[
  {
    "path": ".changeset/config.json",
    "content": "{\n  \"$schema\": \"https://unpkg.com/@changesets/config@3.1.2/schema.json\",\n  \"changelog\": [\n    \"@svitejs/changesets-changelog-github-compact\",\n    { \"repo\": \"TanStack/router\" }\n  ],\n  \"commit\": false,\n  \"access\": \"public\",\n  \"baseBranch\": \"main\",\n  \"updateInternalDependencies\": \"patch\",\n  \"fixed\": [],\n  \"linked\": [],\n  \"ignore\": [],\n  \"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH\": {\n    \"onlyUpdatePeerDependentsWhenOutOfRange\": true\n  }\n}\n"
  },
  {
    "path": ".devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": ".gitattributes",
    "content": "# Auto detect text files and perform LF normalization\n* text=auto\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: tannerlinsley\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.yml",
    "content": "name: 🐛 Bug Report\ndescription: Create a report to help us improve\nbody:\n  - type: markdown\n    attributes:\n      value: |\n        Thank you for reporting an issue :pray:.\n\n        This issue tracker is for reporting bugs found in `router` (https://github.com/tanstack/router).\n        If you have a question about how to achieve something and are struggling, please post a question\n        inside of `router` Discussions tab: https://github.com/tanstack/router/discussions\n\n        Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already:\n         - `router` Issues tab: https://github.com/tanstack/router/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc\n         - `router` closed issues tab: https://github.com/tanstack/router/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed\n         - `router` Discussions tab: https://github.com/tanstack/router/discussions\n\n        The more information you fill in, the better the community can help you.\n  - type: dropdown\n    id: project\n    attributes:\n      label: Which project does this relate to?\n      description: If you are unsure, please leave this as \"Router\".\n      options:\n        - Router\n        - Start\n    validations:\n      required: true\n  - type: textarea\n    id: description\n    attributes:\n      label: Describe the bug\n      description: Provide a clear and concise description of the challenge you are running into.\n    validations:\n      required: true\n  - type: input\n    id: link\n    attributes:\n      label: Your Example Website or App\n      description: |\n        Which website or app were you using when the bug happened?\n        Note:\n        - 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.\n        - 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.\n        - To create a shareable code example you can use Stackblitz. Please no localhost URLs.\n        - Please read these tips for providing a minimal example: https://stackoverflow.com/help/mcve.\n      placeholder: reproduction URL\n    validations:\n      required: true\n  - type: textarea\n    id: steps\n    attributes:\n      label: Steps to Reproduce the Bug or Issue\n      description: Describe the steps we have to take to reproduce the behavior.\n      placeholder: |\n        1. Go to '...'\n        2. Click on '....'\n        3. Scroll down to '....'\n        4. See error\n    validations:\n      required: true\n  - type: textarea\n    id: expected\n    attributes:\n      label: Expected behavior\n      description: Provide a clear and concise description of what you expected to happen.\n      placeholder: |\n        As a user, I expected ___ behavior but i am seeing ___\n    validations:\n      required: true\n  - type: textarea\n    id: screenshots_or_videos\n    attributes:\n      label: Screenshots or Videos\n      description: |\n        If applicable, add screenshots or a video to help explain your problem.\n        For more information on the supported file image/file types and the file size limits, please refer\n        to the following link: https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/attaching-files\n      placeholder: |\n        You can drag your video or image files inside of this editor ↓\n  - type: textarea\n    id: platform\n    attributes:\n      label: Platform\n      value: |\n        - Router / Start Version: [e.g. 1.121.0]\n        - OS: [e.g. macOS, Windows, Linux]\n        - Browser: [e.g. Chrome, Safari, Firefox]\n        - Browser Version: [e.g. 91.1]\n        - Bundler: [e.g. vite]\n        - Bundler Version: [e.g. 7.0.0]\n    validations:\n      required: true\n  - type: textarea\n    id: additional\n    attributes:\n      label: Additional context\n      description: Add any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: false\ncontact_links:\n  - name: 🤔 Feature Requests & Questions\n    url: https://github.com/TanStack/router/discussions\n    about: Please ask and answer questions here.\n  - name: 💬 Community Chat\n    url: https://discord.gg/mQd7egN\n    about: A dedicated discord server hosted by TanStack\n  - name: 🦋 TanStack Bluesky\n    url: https://bsky.app/profile/tanstack.com\n    about: Stay up to date with new releases of our libraries\n"
  },
  {
    "path": ".github/renovate.json",
    "content": "{\n  \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n  \"configMigration\": true,\n  \"extends\": [\n    \"config:recommended\",\n    \"group:allNonMajor\",\n    \"schedule:weekly\",\n    \":approveMajorUpdates\",\n    \":automergeMinor\",\n    \":disablePeerDependencies\",\n    \":maintainLockFilesMonthly\",\n    \":semanticCommits\",\n    \":semanticCommitTypeAll(chore)\"\n  ],\n  \"ignorePresets\": [\":ignoreModulesAndTests\"],\n  \"labels\": [\"dependencies\"],\n  \"rangeStrategy\": \"bump\",\n  \"postUpdateOptions\": [\"pnpmDedupe\"],\n  \"ignoreDeps\": [\n    \"@types/node\",\n    \"@types/react\",\n    \"@types/react-dom\",\n    \"h3\",\n    \"node\",\n    \"react\",\n    \"react-dom\",\n    \"react-server-dom-webpack\",\n    \"temp-react\",\n    \"temp-react-dom\",\n    \"typescript\",\n    \"typescript52\",\n    \"typescript53\",\n    \"typescript54\",\n    \"typescript55\",\n    \"typescript56\",\n    \"unplugin\",\n    \"use-sync-external-store\",\n    \"waku\"\n  ]\n}\n"
  },
  {
    "path": ".github/workflows/autofix.yml",
    "content": "name: autofix.ci # needed to securely identify the workflow\n\non:\n  pull_request:\n  push:\n    branches: [main, alpha, beta]\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.event.number || github.ref }}\n  cancel-in-progress: true\n\npermissions:\n  contents: read\n\njobs:\n  autofix:\n    name: autofix\n    runs-on: ubuntu-latest\n    if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n      - name: Setup Tools\n        uses: TanStack/config/.github/setup@main\n      - name: Fix formatting\n        run: pnpm format\n      - name: Generate labeler config\n        run: pnpm labeler-generate\n      - name: Apply fixes\n        uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27\n        with:\n          commit-message: 'ci: apply automated fixes'\n"
  },
  {
    "path": ".github/workflows/bundle-size.yml",
    "content": "name: Bundle Size\n\non:\n  # We use `pull_request_target` to split trust boundaries across jobs:\n  # - `benchmark-pr` checks out PR merge code and runs it as untrusted with read-only permissions.\n  # - `comment-pr` runs trusted base-repo code with limited write access to upsert the PR comment.\n  pull_request_target:\n    paths:\n      - 'packages/**'\n      - 'benchmarks/**'\n  push:\n    branches: [main]\n    paths:\n      - 'packages/**'\n      - 'benchmarks/**'\n  workflow_dispatch:\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.event.number || github.ref }}\n  cancel-in-progress: true\n\npermissions:\n  contents: read\n\nenv:\n  NX_NO_CLOUD: true\njobs:\n  benchmark-pr:\n    name: Benchmark PR\n    if: github.event_name == 'pull_request_target'\n    runs-on: ubuntu-latest\n    outputs:\n      current_json_b64: ${{ steps.capture.outputs.current_json_b64 }}\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n        with:\n          ref: refs/pull/${{ github.event.pull_request.number }}/merge\n          fetch-depth: 0\n          persist-credentials: false\n\n      - name: Setup Tools\n        uses: TanStack/config/.github/setup@main\n\n      - name: Measure Bundle Size\n        run: pnpm nx run @benchmarks/bundle-size:build --outputStyle=stream --skipRemoteCache\n\n      - name: Capture Benchmark Outputs\n        id: capture\n        run: |\n          {\n            echo \"current_json_b64=$(base64 -w 0 < benchmarks/bundle-size/results/current.json)\"\n          } >> \"$GITHUB_OUTPUT\"\n\n  comment-pr:\n    name: Upsert PR Comment\n    if: github.event_name == 'pull_request_target'\n    runs-on: ubuntu-latest\n    needs: benchmark-pr\n    permissions:\n      contents: read\n      pull-requests: write\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n        with:\n          fetch-depth: 0\n          persist-credentials: false\n\n      - name: Restore Benchmark Outputs\n        env:\n          CURRENT_JSON_B64: ${{ needs.benchmark-pr.outputs.current_json_b64 }}\n        run: |\n          mkdir -p benchmarks/bundle-size/results\n          node -e \"const fs=require('node:fs'); fs.writeFileSync('benchmarks/bundle-size/results/current.json', Buffer.from(process.env.CURRENT_JSON_B64 || '', 'base64'))\"\n\n      - name: Read Historical Data (if available)\n        run: |\n          mkdir -p benchmarks/bundle-size/results\n          if git fetch --depth=1 origin gh-pages; then\n            if git show origin/gh-pages:benchmarks/bundle-size/data.js > benchmarks/bundle-size/results/history-data.js 2>/dev/null; then\n              echo \"Loaded bundle-size history from gh-pages.\"\n            else\n              rm -f benchmarks/bundle-size/results/history-data.js\n              echo \"No bundle-size history found on gh-pages yet.\"\n            fi\n          fi\n\n      - name: Build PR Report\n        run: |\n          node scripts/benchmarks/bundle-size/pr-report.mjs \\\n            --current benchmarks/bundle-size/results/current.json \\\n            --history benchmarks/bundle-size/results/history-data.js \\\n            --output benchmarks/bundle-size/results/pr-comment.md \\\n            --base-sha \"${{ github.event.pull_request.base.sha }}\" \\\n            --dashboard-url \"https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/benchmarks/bundle-size/\"\n\n      - name: Upsert Sticky PR Comment\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        run: |\n          node scripts/benchmarks/common/upsert-pr-comment.mjs \\\n            --pr \"${{ github.event.pull_request.number }}\" \\\n            --body-file benchmarks/bundle-size/results/pr-comment.md\n\n  benchmark-main:\n    name: Publish Bundle Size History\n    if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'TanStack'\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n        with:\n          fetch-depth: 0\n\n      - name: Setup Tools\n        uses: TanStack/config/.github/setup@main\n\n      - name: Measure Bundle Size\n        run: pnpm nx run @benchmarks/bundle-size:build --outputStyle=stream --skipRemoteCache\n      - name: Publish Benchmark Dashboard\n        uses: benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b # v1.20.7\n        with:\n          tool: customSmallerIsBetter\n          name: Bundle Size (gzip)\n          output-file-path: benchmarks/bundle-size/results/benchmark-action.json\n          github-token: ${{ secrets.GITHUB_TOKEN }}\n          auto-push: true\n          gh-pages-branch: gh-pages\n          benchmark-data-dir-path: benchmarks/bundle-size\n          max-items-in-chart: 200\n          summary-always: true\n          comment-on-alert: false\n          fail-on-alert: false\n"
  },
  {
    "path": ".github/workflows/check-skills.yml",
    "content": "# check-skills.yml — Drop this into your library repo's .github/workflows/\n#\n# Checks for stale intent skills after a release and opens a review PR\n# if any skills need attention. The PR body includes a prompt you can\n# paste into Claude Code, Cursor, or any coding agent to update them.\n#\n# Triggers: new release published, or manual workflow_dispatch.\n#\n# Template variables (replaced by `intent setup`):\n#   @tanstack/react-router  — e.g. @tanstack/query\n#\n# Adapted for TanStack Router monorepo: loops over all packages with skills.\n\nname: Check Skills\n\non:\n  release:\n    types: [published]\n  workflow_dispatch: {}\n\npermissions:\n  contents: write\n  pull-requests: write\n\njobs:\n  check:\n    name: Check for stale skills\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - name: Setup Node\n        uses: actions/setup-node@v4\n        with:\n          node-version: 20\n\n      - name: Install intent CLI\n        run: npm install -g @tanstack/intent\n\n      - name: Install dependencies\n        run: npm install --ignore-scripts\n        env:\n          npm_config_legacy_peer_deps: 'true'\n\n      - name: Check staleness\n        id: stale\n        run: |\n          # Monorepo: collect stale reports from all packages with skills\n          ALL_OUTPUT=\"[\"\n          FIRST=true\n          for dir in packages/*/; do\n            if [ -d \"$dir/skills\" ]; then\n              PKG_OUTPUT=$(cd \"$dir\" && npx @tanstack/intent stale --json 2>/dev/null) || true\n              if [ -n \"$PKG_OUTPUT\" ] && [ \"$PKG_OUTPUT\" != \"[]\" ] && [ \"$PKG_OUTPUT\" != \"No intent-enabled packages found.\" ]; then\n                if [ \"$FIRST\" = true ]; then\n                  FIRST=false\n                else\n                  ALL_OUTPUT=\"${ALL_OUTPUT},\"\n                fi\n                # Strip outer brackets and append entries\n                ENTRIES=$(echo \"$PKG_OUTPUT\" | node -e \"\n                  const input = require('fs').readFileSync('/dev/stdin','utf8').trim();\n                  try { const arr = JSON.parse(input); process.stdout.write(JSON.stringify(arr).slice(1, -1)); } catch {}\n                \")\n                ALL_OUTPUT=\"${ALL_OUTPUT}${ENTRIES}\"\n              fi\n            fi\n          done\n          ALL_OUTPUT=\"${ALL_OUTPUT}]\"\n\n          echo \"$ALL_OUTPUT\"\n\n          # Check if any skills need review\n          NEEDS_REVIEW=$(echo \"$ALL_OUTPUT\" | node -e \"\n            const input = require('fs').readFileSync('/dev/stdin','utf8');\n            try {\n              const reports = JSON.parse(input);\n              const stale = reports.flatMap(r =>\n                r.skills.filter(s => s.needsReview).map(s => ({ library: r.library, skill: s.name, reasons: s.reasons }))\n              );\n              if (stale.length > 0) {\n                console.log(JSON.stringify(stale));\n              }\n            } catch {}\n          \")\n\n          if [ -z \"$NEEDS_REVIEW\" ]; then\n            echo \"has_stale=false\" >> \"$GITHUB_OUTPUT\"\n          else\n            echo \"has_stale=true\" >> \"$GITHUB_OUTPUT\"\n            # Escape for multiline GH output\n            EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)\n            echo \"stale_json<<$EOF\" >> \"$GITHUB_OUTPUT\"\n            echo \"$NEEDS_REVIEW\" >> \"$GITHUB_OUTPUT\"\n            echo \"$EOF\" >> \"$GITHUB_OUTPUT\"\n          fi\n\n      - name: Build summary\n        if: steps.stale.outputs.has_stale == 'true'\n        id: summary\n        run: |\n          node -e \"\n            const stale = JSON.parse(process.env.STALE_JSON);\n            const lines = stale.map(s =>\n              '- **' + s.skill + '** (' + s.library + '): ' + s.reasons.join(', ')\n            );\n            const summary = lines.join('\\n');\n\n            const prompt = [\n              'Review and update the following stale intent skills for TanStack Router:',\n              '',\n              ...stale.map(s => '- ' + s.skill + ': ' + s.reasons.join(', ')),\n              '',\n              'For each stale skill:',\n              '1. Read the current SKILL.md file',\n              '2. Check what changed in the library since the skill was last updated',\n              '3. Update the skill content to reflect current APIs and behavior',\n              '4. Run \\`npx @tanstack/intent validate\\` to verify the updated skill',\n            ].join('\\n');\n\n            // Write outputs\n            const fs = require('fs');\n            const env = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8');\n            const eof = require('crypto').randomBytes(15).toString('base64');\n            fs.appendFileSync(process.env.GITHUB_OUTPUT,\n              'summary<<' + eof + '\\n' + summary + '\\n' + eof + '\\n' +\n              'prompt<<' + eof + '\\n' + prompt + '\\n' + eof + '\\n'\n            );\n          \"\n        env:\n          STALE_JSON: ${{ steps.stale.outputs.stale_json }}\n\n      - name: Open review PR\n        if: steps.stale.outputs.has_stale == 'true'\n        env:\n          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n        run: |\n          VERSION=\"${{ github.event.release.tag_name || 'manual' }}\"\n          BRANCH=\"skills/review-${VERSION}\"\n\n          git config user.name \"github-actions[bot]\"\n          git config user.email \"41898282+github-actions[bot]@users.noreply.github.com\"\n          git checkout -b \"$BRANCH\"\n          git commit --allow-empty -m \"chore: review stale skills for ${VERSION}\"\n          git push origin \"$BRANCH\"\n\n          gh pr create \\\n            --title \"Review stale skills (${VERSION})\" \\\n            --body \"$(cat <<'PREOF'\n          ## Stale Skills Detected\n\n          The following skills may need updates after the latest release:\n\n          ${{ steps.summary.outputs.summary }}\n\n          ---\n\n          ### Update Prompt\n\n          Paste this into your coding agent (Claude Code, Cursor, etc.):\n\n          ~~~\n          ${{ steps.summary.outputs.prompt }}\n          ~~~\n\n          PREOF\n          )\" \\\n            --head \"$BRANCH\" \\\n            --base main\n"
  },
  {
    "path": ".github/workflows/client-nav-benchmarks.yml",
    "content": "# Setup taken from https://codspeed.io/docs/benchmarks/nodejs/vitest\nname: Benchmarks\n\non:\n  push:\n    branches:\n      - 'main'\n    paths:\n      - 'packages/**'\n      - 'benchmarks/**'\n  pull_request:\n    paths:\n      - 'packages/**'\n      - 'benchmarks/**'\n  workflow_dispatch:\n\npermissions:\n  contents: read # required for actions/checkout\n  id-token: write # required for OIDC authentication with CodSpeed\n\nenv:\n  NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}\n  SERVER_PRESET: 'node-server'\n  NX_NO_CLOUD: true\n\njobs:\n  benchmarks:\n    name: Run ${{ matrix.benchmark }}:${{ matrix.framework }} CodSpeed benchmark\n    strategy:\n      fail-fast: false\n      matrix:\n        framework:\n          - react\n          - solid\n          - vue\n        benchmark:\n          - client-nav\n          - ssr\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n\n      - name: Setup Tools\n        uses: TanStack/config/.github/setup@main\n\n      - name: Run ${{ matrix.benchmark }}:${{ matrix.framework }} CodSpeed benchmark\n        continue-on-error: true\n        uses: CodSpeedHQ/action@v4\n        with:\n          mode: simulation\n          run: WITH_INSTRUMENTATION=1 pnpm nx run @benchmarks/${{ matrix.benchmark }}:test:perf:${{ matrix.framework }}\n"
  },
  {
    "path": ".github/workflows/labeler.yml",
    "content": "name: Labeler\n\non:\n  pull_request_target:\n\npermissions:\n  contents: read\n  pull-requests: write\n\njobs:\n  labeler:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Labeller\n        uses: actions/labeler@v6.0.1\n        with:\n          repo-token: ${{ secrets.GITHUB_TOKEN }}\n          configuration-path: labeler-config.yml\n"
  },
  {
    "path": ".github/workflows/notify-playbooks.yml",
    "content": "# notify-intent.yml — Drop this into your library repo's .github/workflows/\n#\n# Fires a repository_dispatch event to TanStack/intent whenever docs or\n# source files change on merge to main. This triggers the skill staleness\n# check workflow in the intent repo.\n#\n# Requirements:\n#   - A fine-grained PAT with contents:write on TanStack/intent stored\n#     as the INTENT_NOTIFY_TOKEN repository secret.\n#\n# Template variables (replaced by `intent setup`):\n#   @tanstack/react-router  — e.g. @tanstack/query\n#   docs/**     — e.g. docs/**\n#   packages/*/src/**      — e.g. packages/query-core/src/**\n#\n# Adapted for TanStack Router monorepo: watches all packages.\n\nname: Notify Intent\n\non:\n  push:\n    branches: [main]\n    paths:\n      - 'docs/**'\n      - 'packages/*/src/**'\n\njobs:\n  notify:\n    name: Notify TanStack Intent\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 2\n\n      - name: Collect changed files\n        id: changes\n        run: |\n          FILES=$(git diff --name-only HEAD~1 HEAD | jq -R -s -c 'split(\"\\n\") | map(select(length > 0))')\n          echo \"files=$FILES\" >> \"$GITHUB_OUTPUT\"\n\n      - name: Dispatch to intent repo\n        uses: peter-evans/repository-dispatch@v3\n        with:\n          token: ${{ secrets.INTENT_NOTIFY_TOKEN }}\n          repository: TanStack/intent\n          event-type: skill-check\n          client-payload: |\n            {\n              \"package\": \"@tanstack/router\",\n              \"sha\": \"${{ github.sha }}\",\n              \"changed_files\": ${{ steps.changes.outputs.files }}\n            }\n"
  },
  {
    "path": ".github/workflows/pr.yml",
    "content": "name: PR\n\non:\n  pull_request:\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.event.number || github.ref }}\n  cancel-in-progress: true\n\nenv:\n  NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}\n  SERVER_PRESET: 'node-server'\n\npermissions:\n  contents: read\n  pull-requests: write\n\njobs:\n  test:\n    name: Test\n    runs-on: ubuntu-latest\n    env:\n      TSR_TMP_DIR: ./tmp\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n        with:\n          fetch-depth: 0\n      - name: Start Nx Agents\n        run: npx nx-cloud start-ci-run --distribute-on=\".nx/workflows/dynamic-changesets.yaml\"\n      - name: Setup Tools\n        uses: TanStack/config/.github/setup@main\n      - name: Get base and head commits for `nx affected`\n        uses: nrwl/nx-set-shas@v4.4.0\n        with:\n          main-branch-name: main\n      - name: Run Checks\n        run: pnpm run test:pr --parallel=3\n      - name: Stop Nx Agents\n        if: ${{ always() }}\n        run: npx nx-cloud stop-all-agents\n  preview:\n    name: Preview\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n        with:\n          fetch-depth: 0\n      - name: Setup Tools\n        uses: TanStack/config/.github/setup@main\n      - name: Build Packages\n        run: pnpm run build:all\n      - name: Publish Previews\n        run: pnpx pkg-pr-new publish --pnpm './packages/*' --template './examples/*/*'\n  version-preview:\n    name: Version Preview\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n      - name: Setup Tools\n        uses: TanStack/config/.github/setup@main\n      - name: Changeset Preview\n        uses: TanStack/config/.github/changeset-preview@main\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Release\n\non:\n  push:\n    branches: [main, '*-pre', '*-maint']\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: false\n\nenv:\n  NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}\n  SERVER_PRESET: 'node-server'\n\npermissions:\n  contents: write\n  id-token: write\n  pull-requests: write\n\njobs:\n  release:\n    name: Release\n    if: \"!contains(github.event.head_commit.message, 'ci: changeset release')\"\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6.0.2\n        with:\n          fetch-depth: 0\n      - name: Check for changesets\n        id: changesets\n        run: |\n          CHANGESET_FILES=$(ls .changeset/*.md 2>/dev/null | grep -v README.md || true)\n          if [ -z \"$CHANGESET_FILES\" ]; then\n            echo \"has_changesets=false\" >> \"$GITHUB_OUTPUT\"\n          else\n            echo \"has_changesets=true\" >> \"$GITHUB_OUTPUT\"\n          fi\n      - name: Start Nx Agents\n        if: steps.changesets.outputs.has_changesets == 'true'\n        run: npx nx-cloud start-ci-run --distribute-on=\".nx/workflows/dynamic-changesets.yaml\"\n      - name: Setup Tools\n        uses: TanStack/config/.github/setup@main\n      - name: Run Tests\n        if: steps.changesets.outputs.has_changesets == 'true'\n        run: pnpm run test:ci --parallel=3\n      - name: Stop Nx Agents\n        if: ${{ always() && steps.changesets.outputs.has_changesets == 'true' }}\n        run: npx nx-cloud stop-all-agents\n      - name: Enter Pre-Release Mode\n        if: \"contains(github.ref_name, '-pre') && !hashFiles('.changeset/pre.json')\"\n        run: pnpm changeset pre enter pre\n      - name: Version Packages\n        run: pnpm run changeset:version\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      - name: Commit and Push Version Changes\n        id: commit\n        run: |\n          git config user.name \"github-actions[bot]\"\n          git config user.email \"github-actions[bot]@users.noreply.github.com\"\n          git add .\n          if git commit -m \"ci: changeset release\"; then\n            git push\n            echo \"committed=true\" >> \"$GITHUB_OUTPUT\"\n          fi\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n      - name: Determine dist-tag\n        if: steps.commit.outputs.committed == 'true'\n        id: dist-tag\n        run: |\n          BRANCH=\"${GITHUB_REF_NAME}\"\n          if [[ \"$BRANCH\" == *-pre ]]; then\n            echo \"prerelease=true\" >> \"$GITHUB_OUTPUT\"\n          elif [[ \"$BRANCH\" == *-maint ]]; then\n            echo \"tag=maint\" >> \"$GITHUB_OUTPUT\"\n          else\n            echo \"latest=true\" >> \"$GITHUB_OUTPUT\"\n          fi\n      - name: Publish Packages\n        if: steps.commit.outputs.committed == 'true'\n        run: pnpm run changeset:publish ${{ steps.dist-tag.outputs.tag && format('--tag {0}', steps.dist-tag.outputs.tag) }}\n      - name: Create GitHub Release\n        if: steps.commit.outputs.committed == 'true'\n        run: node scripts/create-github-release.mjs ${{ steps.dist-tag.outputs.prerelease == 'true' && '--prerelease' }} ${{ steps.dist-tag.outputs.latest == 'true' && '--latest' }}\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/validate-skills.yml",
    "content": "# validate-skills.yml — Drop this into your library repo's .github/workflows/\n#\n# Validates skill files on PRs that touch the skills/ directory.\n# Ensures frontmatter is correct, names match paths, and files stay under\n# the 500-line limit.\n\nname: Validate Skills\n\non:\n  pull_request:\n    paths:\n      - 'skills/**'\n      - '**/skills/**'\n\njobs:\n  validate:\n    name: Validate skill files\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - name: Setup Node\n        uses: actions/setup-node@v4\n        with:\n          node-version: 20\n\n      - name: Install intent CLI\n        run: npm install -g @tanstack/intent\n\n      - name: Find and validate skills\n        run: |\n          # Find all directories containing SKILL.md files\n          SKILLS_DIR=\"\"\n          if [ -d \"skills\" ]; then\n            SKILLS_DIR=\"skills\"\n          elif [ -d \"packages\" ]; then\n            # Monorepo — find skills/ under packages\n            for dir in packages/*/skills; do\n              if [ -d \"$dir\" ]; then\n                echo \"Validating $dir...\"\n                intent validate \"$dir\"\n              fi\n            done\n            exit 0\n          fi\n\n          if [ -n \"$SKILLS_DIR\" ]; then\n            intent validate \"$SKILLS_DIR\"\n          else\n            echo \"No skills/ directory found — skipping validation.\"\n          fi\n"
  },
  {
    "path": ".gitignore",
    "content": ".vite\n# See https://help.github.com/ignore-files/ for more about ignoring files.\n\n# dependencies\nnode_modules\npackage-lock.json\nyarn.lock\n\n# builds\ntypes\nbuild\n*/build\ndist\n.output\nlib\nes\nartifacts\n.rpt2_cache\ncoverage\n*.tgz\n.wrangler\n\n# tests\npackages/router-generator/tests/**/*.gen.ts\npackages/router-generator/tests/**/*.gen.js\n**/port*.txt\n**/test-results/\n\n# Playwright artifacts\n**/playwright-report/\n**/blob-report/\n\n# misc\n.DS_Store\n.env\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n.next\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n.history\nsize-plugin.json\nstats-hydration.json\nstats-react.json\nstats.html\n.vscode/settings.json\n\n*.log\n.DS_Store\n.cache\n.pnpm-store\nts-perf\n\n/examples/*/*/yarn.lock\n/examples/*/*/package-lock.json\n\n.netlify\n\nnx-cloud.env\n.nx/cache\n.nx/workspace-data\n\ngpt/db.json\n\nvite.config.timestamp-*\nvite.config.js.timestamp-*\nvite.config.ts.timestamp-*\n\nvite.config.timestamp_*\nvite.config.js.timestamp_*\nvite.config.ts.timestamp_*\n\n.idea\n*.vitest-temp.json\n\n# Handling VSCode settings\n/.vscode/\n!/examples/react/**/.vscode/settings.json\n\n**/llms\n\n**/.tanstack\n"
  },
  {
    "path": ".npmrc",
    "content": "provenance=true\n"
  },
  {
    "path": ".nvmrc",
    "content": "24.8.0\n"
  },
  {
    "path": ".nx/workflows/dynamic-changesets.yaml",
    "content": "distribute-on:\n  small-changeset: 3 linux-medium-js\n  medium-changeset: 6 linux-medium-js\n  large-changeset: 10 linux-medium-js\n"
  },
  {
    "path": ".prettierignore",
    "content": "**/.next\n**/.nx/cache\n**/.svelte-kit\n**/build\n**/coverage\n**/dist\npnpm-lock.yaml\n**/snapshots\n**/.vercel\n**/.output\n**/node_modules\nnode_modules\n\n**/test-results\n**/tests/generator/file-modification/routes/(test)/*\n**/tests/generator/**/routeTree*.snapshot.ts\n/.nx/workspace-data\n**/src/routeTree.gen.ts\n"
  },
  {
    "path": "AGENTS.md",
    "content": "# AGENTS.md\n\n## Project overview\n\nTanStack Router is a type-safe router with built-in caching and URL state management for React and Solid applications. This monorepo contains two main products:\n\n- **TanStack Router** - Core routing library with type-safe navigation, search params, and path params\n- **TanStack Start** - Full-stack framework built on top of TanStack Router\n\n## Setup commands\n\n- Install deps: `pnpm install`\n- Setup e2e testing: `pnpm exec playwright install`\n- Build packages: `pnpm build` (affected) or `pnpm build:all` (force all)\n- Start dev server: `pnpm dev`\n- Run tests: `pnpm test`\n\n## Code style\n\n- TypeScript strict mode with extensive type safety\n- Framework-agnostic core logic separated from React/Solid bindings\n- Type-safe routing with search params and path params\n- Use workspace protocol for internal dependencies (`workspace:*`)\n\n## Dev environment tips\n\n- This is a pnpm workspace monorepo with packages organized by functionality\n- Nx provides caching, affected testing, targeting, and parallel execution for efficiency\n- Use `pnpm nx show projects` to list all available packages\n- Target specific packages: `pnpm nx run @tanstack/react-router:test:unit`\n- Target multiple packages: `pnpm nx run-many --target=test:eslint --projects=@tanstack/history,@tanstack/router-core`\n- Run affected tests only: `pnpm nx affected --target=test:unit`\n- Exclude patterns: `pnpm nx run-many --target=test:unit --exclude=\"examples/**,e2e/**\"`\n- Navigate to examples and run `pnpm dev` to test changes: `cd examples/react/basic && pnpm dev`\n- **Granular unit testing through Nx (recommended):**\n  - Specific files: `pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx tests/Scripts.test.tsx`\n  - Test patterns: `pnpm nx run @tanstack/react-router:test:unit -- tests/ClientOnly.test.tsx -t \"should render fallback\"`\n  - Name patterns: `pnpm nx run @tanstack/react-router:test:unit -- -t \"navigation\"` (all tests with \"navigation\" in name)\n  - Exclude patterns: `pnpm nx run @tanstack/react-router:test:unit -- --exclude=\"**/*link*\" tests/`\n  - List tests: `pnpm nx run @tanstack/react-router:test:unit -- list tests/link.test.tsx` (or `-- list` for all)\n- **Available test targets per package:** `test:unit`, `test:types`, `test:eslint`, `test:build`, `test:perf`, `build`\n- **Testing strategy:** Package level (nx) → File-level args via nx → Test-level args (`-t`) via nx → Pattern-level args (`--exclude`) via nx\n- **Agent execution guardrails (important):**\n  - Always prefer `pnpm nx ...` over `npx nx ...`.\n  - Prefer Nx targets over direct test runners so task dependencies (including required builds) remain in the graph.\n  - In sandbox, run Nx with `CI=1 NX_DAEMON=false pnpm nx run <project>:<target> --outputStyle=stream --skipRemoteCache`\n  - Run only one Nx command at a time.\n  - If an Nx command shows no output for ~20 seconds, stop, run `pnpm nx reset` once, and retry once.\n  - Do not loop retries indefinitely. If it still hangs or sandbox blocks graph/daemon behavior, request escalation immediately.\n\n## Testing instructions\n\n- **Critical**: Always run unit and type tests during development - do not proceed if they fail\n- **Test types:** `pnpm test:unit`, `pnpm test:types`, `pnpm test:eslint`, `pnpm test:e2e`, `pnpm test:build`\n- **Full CI suite:** `pnpm test:ci`\n- **Fix formatting:** `pnpm format`\n- **Efficient targeted testing workflow:**\n  1. **Affected only:** `pnpm nx affected --target=test:unit` (compares to main branch)\n  2. **Specific packages:** `pnpm nx run @tanstack/react-router:test:unit`\n  3. **Specific files:** `pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx`\n  4. **Specific patterns:** `pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx -t \"preloading\"`\n- **Pro tips:**\n  - Use `pnpm nx run @tanstack/react-router:test:unit -- list` to explore available tests before running\n  - Use `-t \"pattern\"` to focus on specific functionality during development\n  - Use `--exclude` patterns to skip unrelated tests\n  - Keep all test filtering arguments behind `pnpm nx run ... -- ...` for maximum precision while preserving task dependencies\n- **Example workflow:** `pnpm nx run @tanstack/react-router:test:unit` → `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\"`\n\n## PR instructions\n\n- Always run `pnpm test:eslint`, `pnpm test:types`, and `pnpm test:unit` before committing\n- Test changes in relevant example apps: `cd examples/react/basic && pnpm dev`\n- Update corresponding documentation in `docs/` directory when adding features\n- Add or update tests for any code changes\n- Use internal docs links relative to `docs/` folder (e.g., `./guide/data-loading`)\n\n## Package structure\n\n**Core packages:**\n\n- `packages/router-core/` - Framework-agnostic core router logic\n- `packages/react-router/`, `packages/solid-router/` - React/Solid bindings and components\n- `packages/history/` - Browser history management\n\n**Tooling:**\n\n- `packages/router-cli/` - CLI tools for code generation\n- `packages/router-generator/` - Route generation utilities\n- `packages/router-plugin/` - Universal bundler plugins (Vite, Webpack, ESBuild, Rspack)\n- `packages/virtual-file-routes/` - Virtual file routing system\n\n**Developer experience:**\n\n- `packages/router-devtools/`, `packages/*-router-devtools/` - Development tools\n- `packages/eslint-plugin-router/` - ESLint rules for router\n\n**Validation adapters:**\n\n- `packages/zod-adapter/`, `packages/valibot-adapter/`, `packages/arktype-adapter/`\n\n**Start framework:**\n\n- `packages/*-start/`, `packages/start-*/` - Full-stack framework packages\n\n**Examples & testing:**\n\n- `examples/react/`, `examples/solid/` - Example applications (test changes here)\n- `e2e/` - End-to-end tests (requires Playwright)\n- `docs/router/`, `docs/start/` - Documentation with React/Solid subdirectories\n\n**Dependencies:** Uses workspace protocol (`workspace:*`) - core → framework → start packages\n\n## Common development tasks\n\n**Adding new routes:**\n\n- Use file-based routing in `src/routes/` directories\n- Or use code-based routing with route definitions\n- Run route generation with CLI tools\n\n**Testing changes:**\n\n- Build packages: `pnpm build` or `pnpm dev` (watch mode)\n- Run example apps to test functionality\n- Use devtools for debugging router state\n\n**Documentation updates:**\n\n- Update relevant docs in `docs/` directory\n- Ensure examples reflect documentation changes\n- Test documentation links and references\n- Use relative links to `docs/` folder format\n\n## Framework-specific notes\n\n**React:**\n\n- Uses React Router components and hooks\n- Supports React Server Components (RSC)\n- Examples include React Query integration\n- Package: `@tanstack/react-router`\n\n**Solid:**\n\n- Uses Solid Router components and primitives\n- Supports Solid Start for full-stack applications\n- Examples include Solid Query integration\n- Package: `@tanstack/solid-router`\n\n## Environment requirements\n\n- **Node.js** - Required for development\n- **pnpm** - Package manager (required for workspace features)\n- **Playwright** - Required for e2e tests (`pnpm exec playwright install`)\n\n## Key architecture patterns\n\n- **Type Safety**: Extensive TypeScript for type-safe routing\n- **Framework Agnostic**: Core logic separated from framework bindings\n- **Plugin Architecture**: Universal bundler plugins using unplugin\n- **File-based Routing**: Support for both code-based and file-based routing\n- **Search Params**: First-class support for type-safe search parameters\n\n## Development workflow\n\n1. **Setup**: `pnpm install` and `pnpm exec playwright install`\n2. **Build**: `pnpm build:all` or `pnpm dev` for watch mode\n3. **Test**: Make changes and run relevant tests (use nx for targeted testing)\n4. **Examples**: Navigate to examples and run `pnpm dev` to test changes\n5. **Quality**: Run `pnpm test:eslint`, `pnpm test:types`, `pnpm test:unit` before committing\n\n## References\n\n- **Documentation**: https://tanstack.com/router\n- **GitHub**: https://github.com/TanStack/router\n- **Discord Community**: https://discord.com/invite/WrRKjPJ\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\n- Clone the repo\n  - `gh repo clone TanStack/router`\n- Ensure `node` is installed\n  - https://nodejs.org/en/\n- Ensure `pnpm` is installed\n  - https://pnpm.io/installation\n  - Why? We use `pnpm` to manage workspace dependencies. It's easily the best monorepo/workspace experience available as of when this was written.\n- Install dependencies\n  - `pnpm install`\n  - This installs dependencies for all of the packages in the monorepo, even examples!\n  - Dependencies inside of the packages and examples are automatically linked together as local/dynamic dependencies.\n- Install test dependencies\n  - `pnpm exec playwright install` (required for e2e tests)\n- Run the build or dev watcher\n  - `pnpm build:all` (build all packages) or\n  - `pnpm build` (cached build with [nx affected](https://nx.dev/nx-api/nx/documents/affected)) or\n  - `pnpm dev`\n- Navigate to an example\n  - `cd examples/react/basic`\n- Run the example\n  - `pnpm dev`\n- Make changes to the code\n  - If you ran `pnpm dev` the dev watcher will automatically rebuild the code that has changed\n- Editing the docs locally and previewing the changes\n  - The documentations for all the TanStack projects are hosted on [tanstack.com](https://tanstack.com), which is a TanStack Start application (https://github.com/TanStack/tanstack.com). You need to run this app locally to preview your changes in the `TanStack/router` docs.\n\n> [!NOTE]\n> 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`.\n\nYou can follow these steps to set up the docs for local development:\n\n1. Make a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter that directory and clone the [`TanStack/router`](https://github.com/TanStack/router) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/router.git\n# We probably don't need all the branches and commit history\n# from the `tanstack.com` repo, so let's just create a shallow\n# clone of the latest version of the `main` branch.\n# Read more about shallow clones here:\n# https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones\ngit clone git@github.com:TanStack/tanstack.com.git --depth=1 --single-branch --branch=main\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- router/ (<-- this directory cannot be called anything else!)\n>    |\n>    +-- tanstack.com/\n> ```\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. 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.\n\n> [!WARNING]\n> You will need to update the `docs/(router or start)config.json` file (in `TanStack/router`) if you add a new documentation page!\n\nYou can see the whole process in the screen capture below:\n\nhttps://github.com/fulopkovacs/form/assets/43729152/9d35a3c3-8153-4e74-9cb2-af275f7a269b\n"
  },
  {
    "path": "DEBUGGING.md",
    "content": "# Debugging & Testing Guide\n\n_A practical guide for debugging complex issues and running tests effectively, learned from investigating production regressions in large codebases._\n\n## Quick Start Debugging Checklist\n\nWhen you encounter a bug report or failing test:\n\n1. **Reproduce first** - Create a minimal test case that demonstrates the exact issue\n2. **Establish baseline** - Run existing tests to see what currently works/breaks\n3. **Add targeted logging** - Insert debug output at key decision points\n4. **Trace the data flow** - Follow the path from input to unexpected output\n5. **Check recent changes** - Look for version changes mentioned in bug reports\n6. **Test your hypothesis** - Make small, targeted changes and validate each step\n\n## Essential Testing Commands\n\n### Monorepo with Nx\n\n```bash\n# Run all tests for a package\nnpx nx test:unit @package-name\n\n# Run specific test file\nnpx nx test:unit @package-name -- --run path/to/test.test.tsx\n\n# Run tests matching a pattern\nnpx nx test:unit @package-name -- --run \"pattern-in-test-name\"\n\n# Run with verbose output\nnpx nx test:unit @package-name -- --run --verbose\n```\n\n### Standard npm/yarn projects\n\n```bash\n# Run specific test file\nnpm test -- --run path/to/test.test.tsx\nyarn test path/to/test.test.tsx\n\n# Run tests matching pattern\nnpm test -- --grep \"test pattern\"\n```\n\n### Useful test flags\n\n```bash\n# Run only (don't watch for changes)\n--run\n\n# Show full output including console.logs\n--verbose\n\n# Run in specific environment\n--environment=jsdom\n```\n\n## Effective Debugging Strategies\n\n### 1. Strategic Logging\n\n```javascript\n// Use distinctive prefixes for easy filtering\nconsole.log('[DEBUG useNavigate] from:', from, 'to:', to)\nconsole.log('[DEBUG router] current location:', state.location.pathname)\n\n// Log both input and output of functions\nconsole.log('[DEBUG buildLocation] input:', dest)\n// ... function logic ...\nconsole.log('[DEBUG buildLocation] output:', result)\n```\n\n**Pro tip:** Use `[DEBUG componentName]` prefixes so you can easily filter logs in browser dev tools.\n\n### 2. Reproduction Test Pattern\n\n```javascript\ntest('should reproduce the exact issue from bug report', async () => {\n  // Set up the exact scenario described\n  const router = createRouter({\n    /* exact config from bug report */\n  })\n\n  // Perform the exact user actions\n  await navigate({ to: '/initial-route' })\n  await navigate({ to: '.', search: { param: 'value' } })\n\n  // Assert the expected vs actual behavior\n  expect(router.state.location.pathname).toBe('/expected')\n  // This should fail initially, proving reproduction\n})\n```\n\n### 3. Data Flow Tracing\n\n```\nUser Action → Hook Call → Router Logic → State Update → UI Update\n     ↓            ↓           ↓           ↓          ↓\n  onClick()  → useNavigate() → buildLocation() → setState() → re-render\n```\n\nAdd logging at each step to see where the flow diverges from expectations.\n\n## Common Pitfalls & Solutions\n\n### React Testing Issues\n\n**Problem:** State updates not reflected in tests\n\n```javascript\n// ❌ Bad - missing act() wrapper\nfireEvent.click(button)\nexpect(component.state).toBe(newValue)\n\n// ✅ Good - wrapped in act()\nact(() => {\n  fireEvent.click(button)\n})\nexpect(component.state).toBe(newValue)\n```\n\n**Problem:** Async operations not completing\n\n```javascript\n// ❌ Bad - not waiting for async\nconst result = await someAsyncOperation()\nexpect(result).toBe(expected)\n\n// ✅ Good - ensuring completion\nawait act(async () => {\n  await someAsyncOperation()\n})\nexpect(result).toBe(expected)\n```\n\n### React Router Specific Issues\n\n**Context vs Location confusion:**\n\n- `useMatch({ strict: false })` returns the **component's route context**\n- `router.state.location.pathname` returns the **current URL**\n- These can be different when components are rendered by parent routes\n\n```javascript\n// Component rendered by parent route \"/\" but URL is \"/child\"\nconst match = useMatch({ strict: false }) // Returns \"/\" context\nconst location = router.state.location.pathname // Returns \"/child\"\n```\n\n## Search & Investigation Commands\n\n### Finding relevant code\n\n```bash\n# Search for specific patterns in TypeScript/JavaScript files\ngrep -r \"navigate.*to.*\\.\" --include=\"*.ts\" --include=\"*.tsx\" .\n\n# Find files related to a feature\nfind . -name \"*navigate*\" -type f\n\n# Search with ripgrep (faster)\nrg \"useNavigate\" --type typescript\n```\n\n### Git investigation\n\n```bash\n# Find when a specific line was changed\ngit blame path/to/file.ts\n\n# See recent changes to a file\ngit log --oneline -10 path/to/file.ts\n\n# Search commit messages\ngit log --grep=\"navigation\" --oneline\n```\n\n## Testing Best Practices\n\n### Test Structure\n\n```javascript\ndescribe('Feature', () => {\n  beforeEach(() => {\n    // Reset state for each test\n    cleanup()\n    history = createBrowserHistory()\n  })\n\n  test('should handle specific scenario', async () => {\n    // Arrange - set up the test conditions\n    const router = createRouter(config)\n\n    // Act - perform the action being tested\n    await act(async () => {\n      navigate({ to: '/target' })\n    })\n\n    // Assert - verify the results\n    expect(router.state.location.pathname).toBe('/target')\n  })\n})\n```\n\n### Multiple Assertions\n\n```javascript\ntest('navigation should update both path and search', async () => {\n  await navigate({ to: '/page', search: { q: 'test' } })\n\n  // Test multiple aspects\n  expect(router.state.location.pathname).toBe('/page')\n  expect(router.state.location.search).toEqual({ q: 'test' })\n  expect(router.state.matches).toHaveLength(2)\n})\n```\n\n## Architecture Investigation Process\n\n### 1. Map the System\n\n```\nUser Input → Component → Hook → Core Logic → State → UI\n```\n\nIdentify each layer and what it's responsible for.\n\n### 2. Find the Divergence Point\n\nUse logging to identify exactly where expected behavior diverges:\n\n```javascript\nconsole.log('Input received:', input)\n// ... processing ...\nconsole.log('After step 1:', intermediate)\n// ... more processing ...\nconsole.log('Final output:', output) // Is this what we expected?\n```\n\n### 3. Check Assumptions\n\nCommon false assumptions:\n\n- \"This hook returns the current route\" (might return component context)\n- \"State updates are synchronous\" (often async in React)\n- \"This worked before\" (check if tests actually covered this case)\n\n## Regression Investigation\n\n### Version Comparison\n\n```bash\n# Check what changed between versions\ngit diff v1.120.13..v1.121.34 -- packages/react-router/\n\n# Look for specific changes\ngit log v1.120.13..v1.121.34 --oneline --grep=\"navigate\"\n```\n\n### Bisecting Issues\n\n```bash\n# Start bisect to find breaking commit\ngit bisect start\ngit bisect bad HEAD\ngit bisect good v1.120.13\n\n# Test each commit until you find the breaking change\n```\n\n## When to Stop & Reconsider\n\n**Stop changing code when:**\n\n- Your fix breaks multiple existing tests\n- You're changing fundamental assumptions\n- The solution feels hacky or overly complex\n\n**Consider instead:**\n\n- Adding a new API rather than changing existing behavior\n- Documenting the current behavior if it's actually correct\n- Creating a more targeted fix for the specific use case\n\n## Advanced Debugging Techniques\n\n### React DevTools\n\n- Inspect component tree to understand render context\n- Check props and state at each level\n- Use Profiler to identify performance issues\n\n### Browser DevTools\n\n```javascript\n// Add global debugging helpers\nwindow.debugRouter = router\nwindow.debugState = () => console.log(router.state)\n\n// Use conditional breakpoints\nif (router.state.location.pathname === '/problematic-route') {\n  debugger\n}\n```\n\n### Test Isolation\n\n```javascript\n// Run only one test to isolate issues\ntest.only('this specific failing test', () => {\n  // ...\n})\n\n// Skip problematic tests temporarily\ntest.skip('temporarily disabled', () => {\n  // ...\n})\n```\n\n## Key Takeaways\n\n1. **Reproduction beats theory** - A failing test that demonstrates the issue is worth more than understanding the problem in theory\n\n2. **Existing tests are protection** - If your fix breaks many existing tests, you're probably changing the wrong thing\n\n3. **Context matters** - Especially in React, understanding where components are rendered and what context they have access to is crucial\n\n4. **Small changes, frequent validation** - Make small, targeted changes and test each one rather than large refactors\n\n5. **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\n\n---\n\n_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._\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2021-present Tanner Linsley\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n<table>\n<tr>\n<td>\n\n<img\nsrc=\"./media/header_router.png\"\nalt=\"TanStack Router\"\n/>\n\n## TanStack Router\n\nA modern router designed for type safety, data‑driven navigation, and seamless developer experience.\n\n- End‑to-end type safety (routes, params, loaders)\n- Schema‑driven search params with validation\n- Built‑in caching, prefetching & invalidation\n- Nested layouts, transitions & error boundaries\n\n### [Read the Router Docs →](https://tanstack.com/router)\n\n</td>\n<td>\n\n<img\nsrc=\"./media/header_start.png\"\nalt=\"TanStack Start\"\n/>\n\n## TanStack Start\n\nA full‑stack framework built on Router, designed for server rendering, streaming, and production‑ready deployments.\n\n- Full‑document SSR & streaming\n- Server functions & end‑to‑end type safety\n- Deployment‑ready bundling & builds\n- All the power of TanStack Router, plus full‑stack features\n\n### [Read the Start Docs →](https://tanstack.com/start)\n\n</td>\n</tr>\n</table>\n\n<br />\n\n<p align=\"center\">\n  <a href=\"https://npmjs.com/package/@tanstack/react-router\"><img src=\"https://img.shields.io/npm/dm/@tanstack/react-router.svg\" alt=\"npm downloads\" /></a> <a href=\"https://github.com/tanstack/router\"><img src=\"https://img.shields.io/github/stars/tanstack/router.svg?style=social&label=Star\" alt=\"GitHub stars\" /></a> <a href=\"https://bundlephobia.com/result?p=@tanstack/react-router\"><img src=\"https://badgen.net/bundlephobia/minzip/@tanstack/react-router\" alt=\"Bundle size\" /></a>\n</p>\n<p align=\"center\">\n  <a href=\"#badge\"><img alt=\"semantic-release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\"></a> <a href=\"https://bestofjs.org/projects/tanstack-router\"><img alt=\"Best of JS\" src=\"https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=TanStack%2Frouter%26since=daily\" /></a> <a href=\"https://twitter.com/tan_stack\"><img src=\"https://img.shields.io/twitter/follow/tan_stack.svg?style=social\" alt=\"Follow @TanStack\"/></a>\n</p>\n\n<div align=\"center\">\n\n### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)\n\n</div>\n\n## Get Involved\n\n- We welcome issues and pull requests!\n- Participate in [GitHub discussions](https://github.com/TanStack/router/discussions)\n- Chat with the community on [Discord](https://discord.com/invite/WrRKjPJ)\n- See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions\n\n## Partners\n\n<table align=\"center\">\n  <tr>\n        <td>\n      <a href=\"https://www.coderabbit.ai/?via=tanstack&dub_id=aCcEEdAOqqutX6OS\" >\n        <picture>\n          <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://tanstack.com/assets/coderabbit-dark-D643Zkrv.svg\" />\n          <source media=\"(prefers-color-scheme: light)\" srcset=\"https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg\" />\n          <img src=\"https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg\" height=\"40\" alt=\"CodeRabbit\" />\n        </picture>\n      </a>\n    </td>\n    <td>\n      <a href=\"https://www.cloudflare.com?utm_source=tanstack\">\n        <picture>\n          <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg\" />\n          <source media=\"(prefers-color-scheme: light)\" srcset=\"https://tanstack.com/assets/cloudflare-black-6Ojsn8yh.svg\" />\n          <img src=\"https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg\" height=\"60\" alt=\"Cloudflare\" />\n        </picture>\n      </a>\n    </td>\n    <td>\n      <a href=\"https://netlify.com?utm_source=tanstack\">\n      <picture>\n        <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/netlify-dark.svg\" height=\"70\"/>\n        <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tannerlinsley/files/master/partners/netlify.svg\" height=\"70\"/>\n        <img src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/netlify-dark.svg\" height=\"70\" alt=\"Netlify\" />\n      </picture>\n      </a>\n    </td>\n  </tr>\n  <tr>\n    <td>\n      <a href=\"https://neon.tech?utm_source=tanstack\">\n\t\t  <picture>\n\t        <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/neon-dark.svg\" height=\"50\"/>\n\t        <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tannerlinsley/files/master/partners/neon.svg\" height=\"50\"/>\n\t        <img src=\"https://raw.githubusercontent.com/tannerlinsley/files/master/partners/neon.svg\" height=\"50\" alt=\"Neon\" />\n\t\t  </picture>\n\t  </a>\n    </td>\n    <td>\n      <a href=\"https://go.clerk.com/wOwHtuJ\">\n        <picture>\n          <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://tanstack.com/assets/clerk-logo-dark-CRE22T_2.svg\" height=\"40\"/>\n          <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tannerlinsley/files/master/partners/clerk.svg\" height=\"40\"/>\n          <img src=\"https://tanstack.com/assets/clerk-logo-dark-CRE22T_2.svg\" height=\"40\" alt=\"Clerk\" />\n        </picture>\n      </a>\n    </td>\n    <td>\n      <a href=\"https://convex.dev?utm_source=tanstack\">\n        <picture>\n          <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/convex-white.svg\" height=\"30\"/>\n          <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tannerlinsley/files/master/partners/convex.svg\" height=\"30\"/>\n          <img src=\"https://raw.githubusercontent.com/tannerlinsley/files/master/partners/convex.svg\" height=\"30\" alt=\"Convex\" />\n        </picture>\n      </a>\n    </td>\n  </tr>\n    <tr>\n    <td>\n      <a href=\"https://sentry.io?utm_source=tanstack\">\n        <picture>\n           <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/sentry-wordmark-light.svg\" height=\"50\"/>\n          <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tannerlinsley/files/master/partners/sentry.svg\" height=\"50\"/>\n          <img src=\"https://raw.githubusercontent.com/tannerlinsley/files/master/partners/sentry.svg\" height=\"50\" alt=\"Sentry\" />\n        </picture>\n      </a>\n    </td>\n    <td>\n      <a href=\"https://www.prisma.io?utm_source=tanstack&via=tanstack\">\n        <picture>\n          <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://tanstack.com/assets/prisma-dark-DwgDxLwn.svg\" height=\"50\"/>\n          <source media=\"(prefers-color-scheme: light)\" srcset=\"https://tanstack.com/assets/prisma-light-Cloa3Onm.svg\" height=\"50\"/>\n          <img src=\"https://tanstack.com/assets/prisma-dark-DwgDxLwn.svg\" height=\"50\" alt=\"Prisma\" />\n        </picture>\n      </a>\n    </td>\n    <td>\n      <a href=\"https://strapi.link/tanstack-start\">\n        <picture>\n          <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://tanstack.com/assets/strapi-dark-CQ84tQTk.svg\" height=\"40\"/>\n          <source media=\"(prefers-color-scheme: light)\" srcset=\"https://tanstack.com/assets/strapi-light-6x7linao.svg\" height=\"40\"/>\n          <img src=\"https://tanstack.com/assets/strapi-dark-CQ84tQTk.svg\" height=\"40\" alt=\"Strapi\" />\n        </picture>\n      </a>\n    </td>\n  </tr>\n</table>\n\n<div align=\"center\">\n<img src=\"./media/partner_logo.svg\" alt=\"Router & you?\" height=\"65\">\n<p>\nWe're looking for TanStack Router & Start Partners to join our mission! Partner with us to push the boundaries of TanStack Router & Start and build amazing things together.\n</p>\n<a href=\"mailto:partners@tanstack.com?subject=TanStack Router & Start Partnership\"><b>LET'S CHAT</b></a>\n</div>\n\n## Explore the TanStack Ecosystem\n\n- <a href=\"https://github.com/tanstack/config\"><b>TanStack Config</b></a> – Tooling for JS/TS packages\n- <a href=\"https://github.com/tanstack/db\"><b>TanStack DB</b></a> – Reactive sync client store\n- <a href=\"https://github.com/tanstack/devtools\"><b>TanStack DevTools</b></a> – Unified devtools panel\n- <a href=\"https://github.com/tanstack/form\"><b>TanStack Form</b></a> – Type‑safe form state\n- <a href=\"https://github.com/tanstack/pacer\"><b>TanStack Pacer</b></a> – Debouncing, throttling, batching <br/>\n- <a href=\"https://github.com/tanstack/query\"><b>TanStack Query</b></a> – Async state & caching\n- <a href=\"https://github.com/tanstack/ranger\"><b>TanStack Ranger</b></a> – Range & slider primitives\n- <a href=\"https://github.com/tanstack/store\"><b>TanStack Store</b></a> – Reactive data store\n- <a href=\"https://github.com/tanstack/table\"><b>TanStack Table</b></a> – Headless datagrids\n- <a href=\"https://github.com/tanstack/virtual\"><b>TanStack Virtual</b></a> – Virtualized rendering\n\n… and more at <a href=\"https://tanstack.com\"><b>TanStack.com »</b></a>\n\n<!-- Use the force, Luke!!! -->\n"
  },
  {
    "path": "_artifacts/domain_map.yaml",
    "content": "# domain_map.yaml\n# Generated by skill-domain-discovery\n# Library: TanStack Router\n# Version: 1.166.2\n# Date: 2026-03-07\n# Status: reviewed\n\nlibrary:\n  name: '@tanstack/react-router'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Type-safe router for React and Solid with built-in SWR caching,\n    JSON-first search params, file-based route generation, and\n    end-to-end type inference.\n  primary_framework: 'React'\n\ndomains:\n  - name: 'Defining Routes'\n    slug: 'defining-routes'\n    description: >-\n      Setting up route trees via file-based, code-based, or virtual\n      file routes, configuring the router instance, and registering\n      types for end-to-end inference.\n\n  - name: 'Navigating'\n    slug: 'navigating'\n    description: >-\n      Moving between routes using Links, imperative navigation,\n      redirects, preloading, active states, and navigation blocking.\n\n  - name: 'Managing URL State'\n    slug: 'managing-url-state'\n    description: >-\n      Reading and writing search params and path params with\n      validation, serialization, middlewares, and type-safe adapters.\n\n  - name: 'Loading Data'\n    slug: 'loading-data'\n    description: >-\n      Fetching data via route loaders, coordinating external caches,\n      managing SWR caching, deferred loading, and error/pending states.\n\n  - name: 'Protecting Routes'\n    slug: 'protecting-routes'\n    description: >-\n      Authentication guards, authorization checks, RBAC patterns,\n      and redirect-based access control via beforeLoad.\n\n  - name: 'Rendering and Layout'\n    slug: 'rendering-and-layout'\n    description: >-\n      Outlets, nested layouts, pathless layouts, code splitting,\n      error boundaries, not-found handling, route masking, scroll\n      restoration, and document head management.\n\n  - name: 'Type Safety'\n    slug: 'type-safety'\n    description: >-\n      Router type registration, inference patterns, narrowing with\n      from, TypeScript performance, and avoiding unnecessary type\n      annotations.\n\n  - name: 'Server-Side Rendering'\n    slug: 'server-side-rendering'\n    description: >-\n      Non-streaming and streaming SSR setup, hydration, data\n      serialization, and isomorphic router creation.\n\nskills:\n  # ── Defining Routes ──────────────────────────────────────────────\n  - name: 'Route Setup'\n    slug: 'route-setup'\n    domain: 'defining-routes'\n    description: >-\n      Set up a TanStack Router project with file-based, code-based,\n      or virtual file routes, configure the router instance, and\n      register types.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n      - '@tanstack/router-plugin'\n      - '@tanstack/router-generator'\n      - '@tanstack/router-cli'\n      - '@tanstack/virtual-file-routes'\n      - '@tanstack/eslint-plugin-router'\n    covers:\n      - createRouter\n      - createRootRoute\n      - createRootRouteWithContext\n      - createRoute\n      - createFileRoute\n      - createLazyFileRoute\n      - addChildren\n      - routeTree.gen.ts\n      - declare module Register\n      - TanStackRouter bundler plugin\n      - tsr.config.json\n      - virtual file routes API\n      - file naming conventions\n      - route matching and sorting\n    tasks:\n      - 'Scaffold a new TanStack Router project'\n      - 'Configure file-based routing with Vite plugin'\n      - 'Set up code-based route tree manually'\n      - 'Configure virtual file routes for custom conventions'\n      - 'Register router types via module declaration'\n      - 'Set up ESLint plugin for route property ordering'\n    reference_candidates:\n      - topic: 'file naming conventions'\n        reason: '>10 distinct conventions (dot separator, $ token, _ prefix/suffix, () groups, [] escaping, index, route.tsx, __root)'\n    failure_modes:\n      - mistake: 'Missing router type registration'\n        mechanism: >-\n          Without declare module Register, top-level exports like\n          Link, useNavigate, useParams have no type safety. Code\n          compiles but all route paths are untyped strings.\n        wrong_pattern: |\n          const router = createRouter({ routeTree })\n          // no declare module — Link to=\"\" has no autocomplete\n        correct_pattern: |\n          const router = createRouter({ routeTree })\n          declare module '@tanstack/react-router' {\n            interface Register {\n              router: typeof router\n            }\n          }\n        source: 'docs/router/guide/creating-a-router.md'\n        priority: CRITICAL\n        status: active\n        skills: ['route-setup', 'type-safety']\n\n      - mistake: 'Not committing routeTree.gen.ts'\n        mechanism: >-\n          routeTree.gen.ts is runtime code, not a build artifact.\n          Without it in version control, other developers cannot\n          build or run the project.\n        source: 'docs/router/faq.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Wrong route property order breaks type inference'\n        mechanism: >-\n          Properties like beforeLoad must come before loader in\n          createRoute/createFileRoute calls. Incorrect order causes\n          context types to not flow into loader.\n        wrong_pattern: |\n          createFileRoute('/posts')({\n            loader: ({ context }) => context.queryClient.ensureQueryData(postsQuery),\n            beforeLoad: ({ context }) => ({ queryClient: context.queryClient }),\n          })\n        correct_pattern: |\n          createFileRoute('/posts')({\n            beforeLoad: ({ context }) => ({ queryClient: context.queryClient }),\n            loader: ({ context }) => context.queryClient.ensureQueryData(postsQuery),\n          })\n        source: 'docs/router/eslint/create-route-property-order.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Placing TanStackRouter plugin after framework plugin'\n        mechanism: >-\n          The TanStackRouter Vite plugin must be listed before the\n          React/Solid plugin in the Vite config. Wrong order causes\n          route generation to fail silently.\n        wrong_pattern: |\n          plugins: [react(), TanStackRouterVite()]\n        correct_pattern: |\n          plugins: [TanStackRouterVite(), react()]\n        source: 'docs/router/installation/with-vite.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Using getParentRoute incorrectly in code-based routing'\n        mechanism: >-\n          Every non-root route must reference its correct parent via\n          getParentRoute. Wrong parent breaks type inference for\n          context, search params, and path params from ancestors.\n        source: 'docs/router/decisions-on-dx.md'\n        priority: HIGH\n        status: active\n\n    compositions:\n      - library: '@tanstack/eslint-plugin-router'\n        skill: null\n\n  # ── Navigating ───────────────────────────────────────────────────\n  - name: 'Navigation'\n    slug: 'navigation'\n    domain: 'navigating'\n    description: >-\n      Navigate between routes using Link, useNavigate, Navigate\n      component, and router.navigate. Configure preloading, active\n      link states, and navigation blocking.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n    covers:\n      - Link component\n      - useNavigate hook\n      - Navigate component\n      - router.navigate\n      - ToOptions / NavigateOptions / LinkOptions\n      - from / to relative navigation\n      - activeOptions / activeProps / inactiveProps\n      - preload (intent / viewport / render)\n      - preloadDelay / defaultPreloadDelay\n      - useBlocker hook\n      - Block component\n      - createLink (custom link components)\n      - linkOptions helper\n      - MatchRoute component\n      - scroll restoration\n    tasks:\n      - 'Create type-safe links between routes'\n      - 'Navigate programmatically after an action'\n      - 'Set up link preloading on hover intent'\n      - 'Style active and inactive links'\n      - 'Block navigation for unsaved changes'\n      - 'Create custom link components with createLink'\n      - 'Build reusable navigation options with linkOptions'\n      - 'Configure scroll restoration'\n    failure_modes:\n      - mistake: 'Interpolating params into the to string'\n        mechanism: >-\n          Agents build paths like to={`/posts/${id}`} instead of\n          using the params option. Breaks type safety and param\n          encoding.\n        wrong_pattern: |\n          <Link to={`/posts/${postId}`}>Post</Link>\n        correct_pattern: |\n          <Link to=\"/posts/$postId\" params={{ postId }}>Post</Link>\n        source: 'docs/router/guide/navigation.md'\n        priority: CRITICAL\n        status: active\n        skills: ['navigation', 'type-safety']\n\n      - mistake: 'Using useNavigate instead of Link for user-clickable elements'\n        mechanism: >-\n          Link renders a real <a> with href, supports cmd/ctrl+click\n          and preloading. useNavigate produces no accessible element.\n        source: 'docs/router/guide/navigation.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Not providing from for relative navigation'\n        mechanism: >-\n          Without from, the router assumes navigation from root.\n          Only absolute paths are autocompleted. Relative paths\n          like \"..\" resolve from root instead of current route.\n        wrong_pattern: |\n          <Link to=\"..\">Back</Link>\n        correct_pattern: |\n          <Link from={Route.fullPath} to=\"..\">Back</Link>\n        source: 'docs/router/guide/navigation.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Using search as object instead of function loses existing params'\n        mechanism: >-\n          search={{ page: 2 }} replaces all search params.\n          Must use function form to preserve existing params.\n        wrong_pattern: |\n          <Link to=\".\" search={{ page: 2 }}>Page 2</Link>\n        correct_pattern: |\n          <Link to=\".\" search={(prev) => ({ ...prev, page: 2 })}>Page 2</Link>\n        source: 'docs/router/how-to/navigate-with-search-params.md'\n        priority: HIGH\n        status: active\n        skills: ['navigation', 'search-params']\n\n  # ── Managing URL State ───────────────────────────────────────────\n  - name: 'Search Params'\n    slug: 'search-params'\n    domain: 'managing-url-state'\n    description: >-\n      Validate, read, write, and transform search params with\n      schema validation, adapters, middlewares, and custom\n      serialization.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n      - '@tanstack/zod-adapter'\n      - '@tanstack/valibot-adapter'\n      - '@tanstack/arktype-adapter'\n    covers:\n      - validateSearch\n      - useSearch hook\n      - Route.useSearch\n      - getRouteApi().useSearch\n      - search middlewares\n      - retainSearchParams\n      - stripSearchParams\n      - custom serialization (parseSearch / stringifySearch)\n      - zod adapter / valibot adapter / arktype adapter\n      - search param inheritance from parent routes\n      - structural sharing for search params\n    tasks:\n      - 'Add validated search params to a route'\n      - 'Read search params in components'\n      - 'Update search params while preserving others'\n      - 'Share search params across parent and child routes'\n      - 'Set up search param middlewares for retention/stripping'\n      - 'Configure custom search param serialization'\n      - 'Handle arrays, objects, and dates in search params'\n    subsystems:\n      - name: 'Zod adapter'\n        package: '@tanstack/zod-adapter'\n        config_surface: 'zodValidator, fallback() wrapper for .catch/.default type correctness'\n      - name: 'Valibot adapter'\n        package: '@tanstack/valibot-adapter'\n        config_surface: 'Standard Schema compliant, requires valibot 1.0'\n      - name: 'ArkType adapter'\n        package: '@tanstack/arktype-adapter'\n        config_surface: 'Standard Schema compliant, requires arktype 2.0-rc, pass directly to validateSearch'\n    reference_candidates:\n      - topic: 'search param validation patterns'\n        reason: '>10 distinct patterns (basic, optional, arrays, objects, dates, discriminated unions, transforms, conditional, cross-route inheritance, middleware chaining)'\n    failure_modes:\n      - mistake: 'Using zod .catch() instead of adapter fallback()'\n        mechanism: >-\n          Zod .catch() makes the output type unknown, losing type\n          safety. The @tanstack/zod-adapter fallback() preserves\n          the correct inferred type.\n        wrong_pattern: |\n          z.object({ page: z.number().catch(1) })\n        correct_pattern: |\n          import { fallback } from '@tanstack/zod-adapter'\n          z.object({ page: fallback(z.number(), 1) })\n        source: 'docs/router/guide/search-params.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Returning entire search object from loaderDeps'\n        mechanism: >-\n          loaderDeps: ({ search }) => search causes loader to\n          re-run on ANY search param change, not just relevant ones.\n          Deep equality comparison fires on every unrelated change.\n        wrong_pattern: |\n          loaderDeps: ({ search }) => search\n        correct_pattern: |\n          loaderDeps: ({ search }) => ({ page: search.page })\n        source: 'docs/router/guide/data-loading.md'\n        priority: HIGH\n        status: active\n        skills: ['search-params', 'data-loading']\n\n      - mistake: 'Passing Date objects in search params'\n        mechanism: >-\n          Date objects serialize to [object Object] in URLs.\n          Must convert to ISO strings for correct serialization.\n        wrong_pattern: |\n          <Link search={{ startDate: new Date() }}>\n        correct_pattern: |\n          <Link search={{ startDate: new Date().toISOString() }}>\n        source: 'docs/router/how-to/arrays-objects-dates-search-params.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Parent route missing validateSearch blocks inheritance'\n        mechanism: >-\n          Child routes cannot access shared search params unless\n          the parent route defines validateSearch. Without it,\n          the types and runtime values are not available.\n        source: 'docs/router/how-to/share-search-params-across-routes.md'\n        priority: MEDIUM\n        status: active\n\n  - name: 'Path Params'\n    slug: 'path-params'\n    domain: 'managing-url-state'\n    description: >-\n      Define and consume dynamic path segments, splat routes,\n      optional params, and prefix/suffix patterns.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n    covers:\n      - '$paramName dynamic segments'\n      - '$ splat / _splat'\n      - '{-$paramName} optional params'\n      - '{$paramName} prefix/suffix patterns'\n      - useParams hook\n      - params.parse / params.stringify\n      - pathParamsAllowedCharacters\n    tasks:\n      - 'Define routes with dynamic path parameters'\n      - 'Use splat routes for catch-all matching'\n      - 'Set up optional path parameters for i18n'\n      - 'Navigate with type-safe path params'\n    failure_modes:\n      - mistake: 'Interpolating path params into to string'\n        mechanism: >-\n          Same as navigation failure mode — agents build template\n          literal paths instead of using params option.\n        source: 'docs/router/guide/navigation.md'\n        priority: CRITICAL\n        status: active\n        skills: ['path-params', 'navigation']\n\n      - mistake: 'Using * for splat routes instead of $'\n        mechanism: >-\n          TanStack Router uses $ for splat routes, not * like some\n          other routers. The captured value is under _splat key,\n          not * (though * works in v1 for backwards compat, removed in v2).\n        source: 'docs/router/routing/routing-concepts.md'\n        priority: MEDIUM\n        status: 'fixed-but-legacy-risk'\n        version_context: '* works in v1 for compat but will be removed in v2'\n\n      - mistake: 'Using curly braces for basic dynamic segments'\n        mechanism: >-\n          Basic dynamic segments use $postId (no braces). Curly\n          braces are only for prefix/suffix patterns like {$postId}.txt\n          or optional params {-$locale}.\n        source: 'docs/router/guide/path-params.md'\n        priority: MEDIUM\n        status: active\n\n  # ── Loading Data ─────────────────────────────────────────────────\n  - name: 'Data Loading'\n    slug: 'data-loading'\n    domain: 'loading-data'\n    description: >-\n      Load data via route loaders with built-in SWR caching,\n      configure staleTime/gcTime, use loaderDeps for cache keys,\n      handle pending and error states, and inject dependencies\n      via router context.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n    covers:\n      - loader option\n      - loaderDeps\n      - staleTime / gcTime / defaultPreloadStaleTime\n      - pendingComponent / pendingMs / pendingMinMs\n      - errorComponent / onError / onCatch\n      - beforeLoad\n      - router context / createRootRouteWithContext\n      - router.invalidate\n      - Await component\n      - deferred data loading\n    tasks:\n      - 'Add a data loader to a route'\n      - 'Configure cache timing (staleTime, gcTime)'\n      - 'Set up loader dependencies for search-param-driven data'\n      - 'Show pending UI during slow loads'\n      - 'Handle loader errors with error boundaries'\n      - 'Inject dependencies via router context'\n      - 'Defer non-critical data with unawaited promises'\n      - 'Invalidate cached data after mutations'\n    failure_modes:\n      - mistake: 'Assuming loaders only run on the server'\n        mechanism: >-\n          TanStack Router is client-first. Loaders run on the client\n          by default (and also on the server if using TanStack Start).\n          Agents trained on Remix/Next assume loaders are server-only\n          and put server-only code (DB queries, fs access) in them.\n        source: 'maintainer interview'\n        priority: CRITICAL\n        status: active\n        skills: ['data-loading', 'ssr']\n\n      - mistake: 'Not understanding staleTime default is 0'\n        mechanism: >-\n          Default staleTime is 0, meaning data is always considered\n          stale and reloads in background on every route re-match.\n          Agents may not set staleTime, causing excessive refetching.\n        source: 'docs/router/guide/data-loading.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Using reset() instead of router.invalidate() in error components'\n        mechanism: >-\n          For loader errors, reset() only resets the error boundary\n          but does not re-run the loader. Must use router.invalidate()\n          to coordinate both reload and boundary reset.\n        wrong_pattern: |\n          function PostErrorComponent({ error, reset }) {\n            return <button onClick={reset}>Retry</button>\n          }\n        correct_pattern: |\n          function PostErrorComponent({ error, reset }) {\n            const router = useRouter()\n            return <button onClick={() => { router.invalidate(); reset() }}>Retry</button>\n          }\n        source: 'docs/router/guide/data-loading.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Double parentheses missing on createRootRouteWithContext'\n        mechanism: >-\n          createRootRouteWithContext<Type>() is a factory — it returns\n          a function. Must call it twice: createRootRouteWithContext<Type>()(routeOptions).\n          Missing second call is a common error.\n        wrong_pattern: |\n          const rootRoute = createRootRouteWithContext<{ auth: AuthState }>({\n            component: RootComponent,\n          })\n        correct_pattern: |\n          const rootRoute = createRootRouteWithContext<{ auth: AuthState }>()({\n            component: RootComponent,\n          })\n        source: 'docs/router/guide/data-loading.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Using React hooks in beforeLoad or loader'\n        mechanism: >-\n          beforeLoad and loader are not React components — hooks\n          cannot be called in them. Must extract hook state in a\n          wrapper component and pass via router context.\n        source: 'docs/router/guide/router-context.md'\n        priority: HIGH\n        status: active\n\n    compositions:\n      - library: '@tanstack/react-query'\n        skill: 'external-data-loading'\n\n  - name: 'External Data Loading'\n    slug: 'external-data-loading'\n    domain: 'loading-data'\n    description: >-\n      Integrate TanStack Query (or other external caches) with\n      Router for coordinated data loading, SSR dehydration/hydration,\n      and streaming.\n    type: composition\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/react-router-ssr-query'\n    covers:\n      - External cache coordination pattern\n      - queryClient.ensureQueryData in loader\n      - useSuspenseQuery in components\n      - setupRouterSsrQueryIntegration\n      - defaultPreloadStaleTime\n      - dehydrate / hydrate router options\n      - QueryClient per-request isolation\n      - Wrap router option for providers\n    tasks:\n      - 'Set up TanStack Query with Router'\n      - 'Preload query data in route loaders'\n      - 'Configure SSR dehydration/hydration with Query'\n      - 'Stream query data during SSR'\n    failure_modes:\n      - mistake: 'Not setting defaultPreloadStaleTime to 0 with external caches'\n        mechanism: >-\n          Router's built-in preload cache (30s default) prevents\n          external library from controlling freshness. Set\n          defaultPreloadStaleTime: 0 to let Query manage caching.\n        wrong_pattern: |\n          createRouter({ routeTree })\n        correct_pattern: |\n          createRouter({ routeTree, defaultPreloadStaleTime: 0 })\n        source: 'docs/router/guide/external-data-loading.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Creating QueryClient outside createRouter for SSR'\n        mechanism: >-\n          For SSR, QueryClient must be created inside createRouter\n          to ensure per-request isolation. A shared singleton leaks\n          data between requests.\n        wrong_pattern: |\n          const queryClient = new QueryClient()\n          const router = createRouter({ routeTree, context: { queryClient } })\n        correct_pattern: |\n          function createAppRouter() {\n            const queryClient = new QueryClient()\n            return createRouter({ routeTree, context: { queryClient } })\n          }\n        source: 'docs/router/guide/external-data-loading.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Awaiting prefetchQuery in loader blocks rendering'\n        mechanism: >-\n          For streaming/deferred patterns, prefetchQuery should NOT\n          be awaited in the loader — it starts fetching on server\n          and streams without blocking. Awaiting defeats the purpose.\n        source: 'docs/router/integrations/query.md'\n        priority: MEDIUM\n        status: active\n\n  # ── Protecting Routes ────────────────────────────────────────────\n  - name: 'Auth and Guards'\n    slug: 'auth-and-guards'\n    domain: 'protecting-routes'\n    description: >-\n      Protect routes with authentication checks, authorization\n      guards, and RBAC patterns using beforeLoad redirects and\n      layout routes.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n    covers:\n      - beforeLoad for auth checks\n      - redirect() / throw redirect()\n      - isRedirect helper\n      - Authenticated layout routes (_authenticated)\n      - Non-redirect auth (inline login)\n      - RBAC with roles and permissions\n      - Auth provider integration (Auth0, Clerk, Supabase)\n      - Router context for auth state\n    tasks:\n      - 'Protect routes with authentication checks'\n      - 'Redirect unauthenticated users to login'\n      - 'Implement role-based access control'\n      - 'Integrate third-party auth providers'\n      - 'Pass auth state through router context'\n    failure_modes:\n      - mistake: 'Auth check in component instead of beforeLoad'\n        mechanism: >-\n          Component-level auth checks cause protected content to\n          flash before redirect. beforeLoad runs before any\n          component rendering and prevents the flash entirely.\n        wrong_pattern: |\n          component: () => {\n            const auth = useAuth()\n            if (!auth.isAuthenticated) return <Navigate to=\"/login\" />\n            return <Dashboard />\n          }\n        correct_pattern: |\n          beforeLoad: ({ context }) => {\n            if (!context.auth.isAuthenticated) {\n              throw redirect({ to: '/login' })\n            }\n          }\n        source: 'docs/router/how-to/setup-authentication.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Not re-throwing redirects in try/catch'\n        mechanism: >-\n          redirect() works by throwing. If beforeLoad has a try/catch\n          for error handling, the redirect gets swallowed unless\n          re-thrown via isRedirect() check.\n        wrong_pattern: |\n          beforeLoad: async ({ context }) => {\n            try {\n              await validateSession(context.auth)\n            } catch (e) {\n              // swallows redirect!\n              console.error(e)\n            }\n          }\n        correct_pattern: |\n          beforeLoad: async ({ context }) => {\n            try {\n              await validateSession(context.auth)\n            } catch (e) {\n              if (isRedirect(e)) throw e\n              console.error(e)\n            }\n          }\n        source: 'docs/router/guide/authenticated-routes.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Trying to conditionally render root route component'\n        mechanism: >-\n          Root route is always rendered regardless of auth state.\n          Use a pathless layout route (_authenticated) with\n          beforeLoad for conditional rendering.\n        source: 'docs/router/faq.md'\n        priority: MEDIUM\n        status: active\n\n  # ── Rendering and Layout ─────────────────────────────────────────\n  - name: 'Code Splitting'\n    slug: 'code-splitting'\n    domain: 'rendering-and-layout'\n    description: >-\n      Split route code into lazy-loaded chunks using automatic\n      code splitting, .lazy.tsx files, or code-based lazy loading.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-plugin'\n    covers:\n      - autoCodeSplitting plugin option\n      - .lazy.tsx file convention\n      - createLazyFileRoute\n      - createLazyRoute\n      - lazyRouteComponent\n      - getRouteApi for code-split components\n      - codeSplitGroupings per-route override\n      - splitBehavior programmatic config\n      - Critical vs non-critical route properties\n    tasks:\n      - 'Enable automatic code splitting'\n      - 'Manually split a route with .lazy.tsx'\n      - 'Access typed hooks from code-split components'\n      - 'Customize which properties are split per route'\n    failure_modes:\n      - mistake: 'Exporting route property functions prevents code splitting'\n        mechanism: >-\n          Exported functions from route files are included in the\n          main bundle even with auto code splitting. Component\n          functions must NOT be exported.\n        wrong_pattern: |\n          export function PostsComponent() { return <div>Posts</div> }\n        correct_pattern: |\n          function PostsComponent() { return <div>Posts</div> }\n        source: 'docs/router/guide/automatic-code-splitting.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Trying to code-split the root route'\n        mechanism: >-\n          __root.tsx does not support code splitting — it is always\n          rendered regardless of current route.\n        source: 'docs/router/guide/code-splitting.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Splitting the loader adds double async cost'\n        mechanism: >-\n          Loader is already async. Splitting it requires fetching\n          the chunk AND then executing the loader, adding latency.\n          Loaders should stay in the main bundle unless there is\n          a specific reason to split them.\n        source: 'docs/router/guide/code-splitting.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Importing Route in code-split files for typed hooks'\n        mechanism: >-\n          Importing the Route object in a lazy-loaded file pulls\n          the route config into the lazy chunk, defeating code\n          splitting. Use getRouteApi('/path') instead.\n        wrong_pattern: |\n          import { Route } from './posts.tsx'\n          const data = Route.useLoaderData()\n        correct_pattern: |\n          import { getRouteApi } from '@tanstack/react-router'\n          const route = getRouteApi('/posts')\n          const data = route.useLoaderData()\n        source: 'docs/router/guide/code-splitting.md'\n        priority: HIGH\n        status: active\n\n  - name: 'Not Found and Errors'\n    slug: 'not-found-and-errors'\n    domain: 'rendering-and-layout'\n    description: >-\n      Handle not-found routes, missing resources, and route-level\n      errors with notFound(), notFoundComponent, errorComponent,\n      and CatchBoundary.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n    covers:\n      - notFound() function\n      - notFoundComponent\n      - defaultNotFoundComponent\n      - notFoundMode (fuzzy / root)\n      - errorComponent\n      - onError / onCatch\n      - CatchBoundary component\n      - NotFoundRoute (deprecated)\n    tasks:\n      - 'Add a 404 page for unmatched routes'\n      - 'Throw not-found for missing resources in loaders'\n      - 'Configure error boundaries per route'\n      - 'Target specific routes with notFound()'\n    failure_modes:\n      - mistake: 'Using deprecated NotFoundRoute'\n        mechanism: >-\n          NotFoundRoute is deprecated. When present, notFound() and\n          notFoundComponent will NOT work. Must remove NotFoundRoute\n          and use notFoundComponent instead.\n        source: 'docs/router/guide/not-found-errors.md'\n        priority: HIGH\n        status: 'fixed-but-legacy-risk'\n        version_context: 'NotFoundRoute deprecated, will be removed in next major'\n\n      - mistake: 'Expecting useLoaderData to work in notFoundComponent'\n        mechanism: >-\n          When notFoundComponent renders, the route's loader may\n          not have completed. useLoaderData() may return undefined.\n          Use useParams, useSearch, or useRouteContext instead.\n        source: 'docs/router/guide/not-found-errors.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Leaf route cannot handle not-found errors'\n        mechanism: >-\n          Routes without children never render Outlet and therefore\n          cannot catch not-found errors. Only routes with children\n          (or the root route) can have notFoundComponent.\n        source: 'docs/router/guide/not-found-errors.md'\n        priority: MEDIUM\n        status: active\n\n  - name: 'Route Masking'\n    slug: 'route-masking'\n    domain: 'rendering-and-layout'\n    description: >-\n      Mask the browser URL while navigating to a different internal\n      route, with configurable unmask behavior.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n    covers:\n      - mask option on Link / navigate\n      - createRouteMask\n      - routeMasks router option\n      - unmaskOnReload\n      - location.maskedLocation\n      - location.state.__tempLocation\n    tasks:\n      - 'Show a modal route with a clean URL'\n      - 'Configure declarative route masks'\n      - 'Control unmask behavior on page reload'\n    failure_modes:\n      - mistake: 'Expecting masked URLs to survive sharing'\n        mechanism: >-\n          Masking data is stored in browser history state. When a\n          URL is shared or opened in a new tab, masking data is\n          lost and the visible URL is used directly.\n        source: 'docs/router/guide/route-masking.md'\n        priority: MEDIUM\n        status: active\n\n  # ── Type Safety ──────────────────────────────────────────────────\n  - name: 'Type Safety'\n    slug: 'type-safety'\n    domain: 'type-safety'\n    description: >-\n      Leverage TanStack Router's fully inferred type system.\n      Avoid unnecessary type annotations, narrow routes with from,\n      and optimize TypeScript performance.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n    covers:\n      - Full type inference philosophy\n      - Register module declaration\n      - from narrowing on hooks and Link\n      - strict false for shared components\n      - getRouteApi for code-split typed access\n      - addChildren with object syntax for TS perf\n      - LinkProps / ValidateLinkOptions type utilities\n      - as const satisfies pattern\n    tasks:\n      - 'Register router types for global type safety'\n      - 'Narrow route types with from parameter'\n      - 'Use getRouteApi in code-split components'\n      - 'Optimize TypeScript performance in large route trees'\n      - 'Build type-safe link option utilities'\n    failure_modes:\n      - mistake: 'Adding type annotations or casts to inferred values'\n        mechanism: >-\n          TanStack Router is fully type-safe with full inference.\n          Adding as Type, generic type parameters, satisfies, or\n          explicit type annotations is unnecessary and can mask\n          real type errors or break the inference chain.\n        wrong_pattern: |\n          const search = useSearch({ from: '/posts' }) as { page: number }\n        correct_pattern: |\n          const search = useSearch({ from: '/posts' })\n          // search.page is already typed as number\n        source: 'maintainer interview'\n        priority: CRITICAL\n        status: active\n\n      - mistake: 'Using un-narrowed LinkProps type'\n        mechanism: >-\n          LinkProps without generics is an extremely large union type.\n          Using it as a variable type causes severe TS performance\n          degradation. Use as const satisfies or narrow with generics.\n        wrong_pattern: |\n          const props: LinkProps = { to: '/posts' }\n        correct_pattern: |\n          const props = { to: '/posts' } as const satisfies LinkProps\n        source: 'docs/router/guide/type-safety.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Not narrowing Link/useNavigate with from'\n        mechanism: >-\n          Without from, search resolves to a union of ALL routes\n          search params. TypeScript check time grows linearly with\n          route count. Always provide from to narrow.\n        wrong_pattern: |\n          <Link to=\"..\" search={{ page: 0 }} />\n        correct_pattern: |\n          <Link from={Route.fullPath} to=\"..\" search={{ page: 0 }} />\n        source: 'docs/router/guide/type-safety.md'\n        priority: HIGH\n        status: active\n\n  # ── Server-Side Rendering ────────────────────────────────────────\n  - name: 'SSR'\n    slug: 'ssr'\n    domain: 'server-side-rendering'\n    description: >-\n      Set up server-side rendering with non-streaming or streaming\n      approaches, manage hydration, and handle document head.\n    type: core\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-core'\n    covers:\n      - RouterClient / RouterServer\n      - renderRouterToString / renderRouterToStream\n      - createRequestHandler\n      - defaultRenderHandler / defaultStreamHandler\n      - HeadContent / Scripts components\n      - head route option (meta, links, styles, scripts)\n      - ScriptOnce component\n      - Automatic loader dehydration/hydration\n      - Memory history on server\n      - Data serialization (Date, Error, FormData, undefined)\n    tasks:\n      - 'Set up non-streaming SSR with Express'\n      - 'Set up streaming SSR'\n      - 'Configure document head management'\n      - 'Handle hydration mismatches'\n    failure_modes:\n      - mistake: 'Using browser APIs in loaders without environment check'\n        mechanism: >-\n          Loaders run on both client and server when using SSR.\n          Browser-only APIs (window, document, localStorage) will\n          throw on the server.\n        source: 'docs/router/guide/ssr.md'\n        priority: HIGH\n        status: active\n        skills: ['ssr', 'data-loading']\n\n      - mistake: 'Using hash fragments for server-rendered content'\n        mechanism: >-\n          Hash fragments are client-only — browsers never send them\n          to the server. Using hash for conditional rendering causes\n          hydration mismatches during SSR.\n        source: 'docs/router/guide/navigation.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Generating Next.js or Remix SSR patterns'\n        mechanism: >-\n          Agents trained on Next.js generate getServerSideProps,\n          App Router patterns, or server components. Agents trained\n          on Remix generate server-only loader exports. TanStack\n          Router has its own SSR API (RouterClient/RouterServer).\n        source: 'maintainer interview'\n        priority: CRITICAL\n        status: active\n        skills: ['ssr', 'route-setup', 'data-loading']\n\n  # ── Migration ────────────────────────────────────────────────────\n  - name: 'Migrate from React Router'\n    slug: 'migrate-from-react-router'\n    domain: 'defining-routes'\n    description: >-\n      Step-by-step migration from React Router v7 to TanStack Router,\n      covering route definitions, navigation, search params, and\n      data loading.\n    type: lifecycle\n    packages:\n      - '@tanstack/react-router'\n      - '@tanstack/router-plugin'\n    covers:\n      - Migration checklist\n      - Route definition conversion\n      - Link / useNavigate API differences\n      - useSearchParams to validateSearch + useSearch\n      - useParams with from\n      - Outlet replacement\n      - Loader conversion\n      - Code splitting differences\n    tasks:\n      - 'Migrate routes from React Router to TanStack Router'\n      - 'Convert React Router Links and navigation'\n      - 'Replace useSearchParams with validated search params'\n      - 'Convert React Router loaders'\n    failure_modes:\n      - mistake: 'Leaving React Router imports alongside TanStack Router'\n        mechanism: >-\n          React Router and TanStack Router share similar API names\n          (Link, useNavigate, Outlet). Leftover React Router imports\n          cause context errors (\"cannot use useNavigate outside of\n          context\"). Uninstall react-router-dom to surface these.\n        source: 'docs/router/how-to/migrate-from-react-router.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Using React Router useSearchParams pattern'\n        mechanism: >-\n          React Router uses useSearchParams() returning URLSearchParams.\n          TanStack Router uses validateSearch schema + useSearch()\n          returning typed objects. Agents may generate the RR pattern.\n        wrong_pattern: |\n          const [searchParams, setSearchParams] = useSearchParams()\n          const page = Number(searchParams.get('page'))\n        correct_pattern: |\n          // In route definition:\n          validateSearch: z.object({ page: fallback(z.number(), 1) })\n          // In component:\n          const { page } = Route.useSearch()\n        source: 'docs/router/installation/migrate-from-react-router.md'\n        priority: HIGH\n        status: active\n\ntensions:\n  - name: 'Type safety strictness vs rapid prototyping'\n    skills: ['type-safety', 'route-setup']\n    description: >-\n      Full type inference requires proper setup (Register, correct\n      property order, getParentRoute). This upfront cost conflicts\n      with quick prototyping where developers want to skip setup.\n    implication: >-\n      Agents skip Register declaration or use type casts to silence\n      errors, producing code that compiles but has no type safety.\n\n  - name: 'Client-first loaders vs SSR expectations'\n    skills: ['data-loading', 'ssr']\n    description: >-\n      Loaders are client-first by design but agents assume they are\n      server-only (Remix/Next mental model). This tension means\n      browser APIs work in loaders by default but break under SSR.\n    implication: >-\n      Agents either put server-only code in client loaders or avoid\n      browser APIs unnecessarily, depending on which framework mental\n      model they default to.\n\n  - name: 'Built-in SWR cache vs external cache coordination'\n    skills: ['data-loading', 'external-data-loading']\n    description: >-\n      Router has built-in caching with staleTime/gcTime defaults.\n      When using an external cache like React Query, the built-in\n      cache must be bypassed (defaultPreloadStaleTime: 0) or it\n      conflicts with the external library's freshness management.\n    implication: >-\n      Agents use both caches simultaneously without disabling the\n      built-in one, causing stale data or double-fetching.\n\n  - name: 'Code splitting granularity vs loader performance'\n    skills: ['code-splitting', 'data-loading']\n    description: >-\n      Splitting more aggressively reduces initial bundle but splitting\n      the loader adds a network round-trip before data can be fetched.\n      The optimal split point differs per route.\n    implication: >-\n      Agents split everything including loaders, adding latency to\n      data loading without understanding the tradeoff.\n\ncross_references:\n  - from: 'route-setup'\n    to: 'type-safety'\n    reason: 'Register declaration and property order are prerequisites for type inference'\n  - from: 'navigation'\n    to: 'search-params'\n    reason: 'Link search prop and navigate search option directly interact with search param validation'\n  - from: 'data-loading'\n    to: 'search-params'\n    reason: 'loaderDeps consumes validated search params as cache keys'\n  - from: 'data-loading'\n    to: 'external-data-loading'\n    reason: 'Understanding built-in caching is prerequisite for coordinating with external caches'\n  - from: 'auth-and-guards'\n    to: 'data-loading'\n    reason: 'beforeLoad runs before loader — auth context flows into loader via route context'\n  - from: 'code-splitting'\n    to: 'data-loading'\n    reason: 'Loader splitting decisions affect data loading performance'\n  - from: 'ssr'\n    to: 'data-loading'\n    reason: 'SSR changes where loaders execute — must handle both environments'\n  - from: 'ssr'\n    to: 'external-data-loading'\n    reason: 'SSR dehydration/hydration requires special setup for Query integration'\n  - from: 'not-found-and-errors'\n    to: 'data-loading'\n    reason: 'notFound() thrown in loaders interacts with error boundaries and loader data availability'\n  - from: 'migrate-from-react-router'\n    to: 'route-setup'\n    reason: 'Migration requires understanding TanStack Router route setup to replace RR patterns'\n\ngaps: []\n"
  },
  {
    "path": "_artifacts/skill_spec.md",
    "content": "# TanStack Router — Skill Spec\n\nTanStack 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.\n\n## Domains\n\n| Domain                | Description                                                         | Skills                                              |\n| --------------------- | ------------------------------------------------------------------- | --------------------------------------------------- |\n| Defining Routes       | Setting up route trees, configuring the router, registering types   | route-setup, migrate-from-react-router              |\n| Navigating            | Links, imperative navigation, preloading, blocking                  | navigation                                          |\n| Managing URL State    | Search params and path params with validation and serialization     | search-params, path-params                          |\n| Loading Data          | Route loaders, SWR caching, external cache coordination, context/DI | data-loading, external-data-loading                 |\n| Protecting Routes     | Auth guards, RBAC, beforeLoad redirects                             | auth-and-guards                                     |\n| Rendering and Layout  | Code splitting, error/not-found handling, route masking             | code-splitting, not-found-and-errors, route-masking |\n| Type Safety           | Inference patterns, narrowing, TS performance                       | type-safety                                         |\n| Server-Side Rendering | SSR setup, hydration, head management                               | ssr                                                 |\n\n## Skill Inventory\n\n| Skill                     | Type        | Domain                | What it covers                                                                       | Failure modes |\n| ------------------------- | ----------- | --------------------- | ------------------------------------------------------------------------------------ | ------------- |\n| route-setup               | core        | defining-routes       | createRouter, file/code/virtual routing, Register, plugin config, ESLint             | 5             |\n| navigation                | core        | navigating            | Link, useNavigate, Navigate, preloading, blocking, active states, scroll restoration | 4             |\n| search-params             | core        | managing-url-state    | validateSearch, useSearch, middlewares, serialization, adapters                      | 4             |\n| path-params               | core        | managing-url-state    | $params, splats, optional params, prefix/suffix patterns                             | 3             |\n| data-loading              | core        | loading-data          | loader, loaderDeps, staleTime/gcTime, pending/error, context/DI, deferred            | 5             |\n| external-data-loading     | composition | loading-data          | TanStack Query integration, SSR dehydration/hydration, streaming                     | 3             |\n| auth-and-guards           | core        | protecting-routes     | beforeLoad redirects, layout auth, RBAC, provider integration                        | 3             |\n| code-splitting            | core        | rendering-and-layout  | autoCodeSplitting, .lazy.tsx, getRouteApi, split groupings                           | 4             |\n| not-found-and-errors      | core        | rendering-and-layout  | notFound(), notFoundComponent, errorComponent, CatchBoundary                         | 3             |\n| route-masking             | core        | rendering-and-layout  | mask option, createRouteMask, unmaskOnReload                                         | 1             |\n| type-safety               | core        | type-safety           | Register, from narrowing, TS perf, type utilities                                    | 3             |\n| ssr                       | core        | server-side-rendering | RouterClient/Server, streaming, hydration, head management                           | 3             |\n| migrate-from-react-router | lifecycle   | defining-routes       | Migration checklist, API mapping, search params conversion                           | 2             |\n\n## Failure Mode Inventory\n\n### route-setup (5 failure modes)\n\n| #   | Mistake                                                | Priority | Source                                  | Cross-skill? |\n| --- | ------------------------------------------------------ | -------- | --------------------------------------- | ------------ |\n| 1   | Missing router type registration                       | CRITICAL | docs/guide/creating-a-router            | type-safety  |\n| 2   | Not committing routeTree.gen.ts                        | HIGH     | docs/faq                                | —            |\n| 3   | Wrong route property order breaks type inference       | HIGH     | docs/eslint/create-route-property-order | —            |\n| 4   | Placing TanStackRouter plugin after framework plugin   | HIGH     | docs/installation/with-vite             | —            |\n| 5   | Using getParentRoute incorrectly in code-based routing | HIGH     | docs/decisions-on-dx                    | —            |\n\n### navigation (4 failure modes)\n\n| #   | Mistake                                                  | Priority | Source                                  | Cross-skill?  |\n| --- | -------------------------------------------------------- | -------- | --------------------------------------- | ------------- |\n| 1   | Interpolating params into the to string                  | CRITICAL | docs/guide/navigation                   | type-safety   |\n| 2   | Using useNavigate instead of Link for clickable elements | MEDIUM   | docs/guide/navigation                   | —             |\n| 3   | Not providing from for relative navigation               | HIGH     | docs/guide/navigation                   | —             |\n| 4   | Using search as object instead of function loses params  | HIGH     | docs/how-to/navigate-with-search-params | search-params |\n\n### search-params (4 failure modes)\n\n| #   | Mistake                                                | Priority | Source                           | Cross-skill? |\n| --- | ------------------------------------------------------ | -------- | -------------------------------- | ------------ |\n| 1   | Using zod .catch() instead of adapter fallback()       | HIGH     | docs/guide/search-params         | —            |\n| 2   | Returning entire search object from loaderDeps         | HIGH     | docs/guide/data-loading          | data-loading |\n| 3   | Passing Date objects in search params                  | HIGH     | docs/how-to/arrays-objects-dates | —            |\n| 4   | Parent route missing validateSearch blocks inheritance | MEDIUM   | docs/how-to/share-search-params  | —            |\n\n### path-params (3 failure modes)\n\n| #   | Mistake                                       | Priority | Source                        | Cross-skill? |\n| --- | --------------------------------------------- | -------- | ----------------------------- | ------------ |\n| 1   | Interpolating path params into to string      | CRITICAL | docs/guide/navigation         | navigation   |\n| 2   | Using \\* for splat routes instead of $        | MEDIUM   | docs/routing/routing-concepts | —            |\n| 3   | Using curly braces for basic dynamic segments | MEDIUM   | docs/guide/path-params        | —            |\n\n### data-loading (5 failure modes)\n\n| #   | Mistake                                                          | Priority | Source                    | Cross-skill? |\n| --- | ---------------------------------------------------------------- | -------- | ------------------------- | ------------ |\n| 1   | Assuming loaders only run on the server                          | CRITICAL | maintainer interview      | ssr          |\n| 2   | Not understanding staleTime default is 0                         | MEDIUM   | docs/guide/data-loading   | —            |\n| 3   | Using reset() instead of router.invalidate() in error components | HIGH     | docs/guide/data-loading   | —            |\n| 4   | Double parentheses missing on createRootRouteWithContext         | HIGH     | docs/guide/data-loading   | —            |\n| 5   | Using React hooks in beforeLoad or loader                        | HIGH     | docs/guide/router-context | —            |\n\n### external-data-loading (3 failure modes)\n\n| #   | Mistake                                           | Priority | Source                           | Cross-skill? |\n| --- | ------------------------------------------------- | -------- | -------------------------------- | ------------ |\n| 1   | Not setting defaultPreloadStaleTime to 0          | HIGH     | docs/guide/external-data-loading | —            |\n| 2   | Creating QueryClient outside createRouter for SSR | HIGH     | docs/guide/external-data-loading | —            |\n| 3   | Awaiting prefetchQuery in loader blocks rendering | MEDIUM   | docs/integrations/query          | —            |\n\n### auth-and-guards (3 failure modes)\n\n| #   | Mistake                                             | Priority | Source                           | Cross-skill? |\n| --- | --------------------------------------------------- | -------- | -------------------------------- | ------------ |\n| 1   | Auth check in component instead of beforeLoad       | HIGH     | docs/how-to/setup-authentication | —            |\n| 2   | Not re-throwing redirects in try/catch              | HIGH     | docs/guide/authenticated-routes  | —            |\n| 3   | Trying to conditionally render root route component | MEDIUM   | docs/faq                         | —            |\n\n### code-splitting (4 failure modes)\n\n| #   | Mistake                                                    | Priority | Source                              | Cross-skill? |\n| --- | ---------------------------------------------------------- | -------- | ----------------------------------- | ------------ |\n| 1   | Exporting route property functions prevents code splitting | HIGH     | docs/guide/automatic-code-splitting | —            |\n| 2   | Trying to code-split the root route                        | MEDIUM   | docs/guide/code-splitting           | —            |\n| 3   | Splitting the loader adds double async cost                | MEDIUM   | docs/guide/code-splitting           | —            |\n| 4   | Importing Route in code-split files for typed hooks        | HIGH     | docs/guide/code-splitting           | —            |\n\n### not-found-and-errors (3 failure modes)\n\n| #   | Mistake                                              | Priority | Source                      | Cross-skill? |\n| --- | ---------------------------------------------------- | -------- | --------------------------- | ------------ |\n| 1   | Using deprecated NotFoundRoute                       | HIGH     | docs/guide/not-found-errors | —            |\n| 2   | Expecting useLoaderData to work in notFoundComponent | MEDIUM   | docs/guide/not-found-errors | —            |\n| 3   | Leaf route cannot handle not-found errors            | MEDIUM   | docs/guide/not-found-errors | —            |\n\n### route-masking (1 failure mode)\n\n| #   | Mistake                                  | Priority | Source                   | Cross-skill? |\n| --- | ---------------------------------------- | -------- | ------------------------ | ------------ |\n| 1   | Expecting masked URLs to survive sharing | MEDIUM   | docs/guide/route-masking | —            |\n\n### type-safety (3 failure modes)\n\n| #   | Mistake                                             | Priority | Source                 | Cross-skill? |\n| --- | --------------------------------------------------- | -------- | ---------------------- | ------------ |\n| 1   | Adding type annotations or casts to inferred values | CRITICAL | maintainer interview   | —            |\n| 2   | Using un-narrowed LinkProps type                    | HIGH     | docs/guide/type-safety | —            |\n| 3   | Not narrowing Link/useNavigate with from            | HIGH     | docs/guide/type-safety | —            |\n\n### ssr (3 failure modes)\n\n| #   | Mistake                                                 | Priority | Source                | Cross-skill?              |\n| --- | ------------------------------------------------------- | -------- | --------------------- | ------------------------- |\n| 1   | Using browser APIs in loaders without environment check | HIGH     | docs/guide/ssr        | data-loading              |\n| 2   | Using hash fragments for server-rendered content        | MEDIUM   | docs/guide/navigation | —                         |\n| 3   | Generating Next.js or Remix SSR patterns                | CRITICAL | maintainer interview  | route-setup, data-loading |\n\n### migrate-from-react-router (2 failure modes)\n\n| #   | Mistake                                                | Priority | Source                                      | Cross-skill? |\n| --- | ------------------------------------------------------ | -------- | ------------------------------------------- | ------------ |\n| 1   | Leaving React Router imports alongside TanStack Router | HIGH     | docs/how-to/migrate-from-react-router       | —            |\n| 2   | Using React Router useSearchParams pattern             | HIGH     | docs/installation/migrate-from-react-router | —            |\n\n## Tensions\n\n| Tension                                           | Skills                               | Agent implication                                                                 |\n| ------------------------------------------------- | ------------------------------------ | --------------------------------------------------------------------------------- |\n| Type safety strictness vs rapid prototyping       | type-safety ↔ route-setup            | Agents skip Register declaration or use type casts to silence errors              |\n| Client-first loaders vs SSR expectations          | data-loading ↔ ssr                   | Agents put server-only code in client loaders or avoid browser APIs unnecessarily |\n| Built-in SWR cache vs external cache coordination | data-loading ↔ external-data-loading | Agents use both caches simultaneously causing stale data or double-fetching       |\n| Code splitting granularity vs loader performance  | code-splitting ↔ data-loading        | Agents split everything including loaders, adding latency                         |\n\n## Cross-References\n\n| From                      | To                    | Reason                                                                             |\n| ------------------------- | --------------------- | ---------------------------------------------------------------------------------- |\n| route-setup               | type-safety           | Register declaration and property order are prerequisites for type inference       |\n| navigation                | search-params         | Link search prop directly interacts with search param validation                   |\n| data-loading              | search-params         | loaderDeps consumes validated search params as cache keys                          |\n| data-loading              | external-data-loading | Understanding built-in caching is prerequisite for external cache coordination     |\n| auth-and-guards           | data-loading          | beforeLoad runs before loader — auth context flows into loader via route context   |\n| code-splitting            | data-loading          | Loader splitting decisions affect data loading performance                         |\n| ssr                       | data-loading          | SSR changes where loaders execute — must handle both environments                  |\n| ssr                       | external-data-loading | SSR dehydration/hydration requires special Query setup                             |\n| not-found-and-errors      | data-loading          | notFound() in loaders interacts with error boundaries and loader data availability |\n| migrate-from-react-router | route-setup           | Migration requires understanding TanStack Router route setup                       |\n\n## Subsystems & Reference Candidates\n\n| Skill         | Subsystems                                    | Reference candidates                                     |\n| ------------- | --------------------------------------------- | -------------------------------------------------------- |\n| route-setup   | —                                             | file naming conventions (>10 distinct conventions)       |\n| search-params | Zod adapter, Valibot adapter, ArkType adapter | search param validation patterns (>10 distinct patterns) |\n| All others    | —                                             | —                                                        |\n\n## Recommended Skill File Structure\n\n- **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\n- **Framework skills:** None needed separately — React and Solid share the same core API surface. Framework-specific notes belong inline.\n- **Lifecycle skills:** migrate-from-react-router\n- **Composition skills:** external-data-loading (TanStack Query)\n- **Reference files:** search-params (validation patterns), route-setup (file naming conventions)\n\n## Composition Opportunities\n\n| Library               | Integration points                                        | Composition skill needed?                  |\n| --------------------- | --------------------------------------------------------- | ------------------------------------------ |\n| @tanstack/react-query | Loader coordination, SSR dehydration/hydration, streaming | Yes — external-data-loading                |\n| Zod                   | Search param validation                                   | No — covered as subsystem in search-params |\n| Valibot               | Search param validation                                   | No — covered as subsystem in search-params |\n| ArkType               | Search param validation                                   | No — covered as subsystem in search-params |\n"
  },
  {
    "path": "_artifacts/skill_tree.yaml",
    "content": "# skills/_artifacts/skill_tree.yaml\nlibrary:\n  name: '@tanstack/router'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Type-safe router for React and Solid with built-in SWR caching,\n    JSON-first search params, and end-to-end type inference.\ngenerated_from:\n  domain_map: '_artifacts/domain_map.yaml'\n  skill_spec: '_artifacts/skill_spec.md'\ngenerated_at: '2026-03-07'\n\nskills:\n  # ── Router Core Skills ───────────────────────────────────────────\n  - name: 'Router Core'\n    slug: 'router-core'\n    type: 'core'\n    domain: 'defining-routes'\n    path: 'skills/router-core/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      Framework-agnostic core concepts for TanStack Router: route trees,\n      createRouter, createRoute, createRootRoute, createRootRouteWithContext,\n      addChildren, Register type declaration, route matching, route sorting,\n      file naming conventions. Entry point for all router skills.\n    sources:\n      - 'TanStack/router:docs/router/overview.md'\n      - 'TanStack/router:docs/router/routing/routing-concepts.md'\n      - 'TanStack/router:docs/router/routing/route-trees.md'\n      - 'TanStack/router:docs/router/routing/route-matching.md'\n      - 'TanStack/router:docs/router/guide/creating-a-router.md'\n      - 'TanStack/router:docs/router/decisions-on-dx.md'\n      - 'TanStack/router:packages/router-core/src'\n\n  - name: 'Search Params'\n    slug: 'router-core/search-params'\n    type: 'sub-skill'\n    domain: 'managing-url-state'\n    path: 'skills/router-core/search-params/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      validateSearch, search param validation with Zod/Valibot/ArkType adapters,\n      fallback(), search middlewares (retainSearchParams, stripSearchParams),\n      custom serialization (parseSearch, stringifySearch), search param\n      inheritance, loaderDeps for cache keys, reading and writing search params.\n    requires:\n      - 'router-core'\n    sources:\n      - 'TanStack/router:docs/router/guide/search-params.md'\n      - 'TanStack/router:docs/router/how-to/setup-basic-search-params.md'\n      - 'TanStack/router:docs/router/how-to/validate-search-params.md'\n      - 'TanStack/router:docs/router/how-to/navigate-with-search-params.md'\n      - 'TanStack/router:docs/router/how-to/share-search-params-across-routes.md'\n      - 'TanStack/router:docs/router/how-to/arrays-objects-dates-search-params.md'\n      - 'TanStack/router:docs/router/guide/custom-search-param-serialization.md'\n    subsystems:\n      - 'Zod adapter'\n      - 'Valibot adapter'\n      - 'ArkType adapter'\n    references:\n      - 'references/validation-patterns.md'\n\n  - name: 'Path Params'\n    slug: 'router-core/path-params'\n    type: 'sub-skill'\n    domain: 'managing-url-state'\n    path: 'skills/router-core/path-params/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      Dynamic path segments ($paramName), splat routes ($ / _splat),\n      optional params ({-$paramName}), prefix/suffix patterns ({$param}.ext),\n      useParams, params.parse/stringify, pathParamsAllowedCharacters,\n      i18n locale patterns.\n    requires:\n      - 'router-core'\n    sources:\n      - 'TanStack/router:docs/router/guide/path-params.md'\n      - 'TanStack/router:docs/router/guide/internationalization-i18n.md'\n      - 'TanStack/router:docs/router/routing/routing-concepts.md'\n\n  - name: 'Navigation'\n    slug: 'router-core/navigation'\n    type: 'sub-skill'\n    domain: 'navigating'\n    path: 'skills/router-core/navigation/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      Link component, useNavigate, Navigate component, router.navigate,\n      ToOptions/NavigateOptions/LinkOptions, from/to relative navigation,\n      activeOptions/activeProps, preloading (intent/viewport/render),\n      preloadDelay, navigation blocking (useBlocker, Block), createLink,\n      linkOptions helper, scroll restoration, MatchRoute.\n    requires:\n      - 'router-core'\n    sources:\n      - 'TanStack/router:docs/router/guide/navigation.md'\n      - 'TanStack/router:docs/router/guide/preloading.md'\n      - 'TanStack/router:docs/router/guide/navigation-blocking.md'\n      - 'TanStack/router:docs/router/guide/link-options.md'\n      - 'TanStack/router:docs/router/guide/custom-link.md'\n      - 'TanStack/router:docs/router/guide/scroll-restoration.md'\n\n  - name: 'Data Loading'\n    slug: 'router-core/data-loading'\n    type: 'sub-skill'\n    domain: 'loading-data'\n    path: 'skills/router-core/data-loading/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      Route loader option, loaderDeps for cache keys, staleTime/gcTime/\n      defaultPreloadStaleTime SWR caching, pendingComponent/pendingMs/\n      pendingMinMs, errorComponent/onError/onCatch, beforeLoad, router\n      context and createRootRouteWithContext DI pattern, router.invalidate,\n      Await component, deferred data loading with unawaited promises.\n    requires:\n      - 'router-core'\n    sources:\n      - 'TanStack/router:docs/router/guide/data-loading.md'\n      - 'TanStack/router:docs/router/guide/deferred-data-loading.md'\n      - 'TanStack/router:docs/router/guide/router-context.md'\n      - 'TanStack/router:docs/router/guide/data-mutations.md'\n\n  - name: 'Auth and Guards'\n    slug: 'router-core/auth-and-guards'\n    type: 'sub-skill'\n    domain: 'protecting-routes'\n    path: 'skills/router-core/auth-and-guards/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      Route protection with beforeLoad, redirect()/throw redirect(),\n      isRedirect helper, authenticated layout routes (_authenticated),\n      non-redirect auth (inline login), RBAC with roles and permissions,\n      auth provider integration (Auth0, Clerk, Supabase), router context\n      for auth state.\n    requires:\n      - 'router-core'\n      - 'router-core/data-loading'\n    sources:\n      - 'TanStack/router:docs/router/guide/authenticated-routes.md'\n      - 'TanStack/router:docs/router/how-to/setup-authentication.md'\n      - 'TanStack/router:docs/router/how-to/setup-auth-providers.md'\n      - 'TanStack/router:docs/router/how-to/setup-rbac.md'\n\n  - name: 'Code Splitting'\n    slug: 'router-core/code-splitting'\n    type: 'sub-skill'\n    domain: 'rendering-and-layout'\n    path: 'skills/router-core/code-splitting/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      Automatic code splitting (autoCodeSplitting), .lazy.tsx convention,\n      createLazyFileRoute, createLazyRoute, lazyRouteComponent, getRouteApi\n      for typed hooks in split files, codeSplitGroupings per-route override,\n      splitBehavior programmatic config, critical vs non-critical properties.\n    requires:\n      - 'router-core'\n    sources:\n      - 'TanStack/router:docs/router/guide/code-splitting.md'\n      - 'TanStack/router:docs/router/guide/automatic-code-splitting.md'\n\n  - name: 'Not Found and Errors'\n    slug: 'router-core/not-found-and-errors'\n    type: 'sub-skill'\n    domain: 'rendering-and-layout'\n    path: 'skills/router-core/not-found-and-errors/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      notFound() function, notFoundComponent, defaultNotFoundComponent,\n      notFoundMode (fuzzy/root), errorComponent, onError/onCatch,\n      CatchBoundary, NotFoundRoute (deprecated), route masking (mask\n      option, createRouteMask, unmaskOnReload).\n    requires:\n      - 'router-core'\n    sources:\n      - 'TanStack/router:docs/router/guide/not-found-errors.md'\n      - 'TanStack/router:docs/router/guide/route-masking.md'\n\n  - name: 'Type Safety'\n    slug: 'router-core/type-safety'\n    type: 'sub-skill'\n    domain: 'type-safety'\n    path: 'skills/router-core/type-safety/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      Full type inference philosophy (never cast, never annotate inferred\n      values), Register module declaration, from narrowing on hooks and\n      Link, strict:false for shared components, getRouteApi for code-split\n      typed access, addChildren with object syntax for TS perf, LinkProps\n      and ValidateLinkOptions type utilities, as const satisfies pattern.\n    requires:\n      - 'router-core'\n    sources:\n      - 'TanStack/router:docs/router/guide/type-safety.md'\n      - 'TanStack/router:docs/router/guide/type-utilities.md'\n      - 'TanStack/router:docs/router/guide/render-optimizations.md'\n\n  - name: 'SSR'\n    slug: 'router-core/ssr'\n    type: 'sub-skill'\n    domain: 'server-side-rendering'\n    path: 'skills/router-core/ssr/SKILL.md'\n    package: 'packages/router-core'\n    description: >-\n      Non-streaming and streaming SSR, RouterClient/RouterServer,\n      renderRouterToString/renderRouterToStream, createRequestHandler,\n      defaultRenderHandler/defaultStreamHandler, HeadContent/Scripts\n      components, head route option (meta/links/styles/scripts),\n      ScriptOnce, automatic loader dehydration/hydration, memory\n      history on server, data serialization, document head management.\n    requires:\n      - 'router-core'\n      - 'router-core/data-loading'\n    sources:\n      - 'TanStack/router:docs/router/guide/ssr.md'\n      - 'TanStack/router:docs/router/guide/document-head-management.md'\n      - 'TanStack/router:docs/router/how-to/setup-ssr.md'\n\n  # ── React Router Skills ──────────────────────────────────────────\n  - name: 'React Router'\n    slug: 'react-router'\n    type: 'framework'\n    domain: 'defining-routes'\n    path: 'skills/react-router/SKILL.md'\n    package: 'packages/react-router'\n    description: >-\n      React bindings for TanStack Router: RouterProvider, useRouter,\n      useRouterState, useMatch, useMatches, useLocation, useSearch,\n      useParams, useNavigate, useLoaderData, useLoaderDeps,\n      useRouteContext, useBlocker, useCanGoBack, Link, Navigate,\n      Outlet, CatchBoundary, ErrorComponent. React-specific patterns\n      for hooks, providers, SSR hydration, and createLink with\n      forwardRef.\n    requires:\n      - 'router-core'\n    sources:\n      - 'TanStack/router:packages/react-router/src'\n      - 'TanStack/router:docs/router/guide/creating-a-router.md'\n      - 'TanStack/router:docs/router/installation/manual.md'\n\n  # ── Composition Skills ───────────────────────────────────────────\n  - name: 'External Data Loading (TanStack Query)'\n    slug: 'compositions/router-query'\n    type: 'composition'\n    domain: 'loading-data'\n    path: 'skills/compositions/router-query/SKILL.md'\n    package: 'packages/react-router'\n    description: >-\n      Integrating TanStack Router with TanStack Query: queryClient\n      in router context, ensureQueryData/prefetchQuery in loaders,\n      useSuspenseQuery in components, defaultPreloadStaleTime: 0,\n      setupRouterSsrQueryIntegration for SSR dehydration/hydration\n      and streaming, per-request QueryClient isolation.\n    requires:\n      - 'router-core'\n      - 'router-core/data-loading'\n      - 'react-router'\n    sources:\n      - 'TanStack/router:docs/router/guide/external-data-loading.md'\n      - 'TanStack/router:docs/router/integrations/query.md'\n\n  # ── Lifecycle Skills ─────────────────────────────────────────────\n  - name: 'Migrate from React Router'\n    slug: 'lifecycle/migrate-from-react-router'\n    type: 'lifecycle'\n    domain: 'defining-routes'\n    path: 'skills/lifecycle/migrate-from-react-router/SKILL.md'\n    package: 'packages/react-router'\n    description: >-\n      Step-by-step migration from React Router v7 to TanStack Router:\n      route definition conversion, Link/useNavigate API differences,\n      useSearchParams to validateSearch + useSearch, useParams with from,\n      Outlet replacement, loader conversion, code splitting differences.\n    requires:\n      - 'router-core'\n      - 'react-router'\n    sources:\n      - 'TanStack/router:docs/router/how-to/migrate-from-react-router.md'\n      - 'TanStack/router:docs/router/installation/migrate-from-react-router.md'\n"
  },
  {
    "path": "_artifacts/start_domain_map.yaml",
    "content": "# domain_map.yaml\n# Generated by skill-domain-discovery\n# Library: TanStack Start\n# Version: 1.166.2\n# Date: 2026-03-07\n# Status: reviewed\n\nlibrary:\n  name: '@tanstack/react-start'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Full-stack React framework built on TanStack Router and Vite. Adds\n    SSR, streaming, server functions (type-safe RPCs), middleware,\n    server routes, and universal deployment. Isomorphic by default —\n    all code runs in both environments unless explicitly constrained.\n  primary_framework: 'React'\n\ndomains:\n  - name: 'Project Setup'\n    slug: 'project-setup'\n    description: >-\n      Scaffolding a Start project, configuring Vite plugin, router\n      setup with getRouter(), root route with document shell, client\n      and server entry points.\n\n  - name: 'Server Functions'\n    slug: 'server-functions'\n    description: >-\n      Creating type-safe RPCs with createServerFn, input validation,\n      calling from loaders/components/other server functions, error\n      handling, streaming responses.\n\n  - name: 'Middleware and Context'\n    slug: 'middleware-and-context'\n    description: >-\n      Request middleware, server function middleware, context passing\n      with sendContext, global middleware via createStart, middleware\n      factories, fetch override precedence.\n\n  - name: 'Execution Model'\n    slug: 'execution-model'\n    description: >-\n      Isomorphic code execution, environment functions\n      (createServerFn, createServerOnlyFn, createClientOnlyFn,\n      createIsomorphicFn), import protection, dead code elimination,\n      environment variable safety.\n\n  - name: 'Server Routes'\n    slug: 'server-routes'\n    description: >-\n      Server-side API endpoints defined in routes, HTTP method\n      handlers, handler middleware, request/response patterns.\n\n  - name: 'Deployment and Rendering'\n    slug: 'deployment-and-rendering'\n    description: >-\n      Hosting providers (Cloudflare, Netlify, Vercel, Node/Docker),\n      selective SSR, SPA mode, static prerendering, ISR with\n      Cache-Control headers, SEO and head management.\n\nskills:\n  # ── Project Setup ────────────────────────────────────────────────\n  - name: 'Start Setup'\n    slug: 'start-setup'\n    domain: 'project-setup'\n    description: >-\n      Scaffold a TanStack Start project, configure Vite plugin with\n      tanstackStart(), set up router with getRouter(), create root\n      route with document shell (HeadContent, Scripts, Outlet),\n      configure client and server entry points.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-plugin-core'\n    covers:\n      - tanstackStart Vite plugin\n      - getRouter() factory pattern\n      - Root route document shell\n      - HeadContent / Scripts / Outlet\n      - Client entry point (optional)\n      - Server entry point (optional)\n      - routeTree.gen.ts\n      - tsconfig configuration\n    tasks:\n      - 'Scaffold a new TanStack Start project'\n      - 'Configure the Vite plugin'\n      - 'Set up the router factory'\n      - 'Customize client/server entry points'\n    failure_modes:\n      - mistake: 'React plugin before Start plugin in Vite config'\n        mechanism: >-\n          Start's Vite plugin must come before React's plugin.\n          Wrong order causes route generation and server function\n          compilation to fail.\n        wrong_pattern: |\n          plugins: [react(), tanstackStart()]\n        correct_pattern: |\n          plugins: [tanstackStart(), react()]\n        source: 'docs/start/framework/react/build-from-scratch.md'\n        priority: CRITICAL\n        status: active\n\n      - mistake: 'Enabling verbatimModuleSyntax in tsconfig'\n        mechanism: >-\n          verbatimModuleSyntax causes server bundles to leak into\n          client bundles. Must be disabled.\n        source: 'docs/start/framework/react/build-from-scratch.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Missing Scripts component in root route'\n        mechanism: >-\n          The Scripts component must be rendered in the body of\n          the root route for proper hydration and functionality.\n          Without it, client-side JavaScript does not load.\n        source: 'docs/start/framework/react/guide/routing.md'\n        priority: HIGH\n        status: active\n\n  # ── Server Functions ─────────────────────────────────────────────\n  - name: 'Server Functions'\n    slug: 'server-functions'\n    domain: 'server-functions'\n    description: >-\n      Create type-safe RPCs with createServerFn, validate inputs\n      with Zod or plain functions, call from loaders/components/\n      event handlers, handle errors/redirects/notFound, stream\n      responses with ReadableStream or async generators.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-client-core'\n      - '@tanstack/start-server-core'\n    covers:\n      - createServerFn (GET/POST)\n      - inputValidator (Zod or function)\n      - useServerFn hook\n      - Server context utilities (getRequest, getRequestHeader, setResponseHeader, setResponseStatus)\n      - Error handling (throw errors, redirect, notFound)\n      - Streaming (ReadableStream, async generators)\n      - File organization (.functions.ts, .server.ts)\n      - FormData handling\n    tasks:\n      - 'Create a server function for data fetching'\n      - 'Validate server function inputs'\n      - 'Call server functions from components'\n      - 'Stream data from server functions'\n      - 'Handle errors in server functions'\n    failure_modes:\n      - mistake: 'Putting server-only code in loaders instead of server functions'\n        mechanism: >-\n          Loaders are ISOMORPHIC — they run on both client and server.\n          Database queries, file system access, and secret API keys\n          in loaders will either fail on the client or leak to the\n          client bundle. Use createServerFn for server-only logic.\n        wrong_pattern: |\n          export const Route = createFileRoute('/posts')({\n            loader: async () => {\n              const posts = await db.query('SELECT * FROM posts')\n              return { posts }\n            },\n          })\n        correct_pattern: |\n          const getPosts = createServerFn({ method: 'GET' })\n            .handler(async () => {\n              const posts = await db.query('SELECT * FROM posts')\n              return { posts }\n            })\n\n          export const Route = createFileRoute('/posts')({\n            loader: () => getPosts(),\n          })\n        source: 'maintainer interview'\n        priority: CRITICAL\n        status: active\n        skills: ['server-functions', 'execution-model']\n\n      - mistake: 'Using dynamic imports for server functions'\n        mechanism: >-\n          Dynamic imports of server functions can cause bundler\n          issues. Static imports are safe — the build process\n          replaces server implementations with RPC stubs.\n        wrong_pattern: |\n          const { getUser } = await import('~/utils/users.functions')\n        correct_pattern: |\n          import { getUser } from '~/utils/users.functions'\n        source: 'docs/start/framework/react/guide/server-functions.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Generating Next.js or Remix server patterns'\n        mechanism: >-\n          Agents generate getServerSideProps, \"use server\" directives,\n          or Remix-style loader exports. TanStack Start uses\n          createServerFn for server-only code.\n        wrong_pattern: |\n          'use server'\n          export async function getUser() { ... }\n        correct_pattern: |\n          const getUser = createServerFn({ method: 'GET' })\n            .handler(async () => { ... })\n        source: 'maintainer interview'\n        priority: CRITICAL\n        status: active\n\n  # ── Middleware and Context ───────────────────────────────────────\n  - name: 'Middleware'\n    slug: 'middleware'\n    domain: 'middleware-and-context'\n    description: >-\n      Request middleware and server function middleware with\n      createMiddleware, context passing via next(), sendContext\n      for client-server transfer, global middleware via createStart\n      in src/start.ts, middleware factories, fetch override\n      precedence, header merging.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-client-core'\n      - '@tanstack/start-server-core'\n    covers:\n      - createMiddleware\n      - Request middleware (.server only)\n      - Server function middleware (.client + .server)\n      - Context passing via next({ context })\n      - sendContext for client-server transfer\n      - Global middleware (createStart in src/start.ts)\n      - Middleware factories\n      - Fetch override precedence\n      - Header merging\n      - Method order enforcement (middleware → inputValidator → client → server)\n    tasks:\n      - 'Add authentication middleware'\n      - 'Pass context through middleware chain'\n      - 'Configure global request middleware'\n      - 'Create reusable middleware factories'\n    failure_modes:\n      - mistake: 'Trusting client context without server validation'\n        mechanism: >-\n          Client context via sendContext is NOT validated by default.\n          Dynamic user-generated data must be validated in server-side\n          middleware before use.\n        source: 'docs/start/framework/react/guide/middleware.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Wrong middleware method order'\n        mechanism: >-\n          TypeScript enforces method order: middleware → inputValidator\n          → client → server. Wrong order causes type errors and\n          runtime failures.\n        source: 'docs/start/framework/react/guide/middleware.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Confusing request vs server function middleware'\n        mechanism: >-\n          Request middleware runs on ALL server requests (SSR, server\n          routes, server functions). Server function middleware runs\n          only for server functions and has .client() method. Using\n          the wrong type causes unexpected scope.\n        source: 'docs/start/framework/react/guide/middleware.md'\n        priority: MEDIUM\n        status: active\n\n  # ── Execution Model ──────────────────────────────────────────────\n  - name: 'Execution Model'\n    slug: 'execution-model'\n    domain: 'execution-model'\n    description: >-\n      Isomorphic code execution model, environment boundary functions\n      (createServerFn, createServerOnlyFn, createClientOnlyFn,\n      createIsomorphicFn), import protection, dead code elimination,\n      environment variable safety (VITE_ prefix), useHydrated hook.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-client-core'\n      - '@tanstack/start-server-core'\n    covers:\n      - Isomorphic-by-default principle\n      - createServerFn (RPC boundary)\n      - createServerOnlyFn (throws on client)\n      - createClientOnlyFn (throws on server)\n      - createIsomorphicFn (different impl per env)\n      - ClientOnly component\n      - useHydrated hook\n      - Import protection (experimental)\n      - Environment variables (VITE_ prefix, process.env)\n      - Dead code elimination / tree shaking\n    tasks:\n      - 'Protect server-only code from client bundles'\n      - 'Use environment-specific implementations'\n      - 'Handle environment variables safely'\n      - 'Debug import protection violations'\n    failure_modes:\n      - mistake: 'Assuming loaders are server-only'\n        mechanism: >-\n          ALL code in TanStack Start is isomorphic by default.\n          Loaders run on BOTH server and client. Server-only\n          operations must use createServerFn, createServerOnlyFn,\n          or server routes.\n        wrong_pattern: |\n          export const Route = createFileRoute('/dashboard')({\n            loader: async () => {\n              const secret = process.env.API_SECRET\n              return fetch(`https://api.example.com/data`, {\n                headers: { Authorization: secret }\n              })\n            },\n          })\n        correct_pattern: |\n          const getData = createServerFn({ method: 'GET' })\n            .handler(async () => {\n              const secret = process.env.API_SECRET\n              return fetch(`https://api.example.com/data`, {\n                headers: { Authorization: secret }\n              })\n            })\n\n          export const Route = createFileRoute('/dashboard')({\n            loader: () => getData(),\n          })\n        source: 'docs/start/framework/react/guide/execution-model.md'\n        priority: CRITICAL\n        status: active\n        skills: ['execution-model', 'server-functions']\n\n      - mistake: 'Exposing secrets via module-level process.env'\n        mechanism: >-\n          Module-level process.env access runs in both environments.\n          The variable value leaks into the client bundle. Access\n          secrets only inside createServerFn or createServerOnlyFn.\n        wrong_pattern: |\n          const apiKey = process.env.SECRET_KEY\n          export function fetchData() { ... }\n        correct_pattern: |\n          const fetchData = createServerFn({ method: 'GET' })\n            .handler(async () => {\n              const apiKey = process.env.SECRET_KEY\n              return fetch(url, { headers: { Authorization: apiKey } })\n            })\n        source: 'docs/start/framework/react/guide/execution-model.md'\n        priority: CRITICAL\n        status: active\n\n      - mistake: 'Using VITE_ prefix for server secrets'\n        mechanism: >-\n          VITE_ prefixed variables are exposed to the client bundle.\n          Server secrets must NOT have the VITE_ prefix. Access\n          them via process.env inside server functions only.\n        source: 'docs/start/framework/react/guide/environment-variables.md'\n        priority: CRITICAL\n        status: active\n\n  # ── Server Routes ────────────────────────────────────────────────\n  - name: 'Server Routes'\n    slug: 'server-routes'\n    domain: 'server-routes'\n    description: >-\n      Define server-side API endpoints alongside app routes using\n      the server property with HTTP method handlers, per-handler\n      middleware via createHandlers, request/response patterns.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-server-core'\n    covers:\n      - server property on createFileRoute\n      - handlers object (GET, POST, PUT, DELETE)\n      - createHandlers for per-handler middleware\n      - Handler context (request, params, context)\n      - Request body parsing (json, text, formData)\n      - Response helpers (Response.json)\n      - File naming for API routes\n    tasks:\n      - 'Create a REST API endpoint'\n      - 'Add middleware to server route handlers'\n      - 'Handle different HTTP methods'\n    failure_modes:\n      - mistake: 'Duplicate path resolution for server routes'\n        mechanism: >-\n          Each route can only have a single handler file. Having\n          both users.ts and users/index.ts causes errors.\n        source: 'docs/start/framework/react/guide/server-routes.md'\n        priority: MEDIUM\n        status: active\n\n  # ── Deployment and Rendering ─────────────────────────────────────\n  - name: 'Deployment'\n    slug: 'deployment'\n    domain: 'deployment-and-rendering'\n    description: >-\n      Deploy TanStack Start to Cloudflare Workers, Netlify, Vercel,\n      Node.js/Docker, Bun, Railway. Configure selective SSR, SPA\n      mode, static prerendering, ISR with Cache-Control headers.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-plugin-core'\n    covers:\n      - Cloudflare Workers deployment\n      - Netlify deployment\n      - Vercel / Railway deployment\n      - Node.js / Docker deployment\n      - Bun deployment\n      - Selective SSR (ssr option per route)\n      - SPA mode configuration\n      - Static prerendering (prerender option)\n      - ISR with Cache-Control headers\n      - SEO (head property, structured data)\n    tasks:\n      - 'Deploy to Cloudflare Workers'\n      - 'Deploy to Netlify'\n      - 'Configure selective SSR per route'\n      - 'Enable SPA mode'\n      - 'Set up static prerendering'\n      - 'Configure ISR with cache headers'\n    failure_modes:\n      - mistake: 'Bun deployment with React 18'\n        mechanism: >-\n          Bun-specific deployment only works with React 19.\n          For React 18, use Node.js deployment guidelines.\n        source: 'docs/start/framework/react/guide/hosting.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Missing nodejs_compat flag for Cloudflare Workers'\n        mechanism: >-\n          Cloudflare Workers requires compatibility_flags:\n          [\"nodejs_compat\"] in wrangler config. Without it,\n          Node.js APIs used by Start fail at runtime.\n        source: 'docs/start/framework/react/guide/hosting.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Child route loosening parent SSR config'\n        mechanism: >-\n          SSR config inherits from parent and can only become MORE\n          restrictive (true → data-only → false). A child cannot\n          set ssr: true if parent has ssr: false.\n        source: 'docs/start/framework/react/guide/selective-ssr.md'\n        priority: MEDIUM\n        status: active\n\ntensions:\n  - name: 'Isomorphic defaults vs server-only expectations'\n    skills: ['execution-model', 'server-functions']\n    description: >-\n      All code runs everywhere by default. Agents trained on\n      Next.js/Remix assume loaders and route code are server-only.\n    implication: >-\n      Agents put secrets, DB queries, and file system access in\n      loaders instead of server functions, causing client-side\n      failures or security leaks.\n\n  - name: 'Simplicity of isomorphic code vs security boundaries'\n    skills: ['execution-model', 'middleware']\n    description: >-\n      The isomorphic model makes code easy to write but requires\n      explicit boundaries for security. Agents don't realize they\n      need to actively constrain execution environment.\n    implication: >-\n      Agents expose secrets via module-level process.env or\n      forget to validate sendContext data in middleware.\n\ncross_references:\n  - from: 'server-functions'\n    to: 'execution-model'\n    reason: 'Server functions ARE the isomorphic boundary — understanding the execution model is prerequisite'\n  - from: 'server-functions'\n    to: 'middleware'\n    reason: 'Server function middleware chains compose with server functions'\n  - from: 'middleware'\n    to: 'server-routes'\n    reason: 'Server routes use the same middleware system'\n  - from: 'deployment'\n    to: 'execution-model'\n    reason: 'Deployment target affects which environment code runs in'\n\ngaps: []\n"
  },
  {
    "path": "_artifacts/start_skill_tree.yaml",
    "content": "# skills/_artifacts/start_skill_tree.yaml\nlibrary:\n  name: '@tanstack/react-start'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Full-stack React framework built on TanStack Router and Vite.\n    Adds SSR, streaming, server functions (type-safe RPCs), middleware,\n    server routes, and universal deployment. Isomorphic by default —\n    all code runs in both environments unless explicitly constrained.\ngenerated_from:\n  domain_map: '_artifacts/start_domain_map.yaml'\ngenerated_at: '2026-03-07'\n\nskills:\n  # ── Start Core Skills ───────────────────────────────────────────\n  - name: 'Start Core'\n    slug: 'start-core'\n    type: 'core'\n    domain: 'project-setup'\n    path: 'skills/start-core/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      Core overview for TanStack Start: tanstackStart() Vite plugin,\n      getRouter() factory, root route document shell (HeadContent,\n      Scripts, Outlet), client/server entry points, routeTree.gen.ts,\n      tsconfig configuration. Entry point for all Start skills.\n    sources:\n      - 'TanStack/router:docs/start/framework/react/build-from-scratch.md'\n      - 'TanStack/router:docs/start/framework/react/quick-start.md'\n      - 'TanStack/router:docs/start/framework/react/guide/routing.md'\n\n  - name: 'Server Functions'\n    slug: 'start-core/server-functions'\n    type: 'sub-skill'\n    domain: 'server-functions'\n    path: 'skills/start-core/server-functions/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      createServerFn (GET/POST), inputValidator (Zod or function),\n      useServerFn hook, server context utilities (getRequest,\n      getRequestHeader, setResponseHeader, setResponseStatus), error\n      handling (throw errors, redirect, notFound), streaming\n      (ReadableStream, async generators), FormData handling, file\n      organization (.functions.ts, .server.ts).\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/server-functions.md'\n\n  - name: 'Middleware'\n    slug: 'start-core/middleware'\n    type: 'sub-skill'\n    domain: 'middleware-and-context'\n    path: 'skills/start-core/middleware/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      createMiddleware, request middleware (.server only), server\n      function middleware (.client + .server), context passing via\n      next({ context }), sendContext for client-server transfer,\n      global middleware via createStart in src/start.ts, middleware\n      factories, method order enforcement.\n    requires:\n      - 'start-core'\n      - 'start-core/server-functions'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/middleware.md'\n\n  - name: 'Execution Model'\n    slug: 'start-core/execution-model'\n    type: 'sub-skill'\n    domain: 'execution-model'\n    path: 'skills/start-core/execution-model/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      Isomorphic-by-default principle, environment boundary functions\n      (createServerFn, createServerOnlyFn, createClientOnlyFn,\n      createIsomorphicFn), ClientOnly component, useHydrated hook,\n      import protection, dead code elimination, environment variable\n      safety (VITE_ prefix, process.env).\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/execution-model.md'\n      - 'TanStack/router:docs/start/framework/react/guide/environment-variables.md'\n\n  - name: 'Server Routes'\n    slug: 'start-core/server-routes'\n    type: 'sub-skill'\n    domain: 'server-routes'\n    path: 'skills/start-core/server-routes/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      Server-side API endpoints using the server property on\n      createFileRoute, HTTP method handlers (GET, POST, PUT, DELETE),\n      createHandlers for per-handler middleware, handler context\n      (request, params, context), request body parsing, response\n      helpers, file naming for API routes.\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/server-routes.md'\n\n  - name: 'Deployment'\n    slug: 'start-core/deployment'\n    type: 'sub-skill'\n    domain: 'deployment-and-rendering'\n    path: 'skills/start-core/deployment/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      Deploy to Cloudflare Workers, Netlify, Vercel, Node.js/Docker,\n      Bun, Railway. Selective SSR (ssr option per route), SPA mode,\n      static prerendering, ISR with Cache-Control headers, SEO and\n      head management.\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/hosting.md'\n      - 'TanStack/router:docs/start/framework/react/guide/selective-ssr.md'\n      - 'TanStack/router:docs/start/framework/react/guide/static-prerendering.md'\n      - 'TanStack/router:docs/start/framework/react/guide/full-stack-seo.md'\n\n  # ── React Start Skills ──────────────────────────────────────────\n  - name: 'React Start'\n    slug: 'react-start'\n    type: 'framework'\n    domain: 'project-setup'\n    path: 'skills/react-start/SKILL.md'\n    package: 'packages/react-start'\n    description: >-\n      React bindings for TanStack Start: createStart, StartClient,\n      StartServer, React-specific imports, re-exports from\n      @tanstack/react-router, full project setup with React.\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:packages/react-start/src'\n      - 'TanStack/router:docs/start/framework/react/build-from-scratch.md'\n\n  # ── Lifecycle Skills ────────────────────────────────────────────\n  - name: 'Migrate from Next.js'\n    slug: 'lifecycle/migrate-from-nextjs'\n    type: 'lifecycle'\n    domain: 'project-setup'\n    path: 'skills/lifecycle/migrate-from-nextjs/SKILL.md'\n    package: 'packages/react-start'\n    description: >-\n      Step-by-step migration from Next.js App Router to TanStack\n      Start: route definition conversion, API mapping, server\n      function conversion from Server Actions, middleware conversion,\n      data fetching pattern changes.\n    requires:\n      - 'start-core'\n      - 'react-start'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/server-functions.md'\n      - 'TanStack/router:docs/start/framework/react/guide/middleware.md'\n      - 'TanStack/router:docs/start/framework/react/guide/execution-model.md'\n"
  },
  {
    "path": "benchmarks/bundle-size/.gitignore",
    "content": "node_modules\ndist\nscenarios/*/src/routeTree.gen.ts\n\nresults/*.json\nresults/*.md\nresults/*.js\n!results/.gitkeep\n"
  },
  {
    "path": "benchmarks/bundle-size/README.md",
    "content": "# Bundle Size Benchmarks\n\nThis workspace contains deterministic bundle-size fixtures for:\n\n- `@tanstack/react-router`\n- `@tanstack/solid-router`\n- `@tanstack/vue-router`\n- `@tanstack/react-start`\n- `@tanstack/solid-start`\n\nEach package has two scenarios:\n\n- `minimal`: Small route app with `__root` + index route that renders `hello world`\n- `full`: Same route shape plus a broad root-level harness that imports/uses the full hooks/components surface\n- Start `full` scenarios also exercise `createServerFn`, `createMiddleware`, and `useServerFn`\n\n## Design Notes\n\n- Scenarios use file-based routing as the default app style.\n- Router scenarios use `@tanstack/router-plugin/vite` with `autoCodeSplitting: true`.\n- Start scenarios use `@tanstack/<framework>-start/plugin/vite` with router code-splitting enabled.\n- Full-surface coverage is manually maintained (no strict export-coverage gate).\n- Metrics are measured from initial-load JS graph only and reported as raw/gzip/brotli bytes.\n- Gzip is the primary tracking signal for PR deltas and historical charting.\n\n## Local Run\n\n```bash\npnpm nx run @benchmarks/bundle-size:build\n```\n\nThis writes:\n\n- `benchmarks/bundle-size/results/current.json`\n- `benchmarks/bundle-size/results/benchmark-action.json`\n\n## CI Reporting\n\n- PR workflow generates a sticky comment with:\n  - current gzip values\n  - baseline delta\n  - inline sparkline trend\n- Pushes to `main` publish historical chart data to GitHub Pages via `benchmark-action/github-action-benchmark`.\n\n## Manual Update Policy\n\nWhen router/start public hooks/components evolve, update the corresponding `*-full/src/routes/__root.tsx` harness to keep full scenarios representative.\n\n## Backfill Readiness\n\nThe measurement script supports optional interfaces for historical backfilling:\n\n- `--sha`\n- `--measured-at`\n- `--append-history`\n\nThese are intended for one-off scripts that replay historical commits and append results to the same history dataset shape used for chart generation.\nIf `--append-history` points at a `data.js` file, output is written as `window.BENCHMARK_DATA = ...` for direct GitHub Pages compatibility.\n"
  },
  {
    "path": "benchmarks/bundle-size/package.json",
    "content": "{\n  \"name\": \"@benchmarks/bundle-size\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"node ../../scripts/benchmarks/bundle-size/measure.mjs\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"solid-js\": \"^1.9.10\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/results/.gitkeep",
    "content": "\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-full/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>react-router-full</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-full/src/main.tsx",
    "content": "import ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')\nif (!rootElement) {\n  throw new Error('Root element `#app` not found')\n}\nif (!rootElement.innerHTML) {\n  ReactDOM.createRoot(rootElement).render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-full/src/routes/__root.tsx",
    "content": "import {\n  Asset,\n  Await,\n  Block,\n  CatchBoundary,\n  CatchNotFound,\n  ClientOnly,\n  DefaultGlobalNotFound,\n  ErrorComponent,\n  HeadContent,\n  Link,\n  Match,\n  MatchRoute,\n  Matches,\n  Navigate,\n  Outlet,\n  RouterContextProvider,\n  ScriptOnce,\n  Scripts,\n  ScrollRestoration,\n  createLink,\n  createRootRoute,\n  linkOptions,\n  useAwaited,\n  useBlocker,\n  useCanGoBack,\n  useElementScrollRestoration,\n  useHydrated,\n  useLinkProps,\n  useLoaderData,\n  useLoaderDeps,\n  useLocation,\n  useMatch,\n  useMatchRoute,\n  useMatches,\n  useNavigate,\n  useParams,\n  useParentMatches,\n  useChildMatches,\n  useRouteContext,\n  useRouter,\n  useRouterState,\n  useSearch,\n  useTags,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const hydrated = useHydrated()\n  const awaited = useAwaited({ promise: Promise.resolve('ready') })\n  const linkProps = useLinkProps({ to: '/' } as any)\n  const matchRoute = useMatchRoute()\n  const matches = useMatches()\n  const parentMatches = useParentMatches()\n  const childMatches = useChildMatches()\n  const match = useMatch({ strict: false, shouldThrow: false } as any)\n  const loaderDeps = useLoaderDeps({ strict: false } as any)\n  const loaderData = useLoaderData({ strict: false } as any)\n  const params = useParams({ strict: false } as any)\n  const search = useSearch({ strict: false } as any)\n  const routeContext = useRouteContext({ strict: false } as any)\n  const routerState = useRouterState({ select: (state) => state.status } as any)\n  const location = useLocation()\n  const canGoBack = useCanGoBack()\n  const navigate = useNavigate()\n  const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })\n  const tags = useTags()\n\n  useBlocker({\n    shouldBlockFn: () => false,\n    disabled: true,\n    withResolver: false,\n  })\n\n  const linkFactoryResult = linkOptions({ to: '/' } as any)\n  const routeMatchResult = matchRoute({ to: '/' } as any)\n  const SvgLink = createLink('svg')\n\n  const hooksAndComponents = [\n    useAwaited,\n    useHydrated,\n    useLinkProps,\n    useMatchRoute,\n    useMatches,\n    useParentMatches,\n    useChildMatches,\n    useMatch,\n    useLoaderDeps,\n    useLoaderData,\n    useBlocker,\n    useNavigate,\n    useParams,\n    useSearch,\n    useRouteContext,\n    useRouter,\n    useRouterState,\n    useLocation,\n    useCanGoBack,\n    useElementScrollRestoration,\n    useTags,\n    Await,\n    CatchBoundary,\n    CatchNotFound,\n    ClientOnly,\n    DefaultGlobalNotFound,\n    ErrorComponent,\n    Link,\n    Match,\n    MatchRoute,\n    Matches,\n    Navigate,\n    Outlet,\n    RouterContextProvider,\n    ScrollRestoration,\n    Block,\n    ScriptOnce,\n    Asset,\n    HeadContent,\n    Scripts,\n  ]\n\n  ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = {\n    hooksAndComponents,\n  }\n\n  void awaited\n  void linkFactoryResult\n  void matches\n  void parentMatches\n  void childMatches\n  void match\n  void loaderDeps\n  void loaderData\n  void params\n  void search\n  void routeContext\n  void routerState\n  void location\n  void canGoBack\n  void navigate\n  void scrollEntry\n  void tags\n  void routeMatchResult\n\n  return (\n    <>\n      <HeadContent />\n      <ScriptOnce>{'window.__tsr_bundle_size = true'}</ScriptOnce>\n      <Asset\n        tag=\"meta\"\n        attrs={{ name: 'bundle-size', content: 'react-router-full' }}\n      />\n      <Link {...(linkProps as any)}>home</Link>\n      <SvgLink to=\"/\" aria-label=\"svg-home\">\n        <circle cx=\"8\" cy=\"8\" r=\"7\" />\n      </SvgLink>\n      <MatchRoute to=\"/\">{() => <span data-test=\"match-route\" />}</MatchRoute>\n      <ClientOnly fallback={<span data-test=\"client-only-fallback\" />}>\n        <span data-test=\"client-only\" />\n      </ClientOnly>\n      <Await promise={Promise.resolve('done')}>\n        {() => <span data-test=\"await\" />}\n      </Await>\n      <Block shouldBlockFn={() => false} disabled withResolver={false}>\n        {() => <span data-test=\"block\" />}\n      </Block>\n      <CatchNotFound fallback={() => <DefaultGlobalNotFound />}>\n        <span data-test=\"catch-not-found\" />\n      </CatchNotFound>\n      <RouterContextProvider router={router}>\n        <span data-test=\"nested-router-context\" />\n      </RouterContextProvider>\n      <ScrollRestoration />\n      <Outlet />\n      <Scripts />\n      <div data-test=\"full-root\" data-hydrated={String(hydrated)}>\n        <div>hello world</div>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-full/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-full/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-minimal/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>react-router-minimal</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-minimal/src/main.tsx",
    "content": "import ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')\nif (!rootElement) {\n  throw new Error('Root element `#app` not found')\n}\nif (!rootElement.innerHTML) {\n  ReactDOM.createRoot(rootElement).render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-minimal/src/routes/__root.tsx",
    "content": "import { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return <Outlet />\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-minimal/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-router-minimal/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-start-full/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-start-full/src/routes/__root.tsx",
    "content": "import {\n  Asset,\n  Await,\n  Block,\n  CatchBoundary,\n  CatchNotFound,\n  ClientOnly,\n  DefaultGlobalNotFound,\n  ErrorComponent,\n  HeadContent,\n  Link,\n  Match,\n  MatchRoute,\n  Matches,\n  Navigate,\n  Outlet,\n  RouterContextProvider,\n  ScriptOnce,\n  Scripts,\n  ScrollRestoration,\n  createLink,\n  createRootRoute,\n  linkOptions,\n  useAwaited,\n  useBlocker,\n  useCanGoBack,\n  useElementScrollRestoration,\n  useHydrated,\n  useLinkProps,\n  useLoaderData,\n  useLoaderDeps,\n  useLocation,\n  useMatch,\n  useMatchRoute,\n  useMatches,\n  useNavigate,\n  useParams,\n  useParentMatches,\n  useChildMatches,\n  useRouteContext,\n  useRouter,\n  useRouterState,\n  useSearch,\n  useTags,\n} from '@tanstack/react-router'\nimport {\n  createMiddleware,\n  createServerFn,\n  useServerFn,\n} from '@tanstack/react-start'\n\nconst requestMiddleware = createMiddleware().server(async ({ next }) => {\n  return next()\n})\n\nconst functionMiddleware = createMiddleware({ type: 'function' })\n  .client(async ({ next }) => {\n    return next()\n  })\n  .server(async ({ next }) => {\n    return next()\n  })\n\nconst helloServerFn = createServerFn({ method: 'GET' })\n  .middleware([requestMiddleware, functionMiddleware])\n  .handler(async () => {\n    return 'hello from server fn'\n  })\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const hydrated = useHydrated()\n  const awaited = useAwaited({ promise: Promise.resolve('ready') })\n  const linkProps = useLinkProps({ to: '/' } as any)\n  const matchRoute = useMatchRoute()\n  const matches = useMatches()\n  const parentMatches = useParentMatches()\n  const childMatches = useChildMatches()\n  const match = useMatch({ strict: false, shouldThrow: false } as any)\n  const loaderDeps = useLoaderDeps({ strict: false } as any)\n  const loaderData = useLoaderData({ strict: false } as any)\n  const params = useParams({ strict: false } as any)\n  const search = useSearch({ strict: false } as any)\n  const routeContext = useRouteContext({ strict: false } as any)\n  const routerState = useRouterState({ select: (state) => state.status } as any)\n  const location = useLocation()\n  const canGoBack = useCanGoBack()\n  const navigate = useNavigate()\n  const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })\n  const tags = useTags()\n  const invokeServerFn = useServerFn(helloServerFn)\n\n  useBlocker({\n    shouldBlockFn: () => false,\n    disabled: true,\n    withResolver: false,\n  })\n\n  const linkFactoryResult = linkOptions({ to: '/' } as any)\n  const routeMatchResult = matchRoute({ to: '/' } as any)\n  const SvgLink = createLink('svg')\n\n  const startSurface = [createMiddleware, createServerFn, useServerFn]\n  const hooksAndComponents = [\n    useAwaited,\n    useHydrated,\n    useLinkProps,\n    useMatchRoute,\n    useMatches,\n    useParentMatches,\n    useChildMatches,\n    useMatch,\n    useLoaderDeps,\n    useLoaderData,\n    useBlocker,\n    useNavigate,\n    useParams,\n    useSearch,\n    useRouteContext,\n    useRouter,\n    useRouterState,\n    useLocation,\n    useCanGoBack,\n    useElementScrollRestoration,\n    useTags,\n    Await,\n    CatchBoundary,\n    CatchNotFound,\n    ClientOnly,\n    DefaultGlobalNotFound,\n    ErrorComponent,\n    Link,\n    Match,\n    MatchRoute,\n    Matches,\n    Navigate,\n    Outlet,\n    RouterContextProvider,\n    ScrollRestoration,\n    Block,\n    ScriptOnce,\n    Asset,\n    HeadContent,\n    Scripts,\n  ]\n\n  ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = {\n    hooksAndComponents,\n    startSurface,\n  }\n\n  void awaited\n  void linkFactoryResult\n  void matches\n  void parentMatches\n  void childMatches\n  void match\n  void loaderDeps\n  void loaderData\n  void params\n  void search\n  void routeContext\n  void routerState\n  void location\n  void canGoBack\n  void navigate\n  void scrollEntry\n  void tags\n  void routeMatchResult\n  void invokeServerFn\n\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <ScriptOnce>{'window.__tsr_bundle_size = true'}</ScriptOnce>\n        <Asset\n          tag=\"meta\"\n          attrs={{ name: 'bundle-size', content: 'react-start-full' }}\n        />\n        <Link {...(linkProps as any)}>home</Link>\n        <SvgLink to=\"/\" aria-label=\"svg-home\">\n          <circle cx=\"8\" cy=\"8\" r=\"7\" />\n        </SvgLink>\n        <MatchRoute to=\"/\">{() => <span data-test=\"match-route\" />}</MatchRoute>\n        <ClientOnly fallback={<span data-test=\"client-only-fallback\" />}>\n          <span data-test=\"client-only\" />\n        </ClientOnly>\n        <Await promise={Promise.resolve('done')}>\n          {() => <span data-test=\"await\" />}\n        </Await>\n        <Block shouldBlockFn={() => false} disabled withResolver={false}>\n          {() => <span data-test=\"block\" />}\n        </Block>\n        <CatchNotFound fallback={() => <DefaultGlobalNotFound />}>\n          <span data-test=\"catch-not-found\" />\n        </CatchNotFound>\n        <RouterContextProvider router={router}>\n          <span data-test=\"nested-router-context\" />\n        </RouterContextProvider>\n        <ScrollRestoration />\n        <Outlet />\n        <Scripts />\n        <div data-test=\"full-root\" data-hydrated={String(hydrated)}>\n          <div>hello world</div>\n        </div>\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-start-full/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-start-full/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-start-minimal/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-start-minimal/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-start-minimal/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/react-start-minimal/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-full/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>solid-router-full</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-full/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')\nif (!rootElement) {\n  throw new Error('Root element `#app` not found')\n}\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx",
    "content": "import {\n  Asset,\n  Await,\n  Block,\n  CatchBoundary,\n  CatchNotFound,\n  ClientOnly,\n  DefaultGlobalNotFound,\n  ErrorComponent,\n  HeadContent,\n  Link,\n  Match,\n  MatchRoute,\n  Matches,\n  Navigate,\n  Outlet,\n  RouterContextProvider,\n  ScriptOnce,\n  Scripts,\n  ScrollRestoration,\n  createLink,\n  createRootRoute,\n  linkOptions,\n  useAwaited,\n  useBlocker,\n  useCanGoBack,\n  useChildMatches,\n  useElementScrollRestoration,\n  useHydrated,\n  useLinkProps,\n  useLoaderData,\n  useLoaderDeps,\n  useLocation,\n  useMatch,\n  useMatchRoute,\n  useMatches,\n  useNavigate,\n  useParams,\n  useParentMatches,\n  useRouteContext,\n  useRouter,\n  useRouterState,\n  useSearch,\n  useTags,\n} from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const hydrated = useHydrated()\n  const [awaited] = useAwaited({ promise: Promise.resolve('ready') })\n  const linkProps = useLinkProps({ to: '/' } as any)\n  const matchRoute = useMatchRoute()\n  const matches = useMatches()\n  const parentMatches = useParentMatches()\n  const childMatches = useChildMatches()\n  const match = useMatch({ strict: false, shouldThrow: false } as any)\n  const loaderDeps = useLoaderDeps({ strict: false } as any)\n  const loaderData = useLoaderData({ strict: false } as any)\n  const params = useParams({ strict: false } as any)\n  const search = useSearch({ strict: false } as any)\n  const routeContext = useRouteContext({ strict: false } as any)\n  const routerState = useRouterState({ select: (state) => state.status } as any)\n  const location = useLocation()\n  const canGoBack = useCanGoBack()\n  const navigate = useNavigate()\n  const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })\n  const tags = useTags()\n\n  useBlocker({\n    shouldBlockFn: () => false,\n    disabled: true,\n    withResolver: false,\n  })\n\n  const linkFactoryResult = linkOptions({ to: '/' } as any)\n  const routeMatchResult = matchRoute({ to: '/' } as any)\n  const SvgLink = createLink('svg')\n\n  const hooksAndComponents = [\n    useAwaited,\n    useHydrated,\n    useLinkProps,\n    useMatchRoute,\n    useMatches,\n    useParentMatches,\n    useChildMatches,\n    useMatch,\n    useLoaderDeps,\n    useLoaderData,\n    useBlocker,\n    useNavigate,\n    useParams,\n    useSearch,\n    useRouteContext,\n    useRouter,\n    useRouterState,\n    useLocation,\n    useCanGoBack,\n    useElementScrollRestoration,\n    useTags,\n    Await,\n    CatchBoundary,\n    CatchNotFound,\n    ClientOnly,\n    DefaultGlobalNotFound,\n    ErrorComponent,\n    Link,\n    Match,\n    MatchRoute,\n    Matches,\n    Navigate,\n    Outlet,\n    RouterContextProvider,\n    ScrollRestoration,\n    Block,\n    ScriptOnce,\n    Asset,\n    HeadContent,\n    Scripts,\n  ]\n\n  ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = {\n    hooksAndComponents,\n  }\n\n  void awaited\n  void linkFactoryResult\n  void matches()\n  void parentMatches()\n  void childMatches()\n  void match()\n  void loaderDeps()\n  void loaderData()\n  void params()\n  void search()\n  void routeContext()\n  void routerState()\n  void location()\n  void canGoBack()\n  void navigate\n  void scrollEntry\n  void tags()\n  void routeMatchResult()\n\n  return (\n    <>\n      <HeadContent />\n      <ScriptOnce>{'window.__tsr_bundle_size = true'}</ScriptOnce>\n      <Asset\n        tag=\"meta\"\n        attrs={{ name: 'bundle-size', content: 'solid-router-full' }}\n      />\n      <Link {...(linkProps as any)}>home</Link>\n      <SvgLink to=\"/\" aria-label=\"svg-home\">\n        <circle cx=\"8\" cy=\"8\" r=\"7\" />\n      </SvgLink>\n      <MatchRoute to=\"/\">{() => <span data-test=\"match-route\" />}</MatchRoute>\n      <ClientOnly fallback={<span data-test=\"client-only-fallback\" />}>\n        <span data-test=\"client-only\" />\n      </ClientOnly>\n      <Await promise={Promise.resolve('done')}>\n        {() => <span data-test=\"await\" />}\n      </Await>\n      <Block shouldBlockFn={() => false} disabled withResolver={false}>\n        {() => <span data-test=\"block\" />}\n      </Block>\n      <CatchNotFound fallback={() => <DefaultGlobalNotFound />}>\n        <span data-test=\"catch-not-found\" />\n      </CatchNotFound>\n      <RouterContextProvider router={router}>\n        {() => <span data-test=\"nested-router-context\" />}\n      </RouterContextProvider>\n      <ScrollRestoration />\n      <Outlet />\n      <Scripts />\n      <div data-test=\"full-root\" data-hydrated={String(hydrated())}>\n        <div>hello world</div>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-full/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-full/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-minimal/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>solid-router-minimal</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-minimal/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')\nif (!rootElement) {\n  throw new Error('Root element `#app` not found')\n}\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-minimal/src/routes/__root.tsx",
    "content": "import { Outlet, createRootRoute } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return <Outlet />\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-minimal/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-router-minimal/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-start-full/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx",
    "content": "import {\n  Asset,\n  Await,\n  Block,\n  CatchBoundary,\n  CatchNotFound,\n  ClientOnly,\n  DefaultGlobalNotFound,\n  ErrorComponent,\n  HeadContent,\n  Link,\n  Match,\n  MatchRoute,\n  Matches,\n  Navigate,\n  Outlet,\n  RouterContextProvider,\n  ScriptOnce,\n  Scripts,\n  ScrollRestoration,\n  createLink,\n  createRootRoute,\n  linkOptions,\n  useAwaited,\n  useBlocker,\n  useCanGoBack,\n  useChildMatches,\n  useElementScrollRestoration,\n  useHydrated,\n  useLinkProps,\n  useLoaderData,\n  useLoaderDeps,\n  useLocation,\n  useMatch,\n  useMatchRoute,\n  useMatches,\n  useNavigate,\n  useParams,\n  useParentMatches,\n  useRouteContext,\n  useRouter,\n  useRouterState,\n  useSearch,\n  useTags,\n} from '@tanstack/solid-router'\nimport {\n  createMiddleware,\n  createServerFn,\n  useServerFn,\n} from '@tanstack/solid-start'\n\ntype BundleSizeKeep = {\n  hooksAndComponents: ReadonlyArray<unknown>\n  startSurface: ReadonlyArray<unknown>\n}\n\ndeclare global {\n  var __TANSTACK_BUNDLE_SIZE_KEEP__: BundleSizeKeep | undefined\n}\n\nconst requestMiddleware = createMiddleware().server(async ({ next }) => {\n  return next()\n})\n\nconst functionMiddleware = createMiddleware({ type: 'function' })\n  .client(async ({ next }) => {\n    return next()\n  })\n  .server(async ({ next }) => {\n    return next()\n  })\n\nconst helloServerFn = createServerFn({ method: 'GET' })\n  .middleware([requestMiddleware, functionMiddleware])\n  .handler(async () => {\n    return 'hello from server fn'\n  })\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const hydrated = useHydrated()\n  const [awaited] = useAwaited({ promise: Promise.resolve('ready') })\n  const linkProps = useLinkProps({ to: '/' })\n  const matchRoute = useMatchRoute()\n  const matches = useMatches()\n  const parentMatches = useParentMatches()\n  const childMatches = useChildMatches()\n  const match = useMatch({ strict: false, shouldThrow: false })\n  const loaderDeps = useLoaderDeps({ strict: false })\n  const loaderData = useLoaderData({ strict: false })\n  const params = useParams({ strict: false })\n  const search = useSearch({ strict: false })\n  const routeContext = useRouteContext({ strict: false })\n  const routerState = useRouterState({ select: (state) => state.status })\n  const location = useLocation()\n  const canGoBack = useCanGoBack()\n  const navigate = useNavigate()\n  const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })\n  const tags = useTags()\n  const invokeServerFn = useServerFn(helloServerFn)\n\n  useBlocker({\n    shouldBlockFn: () => false,\n    disabled: true,\n    withResolver: false,\n  })\n\n  const linkFactoryResult = linkOptions({ to: '/' })\n  const routeMatchResult = matchRoute({ to: '/' })\n  const SvgLink = createLink('svg')\n\n  const startSurface = [createMiddleware, createServerFn, useServerFn]\n  const hooksAndComponents = [\n    useAwaited,\n    useHydrated,\n    useLinkProps,\n    useMatchRoute,\n    useMatches,\n    useParentMatches,\n    useChildMatches,\n    useMatch,\n    useLoaderDeps,\n    useLoaderData,\n    useBlocker,\n    useNavigate,\n    useParams,\n    useSearch,\n    useRouteContext,\n    useRouter,\n    useRouterState,\n    useLocation,\n    useCanGoBack,\n    useElementScrollRestoration,\n    useTags,\n    Await,\n    CatchBoundary,\n    CatchNotFound,\n    ClientOnly,\n    DefaultGlobalNotFound,\n    ErrorComponent,\n    Link,\n    Match,\n    MatchRoute,\n    Matches,\n    Navigate,\n    Outlet,\n    RouterContextProvider,\n    ScrollRestoration,\n    Block,\n    ScriptOnce,\n    Asset,\n    HeadContent,\n    Scripts,\n  ]\n\n  globalThis.__TANSTACK_BUNDLE_SIZE_KEEP__ = {\n    hooksAndComponents,\n    startSurface,\n  }\n\n  void awaited\n  void linkFactoryResult\n  void matches()\n  void parentMatches()\n  void childMatches()\n  void match()\n  void loaderDeps()\n  void loaderData()\n  void params()\n  void search()\n  void routeContext()\n  void routerState()\n  void location()\n  void canGoBack()\n  void navigate\n  void scrollEntry\n  void tags()\n  void routeMatchResult()\n  void invokeServerFn\n\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <ScriptOnce>{'window.__tsr_bundle_size = true'}</ScriptOnce>\n        <Asset\n          tag=\"meta\"\n          attrs={{ name: 'bundle-size', content: 'solid-start-full' }}\n        />\n        <Link {...linkProps}>home</Link>\n        <SvgLink to=\"/\" aria-label=\"svg-home\">\n          <circle cx=\"8\" cy=\"8\" r=\"7\" />\n        </SvgLink>\n        <MatchRoute to=\"/\">{() => <span data-test=\"match-route\" />}</MatchRoute>\n        <ClientOnly fallback={<span data-test=\"client-only-fallback\" />}>\n          <span data-test=\"client-only\" />\n        </ClientOnly>\n        <Await promise={Promise.resolve('done')}>\n          {() => <span data-test=\"await\" />}\n        </Await>\n        <Block shouldBlockFn={() => false} disabled withResolver={false}>\n          {() => <span data-test=\"block\" />}\n        </Block>\n        <CatchNotFound fallback={() => <DefaultGlobalNotFound />}>\n          <span data-test=\"catch-not-found\" />\n        </CatchNotFound>\n        <RouterContextProvider router={router}>\n          {() => <span data-test=\"nested-router-context\" />}\n        </RouterContextProvider>\n        <ScrollRestoration />\n        <Outlet />\n        <Scripts />\n        <div data-test=\"full-root\" data-hydrated={String(hydrated())}>\n          <div>hello world</div>\n        </div>\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-start-full/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-start-full/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [tanstackStart(), solid({ ssr: true })],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-start-minimal/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-start-minimal/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-start-minimal/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/solid-start-minimal/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [tanstackStart(), solid({ ssr: true })],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-full/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>vue-router-full</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-full/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')\nif (!rootElement) {\n  throw new Error('Root element `#app` not found')\n}\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx",
    "content": "import {\n  Asset,\n  Await,\n  Block,\n  Body,\n  CatchBoundary,\n  CatchNotFound,\n  ClientOnly,\n  DefaultGlobalNotFound,\n  ErrorComponent,\n  HeadContent,\n  Html,\n  Link,\n  Match,\n  MatchRoute,\n  Matches,\n  Navigate,\n  Outlet,\n  RouterContextProvider,\n  ScriptOnce,\n  Scripts,\n  ScrollRestoration,\n  createLink,\n  createRootRoute,\n  linkOptions,\n  useAwaited,\n  useBlocker,\n  useCanGoBack,\n  useChildMatches,\n  useElementScrollRestoration,\n  useLinkProps,\n  useLoaderData,\n  useLoaderDeps,\n  useLocation,\n  useMatch,\n  useMatchRoute,\n  useMatches,\n  useNavigate,\n  useParams,\n  useParentMatches,\n  useRouteContext,\n  useRouter,\n  useRouterState,\n  useSearch,\n  useTags,\n} from '@tanstack/vue-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const [awaited] = useAwaited({ promise: Promise.resolve('ready') })\n  const linkProps = useLinkProps({ to: '/' } as any)\n  const matchRoute = useMatchRoute()\n  const matches = useMatches()\n  const parentMatches = useParentMatches()\n  const childMatches = useChildMatches()\n  const match = useMatch({ strict: false, shouldThrow: false } as any)\n  const loaderDeps = useLoaderDeps({ strict: false } as any)\n  const loaderData = useLoaderData({ strict: false } as any)\n  const params = useParams({ strict: false } as any)\n  const search = useSearch({ strict: false } as any)\n  const routeContext = useRouteContext({ strict: false } as any)\n  const routerState = useRouterState({ select: (state) => state.status } as any)\n  const location = useLocation()\n  const canGoBack = useCanGoBack()\n  const navigate = useNavigate()\n  const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' })\n  const tags = useTags()\n\n  useBlocker({\n    shouldBlockFn: () => false,\n    disabled: true,\n    withResolver: false,\n  })\n\n  const linkFactoryResult = linkOptions({ to: '/' } as any)\n  const routeMatchResult = matchRoute({ to: '/' } as any)\n  const SvgLink = createLink('svg')\n\n  const hooksAndComponents = [\n    useAwaited,\n    useLinkProps,\n    useMatchRoute,\n    useMatches,\n    useParentMatches,\n    useChildMatches,\n    useMatch,\n    useLoaderDeps,\n    useLoaderData,\n    useBlocker,\n    useNavigate,\n    useParams,\n    useSearch,\n    useRouteContext,\n    useRouter,\n    useRouterState,\n    useLocation,\n    useCanGoBack,\n    useElementScrollRestoration,\n    useTags,\n    Await,\n    CatchBoundary,\n    CatchNotFound,\n    ClientOnly,\n    DefaultGlobalNotFound,\n    ErrorComponent,\n    Link,\n    Match,\n    MatchRoute,\n    Matches,\n    Navigate,\n    Outlet,\n    RouterContextProvider,\n    ScrollRestoration,\n    Block,\n    ScriptOnce,\n    Asset,\n    HeadContent,\n    Scripts,\n    Body,\n    Html,\n  ]\n\n  ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = {\n    hooksAndComponents,\n  }\n\n  void awaited\n  void linkFactoryResult\n  void matches.value\n  void parentMatches.value\n  void childMatches.value\n  void match.value\n  void loaderDeps.value\n  void loaderData.value\n  void params.value\n  void search.value\n  void routeContext.value\n  void routerState.value\n  void location.value\n  void canGoBack.value\n  void navigate\n  void scrollEntry\n  void tags()\n  void routeMatchResult.value\n\n  return (\n    <>\n      <HeadContent />\n      <ScriptOnce>{'window.__tsr_bundle_size = true'}</ScriptOnce>\n      <Asset\n        tag=\"meta\"\n        attrs={{ name: 'bundle-size', content: 'vue-router-full' }}\n      />\n      <Link {...(linkProps as any)}>home</Link>\n      <SvgLink to=\"/\" aria-label=\"svg-home\">\n        <circle cx=\"8\" cy=\"8\" r=\"7\" />\n      </SvgLink>\n      <MatchRoute to=\"/\">{() => <span data-test=\"match-route\" />}</MatchRoute>\n      <ClientOnly fallback={<span data-test=\"client-only-fallback\" />}>\n        <span data-test=\"client-only\" />\n      </ClientOnly>\n      <Await\n        promise={Promise.resolve('done')}\n        children={() => <span data-test=\"await\" />}\n      />\n      <Block shouldBlockFn={() => false} disabled withResolver={false}>\n        {() => <span data-test=\"block\" />}\n      </Block>\n      <CatchNotFound fallback={() => <DefaultGlobalNotFound />}>\n        <span data-test=\"catch-not-found\" />\n      </CatchNotFound>\n      <RouterContextProvider router={router}>\n        <span data-test=\"nested-router-context\" />\n      </RouterContextProvider>\n      <ScrollRestoration />\n      <Outlet />\n      <Scripts />\n      <div data-test=\"full-root\">\n        <div>hello world</div>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-full/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-full/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-minimal/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>vue-router-minimal</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-minimal/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')\nif (!rootElement) {\n  throw new Error('Root element `#app` not found')\n}\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-minimal/src/routes/__root.tsx",
    "content": "import { Outlet, createRootRoute } from '@tanstack/vue-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return <Outlet />\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-minimal/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return <div>hello world</div>\n}\n"
  },
  {
    "path": "benchmarks/bundle-size/scenarios/vue-router-minimal/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "benchmarks/bundle-size/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"jsx\": \"preserve\",\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "benchmarks/client-nav/README.md",
    "content": "# Client Navigation Benchmarks\n\nCross-framework client-side navigation benchmarks for:\n\n- `@tanstack/react-router`\n- `@tanstack/solid-router`\n- `@tanstack/vue-router`\n\n## Layout\n\n- `react/` - React benchmark + Vitest config\n- `solid/` - Solid benchmark + Vitest config\n- `vue/` - Vue benchmark + Vitest config\n\n## Run\n\nRun all benchmarks through Nx so dependency builds are part of the graph:\n\n```bash\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf --outputStyle=stream --skipRemoteCache\n```\n\nRun framework-specific benchmarks:\n\n```bash\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:react --outputStyle=stream --skipRemoteCache\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:solid --outputStyle=stream --skipRemoteCache\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:vue --outputStyle=stream --skipRemoteCache\n```\n\nRun framework-specific flame benchmarks (10 second loop, profiled with `@platformatic/flame`, forced to `NODE_ENV=production`):\n\n```bash\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:react --outputStyle=stream --skipRemoteCache\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:solid --outputStyle=stream --skipRemoteCache\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:vue --outputStyle=stream --skipRemoteCache\n```\n\nTypecheck benchmark sources:\n\n```bash\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:types --outputStyle=stream --skipRemoteCache\n```\n"
  },
  {
    "path": "benchmarks/client-nav/jsdom.ts",
    "content": "import { JSDOM } from 'jsdom'\n\nconst dom = new JSDOM('<!doctype html><html><body></body></html>', {\n  url: 'http://localhost/',\n})\n\nconst { window } = dom\n\nfunction setGlobal(name: string, value: unknown) {\n  Object.defineProperty(globalThis, name, {\n    value,\n    configurable: true,\n    writable: true,\n  })\n}\n\nsetGlobal('window', window)\nsetGlobal('document', window.document)\nsetGlobal('self', window)\nsetGlobal('navigator', window.navigator)\nsetGlobal('location', window.location)\nsetGlobal('history', window.history)\nsetGlobal('HTMLElement', window.HTMLElement)\nsetGlobal('Element', window.Element)\nsetGlobal('SVGElement', window.SVGElement)\nsetGlobal('DocumentFragment', window.DocumentFragment)\nsetGlobal('Node', window.Node)\nsetGlobal('MutationObserver', window.MutationObserver)\nsetGlobal('sessionStorage', window.sessionStorage)\nsetGlobal('localStorage', window.localStorage)\nsetGlobal('getComputedStyle', window.getComputedStyle.bind(window))\n\nsetGlobal(\n  'requestAnimationFrame',\n  window.requestAnimationFrame?.bind(window) ??\n    ((callback: (time: number) => void) =>\n      setTimeout(() => callback(performance.now()), 16)),\n)\n\nsetGlobal(\n  'cancelAnimationFrame',\n  window.cancelAnimationFrame?.bind(window) ??\n    ((handle: number) => clearTimeout(handle)),\n)\n\nwindow.scrollTo = () => {}\n\nexport { window }\n"
  },
  {
    "path": "benchmarks/client-nav/package.json",
    "content": "{\n  \"name\": \"@benchmarks/client-nav\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build:react\": \"vite build --config ./react/vite.config.ts\",\n    \"build:solid\": \"vite build --config ./solid/vite.config.ts\",\n    \"build:vue\": \"vite build --config ./vue/vite.config.ts\",\n    \"test:flame:react\": \"NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\\\"--stack-size=65500\\\" ./react/speed.flame.ts\",\n    \"test:flame:solid\": \"NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\\\"--stack-size=65500\\\" ./solid/speed.flame.ts\",\n    \"test:flame:vue\": \"NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\\\"--stack-size=65500\\\" ./vue/speed.flame.ts\",\n    \"test:perf\": \"NODE_ENV=production vitest bench --config ./vitest.config.ts\",\n    \"test:perf:react\": \"NODE_ENV=production vitest bench --config ./react/vite.config.ts ./react/speed.bench.ts\",\n    \"test:perf:solid\": \"NODE_ENV=production vitest bench --config ./solid/vite.config.ts ./solid/speed.bench.ts\",\n    \"test:perf:vue\": \"NODE_ENV=production vitest bench --config ./vue/vite.config.ts ./vue/speed.bench.ts\",\n    \"test:types\": \"pnpm run test:types:react && pnpm run test:types:solid && pnpm run test:types:vue\",\n    \"test:types:react\": \"tsc -p ./react/tsconfig.json --noEmit\",\n    \"test:types:solid\": \"tsc -p ./solid/tsconfig.json --noEmit\",\n    \"test:types:vue\": \"tsc -p ./vue/tsconfig.json --noEmit\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/router-core\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"solid-js\": \"^1.9.10\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@platformatic/flame\": \"^1.6.0\",\n    \"@codspeed/vitest-plugin\": \"^5.0.1\",\n    \"@testing-library/react\": \"^16.2.0\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"@types/jsdom\": \"28.0.0\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"vitest\": \"^4.0.17\"\n  },\n  \"nx\": {\n    \"targets\": {\n      \"build:react\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          {\n            \"projects\": [\n              \"@tanstack/react-router\"\n            ],\n            \"target\": \"build\"\n          }\n        ]\n      },\n      \"build:solid\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          {\n            \"projects\": [\n              \"@tanstack/solid-router\"\n            ],\n            \"target\": \"build\"\n          }\n        ]\n      },\n      \"build:vue\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          {\n            \"projects\": [\n              \"@tanstack/vue-router\"\n            ],\n            \"target\": \"build\"\n          }\n        ]\n      },\n      \"test:perf\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:react\",\n          \"build:solid\",\n          \"build:vue\"\n        ]\n      },\n      \"test:flame:react\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:react\"\n        ]\n      },\n      \"test:flame:solid\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:solid\"\n        ]\n      },\n      \"test:flame:vue\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:vue\"\n        ]\n      },\n      \"test:perf:react\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:react\"\n        ]\n      },\n      \"test:perf:solid\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:solid\"\n        ]\n      },\n      \"test:perf:vue\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:vue\"\n        ]\n      },\n      \"test:types\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"^build\"\n        ]\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "benchmarks/client-nav/react/app.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useParams,\n  useSearch,\n} from '@tanstack/react-router'\nimport { createRoot } from 'react-dom/client'\n\nfunction runPerfSelectorComputation(seed: number) {\n  let value = Math.trunc(seed) | 0\n\n  for (let index = 0; index < 100; index++) {\n    value = (value * 1664525 + 1013904223 + index) >>> 0\n  }\n\n  return value\n}\n\nconst selectors = Array.from({ length: 20 }, (_, index) => index)\n\nfunction Params() {\n  const params = useParams({\n    strict: false,\n    select: (params) => runPerfSelectorComputation(Number(params.id ?? 0)),\n  })\n  void params\n  return null\n}\n\nfunction Search() {\n  const search = useSearch({\n    strict: false,\n    select: (search) => runPerfSelectorComputation(Number(search.id ?? 0)),\n  })\n  void search\n  return null\n}\n\nfunction Links() {\n  return (\n    <Link to=\"/$id\" params={{ id: '0' }} search={{ id: '0' }}>\n      Link\n    </Link>\n  )\n}\n\nfunction Root() {\n  return (\n    <>\n      {selectors.map((selector) => (\n        <Params key={selector} />\n      ))}\n      {selectors.map((selector) => (\n        <Search key={selector} />\n      ))}\n      {selectors.map((selector) => (\n        <Links key={selector} />\n      ))}\n      <Outlet />\n    </>\n  )\n}\n\nconst rootRoute = createRootRoute({\n  component: Root,\n})\n\nconst route = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/$id',\n  component: () => <div />,\n})\n\nexport function mountTestApp(container: Element) {\n  const router = createRouter({\n    history: createMemoryHistory({\n      initialEntries: ['/0'],\n    }),\n    scrollRestoration: true,\n    routeTree: rootRoute.addChildren([route]),\n  })\n\n  const reactRoot = createRoot(container)\n  reactRoot.render(<RouterProvider router={router} />)\n\n  return {\n    router,\n    unmount() {\n      reactRoot.unmount()\n    },\n  }\n}\n"
  },
  {
    "path": "benchmarks/client-nav/react/setup.ts",
    "content": "import type { NavigateOptions } from '@tanstack/router-core'\nimport type * as App from './app'\n\nconst appModulePath = './dist/app.js'\nconst { mountTestApp } = (await import(appModulePath)) as typeof App\n\nexport function setup() {\n  if (process.env.NODE_ENV !== 'production') {\n    console.warn(\n      'client-nav benchmark is running without NODE_ENV=production; React dev overhead will dominate results.',\n    )\n  }\n  let id = 0\n  let unmount: (() => void) | undefined = undefined\n  let container: HTMLDivElement | undefined = undefined\n  let unsub = () => {}\n  let next: () => Promise<void> = () => Promise.reject('Test not initialized')\n\n  async function before() {\n    id = 0\n    container = document.createElement('div')\n    document.body.append(container)\n\n    const { router, unmount: dispose } = mountTestApp(container)\n    unmount = dispose\n    let resolve: () => void = () => {}\n    unsub = router.subscribe('onRendered', () => resolve())\n\n    const navigate = (opts: NavigateOptions) =>\n      new Promise<void>((resolveNext) => {\n        resolve = resolveNext\n        router.navigate(opts)\n      })\n\n    next = () => {\n      const nextId = id++\n\n      return navigate({\n        to: '/$id',\n        params: { id: nextId },\n        // update search every 2 navigations, to still test them, but also measure the impact of granular re-rendering\n        search: { id: Math.floor(nextId / 2) },\n        replace: true,\n      })\n    }\n    await router.load()\n  }\n\n  function after() {\n    unmount?.()\n    container?.remove()\n    unsub()\n  }\n\n  function tick() {\n    return next()\n  }\n\n  return {\n    before,\n    tick,\n    after,\n  }\n}\n"
  },
  {
    "path": "benchmarks/client-nav/react/speed.bench.ts",
    "content": "import { afterAll, beforeAll, bench, describe } from 'vitest'\nimport { setup } from './setup'\n\ndescribe('client-nav', () => {\n  const test = setup()\n\n  /**\n   * Running `vitest bench` ignores \"suite hooks\" like `beforeAll` and `afterAll`,\n   * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.\n   *\n   * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,\n   * but it does support `beforeAll` and `afterAll`.\n   *\n   * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.\n   */\n\n  beforeAll(test.before)\n  afterAll(test.after)\n\n  bench(\n    'client-side navigation loop (react)',\n    async () => {\n      for (let i = 0; i < 10; i++) {\n        await test.tick()\n      }\n    },\n    {\n      warmupIterations: 100,\n      time: 10_000,\n      setup: test.before,\n      teardown: test.after,\n    },\n  )\n})\n"
  },
  {
    "path": "benchmarks/client-nav/react/speed.flame.ts",
    "content": "import { window } from '../jsdom.ts'\nimport { setup } from './setup.ts'\n\nconst DURATION_MS = 10_000\n\nconst test = setup()\n\ntry {\n  await test.before()\n\n  const startedAt = performance.now()\n  while (performance.now() - startedAt < DURATION_MS) {\n    await test.tick()\n  }\n} finally {\n  test.after()\n  window.close()\n}\n"
  },
  {
    "path": "benchmarks/client-nav/react/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"allowImportingTsExtensions\": true,\n    \"jsxImportSource\": \"react\",\n    \"types\": [\"node\", \"vite/client\", \"vitest/globals\"]\n  },\n  \"include\": [\n    \"speed.bench.ts\",\n    \"speed.flame.ts\",\n    \"../jsdom.ts\",\n    \"setup.ts\",\n    \"vite.config.ts\",\n    \"../vitest.setup.ts\"\n  ]\n}\n"
  },
  {
    "path": "benchmarks/client-nav/react/vite.config.ts",
    "content": "import { defineConfig } from 'vitest/config'\nimport react from '@vitejs/plugin-react'\nimport codspeedPlugin from '@codspeed/vitest-plugin'\n\nexport default defineConfig({\n  plugins: [\n    !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&\n      codspeedPlugin(),\n    react(),\n  ],\n  build: {\n    outDir: './react/dist',\n    emptyOutDir: true,\n    minify: false,\n    lib: {\n      entry: './react/app.tsx',\n      formats: ['es'],\n      fileName: 'app',\n    },\n  },\n  test: {\n    name: '@benchmarks/client-nav (react)',\n    watch: false,\n    environment: 'jsdom',\n    setupFiles: ['./vitest.setup.ts'],\n  },\n})\n"
  },
  {
    "path": "benchmarks/client-nav/solid/app.tsx",
    "content": "import { For, createEffect } from 'solid-js'\nimport { render } from 'solid-js/web'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useParams,\n  useSearch,\n} from '@tanstack/solid-router'\n\nfunction runPerfSelectorComputation(seed: number) {\n  let value = Math.trunc(seed) | 0\n\n  for (let index = 0; index < 100; index++) {\n    value = (value * 1664525 + 1013904223 + index) >>> 0\n  }\n\n  return value\n}\n\nconst selectors = Array.from({ length: 20 }, (_, index) => index)\n\nfunction Params() {\n  const params = useParams({\n    strict: false,\n    select: (params) => runPerfSelectorComputation(Number(params.id ?? 0)),\n  })\n\n  createEffect(() => {\n    void params()\n  })\n\n  return null\n}\n\nfunction Search() {\n  const search = useSearch({\n    strict: false,\n    select: (search) => runPerfSelectorComputation(Number(search.id ?? 0)),\n  })\n\n  createEffect(() => {\n    void search()\n  })\n\n  return null\n}\n\nfunction Links() {\n  return (\n    <Link to=\"/$id\" params={{ id: '0' }} search={{ id: '0' }}>\n      Link\n    </Link>\n  )\n}\n\nfunction Root() {\n  return (\n    <>\n      <For each={selectors}>{() => <Params />}</For>\n      <For each={selectors}>{() => <Search />}</For>\n      <For each={selectors}>{() => <Links />}</For>\n      <Outlet />\n    </>\n  )\n}\n\nconst root = createRootRoute({\n  component: Root,\n})\n\nconst route = createRoute({\n  getParentRoute: () => root,\n  path: '/$id',\n  component: () => {\n    return <div />\n  },\n})\n\nexport function mountTestApp(container: Element) {\n  const router = createRouter({\n    history: createMemoryHistory({\n      initialEntries: ['/0'],\n    }),\n    scrollRestoration: true,\n    routeTree: root.addChildren([route]),\n  })\n\n  const unmount = render(() => <RouterProvider router={router} />, container)\n\n  return { router, unmount }\n}\n"
  },
  {
    "path": "benchmarks/client-nav/solid/setup.ts",
    "content": "import type { NavigateOptions } from '@tanstack/router-core'\nimport type * as App from './app'\n\nconst appModulePath = './dist/app.js'\nconst { mountTestApp } = (await import(appModulePath)) as typeof App\n\nexport function setup() {\n  if (process.env.NODE_ENV !== 'production') {\n    console.warn(\n      'client-nav benchmark is running without NODE_ENV=production; Solid dev overhead will dominate results.',\n    )\n  }\n\n  let id = 0\n  let dispose: (() => void) | undefined = undefined\n  let container: HTMLDivElement | undefined = undefined\n  let unsub = () => {}\n  let next: () => Promise<void> = () => Promise.reject('Test not initialized')\n\n  async function before() {\n    id = 0\n    container = document.createElement('div')\n    document.body.append(container)\n\n    const { router, unmount } = mountTestApp(container)\n    dispose = unmount\n    let resolveRendered: () => void = () => {}\n    unsub = router.subscribe('onRendered', () => {\n      resolveRendered()\n    })\n\n    const navigate = (opts: NavigateOptions) =>\n      new Promise<void>((resolveNext) => {\n        resolveRendered = resolveNext\n        router.navigate(opts)\n      })\n\n    next = () => {\n      const nextId = id++\n\n      return navigate({\n        to: '/$id',\n        params: { id: nextId },\n        // update search every 2 navigations, to still test them, but also measure the impact of granular re-rendering\n        search: { id: Math.floor(nextId / 2) },\n        replace: true,\n      })\n    }\n    await router.load()\n  }\n\n  function after() {\n    dispose?.()\n    container?.remove()\n    unsub()\n  }\n\n  function tick() {\n    return next()\n  }\n\n  return {\n    before,\n    tick,\n    after,\n  }\n}\n"
  },
  {
    "path": "benchmarks/client-nav/solid/speed.bench.ts",
    "content": "import { afterAll, beforeAll, bench, describe } from 'vitest'\nimport { setup } from './setup'\n\ndescribe('client-nav', () => {\n  const test = setup()\n\n  /**\n   * Running `vitest bench` ignores \"suite hooks\" like `beforeAll` and `afterAll`,\n   * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.\n   *\n   * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,\n   * but it does support `beforeAll` and `afterAll`.\n   *\n   * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.\n   */\n\n  beforeAll(test.before)\n  afterAll(test.after)\n\n  bench(\n    'client-side navigation loop (solid)',\n    async () => {\n      for (let i = 0; i < 10; i++) {\n        await test.tick()\n      }\n    },\n    {\n      warmupIterations: 100,\n      time: 10_000,\n      setup: test.before,\n      teardown: test.after,\n    },\n  )\n})\n"
  },
  {
    "path": "benchmarks/client-nav/solid/speed.flame.ts",
    "content": "import { window } from '../jsdom.ts'\nimport { setup } from './setup.ts'\n\nconst DURATION_MS = 10_000\n\nconst test = setup()\n\ntry {\n  await test.before()\n\n  const startedAt = performance.now()\n  while (performance.now() - startedAt < DURATION_MS) {\n    await test.tick()\n  }\n} finally {\n  test.after()\n  window.close()\n}\n"
  },
  {
    "path": "benchmarks/client-nav/solid/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"preserve\",\n    \"allowImportingTsExtensions\": true,\n    \"jsxImportSource\": \"solid-js\",\n    \"types\": [\"node\", \"vite/client\", \"vitest/globals\"]\n  },\n  \"include\": [\n    \"speed.bench.ts\",\n    \"speed.flame.ts\",\n    \"../jsdom.ts\",\n    \"setup.ts\",\n    \"vite.config.ts\",\n    \"../vitest.setup.ts\"\n  ]\n}\n"
  },
  {
    "path": "benchmarks/client-nav/solid/vite.config.ts",
    "content": "import { defineConfig } from 'vitest/config'\nimport solid from 'vite-plugin-solid'\nimport codspeedPlugin from '@codspeed/vitest-plugin'\n\nexport default defineConfig({\n  plugins: [\n    !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&\n      codspeedPlugin(),\n    solid({ hot: false, dev: false }),\n  ],\n  build: {\n    outDir: './solid/dist',\n    emptyOutDir: true,\n    minify: false,\n    lib: {\n      entry: './solid/app.tsx',\n      formats: ['es'],\n      fileName: 'app',\n    },\n  },\n  resolve: {\n    conditions: ['solid', 'browser'],\n  },\n  test: {\n    name: '@benchmarks/client-nav (solid)',\n    watch: false,\n    environment: 'jsdom',\n    setupFiles: ['./vitest.setup.ts'],\n    server: {\n      deps: {\n        inline: [/@solidjs/, /@tanstack\\/solid-store/],\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "benchmarks/client-nav/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"node\", \"vite/client\", \"vitest/globals\"]\n  },\n  \"include\": [\"vitest.setup.ts\"]\n}\n"
  },
  {
    "path": "benchmarks/client-nav/vitest.config.ts",
    "content": "import { defineConfig } from 'vitest/config'\n\nexport default defineConfig({\n  test: {\n    watch: false,\n    projects: [\n      './react/vite.config.ts',\n      './solid/vite.config.ts',\n      './vue/vite.config.ts',\n    ],\n  },\n})\n"
  },
  {
    "path": "benchmarks/client-nav/vitest.setup.ts",
    "content": "import { vi } from 'vitest'\n\n// @ts-expect-error\nglobal.IS_REACT_ACT_ENVIRONMENT = true\n\nwindow.scrollTo = vi.fn()\n"
  },
  {
    "path": "benchmarks/client-nav/vue/app.tsx",
    "content": "import * as Vue from 'vue'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useParams,\n  useSearch,\n} from '@tanstack/vue-router'\n\nfunction runPerfSelectorComputation(seed: number) {\n  let value = Math.trunc(seed) | 0\n\n  for (let index = 0; index < 100; index++) {\n    value = (value * 1664525 + 1013904223 + index) >>> 0\n  }\n\n  return value\n}\n\nconst selectors = Array.from({ length: 20 }, (_, index) => index)\n\nconst Params = Vue.defineComponent({\n  setup() {\n    const params = useParams({\n      strict: false,\n      select: (params) => runPerfSelectorComputation(Number(params.id ?? 0)),\n    })\n\n    return () => {\n      void params.value\n      return null\n    }\n  },\n})\n\nconst Search = Vue.defineComponent({\n  setup() {\n    const search = useSearch({\n      strict: false,\n      select: (search) => runPerfSelectorComputation(Number(search.id ?? 0)),\n    })\n\n    return () => {\n      void search.value\n      return null\n    }\n  },\n})\n\nconst Links = Vue.defineComponent({\n  setup() {\n    return () => (\n      <Link to=\"/$id\" params={{ id: '0' }} search={{ id: '0' }}>\n        Link\n      </Link>\n    )\n  },\n})\n\nconst Root = Vue.defineComponent({\n  setup() {\n    return () => (\n      <>\n        {selectors.map((selector) => (\n          <Params key={`params-${selector}`} />\n        ))}\n        {selectors.map((selector) => (\n          <Search key={`search-${selector}`} />\n        ))}\n        {selectors.map((selector) => (\n          <Links key={`link-${selector}`} />\n        ))}\n        <Outlet />\n      </>\n    )\n  },\n})\n\nconst root = createRootRoute({\n  component: Root,\n})\n\nconst route = createRoute({\n  getParentRoute: () => root,\n  path: '/$id',\n  component: () => <div />,\n})\n\nexport function mountTestApp(container: Element) {\n  const router = createRouter({\n    history: createMemoryHistory({\n      initialEntries: ['/0'],\n    }),\n    scrollRestoration: true,\n    routeTree: root.addChildren([route]),\n  })\n\n  const component = <RouterProvider router={router} />\n  const app = Vue.createApp({\n    render: () => component,\n  })\n\n  app.mount(container)\n\n  return {\n    router,\n    unmount() {\n      app.unmount()\n    },\n  }\n}\n"
  },
  {
    "path": "benchmarks/client-nav/vue/setup.ts",
    "content": "import type { NavigateOptions } from '@tanstack/router-core'\nimport type * as App from './app'\n\nconst appModulePath = './dist/app.js'\nconst { mountTestApp } = (await import(appModulePath)) as typeof App\n\nexport function setup() {\n  if (process.env.NODE_ENV !== 'production') {\n    console.warn(\n      'client-nav benchmark is running without NODE_ENV=production; Vue dev overhead will dominate results.',\n    )\n  }\n\n  let id = 0\n  let unmount: (() => void) | undefined = undefined\n  let container: HTMLDivElement | undefined = undefined\n  let unsub = () => {}\n  let next: () => Promise<void> = () => Promise.reject('Test not initialized')\n\n  async function before() {\n    id = 0\n    container = document.createElement('div')\n    document.body.append(container)\n\n    const { router, unmount: dispose } = mountTestApp(container)\n    unmount = dispose\n    let resolveRendered: () => void = () => {}\n    unsub = router.subscribe('onRendered', () => {\n      resolveRendered()\n    })\n\n    const navigate = (opts: NavigateOptions) =>\n      new Promise<void>((resolveNext) => {\n        resolveRendered = resolveNext\n        router.navigate(opts)\n      })\n\n    next = () => {\n      const nextId = id++\n\n      return navigate({\n        to: '/$id',\n        params: { id: nextId },\n        // update search every 2 navigations, to still test them, but also measure the impact of granular re-rendering\n        search: { id: Math.floor(nextId / 2) },\n        replace: true,\n      })\n    }\n    await router.load()\n  }\n\n  function after() {\n    unmount?.()\n    container?.remove()\n    unsub()\n  }\n\n  function tick() {\n    return next()\n  }\n\n  return {\n    before,\n    tick,\n    after,\n  }\n}\n"
  },
  {
    "path": "benchmarks/client-nav/vue/speed.bench.ts",
    "content": "import { afterAll, beforeAll, bench, describe } from 'vitest'\nimport { setup } from './setup'\n\ndescribe('client-nav', () => {\n  const test = setup()\n\n  /**\n   * Running `vitest bench` ignores \"suite hooks\" like `beforeAll` and `afterAll`,\n   * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.\n   *\n   * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,\n   * but it does support `beforeAll` and `afterAll`.\n   *\n   * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.\n   */\n\n  beforeAll(test.before)\n  afterAll(test.after)\n\n  bench(\n    'client-side navigation loop (vue)',\n    async () => {\n      for (let i = 0; i < 10; i++) {\n        await test.tick()\n      }\n    },\n    {\n      warmupIterations: 100,\n      time: 10_000,\n      setup: test.before,\n      teardown: test.after,\n    },\n  )\n})\n"
  },
  {
    "path": "benchmarks/client-nav/vue/speed.flame.ts",
    "content": "import { window } from '../jsdom.ts'\nimport { setup } from './setup.ts'\n\nconst DURATION_MS = 10_000\n\nconst test = setup()\n\ntry {\n  await test.before()\n\n  const startedAt = performance.now()\n  while (performance.now() - startedAt < DURATION_MS) {\n    await test.tick()\n  }\n} finally {\n  test.after()\n  window.close()\n}\n"
  },
  {
    "path": "benchmarks/client-nav/vue/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"preserve\",\n    \"allowImportingTsExtensions\": true,\n    \"jsxImportSource\": \"vue\",\n    \"types\": [\"node\", \"vite/client\", \"vitest/globals\"]\n  },\n  \"include\": [\n    \"speed.bench.ts\",\n    \"speed.flame.ts\",\n    \"../jsdom.ts\",\n    \"setup.ts\",\n    \"vite.config.ts\",\n    \"../vitest.setup.ts\"\n  ]\n}\n"
  },
  {
    "path": "benchmarks/client-nav/vue/vite.config.ts",
    "content": "import { defineConfig } from 'vitest/config'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport codspeedPlugin from '@codspeed/vitest-plugin'\n\nexport default defineConfig({\n  define: {\n    'process.env.NODE_ENV': JSON.stringify('production'),\n  },\n  plugins: [\n    !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&\n      codspeedPlugin(),\n    vue(),\n    vueJsx(),\n  ],\n  build: {\n    outDir: './vue/dist',\n    emptyOutDir: true,\n    minify: false,\n    lib: {\n      entry: './vue/app.tsx',\n      formats: ['es'],\n      fileName: 'app',\n    },\n  },\n  test: {\n    name: '@benchmarks/client-nav (vue)',\n    watch: false,\n    environment: 'jsdom',\n    setupFiles: ['./vitest.setup.ts'],\n  },\n})\n"
  },
  {
    "path": "benchmarks/ssr/README.md",
    "content": "# SSR Benchmarks\n\nCross-framework SSR request-loop benchmarks for:\n\n- `@tanstack/react-start`\n- `@tanstack/solid-start`\n- `@tanstack/vue-start`\n\nEach benchmark builds a Start app with file-based routes and runs Vitest benches against the built server handler.\n\n## Layout\n\n- `react/` - React Start benchmark + Vitest config\n- `solid/` - Solid Start benchmark + Vitest config\n- `vue/` - Vue Start benchmark + Vitest config\n\n## Run\n\nRun all benchmarks through Nx so dependency builds are part of the graph:\n\n```bash\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/ssr:test:perf --outputStyle=stream --skipRemoteCache\n```\n\nRun framework-specific benchmarks:\n\n```bash\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/ssr:test:perf:react --outputStyle=stream --skipRemoteCache\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/ssr:test:perf:solid --outputStyle=stream --skipRemoteCache\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/ssr:test:perf:vue --outputStyle=stream --skipRemoteCache\n```\n\nTypecheck benchmark sources:\n\n```bash\nCI=1 NX_DAEMON=false pnpm nx run @benchmarks/ssr:test:types --outputStyle=stream --skipRemoteCache\n```\n"
  },
  {
    "path": "benchmarks/ssr/bench-utils.ts",
    "content": "export interface StartRequestHandler {\n  fetch: (request: Request) => Promise<Response> | Response\n}\n\nexport interface RunSsrRequestLoopOptions {\n  seed: number\n  iterations?: number\n}\n\nconst requestInit = {\n  method: 'GET',\n  headers: {\n    accept: 'text/html',\n  },\n} satisfies RequestInit\n\nfunction createDeterministicRandom(seed: number) {\n  let state = seed >>> 0\n\n  return () => {\n    state = (state * 1664525 + 1013904223) >>> 0\n    return state / 0x100000000\n  }\n}\n\nfunction randomSegment(random: () => number) {\n  return Math.floor(random() * 1_000_000_000).toString(36)\n}\n\nfunction randomSearchValue(random: () => number) {\n  return `q-${randomSegment(random)}`\n}\n\nfunction randomRequestUrl(random: () => number) {\n  const a = randomSegment(random)\n  const b = randomSegment(random)\n  const c = randomSegment(random)\n  const d = randomSegment(random)\n  const q = randomSearchValue(random)\n\n  return `http://localhost/${a}/${b}/${c}/${d}?q=${q}`\n}\n\nexport async function runSsrRequestLoop(\n  handler: StartRequestHandler,\n  { seed, iterations = 10 }: RunSsrRequestLoopOptions,\n) {\n  const random = createDeterministicRandom(seed)\n  const pendingBodyReads: Array<Promise<void>> = []\n\n  for (let index = 0; index < iterations; index++) {\n    const requestUrl = randomRequestUrl(random)\n    const response = await handler.fetch(new Request(requestUrl, requestInit))\n\n    if (response.status !== 200) {\n      await Promise.allSettled(pendingBodyReads)\n\n      throw new Error(\n        `Request failed with non-200 status ${response.status} (${requestUrl})`,\n      )\n    }\n\n    pendingBodyReads.push(response.text().then(() => undefined))\n  }\n\n  await Promise.all(pendingBodyReads)\n}\n"
  },
  {
    "path": "benchmarks/ssr/package.json",
    "content": "{\n  \"name\": \"@benchmarks/ssr\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build:react\": \"vite build --config ./react/vite.config.ts\",\n    \"build:solid\": \"vite build --config ./solid/vite.config.ts\",\n    \"build:vue\": \"vite build --config ./vue/vite.config.ts\",\n    \"test:perf\": \"vitest bench\",\n    \"test:perf:react\": \"vitest bench --config ./react/vite.config.ts ./react/speed.bench.ts\",\n    \"test:perf:solid\": \"vitest bench --config ./solid/vite.config.ts ./solid/speed.bench.ts\",\n    \"test:perf:vue\": \"vitest bench --config ./vue/vite.config.ts ./vue/speed.bench.ts\",\n    \"test:types\": \"pnpm run test:types:react && pnpm run test:types:solid && pnpm run test:types:vue\",\n    \"test:types:react\": \"tsc -p ./react/tsconfig.json --noEmit\",\n    \"test:types:solid\": \"tsc -p ./solid/tsconfig.json --noEmit\",\n    \"test:types:vue\": \"tsc -p ./vue/tsconfig.json --noEmit\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"solid-js\": \"^1.9.10\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@codspeed/vitest-plugin\": \"^5.0.1\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"vitest\": \"^4.0.17\"\n  },\n  \"nx\": {\n    \"targets\": {\n      \"build:react\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          {\n            \"projects\": [\n              \"@tanstack/react-start\"\n            ],\n            \"target\": \"build\"\n          }\n        ]\n      },\n      \"build:solid\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          {\n            \"projects\": [\n              \"@tanstack/solid-start\"\n            ],\n            \"target\": \"build\"\n          }\n        ]\n      },\n      \"build:vue\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          {\n            \"projects\": [\n              \"@tanstack/vue-start\"\n            ],\n            \"target\": \"build\"\n          }\n        ]\n      },\n      \"test:perf\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:react\",\n          \"build:solid\",\n          \"build:vue\"\n        ]\n      },\n      \"test:perf:react\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:react\"\n        ]\n      },\n      \"test:perf:solid\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:solid\"\n        ]\n      },\n      \"test:perf:vue\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"build:vue\"\n        ]\n      },\n      \"test:types\": {\n        \"cache\": false,\n        \"dependsOn\": [\n          \"^build\"\n        ]\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/speed.bench.ts",
    "content": "import { afterAll, beforeAll, bench, describe } from 'vitest'\nimport { runSsrRequestLoop } from '../bench-utils'\nimport type { StartRequestHandler } from '../bench-utils'\n\nconst appModulePath = './dist/server/server.js'\nconst benchmarkSeed = 0xdecafbad\n\nconst uninitializedHandler: StartRequestHandler = {\n  fetch: () => Promise.reject(new Error('Benchmark not initialized')),\n}\n\nlet handler = uninitializedHandler\n\nasync function setup() {\n  const module = (await import(appModulePath)) as {\n    default: StartRequestHandler\n  }\n\n  handler = module.default\n}\n\nfunction teardown() {\n  handler = uninitializedHandler\n}\n\ndescribe('ssr', () => {\n  /**\n   * Running `vitest bench` ignores \"suite hooks\" like `beforeAll` and `afterAll`,\n   * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.\n   *\n   * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,\n   * but it does support `beforeAll` and `afterAll`.\n   *\n   * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.\n   */\n  beforeAll(setup)\n  afterAll(teardown)\n\n  bench(\n    'ssr request loop (react)',\n    () => runSsrRequestLoop(handler, { seed: benchmarkSeed }),\n    {\n      warmupIterations: 100,\n      time: 10_000,\n      setup,\n      teardown,\n      throws: true,\n    },\n  )\n})\n"
  },
  {
    "path": "benchmarks/ssr/react/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ARouteImport } from './routes/$a'\nimport { Route as ABRouteImport } from './routes/$a.$b'\nimport { Route as ABCRouteImport } from './routes/$a.$b.$c'\nimport { Route as ABCDRouteImport } from './routes/$a.$b.$c.$d'\n\nconst ARoute = ARouteImport.update({\n  id: '/$a',\n  path: '/$a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ABRoute = ABRouteImport.update({\n  id: '/$b',\n  path: '/$b',\n  getParentRoute: () => ARoute,\n} as any)\nconst ABCRoute = ABCRouteImport.update({\n  id: '/$c',\n  path: '/$c',\n  getParentRoute: () => ABRoute,\n} as any)\nconst ABCDRoute = ABCDRouteImport.update({\n  id: '/$d',\n  path: '/$d',\n  getParentRoute: () => ABCRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRoutesByTo {\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  ARoute: typeof ARouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/$a': {\n      id: '/$a'\n      path: '/$a'\n      fullPath: '/$a'\n      preLoaderRoute: typeof ARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$a/$b': {\n      id: '/$a/$b'\n      path: '/$b'\n      fullPath: '/$a/$b'\n      preLoaderRoute: typeof ABRouteImport\n      parentRoute: typeof ARoute\n    }\n    '/$a/$b/$c': {\n      id: '/$a/$b/$c'\n      path: '/$c'\n      fullPath: '/$a/$b/$c'\n      preLoaderRoute: typeof ABCRouteImport\n      parentRoute: typeof ABRoute\n    }\n    '/$a/$b/$c/$d': {\n      id: '/$a/$b/$c/$d'\n      path: '/$d'\n      fullPath: '/$a/$b/$c/$d'\n      preLoaderRoute: typeof ABCDRouteImport\n      parentRoute: typeof ABCRoute\n    }\n  }\n}\n\ninterface ABCRouteChildren {\n  ABCDRoute: typeof ABCDRoute\n}\n\nconst ABCRouteChildren: ABCRouteChildren = {\n  ABCDRoute: ABCDRoute,\n}\n\nconst ABCRouteWithChildren = ABCRoute._addFileChildren(ABCRouteChildren)\n\ninterface ABRouteChildren {\n  ABCRoute: typeof ABCRouteWithChildren\n}\n\nconst ABRouteChildren: ABRouteChildren = {\n  ABCRoute: ABCRouteWithChildren,\n}\n\nconst ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren)\n\ninterface ARouteChildren {\n  ABRoute: typeof ABRouteWithChildren\n}\n\nconst ARouteChildren: ARouteChildren = {\n  ABRoute: ABRouteWithChildren,\n}\n\nconst ARouteWithChildren = ARoute._addFileChildren(ARouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  ARoute: ARouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    defaultPreload: false,\n    scrollRestoration: false,\n  })\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/src/routes/$a.$b.$c.$d.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b/$c/$d')({\n  component: LevelDComponent,\n})\n\nfunction LevelDComponent() {\n  return <RouteWorkload />\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/src/routes/$a.$b.$c.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b/$c')({\n  component: LevelCComponent,\n})\n\nfunction LevelCComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/src/routes/$a.$b.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b')({\n  component: LevelBComponent,\n})\n\nfunction LevelBComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/src/routes/$a.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a')({\n  component: LevelAComponent,\n})\n\nfunction LevelAComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  validateSearch: (s) => s as { q?: string },\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/src/workload.tsx",
    "content": "import { Link, useParams, useSearch } from '@tanstack/react-router'\n\nconst probes = Array.from({ length: 10 }, (_, index) => index)\n\nfunction runSelectorWork(input: string, salt: number) {\n  let value = salt\n\n  for (let index = 0; index < input.length; index++) {\n    value = (value * 33 + input.charCodeAt(index) + index) >>> 0\n  }\n\n  for (let index = 0; index < 16; index++) {\n    value = (value ^ (value << 13)) >>> 0\n    value = (value ^ (value >> 17)) >>> 0\n    value = (value ^ (value << 5)) >>> 0\n  }\n\n  return value\n}\n\nfunction ParamsProbe({ salt }: { salt: number }) {\n  const params = useParams({\n    strict: false,\n    select: (nextParams) =>\n      runSelectorWork(\n        `${nextParams.a ?? ''}/${nextParams.b ?? ''}/${nextParams.c ?? ''}/${nextParams.d ?? ''}`,\n        salt,\n      ),\n  })\n\n  void params\n\n  return null\n}\n\nfunction SearchProbe({ salt }: { salt: number }) {\n  const search = useSearch({\n    strict: false,\n    select: (nextSearch) => runSelectorWork(String(nextSearch.q ?? ''), salt),\n  })\n\n  void search\n\n  return null\n}\n\nfunction LinkProbe({ salt }: { salt: number }) {\n  const value = String((salt % 97) + 1)\n\n  return (\n    <Link\n      to=\"/$a/$b/$c/$d\"\n      params={{\n        a: `a-${value}`,\n        b: `b-${value}`,\n        c: `c-${value}`,\n        d: `d-${value}`,\n      }}\n      search={{ q: `q-${value}` }}\n      preload={false}\n    >\n      Link\n    </Link>\n  )\n}\n\nexport function RouteWorkload() {\n  return (\n    <>\n      {probes.map((probe) => (\n        <ParamsProbe key={`params-${probe}`} salt={probe + 1} />\n      ))}\n      {probes.map((probe) => (\n        <SearchProbe key={`search-${probe}`} salt={probe + 11} />\n      ))}\n      {probes.map((probe) => (\n        <LinkProbe key={`link-${probe}`} salt={probe + 21} />\n      ))}\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"jsxImportSource\": \"react\",\n    \"types\": [\"node\", \"vite/client\", \"vitest/globals\"]\n  },\n  \"include\": [\n    \"speed.bench.ts\",\n    \"vite.config.ts\",\n    \"../bench-utils.ts\",\n    \"./src/**/*\"\n  ]\n}\n"
  },
  {
    "path": "benchmarks/ssr/react/vite.config.ts",
    "content": "import { fileURLToPath } from 'node:url'\nimport { defineConfig } from 'vitest/config'\nimport codspeedPlugin from '@codspeed/vitest-plugin'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport react from '@vitejs/plugin-react'\n\nconst rootDir = fileURLToPath(new URL('.', import.meta.url))\n\nexport default defineConfig({\n  root: rootDir,\n  plugins: [\n    !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&\n      codspeedPlugin(),\n    tanstackStart({\n      srcDirectory: 'src',\n    }),\n    react(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    minify: false,\n  },\n  test: {\n    name: '@benchmarks/ssr (react)',\n    watch: false,\n    environment: 'node',\n  },\n})\n"
  },
  {
    "path": "benchmarks/ssr/solid/speed.bench.ts",
    "content": "import { afterAll, beforeAll, bench, describe } from 'vitest'\nimport { runSsrRequestLoop } from '../bench-utils'\nimport type { StartRequestHandler } from '../bench-utils'\n\nconst appModulePath = './dist/server/server.js'\nconst benchmarkSeed = 0xcafebabe\n\nconst uninitializedHandler: StartRequestHandler = {\n  fetch: () => Promise.reject(new Error('Benchmark not initialized')),\n}\n\nlet handler = uninitializedHandler\n\nasync function setup() {\n  const module = (await import(appModulePath)) as {\n    default: StartRequestHandler\n  }\n\n  handler = module.default\n}\n\nfunction teardown() {\n  handler = uninitializedHandler\n}\n\ndescribe('ssr', () => {\n  /**\n   * Running `vitest bench` ignores \"suite hooks\" like `beforeAll` and `afterAll`,\n   * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.\n   *\n   * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,\n   * but it does support `beforeAll` and `afterAll`.\n   *\n   * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.\n   */\n  beforeAll(setup)\n  afterAll(teardown)\n\n  bench(\n    'ssr request loop (solid)',\n    () => runSsrRequestLoop(handler, { seed: benchmarkSeed }),\n    {\n      warmupIterations: 100,\n      time: 10_000,\n      setup,\n      teardown,\n      throws: true,\n    },\n  )\n})\n"
  },
  {
    "path": "benchmarks/ssr/solid/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ARouteImport } from './routes/$a'\nimport { Route as ABRouteImport } from './routes/$a.$b'\nimport { Route as ABCRouteImport } from './routes/$a.$b.$c'\nimport { Route as ABCDRouteImport } from './routes/$a.$b.$c.$d'\n\nconst ARoute = ARouteImport.update({\n  id: '/$a',\n  path: '/$a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ABRoute = ABRouteImport.update({\n  id: '/$b',\n  path: '/$b',\n  getParentRoute: () => ARoute,\n} as any)\nconst ABCRoute = ABCRouteImport.update({\n  id: '/$c',\n  path: '/$c',\n  getParentRoute: () => ABRoute,\n} as any)\nconst ABCDRoute = ABCDRouteImport.update({\n  id: '/$d',\n  path: '/$d',\n  getParentRoute: () => ABCRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRoutesByTo {\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  ARoute: typeof ARouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/$a': {\n      id: '/$a'\n      path: '/$a'\n      fullPath: '/$a'\n      preLoaderRoute: typeof ARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$a/$b': {\n      id: '/$a/$b'\n      path: '/$b'\n      fullPath: '/$a/$b'\n      preLoaderRoute: typeof ABRouteImport\n      parentRoute: typeof ARoute\n    }\n    '/$a/$b/$c': {\n      id: '/$a/$b/$c'\n      path: '/$c'\n      fullPath: '/$a/$b/$c'\n      preLoaderRoute: typeof ABCRouteImport\n      parentRoute: typeof ABRoute\n    }\n    '/$a/$b/$c/$d': {\n      id: '/$a/$b/$c/$d'\n      path: '/$d'\n      fullPath: '/$a/$b/$c/$d'\n      preLoaderRoute: typeof ABCDRouteImport\n      parentRoute: typeof ABCRoute\n    }\n  }\n}\n\ninterface ABCRouteChildren {\n  ABCDRoute: typeof ABCDRoute\n}\n\nconst ABCRouteChildren: ABCRouteChildren = {\n  ABCDRoute: ABCDRoute,\n}\n\nconst ABCRouteWithChildren = ABCRoute._addFileChildren(ABCRouteChildren)\n\ninterface ABRouteChildren {\n  ABCRoute: typeof ABCRouteWithChildren\n}\n\nconst ABRouteChildren: ABRouteChildren = {\n  ABCRoute: ABCRouteWithChildren,\n}\n\nconst ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren)\n\ninterface ARouteChildren {\n  ABRoute: typeof ABRouteWithChildren\n}\n\nconst ARouteChildren: ARouteChildren = {\n  ABRoute: ABRouteWithChildren,\n}\n\nconst ARouteWithChildren = ARoute._addFileChildren(ARouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  ARoute: ARouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    defaultPreload: false,\n    scrollRestoration: false,\n  })\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/src/routes/$a.$b.$c.$d.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b/$c/$d')({\n  component: LevelDComponent,\n})\n\nfunction LevelDComponent() {\n  return <RouteWorkload />\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/src/routes/$a.$b.$c.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b/$c')({\n  component: LevelCComponent,\n})\n\nfunction LevelCComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/src/routes/$a.$b.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b')({\n  component: LevelBComponent,\n})\n\nfunction LevelBComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/src/routes/$a.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a')({\n  component: LevelAComponent,\n})\n\nfunction LevelAComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  validateSearch: (s) => s as { q?: string },\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/src/workload.tsx",
    "content": "import { For, createEffect } from 'solid-js'\nimport { Link, useParams, useSearch } from '@tanstack/solid-router'\n\nconst probes = Array.from({ length: 10 }, (_, index) => index)\n\nfunction runSelectorWork(input: string, salt: number) {\n  let value = salt\n\n  for (let index = 0; index < input.length; index++) {\n    value = (value * 33 + input.charCodeAt(index) + index) >>> 0\n  }\n\n  for (let index = 0; index < 16; index++) {\n    value = (value ^ (value << 13)) >>> 0\n    value = (value ^ (value >> 17)) >>> 0\n    value = (value ^ (value << 5)) >>> 0\n  }\n\n  return value\n}\n\nfunction ParamsProbe(props: { salt: number }) {\n  const params = useParams({\n    strict: false,\n    select: (nextParams) =>\n      runSelectorWork(\n        `${nextParams.a ?? ''}/${nextParams.b ?? ''}/${nextParams.c ?? ''}/${nextParams.d ?? ''}`,\n        props.salt,\n      ),\n  })\n\n  createEffect(() => {\n    void params()\n  })\n\n  return null\n}\n\nfunction SearchProbe(props: { salt: number }) {\n  const search = useSearch({\n    strict: false,\n    select: (nextSearch) =>\n      runSelectorWork(String(nextSearch.q ?? ''), props.salt),\n  })\n\n  createEffect(() => {\n    void search()\n  })\n\n  return null\n}\n\nfunction LinkProbe(props: { salt: number }) {\n  const value = String((props.salt % 97) + 1)\n\n  return (\n    <Link\n      to=\"/$a/$b/$c/$d\"\n      params={{\n        a: `a-${value}`,\n        b: `b-${value}`,\n        c: `c-${value}`,\n        d: `d-${value}`,\n      }}\n      search={{ q: `q-${value}` }}\n      preload={false}\n    >\n      Link\n    </Link>\n  )\n}\n\nexport function RouteWorkload() {\n  return (\n    <>\n      <For each={probes}>{(probe) => <ParamsProbe salt={probe + 1} />}</For>\n      <For each={probes}>{(probe) => <SearchProbe salt={probe + 11} />}</For>\n      <For each={probes}>{(probe) => <LinkProbe salt={probe + 21} />}</For>\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"types\": [\"node\", \"vite/client\", \"vitest/globals\"]\n  },\n  \"include\": [\n    \"speed.bench.ts\",\n    \"vite.config.ts\",\n    \"../bench-utils.ts\",\n    \"./src/**/*\"\n  ]\n}\n"
  },
  {
    "path": "benchmarks/ssr/solid/vite.config.ts",
    "content": "import { fileURLToPath } from 'node:url'\nimport { defineConfig } from 'vitest/config'\nimport codspeedPlugin from '@codspeed/vitest-plugin'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport solid from 'vite-plugin-solid'\n\nconst rootDir = fileURLToPath(new URL('.', import.meta.url))\n\nexport default defineConfig({\n  root: rootDir,\n  plugins: [\n    !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&\n      codspeedPlugin(),\n    tanstackStart({\n      srcDirectory: 'src',\n    }),\n    solid({ ssr: true, hot: false, dev: false }),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    minify: false,\n  },\n  test: {\n    name: '@benchmarks/ssr (solid)',\n    watch: false,\n    environment: 'node',\n    server: {\n      deps: {\n        inline: [/@solidjs/, /@tanstack\\/solid-store/],\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "benchmarks/ssr/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"types\": [\"node\", \"vite/client\", \"vitest/globals\"]\n  },\n  \"include\": [\"bench-utils.ts\"]\n}\n"
  },
  {
    "path": "benchmarks/ssr/vitest.config.ts",
    "content": "import { defineConfig } from 'vitest/config'\n\nexport default defineConfig({\n  test: {\n    watch: false,\n    projects: [\n      './react/vite.config.ts',\n      './solid/vite.config.ts',\n      './vue/vite.config.ts',\n    ],\n  },\n})\n"
  },
  {
    "path": "benchmarks/ssr/vue/speed.bench.ts",
    "content": "import { afterAll, beforeAll, bench, describe } from 'vitest'\nimport { runSsrRequestLoop } from '../bench-utils'\nimport type { StartRequestHandler } from '../bench-utils'\n\nconst appModulePath = './dist/server/server.js'\nconst benchmarkSeed = 0xdeadbeef\n\nconst uninitializedHandler: StartRequestHandler = {\n  fetch: () => Promise.reject(new Error('Benchmark not initialized')),\n}\n\nlet handler = uninitializedHandler\n\nasync function setup() {\n  const module = (await import(appModulePath)) as {\n    default: StartRequestHandler\n  }\n\n  handler = module.default\n}\n\nfunction teardown() {\n  handler = uninitializedHandler\n}\n\ndescribe('ssr', () => {\n  /**\n   * Running `vitest bench` ignores \"suite hooks\" like `beforeAll` and `afterAll`,\n   * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.\n   *\n   * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,\n   * but it does support `beforeAll` and `afterAll`.\n   *\n   * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.\n   */\n  beforeAll(setup)\n  afterAll(teardown)\n\n  bench(\n    'ssr request loop (vue)',\n    () => runSsrRequestLoop(handler, { seed: benchmarkSeed }),\n    {\n      warmupIterations: 100,\n      time: 10_000,\n      setup,\n      teardown,\n      throws: true,\n    },\n  )\n})\n"
  },
  {
    "path": "benchmarks/ssr/vue/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ARouteImport } from './routes/$a'\nimport { Route as ABRouteImport } from './routes/$a.$b'\nimport { Route as ABCRouteImport } from './routes/$a.$b.$c'\nimport { Route as ABCDRouteImport } from './routes/$a.$b.$c.$d'\n\nconst ARoute = ARouteImport.update({\n  id: '/$a',\n  path: '/$a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ABRoute = ABRouteImport.update({\n  id: '/$b',\n  path: '/$b',\n  getParentRoute: () => ARoute,\n} as any)\nconst ABCRoute = ABCRouteImport.update({\n  id: '/$c',\n  path: '/$c',\n  getParentRoute: () => ABRoute,\n} as any)\nconst ABCDRoute = ABCDRouteImport.update({\n  id: '/$d',\n  path: '/$d',\n  getParentRoute: () => ABCRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRoutesByTo {\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/$a': typeof ARouteWithChildren\n  '/$a/$b': typeof ABRouteWithChildren\n  '/$a/$b/$c': typeof ABCRouteWithChildren\n  '/$a/$b/$c/$d': typeof ABCDRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  ARoute: typeof ARouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/$a': {\n      id: '/$a'\n      path: '/$a'\n      fullPath: '/$a'\n      preLoaderRoute: typeof ARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$a/$b': {\n      id: '/$a/$b'\n      path: '/$b'\n      fullPath: '/$a/$b'\n      preLoaderRoute: typeof ABRouteImport\n      parentRoute: typeof ARoute\n    }\n    '/$a/$b/$c': {\n      id: '/$a/$b/$c'\n      path: '/$c'\n      fullPath: '/$a/$b/$c'\n      preLoaderRoute: typeof ABCRouteImport\n      parentRoute: typeof ABRoute\n    }\n    '/$a/$b/$c/$d': {\n      id: '/$a/$b/$c/$d'\n      path: '/$d'\n      fullPath: '/$a/$b/$c/$d'\n      preLoaderRoute: typeof ABCDRouteImport\n      parentRoute: typeof ABCRoute\n    }\n  }\n}\n\ninterface ABCRouteChildren {\n  ABCDRoute: typeof ABCDRoute\n}\n\nconst ABCRouteChildren: ABCRouteChildren = {\n  ABCDRoute: ABCDRoute,\n}\n\nconst ABCRouteWithChildren = ABCRoute._addFileChildren(ABCRouteChildren)\n\ninterface ABRouteChildren {\n  ABCRoute: typeof ABCRouteWithChildren\n}\n\nconst ABRouteChildren: ABRouteChildren = {\n  ABCRoute: ABCRouteWithChildren,\n}\n\nconst ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren)\n\ninterface ARouteChildren {\n  ABRoute: typeof ABRouteWithChildren\n}\n\nconst ARouteChildren: ARouteChildren = {\n  ABRoute: ABRouteWithChildren,\n}\n\nconst ARouteWithChildren = ARoute._addFileChildren(ARouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  ARoute: ARouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "benchmarks/ssr/vue/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    defaultPreload: false,\n    scrollRestoration: false,\n  })\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "benchmarks/ssr/vue/src/routes/$a.$b.$c.$d.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b/$c/$d')({\n  component: LevelDComponent,\n})\n\nfunction LevelDComponent() {\n  return <RouteWorkload />\n}\n"
  },
  {
    "path": "benchmarks/ssr/vue/src/routes/$a.$b.$c.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b/$c')({\n  component: LevelCComponent,\n})\n\nfunction LevelCComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/vue/src/routes/$a.$b.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a/$b')({\n  component: LevelBComponent,\n})\n\nfunction LevelBComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/vue/src/routes/$a.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { RouteWorkload } from '../workload'\n\nexport const Route = createFileRoute('/$a')({\n  component: LevelAComponent,\n})\n\nfunction LevelAComponent() {\n  return (\n    <>\n      <RouteWorkload />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/vue/src/routes/__root.tsx",
    "content": "import {\n  Body,\n  HeadContent,\n  Html,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  validateSearch: (s) => s as { q?: string },\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <Outlet />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "benchmarks/ssr/vue/src/workload.tsx",
    "content": "import * as Vue from 'vue'\nimport { Link, useParams, useSearch } from '@tanstack/vue-router'\n\nconst probes = Array.from({ length: 10 }, (_, index) => index)\n\nfunction runSelectorWork(input: string, salt: number) {\n  let value = salt\n\n  for (let index = 0; index < input.length; index++) {\n    value = (value * 33 + input.charCodeAt(index) + index) >>> 0\n  }\n\n  for (let index = 0; index < 16; index++) {\n    value = (value ^ (value << 13)) >>> 0\n    value = (value ^ (value >> 17)) >>> 0\n    value = (value ^ (value << 5)) >>> 0\n  }\n\n  return value\n}\n\nconst ParamsProbe = Vue.defineComponent({\n  props: {\n    salt: {\n      type: Number,\n      required: true,\n    },\n  },\n  setup(props) {\n    const params = useParams({\n      strict: false,\n      select: (nextParams) =>\n        runSelectorWork(\n          `${nextParams.a ?? ''}/${nextParams.b ?? ''}/${nextParams.c ?? ''}/${nextParams.d ?? ''}`,\n          props.salt,\n        ),\n    })\n\n    return () => {\n      void params.value\n      return null\n    }\n  },\n})\n\nconst SearchProbe = Vue.defineComponent({\n  props: {\n    salt: {\n      type: Number,\n      required: true,\n    },\n  },\n  setup(props) {\n    const search = useSearch({\n      strict: false,\n      select: (nextSearch) =>\n        runSelectorWork(String(nextSearch.q ?? ''), props.salt),\n    })\n\n    return () => {\n      void search.value\n      return null\n    }\n  },\n})\n\nconst LinkProbe = Vue.defineComponent({\n  props: {\n    salt: {\n      type: Number,\n      required: true,\n    },\n  },\n  setup(props) {\n    const value = String((props.salt % 97) + 1)\n\n    return () => (\n      <Link\n        to=\"/$a/$b/$c/$d\"\n        params={{\n          a: `a-${value}`,\n          b: `b-${value}`,\n          c: `c-${value}`,\n          d: `d-${value}`,\n        }}\n        search={{ q: `q-${value}` }}\n        preload={false}\n      >\n        Link\n      </Link>\n    )\n  },\n})\n\nexport const RouteWorkload = Vue.defineComponent({\n  setup() {\n    return () => (\n      <>\n        {probes.map((probe) => (\n          <ParamsProbe key={`params-${probe}`} salt={probe + 1} />\n        ))}\n        {probes.map((probe) => (\n          <SearchProbe key={`search-${probe}`} salt={probe + 11} />\n        ))}\n        {probes.map((probe) => (\n          <LinkProbe key={`link-${probe}`} salt={probe + 21} />\n        ))}\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "benchmarks/ssr/vue/tsconfig.json",
    "content": "{\n  \"extends\": \"../../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"types\": [\"node\", \"vite/client\", \"vitest/globals\"]\n  },\n  \"include\": [\n    \"speed.bench.ts\",\n    \"vite.config.ts\",\n    \"../bench-utils.ts\",\n    \"./src/**/*\"\n  ]\n}\n"
  },
  {
    "path": "benchmarks/ssr/vue/vite.config.ts",
    "content": "import { fileURLToPath } from 'node:url'\nimport { defineConfig } from 'vitest/config'\nimport codspeedPlugin from '@codspeed/vitest-plugin'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\n\nconst rootDir = fileURLToPath(new URL('.', import.meta.url))\n\nexport default defineConfig({\n  root: rootDir,\n  plugins: [\n    !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) &&\n      codspeedPlugin(),\n    tanstackStart({\n      srcDirectory: 'src',\n    }),\n    vueJsx(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    minify: false,\n  },\n  test: {\n    name: '@benchmarks/ssr (vue)',\n    watch: false,\n    environment: 'node',\n  },\n})\n"
  },
  {
    "path": "docs/router/api/file-based-routing.md",
    "content": "---\ntitle: File-Based Routing API Reference\n---\n\nTanStack Router's file-based routing is quite flexible and can be configured to suit your project's needs.\n\n## Configuration options\n\nThe following options are available for configuring the file-based routing:\n\n- [`routesDirectory` (required)](#routesdirectory-required)\n- [`generatedRouteTree` (required)](#generatedroutetree-required)\n- [`virtualRouteConfig`](#virtualrouteconfig)\n- [`routeFilePrefix`](#routefileprefix)\n- [`routeFileIgnorePrefix`](#routefileignoreprefix)\n- [`routeFileIgnorePattern`](#routefileignorepattern)\n- [`indexToken`](#indextoken)\n- [`routeToken`](#routetoken)\n- [`quoteStyle`](#quotestyle)\n- [`semicolons`](#semicolons)\n- [`autoCodeSplitting`](#autocodesplitting)\n- [`disableTypes`](#disabletypes)\n- [`addExtensions`](#addextensions)\n- [`disableLogging`](#disablelogging)\n- [`routeTreeFileHeader`](#routetreefileheader)\n- [`routeTreeFileFooter`](#routetreefilefooter)\n- [`enableRouteTreeFormatting`](#enableroutetreeformatting)\n- [`tmpDir`](#tmpdir)\n\n> [!WARNING]\n> 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.\n\n### `routesDirectory` (required)\n\nThis is the path to the directory where the route files are located, relative to the cwd (current working directory).\n\nBy default, the value is set to the following and cannot be set to an empty `string` or `undefined`.\n\n```txt\n./src/routes\n```\n\n### `generatedRouteTree` (required)\n\nThis is the path to the file where the generated route tree will be saved, relative to the cwd (current working directory).\n\nBy default, the value is set to the following and cannot be set to an empty `string` or `undefined`.\n\n```txt\n./src/routeTree.gen.ts\n```\n\nIf the [`disableTypes`](#disabletypes) is set to `true`, the generated route tree will be saved with the `.js` extension instead of `.ts`.\n\n### `virtualRouteConfig`\n\nThis option is used to configure the Virtual File Routes feature. See the \"Virtual File Routes\" guide for more information.\n\nBy default, this value is set to `undefined`.\n\n### `routeFilePrefix`\n\nThis 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.\n\nBy default, this value is set to `` and as such all files in the route directory will be considered for routing.\n\n### `routeFileIgnorePrefix`\n\nThis 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.\n\nBy default, this value is set to `-`.\n\nWhen using this option, it allows you have structures like this where it let's you co-located related files that are not route files:\n\n```txt\nsrc/routes\n├── posts\n│   ├── -components  // Ignored\n│   │   ├── Post.tsx\n│   ├── index.tsx\n│   ├── route.tsx\n```\n\n### `routeFileIgnorePattern`\n\nThis 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`.\n\nBy default, this value is set to `undefined`.\n\n### `routeToken`\n\nAs 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.\n\nBy default, this value is set to `route`.\n\n> 🧠 the following filenames would equal the same runtime URL:\n\n```txt\nsrc/routes/posts.tsx -> /posts\nsrc/routes/posts.route.tsx -> /posts\nsrc/routes/posts/route.tsx -> /posts\n```\n\n#### Using regex patterns for `routeToken`\n\nYou 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.\n\n**In `tsr.config.json`** (JSON config), use an object with `regex` and optional `flags` properties:\n\n```json\n{\n  \"routeToken\": { \"regex\": \"[a-z]+-layout\", \"flags\": \"i\" }\n}\n```\n\n**In code** (inline config), you can use a native `RegExp`:\n\n```ts\n{\n  routeToken: /[a-z]+-layout/i\n}\n```\n\nWith 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.\n\n> [!NOTE]\n> The regex is matched against the **entire** final segment of the route path. For example, with `routeToken: { \"regex\": \"[a-z]+-layout\" }`:\n>\n> - `dashboard.main-layout.tsx` matches (`main-layout` is the full segment)\n> - `dashboard.my-layout-extra.tsx` does NOT match (the segment is `my-layout-extra`, not just `my-layout`)\n\n### `indexToken`\n\nAs 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.\n\nBy default, this value is set to `index`.\n\n> 🧠 the following filenames would equal the same runtime URL:\n\n```txt\nsrc/routes/posts.index.tsx -> /posts/\nsrc/routes/posts/index.tsx -> /posts/\n```\n\n#### Using regex patterns for `indexToken`\n\nSimilar to `routeToken`, you can use a regular expression pattern for `indexToken` to match multiple index route naming conventions.\n\n**In `tsr.config.json`** (JSON config):\n\n```json\n{\n  \"indexToken\": { \"regex\": \"[a-z]+-page\" }\n}\n```\n\n**In code** (inline config):\n\n```ts\n{\n  indexToken: /[a-z]+-page/\n}\n```\n\nWith 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.\n\n#### Escaping regex tokens\n\nWhen 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`.\n\n### `quoteStyle`\n\nWhen 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.\n\nBy default, this value is set to `single`.\n\n> [!TIP]\n> You should ignore the path of your generated route tree file from your linter and formatter to avoid conflicts.\n\n### `semicolons`\n\nWhen 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`.\n\nBy default, this value is set to `false`.\n\n> [!TIP]\n> You should ignore the path of your generated route tree file from your linter and formatter to avoid conflicts.\n\n### `autoCodeSplitting`\n\nThis feature is only available if you are using the TanStack Router Bundler Plugin.\n\nThis option is used to enable automatic code-splitting for non-critical route configuration items. See the \"Automatic Code-Splitting\" guide for more information.\n\nBy default, this value is set to `false`.\n\n> [!IMPORTANT]\n> The next major release of TanStack Router (i.e. v2), will have this value defaulted to `true`.\n\n### `disableTypes`\n\nThis option is used to disable generating types for the route tree.\n\nIf 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.\n\nBy default, this value is set to `false`.\n\n### `addExtensions`\n\n- Type: `boolean | string`\n- Default: `false`\n\nThis option controls file extensions on import paths in the generated route tree.\n\n- `false` — Extensions are stripped from import paths (e.g. `'./routes/posts'`)\n- `true` — The original file extensions are kept (e.g. `'./routes/posts.tsx'`)\n- `string` — The original extension is replaced with the provided one (e.g. `'js'` produces `'./routes/posts.js'`)\n\nPassing 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`.\n\n```ts\n// Example: replace .tsx/.ts extensions with .js in generated imports\nTanStackRouterVite({\n  addExtensions: 'js',\n})\n```\n\n### `disableLogging`\n\nThis option turns off the console logging for the route generation process.\n\nBy default, this value is set to `false`.\n\n### `routeTreeFileHeader`\n\nThis option let's you prepend content to the start of the generated route tree file.\n\nBy default, this value is set to:\n\n```json\n[\n  \"/* eslint-disable */\",\n  \"// @ts-nocheck\",\n  \"// noinspection JSUnusedGlobalSymbols\"\n]\n```\n\n### `routeTreeFileFooter`\n\nThis option let's you append content to the end of the generated route tree file.\n\nBy default, this value is set to:\n\n```json\n[]\n```\n\n### `enableRouteTreeFormatting`\n\nThis option turns on the formatting function on the generated route tree file, which can be time-consuming for large projects.\n\nBy default, this value is set to `true`.\n\n### `tmpDir`\n\nAtomic 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.\n\nThis config option allows to configure the path of the temp directory that will be used for creating those temporary files.\nIf it is a relative path, it will be resolved to the current working directory.\nIf this value is not set, `process.env.TSR_TMP_DIR` will be used.\nIf `process.env.TSR_TMP_DIR` is not set, it will default to `.tanstack/tmp` relative to the current working directory.\n"
  },
  {
    "path": "docs/router/api/router/ActiveLinkOptionsType.md",
    "content": "---\nid: ActiveLinkOptionsType\ntitle: ActiveLinkOptions type\n---\n\nThe `ActiveLinkOptions` type extends the [`LinkOptions`](./LinkOptionsType.md) type and contains additional options that can be used to describe how a link should be styled when it is active.\n\n```tsx\ntype ActiveLinkOptions = LinkOptions & {\n  activeProps?:\n    | React.AnchorHTMLAttributes<HTMLAnchorElement>\n    | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n  inactiveProps?:\n    | React.AnchorHTMLAttributes<HTMLAnchorElement>\n    | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n```\n\n## ActiveLinkOptions properties\n\nThe `ActiveLinkOptions` object accepts/contains the following properties:\n\n### `activeProps`\n\n- `React.AnchorHTMLAttributes<HTMLAnchorElement>`\n- Optional\n- The props that will be applied to the anchor element when the link is active\n\n### `inactiveProps`\n\n- Type: `React.AnchorHTMLAttributes<HTMLAnchorElement>`\n- Optional\n- The props that will be applied to the anchor element when the link is inactive\n"
  },
  {
    "path": "docs/router/api/router/AsyncRouteComponentType.md",
    "content": "---\nid: AsyncRouteComponentType\ntitle: AsyncRouteComponent type\n---\n\nThe `AsyncRouteComponent` type is used to describe a code-split route component that can be preloaded using a `component.preload()` method.\n\n```tsx\ntype AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {\n  preload?: () => Promise<void>\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/FileRouteClass.md",
    "content": "---\nid: FileRouteClass\ntitle: FileRoute class\n---\n\n> [!CAUTION]\n> This class has been deprecated and will be removed in the next major version of TanStack Router.\n> Please use the [`createFileRoute`](./createFileRouteFunction.md) function instead.\n\nThe `FileRoute` class is a factory that can be used to create a file-based route instance. This route instance can then be used to automatically generate a route tree with the `tsr generate` and `tsr watch` commands.\n\n## `FileRoute` constructor\n\nThe `FileRoute` constructor accepts a single argument: the `path` of the file that the route will be generated for.\n\n### Constructor options\n\n- Type: `string` literal\n- Required, but **automatically inserted and updated by the `tsr generate` and `tsr watch` commands**.\n- The full path of the file that the route will be generated from.\n\n### Constructor returns\n\n- An instance of the `FileRoute` class that can be used to create a route.\n\n## `FileRoute` methods\n\nThe `FileRoute` class implements the following method(s):\n\n### `.createRoute` method\n\nThe `createRoute` method is a method that can be used to configure the file route instance. It accepts a single argument: the `options` that will be used to configure the file route instance.\n\n#### .createRoute options\n\n- Type: `Omit<RouteOptions, 'getParentRoute' | 'path' | 'id'>`\n- [`RouteOptions`](./RouteOptionsType.md)\n- Optional\n- The same options that are available to the `Route` class, but with the `getParentRoute`, `path`, and `id` options omitted since they are unnecessary for file-based routing.\n\n#### .createRoute returns\n\nA [`Route`](./RouteType.md) instance that can be used to configure the route to be inserted into the route-tree.\n\n> ⚠️ Note: For `tsr generate` and `tsr watch` to work properly, the file route instance must be exported from the file using the `Route` identifier.\n\n### Examples\n\n```tsx\nimport { FileRoute } from '@tanstack/react-router'\n\nexport const Route = new FileRoute('/').createRoute({\n  loader: () => {\n    return 'Hello World'\n  },\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = Route.useLoaderData()\n  return <div>{data}</div>\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/LinkOptionsType.md",
    "content": "---\nid: LinkOptionsType\ntitle: LinkOptions type\n---\n\nThe `LinkOptions` type extends the [`NavigateOptions`](./NavigateOptionsType.md) type and contains additional options that can be used by TanStack Router when handling actual anchor element attributes.\n\n```tsx\ntype LinkOptions = NavigateOptions & {\n  target?: HTMLAnchorElement['target']\n  activeOptions?: ActiveOptions\n  preload?: false | 'intent'\n  preloadDelay?: number\n  disabled?: boolean\n}\n```\n\n## LinkOptions properties\n\nThe `LinkOptions` object accepts/contains the following properties:\n\n### `target`\n\n- Type: `HTMLAnchorElement['target']`\n- Optional\n- The standard anchor tag target attribute\n\n### `activeOptions`\n\n- Type: `ActiveOptions`\n- Optional\n- The options that will be used to determine if the link is active\n\n### `preload`\n\n- Type: `false | 'intent' | 'viewport' | 'render'`\n- Optional\n- If set, the link's preloading strategy will be set to this value.\n- See the [Preloading guide](../../guide/preloading.md) for more information.\n\n### `preloadDelay`\n\n- Type: `number`\n- Optional\n- Delay intent preloading by this many milliseconds. If the intent exits before this delay, the preload will be cancelled.\n\n### `disabled`\n\n- Type: `boolean`\n- Optional\n- If true, will render the link without the href attribute\n"
  },
  {
    "path": "docs/router/api/router/LinkPropsType.md",
    "content": "---\nid: LinkPropsType\ntitle: LinkProps type\n---\n\nThe `LinkProps` type extends the [`ActiveLinkOptions`](./ActiveLinkOptionsType.md) and `React.AnchorHTMLAttributes<HTMLAnchorElement>` types and contains additional props specific to the `Link` component.\n\n```tsx\ntype LinkProps = ActiveLinkOptions &\n  Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n    children?:\n      | React.ReactNode\n      | ((state: { isActive: boolean }) => React.ReactNode)\n  }\n```\n\n## LinkProps properties\n\n- All of the props from [`ActiveLinkOptions`](./ActiveLinkOptionsType.md)\n- All of the props from `React.AnchorHTMLAttributes<HTMLAnchorElement>`\n\n#### `children`\n\n- Type: `React.ReactNode | ((state: { isActive: boolean }) => React.ReactNode)`\n- Optional\n- The children that will be rendered inside of the anchor element. If a function is provided, it will be called with an object that contains the `isActive` boolean value that can be used to determine if the link is active.\n"
  },
  {
    "path": "docs/router/api/router/MatchRouteOptionsType.md",
    "content": "---\nid: MatchRouteOptionsType\ntitle: MatchRouteOptions type\n---\n\nThe `MatchRouteOptions` type is used to describe the options that can be used when matching a route.\n\n```tsx\ninterface MatchRouteOptions {\n  pending?: boolean\n  caseSensitive?: boolean /* @deprecated */\n  includeSearch?: boolean\n  fuzzy?: boolean\n}\n```\n\n## MatchRouteOptions properties\n\nThe `MatchRouteOptions` type has the following properties:\n\n### `pending` property\n\n- Type: `boolean`\n- Optional\n- If `true`, will match against pending location instead of the current location\n\n### ~~`caseSensitive`~~ property (deprecated)\n\n- Type: `boolean`\n- Optional\n- If `true`, will match against the current location with case sensitivity\n- Declare case sensitivity in the route definition instead, or globally for all routes using the `caseSensitive` option on the router\n\n### `includeSearch` property\n\n- Type: `boolean`\n- Optional\n- If `true`, will match against the current location's search params using a deep inclusive check. e.g. `{ a: 1 }` will match for a current location of `{ a: 1, b: 2 }`\n\n### `fuzzy` property\n\n- Type: `boolean`\n- Optional\n- If `true`, will match against the current location using a fuzzy match. e.g. `/posts` will match for a current location of `/posts/123`\n"
  },
  {
    "path": "docs/router/api/router/NavigateOptionsType.md",
    "content": "---\nid: NavigateOptionsType\ntitle: NavigateOptions type\n---\n\nThe `NavigateOptions` type is used to describe the options that can be used when describing a navigation action in TanStack Router.\n\n```tsx\ntype NavigateOptions = ToOptions & {\n  replace?: boolean\n  resetScroll?: boolean\n  hashScrollIntoView?: boolean | ScrollIntoViewOptions\n  viewTransition?: boolean | ViewTransitionOptions\n  ignoreBlocker?: boolean\n  reloadDocument?: boolean\n  href?: string\n}\n```\n\n## NavigateOptions properties\n\nThe `NavigateOptions` object accepts the following properties:\n\n### `replace`\n\n- Type: `boolean`\n- Optional\n- Defaults to `false`.\n- If `true`, the location will be committed to the browser history using `history.replace` instead of `history.push`.\n\n### `resetScroll`\n\n- Type: `boolean`\n- Optional\n- Defaults to `true` so that the scroll position will be reset to 0,0 after the location is committed to the browser history.\n- If `false`, the scroll position will not be reset to 0,0 after the location is committed to history.\n\n### `hashScrollIntoView`\n\n- Type: `boolean | ScrollIntoViewOptions`\n- Optional\n- Defaults to `true` so the element with an id matching the hash will be scrolled into view after the location is committed to history.\n- If `false`, the element with an id matching the hash will not be scrolled into view after the location is committed to history.\n- If an object is provided, it will be passed to the `scrollIntoView` method as options.\n- See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.\n\n### `viewTransition`\n\n- Type: `boolean | ViewTransitionOptions`\n- Optional\n- Defaults to `false`.\n- If `true`, navigation will be called using `document.startViewTransition()`.\n- 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.\n- If the browser does not support this api, this option will be ignored.\n- See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.\n- See [Google](https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types) for more information on viewTransition types\n\n### `ignoreBlocker`\n\n- Type: `boolean`\n- Optional\n- Defaults to `false`.\n- If `true`, navigation will ignore any blockers that might prevent it.\n\n### `reloadDocument`\n\n- Type: `boolean`\n- Optional\n- Defaults to `false`.\n- If `true`, navigation to a route inside of router will trigger a full page load instead of the traditional SPA navigation.\n\n### `href`\n\n- Type: `string`\n- Optional\n- This can be used instead of `to` to navigate to a fully built href, e.g. pointing to an external target.\n\n- [`ToOptions`](./ToOptionsType.md)\n"
  },
  {
    "path": "docs/router/api/router/NotFoundErrorType.md",
    "content": "---\nid: NotFoundErrorType\ntitle: NotFoundError\n---\n\nThe `NotFoundError` type is used to represent a not-found error in TanStack Router.\n\n```tsx\nexport type NotFoundError = {\n  global?: boolean\n  data?: any\n  throw?: boolean\n  routeId?: string\n  headers?: HeadersInit\n}\n```\n\n## NotFoundError properties\n\nThe `NotFoundError` object accepts/contains the following properties:\n\n### `global` property (⚠️ deprecated, use `routeId: rootRouteId` instead)\n\n- Type: `boolean`\n- Optional - `default: false`\n- 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()`.\n\n### `data` property\n\n- Type: `any`\n- Optional\n- Custom data that is passed into to `notFoundComponent` when the not-found error is handled\n\n### `throw` property\n\n- Type: `boolean`\n- Optional - `default: false`\n- 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.\n\n### `routeId` property\n\n- Type: `string`\n- Optional\n- 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.\n\n### `headers` property\n\n- Type: `HeadersInit`\n- Optional\n- HTTP headers to be included when the not-found error is handled on the server side.\n"
  },
  {
    "path": "docs/router/api/router/NotFoundRouteClass.md",
    "content": "---\nid: NotFoundRouteClass\ntitle: NotFoundRoute class\n---\n\n> [!CAUTION]\n> This class has been deprecated and will be removed in the next major version of TanStack Router.\n> Please use the `notFoundComponent` route option that is present during route configuration.\n> See the [Not Found Errors guide](../../guide/not-found-errors.md) for more information.\n\nThe `NotFoundRoute` class extends the `Route` class and can be used to create a not found route instance. A not found route instance can be passed to the `routerOptions.notFoundRoute` option to configure a default not-found/404 route for every branch of the route tree.\n\n## Constructor options\n\nThe `NotFoundRoute` constructor accepts an object as its only argument.\n\n- Type:\n\n```tsx\nOmit<\n  RouteOptions,\n  | 'path'\n  | 'id'\n  | 'getParentRoute'\n  | 'caseSensitive'\n  | 'parseParams'\n  | 'stringifyParams'\n>\n```\n\n- [RouteOptions](./RouteOptionsType.md)\n- Required\n- The options that will be used to configure the not found route instance.\n\n## Examples\n\n```tsx\nimport { NotFoundRoute, createRouter } from '@tanstack/react-router'\nimport { Route as rootRoute } from './routes/__root'\nimport { routeTree } from './routeTree.gen'\n\nconst notFoundRoute = new NotFoundRoute({\n  getParentRoute: () => rootRoute,\n  component: () => <div>Not found!!!</div>,\n})\n\nconst router = createRouter({\n  routeTree,\n  notFoundRoute,\n})\n\n// ... other code\n```\n"
  },
  {
    "path": "docs/router/api/router/ParsedHistoryStateType.md",
    "content": "---\nid: ParsedHistoryStateType\ntitle: ParsedHistoryState type\n---\n\nThe `ParsedHistoryState` type represents a parsed state object. Additionally to `HistoryState`, it contains the index and the unique key of the route.\n\n```tsx\nexport type ParsedHistoryState = HistoryState & {\n  key?: string // TODO: Remove in v2 - use __TSR_key instead\n  __TSR_key?: string\n  __TSR_index: number\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/ParsedLocationType.md",
    "content": "---\nid: ParsedLocationType\ntitle: ParsedLocation type\n---\n\nThe `ParsedLocation` type represents a parsed location in TanStack Router. It contains a lot of useful information about the current location, including the pathname, search params, hash, location state, and route masking information.\n\n```tsx\ninterface ParsedLocation {\n  href: string\n  pathname: string\n  search: TFullSearchSchema\n  searchStr: string\n  state: ParsedHistoryState\n  hash: string\n  maskedLocation?: ParsedLocation\n  unmaskOnReload?: boolean\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/RedirectType.md",
    "content": "---\nid: RedirectType\ntitle: Redirect type\n---\n\nThe `Redirect` type is used to represent a redirect action in TanStack Router.\n\n```tsx\nexport type Redirect = {\n  statusCode?: number\n  throw?: any\n  headers?: HeadersInit\n} & NavigateOptions\n```\n\n- [`NavigateOptions`](./NavigateOptionsType.md)\n\n## Redirect properties\n\nThe `Redirect` object accepts/contains the following properties:\n\n### `statusCode` property\n\n- Type: `number`\n- Optional\n- The HTTP status code to use when redirecting\n\n### `throw` property\n\n- Type: `any`\n- Optional\n- 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.\n\n### `headers` property\n\n- Type: `HeadersInit`\n- Optional\n- The HTTP headers to use when redirecting.\n\n### Navigation Properties\n\nSince `Redirect` extends `NavigateOptions`, it also supports navigation properties:\n\n- **`to`**: Use for internal application routes (e.g., `/dashboard`, `../profile`)\n- **`href`**: Use for external URLs (e.g., `https://example.com`, `https://authprovider.com`)\n\n> **Important**: For external URLs, always use the `href` property instead of `to`. The `to` property is designed for internal navigation within your application.\n"
  },
  {
    "path": "docs/router/api/router/RegisterType.md",
    "content": "---\nid: RegisterType\ntitle: Register type\n---\n\nThis type is used to register a route tree with a router instance. Doing so unlocks the full type safety of TanStack Router, including top-level exports from the `@tanstack/react-router` package.\n\n```tsx\nexport type Register = {\n  // router: [Your router type here]\n}\n```\n\nTo register a route tree with a router instance, use declaration merging to add the type of your router instance to the Register interface under the `router` property:\n\n## Examples\n\n```tsx\nconst router = createRouter({\n  // ...\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/RootRouteClass.md",
    "content": "---\nid: RootRouteClass\ntitle: RootRoute class\n---\n\n> [!CAUTION]\n> This class has been deprecated and will be removed in the next major version of TanStack Router.\n> Please use the [`createRootRoute`](./createRootRouteFunction.md) function instead.\n\nThe `RootRoute` class extends the `Route` class and can be used to create a root route instance. A root route instance can then be used to create a route tree.\n\n## `RootRoute` constructor\n\nThe `RootRoute` constructor accepts an object as its only argument.\n\n### Constructor options\n\nThe options that will be used to configure the root route instance.\n\n- Type:\n\n```tsx\nOmit<\n  RouteOptions,\n  | 'path'\n  | 'id'\n  | 'getParentRoute'\n  | 'caseSensitive'\n  | 'parseParams'\n  | 'stringifyParams'\n>\n```\n\n- [`RouteOptions`](./RouteOptionsType.md)\n- Optional\n\n## Constructor returns\n\nA new [`Route`](./RouteType.md) instance.\n\n## Examples\n\n```tsx\nimport { RootRoute, createRouter, Outlet } from '@tanstack/react-router'\n\nconst rootRoute = new RootRoute({\n  component: () => <Outlet />,\n  // ... root route options\n})\n\nconst routeTree = rootRoute.addChildren([\n  // ... other routes\n])\n\nconst router = createRouter({\n  routeTree,\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/RouteApiClass.md",
    "content": "---\nid: RouteApiClass\ntitle: RouteApi class\n---\n\n> [!CAUTION]\n> This class has been deprecated and will be removed in the next major version of TanStack Router.\n> Please use the [`getRouteApi`](./getRouteApiFunction.md) function instead.\n\nThe `RouteApi` class provides type-safe version 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.\n\n## Constructor options\n\nThe `RouteApi` constructor accepts a single argument: the `options` that will be used to configure the `RouteApi` instance.\n\n### `opts.routeId` option\n\n- Type: `string`\n- Required\n- The route ID to which the `RouteApi` instance will be bound\n\n## Constructor returns\n\n- An instance of the [`RouteApi`](./RouteApiType.md) that is pre-bound to the route ID that it was called with.\n\n## Examples\n\n```tsx\nimport { RouteApi } from '@tanstack/react-router'\n\nconst routeApi = new RouteApi({ id: '/posts' })\n\nexport function PostsPage() {\n  const posts = routeApi.useLoaderData()\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/RouteApiType.md",
    "content": "---\nid: RouteApiType\ntitle: RouteApi Type\n---\n\nThe `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.\n\n## `RouteApi` properties and methods\n\nThe `RouteApi` has the following properties and methods:\n\n### `useMatch` method\n\n```tsx\n  useMatch<TSelected = TAllContext>(opts?: {\n    select?: (match: TAllContext) => TSelected\n  }): TSelected\n```\n\n- 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.\n- Options\n  - `opts.select`\n    - Optional\n    - `(match: RouteMatch) => TSelected`\n    - 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.\n  - `opts.structuralSharing`\n    - Optional\n    - `boolean`\n    - Configures whether structural sharing is enabled for the value returned by `select`.\n    - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n- Returns\n  - If a `select` function is provided, the return value of the `select` function.\n  - If no `select` function is provided, the `RouteMatch` object or a loosened version of the `RouteMatch` object if `opts.strict` is `false`.\n\n### `useRouteContext` method\n\n```tsx\n  useRouteContext<TSelected = TAllContext>(opts?: {\n    select?: (search: TAllContext) => TSelected\n  }): TSelected\n```\n\n- 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.\n- Options\n  - `opts.select`\n    - Optional\n    - `(match: RouteContext) => TSelected`\n    - 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.\n- Returns\n  - If a `select` function is provided, the return value of the `select` function.\n  - If no `select` function is provided, the `RouteContext` object or a loosened version of the `RouteContext` object if `opts.strict` is `false`.\n\n### `useSearch` method\n\n```tsx\n  useSearch<TSelected = TFullSearchSchema>(opts?: {\n    select?: (search: TFullSearchSchema) => TSelected\n  }): TSelected\n```\n\n- 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.\n- Options\n  - `opts.select`\n    - Optional\n    - `(match: TFullSearchSchema) => TSelected`\n    - 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.\n  - `opts.structuralSharing`\n    - Optional\n    - `boolean`\n    - Configures whether structural sharing is enabled for the value returned by `select`.\n    - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n- Returns\n  - If a `select` function is provided, the return value of the `select` function.\n  - If no `select` function is provided, the `TFullSearchSchema` object or a loosened version of the `TFullSearchSchema` object if `opts.strict` is `false`.\n\n### `useParams` method\n\n```tsx\n  useParams<TSelected = TAllParams>(opts?: {\n    select?: (params: TAllParams) => TSelected\n  }): TSelected\n```\n\n- 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.\n- Options\n  - `opts.select`\n    - Optional\n    - `(match: TAllParams) => TSelected`\n    - 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.\n  - `opts.structuralSharing`\n    - Optional\n    - `boolean`\n    - Configures whether structural sharing is enabled for the value returned by `select`.\n    - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n- Returns\n  - If a `select` function is provided, the return value of the `select` function.\n  - If no `select` function is provided, the `TAllParams` object or a loosened version of the `TAllParams` object if `opts.strict` is `false`.\n\n### `useLoaderData` method\n\n```tsx\n  useLoaderData<TSelected = TLoaderData>(opts?: {\n    select?: (search: TLoaderData) => TSelected\n  }): TSelected\n```\n\n- 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.\n- Options\n  - `opts.select`\n    - Optional\n    - `(match: TLoaderData) => TSelected`\n    - 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.\n  - `opts.structuralSharing`\n    - Optional\n    - `boolean`\n    - Configures whether structural sharing is enabled for the value returned by `select`.\n    - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n- Returns\n  - If a `select` function is provided, the return value of the `select` function.\n  - If no `select` function is provided, the `TLoaderData` object or a loosened version of the `TLoaderData` object if `opts.strict` is `false`.\n\n### `useLoaderDeps` method\n\n```tsx\n  useLoaderDeps<TSelected = TLoaderDeps>(opts?: {\n    select?: (search: TLoaderDeps) => TSelected\n  }): TSelected\n```\n\n- 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.\n- Options\n  - `opts.select`\n    - Optional\n    - `(match: TLoaderDeps) => TSelected`\n    - If supplied, this function will be called with the route match and the return value will be returned from `useLoaderDeps`.\n  - `opts.structuralSharing`\n    - Optional\n    - `boolean`\n    - Configures whether structural sharing is enabled for the value returned by `select`.\n    - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n- Returns\n  - If a `select` function is provided, the return value of the `select` function.\n  - If no `select` function is provided, the `TLoaderDeps` object.\n\n### `useNavigate` method\n\n```tsx\n  useNavigate(): // navigate function\n```\n\n- A type-safe version of [`useNavigate`](./useNavigateHook.md) that is pre-bound to the route ID that the `RouteApi` instance was created with.\n\n### `redirect` method\n\n```tsx\n  redirect(opts?: RedirectOptions): Redirect\n```\n\n- 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.\n- The `from` parameter is automatically set to the route ID, enabling type-safe relative redirects.\n- Options\n  - All options from [`redirect`](./redirectFunction.md) except `from`, which is automatically provided.\n- Returns\n  - A `Redirect` object that can be thrown from `beforeLoad` or `loader` callbacks.\n\n#### Example\n\n```tsx\nimport { getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/dashboard/settings')\n\nexport const Route = createFileRoute('/dashboard/settings')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      // Type-safe redirect - 'from' is automatically '/dashboard/settings'\n      throw routeApi.redirect({\n        to: '../login', // Relative path to sibling route\n      })\n    }\n  },\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/RouteClass.md",
    "content": "---\nid: RouteClass\ntitle: Route class\n---\n\n> [!CAUTION]\n> This class has been deprecated and will be removed in the next major version of TanStack Router.\n> Please use the [`createRoute`](./createRouteFunction.md) function instead.\n\nThe `Route` class implements the `RouteApi` class and can be used to create route instances. A route instance can then be used to create a route tree.\n\n## `Route` constructor\n\nThe `Route` constructor accepts an object as its only argument.\n\n### Constructor options\n\n- Type: [`RouteOptions`](./RouteOptionsType.md)\n- Required\n- The options that will be used to configure the route instance\n\n### Constructor returns\n\nA new [`Route`](./RouteType.md) instance.\n\n## Examples\n\n```tsx\nimport { Route } from '@tanstack/react-router'\nimport { rootRoute } from './__root'\n\nconst indexRoute = new Route({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  loader: () => {\n    return 'Hello World'\n  },\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = indexRoute.useLoaderData()\n  return <div>{data}</div>\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/RouteMaskType.md",
    "content": "---\nid: RouteMaskType\ntitle: RouteMask type\n---\n\nThe `RouteMask` type extends the [`ToOptions`](./ToOptionsType.md) type and has other the necessary properties to create a route mask.\n\n## RouteMask properties\n\nThe `RouteMask` type accepts an object with the following properties:\n\n### `...ToOptions`\n\n- Type: [`ToOptions`](./ToOptionsType.md)\n- Required\n- The options that will be used to configure the route mask\n\n### `options.routeTree`\n\n- Type: `TRouteTree`\n- Required\n- The route tree that this route mask will support\n\n### `options.unmaskOnReload`\n\n- Type: `boolean`\n- Optional\n- If `true`, the route mask will be removed when the page is reloaded\n"
  },
  {
    "path": "docs/router/api/router/RouteMatchType.md",
    "content": "---\nid: RouteMatchType\ntitle: RouteMatch type\n---\n\nThe `RouteMatch` type represents a route match in TanStack Router.\n\n```tsx\ninterface RouteMatch {\n  id: string\n  routeId: string\n  pathname: string\n  params: Route['allParams']\n  status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'\n  isFetching: false | 'beforeLoad' | 'loader'\n  showPending: boolean\n  error: unknown\n  paramsError: unknown\n  searchError: unknown\n  updatedAt: number\n  loaderData?: Route['loaderData']\n  context: Route['allContext']\n  search: Route['fullSearchSchema']\n  fetchedAt: number\n  abortController: AbortController\n  cause: 'enter' | 'stay'\n  ssr?: boolean | 'data-only'\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/RouteOptionsType.md",
    "content": "---\nid: RouteOptionsType\ntitle: RouteOptions type\n---\n\nThe `RouteOptions` type is used to describe the options that can be used when creating a route.\n\n## RouteOptions properties\n\nThe `RouteOptions` type accepts an object with the following properties:\n\n### `getParentRoute` method\n\n- Type: `() => TParentRoute`\n- Required\n- 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.\n\n### `path` property\n\n- Type: `string`\n- Required, unless an `id` is provided to configure the route as a pathless layout route\n- The path segment that will be used to match the route.\n\n### `id` property\n\n- Type: `string`\n- Optional, but required if a `path` is not provided\n- 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.\n\n### `component` property\n\n- Type: `RouteComponent` or `LazyRouteComponent`\n- Optional - Defaults to `<Outlet />`\n- The content to be rendered when the route is matched.\n\n### `errorComponent` property\n\n- Type: `RouteComponent` or `LazyRouteComponent`\n- Optional - Defaults to `routerOptions.defaultErrorComponent`\n- The content to be rendered when the route encounters an error.\n\n### `pendingComponent` property\n\n- Type: `RouteComponent` or `LazyRouteComponent`\n- Optional - Defaults to `routerOptions.defaultPendingComponent`\n- The content to be rendered if and when the route is pending and has reached its pendingMs threshold.\n\n### `notFoundComponent` property\n\n- Type: `NotFoundRouteComponent` or `LazyRouteComponent`\n- Optional - Defaults to `routerOptions.defaultNotFoundComponent`\n- The content to be rendered when the route is not found.\n\n### `validateSearch` method\n\n- Type: `(rawSearchParams: unknown) => TSearchSchema`\n- Optional\n- 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.\n- 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 `<Link />` and `navigate()` **instead of** `TSearchSchema`. The difference between `TSearchSchemaInput` and `TSearchSchema` can be useful, for example, to express optional search parameters.\n\n### `search.middlewares` property\n\n- Type: `(({search: TSearchSchema, next: (newSearch: TSearchSchema) => TSearchSchema}) => TSearchSchema)[]`\n- Optional\n- Search middlewares are functions that transform the search parameters when generating new links for a route or its descendants.\n- 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`.\n\n### `parseParams` method (⚠️ deprecated, use `params.parse` instead)\n\n- Type: `(rawParams: Record<string, string>) => TParams`\n- Optional\n- 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.\n\n### `stringifyParams` method (⚠️ deprecated, use `params.stringify` instead)\n\n- Type: `(params: TParams) => Record<string, string>`\n- Required if `parseParams` is provided\n- 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<string, string>` mapping.\n\n### `params.parse` method\n\n- Type: `(rawParams: Record<string, string>) => TParams`\n- Optional\n- 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.\n\n### `params.stringify` method\n\n- Type: `(params: TParams) => Record<string, string>`\n- 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<string, string>` mapping.\n\n### `beforeLoad` method\n\n- Type:\n\n```tsx\ntype beforeLoad = (\n  opts: RouteMatch & {\n    search: TFullSearchSchema\n    abortController: AbortController\n    preload: boolean\n    params: TAllParams\n    context: TParentContext\n    location: ParsedLocation\n    navigate: NavigateFn<AnyRoute> // @deprecated\n    buildLocation: BuildLocationFn<AnyRoute>\n    cause: 'enter' | 'stay'\n  },\n) => Promise<TRouteContext> | TRouteContext | void\n```\n\n- Optional\n- [`ParsedLocation`](./ParsedLocationType.md)\n- 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 canceled 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.\n- 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.\n- 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.\n- 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.\n\n> 🚧 `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).\n\n### `loader` method\n\n- Type:\n\n```tsx\ntype loaderFn = (\n  opts: RouteMatch & {\n    abortController: AbortController\n    cause: 'preload' | 'enter' | 'stay'\n    context: TAllContext\n    deps: TLoaderDeps\n    location: ParsedLocation\n    params: TAllParams\n    preload: boolean\n    parentMatchPromise: Promise<MakeRouteMatchFromRoute<TParentRoute>>\n    navigate: NavigateFn<AnyRoute> // @deprecated\n    route: AnyRoute\n  },\n) => Promise<TLoaderData> | TLoaderData | void\n\ntype loader =\n  | loaderFn\n  | {\n      handler: loaderFn\n      staleReloadMode?: 'background' | 'blocking'\n    }\n```\n\n- Optional\n- [`ParsedLocation`](./ParsedLocationType.md)\n- 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 canceled 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.\n- 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.\n- 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 `<Outlet />` is rendered.\n- Deps must be returned by your `loaderDeps` function in order to appear.\n- Use the object form to configure loader-specific behavior like `staleReloadMode`.\n- `staleReloadMode: 'background'` preserves stale-while-revalidate behavior for stale successful matches.\n- `staleReloadMode: 'blocking'` waits for the stale loader reload to complete before continuing.\n\n> 🚧 `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).\n\n### `loaderDeps` method\n\n- Type:\n\n```tsx\ntype loaderDeps = (opts: { search: TFullSearchSchema }) => Record<string, any>\n```\n\n- Optional\n- 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.\n- By default, path params are already used to uniquely identify a route match, so it's unnecessary to return these here.\n- 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.\n\n### `staleTime` property\n\n- Type: `number`\n- Optional\n- Defaults to `routerOptions.defaultStaleTime`, which defaults to `0`\n- 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.\n\n### `preloadStaleTime` property\n\n- Type: `number`\n- Optional\n- Defaults to `routerOptions.defaultPreloadStaleTime`, which defaults to `30_000` ms (30 seconds)\n- 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.\n\n### `gcTime` property\n\n- Type: `number`\n- Optional\n- Defaults to `routerOptions.defaultGcTime`, which defaults to 30 minutes.\n- 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.\n\n### `shouldReload` property\n\n- Type: `boolean | ((args: LoaderArgs) => boolean)`\n- Optional\n- If `false` or returns `false`, the route match's loader data will not be reloaded on subsequent matches.\n- If `true` or returns `true`, the route match's loader data will be reloaded on subsequent matches.\n- If `undefined` or returns `undefined`, the route match's loader data will adhere to the default stale-while-revalidate behavior.\n\n### `caseSensitive` property\n\n- Type: `boolean`\n- Optional\n- If `true`, this route will be matched as case-sensitive.\n\n### `wrapInSuspense` property\n\n- Type: `boolean`\n- Optional\n- 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.\n\n### `pendingMs` property\n\n- Type: `number`\n- Optional\n- Defaults to `routerOptions.defaultPendingMs`, which defaults to `1000`\n- The threshold in milliseconds that a route must be pending before its `pendingComponent` is shown.\n\n### `pendingMinMs` property\n\n- Type: `number`\n- Optional\n- Defaults to `routerOptions.defaultPendingMinMs` which defaults to `500`\n- 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.\n\n### `preloadMaxAge` property\n\n- Type: `number`\n- Optional\n- Defaults to `30_000` ms (30 seconds)\n- 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.\n\n### `preSearchFilters` property (⚠️ deprecated, use `search.middlewares` instead)\n\n- Type: `((search: TFullSearchSchema) => TFullSearchSchema)[]`\n- Optional\n- An array of functions that will be called when generating any new links to this route or its grandchildren.\n- 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.\n- 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.\n\n### `postSearchFilters` property (⚠️ deprecated, use `search.middlewares` instead)\n\n- Type: `((search: TFullSearchSchema) => TFullSearchSchema)[]`\n- Optional\n- An array of functions that will be called when generating any new links to this route or its grandchildren.\n- 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.\n- 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.\n\n### `onError` property\n\n- Type: `(error: any) => void`\n- Optional\n- A function that will be called when an error is thrown during a navigation or preload event.\n- If this function throws a [`redirect`](./redirectFunction.md), then the router will process and apply the redirect immediately.\n\n### `onEnter` property\n\n- Type: `(match: RouteMatch) => void`\n- Optional\n- A function that will be called when a route is matched and loaded after not being matched in the previous location.\n\n### `onStay` property\n\n- Type: `(match: RouteMatch) => void`\n- Optional\n- A function that will be called when a route is matched and loaded after being matched in the previous location.\n\n### `onLeave` property\n\n- Type: `(match: RouteMatch) => void`\n- Optional\n- A function that will be called when a route is no longer matched after being matched in the previous location.\n\n### `onCatch` property\n\n- Type: `(error: Error, errorInfo: ErrorInfo) => void`\n- Optional - Defaults to `routerOptions.defaultOnCatch`\n- A function that will be called when errors are caught when the route encounters an error.\n\n### `remountDeps` method\n\n- Type:\n\n```tsx\ntype remountDeps = (opts: RemountDepsOptions) => any\n\ninterface RemountDepsOptions<\n  in out TRouteId,\n  in out TFullSearchSchema,\n  in out TAllParams,\n  in out TLoaderDeps,\n> {\n  routeId: TRouteId\n  search: TFullSearchSchema\n  params: TAllParams\n  loaderDeps: TLoaderDeps\n}\n```\n\n- Optional\n- 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.\n- The return value needs to be JSON serializable.\n- By default, a route component will not be remounted if it stays active after a navigation.\n\nExample:\nIf you want to configure to remount a route component upon `params` change, use:\n\n```tsx\nremountDeps: ({ params }) => params\n```\n\n### `headers` method\n\n- Type:\n\n```tsx\ntype headers = (opts: {\n  matches: Array<RouteMatch>\n  match: RouteMatch\n  params: TAllParams\n  loaderData?: TLoaderData\n}) => Promise<Record<string, string>> | Record<string, string>\n```\n\n- Optional\n- 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.\n\n### `head` method\n\n- Type:\n\n```tsx\ntype head = (ctx: {\n  matches: Array<RouteMatch>\n  match: RouteMatch\n  params: TAllParams\n  loaderData?: TLoaderData\n}) =>\n  | Promise<{\n      links?: RouteMatch['links']\n      scripts?: RouteMatch['headScripts']\n      meta?: RouteMatch['meta']\n      styles?: RouteMatch['styles']\n    }>\n  | {\n      links?: RouteMatch['links']\n      scripts?: RouteMatch['headScripts']\n      meta?: RouteMatch['meta']\n      styles?: RouteMatch['styles']\n    }\n```\n\n- Optional\n- Returns additional elements to inject into the document `<head>` for this route. Use it to add route-level SEO metadata, preload links, inline styles, or custom scripts.\n\n### `scripts` method\n\n- Type:\n\n```tsx\ntype scripts = (ctx: {\n  matches: Array<RouteMatch>\n  match: RouteMatch\n  params: TAllParams\n  loaderData?: TLoaderData\n}) => Promise<RouteMatch['scripts']> | RouteMatch['scripts']\n```\n\n- Optional\n- A shorthand helper to return only `<script>` elements. Equivalent to returning the `scripts` field from the `head` method.\n\n### `codeSplitGroupings` property\n\n- Type: `Array<Array<'loader' | 'component' | 'pendingComponent' | 'notFoundComponent' | 'errorComponent'>>`\n- Optional\n- Fine-grained control over how the router groups lazy-loaded pieces of a route into chunks. Each inner array represents a group of assets that will be placed into the same bundle during code-splitting.\n"
  },
  {
    "path": "docs/router/api/router/RouteType.md",
    "content": "---\nid: RouteType\ntitle: Route type\n---\n\nThe `Route` type is used to describe a route instance.\n\n## `Route` properties and methods\n\nAn instance of the `Route` has the following properties and methods:\n\n### `.addChildren` method\n\n- Type: `(children: Route[]) => this`\n- Adds child routes to the route instance and returns the route instance (but with updated types to reflect the new children).\n\n### `.update` method\n\n- Type: `(options: Partial<UpdatableRouteOptions>) => this`\n- Updates the route instance with new options and returns the route instance (but with updated types to reflect the new options).\n- In some circumstances, it can be useful to update a route instance's options after it has been created to avoid circular type references.\n- ...`RouteApi` methods\n\n### `.lazy` method\n\n- Type: `(lazyImporter: () => Promise<Partial<UpdatableRouteOptions>>) => this`\n- 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.\n\n### `.redirect` method\n\n- Type: `(opts?: RedirectOptions) => Redirect`\n- A type-safe version of the [`redirect`](./redirectFunction.md) function that is pre-bound to the route's path.\n- The `from` parameter is automatically set to the route's `fullPath`, enabling type-safe relative redirects.\n- See [`RouteApi.redirect`](./RouteApiType.md#redirect-method) for more details.\n\n#### Example\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/settings')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      // Type-safe redirect - 'from' is automatically '/dashboard/settings'\n      throw Route.redirect({\n        to: '../login', // Relative path to sibling route\n      })\n    }\n  },\n})\n```\n\n### ...`RouteApi` methods\n\n- All of the methods from [`RouteApi`](./RouteApiType.md) are available.\n"
  },
  {
    "path": "docs/router/api/router/RouterClass.md",
    "content": "---\nid: RouterClass\ntitle: Router Class\n---\n\n> [!CAUTION]\n> This class has been deprecated and will be removed in the next major version of TanStack Router.\n> Please use the [`createRouter`](./createRouterFunction.md) function instead.\n\nThe `Router` class is used to instantiate a new router instance.\n\n## `Router` constructor\n\nThe `Router` constructor accepts a single argument: the `options` that will be used to configure the router instance.\n\n### Constructor options\n\n- Type: [`RouterOptions`](./RouterOptionsType.md)\n- Required\n- The options that will be used to configure the router instance.\n\n### Constructor returns\n\n- An instance of the [`Router`](./RouterType.md).\n\n## Examples\n\n```tsx\nimport { Router, RouterProvider } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = new Router({\n  routeTree,\n  defaultPreload: 'intent',\n})\n\nexport default function App() {\n  return <RouterProvider router={router} />\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/RouterEventsType.md",
    "content": "---\nid: RouterEventsType\ntitle: RouterEvents type\n---\n\nThe `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.\n\n```tsx\ntype RouterEvents = {\n  onBeforeNavigate: {\n    type: 'onBeforeNavigate'\n    fromLocation?: ParsedLocation\n    toLocation: ParsedLocation\n    pathChanged: boolean\n    hrefChanged: boolean\n  }\n  onBeforeLoad: {\n    type: 'onBeforeLoad'\n    fromLocation?: ParsedLocation\n    toLocation: ParsedLocation\n    pathChanged: boolean\n    hrefChanged: boolean\n  }\n  onLoad: {\n    type: 'onLoad'\n    fromLocation?: ParsedLocation\n    toLocation: ParsedLocation\n    pathChanged: boolean\n    hrefChanged: boolean\n  }\n  onResolved: {\n    type: 'onResolved'\n    fromLocation?: ParsedLocation\n    toLocation: ParsedLocation\n    pathChanged: boolean\n    hrefChanged: boolean\n  }\n  onBeforeRouteMount: {\n    type: 'onBeforeRouteMount'\n    fromLocation?: ParsedLocation\n    toLocation: ParsedLocation\n    pathChanged: boolean\n    hrefChanged: boolean\n  }\n  onInjectedHtml: {\n    type: 'onInjectedHtml'\n  }\n  onRendered: {\n    type: 'onRendered'\n    fromLocation?: ParsedLocation\n    toLocation: ParsedLocation\n  }\n}\n```\n\n## RouterEvents properties\n\nOnce an event is emitted, the following properties will be present on the event payload.\n\n### `type` property\n\n- Type: `onBeforeNavigate | onBeforeLoad | onLoad | onBeforeRouteMount | onResolved`\n- The type of the event\n- This is useful for discriminating between events in a listener function.\n\n### `fromLocation` property\n\n- Type: [`ParsedLocation`](./ParsedLocationType.md)\n- The location that the router is transitioning from.\n\n### `toLocation` property\n\n- Type: [`ParsedLocation`](./ParsedLocationType.md)\n- The location that the router is transitioning to.\n\n### `pathChanged` property\n\n- Type: `boolean`\n- `true` if the path has changed between the `fromLocation` and `toLocation`.\n\n### `hrefChanged` property\n\n- Type: `boolean`\n- `true` if the href has changed between the `fromLocation` and `toLocation`.\n\n## Example\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\nconst unsub = router.subscribe('onResolved', (evt) => {\n  // ...\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/RouterOptionsType.md",
    "content": "---\nid: RouterOptions\ntitle: RouterOptions\n---\n\nThe `RouterOptions` type contains all of the options that can be used to configure a router instance.\n\n## RouterOptions properties\n\nThe `RouterOptions` type accepts an object with the following properties and methods:\n\n### `routeTree` property\n\n- Type: `AnyRoute`\n- Required\n- The route tree that will be used to configure the router instance.\n\n### `history` property\n\n- Type: `RouterHistory`\n- Optional\n- The history object that will be used to manage the browser history. If not provided, a new `createBrowserHistory` instance will be created and used.\n\n### `stringifySearch` method\n\n- Type: `(search: Record<string, any>) => string`\n- Optional\n- A function that will be used to stringify search params when generating links.\n- Defaults to `defaultStringifySearch`.\n\n### `parseSearch` method\n\n- Type: `(search: string) => Record<string, any>`\n- Optional\n- A function that will be used to parse search params when parsing the current location.\n- Defaults to `defaultParseSearch`.\n\n### `search.strict` property\n\n- Type: `boolean`\n- Optional\n- Defaults to `false`\n- Configures how unknown search params (= not returned by any `validateSearch`) are treated.\n- If `false`, unknown search params will be kept.\n- If `true`, unknown search params will be removed.\n\n### `defaultPreload` property\n\n- Type: `undefined | false | 'intent' | 'viewport' | 'render'`\n- Optional\n- Defaults to `false`\n- If `false`, routes will not be preloaded by default in any way.\n- If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.\n- If `'viewport'`, routes will be preloaded by default when they are within the viewport of the browser.\n- If `'render'`, routes will be preloaded by default as soon as they are rendered in the DOM.\n\n### `defaultPreloadDelay` property\n\n- Type: `number`\n- Optional\n- Defaults to `50`\n- The delay in milliseconds that a route must be hovered over or touched before it is preloaded.\n\n### `defaultComponent` property\n\n- Type: `RouteComponent`\n- Optional\n- Defaults to `Outlet`\n- The default `component` a route should use if no component is provided.\n\n### `defaultErrorComponent` property\n\n- Type: `RouteComponent`\n- Optional\n- Defaults to `ErrorComponent`\n- The default `errorComponent` a route should use if no error component is provided.\n\n### `defaultNotFoundComponent` property\n\n- Type: `NotFoundRouteComponent`\n- Optional\n- Defaults to `NotFound`\n- The default `notFoundComponent` a route should use if no notFound component is provided.\n\n### `defaultPendingComponent` property\n\n- Type: `RouteComponent`\n- Optional\n- The default `pendingComponent` a route should use if no pending component is provided.\n\n### `defaultPendingMs` property\n\n- Type: `number`\n- Optional\n- Defaults to `1000`\n- The default `pendingMs` a route should use if no pendingMs is provided.\n\n### `defaultPendingMinMs` property\n\n- Type: `number`\n- Optional\n- Defaults to `500`\n- The default `pendingMinMs` a route should use if no pendingMinMs is provided.\n\n### `defaultStaleTime` property\n\n- Type: `number`\n- Optional\n- Defaults to `0`\n- The default `staleTime` a route should use if no staleTime is provided.\n\n### `defaultStaleReloadMode` property\n\n- Type: `'background' | 'blocking'`\n- Optional\n- Defaults to `'background'`\n- Controls how stale successful loader data is revalidated by default.\n- `'background'` preserves stale-while-revalidate behavior.\n- `'blocking'` waits for the stale loader reload to finish before navigation resolves.\n\n### `defaultPreloadStaleTime` property\n\n- Type: `number`\n- Optional\n- Defaults to `30_000` ms (30 seconds)\n- The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.\n\n### `defaultPreloadGcTime` property\n\n- Type: `number`\n- Optional\n- Defaults to `routerOptions.defaultGcTime`, which defaults to 30 minutes.\n- The default `preloadGcTime` a route should use if no preloadGcTime is provided.\n\n### `defaultGcTime` property\n\n- Type: `number`\n- Optional\n- Defaults to 30 minutes.\n- The default `gcTime` a route should use if no gcTime is provided.\n\n### `defaultOnCatch` property\n\n- Type: `(error: Error, errorInfo: ErrorInfo) => void`\n- Optional\n- The default `onCatch` handler for errors caught by the Router ErrorBoundary\n\n### `disableGlobalCatchBoundary` property\n\n- Type: `boolean`\n- Optional\n- Defaults to `false`\n- When `true`, disables the global catch boundary that normally wraps all route matches. This allows unhandled errors to bubble up to top-level error handlers in the browser.\n- Useful for testing tools, error reporting services, and debugging scenarios.\n\n### `protocolAllowlist` property\n\n- Type: `Array<string>`\n- Optional\n- Defaults to `DEFAULT_PROTOCOL_ALLOWLIST` which includes:\n  - Web navigation: `http:`, `https:`\n  - Common browser-safe actions: `mailto:`, `tel:`\n- An array of URL protocols that are allowed in links, redirects, and navigation. Absolute URLs with protocols not in this list are rejected to prevent security vulnerabilities like XSS attacks.\n- This check is applied across router navigation APIs, including:\n  - `<Link to=\"...\">`\n  - `navigate({ to: ... })` and `navigate({ href: ... })`\n  - `redirect({ to: ... })` and `redirect({ href: ... })`\n- Protocol entries must match `URL.protocol` format (lowercase with a trailing `:`), for example `blob:` or `data:`. If you configure `protocolAllowlist: ['blob']` (without `:`), links using `blob:` will still be blocked.\n\n**Example**\n\n```tsx\nimport {\n  createRouter,\n  DEFAULT_PROTOCOL_ALLOWLIST,\n} from '@tanstack/react-router'\n\n// Use a custom allowlist (replaces the default)\nconst router = createRouter({\n  routeTree,\n  protocolAllowlist: ['https:', 'mailto:'],\n})\n\n// Or extend the default allowlist\nconst router = createRouter({\n  routeTree,\n  protocolAllowlist: [...DEFAULT_PROTOCOL_ALLOWLIST, 'ftp:'],\n})\n```\n\n### `defaultViewTransition` property\n\n- Type: `boolean | ViewTransitionOptions`\n- Optional\n- If `true`, route navigations will be called using `document.startViewTransition()`.\n- If [`ViewTransitionOptions`](./ViewTransitionOptionsType.md), route navigations will be called using `document.startViewTransition({update, types})`\n  where `types` will be the strings array passed with `ViewTransitionOptions[\"types\"]`. If the browser does not support viewTransition types,\n  the navigation will fall back to normal `document.startTransition()`, same as if `true` was passed.\n- If the browser does not support this api, this option will be ignored.\n- See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.\n- See [Google](https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types) for more information on viewTransition types\n\n### `defaultHashScrollIntoView` property\n\n- Type: `boolean | ScrollIntoViewOptions`\n- Optional\n- Defaults to `true` so the element with an id matching the hash will be scrolled into view after the location is committed to history.\n- If `false`, the element with an id matching the hash will not be scrolled into view after the location is committed to history.\n- If an object is provided, it will be passed to the `scrollIntoView` method as options.\n- See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.\n\n### `caseSensitive` property\n\n- Type: `boolean`\n- Optional\n- Defaults to `false`\n- If `true`, all routes will be matched as case-sensitive.\n\n### `basepath` property\n\n- Type: `string`\n- Optional\n- Defaults to `/`\n- The basepath for the entire router. This is useful for mounting a router instance at a subpath.\n\n### `rewrite` property\n\n- Type: `LocationRewrite`\n- Optional\n- Configures bidirectional URL transformation between the browser URL and the router's internal URL.\n- See the [URL Rewrites guide](../../guide/url-rewrites.md) for detailed usage and patterns.\n\nThe `LocationRewrite` type has the following shape:\n\n```tsx\ntype LocationRewrite = {\n  input?: LocationRewriteFunction\n  output?: LocationRewriteFunction\n}\n\ntype LocationRewriteFunction = (opts: { url: URL }) => undefined | string | URL\n```\n\n- `input`: Transforms the URL before the router interprets it (browser → router)\n- `output`: Transforms the URL before it's written to browser history (router → browser)\n\n**Example**\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => {\n      // Strip locale prefix: /en/about → /about\n      if (url.pathname.startsWith('/en')) {\n        url.pathname = url.pathname.replace(/^\\/en/, '') || '/'\n      }\n      return url\n    },\n    output: ({ url }) => {\n      // Add locale prefix: /about → /en/about\n      url.pathname = `/en${url.pathname === '/' ? '' : url.pathname}`\n      return url\n    },\n  },\n})\n```\n\nWhen both `basepath` and `rewrite` are configured, they are automatically composed. The basepath rewrite runs first on input (stripping the basepath) and last on output (adding it back).\n\n### `context` property\n\n- Type: `any`\n- Optional or required if the root route was created with [`createRootRouteWithContext()`](./createRootRouteWithContextFunction.md).\n- 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.\n\n### `dehydrate` method\n\n- Type: `() => TDehydrated`\n- Optional\n- 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.\n\n### `hydrate` method\n\n- Type: `(dehydrated: TDehydrated) => void`\n- Optional\n- 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.\n\n### `routeMasks` property\n\n- Type: `RouteMask[]`\n- Optional\n- 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.\n\n### `unmaskOnReload` property\n\n- Type: `boolean`\n- Optional\n- Defaults to `false`\n- 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 `unmaskOnReload` on the mask, or on a per-navigation basis by setting `mask.unmaskOnReload` in [`NavigateOptions`](./NavigateOptionsType.md).\n\n### `Wrap` property\n\n- Type: `React.Component`\n- Optional\n- 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.\n\n**Example**\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  // ...\n  Wrap: ({ children }) => {\n    return <MyContext.Provider value={myContext}>{children}</MyContext>\n  },\n})\n```\n\n### `InnerWrap` property\n\n- Type: `React.Component`\n- Optional\n- 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.\n\n**Example**\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  // ...\n  InnerWrap: ({ children }) => {\n    const routerState = useRouterState()\n\n    return (\n      <MyContext.Provider value={myContext}>\n        {children}\n      </MyContext>\n    )\n  },\n})\n```\n\n### `notFoundMode` property\n\n- Type: `'root' | 'fuzzy'`\n- Optional\n- Defaults to `'fuzzy'`\n- 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.\n\n### `notFoundRoute` property\n\n- **Deprecated**\n- Type: `NotFoundRoute`\n- Optional\n- 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.\n\n### `trailingSlash` property\n\n- Type: `'always' | 'never' | 'preserve'`\n- Optional\n- Defaults to `never`\n- 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.\n\n### `pathParamsAllowedCharacters` property\n\n- Type: `Array<';' | ':' | '@' | '&' | '=' | '+' | '$' | ','>`\n- Optional\n- Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.\n\n### `defaultStructuralSharing` property\n\n- Type: `boolean`\n- Optional\n- Defaults to `false`\n- Configures whether structural sharing is enabled by default for fine-grained selectors.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n### `defaultRemountDeps` property\n\n- Type:\n\n```tsx\ntype defaultRemountDeps = (opts: RemountDepsOptions) => any\n\ninterface RemountDepsOptions<\n  in out TRouteId,\n  in out TFullSearchSchema,\n  in out TAllParams,\n  in out TLoaderDeps,\n> {\n  routeId: TRouteId\n  search: TFullSearchSchema\n  params: TAllParams\n  loaderDeps: TLoaderDeps\n}\n```\n\n- Optional\n- A default 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.\n- The return value needs to be JSON serializable.\n- By default, a route component will not be remounted if it stays active after a navigation\n\nExample:  \nIf you want to configure to remount all route components upon `params` change, use:\n\n```tsx\nremountDeps: ({ params }) => params\n```\n"
  },
  {
    "path": "docs/router/api/router/RouterStateType.md",
    "content": "---\nid: RouterStateType\ntitle: RouterState type\n---\n\nThe `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.\n\n```tsx\ntype RouterState = {\n  status: 'pending' | 'idle'\n  isLoading: boolean\n  isTransitioning: boolean\n  matches: Array<RouteMatch>\n  location: ParsedLocation\n  resolvedLocation: ParsedLocation\n}\n```\n\n## RouterState properties\n\nThe `RouterState` type contains all of the properties that are available on the router state.\n\n### `status` property\n\n- Type: `'pending' | 'idle'`\n- 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.\n\n### `isLoading` property\n\n- Type: `boolean`\n- `true` if the router is currently loading a route or waiting for a route to finish loading.\n\n### `isTransitioning` property\n\n- Type: `boolean`\n- `true` if the router is currently transitioning to a new route.\n\n### `matches` property\n\n- Type: [`Array<RouteMatch>`](./RouteMatchType.md)\n- An array of all of the route matches that have been resolved and are currently active.\n\n### `location` property\n\n- Type: [`ParsedLocation`](./ParsedLocationType.md)\n- The latest location that the router has parsed from the browser history. This location may not be resolved and loaded yet.\n\n### `resolvedLocation` property\n\n- Type: [`ParsedLocation`](./ParsedLocationType.md)\n- The location that the router has resolved and loaded.\n"
  },
  {
    "path": "docs/router/api/router/RouterType.md",
    "content": "---\nid: RouterType\ntitle: Router type\n---\n\nThe `Router` type is used to describe a router instance.\n\n## `Router` properties and methods\n\nAn instance of the `Router` has the following properties and methods:\n\n### `.update` method\n\n- Type: `(newOptions: RouterOptions) => void`\n- Updates the router instance with new options.\n\n### `state` property\n\n- Type: [`RouterState`](./RouterStateType.md)\n- The current state of the router.\n\n> ⚠️⚠️⚠️ **`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.**\n\n### `.subscribe` method\n\n- Type: `(eventType: TType, fn: ListenerFn<RouterEvents[TType]>) => (event: RouterEvent) => void`\n- Subscribes to a [`RouterEvent`](./RouterEventsType.md).\n- Returns a function that can be used to unsubscribe from the event.\n- The callback provided to the returned function will be called with the event that was emitted.\n\n### `.matchRoutes` method\n\n- Type: `(pathname: string, locationSearch?: Record<string, any>, opts?: { throwOnError?: boolean; }) => RouteMatch[]`\n- Matches a pathname and search params against the router's route tree and returns an array of route matches.\n- 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).\n\n### `.cancelMatch` method\n\n- Type: `(matchId: string) => void`\n- Cancels a route match that is currently pending by calling `match.abortController.abort()`.\n\n### `.cancelMatches` method\n\n- Type: `() => void`\n- Cancels all route matches that are currently pending by calling `match.abortController.abort()` on each one.\n\n### `.buildLocation` method\n\nBuilds a new parsed location object that can be used later to navigate to a new location.\n\n- Type: `(opts: BuildNextOptions) => ParsedLocation`\n- Properties\n  - `from`\n    - Type: `string`\n    - Optional\n    - The path to navigate from. If not provided, the current path will be used.\n  - `to`\n    - Type: `string | number | null`\n    - Optional\n    - The path to navigate to. If `null`, the current path will be used.\n  - `params`\n    - Type: `true | Updater<unknown>`\n    - Optional\n    - 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.\n  - `search`\n    - Type: `true | Updater<unknown>`\n    - Optional\n    - 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.\n  - `hash`\n    - Type: `true | Updater<string>`\n    - Optional\n    - 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.\n  - `state`\n    - Type: `true | NonNullableUpdater<ParsedHistoryState, HistoryState>`\n    - Optional\n    - 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.\n  - `mask`\n    - Type: `object`\n    - Optional\n    - Contains all of the same BuildNextOptions, with the addition of `unmaskOnReload`.\n    - `unmaskOnReload`\n      - Type: `boolean`\n      - Optional\n      - If `true`, the route mask will be removed when the page is reloaded. This can be overridden on a per-navigation basis by setting `mask.unmaskOnReload` in [`NavigateOptions`](./NavigateOptionsType.md).\n\n### `.commitLocation` method\n\nCommits a new location object to the browser history.\n\n- Type\n  ```tsx\n  type commitLocation = (\n    location: ParsedLocation & {\n      replace?: boolean\n      resetScroll?: boolean\n      hashScrollIntoView?: boolean | ScrollIntoViewOptions\n      ignoreBlocker?: boolean\n    },\n  ) => Promise<void>\n  ```\n- Properties\n  - `location`\n    - Type: [`ParsedLocation`](./ParsedLocationType.md)\n    - Required\n    - The location to commit to the browser history.\n  - `replace`\n    - Type: `boolean`\n    - Optional\n    - Defaults to `false`.\n    - If `true`, the location will be committed to the browser history using `history.replace` instead of `history.push`.\n  - `resetScroll`\n    - Type: `boolean`\n    - Optional\n    - Defaults to `true` so that the scroll position will be reset to 0,0 after the location is committed to the browser history.\n    - If `false`, the scroll position will not be reset to 0,0 after the location is committed to history.\n  - `hashScrollIntoView`\n    - Type: `boolean | ScrollIntoViewOptions`\n    - Optional\n    - Defaults to `true` so the element with an id matching the hash will be scrolled into view after the location is committed to history.\n    - If `false`, the element with an id matching the hash will not be scrolled into view after the location is committed to history.\n    - If an object is provided, it will be passed to the `scrollIntoView` method as options.\n    - See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.\n  - `ignoreBlocker`\n    - Type: `boolean`\n    - Optional\n    - Defaults to `false`.\n    - If `true`, navigation will ignore any blockers that might prevent it.\n\n### `.navigate` method\n\nNavigates to a new location.\n\n- Type\n  ```tsx\n  type navigate = (options: NavigateOptions) => Promise<void>\n  ```\n\n### `.invalidate` method\n\nInvalidates route matches by forcing their `beforeLoad` and `load` functions to be called again.\n\n- Type: `(opts?: {filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean, sync?: boolean, forcePending?: boolean }) => Promise<void>`\n- 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.\n- if `filter` is not supplied, all matches will be invalidated\n- if `filter` is supplied, only matches for which `filter` returns `true` will be invalidated.\n- if `sync` is true, the promise returned by this function will only resolve once all loaders have finished.\n- if `forcePending` is true, the invalidated matches will be put into `'pending'` state regardless whether they are in `'error'` state or not.\n- You might also want to invalidate the Router if you imperatively `reset` the router's `CatchBoundary` to trigger loaders again.\n\n### `.clearCache` method\n\nRemove cached route matches.\n\n- Type: `(opts?: {filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean}) => void`\n- if `filter` is not supplied, all cached matches will be removed\n- if `filter` is supplied, only matches for which `filter` returns `true` will be removed.\n\n### `.load` method\n\nLoads all of the currently matched route matches and resolves when they are all loaded and ready to be rendered.\n\n> ⚠️⚠️⚠️ **`router.load()` respects `route.staleTime`: fresh matches stay fresh, but stale matches are revalidated even if their loader key did not change. If you need to forcefully reload all active matches regardless of freshness, use `router.invalidate()` instead.**\n\n- Type: `(opts?: {sync?: boolean}) => Promise<void>`\n- if `sync` is true, the promise returned by this function will only resolve once all loaders have finished.\n- 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.\n\n### `.preloadRoute` method\n\nPreloads all of the matches that match the provided `NavigateOptions`.\n\n> ⚠️⚠️⚠️ **Preloaded route matches are not stored long-term in the router state. They are only stored until the next attempted navigation action.**\n\n- Type: `(opts?: NavigateOptions) => Promise<RouteMatch[]>`\n- Properties\n  - `opts`\n    - Type: `NavigateOptions`\n    - Optional, defaults to the current location.\n    - The options that will be used to determine which route matches to preload.\n- Returns\n  - A promise that resolves with an array of all of the route matches that were preloaded.\n\n### `.loadRouteChunk` method\n\nLoads the JS chunk of the route.\n\n- Type: `(route: AnyRoute) => Promise<void>`\n\n### `.matchRoute` method\n\nMatches 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.\n\n- Type: `(dest: ToOptions, matchOpts?: MatchRouteOptions) => RouteMatch['params'] | false`\n- Properties\n  - `dest`\n    - Type: `ToOptions`\n    - Required\n    - The destination to match against.\n  - `matchOpts`\n    - Type: `MatchRouteOptions`\n    - Optional\n    - Options that will be used to match the destination.\n- Returns\n  - A route match's params if a match was found.\n  - `false` if no match was found.\n\n### `.dehydrate` method\n\nDehydrates the router's critical state into a serializable object that can be sent to the client in an initial request.\n\n- Type: `() => DehydratedRouter`\n- Returns\n  - A serializable object that contains the router's critical state.\n\n### `.hydrate` method\n\nHydrates the router's critical state from a serializable object that was sent from the server in an initial request.\n\n- Type: `(dehydrated: DehydratedRouter) => void`\n- Properties\n  - `dehydrated`\n    - Type: `DehydratedRouter`\n    - Required\n    - The dehydrated router state that was sent from the server.\n"
  },
  {
    "path": "docs/router/api/router/ToMaskOptionsType.md",
    "content": "---\nid: ToMaskOptionsType\ntitle: ToMaskOptions type\n---\n\nThe `ToMaskOptions` type includes the same destination fields as [`ToOptions`](./ToOptionsType.md), excluding `mask`, and adds options specific to route masking.\n\n```tsx\ntype ToMaskOptions = {\n  from?: ValidRoutePath | string\n  to?: ValidRoutePath | string\n  hash?: true | string | ((prev?: string) => string)\n  state?: true | HistoryState | ((prev: HistoryState) => HistoryState)\n} & SearchParamOptions &\n  PathParamOptions & {\n    unmaskOnReload?: boolean\n  }\n```\n\n- [`ToOptions`](./ToOptionsType.md)\n"
  },
  {
    "path": "docs/router/api/router/ToOptionsType.md",
    "content": "---\nid: ToOptionsType\ntitle: ToOptions type\n---\n\nThe `ToOptions` type contains several properties that can be used to describe a router destination, including `mask` for route masking.\n\n```tsx\ntype ToOptions = {\n  from?: ValidRoutePath | string\n  to?: ValidRoutePath | string\n  hash?: true | string | ((prev?: string) => string)\n  state?: true | HistoryState | ((prev: HistoryState) => HistoryState)\n} & SearchParamOptions &\n  PathParamOptions &\n  MaskOptions\n\ntype SearchParamOptions = {\n  search?: true | TToSearch | ((prev: TFromSearch) => TToSearch)\n}\n\ntype PathParamOptions = {\n  params?:\n    | true\n    | Record<string, TPathParam>\n    | ((prev: TFromParams) => TToParams)\n}\n\ntype MaskOptions = {\n  mask?: ToMaskOptions<TRouter, TMaskFrom, TMaskTo>\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/UseMatchRouteOptionsType.md",
    "content": "---\nid: UseMatchRouteOptionsType\ntitle: UseMatchRouteOptions type\n---\n\nThe `UseMatchRouteOptions` type extends the [`ToOptions`](./ToOptionsType.md) type and describes additional options available when using the [`useMatchRoute`](./useMatchRouteHook.md) hook.\n\n```tsx\nexport type UseMatchRouteOptions = ToOptions & MatchRouteOptions\n```\n\n- [`ToOptions`](./ToOptionsType.md)\n- [`MatchRouteOptions`](./MatchRouteOptionsType.md)\n"
  },
  {
    "path": "docs/router/api/router/ViewTransitionOptionsType.md",
    "content": "---\nid: ViewTransitionOptionsType\ntitle: ViewTransitionOptions type\n---\n\nThe `ViewTransitionOptions` type is used to define a\n[viewTransition type](https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types).\n\n```tsx\ninterface ViewTransitionOptions {\n  types:\n    | Array<string>\n    | ((locationChangeInfo: {\n        fromLocation?: ParsedLocation\n        toLocation: ParsedLocation\n        pathChanged: boolean\n        hrefChanged: boolean\n        hashChanged: boolean\n      }) => Array<string> | false)\n}\n```\n\n## ViewTransitionOptions properties\n\nThe `ViewTransitionOptions` type accepts an object with a single property:\n\n### `types` property\n\n- Type: `Array<string> | ((locationChangeInfo: {\n  fromLocation?: ParsedLocation\n  toLocation: ParsedLocation\n  pathChanged: boolean\n  hrefChanged: boolean\n  hashChanged: boolean\n}) => (Array<string> | false))`\n- Required\n- Either one of:\n  - An array of strings that will be passed to the `document.startViewTransition({update, types}) call`\n  - A function that accepts `locationChangeInfo` object and returns either:\n    - An array of strings that will be passed to the `document.startViewTransition({update, types}) call`\n    - or `false` to skip the view transition\n"
  },
  {
    "path": "docs/router/api/router/awaitComponent.md",
    "content": "---\nid: awaitComponent\ntitle: Await component\n---\n\nThe `Await` component is a component that suspends until the provided promise is resolved or rejected.\nThis is only necessary for React 18.\nIf you are using React 19, you can use the `use()` hook instead.\n\n## Await props\n\nThe `Await` component accepts the following props:\n\n### `props.promise` prop\n\n- Type: `Promise<T>`\n- Required\n- The promise to await.\n\n### `props.children` prop\n\n- Type: `(result: T) => React.ReactNode`\n- Required\n- A function that will be called with the resolved value of the promise.\n\n## Await returns\n\n- Throws an error if the promise is rejected.\n- Suspends (throws a promise) if the promise is pending.\n- Returns the resolved value of a deferred promise if the promise is resolved using `props.children` as the render function.\n\n## Examples\n\n```tsx\nimport { Await } from '@tanstack/react-router'\n\nfunction Component() {\n  const { deferredPromise } = route.useLoaderData()\n\n  return (\n    <Await promise={deferredPromise}>\n      {(data) => <div>{JSON.stringify(data)}</div>}\n    </Await>\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/catchBoundaryComponent.md",
    "content": "---\nid: catchBoundaryComponent\ntitle: CatchBoundary component\n---\n\nThe `CatchBoundary` component is a component that catches errors thrown by its children, renders an error component and optionally calls the `onCatch` callback. It also accepts a `getResetKey` function that can be used to declaratively reset the component's state when the key changes.\n\n## CatchBoundary props\n\nThe `CatchBoundary` component accepts the following props:\n\n### `props.getResetKey` prop\n\n- Type: `() => string`\n- Required\n- A function that returns a string that will be used to reset the component's state when the key changes.\n\n### `props.children` prop\n\n- Type: `React.ReactNode`\n- Required\n- The component's children to render when there is no error\n\n### `props.errorComponent` prop\n\n- Type: `React.ReactNode`\n- Optional - [`default: ErrorComponent`](./errorComponentComponent.md)\n- The component to render when there is an error.\n\n### `props.onCatch` prop\n\n- Type: `(error: any) => void`\n- Optional\n- A callback that will be called with the error that was thrown by the component's children.\n\n## CatchBoundary returns\n\n- Returns the component's children if there is no error.\n- Returns the `errorComponent` if there is an error.\n\n## Examples\n\n```tsx\nimport { CatchBoundary } from '@tanstack/react-router'\n\nfunction Component() {\n  return (\n    <CatchBoundary\n      getResetKey={() => 'reset'}\n      onCatch={(error) => console.error(error)}\n    >\n      <div>My Component</div>\n    </CatchBoundary>\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/catchNotFoundComponent.md",
    "content": "---\nid: catchNotFoundComponent\ntitle: CatchNotFound Component\n---\n\nThe `CatchNotFound` component is a component that catches not-found errors thrown by its children, renders a fallback component and optionally calls the `onCatch` callback. It resets when the pathname changes.\n\n## CatchNotFound props\n\nThe `CatchNotFound` component accepts the following props:\n\n### `props.children` prop\n\n- Type: `React.ReactNode`\n- Required\n- The component's children to render when there is no error\n\n### `props.fallback` prop\n\n- Type: `(error: NotFoundError) => React.ReactElement`\n- Optional\n- The component to render when there is an error\n\n### `props.onCatch` prop\n\n- Type: `(error: any) => void`\n- Optional\n- A callback that will be called with the error that was thrown by the component's children\n\n## CatchNotFound returns\n\n- Returns the component's children if there is no error.\n- Returns the `fallback` if there is an error.\n\n## Examples\n\n```tsx\nimport { CatchNotFound } from '@tanstack/react-router'\n\nfunction Component() {\n  return (\n    <CatchNotFound\n      fallback={(error) => <p>Not found error! {JSON.stringify(error)}</p>}\n    >\n      <ComponentThatMightThrowANotFoundError />\n    </CatchNotFound>\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/clientOnlyComponent.md",
    "content": "---\nid: clientOnlyComponent\ntitle: ClientOnly Component\n---\n\nThe `ClientOnly` component is used to render a component only in the client, without breaking the server-side rendering due to hydration errors. It accepts a `fallback` prop that will be rendered if the JS is not yet loaded in the client.\n\n## Props\n\nThe `ClientOnly` component accepts the following props:\n\n### `props.fallback` prop\n\nThe fallback component to render if the JS is not yet loaded in the client.\n\n### `props.children` prop\n\nThe component to render if the JS is loaded in the client.\n\n## Returns\n\n- Returns the component's children if the JS is loaded in the client.\n- Returns the `fallback` component if the JS is not yet loaded in the client.\n\n## Examples\n\n```tsx\n// src/routes/dashboard.tsx\nimport { ClientOnly, createFileRoute } from '@tanstack/react-router'\nimport {\n  Charts,\n  FallbackCharts,\n} from './charts-that-break-server-side-rendering'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: Dashboard,\n  // ... other route options\n})\n\nfunction Dashboard() {\n  return (\n    <div>\n      <p>Dashboard</p>\n      <ClientOnly fallback={<FallbackCharts />}>\n        <Charts />\n      </ClientOnly>\n    </div>\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/createFileRouteFunction.md",
    "content": "---\nid: createFileRouteFunction\ntitle: createFileRoute function\n---\n\nThe `createFileRoute` function is a factory that can be used to create a file-based route instance. This route instance can then be used to automatically generate a route tree with the `tsr generate` and `tsr watch` commands.\n\n## createFileRoute options\n\nThe `createFileRoute` function accepts a single argument of type `string` that represents the `path` of the file that the route will be generated from.\n\n### `path` option\n\n- Type: `string` literal\n- Required, but **automatically inserted and updated by the `tsr generate` and `tsr watch` commands**\n- The full path of the file that the route will be generated from\n\n## createFileRoute returns\n\nA new function that accepts a single argument of type [`RouteOptions`](./RouteOptionsType.md) that will be used to configure the file [`Route`](./RouteType.md) instance.\n\n> ⚠️ Note: For `tsr generate` and `tsr watch` to work properly, the file route instance must be exported from the file using the `Route` identifier.\n\n## Examples\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  loader: () => {\n    return 'Hello World'\n  },\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = Route.useLoaderData()\n  return <div>{data}</div>\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/createLazyFileRouteFunction.md",
    "content": "---\nid: createLazyFileRouteFunction\ntitle: createLazyFileRoute function\n---\n\nThe `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`.\n\n## createLazyFileRoute options\n\nThe `createLazyFileRoute` function accepts a single argument of type `string` that represents the `path` of the file that the route will be generated from.\n\n### `path`\n\n- Type: `string`\n- Required, but **automatically inserted and updated by the `tsr generate` and `tsr watch` commands**\n- The full path of the file that the route will be generated from.\n\n### createLazyFileRoute returns\n\nA new function that accepts a single argument of partial of the type [`RouteOptions`](./RouteOptionsType.md) that will be used to configure the file [`Route`](./RouteType.md) instance.\n\n- Type:\n\n```tsx\nPick<\n  RouteOptions,\n  'component' | 'pendingComponent' | 'errorComponent' | 'notFoundComponent'\n>\n```\n\n- [`RouteOptions`](./RouteOptionsType.md)\n\n> ⚠️ Note: For `tsr generate` and `tsr watch` to work properly, the file route instance must be exported from the file using the `Route` identifier.\n\n### Examples\n\n```tsx\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = Route.useLoaderData()\n  return <div>{data}</div>\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/createLazyRouteFunction.md",
    "content": "---\nid: createLazyRouteFunction\ntitle: createLazyRoute function\n---\n\nThe `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`.\n\n## createLazyRoute options\n\nThe `createLazyRoute` function accepts a single argument of type `string` that represents the `id` of the route.\n\n### `id`\n\n- Type: `string`\n- Required\n- The route id of the route.\n\n### createLazyRoute returns\n\nA new function that accepts a single argument of partial of the type [`RouteOptions`](./RouteOptionsType.md) that will be used to configure the file [`Route`](./RouteType.md) instance.\n\n- Type:\n\n```tsx\nPick<\n  RouteOptions,\n  'component' | 'pendingComponent' | 'errorComponent' | 'notFoundComponent'\n>\n```\n\n- [`RouteOptions`](./RouteOptionsType.md)\n\n> ⚠️ Note: This route instance must be manually lazily loaded against its critical route instance using the `lazy` method returned by the `createRoute` function.\n\n### Examples\n\n```tsx\n// src/route-pages/index.tsx\nimport { createLazyRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = Route.useLoaderData()\n  return <div>{data}</div>\n}\n\n// src/routeTree.tsx\nimport {\n  createRootRouteWithContext,\n  createRoute,\n  Outlet,\n} from '@tanstack/react-router'\n\ninterface MyRouterContext {\n  foo: string\n}\n\nconst rootRoute = createRootRouteWithContext<MyRouterContext>()({\n  component: () => <Outlet />,\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n}).lazy(() => import('./route-pages/index').then((d) => d.Route))\n\nexport const routeTree = rootRoute.addChildren([indexRoute])\n```\n"
  },
  {
    "path": "docs/router/api/router/createRootRouteFunction.md",
    "content": "---\nid: createRootRouteFunction\ntitle: createRootRoute function\n---\n\nThe `createRootRoute` function returns a new root route instance. A root route instance can then be used to create a route-tree.\n\n## createRootRoute options\n\nThe options that will be used to configure the root route instance.\n\n- Type:\n\n```tsx\nOmit<\n  RouteOptions,\n  | 'path'\n  | 'id'\n  | 'getParentRoute'\n  | 'caseSensitive'\n  | 'parseParams'\n  | 'stringifyParams'\n>\n```\n\n- [`RouteOptions`](./RouteOptionsType.md)\n- Optional\n\n## createRootRoute returns\n\nA new [`Route`](./RouteType.md) instance.\n\n## Examples\n\n```tsx\nimport { createRootRoute, createRouter, Outlet } from '@tanstack/react-router'\n\nconst rootRoute = createRootRoute({\n  component: () => <Outlet />,\n  // ... root route options\n})\n\nconst routeTree = rootRoute.addChildren([\n  // ... other routes\n])\n\nconst router = createRouter({\n  routeTree,\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/createRootRouteWithContextFunction.md",
    "content": "---\nid: createRootRouteWithContextFunction\ntitle: createRootRouteWithContext function\n---\n\nThe `createRootRouteWithContext` function is a helper function that can be used to create a root route instance that requires a context type to be fulfilled when the router is created.\n\n## createRootRouteWithContext generics\n\nThe `createRootRouteWithContext` function accepts a single generic argument:\n\n### `TRouterContext` generic\n\n- Type: `TRouterContext`\n- Optional, **but recommended**.\n- The context type that will be required to be fulfilled when the router is created\n\n## createRootRouteWithContext returns\n\n- A factory function that can be used to create a new [`createRootRoute`](./createRootRouteFunction.md) instance.\n- It accepts a single argument, the same as the [`createRootRoute`](./createRootRouteFunction.md) function.\n\n## Examples\n\n```tsx\nimport {\n  createRootRouteWithContext,\n  createRouter,\n} from '@tanstack/react-router'\nimport { QueryClient } from '@tanstack/react-query'\n\ninterface MyRouterContext {\n  queryClient: QueryClient\n}\n\nconst rootRoute = createRootRouteWithContext<MyRouterContext>()({\n  component: () => <Outlet />,\n  // ... root route options\n})\n\nconst routeTree = rootRoute.addChildren([\n  // ... other routes\n])\n\nconst queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/createRouteFunction.md",
    "content": "---\nid: createRouteFunction\ntitle: createRoute function\n---\n\nThe `createRoute` function implements returns a [`Route`](./RouteType.md) instance. A route instance can then be passed to a root route's children to create a route tree, which is then passed to the router.\n\n## createRoute options\n\n- Type: [`RouteOptions`](./RouteOptionsType.md)\n- Required\n- The options that will be used to configure the route instance\n\n## createRoute returns\n\nA new [`Route`](./RouteType.md) instance.\n\n## Examples\n\n```tsx\nimport { createRoute } from '@tanstack/react-router'\nimport { rootRoute } from './__root'\n\nconst Route = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  loader: () => {\n    return 'Hello World'\n  },\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = Route.useLoaderData()\n  return <div>{data}</div>\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/createRouteMaskFunction.md",
    "content": "---\nid: createRouteMaskFunction\ntitle: createRouteMask function\n---\n\nThe `createRouteMask` function is a helper function that can be used to create a route mask configuration that can be passed to the `RouterOptions.routeMasks` option.\n\n## createRouteMask options\n\n- Type: [`RouteMask`](./RouteMaskType.md)\n- Required\n- The options that will be used to configure the route mask\n\n## createRouteMask returns\n\n- A object with the type signature of [`RouteMask`](./RouteMaskType.md) that can be passed to the `RouterOptions.routeMasks` option.\n\n## Examples\n\n```tsx\nimport { createRouteMask, createRouter } from '@tanstack/react-router'\n\nconst photoModalToPhotoMask = createRouteMask({\n  routeTree,\n  from: '/photos/$photoId/modal',\n  to: '/photos/$photoId',\n  params: true,\n})\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  routeMasks: [photoModalToPhotoMask],\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/createRouterFunction.md",
    "content": "---\nid: createRouterFunction\ntitle: createRouter function\n---\n\nThe `createRouter` function accepts a [`RouterOptions`](./RouterOptionsType.md) object and creates a new [`Router`](./RouterClass.md) instance.\n\n## createRouter options\n\n- Type: [`RouterOptions`](./RouterOptionsType.md)\n- Required\n- The options that will be used to configure the router instance.\n\n## createRouter returns\n\n- An instance of the [`Router`](./RouterType.md).\n\n## Examples\n\n```tsx\nimport { createRouter, RouterProvider } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n})\n\nexport default function App() {\n  return <RouterProvider router={router} />\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/defaultGlobalNotFoundComponent.md",
    "content": "---\nid: defaultGlobalNotFoundComponent\ntitle: DefaultGlobalNotFound component\n---\n\nThe `DefaultGlobalNotFound` component is a component that renders \"Not Found\" on the root route when there is no other route that matches and a `notFoundComponent` is not provided.\n\n## DefaultGlobalNotFound returns\n\n```tsx\n<p>Not Found</p>\n```\n"
  },
  {
    "path": "docs/router/api/router/deferFunction.md",
    "content": "---\nid: deferFunction\ntitle: defer function\n---\n\n> [!CAUTION]\n> You don't need to call `defer` manually anymore, Promises are handled automatically now.\n\nThe `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 [`<Await>`](./awaitComponent.md) component for suspending until the promise is resolved or rejected.\n\nThe `defer` function accepts a single argument, the `promise` to wrap with a deferred state object.\n\n## defer options\n\n- Type: `Promise<T>`\n- Required\n- The promise to wrap with a deferred state object.\n\n## defer returns\n\n- A promise that can be passed to the [`useAwaited`](./useAwaitedHook.md) hook or the [`<Await>`](./awaitComponent.md) component.\n\n## Examples\n\n```tsx\nimport { defer } from '@tanstack/react-router'\n\nconst route = createRoute({\n  loader: () => {\n    const deferredPromise = defer(fetch('/api/data'))\n    return { deferredPromise }\n  },\n  component: MyComponent,\n})\n\nfunction MyComponent() {\n  const { deferredPromise } = Route.useLoaderData()\n\n  const data = useAwaited({ promise: deferredPromise })\n\n  // or\n\n  return (\n    <Await promise={deferredPromise}>\n      {(data) => <div>{JSON.stringify(data)}</div>}\n    </Await>\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/errorComponentComponent.md",
    "content": "---\nid: errorComponentComponent\ntitle: ErrorComponent component\n---\n\nThe `ErrorComponent` component is a component that renders an error message and optionally the error's message.\n\n## ErrorComponent props\n\nThe `ErrorComponent` component accepts the following props:\n\n### `props.error` prop\n\n- Type: `TError` (defaults to `Error`)\n- The error that was thrown by the component's children\n\n### `props.info` prop\n\n- Type: `{ componentStack: string }`\n- Optional\n- Additional information about where the error was thrown, such as the React component stack trace.\n\n### `props.reset` prop\n\n- Type: `() => void`\n- A function to programmatically reset the error state\n\n## ErrorComponent returns\n\n- Returns a formatted error message with the error's message if it exists.\n- The error message can be toggled by clicking the \"Show Error\" button.\n- By default, the error message will be shown in development.\n"
  },
  {
    "path": "docs/router/api/router/getRouteApiFunction.md",
    "content": "---\nid: getRouteApiFunction\ntitle: getRouteApi function\n---\n\nThe `getRouteApi` function provides type-safe version 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.\n\n## getRouteApi options\n\nThe `getRouteApi` function accepts a single argument, a `routeId` string literal.\n\n### `routeId` option\n\n- Type: `string`\n- Required\n- The route ID to which the [`RouteApi`](./RouteApiClass.md) instance will be bound\n\n## getRouteApi returns\n\n- An instance of the [`RouteApi`](./RouteApiType.md) that is pre-bound to the route ID that the `getRouteApi` function was called with.\n\n## Examples\n\n```tsx\nimport { getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/posts')\n\nexport function PostsPage() {\n  const posts = routeApi.useLoaderData()\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/historyStateInterface.md",
    "content": "---\nid: historyStateInterface\ntitle: HistoryState interface\n---\n\nThe `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.\n\nYou can extend this interface to add additional properties to the state object across your application.\n\n```tsx\n// src/main.tsx\ndeclare module '@tanstack/react-router' {\n  // ...\n\n  interface HistoryState {\n    additionalRequiredProperty: number\n    additionalProperty?: string\n  }\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/isNotFoundFunction.md",
    "content": "---\nid: isNotFoundFunction\ntitle: isNotFound function\n---\n\nThe `isNotFound` function can be used to determine if an object is a [`NotFoundError`](./NotFoundErrorType.md) object.\n\n## isNotFound options\n\nThe `isNotFound` function accepts a single argument, an `input`.\n\n### `input` option\n\n- Type: `unknown`\n- Required\n- An object to check if it is a [`NotFoundError`](./NotFoundErrorType.md).\n\n## isNotFound returns\n\n- Type: `boolean`\n- `true` if the object is a [`NotFoundError`](./NotFoundErrorType.md).\n- `false` if the object is not a [`NotFoundError`](./NotFoundErrorType.md).\n\n## Examples\n\n```tsx\nimport { isNotFound } from '@tanstack/react-router'\n\nfunction somewhere(obj: unknown) {\n  if (isNotFound(obj)) {\n    // ...\n  }\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/isRedirectFunction.md",
    "content": "---\nid: isRedirectFunction\ntitle: isRedirect function\n---\n\nThe `isRedirect` function can be used to determine if an object is a redirect object.\n\n## isRedirect options\n\nThe `isRedirect` function accepts a single argument, an `input`.\n\n#### `input`\n\n- Type: `unknown`\n- Required\n- An object to check if it is a redirect object\n\n## isRedirect returns\n\n- Type: `boolean`\n- `true` if the object is a redirect object\n- `false` if the object is not a redirect object\n\n## Examples\n\n```tsx\nimport { isRedirect } from '@tanstack/react-router'\n\nfunction somewhere(obj: unknown) {\n  if (isRedirect(obj)) {\n    // ...\n  }\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/lazyRouteComponentFunction.md",
    "content": "---\nid: lazyRouteComponentFunction\ntitle: lazyRouteComponent function\n---\n\n> [!IMPORTANT]\n> If you are using file-based routing, it's recommended to use the `createLazyFileRoute` function instead.\n\nThe `lazyRouteComponent` function can be used to create a one-off code-split route component that can be preloaded using a `component.preload()` method.\n\n## lazyRouteComponent options\n\nThe `lazyRouteComponent` function accepts two arguments:\n\n### `importer` option\n\n- Type: `() => Promise<T>`\n- Required\n- A function that returns a promise that resolves to an object that contains the component to be loaded.\n\n### `exportName` option\n\n- Type: `string`\n- Optional\n- The name of the component to be loaded from the imported object. Defaults to `'default'`.\n\n## lazyRouteComponent returns\n\n- A `React.lazy` component that can be preloaded using a `component.preload()` method.\n\n## Examples\n\n```tsx\nimport { lazyRouteComponent } from '@tanstack/react-router'\n\nconst route = createRoute({\n  path: '/posts/$postId',\n  component: lazyRouteComponent(() => import('./Post')), // default export\n})\n\n// or\n\nconst route = createRoute({\n  path: '/posts/$postId',\n  component: lazyRouteComponent(\n    () => import('./Post'),\n    'PostByIdPageComponent', // named export\n  ),\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/linkComponent.md",
    "content": "---\nid: linkComponent\ntitle: Link component\n---\n\nThe `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.\n\n## Link props\n\nThe `Link` component accepts the following props:\n\n### `...props`\n\n- Type: `LinkProps & React.RefAttributes<HTMLAnchorElement>`\n- [`LinkProps`](./LinkPropsType.md)\n\n## Link returns\n\nAn anchor element that can be used to navigate to a new location.\n\n## Examples\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction Component() {\n  return (\n    <Link\n      to=\"/somewhere/$somewhereId\"\n      params={{ somewhereId: 'baz' }}\n      search={(prev) => ({ ...prev, foo: 'bar' })}\n    >\n      Click me\n    </Link>\n  )\n}\n```\n\nBy default, param values with characters such as `@` will be encoded in the URL:\n\n```tsx\n// url path will be `/%40foo`\n<Link to=\"/$username\" params={{ username: '@foo' }} />\n```\n\nTo opt-out, update the [pathParamsAllowedCharacters](../router/RouterOptionsType#pathparamsallowedcharacters-property) config on the router\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  routeTree,\n  pathParamsAllowedCharacters: ['@'],\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/linkOptions.md",
    "content": "---\nid: linkOptions\ntitle: Link options\n---\n\n`linkOptions` is a function which type checks an object literal with the intention of being used for `Link`, `navigate` or `redirect`\n\n## linkOptions props\n\nThe `linkOptions` accepts the following option:\n\n### `...props`\n\n- Type: `LinkProps & React.RefAttributes<HTMLAnchorElement>`\n- [`LinkProps`](./LinkPropsType.md)\n\n## `linkOptions` returns\n\nAn object literal with the exact type inferred from the input\n\n## Examples\n\n```tsx\nconst userLinkOptions = linkOptions({\n  to: '/dashboard/users/user',\n  search: {\n    usersView: {\n      sortBy: 'email',\n      filterBy: 'filter',\n    },\n    userId: 0,\n  },\n})\n\nfunction DashboardComponent() {\n  return <Link {...userLinkOptions} />\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/matchRouteComponent.md",
    "content": "---\nid: matchRouteComponent\ntitle: MatchRoute component\n---\n\nA component version of the `useMatchRoute` hook. It accepts the same options as the `useMatchRoute` with additional props to aid in conditional rendering.\n\n## MatchRoute props\n\nThe `MatchRoute` component accepts the same options as the `useMatchRoute` hook with additional props to aid in conditional rendering.\n\n### `...props` prop\n\n- Type: [`UseMatchRouteOptions`](./UseMatchRouteOptionsType.md)\n\n### `children` prop\n\n- Optional\n- `React.ReactNode`\n  - The component that will be rendered if the route is matched.\n- `((params: TParams | false) => React.ReactNode)`\n  - A function that will be called with the matched route's params or `false` if no route was matched. This can be useful for components that need to always render, but render different props based on a route match or not.\n\n## MatchRoute returns\n\nEither the `children` prop or the return value of the `children` function.\n\n## Examples\n\n```tsx\nimport { MatchRoute } from '@tanstack/react-router'\n\nfunction Component() {\n  return (\n    <div>\n      <MatchRoute to=\"/posts/$postId\" params={{ postId: '123' }} pending>\n        {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n      </MatchRoute>\n    </div>\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/navigateComponent.md",
    "content": "---\nid: navigateComponent\ntitle: Navigate component\n---\n\nThe `Navigate` component is a component that can be used to navigate to a new location when rendered. This includes changes to the pathname, search params, hash, and location state. The underlying navigation will happen inside of a `useEffect` hook when successfully rendered.\n\n## Navigate props\n\nThe `Navigate` component accepts the following props:\n\n### `...options`\n\n- Type: [`NavigateOptions`](./NavigateOptionsType.md)\n\n## Navigate returns\n\n- `null`\n"
  },
  {
    "path": "docs/router/api/router/notFoundComponentComponent.md",
    "content": "---\nid: notFoundComponentComponent\ntitle: NotFoundComponent component\n---\n\nThe `NotFoundComponent` component is a component that renders when a not-found error occurs in a route.\n\n## NotFoundComponent props\n\nThe `NotFoundComponent` component accepts the following props:\n\n### `props.data` prop\n\n- Type: `unknown`\n- Optional\n- Custom data that is passed to the `notFoundComponent` when the not-found error is handled\n- This data comes from the `data` property of the `NotFoundError` object\n\n### `props.isNotFound` prop\n\n- Type: `boolean`\n- Required\n- A boolean value indicating whether the current state is a not-found error state\n- This value is always `true`\n\n### `props.routeId` prop\n\n- Type: `RouteIds<RegisteredRouter['routeTree']>`\n- Required\n- The ID of the route that is attempting to handle the not-found error\n- Must be one of the valid route IDs from the router's route tree\n\n## NotFoundComponent returns\n\n- Returns appropriate UI for not-found error situations\n- Typically includes a \"page not found\" message along with links to go home or navigate to previous pages\n"
  },
  {
    "path": "docs/router/api/router/notFoundFunction.md",
    "content": "---\nid: notFoundFunction\ntitle: notFound function\n---\n\nThe `notFound` function returns a new `NotFoundError` object that can be either returned or thrown from places like a Route's `beforeLoad` or `loader` callbacks to trigger the `notFoundComponent`.\n\n## notFound options\n\nThe `notFound` function accepts a single optional argument, the `options` to create the not-found error object.\n\n- Type: [`Partial<NotFoundError>`](./NotFoundErrorType.md)\n- Optional\n\n## notFound returns\n\n- If the `throw` property is `true` in the `options` object, the `NotFoundError` object will be thrown from within the function call.\n- If the `throw` property is `false | undefined` in the `options` object, the `NotFoundError` object will be returned.\n\n## Examples\n\n```tsx\nimport { notFound, createFileRoute, rootRouteId } from '@tanstack/react-router'\n\nconst Route = new createFileRoute('/posts/$postId')({\n  // throwing a not-found object\n  loader: ({ context: { post } }) => {\n    if (!post) {\n      throw notFound()\n    }\n  },\n  // or if you want to show a not-found on the whole page\n  loader: ({ context: { team } }) => {\n    if (!team) {\n      throw notFound({ routeId: rootRouteId })\n    }\n  },\n  // ... other route options\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/outletComponent.md",
    "content": "---\nid: outletComponent\ntitle: Outlet component\n---\n\nThe `Outlet` component is a component that can be used to render the next child route of a parent route.\n\n## Outlet props\n\nThe `Outlet` component does not accept any props.\n\n## Outlet returns\n\n- If matched, the child route match's `component`/`errorComponent`/`pendingComponent`/`notFoundComponent`.\n- If not matched, `null`.\n"
  },
  {
    "path": "docs/router/api/router/redirectFunction.md",
    "content": "---\nid: redirectFunction\ntitle: redirect function\n---\n\nThe `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.\n\n## redirect options\n\nThe `redirect` function accepts a single argument, the `options` to determine the redirect behavior.\n\n- Type: [`Redirect`](./RedirectType.md)\n- Required\n\n## redirect returns\n\n- If the `throw` property is `true` in the `options` object, the `Redirect` object will be thrown from within the function call.\n- If the `throw` property is `false | undefined` in the `options` object, the `Redirect` object will be returned.\n\n## Examples\n\n### Using the standalone `redirect` function\n\n```tsx\nimport { redirect } from '@tanstack/react-router'\n\nconst route = createRoute({\n  // throwing an internal redirect object using 'to' property\n  loader: () => {\n    if (!user) {\n      throw redirect({\n        to: '/login',\n      })\n    }\n  },\n  // throwing an external redirect object using 'href' property\n  loader: () => {\n    if (needsExternalAuth) {\n      throw redirect({\n        href: 'https://authprovider.com/login',\n      })\n    }\n  },\n  // or forcing `redirect` to throw itself\n  loader: () => {\n    if (!user) {\n      redirect({\n        to: '/login',\n        throw: true,\n      })\n    }\n  },\n  // ... other route options\n})\n```\n\n### Using Route.redirect (File-Based Routes)\n\nWhen using file-based routing with `createFileRoute`, you can use the `Route.redirect` method directly. This method automatically sets the `from` parameter based on the route's path, enabling type-safe relative redirects without manually specifying the origin route:\n\n```tsx\n// In routes/dashboard/settings.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/settings')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      // Relative redirect - automatically knows we're redirecting from '/dashboard/settings'\n      throw Route.redirect({\n        to: '../login', // Redirects to '/dashboard/login'\n      })\n    }\n  },\n  loader: () => {\n    // Also works in loader\n    if (needsMigration) {\n      throw Route.redirect({\n        to: './migrate', // Redirects to '/dashboard/settings/migrate'\n      })\n    }\n  },\n})\n```\n\n### Using getRouteApi().redirect\n\nFor accessing the redirect method outside of the route definition file, you can use `getRouteApi`:\n\n```tsx\nimport { getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/dashboard/settings')\n\n// In a beforeLoad or loader callback\nfunction checkAuth() {\n  if (!user) {\n    // Type-safe redirect with automatic 'from' parameter\n    throw routeApi.redirect({\n      to: '../login',\n    })\n  }\n}\n```\n\n### Benefits of Route-Bound Redirect\n\nUsing `Route.redirect` or `getRouteApi().redirect` instead of the standalone `redirect` function offers several advantages:\n\n1. **No need to specify `from`**: The route path is automatically used as the origin\n2. **Type-safe relative paths**: TypeScript validates that relative paths like `../sibling` or `./child` resolve to valid routes\n3. **Refactoring-friendly**: If the route path changes, the redirect origin updates automatically\n"
  },
  {
    "path": "docs/router/api/router/retainSearchParamsFunction.md",
    "content": "---\nid: retainSearchParams\ntitle: Search middleware to retain search params\n---\n\n`retainSearchParams` is a search middleware that allows to keep search params.\n\n## retainSearchParams props\n\nThe `retainSearchParams` either accepts `true` or a list of keys of those search params that shall be retained.\nIf `true` is passed in, all search params will be retained.\n\n## Examples\n\n```tsx\nimport { z } from 'zod'\nimport { createRootRoute, retainSearchParams } from '@tanstack/react-router'\n\nconst searchSchema = z.object({\n  rootValue: z.string().optional(),\n})\n\nexport const Route = createRootRoute({\n  // Use the schema directly for Zod v4\n  validateSearch: searchSchema,\n  search: {\n    middlewares: [retainSearchParams(['rootValue'])],\n  },\n})\n```\n\n```tsx\nimport { z } from 'zod'\nimport { createFileRoute, retainSearchParams } from '@tanstack/react-router'\n\nconst searchSchema = z.object({\n  one: z.string().optional(),\n  two: z.string().optional(),\n})\n\nexport const Route = createFileRoute('/')({\n  // Use the schema directly for Zod v4\n  validateSearch: searchSchema,\n  search: {\n    middlewares: [retainSearchParams(true)],\n  },\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/rootRouteWithContextFunction.md",
    "content": "---\nid: rootRouteWithContextFunction\ntitle: rootRouteWithContext function\n---\n\n> [!CAUTION]\n> This function is deprecated and will be removed in the next major version of TanStack Router.\n> Please use the [`createRootRouteWithContext`](./createRootRouteWithContextFunction.md) function instead.\n\nThe `rootRouteWithContext` function is a helper function that can be used to create a root route instance that requires a context type to be fulfilled when the router is created.\n\n## rootRouteWithContext generics\n\nThe `rootRouteWithContext` function accepts a single generic argument:\n\n### `TRouterContext` generic\n\n- Type: `TRouterContext`\n- Optional, **but recommended**.\n- The context type that will be required to be fulfilled when the router is created\n\n## rootRouteWithContext returns\n\n- A factory function that can be used to create a new [`createRootRoute`](./createRootRouteFunction.md) instance.\n- It accepts a single argument, the same as the [`createRootRoute`](./createRootRouteFunction.md) function.\n\n## Examples\n\n```tsx\nimport { rootRouteWithContext, createRouter } from '@tanstack/react-router'\nimport { QueryClient } from '@tanstack/react-query'\n\ninterface MyRouterContext {\n  queryClient: QueryClient\n}\n\nconst rootRoute = rootRouteWithContext<MyRouterContext>()({\n  component: () => <Outlet />,\n  // ... root route options\n})\n\nconst routeTree = rootRoute.addChildren([\n  // ... other routes\n])\n\nconst queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/stripSearchParamsFunction.md",
    "content": "---\nid: stripSearchParams\ntitle: Search middleware to strip search params\n---\n\n`stripSearchParams` is a search middleware that allows to remove search params.\n\n## stripSearchParams props\n\n`stripSearchParams` accepts one of the following inputs:\n\n- `true`: if the search schema has no required params, `true` can be used to strip all search params\n- a list of keys of those search params that shall be removed; only keys of optional search params are allowed.\n- an object that conforms to the partial input search schema. The search params are compared against the values of this object; if the value is deeply equal, it will be removed. This is especially useful to strip out default search params.\n\n## Examples\n\n```tsx\nimport { z } from 'zod'\nimport { createFileRoute, stripSearchParams } from '@tanstack/react-router'\n\nconst defaultValues = {\n  one: 'abc',\n  two: 'xyz',\n}\n\nconst searchSchema = z.object({\n  one: z.string().default(defaultValues.one),\n  two: z.string().default(defaultValues.two),\n})\n\nexport const Route = createFileRoute('/')({\n  // for Zod v4, use the schema directly\n  validateSearch: searchSchema,\n  search: {\n    // strip default values\n    middlewares: [stripSearchParams(defaultValues)],\n  },\n})\n```\n\n```tsx\nimport { z } from 'zod'\nimport { createRootRoute, stripSearchParams } from '@tanstack/react-router'\n\nconst searchSchema = z.object({\n  hello: z.string().default('world'),\n  requiredParam: z.string(),\n})\n\nexport const Route = createRootRoute({\n  // for Zod v4, use the schema directly\n  validateSearch: searchSchema,\n  search: {\n    // always remove `hello`\n    middlewares: [stripSearchParams(['hello'])],\n  },\n})\n```\n\n```tsx\nimport { z } from 'zod'\nimport { createFileRoute, stripSearchParams } from '@tanstack/react-router'\n\nconst searchSchema = z.object({\n  one: z.string().default('abc'),\n  two: z.string().default('xyz'),\n})\n\nexport const Route = createFileRoute('/')({\n  // for Zod v4, use the schema directly\n  validateSearch: searchSchema,\n  search: {\n    // remove all search params\n    middlewares: [stripSearchParams(true)],\n  },\n})\n```\n"
  },
  {
    "path": "docs/router/api/router/useAwaitedHook.md",
    "content": "---\nid: useAwaitedHook\ntitle: useAwaited hook\n---\n\nThe `useAwaited` method is a hook that suspends until the provided promise is resolved or rejected.\n\n## useAwaited options\n\nThe `useAwaited` hook accepts a single argument, an `options` object.\n\n### `options.promise` option\n\n- Type: `Promise<T>`\n- Required\n- The deferred promise to await.\n\n## useAwaited returns\n\n- Throws an error if the promise is rejected.\n- Suspends (throws a promise) if the promise is pending.\n- Returns the resolved value of a deferred promise if the promise is resolved.\n\n## Examples\n\n```tsx\nimport { useAwaited } from '@tanstack/react-router'\n\nfunction Component() {\n  const { deferredPromise } = route.useLoaderData()\n\n  const data = useAwaited({ promise: myDeferredPromise })\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useBlockerHook.md",
    "content": "---\nid: useBlockerHook\ntitle: useBlocker hook\n---\n\nThe `useBlocker` method is a hook that [blocks navigation](../../guide/navigation-blocking.md) when a condition is met.\n\n> ⚠️ The following new `useBlocker` API is currently _experimental_.\n\n## useBlocker options\n\nThe `useBlocker` hook accepts a single _required_ argument, an option object:\n\n### `options.shouldBlockFn` option\n\n- Required\n- Type: `ShouldBlockFn`\n- This function should return a `boolean` or a `Promise<boolean>` that tells the blocker if it should block the current navigation\n- The function has the argument of type `ShouldBlockFnArgs` passed to it, which tells you information about the current and next route and the action performed\n- Think of this function as telling the router if it should block the navigation, so returning `true` mean that it should block the navigation and `false` meaning that it should be allowed\n\n```ts\ninterface ShouldBlockFnLocation<...> {\n  routeId: TRouteId\n  fullPath: TFullPath\n  pathname: string\n  params: TAllParams\n  search: TFullSearchSchema\n}\n\ntype ShouldBlockFnArgs = {\n  current: ShouldBlockFnLocation\n  next: ShouldBlockFnLocation\n  action: HistoryAction\n}\n```\n\n### `options.disabled` option\n\n- Optional - defaults to `false`\n- Type: `boolean`\n- Specifies if the blocker should be entirely disabled or not\n\n### `options.enableBeforeUnload` option\n\n- Optional - defaults to `true`\n- Type: `boolean | (() => boolean)`\n- Tell the blocker to sometimes or always block the browser `beforeUnload` event or not\n\n### `options.withResolver` option\n\n- Optional - defaults to `false`\n- Type: `boolean`\n- Specify if the resolver returned by the hook should be used or whether your `shouldBlockFn` function itself resolves the blocking\n\n### `options.blockerFn` option (⚠️ deprecated)\n\n- Optional\n- Type: `BlockerFn`\n- The function that returns a `boolean` or `Promise<boolean>` indicating whether to allow navigation.\n\n### `options.condition` option (⚠️ deprecated)\n\n- Optional - defaults to `true`\n- Type: `boolean`\n- A navigation attempt is blocked when this condition is `true`.\n\n## useBlocker returns\n\nAn object with the controls to allow manual blocking and unblocking of navigation.\n\n- `status` - A string literal that can be either `'blocked'` or `'idle'`\n- `next` - When status is `blocked`, a type narrrowable object that contains information about the next location\n- `current` - When status is `blocked`, a type narrrowable object that contains information about the current location\n- `action` - When status is `blocked`, a `HistoryAction` string that shows the action that triggered the navigation\n- `proceed` - When status is `blocked`, a function that allows navigation to continue\n- `reset` - When status is `blocked`, a function that cancels navigation (`status` will be reset to `'idle'`)\n\nor\n\n`void` when `withResolver` is `false`\n\n## Examples\n\nTwo common use cases for the `useBlocker` hook are:\n\n### Basic usage\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  useBlocker({\n    shouldBlockFn: () => formIsDirty,\n  })\n\n  // ...\n}\n```\n\n### Custom UI\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  const { proceed, reset, status, next } = useBlocker({\n    shouldBlockFn: () => formIsDirty,\n    withResolver: true,\n  })\n\n  // ...\n\n  return (\n    <>\n      {/* ... */}\n      {status === 'blocked' && (\n        <div>\n          <p>You are navigating to {next.pathname}</p>\n          <p>Are you sure you want to leave?</p>\n          <button onClick={proceed}>Yes</button>\n          <button onClick={reset}>No</button>\n        </div>\n      )}\n    </>\n}\n```\n\n### Conditional blocking\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const { proceed, reset, status } = useBlocker({\n    shouldBlockFn: ({ next }) => {\n      return !next.pathname.includes('step/')\n    },\n    withResolver: true,\n  })\n\n  // ...\n\n  return (\n    <>\n      {/* ... */}\n      {status === 'blocked' && (\n        <div>\n          <p>Are you sure you want to leave?</p>\n          <button onClick={proceed}>Yes</button>\n          <button onClick={reset}>No</button>\n        </div>\n      )}\n    </>\n  )\n}\n```\n\n### Without resolver\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  useBlocker({\n    shouldBlockFn: ({ next }) => {\n      if (next.pathname.includes('step/')) {\n        return false\n      }\n\n      const shouldLeave = confirm('Are you sure you want to leave?')\n      return !shouldLeave\n    },\n  })\n\n  // ...\n}\n```\n\n### Type narrowing\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  // block going from editor-1 to /foo/123?hello=world\n  const { proceed, reset, status } = useBlocker({\n    shouldBlockFn: ({ current, next }) => {\n      if (\n        current.routeId === '/editor-1' &&\n        next.fullPath === '/foo/$id' &&\n        next.params.id === '123' &&\n        next.search.hello === 'world'\n      ) {\n        return true\n      }\n      return false\n    },\n    enableBeforeUnload: false,\n    withResolver: true,\n  })\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useCanGoBack.md",
    "content": "---\nid: useCanGoBack\ntitle: useCanGoBack hook\n---\n\nThe `useCanGoBack` hook returns a boolean representing if the router history can safely go back without exiting the application.\n\n> ⚠️ The following new `useCanGoBack` API is currently _experimental_.\n\n## useCanGoBack returns\n\n- If the router history is not at index `0`, `true`.\n- If the router history is at index `0`, `false`.\n\n## Limitations\n\nThe router history index is reset after a navigation with [`reloadDocument`](./NavigateOptionsType.md#reloaddocument) set as `true`. This causes the router history to consider the new location as the initial one and will cause `useCanGoBack` to return `false`.\n\n## Examples\n\n### Showing a back button\n\n```tsx\nimport { useRouter, useCanGoBack } from '@tanstack/react-router'\n\nfunction Component() {\n  const router = useRouter()\n  const canGoBack = useCanGoBack()\n\n  return (\n    <div>\n      {canGoBack ? (\n        <button onClick={() => router.history.back()}>Go back</button>\n      ) : null}\n\n      {/* ... */}\n    </div>\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useChildMatchesHook.md",
    "content": "---\nid: useChildMatchesHook\ntitle: useChildMatches hook\n---\n\nThe `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.**\n\n> [!IMPORTANT]\n> If the router has pending matches and they are showing their pending component fallbacks, pending matches are used instead of active matches.\n\n## useChildMatches options\n\nThe `useChildMatches` hook accepts a single _optional_ argument, an `options` object.\n\n### `opts.select` option\n\n- Optional\n- `(matches: RouteMatch[]) => TSelected`\n- 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.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n## useChildMatches returns\n\n- If a `select` function is provided, the return value of the `select` function.\n- If no `select` function is provided, an array of [`RouteMatch`](./RouteMatchType.md) objects.\n\n## Examples\n\n```tsx\nimport { useChildMatches } from '@tanstack/react-router'\n\nfunction Component() {\n  const childMatches = useChildMatches()\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useLinkPropsHook.md",
    "content": "---\nid: useLinkPropsHook\ntitle: useLinkProps hook\n---\n\nThe `useLinkProps` hook that takes an object as its argument and returns a `React.AnchorHTMLAttributes<HTMLAnchorElement>` props object. These props can then be safely applied to an anchor element to create a link that can be used to navigate to the new location. This includes changes to the pathname, search params, hash, and location state.\n\n## useLinkProps options\n\n```tsx\ntype UseLinkPropsOptions = ActiveLinkOptions &\n  React.AnchorHTMLAttributes<HTMLAnchorElement>\n```\n\n- [`ActiveLinkOptions`](./ActiveLinkOptionsType.md)\n- The `useLinkProps` options are used to build a [`LinkProps`](./LinkPropsType.md) object.\n- It also extends the `React.AnchorHTMLAttributes<HTMLAnchorElement>` type, so that any additional props that are passed to the `useLinkProps` hook will be merged with the [`LinkProps`](./LinkPropsType.md) object.\n\n## useLinkProps returns\n\n- A `React.AnchorHTMLAttributes<HTMLAnchorElement>` object that can be applied to an anchor element to create a link that can be used to navigate to the new location\n"
  },
  {
    "path": "docs/router/api/router/useLoaderDataHook.md",
    "content": "---\nid: useLoaderDataHook\ntitle: useLoaderData hook\n---\n\nThe `useLoaderData` hook returns the loader data from the closest [`RouteMatch`](./RouteMatchType.md) in the component tree.\n\n## useLoaderData options\n\nThe `useLoaderData` hook accepts an `options` object.\n\n### `opts.from` option\n\n- Type: `string`\n- The route id of the closest parent match\n- Optional, but recommended for full type safety.\n- If `opts.strict` is `true`, TypeScript will warn for this option if it is not provided.\n- If `opts.strict` is `false`, TypeScript will provide loosened types for the returned loader data.\n\n### `opts.strict` option\n\n- Type: `boolean`\n- Optional - `default: true`\n- If `false`, the `opts.from` option will be ignored and types will be loosened to reflect the shared types of all possible loader data.\n\n### `opts.select` option\n\n- Optional\n- `(loaderData: TLoaderData) => TSelected`\n- 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.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n## useLoaderData returns\n\n- If a `select` function is provided, the return value of the `select` function.\n- If no `select` function is provided, the loader data or a loosened version of the loader data if `opts.strict` is `false`.\n\n## Examples\n\n```tsx\nimport { useLoaderData } from '@tanstack/react-router'\n\nfunction Component() {\n  const loaderData = useLoaderData({ from: '/posts/$postId' })\n  //     ^? { postId: string, body: string, ... }\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useLoaderDepsHook.md",
    "content": "---\nid: useLoaderDepsHook\ntitle: useLoaderDeps hook\n---\n\nThe `useLoaderDeps` hook is a hook that returns an object with the dependencies that are used to trigger the `loader` for a given route.\n\n## useLoaderDepsHook options\n\nThe `useLoaderDepsHook` hook accepts an `options` object.\n\n### `opts.from` option\n\n- Type: `string`\n- Required\n- The RouteID or path to get the loader dependencies from.\n\n### `opts.select` option\n\n- Type: `(deps: TLoaderDeps) => TSelected`\n- Optional\n- If supplied, this function will be called with the loader dependencies object and the return value will be returned from `useLoaderDeps`.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n## useLoaderDeps returns\n\n- An object of the loader dependencies or `TSelected` if a `select` function is provided.\n\n## Examples\n\n```tsx\nimport { useLoaderDeps } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/posts/$postId')\n\nfunction Component() {\n  const deps = useLoaderDeps({ from: '/posts/$postId' })\n\n  // OR\n\n  const routeDeps = routeApi.useLoaderDeps()\n\n  // OR\n\n  const postId = useLoaderDeps({\n    from: '/posts',\n    select: (deps) => deps.view,\n  })\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useLocationHook.md",
    "content": "---\nid: useLocationHook\ntitle: useLocation hook\n---\n\nThe `useLocation` method is a hook that returns the current [`location`](./ParsedLocationType.md) object. This hook is useful for when you want to perform some side effect whenever the current location changes.\n\n## useLocation options\n\nThe `useLocation` hook accepts an optional `options` object.\n\n### `opts.select` option\n\n- Type: `(state: ParsedLocationType) => TSelected`\n- Optional\n- If supplied, this function will be called with the [`location`](./ParsedLocationType.md) object and the return value will be returned from `useLocation`.\n\n## useLocation returns\n\n- The current [`location`](./ParsedLocationType.md) object or `TSelected` if a `select` function is provided.\n\n## Examples\n\n```tsx\nimport { useLocation } from '@tanstack/react-router'\n\nfunction Component() {\n  const location = useLocation()\n  //    ^ ParsedLocation\n\n  // OR\n\n  const pathname = useLocation({\n    select: (location) => location.pathname,\n  })\n  //    ^ string\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useMatchHook.md",
    "content": "---\nid: useMatchHook\ntitle: useMatch hook\n---\n\nThe `useMatch` hook returns a [`RouteMatch`](./RouteMatchType.md) in the component tree. The raw route match contains all of the information about a route match in the router and also powers many other hooks under the hood like `useParams`, `useLoaderData`, `useRouteContext`, and `useSearch`.\n\n## useMatch options\n\nThe `useMatch` hook accepts a single argument, an `options` object.\n\n### `opts.from` option\n\n- Type: `string`\n- The route id of a match\n- Optional, but recommended for full type safety.\n- If `opts.strict` is `true`, `from` is required and TypeScript will warn for this option if it is not provided.\n- If `opts.strict` is `false`, `from` must not be set and TypeScript will provided loosened types for the returned [`RouteMatch`](./RouteMatchType.md).\n\n### `opts.strict` option\n\n- Type: `boolean`\n- Optional\n- `default: true`\n- If `false`, the `opts.from` must not be set and types will be loosened to `Partial<RouteMatch>` to reflect the shared types of all matches.\n\n### `opts.select` option\n\n- Optional\n- `(match: RouteMatch) => TSelected`\n- 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.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n### `opts.shouldThrow` option\n\n- Type: `boolean`\n- Optional\n- `default: true`\n- If `false`,`useMatch` 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`.\n\n## useMatch returns\n\n- If a `select` function is provided, the return value of the `select` function.\n- If no `select` function is provided, the [`RouteMatch`](./RouteMatchType.md) object or a loosened version of the `RouteMatch` object if `opts.strict` is `false`.\n\n## Examples\n\n### Accessing a route match\n\n```tsx\nimport { useMatch } from '@tanstack/react-router'\n\nfunction Component() {\n  const match = useMatch({ from: '/posts/$postId' })\n  //     ^? strict match for RouteMatch\n  // ...\n}\n```\n\n### Accessing the root route's match\n\n```tsx\nimport {\n  useMatch,\n  rootRouteId, // <<<< use this token!\n} from '@tanstack/react-router'\n\nfunction Component() {\n  const match = useMatch({ from: rootRouteId })\n  //     ^? strict match for RouteMatch\n  // ...\n}\n```\n\n### Checking if a specific route is currently rendered\n\n```tsx\nimport { useMatch } from '@tanstack/react-router'\n\nfunction Component() {\n  const match = useMatch({ from: '/posts', shouldThrow: false })\n  //     ^? RouteMatch | undefined\n  if (match !== undefined) {\n    // ...\n  }\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useMatchRouteHook.md",
    "content": "---\nid: useMatchRouteHook\ntitle: useMatchRoute hook\n---\n\nThe `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.\n\n## useMatchRoute returns\n\n- A `matchRoute` function that can be used to match a route against either the current or pending location.\n\n## matchRoute function\n\nThe `matchRoute` function is a function that can be used to match a route against either the current or pending location.\n\n### matchRoute function options\n\nThe `matchRoute` function accepts a single argument, an `options` object.\n\n- Type: [`UseMatchRouteOptions`](./UseMatchRouteOptionsType.md)\n\n### matchRoute function returns\n\n- The matched route's params or `false` if no route was matched\n\n## Examples\n\n```tsx\nimport { useMatchRoute } from '@tanstack/react-router'\n\n// Current location: /posts/123\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({ to: '/posts/$postId' })\n  //    ^ { postId: '123' }\n}\n\n// Current location: /posts/123\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({ to: '/posts' })\n  //    ^ false\n}\n\n// Current location: /posts/123\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({ to: '/posts', fuzzy: true })\n  //    ^ {}\n}\n\n// Current location: /posts\n// Pending location: /posts/123\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({ to: '/posts/$postId', pending: true })\n  //    ^ { postId: '123' }\n}\n\n// Current location: /posts/123/foo/456\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({ to: '/posts/$postId/foo/$fooId' })\n  //    ^ { postId: '123', fooId: '456' }\n}\n\n// Current location: /posts/123/foo/456\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({\n    to: '/posts/$postId/foo/$fooId',\n    params: { postId: '123' },\n  })\n  //    ^ { postId: '123', fooId: '456' }\n}\n\n// Current location: /posts/123/foo/456\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({\n    to: '/posts/$postId/foo/$fooId',\n    params: { postId: '789' },\n  })\n  //    ^ false\n}\n\n// Current location: /posts/123/foo/456\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({\n    to: '/posts/$postId/foo/$fooId',\n    params: { fooId: '456' },\n  })\n  //    ^ { postId: '123', fooId: '456' }\n}\n\n// Current location: /posts/123/foo/456\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({\n    to: '/posts/$postId/foo/$fooId',\n    params: { postId: '123', fooId: '456' },\n  })\n  //    ^ { postId: '123', fooId: '456' }\n}\n\n// Current location: /posts/123/foo/456\nfunction Component() {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute({\n    to: '/posts/$postId/foo/$fooId',\n    params: { postId: '789', fooId: '456' },\n  })\n  //    ^ false\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useMatchesHook.md",
    "content": "---\nid: useMatchesHook\ntitle: useMatches hook\n---\n\nThe `useMatches` hook returns all of the [`RouteMatch`](./RouteMatchType.md) objects from the router **regardless of its callers position in the React component tree**.\n\n> [!TIP]\n> 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.\n\n## useMatches options\n\nThe `useMatches` hook accepts a single _optional_ argument, an `options` object.\n\n### `opts.select` option\n\n- Optional\n- `(matches: RouteMatch[]) => TSelected`\n- 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.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n## useMatches returns\n\n- If a `select` function is provided, the return value of the `select` function.\n- If no `select` function is provided, an array of [`RouteMatch`](./RouteMatchType.md) objects.\n\n## Examples\n\n```tsx\nimport { useMatches } from '@tanstack/react-router'\n\nfunction Component() {\n  const matches = useMatches()\n  //     ^? [RouteMatch, RouteMatch, ...]\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useNavigateHook.md",
    "content": "---\nid: useNavigateHook\ntitle: useNavigate hook\n---\n\nThe `useNavigate` hook is a hook that returns a `navigate` function that can be used to navigate to a new location. This includes changes to the pathname, search params, hash, and location state.\n\n## useNavigate options\n\nThe `useNavigate` hook accepts a single argument, an `options` object.\n\n### `opts.from` option\n\n- Type: `string`\n- Optional\n- Description: The location to navigate from. This is useful when you want to navigate to a new location from a specific location, rather than the current location.\n\n## useNavigate returns\n\n- A `navigate` function that can be used to navigate to a new location.\n\n## navigate function\n\nThe `navigate` function is a function that can be used to navigate to a new location.\n\n### navigate function options\n\nThe `navigate` function accepts a single argument, an `options` object.\n\n- Type: [`NavigateOptions`](./NavigateOptionsType.md)\n\n### navigate function returns\n\n- A `Promise` that resolves when the navigation is complete\n\n## Examples\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction PostsPage() {\n  const navigate = useNavigate({ from: '/posts' })\n  const handleClick = () => navigate({ search: { page: 2 } })\n  // ...\n}\n\nfunction Component() {\n  const navigate = useNavigate()\n  return (\n    <div>\n      <button\n        onClick={() =>\n          navigate({\n            to: '/posts',\n          })\n        }\n      >\n        Posts\n      </button>\n      <button\n        onClick={() =>\n          navigate({\n            to: '/posts',\n            search: { page: 2 },\n          })\n        }\n      >\n        Posts (Page 2)\n      </button>\n      <button\n        onClick={() =>\n          navigate({\n            to: '/posts',\n            hash: 'my-hash',\n          })\n        }\n      >\n        Posts (Hash)\n      </button>\n      <button\n        onClick={() =>\n          navigate({\n            to: '/posts',\n            state: { from: 'home' },\n          })\n        }\n      >\n        Posts (State)\n      </button>\n    </div>\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useParamsHook.md",
    "content": "---\nid: useParamsHook\ntitle: useParams hook\n---\n\nThe `useParams` method returns all of the path parameters that were parsed for the closest match and all of its parent matches.\n\n## useParams options\n\nThe `useParams` hook accepts an optional `options` object.\n\n### `opts.strict` option\n\n- Type: `boolean`\n- Optional - `default: true`\n- If `false`, the `opts.from` option will be ignored and types will be loosened to `Partial<AllParams>` to reflect the shared types of all params.\n\n### `opts.shouldThrow` option\n\n- Type: `boolean`\n- Optional\n- `default: true`\n- If `false`,`useParams` 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`.\n\n### `opts.select` option\n\n- Optional\n- `(params: AllParams) => TSelected`\n- 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.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n## useParams returns\n\n- An object of the match's and parent match path params or `TSelected` if a `select` function is provided.\n\n## Examples\n\n```tsx\nimport { useParams } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/posts/$postId')\n\nfunction Component() {\n  const params = useParams({ from: '/posts/$postId' })\n\n  // OR\n\n  const routeParams = routeApi.useParams()\n\n  // OR\n\n  const postId = useParams({\n    from: '/posts/$postId',\n    select: (params) => params.postId,\n  })\n\n  // OR\n\n  const looseParams = useParams({ strict: false })\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useParentMatchesHook.md",
    "content": "---\nid: useParentMatchesHook\ntitle: useParentMatches hook\n---\n\nThe `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.**\n\n> [!IMPORTANT]\n> If the router has pending matches and they are showing their pending component fallbacks, pending matches are used instead of active matches.\n\n## useParentMatches options\n\nThe `useParentMatches` hook accepts an optional `options` object.\n\n### `opts.select` option\n\n- Optional\n- `(matches: RouteMatch[]) => TSelected`\n- 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.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n## useParentMatches returns\n\n- If a `select` function is provided, the return value of the `select` function.\n- If no `select` function is provided, an array of [`RouteMatch`](./RouteMatchType.md) objects.\n\n## Examples\n\n```tsx\nimport { useParentMatches } from '@tanstack/react-router'\n\nfunction Component() {\n  const parentMatches = useParentMatches()\n  //    ^ [RouteMatch, RouteMatch, ...]\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useRouteContextHook.md",
    "content": "---\nid: useRouteContextHook\ntitle: useRouteContext hook\n---\n\nThe `useRouteContext` method is a hook that returns the current context for the current route. This hook is useful for accessing the current route context in a component.\n\n## useRouteContext options\n\nThe `useRouteContext` hook accepts an `options` object.\n\n### `opts.from` option\n\n- Type: `string`\n- Required\n- The RouteID to match the route context from.\n\n### `opts.select` option\n\n- Type: `(context: RouteContext) => TSelected`\n- Optional\n- If supplied, this function will be called with the route context object and the return value will be returned from `useRouteContext`.\n\n## useRouteContext returns\n\n- The current context for the current route or `TSelected` if a `select` function is provided.\n\n## Examples\n\n```tsx\nimport { useRouteContext } from '@tanstack/react-router'\n\nfunction Component() {\n  const context = useRouteContext({ from: '/posts/$postId' })\n  //    ^ RouteContext\n\n  // OR\n\n  const selected = useRouteContext({\n    from: '/posts/$postId',\n    select: (context) => context.postId,\n  })\n  //    ^ string\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useRouterHook.md",
    "content": "---\nid: useRouterHook\ntitle: useRouter hook\n---\n\nThe `useRouter` method is a hook that returns the current instance of [`Router`](./RouterType.md) from context. This hook is useful for accessing the router instance in a component.\n\n## useRouter returns\n\n- The current [`Router`](./RouterType.md) instance.\n\n> ⚠️⚠️⚠️ **`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.**\n\n## Examples\n\n```tsx\nimport { useRouter } from '@tanstack/react-router'\n\nfunction Component() {\n  const router = useRouter()\n  //    ^ Router\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useRouterStateHook.md",
    "content": "---\nid: useRouterStateHook\ntitle: useRouterState hook\n---\n\nThe `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.\n\n> [!TIP]\n> 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.\n\n## useRouterState options\n\nThe `useRouterState` hook accepts an optional `options` object.\n\n### `opts.select` option\n\n- Type: `(state: RouterState) => TSelected`\n- Optional\n- If supplied, this function will be called with the [`RouterState`](./RouterStateType.md) object and the return value will be returned from `useRouterState`.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n## useRouterState returns\n\n- The current [`RouterState`](./RouterStateType.md) object or `TSelected` if a `select` function is provided.\n\n## Examples\n\n```tsx\nimport { useRouterState } from '@tanstack/react-router'\n\nfunction Component() {\n  const state = useRouterState()\n  //    ^ RouterState\n\n  // OR\n\n  const selected = useRouterState({\n    select: (state) => state.location,\n  })\n  //    ^ ParsedLocation\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router/useSearchHook.md",
    "content": "---\nid: useSearchHook\ntitle: useSearch hook\n---\n\nThe `useSearch` method is a hook that returns the current search query parameters as an object for the current location. This hook is useful for accessing the current search string and query parameters in a component.\n\n## useSearch options\n\nThe `useSearch` hook accepts an `options` object.\n\n### `opts.from` option\n\n- Type: `string`\n- Required\n- The RouteID to match the search query parameters from.\n\n### `opts.shouldThrow` option\n\n- Type: `boolean`\n- Optional\n- `default: true`\n- 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`.\n\n### `opts.select` option\n\n- Type: `(search: SelectedSearchSchema) => TSelected`\n- Optional\n- If supplied, this function will be called with the search object and the return value will be returned from `useSearch`.\n\n### `opts.structuralSharing` option\n\n- Type: `boolean`\n- Optional\n- Configures whether structural sharing is enabled for the value returned by `select`.\n- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information.\n\n### `opts.strict` option\n\n- Type: `boolean`\n- Optional - `default: true`\n- If `false`, the `opts.from` option will be ignored and types will be loosened to `Partial<FullSearchSchema>` to reflect the shared types of all search query parameters.\n\n## useSearch returns\n\n- If `opts.from` is provided, an object of the search query parameters for the current location or `TSelected` if a `select` function is provided.\n- If `opts.strict` is `false`, an object of the search query parameters for the current location or `TSelected` if a `select` function is provided.\n\n## Examples\n\n```tsx\nimport { useSearch } from '@tanstack/react-router'\n\nfunction Component() {\n  const search = useSearch({ from: '/posts/$postId' })\n  //    ^ FullSearchSchema\n\n  // OR\n\n  const selected = useSearch({\n    from: '/posts/$postId',\n    select: (search) => search.postView,\n  })\n  //    ^ string\n\n  // OR\n\n  const looseSearch = useSearch({ strict: false })\n  //    ^ Partial<FullSearchSchema>\n\n  // ...\n}\n```\n"
  },
  {
    "path": "docs/router/api/router.md",
    "content": "---\nid: router\ntitle: Router API\n---\n\n- Functions\n  - [`createFileRoute`](./router/createFileRouteFunction.md)\n  - [`createLazyFileRoute`](./router/createLazyFileRouteFunction.md)\n  - [`createRootRoute`](./router/createRootRouteFunction.md)\n  - [`createRootRouteWithContext`](./router/createRootRouteWithContextFunction.md)\n  - [`createRoute`](./router/createRouteFunction.md)\n  - [`createLazyRoute`](./router/createLazyRouteFunction.md)\n  - [`createRouteMask`](./router/createRouteMaskFunction.md)\n  - [`createRouter`](./router/createRouterFunction.md)\n  - [`defer`](./router/deferFunction.md)\n  - [`getRouteApi`](./router/getRouteApiFunction.md)\n  - [`isNotFound`](./router/isNotFoundFunction.md)\n  - [`isRedirect`](./router/isRedirectFunction.md)\n  - [`lazyRouteComponent`](./router/lazyRouteComponentFunction.md)\n  - [`linkOptions`](./router/linkOptions.md)\n  - [`notFound`](./router/notFoundFunction.md)\n  - [`redirect`](./router/redirectFunction.md)\n  - [`retainSearchParams`](./router/retainSearchParamsFunction.md)\n  - [`stripSearchParams`](./router/stripSearchParamsFunction.md)\n- Components\n  - [`<Await>`](./router/awaitComponent.md)\n  - [`<CatchBoundary>`](./router/catchBoundaryComponent.md)\n  - [`<CatchNotFound>`](./router/catchNotFoundComponent.md)\n  - [`<ClientOnly>`](./router/clientOnlyComponent.md)\n  - [`<DefaultGlobalNotFound>`](./router/defaultGlobalNotFoundComponent.md)\n  - [`<ErrorComponent>`](./router/errorComponentComponent.md)\n  - [`<Link>`](./router/linkComponent.md)\n  - [`<MatchRoute>`](./router/matchRouteComponent.md)\n  - [`<Navigate>`](./router/navigateComponent.md)\n  - [`<NotFoundComponent>`](./router/notFoundComponentComponent.md)\n  - [`<Outlet>`](./router/outletComponent.md)\n- Hooks\n  - [`useAwaited`](./router/useAwaitedHook.md)\n  - [`useBlocker`](./router/useBlockerHook.md)\n  - [`useCanGoBack`](./router/useCanGoBack.md)\n  - [`useChildMatches`](./router/useChildMatchesHook.md)\n  - [`useLinkProps`](./router/useLinkPropsHook.md)\n  - [`useLoaderData`](./router/useLoaderDataHook.md)\n  - [`useLoaderDeps`](./router/useLoaderDepsHook.md)\n  - [`useLocation`](./router/useLocationHook.md)\n  - [`useMatch`](./router/useMatchHook.md)\n  - [`useMatchRoute`](./router/useMatchRouteHook.md)\n  - [`useMatches`](./router/useMatchesHook.md)\n  - [`useNavigate`](./router/useNavigateHook.md)\n  - [`useParentMatches`](./router/useParentMatchesHook.md)\n  - [`useParams`](./router/useParamsHook.md)\n  - [`useRouteContext`](./router/useRouteContextHook.md)\n  - [`useRouter`](./router/useRouterHook.md)\n  - [`useRouterState`](./router/useRouterStateHook.md)\n  - [`useSearch`](./router/useSearchHook.md)\n- Types\n  - [`ActiveLinkOptions Type`](./router/ActiveLinkOptionsType.md)\n  - [`AsyncRouteComponent Type`](./router/AsyncRouteComponentType.md)\n  - [`HistoryState Interface`](./router/historyStateInterface.md)\n  - [`LinkOptions Type`](./router/LinkOptionsType.md)\n  - [`LinkProps Type`](./router/LinkPropsType.md)\n  - [`MatchRouteOptions Type`](./router/MatchRouteOptionsType.md)\n  - [`NavigateOptions Type`](./router/NavigateOptionsType.md)\n  - [`NotFoundError Type`](./router/NotFoundErrorType.md)\n  - [`ParsedHistoryState Type`](./router/ParsedHistoryStateType.md)\n  - [`ParsedLocation Type`](./router/ParsedLocationType.md)\n  - [`Redirect Type`](./router/RedirectType.md)\n  - [`Register Type`](./router/RegisterType.md)\n  - [`Route Type`](./router/RouteType.md)\n  - [`RouteApi Type`](./router/RouteApiType.md)\n  - [`RouteMask Type`](./router/RouteMaskType.md)\n  - [`RouteMatch Type`](./router/RouteMatchType.md)\n  - [`RouteOptions Type`](./router/RouteOptionsType.md)\n  - [`Router Type`](./router/RouterType.md)\n  - [`RouterEvents Type`](./router/RouterEventsType.md)\n  - [`RouterOptions Type`](./router/RouterOptionsType.md)\n  - [`RouterState Type`](./router/RouterStateType.md)\n  - [`ToMaskOptions Type`](./router/ToMaskOptionsType.md)\n  - [`ToOptions Type`](./router/ToOptionsType.md)\n  - [`UseMatchRouteOptions Type`](./router/UseMatchRouteOptionsType.md)\n  - [`ViewTransitionOptions Type`](./router/ViewTransitionOptionsType.md)\n- ⚠️ Deprecated\n  - [`FileRoute Class`](./router/FileRouteClass.md)\n  - [`Route Class`](./router/RouteClass.md)\n  - [`Router Class`](./router/RouterClass.md)\n  - [`RouteApi Class`](./router/RouteApiClass.md)\n  - [`RootRoute Class`](./router/RootRouteClass.md)\n  - [`NotFoundRoute Class`](./router/NotFoundRouteClass.md)\n  - [`rootRouteWithContext Function`](./router/rootRouteWithContextFunction.md)\n"
  },
  {
    "path": "docs/router/comparison.md",
    "content": "---\ntitle: Comparison\ntoc: false\n---\n\nChoosing a routing solution? This side‑by‑side comparison highlights key features, trade‑offs, and common use cases to help you quickly evaluate how each option fits your project’s needs.\n\nWhile we aim to provide an accurate and fair comparison, please note that this table may not capture every nuance or recent update of each library. We recommend reviewing the official documentation and trying out each solution to make the most informed decision for your specific use case.\n\nIf you find any discrepancies or have suggestions for improvement, please don't hesitate to contribute via the \"Edit this page on GitHub\" link at the bottom of this page or open an issue in the [TanStack Router GitHub repository](https://github.com/TanStack/router).\n\nFeature/Capability Key:\n\n- ✅ 1st-class, built-in, and ready to use with no added configuration or code\n- 🟡 Partial Support (on a scale of 5)\n- 🟠 Supported via addon/community package\n- 🔶 Possible, but requires custom code/implementation/casting\n- 🛑 Not officially supported\n\n<!-- ::start:framework -->\n\n# React\n\n## Comparison | TanStack Router & TanStack Start vs Next.js vs React Router / Remix\n\n|                                                | TanStack Router / Start                          | React Router DOM [_(Website)_][router]                | Next.JS [_(Website)_][nextjs]                         |\n| ---------------------------------------------- | ------------------------------------------------ | ----------------------------------------------------- | ----------------------------------------------------- |\n| Github Repo / Stars                            | [![][stars-tanstack-router]][gh-tanstack-router] | [![][stars-router]][gh-router]                        | [![][stars-nextjs]][gh-nextjs]                        |\n| Bundle Size                                    | [![][bp-tanstack-router]][bpl-tanstack-router]   | [![][bp-router]][bpl-router]                          | ❓                                                    |\n| History, Memory & Hash Routers                 | ✅                                               | ✅                                                    | 🛑                                                    |\n| Nested / Layout Routes                         | ✅                                               | ✅                                                    | 🟡                                                    |\n| Suspense-like Route Transitions                | ✅                                               | ✅                                                    | ✅                                                    |\n| Typesafe Routes                                | ✅                                               | 🟡 (1/5)                                              | 🟡                                                    |\n| Code-based Routes                              | ✅                                               | ✅                                                    | 🛑                                                    |\n| File-based Routes                              | ✅                                               | ✅                                                    | ✅                                                    |\n| Virtual/Programmatic File-based Routes         | ✅                                               | ✅                                                    | 🛑                                                    |\n| Router Loaders                                 | ✅                                               | ✅                                                    | ✅                                                    |\n| SWR Loader Caching                             | ✅                                               | 🛑                                                    | ✅                                                    |\n| Route Prefetching                              | ✅                                               | ✅                                                    | ✅                                                    |\n| Auto Route Prefetching                         | ✅                                               | ✅                                                    | ✅                                                    |\n| Route Prefetching Delay                        | ✅                                               | 🔶                                                    | 🛑                                                    |\n| Path Params                                    | ✅                                               | ✅                                                    | ✅                                                    |\n| Typesafe Path Params                           | ✅                                               | ✅                                                    | 🛑                                                    |\n| Typesafe Route Context                         | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Path Param Validation                          | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Custom Path Param Parsing/Serialization        | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Ranked Routes                                  | ✅                                               | ✅                                                    | ✅                                                    |\n| Active Link Customization                      | ✅                                               | ✅                                                    | ✅                                                    |\n| Optimistic UI                                  | ✅                                               | ✅                                                    | 🔶                                                    |\n| Typesafe Absolute + Relative Navigation        | ✅                                               | 🟡 (1/5 via `buildHref` util)                         | 🟠 (IDE plugin)                                       |\n| Route Mount/Transition/Unmount Events          | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Devtools                                       | ✅                                               | 🟠                                                    | 🛑                                                    |\n| Basic Search Params                            | ✅                                               | ✅                                                    | ✅                                                    |\n| Search Param Hooks                             | ✅                                               | ✅                                                    | ✅                                                    |\n| `<Link/>`/`useNavigate` Search Param API       | ✅                                               | 🟡 (search-string only via the `to`/`search` options) | 🟡 (search-string only via the `to`/`search` options) |\n| JSON Search Params                             | ✅                                               | 🔶                                                    | 🔶                                                    |\n| TypeSafe Search Params                         | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Search Param Schema Validation                 | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Search Param Immutability + Structural Sharing | ✅                                               | 🔶                                                    | 🛑                                                    |\n| Custom Search Param parsing/serialization      | ✅                                               | 🔶                                                    | 🛑                                                    |\n| Search Param Middleware                        | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Suspense Route Elements                        | ✅                                               | ✅                                                    | ✅                                                    |\n| Route Error Elements                           | ✅                                               | ✅                                                    | ✅                                                    |\n| Route Pending Elements                         | ✅                                               | ✅                                                    | ✅                                                    |\n| `<Block>`/`useBlocker`                         | ✅                                               | 🔶 (no hard reloads or cross-origin navigation)       | 🛑                                                    |\n| Deferred Primitives                            | ✅                                               | ✅                                                    | ✅                                                    |\n| Navigation Scroll Restoration                  | ✅                                               | ✅                                                    | ❓                                                    |\n| ElementScroll Restoration                      | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Async Scroll Restoration                       | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Router Invalidation                            | ✅                                               | ✅                                                    | ✅                                                    |\n| Runtime Route Manipulation (Fog of War)        | 🛑                                               | ✅                                                    | ✅                                                    |\n| Parallel Routes                                | 🛑                                               | 🛑                                                    | ✅                                                    |\n| --                                             | --                                               | --                                                    | --                                                    |\n| **Full Stack**                                 | --                                               | --                                                    | --                                                    |\n| SSR                                            | ✅                                               | ✅                                                    | ✅                                                    |\n| Streaming SSR                                  | ✅                                               | ✅                                                    | ✅                                                    |\n| Generic RPCs                                   | ✅                                               | 🛑                                                    | 🛑                                                    |\n| Generic RPC Middleware                         | ✅                                               | 🛑                                                    | 🛑                                                    |\n| React Server Functions                         | ✅                                               | 🛑                                                    | ✅                                                    |\n| React Server Function Middleware               | ✅                                               | 🛑                                                    | 🛑                                                    |\n| API Routes                                     | ✅                                               | ✅                                                    | ✅                                                    |\n| API Middleware                                 | ✅                                               | ✅                                                    | ✅                                                    |\n| React Server Components                        | 🛑                                               | 🟡 (Experimental)                                     | ✅                                                    |\n| `<Form>` API                                   | 🛑                                               | ✅                                                    | ✅                                                    |\n\n[bp-tanstack-router]: https://badgen.net/bundlephobia/minzip/@tanstack/react-router\n[bpl-tanstack-router]: https://bundlephobia.com/result?p=@tanstack/react-router\n[gh-tanstack-router]: https://github.com/tanstack/router\n[stars-tanstack-router]: https://img.shields.io/github/stars/tanstack/router?label=%F0%9F%8C%9F\n[_]: _\n[router]: https://github.com/remix-run/react-router\n[bp-router]: https://badgen.net/bundlephobia/minzip/react-router\n[gh-router]: https://github.com/remix-run/react-router\n[stars-router]: https://img.shields.io/github/stars/remix-run/react-router?label=%F0%9F%8C%9F\n[bpl-router]: https://bundlephobia.com/result?p=react-router\n[bpl-history]: https://bundlephobia.com/result?p=history\n[_]: _\n[nextjs]: https://nextjs.org/docs/routing/introduction\n[bp-nextjs]: https://badgen.net/bundlephobia/minzip/next.js?label=All\n[gh-nextjs]: https://github.com/vercel/next.js\n[stars-nextjs]: https://img.shields.io/github/stars/vercel/next.js?label=%F0%9F%8C%9F\n[bpl-nextjs]: https://bundlephobia.com/result?p=next\n\n# Solid\n\n---\n\nWe don't have a comparison table for Solid just yet. If you're interested in helping us create one, please reach out in the [TanStack Discord](https://tanstack.com/discord) or open a PR with your proposed comparison!\n\n<!-- ::end:framework -->\n"
  },
  {
    "path": "docs/router/config.json",
    "content": "{\n  \"$schema\": \"https://raw.githubusercontent.com/TanStack/tanstack.com/main/tanstack-docs-config.schema.json\",\n  \"docSearch\": {\n    \"appId\": \"FQ0DQ6MA3C\",\n    \"apiKey\": \"8264730bab8a9b7fa6a0c85761d7a3fe\",\n    \"indexName\": \"tanstack\"\n  },\n  \"sections\": [\n    {\n      \"label\": \"Getting Started\",\n      \"children\": [\n        {\n          \"label\": \"Overview\",\n          \"to\": \"overview\"\n        },\n        {\n          \"label\": \"Quick Start\",\n          \"to\": \"quick-start\"\n        },\n        {\n          \"label\": \"Devtools\",\n          \"to\": \"devtools\"\n        },\n        {\n          \"label\": \"Decisions on DX\",\n          \"to\": \"decisions-on-dx\"\n        },\n        {\n          \"label\": \"LLM Assistance Support\",\n          \"to\": \"llm-support\"\n        },\n        {\n          \"label\": \"Comparison\",\n          \"to\": \"comparison\"\n        },\n        {\n          \"label\": \"Frequently Asked Questions\",\n          \"to\": \"faq\"\n        }\n      ],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": []\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": []\n        }\n      ]\n    },\n    {\n      \"label\": \"Installation Guides\",\n      \"children\": [\n        {\n          \"label\": \"Manual Setup\",\n          \"to\": \"installation/manual\"\n        },\n        {\n          \"label\": \"Vite\",\n          \"to\": \"installation/with-vite\"\n        },\n        {\n          \"label\": \"Rspack/Rsbuild\",\n          \"to\": \"installation/with-rspack\"\n        },\n        {\n          \"label\": \"Webpack\",\n          \"to\": \"installation/with-webpack\"\n        },\n        {\n          \"label\": \"Esbuild\",\n          \"to\": \"installation/with-esbuild\"\n        },\n        {\n          \"label\": \"Router CLI\",\n          \"to\": \"installation/with-router-cli\"\n        }\n      ],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": [\n            {\n              \"label\": \"Migrate from React Router\",\n              \"to\": \"installation/migrate-from-react-router\"\n            },\n            {\n              \"label\": \"Migrate from React Location\",\n              \"to\": \"installation/migrate-from-react-location\"\n            }\n          ]\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": []\n        }\n      ]\n    },\n    {\n      \"label\": \"Routing\",\n      \"children\": [\n        {\n          \"label\": \"Routing Concepts\",\n          \"to\": \"routing/routing-concepts\"\n        },\n        {\n          \"label\": \"Route Trees\",\n          \"to\": \"routing/route-trees\"\n        },\n        {\n          \"label\": \"Route Matching\",\n          \"to\": \"routing/route-matching\"\n        },\n        {\n          \"label\": \"File-Based Routing\",\n          \"to\": \"routing/file-based-routing\"\n        },\n        {\n          \"label\": \"Virtual File Routes\",\n          \"to\": \"routing/virtual-file-routes\"\n        },\n        {\n          \"label\": \"Code-Based Routing\",\n          \"to\": \"routing/code-based-routing\"\n        },\n        {\n          \"label\": \"File Naming Conventions\",\n          \"to\": \"routing/file-naming-conventions\"\n        }\n      ],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": []\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": []\n        }\n      ]\n    },\n    {\n      \"label\": \"Guides\",\n      \"children\": [\n        {\n          \"label\": \"Code Splitting\",\n          \"to\": \"guide/code-splitting\"\n        },\n        {\n          \"label\": \"Automatic Code Splitting\",\n          \"to\": \"guide/automatic-code-splitting\"\n        },\n        {\n          \"label\": \"Creating a Router\",\n          \"to\": \"guide/creating-a-router\"\n        },\n        {\n          \"label\": \"Outlets\",\n          \"to\": \"guide/outlets\"\n        },\n        {\n          \"label\": \"Navigation\",\n          \"to\": \"guide/navigation\"\n        },\n        {\n          \"label\": \"Path Params\",\n          \"to\": \"guide/path-params\"\n        },\n        {\n          \"label\": \"Search Params\",\n          \"to\": \"guide/search-params\"\n        },\n        {\n          \"label\": \"Link Options\",\n          \"to\": \"guide/link-options\"\n        },\n        {\n          \"label\": \"Custom Links\",\n          \"to\": \"guide/custom-link\"\n        },\n        {\n          \"label\": \"Data Loading\",\n          \"to\": \"guide/data-loading\"\n        },\n        {\n          \"label\": \"Deferred Data Loading\",\n          \"to\": \"guide/deferred-data-loading\"\n        },\n        {\n          \"label\": \"External Data Loading\",\n          \"to\": \"guide/external-data-loading\"\n        },\n        {\n          \"label\": \"Data Mutations\",\n          \"to\": \"guide/data-mutations\"\n        },\n        {\n          \"label\": \"Type Safety\",\n          \"to\": \"guide/type-safety\"\n        },\n        {\n          \"label\": \"Type Utilities\",\n          \"to\": \"guide/type-utilities\"\n        },\n        {\n          \"label\": \"Preloading\",\n          \"to\": \"guide/preloading\"\n        },\n        {\n          \"label\": \"Document Head Management\",\n          \"to\": \"guide/document-head-management\"\n        },\n        {\n          \"label\": \"Route Masking\",\n          \"to\": \"guide/route-masking\"\n        },\n        {\n          \"label\": \"Navigation Blocking\",\n          \"to\": \"guide/navigation-blocking\"\n        },\n        {\n          \"label\": \"Custom Search Param Serialization\",\n          \"to\": \"guide/custom-search-param-serialization\"\n        },\n        {\n          \"label\": \"History Types\",\n          \"to\": \"guide/history-types\"\n        },\n        {\n          \"label\": \"Router Context\",\n          \"to\": \"guide/router-context\"\n        },\n        {\n          \"label\": \"Not Found Errors\",\n          \"to\": \"guide/not-found-errors\"\n        },\n        {\n          \"label\": \"Authenticated Routes\",\n          \"to\": \"guide/authenticated-routes\"\n        },\n        {\n          \"label\": \"Scroll Restoration\",\n          \"to\": \"guide/scroll-restoration\"\n        },\n        {\n          \"label\": \"Static Route Data\",\n          \"to\": \"guide/static-route-data\"\n        },\n        {\n          \"label\": \"SSR\",\n          \"to\": \"guide/ssr\"\n        },\n        {\n          \"label\": \"Render Optimizations\",\n          \"to\": \"guide/render-optimizations\"\n        }\n      ],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": []\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": []\n        }\n      ]\n    },\n    {\n      \"label\": \"API\",\n      \"children\": [\n        {\n          \"label\": \"Router\",\n          \"to\": \"api/router\"\n        },\n        {\n          \"label\": \"File-Based Routing\",\n          \"to\": \"api/file-based-routing\"\n        }\n      ],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": []\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": []\n        }\n      ]\n    },\n    {\n      \"label\": \"Integrations\",\n      \"children\": [\n        {\n          \"label\": \"TanStack Query\",\n          \"to\": \"integrations/query\"\n        }\n      ],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": []\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": []\n        }\n      ]\n    },\n    {\n      \"label\": \"ESLint\",\n      \"children\": [\n        {\n          \"label\": \"ESLint Plugin Router\",\n          \"to\": \"eslint/eslint-plugin-router\"\n        },\n        {\n          \"label\": \"Create Route Property Order\",\n          \"to\": \"eslint/create-route-property-order\"\n        }\n      ]\n    },\n    {\n      \"label\": \"Router Examples\",\n      \"children\": [],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": [\n            {\n              \"label\": \"Quickstart (file-based)\",\n              \"to\": \"framework/react/examples/quickstart-file-based\"\n            },\n            {\n              \"label\": \"Quickstart (code-based)\",\n              \"to\": \"framework/react/examples/quickstart\"\n            },\n            {\n              \"label\": \"Basic (file-based)\",\n              \"to\": \"framework/react/examples/basic-file-based\"\n            },\n            {\n              \"label\": \"Basic (code-based)\",\n              \"to\": \"framework/react/examples/basic\"\n            },\n            {\n              \"label\": \"Basic + React Query (file-based)\",\n              \"to\": \"framework/react/examples/basic-react-query-file-based\"\n            },\n            {\n              \"label\": \"Basic + React Query (code-based)\",\n              \"to\": \"framework/react/examples/basic-react-query\"\n            },\n            {\n              \"label\": \"Basic + SSR (file-based)\",\n              \"to\": \"framework/react/examples/basic-ssr-file-based\"\n            },\n            {\n              \"label\": \"Basic + SSR Streaming (file-based)\",\n              \"to\": \"framework/react/examples/basic-ssr-streaming-file-based\"\n            },\n            {\n              \"label\": \"Kitchen Sink (file-based)\",\n              \"to\": \"framework/react/examples/kitchen-sink-file-based\"\n            },\n            {\n              \"label\": \"Kitchen Sink (code-based)\",\n              \"to\": \"framework/react/examples/kitchen-sink\"\n            },\n            {\n              \"label\": \"Kitchen Sink + React Query (file-based)\",\n              \"to\": \"framework/react/examples/kitchen-sink-react-query-file-based\"\n            },\n            {\n              \"label\": \"Kitchen Sink + React Query (code-based)\",\n              \"to\": \"framework/react/examples/kitchen-sink-react-query\"\n            },\n            {\n              \"label\": \"Location Masking\",\n              \"to\": \"framework/react/examples/location-masking\"\n            },\n            {\n              \"label\": \"Authenticated Routes\",\n              \"to\": \"framework/react/examples/authenticated-routes\"\n            },\n            {\n              \"label\": \"Scroll Restoration\",\n              \"to\": \"framework/react/examples/scroll-restoration\"\n            },\n            {\n              \"label\": \"Deferred Data\",\n              \"to\": \"framework/react/examples/deferred-data\"\n            },\n            {\n              \"label\": \"Navigation Blocking\",\n              \"to\": \"framework/react/examples/navigation-blocking\"\n            },\n            {\n              \"label\": \"View Transitions\",\n              \"to\": \"framework/react/examples/view-transitions\"\n            },\n            {\n              \"label\": \"Framer Motion\",\n              \"to\": \"framework/react/examples/with-framer-motion\"\n            },\n            {\n              \"label\": \"With tRPC\",\n              \"to\": \"framework/react/examples/with-trpc\"\n            },\n            {\n              \"label\": \"With tRPC + React Query\",\n              \"to\": \"framework/react/examples/with-trpc-react-query\"\n            },\n            {\n              \"label\": \"Monorepo basic\",\n              \"to\": \"framework/react/examples/router-monorepo-simple\"\n            },\n            {\n              \"label\": \"Monorepo basic (with lazy loading)\",\n              \"to\": \"framework/react/examples/router-monorepo-simple-lazy\"\n            },\n            {\n              \"label\": \"Monorepo with React Query\",\n              \"to\": \"framework/react/examples/router-monorepo-react-query\"\n            }\n          ]\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": [\n            {\n              \"label\": \"Quickstart (file-based)\",\n              \"to\": \"framework/solid/examples/quickstart-file-based\"\n            },\n            {\n              \"label\": \"Quickstart (code-based)\",\n              \"to\": \"framework/solid/examples/quickstart\"\n            },\n            {\n              \"label\": \"Basic (file-based)\",\n              \"to\": \"framework/solid/examples/basic-file-based\"\n            },\n            {\n              \"label\": \"Basic + Solid Query (file-based)\",\n              \"to\": \"framework/solid/examples/basic-solid-query-file-based\"\n            },\n            {\n              \"label\": \"Basic + Solid Query (code-based)\",\n              \"to\": \"framework/solid/examples/basic-solid-query\"\n            },\n            {\n              \"label\": \"Basic + SSR (file-based)\",\n              \"to\": \"framework/solid/examples/basic-ssr-file-based\"\n            },\n            {\n              \"label\": \"Basic + SSR Streaming (file-based)\",\n              \"to\": \"framework/solid/examples/basic-ssr-streaming-file-based\"\n            },\n            {\n              \"label\": \"Kitchen Sink (code-based)\",\n              \"to\": \"framework/solid/examples/kitchen-sink\"\n            },\n            {\n              \"label\": \"Kitchen Sink (file-based)\",\n              \"to\": \"framework/solid/examples/kitchen-sink-file-based\"\n            },\n            {\n              \"label\": \"Kitchen Sink + Solid Query (file-based)\",\n              \"to\": \"framework/solid/examples/kitchen-sink-solid-query-file-based\"\n            },\n            {\n              \"label\": \"Kitchen Sink + Solid Query (code-based)\",\n              \"to\": \"framework/solid/examples/kitchen-sink-solid-query\"\n            },\n            {\n              \"label\": \"Location Masking\",\n              \"to\": \"framework/solid/examples/location-masking\"\n            },\n            {\n              \"label\": \"Authenticated Routes\",\n              \"to\": \"framework/solid/examples/authenticated-routes\"\n            },\n            {\n              \"label\": \"Scroll Restoration\",\n              \"to\": \"framework/solid/examples/scroll-restoration\"\n            },\n            {\n              \"label\": \"Deferred Data\",\n              \"to\": \"framework/solid/examples/deferred-data\"\n            },\n            {\n              \"label\": \"Navigation Blocking\",\n              \"to\": \"framework/solid/examples/navigation-blocking\"\n            },\n            {\n              \"label\": \"View Transitions\",\n              \"to\": \"framework/solid/examples/view-transitions\"\n            },\n            {\n              \"label\": \"Framer Motion\",\n              \"to\": \"framework/solid/examples/with-framer-motion\"\n            },\n            {\n              \"label\": \"With tRPC\",\n              \"to\": \"framework/solid/examples/with-trpc\"\n            },\n            {\n              \"label\": \"Monorepo basic\",\n              \"to\": \"framework/solid/examples/router-monorepo-simple\"\n            },\n            {\n              \"label\": \"Monorepo basic (with lazy loading)\",\n              \"to\": \"framework/solid/examples/router-monorepo-simple-lazy\"\n            },\n            {\n              \"label\": \"Monorepo with Solid Query\",\n              \"to\": \"framework/solid/examples/router-monorepo-solid-query\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "docs/router/decisions-on-dx.md",
    "content": "---\ntitle: Decisions on Developer Experience\n---\n\nWhen people first start using TanStack Router, they often have a lot of questions that revolve around the following themes:\n\n> Why do I have to do things this way?\n\n> Why is it done this way? and not that way?\n\n> I'm used to doing it this way, why should I change?\n\nAnd they are all valid questions. For the most part, people are used to using routing libraries that are very similar to each other. They all have a similar API, similar concepts, and similar ways of doing things.\n\nBut 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.\n\n> [!TIP]\n> 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.\n\n## TanStack Router's origin story\n\nIt'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.\n\nAnd 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.\n\n## How does TanStack Router achieve this?\n\n> TypeScript! TypeScript! TypeScript!\n\nEvery aspect of TanStack Router is designed to be as type-safe as possible, and this is achieved by leveraging TypeScript's type system to its fullest extent. This involves using some very advanced and complex types, type inference, and other features to ensure that the developer experience is as smooth as possible.\n\nBut to achieve this, we had to make some decisions that deviate from the norms in the routing world.\n\n1. [**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.\n2. [**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.\n3. [**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.\n\n> 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.\n\n## Why is the Router's configuration done this way?\n\nWhen 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.\n\nThis 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.\n\n> Can I use JSX to define my routes?\n\nUsing JSX for defining your routes is **out of the question**, as TypeScript will not be able to infer the route configuration types of your router.\n\n```tsx\n// ⛔️ This is not possible\nfunction App() {\n  return (\n    <Router>\n      <Route path=\"/posts\" component={PostsPage} />\n      <Route path=\"/posts/$postId\" component={PostIdPage} />\n      {/* ... */}\n    </Router>\n    // ^? TypeScript cannot infer the routes in this configuration\n  )\n}\n```\n\nAnd since this would mean that you'd have to manually type the `to` prop of the `<Link>` component and wouldn't catch any errors until runtime, it's not a viable option.\n\n> Maybe I could define my routes as a tree of nested objects?\n\n```tsx\n// ⛔️ This file will just keep growing and growing...\nconst router = createRouter({\n  routes: {\n    posts: {\n      component: PostsPage, // /posts\n      children: {\n        $postId: {\n          component: PostIdPage, // /posts/$postId\n        },\n      },\n    },\n    // ...\n  },\n})\n```\n\nAt first glance, this seems like a good idea. It's easy to visualize the entire route hierarchy in one go. But this approach has a couple of big downsides that make it not ideal for large applications:\n\n- **It's not very scalable**: As your application grows, the tree will grow and become harder to manage. And since it's all defined in one file, it can become very hard to maintain.\n- **It's not great for code-splitting**: You'd have to manually code-split each component and then pass it into the `component` property of the route, further complicating the route configuration with an ever-growing route configuration file.\n\nThis only gets worse as you begin to use more features of the router, such as nested context, loaders, search param validation, etc.\n\n> So, what's the best way to define my routes?\n\nWhat 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.\n\nYou can read more about [code-based routing](./routing/code-based-routing.md) to see how to define your routes in this way.\n\n> [!TIP]\n> 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.\n\n## Declaring the Router instance for type inference\n\n> Why do I have to declare the `Router`?\n\n> This declaration stuff is way too complicated for me...\n\nOnce you've constructed your routes into a tree and passed it into your Router instance (using `createRouter`) with all the generics working correctly, you then need to somehow pass this information to the rest of your application.\n\nThere were two approaches we considered for this:\n\n1. **Imports**: You could import the `Router` instance from the file where you created it and use it directly in your components.\n\n```tsx\nimport { router } from '@/src/app'\nexport const PostsIdLink = () => {\n  return (\n    <Link<typeof router> to=\"/posts/$postId\" params={{ postId: '123' }}>\n      Go to post 123\n    </Link>\n  )\n}\n```\n\nA downside to this approach is that you'd have to import the entire `Router` instance into every file where you want to use it. This can lead to increased bundle sizes and can be cumbersome to manage, and only get worse as your application grows and you use more features of the router.\n\n2. **Module declaration**: You can use TypeScript's module declaration to declare the `Router` instance as a module that can be used for type inference anywhere in your application without having to import it.\n\nYou'll do this once in your application.\n\n```tsx\n// src/app.tsx\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n```\n\nAnd then you can benefit from its auto-complete anywhere in your app without having to import it.\n\n```tsx\nexport const PostsIdLink = () => {\n  return (\n    <Link\n      to=\"/posts/$postId\"\n      // ^? TypeScript will auto-complete this for you\n      params={{ postId: '123' }} // and this too!\n    >\n      Go to post 123\n    </Link>\n  )\n}\n```\n\nWe 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.\n\n## Why is file-based routing the preferred way to define routes?\n\n> Why are the docs pushing for file-based routing?\n\n> I'm used to defining my routes in a single file, why should I change?\n\nSomething 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.\n\n> [!TIP]\n> 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).\n\nAs 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.\n\nA key difference in the set-up of a _basic_ application with TanStack Router, is that your route configurations require a function to be provided to `getParentRoute`, that returns the parent route of the current route.\n\n```tsx\nimport { createRoute } from '@tanstack/react-router'\nimport { postsRoute } from './postsRoute'\n\nexport const postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n})\n```\n\nAt this stage, this is done so the definition of `postsIndexRoute` can be aware of its location in the route tree and so that it can correctly infer the types of the `context`, `path params`, `search params` returned by the parent route. Incorrectly defining the `getParentRoute` function means that the properties of the parent route will not be correctly inferred by the child route.\n\nAs such, this is a critical part of the route configuration and a point of failure if not done correctly.\n\nBut this is only one part of setting up a basic application. TanStack Router requires all the routes (including the root route) to be stitched into a **_route-tree_** so that it may be passed into the `createRouter` function before declaring the `Router` instance on the module for type inference. This is another critical part of the route configuration and a point of failure if not done correctly.\n\n> 🤯 If this route-tree were in its own file for an application with ~40-50 routes, it can easily grow up to 700+ lines.\n\n```tsx\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postsIndexRoute, postsIdRoute]),\n])\n```\n\nThis complexity only increases as you begin to use more features of the router, such as nested context, loaders, search param validation, etc. As such, it no longer becomes feasible to define your routes in a single file. And so, users end up building their own _semi consistent_ way of defining their routes across multiple files. This can lead to inconsistencies and errors in the route configuration.\n\nFinally, comes the issue of code-splitting. As your application grows, you'll want to code-split your components to reduce the initial bundle size of your application. This can be a bit of a headache to manage when you're defining your routes in a single file or even across multiple files.\n\n```tsx\nimport { createRoute, lazyRouteComponent } from '@tanstack/react-router'\nimport { postsRoute } from './postsRoute'\n\nexport const postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n  component: lazyRouteComponent(() => import('../page-components/posts/index')),\n})\n```\n\nAll of this boilerplate, no matter how essential for providing a best-in-class type-inference experience, can be a bit overwhelming and can lead to inconsistencies and errors in the route configuration.\n\n... and this example configuration is just for rendering a single codes-split route. Imagine having to do this for 40-50 routes. Now remember that you still haven't touched the `context`, `loaders`, `search param validation`, and other features of the router 🤕.\n\n> So, why's file-based routing the preferred way?\n\nTanStack 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.\n\nThe 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:\n\n1. **Route configuration boilerplate**: It generates the boilerplate for your route configurations.\n2. **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.\n3. **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.\n\nLet's take a look at how the route configuration for the previous example would look like with file-based routing.\n\n```tsx\n// src/routes/posts/index.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: () => 'Posts index component goes here!!!',\n})\n```\n\nThat'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.\n\nAt 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.\n\nCheck 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.\n"
  },
  {
    "path": "docs/router/devtools.md",
    "content": "---\ntitle: Devtools\n---\n\n> Link, take this sword... I mean Devtools!... to help you on your way!\n\nWave your hands in the air and shout hooray because TanStack Router comes with dedicated devtools! 🥳\n\nWhen 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!\n\n## Installation\n\nThe devtools are a separate package that you need to install:\n\n<!-- ::start:tabs variant=\"package-manager\" -->\n\nreact: @tanstack/react-router-devtools\nsolid: @tanstack/solid-router-devtools\n\n<!-- ::end:tabs -->\n\n## Import the Devtools\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n```\n\n# Solid\n\n```tsx\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n```\n\n<!-- ::end:framework -->\n\n## Using Devtools in production\n\nThe Devtools, if imported as `TanStackRouterDevtools` will not be shown in production. If you want to have devtools in an environment with `process.env.NODE_ENV === 'production'`, use instead `TanStackRouterDevtoolsInProd`, which has all the same options:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/react-router-devtools'\n```\n\n# Solid\n\n```tsx\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'\n```\n\n<!-- ::end:framework -->\n\n## Using the Devtools in the root route\n\nThe 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.\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\nimport { createRootRoute, Outlet } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n## Manually passing the Router Instance\n\nIf 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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nfunction App() {\n  return (\n    <>\n      <RouterProvider router={router} />\n      <TanStackRouterDevtools router={router} />\n    </>\n  )\n}\n```\n\n# Solid\n\n```tsx\nfunction App() {\n  return (\n    <>\n      <RouterProvider router={router} />\n      <TanStackRouterDevtools router={router} />\n    </>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n## Floating Mode\n\nFloating 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.\n\nPlace the following code as high in your app as you can. The closer it is to the root of the page, the better it will work!\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nfunction App() {\n  return (\n    <>\n      <RouterProvider router={router} />\n      <TanStackRouterDevtools initialIsOpen={false} />\n    </>\n  )\n}\n```\n\n# Solid\n\n```tsx\nfunction App() {\n  return (\n    <>\n      <RouterProvider router={router} />\n      <TanStackRouterDevtools initialIsOpen={false} />\n    </>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n### Devtools Options\n\n- `router: Router`\n  - The router instance to connect to.\n- `initialIsOpen: Boolean`\n  - Set this `true` if you want the devtools to default to being open.\n- `panelProps: PropsObject`\n  - Use this to add props to the panel. For example, you can add `className`, `style` (merge and override default style), etc.\n- `closeButtonProps: PropsObject`\n  - 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.\n- `toggleButtonProps: PropsObject`\n  - 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.\n- `position?: \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\"`\n  - Defaults to `bottom-left`.\n  - The position of the TanStack Router logo to open and close the devtools panel.\n- `shadowDOMTarget?: ShadowRoot`\n  - Specifies a Shadow DOM target for the devtools.\n  - By default, devtool styles are applied to the `<head>` tag of the main document (light DOM). When a `shadowDOMTarget` is provided, styles will be applied within this Shadow DOM instead.\n- `containerElement?: string | any`\n  - Use this to render the devtools inside a different type of container element for ally purposes.\n  - Any string which corresponds to a valid intrinsic JSX element is allowed.\n  - Defaults to 'footer'.\n\n## Fixed Mode\n\nTo control the position of the devtools, import the `TanStackRouterDevtoolsPanel`:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\n```\n\n# Solid\n\n```tsx\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'\n```\n\n<!-- ::end:framework -->\n\nIt can then be attached to provided shadow DOM target:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\n<TanStackRouterDevtoolsPanel\n  shadowDOMTarget={shadowContainer}\n  router={router}\n/>\n```\n\n# Solid\n\n```tsx\n<TanStackRouterDevtoolsPanel\n  shadowDOMTarget={shadowContainer}\n  router={router}\n/>\n```\n\n<!-- ::end:framework -->\n\nClick [here](https://tanstack.com/router/latest/docs/framework/react/examples/basic-devtools-panel) to see a live example of this in StackBlitz.\n\n## Embedded Mode\n\nEmbedded Mode will embed the devtools as a regular component in your application. You can style it however you'd like after that!\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\n\nfunction App() {\n  return (\n    <>\n      <RouterProvider router={router} />\n      <TanStackRouterDevtoolsPanel\n        router={router}\n        style={styles}\n        className={className}\n      />\n    </>\n  )\n}\n```\n\n# Solid\n\n```tsx\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'\n\nfunction App() {\n  return (\n    <>\n      <RouterProvider router={router} />\n      <TanStackRouterDevtoolsPanel\n        router={router}\n        style={styles}\n        class={className}\n      />\n    </>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n### DevtoolsPanel Options\n\n- `router: Router`\n  - The router instance to connect to.\n\n<!-- ::start:framework -->\n\n# React\n\n- `style?: StyleObject`\n  - The standard React style object used to style a component with inline styles.\n- `className?: string`\n  - The standard React className property used to style a component with classes.\n\n# Solid\n\n- `style?: StyleObject`\n  - The standard Solid style object used to style a component with inline styles.\n- `class?: string`\n  - The standard Solid class property used to style a component with classes.\n\n<!-- ::end:framework -->\n\n- `isOpen?: boolean`\n  - A boolean variable indicating whether the panel is open or closed.\n- `setIsOpen?: (isOpen: boolean) => void`\n  - A function that toggles the open and close state of the panel.\n- `handleDragStart?: (e: any) => void`\n  - Handles the opening and closing the devtools panel.\n- `shadowDOMTarget?: ShadowRoot`\n  - Specifies a Shadow DOM target for the devtools.\n  - By default, devtool styles are applied to the `<head>` tag of the main document (light DOM). When a `shadowDOMTarget` is provided, styles will be applied within this Shadow DOM instead.\n"
  },
  {
    "path": "docs/router/eslint/create-route-property-order.md",
    "content": "---\nid: create-route-property-order\ntitle: Ensure correct order of inference sensitive properties for createRoute functions\n---\n\nFor the following functions, the property order of the passed in object matters due to type inference:\n\n- `createRoute`\n- `createFileRoute`\n- `createRootRoute`\n- `createRootRouteWithContext`\n\nThe correct property order is as follows\n\n- `params`, `validateSearch`\n- `loaderDeps`, `search.middlewares`, `ssr`\n- `context`\n- `beforeLoad`\n- `loader`\n- `onEnter`, `onStay`, `onLeave`, `head`, `scripts`, `headers`, `remountDeps`\n\nAll other properties are insensitive to the order as they do not depend on type inference.\n\n## Rule Details\n\nExamples of **incorrect** code for this rule:\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/path.tsx\"\n/* eslint \"@tanstack/router/create-route-property-order\": \"warn\" */\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/path')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(getQueryOptions(context.hello))\n  },\n  beforeLoad: () => ({ hello: 'world' }),\n})\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/path.tsx\"\n/* eslint \"@tanstack/router/create-route-property-order\": \"warn\" */\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/path')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(getQueryOptions(context.hello))\n  },\n  beforeLoad: () => ({ hello: 'world' }),\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\nExamples of **correct** code for this rule:\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/path.tsx\"\n/* eslint \"@tanstack/router/create-route-property-order\": \"warn\" */\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/path')({\n  beforeLoad: () => ({ hello: 'world' }),\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(getQueryOptions(context.hello))\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/path.tsx\"\n/* eslint \"@tanstack/router/create-route-property-order\": \"warn\" */\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/path')({\n  beforeLoad: () => ({ hello: 'world' }),\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(getQueryOptions(context.hello))\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n## Attributes\n\n- [x] ✅ Recommended\n- [x] 🔧 Fixable\n"
  },
  {
    "path": "docs/router/eslint/eslint-plugin-router.md",
    "content": "---\nid: eslint-plugin-router\ntitle: ESLint Plugin Router\n---\n\nTanStack Router comes with its own ESLint plugin. This plugin is used to enforce best practices and to help you avoid common mistakes.\n\n## Installation\n\nThe plugin is a separate package that you need to install:\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"dev-install\" -->\n\nreact: @tanstack/eslint-plugin-router\nsolid: @tanstack/eslint-plugin-router\n\n<!-- ::end:tabs -->\n\n## Flat Config (`eslint.config.js`)\n\nThe release of ESLint 9.0 introduced a new way to configure ESLint using a flat config format. This new format is more flexible and allows you to configure ESLint in a more granular way than the legacy `.eslintrc` format. The TanStack Router ESLint Plugin supports this new format and provides a recommended config that you can use to enable all of the recommended rules for the plugin\n.\n\n### Recommended Flat Config setup\n\nTo enable all of the recommended rules for our plugin, add the following config:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```js title=\"eslint.config.js\"\nimport pluginRouter from '@tanstack/eslint-plugin-router'\n\nexport default [\n  ...pluginRouter.configs['flat/recommended'],\n  // Any other config...\n]\n```\n\n<!-- ::end:tabs -->\n\n### Custom Flat Config setup\n\nAlternatively, you can load the plugin and configure only the rules you want to use:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```js title=\"eslint.config.js\"\nimport pluginRouter from '@tanstack/eslint-plugin-router'\n\nexport default [\n  {\n    plugins: {\n      '@tanstack/router': pluginRouter,\n    },\n    rules: {\n      '@tanstack/router/create-route-property-order': 'error',\n    },\n  },\n  // Any other config...\n]\n```\n\n<!-- ::end:tabs -->\n\n## Legacy Config (`.eslintrc`)\n\nPrior to the ESLint 9.0 release, the most common way of configuring EsLint was using a `.eslintrc` file. The TanStack Router ESLint Plugin still supports this configuration method.\n\n### Recommended Legacy Config setup\n\nTo enable all of the recommended rules for our plugin, add `plugin:@tanstack/eslint-plugin-router/recommended` in extends:\n\n```json\n{\n  \"extends\": [\"plugin:@tanstack/eslint-plugin-router/recommended\"]\n}\n```\n\n### Custom Legacy Config setup\n\nAlternatively, add `@tanstack/eslint-plugin-router` to the plugins section, and configure the rules you want to use:\n\n```json\n{\n  \"plugins\": [\"@tanstack/eslint-plugin-router\"],\n  \"rules\": {\n    \"@tanstack/router/create-route-property-order\": \"error\"\n  }\n}\n```\n\n## Rules\n\nThe following rules are available in the TanStack Router ESLint Plugin:\n\n- [@tanstack/router/create-route-property-order](./create-route-property-order.md)\n\n## Conflicts with other ESLint plugins\n\nIf you have other ESLint plugins installed, they may rules that conflict with this plugin. If so, you'll need to make some tweaks to allow these plugins to work together.\n\n### `typescript-eslint`\n\nThe [`@typescript-eslint/only-throw-error`](https://typescript-eslint.io/rules/only-throw-error/) rule, enabled by default in the `recommended-type-checked` and `strict-type-checked` rulesets, disallows the throwing of non-Error values as exceptions, which is considered a good practice.\n\nTo ensure it does not conflict with TanStack Router, you should allow `redirect` and `notFound` as throwable objects.\n\n```json\n{\n  \"rules\": {\n    \"@typescript-eslint/only-throw-error\": [\n      \"error\",\n      {\n        \"allow\": [\n          {\n            \"from\": \"package\",\n            \"package\": \"@tanstack/router-core\",\n            \"name\": \"Redirect\"\n          },\n          {\n            \"from\": \"package\",\n            \"package\": \"@tanstack/router-core\",\n            \"name\": \"NotFoundError\"\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n"
  },
  {
    "path": "docs/router/faq.md",
    "content": "---\ntitle: Frequently Asked Questions\n---\n\nWelcome to the TanStack Router FAQ! Here you'll find answers to common questions about the TanStack Router. If you have a question that isn't answered here, please feel free to ask in the [TanStack Discord](https://tlinz.com/discord).\n\n## Why should you choose TanStack Router over another router?\n\nTo answer this question, it's important to view the other options in the space. There are many alternatives to choose from, but only a couple that are widely adopted and actively maintained:\n\n- **Next.js** - Widely regarded as the leading framework for starting new React projects. Its design focuses on performance, development workflows, and cutting-edge technology. The framework's APIs and abstractions, while powerful, can sometimes present as non-standard. Rapid growth and industry adoption have resulted in a feature-rich experience, sometimes leading to a steeper learning curve and increased overhead.\n- **Remix / React Router** - Based on the historically successful React Router, Remix delivers a powerful developer and user experience. Its API and architectural vision are firmly rooted in web standards such as Request/Response, with an emphasis on adaptability across various JavaScript environments. Many of its APIs and abstractions are well-designed and have influenced more than a few of TanStack Router's APIs. However, its rigid design, the integration of type safety as an add-on, and sometimes strict adherence to platform APIs can present limitations for some developers.\n\nThese frameworks and routers have their strengths, but they also come with trade-offs that may not align with every project's needs. TanStack Router aims to strike a balance by offering routing APIs designed to improve the developer experience without sacrificing flexibility or performance.\n\n## Is TanStack Router a framework?\n\nTanStack 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 Vite.\nFor a deeper dive on the history of TanStack Router, feel free to read [TanStack Router's History](./decisions-on-dx.md#tanstack-routers-origin-story).\n\n## Should I commit my `routeTree.gen.ts` file into git?\n\nYes! Although the route tree file (i.e., `routeTree.gen.ts`) is generated by TanStack Router, it is essentially part of your application’s runtime, not a build artifact. The route tree file is a critical part of your application’s source code, and it is used by TanStack Router to build your application’s routes at runtime.\n\nYou should commit this file into git so that other developers can use it to build your application.\n\n## Can I conditionally render the Root Route component?\n\nNo, the root route is always rendered as it is the entry point of your application.\nIf you need to conditionally render a route's component, this usually means that the page content needs to be different based on some condition (e.g. user authentication). For this use case, you should use a [Layout Route](./routing/routing-concepts.md#layout-routes) or a [Pathless Layout Route](./routing/routing-concepts.md#pathless-layout-routes) to conditionally render the content.\n\nYou can restrict access to these routes using a conditional check in the `beforeLoad` function of the route.\n\n<details>\n<summary>What does this look like?</summary>\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\n// src/routes/_pathless-layout.tsx\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport { isAuthenticated } from '../utils/auth'\n\nexport const Route = createFileRoute('/_pathless-layout', {\n  beforeLoad: async () => {\n    // Check if the user is authenticated\n    const authed = await isAuthenticated()\n    if (!authed) {\n      // Redirect the user to the login page\n      return '/login'\n    }\n  },\n  component: PathlessLayoutRouteComponent,\n  // ...\n})\n\nfunction PathlessLayoutRouteComponent() {\n  return (\n    <div>\n      <h1>You are authed</h1>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx\n// src/routes/_pathless-layout.tsx\nimport { createFileRoute, Outlet } from '@tanstack/solid-router'\nimport { isAuthenticated } from '../utils/auth'\n\nexport const Route = createFileRoute('/_pathless-layout', {\n  beforeLoad: async () => {\n    // Check if the user is authenticated\n    const authed = await isAuthenticated()\n    if (!authed) {\n      // Redirect the user to the login page\n      return '/login'\n    }\n  },\n  component: PathlessLayoutRouteComponent,\n  // ...\n})\n\nfunction PathlessLayoutRouteComponent() {\n  return (\n    <div>\n      <h1>You are authed</h1>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n</details>\n"
  },
  {
    "path": "docs/router/guide/authenticated-routes.md",
    "content": "---\nid: authenticated-routes\ntitle: Authenticated Routes\n---\n\nAuthentication 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.\n\n## The `route.beforeLoad` Option\n\nThe `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.\n\nThe `beforeLoad` function runs in relative order to these other route loading functions:\n\n- Route Matching (Top-Down)\n  - `route.params.parse`\n  - `route.validateSearch`\n- Route Loading (including Preloading)\n  - **`route.beforeLoad`**\n  - `route.onError`\n- Route Loading (Parallel)\n  - `route.component.preload?`\n  - `route.load`\n\n**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.\n\n**If you throw an error in `beforeLoad`, none of its children will attempt to load**.\n\n## Redirecting\n\nWhile not required, some authentication flows require redirecting to a login page. To do this, you can **throw a `redirect()`** from `beforeLoad`:\n\n```tsx\n// src/routes/_authenticated.tsx\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: async ({ location }) => {\n    if (!isAuthenticated()) {\n      throw redirect({\n        to: '/login',\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n  },\n})\n```\n\n> [!TIP]\n> 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.\n\n### Handling Auth Check Failures\n\nIf your authentication check can throw errors (network failures, token validation, etc.), wrap it in try/catch:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createFileRoute, redirect, isRedirect } from '@tanstack/react-router'\n\n// src/routes/_authenticated.tsx\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: async ({ location }) => {\n    try {\n      const user = await verifySession() // might throw on network error\n      if (!user) {\n        throw redirect({\n          to: '/login',\n          search: { redirect: location.href },\n        })\n      }\n      return { user }\n    } catch (error) {\n      // Re-throw redirects (they're intentional, not errors)\n      if (isRedirect(error)) throw error\n\n      // Auth check failed (network error, etc.) - redirect to login\n      throw redirect({\n        to: '/login',\n        search: { redirect: location.href },\n      })\n    }\n  },\n})\n```\n\n# Solid\n\n```tsx\nimport { createFileRoute, redirect, isRedirect } from '@tanstack/solid-router'\n\n// src/routes/_authenticated.tsx\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: async ({ location }) => {\n    try {\n      const user = await verifySession() // might throw on network error\n      if (!user) {\n        throw redirect({\n          to: '/login',\n          search: { redirect: location.href },\n        })\n      }\n      return { user }\n    } catch (error) {\n      // Re-throw redirects (they're intentional, not errors)\n      if (isRedirect(error)) throw error\n\n      // Auth check failed (network error, etc.) - redirect to login\n      throw redirect({\n        to: '/login',\n        search: { redirect: location.href },\n      })\n    }\n  },\n})\n```\n\n<!-- ::end:framework -->\n\nThe [`isRedirect()`](../api/router/isRedirectFunction.md) helper distinguishes between actual errors and intentional redirects.\n\nOnce 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`:\n\n```tsx\nrouter.history.push(search.redirect)\n```\n\n## Non-Redirected Authentication\n\nSome 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 `<Outlet />` that would normally render the child routes:\n\n```tsx\n// src/routes/_authenticated.tsx\nexport const Route = createFileRoute('/_authenticated')({\n  component: () => {\n    if (!isAuthenticated()) {\n      return <Login />\n    }\n\n    return <Outlet />\n  },\n})\n```\n\nThis 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 `<Outlet />` and the child routes will be rendered.\n\n## Authentication using React context/hooks\n\nIf 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.\n\n> [!IMPORTANT]\n> 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 `<RouterProvider />` and then pass the returned value down to TanStack Router.\n\nWe'll cover the `router.context` options in-detail in the [Router Context](./router-context.md) section.\n\nHere'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](https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes).\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\nimport { createRootRouteWithContext } from '@tanstack/react-router'\n\ninterface MyRouterContext {\n  // The ReturnType of your useAuth hook or the value of your AuthContext\n  auth: AuthState\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => <Outlet />,\n})\n```\n\n```tsx title=\"src/router.tsx\"\nimport { createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\n\nexport const router = createRouter({\n  routeTree,\n  context: {\n    // auth will initially be undefined\n    // We'll be passing down the auth state from within a React component\n    auth: undefined!,\n  },\n})\n```\n\n```tsx title=\"src/App.tsx\"\nimport { RouterProvider } from '@tanstack/react-router'\n\nimport { AuthProvider, useAuth } from './auth'\n\nimport { router } from './router'\n\nfunction InnerApp() {\n  const auth = useAuth()\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthProvider>\n      <InnerApp />\n    </AuthProvider>\n  )\n}\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\nimport { createRootRouteWithContext } from '@tanstack/solid-router'\n\ninterface MyRouterContext {\n  // The ReturnType of your useAuth hook or the value of your AuthContext\n  auth: AuthState\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => <Outlet />,\n})\n```\n\n```tsx title=\"src/router.tsx\"\nimport { createRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\n\nexport const router = createRouter({\n  routeTree,\n  context: {\n    // auth will initially be undefined\n    // We'll be passing down the auth state from within a React component\n    auth: undefined!,\n  },\n})\n```\n\n```tsx title=\"src/App.tsx\"\nimport { RouterProvider } from '@tanstack/solid-router'\n\nimport { AuthProvider, useAuth } from './auth'\n\nimport { router } from './router'\n\nfunction InnerApp() {\n  const auth = useAuth()\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthProvider>\n      <InnerApp />\n    </AuthProvider>\n  )\n}\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\nThen 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.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/dashboard.route.tsx\"\nimport { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({\n        to: '/login',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n  },\n})\n```\n\n# Solid\n\n```tsx title=\"src/routes/dashboard.route.tsx\"\nimport { createFileRoute, redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated()) {\n      throw redirect({\n        to: '/login',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n  },\n})\n```\n\n<!-- ::end:framework -->\n\nYou can _optionally_, also use the [Non-Redirected Authentication](#non-redirected-authentication) approach to show a login form instead of calling a **redirect**.\n\nThis approach can also be used in conjunction with Pathless or Layout Route to protect all routes under their parent route.\n\n## Related How-To Guides\n\nFor detailed, step-by-step implementation guides, see:\n\n- [How to Set Up Basic Authentication](../how-to/setup-authentication.md) - Complete setup with React Context and protected routes\n- [How to Integrate Authentication Providers](../how-to/setup-auth-providers.md) - Use Auth0, Clerk, or Supabase\n- [How to Set Up Role-Based Access Control](../how-to/setup-rbac.md) - Implement permissions and role-based routing\n\n## Examples\n\nWorking authentication examples are available in the repository:\n\n- [Basic Authentication Example](https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes) - Simple authentication with context\n- [Firebase Authentication](https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes-firebase) - Firebase Auth integration\n- [TanStack Start Auth Examples](https://github.com/TanStack/router/tree/main/examples/react) - Various auth implementations with TanStack Start\n"
  },
  {
    "path": "docs/router/guide/automatic-code-splitting.md",
    "content": "---\ntitle: Automatic Code Splitting\n---\n\nThe automatic code splitting feature in TanStack Router allows you to optimize your application's bundle size by lazily loading route components and their associated data. This is particularly useful for large applications where you want to minimize the initial load time by only loading the necessary code for the current route.\n\nTo turn this feature on, simply set the `autoCodeSplitting` option to `true` in your bundler plugin configuration. This enables the router to automatically handle code splitting for your routes without requiring any additional setup.\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true, // Enable automatic code splitting\n    }),\n  ],\n})\n```\n\nBut that's just the beginning! TanStack Router's automatic code splitting is not only easy to enable, but it also provides powerful customization options to tailor how your routes are split into chunks. This allows you to optimize your application's performance based on your specific needs and usage patterns.\n\n## How does it work?\n\nTanStack Router's automatic code splitting works by transforming your route files both during 'development' and at 'build' time. It rewrites the route definitions to use lazy-loading wrappers for components and loaders, which allows the bundler to group these properties into separate chunks.\n\n> [!TIP]\n> A **chunk** is a file that contains a portion of your application's code, which can be loaded on demand. This helps reduce the initial load time of your application by only loading the code that is needed for the current route.\n\nSo when your application loads, it doesn't include all the code for every route. Instead, it only includes the code for the routes that are initially needed. As users navigate through your application, additional chunks are loaded on demand.\n\nThis happens seamlessly, without requiring you to manually split your code or manage lazy loading. The TanStack Router bundler plugin takes care of everything, ensuring that your routes are optimized for performance right out of the box.\n\n### The transformation process\n\nWhen you enable automatic code splitting, the bundler plugin does this by using static code analysis look at your the code in your route files to transform them into optimized outputs.\n\nThis transformation process produces two key outputs when each of your route files are processed:\n\n1. **Reference File**: The bundler plugin takes your original route file (e.g., `posts.route.tsx`) and modifies the values for properties like `component` or `pendingComponent` to use special lazy-loading wrappers that'll fetch the actual code later. These wrappers point to a \"virtual\" file that the bundler will resolve later on.\n2. **Virtual File**: When the bundler sees a request for one of these virtual files (e.g., `posts.route.tsx?tsr-split=component`), it intercepts it to generate a new, minimal on-the-fly file that _only_ contains the code for the requested properties (e.g., just the `PostsComponent`).\n\nThis process ensures that your original code remains clean and readable, while the actual bundled output is optimized for initial bundle size.\n\n### What gets code split?\n\nThe decision of what to split into separate chunks is crucial for optimizing your application's performance. TanStack Router uses a concept called \"**Split Groupings**\" to determine how different parts of your route should be bundled together.\n\nSplit groupings are arrays of properties that tell TanStack Router how to bundle different parts of your route together. Each grouping is an list of property names that you want to bundle together into a single lazy-loaded chunk.\n\nThe available properties to split are:\n\n- `component`\n- `errorComponent`\n- `pendingComponent`\n- `notFoundComponent`\n- `loader`\n\nBy default, TanStack Router uses the following split groupings:\n\n```sh\n[\n  ['component'],\n  ['errorComponent'],\n  ['notFoundComponent']\n]\n```\n\nThis means that it creates three separate lazy-loaded chunks for each route. Resulting in:\n\n- One for the main component\n- One for the error component\n- And one for the not-found component.\n\n### Rules of Splitting\n\nFor automatic code splitting to work, there are some rules in-place to make sure that this process can reliably and predictably happen.\n\n#### Do not export route properties\n\nRoute properties like `component`, `loader`, etc., should not be exported from the route file. Exporting these properties results in them being bundled into the main application bundle, which means that they will not be code-split.\n\n```tsx\nexport const Route = createRoute('/posts')({\n  // ...\n  notFoundComponent: PostsNotFoundComponent,\n})\n\n// ❌ Do NOT do this!\n// Exporting the notFoundComponent will prevent it from being code-split\n// and will be included in the main bundle.\nexport function PostsNotFoundComponent() {\n  // ❌\n  // ...\n}\n\nfunction PostsNotFoundComponent() {\n  // ✅\n  // ...\n}\n```\n\n**That's it!** There are no other restrictions. You can use any other JavaScript or TypeScript features in your route files as you normally would. If you run into any issues, please [open an issue](https://github.com/tanstack/router/issues) on GitHub.\n\n## Granular control\n\nFor most applications, the default behavior of using `autoCodeSplitting: true` is sufficient. However, TanStack Router provides several options to customize how your routes are split into chunks, allowing you to optimize for specific use cases or performance needs.\n\n### Global code splitting behavior (`defaultBehavior`)\n\nYou can change how TanStack Router splits your routes by changing the `defaultBehavior` option in your bundler plugin configuration. This allows you to define how different properties of your routes should be bundled together.\n\nFor example, to bundle all UI-related components into a single chunk, you could configure it like this:\n\n```ts title=\"vite.config.ts\"\nimport { defineConfig } from 'vite'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true,\n      codeSplittingOptions: {\n        defaultBehavior: [\n          [\n            'component',\n            'pendingComponent',\n            'errorComponent',\n            'notFoundComponent',\n          ], // Bundle all UI components together\n        ],\n      },\n    }),\n  ],\n})\n```\n\n### Advanced programmatic control (`splitBehavior`)\n\nFor complex rulesets, you can use the `splitBehavior` function in your vite config to programmatically define how routes should be split into chunks based on their `routeId`. This function allows you to implement custom logic for grouping properties together, giving you fine-grained control over the code splitting behavior.\n\n```ts title=\"vite.config.ts\"\nimport { defineConfig } from 'vite'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true,\n      codeSplittingOptions: {\n        splitBehavior: ({ routeId }) => {\n          // For all routes under /posts, bundle the loader and component together\n          if (routeId.startsWith('/posts')) {\n            return [['loader', 'component']]\n          }\n          // All other routes will use the `defaultBehavior`\n        },\n      },\n    }),\n  ],\n})\n```\n\n### Per-route overrides (`codeSplitGroupings`)\n\nFor ultimate control, you can override the global configuration directly inside a route file by adding a `codeSplitGroupings` property. This is useful for routes that have unique optimization needs.\n\n```tsx title=\"src/routes/posts.route.tsx\"\nimport { loadPostsData } from './-heavy-posts-utils'\n\nexport const Route = createFileRoute('/posts')({\n  // For this specific route, bundle the loader and component together.\n  codeSplitGroupings: [['loader', 'component']],\n  loader: () => loadPostsData(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  // ...\n}\n```\n\nThis will create a single chunk that includes both the `loader` and the `component` for this specific route, overriding both the default behavior and any programmatic split behavior defined in your bundler config.\n\n### Configuration order matters\n\nThis guide has so far describe three different ways to configure how TanStack Router splits your routes into chunks.\n\nTo make sure that the different configurations do not conflict with each other, TanStack Router uses the following order of precedence:\n\n1. **Per-route overrides**: The `codeSplitGroupings` property inside a route file takes the highest precedence. This allows you to define specific split groupings for individual routes.\n2. **Programmatic split behavior**: The `splitBehavior` function in your bundler config allows you to define custom logic for how routes should be split based on their `routeId`.\n3. **Default behavior**: The `defaultBehavior` option in your bundler config serves as the fallback for any routes that do not have specific overrides or custom logic defined. This is the base configuration that applies to all routes unless overridden.\n\n### Splitting the Data Loader\n\nThe `loader` function is responsible for fetching data needed by the route. By default, it is bundled with into your \"reference file\" and loaded in the initial bundle. However, you can also split the `loader` into its own chunk if you want to optimize further.\n\n> [!CAUTION]\n> Moving the `loader` into its own chunk is a **performance trade-off**. It introduces an additional trip to the server before the data can be fetched, which can lead to slower initial page loads. This is because the `loader` **must** be fetched and executed before the route can render its component.\n> Therefore, we recommend keeping the `loader` in the initial bundle unless you have a specific reason to split it.\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true,\n      codeSplittingOptions: {\n        defaultBehavior: [\n          ['loader'], // The loader will be in its own chunk\n          ['component'],\n          // ... other component groupings\n        ],\n      },\n    }),\n  ],\n})\n```\n\nWe highly discourage splitting the `loader` unless you have a specific use case that requires it. In most cases, not splitting off the `loader` and keep it in the main bundle is the best choice for performance.\n"
  },
  {
    "path": "docs/router/guide/code-splitting.md",
    "content": "---\ntitle: Code Splitting\n---\n\nCode splitting and lazy loading is a powerful technique for improving the bundle size and load performance of an application.\n\n- Reduces the amount of code that needs to be loaded on initial page load\n- Code is loaded on-demand when it is needed\n- Results in more chunks that are smaller in size that can be cached more easily by the browser.\n\n## How does TanStack Router split code?\n\nTanStack Router separates code into two categories:\n\n- **Critical Route Configuration** - The code that is required to render the current route and kick off the data loading process as early as possible.\n  - Path Parsing/Serialization\n  - Search Param Validation\n  - Loaders, Before Load\n  - Route Context\n  - Static Data\n  - Links\n  - Scripts\n  - Styles\n  - All other route configuration not listed below\n\n- **Non-Critical/Lazy Route Configuration** - The code that is not required to match the route, and can be loaded on-demand.\n  - Route Component\n  - Error Component\n  - Pending Component\n  - Not-found Component\n\n> 🧠 **Why is the loader not split?**\n>\n> - The loader is already an asynchronous boundary, so you pay double to both get the chunk _and_ wait for the loader to execute.\n> - Categorically, it is less likely to contribute to a large bundle size than a component.\n> - 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.\n>\n>   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.\n\n## Encapsulating a route's files into a directory\n\nSince 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.\n\nTo 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.\n\nFor 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`.\n\n**Before**\n\n- `posts.tsx`\n\n**After**\n\n- `posts`\n  - `route.tsx`\n\n## Approaches to code splitting\n\nTanStack Router supports multiple approaches to code splitting. If you are using code-based routing, skip to the [Code-Based Splitting](#code-based-splitting) section.\n\nWhen you are using file-based routing, you can use the following approaches to code splitting:\n\n- [Using automatic code-splitting ✨](#using-automatic-code-splitting)\n- [Using the `.lazy.tsx` suffix](#using-the-lazytsx-suffix)\n- [Using Virtual Routes](#using-virtual-routes)\n\n## Using automatic code-splitting✨\n\nThis is the easiest and most powerful way to code split your route files.\n\nWhen using the `autoCodeSplitting` feature, TanStack Router will automatically code split your route files based on the non-critical route configuration mentioned above.\n\n> [!IMPORTANT]\n> The automatic code-splitting feature is **ONLY** available when you are using file-based routing with one of our [supported bundlers](../routing/file-based-routing.md#getting-started-with-file-based-routing).\n> This will **NOT** work if you are **only** using the CLI (`@tanstack/router-cli`).\n\nTo enable automatic code-splitting, you just need to add the following to the configuration of your TanStack Router Bundler Plugin:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      // ...\n      autoCodeSplitting: true,\n    }),\n    react(), // Make sure to add this plugin after the TanStack Router Bundler plugin\n  ],\n})\n```\n\nThat's it! TanStack Router will automatically code-split all your route files by their critical and non-critical route configurations.\n\nIf you want more control over the code-splitting process, head over to the [Automatic Code Splitting](./automatic-code-splitting.md) guide to learn more about the options available.\n\n## Using the `.lazy.tsx` suffix\n\nIf you are not able to use the automatic code-splitting feature, you can still code-split your route files using the `.lazy.tsx` suffix. It is **as easy as moving your code into a separate file with a `.lazy.tsx` suffix** and using the `createLazyFileRoute` function instead of `createFileRoute`.\n\n> [!IMPORTANT]\n> The `__root.tsx` route file, using either `createRootRoute` or `createRootRouteWithContext`, does not support code splitting, since it's always rendered regardless of the current route.\n\nThese are the only options that `createLazyFileRoute` supports:\n\n| Export Name         | Description                                                           |\n| ------------------- | --------------------------------------------------------------------- |\n| `component`         | The component to render for the route.                                |\n| `errorComponent`    | The component to render when an error occurs while loading the route. |\n| `pendingComponent`  | The component to render while the route is loading.                   |\n| `notFoundComponent` | The component to render if a not-found error gets thrown.             |\n\n### Example code splitting with `.lazy.tsx`\n\nWhen you are using `.lazy.tsx` you can split your route into two files to enable code splitting:\n\n**Before (Single File)**\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from './api'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: Posts,\n})\n\nfunction Posts() {\n  // ...\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from './api'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: Posts,\n})\n\nfunction Posts() {\n  // ...\n}\n```\n\n<!-- ::end:framework -->\n\n**After (Split into two files)**\n\nThis file would contain the critical route configuration:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from './api'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n})\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from './api'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n})\n```\n\n<!-- ::end:framework -->\n\nWith the non-critical route configuration going into the file with the `.lazy.tsx` suffix:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.lazy.tsx\"\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: Posts,\n})\n\nfunction Posts() {\n  // ...\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.lazy.tsx\"\nimport { createLazyFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: Posts,\n})\n\nfunction Posts() {\n  // ...\n}\n```\n\n<!-- ::end:framework -->\n\n## Using Virtual Routes\n\nYou 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.\n\n**Before (Virtual Routes)**\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  // Hello?\n})\n```\n\n```tsx title=\"src/routes/posts.lazy.tsx\"\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: Posts,\n})\n\nfunction Posts() {\n  // ...\n}\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts')({\n  // Hello?\n})\n```\n\n```tsx title=\"src/routes/posts.lazy.tsx\"\nimport { createLazyFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: Posts,\n})\n\nfunction Posts() {\n  // ...\n}\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n**After (Virtual Routes)**\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.lazy.tsx\"\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: Posts,\n})\n\nfunction Posts() {\n  // ...\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.lazy.tsx\"\nimport { createLazyFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: Posts,\n})\n\nfunction Posts() {\n  // ...\n}\n```\n\n<!-- ::end:framework -->\n\nTada! 🎉\n\n## Code-Based Splitting\n\nIf you are using code-based routing, you can still code-split your routes using the `Route.lazy()` method and the `createLazyRoute` function. You'll need to split your route configuration into two parts:\n\nCreate a lazy route using the `createLazyRoute` function.\n\n```tsx title=\"src/posts.lazy.tsx\"\nexport const Route = createLazyRoute('/posts')({\n  component: MyComponent,\n})\n\nfunction MyComponent() {\n  return <div>My Component</div>\n}\n```\n\nThen, 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.\n\n```tsx title=\"src/app.tsx\"\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/posts',\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n```\n\n## Data Loader Splitting\n\n**Be warned!!!** Splitting a route loader is a dangerous game.\n\nIt can be a powerful tool to reduce bundle size, but it comes with a cost as mentioned in the [How does TanStack Router split code?](#how-does-tanstack-router-split-code) section.\n\nYou 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 you most of the way there:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { lazyFn } from '@tanstack/react-router'\n\nconst route = createRoute({\n  path: '/my-route',\n  component: MyComponent,\n  loader: lazyFn(() => import('./loader'), 'loader'),\n})\n\n// In another file...a\nexport const loader = async (context: LoaderContext) => {\n  /// ...\n}\n```\n\n# Solid\n\n```tsx\nimport { lazyFn } from '@tanstack/solid-router'\n\nconst route = createRoute({\n  path: '/my-route',\n  component: MyComponent,\n  loader: lazyFn(() => import('./loader'), 'loader'),\n})\n\n// In another file...a\nexport const loader = async (context: LoaderContext) => {\n  /// ...\n}\n```\n\n<!-- ::end:framework -->\n\nIf you are using file-based routing, you'll only be able to split your `loader` if you are using [Automatic Code Splitting](#using-automatic-code-splitting) with customized bundling options.\n\n## Manually accessing Route APIs in other files with the `getRouteApi` helper\n\nAs 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.\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/my-route.tsx\"\nimport { createRoute } from '@tanstack/react-router'\nimport { MyComponent } from './MyComponent'\n\nconst route = createRoute({\n  path: '/my-route',\n  loader: () => ({\n    foo: 'bar',\n  }),\n  component: MyComponent,\n})\n```\n\n```tsx title=\"src/MyComponent.tsx\"\nimport { getRouteApi } from '@tanstack/react-router'\n\nconst route = getRouteApi('/my-route')\n\nexport function MyComponent() {\n  const loaderData = route.useLoaderData()\n  //    ^? { foo: string }\n\n  return <div>...</div>\n}\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/my-route.tsx\"\nimport { createRoute } from '@tanstack/solid-router'\nimport { MyComponent } from './MyComponent'\n\nconst route = createRoute({\n  path: '/my-route',\n  loader: () => ({\n    foo: 'bar',\n  }),\n  component: MyComponent,\n})\n```\n\n```tsx title=\"src/MyComponent.tsx\"\nimport { getRouteApi } from '@tanstack/solid-router'\n\nconst route = getRouteApi('/my-route')\n\nexport function MyComponent() {\n  const loaderData = route.useLoaderData()\n  //    ^? { foo: string }\n\n  return <div>...</div>\n}\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\nThe `getRouteApi` function is useful for accessing other type-safe APIs:\n\n- `useLoaderData`\n- `useLoaderDeps`\n- `useMatch`\n- `useParams`\n- `useRouteContext`\n- `useSearch`\n"
  },
  {
    "path": "docs/router/guide/creating-a-router.md",
    "content": "---\ntitle: Creating a Router\n---\n\n## The `createRouter` function\n\nWhen 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.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/router.tsx\"\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  // ...\n})\n```\n\n# Solid\n\n```tsx title=\"src/router.tsx\"\nimport { createRouter } from '@tanstack/solid-router'\n\nconst router = createRouter({\n  // ...\n})\n```\n\n<!-- ::end:framework -->\n\n## Route Tree\n\nYou'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.\n\nWhether you used [file-based routing](../routing/file-based-routing.md) or [code-based routing](../routing/code-based-routing.md), you'll need to pass your route tree to the `createRouter` function:\n\n### Filesystem Route Tree\n\nIf 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.\n\n```tsx\nimport { routeTree } from './routeTree.gen'\n```\n\n### Code-Based Route Tree\n\nIf you used code-based routing, then you likely created your route tree manually using the root route's `addChildren` method:\n\n```tsx\nconst routeTree = rootRoute.addChildren([\n  // ...\n])\n```\n\n## Router Type Safety\n\n> [!IMPORTANT]\n> DO NOT SKIP THIS SECTION! ⚠️\n\nTanStack 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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/router.tsx\"\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    // This infers the type of our router and registers it across your entire project\n    router: typeof router\n  }\n}\n```\n\n# Solid\n\n```tsx title=\"src/router.tsx\"\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    // This infers the type of our router and registers it across your entire project\n    router: typeof router\n  }\n}\n```\n\n<!-- ::end:framework -->\n\nWith your router registered, you'll now get type-safety across your entire project for anything related to routing.\n\n## 404 Not Found Route\n\nAs 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.\n\nIf you are using either file-based or code-based routing, then you'll need to add a `notFoundComponent` key to `createRootRoute`:\n\n```tsx\nexport const Route = createRootRoute({\n  component: () => (\n    // ...\n  ),\n  notFoundComponent: () => <div>404 Not Found</div>,\n});\n```\n\n## Other Options\n\nThere 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).\n"
  },
  {
    "path": "docs/router/guide/custom-link.md",
    "content": "---\ntitle: Custom Link\n---\n\nWhile repeating yourself can be acceptable in many situations, you might find that you do it too often. At times, you may want to create cross-cutting components with additional behavior or styles. You might also consider using third-party libraries in combination with TanStack Router's type safety.\n\n## `createLink` for cross-cutting concerns\n\n`createLink` creates a custom `Link` component with the same type parameters as `Link`. This means you can create your own component which provides the same type safety and typescript performance as `Link`.\n\n### Basic example\n\nIf you want to create a basic custom link component, you can do so with the following:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport * as React from 'react'\nimport { createLink, LinkComponent } from '@tanstack/react-router'\n\ninterface BasicLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n  // Add any additional props you want to pass to the anchor element\n}\n\nconst BasicLinkComponent = React.forwardRef<HTMLAnchorElement, BasicLinkProps>(\n  (props, ref) => {\n    return (\n      <a ref={ref} {...props} className={'block px-3 py-2 text-blue-700'} />\n    )\n  },\n)\n\nconst CreatedLinkComponent = createLink(BasicLinkComponent)\n\nexport const CustomLink: LinkComponent<typeof BasicLinkComponent> = (props) => {\n  return <CreatedLinkComponent preload={'intent'} {...props} />\n}\n```\n\n# Solid\n\n```tsx\nimport * as Solid from 'solid-js'\nimport { createLink, LinkComponent } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\ntype BasicLinkProps = Solid.JSX.IntrinsicElements['a'] & {\n  // Add any additional props you want to pass to the anchor element\n}\n\nconst BasicLinkComponent: Solid.Component<BasicLinkProps> = (props) => (\n  <a {...props} class=\"block px-3 py-2 text-red-700\">\n    {props.children}\n  </a>\n)\n\nconst CreatedLinkComponent = createLink(BasicLinkComponent)\n\nexport const CustomLink: LinkComponent<typeof BasicLinkComponent> = (props) => {\n  return <CreatedLinkComponent preload={'intent'} {...props} />\n}\n```\n\n<!-- ::end:framework -->\n\nYou can then use your newly created `Link` component as any other `Link`\n\n```tsx\n<CustomLink to={'/dashboard/invoices/$invoiceId'} params={{ invoiceId: 0 }} />\n```\n\n## `createLink` with third party libraries\n\nHere are some examples of how you can use `createLink` with third-party libraries.\n\n<!-- ::start:framework -->\n\n# React\n\n### React Aria Components example\n\nReact Aria Components v1.11.0 and later works with TanStack Router's `preload (intent)` prop. Use `createLink` to wrap each React Aria component that you use as a link.\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"RACLink.tsx\"\nimport { createLink } from '@tanstack/react-router'\nimport { Link as RACLink, MenuItem } from 'react-aria-components'\n\nexport const Link = createLink(RACLink)\nexport const MenuItemLink = createLink(MenuItem)\n```\n\n```tsx title=\"CustomRACLink.tsx\"\nimport { createLink } from '@tanstack/react-router'\nimport { Link as RACLink, type LinkProps } from 'react-aria-components'\n\ninterface MyLinkProps extends LinkProps {\n  // your props\n}\n\nfunction MyLink(props: MyLinkProps) {\n  return (\n    <RACLink\n      {...props}\n      style={({ isHovered }) => ({\n        color: isHovered ? 'red' : 'blue',\n      })}\n    />\n  )\n}\n\nexport const Link = createLink(MyLink)\n```\n\n<!-- ::end:tabs -->\n\nTo use React Aria's render props, including the `className`, `style`, and `children` functions, create a wrapper component and pass that to `createLink`.\n\n<!-- ::end:framework -->\n\n<!-- ::start:framework -->\n\n# React\n\n### Chakra UI example\n\n```tsx title=\"ChakraLinkComponent.tsx\"\nimport * as React from 'react'\nimport { createLink, LinkComponent } from '@tanstack/react-router'\nimport { Link } from '@chakra-ui/react'\n\ninterface ChakraLinkProps extends Omit<\n  React.ComponentPropsWithoutRef<typeof Link>,\n  'href'\n> {\n  // Add any additional props you want to pass to the link\n}\n\nconst ChakraLinkComponent = React.forwardRef<\n  HTMLAnchorElement,\n  ChakraLinkProps\n>((props, ref) => {\n  return <Link ref={ref} {...props} />\n})\n\nconst CreatedLinkComponent = createLink(ChakraLinkComponent)\n\nexport const CustomLink: LinkComponent<typeof ChakraLinkComponent> = (\n  props,\n) => {\n  return (\n    <CreatedLinkComponent\n      textDecoration={'underline'}\n      _hover={{ textDecoration: 'none' }}\n      _focus={{ textDecoration: 'none' }}\n      preload={'intent'}\n      {...props}\n    />\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n<!-- ::start:framework -->\n\n# React\n\n### MUI example\n\nThere is an [example](https://github.com/TanStack/router/tree/main/examples/react/start-material-ui) available which uses these patterns.\n\n#### `Link`\n\nIf the MUI `Link` should simply behave like the router `Link`, it can be just wrapped with `createLink`:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"CustomLink.tsx\"\nimport { createLink } from '@tanstack/react-router'\nimport { Link } from '@mui/material'\n\nexport const CustomLink = createLink(Link)\n```\n\n<!-- ::end:tabs -->\n\nIf the `Link` should be customized this approach can be used:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"CustomLink.tsx\"\nimport React from 'react'\nimport { createLink } from '@tanstack/react-router'\nimport { Link } from '@mui/material'\nimport type { LinkProps } from '@mui/material'\nimport type { LinkComponent } from '@tanstack/react-router'\n\ninterface MUILinkProps extends LinkProps {\n  // Add any additional props you want to pass to the Link\n}\n\nconst MUILinkComponent = React.forwardRef<HTMLAnchorElement, MUILinkProps>(\n  (props, ref) => <Link ref={ref} {...props} />,\n)\n\nconst CreatedLinkComponent = createLink(MUILinkComponent)\n\nexport const CustomLink: LinkComponent<typeof MUILinkComponent> = (props) => {\n  return <CreatedLinkComponent preload={'intent'} {...props} />\n}\n\n// Can also be styled\n```\n\n<!-- ::end:tabs -->\n\n#### `Button`\n\nIf a `Button` should be used as a router `Link`, the `component` should be set as `a`:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"CustomButtonLink.tsx\"\nimport React from 'react'\nimport { createLink } from '@tanstack/react-router'\nimport { Button } from '@mui/material'\nimport type { ButtonProps } from '@mui/material'\nimport type { LinkComponent } from '@tanstack/react-router'\n\ninterface MUIButtonLinkProps extends ButtonProps<'a'> {\n  // Add any additional props you want to pass to the Button\n}\n\nconst MUIButtonLinkComponent = React.forwardRef<\n  HTMLAnchorElement,\n  MUIButtonLinkProps\n>((props, ref) => <Button ref={ref} component=\"a\" {...props} />)\n\nconst CreatedButtonLinkComponent = createLink(MUIButtonLinkComponent)\n\nexport const CustomButtonLink: LinkComponent<typeof MUIButtonLinkComponent> = (\n  props,\n) => {\n  return <CreatedButtonLinkComponent preload={'intent'} {...props} />\n}\n```\n\n<!-- ::end:tabs -->\n\n#### Usage with `styled`\n\nAny of these MUI approaches can then be used with `styled`:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"StyledCustomLink.tsx\"\nimport { css, styled } from '@mui/material'\nimport { CustomLink } from './CustomLink'\n\nconst StyledCustomLink = styled(CustomLink)(\n  ({ theme }) => css`\n    color: ${theme.palette.common.white};\n  `,\n)\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n<!-- ::start:framework -->\n\n# React\n\n### Mantine example\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"CustomLink.tsx\"\nimport * as React from 'react'\nimport { createLink, LinkComponent } from '@tanstack/react-router'\nimport { Anchor, AnchorProps } from '@mantine/core'\n\ninterface MantineAnchorProps extends Omit<AnchorProps, 'href'> {\n  // Add any additional props you want to pass to the anchor\n}\n\nconst MantineLinkComponent = React.forwardRef<\n  HTMLAnchorElement,\n  MantineAnchorProps\n>((props, ref) => {\n  return <Anchor ref={ref} {...props} />\n})\n\nconst CreatedLinkComponent = createLink(MantineLinkComponent)\n\nexport const CustomLink: LinkComponent<typeof MantineLinkComponent> = (\n  props,\n) => {\n  return <CreatedLinkComponent preload=\"intent\" {...props} />\n}\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n<!-- ::start:framework -->\n\n# Solid\n\n### Some Library example\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"UntitledLink.tsx\"\n// TODO: Add this example.\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n"
  },
  {
    "path": "docs/router/guide/custom-search-param-serialization.md",
    "content": "---\ntitle: Custom Search Param Serialization\n---\n\nBy 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.\n\nFor instance, using the default configuration, if you have the following search object:\n\n```tsx\nconst search = {\n  page: 1,\n  sort: 'asc',\n  filters: { author: 'tanner', min_words: 800 },\n}\n```\n\nIt would be serialized and escaped into the following search string:\n\n```txt\n?page=1&sort=asc&filters=%7B%22author%22%3A%22tanner%22%2C%22min_words%22%3A800%7D\n```\n\nWe can implement the default behavior with the following code:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport {\n  createRouter,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/react-router'\n\nconst router = createRouter({\n  // ...\n  parseSearch: parseSearchWith(JSON.parse),\n  stringifySearch: stringifySearchWith(JSON.stringify),\n})\n```\n\n# Solid\n\n```tsx\nimport {\n  createRouter,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/solid-router'\n\nconst router = createRouter({\n  // ...\n  parseSearch: parseSearchWith(JSON.parse),\n  stringifySearch: stringifySearchWith(JSON.stringify),\n})\n```\n\n<!-- ::end:framework -->\n\nHowever, 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/).\n\nThis 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.\n\n> [!TIP]\n> 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.\n\n![Diagram showing idempotent nature of URL search param serialization and deserialization](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/search-serialization-deserialization-idempotency.jpg)\n\nHere are some examples of how you can customize the search param serialization in TanStack Router:\n\n## Using Base64\n\nIt'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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport {\n  Router,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/react-router'\n\nconst router = createRouter({\n  parseSearch: parseSearchWith((value) => JSON.parse(decodeFromBinary(value))),\n  stringifySearch: stringifySearchWith((value) =>\n    encodeToBinary(JSON.stringify(value)),\n  ),\n})\n\nfunction decodeFromBinary(str: string): string {\n  return decodeURIComponent(\n    Array.prototype.map\n      .call(atob(str), function (c) {\n        return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)\n      })\n      .join(''),\n  )\n}\n\nfunction encodeToBinary(str: string): string {\n  return btoa(\n    encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {\n      return String.fromCharCode(parseInt(p1, 16))\n    }),\n  )\n}\n```\n\n# Solid\n\n```tsx\nimport {\n  Router,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/solid-router'\n\nconst router = createRouter({\n  parseSearch: parseSearchWith((value) => JSON.parse(decodeFromBinary(value))),\n  stringifySearch: stringifySearchWith((value) =>\n    encodeToBinary(JSON.stringify(value)),\n  ),\n})\n\nfunction decodeFromBinary(str: string): string {\n  return decodeURIComponent(\n    Array.prototype.map\n      .call(atob(str), function (c) {\n        return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)\n      })\n      .join(''),\n  )\n}\n\nfunction encodeToBinary(str: string): string {\n  return btoa(\n    encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {\n      return String.fromCharCode(parseInt(p1, 16))\n    }),\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n> [⚠️ Why does this snippet not use atob/btoa?](#safe-binary-encodingdecoding)\n\nSo, if we were to turn the previous object into a search string using this configuration, it would look like this:\n\n```txt\n?page=1&sort=asc&filters=eyJhdXRob3IiOiJ0YW5uZXIiLCJtaW5fd29yZHMiOjgwMH0%3D\n```\n\n> [!WARNING]\n> If you are serializing user input into Base64, you run the risk of causing a collision with the URL deserialization. This can lead to unexpected behavior, such as the URL not being parsed correctly or being interpreted as a different value. To avoid this, you should encode the search params using a safe binary encoding/decoding method (see below).\n\n## Using the query-string library\n\nThe [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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\nimport qs from 'query-string'\n\nconst router = createRouter({\n  // ...\n  stringifySearch: stringifySearchWith((value) =>\n    qs.stringify(value, {\n      // ...options\n    }),\n  ),\n  parseSearch: parseSearchWith((value) =>\n    qs.parse(value, {\n      // ...options\n    }),\n  ),\n})\n```\n\n# Solid\n\n```tsx\nimport { createRouter } from '@tanstack/solid-router'\nimport qs from 'query-string'\n\nconst router = createRouter({\n  // ...\n  stringifySearch: stringifySearchWith((value) =>\n    qs.stringify(value, {\n      // ...options\n    }),\n  ),\n  parseSearch: parseSearchWith((value) =>\n    qs.parse(value, {\n      // ...options\n    }),\n  ),\n})\n```\n\n<!-- ::end:framework -->\n\nSo, if we were to turn the previous object into a search string using this configuration, it would look like this:\n\n```txt\n?page=1&sort=asc&filters=author%3Dtanner%26min_words%3D800\n```\n\n## Using the JSURL2 library\n\n[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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport {\n  Router,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/react-router'\nimport { parse, stringify } from 'jsurl2'\n\nconst router = createRouter({\n  // ...\n  parseSearch: parseSearchWith(parse),\n  stringifySearch: stringifySearchWith(stringify),\n})\n```\n\n# Solid\n\n```tsx\nimport {\n  Router,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/solid-router'\nimport { parse, stringify } from 'jsurl2'\n\nconst router = createRouter({\n  // ...\n  parseSearch: parseSearchWith(parse),\n  stringifySearch: stringifySearchWith(stringify),\n})\n```\n\n<!-- ::end:framework -->\n\nSo, if we were to turn the previous object into a search string using this configuration, it would look like this:\n\n```txt\n?page=1&sort=asc&filters=(author~tanner~min*_words~800)~\n```\n\n## Using the Zipson library\n\n[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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport {\n  Router,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/react-router'\nimport { stringify, parse } from 'zipson'\n\nconst router = createRouter({\n  parseSearch: parseSearchWith((value) => parse(decodeFromBinary(value))),\n  stringifySearch: stringifySearchWith((value) =>\n    encodeToBinary(stringify(value)),\n  ),\n})\n\nfunction decodeFromBinary(str: string): string {\n  return decodeURIComponent(\n    Array.prototype.map\n      .call(atob(str), function (c) {\n        return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)\n      })\n      .join(''),\n  )\n}\n\nfunction encodeToBinary(str: string): string {\n  return btoa(\n    encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {\n      return String.fromCharCode(parseInt(p1, 16))\n    }),\n  )\n}\n```\n\n# Solid\n\n```tsx\nimport {\n  Router,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/solid-router'\nimport { stringify, parse } from 'zipson'\n\nconst router = createRouter({\n  parseSearch: parseSearchWith((value) => parse(decodeFromBinary(value))),\n  stringifySearch: stringifySearchWith((value) =>\n    encodeToBinary(stringify(value)),\n  ),\n})\n\nfunction decodeFromBinary(str: string): string {\n  return decodeURIComponent(\n    Array.prototype.map\n      .call(atob(str), function (c) {\n        return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)\n      })\n      .join(''),\n  )\n}\n\nfunction encodeToBinary(str: string): string {\n  return btoa(\n    encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {\n      return String.fromCharCode(parseInt(p1, 16))\n    }),\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n> [⚠️ Why does this snippet not use atob/btoa?](#safe-binary-encodingdecoding)\n\nSo, if we were to turn the previous object into a search string using this configuration, it would look like this:\n\n```txt\n?page=1&sort=asc&filters=JTdCJUMyJUE4YXV0aG9yJUMyJUE4JUMyJUE4dGFubmVyJUMyJUE4JUMyJUE4bWluX3dvcmRzJUMyJUE4JUMyJUEyQ3UlN0Q%3D\n```\n\n<hr>\n\n## Safe Binary Encoding/Decoding\n\nIn 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:\n\nTo encode from a string to a binary string:\n\n```ts\nexport function encodeToBinary(str: string): string {\n  return btoa(\n    encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {\n      return String.fromCharCode(parseInt(p1, 16))\n    }),\n  )\n}\n```\n\nTo decode from a binary string to a string:\n\n```ts\nexport function decodeFromBinary(str: string): string {\n  return decodeURIComponent(\n    Array.prototype.map\n      .call(atob(str), function (c) {\n        return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)\n      })\n      .join(''),\n  )\n}\n```\n"
  },
  {
    "path": "docs/router/guide/data-loading.md",
    "content": "---\nid: data-loading\ntitle: Data Loading\n---\n\nData 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.\n\nYou 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 it to render as quickly as possible as it fetches via suspense.\n\nBeyond 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.\n\n## The route loading lifecycle\n\nEvery time a URL/history update is detected, the router executes the following sequence:\n\n- Route Matching (Top-Down)\n  - `route.params.parse`\n  - `route.validateSearch`\n- Route Pre-Loading (Serial)\n  - `route.beforeLoad`\n  - `route.onError`\n    - `route.errorComponent` / `parentRoute.errorComponent` / `router.defaultErrorComponent`\n- Route Loading (Parallel)\n  - `route.component.preload?`\n  - `route.loader`\n    - `route.pendingComponent` (Optional)\n    - `route.component`\n  - `route.onError`\n    - `route.errorComponent` / `parentRoute.errorComponent` / `router.defaultErrorComponent`\n\n## To Router Cache or not to Router Cache?\n\nThere 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:\n\nTanStack Router Cache Pros:\n\n- Built-in, easy to use, no extra dependencies\n- Handles deduping, preloading, loading, stale-while-revalidate, background refetching on a per-route basis\n- Coarse invalidation (invalidate all routes and cache at once)\n- Automatic garbage collection\n- Works great for apps that share little data between routes\n- \"Just works\" for SSR\n\nTanStack Router Cache Cons:\n\n- No persistence adapters/model\n- No shared caching/deduping between routes\n- No built-in mutation APIs (a basic `useMutation` hook is provided in many examples that may be sufficient for many use cases)\n- 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)\n\n> [!TIP]\n> 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.\n\n## Using the Router Cache\n\nThe router cache is built-in and is as easy as returning data from any route's `loader` function. Let's learn how!\n\n## Route `loader`s\n\nRoute `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 the two supported `loader` forms:\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n})\n```\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: {\n    handler: () => fetchPosts(),\n  },\n})\n```\n\nUse the object form when you want to configure loader-specific behavior such as `staleReloadMode`.\n\n## `loader` Parameters\n\nThe `loader` function receives a single object with the following properties:\n\n- `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.\n- `cause` - The cause of the current route match. Can be either one of the following:\n  - `enter` - When the route is matched and loaded after not being matched in the previous location.\n  - `preload` - When the route is being preloaded.\n  - `stay` - When the route is matched and loaded after being matched in the previous location.\n- `context` - The route's context object, which is a merged union of:\n  - Parent route context\n  - This route's context as provided by the `beforeLoad` option\n- `deps` - The object value returned from the `Route.loaderDeps` function. If `Route.loaderDeps` is not defined, an empty object will be provided instead.\n- `location` - The current location\n- `params` - The route's path params\n- `parentMatchPromise` - `Promise<RouteMatch>` (`undefined` for the root route)\n- `preload` - Boolean which is `true` when the route is being preloaded instead of loaded\n- `route` - The route itself\n\nUsing 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.\n\n## Consuming data from `loader`s\n\nTo consume data from a `loader`, use the `useLoaderData` hook defined on your Route object.\n\n```tsx\nconst posts = Route.useLoaderData()\n```\n\nIf you don't have ready access to your route object (i.e. you're deep in the component tree for the current route), you can use `getRouteApi` to access the same hook (as well as the other hooks on the Route object). This should be preferred over importing the Route object, which is likely to create circular dependencies.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { getRouteApi } from '@tanstack/react-router'\n\n// in your component\n\nconst routeApi = getRouteApi('/posts')\nconst data = routeApi.useLoaderData()\n```\n\n# Solid\n\n```tsx\nimport { getRouteApi } from '@tanstack/solid-router'\n\n// in your component\n\nconst routeApi = getRouteApi('/posts')\nconst data = routeApi.useLoaderData()\n```\n\n<!-- ::end:framework -->\n\n## Dependency-based Stale-While-Revalidate Caching\n\nTanStack Router provides a built-in Stale-While-Revalidate caching layer for route loaders that is keyed on the dependencies of a route:\n\n- The route's fully parsed pathname\n  - e.g. `/posts/1` vs `/posts/2`\n- Any additional dependencies provided by the `loaderDeps` option\n  - e.g. `loaderDeps: ({ search: { pageIndex, pageSize } }) => ({ pageIndex, pageSize })`\n\nUsing 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.\n\n### Key options\n\nTo 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:\n\n- `routeOptions.loaderDeps`\n  - 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.\n- `routeOptions.staleTime`\n- `routerOptions.defaultStaleTime`\n  - The number of milliseconds that a route's data should be considered fresh when attempting to load.\n- `routeOptions.preloadStaleTime`\n- `routerOptions.defaultPreloadStaleTime`\n  - The number of milliseconds that a route's data should be considered fresh attempting to preload.\n- `routeOptions.gcTime`\n- `routerOptions.defaultGcTime`\n  - The number of milliseconds that a route's data should be kept in the cache before being garbage collected.\n- `routeOptions.shouldReload`\n  - 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.\n- `routeOptions.loader.staleReloadMode`\n- `routerOptions.defaultStaleReloadMode`\n  - Controls what happens when a matched route already has stale successful data. Use `'background'` for stale-while-revalidate, or `'blocking'` to wait for the stale loader reload to finish before continuing.\n\n### ⚠️ Some Important Defaults\n\n- By default, the `staleTime` is set to `0`, meaning that the route's data is immediately considered stale. Stale matches are reloaded in the background when the route is entered again, when its loader key changes (path params used by the route or `loaderDeps`), or when `router.load()` is called explicitly.\n- 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.**\n- 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.\n- By default, `staleReloadMode` is `'background'`, so stale successful matches keep rendering with their existing `loaderData` while the loader revalidates in the background.\n- `router.invalidate()` will force all active routes to reload their loaders immediately and mark every cached route's data as stale.\n\n### Using `loaderDeps` to access search params\n\nImagine 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!\n\nOnce we have these deps in place, the route will always reload when the deps change.\n\n```tsx\n// /routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loaderDeps: ({ search: { offset, limit } }) => ({ offset, limit }),\n  loader: ({ deps: { offset, limit } }) =>\n    fetchPosts({\n      offset,\n      limit,\n    }),\n})\n```\n\n> [!WARNING]\n> **Only include dependencies you actually use in the loader.**\n>\n> A common mistake is returning the entire `search` object:\n>\n> ```tsx\n> // ❌ Don't do this - causes unnecessary cache invalidation\n> loaderDeps: ({ search }) => search,\n> loader: ({ deps }) => fetchPosts({ page: deps.page }), // only uses page!\n> ```\n>\n> This causes the route to reload whenever ANY search param changes, even params not used in the loader (like `viewMode` or `sortDirection`). Instead, extract only what you need:\n>\n> ```tsx\n> // ✅ Do this - only reload when used params change\n> loaderDeps: ({ search }) => ({\n>   page: search.page,\n>   limit: search.limit,\n> }),\n> loader: ({ deps }) => fetchPosts(deps),\n> ```\n\n### Using `staleTime` to control how long data is considered fresh\n\nBy 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. When a stale route is entered again, its loader key changes, or `router.load()` is called explicitly, the route will reload in the background.\n\n**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:\n\n```tsx\n// /routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  // Consider the route's data fresh for 10 seconds\n  staleTime: 10_000,\n})\n```\n\nBy 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**.\n\n## Choosing background vs blocking stale reloads\n\nBy default, stale successful matches use stale-while-revalidate behavior. That means the router can render with the existing `loaderData` immediately and then refresh it in the background.\n\nIf you want a specific loader to wait for a stale reload to finish before continuing, use the object form and set `staleReloadMode: 'blocking'`:\n\n```tsx\n// /routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: {\n    handler: () => fetchPosts(),\n    staleReloadMode: 'blocking',\n  },\n})\n```\n\nYou can also change the default for the entire router:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  defaultStaleReloadMode: 'blocking',\n})\n```\n\nUse `'background'` when showing stale data during revalidation is acceptable. Use `'blocking'` when you want stale matches to behave more like a fresh load and wait for the new loader result.\n\n## Turning off automatic stale reloads\n\nTo disable automatic stale reloads for a route, set the `staleTime` option to `Infinity`:\n\n```tsx\n// /routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  staleTime: Infinity,\n})\n```\n\nYou can even turn this off for all routes by setting the `defaultStaleTime` option on the router:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  defaultStaleTime: Infinity,\n})\n```\n\nThis differs from `staleReloadMode: 'blocking'`:\n\n- `staleTime: Infinity` prevents the route from becoming stale in the first place\n- `staleReloadMode: 'blocking'` still allows stale reloads, but waits for them instead of doing them in the background\n\n## Using `shouldReload` and `gcTime` to opt-out of caching\n\nSimilar 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.\n\n```tsx\n// /routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loaderDeps: ({ search: { offset, limit } }) => ({ offset, limit }),\n  loader: ({ deps }) => fetchPosts(deps),\n  // Do not cache this route's data after it's unloaded\n  gcTime: 0,\n  // Only reload the route when the user navigates to it or when deps change\n  shouldReload: false,\n})\n```\n\n### Opting out of caching while still preloading\n\nEven 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.\n\nTo opt out of preloading, don't turn it on via the `routerOptions.defaultPreload` or `routeOptions.preload` options.\n\n## Passing all loader events to an external cache\n\nWe 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`:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  defaultPreloadStaleTime: 0,\n})\n```\n\nThis 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.\n\n## Using Router Context\n\nThe `context` argument passed to the `loader` function is an object containing a merged union of:\n\n- Parent route context\n- This route's context as provided by the `beforeLoad` option\n\nStarting 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.\n\nIn this example, we'll create a function in our route context to fetch posts, then use it in our `loader` function.\n\n> 🧠 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.\n\n- `/utils/fetchPosts.tsx`\n\n```tsx\nexport const fetchPosts = async () => {\n  const res = await fetch(`/api/posts?page=${pageIndex}`)\n  if (!res.ok) throw new Error('Failed to fetch posts')\n  return res.json()\n}\n```\n\n- `/routes/__root.tsx`\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRootRouteWithContext } from '@tanstack/react-router'\n\n// Create a root route using the createRootRouteWithContext<{...}>() function and pass it whatever types you would like to be available in your router context.\nexport const Route = createRootRouteWithContext<{\n  fetchPosts: typeof fetchPosts\n}>()() // NOTE: the double call is on purpose, since createRootRouteWithContext is a factory ;)\n```\n\n# Solid\n\n```tsx\nimport { createRootRouteWithContext } from '@tanstack/solid-router'\n\n// Create a root route using the createRootRouteWithContext<{...}>() function and pass it whatever types you would like to be available in your router context.\nexport const Route = createRootRouteWithContext<{\n  fetchPosts: typeof fetchPosts\n}>()() // NOTE: the double call is on purpose, since createRootRouteWithContext is a factory ;)\n```\n\n<!-- ::end:framework -->\n\n- `/routes/posts.tsx`\n\n```tsx\n// Notice how our postsRoute references context to get our fetchPosts function\n// This can be a powerful tool for dependency injection across your router\n// and routes.\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context: { fetchPosts } }) => fetchPosts(),\n})\n```\n\n- `/router.tsx`\n\n```tsx\nimport { routeTree } from './routeTree.gen'\n\n// Use your routerContext to create a new router\n// This will require that you fullfil the type requirements of the routerContext\nconst router = createRouter({\n  routeTree,\n  context: {\n    // Supply the fetchPosts function to the router context\n    fetchPosts,\n  },\n})\n```\n\n## Using Path Params\n\nTo use path params in your `loader` function, access them via the `params` property on the function's parameters. Here's an example:\n\n```tsx\n// src/routes/posts.$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPostById(postId),\n})\n```\n\n## Using Route Context\n\nPassing 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:\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  // Pass the fetchPosts function to the route context\n  beforeLoad: () => ({\n    fetchPosts: () => console.info('foo'),\n  }),\n  loader: ({ context: { fetchPosts } }) => {\n    fetchPosts() // 'foo'\n\n    // ...\n  },\n})\n```\n\n## Using Search Params in Loaders\n\n> ❓ But wait Tanner... where the heck are my search params?!\n\nYou 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:\n\n- 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.\n- 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!\n- Placing a threshold between search parameters and the loader function allows the router to understand your dependencies and reactivity.\n\n```tsx\n// /routes/users.user.tsx\nexport const Route = createFileRoute('/users/user')({\n  validateSearch: (search) =>\n    search as {\n      userId: string\n    },\n  loaderDeps: ({ search: { userId } }) => ({\n    userId,\n  }),\n  loader: async ({ deps: { userId } }) => getUser(userId),\n})\n```\n\n### Accessing Search Params via `routeOptions.loaderDeps`\n\n```tsx\n// /routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  // Use zod to validate and parse the search params\n  validateSearch: z.object({\n    offset: z.number().int().nonnegative().catch(0),\n  }),\n  // Pass the offset to your loader deps via the loaderDeps function\n  loaderDeps: ({ search: { offset } }) => ({ offset }),\n  // Use the offset from context in the loader function\n  loader: async ({ deps: { offset } }) =>\n    fetchPosts({\n      offset,\n    }),\n})\n```\n\n## Using the Abort Signal\n\nThe `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:\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: ({ abortController }) =>\n    fetchPosts({\n      // Pass this to an underlying fetch call or anything that supports signals\n      signal: abortController.signal,\n    }),\n})\n```\n\n## Using the `preload` flag\n\nThe `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:\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: async ({ preload }) =>\n    fetchPosts({\n      maxAge: preload ? 10_000 : 0, // Preloads should hang around a bit longer\n    }),\n})\n```\n\n## Handling Slow Loaders\n\nIdeally 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:\n\n- 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).\n- Show a pending component after an optimistic suspense threshold until all of the data is ready (See below).\n\n## Showing a pending component\n\n**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:\n\n- `routeOptions.pendingMs` or\n- `routerOptions.defaultPendingMs`\n\nWhen the pending time threshold is exceeded, the router will render the `pendingComponent` option of the route, if configured.\n\n## Avoiding Pending Component Flash\n\nIf 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:\n\n- `routeOptions.pendingMinMs` or\n- `routerOptions.defaultPendingMinMs`\n\n## Handling Errors\n\nTanStack Router provides a few ways to handle errors that occur during the route loading lifecycle. Let's take a look at them.\n\n### Handling Errors with `routeOptions.onError`\n\nThe `routeOptions.onError` option is a function that is called when an error occurs during the route loading.\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  onError: ({ error }) => {\n    // Log the error\n    console.error(error)\n  },\n})\n```\n\n### Handling Errors with `routeOptions.onCatch`\n\nThe `routeOptions.onCatch` option is a function that is called whenever an error was caught by the router's CatchBoundary.\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  onCatch: ({ error, errorInfo }) => {\n    // Log the error\n    console.error(error)\n  },\n})\n```\n\n### Handling Errors with `routeOptions.errorComponent`\n\nThe `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:\n\n- `error` - The error that occurred\n- `reset` - A function to reset the internal `CatchBoundary`\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  errorComponent: ({ error }) => {\n    // Render an error message\n    return <div>{error.message}</div>\n  },\n})\n```\n\nThe `reset` function can be used to allow the user to retry rendering the error boundaries normal children:\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  errorComponent: ({ error, reset }) => {\n    return (\n      <div>\n        {error.message}\n        <button\n          onClick={() => {\n            // Reset the router error boundary\n            reset()\n          }}\n        >\n          retry\n        </button>\n      </div>\n    )\n  },\n})\n```\n\nIf 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:\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  errorComponent: ({ error, reset }) => {\n    const router = useRouter()\n\n    return (\n      <div>\n        {error.message}\n        <button\n          onClick={() => {\n            // Invalidate the route to reload the loader, which will also reset the error boundary\n            router.invalidate()\n          }}\n        >\n          retry\n        </button>\n      </div>\n    )\n  },\n})\n```\n\n### Using the default `ErrorComponent`\n\nTanStack 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`:\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  errorComponent: ({ error }) => {\n    if (error instanceof MyCustomError) {\n      // Render a custom error message\n      return <div>{error.message}</div>\n    }\n\n    // Fallback to the default ErrorComponent\n    return <ErrorComponent error={error} />\n  },\n})\n```\n"
  },
  {
    "path": "docs/router/guide/data-mutations.md",
    "content": "---\ntitle: Data Mutations\n---\n\nSince 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.\n\nLook for and use mutation utilities that support:\n\n- Handling and caching submission state\n- Providing both local and global optimistic UI support\n- Built-in hooks to wire up invalidation (or automatically support it)\n- Handling multiple in-flight mutations at once\n- Organizing mutation state as a globally accessible resource\n- Submission state history and garbage collection\n\nSome suggested libraries:\n\n- [TanStack Query](https://tanstack.com/query/latest/docs/react/guides/mutations)\n- [SWR](https://swr.vercel.app/)\n- [RTK Query](https://redux-toolkit.js.org/rtk-query/overview)\n- [urql](https://formidable.com/open-source/urql/)\n- [Relay](https://relay.dev/)\n- [Apollo](https://www.apollographql.com/docs/react/)\n\nOr, even...\n\n- [Zustand](https://zustand-demo.pmnd.rs/)\n- [Jotai](https://jotai.org/)\n- [Recoil](https://recoiljs.org/)\n- [Redux](https://redux.js.org/)\n\nSimilar to data fetching, mutation state isn't a one-size-fits-all solution, so you'll need to pick a solution that fits your needs and your team's needs. We recommend trying out a few different solutions and seeing what works best for you.\n\n> ⚠️ Still here? Submission state is an interesting topic when it comes to persistence. Do you keep every mutation around forever? How do you know when to get rid of it? What if the user navigates away from the screen and then back? Let's dig in!\n\n## Invalidating TanStack Router after a mutation\n\nTanStack 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.\n\nWhen mutations related to loader data are made, we can use `router.invalidate` to force the router to reload all of the current route matches:\n\n```tsx\nconst router = useRouter()\n\nconst addTodo = async (todo: Todo) => {\n  try {\n    await api.addTodo()\n    router.invalidate()\n  } catch {\n    //\n  }\n}\n```\n\nInvalidating 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.\n\nIf you want to await the invalidation until all loaders have finished, pass `{sync: true}` into `router.invalidate`:\n\n```tsx\nconst router = useRouter()\n\nconst addTodo = async (todo: Todo) => {\n  try {\n    await api.addTodo()\n    await router.invalidate({ sync: true })\n  } catch {\n    //\n  }\n}\n```\n\n## Long-term mutation State\n\nRegardless of the mutation library used, mutations often create state related to their submission. While most mutations are set-and-forget, some mutation states are more long-lived, either to support optimistic UI or to provide feedback to the user about the status of their submissions. Most state managers will correctly keep this submission state around and expose it to make it possible to show UI elements like loading spinners, success messages, error messages, etc.\n\nLet's consider the following interactions:\n\n- User navigates to the `/posts/123/edit` screen to edit a post\n- User edits the `123` post and upon success, sees a success message below the editor that the post was updated\n- User navigates to the `/posts` screen\n- User navigates back to the `/posts/123/edit` screen again\n\nWithout notifying your mutation management library about the route change, it's possible that your submission state could still be around and your user would still see the **\"Post updated successfully\"** message when they return to the previous screen. This is not ideal. Obviously, our intent wasn't to keep this mutation state around forever, right?!\n\n## Using mutation keys\n\nHopefully 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:\n\n```tsx\nconst routeApi = getRouteApi('/room/$roomId/chat')\n\nfunction ChatRoom() {\n  const { roomId } = routeApi.useParams()\n\n  const sendMessageMutation = useCoolMutation({\n    fn: sendMessage,\n    // Clear the mutation state when the roomId changes\n    // including any submission state\n    key: ['sendMessage', roomId],\n  })\n\n  // Fire off a bunch of messages\n  const test = () => {\n    sendMessageMutation.mutate({ roomId, message: 'Hello!' })\n    sendMessageMutation.mutate({ roomId, message: 'How are you?' })\n    sendMessageMutation.mutate({ roomId, message: 'Goodbye!' })\n  }\n\n  return (\n    <>\n      {sendMessageMutation.submissions.map((submission) => {\n        return (\n          <div>\n            <div>{submission.status}</div>\n            <div>{submission.message}</div>\n          </div>\n        )\n      })}\n    </>\n  )\n}\n```\n\n## Using the `router.subscribe` method\n\nFor 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.\n\nThe `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_.\n\nThis is a great place to reset your old mutation states. Here's an example:\n\n```tsx\nconst router = createRouter()\nconst coolMutationCache = createCoolMutationCache()\n\nconst unsubscribeFn = router.subscribe('onResolved', () => {\n  // Reset mutation states when the route changes\n  coolMutationCache.clear()\n})\n```\n"
  },
  {
    "path": "docs/router/guide/deferred-data-loading.md",
    "content": "---\nid: deferred-data-loading\ntitle: Deferred Data Loading\n---\n\nTanStack 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.\n\nDeferred 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.\n\nIf you are using a library like [TanStack Query](https://tanstack.com/query/latest) or any other data fetching library, then deferred data loading works a bit differently. Skip ahead to the [Deferred Data Loading with External Libraries](#deferred-data-loading-with-external-libraries) section for more information.\n\n## Deferred Data Loading with `Await`\n\nTo defer slow or non-critical data, return an **unawaited/unresolved** promise anywhere in your loader response:\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute, defer } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async () => {\n    // Fetch some slower data, but do not await it\n    const slowDataPromise = fetchSlowData()\n\n    // Fetch and await some data that resolves quickly\n    const fastData = await fetchFastData()\n\n    return {\n      fastData,\n      deferredSlowData: slowDataPromise,\n    }\n  },\n})\n```\n\nAs soon as any awaited promises are resolved, the next route will begin rendering while the deferred promises continue to resolve.\n\nIn the component, deferred promises can be resolved and utilized using the `Await` component:\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute, Await } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  // ...\n  component: PostIdComponent,\n})\n\nfunction PostIdComponent() {\n  const { deferredSlowData, fastData } = Route.useLoaderData()\n\n  // do something with fastData\n\n  return (\n    <Await promise={deferredSlowData} fallback={<div>Loading...</div>}>\n      {(data) => {\n        return <div>{data}</div>\n      }}\n    </Await>\n  )\n}\n```\n\n> [!TIP]\n> 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 import the `Route` configuration to get access to the typed `useLoaderData()` hook.\n\nThe `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.\n\nIf the promise is rejected, the `Await` component will throw the serialized error, which can be caught by the nearest error boundary.\n\n<!-- ::start:framework -->\n\n# React\n\n> [!TIP]\n> In React 19, you can use the `use()` hook instead of `Await`\n\n<!-- ::end:framework -->\n\n## Deferred Data Loading with External libraries\n\nWhen your strategy for fetching information for the route relies on [External Data Loading](./external-data-loading.md) with an external library like [TanStack Query](https://tanstack.com/query), deferred data loading works a bit differently, as the library handles the data fetching and caching for you outside of TanStack Router.\n\nSo, instead of using `defer` and `Await`, you'll instead want to use the Route's `loader` to kick off the data fetching and then use the library's hooks to access the data in your components.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { slowDataOptions, fastDataOptions } from '~/api/query-options'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ context: { queryClient } }) => {\n    // Kick off the fetching of some slower data, but do not await it\n    queryClient.prefetchQuery(slowDataOptions())\n\n    // Fetch and await some data that resolves quickly\n    await queryClient.ensureQueryData(fastDataOptions())\n  },\n})\n```\n\n# Solid\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { slowDataOptions, fastDataOptions } from '~/api/query-options'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ context: { queryClient } }) => {\n    // Kick off the fetching of some slower data, but do not await it\n    queryClient.prefetchQuery(slowDataOptions())\n\n    // Fetch and await some data that resolves quickly\n    await queryClient.ensureQueryData(fastDataOptions())\n  },\n})\n```\n\n<!-- ::end:framework -->\n\nThen in your component, you can use the library's hooks to access the data:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { slowDataOptions, fastDataOptions } from '~/api/query-options'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  // ...\n  component: PostIdComponent,\n})\n\nfunction PostIdComponent() {\n  const fastData = useSuspenseQuery(fastDataOptions())\n\n  // do something with fastData\n\n  return (\n    <Suspense fallback={<div>Loading...</div>}>\n      <SlowDataComponent />\n    </Suspense>\n  )\n}\n\nfunction SlowDataComponent() {\n  const data = useSuspenseQuery(slowDataOptions())\n\n  return <div>{data}</div>\n}\n```\n\n# Solid\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { useSuspenseQuery } from '@tanstack/solid-query'\nimport { slowDataOptions, fastDataOptions } from '~/api/query-options'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  // ...\n  component: PostIdComponent,\n})\n\nfunction PostIdComponent() {\n  const fastData = useSuspenseQuery(fastDataOptions())\n\n  // do something with fastData\n\n  return (\n    <Suspense fallback={<div>Loading...</div>}>\n      <SlowDataComponent />\n    </Suspense>\n  )\n}\n\nfunction SlowDataComponent() {\n  const data = useSuspenseQuery(slowDataOptions())\n\n  return <div>{data()}</div>\n}\n```\n\n<!-- ::end:framework -->\n\n## Caching and Invalidation\n\nStreamed promises follow the same lifecycle as the loader data they are associated with. They can even be preloaded!\n\n<!-- ::start:framework -->\n\n# React\n\n## SSR & Streaming Deferred Data\n\n**Streaming requires a server that supports it and for TanStack Router to be configured to use it properly.**\n\nPlease read the entire [Streaming SSR Guide](./ssr.md#streaming-ssr) for step by step instructions on how to set up your server for streaming.\n\n## SSR Streaming Lifecycle\n\nThe following is a high-level overview of how deferred data streaming works with TanStack Router:\n\n- Server\n  - Promises are marked and tracked as they are returned from route loaders\n  - All loaders resolve and any deferred promises are serialized and embedded into the html\n  - The route begins to render\n  - Deferred promises rendered with the `<Await>` component trigger suspense boundaries, allowing the server to stream html up to that point\n- Client\n  - The client receives the initial html from the server\n  - `<Await>` components suspend with placeholder promises while they wait for their data to resolve on the server\n- Server\n  - As deferred promises resolve, their results (or errors) are serialized and streamed to the client via an inline script tag\n  - The resolved `<Await>` components and their suspense boundaries are resolved and their resulting HTML is streamed to the client along with their dehydrated data\n- Client\n  - The suspended placeholder promises within `<Await>` are resolved with the streamed data/error responses and either render the result or throw the error to the nearest error boundary\n\n<!-- ::end:framework -->\n"
  },
  {
    "path": "docs/router/guide/document-head-management.md",
    "content": "---\ntitle: Document Head Management\n---\n\nDocument head management is the process of managing the head, title, meta, link, and script tags of a document and TanStack Router provides a robust way to manage the document head for full-stack applications that use Start and for single-page applications that use TanStack Router. It provides:\n\n- Automatic deduping of `title` and `meta` tags\n- Automatic loading/unloading of tags based on route visibility\n- A composable way to merge `title` and `meta` tags from nested routes\n\nFor full-stack applications that use Start, and even for single-page applications that use TanStack Router, managing the document head is a crucial part of any application for the following reasons:\n\n- SEO\n- Social media sharing\n- Analytics\n- CSS and JS loading/unloading\n\nTo manage the document head, it's required that you render both the `<HeadContent />` and `<Scripts />` components and use the `routeOptions.head` property to manage the head of a route, which returns an object with `title`, `meta`, `links`, `styles`, and `scripts` properties.\n\n## Managing the Document Head\n\n```tsx\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        name: 'description',\n        content: 'My App is a web application',\n      },\n      {\n        title: 'My App',\n      },\n    ],\n    links: [\n      {\n        rel: 'icon',\n        href: '/favicon.ico',\n      },\n    ],\n    styles: [\n      {\n        media: 'all and (max-width: 500px)',\n        children: `p {\n                  color: blue;\n                  background-color: yellow;\n                }`,\n      },\n    ],\n    scripts: [\n      {\n        src: 'https://www.google-analytics.com/analytics.js',\n      },\n    ],\n  }),\n})\n```\n\n### Deduping\n\nOut of the box, TanStack Router will dedupe `title` and `meta` tags, preferring the **last** occurrence of each tag found in nested routes.\n\n- `title` tags defined in nested routes will override a `title` tag defined in a parent route (but you can compose them together, which is covered in a future section of this guide)\n- `meta` tags with the same `name` or `property` will be overridden by the last occurrence of that tag found in nested routes\n\n### `<HeadContent />`\n\nThe `<HeadContent />` component is **required** to render the head, title, meta, link, and head-related script tags of a document.\n\nIt should be **rendered either in the `<head>` tag of your root layout or as high up in the component tree as possible** if your application doesn't or can't manage the `<head>` tag.\n\n### Start/Full-Stack Applications\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { HeadContent } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n      </body>\n    </html>\n  ),\n})\n```\n\n# Solid\n\n```tsx\nimport { HeadContent } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n      </body>\n    </html>\n  ),\n})\n```\n\n<!-- ::end:framework -->\n\n### Single-Page Applications\n\nFirst, remove the `<title>` tag from the index.html if you have set any.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { HeadContent } from '@tanstack/react-router'\n\nconst rootRoute = createRootRoute({\n  component: () => (\n    <>\n      <HeadContent />\n      <Outlet />\n    </>\n  ),\n})\n```\n\n# Solid\n\n```tsx\nimport { HeadContent } from '@tanstack/solid-router'\n\nconst rootRoute = createRootRoute({\n  component: () => (\n    <>\n      <HeadContent />\n      <Outlet />\n    </>\n  ),\n})\n```\n\n<!-- ::end:framework -->\n\n## Managing Body Scripts\n\nIn addition to scripts that can be rendered in the `<head>` tag, you can also render scripts in the `<body>` tag using the `routeOptions.scripts` property. This is useful for loading scripts (even inline scripts) that require the DOM to be loaded, but before the main entry point of your application (which includes hydration if you're using Start or a full-stack implementation of TanStack Router).\n\nTo do this, you must:\n\n- Use the `scripts` property of the `routeOptions` object\n- [Render the `<Scripts />` component](#scripts)\n\n```tsx\nexport const Route = createRootRoute({\n  scripts: () => [\n    {\n      children: 'console.log(\"Hello, world!\")',\n    },\n  ],\n})\n```\n\n### `<Scripts />`\n\nThe `<Scripts />` component is **required** to render the body scripts of a document. It should be rendered either in the `<body>` tag of your root layout or as high up in the component tree as possible if your application doesn't or can't manage the `<body>` tag.\n\n### Example\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRootRoute, Scripts } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => (\n    <html>\n      <head />\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  ),\n})\n```\n\n# Solid\n\n```tsx\nimport { createFileRoute, Scripts } from '@tanstack/solid-router'\nexport const Route = createRootRoute('/')({\n  component: () => (\n    <html>\n      <head />\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  ),\n})\n```\n\n<!-- ::end:framework -->\n\n## Inline Scripts with ScriptOnce\n\nFor scripts that must run before React hydrates (like theme detection), use `ScriptOnce`. This is particularly useful for avoiding flash of unstyled content (FOUC) or theme flicker.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { ScriptOnce } from '@tanstack/react-router'\n\nconst themeScript = `(function() {\n  try {\n    const theme = localStorage.getItem('theme') || 'auto';\n    const resolved = theme === 'auto'\n      ? (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')\n      : theme;\n    document.documentElement.classList.add(resolved);\n  } catch (e) {}\n})();`\n\nfunction ThemeProvider({ children }) {\n  return (\n    <>\n      <ScriptOnce children={themeScript} />\n      {children}\n    </>\n  )\n}\n```\n\n# Solid\n\n```tsx\nimport { ScriptOnce } from '@tanstack/solid-router'\n\nconst themeScript = `(function() {\n  try {\n    const theme = localStorage.getItem('theme') || 'auto';\n    const resolved = theme === 'auto'\n      ? (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')\n      : theme;\n    document.documentElement.classList.add(resolved);\n  } catch (e) {}\n})();`\n\nfunction ThemeProvider({ children }) {\n  return (\n    <>\n      <ScriptOnce children={themeScript} />\n      {children}\n    </>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n### How ScriptOnce Works\n\n1. During SSR, renders a `<script>` tag with the provided code\n2. The script executes immediately when the browser parses the HTML (before React hydrates)\n3. After execution, the script removes itself from the DOM\n4. On client-side navigation, nothing is rendered (prevents duplicate execution)\n\n<!-- ::start:framework -->\n\n# React\n\n### Preventing Hydration Warnings\n\nIf your script modifies the DOM before hydration (like adding a class to `<html>`), use `suppressHydrationWarning` to prevent React warnings:\n\n```tsx\nexport const Route = createRootRoute({\n  component: () => (\n    <html lang=\"en\" suppressHydrationWarning>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <ThemeProvider>\n          <Outlet />\n        </ThemeProvider>\n        <Scripts />\n      </body>\n    </html>\n  ),\n})\n```\n\n<!-- ::end:framework -->\n\n### Common Use Cases\n\n- **Theme/dark mode detection** - Apply theme class before hydration to prevent flash\n- **Feature detection** - Check browser capabilities before rendering\n- **Analytics initialization** - Initialize tracking before user interaction\n- **Critical path setup** - Any JavaScript that must run before hydration\n"
  },
  {
    "path": "docs/router/guide/external-data-loading.md",
    "content": "---\nid: external-data-loading\ntitle: External Data Loading\n---\n\n> [!IMPORTANT]\n> 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.\n\n## To **Store** or to **Coordinate**?\n\nWhile Router is very capable of storing and managing most data needs out of the box, sometimes you just might want something more robust!\n\nRouter is designed to be a perfect **coordinator** for external data fetching and caching libraries. This means that you can use any data fetching/caching library you want, and the router will coordinate the loading of your data in a way that aligns with your users' navigation and expectations of freshness.\n\n## What data fetching libraries are supported?\n\nAny data fetching library that supports asynchronous promises can be used with TanStack Router. This includes:\n\n- [TanStack Query](https://tanstack.com/query/latest/docs/react/overview)\n- [SWR](https://swr.vercel.app/)\n- [RTK Query](https://redux-toolkit.js.org/rtk-query/overview)\n- [urql](https://formidable.com/open-source/urql/)\n- [Relay](https://relay.dev/)\n- [Apollo](https://www.apollographql.com/docs/react/)\n\nOr, even...\n\n- [Zustand](https://zustand-demo.pmnd.rs/)\n- [Jotai](https://jotai.org/)\n- [Recoil](https://recoiljs.org/)\n- [Redux](https://redux.js.org/)\n\nLiterally any library that **can return a promise and read/write data** can be integrated.\n\n## Using Loaders to ensure data is loaded\n\nThe 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.\n\n> ⚠️ BUT WHY? It's very important to preload your critical render data in the loader for a few reasons:\n>\n> - No \"flash of loading\" states\n> - No waterfall data fetching, caused by component based fetching\n> - Better for SEO. If your data is available at render time, it will be indexed by search engines.\n\nHere is a naive illustration (don't do this) of using a Route's `loader` option to seed the cache for some data:\n\n```tsx\n// src/routes/posts.tsx\nlet postsCache = []\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    postsCache = await fetchPosts()\n  },\n  component: () => {\n    return (\n      <div>\n        {postsCache.map((post) => (\n          <Post key={post.id} post={post} />\n        ))}\n      </div>\n    )\n  },\n})\n```\n\nThis example is **obviously flawed**, but illustrates the point that you can use a route's `loader` option to seed your cache with data. Let's take a look at a more realistic example using TanStack Query.\n\n- Replace `fetchPosts` with your preferred data fetching library's prefetching API\n- Replace `postsCache` with your preferred data fetching library's read-or-fetch API or hook\n\n## A more realistic example using TanStack Query\n\nLet's take a look at a more realistic example using TanStack Query.\n\n```tsx\n// src/routes/posts.tsx\nconst postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n\nexport const Route = createFileRoute('/posts')({\n  // Use the `loader` option to ensure that the data is loaded\n  loader: () => queryClient.ensureQueryData(postsQueryOptions),\n  component: () => {\n    // Read the data from the cache and subscribe to updates\n    const {\n      data: { posts },\n    } = useSuspenseQuery(postsQueryOptions)\n\n    return (\n      <div>\n        {posts.map((post) => (\n          <Post key={post.id} post={post} />\n        ))}\n      </div>\n    )\n  },\n})\n```\n\n### Error handling with TanStack Query\n\nWhen 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.\n\n```tsx\nexport const Route = createFileRoute('/')({\n  loader: () => queryClient.ensureQueryData(postsQueryOptions),\n  errorComponent: ({ error, reset }) => {\n    const router = useRouter()\n    const queryErrorResetBoundary = useQueryErrorResetBoundary()\n\n    useEffect(() => {\n      // Reset the query error boundary\n      queryErrorResetBoundary.reset()\n    }, [queryErrorResetBoundary])\n\n    return (\n      <div>\n        {error.message}\n        <button\n          onClick={() => {\n            // Invalidate the route to reload the loader, and reset any router error boundaries\n            router.invalidate()\n          }}\n        >\n          retry\n        </button>\n      </div>\n    )\n  },\n})\n```\n\n## SSR Dehydration/Hydration\n\nTools that are able can integrate with TanStack Router's convenient Dehydration/Hydration APIs to shuttle dehydrated data between the server and client and rehydrate it where needed. Let's go over how to do this with both 3rd party critical data and 3rd party deferred data.\n\n## Critical Dehydration/Hydration\n\n**For critical data needed for the first render/paint**, TanStack Router supports **`dehydrate` and `hydrate`** options when configuring the `Router`. These callbacks are functions that are automatically called on the server and client when the router dehydrates and hydrates normally and allow you to augment the dehydrated data with your own data.\n\nThe `dehydrate` function can return any serializable JSON data which will get merged and injected into the dehydrated payload that is sent to the client.\n\nFor example, let's dehydrate and hydrate a TanStack Query `QueryClient` so that our data we fetched on the server will be available for hydration on the client.\n\n```tsx\n// src/router.tsx\n\nexport function createRouter() {\n  // Make sure you create your loader client or similar data\n  // stores inside of your `createRouter` function. This ensures\n  // that your data stores are unique to each request and\n  // always present on both server and client.\n  const queryClient = new QueryClient()\n\n  return createRouter({\n    routeTree,\n    // Optionally provide your loaderClient to the router context for\n    // convenience (you can provide anything you want to the router\n    // context!)\n    context: {\n      queryClient,\n    },\n    // On the server, dehydrate the loader client so the router\n    // can serialize it and send it to the client for us\n    dehydrate: () => {\n      return {\n        queryClientState: dehydrate(queryClient),\n      }\n    },\n    // On the client, hydrate the loader client with the data\n    // we dehydrated on the server\n    hydrate: (dehydrated) => {\n      hydrate(queryClient, dehydrated.queryClientState)\n    },\n    // Optionally, we can use `Wrap` to wrap our router in the loader client provider\n    Wrap: ({ children }) => {\n      return (\n        <QueryClientProvider client={queryClient}>\n          {children}\n        </QueryClientProvider>\n      )\n    },\n  })\n}\n```\n"
  },
  {
    "path": "docs/router/guide/history-types.md",
    "content": "---\ntitle: History Types\n---\n\nWhile it's not required to know the `@tanstack/history` API itself to use TanStack Router, it's a good idea to understand how it works. Under the hood, TanStack Router requires and uses a `history` abstraction to manage the routing history.\n\nIf you don't create a history instance, a browser-oriented instance of this API is created for you when the router is initialized. If you need a special history API type, You can use the `@tanstack/history` package to create your own:\n\n- `createBrowserHistory`: The default history type.\n- `createHashHistory`: A history type that uses a hash to track history.\n- `createMemoryHistory`: A history type that keeps the history in memory.\n\nOnce you have a history instance, you can pass it to the `Router` constructor:\n\n<!-- ::start:framework -->\n\n# React\n\n```ts\nimport { createMemoryHistory, createRouter } from '@tanstack/react-router'\n\nconst memoryHistory = createMemoryHistory({\n  initialEntries: ['/'], // Pass your initial url\n})\n\nconst router = createRouter({ routeTree, history: memoryHistory })\n```\n\n# Solid\n\n```ts\nimport { createMemoryHistory, createRouter } from '@tanstack/solid-router'\n\nconst memoryHistory = createMemoryHistory({\n  initialEntries: ['/'], // Pass your initial url\n})\n\nconst router = createRouter({ routeTree, history: memoryHistory })\n```\n\n<!-- ::end:framework -->\n\n## Browser Routing\n\nThe `createBrowserHistory` is the default history type. It uses the browser's history API to manage the browser history.\n\n## Hash Routing\n\nHash routing can be helpful if your server doesn't support rewrites to index.html for HTTP requests (among other environments that don't have a server).\n\n<!-- ::start:framework -->\n\n# React\n\n```ts\nimport { createHashHistory, createRouter } from '@tanstack/react-router'\n\nconst hashHistory = createHashHistory()\n\nconst router = createRouter({ routeTree, history: hashHistory })\n```\n\n# Solid\n\n```ts\nimport { createHashHistory, createRouter } from '@tanstack/solid-router'\n\nconst hashHistory = createHashHistory()\n\nconst router = createRouter({ routeTree, history: hashHistory })\n```\n\n<!-- ::end:framework -->\n\n## Memory Routing\n\nMemory routing is useful in environments that are not a browser or when you do not want components to interact with the URL.\n\n<!-- ::start:framework -->\n\n# React\n\n```ts\nimport { createMemoryHistory, createRouter } from '@tanstack/react-router'\n\nconst memoryHistory = createMemoryHistory({\n  initialEntries: ['/'], // Pass your initial url\n})\n\nconst router = createRouter({ routeTree, history: memoryHistory })\n```\n\n# Solid\n\n```ts\nimport { createMemoryHistory, createRouter } from '@tanstack/solid-router'\n\nconst memoryHistory = createMemoryHistory({\n  initialEntries: ['/'], // Pass your initial url\n})\n\nconst router = createRouter({ routeTree, history: memoryHistory })\n```\n\n<!-- ::end:framework -->\n\nRefer to the [SSR Guide](./ssr.md#automatic-server-history) for usage on the server for server-side rendering.\n"
  },
  {
    "path": "docs/router/guide/internationalization-i18n.md",
    "content": "---\ntitle: Internationalization (i18n)\n---\n\nTanStack Router provides flexible and highly customizable primitives that can be composed to support common internationalization (i18n) routing patterns, such as **optional path parameters**, **route rewriting**, and **type-safe params**. This enables clean, SEO-friendly URLs, flexible locale handling, and seamless integration with i18n libraries.\n\nThis guide covers:\n\n- Prefix-based and optional-locale routing\n- Advanced routing patterns for i18n\n- Language navigation and switching\n- SEO considerations\n- Type safety\n- Integration patterns with i18n libraries (Paraglide)\n\n---\n\n## i18n with Optional Path Parameters\n\nThis pattern relies exclusively on TanStack Router features. It is suitable when:\n\n- You want full control over translations\n- You already manage translations manually\n- You do not need automatic locale detection\n\nOptional path parameters are ideal for implementing locale-aware routing without duplicating routes.\n\n```\n/{-$locale}/about\n```\n\nThis single route matches:\n\n- `/about` (default locale)\n- `/en/about`\n- `/fr/about`\n- `/es/about`\n\n### Prefix-based i18n\n\n```tsx\n// Route: /{-$locale}/about\nexport const Route = createFileRoute('/{-$locale}/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  const { locale } = Route.useParams()\n  const currentLocale = locale || 'en'\n\n  const content = {\n    en: { title: 'About Us' },\n    fr: { title: 'À Propos' },\n    es: { title: 'Acerca de' },\n  }\n\n  return <h1>{content[currentLocale].title}</h1>\n}\n```\n\n### Complex Routing Patterns\n\n```tsx\n// Route: /{-$locale}/blog/{-$category}/$slug\nexport const Route = createFileRoute('/{-$locale}/blog/{-$category}/$slug')({\n  beforeLoad: ({ params }) => {\n    const locale = params.locale || 'en'\n    const validLocales = ['en', 'fr', 'es', 'de']\n\n    if (params.locale && !validLocales.includes(params.locale)) {\n      throw new Error('Invalid locale')\n    }\n\n    return { locale }\n  },\n})\n```\n\n### Language Switching\n\n```tsx\n<Link\n  to=\"/{-$locale}/blog/{-$category}/$slug\"\n  params={(prev) => ({\n    ...prev,\n    locale: prev.locale === 'en' ? undefined : 'fr',\n  })}\n>\n  Français\n</Link>\n```\n\n### Type-safe Locales\n\n```ts\ntype Locale = 'en' | 'fr' | 'es' | 'de'\n\nfunction isLocale(value?: string): value is Locale {\n  return ['en', 'fr', 'es', 'de'].includes(value as Locale)\n}\n```\n\n---\n\n## i18n Library Integration Patterns\n\nTanStack Router is **library-agnostic**. You can integrate any i18n solution by mapping locale state to routing behavior.\n\nBelow is a recommended pattern using **Paraglide**.\n\n---\n\n## Client-side i18n with a Library (TanStack Router)\n\nThis pattern combines TanStack Router with a client-side i18n library. It is suitable when:\n\n- You want type-safe translations\n- You want localized URLs\n- You do not need server-side rendering\n\n### TanStack Router + Paraglide (Client-only)\n\nParaglide provides type-safe translations, locale detection, and URL localization that pair naturally with TanStack Router.\n\n**GitHub example:**\n[https://github.com/TanStack/router/tree/main/examples/react/i18n-paraglide](https://github.com/TanStack/router/tree/main/examples/react/i18n-paraglide)\n\n### Project Setup\n\n```bash\nnpx @inlang/paraglide-js@latest init\n```\n\n```ts\nimport { paraglideVitePlugin } from '@inlang/paraglide-js'\n\nparaglideVitePlugin({\n  project: './project.inlang',\n  outdir: './app/paraglide',\n})\n```\n\n### URL Localization via Router Rewrite\n\nThe router's `rewrite` option enables bidirectional URL transformation, perfect for locale prefixes. For comprehensive documentation on URL rewrites including advanced patterns, see the [URL Rewrites guide](./url-rewrites.md).\n\n```ts\nimport { deLocalizeUrl, localizeUrl } from './paraglide/runtime'\n\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => deLocalizeUrl(url),\n    output: ({ url }) => localizeUrl(url),\n  },\n})\n```\n\n---\n\n## Server-side i18n (TanStack Start)\n\nThis pattern integrates i18n at the routing and server layers. It is suitable when:\n\n- You use TanStack Start\n- You need SSR or streaming\n- You want locale-aware redirects and metadata\n\n### TanStack Start + Paraglide\n\n**GitHub example:**\n[https://github.com/TanStack/router/tree/main/examples/react/start-i18n-paraglide](https://github.com/TanStack/router/tree/main/examples/react/start-i18n-paraglide)\n\n### Server Middleware (SSR)\n\n```ts\nimport { paraglideMiddleware } from './paraglide/server'\n\nexport default {\n  fetch(req: Request) {\n    return paraglideMiddleware(req, () => handler.fetch(req))\n  },\n}\n```\n\n### HTML Language Attribute\n\n```tsx\nimport { getLocale } from '../paraglide/runtime'\n;<html lang={getLocale()} />\n```\n\n---\n\n## Offline-safe Redirects\n\nFor offline or client-only environments:\n\n```ts\nimport { shouldRedirect } from '../paraglide/runtime'\n\nbeforeLoad: async () => {\n  const decision = await shouldRedirect({ url: window.location.href })\n  if (decision.redirectUrl) {\n    throw redirect({ href: decision.redirectUrl.href })\n  }\n}\n```\n\n---\n\n## Type-safe Translated Pathnames\n\nTo ensure every route has translations, you can derive translated pathnames directly from the TanStack Router route tree.\n\n```ts\nimport { FileRoutesByTo } from '../routeTree.gen'\nimport { Locale } from '@/paraglide/runtime'\n```\n\nThis guarantees:\n\n- No missing translations\n- Full type safety\n- Compiler feedback for routing mistakes\n\n---\n\n## Prerendering Localized Routes\n\n```ts\nimport { localizeHref } from './paraglide/runtime'\n\nexport const prerenderRoutes = ['/', '/about'].map((path) => ({\n  path: localizeHref(path),\n  prerender: { enabled: true },\n}))\n```\n\n---\n\n## Additional i18n Integration Patterns\n\n### Intlayer (TanStack Start integration)\n\n[https://intlayer.org/doc/environment/tanstack-start](https://intlayer.org/doc/environment/tanstack-start)\n\n### use-intl (TanStack Start integration)\n\n[https://nikuscs.com/blog/13-tanstackstart-i18n/](https://nikuscs.com/blog/13-tanstackstart-i18n/)\n"
  },
  {
    "path": "docs/router/guide/link-options.md",
    "content": "---\ntitle: Link Options\n---\n\nYou may want to reuse options that are intended to be passed to `Link`, `redirect` or `navigate`. In which case you may decide an object literal is a good way to represent options passed to `Link`.\n\n```tsx\nconst dashboardLinkOptions = {\n  to: '/dashboard',\n  search: { search: '' },\n}\n\nfunction DashboardComponent() {\n  return <Link {...dashboardLinkOptions} />\n}\n```\n\nThere are a few problems here. `dashboardLinkOptions.to` is inferred as `string` which by default will resolve to every route when passed to `Link`, `navigate` or `redirect` (this particular issue could be fixed by `as const`). The other issue here is we do not know `dashboardLinkOptions` even passes the type checker until it is spread into `Link`. We could very easily create incorrect navigation options and only when the options are spread into `Link` do we know there is a type error.\n\n### Using `linkOptions` function to create re-usable options\n\n`linkOptions` is a function which type checks an object literal and returns the inferred input as is. This provides type safety on options exactly like `Link` before it is used allowing for easier maintenance and re-usability. Our above example using `linkOptions` looks like this:\n\n```tsx\nconst dashboardLinkOptions = linkOptions({\n  to: '/dashboard',\n  search: { search: '' },\n})\n\nfunction DashboardComponent() {\n  return <Link {...dashboardLinkOptions} />\n}\n```\n\nThis allows eager type checking of `dashboardLinkOptions` which can then be re-used anywhere\n\n```tsx\nconst dashboardLinkOptions = linkOptions({\n  to: '/dashboard',\n  search: { search: '' },\n})\n\nexport const Route = createFileRoute('/dashboard')({\n  component: DashboardComponent,\n  validateSearch: (input) => ({ search: input.search }),\n  beforeLoad: () => {\n    // can used in redirect\n    throw redirect(dashboardLinkOptions)\n  },\n})\n\nfunction DashboardComponent() {\n  const navigate = useNavigate()\n\n  return (\n    <div>\n      {/** can be used in navigate */}\n      <button onClick={() => navigate(dashboardLinkOptions)} />\n\n      {/** can be used in Link */}\n      <Link {...dashboardLinkOptions} />\n    </div>\n  )\n}\n```\n\n### An array of `linkOptions`\n\nWhen creating navigation you might loop over an array to construct a navigation bar. In which case `linkOptions` can be used to type check an array of object literals which are intended for `Link` props\n\n```tsx\nconst options = linkOptions([\n  {\n    to: '/dashboard',\n    label: 'Summary',\n    activeOptions: { exact: true },\n  },\n  {\n    to: '/dashboard/invoices',\n    label: 'Invoices',\n  },\n  {\n    to: '/dashboard/users',\n    label: 'Users',\n  },\n])\n\nfunction DashboardComponent() {\n  return (\n    <>\n      <div className=\"flex items-center border-b\">\n        <h2 className=\"text-xl p-2\">Dashboard</h2>\n      </div>\n\n      <div className=\"flex flex-wrap divide-x\">\n        {options.map((option) => {\n          return (\n            <Link\n              {...option}\n              key={option.to}\n              activeProps={{ className: `font-bold` }}\n              className=\"p-2\"\n            >\n              {option.label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n\n      <Outlet />\n    </>\n  )\n}\n```\n\nThe input of `linkOptions` is inferred and returned, as shown with the use of `label` as this does not exist on `Link` props\n"
  },
  {
    "path": "docs/router/guide/navigation-blocking.md",
    "content": "---\ntitle: Navigation Blocking\n---\n\nNavigation blocking is a way to prevent navigation from happening. This is typical if a user attempts to navigate while they:\n\n- Have unsaved changes\n- Are in the middle of a form\n- Are in the middle of a payment\n\nIn these situations, a prompt or custom UI should be shown to the user to confirm they want to navigate away.\n\n- If the user confirms, navigation will continue as normal\n- If the user cancels, all pending navigations will be blocked\n\n## How does navigation blocking work?\n\nNavigation blocking adds one or more layers of \"blockers\" to the entire underlying history API. If any blockers are present, navigation will be paused via one of the following ways:\n\n- Custom UI\n  - If the navigation is triggered by something we control at the router level, we can allow you to perform any task or show any UI you'd like to the user to confirm the action. Each blocker's `blocker` function will be asynchronously and sequentially executed. If any blocker function resolves or returns `true`, the navigation will be allowed and all other blockers will continue to do the same until all blockers have been allowed to proceed. If any single blocker resolves or returns `false`, the navigation will be canceled and the rest of the `blocker` functions will be ignored.\n- The `onbeforeunload` event\n  - For page events that we cannot control directly, we rely on the browser's `onbeforeunload` event. If the user attempts to close the tab or window, refresh, or \"unload\" the page assets in any way, the browser's generic \"Are you sure you want to leave?\" dialog will be shown. If the user confirms, all blockers will be bypassed and the page will unload. If the user cancels, the unload will be cancelled, and the page will remain as is.\n\n## How do I use navigation blocking?\n\nThere are 2 ways to use navigation blocking:\n\n- Hook/logical-based blocking\n- Component-based blocking\n\n## Hook/logical-based blocking\n\nLet's imagine we want to prevent navigation if a form is dirty. We can do this by using the `useBlocker` hook:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  useBlocker({\n    shouldBlockFn: () => {\n      if (!formIsDirty) return false\n\n      const shouldLeave = confirm('Are you sure you want to leave?')\n      return !shouldLeave\n    },\n  })\n\n  // ...\n}\n```\n\n# Solid\n\n```tsx\nimport { useBlocker } from '@tanstack/solid-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = createSignal(false)\n\n  useBlocker({\n    shouldBlockFn: () => {\n      if (!formIsDirty()) return false\n\n      const shouldLeave = confirm('Are you sure you want to leave?')\n      return !shouldLeave\n    },\n  })\n\n  // ...\n}\n```\n\n<!-- ::end:framework -->\n\n`shouldBlockFn` gives you type safe access to the `current` and `next` location:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  // always block going from /foo to /bar/123?hello=world\n  const { proceed, reset, status } = useBlocker({\n    shouldBlockFn: ({ current, next }) => {\n      return (\n        current.routeId === '/foo' &&\n        next.fullPath === '/bar/$id' &&\n        next.params.id === 123 &&\n        next.search.hello === 'world'\n      )\n    },\n    withResolver: true,\n  })\n\n  // ...\n}\n```\n\n# Solid\n\n```tsx\nimport { useBlocker } from '@tanstack/solid-router'\n\nfunction MyComponent() {\n  // always block going from /foo to /bar/123?hello=world\n  const { proceed, reset, status } = useBlocker({\n    shouldBlockFn: ({ current, next }) => {\n      return (\n        current.routeId === '/foo' &&\n        next.fullPath === '/bar/$id' &&\n        next.params.id === 123 &&\n        next.search.hello === 'world'\n      )\n    },\n    withResolver: true,\n  })\n\n  // ...\n}\n```\n\n<!-- ::end:framework -->\n\nNote that even if `shouldBlockFn` returns `false`, the browser's `beforeunload` event may still be triggered on page reloads or tab closing. To gain control over this, you can use the `enableBeforeUnload` option to conditionally register the `beforeunload` handler:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  useBlocker({\n    {/* ... */}\n    enableBeforeUnload: formIsDirty, // or () => formIsDirty\n  })\n\n  // ...\n}\n```\n\n# Solid\n\n```tsx\nimport { useBlocker } from '@tanstack/solid-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  useBlocker({\n    {/* ... */}\n    enableBeforeUnload: formIsDirty(),\n  })\n\n  // ...\n}\n```\n\n<!-- ::end:framework -->\n\nYou can find more information about the `useBlocker` hook in the [API reference](../api/router/useBlockerHook.md).\n\n## Component-based blocking\n\nIn addition to logical/hook based blocking, you can use the `Block` component to achieve similar results:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { Block } from '@tanstack/solid-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  return (\n    <Block\n      shouldBlockFn={() => {\n        if (!formIsDirty) return false\n\n        const shouldLeave = confirm('Are you sure you want to leave?')\n        return !shouldLeave\n      }}\n      enableBeforeUnload={formIsDirty}\n    />\n  )\n\n  // OR\n\n  return (\n    <Block\n      shouldBlockFn={() => formIsDirty}\n      enableBeforeUnload={formIsDirty}\n      withResolver\n    >\n      {({ status, proceed, reset }) => <>{/* ... */}</>}\n    </Block>\n  )\n}\n```\n\n# Solid\n\n```tsx\nimport { Block } from '@tanstack/solid-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = createSignal(false)\n\n  return (\n    <Block\n      shouldBlockFn={() => {\n        if (!formIsDirty()) return false\n\n        const shouldLeave = confirm('Are you sure you want to leave?')\n        return !shouldLeave\n      }}\n    />\n  )\n\n  // OR\n\n  return (\n    <Block shouldBlockFn={() => !formIsDirty} withResolver>\n      {({ status, proceed, reset }) => <>{/* ... */}</>}\n    </Block>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n## How can I show a custom UI?\n\nIn most cases, using `window.confirm` in the `shouldBlockFn` function with `withResolver: false` in the hook is enough since it will clearly show the user that the navigation is being blocked and resolve the blocking based on their response.\n\nHowever, in some situations, you might want to show a custom UI that is intentionally less disruptive and more integrated with your app's design.\n\n**Note:** The return value of `shouldBlockFn` does not resolve the blocking if `withResolver` is `true`.\n\n### Hook/logical-based custom UI with resolver\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  const { proceed, reset, status } = useBlocker({\n    shouldBlockFn: () => formIsDirty,\n    withResolver: true,\n  })\n\n  // ...\n\n  return (\n    <>\n      {/* ... */}\n      {status === 'blocked' && (\n        <div>\n          <p>Are you sure you want to leave?</p>\n          <button onClick={proceed}>Yes</button>\n          <button onClick={reset}>No</button>\n        </div>\n      )}\n    </>\n}\n```\n\n# Solid\n\n```tsx\nimport { useBlocker } from '@tanstack/solid-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = createSignal(false)\n\n  const { proceed, reset, status } = useBlocker({\n    shouldBlockFn: () => formIsDirty(),\n    withResolver: true,\n  })\n\n  // ...\n\n  return (\n    <>\n      {/* ... */}\n      {status === 'blocked' && (\n        <div>\n          <p>Are you sure you want to leave?</p>\n          <button onClick={proceed}>Yes</button>\n          <button onClick={reset}>No</button>\n        </div>\n      )}\n    </>\n}\n```\n\n<!-- ::end:framework -->\n\n### Hook/logical-based custom UI without resolver\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  useBlocker({\n    shouldBlockFn: () => {\n      if (!formIsDirty) {\n        return false\n      }\n\n      const shouldBlock = new Promise<boolean>((resolve) => {\n        // Using a modal manager of your choice\n        modals.open({\n          title: 'Are you sure you want to leave?',\n          children: (\n            <SaveBlocker\n              confirm={() => {\n                modals.closeAll()\n                resolve(false)\n              }}\n              reject={() => {\n                modals.closeAll()\n                resolve(true)\n              }}\n            />\n          ),\n          onClose: () => resolve(true),\n        })\n      })\n      return shouldBlock\n    },\n  })\n\n  // ...\n}\n```\n\n# Solid\n\n```tsx\nimport { useBlocker } from '@tanstack/solid-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = createSignal(false)\n\n  useBlocker({\n    shouldBlockFn: () => {\n      if (!formIsDirty()) {\n        return false\n      }\n\n      const shouldBlock = new Promise<boolean>((resolve) => {\n        // Using a modal manager of your choice\n        modals.open({\n          title: 'Are you sure you want to leave?',\n          children: (\n            <SaveBlocker\n              confirm={() => {\n                modals.closeAll()\n                resolve(false)\n              }}\n              reject={() => {\n                modals.closeAll()\n                resolve(true)\n              }}\n            />\n          ),\n          onClose: () => resolve(true),\n        })\n      })\n      return shouldBlock\n    },\n  })\n\n  // ...\n}\n```\n\n<!-- ::end:framework -->\n\n### Component-based custom UI\n\nSimilarly to the hook, the `Block` component returns the same state and functions as render props:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { Block } from '@tanstack/react-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  return (\n    <Block shouldBlockFn={() => formIsDirty} withResolver>\n      {({ status, proceed, reset }) => (\n        <>\n          {/* ... */}\n          {status === 'blocked' && (\n            <div>\n              <p>Are you sure you want to leave?</p>\n              <button onClick={proceed}>Yes</button>\n              <button onClick={reset}>No</button>\n            </div>\n          )}\n        </>\n      )}\n    </Block>\n  )\n}\n```\n\n# Solid\n\n```tsx\nimport { Block } from '@tanstack/solid-router'\n\nfunction MyComponent() {\n  const [formIsDirty, setFormIsDirty] = createSignal(false)\n\n  return (\n    <Block shouldBlockFn={() => formIsDirty()} withResolver>\n      {({ status, proceed, reset }) => (\n        <>\n          {/* ... */}\n          {status === 'blocked' && (\n            <div>\n              <p>Are you sure you want to leave?</p>\n              <button onClick={proceed}>Yes</button>\n              <button onClick={reset}>No</button>\n            </div>\n          )}\n        </>\n      )}\n    </Block>\n  )\n}\n```\n\n<!-- ::end:framework -->\n"
  },
  {
    "path": "docs/router/guide/navigation.md",
    "content": "---\ntitle: Navigation\n---\n\n## Everything is Relative\n\nBelieve 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.\n\nTanStack Router keeps this constant concept of relative navigation in mind for every navigation, so you'll constantly see two properties in the API:\n\n- `from` - The origin route path\n- `to` - The destination route path\n\n> ⚠️ If a `from` route path 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 😉.\n\n## Shared Navigation API\n\nEvery 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.\n\n### `ToOptions` Interface\n\nThis is the core `ToOptions` interface that is used in every navigation and route matching API:\n\n```ts\ntype ToOptions<\n  TRouteTree extends AnyRoute = AnyRoute,\n  TFrom extends RoutePaths<TRouteTree> | string = string,\n  TTo extends string = '',\n> = {\n  // `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.\n  from?: string\n  // `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.\n  to: string\n  // `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.\n  params:\n    | Record<string, unknown>\n    | ((prevParams: Record<string, unknown>) => Record<string, unknown>)\n  // `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.\n  search:\n    | Record<string, unknown>\n    | ((prevSearch: Record<string, unknown>) => Record<string, unknown>)\n  // `hash` is either a string or a function that supplies the previous hash and allows you to return a new one.\n  hash?: string | ((prevHash: string) => string)\n  // `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.\n  state?:\n    | Record<string, any>\n    | ((prevState: Record<string, unknown>) => Record<string, unknown>)\n  // `mask` is another navigation object used to mask the URL shown in the browser for this navigation.\n  mask?: ToMaskOptions<TRouteTree>\n}\n\ntype ToMaskOptions<TRouteTree extends AnyRoute = AnyRoute> = {\n  // `from`, `to`, `params`, `search`, `hash`, and `state` behave the same as in `ToOptions`.\n  // `mask` itself is not allowed inside `ToMaskOptions`.\n  from?: string\n  to: string\n  params:\n    | Record<string, unknown>\n    | ((prevParams: Record<string, unknown>) => Record<string, unknown>)\n  search:\n    | Record<string, unknown>\n    | ((prevSearch: Record<string, unknown>) => Record<string, unknown>)\n  hash?: string | ((prevHash: string) => string)\n  state?:\n    | Record<string, any>\n    | ((prevState: Record<string, unknown>) => Record<string, unknown>)\n  // If true, the URL will unmask on page reload.\n  unmaskOnReload?: boolean\n}\n```\n\n> 🧠 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:\n\n```tsx\nimport { Route as aboutRoute } from './routes/about.tsx'\n\nfunction Comp() {\n  return <Link to={aboutRoute.to}>About</Link>\n}\n```\n\n### `NavigateOptions` Interface\n\nThis is the core `NavigateOptions` interface that extends `ToOptions`. Any API that is actually performing a navigation will use this interface:\n\n```ts\nexport type NavigateOptions<\n  TRouteTree extends AnyRoute = AnyRoute,\n  TFrom extends RoutePaths<TRouteTree> | string = string,\n  TTo extends string = '',\n> = ToOptions<TRouteTree, TFrom, TTo> & {\n  // `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.\n  replace?: boolean\n  // `resetScroll` is a boolean that determines whether scroll position will be reset to 0,0 after the location is committed to browser history.\n  resetScroll?: boolean\n  // `hashScrollIntoView` is a boolean or object that determines whether an id matching the hash will be scrolled into view after the location is committed to history.\n  hashScrollIntoView?: boolean | ScrollIntoViewOptions\n  // `viewTransition` is either a boolean or function that determines if and how the browser will call document.startViewTransition() when navigating.\n  viewTransition?: boolean | ViewTransitionOptions\n  // `ignoreBlocker` is a boolean that determines if navigation should ignore any blockers that might prevent it.\n  ignoreBlocker?: boolean\n  // `reloadDocument` is a boolean that determines if navigation to a route inside of router will trigger a full page load instead of the traditional SPA navigation.\n  reloadDocument?: boolean\n  // `href` is a string that can be used in place of `to` to navigate to a full built href, e.g. pointing to an external target.\n  href?: string\n}\n```\n\n`NavigateOptions` includes all `ToOptions` fields, including `mask`.\n\n### `LinkOptions` Interface\n\nAnywhere an actual `<a>` tag the `LinkOptions` interface which extends `NavigateOptions` will be available:\n\n```tsx\nexport type LinkOptions<\n  TRouteTree extends AnyRoute = AnyRoute,\n  TFrom extends RoutePaths<TRouteTree> | string = string,\n  TTo extends string = '',\n> = NavigateOptions<TRouteTree, TFrom, TTo> & {\n  // The standard anchor tag target attribute\n  target?: HTMLAnchorElement['target']\n  // Defaults to `{ exact: false, includeHash: false }`\n  activeOptions?: {\n    exact?: boolean\n    includeHash?: boolean\n    includeSearch?: boolean\n    explicitUndefined?: boolean\n  }\n  // 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.\n  preload?: false | 'intent'\n  // Delay intent preloading by this many milliseconds. If the intent exits before this delay, the preload will be cancelled.\n  preloadDelay?: number\n  // If true, will render the link without the href attribute\n  disabled?: boolean\n}\n```\n\nSince `LinkOptions` extends `NavigateOptions`, it also supports `mask`.\n\n## Navigation API\n\nWith relative navigation and all of the interfaces in mind now, let's talk about the different flavors of navigation API at your disposal:\n\n- The `<Link>` component\n  - Generates an actual `<a>` tag with a valid `href` which can be click or even cmd/ctrl + clicked to open in a new tab\n- The `useNavigate()` hook\n  - 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.\n- The `<Navigate>` component\n  - Renders nothing and performs an immediate client-side navigation.\n- The `Router.navigate()` method\n  - 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.\n\n⚠️ 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.\n\n## `<Link>` Component\n\nThe `Link` component is the most common way to navigate within an app. It renders an actual `<a>` 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 `<a>` attributes including `target` to open links in new windows, etc.\n\nIn addition to the [`LinkOptions`](#linkoptions-interface) interface, the `Link` component also supports the following props:\n\n```tsx\nexport type LinkProps<\n  TFrom extends RoutePaths<RegisteredRouter['routeTree']> | string = string,\n  TTo extends string = '',\n> = LinkOptions<RegisteredRouter['routeTree'], TFrom, TTo> & {\n  // 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)\n  activeProps?:\n    | FrameworkHTMLAnchorTagAttributes\n    | (() => FrameworkHTMLAnchorAttributes)\n  // 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)\n  inactiveProps?:\n    | FrameworkHTMLAnchorAttributes\n    | (() => FrameworkHTMLAnchorAttributes)\n}\n```\n\n### Absolute Links\n\nLet's make a simple static link!\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nconst link = <Link to=\"/about\">About</Link>\n```\n\n# Solid\n\n```tsx\nimport { Link } from '@tanstack/solid-router'\n\nconst link = <Link to=\"/about\">About</Link>\n```\n\n<!-- ::end:framework -->\n\n### Dynamic Links\n\nDynamic links are links that have dynamic segments in them. For example, a link to a blog post might look like this:\n\n```tsx\nconst link = (\n  <Link\n    to=\"/blog/post/$postId\"\n    params={{\n      postId: 'my-first-blog-post',\n    }}\n  >\n    Blog Post\n  </Link>\n)\n```\n\nKeep 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.\n\n### Relative Links\n\nBy 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.\n\nRelative links can be combined with a `from` route path. If a from route path isn't provided, relative paths default to the current active location.\n\n> [!NOTE]\n> Keep in mind that when calling useNavigate as a method on the route, for example `Route.useNavigate`, then the `from` location is predefined to be the route it's called on.\n>\n> Another common pitfall is when using this in a pathless layout route, since the pathless layout route does not have an actual path, the `from` location is regarded as the parent of the pathless layout route. Hence relative routing will be resolved from this parent.\n\n```tsx\nconst postIdRoute = createRoute({\n  path: '/blog/post/$postId',\n})\n\nconst link = (\n  <Link from={postIdRoute.fullPath} to=\"../categories\">\n    Categories\n  </Link>\n)\n```\n\nAs 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!\n\n### Special relative paths: `\".\"` and `\"..\"`\n\nQuite often you might want to reload the current location or another `from` path, for example, to rerun the loaders on the current and/or parent routes, or maybe navigate back to a parent route. This can be achieved by specifying a `to` route path of `\".\"` which will reload the current location or provided `from` path.\n\nAnother common need is to navigate one route back relative to the current location or another path. By specifying a `to` route path of `\"..\"` navigation will be resolved to the first parent route preceding the current location.\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  return (\n    <div>\n      <Link to=\".\">Reload the current route of /posts/$postId</Link>\n      <Link to=\"..\">Navigate back to /posts</Link>\n      // the below are all equivalent\n      <Link to=\"/posts\">Navigate back to /posts</Link>\n      <Link from=\"/posts\" to=\".\">\n        Navigate back to /posts\n      </Link>\n      // the below are all equivalent\n      <Link to=\"/\">Navigate to root</Link>\n      <Link from=\"/posts\" to=\"..\">\n        Navigate to root\n      </Link>\n    </div>\n  )\n}\n```\n\n### Search Param Links\n\nSearch 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:\n\n```tsx\nconst link = (\n  <Link\n    to=\"/search\"\n    search={{\n      query: 'tanstack',\n    }}\n  >\n    Search\n  </Link>\n)\n```\n\nIt'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:\n\n```tsx\nconst link = (\n  <Link\n    to=\".\"\n    search={(prev) => ({\n      ...prev,\n      page: prev.page + 1,\n    })}\n  >\n    Next Page\n  </Link>\n)\n```\n\n### Search Param Type Safety\n\nSearch 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!\n\n### Hash Links\n\nHash 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:\n\n```tsx\nconst link = (\n  <Link\n    to=\"/blog/post/$postId\"\n    params={{\n      postId: 'my-first-blog-post',\n    }}\n    hash=\"section-1\"\n  >\n    Section 1\n  </Link>\n)\n```\n\n> ⚠️ When directly navigating to a URL with a hash fragment, the fragment is only available on the client; the browser does not send the fragment to the server as part of the request URL.\n>\n> This means that if you are using a server-side rendering approach, the hash fragment will not be available on the server-side, and hydration mismatches can occur when using the hash for rendering markup.\n>\n> Examples of this would be:\n>\n> - returning the hash value in the markup,\n> - conditional rendering based on the hash value, or\n> - setting the Link as active based on the hash value.\n\n### Navigating with Optional Parameters\n\nOptional path parameters provide flexible navigation patterns where you can include or omit parameters as needed. Optional parameters use the `{-$paramName}` syntax and offer fine-grained control over URL structure.\n\n#### Parameter Inheritance vs Removal\n\nWhen navigating with optional parameters, you have two main strategies:\n\n**Inheriting Current Parameters**\nUse `params: {}` to inherit all current route parameters:\n\n```tsx\n// Inherits current route parameters\n<Link to=\"/posts/{-$category}\" params={{}}>\n  All Posts\n</Link>\n```\n\n**Removing Parameters**  \nSet parameters to `undefined` to explicitly remove them:\n\n```tsx\n// Removes the category parameter\n<Link to=\"/posts/{-$category}\" params={{ category: undefined }}>\n  All Posts\n</Link>\n```\n\n#### Basic Optional Parameter Navigation\n\n```tsx\n// Navigate with optional parameter\n<Link\n  to=\"/posts/{-$category}\"\n  params={{ category: 'tech' }}\n>\n  Tech Posts\n</Link>\n\n// Navigate without optional parameter\n<Link\n  to=\"/posts/{-$category}\"\n  params={{ category: undefined }}\n>\n  All Posts\n</Link>\n\n// Navigate using parameter inheritance\n<Link\n  to=\"/posts/{-$category}\"\n  params={{}}\n>\n  Current Category\n</Link>\n```\n\n#### Function-Style Parameter Updates\n\nFunction-style parameter updates are particularly useful with optional parameters:\n\n```tsx\n// Remove a parameter using function syntax\n<Link\n  to=\"/posts/{-$category}\"\n  params={(prev) => ({ ...prev, category: undefined })}\n>\n  Clear Category\n</Link>\n\n// Update a parameter while keeping others\n<Link\n  to=\"/articles/{-$category}/{-$slug}\"\n  params={(prev) => ({ ...prev, category: 'news' })}\n>\n  News Articles\n</Link>\n\n// Conditionally set parameters\n<Link\n  to=\"/posts/{-$category}\"\n  params={(prev) => ({\n    ...prev,\n    category: someCondition ? 'tech' : undefined\n  })}\n>\n  Conditional Category\n</Link>\n```\n\n#### Multiple Optional Parameters\n\nWhen working with multiple optional parameters, you can mix and match which ones to include:\n\n```tsx\n// Navigate with some optional parameters\n<Link\n  to=\"/posts/{-$category}/{-$slug}\"\n  params={{ category: 'tech', slug: undefined }}\n>\n  Tech Posts\n</Link>\n\n// Remove all optional parameters\n<Link\n  to=\"/posts/{-$category}/{-$slug}\"\n  params={{ category: undefined, slug: undefined }}\n>\n  All Posts\n</Link>\n\n// Set multiple parameters\n<Link\n  to=\"/posts/{-$category}/{-$slug}\"\n  params={{ category: 'tech', slug: 'react-tips' }}\n>\n  Specific Post\n</Link>\n```\n\n#### Mixed Required and Optional Parameters\n\nOptional parameters work seamlessly with required parameters:\n\n```tsx\n// Required 'id', optional 'tab'\n<Link\n  to=\"/users/$id/{-$tab}\"\n  params={{ id: '123', tab: 'settings' }}\n>\n  User Settings\n</Link>\n\n// Remove optional parameter while keeping required\n<Link\n  to=\"/users/$id/{-$tab}\"\n  params={{ id: '123', tab: undefined }}\n>\n  User Profile\n</Link>\n\n// Use function style with mixed parameters\n<Link\n  to=\"/users/$id/{-$tab}\"\n  params={(prev) => ({ ...prev, tab: 'notifications' })}\n>\n  User Notifications\n</Link>\n```\n\n#### Advanced Optional Parameter Patterns\n\n**Prefix and Suffix Parameters**\nOptional parameters with prefix/suffix work with navigation:\n\n```tsx\n// Navigate to file with optional name\n<Link\n  to=\"/files/prefix{-$name}.txt\"\n  params={{ name: 'document' }}\n>\n  Document File\n</Link>\n\n// Navigate to file without optional name\n<Link\n  to=\"/files/prefix{-$name}.txt\"\n  params={{ name: undefined }}\n>\n  Default File\n</Link>\n```\n\n**All Optional Parameters**\nRoutes where all parameters are optional:\n\n```tsx\n// Navigate to specific date\n<Link\n  to=\"/{-$year}/{-$month}/{-$day}\"\n  params={{ year: '2023', month: '12', day: '25' }}\n>\n  Christmas 2023\n</Link>\n\n// Navigate to partial date\n<Link\n  to=\"/{-$year}/{-$month}/{-$day}\"\n  params={{ year: '2023', month: '12', day: undefined }}\n>\n  December 2023\n</Link>\n\n// Navigate to root with all parameters removed\n<Link\n  to=\"/{-$year}/{-$month}/{-$day}\"\n  params={{ year: undefined, month: undefined, day: undefined }}\n>\n  Home\n</Link>\n```\n\n#### Navigation with Search Params and Optional Parameters\n\nOptional parameters work great in combination with search params:\n\n```tsx\n// Combine optional path params with search params\n<Link\n  to=\"/posts/{-$category}\"\n  params={{ category: 'tech' }}\n  search={{ page: 1, sort: 'newest' }}\n>\n  Tech Posts - Page 1\n</Link>\n\n// Remove path param but keep search params\n<Link\n  to=\"/posts/{-$category}\"\n  params={{ category: undefined }}\n  search={(prev) => prev}\n>\n  All Posts - Same Filters\n</Link>\n```\n\n#### Imperative Navigation with Optional Parameters\n\nAll the same patterns work with imperative navigation:\n\n```tsx\nfunction Component() {\n  const navigate = useNavigate()\n\n  const clearFilters = () => {\n    navigate({\n      to: '/posts/{-$category}/{-$tag}',\n      params: { category: undefined, tag: undefined },\n    })\n  }\n\n  const setCategory = (category: string) => {\n    navigate({\n      to: '/posts/{-$category}/{-$tag}',\n      params: (prev) => ({ ...prev, category }),\n    })\n  }\n\n  const applyFilters = (category?: string, tag?: string) => {\n    navigate({\n      to: '/posts/{-$category}/{-$tag}',\n      params: { category, tag },\n    })\n  }\n}\n```\n\n### Active & Inactive Props\n\nThe `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.\n\nHere's an example:\n\n```tsx\nconst link = (\n  <Link\n    to=\"/blog/post/$postId\"\n    params={{\n      postId: 'my-first-blog-post',\n    }}\n    activeProps={{\n      style: {\n        fontWeight: 'bold',\n      },\n    }}\n  >\n    Section 1\n  </Link>\n)\n```\n\n### The `data-status` attribute\n\nIn 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.\n\n### Active Options\n\nThe `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:\n\n```tsx\nexport interface ActiveOptions {\n  // If true, the link will be active if the current route matches the `to` route path exactly (no children routes)\n  // Defaults to `false`\n  exact?: boolean\n  // If true, the link will only be active if the current URL hash matches the `hash` prop\n  // Defaults to `false`\n  includeHash?: boolean // Defaults to false\n  // If true, the link will only be active if the current URL search params inclusively match the `search` prop\n  // Defaults to `true`\n  includeSearch?: boolean\n  // This modifies the `includeSearch` behavior.\n  // If true,  properties in `search` that are explicitly `undefined` must NOT be present in the current URL search params for the link to be active.\n  // defaults to `false`\n  explicitUndefined?: boolean\n}\n```\n\nBy 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.\n\nFor example, if you are on the `/blog/post/my-first-blog-post` route, the following links will be active:\n\n```tsx\nconst link1 = (\n  <Link to=\"/blog/post/$postId\" params={{ postId: 'my-first-blog-post' }}>\n    Blog Post\n  </Link>\n)\nconst link2 = <Link to=\"/blog/post\">Blog Post</Link>\nconst link3 = <Link to=\"/blog\">Blog Post</Link>\n```\n\nHowever, the following links will not be active:\n\n```tsx\nconst link4 = (\n  <Link to=\"/blog/post/$postId\" params={{ postId: 'my-second-blog-post' }}>\n    Blog Post\n  </Link>\n)\n```\n\nIt'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:\n\n```tsx\nconst link = (\n  <Link to=\"/\" activeOptions={{ exact: true }}>\n    Home\n  </Link>\n)\n```\n\nThis will ensure that the link is not active when you are a child route.\n\nA few more options to be aware of:\n\n- If you want to include the hash in your matching, you can pass the `includeHash: true` option\n- If you do **not** want to include the search params in your matching, you can pass the `includeSearch: false` option\n\n### Passing `isActive` to children\n\nThe `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:\n\n```tsx\nconst link = (\n  <Link to=\"/blog/post\">\n    {({ isActive }) => {\n      return (\n        <>\n          <span>My Blog Post</span>\n          <icon className={isActive ? 'active' : 'inactive'} />\n        </>\n      )\n    }}\n  </Link>\n)\n```\n\n### Link Preloading\n\nThe `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:\n\n```tsx\nconst link = (\n  <Link to=\"/blog/post/$postId\" preload=\"intent\">\n    Blog Post\n  </Link>\n)\n```\n\nWith 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.\n\nWhat'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.\n\n### Link Preloading Delay\n\nAlong with preloading is a configurable delay which determines how long a user must hover over a link to trigger the intent-based preloading. The default delay is 50 milliseconds, but you can change this by passing a `preloadDelay` prop to the `Link` component with the number of milliseconds you'd like to wait:\n\n```tsx\nconst link = (\n  <Link to=\"/blog/post/$postId\" preload=\"intent\" preloadDelay={100}>\n    Blog Post\n  </Link>\n)\n```\n\n## `useNavigate`\n\n> ⚠️ 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).\n\nThe `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:\n\n```tsx\nfunction Component() {\n  const navigate = useNavigate({ from: '/posts/$postId' })\n\n  const handleSubmit = async (e: FrameworkFormEvent) => {\n    e.preventDefault()\n\n    const response = await fetch('/posts', {\n      method: 'POST',\n      body: JSON.stringify({ title: 'My First Post' }),\n    })\n\n    const { id: postId } = await response.json()\n\n    if (response.ok) {\n      navigate({ to: '/posts/$postId', params: { postId } })\n    }\n  }\n}\n```\n\n> 🧠 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!\n\n### `navigate` Options\n\nThe `navigate` function returned by `useNavigate` accepts the [`NavigateOptions` interface](#navigateoptions-interface)\n\n## `Navigate` Component\n\nOccasionally, 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. useEffect), but this is unnecessary. Instead, you can render the `Navigate` component to achieve the same result:\n\n```tsx\nfunction Component() {\n  return <Navigate to=\"/posts/$postId\" params={{ postId: 'my-first-post' }} />\n}\n```\n\nThink 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.\n\n## `router.navigate`\n\nThe `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.\n\n## `useMatchRoute` and `<MatchRoute>`\n\nThe `useMatchRoute` hook and `<MatchRoute>` 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:\n\n```tsx\nfunction Component() {\n  return (\n    <div>\n      <Link to=\"/users\">\n        Users\n        <MatchRoute to=\"/users\" pending>\n          <Spinner />\n        </MatchRoute>\n      </Link>\n    </div>\n  )\n}\n```\n\nThe component version `<MatchRoute>` can also be used with a function as children to render something when the route is matched:\n\n```tsx\nfunction Component() {\n  return (\n    <div>\n      <Link to=\"/users\">\n        Users\n        <MatchRoute to=\"/users\" pending>\n          {(match) => {\n            return <Spinner show={match} />\n          }}\n        </MatchRoute>\n      </Link>\n    </div>\n  )\n}\n```\n\nThe hook version `useMatchRoute` returns a function that can be called programmatically to check if a route is matched:\n\n```tsx\nfunction Component() {\n  const matchRoute = useMatchRoute()\n\n  useEffect(() => {\n    if (matchRoute({ to: '/users', pending: true })) {\n      console.info('The /users route is matched and pending')\n    }\n  })\n\n  return (\n    <div>\n      <Link to=\"/users\">Users</Link>\n    </div>\n  )\n}\n```\n\n---\n\nPhew! That's a lot of navigating! That said, hopefully you're feeling pretty good about getting around your application now. Let's move on!\n"
  },
  {
    "path": "docs/router/guide/not-found-errors.md",
    "content": "---\ntitle: Not Found Errors\n---\n\n> ⚠️ This page covers the newer `notFound` function and `notFoundComponent` API for handling not found errors. The `NotFoundRoute` route is deprecated and will be removed in a future release. See [Migrating from `NotFoundRoute`](#migrating-from-notfoundroute) for more information.\n\n## Overview\n\nThere are 2 uses for not-found errors in TanStack Router:\n\n- **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\n  - The **router** will automatically throw a not-found error when a path does not match any known route matching pattern\n  - 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.\n  - Examples:\n    - Attempting to access `/users` when there is no `/users` route\n    - Attempting to access `/posts/1/edit` when the route tree only handles `/posts/$postId`\n- **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\n  - **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.\n  - Will be handled by the nearest parent route with a `notFoundComponent` (when `notFound` is called within `loader`) or the root route.\n  - Examples:\n    - Attempting to access `/posts/1` when the post with ID 1 does not exist\n    - Attempting to access `/docs/path/to/document` when the document does not exist\n\nUnder the hood, both of these cases are implemented using the same `notFound` function and `notFoundComponent` API.\n\n## The `notFoundMode` option\n\nWhen 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.\n\nDepending on the `notFoundMode` option, the router will handle these automatic errors differently::\n\n- [\"fuzzy\" mode](#notfoundmode-fuzzy) (default): The router will intelligently find the closest matching suitable route and display the `notFoundComponent`.\n- [\"root\" mode](#notfoundmode-root): All not-found errors will be handled by the root route's `notFoundComponent`, regardless of the nearest matching route.\n\n### `notFoundMode: 'fuzzy'`\n\nBy 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.\n\n> **❓ 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.\n\nThe nearest suitable route is found using the following criteria:\n\n- The route must have children and therefore an `Outlet` to render the `notFoundComponent`\n- The route must have a `notFoundComponent` configured or the router must have a `defaultNotFoundComponent` configured\n\nFor example, consider the following route tree:\n\n- `__root__` (has a `notFoundComponent` configured)\n  - `posts` (has a `notFoundComponent` configured)\n    - `$postId` (has a `notFoundComponent` configured)\n\nIf provided the path of `/posts/1/edit`, the following component structure will be rendered:\n\n- `<Root>`\n  - `<Posts>`\n    - `<Posts.notFoundComponent>`\n\nThe `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**.\n\n### `notFoundMode: 'root'`\n\nWhen `notFoundMode` is set to `root`, all not-found errors will be handled by the root route's `notFoundComponent` instead of bubbling up from the nearest fuzzy-matched route.\n\nFor example, consider the following route tree:\n\n- `__root__` (has a `notFoundComponent` configured)\n  - `posts` (has a `notFoundComponent` configured)\n    - `$postId` (has a `notFoundComponent` configured)\n\nIf provided the path of `/posts/1/edit`, the following component structure will be rendered:\n\n- `<Root>`\n  - `<Root.notFoundComponent>`\n\nThe `notFoundComponent` of the `__root__` route will be rendered because the `notFoundMode` is set to `root`.\n\n## Configuring a route's `notFoundComponent`\n\nTo handle both types of not-found errors, you can attach a `notFoundComponent` to a route. This component will be rendered when a not-found error is thrown.\n\nFor example, configuring a `notFoundComponent` for a `/settings` route to handle non-existing settings pages:\n\n```tsx\nexport const Route = createFileRoute('/settings')({\n  component: () => {\n    return (\n      <div>\n        <p>Settings page</p>\n        <Outlet />\n      </div>\n    )\n  },\n  notFoundComponent: () => {\n    return <p>This setting page doesn't exist!</p>\n  },\n})\n```\n\nOr configuring a `notFoundComponent` for a `/posts/$postId` route to handle posts that don't exist:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const post = await getPost(postId)\n    if (!post) throw notFound()\n    return { post }\n  },\n  component: ({ post }) => {\n    return (\n      <div>\n        <h1>{post.title}</h1>\n        <p>{post.body}</p>\n      </div>\n    )\n  },\n  notFoundComponent: () => {\n    return <p>Post not found!</p>\n  },\n})\n```\n\n## Default Router-Wide Not Found Handling\n\nYou may want to provide a default not-found component for every route in your app with child routes.\n\n> Why only routes with children? **Leaf-node routes (routes without children) will never render an `Outlet` and therefore are not able to handle not-found errors.**\n\nTo do this, pass a `defaultNotFoundComponent` to the `createRouter` function:\n\n```tsx\nconst router = createRouter({\n  defaultNotFoundComponent: () => {\n    return (\n      <div>\n        <p>Not found!</p>\n        <Link to=\"/\">Go home</Link>\n      </div>\n    )\n  },\n})\n```\n\n## Throwing your own `notFound` errors\n\nYou can manually throw not-found errors in loader methods and components using the `notFound` function. This is useful when you need to signal that a resource cannot be found.\n\nThe `notFound` function works in a similar fashion to the `redirect` function. To cause a not-found error, you can **throw a `notFound()`**.\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    // Returns `null` if the post doesn't exist\n    const post = await getPost(postId)\n    if (!post) {\n      throw notFound()\n      // Alternatively, you can make the notFound function throw:\n      // notFound({ throw: true })\n    }\n    // Post is guaranteed to be defined here because we threw an error\n    return { post }\n  },\n})\n```\n\nThe 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.\n\nIf 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 `<p>Not Found</p>`. 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.\n\n> ⚠️ When you throw `notFound()` in `beforeLoad`, TanStack Router resolves it the same way as other not-found errors:\n>\n> - If you pass `routeId`, that route (or the nearest valid ancestor boundary) handles it.\n> - If you don't pass `routeId`, the nearest route/ancestor with a `notFoundComponent` handles it (based on the router's mode and matching rules).\n> - If no suitable boundary is found, handling falls back to the root/default not-found behavior.\n>\n> 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.\n\n## Specifying Which Routes Handle Not Found Errors\n\nSometimes 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.\n\n```tsx\n// _pathlessLayout.tsx\nexport const Route = createFileRoute('/_pathlessLayout')({\n  // This will render\n  notFoundComponent: () => {\n    return <p>Not found (in _pathlessLayout)</p>\n  },\n  component: () => {\n    return (\n      <div>\n        <p>This is a pathless layout route!</p>\n        <Outlet />\n      </div>\n    )\n  },\n})\n\n// _pathlessLayout/route-a.tsx\nexport const Route = createFileRoute('/_pathless/route-a')({\n  loader: async () => {\n    // This will make LayoutRoute handle the not-found error\n    throw notFound({ routeId: '/_pathlessLayout' })\n    //                      ^^^^^^^^^ This will autocomplete from the registered router\n  },\n  // This WILL NOT render\n  notFoundComponent: () => {\n    return <p>Not found (in _pathlessLayout/route-a)</p>\n  },\n})\n```\n\n### Manually targeting the root route\n\nYou can also target the root route by passing the exported `rootRouteId` variable to the `notFound` function's `route` property:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const post = await getPost(postId)\n    if (!post) throw notFound({ routeId: rootRouteId })\n    return { post }\n  },\n})\n```\n\n### Throwing Not Found Errors in Components\n\nYou can also throw not-found errors in components. However, **it is recommended to throw not-found errors in loader methods instead of components in order to correctly type loader data and prevent flickering.**\n\nTanStack Router exposes a `CatchNotFound` component similar to `CatchBoundary` that can be used to catch not-found errors in components and display UI accordingly.\n\n### Data Loading Inside `notFoundComponent`\n\n`notFoundComponent` is a special case when it comes to data loading. **`SomeRoute.useLoaderData` may not be defined depending on which route you are trying to access and where the not-found error gets thrown**. However, `Route.useParams`, `Route.useSearch`, `Route.useRouteContext`, etc. will return a defined value.\n\n**If you need to pass incomplete loader data to `notFoundComponent`,** pass the data via the `data` option in the `notFound` function and validate it in `notFoundComponent`.\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const post = await getPost(postId)\n    if (!post)\n      throw notFound({\n        // Forward some data to the notFoundComponent\n        // data: someIncompleteLoaderData\n      })\n    return { post }\n  },\n  // `data: unknown` is passed to the component via the `data` option when calling `notFound`\n  notFoundComponent: ({ data }) => {\n    // ❌ useLoaderData is not valid here: const { post } = Route.useLoaderData()\n\n    // ✅:\n    const { postId } = Route.useParams()\n    const search = Route.useSearch()\n    const context = Route.useRouteContext()\n\n    return <p>Post with id {postId} not found!</p>\n  },\n})\n```\n\n## Usage With SSR\n\nSee [SSR guide](./ssr.md) for more information.\n\n## Migrating from `NotFoundRoute`\n\nThe `NotFoundRoute` API is deprecated in favor of `notFoundComponent`. The `NotFoundRoute` API will be removed in a future release.\n\n**The `notFound` function and `notFoundComponent` will not work when using `NotFoundRoute`.**\n\nThe main differences are:\n\n- `NotFoundRoute` is a route that requires an `<Outlet>` on its parent route to render. `notFoundComponent` is a component that can be attached to any route.\n- When using `NotFoundRoute`, you can't use layouts. `notFoundComponent` can be used with layouts.\n- 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 `<Outlet>`.\n\nTo migrate from `NotFoundRoute` to `notFoundComponent`, you'll just need to make a few changes:\n\n```tsx title='src/router.tsx'\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen.'\n- import { notFoundRoute } from './notFoundRoute'  // [!code --]\n\nexport const router = createRouter({\n  routeTree,\n- notFoundRoute // [!code --]\n})\n\n// routes/__root.tsx\nimport { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  // ...\n+ notFoundComponent: () => {  // [!code ++]\n+   return <p>Not found!</p>  // [!code ++]\n+ } // [!code ++]\n})\n```\n\nImportant changes:\n\n- A `notFoundComponent` is added to the root route for global not-found handling.\n  - You can also add a `notFoundComponent` to any other route in your route tree to handle not-found errors for that specific route.\n- The `notFoundComponent` does not support rendering an `<Outlet>`.\n"
  },
  {
    "path": "docs/router/guide/outlets.md",
    "content": "---\ntitle: Outlets\n---\n\nNested 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?\n\n## The `Outlet` Component\n\nThe `Outlet` component is used to render the next potentially matching child route. `<Outlet />` doesn't take any props and can be rendered anywhere within a route's component tree. If there is no matching child route, `<Outlet />` will render `null`.\n\n> [!TIP]\n> If a route's `component` is left undefined, it will render an `<Outlet />` automatically.\n\nA great example is configuring the root route of your application. Let's give our root route a component that renders a title, then an `<Outlet />` for our top-level routes to render.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <div>\n      <h1>My App</h1>\n      <Outlet /> {/* This is where child routes will render */}\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx\nimport { createRootRoute, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <div>\n      <h1>My App</h1>\n      <Outlet /> {/* This is where child routes will render */}\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n"
  },
  {
    "path": "docs/router/guide/parallel-routes.md",
    "content": "---\ntitle: Parallel Routes\n---\n\nWe haven't covered this yet. Stay tuned!\n"
  },
  {
    "path": "docs/router/guide/path-params.md",
    "content": "---\ntitle: Path Params\n---\n\nPath 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:\n\n- `$postId`\n- `$name`\n- `$teamId`\n- `about/$name`\n- `team/$teamId`\n- `blog/$postId`\n\nBecause path param routes only match to the next `/`, child routes can be created to continue expressing hierarchy:\n\nLet's create a post route file that uses a path param to match the post ID:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.$postId.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    return fetchPost(params.postId)\n  },\n})\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.$postId.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    return fetchPost(params.postId)\n  },\n})\n```\n\n<!-- ::end:framework -->\n\n## Path Params can be used by child routes\n\nOnce 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!\n\n## Path Params in Loaders\n\nPath 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' }`:\n\n```tsx title=\"src/routes/posts.$postId.tsx\"\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    return fetchPost(params.postId)\n  },\n})\n```\n\nThe `params` object is also passed to the `beforeLoad` option:\n\n```tsx title=\"src/routes/posts.$postId.tsx\"\nexport const Route = createFileRoute('/posts/$postId')({\n  beforeLoad: async ({ params }) => {\n    // do something with params.postId\n  },\n})\n```\n\n## Path Params in Components\n\nIf we add a component to our `postRoute`, we can access the `postId` variable from the URL by using the route's `useParams` hook:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.$postId.tsx\"\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const { postId } = Route.useParams()\n  return <div>Post {postId}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.$postId.tsx\"\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const params = Route.useParams()\n  return <div>Post {params().postId}</div>\n}\n```\n\n<!-- ::end:framework -->\n\n> 🧠 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 import the `Route` configuration to get access to the typed `useParams()` hook.\n\n## Path Params outside of Routes\n\nYou 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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/components/PostComponent.tsx\"\nfunction PostComponent() {\n  const { postId } = useParams({ strict: false })\n  return <div>Post {postId}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/components/PostComponent.tsx\"\nfunction PostComponent() {\n  const params = useParams({ strict: false })\n  return <div>Post {params().postId}</div>\n}\n```\n\n<!-- ::end:framework -->\n\n## Navigating with Path Params\n\nWhen 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.\n\nLet's see what an object style looks like:\n\n```tsx\nfunction Component() {\n  return (\n    <Link to=\"/blog/$postId\" params={{ postId: '123' }}>\n      Post 123\n    </Link>\n  )\n}\n```\n\nAnd here's what a function style looks like:\n\n```tsx\nfunction Component() {\n  return (\n    <Link to=\"/blog/$postId\" params={(prev) => ({ ...prev, postId: '123' })}>\n      Post 123\n    </Link>\n  )\n}\n```\n\nNotice 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.\n\n## Prefixes and Suffixes for Path Params\n\nYou can also use **prefixes** and **suffixes** with path params to create more complex routing patterns. This allows you to match specific URL structures while still capturing the dynamic segments.\n\nWhen using either prefixes or suffixes, you can define them by wrapping the path param in curly braces `{}` and placing the prefix or suffix before or after the variable name.\n\n### Defining Prefixes\n\nPrefixes are defined by placing the prefix text outside the curly braces before the variable name. For example, if you want to match a URL that starts with `post-` followed by a post ID, you can define it like this:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts/post-{$postId}.tsx\"\nexport const Route = createFileRoute('/posts/post-{$postId}')({\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const { postId } = Route.useParams()\n  // postId will be the value after 'post-'\n  return <div>Post ID: {postId}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts/post-{$postId}.tsx\"\nexport const Route = createFileRoute('/posts/post-{$postId}')({\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const params = Route.useParams()\n  // postId will be the value after 'post-'\n  return <div>Post ID: {params().postId}</div>\n}\n```\n\n<!-- ::end:framework -->\n\nYou can even combines prefixes with wildcard routes to create more complex patterns:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/on-disk/storage-{$postId}/$.tsx\"\nexport const Route = createFileRoute('/on-disk/storage-{$postId}/$')({\n  component: StorageComponent,\n})\n\nfunction StorageComponent() {\n  const { _splat } = Route.useParams()\n  // _splat, will be value after 'storage-'\n  // i.e. my-drive/documents/foo.txt\n  return <div>Storage Location: /{_splat}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/on-disk/storage-{$postId}/$.tsx\"\nexport const Route = createFileRoute('/on-disk/storage-{$postId}/$')({\n  component: StorageComponent,\n})\n\nfunction StorageComponent() {\n  const params = Route.useParams()\n  // _splat, will be value after 'storage-'\n  // i.e. my-drive/documents/foo.txt\n  return <div>Storage Location: /{params()._splat}</div>\n}\n```\n\n<!-- ::end:framework -->\n\n### Defining Suffixes\n\nSuffixes are defined by placing the suffix text outside the curly braces after the variable name. For example, if you want to match a URL a filename that ends with `txt`, you can define it like this:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/files/{$fileName}[.]txt.tsx\"\nexport const Route = createFileRoute('/files/{$fileName}.txt')({\n  component: FileComponent,\n})\n\nfunction FileComponent() {\n  const { fileName } = Route.useParams()\n  // fileName will be the value before 'txt'\n  return <div>File Name: {fileName}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/files/{$fileName}[.]txt.tsx\"\nexport const Route = createFileRoute('/files/{$fileName}.txt')({\n  component: FileComponent,\n})\n\nfunction FileComponent() {\n  const params = Route.useParams()\n  // fileName will be the value before 'txt'\n  return <div>File Name: {params().fileName}</div>\n}\n```\n\n<!-- ::end:framework -->\n\nYou can also combine suffixes with wildcards for more complex routing patterns:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/files/{$}[.]txt.tsx\"\nexport const Route = createFileRoute('/files/{$}.txt')({\n  component: FileComponent,\n})\n\nfunction FileComponent() {\n  const { _splat } = Route.useParams()\n  // _splat will be the value before '.txt'\n  return <div>File Splat: {_splat}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/files/{$}[.]txt.tsx\"\nexport const Route = createFileRoute('/files/{$}.txt')({\n  component: FileComponent,\n})\n\nfunction FileComponent() {\n  const params = Route.useParams()\n  // _splat will be the value before '.txt'\n  return <div>File Splat: {params()._splat}</div>\n}\n```\n\n<!-- ::end:framework -->\n\n### Combining Prefixes and Suffixes\n\nYou can combine both prefixes and suffixes to create very specific routing patterns. For example, if you want to match a URL that starts with `user-` and ends with `.json`, you can define it like this:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/users/user-{$userId}.json\"\nexport const Route = createFileRoute('/users/user-{$userId}.json')({\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const { userId } = Route.useParams()\n  // userId will be the value between 'user-' and '.json'\n  return <div>User ID: {userId}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/users/user-{$userId}.json\"\nexport const Route = createFileRoute('/users/user-{$userId}.json')({\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const params = Route.useParams()\n  // userId will be the value between 'user-' and '.json'\n  return <div>User ID: {params().userId}</div>\n}\n```\n\n<!-- ::end:framework -->\n\nSimilar to the previous examples, you can also use wildcards with prefixes and suffixes. Go wild!\n\n## Optional Path Parameters\n\nOptional path parameters allow you to define route segments that may or may not be present in the URL. They use the `{-$paramName}` syntax and provide flexible routing patterns where certain parameters are optional.\n\n### Defining Optional Parameters\n\nOptional path parameters are defined using curly braces with a dash prefix: `{-$paramName}`\n\n```tsx\n// Single optional parameter\n// src/routes/posts/{-$category}.tsx\nexport const Route = createFileRoute('/posts/{-$category}')({\n  component: PostsComponent,\n})\n\n// Multiple optional parameters\n// src/routes/posts/{-$category}/{-$slug}.tsx\nexport const Route = createFileRoute('/posts/{-$category}/{-$slug}')({\n  component: PostComponent,\n})\n\n// Mixed required and optional parameters\n// src/routes/users/$id/{-$tab}.tsx\nexport const Route = createFileRoute('/users/$id/{-$tab}')({\n  component: UserComponent,\n})\n```\n\n### How Optional Parameters Work\n\nOptional parameters create flexible URL patterns:\n\n- `/posts/{-$category}` matches both `/posts` and `/posts/tech`\n- `/posts/{-$category}/{-$slug}` matches `/posts`, `/posts/tech`, and `/posts/tech/hello-world`\n- `/users/$id/{-$tab}` matches `/users/123` and `/users/123/settings`\n\nWhen an optional parameter is not present in the URL, its value will be `undefined` in your route handlers and components.\n\n### Accessing Optional Parameters\n\nOptional parameters work exactly like regular parameters in your components, but their values may be `undefined`:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts/{-$category}.tsx\"\nfunction PostsComponent() {\n  const { category } = Route.useParams()\n\n  return <div>{category ? `Posts in ${category}` : 'All Posts'}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts/{-$category}.tsx\"\nfunction PostsComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      {params().category ? `Posts in ${params().category}` : 'All Posts'}\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n### Optional Parameters in Loaders\n\nOptional parameters are available in loaders and may be `undefined`:\n\n```tsx\nexport const Route = createFileRoute('/posts/{-$category}')({\n  loader: async ({ params }) => {\n    // params.category might be undefined\n    return fetchPosts({ category: params.category })\n  },\n})\n```\n\n### Optional Parameters in beforeLoad\n\nOptional parameters work in `beforeLoad` handlers as well:\n\n```tsx\nexport const Route = createFileRoute('/posts/{-$category}')({\n  beforeLoad: async ({ params }) => {\n    if (params.category) {\n      // Validate category exists\n      await validateCategory(params.category)\n    }\n  },\n})\n```\n\n### Advanced Optional Parameter Patterns\n\n#### With Prefix and Suffix\n\nOptional parameters support prefix and suffix patterns:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/files/prefix{-$name}.txt\"\n// Route: /files/prefix{-$name}.txt\n// Matches: /files/prefix.txt and /files/prefixdocument.txt\nexport const Route = createFileRoute('/files/prefix{-$name}.txt')({\n  component: FileComponent,\n})\n\nfunction FileComponent() {\n  const { name } = Route.useParams()\n  return <div>File: {name || 'default'}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/files/prefix{-$name}.txt\"\n// Route: /files/prefix{-$name}.txt\n// Matches: /files/prefix.txt and /files/prefixdocument.txt\nexport const Route = createFileRoute('/files/prefix{-$name}.txt')({\n  component: FileComponent,\n})\n\nfunction FileComponent() {\n  const params = Route.useParams()\n  return <div>File: {params().name || 'default'}</div>\n}\n```\n\n<!-- ::end:framework -->\n\n#### All Optional Parameters\n\nYou can create routes where all parameters are optional:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/{-$year}/{-$month}/{-$day}.tsx\"\n// Route: /{-$year}/{-$month}/{-$day}\n// Matches: /, /2023, /2023/12, /2023/12/25\nexport const Route = createFileRoute('/{-$year}/{-$month}/{-$day}')({\n  component: DateComponent,\n})\n\nfunction DateComponent() {\n  const { year, month, day } = Route.useParams()\n\n  if (!year) return <div>Select a year</div>\n  if (!month) return <div>Year: {year}</div>\n  if (!day)\n    return (\n      <div>\n        Month: {year}/{month}\n      </div>\n    )\n\n  return (\n    <div>\n      Date: {year}/{month}/{day}\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/{-$year}/{-$month}/{-$day}.tsx\"\n// Route: /{-$year}/{-$month}/{-$day}\n// Matches: /, /2023, /2023/12, /2023/12/25\nexport const Route = createFileRoute('/{-$year}/{-$month}/{-$day}')({\n  component: DateComponent,\n})\n\nfunction DateComponent() {\n  const params = Route.useParams()\n\n  if (!params().year) return <div>Select a year</div>\n  if (!params().month) return <div>Year: {params().year}</div>\n  if (!params().day)\n    return (\n      <div>\n        Month: {params().year}/{params().month}\n      </div>\n    )\n\n  return (\n    <div>\n      Date: {params().year}/{params().month}/{params().day}\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n#### Optional Parameters with Wildcards\n\nOptional parameters can be combined with wildcards for complex routing patterns:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/docs/{-$version}/$.tsx\"\n// Route: /docs/{-$version}/$\n// Matches: /docs/extra/path, /docs/v2/extra/path\nexport const Route = createFileRoute('/docs/{-$version}/$')({\n  component: DocsComponent,\n})\n\nfunction DocsComponent() {\n  const { version } = Route.useParams()\n  const { _splat } = Route.useParams()\n\n  return (\n    <div>\n      Version: {version || 'latest'}\n      Path: {_splat}\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/docs/{-$version}/$.tsx\"\n// Route: /docs/{-$version}/$\n// Matches: /docs/extra/path, /docs/v2/extra/path\nexport const Route = createFileRoute('/docs/{-$version}/$')({\n  component: DocsComponent,\n})\n\nfunction DocsComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      Version: {params().version || 'latest'}\n      Path: {params()._splat}\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n### Navigating with Optional Parameters\n\nWhen navigating to routes with optional parameters, you have fine-grained control over which parameters to include:\n\n```tsx\nfunction Navigation() {\n  return (\n    <div>\n      {/* Navigate with optional parameter */}\n      <Link to=\"/posts/{-$category}\" params={{ category: 'tech' }}>\n        Tech Posts\n      </Link>\n\n      {/* Navigate without optional parameter */}\n      <Link to=\"/posts/{-$category}\" params={{ category: undefined }}>\n        All Posts\n      </Link>\n\n      {/* Navigate with multiple optional parameters */}\n      <Link\n        to=\"/posts/{-$category}/{-$slug}\"\n        params={{ category: 'tech', slug: 'react-tips' }}\n      >\n        Specific Post\n      </Link>\n    </div>\n  )\n}\n```\n\n### Type Safety with Optional Parameters\n\nTypeScript provides full type safety for optional parameters:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts/{-$category}.tsx\"\nfunction PostsComponent() {\n  // TypeScript knows category might be undefined\n  const { category } = Route.useParams() // category: string | undefined\n\n  // Safe navigation\n  const categoryUpper = category?.toUpperCase()\n\n  return <div>{categoryUpper || 'All Categories'}</div>\n}\n\n// Navigation is type-safe and flexible\n<Link\n  to=\"/posts/{-$category}\"\n  params={{ category: 'tech' }} // ✅ Valid - string\n>\n  Tech Posts\n</Link>\n\n<Link\n  to=\"/posts/{-$category}\"\n  params={{ category: 123 }} // ✅ Valid - number (auto-stringified)\n>\n  Category 123\n</Link>\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts/{-$category}.tsx\"\nfunction PostsComponent() {\n  // TypeScript knows category might be undefined\n  const params = Route.useParams() // category: string | undefined\n\n  // Safe navigation\n  const categoryUpper = params().category?.toUpperCase()\n\n  return <div>{categoryUpper || 'All Categories'}</div>\n}\n\n// Navigation is type-safe and flexible\n<Link\n  to=\"/posts/{-$category}\"\n  params={{ category: 'tech' }} // ✅ Valid - string\n>\n  Tech Posts\n</Link>\n\n<Link\n  to=\"/posts/{-$category}\"\n  params={{ category: 123 }} // ✅ Valid - number (auto-stringified)\n>\n  Category 123\n</Link>\n```\n\n<!-- ::end:framework -->\n\n## Internationalization (i18n) with Optional Path Parameters\n\nOptional path parameters are excellent for implementing internationalization (i18n) routing patterns. You can use prefix patterns to handle multiple languages while maintaining clean, SEO-friendly URLs.\n\n### Prefix-based i18n\n\nUse optional language prefixes to support URLs like `/en/about`, `/fr/about`, or just `/about` (default language):\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/{-$locale}/about.tsx\"\n// Route: /{-$locale}/about\nexport const Route = createFileRoute('/{-$locale}/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  const { locale } = Route.useParams()\n  const currentLocale = locale || 'en' // Default to English\n\n  const content = {\n    en: { title: 'About Us', description: 'Learn more about our company.' },\n    fr: {\n      title: 'À Propos',\n      description: 'En savoir plus sur notre entreprise.',\n    },\n    es: {\n      title: 'Acerca de',\n      description: 'Conoce más sobre nuestra empresa.',\n    },\n  }\n\n  return (\n    <div>\n      <h1>{content[currentLocale]?.title}</h1>\n      <p>{content[currentLocale]?.description}</p>\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/{-$locale}/about.tsx\"\n// Route: /{-$locale}/about\nexport const Route = createFileRoute('/{-$locale}/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  const params = Route.useParams()\n  const currentLocale = params().locale || 'en' // Default to English\n\n  const content = {\n    en: { title: 'About Us', description: 'Learn more about our company.' },\n    fr: {\n      title: 'À Propos',\n      description: 'En savoir plus sur notre entreprise.',\n    },\n    es: {\n      title: 'Acerca de',\n      description: 'Conoce más sobre nuestra empresa.',\n    },\n  }\n\n  return (\n    <div>\n      <h1>{content[currentLocale]?.title}</h1>\n      <p>{content[currentLocale]?.description}</p>\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nThis pattern matches:\n\n- `/about` (default locale)\n- `/en/about` (explicit English)\n- `/fr/about` (French)\n- `/es/about` (Spanish)\n\n### Complex i18n Patterns\n\nCombine optional parameters for more sophisticated i18n routing:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/{-$locale}/blog/{-$category}/$slug.tsx\"\n// Route: /{-$locale}/blog/{-$category}/$slug\nexport const Route = createFileRoute('/{-$locale}/blog/{-$category}/$slug')({\n  beforeLoad: async ({ params }) => {\n    const locale = params.locale || 'en'\n    const category = params.category\n\n    // Validate locale and category\n    const validLocales = ['en', 'fr', 'es', 'de']\n    if (locale && !validLocales.includes(locale)) {\n      throw new Error('Invalid locale')\n    }\n\n    return { locale, category }\n  },\n  loader: async ({ params, context }) => {\n    const { locale } = context\n    const { slug, category } = params\n\n    return fetchBlogPost({ slug, category, locale })\n  },\n  component: BlogPostComponent,\n})\n\nfunction BlogPostComponent() {\n  const { locale, category, slug } = Route.useParams()\n  const data = Route.useLoaderData()\n\n  return (\n    <article>\n      <h1>{data.title}</h1>\n      <p>\n        Category: {category || 'All'} | Language: {locale || 'en'}\n      </p>\n      <div>{data.content}</div>\n    </article>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/{-$locale}/blog/{-$category}/$slug.tsx\"\n// Route: /{-$locale}/blog/{-$category}/$slug\nexport const Route = createFileRoute('/{-$locale}/blog/{-$category}/$slug')({\n  beforeLoad: async ({ params }) => {\n    const locale = params.locale || 'en'\n    const category = params.category\n\n    // Validate locale and category\n    const validLocales = ['en', 'fr', 'es', 'de']\n    if (locale && !validLocales.includes(locale)) {\n      throw new Error('Invalid locale')\n    }\n\n    return { locale, category }\n  },\n  loader: async ({ params, context }) => {\n    const { locale } = context\n    const { slug, category } = params\n\n    return fetchBlogPost({ slug, category, locale })\n  },\n  component: BlogPostComponent,\n})\n\nfunction BlogPostComponent() {\n  const params = Route.useParams()\n  const data = Route.useLoaderData()\n\n  return (\n    <article>\n      <h1>{data.title}</h1>\n      <p>\n        Category: {params().category || 'All'} | Language:{' '}\n        {params().locale || 'en'}\n      </p>\n      <div>{data.content}</div>\n    </article>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nThis supports URLs like:\n\n- `/blog/tech/my-post` (default locale, tech category)\n- `/fr/blog/my-post` (French, no category)\n- `/en/blog/tech/my-post` (explicit English, tech category)\n- `/es/blog/tecnologia/mi-post` (Spanish, Spanish category)\n\n### Language Navigation\n\nCreate language switchers using optional i18n parameters with function-style params:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/components/LanguageSwitcher.tsx\"\nfunction LanguageSwitcher() {\n  const currentParams = useParams({ strict: false })\n\n  const languages = [\n    { code: 'en', name: 'English' },\n    { code: 'fr', name: 'Français' },\n    { code: 'es', name: 'Español' },\n  ]\n\n  return (\n    <div className=\"language-switcher\">\n      {languages.map(({ code, name }) => (\n        <Link\n          key={code}\n          to=\"/{-$locale}/blog/{-$category}/$slug\"\n          params={(prev) => ({\n            ...prev,\n            locale: code === 'en' ? undefined : code, // Remove 'en' for clean URLs\n          })}\n          className={currentParams.locale === code ? 'active' : ''}\n        >\n          {name}\n        </Link>\n      ))}\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/components/LanguageSwitcher.tsx\"\nfunction LanguageSwitcher() {\n  const currentParams = useParams({ strict: false })\n\n  const languages = [\n    { code: 'en', name: 'English' },\n    { code: 'fr', name: 'Français' },\n    { code: 'es', name: 'Español' },\n  ]\n\n  return (\n    <div class=\"language-switcher\">\n      {languages.map(({ code, name }) => (\n        <Link\n          to=\"/{-$locale}/blog/{-$category}/$slug\"\n          params={(prev) => ({\n            ...prev,\n            locale: code === 'en' ? undefined : code, // Remove 'en' for clean URLs\n          })}\n          class={currentParams().locale === code ? 'active' : ''}\n        >\n          {name}\n        </Link>\n      ))}\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nYou can also create more sophisticated language switching logic:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nfunction AdvancedLanguageSwitcher() {\n  const currentParams = useParams({ strict: false })\n\n  const handleLanguageChange = (newLocale: string) => {\n    return (prev: any) => {\n      // Preserve all existing params but update locale\n      const updatedParams = { ...prev }\n\n      if (newLocale === 'en') {\n        // Remove locale for clean English URLs\n        delete updatedParams.locale\n      } else {\n        updatedParams.locale = newLocale\n      }\n\n      return updatedParams\n    }\n  }\n\n  return (\n    <div className=\"language-switcher\">\n      <Link\n        to=\"/{-$locale}/blog/{-$category}/$slug\"\n        params={handleLanguageChange('fr')}\n      >\n        Français\n      </Link>\n\n      <Link\n        to=\"/{-$locale}/blog/{-$category}/$slug\"\n        params={handleLanguageChange('es')}\n      >\n        Español\n      </Link>\n\n      <Link\n        to=\"/{-$locale}/blog/{-$category}/$slug\"\n        params={handleLanguageChange('en')}\n      >\n        English\n      </Link>\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx\nfunction AdvancedLanguageSwitcher() {\n  const currentParams = useParams({ strict: false })\n\n  const handleLanguageChange = (newLocale: string) => {\n    return (prev: any) => {\n      // Preserve all existing params but update locale\n      const updatedParams = { ...prev }\n\n      if (newLocale === 'en') {\n        // Remove locale for clean English URLs\n        delete updatedParams.locale\n      } else {\n        updatedParams.locale = newLocale\n      }\n\n      return updatedParams\n    }\n  }\n\n  return (\n    <div class=\"language-switcher\">\n      <Link\n        to=\"/{-$locale}/blog/{-$category}/$slug\"\n        params={handleLanguageChange('fr')}\n      >\n        Français\n      </Link>\n\n      <Link\n        to=\"/{-$locale}/blog/{-$category}/$slug\"\n        params={handleLanguageChange('es')}\n      >\n        Español\n      </Link>\n\n      <Link\n        to=\"/{-$locale}/blog/{-$category}/$slug\"\n        params={handleLanguageChange('en')}\n      >\n        English\n      </Link>\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n### Advanced i18n with Optional Parameters\n\nOrganize i18n routes using optional parameters for flexible locale handling:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\n// Route structure:\n// routes/\n//   {-$locale}/\n//     index.tsx        // /, /en, /fr\n//     about.tsx        // /about, /en/about, /fr/about\n//     blog/\n//       index.tsx      // /blog, /en/blog, /fr/blog\n//       $slug.tsx      // /blog/post, /en/blog/post, /fr/blog/post\n\n// routes/{-$locale}/index.tsx\nexport const Route = createFileRoute('/{-$locale}/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  const { locale } = Route.useParams()\n  const isRTL = ['ar', 'he', 'fa'].includes(locale || '')\n\n  return (\n    <div dir={isRTL ? 'rtl' : 'ltr'}>\n      <h1>Welcome ({locale || 'en'})</h1>\n      {/* Localized content */}\n    </div>\n  )\n}\n\n// routes/{-$locale}/about.tsx\nexport const Route = createFileRoute('/{-$locale}/about')({\n  component: AboutComponent,\n})\n```\n\n# Solid\n\n```tsx\n// Route structure:\n// routes/\n//   {-$locale}/\n//     index.tsx        // /, /en, /fr\n//     about.tsx        // /about, /en/about, /fr/about\n//     blog/\n//       index.tsx      // /blog, /en/blog, /fr/blog\n//       $slug.tsx      // /blog/post, /en/blog/post, /fr/blog/post\n\n// routes/{-$locale}/index.tsx\nexport const Route = createFileRoute('/{-$locale}/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  const params = Route.useParams()\n  const isRTL = ['ar', 'he', 'fa'].includes(params().locale || '')\n\n  return (\n    <div dir={isRTL ? 'rtl' : 'ltr'}>\n      <h1>Welcome ({params().locale || 'en'})</h1>\n      {/* Localized content */}\n    </div>\n  )\n}\n\n// routes/{-$locale}/about.tsx\nexport const Route = createFileRoute('/{-$locale}/about')({\n  component: AboutComponent,\n})\n```\n\n<!-- ::end:framework -->\n\n### SEO and Canonical URLs\n\nHandle SEO for i18n routes properly:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/{-$locale}/products/$id.tsx\"\nexport const Route = createFileRoute('/{-$locale}/products/$id')({\n  component: ProductComponent,\n  head: ({ params, loaderData }) => {\n    const locale = params.locale || 'en'\n    const product = loaderData\n\n    return {\n      title: product.title[locale] || product.title.en,\n      meta: [\n        {\n          name: 'description',\n          content: product.description[locale] || product.description.en,\n        },\n        {\n          property: 'og:locale',\n          content: locale,\n        },\n      ],\n      links: [\n        // Canonical URL (always use default locale format)\n        {\n          rel: 'canonical',\n          href: `https://example.com/products/${params.id}`,\n        },\n        // Alternate language versions\n        {\n          rel: 'alternate',\n          hreflang: 'en',\n          href: `https://example.com/products/${params.id}`,\n        },\n        {\n          rel: 'alternate',\n          hreflang: 'fr',\n          href: `https://example.com/fr/products/${params.id}`,\n        },\n        {\n          rel: 'alternate',\n          hreflang: 'es',\n          href: `https://example.com/es/products/${params.id}`,\n        },\n      ],\n    }\n  },\n})\n```\n\n# Solid\n\n```tsx title=\"src/routes/{-$locale}/products/$id.tsx\"\nexport const Route = createFileRoute('/{-$locale}/products/$id')({\n  component: ProductComponent,\n  head: ({ params, loaderData }) => {\n    const locale = params.locale || 'en'\n    const product = loaderData\n\n    return {\n      title: product.title[locale] || product.title.en,\n      meta: [\n        {\n          name: 'description',\n          content: product.description[locale] || product.description.en,\n        },\n        {\n          property: 'og:locale',\n          content: locale,\n        },\n      ],\n      links: [\n        // Canonical URL (always use default locale format)\n        {\n          rel: 'canonical',\n          href: `https://example.com/products/${params.id}`,\n        },\n        // Alternate language versions\n        {\n          rel: 'alternate',\n          hreflang: 'en',\n          href: `https://example.com/products/${params.id}`,\n        },\n        {\n          rel: 'alternate',\n          hreflang: 'fr',\n          href: `https://example.com/fr/products/${params.id}`,\n        },\n        {\n          rel: 'alternate',\n          hreflang: 'es',\n          href: `https://example.com/es/products/${params.id}`,\n        },\n      ],\n    }\n  },\n})\n```\n\n<!-- ::end:framework -->\n\n### Type Safety for i18n\n\nEnsure type safety for your i18n implementations:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/{-$locale}/shop/{-$category}.tsx\"\n// Define supported locales\ntype Locale = 'en' | 'fr' | 'es' | 'de'\n\n// Type-safe locale validation\nfunction validateLocale(locale: string | undefined): locale is Locale {\n  return ['en', 'fr', 'es', 'de'].includes(locale as Locale)\n}\n\nexport const Route = createFileRoute('/{-$locale}/shop/{-$category}')({\n  beforeLoad: async ({ params }) => {\n    const { locale } = params\n\n    // Type-safe locale validation\n    if (locale && !validateLocale(locale)) {\n      throw redirect({\n        to: '/shop/{-$category}',\n        params: { category: params.category },\n      })\n    }\n\n    return {\n      locale: (locale as Locale) || 'en',\n      isDefaultLocale: !locale || locale === 'en',\n    }\n  },\n  component: ShopComponent,\n})\n\nfunction ShopComponent() {\n  const { locale, category } = Route.useParams()\n  const { isDefaultLocale } = Route.useRouteContext()\n\n  // TypeScript knows locale is Locale | undefined\n  // and we have validated it in beforeLoad\n\n  return (\n    <div>\n      <h1>Shop {category ? `- ${category}` : ''}</h1>\n      <p>Language: {locale || 'en'}</p>\n      {!isDefaultLocale && (\n        <Link to=\"/shop/{-$category}\" params={{ category }}>\n          View in English\n        </Link>\n      )}\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/{-$locale}/shop/{-$category}.tsx\"\n// Define supported locales\ntype Locale = 'en' | 'fr' | 'es' | 'de'\n\n// Type-safe locale validation\nfunction validateLocale(locale: string | undefined): locale is Locale {\n  return ['en', 'fr', 'es', 'de'].includes(locale as Locale)\n}\n\nexport const Route = createFileRoute('/{-$locale}/shop/{-$category}')({\n  beforeLoad: async ({ params }) => {\n    const { locale } = params\n\n    // Type-safe locale validation\n    if (locale && !validateLocale(locale)) {\n      throw redirect({\n        to: '/shop/{-$category}',\n        params: { category: params.category },\n      })\n    }\n\n    return {\n      locale: (locale as Locale) || 'en',\n      isDefaultLocale: !locale || locale === 'en',\n    }\n  },\n  component: ShopComponent,\n})\n\nfunction ShopComponent() {\n  const params = Route.useParams()\n  const routeContext = Route.useRouteContext()\n\n  // TypeScript knows locale is Locale | undefined\n  // and we have validated it in beforeLoad\n\n  return (\n    <div>\n      <h1>Shop {params().category ? `- ${params().category}` : ''}</h1>\n      <p>Language: {params().locale || 'en'}</p>\n      {!routeContext().isDefaultLocale && (\n        <Link to=\"/shop/{-$category}\" params={{ category: params().category }}>\n          View in English\n        </Link>\n      )}\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nOptional path parameters provide a powerful and flexible foundation for implementing internationalization in your TanStack Router applications. Whether you prefer prefix-based or combined approaches, you can create clean, SEO-friendly URLs while maintaining excellent developer experience and type safety.\n\n## Allowed Characters\n\nBy default, path params are escaped with `encodeURIComponent`. If you want to allow other valid URI characters (e.g. `@` or `+`), you can specify that in your [RouterOptions](../api/router/RouterOptionsType.md#pathparamsallowedcharacters-property).\n\nExample usage:\n\n```tsx\nconst router = createRouter({\n  // ...\n  pathParamsAllowedCharacters: ['@'],\n})\n```\n\nThe following is the list of accepted allowed characters:\n\n- `;`\n- `:`\n- `@`\n- `&`\n- `=`\n- `+`\n- `$`\n- `,`\n"
  },
  {
    "path": "docs/router/guide/preloading.md",
    "content": "---\ntitle: Preloading\n---\n\nPreloading 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.\n\n## Supported Preloading Strategies\n\n- Intent\n  - Preloading by **\"intent\"** works by using hover and touch start events on `<Link>` components to preload the dependencies for the destination route.\n  - This strategy is useful for preloading routes that the user is likely to visit next.\n- Viewport Visibility\n  - Preloading by **\"viewport**\" works by using the Intersection Observer API to preload the dependencies for the destination route when the `<Link>` component is in the viewport.\n  - This strategy is useful for preloading routes that are below the fold or off-screen.\n- Render\n  - Preloading by **\"render\"** works by preloading the dependencies for the destination route as soon as the `<Link>` component is rendered in the DOM.\n  - This strategy is useful for preloading routes that are always needed.\n\n## How long does preloaded data stay in memory?\n\nPreloaded route matches are temporarily cached in memory with a few important caveats:\n\n- **Unused preloaded data is removed after 30 seconds by default.** This can be configured by setting the `defaultPreloadMaxAge` option on your router.\n- **Obviously, when a route is loaded, its preloaded version is promoted to the router's normal pending matches state.**\n\nIf 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://tanstack.com/query).\n\nThe simplest way to preload routes for your application is to set the `defaultPreload` option to `intent` for your entire router:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  // ...\n  defaultPreload: 'intent',\n})\n```\n\n# Solid\n\n```tsx\nimport { createRouter } from '@tanstack/solid-router'\n\nconst router = createRouter({\n  // ...\n  defaultPreload: 'intent',\n})\n```\n\n<!-- ::end:framework -->\n\nThis will turn on `intent` preloading by default for all `<Link>` components in your application. You can also set the `preload` prop on individual `<Link>` components to override the default behavior.\n\n## Preload Delay\n\nBy default, preloading will start after **50ms** of the user hovering or touching a `<Link>` component. You can change this delay by setting the `defaultPreloadDelay` option on your router:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  // ...\n  defaultPreloadDelay: 100,\n})\n```\n\n# Solid\n\n```tsx\nimport { createRouter } from '@tanstack/solid-router'\n\nconst router = createRouter({\n  // ...\n  defaultPreloadDelay: 100,\n})\n```\n\n<!-- ::end:framework -->\n\nYou can also set the `preloadDelay` prop on individual `<Link>` components to override the default behavior on a per-link basis.\n\n## Built-in Preloading & `preloadStaleTime`\n\nIf 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.**.\n\nTo change this, you can set the `defaultPreloadStaleTime` option on your router:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  // ...\n  defaultPreloadStaleTime: 10_000,\n})\n```\n\n# Solid\n\n```tsx\nimport { createRouter } from '@tanstack/solid-router'\n\nconst router = createRouter({\n  // ...\n  defaultPreloadStaleTime: 10_000,\n})\n```\n\n<!-- ::end:framework -->\n\nOr, you can use the `routeOptions.preloadStaleTime` option on individual routes:\n\n```tsx\n// src/routes/posts.$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => fetchPost(params.postId),\n  // Preload the route again if the preload cache is older than 10 seconds\n  preloadStaleTime: 10_000,\n})\n```\n\n## Preloading with External Libraries\n\nWhen 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.\n\nTo 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.\n\nFor example:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  // ...\n  defaultPreloadStaleTime: 0,\n})\n```\n\n# Solid\n\n```tsx\nimport { createRouter } from '@tanstack/solid-router'\n\nconst router = createRouter({\n  // ...\n  defaultPreloadStaleTime: 0,\n})\n```\n\n<!-- ::end:framework -->\n\nThis would then allow you, for instance, to use an option like React Query's `staleTime` to control the freshness of your preloads.\n\n## Preloading Manually\n\nIf 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.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nfunction Component() {\n  const router = useRouter()\n\n  useEffect(() => {\n    async function preload() {\n      try {\n        const matches = await router.preloadRoute({\n          to: postRoute,\n          params: { id: 1 },\n        })\n      } catch (err) {\n        // Failed to preload route\n      }\n    }\n\n    preload()\n  }, [router])\n\n  return <div />\n}\n```\n\n# Solid\n\n```tsx\nfunction Component() {\n  const router = useRouter()\n\n  createEffect(() => {\n    async function preload() {\n      try {\n        const matches = await router.preloadRoute({\n          to: postRoute,\n          params: { id: 1 },\n        })\n      } catch (err) {\n        // Failed to preload route\n      }\n    }\n\n    preload()\n  })\n\n  return <div />\n}\n```\n\n<!-- ::end:framework -->\n\nIf you need to preload only the JS chunk of a route, you can use the router's `loadRouteChunk` method. It accepts a route object and returns a promise that resolves when the route chunk is loaded.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nfunction Component() {\n  const router = useRouter()\n\n  useEffect(() => {\n    async function preloadRouteChunks() {\n      try {\n        const postsRoute = router.routesByPath['/posts']\n        await Promise.all([\n          router.loadRouteChunk(router.routesByPath['/']),\n          router.loadRouteChunk(postsRoute),\n          router.loadRouteChunk(postsRoute.parentRoute),\n        ])\n      } catch (err) {\n        // Failed to preload route chunk\n      }\n    }\n\n    preloadRouteChunks()\n  }, [router])\n\n  return <div />\n}\n```\n\n# Solid\n\n```tsx\nfunction Component() {\n  const router = useRouter()\n\n  createEffect(() => {\n    async function preloadRouteChunks() {\n      try {\n        const postsRoute = router.routesByPath['/posts']\n        await Promise.all([\n          router.loadRouteChunk(router.routesByPath['/']),\n          router.loadRouteChunk(postsRoute),\n          router.loadRouteChunk(postsRoute.parentRoute),\n        ])\n      } catch (err) {\n        // Failed to preload route chunk\n      }\n    }\n\n    preloadRouteChunks()\n  })\n\n  return <div />\n}\n```\n\n<!-- ::end:framework -->\n"
  },
  {
    "path": "docs/router/guide/render-optimizations.md",
    "content": "---\ntitle: Render Optimizations\n---\n\nTanStack Router includes several optimizations to ensure your components only re-render when necessary. These optimizations include:\n\n## structural sharing\n\nTanStack Router uses a technique called \"structural sharing\" to preserve as many references as possible between re-renders, which is particularly useful for state stored in the URL, such as search parameters.\n\nFor example, consider a `details` route with two search parameters, `foo` and `bar`, accessed like this:\n\n```tsx\nconst search = Route.useSearch()\n```\n\nWhen only `bar` is changed by navigating from `/details?foo=f1&bar=b1` to `/details?foo=f1&bar=b2`, `search.foo` will be referentially stable and only `search.bar` will be replaced.\n\n## fine-grained selectors\n\nYou can access and subscribe to the router state using various hooks like `useRouterState`, `useSearch`, and others. If you only want a specific component to re-render when a particular subset of the router state such as a subset of the search parameters changes, you can use partial subscriptions with the `select` property.\n\n```tsx\n// component won't re-render when `bar` changes\nconst foo = Route.useSearch({ select: ({ foo }) => foo })\n```\n\n### structural sharing with fine-grained selectors\n\nThe `select` function can perform various calculations on the router state, allowing you to return different types of values, such as objects. For example:\n\n```tsx\nconst result = Route.useSearch({\n  select: (search) => {\n    return {\n      foo: search.foo,\n      hello: `hello ${search.foo}`,\n    }\n  },\n})\n```\n\nAlthough this works, it will cause your component to re-render each time, since `select` is now returning a new object each time it’s called.\n\nYou can avoid this re-rendering issue by using \"structural sharing\" as described above. By default, structural sharing is turned off to maintain backward compatibility, but this may change in v2.\n\nTo enable structural sharing for fine grained selectors, you have two options:\n\n#### Enable it by default in the router options:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  defaultStructuralSharing: true,\n})\n```\n\n#### Enable it per hook usage as shown here:\n\n```tsx\nconst result = Route.useSearch({\n  select: (search) => {\n    return {\n      foo: search.foo,\n      hello: `hello ${search.foo}`,\n    }\n  },\n  structuralSharing: true,\n})\n```\n\n> [!IMPORTANT]\n> Structural sharing only works with JSON-compatible data. This means you cannot use `select` to return items like class instances if structural sharing is enabled.\n\nIn line with TanStack Router's type-safe design, TypeScript will raise an error if you attempt the following:\n\n```tsx\nconst result = Route.useSearch({\n  select: (search) => {\n    return {\n      date: new Date(),\n    }\n  },\n  structuralSharing: true,\n})\n```\n\nIf structural sharing is enabled by default in the router options, you can prevent this error by setting `structuralSharing: false`.\n"
  },
  {
    "path": "docs/router/guide/route-masking.md",
    "content": "---\ntitle: Route Masking\n---\n\nRoute masking is a way to mask the actual URL of a route that gets persisted to the browser's history and URL bar. This is useful for scenarios where you want to show a different URL than the one that is actually being navigated to and then falling back to the displayed URL when it is shared and (optionally) when the page is reloaded. Here's a few examples:\n\n- Navigating to a modal route like `/photo/5/modal`, but masking the actual URL as `/photos/5`\n- Navigating to a modal route like `/post/5/comments`, but masking the actual URL as `/posts/5`\n- Navigating to a route with the search param `?showLogin=true`, but masking the URL to _not_ contain the search param\n- Navigating to a route with the search param `?modal=settings`, but masking the URL as `/settings'\n\nEach of these scenarios can be achieved with route masking and even extended to support more advanced patterns like [parallel routes](./parallel-routes.md).\n\n## How does route masking work?\n\n> [!IMPORTANT]\n> You **do not** need to understand how route masking works in order to use it. This section is for those who are curious about how it works under the hood. Skip to [How do I use route masking?](#how-do-i-use-route-masking) to learn how to use it!.\n\nRoute masking utilizes the `location.state` API to store the desired runtime location inside of the location that will get written to the URL. It stores this runtime location under the `__tempLocation` state property:\n\n```tsx\nconst location = {\n  pathname: '/photos/5',\n  search: '',\n  hash: '',\n  state: {\n    key: 'wesdfs',\n    __tempKey: 'sadfasd',\n    __tempLocation: {\n      pathname: '/photo/5/modal',\n      search: '',\n      hash: '',\n      state: {},\n    },\n  },\n}\n```\n\nWhen the router parses a location from history with the `location.state.__tempLocation` property, it will use that location instead of the one that was parsed from the URL. This allows you to navigate to a route like `/photos/5` and have the router actually navigate to `/photo/5/modal` instead. When this happens, the history location is saved back into the `location.maskedLocation` property, just in case we need to know what the **actual URL** is. One example of where this is used is in the Devtools where we detect if a route is masked and show the actual URL instead of the masked one!\n\nRemember, you don't need to worry about any of this. It's all handled for you automatically under the hood!\n\n## How do I use route masking?\n\nRoute masking is a simple API that can be used in 2 ways:\n\n- Imperatively via the `mask` option available on the `<Link>` and `navigate()` APIs\n- Declaratively via the Router's `routeMasks` option\n\nWhen using either route masking APIs, the `mask` option accepts the same navigation object that the `<Link>` and `navigate()` APIs accept. This means you can use the same `to`, `replace`, `state`, and `search` options that you're already familiar with. The only difference is that the `mask` option will be used to mask the URL of the route being navigated to.\n\n> 🧠 The mask option is also **type-safe**! This means that if you're using TypeScript, you'll get type errors if you try to pass an invalid navigation object to the `mask` option. Booyah!\n\n### Imperative route masking\n\nThe `<Link>` 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 `<Link>` component:\n\n```tsx\n<Link\n  to=\"/photos/$photoId/modal\"\n  params={{ photoId: 5 }}\n  mask={{\n    to: '/photos/$photoId',\n    params: {\n      photoId: 5,\n    },\n  }}\n>\n  Open Photo\n</Link>\n```\n\nAnd here's an example of using it with the `navigate()` API:\n\n```tsx\nconst navigate = useNavigate()\n\nfunction onOpenPhoto() {\n  navigate({\n    to: '/photos/$photoId/modal',\n    params: { photoId: 5 },\n    mask: {\n      to: '/photos/$photoId',\n      params: {\n        photoId: 5,\n      },\n    },\n  })\n}\n```\n\n### Declarative route masking\n\nIn 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 `<Link>` 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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRouteMask } from '@tanstack/react-router'\n\nconst photoModalToPhotoMask = createRouteMask({\n  routeTree,\n  from: '/photos/$photoId/modal',\n  to: '/photos/$photoId',\n  params: (prev) => ({\n    photoId: prev.photoId,\n  }),\n})\n\nconst router = createRouter({\n  routeTree,\n  routeMasks: [photoModalToPhotoMask],\n})\n```\n\n# Solid\n\n```tsx\nimport { createRouteMask } from '@tanstack/solid-router'\n\nconst photoModalToPhotoMask = createRouteMask({\n  routeTree,\n  from: '/photos/$photoId/modal',\n  to: '/photos/$photoId',\n  params: (prev) => ({\n    photoId: prev.photoId,\n  }),\n})\n\nconst router = createRouter({\n  routeTree,\n  routeMasks: [photoModalToPhotoMask],\n})\n```\n\n<!-- ::end:framework -->\n\nWhen creating a route mask, you'll need to pass 1 argument with at least:\n\n- `routeTree` - The route tree that the route mask will be applied to\n- `from` - The route ID that the route mask will be applied to\n- `...navigateOptions` - The standard `to`, `search`, `params`, `replace`, etc options that the `<Link>` and `navigate()` APIs accept\n\n> 🧠 The `createRouteMask` option is also **type-safe**! This means that if you're using TypeScript, you'll get type errors if you try to pass an invalid route mask to the `routeMasks` option.\n\n## Unmasking when sharing the URL\n\nURLs are automatically unmasked when they are shared since as soon as a URL is detached from your browsers local history stack, the URL masking data is no longer available. Essentially, as soon as you copy and paste a URL out of your history, its masking data is lost... after all, that's the point of masking a URL!\n\n## Local Unmasking Defaults\n\n**By default, URLs are not unmasked when the page is reloaded locally**. Masking data is stored in the `location.state` property of the history location, so as long as the history location is still in memory in your history stack, the masking data will be available and the URL will continue to be masked.\n\n## Unmasking on page reload\n\n**As stated above, URLs are not unmasked when the page is reloaded by default**.\n\nIf you want to unmask a URL locally when the page is reloaded, you have 3 options, each overriding the previous one in priority if passed:\n\n- Set the Router's default `unmaskOnReload` option to `true`\n- Return the `unmaskOnReload: true` option from the masking function when creating a route mask with `createRouteMask()`\n- Pass the `unmaskOnReload: true` option to the `<Link`> component or `navigate()` API\n"
  },
  {
    "path": "docs/router/guide/router-context.md",
    "content": "---\ntitle: Router Context\n---\n\nTanStack 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:\n\n- Dependency Injection\n  - 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.\n- Breadcrumbs\n  - 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.\n- Dynamic meta tag management\n  - 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.\n\nThese are just suggested uses of the router context. You can use it for whatever you want!\n\n## Typed Router Context\n\nLike 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<YourContextTypeHere>()(routeOptions)` function to create a new router context instead of the `createRootRoute()` function to create your root route. Here's an example:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport {\n  createRootRouteWithContext,\n  createRouter,\n} from '@tanstack/react-router'\n\ninterface MyRouterContext {\n  user: User\n}\n\n// Use the routerContext to create your root route\nconst rootRoute = createRootRouteWithContext<MyRouterContext>()({\n  component: App,\n})\n\nconst routeTree = rootRoute.addChildren([\n  // ...\n])\n\n// Use the routerContext to create your router\nconst router = createRouter({\n  routeTree,\n})\n```\n\n# Solid\n\n```tsx\nimport {\n  createRootRouteWithContext,\n  createRouter,\n} from '@tanstack/solid-router'\n\ninterface MyRouterContext {\n  user: User\n}\n\n// Use the routerContext to create your root route\nconst rootRoute = createRootRouteWithContext<MyRouterContext>()({\n  component: App,\n})\n\nconst routeTree = rootRoute.addChildren([\n  // ...\n])\n\n// Use the routerContext to create your router\nconst router = createRouter({\n  routeTree,\n})\n```\n\n<!-- ::end:framework -->\n\n> [!TIP]\n> `MyRouterContext` only needs to contain content that will be passed directly to `createRouter` below. All other context added in `beforeLoad` will be inferred.\n\n## Passing the initial Router Context\n\nThe router context is passed to the router at instantiation time. You can pass the initial router context to the router via the `context` option:\n\n> [!TIP]\n> 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 `{}`.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\n// Use the routerContext you created to create your router\nconst router = createRouter({\n  routeTree,\n  context: {\n    user: {\n      id: '123',\n      name: 'John Doe',\n    },\n  },\n})\n```\n\n# Solid\n\n```tsx\nimport { createRouter } from '@tanstack/solid-router'\n\n// Use the routerContext you created to create your router\nconst router = createRouter({\n  routeTree,\n  context: {\n    user: {\n      id: '123',\n      name: 'John Doe',\n    },\n  },\n})\n```\n\n<!-- ::end:framework -->\n\n### Invalidating the Router Context\n\nIf 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.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nfunction useAuth() {\n  const router = useRouter()\n  const [user, setUser] = useState<User | null>(null)\n\n  useEffect(() => {\n    const unsubscribe = auth.onAuthStateChanged((user) => {\n      setUser(user)\n      router.invalidate()\n    })\n\n    return unsubscribe\n  }, [])\n\n  return user\n}\n```\n\n# Solid\n\n```tsx\nfunction useAuth() {\n  const router = useRouter()\n  const [user, setUser] = createSignal<User | null>(null)\n\n  createEffect(() => {\n    const unsubscribe = auth.onAuthStateChanged((user) => {\n      setUser(user)\n      router.invalidate()\n    })\n\n    return unsubscribe\n  }, [])\n\n  return user()\n}\n```\n\n<!-- ::end:framework -->\n\n## Using the Router Context\n\nOnce you have defined the router context type, you can use it in your route definitions:\n\n```tsx\n// src/routes/todos.tsx\nexport const Route = createFileRoute('/todos')({\n  component: Todos,\n  loader: ({ context }) => fetchTodosByUserId(context.user.id),\n})\n```\n\nYou can even inject data fetching and mutation implementations themselves! In fact, this is highly recommended 😜\n\nLet's try this with a simple function to fetch some todos:\n\n```tsx\nconst fetchTodosByUserId = async ({ userId }) => {\n  const response = await fetch(`/api/todos?userId=${userId}`)\n  const data = await response.json()\n  return data\n}\n\nconst router = createRouter({\n  routeTree: rootRoute,\n  context: {\n    userId: '123',\n    fetchTodosByUserId,\n  },\n})\n```\n\nThen, in your route:\n\n```tsx\n// src/routes/todos.tsx\nexport const Route = createFileRoute('/todos')({\n  component: Todos,\n  loader: ({ context }) => context.fetchTodosByUserId(context.userId),\n})\n```\n\n### How about an external data fetching library?\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport {\n  createRootRouteWithContext,\n  createRouter,\n} from '@tanstack/react-router'\n\ninterface MyRouterContext {\n  queryClient: QueryClient\n}\n\nconst rootRoute = createRootRouteWithContext<MyRouterContext>()({\n  component: App,\n})\n\nconst queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree: rootRoute,\n  context: {\n    queryClient,\n  },\n})\n```\n\n# Solid\n\n```tsx\nimport {\n  createRootRouteWithContext,\n  createRouter,\n} from '@tanstack/solid-router'\n\ninterface MyRouterContext {\n  queryClient: QueryClient\n}\n\nconst rootRoute = createRootRouteWithContext<MyRouterContext>()({\n  component: App,\n})\n\nconst queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree: rootRoute,\n  context: {\n    queryClient,\n  },\n})\n```\n\n<!-- ::end:framework -->\n\nThen, in your route:\n\n```tsx\n// src/routes/todos.tsx\nexport const Route = createFileRoute('/todos')({\n  component: Todos,\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData({\n      queryKey: ['todos', { userId: user.id }],\n      queryFn: fetchTodos,\n    })\n  },\n})\n```\n\n<!-- ::start:framework -->\n\n# React\n\n## How about using React Context/Hooks?\n\nWhen 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.\n\nSo, 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.\n\nLet's look at the setup for an example, where we pass down a `useNetworkStrength` hook to our route's `loader` function:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\n// First, make sure the context for the root route is typed\nimport { createRootRouteWithContext } from '@tanstack/react-router'\nimport { useNetworkStrength } from '@/hooks/useNetworkStrength'\n\ninterface MyRouterContext {\n  networkStrength: ReturnType<typeof useNetworkStrength>\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: App,\n})\n```\n\n<!-- ::end:tabs -->\n\nIn this example, we'd instantiate the hook before rendering the router using the `<RouterProvider />`. This way, the hook would be called in React-land, therefore adhering to the Rules of Hooks.\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/router.tsx\"\nimport { createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\n\nexport const router = createRouter({\n  routeTree,\n  context: {\n    networkStrength: undefined!, // We'll set this in React-land\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\nThen, we can call the `useNetworkStrength` hook in our `App` component and pass the returned value into the router context via the `<RouterProvider />`:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/main.tsx\"\nimport { RouterProvider } from '@tanstack/react-router'\nimport { router } from './router'\n\nimport { useNetworkStrength } from '@/hooks/useNetworkStrength'\n\nfunction App() {\n  const networkStrength = useNetworkStrength()\n  // Inject the returned value from the hook into the router context\n  return <RouterProvider router={router} context={{ networkStrength }} />\n}\n\n// ...\n```\n\n<!-- ::end:tabs -->\n\nSo, now in our route's `loader` function, we can access the `networkStrength` hook from the router context:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  component: Posts,\n  loader: ({ context }) => {\n    if (context.networkStrength === 'STRONG') {\n      // Do something\n    }\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n## Modifying the Router Context\n\nThe 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:\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\nimport { createRootRouteWithContext } from '@tanstack/react-router'\n\ninterface MyRouterContext {\n  foo: boolean\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: App,\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/router.tsx\"\nimport { createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  context: {\n    foo: true,\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/todos.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/todos')({\n  component: Todos,\n  beforeLoad: () => {\n    return {\n      bar: true,\n    }\n  },\n  loader: ({ context }) => {\n    context.foo // true\n    context.bar // true\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\nimport { createRootRouteWithContext } from '@tanstack/solid-router'\n\ninterface MyRouterContext {\n  foo: boolean\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: App,\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/router.tsx\"\nimport { createRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  context: {\n    foo: true,\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/todos.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/todos')({\n  component: Todos,\n  beforeLoad: () => {\n    return {\n      bar: true,\n    }\n  },\n  loader: ({ context }) => {\n    context.foo // true\n    context.bar // true\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n## Processing Accumulated Route Context\n\nContext, 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:\n\n```tsx title=\"src/routes/__root.tsx\"\nexport const Route = createRootRoute({\n  component: () => {\n    const matches = useRouterState({ select: (s) => s.matches })\n\n    const breadcrumbs = matches\n      .filter((match) => match.context.getTitle)\n      .map(({ pathname, context }) => {\n        return {\n          title: context.getTitle(),\n          path: pathname,\n        }\n      })\n\n    // ...\n  },\n})\n```\n\nUsing that same route context, we could also generate a title tag for our page's `<head>`:\n\n```tsx title=\"src/routes/__root.tsx\"\nexport const Route = createRootRoute({\n  component: () => {\n    const matches = useRouterState({ select: (s) => s.matches })\n\n    const matchWithTitle = [...matches]\n      .reverse()\n      .find((d) => d.context.getTitle)\n\n    const title = matchWithTitle?.context.getTitle() || 'My App'\n\n    return (\n      <html>\n        <head>\n          <title>{title}</title>\n        </head>\n        <body>{/* ... */}</body>\n      </html>\n    )\n  },\n})\n```\n"
  },
  {
    "path": "docs/router/guide/scroll-restoration.md",
    "content": "---\nid: scroll-restoration\ntitle: Scroll Restoration\n---\n\n## Hash/Top-of-Page Scrolling\n\nOut of the box, TanStack Router supports both **hash scrolling** and **top-of-page scrolling** without any additional configuration.\n\n## Scroll-to-top & Nested Scrollable Areas\n\nBy default, scroll-to-top mimics the behavior of the browser, which means only the `window` itself is scrolled to the top after successful navigation. For many apps however, it's common for the main scrollable area to be a nested div or similar because of advanced layouts. If you would like TanStack Router to also scroll these main scrollable areas for you, you can add selectors to target them using the `routerOptions.scrollToTopSelectors`:\n\n```tsx\nconst router = createRouter({\n  scrollToTopSelectors: ['#main-scrollable-area'],\n})\n```\n\nFor complex selectors that cannot be simply resolved using `document.querySelector(selector)`, you can pass functions that return HTML elements to `routerOptions.scrollToTopSelectors`:\n\n```tsx\nconst selector = () =>\n  document\n    .querySelector('#shadowRootParent')\n    ?.shadowRoot?.querySelector('#main-scrollable-area')\n\nconst router = createRouter({\n  scrollToTopSelectors: [selector],\n})\n```\n\nThese selectors are handled **in addition to `window`** which cannot be disabled currently.\n\n## Scroll Restoration\n\nScroll 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:\n\n- SPAs typically use the `history.pushState` API for navigation, so the browser doesn't know to restore the scroll position natively\n- SPAs sometimes render content asynchronously, so the browser doesn't know the height of the page until after it's rendered\n- SPAs can sometimes use nested scrollable containers to force specific layouts and features.\n\nNot 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.\n\nTo 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.\n\nIt does this by:\n\n- Monitoring the DOM for scroll events\n- Registering scrollable areas with the scroll restoration cache\n- Listening to the proper router events to know when to cache and restore scroll positions\n- Storing scroll positions for each scrollable area in the cache (including `window` and `body`)\n- Restoring scroll positions after successful navigations before DOM paint\n\nThat may sound like a lot, but for you, it's as simple as this:\n\n```tsx\nconst router = createRouter({\n  scrollRestoration: true,\n})\n```\n\n> [!NOTE]\n> The `<ScrollRestoration />` component still works, but has been deprecated.\n\n## Custom Cache Keys\n\nFalling 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.\n\nThe `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.\n\nThe default `getKey` is `(location) => location.state.__TSR_key!`, where `__TSR_key` is the unique key generated for each entry in the history.\n\n> Older versions, prior to `v1.121.34`, used `state.key` as the default key, but this has been deprecated in favor of `state.__TSR_key`. For now, `location.state.key` will still be available for compatibility, but it will be removed in the next major version.\n\n## Examples\n\nYou could sync scrolling to the pathname:\n\n```tsx\nconst router = createRouter({\n  getScrollRestorationKey: (location) => location.pathname,\n})\n```\n\nYou can conditionally sync only some paths, then use the key for the rest:\n\n```tsx\nconst router = createRouter({\n  getScrollRestorationKey: (location) => {\n    const paths = ['/', '/chat']\n    return paths.includes(location.pathname)\n      ? location.pathname\n      : location.state.__TSR_key!\n  },\n})\n```\n\n## Preventing Scroll Restoration\n\nSometimes you may want to prevent scroll restoration from happening. To do this you can utilize the `resetScroll` option available on the following APIs:\n\n- `<Link resetScroll={false}>`\n- `navigate({ resetScroll: false })`\n- `redirect({ resetScroll: false })`\n\nWhen `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).\n\n## Manual Scroll Restoration\n\nMost 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**.\n\nTo manually control scroll restoration for virtualized lists within the whole browser window:\n\n```tsx\nfunction Component() {\n  const scrollEntry = useElementScrollRestoration({\n    getElement: () => window,\n  })\n\n  // Let's use TanStack Virtual to virtualize some content!\n  const virtualizer = useWindowVirtualizer({\n    count: 10000,\n    estimateSize: () => 100,\n    // We pass the scrollY from the scroll restoration entry to the virtualizer\n    // as the initial offset\n    initialOffset: scrollEntry?.scrollY,\n  })\n\n  return (\n    <div>\n      {virtualizer.getVirtualItems().map(item => (\n        ...\n      ))}\n    </div>\n  )\n}\n```\n\nTo manually control scroll restoration for a specific element, you can use the `useElementScrollRestoration` hook and the `data-scroll-restoration-id` DOM attribute:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nfunction Component() {\n  // We need a unique ID for manual scroll restoration on a specific element\n  // It should be as unique as possible for this element across your app\n  const scrollRestorationId = 'myVirtualizedContent'\n\n  // We use that ID to get the scroll entry for this element\n  const scrollEntry = useElementScrollRestoration({\n    id: scrollRestorationId,\n  })\n\n  // Let's use TanStack Virtual to virtualize some content!\n  const virtualizerParentRef = React.useRef<HTMLDivElement>(null)\n  const virtualizer = useVirtualizer({\n    count: 10000,\n    getScrollElement: () => virtualizerParentRef.current,\n    estimateSize: () => 100,\n    // We pass the scrollY from the scroll restoration entry to the virtualizer\n    // as the initial offset\n    initialOffset: scrollEntry?.scrollY,\n  })\n\n  return (\n    <div\n      ref={virtualizerParentRef}\n      // We pass the scroll restoration ID to the element\n      // as a custom attribute that will get picked up by the\n      // scroll restoration watcher\n      data-scroll-restoration-id={scrollRestorationId}\n      className=\"flex-1 border rounded-lg overflow-auto relative\"\n    >\n      ...\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx\nfunction Component() {\n  // We need a unique ID for manual scroll restoration on a specific element\n  // It should be as unique as possible for this element across your app\n  const scrollRestorationId = 'myVirtualizedContent'\n\n  // We use that ID to get the scroll entry for this element\n  const scrollEntry = useElementScrollRestoration({\n    id: scrollRestorationId,\n  })\n\n  // Let's use TanStack Virtual to virtualize some content!\n  let virtualizerParentRef: any\n  const virtualizer = createVirtualizer({\n    count: 10000,\n    getScrollElement: () => virtualizerParentRef,\n    estimateSize: () => 100,\n    // We pass the scrollY from the scroll restoration entry to the virtualizer\n    // as the initial offset\n    initialOffset: scrollEntry?.scrollY,\n  })\n\n  return (\n    <div\n      ref={virtualizerParentRef}\n      // We pass the scroll restoration ID to the element\n      // as a custom attribute that will get picked up by the\n      // scroll restoration watcher\n      data-scroll-restoration-id={scrollRestorationId}\n      class=\"flex-1 border rounded-lg overflow-auto relative\"\n    >\n      ...\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n## Scroll Behavior\n\nTo control the scroll behavior when navigating between pages, you can use the `scrollRestorationBehavior` option. This allows you to make the transition between pages instant instead of a smooth scroll. The global configuration of scroll restoration behavior has the same options as those supported by the browser, which are `smooth`, `instant`, and `auto` (see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView#behavior) for more information).\n\n```tsx\nconst router = createRouter({\n  scrollRestorationBehavior: 'instant',\n})\n```\n"
  },
  {
    "path": "docs/router/guide/search-params.md",
    "content": "---\ntitle: Search Params\n---\n\nSimilar to how TanStack Query made handling server-state in your React and Solid applications a breeze, TanStack Router aims to unlock the power of URL search params in your applications.\n\n> 🧠 If you are on a really old browser, like IE11, you may need to use a polyfill for `URLSearchParams`.\n\n## Why not just use `URLSearchParams`?\n\nWe 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.\n\nTraditional Search Param APIs usually assume a few things:\n\n- Search params are always strings\n- They are _mostly_ flat\n- Serializing and deserializing using `URLSearchParams` is good enough (Spoiler alert: it's not.)\n- Search params modifications are tightly coupled with the URL's pathname and must be updated together, even if the pathname is not changing.\n\nReality is very different from these assumptions though.\n\n- 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.\n- 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`.\n- 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.\n- 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.\n\n## Search Params, the \"OG\" State Manager\n\nYou'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:\n\n- Users should be able to:\n  - Cmd/Ctrl + Click to open a link in a new tab and reliably see the state they expected\n  - Bookmark and share links from your application with others with assurances that they will see exactly the state as when the link was copied.\n  - Refresh your app or navigate back and forth between pages without losing their state\n- Developers should be able to easily:\n  - Add, remove or modify state in the URL with the same great DX as other state managers\n  - Easily validate search params coming from the URL in a format and type that is safe for their application to consume\n  - Read and write to search params without having to worry about the underlying serialization format\n\n## JSON-first Search Params\n\nTo 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.\n\nFor example, navigating to the following route:\n\n```tsx\nconst link = (\n  <Link\n    to=\"/shop\"\n    search={{\n      pageIndex: 3,\n      includeCategories: ['electronics', 'gifts'],\n      sortBy: 'price',\n      desc: true,\n    }}\n  />\n)\n```\n\nWill result in the following URL:\n\n```\n/shop?pageIndex=3&includeCategories=%5B%22electronics%22%2C%22gifts%22%5D&sortBy=price&desc=true\n```\n\nWhen this URL is parsed, the search params will be accurately converted back to the following JSON:\n\n```json\n{\n  \"pageIndex\": 3,\n  \"includeCategories\": [\"electronics\", \"gifts\"],\n  \"sortBy\": \"price\",\n  \"desc\": true\n}\n```\n\nIf you noticed, there are a few things going on here:\n\n- The first level of the search params is flat and string based, just like `URLSearchParams`.\n- First level values that are not strings are accurately preserved as actual numbers and booleans.\n- Nested data structures are automatically converted to URL-safe JSON strings\n\n> 🧠 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.\n\n## Validating and Typing Search Params\n\nDespite 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.\n\n### Enter Validation + TypeScript!\n\nTanStack Router provides convenient APIs for validating and typing search params. This all starts with the `Route`'s `validateSearch` option:\n\n```tsx title=\"src/routes/shop/products.tsx\"\ntype ProductSearchSortOptions = 'newest' | 'oldest' | 'price'\n\ntype ProductSearch = {\n  page: number\n  filter: string\n  sort: ProductSearchSortOptions\n}\n\nexport const Route = createFileRoute('/shop/products')({\n  validateSearch: (search: Record<string, unknown>): ProductSearch => {\n    // validate and parse the search params into a typed state\n    return {\n      page: Number(search?.page ?? 1),\n      filter: (search.filter as string) || '',\n      sort: (search.sort as ProductSearchSortOptions) || 'newest',\n    }\n  },\n})\n```\n\nIn the above example, we're validating the search params of the `Route` and returning a typed `ProductSearch` object. This typed object is then made available to this route's other options **and any child routes, too!**\n\n### Validating Search Params\n\nThe `validateSearch` option is a function that is provided the JSON parsed (but non-validated) search params as a `Record<string, unknown>` 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.\n\nHere's an example:\n\n```tsx title=\"src/routes/shop/products.tsx\"\ntype ProductSearchSortOptions = 'newest' | 'oldest' | 'price'\n\ntype ProductSearch = {\n  page: number\n  filter: string\n  sort: ProductSearchSortOptions\n}\n\nexport const Route = createFileRoute('/shop/products')({\n  validateSearch: (search: Record<string, unknown>): ProductSearch => {\n    // validate and parse the search params into a typed state\n    return {\n      page: Number(search?.page ?? 1),\n      filter: (search.filter as string) || '',\n      sort: (search.sort as ProductSearchSortOptions) || 'newest',\n    }\n  },\n})\n```\n\nHere'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:\n\n```tsx title=\"src/routes/shop/products.tsx\"\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  page: z.number().catch(1),\n  filter: z.string().catch(''),\n  sort: z.enum(['newest', 'oldest', 'price']).catch('newest'),\n})\n\ntype ProductSearch = z.infer<typeof productSearchSchema>\n\nexport const Route = createFileRoute('/shop/products')({\n  validateSearch: (search) => productSearchSchema.parse(search),\n})\n```\n\nBecause `validateSearch` also accepts an object with the `parse` property, this can be shortened to:\n\n```tsx\nvalidateSearch: productSearchSchema\n```\n\nIn 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()`.\n\nThe 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.\n\n#### Adapters\n\nWhen 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.\n\n```tsx\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  page: z.number().default(1),\n  filter: z.string().default(''),\n  sort: z.enum(['newest', 'oldest', 'price']).default('newest'),\n})\n\nexport const Route = createFileRoute('/shop/products/')({\n  validateSearch: productSearchSchema,\n})\n```\n\nIt 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.\n\n```tsx\n<Link to=\"/shop/products\" />\n```\n\nFor validation libraries we recommend using adapters which infer the correct `input` and `output` types.\n\n### Zod\n\nAn adapter is provided for [Zod](https://zod.dev/) which will pipe through the correct `input` type and `output` type.\n\nFor Zod v3:\n\n```tsx\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  page: z.number().default(1),\n  filter: z.string().default(''),\n  sort: z.enum(['newest', 'oldest', 'price']).default('newest'),\n})\n\nexport const Route = createFileRoute('/shop/products/')({\n  validateSearch: zodValidator(productSearchSchema),\n})\n```\n\nWith Zod v4, you should directly use the schema in `validateSearch`:\n\n```tsx\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  page: z.number().default(1),\n  filter: z.string().default(''),\n  sort: z.enum(['newest', 'oldest', 'price']).default('newest'),\n})\n\nexport const Route = createFileRoute('/shop/products/')({\n  // With Zod v4, we can use the schema without the adapter\n  validateSearch: productSearchSchema,\n})\n```\n\nThe important part here is the following use of `Link` no longer requires `search` params:\n\n```tsx\n<Link to=\"/shop/products\" />\n```\n\nIn Zod v3, 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:\n\n```tsx\nimport { fallback, zodValidator } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  page: fallback(z.number(), 1).default(1),\n  filter: fallback(z.string(), '').default(''),\n  sort: fallback(z.enum(['newest', 'oldest', 'price']), 'newest').default(\n    'newest',\n  ),\n})\n\nexport const Route = createFileRoute('/shop/products/')({\n  validateSearch: zodValidator(productSearchSchema),\n})\n```\n\nTherefore when navigating to this route, `search` is optional and retains the correct types.\n\nIn Zod v4, schemas may use `catch` instead of the fallback and will retain type inference throughout.\n\nWhile not recommended, it is also possible to configure `input` and `output` type in case the `output` type is more accurate than the `input` type:\n\n```tsx\nconst productSearchSchema = z.object({\n  page: fallback(z.number(), 1).default(1),\n  filter: fallback(z.string(), '').default(''),\n  sort: fallback(z.enum(['newest', 'oldest', 'price']), 'newest').default(\n    'newest',\n  ),\n})\n\nexport const Route = createFileRoute('/shop/products/')({\n  validateSearch: zodValidator({\n    schema: productSearchSchema,\n    input: 'output',\n    output: 'input',\n  }),\n})\n```\n\nThis provides flexibility in which type you want to infer for navigation and which types you want to infer for reading search params.\n\n### Valibot\n\n> [!WARNING]\n> Router expects the valibot 1.0 package to be installed.\n\nWhen using [Valibot](https://valibot.dev/) an adapter is not needed to ensure the correct `input` and `output` types are used for navigation and reading search params. This is because `valibot` implements [Standard Schema](https://github.com/standard-schema/standard-schema)\n\n```tsx\nimport * as v from 'valibot'\n\nconst productSearchSchema = v.object({\n  page: v.optional(v.fallback(v.number(), 1), 1),\n  filter: v.optional(v.fallback(v.string(), ''), ''),\n  sort: v.optional(\n    v.fallback(v.picklist(['newest', 'oldest', 'price']), 'newest'),\n    'newest',\n  ),\n})\n\nexport const Route = createFileRoute('/shop/products/')({\n  validateSearch: productSearchSchema,\n})\n```\n\n### Arktype\n\n> [!WARNING]\n> Router expects the arktype 2.0-rc package to be installed.\n\nWhen using [ArkType](https://arktype.io/) an adapter is not needed to ensure the correct `input` and `output` types are used for navigation and reading search params. This is because [ArkType](https://arktype.io/) implements [Standard Schema](https://github.com/standard-schema/standard-schema)\n\n```tsx\nimport { type } from 'arktype'\n\nconst productSearchSchema = type({\n  page: 'number = 1',\n  filter: 'string = \"\"',\n  sort: '\"newest\" | \"oldest\" | \"price\" = \"newest\"',\n})\n\nexport const Route = createFileRoute('/shop/products/')({\n  validateSearch: productSearchSchema,\n})\n```\n\n### Effect/Schema\n\nWhen using [Effect/Schema](https://effect.website/docs/schema/introduction/) an adapter is not needed to ensure the correct `input` and `output` types are used for navigation and reading search params. This is because [Effect/Schema](https://effect.website/docs/schema/standard-schema/) implements [Standard Schema](https://github.com/standard-schema/standard-schema)\n\n```tsx\nimport { Schema as S } from 'effect'\n\nconst productSearchSchema = S.standardSchemaV1(\n  S.Struct({\n    page: S.NumberFromString.pipe(\n      S.optional,\n      S.withDefaults({\n        constructor: () => 1,\n        decoding: () => 1,\n      }),\n    ),\n    filter: S.String.pipe(\n      S.optional,\n      S.withDefaults({\n        constructor: () => '',\n        decoding: () => '',\n      }),\n    ),\n    sort: S.Literal('newest', 'oldest', 'price').pipe(\n      S.optional,\n      S.withDefaults({\n        constructor: () => 'newest' as const,\n        decoding: () => 'newest' as const,\n      }),\n    ),\n  }),\n)\n\nexport const Route = createFileRoute('/shop/products/')({\n  validateSearch: productSearchSchema,\n})\n```\n\n## Reading Search Params\n\nOnce 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.\n\n### Using Search Params in Loaders\n\nPlease 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.\n\n### Search Params are inherited from Parent Routes\n\nThe 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:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/shop/products.tsx\"\nconst productSearchSchema = z.object({\n  page: z.number().catch(1),\n  filter: z.string().catch(''),\n  sort: z.enum(['newest', 'oldest', 'price']).catch('newest'),\n})\n\ntype ProductSearch = z.infer<typeof productSearchSchema>\n\nexport const Route = createFileRoute('/shop/products')({\n  validateSearch: productSearchSchema,\n})\n```\n\n```tsx title=\"src/routes/shop/products/$productId.tsx\"\nexport const Route = createFileRoute('/shop/products/$productId')({\n  beforeLoad: ({ search }) => {\n    search\n    // ^? ProductSearch ✅\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n### Search Params in Components\n\nYou can access your route's validated search params in your route's `component` via the `useSearch` hook.\n\n```tsx title=\"src/routes/shop/products.tsx\"\nexport const Route = createFileRoute('/shop/products')({\n  validateSearch: productSearchSchema,\n})\n\nconst ProductList = () => {\n  const { page, filter, sort } = Route.useSearch()\n\n  return <div>...</div>\n}\n```\n\n> [!TIP]\n> 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 import the `Route` configuration to get access to the typed `useSearch()` hook.\n\n### Search Params outside of Route Components\n\nYou 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:\n\n```tsx\n// src/routes/shop.products.tsx\nexport const Route = createFileRoute('/shop/products')({\n  validateSearch: productSearchSchema,\n  // ...\n})\n\n// Somewhere else...\n\n// src/components/product-list-sidebar.tsx\nconst routeApi = getRouteApi('/shop/products')\n\nconst ProductList = () => {\n  const routeSearch = routeApi.useSearch()\n\n  // OR\n\n  const { page, filter, sort } = useSearch({\n    from: Route.fullPath,\n  })\n\n  return <div>...</div>\n}\n```\n\nOr, you can loosen up the type-safety and get an optional `search` object by passing `strict: false`:\n\n```tsx\nfunction ProductList() {\n  const search = useSearch({\n    strict: false,\n  })\n  // {\n  //   page: number | undefined\n  //   filter: string | undefined\n  //   sort: 'newest' | 'oldest' | 'price' | undefined\n  // }\n\n  return <div>...</div>\n}\n```\n\n## Writing Search Params\n\nNow 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\n\n### `<Link search />`\n\nThe best way to update search params is to use the `search` prop on the `<Link />` component.\n\nIf the search for the current page shall be updated and the `from` prop is specified, the `to` prop can be omitted.\nHere's an example:\n\n```tsx title=\"src/routes/shop/products.tsx\"\nexport const Route = createFileRoute('/shop/products')({\n  validateSearch: productSearchSchema,\n})\n\nconst ProductList = () => {\n  return (\n    <div>\n      <Link from={Route.fullPath} search={(prev) => ({ page: prev.page + 1 })}>\n        Next Page\n      </Link>\n    </div>\n  )\n}\n```\n\nIf you want to update the search params in a generic component that is rendered on multiple routes, specifying `from` can be challenging.\n\nIn this scenario you can set `to=\".\"` which will give you access to loosely typed search params.\nHere is an example that illustrates this:\n\n```tsx\n// `page` is a search param that is defined in the __root route and hence available on all routes.\nconst PageSelector = () => {\n  return (\n    <div>\n      <Link to=\".\" search={(prev) => ({ ...prev, page: prev.page + 1 })}>\n        Next Page\n      </Link>\n    </div>\n  )\n}\n```\n\nIf the generic component is only rendered in a specific subtree of the route tree, you can specify that subtree using `from`. Here you can omit `to='.'` if you want.\n\n```tsx\n// `page` is a search param that is defined in the /posts route and hence available on all of its child routes.\nconst PageSelector = () => {\n  return (\n    <div>\n      <Link\n        from=\"/posts\"\n        to=\".\"\n        search={(prev) => ({ ...prev, page: prev.page + 1 })}\n      >\n        Next Page\n      </Link>\n    </div>\n  )\n```\n\n### `useNavigate(), navigate({ search })`\n\nThe `navigate` function also accepts a `search` option that works the same way as the `search` prop on `<Link />`:\n\n```tsx title=\"src/routes/shop/products.tsx\"\nexport const Route = createFileRoute('/shop/products/$productId')({\n  validateSearch: productSearchSchema,\n})\n\nconst ProductList = () => {\n  const navigate = useNavigate({ from: Route.fullPath })\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          navigate({\n            search: (prev) => ({ page: prev.page + 1 }),\n          })\n        }}\n      >\n        Next Page\n      </button>\n    </div>\n  )\n}\n```\n\n### `router.navigate({ search })`\n\nThe `router.navigate` function works exactly the same way as the `useNavigate`/`navigate` hook/function above.\n\n### `<Navigate search />`\n\nThe `<Navigate search />` component works exactly the same way as the `useNavigate`/`navigate` hook/function above, but accepts its options as props instead of a function argument.\n\n## Transforming search with search middlewares\n\nWhen link hrefs are built, by default the only thing that matters for the query string part is the `search` property of a `<Link>`.\n\nTanStack Router provides a way to manipulate search params before the href is generated via **search middlewares**.\nSearch middlewares are functions that transform the search parameters when generating new links for a route or its descendants.\nThey are also executed upon navigation after search validation to allow manipulation of the query string.\n\nThe following example shows how to make sure that for **every** link that is being built, the `rootValue` search param is added _if_ it is part of the current search params. If a link specifies `rootValue` inside `search`, then that value is used for building the link.\n\n```tsx\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst searchSchema = z.object({\n  rootValue: z.string().optional(),\n})\n\nexport const Route = createRootRoute({\n  validateSearch: zodValidator(searchSchema),\n  search: {\n    middlewares: [\n      ({ search, next }) => {\n        const result = next(search)\n        return {\n          rootValue: search.rootValue,\n          ...result,\n        }\n      },\n    ],\n  },\n})\n```\n\nSince this specific use case is quite common, TanStack Router provides a generic implementation to retain search params via `retainSearchParams`:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { z } from 'zod'\nimport { createFileRoute, retainSearchParams } from '@tanstack/react-router'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst searchSchema = z.object({\n  rootValue: z.string().optional(),\n})\n\nexport const Route = createRootRoute({\n  validateSearch: zodValidator(searchSchema),\n  search: {\n    middlewares: [retainSearchParams(['rootValue'])],\n  },\n})\n```\n\n# Solid\n\n```tsx\nimport { z } from 'zod'\nimport { createFileRoute, retainSearchParams } from '@tanstack/solid-router'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst searchSchema = z.object({\n  rootValue: z.string().optional(),\n})\n\nexport const Route = createRootRoute({\n  validateSearch: zodValidator(searchSchema),\n  search: {\n    middlewares: [retainSearchParams(['rootValue'])],\n  },\n})\n```\n\n<!-- ::end:framework -->\n\nAnother common use case is to strip out search params from links if their default value is set. TanStack Router provides a generic implementation for this use case via `stripSearchParams`:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { z } from 'zod'\nimport { createFileRoute, stripSearchParams } from '@tanstack/react-router'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst defaultValues = {\n  one: 'abc',\n  two: 'xyz',\n}\n\nconst searchSchema = z.object({\n  one: z.string().default(defaultValues.one),\n  two: z.string().default(defaultValues.two),\n})\n\nexport const Route = createFileRoute('/hello')({\n  validateSearch: zodValidator(searchSchema),\n  search: {\n    // strip default values\n    middlewares: [stripSearchParams(defaultValues)],\n  },\n})\n```\n\n# Solid\n\n```tsx\nimport { z } from 'zod'\nimport { createFileRoute, stripSearchParams } from '@tanstack/solid-router'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst defaultValues = {\n  one: 'abc',\n  two: 'xyz',\n}\n\nconst searchSchema = z.object({\n  one: z.string().default(defaultValues.one),\n  two: z.string().default(defaultValues.two),\n})\n\nexport const Route = createFileRoute('/hello')({\n  validateSearch: zodValidator(searchSchema),\n  search: {\n    // strip default values\n    middlewares: [stripSearchParams(defaultValues)],\n  },\n})\n```\n\n<!-- ::end:framework -->\n\nMultiple middlewares can be chained. The following example shows how to combine both `retainSearchParams` and `stripSearchParams`.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport {\n  Link,\n  createFileRoute,\n  retainSearchParams,\n  stripSearchParams,\n} from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst defaultValues = ['foo', 'bar']\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: zodValidator(\n    z.object({\n      retainMe: z.string().optional(),\n      arrayWithDefaults: z.string().array().default(defaultValues),\n      required: z.string(),\n    }),\n  ),\n  search: {\n    middlewares: [\n      retainSearchParams(['retainMe']),\n      stripSearchParams({ arrayWithDefaults: defaultValues }),\n    ],\n  },\n})\n```\n\n# Solid\n\n```tsx\nimport {\n  Link,\n  createFileRoute,\n  retainSearchParams,\n  stripSearchParams,\n} from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst defaultValues = ['foo', 'bar']\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: zodValidator(\n    z.object({\n      retainMe: z.string().optional(),\n      arrayWithDefaults: z.string().array().default(defaultValues),\n      required: z.string(),\n    }),\n  ),\n  search: {\n    middlewares: [\n      retainSearchParams(['retainMe']),\n      stripSearchParams({ arrayWithDefaults: defaultValues }),\n    ],\n  },\n})\n```\n\n<!-- ::end:framework -->\n"
  },
  {
    "path": "docs/router/guide/ssr.md",
    "content": "---\nid: ssr\ntitle: SSR\n---\n\n> [!WARNING]\n> While every effort has been made to separate these APIs from changes to Tanstack Start, there are underlying shared implementations internally. Therefore these can be subject to change and should be regarded as experimental until Start reaches stable status.\n\nServer 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.\n\nThere are usually two different flavors of SSR to be considered:\n\n- Non-streaming SSR\n  - 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.\n- Streaming SSR\n  - 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\n  - The rest of the page is then streamed to the client as it is rendered on the server.\n\nThis guide will explain how to implement both flavors of SSR with TanStack Router!\n\n## Non-Streaming SSR\n\nNon-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.\n\nTo implement non-streaming SSR with TanStack Router, you will need the following utilities:\n\n<!-- ::start:framework -->\n\n# React\n\n- `RouterClient` from `@tanstack/react-router`\n  - e.g. `<RouterClient router={router} />`\n  - Rendering this component in your client entry will render your application and also automatically implement the `Wrap` component option on `Router`\n- And, either:\n  - `defaultRenderHandler` from `@tanstack/react-router`\n    - This will render your application in your server entry and also automatically handle application-level hydration/dehydration and also automatically implement the RouterServer component.\n      or:\n  - `renderRouterToString` from `@tanstack/react-router`\n    - This differs from defaultRenderHandler in that it allows you to manually specify the `Wrap` component option on `Router` together with any other providers you may need to wrap it with.\n  - `RouterServer` from `@tanstack/react-router`\n    - This implements the `Wrap` component option on `Router`\n\n# Solid\n\n- `RouterClient` from `@tanstack/solid-router`\n  - e.g. `<RouterClient router={router} />`\n  - Rendering this component in your client entry will render your application and also automatically implement the `Wrap` component option on `Router`\n- And, either:\n  - `defaultRenderHandler` from `@tanstack/solid-router`\n    - This will render your application in your server entry and also automatically handle application-level hydration/dehydration and also automatically implement the RouterServer component.\n      or:\n  - `renderRouterToString` from `@tanstack/solid-router`\n    - This differs from defaultRenderHandler in that it allows you to manually specify the `Wrap` component option on `Router` together with any other providers you may need to wrap it with.\n  - `RouterServer` from `@tanstack/solid-router`\n    - This implements the `Wrap` component option on `Router`\n\n<!-- ::end:framework -->\n\n### Automatic Server History\n\nOn 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. This is handled automatically for you in the RouterServer component.\n\n### Automatic Loader Dehydration/Hydration\n\nResolved 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.\n\n⚠️ 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.\n\nFor more information on how to utilize data loading, see the [Data Loading](./data-loading.md) guide.\n\n### Router Creation\n\nSince 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.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title='src/router.tsx'\nimport { createRouter as createTanstackRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function createRouter() {\n  return createTanstackRouter({ routeTree })\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n```\n\n# Solid\n\n```tsx title='src/router.tsx'\nimport { createRouter as createTanstackRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function createRouter() {\n  return createTanstackRouter({ routeTree })\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n```\n\n<!-- ::end:framework -->\n\n### Rendering the Application on the Server\n\nNow that you have a router instance that has loaded all the critical data for the current URL, you can render your application on the server:\n\nusing `defaultRenderHandler`\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/entry-server.tsx\"\nimport {\n  createRequestHandler,\n  defaultRenderHandler,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport async function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return await handler(defaultRenderHandler)\n}\n```\n\n# Solid\n\n```tsx title=\"src/entry-server.tsx\"\nimport {\n  createRequestHandler,\n  defaultRenderHandler,\n} from '@tanstack/solid-router/ssr/server'\nimport { createRouter } from './router'\n\nexport async function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return await handler(defaultRenderHandler)\n}\n```\n\n<!-- ::end:framework -->\n\nusing `renderRouterToString`\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/entry-server.tsx\"\nimport {\n  createRequestHandler,\n  renderRouterToString,\n  RouterServer,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return handler(({ request, responseHeaders, router }) =>\n    renderRouterToString({\n      request,\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/entry-server.tsx\"\nimport {\n  createRequestHandler,\n  renderRouterToString,\n  RouterServer,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return handler(({ request, responseHeaders, router }) =>\n    renderRouterToString({\n      request,\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nNOTE: The createRequestHandler method requires a web api standard Request object, while the handler method will return a web api standard Response promise.\n\nShould you be using a server framework like Express that uses its own Request and Response objects you would need to convert from the one to the other. Please have a look at the examples for how such an implementation might look like.\n\n## Rendering the Application on the Client\n\nOn the client, things are much simpler.\n\n- Create your router instance\n- Render your application using the `<RouterClient />` component\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/entry-client.tsx\"\nimport { hydrateRoot } from 'react-dom/client'\nimport { RouterClient } from '@tanstack/react-router/ssr/client'\nimport { createRouter } from './router'\n\nconst router = createRouter()\n\nhydrateRoot(document, <RouterClient router={router} />)\n```\n\n# Solid\n\n```tsx title=\"src/entry-client.tsx\"\nimport { hydrate } from 'solid-js/web'\nimport { RouterClient } from '@tanstack/solid-router/ssr/client'\nimport { createRouter } from './router'\n\nconst router = createRouter()\n\nhydrate(() => <RouterClient router={router} />, document.body)\n```\n\n<!-- ::end:framework -->\n\nWith this setup, your application will be rendered on the server and then hydrated on the client!\n\n## Streaming SSR\n\nStreaming 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 lower priority or slower response times can be streamed to the client after the initial render, but in the same request.\n\nThis 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.\n\n> [!NOTE]\n> This streaming pattern is all automatic as long as you are using either `defaultStreamHandler` or `renderRouterToStream`.\n\nusing `defaultStreamHandler`\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/entry-server.tsx\"\nimport {\n  createRequestHandler,\n  defaultStreamHandler,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport async function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return await handler(defaultStreamHandler)\n}\n```\n\n# Solid\n\n```tsx title=\"src/entry-server.tsx\"\nimport {\n  createRequestHandler,\n  defaultStreamHandler,\n} from '@tanstack/solid-router/ssr/server'\nimport { createRouter } from './router'\n\nexport async function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return await handler(defaultStreamHandler)\n}\n```\n\n<!-- ::end:framework -->\n\nusing `renderRouterToStream`\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/entry-server.tsx\"\nimport {\n  createRequestHandler,\n  renderRouterToStream,\n  RouterServer,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return handler(({ request, responseHeaders, router }) =>\n    renderRouterToStream({\n      request,\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/entry-server.tsx\"\nimport {\n  createRequestHandler,\n  renderRouterToStream,\n  RouterServer,\n} from '@tanstack/solid-router/ssr/server'\nimport { createRouter } from './router'\n\nexport function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return handler(({ request, responseHeaders, router }) =>\n    renderRouterToStream({\n      request,\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n## Streaming Dehydration/Hydration\n\nStreaming 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.\n\n## Data Serialization\n\nWhen using SSR, data passed between the server and the client must be serialized before it is sent across network-boundaries. TanStack Router handles this serialization using a very lightweight serializer that supports common data types beyond JSON.stringify/JSON.parse.\n\nOut of the box, the following types are supported:\n\n- `undefined`\n- `Date`\n- `Error`\n- `FormData`\n\nIf you feel that there are other types that should be supported by default, please open an issue on the TanStack Router repository.\n\nIf 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. We are currently working on both a more robust serializer and a way to customize the serializer for your application. Open an issue if you are interested in helping out!\n"
  },
  {
    "path": "docs/router/guide/static-route-data.md",
    "content": "---\ntitle: Static Route Data\n---\n\nWhen 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.\n\nIn 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.\n\n## Example\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/routes/posts.tsx'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  staticData: {\n    customData: 'Hello!',\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\nYou can then access this data anywhere you have access to your routes, including matches that can be mapped back to their routes.\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/routes/__root.tsx'\nimport { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => {\n    const matches = useMatches()\n\n    return (\n      <div>\n        {matches.map((match) => {\n          return <div key={match.id}>{match.staticData.customData}</div>\n        })}\n      </div>\n    )\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/routes/posts.tsx'\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts')({\n  staticData: {\n    customData: 'Hello!',\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\nYou can then access this data anywhere you have access to your routes, including matches that can be mapped back to their routes.\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/routes/__root.tsx'\nimport { createRootRoute, useMatches } from '@tanstack/solid-router'\nimport { For } from 'solid-js'\n\nexport const Route = createRootRoute({\n  component: () => {\n    const matches = useMatches()\n\n    return (\n      <div>\n        <For each={matches()}>\n          {(match) => <div>{match.staticData.customData}</div>}\n        </For>\n      </div>\n    )\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n## Enforcing Static Data\n\nIf 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:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\ndeclare module '@tanstack/react-router' {\n  interface StaticDataRouteOption {\n    customData: string\n  }\n}\n```\n\n# Solid\n\n```tsx\ndeclare module '@tanstack/solid-router' {\n  interface StaticDataRouteOption {\n    customData: string\n  }\n}\n```\n\n<!-- ::end:framework -->\n\nNow, if you try to create a route without the `customData` property, you'll get a type error:\n\n```tsx\nexport const Route = createFileRoute('/posts')({\n  staticData: {\n    // Property 'customData' is missing in type '{ customData: number; }' but required in type 'StaticDataRouteOption'.ts(2741)\n  },\n})\n```\n\n## Optional Static Data\n\nIf you want to make static data optional, simply add a `?` to the property:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\ndeclare module '@tanstack/react-router' {\n  interface StaticDataRouteOption {\n    customData?: string\n  }\n}\n```\n\n# Solid\n\n```tsx\ndeclare module '@tanstack/solid-router' {\n  interface StaticDataRouteOption {\n    customData?: string\n  }\n}\n```\n\n<!-- ::end:framework -->\n\nAs long as there are any required properties on the `StaticDataRouteOption`, you'll be required to pass in an object.\n\n## Common Patterns\n\n### Controlling Layout Visibility\n\nUse staticData to control which routes show or hide layout elements:\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/routes/admin/route.tsx'\nexport const Route = createFileRoute('/admin')({\n  staticData: { showNavbar: false },\n  component: AdminLayout,\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx\n// routes/__root.tsx\nfunction RootComponent() {\n  const showNavbar = useMatches({\n    select: (matches) =>\n      !matches.some((m) => m.staticData?.showNavbar === false),\n  })\n\n  return showNavbar ? (\n    <Navbar>\n      <Outlet />\n    </Navbar>\n  ) : (\n    <Outlet />\n  )\n}\n```\n\n<!-- ::end:tabs -->\n\n### Route Titles for Breadcrumbs\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/routes/posts/$postId.tsx'\nexport const Route = createFileRoute('/posts/$postId')({\n  staticData: {\n    getTitle: () => 'Post Details',\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/components/Breadcrumbs.tsx'\nfunction Breadcrumbs() {\n  const matches = useMatches()\n\n  return (\n    <nav>\n      {matches\n        .filter((m) => m.staticData?.getTitle)\n        .map((m) => (\n          <span key={m.id}>{m.staticData.getTitle()}</span>\n        ))}\n    </nav>\n  )\n}\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/routes/posts/$postId.tsx'\nexport const Route = createFileRoute('/posts/$postId')({\n  staticData: {\n    getTitle: () => 'Post Details',\n  },\n})\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title='src/components/Breadcrumbs.tsx'\nimport { useMatches } from '@tanstack/solid-router'\nimport { For } from 'solid-js'\n\nfunction Breadcrumbs() {\n  const matches = useMatches()\n\n  return (\n    <nav>\n      <For each={matches().filter((m) => m.staticData?.getTitle)}>\n        {(m) => <span>{m.staticData.getTitle()}</span>}\n      </For>\n    </nav>\n  )\n}\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\n### When to Use staticData vs Context\n\n| staticData                             | context                         |\n| -------------------------------------- | ------------------------------- |\n| Synchronous, defined at route creation | Can be async (via `beforeLoad`) |\n| Available before loading starts        | Can depend on params/search     |\n| Same for all instances of a route      | Passed down to child routes     |\n\nUse staticData for static route metadata. Use context for dynamic data or auth state that varies per request.\n"
  },
  {
    "path": "docs/router/guide/type-safety.md",
    "content": "---\ntitle: Type Safety\n---\n\nTanStack Router is built to be as type-safe as possible within the limits of the TypeScript compiler and runtime. This means that it's not only written in TypeScript, but that it also **fully infers the types it's provided and tenaciously pipes them through the entire routing experience**.\n\nUltimately, this means that you write **less types as a developer** and have **more confidence in your code** as it evolves.\n\n## Route Definitions\n\n### File-based Routing\n\nRoutes are hierarchical, and so are their definitions. If you're using file-based routing, much of the type-safety is already taken care of for you.\n\n### Code-based Routing\n\nIf 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.\n\nSo, don't forget to pass the parent route to your child routes!\n\n```tsx\nconst parentRoute = createRoute({\n  getParentRoute: () => parentRoute,\n})\n```\n\n## Exported Hooks, Components, and Utilities\n\nFor 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.\n\n<!-- ::start:framework -->\n\n# React\n\n```ts\nconst router = createRouter({\n  // ...\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n```\n\n# Solid\n\n```ts\nconst router = createRouter({\n  // ...\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n```\n\n<!-- ::end:framework -->\n\nBy registering your router with the module, you can now use the exported hooks, components, and utilities with your router's exact types.\n\n## Fixing the Component Context Problem\n\nComponent context is a wonderful tool in React and other frameworks for providing dependencies to components. However, if that context is changing types as it moves throughout your component hierarchy, it becomes impossible for TypeScript to know how to infer those changes. To get around this, context-based hooks and components require that you give them a hint on how and where they are being used.\n\n```tsx\nexport const Route = createFileRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  // Each route has type-safe versions of most of the built-in hooks from TanStack Router\n  const params = Route.useParams()\n  const search = Route.useSearch()\n\n  // Some hooks require context from the *entire* router, not just the current route. To achieve type-safety here,\n  // we must pass the `from` param to tell the hook our relative position in the route hierarchy.\n  const navigate = useNavigate({ from: Route.fullPath })\n  // ... etc\n}\n```\n\nEvery 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.\n\n> 🧠 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.\n\n### What if I don't know the route? What if it's a shared component?\n\nThe `from` property is optional, which means if you don't pass it, you'll get the router's best guess on what types will be available. Usually, that means you'll get a union of all of the types of all of the routes in the router.\n\n### What if I pass the wrong `from` path?\n\nIt's technically possible to pass a `from` that satisfies TypeScript, but may not match the actual route you are rendering within at runtime. In this case, each hook and component that supports `from` will detect if your expectations don't match the actual route you are rendering within, and will throw a runtime error.\n\n### What if I don't know the route, or it's a shared component, and I can't pass `from`?\n\nIf you are rendering a component that is shared across multiple routes, or you are rendering a component that is not within a route, you can pass `strict: false` instead of a `from` option. This will not only silence the runtime error, but will also give you relaxed, but accurate types for the potential hook you are calling. A good example of this is calling `useSearch` from a shared component:\n\n```tsx\nfunction MyComponent() {\n  const search = useSearch({ strict: false })\n}\n```\n\nIn this case, the `search` variable will be typed as a union of all possible search params from all routes in the router.\n\n## Router Context\n\nRouter context is so extremely useful as it's the ultimate hierarchical dependency injection. You can supply context to the router and to each and every route it renders. As you build up this context, TanStack Router will merge it down with the hierarchy of routes, so that each route has access to the context of all of its parents.\n\nThe `createRootRouteWithContext` factory creates a new router with the instantiated type, which then creates a requirement for you to fulfill the same type contract to your router, and will also ensure that your context is properly typed throughout the entire route tree.\n\n```tsx\nconst rootRoute = createRootRouteWithContext<{ whateverYouWant: true }>()({\n  component: App,\n})\n\nconst routeTree = rootRoute.addChildren([\n  // ... all child routes will have access to `whateverYouWant` in their context\n])\n\nconst router = createRouter({\n  routeTree,\n  context: {\n    // This will be required to be passed now\n    whateverYouWant: true,\n  },\n})\n```\n\n## Performance Recommendations\n\nAs your application scales, TypeScript check times will naturally increase. There are a few things to keep in mind when your application scales to keep your TS check times down.\n\n### Only infer types you need\n\nA 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`.\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId/deep')({\n  loader: ({ context: { queryClient }, params: { postId } }) =>\n    queryClient.ensureQueryData(postQueryOptions(postId)),\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const params = Route.useParams()\n  const data = useSuspenseQuery(postQueryOptions(params.postId))\n\n  return <></>\n}\n```\n\nThis 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<void>.\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId/deep')({\n  loader: async ({ context: { queryClient }, params: { postId } }) => {\n    await queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const params = Route.useParams()\n  const data = useSuspenseQuery(postQueryOptions(params.postId))\n\n  return <></>\n}\n```\n\nThis way the loader data is never inferred and it moves the inference out of the route tree to the first time you use `useSuspenseQuery`.\n\n### Narrow to relevant routes as much as you possibly can\n\nConsider the following usage of `Link`\n\n```tsx\n<Link to=\"..\" search={{ page: 0 }} />\n<Link to=\".\" search={{ page: 0 }} />\n```\n\n**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.\n\nInstead you should try to narrow to relevant routes with `from` or `to`.\n\n```tsx\n<Link from={Route.fullPath} to=\"..\" search={{page: 0}} />\n<Link from=\"/posts\" to=\"..\" search={{page: 0}} />\n```\n\nRemember you can always pass a union to `to` or `from` to narrow the routes you're interested in.\n\n```tsx\nconst from: '/posts/$postId/deep' | '/posts/' = '/posts/'\n<Link from={from} to='..' />\n```\n\nYou can also pass branches to `from` to only resolve `search` or `params` to be from any descendants of that branch:\n\n```tsx\nconst from = '/posts'\n<Link from={from} to='..' />\n```\n\n`/posts` could be a branch with many descendants which share the same `search` or `params`\n\n### Consider using the object syntax of `addChildren`\n\nIt's typical of routes to have `params` `search`, `loaders` or `context` that can even reference external dependencies which are also heavy on TS inference. For such applications, using objects for creating the route tree can be more performant than tuples.\n\n`createChildren` also can accept an object. For large route trees with complex routes and external libraries, objects can be much faster for TS to type check as opposed to large tuples. The performance gains depend on your project, what external dependencies you have and how the types for those libraries are written\n\n```tsx\nconst routeTree = rootRoute.addChildren({\n  postsRoute: postsRoute.addChildren({ postRoute, postsIndexRoute }),\n  indexRoute,\n})\n```\n\nNote this syntax is more verbose but has better TS performance. With file based routing, the route tree is generated for you so a verbose route tree is not a concern\n\n### Avoid internal types without narrowing\n\nIt's common you might want to re-use types exposed. For example you might be tempted to use `LinkProps` like so\n\n```tsx\nconst props: LinkProps = {\n  to: '/posts/',\n}\n\nreturn (\n  <Link {...props}>\n)\n```\n\n**This is VERY bad for TS Performance**. The problem here is `LinkProps` has no type arguments and is therefore an extremely large type. It includes `search` which is a union of all `search` params, it contains `params` which is a union of all `params`. When merging this object with `Link` it will do a structural comparison of this huge type.\n\nInstead you can use `as const satisfies` to infer a precise type and not `LinkProps` directly to avoid the huge check\n\n```tsx\nconst props = {\n  to: '/posts/',\n} as const satisfies LinkProps\n\nreturn (\n  <Link {...props}>\n)\n```\n\nAs `props` is not of type `LinkProps` and therefore this check is cheaper because the type is much more precise. You can also improve type checking further by narrowing `LinkProps`\n\n```tsx\nconst props = {\n  to: '/posts/',\n} as const satisfies LinkProps<RegisteredRouter, string '/posts/'>\n\nreturn (\n  <Link {...props}>\n)\n```\n\nThis is even faster as we're checking against the narrowed `LinkProps` type.\n\nYou can also use this to narrow the type of `LinkProps` to a specific type to be used as a prop or parameter to a function\n\n```tsx\nexport const myLinkProps = [\n  {\n    to: '/posts',\n  },\n  {\n    to: '/posts/$postId',\n    params: { postId: 'postId' },\n  },\n] as const satisfies ReadonlyArray<LinkProps>\n\nexport type MyLinkProps = (typeof myLinkProps)[number]\n\nconst MyComponent = (props: { linkProps: MyLinkProps }) => {\n  return <Link {...props.linkProps} />\n}\n```\n\nThis is faster than using `LinkProps` directly in a component because `MyLinkProps` is a much more precise type\n\nAnother solution is not to use `LinkProps` and to provide inversion of control to render a `Link` component narrowed to a specific route. Render props are a good method of inverting control to the user of a component\n\n```tsx\nexport interface MyComponentProps {\n  readonly renderLink: () => React.ReactNode\n}\n\nconst MyComponent = (props: MyComponentProps) => {\n  return <div>{props.renderLink()}</div>\n}\n\nconst Page = () => {\n  return <MyComponent renderLink={() => <Link to=\"/absolute\" />} />\n}\n```\n\nThis particular example is very fast as we've inverted control of where we're navigating to the user of the component. The `Link` is narrowed to the exact route\nwe want to navigate to\n"
  },
  {
    "path": "docs/router/guide/type-utilities.md",
    "content": "---\nid: type-utilities\ntitle: Type Utilities\n---\n\nMost types exposed by TanStack Router are internal, subject to breaking changes and not always easy to use. That is why TanStack Router has a subset of exposed types focused on ease of use with the intension to be used externally. These types provide the same type safe experience from TanStack Router's runtime concepts on the type level, with flexibility of where to provide type checking\n\n## Type checking Link options with `ValidateLinkOptions`\n\n`ValidateLinkOptions` type checks object literal types to ensure they conform to `Link` options at inference sites. For example, you may have a generic `HeadingLink` component which accepts a `title` prop along with `linkOptions`, the idea being this component can be re-used for any navigation.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nexport interface HeaderLinkProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions = unknown,\n> {\n  title: string\n  linkOptions: ValidateLinkOptions<TRouter, TOptions>\n}\n\nexport function HeadingLink<TRouter extends RegisteredRouter, TOptions>(\n  props: HeaderLinkProps<TRouter, TOptions>,\n): React.ReactNode\nexport function HeadingLink(props: HeaderLinkProps): React.ReactNode {\n  return (\n    <>\n      <h1>{props.title}</h1>\n      <Link {...props.linkOptions} />\n    </>\n  )\n}\n```\n\n# Solid\n\n```tsx\nexport interface HeaderLinkProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions = unknown,\n> {\n  title: string\n  linkOptions: ValidateLinkOptions<TRouter, TOptions>\n}\n\nexport function HeadingLink<TRouter extends RegisteredRouter, TOptions>(\n  props: HeaderLinkProps<TRouter, TOptions>,\n): Solid.JSX.Element\nexport function HeadingLink(props: HeaderLinkProps): Solid.JSX.Element {\n  return (\n    <>\n      <h1>{props.title}</h1>\n      <Link {...props.linkOptions} />\n    </>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nA more permissive overload of `HeadingLink` is used to avoid type assertions you would otherwise have to do with the generic signature. Using a looser signature without type parameters is an easy way to avoid type assertions in the implementation of `HeadingLink`\n\nAll type parameters for utilities are optional but for the best TypeScript performance `TRouter` should always be specified for the public facing signature. And `TOptions` should always be used at inference sites like `HeadingLink` to infer the `linkOptions` to correctly narrow `params` and `search`\n\nThe result of this is that `linkOptions` in the following is completely type-safe\n\n```tsx\n<HeadingLink title=\"Posts\" linkOptions={{ to: '/posts' }} />\n<HeadingLink title=\"Post\" linkOptions={{ to: '/posts/$postId', params: {postId: 'postId'} }} />\n```\n\n## Type checking an array of Link options with `ValidateLinkOptionsArray`\n\nAll navigation type utilities have an array variant. `ValidateLinkOptionsArray` enables type checking of an array of `Link` options. For example, you might have a generic `Menu` component where each item is a `Link`.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nexport interface MenuProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TItems extends ReadonlyArray<unknown> = ReadonlyArray<unknown>,\n> {\n  items: ValidateLinkOptionsArray<TRouter, TItems>\n}\n\nexport function Menu<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TItems extends ReadonlyArray<unknown>,\n>(props: MenuProps<TRouter, TItems>): React.ReactNode\nexport function Menu(props: MenuProps): React.ReactNode {\n  return (\n    <ul>\n      {props.items.map((item) => (\n        <li>\n          <Link {...item} />\n        </li>\n      ))}\n    </ul>\n  )\n}\n```\n\n# Solid\n\n```tsx\nimport { For } from 'solid-js'\n\nexport interface MenuProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TItems extends ReadonlyArray<unknown> = ReadonlyArray<unknown>,\n> {\n  items: ValidateLinkOptionsArray<TRouter, TItems>\n}\n\nexport function Menu<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TItems extends ReadonlyArray<unknown>,\n>(props: MenuProps<TRouter, TItems>): Solid.JSX.Element\nexport function Menu(props: MenuProps): Solid.JSX.Element {\n  return (\n    <ul>\n      <For each={props.items}>\n        {(item) => (\n          <li>\n            <Link {...item} />\n          </li>\n        )}\n      </For>\n    </ul>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nThis of course allows the following `items` prop to be completely type-safe\n\n```tsx\n<Menu\n  items={[\n    { to: '/posts' },\n    { to: '/posts/$postId', params: { postId: 'postId' } },\n  ]}\n/>\n```\n\nIt is also possible to fix `from` for each `Link` options in the array. This would allow all `Menu` items to navigate relative to `from`. Additional type checking of `from` can be provided by the `ValidateFromPath` utility\n\n<!-- ::start:framework -->\n\n# React\n\n```ts\nexport interface MenuProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TItems extends ReadonlyArray<unknown> = ReadonlyArray<unknown>,\n  TFrom extends string = string,\n> {\n  from: ValidateFromPath<TRouter, TFrom>\n  items: ValidateLinkOptionsArray<TRouter, TItems, TFrom>\n}\n\nexport function Menu<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TItems extends ReadonlyArray<unknown>,\n  TFrom extends string = string,\n>(props: MenuProps<TRouter, TItems, TFrom>): React.ReactNode\nexport function Menu(props: MenuProps): React.ReactNode {\n  return (\n    <ul>\n      {props.items.map((item) => (\n        <li>\n          <Link {...item} from={props.from} />\n        </li>\n      ))}\n    </ul>\n  )\n}\n```\n\n# Solid\n\n```ts\nimport { For } from 'solid-js'\n\nexport interface MenuProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TItems extends ReadonlyArray<unknown> = ReadonlyArray<unknown>,\n  TFrom extends string = string,\n> {\n  from: ValidateFromPath<TRouter, TFrom>\n  items: ValidateLinkOptionsArray<TRouter, TItems, TFrom>\n}\n\nexport function Menu<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TItems extends ReadonlyArray<unknown>,\n  TFrom extends string = string,\n>(props: MenuProps<TRouter, TItems, TFrom>): Solid.JSX.Element\nexport function Menu(props: MenuProps): Solid.JSX.Element {\n  return (\n    <ul>\n      <For each={props.items}>\n        {(item) => (\n          <li>\n            <Link {...item} from={props.from} />\n          </li>\n        )}\n      </For>\n    </ul>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\n`ValidateLinkOptionsArray` allows you to fix `from` by providing an extra type parameter. The result is a type safe array of `Link` options providing navigation relative to `from`\n\n```tsx\n<Menu\n  from=\"/posts\"\n  items={[{ to: '.' }, { to: './$postId', params: { postId: 'postId' } }]}\n/>\n```\n\n## Type checking redirect options with `ValidateRedirectOptions`\n\n`ValidateRedirectOptions` type checks object literal types to ensure they conform to redirect options at inference sites. For example, you may need a generic `fetchOrRedirect` function which accepts a `url` along with `redirectOptions`, the idea being this function will redirect when the `fetch` fails.\n\n```tsx\nexport async function fetchOrRedirect<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions,\n>(\n  url: string,\n  redirectOptions: ValidateRedirectOptions<TRouter, TOptions>,\n): Promise<unknown>\nexport async function fetchOrRedirect(\n  url: string,\n  redirectOptions: ValidateRedirectOptions,\n): Promise<unknown> {\n  const response = await fetch(url)\n\n  if (!response.ok && response.status === 401) {\n    throw redirect(redirectOptions)\n  }\n\n  return await response.json()\n}\n```\n\nThe result is that `redirectOptions` passed to `fetchOrRedirect` is completely type-safe\n\n```tsx\nfetchOrRedirect('http://example.com/', { to: '/login' })\n```\n\n## Type checking navigate options with `ValidateNavigateOptions`\n\n`ValidateNavigateOptions` type checks object literal types to ensure they conform to navigate options at inference sites. For example, you may want to write a custom hook to enable/disable navigation.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nexport interface UseConditionalNavigateResult {\n  enable: () => void\n  disable: () => void\n  navigate: () => void\n}\n\nexport function useConditionalNavigate<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions,\n>(\n  navigateOptions: ValidateNavigateOptions<TRouter, TOptions>,\n): UseConditionalNavigateResult\nexport function useConditionalNavigate(\n  navigateOptions: ValidateNavigateOptions,\n): UseConditionalNavigateResult {\n  const [enabled, setEnabled] = useState(false)\n  const navigate = useNavigate()\n  return {\n    enable: () => setEnabled(true),\n    disable: () => setEnabled(false),\n    navigate: () => {\n      if (enabled) {\n        navigate(navigateOptions)\n      }\n    },\n  }\n}\n```\n\n# Solid\n\n```tsx\nimport { createSignal } from 'solid-js'\n\nexport interface UseConditionalNavigateResult {\n  enable: () => void\n  disable: () => void\n  navigate: () => void\n}\n\nexport function useConditionalNavigate<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions = unknown,\n>(\n  navigateOptions: ValidateNavigateOptions<TRouter, TOptions>,\n): UseConditionalNavigateResult\nexport function useConditionalNavigate(\n  navigateOptions: ValidateNavigateOptions,\n): UseConditionalNavigateResult {\n  const [enabled, setEnabled] = createSignal(false)\n  const navigate = useNavigate()\n  return {\n    enable: () => setEnabled(true),\n    disable: () => setEnabled(false),\n    navigate: () => {\n      if (enabled()) {\n        navigate(navigateOptions)\n      }\n    },\n  }\n}\n```\n\n<!-- ::end:framework -->\n\nThe result of this is that `navigateOptions` passed to `useConditionalNavigate` is completely type-safe and we can enable/disable navigation based on react state\n\n```tsx\nconst { enable, disable, navigate } = useConditionalNavigate({\n  to: '/posts/$postId',\n  params: { postId: 'postId' },\n})\n```\n"
  },
  {
    "path": "docs/router/guide/url-rewrites.md",
    "content": "---\ntitle: URL Rewrites\n---\n\nURL rewrites allow you to transform URLs bidirectionally between what the browser displays and what the router interprets internally. This powerful feature enables patterns like locale prefixes, subdomain routing, legacy URL migration, and multi-tenant applications without duplicating routes or complicating your route tree.\n\n## When to Use URL Rewrites\n\nURL rewrites are useful when you need to:\n\n- **i18n locale prefixes**: Display `/en/about` in the browser but route to `/about` internally\n- **Subdomain routing**: Route `admin.example.com/users` to `/admin/users` internally\n- **Legacy URL migration**: Support old URLs like `/old-path` that map to new routes\n- **Multi-tenant applications**: Route `tenant1.example.com` to tenant-specific routes\n- **Custom URL schemes**: Transform any URL pattern to match your route structure\n\n## How URL Rewrites Work\n\nURL rewrites operate in two directions:\n\n1. **Input rewrite**: Transforms the URL **from the browser** before the router interprets it\n2. **Output rewrite**: Transforms the URL **from the router** before it's written to the browser\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                         Browser URL Bar                         │\n│                        /en/about?q=test                         │\n└─────────────────────────┬───────────────────────────────────────┘\n                          │\n                          ▼ input rewrite\n┌─────────────────────────────────────────────────────────────────┐\n│                      Router Internal URL                        │\n│                        /about?q=test                            │\n│                                                                 │\n│                    (matches routes, runs loaders)               │\n└─────────────────────────┬───────────────────────────────────────┘\n                          │\n                          ▼ output rewrite\n┌─────────────────────────────────────────────────────────────────┐\n│                         Browser URL Bar                         │\n│                        /en/about?q=test                         │\n└─────────────────────────────────────────────────────────────────┘\n```\n\nThe router exposes two href properties on the location object:\n\n- `location.href` - The internal URL (after input rewrite)\n- `location.publicHref` - The external URL displayed in the browser (after output rewrite)\n\n## Basic Usage\n\nConfigure rewrites when creating your router:\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => {\n      // Transform browser URL → router internal URL\n      // Return the modified URL, a new URL, or undefined to skip\n      return url\n    },\n    output: ({ url }) => {\n      // Transform router internal URL → browser URL\n      // Return the modified URL, a new URL, or undefined to skip\n      return url\n    },\n  },\n})\n```\n\nThe `input` and `output` functions receive a `URL` object and can:\n\n- Mutate and return the same `url` object\n- Return a new `URL` instance\n- Return a full href string (will be parsed into a URL)\n- Return `undefined` to skip the rewrite\n\n## Common Patterns\n\n### Pattern 1: i18n Locale Prefix\n\nStrip locale prefixes on input and add them back on output:\n\n```tsx\nconst locales = ['en', 'fr', 'es', 'de']\nconst defaultLocale = 'en'\n\n// Get current locale (from cookie, localStorage, or detection)\nfunction getLocale() {\n  return localStorage.getItem('locale') || defaultLocale\n}\n\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => {\n      // Check if pathname starts with a locale prefix\n      const segments = url.pathname.split('/').filter(Boolean)\n      const firstSegment = segments[0]\n\n      if (firstSegment && locales.includes(firstSegment)) {\n        // Strip the locale prefix: /en/about → /about\n        url.pathname = '/' + segments.slice(1).join('/') || '/'\n      }\n      return url\n    },\n    output: ({ url }) => {\n      const locale = getLocale()\n      // Add locale prefix: /about → /en/about\n      if (locale !== defaultLocale || true) {\n        // Always prefix, or conditionally skip default locale\n        url.pathname = `/${locale}${url.pathname === '/' ? '' : url.pathname}`\n      }\n      return url\n    },\n  },\n})\n```\n\nFor production i18n, consider using a library like Paraglide that provides `localizeUrl` and `deLocalizeUrl` functions. See the [Internationalization guide](./internationalization-i18n.md) for integration details.\n\n### Pattern 2: Subdomain to Path Routing\n\nRoute subdomain requests to path-based routes:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => {\n      const subdomain = url.hostname.split('.')[0]\n\n      // admin.example.com/users → /admin/users\n      if (subdomain === 'admin') {\n        url.pathname = '/admin' + url.pathname\n      }\n      // api.example.com/v1/users → /api/v1/users\n      else if (subdomain === 'api') {\n        url.pathname = '/api' + url.pathname\n      }\n\n      return url\n    },\n    output: ({ url }) => {\n      // Reverse the transformation for link generation\n      if (url.pathname.startsWith('/admin')) {\n        url.hostname = 'admin.example.com'\n        url.pathname = url.pathname.replace(/^\\/admin/, '') || '/'\n      } else if (url.pathname.startsWith('/api')) {\n        url.hostname = 'api.example.com'\n        url.pathname = url.pathname.replace(/^\\/api/, '') || '/'\n      }\n      return url\n    },\n  },\n})\n```\n\n### Pattern 3: Legacy URL Migration\n\nSupport old URLs while maintaining new route structure:\n\n```tsx\nconst legacyPaths: Record<string, string> = {\n  '/old-about': '/about',\n  '/old-contact': '/contact',\n  '/blog-posts': '/blog',\n  '/user-profile': '/account/profile',\n}\n\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => {\n      const newPath = legacyPaths[url.pathname]\n      if (newPath) {\n        url.pathname = newPath\n      }\n      return url\n    },\n    // No output rewrite needed - new URLs will be used going forward\n  },\n})\n```\n\n### Pattern 4: Multi-tenant Routing\n\nRoute tenant-specific domains to a unified route structure:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => {\n      // Extract tenant from subdomain: acme.app.com → acme\n      const parts = url.hostname.split('.')\n      if (parts.length >= 3) {\n        const tenant = parts[0]\n        // Inject tenant into the path: /dashboard → /tenant/acme/dashboard\n        url.pathname = `/tenant/${tenant}${url.pathname}`\n      }\n      return url\n    },\n    output: ({ url }) => {\n      // Extract tenant from path and move to subdomain\n      const match = url.pathname.match(/^\\/tenant\\/([^/]+)(.*)$/)\n      if (match) {\n        const [, tenant, rest] = match\n        url.hostname = `${tenant}.app.com`\n        url.pathname = rest || '/'\n      }\n      return url\n    },\n  },\n})\n```\n\n### Pattern 5: Search Parameter Transformation\n\nTransform search parameters during rewrites:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => {\n      // Convert legacy search param format\n      // ?filter_status=active → ?status=active\n      const filterStatus = url.searchParams.get('filter_status')\n      if (filterStatus) {\n        url.searchParams.delete('filter_status')\n        url.searchParams.set('status', filterStatus)\n      }\n      return url\n    },\n    output: ({ url }) => {\n      // Optionally transform back for external display\n      return url\n    },\n  },\n})\n```\n\n## Composing Multiple Rewrites\n\nWhen you need multiple independent rewrite transformations, use `composeRewrites` to combine them:\n\n```tsx\nimport { composeRewrites } from '@tanstack/react-router'\n\nconst localeRewrite = {\n  input: ({ url }) => {\n    // Strip locale prefix\n    const match = url.pathname.match(/^\\/(en|fr|es)(\\/.*)$/)\n    if (match) {\n      url.pathname = match[2] || '/'\n    }\n    return url\n  },\n  output: ({ url }) => {\n    // Add locale prefix\n    url.pathname = `/en${url.pathname === '/' ? '' : url.pathname}`\n    return url\n  },\n}\n\nconst legacyRewrite = {\n  input: ({ url }) => {\n    if (url.pathname === '/old-page') {\n      url.pathname = '/new-page'\n    }\n    return url\n  },\n}\n\nconst router = createRouter({\n  routeTree,\n  rewrite: composeRewrites([localeRewrite, legacyRewrite]),\n})\n```\n\n**Order of operations:**\n\n- **Input rewrites**: Execute in order (first to last)\n- **Output rewrites**: Execute in reverse order (last to first)\n\nThis ensures that composed rewrites \"unwrap\" correctly. In the example above:\n\n- Input: locale strips `/en`, then legacy redirects `/old-page`\n- Output: legacy runs first (no-op), then locale adds `/en` back\n\n## Interaction with Basepath\n\nWhen you configure a `basepath`, the router internally implements it as a rewrite. If you also provide a custom `rewrite`, they are automatically composed together:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  basepath: '/app',\n  rewrite: {\n    input: ({ url }) => {\n      // This runs AFTER basepath is stripped\n      // Browser: /app/en/about → After basepath: /en/about → Your rewrite: /about\n      return url\n    },\n    output: ({ url }) => {\n      // This runs BEFORE basepath is added\n      // Your rewrite: /about → After your rewrite: /en/about → Basepath adds: /app/en/about\n      return url\n    },\n  },\n})\n```\n\nThe composition order ensures:\n\n1. **Input**: Basepath stripped first, then your rewrite runs\n2. **Output**: Your rewrite runs first, then basepath added\n\n## Working with Links and Navigation\n\n### Link Component\n\nThe `<Link>` component automatically applies output rewrites when generating `href` attributes:\n\n```tsx\n// With locale rewrite configured (adds /en prefix)\n<Link to=\"/about\">About</Link>\n// Renders: <a href=\"/en/about\">About</a>\n```\n\n### Programmatic Navigation\n\nProgrammatic navigation via `navigate()` or `router.navigate()` also respects rewrites:\n\n```tsx\nconst navigate = useNavigate()\n\n// Navigates to /about internally, displays /en/about in browser\nnavigate({ to: '/about' })\n```\n\n### Hard Links for Cross-Origin Rewrites\n\nWhen an output rewrite changes the origin (hostname), the `<Link>` component automatically renders a standard anchor tag instead of using client-side navigation:\n\n```tsx\n// Rewrite that changes hostname for /admin paths\nconst router = createRouter({\n  routeTree,\n  rewrite: {\n    output: ({ url }) => {\n      if (url.pathname.startsWith('/admin')) {\n        url.hostname = 'admin.example.com'\n        url.pathname = url.pathname.replace(/^\\/admin/, '') || '/'\n      }\n      return url\n    },\n  },\n})\n\n// This link will be a hard navigation (full page load)\n<Link to=\"/admin/dashboard\">Admin Dashboard</Link>\n// Renders: <a href=\"https://admin.example.com/dashboard\">Admin Dashboard</a>\n```\n\n## The publicHref Property\n\nThe router's location object includes a `publicHref` property that contains the external URL (after output rewrite):\n\n```tsx\nfunction MyComponent() {\n  const location = useLocation()\n\n  // Internal URL used for routing\n  console.log(location.href) // \"/about\"\n\n  // External URL shown in browser\n  console.log(location.publicHref) // \"/en/about\"\n\n  return (\n    <div>\n      {/* Use publicHref for sharing, canonical URLs, etc. */}\n      <ShareButton url={window.location.origin + location.publicHref} />\n    </div>\n  )\n}\n```\n\nUse `publicHref` when you need the actual browser URL for:\n\n- Social sharing\n- Canonical URLs\n- Analytics tracking\n- Copying links to clipboard\n\n## Server-side Considerations\n\nURL rewrites apply on both client and server. When using TanStack Start:\n\n### Server Middleware\n\nRewrites are applied when parsing incoming requests:\n\n```tsx\n// router.tsx\nexport const router = createRouter({\n  routeTree,\n  rewrite: {\n    input: ({ url }) => deLocalizeUrl(url),\n    output: ({ url }) => localizeUrl(url),\n  },\n})\n```\n\nThe server handler will use the same rewrite configuration to parse incoming URLs and generate responses with the correct external URLs.\n\n### SSR Hydration\n\nThe router ensures that the server-rendered HTML and client hydration use consistent URLs. The `publicHref` is serialized during SSR so the client can hydrate with the correct external URL.\n\n## API Reference\n\n### `rewrite` option\n\n- Type: [`LocationRewrite`](#locationrewrite-type)\n- Optional\n- Configures bidirectional URL transformation between browser and router.\n\n### LocationRewrite type\n\n```tsx\ntype LocationRewrite = {\n  /**\n   * Transform the URL before the router interprets it.\n   * Called when reading from browser history.\n   */\n  input?: LocationRewriteFunction\n\n  /**\n   * Transform the URL before it's written to browser history.\n   * Called when generating links and committing navigation.\n   */\n  output?: LocationRewriteFunction\n}\n```\n\n### LocationRewriteFunction type\n\n```tsx\ntype LocationRewriteFunction = (opts: { url: URL }) => undefined | string | URL\n```\n\n**Parameters:**\n\n- `url`: A `URL` object representing the current URL\n\n**Returns:**\n\n- `URL`: The transformed URL object (can be the same mutated object or a new instance)\n- `string`: A full href string that will be parsed into a URL\n- `undefined`: Skip the rewrite, use the original URL\n\n### composeRewrites function\n\n```tsx\nimport { composeRewrites } from '@tanstack/react-router'\n\nfunction composeRewrites(rewrites: Array<LocationRewrite>): LocationRewrite\n```\n\nCombines multiple rewrite pairs into a single rewrite. Input rewrites execute in order, output rewrites execute in reverse order.\n\n**Example:**\n\n```tsx\nconst composedRewrite = composeRewrites([\n  { input: rewrite1Input, output: rewrite1Output },\n  { input: rewrite2Input, output: rewrite2Output },\n])\n\n// Input execution order: rewrite1Input → rewrite2Input\n// Output execution order: rewrite2Output → rewrite1Output\n```\n\n## Examples\n\nComplete working examples are available in the TanStack Router repository:\n\n- [React + Paraglide (Client-side i18n)](https://github.com/TanStack/router/tree/main/examples/react/i18n-paraglide)\n- [React + TanStack Start + Paraglide (SSR i18n)](https://github.com/TanStack/router/tree/main/examples/react/start-i18n-paraglide)\n- [Solid + Paraglide (Client-side i18n)](https://github.com/TanStack/router/tree/main/examples/solid/i18n-paraglide)\n- [Solid + TanStack Start + Paraglide (SSR i18n)](https://github.com/TanStack/router/tree/main/examples/solid/start-i18n-paraglide)\n"
  },
  {
    "path": "docs/router/how-to/README.md",
    "content": "# How-To Guides\n\nThis directory contains focused, step-by-step instructions for common TanStack Router tasks. Each guide is designed to be:\n\n- **Task-focused**: Covers one specific goal from start to finish\n- **Self-contained**: All necessary steps included, no prerequisites assumed\n- **Copy-paste ready**: Working code examples you can use immediately\n- **Problem-solving oriented**: Addresses real-world scenarios and common issues\n\n## Available Guides\n\n- [Install TanStack Router](./install.md) - Basic installation steps\n- [Use Environment Variables](./use-environment-variables.md) - Configure and use environment variables across different bundlers\n- [Deploy to Production](./deploy-to-production.md) - Deploy your app to hosting platforms\n- [Set Up Server-Side Rendering (SSR)](./setup-ssr.md) - Implement SSR with TanStack Router\n- [Migrate from React Router v7](./migrate-from-react-router.md) - Complete migration guide from React Router v7\n\n### Authentication\n\n- [Set Up Basic Authentication](./setup-authentication.md) - Implement basic auth with React Context\n- [Integrate Authentication Providers](./setup-auth-providers.md) - Use Auth0, Clerk, or Supabase\n- [Set Up Role-Based Access Control](./setup-rbac.md) - Add permission-based routing\n\n### Testing & Debugging\n\n- [Set Up Testing with Code-Based Routing](./setup-testing.md) - Comprehensive testing setup for manually defined routes\n- [Test File-Based Routing](./test-file-based-routing.md) - Specific patterns for testing file-based routing applications\n- [Debug Router Issues](./debug-router-issues.md) - Troubleshoot common routing problems and performance issues\n\n### UI Library Integration\n\n- [Integrate with Shadcn/ui](./integrate-shadcn-ui.md) - Set up Shadcn/ui components with animations and styling\n- [Integrate with Material-UI (MUI)](./integrate-material-ui.md) - Configure MUI components with proper theming and TypeScript\n- [Integrate with Framer Motion](./integrate-framer-motion.md) - Add smooth animations and transitions to your routes\n- [Integrate with Chakra UI](./integrate-chakra-ui.md) - Build responsive, accessible UIs with Chakra UI components\n\n### Search Parameters & URL State (Progressive Series)\n\n**Foundation Level (Start Here):**\n\n- [x] [Set Up Basic Search Parameters](./setup-basic-search-params.md) - Create type-safe search validation and reading\n- [x] [Navigate with Search Parameters](./navigate-with-search-params.md) - Update and manage search params with Links and navigation\n\n**Intermediate Level (Common Patterns):**\n\n- [x] [Validate Search Parameters with Schemas](./validate-search-params.md) - Use schema validation libraries for robust validation and type safety\n- [x] [Work with Arrays, Objects, and Dates](./arrays-objects-dates-search-params.md) - Handle arrays, objects, dates, and nested data structures\n- [x] [Share Search Parameters Across Routes](./share-search-params-across-routes.md) - Inherit and manage search params across route hierarchies\n\n**Advanced Level (Power User Patterns):**\n\n- [ ] Build Advanced Search Parameter Middleware - Create custom middleware for search param processing\n- [ ] Optimize Search Parameter Performance - Minimize re-renders and improve performance with selectors\n- [ ] Customize Search Parameter Serialization - Implement custom serialization for compression and compatibility\n\n**Specialized Use Cases:**\n\n- [ ] Build Search-Based Filtering Systems - Create complex filtering UIs with URL state\n- [ ] Handle Search Parameters in Forms - Synchronize form state with URL search parameters\n- [ ] Debug Search Parameter Issues - Troubleshoot common search param problems and performance issues\n- [ ] Use Search Parameters with Data Loading - Integrate search params with loaders and data fetching\n\n## Using These Guides\n\nEach guide follows a consistent structure:\n\n1. **Quick Start** - Brief overview of what you'll accomplish\n2. **Step-by-step instructions** - Platform-specific or scenario-specific guidance\n3. **Production checklist** - Verification steps (where applicable)\n4. **Common problems** - Troubleshooting for typical issues\n5. **Common next steps** - Optional related tasks you might want to tackle\n\n## Contributing\n\nWhen adding new how-to guides:\n\n1. Focus on a single, well-defined task\n2. Use clear headings and numbered steps\n3. Include complete, working code examples\n4. Address the most frequent problems at the end\n5. Comment out \"Common next steps\" links until those guides are created\n6. In \"Related Resources\", link to specific relevant resources, not generic documentation\n"
  },
  {
    "path": "docs/router/how-to/arrays-objects-dates-search-params.md",
    "content": "---\ntitle: Work with Arrays, Objects, and Dates in Search Parameters\n---\n\nLearn to handle arrays, objects, dates, and nested data structures in search parameters while maintaining type safety and URL compatibility.\n\n## Quick Start\n\nComplex search parameters go beyond simple strings and numbers. TanStack Router's JSON-first approach makes it easy to handle arrays, objects, dates, and nested structures:\n\n```tsx\n// Example of complex search parameters\nconst complexSearch = {\n  tags: ['typescript', 'react', 'router'], // Array\n  filters: {\n    // Nested object\n    category: 'web',\n    minRating: 4.5,\n    active: true,\n  },\n  dateRange: {\n    // Date objects\n    start: new Date('2024-01-01'),\n    end: new Date('2024-12-31'),\n  },\n  pagination: {\n    // Nested pagination\n    page: 1,\n    size: 20,\n    sort: { field: 'name', direction: 'asc' },\n  },\n}\n```\n\n## Working with Arrays\n\nArrays are commonly used for filters, tags, categories, and multi-select options.\n\n### Basic Array Validation\n\n```tsx\n// routes/products.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  categories: z.array(z.string()).default([]),\n  tags: z.array(z.string()).optional(),\n  priceRange: z.array(z.number()).length(2).optional(), // [min, max]\n})\n\nexport const Route = createFileRoute('/products')({\n  validateSearch: searchSchema,\n  component: ProductsComponent,\n})\n\nfunction ProductsComponent() {\n  const { categories, tags, priceRange } = Route.useSearch()\n\n  return (\n    <div>\n      <h2>Active Categories: {categories.join(', ')}</h2>\n      {tags && <p>Tags: {tags.join(', ')}</p>}\n      {priceRange && (\n        <p>\n          Price: ${priceRange[0]} - ${priceRange[1]}\n        </p>\n      )}\n    </div>\n  )\n}\n```\n\n### Navigating with Arrays\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction FilterControls() {\n  return (\n    <div>\n      {/* Add to existing array */}\n      <Link\n        to=\"/products\"\n        search={(prev) => ({\n          ...prev,\n          categories: [...(prev.categories || []), 'electronics'],\n        })}\n      >\n        Add Electronics\n      </Link>\n\n      {/* Replace entire array */}\n      <Link to=\"/products\" search={{ categories: ['books', 'music'] }}>\n        Books & Music Only\n      </Link>\n\n      {/* Remove from array */}\n      <Link\n        to=\"/products\"\n        search={(prev) => ({\n          ...prev,\n          categories:\n            prev.categories?.filter((cat) => cat !== 'electronics') || [],\n        })}\n      >\n        Remove Electronics\n      </Link>\n\n      {/* Clear array */}\n      <Link to=\"/products\" search={(prev) => ({ ...prev, categories: [] })}>\n        Clear All\n      </Link>\n    </div>\n  )\n}\n```\n\n### Advanced Array Patterns\n\n```tsx\n// routes/search.tsx\nconst advancedArraySchema = z.object({\n  // Array of objects\n  filters: z\n    .array(\n      z.object({\n        field: z.string(),\n        operator: z.enum(['eq', 'gt', 'lt', 'contains']),\n        value: z.union([z.string(), z.number(), z.boolean()]),\n      }),\n    )\n    .default([]),\n\n  // Array with constraints\n  selectedIds: z.array(z.string().uuid()).max(10).default([]),\n\n  // Array with transformation\n  sortFields: z\n    .array(z.string())\n    .transform((arr) =>\n      arr.filter((field) => ['name', 'date', 'price'].includes(field)),\n    )\n    .default(['name']),\n})\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: advancedArraySchema,\n  component: SearchComponent,\n})\n```\n\n## Working with Objects\n\nObjects are useful for grouped parameters, complex filters, and nested configurations.\n\n### Basic Object Validation\n\n```tsx\n// routes/dashboard.tsx\nconst dashboardSchema = z.object({\n  view: z\n    .object({\n      layout: z.enum(['grid', 'list', 'cards']).default('grid'),\n      columns: z.number().min(1).max(6).default(3),\n      showDetails: z.boolean().default(false),\n    })\n    .default({}),\n\n  filters: z\n    .object({\n      status: z.enum(['active', 'inactive', 'pending']).optional(),\n      dateCreated: z\n        .object({\n          after: z.string().optional(),\n          before: z.string().optional(),\n        })\n        .optional(),\n      metadata: z.record(z.string()).optional(), // Dynamic object keys\n    })\n    .default({}),\n})\n\nexport const Route = createFileRoute('/dashboard')({\n  validateSearch: dashboardSchema,\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  const { view, filters } = Route.useSearch()\n\n  return (\n    <div>\n      <div className={`layout-${view.layout} columns-${view.columns}`}>\n        {/* Render based on complex object state */}\n      </div>\n\n      {filters.status && <p>Status: {filters.status}</p>}\n      {filters.dateCreated?.after && (\n        <p>Created after: {filters.dateCreated.after}</p>\n      )}\n    </div>\n  )\n}\n```\n\n### Navigating with Objects\n\n```tsx\nfunction ViewControls() {\n  return (\n    <div>\n      {/* Update nested object property */}\n      <Link\n        to=\"/dashboard\"\n        search={(prev) => ({\n          ...prev,\n          view: {\n            ...prev.view,\n            layout: 'list',\n          },\n        })}\n      >\n        List View\n      </Link>\n\n      {/* Update multiple nested properties */}\n      <Link\n        to=\"/dashboard\"\n        search={(prev) => ({\n          ...prev,\n          view: {\n            ...prev.view,\n            layout: 'grid',\n            columns: 4,\n            showDetails: true,\n          },\n        })}\n      >\n        4-Column Grid with Details\n      </Link>\n\n      {/* Deep merge with library for complex updates */}\n      <Link\n        to=\"/dashboard\"\n        search={(prev) =>\n          merge(prev, {\n            filters: {\n              dateCreated: { after: '2024-01-01' },\n            },\n          })\n        }\n      >\n        Filter Recent Items\n      </Link>\n    </div>\n  )\n}\n\n// For deep merging, use a well-tested library:\n\n// Option 1: Lodash (most popular, full-featured)\n// npm install lodash-es\n// import { merge } from 'lodash-es'\n\n// Option 2: deepmerge (lightweight, focused)\n// npm install deepmerge\n// import merge from 'deepmerge'\n\n// Option 3: Ramda (functional programming style)\n// npm install ramda\n// import { mergeDeepRight as merge } from 'ramda'\n\n// Example with deepmerge (recommended for most cases):\nimport merge from 'deepmerge'\n\n// Handles arrays intelligently - combines by default\nconst result = merge(\n  { filters: { tags: ['react'] } },\n  { filters: { tags: ['typescript'] } },\n)\n// Result: { filters: { tags: ['react', 'typescript'] } }\n\n// Override array merging behavior if needed\nconst overwriteResult = merge(\n  { filters: { tags: ['react'] } },\n  { filters: { tags: ['typescript'] } },\n  { arrayMerge: (dest, source) => source }, // Overwrite instead of combine\n)\n// Result: { filters: { tags: ['typescript'] } }\n```\n\n## Working with Dates\n\nDates require special handling for URL serialization and validation.\n\n### Date Validation and Serialization\n\n```tsx\n// routes/events.tsx\nconst eventSchema = z.object({\n  // ISO string dates\n  startDate: z.string().datetime().optional(),\n  endDate: z.string().datetime().optional(),\n\n  // Date range as object\n  dateRange: z\n    .object({\n      start: z.string().datetime(),\n      end: z.string().datetime(),\n    })\n    .optional(),\n\n  // Transform string to Date object\n  selectedDate: z\n    .string()\n    .datetime()\n    .transform((str) => new Date(str))\n    .optional(),\n\n  // Relative dates\n  timeFilter: z.enum(['today', 'week', 'month', 'year']).default('week'),\n})\n\nexport const Route = createFileRoute('/events')({\n  validateSearch: eventSchema,\n  component: EventsComponent,\n})\n\nfunction EventsComponent() {\n  const search = Route.useSearch()\n\n  // Convert string dates back to Date objects for display\n  const startDate = search.startDate ? new Date(search.startDate) : null\n  const endDate = search.endDate ? new Date(search.endDate) : null\n\n  return (\n    <div>\n      {startDate && <p>Events from: {startDate.toLocaleDateString()}</p>}\n      {search.selectedDate && (\n        <p>Selected: {search.selectedDate.toLocaleDateString()}</p>\n      )}\n    </div>\n  )\n}\n```\n\n### Date Navigation Patterns\n\n```tsx\nfunction DateControls() {\n  const navigate = useNavigate()\n\n  const setDateRange = (start: Date, end: Date) => {\n    navigate({\n      to: '/events',\n      search: (prev) => ({\n        ...prev,\n        dateRange: {\n          start: start.toISOString(),\n          end: end.toISOString(),\n        },\n      }),\n    })\n  }\n\n  const setRelativeDate = (period: string) => {\n    const now = new Date()\n    let start: Date\n\n    switch (period) {\n      case 'today':\n        start = new Date(now.getFullYear(), now.getMonth(), now.getDate())\n        break\n      case 'week':\n        start = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000)\n        break\n      case 'month':\n        start = new Date(now.getFullYear(), now.getMonth() - 1, now.getDate())\n        break\n      default:\n        start = now\n    }\n\n    setDateRange(start, now)\n  }\n\n  return (\n    <div>\n      <button onClick={() => setRelativeDate('today')}>Today</button>\n      <button onClick={() => setRelativeDate('week')}>Past Week</button>\n      <button onClick={() => setRelativeDate('month')}>Past Month</button>\n\n      {/* Date picker integration */}\n      <input\n        type=\"date\"\n        onChange={(e) => {\n          const date = new Date(e.target.value)\n          navigate({\n            to: '/events',\n            search: (prev) => ({\n              ...prev,\n              selectedDate: date.toISOString(),\n            }),\n          })\n        }}\n      />\n    </div>\n  )\n}\n```\n\n## Nested Data Structures\n\nComplex applications often need deeply nested search parameters.\n\n### Complex Nested Schema\n\n```tsx\n// routes/analytics.tsx\nconst analyticsSchema = z.object({\n  dashboard: z\n    .object({\n      widgets: z\n        .array(\n          z.object({\n            id: z.string(),\n            type: z.enum(['chart', 'table', 'metric']),\n            config: z.object({\n              title: z.string(),\n              dataSource: z.string(),\n              filters: z.array(\n                z.object({\n                  field: z.string(),\n                  operator: z.string(),\n                  value: z.any(),\n                }),\n              ),\n              visualization: z\n                .object({\n                  chartType: z.enum(['line', 'bar', 'pie']).optional(),\n                  colors: z.array(z.string()).optional(),\n                  axes: z\n                    .object({\n                      x: z.string(),\n                      y: z.array(z.string()),\n                    })\n                    .optional(),\n                })\n                .optional(),\n            }),\n          }),\n        )\n        .default([]),\n\n      layout: z\n        .object({\n          columns: z.number().min(1).max(12).default(2),\n          gap: z.number().default(16),\n          responsive: z.boolean().default(true),\n        })\n        .default({}),\n\n      timeRange: z\n        .object({\n          preset: z.enum(['1h', '24h', '7d', '30d', 'custom']).default('24h'),\n          custom: z\n            .object({\n              start: z.string().datetime(),\n              end: z.string().datetime(),\n            })\n            .optional(),\n        })\n        .default({}),\n    })\n    .default({}),\n})\n\nexport const Route = createFileRoute('/analytics')({\n  validateSearch: analyticsSchema,\n  component: AnalyticsComponent,\n})\n```\n\n### Managing Complex State Updates\n\n```tsx\nfunction AnalyticsControls() {\n  const search = Route.useSearch()\n  const navigate = useNavigate()\n\n  // Helper to update nested widget config\n  const updateWidgetConfig = (widgetId: string, configUpdate: any) => {\n    navigate({\n      to: '/analytics',\n      search: (prev) => ({\n        ...prev,\n        dashboard: {\n          ...prev.dashboard,\n          widgets: prev.dashboard.widgets.map((widget) =>\n            widget.id === widgetId\n              ? {\n                  ...widget,\n                  config: { ...widget.config, ...configUpdate },\n                }\n              : widget,\n          ),\n        },\n      }),\n    })\n  }\n\n  // Helper to add new widget\n  const addWidget = (widget: any) => {\n    navigate({\n      to: '/analytics',\n      search: (prev) => ({\n        ...prev,\n        dashboard: {\n          ...prev.dashboard,\n          widgets: [...prev.dashboard.widgets, widget],\n        },\n      }),\n    })\n  }\n\n  // Helper to update layout\n  const updateLayout = (layoutUpdate: any) => {\n    navigate({\n      to: '/analytics',\n      search: (prev) => ({\n        ...prev,\n        dashboard: {\n          ...prev.dashboard,\n          layout: { ...prev.dashboard.layout, ...layoutUpdate },\n        },\n      }),\n    })\n  }\n\n  return (\n    <div>\n      <button onClick={() => updateLayout({ columns: 3 })}>3 Columns</button>\n\n      <button\n        onClick={() =>\n          addWidget({\n            id: Date.now().toString(),\n            type: 'chart',\n            config: {\n              title: 'New Chart',\n              dataSource: 'default',\n              filters: [],\n            },\n          })\n        }\n      >\n        Add Chart Widget\n      </button>\n    </div>\n  )\n}\n```\n\n## Performance Optimization\n\n### Selective Updates with Selectors\n\n```tsx\n// Only re-render when specific nested values change\nfunction WidgetComponent({ widgetId }: { widgetId: string }) {\n  // Use selector to avoid unnecessary re-renders\n  const widget = Route.useSearch({\n    select: (search) => search.dashboard.widgets.find((w) => w.id === widgetId),\n  })\n\n  const layout = Route.useSearch({\n    select: (search) => search.dashboard.layout,\n  })\n\n  if (!widget) return null\n\n  return (\n    <div\n      style={{\n        gridColumn: `span ${Math.ceil(12 / layout.columns)}`,\n      }}\n    >\n      <h3>{widget.config.title}</h3>\n      {/* Widget content */}\n    </div>\n  )\n}\n```\n\n### Memoization for Complex Transforms\n\n```tsx\nimport { useMemo } from 'react'\n\nfunction ComplexDataComponent() {\n  const search = Route.useSearch()\n\n  // Memoize expensive transformations\n  const processedData = useMemo(() => {\n    return search.dashboard.widgets\n      .filter((widget) => widget.type === 'chart')\n      .map((widget) => ({\n        ...widget,\n        computedMetrics: expensiveCalculation(widget.config),\n      }))\n  }, [search.dashboard.widgets])\n\n  return (\n    <div>\n      {processedData.map((widget) => (\n        <ComplexChart key={widget.id} data={widget} />\n      ))}\n    </div>\n  )\n}\n```\n\n## Production Checklist\n\n- [ ] **Array bounds validation** - Use `.min()`, `.max()`, `.length()` constraints\n- [ ] **Date format consistency** - Stick to ISO strings for URL compatibility\n- [ ] **Object depth limits** - Avoid excessively nested structures for URL length\n- [ ] **Performance testing** - Test with large arrays/objects in search params\n- [ ] **URL length limits** - Most browsers limit URLs to ~2000 characters\n- [ ] **Fallback values** - Provide sensible defaults for all complex types\n- [ ] **Type safety** - Ensure schemas match your component expectations\n- [ ] **Serialization testing** - Verify round-trip serialization works correctly\n\n## Common Problems\n\n### Problem: Array Parameters Not Updating\n\n**Symptoms:** Link clicks don't update array search parameters.\n\n**Cause:** Directly mutating arrays instead of creating new ones.\n\n**Solution:** Always create new arrays when updating:\n\n```tsx\n// ❌ Wrong - mutates existing array\nsearch={(prev) => {\n  prev.categories.push('new-item')\n  return prev\n}}\n\n// ✅ Correct - creates new array\nsearch={(prev) => ({\n  ...prev,\n  categories: [...prev.categories, 'new-item']\n})}\n```\n\n### Problem: Dates Not Serializing Correctly\n\n**Symptoms:** Date objects become `[object Object]` in URL.\n\n**Cause:** Attempting to serialize Date objects directly.\n\n**Solution:** Convert dates to ISO strings:\n\n```tsx\n// ❌ Wrong - Date objects don't serialize\nsearch={{\n  startDate: new Date() // Becomes \"[object Object]\"\n}}\n\n// ✅ Correct - Use ISO strings\nsearch={{\n  startDate: new Date().toISOString()\n}}\n```\n\n### Problem: Deep Object Updates Not Working\n\n**Symptoms:** Nested object properties don't update as expected.\n\n**Cause:** Shallow merging doesn't update nested properties.\n\n**Solution:** Use proper deep merging or spread operators:\n\n```tsx\n// ❌ Wrong - shallow merge loses nested properties\nsearch={(prev) => ({\n  ...prev,\n  filters: { category: 'new' } // Loses other filter properties\n})}\n\n// ✅ Correct - preserve nested properties\nsearch={(prev) => ({\n  ...prev,\n  filters: {\n    ...prev.filters,\n    category: 'new'\n  }\n})}\n```\n\n### Problem: URL Too Long Error\n\n**Symptoms:** Browser errors with very complex search parameters.\n\n**Cause:** Exceeding browser URL length limits (~2000 characters).\n\n**Solutions:**\n\n1. **Simplify data structures** - Remove unnecessary nesting\n2. **Use compression** - Implement custom serialization\n3. **Store in session** - Keep complex state in sessionStorage with URL key\n4. **Pagination** - Break large arrays into pages\n\n```tsx\n// Option 3: Session storage approach\nconst sessionKey = Route.useSearch({ select: (s) => s.sessionKey })\nconst complexData = useMemo(() => {\n  if (sessionKey) {\n    return JSON.parse(sessionStorage.getItem(sessionKey) || '{}')\n  }\n  return {}\n}, [sessionKey])\n```\n\n### Problem: Performance Issues with Large Objects\n\n**Symptoms:** Slow navigation and re-renders with complex search parameters.\n\n**Cause:** Large objects causing expensive serialization and comparison operations.\n\n**Solutions:**\n\n1. **Use selectors** to limit re-renders\n2. **Memoize expensive calculations**\n3. **Consider alternatives** like context or state management\n\n```tsx\n// Use selector to minimize re-renders\nconst onlyNeededData = Route.useSearch({\n  select: (search) => ({\n    currentPage: search.pagination.page,\n    pageSize: search.pagination.size,\n  }),\n})\n```\n\n## Common Next Steps\n\n<!-- - [Share Search Parameters Across Routes](./share-search-params-across-routes.md) - Inherit and manage search params across route hierarchies -->\n<!-- - [Optimize Search Parameter Performance](./optimize-search-param-performance.md) - Advanced performance patterns for search state -->\n<!-- - [Customize Search Parameter Serialization](./customize-search-param-serialization.md) - Implement custom serialization for compression and compatibility -->\n<!-- - [Build Search-Based Filtering Systems](./build-search-filtering-systems.md) - Create filtering UIs with URL state -->\n\n## Related Resources\n\n- [Search Params Guide](../guide/search-params.md) - Core concepts and JSON-first approach\n- [Zod Documentation](https://zod.dev/) - Schema validation library\n- [MDN Date.toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - Date serialization reference\n- [URLSearchParams Limits](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers) - Browser URL length limits\n\n**Deep Merging Libraries:**\n\n- [deepmerge](https://www.npmjs.com/package/deepmerge) - Lightweight, focused deep merging utility\n- [Lodash merge](https://lodash.com/docs#merge) - Full-featured utility library with deep merging\n- [Ramda mergeDeepRight](https://ramdajs.com/docs/#mergeDeepRight) - Functional programming approach\n"
  },
  {
    "path": "docs/router/how-to/debug-router-issues.md",
    "content": "---\ntitle: How to Debug Common Router Issues\n---\n\nThis guide covers debugging common TanStack Router problems, from route matching failures to navigation issues and performance problems.\n\n## Quick Start\n\nUse TanStack Router DevTools for real-time debugging, add strategic console logging, and follow systematic troubleshooting patterns to identify and resolve router issues quickly.\n\n---\n\n## Essential Debugging Tools\n\n### 1. TanStack Router DevTools\n\nInstall and configure the DevTools for the best debugging experience:\n\n```bash\nnpm install @tanstack/router-devtools\n```\n\n```tsx\n// src/App.tsx\nimport { TanStackRouterDevtools } from '@tanstack/router-devtools'\n\nfunction App() {\n  return (\n    <div>\n      <RouterProvider router={router} />\n      {/* Only shows in development */}\n      <TanStackRouterDevtools router={router} />\n    </div>\n  )\n}\n```\n\n**DevTools Features:**\n\n- **Route Tree Visualization** - See your entire route structure\n- **Current Route State** - Inspect active route data, params, and search\n- **Navigation History** - Track navigation events and timing\n- **Route Matching** - See which routes match current URL\n- **Performance Metrics** - Monitor route load times and re-renders\n\n### 2. Debug Mode Configuration\n\nEnable debug mode for detailed console logging:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  context: {\n    // your context\n  },\n  // Enable debug mode\n  debug: true,\n})\n```\n\n### 3. Browser DevTools Setup\n\n**Add router to global scope for debugging:**\n\n```tsx\n// In development only\nif (import.meta.env.DEV) {\n  window.router = router\n}\n\n// Console debugging commands:\n// router.state - current router state\n// router.navigate() - programmatic navigation\n// router.history - navigation history\n```\n\n---\n\n## Route Matching Issues\n\n### Problem: Route Not Found (404)\n\n**Symptoms:**\n\n- Route exists but shows 404 or \"Not Found\"\n- Console shows route matching failures\n\n**Debugging Steps:**\n\n1. **Check Route Path Definition**\n\n```tsx\n// ❌ Common mistake - missing leading slash\nconst route = createRoute({\n  path: 'about', // Should be '/about'\n  // ...\n})\n\n// ✅ Correct\nconst route = createRoute({\n  path: '/about',\n  // ...\n})\n```\n\n2. **Verify Route Tree Structure**\n\n```tsx\n// Debug route tree in console\nconsole.log('Route tree:', router.routeTree)\nconsole.log('All routes:', router.routesById)\n```\n\n3. **Check Parent Route Configuration**\n\n```tsx\n// Ensure parent route is properly defined\nconst childRoute = createRoute({\n  getParentRoute: () => parentRoute, // Must return correct parent\n  path: '/child',\n  // ...\n})\n```\n\n### Problem: Route Parameters Not Working\n\n**Symptoms:**\n\n- `useParams()` returns undefined or wrong values\n- Route params not being parsed correctly\n\n**Debugging Steps:**\n\n1. **Verify Parameter Syntax**\n\n```tsx\n// ❌ Wrong parameter syntax\npath: '/users/{id}' // Should use $\n\n// ✅ Correct parameter syntax\npath: '/users/$userId'\n```\n\n2. **Check Parameter Parsing**\n\n```tsx\nconst route = createRoute({\n  path: '/users/$userId',\n  // Add parameter validation/parsing\n  params: {\n    parse: (params) => ({\n      userId: Number(params.userId), // Convert to number\n    }),\n    stringify: (params) => ({\n      userId: String(params.userId), // Convert back to string\n    }),\n  },\n  component: () => {\n    const { userId } = Route.useParams()\n    console.log('User ID:', userId, typeof userId) // Debug output\n    return <div>User {userId}</div>\n  },\n})\n```\n\n3. **Debug Current URL and Params**\n\n```tsx\nfunction DebugParams() {\n  const location = useLocation()\n  const params = Route.useParams()\n\n  console.log('Current pathname:', location.pathname)\n  console.log('Parsed params:', params)\n\n  return null // Just for debugging\n}\n```\n\n---\n\n## Navigation Issues\n\n### Problem: Navigation Not Working\n\n**Symptoms:**\n\n- Links don't navigate\n- Programmatic navigation fails silently\n- Browser URL doesn't update\n\n**Debugging Steps:**\n\n1. **Check Link Configuration**\n\n```tsx\n// ❌ Common mistakes\n<Link to=\"about\">About</Link> // Missing leading slash\n<Link href=\"/about\">About</Link> // Wrong prop (href instead of to)\n\n// ✅ Correct\n<Link to=\"/about\">About</Link>\n```\n\n2. **Debug Navigation Calls**\n\n```tsx\nfunction NavigationDebug() {\n  const navigate = useNavigate()\n\n  const handleNavigate = () => {\n    console.log('Attempting navigation...')\n    navigate({\n      to: '/dashboard',\n      search: { tab: 'settings' },\n    })\n      .then(() => console.log('Navigation successful'))\n      .catch((err) => console.error('Navigation failed:', err))\n  }\n\n  return <button onClick={handleNavigate}>Navigate</button>\n}\n```\n\n3. **Check Router Context**\n\n```tsx\n// Ensure component is inside RouterProvider\nfunction ComponentWithNavigation() {\n  const router = useRouter() // Will throw error if outside provider\n  console.log('Router state:', router.state)\n\n  return <div>...</div>\n}\n```\n\n### Problem: Navigation Redirects Unexpectedly\n\n**Symptoms:**\n\n- Navigating to one route but ending up somewhere else\n- Infinite redirect loops\n\n**Debugging Steps:**\n\n1. **Check Route Guards**\n\n```tsx\nconst route = createRoute({\n  path: '/dashboard',\n  beforeLoad: ({ context, location }) => {\n    console.log('Before load - location:', location.pathname)\n    console.log('Auth state:', context.auth)\n\n    if (!context.auth.isAuthenticated) {\n      console.log('Redirecting to login...')\n      throw redirect({ to: '/login' })\n    }\n  },\n  // ...\n})\n```\n\n2. **Debug Redirect Chains**\n\n```tsx\n// Add to router configuration\nconst router = createRouter({\n  routeTree,\n  context: {\n    /* ... */\n  },\n  // Log all navigation events\n  onNavigate: ({ location, type }) => {\n    console.log(`Navigation (${type}):`, location.pathname)\n  },\n})\n```\n\n---\n\n## Data Loading Problems\n\n### Problem: Route Data Not Loading\n\n**Symptoms:**\n\n- `useLoaderData()` returns undefined\n- Loading states not working correctly\n- Data not refreshing\n\n**Debugging Steps:**\n\n1. **Check Loader Implementation**\n\n```tsx\nconst route = createRoute({\n  path: '/posts',\n  loader: async ({ params, context }) => {\n    console.log('Loader called with params:', params)\n\n    try {\n      const data = await fetchPosts()\n      console.log('Loader data:', data)\n      return data\n    } catch (error) {\n      console.error('Loader error:', error)\n      throw error\n    }\n  },\n  component: () => {\n    const data = Route.useLoaderData()\n    console.log('Component data:', data)\n\n    return <div>{/* render data */}</div>\n  },\n})\n```\n\n2. **Debug Loading States**\n\n```tsx\nfunction DataLoadingDebug() {\n  const location = useLocation()\n\n  console.log('Route status:', {\n    isLoading: location.isLoading,\n    isTransitioning: location.isTransitioning,\n  })\n\n  return null\n}\n```\n\n3. **Check Loader Dependencies**\n\n```tsx\nconst route = createRoute({\n  path: '/posts/$postId',\n  loader: async ({ params }) => {\n    // Loader will re-run when params change\n    console.log('Loading post:', params.postId)\n    return fetchPost(params.postId)\n  },\n  // Add dependencies for explicit re-loading\n  loaderDeps: ({ search }) => ({\n    refresh: search.refresh,\n  }),\n})\n```\n\n---\n\n## Search Parameters Issues\n\n### Problem: Search Params Not Updating\n\n**Symptoms:**\n\n- URL search params don't update\n- `useSearch()` returns stale data\n- Search validation errors\n\n**Debugging Steps:**\n\n1. **Check Search Validation Schema**\n\n```tsx\nconst route = createRoute({\n  path: '/search',\n  validateSearch: (search) => {\n    console.log('Raw search params:', search)\n\n    const validated = {\n      q: (search.q as string) || '',\n      page: Number(search.page) || 1,\n    }\n\n    console.log('Validated search params:', validated)\n    return validated\n  },\n  component: () => {\n    const search = Route.useSearch()\n    console.log('Component search:', search)\n\n    return <div>Query: {search.q}</div>\n  },\n})\n```\n\n2. **Debug Search Navigation**\n\n```tsx\nfunction SearchDebug() {\n  const navigate = useNavigate()\n  const currentSearch = Route.useSearch()\n\n  const updateSearch = (newSearch: any) => {\n    console.log('Current search:', currentSearch)\n    console.log('New search:', newSearch)\n\n    navigate({\n      to: '.',\n      search: (prev) => {\n        const updated = { ...prev, ...newSearch }\n        console.log('Final search:', updated)\n        return updated\n      },\n    })\n  }\n\n  return (\n    <button onClick={() => updateSearch({ q: 'test' })}>Update Search</button>\n  )\n}\n```\n\n---\n\n## Performance Issues\n\n### Problem: Excessive Re-renders\n\n**Symptoms:**\n\n- Components re-rendering too often\n- Performance lag during navigation\n- Memory usage increasing\n\n**Debugging Steps:**\n\n1. **Use React DevTools Profiler**\n\n```tsx\n// Wrap your app for profiling\nimport { Profiler } from 'react'\n\nfunction App() {\n  return (\n    <Profiler\n      id=\"Router\"\n      onRender={(id, phase, actualDuration) => {\n        console.log(`${id} ${phase} took ${actualDuration}ms`)\n      }}\n    >\n      <RouterProvider router={router} />\n    </Profiler>\n  )\n}\n```\n\n2. **Optimize Route Subscriptions**\n\n```tsx\n// ❌ Subscribes to all search params\nfunction MyComponent() {\n  const search = Route.useSearch()\n  return <div>{search.someSpecificField}</div>\n}\n\n// ✅ Subscribe only to specific field\nfunction MyComponent() {\n  const someSpecificField = Route.useSearch({\n    select: (search) => search.someSpecificField,\n  })\n  return <div>{someSpecificField}</div>\n}\n```\n\n3. **Monitor Route State Changes**\n\n```tsx\n// Add to router configuration\nconst router = createRouter({\n  routeTree,\n  context: {\n    /* ... */\n  },\n  onUpdate: (router) => {\n    console.log('Router state updated:', {\n      pathname: router.state.location.pathname,\n      isLoading: router.state.isLoading,\n      matches: router.state.matches.length,\n    })\n  },\n})\n```\n\n### Problem: Memory Leaks\n\n**Symptoms:**\n\n- Memory usage constantly increasing\n- Browser becomes slow over time\n- Route components not cleaning up\n\n**Debugging Steps:**\n\n1. **Check Component Cleanup**\n\n```tsx\nfunction MyComponent() {\n  const [data, setData] = useState(null)\n\n  useEffect(() => {\n    const subscription = someService.subscribe(setData)\n\n    // ✅ Always clean up subscriptions\n    return () => {\n      subscription.unsubscribe()\n    }\n  }, [])\n\n  return <div>{data}</div>\n}\n```\n\n2. **Monitor Route Unmounting**\n\n```tsx\nfunction DebuggableComponent() {\n  useEffect(() => {\n    console.log('Component mounted')\n\n    return () => {\n      console.log('Component unmounted')\n    }\n  }, [])\n\n  return <div>Content</div>\n}\n```\n\n---\n\n## TypeScript Issues\n\n### Problem: Type Errors with Router\n\n**Symptoms:**\n\n- TypeScript errors in route definitions\n- Type inference not working\n- Parameter types incorrect\n\n**Debugging Steps:**\n\n1. **Check Route Tree Type Registration**\n\n```tsx\n// Ensure this declaration exists\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n```\n\n2. **Debug Route Type Generation**\n\n```bash\n# Check if route types are being generated\nls src/routeTree.gen.ts\n\n# Regenerate route types if needed\nnpx @tanstack/router-cli generate\n```\n\n3. **Use Type Assertions for Debugging**\n\n```tsx\nfunction TypeDebugComponent() {\n  const params = Route.useParams()\n  const search = Route.useSearch()\n\n  // Add type assertions to check what TypeScript infers\n  console.log('Params type:', params as any)\n  console.log('Search type:', search as any)\n\n  return null\n}\n```\n\n---\n\n## Systematic Debugging Process\n\n### 1. Information Gathering\n\nWhen debugging any router issue, start by collecting this information:\n\n```tsx\nfunction RouterDebugInfo() {\n  const router = useRouter()\n  const location = useLocation()\n\n  useEffect(() => {\n    console.group('🐛 Router Debug Info')\n    console.log('Current pathname:', location.pathname)\n    console.log('Search params:', location.search)\n    console.log('Router state:', router.state)\n    console.log('Active matches:', router.state.matches)\n    console.log('Route tree:', router.routeTree)\n    console.groupEnd()\n  }, [location.pathname])\n\n  return null\n}\n\n// Add to your app during debugging\n;<RouterDebugInfo />\n```\n\n### 2. Isolation Testing\n\nCreate minimal reproduction:\n\n```tsx\n// Minimal route for testing\nconst testRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/debug',\n  component: () => {\n    console.log('Test route rendered')\n    return <div>Debug Route</div>\n  },\n})\n\n// Add to route tree temporarily\nconst routeTree = rootRoute.addChildren([\n  // ... other routes\n  testRoute, // Add test route\n])\n```\n\n### 3. Step-by-Step Debugging\n\n1. **Verify basic setup** - Router provider, route tree structure\n2. **Check route definitions** - Paths, parent routes, configuration\n3. **Test navigation** - Links, programmatic navigation\n4. **Validate data flow** - Loaders, search params, context\n5. **Monitor performance** - Re-renders, memory usage\n\n---\n\n## Browser Debugging Tips\n\n### Console Commands\n\n```js\n// In browser console (when router is on window)\n\n// Current router state\nrouter.state\n\n// Navigate programmatically\nrouter.navigate({ to: '/some-path' })\n\n// Get route by path\nrouter.getRoute('/users/$userId')\n\n// Check if route exists\nrouter.buildLocation({ to: '/some-path' })\n\n// View all registered routes\nObject.keys(router.routesById)\n```\n\n### Network Tab\n\nMonitor these requests when debugging:\n\n- **Route code chunks** - Check if lazy routes are loading\n- **Loader data requests** - Verify API calls from loaders\n- **Failed requests** - Look for 404s or failed API calls\n\n### React DevTools\n\n1. **Components Tab** - Find router components and inspect props\n2. **Profiler Tab** - Identify performance bottlenecks\n3. **Search for components** - Find specific route components quickly\n\n---\n\n## Common Error Messages\n\n### \"Route not found\"\n\n- Check route path spelling and case sensitivity\n- Verify route is added to route tree\n- Ensure parent routes are properly configured\n\n### \"Cannot read property 'useParams' of undefined\"\n\n- Component is likely outside RouterProvider\n- Route might not be properly registered\n- Check if using correct Route object\n\n### \"Invalid search params\"\n\n- Check validateSearch schema\n- Verify search param types match schema\n- Look for required vs optional parameters\n\n### \"Navigation was interrupted\"\n\n- Usually caused by redirect in beforeLoad\n- Check for redirect loops\n- Verify authentication logic\n\n---\n\n## Performance Monitoring\n\n### Enable Performance Tracking\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  context: {\n    /* ... */\n  },\n  onUpdate: (router) => {\n    performance.mark('router-update')\n  },\n  onLoad: (router) => {\n    performance.mark('router-load')\n    performance.measure('router-load-time', 'router-update', 'router-load')\n  },\n})\n```\n\n### Monitor Route Loading Times\n\n```tsx\nconst route = createRoute({\n  path: '/slow-route',\n  loader: async () => {\n    const start = performance.now()\n    const data = await fetchData()\n    const end = performance.now()\n\n    console.log(`Loader took ${end - start}ms`)\n    return data\n  },\n})\n```\n\n---\n\n## Common Next Steps\n\nAfter debugging router issues, you might want to:\n\n- [How to Set Up Testing](./setup-testing.md) - Add tests to prevent regressions\n- [How to Deploy to Production](./deploy-to-production.md) - Ensure issues don't occur in production\n\n<!-- TODO: Uncomment as guides are created\n- [How to Optimize Performance](./optimize-performance.md)\n- [How to Set Up Error Monitoring](./setup-error-monitoring.md)\n-->\n\n## Related Resources\n\n- [TanStack Router DevTools](https://github.com/TanStack/router/tree/main/packages/router-devtools) - Official debugging tools\n- [React DevTools](https://react.dev/learn/react-developer-tools) - React-specific debugging\n- [Router Core Documentation](../overview.md) - Understanding router internals\n"
  },
  {
    "path": "docs/router/how-to/deploy-to-production.md",
    "content": "---\ntitle: How to Deploy TanStack Router to Production\n---\n\nThis guide covers deploying TanStack Router applications to popular hosting platforms.\n\n## Quick Start\n\nSingle Page Applications (SPAs) need special server configuration to handle client-side routing. Configure your hosting platform to serve `index.html` for all routes, allowing TanStack Router to handle navigation.\n\n---\n\n## Netlify Deployment\n\n### 1. Create `_redirects` File\n\nCreate a `public/_redirects` file (or `_redirects` in your build output):\n\n```\n/*    /index.html   200\n```\n\n### 2. Alternative: `netlify.toml`\n\nCreate a `netlify.toml` file in your project root:\n\n```toml\n[[redirects]]\n  from = \"/*\"\n  to = \"/index.html\"\n  status = 200\n\n[build]\n  publish = \"dist\"\n  command = \"npm run build\"\n```\n\n### 3. For TanStack Start (SSR)\n\n```toml\n[build]\n  publish = \".output/public\"\n  command = \"npm run build\"\n\n[functions]\n  directory = \".output/server\"\n\n[[redirects]]\n  from = \"/api/*\"\n  to = \"/.netlify/functions/server\"\n  status = 200\n\n[[redirects]]\n  from = \"/*\"\n  to = \"/index.html\"\n  status = 200\n```\n\n---\n\n## Cloudflare Pages\n\n### 1. Create `_redirects` File\n\nCreate a `public/_redirects` file:\n\n```\n/*    /index.html   200\n```\n\n### 2. Alternative: `_routes.json`\n\nCreate a `public/_routes.json` file for more control:\n\n```json\n{\n  \"version\": 1,\n  \"include\": [\"/*\"],\n  \"exclude\": [\"/api/*\"]\n}\n```\n\n### 3. For TanStack Start (SSR)\n\nCreate `functions/_middleware.ts` for SSR support:\n\n```ts\nexport const onRequest: PagesFunction = async (context) => {\n  // Handle SSR requests\n  return await handleSSR(context)\n}\n```\n\n### 4. Deploy via Git\n\n1. Connect your GitHub repository to Cloudflare Pages\n2. Set build settings:\n   - **Build command:** `npm run build`\n   - **Build output directory:** `dist`\n   - **Root directory:** (leave empty)\n\n### 5. Deploy via Wrangler CLI\n\n```bash\n# Install Wrangler\nnpm install -g wrangler\n\n# Deploy\nwrangler pages publish dist --project-name=my-app\n```\n\n---\n\n## Vercel Deployment\n\n### 1. Create `vercel.json`\n\nCreate a `vercel.json` file in your project root:\n\n```json\n{\n  \"rewrites\": [\n    {\n      \"source\": \"/(.*)\",\n      \"destination\": \"/index.html\"\n    }\n  ]\n}\n```\n\n### 2. For TanStack Start (SSR) Applications\n\nIf using TanStack Start with SSR, use this configuration instead:\n\n```json\n{\n  \"functions\": {\n    \"app/server.ts\": {\n      \"runtime\": \"nodejs18.x\"\n    }\n  },\n  \"routes\": [\n    {\n      \"src\": \"/(.*)\",\n      \"dest\": \"/api/server\"\n    }\n  ]\n}\n```\n\n### 3. Build Configuration\n\nEnsure your `package.json` has the correct build script:\n\n```json\n{\n  \"scripts\": {\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\"\n  }\n}\n```\n\n### 4. Deploy\n\n```bash\n# Install Vercel CLI\nnpm i -g vercel\n\n# Deploy\nvercel\n```\n\n---\n\n## GitHub Pages\n\n### 1. Create `404.html`\n\nGitHub Pages requires a `404.html` file that duplicates `index.html`:\n\n```bash\n# After building\ncp dist/index.html dist/404.html\n```\n\n### 2. Update `vite.config.js`\n\n```js\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  base: '/your-repo-name/', // Replace with your repository name\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n  build: {\n    outDir: 'dist',\n  },\n})\n```\n\n### 3. GitHub Actions Workflow\n\nCreate `.github/workflows/deploy.yml`:\n\n```yaml\nname: Deploy to GitHub Pages\n\non:\n  push:\n    branches: [main]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n\n      - name: Setup Node.js\n        uses: actions/setup-node@v3\n        with:\n          node-version: '18'\n          cache: 'npm'\n\n      - name: Install dependencies\n        run: npm ci\n\n      - name: Build\n        run: npm run build\n\n      - name: Create 404.html\n        run: cp dist/index.html dist/404.html\n\n      - name: Deploy to GitHub Pages\n        uses: peaceiris/actions-gh-pages@v3\n        with:\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n          publish_dir: ./dist\n```\n\n---\n\n## Firebase Hosting\n\n### 1. Create `firebase.json`\n\n```json\n{\n  \"hosting\": {\n    \"public\": \"dist\",\n    \"ignore\": [\"firebase.json\", \"**/.*\", \"**/node_modules/**\"],\n    \"rewrites\": [\n      {\n        \"source\": \"**\",\n        \"destination\": \"/index.html\"\n      }\n    ]\n  }\n}\n```\n\n### 2. Deploy\n\n```bash\n# Install Firebase CLI\nnpm install -g firebase-tools\n\n# Login and initialize\nfirebase login\nfirebase init hosting\n\n# Build and deploy\nnpm run build\nfirebase deploy\n```\n\n---\n\n## Apache Server\n\nCreate a `.htaccess` file in your build output directory:\n\n```apache\n<IfModule mod_rewrite.c>\n  RewriteEngine On\n  RewriteBase /\n  RewriteRule ^index\\.html$ - [L]\n  RewriteCond %{REQUEST_FILENAME} !-f\n  RewriteCond %{REQUEST_FILENAME} !-d\n  RewriteRule . /index.html [L]\n</IfModule>\n```\n\n---\n\n## Nginx\n\nAdd this configuration to your Nginx server block:\n\n```nginx\nserver {\n  listen 80;\n  server_name your-domain.com;\n  root /path/to/your/dist;\n  index index.html;\n\n  location / {\n    try_files $uri $uri/ /index.html;\n  }\n\n  # Optional: Cache static assets\n  location ~* \\.(js|css|png|jpg|jpeg|gif|ico|svg)$ {\n    expires 1y;\n    add_header Cache-Control \"public, immutable\";\n  }\n}\n```\n\n---\n\n## Docker Deployment\n\n### 1. Create `Dockerfile`\n\n```dockerfile\n# Build stage\nFROM node:18-alpine AS build\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci\nCOPY . .\nRUN npm run build\n\n# Production stage\nFROM nginx:alpine\nCOPY --from=build /app/dist /usr/share/nginx/html\nCOPY nginx.conf /etc/nginx/conf.d/default.conf\nEXPOSE 80\nCMD [\"nginx\", \"-g\", \"daemon off;\"]\n```\n\n### 2. Create `nginx.conf`\n\n```nginx\nserver {\n    listen 80;\n    server_name localhost;\n    root /usr/share/nginx/html;\n    index index.html;\n\n    location / {\n        try_files $uri $uri/ /index.html;\n    }\n}\n```\n\n### 3. Build and Run\n\n```bash\ndocker build -t my-tanstack-app .\ndocker run -p 80:80 my-tanstack-app\n```\n\n---\n\n## Production Checklist\n\nBefore deploying, ensure you have:\n\n- [ ] Created hosting platform configuration file\n- [ ] Set correct base path if deploying to subdirectory\n- [ ] Configured environment variables with `VITE_` prefix\n- [ ] Tested all routes by direct URL access\n- [ ] Verified static assets load correctly\n\n---\n\n## Common Problems\n\n### 404 Errors on Page Refresh\n\n**Problem:** Routes work when navigating within the app, but refreshing the page shows 404.\n\n**Cause:** The server looks for files like `/about/index.html` which don't exist in SPAs.\n\n**Solution:** Add the configuration files shown above for your hosting platform.\n\n### App Works Locally But Breaks When Deployed\n\n**Problem:** App works in development but shows errors in production.\n\n**Solutions:**\n\n- **Subdirectory deployment:** Configure base path in `vite.config.js`:\n  ```js\n  export default defineConfig({\n    base: '/my-app/', // Match your deployment path\n  })\n  ```\n- **Build output mismatch:** Ensure build directory matches hosting config:\n  ```js\n  export default defineConfig({\n    build: {\n      outDir: 'dist', // Must match hosting platform setting\n    },\n  })\n  ```\n- **Environment variables:** Prefix with `VITE_` and rebuild:\n  ```bash\n  # .env\n  VITE_API_URL=https://api.example.com\n  ```\n\n### Assets Not Loading (CSS/JS 404s)\n\n**Problem:** App loads but styling is broken or JavaScript fails to load.\n\n**Solutions:**\n\n- Check build output directory in hosting configuration\n- Verify public path configuration in Vite\n- Ensure static file serving is properly configured\n\n---\n\n## Common Next Steps\n\nAfter deployment, you might want to:\n\n- [How to Set Up Basic Authentication](./setup-authentication.md) - Secure your application with auth\n- [Migrate from React Router v7](./migrate-from-react-router.md) - Complete migration guide if you're coming from React Router\n- [How to Set Up Server-Side Rendering (SSR)](./setup-ssr.md)\n\n<!-- TODO: Uncomment as how-to guides are created\n- [How to Optimize Performance](./optimize-performance.md)\n- [How to Set Up Analytics](./setup-analytics.md)\n-->\n\n## Related Resources\n\n- [Deployment Examples](https://github.com/TanStack/router/tree/main/examples) - Official examples\n"
  },
  {
    "path": "docs/router/how-to/drafts/README.md",
    "content": "# How-To Guide Drafts\n\nThis directory contains draft content for upcoming how-to guides in the Progressive Search Parameters Series. Each draft file contains:\n\n- **Metadata** about the final destination and dependencies\n- **Staged content** extracted from other guides to avoid scope creep\n- **Implementation notes** for future development\n- **Cross-reference planning** for proper guide linking\n\n## File Naming Convention\n\n- `{guide-name}.draft.md` - Draft content for upcoming guides\n- Clear metadata header with destination path and status\n\n## Current Drafts\n\n### ⏳ Ready for Implementation (Substantial Content Available)\n\n1. **`validate-search-params.draft.md`**\n   - **Destination:** `validate-search-params.md`\n   - **Position:** Intermediate Level - Guide #3\n   - **Content:** Schema validation, type safety, error handling\n\n2. **`build-search-filtering-systems.draft.md`**\n   - **Destination:** `build-search-filtering-systems.md`\n   - **Position:** Specialized Use Cases - Guide #9\n   - **Content:** Complete filtering UIs, search results, pagination\n\n3. **`search-params-in-forms.draft.md`**\n   - **Destination:** `search-params-in-forms.md`\n   - **Position:** Specialized Use Cases - Guide #10\n   - **Content:** Form synchronization, state management\n\n4. **`optimize-search-param-performance.draft.md`**\n   - **Destination:** `optimize-search-param-performance.md`\n   - **Position:** Advanced Level - Guide #7\n   - **Content:** Performance optimization, memoization patterns\n\n## Implementation Workflow\n\nWhen implementing a guide from a draft:\n\n1. **Copy the staged content** to the final destination\n2. **Expand with additional examples** specific to the guide's focus\n3. **Add comprehensive troubleshooting** for the domain\n4. **Update cross-references** in related guides\n5. **Update the main README** to mark guide as completed\n6. **Delete the draft file** once fully implemented\n\n## Benefits of This System\n\n- **Prevents scope creep** in individual guides\n- **Preserves valuable content** during refactoring\n- **Enables focused guide development**\n- **Maintains clear progression** through the series\n- **Facilitates parallel development** of multiple guides\n\n## Content Sources\n\nMost staged content originates from:\n\n- `navigate-with-search-params.md` - Content moved to maintain focus\n- Implementation planning sessions\n- User feedback and common questions\n"
  },
  {
    "path": "docs/router/how-to/drafts/build-search-filtering-systems.draft.md",
    "content": "# DRAFT: Build Search-Based Filtering Systems\n\n**Final Destination:** `docs/router/framework/react/how-to/build-search-filtering-systems.md`  \n**Progressive Series Position:** Specialized Use Cases - Guide #9  \n**Depends On:** `setup-basic-search-params.md`, `navigate-with-search-params.md`, `validate-search-params.md`  \n**Status:** Ready for implementation - comprehensive UI patterns available\n\n---\n\n## Content Staged from navigate-with-search-params.md\n\n### Search Result Navigation\n\nHandle search result navigation with query preservation:\n\n```tsx\nimport { Link, useSearch } from '@tanstack/react-router'\n\nfunction SearchResults() {\n  const search = useSearch({ from: '/search' })\n\n  return (\n    <div>\n      {/* Preserve search query, change view */}\n      <nav>\n        <Link search={(prev) => ({ ...prev, view: 'grid' })}>Grid View</Link>\n        <Link search={(prev) => ({ ...prev, view: 'list' })}>List View</Link>\n      </nav>\n\n      {/* Pagination with query preservation */}\n      <div>\n        {search.page > 1 && (\n          <Link search={(prev) => ({ ...prev, page: prev.page - 1 })}>\n            Previous\n          </Link>\n        )}\n\n        <Link search={(prev) => ({ ...prev, page: (prev.page || 1) + 1 })}>\n          Next\n        </Link>\n      </div>\n\n      {/* Related searches */}\n      <div>\n        Related searches:\n        {['laptops gaming', 'laptops business', 'laptops student'].map(\n          (suggestion) => (\n            <Link\n              key={suggestion}\n              search={(prev) => ({ ...prev, query: suggestion, page: 1 })}\n            >\n              {suggestion}\n            </Link>\n          ),\n        )}\n      </div>\n    </div>\n  )\n}\n```\n\n### Filter Navigation\n\nBuild filtering interfaces with search parameter navigation:\n\n```tsx\nimport { Link, useSearch } from '@tanstack/react-router'\n\nconst categories = ['electronics', 'clothing', 'books', 'home']\nconst sortOptions = [\n  { value: 'relevance', label: 'Relevance' },\n  { value: 'price-asc', label: 'Price: Low to High' },\n  { value: 'price-desc', label: 'Price: High to Low' },\n  { value: 'rating', label: 'Customer Rating' },\n]\n\nfunction FilterNavigation() {\n  const search = useSearch({ from: '/products' })\n\n  return (\n    <aside>\n      {/* Category filters */}\n      <div>\n        <h3>Categories</h3>\n        {categories.map((category) => (\n          <Link\n            key={category}\n            search={(prev) => ({\n              ...prev,\n              category: prev.category === category ? undefined : category,\n              page: 1,\n            })}\n            className={search.category === category ? 'active' : ''}\n          >\n            {category}\n          </Link>\n        ))}\n      </div>\n\n      {/* Sort options */}\n      <div>\n        <h3>Sort By</h3>\n        {sortOptions.map((option) => (\n          <Link\n            key={option.value}\n            search={(prev) => ({ ...prev, sort: option.value, page: 1 })}\n            className={search.sort === option.value ? 'active' : ''}\n          >\n            {option.label}\n          </Link>\n        ))}\n      </div>\n\n      {/* Clear all filters */}\n      <Link\n        search={(prev) => {\n          const { category, sort, minPrice, maxPrice, ...rest } = prev\n          return rest\n        }}\n      >\n        Clear All Filters\n      </Link>\n    </aside>\n  )\n}\n```\n\n### Programmatic Search Controls\n\nNavigate programmatically with search parameter updates:\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction SearchControls() {\n  const navigate = useNavigate()\n\n  const handleSortChange = (sortBy: string) => {\n    navigate({\n      search: (prev) => ({ ...prev, sort: sortBy, page: 1 }),\n    })\n  }\n\n  const handleClearFilters = () => {\n    navigate({\n      search: (prev) => {\n        const { category, minPrice, maxPrice, ...rest } = prev\n        return rest\n      },\n    })\n  }\n\n  return (\n    <div>\n      <select onChange={(e) => handleSortChange(e.target.value)}>\n        <option value=\"relevance\">Sort by Relevance</option>\n        <option value=\"price-asc\">Price: Low to High</option>\n        <option value=\"price-desc\">Price: High to Low</option>\n      </select>\n\n      <button onClick={handleClearFilters}>Clear Filters</button>\n    </div>\n  )\n}\n```\n\n---\n\n## Implementation Notes\n\n### Additional Content Needed:\n\n- [ ] Complete e-commerce filtering example\n- [ ] Advanced filter combinations (price ranges, multi-select)\n- [ ] Filter state persistence and sharing\n- [ ] Search result highlighting and sorting\n- [ ] Infinite scroll pagination patterns\n- [ ] Filter URL state management best practices\n- [ ] Accessibility considerations for filter UIs\n- [ ] Mobile-responsive filter patterns\n\n### Cross-References to Add:\n\n- Link to `setup-basic-search-params.md` for foundation\n- Link to `navigate-with-search-params.md` for navigation patterns\n- Link to `validate-search-params.md` for filter validation\n- Forward link to `search-params-with-data-loading.md` for data integration\n\n### README Update Required:\n\n- [ ] Mark guide as completed in progressive series\n- [ ] Uncomment \"Common Next Steps\" in related guides\n"
  },
  {
    "path": "docs/router/how-to/drafts/optimize-search-param-performance.draft.md",
    "content": "# DRAFT: Optimize Search Parameter Performance\n\n**Final Destination:** `docs/router/framework/react/how-to/optimize-search-param-performance.md`  \n**Progressive Series Position:** Advanced Level (Power User Patterns) - Guide #7  \n**Depends On:** `setup-basic-search-params.md`, `navigate-with-search-params.md`  \n**Status:** Ready for implementation - performance patterns available\n\n---\n\n## Content Staged from navigate-with-search-params.md\n\n### Performance Issues with Functional Updates\n\n**Problem:** Complex functional updates cause unnecessary re-renders.\n\n```tsx\n// ❌ Wrong - complex computation in render\n<Link search={(prev) => {\n  // Expensive computation on every render\n  const result = expensiveCalculation(prev)\n  return { ...prev, computed: result }\n}}>\n  Update\n</Link>\n\n// ✅ Correct - memoize or use callback\nconst updateSearch = useCallback((prev) => {\n  const result = expensiveCalculation(prev)\n  return { ...prev, computed: result }\n}, [])\n\n<Link search={updateSearch}>Update</Link>\n```\n\n### Navigation During Render\n\n**Problem:** Calling navigate during component render causes infinite loops.\n\n```tsx\nfunction ProblematicComponent() {\n  const navigate = useNavigate()\n\n  // ❌ Wrong - navigate during render\n  if (someCondition) {\n    navigate({ search: { redirect: true } })\n  }\n\n  return <div>Content</div>\n}\n\nfunction FixedComponent() {\n  const navigate = useNavigate()\n\n  // ✅ Correct - navigate in effect\n  useEffect(() => {\n    if (someCondition) {\n      navigate({ search: { redirect: true } })\n    }\n  }, [someCondition, navigate])\n\n  return <div>Content</div>\n}\n```\n\n---\n\n## Implementation Notes\n\n### Additional Content Needed:\n\n- [ ] Search parameter selectors to prevent unnecessary re-renders\n- [ ] Debouncing search input updates\n- [ ] Memoization strategies for expensive search computations\n- [ ] React.memo usage with search parameters\n- [ ] useMemo patterns for derived search state\n- [ ] Search parameter batching techniques\n- [ ] Performance monitoring and profiling search params\n- [ ] Bundle size optimization strategies\n\n### Cross-References to Add:\n\n- Link to `setup-basic-search-params.md` for foundation\n- Link to `navigate-with-search-params.md` for navigation patterns\n- Link to `search-params-in-forms.md` for debouncing forms\n- Forward link to `debug-search-param-issues.md` for debugging performance\n\n### README Update Required:\n\n- [ ] Mark guide as completed in progressive series\n- [ ] Uncomment \"Common Next Steps\" in related guides\n"
  },
  {
    "path": "docs/router/how-to/drafts/search-params-in-forms.draft.md",
    "content": "# DRAFT: Handle Search Parameters in Forms\n\n**Final Destination:** `docs/router/framework/react/how-to/search-params-in-forms.md`  \n**Progressive Series Position:** Specialized Use Cases - Guide #10  \n**Depends On:** `setup-basic-search-params.md`, `navigate-with-search-params.md`, `validate-search-params.md`  \n**Status:** Ready for implementation - form synchronization patterns available\n\n---\n\n## Content Staged from navigate-with-search-params.md\n\n### Navigation with State Synchronization\n\nKeep component state in sync with URL search parameters:\n\n```tsx\nimport { useState, useEffect } from 'react'\nimport { useNavigate, useSearch } from '@tanstack/react-router'\n\nfunction SynchronizedForm() {\n  const navigate = useNavigate()\n  const search = useSearch({ from: '/products' })\n\n  // Local state synced with URL\n  const [localFilters, setLocalFilters] = useState({\n    minPrice: search.minPrice || 0,\n    maxPrice: search.maxPrice || 1000,\n    inStock: search.inStock || false,\n  })\n\n  // Update local state when URL changes\n  useEffect(() => {\n    setLocalFilters({\n      minPrice: search.minPrice || 0,\n      maxPrice: search.maxPrice || 1000,\n      inStock: search.inStock || false,\n    })\n  }, [search.minPrice, search.maxPrice, search.inStock])\n\n  const applyFilters = () => {\n    navigate({\n      search: (prev) => ({\n        ...prev,\n        ...localFilters,\n        page: 1, // Reset pagination\n      }),\n    })\n  }\n\n  const resetFilters = () => {\n    const defaultFilters = { minPrice: 0, maxPrice: 1000, inStock: false }\n    setLocalFilters(defaultFilters)\n\n    navigate({\n      search: (prev) => {\n        const { minPrice, maxPrice, inStock, ...rest } = prev\n        return rest\n      },\n    })\n  }\n\n  return (\n    <div>\n      <label>\n        Min Price:\n        <input\n          type=\"number\"\n          value={localFilters.minPrice}\n          onChange={(e) =>\n            setLocalFilters((prev) => ({\n              ...prev,\n              minPrice: parseInt(e.target.value) || 0,\n            }))\n          }\n        />\n      </label>\n\n      <label>\n        Max Price:\n        <input\n          type=\"number\"\n          value={localFilters.maxPrice}\n          onChange={(e) =>\n            setLocalFilters((prev) => ({\n              ...prev,\n              maxPrice: parseInt(e.target.value) || 1000,\n            }))\n          }\n        />\n      </label>\n\n      <label>\n        <input\n          type=\"checkbox\"\n          checked={localFilters.inStock}\n          onChange={(e) =>\n            setLocalFilters((prev) => ({\n              ...prev,\n              inStock: e.target.checked,\n            }))\n          }\n        />\n        In Stock Only\n      </label>\n\n      <button onClick={applyFilters}>Apply Filters</button>\n      <button onClick={resetFilters}>Reset</button>\n    </div>\n  )\n}\n```\n\n### Form with Search Parameter Validation\n\n```tsx\nconst handleFormSubmit = (formData: FormData) => {\n  const query = formData.get('query') as string\n  const page = parseInt(formData.get('page') as string) || 1\n\n  safeNavigate({ query, page })\n}\n\nreturn (\n  <form action={handleFormSubmit}>\n    <input name=\"query\" placeholder=\"Search...\" required />\n    <input name=\"page\" type=\"number\" defaultValue=\"1\" />\n    <button type=\"submit\">Search</button>\n  </form>\n)\n```\n\n---\n\n## Implementation Notes\n\n### Additional Content Needed:\n\n- [ ] Uncontrolled form patterns with search params\n- [ ] Controlled form patterns with real-time updates\n- [ ] Form library integration (React Hook Form, Formik)\n- [ ] Debounced form updates to URL\n- [ ] Form reset and default value handling\n- [ ] Multi-step form with URL state\n- [ ] File upload forms with search state\n- [ ] Form validation error handling with URL feedback\n\n### Cross-References to Add:\n\n- Link to `setup-basic-search-params.md` for foundation\n- Link to `navigate-with-search-params.md` for navigation patterns\n- Link to `validate-search-params.md` for form validation\n- Forward link to `optimize-search-param-performance.md` for debouncing\n\n### README Update Required:\n\n- [ ] Mark guide as completed in progressive series\n- [ ] Uncomment \"Common Next Steps\" in related guides\n"
  },
  {
    "path": "docs/router/how-to/install.md",
    "content": "---\ntitle: How to Install TanStack Router\n---\n\n## Prerequisites\n\n- React 18.x.x or 19.x.x\n- ReactDOM 18.x.x or 19.x.x with `createRoot` support\n- TypeScript 5.3.x or higher (recommended)\n\n## Installation Steps\n\n1. **Install the package**\n\n   Choose your package manager:\n\n   ```sh\n   npm install @tanstack/react-router\n   ```\n\n   ```sh\n   pnpm add @tanstack/react-router\n   ```\n\n   ```sh\n   yarn add @tanstack/react-router\n   ```\n\n   ```sh\n   bun add @tanstack/react-router\n   ```\n\n   ```sh\n   deno add npm:@tanstack/react-router\n   ```\n\n2. **Verify installation**\n\n   Check that the package appears in your `package.json`:\n\n   ```json\n   {\n     \"dependencies\": {\n       \"@tanstack/react-router\": \"^x.x.x\"\n     }\n   }\n   ```\n"
  },
  {
    "path": "docs/router/how-to/integrate-chakra-ui.md",
    "content": "---\ntitle: How to Integrate TanStack Router with Chakra UI\n---\n\nThis guide covers setting up Chakra UI with TanStack Router, including theme configuration and creating responsive, accessible components.\n\n## Quick Start\n\n**Time Required:** 30-40 minutes  \n**Difficulty:** Beginner to Intermediate  \n**Prerequisites:** Existing TanStack Router project\n\n### What You'll Accomplish\n\n- Install and configure Chakra UI with TanStack Router\n- Set up theme provider and custom theming\n- Create type-safe router-compatible Chakra components\n- Implement responsive navigation patterns\n- Build accessible UI components with router integration\n\n---\n\n## Installation and Setup\n\n### Step 1: Install Chakra UI Dependencies\n\n```bash\nnpm install @chakra-ui/react @emotion/react @emotion/styled framer-motion\n```\n\n### Step 2: Set Up Chakra Provider\n\n```tsx\n// src/components/chakra-provider.tsx\nimport { ChakraProvider, extendTheme, type ThemeConfig } from '@chakra-ui/react'\nimport { ReactNode } from 'react'\n\n// Extend the theme with custom colors and configurations\nconst config: ThemeConfig = {\n  initialColorMode: 'light',\n  useSystemColorMode: true,\n}\n\nconst theme = extendTheme({\n  config,\n  colors: {\n    brand: {\n      50: '#e3f2fd',\n      100: '#bbdefb',\n      200: '#90caf9',\n      300: '#64b5f6',\n      400: '#42a5f5',\n      500: '#2196f3',\n      600: '#1e88e5',\n      700: '#1976d2',\n      800: '#1565c0',\n      900: '#0d47a1',\n    },\n  },\n  fonts: {\n    heading: 'Inter, sans-serif',\n    body: 'Inter, sans-serif',\n  },\n  components: {\n    Button: {\n      defaultProps: {\n        colorScheme: 'brand',\n      },\n    },\n    Link: {\n      baseStyle: {\n        _hover: {\n          textDecoration: 'none',\n        },\n      },\n    },\n  },\n})\n\ninterface ChakraAppProviderProps {\n  children: ReactNode\n}\n\nexport function ChakraAppProvider({ children }: ChakraAppProviderProps) {\n  return <ChakraProvider theme={theme}>{children}</ChakraProvider>\n}\n```\n\n### Step 3: Update Root Route\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/router-devtools'\nimport { ChakraAppProvider } from '@/components/chakra-provider'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <ChakraAppProvider>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </ChakraAppProvider>\n  ),\n})\n```\n\n---\n\n## Creating Router-Compatible Components\n\n### Step 1: Create Router-Compatible Chakra Components\n\n```tsx\n// src/components/ui/chakra-router-link.tsx\nimport { createLink } from '@tanstack/react-router'\nimport { Link as ChakraLink, Button, IconButton } from '@chakra-ui/react'\nimport { forwardRef } from 'react'\n\n// Router-compatible Chakra Link\nexport const RouterLink = createLink(\n  forwardRef<HTMLAnchorElement, any>((props, ref) => {\n    return <ChakraLink ref={ref} {...props} />\n  }),\n)\n\n// Router-compatible Chakra Button\nexport const RouterButton = createLink(\n  forwardRef<HTMLButtonElement, any>((props, ref) => {\n    return <Button ref={ref} as=\"button\" {...props} />\n  }),\n)\n\n// Router-compatible Chakra IconButton\nexport const RouterIconButton = createLink(\n  forwardRef<HTMLButtonElement, any>((props, ref) => {\n    return <IconButton ref={ref} as=\"button\" {...props} />\n  }),\n)\n```\n\n### Step 2: Create Navigation Components\n\n```tsx\n// src/components/navigation/chakra-nav.tsx\nimport { useMatchRoute } from '@tanstack/react-router'\nimport {\n  Box,\n  Flex,\n  HStack,\n  IconButton,\n  useDisclosure,\n  useColorModeValue,\n  Stack,\n  Collapse,\n} from '@chakra-ui/react'\nimport { HamburgerIcon, CloseIcon } from '@chakra-ui/icons'\nimport { RouterLink } from '@/components/ui/chakra-router-link'\n\ninterface NavItem {\n  label: string\n  to: string\n  exact?: boolean\n}\n\ninterface ChakraNavProps {\n  items: NavItem[]\n  brand?: string\n  brandTo?: string\n}\n\nexport function ChakraNav({\n  items,\n  brand = 'Logo',\n  brandTo = '/',\n}: ChakraNavProps) {\n  const { isOpen, onToggle } = useDisclosure()\n  const matchRoute = useMatchRoute()\n\n  return (\n    <Box>\n      <Flex\n        bg={useColorModeValue('white', 'gray.800')}\n        color={useColorModeValue('gray.600', 'white')}\n        minH=\"60px\"\n        py={{ base: 2 }}\n        px={{ base: 4 }}\n        borderBottom={1}\n        borderStyle=\"solid\"\n        borderColor={useColorModeValue('gray.200', 'gray.900')}\n        align=\"center\"\n      >\n        <Flex\n          flex={{ base: 1, md: 'auto' }}\n          ml={{ base: -2 }}\n          display={{ base: 'flex', md: 'none' }}\n        >\n          <IconButton\n            onClick={onToggle}\n            icon={\n              isOpen ? <CloseIcon w={3} h={3} /> : <HamburgerIcon w={5} h={5} />\n            }\n            variant=\"ghost\"\n            aria-label=\"Toggle Navigation\"\n          />\n        </Flex>\n\n        <Flex flex={{ base: 1 }} justify={{ base: 'center', md: 'start' }}>\n          <RouterLink\n            to={brandTo}\n            fontFamily=\"heading\"\n            fontWeight=\"bold\"\n            fontSize=\"xl\"\n            color={useColorModeValue('gray.800', 'white')}\n          >\n            {brand}\n          </RouterLink>\n\n          <Flex display={{ base: 'none', md: 'flex' }} ml={10}>\n            <DesktopNav items={items} />\n          </Flex>\n        </Flex>\n      </Flex>\n\n      <Collapse in={isOpen} animateOpacity>\n        <MobileNav items={items} />\n      </Collapse>\n    </Box>\n  )\n}\n\nfunction DesktopNav({ items }: { items: NavItem[] }) {\n  const matchRoute = useMatchRoute()\n  const linkColor = useColorModeValue('gray.600', 'gray.200')\n  const linkHoverColor = useColorModeValue('gray.800', 'white')\n\n  return (\n    <HStack spacing={4}>\n      {items.map((item) => {\n        const isActive = matchRoute({ to: item.to, fuzzy: !item.exact })\n\n        return (\n          <RouterLink\n            key={item.to}\n            to={item.to}\n            p={2}\n            fontSize=\"sm\"\n            fontWeight={isActive ? 'bold' : 'medium'}\n            color={isActive ? 'brand.500' : linkColor}\n            _hover={{\n              textDecoration: 'none',\n              color: linkHoverColor,\n            }}\n          >\n            {item.label}\n          </RouterLink>\n        )\n      })}\n    </HStack>\n  )\n}\n\nfunction MobileNav({ items }: { items: NavItem[] }) {\n  const matchRoute = useMatchRoute()\n\n  return (\n    <Stack\n      bg={useColorModeValue('white', 'gray.800')}\n      p={4}\n      display={{ md: 'none' }}\n    >\n      {items.map((item) => {\n        const isActive = matchRoute({ to: item.to, fuzzy: !item.exact })\n\n        return (\n          <RouterLink\n            key={item.to}\n            to={item.to}\n            py={2}\n            fontWeight={isActive ? 'bold' : 'medium'}\n            color={\n              isActive ? 'brand.500' : useColorModeValue('gray.600', 'gray.200')\n            }\n            _hover={{\n              textDecoration: 'none',\n            }}\n          >\n            {item.label}\n          </RouterLink>\n        )\n      })}\n    </Stack>\n  )\n}\n```\n\n### Step 3: Create Breadcrumb Navigation\n\n```tsx\n// src/components/navigation/chakra-breadcrumb.tsx\nimport { useRouter } from '@tanstack/react-router'\nimport {\n  Breadcrumb,\n  BreadcrumbItem,\n  BreadcrumbLink,\n  BreadcrumbSeparator,\n} from '@chakra-ui/react'\nimport { ChevronRightIcon } from '@chakra-ui/icons'\nimport { RouterLink } from '@/components/ui/chakra-router-link'\n\ninterface BreadcrumbConfig {\n  [key: string]: string\n}\n\ninterface ChakraBreadcrumbProps {\n  config?: BreadcrumbConfig\n  separator?: React.ReactElement\n}\n\nexport function ChakraBreadcrumb({\n  config = {},\n  separator = <ChevronRightIcon color=\"gray.500\" />,\n}: ChakraBreadcrumbProps) {\n  const router = useRouter()\n  const pathSegments = router.state.location.pathname.split('/').filter(Boolean)\n\n  if (pathSegments.length === 0) return null\n\n  const breadcrumbItems = pathSegments.map((segment, index) => {\n    const path = '/' + pathSegments.slice(0, index + 1).join('/')\n    const label =\n      config[segment] || segment.charAt(0).toUpperCase() + segment.slice(1)\n    const isLast = index === pathSegments.length - 1\n\n    return {\n      path,\n      label,\n      isLast,\n    }\n  })\n\n  return (\n    <Breadcrumb spacing=\"8px\" separator={separator}>\n      <BreadcrumbItem>\n        <BreadcrumbLink as={RouterLink} to=\"/\">\n          Home\n        </BreadcrumbLink>\n      </BreadcrumbItem>\n\n      {breadcrumbItems.map(({ path, label, isLast }) => (\n        <BreadcrumbItem key={path} isCurrentPage={isLast}>\n          <BreadcrumbLink\n            as={isLast ? 'span' : RouterLink}\n            to={isLast ? undefined : path}\n            color={isLast ? 'gray.500' : undefined}\n          >\n            {label}\n          </BreadcrumbLink>\n        </BreadcrumbItem>\n      ))}\n    </Breadcrumb>\n  )\n}\n```\n\n---\n\n## Responsive Design Patterns\n\n### Step 1: Create Responsive Layout Component\n\n```tsx\n// src/components/layout/chakra-layout.tsx\nimport { ReactNode } from 'react'\nimport {\n  Box,\n  Container,\n  Flex,\n  useColorModeValue,\n  VStack,\n  useBreakpointValue,\n} from '@chakra-ui/react'\nimport { ChakraNav } from '@/components/navigation/chakra-nav'\nimport { ChakraBreadcrumb } from '@/components/navigation/chakra-breadcrumb'\n\ninterface ChakraLayoutProps {\n  children: ReactNode\n  showBreadcrumb?: boolean\n  maxWidth?: string\n}\n\nconst navItems = [\n  { label: 'Home', to: '/', exact: true },\n  { label: 'Posts', to: '/posts' },\n  { label: 'About', to: '/about' },\n  { label: 'Contact', to: '/contact' },\n]\n\nexport function ChakraLayout({\n  children,\n  showBreadcrumb = true,\n  maxWidth = 'container.xl',\n}: ChakraLayoutProps) {\n  const containerPadding = useBreakpointValue({ base: 4, md: 6 })\n\n  return (\n    <Box minH=\"100vh\" bg={useColorModeValue('gray.50', 'gray.900')}>\n      <ChakraNav items={navItems} brand=\"My App\" />\n\n      <Container maxW={maxWidth} py={containerPadding}>\n        {showBreadcrumb && (\n          <Box mb={6}>\n            <ChakraBreadcrumb />\n          </Box>\n        )}\n\n        <Box>{children}</Box>\n      </Container>\n    </Box>\n  )\n}\n```\n\n### Step 2: Create Responsive Card Grid\n\n```tsx\n// src/components/ui/chakra-card-grid.tsx\nimport { ReactNode } from 'react'\nimport { SimpleGrid, Box, useBreakpointValue } from '@chakra-ui/react'\n\ninterface ChakraCardGridProps {\n  children: ReactNode\n  minChildWidth?: string\n  spacing?: number\n}\n\nexport function ChakraCardGrid({\n  children,\n  minChildWidth = '300px',\n  spacing = 6,\n}: ChakraCardGridProps) {\n  const columns = useBreakpointValue({\n    base: 1,\n    md: 2,\n    lg: 3,\n    xl: 4,\n  })\n\n  return (\n    <SimpleGrid\n      columns={columns}\n      spacing={spacing}\n      minChildWidth={minChildWidth}\n    >\n      {children}\n    </SimpleGrid>\n  )\n}\n```\n\n---\n\n## Complete Usage Examples\n\n### Step 1: Posts List Page\n\n```tsx\n// src/routes/posts/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport {\n  Box,\n  Card,\n  CardBody,\n  CardHeader,\n  Heading,\n  Text,\n  Badge,\n  VStack,\n  HStack,\n  useColorModeValue,\n} from '@chakra-ui/react'\nimport { ChakraLayout } from '@/components/layout/chakra-layout'\nimport { ChakraCardGrid } from '@/components/ui/chakra-card-grid'\nimport { RouterLink, RouterButton } from '@/components/ui/chakra-router-link'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsPage,\n})\n\nfunction PostsPage() {\n  const posts = [\n    {\n      id: '1',\n      title: 'Getting Started with TanStack Router',\n      excerpt: 'Learn how to build type-safe routing in React applications.',\n      category: 'Tutorial',\n      readTime: '5 min read',\n    },\n    {\n      id: '2',\n      title: 'Chakra UI Best Practices',\n      excerpt: 'Tips and tricks for building beautiful UIs with Chakra UI.',\n      category: 'Design',\n      readTime: '8 min read',\n    },\n  ]\n\n  return (\n    <ChakraLayout>\n      <VStack spacing={8} align=\"stretch\">\n        <Box>\n          <Heading size=\"xl\" mb={4}>\n            Blog Posts\n          </Heading>\n          <Text color={useColorModeValue('gray.600', 'gray.400')}>\n            Discover our latest articles and tutorials\n          </Text>\n        </Box>\n\n        <Box>\n          <RouterButton colorScheme=\"brand\" mb={6}>\n            Create New Post\n          </RouterButton>\n\n          <ChakraCardGrid>\n            {posts.map((post) => (\n              <PostCard key={post.id} post={post} />\n            ))}\n          </ChakraCardGrid>\n        </Box>\n      </VStack>\n    </ChakraLayout>\n  )\n}\n\nfunction PostCard({ post }: { post: any }) {\n  const cardBg = useColorModeValue('white', 'gray.800')\n  const cardBorder = useColorModeValue('gray.200', 'gray.700')\n\n  return (\n    <Card\n      bg={cardBg}\n      borderColor={cardBorder}\n      borderWidth=\"1px\"\n      _hover={{\n        shadow: 'lg',\n        transform: 'translateY(-2px)',\n        transition: 'all 0.2s',\n      }}\n    >\n      <CardHeader pb={3}>\n        <HStack justify=\"space-between\" align=\"start\">\n          <Badge colorScheme=\"brand\" variant=\"subtle\">\n            {post.category}\n          </Badge>\n          <Text fontSize=\"sm\" color=\"gray.500\">\n            {post.readTime}\n          </Text>\n        </HStack>\n      </CardHeader>\n\n      <CardBody pt={0}>\n        <VStack align=\"start\" spacing={3}>\n          <RouterLink to=\"/posts/$postId\" params={{ postId: post.id }}>\n            <Heading size=\"md\" _hover={{ color: 'brand.500' }}>\n              {post.title}\n            </Heading>\n          </RouterLink>\n\n          <Text color={useColorModeValue('gray.600', 'gray.400')}>\n            {post.excerpt}\n          </Text>\n\n          <RouterButton\n            to=\"/posts/$postId\"\n            params={{ postId: post.id }}\n            variant=\"ghost\"\n            colorScheme=\"brand\"\n            size=\"sm\"\n            alignSelf=\"flex-start\"\n          >\n            Read More →\n          </RouterButton>\n        </VStack>\n      </CardBody>\n    </Card>\n  )\n}\n```\n\n### Step 2: Post Detail Page\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport {\n  Box,\n  Heading,\n  Text,\n  VStack,\n  HStack,\n  Button,\n  useColorModeValue,\n  Divider,\n  Tag,\n  TagLabel,\n} from '@chakra-ui/react'\nimport { ArrowBackIcon, EditIcon, DeleteIcon } from '@chakra-ui/icons'\nimport { ChakraLayout } from '@/components/layout/chakra-layout'\nimport { RouterButton, RouterLink } from '@/components/ui/chakra-router-link'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostPage,\n})\n\nfunction PostPage() {\n  const { postId } = Route.useParams()\n  const textColor = useColorModeValue('gray.600', 'gray.300')\n\n  return (\n    <ChakraLayout>\n      <VStack spacing={8} align=\"stretch\">\n        {/* Back Navigation */}\n        <Box>\n          <RouterLink\n            to=\"/posts\"\n            color=\"brand.500\"\n            _hover={{ textDecoration: 'none' }}\n          >\n            <HStack spacing={2}>\n              <ArrowBackIcon />\n              <Text>Back to Posts</Text>\n            </HStack>\n          </RouterLink>\n        </Box>\n\n        {/* Post Header */}\n        <VStack spacing={4} align=\"start\">\n          <Heading size=\"2xl\">Understanding TanStack Router</Heading>\n\n          <HStack spacing={3}>\n            <Tag colorScheme=\"brand\">\n              <TagLabel>Tutorial</TagLabel>\n            </Tag>\n            <Text color={textColor}>March 15, 2024</Text>\n            <Text color={textColor}>•</Text>\n            <Text color={textColor}>5 min read</Text>\n          </HStack>\n\n          <Divider />\n        </VStack>\n\n        {/* Post Content */}\n        <Box>\n          <VStack spacing={4} align=\"start\">\n            <Text color={textColor} lineHeight=\"tall\">\n              This is the detailed content of post {postId}. In this\n              comprehensive guide, we'll explore how to integrate TanStack\n              Router with Chakra UI to create beautiful, accessible, and\n              responsive web applications.\n            </Text>\n\n            <Text color={textColor} lineHeight=\"tall\">\n              Chakra UI provides a simple, modular, and accessible component\n              library that gives you the building blocks you need to build React\n              applications with speed.\n            </Text>\n          </VStack>\n        </Box>\n\n        {/* Action Buttons */}\n        <HStack spacing={4}>\n          <RouterButton\n            to=\"/posts/$postId/edit\"\n            params={{ postId }}\n            leftIcon={<EditIcon />}\n            colorScheme=\"brand\"\n            variant=\"outline\"\n          >\n            Edit Post\n          </RouterButton>\n\n          <Button leftIcon={<DeleteIcon />} colorScheme=\"red\" variant=\"outline\">\n            Delete Post\n          </Button>\n        </HStack>\n      </VStack>\n    </ChakraLayout>\n  )\n}\n```\n\n---\n\n## Common Problems\n\n### Theme Provider Issues\n\n**Problem:** Chakra theme not applying correctly across routes.\n\n**Solution:** Ensure ChakraProvider wraps the entire app at the root level:\n\n```tsx\n// ❌ Don't put provider inside individual routes\nexport const Route = createFileRoute('/some-route')({\n  component: () => (\n    <ChakraProvider>\n      <SomeComponent />\n    </ChakraProvider>\n  ),\n})\n\n// ✅ Put provider at root level\nexport const Route = createRootRoute({\n  component: () => (\n    <ChakraProvider>\n      <Outlet />\n    </ChakraProvider>\n  ),\n})\n```\n\n### TypeScript Errors with Router Integration\n\n**Problem:** TypeScript errors when using Chakra components with TanStack Router.\n\n**Solution:** Use proper typing with `createLink`:\n\n```tsx\nimport { createLink } from '@tanstack/react-router'\nimport { Button, type ButtonProps } from '@chakra-ui/react'\nimport { forwardRef } from 'react'\n\n// Properly typed router button\nexport const RouterButton = createLink(\n  forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n    return <Button ref={ref} as=\"button\" {...props} />\n  }),\n)\n```\n\n### Color Mode Persistence\n\n**Problem:** Color mode doesn't persist across route changes.\n\n**Solution:** Set up proper color mode manager:\n\n```tsx\nimport { ColorModeScript } from '@chakra-ui/react'\n\n// Add to your index.html head\n;<ColorModeScript initialColorMode={theme.config.initialColorMode} />\n\n// Or use localStorage manager\nimport { localStorageManager } from '@chakra-ui/react'\n;<ChakraProvider theme={theme} colorModeManager={localStorageManager}>\n  {children}\n</ChakraProvider>\n```\n\n### Responsive Design Issues\n\n**Problem:** Responsive breakpoints not working correctly.\n\n**Solution:** Use Chakra's responsive utilities properly:\n\n```tsx\n// ✅ Use breakpoint values correctly\nconst columns = useBreakpointValue({\n  base: 1,\n  md: 2,\n  lg: 3,\n  xl: 4,\n})\n\n// ✅ Or use responsive props\n<Box\n  display={{ base: 'block', md: 'flex' }}\n  flexDirection={{ base: 'column', md: 'row' }}\n>\n```\n\n---\n\n## Production Checklist\n\nBefore deploying your Chakra UI + TanStack Router app:\n\n### Functionality\n\n- [ ] All router-compatible components work correctly\n- [ ] Navigation states properly reflected\n- [ ] Theme persists across route changes\n- [ ] TypeScript compilation successful\n\n### Accessibility\n\n- [ ] Keyboard navigation working\n- [ ] Screen reader compatibility tested\n- [ ] Color contrast meets WCAG standards\n- [ ] Focus management working properly\n\n### Performance\n\n- [ ] Bundle size optimized\n- [ ] Color mode switching performant\n- [ ] No unnecessary re-renders\n- [ ] Images and icons optimized\n\n### Responsiveness\n\n- [ ] Works on mobile devices\n- [ ] Tablet layouts functional\n- [ ] Desktop experience optimal\n- [ ] Breakpoints working correctly\n\n---\n\n## Related Resources\n\n- [Chakra UI Documentation](https://chakra-ui.com/getting-started) - Complete component library guide\n- [Chakra UI Recipes](https://chakra-ui.com/community/recipes) - Common patterns and recipes\n- [TanStack Router createLink API](../api/router#createlink) - API documentation for component integration\n- [Emotion CSS-in-JS](https://emotion.sh/docs/introduction) - Styling library used by Chakra UI\n"
  },
  {
    "path": "docs/router/how-to/integrate-framer-motion.md",
    "content": "---\ntitle: How to Integrate TanStack Router with Framer Motion\n---\n\nThis guide covers setting up Framer Motion with TanStack Router for smooth route transitions and navigation animations.\n\n## Quick Start\n\n**Time Required:** 30-45 minutes  \n**Difficulty:** Intermediate  \n**Prerequisites:** Existing TanStack Router project\n\n### What You'll Accomplish\n\n- Install and configure Framer Motion with TanStack Router\n- Create smooth route transition animations\n- Implement animated navigation components\n- Set up layout animations and shared elements\n- Handle complex animation sequences\n\n---\n\n## Installation and Setup\n\n### Step 1: Install Framer Motion\n\n```bash\nnpm install framer-motion\n```\n\n### Step 2: Verify Version Compatibility\n\nEnsure you're using compatible versions:\n\n```json\n{\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.0.0\",\n    \"framer-motion\": \"^11.0.0\",\n    \"react\": \"^18.0.0\"\n  }\n}\n```\n\n---\n\n## Route Transition Animations\n\n### Step 1: Create Animated Route Wrapper\n\n```tsx\n// src/components/animated-route.tsx\nimport { motion, type MotionProps, type Variants } from 'framer-motion'\nimport { ReactNode } from 'react'\n\ninterface AnimatedRouteProps extends MotionProps {\n  children: ReactNode\n  variant?: 'fade' | 'slide' | 'scale' | 'slideUp'\n}\n\nconst routeVariants: Record<string, Variants> = {\n  fade: {\n    initial: { opacity: 0 },\n    in: { opacity: 1 },\n    out: { opacity: 0 },\n  },\n  slide: {\n    initial: { opacity: 0, x: -20 },\n    in: { opacity: 1, x: 0 },\n    out: { opacity: 0, x: 20 },\n  },\n  scale: {\n    initial: { opacity: 0, scale: 0.95 },\n    in: { opacity: 1, scale: 1 },\n    out: { opacity: 0, scale: 1.05 },\n  },\n  slideUp: {\n    initial: { opacity: 0, y: 20 },\n    in: { opacity: 1, y: 0 },\n    out: { opacity: 0, y: -20 },\n  },\n}\n\nconst pageTransition = {\n  type: 'tween',\n  ease: 'anticipate',\n  duration: 0.3,\n}\n\nexport function AnimatedRoute({\n  children,\n  variant = 'fade',\n  ...motionProps\n}: AnimatedRouteProps) {\n  return (\n    <motion.div\n      initial=\"initial\"\n      animate=\"in\"\n      exit=\"out\"\n      variants={routeVariants[variant]}\n      transition={pageTransition}\n      {...motionProps}\n    >\n      {children}\n    </motion.div>\n  )\n}\n```\n\n### Step 2: Set Up Route Animation Container\n\n```tsx\n// src/components/route-animation-container.tsx\nimport { useRouter } from '@tanstack/react-router'\nimport { AnimatePresence } from 'framer-motion'\nimport { ReactNode } from 'react'\n\ninterface RouteAnimationContainerProps {\n  children: ReactNode\n}\n\nexport function RouteAnimationContainer({\n  children,\n}: RouteAnimationContainerProps) {\n  const router = useRouter()\n\n  return (\n    <AnimatePresence mode=\"wait\" initial={false}>\n      <div key={router.state.location.pathname}>{children}</div>\n    </AnimatePresence>\n  )\n}\n```\n\n### Step 3: Update Root Route for Animations\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/router-devtools'\nimport { RouteAnimationContainer } from '@/components/route-animation-container'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <>\n      <RouteAnimationContainer>\n        <Outlet />\n      </RouteAnimationContainer>\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n```\n\n### Step 4: Use Animations in Routes\n\n```tsx\n// src/routes/posts/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { motion } from 'framer-motion'\nimport { AnimatedRoute } from '@/components/animated-route'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsPage,\n})\n\nfunction PostsPage() {\n  return (\n    <AnimatedRoute variant=\"slide\">\n      <div className=\"container mx-auto p-4\">\n        <motion.h1\n          initial={{ opacity: 0, y: -20 }}\n          animate={{ opacity: 1, y: 0 }}\n          transition={{ delay: 0.1 }}\n          className=\"text-3xl font-bold mb-6\"\n        >\n          Posts\n        </motion.h1>\n\n        <motion.div\n          initial={{ opacity: 0 }}\n          animate={{ opacity: 1 }}\n          transition={{ delay: 0.2 }}\n          className=\"grid gap-4\"\n        >\n          {/* Post cards with staggered animations */}\n          {posts.map((post, index) => (\n            <motion.div\n              key={post.id}\n              initial={{ opacity: 0, y: 20 }}\n              animate={{ opacity: 1, y: 0 }}\n              transition={{ delay: 0.3 + index * 0.1 }}\n              className=\"border rounded-lg p-4\"\n            >\n              <h2 className=\"text-xl font-semibold\">{post.title}</h2>\n              <p className=\"text-gray-600\">{post.excerpt}</p>\n            </motion.div>\n          ))}\n        </motion.div>\n      </div>\n    </AnimatedRoute>\n  )\n}\n```\n\n---\n\n## Animated Navigation Components\n\n### Step 1: Create Animated Tab Navigation\n\n```tsx\n// src/components/navigation/animated-tabs.tsx\nimport { Link, useMatchRoute } from '@tanstack/react-router'\nimport { motion } from 'framer-motion'\n\ninterface TabItem {\n  to: string\n  label: string\n  exact?: boolean\n}\n\ninterface AnimatedTabsProps {\n  items: TabItem[]\n  className?: string\n}\n\nexport function AnimatedTabs({ items, className }: AnimatedTabsProps) {\n  const matchRoute = useMatchRoute()\n\n  return (\n    <nav className={`flex space-x-1 p-2 bg-gray-100 rounded-lg ${className}`}>\n      {items.map((item) => {\n        const isActive = matchRoute({ to: item.to, fuzzy: !item.exact })\n\n        return (\n          <Link\n            key={item.to}\n            to={item.to}\n            className={`relative px-3 py-2 rounded-md text-sm font-medium transition-colors ${\n              isActive ? 'text-blue-600' : 'text-gray-600 hover:text-gray-900'\n            }`}\n          >\n            {isActive && (\n              <motion.div\n                layoutId=\"activeTab\"\n                className=\"absolute inset-0 bg-white rounded-md shadow-sm\"\n                initial={false}\n                transition={{\n                  type: 'spring',\n                  bounce: 0.2,\n                  duration: 0.6,\n                }}\n              />\n            )}\n            <span className=\"relative z-10\">{item.label}</span>\n          </Link>\n        )\n      })}\n    </nav>\n  )\n}\n```\n\n### Step 2: Create Sliding Mobile Menu\n\n```tsx\n// src/components/navigation/animated-mobile-menu.tsx\nimport { useState } from 'react'\nimport { Link } from '@tanstack/react-router'\nimport { motion, AnimatePresence } from 'framer-motion'\n\ninterface MenuItem {\n  to: string\n  label: string\n  icon?: React.ReactNode\n}\n\ninterface AnimatedMobileMenuProps {\n  items: MenuItem[]\n  trigger: React.ReactNode\n}\n\nexport function AnimatedMobileMenu({\n  items,\n  trigger,\n}: AnimatedMobileMenuProps) {\n  const [isOpen, setIsOpen] = useState(false)\n\n  const menuVariants = {\n    closed: {\n      opacity: 0,\n      x: '-100%',\n      transition: {\n        type: 'spring',\n        stiffness: 400,\n        damping: 40,\n      },\n    },\n    open: {\n      opacity: 1,\n      x: 0,\n      transition: {\n        type: 'spring',\n        stiffness: 400,\n        damping: 40,\n      },\n    },\n  }\n\n  const itemVariants = {\n    closed: { opacity: 0, x: -20 },\n    open: { opacity: 1, x: 0 },\n  }\n\n  return (\n    <>\n      {/* Trigger */}\n      <button onClick={() => setIsOpen(!isOpen)}>{trigger}</button>\n\n      {/* Overlay */}\n      <AnimatePresence>\n        {isOpen && (\n          <motion.div\n            initial={{ opacity: 0 }}\n            animate={{ opacity: 1 }}\n            exit={{ opacity: 0 }}\n            className=\"fixed inset-0 bg-black bg-opacity-50 z-40\"\n            onClick={() => setIsOpen(false)}\n          />\n        )}\n      </AnimatePresence>\n\n      {/* Menu */}\n      <motion.nav\n        initial=\"closed\"\n        animate={isOpen ? 'open' : 'closed'}\n        variants={menuVariants}\n        className=\"fixed top-0 left-0 h-full w-64 bg-white shadow-lg z-50\"\n      >\n        <div className=\"p-4\">\n          <motion.div\n            initial=\"closed\"\n            animate={isOpen ? 'open' : 'closed'}\n            transition={{ staggerChildren: 0.1, delayChildren: 0.2 }}\n            className=\"space-y-2\"\n          >\n            {items.map((item) => (\n              <motion.div key={item.to} variants={itemVariants}>\n                <Link\n                  to={item.to}\n                  className=\"flex items-center space-x-3 p-3 rounded-lg hover:bg-gray-100 transition-colors\"\n                  onClick={() => setIsOpen(false)}\n                >\n                  {item.icon}\n                  <span className=\"text-gray-700\">{item.label}</span>\n                </Link>\n              </motion.div>\n            ))}\n          </motion.div>\n        </div>\n      </motion.nav>\n    </>\n  )\n}\n```\n\n### Step 3: Create Floating Action Button with Animations\n\n```tsx\n// src/components/navigation/animated-fab.tsx\nimport { Link } from '@tanstack/react-router'\nimport { motion } from 'framer-motion'\nimport { Plus } from 'lucide-react'\n\ninterface AnimatedFabProps {\n  to: string\n  label?: string\n  icon?: React.ReactNode\n  className?: string\n}\n\nexport function AnimatedFab({\n  to,\n  label = 'Add',\n  icon = <Plus className=\"w-6 h-6\" />,\n  className = '',\n}: AnimatedFabProps) {\n  return (\n    <motion.div\n      whileHover={{ scale: 1.1 }}\n      whileTap={{ scale: 0.95 }}\n      className={`fixed bottom-6 right-6 ${className}`}\n    >\n      <Link\n        to={to}\n        className=\"flex items-center space-x-2 bg-blue-600 text-white px-6 py-3 rounded-full shadow-lg hover:bg-blue-700 transition-colors\"\n      >\n        <motion.div\n          initial={{ rotate: 0 }}\n          whileHover={{ rotate: 90 }}\n          transition={{ type: 'spring', stiffness: 300 }}\n        >\n          {icon}\n        </motion.div>\n        <span className=\"font-medium\">{label}</span>\n      </Link>\n    </motion.div>\n  )\n}\n```\n\n---\n\n## Advanced Animation Patterns\n\n### Step 1: Shared Element Transitions\n\n```tsx\n// src/components/animations/shared-element.tsx\nimport { motion } from 'framer-motion'\nimport { ReactNode } from 'react'\n\ninterface SharedElementProps {\n  layoutId: string\n  children: ReactNode\n  className?: string\n}\n\nexport function SharedElement({\n  layoutId,\n  children,\n  className,\n}: SharedElementProps) {\n  return (\n    <motion.div\n      layoutId={layoutId}\n      className={className}\n      transition={{\n        type: 'spring',\n        stiffness: 300,\n        damping: 30,\n      }}\n    >\n      {children}\n    </motion.div>\n  )\n}\n\n// Usage in post list\nfunction PostCard({ post }: { post: Post }) {\n  return (\n    <Link to=\"/posts/$postId\" params={{ postId: post.id }}>\n      <SharedElement layoutId={`post-${post.id}`}>\n        <div className=\"border rounded-lg p-4\">\n          <h2 className=\"text-xl font-semibold\">{post.title}</h2>\n          <p className=\"text-gray-600\">{post.excerpt}</p>\n        </div>\n      </SharedElement>\n    </Link>\n  )\n}\n\n// Usage in post detail\nfunction PostDetail({ post }: { post: Post }) {\n  return (\n    <SharedElement layoutId={`post-${post.id}`}>\n      <div className=\"border rounded-lg p-6\">\n        <h1 className=\"text-3xl font-bold\">{post.title}</h1>\n        <div className=\"prose mt-4\">{post.content}</div>\n      </div>\n    </SharedElement>\n  )\n}\n```\n\n### Step 2: Route-Based Animation Variants\n\n```tsx\n// src/components/animations/route-variants.tsx\nimport { motion } from 'framer-motion'\nimport { useRouter } from '@tanstack/react-router'\nimport { ReactNode } from 'react'\n\ninterface RouteVariantsProps {\n  children: ReactNode\n}\n\nexport function RouteVariants({ children }: RouteVariantsProps) {\n  const router = useRouter()\n  const currentPath = router.state.location.pathname\n\n  // Different animations based on route depth\n  const getVariants = (path: string) => {\n    const depth = path.split('/').length - 1\n\n    if (depth === 1) {\n      // Top-level routes slide from right\n      return {\n        initial: { opacity: 0, x: 100 },\n        in: { opacity: 1, x: 0 },\n        out: { opacity: 0, x: -100 },\n      }\n    } else if (depth === 2) {\n      // Sub-routes slide up\n      return {\n        initial: { opacity: 0, y: 50 },\n        in: { opacity: 1, y: 0 },\n        out: { opacity: 0, y: -50 },\n      }\n    } else {\n      // Deep routes fade\n      return {\n        initial: { opacity: 0 },\n        in: { opacity: 1 },\n        out: { opacity: 0 },\n      }\n    }\n  }\n\n  return (\n    <motion.div\n      key={currentPath}\n      initial=\"initial\"\n      animate=\"in\"\n      exit=\"out\"\n      variants={getVariants(currentPath)}\n      transition={{\n        type: 'spring',\n        stiffness: 300,\n        damping: 30,\n      }}\n    >\n      {children}\n    </motion.div>\n  )\n}\n```\n\n### Step 3: Loading Animations\n\n```tsx\n// src/components/animations/loading-animation.tsx\nimport { motion } from 'framer-motion'\n\nexport function LoadingAnimation() {\n  return (\n    <div className=\"flex items-center justify-center min-h-screen\">\n      <motion.div\n        className=\"flex space-x-2\"\n        initial={{ opacity: 0 }}\n        animate={{ opacity: 1 }}\n        exit={{ opacity: 0 }}\n      >\n        {[0, 1, 2].map((index) => (\n          <motion.div\n            key={index}\n            className=\"w-3 h-3 bg-blue-600 rounded-full\"\n            animate={{\n              scale: [1, 1.2, 1],\n              opacity: [1, 0.8, 1],\n            }}\n            transition={{\n              duration: 1,\n              repeat: Infinity,\n              delay: index * 0.2,\n            }}\n          />\n        ))}\n      </motion.div>\n    </div>\n  )\n}\n\n// Usage in routes with loading states\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostPage,\n  pendingComponent: LoadingAnimation,\n})\n```\n\n---\n\n## Complete Example\n\n### App with Full Animation Integration\n\n```tsx\n// src/routes/posts/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { motion } from 'framer-motion'\nimport { AnimatedRoute } from '@/components/animated-route'\nimport { AnimatedTabs } from '@/components/navigation/animated-tabs'\nimport { AnimatedFab } from '@/components/navigation/animated-fab'\nimport { SharedElement } from '@/components/animations/shared-element'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsPage,\n})\n\nconst tabItems = [\n  { to: '/posts', label: 'All Posts', exact: true },\n  { to: '/posts/published', label: 'Published' },\n  { to: '/posts/drafts', label: 'Drafts' },\n]\n\nfunction PostsPage() {\n  const posts = [\n    { id: '1', title: 'First Post', excerpt: 'This is the first post' },\n    { id: '2', title: 'Second Post', excerpt: 'This is the second post' },\n  ]\n\n  return (\n    <AnimatedRoute variant=\"slide\">\n      <div className=\"container mx-auto p-4\">\n        {/* Animated header */}\n        <motion.div\n          initial={{ opacity: 0, y: -20 }}\n          animate={{ opacity: 1, y: 0 }}\n          transition={{ delay: 0.1 }}\n          className=\"mb-6\"\n        >\n          <h1 className=\"text-3xl font-bold mb-4\">Posts</h1>\n          <AnimatedTabs items={tabItems} />\n        </motion.div>\n\n        {/* Animated post grid */}\n        <motion.div\n          initial={{ opacity: 0 }}\n          animate={{ opacity: 1 }}\n          transition={{ delay: 0.2 }}\n          className=\"grid gap-4\"\n        >\n          {posts.map((post, index) => (\n            <motion.div\n              key={post.id}\n              initial={{ opacity: 0, y: 20 }}\n              animate={{ opacity: 1, y: 0 }}\n              transition={{ delay: 0.3 + index * 0.1 }}\n              whileHover={{ y: -2 }}\n              className=\"cursor-pointer\"\n            >\n              <SharedElement layoutId={`post-${post.id}`}>\n                <div className=\"border rounded-lg p-4 hover:shadow-lg transition-shadow\">\n                  <h2 className=\"text-xl font-semibold\">{post.title}</h2>\n                  <p className=\"text-gray-600\">{post.excerpt}</p>\n                </div>\n              </SharedElement>\n            </motion.div>\n          ))}\n        </motion.div>\n\n        {/* Floating action button */}\n        <AnimatedFab to=\"/posts/new\" label=\"New Post\" />\n      </div>\n    </AnimatedRoute>\n  )\n}\n```\n\n---\n\n## Common Problems\n\n### Animations Not Triggering\n\n**Problem:** Route animations don't work or appear choppy.\n\n**Solutions:**\n\n1. **Ensure proper key for AnimatePresence:**\n\n   ```tsx\n   <AnimatePresence mode=\"wait\">\n     <motion.div key={router.state.location.pathname}>\n       <Outlet />\n     </motion.div>\n   </AnimatePresence>\n   ```\n\n2. **Use layout animations correctly:**\n\n   ```tsx\n   // ❌ This might cause layout shifts\n   <motion.div animate={{ x: 100 }}>\n\n   // ✅ Use layout for changing layouts\n   <motion.div layout>\n   ```\n\n### Performance Issues\n\n**Problem:** Animations cause performance problems or jank.\n\n**Solutions:**\n\n1. **Prefer transform and opacity animations:**\n\n   ```tsx\n   // ✅ GPU-accelerated properties\n   const variants = {\n     initial: { opacity: 0, scale: 0.95 },\n     in: { opacity: 1, scale: 1 },\n   }\n\n   // ❌ Avoid animating layout properties\n   const badVariants = {\n     initial: { width: 0, height: 0 },\n     in: { width: 'auto', height: 'auto' },\n   }\n   ```\n\n2. **Use will-change CSS property sparingly:**\n   ```tsx\n   <motion.div style={{ willChange: 'transform' }} animate={{ x: 100 }} />\n   ```\n\n### Layout Shift Issues\n\n**Problem:** Shared element transitions cause layout shifts.\n\n**Solution:** Use layout animations and proper positioning:\n\n```tsx\n<motion.div\n  layout\n  layoutId=\"shared-element\"\n  style={{ position: 'relative' }}\n  transition={{\n    layout: { duration: 0.3 },\n  }}\n>\n  {children}\n</motion.div>\n```\n\n---\n\n## Production Checklist\n\nBefore deploying your animated TanStack Router app:\n\n### Performance\n\n- [ ] Animations use GPU-accelerated properties (transform, opacity)\n- [ ] No unnecessary will-change CSS properties\n- [ ] Complex animations are conditional on user preferences\n- [ ] Frame rate stays above 60fps on target devices\n\n### User Experience\n\n- [ ] Animations respect user's motion preferences\n- [ ] Loading states have appropriate animations\n- [ ] Navigation feels responsive and smooth\n- [ ] Animations enhance rather than distract from content\n\n### Accessibility\n\n- [ ] Respect prefers-reduced-motion media query\n- [ ] Animations don't interfere with screen readers\n- [ ] Focus management works during transitions\n- [ ] Essential content isn't hidden behind animations\n\n### Technical\n\n- [ ] Bundle size impact acceptable\n- [ ] No animation-related console errors\n- [ ] Smooth transitions on slower devices\n- [ ] Proper cleanup of animation effects\n\n---\n\n## Related Resources\n\n- [Framer Motion Documentation](https://www.framer.com/motion/) - Complete animation library guide\n- [React Transition Group Migration](https://www.framer.com/motion/migrate-from-react-transition-group/) - Migration guide from other animation libraries\n- [Animation Performance](https://web.dev/animations-guide/) - Web performance guide for animations\n"
  },
  {
    "path": "docs/router/how-to/integrate-material-ui.md",
    "content": "---\ntitle: How to Integrate TanStack Router with Material-UI (MUI)\n---\n\nThis guide covers setting up Material-UI with TanStack Router, including proper TypeScript integration and component composition patterns.\n\n## Quick Start\n\n**Time Required:** 45-60 minutes  \n**Difficulty:** Intermediate  \n**Prerequisites:** Existing TanStack Router project\n\n### What You'll Accomplish\n\n- Install and configure Material-UI with TanStack Router\n- Set up proper theme provider integration\n- Create type-safe router-compatible MUI components\n- Implement navigation with active state indicators\n- Resolve common TypeScript and styling issues\n\n---\n\n## Installation and Setup\n\n### Step 1: Install Material-UI Dependencies\n\n```bash\nnpm install @mui/material @emotion/react @emotion/styled @mui/icons-material\n```\n\n**Optional: Add date picker support**\n\n```bash\nnpm install @mui/x-date-pickers dayjs\n```\n\n### Step 2: Set Up Theme Provider\n\nCreate a theme provider that works with TanStack Router:\n\n```tsx\n// src/components/theme-provider.tsx\nimport { ThemeProvider, createTheme } from '@mui/material/styles'\nimport CssBaseline from '@mui/material/CssBaseline'\nimport { ReactNode } from 'react'\n\nconst theme = createTheme({\n  palette: {\n    mode: 'light',\n    primary: {\n      main: '#1976d2',\n    },\n    secondary: {\n      main: '#dc004e',\n    },\n  },\n  typography: {\n    fontFamily: '\"Roboto\", \"Helvetica\", \"Arial\", sans-serif',\n  },\n  components: {\n    // Customize components for router integration\n    MuiButton: {\n      styleOverrides: {\n        root: {\n          textTransform: 'none', // More modern button styling\n        },\n      },\n    },\n    MuiLink: {\n      styleOverrides: {\n        root: {\n          textDecoration: 'none',\n          '&:hover': {\n            textDecoration: 'underline',\n          },\n        },\n      },\n    },\n  },\n})\n\ninterface MuiThemeProviderProps {\n  children: ReactNode\n}\n\nexport function MuiThemeProvider({ children }: MuiThemeProviderProps) {\n  return (\n    <ThemeProvider theme={theme}>\n      <CssBaseline />\n      {children}\n    </ThemeProvider>\n  )\n}\n```\n\n### Step 3: Update Root Route\n\nWrap your application with the MUI theme provider:\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/router-devtools'\nimport { MuiThemeProvider } from '@/components/theme-provider'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <MuiThemeProvider>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </MuiThemeProvider>\n  ),\n})\n```\n\n---\n\n## Creating Router-Compatible MUI Components\n\n### Step 1: Create Typed MUI Link Component\n\nMUI Link components require special handling for TanStack Router's type system:\n\n```tsx\n// src/components/ui/mui-router-link.tsx\nimport { createLink } from '@tanstack/react-router'\nimport { Link as MuiLink, type LinkProps } from '@mui/material/Link'\nimport { forwardRef } from 'react'\n\n// Create a router-compatible MUI Link with full type safety\nexport const RouterLink = createLink(\n  forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {\n    return <MuiLink ref={ref} {...props} />\n  }),\n)\n```\n\n### Step 2: Create Typed MUI Button Component\n\n```tsx\n// src/components/ui/mui-router-button.tsx\nimport { createLink } from '@tanstack/react-router'\nimport { Button, type ButtonProps } from '@mui/material/Button'\nimport { forwardRef } from 'react'\n\n// Create a router-compatible MUI Button\nexport const RouterButton = createLink(\n  forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n    return <Button ref={ref} component=\"button\" {...props} />\n  }),\n)\n```\n\n### Step 3: Create Advanced Navigation Components\n\n```tsx\n// src/components/ui/mui-router-fab.tsx\nimport { createLink } from '@tanstack/react-router'\nimport { Fab, type FabProps } from '@mui/material/Fab'\nimport { forwardRef } from 'react'\n\n// Router-compatible Floating Action Button\nexport const RouterFab = createLink(\n  forwardRef<HTMLButtonElement, FabProps>((props, ref) => {\n    return <Fab ref={ref} {...props} />\n  }),\n)\n```\n\n---\n\n## Implementing Navigation with Active States\n\n### Step 1: Create Navigation Tabs with Active States\n\n```tsx\n// src/components/navigation/mui-nav-tabs.tsx\nimport { useMatchRoute } from '@tanstack/react-router'\nimport { Tabs, Tab, type TabsProps } from '@mui/material'\nimport { RouterLink } from '@/components/ui/mui-router-link'\n\ninterface NavTab {\n  label: string\n  to: string\n  value: string\n  icon?: React.ReactNode\n}\n\ninterface MuiNavTabsProps extends Omit<TabsProps, 'value' | 'onChange'> {\n  tabs: NavTab[]\n}\n\nexport function MuiNavTabs({ tabs, ...tabsProps }: MuiNavTabsProps) {\n  const matchRoute = useMatchRoute()\n\n  // Find active tab based on current route\n  const activeTab =\n    tabs.find((tab) => matchRoute({ to: tab.to, fuzzy: true }))?.value || false\n\n  return (\n    <Tabs value={activeTab} {...tabsProps}>\n      {tabs.map((tab) => (\n        <Tab\n          key={tab.value}\n          label={tab.label}\n          value={tab.value}\n          icon={tab.icon}\n          component={RouterLink}\n          to={tab.to}\n          sx={{\n            '&.Mui-selected': {\n              fontWeight: 'bold',\n            },\n          }}\n        />\n      ))}\n    </Tabs>\n  )\n}\n```\n\n### Step 2: Create Navigation Drawer\n\n```tsx\n// src/components/navigation/mui-nav-drawer.tsx\nimport { useMatchRoute } from '@tanstack/react-router'\nimport {\n  Drawer,\n  List,\n  ListItem,\n  ListItemButton,\n  ListItemIcon,\n  ListItemText,\n  Typography,\n  Box,\n  type DrawerProps,\n} from '@mui/material'\nimport { RouterLink } from '@/components/ui/mui-router-link'\n\ninterface DrawerItem {\n  label: string\n  to: string\n  icon?: React.ReactNode\n}\n\ninterface MuiNavDrawerProps extends Omit<DrawerProps, 'children'> {\n  items: DrawerItem[]\n  title?: string\n}\n\nexport function MuiNavDrawer({\n  items,\n  title,\n  ...drawerProps\n}: MuiNavDrawerProps) {\n  const matchRoute = useMatchRoute()\n\n  return (\n    <Drawer {...drawerProps}>\n      <Box sx={{ width: 250 }} role=\"presentation\">\n        {title && (\n          <Typography\n            variant=\"h6\"\n            sx={{ p: 2, borderBottom: 1, borderColor: 'divider' }}\n          >\n            {title}\n          </Typography>\n        )}\n\n        <List>\n          {items.map((item) => {\n            const isActive = matchRoute({ to: item.to, fuzzy: true })\n\n            return (\n              <ListItem key={item.to} disablePadding>\n                <ListItemButton\n                  component={RouterLink}\n                  to={item.to}\n                  selected={isActive}\n                  sx={{\n                    '&.Mui-selected': {\n                      backgroundColor: 'primary.main',\n                      color: 'primary.contrastText',\n                      '&:hover': {\n                        backgroundColor: 'primary.dark',\n                      },\n                    },\n                  }}\n                >\n                  {item.icon && <ListItemIcon>{item.icon}</ListItemIcon>}\n                  <ListItemText primary={item.label} />\n                </ListItemButton>\n              </ListItem>\n            )\n          })}\n        </List>\n      </Box>\n    </Drawer>\n  )\n}\n```\n\n### Step 3: Create App Bar with Navigation\n\n```tsx\n// src/components/navigation/mui-app-bar.tsx\nimport { useState } from 'react'\nimport {\n  AppBar,\n  Toolbar,\n  Typography,\n  IconButton,\n  Menu,\n  MenuItem,\n  Box,\n} from '@mui/material'\nimport { Menu as MenuIcon, AccountCircle } from '@mui/icons-material'\nimport { RouterButton, RouterLink } from '@/components/ui/mui-router-link'\nimport { MuiNavDrawer } from './mui-nav-drawer'\n\ninterface AppBarItem {\n  label: string\n  to: string\n  icon?: React.ReactNode\n}\n\ninterface MuiAppBarProps {\n  title: string\n  navigationItems: AppBarItem[]\n  userMenuItems?: AppBarItem[]\n}\n\nexport function MuiAppBar({\n  title,\n  navigationItems,\n  userMenuItems,\n}: MuiAppBarProps) {\n  const [drawerOpen, setDrawerOpen] = useState(false)\n  const [userMenuAnchor, setUserMenuAnchor] = useState<null | HTMLElement>(null)\n\n  const handleUserMenuClick = (event: React.MouseEvent<HTMLElement>) => {\n    setUserMenuAnchor(event.currentTarget)\n  }\n\n  const handleUserMenuClose = () => {\n    setUserMenuAnchor(null)\n  }\n\n  return (\n    <>\n      <AppBar position=\"static\">\n        <Toolbar>\n          <IconButton\n            edge=\"start\"\n            color=\"inherit\"\n            onClick={() => setDrawerOpen(true)}\n            sx={{ mr: 2 }}\n          >\n            <MenuIcon />\n          </IconButton>\n\n          <Typography variant=\"h6\" component=\"div\" sx={{ flexGrow: 1 }}>\n            <RouterLink to=\"/\" color=\"inherit\" underline=\"none\">\n              {title}\n            </RouterLink>\n          </Typography>\n\n          {/* Desktop Navigation */}\n          <Box sx={{ display: { xs: 'none', md: 'flex' }, mr: 2 }}>\n            {navigationItems.map((item) => (\n              <RouterButton\n                key={item.to}\n                to={item.to}\n                color=\"inherit\"\n                startIcon={item.icon}\n                sx={{ ml: 1 }}\n              >\n                {item.label}\n              </RouterButton>\n            ))}\n          </Box>\n\n          {/* User Menu */}\n          {userMenuItems && (\n            <>\n              <IconButton color=\"inherit\" onClick={handleUserMenuClick}>\n                <AccountCircle />\n              </IconButton>\n              <Menu\n                anchorEl={userMenuAnchor}\n                open={Boolean(userMenuAnchor)}\n                onClose={handleUserMenuClose}\n              >\n                {userMenuItems.map((item) => (\n                  <MenuItem\n                    key={item.to}\n                    component={RouterLink}\n                    to={item.to}\n                    onClick={handleUserMenuClose}\n                  >\n                    {item.label}\n                  </MenuItem>\n                ))}\n              </Menu>\n            </>\n          )}\n        </Toolbar>\n      </AppBar>\n\n      {/* Mobile Navigation Drawer */}\n      <MuiNavDrawer\n        items={navigationItems}\n        title=\"Navigation\"\n        open={drawerOpen}\n        onClose={() => setDrawerOpen(false)}\n      />\n    </>\n  )\n}\n```\n\n---\n\n## Usage Examples\n\n### Complete Page Example\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport {\n  Container,\n  Typography,\n  Box,\n  Card,\n  CardContent,\n  CardActions,\n  Chip,\n  Stack,\n} from '@mui/material'\nimport { Edit, Delete, ArrowBack } from '@mui/icons-material'\nimport { RouterButton, RouterLink } from '@/components/ui/mui-router-link'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostPage,\n})\n\nfunction PostPage() {\n  const { postId } = Route.useParams()\n\n  return (\n    <Container maxWidth=\"md\" sx={{ py: 4 }}>\n      {/* Breadcrumb Navigation */}\n      <Box sx={{ mb: 3 }}>\n        <RouterLink\n          to=\"/posts\"\n          color=\"primary\"\n          sx={{ display: 'flex', alignItems: 'center', mb: 2 }}\n        >\n          <ArrowBack sx={{ mr: 1 }} />\n          Back to Posts\n        </RouterLink>\n      </Box>\n\n      {/* Post Content */}\n      <Card>\n        <CardContent>\n          <Typography variant=\"h4\" component=\"h1\" gutterBottom>\n            Post {postId}\n          </Typography>\n\n          <Stack direction=\"row\" spacing={1} sx={{ mb: 2 }}>\n            <Chip label=\"React\" color=\"primary\" size=\"small\" />\n            <Chip label=\"TypeScript\" color=\"secondary\" size=\"small\" />\n          </Stack>\n\n          <Typography variant=\"body1\" paragraph>\n            This is the content of post {postId}. It demonstrates how\n            Material-UI components work seamlessly with TanStack Router.\n          </Typography>\n        </CardContent>\n\n        <CardActions>\n          <RouterButton\n            to=\"/posts/$postId/edit\"\n            params={{ postId }}\n            variant=\"contained\"\n            startIcon={<Edit />}\n            size=\"small\"\n          >\n            Edit Post\n          </RouterButton>\n\n          <RouterButton\n            to=\"/posts/$postId/delete\"\n            params={{ postId }}\n            variant=\"outlined\"\n            color=\"error\"\n            startIcon={<Delete />}\n            size=\"small\"\n          >\n            Delete Post\n          </RouterButton>\n        </CardActions>\n      </Card>\n    </Container>\n  )\n}\n```\n\n### Layout with Navigation\n\n```tsx\n// src/routes/_layout.tsx\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport { Box } from '@mui/material'\nimport { Home, Article, Info, Contact } from '@mui/icons-material'\nimport { MuiAppBar } from '@/components/navigation/mui-app-bar'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nconst navigationItems = [\n  { label: 'Home', to: '/', icon: <Home /> },\n  { label: 'Posts', to: '/posts', icon: <Article /> },\n  { label: 'About', to: '/about', icon: <Info /> },\n  { label: 'Contact', to: '/contact', icon: <Contact /> },\n]\n\nconst userMenuItems = [\n  { label: 'Profile', to: '/profile' },\n  { label: 'Settings', to: '/settings' },\n  { label: 'Logout', to: '/logout' },\n]\n\nfunction LayoutComponent() {\n  return (\n    <Box sx={{ flexGrow: 1 }}>\n      <MuiAppBar\n        title=\"My App\"\n        navigationItems={navigationItems}\n        userMenuItems={userMenuItems}\n      />\n\n      <Box component=\"main\" sx={{ mt: 2 }}>\n        <Outlet />\n      </Box>\n    </Box>\n  )\n}\n```\n\n---\n\n## Common Problems\n\n### TypeScript Errors with Component Props\n\n**Problem:** TypeScript errors when using MUI components with TanStack Router props.\n\n**Solution:** Always use `createLink` for proper typing:\n\n```tsx\n// ❌ This will cause TypeScript errors\nconst BadButton = (props: any) => <Button {...props} />\n\n// ✅ This provides full type safety\nexport const RouterButton = createLink(\n  forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n    return <Button ref={ref} component=\"button\" {...props} />\n  }),\n)\n```\n\n### Styling Conflicts\n\n**Problem:** MUI styles conflict with other libraries or custom styles.\n\n**Solutions:**\n\n1. **Use MUI's emotion cache:**\n\n   ```tsx\n   import { CacheProvider } from '@emotion/react'\n   import createCache from '@emotion/cache'\n\n   const cache = createCache({\n     key: 'mui',\n     prepend: true,\n   })\n\n   export function App() {\n     return (\n       <CacheProvider value={cache}>\n         <MuiThemeProvider>{/* Your app */}</MuiThemeProvider>\n       </CacheProvider>\n     )\n   }\n   ```\n\n2. **Increase CSS specificity:**\n   ```tsx\n   const StyledButton = styled(Button)(({ theme }) => ({\n     '&.router-active': {\n       backgroundColor: theme.palette.primary.main,\n       color: theme.palette.primary.contrastText,\n     },\n   }))\n   ```\n\n### Theme Not Applied Correctly\n\n**Problem:** MUI theme changes don't apply to router-created components.\n\n**Solution:** Ensure theme provider wraps the entire app:\n\n```tsx\n// ❌ Theme provider inside routes won't work for navigation\nexport const Route = createFileRoute('/some-route')({\n  component: () => (\n    <ThemeProvider theme={theme}>\n      <SomeComponent />\n    </ThemeProvider>\n  ),\n})\n\n// ✅ Theme provider at root level\nexport const Route = createRootRoute({\n  component: () => (\n    <ThemeProvider theme={theme}>\n      <Outlet />\n    </ThemeProvider>\n  ),\n})\n```\n\n### Performance Issues with Large Apps\n\n**Problem:** Bundle size or runtime performance issues.\n\n**Solutions:**\n\n1. **Use tree shaking:**\n\n   ```tsx\n   // ✅ Import only what you need\n   import Button from '@mui/material/Button'\n   import TextField from '@mui/material/TextField'\n\n   // ❌ Avoid importing everything\n   import { Button, TextField } from '@mui/material'\n   ```\n\n2. **Use dynamic imports for heavy components:**\n\n   ```tsx\n   import { lazy, Suspense } from 'react'\n   import { CircularProgress } from '@mui/material'\n\n   const DataGrid = lazy(() =>\n     import('@mui/x-data-grid').then((module) => ({\n       default: module.DataGrid,\n     })),\n   )\n\n   function MyComponent() {\n     return (\n       <Suspense fallback={<CircularProgress />}>\n         <DataGrid {...props} />\n       </Suspense>\n     )\n   }\n   ```\n\n---\n\n## Production Checklist\n\nBefore deploying your MUI + TanStack Router app:\n\n### Functionality\n\n- [ ] All navigation components work with router state\n- [ ] Active states properly reflected in tabs and navigation\n- [ ] TypeScript compilation successful\n- [ ] All MUI components render correctly\n\n### Performance\n\n- [ ] Bundle size optimized with tree shaking\n- [ ] Emotion CSS-in-JS performance acceptable\n- [ ] No unnecessary re-renders on route changes\n- [ ] Large components code-split appropriately\n\n### Styling\n\n- [ ] Theme consistency across all routes\n- [ ] CSS conflicts resolved\n- [ ] Responsive design working properly\n- [ ] Dark mode integration (if applicable)\n\n### Accessibility\n\n- [ ] Keyboard navigation working\n- [ ] Screen reader compatibility maintained\n- [ ] Focus management across route transitions\n- [ ] ARIA labels and roles properly set\n\n---\n\n## Related Resources\n\n- [Material-UI with TypeScript](https://mui.com/material-ui/guides/typescript/) - Official MUI TypeScript guide\n- [MUI Theming](https://mui.com/material-ui/customization/theming/) - Complete theming documentation\n- [TanStack Router createLink API](../api/router#createlink) - API documentation for component integration\n- [Emotion CSS-in-JS](https://emotion.sh/docs/introduction) - Styling library used by MUI\n"
  },
  {
    "path": "docs/router/how-to/integrate-shadcn-ui.md",
    "content": "---\ntitle: How to Integrate TanStack Router with Shadcn/ui\n---\n\nThis guide covers setting up Shadcn/ui with TanStack Router, including solutions for common animation and compatibility issues.\n\n## Quick Start\n\n**Time Required:** 30-45 minutes  \n**Difficulty:** Intermediate  \n**Prerequisites:** Existing TanStack Router project\n\n### What You'll Accomplish\n\n- Install and configure Shadcn/ui with TanStack Router\n- Fix animation issues with modals, sheets, and dialogs\n- Create type-safe navigation components\n- Set up proper styling integration\n- Resolve common compatibility problems\n\n---\n\n## Installation and Setup\n\n### Step 1: Install Shadcn/ui\n\n**Option 1: New project with TanStack Router template**\n\n```bash\nnpx create-tsrouter-app@latest my-app --template file-router --tailwind --add-ons shadcn\n```\n\n**Option 2: Add to existing TanStack Router project**\n\n```bash\nnpx shadcn@latest init\n```\n\n### Step 2: Configure components.json\n\nCreate or update your `components.json` for TanStack Router compatibility:\n\n```json\n{\n  \"$schema\": \"https://ui.shadcn.com/schema.json\",\n  \"style\": \"default\",\n  \"rsc\": false,\n  \"tsx\": true,\n  \"tailwind\": {\n    \"config\": \"tailwind.config.js\",\n    \"css\": \"src/app/globals.css\",\n    \"baseColor\": \"slate\",\n    \"cssVariables\": true\n  },\n  \"aliases\": {\n    \"components\": \"@/components\",\n    \"utils\": \"@/lib/utils\"\n  }\n}\n```\n\n### Step 3: Add Essential Components\n\nInstall the most commonly used components:\n\n```bash\nnpx shadcn@latest add button\nnpx shadcn@latest add navigation-menu\nnpx shadcn@latest add sheet\nnpx shadcn@latest add dialog\n```\n\n---\n\n## Fixing Animation Issues\n\n### Step 1: Set Up Proper DOM Structure\n\nUpdate your root route to support portals and animations:\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <>\n      {/* Main content wrapper */}\n      <div id=\"root-content\">\n        <Outlet />\n      </div>\n\n      {/* Portal root for overlays */}\n      <div id=\"portal-root\"></div>\n\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n```\n\n### Step 2: Create Router-Compatible Sheet Component\n\nShadcn/ui Sheet components can have animation issues. Create a wrapper:\n\n```tsx\n// src/components/ui/router-sheet.tsx\nimport * as React from 'react'\nimport {\n  Sheet,\n  SheetContent,\n  SheetDescription,\n  SheetHeader,\n  SheetTitle,\n  SheetTrigger,\n} from '@/components/ui/sheet'\n\ninterface RouterSheetProps {\n  children: React.ReactNode\n  trigger: React.ReactNode\n  title: string\n  description?: string\n  onOpenChange?: (open: boolean) => void\n}\n\nexport function RouterSheet({\n  children,\n  trigger,\n  title,\n  description,\n  onOpenChange,\n}: RouterSheetProps) {\n  const [open, setOpen] = React.useState(false)\n\n  const handleOpenChange = (newOpen: boolean) => {\n    setOpen(newOpen)\n    onOpenChange?.(newOpen)\n  }\n\n  return (\n    <Sheet open={open} onOpenChange={handleOpenChange}>\n      <SheetTrigger asChild>{trigger}</SheetTrigger>\n      <SheetContent>\n        <SheetHeader>\n          <SheetTitle>{title}</SheetTitle>\n          {description && <SheetDescription>{description}</SheetDescription>}\n        </SheetHeader>\n        <div className=\"mt-4\">{children}</div>\n      </SheetContent>\n    </Sheet>\n  )\n}\n```\n\n### Step 3: Create Router-Compatible Dialog Component\n\n```tsx\n// src/components/ui/router-dialog.tsx\nimport * as React from 'react'\nimport {\n  Dialog,\n  DialogContent,\n  DialogDescription,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n} from '@/components/ui/dialog'\n\ninterface RouterDialogProps {\n  children: React.ReactNode\n  trigger: React.ReactNode\n  title: string\n  description?: string\n  open?: boolean\n  onOpenChange?: (open: boolean) => void\n}\n\nexport function RouterDialog({\n  children,\n  trigger,\n  title,\n  description,\n  open: controlledOpen,\n  onOpenChange,\n}: RouterDialogProps) {\n  const [internalOpen, setInternalOpen] = React.useState(false)\n\n  const open = controlledOpen ?? internalOpen\n  const setOpen = onOpenChange ?? setInternalOpen\n\n  return (\n    <Dialog open={open} onOpenChange={setOpen}>\n      <DialogTrigger asChild>{trigger}</DialogTrigger>\n      <DialogContent>\n        <DialogHeader>\n          <DialogTitle>{title}</DialogTitle>\n          {description && <DialogDescription>{description}</DialogDescription>}\n        </DialogHeader>\n        <div className=\"mt-4\">{children}</div>\n      </DialogContent>\n    </Dialog>\n  )\n}\n```\n\n---\n\n## Creating Navigation Components\n\n### Step 1: Router-Compatible Navigation Menu\n\n```tsx\n// src/components/navigation/main-nav.tsx\nimport { Link, useMatchRoute } from '@tanstack/react-router'\nimport { cn } from '@/lib/utils'\nimport {\n  NavigationMenu,\n  NavigationMenuItem,\n  NavigationMenuLink,\n  NavigationMenuList,\n  navigationMenuTriggerStyle,\n} from '@/components/ui/navigation-menu'\n\ninterface NavItem {\n  to: string\n  label: string\n  exact?: boolean\n}\n\ninterface MainNavProps {\n  items: NavItem[]\n  className?: string\n}\n\nexport function MainNav({ items, className }: MainNavProps) {\n  const matchRoute = useMatchRoute()\n\n  return (\n    <NavigationMenu className={className}>\n      <NavigationMenuList>\n        {items.map((item) => {\n          const isActive = matchRoute({ to: item.to, fuzzy: !item.exact })\n\n          return (\n            <NavigationMenuItem key={item.to}>\n              <Link\n                to={item.to}\n                className={cn(\n                  navigationMenuTriggerStyle(),\n                  isActive && 'bg-accent text-accent-foreground font-medium',\n                )}\n              >\n                {item.label}\n              </Link>\n            </NavigationMenuItem>\n          )\n        })}\n      </NavigationMenuList>\n    </NavigationMenu>\n  )\n}\n```\n\n### Step 2: Create Router-Compatible Button Links\n\n```tsx\n// src/components/ui/router-button.tsx\nimport { createLink } from '@tanstack/react-router'\nimport { Button, type ButtonProps } from '@/components/ui/button'\nimport { forwardRef } from 'react'\n\n// Create a router-compatible Button\nexport const RouterButton = createLink(\n  forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n    return <Button ref={ref} {...props} />\n  }),\n)\n```\n\n### Step 3: Usage Example\n\n```tsx\n// src/routes/posts/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { MainNav } from '@/components/navigation/main-nav'\nimport { RouterButton } from '@/components/ui/router-button'\nimport { RouterSheet } from '@/components/ui/router-sheet'\nimport { Button } from '@/components/ui/button'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsPage,\n})\n\nconst navItems = [\n  { to: '/', label: 'Home' },\n  { to: '/posts', label: 'Posts', exact: true },\n  { to: '/about', label: 'About' },\n]\n\nfunction PostsPage() {\n  return (\n    <div className=\"container mx-auto p-4\">\n      {/* Navigation with active states */}\n      <MainNav items={navItems} className=\"mb-8\" />\n\n      <div className=\"flex items-center justify-between mb-6\">\n        <h1 className=\"text-3xl font-bold\">Posts</h1>\n\n        {/* Router-compatible button */}\n        <RouterButton to=\"/posts/new\" variant=\"default\">\n          Create Post\n        </RouterButton>\n      </div>\n\n      {/* Sheet with proper animations */}\n      <RouterSheet\n        trigger={<Button variant=\"outline\">Open Menu</Button>}\n        title=\"Navigation Menu\"\n        description=\"Navigate through your posts\"\n      >\n        <div className=\"space-y-4\">\n          <p>This sheet animates correctly with TanStack Router!</p>\n          <RouterButton to=\"/posts/new\" variant=\"default\" className=\"w-full\">\n            Create New Post\n          </RouterButton>\n        </div>\n      </RouterSheet>\n    </div>\n  )\n}\n```\n\n---\n\n## Common Problems\n\n### Animation Components Not Working\n\n**Problem:** Sheet, Dialog, or other animated components don't animate properly.\n\n**Solutions:**\n\n1. **Ensure proper portal setup:**\n\n   ```tsx\n   // Add to your index.html or root component\n   <div id=\"portal-root\"></div>\n   ```\n\n2. **Check CSS imports order:**\n\n   ```css\n   /* Make sure this comes before your custom styles */\n   @import 'tailwindcss/base';\n   @import 'tailwindcss/components';\n   @import 'tailwindcss/utilities';\n   ```\n\n3. **Use controlled components for complex animations:**\n\n   ```tsx\n   const [open, setOpen] = useState(false)\n\n   // Controlled instead of uncontrolled\n   <Sheet open={open} onOpenChange={setOpen}>\n   ```\n\n### TypeScript Errors with Router Integration\n\n**Problem:** TypeScript errors when using Shadcn/ui components with TanStack Router.\n\n**Solution:** Use `createLink` for proper typing:\n\n```tsx\nimport { createLink } from '@tanstack/react-router'\nimport { Button } from '@/components/ui/button'\n\n// This provides full type safety\nexport const RouterButton = createLink(Button)\n```\n\n### Styling Conflicts\n\n**Problem:** Shadcn/ui styles conflict with router or custom styles.\n\n**Solutions:**\n\n1. **Use CSS layers:**\n\n   ```css\n   @layer base, components, utilities;\n\n   @layer base {\n     /* Shadcn/ui base styles */\n   }\n\n   @layer components {\n     /* Your component styles */\n   }\n   ```\n\n2. **Increase specificity for router-specific styles:**\n   ```tsx\n   <Button className=\"router-active:bg-primary router-active:text-primary-foreground\">\n     Active Button\n   </Button>\n   ```\n\n### Dark Mode Integration\n\n**Problem:** Dark mode doesn't work properly with route changes.\n\n**Solution:** Set up theme provider correctly:\n\n```tsx\n// src/components/theme-provider.tsx\nimport { createContext, useContext, useEffect, useState } from 'react'\n\ntype Theme = 'dark' | 'light' | 'system'\n\ninterface ThemeProviderProps {\n  children: React.ReactNode\n  defaultTheme?: Theme\n  storageKey?: string\n}\n\nconst ThemeProviderContext = createContext<{\n  theme: Theme\n  setTheme: (theme: Theme) => void\n}>({\n  theme: 'system',\n  setTheme: () => null,\n})\n\nexport function ThemeProvider({\n  children,\n  defaultTheme = 'system',\n  storageKey = 'ui-theme',\n}: ThemeProviderProps) {\n  const [theme, setTheme] = useState<Theme>(\n    () => (localStorage.getItem(storageKey) as Theme) || defaultTheme,\n  )\n\n  useEffect(() => {\n    const root = window.document.documentElement\n    root.classList.remove('light', 'dark')\n\n    if (theme === 'system') {\n      const systemTheme = window.matchMedia('(prefers-color-scheme: dark)')\n        .matches\n        ? 'dark'\n        : 'light'\n      root.classList.add(systemTheme)\n      return\n    }\n\n    root.classList.add(theme)\n  }, [theme])\n\n  const value = {\n    theme,\n    setTheme: (theme: Theme) => {\n      localStorage.setItem(storageKey, theme)\n      setTheme(theme)\n    },\n  }\n\n  return (\n    <ThemeProviderContext.Provider value={value}>\n      {children}\n    </ThemeProviderContext.Provider>\n  )\n}\n\nexport const useTheme = () => {\n  const context = useContext(ThemeProviderContext)\n  if (context === undefined)\n    throw new Error('useTheme must be used within a ThemeProvider')\n  return context\n}\n```\n\n---\n\n## Production Checklist\n\nBefore deploying your Shadcn/ui + TanStack Router app:\n\n### Styling\n\n- [ ] All Shadcn/ui components render correctly\n- [ ] Animations work properly on route changes\n- [ ] Dark mode integration working (if applicable)\n- [ ] CSS conflicts resolved\n- [ ] Responsive design tested\n\n### Functionality\n\n- [ ] Navigation components work with router state\n- [ ] Active states properly reflected\n- [ ] TypeScript compilation successful\n- [ ] All sheets, dialogs, and modals animate correctly\n\n### Performance\n\n- [ ] Bundle size optimized (tree shaking working)\n- [ ] CSS-in-JS not causing performance issues\n- [ ] Animation performance acceptable on slower devices\n\n---\n\n## Related Resources\n\n- [Shadcn/ui TanStack Router Installation](https://ui.shadcn.com/docs/installation/tanstack-router) - Official integration guide\n- [TanStack Router createLink API](../api/router#createlink) - API documentation for component integration\n- [Shadcn/ui Components](https://ui.shadcn.com/docs/components) - Complete component documentation\n"
  },
  {
    "path": "docs/router/how-to/migrate-from-react-router.md",
    "content": "---\ntitle: How to Migrate from React Router v7\n---\n\nThis guide provides a step-by-step process to migrate your application from React Router v7 to TanStack Router. We'll cover the complete migration process from removing React Router dependencies to implementing TanStack Router's type-safe routing patterns.\n\n## Quick Start\n\n**Time Required:** 2-4 hours depending on app complexity  \n**Difficulty:** Intermediate  \n**Prerequisites:** Basic React knowledge, existing React Router v7 app\n\n### What You'll Accomplish\n\n- Remove React Router v7 dependencies and components\n- Install and configure TanStack Router\n- Convert route definitions to file-based routing\n- Update navigation components and hooks\n- Implement type-safe routing patterns\n- Handle search params and dynamic routes\n- Migrate from React Router v7's new features to TanStack Router equivalents\n\n---\n\n## Complete Migration Process\n\n### Step 1: Prepare for Migration\n\nBefore making any changes, prepare your environment and codebase:\n\n**1.1 Create a backup branch**\n\n```bash\ngit checkout -b migrate-to-tanstack-router\ngit push -u origin migrate-to-tanstack-router\n```\n\n**1.2 Install TanStack Router (keep React Router temporarily)**\n\n```bash\n# Install TanStack Router\nnpm install @tanstack/react-router\n\n# Install development dependencies\nnpm install -D @tanstack/router-plugin @tanstack/react-router-devtools\n```\n\n**1.3 Set up the router plugin for your bundler**\n\nFor **Vite** users, update your `vite.config.ts`:\n\n```typescript\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter(), // Add this before react plugin\n    react(),\n  ],\n})\n```\n\nFor **other bundlers**, see our [bundler configuration guides](../routing/routing-concepts.md).\n\n### Step 2: Create TanStack Router Configuration\n\n**2.1 Create router configuration file**\n\nCreate `tsr.config.json` in your project root:\n\n```json\n{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"quoteStyle\": \"single\"\n}\n```\n\n**2.2 Create routes directory**\n\n```bash\nmkdir src/routes\n```\n\n### Step 3: Convert Your React Router v7 Structure\n\n**3.1 Identify your current React Router v7 setup**\n\nReact Router v7 introduced several new patterns. Look for:\n\n- `createBrowserRouter` with new data APIs\n- Framework mode configurations\n- Server-side rendering setup\n- New `loader` and `action` functions\n- `defer` usage (simplified in v7)\n- Type-safe routing features\n\n**3.2 Create root route**\n\nCreate `src/routes/__root.tsx`:\n\n```typescript\nimport { createRootRoute, Link, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <>\n      {/* Your existing layout/navbar content */}\n      <div className=\"p-2 flex gap-2\">\n        <Link to=\"/\" className=\"[&.active]:font-bold\">\n          Home\n        </Link>\n        <Link to=\"/about\" className=\"[&.active]:font-bold\">\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n```\n\n**3.3 Create index route**\n\nCreate `src/routes/index.tsx` for your home page:\n\n```typescript\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Index,\n})\n\nfunction Index() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n```\n\n**3.4 Convert React Router v7 loaders**\n\nReact Router v7 simplified loader patterns. Here's how to migrate them:\n\n**React Router v7:**\n\n```typescript\n// app/routes/posts.tsx\nexport async function loader() {\n  const posts = await fetchPosts()\n  return { posts } // v7 removed need for json() wrapper\n}\n\nexport default function Posts() {\n  const { posts } = useLoaderData()\n  return <div>{/* render posts */}</div>\n}\n```\n\n**TanStack Router equivalent:**\nCreate `src/routes/posts.tsx`:\n\n```typescript\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    const posts = await fetchPosts()\n    return { posts }\n  },\n  component: Posts,\n})\n\nfunction Posts() {\n  const { posts } = Route.useLoaderData()\n  return <div>{/* render posts */}</div>\n}\n```\n\n**3.5 Convert dynamic routes**\n\n**React Router v7:**\n\n```typescript\n// app/routes/posts.$postId.tsx\nexport async function loader({ params }) {\n  const post = await fetchPost(params.postId)\n  return { post }\n}\n\nexport default function Post() {\n  const { post } = useLoaderData()\n  return <div>{post.title}</div>\n}\n```\n\n**TanStack Router equivalent:**\nCreate `src/routes/posts/$postId.tsx`:\n\n```typescript\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  component: Post,\n})\n\nfunction Post() {\n  const { post } = Route.useLoaderData()\n  const { postId } = Route.useParams()\n  return <div>{post.title}</div>\n}\n```\n\n**3.6 Convert React Router v7 actions**\n\n**React Router v7:**\n\n```typescript\nexport async function action({ request, params }) {\n  const formData = await request.formData()\n  const result = await updatePost(params.postId, formData)\n  return { success: true }\n}\n```\n\n**TanStack Router equivalent:**\n\n```typescript\nexport const Route = createFileRoute('/posts/$postId/edit')({\n  component: EditPost,\n  // Actions are typically handled differently in TanStack Router\n  // Use mutations or form libraries like React Hook Form\n})\n\nfunction EditPost() {\n  const navigate = useNavigate()\n\n  const handleSubmit = async (formData) => {\n    const result = await updatePost(params.postId, formData)\n    navigate({ to: '/posts/$postId', params: { postId } })\n  }\n\n  return <form onSubmit={handleSubmit}>{/* form */}</form>\n}\n```\n\n### Step 4: Handle React Router v7 Framework Features\n\n**4.1 Server-Side Rendering Migration**\n\nReact Router v7 introduced framework mode with SSR. If you're using this:\n\n**React Router v7 Framework Mode:**\n\n```typescript\n// react-router.config.ts\nexport default {\n  ssr: true,\n  prerender: ['/'],\n}\n```\n\n**TanStack Router approach:**\n\nTanStack Router has built-in SSR capabilities. Set up your router for SSR:\n\n```typescript\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  context: {\n    // Add any SSR context here\n  },\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport { router }\n```\n\nFor server-side rendering, use TanStack Router's built-in SSR APIs:\n\n```typescript\n// server.tsx\nimport { createMemoryHistory } from '@tanstack/react-router'\nimport { StartServer } from '@tanstack/start/server'\n\nexport async function render(url: string) {\n  const router = createRouter({\n    routeTree,\n    history: createMemoryHistory({ initialEntries: [url] }),\n  })\n\n  await router.load()\n\n  return (\n    <StartServer router={router} />\n  )\n}\n```\n\n**4.2 Code Splitting Migration**\n\nReact Router v7 improved code splitting. TanStack Router handles this via lazy routes:\n\n**React Router v7:**\n\n```typescript\nconst LazyComponent = lazy(() => import('./LazyComponent'))\n```\n\n**TanStack Router:**\n\n```typescript\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/lazy-route')({\n  component: LazyComponent,\n})\n\nfunction LazyComponent() {\n  return <div>Lazy loaded!</div>\n}\n```\n\n### Step 5: Update Navigation Components\n\n**5.1 Update Link components**\n\n**React Router v7:**\n\n```typescript\nimport { Link } from 'react-router'\n\n<Link to=\"/posts/123\">View Post</Link>\n<Link to=\"/posts\" state={{ from: 'home' }}>Posts</Link>\n```\n\n**TanStack Router:**\n\n```typescript\nimport { Link } from '@tanstack/react-router'\n\n<Link to=\"/posts/$postId\" params={{ postId: '123' }}>View Post</Link>\n<Link to=\"/posts\" state={{ from: 'home' }}>Posts</Link>\n```\n\n**5.2 Update navigation hooks**\n\n**React Router v7:**\n\n```typescript\nimport { useNavigate } from 'react-router'\n\nfunction Component() {\n  const navigate = useNavigate()\n\n  const handleClick = () => {\n    navigate('/posts/123')\n  }\n}\n```\n\n**TanStack Router:**\n\n```typescript\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction Component() {\n  const navigate = useNavigate()\n\n  const handleClick = () => {\n    navigate({ to: '/posts/$postId', params: { postId: '123' } })\n  }\n}\n```\n\n### Step 6: Handle React Router v7 Specific Features\n\n**6.1 Migrate simplified `defer` usage**\n\nReact Router v7 simplified defer by removing the wrapper function:\n\n**React Router v7:**\n\n```typescript\nexport async function loader() {\n  return {\n    data: fetchData(), // Promise directly returned\n  }\n}\n```\n\n**TanStack Router:**\n\nTanStack Router uses a different approach for deferred data. Use loading states:\n\n```typescript\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    const data = await fetchData()\n    return { data }\n  },\n  pendingComponent: () => <div>Loading...</div>,\n  component: DeferredComponent,\n})\n```\n\n**6.2 Handle React Router v7's enhanced type safety**\n\nReact Router v7 improved type inference. TanStack Router provides even better type safety:\n\n```typescript\n// TanStack Router automatically infers types\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    // params.postId is automatically typed as string\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  component: Post,\n})\n\nfunction Post() {\n  // post is automatically typed based on loader return\n  const { post } = Route.useLoaderData()\n  // postId is automatically typed as string\n  const { postId } = Route.useParams()\n}\n```\n\n### Step 7: Update Your Main Router Setup\n\n**7.1 Replace React Router v7 router creation**\n\n**Before (React Router v7):**\n\n```typescript\nimport { createBrowserRouter, RouterProvider } from 'react-router'\n\nconst router = createBrowserRouter([\n  // Your route definitions\n])\n\nReactDOM.createRoot(document.getElementById('root')!).render(\n  <React.StrictMode>\n    <RouterProvider router={router} />\n  </React.StrictMode>,\n)\n```\n\n**After (TanStack Router):**\n\n```typescript\nimport { RouterProvider } from '@tanstack/react-router'\nimport { router } from './router'\n\nReactDOM.createRoot(document.getElementById('root')!).render(\n  <React.StrictMode>\n    <RouterProvider router={router} />\n  </React.StrictMode>,\n)\n```\n\n### Step 8: Handle Search Parameters\n\n**8.1 React Router v7 to TanStack Router search params**\n\n**React Router v7:**\n\n```typescript\nimport { useSearchParams } from 'react-router'\n\nfunction Component() {\n  const [searchParams, setSearchParams] = useSearchParams()\n  const page = searchParams.get('page') || '1'\n\n  const updatePage = (newPage) => {\n    setSearchParams({ page: newPage })\n  }\n}\n```\n\n**TanStack Router:**\n\n```typescript\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  page: z.number().catch(1),\n  filter: z.string().optional(),\n})\n\nexport const Route = createFileRoute('/posts')({\n  validateSearch: searchSchema,\n  component: Posts,\n})\n\nfunction Posts() {\n  const navigate = useNavigate({ from: '/posts' })\n  const { page, filter } = Route.useSearch()\n\n  const updatePage = (newPage: number) => {\n    navigate({ search: (prev) => ({ ...prev, page: newPage }) })\n  }\n}\n```\n\n### Step 9: Remove React Router Dependencies\n\nOnly after everything is working with TanStack Router:\n\n**9.1 Remove React Router v7**\n\n```bash\nnpm uninstall react-router\n```\n\n**9.2 Clean up unused imports**\n\nSearch your codebase for any remaining React Router imports:\n\n```bash\n# Find remaining React Router imports\ngrep -r \"react-router\" src/\n```\n\nRemove any remaining imports and replace with TanStack Router equivalents.\n\n### Step 10: Add Advanced Type Safety\n\n**10.1 Configure strict TypeScript**\n\nUpdate your `tsconfig.json`:\n\n```json\n{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"noUncheckedIndexedAccess\": true\n  }\n}\n```\n\n**10.2 Add search parameter validation**\n\nFor routes with search parameters, add validation schemas:\n\n```typescript\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst postsSearchSchema = z.object({\n  page: z.number().min(1).catch(1),\n  search: z.string().optional(),\n  category: z.enum(['tech', 'business', 'lifestyle']).optional(),\n})\n\nexport const Route = createFileRoute('/posts')({\n  validateSearch: postsSearchSchema,\n  component: Posts,\n})\n```\n\n---\n\n## Production Checklist\n\nBefore deploying your migrated application:\n\n### Router Configuration\n\n- [ ] Router instance created and properly exported\n- [ ] Route tree generated successfully\n- [ ] TypeScript declarations registered\n- [ ] All route files follow naming conventions\n\n### Route Migration\n\n- [ ] All React Router v7 routes converted to file-based routing\n- [ ] Dynamic routes updated with proper parameter syntax\n- [ ] Nested routes maintain hierarchy\n- [ ] Index routes created where needed\n- [ ] Layout routes preserve component structure\n\n### Feature Migration\n\n- [ ] All React Router v7 loaders converted\n- [ ] Actions migrated to appropriate patterns\n- [ ] Server-side rendering configured (if applicable)\n- [ ] Code splitting implemented\n- [ ] Type safety enhanced\n\n### Navigation Updates\n\n- [ ] All Link components updated to TanStack Router\n- [ ] useNavigate hooks replaced and tested\n- [ ] Navigation parameters properly typed\n- [ ] Search parameter validation implemented\n\n### Code Cleanup\n\n- [ ] React Router v7 dependencies removed\n- [ ] Unused imports cleaned up\n- [ ] No React Router references remain\n- [ ] TypeScript compilation successful\n- [ ] All tests passing\n\n### Testing\n\n- [ ] All routes accessible and rendering correctly\n- [ ] Navigation between routes working\n- [ ] Back/forward browser buttons functional\n- [ ] Search parameters persisting correctly\n- [ ] Dynamic routes with parameters working\n- [ ] Nested route layouts displaying properly\n- [ ] Framework features (SSR, code splitting) working if applicable\n\n---\n\n## Common Problems\n\n### Error: \"Cannot use useNavigate outside of context\"\n\n**Problem:** You have remaining React Router imports that conflict with TanStack Router.\n\n**Solution:**\n\n1. Search for all React Router imports:\n   ```bash\n   grep -r \"react-router\" src/\n   ```\n2. Replace all imports with TanStack Router equivalents\n3. Ensure React Router is completely uninstalled\n\n### TypeScript Errors: Route Parameters\n\n**Problem:** TypeScript showing errors about route parameters not being typed correctly.\n\n**Solution:**\n\n1. Ensure your router is registered in the TypeScript module declaration:\n   ```typescript\n   declare module '@tanstack/react-router' {\n     interface Register {\n       router: typeof router\n     }\n   }\n   ```\n2. Check that your route files export the Route correctly\n3. Verify parameter names match between route definition and usage\n\n### React Router v7 Framework Features Not Working\n\n**Problem:** Missing SSR or code splitting functionality after migration.\n\n**Solution:**\n\n1. TanStack Router has built-in SSR capabilities - use TanStack Start for full-stack applications\n2. Use TanStack Router's lazy routes for code splitting\n3. Configure SSR using TanStack Router's native APIs\n4. Follow the [SSR setup guide](./setup-ssr.md) for detailed instructions\n\n### Routes Not Matching\n\n**Problem:** Routes not rendering or 404 errors for valid routes.\n\n**Solution:**\n\n1. Check file naming follows TanStack Router conventions:\n   - Dynamic routes: `$paramName.tsx`\n   - Index routes: `index.tsx`\n   - Nested routes: proper directory structure\n2. Verify route tree generation is working\n3. Check that the router plugin is properly configured\n\n### React Router v7 Simplified APIs Not Translating\n\n**Problem:** v7's simplified `defer` or other features don't have direct equivalents.\n\n**Solution:**\n\n1. Use TanStack Router's pending states for loading UX\n2. Implement data fetching patterns that fit TanStack Router's architecture\n3. Leverage TanStack Router's superior type safety for better DX\n\n---\n\n## React Router v7 vs TanStack Router Feature Comparison\n\n| Feature            | React Router v7     | TanStack Router              |\n| ------------------ | ------------------- | ---------------------------- |\n| Type Safety        | Good                | Excellent                    |\n| File-based Routing | Framework mode only | Built-in                     |\n| Search Params      | Basic               | Validated with schemas       |\n| Code Splitting     | Good                | Excellent with lazy routes   |\n| SSR                | Framework mode      | Built-in with TanStack Start |\n| Bundle Size        | Larger              | Smaller                      |\n| Learning Curve     | Moderate            | Moderate                     |\n| Community          | Large               | Growing                      |\n\n---\n\n## Common Next Steps\n\nAfter successfully migrating to TanStack Router, consider these enhancements:\n\n### Advanced Features to Explore\n\n- **Route-based code splitting** - Improve performance with lazy loading\n- **Search parameter validation** - Type-safe URL state management\n- **Route preloading** - Enhance perceived performance\n- **Route masking** - Advanced URL management\n- **Integration with TanStack Query** - Powerful data fetching\n\n---\n\n## Related Resources\n\n- [TanStack Router Documentation](https://tanstack.com/router) - Complete API reference\n- [File-Based Routing Guide](../routing/file-based-routing.md) - Detailed routing concepts\n- [Navigation Guide](../guide/navigation.md) - Complete navigation patterns\n- [Search Parameters Guide](../guide/search-params.md) - Advanced search param usage\n- [Type Safety Guide](../guide/type-safety.md) - TypeScript integration details\n- [React Router v7 Changelog](https://reactrouter.com/start/changelog) - What changed in v7\n"
  },
  {
    "path": "docs/router/how-to/navigate-with-search-params.md",
    "content": "---\ntitle: How to Navigate with Search Parameters\n---\n\nThis guide covers updating and managing search parameters during navigation using TanStack Router's Link components and programmatic navigation methods.\n\n**Prerequisites:** [Set Up Basic Search Parameters](./setup-basic-search-params.md) - Foundation concepts for reading and validating search params.\n\n## Quick Start\n\nConfigure navigation that updates search parameters while preserving existing state:\n\n```tsx\nimport { Link, useNavigate } from '@tanstack/react-router'\n\n// Link with search parameter updates\n;<Link to=\"/search\" search={(prev) => ({ ...prev, query: 'new search' })}>\n  Search for \"new search\"\n</Link>\n\n// Programmatic navigation\nconst navigate = useNavigate()\nnavigate({\n  to: '/search',\n  search: (prev) => ({ ...prev, page: 1 }),\n})\n```\n\n## Navigation Methods\n\n### Using Link Components\n\n#### Basic Search Parameter Updates\n\nReplace all search parameters:\n\n```tsx\nimport { Link } from '@tanstack/router'\n\nfunction SearchForm() {\n  return (\n    <div>\n      {/* Replace all search params */}\n      <Link to=\"/products\" search={{ category: 'electronics', page: 1 }}>\n        Electronics\n      </Link>\n\n      {/* Navigate to same route with new search */}\n      <Link search={{ sort: 'price-asc' }}>Sort by Price</Link>\n    </div>\n  )\n}\n```\n\n#### Functional Search Parameter Updates\n\nMerge with existing search parameters:\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction Pagination() {\n  return (\n    <div>\n      {/* Preserve existing search, update page */}\n      <Link search={(prev) => ({ ...prev, page: (prev.page || 1) + 1 })}>\n        Next Page\n      </Link>\n\n      {/* Toggle filter while keeping other params */}\n      <Link\n        search={(prev) => ({\n          ...prev,\n          inStock: !prev.inStock,\n        })}\n      >\n        Toggle In Stock\n      </Link>\n\n      {/* Remove a search parameter */}\n      <Link\n        search={(prev) => {\n          const { category, ...rest } = prev\n          return rest\n        }}\n      >\n        Clear Category Filter\n      </Link>\n    </div>\n  )\n}\n```\n\n#### Preserving All Search Parameters\n\nUse `search={true}` to keep all current search parameters when navigating:\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction Navigation() {\n  return (\n    <nav>\n      {/* Keep all search params when changing routes */}\n      <Link to=\"/products\" search={true}>\n        View Products (Keep Filters)\n      </Link>\n\n      {/* Equivalent functional approach */}\n      <Link to=\"/products\" search={(prev) => prev}>\n        View Products (Functional)\n      </Link>\n    </nav>\n  )\n}\n```\n\n#### Navigation with Route Changes\n\nNavigate to different routes with search parameters:\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction Navigation() {\n  return (\n    <nav>\n      {/* Navigate to different route with search */}\n      <Link to=\"/search\" search={{ query: 'laptops', category: 'electronics' }}>\n        Search Laptops\n      </Link>\n\n      {/* Inherit current search params to new route */}\n      <Link\n        to=\"/products\"\n        search={true} // Shorthand to carry over all search params\n      >\n        View Products\n      </Link>\n\n      {/* Transform search params for new route */}\n      <Link\n        to=\"/advanced-search\"\n        search={(prev) => ({\n          q: prev.query, // Rename parameter\n          filters: {\n            category: prev.category,\n            inStock: prev.inStock,\n          },\n        })}\n      >\n        Advanced Search\n      </Link>\n    </nav>\n  )\n}\n```\n\n### Programmatic Navigation\n\n#### Using useNavigate Hook\n\nNavigate programmatically with search parameter updates:\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction SearchControls() {\n  const navigate = useNavigate()\n\n  const handleSortChange = (sortBy: string) => {\n    navigate({\n      search: (prev) => ({ ...prev, sort: sortBy, page: 1 }),\n    })\n  }\n\n  const handleClearFilters = () => {\n    navigate({\n      search: (prev) => {\n        const { category, minPrice, maxPrice, ...rest } = prev\n        return rest\n      },\n    })\n  }\n\n  const handleSearch = (query: string) => {\n    navigate({\n      to: '/search',\n      search: { query, page: 1 },\n    })\n  }\n\n  return (\n    <div>\n      <select onChange={(e) => handleSortChange(e.target.value)}>\n        <option value=\"relevance\">Sort by Relevance</option>\n        <option value=\"price-asc\">Price: Low to High</option>\n        <option value=\"price-desc\">Price: High to Low</option>\n      </select>\n\n      <button onClick={handleClearFilters}>Clear Filters</button>\n\n      <button onClick={() => handleSearch('latest products')}>\n        Search Latest\n      </button>\n    </div>\n  )\n}\n```\n\n#### Navigation with Router Instance\n\nUse the router directly only in non-React contexts where `useNavigate` or `Link` aren't available:\n\n```tsx\nimport { router } from './router' // Your router instance\n\n// ✅ Appropriate use case: Utility function outside React components\nexport function navigateFromUtility(searchParams: Record<string, any>) {\n  router.navigate({\n    search: (prev) => ({ ...prev, ...searchParams }),\n  })\n}\n\n// ✅ Appropriate use case: Event handlers in non-React code\nclass ApiService {\n  onAuthError() {\n    // Navigate to login when auth fails\n    router.navigate({\n      to: '/login',\n      search: { redirect: window.location.pathname },\n    })\n  }\n}\n\n// ✅ Appropriate use case: Global error handler\nwindow.addEventListener('unhandledrejection', (event) => {\n  if (event.reason.status === 401) {\n    router.navigate({\n      to: '/login',\n      search: { error: 'session-expired' },\n    })\n  }\n})\n```\n\n**⚠️ In React components, prefer `useNavigate` instead:**\n\n```tsx\n// ❌ Avoid in React components\nfunction Component() {\n  const router = useRouter()\n\n  const handleClick = () => {\n    router.navigate({ search: { filter: 'active' } })\n  }\n\n  return <button onClick={handleClick}>Filter</button>\n}\n\n// ✅ Use useNavigate in React components\nfunction Component() {\n  const navigate = useNavigate()\n\n  const handleClick = () => {\n    navigate({ search: { filter: 'active' } })\n  }\n\n  return <button onClick={handleClick}>Filter</button>\n}\n```\n\n## Advanced Navigation Patterns\n\n### Conditional Navigation\n\nNavigate automatically when certain conditions are met:\n\n```tsx\nimport { useEffect } from 'react'\nimport { useNavigate, useSearch } from '@tanstack/react-router'\n\nfunction ConditionalNavigation() {\n  const navigate = useNavigate()\n  const search = useSearch({ from: '/products' })\n\n  // Auto-reset page when search query changes\n  useEffect(() => {\n    if (search.query && search.page > 1) {\n      navigate({\n        search: (prev) => ({ ...prev, page: 1 }),\n      })\n    }\n  }, [search.query, search.page, navigate])\n\n  return <div>Page resets automatically when search changes</div>\n}\n```\n\n## Common Patterns\n\n## Common Problems\n\n### Search Parameters Not Updating\n\n**Problem:** Link navigation doesn't update search parameters.\n\n```tsx\n// ❌ Wrong - no search prop\n<Link to=\"/products\">Electronics</Link>\n\n// ✅ Correct - with search parameters\n<Link to=\"/products\" search={{ category: 'electronics' }}>\n  Electronics\n</Link>\n```\n\n### Losing Existing Search Parameters\n\n**Problem:** New navigation replaces all search parameters instead of updating specific ones.\n\n```tsx\n// ❌ Wrong - replaces all search params\n<Link search={{ page: 2 }}>Next Page</Link>\n\n// ✅ Correct - preserves existing search params\n<Link search={(prev) => ({ ...prev, page: 2 })}>\n  Next Page\n</Link>\n```\n\n## Common Next Steps\n\nAfter mastering navigation with search parameters, you might want to:\n\n- [Validate Search Parameters with Schemas](./validate-search-params.md) - Add robust validation with Zod, Valibot, or ArkType\n- [Work with Arrays, Objects, and Dates](./arrays-objects-dates-search-params.md) - Handle arrays, objects, dates, and nested data structures\n\n<!-- Uncomment when guides are available\n- [Share Search Parameters Across Routes](./share-search-params-across-routes.md) - Inherit and manage search params across route hierarchies\n-->\n\n## Related Resources\n\n- [TanStack Router Search Params Guide](https://tanstack.com/router/latest/docs/framework/react/guide/search-params) - Official documentation\n"
  },
  {
    "path": "docs/router/how-to/setup-auth-providers.md",
    "content": "---\ntitle: How to Set Up Authentication Providers\n---\n\nThis guide covers integrating popular authentication services (Auth0, Clerk, Supabase) with TanStack Router.\n\n## Quick Start\n\nChoose an authentication provider, install their SDK, wrap your router with their context, and adapt their auth state to work with TanStack Router's context system.\n\n---\n\n## Auth0 Integration\n\n### 1. Install Auth0\n\n```bash\nnpm install @auth0/auth0-react\n```\n\n### 2. Set Up Environment Variables\n\nAdd to your `.env` file:\n\n```env\nVITE_AUTH0_DOMAIN=your-auth0-domain.auth0.com\nVITE_AUTH0_CLIENT_ID=your_auth0_client_id\n```\n\n### 3. Create Auth0 Wrapper\n\nCreate `src/auth/auth0.tsx`:\n\n```tsx\nimport { Auth0Provider, useAuth0 } from '@auth0/auth0-react'\nimport { createContext, useContext } from 'react'\n\ninterface Auth0ContextType {\n  isAuthenticated: boolean\n  user: any\n  login: () => void\n  logout: () => void\n  isLoading: boolean\n}\n\nconst Auth0Context = createContext<Auth0ContextType | undefined>(undefined)\n\nexport function Auth0Wrapper({ children }: { children: React.ReactNode }) {\n  return (\n    <Auth0Provider\n      domain={import.meta.env.VITE_AUTH0_DOMAIN}\n      clientId={import.meta.env.VITE_AUTH0_CLIENT_ID}\n      authorizationParams={{\n        redirect_uri: window.location.origin,\n      }}\n    >\n      <Auth0ContextProvider>{children}</Auth0ContextProvider>\n    </Auth0Provider>\n  )\n}\n\nfunction Auth0ContextProvider({ children }: { children: React.ReactNode }) {\n  const { isAuthenticated, user, loginWithRedirect, logout, isLoading } =\n    useAuth0()\n\n  const contextValue = {\n    isAuthenticated,\n    user,\n    login: loginWithRedirect,\n    logout: () =>\n      logout({ logoutParams: { returnTo: window.location.origin } }),\n    isLoading,\n  }\n\n  return (\n    <Auth0Context.Provider value={contextValue}>\n      {children}\n    </Auth0Context.Provider>\n  )\n}\n\nexport function useAuth0Context() {\n  const context = useContext(Auth0Context)\n  if (context === undefined) {\n    throw new Error('useAuth0Context must be used within Auth0Wrapper')\n  }\n  return context\n}\n```\n\n### 4. Update App Configuration\n\nUpdate `src/App.tsx`:\n\n```tsx\nimport { RouterProvider } from '@tanstack/react-router'\nimport { Auth0Wrapper, useAuth0Context } from './auth/auth0'\nimport { router } from './router'\n\nfunction InnerApp() {\n  const auth = useAuth0Context()\n\n  if (auth.isLoading) {\n    return (\n      <div className=\"flex items-center justify-center min-h-screen\">\n        Loading...\n      </div>\n    )\n  }\n\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <Auth0Wrapper>\n      <InnerApp />\n    </Auth0Wrapper>\n  )\n}\n\nexport default App\n```\n\n### 5. Create Protected Routes\n\nCreate `src/routes/_authenticated.tsx`:\n\n```tsx\nimport { createFileRoute, redirect, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated) {\n      // Auth0 handles login redirects, so just trigger login\n      context.auth.login()\n      return\n    }\n  },\n  component: () => <Outlet />,\n})\n```\n\n---\n\n## Clerk Integration\n\n### 1. Install Clerk\n\n```bash\nnpm install @clerk/clerk-react\n```\n\n### 2. Set Up Environment Variables\n\nAdd to your `.env` file:\n\n```env\nVITE_CLERK_PUBLISHABLE_KEY=pk_test_your_clerk_key\n```\n\n### 3. Create Clerk Wrapper\n\nCreate `src/auth/clerk.tsx`:\n\n```tsx\nimport { ClerkProvider, useUser, useAuth } from '@clerk/clerk-react'\n\nexport function ClerkWrapper({ children }: { children: React.ReactNode }) {\n  return (\n    <ClerkProvider publishableKey={import.meta.env.VITE_CLERK_PUBLISHABLE_KEY}>\n      {children}\n    </ClerkProvider>\n  )\n}\n\nexport function useClerkAuth() {\n  const { isSignedIn, isLoaded } = useAuth()\n  const { user } = useUser()\n\n  return {\n    isAuthenticated: isSignedIn,\n    user: user\n      ? {\n          id: user.id,\n          username:\n            user.username || user.primaryEmailAddress?.emailAddress || '',\n          email: user.primaryEmailAddress?.emailAddress || '',\n        }\n      : null,\n    isLoading: !isLoaded,\n    login: () => {\n      // Clerk handles login through components\n      window.location.href = '/sign-in'\n    },\n    logout: () => {\n      // Clerk handles logout through components\n      window.location.href = '/sign-out'\n    },\n  }\n}\n```\n\n### 4. Create Clerk Auth Routes\n\nCreate `src/routes/sign-in.tsx`:\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { SignIn } from '@clerk/clerk-react'\n\nexport const Route = createFileRoute('/sign-in')({\n  component: () => (\n    <div className=\"flex items-center justify-center min-h-screen\">\n      <SignIn redirectUrl=\"/dashboard\" signUpUrl=\"/sign-up\" />\n    </div>\n  ),\n})\n```\n\nCreate `src/routes/sign-up.tsx`:\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { SignUp } from '@clerk/clerk-react'\n\nexport const Route = createFileRoute('/sign-up')({\n  component: () => (\n    <div className=\"flex items-center justify-center min-h-screen\">\n      <SignUp redirectUrl=\"/dashboard\" signInUrl=\"/sign-in\" />\n    </div>\n  ),\n})\n```\n\n### 5. Update App Configuration\n\nUpdate `src/App.tsx`:\n\n```tsx\nimport { RouterProvider } from '@tanstack/react-router'\nimport { ClerkWrapper, useClerkAuth } from './auth/clerk'\nimport { router } from './router'\n\nfunction InnerApp() {\n  const auth = useClerkAuth()\n\n  if (auth.isLoading) {\n    return (\n      <div className=\"flex items-center justify-center min-h-screen\">\n        Loading...\n      </div>\n    )\n  }\n\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <ClerkWrapper>\n      <InnerApp />\n    </ClerkWrapper>\n  )\n}\n\nexport default App\n```\n\n### 6. Create Protected Routes\n\nCreate `src/routes/_authenticated.tsx`:\n\n```tsx\nimport { createFileRoute, redirect, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({\n        to: '/sign-in',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n  },\n  component: () => <Outlet />,\n})\n```\n\n---\n\n## Supabase Integration\n\n### 1. Install Supabase\n\n```bash\nnpm install @supabase/supabase-js\n```\n\n### 2. Set Up Environment Variables\n\nAdd to your `.env` file:\n\n```env\nVITE_SUPABASE_URL=https://your-project.supabase.co\nVITE_SUPABASE_ANON_KEY=your_supabase_anon_key\n```\n\n### 3. Create Supabase Client\n\nCreate `src/auth/supabase.tsx`:\n\n```tsx\nimport { createClient } from '@supabase/supabase-js'\nimport { createContext, useContext, useEffect, useState } from 'react'\n\nconst supabase = createClient(\n  import.meta.env.VITE_SUPABASE_URL,\n  import.meta.env.VITE_SUPABASE_ANON_KEY,\n)\n\ninterface SupabaseAuthState {\n  isAuthenticated: boolean\n  user: any\n  login: (email: string, password: string) => Promise<void>\n  logout: () => Promise<void>\n  isLoading: boolean\n}\n\nconst SupabaseAuthContext = createContext<SupabaseAuthState | undefined>(\n  undefined,\n)\n\nexport function SupabaseAuthProvider({\n  children,\n}: {\n  children: React.ReactNode\n}) {\n  const [user, setUser] = useState(null)\n  const [isAuthenticated, setIsAuthenticated] = useState(false)\n  const [isLoading, setIsLoading] = useState(true)\n\n  useEffect(() => {\n    // Get initial session\n    supabase.auth.getSession().then(({ data: { session } }) => {\n      setUser(session?.user ?? null)\n      setIsAuthenticated(!!session?.user)\n      setIsLoading(false)\n    })\n\n    // Listen for auth changes\n    const {\n      data: { subscription },\n    } = supabase.auth.onAuthStateChange((_event, session) => {\n      setUser(session?.user ?? null)\n      setIsAuthenticated(!!session?.user)\n      setIsLoading(false)\n    })\n\n    return () => subscription.unsubscribe()\n  }, [])\n\n  const login = async (email: string, password: string) => {\n    const { error } = await supabase.auth.signInWithPassword({\n      email,\n      password,\n    })\n    if (error) throw error\n  }\n\n  const logout = async () => {\n    const { error } = await supabase.auth.signOut()\n    if (error) throw error\n  }\n\n  return (\n    <SupabaseAuthContext.Provider\n      value={{\n        isAuthenticated,\n        user,\n        login,\n        logout,\n        isLoading,\n      }}\n    >\n      {children}\n    </SupabaseAuthContext.Provider>\n  )\n}\n\nexport function useSupabaseAuth() {\n  const context = useContext(SupabaseAuthContext)\n  if (context === undefined) {\n    throw new Error('useSupabaseAuth must be used within SupabaseAuthProvider')\n  }\n  return context\n}\n```\n\n### 4. Create Login Component\n\nCreate `src/routes/login.tsx`:\n\n```tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: (search) => ({\n    redirect: (search.redirect as string) || '/dashboard',\n  }),\n  beforeLoad: ({ context, search }) => {\n    if (context.auth.isAuthenticated) {\n      throw redirect({ to: search.redirect })\n    }\n  },\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const { auth } = Route.useRouteContext()\n  const { redirect } = Route.useSearch()\n  const [email, setEmail] = useState('')\n  const [password, setPassword] = useState('')\n  const [isLoading, setIsLoading] = useState(false)\n  const [error, setError] = useState('')\n\n  const handleSubmit = async (e: React.FormEvent) => {\n    e.preventDefault()\n    setIsLoading(true)\n    setError('')\n\n    try {\n      await auth.login(email, password)\n      // Supabase auth will automatically update context\n      window.location.href = redirect\n    } catch (err: any) {\n      setError(err.message || 'Login failed')\n    } finally {\n      setIsLoading(false)\n    }\n  }\n\n  return (\n    <div className=\"min-h-screen flex items-center justify-center\">\n      <form\n        onSubmit={handleSubmit}\n        className=\"max-w-md w-full space-y-4 p-6 border rounded-lg\"\n      >\n        <h1 className=\"text-2xl font-bold text-center\">Sign In</h1>\n\n        {error && (\n          <div className=\"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded\">\n            {error}\n          </div>\n        )}\n\n        <div>\n          <label htmlFor=\"email\" className=\"block text-sm font-medium mb-1\">\n            Email\n          </label>\n          <input\n            id=\"email\"\n            type=\"email\"\n            value={email}\n            onChange={(e) => setEmail(e.target.value)}\n            className=\"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500\"\n            required\n          />\n        </div>\n\n        <div>\n          <label htmlFor=\"password\" className=\"block text-sm font-medium mb-1\">\n            Password\n          </label>\n          <input\n            id=\"password\"\n            type=\"password\"\n            value={password}\n            onChange={(e) => setPassword(e.target.value)}\n            className=\"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500\"\n            required\n          />\n        </div>\n\n        <button\n          type=\"submit\"\n          disabled={isLoading}\n          className=\"w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 disabled:opacity-50\"\n        >\n          {isLoading ? 'Signing in...' : 'Sign In'}\n        </button>\n      </form>\n    </div>\n  )\n}\n```\n\n### 5. Update App Configuration\n\nUpdate `src/App.tsx`:\n\n```tsx\nimport { RouterProvider } from '@tanstack/react-router'\nimport { SupabaseAuthProvider, useSupabaseAuth } from './auth/supabase'\nimport { router } from './router'\n\nfunction InnerApp() {\n  const auth = useSupabaseAuth()\n\n  if (auth.isLoading) {\n    return (\n      <div className=\"flex items-center justify-center min-h-screen\">\n        Loading...\n      </div>\n    )\n  }\n\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <SupabaseAuthProvider>\n      <InnerApp />\n    </SupabaseAuthProvider>\n  )\n}\n\nexport default App\n```\n\n---\n\n## Provider Comparison\n\n| Feature                 | Auth0    | Clerk     | Supabase |\n| ----------------------- | -------- | --------- | -------- |\n| **Setup Complexity**    | Medium   | Low       | Medium   |\n| **UI Components**       | Basic    | Excellent | None     |\n| **Customization**       | High     | Medium    | High     |\n| **Pricing**             | Freemium | Freemium  | Freemium |\n| **Social Login**        | ✅       | ✅        | ✅       |\n| **Enterprise Features** | ✅       | ✅        | ✅       |\n| **Database Included**   | ❌       | ❌        | ✅       |\n\n### When to Choose Each:\n\n- **Auth0**: Complex enterprise requirements, extensive customization\n- **Clerk**: Quick setup with beautiful UI components\n- **Supabase**: Full-stack solution with database and real-time features\n\n---\n\n## Common Problems\n\n### Provider Context Not Available\n\n**Problem:** Auth context is undefined in components.\n\n**Solution:** Ensure the provider wrapper is above `RouterProvider`:\n\n```tsx\n// ✅ Correct order\n<AuthProvider>\n  <InnerApp>\n    <RouterProvider />\n  </InnerApp>\n</AuthProvider>\n\n// ❌ Wrong order\n<RouterProvider>\n  <AuthProvider />\n</RouterProvider>\n```\n\n### Infinite Loading States\n\n**Problem:** App stuck on loading screen.\n\n**Solution:** Check if auth provider properly sets `isLoading` to `false`:\n\n```tsx\n// Add timeout fallback\nuseEffect(() => {\n  const timeout = setTimeout(() => {\n    if (isLoading) {\n      setIsLoading(false)\n    }\n  }, 5000)\n  return () => clearTimeout(timeout)\n}, [isLoading])\n```\n\n### Redirect Loops with Auth0\n\n**Problem:** Continuous redirects between login and protected routes.\n\n**Solution:** Handle Auth0's automatic redirects properly:\n\n```tsx\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: ({ context }) => {\n    if (!context.auth.isAuthenticated && !context.auth.isLoading) {\n      context.auth.login()\n      // Don't throw redirect, let Auth0 handle it\n      return\n    }\n  },\n  component: () => <Outlet />,\n})\n```\n\n---\n\n## Common Next Steps\n\nAfter integrating authentication providers, you might want to:\n\n- [How to Set Up Role-Based Access Control](./setup-rbac.md) - Add permission-based routing\n- [How to Set Up Basic Authentication](./setup-authentication.md) - Custom auth implementation\n\n<!-- TODO: Uncomment as how-to guides are created\n- [How to Handle User Sessions](./handle-user-sessions.md)\n- [How to Set Up Social Login](./setup-social-login.md)\n-->\n\n## Related Resources\n\n- [Auth0 React SDK](https://auth0.com/docs/libraries/auth0-react) - Official Auth0 documentation\n- [Clerk React SDK](https://clerk.com/docs/references/react/overview) - Official Clerk documentation\n- [Supabase Auth](https://supabase.com/docs/guides/auth) - Official Supabase auth guide\n"
  },
  {
    "path": "docs/router/how-to/setup-authentication.md",
    "content": "---\ntitle: How to Set Up Basic Authentication and Protected Routes\n---\n\nThis guide covers implementing basic authentication patterns and protecting routes in TanStack Router applications.\n\n## Quick Start\n\nSet up authentication by creating a context-aware router, implementing auth state management, and using `beforeLoad` for route protection. This guide focuses on the core authentication setup using React Context.\n\n---\n\n## Create Authentication Context\n\nCreate `src/auth.tsx`:\n\n```tsx\nimport React, { createContext, useContext, useState, useEffect } from 'react'\n\ninterface User {\n  id: string\n  username: string\n  email: string\n}\n\ninterface AuthState {\n  isAuthenticated: boolean\n  user: User | null\n  login: (username: string, password: string) => Promise<void>\n  logout: () => void\n}\n\nconst AuthContext = createContext<AuthState | undefined>(undefined)\n\nexport function AuthProvider({ children }: { children: React.ReactNode }) {\n  const [user, setUser] = useState<User | null>(null)\n  const [isAuthenticated, setIsAuthenticated] = useState(false)\n  const [isLoading, setIsLoading] = useState(true)\n\n  // Restore auth state on app load\n  useEffect(() => {\n    const token = localStorage.getItem('auth-token')\n    if (token) {\n      // Validate token with your API\n      fetch('/api/validate-token', {\n        headers: { Authorization: `Bearer ${token}` },\n      })\n        .then((response) => response.json())\n        .then((userData) => {\n          if (userData.valid) {\n            setUser(userData.user)\n            setIsAuthenticated(true)\n          } else {\n            localStorage.removeItem('auth-token')\n          }\n        })\n        .catch(() => {\n          localStorage.removeItem('auth-token')\n        })\n        .finally(() => {\n          setIsLoading(false)\n        })\n    } else {\n      setIsLoading(false)\n    }\n  }, [])\n\n  // Show loading state while checking auth\n  if (isLoading) {\n    return (\n      <div className=\"flex items-center justify-center min-h-screen\">\n        Loading...\n      </div>\n    )\n  }\n\n  const login = async (username: string, password: string) => {\n    // Replace with your authentication logic\n    const response = await fetch('/api/login', {\n      method: 'POST',\n      headers: { 'Content-Type': 'application/json' },\n      body: JSON.stringify({ username, password }),\n    })\n\n    if (response.ok) {\n      const userData = await response.json()\n      setUser(userData)\n      setIsAuthenticated(true)\n      // Store token for persistence\n      localStorage.setItem('auth-token', userData.token)\n    } else {\n      throw new Error('Authentication failed')\n    }\n  }\n\n  const logout = () => {\n    setUser(null)\n    setIsAuthenticated(false)\n    localStorage.removeItem('auth-token')\n  }\n\n  return (\n    <AuthContext.Provider value={{ isAuthenticated, user, login, logout }}>\n      {children}\n    </AuthContext.Provider>\n  )\n}\n\nexport function useAuth() {\n  const context = useContext(AuthContext)\n  if (context === undefined) {\n    throw new Error('useAuth must be used within an AuthProvider')\n  }\n  return context\n}\n```\n\n---\n\n## Configure Router Context\n\n### 1. Set Up Router Context\n\nUpdate `src/routes/__root.tsx`:\n\n```tsx\nimport { createRootRouteWithContext, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\ninterface AuthState {\n  isAuthenticated: boolean\n  user: { id: string; username: string; email: string } | null\n  login: (username: string, password: string) => Promise<void>\n  logout: () => void\n}\n\ninterface MyRouterContext {\n  auth: AuthState\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => (\n    <div>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </div>\n  ),\n})\n```\n\n### 2. Configure Router\n\nUpdate `src/router.tsx`:\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport const router = createRouter({\n  routeTree,\n  context: {\n    // auth will be passed down from App component\n    auth: undefined!,\n  },\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n```\n\n### 3. Connect App with Authentication\n\nUpdate `src/App.tsx`:\n\n```tsx\nimport { RouterProvider } from '@tanstack/react-router'\nimport { AuthProvider, useAuth } from './auth'\nimport { router } from './router'\n\nfunction InnerApp() {\n  const auth = useAuth()\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthProvider>\n      <InnerApp />\n    </AuthProvider>\n  )\n}\n\nexport default App\n```\n\n---\n\n## Create Protected Routes\n\n### 1. Create Authentication Layout Route\n\nCreate `src/routes/_authenticated.tsx`:\n\n```tsx\nimport { createFileRoute, redirect, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({\n        to: '/login',\n        search: {\n          // Save current location for redirect after login\n          redirect: location.href,\n        },\n      })\n    }\n  },\n  component: () => <Outlet />,\n})\n```\n\n### 2. Create Login Route\n\nCreate `src/routes/login.tsx`:\n\n```tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: (search) => ({\n    redirect: (search.redirect as string) || '/',\n  }),\n  beforeLoad: ({ context, search }) => {\n    // Redirect if already authenticated\n    if (context.auth.isAuthenticated) {\n      throw redirect({ to: search.redirect })\n    }\n  },\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const { auth } = Route.useRouteContext()\n  const { redirect } = Route.useSearch()\n  const navigate = Route.useNavigate()\n  const [username, setUsername] = useState('')\n  const [password, setPassword] = useState('')\n  const [isLoading, setIsLoading] = useState(false)\n  const [error, setError] = useState('')\n\n  const handleSubmit = async (e: React.FormEvent) => {\n    e.preventDefault()\n    setIsLoading(true)\n    setError('')\n\n    try {\n      await auth.login(username, password)\n      // Navigate to the redirect URL using router navigation\n      navigate({ to: redirect })\n    } catch (err) {\n      setError('Invalid username or password')\n    } finally {\n      setIsLoading(false)\n    }\n  }\n\n  return (\n    <div className=\"min-h-screen flex items-center justify-center\">\n      <form\n        onSubmit={handleSubmit}\n        className=\"max-w-md w-full space-y-4 p-6 border rounded-lg\"\n      >\n        <h1 className=\"text-2xl font-bold text-center\">Sign In</h1>\n\n        {error && (\n          <div className=\"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded\">\n            {error}\n          </div>\n        )}\n\n        <div>\n          <label htmlFor=\"username\" className=\"block text-sm font-medium mb-1\">\n            Username\n          </label>\n          <input\n            id=\"username\"\n            type=\"text\"\n            value={username}\n            onChange={(e) => setUsername(e.target.value)}\n            className=\"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500\"\n            required\n          />\n        </div>\n\n        <div>\n          <label htmlFor=\"password\" className=\"block text-sm font-medium mb-1\">\n            Password\n          </label>\n          <input\n            id=\"password\"\n            type=\"password\"\n            value={password}\n            onChange={(e) => setPassword(e.target.value)}\n            className=\"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500\"\n            required\n          />\n        </div>\n\n        <button\n          type=\"submit\"\n          disabled={isLoading}\n          className=\"w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed\"\n        >\n          {isLoading ? 'Signing in...' : 'Sign In'}\n        </button>\n      </form>\n    </div>\n  )\n}\n```\n\n### 3. Create Protected Dashboard\n\nCreate `src/routes/_authenticated/dashboard.tsx`:\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  const { auth } = Route.useRouteContext()\n\n  return (\n    <div className=\"p-6\">\n      <div className=\"flex justify-between items-center mb-6\">\n        <h1 className=\"text-3xl font-bold\">Dashboard</h1>\n        <button\n          onClick={auth.logout}\n          className=\"bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700\"\n        >\n          Sign Out\n        </button>\n      </div>\n\n      <div className=\"bg-white p-6 rounded-lg shadow\">\n        <h2 className=\"text-xl font-semibold mb-2\">Welcome back!</h2>\n        <p className=\"text-gray-600\">\n          Hello, <strong>{auth.user?.username}</strong>! You are successfully\n          authenticated.\n        </p>\n        <p className=\"text-sm text-gray-500 mt-2\">Email: {auth.user?.email}</p>\n      </div>\n    </div>\n  )\n}\n```\n\n---\n\n## Add Authentication Persistence\n\nUpdate your `AuthProvider` to restore authentication state on page refresh:\n\n```tsx\nexport function AuthProvider({ children }: { children: React.ReactNode }) {\n  const [user, setUser] = useState<User | null>(null)\n  const [isAuthenticated, setIsAuthenticated] = useState(false)\n  const [isLoading, setIsLoading] = useState(true)\n\n  // Restore auth state on app load\n  useEffect(() => {\n    const token = localStorage.getItem('auth-token')\n    if (token) {\n      // Validate token with your API\n      fetch('/api/validate-token', {\n        headers: { Authorization: `Bearer ${token}` },\n      })\n        .then((response) => response.json())\n        .then((userData) => {\n          if (userData.valid) {\n            setUser(userData.user)\n            setIsAuthenticated(true)\n          } else {\n            localStorage.removeItem('auth-token')\n          }\n        })\n        .catch(() => {\n          localStorage.removeItem('auth-token')\n        })\n        .finally(() => {\n          setIsLoading(false)\n        })\n    } else {\n      setIsLoading(false)\n    }\n  }, [])\n\n  // Show loading state while checking auth\n  if (isLoading) {\n    return (\n      <div className=\"flex items-center justify-center min-h-screen\">\n        Loading...\n      </div>\n    )\n  }\n\n  // ... rest of the provider logic\n}\n```\n\n---\n\n## Production Checklist\n\nBefore deploying authentication, ensure you have:\n\n- [ ] Secured API endpoints with proper authentication middleware\n- [ ] Set up HTTPS in production (required for secure cookies)\n- [ ] Configured environment variables for API endpoints\n- [ ] Implemented proper token validation and refresh\n- [ ] Added CSRF protection for form-based authentication\n- [ ] Tested authentication flows (login, logout, persistence)\n- [ ] Added proper error handling for network failures\n- [ ] Implemented loading states for auth operations\n\n---\n\n## Common Problems\n\n### Authentication Context Not Available\n\n**Problem:** `useAuth must be used within an AuthProvider` error.\n\n**Solution:** Ensure `AuthProvider` wraps your entire app and `RouterProvider` is inside it.\n\n### User Logged Out on Page Refresh\n\n**Problem:** Authentication state resets when page refreshes.\n\n**Solution:** Add token persistence as shown in the persistence section above.\n\n### Protected Route Flashing Before Redirect\n\n**Problem:** Protected content briefly shows before redirecting to login.\n\n**Solution:** Use `beforeLoad` instead of component-level auth checks:\n\n```tsx\nexport const Route = createFileRoute('/_authenticated/dashboard')({\n  beforeLoad: ({ context }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({ to: '/login' })\n    }\n  },\n  component: DashboardComponent,\n})\n```\n\n---\n\n## Common Next Steps\n\nAfter setting up basic authentication, you might want to:\n\n- [How to Integrate Authentication Providers](./setup-auth-providers.md) - Use Auth0, Clerk, or Supabase\n- [How to Set Up Role-Based Access Control](./setup-rbac.md) - Add permission-based routing\n\n<!-- TODO: Uncomment as how-to guides are created\n- [How to Handle User Sessions](./handle-user-sessions.md)\n- [How to Set Up Social Login](./setup-social-login.md)\n-->\n\n## Related Resources\n\n- [Authenticated Routes Guide](../guide/authenticated-routes.md) - Detailed conceptual guide\n- [Router Context Guide](../guide/router-context.md) - Understanding context in TanStack Router\n- [Authentication Examples](https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes) - Complete working examples\n"
  },
  {
    "path": "docs/router/how-to/setup-basic-search-params.md",
    "content": "---\ntitle: How to Set Up Basic Search Parameters\n---\n\nLearn how to add type-safe, production-ready search parameters to your TanStack Router routes using schema validation. This guide covers the fundamentals of search parameter validation, reading values, and handling different data types with any standard schema-compliant validation library.\n\n## Quick Start\n\nSet up search parameters with schema validation (recommended for production):\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  page: fallback(z.number(), 1).default(1),\n  category: fallback(z.string(), 'all').default('all'),\n  showSale: fallback(z.boolean(), false).default(false),\n})\n\nexport const Route = createFileRoute('/products')({\n  validateSearch: productSearchSchema,\n  component: ProductsPage,\n})\n\nfunction ProductsPage() {\n  const { page, category, showSale } = Route.useSearch()\n\n  return (\n    <div>\n      <h1>Products</h1>\n      <p>Page: {page}</p>\n      <p>Category: {category}</p>\n      <p>Show Sale Items: {showSale ? 'Yes' : 'No'}</p>\n    </div>\n  )\n}\n```\n\n## Why Use Schema Validation for Search Parameters?\n\n**Production Benefits:**\n\n- **Type Safety**: Automatic TypeScript inference\n- **Runtime Validation**: Catches invalid URL parameters gracefully\n- **Default Values**: Fallback handling for missing parameters\n- **Error Handling**: Built-in validation error management\n- **Maintainability**: Clear, declarative schema definitions\n\n## Validation Library Setup\n\nTanStack Router supports any standard schema-compliant validation library. This guide focuses on Zod for examples, but you can use any validation library.\n\nUsing Zod v4:\n\n```tsx\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  page: z.number().default(1),\n  category: z.string().default('all').catch('all'),\n})\n\nexport const Route = createFileRoute('/products')({\n  validateSearch: searchSchema,\n  component: ProductsPage,\n})\n```\n\nFor Zod v3:\n\n```bash\nnpm install zod @tanstack/zod-adapter\n```\n\n```tsx\nimport { zodValidator, fallback } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  page: fallback(z.number(), 1).default(1),\n  category: fallback(z.string(), 'all').default('all'),\n})\n\nexport const Route = createFileRoute('/products')({\n  validateSearch: zodValidator(searchSchema),\n  component: ProductsPage,\n})\n```\n\n**For detailed validation library comparisons and advanced validation patterns, see:** [Validate Search Parameters with Schemas](./validate-search-params.md)\n\n## Step-by-Step Setup with Zod\n\nThe rest of this guide uses Zod v4 for examples, but the patterns apply to any validation library.\n\n### Step 1: Define Your Search Schema\n\nStart by identifying what search parameters your route needs:\n\n```tsx\nimport { z } from 'zod'\nimport { fallback } from '@tanstack/zod-adapter'\n\nconst shopSearchSchema = z.object({\n  // Pagination\n  page: z.number().default(1),\n  limit: z.number().default(20),\n\n  // Filtering\n  category: z.string().default('all'),\n  minPrice: z.number().default(0),\n  maxPrice: z.number().default(1000),\n\n  // Settings\n  sort: z.enum(['name', 'price', 'date']).default('name'),\n  ascending: z.boolean().default(true),\n\n  // Optional parameters\n  searchTerm: z.string().optional(),\n  showOnlyInStock: z.boolean().default(false),\n})\n\ntype ShopSearch = z.infer<typeof shopSearchSchema>\n```\n\n### Step 2: Add Schema Validation to Route\n\nConnect your schema to the route:\n\n```tsx\nexport const Route = createFileRoute('/shop')({\n  validateSearch: shopSearchSchema,\n  component: ShopPage,\n})\n```\n\n### Step 3: Read Search Parameters in Components\n\nUse the route's `useSearch()` hook to access validated and typed search parameters:\n\n```tsx\nfunction ShopPage() {\n  const searchParams = Route.useSearch()\n\n  // All properties are fully type-safe and validated\n  const {\n    page,\n    limit,\n    category,\n    sort,\n    ascending,\n    searchTerm,\n    showOnlyInStock,\n  } = searchParams\n\n  return (\n    <div>\n      <h1>Shop - Page {page}</h1>\n      <div>Category: {category}</div>\n      <div>\n        Sort: {sort} ({ascending ? 'ascending' : 'descending'})\n      </div>\n      <div>Items per page: {limit}</div>\n      <div>In stock only: {showOnlyInStock ? 'Yes' : 'No'}</div>\n      {searchTerm && <div>Search: \"{searchTerm}\"</div>}\n    </div>\n  )\n}\n```\n\n## Common Search Parameter Patterns\n\n### Pagination with Constraints\n\n```tsx\nconst paginationSchema = z.object({\n  page: z.number().min(1).default(1),\n  limit: z.number().min(10).max(100).default(20),\n})\n\nexport const Route = createFileRoute('/posts')({\n  validateSearch: paginationSchema,\n  component: PostsPage,\n})\n\nfunction PostsPage() {\n  const { page, limit } = Route.useSearch()\n\n  // Calculate offset for API calls\n  const offset = (page - 1) * limit\n\n  return (\n    <div>\n      <h1>Posts (Page {page})</h1>\n      <p>Showing {limit} posts per page</p>\n      <p>Offset: {offset}</p>\n      {/* Render posts... */}\n    </div>\n  )\n}\n```\n\n### Enum Validation with Defaults\n\n```tsx\nconst catalogSchema = z.object({\n  sort: z.enum(['name', 'date', 'price']).default('name'),\n  category: z.enum(['electronics', 'clothing', 'books', 'all']).default('all'),\n  ascending: z.boolean().default(true),\n})\n\nexport const Route = createFileRoute('/catalog')({\n  validateSearch: catalogSchema,\n  component: CatalogPage,\n})\n```\n\n### Complex Data Types\n\n```tsx\nconst dashboardSchema = z.object({\n  // Numbers with validation\n  userId: z.number().positive().default(1),\n  refreshInterval: z.number().min(1000).max(60000).default(5000),\n\n  // Strings with validation\n  theme: z.enum(['light', 'dark']).default('light'),\n  timezone: z.string().optional(),\n\n  // Arrays with validation\n  selectedIds: z.number().array().default([]),\n  tags: z.string().array().default([]),\n\n  // Objects with validation\n  filters: z\n    .object({\n      status: z.enum(['active', 'inactive']).optional(),\n      type: z.string().optional(),\n    })\n    .default({}),\n})\n```\n\n### Date and Advanced Types\n\n```tsx\nconst reportSchema = z.object({\n  startDate: z.string().pipe(z.coerce.date()).optional(),\n  endDate: z.string().pipe(z.coerce.date()).optional(),\n  format: z.enum(['pdf', 'csv', 'excel']).default('pdf').catch('pdf'),\n  includeCharts: z.boolean().default(true),\n})\n```\n\n## Reading Search Parameters Outside Components\n\n### Using getRouteApi\n\nFor code-split components or separate files:\n\n```tsx\n// components/ProductFilters.tsx\nimport { getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/products')\n\nexport function ProductFilters() {\n  const { category, sort, showSale } = routeApi.useSearch()\n\n  return (\n    <div>\n      <select value={category}>\n        <option value=\"all\">All Categories</option>\n        <option value=\"electronics\">Electronics</option>\n        <option value=\"clothing\">Clothing</option>\n      </select>\n      {/* More filters... */}\n    </div>\n  )\n}\n```\n\n### Using useSearch with from\n\n```tsx\nimport { useSearch } from '@tanstack/react-router'\n\nfunction GenericSearchDisplay() {\n  const search = useSearch({ from: '/products' })\n\n  return <div>Current filters: {JSON.stringify(search, null, 2)}</div>\n}\n```\n\n## Manual Validation (Understanding the Primitives)\n\nWhile schema validation is recommended for production, understanding manual validation helps you understand how search parameters work under the hood:\n\n```tsx\n// Educational example - use schema validation for production\nexport const Route = createFileRoute('/example')({\n  validateSearch: (search: Record<string, unknown>) => ({\n    // Numbers need coercion from URL strings\n    page: Number(search.page) || 1,\n\n    // Strings can be cast with defaults\n    category: (search.category as string) || 'all',\n\n    // Booleans: TanStack Router auto-converts \"true\"/\"false\" to booleans\n    showSale: Boolean(search.showSale),\n\n    // Arrays need JSON parsing validation\n    selectedIds: Array.isArray(search.selectedIds)\n      ? search.selectedIds.map(Number).filter(Boolean)\n      : [],\n  }),\n  component: ExamplePage,\n})\n```\n\n## Production Checklist\n\n- [x] **Use schema validation** with a validation library for type safety and runtime validation\n- [x] **Add fallback values** for graceful error handling\n- [x] **Set default values** for optional parameters\n- [x] **Validate constraints** using your validation library's built-in validators\n- [x] **Handle optional parameters** appropriately\n- [x] **Type inference** works automatically with proper schema setup\n- [x] **Error boundaries** are configured to handle validation failures\n\n## Common Problems\n\n### Problem: Search Parameters Cause TypeScript Errors\n\n**Cause:** Missing or incorrect schema definition with Zod v3.\n\n**Solution:** Ensure your schema covers all search parameters and use proper types:\n\n```tsx\n// ❌ Missing schema or incorrect types\nexport const Route = createFileRoute('/page')({\n  component: MyPage,\n})\n\n// ✅ Complete schema with proper validation\nconst searchSchema = z.object({\n  page: fallback(z.number(), 1).default(1),\n  category: fallback(z.string(), 'all').default('all'),\n})\n\nexport const Route = createFileRoute('/page')({\n  validateSearch: zodValidator(searchSchema),\n  component: MyPage,\n})\n```\n\n### Problem: Invalid URL Parameters Break the App\n\n**Cause:** Not using fallback handling for error cases.\n\n**Solution:** Use fallback values to provide safe defaults:\n\n```tsx\n// ❌ No fallback handling\nconst schema = z.object({\n  page: z.number().default(1), // Will throw on invalid input\n})\n\n// ✅ Graceful fallback handling\nconst schema = z.object({\n  page: z.number().default(1).catch(1), // Safe fallback to 1\n})\n```\n\n### Problem: Optional Parameters Are Required by TypeScript\n\n**Cause:** Using `.default()` makes parameters required in navigation.\n\n**Solution:** Use `.optional()` for truly optional parameters:\n\n```tsx\nconst schema = z.object({\n  // Required with default (navigation can omit, but always present in component)\n  page: fallback(z.number(), 1).default(1),\n\n  // Truly optional (can be undefined in component)\n  searchTerm: z.string().optional(),\n})\n```\n\n### Problem: Complex Objects Not Validating\n\n**Cause:** Nested objects need explicit schema definition.\n\n**Solution:** Define complete nested schemas:\n\n```tsx\nconst schema = z.object({\n  filters: fallback(\n    z.object({\n      status: z.enum(['active', 'inactive']).optional(),\n      tags: z.string().array().optional(),\n      dateRange: z\n        .object({\n          start: z.string().pipe(z.coerce.date()),\n          end: z.string().pipe(z.coerce.date()),\n        })\n        .optional(),\n    }),\n    {},\n  ).default({}),\n})\n```\n\n## Common Next Steps\n\nAfter setting up basic search parameters, you might want to:\n\n- [Validate Search Parameters with Schemas](./validate-search-params.md) - Add robust validation with Zod, Valibot, or ArkType\n- [Navigate with Search Parameters](./navigate-with-search-params.md) - Learn to update search params with Links and navigation\n- [Work with Arrays, Objects, and Dates](./arrays-objects-dates-search-params.md) - Handle arrays, objects, dates, and nested data structures\n\n## Related Resources\n\n- **Validation Libraries:**\n  - [Zod Documentation](https://zod.dev/) - Complete validation library reference\n  - [Valibot Documentation](https://valibot.dev/) - Lightweight validation library\n  - [Yup Documentation](https://github.com/jquense/yup) - Object schema validation\n- **TanStack Router:**\n  - [TanStack Zod Adapter](https://tanstack.com/router/latest/docs/framework/react/api/router/zodValidator) - Official Zod adapter\n  - [TanStack Valibot Adapter](https://tanstack.com/router/latest/docs/framework/react/api/router/valibotValidator) - Official Valibot adapter\n  - [Search Parameters Guide](../guide/search-params.md) - Comprehensive search parameters documentation\n  - [Type Safety Guide](../guide/type-safety.md) - Understanding TanStack Router's type safety\n"
  },
  {
    "path": "docs/router/how-to/setup-rbac.md",
    "content": "---\ntitle: How to Set Up Role-Based Access Control\n---\n\nThis guide covers implementing role-based access control (RBAC) and permission-based routing in TanStack Router applications.\n\n## Quick Start\n\nExtend your authentication context to include roles and permissions, create role-protected layout routes, and use `beforeLoad` to check user permissions before rendering routes.\n\n---\n\n## Extend Authentication Context\n\n### 1. Add Roles to User Type\n\nUpdate your authentication context to include roles:\n\n```tsx\n// src/auth.tsx\nimport React, { createContext, useContext, useState } from 'react'\n\ninterface User {\n  id: string\n  username: string\n  email: string\n  roles: string[]\n  permissions: string[]\n}\n\ninterface AuthState {\n  isAuthenticated: boolean\n  user: User | null\n  hasRole: (role: string) => boolean\n  hasAnyRole: (roles: string[]) => boolean\n  hasPermission: (permission: string) => boolean\n  hasAnyPermission: (permissions: string[]) => boolean\n  login: (username: string, password: string) => Promise<void>\n  logout: () => void\n}\n\nconst AuthContext = createContext<AuthState | undefined>(undefined)\n\nexport function AuthProvider({ children }: { children: React.ReactNode }) {\n  const [user, setUser] = useState<User | null>(null)\n  const [isAuthenticated, setIsAuthenticated] = useState(false)\n\n  const hasRole = (role: string) => {\n    return user?.roles.includes(role) ?? false\n  }\n\n  const hasAnyRole = (roles: string[]) => {\n    return roles.some((role) => user?.roles.includes(role)) ?? false\n  }\n\n  const hasPermission = (permission: string) => {\n    return user?.permissions.includes(permission) ?? false\n  }\n\n  const hasAnyPermission = (permissions: string[]) => {\n    return (\n      permissions.some((permission) =>\n        user?.permissions.includes(permission),\n      ) ?? false\n    )\n  }\n\n  const login = async (username: string, password: string) => {\n    const response = await fetch('/api/login', {\n      method: 'POST',\n      headers: { 'Content-Type': 'application/json' },\n      body: JSON.stringify({ username, password }),\n    })\n\n    if (response.ok) {\n      const userData = await response.json()\n      setUser(userData)\n      setIsAuthenticated(true)\n    } else {\n      throw new Error('Authentication failed')\n    }\n  }\n\n  const logout = () => {\n    setUser(null)\n    setIsAuthenticated(false)\n  }\n\n  return (\n    <AuthContext.Provider\n      value={{\n        isAuthenticated,\n        user,\n        hasRole,\n        hasAnyRole,\n        hasPermission,\n        hasAnyPermission,\n        login,\n        logout,\n      }}\n    >\n      {children}\n    </AuthContext.Provider>\n  )\n}\n\nexport function useAuth() {\n  const context = useContext(AuthContext)\n  if (context === undefined) {\n    throw new Error('useAuth must be used within an AuthProvider')\n  }\n  return context\n}\n```\n\n### 2. Update Router Context Types\n\nUpdate `src/routes/__root.tsx`:\n\n```tsx\nimport { createRootRouteWithContext, Outlet } from '@tanstack/react-router'\n\ninterface AuthState {\n  isAuthenticated: boolean\n  user: {\n    id: string\n    username: string\n    email: string\n    roles: string[]\n    permissions: string[]\n  } | null\n  hasRole: (role: string) => boolean\n  hasAnyRole: (roles: string[]) => boolean\n  hasPermission: (permission: string) => boolean\n  hasAnyPermission: (permissions: string[]) => boolean\n  login: (username: string, password: string) => Promise<void>\n  logout: () => void\n}\n\ninterface MyRouterContext {\n  auth: AuthState\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => (\n    <div>\n      <Outlet />\n    </div>\n  ),\n})\n```\n\n---\n\n## Create Role-Protected Routes\n\n### 1. Admin-Only Routes\n\nCreate `src/routes/_authenticated/_admin.tsx`:\n\n```tsx\nimport { createFileRoute, redirect, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_admin')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.hasRole('admin')) {\n      throw redirect({\n        to: '/unauthorized',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n  },\n  component: AdminLayout,\n})\n\nfunction AdminLayout() {\n  return (\n    <div>\n      <div className=\"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4\">\n        <strong>Admin Area:</strong> You have administrative privileges.\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n### 2. Multiple Role Access\n\nCreate `src/routes/_authenticated/_moderator.tsx`:\n\n```tsx\nimport { createFileRoute, redirect, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_moderator')({\n  beforeLoad: ({ context, location }) => {\n    const allowedRoles = ['admin', 'moderator']\n    if (!context.auth.hasAnyRole(allowedRoles)) {\n      throw redirect({\n        to: '/unauthorized',\n        search: {\n          redirect: location.href,\n          reason: 'insufficient_role',\n        },\n      })\n    }\n  },\n  component: ModeratorLayout,\n})\n\nfunction ModeratorLayout() {\n  const { auth } = Route.useRouteContext()\n\n  return (\n    <div>\n      <div className=\"bg-blue-100 border border-blue-400 text-blue-700 px-4 py-3 rounded mb-4\">\n        <strong>Moderator Area:</strong> Role: {auth.user?.roles.join(', ')}\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n### 3. Permission-Based Routes\n\nCreate `src/routes/_authenticated/_users.tsx`:\n\n```tsx\nimport { createFileRoute, redirect, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_users')({\n  beforeLoad: ({ context, location }) => {\n    const requiredPermissions = ['users:read', 'users:write']\n    if (!context.auth.hasAnyPermission(requiredPermissions)) {\n      throw redirect({\n        to: '/unauthorized',\n        search: {\n          redirect: location.href,\n          reason: 'insufficient_permissions',\n        },\n      })\n    }\n  },\n  component: () => <Outlet />,\n})\n```\n\n---\n\n## Create Specific Protected Pages\n\n### 1. Admin Dashboard\n\nCreate `src/routes/_authenticated/_admin/dashboard.tsx`:\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_admin/dashboard')({\n  component: AdminDashboard,\n})\n\nfunction AdminDashboard() {\n  const { auth } = Route.useRouteContext()\n\n  return (\n    <div className=\"p-6\">\n      <h1 className=\"text-3xl font-bold mb-6\">Admin Dashboard</h1>\n\n      <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6\">\n        <div className=\"bg-white p-6 rounded-lg shadow\">\n          <h2 className=\"text-xl font-semibold mb-2\">User Management</h2>\n          <p className=\"text-gray-600\">Manage all users in the system</p>\n          <button className=\"mt-4 bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700\">\n            View Users\n          </button>\n        </div>\n\n        <div className=\"bg-white p-6 rounded-lg shadow\">\n          <h2 className=\"text-xl font-semibold mb-2\">System Settings</h2>\n          <p className=\"text-gray-600\">Configure system-wide settings</p>\n          <button className=\"mt-4 bg-green-600 text-white px-4 py-2 rounded hover:bg-green-700\">\n            Open Settings\n          </button>\n        </div>\n\n        <div className=\"bg-white p-6 rounded-lg shadow\">\n          <h2 className=\"text-xl font-semibold mb-2\">Reports</h2>\n          <p className=\"text-gray-600\">View system reports and analytics</p>\n          <button className=\"mt-4 bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700\">\n            View Reports\n          </button>\n        </div>\n      </div>\n\n      <div className=\"mt-8 bg-gray-100 p-4 rounded\">\n        <h3 className=\"font-semibold\">Your Info:</h3>\n        <p>Username: {auth.user?.username}</p>\n        <p>Roles: {auth.user?.roles.join(', ')}</p>\n        <p>Permissions: {auth.user?.permissions.join(', ')}</p>\n      </div>\n    </div>\n  )\n}\n```\n\n### 2. User Management Page\n\nCreate `src/routes/_authenticated/_users/manage.tsx`:\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_users/manage')({\n  beforeLoad: ({ context }) => {\n    // Additional permission check at the page level\n    if (!context.auth.hasPermission('users:write')) {\n      throw new Error('You need write permissions to manage users')\n    }\n  },\n  component: UserManagement,\n})\n\nfunction UserManagement() {\n  const { auth } = Route.useRouteContext()\n\n  const canEdit = auth.hasPermission('users:write')\n  const canDelete = auth.hasPermission('users:delete')\n\n  return (\n    <div className=\"p-6\">\n      <h1 className=\"text-3xl font-bold mb-6\">User Management</h1>\n\n      <div className=\"bg-white rounded-lg shadow overflow-hidden\">\n        <table className=\"min-w-full\">\n          <thead className=\"bg-gray-50\">\n            <tr>\n              <th className=\"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase\">\n                Name\n              </th>\n              <th className=\"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase\">\n                Email\n              </th>\n              <th className=\"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase\">\n                Role\n              </th>\n              <th className=\"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase\">\n                Actions\n              </th>\n            </tr>\n          </thead>\n          <tbody className=\"divide-y divide-gray-200\">\n            <tr>\n              <td className=\"px-6 py-4 whitespace-nowrap\">John Doe</td>\n              <td className=\"px-6 py-4 whitespace-nowrap\">john@example.com</td>\n              <td className=\"px-6 py-4 whitespace-nowrap\">\n                <span className=\"inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800\">\n                  User\n                </span>\n              </td>\n              <td className=\"px-6 py-4 whitespace-nowrap text-sm\">\n                {canEdit && (\n                  <button className=\"text-blue-600 hover:text-blue-900 mr-4\">\n                    Edit\n                  </button>\n                )}\n                {canDelete && (\n                  <button className=\"text-red-600 hover:text-red-900\">\n                    Delete\n                  </button>\n                )}\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </div>\n\n      <div className=\"mt-6 p-4 bg-blue-50 rounded\">\n        <h3 className=\"font-semibold text-blue-800\">Your Permissions:</h3>\n        <ul className=\"text-blue-700 text-sm\">\n          {auth.user?.permissions.map((permission) => (\n            <li key={permission}>✓ {permission}</li>\n          ))}\n        </ul>\n      </div>\n    </div>\n  )\n}\n```\n\n---\n\n## Create Unauthorized Page\n\nCreate `src/routes/unauthorized.tsx`:\n\n```tsx\nimport { createFileRoute, Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/unauthorized')({\n  validateSearch: (search) => ({\n    redirect: (search.redirect as string) || '/dashboard',\n    reason: (search.reason as string) || 'insufficient_permissions',\n  }),\n  component: UnauthorizedPage,\n})\n\nfunction UnauthorizedPage() {\n  const { redirect, reason } = Route.useSearch()\n  const { auth } = Route.useRouteContext()\n\n  const reasonMessages = {\n    insufficient_role: 'You do not have the required role to access this page.',\n    insufficient_permissions:\n      'You do not have the required permissions to access this page.',\n    default: 'You are not authorized to access this page.',\n  }\n\n  const message =\n    reasonMessages[reason as keyof typeof reasonMessages] ||\n    reasonMessages.default\n\n  return (\n    <div className=\"min-h-screen flex items-center justify-center bg-gray-50\">\n      <div className=\"max-w-md w-full bg-white shadow-lg rounded-lg p-8 text-center\">\n        <div className=\"mb-6\">\n          <div className=\"mx-auto w-16 h-16 bg-red-100 rounded-full flex items-center justify-center\">\n            <svg\n              className=\"w-8 h-8 text-red-600\"\n              fill=\"none\"\n              stroke=\"currentColor\"\n              viewBox=\"0 0 24 24\"\n            >\n              <path\n                strokeLinecap=\"round\"\n                strokeLinejoin=\"round\"\n                strokeWidth={2}\n                d=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z\"\n              />\n            </svg>\n          </div>\n        </div>\n\n        <h1 className=\"text-2xl font-bold text-gray-900 mb-4\">Access Denied</h1>\n        <p className=\"text-gray-600 mb-6\">{message}</p>\n\n        <div className=\"mb-6 text-sm text-gray-500\">\n          <p>\n            <strong>Your roles:</strong> {auth.user?.roles.join(', ') || 'None'}\n          </p>\n          <p>\n            <strong>Your permissions:</strong>{' '}\n            {auth.user?.permissions.join(', ') || 'None'}\n          </p>\n        </div>\n\n        <div className=\"space-y-3\">\n          <Link\n            to=\"/dashboard\"\n            className=\"block w-full bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700 transition-colors\"\n          >\n            Go to Dashboard\n          </Link>\n\n          <Link\n            to={redirect}\n            className=\"block w-full bg-gray-200 text-gray-800 py-2 px-4 rounded hover:bg-gray-300 transition-colors\"\n          >\n            Try Again\n          </Link>\n        </div>\n      </div>\n    </div>\n  )\n}\n```\n\n---\n\n## Component-Level Permission Checks\n\n### 1. Conditional Rendering Hook\n\nCreate `src/hooks/usePermissions.ts`:\n\n```tsx\nimport { useRouter } from '@tanstack/react-router'\n\nexport function usePermissions() {\n  const router = useRouter()\n  const auth = router.options.context.auth\n\n  return {\n    hasRole: auth.hasRole,\n    hasAnyRole: auth.hasAnyRole,\n    hasPermission: auth.hasPermission,\n    hasAnyPermission: auth.hasAnyPermission,\n    user: auth.user,\n  }\n}\n```\n\n### 2. Permission Guard Component\n\nCreate `src/components/PermissionGuard.tsx`:\n\n```tsx\ninterface PermissionGuardProps {\n  children: React.ReactNode\n  roles?: string[]\n  permissions?: string[]\n  requireAll?: boolean\n  fallback?: React.ReactNode\n}\n\nexport function PermissionGuard({\n  children,\n  roles = [],\n  permissions = [],\n  requireAll = false,\n  fallback = null,\n}: PermissionGuardProps) {\n  const { hasAnyRole, hasAnyPermission, hasRole, hasPermission } =\n    usePermissions()\n\n  const hasRequiredRoles =\n    roles.length === 0 ||\n    (requireAll ? roles.every((role) => hasRole(role)) : hasAnyRole(roles))\n\n  const hasRequiredPermissions =\n    permissions.length === 0 ||\n    (requireAll\n      ? permissions.every((permission) => hasPermission(permission))\n      : hasAnyPermission(permissions))\n\n  if (hasRequiredRoles && hasRequiredPermissions) {\n    return <>{children}</>\n  }\n\n  return <>{fallback}</>\n}\n```\n\n### 3. Using Permission Guards\n\n```tsx\nimport { PermissionGuard } from '../components/PermissionGuard'\n\nfunction SomeComponent() {\n  return (\n    <div>\n      <h1>Dashboard</h1>\n\n      <PermissionGuard roles={['admin']}>\n        <button className=\"bg-red-600 text-white px-4 py-2 rounded\">\n          Admin Only Button\n        </button>\n      </PermissionGuard>\n\n      <PermissionGuard\n        permissions={['users:write']}\n        fallback={<p className=\"text-gray-500\">You cannot edit users</p>}\n      >\n        <button className=\"bg-blue-600 text-white px-4 py-2 rounded\">\n          Edit Users\n        </button>\n      </PermissionGuard>\n\n      <PermissionGuard\n        roles={['admin', 'moderator']}\n        permissions={['content:moderate']}\n        requireAll={true}\n      >\n        <button className=\"bg-yellow-600 text-white px-4 py-2 rounded\">\n          Moderate Content (Admin/Mod + Permission)\n        </button>\n      </PermissionGuard>\n    </div>\n  )\n}\n```\n\n---\n\n## Advanced Permission Patterns\n\n### 1. Resource-Based Permissions\n\n```tsx\n// Check if user can edit a specific resource\nfunction canEditResource(auth: AuthState, resourceId: string, ownerId: string) {\n  // Admin can edit anything\n  if (auth.hasRole('admin')) return true\n\n  // Owner can edit their own resources\n  if (auth.user?.id === ownerId && auth.hasPermission('resource:edit:own'))\n    return true\n\n  // Moderators can edit with permission\n  if (auth.hasRole('moderator') && auth.hasPermission('resource:edit:any'))\n    return true\n\n  return false\n}\n\n// Usage in component\nfunction ResourceEditor({ resource }) {\n  const { auth } = Route.useRouteContext()\n\n  if (!canEditResource(auth, resource.id, resource.ownerId)) {\n    return <div>You cannot edit this resource</div>\n  }\n\n  return <EditForm resource={resource} />\n}\n```\n\n### 2. Time-Based Permissions\n\n```tsx\nfunction hasTimeBasedPermission(auth: AuthState, permission: string) {\n  const userPermissions = auth.user?.permissions || []\n  const hasPermission = userPermissions.includes(permission)\n\n  // Check if permission has time restrictions\n  const timeRestricted = userPermissions.find((p) =>\n    p.startsWith(`${permission}:time:`),\n  )\n\n  if (timeRestricted) {\n    const [, , startHour, endHour] = timeRestricted.split(':')\n    const currentHour = new Date().getHours()\n    return (\n      currentHour >= parseInt(startHour) && currentHour <= parseInt(endHour)\n    )\n  }\n\n  return hasPermission\n}\n```\n\n---\n\n## Common Problems\n\n### Role/Permission Data Not Loading\n\n**Problem:** User roles/permissions are undefined in routes.\n\n**Solution:** Ensure your authentication API returns complete user data:\n\n```tsx\nconst login = async (username: string, password: string) => {\n  const response = await fetch('/api/login', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({ username, password }),\n  })\n\n  if (response.ok) {\n    const userData = await response.json()\n    // Ensure userData includes roles and permissions\n    console.log('User data:', userData) // Debug log\n    setUser(userData)\n    setIsAuthenticated(true)\n  }\n}\n```\n\n### Permission Checks Too Restrictive\n\n**Problem:** Users locked out of areas they should access.\n\n**Solution:** Use hierarchical permissions and role inheritance:\n\n```tsx\nconst roleHierarchy = {\n  admin: ['admin', 'moderator', 'user'],\n  moderator: ['moderator', 'user'],\n  user: ['user'],\n}\n\nconst hasRole = (requiredRole: string) => {\n  const userRoles = user?.roles || []\n  return userRoles.some((userRole) =>\n    roleHierarchy[userRole]?.includes(requiredRole),\n  )\n}\n```\n\n### Performance Issues with Many Permission Checks\n\n**Problem:** Too many permission checks slowing down renders.\n\n**Solution:** Memoize permission computations:\n\n```tsx\nimport { useMemo } from 'react'\n\nfunction usePermissions() {\n  const { auth } = Route.useRouteContext()\n\n  const permissions = useMemo(\n    () => ({\n      canEditUsers: auth.hasPermission('users:write'),\n      canDeleteUsers: auth.hasPermission('users:delete'),\n      isAdmin: auth.hasRole('admin'),\n      isModerator: auth.hasAnyRole(['admin', 'moderator']),\n    }),\n    [auth.user?.roles, auth.user?.permissions],\n  )\n\n  return permissions\n}\n```\n\n---\n\n## Common Next Steps\n\nAfter setting up RBAC, you might want to:\n\n- [How to Set Up Basic Authentication](./setup-authentication.md) - Core auth implementation\n- [How to Integrate Authentication Providers](./setup-auth-providers.md) - Use external auth services\n\n<!-- TODO: Uncomment as how-to guides are created\n- [How to Implement Dynamic Permissions](./setup-dynamic-permissions.md)\n- [How to Audit User Actions](./setup-audit-logging.md)\n-->\n\n## Related Resources\n\n- [Authenticated Routes Guide](../guide/authenticated-routes.md) - Core authentication concepts\n- [Router Context Guide](../guide/router-context.md) - Understanding router context\n- [RBAC Best Practices](https://auth0.com/docs/manage-users/access-control/rbac) - General RBAC principles\n"
  },
  {
    "path": "docs/router/how-to/setup-ssr.md",
    "content": "---\ntitle: How to Set Up Server-Side Rendering (SSR)\n---\n\n> [!IMPORTANT]\n> **[TanStack Start](/start/latest/docs/framework/react/overview) is the recommended way to set up SSR** - it provides SSR, streaming, and deployment with zero configuration.\n\n> Use the manual setup below only if you need to integrate with an existing server.\n\n## Quick Start with TanStack Start\n\n```bash\nnpx create-tsrouter-app@latest my-app --template start\ncd my-app\nnpm run dev\n```\n\n## Manual SSR Setup\n\n### 1. Install Dependencies\n\n```bash\nnpm install express compression\nnpm install --save-dev @types/express\n```\n\n### 2. Create Shared Router Configuration\n\n```tsx\n// src/router.tsx\nimport { createRouter as createTanstackRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function createRouter() {\n  return createTanstackRouter({\n    routeTree,\n    context: {\n      head: '', // For server-side head injection\n    },\n    defaultPreload: 'intent',\n  })\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n```\n\n### 3. Set Up Server Entry Point\n\n```tsx\n// src/entry-server.tsx\nimport { pipeline } from 'node:stream/promises'\nimport {\n  RouterServer,\n  createRequestHandler,\n  renderRouterToString,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\nimport type express from 'express'\n\nexport async function render({\n  req,\n  res,\n  head = '',\n}: {\n  head?: string\n  req: express.Request\n  res: express.Response\n}) {\n  // Convert Express request to Web API Request\n  const url = new URL(req.originalUrl || req.url, 'https://localhost:3000').href\n\n  const request = new Request(url, {\n    method: req.method,\n    headers: (() => {\n      const headers = new Headers()\n      for (const [key, value] of Object.entries(req.headers)) {\n        headers.set(key, value as any)\n      }\n      return headers\n    })(),\n  })\n\n  // Create request handler\n  const handler = createRequestHandler({\n    request,\n    createRouter: () => {\n      const router = createRouter()\n\n      // Inject server context (like head tags from Vite)\n      router.update({\n        context: {\n          ...router.options.context,\n          head: head,\n        },\n      })\n      return router\n    },\n  })\n\n  // Render to string (non-streaming)\n  const response = await handler(({ responseHeaders, router }) =>\n    renderRouterToString({\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n\n  // Convert Web API Response back to Express response\n  res.statusMessage = response.statusText\n  res.status(response.status)\n\n  response.headers.forEach((value, name) => {\n    res.setHeader(name, value)\n  })\n\n  // Stream response body\n  return pipeline(response.body as any, res)\n}\n```\n\n### 4. Set Up Client Entry Point\n\n```tsx\n// src/entry-client.tsx\nimport { hydrateRoot } from 'react-dom/client'\nimport { RouterClient } from '@tanstack/react-router/ssr/client'\nimport { createRouter } from './router'\n\nconst router = createRouter()\n\nhydrateRoot(document, <RouterClient router={router} />)\n```\n\n### 5. Configure Vite for SSR\n\n```ts\n// vite.config.ts\nimport path from 'node:path'\nimport url from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig(({ isSsrBuild }) => ({\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n  build: isSsrBuild\n    ? {\n        // SSR build configuration\n        ssr: true,\n        outDir: 'dist/server',\n        emitAssets: true,\n        copyPublicDir: false,\n        rolldownOptions: {\n          input: path.resolve(__dirname, 'src/entry-server.tsx'),\n          output: {\n            entryFileNames: '[name].js',\n            chunkFileNames: 'assets/[name]-[hash].js',\n            assetFileNames: 'assets/[name]-[hash][extname]',\n          },\n        },\n      }\n    : {\n        // Client build configuration\n        outDir: 'dist/client',\n        emitAssets: true,\n        copyPublicDir: true,\n        rolldownOptions: {\n          input: path.resolve(__dirname, 'src/entry-client.tsx'),\n          output: {\n            entryFileNames: '[name].js',\n            chunkFileNames: 'assets/[name]-[hash].js',\n            assetFileNames: 'assets/[name]-[hash][extname]',\n          },\n        },\n      },\n}))\n```\n\n### 6. Update Root Route for HTML Structure\n\n```tsx\n// src/routes/__root.tsx\nimport {\n  HeadContent,\n  Outlet,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\ninterface RouterContext {\n  head: string\n}\n\nexport const Route = createRootRouteWithContext<RouterContext>()({\n  head: () => ({\n    links: [\n      { rel: 'icon', href: '/favicon.ico' },\n      { rel: 'apple-touch-icon', href: '/logo192.png' },\n      { rel: 'manifest', href: '/manifest.json' },\n    ],\n    meta: [\n      {\n        charSet: 'UTF-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1.0',\n      },\n      {\n        title: 'TanStack Router SSR App',\n      },\n    ],\n    scripts: [\n      // Development scripts\n      ...(!import.meta.env.PROD\n        ? [\n            {\n              type: 'module',\n              children: `import RefreshRuntime from \"/@react-refresh\"\n                RefreshRuntime.injectIntoGlobalHook(window)\n                window.$RefreshReg$ = () => {}\n                window.$RefreshSig$ = () => (type) => type\n                window.__vite_plugin_react_preamble_installed__ = true`,\n            },\n            {\n              type: 'module',\n              src: '/@vite/client',\n            },\n          ]\n        : []),\n      // Entry script\n      {\n        type: 'module',\n        src: import.meta.env.PROD\n          ? '/entry-client.js'\n          : '/src/entry-client.tsx',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html lang=\"en\">\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <TanStackRouterDevtools />\n      </body>\n    </html>\n  )\n}\n```\n\n### 7. Create Express Server\n\n```js\n// server.js\nimport path from 'node:path'\nimport express from 'express'\nimport compression from 'compression'\n\nconst isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD\n\nexport async function createServer(\n  root = process.cwd(),\n  isProd = process.env.NODE_ENV === 'production',\n  hmrPort = process.env.VITE_DEV_SERVER_PORT,\n) {\n  const app = express()\n\n  let vite\n  if (!isProd) {\n    // Development mode with Vite middleware\n    vite = await (\n      await import('vite')\n    ).createServer({\n      root,\n      logLevel: isTest ? 'error' : 'info',\n      server: {\n        middlewareMode: true,\n        watch: {\n          usePolling: true,\n          interval: 100,\n        },\n        hmr: {\n          port: hmrPort,\n        },\n      },\n      appType: 'custom',\n    })\n    app.use(vite.middlewares)\n  } else {\n    // Production mode\n    app.use(compression())\n    app.use(express.static('./dist/client'))\n  }\n\n  app.use('*', async (req, res) => {\n    try {\n      const url = req.originalUrl\n\n      // Check for static assets\n      if (path.extname(url) !== '') {\n        console.warn(`${url} is not a valid router path`)\n        res.status(404).end(`${url} is not a valid router path`)\n        return\n      }\n\n      // Extract head content from Vite in development\n      let viteHead = ''\n      if (!isProd) {\n        const transformedHtml = await vite.transformIndexHtml(\n          url,\n          `<html><head></head><body></body></html>`,\n        )\n        viteHead = transformedHtml.substring(\n          transformedHtml.indexOf('<head>') + 6,\n          transformedHtml.indexOf('</head>'),\n        )\n      }\n\n      // Load server entry\n      const entry = await (async () => {\n        if (!isProd) {\n          return vite.ssrLoadModule('/src/entry-server.tsx')\n        } else {\n          return import('./dist/server/entry-server.js')\n        }\n      })()\n\n      console.info('Rendering:', url)\n      await entry.render({ req, res, head: viteHead })\n    } catch (e) {\n      !isProd && vite.ssrFixStacktrace(e)\n      console.error(e.stack)\n      res.status(500).end(e.stack)\n    }\n  })\n\n  return { app, vite }\n}\n\nif (!isTest) {\n  createServer().then(({ app }) =>\n    app.listen(3000, () => {\n      console.info('Server running at http://localhost:3000')\n    }),\n  )\n}\n```\n\n### 8. Update Package Scripts\n\n```json\n{\n  \"scripts\": {\n    \"dev\": \"node server.js\",\n    \"build\": \"npm run build:client && npm run build:server\",\n    \"build:client\": \"vite build\",\n    \"build:server\": \"vite build --ssr\",\n    \"start\": \"NODE_ENV=production node server.js\"\n  }\n}\n```\n\n## Streaming SSR\n\nFor better performance, enable streaming SSR by replacing `renderRouterToString` with `renderRouterToStream`:\n\n```tsx\n// src/entry-server.tsx\nimport { renderRouterToStream } from '@tanstack/react-router/ssr/server'\n\n// Replace renderRouterToString with:\nconst response = await handler(({ request, responseHeaders, router }) =>\n  renderRouterToStream({\n    request,\n    responseHeaders,\n    router,\n    children: <RouterServer router={router} />,\n  }),\n)\n```\n\n### Streaming Vite Configuration\n\nFor streaming SSR, update your Vite config:\n\n```ts\n// vite.config.ts\nexport default defineConfig(({ isSsrBuild }) => ({\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true,\n      enableStreaming: true, // Enable streaming support\n    }),\n    react(),\n  ],\n  // ... rest of config\n  ssr: {\n    optimizeDeps: {\n      include: ['@tanstack/react-router/ssr/server'],\n    },\n  },\n}))\n```\n\n## Common Problems\n\n> [!TIP]\n> **Most of these problems are automatically solved by [TanStack Start](/start/latest/docs/framework/react/overview).** The issues below are primarily relevant for manual SSR setups.\n\n### React Import Errors\n\n**Problem:** `ReferenceError: React is not defined` during SSR\n\n**Solution:** Ensure React is properly imported in components:\n\n```tsx\n// In your route components\nimport React from 'react' // Add explicit import\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello World</div>, // React is now available\n})\n```\n\n### Hydration Mismatches\n\n**Problem:** Client HTML doesn't match server HTML\n\n**Solution:** Ensure consistent rendering between server and client:\n\n```tsx\n// Use useIsomorphicLayoutEffect for browser-only effects\nimport { useLayoutEffect, useEffect } from 'react'\n\nconst useIsomorphicLayoutEffect =\n  typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\nfunction MyComponent() {\n  useIsomorphicLayoutEffect(() => {\n    // Browser-only code that won't cause hydration mismatches\n  }, [])\n}\n```\n\n### Bun Runtime Issues\n\n**Problem:** `Cannot find module \"react-dom/server\"` with Bun\n\n**Solution:** Use Node.js compatibility or create Bun-specific builds:\n\n```json\n{\n  \"scripts\": {\n    \"build:bun\": \"bun build --target=bun --outdir=dist/bun src/entry-server.tsx\"\n  }\n}\n```\n\n### Module Resolution Errors\n\n**Problem:** SSR modules not resolving correctly\n\n**Solution:** Configure Vite SSR externals:\n\n```ts\n// vite.config.ts\nexport default defineConfig({\n  ssr: {\n    noExternal: [\n      // Packages that need to be bundled for SSR\n      '@tanstack/react-router',\n    ],\n    external: [\n      // Packages that should remain external\n      'express',\n    ],\n  },\n})\n```\n\n### Streaming Configuration Issues\n\n**Problem:** Streaming SSR not working with existing Vite setup\n\n**Solution:** Ensure proper streaming configuration:\n\n```ts\n// vite.config.ts - Additional streaming config\nexport default defineConfig({\n  define: {\n    'process.env.STREAMING_SSR': JSON.stringify(true),\n  },\n  optimizeDeps: {\n    include: ['@tanstack/react-router/ssr/server'],\n  },\n})\n```\n\n### Build Output Issues\n\n**Problem:** Server build missing assets or incorrect paths\n\n**Solution:** Verify build configuration:\n\n```ts\n// vite.config.ts\nconst ssrConfig = {\n  ssr: true,\n  outDir: 'dist/server',\n  ssrEmitAssets: true, // Important for asset handling\n  copyPublicDir: false,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-server.tsx'),\n    external: ['express', 'compression'], // External deps\n  },\n}\n```\n\n## Related Resources\n\n- [TanStack Start](/start/latest/docs/framework/react/overview) - **Recommended full-stack React framework with SSR**\n- [SSR Guide (Detailed)](../guide/ssr.md) - Comprehensive SSR concepts, utilities, and theory\n- [Data Loading](../guide/data-loading.md) - SSR-compatible data loading patterns\n\n## Common Next Steps\n\n- [Deploy to Production](./deploy-to-production.md) - Deploy your SSR app\n- [Setup Authentication](./setup-authentication.md) - Add auth to SSR routes\n- [Debug Router Issues](./debug-router-issues.md) - Troubleshoot SSR-specific routing problems\n\n<!-- TODO: Uncomment as guides are created\n- [Fix Build Issues](./fix-build-issues.md) - Troubleshoot bundler problems\n-->\n"
  },
  {
    "path": "docs/router/how-to/setup-testing.md",
    "content": "# How to Set Up Testing with Code-Based Routing\n\nThis guide covers setting up comprehensive testing for TanStack Router applications that use code-based routing, including unit tests, integration tests, and end-to-end testing strategies.\n\n## Quick Start\n\nSet up testing by configuring your test framework (Vitest/Jest), creating router test utilities, and implementing patterns for testing navigation, route components, and data loading with manually defined routes.\n\n> **Using File-Based Routing?** See [How to Test File-Based Routing](./test-file-based-routing.md) for patterns specific to file-based routing applications.\n\n---\n\n## Configure Test Framework\n\n### 1. Install Dependencies\n\nFor **Vitest** (recommended):\n\n```bash\nnpm install -D vitest @testing-library/react @testing-library/jest-dom @testing-library/user-event jsdom\n```\n\nFor **Jest**:\n\n```bash\nnpm install -D jest @testing-library/react @testing-library/jest-dom @testing-library/user-event jest-environment-jsdom\n```\n\n### 2. Configure Vitest\n\nCreate `vitest.config.ts`:\n\n```ts\nimport { defineConfig } from 'vitest/config'\nimport react from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [react()],\n  test: {\n    environment: 'jsdom',\n    setupFiles: ['./src/test/setup.ts'],\n    typecheck: { enabled: true },\n    watch: false,\n  },\n})\n```\n\n### 3. Create Test Setup\n\nCreate `src/test/setup.ts`:\n\n```ts\nimport '@testing-library/jest-dom/vitest'\n\n// @ts-expect-error\nglobal.IS_REACT_ACT_ENVIRONMENT = true\n```\n\n---\n\n## Code-Based Router Testing Patterns\n\nThe following patterns are specifically designed for applications using code-based routing where you manually create routes with `createRoute()` and build route trees programmatically.\n\n### 1. TanStack Router Internal Pattern (Recommended)\n\nThe TanStack Router team uses this pattern internally for testing router components:\n\n```tsx\nimport { beforeEach, afterEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, render, screen } from '@testing-library/react'\nimport {\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport type { RouterHistory } from '@tanstack/react-router'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  cleanup()\n})\n\ndescribe('Router Component Testing', () => {\n  test('should render route component', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <h1>IndexTitle</h1>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    expect(await screen.findByText('IndexTitle')).toBeInTheDocument()\n  })\n})\n```\n\n### 2. Alternative: Router Test Utilities (For Simpler Cases)\n\nCreate `src/test/router-utils.tsx`:\n\n```tsx\nimport React from 'react'\nimport { render, RenderOptions } from '@testing-library/react'\nimport {\n  createRouter,\n  createRootRoute,\n  createRoute,\n  RouterProvider,\n  Outlet,\n} from '@tanstack/react-router'\nimport { createMemoryHistory } from '@tanstack/react-router'\n\n// Create a root route for testing\nconst rootRoute = createRootRoute({\n  component: () => <Outlet />,\n})\n\n// Test router factory\nexport function createTestRouter(routes: any[], initialLocation = '/') {\n  const routeTree = rootRoute.addChildren(routes)\n\n  const router = createRouter({\n    routeTree,\n    history: createMemoryHistory({\n      initialEntries: [initialLocation],\n    }),\n  })\n\n  return router\n}\n\n// Wrapper component for testing\ninterface RouterWrapperProps {\n  children: React.ReactNode\n  router: any\n}\n\nfunction RouterWrapper({ children, router }: RouterWrapperProps) {\n  return <RouterProvider router={router}>{children}</RouterProvider>\n}\n\n// Custom render function with router\ninterface RenderWithRouterOptions extends Omit<RenderOptions, 'wrapper'> {\n  router?: any\n  initialLocation?: string\n  routes?: any[]\n}\n\nexport function renderWithRouter(\n  ui: React.ReactElement,\n  {\n    router,\n    initialLocation = '/',\n    routes = [],\n    ...renderOptions\n  }: RenderWithRouterOptions = {},\n) {\n  if (!router && routes.length > 0) {\n    router = createTestRouter(routes, initialLocation)\n  }\n\n  if (!router) {\n    throw new Error(\n      'Router is required. Provide either a router or routes array.',\n    )\n  }\n\n  function Wrapper({ children }: { children: React.ReactNode }) {\n    return <RouterWrapper router={router}>{children}</RouterWrapper>\n  }\n\n  return {\n    ...render(ui, { wrapper: Wrapper, ...renderOptions }),\n    router,\n  }\n}\n```\n\n### 2. Mock Route Factory\n\nCreate `src/test/mock-routes.tsx`:\n\n```tsx\nimport { createRoute } from '@tanstack/react-router'\nimport { rootRoute } from './router-utils'\n\nexport const createMockRoute = (\n  path: string,\n  component: React.ComponentType,\n  options: any = {},\n) => {\n  return createRoute({\n    getParentRoute: () => rootRoute,\n    path,\n    component,\n    ...options,\n  })\n}\n\n// Common test components\nexport function TestComponent({ title = 'Test' }: { title?: string }) {\n  return <div data-testid=\"test-component\">{title}</div>\n}\n\nexport function LoadingComponent() {\n  return <div data-testid=\"loading\">Loading...</div>\n}\n\nexport function ErrorComponent({ error }: { error: Error }) {\n  return <div data-testid=\"error\">Error: {error.message}</div>\n}\n```\n\n---\n\n## Test Code-Based Route Components\n\n### 1. Basic Component Testing\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { createRoute } from '@tanstack/react-router'\nimport {\n  renderWithRouter,\n  rootRoute,\n  TestComponent,\n} from '../test/router-utils'\n\ndescribe('Code-Based Route Component Testing', () => {\n  it('should render route component', () => {\n    const testRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: TestComponent,\n    })\n\n    renderWithRouter(<div />, {\n      routes: [testRoute],\n      initialLocation: '/',\n    })\n\n    expect(screen.getByTestId('test-component')).toBeInTheDocument()\n  })\n\n  it('should render component with props from route context', () => {\n    function ComponentWithContext() {\n      const { title } = Route.useLoaderData()\n      return <div data-testid=\"context-component\">{title}</div>\n    }\n\n    const contextRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/context',\n      component: ComponentWithContext,\n      loader: () => ({ title: 'From Context' }),\n    })\n\n    renderWithRouter(<div />, {\n      routes: [contextRoute],\n      initialLocation: '/context',\n    })\n\n    expect(screen.getByText('From Context')).toBeInTheDocument()\n  })\n})\n```\n\n### 2. Testing Route Parameters\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { createRoute } from '@tanstack/react-router'\nimport { renderWithRouter, rootRoute } from '../test/router-utils'\n\ndescribe('Route Parameters', () => {\n  it('should handle route params correctly', () => {\n    function UserProfile() {\n      const { userId } = Route.useParams()\n      return <div data-testid=\"user-profile\">User: {userId}</div>\n    }\n\n    const userRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n      component: UserProfile,\n    })\n\n    renderWithRouter(<div />, {\n      routes: [userRoute],\n      initialLocation: '/users/123',\n    })\n\n    expect(screen.getByText('User: 123')).toBeInTheDocument()\n  })\n\n  it('should handle search params correctly', () => {\n    function SearchPage() {\n      const { q, page } = Route.useSearch()\n      return (\n        <div data-testid=\"search-results\">\n          Query: {q}, Page: {page}\n        </div>\n      )\n    }\n\n    const searchRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/search',\n      component: SearchPage,\n      validateSearch: (search) => ({\n        q: (search.q as string) || '',\n        page: Number(search.page) || 1,\n      }),\n    })\n\n    renderWithRouter(<div />, {\n      routes: [searchRoute],\n      initialLocation: '/search?q=react&page=2',\n    })\n\n    expect(screen.getByText('Query: react, Page: 2')).toBeInTheDocument()\n  })\n})\n```\n\n---\n\n## Test Navigation\n\n### 1. Testing Link Components\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen, fireEvent } from '@testing-library/react'\nimport userEvent from '@testing-library/user-event'\nimport { Link, createRoute } from '@tanstack/react-router'\nimport {\n  renderWithRouter,\n  rootRoute,\n  TestComponent,\n} from '../test/router-utils'\n\ndescribe('Code-Based Route Navigation', () => {\n  it('should navigate when link is clicked', async () => {\n    const user = userEvent.setup()\n\n    function HomePage() {\n      return (\n        <div>\n          <h1>Home</h1>\n          <Link to=\"/about\" data-testid=\"about-link\">\n            About\n          </Link>\n        </div>\n      )\n    }\n\n    function AboutPage() {\n      return <h1>About Page</h1>\n    }\n\n    const homeRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: HomePage,\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: AboutPage,\n    })\n\n    const { router } = renderWithRouter(<div />, {\n      routes: [homeRoute, aboutRoute],\n      initialLocation: '/',\n    })\n\n    // Initial state\n    expect(screen.getByText('Home')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/')\n\n    // Click link\n    await user.click(screen.getByTestId('about-link'))\n\n    // Check navigation\n    expect(screen.getByText('About Page')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/about')\n  })\n\n  it('should navigate programmatically', async () => {\n    function NavigationTest() {\n      const navigate = Route.useNavigate()\n\n      const handleNavigate = () => {\n        navigate({ to: '/dashboard', search: { tab: 'settings' } })\n      }\n\n      return (\n        <div>\n          <h1>Navigation Test</h1>\n          <button onClick={handleNavigate} data-testid=\"navigate-btn\">\n            Go to Dashboard\n          </button>\n        </div>\n      )\n    }\n\n    const testRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: NavigationTest,\n    })\n\n    const dashboardRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/dashboard',\n      component: () => <h1>Dashboard</h1>,\n      validateSearch: (search) => ({\n        tab: (search.tab as string) || 'general',\n      }),\n    })\n\n    const { router } = renderWithRouter(<div />, {\n      routes: [testRoute, dashboardRoute],\n      initialLocation: '/',\n    })\n\n    await userEvent.click(screen.getByTestId('navigate-btn'))\n\n    expect(router.state.location.pathname).toBe('/dashboard')\n    expect(router.state.location.search).toEqual({ tab: 'settings' })\n  })\n})\n```\n\n### 2. Testing Route Guards\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { createRoute, redirect } from '@tanstack/react-router'\nimport { renderWithRouter, rootRoute } from '../test/router-utils'\n\ndescribe('Code-Based Route Guards', () => {\n  it('should redirect unauthenticated users', () => {\n    const mockAuth = { isAuthenticated: false }\n\n    function ProtectedPage() {\n      return <h1>Protected Content</h1>\n    }\n\n    function LoginPage() {\n      return <h1>Login Required</h1>\n    }\n\n    const protectedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/protected',\n      component: ProtectedPage,\n      beforeLoad: ({ context }) => {\n        if (!mockAuth.isAuthenticated) {\n          throw redirect({ to: '/login' })\n        }\n      },\n    })\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/login',\n      component: LoginPage,\n    })\n\n    renderWithRouter(<div />, {\n      routes: [protectedRoute, loginRoute],\n      initialLocation: '/protected',\n    })\n\n    // Should redirect to login\n    expect(screen.getByText('Login Required')).toBeInTheDocument()\n  })\n\n  it('should allow authenticated users', () => {\n    const mockAuth = { isAuthenticated: true }\n\n    function ProtectedPage() {\n      return <h1>Protected Content</h1>\n    }\n\n    const protectedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/protected',\n      component: ProtectedPage,\n      beforeLoad: ({ context }) => {\n        if (!mockAuth.isAuthenticated) {\n          throw redirect({ to: '/login' })\n        }\n      },\n    })\n\n    renderWithRouter(<div />, {\n      routes: [protectedRoute],\n      initialLocation: '/protected',\n    })\n\n    expect(screen.getByText('Protected Content')).toBeInTheDocument()\n  })\n})\n```\n\n---\n\n## Test Data Loading\n\n### 1. Testing Loaders\n\n```tsx\nimport { describe, it, expect, vi } from 'vitest'\nimport { screen, waitFor } from '@testing-library/react'\nimport { createRoute } from '@tanstack/react-router'\nimport { renderWithRouter, rootRoute } from '../test/router-utils'\n\ndescribe('Code-Based Route Data Loading', () => {\n  it('should load and display data from loader', async () => {\n    const mockFetchUser = vi.fn().mockResolvedValue({\n      id: 1,\n      name: 'John Doe',\n      email: 'john@example.com',\n    })\n\n    function UserProfile() {\n      const user = Route.useLoaderData()\n      return (\n        <div data-testid=\"user-profile\">\n          <h1>{user.name}</h1>\n          <p>{user.email}</p>\n        </div>\n      )\n    }\n\n    const userRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n      component: UserProfile,\n      loader: ({ params }) => mockFetchUser(params.userId),\n    })\n\n    renderWithRouter(<div />, {\n      routes: [userRoute],\n      initialLocation: '/users/1',\n    })\n\n    await waitFor(() => {\n      expect(screen.getByText('John Doe')).toBeInTheDocument()\n      expect(screen.getByText('john@example.com')).toBeInTheDocument()\n    })\n\n    expect(mockFetchUser).toHaveBeenCalledWith('1')\n  })\n\n  it('should handle loader errors', async () => {\n    const mockFetchUser = vi.fn().mockRejectedValue(new Error('User not found'))\n\n    function UserProfile() {\n      const user = Route.useLoaderData()\n      return <div>{user.name}</div>\n    }\n\n    function ErrorComponent({ error }: { error: Error }) {\n      return <div data-testid=\"error\">Error: {error.message}</div>\n    }\n\n    const userRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n      component: UserProfile,\n      loader: ({ params }) => mockFetchUser(params.userId),\n      errorComponent: ErrorComponent,\n    })\n\n    renderWithRouter(<div />, {\n      routes: [userRoute],\n      initialLocation: '/users/1',\n    })\n\n    await waitFor(() => {\n      expect(screen.getByTestId('error')).toBeInTheDocument()\n      expect(screen.getByText('Error: User not found')).toBeInTheDocument()\n    })\n  })\n})\n```\n\n### 2. Testing with React Query\n\n```tsx\nimport { describe, it, expect, vi } from 'vitest'\nimport { screen, waitFor } from '@testing-library/react'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { createRoute } from '@tanstack/react-router'\nimport { renderWithRouter, rootRoute } from '../test/router-utils'\n\ndescribe('React Query Integration', () => {\n  it('should work with React Query', async () => {\n    const queryClient = new QueryClient({\n      defaultOptions: {\n        queries: {\n          retry: false,\n        },\n      },\n    })\n\n    const mockFetchPosts = vi.fn().mockResolvedValue([\n      { id: 1, title: 'Post 1' },\n      { id: 2, title: 'Post 2' },\n    ])\n\n    function PostsList() {\n      const posts = Route.useLoaderData()\n      return (\n        <div data-testid=\"posts-list\">\n          {posts.map((post: any) => (\n            <div key={post.id}>{post.title}</div>\n          ))}\n        </div>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: PostsList,\n      loader: ({ context: { queryClient } }) =>\n        queryClient.ensureQueryData({\n          queryKey: ['posts'],\n          queryFn: mockFetchPosts,\n        }),\n    })\n\n    function TestWrapper({ children }: { children: React.ReactNode }) {\n      return (\n        <QueryClientProvider client={queryClient}>\n          {children}\n        </QueryClientProvider>\n      )\n    }\n\n    renderWithRouter(<div />, {\n      routes: [postsRoute],\n      initialLocation: '/posts',\n      wrapper: TestWrapper,\n    })\n\n    await waitFor(() => {\n      expect(screen.getByText('Post 1')).toBeInTheDocument()\n      expect(screen.getByText('Post 2')).toBeInTheDocument()\n    })\n  })\n})\n```\n\n---\n\n## Test with Context\n\n### 1. Testing Router Context\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport {\n  createRootRouteWithContext,\n  createRoute,\n  Outlet,\n} from '@tanstack/react-router'\n\ninterface RouterContext {\n  auth: {\n    user: { id: string; name: string } | null\n    isAuthenticated: boolean\n  }\n}\n\ndescribe('Code-Based Router Context', () => {\n  it('should provide context to routes', () => {\n    const rootRouteWithContext = createRootRouteWithContext<RouterContext>()({\n      component: () => <Outlet />,\n    })\n\n    function UserDashboard() {\n      const { auth } = Route.useRouteContext()\n      return (\n        <div data-testid=\"dashboard\">\n          Welcome, {auth.user?.name || 'Guest'}!\n        </div>\n      )\n    }\n\n    const dashboardRoute = createRoute({\n      getParentRoute: () => rootRouteWithContext,\n      path: '/dashboard',\n      component: UserDashboard,\n    })\n\n    const mockContext = {\n      auth: {\n        user: { id: '1', name: 'John Doe' },\n        isAuthenticated: true,\n      },\n    }\n\n    const router = createRouter({\n      routeTree: rootRouteWithContext.addChildren([dashboardRoute]),\n      context: mockContext,\n      history: createMemoryHistory({\n        initialEntries: ['/dashboard'],\n      }),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    expect(screen.getByText('Welcome, John Doe!')).toBeInTheDocument()\n  })\n})\n```\n\n---\n\n## E2E Testing with Playwright\n\n### 1. Playwright Configuration\n\nCreate `playwright.config.ts`:\n\n```ts\nimport { defineConfig, devices } from '@playwright/test'\n\nexport default defineConfig({\n  testDir: './e2e',\n  fullyParallel: true,\n  forbidOnly: !!process.env.CI,\n  retries: process.env.CI ? 2 : 0,\n  workers: process.env.CI ? 1 : undefined,\n  reporter: 'html',\n  use: {\n    baseURL: 'http://localhost:3000',\n    trace: 'on-first-retry',\n  },\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n  webServer: {\n    command: 'npm run dev',\n    url: 'http://localhost:3000',\n    reuseExistingServer: !process.env.CI,\n  },\n})\n```\n\n### 2. E2E Test Example\n\nCreate `e2e/navigation.spec.ts`:\n\n```ts\nimport { test, expect } from '@playwright/test'\n\ntest.describe('Code-Based Router Navigation', () => {\n  test('should navigate between pages', async ({ page }) => {\n    await page.goto('/')\n\n    // Check home page\n    await expect(page.locator('h1')).toContainText('Home')\n\n    // Navigate to about page\n    await page.click('text=About')\n    await expect(page).toHaveURL('/about')\n    await expect(page.locator('h1')).toContainText('About')\n\n    // Use browser back button\n    await page.goBack()\n    await expect(page).toHaveURL('/')\n    await expect(page.locator('h1')).toContainText('Home')\n  })\n\n  test('should handle search parameters', async ({ page }) => {\n    await page.goto('/search?q=react')\n\n    await expect(page.locator('[data-testid=\"search-input\"]')).toHaveValue(\n      'react',\n    )\n    await expect(page).toHaveURL('/search?q=react')\n\n    // Update search\n    await page.fill('[data-testid=\"search-input\"]', 'vue')\n    await page.press('[data-testid=\"search-input\"]', 'Enter')\n\n    await expect(page).toHaveURL('/search?q=vue')\n  })\n\n  test('should handle authentication flow', async ({ page }) => {\n    // Try to access protected route\n    await page.goto('/dashboard')\n\n    // Should redirect to login\n    await expect(page).toHaveURL('/login')\n\n    // Login\n    await page.fill('[data-testid=\"username\"]', 'testuser')\n    await page.fill('[data-testid=\"password\"]', 'password')\n    await page.click('[data-testid=\"login-btn\"]')\n\n    // Should redirect back to dashboard\n    await expect(page).toHaveURL('/dashboard')\n    await expect(page.locator('h1')).toContainText('Dashboard')\n  })\n})\n```\n\n---\n\n## Code-Based Routing Testing Best Practices\n\n### 1. Test Organization\n\n```\nsrc/\n├── components/\n│   ├── Header.tsx\n│   └── Header.test.tsx\n├── routes/\n│   ├── posts.tsx     # Code-based route definitions\n│   ├── posts.test.tsx\n│   └── index.tsx\n├── test/\n│   ├── setup.ts\n│   ├── router-utils.tsx  # Code-based router utilities\n│   └── mock-routes.tsx   # Manual route factories\n└── __tests__/\n    ├── integration/\n    └── e2e/\n```\n\n### 2. Common Patterns\n\n```tsx\n// Mock external dependencies for code-based routes\nvi.mock('../api/users', () => ({\n  fetchUser: vi.fn(),\n  updateUser: vi.fn(),\n}))\n\n// Test utility for common code-based route setups\nexport function createAuthenticatedRouter(user = mockUser) {\n  // Manually create routes for testing\n  const protectedRoutes = [\n    createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/dashboard',\n      component: DashboardComponent,\n    }),\n  ]\n\n  return createTestRouter(protectedRoutes, {\n    context: {\n      auth: { user, isAuthenticated: true },\n    },\n  })\n}\n\n// Group related tests\ndescribe('User Management', () => {\n  describe('when authenticated', () => {\n    it('should show user dashboard', () => {\n      // Test implementation\n    })\n  })\n\n  describe('when not authenticated', () => {\n    it('should redirect to login', () => {\n      // Test implementation\n    })\n  })\n})\n```\n\n---\n\n## Common Problems\n\n### Test Environment Issues\n\n**Problem:** Tests fail with \"window is not defined\" errors.\n\n**Solution:** Ensure jsdom environment is configured:\n\n```ts\n// vitest.config.ts\nexport default defineConfig({\n  test: {\n    environment: 'jsdom',\n  },\n})\n```\n\n### Router Context Missing\n\n**Problem:** Components can't access router context in tests.\n\n**Solution:** Use the custom render function with router:\n\n```tsx\n// ✅ Correct\nrenderWithRouter(<Component />, { routes, initialLocation })\n\n// ❌ Wrong\nrender(<Component />)\n```\n\n### Async Data Loading\n\n**Problem:** Tests fail because they don't wait for data loading.\n\n**Solution:** Use proper async testing patterns:\n\n```tsx\nawait waitFor(() => {\n  expect(screen.getByText('Loaded Data')).toBeInTheDocument()\n})\n```\n\n---\n\n## Common Next Steps\n\nAfter setting up code-based routing testing, you might want to:\n\n- [How to Test File-Based Routing](./test-file-based-routing.md) - Specific patterns for file-based routing apps\n- [How to Set Up Basic Authentication](./setup-authentication.md) - Test authentication flows\n- [How to Debug Common Router Issues](./debug-router-issues.md) - Debug test failures\n\n<!-- TODO: Uncomment as guides are created\n- [How to Set Up Continuous Integration](./setup-ci.md)\n- [How to Optimize Test Performance](./optimize-test-performance.md)\n-->\n\n## Related Resources\n\n- [Code-Based Routing Guide](../routing/code-based-routing.md) - Understanding code-based routing\n- [Vitest Documentation](https://vitest.dev/) - Testing framework\n- [Testing Library React](https://testing-library.com/docs/react-testing-library/intro/) - Component testing utilities\n- [Playwright Documentation](https://playwright.dev/) - E2E testing framework\n- [TanStack Router Examples](https://github.com/TanStack/router/tree/main/examples) - Example test setups\n"
  },
  {
    "path": "docs/router/how-to/share-search-params-across-routes.md",
    "content": "---\ntitle: Share Search Parameters Across Routes\n---\n\n# How to Share Search Parameters Across Routes\n\nSearch parameters automatically inherit from parent routes in TanStack Router. When a parent route validates search parameters, child routes can access them via `Route.useSearch()` alongside their own parameters.\n\n## How Parameter Inheritance Works\n\nTanStack Router automatically merges search parameters from parent routes with child route parameters. This happens through the route hierarchy:\n\n1. **Parent route** validates shared parameters with `validateSearch`\n2. **Child routes** automatically inherit those validated parameters\n3. **`Route.useSearch()`** returns both local and inherited parameters\n\n## Global Parameters via Root Route\n\nShare parameters across your entire application by validating them in the root route:\n\n```tsx\n// routes/__root.tsx\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst globalSearchSchema = z.object({\n  theme: z.enum(['light', 'dark']).default('light'),\n  lang: z.enum(['en', 'es', 'fr']).default('en'),\n  debug: z.boolean().default(false),\n})\n\nexport const Route = createRootRoute({\n  validateSearch: globalSearchSchema,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const { theme, lang, debug } = Route.useSearch()\n\n  return (\n    <div className={`app theme-${theme} lang-${lang}`}>\n      {debug && <DebugPanel />}\n      <Outlet />\n    </div>\n  )\n}\n```\n\n```tsx\n// routes/products/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  page: z.number().default(1),\n  category: z.string().default('all'),\n})\n\nexport const Route = createFileRoute('/products/')({\n  validateSearch: productSearchSchema,\n  component: ProductsPage,\n})\n\nfunction ProductsPage() {\n  // Contains both local (page, category) AND inherited (theme, lang, debug) parameters\n  const search = Route.useSearch()\n\n  return (\n    <div>\n      <h1>Products (Theme: {search.theme})</h1>\n      <p>Page: {search.page}</p>\n      <p>Category: {search.category}</p>\n    </div>\n  )\n}\n```\n\n## Section-Specific Parameters via Layout Routes\n\nShare parameters within a section of your app using layout routes:\n\n```tsx\n// routes/_authenticated.tsx\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst authSearchSchema = z.object({\n  impersonate: z.string().optional(),\n  sidebar: z.boolean().default(true),\n  notifications: z.boolean().default(true),\n})\n\nexport const Route = createFileRoute('/_authenticated')({\n  validateSearch: authSearchSchema,\n  component: AuthenticatedLayout,\n})\n\nfunction AuthenticatedLayout() {\n  const search = Route.useSearch()\n\n  return (\n    <div className=\"authenticated-layout\">\n      {search.sidebar && <Sidebar />}\n      <main className=\"main-content\">\n        {search.notifications && <NotificationBar />}\n        <Outlet />\n      </main>\n      {search.impersonate && <ImpersonationBanner user={search.impersonate} />}\n    </div>\n  )\n}\n```\n\n```tsx\n// routes/_authenticated/dashboard.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/dashboard')({\n  component: DashboardPage,\n})\n\nfunction DashboardPage() {\n  // Contains inherited auth parameters (impersonate, sidebar, notifications)\n  const search = Route.useSearch()\n\n  return (\n    <div>\n      <h1>Dashboard</h1>\n      {search.impersonate && (\n        <Alert>Currently impersonating: {search.impersonate}</Alert>\n      )}\n      <DashboardContent />\n    </div>\n  )\n}\n```\n\n## Common Use Cases\n\n**Global Application Settings:**\n\n- Theme, language, timezone\n- Debug flags, feature toggles\n- Analytics tracking (UTM parameters)\n\n**Section-Specific State:**\n\n- Authentication context (user role, impersonation)\n- Layout preferences (sidebar, density)\n- Workspace or organization context\n\n**Persistent UI State:**\n\n- Modal visibility, drawer state\n- Filter presets, view modes\n- Accessibility preferences\n\n## Common Problems\n\n### Problem: Parameters Not Inheriting\n\n**Cause**: Parent route not validating the shared parameters.\n\n```tsx\n// ❌ Root route missing validateSearch\nexport const Route = createRootRoute({\n  component: RootComponent, // No validateSearch\n})\n\n// Child route can't access theme parameter\nfunction ProductsPage() {\n  const search = Route.useSearch() // No theme available\n}\n```\n\n**Solution**: Add `validateSearch` to the parent route:\n\n```tsx\n// ✅ Root route validates shared parameters\nexport const Route = createRootRoute({\n  validateSearch: globalSearchSchema,\n  component: RootComponent,\n})\n```\n\n### Problem: Navigation Loses Shared Parameters\n\n**Cause**: Not preserving inherited parameters during navigation.\n\n```tsx\n// ❌ Navigation overwrites all search parameters\nrouter.navigate({\n  to: '/products',\n  search: { page: 1 }, // Loses theme, lang, etc.\n})\n```\n\n**Solution**: Preserve existing parameters with function syntax:\n\n```tsx\n// ✅ Preserve existing parameters\nrouter.navigate({\n  to: '/products',\n  search: (prev) => ({ ...prev, page: 1 }),\n})\n```\n\n### Problem: Type Errors with Inherited Parameters\n\n**Cause**: Child route schema doesn't account for inherited parameters.\n\n```tsx\n// ❌ TypeScript error: Property 'theme' doesn't exist\nconst search = Route.useSearch()\nconsole.log(search.theme) // Type error\n```\n\n**Solution**: TypeScript automatically infers inherited types when using `validateSearch`. No additional typing needed - the inheritance works automatically.\n\n## Production Checklist\n\n- [ ] **Clear ownership**: Document which route validates which shared parameters\n- [ ] **Avoid conflicts**: Use distinct parameter names across route levels\n- [ ] **Preserve on navigation**: Use function syntax to maintain inherited parameters\n- [ ] **Minimal URLs**: Only include essential shared parameters\n- [ ] **Graceful defaults**: Provide fallback values for all shared parameters\n\n<!--\n## Common Next Steps\n\nAfter implementing shared search parameters, you might want to:\n\n- [Build Advanced Search Parameter Middleware](./advanced-search-param-middleware.md) - Create reusable parameter sharing logic\n- [Handle Search Parameters in Forms](./search-params-in-forms.md) - Integrate shared parameters with form state\n- [Debug Search Parameter Issues](./debug-search-param-issues.md) - Troubleshoot parameter sharing problems\n-->\n\n## Related Resources\n\n- [Set Up Basic Search Parameters](./setup-basic-search-params.md) - Learn search parameter fundamentals\n- [Navigate with Search Parameters](./navigate-with-search-params.md) - Navigate while preserving search state\n- [Validate Search Parameters with Schemas](./validate-search-params.md) - Add type safety to shared parameters\n"
  },
  {
    "path": "docs/router/how-to/test-file-based-routing.md",
    "content": "---\ntitle: How to Test Router with File-Based Routing\n---\n\nThis guide covers testing TanStack Router applications that use file-based routing, including testing route generation, file-based route components, and file-based routing patterns.\n\n## Quick Start\n\nTest file-based routing by setting up route mocking utilities, testing generated route trees, and implementing patterns specific to file-based route structures and conventions.\n\n---\n\n## Understanding File-Based Routing Testing\n\nFile-based routing testing differs from code-based routing testing in several key ways:\n\n- **Generated Route Trees**: Routes are automatically generated from filesystem structure\n- **File Conventions**: Routes follow specific file naming conventions (`index.tsx`, `route.tsx`, `$param.tsx`)\n- **Route Discovery**: Routes are discovered through filesystem scanning rather than explicit imports\n- **Type Generation**: Route types are automatically generated and need special testing considerations\n\n---\n\n## Setting Up File-Based Route Testing\n\n### 1. Install Test Dependencies\n\nFor file-based routing testing, you'll need the same base dependencies as regular router testing:\n\n```bash\nnpm install -D vitest @testing-library/react @testing-library/jest-dom @testing-library/user-event jsdom\n```\n\n### 2. Configure Test Environment\n\nCreate `vitest.config.ts` with file-based routing support:\n\n```ts\nimport { defineConfig } from 'vitest/config'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      // Configure for test environment\n      routesDirectory: './src/routes',\n      generatedRouteTree: './src/routeTree.gen.ts',\n      disableLogging: true,\n    }),\n    react(),\n  ],\n  test: {\n    environment: 'jsdom',\n    setupFiles: ['./src/test/setup.ts'],\n    typecheck: { enabled: true },\n    watch: false,\n    // Ensure route tree is generated before tests\n    globals: true,\n  },\n})\n```\n\n### 3. Create Route Testing Utilities\n\nCreate `src/test/file-route-utils.tsx`:\n\n```tsx\nimport React from 'react'\nimport { render, RenderOptions } from '@testing-library/react'\nimport {\n  createRouter,\n  RouterProvider,\n  createMemoryHistory,\n} from '@tanstack/react-router'\n\n// Import the generated route tree\nimport { routeTree } from '../routeTree.gen'\n\n// Create test router with generated route tree\nexport function createTestRouterFromFiles(initialLocation = '/') {\n  const router = createRouter({\n    routeTree,\n    history: createMemoryHistory({\n      initialEntries: [initialLocation],\n    }),\n    context: {\n      // Add any required context for your routes\n    },\n  })\n\n  return router\n}\n\n// Custom render function for file-based routes\ninterface RenderWithFileRoutesOptions extends Omit<RenderOptions, 'wrapper'> {\n  initialLocation?: string\n  routerContext?: any\n}\n\nexport function renderWithFileRoutes(\n  ui: React.ReactElement,\n  {\n    initialLocation = '/',\n    routerContext = {},\n    ...renderOptions\n  }: RenderWithFileRoutesOptions = {},\n) {\n  const router = createRouter({\n    routeTree,\n    history: createMemoryHistory({\n      initialEntries: [initialLocation],\n    }),\n    context: routerContext,\n  })\n\n  function Wrapper({ children }: { children: React.ReactNode }) {\n    return <RouterProvider router={router}>{children}</RouterProvider>\n  }\n\n  return {\n    ...render(ui, { wrapper: Wrapper, ...renderOptions }),\n    router,\n  }\n}\n\n// Helper to test specific file routes\nexport function createMockFileRoute(\n  path: string,\n  component: React.ComponentType,\n) {\n  // This is useful for isolated testing when you don't want to use the full route tree\n  return {\n    path,\n    component,\n    // Add other common route properties as needed\n  }\n}\n```\n\n---\n\n## Testing File-Based Route Structure\n\n### 1. Test Route Tree Generation\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { routeTree } from '../routeTree.gen'\n\ndescribe('Generated Route Tree', () => {\n  it('should generate route tree from file structure', () => {\n    // Test that route tree exists and has expected structure\n    expect(routeTree).toBeDefined()\n    expect(routeTree.children).toBeDefined()\n  })\n\n  it('should include all expected routes', () => {\n    // Get all route paths from the generated tree\n    const getAllRoutePaths = (tree: any, paths: string[] = []): string[] => {\n      if (tree.path) {\n        paths.push(tree.path)\n      }\n      if (tree.children) {\n        tree.children.forEach((child: any) => {\n          getAllRoutePaths(child, paths)\n        })\n      }\n      return paths\n    }\n\n    const routePaths = getAllRoutePaths(routeTree)\n\n    // Test that expected routes are present\n    expect(routePaths).toContain('/')\n    expect(routePaths).toContain('/about')\n    // Add assertions for your specific routes\n  })\n\n  it('should have correct route hierarchy', () => {\n    // Test parent-child relationships\n    const homeRoute = routeTree.children?.find(\n      (child: any) => child.path === '/',\n    )\n    expect(homeRoute).toBeDefined()\n\n    // Test for specific route structure based on your file organization\n    // For example, if you have /posts/$postId routes:\n    // const postsRoute = routeTree.children?.find((child: any) => child.path === '/posts')\n    // expect(postsRoute?.children).toBeDefined()\n  })\n})\n```\n\n### 2. Test File Route Conventions\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('File Route Conventions', () => {\n  it('should render index route at root path', () => {\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/',\n    })\n\n    // Test that the index route component renders\n    // This depends on what your src/routes/index.tsx exports\n    expect(screen.getByText('Welcome Home!')).toBeInTheDocument()\n  })\n\n  it('should handle route parameters from filename', () => {\n    // If you have a route like src/routes/posts/$postId.tsx\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/posts/123',\n    })\n\n    // Test that parameter is correctly parsed from file-based route\n    expect(screen.getByText(/Post.*123/)).toBeInTheDocument()\n  })\n\n  it('should handle nested routes from directory structure', () => {\n    // If you have src/routes/dashboard/settings.tsx\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/dashboard/settings',\n    })\n\n    expect(screen.getByText(/Settings/)).toBeInTheDocument()\n  })\n\n  it('should handle layout routes', () => {\n    // If you have src/routes/_layout.tsx\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/some-nested-route',\n    })\n\n    // Test that layout is rendered for nested routes\n    expect(screen.getByTestId('layout-header')).toBeInTheDocument()\n  })\n})\n```\n\n---\n\n## Testing File-Based Route Components\n\n### 1. Test Individual Route Files\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('Individual Route Components', () => {\n  it('should test about route component', () => {\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/about',\n    })\n\n    expect(screen.getByText('About')).toBeInTheDocument()\n  })\n\n  it('should test route with loader data', () => {\n    // For a route like src/routes/posts/index.tsx with loader\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/posts',\n    })\n\n    // Wait for loader data to load\n    expect(screen.getByText(/Posts List/)).toBeInTheDocument()\n  })\n\n  it('should test route with search params validation', () => {\n    // For a route with validateSearch in src/routes/search.tsx\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/search?q=react&page=1',\n    })\n\n    expect(screen.getByDisplayValue('react')).toBeInTheDocument()\n  })\n})\n```\n\n### 2. Test Route-Specific Hooks\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('Route-Specific Hooks', () => {\n  it('should test useParams in parameterized route', () => {\n    // Create a test component that uses Route.useParams()\n    function TestComponent() {\n      // This would be available in the actual route component\n      const params = Route.useParams()\n      return <div data-testid=\"param-value\">{params.postId}</div>\n    }\n\n    renderWithFileRoutes(<TestComponent />, {\n      initialLocation: '/posts/abc123',\n    })\n\n    expect(screen.getByTestId('param-value')).toHaveTextContent('abc123')\n  })\n\n  it('should test useLoaderData in route with loader', () => {\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/posts/123',\n    })\n\n    // Test that loader data is available in the component\n    expect(screen.getByText(/Post Title/)).toBeInTheDocument()\n  })\n\n  it('should test useSearch in route with search validation', () => {\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/search?q=typescript&sort=date',\n    })\n\n    // Test that search params are correctly parsed\n    expect(screen.getByDisplayValue('typescript')).toBeInTheDocument()\n    expect(screen.getByText(/sorted by date/)).toBeInTheDocument()\n  })\n})\n```\n\n---\n\n## Testing Route Navigation with File-Based Routes\n\n### 1. Test Link Navigation\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport userEvent from '@testing-library/user-event'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('File-Based Route Navigation', () => {\n  it('should navigate between file-based routes', async () => {\n    const user = userEvent.setup()\n\n    const { router } = renderWithFileRoutes(<div />, {\n      initialLocation: '/',\n    })\n\n    // Initial state - should be on home route\n    expect(screen.getByText('Welcome Home!')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/')\n\n    // Click navigation link\n    await user.click(screen.getByRole('link', { name: /about/i }))\n\n    // Should navigate to about route\n    expect(screen.getByText('About')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/about')\n  })\n\n  it('should handle dynamic route navigation', async () => {\n    const user = userEvent.setup()\n\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/posts',\n    })\n\n    // Click on a post link (assuming your posts route renders links)\n    await user.click(screen.getByRole('link', { name: /View Post 1/i }))\n\n    // Should navigate to dynamic post route\n    expect(screen.getByText(/Post 1 Details/)).toBeInTheDocument()\n  })\n\n  it('should handle nested route navigation', async () => {\n    const user = userEvent.setup()\n\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/dashboard',\n    })\n\n    // Navigate to nested route\n    await user.click(screen.getByRole('link', { name: /settings/i }))\n\n    expect(screen.getByText(/Dashboard Settings/)).toBeInTheDocument()\n  })\n})\n```\n\n### 2. Test Programmatic Navigation\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport userEvent from '@testing-library/user-event'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('Programmatic Navigation', () => {\n  it('should programmatically navigate between file routes', async () => {\n    const user = userEvent.setup()\n\n    const { router } = renderWithFileRoutes(<div />, {\n      initialLocation: '/',\n    })\n\n    // Trigger programmatic navigation (button in your component)\n    await user.click(screen.getByRole('button', { name: /Go to Posts/i }))\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate with search params', async () => {\n    const user = userEvent.setup()\n\n    const { router } = renderWithFileRoutes(<div />, {\n      initialLocation: '/search',\n    })\n\n    // Trigger search with params\n    await user.type(screen.getByRole('textbox'), 'test query')\n    await user.click(screen.getByRole('button', { name: /search/i }))\n\n    expect(router.state.location.search).toMatchObject({\n      q: 'test query',\n    })\n  })\n})\n```\n\n---\n\n## Testing File-Based Route Guards and Loaders\n\n### 1. Test Route Guards\n\n```tsx\nimport { describe, it, expect, vi } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('File-Based Route Guards', () => {\n  it('should redirect unauthenticated users from protected routes', () => {\n    // Mock unauthenticated state\n    const mockAuth = { isAuthenticated: false, user: null }\n\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/dashboard',\n      routerContext: { auth: mockAuth },\n    })\n\n    // Should redirect to login (based on your beforeLoad implementation)\n    expect(screen.getByText(/Please log in/)).toBeInTheDocument()\n  })\n\n  it('should allow authenticated users to access protected routes', () => {\n    const mockAuth = {\n      isAuthenticated: true,\n      user: { id: '1', name: 'John' },\n    }\n\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/dashboard',\n      routerContext: { auth: mockAuth },\n    })\n\n    expect(screen.getByText(/Welcome to Dashboard/)).toBeInTheDocument()\n  })\n})\n```\n\n### 2. Test Route Loaders\n\n```tsx\nimport { describe, it, expect, vi } from 'vitest'\nimport { screen, waitFor } from '@testing-library/react'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('File-Based Route Loaders', () => {\n  it('should load data for route with loader', async () => {\n    // Mock the API function used in your route loader\n    const mockFetchPost = vi.fn().mockResolvedValue({\n      id: '123',\n      title: 'Test Post',\n      content: 'Test content',\n    })\n\n    // If your route loader uses a global API function, mock it\n    vi.mock('../api/posts', () => ({\n      fetchPost: mockFetchPost,\n    }))\n\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/posts/123',\n    })\n\n    await waitFor(() => {\n      expect(screen.getByText('Test Post')).toBeInTheDocument()\n    })\n\n    expect(mockFetchPost).toHaveBeenCalledWith('123')\n  })\n\n  it('should handle loader errors', async () => {\n    const mockFetchPost = vi.fn().mockRejectedValue(new Error('Post not found'))\n\n    vi.mock('../api/posts', () => ({\n      fetchPost: mockFetchPost,\n    }))\n\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/posts/invalid',\n    })\n\n    await waitFor(() => {\n      expect(screen.getByText(/Error.*Post not found/)).toBeInTheDocument()\n    })\n  })\n})\n```\n\n---\n\n## Testing File Route Validation\n\n### 1. Test Search Parameter Validation\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('File Route Validation', () => {\n  it('should validate search parameters', () => {\n    // Test with valid search params\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/search?q=react&page=1&sort=date',\n    })\n\n    expect(screen.getByDisplayValue('react')).toBeInTheDocument()\n    expect(screen.getByText(/Page 1/)).toBeInTheDocument()\n  })\n\n  it('should handle invalid search parameters', () => {\n    // Test with invalid search params (e.g., invalid page number)\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/search?page=invalid&sort=unknown',\n    })\n\n    // Should fall back to defaults based on your validation schema\n    expect(screen.getByText(/Page 1/)).toBeInTheDocument() // default page\n  })\n\n  it('should validate route parameters', () => {\n    // Test with valid route param\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/posts/123',\n    })\n\n    expect(screen.getByText(/Post 123/)).toBeInTheDocument()\n  })\n})\n```\n\n---\n\n## Testing File Route Error Boundaries\n\n### 1. Test Route-Level Error Handling\n\n```tsx\nimport { describe, it, expect, vi } from 'vitest'\nimport { screen } from '@testing-library/react'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('File Route Error Handling', () => {\n  it('should handle component errors with error boundary', () => {\n    // Mock console.error to avoid noise in test output\n    const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})\n\n    // Force an error in a route component\n    vi.mock('../routes/error-prone.tsx', () => ({\n      Route: {\n        component: () => {\n          throw new Error('Test error')\n        },\n      },\n    }))\n\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/error-prone',\n    })\n\n    expect(screen.getByText(/Something went wrong/)).toBeInTheDocument()\n\n    consoleSpy.mockRestore()\n  })\n\n  it('should handle loader errors with error component', async () => {\n    const mockFailingLoader = vi\n      .fn()\n      .mockRejectedValue(new Error('Load failed'))\n\n    vi.mock('../api/data', () => ({\n      loadData: mockFailingLoader,\n    }))\n\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/data-route',\n    })\n\n    expect(screen.getByText(/Failed to load data/)).toBeInTheDocument()\n  })\n})\n```\n\n---\n\n## Testing with Generated Route Types\n\n### 1. Test Type Safety\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { useNavigate } from '@tanstack/react-router'\nimport { renderWithFileRoutes } from '../test/file-route-utils'\n\ndescribe('Generated Route Types', () => {\n  it('should provide type-safe navigation', () => {\n    function TestComponent() {\n      const navigate = useNavigate()\n\n      const handleNavigate = () => {\n        // This should be type-safe based on your generated routes\n        navigate({\n          to: '/posts/$postId',\n          params: { postId: '123' },\n          search: { tab: 'comments' },\n        })\n      }\n\n      return (\n        <button onClick={handleNavigate} data-testid=\"navigate-btn\">\n          Navigate\n        </button>\n      )\n    }\n\n    const { router } = renderWithFileRoutes(<TestComponent />, {\n      initialLocation: '/',\n    })\n\n    // Test the navigation works correctly\n    const button = screen.getByTestId('navigate-btn')\n    fireEvent.click(button)\n\n    expect(router.state.location.pathname).toBe('/posts/123')\n    expect(router.state.location.search).toEqual({ tab: 'comments' })\n  })\n})\n```\n\n---\n\n## Testing Route Tree Changes\n\n### 1. Test Route Generation During Development\n\n```tsx\nimport { describe, it, expect } from 'vitest'\nimport { routeTree } from '../routeTree.gen'\n\ndescribe('Route Tree Development', () => {\n  it('should regenerate routes when files change', () => {\n    // This test ensures your route tree is properly generated\n    // You can add specific assertions based on your file structure\n\n    expect(routeTree).toBeDefined()\n    expect(typeof routeTree.children).toBe('object')\n\n    // Test specific routes exist\n    const routes = getAllRouteIds(routeTree)\n    expect(routes).toContain('/')\n    expect(routes).toContain('/about')\n    // Add assertions for your specific routes\n  })\n\n  // Helper function to get all route IDs from tree\n  function getAllRouteIds(tree: any, ids: string[] = []): string[] {\n    if (tree.id) {\n      ids.push(tree.id)\n    }\n    if (tree.children) {\n      Object.values(tree.children).forEach((child: any) => {\n        getAllRouteIds(child, ids)\n      })\n    }\n    return ids\n  }\n})\n```\n\n---\n\n## E2E Testing for File-Based Routes\n\n### 1. Playwright Configuration for File-Based Routes\n\nCreate `e2e/file-routing.spec.ts`:\n\n```ts\nimport { test, expect } from '@playwright/test'\n\ntest.describe('File-Based Route E2E', () => {\n  test('should navigate through file-based route structure', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    // Test home route (from src/routes/index.tsx)\n    await expect(page.locator('h3')).toContainText('Welcome Home!')\n\n    // Navigate to about route (from src/routes/about.tsx)\n    await page.click('text=About')\n    await expect(page).toHaveURL('/about')\n    await expect(page.locator('h3')).toContainText('About')\n\n    // Test browser navigation\n    await page.goBack()\n    await expect(page).toHaveURL('/')\n  })\n\n  test('should handle dynamic routes from file structure', async ({ page }) => {\n    await page.goto('/posts')\n\n    // Click on a dynamic post link (from src/routes/posts/$postId.tsx)\n    await page.click('[data-testid=\"post-link-1\"]')\n    await expect(page).toHaveURL('/posts/1')\n    await expect(page.locator('h1')).toContainText('Post 1')\n  })\n\n  test('should handle nested routes', async ({ page }) => {\n    await page.goto('/dashboard')\n\n    // Navigate to nested route (from src/routes/dashboard/settings.tsx)\n    await page.click('text=Settings')\n    await expect(page).toHaveURL('/dashboard/settings')\n    await expect(page.locator('h2')).toContainText('Settings')\n  })\n})\n```\n\n---\n\n## Common File-Based Routing Testing Patterns\n\n### 1. Mock Route Files for Testing\n\n```tsx\n// src/test/mock-file-routes.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\n// Mock individual route for isolated testing\nexport const createMockFileRoute = (\n  path: string,\n  component: React.ComponentType,\n  options: any = {},\n) => {\n  return createFileRoute(path)({\n    component,\n    ...options,\n  })\n}\n\n// Common test route components\nexport const TestHomeRoute = createMockFileRoute('/', () => (\n  <div data-testid=\"home\">Home Page</div>\n))\n\nexport const TestAboutRoute = createMockFileRoute('/about', () => (\n  <div data-testid=\"about\">About Page</div>\n))\n\nexport const TestDynamicRoute = createMockFileRoute('/posts/$postId', () => {\n  const { postId } = Route.useParams()\n  return <div data-testid=\"post\">Post {postId}</div>\n})\n```\n\n### 2. Test Route Discovery\n\n```tsx\nimport { describe, it, expect } from 'vitest'\n\ndescribe('Route Discovery', () => {\n  it('should discover all routes from file structure', () => {\n    // Test that your route tree includes all expected routes\n    // This helps catch when routes are accidentally not being generated\n\n    const expectedRoutes = [\n      '/',\n      '/about',\n      '/posts',\n      '/posts/$postId',\n      '/dashboard',\n      '/dashboard/settings',\n    ]\n\n    expectedRoutes.forEach((routePath) => {\n      const routeExists = checkRouteExists(routeTree, routePath)\n      expect(routeExists).toBe(true)\n    })\n  })\n})\n\nfunction checkRouteExists(tree: any, path: string): boolean {\n  // Implementation to check if route exists in tree\n  // This depends on your route tree structure\n  return true // Simplified\n}\n```\n\n---\n\n## Best Practices for File-Based Route Testing\n\n### 1. Test Organization\n\n```\nsrc/\n├── routes/\n│   ├── __root.tsx\n│   ├── index.tsx\n│   ├── about.tsx\n│   ├── posts/\n│   │   ├── index.tsx\n│   │   └── $postId.tsx\n├── test/\n│   ├── setup.ts\n│   ├── file-route-utils.tsx\n│   └── routes/\n│       ├── index.test.tsx\n│       ├── about.test.tsx\n│       └── posts/\n│           ├── index.test.tsx\n│           └── $postId.test.tsx\n```\n\n### 2. Common Test Patterns\n\n```tsx\n// Test file for each route file\ndescribe('Posts Route (/posts)', () => {\n  it('should render posts list', () => {\n    renderWithFileRoutes(<div />, {\n      initialLocation: '/posts',\n    })\n\n    expect(screen.getByText(/Posts/)).toBeInTheDocument()\n  })\n\n  it('should handle loading state', () => {\n    // Test pending state for route with loader\n  })\n\n  it('should handle error state', () => {\n    // Test error handling for route\n  })\n})\n\n// Test route groups\ndescribe('Dashboard Routes', () => {\n  describe('/dashboard', () => {\n    // Dashboard index tests\n  })\n\n  describe('/dashboard/settings', () => {\n    // Settings route tests\n  })\n})\n```\n\n---\n\n## Troubleshooting File-Based Route Testing\n\n### Common Issues\n\n**Problem**: Route tree not found in tests\n\n```bash\nError: Cannot find module '../routeTree.gen'\n```\n\n**Solution**: Ensure route tree generation in test setup:\n\n```ts\n// vitest.config.ts\nexport default defineConfig({\n  plugins: [\n    tanstackRouter(), // Ensure this runs before tests\n    react(),\n  ],\n  test: {\n    setupFiles: ['./src/test/setup.ts'],\n  },\n})\n```\n\n**Problem**: Routes not updating in tests after file changes\n\n**Solution**: Clear module cache in test setup:\n\n```ts\n// src/test/setup.ts\nbeforeEach(() => {\n  vi.clearAllMocks()\n  // Clear route tree cache if needed\n  delete require.cache[require.resolve('../routeTree.gen')]\n})\n```\n\n**Problem**: Type errors in tests with generated routes\n\n**Solution**: Ensure proper TypeScript configuration:\n\n```json\n{\n  \"compilerOptions\": {\n    \"types\": [\"vitest/globals\", \"@testing-library/jest-dom\"],\n    \"moduleResolution\": \"bundler\"\n  },\n  \"include\": [\"src/**/*\", \"src/routeTree.gen.ts\"]\n}\n```\n\n---\n\n## Next Steps\n\nAfter setting up file-based route testing, you might want to:\n\n- [How to Set Up Testing with Code-Based Routing](./setup-testing.md) - Testing patterns for manually defined routes\n- [How to Debug Router Issues](./debug-router-issues.md) - Debug file-based routing issues\n- [File-Based Routing Guide](../routing/file-based-routing.md) - Learn more about file-based routing\n\n## Related Resources\n\n- [TanStack Router File-Based Routing](../routing/file-based-routing.md) - Complete file-based routing guide\n- [File Naming Conventions](../routing/file-naming-conventions.md) - Understanding file structure\n- [Testing Library](https://testing-library.com/) - Component testing utilities\n- [Vitest](https://vitest.dev/) - Testing framework documentation\n"
  },
  {
    "path": "docs/router/how-to/use-environment-variables.md",
    "content": "---\ntitle: How to Use Environment Variables\n---\n\nLearn how to configure and use environment variables in your TanStack Router application for API endpoints, feature flags, and build configuration across different bundlers.\n\n## Quick Start\n\nEnvironment variables in TanStack Router are primarily used for client-side configuration and must follow bundler-specific naming conventions for security.\n\n```bash\n# .env\nVITE_API_URL=https://api.example.com\nVITE_ENABLE_DEVTOOLS=true\n```\n\n```typescript\n// Route configuration\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    const apiUrl = import.meta.env.VITE_API_URL\n    const response = await fetch(`${apiUrl}/posts`)\n    return response.json()\n  },\n  component: PostsList,\n})\n```\n\n## Environment Variable Access Patterns\n\n### Vite-Based Projects (Most Common)\n\nWith Vite, environment variables must be prefixed with `VITE_` to be accessible in client code:\n\n```typescript\n// Route loaders\nexport const Route = createFileRoute('/dashboard')({\n  loader: async () => {\n    const apiUrl = import.meta.env.VITE_API_URL        // ✅ Works\n    const apiKey = import.meta.env.VITE_PUBLIC_API_KEY // ✅ Works\n\n    // This would be undefined (security feature):\n    // const secret = import.meta.env.SECRET_KEY        // ❌ Undefined\n\n    return fetchDashboardData(apiUrl, apiKey)\n  },\n})\n\n// Components\nexport function ApiStatus() {\n  const isDev = import.meta.env.DEV           // ✅ Built-in Vite variable\n  const isProd = import.meta.env.PROD         // ✅ Built-in Vite variable\n  const mode = import.meta.env.MODE           // ✅ development/production\n\n  return (\n    <div>\n      Environment: {mode}\n      {isDev && <DevToolsPanel />}\n    </div>\n  )\n}\n```\n\n### Webpack-Based Projects\n\nConfigure webpack's DefinePlugin to inject environment variables. **Note:** Webpack doesn't support `import.meta.env` by default, so use `process.env` patterns:\n\n```typescript\n// webpack.config.js\nconst webpack = require('webpack')\n\nmodule.exports = {\n  plugins: [\n    new webpack.DefinePlugin({\n      'process.env.API_URL': JSON.stringify(process.env.API_URL),\n      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),\n      'process.env.ENABLE_FEATURE': JSON.stringify(process.env.ENABLE_FEATURE),\n    }),\n  ],\n}\n\n// Usage in routes\nexport const Route = createFileRoute('/api-data')({\n  loader: async () => {\n    const response = await fetch(`${process.env.API_URL}/data`)\n    return response.json()\n  },\n  component: () => {\n    const enableFeature = process.env.ENABLE_FEATURE === 'true'\n    return enableFeature ? <NewFeature /> : <OldFeature />\n  },\n})\n```\n\n### Rspack-Based Projects\n\nRspack uses the `PUBLIC_` prefix convention. **Note:** `import.meta.env` support depends on your Rspack configuration and runtime - you may need to configure `builtins.define` properly:\n\n```bash\n# .env\nPUBLIC_API_URL=https://api.example.com\nPUBLIC_FEATURE_FLAG=true\n```\n\n```typescript\n// Route usage\nexport const Route = createFileRoute('/features')({\n  loader: async () => {\n    const apiUrl = import.meta.env.PUBLIC_API_URL\n    return fetch(`${apiUrl}/features`).then(r => r.json())\n  },\n  component: () => {\n    const enableFeature = import.meta.env.PUBLIC_FEATURE_FLAG === 'true'\n    return enableFeature ? <NewFeature /> : <OldFeature />\n  },\n})\n```\n\n### ESBuild Projects\n\nConfigure defines manually:\n\n```typescript\n// build script\nimport { build } from 'esbuild'\n\nawait build({\n  entryPoints: ['src/main.tsx'],\n  define: {\n    'process.env.NODE_ENV': '\"production\"',\n    'process.env.API_URL': `\"${process.env.API_URL}\"`,\n  },\n})\n```\n\n## Common Patterns\n\n### API Configuration in Route Loaders\n\n```typescript\n// src/routes/posts/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nconst fetchPosts = async () => {\n  const baseUrl = import.meta.env.VITE_API_URL\n  const apiKey = import.meta.env.VITE_API_KEY\n\n  const response = await fetch(`${baseUrl}/posts`, {\n    headers: {\n      'Authorization': `Bearer ${apiKey}`,\n      'Content-Type': 'application/json',\n    },\n  })\n\n  if (!response.ok) {\n    throw new Error('Failed to fetch posts')\n  }\n\n  return response.json()\n}\n\nexport const Route = createFileRoute('/posts/')({\n  loader: fetchPosts,\n  errorComponent: ({ error }) => (\n    <div>Error loading posts: {error.message}</div>\n  ),\n})\n```\n\n### Environment-Based Route Configuration\n\n```typescript\n// src/routes/__root.tsx\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <>\n      <Outlet />\n      {/* Only show devtools in development */}\n      {import.meta.env.DEV && <TanStackRouterDevtools />}\n    </>\n  ),\n})\n```\n\n### Feature Flags in Routes\n\n```typescript\n// src/lib/features.ts\nexport const features = {\n  enableNewDashboard: import.meta.env.VITE_ENABLE_NEW_DASHBOARD === 'true',\n  enableAnalytics: import.meta.env.VITE_ENABLE_ANALYTICS === 'true',\n  debugMode: import.meta.env.DEV,\n}\n\n// src/routes/dashboard/index.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\nimport { features } from '../../lib/features'\n\nexport const Route = createFileRoute('/dashboard/')({\n  beforeLoad: () => {\n    // Redirect to old dashboard if new one is disabled\n    if (!features.enableNewDashboard) {\n      throw redirect({ to: '/dashboard/legacy' })\n    }\n  },\n  component: NewDashboard,\n})\n```\n\n### Authentication Configuration\n\n```typescript\n// src/lib/auth.ts\nexport const authConfig = {\n  domain: import.meta.env.VITE_AUTH0_DOMAIN,\n  clientId: import.meta.env.VITE_AUTH0_CLIENT_ID,\n  redirectUri: `${window.location.origin}/callback`,\n}\n\n// src/routes/_authenticated.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\nimport { authConfig } from '../lib/auth'\n\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: async ({ location }) => {\n    const isAuthenticated = await checkAuthStatus()\n\n    if (!isAuthenticated) {\n      // Redirect to auth provider\n      const authUrl = `https://${authConfig.domain}/authorize?client_id=${authConfig.clientId}&redirect_uri=${authConfig.redirectUri}`\n      window.location.href = authUrl\n      return\n    }\n  },\n})\n```\n\n### Search Params with Environment Config\n\n```typescript\n// src/routes/search.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  q: z.string().optional(),\n  category: z.string().optional(),\n})\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: searchSchema,\n  loader: async ({ search }) => {\n    const apiUrl = import.meta.env.VITE_SEARCH_API_URL\n    const params = new URLSearchParams({\n      q: search.q || '',\n      category: search.category || 'all',\n      api_key: import.meta.env.VITE_SEARCH_API_KEY,\n    })\n\n    const response = await fetch(`${apiUrl}/search?${params}`)\n    return response.json()\n  },\n})\n```\n\n## Environment File Setup\n\n### File Hierarchy (Vite)\n\nVite loads environment files in this order:\n\n```\n.env.local          # Local overrides (add to .gitignore)\n.env.production     # Production-specific\n.env.development    # Development-specific\n.env                # Default (commit to git)\n```\n\n### Example Configuration\n\n**.env** (committed to repository):\n\n```bash\n# API Configuration\nVITE_API_URL=https://api.example.com\nVITE_API_VERSION=v1\n\n# Feature Flags\nVITE_ENABLE_NEW_UI=false\nVITE_ENABLE_ANALYTICS=true\n\n# Auth Configuration (public keys only)\nVITE_AUTH0_DOMAIN=your-domain.auth0.com\nVITE_AUTH0_CLIENT_ID=your-client-id\n\n# Build Configuration\nVITE_APP_NAME=TanStack Router App\nVITE_APP_VERSION=1.0.0\n```\n\n**.env.local** (add to .gitignore):\n\n```bash\n# Development overrides\nVITE_API_URL=http://localhost:3001\nVITE_ENABLE_NEW_UI=true\nVITE_DEBUG_MODE=true\n```\n\n**.env.production**:\n\n```bash\n# Production-specific\nVITE_API_URL=https://api.prod.example.com\nVITE_ENABLE_ANALYTICS=true\nVITE_ENABLE_NEW_UI=true\n```\n\n## Type Safety\n\n### Vite TypeScript Declarations\n\nCreate `src/vite-env.d.ts`:\n\n```typescript\n/// <reference types=\"vite/client\" />\n\ninterface ImportMetaEnv {\n  // API Configuration\n  readonly VITE_API_URL: string\n  readonly VITE_API_VERSION: string\n  readonly VITE_API_KEY?: string\n\n  // Feature Flags\n  readonly VITE_ENABLE_NEW_UI: string\n  readonly VITE_ENABLE_ANALYTICS: string\n  readonly VITE_DEBUG_MODE?: string\n\n  // Authentication\n  readonly VITE_AUTH0_DOMAIN: string\n  readonly VITE_AUTH0_CLIENT_ID: string\n\n  // App Configuration\n  readonly VITE_APP_NAME: string\n  readonly VITE_APP_VERSION: string\n}\n\ninterface ImportMeta {\n  readonly env: ImportMetaEnv\n}\n```\n\n### Runtime Validation\n\nUse Zod to validate environment variables at startup with fallbacks and optional values:\n\n```typescript\n// src/config/env.ts\nimport { z } from 'zod'\n\nconst envSchema = z.object({\n  // Required variables\n  VITE_API_URL: z.string().url(),\n  VITE_AUTH0_DOMAIN: z.string(),\n  VITE_AUTH0_CLIENT_ID: z.string(),\n  VITE_APP_NAME: z.string(),\n\n  // Optional with defaults\n  VITE_API_VERSION: z.string().default('v1'),\n  VITE_ENABLE_NEW_UI: z.string().default('false'),\n  VITE_ENABLE_ANALYTICS: z.string().default('true'),\n\n  // Optional variables\n  VITE_DEBUG_MODE: z.string().optional(),\n  VITE_SENTRY_DSN: z.string().optional(),\n})\n\n// Validate at app startup with fallbacks\nexport const env = envSchema.parse({\n  ...import.meta.env,\n  // Provide fallbacks for missing optional values\n  VITE_API_VERSION: import.meta.env.VITE_API_VERSION || 'v1',\n  VITE_ENABLE_NEW_UI: import.meta.env.VITE_ENABLE_NEW_UI || 'false',\n  VITE_ENABLE_ANALYTICS: import.meta.env.VITE_ENABLE_ANALYTICS || 'true',\n})\n\n// Typed helper functions\nexport const isFeatureEnabled = (flag: keyof typeof env) => {\n  return env[flag] === 'true'\n}\n\n// Type-safe boolean conversion\nexport const getBooleanEnv = (\n  value: string | undefined,\n  defaultValue = false,\n): boolean => {\n  if (value === undefined) return defaultValue\n  return value === 'true'\n}\n```\n\n### Usage with Type Safety\n\n```typescript\n// src/routes/api-data.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { env, isFeatureEnabled } from '../config/env'\n\nexport const Route = createFileRoute('/api-data')({\n  loader: async () => {\n    // TypeScript knows these are strings and exist\n    const response = await fetch(`${env.VITE_API_URL}/${env.VITE_API_VERSION}/data`)\n    return response.json()\n  },\n  component: () => {\n    return (\n      <div>\n        <h1>{env.VITE_APP_NAME}</h1>\n        {isFeatureEnabled('VITE_ENABLE_NEW_UI') && <NewUIComponent />}\n      </div>\n    )\n  },\n})\n```\n\n## Bundler-Specific Configuration\n\n### Vite Configuration\n\n```typescript\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    react(),\n    // tanstackRouter generates route tree and enables file-based routing\n    tanstackRouter(),\n  ],\n  // Environment variables are handled automatically\n  // Custom environment variable handling:\n  define: {\n    // Global constants (these become available as global variables)\n    __APP_VERSION__: JSON.stringify(process.env.npm_package_version),\n  },\n})\n```\n\n### Webpack Configuration\n\n```typescript\n// webpack.config.js\nconst { TanStackRouterWebpack } = require('@tanstack/router-webpack-plugin')\nconst webpack = require('webpack')\n\nmodule.exports = {\n  plugins: [\n    // TanStackRouterWebpack generates route tree and enables file-based routing\n    new TanStackRouterWebpack(),\n    new webpack.DefinePlugin({\n      // Inject environment variables (use process.env for Webpack)\n      'process.env.API_URL': JSON.stringify(process.env.API_URL),\n      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),\n      'process.env.ENABLE_FEATURE': JSON.stringify(process.env.ENABLE_FEATURE),\n    }),\n  ],\n}\n```\n\n### Rspack Configuration\n\n```typescript\n// rspack.config.js\nconst { TanStackRouterRspack } = require('@tanstack/router-rspack-plugin')\n\nmodule.exports = {\n  plugins: [\n    // TanStackRouterRspack generates route tree and enables file-based routing\n    new TanStackRouterRspack(),\n  ],\n  // Rspack automatically handles PUBLIC_ prefixed variables for import.meta.env\n  // Custom handling for additional variables:\n  builtins: {\n    define: {\n      // Define additional variables (these become global replacements)\n      'process.env.API_URL': JSON.stringify(process.env.PUBLIC_API_URL),\n      __BUILD_TIME__: JSON.stringify(new Date().toISOString()),\n    },\n  },\n}\n```\n\n## Production Checklist\n\n- [ ] All client-exposed variables use appropriate prefix (`VITE_`, `PUBLIC_`, etc.)\n- [ ] No sensitive data (API secrets, private keys) in environment variables\n- [ ] `.env.local` is in `.gitignore`\n- [ ] Production environment variables are configured on hosting platform\n- [ ] Required environment variables are validated at build time\n- [ ] TypeScript declarations are up to date\n- [ ] Feature flags are properly configured for production\n- [ ] API URLs point to production endpoints\n\n## Common Problems\n\n### Environment Variable is Undefined\n\n**Problem**: `import.meta.env.MY_VARIABLE` returns `undefined`\n\n**Solutions**:\n\n1. **Add correct prefix**: Use `VITE_` for Vite, `PUBLIC_` for Rspack.\n   Vite's default prefix may be changed in the config:\n   ```ts\n   // vite.config.ts\n   export const config = {\n     // ...rest of your config\n     envPrefix: 'MYPREFIX_', // this means `MYPREFIX_MY_VARIABLE` is the new correct way\n   }\n   ```\n2. **Restart development server** after adding new variables\n3. **Check file location**: `.env` file must be in project root\n4. **Verify bundler configuration**: Ensure variables are properly injected\n5. **Verify variable**:\n\n- **In dev**: is in correct `.env` file or environment\n- **For prod**: is in correct `.env` file or current environment **_at bundle time_**. That's right, `VITE_`/`PUBLIC_`-prefixed variables are replaced in a macro-like fashion at bundle time, and will _never_ be read at runtime on your server. This is a common mistake, so make sure this is not your case.\n\n**Example**:\n\n```bash\n# ❌ Won't work (no prefix)\nAPI_KEY=abc123\n\n# ✅ Works with Vite\nVITE_API_KEY=abc123\n\n# ✅ Works with Rspack\nPUBLIC_API_KEY=abc123\n\n# ❌ Won't bundle the variable (assuming it is not set in the environment of the build)\nnpm run build\n\n# ✅ Works with Vite and will bundle the variable for production\nVITE_API_KEY=abc123 npm run build\n\n# ✅ Works with Rspack and will bundle the variable for production\nPUBLIC_API_KEY=abc123 npm run build\n```\n\n### Runtime Client Environment Variables at Runtime in Production\n\n**Problem**: If `VITE_`/`PUBLIC_` variables are replaced at bundle time only, how to make runtime variables available on the client ?\n\n**Solutions**:\n\nPass variables from the server down to the client:\n\n1. Add your variable to the correct `env.` file\n2. Create an endpoint on your server to read the value from the client\n\n**Example**:\n\nYou may use your prefered backend framework/libray, but here it is using Tanstack Start server functions:\n\n```tsx\nconst getRuntimeVar = createServerFn({ method: 'GET' }).handler(() => {\n  return process.env.MY_RUNTIME_VAR // notice `process.env` on the server, and no `VITE_`/`PUBLIC_` prefix\n})\n\nexport const Route = createFileRoute('/')({\n  loader: async () => {\n    const foo = await getRuntimeVar()\n    return { foo }\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { foo } = Route.useLoaderData()\n  // ... use your variable however you want\n}\n```\n\n### Variable Not Updating\n\n**Problem**: Environment variable changes aren't reflected in app\n\n**Solutions**:\n\n1. **Restart development server** - Required for new variables\n2. **Check file hierarchy** - `.env.local` overrides `.env`\n3. **Clear browser cache** - Hard refresh (Ctrl+Shift+R)\n4. **Verify correct file** - Make sure you're editing the right `.env` file\n\n### TypeScript Errors\n\n**Problem**: `Property 'VITE_MY_VAR' does not exist on type 'ImportMetaEnv'`\n\n**Solution**: Add declaration to `src/vite-env.d.ts`:\n\n```typescript\ninterface ImportMetaEnv {\n  readonly VITE_MY_VAR: string\n}\n```\n\n### Build Errors\n\n**Problem**: Missing environment variables during build\n\n**Solutions**:\n\n1. **Configure CI/CD**: Set variables in build environment\n2. **Add validation**: Check required variables at build time\n3. **Use .env files**: Ensure production `.env` files exist\n4. **Check bundler config**: Verify environment variable injection\n\n### Security Issues\n\n**Problem**: Accidentally exposing sensitive data\n\n**Solutions**:\n\n1. **Never use secrets in client variables** - They're visible in browser\n2. **Use server-side proxies** for sensitive API calls\n3. **Audit bundle** - Check built files for leaked secrets\n4. **Follow naming conventions** - Only prefixed variables are exposed\n\n### Runtime vs Build-time Confusion\n\n**Problem**: Variables not available at runtime\n\n**Solutions**:\n\n1. **Understand static replacement** - Variables are replaced at build time\n2. **Use server-side for dynamic values** - Use APIs for runtime configuration\n3. **Validate at startup** - Check all required variables exist\n\n### Environment Variables are Always Strings\n\n**Problem**: Unexpected behavior when comparing boolean or numeric values\n\n**Solutions**:\n\n1. **Always compare as strings**: Use `=== 'true'` not `=== true`\n2. **Convert explicitly**: Use `parseInt()`, `parseFloat()`, or `Boolean()`\n3. **Use helper functions**: Create typed conversion utilities\n\n**Example**:\n\n```typescript\n// ❌ Won't work as expected\nconst isEnabled = import.meta.env.VITE_FEATURE_ENABLED // This is a string!\nif (isEnabled) {\n  /* Always true if variable exists */\n}\n\n// ✅ Correct string comparison\nconst isEnabled = import.meta.env.VITE_FEATURE_ENABLED === 'true'\n\n// ✅ Safe numeric conversion\nconst port = parseInt(import.meta.env.VITE_PORT || '3000', 10)\n\n// ✅ Helper function approach\nconst getBooleanEnv = (value: string | undefined, defaultValue = false) => {\n  if (value === undefined) return defaultValue\n  return value.toLowerCase() === 'true'\n}\n```\n\n## Common Next Steps\n\n<!-- [Set Up Authentication](./setup-authentication.md) - Configure auth providers with environment variables -->\n<!-- [Deploy to Production](./deploy-to-production.md) - Set up production environment variables -->\n<!-- [Set Up API Integration](./setup-api-integration.md) - Configure API endpoints and keys -->\n\n## Related Resources\n\n- [TanStack Router File-Based Routing](../routing/file-based-routing.md) - Learn about route configuration\n- [Vite Environment Variables](https://vitejs.dev/guide/env-and-mode.html) - Official Vite documentation\n- [Webpack DefinePlugin](https://webpack.js.org/plugins/define-plugin/) - Webpack environment configuration\n"
  },
  {
    "path": "docs/router/how-to/validate-search-params.md",
    "content": "---\ntitle: Validate Search Parameters with Schemas\n---\n\nLearn how to add robust schema validation to your search parameters using popular validation libraries like Zod, Valibot, and ArkType. This guide covers validation setup, error handling, type safety, and common validation patterns for production applications.\n\n**Prerequisites:** [Set Up Basic Search Parameters](./setup-basic-search-params.md) - Foundation concepts for reading and working with search params.\n\n## Quick Start\n\nAdd robust validation with custom error messages, complex types, and production-ready error handling:\n\n```tsx\nimport { createFileRoute, useRouter } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  query: z.string().min(1, 'Search query required'),\n  category: z.enum(['electronics', 'clothing', 'books', 'home']).optional(),\n  minPrice: z.number().min(0, 'Price cannot be negative').default(0),\n  maxPrice: z.number().min(0, 'Price cannot be negative').default(1000),\n  inStock: z.boolean().default(true),\n  tags: z.array(z.string()).optional(),\n  dateRange: z\n    .object({\n      start: z.string().datetime().optional(),\n      end: z.string().datetime().optional(),\n    })\n    .optional(),\n})\n\nexport const Route = createFileRoute('/products')({\n  validateSearch: productSearchSchema,\n  errorComponent: ({ error }) => {\n    const router = useRouter()\n    return (\n      <div className=\"error\">\n        <h2>Invalid Search Parameters</h2>\n        <p>{error.message}</p>\n        <button\n          onClick={() => router.navigate({ to: '/products', search: {} })}\n        >\n          Reset Search\n        </button>\n      </div>\n    )\n  },\n  component: ProductsPage,\n})\n\nfunction ProductsPage() {\n  // All search params are validated, type-safe, and have fallback values applied\n  const { query, category, minPrice, maxPrice, inStock, tags, dateRange } =\n    Route.useSearch()\n\n  return (\n    <div>\n      <h1>Products</h1>\n      <p>Search: {query}</p>\n      <p>Category: {category || 'All'}</p>\n      <p>\n        Price Range: ${minPrice} - ${maxPrice}\n      </p>\n      <p>In Stock Only: {inStock ? 'Yes' : 'No'}</p>\n      {tags && <p>Tags: {tags.join(', ')}</p>}\n      {dateRange && (\n        <p>\n          Date Range: {dateRange.start} to {dateRange.end}\n        </p>\n      )}\n    </div>\n  )\n}\n```\n\n## Validation Library Options\n\nTanStack Router supports multiple validation libraries through adapters:\n\n### Zod (Recommended)\n\nMost popular with excellent TypeScript integration. For Zod v3, use `@tanstack/zod-adapter` for validation:\n\n```tsx\nimport { zodValidator, fallback } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  query: z.string().min(1).max(100),\n  page: fallback(z.number().int().positive(), 1),\n  sortBy: z.enum(['name', 'date', 'relevance']).optional(),\n  filters: z.array(z.string()).optional(),\n})\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: zodValidator(searchSchema),\n  component: SearchPage,\n})\n```\n\nFor Zod v4, the adapter is no longer necessary:\n\n```tsx\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  query: z.string().min(1).max(100),\n  page: z.number().int().positive().default(1),\n  sortBy: z.enum(['name', 'date', 'relevance']).optional(),\n  filters: z.array(z.string()).optional(),\n})\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: searchSchema,\n  component: SearchPage,\n})\n```\n\n### Valibot\n\nLightweight alternative with modular design:\n\n```tsx\nimport { valibotValidator } from '@tanstack/valibot-adapter'\nimport * as v from 'valibot'\n\nconst searchSchema = v.object({\n  query: v.pipe(v.string(), v.minLength(1), v.maxLength(100)),\n  page: v.fallback(v.pipe(v.number(), v.integer(), v.minValue(1)), 1),\n  sortBy: v.optional(v.picklist(['name', 'date', 'relevance'])),\n  filters: v.optional(v.array(v.string())),\n})\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: valibotValidator(searchSchema),\n  component: SearchPage,\n})\n```\n\n### ArkType\n\nTypeScript-first with runtime validation:\n\n```tsx\nimport { type } from 'arktype'\n\nconst searchSchema = type({\n  query: 'string>0&<=100',\n  page: 'number>0 = 1',\n  'sortBy?': \"'name'|'date'|'relevance'\",\n  'filters?': 'string[]',\n})\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: searchSchema,\n  component: SearchPage,\n})\n```\n\n### Custom Validation Function\n\nFor complete control, implement your own validation logic:\n\n```tsx\nexport const Route = createFileRoute('/search')({\n  validateSearch: (search: Record<string, unknown>) => {\n    // Custom validation with detailed error handling\n    const result = {\n      page: 1,\n      query: '',\n      category: 'all',\n    }\n\n    // Validate page number\n    const pageNum = Number(search.page)\n    if (isNaN(pageNum) || pageNum < 1) {\n      throw new Error('Page must be a positive number')\n    }\n    result.page = pageNum\n\n    // Validate query string\n    if (typeof search.query === 'string' && search.query.length > 0) {\n      if (search.query.length > 100) {\n        throw new Error('Search query too long (max 100 characters)')\n      }\n      result.query = search.query\n    }\n\n    // Validate category\n    const validCategories = ['electronics', 'clothing', 'books', 'all']\n    if (\n      typeof search.category === 'string' &&\n      validCategories.includes(search.category)\n    ) {\n      result.category = search.category\n    }\n\n    return result\n  },\n  component: SearchPage,\n})\n```\n\n## Common Validation Patterns\n\n### Required vs Optional Parameters\n\nControl which search parameters are mandatory:\n\n```tsx\nconst validationSchema = z.object({\n  // Required - will throw validation error if missing or invalid\n  userId: z.number().int().positive(),\n  action: z.enum(['view', 'edit', 'delete']),\n\n  // Optional - can be undefined\n  sortBy: z.string().optional(),\n\n  // Optional with fallback - provides default if missing/invalid\n  page: fallback(z.number().int().positive(), 1),\n  limit: fallback(z.number().int().min(1).max(100), 20),\n})\n```\n\n### Complex Data Types\n\nHandle arrays, objects, and custom types:\n\n```tsx\nconst advancedSchema = z.object({\n  // Array of strings\n  tags: z.array(z.string()).optional(),\n\n  // Array of numbers\n  categoryIds: z.array(z.number().int()).optional(),\n\n  // Date validation\n  startDate: z.string().datetime().optional(),\n  endDate: z.string().datetime().optional(),\n\n  // Custom validation\n  email: z.string().email().optional(),\n\n  // Refined validation with custom logic\n  priceRange: z\n    .object({\n      min: z.number().min(0),\n      max: z.number().min(0),\n    })\n    .refine((data) => data.max >= data.min, {\n      message: 'Max price must be greater than or equal to min price',\n    })\n    .optional(),\n})\n```\n\n### Input Transformation\n\nTransform and sanitize input values during validation:\n\n```tsx\nconst transformSchema = z.object({\n  // Transform string to number\n  page: z\n    .string()\n    .transform((val) => parseInt(val, 10))\n    .pipe(z.number().int().positive()),\n\n  // Transform and validate email\n  email: z.string().toLowerCase().trim().pipe(z.string().email()).optional(),\n\n  // Transform comma-separated string to array\n  tags: z\n    .string()\n    .transform((val) => (val ? val.split(',').map((tag) => tag.trim()) : []))\n    .pipe(z.array(z.string().min(1)))\n    .optional(),\n})\n```\n\n## Error Handling Strategies\n\n### Basic Error Handling\n\nHandle validation errors through route error components:\n\n```tsx\nimport { createFileRoute, useRouter } from '@tanstack/react-router'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  query: z.string().min(1, 'Search query is required'),\n  page: z.number().int().positive('Page must be a positive number'),\n})\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: zodValidator(searchSchema),\n  errorComponent: ({ error }) => {\n    const router = useRouter()\n\n    return (\n      <div className=\"error\">\n        <h2>Invalid Search Parameters</h2>\n        <p>{error.message}</p>\n        <button onClick={() => router.navigate({ to: '/search', search: {} })}>\n          Reset Search\n        </button>\n        <button\n          onClick={() =>\n            router.navigate({ to: '/search', search: { query: '', page: 1 } })\n          }\n        >\n          Start Over\n        </button>\n      </div>\n    )\n  },\n  component: SearchPage,\n})\n\nfunction SearchPage() {\n  // Only called when validation succeeds\n  const search = Route.useSearch()\n  // ... rest of component\n}\n```\n\n### Custom Error Messages\n\nProvide user-friendly validation messages:\n\n```tsx\nconst userFriendlySchema = z.object({\n  query: z\n    .string()\n    .min(2, 'Search query must be at least 2 characters')\n    .max(100, 'Search query cannot exceed 100 characters'),\n\n  page: fallback(\n    z\n      .number()\n      .int('Page must be a whole number')\n      .positive('Page must be greater than 0'),\n    1,\n  ),\n\n  category: z\n    .enum(['electronics', 'clothing', 'books'], {\n      errorMap: () => ({ message: 'Please select a valid category' }),\n    })\n    .optional(),\n})\n```\n\n### Validation Error Recovery\n\nImplement fallback behavior for invalid parameters:\n\n```tsx\nconst resilientSchema = z.object({\n  // Use .catch() to provide fallback values on validation failure\n  page: z.number().int().positive().catch(1),\n\n  // Use .default() for missing values, .catch() for invalid values\n  sortBy: z\n    .enum(['name', 'date', 'relevance'])\n    .default('relevance')\n    .catch('relevance'),\n\n  // Custom recovery logic\n  dateRange: z\n    .object({\n      start: z.string().datetime(),\n      end: z.string().datetime(),\n    })\n    .catch({\n      start: new Date().toISOString(),\n      end: new Date().toISOString(),\n    })\n    .optional(),\n})\n```\n\n## Advanced Validation Techniques\n\n### Conditional Validation\n\nApply different validation rules based on other parameters:\n\n```tsx\nconst conditionalSchema = z\n  .object({\n    searchType: z.enum(['basic', 'advanced']),\n    query: z.string().min(1),\n  })\n  .and(\n    z.discriminatedUnion('searchType', [\n      z.object({\n        searchType: z.literal('basic'),\n        // Basic search requires only query\n      }),\n      z.object({\n        searchType: z.literal('advanced'),\n        // Advanced search requires additional fields\n        category: z.string().min(1),\n        minPrice: z.number().min(0),\n        maxPrice: z.number().min(0),\n      }),\n    ]),\n  )\n```\n\n### Schema Composition\n\nCombine and extend schemas for reusability:\n\n```tsx\n// Base pagination schema\nconst paginationSchema = z.object({\n  page: fallback(z.number().int().positive(), 1),\n  limit: fallback(z.number().int().min(1).max(100), 20),\n})\n\n// Base filter schema\nconst filterSchema = z.object({\n  sortBy: z.enum(['name', 'date', 'relevance']).optional(),\n  sortOrder: z.enum(['asc', 'desc']).optional(),\n})\n\n// Compose schemas for different routes\nconst productSearchSchema = paginationSchema.extend({\n  category: z.string().optional(),\n  inStock: fallback(z.boolean(), true),\n})\n\nconst userSearchSchema = paginationSchema.merge(filterSchema).extend({\n  role: z.enum(['admin', 'user', 'moderator']).optional(),\n  isActive: fallback(z.boolean(), true),\n})\n```\n\n### Performance Optimization\n\nOptimize validation for better performance:\n\n```tsx\n// Pre-compile schemas for better performance\nconst compiledSchema = zodValidator(\n  z.object({\n    query: z.string().min(1),\n    page: fallback(z.number().int().positive(), 1),\n  }),\n)\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: compiledSchema,\n  component: SearchPage,\n})\n\n// Use selective validation for expensive operations\nfunction SearchPage() {\n  // Only validate specific fields when needed\n  const search = Route.useSearch({\n    select: (search) => ({\n      query: search.query,\n      page: search.page,\n    }),\n  })\n\n  return <div>Search Results</div>\n}\n```\n\n## Testing Search Parameter Validation\n\nFocus on testing validation behavior specific to your schemas:\n\n```tsx\nimport { render, screen, waitFor } from '@testing-library/react'\nimport {\n  createRouter,\n  createMemoryHistory,\n  RouterProvider,\n} from '@tanstack/react-router'\n\ndescribe('Search Validation Behavior', () => {\n  it('should show error component when validation fails', async () => {\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/search?page=invalid&query='],\n      }),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByText('Invalid Search Parameters')).toBeInTheDocument()\n    })\n  })\n\n  it('should apply fallback values correctly', async () => {\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/search?query=laptops'], // page missing\n      }),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByText('Page: 1')).toBeInTheDocument() // Fallback applied\n    })\n  })\n})\n```\n\n**For comprehensive route testing patterns, see:** [Set Up Testing](./setup-testing.md) and [Test File-Based Routing](./test-file-based-routing.md)\n\n## Common Problems\n\n### Problem: Validation errors break the entire route\n\n**Symptoms:** Page fails to load when URL contains invalid search parameters.\n\n**Solution:** Use fallback values and error boundaries:\n\n```tsx\n// ❌ Wrong - will throw error and break route\nconst strictSchema = z.object({\n  page: z.number().int().positive(), // No fallback\n})\n\n// ✅ Correct - provides fallback for invalid values\nconst resilientSchema = z.object({\n  page: fallback(z.number().int().positive(), 1),\n})\n\n// ✅ Alternative - use errorComponent on route\nexport const Route = createFileRoute('/search')({\n  validateSearch: resilientSchema,\n  errorComponent: ({ error }) => <SearchError error={error} />,\n  component: SearchPage,\n})\n\nfunction SearchPage() {\n  // Only called when validation succeeds\n  const search = Route.useSearch()\n  return <SearchResults search={search} />\n}\n```\n\n### Problem: TypeScript errors with optional search parameters\n\n**Symptoms:** TypeScript complains about potentially undefined values.\n\n**Solution:** Use proper optional handling or fallback values:\n\n```tsx\n// ❌ Wrong - category might be undefined\nfunction FilterBar() {\n  const { category } = Route.useSearch()\n  return <span>{category.toUpperCase()}</span> // TypeScript error\n}\n\n// ✅ Correct - handle optional values\nfunction FilterBar() {\n  const { category } = Route.useSearch()\n  return <span>{category?.toUpperCase() || 'All Categories'}</span>\n}\n\n// ✅ Better - use fallback in schema\nconst schema = z.object({\n  category: fallback(z.string(), 'all'),\n})\n```\n\n### Problem: Search parameter arrays not parsing correctly\n\n**Symptoms:** Array values appear as strings instead of arrays.\n\n**Solution:** Ensure proper array parsing in your schema:\n\n```tsx\n// ❌ Wrong - doesn't handle URL array format\nconst badSchema = z.object({\n  tags: z.array(z.string()).optional(),\n})\n\n// ✅ Correct - parse comma-separated values or multiple params\nconst goodSchema = z.object({\n  tags: z\n    .union([\n      z.array(z.string()), // Multiple ?tags=a&tags=b\n      z.string().transform((val) => val.split(',')), // Single ?tags=a,b,c\n    ])\n    .optional(),\n})\n\n// ✅ Alternative - custom preprocessing\nconst preprocessedSchema = z.preprocess((val) => {\n  if (typeof val === 'string') return val.split(',')\n  return val\n}, z.array(z.string()).optional())\n```\n\n### Problem: Schema validation is too slow\n\n**Symptoms:** Noticeable delay when navigating with complex search parameters.\n\n**Solution:** Optimize schema complexity and use selective parsing:\n\n```tsx\n// ❌ Slow - complex validation on every navigation\nconst complexSchema = z.object({\n  query: z.string().refine(async (val) => await validateQuery(val)),\n  // ... many complex validations\n})\n\n// ✅ Fast - simplified validation with lazy refinement\nconst optimizedSchema = z.object({\n  query: z.string().min(1), // Basic validation only\n  // ... other simple validations\n})\n\n// Perform complex validation separately in component\nfunction SearchPage() {\n  const search = Route.useSearch()\n\n  // Complex validation only when needed\n  const [complexValidation, setComplexValidation] = useState(null)\n\n  useEffect(() => {\n    validateComplexRules(search).then(setComplexValidation)\n  }, [search])\n\n  return <SearchResults search={search} validation={complexValidation} />\n}\n```\n\n## Common Next Steps\n\nAfter setting up schema validation, you might want to:\n\n- [Work with Arrays, Objects, and Dates](./arrays-objects-dates-search-params.md) - Handle arrays, objects, dates, and nested data structures\n\n<!-- Uncomment when guides are available\n- [Share Search Parameters Across Routes](./share-search-params-across-routes.md) - Inherit and manage search params across route hierarchies\n- [Debug Search Parameter Issues](./debug-search-param-issues.md) - Troubleshoot validation problems and performance issues\n-->\n\n## Related Resources\n\n- [TanStack Zod Adapter Documentation](https://tanstack.com/router/latest/docs/framework/react/guide/search-params#zod-adapter)\n- [TanStack Valibot Adapter Documentation](https://tanstack.com/router/latest/docs/framework/react/guide/search-params#valibot-adapter)\n- [Zod Documentation](https://zod.dev/) - Schema validation library\n- [Valibot Documentation](https://valibot.dev/) - Lightweight validation library\n- [ArkType Documentation](https://arktype.io/) - TypeScript-first validation\n"
  },
  {
    "path": "docs/router/installation/manual.md",
    "content": "---\ntitle: Manual Setup\n---\n\nTo set up TanStack Router manually in a React project, follow the steps below. This gives you a bare minimum setup to get going with TanStack Router using both file-based route generation and code-based route configuration:\n\n## Using File-Based Route Generation\n\n#### Install TanStack Router, Vite Plugin, and the Router Devtools\n\nInstall the necessary core dependencies:\n\n<!-- ::start:tabs variant=\"package-managers\" -->\n\nreact: @tanstack/react-router @tanstack/react-router-devtools\nsolid: @tanstack/solid-router @tanstack/solid-router-devtools\n\n<!-- ::end:tabs -->\n\nInstall the necessary development dependencies:\n\n<!-- ::start:tabs variant=\"package-managers\" mode=\"dev-install\" -->\n\nreact: @tanstack/router-plugin\nsolid: @tanstack/router-plugin\n\n<!-- ::end:tabs -->\n\n#### Configure the Vite Plugin\n\n```tsx\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    // Please make sure that '@tanstack/router-plugin' is passed before '@vitejs/plugin-react'\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n    // ...,\n  ],\n})\n```\n\n> [!TIP]\n> If you are not using Vite, or any of the supported bundlers, you can check out the [TanStack Router CLI](./with-router-cli) guide for more info.\n\nCreate the following files:\n\n- `src/routes/__root.tsx` (with two '`_`' characters)\n- `src/routes/index.tsx`\n- `src/routes/about.tsx`\n- `src/main.tsx`\n\n<!-- ::start:framework -->\n\n# React\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\nimport { createRootRoute, Link, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nconst RootLayout = () => (\n  <>\n    <div className=\"p-2 flex gap-2\">\n      <Link to=\"/\" className=\"[&.active]:font-bold\">\n        Home\n      </Link>{' '}\n      <Link to=\"/about\" className=\"[&.active]:font-bold\">\n        About\n      </Link>\n    </div>\n    <hr />\n    <Outlet />\n    <TanStackRouterDevtools />\n  </>\n)\n\nexport const Route = createRootRoute({ component: RootLayout })\n```\n\n```tsx title=\"src/routes/index.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Index,\n})\n\nfunction Index() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n```\n\n```tsx title=\"src/routes/about.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: About,\n})\n\nfunction About() {\n  return <div className=\"p-2\">Hello from About!</div>\n}\n```\n\n```tsx title=\"src/main.tsx\"\nimport { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a new router instance\nconst router = createRouter({ routeTree })\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\n// Render the app\nconst rootElement = document.getElementById('root')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n```\n\n<!-- ::end:tabs -->\n\n# Solid\n\n<!-- ::start:tabs variant=\"files\" -->\n\n```tsx title=\"src/routes/__root.tsx\"\nimport { createRootRoute, Link, Outlet } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nconst RootLayout = () => (\n  <>\n    <div class=\"p-2 flex gap-2\">\n      <Link to=\"/\" class=\"[&.active]:font-bold\">\n        Home\n      </Link>{' '}\n      <Link to=\"/about\" class=\"[&.active]:font-bold\">\n        About\n      </Link>\n    </div>\n    <hr />\n    <Outlet />\n    <TanStackRouterDevtools />\n  </>\n)\n\nexport const Route = createRootRoute({ component: RootLayout })\n```\n\n```tsx title=\"src/routes/index.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Index,\n})\n\nfunction Index() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n```\n\n```tsx title=\"src/routes/about.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/about')({\n  component: About,\n})\n\nfunction About() {\n  return <div class=\"p-2\">Hello from About!</div>\n}\n```\n\n```tsx title=\"src/main.tsx\"\n/* @refresh reload */\nimport { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a new router instance\nconst router = createRouter({ routeTree })\n\n// Register the router instance for type safety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\n// Render the app\nconst rootElement = document.getElementById('root')!\n\nrender(() => <RouterProvider router={router} />, rootElement)\n```\n\n<!-- ::end:tabs -->\n\n<!-- ::end:framework -->\n\nRegardless of whether you are using the `@tanstack/router-plugin` package and running the `npm run dev`/`npm run build` scripts, or manually running the `tsr watch`/`tsr generate` commands from your package scripts, the route tree file will be generated at `src/routeTree.gen.ts`.\n\nIf you are working with this pattern you should change the `id` of the root `<div>` on your `index.html` file to `<div id='root'></div>`\n\n## Using Code-Based Route Configuration\n\n> [!IMPORTANT]\n> 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.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  Outlet,\n  RouterProvider,\n  Link,\n  createRouter,\n  createRoute,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nconst rootRoute = createRootRoute({\n  component: () => (\n    <>\n      <div className=\"p-2 flex gap-2\">\n        <Link to=\"/\" className=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" className=\"[&.active]:font-bold\">\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: function Index() {\n    return (\n      <div className=\"p-2\">\n        <h3>Welcome Home!</h3>\n      </div>\n    )\n  },\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  component: function About() {\n    return <div className=\"p-2\">Hello from About!</div>\n  },\n})\n\nconst routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\nconst router = createRouter({ routeTree })\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n```\n\n# Solid\n\n```tsx\n/* @refresh reload */\nimport { render } from 'solid-js/web'\nimport {\n  Outlet,\n  RouterProvider,\n  Link,\n  createRouter,\n  createRoute,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nconst rootRoute = createRootRoute({\n  component: () => (\n    <>\n      <div class=\"p-2 flex gap-2\">\n        <Link to=\"/\" class=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" class=\"[&.active]:font-bold\">\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: function Index() {\n    return (\n      <div class=\"p-2\">\n        <h3>Welcome Home!</h3>\n      </div>\n    )\n  },\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  component: function About() {\n    return <div class=\"p-2\">Hello from About!</div>\n  },\n})\n\nconst routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\nconst router = createRouter({ routeTree })\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\nrender(() => <RouterProvider router={router} />, rootElement)\n```\n\n<!-- ::end:framework -->\n\nIf 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.\n"
  },
  {
    "path": "docs/router/installation/migrate-from-react-location.md",
    "content": "---\ntitle: Migration from React Location\n---\n\nBefore you begin your journey in migrating from React Location, it's important that you have a good understanding of the [Routing Concepts](../routing/routing-concepts.md) and [Design Decisions](../decisions-on-dx.md) used by TanStack Router.\n\n## Differences between React Location and TanStack Router\n\nReact Location and TanStack Router share much of same design decisions concepts, but there are some key differences that you should be aware of.\n\n- React Location uses _generics_ to infer types for routes, while TanStack Router uses _module declaration merging_ to infer types.\n- 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](../routing/routing-concepts.md#the-root-route).\n- [File-based routing](../routing/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.\n  - TanStack Router does support a [code-based approach](../routing/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#why-is-file-based-routing-the-preferred-way-to-define-routes)\n\n## Migration guide\n\nIn 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).\n\n> [!TIP]\n> To use a code-based approach for defining your routes, you can read the [code-based Routing](../routing/code-based-routing.md) guide.\n\n### Step 1: Swap over to TanStack Router's dependencies\n\nFirst, we need to install the dependencies for TanStack Router. For detailed installation instructions, see our [How to Install TanStack Router](../how-to/install.md) guide.\n\n```sh\nnpm install @tanstack/react-router @tanstack/router-devtools\n```\n\nAnd remove the React Location dependencies.\n\n```sh\nnpm uninstall @tanstack/react-location @tanstack/react-location-devtools\n```\n\n### Step 2: Use the file-based routing watcher\n\nIf your project uses Vite (or one of the supported bundlers), you can use the TanStack Router plugin to watch for changes in your routes files and automatically update the routes configuration.\n\nInstallation of the Vite plugin:\n\n```sh\nnpm install -D @tanstack/router-plugin\n```\n\nAnd add it to your `vite.config.js`:\n\n```js\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  // ...\n  plugins: [tanstackRouter(), react()],\n})\n```\n\nHowever, if your application does not use Vite, you use one of our other [supported bundlers](../routing/file-based-routing.md#getting-started-with-file-based-routing), or you can use the `@tanstack/router-cli` package to watch for changes in your routes files and automatically update the routes configuration.\n\n### Step 3: Add the file-based configuration file to your project\n\nCreate a `tsr.config.json` file in the root of your project with the following content:\n\n```json\n{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\"\n}\n```\n\nYou can find the full list of options for the `tsr.config.json` file in the [File-Based Routing](../routing/file-based-routing.md) guide.\n\n### Step 4: Create the routes directory\n\nCreate a `routes` directory in the `src` directory of your project.\n\n```sh\nmkdir src/routes\n```\n\n### Step 5: Create the root route file\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Outlet, Link } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/router-devtools'\n\nexport const Route = createRootRoute({\n  component: () => {\n    return (\n      <>\n        <div>\n          <Link to=\"/\" activeOptions={{ exact: true }}>\n            Home\n          </Link>\n          <Link to=\"/posts\">Posts</Link>\n        </div>\n        <hr />\n        <Outlet />\n        <TanStackRouterDevtools />\n      </>\n    )\n  },\n})\n```\n\n### Step 6: Create the index route file\n\n```tsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Index,\n})\n```\n\n> 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.\n\n### Step 7: Create the posts route file\n\n```tsx\n// src/routes/posts.tsx\nimport { createFileRoute, Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  component: Posts,\n  loader: async () => {\n    const posts = await fetchPosts()\n    return {\n      posts,\n    }\n  },\n})\n\nfunction Posts() {\n  const { posts } = Route.useLoaderData()\n  return (\n    <div>\n      <nav>\n        {posts.map((post) => (\n          <Link\n            key={post.id}\n            to={`/posts/$postId`}\n            params={{ postId: post.id }}\n          >\n            {post.title}\n          </Link>\n        ))}\n      </nav>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n> 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.\n\n### Step 8: Create the posts index route file\n\n```tsx\n// src/routes/posts.index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndex,\n})\n```\n\n> 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.\n\n### Step 9: Create the posts id route file\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostsId,\n  loader: async ({ params: { postId } }) => {\n    const post = await fetchPost(postId)\n    return {\n      post,\n    }\n  },\n})\n\nfunction PostsId() {\n  const { post } = Route.useLoaderData()\n  // ...\n}\n```\n\n> 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.\n\n### Step 10: Generate the route tree\n\nIf you are using one of the supported bundlers, the route tree will be generated automatically when you run the dev script.\n\nIf you are not using one of the supported bundlers, you can generate the route tree by running the following command:\n\n```sh\nnpx tsr generate\n```\n\n### Step 11: Update the main entry file to render the Router\n\nOnce you've generated the route-tree, you can then update the `src/index.tsx` file to create the router instance and render it.\n\n```tsx\n// src/index.tsx\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport { createRouter, RouterProvider } from '@tanstack/react-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a new router instance\nconst router = createRouter({ routeTree })\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst domElementId = 'root' // Assuming you have a root element with the id 'root'\n\n// Render the app\nconst rootElement = document.getElementById(domElementId)\nif (!rootElement) {\n  throw new Error(`Element with id ${domElementId} not found`)\n}\n\nReactDOM.createRoot(rootElement).render(\n  <React.StrictMode>\n    <RouterProvider router={router} />\n  </React.StrictMode>,\n)\n```\n\n### Finished!\n\nYou should now have successfully migrated your application from React Location to TanStack Router using file-based routing.\n\nReact 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:\n\n- [Search params](../guide/search-params.md)\n- [Data loading](../guide/data-loading.md)\n- [History types](../guide/history-types.md)\n- [Wildcard / Splat / Catch-all routes](../routing/routing-concepts.md#splat--catch-all-routes)\n- [Authenticated routes](../guide/authenticated-routes.md)\n\nTanStack Router also has a few more features that you might want to explore:\n\n- [Router Context](../guide/router-context.md)\n- [Preloading](../guide/preloading.md)\n- [Pathless Layout Routes](../routing/routing-concepts.md#pathless-layout-routes)\n- [Route masking](../guide/route-masking.md)\n- [SSR](../guide/ssr.md)\n- ... and more!\n\nIf you are facing any issues or have any questions, feel free to ask for help in the TanStack Discord.\n"
  },
  {
    "path": "docs/router/installation/migrate-from-react-router.md",
    "content": "---\ntitle: Migration from React Router Checklist\ntoc: false\n---\n\n**_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._**\n\nHere is the [example repo](https://github.com/Benanna2019/SickFitsForEveryone/tree/migrate-to-tanstack/router/React-Router)\n\n- [ ] Install Router - `npm i @tanstack/react-router` (see [detailed installation guide](../how-to/install.md))\n- [ ] **Optional:** Uninstall React Router to get TypeScript errors on imports.\n  - 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.\n  - 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.\n- [ ] Create Routes for each existing React Router route we have\n- [ ] Create root route\n- [ ] Create router instance\n- [ ] Add global module in main.tsx\n- [ ] Remove any React Router (`createBrowserRouter` or `BrowserRouter`), `Routes`, and `Route` Components from main.tsx\n- [ ] **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\n- [ ] Set RouterProvider and pass it the router as the prop\n- [ ] Replace all instances of React Router `Link` component with `@tanstack/react-router` `Link` component\n  - [ ] Add `to` prop with literal path\n  - [ ] Add `params` prop, where necessary with params like so `params={{ orderId: order.id }}`\n- [ ] Replace all instances of React Router `useNavigate` hook with `@tanstack/react-router` `useNavigate` hook\n  - [ ] Set `to` property and `params` property where needed\n- [ ] Replace any React Router `Outlet`'s with the `@tanstack/react-router` equivalent\n- [ ] If you are using `useSearchParams` hook from React Router, move the search params default value to the validateSearch property on a Route definition.\n  - [ ] Instead of using the `useSearchParams` hook, use `@tanstack/react-router` `Link`'s search property to update the search params state\n  - [ ] To read search params you can do something like the following\n    - `const { page } = useSearch({ from: productPage.fullPath })`\n- [ ] 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\n  - So say we have a route with the path name `orders/$orderid`.\n  - In the `useParams` hook we would set up our hook like so: `const params = useParams({ from: \"/orders/$orderId\" })`\n  - Then wherever we wanted to access the order id we would get it off of the params object `params.orderId`\n"
  },
  {
    "path": "docs/router/installation/with-esbuild.md",
    "content": "---\ntitle: Installation with Esbuild\n---\n\nTo use file-based routing with **Esbuild**, you'll need to install the `@tanstack/router-plugin` package.\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"dev-install\" -->\n\nreact: @tanstack/router-plugin\nsolid: @tanstack/router-plugin\n\n<!-- ::end:tabs -->\n\nOnce installed, you'll need to add the plugin to your configuration.\n\n<!-- ::start:framework -->\n\n# React\n\n```ts title=\"esbuild.config.js\"\nimport { tanstackRouter } from '@tanstack/router-plugin/esbuild'\n\nexport default {\n  // ...\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n  ],\n}\n```\n\nOr, you can clone our [Quickstart Esbuild example](https://github.com/TanStack/router/tree/main/examples/react/quickstart-esbuild-file-based) and get started.\n\n# Solid\n\n```ts title=\"build.js\"\nimport * as esbuild from 'esbuild'\nimport { solidPlugin } from 'esbuild-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/esbuild'\n\nconst isDev = process.argv.includes('--dev')\n\nconst ctx = await esbuild.context({\n  entryPoints: ['src/main.tsx'],\n  outfile: 'dist/main.js',\n  minify: !isDev,\n  bundle: true,\n  format: 'esm',\n  target: ['esnext'],\n  sourcemap: true,\n  plugins: [\n    solidPlugin(),\n    tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n  ],\n})\n\nif (isDev) {\n  await ctx.watch()\n  const { host, port } = await ctx.serve({ servedir: '.', port: 3005 })\n  console.log(`Server running at http://${host || 'localhost'}:${port}`)\n} else {\n  await ctx.rebuild()\n  await ctx.dispose()\n}\n```\n\nOr, you can clone our [Quickstart Esbuild example](https://github.com/TanStack/router/tree/main/examples/solid/quickstart-esbuild-file-based) and get started.\n\n<!-- ::end:framework -->\n\nNow that you've added the plugin to your Esbuild configuration, you're all set to start using file-based routing with TanStack Router.\n\n## Ignoring the generated route tree file\n\nIf your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.\n\nHere are some resources to help you ignore the generated route tree file:\n\n- Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)\n- ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)\n- Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)\n\n> [!WARNING]\n> If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.\n\nYou can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:\n\n```json\n{\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n```\n\nYou can use those settings either at a user level or only for a single workspace by creating the file `.vscode/settings.json` at the root of your project.\n\n## Configuration\n\nWhen using the TanStack Router Plugin with Esbuild for File-based routing, it comes with some sane defaults that should work for most projects:\n\n```json\n{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"routeFileIgnorePrefix\": \"-\",\n  \"quoteStyle\": \"single\"\n}\n```\n\nIf these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by editing the configuration object passed into the `tanstackRouter` function.\n\nYou can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).\n"
  },
  {
    "path": "docs/router/installation/with-router-cli.md",
    "content": "---\ntitle: Installation with Router CLI\n---\n\n> [!WARNING]\n> You should only use the TanStack Router CLI if you are not using a supported bundler. The CLI only supports the generation of the route tree file and does not provide any other features.\n\nTo use file-based routing with the TanStack Router CLI, you'll need to install the `@tanstack/router-cli` package.\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"dev-install\" -->\n\nreact: @tanstack/router-cli\nsolid: @tanstack/router-cli\n\n<!-- ::end:tabs -->\n\nOnce installed, you'll need to amend your scripts in your `package.json` for the CLI to `watch` and `generate` files.\n\n```json\n{\n  \"scripts\": {\n    \"generate-routes\": \"tsr generate\",\n    \"watch-routes\": \"tsr watch\",\n    \"build\": \"npm run generate-routes && ...\",\n    \"dev\": \"npm run watch-routes && ...\"\n  }\n}\n```\n\n<!-- ::start:framework -->\n\n# Solid\n\nIf you are using TypeScript, you should also add the following options to your `tsconfig.json`:\n\n```json\n{\n  \"compilerOptions\": {\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\"\n  }\n}\n```\n\nWith that, you're all set to start using file-based routing with TanStack Router.\n\n<!-- ::end:framework -->\n\n[//]: # 'AfterScripts'\n[//]: # 'AfterScripts'\n\nYou shouldn't forget to _ignore_ the generated route tree file. Head over to the [Ignoring the generated route tree file](#ignoring-the-generated-route-tree-file) section to learn more.\n\nWith the CLI installed, the following commands are made available via the `tsr` command\n\n## Using the `generate` command\n\nGenerates the routes for a project based on the provided configuration.\n\n```sh\ntsr generate\n```\n\n## Using the `watch` command\n\nContinuously watches the specified directories and regenerates routes as needed.\n\n**Usage:**\n\n```sh\ntsr watch\n```\n\nWith file-based routing enabled, whenever you start your application in development mode, TanStack Router will watch your configured `routesDirectory` and generate your route tree whenever a file is added, removed, or changed.\n\n## Ignoring the generated route tree file\n\nIf your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.\n\nHere are some resources to help you ignore the generated route tree file:\n\n- Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)\n- ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)\n- Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)\n\n> [!WARNING]\n> If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.\n\nYou can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:\n\n```json\n{\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n```\n\nYou can use those settings either at a user level or only for a single workspace by creating the file `.vscode/settings.json` at the root of your project.\n\n## Configuration\n\nWhen using the TanStack Router CLI for File-based routing, it comes with some sane defaults that should work for most projects:\n\n<!-- ::start:framework -->\n\n# React\n\n```json\n{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"routeFileIgnorePrefix\": \"-\",\n  \"quoteStyle\": \"single\",\n  \"target\": \"react\"\n}\n```\n\n# Solid\n\n```json\n{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"routeFileIgnorePrefix\": \"-\",\n  \"quoteStyle\": \"single\",\n  \"target\": \"solid\"\n}\n```\n\n<!-- ::end:framework -->\n\nIf these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by creating a `tsr.config.json` file in the root of your project directory.\n\nYou can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).\n"
  },
  {
    "path": "docs/router/installation/with-rspack.md",
    "content": "---\ntitle: Installation with Rspack\n---\n\nTo use file-based routing with **Rspack** or **Rsbuild**, you'll need to install the `@tanstack/router-plugin` package.\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"dev-install\" -->\n\nreact: @tanstack/router-plugin\nsolid: @tanstack/router-plugin\n\n<!-- ::end:tabs -->\n\nOnce installed, you'll need to add the plugin to your configuration.\n\n<!-- ::start:framework -->\n\n# React\n\n```ts title=\"rsbuild.config.ts\"\nimport { defineConfig } from '@rsbuild/core'\nimport { pluginReact } from '@rsbuild/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\n\nexport default defineConfig({\n  plugins: [pluginReact()],\n  tools: {\n    rspack: {\n      plugins: [\n        tanstackRouter({\n          target: 'react',\n          autoCodeSplitting: true,\n        }),\n      ],\n    },\n  },\n})\n```\n\nOr, you can clone our [Quickstart Rspack/Rsbuild example](https://github.com/TanStack/router/tree/main/examples/react/quickstart-rspack-file-based) and get started.\n\n# Solid\n\n```ts title=\"rsbuild.config.ts\"\nimport { defineConfig } from '@rsbuild/core'\nimport { pluginBabel } from '@rsbuild/plugin-babel'\nimport { pluginSolid } from '@rsbuild/plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\n\nexport default defineConfig({\n  plugins: [\n    pluginBabel({\n      include: /\\.(?:jsx|tsx)$/,\n    }),\n    pluginSolid(),\n  ],\n  tools: {\n    rspack: {\n      plugins: [tanstackRouter({ target: 'solid', autoCodeSplitting: true })],\n    },\n  },\n})\n```\n\nOr, you can clone our [Quickstart Rspack/Rsbuild example](https://github.com/TanStack/router/tree/main/examples/solid/quickstart-rspack-file-based) and get started.\n\n<!-- ::end:framework -->\n\nNow that you've added the plugin to your Rspack/Rsbuild configuration, you're all set to start using file-based routing with TanStack Router.\n\n## Ignoring the generated route tree file\n\nIf your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.\n\nHere are some resources to help you ignore the generated route tree file:\n\n- Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)\n- ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)\n- Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)\n\n> [!WARNING]\n> If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.\n\nYou can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:\n\n```json\n{\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n```\n\nYou can use those settings either at a user level or only for a single workspace by creating the file `.vscode/settings.json` at the root of your project.\n\n## Configuration\n\nWhen using the TanStack Router Plugin with Rspack (or Rsbuild) for File-based routing, it comes with some sane defaults that should work for most projects:\n\n```json\n{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"routeFileIgnorePrefix\": \"-\",\n  \"quoteStyle\": \"single\"\n}\n```\n\nIf these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by editing the configuration object passed into the `tanstackRouter` function.\n\nYou can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).\n"
  },
  {
    "path": "docs/router/installation/with-vite.md",
    "content": "---\ntitle: Installation with Vite\n---\n\nTo use file-based routing with **Vite**, you'll need to install the `@tanstack/router-plugin` package.\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"dev-install\" -->\n\nreact: @tanstack/router-plugin\nsolid: @tanstack/router-plugin\n\n<!-- ::end:tabs -->\n\nOnce installed, you'll need to add the plugin to your Vite configuration.\n\n<!-- ::start:framework -->\n\n# React\n\n```ts title=\"vite.config.ts\"\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    // Please make sure that '@tanstack/router-plugin' is passed before '@vitejs/plugin-react'\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n    // ...\n  ],\n})\n```\n\nOr, you can clone our [Quickstart Vite example](https://github.com/TanStack/router/tree/main/examples/react/quickstart-file-based) and get started.\n\n# Solid\n\n```ts title=\"vite.config.ts\"\nimport { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n    // ...\n  ],\n})\n```\n\nOr, you can clone our [Quickstart Vite example](https://github.com/TanStack/router/tree/main/examples/solid/quickstart-file-based) and get started.\n\n<!-- ::end:framework -->\n\nNow that you've added the plugin to your Vite configuration, you're all set to start using file-based routing with TanStack Router.\n\n## Ignoring the generated route tree file\n\nIf your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.\n\nHere are some resources to help you ignore the generated route tree file:\n\n- Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)\n- ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)\n- Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)\n\n> [!WARNING]\n> If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.\n\nYou can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:\n\n```json\n{\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n```\n\nYou can use those settings either at a user level or only for a single workspace by creating the file `.vscode/settings.json` at the root of your project.\n\n## Configuration\n\nWhen using the TanStack Router Plugin with Vite for File-based routing, it comes with some sane defaults that should work for most projects:\n\n```json\n{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"routeFileIgnorePrefix\": \"-\",\n  \"quoteStyle\": \"single\"\n}\n```\n\nIf these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by editing the configuration object passed into the `tanstackRouter` function.\n\nYou can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).\n"
  },
  {
    "path": "docs/router/installation/with-webpack.md",
    "content": "---\ntitle: Installation with Webpack\n---\n\nTo use file-based routing with **Webpack**, you'll need to install the `@tanstack/router-plugin` package.\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"dev-install\" -->\n\nreact: @tanstack/router-plugin\nsolid: @tanstack/router-plugin\n\n<!-- ::end:tabs -->\n\nOnce installed, you'll need to add the plugin to your configuration.\n\n<!-- ::start:framework -->\n\n# React\n\n```ts title=\"webpack.config.ts\"\nimport { tanstackRouter } from '@tanstack/router-plugin/webpack'\n\nexport default {\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n  ],\n}\n```\n\nOr, you can clone our [Quickstart Webpack example](https://github.com/TanStack/router/tree/main/examples/react/quickstart-webpack-file-based) and get started.\n\n# Solid\n\n```ts title=\"webpack.config.ts\"\nimport { tanstackRouter } from '@tanstack/router-plugin/webpack'\n\nexport default {\n  plugins: [\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n  ],\n}\n```\n\nAnd in the .babelrc (SWC doesn't support solid-js, see [here](https://www.answeroverflow.com/m/1135200483116593182)), add these presets:\n\n```tsx\n// .babelrc\n\n{\n  \"presets\": [\"babel-preset-solid\", \"@babel/preset-typescript\"]\n}\n\n```\n\nOr, for a full webpack.config.js, you can clone our [Quickstart Webpack example](https://github.com/TanStack/router/tree/main/examples/solid/quickstart-webpack-file-based) and get started.\n\n<!-- ::end:framework -->\n\nNow that you've added the plugin to your Webpack configuration, you're all set to start using file-based routing with TanStack Router.\n\n## Ignoring the generated route tree file\n\nIf your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.\n\nHere are some resources to help you ignore the generated route tree file:\n\n- Prettier - [https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore](https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore)\n- ESLint - [https://eslint.org/docs/latest/use/configure/ignore#ignoring-files](https://eslint.org/docs/latest/use/configure/ignore#ignoring-files)\n- Biome - [https://biomejs.dev/reference/configuration/#filesignore](https://biomejs.dev/reference/configuration/#filesignore)\n\n> [!WARNING]\n> If you are using VSCode, you may experience the route tree file unexpectedly open (with errors) after renaming a route.\n\nYou can prevent that from the VSCode settings by marking the file as readonly. Our recommendation is to also exclude it from search results and file watcher with the following settings:\n\n```json\n{\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n```\n\nYou can use those settings either at a user level or only for a single workspace by creating the file `.vscode/settings.json` at the root of your project.\n\n## Configuration\n\nWhen using the TanStack Router Plugin with Webpack for File-based routing, it comes with some sane defaults that should work for most projects:\n\n```json\n{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"routeFileIgnorePrefix\": \"-\",\n  \"quoteStyle\": \"single\"\n}\n```\n\nIf these defaults work for your project, you don't need to configure anything at all! However, if you need to customize the configuration, you can do so by editing the configuration object passed into the `tanstackRouter` function.\n\nYou can find all the available configuration options in the [File-based Routing API Reference](../api/file-based-routing.md).\n"
  },
  {
    "path": "docs/router/integrations/query.md",
    "content": "---\nid: query\ntitle: TanStack Query Integration\n---\n\n> [!IMPORTANT]\n> This integration automates SSR dehydration/hydration and streaming between TanStack Router and TanStack Query. If you haven't read the standard [External Data Loading](../guide/external-data-loading.md) guide, start there.\n\n## What you get\n\n- **Automatic SSR dehydration/hydration** of your `QueryClient`\n- **Streaming of queries** that resolve during initial server render to the client\n- **Redirect handling** for `redirect()` thrown from queries/mutations\n- Optional **provider wrapping** with `QueryClientProvider`\n\n## Installation\n\nThe TanStack query integration is a separate package that you need to install:\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"dev-install\" -->\n\nreact: @tanstack/react-router-ssr-query\nsolid: @tanstack/solid-router-ssr-query\n\n<!-- ::end:tabs -->\n\n## Setup\n\nCreate your router and wire up the integration. Ensure a fresh `QueryClient` is created per request in SSR environments.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/router.tsx\"\nimport { QueryClient } from '@tanstack/react-query'\nimport { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    // optionally expose the QueryClient via router context\n    context: { queryClient },\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n  })\n\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n    // optional:\n    // handleRedirects: true,\n    // wrapQueryClient: true,\n  })\n\n  return router\n}\n```\n\n<!-- ::end:framework -->\n\nBy default, the integration wraps your router with a `QueryClientProvider`. If you already provide your own provider, pass `wrapQueryClient: false` and keep your custom wrapper.\n\n## SSR behavior and streaming\n\n- During server render, the integration dehydrates initial queries and streams any subsequent queries that resolve while rendering.\n- On the client, the integration hydrates the initial state, then incrementally hydrates streamed queries.\n- Queries from `useSuspenseQuery` or loader prefetches participate in SSR/streaming. Plain `useQuery` does not execute on the server.\n\n## Use in routes\n\n### Using useSuspenseQuery vs useQuery\n\n- `useSuspenseQuery`: runs on the server during SSR when its data is required and will be streamed to the client as it resolves.\n- `useQuery`: does not execute on the server; it will fetch on the client after hydration. Use this for data that is not required for SSR.\n\n```tsx\n// Suspense: executes on server and streams\nconst { data } = useSuspenseQuery(postsQuery)\n\n// Non-suspense: executes only on client\nconst { data, isLoading } = useQuery(postsQuery)\n```\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\n// Suspense: executes on server and streams\nconst { data } = useSuspenseQuery(postsQuery)\n\n// Non-suspense: executes only on client\nconst { data, isLoading } = useQuery(postsQuery)\n```\n\n<!-- ::end:framework -->\n\n### Preload with a loader and read with a hook\n\nPreload critical data in the route `loader` to avoid waterfalls and loading flashes, then read it in the component. The integration ensures server-fetched data is dehydrated and streamed to the client during SSR.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { queryOptions, useSuspenseQuery, useQuery } from '@tanstack/react-query'\nimport { createFileRoute } from '@tanstack/react-router'\n\nconst postsQuery = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetch('/api/posts').then((r) => r.json()),\n})\n\nexport const Route = createFileRoute('/posts')({\n  // Ensure the data is in the cache before render\n  loader: ({ context }) => context.queryClient.ensureQueryData(postsQuery),\n  component: PostsPage,\n})\n\nfunction PostsPage() {\n  // Prefer suspense for best SSR + streaming behavior\n  const { data } = useSuspenseQuery(postsQuery)\n  return <div>{data.map((p: any) => p.title).join(', ')}</div>\n}\n```\n\n<!-- ::end:framework -->\n\n### Prefetching and streaming\n\nYou can also prefetch with `fetchQuery` or `ensureQueryData` in a loader without consuming the data in a component. If you return the promise directly from the loader, it will be awaited and thus block the SSR request until the query finishes. If you don't await the promise nor return it, the query will be started on the server and will be streamed to the client without blocking the SSR request.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/users.$id.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\nimport { queryOptions, useQuery } from '@tanstack/react-query'\n\nconst userQuery = (id: string) =>\n  queryOptions({\n    queryKey: ['user', id],\n    queryFn: () => fetch(`/api/users/${id}`).then((r) => r.json()),\n  })\n\nexport const Route = createFileRoute('/user/$id')({\n  loader: ({ params }) => {\n    // do not await this nor return the promise, just kick off the query to stream it to the client\n    context.queryClient.fetchQuery(userQuery(params.id))\n  },\n})\n```\n\n<!-- ::end:framework -->\n\n## Redirect handling\n\nIf a query or mutation throws a `redirect(...)`, the integration intercepts it on the client and performs a router navigation.\n\n- Enabled by default\n- Disable with `handleRedirects: false` if you need custom handling\n\n## Works with TanStack Start\n\nTanStack Start uses TanStack Router under the hood. The same setup applies, and the integration will stream query results during SSR automatically.\n"
  },
  {
    "path": "docs/router/llm-support.md",
    "content": "---\nid: llm-assistance\ntitle: LLM Assistance Support\n---\n\nTanStack Router's documentation is integrated into its NPM module, making it available to install as LLM assistance rules. These rules can be integrated into various editors to provide context-aware help using [`vibe-rules`](https://www.npmjs.com/package/vibe-rules).\n\n## Installation\n\nTo use `vibe-rules`, install it globally using your package manager of choice. For example, with `pnpm`:\n\n```bash\npnpm add -g vibe-rules\n```\n\nOnce installed, you can then run it in the editor of your choice. For example, to integrate with Cursor:\n\n```bash\nvibe-rules install cursor\n```\n\n## Supported Editors\n\n`vibe-rules` supports a variety of editors, including `windsurf`, `claude-code`, and more. For more information on supported editors and how to set them up, refer to the [`vibe-rules` documentation](https://github.com/FutureExcited/vibe-rules).\n\n> [!IMPORTANT]\n> If you're using [Yarn Workspaces](https://yarnpkg.com/features/workspaces), you will need to add the following configuration to your `.yarnrc.yaml` file of your application that uses TanStack Router:\n\n> ```yaml\n> pnpFallbackMode: all\n> pnpMode: loose\n> ```\n"
  },
  {
    "path": "docs/router/overview.md",
    "content": "---\ntitle: Overview\n---\n\n**TanStack Router is a router for building React and Solid applications**. Some of its features include:\n\n- 100% inferred TypeScript support\n- Typesafe navigation\n- Nested Routing and layout routes (with pathless layouts)\n- Built-in Route Loaders w/ SWR Caching\n- Designed for client-side data caches (TanStack Query, SWR, etc.)\n- Automatic route prefetching\n- Asynchronous route elements and error boundaries\n- File-based Route Generation\n- Typesafe JSON-first Search Params state management APIs\n- Path and Search Parameter Schema Validation\n- Search Param Navigation APIs\n- Custom Search Param parser/serializer support\n- Search param middleware\n- Route matching/loading middleware\n\nTo get started quickly, head to the next page. For a more lengthy explanation, buckle up while I bring you up to speed!\n\n## \"A Fork in the Route\"\n\nUsing 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.\n\n## Why TanStack Router?\n\nTanStack Router delivers on the same fundamental expectations as other routers that you’ve come to expect:\n\n- Nested routes, layout routes, grouped routes\n- File-based Routing\n- Parallel data loading\n- Prefetching\n- URL Path Params\n- Error Boundaries and Handling\n- SSR\n- Route Masking\n\nAnd it also delivers some new features that raise the bar:\n\n- 100% inferred TypeScript support\n- Typesafe navigation\n- Built-in SWR Caching for loaders\n- Designed for client-side data caches (TanStack Query, SWR, etc.)\n- Typesafe JSON-first Search Params state management APIs\n- Path and Search Parameter Schema Validation\n- Search Parameter Navigation APIs\n- Custom Search Param parser/serializer support\n- Search param middleware\n- Inherited Route Context\n- Mixed file-based and code-based routing\n\nLet’s dive into some of the more important ones in more detail!\n\n## 100% Inferred TypeScript Support\n\nEverything 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.\n\n- 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.\n- 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 of its API and ultimately your app. No other router offers this level of type safety and developer confidence.\n\nWhat does all of that mean for you?\n\n- Faster feature development with auto-completion and type hints\n- Safer and faster refactors\n- Confidence that your code will work as expected\n\n## 1st Class Search Parameters\n\nSearch 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 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`.\n\nLet'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.\n\nTo 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.\n\n**It's like having `useState` right in the URL!**\n\nSearch parameters are:\n\n- Automatically parsed and serialized as JSON\n- Validated and typed\n- Inherited from parent routes\n- Accessible in loaders, components, and hooks\n- Easily modified with the useSearch hook, Link, navigate, and router.navigate APIs\n- Customizable with a custom search filters and middleware\n- Subscribed via fine-grained search param selectors for efficient re-renders\n\nOnce you start using TanStack Router's search parameters, you'll wonder how you ever lived without them.\n\n## Built-In Caching and Friendly Data Loading\n\nData 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:\n\n- No caching at all. Data is always fresh, but your users are left waiting for frequently accessed data to load over and over again.\n- Overly-aggressive caching. Data is cached for too long, leading to stale data and a poor user experience.\n- 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.\n\nTanStack Router solves these problems with a two-prong approach to caching and data loading:\n\n### Built-in Cache\n\nTanStack 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 guarantee 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.\n\n### Flexible & Powerful Data Lifecycle APIs\n\nTanStack 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.\n\n## Inherited Route Context\n\nTanStack 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 routes 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:\n\n- Authentication and Authorization\n- Hybrid SSR/CSR data fetching and preloading\n- Theming\n- Singletons and global utilities\n- Curried or partial application across preloading, loading, and rendering stages\n\nAlso, 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.\n\n## File-based and/or Code-Based Routing\n\nTanStack 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.\n\nTanStack 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.\n\n## Acknowledgements\n\nTanStack Router builds on concepts and patterns popularized by many other OSS projects, including:\n\n- [TRPC](https://trpc.io/)\n- [Remix](https://remix.run)\n- [Chicane](https://swan-io.github.io/chicane/)\n- [Next.js](https://nextjs.org)\n\nWe acknowledge the investment, risk and research that went into their development, but are excited to push the bar they have set even higher.\n\n## Let's go!\n\nEnough overview, there's so much more to do with TanStack Router. Hit that next button and let's get started!\n"
  },
  {
    "path": "docs/router/quick-start.md",
    "content": "---\nid: quick-start\ntitle: Quick Start\n---\n\n## Impatient?\n\nThe fastest way to get started with TanStack Router is to scaffold a new project. Just run:\n\n<!-- ::start:tabs variant=\"package-managers\" mode=\"local-install\" -->\n\nreact: create-tsrouter-app@latest\nsolid: create-tsrouter-app@latest --framework solid\n\n<!-- ::end:tabs -->\n\nThe CLI will guide you through a short series of prompts to customize your setup, including options for:\n\n- File-based or code-based route configuration\n- TypeScript support\n- Tailwind CSS integration\n- Toolchain setup\n- Git initialization\n\nOnce complete, a new project will be generated with TanStack Router installed and ready to use.\n\n> [!TIP]\n> For full details on available options and templates, visit the [`create-tsrouter-app` documentation](https://github.com/TanStack/create-tsrouter-app/tree/main/cli/create-tsrouter-app).\n\n## Routing Options\n\nTanStack Router supports both file-based and code-based route configurations. You can specify your preference during the CLI setup, or use these commands directly:\n\n### File-Based Route Generation\n\nThe file-based approach is the recommended option for most projects. It automatically creates routes based on your file structure, giving you the best mix of performance, simplicity, and developer experience.\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"local-install\" -->\n\nreact: create-tsrouter-app@latest my-app --template file-router\nsolid: create-tsrouter-app@latest my-app --framework solid --template file-router\n\n<!-- ::end:tabs -->\n\n### Code-Based Route Configuration\n\nIf you prefer to define routes programmatically, you can use the code-based route configuration. This approach gives you full control over routing logic.\n\n<!-- ::start:tabs variant=\"package-manager\" mode=\"local-install\" -->\n\nreact: create-tsrouter-app@latest my-app\nsolid: create-tsrouter-app@latest my-app --framework solid\n\n<!-- ::end:tabs -->\n\nWith either approach, navigate to your project directory and start the development server.\n\n## Existing Project\n\nIf you have an existing React project and want to add TanStack Router to it, you can install it manually.\n\n### Requirements\n\nBefore installing TanStack Router, please ensure your project meets the following requirements:\n\n<!-- ::start:framework -->\n\n# React\n\n- `react` v18 or later with `createRoot` support.\n- `react-dom` v18 or later.\n\n# Solid\n\n- `solid-js` v1.x.x\n\n<!-- ::end:framework -->\n\n> [!NOTE]\n> Using TypeScript (`v5.3.x or higher`) is recommended for the best development experience, though not strictly required. We aim to support the last 5 minor versions of TypeScript, but using the latest version will help avoid potential issues.\n\nTanStack Router is currently only compatible with React (with ReactDOM) and Solid. If you're interested in contributing to support other frameworks, such as React Native, Angular, or Vue, please reach out to us on [Discord](https://tlinz.com/discord).\n\n### Installation\n\nTo install TanStack Router in your project, run the following command using your preferred package manager:\n\n<!-- ::start:tabs variant=\"package-managers\" -->\n\nreact: @tanstack/react-router\nsolid: @tanstack/solid-router\n\n<!-- ::end:tabs -->\n\nOnce installed, you can verify the installation by checking your `package.json` file for the dependency.\n\n<!-- ::start:framework -->\n\n# React\n\n```json\n{\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^x.x.x\"\n  }\n}\n```\n\n# Solid\n\n```json\n{\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^x.x.x\"\n  }\n}\n```\n\n<!-- ::end:framework -->\n"
  },
  {
    "path": "docs/router/routing/code-based-routing.md",
    "content": "---\ntitle: Code-Based Routing\n---\n\n> [!TIP]\n> Code-based routing is not recommended for most applications. It is recommended to use [File-Based Routing](./file-based-routing.md) instead.\n\n## ⚠️ Before You Start\n\n- If you're using [File-Based Routing](./file-based-routing.md), **skip this guide**.\n- If you still insist on using code-based routing, you must read the [Routing Concepts](./routing-concepts.md) guide first, as it also covers core concepts of the router.\n\n## Route Trees\n\nCode-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.\n\nLet's consider the same route tree from the [Route Trees & Nesting](./route-trees.md#route-trees) guide, and convert it to code-based routing:\n\nHere is the file-based version:\n\n```\nroutes/\n├── __root.tsx\n├── index.tsx\n├── about.tsx\n├── posts/\n│   ├── index.tsx\n│   ├── $postId.tsx\n├── posts.$postId.edit.tsx\n├── settings/\n│   ├── profile.tsx\n│   ├── notifications.tsx\n├── _pathlessLayout.tsx\n├── _pathlessLayout/\n│   ├── route-a.tsx\n├── ├── route-b.tsx\n├── files/\n│   ├── $.tsx\n```\n\nAnd here is a summarized code-based version:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/react-router'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'about',\n})\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n})\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n})\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n})\n\nconst postEditorRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts/$postId/edit',\n})\n\nconst settingsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'settings',\n})\n\nconst profileRoute = createRoute({\n  getParentRoute: () => settingsRoute,\n  path: 'profile',\n})\n\nconst notificationsRoute = createRoute({\n  getParentRoute: () => settingsRoute,\n  path: 'notifications',\n})\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'pathlessLayout',\n})\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-a',\n})\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-b',\n})\n\nconst filesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'files/$',\n})\n```\n\n# Solid\n\n```tsx\nimport { createRootRoute, createRoute } from '@tanstack/solid-router'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'about',\n})\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n})\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n})\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n})\n\nconst postEditorRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts/$postId/edit',\n})\n\nconst settingsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'settings',\n})\n\nconst profileRoute = createRoute({\n  getParentRoute: () => settingsRoute,\n  path: 'profile',\n})\n\nconst notificationsRoute = createRoute({\n  getParentRoute: () => settingsRoute,\n  path: 'notifications',\n})\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'pathlessLayout',\n})\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-a',\n})\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-b',\n})\n\nconst filesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'files/$',\n})\n```\n\n<!-- ::end:framework -->\n\n## Anatomy of a Route\n\nAll other routes other than the root route are configured using the `createRoute` function:\n\n```tsx\nconst route = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/posts',\n  component: PostsComponent,\n})\n```\n\nThe `getParentRoute` option is a function that returns the parent route of the route you're creating.\n\n**❓❓❓ \"Wait, you're making me pass the parent route for every route I make?\"**\n\nAbsolutely! 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!\n\n> [!IMPORTANT]\n> For every route that's **NOT** the **Root Route** or a **Pathless Layout 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.\n\nWhen configuring route `path` option on a route, it ignores 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:\n\n| Path     | Normalized Path |\n| -------- | --------------- |\n| `/`      | `/`             |\n| `/about` | `about`         |\n| `about/` | `about`         |\n| `about`  | `about`         |\n| `$`      | `$`             |\n| `/$`     | `$`             |\n| `/$/`    | `$`             |\n\n## Manually building the route tree\n\nWhen 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.\n\n```tsx\n/* prettier-ignore */\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  aboutRoute,\n  postsRoute.addChildren([\n    postsIndexRoute,\n    postRoute,\n  ]),\n  postEditorRoute,\n  settingsRoute.addChildren([\n    profileRoute,\n    notificationsRoute,\n  ]),\n  pathlessLayoutRoute.addChildren([\n    pathlessLayoutARoute,\n    pathlessLayoutBRoute,\n  ]),\n  filesRoute.addChildren([\n    fileRoute,\n  ]),\n])\n/* prettier-ignore-end */\n```\n\nBut before you can go ahead and build the route tree, you need to understand how the Routing Concepts for Code-Based Routing work.\n\n## Routing Concepts for Code-Based Routing\n\nBelieve it or not, file-based routing is really a superset of code-based routing and uses the filesystem and a bit of code-generation abstraction on top of it to generate this structure you see above automatically.\n\nWe're going to assume you've read the [Routing Concepts](./routing-concepts.md) guide and are familiar with each of these main concepts:\n\n- The Root Route\n- Basic Routes\n- Index Routes\n- Dynamic Route Segments\n- Splat / Catch-All Routes\n- Layout Routes\n- Pathless Routes\n- Non-Nested Routes\n\nNow, let's take a look at how to create each of these route types in code.\n\n## The Root Route\n\nCreating a root route in code-based routing is thankfully the same as doing so in file-based routing. Call the `createRootRoute()` function.\n\nUnlike 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).\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\n// Standard root route\nimport { createRootRoute } from '@tanstack/react-router'\n\nconst rootRoute = createRootRoute()\n\n// Root route with Context\nimport { createRootRouteWithContext } from '@tanstack/react-router'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport interface MyRouterContext {\n  queryClient: QueryClient\n}\nconst rootRoute = createRootRouteWithContext<MyRouterContext>()\n```\n\n# Solid\n\n```tsx\n// Standard root route\nimport { createRootRoute } from '@tanstack/solid-router'\n\nconst rootRoute = createRootRoute()\n\n// Root route with Context\nimport { createRootRouteWithContext } from '@tanstack/solid-router'\nimport type { QueryClient } from '@tanstack/solid-query'\n\nexport interface MyRouterContext {\n  queryClient: QueryClient\n}\nconst rootRoute = createRootRouteWithContext<MyRouterContext>()\n```\n\n<!-- ::end:framework -->\n\nTo learn more about Context in TanStack Router, see the [Router Context](../guide/router-context.md) guide.\n\n## Basic Routes\n\nTo create a basic route, simply provide a normal `path` string to the `createRoute` function:\n\n```tsx\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'about',\n})\n```\n\nSee, it's that simple! The `aboutRoute` will match the URL `/about`.\n\n## Index Routes\n\nUnlike 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:\n\n```tsx\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n})\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  // Notice the single slash `/` here\n  path: '/',\n})\n```\n\nSo, the `postsIndexRoute` will match the URL `/posts/` (or `/posts`).\n\n## Dynamic Route Segments\n\nDynamic 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`:\n\n```tsx\nconst postIdRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  // In a loader\n  loader: ({ params }) => fetchPost(params.postId),\n  // Or in a component\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const { postId } = postIdRoute.useParams()\n  return <div>Post ID: {postId}</div>\n}\n```\n\n> [!TIP]\n> If your component is code-split, you can use the [getRouteApi function](../guide/code-splitting.md#manually-accessing-route-apis-in-other-files-with-the-getrouteapi-helper) to avoid having to import the `postIdRoute` configuration to get access to the typed `useParams()` hook.\n\n## Splat / Catch-All Routes\n\nAs 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:\n\n```tsx\nconst filesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'files',\n})\n\nconst fileRoute = createRoute({\n  getParentRoute: () => filesRoute,\n  path: '$',\n})\n```\n\nFor the URL `/documents/hello-world`, the `params` object will look like this:\n\n```js\n{\n  '_splat': 'documents/hello-world'\n}\n```\n\n## Layout Routes\n\nLayout routes are routes that wrap their children in a layout component. In code-based routing, you can create a layout route by simply nesting a route under another route:\n\n```tsx\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  component: PostsLayoutComponent, // The layout component\n})\n\nfunction PostsLayoutComponent() {\n  return (\n    <div>\n      <h1>Posts</h1>\n      <Outlet />\n    </div>\n  )\n}\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n})\n\nconst postsCreateRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: 'create',\n})\n\nconst routeTree = rootRoute.addChildren([\n  // The postsRoute is the layout route\n  // Its children will be nested under the PostsLayoutComponent\n  postsRoute.addChildren([postsIndexRoute, postsCreateRoute]),\n])\n```\n\nNow, both the `postsIndexRoute` and `postsCreateRoute` will render their contents inside of the `PostsLayoutComponent`:\n\n```tsx\n// URL: /posts\n<PostsLayoutComponent>\n  <PostsIndexComponent />\n</PostsLayoutComponent>\n\n// URL: /posts/create\n<PostsLayoutComponent>\n  <PostsCreateComponent />\n</PostsLayoutComponent>\n```\n\n## Pathless Layout Routes\n\nIn file-based routing a pathless layout route is prefixed with a `_`, but in code-based routing, this 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.\n\n```tsx\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <h1>Pathless Layout</h1>\n      <Outlet />\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-a',\n})\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-b',\n})\n\nconst routeTree = rootRoute.addChildren([\n  // The pathless layout route has no path, only an id\n  // So its children will be nested under the pathless layout route\n  pathlessLayoutRoute.addChildren([pathlessLayoutARoute, pathlessLayoutBRoute]),\n])\n```\n\nNow both `/route-a` and `/route-b` will render their contents inside of the `PathlessLayoutComponent`:\n\n```tsx\n// URL: /route-a\n<PathlessLayoutComponent>\n  <RouteAComponent />\n</PathlessLayoutComponent>\n\n// URL: /route-b\n<PathlessLayoutComponent>\n  <RouteBComponent />\n</PathlessLayoutComponent>\n```\n\n## Non-Nested Routes\n\nBuilding 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:\n\n- `/posts_/$postId/edit`\n- `/posts`\n  - `$postId`\n\nTo do this we need to build a separate route for the post editor and 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):\n\n```tsx\n// The posts editor route is nested under the root route\nconst postEditorRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  // The path includes the entire path we need to match\n  path: 'posts/$postId/edit',\n})\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n})\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n})\n\nconst routeTree = rootRoute.addChildren([\n  // The post editor route is nested under the root route\n  postEditorRoute,\n  postsRoute.addChildren([postRoute]),\n])\n```\n"
  },
  {
    "path": "docs/router/routing/file-based-routing.md",
    "content": "---\ntitle: File-Based Routing\n---\n\nMost of the TanStack Router documentation is written for file-based routing and is intended to help you understand in more detail how to configure file-based routing and the technical details behind how it works. While file-based routing is the preferred and recommended way to configure TanStack Router, you can also use [code-based routing](./code-based-routing.md) if you prefer.\n\n## What is File-Based Routing?\n\nFile-based routing is a way to configure your routes using the filesystem. Instead of defining your route structure via code, you can define your routes using a series of files and directories that represent the route hierarchy of your application. This brings a number of benefits:\n\n- **Simplicity**: File-based routing is visually intuitive and easy to understand for both new and experienced developers.\n- **Organization**: Routes are organized in a way that mirrors the URL structure of your application.\n- **Scalability**: As your application grows, file-based routing makes it easy to add new routes and maintain existing ones.\n- **Code-Splitting**: File-based routing allows TanStack Router to automatically code-split your routes for better performance.\n- **Type-Safety**: File-based routing raises the ceiling on type-safety by generating managing type linkages for your routes, which can otherwise be a tedious process via code-based routing.\n- **Consistency**: File-based routing enforces a consistent structure for your routes, making it easier to maintain and update your application and move from one project to another.\n\n## `/`s or `.`s?\n\nWhile directories have long been used to represent route hierarchy, file-based routing introduces an additional concept of using the `.` character in the file-name to denote a route nesting. This allows you to avoid creating directories for few deeply nested routes and continue to use directories for wider route hierarchies. Let's take a look at some examples!\n\n## Directory Routes\n\nDirectories can be used to denote route hierarchy, which can be useful for organizing multiple routes into logical groups and also cutting down on the filename length for large groups of deeply nested routes.\n\nSee the example below:\n\n| Filename                | Route Path                | Component Output                  |\n| ----------------------- | ------------------------- | --------------------------------- |\n| ʦ `__root.tsx`          |                           | `<Root>`                          |\n| ʦ `index.tsx`           | `/` (exact)               | `<Root><RootIndex>`               |\n| ʦ `about.tsx`           | `/about`                  | `<Root><About>`                   |\n| ʦ `posts.tsx`           | `/posts`                  | `<Root><Posts>`                   |\n| 📂 `posts`              |                           |                                   |\n| ┄ ʦ `index.tsx`         | `/posts` (exact)          | `<Root><Posts><PostsIndex>`       |\n| ┄ ʦ `$postId.tsx`       | `/posts/$postId`          | `<Root><Posts><Post>`             |\n| 📂 `posts_`             |                           |                                   |\n| ┄ 📂 `$postId`          |                           |                                   |\n| ┄ ┄ ʦ `edit.tsx`        | `/posts/$postId/edit`     | `<Root><EditPost>`                |\n| ʦ `settings.tsx`        | `/settings`               | `<Root><Settings>`                |\n| 📂 `settings`           |                           | `<Root><Settings>`                |\n| ┄ ʦ `profile.tsx`       | `/settings/profile`       | `<Root><Settings><Profile>`       |\n| ┄ ʦ `notifications.tsx` | `/settings/notifications` | `<Root><Settings><Notifications>` |\n| ʦ `_pathlessLayout.tsx` |                           | `<Root><PathlessLayout>`          |\n| 📂 `_pathlessLayout`    |                           |                                   |\n| ┄ ʦ `route-a.tsx`       | `/route-a`                | `<Root><PathlessLayout><RouteA>`  |\n| ┄ ʦ `route-b.tsx`       | `/route-b`                | `<Root><PathlessLayout><RouteB>`  |\n| 📂 `files`              |                           |                                   |\n| ┄ ʦ `$.tsx`             | `/files/$`                | `<Root><Files>`                   |\n| 📂 `account`            |                           |                                   |\n| ┄ ʦ `route.tsx`         | `/account`                | `<Root><Account>`                 |\n| ┄ ʦ `overview.tsx`      | `/account/overview`       | `<Root><Account><Overview>`       |\n\n## Flat Routes\n\nFlat routing gives you the ability to use `.`s to denote route nesting levels.\n\nThis can be useful when you have a large number of uniquely deeply nested routes and want to avoid creating directories for each one:\n\nSee the example below:\n\n| Filename                        | Route Path                | Component Output                  |\n| ------------------------------- | ------------------------- | --------------------------------- |\n| ʦ `__root.tsx`                  |                           | `<Root>`                          |\n| ʦ `index.tsx`                   | `/` (exact)               | `<Root><RootIndex>`               |\n| ʦ `about.tsx`                   | `/about`                  | `<Root><About>`                   |\n| ʦ `posts.tsx`                   | `/posts`                  | `<Root><Posts>`                   |\n| ʦ `posts.index.tsx`             | `/posts` (exact)          | `<Root><Posts><PostsIndex>`       |\n| ʦ `posts.$postId.tsx`           | `/posts/$postId`          | `<Root><Posts><Post>`             |\n| ʦ `posts_.$postId.edit.tsx`     | `/posts/$postId/edit`     | `<Root><EditPost>`                |\n| ʦ `settings.tsx`                | `/settings`               | `<Root><Settings>`                |\n| ʦ `settings.profile.tsx`        | `/settings/profile`       | `<Root><Settings><Profile>`       |\n| ʦ `settings.notifications.tsx`  | `/settings/notifications` | `<Root><Settings><Notifications>` |\n| ʦ `_pathlessLayout.tsx`         |                           | `<Root><PathlessLayout>`          |\n| ʦ `_pathlessLayout.route-a.tsx` | `/route-a`                | `<Root><PathlessLayout><RouteA>`  |\n| ʦ `_pathlessLayout.route-b.tsx` | `/route-b`                | `<Root><PathlessLayout><RouteB>`  |\n| ʦ `files.$.tsx`                 | `/files/$`                | `<Root><Files>`                   |\n| ʦ `account.tsx`                 | `/account`                | `<Root><Account>`                 |\n| ʦ `account.overview.tsx`        | `/account/overview`       | `<Root><Account><Overview>`       |\n\n## Mixed Flat and Directory Routes\n\nIt's extremely likely that a 100% directory or flat route structure won't be the best fit for your project, which is why TanStack Router allows you to mix both flat and directory routes together to create a route tree that uses the best of both worlds where it makes sense:\n\nSee the example below:\n\n| Filename                       | Route Path                | Component Output                  |\n| ------------------------------ | ------------------------- | --------------------------------- |\n| ʦ `__root.tsx`                 |                           | `<Root>`                          |\n| ʦ `index.tsx`                  | `/` (exact)               | `<Root><RootIndex>`               |\n| ʦ `about.tsx`                  | `/about`                  | `<Root><About>`                   |\n| ʦ `posts.tsx`                  | `/posts`                  | `<Root><Posts>`                   |\n| 📂 `posts`                     |                           |                                   |\n| ┄ ʦ `index.tsx`                | `/posts` (exact)          | `<Root><Posts><PostsIndex>`       |\n| ┄ ʦ `$postId.tsx`              | `/posts/$postId`          | `<Root><Posts><Post>`             |\n| ┄ ʦ `$postId.edit.tsx`         | `/posts/$postId/edit`     | `<Root><Posts><Post><EditPost>`   |\n| ʦ `settings.tsx`               | `/settings`               | `<Root><Settings>`                |\n| ʦ `settings.profile.tsx`       | `/settings/profile`       | `<Root><Settings><Profile>`       |\n| ʦ `settings.notifications.tsx` | `/settings/notifications` | `<Root><Settings><Notifications>` |\n| ʦ `account.tsx`                | `/account`                | `<Root><Account>`                 |\n| ʦ `account.overview.tsx`       | `/account/overview`       | `<Root><Account><Overview>`       |\n\nBoth flat and directory routes can be mixed together to create a route tree that uses the best of both worlds where it makes sense.\n\n> [!TIP]\n> If you find that the default file-based routing structure doesn't fit your needs, you can always use [Virtual File Routes](./virtual-file-routes.md) to control the source of your routes whilst still getting the awesome performance benefits of file-based routing.\n\n## Getting started with File-Based Routing\n\nTo get started with file-based routing, you'll need to configure your project's bundler to use the TanStack Router Plugin or the TanStack Router CLI.\n\nTo enable file-based routing, you'll need to be using React with a supported bundler. See if your bundler is listed in the configuration guides below.\n\n<!-- ::start:framework -->\n\n# React\n\n- [Installation with Vite](../installation/with-vite)\n- [Installation with Rspack/Rsbuild](../installation/with-rspack)\n- [Installation with Webpack](../installation/with-webpack)\n- [Installation with Esbuild](../installation/with-esbuild)\n\n# Solid\n\n- [Installation with Vite](../installation/with-vite)\n- [Installation with Rspack/Rsbuild](../installation/with-rspack)\n- [Installation with Webpack](../installation/with-webpack)\n- [Installation with Esbuild](../installation/with-esbuild)\n\n<!-- ::end:framework -->\n\nWhen using TanStack Router's file-based routing through one of the supported bundlers, our plugin will **automatically generate your route configuration through your bundler's dev and build processes**. It is the easiest way to use TanStack Router's route generation features.\n\nIf your bundler is not yet supported, you can reach out to us on Discord or GitHub to let us know.\n"
  },
  {
    "path": "docs/router/routing/file-naming-conventions.md",
    "content": "---\ntitle: File Naming Conventions\n---\n\nFile-based routing requires that you follow a few simple file naming conventions to ensure that your routes are generated correctly. The concepts these conventions enable are covered in detail in the [Route Trees & Nesting](./route-trees.md) guide.\n\n| Feature                            | Description                                                                                                                                                                                                                                                                                                                                                                                                          |\n| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **`__root.tsx`**                   | The root route file must be named `__root.tsx` and must be placed in the root of the configured `routesDirectory`.                                                                                                                                                                                                                                                                                                   |\n| **`.` Separator**                  | Routes can use the `.` character to denote a nested route. For example, `blog.post` will be generated as a child of `blog`.                                                                                                                                                                                                                                                                                          |\n| **`$` Token**                      | Route segments with the `$` token are parameterized and will extract the value from the URL pathname as a route `param`.                                                                                                                                                                                                                                                                                             |\n| **`_` Prefix**                     | Route segments with the `_` prefix are considered to be pathless layout routes and will not be used when matching its child routes against the URL pathname.                                                                                                                                                                                                                                                         |\n| **`_` Suffix**                     | Route segments with the `_` suffix exclude the route from being nested under any parent routes.                                                                                                                                                                                                                                                                                                                      |\n| **`-` Prefix**                     | Files and folders with the `-` prefix are excluded from the route tree. They will not be added to the `routeTree.gen.ts` file and can be used to colocate logic in route folders.                                                                                                                                                                                                                                    |\n| **`(folder)` folder name pattern** | A folder that matches this pattern is treated as a **route group**, preventing the folder from being included in the route's URL path.                                                                                                                                                                                                                                                                               |\n| **`[x]` Escaping**                 | Square brackets escape special characters in filenames that would otherwise have routing meaning. For example, `script[.]js.tsx` becomes `/script.js` and `api[.]v1.tsx` becomes `/api.v1`.                                                                                                                                                                                                                          |\n| **`index` Token**                  | Route segments ending with the `index` token (before any file extensions) will match the parent route when the URL pathname matches the parent route exactly. This can be configured via the `indexToken` configuration option (supports both strings and regex patterns), see [options](../api/file-based-routing.md#indextoken).                                                                                   |\n| **`.route.tsx` File Type**         | When using directories to organise routes, the `route` suffix can be used to create a route file at the directory's path. For example, `blog.post.route.tsx` or `blog/post/route.tsx` can be used as the route file for the `/blog/post` route. This can be configured via the `routeToken` configuration option (supports both strings and regex patterns), see [options](../api/file-based-routing.md#routetoken). |\n\n> **💡 Remember:** The file-naming conventions for your project could be affected by what [options](../api/file-based-routing.md) are configured.\n\n## Dynamic Path Params\n\nDynamic path params can be used in both flat and directory routes to create routes that can match a dynamic segment of the URL path. Dynamic path params are denoted by the `$` character in the filename:\n\n| Filename              | Route Path       | Component Output      |\n| --------------------- | ---------------- | --------------------- |\n| ...                   | ...              | ...                   |\n| ʦ `posts.$postId.tsx` | `/posts/$postId` | `<Root><Posts><Post>` |\n\nWe'll learn more about dynamic path params in the [Path Params](../guide/path-params.md) guide.\n\n## Pathless Routes\n\nPathless routes wrap child routes with either logic or a component without requiring a URL path. Non-path routes are denoted by the `_` character in the filename:\n\n| Filename       | Route Path | Component Output |\n| -------------- | ---------- | ---------------- |\n| ʦ `_app.tsx`   |            |                  |\n| ʦ `_app.a.tsx` | /a         | `<Root><App><A>` |\n| ʦ `_app.b.tsx` | /b         | `<Root><App><B>` |\n\nTo learn more about pathless routes, see the [Routing Concepts - Pathless Routes](./routing-concepts.md#pathless-layout-routes) guide.\n"
  },
  {
    "path": "docs/router/routing/route-matching.md",
    "content": "---\ntitle: Route Matching\n---\n\nRoute matching follows a consistent and predictable pattern. This guide will explain how route trees are matched.\n\nWhen 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:\n\n- Index Route\n- Static Routes (most specific to least specific)\n- Dynamic Routes (longest to shortest)\n- Splat/Wildcard Routes\n\nConsider the following pseudo route tree:\n\n```\nRoot\n  - blog\n    - $postId\n    - /\n    - new\n  - /\n  - *\n  - about\n  - about/us\n```\n\nAfter sorting, this route tree will become:\n\n```\nRoot\n  - /\n  - about/us\n  - about\n  - blog\n    - /\n    - new\n    - $postId\n  - *\n```\n\nThis final order represents the order in which routes will be matched based on specificity.\n\nUsing that route tree, let's follow the matching process for a few different URLs:\n\n- `/blog`\n  ```\n  Root\n    ❌ /\n    ❌ about/us\n    ❌ about\n    ⏩ blog\n      ✅ /\n      - new\n      - $postId\n    - *\n  ```\n- `/blog/my-post`\n  ```\n  Root\n    ❌ /\n    ❌ about/us\n    ❌ about\n    ⏩ blog\n      ❌ /\n      ❌ new\n      ✅ $postId\n    - *\n  ```\n- `/`\n  ```\n  Root\n    ✅ /\n    - about/us\n    - about\n    - blog\n      - /\n      - new\n      - $postId\n    - *\n  ```\n- `/not-a-route`\n  ```\n  Root\n    ❌ /\n    ❌ about/us\n    ❌ about\n    ❌ blog\n      - /\n      - new\n      - $postId\n    ✅ *\n  ```\n"
  },
  {
    "path": "docs/router/routing/route-trees.md",
    "content": "---\ntitle: Route Trees\n---\n\nTanStack Router uses a nested route tree to match up the URL with the correct component tree to render.\n\nTo build a route tree, TanStack Router supports:\n\n- [File-Based Routing](./file-based-routing.md)\n- [Code-Based Routing](./code-based-routing.md)\n\nBoth methods support the exact same core features and functionality, but **file-based routing requires less code for the same or better results**. For this reason, **file-based routing is the preferred and recommended way** to configure TanStack Router. Most of the documentation is written from the perspective of file-based routing.\n\n## Route Trees\n\nNested 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 create a route hierarchy that looks like this:\n\n```tsx\n├── blog\n│   ├── posts\n│   │   ├── $postId\n```\n\nAnd render a component tree that looks like this:\n\n```tsx\n<Blog>\n  <Posts>\n    <Post postId=\"123\" />\n  </Posts>\n</Blog>\n```\n\nLet's take that concept and expand it out to a larger site structure, but with file-names now:\n\n```\n/routes\n├── __root.tsx\n├── index.tsx\n├── about.tsx\n├── posts/\n│   ├── index.tsx\n│   ├── $postId.tsx\n├── posts.$postId.edit.tsx\n├── settings/\n│   ├── profile.tsx\n│   ├── notifications.tsx\n├── _pathlessLayout/\n│   ├── route-a.tsx\n├── ├── route-b.tsx\n├── files/\n│   ├── $.tsx\n```\n\nThe above is a valid route tree configuration that can be used with TanStack Router! There's a lot of power and convention to unpack with file-based routing, so let's break it down a bit.\n\n## Route Tree Configuration\n\nRoute trees can be configured using a few different ways:\n\n- [Flat Routes](./file-based-routing.md#flat-routes)\n- [Directories](./file-based-routing.md#directory-routes)\n- [Mixed Flat Routes and Directories](./file-based-routing.md#mixed-flat-and-directory-routes)\n- [Virtual File Routes](./virtual-file-routes.md)\n- [Code-Based Routes](./code-based-routing.md)\n\nPlease be sure to check out the full documentation links above for each type of route tree, or just proceed to the next section to get started with file-based routing.\n"
  },
  {
    "path": "docs/router/routing/routing-concepts.md",
    "content": "---\ntitle: Routing Concepts\n---\n\nTanStack Router supports a number of powerful routing concepts that allow you to build complex and dynamic routing systems with ease.\n\nEach of these concepts is useful and powerful, and we'll dive into each of them in the following sections.\n\n## Anatomy of a Route\n\nAll other routes, other than the [Root Route](#the-root-route), are configured using the `createFileRoute` function, which provides type safety when using file-based routing:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/index.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: PostsComponent,\n})\n```\n\n# Solid\n\n```tsx title=\"src/routes/index.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: PostsComponent,\n})\n```\n\n<!-- ::end:framework -->\n\nThe `createFileRoute` function takes a single argument, the file-route's path as a string.\n\n**❓❓❓ \"Wait, you're making me pass the path of the route file to `createFileRoute`?\"**\n\nYes! But don't worry, this path is **automatically written and managed by the router for you via the TanStack Router Bundler Plugin or Router CLI.** So, as you create new routes, move routes around or rename routes, the path will be updated for you automatically.\n\nThe 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 🤷‍♂️)\n\n## The Root Route\n\nThe root route is the top-most route in the entire tree and encapsulates all other routes as children.\n\n- It has no path\n- It is **always** matched\n- Its `component` is **always** rendered\n\nEven though it doesn't have a path, the root route has access to all of the same functionality as other routes including:\n\n- components\n- loaders\n- search param validation\n- etc.\n\nTo create a root route, call the `createRootRoute()` function and export it as the `Route` variable in your route file:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx\n// Standard root route\nimport { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute()\n\n// Root route with Context\nimport { createRootRouteWithContext } from '@tanstack/react-router'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport interface MyRouterContext {\n  queryClient: QueryClient\n}\nexport const Route = createRootRouteWithContext<MyRouterContext>()\n```\n\n# Solid\n\n```tsx\n// Standard root route\nimport { createRootRoute } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute()\n\n// Root route with Context\nimport { createRootRouteWithContext } from '@tanstack/solid-router'\nimport type { QueryClient } from '@tanstack/solid-query'\n\nexport interface MyRouterContext {\n  queryClient: QueryClient\n}\nexport const Route = createRootRouteWithContext<MyRouterContext>()\n```\n\n<!-- ::end:framework -->\n\nTo learn more about Context in TanStack Router, see the [Router Context](../guide/router-context.md) guide.\n\n## Basic Routes\n\nBasic routes match a specific path, for example `/about`, `/settings`, `/settings/notifications` are all basic routes, as they match the path exactly.\n\nLet's take a look at an `/about` route:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/about.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return <div>About</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/about.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return <div>About</div>\n}\n```\n\n<!-- ::end:framework -->\n\nBasic routes are simple and straightforward. They match the path exactly and render the provided component.\n\n## Index Routes\n\nIndex routes specifically target their parent route when it is **matched exactly and no child route is matched**.\n\nLet's take a look at an index route for a `/posts` URL:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.index.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\n// Note the trailing slash, which is used to target index routes\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Please select a post!</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.index.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\n// Note the trailing slash, which is used to target index routes\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Please select a post!</div>\n}\n```\n\n<!-- ::end:framework -->\n\nThis route will be matched when the URL is `/posts` exactly.\n\n## Dynamic Route Segments\n\nRoute 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' }`.\n\nThese params are then usable in your route's configuration and components! Let's look at a `posts.$postId.tsx` route:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts/$postId.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  // In a loader\n  loader: ({ params }) => fetchPost(params.postId),\n  // Or in a component\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  // In a component!\n  const { postId } = Route.useParams()\n  return <div>Post ID: {postId}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  // In a loader\n  loader: ({ params }) => fetchPost(params.postId),\n  // Or in a component\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  // In a component!\n  const { postId } = Route.useParams()\n  return <div>Post ID: {postId()}</div>\n}\n```\n\n<!-- ::end:framework -->\n\n> 🧠 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.\n\n## Splat / Catch-All Routes\n\nA 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.\n\nFor example, a route targeting the `files/$` path is a splat route. If the URL pathname is `/files/documents/hello-world`, the `params` object would contain `documents/hello-world` under the special `_splat` property:\n\n```js\n{\n  '_splat': 'documents/hello-world'\n}\n```\n\n> ⚠️ 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.\n\n> 🧠 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.\n\n## Optional Path Parameters\n\nOptional path parameters allow you to define route segments that may or may not be present in the URL. They use the `{-$paramName}` syntax and provide flexible routing patterns where certain parameters are optional.\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.{-$category}.tsx\"\n// The `-$category` segment is optional, so this route matches both `/posts` and `/posts/tech`\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/{-$category}')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const { category } = Route.useParams()\n\n  return <div>{category ? `Posts in ${category}` : 'All Posts'}</div>\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.{-$category}.tsx\"\n// The `-$category` segment is optional, so this route matches both `/posts` and `/posts/tech`\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/{-$category}')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const { category } = Route.useParams()\n\n  return <div>{category ? `Posts in ${category()}` : 'All Posts'}</div>\n}\n```\n\n<!-- ::end:framework -->\n\nThis route will match both `/posts` (category is `undefined`) and `/posts/tech` (category is `\"tech\"`).\n\nYou can also define multiple optional parameters in a single route:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.{-$category}.${-$slug}.tsx\"\n// The `-$category` segment is optional, so this route matches both `/posts` and `/posts/tech`\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/{-$category}/{-$slug}')({\n  component: PostsComponent,\n})\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.{-$category}.${-$slug}.tsx\"\n// The `-$category` segment is optional, so this route matches both `/posts` and `/posts/tech`\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/{-$category}/{-$slug}')({\n  component: PostsComponent,\n})\n```\n\n<!-- ::end:framework -->\n\nThis route matches `/posts`, `/posts/tech`, and `/posts/tech/hello-world`.\n\n> 🧠 Routes with optional parameters are ranked lower in priority than exact matches, ensuring that more specific routes like `/posts/featured` are matched before `/posts/{-$category}`.\n\n## Layout Routes\n\nLayout routes are used to wrap child routes with additional components and logic. They are useful for:\n\n- Wrapping child routes with a layout component\n- Enforcing a `loader` requirement before displaying any child routes\n- Validating and providing search params to child routes\n- Providing fallbacks for error components or pending elements to child routes\n- Providing shared context to all child routes\n- And more!\n\nLet's take a look at an example layout route called `app.tsx`:\n\n```\nroutes/\n├── app.tsx\n├── app.dashboard.tsx\n├── app.settings.tsx\n```\n\nIn the tree above, `app.tsx` is a layout route that wraps two child routes, `app.dashboard.tsx` and `app.settings.tsx`.\n\nThis tree structure is used to wrap the child routes with a layout component:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/app.tsx\"\nimport { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/app')({\n  component: AppLayoutComponent,\n})\n\nfunction AppLayoutComponent() {\n  return (\n    <div>\n      <h1>App Layout</h1>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/app.tsx\"\nimport { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/app')({\n  component: AppLayoutComponent,\n})\n\nfunction AppLayoutComponent() {\n  return (\n    <div>\n      <h1>App Layout</h1>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nThe following table shows which component(s) will be rendered based on the URL:\n\n| URL Path         | Component                |\n| ---------------- | ------------------------ |\n| `/app`           | `<AppLayout>`            |\n| `/app/dashboard` | `<AppLayout><Dashboard>` |\n| `/app/settings`  | `<AppLayout><Settings>`  |\n\nSince TanStack Router supports mixed flat and directory routes, you can also express your application's routing using layout routes within directories:\n\n```\nroutes/\n├── app/\n│   ├── route.tsx\n│   ├── dashboard.tsx\n│   ├── settings.tsx\n```\n\nIn this nested tree, the `app/route.tsx` file is a configuration for the layout route that wraps two child routes, `app/dashboard.tsx` and `app/settings.tsx`.\n\nLayout Routes also let you enforce component and loader logic for Dynamic Route Segments:\n\n```\nroutes/\n├── app/users/\n│   ├── $userId/\n|   |   ├── route.tsx\n|   |   ├── index.tsx\n|   |   ├── edit.tsx\n```\n\n## Pathless Layout Routes\n\nLike [Layout Routes](#layout-routes), Pathless Layout Routes are used to wrap child routes with additional components and logic. However, pathless layout routes do not require a matching `path` in the URL and are used to wrap child routes with additional components and logic without requiring a matching `path` in the URL.\n\nPathless Layout Routes are prefixed with an underscore (`_`) to denote that they are \"pathless\".\n\n> 🧠 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.\n\nLet's take a look at an example route called `_pathlessLayout.tsx`:\n\n```\n\nroutes/\n├── _pathlessLayout.tsx\n├── _pathlessLayout.a.tsx\n├── _pathlessLayout.b.tsx\n\n```\n\nIn the tree above, `_pathlessLayout.tsx` is a pathless layout route that wraps two child routes, `_pathlessLayout.a.tsx` and `_pathlessLayout.b.tsx`.\n\nThe `_pathlessLayout.tsx` route is used to wrap the child routes with a Pathless layout component:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/_pathlessLayout.tsx\"\nimport { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <h1>Pathless layout</h1>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/_pathlessLayout.tsx\"\nimport { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <h1>Pathless layout</h1>\n      <Outlet />\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nThe following table shows which component will be rendered based on the URL:\n\n| URL Path | Component             |\n| -------- | --------------------- |\n| `/`      | `<Index>`             |\n| `/a`     | `<PathlessLayout><A>` |\n| `/b`     | `<PathlessLayout><B>` |\n\nSince TanStack Router supports mixed flat and directory routes, you can also express your application's routing using pathless layout routes within directories:\n\n```\nroutes/\n├── _pathlessLayout/\n│   ├── route.tsx\n│   ├── a.tsx\n│   ├── b.tsx\n```\n\nHowever, unlike Layout Routes, since Pathless Layout Routes do not match based on URL path segments, this means that these routes do not support [Dynamic Route Segments](#dynamic-route-segments) as part of their path and therefore cannot be matched in the URL.\n\nThis means that you cannot do this:\n\n```\nroutes/\n├── _$postId/ ❌\n│   ├── ...\n```\n\nRather, you'd have to do this:\n\n```\nroutes/\n├── $postId/\n├── _postPathlessLayout/ ✅\n│   ├── ...\n```\n\n## Non-Nested Routes\n\nNon-nested routes can be created by suffixing a parent file route segment with a `_` and are used to **un-nest** a route from its parents and render its own component tree.\n\nConsider the following flat route tree:\n\n```\nroutes/\n├── posts.tsx\n├── posts.$postId.tsx\n├── posts_.$postId.edit.tsx\n```\n\nThe following table shows which component will be rendered based on the URL:\n\n| URL Path          | Component                    |\n| ----------------- | ---------------------------- |\n| `/posts`          | `<Posts>`                    |\n| `/posts/123`      | `<Posts><Post postId=\"123\">` |\n| `/posts/123/edit` | `<PostEditor postId=\"123\">`  |\n\n- The `posts.$postId.tsx` route is nested as normal under the `posts.tsx` route and will render `<Posts><Post>`.\n- The `posts_.$postId.edit.tsx` route **does not share** the same `posts` prefix as the other routes and therefore will be treated as if it is a top-level route and will render `<PostEditor>`.\n\n## Excluding Files and Folders from Routes\n\nFiles and folders can be excluded from route generation with a `-` prefix attached to the file name. This gives you the ability to colocate logic in the route directories.\n\nConsider the following route tree:\n\n```\nroutes/\n├── posts.tsx\n├── -posts-table.tsx // 👈🏼 ignored\n├── -components/ // 👈🏼 ignored\n│   ├── header.tsx // 👈🏼 ignored\n│   ├── footer.tsx // 👈🏼 ignored\n│   ├── ...\n```\n\nWe can import from the excluded files into our posts route\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/react-router'\nimport { PostsTable } from './-posts-table'\nimport { PostsHeader } from './-components/header'\nimport { PostsFooter } from './-components/footer'\n\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div>\n      <PostsHeader />\n      <PostsTable posts={posts} />\n      <PostsFooter />\n    </div>\n  )\n}\n```\n\n# Solid\n\n```tsx title=\"src/routes/posts.tsx\"\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { PostsTable } from './-posts-table'\nimport { PostsHeader } from './-components/header'\nimport { PostsFooter } from './-components/footer'\n\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div>\n      <PostsHeader />\n      <PostsTable posts={posts} />\n      <PostsFooter />\n    </div>\n  )\n}\n```\n\n<!-- ::end:framework -->\n\nThe excluded files will not be added to `routeTree.gen.ts`.\n\n## Pathless Route Group Directories\n\nPathless route group directories use `()` as a way to group routes files together regardless of their path. They are purely organizational and do not affect the route tree or component tree in any way.\n\n```\nroutes/\n├── index.tsx\n├── (app)/\n│   ├── dashboard.tsx\n│   ├── settings.tsx\n│   ├── users.tsx\n├── (auth)/\n│   ├── login.tsx\n│   ├── register.tsx\n```\n\nIn the example above, the `app` and `auth` directories are purely organizational and do not affect the route tree or component tree in any way. They are used to group related routes together for easier navigation and organization.\n\nThe following table shows which component will be rendered based on the URL:\n\n| URL Path     | Component     |\n| ------------ | ------------- |\n| `/`          | `<Index>`     |\n| `/dashboard` | `<Dashboard>` |\n| `/settings`  | `<Settings>`  |\n| `/users`     | `<Users>`     |\n| `/login`     | `<Login>`     |\n| `/register`  | `<Register>`  |\n\nAs you can see, the `app` and `auth` directories are purely organizational and do not affect the route tree or component tree in any way.\n"
  },
  {
    "path": "docs/router/routing/virtual-file-routes.md",
    "content": "---\nid: virtual-file-routes\ntitle: Virtual File Routes\n---\n\n> We'd like to thank the Remix team for [pioneering the concept of virtual file routes](https://www.youtube.com/watch?v=fjTX8hQTlEc&t=730s). We've taken inspiration from their work and adapted it to work with TanStack Router's existing file-based route-tree generation.\n\nVirtual file routes are a powerful concept that allows you to build a route tree programmatically using code that references real files in your project. This can be useful if:\n\n- You have an existing route organization that you want to keep.\n- You want to customize the location of your route files.\n- You want to completely override TanStack Router's file-based route generation and build your own convention.\n\nHere's a quick example of using virtual file routes to map a route tree to a set of real files in your project:\n\n```tsx\n// routes.ts\nimport {\n  rootRoute,\n  route,\n  index,\n  layout,\n  physical,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('index.tsx'),\n  layout('pathlessLayout.tsx', [\n    route('/dashboard', 'app/dashboard.tsx', [\n      index('app/dashboard-index.tsx'),\n      route('/invoices', 'app/dashboard-invoices.tsx', [\n        index('app/invoices-index.tsx'),\n        route('$id', 'app/invoice-detail.tsx'),\n      ]),\n    ]),\n    physical('/posts', 'posts'),\n  ]),\n])\n```\n\n## Configuration\n\nVirtual file routes can be configured either via:\n\n- The `TanStackRouter` plugin for Vite/Rspack/Webpack\n- The `tsr.config.json` file for the TanStack Router CLI\n\n## Configuration via the TanStackRouter Plugin\n\nIf you're using the `TanStackRouter` plugin for Vite/Rspack/Webpack, you can configure virtual file routes by passing the path of your routes file to the `virtualRoutesConfig` option when setting up the plugin:\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"vite.config.ts\"\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      virtualRouteConfig: './routes.ts',\n    }),\n    react(),\n  ],\n})\n```\n\n# Solid\n\n```tsx title=\"vite.config.ts\"\nimport { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'solid',\n      virtualRouteConfig: './routes.ts',\n    }),\n    solid(),\n  ],\n})\n```\n\n<!-- ::end:framework -->\n\nOr, you choose to define the virtual routes directly in the configuration:\n\n```tsx\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { rootRoute } from '@tanstack/virtual-file-routes'\n\nconst routes = rootRoute('root.tsx', [\n  // ... the rest of your virtual route tree\n])\n\nexport default defineConfig({\n  plugins: [tanstackRouter({ virtualRouteConfig: routes }), react()],\n})\n```\n\n<!-- ::start:framework -->\n\n# React\n\n```tsx title=\"vite.config.ts\"\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nconst routes = rootRoute('root.tsx', [\n  // ... the rest of your virtual route tree\n])\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({ virtualRouteConfig: routes, target: 'react' }),\n    react(),\n  ],\n})\n```\n\n# Solid\n\n```tsx title=\"vite.config.ts\"\nimport { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nconst routes = rootRoute('root.tsx', [\n  // ... the rest of your virtual route tree\n])\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({ virtualRouteConfig: routes, target: 'solid' }),\n    solid(),\n  ],\n})\n```\n\n<!-- ::end:framework -->\n\n## Creating Virtual File Routes\n\nTo create virtual file routes, you'll need to import the `@tanstack/virtual-file-routes` package. This package provides a set of functions that allow you to create virtual routes that reference real files in your project. A few utility functions are exported from the package:\n\n- `rootRoute` - Creates a virtual root route.\n- `route` - Creates a virtual route.\n- `index` - Creates a virtual index route.\n- `layout` - Creates a virtual pathless layout route.\n- `physical` - Creates a physical virtual route (more on this later).\n\n## Virtual Root Route\n\nThe `rootRoute` function is used to create a virtual root route. It takes a file name and an array of children routes. Here's an example of a virtual root route:\n\n```tsx\n// routes.ts\nimport { rootRoute } from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  // ... children routes\n])\n```\n\n## Virtual Route\n\nThe `route` function is used to create a virtual route. It takes a path, a file name, and an array of children routes. Here's an example of a virtual route:\n\n```tsx\n// routes.ts\nimport { route } from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  route('/about', 'about.tsx', [\n    // ... children routes\n  ]),\n])\n```\n\nYou can also define a virtual route without a file name. This allows to set a common path prefix for its children:\n\n```tsx\n// routes.ts\nimport { route } from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  route('/hello', [\n    route('/world', 'world.tsx'), // full path will be \"/hello/world\"\n    route('/universe', 'universe.tsx'), // full path will be \"/hello/universe\"\n  ]),\n])\n```\n\n## Virtual Index Route\n\nThe `index` function is used to create a virtual index route. It takes a file name. Here's an example of a virtual index route:\n\n```tsx\nimport { index } from '@tanstack/virtual-file-routes'\n\nconst routes = rootRoute('root.tsx', [index('index.tsx')])\n```\n\n## Virtual Pathless Route\n\nThe `layout` function is used to create a virtual pathless route. It takes a file name, an array of children routes, and an optional pathless ID. Here's an example of a virtual pathless route:\n\n```tsx\n// routes.ts\nimport { layout } from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  layout('pathlessLayout.tsx', [\n    // ... children routes\n  ]),\n])\n```\n\nYou can also specify a pathless ID to give the route a unique identifier that is different from the filename:\n\n```tsx\n// routes.ts\nimport { layout } from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  layout('my-pathless-layout-id', 'pathlessLayout.tsx', [\n    // ... children routes\n  ]),\n])\n```\n\n## Physical Virtual Routes\n\nPhysical virtual routes are a way to \"mount\" a directory of good ol' TanStack Router File Based routing convention under a specific URL path. This can be useful if you are using virtual routes to customize a small portion of your route tree high up in the hierarchy, but want to use the standard file-based routing convention for sub-routes and directories.\n\nConsider the following file structure:\n\n```\n/routes\n├── root.tsx\n├── index.tsx\n├── pathlessLayout.tsx\n├── app\n│   ├── dashboard.tsx\n│   ├── dashboard-index.tsx\n│   ├── dashboard-invoices.tsx\n│   ├── invoices-index.tsx\n│   ├── invoice-detail.tsx\n└── posts\n    ├── index.tsx\n    ├── $postId.tsx\n    ├── $postId.edit.tsx\n    ├── comments/\n    │   ├── index.tsx\n    │   ├── $commentId.tsx\n    └── likes/\n        ├── index.tsx\n        ├── $likeId.tsx\n```\n\nLet's use virtual routes to customize our route tree for everything but `posts`, then use physical virtual routes to mount the `posts` directory under the `/posts` path:\n\n```tsx\n// routes.ts\nexport const routes = rootRoute('root.tsx', [\n  // Set up your virtual routes as normal\n  index('index.tsx'),\n  layout('pathlessLayout.tsx', [\n    route('/dashboard', 'app/dashboard.tsx', [\n      index('app/dashboard-index.tsx'),\n      route('/invoices', 'app/dashboard-invoices.tsx', [\n        index('app/invoices-index.tsx'),\n        route('$id', 'app/invoice-detail.tsx'),\n      ]),\n    ]),\n    // Mount the `posts` directory under the `/posts` path\n    physical('/posts', 'posts'),\n  ]),\n])\n```\n\n### Merging Physical Routes at Current Level\n\nYou can also use `physical` with an empty path prefix (or a single argument) to merge routes from a physical directory directly at the current level, without adding a path prefix. This is useful when you want to organize your routes into separate directories but have them appear at the same URL level.\n\nConsider the following file structure:\n\n```\n/routes\n├── __root.tsx\n├── about.tsx\n└── features\n    ├── index.tsx\n    └── contact.tsx\n```\n\nYou can merge the `features` directory routes at the root level:\n\n```tsx\n// routes.ts\nimport { physical, rootRoute, route } from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('__root.tsx', [\n  route('/about', 'about.tsx'),\n  // Merge features/ routes at root level (no path prefix)\n  physical('features'),\n  // Or equivalently: physical('', 'features')\n])\n```\n\nThis will produce the following routes:\n\n- `/about` - from `about.tsx`\n- `/` - from `features/index.tsx`\n- `/contact` - from `features/contact.tsx`\n\n> **Note:** When merging at the same level, ensure there are no conflicting route paths between your virtual routes and the physical directory routes. If a conflict occurs (e.g., both have an `/about` route), the generator will throw an error.\n\n## Virtual Routes inside of TanStack Router File Based routing\n\nThe previous section showed you how you can use TanStack Router's File Based routing convention inside of a virtual route configuration.\nHowever, the opposite is possible as well.  \nYou can configure the main part of your app's route tree using TanStack Router's File Based routing convention and opt into virtual route configuration for specific subtrees.\n\nConsider the following file structure:\n\n```\n/routes\n├── __root.tsx\n├── foo\n│   ├── bar\n│   │   ├── __virtual.ts\n│   │   ├── details.tsx\n│   │   ├── home.tsx\n│   │   └── route.ts\n│   └── bar.tsx\n└── index.tsx\n```\n\nLet's look at the `bar` directory which contains a special file named `__virtual.ts`. This file instructs the generator to switch over to virtual file route configuration for this directory (and its child directories).\n\n`__virtual.ts` configures the virtual routes for that particular subtree of the route tree. It uses the same API as explained above, with the only difference being that no `rootRoute` is defined for that subtree:\n\n```tsx\n// routes/foo/bar/__virtual.ts\nimport {\n  defineVirtualSubtreeConfig,\n  index,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport default defineVirtualSubtreeConfig([\n  index('home.tsx'),\n  route('$id', 'details.tsx'),\n])\n```\n\nThe helper function `defineVirtualSubtreeConfig` is closely modeled after vite's `defineConfig` and allows you to define a subtree configuration via a default export. The default export can either be\n\n- a subtree config object\n- a function returning a subtree config object\n- an async function returning a subtree config object\n\n## Inception\n\nYou can mix and match TanStack Router's File Based routing convention and virtual route configuration however you like.  \nLet's go deeper!  \nCheck out the following example that starts off using File Based routing convention, switches over to virtual route configuration for `/posts`, switches back to File Based routing convention for `/posts/lets-go` only to switch over to virtual route configuration again for `/posts/lets-go/deeper`.\n\n```\n├── __root.tsx\n├── index.tsx\n├── posts\n│   ├── __virtual.ts\n│   ├── details.tsx\n│   ├── home.tsx\n│   └── lets-go\n│       ├── deeper\n│       │   ├── __virtual.ts\n│       │   └── home.tsx\n│       └── index.tsx\n└── posts.tsx\n```\n\n## Configuration via the TanStack Router CLI\n\nIf you're using the TanStack Router CLI, you can configure virtual file routes by defining the path to your routes file in the `tsr.config.json` file:\n\n```json\n// tsr.config.json\n{\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n```\n\nOr you can define the virtual routes directly in the configuration, while much less common allows you to configure them via the TanStack Router CLI by adding a `virtualRouteConfig` object to your `tsr.config.json` file and defining your virtual routes and passing the resulting JSON that is generated by calling the actual `rootRoute`/`route`/`index`/etc functions from the `@tanstack/virtual-file-routes` package:\n\n```json\n// tsr.config.json\n{\n  \"virtualRouteConfig\": {\n    \"type\": \"root\",\n    \"file\": \"root.tsx\",\n    \"children\": [\n      {\n        \"type\": \"index\",\n        \"file\": \"home.tsx\"\n      },\n      {\n        \"type\": \"route\",\n        \"file\": \"posts/posts.tsx\",\n        \"path\": \"/posts\",\n        \"children\": [\n          {\n            \"type\": \"index\",\n            \"file\": \"posts/posts-home.tsx\"\n          },\n          {\n            \"type\": \"route\",\n            \"file\": \"posts/posts-detail.tsx\",\n            \"path\": \"$postId\"\n          }\n        ]\n      },\n      {\n        \"type\": \"layout\",\n        \"id\": \"first\",\n        \"file\": \"layout/first-pathless-layout.tsx\",\n        \"children\": [\n          {\n            \"type\": \"layout\",\n            \"id\": \"second\",\n            \"file\": \"layout/second-pathless-layout.tsx\",\n            \"children\": [\n              {\n                \"type\": \"route\",\n                \"file\": \"a.tsx\",\n                \"path\": \"/route-a\"\n              },\n              {\n                \"type\": \"route\",\n                \"file\": \"b.tsx\",\n                \"path\": \"/route-b\"\n              }\n            ]\n          }\n        ]\n      }\n    ]\n  }\n}\n```\n"
  },
  {
    "path": "docs/start/config.json",
    "content": "{\n  \"$schema\": \"https://raw.githubusercontent.com/TanStack/tanstack.com/main/tanstack-docs-config.schema.json\",\n  \"docSearch\": {\n    \"appId\": \"FQ0DQ6MA3C\",\n    \"apiKey\": \"8264730bab8a9b7fa6a0c85761d7a3fe\",\n    \"indexName\": \"tanstack\"\n  },\n  \"sections\": [\n    {\n      \"label\": \"Getting Started\",\n      \"children\": [],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": [\n            {\n              \"label\": \"Overview\",\n              \"to\": \"framework/react/overview\"\n            },\n            {\n              \"label\": \"Getting Started\",\n              \"to\": \"framework/react/getting-started\"\n            },\n            {\n              \"label\": \"Quick Start\",\n              \"to\": \"framework/react/quick-start\"\n            },\n            {\n              \"label\": \"Build from Scratch\",\n              \"to\": \"framework/react/build-from-scratch\"\n            },\n            {\n              \"label\": \"Comparison\",\n              \"to\": \"framework/react/comparison\"\n            },\n            {\n              \"label\": \"Start vs Next.js\",\n              \"to\": \"framework/react/start-vs-nextjs\"\n            },\n            {\n              \"label\": \"Migrate from Next.js\",\n              \"to\": \"framework/react/migrate-from-next-js\"\n            }\n          ]\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": [\n            {\n              \"label\": \"Overview\",\n              \"to\": \"framework/solid/overview\"\n            },\n            {\n              \"label\": \"Getting Started\",\n              \"to\": \"framework/solid/getting-started\"\n            },\n            {\n              \"label\": \"Quick Start\",\n              \"to\": \"framework/solid/quick-start\"\n            },\n            {\n              \"label\": \"Build from Scratch\",\n              \"to\": \"framework/solid/build-from-scratch\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"label\": \"Guides\",\n      \"children\": [],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": [\n            {\n              \"label\": \"Routing\",\n              \"to\": \"framework/react/guide/routing\"\n            },\n            {\n              \"label\": \"Execution Model\",\n              \"to\": \"framework/react/guide/execution-model\"\n            },\n            {\n              \"label\": \"Code Execution Patterns\",\n              \"to\": \"framework/react/guide/code-execution-patterns\"\n            },\n            {\n              \"label\": \"Import Protection\",\n              \"to\": \"framework/react/guide/import-protection\"\n            },\n            {\n              \"label\": \"Environment Variables\",\n              \"to\": \"framework/react/guide/environment-variables\"\n            },\n            {\n              \"label\": \"Server Functions\",\n              \"to\": \"framework/react/guide/server-functions\"\n            },\n            {\n              \"label\": \"Static Server Functions\",\n              \"to\": \"framework/react/guide/static-server-functions\"\n            },\n            {\n              \"label\": \"Environment Functions\",\n              \"to\": \"framework/react/guide/environment-functions\"\n            },\n            {\n              \"label\": \"Middleware\",\n              \"to\": \"framework/react/guide/middleware\"\n            },\n            {\n              \"label\": \"Error Boundaries\",\n              \"to\": \"framework/react/guide/error-boundaries\"\n            },\n            {\n              \"label\": \"Server Routes\",\n              \"to\": \"framework/react/guide/server-routes\"\n            },\n            {\n              \"label\": \"Hydration Errors\",\n              \"to\": \"framework/react/guide/hydration-errors\"\n            },\n            {\n              \"label\": \"Selective SSR\",\n              \"to\": \"framework/react/guide/selective-ssr\"\n            },\n            {\n              \"label\": \"SPA Mode\",\n              \"to\": \"framework/react/guide/spa-mode\"\n            },\n            {\n              \"label\": \"Static Prerendering\",\n              \"to\": \"framework/react/guide/static-prerendering\"\n            },\n            {\n              \"label\": \"Incremental Static Regeneration (ISR)\",\n              \"to\": \"framework/react/guide/isr\"\n            },\n            {\n              \"label\": \"Server Entry Point\",\n              \"to\": \"framework/react/guide/server-entry-point\"\n            },\n            {\n              \"label\": \"CDN Asset URLs\",\n              \"to\": \"framework/react/guide/cdn-asset-urls\"\n            },\n            {\n              \"label\": \"Client Entry Point\",\n              \"to\": \"framework/react/guide/client-entry-point\"\n            },\n            {\n              \"label\": \"Hosting\",\n              \"to\": \"framework/react/guide/hosting\"\n            },\n            {\n              \"label\": \"Authentication Overview\",\n              \"to\": \"framework/react/guide/authentication-overview\"\n            },\n            {\n              \"label\": \"Authentication\",\n              \"to\": \"framework/react/guide/authentication\"\n            },\n            {\n              \"label\": \"Databases\",\n              \"to\": \"framework/react/guide/databases\"\n            },\n            {\n              \"label\": \"Observability\",\n              \"to\": \"framework/react/guide/observability\"\n            },\n            {\n              \"label\": \"Path Aliases\",\n              \"to\": \"framework/react/guide/path-aliases\"\n            },\n            {\n              \"label\": \"Tailwind CSS Integration\",\n              \"to\": \"framework/react/guide/tailwind-integration\"\n            },\n            {\n              \"label\": \"Rendering Markdown\",\n              \"to\": \"framework/react/guide/rendering-markdown\"\n            },\n            {\n              \"label\": \"SEO\",\n              \"to\": \"framework/react/guide/seo\"\n            },\n            {\n              \"label\": \"LLM Optimization (LLMO)\",\n              \"to\": \"framework/react/guide/llmo\"\n            }\n          ]\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": [\n            {\n              \"label\": \"Routing\",\n              \"to\": \"framework/solid/guide/routing\"\n            },\n            {\n              \"label\": \"Execution Model\",\n              \"to\": \"framework/solid/guide/execution-model\"\n            },\n            {\n              \"label\": \"Code Execution Patterns\",\n              \"to\": \"framework/solid/guide/code-execution-patterns\"\n            },\n            {\n              \"label\": \"Import Protection\",\n              \"to\": \"framework/solid/guide/import-protection\"\n            },\n            {\n              \"label\": \"Environment Variables\",\n              \"to\": \"framework/solid/guide/environment-variables\"\n            },\n            {\n              \"label\": \"Server Functions\",\n              \"to\": \"framework/solid/guide/server-functions\"\n            },\n            {\n              \"label\": \"Static Server Functions\",\n              \"to\": \"framework/solid/guide/static-server-functions\"\n            },\n            {\n              \"label\": \"Environment Functions\",\n              \"to\": \"framework/solid/guide/environment-functions\"\n            },\n            {\n              \"label\": \"Middleware\",\n              \"to\": \"framework/solid/guide/middleware\"\n            },\n            {\n              \"label\": \"Error Boundaries\",\n              \"to\": \"framework/solid/guide/error-boundaries\"\n            },\n            {\n              \"label\": \"Server Routes\",\n              \"to\": \"framework/solid/guide/server-routes\"\n            },\n            {\n              \"label\": \"Hydration Errors\",\n              \"to\": \"framework/solid/guide/hydration-errors\"\n            },\n            {\n              \"label\": \"Selective SSR\",\n              \"to\": \"framework/solid/guide/selective-ssr\"\n            },\n            {\n              \"label\": \"SPA Mode\",\n              \"to\": \"framework/solid/guide/spa-mode\"\n            },\n            {\n              \"label\": \"Static Prerendering\",\n              \"to\": \"framework/solid/guide/static-prerendering\"\n            },\n            {\n              \"label\": \"Server Entry Point\",\n              \"to\": \"framework/solid/guide/server-entry-point\"\n            },\n            {\n              \"label\": \"Client Entry Point\",\n              \"to\": \"framework/solid/guide/client-entry-point\"\n            },\n            {\n              \"label\": \"Hosting\",\n              \"to\": \"framework/solid/guide/hosting\"\n            },\n            {\n              \"label\": \"Authentication Overview\",\n              \"to\": \"framework/solid/guide/authentication-overview\"\n            },\n            {\n              \"label\": \"Authentication\",\n              \"to\": \"framework/solid/guide/authentication\"\n            },\n            {\n              \"label\": \"Databases\",\n              \"to\": \"framework/solid/guide/databases\"\n            },\n            {\n              \"label\": \"Observability\",\n              \"to\": \"framework/solid/guide/observability\"\n            },\n            {\n              \"label\": \"Path Aliases\",\n              \"to\": \"framework/solid/guide/path-aliases\"\n            },\n            {\n              \"label\": \"Tailwind CSS Integration\",\n              \"to\": \"framework/solid/guide/tailwind-integration\"\n            },\n            {\n              \"label\": \"SEO\",\n              \"to\": \"framework/solid/guide/seo\"\n            },\n            {\n              \"label\": \"LLM Optimization (LLMO)\",\n              \"to\": \"framework/solid/guide/llmo\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"label\": \"Examples\",\n      \"children\": [],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": [\n            {\n              \"label\": \"Basic\",\n              \"to\": \"framework/react/examples/start-basic\"\n            },\n            {\n              \"label\": \"Basic + React Query\",\n              \"to\": \"framework/react/examples/start-basic-react-query\"\n            },\n            {\n              \"label\": \"Basic + Clerk Auth\",\n              \"to\": \"framework/react/examples/start-clerk-basic\"\n            },\n            {\n              \"label\": \"Basic + DIY Auth\",\n              \"to\": \"framework/react/examples/start-basic-auth\"\n            },\n            {\n              \"label\": \"Basic + Supabase Auth\",\n              \"to\": \"framework/react/examples/start-supabase-basic\"\n            },\n            {\n              \"label\": \"Trellaux + Convex\",\n              \"to\": \"framework/react/examples/start-convex-trellaux\"\n            },\n            {\n              \"label\": \"Trellaux\",\n              \"to\": \"framework/react/examples/start-trellaux\"\n            },\n            {\n              \"label\": \"WorkOS\",\n              \"to\": \"framework/react/examples/start-workos\"\n            },\n            {\n              \"label\": \"Material UI\",\n              \"to\": \"framework/react/examples/start-material-ui\"\n            },\n            {\n              \"label\": \"Basic + Auth.js\",\n              \"to\": \"framework/react/examples/start-basic-authjs\"\n            },\n            {\n              \"label\": \"Basic + Static rendering\",\n              \"to\": \"framework/react/examples/start-basic-static\"\n            },\n            {\n              \"label\": \"Cloudflare Vite Plugin\",\n              \"to\": \"framework/react/examples/start-basic-cloudflare\"\n            }\n          ]\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": [\n            {\n              \"label\": \"Basic\",\n              \"to\": \"framework/solid/examples/start-basic\"\n            },\n            {\n              \"label\": \"Basic + Solid Query\",\n              \"to\": \"framework/solid/examples/start-basic-solid-query\"\n            },\n            {\n              \"label\": \"Basic + DIY Auth\",\n              \"to\": \"framework/solid/examples/start-basic-auth\"\n            },\n            {\n              \"label\": \"Basic + Supabase Auth\",\n              \"to\": \"framework/solid/examples/start-supabase-basic\"\n            },\n            {\n              \"label\": \"Basic + Convex + Better Auth\",\n              \"to\": \"framework/solid/examples/start-convex-better-auth\"\n            },\n            {\n              \"label\": \"Basic + Auth.js\",\n              \"to\": \"framework/solid/examples/start-basic-authjs\"\n            },\n            {\n              \"label\": \"Basic + Static rendering\",\n              \"to\": \"framework/solid/examples/start-basic-static\"\n            },\n            {\n              \"label\": \"Cloudflare Vite Plugin\",\n              \"to\": \"framework/solid/examples/start-basic-cloudflare\"\n            },\n            {\n              \"label\": \"Netlify Vite Plugin\",\n              \"to\": \"framework/solid/examples/start-basic-netlify\"\n            },\n            {\n              \"label\": \"Nitro Vite Plugin\",\n              \"to\": \"framework/solid/examples/start-basic-nitro\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"label\": \"Tutorials\",\n      \"children\": [],\n      \"frameworks\": [\n        {\n          \"label\": \"react\",\n          \"children\": [\n            {\n              \"label\": \"Reading and Writing a File\",\n              \"to\": \"framework/react/tutorial/reading-writing-file\"\n            },\n            {\n              \"label\": \"Fetching Data from External API\",\n              \"to\": \"framework/react/tutorial/fetching-external-api\"\n            }\n          ]\n        },\n        {\n          \"label\": \"solid\",\n          \"children\": [\n            {\n              \"label\": \"Reading and Writing a File\",\n              \"to\": \"framework/solid/tutorial/reading-writing-file\"\n            },\n            {\n              \"label\": \"Fetching Data from External API\",\n              \"to\": \"framework/solid/tutorial/fetching-external-api\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "docs/start/framework/react/build-from-scratch.md",
    "content": "---\nid: build-from-scratch\ntitle: Build a Project from Scratch\n---\n\n> [!NOTE]\n> If you chose to quick start with an example or cloned project, you can skip this guide and move on to the [Routing](./guide/routing) guide.\n\n_So you want to build a TanStack Start project from scratch?_\n\nThis guide will help you build a **very** basic TanStack Start web application. Together, we will use TanStack Start to:\n\n- Serve an index page\n- Display a counter\n- Increment the counter on the server and client\n\n[Here is what that will look like](https://stackblitz.com/github/tanstack/router/tree/main/examples/react/start-counter)\n\nLet's create a new project directory and initialize it.\n\n```shell\nmkdir myApp\ncd myApp\nnpm init -y\n```\n\n> [!NOTE]\n> We use `npm` in all of these examples, but you can use your package manager of choice instead.\n\n## TypeScript Configuration\n\nWe highly recommend using TypeScript with TanStack Start. Create a `tsconfig.json` file with at least the following settings:\n\n```json\n{\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"target\": \"ES2022\",\n    \"skipLibCheck\": true,\n    \"strictNullChecks\": true\n  }\n}\n```\n\n> [!NOTE]\n> Enabling `verbatimModuleSyntax` can result in server bundles leaking into client bundles. It is recommended to keep this option disabled.\n\n## Install Dependencies\n\nTanStack Start is powered by [Vite](https://vite.dev/) and [TanStack Router](https://tanstack.com/router) and requires them as dependencies.\n\nTo install them, run:\n\n```shell\nnpm i @tanstack/react-start @tanstack/react-router\n```\n\nWe also need vite as a devDependency:\n\n```shell\nnpm i -D vite\n```\n\nYou'll also need React:\n\n```shell\nnpm i react react-dom\n```\n\nAs well as React's Vite plugin:\n\n```shell\nnpm i -D @vitejs/plugin-react\n```\n\nAlternatively, you can also use `@vitejs/plugin-react-swc`.\n\nand some TypeScript:\n\n```shell\nnpm i -D typescript @types/react @types/react-dom @types/node\n```\n\n## Update Configuration Files\n\nWe'll then update our `package.json` to use Vite's CLI and set `\"type\": \"module\"`:\n\n```json\n{\n  // ...\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\"\n  }\n}\n```\n\nThen configure TanStack Start's Vite plugin in `vite.config.ts`:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tanstackStart(),\n    // react's vite plugin must come after start's vite plugin\n    viteReact(),\n  ],\n})\n```\n\n## Add the Basic Templating\n\nThere are 2 required files for TanStack Start usage:\n\n1. The router configuration\n2. The root of your application\n\nOnce configuration is done, we'll have a file tree that looks like the following:\n\n```\n.\n├── src/\n│   ├── routes/\n│   │   └── `__root.tsx`\n│   ├── `router.tsx`\n│   ├── `routeTree.gen.ts`\n├── `vite.config.ts`\n├── `package.json`\n└── `tsconfig.json`\n```\n\n## The Router Configuration\n\nThis is the file that will dictate the behavior of TanStack Router used within Start. Here, you can configure everything\nfrom the default [preloading functionality](/router/latest/docs/framework/react/guide/preloading) to [caching staleness](/router/latest/docs/framework/react/guide/data-loading).\n\n> [!NOTE]\n> You won't have a `routeTree.gen.ts` file yet. This file will be generated when you run TanStack Start for the first time.\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n```\n\n## The Root of Your Application\n\nFinally, 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.\n\n```tsx\n// src/routes/__root.tsx\n/// <reference types=\"vite/client\" />\nimport type { ReactNode } from 'react'\nimport {\n  Outlet,\n  createRootRoute,\n  HeadContent,\n  Scripts,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: Readonly<{ children: ReactNode }>) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n## Writing Your First Route\n\nNow that we have the basic templating setup, we can write our first route. This is done by creating a new file in the `src/routes` directory.\n\n```tsx\n// src/routes/index.tsx\nimport * as fs from 'node:fs'\nimport { createFileRoute, useRouter } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst filePath = 'count.txt'\n\nasync function readCount() {\n  return parseInt(\n    await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'),\n  )\n}\n\nconst getCount = createServerFn({\n  method: 'GET',\n}).handler(() => {\n  return readCount()\n})\n\nconst updateCount = createServerFn({ method: 'POST' })\n  .inputValidator((d: number) => d)\n  .handler(async ({ data }) => {\n    const count = await readCount()\n    await fs.promises.writeFile(filePath, `${count + data}`)\n  })\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => await getCount(),\n})\n\nfunction Home() {\n  const router = useRouter()\n  const state = Route.useLoaderData()\n\n  return (\n    <button\n      type=\"button\"\n      onClick={() => {\n        updateCount({ data: 1 }).then(() => {\n          router.invalidate()\n        })\n      }}\n    >\n      Add 1 to {state}?\n    </button>\n  )\n}\n```\n\nThat's it! 🤯 You've now set up a TanStack Start project and written your first route. 🎉\n\nYou can now run `npm run dev` to start your server and navigate to `http://localhost:3000` to see your route in action.\n\nYou want to deploy your application? Check out the [hosting guide](./guide/hosting.md).\n"
  },
  {
    "path": "docs/start/framework/react/comparison.md",
    "content": "---\ntitle: Comparison | TanStack Start vs Next.js vs React Router\ntoc: false\n---\n\nChoosing a full-stack React framework? This comparison focuses on the **full-stack framework features** that distinguish TanStack Start from Next.js and React Router (v7 Framework Mode).\n\n> **🚨 IMPORTANT: Looking for routing features?**\n>\n> TanStack Start is built on **TanStack Router**, which provides industry-leading type-safe routing capabilities. For a comprehensive comparison of routing features (nested routes, search params, type safety, loaders, etc.), please see:\n>\n> ### [📖 TanStack Router Comparison vs React Router / Next.js →](/router/latest/docs/framework/react/comparison)\n>\n> That comparison covers all the routing features in detail. This page focuses specifically on **full-stack framework capabilities** like SSR, server functions, middleware, deployment, and more.\n\nWhile we aim to provide an accurate and fair comparison, please note that this table may not capture every nuance or recent update of each framework. We recommend reviewing the official documentation and trying out each solution to make the most informed decision for your specific use case.\n\nIf you find any discrepancies or have suggestions for improvement, please don't hesitate to contribute via the \"Edit this page on GitHub\" link at the bottom of this page or open an issue in the [TanStack Router GitHub repository](https://github.com/TanStack/router).\n\nFeature/Capability Key:\n\n- ✅ 1st-class, built-in, and ready to use with no added configuration or code\n- 🟡 Partial Support (rated 1-5 where noted)\n- 🟠 Supported via addon/community package\n- 🔶 Possible, but requires custom code/implementation/casting\n- 🛑 Not officially supported\n\n|                                                                   | TanStack Start                                   | Next.js [_(Website)_][nextjs]                 | React Router [_(Website)_][react-router]   |\n| ----------------------------------------------------------------- | ------------------------------------------------ | --------------------------------------------- | ------------------------------------------ |\n| Github Repo / Stars                                               | [![][stars-tanstack-router]][gh-tanstack-router] | [![][stars-nextjs]][gh-nextjs]                | [![][stars-react-router]][gh-react-router] |\n| Bundle Size                                                       | [![][bp-tanstack-router]][bpl-tanstack-router]   | ❓                                            | ❓                                         |\n| --                                                                | --                                               | --                                            | --                                         |\n| **Routing Features** [_(See Full Comparison)_][router-comparison] | ✅ Built on TanStack Router                      | ✅ File-based App Router                      | ✅ File-based Nested Routes                |\n| --                                                                | --                                               | --                                            | --                                         |\n| **Full-Stack Features**                                           | --                                               | --                                            | --                                         |\n| SSR                                                               | ✅                                               | ✅                                            | ✅                                         |\n| Streaming SSR                                                     | ✅                                               | ✅                                            | ✅                                         |\n| Selective SSR (per-route)                                         | ✅                                               | 🔶                                            | 🔶                                         |\n| SPA Mode                                                          | ✅                                               | 🔶 (via \"use client\")                         | ✅                                         |\n| Built-in Client-Side SWR Caching                                  | ✅ (via TanStack Router)                         | 🔶 (fetch cache only)                         | 🛑                                         |\n| Data Fetching Library Integration                                 | ✅ (Official TanStack Query, Apollo, etc.)       | 🔶 (manual integration)                       | 🔶 (manual integration)                    |\n| Static Prerendering (SSG)                                         | ✅                                               | ✅                                            | ✅                                         |\n| Incremental Static Regeneration (ISR)                             | ✅ (via Cache-Control headers)                   | ✅ (Proprietary)                              | ✅ (via Cache-Control headers)             |\n| React Server Components                                           | 🛑 (In active development)                       | ✅                                            | 🟡 (Experimental)                          |\n| Server Functions                                                  | ✅ (RPC-based)                                   | ✅ (Server Actions)                           | ✅ (Actions)                               |\n| Server Function Client Middleware                                 | ✅                                               | 🛑                                            | 🛑                                         |\n| Server Function Server Middleware                                 | ✅                                               | 🛑                                            | ✅                                         |\n| Request Middleware (All Routes)                                   | ✅                                               | ✅                                            | ✅                                         |\n| Server Function Input Validation                                  | ✅                                               | 🔶 (manual)                                   | 🔶 (manual)                                |\n| API Routes / Server Routes / Resource Routes                      | ✅                                               | ✅                                            | ✅                                         |\n| `<Form>` API                                                      | 🛑                                               | 🟠 (via React 19 useActionState)              | ✅                                         |\n| --                                                                | --                                               | --                                            | --                                         |\n| **Developer Experience**                                          | --                                               | --                                            | --                                         |\n| Devtools                                                          | ✅                                               | 🛑                                            | 🟠 (3rd party)                             |\n| CLI Tooling                                                       | ✅                                               | ✅                                            | ✅                                         |\n| Dev Server Startup Speed                                          | ✅ (Fast)                                        | 🛑 (Slow)                                     | ✅ (Fast)                                  |\n| HMR Speed                                                         | ✅ (Fast, Vite)                                  | 🛑 (Slow, Webpack/Turbopack)                  | ✅ (Fast, Vite)                            |\n| Dev Navigation Speed                                              | ✅                                               | 🟡                                            | ✅                                         |\n| Dev Resource Usage (CPU/RAM)                                      | ✅ (Lightweight)                                 | 🛑 (Heavy)                                    | ✅ (Lightweight)                           |\n| TypeScript Support                                                | ✅                                               | ✅                                            | ✅                                         |\n| Type-First Architecture                                           | ✅                                               | 🛑                                            | 🛑                                         |\n| --                                                                | --                                               | --                                            | --                                         |\n| **Deployment & Hosting**                                          | --                                               | --                                            | --                                         |\n| Deployment Flexibility                                            | ✅ (Any Vite-compatible host)                    | 🟡 (Optimized for Vercel, possible elsewhere) | ✅ (Multiple adapters)                     |\n| Edge Runtime Support                                              | ✅                                               | ✅                                            | ✅                                         |\n| Serverless Support                                                | ✅                                               | ✅                                            | ✅                                         |\n| Node.js Support                                                   | ✅                                               | ✅                                            | ✅                                         |\n| Docker Support                                                    | ✅                                               | ✅                                            | ✅                                         |\n| Static Export                                                     | ✅                                               | ✅                                            | ✅                                         |\n| Official Cloudflare Support                                       | ✅                                               | 🟡                                            | ✅                                         |\n| Official Netlify Support                                          | ✅                                               | 🟡                                            | ✅                                         |\n| Official Vercel Support                                           | ✅ (via Nitro)                                   | ✅                                            | ✅                                         |\n\n---\n\n> **⚠️ Remember:** For detailed comparisons of **routing features** (type safety, search params, loaders, navigation, etc.), see the [**TanStack Router Comparison**][router-comparison]. This page focuses on full-stack framework capabilities.\n\n---\n\n## Key Philosophical Differences\n\n### TanStack Start\n\n**Philosophy**: Maximum developer freedom with best-in-class type safety.\n\n- **Router-First**: Built on TanStack Router (see [full routing comparison][router-comparison])\n- **Deployment Agnostic**: Built on Vite, deploy anywhere without vendor lock-in\n- **Composable Middleware**: Middleware system works at both the request level AND individual server function level (both client & server)\n- **Selective SSR**: Fine-grained control over SSR behavior per route (full SSR, data-only, or client-only)\n- **Developer Control**: Explicit, composable patterns over convention-based magic\n- **Type Safety First**: End-to-end compile-time safety for server functions, loaders, and routing\n\n### Next.js\n\n**Philosophy**: Production-ready with optimal defaults, best with Vercel.\n\n- **RSC-First**: Deep integration with React Server Components as the primary paradigm\n- **Vercel-Optimized**: Best performance and DX on Vercel's infrastructure\n- **Convention over Configuration**: Opinionated structure with file-system routing conventions\n- **Automatic Optimizations**: Many performance optimizations happen automatically\n- **Production Grade**: Battle-tested at massive scale\n\n### React Router (v7 Framework Mode)\n\n**Philosophy**: Web fundamentals with progressive enhancement.\n\n- **Web Standards**: Embraces web platform primitives (fetch, FormData, Headers)\n- **Progressive Enhancement**: Works without JavaScript by default\n- **Nested Routes**: First-class support for nested routing and data loading\n- **Action-Based**: Form submissions via actions follow web standards\n- **Framework Evolution**: Successor to Remix, with Vite-based architecture\n\n## When to Choose Each Framework\n\n### Choose TanStack Start if you:\n\n- Want the absolute best type safety for routing (see [Router Comparison][router-comparison])\n- Need deployment flexibility without vendor lock-in (works with any Vite-compatible host)\n- Prefer composable, explicit patterns over convention\n- Want fine-grained control over SSR behavior (selective SSR per route)\n- Need composable middleware that works at both request and server function levels\n- Are building a complex application that benefits from TanStack Router's advanced features\n- Already use TanStack Query or other TanStack libraries\n\n### Choose Next.js if you:\n\n- Want to use React Server Components today with full ecosystem support\n- Are deploying to Vercel or want a Vercel-optimized experience\n- Prefer convention over configuration for faster initial development\n- Want automatic image optimization and font loading\n\n### Choose React Router if you:\n\n- Prioritize progressive enhancement\n- Want your app to work without JavaScript\n- Prefer action-based mutations following web conventions\n\n## Feature Deep Dives\n\n### Built-in Client-Side Caching\n\n**TanStack Start** includes powerful built-in SWR (stale-while-revalidate) caching through TanStack Router:\n\n- **Out-of-the-box performance** - Loader data is automatically cached and revalidated\n- **Fine-grained control** - Configure `staleTime`, `gcTime`, and revalidation per route\n- **Structural sharing** - Efficient updates that only re-render what changed\n- **Official integrations** - Turn-key support for TanStack Query, Apollo, and other data fetching libraries\n- **More performant** - Optimized for the user experience with instant navigation and background updates\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => fetchPost(params.postId),\n  staleTime: 10_000, // Consider fresh for 10 seconds\n  gcTime: 5 * 60_000, // Keep in memory for 5 minutes\n})\n```\n\nFor advanced scenarios, TanStack Start integrates seamlessly with TanStack Query:\n\n```tsx\nimport { queryOptions } from '@tanstack/react-query'\n\nconst postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['post', postId],\n    queryFn: () => fetchPost(postId),\n  })\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ context, params }) =>\n    context.queryClient.ensureQueryData(postQueryOptions(params.postId)),\n})\n\nfunction Post() {\n  const { postId } = Route.useParams()\n  const { data } = useQuery(postQueryOptions(postId))\n  // Automatically uses cached data from loader\n}\n```\n\n**Next.js** has basic fetch caching but lacks fine-grained control and requires manual integration with libraries like React Query.\n\n**React Router** doesn't have built-in client-side caching - you need to manually integrate a caching solution.\n\n### Server Functions vs Server Actions\n\n**TanStack Start Server Functions**:\n\n```tsx\nexport const getTodos = createServerFn({ method: 'GET' })\n  .inputValidator(zodValidator(z.object({ userId: z.string() })))\n  .middleware([authMiddleware])\n  .handler(async ({ data, context }) => {\n    // Fully typed data and context\n    return db.todos.findMany({ where: { userId: data.userId } })\n  })\n\n// Call from anywhere with full type safety\nconst todos = await getTodos({ data: { userId: '123' } })\n```\n\n**Next.js Server Actions**:\n\n```tsx\n'use server'\nexport async function getTodos(userId: string) {\n  // Runs on server, called from client\n  return db.todos.findMany({ where: { userId } })\n}\n\n// Call from client component\nconst todos = await getTodos('123')\n```\n\nKey differences:\n\n- Start's server functions support both client and server middleware\n- Start has built-in input validation\n- Start's approach is more explicit about the client/server boundary\n- Next.js Server Actions integrate more seamlessly with forms\n\n### Middleware Architecture\n\n**TanStack Start** has two types of middleware:\n\n1. **Request Middleware**: Runs for all requests (SSR, API routes, server functions)\n2. **Server Function Middleware**: Runs specifically for server functions, supports both client-side and server-side execution\n\nThis composability allows for:\n\n```tsx\nconst authMiddleware = createMiddleware({ type: 'function' })\n  .client(async ({ next }) => {\n    // Run auth checks on client\n    return next({\n      headers: { Authorization: `Bearer ${getToken()}` },\n    })\n  })\n  .server(async ({ next }) => {\n    // Validate auth on server\n    return next({ context: { user: await getUser() } })\n  })\n```\n\n**Next.js** has a single middleware.ts file that runs on the Edge Runtime for all requests. It cannot access server-only resources like databases and has limitations compared to the Node.js runtime.\n\n### Deployment Flexibility\n\n**TanStack Start** leverages Vite's ecosystem:\n\n- Deploy to Cloudflare Workers, Netlify, Vercel, Railway, Fly.io, AWS, etc.\n- Use Nitro for universal deployment support\n- No vendor-specific features or lock-in\n- Same codebase works everywhere\n\n**Next.js** is optimized for Vercel:\n\n- Many features work best or only on Vercel (ISR, Image Optimization, Middleware)\n- Self-hosting requires more configuration\n- Deployment to other platforms may have limitations\n\n## React Server Components (RSC)\n\n**Current Status**:\n\n- **Next.js**: Full production support with extensive ecosystem\n- **TanStack Start**: In active development, expected soon\n- **React Router**: Experimental support available\n\nRSC is still evolving, and TanStack Start is taking time to ensure the best possible implementation that aligns with its type-safety-first philosophy.\n\n## Performance Considerations\n\n### Production Performance\n\nAll three frameworks are capable of achieving excellent production performance and top Lighthouse scores. The differences come down to optimization strategies:\n\n- **TanStack Start**: Vite's optimized builds, SWR caching reduces server load, lightweight runtime\n- **Next.js**: Automatic code splitting, image optimization, and built-in performance features\n- **React Router**: Web standards-based caching and optimization\n\n### Development Performance\n\nThis is where the frameworks differ significantly:\n\n**TanStack Start & React Router:**\n\n- ⚡ **Instant dev server startup** - Vite starts in milliseconds\n- ⚡ **Lightning-fast HMR** - Changes reflect instantly without page refresh\n- ⚡ **Fast dev navigation** - Full-speed routing during development\n- ⚡ **Lightweight resource usage** - Minimal CPU and RAM consumption\n- ⚡ **High dev throughput** - Handle many concurrent requests efficiently\n\n**Next.js:**\n\n- 🐌 **Slow dev server startup** - Can take many seconds to start, especially on larger projects\n- 🐌 **Slow HMR** - Hot reloading is noticeably sluggish even with Turbopack\n- 🐌 **Throttled dev navigation** - Navigation is artificially slowed during development\n- 🐌 **Heavy resource usage** - Significant CPU and RAM consumption during development\n\n**Why This Matters:**\n\nDevelopment performance directly impacts developer productivity. Faster feedback loops mean:\n\n- More iterations per hour\n- Better flow state and focus\n- Lower machine requirements\n- Reduced frustration during development\n- Faster CI/CD pipelines for development builds\n\nWhile Next.js's production performance is excellent, the development experience can be notably slower, especially on larger codebases or less powerful machines.\n\n## Community and Ecosystem\n\n- **Next.js**: Largest community, most third-party integrations, extensive learning resources\n- **React Router**: One of the oldest and most widely used React libraries, strong community, excellent documentation\n- **TanStack Start**: Growing community, part of TanStack ecosystem, excellent Discord support\n\n## Maturity\n\n- **Next.js**: Production-ready, used by thousands of companies, proven at scale\n- **React Router**: Production-ready, powers millions of apps, v7 Framework Mode is the evolution of Remix\n- **TanStack Start**: Release Candidate stage, feature-complete, rapidly stabilizing toward v1\n\n[bp-tanstack-router]: https://badgen.net/bundlephobia/minzip/@tanstack/react-router\n[bpl-tanstack-router]: https://bundlephobia.com/result?p=@tanstack/react-router\n[gh-tanstack-router]: https://github.com/tanstack/router\n[stars-tanstack-router]: https://img.shields.io/github/stars/tanstack/router?label=%F0%9F%8C%9F\n[router-comparison]: /router/latest/docs/framework/react/comparison\n[_]: _\n[nextjs]: https://nextjs.org/\n[gh-nextjs]: https://github.com/vercel/next.js\n[stars-nextjs]: https://img.shields.io/github/stars/vercel/next.js?label=%F0%9F%8C%9F\n[_]: _\n[react-router]: https://reactrouter.com/\n[gh-react-router]: https://github.com/remix-run/react-router\n[stars-react-router]: https://img.shields.io/github/stars/remix-run/react-router?label=%F0%9F%8C%9F\n"
  },
  {
    "path": "docs/start/framework/react/getting-started.md",
    "content": "---\nid: getting-started\ntitle: Getting Started\n---\n\n## Migrate an existing project from another framework\n\n- [Start a new project from scratch](#start-a-new-project-from-scratch) to quickly learn how Start works (see below)\n- Refer to a migration guide for your specific framework:\n  - [Next.js](./migrate-from-next-js)\n  - Remix 2 / React Router 7 \"Framework Mode\" (coming soon!)\n\n## Start a new project from scratch\n\nChoose one of the following options to start building a _new_ TanStack Start project:\n\n- [TanStack Start CLI](https://tanstack.com/cli/latest) - Just run `npx @tanstack/cli@latest create`. Local, fast, and optionally customizable\n- [TanStack Builder](https://tanstack.com/builder) - A visual interface to configure new TanStack projects with a few clicks\n- [Quick Start Examples](./quick-start) Download or clone one of our official examples\n- [Build a project from scratch](./build-from-scratch) - A guide to building a TanStack Start project line-by-line, file-by-file.\n\n## Next Steps\n\nUnless you chose to build a project from scratch, you can now move on to the [Routing](./guide/routing) guide to learn how to use TanStack Start!\n"
  },
  {
    "path": "docs/start/framework/react/guide/authentication-overview.md",
    "content": "---\nid: authentication-overview\ntitle: Authentication\n---\n\n## Authentication vs Authorization\n\n- **Authentication**: Who is this user? (Login/logout, identity verification)\n- **Authorization**: What can this user do? (Permissions, roles, access control)\n\n## Architecture Overview\n\n### Full-Stack Authentication Model\n\n**Server-Side (Secure)**\n\n- Session storage and validation\n- User credential verification\n- Database operations\n- Token generation/verification\n- Protected API endpoints\n\n**Client-Side (Public)**\n\n- Authentication state management\n- Route protection logic\n- Login/logout user interface\n- Redirect handling\n\n**Isomorphic (Both)**\n\n- Route loaders checking auth state\n- Shared validation logic\n- User profile data access\n\n### Session Management Patterns\n\n**HTTP-Only Cookies (Recommended)**\n\n- Most secure approach - not accessible via JavaScript\n- Automatic browser handling\n- Built-in CSRF protection with `sameSite`\n- Best for traditional web applications\n\n**JWT Tokens**\n\n- Stateless authentication\n- Good for API-first applications\n- Requires careful handling to avoid XSS vulnerabilities\n- Consider refresh token rotation\n\n**Server-Side Sessions**\n\n- Centralized session control\n- Easy to revoke sessions\n- Requires session storage (database, Redis)\n- Good for applications requiring immediate session control\n\n### Route Protection Architecture\n\n**Layout Route Pattern (Recommended)**\n\n- Protect entire route subtrees with parent layout routes\n- Centralized authentication logic\n- Automatic protection for all child routes\n- Clean separation of authenticated vs public routes\n\n**Component-Level Protection**\n\n- Conditional rendering within components\n- More granular control over UI states\n- Good for mixed public/private content on same route\n- Requires careful handling to prevent layout shifts\n\n**Server Function Guards**\n\n- Server-side validation before executing sensitive operations\n- Works alongside route-level protection\n- Essential for API security regardless of client-side protection\n\n### State Management Patterns\n\n**Server-Driven State (Recommended)**\n\n- Authentication state sourced from server on each request\n- Always up-to-date with server state\n- Works seamlessly with SSR\n- Best security - server is source of truth\n\n**Context-Based State**\n\n- Client-side authentication state management\n- Good for third-party auth providers (Auth0, Firebase)\n- Requires careful synchronization with server state\n- Consider for highly interactive client-first applications\n\n**Hybrid Approach**\n\n- Initial state from server, client-side updates\n- Balance between security and UX\n- Periodic server-side validation\n\n## Authentication Options\n\n### 🏢 Partner Solutions\n\n- **[WorkOS](https://workos.com)**\n- **[Clerk](https://clerk.dev)**\n\n### 🛠️ DIY Authentication\n\nBuild your own authentication system using TanStack Start's server functions and session management:\n\n- **Full Control**: Complete customization over authentication flow\n- **Server Functions**: Secure authentication logic on the server\n- **Session Management**: Built-in session handling with HTTP-only cookies\n- **Type Safety**: End-to-end type safety for authentication state\n\n### 🌐 Other Excellent Options\n\n**Open Source & Community Solutions:**\n\n- **[Better Auth](https://www.better-auth.com/)** - Modern, TypeScript-first authentication library\n- **[Auth.js](https://authjs.dev/)** (formerly NextAuth.js) - Popular authentication library for React\n\n**Hosted Services:**\n\n- **[Supabase Auth](https://supabase.com/auth)** - Open source Firebase alternative with built-in auth\n- **[Auth0](https://auth0.com/)** - Established authentication platform with extensive features\n- **[Firebase Auth](https://firebase.google.com/docs/auth)** - Google's authentication service\n\n## Partner Solutions\n\n### WorkOS - Enterprise Authentication\n\n<a href=\"https://workos.com/\" alt=\"WorkOS Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/workos-white.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/workos-black.svg\" width=\"280\">\n    <img alt=\"WorkOS logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/workos-black.svg\" width=\"280\">\n  </picture>\n</a>\n\n- **Single Sign-On (SSO)** - SAML, OIDC, and OAuth integrations\n- **Directory Sync** - SCIM provisioning with Active Directory and Google Workspace\n- **Multi-factor Authentication** - Enterprise-grade security options\n- **Compliance Ready** - SOC 2, GDPR, and CCPA compliant\n\n[Visit WorkOS →](https://workos.com/) | [View example →](https://github.com/TanStack/router/tree/main/examples/react/start-workos)\n\n### Clerk - Complete Authentication Platform\n\n<a href=\"https://go.clerk.com/wOwHtuJ\" alt=\"Clerk Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/clerk-logo-dark.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/clerk-logo-light.svg\" width=\"280\">\n    <img alt=\"Clerk logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/clerk-logo-light.svg\" width=\"280\">\n  </picture>\n</a>\n\n- **Ready-to-use UI Components** - Sign-in, sign-up, user profile, and organization management\n- **Social Logins** - Google, GitHub, Discord, and 20+ providers\n- **Multi-factor Authentication** - SMS, TOTP, and backup codes\n- **Organizations & Teams** - Built-in support for team-based applications\n\n[Visit Clerk →](https://go.clerk.com/wOwHtuJ) | [Sign up free →](https://go.clerk.com/PrSDXti) | [View example →](https://github.com/TanStack/router/tree/main/examples/react/start-clerk-basic)\n\n## Examples\n\n**Partner Solutions:**\n\n- [Clerk Integration](https://github.com/TanStack/router/tree/main/examples/react/start-clerk-basic)\n- [WorkOS Integration](https://github.com/TanStack/router/tree/main/examples/react/start-workos)\n\n**DIY Implementations:**\n\n- [Basic Auth with Prisma](https://github.com/TanStack/router/tree/main/examples/react/start-basic-auth)\n- [Supabase Auth](https://github.com/TanStack/router/tree/main/examples/react/start-supabase-basic)\n\n**Client-Side Examples:**\n\n- [Basic Authentication](https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes)\n- [Firebase Auth](https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes-firebase)\n\n## Architecture Decision Guide\n\n### Choosing an Authentication Approach\n\n**Partner Solutions:**\n\n- Focus on your core business logic\n- Enterprise features (SSO, compliance)\n- Managed security and updates\n- Pre-built UI components\n\n**OSS Solutions:**\n\n- Community-driven development\n- Specific customizations\n- Self-hosted solutions\n- Avoid vendor lock-in\n\n**DIY Implementation:**\n\n- Complete control over the auth flow\n- Custom security requirements\n- Specific business logic needs\n- Full ownership of authentication data\n\n### Security Considerations\n\n- Use HTTPS in production\n- Use HTTP-only cookies when possible\n- Validate all inputs on the server\n- Keep secrets in server-only functions\n- Implement rate limiting for auth endpoints\n- Use CSRF protection for form submissions\n\n## Next Steps\n\n- **Partner solutions** → [Clerk](https://go.clerk.com/wOwHtuJ) or [WorkOS](https://workos.com/)\n- **DIY implementation** → [Authentication Guide](./authentication.md)\n- **Examples** → [Working implementations](https://github.com/TanStack/router/tree/main/examples/react)\n\n## Resources\n\n**Implementation Guides:**\n\n- [Authentication Patterns](./authentication.md)\n- [Router Authentication Guide](/router/latest/docs/framework/react/guide/authenticated-routes.md)\n\n**Foundation Concepts:**\n\n- [Execution Model](./execution-model.md)\n- [Server Functions](./server-functions.md)\n\n**Step-by-Step Tutorials:**\n\n- [Router How-to Guides](/router/latest/docs/framework/react/how-to/README.md#authentication)\n"
  },
  {
    "path": "docs/start/framework/react/guide/authentication.md",
    "content": "---\nid: authentication\ntitle: Authentication\n---\n\nThis guide covers authentication patterns and shows how to implement your own authentication system with TanStack Start.\n\n> **📋 Before You Start:** Check our [Authentication Overview](./authentication-overview.md) for all available options including partner solutions and hosted services.\n\n## Authentication Approaches\n\nYou have several options for authentication in your TanStack Start application:\n\n**Hosted Solutions:**\n\n1. **[Clerk](https://clerk.dev)** - Complete authentication platform with UI components\n2. **[WorkOS](https://workos.com)** - Enterprise-focused with SSO and compliance features\n3. **[Better Auth](https://www.better-auth.com/)** - Open-source TypeScript library\n4. **[Auth.js](https://authjs.dev/)** - Open-source library supporting 80+ OAuth providers\n\n**DIY Implementation Benefits:**\n\n- **Full Control**: Complete customization over authentication flow\n- **No Vendor Lock-in**: Own your authentication logic and user data\n- **Custom Requirements**: Implement specific business logic or compliance needs\n- **Cost Control**: No per-user pricing or usage limits\n\nAuthentication involves many considerations including password security, session management, rate limiting, CSRF protection, and various attack vectors.\n\n## Core Concepts\n\n### Authentication vs Authorization\n\n- **Authentication**: Who is this user? (Login/logout)\n- **Authorization**: What can this user do? (Permissions/roles)\n\nTanStack Start provides the tools for both through server functions, sessions, and route protection.\n\n## Essential Building Blocks\n\n### 1. Server Functions for Authentication\n\nServer functions handle sensitive authentication logic securely on the server:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\nimport { redirect } from '@tanstack/react-router'\n\n// Login server function\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator((data: { email: string; password: string }) => data)\n  .handler(async ({ data }) => {\n    // Verify credentials (replace with your auth logic)\n    const user = await authenticateUser(data.email, data.password)\n\n    if (!user) {\n      return { error: 'Invalid credentials' }\n    }\n\n    // Create session\n    const session = await useAppSession()\n    await session.update({\n      userId: user.id,\n      email: user.email,\n    })\n\n    // Redirect to protected area\n    throw redirect({ to: '/dashboard' })\n  })\n\n// Logout server function\nexport const logoutFn = createServerFn({ method: 'POST' }).handler(async () => {\n  const session = await useAppSession()\n  await session.clear()\n  throw redirect({ to: '/' })\n})\n\n// Get current user\nexport const getCurrentUserFn = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    const session = await useAppSession()\n    const userId = session.data.userId\n\n    if (!userId) {\n      return null\n    }\n\n    return await getUserById(userId)\n  },\n)\n```\n\n### 2. Session Management\n\nTanStack Start provides secure HTTP-only cookie sessions:\n\n```tsx\n// utils/session.ts\nimport { useSession } from '@tanstack/react-start/server'\n\ntype SessionData = {\n  userId?: string\n  email?: string\n  role?: string\n}\n\nexport function useAppSession() {\n  return useSession<SessionData>({\n    // Session configuration\n    name: 'app-session',\n    password: process.env.SESSION_SECRET!, // At least 32 characters\n    // Optional: customize cookie settings\n    cookie: {\n      secure: process.env.NODE_ENV === 'production',\n      sameSite: 'lax',\n      httpOnly: true,\n    },\n  })\n}\n```\n\n### 3. Authentication Context\n\nShare authentication state across your application:\n\n```tsx\n// contexts/auth.tsx\nimport { createContext, useContext, ReactNode } from 'react'\nimport { useServerFn } from '@tanstack/react-start'\nimport { getCurrentUserFn } from '../server/auth'\n\ntype User = {\n  id: string\n  email: string\n  role: string\n}\n\ntype AuthContextType = {\n  user: User | null\n  isLoading: boolean\n  refetch: () => void\n}\n\nconst AuthContext = createContext<AuthContextType | undefined>(undefined)\n\nexport function AuthProvider({ children }: { children: ReactNode }) {\n  const { data: user, isLoading, refetch } = useServerFn(getCurrentUserFn)\n\n  return (\n    <AuthContext.Provider value={{ user, isLoading, refetch }}>\n      {children}\n    </AuthContext.Provider>\n  )\n}\n\nexport function useAuth() {\n  const context = useContext(AuthContext)\n  if (!context) {\n    throw new Error('useAuth must be used within AuthProvider')\n  }\n  return context\n}\n```\n\n### 4. Route Protection\n\nProtect routes using `beforeLoad`:\n\n```tsx\n// routes/_authed.tsx - Layout route for protected pages\nimport { createFileRoute, redirect } from '@tanstack/react-router'\nimport { getCurrentUserFn } from '../server/auth'\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: async ({ location }) => {\n    const user = await getCurrentUserFn()\n\n    if (!user) {\n      throw redirect({\n        to: '/login',\n        search: { redirect: location.href },\n      })\n    }\n\n    // Pass user to child routes\n    return { user }\n  },\n})\n```\n\n```tsx\n// routes/_authed/dashboard.tsx - Protected route\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authed/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  const { user } = Route.useRouteContext()\n\n  return (\n    <div>\n      <h1>Welcome, {user.email}!</h1>\n      {/* Dashboard content */}\n    </div>\n  )\n}\n```\n\n## Implementation Patterns\n\n### Basic Email/Password Authentication\n\n```tsx\n// server/auth.ts\nimport bcrypt from 'bcryptjs'\nimport { createServerFn } from '@tanstack/react-start'\n\n// User registration\nexport const registerFn = createServerFn({ method: 'POST' })\n  .inputValidator(\n    (data: { email: string; password: string; name: string }) => data,\n  )\n  .handler(async ({ data }) => {\n    // Check if user exists\n    const existingUser = await getUserByEmail(data.email)\n    if (existingUser) {\n      return { error: 'User already exists' }\n    }\n\n    // Hash password\n    const hashedPassword = await bcrypt.hash(data.password, 12)\n\n    // Create user\n    const user = await createUser({\n      email: data.email,\n      password: hashedPassword,\n      name: data.name,\n    })\n\n    // Create session\n    const session = await useAppSession()\n    await session.update({ userId: user.id })\n\n    return { success: true, user: { id: user.id, email: user.email } }\n  })\n\nasync function authenticateUser(email: string, password: string) {\n  const user = await getUserByEmail(email)\n  if (!user) return null\n\n  const isValid = await bcrypt.compare(password, user.password)\n  return isValid ? user : null\n}\n```\n\n### Role-Based Access Control (RBAC)\n\n```tsx\n// utils/auth.ts\nexport const roles = {\n  USER: 'user',\n  ADMIN: 'admin',\n  MODERATOR: 'moderator',\n} as const\n\ntype Role = (typeof roles)[keyof typeof roles]\n\nexport function hasPermission(userRole: Role, requiredRole: Role): boolean {\n  const hierarchy = {\n    [roles.USER]: 0,\n    [roles.MODERATOR]: 1,\n    [roles.ADMIN]: 2,\n  }\n\n  return hierarchy[userRole] >= hierarchy[requiredRole]\n}\n\n// Protected route with role check\nexport const Route = createFileRoute('/_authed/admin/')({\n  beforeLoad: async ({ context }) => {\n    if (!hasPermission(context.user.role, roles.ADMIN)) {\n      throw redirect({ to: '/unauthorized' })\n    }\n  },\n})\n```\n\n### Social Authentication Integration\n\n```tsx\n// Example with OAuth providers\nexport const authProviders = {\n  google: {\n    clientId: process.env.GOOGLE_CLIENT_ID!,\n    redirectUri: `${process.env.APP_URL}/auth/google/callback`,\n  },\n  github: {\n    clientId: process.env.GITHUB_CLIENT_ID!,\n    redirectUri: `${process.env.APP_URL}/auth/github/callback`,\n  },\n}\n\nexport const initiateOAuthFn = createServerFn({ method: 'POST' })\n  .inputValidator((data: { provider: 'google' | 'github' }) => data)\n  .handler(async ({ data }) => {\n    const provider = authProviders[data.provider]\n    const state = generateRandomState()\n\n    // Store state in session for CSRF protection\n    const session = await useAppSession()\n    await session.update({ oauthState: state })\n\n    // Generate OAuth URL\n    const authUrl = generateOAuthUrl(provider, state)\n\n    throw redirect({ href: authUrl })\n  })\n```\n\n### Password Reset Flow\n\n```tsx\n// Password reset request\nexport const requestPasswordResetFn = createServerFn({ method: 'POST' })\n  .inputValidator((data: { email: string }) => data)\n  .handler(async ({ data }) => {\n    const user = await getUserByEmail(data.email)\n    if (!user) {\n      // Don't reveal if email exists\n      return { success: true }\n    }\n\n    const token = generateSecureToken()\n    const expires = new Date(Date.now() + 60 * 60 * 1000) // 1 hour\n\n    await savePasswordResetToken(user.id, token, expires)\n    await sendPasswordResetEmail(user.email, token)\n\n    return { success: true }\n  })\n\n// Password reset confirmation\nexport const resetPasswordFn = createServerFn({ method: 'POST' })\n  .inputValidator((data: { token: string; newPassword: string }) => data)\n  .handler(async ({ data }) => {\n    const resetToken = await getPasswordResetToken(data.token)\n\n    if (!resetToken || resetToken.expires < new Date()) {\n      return { error: 'Invalid or expired token' }\n    }\n\n    const hashedPassword = await bcrypt.hash(data.newPassword, 12)\n    await updateUserPassword(resetToken.userId, hashedPassword)\n    await deletePasswordResetToken(data.token)\n\n    return { success: true }\n  })\n```\n\n## Security Best Practices\n\n### 1. Password Security\n\n```tsx\n// Use strong hashing (bcrypt, scrypt, or argon2)\nimport bcrypt from 'bcryptjs'\n\nconst saltRounds = 12 // Adjust based on your security needs\nconst hashedPassword = await bcrypt.hash(password, saltRounds)\n```\n\n### 2. Session Security\n\n```tsx\n// Use secure session configuration\nexport function useAppSession() {\n  return useSession({\n    name: 'app-session',\n    password: process.env.SESSION_SECRET!, // 32+ characters\n    cookie: {\n      secure: process.env.NODE_ENV === 'production', // HTTPS only in production\n      sameSite: 'lax', // CSRF protection\n      httpOnly: true, // XSS protection\n      maxAge: 7 * 24 * 60 * 60, // 7 days\n    },\n  })\n}\n```\n\n### 3. Rate Limiting\n\n```tsx\n// Simple in-memory rate limiting (use Redis in production)\nconst loginAttempts = new Map<string, { count: number; resetTime: number }>()\n\nexport const rateLimitLogin = (ip: string): boolean => {\n  const now = Date.now()\n  const attempts = loginAttempts.get(ip)\n\n  if (!attempts || now > attempts.resetTime) {\n    loginAttempts.set(ip, { count: 1, resetTime: now + 15 * 60 * 1000 }) // 15 min\n    return true\n  }\n\n  if (attempts.count >= 5) {\n    return false // Too many attempts\n  }\n\n  attempts.count++\n  return true\n}\n```\n\n### 4. Input Validation\n\n```tsx\nimport { z } from 'zod'\n\nconst loginSchema = z.object({\n  email: z.string().email().max(255),\n  password: z.string().min(8).max(100),\n})\n\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator((data) => loginSchema.parse(data))\n  .handler(async ({ data }) => {\n    // data is now validated\n  })\n```\n\n## Testing Authentication\n\n### Unit Testing Server Functions\n\n```tsx\n// __tests__/auth.test.ts\nimport { describe, it, expect, beforeEach } from 'vitest'\nimport { loginFn } from '../server/auth'\n\ndescribe('Authentication', () => {\n  beforeEach(async () => {\n    await setupTestDatabase()\n  })\n\n  it('should login with valid credentials', async () => {\n    const result = await loginFn({\n      data: { email: 'test@example.com', password: 'password123' },\n    })\n\n    expect(result.error).toBeUndefined()\n    expect(result.user).toBeDefined()\n  })\n\n  it('should reject invalid credentials', async () => {\n    const result = await loginFn({\n      data: { email: 'test@example.com', password: 'wrongpassword' },\n    })\n\n    expect(result.error).toBe('Invalid credentials')\n  })\n})\n```\n\n### Integration Testing\n\n```tsx\n// __tests__/auth-flow.test.tsx\nimport { render, screen, fireEvent, waitFor } from '@testing-library/react'\nimport { RouterProvider, createMemoryHistory } from '@tanstack/react-router'\nimport { router } from '../router'\n\ndescribe('Authentication Flow', () => {\n  it('should redirect to login when accessing protected route', async () => {\n    const history = createMemoryHistory()\n    history.push('/dashboard') // Protected route\n\n    render(<RouterProvider router={router} history={history} />)\n\n    await waitFor(() => {\n      expect(screen.getByText('Login')).toBeInTheDocument()\n    })\n  })\n})\n```\n\n## Common Patterns\n\n### Loading States\n\n```tsx\nfunction LoginForm() {\n  const [isLoading, setIsLoading] = useState(false)\n  const loginMutation = useServerFn(loginFn)\n\n  const handleSubmit = async (data: LoginData) => {\n    setIsLoading(true)\n    try {\n      await loginMutation.mutate(data)\n    } catch (error) {\n      // Handle error\n    } finally {\n      setIsLoading(false)\n    }\n  }\n\n  return (\n    <form onSubmit={handleSubmit}>\n      {/* Form fields */}\n      <button disabled={isLoading}>\n        {isLoading ? 'Logging in...' : 'Login'}\n      </button>\n    </form>\n  )\n}\n```\n\n### Remember Me Functionality\n\n```tsx\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator(\n    (data: { email: string; password: string; rememberMe?: boolean }) => data,\n  )\n  .handler(async ({ data }) => {\n    const user = await authenticateUser(data.email, data.password)\n    if (!user) return { error: 'Invalid credentials' }\n\n    const session = await useAppSession()\n    await session.update(\n      { userId: user.id },\n      {\n        // Extend session if remember me is checked\n        maxAge: data.rememberMe ? 30 * 24 * 60 * 60 : undefined, // 30 days vs session\n      },\n    )\n\n    return { success: true }\n  })\n```\n\n## Working Examples\n\nStudy these implementations to understand different authentication patterns:\n\n- **[Basic Auth with Prisma](https://github.com/TanStack/router/tree/main/examples/react/start-basic-auth)** - Complete DIY implementation with database and sessions\n- **[Supabase Integration](https://github.com/TanStack/router/tree/main/examples/react/start-supabase-basic)** - Third-party service integration example\n- **[Client-side Context Auth](https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes)** - Client-only authentication patterns\n\n## Migration from Other Solutions\n\n### From Client-Side Auth\n\nIf you're migrating from client-side authentication (localStorage, context only):\n\n1. Move authentication logic to server functions\n2. Replace localStorage with server sessions\n3. Update route protection to use `beforeLoad`\n4. Add proper security headers and CSRF protection\n\n### From Other Frameworks\n\n- **Next.js**: Replace API routes with server functions, migrate NextAuth sessions\n- **Remix**: Convert loaders/actions to server functions, adapt session patterns\n- **SvelteKit**: Move form actions to server functions, update route protection\n\n## Production Considerations\n\nWhen choosing your authentication approach, consider these factors:\n\n### Hosted vs DIY Comparison\n\n**Hosted Solutions (Clerk, WorkOS, Better Auth):**\n\n- Pre-built security measures and regular updates\n- UI components and user management features\n- Compliance certifications and audit trails\n- Support and documentation\n- Per-user or subscription pricing\n\n**DIY Implementation:**\n\n- Complete control over implementation and data\n- No ongoing subscription costs\n- Custom business logic and workflows\n- Responsibility for security updates and monitoring\n- Need to handle edge cases and attack vectors\n\n### Security Considerations\n\nAuthentication systems need to handle various security aspects:\n\n- Password hashing and timing attack prevention\n- Session management and fixation protection\n- CSRF and XSS protection\n- Rate limiting and brute force prevention\n- OAuth flow security\n- Compliance requirements (GDPR, CCPA, etc.)\n\n## Next Steps\n\nWhen implementing authentication, consider:\n\n- **Security Review**: Review your implementation for security best practices\n- **Performance**: Add caching for user lookups and session validation\n- **Monitoring**: Add logging and monitoring for authentication events\n- **Compliance**: Ensure compliance with relevant regulations if storing personal data\n\nFor other authentication approaches, check the [Authentication Overview](./authentication-overview.md). For specific integration help, explore our [working examples](https://github.com/TanStack/router/tree/main/examples/react).\n"
  },
  {
    "path": "docs/start/framework/react/guide/cdn-asset-urls.md",
    "content": "---\nid: cdn-asset-urls\ntitle: CDN Asset URLs\n---\n\n# CDN Asset URLs\n\n> **Experimental:** `transformAssetUrls` is experimental and subject to change.\n\nWhen deploying to production, you may want to serve your static assets (JavaScript, CSS) from a CDN. The `transformAssetUrls` option on `createStartHandler` lets you rewrite asset URLs at runtime — for example, prepending a CDN origin that is only known when the server starts.\n\n## Why Runtime URL Rewriting?\n\nVite's `base` config is evaluated at build time. If your CDN URL is determined at deploy time (via environment variables, dynamic configuration, etc.), you need a way to rewrite URLs at runtime. `transformAssetUrls` solves this for the URLs that TanStack Start manages in its manifest:\n\n- `<link rel=\"modulepreload\">` tags (JS preloads)\n- `<link rel=\"stylesheet\">` tags (CSS)\n- The client entry `<script>` tag\n\n## Basic Usage\n\n### String Prefix\n\nThe simplest usage is passing a string. Every manifest asset URL will be prefixed with it:\n\n```tsx\n// src/server.ts\nimport {\n  createStartHandler,\n  defaultStreamHandler,\n} from '@tanstack/react-start/server'\nimport { createServerEntry } from '@tanstack/react-start/server-entry'\n\nconst handler = createStartHandler({\n  handler: defaultStreamHandler,\n  transformAssetUrls: process.env.CDN_ORIGIN || '',\n})\n\nexport default createServerEntry({ fetch: handler })\n```\n\nIf `CDN_ORIGIN` is `https://cdn.example.com` and an asset URL is `/assets/index-abc123.js`, the resulting URL will be `https://cdn.example.com/assets/index-abc123.js`.\n\nWhen the string is empty (or not set), the URLs are left unchanged.\n\n### Callback\n\nFor more control, pass a callback that receives `{ url, type }` and returns a new URL (or a `Promise` of one). By default, the transformed manifest is cached after the first request (`cache: true`), so the callback only runs once in production:\n\n```tsx\n// src/server.ts\nimport {\n  createStartHandler,\n  defaultStreamHandler,\n} from '@tanstack/react-start/server'\nimport { createServerEntry } from '@tanstack/react-start/server-entry'\n\nconst handler = createStartHandler({\n  handler: defaultStreamHandler,\n  transformAssetUrls: ({ url, type }) => {\n    // Only rewrite JS and CSS, leave client entry unchanged\n    if (type === 'clientEntry') return url\n    return `https://cdn.example.com${url}`\n  },\n})\n\nexport default createServerEntry({ fetch: handler })\n```\n\nIf you need per-request behavior (for example, choosing a CDN based on a header), use the object form with `cache: false`.\n\nThe `type` parameter tells you what kind of asset URL is being transformed:\n\n| `type`            | Description                                          |\n| ----------------- | ---------------------------------------------------- |\n| `'modulepreload'` | JS module preload URL (`<link rel=\"modulepreload\">`) |\n| `'stylesheet'`    | CSS stylesheet URL (`<link rel=\"stylesheet\">`)       |\n| `'clientEntry'`   | Client entry module URL (used in `import('...')`)    |\n\n### Object Form (Explicit Cache Control)\n\nFor per-request transforms — where the CDN URL depends on request-specific data like headers — use the object form with `cache: false`:\n\n```tsx\n// src/server.ts\nimport {\n  createStartHandler,\n  defaultStreamHandler,\n} from '@tanstack/react-start/server'\nimport { createServerEntry } from '@tanstack/react-start/server-entry'\nimport { getRequest } from '@tanstack/react-start/server'\n\nconst handler = createStartHandler({\n  handler: defaultStreamHandler,\n  transformAssetUrls: {\n    transform: ({ url, type }) => {\n      const region = getRequest().headers.get('x-region') || 'us'\n      const cdnBase =\n        region === 'eu'\n          ? 'https://cdn-eu.example.com'\n          : 'https://cdn-us.example.com'\n      return `${cdnBase}${url}`\n    },\n    cache: false,\n  },\n})\n\nexport default createServerEntry({ fetch: handler })\n```\n\nThe object form accepts:\n\n| Property          | Type                                                                                                     | Description                                                                                                                   |\n| ----------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |\n| `transform`       | `string \\| (asset) => string \\| Promise<string>`                                                         | A string prefix or callback, same as the shorthand forms above.                                                               |\n| `createTransform` | `(ctx: { warmup: true } \\| { warmup: false; request: Request }) => (asset) => string \\| Promise<string>` | Async factory that runs once per manifest computation and returns a per-asset transform. Mutually exclusive with `transform`. |\n| `cache`           | `boolean`                                                                                                | Whether to cache the transformed manifest. Defaults to `true`.                                                                |\n| `warmup`          | `boolean`                                                                                                | When `true`, warms up the cached manifest on server startup (prod only). Defaults to `false`.                                 |\n\nIf you need to do async work once per manifest computation (e.g. fetch a CDN origin from a service) and then transform many URLs, prefer `createTransform`:\n\n```ts\ntransformAssetUrls: {\n  cache: false,\n  async createTransform(ctx) {\n    if (ctx.warmup) {\n      // optional: return a default transform during warmup\n      return ({ url }) => url\n    }\n\n    const region = ctx.request.headers.get('x-region') || 'us'\n    const cdnBase = await fetchCdnBaseForRegion(region)\n    return ({ url }) => `${cdnBase}${url}`\n  },\n}\n```\n\n## Caching Behavior\n\nBy default, **all forms** of `transformAssetUrls` cache the transformed manifest after the first request (`cache: true`). This means the transform function runs once on the first request, and the result is reused for every subsequent request in production.\n\n| Form                                   | Default cache | Behavior                                                   |\n| -------------------------------------- | ------------- | ---------------------------------------------------------- |\n| String prefix                          | `true`        | Computed once, cached forever in prod.                     |\n| Callback                               | `true`        | Runs once on first request, cached forever in prod.        |\n| Object with `cache: true` (or omitted) | `true`        | Same as above.                                             |\n| Object with `cache: false`             | `false`       | Deep-clones base manifest and transforms on every request. |\n\nUse `cache: false` only when the transform depends on per-request data (e.g., geo-routing based on request headers). For static CDN prefixes, the default `cache: true` is recommended.\n\n### Optional Warmup (Avoid First-Request Latency)\n\nIf you're using the object form with `cache: true`, you can set `warmup: true`\nto compute the transformed manifest in the background at server startup.\n\n```ts\ntransformAssetUrls: {\n  transform: process.env.CDN_ORIGIN || '',\n  cache: true,\n  warmup: true,\n}\n```\n\nThis has no effect in development mode, or when `cache: false`.\n\n> **Note:** In development mode (`TSS_DEV_SERVER`), caching is always skipped regardless of the `cache` setting, so you always get fresh manifests.\n\n## Recommended: Set `base: ''` for Client-Side Navigation\n\n`transformAssetUrls` rewrites the URLs in the SSR HTML — modulepreload hints, stylesheets, and the client entry script. This means the browser's initial page load fetches all assets from the CDN.\n\nHowever, when users navigate client-side (e.g., clicking a `<Link>`), TanStack Router lazy-loads route chunks using `import()` calls with paths that were baked in at **build time** by Vite. By default, Vite uses `base: '/'`, which produces absolute paths like `/assets/about-abc123.js`. These resolve against the **app server's origin**, not the CDN — even though the entry module was loaded from the CDN.\n\nTo fix this, set `base: ''` in your Vite config:\n\n```ts\n// vite.config.ts\nexport default defineConfig({\n  base: '',\n  // ... plugins, etc.\n})\n```\n\nWith `base: ''`, Vite generates **relative** import paths for client-side chunks. Since the client entry module was loaded from the CDN (thanks to `transformAssetUrls`), all relative `import()` calls resolve against the CDN origin. This ensures that lazy-loaded route chunks during client-side navigation are also served from the CDN.\n\nUsing an empty string rather than `'./'` is important — both produce relative client-side imports, but `base: ''` preserves the correct root-relative paths (`/assets/...`) in the SSR manifest so that `transformAssetUrls` can properly prepend the CDN origin.\n\n| `base` setting  | SSR assets (initial load)      | Client-side navigation chunks  |\n| --------------- | ------------------------------ | ------------------------------ |\n| `'/'` (default) | CDN (via `transformAssetUrls`) | App server                     |\n| `''`            | CDN (via `transformAssetUrls`) | CDN (relative to entry module) |\n\n> **Tip:** `base: ''` is recommended whenever you use `transformAssetUrls` so that all assets — both on initial load and during client-side navigation — are consistently served from the CDN.\n\n## What This Does NOT Cover\n\n`transformAssetUrls` only rewrites URLs in the TanStack Start manifest — the tags emitted during SSR for preloading and bootstrapping the application.\n\nIt does **not** rewrite asset URLs that are imported directly in your components:\n\n```tsx\n// This import resolves to a URL at build time by Vite\nimport logo from './logo.svg'\n\nfunction Header() {\n  return <img src={logo} /> // This URL is NOT affected by transformAssetUrls\n}\n```\n\nFor these asset imports, use Vite's `experimental.renderBuiltUrl` in your `vite.config.ts`:\n\n```ts\n// vite.config.ts\nexport default defineConfig({\n  experimental: {\n    renderBuiltUrl(filename, { hostType }) {\n      if (hostType === 'js') {\n        return { relative: true }\n      }\n      return `https://cdn.example.com/${filename}`\n    },\n  },\n})\n```\n"
  },
  {
    "path": "docs/start/framework/react/guide/client-entry-point.md",
    "content": "---\nid: client-entry-point\ntitle: Client Entry Point\n---\n\n# Client Entry Point\n\n> [!NOTE]\n> The client entry point is **optional** out of the box. If not provided, TanStack Start will automatically handle the client entry point for you using the below as a default.\n\nGetting our html to the client is only half the battle. Once there, we need to hydrate our client-side JavaScript once the route resolves to the client. We do this by hydrating the root of our application with the `StartClient` component:\n\n```tsx\n// src/client.tsx\nimport { StartClient } from '@tanstack/react-start/client'\nimport { StrictMode } from 'react'\nimport { hydrateRoot } from 'react-dom/client'\n\nhydrateRoot(\n  document,\n  <StrictMode>\n    <StartClient />\n  </StrictMode>,\n)\n```\n\nThis enables us to kick off client-side routing once the user's initial server request has fulfilled.\n\n## Error Handling\n\nYou can wrap your client entry point with error boundaries to handle client-side errors gracefully:\n\n```tsx\n// src/client.tsx\nimport { StartClient } from '@tanstack/react-start/client'\nimport { StrictMode } from 'react'\nimport { hydrateRoot } from 'react-dom/client'\nimport { ErrorBoundary } from './components/ErrorBoundary'\n\nhydrateRoot(\n  document,\n  <StrictMode>\n    <ErrorBoundary>\n      <StartClient />\n    </ErrorBoundary>\n  </StrictMode>,\n)\n```\n\n## Development vs Production\n\nYou may want different behavior in development vs production:\n\n```tsx\n// src/client.tsx\nimport { StartClient } from '@tanstack/react-start/client'\nimport { StrictMode } from 'react'\nimport { hydrateRoot } from 'react-dom/client'\n\nconst App = (\n  <>\n    {import.meta.env.DEV && <div>Development Mode</div>}\n    <StartClient />\n  </>\n)\n\nhydrateRoot(\n  document,\n  import.meta.env.DEV ? <StrictMode>{App}</StrictMode> : App,\n)\n```\n\nThe client entry point gives you full control over how your application initializes on the client side while working seamlessly with TanStack Start's server-side rendering.\n"
  },
  {
    "path": "docs/start/framework/react/guide/code-execution-patterns.md",
    "content": "---\nid: code-execution-patterns\ntitle: Code Execution Patterns\n---\n\nThis guide covers patterns for controlling where code runs in your TanStack Start application - server-only, client-only, or isomorphic (both environments). For foundational concepts, see the [Execution Model](./execution-model.md) guide.\n\n## Quick Start\n\nSet up execution boundaries in your TanStack Start application:\n\n```tsx\nimport {\n  createServerFn,\n  createServerOnlyFn,\n  createClientOnlyFn,\n  createIsomorphicFn,\n} from '@tanstack/react-start'\n\n// Server function (RPC call)\nconst getUsers = createServerFn().handler(async () => {\n  return await db.users.findMany()\n})\n\n// Server-only utility (crashes on client)\nconst getSecret = createServerOnlyFn(() => process.env.API_SECRET)\n\n// Client-only utility (crashes on server)\nconst saveToStorage = createClientOnlyFn((data: any) => {\n  localStorage.setItem('data', JSON.stringify(data))\n})\n\n// Different implementations per environment\nconst logger = createIsomorphicFn()\n  .server((msg) => console.log(`[SERVER]: ${msg}`))\n  .client((msg) => console.log(`[CLIENT]: ${msg}`))\n```\n\n## Implementation Patterns\n\n### Progressive Enhancement\n\n```tsx\n// Component works without JS, enhanced with JS\nfunction SearchForm() {\n  const [query, setQuery] = useState('')\n\n  return (\n    <form action=\"/search\" method=\"get\">\n      <input\n        name=\"q\"\n        value={query}\n        onChange={(e) => setQuery(e.target.value)}\n      />\n      <ClientOnly fallback={<button type=\"submit\">Search</button>}>\n        <SearchButton onSearch={() => search(query)} />\n      </ClientOnly>\n    </form>\n  )\n}\n```\n\n### Environment-Aware Storage\n\n```tsx\nconst storage = createIsomorphicFn()\n  .server((key: string) => {\n    // Server: File-based cache\n    const fs = require('node:fs')\n    return JSON.parse(fs.readFileSync('.cache', 'utf-8'))[key]\n  })\n  .client((key: string) => {\n    // Client: localStorage\n    return JSON.parse(localStorage.getItem(key) || 'null')\n  })\n```\n\n## Common Problems\n\n### Environment Variable Exposure\n\n```tsx\n// ❌ Exposes to client bundle\nconst apiKey = process.env.SECRET_KEY\n\n// ✅ Server-only access\nconst apiKey = createServerOnlyFn(() => process.env.SECRET_KEY)\n```\n\n### Incorrect Loader Assumptions\n\n```tsx\n// ❌ Assuming loader is server-only\nexport const Route = createFileRoute('/users')({\n  loader: () => {\n    // This runs on BOTH server and client!\n    const secret = process.env.SECRET // Exposed to client\n    return fetch(`/api/users?key=${secret}`)\n  },\n})\n\n// ✅ Use server function for server-only operations\nconst getUsersSecurely = createServerFn().handler(() => {\n  const secret = process.env.SECRET // Server-only\n  return fetch(`/api/users?key=${secret}`)\n})\n\nexport const Route = createFileRoute('/users')({\n  loader: () => getUsersSecurely(), // Isomorphic call to server function\n})\n```\n\n### Hydration Mismatches\n\n```tsx\n// ❌ Different content server vs client\nfunction CurrentTime() {\n  return <div>{new Date().toLocaleString()}</div>\n}\n\n// ✅ Consistent rendering\nfunction CurrentTime() {\n  const [time, setTime] = useState<string>()\n\n  useEffect(() => {\n    setTime(new Date().toLocaleString())\n  }, [])\n\n  return <div>{time || 'Loading...'}</div>\n}\n```\n\n## Production Checklist\n\n- [ ] **Bundle Analysis**: Verify server-only code isn't in client bundle\n- [ ] **Environment Variables**: Ensure secrets use `createServerOnlyFn()` or `createServerFn()`\n- [ ] **Loader Logic**: Remember loaders are isomorphic, not server-only\n- [ ] **ClientOnly Fallbacks**: Provide appropriate fallbacks to prevent layout shift\n- [ ] **Error Boundaries**: Handle server/client execution errors gracefully\n\n## Related Resources\n\n- [Execution Model](./execution-model.md) - Core concepts and architectural patterns\n- [Server Functions](./server-functions.md) - Deep dive into server function patterns\n- [Environment Variables](./environment-variables.md) - Secure environment variable handling\n- [Middleware](./middleware.md) - Server function middleware patterns\n"
  },
  {
    "path": "docs/start/framework/react/guide/databases.md",
    "content": "---\nid: databases\ntitle: Databases\n---\n\nDatabases 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.\n\n## What should I use?\n\nTanStack 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.\n\n## How simple is it to use a database with TanStack Start?\n\nUsing a database with TanStack Start is as simple as calling into your database's adapter/client/driver/service from a TanStack Start server function or server route.\n\nHere's an abstract example of how you might connect with a database and read/write to it:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\n\nconst db = createMyDatabaseClient()\n\nexport const getUser = createServerFn().handler(async ({ context }) => {\n  const user = await db.getUser(context.userId)\n  return user\n})\n\nexport const createUser = createServerFn({ method: 'POST' }).handler(\n  async ({ data }) => {\n    const user = await db.createUser(data)\n    return user\n  },\n)\n```\n\nThis is obviously contrived, but it demonstrates that you can use literally any database provider with TanStack Start as long as you can call into it from a server function or server route.\n\n## Recommended Database Providers\n\nWhile TanStack Start is designed to work with any database provider, we highly recommend considering one of our vetted partner database providers [Neon](https://neon.tech?utm_source=tanstack) or [Convex](https://convex.dev?utm_source=tanstack). They have been vetted by TanStack to match our quality, openness, and performance standards and are both excellent choices for your database needs.\n\n## What is Neon?\n\n<a href=\"https://neon.tech?utm_source=tanstack\" alt=\"Neon Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/neon-dark.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/neon-light.svg\" width=\"280\">\n    <img alt=\"Neon logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/neon-light.svg\" width=\"280\">\n  </picture>\n</a>\n\nNeon is a fully managed serverless PostgreSQL with a generous free tier. It separates storage and compute to offer autoscaling, branching, and bottomless storage. With Neon, you get all the power and reliability of PostgreSQL combined with modern cloud capabilities, making it perfect for TanStack Start applications.\n\nKey features that make Neon stand out:\n\n- Serverless PostgreSQL that scales automatically\n- Database branching for development and testing\n- Built-in connection pooling\n- Point-in-time restore\n- Web-based SQL editor\n- Bottomless storage\n  <br />\n  <br />\n- To learn more about Neon, visit the [Neon website](https://neon.tech?utm_source=tanstack)\n- To sign up, visit the [Neon dashboard](https://console.neon.tech/signup?utm_source=tanstack)\n\n## What is Convex?\n\n<a href=\"https://convex.dev?utm_source=tanstack\" alt=\"Convex Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/convex-white.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/convex-color.svg\" width=\"280\">\n    <img alt=\"Convex logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/convex-color.svg\" width=\"280\">\n  </picture>\n</a>\n\nConvex 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.\n\nConvex'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.\n\n- To learn more about Convex, visit the [Convex website](https://convex.dev?utm_source=tanstack)\n- To sign up, visit the [Convex dashboard](https://dashboard.convex.dev/signup?utm_source=tanstack)\n\n## What is Prisma Postgres?\n\n<a href=\"https://www.prisma.io?utm_source=tanstack&via=tanstack\" alt=\"Prisma Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/prisma-dark.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/prisma-light.svg\" width=\"280\">\n    <img alt=\"Prisma logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/prisma-light.svg\" width=\"280\">\n  </picture>\n</a>\n\nInstant Postgres, Zero Setup: Get a production-ready Postgres database in seconds, then dive straight back into code. We handle connections, scaling, and turning knobs so your flow never breaks. Blends perfectly with TanStack Start.\n\n- Edge-optimized: Local region routing means lower latency and fewer hops. Even complex queries are one fast round trip.\n- Fits your stack: Works with your frameworks, libraries, and tools for a smooth DX.\n- Web UI: A hosted interface to inspect, manage, and query data with your team.\n- Auto-scaling: Grows from zero to millions of users without cold starts or manual tuning.\n- Unikernel isolation: Each DB runs as its own unikernel for security, speed, and efficiency.\n  <br />\n  <br />\n- To learn more about Prisma Postgres, visit the [Prisma website](https://www.prisma.io?utm_source=tanstack&via=tanstack)\n- To sign up, visit the [Prisma Console](https://console.prisma.io/sign-up?utm_source=tanstack&via=tanstack)\n\n## Documentation & APIs\n\nDocumentation 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.\n"
  },
  {
    "path": "docs/start/framework/react/guide/environment-functions.md",
    "content": "---\nid: environment-functions\ntitle: Environment Functions\n---\n\n## What Are Environment Functions?\n\nEnvironment functions are utilities designed to define and control function execution based on the runtime environment—whether the code is running on the client or the server. These utilities help ensure that environment-specific logic is executed safely and intentionally, preventing runtime errors and improving maintainability in fullstack or isomorphic applications.\n\nStart provides three core environment functions:\n\n- `createIsomorphicFn`: Compose a single function that adapts to both client and server environments.\n- `createServerOnlyFn`: Create a function that can only run on the server.\n- `createClientOnlyFn`: Create a function that can only run on the client.\n\n---\n\n## Isomorphic Functions\n\nUse `createIsomorphicFn()` to define functions that behave differently depending on whether they are called on the client or the server. This is useful for safely sharing logic across environments while delegating environment-specific behavior to appropriate handlers.\n\n### Complete Implementation\n\n```tsx\nimport { createIsomorphicFn } from '@tanstack/react-start'\n\nconst getEnv = createIsomorphicFn()\n  .server(() => 'server')\n  .client(() => 'client')\n\nconst env = getEnv()\n// ℹ️ On the **server**, it returns `'server'`.\n// ℹ️ On the **client**, it returns `'client'`.\n```\n\n### Partial Implementation (Server)\n\nHere is an example of `createIsomorphicFn()` with only server implementation:\n\n```tsx\nimport { createIsomorphicFn } from '@tanstack/react-start'\n\nconst serverImplementationOnly = createIsomorphicFn().server(() => 'server')\n\nconst server = serverImplementationOnly()\n// ℹ️ On the **server**, it returns `'server'`.\n// ℹ️ On the **client**, it is no-op (returns `undefined`)\n```\n\n### Partial Implementation (Client)\n\nHere is an example of `createIsomorphicFn()` with only client implementation:\n\n```tsx\nimport { createIsomorphicFn } from '@tanstack/react-start'\n\nconst clientImplementationOnly = createIsomorphicFn().client(() => 'client')\n\nconst client = clientImplementationOnly()\n// ℹ️ On the **server**, it is no-op (returns `undefined`)\n// ℹ️ On the **client**, it returns `'client'`.\n```\n\n### No Implementation\n\nHere is an example of `createIsomorphicFn()` without any environment specific implementation:\n\n```tsx\nimport { createIsomorphicFn } from '@tanstack/react-start'\n\nconst noImplementation = createIsomorphicFn()\n\nconst noop = noImplementation()\n// ℹ️ On both **client** and **server**, it is no-op (returns `undefined`)\n```\n\n#### What is a no-op?\n\nA no-op (short for \"no operation\") is a function that does nothing when executed - it simply returns `undefined` without performing any operations.\n\n```tsx\n// basic no-op implementation\nfunction noop() {}\n```\n\n---\n\n## `env`Only Functions\n\nThe `createServerOnlyFn` and `createClientOnlyFn` helpers enforce strict environment-bound execution. They ensure the returned function is only callable in the correct runtime context. If misused, they throw descriptive runtime errors to prevent unintentional logic execution.\n\n### `createServerOnlyFn`\n\n```tsx\nimport { createServerOnlyFn } from '@tanstack/react-start'\n\nconst foo = createServerOnlyFn(() => 'bar')\n\nfoo() // ✅ On server: returns \"bar\"\n// ❌ On client: throws \"createServerOnlyFn() functions can only be called on the server!\"\n```\n\n### `createClientOnlyFn`\n\n```tsx\nimport { createClientOnlyFn } from '@tanstack/react-start'\n\nconst foo = createClientOnlyFn(() => 'bar')\n\nfoo() // ✅ On client: returns \"bar\"\n// ❌ On server: throws \"createClientOnlyFn() functions can only be called on the client!\"\n```\n\n> [!NOTE]\n> These functions are useful for API access, filesystem reads, using browser APIs, or other operations that are invalid or insecure outside their intended environment.\n\n## Tree Shaking\n\nEnvironment functions are tree-shaken based on the environment for each bundle produced.\n\nFunctions created using `createIsomorphicFn()` are tree-shaken. All codes inside `.client()` are not included in server bundle, and vice-versa.\n\nOn the server, functions created using `createClientOnlyFn()` are replaced with a function that throws an `Error` on the server. The reverse is true for `createServerOnlyFn` functions on the client.\n"
  },
  {
    "path": "docs/start/framework/react/guide/environment-variables.md",
    "content": "---\nid: environment-variables\ntitle: Environment Variables\n---\n\nLearn how to securely configure and use environment variables in your TanStack Start application across different contexts (server functions, client code, and build processes).\n\n## Quick Start\n\nTanStack Start automatically loads `.env` files and makes variables available in both server and client contexts with proper security boundaries.\n\n```bash\n# .env\nDATABASE_URL=postgresql://user:pass@localhost:5432/mydb\nVITE_APP_NAME=My TanStack Start App\n```\n\n```typescript\n// Server function - can access any environment variable\nconst getUser = createServerFn().handler(async () => {\n  const db = await connect(process.env.DATABASE_URL) // ✅ Server-only\n  return db.user.findFirst()\n})\n\n// Client component - only VITE_ prefixed variables\nexport function AppHeader() {\n  return <h1>{import.meta.env.VITE_APP_NAME}</h1> // ✅ Client-safe\n}\n```\n\n## Environment Variable Contexts\n\n### Server-Side Context (Server Functions & API Routes)\n\nServer functions can access **any** environment variable using `process.env`:\n\n```typescript\nimport { createServerFn } from '@tanstack/react-start'\n\n// Database connection (server-only)\nconst connectToDatabase = createServerFn().handler(async () => {\n  const connectionString = process.env.DATABASE_URL // No prefix needed\n  const apiKey = process.env.EXTERNAL_API_SECRET // Stays on server\n\n  // These variables are never exposed to the client\n  return await database.connect(connectionString)\n})\n\n// Authentication (server-only)\nconst authenticateUser = createServerFn()\n  .inputValidator(z.object({ token: z.string() }))\n  .handler(async ({ data }) => {\n    const jwtSecret = process.env.JWT_SECRET // Server-only\n    return jwt.verify(data.token, jwtSecret)\n  })\n```\n\n### Client-Side Context (Components & Client Code)\n\nClient code can only access variables with the `VITE_` prefix:\n\n```typescript\n// Client configuration\nexport function ApiProvider({ children }: { children: React.ReactNode }) {\n  const apiUrl = import.meta.env.VITE_API_URL     // ✅ Public\n  const apiKey = import.meta.env.VITE_PUBLIC_KEY  // ✅ Public\n\n  // This would be undefined (security feature):\n  // const secret = import.meta.env.DATABASE_URL   // ❌ Undefined\n\n  return (\n    <ApiContext.Provider value={{ apiUrl, apiKey }}>\n      {children}\n    </ApiContext.Provider>\n  )\n}\n\n// Feature flags\nexport function FeatureGatedComponent() {\n  const enableNewFeature = import.meta.env.VITE_ENABLE_NEW_FEATURE === 'true'\n\n  if (!enableNewFeature) return null\n\n  return <NewFeature />\n}\n```\n\n## Environment File Setup\n\n### File Hierarchy (Loaded in Order)\n\nTanStack Start automatically loads environment files in this order:\n\n```\n.env.local          # Local overrides (add to .gitignore)\n.env.production     # Production-specific variables\n.env.development    # Development-specific variables\n.env                # Default variables (commit to git)\n```\n\n### Example Setup\n\n**.env** (committed to repository):\n\n```bash\n# Public configuration\nVITE_APP_NAME=My TanStack Start App\nVITE_API_URL=https://api.example.com\nVITE_SENTRY_DSN=https://...\n\n# Server configuration templates\nDATABASE_URL=postgresql://localhost:5432/myapp_dev\nREDIS_URL=redis://localhost:6379\n```\n\n**.env.local** (add to .gitignore):\n\n```bash\n# Override for local development\nDATABASE_URL=postgresql://user:password@localhost:5432/myapp_local\nSTRIPE_SECRET_KEY=sk_test_...\nJWT_SECRET=your-local-secret\n```\n\n**.env.production**:\n\n```bash\n# Production overrides\nVITE_API_URL=https://api.myapp.com\nDATABASE_POOL_SIZE=20\n```\n\n## Common Patterns\n\n### Database Configuration\n\n```typescript\n// src/lib/database.ts\nimport { createServerFn } from '@tanstack/react-start'\n\nconst getDatabaseConnection = createServerFn().handler(async () => {\n  const config = {\n    url: process.env.DATABASE_URL,\n    maxConnections: parseInt(process.env.DB_MAX_CONNECTIONS || '10'),\n    ssl: process.env.NODE_ENV === 'production',\n  }\n\n  return createConnection(config)\n})\n```\n\n### Authentication Provider Setup\n\n```typescript\n// src/lib/auth.ts (Server)\nexport const authConfig = {\n  secret: process.env.AUTH_SECRET,\n  providers: {\n    auth0: {\n      domain: process.env.AUTH0_DOMAIN,\n      clientId: process.env.AUTH0_CLIENT_ID,\n      clientSecret: process.env.AUTH0_CLIENT_SECRET, // Server-only\n    }\n  }\n}\n\n// src/components/AuthProvider.tsx (Client)\nexport function AuthProvider({ children }: { children: React.ReactNode }) {\n  return (\n    <Auth0Provider\n      domain={import.meta.env.VITE_AUTH0_DOMAIN}\n      clientId={import.meta.env.VITE_AUTH0_CLIENT_ID}\n      // No client secret here - it stays on the server\n    >\n      {children}\n    </Auth0Provider>\n  )\n}\n```\n\n### External API Integration\n\n```typescript\n// src/lib/external-api.ts\nimport { createServerFn } from '@tanstack/react-start'\n\n// Server-side API calls (can use secret keys)\nconst fetchUserData = createServerFn()\n  .inputValidator(z.object({ userId: z.string() }))\n  .handler(async ({ data }) => {\n    const response = await fetch(\n      `${process.env.EXTERNAL_API_URL}/users/${data.userId}`,\n      {\n        headers: {\n          Authorization: `Bearer ${process.env.EXTERNAL_API_SECRET}`,\n          'Content-Type': 'application/json',\n        },\n      },\n    )\n\n    return response.json()\n  })\n\n// Client-side API calls (public endpoints only)\nexport function usePublicData() {\n  const apiUrl = import.meta.env.VITE_PUBLIC_API_URL\n\n  return useQuery({\n    queryKey: ['public-data'],\n    queryFn: () => fetch(`${apiUrl}/public/stats`).then((r) => r.json()),\n  })\n}\n```\n\n### Feature Flags and Configuration\n\n```typescript\n// src/config/features.ts\nexport const featureFlags = {\n  enableNewDashboard: import.meta.env.VITE_ENABLE_NEW_DASHBOARD === 'true',\n  enableAnalytics: import.meta.env.VITE_ENABLE_ANALYTICS === 'true',\n  debugMode: import.meta.env.VITE_DEBUG_MODE === 'true',\n}\n\n// Usage in components\nexport function Dashboard() {\n  if (featureFlags.enableNewDashboard) {\n    return <NewDashboard />\n  }\n\n  return <LegacyDashboard />\n}\n```\n\n## Type Safety\n\n### TypeScript Declarations\n\nCreate `src/env.d.ts` to add type safety:\n\n```typescript\n/// <reference types=\"vite/client\" />\n\ninterface ImportMetaEnv {\n  // Client-side environment variables\n  readonly VITE_APP_NAME: string\n  readonly VITE_API_URL: string\n  readonly VITE_AUTH0_DOMAIN: string\n  readonly VITE_AUTH0_CLIENT_ID: string\n  readonly VITE_SENTRY_DSN?: string\n  readonly VITE_ENABLE_NEW_DASHBOARD?: string\n}\n\ninterface ImportMeta {\n  readonly env: ImportMetaEnv\n}\n\n// Server-side environment variables\ndeclare global {\n  namespace NodeJS {\n    interface ProcessEnv {\n      readonly DATABASE_URL: string\n      readonly REDIS_URL: string\n      readonly JWT_SECRET: string\n      readonly AUTH0_CLIENT_SECRET: string\n      readonly STRIPE_SECRET_KEY: string\n      readonly NODE_ENV: 'development' | 'production' | 'test'\n    }\n  }\n}\n\nexport {}\n```\n\n### Runtime Validation\n\nUse Zod for runtime validation of environment variables:\n\n```typescript\n// src/config/env.ts\nimport { z } from 'zod'\n\nconst envSchema = z.object({\n  DATABASE_URL: z.string().url(),\n  JWT_SECRET: z.string().min(32),\n  NODE_ENV: z.enum(['development', 'production', 'test']),\n})\n\nconst clientEnvSchema = z.object({\n  VITE_APP_NAME: z.string(),\n  VITE_API_URL: z.string().url(),\n  VITE_AUTH0_DOMAIN: z.string(),\n  VITE_AUTH0_CLIENT_ID: z.string(),\n})\n\n// Validate server environment\nexport const serverEnv = envSchema.parse(process.env)\n\n// Validate client environment\nexport const clientEnv = clientEnvSchema.parse(import.meta.env)\n```\n\n## Security Best Practices\n\n### 1. Never Expose Secrets to Client\n\n```typescript\n// ❌ WRONG - Secret exposed to client bundle\nconst config = {\n  apiKey: import.meta.env.VITE_SECRET_API_KEY, // This will be in your JS bundle!\n}\n\n// ✅ CORRECT - Keep secrets on server\nconst getApiData = createServerFn().handler(async () => {\n  const response = await fetch(apiUrl, {\n    headers: { Authorization: `Bearer ${process.env.SECRET_API_KEY}` },\n  })\n  return response.json()\n})\n```\n\n### 2. Use Appropriate Prefixes\n\n```bash\n# ✅ Server-only (no prefix)\nDATABASE_URL=postgresql://...\nJWT_SECRET=super-secret-key\nSTRIPE_SECRET_KEY=sk_live_...\n\n# ✅ Client-safe (VITE_ prefix)\nVITE_APP_NAME=My App\nVITE_API_URL=https://api.example.com\nVITE_SENTRY_DSN=https://...\n```\n\n### 3. Validate Required Variables\n\n```typescript\n// src/config/validation.ts\nconst requiredServerEnv = ['DATABASE_URL', 'JWT_SECRET'] as const\n\nconst requiredClientEnv = ['VITE_APP_NAME', 'VITE_API_URL'] as const\n\n// Validate on server startup\nfor (const key of requiredServerEnv) {\n  if (!process.env[key]) {\n    throw new Error(`Missing required environment variable: ${key}`)\n  }\n}\n\n// Validate client environment at build time\nfor (const key of requiredClientEnv) {\n  if (!import.meta.env[key]) {\n    throw new Error(`Missing required environment variable: ${key}`)\n  }\n}\n```\n\n## Production Checklist\n\n- [ ] All sensitive variables are server-only (no `VITE_` prefix)\n- [ ] Client variables use `VITE_` prefix\n- [ ] `.env.local` is in `.gitignore`\n- [ ] Production environment variables are configured on hosting platform\n- [ ] Required environment variables are validated at startup\n- [ ] No hardcoded secrets in source code\n- [ ] Database URLs use connection pooling in production\n- [ ] API keys are rotated regularly\n\n## Common Problems\n\n### Environment Variable is Undefined\n\n**Problem**: `import.meta.env.MY_VARIABLE` returns `undefined`\n\n**Solutions**:\n\n1. **Add correct prefix**: Use `VITE_` prefix (e.g. `VITE_MY_VARIABLE`)\n2. **Restart development server** after adding new variables\n3. **Check file location**: `.env` file must be in project root\n4. **Verify bundler configuration**: Ensure variables are properly injected\n\n**Example**:\n\n```bash\n# ❌ Won't work in client code\nAPI_KEY=abc123\n\n# ✅ Works in client code\nVITE_API_KEY=abc123\n\n# ❌ Won't bundle the variable (assuming it is not set in the environment of the build)\nnpm run build\n\n# ✅ Works in client code and will bundle the variable for production\nVITE_API_KEY=abc123 npm run build\n```\n\n### Runtime Client Environment Variables in Production\n\n**Problem**: If `VITE_` variables are replaced at bundle time only, how to make runtime variables available on the client?\n\n**Solutions**:\n\nPass variables from the server down to the client:\n\n```tsx\nconst getRuntimeVar = createServerFn({ method: 'GET' }).handler(() => {\n  return process.env.MY_RUNTIME_VAR // notice `process.env` on the server, and no `VITE_` prefix\n})\n\nexport const Route = createFileRoute('/')({\n  loader: async () => {\n    const foo = await getRuntimeVar()\n    return { foo }\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { foo } = Route.useLoaderData()\n  // ... use your variable however you want\n}\n```\n\n### Variable Not Updating\n\n**Problem**: Environment variable changes aren't reflected\n\n**Solutions**:\n\n1. Restart development server\n2. Check if you're modifying the correct `.env` file\n3. Verify file hierarchy (`.env.local` overrides `.env`)\n\n### TypeScript Errors\n\n**Problem**: `Property 'VITE_MY_VAR' does not exist on type 'ImportMetaEnv'`\n\n**Solution**: Add to `src/env.d.ts`:\n\n```typescript\ninterface ImportMetaEnv {\n  readonly VITE_MY_VAR: string\n}\n```\n\n### Security: Secret Exposed to Client\n\n**Problem**: Sensitive data appearing in client bundle\n\n**Solutions**:\n\n1. Remove `VITE_` prefix from sensitive variables\n2. Move sensitive operations to server functions\n3. Use build tools to verify no secrets in client bundle\n\n### Build Errors in Production\n\n**Problem**: Missing environment variables in production build\n\n**Solutions**:\n\n1. Configure variables on hosting platform\n2. Validate required variables at build time\n3. Use deployment-specific `.env` files\n\n## Server Build Configuration\n\n### Static `NODE_ENV` Replacement\n\nBy default, TanStack Start statically replaces `process.env.NODE_ENV` in **server builds** at build time. This enables dead code elimination (tree-shaking) for development-only code paths in your server bundle.\n\n**Why this matters:** Vite automatically replaces `process.env.NODE_ENV` in client builds, but server builds run in Node.js where `process.env` is a real runtime object. Without static replacement, code like this would remain in your production server bundle:\n\n```typescript\nif (process.env.NODE_ENV === 'development') {\n  // This code would NOT be eliminated without static replacement\n  enableDevTools()\n  logDebugInfo()\n}\n```\n\nWith static replacement enabled (the default), the bundler sees `\"production\" === 'development'` and eliminates the entire block.\n\n### Configuring Static Replacement\n\nThe replacement is controlled by the `server.build.staticNodeEnv` option:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      server: {\n        build: {\n          // Replace process.env.NODE_ENV at build time (default: true)\n          staticNodeEnv: true,\n        },\n      },\n    }),\n    viteReact(),\n  ],\n})\n```\n\nThe replacement value is determined in this order:\n\n1. `process.env.NODE_ENV` at build time (if set)\n2. Vite's `mode` (e.g., from `--mode staging`)\n3. `\"production\"` (fallback)\n\n### When to Disable Static Replacement\n\nSet `staticNodeEnv: false` if you need `NODE_ENV` to remain dynamic at runtime:\n\n```ts\ntanstackStart({\n  server: {\n    build: {\n      staticNodeEnv: false, // Keep NODE_ENV dynamic at runtime\n    },\n  },\n})\n```\n\nCommon reasons to disable:\n\n- **Same build, multiple environments**: Deploying one build artifact to staging and production\n- **Runtime environment detection**: Code that must check the actual runtime environment\n- **Testing production builds locally**: Running production builds with `NODE_ENV=development`\n\n> **Note:** Disabling static replacement means development-only code paths will remain in your production bundle and be evaluated at runtime.\n\n> **Important:** If you disable `staticNodeEnv`, you **must** set `NODE_ENV=production` at runtime when running your server in production. Without this, React (and possibly other libraries) will run in development mode, which is significantly slower and includes extra warnings and checks not intended for production use.\n\n## Related Resources\n\n- [Code Execution Patterns](./code-execution-patterns.md) - Learn about server vs client code execution\n- [Server Functions](./server-functions.md) - Learn more about server-side code\n- [Hosting](./hosting.md) - Platform-specific environment variable configuration\n- [Vite Environment Variables](https://vitejs.dev/guide/env-and-mode.html) - Official Vite documentation\n"
  },
  {
    "path": "docs/start/framework/react/guide/error-boundaries.md",
    "content": "---\nid: error-boundaries\ntitle: Error Boundaries\n---\n\n## Error Boundaries (React Start)\n\nTanStack Start uses TanStack Router's route-level error boundaries.\n\n- Set a default for all routes via the router\n- Override per-route with `errorComponent`\n\n### Configure a default\n\n```tsx\n// src/router.tsx\nimport { createRouter, ErrorComponent } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    // Shown when an error bubbles to the router\n    defaultErrorComponent: ({ error, reset }) => (\n      <ErrorComponent error={error} />\n    ),\n  })\n  return router\n}\n```\n\n### Per-route override\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute, ErrorComponent } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nfunction PostError({ error, reset }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostComponent,\n  errorComponent: PostError,\n})\n```\n\nNotes:\n\n- `ErrorComponent` is a simple built-in UI you can replace.\n- Call `reset()` to retry rendering the route after fixing state.\n- Use `beforeLoad`/`loader` to throw errors that will be caught.\n"
  },
  {
    "path": "docs/start/framework/react/guide/execution-model.md",
    "content": "---\nid: execution-model\ntitle: Execution Model\n---\n\nUnderstanding where code runs is fundamental to building TanStack Start applications. This guide explains TanStack Start's execution model and how to control where your code executes.\n\n## Core Principle: Isomorphic by Default\n\n**All code in TanStack Start is isomorphic by default** - it runs and is included in both server and client bundles unless explicitly constrained.\n\n```tsx\n// ✅ This runs on BOTH server and client\nfunction formatPrice(price: number) {\n  return new Intl.NumberFormat('en-US', {\n    style: 'currency',\n    currency: 'USD',\n  }).format(price)\n}\n\n// ✅ Route loaders are ISOMORPHIC\nexport const Route = createFileRoute('/products')({\n  loader: async () => {\n    // This runs on server during SSR AND on client during navigation\n    const response = await fetch('/api/products')\n    return response.json()\n  },\n})\n```\n\n> **Critical Understanding**: Route `loader`s are isomorphic - they run on both server and client, not just the server.\n\n## The Execution Boundary\n\nTanStack Start applications run in two environments:\n\n### Server Environment\n\n- **Node.js runtime** with access to file system, databases, environment variables\n- **During SSR** - Initial page renders on server\n- **API requests** - Server functions execute server-side\n- **Build time** - Static generation and pre-rendering\n\n### Client Environment\n\n- **Browser runtime** with access to DOM, localStorage, user interactions\n- **After hydration** - Client takes over after initial server render\n- **Navigation** - Route loaders run client-side during navigation\n- **User interactions** - Event handlers, form submissions, etc.\n\n## Execution Control APIs\n\n### Server-Only Execution\n\n| API                      | Use Case                  | Client Behavior           |\n| ------------------------ | ------------------------- | ------------------------- |\n| `createServerFn()`       | RPC calls, data mutations | Network request to server |\n| `createServerOnlyFn(fn)` | Utility functions         | Throws error              |\n\n```tsx\nimport { createServerFn, createServerOnlyFn } from '@tanstack/react-start'\n\n// RPC: Server execution, callable from client\nconst updateUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: UserData) => data)\n  .handler(async ({ data }) => {\n    // Only runs on server, but client can call it\n    return await db.users.update(data)\n  })\n\n// Utility: Server-only, client crashes if called\nconst getEnvVar = createServerOnlyFn(() => process.env.DATABASE_URL)\n```\n\n### Client-Only Execution\n\n| API                      | Use Case                        | Server Behavior  |\n| ------------------------ | ------------------------------- | ---------------- |\n| `createClientOnlyFn(fn)` | Browser utilities               | Throws error     |\n| `<ClientOnly>`           | Components needing browser APIs | Renders fallback |\n\n```tsx\nimport { createClientOnlyFn } from '@tanstack/react-start'\nimport { ClientOnly } from '@tanstack/react-router'\n\n// Utility: Client-only, server crashes if called\nconst saveToStorage = createClientOnlyFn((key: string, value: any) => {\n  localStorage.setItem(key, JSON.stringify(value))\n})\n\n// Component: Only renders children after hydration\nfunction Analytics() {\n  return (\n    <ClientOnly fallback={null}>\n      <GoogleAnalyticsScript />\n    </ClientOnly>\n  )\n}\n```\n\n#### useHydrated Hook\n\nFor more granular control over hydration-dependent behavior, use the `useHydrated` hook. It returns a boolean indicating whether the client has been hydrated:\n\n```tsx\nimport { useHydrated } from '@tanstack/react-router'\n\nfunction TimeZoneDisplay() {\n  const hydrated = useHydrated()\n  const timeZone = hydrated\n    ? Intl.DateTimeFormat().resolvedOptions().timeZone\n    : 'UTC'\n\n  return <div>Your timezone: {timeZone}</div>\n}\n```\n\n**Behavior:**\n\n- **During SSR**: Always returns `false`\n- **First client render**: Returns `false`\n- **After hydration**: Returns `true` (and stays `true` for all subsequent renders)\n\nThis is useful when you need to conditionally render content based on client-side data (like browser timezone, locale, or localStorage) while providing a sensible fallback for server rendering.\n\n### Environment-Specific Implementations\n\n```tsx\nimport { createIsomorphicFn } from '@tanstack/react-start'\n\n// Different implementation per environment\nconst getDeviceInfo = createIsomorphicFn()\n  .server(() => ({ type: 'server', platform: process.platform }))\n  .client(() => ({ type: 'client', userAgent: navigator.userAgent }))\n```\n\n## Architectural Patterns\n\n### Progressive Enhancement\n\nBuild components that work without JavaScript and enhance with client-side functionality:\n\n```tsx\nfunction SearchForm() {\n  const [query, setQuery] = useState('')\n\n  return (\n    <form action=\"/search\" method=\"get\">\n      <input\n        name=\"q\"\n        value={query}\n        onChange={(e) => setQuery(e.target.value)}\n      />\n      <ClientOnly fallback={<button type=\"submit\">Search</button>}>\n        <SearchButton onSearch={() => search(query)} />\n      </ClientOnly>\n    </form>\n  )\n}\n```\n\n### Environment-Aware Storage\n\n```tsx\nconst storage = createIsomorphicFn()\n  .server((key: string) => {\n    // Server: File-based cache\n    const fs = require('node:fs')\n    return JSON.parse(fs.readFileSync('.cache', 'utf-8'))[key]\n  })\n  .client((key: string) => {\n    // Client: localStorage\n    return JSON.parse(localStorage.getItem(key) || 'null')\n  })\n```\n\n### RPC vs Direct Function Calls\n\nUnderstanding when to use server functions vs server-only functions:\n\n```tsx\n// createServerFn: RPC pattern - server execution, client callable\nconst fetchUser = createServerFn().handler(async () => await db.users.find())\n\n// Usage from client component:\nconst user = await fetchUser() // ✅ Network request\n\n// createServerOnlyFn: Crashes if called from client\nconst getSecret = createServerOnlyFn(() => process.env.SECRET)\n\n// Usage from client:\nconst secret = getSecret() // ❌ Throws error\n```\n\n## Common Anti-Patterns\n\n### Environment Variable Exposure\n\n```tsx\n// ❌ Exposes to client bundle\nconst apiKey = process.env.SECRET_KEY\n\n// ✅ Server-only access\nconst apiKey = createServerOnlyFn(() => process.env.SECRET_KEY)\n```\n\n### Incorrect Loader Assumptions\n\n```tsx\n// ❌ Assuming loader is server-only\nexport const Route = createFileRoute('/users')({\n  loader: () => {\n    // This runs on BOTH server and client!\n    const secret = process.env.SECRET // Exposed to client\n    return fetch(`/api/users?key=${secret}`)\n  },\n})\n\n// ✅ Use server function for server-only operations\nconst getUsersSecurely = createServerFn().handler(() => {\n  const secret = process.env.SECRET // Server-only\n  return fetch(`/api/users?key=${secret}`)\n})\n\nexport const Route = createFileRoute('/users')({\n  loader: () => getUsersSecurely(), // Isomorphic call to server function\n})\n```\n\n### Hydration Mismatches\n\n```tsx\n// ❌ Different content server vs client\nfunction CurrentTime() {\n  return <div>{new Date().toLocaleString()}</div>\n}\n\n// ✅ Consistent rendering\nfunction CurrentTime() {\n  const [time, setTime] = useState<string>()\n\n  useEffect(() => {\n    setTime(new Date().toLocaleString())\n  }, [])\n\n  return <div>{time || 'Loading...'}</div>\n}\n```\n\n## Manual vs API-Driven Environment Detection\n\n```tsx\n// Manual: You handle the logic\nfunction logMessage(msg: string) {\n  if (typeof window === 'undefined') {\n    console.log(`[SERVER]: ${msg}`)\n  } else {\n    console.log(`[CLIENT]: ${msg}`)\n  }\n}\n\n// API: Framework handles it\nconst logMessage = createIsomorphicFn()\n  .server((msg) => console.log(`[SERVER]: ${msg}`))\n  .client((msg) => console.log(`[CLIENT]: ${msg}`))\n```\n\n## Architecture Decision Framework\n\n**Choose Server-Only when:**\n\n- Accessing sensitive data (environment variables, secrets)\n- File system operations\n- Database connections\n- External API keys\n\n**Choose Client-Only when:**\n\n- DOM manipulation\n- Browser APIs (localStorage, geolocation)\n- User interaction handling\n- Analytics/tracking\n\n**Choose Isomorphic when:**\n\n- Data formatting/transformation\n- Business logic\n- Shared utilities\n- Route loaders (they're isomorphic by nature)\n\n## Security Considerations\n\n### Bundle Analysis\n\nAlways verify server-only code isn't included in client bundles:\n\n```bash\n# Analyze client bundle\nnpm run build\n# Check dist/client for any server-only imports\n```\n\n### Environment Variable Strategy\n\n- **Client-exposed**: Use `VITE_` prefix for client-accessible variables\n- **Server-only**: Access via `createServerOnlyFn()` or `createServerFn()`\n- **Never expose**: Database URLs, API keys, secrets\n\n### Error Boundaries\n\nHandle server/client execution errors gracefully:\n\n```tsx\nfunction ErrorBoundary({ children }: { children: React.ReactNode }) {\n  return (\n    <ErrorBoundaryComponent\n      fallback={<div>Something went wrong</div>}\n      onError={(error) => {\n        if (typeof window === 'undefined') {\n          console.error('[SERVER ERROR]:', error)\n        } else {\n          console.error('[CLIENT ERROR]:', error)\n        }\n      }}\n    >\n      {children}\n    </ErrorBoundaryComponent>\n  )\n}\n```\n\nUnderstanding TanStack Start's execution model is crucial for building secure, performant, and maintainable applications. The isomorphic-by-default approach provides flexibility while the execution control APIs give you precise control when needed.\n"
  },
  {
    "path": "docs/start/framework/react/guide/hosting.md",
    "content": "---\nid: hosting\ntitle: Hosting\n---\n\nHosting 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 Vite, a powerful dev/build platform that allows us to make it possible to deploy your application to any hosting provider.\n\n## What should I use?\n\nTanStack 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.\n\nHowever, since hosting is one of the most crucial aspects of your application's performance, reliability, and scalability, we recommend using one of our **Official Hosting Partners**: [Cloudflare](https://www.cloudflare.com?utm_source=tanstack), [Netlify](https://www.netlify.com?utm_source=tanstack), or [Railway](https://railway.com?utm_source=tanstack).\n\n## Deployment\n\nOnce you've chosen a deployment target, you can follow the deployment guidelines below to deploy your TanStack Start application to the hosting provider of your choice:\n\n- [`cloudflare-workers`](#cloudflare-workers--official-partner): Deploy to Cloudflare Workers\n- [`netlify`](#netlify--official-partner): Deploy to Netlify\n- [`railway`](#railway--official-partner): Deploy to Railway\n- [`nitro`](#nitro): Deploy using Nitro\n- [`vercel`](#vercel): Deploy to Vercel\n- [`node-server`](#nodejs--docker): Deploy to a Node.js server\n- [`bun`](#bun): Deploy to a Bun server\n- [`appwrite-sites`](#appwrite-sites): Deploy to Appwrite Sites\n- ... and more to come!\n\n### Cloudflare Workers ⭐ _Official Partner_\n\n<a href=\"https://www.cloudflare.com?utm_source=tanstack\" alt=\"Cloudflare Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/cloudflare-white.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/cloudflare-black.svg\" width=\"280\">\n    <img alt=\"Cloudflare logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/cloudflare-black.svg\" width=\"280\">\n  </picture>\n</a>\n\nWhen deploying to Cloudflare Workers, you'll need to complete a few extra steps before your users can start using your app.\n\n1. Install `@cloudflare/vite-plugin` and `wrangler`\n\n```bash\npnpm add -D @cloudflare/vite-plugin wrangler\n```\n\n2. Add the Cloudflare plugin to your `vite.config.ts` file\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { cloudflare } from '@cloudflare/vite-plugin'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [\n    cloudflare({ viteEnvironment: { name: 'ssr' } }),\n    tanstackStart(),\n    viteReact(),\n  ],\n})\n```\n\n3. Add a `wrangler.jsonc` config file\n\n```json\n{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"tanstack-start-app\",\n  \"compatibility_date\": \"2025-09-02\",\n  \"compatibility_flags\": [\"nodejs_compat\"],\n  \"main\": \"@tanstack/react-start/server-entry\"\n}\n```\n\n4. Modify the scripts in your `package.json` file\n\n```json\n{\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    // ============ 👇 remove this line ============\n    \"start\": \"node .output/server/index.mjs\",\n    // ============ 👇 add these lines ============\n    \"preview\": \"vite preview\",\n    \"deploy\": \"npm run build && wrangler deploy\",\n    \"cf-typegen\": \"wrangler types\"\n  }\n}\n```\n\n5. Login with Wrangler to authenticate with your Cloudflare account.\n\n```bash\nnpx wrangler login\n```\n\nor if using pnpm:\n\n```bash\npnpm dlx wrangler login\n```\n\nTo check current user use `wrangler whoami`.\n\n6. Deploy\n\n```bash\npnpm run deploy\n```\n\nDeploy your application to Cloudflare Workers using their one-click deployment process, and you're ready to go!\n\nA full TanStack Start example for Cloudflare Workers is available [here](https://github.com/TanStack/router/tree/main/examples/react/start-basic-cloudflare).\n\n### Netlify ⭐ _Official Partner_\n\n<a href=\"https://www.netlify.com?utm_source=tanstack\" alt=\"Netlify Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/netlify-dark.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/netlify-light.svg\" width=\"280\">\n    <img alt=\"Netlify logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/netlify-light.svg\" width=\"280\">\n  </picture>\n</a>\n\nInstall and add the [`@netlify/vite-plugin-tanstack-start`](https://www.npmjs.com/package/@netlify/vite-plugin-tanstack-start) plugin, which configures your build for Netlify deployment and provides full Netlify production platform emulation in local dev:\n\n```bash\nnpm install --save-dev @netlify/vite-plugin-tanstack-start\n# or...\npnpm add --save-dev @netlify/vite-plugin-tanstack-start\n# or yarn, bun, etc.\n```\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport netlify from '@netlify/vite-plugin-tanstack-start' // ← add this\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart(),\n    netlify(), // ← add this (anywhere in the array is fine)\n    viteReact(),\n  ],\n})\n```\n\nFinally, use [Netlify CLI](https://developers.netlify.com/cli/) to deploy your app:\n\n```bash\nnpx netlify deploy\n```\n\nIf this is a new Netlify project, you'll be prompted to initialize it and build settings will be automatically configured for you.\n\nFor more detailed documentation, check out the full [TanStack Start on Netlify\ndocs](https://docs.netlify.com/build/frameworks/framework-setup-guides/tanstack-start/).\n\n#### Manual configuration\n\nAlternatively, if you prefer manual configuration, you can add a `netlify.toml` file to your project root:\n\n```toml\n[build]\n  command = \"vite build\"\n  publish = \"dist/client\"\n[dev]\n  command = \"vite dev\"\n  port = 3000\n```\n\nOr you can set the above settings directly [in the Netlify\napp](https://docs.netlify.com/build/configure-builds/overview/#build-settings).\n\n#### Other deployment methods\n\nNetlify also supports other deployment methods, such as [continuous deployment from a git repo\nhosted on GitHub, GitLab, or\nothers](https://docs.netlify.com/start/quickstarts/deploy-from-repository/), [starting from a\ntemplate](https://docs.netlify.com/start/quickstarts/deploy-from-template/), [deploying or\nimporting from an AI code generation\ntool](https://docs.netlify.com/start/quickstarts/deploy-from-ai-code-generation-tool/), and\n[more](https://docs.netlify.com/deploy/create-deploys/).\n\n### Railway ⭐ _Official Partner_\n\n<a href=\"https://railway.com?utm_source=tanstack\" alt=\"Railway Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/railway-dark.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/railway-light.svg\" width=\"280\">\n    <img alt=\"Railway logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/railway-light.svg\" width=\"280\">\n  </picture>\n</a>\n\nRailway provides instant deployments with zero configuration. Follow the [`Nitro`](#nitro) deployment instructions, then deploy to Railway:\n\n1. Push your code to a GitHub repository\n\n2. Connect your repository to Railway at [railway.com](https://railway.com?utm_source=tanstack)\n\n3. Railway will automatically detect your build settings and deploy your application\n\nRailway automatically provides:\n\n- **Automatic deployments** on every push to your repository\n- **Built-in databases** (Postgres, MySQL, Redis, MongoDB)\n- **Preview environments** for pull requests\n- **Automatic HTTPS** and custom domains\n\nFor more details, see [Railway's documentation](https://docs.railway.com).\n\n### Nitro\n\n[Nitro](https://nitro.build/) is an agnostic layer that allows you to deploy TanStack Start applications to [a wide range of hostings](https://nitro.build/deploy).\n\n**⚠️ The [`nitro/vite`](https://nitro.build/) plugin natively integrates with Vite Environments API as the underlying build tool for TanStack Start. It is still under active development and receives regular updates. Please report any issues you encounter with reproduction so they can be investigated.**\n\n1. Install `nitro`:\n\n```bash\nnpm install nitro\n```\n\n2. Add the `nitro/vite` plugin to your `vite.config.ts` file:\n\n```tsx\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport { nitro } from 'nitro/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [tanstackStart(), nitro(), viteReact()],\n})\n```\n\n#### Performance Tip: FastResponse\n\nIf you're deploying to Node.js with Nitro (which uses [srvx](https://srvx.h3.dev/) under the hood), you can get a ~5% throughput improvement by replacing the global `Response` constructor with srvx's optimized `FastResponse`.\n\nFirst, install srvx:\n\n```bash\nnpm install srvx\n```\n\nThen add this to your server entry point (`src/server.ts`):\n\n```ts\nimport { FastResponse } from 'srvx'\nglobalThis.Response = FastResponse\n```\n\nThis works because srvx's `FastResponse` includes an optimized `_toNodeResponse()` path that avoids the overhead of the standard Web `Response` to Node.js conversion. This optimization only applies to Node.js deployments using Nitro/h3/srvx.\n\n### Vercel\n\nFollow the [`Nitro`](#nitro) deployment instructions.\nDeploy your application to Vercel using their one-click deployment process, and you're ready to go!\n\n### Node.js / Docker\n\nFollow the [`Nitro`](#nitro) deployment instructions. Use the `node` command to start your application from the server from the build output files.\n\nEnsure `build` and `start` npm scripts are present in your `package.json` file:\n\n```json\n    \"build\": \"vite build\",\n    \"start\": \"node .output/server/index.mjs\"\n```\n\nThen you can run the following command to build your application:\n\n```sh\nnpm run build\n```\n\nYou can start your application by running:\n\n```sh\nnpm run start\n```\n\n### Bun\n\n> [!IMPORTANT]\n> Currently, the Bun specific deployment guidelines only work with React 19. If you are using React 18, please refer to the [Node.js](#nodejs--docker) deployment guidelines.\n\nMake sure that your `react` and `react-dom` packages are set to version 19.0.0 or higher in your `package.json` file. If not, run the following command to upgrade the packages:\n\n```sh\nbun install react@19 react-dom@19\n```\n\nFollow the [`Nitro`](#nitro) deployment instructions.\nDepending on how you invoke the build, you might need to set the `'bun'` preset in the Nitro configuration:\n\n```ts\n// vite.config.ts\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport { nitro } from 'nitro/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [tanstackStart(), nitro({ preset: 'bun' }), viteReact()],\n})\n```\n\n#### Production Server with Bun\n\nAlternatively, you can use a custom server implementation that leverages Bun's native APIs.\n\nWe provide a reference implementation that demonstrates one approach to building a production-ready Bun server. This example uses Bun-native functions for optimal performance and includes features like intelligent asset preloading and memory management.\n\n**This is a starting point - feel free to adapt it to your needs or simplify it for your use case.**\n\n**What this example demonstrates:**\n\n- Serving static assets using Bun's native file handling\n- Hybrid loading strategy (preload small files, serve large files on-demand)\n- Optional features like ETag support and Gzip compression\n- Production-ready caching headers\n\n**Quick Setup:**\n\n1. Copy the [`server.ts`](https://github.com/tanstack/router/blob/main/examples/react/start-bun/server.ts) file from the example repository to your project root (or use it as inspiration for your own implementation)\n\n2. Build your application:\n\n   ```sh\n   bun run build\n   ```\n\n3. Start the server:\n\n   ```sh\n   bun run server.ts\n   ```\n\n**Configuration (Optional):**\n\nThe reference server implementation includes several optional configuration options via environment variables. You can use these as-is, modify them, or remove features you don't need:\n\n```sh\n# Basic usage - just works out of the box\nbun run server.ts\n\n# Common configurations\nPORT=8080 bun run server.ts  # Custom port\nASSET_PRELOAD_VERBOSE_LOGGING=true bun run server.ts  # See what's happening\n```\n\n**Available Environment Variables:**\n\n| Variable                         | Description                                        | Default                                                                       |\n| -------------------------------- | -------------------------------------------------- | ----------------------------------------------------------------------------- |\n| `PORT`                           | Server port                                        | `3000`                                                                        |\n| `ASSET_PRELOAD_MAX_SIZE`         | Maximum file size to preload into memory (bytes)   | `5242880` (5MB)                                                               |\n| `ASSET_PRELOAD_INCLUDE_PATTERNS` | Comma-separated glob patterns for files to include | All files                                                                     |\n| `ASSET_PRELOAD_EXCLUDE_PATTERNS` | Comma-separated glob patterns for files to exclude | None                                                                          |\n| `ASSET_PRELOAD_VERBOSE_LOGGING`  | Enable detailed logging                            | `false`                                                                       |\n| `ASSET_PRELOAD_ENABLE_ETAG`      | Enable ETag generation                             | `true`                                                                        |\n| `ASSET_PRELOAD_ENABLE_GZIP`      | Enable Gzip compression                            | `true`                                                                        |\n| `ASSET_PRELOAD_GZIP_MIN_SIZE`    | Minimum file size for Gzip (bytes)                 | `1024` (1KB)                                                                  |\n| `ASSET_PRELOAD_GZIP_MIME_TYPES`  | MIME types eligible for Gzip                       | `text/,application/javascript,application/json,application/xml,image/svg+xml` |\n\n<details>\n<summary>Advanced configuration examples</summary>\n\n```sh\n# Optimize for minimal memory usage\nASSET_PRELOAD_MAX_SIZE=1048576 bun run server.ts\n\n# Preload only critical assets\nASSET_PRELOAD_INCLUDE_PATTERNS=\"*.js,*.css\" \\\nASSET_PRELOAD_EXCLUDE_PATTERNS=\"*.map,vendor-*\" \\\nbun run server.ts\n\n# Disable optional features\nASSET_PRELOAD_ENABLE_ETAG=false \\\nASSET_PRELOAD_ENABLE_GZIP=false \\\nbun run server.ts\n\n# Custom Gzip configuration\nASSET_PRELOAD_GZIP_MIN_SIZE=2048 \\\nASSET_PRELOAD_GZIP_MIME_TYPES=\"text/,application/javascript,application/json\" \\\nbun run server.ts\n```\n\n</details>\n\n**Example Output:**\n\n```txt\n📦 Loading static assets from ./dist/client...\n   Max preload size: 5.00 MB\n\n📁 Preloaded into memory:\n   /assets/index-a1b2c3d4.js           45.23 kB │ gzip:  15.83 kB\n   /assets/index-e5f6g7h8.css           12.45 kB │ gzip:   4.36 kB\n\n💾 Served on-demand:\n   /assets/vendor-i9j0k1l2.js          245.67 kB │ gzip:  86.98 kB\n\n✅ Preloaded 2 files (57.68 KB) into memory\n🚀 Server running at http://localhost:3000\n```\n\nFor a complete working example, check out the [TanStack Start + Bun example](https://github.com/TanStack/router/tree/main/examples/react/start-bun) in this repository.\n\n### Appwrite Sites\n\nWhen deploying to [Appwrite Sites](https://appwrite.io/products/sites), you'll need to complete a few steps:\n\n1. **Create a TanStack Start app** (or use an existing one)\n\n```bash\nnpx @tanstack/cli@latest create\n```\n\n2. **Push your project to a GitHub repository**\n\nCreate a [GitHub repository](https://github.com/new) and push your code.\n\n3. **Create an Appwrite project**\n\nHead to [Appwrite Cloud](https://cloud.appwrite.io) and sign up if you haven't already, then create your first project.\n\n4. **Deploy your site**\n\nIn your Appwrite project, navigate to the **Sites** page from the sidebar. Click on the **Create site**, select **Connect a repository**, connect your GitHub account and select your repository.\n\n1. Select the **production branch** and **root directory**\n2. Verify **TanStack Start** is selected as the framework\n3. Confirm the build settings:\n   - **Install command:** `npm install`\n   - **Build command:** `npm run build`\n   - **Output directory:** `./dist` (if you're using Nitro v2 or v3, this should be `./.output`)\n\n4. Add any required **environment variables**\n5. Click **Deploy**\n\nAfter successful deployment, click the **Visit site** button to see your deployed application.\n"
  },
  {
    "path": "docs/start/framework/react/guide/hydration-errors.md",
    "content": "---\nid: hydration-errors\ntitle: Hydration Errors\n---\n\n### Why it happens\n\n- **Mismatch**: Server HTML differs from client render during hydration\n- **Common causes**: `Intl` (locale/time zone), `Date.now()`, random IDs, responsive-only logic, feature flags, user prefs\n\n### Strategy 1 — Make server and client match\n\n- **Pick a deterministic locale/time zone on the server** and use the same on the client\n- **Source of truth**: cookie (preferred) or `Accept-Language` header\n- **Compute once on the server** and hydrate as initial state\n\n```tsx\n// src/start.ts\nimport { createStart, createMiddleware } from '@tanstack/react-start'\nimport {\n  getRequestHeader,\n  getCookie,\n  setCookie,\n} from '@tanstack/react-start/server'\n\nconst localeTzMiddleware = createMiddleware().server(async ({ next }) => {\n  const header = getRequestHeader('accept-language')\n  const headerLocale = header?.split(',')[0] || 'en-US'\n  const cookieLocale = getCookie('locale')\n  const cookieTz = getCookie('tz') // set by client later (see Strategy 2)\n\n  const locale = cookieLocale || headerLocale\n  const timeZone = cookieTz || 'UTC' // deterministic until client sends tz\n\n  // Persist locale for subsequent requests (optional)\n  setCookie('locale', locale, { path: '/', maxAge: 60 * 60 * 24 * 365 })\n\n  return next({ context: { locale, timeZone } })\n})\n\nexport const startInstance = createStart(() => ({\n  requestMiddleware: [localeTzMiddleware],\n}))\n```\n\n```tsx\n// src/routes/index.tsx (example)\nimport * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { getCookie } from '@tanstack/react-start/server'\n\nexport const getServerNow = createServerFn().handler(async () => {\n  const locale = getCookie('locale') || 'en-US'\n  const timeZone = getCookie('tz') || 'UTC'\n  return new Intl.DateTimeFormat(locale, {\n    dateStyle: 'medium',\n    timeStyle: 'short',\n    timeZone,\n  }).format(new Date())\n})\n\nexport const Route = createFileRoute('/')({\n  loader: () => getServerNow(),\n  component: () => {\n    const serverNow = Route.useLoaderData() as string\n    return <time dateTime={serverNow}>{serverNow}</time>\n  },\n})\n```\n\n### Strategy 2 — Let the client tell you its environment\n\n- On first visit, set a cookie with the client time zone; SSR uses `UTC` until then\n- Do this without risking mismatches\n\n```tsx\nimport * as React from 'react'\nimport { ClientOnly } from '@tanstack/react-router'\n\nfunction SetTimeZoneCookie() {\n  React.useEffect(() => {\n    const tz = Intl.DateTimeFormat().resolvedOptions().timeZone\n    document.cookie = `tz=${tz}; path=/; max-age=31536000`\n  }, [])\n  return null\n}\n\nexport function AppBoot() {\n  return (\n    <ClientOnly fallback={null}>\n      <SetTimeZoneCookie />\n    </ClientOnly>\n  )\n}\n```\n\n### Strategy 3 — Make it client-only\n\n- Wrap unstable UI in `<ClientOnly>` to avoid SSR and mismatches\n\n```tsx\nimport { ClientOnly } from '@tanstack/react-router'\n;<ClientOnly fallback={<span>—</span>}>\n  <RelativeTime ts={someTs} />\n</ClientOnly>\n```\n\n### Strategy 4 — Disable or limit SSR for the route\n\n- Use Selective SSR to avoid rendering the component on the server\n\n```tsx\nexport const Route = createFileRoute('/unstable')({\n  ssr: 'data-only', // or false\n  component: () => <ExpensiveViz />,\n})\n```\n\n### Strategy 5 — Last resort suppression\n\n- For small, known-different nodes, you can use React’s `suppressHydrationWarning`\n\n```tsx\n<time suppressHydrationWarning>{new Date().toLocaleString()}</time>\n```\n\n### Checklist\n\n- **Deterministic inputs**: locale, time zone, feature flags\n- **Prefer cookies** for client context; fallback to `Accept-Language`\n- **Use `<ClientOnly>`** for inherently dynamic UI\n- **Use Selective SSR** when server HTML cannot be stable\n- **Avoid blind suppression**; use `suppressHydrationWarning` sparingly\n\nSee also: [Execution Model](./execution-model.md), [Code Execution Patterns](./code-execution-patterns.md), [Selective SSR](./selective-ssr.md), [Server Functions](./server-functions.md)\n"
  },
  {
    "path": "docs/start/framework/react/guide/import-protection.md",
    "content": "---\nid: import-protection\ntitle: Import Protection\n---\n\n> **Experimental:** Import protection is experimental and subject to change.\n\nImport protection prevents server-only code from leaking into client bundles and client-only code from leaking into server bundles. It runs as a Vite plugin and is enabled by default in TanStack Start.\n\n## How It Works\n\nTanStack Start builds your application for two environments: **client** and **server**. Some code should only run in one environment. Import protection checks every import in your source files during development and build, and either blocks or mocks imports that cross environment boundaries.\n\nThere are two ways an import can be denied:\n\n- **File patterns** match on the resolved file path. By default, `*.server.*` files are denied in the client environment and `*.client.*` files are denied in the server environment.\n- **Specifier patterns** match on the raw import string. By default, `@tanstack/react-start/server` is denied in the client environment.\n\n## Default Rules\n\nImport protection is enabled out of the box with these defaults:\n\n| Setting            | Default                                         |\n| ------------------ | ----------------------------------------------- |\n| `behavior` (dev)   | `'mock'` -- warn and replace with a mock module |\n| `behavior` (build) | `'error'` -- fail the build                     |\n| `log`              | `'once'` -- deduplicate repeated violations     |\n| Scope              | Files inside Start's `srcDirectory`             |\n\n**Client environment denials:**\n\n- Files matching `**/*.server.*`\n- The specifier `@tanstack/react-start/server`\n- Excluded from file checks: `**/node_modules/**`\n\n**Server environment denials:**\n\n- Files matching `**/*.client.*`\n- Excluded from file checks: `**/node_modules/**`\n\nBy default, files inside `node_modules` are excluded from resolved-target deny checks via the `excludeFiles` option. This prevents false positives from third-party packages whose resolved filenames contain `.client.` or `.server.`. If you need to check third-party files, set `excludeFiles: []` on the relevant environment — see [Configuring Deny Rules](#configuring-deny-rules).\n\nThese defaults mean you can use the `.server.ts` / `.client.ts` naming convention to restrict files to a single environment without any configuration. To also deny entire directories (e.g. `server/` or `client/`), add them via `files` in your [deny rules configuration](#configuring-deny-rules) — for example `files: ['**/*.server.*', '**/server/**']` for the client environment.\n\n## File Markers\n\nYou can explicitly mark a module as server-only or client-only by adding a side-effect import at the top of the file:\n\n```ts\n// src/lib/secrets.ts\nimport '@tanstack/react-start/server-only'\n\nexport const API_KEY = process.env.API_KEY\n```\n\n```ts\n// src/lib/local-storage.ts\nimport '@tanstack/react-start/client-only'\n\nexport function savePreferences(prefs: Record<string, string>) {\n  localStorage.setItem('prefs', JSON.stringify(prefs))\n}\n```\n\nWhen the plugin sees a marker import, it records the file as restricted. If that file is later imported from the wrong environment, the import is denied. Both markers in the same file is always an error.\n\nMarkers are useful when a file doesn't follow the `.server.*` / `.client.*` naming convention but still contains environment-specific code.\n\n## Behavior Modes\n\nThe `behavior` option controls what happens when a violation is detected:\n\n- **`'error'`** -- The build fails with a detailed error message. This is the default for production builds.\n- **`'mock'`** -- The import is replaced with a mock module that returns safe proxy values. A warning is logged but the build continues. This is the default during development.\n\nMock mode is useful during development because it lets you keep working even when your import graph has violations. The mock module returns a recursive Proxy, so any property access or function call on a mocked import returns another mock instead of crashing.\n\nYou can override the defaults:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      importProtection: {\n        // Always error, even in dev\n        behavior: 'error',\n      },\n    }),\n  ],\n})\n```\n\nOr set different behaviors per mode:\n\n```ts\nimportProtection: {\n  behavior: {\n    dev: 'mock',\n    build: 'error',\n  },\n}\n```\n\n## Configuring Deny Rules\n\nYou can add your own deny rules on top of the defaults. Rules are specified per environment using glob patterns (via [picomatch](https://github.com/micromatch/picomatch)) or regular expressions.\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      importProtection: {\n        client: {\n          // Block specific npm packages from the client bundle\n          specifiers: ['@prisma/client', 'bcrypt'],\n          // Block files in a custom directory\n          files: ['**/db/**'],\n        },\n        server: {\n          // Block browser-only libraries from the server\n          specifiers: ['localforage'],\n        },\n      },\n    }),\n  ],\n})\n```\n\n### Checking third-party packages\n\nBy default, resolved files inside `node_modules` are excluded from resolved-target deny checks (file-pattern and marker checks). This avoids false positives from packages that happen to use `.client.` or `.server.` in their distribution filenames. If you want to re-enable checking for a specific environment, set `excludeFiles` to an empty array:\n\n```ts\nimportProtection: {\n  server: {\n    // Re-enable file-pattern checking for node_modules in the server environment\n    excludeFiles: [],\n  },\n}\n```\n\nWhen you provide `excludeFiles`, it **fully replaces** the default (`['**/node_modules/**']`). To exclude additional paths while still skipping `node_modules`, include both:\n\n```ts\nimportProtection: {\n  client: {\n    excludeFiles: ['**/node_modules/**', '**/vendor/**'],\n  },\n}\n```\n\n## Scoping and Exclusions\n\nBy default, import protection only checks files inside Start's `srcDirectory`. You can change the scope with `include`, `exclude`, and `ignoreImporters`:\n\n```ts\nimportProtection: {\n  // Only check files matching these patterns\n  include: ['src/**'],\n  // Skip checking these files\n  exclude: ['src/generated/**'],\n  // Ignore violations when these files are the importer\n  ignoreImporters: ['**/*.test.ts', '**/*.spec.ts'],\n}\n```\n\n## Reading Violation Traces\n\nWhen a violation is detected, the plugin shows a diagnostic message with the full import chain that led to the violation, a code snippet highlighting the offending line, and actionable suggestions.\n\n### Server-only code in the client\n\nThis example shows a `*.server.*` file being imported transitively in the client environment:\n\n```text\n[import-protection] Import denied in client environment\n\n  Denied by file pattern: **/*.server.*\n  Importer: src/features/auth/session.ts:5:27\n  Import: \"../db/queries.server\"\n  Resolved: src/db/queries.server.ts\n\n  Trace:\n    1. src/routes/index.tsx:2:34 (entry) (import \"../features/auth/session\")\n    2. src/features/auth/session.ts:5:27 (import \"../db/queries.server\")\n\n  Code:\n     3 | import { logger } from '../utils/logger'\n     4 |\n  >  5 | import { getUsers } from '../db/queries.server'\n       |                           ^\n     6 |\n     7 | export function loadAuth() {\n\n  src/features/auth/session.ts:5:27\n\n  Suggestions:\n    - Wrap in createServerFn().handler(() => ...) to make it callable from the client via RPC\n    - Wrap in createServerOnlyFn(() => ...) if it should not be callable from the client\n    - Use createIsomorphicFn().client(() => ...).server(() => ...) for environment-specific implementations\n    - Split the file so client-safe exports are separate\n```\n\n### Client-only code on the server\n\nThis example shows a `*.client.*` file imported in the SSR environment. Because the code snippet contains JSX, the `<ClientOnly>` suggestion is shown first:\n\n```text\n[import-protection] Import denied in server environment\n\n  Denied by file pattern: **/*.client.*\n  Importer: src/components/dashboard.tsx:3:30\n  Import: \"./browser-widget.client\"\n  Resolved: src/components/browser-widget.client.tsx\n\n  Trace:\n    1. src/routes/dashboard.tsx:1:32 (entry) (import \"../components/dashboard\")\n    2. src/components/dashboard.tsx:3:30 (import \"./browser-widget.client\")\n\n  Code:\n     1 | import { BrowserWidget } from './browser-widget.client'\n     2 |\n  >  3 | export function Dashboard() { return <BrowserWidget /> }\n       |                              ^\n     4 |\n\n  src/components/dashboard.tsx:3:30\n\n  Suggestions:\n    - Wrap in <ClientOnly fallback={...}>...</ClientOnly> to render only after hydration\n    - Wrap in createClientOnlyFn(() => ...) if it should only run in the browser\n    - Use createIsomorphicFn().client(() => ...).server(() => ...) for environment-specific implementations\n    - Split the file so server-safe exports are separate\n```\n\n### How to read the output\n\nEach violation message has these sections:\n\n| Section                          | Description                                                                                                                                                      |\n| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| **Header**                       | Environment type where the violation occurred (`\"client\"` or `\"server\"`)                                                                                         |\n| **Denied by**                    | The rule that matched: file pattern, specifier pattern, or marker                                                                                                |\n| **Importer / Import / Resolved** | The importing file (with `file:line:col`), the raw import string, and the resolved target path                                                                   |\n| **Trace**                        | The full import chain from the entry point to the denied import. Each step shows `file:line:col` and the import specifier used. Step 1 is always the entry point |\n| **Code**                         | A source code snippet with a `>` marker on the offending line and a `^` caret pointing to the exact column                                                       |\n| **Suggestions**                  | Actionable steps to fix the violation, tailored to the direction (server-in-client vs client-in-server)                                                          |\n\nThe trace reads top-to-bottom, from the entry point to the denied module. This helps you find where the chain starts so you can restructure your code.\n\n## Common Pitfall: Why Some Imports Stay Alive\n\nIt can look like Start \"should have removed that server-only import\". The important detail is that this is handled by the Start compiler:\n\n1. The compiler rewrites environment-specific _implementations_ for the current target (client or server).\n2. As part of that compilation, it prunes code and removes imports that become unused after the rewrite.\n\nIn practice, when the compiler replaces a `createServerFn()` handler with a client RPC stub, it can also remove server-only imports that were only used by the removed implementation.\n\nExample (client build):\n\n```ts\nimport { getUsers } from './db/queries.server'\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const fetchUsers = createServerFn().handler(async () => {\n  return getUsers()\n})\n```\n\nConceptually, the client build output becomes something like (simplified):\n\n```ts\nimport { createClientRpc } from '@tanstack/react-start/client-rpc'\nimport { createServerFn } from '@tanstack/react-start'\n\n// Compiler replaces the handler with a client RPC stub.\n// (The id is generated by the compiler; treat it as an opaque identifier.)\nexport const fetchUsers = TanStackStart.createServerFn({\n  method: 'GET',\n}).handler(createClientRpc('sha256:deadbeef...'))\n\n// The server-only import is removed by the compiler.\n```\n\nIf the import \"leaks\" into code that survives compilation, it stays live and import protection will still flag it:\n\n```ts\nimport { getUsers } from './db/queries.server'\nimport { createServerFn } from '@tanstack/react-start'\n\n// This is fine -- the server implementation is removed for the client build\nexport const fetchUsers = createServerFn().handler(async () => {\n  return getUsers()\n})\n\n// This keeps the import alive in the client build\nexport function leakyHelper() {\n  return getUsers() // referenced outside server boundary\n}\n```\n\nWhen this happens, you have a few options depending on what you want `leakyHelper` to be:\n\nOption A: split the file so client code cannot accidentally import the leak\n\n```ts\n// src/users.server.ts\nimport { getUsers } from './db/queries.server'\nimport { createServerFn } from '@tanstack/react-start'\n\n// Safe to import from client code (compiler rewrites the handler)\nexport const fetchUsers = createServerFn().handler(async () => {\n  return getUsers()\n})\n```\n\n```ts\n// src/users-leaky.server.ts\nimport { getUsers } from './db/queries.server'\n\n// Server-only helper; do not import this from client code\nexport function leakyHelper() {\n  return getUsers()\n}\n```\n\nOption B: keep it in the same file, but wrap the helper in `createServerOnlyFn`\n\nThis is useful when the helper should exist, but must never run on the client. Make sure the server-only import is only referenced inside the `createServerOnlyFn(() => ...)` callback:\n\n```ts\nimport { createServerOnlyFn } from '@tanstack/react-start'\nimport { getUsers } from './db/queries.server'\n\nexport const leakyHelper = createServerOnlyFn(() => {\n  return getUsers()\n})\n```\n\nOn the client, the compiler output is effectively:\n\n```ts\nexport const leakyHelper = () => {\n  throw new Error(\n    'createServerOnlyFn() functions can only be called on the server!',\n  )\n}\n```\n\nNotice that the `createServerOnlyFn` import is gone, and the server-only `getUsers` import is also gone because it is no longer referenced after compilation.\n\nThe same idea applies to `createIsomorphicFn()`: the compiler removes the non-target implementation and prunes anything that becomes unused.\n\nIf you see an import-protection violation for a file you expected to be \"compiled away\", check whether the import is referenced outside a compiler-recognized environment boundary (or is otherwise kept live by surviving code).\n\n## False Positives: Dev vs Build\n\nIn **build mode**, the plugin defers violation checks until after tree-shaking. If an import is eliminated from the final bundle (e.g., a barrel re-exports a `.server` module but no client code actually uses that export), no violation is reported. This means build-time violations are definitive — if the build flags it, the import truly survived.\n\nIn **dev mode**, there is no tree-shaking. The plugin uses graph reachability to filter violations, but it cannot determine whether individual bindings are unused. This means barrel re-exports of `.server` or marker-protected modules may produce warnings even when the server-only exports would be tree-shaken away in production. These dev warnings are informational — run a build to confirm whether the violation is real.\n\nThe same applies to marker-protected files (`import '@tanstack/react-start/server-only'`). If a marked file is re-exported through a barrel but never consumed by client code, the build correctly suppresses the violation while dev may still warn.\n\n## The `onViolation` Callback\n\nYou can hook into violations for custom reporting or to override the verdict:\n\n```ts\nimportProtection: {\n  onViolation: async (info) => {\n    // info.env -- environment name (e.g. 'client', 'ssr', ...)\n    // info.envType -- 'client' or 'server'\n    // info.type -- 'specifier', 'file', or 'marker'\n    // info.specifier -- the raw import string\n    // info.importer -- absolute path of the importing file\n    // info.resolved -- absolute path of the resolved target (if available)\n    // info.trace -- array of { file, line?, column?, specifier? } objects\n    // info.snippet -- { lines, location } with the source code snippet (if available)\n    // info.message -- the formatted diagnostic message\n\n    // Return false (or Promise<false>) to allow this specific import (override the denial)\n    if (info.specifier === 'some-special-case') {\n      return false\n    }\n  },\n}\n```\n\n## Disabling Import Protection\n\nTo disable import protection entirely:\n\n```ts\nimportProtection: {\n  enabled: false,\n}\n```\n\n## Full Configuration Reference\n\n```ts\ninterface ImportProtectionOptions {\n  enabled?: boolean\n  behavior?:\n    | 'error'\n    | 'mock'\n    | { dev?: 'error' | 'mock'; build?: 'error' | 'mock' }\n  log?: 'once' | 'always'\n  include?: Array<string | RegExp>\n  exclude?: Array<string | RegExp>\n  ignoreImporters?: Array<string | RegExp>\n  maxTraceDepth?: number\n  client?: {\n    specifiers?: Array<string | RegExp>\n    files?: Array<string | RegExp>\n    excludeFiles?: Array<string | RegExp>\n  }\n  server?: {\n    specifiers?: Array<string | RegExp>\n    files?: Array<string | RegExp>\n    excludeFiles?: Array<string | RegExp>\n  }\n  onViolation?: (\n    info: ViolationInfo,\n  ) => boolean | void | Promise<boolean | void>\n}\n```\n\n| Option                | Type                 | Default                           | Description                                                                                                                                                           |\n| --------------------- | -------------------- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `enabled`             | `boolean`            | `true`                            | Set to `false` to disable the plugin                                                                                                                                  |\n| `behavior`            | `string \\| object`   | `{ dev: 'mock', build: 'error' }` | What to do on violation                                                                                                                                               |\n| `log`                 | `'once' \\| 'always'` | `'once'`                          | Whether to deduplicate repeated violations                                                                                                                            |\n| `include`             | `Pattern[]`          | Start's `srcDirectory`            | Only check importers matching these patterns                                                                                                                          |\n| `exclude`             | `Pattern[]`          | `[]`                              | Skip importers matching these patterns                                                                                                                                |\n| `ignoreImporters`     | `Pattern[]`          | `[]`                              | Ignore violations from these importers                                                                                                                                |\n| `maxTraceDepth`       | `number`             | `20`                              | Maximum depth for import traces                                                                                                                                       |\n| `client`              | `object`             | See defaults above                | Additional deny rules for the client environment                                                                                                                      |\n| `client.specifiers`   | `Pattern[]`          | Framework server specifiers       | Specifier patterns denied in the client environment (additive with defaults)                                                                                          |\n| `client.files`        | `Pattern[]`          | `['**/*.server.*']`               | File patterns denied in the client environment (replaces defaults)                                                                                                    |\n| `client.excludeFiles` | `Pattern[]`          | `['**/node_modules/**']`          | Resolved files matching these patterns skip resolved-target checks (file-pattern + marker) (replaces defaults)                                                        |\n| `server`              | `object`             | See defaults above                | Additional deny rules for the server environment                                                                                                                      |\n| `server.specifiers`   | `Pattern[]`          | `[]`                              | Specifier patterns denied in the server environment (replaces defaults; defaults for `server.specifiers` are `[]`, so unlike `client.specifiers` this isn't additive) |\n| `server.files`        | `Pattern[]`          | `['**/*.client.*']`               | File patterns denied in the server environment (replaces defaults)                                                                                                    |\n| `server.excludeFiles` | `Pattern[]`          | `['**/node_modules/**']`          | Resolved files matching these patterns skip resolved-target checks (file-pattern + marker) (replaces defaults)                                                        |\n| `onViolation`         | `function`           | `undefined`                       | Callback invoked on every violation                                                                                                                                   |\n"
  },
  {
    "path": "docs/start/framework/react/guide/isr.md",
    "content": "---\nid: isr\ntitle: Incremental Static Regeneration (ISR)\n---\n\nIncremental Static Regeneration (ISR) allows you to serve statically generated content from a CDN while periodically regenerating it in the background. This gives you the performance benefits of static sites with the freshness of dynamic content.\n\n## How ISR Works in TanStack Start\n\nTanStack Start's approach to ISR is flexible and leverages standard HTTP cache headers that work with any CDN. Unlike framework-specific ISR implementations, this approach gives you full control over caching behavior at both the page and data level.\n\nThe core concept is simple:\n\n1. **Static Prerendering**: Pages are generated at build time\n2. **CDN Caching**: Cache headers control how long CDNs cache the HTML\n3. **Revalidation**: After the cache expires, the next request triggers regeneration\n4. **Stale-While-Revalidate**: Serve stale content while fetching fresh data in the background\n\n## Cache Header Strategies\n\n### Time-Based Revalidation\n\nThe most common ISR pattern uses the `Cache-Control` header with `max-age` and `s-maxage` directives:\n\n```tsx\n// vite.config.ts\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      prerender: {\n        routes: ['/blog', '/blog/posts/*'],\n        crawlLinks: true,\n      },\n    }),\n  ],\n})\n```\n\n```tsx\n// routes/blog/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/blog/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  headers: () => ({\n    // Cache at CDN for 1 hour, allow stale content for up to 1 day\n    'Cache-Control':\n      'public, max-age=3600, s-maxage=3600, stale-while-revalidate=86400',\n  }),\n})\n\nexport default function BlogPost() {\n  const { post } = Route.useLoaderData()\n  return (\n    <article>\n      <h1>{post.title}</h1>\n      <div>{post.content}</div>\n    </article>\n  )\n}\n```\n\n### Understanding Cache-Control Directives\n\n- **`public`**: Response can be cached by any cache (CDN, browser, etc.)\n- **`max-age=3600`**: Content is fresh for 3600 seconds (1 hour)\n- **`s-maxage=3600`**: Overrides max-age for shared caches (CDNs)\n- **`stale-while-revalidate=86400`**: Serve stale content while revalidating in background for up to 24 hours\n- **`immutable`**: Content never changes (use for hash-based assets)\n\n## ISR with Server Functions\n\nServer functions can also set cache headers for dynamic data endpoints:\n\n```tsx\n// routes/api/products/$productId.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/products/$productId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        const product = await db.products.findById(params.productId)\n\n        return Response.json(\n          { product },\n          {\n            headers: {\n              'Cache-Control':\n                'public, max-age=300, stale-while-revalidate=600',\n              'CDN-Cache-Control': 'max-age=3600', // Cloudflare-specific\n            },\n          },\n        )\n      },\n    },\n  },\n})\n```\n\n### Using Middleware for Cache Headers\n\nFor API routes, you can use middleware to set cache headers:\n\n```tsx\n// routes/api/products/$productId.ts\nimport { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst cacheMiddleware = createMiddleware().server(async ({ next }) => {\n  const result = await next()\n\n  // Add cache headers to the response\n  result.response.headers.set(\n    'Cache-Control',\n    'public, max-age=3600, stale-while-revalidate=86400',\n  )\n\n  return result\n})\n\nexport const Route = createFileRoute('/api/products/$productId')({\n  server: {\n    middleware: [cacheMiddleware],\n    handlers: {\n      GET: async ({ params }) => {\n        const product = await db.products.findById(params.productId)\n        return Response.json({ product })\n      },\n    },\n  },\n})\n```\n\nFor page routes, it's simpler to use the `headers` property directly:\n\n```tsx\n// routes/blog/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/blog/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  headers: () => ({\n    'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400',\n  }),\n})\n```\n\n## On-Demand Revalidation\n\nWhile time-based revalidation works well for most cases, you may need to invalidate specific pages immediately (e.g., when content is updated):\n\n```tsx\n// routes/api/revalidate.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/revalidate')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const { path, secret } = await request.json()\n\n        // Verify secret token\n        if (secret !== process.env.REVALIDATE_SECRET) {\n          return Response.json({ error: 'Invalid token' }, { status: 401 })\n        }\n\n        // Trigger CDN purge via your CDN's API\n        await fetch(\n          `https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/purge_cache`,\n          {\n            method: 'POST',\n            headers: {\n              Authorization: `Bearer ${CF_API_TOKEN}`,\n              'Content-Type': 'application/json',\n            },\n            body: JSON.stringify({\n              files: [`https://yoursite.com${path}`],\n            }),\n          },\n        )\n\n        return Response.json({ revalidated: true })\n      },\n    },\n  },\n})\n```\n\n## CDN-Specific Configuration\n\n### Cloudflare Workers\n\nCloudflare respects standard `Cache-Control` headers and provides additional control:\n\n```tsx\nexport const Route = createFileRoute('/products/$id')({\n  headers: () => ({\n    'Cache-Control': 'public, max-age=3600',\n    // Cloudflare-specific header for finer control\n    'CDN-Cache-Control': 'max-age=7200',\n  }),\n})\n```\n\n### Netlify\n\nNetlify uses `Cache-Control` headers and also supports `_headers` files:\n\n```plaintext\n# public/_headers\n/blog/*\n  Cache-Control: public, max-age=3600, stale-while-revalidate=86400\n\n/api/*\n  Cache-Control: public, max-age=300\n```\n\n### Vercel\n\nWhen deploying to Vercel, use their Edge Network cache headers:\n\n```tsx\nexport const Route = createFileRoute('/posts/$id')({\n  headers: () => ({\n    'Cache-Control': 'public, s-maxage=3600, stale-while-revalidate=86400',\n  }),\n})\n```\n\n## Combining ISR with Client-Side Caching\n\nTanStack Router's built-in cache control works alongside CDN caching:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    return fetchPost(params.postId)\n  },\n  // CDN caching (via headers)\n  headers: () => ({\n    'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400',\n  }),\n  // Client-side caching (via TanStack Router)\n  staleTime: 60_000, // Consider data fresh for 60 seconds on client\n  gcTime: 5 * 60_000, // Keep in memory for 5 minutes\n})\n```\n\nThis creates a multi-tier caching strategy:\n\n1. **CDN Edge**: 1 hour cache, stale-while-revalidate for 24 hours\n2. **Client**: 60 seconds of fresh data, 5 minutes in memory\n\n## Common ISR Patterns\n\n### Blog Posts\n\n```tsx\nexport const Route = createFileRoute('/blog/$slug')({\n  loader: async ({ params }) => fetchPost(params.slug),\n  headers: () => ({\n    // Cache for 1 hour, allow stale for 7 days\n    'Cache-Control': 'public, max-age=3600, stale-while-revalidate=604800',\n  }),\n  staleTime: 5 * 60_000, // 5 minutes client-side\n})\n```\n\n### E-commerce Product Pages\n\n```tsx\nexport const Route = createFileRoute('/products/$id')({\n  loader: async ({ params }) => fetchProduct(params.id),\n  headers: () => ({\n    // Shorter cache due to inventory changes\n    'Cache-Control': 'public, max-age=300, stale-while-revalidate=3600',\n  }),\n  staleTime: 30_000, // 30 seconds client-side\n})\n```\n\n### Marketing Landing Pages\n\n```tsx\nexport const Route = createFileRoute('/landing/$campaign')({\n  loader: async ({ params }) => fetchCampaign(params.campaign),\n  headers: () => ({\n    // Long cache for stable content\n    'Cache-Control': 'public, max-age=86400, stale-while-revalidate=604800',\n  }),\n  staleTime: 60 * 60_000, // 1 hour client-side\n})\n```\n\n### User-Specific Pages\n\n```tsx\nexport const Route = createFileRoute('/dashboard')({\n  loader: async () => fetchUserData(),\n  headers: () => ({\n    // Private cache, no CDN caching\n    'Cache-Control': 'private, max-age=60',\n  }),\n  staleTime: 30_000,\n})\n```\n\n## Best Practices\n\n### 1. Start Conservative\n\nBegin with shorter cache times and increase as you understand your content update patterns:\n\n```tsx\n// Start here\n'Cache-Control': 'public, max-age=300, stale-while-revalidate=600'\n\n// Then move to\n'Cache-Control': 'public, max-age=3600, stale-while-revalidate=86400'\n```\n\n### 2. Use ETags for Validation\n\nETags help CDNs efficiently revalidate content:\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\nimport crypto from 'crypto'\n\nconst etagMiddleware = createMiddleware().server(async ({ next }) => {\n  const result = await next()\n\n  // Generate ETag from response content\n  const etag = crypto\n    .createHash('md5')\n    .update(JSON.stringify(result.data))\n    .digest('hex')\n\n  result.response.headers.set('ETag', `\"${etag}\"`)\n\n  return result\n})\n```\n\n### 3. Vary Cache by Query Parameters\n\nWhen content varies by query params, include them in cache keys:\n\n```tsx\nexport const Route = createFileRoute('/search')({\n  headers: () => ({\n    'Cache-Control': 'public, max-age=300',\n    Vary: 'Accept, Accept-Encoding',\n  }),\n})\n```\n\n### 4. Monitor Cache Hit Rates\n\nTrack CDN performance to optimize cache times:\n\n```tsx\nconst cacheMonitoringMiddleware = createMiddleware().server(\n  async ({ next }) => {\n    const result = await next()\n\n    // Log cache status (from CDN headers)\n    console.log('Cache Status:', result.response.headers.get('cf-cache-status'))\n\n    return result\n  },\n)\n```\n\n### 5. Combine with Static Prerendering\n\nPrerender at build time for instant first load, then use ISR for updates:\n\n```tsx\n// vite.config.ts\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      prerender: {\n        routes: ['/blog', '/blog/posts/*'],\n        crawlLinks: true,\n      },\n    }),\n  ],\n})\n```\n\n## Debugging ISR\n\n### Check Cache Headers\n\nUse browser DevTools or curl to inspect cache headers:\n\n```bash\ncurl -I https://yoursite.com/blog/my-post\n\n# Look for:\n# Cache-Control: public, max-age=3600, stale-while-revalidate=86400\n# Age: 1234 (time in cache)\n# X-Cache: HIT (from CDN)\n```\n\n### Test Revalidation\n\nForce cache misses to test regeneration:\n\n```bash\n# Cloudflare: Bypass cache\ncurl -H \"Cache-Control: no-cache\" https://yoursite.com/page\n\n# Or use CDN-specific cache purge APIs\n```\n\n### Monitor Performance\n\nTrack key metrics:\n\n- **Cache Hit Rate**: Percentage of requests served from cache\n- **Revalidation Time**: Time to regenerate stale content\n- **Time to First Byte (TTFB)**: Should be low for cached content\n\n## Related Resources\n\n- [Static Prerendering](./static-prerendering.md) - Build-time page generation\n- [Hosting](./hosting.md) - CDN deployment configurations\n- [Server Functions](./server-functions.md) - Creating dynamic data endpoints\n- [Data Loading](../../../../router/guide/data-loading.md) - Client-side cache control\n- [Middleware](./middleware.md) - Request/response customization\n"
  },
  {
    "path": "docs/start/framework/react/guide/llmo.md",
    "content": "---\nid: llmo\ntitle: LLM Optimization (LLMO)\n---\n\n> [!NOTE]\n> Looking for traditional search engine optimization? See the [SEO guide](./seo).\n\n## What is LLMO?\n\n**LLM Optimization (LLMO)**, also known as **AI Optimization (AIO)** or **Generative Engine Optimization (GEO)**, is the practice of structuring your content and data so that AI systems—like ChatGPT, Claude, Perplexity, and other LLM-powered tools—can accurately understand, cite, and recommend your content.\n\nWhile traditional SEO focuses on ranking in search engine results pages, LLMO focuses on being accurately represented in AI-generated responses. As more users get information through AI assistants rather than traditional search, this is becoming increasingly important.\n\n## How LLMO Differs from SEO\n\n| Aspect             | SEO                         | LLMO                                 |\n| ------------------ | --------------------------- | ------------------------------------ |\n| **Goal**           | Rank in search results      | Be cited/recommended by AI           |\n| **Audience**       | Search engine crawlers      | LLM training & retrieval systems     |\n| **Key signals**    | Links, keywords, page speed | Structured data, clarity, authority  |\n| **Content format** | Optimized for snippets      | Optimized for extraction & synthesis |\n\nThe good news: many LLMO best practices overlap with SEO. Clear structure, authoritative content, and good metadata help both.\n\n## What TanStack Start Provides\n\nTanStack Start's features that support LLMO:\n\n- **Server-Side Rendering** - Ensures AI crawlers see fully rendered content\n- **Structured Data** - JSON-LD support for machine-readable content\n- **Document Head Management** - Meta tags that AI systems can parse\n- **Server Routes** - Create machine-readable endpoints (APIs, feeds)\n\n## Structured Data for AI\n\nStructured data using schema.org vocabulary helps AI systems understand your content's meaning and context. This is perhaps the most important LLMO technique.\n\n### Article Schema\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [{ title: loaderData.post.title }],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'Article',\n          headline: loaderData.post.title,\n          description: loaderData.post.excerpt,\n          image: loaderData.post.coverImage,\n          author: {\n            '@type': 'Person',\n            name: loaderData.post.author.name,\n            url: loaderData.post.author.url,\n          },\n          publisher: {\n            '@type': 'Organization',\n            name: 'My Company',\n            logo: {\n              '@type': 'ImageObject',\n              url: 'https://myapp.com/logo.png',\n            },\n          },\n          datePublished: loaderData.post.publishedAt,\n          dateModified: loaderData.post.updatedAt,\n        }),\n      },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n### Product Schema\n\nFor e-commerce, product schema helps AI assistants provide accurate product information:\n\n```tsx\nexport const Route = createFileRoute('/products/$productId')({\n  loader: async ({ params }) => {\n    const product = await fetchProduct(params.productId)\n    return { product }\n  },\n  head: ({ loaderData }) => ({\n    meta: [{ title: loaderData.product.name }],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'Product',\n          name: loaderData.product.name,\n          description: loaderData.product.description,\n          image: loaderData.product.images,\n          brand: {\n            '@type': 'Brand',\n            name: loaderData.product.brand,\n          },\n          offers: {\n            '@type': 'Offer',\n            price: loaderData.product.price,\n            priceCurrency: 'USD',\n            availability: loaderData.product.inStock\n              ? 'https://schema.org/InStock'\n              : 'https://schema.org/OutOfStock',\n          },\n          aggregateRating: loaderData.product.rating\n            ? {\n                '@type': 'AggregateRating',\n                ratingValue: loaderData.product.rating,\n                reviewCount: loaderData.product.reviewCount,\n              }\n            : undefined,\n        }),\n      },\n    ],\n  }),\n  component: ProductPage,\n})\n```\n\n### Organization and Website Schema\n\nAdd organization schema to your root route for site-wide context:\n\n```tsx\n// src/routes/__root.tsx\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n    ],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'WebSite',\n          name: 'My App',\n          url: 'https://myapp.com',\n          publisher: {\n            '@type': 'Organization',\n            name: 'My Company',\n            url: 'https://myapp.com',\n            logo: 'https://myapp.com/logo.png',\n            sameAs: [\n              'https://twitter.com/mycompany',\n              'https://github.com/mycompany',\n            ],\n          },\n        }),\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n```\n\n### FAQ Schema\n\nFAQ schema is particularly effective for LLMO—AI systems often extract Q&A pairs:\n\n```tsx\nexport const Route = createFileRoute('/faq')({\n  loader: async () => {\n    const faqs = await fetchFAQs()\n    return { faqs }\n  },\n  head: ({ loaderData }) => ({\n    meta: [{ title: 'Frequently Asked Questions' }],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'FAQPage',\n          mainEntity: loaderData.faqs.map((faq) => ({\n            '@type': 'Question',\n            name: faq.question,\n            acceptedAnswer: {\n              '@type': 'Answer',\n              text: faq.answer,\n            },\n          })),\n        }),\n      },\n    ],\n  }),\n  component: FAQPage,\n})\n```\n\n## Machine-Readable Endpoints\n\nCreate API endpoints that AI systems and developers can consume directly:\n\n```ts\n// src/routes/api/products.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/products')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        const url = new URL(request.url)\n        const category = url.searchParams.get('category')\n\n        const products = await fetchProducts({ category })\n\n        return Response.json({\n          '@context': 'https://schema.org',\n          '@type': 'ItemList',\n          itemListElement: products.map((product, index) => ({\n            '@type': 'ListItem',\n            position: index + 1,\n            item: {\n              '@type': 'Product',\n              name: product.name,\n              description: product.description,\n              url: `https://myapp.com/products/${product.id}`,\n            },\n          })),\n        })\n      },\n    },\n  },\n})\n```\n\n## Content Best Practices\n\nBeyond technical implementation, content structure matters for LLMO:\n\n### Clear, Factual Statements\n\nAI systems extract factual claims. Make your key information explicit:\n\n```tsx\n// Good: Clear, extractable facts\nfunction ProductDetails({ product }) {\n  return (\n    <article>\n      <h1>{product.name}</h1>\n      <p>\n        {product.name} is a {product.category} made by {product.brand}. It costs\n        ${product.price} and is available in {product.colors.join(', ')}.\n      </p>\n    </article>\n  )\n}\n```\n\n### Hierarchical Structure\n\nUse proper heading hierarchy—AI systems use this to understand content organization:\n\n```tsx\nfunction DocumentationPage() {\n  return (\n    <article>\n      <h1>Getting Started with TanStack Start</h1>\n\n      <section>\n        <h2>Installation</h2>\n        <p>Install TanStack Start using npm...</p>\n\n        <h3>Prerequisites</h3>\n        <p>You'll need Node.js 18 or later...</p>\n      </section>\n\n      <section>\n        <h2>Configuration</h2>\n        <p>Configure your app in vite.config.ts...</p>\n      </section>\n    </article>\n  )\n}\n```\n\n### Authoritative Attribution\n\nInclude author information and sources—AI systems consider authority signals:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  head: ({ loaderData }) => ({\n    meta: [\n      { title: loaderData.post.title },\n      { name: 'author', content: loaderData.post.author.name },\n      {\n        property: 'article:author',\n        content: loaderData.post.author.profileUrl,\n      },\n      {\n        property: 'article:published_time',\n        content: loaderData.post.publishedAt,\n      },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n## llms.txt\n\nSome sites are adopting a `llms.txt` file (similar to `robots.txt`) to provide guidance to AI systems:\n\n```ts\n// src/routes/llms[.]txt.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/llms.txt')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const content = `# My App\n\n> My App is a platform for building modern web applications.\n\n## Documentation\n- Getting Started: https://myapp.com/docs/getting-started\n- API Reference: https://myapp.com/docs/api\n\n## Key Facts\n- Built with TanStack Start\n- Supports React and Solid\n- Full TypeScript support\n\n## Contact\n- Website: https://myapp.com\n- GitHub: https://github.com/mycompany/myapp\n`\n\n        return new Response(content, {\n          headers: {\n            'Content-Type': 'text/plain',\n          },\n        })\n      },\n    },\n  },\n})\n```\n\n## Monitoring AI Citations\n\nUnlike traditional SEO with established analytics, LLMO monitoring is still evolving. Consider:\n\n- **Test with AI assistants** - Ask ChatGPT, Claude, and Perplexity about your product/content\n- **Monitor brand mentions** - Track how AI systems describe your offerings\n- **Validate structured data** - Use [Google's Rich Results Test](https://search.google.com/test/rich-results) and [Schema.org Validator](https://validator.schema.org/)\n- **Check AI search engines** - Monitor presence in Perplexity, Bing Chat, and Google AI Overviews\n"
  },
  {
    "path": "docs/start/framework/react/guide/middleware.md",
    "content": "---\nid: middleware\ntitle: Middleware\n---\n\n## What is Middleware?\n\nMiddleware allows you to customize the behavior of both server routes like GET/POST/etc (including requests to SSR your application) and server functions created with `createServerFn`. Middleware is composable and can even depend on other middleware to create a chain of operations that are executed hierarchically and in order.\n\n### What kinds of things can I do with Middleware?\n\n- **Authentication**: Verify a user's identity before executing a server function.\n- **Authorization**: Check if a user has the necessary permissions to execute a server function.\n- **Logging**: Log requests, responses, and errors.\n- **CSP**: Configure Content Security Policy and other security measures.\n- **Observability**: Collect metrics, traces, and logs.\n- **Provide Context**: Attach data to the request object for use in other middleware or server functions.\n- **Error Handling**: Handle errors in a consistent way.\n- And many more! The possibilities are up to you!\n\n## Middleware Types\n\nThere are two types of middleware: **request middleware** and **server function middleware**.\n\n- **Request middleware** is used to customize the behavior of any server request that passes through it, including server functions.\n- **Server function middleware** is used to customize the behavior of server functions specifically.\n\n> [!NOTE]\n> Server function middleware is a subset of request middleware that has extra functionality specifically for server functions like being able to validate input data or perform client-side logic both before and after the server function is executed.\n\n### Key Differences\n\n| Feature           | Request Middleware               | Server Function Middleware |\n| ----------------- | -------------------------------- | -------------------------- |\n| Scope             | All server requests              | Server functions only      |\n| Methods           | `.server()`                      | `.client()`, `.server()`   |\n| Input Validation  | No                               | Yes (`.inputValidator()`)  |\n| Client-side Logic | No                               | Yes                        |\n| Dependencies      | Can depend on request middleware | Can depend on both types   |\n\n> [!NOTE]\n> Request middleware cannot depend on server function middleware, but server function middleware can depend on request middleware.\n\n## Core Concepts\n\n### Middleware Composition\n\nAll middleware is composable, which means that one middleware can depend on another middleware.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst loggingMiddleware = createMiddleware().server(() => {\n  //...\n})\n\nconst authMiddleware = createMiddleware()\n  .middleware([loggingMiddleware])\n  .server(() => {\n    //...\n  })\n```\n\n### Progressing the Middleware Chain\n\nMiddleware is next-able, which means that you must call the `next` function in the `.server` method (and/or `.client` method if you are creating a server function middleware) to execute the next middleware in the chain. This allows you to:\n\n- Short circuit the middleware chain and return early\n- Pass data to the next middleware\n- Access the result of the next middleware\n- Pass context to the wrapping middleware\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst loggingMiddleware = createMiddleware().server(async ({ next }) => {\n  const result = await next() // <-- This will execute the next middleware in the chain\n  return result\n})\n```\n\n## Request Middleware\n\nRequest middleware is used to customize the behavior of any server request that passes through it, including server routes, SSR and server functions.\n\nTo create a request middleware, call the `createMiddleware` function. You may call this function with the `type` property set to 'request', but this is the default value so you can omit it if you'd like.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst loggingMiddleware = createMiddleware().server(() => {\n  //...\n})\n```\n\n### Available Methods\n\nRequest middleware has the following methods:\n\n- `middleware`: Add a middleware to the chain.\n- `server`: Define server-side logic that the middleware will execute before any nested middleware and ultimately a server function, and also provide the result to the next middleware.\n\n### The `.server` method\n\nThe `.server` method is used to define server-side logic that the middleware will execute before any nested middleware, and also provide the result to the next middleware. It receives the `next` method and other things like context and the request object:\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst loggingMiddleware = createMiddleware().server(\n  ({ next, context, request }) => {\n    return next()\n  },\n)\n```\n\nTo quickly visualize this handshake, here is a diagram:\n\n```mermaid\nsequenceDiagram\n  HTTP ->> Middleware.server: Request\n  Middleware.server ->> Middleware.server: next()\n  Middleware.server ->> ServerFn: payload\n  ServerFn ->> Middleware.server: result\n  Middleware.server ->> Middleware.server: return\n  Middleware.server ->> HTTP: Response\n\n  box Server\n  participant Middleware.server\n  participant ServerFn\n  end\n```\n\n### Using Request Middleware with Server Routes\n\nYou can use request middleware with server routes in two ways:\n\n#### All Server Route Methods\n\nTo have a server route use middleware for all methods, pass a middleware array to the `middleware` property of the method builder object.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst loggingMiddleware = createMiddleware().server(() => {\n  //...\n})\n\nexport const Route = createFileRoute('/foo')({\n  server: {\n    middleware: [loggingMiddleware],\n    handlers: {\n      GET: () => {\n        //...\n      },\n      POST: () => {\n        //...\n      },\n    },\n  },\n})\n```\n\n#### Specific Server Route Methods\n\nYou can pass middleware to specific server route methods by using the `createHandlers` utility and passing a middleware array to the `middleware` property of the method object.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst loggingMiddleware = createMiddleware().server(() => {\n  //...\n})\n\nexport const Route = createFileRoute('/foo')({\n  server: {\n    handlers: ({ createHandlers }) =>\n      createHandlers({\n        GET: {\n          middleware: [loggingMiddleware],\n          handler: () => {\n            //...\n          },\n        },\n      }),\n  },\n})\n```\n\n## Server Function Middleware\n\nServer function middleware is a **subset** of request middleware that has extra functionality specifically for server functions like being able to validate input data or perform client-side logic both before and after the server function is executed.\n\nTo create a server function middleware, call the `createMiddleware` function with the `type` property set to 'function'.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst loggingMiddleware = createMiddleware({ type: 'function' })\n  .client(() => {\n    //...\n  })\n  .server(() => {\n    //...\n  })\n```\n\n### Available Methods\n\nServer function middleware has the following methods:\n\n- `middleware`: Add a middleware to the chain.\n- `inputValidator`: Modify the data object before it is passed to this middleware and any nested middleware and eventually the server function.\n- `client`: Define client-side logic that the middleware will execute on the client before (and after) the server function calls into the server to execute the function.\n- `server`: Define server-side logic that the middleware will execute on the server before (and after) the server function is executed.\n\n> [!NOTE]\n> If you are (hopefully) using TypeScript, the order of these methods is enforced by the type system to ensure maximum inference and type safety.\n\n### The `.client` method\n\nThe `.client` method is used to define client-side logic that the middleware will wrap the execution and result of the RPC call to the server.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst loggingMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next, context, request }) => {\n    const result = await next() // <-- This will execute the next middleware in the chain and eventually, the RPC to the server\n    return result\n  },\n)\n```\n\n### The `.inputValidator` method\n\nThe `inputValidator` method is used to modify the data object before it is passed to this middleware, nested middleware, and ultimately the server function. This method should receive a function that takes the data object and returns a validated (and optionally modified) data object. It's common to use a validation library like `zod` to do this.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\n\nconst mySchema = z.object({\n  workspaceId: z.string(),\n})\n\nconst workspaceMiddleware = createMiddleware({ type: 'function' })\n  .inputValidator(zodValidator(mySchema))\n  .server(({ next, data }) => {\n    console.log('Workspace ID:', data.workspaceId)\n    return next()\n  })\n```\n\n### Using Server Function Middleware\n\nTo have a middleware wrap a specific server function, you can pass a middleware array to the `middleware` property of the `createServerFn` function.\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\nimport { loggingMiddleware } from './middleware'\n\nconst fn = createServerFn()\n  .middleware([loggingMiddleware])\n  .handler(async () => {\n    //...\n  })\n```\n\nTo quickly visualize this handshake, here is a diagram:\n\n```mermaid\nsequenceDiagram\n  ServerFn (client) ->> Middleware.client: payload\n  Middleware.client ->> Middleware.client: next()\n  Middleware.client ->> Middleware.server: Request\n  Middleware.server ->> Middleware.server: next()\n  Middleware.server ->> ServerFn: payload\n  ServerFn ->> Middleware.server: result\n  Middleware.server ->> Middleware.server: return\n  Middleware.server ->> Middleware.client: Response\n  Middleware.client ->> Middleware.client: return\n  Middleware.client ->> ServerFn (client): result\n\n  box Client\n  participant ServerFn (client)\n  participant Middleware.client\n  end\n\n  box Server\n  participant Middleware.server\n  participant ServerFn\n  end\n```\n\n## Context Management\n\n### Providing Context via `next`\n\nThe `next` function can be optionally called with an object that has a `context` property with an object value. Whatever properties you pass to this `context` value will be merged into the parent `context` and provided to the next middleware.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst awesomeMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    return next({\n      context: {\n        isAwesome: Math.random() > 0.5,\n      },\n    })\n  },\n)\n\nconst loggingMiddleware = createMiddleware({ type: 'function' })\n  .middleware([awesomeMiddleware])\n  .server(async ({ next, context }) => {\n    console.log('Is awesome?', context.isAwesome)\n    return next()\n  })\n```\n\n### Sending Client Context to the Server\n\n**Client context is NOT sent to the server by default since this could end up unintentionally sending large payloads to the server.** If you need to send client context to the server, you must call the `next` function with a `sendContext` property and object to transmit any data to the server. Any properties passed to `sendContext` will be merged, serialized and sent to the server along with the data and will be available on the normal context object of any nested server middleware.\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst requestLogger = createMiddleware({ type: 'function' })\n  .client(async ({ next, context }) => {\n    return next({\n      sendContext: {\n        // Send the workspace ID to the server\n        workspaceId: context.workspaceId,\n      },\n    })\n  })\n  .server(async ({ next, data, context }) => {\n    // Woah! We have the workspace ID from the client!\n    console.log('Workspace ID:', context.workspaceId)\n    return next()\n  })\n```\n\n#### Client-Sent Context Security\n\nYou may have noticed that in the example above while client-sent context is type-safe, it is not required to be validated at runtime. If you pass dynamic user-generated data via context, that could pose a security concern, so **if you are sending dynamic data from the client to the server via context, you should validate it in the server-side middleware before using it.**\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\n\nconst requestLogger = createMiddleware({ type: 'function' })\n  .client(async ({ next, context }) => {\n    return next({\n      sendContext: {\n        workspaceId: context.workspaceId,\n      },\n    })\n  })\n  .server(async ({ next, data, context }) => {\n    // Validate the workspace ID before using it\n    const workspaceId = zodValidator(z.number()).parse(context.workspaceId)\n    console.log('Workspace ID:', workspaceId)\n    return next()\n  })\n```\n\n### Sending Server Context to the Client\n\nSimilar to sending client context to the server, you can also send server context to the client by calling the `next` function with a `sendContext` property and object to transmit any data to the client. Any properties passed to `sendContext` will be merged, serialized and sent to the client along with the response and will be available on the normal context object of any nested client middleware. The returned object of calling `next` in `client` contains the context sent from server to the client and is type-safe.\n\n> [!WARNING]\n> The return type of `next` in `client` can only be inferred from middleware known in the current middleware chain. Therefore the most accurate return type of `next` is in middleware at the end of the middleware chain\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst serverTimer = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    return next({\n      sendContext: {\n        // Send the current time to the client\n        timeFromServer: new Date(),\n      },\n    })\n  },\n)\n\nconst requestLogger = createMiddleware({ type: 'function' })\n  .middleware([serverTimer])\n  .client(async ({ next }) => {\n    const result = await next()\n    // Woah! We have the time from the server!\n    console.log('Time from the server:', result.context.timeFromServer)\n\n    return result\n  })\n```\n\n## Global Middleware\n\nGlobal middleware runs automatically for every request in your application. This is useful for functionality like authentication, logging, and monitoring that should apply to all requests.\n\n> [!NOTE]\n> The `src/start.ts` file is not included in the default TanStack Start template. You'll need to create this file when you want to configure global middleware or other Start-level options.\n\n### Global Request Middleware\n\nTo have a middleware run for **every request handled by Start**, create a `src/start.ts` file and use the `createStart` function to return your middleware configuration:\n\n```tsx\n// src/start.ts\nimport { createStart, createMiddleware } from '@tanstack/react-start'\n\nconst myGlobalMiddleware = createMiddleware().server(() => {\n  //...\n})\n\nexport const startInstance = createStart(() => {\n  return {\n    requestMiddleware: [myGlobalMiddleware],\n  }\n})\n```\n\n> [!NOTE]\n> Global **request** middleware runs before **every request, including server routes, SSR and server functions**.\n\n### Global Server Function Middleware\n\nTo have a middleware run for **every server function in your application**, add it to the `functionMiddleware` array in your `src/start.ts` file:\n\n```tsx\n// src/start.ts\nimport { createStart } from '@tanstack/react-start'\nimport { loggingMiddleware } from './middleware'\n\nexport const startInstance = createStart(() => {\n  return {\n    functionMiddleware: [loggingMiddleware],\n  }\n})\n```\n\n### Middleware Execution Order\n\nMiddleware is executed dependency-first, starting with global middleware, followed by server function middleware. The following example will log in this order:\n\n- `globalMiddleware1`\n- `globalMiddleware2`\n- `a`\n- `b`\n- `c`\n- `d`\n- `fn`\n\n```tsx\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\n\nconst globalMiddleware1 = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    console.log('globalMiddleware1')\n    return next()\n  },\n)\n\nconst globalMiddleware2 = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    console.log('globalMiddleware2')\n    return next()\n  },\n)\n\nconst a = createMiddleware({ type: 'function' }).server(async ({ next }) => {\n  console.log('a')\n  return next()\n})\n\nconst b = createMiddleware({ type: 'function' })\n  .middleware([a])\n  .server(async ({ next }) => {\n    console.log('b')\n    return next()\n  })\n\nconst c = createMiddleware({ type: 'function' })\n  .middleware()\n  .server(async ({ next }) => {\n    console.log('c')\n    return next()\n  })\n\nconst d = createMiddleware({ type: 'function' })\n  .middleware([b, c])\n  .server(async () => {\n    console.log('d')\n  })\n\nconst fn = createServerFn()\n  .middleware([d])\n  .server(async () => {\n    console.log('fn')\n  })\n```\n\n## Request and Response Modification\n\n### Reading/Modifying the Server Response\n\nMiddleware that uses the `server` method executes in the same context as server functions, so you can follow the exact same [Server Function Context Utilities](./server-functions.md#server-function-context) to read and modify anything about the request headers, status codes, etc.\n\n### Modifying the Client Request\n\nMiddleware that uses the `client` method executes in a **completely different client-side context** than server functions, so you can't use the same utilities to read and modify the request. However, you can still modify the request by returning additional properties when calling the `next` function.\n\n#### Setting Custom Headers\n\nYou can add headers to the outgoing request by passing a `headers` object to `next`:\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\nimport { getToken } from 'my-auth-library'\n\nconst authMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    return next({\n      headers: {\n        Authorization: `Bearer ${getToken()}`,\n      },\n    })\n  },\n)\n```\n\n#### Header Merging Across Middleware\n\nWhen multiple middlewares set headers, they are **merged together**. Later middlewares can add new headers or override headers set by earlier middlewares:\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst firstMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    return next({\n      headers: {\n        'X-Request-ID': '12345',\n        'X-Source': 'first-middleware',\n      },\n    })\n  },\n)\n\nconst secondMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    return next({\n      headers: {\n        'X-Timestamp': Date.now().toString(),\n        'X-Source': 'second-middleware', // Overrides first middleware\n      },\n    })\n  },\n)\n\n// Final headers will include:\n// - X-Request-ID: '12345' (from first)\n// - X-Timestamp: '<timestamp>' (from second)\n// - X-Source: 'second-middleware' (second overrides first)\n```\n\nYou can also set headers directly at the call site:\n\n```tsx\nawait myServerFn({\n  data: { name: 'John' },\n  headers: {\n    'X-Custom-Header': 'call-site-value',\n  },\n})\n```\n\n**Header precedence (all headers are merged, later values override earlier):**\n\n1. Earlier middleware headers\n2. Later middleware headers (override earlier)\n3. Call-site headers (override all middleware headers)\n\n#### Custom Fetch Implementation\n\nFor advanced use cases, you can provide a custom `fetch` implementation to control how server function requests are made. This is useful for:\n\n- Adding request interceptors or retry logic\n- Using a custom HTTP client\n- Testing and mocking\n- Adding telemetry or monitoring\n\n**Via Client Middleware:**\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\nimport type { CustomFetch } from '@tanstack/react-start'\n\nconst customFetchMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const customFetch: CustomFetch = async (url, init) => {\n      console.log('Request starting:', url)\n      const start = Date.now()\n\n      const response = await fetch(url, init)\n\n      console.log('Request completed in', Date.now() - start, 'ms')\n      return response\n    }\n\n    return next({ fetch: customFetch })\n  },\n)\n```\n\n**Directly at Call Site:**\n\n```tsx\nimport type { CustomFetch } from '@tanstack/react-start'\n\nconst myFetch: CustomFetch = async (url, init) => {\n  // Add custom logic here\n  return fetch(url, init)\n}\n\nawait myServerFn({\n  data: { name: 'John' },\n  fetch: myFetch,\n})\n```\n\n#### Fetch Override Precedence\n\nWhen custom fetch implementations are provided at multiple levels, the following precedence applies (highest to lowest priority):\n\n| Priority    | Source             | Description                                          |\n| ----------- | ------------------ | ---------------------------------------------------- |\n| 1 (highest) | Call site          | `serverFn({ fetch: customFetch })`                   |\n| 2           | Later middleware   | Last middleware in chain that provides `fetch`       |\n| 3           | Earlier middleware | First middleware in chain that provides `fetch`      |\n| 4           | createStart        | `createStart({ serverFns: { fetch: customFetch } })` |\n| 5 (lowest)  | Default            | Global `fetch` function                              |\n\n**Key principle:** The call site always wins. This allows you to override middleware behavior for specific calls when needed.\n\n```tsx\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport type { CustomFetch } from '@tanstack/react-start'\n\n// Middleware sets a fetch that adds logging\nconst loggingMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const loggingFetch: CustomFetch = async (url, init) => {\n      console.log('Middleware fetch:', url)\n      return fetch(url, init)\n    }\n    return next({ fetch: loggingFetch })\n  },\n)\n\nconst myServerFn = createServerFn()\n  .middleware([loggingMiddleware])\n  .handler(async () => {\n    return { message: 'Hello' }\n  })\n\n// Uses middleware's loggingFetch\nawait myServerFn()\n\n// Override with custom fetch for this specific call\nconst testFetch: CustomFetch = async (url, init) => {\n  console.log('Test fetch:', url)\n  return fetch(url, init)\n}\nawait myServerFn({ fetch: testFetch }) // Uses testFetch, NOT loggingFetch\n```\n\n**Chained Middleware Example:**\n\nWhen multiple middlewares provide fetch, the last one wins:\n\n```tsx\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport type { CustomFetch } from '@tanstack/react-start'\n\nconst firstMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const firstFetch: CustomFetch = (url, init) => {\n      const headers = new Headers(init?.headers)\n      headers.set('X-From', 'first-middleware')\n      return fetch(url, { ...init, headers })\n    }\n    return next({ fetch: firstFetch })\n  },\n)\n\nconst secondMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const secondFetch: CustomFetch = (url, init) => {\n      const headers = new Headers(init?.headers)\n      headers.set('X-From', 'second-middleware')\n      return fetch(url, { ...init, headers })\n    }\n    return next({ fetch: secondFetch })\n  },\n)\n\nconst myServerFn = createServerFn()\n  .middleware([firstMiddleware, secondMiddleware])\n  .handler(async () => {\n    // Request will have X-From: 'second-middleware'\n    // because secondMiddleware's fetch overrides firstMiddleware's fetch\n    return { message: 'Hello' }\n  })\n```\n\n**Global Fetch via createStart:**\n\nYou can set a default custom fetch for all server functions in your application by providing `serverFns.fetch` in `createStart`. This is useful for adding global request interceptors, retry logic, or telemetry:\n\n```tsx\n// src/start.ts\nimport { createStart } from '@tanstack/react-start'\nimport type { CustomFetch } from '@tanstack/react-start'\n\nconst globalFetch: CustomFetch = async (url, init) => {\n  console.log('Global fetch:', url)\n  // Add retry logic, telemetry, etc.\n  return fetch(url, init)\n}\n\nexport const startInstance = createStart(() => {\n  return {\n    serverFns: {\n      fetch: globalFetch,\n    },\n  }\n})\n```\n\nThis global fetch has lower priority than middleware and call-site fetch, so you can still override it for specific server functions or calls when needed.\n\n> [!NOTE]\n> Custom fetch only applies on the client side. During SSR, server functions are called directly without going through fetch.\n\n## Environment and Performance\n\n### Environment Tree Shaking\n\nMiddleware functionality is tree-shaken based on the environment for each bundle produced.\n\n- On the server, nothing is tree-shaken, so all code used in middleware will be included in the server bundle.\n- On the client, all server-specific code is removed from the client bundle. This means any code used in the `server` method is always removed from the client bundle. `data` validation code will also be removed.\n\n## Middleware Factories\n\nStatic middlewares are created once and reused across routes. A middleware factory wraps that creation in a function, allowing it to accept parameters and behave differently depending on the caller's needs. Authorization is a common use case.\n\n**Authentication (Static Base Middleware) Example:**\n\nThis middleware validates the session and injects it into `context` for downstream middlewares.\n\n```tsx\n// middleware.ts\nimport { createMiddleware } from '@tanstack/react-start'\nimport { auth } from './my-auth'\n\nexport const authMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    const session = await auth.getSession({ headers: request.headers })\n\n    if (!session) {\n      throw new Error('Unauthorized')\n    }\n\n    return await next({\n      context: { session },\n    })\n  },\n)\n```\n\n**Authorization (Middleware Factory) Example:**\n\nThe middleware validates access based on the dynamic `permissions` parameter, composing with `authMiddleware` so `context.session` is already available.\n\n```tsx\n// middleware.ts\nimport { createMiddleware } from '@tanstack/react-start'\nimport { auth } from './my-auth'\n\nexport const authMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    // ... (implementation from authentication example above)\n  },\n)\n\ntype Permissions = Record<string, string[]>\n\nexport function authorizationMiddleware(permissions: Permissions) {\n  return createMiddleware({ type: 'function' })\n    .middleware([authMiddleware])\n    .server(async ({ next, context }) => {\n      const granted = await auth.hasPermission(context.session, permissions)\n\n      if (!granted) {\n        throw new Error('Forbidden')\n      }\n\n      return await next()\n    })\n}\n```\n\n**Usage in a Server Function:**\n\nAccess requirements are defined per server function, without duplicating any middleware logic.\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\nimport { authorizationMiddleware } from './middleware'\n\nexport const getClients = createServerFn()\n  .middleware([\n    authorizationMiddleware({\n      client: ['read'],\n    }),\n  ])\n  .handler(async ({ context }) => {\n    return { message: 'The user can read clients.' }\n  })\n```\n"
  },
  {
    "path": "docs/start/framework/react/guide/observability.md",
    "content": "---\nid: observability\ntitle: Observability\n---\n\nObservability is a critical aspect of modern web development, enabling you to monitor, trace, and debug your application's performance and errors. TanStack Start provides built-in patterns for observability and integrates seamlessly with external tools to give you comprehensive insights into your application.\n\n## Partner Solution: Sentry\n\n<a href=\"https://sentry.io?utm_source=tanstack\" alt='Sentry Logo'>\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/sentry-wordmark-light.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/sentry-wordmark-dark.svg\" width=\"280\">\n    <img alt=\"Sentry logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/sentry-wordmark-light.svg\" width=\"280\">\n  </picture>\n</a>\n\nFor comprehensive observability, we recommend [Sentry](https://sentry.io?utm_source=tanstack) - our trusted partner for error tracking and performance monitoring. Sentry provides:\n\n- **Real-time Error Tracking** - Catch and debug errors across your entire stack\n- **Performance Monitoring** - Track slow transactions and optimize bottlenecks\n- **Release Health** - Monitor deployments and track error rates over time\n- **User Impact Analysis** - Understand how errors affect your users\n- **TanStack Start Integration** - Works seamlessly with server functions and client code\n\n**Quick Setup:**\n\n```tsx\n// Client-side (app.tsx)\nimport * as Sentry from '@sentry/react'\n\nSentry.init({\n  dsn: import.meta.env.VITE_SENTRY_DSN,\n  environment: import.meta.env.NODE_ENV,\n})\n\n// Server functions\nimport * as Sentry from '@sentry/node'\n\nconst serverFn = createServerFn().handler(async () => {\n  try {\n    return await riskyOperation()\n  } catch (error) {\n    Sentry.captureException(error)\n    throw error\n  }\n})\n```\n\n[Get started with Sentry →](https://sentry.io/signup?utm_source=tanstack) | [View integration example →](https://github.com/TanStack/router/tree/main/e2e/react-router/sentry-integration)\n\n## Built-in Observability Patterns\n\nTanStack Start's architecture provides several opportunities for built-in observability without external dependencies:\n\n### Server Function Logging\n\nAdd logging to your server functions to track execution, performance, and errors:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\n\nconst getUser = createServerFn({ method: 'GET' })\n  .inputValidator((id: string) => id)\n  .handler(async ({ data: id }) => {\n    const startTime = Date.now()\n\n    try {\n      console.log(`[SERVER] Fetching user ${id}`)\n\n      const user = await db.users.findUnique({ where: { id } })\n\n      if (!user) {\n        console.log(`[SERVER] User ${id} not found`)\n        throw new Error('User not found')\n      }\n\n      const duration = Date.now() - startTime\n      console.log(`[SERVER] User ${id} fetched in ${duration}ms`)\n\n      return user\n    } catch (error) {\n      const duration = Date.now() - startTime\n      console.error(\n        `[SERVER] Error fetching user ${id} after ${duration}ms:`,\n        error,\n      )\n      throw error\n    }\n  })\n```\n\n### Request/Response Middleware\n\nCreate middleware to log all requests and responses:\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst requestLogger = createMiddleware().server(async ({ request, next }) => {\n  const startTime = Date.now()\n  const timestamp = new Date().toISOString()\n\n  console.log(`[${timestamp}] ${request.method} ${request.url} - Starting`)\n\n  try {\n    const result = await next()\n    const duration = Date.now() - startTime\n\n    console.log(\n      `[${timestamp}] ${request.method} ${request.url} - ${result.response.status} (${duration}ms)`,\n    )\n\n    return result\n  } catch (error) {\n    const duration = Date.now() - startTime\n    console.error(\n      `[${timestamp}] ${request.method} ${request.url} - Error (${duration}ms):`,\n      error,\n    )\n    throw error\n  }\n})\n\n// Apply to all server routes\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [requestLogger],\n    handlers: {\n      GET: async () => {\n        return Response.json({ users: await getUsers() })\n      },\n    },\n  },\n})\n```\n\n### Route Performance Monitoring\n\nTrack route loading performance on both client and server:\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  loader: async ({ context }) => {\n    const startTime = Date.now()\n\n    try {\n      const data = await loadDashboardData()\n      const duration = Date.now() - startTime\n\n      // Log server-side performance\n      if (typeof window === 'undefined') {\n        console.log(`[SSR] Dashboard loaded in ${duration}ms`)\n      }\n\n      return data\n    } catch (error) {\n      const duration = Date.now() - startTime\n      console.error(`[LOADER] Dashboard error after ${duration}ms:`, error)\n      throw error\n    }\n  },\n  component: Dashboard,\n})\n\nfunction Dashboard() {\n  const data = Route.useLoaderData()\n\n  // Track client-side render time\n  React.useEffect(() => {\n    const renderTime = performance.now()\n    console.log(`[CLIENT] Dashboard rendered in ${renderTime}ms`)\n  }, [])\n\n  return <div>Dashboard content</div>\n}\n```\n\n### Health Check Endpoints\n\nCreate server routes for health monitoring:\n\n```tsx\n// routes/health.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/health')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const checks = {\n          status: 'healthy',\n          timestamp: new Date().toISOString(),\n          uptime: process.uptime(),\n          memory: process.memoryUsage(),\n          database: await checkDatabase(),\n          version: process.env.npm_package_version,\n        }\n\n        return Response.json(checks)\n      },\n    },\n  },\n})\n\nasync function checkDatabase() {\n  try {\n    await db.raw('SELECT 1')\n    return { status: 'connected', latency: 0 }\n  } catch (error) {\n    return { status: 'error', error: error.message }\n  }\n}\n```\n\n### Error Boundaries\n\nImplement comprehensive error handling:\n\n```tsx\n// Client-side error boundary\nimport { ErrorBoundary } from 'react-error-boundary'\n\nfunction ErrorFallback({ error, resetErrorBoundary }: any) {\n  // Log client errors\n  console.error('[CLIENT ERROR]:', error)\n\n  // Could also send to external service\n  // sendErrorToService(error)\n\n  return (\n    <div role=\"alert\">\n      <h2>Something went wrong</h2>\n      <button onClick={resetErrorBoundary}>Try again</button>\n    </div>\n  )\n}\n\nexport function App() {\n  return (\n    <ErrorBoundary FallbackComponent={ErrorFallback}>\n      <Router />\n    </ErrorBoundary>\n  )\n}\n\n// Server function error handling\nconst riskyOperation = createServerFn().handler(async () => {\n  try {\n    return await performOperation()\n  } catch (error) {\n    // Log server errors with context\n    console.error('[SERVER ERROR]:', {\n      error: error.message,\n      stack: error.stack,\n      timestamp: new Date().toISOString(),\n      // Add request context if available\n    })\n\n    // Return user-friendly error\n    throw new Error('Operation failed. Please try again.')\n  }\n})\n```\n\n### Performance Metrics Collection\n\nCollect and expose basic performance metrics:\n\n```tsx\n// utils/metrics.ts\nclass MetricsCollector {\n  private metrics = new Map<string, number[]>()\n\n  recordTiming(name: string, duration: number) {\n    if (!this.metrics.has(name)) {\n      this.metrics.set(name, [])\n    }\n    this.metrics.get(name)!.push(duration)\n  }\n\n  getStats(name: string) {\n    const timings = this.metrics.get(name) || []\n    if (timings.length === 0) return null\n\n    const sorted = timings.sort((a, b) => a - b)\n    return {\n      count: timings.length,\n      avg: timings.reduce((a, b) => a + b, 0) / timings.length,\n      p50: sorted[Math.floor(sorted.length * 0.5)],\n      p95: sorted[Math.floor(sorted.length * 0.95)],\n      min: sorted[0],\n      max: sorted[sorted.length - 1],\n    }\n  }\n\n  getAllStats() {\n    const stats: Record<string, any> = {}\n    for (const [name] of this.metrics) {\n      stats[name] = this.getStats(name)\n    }\n    return stats\n  }\n}\n\nexport const metrics = new MetricsCollector()\n\n// Metrics endpoint\n// routes/metrics.ts\nexport const Route = createFileRoute('/metrics')({\n  server: {\n    handlers: {\n      GET: async () => {\n        return Response.json({\n          system: {\n            uptime: process.uptime(),\n            memory: process.memoryUsage(),\n            timestamp: new Date().toISOString(),\n          },\n          application: metrics.getAllStats(),\n        })\n      },\n    },\n  },\n})\n```\n\n### Debug Headers for Development\n\nAdd helpful debug information to responses:\n\n```tsx\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst debugMiddleware = createMiddleware().server(async ({ next }) => {\n  const result = await next()\n\n  if (process.env.NODE_ENV === 'development') {\n    result.response.headers.set('X-Debug-Timestamp', new Date().toISOString())\n    result.response.headers.set('X-Debug-Node-Version', process.version)\n    result.response.headers.set('X-Debug-Uptime', process.uptime().toString())\n  }\n\n  return result\n})\n```\n\n### Environment-Specific Logging\n\nConfigure different logging strategies for development vs production:\n\n```tsx\n// utils/logger.ts\nimport { createIsomorphicFn } from '@tanstack/react-start'\n\ntype LogLevel = 'debug' | 'info' | 'warn' | 'error'\n\nconst logger = createIsomorphicFn()\n  .server((level: LogLevel, message: string, data?: any) => {\n    const timestamp = new Date().toISOString()\n\n    if (process.env.NODE_ENV === 'development') {\n      // Development: Detailed console logging\n      console[level](`[${timestamp}] [${level.toUpperCase()}]`, message, data)\n    } else {\n      // Production: Structured JSON logging\n      console.log(\n        JSON.stringify({\n          timestamp,\n          level,\n          message,\n          data,\n          service: 'tanstack-start',\n          environment: process.env.NODE_ENV,\n        }),\n      )\n    }\n  })\n  .client((level: LogLevel, message: string, data?: any) => {\n    if (process.env.NODE_ENV === 'development') {\n      console[level](`[CLIENT] [${level.toUpperCase()}]`, message, data)\n    } else {\n      // Production: Send to analytics service\n      // analytics.track('client_log', { level, message, data })\n    }\n  })\n\n// Usage anywhere in your app\nexport { logger }\n\n// Example usage\nconst fetchUserData = createServerFn().handler(async ({ data: userId }) => {\n  logger('info', 'Fetching user data', { userId })\n\n  try {\n    const user = await db.users.findUnique({ where: { id: userId } })\n    logger('info', 'User data fetched successfully', { userId })\n    return user\n  } catch (error) {\n    logger('error', 'Failed to fetch user data', {\n      userId,\n      error: error.message,\n    })\n    throw error\n  }\n})\n```\n\n### Simple Error Reporting\n\nBasic error reporting without external dependencies:\n\n```tsx\n// utils/error-reporter.ts\nconst errorStore = new Map<\n  string,\n  { count: number; lastSeen: Date; error: any }\n>()\n\nexport function reportError(error: Error, context?: any) {\n  const key = `${error.name}:${error.message}`\n  const existing = errorStore.get(key)\n\n  if (existing) {\n    existing.count++\n    existing.lastSeen = new Date()\n  } else {\n    errorStore.set(key, {\n      count: 1,\n      lastSeen: new Date(),\n      error: {\n        name: error.name,\n        message: error.message,\n        stack: error.stack,\n        context,\n      },\n    })\n  }\n\n  // Log immediately\n  console.error('[ERROR REPORTED]:', {\n    error: error.message,\n    count: existing ? existing.count : 1,\n    context,\n  })\n}\n\n// Error reporting endpoint\n// routes/errors.ts\nexport const Route = createFileRoute('/admin/errors')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const errors = Array.from(errorStore.entries()).map(([key, data]) => ({\n          id: key,\n          ...data,\n        }))\n\n        return Response.json({ errors })\n      },\n    },\n  },\n})\n```\n\n## External Observability Tools\n\nWhile TanStack Start provides built-in observability patterns, external tools offer more comprehensive monitoring:\n\n### Other Popular Tools\n\n**Application Performance Monitoring:**\n\n- **[DataDog](https://www.datadoghq.com/)** - Full-stack monitoring with APM\n- **[New Relic](https://newrelic.com/)** - Performance monitoring and alerting\n- **[Honeycomb](https://honeycomb.io/)** - Observability for complex systems\n\n**Error Tracking:**\n\n- **[Bugsnag](https://bugsnag.com/)** - Error monitoring with deployment tracking\n- **[Rollbar](https://rollbar.com/)** - Real-time error alerting\n\n**Analytics & User Behavior:**\n\n- **[PostHog](https://posthog.com/)** - Product analytics with error tracking\n- **[Mixpanel](https://mixpanel.com/)** - Event tracking and user analytics\n\n### New Relic Integration\n\n[New Relic](https://newrelic.com/) is a popular application performance monitoring tool. Here's how to integrate it with TanStack Start.\n\n#### SSR\n\nTo enable New Relic for server-side rendering, you will need to do the following:\n\nCreate a new integration on New Relic of type `Node`. You will be given a license key that we will use below.\n\n```js\n// newrelic.js - New Relic agent configuration\nexports.config = {\n  app_name: ['YourTanStackApp'], // Your application name in New Relic\n  license_key: 'YOUR_NEW_RELIC_LICENSE_KEY', // Your New Relic license key\n  agent_enabled: true,\n  distributed_tracing: { enabled: true },\n  span_events: { enabled: true },\n  transaction_events: { enabled: true },\n  // Additional default settings\n}\n```\n\n```tsx\n// server.tsx\nimport newrelic from 'newrelic' // Make sure this is the first import\nimport {\n  createStartHandler,\n  defaultStreamHandler,\n  defineHandlerCallback,\n} from '@tanstack/react-start/server'\nimport type { ServerEntry } from '@tanstack/react-start/server-entry'\n\nconst customHandler = defineHandlerCallback(async (ctx) => {\n  // We do this so that transactions are grouped under the route ID instead of unique URLs\n  const matches = ctx.router?.state?.matches ?? []\n  const leaf = matches[matches.length - 1]\n  const routeId = leaf?.routeId ?? new URL(ctx.request.url).pathname\n\n  newrelic.setControllerName(routeId, ctx.request.method ?? 'GET')\n  newrelic.addCustomAttributes({\n    'route.id': routeId,\n    'http.method': ctx.request.method,\n    'http.path': new URL(ctx.request.url).pathname,\n    // Any other custom attributes you want to add\n  })\n\n  return defaultStreamHandler(ctx)\n})\n\nexport default {\n  fetch(request) {\n    const handler = createStartHandler(customHandler)\n    return handler(request)\n  },\n} satisfies ServerEntry\n```\n\n```bash\nnode -r newrelic .output/server/index.mjs\n```\n\n#### Server Functions and Server Routes\n\nIf you want to add monitoring for server functions and server routes, you will need to follow the steps above, and then add the following:\n\n```ts\n// newrelic-middleware.ts\nimport newrelic from 'newrelic'\nimport { createMiddleware } from '@tanstack/react-start'\n\nexport const nrTransactionMiddleware = createMiddleware().server(\n  async ({ request, next }) => {\n    const reqPath = new URL(request.url).pathname\n    newrelic.setControllerName(reqPath, request.method ?? 'GET')\n    return await next()\n  },\n)\n```\n\n```ts\n// start.ts\nimport { createStart } from '@tanstack/react-start'\nimport { nrTransactionMiddleware } from './newrelic-middleware'\n\nexport const startInstance = createStart(() => {\n  return {\n    requestMiddleware: [nrTransactionMiddleware],\n  }\n})\n```\n\n#### SPA & Browser\n\nCreate a new integration on New Relic of type `React`.\n\nAfter you set it up, you will have to add the integration script that New Relic provides you with to your root route.\n\n```tsx\n// __root.tsx\nexport const Route = createRootRoute({\n  head: () => ({\n    scripts: [\n      {\n        id: 'new-relic',\n\n        // either copy/paste your New Relic integration script here\n        children: `...`,\n\n        // or you can create it in your public folder and then reference it here\n        src: '/newrelic.js',\n      },\n    ],\n  }),\n})\n```\n\n### OpenTelemetry Integration (Experimental)\n\n[OpenTelemetry](https://opentelemetry.io/) is the industry standard for observability. Here's an experimental approach to integrate it with TanStack Start:\n\n```tsx\n// instrumentation.ts - Initialize before your app\nimport { NodeSDK } from '@opentelemetry/sdk-node'\nimport { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'\nimport { Resource } from '@opentelemetry/resources'\nimport { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'\n\nconst sdk = new NodeSDK({\n  resource: new Resource({\n    [SemanticResourceAttributes.SERVICE_NAME]: 'tanstack-start-app',\n    [SemanticResourceAttributes.SERVICE_VERSION]: '1.0.0',\n  }),\n  instrumentations: [getNodeAutoInstrumentations()],\n})\n\n// Initialize BEFORE importing your app\nsdk.start()\n```\n\n```tsx\n// Server function tracing\nimport { trace, SpanStatusCode } from '@opentelemetry/api'\n\nconst tracer = trace.getTracer('tanstack-start')\n\nconst getUserWithTracing = createServerFn({ method: 'GET' })\n  .inputValidator((id: string) => id)\n  .handler(async ({ data: id }) => {\n    return tracer.startActiveSpan('get-user', async (span) => {\n      span.setAttributes({\n        'user.id': id,\n        operation: 'database.query',\n      })\n\n      try {\n        const user = await db.users.findUnique({ where: { id } })\n        span.setStatus({ code: SpanStatusCode.OK })\n        return user\n      } catch (error) {\n        span.recordException(error)\n        span.setStatus({\n          code: SpanStatusCode.ERROR,\n          message: error.message,\n        })\n        throw error\n      } finally {\n        span.end()\n      }\n    })\n  })\n```\n\n```tsx\n// Middleware for automatic tracing\nimport { createMiddleware } from '@tanstack/react-start'\nimport { trace, SpanStatusCode } from '@opentelemetry/api'\n\nconst tracer = trace.getTracer('tanstack-start')\n\nconst tracingMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    const url = new URL(request.url)\n\n    return tracer.startActiveSpan(\n      `${request.method} ${url.pathname}`,\n      async (span) => {\n        span.setAttributes({\n          'http.method': request.method,\n          'http.url': request.url,\n          'http.route': url.pathname,\n        })\n\n        try {\n          const result = await next()\n          span.setAttribute('http.status_code', result.response.status)\n          span.setStatus({ code: SpanStatusCode.OK })\n          return result\n        } catch (error) {\n          span.recordException(error)\n          span.setStatus({\n            code: SpanStatusCode.ERROR,\n            message: error.message,\n          })\n          throw error\n        } finally {\n          span.end()\n        }\n      },\n    )\n  },\n)\n```\n\n> **Note**: The above OpenTelemetry integration is experimental and requires manual setup. We're exploring first-class OpenTelemetry support that would provide automatic instrumentation for server functions, middleware, and route loaders.\n\n### Quick Integration Pattern\n\nMost observability tools follow a similar integration pattern with TanStack Start:\n\n```tsx\n// Initialize in app entry point\nimport { initObservabilityTool } from 'your-tool'\n\ninitObservabilityTool({\n  dsn: import.meta.env.VITE_TOOL_DSN,\n  environment: import.meta.env.NODE_ENV,\n})\n\n// Server function middleware\nconst observabilityMiddleware = createMiddleware().handler(async ({ next }) => {\n  return yourTool.withTracing('server-function', async () => {\n    try {\n      return await next()\n    } catch (error) {\n      yourTool.captureException(error)\n      throw error\n    }\n  })\n})\n```\n\n## Best Practices\n\n### Development vs Production\n\n```tsx\n// Different strategies per environment\nconst observabilityConfig = {\n  development: {\n    logLevel: 'debug',\n    enableTracing: true,\n    enableMetrics: false, // Too noisy in dev\n  },\n  production: {\n    logLevel: 'warn',\n    enableTracing: true,\n    enableMetrics: true,\n    enableAlerting: true,\n  },\n}\n```\n\n### Performance Monitoring Checklist\n\n- [ ] **Server Function Performance**: Track execution times\n- [ ] **Route Loading Times**: Monitor loader performance\n- [ ] **Database Query Performance**: Log slow queries\n- [ ] **External API Latency**: Monitor third-party service calls\n- [ ] **Memory Usage**: Track memory consumption patterns\n- [ ] **Error Rates**: Monitor error frequency and types\n\n### Security Considerations\n\n- Never log sensitive data (passwords, tokens, PII)\n- Use structured logging for better parsing\n- Implement log rotation in production\n- Consider compliance requirements (GDPR, CCPA)\n\n## Future OpenTelemetry Support\n\nDirect OpenTelemetry support is coming to TanStack Start, which will provide automatic instrumentation for server functions, middleware, and route loaders without the manual setup shown above.\n\n## Resources\n\n- **[Sentry Documentation](https://docs.sentry.io/)**\n- **[OpenTelemetry Documentation](https://opentelemetry.io/docs/)** - Industry standard observability\n- **[Working Example](https://github.com/TanStack/router/tree/main/examples/react/start-basic)** - See observability patterns in action\n"
  },
  {
    "path": "docs/start/framework/react/guide/path-aliases.md",
    "content": "---\nid: path-aliases\ntitle: Path Aliases\n---\n\nPath aliases are a useful feature of TypeScript that allows you to define a shortcut for a path that could be distant in your project's directory structure. This can help you avoid long relative imports in your code and make it easier to refactor your project's structure. This is especially useful for avoiding long relative imports in your code.\n\nBy default, TanStack Start does not include path aliases. However, you can easily add them to your project by updating your `tsconfig.json` file in the root of your project and adding the following configuration:\n\n```json\n{\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    }\n  }\n}\n```\n\nIn this example, we've defined the path alias `~/*` that maps to the `./src/*` directory. This means that you can now import files from the `src` directory using the `~` prefix.\n\nAfter updating your `tsconfig.json` file, you'll need to make changes to `vite.config.ts` to ensure that Vite resolves the path aliases correctly.\n\n## Vite 8\n\nVite 8+ has [built-in support for path aliases](https://vite.dev/config/shared-options#resolve-tsconfigpaths), which is disabled by default. To enable it, simply add the following configuration to your `vite.config.ts` file:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  resolve: {\n    // This enables built-in support for path aliases defined in tsconfig.json\n    tsconfigPaths: true,\n  },\n})\n```\n\n## Vite 7 and earlier\n\nFor Vite 7 and earlier, install the `vite-tsconfig-paths` plugin to enable path aliases in your TanStack Start project. You can do this by running the following command:\n\n```sh\nnpm install -D vite-tsconfig-paths\n```\n\nNow, you'll need to update your `vite.config.ts` file to include the following:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport viteTsConfigPaths from 'vite-tsconfig-paths'\n\nexport default defineConfig({\n  plugins: [\n    // this is the plugin that enables path aliases\n    viteTsConfigPaths({\n      projects: ['./tsconfig.json'],\n    }),\n  ],\n})\n```\n\nOnce this configuration has completed, you'll now be able to import files using the path alias like so:\n\n```ts\n// app/routes/posts/$postId/edit.tsx\nimport { Input } from '~/components/ui/input'\n\n// instead of\n\nimport { Input } from '../../../components/ui/input'\n```\n"
  },
  {
    "path": "docs/start/framework/react/guide/rendering-markdown.md",
    "content": "---\nid: rendering-markdown\ntitle: Rendering Markdown\n---\n\nThis guide covers two methods for importing and rendering markdown content in your TanStack Start application:\n\n1. **Static markdown** with `content-collections` for build-time loading (e.g., blog posts)\n2. **Dynamic markdown** fetched at runtime from GitHub or any remote source\n\nBoth methods share a common rendering pipeline using the `unified` ecosystem.\n\n## Setting Up the Markdown Processor\n\nBoth approaches use the same markdown-to-HTML processing pipeline. First, install the required dependencies:\n\n```bash\nnpm install unified remark-parse remark-gfm remark-rehype rehype-raw rehype-slug rehype-autolink-headings rehype-stringify shiki html-react-parser gray-matter\n```\n\nCreate a markdown processor utility:\n\n```tsx\n// src/utils/markdown.ts\nimport { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkGfm from 'remark-gfm'\nimport remarkRehype from 'remark-rehype'\nimport rehypeRaw from 'rehype-raw'\nimport rehypeSlug from 'rehype-slug'\nimport rehypeAutolinkHeadings from 'rehype-autolink-headings'\nimport rehypeStringify from 'rehype-stringify'\n\nexport type MarkdownHeading = {\n  id: string\n  text: string\n  level: number\n}\n\nexport type MarkdownResult = {\n  markup: string\n  headings: Array<MarkdownHeading>\n}\n\nexport async function renderMarkdown(content: string): Promise<MarkdownResult> {\n  const headings: Array<MarkdownHeading> = []\n\n  const result = await unified()\n    .use(remarkParse) // Parse markdown\n    .use(remarkGfm) // Support GitHub Flavored Markdown\n    .use(remarkRehype, { allowDangerousHtml: true }) // Convert to HTML AST\n    .use(rehypeRaw) // Process raw HTML in markdown\n    .use(rehypeSlug) // Add IDs to headings\n    .use(rehypeAutolinkHeadings, {\n      behavior: 'wrap',\n      properties: { className: ['anchor'] },\n    })\n    .use(() => (tree) => {\n      // Extract headings for table of contents\n      const { visit } = require('unist-util-visit')\n      const { toString } = require('hast-util-to-string')\n\n      visit(tree, 'element', (node: any) => {\n        if (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(node.tagName)) {\n          headings.push({\n            id: node.properties?.id || '',\n            text: toString(node),\n            level: parseInt(node.tagName.charAt(1), 10),\n          })\n        }\n      })\n    })\n    .use(rehypeStringify) // Serialize to HTML string\n    .process(content)\n\n  return {\n    markup: String(result),\n    headings,\n  }\n}\n```\n\n## Creating a Markdown Component\n\nCreate a React component that renders the processed HTML with custom element handling:\n\n```tsx\n// src/components/Markdown.tsx\nimport parse, { type HTMLReactParserOptions, Element } from 'html-react-parser'\nimport { renderMarkdown, type MarkdownResult } from '~/utils/markdown'\n\ntype MarkdownProps = {\n  content: string\n  className?: string\n}\n\nexport function Markdown({ content, className }: MarkdownProps) {\n  const [result, setResult] = useState<MarkdownResult | null>(null)\n\n  useEffect(() => {\n    renderMarkdown(content).then(setResult)\n  }, [content])\n\n  if (!result) {\n    return <div className={className}>Loading...</div>\n  }\n\n  const options: HTMLReactParserOptions = {\n    replace: (domNode) => {\n      if (domNode instanceof Element) {\n        // Customize rendering of specific elements\n        if (domNode.name === 'a') {\n          // Handle links\n          const href = domNode.attribs.href\n          if (href?.startsWith('/')) {\n            // Internal link - use your router's Link component\n            return (\n              <Link to={href}>{domToReact(domNode.children, options)}</Link>\n            )\n          }\n        }\n\n        if (domNode.name === 'img') {\n          // Add lazy loading to images\n          return (\n            <img\n              {...domNode.attribs}\n              loading=\"lazy\"\n              className=\"rounded-lg shadow-md\"\n            />\n          )\n        }\n      }\n    },\n  }\n\n  return <div className={className}>{parse(result.markup, options)}</div>\n}\n```\n\n## Method 1: Static Markdown with content-collections\n\nThe `content-collections` package is ideal for static content like blog posts that are included in your repository. It processes markdown files at build time and provides type-safe access to the content.\n\n### Installation\n\n```bash\nnpm install @content-collections/core @content-collections/vite\n```\n\n### Configuration\n\nCreate a `content-collections.ts` file in your project root:\n\n```tsx\n// content-collections.ts\nimport { defineCollection, defineConfig } from '@content-collections/core'\nimport matter from 'gray-matter'\n\nfunction extractFrontMatter(content: string) {\n  const { data, content: body, excerpt } = matter(content, { excerpt: true })\n  return { data, body, excerpt: excerpt || '' }\n}\n\nconst posts = defineCollection({\n  name: 'posts',\n  directory: './src/blog', // Directory containing your .md files\n  include: '*.md',\n  schema: (z) => ({\n    title: z.string(),\n    published: z.string().date(),\n    description: z.string().optional(),\n    authors: z.string().array(),\n  }),\n  transform: ({ content, ...post }) => {\n    const frontMatter = extractFrontMatter(content)\n\n    // Extract header image (first image in the document)\n    const headerImageMatch = content.match(/!\\[([^\\]]*)\\]\\(([^)]+)\\)/)\n    const headerImage = headerImageMatch ? headerImageMatch[2] : undefined\n\n    return {\n      ...post,\n      slug: post._meta.path,\n      excerpt: frontMatter.excerpt,\n      description: frontMatter.data.description,\n      headerImage,\n      content: frontMatter.body,\n    }\n  },\n})\n\nexport default defineConfig({\n  collections: [posts],\n})\n```\n\n### Vite Integration\n\nAdd the content-collections plugin to your Vite config:\n\n```tsx\n// app.config.ts\nimport { defineConfig } from '@tanstack/react-start/config'\nimport contentCollections from '@content-collections/vite'\n\nexport default defineConfig({\n  vite: {\n    plugins: [contentCollections()],\n  },\n})\n```\n\n### Creating Blog Posts\n\nCreate markdown files in your designated directory:\n\n````markdown\n## <!-- src/blog/hello-world.md -->\n\ntitle: Hello World\npublished: 2024-01-15\nauthors:\n\n- Jane Doe\n  description: My first blog post\n\n---\n\n![Hero Image](/images/hero.jpg)\n\nWelcome to my blog! This is my first post.\n\n## Getting Started\n\nHere's some content with **bold** and _italic_ text.\n\n```javascript\nconsole.log('Hello, world!')\n```\n````\n\n### Using the Collection\n\nAccess your posts through the generated collection:\n\n```tsx\n// src/routes/blog.index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { allPosts } from 'content-collections'\n\nexport const Route = createFileRoute('/blog/')({\n  component: BlogIndex,\n})\n\nfunction BlogIndex() {\n  // Posts are sorted by published date\n  const sortedPosts = allPosts.sort(\n    (a, b) => new Date(b.published).getTime() - new Date(a.published).getTime(),\n  )\n\n  return (\n    <div>\n      <h1>Blog</h1>\n      <ul>\n        {sortedPosts.map((post) => (\n          <li key={post.slug}>\n            <Link to=\"/blog/$slug\" params={{ slug: post.slug }}>\n              <h2>{post.title}</h2>\n              <p>{post.excerpt}</p>\n              <span>{post.published}</span>\n            </Link>\n          </li>\n        ))}\n      </ul>\n    </div>\n  )\n}\n```\n\n### Rendering a Single Post\n\n```tsx\n// src/routes/blog.$slug.tsx\nimport { createFileRoute, notFound } from '@tanstack/react-router'\nimport { allPosts } from 'content-collections'\nimport { Markdown } from '~/components/Markdown'\n\nexport const Route = createFileRoute('/blog/$slug')({\n  loader: ({ params }) => {\n    const post = allPosts.find((p) => p.slug === params.slug)\n    if (!post) {\n      throw notFound()\n    }\n    return post\n  },\n  component: BlogPost,\n})\n\nfunction BlogPost() {\n  const post = Route.useLoaderData()\n\n  return (\n    <article>\n      <header>\n        <h1>{post.title}</h1>\n        <p>\n          By {post.authors.join(', ')} on {post.published}\n        </p>\n      </header>\n      <Markdown content={post.content} className=\"prose\" />\n    </article>\n  )\n}\n```\n\n## Method 2: Dynamic Markdown from Remote Sources\n\nFor content stored externally (like GitHub repositories), you can fetch and render markdown dynamically using server functions.\n\n### Creating a Fetch Utility\n\n```tsx\n// src/utils/docs.server.ts\nimport { createServerFn } from '@tanstack/react-start'\nimport matter from 'gray-matter'\n\ntype FetchDocsParams = {\n  repo: string // e.g., 'tanstack/router'\n  branch: string // e.g., 'main'\n  filePath: string // e.g., 'docs/guide/getting-started.md'\n}\n\nexport const fetchDocs = createServerFn({ method: 'GET' })\n  .inputValidator((params: FetchDocsParams) => params)\n  .handler(async ({ data: { repo, branch, filePath } }) => {\n    const url = `https://raw.githubusercontent.com/${repo}/${branch}/${filePath}`\n\n    const response = await fetch(url, {\n      headers: {\n        // Add GitHub token for private repos or higher rate limits\n        // Authorization: `token ${process.env.GITHUB_TOKEN}`,\n      },\n    })\n\n    if (!response.ok) {\n      throw new Error(`Failed to fetch: ${response.status}`)\n    }\n\n    const rawContent = await response.text()\n    const { data: frontmatter, content } = matter(rawContent)\n\n    return {\n      frontmatter,\n      content,\n      filePath,\n    }\n  })\n```\n\n### Adding Cache Headers\n\nFor production, add appropriate cache headers:\n\n```tsx\nexport const fetchDocs = createServerFn({ method: 'GET' })\n  .inputValidator((params: FetchDocsParams) => params)\n  .handler(async ({ data: { repo, branch, filePath }, context }) => {\n    // Set cache headers for CDN caching\n    context.response.headers.set(\n      'Cache-Control',\n      'public, max-age=0, must-revalidate',\n    )\n    context.response.headers.set(\n      'CDN-Cache-Control',\n      'max-age=300, stale-while-revalidate=300',\n    )\n\n    // ... fetch logic\n  })\n```\n\n### Using Dynamic Markdown in Routes\n\n```tsx\n// src/routes/docs.$path.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { fetchDocs } from '~/utils/docs.server'\nimport { Markdown } from '~/components/Markdown'\n\nexport const Route = createFileRoute('/docs/$path')({\n  loader: async ({ params }) => {\n    return fetchDocs({\n      data: {\n        repo: 'your-org/your-repo',\n        branch: 'main',\n        filePath: `docs/${params.path}.md`,\n      },\n    })\n  },\n  component: DocsPage,\n})\n\nfunction DocsPage() {\n  const { frontmatter, content } = Route.useLoaderData()\n\n  return (\n    <article>\n      <h1>{frontmatter.title}</h1>\n      <Markdown content={content} className=\"prose\" />\n    </article>\n  )\n}\n```\n\n### Fetching Directory Contents\n\nTo build navigation from a GitHub directory:\n\n```tsx\n// src/utils/docs.server.ts\ntype GitHubContent = {\n  name: string\n  path: string\n  type: 'file' | 'dir'\n}\n\nexport const fetchRepoContents = createServerFn({ method: 'GET' })\n  .inputValidator(\n    (params: { repo: string; branch: string; path: string }) => params,\n  )\n  .handler(async ({ data: { repo, branch, path } }) => {\n    const url = `https://api.github.com/repos/${repo}/contents/${path}?ref=${branch}`\n\n    const response = await fetch(url, {\n      headers: {\n        Accept: 'application/vnd.github.v3+json',\n        // Authorization: `token ${process.env.GITHUB_TOKEN}`,\n      },\n    })\n\n    if (!response.ok) {\n      throw new Error(`Failed to fetch contents: ${response.status}`)\n    }\n\n    const contents: Array<GitHubContent> = await response.json()\n\n    return contents\n      .filter((item) => item.type === 'file' && item.name.endsWith('.md'))\n      .map((item) => ({\n        name: item.name.replace('.md', ''),\n        path: item.path,\n      }))\n  })\n```\n\n## Adding Syntax Highlighting with Shiki\n\nFor code blocks with syntax highlighting, integrate Shiki into your markdown processor:\n\n```tsx\n// src/utils/markdown.ts\nimport { codeToHtml } from 'shiki'\n\n// Process code blocks after parsing\nexport async function highlightCode(\n  code: string,\n  language: string,\n): Promise<string> {\n  return codeToHtml(code, {\n    lang: language,\n    themes: {\n      light: 'github-light',\n      dark: 'tokyo-night',\n    },\n  })\n}\n```\n\nThen handle code blocks in your Markdown component:\n\n```tsx\n// In your Markdown component's replace function\nif (domNode.name === 'pre') {\n  const codeElement = domNode.children.find(\n    (child) => child instanceof Element && child.name === 'code',\n  )\n  if (codeElement) {\n    const className = codeElement.attribs.class || ''\n    const language = className.replace('language-', '') || 'text'\n    const code = getText(codeElement)\n\n    return <CodeBlock code={code} language={language} />\n  }\n}\n```\n\n## Summary\n\n| Approach            | Best For                                  | Pros                                           | Cons                                      |\n| ------------------- | ----------------------------------------- | ---------------------------------------------- | ----------------------------------------- |\n| content-collections | Blog posts, static docs bundled with app  | Type-safe, build-time processing, fast runtime | Requires rebuild for content updates      |\n| Dynamic fetching    | External docs, frequently updated content | Always fresh, no rebuild needed                | Runtime overhead, requires error handling |\n\nChoose the approach that best fits your content update frequency and deployment workflow. For hybrid scenarios, you can use both methods in the same application.\n"
  },
  {
    "path": "docs/start/framework/react/guide/routing.md",
    "content": "---\nid: routing\ntitle: Routing\n---\n\nTanStack Start is built on top of TanStack Router, so all of the features of TanStack Router are available to you.\n\n> [!NOTE]\n> We highly recommend reading the [TanStack Router documentation](/router/latest/docs/framework/react/overview) to learn more about the features and capabilities of TanStack Router. What you learn here is more of a high-level overview of TanStack Router and how it works in Start.\n\n## The Router\n\nThe `router.tsx` file is the file that will dictate the behavior of TanStack Router used within Start. It's located in the `src` directory of your project.\n\n```\nsrc/\n├── router.tsx\n```\n\nHere, you can configure everything from the default [preloading functionality](/router/latest/docs/framework/react/guide/preloading) to [caching staleness](/router/latest/docs/framework/react/guide/data-loading).\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\n// You must export a getRouter function that\n// returns a new router instance each time\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n```\n\n## File-Based Routing\n\nStart uses TanStack Router's file-based routing approach to ensure proper code-splitting and advanced type-safety.\n\nYou can find your routes in the `src/routes` directory.\n\n```\nsrc/\n├── routes <-- This is where you put your routes\n│   ├── __root.tsx\n│   ├── index.tsx\n│   ├── about.tsx\n│   ├── posts.tsx\n│   ├── posts/$postId.tsx\n```\n\n## The Root Route\n\nThe root route is the top-most route in the entire tree and encapsulates all other routes as children. It's found in the `src/routes/__root.tsx` file and must be named `__root.tsx`.\n\n```\nsrc/\n├── routes\n│   ├── __root.tsx <-- The root route\n```\n\n- It has no path and is **always** matched\n- Its `component` is **always** rendered\n- This is where you render your document shell, e.g. `<html>`, `<body>`, etc.\n- Because it is **always rendered**, it is the perfect place to construct your application shell and take care of any global logic\n\n```tsx\n// src/routes/__root.tsx\nimport {\n  Outlet,\n  createRootRoute,\n  HeadContent,\n  Scripts,\n} from '@tanstack/react-router'\nimport type { ReactNode } from 'react'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: Readonly<{ children: ReactNode }>) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\nNotice the `Scripts` component at the bottom of the `<body>` tag. This is used to load all of the client-side JavaScript for the application and should always be included for proper functionality.\n\n## The HeadContent Component\n\nThe `HeadContent` component is used to render the head, title, meta, link, and head-related script tags of the document.\n\nIt should be **rendered in the `<head>` tag of your root route's layout.**\n\n## The Outlet Component\n\nThe `Outlet` component is used to render the next potentially matching child route. `<Outlet />` doesn't take any props and can be rendered anywhere within a route's component tree. If there is no matching child route, `<Outlet />` will render `null`.\n\n## The Scripts Component\n\nThe `Scripts` component is used to render the body scripts of the document.\n\nIt should be **rendered in the `<body>` tag of your root route's layout.**\n\n## Route Tree Generation\n\nYou may notice a `routeTree.gen.ts` file in your project.\n\n```\nsrc/\n├── routeTree.gen.ts <-- The generated route tree file\n```\n\nThis file is automatically generated when you run TanStack Start (via `npm run dev` or `npm run start`). This file contains the generated route tree and a handful of TS utilities that make TanStack Start's type-safety extremely fast and fully inferred.\n\n## Nested Routing\n\nTanStack Router uses nested routing to match the URL with the correct component tree to render.\n\nFor example, given the following routes:\n\n```\nroutes/\n├── __root.tsx <-- Renders the <Root> component\n├── posts.tsx <-- Renders the <Posts> component\n├── posts.$postId.tsx <-- Renders the <Post> component\n```\n\nAnd the URL: `/posts/123`\n\nThe component tree would look like this:\n\n```\n<Root>\n  <Posts>\n    <Post />\n  </Posts>\n</Root>\n```\n\n## Types of Routes\n\nThere are a few different types of routes that you can create in your project.\n\n- Index Routes - Matched when the URL is exactly the same as the route's path\n- Dynamic/Wildcard/Splat Routes - Dynamically capture part or all of the URL path into a variable to use in your application\n\nThere are also a few different utility route types that you can use to group and organize your routes\n\n- Pathless Layout Routes (Apply layout or logic to a group of routes without nesting them in a path)\n- Non-Nested Routes (Un-nest a route from its parents and render its own component tree)\n- Grouped Routes (Group routes together in a directory simply for organization, without affecting the path hierarchy)\n\n## Route Tree Configuration\n\nThe route tree is configured in the `src/routes` directory.\n\n## Creating File Routes\n\nTo create a route, create a new file that corresponds to the path of the route you want to create. For example:\n\n| Path             | Filename            | Type           |\n| ---------------- | ------------------- | -------------- |\n| `/`              | `index.tsx`         | Index Route    |\n| `/about`         | `about.tsx`         | Static Route   |\n|                  | `posts.tsx`         | \"Layout\" Route |\n| `/posts/`        | `posts/index.tsx`   | Index Route    |\n| `/posts/:postId` | `posts/$postId.tsx` | Dynamic Route  |\n| `/rest/*`        | `rest/$.tsx`        | Wildcard Route |\n\n## Defining Routes\n\nTo define a route, use the `createFileRoute` function to export the route as the `Route` variable.\n\nFor example, to handle the `/posts/:postId` route, you would create a file named `posts/$postId.tsx` here:\n\n```\nsrc/\n├── routes\n│   ├── posts/$postId.tsx\n```\n\nThen, define the route like this:\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostComponent,\n})\n```\n\n> [!NOTE]\n> The path string passed to `createFileRoute` is **automatically written and managed by the router for you via the TanStack Router Bundler Plugin or Router CLI.** So, as you create new routes, move routes around or rename routes, the path will be updated for you automatically.\n\n## This is just the \"start\"\n\nThis has been just a high-level overview of how to configure routes using TanStack Router. For more detailed information, please refer to the [TanStack Router documentation](/router/latest/docs/framework/react/routing/file-based-routing).\n"
  },
  {
    "path": "docs/start/framework/react/guide/selective-ssr.md",
    "content": "---\nid: selective-ssr\ntitle: Selective Server-Side Rendering (SSR)\n---\n\n## What is Selective SSR?\n\nIn TanStack Start, routes matching the initial request are rendered on the server by default. This means `beforeLoad` and `loader` are executed on the server, followed by rendering the route components. The resulting HTML is sent to the client, which hydrates the markup into a fully interactive application.\n\nHowever, there are cases where you might want to disable SSR for certain routes or all routes, such as:\n\n- When `beforeLoad` or `loader` requires browser-only APIs (e.g., `localStorage`).\n- When the route component depends on browser-only APIs (e.g., `canvas`).\n\nTanStack Start's Selective SSR feature lets you configure:\n\n- Which routes should execute `beforeLoad` or `loader` on the server.\n- Which route components should be rendered on the server.\n\n## How does this compare to SPA mode?\n\nTanStack Start's [SPA mode](./spa-mode) completely disables server-side execution of `beforeLoad` and `loader`, as well as server-side rendering of route components. Selective SSR allows you to configure server-side handling on a per-route basis, either statically or dynamically.\n\n## Configuration\n\nYou can control how a route is handled during the initial server request using the `ssr` property. If this property is not set, it defaults to `true`. You can change this default using the `defaultSsr` option in `createStart`:\n\n```tsx\n// src/start.ts\nimport { createStart } from '@tanstack/react-start'\n\nexport const startInstance = createStart(() => ({\n  // Disable SSR by default\n  defaultSsr: false,\n}))\n```\n\n### `ssr: true`\n\nThis is the default behavior unless otherwise configured. On the initial request, it will:\n\n- Run `beforeLoad` on the server and send the resulting context to the client.\n- Run `loader` on the server and send the loader data to the client.\n- Render the component on the server and send the HTML markup to the client.\n\n```tsx\n// src/routes/posts/$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  ssr: true,\n  beforeLoad: () => {\n    console.log('Executes on the server during the initial request')\n    console.log('Executes on the client for subsequent navigation')\n  },\n  loader: () => {\n    console.log('Executes on the server during the initial request')\n    console.log('Executes on the client for subsequent navigation')\n  },\n  component: () => <div>This component is rendered on the server</div>,\n})\n```\n\n### `ssr: false`\n\nThis disables server-side:\n\n- Execution of the route's `beforeLoad` and `loader`.\n- Rendering of the route component.\n\n```tsx\n// src/routes/posts/$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  ssr: false,\n  beforeLoad: () => {\n    console.log('Executes on the client during hydration')\n  },\n  loader: () => {\n    console.log('Executes on the client during hydration')\n  },\n  component: () => <div>This component is rendered on the client</div>,\n})\n```\n\n### `ssr: 'data-only'`\n\nThis hybrid option will:\n\n- Run `beforeLoad` on the server and send the resulting context to the client.\n- Run `loader` on the server and send the loader data to the client.\n- Disable server-side rendering of the route component.\n\n```tsx\n// src/routes/posts/$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  ssr: 'data-only',\n  beforeLoad: () => {\n    console.log('Executes on the server during the initial request')\n    console.log('Executes on the client for subsequent navigation')\n  },\n  loader: () => {\n    console.log('Executes on the server during the initial request')\n    console.log('Executes on the client for subsequent navigation')\n  },\n  component: () => <div>This component is rendered on the client</div>,\n})\n```\n\n### Functional Form\n\nFor more flexibility, you can use the functional form of the `ssr` property to decide at runtime whether to SSR a route:\n\n```tsx\n// src/routes/docs/$docType/$docId.tsx\nexport const Route = createFileRoute('/docs/$docType/$docId')({\n  validateSearch: z.object({ details: z.boolean().optional() }),\n  ssr: ({ params, search }) => {\n    if (params.status === 'success' && params.value.docType === 'sheet') {\n      return false\n    }\n    if (search.status === 'success' && search.value.details) {\n      return 'data-only'\n    }\n  },\n  beforeLoad: () => {\n    console.log('Executes on the server depending on the result of ssr()')\n  },\n  loader: () => {\n    console.log('Executes on the server depending on the result of ssr()')\n  },\n  component: () => <div>This component is rendered on the client</div>,\n})\n```\n\nThe `ssr` function runs only on the server during the initial request and is stripped from the client bundle.\n\n`search` and `params` are passed in after validation as a discriminated union:\n\n```tsx\nparams:\n    | { status: 'success'; value: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>> }\n    | { status: 'error'; error: unknown }\nsearch:\n    | { status: 'success'; value: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>> }\n    | { status: 'error'; error: unknown }\n```\n\nIf validation fails, `status` will be `error` and `error` will contain the failure details. Otherwise, `status` will be `success` and `value` will contain the validated data.\n\n### Inheritance\n\nAt runtime, a child route inherits the Selective SSR configuration of its parent. However, the inherited value can only be changed to be more restrictive (i.e. `true` to `data-only` or `false` and `data-only` to `false`). For example:\n\n```tsx\nroot { ssr: undefined }\n  posts { ssr: false }\n     $postId { ssr: true }\n```\n\n- `root` defaults to `ssr: true`.\n- `posts` explicitly sets `ssr: false`, so neither `beforeLoad` nor `loader` will run on the server, and the route component won't be rendered on the server.\n- `$postId` sets `ssr: true`, but inherits `ssr: false` from its parent. Because the inherited value can only be changed to be more restrictive, `ssr: true` has no effect and the inherited `ssr: false` will remain.\n\nAnother example:\n\n```tsx\nroot { ssr: undefined }\n  posts { ssr: 'data-only' }\n     $postId { ssr: true }\n       details { ssr: false }\n```\n\n- `root` defaults to `ssr: true`.\n- `posts` sets `ssr: 'data-only'`, so `beforeLoad` and `loader` run on the server, but the route component isn't rendered on the server.\n- `$postId` sets `ssr: true`, but inherits `ssr: 'data-only'` from its parent.\n- `details` sets `ssr: false`, so neither `beforeLoad` nor `loader` will run on the server, and the route component won't be rendered on the server. Here the inherited value is changed to be more restrictive, and therefore, the `ssr: false` will override the inherited value.\n\n## Fallback Rendering\n\nFor the first route with `ssr: false` or `ssr: 'data-only'`, the server will render the route's `pendingComponent` as a fallback. If `pendingComponent` isn't configured, the `defaultPendingComponent` will be rendered. If neither is configured, no fallback will be rendered.\n\nOn the client during hydration, this fallback will be displayed for at least `minPendingMs` (or `defaultPendingMinMs` if not configured), even if the route doesn't have `beforeLoad` or `loader` defined.\n\n## How to disable SSR of the root route?\n\nYou can disable server side rendering of the root route component, however the `<html>` shell still needs to be rendered on the server. This shell is configured via the `shellComponent` property and takes a single property `children`. The `shellComponent` is always SSRed and is wrapping around the root `component`, the root `errorComponent` or the root `notFound` component respectively.\n\nA minimal setup of a root route with disabled SSR for the route component looks like this:\n\n```tsx\nimport * as React from 'react'\n\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  shellComponent: RootShell,\n  component: RootComponent,\n  errorComponent: () => <div>Error</div>,\n  notFoundComponent: () => <div>Not found</div>,\n  ssr: false, // or `defaultSsr: false` on the router\n})\n\nfunction RootShell({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n\nfunction RootComponent() {\n  return (\n    <div>\n      <h1>This component will be rendered on the client</h1>\n      <Outlet />\n    </div>\n  )\n}\n```\n"
  },
  {
    "path": "docs/start/framework/react/guide/seo.md",
    "content": "---\nid: seo\ntitle: SEO\n---\n\n> [!NOTE]\n> Looking to optimize for AI assistants and LLMs? See the [LLM Optimization (LLMO) guide](./llmo).\n\n## What is SEO, really?\n\nSEO (Search Engine Optimization) is often misunderstood as simply \"showing up on Google\" or a checkbox that a library can magically provide. In reality, SEO is a broad discipline focused on delivering valuable content that people need and making it easy for them to find.\n\n**Technical SEO** is a subset of SEO that developers interact with most directly. It involves using tools and APIs that satisfy the technical requirements of search engines, crawlers, rankers, and even LLMs. When someone says a framework has \"good SEO support,\" they typically mean it provides the tools to make this process straightforward.\n\nTanStack Start provides comprehensive technical SEO capabilities, but you still need to put in the work to use them effectively.\n\n## What TanStack Start Provides\n\nTanStack Start gives you the building blocks for technical SEO:\n\n- **Server-Side Rendering (SSR)** - Ensures crawlers receive fully rendered HTML\n- **Static Prerendering** - Pre-generates pages for optimal performance and crawlability\n- **Document Head Management** - Full control over meta tags, titles, and structured data\n- **Performance** - Fast load times through code-splitting, streaming, and optimal bundling\n\n## Document Head Management\n\nThe `head` property on routes is your primary tool for SEO. It allows you to set page titles, meta descriptions, Open Graph tags, and more.\n\n### Basic Meta Tags\n\n```tsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  head: () => ({\n    meta: [\n      { title: 'My App - Home' },\n      {\n        name: 'description',\n        content: 'Welcome to My App, a platform for...',\n      },\n    ],\n  }),\n  component: HomePage,\n})\n```\n\n### Dynamic Meta Tags\n\nUse loader data to generate dynamic meta tags for content pages:\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [\n      { title: loaderData.post.title },\n      { name: 'description', content: loaderData.post.excerpt },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n### Open Graph and Social Sharing\n\nOpen Graph tags control how your pages appear when shared on social media:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [\n      { title: loaderData.post.title },\n      { name: 'description', content: loaderData.post.excerpt },\n      // Open Graph\n      { property: 'og:title', content: loaderData.post.title },\n      { property: 'og:description', content: loaderData.post.excerpt },\n      { property: 'og:image', content: loaderData.post.coverImage },\n      { property: 'og:type', content: 'article' },\n      // Twitter Card\n      { name: 'twitter:card', content: 'summary_large_image' },\n      { name: 'twitter:title', content: loaderData.post.title },\n      { name: 'twitter:description', content: loaderData.post.excerpt },\n      { name: 'twitter:image', content: loaderData.post.coverImage },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n### Canonical URLs\n\nCanonical URLs help prevent duplicate content issues:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  head: ({ params }) => ({\n    links: [\n      {\n        rel: 'canonical',\n        href: `https://myapp.com/posts/${params.postId}`,\n      },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n## Structured Data (JSON-LD)\n\nStructured data helps search engines understand your content and can enable rich results in search:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [{ title: loaderData.post.title }],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'Article',\n          headline: loaderData.post.title,\n          description: loaderData.post.excerpt,\n          image: loaderData.post.coverImage,\n          author: {\n            '@type': 'Person',\n            name: loaderData.post.author.name,\n          },\n          datePublished: loaderData.post.publishedAt,\n        }),\n      },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n## Server-Side Rendering\n\nSSR is enabled by default in TanStack Start. This ensures that search engine crawlers receive fully rendered HTML content, which is critical for SEO.\n\n```tsx\n// SSR is automatic - your pages are rendered on the server\nexport const Route = createFileRoute('/about')({\n  component: AboutPage,\n})\n```\n\nFor routes that don't need SSR, you can disable it selectively. However, be aware this may impact SEO for those pages:\n\n```tsx\n// Only disable SSR for pages that don't need SEO\nexport const Route = createFileRoute('/dashboard')({\n  ssr: false, // Dashboard doesn't need to be indexed\n  component: DashboardPage,\n})\n```\n\nSee the [Selective SSR guide](./selective-ssr) for more details.\n\n## Static Prerendering\n\nFor content that doesn't change frequently, static prerendering generates HTML at build time for optimal performance:\n\n```ts\n// vite.config.ts\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      prerender: {\n        enabled: true,\n        crawlLinks: true,\n      },\n    }),\n  ],\n})\n```\n\nPrerendered pages load faster and are easily crawlable. See the [Static Prerendering guide](./static-prerendering) for configuration options.\n\n## Sitemaps\n\n### Built-in Sitemap Generation\n\nTanStack Start can automatically generate a sitemap when you enable prerendering with link crawling:\n\n```ts\n// vite.config.ts\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      prerender: {\n        enabled: true,\n        crawlLinks: true, // Discovers all linkable pages\n      },\n      sitemap: {\n        enabled: true,\n        host: 'https://myapp.com',\n      },\n    }),\n  ],\n})\n```\n\nThe sitemap is generated at build time by crawling all discoverable pages from your routes. This is the recommended approach for static or mostly-static sites.\n\n### Static Sitemap\n\nFor simple sites, you can also place a static `sitemap.xml` file in your `public` directory:\n\n```xml\n<!-- public/sitemap.xml -->\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url>\n    <loc>https://myapp.com/</loc>\n    <changefreq>daily</changefreq>\n    <priority>1.0</priority>\n  </url>\n  <url>\n    <loc>https://myapp.com/about</loc>\n    <changefreq>monthly</changefreq>\n  </url>\n</urlset>\n```\n\nThis approach works well when your site structure is known and doesn't change often.\n\n### Dynamic Sitemap\n\nFor sites with dynamic content that can't be discovered at build time, you can create a dynamic sitemap using a [server route](./server-routes). Consider caching this at your CDN for performance:\n\n```ts\n// src/routes/sitemap[.]xml.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/sitemap.xml')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const posts = await fetchAllPosts()\n\n        const sitemap = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url>\n    <loc>https://myapp.com/</loc>\n    <changefreq>daily</changefreq>\n    <priority>1.0</priority>\n  </url>\n  ${posts\n    .map(\n      (post) => `\n  <url>\n    <loc>https://myapp.com/posts/${post.id}</loc>\n    <lastmod>${post.updatedAt}</lastmod>\n    <changefreq>weekly</changefreq>\n  </url>`,\n    )\n    .join('')}\n</urlset>`\n\n        return new Response(sitemap, {\n          headers: {\n            'Content-Type': 'application/xml',\n          },\n        })\n      },\n    },\n  },\n})\n```\n\n## robots.txt\n\n### Static robots.txt\n\nThe simplest approach is to place a static `robots.txt` file in your `public` directory:\n\n```txt\n// public/robots.txt\nUser-agent: *\nAllow: /\n\nSitemap: https://myapp.com/sitemap.xml\n```\n\nThis file will be served automatically at `/robots.txt`. This is the most common approach for most sites.\n\n### Dynamic robots.txt\n\nFor more complex scenarios (e.g., different rules per environment), you can create a robots.txt file using a [server route](./server-routes):\n\n```ts\n// src/routes/robots[.]txt.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/robots.txt')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const robots = `User-agent: *\nAllow: /\n\nSitemap: https://myapp.com/sitemap.xml`\n\n        return new Response(robots, {\n          headers: {\n            'Content-Type': 'text/plain',\n          },\n        })\n      },\n    },\n  },\n})\n```\n\n## Best Practices\n\n### Performance Matters\n\nPage speed is a ranking factor. TanStack Start helps with:\n\n- **Automatic code-splitting** - Only load the JavaScript needed for each page\n- **Streaming SSR** - Start sending HTML to the browser immediately\n- **Preloading** - Prefetch routes before users navigate to them\n\n### Content is King\n\nTechnical SEO is just one piece of the puzzle. The most important factors are:\n\n- **Quality content** - Create content that provides value to users\n- **Clear site structure** - Organize your routes logically\n- **Descriptive URLs** - Use meaningful path segments (`/posts/my-great-article` vs `/posts/123`)\n- **Internal linking** - Help users and crawlers discover your content\n\n### Test Your Implementation\n\nUse these tools to verify your SEO implementation:\n\n- [Google Search Console](https://search.google.com/search-console) - Monitor indexing and search performance\n- [Google Rich Results Test](https://search.google.com/test/rich-results) - Validate structured data\n- [Open Graph Debugger](https://developers.facebook.com/tools/debug/) - Preview social sharing cards\n- Browser DevTools - Inspect rendered HTML and meta tags\n\n### Track Your Rankings\n\nTo monitor your SEO performance over time, we recommend [Nozzle.io](https://nozzle.io?utm_source=tanstack). Nozzle provides enterprise-grade rank tracking that lets you monitor unlimited keywords, track SERP features, and analyze your visibility against competitors. Unlike traditional rank trackers, Nozzle stores the entire SERP for every query, giving you complete data to understand how your pages perform in search results.\n"
  },
  {
    "path": "docs/start/framework/react/guide/server-entry-point.md",
    "content": "---\nid: server-entry-point\ntitle: Server Entry Point\n---\n\n# Server Entry Point\n\n> [!NOTE]\n> The server entry point is **optional** out of the box. If not provided, TanStack Start will automatically handle the server entry point for you using the below as a default.\n\nThe Server Entry Point supports the universal fetch handler format, commonly used by [Cloudflare Workers](https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/) and other WinterCG-compatible runtimes.\n\nTo ensure interoperability, the default export must conform to our `ServerEntry` interface:\n\n```ts\nexport default {\n  fetch(req: Request, opts?: RequestOptions): Response | Promise<Response> {\n    // ...\n  },\n}\n```\n\nTanStack Start exposes a wrapper to make creation type-safe. This is done in the `src/server.ts` file.\n\n```tsx\n// src/server.ts\nimport handler, { createServerEntry } from '@tanstack/react-start/server-entry'\n\nexport default createServerEntry({\n  fetch(request) {\n    return handler.fetch(request)\n  },\n})\n```\n\nWhether we are statically generating our app or serving it dynamically, the `server.ts` file is the entry point for doing all SSR-related work as well as for handling server routes and server function requests.\n\n## Custom Server Handlers\n\nYou can create custom server handlers to modify how your application is rendered:\n\n```tsx\n// src/server.ts\nimport {\n  createStartHandler,\n  defaultStreamHandler,\n  defineHandlerCallback,\n} from '@tanstack/react-start/server'\nimport { createServerEntry } from '@tanstack/react-start/server-entry'\n\nconst customHandler = defineHandlerCallback((ctx) => {\n  // add custom logic here\n  return defaultStreamHandler(ctx)\n})\n\nconst fetch = createStartHandler(customHandler)\n\nexport default createServerEntry({\n  fetch,\n})\n```\n\n## Request context\n\nWhen your server needs to pass additional, typed data into request handlers (for example, authenticated user info, a database connection, or per-request flags), register a request context type via TypeScript module augmentation. The registered context is delivered as the second argument to the server `fetch` handler and is available throughout the server-side middleware chain — including global middleware, request/function middleware, server routes, server functions, and the router itself.\n\nTo add types for your request context, augment the `Register` interface from `@tanstack/react-start` with a `server.requestContext` property. The runtime `context` you pass to `handler.fetch` will then match that type. Example:\n\n```tsx\nimport handler, { createServerEntry } from '@tanstack/react-start/server-entry'\n\ntype MyRequestContext = {\n  hello: string\n  foo: number\n}\n\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    server: {\n      requestContext: MyRequestContext\n    }\n  }\n}\n\nexport default createServerEntry({\n  async fetch(request) {\n    return handler.fetch(request, { context: { hello: 'world', foo: 123 } })\n  },\n})\n```\n\n## Server Configuration\n\nThe server entry point is where you can configure server-specific behavior:\n\n- Request/response middleware\n- Custom error handling\n- Authentication logic\n- Database connections\n- Logging and monitoring\n\nThis flexibility allows you to customize how your TanStack Start application handles server-side rendering while maintaining the framework's conventions.\n\n## Cloudflare Workers\n\nWhen deploying to Cloudflare Workers, you can extend `server.ts` to handle additional Workers features like queues, scheduled events, and Durable Objects. For a comprehensive guide, see the [Cloudflare Workers documentation for TanStack Start](https://developers.cloudflare.com/workers/framework-guides/web-apps/tanstack-start/#custom-entrypoints).\n"
  },
  {
    "path": "docs/start/framework/react/guide/server-functions.md",
    "content": "---\nid: server-functions\ntitle: Server Functions\n---\n\n## What are Server Functions?\n\nServer functions let you define server-only logic that can be called from anywhere in your application - loaders, components, hooks, or other server functions. They run on the server but can be invoked from client code seamlessly.\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const getServerTime = createServerFn().handler(async () => {\n  // This runs only on the server\n  return new Date().toISOString()\n})\n\n// Call from anywhere - components, loaders, hooks, etc.\nconst time = await getServerTime()\n```\n\nServer functions provide server capabilities (database access, environment variables, file system) while maintaining type safety across the network boundary.\n\n## Basic Usage\n\nServer functions are created with `createServerFn()` and can specify HTTP method:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\n\n// GET request (default)\nexport const getData = createServerFn().handler(async () => {\n  return { message: 'Hello from server!' }\n})\n\n// POST request\nexport const saveData = createServerFn({ method: 'POST' }).handler(async () => {\n  // Server-only logic\n  return { success: true }\n})\n```\n\n## Where to Call Server Functions\n\nCall server functions from:\n\n- **Route loaders** - Perfect for data fetching\n- **Components** - Use with `useServerFn()` hook\n- **Other server functions** - Compose server logic\n- **Event handlers** - Handle form submissions, clicks, etc.\n\n```tsx\n// In a route loader\nexport const Route = createFileRoute('/posts')({\n  loader: () => getPosts(),\n})\n\n// In a component\nfunction PostList() {\n  const getPosts = useServerFn(getServerPosts)\n\n  const { data } = useQuery({\n    queryKey: ['posts'],\n    queryFn: () => getPosts(),\n  })\n}\n```\n\n## File Organization\n\nFor larger applications, consider organizing server-side code into separate files. Here's one approach:\n\n```\nsrc/utils/\n├── users.functions.ts   # Server function wrappers (createServerFn)\n├── users.server.ts      # Server-only helpers (DB queries, internal logic)\n└── schemas.ts           # Shared validation schemas (client-safe)\n```\n\n- **`.functions.ts`** - Export `createServerFn` wrappers, safe to import anywhere\n- **`.server.ts`** - Server-only code, only imported inside server function handlers\n- **`.ts`** (no suffix) - Client-safe code (types, schemas, constants)\n\n### Example\n\n```tsx\n// users.server.ts - Server-only helpers\nimport { db } from '~/db'\n\nexport async function findUserById(id: string) {\n  return db.query.users.findFirst({ where: eq(users.id, id) })\n}\n```\n\n```tsx\n// users.functions.ts - Server functions\nimport { createServerFn } from '@tanstack/react-start'\nimport { findUserById } from './users.server'\n\nexport const getUser = createServerFn({ method: 'GET' })\n  .inputValidator((data: { id: string }) => data)\n  .handler(async ({ data }) => {\n    return findUserById(data.id)\n  })\n```\n\n### Static Imports Are Safe\n\nServer functions can be statically imported in any file, including client components:\n\n```tsx\n// ✅ Safe - build process handles environment shaking\nimport { getUser } from '~/utils/users.functions'\n\nfunction UserProfile({ id }) {\n  const { data } = useQuery({\n    queryKey: ['user', id],\n    queryFn: () => getUser({ data: { id } }),\n  })\n}\n```\n\nThe build process replaces server function implementations with RPC stubs in client bundles. The actual server code never reaches the browser.\n\n> [!WARNING]\n> Avoid dynamic imports for server functions:\n>\n> ```tsx\n> // ❌ Can cause bundler issues\n> const { getUser } = await import('~/utils/users.functions')\n> ```\n\n## Parameters & Validation\n\nServer functions accept a single `data` parameter. Since they cross the network boundary, validation ensures type safety and runtime correctness.\n\n### Basic Parameters\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const greetUser = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(async ({ data }) => {\n    return `Hello, ${data.name}!`\n  })\n\nawait greetUser({ data: { name: 'John' } })\n```\n\n### Validation with Zod\n\nFor robust validation, use schema libraries like Zod:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\nimport { z } from 'zod'\n\nconst UserSchema = z.object({\n  name: z.string().min(1),\n  age: z.number().min(0),\n})\n\nexport const createUser = createServerFn({ method: 'POST' })\n  .inputValidator(UserSchema)\n  .handler(async ({ data }) => {\n    // data is fully typed and validated\n    return `Created user: ${data.name}, age ${data.age}`\n  })\n```\n\n### Form Data\n\nHandle form submissions with FormData:\n\n```tsx\nexport const submitForm = createServerFn({ method: 'POST' })\n  .inputValidator((data) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Expected FormData')\n    }\n\n    return {\n      name: data.get('name')?.toString() || '',\n      email: data.get('email')?.toString() || '',\n    }\n  })\n  .handler(async ({ data }) => {\n    // Process form data\n    return { success: true }\n  })\n```\n\n## Error Handling & Redirects\n\nServer functions can throw errors, redirects, and not-found responses that are handled automatically when called from route lifecycles or components using `useServerFn()`.\n\n### Basic Errors\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const riskyFunction = createServerFn().handler(async () => {\n  if (Math.random() > 0.5) {\n    throw new Error('Something went wrong!')\n  }\n  return { success: true }\n})\n\n// Errors are serialized to the client\ntry {\n  await riskyFunction()\n} catch (error) {\n  console.log(error.message) // \"Something went wrong!\"\n}\n```\n\n### Redirects\n\nUse redirects for authentication, navigation, etc:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\nimport { redirect } from '@tanstack/react-router'\n\nexport const requireAuth = createServerFn().handler(async () => {\n  const user = await getCurrentUser()\n\n  if (!user) {\n    throw redirect({ to: '/login' })\n  }\n\n  return user\n})\n```\n\n### Not Found\n\nThrow not-found errors for missing resources:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\nimport { notFound } from '@tanstack/react-router'\n\nexport const getPost = createServerFn()\n  .inputValidator((data: { id: string }) => data)\n  .handler(async ({ data }) => {\n    const post = await db.findPost(data.id)\n\n    if (!post) {\n      throw notFound()\n    }\n\n    return post\n  })\n```\n\n## Advanced Topics\n\nFor more advanced server function patterns and features, see these dedicated guides:\n\n### Server Context & Request Handling\n\nAccess request headers, cookies, and customize responses:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\nimport {\n  getRequest,\n  getRequestHeader,\n  setResponseHeaders,\n  setResponseStatus,\n} from '@tanstack/react-start/server'\n\nexport const getCachedData = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    // Access the incoming request\n    const request = getRequest()\n    const authHeader = getRequestHeader('Authorization')\n\n    // Set response headers (e.g., for caching)\n    setResponseHeaders(\n      new Headers({\n        'Cache-Control': 'public, max-age=300',\n        'CDN-Cache-Control': 'max-age=3600, stale-while-revalidate=600',\n      }),\n    )\n\n    // Optionally set status code\n    setResponseStatus(200)\n\n    return fetchData()\n  },\n)\n```\n\nAvailable utilities:\n\n- `getRequest()` - Access the full Request object\n- `getRequestHeader(name)` - Read a specific request header\n- `setResponseHeader(name, value)` - Set a single response header\n- `setResponseHeaders(headers)` - Set multiple response headers via Headers object\n- `setResponseStatus(code)` - Set the HTTP status code\n\n### Streaming\n\nStream typed data from server functions to the client. See the [Streaming Data from Server Functions guide](./streaming-data-from-server-functions).\n\n### Raw Responses\n\nReturn `Response` objects binary data, or custom content types.\n\n### Progressive Enhancement\n\nUse server functions without JavaScript by leveraging the `.url` property with HTML forms.\n\n### Middleware\n\nCompose server functions with middleware for authentication, logging, and shared logic. See the [Middleware guide](./middleware.md).\n\n### Static Server Functions\n\nCache server function results at build time for static generation. See [Static Server Functions](./static-server-functions).\n\n### Request Cancellation\n\nHandle request cancellation with `AbortSignal` for long-running operations.\n\n### Function ID generation for production build\n\nServer functions are addressed by a generated, stable function ID under the hood. These IDs are embedded into the client/SSR builds and used by the server to locate and import the correct module at runtime.\n\nBy default, IDs are SHA256 hashes of the same seed to keep bundles compact and avoid leaking file paths.\nIf two server functions end up with the same ID (including when using a custom generator), the system de-duplicates by appending an incrementing suffix like `_1`, `_2`, etc.\n\nCustomization:\n\nYou can customize function ID generation for the production build by providing a `generateFunctionId` function when configuring the TanStack Start Vite plugin.\n\nPrefer deterministic inputs (filename + functionName) so IDs remain stable between builds.\n\nPlease note that this customization is **experimental** and subject to change.\n\nExample:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      serverFns: {\n        generateFunctionId: ({ filename, functionName }) => {\n          // Return a custom ID string\n          return crypto\n            .createHash('sha1')\n            .update(`${filename}--${functionName}`)\n            .digest('hex')\n\n          // If you return undefined, the default is used\n          // return undefined\n        },\n      },\n    }),\n    react(),\n  ],\n})\n```\n\n---\n\n> **Note**: Server functions use a compilation process that extracts server code from client bundles while maintaining seamless calling patterns. On the client, calls become `fetch` requests to the server.\n"
  },
  {
    "path": "docs/start/framework/react/guide/server-routes.md",
    "content": "---\nid: server-routes\ntitle: Server Routes\n---\n\nServer routes are a powerful feature of TanStack Start that allow you to create server-side endpoints in your application and are useful for handling raw HTTP requests, form submissions, user authentication, and much more.\n\nServer routes can be defined in your `./src/routes` directory of your project **right alongside your TanStack Router routes** and are automatically handled by the TanStack Start server.\n\nHere's what a simple server route looks like:\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World!')\n      },\n    },\n  },\n})\n```\n\n## Server Routes and App Routes\n\nBecause server routes can be defined in the same directory as your app routes, you can even use the same file for both!\n\n```tsx\n// routes/hello.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const body = await request.json()\n        return new Response(JSON.stringify({ message: `Hello, ${body.name}!` }))\n      },\n    },\n  },\n  component: HelloComponent,\n})\n\nfunction HelloComponent() {\n  const [reply, setReply] = useState('')\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          fetch('/hello', {\n            method: 'POST',\n            headers: {\n              'Content-Type': 'application/json',\n            },\n            body: JSON.stringify({ name: 'Tanner' }),\n          })\n            .then((res) => res.json())\n            .then((data) => setReply(data.message))\n        }}\n      >\n        Say Hello\n      </button>\n    </div>\n  )\n}\n```\n\n## File Route Conventions\n\nServer routes in TanStack Start follow the same file-based routing conventions as TanStack Router. This means that each file in your `routes` directory with a `server` property in the `createFileRoute` call will be treated as an API route. Here are a few examples:\n\n- `/routes/users.ts` will create an API route at `/users`\n- `/routes/users.index.ts` will **also** create an API route at `/users` (but will error if duplicate methods are defined)\n- `/routes/users/$id.ts` will create an API route at `/users/$id`\n- `/routes/users/$id/posts.ts` will create an API route at `/users/$id/posts`\n- `/routes/users.$id.posts.ts` will create an API route at `/users/$id/posts`\n- `/routes/api/file/$.ts` will create an API route at `/api/file/$`\n- `/routes/my-script[.]js.ts` will create an API route at `/my-script.js`\n\n## Unique Route Paths\n\nEach route can only have a single handler file associated with it. So, if you have a file named `routes/users.ts` which'd equal the request path of `/users`, you cannot have other files that'd also resolve to the same route. For example, the following files would all resolve to the same route and would error:\n\n- `/routes/users.index.ts`\n- `/routes/users.ts`\n- `/routes/users/index.ts`\n\n## Escaped Matching\n\nJust as with normal routes, server routes can match on escaped characters. For example, a file named `routes/users[.]json.ts` will create an API route at `/users.json`.\n\n## Pathless Layout Routes and Break-out Routes\n\nBecause of the unified routing system, pathless layout routes and break-out routes are supported for similar functionality around server route middleware.\n\n- Pathless layout routes can be used to add middleware to a group of routes\n- Break-out routes can be used to \"break out\" of parent middleware\n\n## Nested Directories vs File-names\n\nIn the examples above, you may have noticed that the file naming conventions are flexible and allow you to mix and match directories and file names. This is intentional and allows you to organize your Server routes in a way that makes sense for your application. You can read more about this in the [TanStack Router File-based Routing Guide](/router/latest/docs/framework/react/routing/file-based-routing#s-or-s).\n\n## Handling Server Route Requests\n\nServer route requests are handled by Start automatically by default or by Start's `createStartHandler` in your custom `src/server.ts` entry point file.\n\nThe start handler is responsible for matching an incoming request to a server route and executing the appropriate middleware and handler.\n\nIf you need to customize the server handler, you can do so by creating a custom handler and then passing the event to the start handler. See [The Server Entry Point](./server-entry-point).\n\n## Defining a Server Route\n\nServer routes are created by adding a `server` property to your `createFileRoute` call. The `server` property contains:\n\n- `handlers` - Either an object mapping HTTP methods to handler functions, or a function that receives `createHandlers` for more advanced use cases\n- `middleware` - Optional route-level middleware array that applies to all handlers\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World! from ' + request.url)\n      },\n    },\n  },\n})\n```\n\n## Defining Server Route Handlers\n\nYou can define handlers in two ways:\n\n- **Simple handlers**: Provide handler functions directly in a handlers object\n- **Handlers with middleware**: Use the `createHandlers` function to define handlers with middleware\n\n### Simple handlers\n\nFor simple use cases, you can provide handler functions directly in a handlers object.\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World! from ' + request.url)\n      },\n    },\n  },\n})\n```\n\n### Adding middleware to specific handlers\n\nFor more complex use cases, you can add middleware to specific handlers. This requires using the `createHandlers` function:\n\n```tsx\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: ({ createHandlers }) =>\n      createHandlers({\n        GET: {\n          middleware: [loggerMiddleware],\n          handler: async ({ request }) => {\n            return new Response('Hello, World! from ' + request.url)\n          },\n        },\n      }),\n  },\n})\n```\n\n### Adding middleware to all handlers\n\nYou can also add middleware that applies to all handlers in a route by using the `middleware` property at the server level:\n\n```tsx\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    middleware: [authMiddleware, loggerMiddleware], // Applies to all handlers\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World! from ' + request.url)\n      },\n      POST: async ({ request }) => {\n        const body = await request.json()\n        return new Response(`Hello, ${body.name}!`)\n      },\n    },\n  },\n})\n```\n\n### Combining route-level and handler-specific middleware\n\nYou can combine both approaches - route-level middleware will run first, followed by handler-specific middleware:\n\n```tsx\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    middleware: [authMiddleware], // Runs first for all handlers\n    handlers: ({ createHandlers }) =>\n      createHandlers({\n        GET: async ({ request }) => {\n          return new Response('Hello, World!')\n        },\n        POST: {\n          middleware: [validationMiddleware], // Runs after authMiddleware, only for POST\n          handler: async ({ request }) => {\n            const body = await request.json()\n            return new Response(`Hello, ${body.name}!`)\n          },\n        },\n      }),\n  },\n})\n```\n\n## Handler Context\n\nEach HTTP method handler receives an object with the following properties:\n\n- `request`: The incoming request object. You can read more about the `Request` object in the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Request).\n- `params`: An object containing the dynamic path parameters of the route. For example, if the route path is `/users/$id`, and the request is made to `/users/123`, then `params` will be `{ id: '123' }`. We'll cover dynamic path parameters and wildcard parameters later in this guide.\n- `context`: An object containing the context of the request. This is useful for passing data between middleware.\n\nOnce you've processed the request, you can return a `Response` object or `Promise<Response>` or even use any of the helpers from `@tanstack/react-start` to manipulate the response.\n\n## Dynamic Path Params\n\nServer routes support dynamic path parameters in the same way as TanStack Router. For example, a file named `routes/users/$id.ts` will create an API route at `/users/$id` that accepts a dynamic `id` parameter.\n\n```ts\n// routes/users/$id.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ params }) => {\n        const { id } = params\n        return new Response(`User ID: ${id}`)\n      },\n    },\n  },\n})\n\n// Visit /users/123 to see the response\n// User ID: 123\n```\n\nYou can also have multiple dynamic path parameters in a single route. For example, a file named `routes/users/$id/posts/$postId.ts` will create an API route at `/users/$id/posts/$postId` that accepts two dynamic parameters.\n\n```ts\n// routes/users/$id/posts/$postId.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/users/$id/posts/$postId')({\n  server: {\n    handlers: {\n      GET: async ({ params }) => {\n        const { id, postId } = params\n        return new Response(`User ID: ${id}, Post ID: ${postId}`)\n      },\n    },\n  },\n})\n\n// Visit /users/123/posts/456 to see the response\n// User ID: 123, Post ID: 456\n```\n\n## Wildcard/Splat Param\n\nServer routes also support wildcard parameters at the end of the path, which are denoted by a `$` followed by nothing. For example, a file named `routes/file/$.ts` will create an API route at `/file/$` that accepts a wildcard parameter.\n\n```ts\n// routes/file/$.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/file/$')({\n  server: {\n    handlers: {\n      GET: async ({ params }) => {\n        const { _splat } = params\n        return new Response(`File: ${_splat}`)\n      },\n    },\n  },\n})\n\n// Visit /file/hello.txt to see the response\n// File: hello.txt\n```\n\n## Handling requests with a body\n\nTo handle POST requests,you can add a `POST` handler to the route object. The handler will receive the request object as the first argument, and you can access the request body using the `request.json()` method.\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const body = await request.json()\n        return new Response(`Hello, ${body.name}!`)\n      },\n    },\n  },\n})\n\n// Send a POST request to /hello with a JSON body like { \"name\": \"Tanner\" }\n// Hello, Tanner!\n```\n\nThis also applies to other HTTP methods like `PUT`, `PATCH`, and `DELETE`. You can add handlers for these methods in the route object and access the request body using the appropriate method.\n\nIt's important to remember that the `request.json()` method returns a `Promise` that resolves to the parsed JSON body of the request. You need to `await` the result to access the body.\n\nThis is a common pattern for handling POST requests in Server routes/ You can also use other methods like `request.text()` or `request.formData()` to access the body of the request.\n\n## Responding with JSON\n\nWhen returning JSON using a Response object, this is a common pattern:\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response(JSON.stringify({ message: 'Hello, World!' }), {\n          headers: {\n            'Content-Type': 'application/json',\n          },\n        })\n      },\n    },\n  },\n})\n\n// Visit /hello to see the response\n// {\"message\":\"Hello, World!\"}\n```\n\n## Using the `Response.json` helper function\n\nOr you can use the [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) helper function to automatically set the `Content-Type` header to `application/json` and serialize the JSON object for you.\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return Response.json({ message: 'Hello, World!' })\n      },\n    },\n  },\n})\n\n// Visit /hello to see the response\n// {\"message\":\"Hello, World!\"}\n```\n\n## Responding with a status code\n\nYou can set the status code of the response by passing it as a property of the second argument to the `Response` constructor\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        const user = await findUser(params.id)\n        if (!user) {\n          return new Response('User not found', {\n            status: 404,\n          })\n        }\n        return Response.json(user)\n      },\n    },\n  },\n})\n```\n\nIn this example, we're returning a `404` status code if the user is not found. You can set any valid HTTP status code using this method.\n\n## Setting headers in the response\n\nSometimes you may need to set headers in the response. You can do this by passing an object as the second argument to the `Response` constructor.\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World!', {\n          headers: {\n            'Content-Type': 'text/plain',\n          },\n        })\n      },\n    },\n  },\n})\n// Visit /hello to see the response\n// Hello, World!\n```\n"
  },
  {
    "path": "docs/start/framework/react/guide/spa-mode.md",
    "content": "---\nid: spa-mode\ntitle: SPA mode\n---\n\n## What the heck is SPA mode?\n\nFor applications that do not require SSR for either SEO, crawlers, or performance reasons, it may be desirable to ship static HTML to your users containing the \"shell\" of your application (or even prerendered HTML for specific routes) that contain the necessary `html`, `head`, and `body` tags to bootstrap your application only on the client.\n\n## Why use Start without SSR?\n\n**No SSR doesn't mean giving up server-side features!** SPA modes actually pair very nicely with server-side features like server functions and/or server routes or even other external APIs. It **simply means that the initial document will not contain the fully rendered HTML of your application until it has been rendered on the client using JavaScript**.\n\n## Benefits of SPA mode\n\n- **Easier to deploy** - A CDN that can serve static assets is all you need.\n- **Cheaper** to host - CDNs are cheap compared to Lambda functions or long-running processes.\n- **Client-side Only is simpler** - No SSR means less to go wrong with hydration, rendering, and routing.\n\n## Caveats of SPA mode\n\n- **Slower time to full content** - Time to full content is longer since all JS must download and execute before anything below the shell can be rendered.\n- **Less SEO friendly** - Robots, crawlers and link unfurlers _may_ have a harder time indexing your application unless they are configured to execute JS and your application can render within a reasonable amount of time.\n\n## How does it work?\n\nAfter enabling the SPA mode, running a Start build will have an additional prerendering step afterwards to generate the shell. This is done by:\n\n- **Prerendering** your application's **root route only**\n- Where your application would normally render your matched routes, your router's configured **pending fallback component is rendered instead**.\n- The resulting HTML is stored to a static HTML page called `/_shell.html` (configurable)\n- Default rewrites are configured to redirect all 404 requests to the SPA mode shell\n\n> [!NOTE]\n> Other routes may also be prerendered and it is recommended to prerender as much as you can in SPA mode, but this is not required for SPA mode to work.\n\n## Configuring SPA mode\n\nTo configure SPA mode, there are a few options you can add to your Start plugin's options:\n\n```tsx\n// vite.config.ts\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      spa: {\n        enabled: true,\n      },\n    }),\n  ],\n})\n```\n\n## Use Necessary Redirects\n\nDeploying a purely client-side SPA to a host or CDN often requires the use of redirects to ensure that urls are properly rewritten to the SPA shell. The goal of any deployment should include these priorities in this order:\n\n1. Ensure that static assets will always be served if they exist, e.g. /about.html. This is usually the default behavior for most CDNs\n2. (Optional) Allow-list specific subpaths to be routed through to any dynamic server handlers, e.g. /api/\\*\\* (More on this below)\n3. Ensure that all 404 requests are rewritten to the SPA shell, e.g. a catch-all redirect to /\\_shell.html (or if you have configured your shell output path to be something custom, use that instead)\n\n## Basic Redirects Example\n\nLet's use Netlify's `_redirects` file to rewrite all 404 requests to the SPA shell.\n\n```\n# Catch all other 404 requests and rewrite them to the SPA shell\n/* /_shell.html 200\n```\n\n## Allowing Server Functions and Server Routes\n\nAgain, using Netlify's `_redirects` file, we can allow-list specific subpaths to be routed through to the server.\n\n```\n# Allow requests to /_serverFn/* to be routed through to the server (If you have configured your server function base path to be something other than /_serverFn, use that instead)\n/_serverFn/* /_serverFn/:splat 200\n\n# Allow any requests to /api/* to be routed through to the server (Server routes can be created at any path, so you must ensure that any server routes you want to use are under this path, or simply add additional redirects for each server route base you want to expose)\n/api/* /api/:splat 200\n\n# Catch all other 404 requests and rewrite them to the SPA shell\n/* /_shell.html 200\n```\n\n## Shell Mask Path\n\nThe default pathname used to generate the SPA shell is `/`. We call this the **shell mask path**. Since matched routes are not included, the pathname used to generate the shell is mostly irrelevant, but it's still configurable.\n\n> [!NOTE]\n> It's recommended to keep the default value of `/` as the shell mask path.\n\n```tsx\n// vite.config.ts\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      spa: {\n        maskPath: '/app',\n      },\n    }),\n  ],\n})\n```\n\n## Prerendering Options\n\nThe prerender option is used to configure the prerendering behavior of the SPA shell, and accepts the same prerender options as found in our prerendering guide.\n\n**By default, the following `prerender` options are set:**\n\n- `outputPath`: `/_shell.html`\n- `crawlLinks`: `false`\n- `retryCount`: `0`\n\nThis means that by default, the shell will not be crawled for links to follow for additional prerendering, and will not retry prerendering fails.\n\nYou can always override these options by providing your own prerender options:\n\n```tsx\n// vite.config.ts\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      spa: {\n        prerender: {\n          outputPath: '/custom-shell',\n          crawlLinks: true,\n          retryCount: 3,\n        },\n      },\n    }),\n  ],\n})\n```\n\n## Customized rendering in SPA mode\n\nCustomizing the HTML output of the SPA shell can be useful if you want to:\n\n- Provide generic head tags for SPA routes\n- Provide a custom pending fallback component\n- Change literally anything about the shell's HTML, CSS, and JS\n\nTo make this process simple, an `isShell()` function can be found on the `router` instance:\n\n```tsx\n// src/routes/root.tsx\nexport default function Root() {\n  const isShell = useRouter().isShell()\n\n  if (isShell) console.log('Rendering the shell!')\n}\n```\n\nYou can use this boolean to conditionally render different UI based on whether the current route is a shell or not, but keep in mind that after hydrating the shell, the router will immediately navigate to the first route and `isShell()` will return `false`. **This could produce flashes of unstyled content if not handled properly.**\n\n## Dynamic Data in your Shell\n\nSince the shell is prerendered using the SSR build of your application, any `loader`s, or server-specific functionality defined on your **Root Route** will run during the prerendering process and the data will be included in the shell.\n\nThis means that you can use dynamic data in your shell by using a `loader` or server-specific functionality.\n\n```tsx\n// src/routes/__root.tsx\n\nexport const RootRoute = createRootRoute({\n  loader: async () => {\n    return {\n      name: 'Tanner',\n    }\n  },\n  component: Root,\n})\n\nexport default function Root() {\n  const { name } = useLoaderData()\n\n  return (\n    <html>\n      <body>\n        <h1>Hello, {name}!</h1>\n        <Outlet />\n      </body>\n    </html>\n  )\n}\n```\n"
  },
  {
    "path": "docs/start/framework/react/guide/static-prerendering.md",
    "content": "---\nid: static-prerendering\ntitle: Static Prerendering\n---\n\nStatic prerendering is the process of generating static HTML files for your application. This can be useful for either improving the performance of your application, as it allows you to serve pre-rendered HTML files to users without having to generate them on the fly or for deploying static sites to platforms that do not support server-side rendering.\n\n## Prerendering\n\nTanStack Start can prerender your application to static HTML files, which can then be served to users without having to generate them on the fly. To prerender your application, you can add the `prerender` option to your tanstackStart configuration in `vite.config.ts` file:\n\n```ts\n// vite.config.ts\n\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      prerender: {\n        // Enable prerendering\n        enabled: true,\n\n        // Enable if you need pages to be at `/page/index.html` instead of `/page.html`\n        autoSubfolderIndex: true,\n\n        // If disabled, only the root path or the paths defined in the pages config will be prerendered\n        autoStaticPathsDiscovery: true,\n\n        // How many prerender jobs to run at once\n        concurrency: 14,\n\n        // Whether to extract links from the HTML and prerender them also\n        crawlLinks: true,\n\n        // Filter function takes the page object and returns whether it should prerender\n        filter: ({ path }) => !path.startsWith('/do-not-render-me'),\n\n        // Number of times to retry a failed prerender job\n        retryCount: 2,\n\n        // Delay between retries in milliseconds\n        retryDelay: 1000,\n\n        // Maximum number of redirects to follow during prerendering\n        maxRedirects: 5,\n\n        // Fail if an error occurs during prerendering\n        failOnError: true,\n\n        // Callback when page is successfully rendered\n        onSuccess: ({ page }) => {\n          console.log(`Rendered ${page.path}!`)\n        },\n      },\n      // Optional configuration for specific pages\n      // Note: When autoStaticPathsDiscovery is enabled (default), discovered static\n      // routes will be merged with the pages specified below\n      pages: [\n        {\n          path: '/my-page',\n          prerender: { enabled: true, outputPath: '/my-page/index.html' },\n        },\n      ],\n    }),\n    viteReact(),\n  ],\n})\n```\n\n## Automatic Static Route Discovery\n\nAll static paths will be automatically discovered and seamlessly merged with the specified `pages` config\n\nRoutes are excluded from automatic discovery in the following cases:\n\n- Routes with path parameters (e.g., `/users/$userId`) since they require specific parameter values\n- Layout routes (prefixed with `_`) since they don't render standalone pages\n- Routes without components (e.g., API routes)\n\nNote: Dynamic routes can still be prerendered if they are linked from other pages when `crawlLinks` is enabled.\n\n## Crawling Links\n\nWhen `crawlLinks` is enabled (default: `true`), TanStack Start will extract links from prerendered pages and prerender those linked pages as well.\n\nFor example, if `/` contains a link to `/posts`, then `/posts` will also be automatically prerendered.\n"
  },
  {
    "path": "docs/start/framework/react/guide/static-server-functions.md",
    "content": "---\nid: static-server-functions\ntitle: Static Server Functions\n---\n\n> [!WARNING]\n> Static Server Functions are experimental!\n\n## What are Static Server Functions?\n\nStatic server functions are server functions that are executed at build time and cached as static assets when using prerendering/static-generation. They can be set to \"static\" mode by applying the `staticFunctionMiddleware` middleware to `createServerFn`:\n\n```tsx\nimport { createServerFn } from '@tanstack/react-start'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nconst myServerFn = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .handler(async () => {\n    return 'Hello, world!'\n  })\n```\n\nEnsure that `staticFunctionMiddleware` is the final middleware!\n\nThis pattern goes as follows:\n\n- Build-time\n  - During build-time prerendering, a server function with `staticFunctionMiddleware` is executed\n  - The result is cached with your build output as a static JSON file under a derived key (function ID + params/payload hash)\n  - The result is returned as normal during prerendering/static-generation and used to prerender the page\n- Runtime\n  - Initially, the prerendered page's html is served and the server function data is embedded in the html\n  - When the client mounts, the embedded server function data is hydrated\n  - For future client-side invocations, the server function is replaced with a fetch call to the static JSON file\n"
  },
  {
    "path": "docs/start/framework/react/guide/streaming-data-from-server-functions.md",
    "content": "---\ntitle: Streaming Data from Server Functions\n---\n\nStreaming data from the server has become very popular thanks to the rise of AI apps. Luckily, it's a pretty easy task with TanStack Start, and what's even better: the streamed data is typed!\n\nThe two most popular ways of streaming data from server functions are using `ReadableStream`-s or async generators.\n\nYou can see how to implement both in the [Streaming Data From Server Functions example](https://github.com/TanStack/router/tree/main/examples/react/start-streaming-data-from-server-functions).\n\n## Typed Readable Streams\n\nHere's an example for a server function that streams an array of messages to the client in a type-safe manner:\n\n```ts\ntype Message = {\n  content: string\n}\n\n/**\n  This server function returns a `ReadableStream`\n  that streams `Message` chunks to the client.\n*/\nconst streamingResponseFn = createServerFn().handler(async () => {\n  // These are the messages that you want to send as chunks to the client\n  const messages: Message[] = generateMessages()\n\n  // This `ReadableStream` is typed, so each\n  // will be of type `Message`.\n  const stream = new ReadableStream<Message>({\n    async start(controller) {\n      for (const message of messages) {\n        // Send the message\n        controller.enqueue(message)\n      }\n      controller.close()\n    },\n  })\n\n  return stream\n})\n```\n\nWhen you consume this stream from the client, the streamed chunks will be properly typed:\n\n```ts\nconst [message, setMessage] = useState('')\n\nconst getTypedReadableStreamResponse = useCallback(async () => {\n  const response = await streamingResponseFn()\n\n  if (!response) {\n    return\n  }\n\n  const reader = response.getReader()\n  let done = false\n  while (!done) {\n    const { value, done: doneReading } = await reader.read()\n    done = doneReading\n    if (value) {\n      // Notice how we know the value of `chunk` (`Message | undefined`)\n      // here, because it's coming from the typed `ReadableStream`\n      const chunk = value.content\n      setMessage((prev) => prev + chunk)\n    }\n  }\n}, [])\n```\n\n## Async Generators in Server Functions\n\nA much cleaner approach with the same results is to use an async generator function:\n\n```ts\nconst streamingWithAnAsyncGeneratorFn = createServerFn().handler(\n  async function* () {\n    const messages: Message[] = generateMessages()\n    for (const msg of messages) {\n      await sleep(500)\n      // The streamed chunks are still typed as `Message`\n      yield msg\n    }\n  },\n)\n```\n\nThe client side code will also be leaner:\n\n```ts\nconst getResponseFromTheAsyncGenerator = useCallback(async () => {\n  for await (const msg of await streamingWithAnAsyncGeneratorFn()) {\n    const chunk = msg.content\n    setMessages((prev) => prev + chunk)\n  }\n}, [])\n```\n"
  },
  {
    "path": "docs/start/framework/react/guide/tailwind-integration.md",
    "content": "---\nid: tailwind-integration\ntitle: Tailwind CSS Integration\n---\n\n_So you want to use Tailwind CSS in your TanStack Start project?_\n\nThis guide will help you use Tailwind CSS in your TanStack Start project.\n\n## Tailwind CSS Version 4 (Latest)\n\nThe latest version of Tailwind CSS is 4. And it has some configuration changes that majorly differ from Tailwind CSS Version 3. It's **easier and recommended** to set up Tailwind CSS Version 4 in a TanStack Start project, as TanStack Start uses Vite as its build tool.\n\n### Install Tailwind CSS\n\nInstall Tailwind CSS and it's Vite plugin.\n\n```shell\nnpm install tailwindcss @tailwindcss/vite\n```\n\n### Configure The Vite Plugin\n\nAdd the `@tailwindcss/vite` plugin to your Vite configuration.\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport tsConfigPaths from 'vite-tsconfig-paths'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [tsConfigPaths(), tanstackStart(), viteReact(), tailwindcss()],\n})\n```\n\n### Import Tailwind in your CSS file\n\nYou need to create a CSS file to configure Tailwind CSS instead of the configuration file in version 4. You can do this by creating a `src/styles/app.css` file or name it whatever you want.\n\n```css\n/* src/styles/app.css */\n@import 'tailwindcss' source('../');\n```\n\n## Import the CSS file in your `__root.tsx` file\n\nImport the CSS file in your `__root.tsx` file with the `?url` query and make sure to add the **triple slash** directive to the top of the file.\n\n```tsx\n// src/routes/__root.tsx\n/// <reference types=\"vite/client\" />\n// other imports...\n\nimport appCss from '../styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      // your meta tags and site config\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n    // other head config\n  }),\n  component: RootComponent,\n})\n```\n\n## Use Tailwind CSS anywhere in your project\n\nYou can now use Tailwind CSS anywhere in your project.\n\n```tsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return <div className=\"bg-red-500 text-white p-4\">Hello World</div>\n}\n```\n\nThat's it! You can now use Tailwind CSS anywhere in your project 🎉.\n\n## Tailwind CSS Version 3 (Legacy)\n\nIf you are want to use Tailwind CSS Version 3, you can use the following steps.\n\n### Install Tailwind CSS\n\nInstall Tailwind CSS and it's peer dependencies.\n\n```shell\nnpm install -D tailwindcss@3 postcss autoprefixer\n```\n\nThen generate the Tailwind and PostCSS configuration files.\n\n```shell\nnpx tailwindcss init -p\n```\n\n### Configure your template paths\n\nAdd the paths to all of your template files in the `tailwind.config.js` file.\n\n```js\n// tailwind.config.js\n/** @type {import('tailwindcss').Config} */\nexport default {\n  content: ['./src/**/*.{js,ts,jsx,tsx}'],\n  theme: {\n    extend: {},\n  },\n  plugins: [],\n}\n```\n\n### Add the Tailwind directives to your CSS file\n\nAdd the `@tailwind` directives for each of Tailwind's layers to your `src/styles/app.css` file.\n\n```css\n/* src/styles/app.css */\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n```\n\n> [!NOTE]\n> Jump to [Import the CSS file in your `__root.tsx` file](#import-the-css-file-in-your-__roottsx-file) to see how to import the CSS file in your `__root.tsx` file.\n"
  },
  {
    "path": "docs/start/framework/react/migrate-from-next-js.md",
    "content": "---\nid: migrate-from-next-js\ntitle: Migrate from Next.js\n---\n\nThis guide provides a step-by-step process to migrate a project from the Next.js App Router to **TanStack Start**. We respect the powerful features of Next.js and aim to make this transition as smooth as possible.\n\n## Step-by-Step (Basics)\n\nThis step-by-step guide provides an overview of how to migrate your Next.js App Router project to TanStack Start. The goal is to help you understand the basic steps involved in the migration process so you can adapt them to your specific project needs.\n\n### Prerequisites\n\nBefore we begin, this guide assumes your project structure looks like this:\n\n```txt\n├── next.config.ts\n├── package.json\n├── postcss.config.mjs\n├── public\n│   ├── file.svg\n│   ├── globe.svg\n│   ├── next.svg\n│   ├── vercel.svg\n│   └── window.svg\n├── README.md\n├── src\n│   └── app\n│       ├── favicon.ico\n│       ├── globals.css\n│       ├── layout.tsx\n│       └── page.tsx\n└── tsconfig.json\n```\n\nAlternatively, you can follow along by cloning the following [starter template](https://github.com/nrjdalal/awesome-templates/tree/main/next.js-apps/next.js-start):\n\n```sh\nnpx gitpick nrjdalal/awesome-templates/tree/main/next.js-apps/next.js-start next.js-start-er\n```\n\nThis structure is a basic Next.js application using the App Router, which we will migrate to TanStack Start.\n\n### 1. Remove Next.js\n\nFirst, uninstall Next.js and remove related configuration files:\n\n```sh\nnpm uninstall @tailwindcss/postcss next\nrm postcss.config.* next.config.*\n```\n\n### 2. Install Required Dependencies\n\nTanStack Start leverages [Vite](https://vite.dev) and TanStack Router:\n\n```sh\nnpm i @tanstack/react-router @tanstack/react-start\n```\n\nFor Tailwind CSS and resolving imports using path aliases:\n\n```sh\nnpm i -D vite @vitejs/plugin-react @tailwindcss/vite tailwindcss vite-tsconfig-paths\n```\n\n### 3. Update Project Configuration\n\nNow that you've installed the necessary dependencies, update your project configuration files to work with TanStack Start.\n\n- `package.json`\n\n```json\n{\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\",\n    \"start\": \"node .output/server/index.mjs\"\n  }\n}\n```\n\n- `vite.config.ts`\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tsconfigPaths from 'vite-tsconfig-paths'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    // Enables Vite to resolve imports using path aliases.\n    tsconfigPaths(),\n    tanstackStart({\n      srcDirectory: 'src', // This is the default\n      router: {\n        // Specifies the directory TanStack Router uses for your routes.\n        routesDirectory: 'app', // Defaults to \"routes\", relative to srcDirectory\n      },\n    }),\n    viteReact(),\n  ],\n})\n```\n\nBy default, `routesDirectory` is set to `routes`. To maintain consistency with Next.js App Router conventions, you can set it to `app` instead.\n\n### 4. Adapt the Root Layout\n\n> TanStack Start uses a routing approach similar to Remix, with some changes to support nested structures and special features using tokens. Learn more about it at [Routing Concepts](/router/latest/docs/framework/react/routing/routing-concepts) guide.\n\nInstead of `layout.tsx`, create a file named `__root.tsx` in the `src/app` directory. This file will serve as the root layout for your application.\n\n- `src/app/layout.tsx` to `src/app/__root.tsx`\n\n```tsx\n- import type { Metadata } from \"next\" // [!code --]\nimport {\n  Outlet,\n  createRootRoute,\n  HeadContent,\n  Scripts,\n} from \"@tanstack/react-router\"\nimport appCss from \"./globals.css?url\"\n\n- export const metadata: Metadata = { // [!code --]\n-   title: \"Create Next App\", // [!code --]\n-   description: \"Generated by create next app\", // [!code --]\n- } // [!code --]\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: \"utf-8\" },\n      {\n        name: \"viewport\",\n        content: \"width=device-width, initial-scale=1\",\n      },\n      { title: \"TanStack Start Starter\" }\n    ],\n    links: [\n      {\n        rel: 'stylesheet',\n        href: appCss,\n      },\n    ],\n  }),\n  component: RootLayout,\n})\n\n- export default function RootLayout({ // [!code --]\n-   children, // [!code --]\n- }: Readonly<{ // [!code --]\n-   children: React.ReactNode // [!code --]\n- }>) { // [!code --]\n-   return ( // [!code --]\n-     <html lang=\"en\"> // [!code --]\n-       <body>{children}</body> // [!code --]\n-     </html> // [!code --]\n-   ) // [!code --]\n- } // [!code --]\nfunction RootLayout() {\n  return (\n    <html lang=\"en\">\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n### 5. Adapt the Home Page\n\nInstead of `page.tsx`, create an `index.tsx` file for the `/` route.\n\n- `src/app/page.tsx` to `src/app/index.tsx`\n\n```tsx\n+ import { createFileRoute } from '@tanstack/react-router' // [!code ++]\n\n- export default function Home() { // [!code --]\n+ export const Route = createFileRoute('/')({ // [!code ++]\n+   component: Home, // [!code ++]\n+ }) // [!code ++]\n\n+ function Home() { // [!code ++]\n  return (\n    <main className=\"min-h-dvh w-screen flex items-center justify-center flex-col gap-y-4 p-4\">\n      <img\n        className=\"max-w-sm w-full\"\n        src=\"https://raw.githubusercontent.com/TanStack/tanstack.com/main/public/images/logos/splash-dark.png\"\n        alt=\"TanStack Logo\"\n      />\n      <h1>\n        <span className=\"line-through\">Next.js</span> TanStack Start\n      </h1>\n      <a\n        className=\"bg-foreground text-background rounded-full px-4 py-1 hover:opacity-90\"\n        href=\"https://tanstack.com/start/latest\"\n        target=\"_blank\"\n      >\n        Docs\n      </a>\n    </main>\n  )\n}\n```\n\n### 6. Are we migrated yet?\n\nBefore you can run the development server, you need to create a file that will define the behavior of TanStack Router within TanStack Start.\n\n- `src/router.tsx`\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n```\n\n> 🧠 Here you can configure everything from the default [preloading functionality](/router/latest/docs/framework/react/guide/preloading) to [caching staleness](/router/latest/docs/framework/react/guide/data-loading).\n\nDon't worry if you see some TypeScript errors at this point; the next step will resolve them.\n\n### 7. Verify the Migration\n\nRun the development server:\n\n```sh\nnpm run dev\n```\n\nThen, visit `http://localhost:3000`. You should see the TanStack Start welcome page with its logo and a documentation link.\n\n> If you encounter issues, review the steps above and ensure that file names and paths match exactly. For a reference implementation, see the [post-migration repository](https://github.com/nrjdalal/next-to-start).\n\n## Next Steps (Advanced)\n\nNow that you have migrated the basic structure of your Next.js application to TanStack Start, you can explore more advanced features and concepts.\n\n### Routing Concepts\n\n| Route Example                  | Next.js                            | TanStack Start            |\n| ------------------------------ | ---------------------------------- | ------------------------- |\n| Root Layout                    | `src/app/layout.tsx`               | `src/app/__root.tsx`      |\n| `/` (Home Page)                | `src/app/page.tsx`                 | `src/app/index.tsx`       |\n| `/posts` (Static Route)        | `src/app/posts/page.tsx`           | `src/app/posts.tsx`       |\n| `/posts/[slug]` (Dynamic)      | `src/app/posts/[slug]/page.tsx`    | `src/app/posts/$slug.tsx` |\n| `/posts/[...slug]` (Catch-All) | `src/app/posts/[...slug]/page.tsx` | `src/app/posts/$.tsx`     |\n| `/api/endpoint` (API Route)    | `src/app/api/endpoint/route.ts`    | `src/app/api/endpoint.ts` |\n\nLearn more about the [Routing Concepts](/router/latest/docs/framework/react/routing/routing-concepts).\n\n### Dynamic and Catch-All Routes\n\nRetrieving dynamic route parameters in TanStack Start is straightforward.\n\n```tsx\n- export default async function Page({ // [!code --]\n-   params, // [!code --]\n- }: { // [!code --]\n-   params: Promise<{ slug: string }> // [!code --]\n- }) { // [!code --]\n+ export const Route = createFileRoute('/app/posts/$slug')({ // [!code ++]\n+   component: Page, // [!code ++]\n+ }) // [!code ++]\n\n+ function Page() { // [!code ++]\n-   const { slug } = await params // [!code --]\n+   const { slug } = Route.useParams() // [!code ++]\n  return <div>My Post: {slug}</div>\n}\n```\n\n> Note: If you've made a catch-all route (like `src/app/posts/$.tsx`), you can access the parameters via `const { _splat } = Route.useParams()`.\n\nSimilarly, you can access `searchParams` using `const { page, filter, sort } = Route.useSearch()`.\n\nLearn more about the [Dynamic and Catch-All Routes](/router/latest/docs/framework/react/routing/routing-concepts#dynamic-route-segments).\n\n### Links\n\n```tsx\n- import Link from \"next/link\" // [!code --]\n+ import { Link } from \"@tanstack/react-router\" // [!code ++]\n\nfunction Component() {\n-   return <Link href=\"/dashboard\">Dashboard</Link> // [!code --]\n+   return <Link to=\"/dashboard\">Dashboard</Link> // [!code ++]\n}\n```\n\nLearn more about the [Links](/router/latest/docs/framework/react/guide/navigation#link-component).\n\n### Images\n\nNext.js uses the `next/image` component for optimized images. In TanStack Start, you can use the package called [Unpic](https://unpic.pics/) for similar functionality\nand almost a drop-in replacement.\n\n```tsx\nimport Image from 'next/image' // [!code --]\nimport { Image } from '@unpic/react' // [!code ++]\nfunction Component() {\n  return (\n    <Image\n      src=\"/path/to/image.jpg\"\n      alt=\"Description\"\n      width=\"600\" // [!code --]\n      height=\"400\" // [!code --]\n      width={600} // [!code ++]\n      height={400} // [!code ++]\n    />\n  )\n}\n```\n\n### Server ~Actions~ Functions\n\n```tsx\n- 'use server' // [!code --]\n+ import { createServerFn } from \"@tanstack/react-start\" // [!code ++]\n\n- export const create = async () => { // [!code --]\n+ export const create = createServerFn().handler(async () => { // [!code ++]\n  return true\n- } // [!code --]\n+ }) // [!code ++]\n```\n\nLearn more about the [Server Functions](./guide/server-functions).\n\n### Server Routes ~Handlers~\n\n```ts\n- export async function GET() { // [!code --]\n+ export const Route = createFileRoute('/api/hello')({ // [!code ++]\n+  server: { // [!code ++]\n+     handlers: { // [!code ++]\n+       GET: async () => { // [!code ++]\n+         return Response.json(\"Hello, World!\")\n+       } // [!code ++]\n+    } // [!code ++]\n+  } // [!code ++]\n+ }) // [!code ++]\n```\n\nLearn more about the [Server Routes](./guide/server-routes).\n\n### Fonts\n\n```tsx\n- import { Inter } from \"next/font/google\" // [!code --]\n\n- const inter = Inter({ // [!code --]\n-   subsets: [\"latin\"], // [!code --]\n-   display: \"swap\", // [!code --]\n- }) // [!code --]\n\n- export default function Page() { // [!code --]\n-   return <p className={inter.className}>Font Sans</p> // [!code --]\n- } // [!code --]\n```\n\nInstead of `next/font`, use Tailwind CSS’s CSS-first approach. Install fonts (for example, from [Fontsource](https://github.com/fontsource/fontsource)):\n\n```sh\nnpm i -D @fontsource-variable/dm-sans @fontsource-variable/jetbrains-mono\n```\n\nAdd the following to `src/app/globals.css`:\n\n```css\n@import 'tailwindcss' source('../');\n\n@import '@fontsource-variable/dm-sans'; /* [!code ++] */\n@import '@fontsource-variable/jetbrains-mono'; /* [!code ++] */\n\n@theme inline {\n  --font-sans: 'DM Sans Variable', sans-serif; /* [!code ++] */\n  --font-mono: 'JetBrains Mono Variable', monospace; /* [!code ++] */\n  /* ... */\n}\n\n/* ... */\n```\n\n### Fetching Data\n\n```tsx\n- export default async function Page() { // [!code --]\n+ export const Route = createFileRoute('/')({ // [!code ++]\n+   component: Page, // [!code ++]\n+   loader: async () => { // [!code ++]\n+     const res = await fetch('https://api.vercel.app/blog') // [!code ++]\n+     return res.json() // [!code ++]\n+   }, // [!code ++]\n+ }) // [!code ++]\n\n+ function Page() { // [!code ++]\n-   const data = await fetch('https://api.vercel.app/blog') // [!code --]\n-   const posts = await data.json() // [!code --]\n+   const posts = Route.useLoaderData() // [!code ++]\n\n  return (\n    <ul>\n      {posts.map((post) => (\n        <li key={post.id}>{post.title}</li>\n      ))}\n    </ul>\n  )\n}\n```\n"
  },
  {
    "path": "docs/start/framework/react/overview.md",
    "content": "---\nid: overview\ntitle: TanStack Start Overview\n---\n\n> [!NOTE]\n> TanStack Start is currently in the **Release Candidate** stage! This means it is considered feature-complete and its API is considered stable.\n> **This does not mean it is bug-free or without issues, which is why we invite you to try it out and provide feedback!**\n> The road to v1 will likely be a quick one, so don't wait too long to try it out!\n\nTanStack Start is a full-stack React framework powered by TanStack Router. It provides a full-document SSR, streaming, server functions, bundling, and more. Thanks to [Vite](https://vite.dev/), it's ready to develop and deploy to any hosting provider or runtime you want!\n\n## Dependencies\n\nTanStack Start is built on two key technologies:\n\n- **[TanStack Router](https://tanstack.com/router)**: A type-safe router for building web applications with advanced features like nested routing, search params, and data loading\n- **[Vite](https://vite.dev/)**: A modern build tool that provides fast development with hot module replacement and optimized production builds\n\n## Should I use TanStack Start or just TanStack Router?\n\n90% of any framework usually comes down to the router, and TanStack Start is no different. **TanStack Start relies 100% on TanStack Router for its routing system.** In addition to TanStack Router's amazing features, Start enables even more powerful features:\n\n- **Full-document SSR** - Server-side rendering for better performance and SEO\n- **Streaming** - Progressive page loading for improved user experience\n- **Server Routes & API Routes** - Build backend endpoints alongside your frontend\n- **Server Functions** - Type-safe RPCs between client and server\n- **Middleware & Context** - Powerful request/response handling and data injection\n- **Full-Stack Bundling** - Optimized builds for both client and server code\n- **Universal Deployment** - Deploy to any Vite-compatible hosting provider\n- **End-to-End Type Safety** - Full TypeScript support across the entire stack\n\nThat said, if you **know with certainty** that you will not need any of the above features, then you may want to consider using TanStack Router alone, which is still a powerful and type-safe SPA routing upgrade over other routers and frameworks.\n\n## Are there limitations?\n\nThe only relevant limitation is that TanStack Start does not currently support React Server Components, **but we are actively working on integration and expect to support them in the near future.**\n\nOtherwise, TanStack Start provides the same capability as other full-stack frameworks like Next.js, Remix, etc, with even more features and a more powerful developer experience.\n\n## How is TanStack Start funded?\n\nTanStack is 100% open source, free to use, and always will be. It is built and maintained by an extremely talented and dedicated community of developers and software engineers. TanStack.com (also open source) is owned by TanStack LLC, a privately held company, 100% bootstrapped and self-funded. We are not venture-backed and have never sought investors. To support the development of TanStack Start and other TanStack libraries, TanStack.com partners with [these amazing companies](https://tanstack.com/partners?status=active&libraries=%5B%22start%22%5D) who offer both financial support and resources to help us continue to build the best possible developer experience for the web community:\n\n<iframe src=\"https://tanstack.com/partners-embed\" style=\"aspect-ratio: 1/2; width: 100%;\"></iframe>\n\n## Ready to get started?\n\nGo to the next page to learn how to install TanStack Start and create your first app!\n"
  },
  {
    "path": "docs/start/framework/react/quick-start.md",
    "content": "---\nid: quick-start\ntitle: Quick Start\n---\n\n## Impatient?\n\nThe fastest way to get a Start project up and running is with the CLI. Just run\n\n```\nnpx @tanstack/cli@latest create\n```\n\ndepending on your package manager of choice. You'll be prompted to add things like Tailwind, eslint, and a ton of other options.\n\nYou can also clone and run the [Basic](https://github.com/TanStack/router/tree/main/examples/react/start-basic) example right away with the following commands:\n\n```bash\nnpx gitpick TanStack/router/tree/main/examples/react/start-basic start-basic\ncd start-basic\nnpm install\nnpm run dev\n```\n\nIf you'd like to use a different example, you can replace `start-basic` above with the slug of the example you'd like to use from the list below.\n\nOnce you've cloned the example you want, head back to the [Routing](./guide/routing) guide to learn how to use TanStack Start!\n\n## Examples\n\nTanStack Start has a load of examples to get you started. Pick one of the examples below to get started!\n\n- [Basic](https://github.com/TanStack/router/tree/main/examples/react/start-basic) (start-basic)\n- [Basic + Auth](https://github.com/TanStack/router/tree/main/examples/react/start-basic-auth) (start-basic-auth)\n- [Counter](https://github.com/TanStack/router/tree/main/examples/react/start-counter) (start-counter)\n- [Basic + React Query](https://github.com/TanStack/router/tree/main/examples/react/start-basic-react-query) (start-basic-react-query)\n- [Clerk Auth](https://github.com/TanStack/router/tree/main/examples/react/start-clerk-basic) (start-clerk-basic)\n- [Convex + Trellaux](https://github.com/TanStack/router/tree/main/examples/react/start-convex-trellaux) (start-convex-trellaux)\n- [Supabase](https://github.com/TanStack/router/tree/main/examples/react/start-supabase-basic) (start-supabase-basic)\n- [Trellaux](https://github.com/TanStack/router/tree/main/examples/react/start-trellaux) (start-trellaux)\n- [WorkOS](https://github.com/TanStack/router/tree/main/examples/react/start-workos) (start-workos)\n- [Material UI](https://github.com/TanStack/router/tree/main/examples/react/start-material-ui) (start-material-ui)\n\n### Stackblitz\n\nEach example above has an embedded stackblitz preview to find the one that feels like a good starting point\n\n### Quick Deploy\n\nTo quickly deploy an example, click the **Deploy to Netlify** button on an example's page to both clone and deploy the example to Netlify.\n\n### Manual Deploy\n\nTo manually clone and deploy the example to anywhere else you'd like, use the following commands replacing `EXAMPLE_SLUG` with the slug of the example you'd like to use from above:\n\n```bash\nnpx gitpick TanStack/router/tree/main/examples/react/EXAMPLE_SLUG my-new-project\ncd my-new-project\nnpm install\nnpm run dev\n```\n\nOnce you've cloned or deployed an example, head back to the [Routing](./guide/routing) guide to learn how to use TanStack Start!\n\n## Other Router Examples\n\nWhile not Start-specific examples, these may help you understand more about how TanStack Router works:\n\n- [Quickstart (file-based)](https://github.com/TanStack/router/tree/main/examples/react/quickstart-file-based)\n- [Basic (file-based)](https://github.com/TanStack/router/tree/main/examples/react/basic-file-based)\n- [Kitchen Sink (file-based)](https://github.com/TanStack/router/tree/main/examples/react/kitchen-sink-file-based)\n- [Kitchen Sink + React Query (file-based)](https://github.com/TanStack/router/tree/main/examples/react/kitchen-sink-react-query-file-based)\n- [Location Masking](https://github.com/TanStack/router/tree/main/examples/react/location-masking)\n- [Authenticated Routes](https://github.com/TanStack/router/tree/main/examples/react/authenticated-routes)\n- [Scroll Restoration](https://github.com/TanStack/router/tree/main/examples/react/scroll-restoration)\n- [Deferred Data](https://github.com/TanStack/router/tree/main/examples/react/deferred-data)\n- [Navigation Blocking](https://github.com/TanStack/router/tree/main/examples/react/navigation-blocking)\n- [View Transitions](https://github.com/TanStack/router/tree/main/examples/react/view-transitions)\n- [With tRPC](https://github.com/TanStack/router/tree/main/examples/react/with-trpc)\n- [With tRPC + React Query](https://github.com/TanStack/router/tree/main/examples/react/with-trpc-react-query)\n"
  },
  {
    "path": "docs/start/framework/react/start-vs-nextjs.md",
    "content": "---\nid: start-vs-nextjs\ntitle: TanStack Start vs Next.js\n---\n\nChoosing between TanStack Start and Next.js isn't just about features - it's about understanding what each framework optimizes for and how those decisions cascade through your entire development experience.\n\nThis page explains the fundamental differences, addresses common misconceptions, and helps you make an informed decision. For a feature-by-feature matrix, see the [full comparison table](./comparison). Ready to switch? See the [migration guide](./migrate-from-next-js).\n\n**A note on benchmarks:** If someone quotes performance numbers comparing Start and Next without methodology, app complexity, hosting details, and configuration specifics - those numbers are meaningless. Comparisons must assume best practices on both sides. You can't give Next the benefit of optimized usage while assuming Start users misconfigure things.\n\n## Two Different Visions of React\n\nBoth frameworks want to help you build great React applications. But they start from different assumptions about what \"great\" means.\n\n### Next.js: The Platform Play\n\nNext.js optimizes for **Vercel's vision of the web**: server-first rendering, tight platform integration, and automatic optimizations that work best on their infrastructure.\n\nThe core bet: most web content is static or near-static. Server Components should be the default. Interactivity is the exception you opt into. The framework should make decisions for you, and those decisions should be optimized for their infrastructure.\n\nThis works well if:\n\n- You're deploying to Vercel and want tight platform integration\n- Your app is content-heavy with islands of interactivity\n- You want the framework to make architectural decisions for you\n\n### TanStack Start: The Developer-First Play\n\nTanStack Start optimizes for **developer control and correctness**: type safety everywhere, explicit over implicit, composable primitives, and deployment freedom.\n\nThe core bet: developers know their apps better than frameworks do. Server rendering is an optimization you opt into where it makes sense. The framework should give you powerful primitives and get out of your way.\n\nThis works well if:\n\n- You want your deployment target to be a decision you make, not one the framework makes for you\n- Your app is highly interactive\n- You value type safety and explicit control\n- You want to understand exactly what your code is doing\n\n## The Mental Model Gap\n\nThis is the most important difference to understand. Everything else flows from it.\n\n### Both SSR - Different Defaults for Interactivity\n\nLet's be clear: both frameworks SSR by default, and both support static generation and React Server Components. The difference isn't capability - it's how you access those capabilities and how much control you have.\n\n**Next.js** defaults to Server Components. Every component is a Server Component unless you add `\"use client\"`. Server Components can't use state, effects, or event handlers - so the path to interactivity requires understanding the framework's implicit boundaries, caching layers, and serialization rules.\n\n**TanStack Start** defaults to interactive components (traditional React). Your components SSR and hydrate, ready for state and event handlers out of the box. You opt into Server Components where they provide value - for heavy static content, keeping secrets server-side, or reducing bundle size.\n\nBoth approaches get you to the same destination. The question is: which direction feels like swimming upstream for _your_ app?\n\nConsider:\n\n- If most of your components need state, effects, or event handlers, Next's defaults mean constant `\"use client\"` annotations and thinking about serialization boundaries\n- If most of your content is static, Start lets you explicitly opt those components into server-only rendering - with clearer control over caching and hydration\n- Either way, Start gives you more granular control over _how_ things render, not just _where_\n\n### Implicit vs Explicit\n\nBoth frameworks handle the fundamentals - code splitting, caching, SSR, static optimization. The difference is visibility and predictability. **Next.js** layers implicit behaviors: multi-layer server-side caching with a history of breaking changes and community frustration, data fetching conventions tied to file structure, optimizations that require understanding the framework's internals to override.\n\n**TanStack Start** is explicit without being verbose. Loader functions, cache configuration, middleware chains - they're visible in your code, not hidden behind conventions. This doesn't mean more code; it means the code you write maps directly to what happens at runtime.\n\n## Architecture Deep Dive\n\n### The Build Pipeline\n\n**Next.js** uses a custom build system (historically Webpack, now Turbopack). It's tightly integrated with their architecture, which enables optimizations but limits flexibility. Turbopack has improved dev speed, but it's still no match for Vite.\n\n**TanStack Start** is built on Vite. This means:\n\n- Faster dev server startup\n- Faster HMR\n- Access to the entire Vite plugin ecosystem\n- Standard tooling that transfers to other projects\n\n### The Runtime\n\n**Next.js** ships a substantial runtime to support Server Components, server-side caching, automatic optimizations, and the App Router's conventions. This runtime has real weight.\n\n**TanStack Start** ships a minimal runtime. The router is powerful but lean. Server functions are thin RPC wrappers. There's no framework magic layer between you and React.\n\nBundle size isn't everything, but it's the baseline everything else builds on. Start's architecture is designed to minimize runtime overhead - even with RSC support, the runtime stays lean. Much of Next's bundle weight is architectural tax, not feature weight.\n\n### The Type System\n\n**Next.js** has TypeScript support. **TanStack Start** is built around TypeScript.\n\nThe difference matters:\n\n- In Next.js, the boundary between client and server creates type gaps. Server Actions can receive data that doesn't match what TypeScript expects. You need runtime validation to be safe.\n- In Start, server functions have end-to-end type safety. Input validation, return types, middleware context, route parameters - all checked at compile time.\n\nIn the age of AI-assisted development, end-to-end type safety should be non-negotiable. Types aren't just \"nice for DX\" - they're correctness guarantees that prevent production errors.\n\n## Routing\n\nThis is where TanStack shines brightest. TanStack Router (which powers Start) is the most powerful, type-safe router in any framework.\n\n**Features Next.js doesn't have:**\n\n- **Typesafe search params** - Define, validate, and parse search params with full type inference. Next gives you `?foo=bar` as strings; Start gives you validated, typed objects\n- **Search param validation & middleware** - Transform and validate search params at the route level\n- **Typesafe path params** - Path params are inferred and validated, not just `string | string[]`\n- **Typesafe route context** - Pass typed context down through nested routes\n- **Path param validation & custom parsing** - Parse `/users/123` as a number, validate it exists\n- **Route mount/transition/unmount events** - Hook into the route lifecycle\n- **Code-based routes** - Define routes in code when file-based doesn't fit\n- **Built-in devtools** - Inspect router state, cache, and pending navigations\n- **Element scroll restoration** - Restore scroll position for specific elements, not just the page\n- **Navigation blocking** - `useBlocker` for unsaved changes warnings\n\n**Type safety that actually works:**\n\n- Route paths are fully typed - typos are compile errors\n- Links validate their destinations - no broken links in production\n- Loaders know their route context - no guessing what data is available\n- Search params are typed end-to-end - from URL to component\n\nNext.js has file-based routing that works, but the type safety is superficial (an IDE plugin for link hints) compared to TanStack Router's compile-time guarantees.\n\n**First-class integrations:**\n\nTanStack Router was designed from the ground up for isomorphism and hydration. This makes it the foundation for first-class integrations with TanStack Query and other data-fetching libraries. In Next, you wire up Query manually; in Start, it's a supported pattern with official integrations.\n\nSee the [full router comparison](/router/latest/docs/framework/react/comparison) for the complete feature matrix.\n\n## The Caching Question\n\nCaching is where the philosophical differences become most visible.\n\n### Next.js: Implicit and Server-Side\n\nNext.js caches aggressively by default (or did - they've changed this multiple times). The caching happens in layers:\n\n- Request memoization\n- Data cache\n- Full route cache\n- Router cache\n\nEach layer has its own invalidation semantics. The system has been rewritten multiple times with community criticism for being unpredictable. Next 15 simplified the defaults, but the fundamental complexity of server-side RSC stream caching remains.\n\nWhen people talk about \"component caching,\" they're referring to caching serialized RSC streams on the server. This is more complicated than most realize:\n\n- You're caching text streams with complex invalidation semantics\n- This happens in lambda-style environments with their own constraints\n- Granular invalidation requires explicit tagging setup\n- Cache misses cascade through the component tree in ways that aren't always predictable\n\n**Ask anyone claiming server-side component caching is special:** \"How do you invalidate a cached RSC stream when a data dependency changes?\" Most can't answer clearly.\n\n### TanStack Start: RSCs Are Just Data\n\nStart treats Server Component output the same as any other data flowing through your app. There's no special \"component cache\" with its own semantics - RSC payloads are data, and you cache data however you want:\n\n- **TanStack Router** - Built-in SWR-style caching with `staleTime` and `gcTime`\n- **TanStack Query** - Full-featured async state management\n- **CDN caching** - Standard HTTP cache headers at the edge\n- **Redis, database, whatever** - It's just data; use your existing infrastructure\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => fetchPost(params.postId),\n  staleTime: 10_000, // Fresh for 10 seconds\n  gcTime: 5 * 60_000, // Keep in memory for 5 minutes\n})\n```\n\nThis is the same SWR pattern TanStack Query has battle-tested across millions of applications. No new mental model. No framework-specific caching semantics to learn. No chasing ghosts.\n\nThe caching layers are well-understood and compose naturally:\n\n- Client-side SWR caching (built into the router)\n- CDN caching at the edge (standard HTTP semantics)\n- Server-side caching where you want it (explicit, opt-in)\n\nYou already know how to cache data. Start doesn't make you learn a new way.\n\n### The Bottom Line on RSCs\n\nStart has full RSC support with feature parity to Next.js. The difference is mental model and cognitive overhead.\n\nIn Next, RSCs are the paradigm - you build around them, think about them constantly, manage their boundaries everywhere. In Start, RSCs are just another data primitive. Fetch them, cache them, compose them - using patterns you already know from TanStack Query and Router.\n\nWe call our approach **Composite Components** - server-produced React components that the client can fetch, cache, stream, and assemble. The client owns composition; the server ships UI pieces. No new mental model. No framework-specific caching semantics. Just data flowing through tools you already understand.\n\nFor the full deep-dive, see [Composite Components: Server Components with Client-Led Composition](https://tanstack.com/blog/composite-components).\n\n## Server Functions vs Server Actions\n\nBoth frameworks let you call server code from the client. The approaches differ significantly.\n\n### Next.js Server Actions\n\n```tsx\n'use server'\n\nexport async function createPost(formData: FormData) {\n  const title = formData.get('title')\n  // No compile-time type safety on inputs\n  return db.posts.create({ title })\n}\n```\n\nServer Actions integrate with forms and transitions. They're convenient for simple cases but provide limited type safety at the boundary.\n\n### TanStack Server Functions\n\n```tsx\nexport const createPost = createServerFn({ method: 'POST' })\n  .validator(z.object({ title: z.string().min(1) }))\n  .middleware([authMiddleware])\n  .handler(async ({ data, context }) => {\n    // data is typed and validated\n    // context comes from middleware, also typed\n    return db.posts.create({ title: data.title })\n  })\n```\n\nServer functions give you:\n\n- **Input validation** - Define schemas, get runtime validation and compile-time types\n- **Middleware** - Composable, works on both client and server\n- **Full type inference** - From input to output to error handling\n- **Explicit RPC** - Clear mental model of what's happening\n\n**Security note:** Start's architecture doesn't parse Flight data on the server - payloads flow one direction (server to client). Recent React security advisories around RSC serialization vulnerabilities don't apply to Start's model.\n\n## Where Next.js Has the Advantage\n\nNext.js has been around longer. That's not a technical advantage, but it creates real ecosystem effects:\n\n**More content** - More tutorials, more Stack Overflow answers, more blog posts, more example repos. When you Google a problem, you're more likely to find a Next-specific answer.\n\n**Mindshare** - Next is the default recommendation in many circles. That means more developers have used it, which means more content, which reinforces the cycle.\n\n**Vercel integration** - Next.js is built by Vercel, so new Vercel platform features often ship with Next.js support first. That said, Start works great on Vercel too - you're not giving up preview deployments or edge functions by choosing Start. You're just not locked into Vercel as the only first-class option.\n\n**Built-in image/font optimization** - Start supports image optimization via pluggable solutions (like [Unpic](https://unpic.pics/)), but it's not built-in. Whether \"built-in\" is better than \"pluggable\" depends on whether you want the framework making that choice for you.\n\nNone of these are technical superiority - they're ecosystem and business model advantages. On the technical merits, we're confident in Start's approach.\n\n## What Start Does Better\n\nWith RSC support, the question isn't \"what does Start lack?\" - it's: **\"Why give up Start's router, type safety, caching design, and simpler mental model for Next's API design?\"**\n\n**Type safety** - End-to-end, not bolted on. This prevents bugs and enables confident refactoring.\n\n**Routing** - The most powerful, type-safe router in any framework. Search params, path params, loaders, middleware - all fully typed.\n\n**Caching model** - Explicit SWR primitives you already understand if you've used TanStack Query. No implicit layers to debug.\n\n**Dev experience** - Vite's speed is real. Instant startup, fast HMR, lower resource usage. This compounds over a workday - and even more so when AI agents are iterating on your code in tight loops.\n\n**Deployment as a feature** - Start treats deployment flexibility as a first-class feature. Cloudflare, Netlify, AWS, Fly, Railway, your own servers - they're all equally supported. Your app works the same everywhere because it's built on standards, not platform-specific optimizations. This means you can:\n\n- Choose hosting based on price, performance, or proximity to your users\n- Switch providers without rewriting deployment logic\n- Run the same code in development, staging, and production across different platforms\n- Avoid accumulating platform-specific patterns that create friction later\n\n**Middleware** - Composable middleware that works at both the request level AND the server function level, on both client and server.\n\n**Debugging** - Predictable execution. When something breaks, you can trace it. No abstraction layers hiding behavior.\n\n## Summary\n\n| Aspect               | TanStack Start                       | Next.js                               |\n| -------------------- | ------------------------------------ | ------------------------------------- |\n| **Philosophy**       | Developer control, explicit patterns | Platform integration, conventions     |\n| **Components**       | Interactive by default, opt into RSC | Server Components by default          |\n| **Type safety**      | End-to-end, compile-time             | TypeScript support with boundary gaps |\n| **Server functions** | Typed, validated, middleware support | Untyped boundary, no middleware       |\n| **Caching**          | Explicit SWR primitives              | Multi-layer implicit caching          |\n| **Build tool**       | Vite                                 | Turbopack/Webpack                     |\n| **Deployment**       | Equal support everywhere             | Optimized for Vercel                  |\n| **Routing**          | Best-in-class type safety            | File-based, basic types               |\n| **RSC**              | Supported                            | Supported                             |\n| **Maturity**         | 2+ years, approaching 1.0            | 8+ years, historically unstable APIs  |\n\n---\n\n> **Ready to try Start?** See the [Getting Started guide](./getting-started) or [migrate from Next.js](./migrate-from-next-js).\n"
  },
  {
    "path": "docs/start/framework/react/tutorial/fetching-external-api.md",
    "content": "---\nid: fetching-external-api\ntitle: Calling an external API using TanStack Start\n---\n\nThis guide demonstrates how to integrate external API calls into your TanStack Start application using route loaders. We will use TMDB API to fetch popular movies using TanStack Start and understand how to fetch data in a TanStack Start app.\n\nThe complete code for this tutorial is available on [GitHub](https://github.com/shrutikapoor08/tanstack-start-movies).\n\n## What You'll Learn\n\n1. Setting up external API integration with TanStack Start\n1. Implementing route loaders for server-side data fetching\n1. Building responsive UI components with fetched data\n1. Handling loading states and error management\n\n## Prerequisites\n\n- Basic knowledge of React and TypeScript\n- Node.js (v18+) and `pnpm` installed on your machine\n- A TMDB API key (free at [themoviedb.org](https://www.themoviedb.org))\n\n## Nice to know\n\n- [TanStack Router](/router/latest/docs/framework/react/routing/routing-concepts)\n\n## Setting up a TanStack Start Project\n\nFirst, let's create a new TanStack Start project:\n\n```bash\npnpx create-start-app movie-discovery\ncd movie-discovery\n```\n\nWhen this script runs, it will ask you a few setup questions. You can either pick choices that work for you or just press enter to accept the defaults.\n\nOptionally, you can pass in a `--add-on` flag to get options such as Shadcn, Clerk, Convex, TanStack Query, etc.\n\nOnce setup is complete, install dependencies and start the development server:\n\n```bash\npnpm i\npnpm dev\n```\n\n## Understanding the Project Structure\n\nAt this point, the project structure should look like this:\n\n```text\n/movie-discovery\n├── src/\n│   ├── routes/\n│   │   ├── __root.tsx                    # Root layout\n│   │   ├── index.tsx                     # Home page\n│   │   └── fetch-movies.tsx              # Movie fetching route\n│   ├── types/\n│   │   └── movie.ts                      # Movie type definitions\n│   ├── router.tsx                        # Router configuration\n│   ├── routeTree.gen.ts                  # Generated route tree\n│   └── styles.css                        # Global styles\n├── public/                               # Static assets\n├── vite.config.ts                         # TanStack Start configuration\n├── package.json                          # Project dependencies\n└── tsconfig.json                         # TypeScript configuration\n\n```\n\nOnce your project is set up, you can access your app at `localhost:3000`. You should see the default TanStack Start welcome page.\n\n## Step 1: Setup a `.env` file with TMDB_AUTH_TOKEN\n\nTo fetch movies from the TMDB API, you need an authentication token. You can get this for free at themoviedb.org.\n\nFirst, let's set up environment variables for our API key. Create a `.env` file in your project root:\n\n```bash\ntouch .env\n\n```\n\nAdd your TMDB API token to this file:\n\n```dotenv\nTMDB_AUTH_TOKEN=your_bearer_token_here\n```\n\n_Important_: Make sure to add `.env` to your `.gitignore` file to keep your API keys secure.\n\n## Step 2: Defining Data Types\n\nLet's create TypeScript interfaces for our movie data. Create a new file at `src/types/movie.ts`:\n\n```ts\n// src/types/movie.ts\nexport interface Movie {\n  id: number\n  title: string\n  overview: string\n  poster_path: string | null\n  backdrop_path: string | null\n  release_date: string\n  vote_average: number\n  popularity: number\n}\n\nexport interface TMDBResponse {\n  page: number\n  results: Movie[]\n  total_pages: number\n  total_results: number\n}\n```\n\n## Step 3: Creating the Route with API Fetch Function\n\nTo call the TMDB API, we're going to create a server function that fetches data on the server. This approach keeps our API credentials secure by never exposing them to the client.\nLet's create our route that fetches data from the TMDB API. Create a new file at `src/routes/fetch-movies.tsx`:\n\n```typescript\n// src/routes/fetch-movies.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport type { Movie, TMDBResponse } from '../types/movie'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst API_URL =\n  'https://api.themoviedb.org/3/discover/movie?include_adult=false&include_video=false&language=en-US&page=1&sort_by=popularity.desc'\n\nconst fetchPopularMovies = createServerFn().handler(\n  async (): Promise<TMDBResponse> => {\n    const response = await fetch(API_URL, {\n      headers: {\n        accept: 'application/json',\n        Authorization: `Bearer ${process.env.TMDB_AUTH_TOKEN}`,\n      },\n    })\n\n    if (!response.ok) {\n      throw new Error(`Failed to fetch movies: ${response.statusText}`)\n    }\n\n    return response.json()\n  },\n)\n\nexport const Route = createFileRoute('/fetch-movies')({\n  component: MoviesPage,\n  loader: async (): Promise<{ movies: Movie[]; error: string | null }> => {\n    try {\n      const moviesData = await fetchPopularMovies()\n      return { movies: moviesData.results, error: null }\n    } catch (error) {\n      console.error('Error fetching movies:', error)\n      return { movies: [], error: 'Failed to load movies' }\n    }\n  },\n})\n```\n\n_What's happening here:_\n\n- `createServerFn()` creates a server-only function that runs exclusively on the server, ensuring our `TMDB_AUTH_TOKEN` environment variable never gets exposed to the client. The server function makes an authenticated request to the TMDB API and returns the parsed JSON response.\n- The route loader runs on the server when a user visits /fetch-movies, calling our server function before the page renders\n- Error handling ensures the component always receives valid data structure - either the movies or an empty array with an error message\n- This pattern provides server-side rendering, automatic type safety, and secure API credential handling out of the box.\n\n## Step 4: Building the Movie Components\n\nNow let's create the components that will display our movie data. Add these components to the same `fetch-movies.tsx` file:\n\n```tsx\n// MovieCard component\nconst MovieCard = ({ movie }: { movie: Movie }) => {\n  return (\n    <div\n      className=\"bg-white/10 border border-white/20 rounded-lg overflow-hidden backdrop-blur-sm shadow-md hover:shadow-xl transition-all duration-300 hover:scale-105\"\n      aria-label={`Movie: ${movie.title}`}\n      role=\"group\"\n    >\n      {movie.poster_path && (\n        <img\n          src={`https://image.tmdb.org/t/p/w500${movie.poster_path}`}\n          alt={movie.title}\n          className=\"w-full h-64 object-cover\"\n        />\n      )}\n      <div className=\"p-4\">\n        <MovieDetails movie={movie} />\n      </div>\n    </div>\n  )\n}\n\n// MovieDetails component\nconst MovieDetails = ({ movie }: { movie: Movie }) => {\n  return (\n    <>\n      <h3 className=\"text-lg font-semibold mb-2 line-clamp-2\">{movie.title}</h3>\n      <p className=\"text-sm text-gray-300 mb-3 line-clamp-3 h-10\">\n        {movie.overview}\n      </p>\n      <div className=\"flex justify-between items-center text-xs text-gray-400\">\n        <span>{movie.release_date}</span>\n        <span className=\"flex items-center\">\n          ⭐️ {movie.vote_average.toFixed(1)}\n        </span>\n      </div>\n    </>\n  )\n}\n```\n\n## Step 5: Creating the MoviesPage Component\n\nFinally, let's create the main component that consumes the loader data:\n\n```tsx\n// MoviesPage component\nconst MoviesPage = () => {\n  const { movies, error } = Route.useLoaderData()\n\n  return (\n    <div\n      className=\"flex items-center justify-center min-h-screen p-4 text-white\"\n      style={{\n        backgroundColor: '#000',\n        backgroundImage:\n          'radial-gradient(ellipse 60% 60% at 0% 100%, #444 0%, #222 60%, #000 100%)',\n      }}\n      role=\"main\"\n      aria-label=\"Popular Movies Section\"\n    >\n      <div className=\"w-full max-w-6xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10\">\n        <h1 className=\"text-3xl mb-6 font-bold text-center\">Popular Movies</h1>\n\n        {error && (\n          <div\n            className=\"text-red-400 text-center mb-4 p-4 bg-red-900/20 rounded-lg\"\n            role=\"alert\"\n          >\n            {error}\n          </div>\n        )}\n\n        {movies.length > 0 ? (\n          <div\n            className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6\"\n            aria-label=\"Movie List\"\n          >\n            {movies.slice(0, 12).map((movie) => (\n              <MovieCard key={movie.id} movie={movie} />\n            ))}\n          </div>\n        ) : (\n          !error && (\n            <div className=\"text-center text-gray-400\" role=\"status\">\n              Loading movies...\n            </div>\n          )\n        )}\n      </div>\n    </div>\n  )\n}\n```\n\n### Understanding How It All Works Together\n\n```mermaid\nsequenceDiagram\n    autonumber\n    actor U as User\n    participant R as Router (TanStack Start)\n    participant L as Route Loader (/fetch-movies)\n    participant A as External API (TMDB)\n    participant V as MoviesPage (UI)\n\n    U->>R: Navigate to /fetch-movies\n    R->>L: Invoke loader (server-side)\n    L->>A: GET /movie/popular\\nAuthorization: Bearer <TOKEN>\n    A-->>L: JSON TMDBResponse\n    alt response.ok\n        L-->>R: { movies, error: null }\n        R->>V: Render SSR with movies\n        V-->>U: HTML with movie grid\n    else non-ok / error\n        L-->>R: { movies: [], error: \"Failed to load movies\" }\n        R->>V: Render SSR with error alert\n        V-->>U: HTML with error state\n    end\n\n    note over L,V: Loader validates response.ok,\\nreturns data or error for initial render\n```\n\nLet's break down how the different parts of our application work together:\n\n1. Route loader: When a user visits `/fetch-movies`, the loader function runs on the server\n2. API call: The loader calls `fetchPopularMovies()` which makes an HTTP request to TMDB\n3. Server-Side rendering: The data is fetched on the server reducing the load on the client side\n4. Component rendering: The `MoviesPage` component receives the data via `Route.useLoaderData()`\n5. Rendering UI: The movie cards are rendered with the fetched data\n\n## Step 6: Testing Your Application\n\nNow you can test your application by visiting [http://localhost:3000/fetch-movies](http://localhost:3000/fetch-movies). If everything is set up correctly, you should see a grid of popular movies with their posters, titles, and ratings. Your app should look like this:\n\n![Netflix style movie setup](https://res.cloudinary.com/dubc3wnbv/image/upload/v1756512946/Screenshot_2025-08-29_at_5.14.26_PM_iiex7o.png)\n\n## Conclusion\n\nYou've successfully built a movie discovery app that integrates with an external API using TanStack Start. This tutorial demonstrated how to use route loaders for server-side data fetching and building UI components with external data.\n\nWhile fetching data at build time in TanStack Start is perfect for static content like blog posts or product pages, it's not ideal for interactive apps. If you need features like real-time updates, caching, or infinite scrolling, you'll want to use [TanStack Query](/query/latest) on the client side instead. TanStack Query makes it easy to handle dynamic data with built-in caching, background updates, and smooth user interactions. By using TanStack Start for static content and TanStack Query for interactive features, you get fast loading pages plus all the modern functionality users expect.\n"
  },
  {
    "path": "docs/start/framework/react/tutorial/reading-writing-file.md",
    "content": "---\nid: reading-and-writing-file\ntitle: Building a Full Stack DevJokes App with TanStack Start\n---\n\nThis tutorial will guide you through building a complete full-stack application using TanStack Start. You'll create a DevJokes app where users can view and add developer-themed jokes, demonstrating key concepts of TanStack Start including server functions, file-based data storage, and React components.\n\nHere's a demo of the app in action:\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/zd0rtKbtlgU?si=7W1Peoo0W0WvZmAd\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n\nThe complete code for this tutorial is available on [GitHub](https://github.com/shrutikapoor08/devjokes).\n\n## What You'll Learn\n\n1. Setting up a TanStack Start project\n2. Implementing server functions\n3. Reading and writing data to files\n4. Building a complete UI with React components\n5. Using TanStack Router for data fetching and navigation\n\n## Prerequisites\n\n- Basic knowledge of React and TypeScript.\n- Node.js and `pnpm` installed on your machine\n\n## Nice to know\n\n- [Server Side Rendering (SSR)](/router/latest/docs/framework/react/guide/ssr)\n- [TanStack Router concepts](/router/latest/docs/framework/react/routing/routing-concepts)\n- [React Query concepts](/query/latest/docs/framework/react/overview)\n\n## Setting up a TanStack Start Project\n\nFirst, let's create a new TanStack Start project:\n\n```bash\npnpx @tanstack/cli@latest create devjokes\ncd devjokes\n```\n\nWhen this script runs, it will ask you a few setup questions. You can either pick choices that work for you or just press enter to accept the defaults.\n\nOptionally, you can pass in a `--add-on` flag to get options such as Shadcn, Clerk, Convex, TanStack Query, etc.\n\nOnce setup is complete, install dependencies and start the development server:\n\n```bash\npnpm i\npnpm dev\n```\n\nFor this project, we'll need the `uuid` package:\n\n```bash\n# Install uuid for generating unique IDs\npnpm add uuid\n```\n\n## Understanding the project structure\n\nAt this point, the project structure should look like this -\n\n```\n/devjokes\n├── src/\n│   ├── routes/\n│   │   ├── demo/                         # Demo routes\n│   │   ├── __root.tsx                    # Root layout\n│   │   └── index.tsx                     # Home page\n│   ├── components/                       # React components\n│   ├── data/                             # Data files\n│   ├── router.tsx                        # Router configuration\n│   ├── routeTree.gen.ts                  # Generated route tree\n│   └── styles.css                        # Global styles\n├── public/                               # Static assets\n├── vite.config.ts                        # TanStack Start configuration\n├── package.json                          # Project dependencies\n└── tsconfig.json                         # TypeScript configuration\n```\n\nThis structure might seem overwhelming at first, but here are the key files you need to focus on:\n\n1. `src/router.tsx` - Sets up routing for your application\n2. `src/routes/__root.tsx` - The root layout component where you can add global styles and components\n3. `src/routes/index.tsx` - Your home page\n\nOnce your project is set up, you can access your app at `localhost:3000`. You should see the default TanStack Start welcome page.\n\nAt this point, your app will look like this:\n\n![TanStack Start Welcome Page After Setup](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-setup.png)\n\n## Step 1: Reading Data From a File\n\nLet's start by creating a file-based storage system for our jokes.\n\n### Step 1.1: Create a JSON File with Jokes\n\nLet's set up a list of jokes that we can use to render on the page. Create a `jokes.json` file within `src/data`:\n\n```bash\ntouch src/data/jokes.json\n```\n\nNow, let's add some sample jokes to this file:\n\n```json\n[\n  {\n    \"id\": \"1\",\n    \"question\": \"Why don't keyboards sleep?\",\n    \"answer\": \"Because they have two shifts\"\n  },\n  {\n    \"id\": \"2\",\n    \"question\": \"Are you a RESTful API?\",\n    \"answer\": \"Because you GET my attention, PUT some love, POST the cutest smile, and DELETE my bad day\"\n  },\n  {\n    \"id\": \"3\",\n    \"question\": \"I used to know a joke about Java\",\n    \"answer\": \"But I ran out of memory.\"\n  },\n  {\n    \"id\": \"4\",\n    \"question\": \"Why do Front-End Developers eat lunch alone?\",\n    \"answer\": \"Because, they don't know how to join tables.\"\n  },\n  {\n    \"id\": \"5\",\n    \"question\": \"I am declaring a war.\",\n    \"answer\": \"var war;\"\n  }\n]\n```\n\n### Step 1.2: Create Types for Our Data\n\nLet's create a file to define our data types. Create a new file at `src/types/index.ts`:\n\n```typescript\n// src/types/index.ts\nexport interface Joke {\n  id: string\n  question: string\n  answer: string\n}\n\nexport type JokesData = Joke[]\n```\n\n### Step 1.3: Create Server Functions to Read the File\n\nLet's create a new file `src/serverActions/jokesActions.ts` to create a server function to perform a read-write operation. We will be creating a server function using [`createServerFn`](https://tanstack.com/start/latest/docs/framework/react/server-functions).\n\n```tsx\n// src/serverActions/jokesActions.ts\nimport { createServerFn } from '@tanstack/react-start'\nimport * as fs from 'node:fs'\nimport type { JokesData } from '../types'\n\nconst JOKES_FILE = 'src/data/jokes.json'\n\nexport const getJokes = createServerFn({ method: 'GET' }).handler(async () => {\n  const jokes = await fs.promises.readFile(JOKES_FILE, 'utf-8')\n  return JSON.parse(jokes) as JokesData\n})\n```\n\nIn this code, we are using `createServerFn` to create a server function that reads the jokes from the JSON file. The `handler` function is where we are using the `fs` module to read the file.\n\n### Step 1.4: Consume Server Function on the Client Side\n\nNow to consume this server function, we can simply call it in our code using TanStack Router which already comes with TanStack Start!\n\nNow let's create a new component `JokesList` to render the jokes on the page with a little Tailwind styling sprinkle.\n\n```tsx\n// src/components/JokesList.tsx\nimport { Joke } from '../types'\n\ninterface JokesListProps {\n  jokes: Joke[]\n}\n\nexport function JokesList({ jokes }: JokesListProps) {\n  if (!jokes || jokes.length === 0) {\n    return <p className=\"text-gray-500 italic\">No jokes found. Add some!</p>\n  }\n\n  return (\n    <div className=\"space-y-4\">\n      <h2 className=\"text-xl font-semibold\">Jokes Collection</h2>\n      {jokes.map((joke) => (\n        <div\n          key={joke.id}\n          className=\"bg-white p-4 rounded-lg shadow-md border border-gray-200\"\n        >\n          <p className=\"font-bold text-lg mb-2\">{joke.question}</p>\n          <p className=\"text-gray-700\">{joke.answer}</p>\n        </div>\n      ))}\n    </div>\n  )\n}\n```\n\nNow let's call our server function inside `index.tsx` using TanStack Router which already comes with TanStack Start!\n\n```jsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { getJokes } from './serverActions/jokesActions'\nimport { JokesList } from './JokesList'\n\nexport const Route = createFileRoute('/')({\n  loader: async () => {\n    // Load jokes data when the route is accessed\n    return getJokes()\n  },\n  component: App,\n})\n\nconst App = () => {\n  const jokes = Route.useLoaderData() || []\n\n  return (\n    <div className=\"max-w-2xl mx-auto py-12 px-4 space-y-6\">\n      <h1 className=\"text-4xl font-bold text-center mb-10\">DevJokes</h1>\n      <JokesList jokes={jokes} />\n    </div>\n  )\n}\n```\n\nWhen the page loads, `jokes` will have data from the `jokes.json` file already!\n\nWith a little Tailwind styling, the app should look like this:\n\n![DevJoke App with 5 DevJokes](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-devjokes-1.png)\n\n## Step 2: Writing Data to a File\n\nSo far, we have been able to read from the file successfully! We can use the same approach to write to the `jokes.json` file using `createServerFunction`.\n\n### Step 2.1: Create Server Function to Write to the File\n\nIt's time to modify the `jokes.json` file so that we can add new jokes to it. Let's create another server function but this time with a `POST` method to write to the same file.\n\n```tsx\n// src/serverActions/jokesActions.ts\nimport { createServerFn } from '@tanstack/react-start'\nimport * as fs from 'node:fs'\nimport { v4 as uuidv4 } from 'uuid' // Add this import\nimport type { Joke, JokesData } from '../types'\n\nconst JOKES_FILE = 'src/data/jokes.json'\n\nexport const getJokes = createServerFn({ method: 'GET' }).handler(async () => {\n  const jokes = await fs.promises.readFile(JOKES_FILE, 'utf-8')\n  return JSON.parse(jokes) as JokesData\n})\n\n// Add this new server function\nexport const addJoke = createServerFn({ method: 'POST' })\n  .inputValidator((data: { question: string; answer: string }) => {\n    // Validate input data\n    if (!data.question || !data.question.trim()) {\n      throw new Error('Joke question is required')\n    }\n    if (!data.answer || !data.answer.trim()) {\n      throw new Error('Joke answer is required')\n    }\n    return data\n  })\n  .handler(async ({ data }) => {\n    try {\n      // Read the existing jokes from the file\n      const jokesData = await getJokes()\n\n      // Create a new joke with a unique ID\n      const newJoke: Joke = {\n        id: uuidv4(),\n        question: data.question,\n        answer: data.answer,\n      }\n\n      // Add the new joke to the list\n      const updatedJokes = [...jokesData, newJoke]\n\n      // Write the updated jokes back to the file\n      await fs.promises.writeFile(\n        JOKES_FILE,\n        JSON.stringify(updatedJokes, null, 2),\n        'utf-8',\n      )\n\n      return newJoke\n    } catch (error) {\n      console.error('Failed to add joke:', error)\n      throw new Error('Failed to add joke')\n    }\n  })\n```\n\nIn this code:\n\n- We are using `createServerFn` to create server functions that run on the server but can be called from the client. This server function is used to write data to the file.\n- We are going to first use `inputValidator` to validate the input data. This is a good practice to ensure that the data we are receiving is in the correct format.\n- We are going to perform the actual write operation in the `handler` function.\n- `getJokes` reads the jokes from our JSON file.\n- `addJoke` validates the input data and adds a new joke to our file.\n- We're using `uuidv4()` to generate unique IDs for our jokes.\n\n### Step 2.2: Adding a Form to Add Jokes to our JSON File\n\nNow, let's modify our home page to display jokes and provide a form to add new ones. Let's create a new component called `JokeForm.jsx` and add the following form to it:\n\n```tsx\n// src/components/JokeForm.tsx\nimport { useState } from 'react'\nimport { useRouter } from '@tanstack/react-router'\nimport { addJoke } from '../serverActions/jokesActions'\n\nexport function JokeForm() {\n  const router = useRouter()\n  const [question, setQuestion] = useState('')\n  const [answer, setAnswer] = useState('')\n  const [isSubmitting, setIsSubmitting] = useState(false)\n  const [error, setError] = useState<string | null>(null)\n\n  return (\n    <form onSubmit={handleSubmit} className=\"mb-8\">\n      {error && (\n        <div className=\"bg-red-100 text-red-700 p-2 rounded mb-4\">{error}</div>\n      )}\n\n      <div className=\"flex flex-col sm:flex-row gap-4 mb-8\">\n        <input\n          id=\"question\"\n          type=\"text\"\n          placeholder=\"Enter joke question\"\n          className=\"w-full p-2 border rounded focus:ring focus:ring-blue-300 flex-1\"\n          value={question}\n          onChange={(e) => setQuestion(e.target.value)}\n          required\n        />\n\n        <input\n          id=\"answer\"\n          type=\"text\"\n          placeholder=\"Enter joke answer\"\n          className=\"w-full p-2 border rounded focus:ring focus:ring-blue-300 flex-1 py-4\"\n          value={answer}\n          onChange={(e) => setAnswer(e.target.value)}\n          required\n        />\n\n        <button\n          type=\"submit\"\n          disabled={isSubmitting}\n          className=\"bg-blue-500 hover:bg-blue-600 text-white font-medium rounded disabled:opacity-50 px-4\"\n        >\n          {isSubmitting ? 'Adding...' : 'Add Joke'}\n        </button>\n      </div>\n    </form>\n  )\n}\n```\n\n### Step 2.3: Wire Up the Form to the Server Function\n\nNow, let's wire the form up to our `addJoke` server function in the `handleSubmit` function. Calling a server action is simple! It's just a function call.\n\n```tsx\n//JokeForm.tsx\nimport { useState } from 'react'\nimport { useRouter } from '@tanstack/react-router'\nimport { addJoke } from '../serverActions/jokesActions'\n\nexport function JokeForm() {\n  const router = useRouter()\n  const [question, setQuestion] = useState('')\n  const [answer, setAnswer] = useState('')\n  const [isSubmitting, setIsSubmitting] = useState(false)\n  const [error, setError] = useState<string | null>(null)\n\n  const handleSubmit = async () => {\n    if (!question || !answer || isSubmitting) return\n    try {\n      setIsSubmitting(true)\n      await addJoke({\n        data: { question, answer },\n      })\n\n      // Clear form\n      setQuestion('')\n      setAnswer('')\n\n      // Refresh data\n      router.invalidate()\n    } catch (error) {\n      console.error('Failed to add joke:', error)\n      setError('Failed to add joke')\n    } finally {\n      setIsSubmitting(false)\n    }\n  }\n\n  return (\n    <form onSubmit={handleSubmit} className=\"mb-8\">\n      {error && (\n        <div className=\"bg-red-100 text-red-700 p-2 rounded mb-4\">{error}</div>\n      )}\n      <div className=\"flex flex-col sm:flex-row gap-4 mb-8\">\n        <input\n          id=\"question\"\n          type=\"text\"\n          placeholder=\"Enter joke question\"\n          className=\"w-full p-2 border rounded focus:ring focus:ring-blue-300 flex-1\"\n          value={question}\n          onChange={(e) => setQuestion(e.target.value)}\n          required\n        />\n        <input\n          id=\"answer\"\n          type=\"text\"\n          placeholder=\"Enter joke answer\"\n          className=\"w-full p-2 border rounded focus:ring focus:ring-blue-300 flex-1 py-4\"\n          value={answer}\n          onChange={(e) => setAnswer(e.target.value)}\n          required\n        />\n        <button\n          type=\"submit\"\n          disabled={isSubmitting}\n          className=\"bg-blue-500 hover:bg-blue-600 text-white font-medium rounded disabled:opacity-50 px-4\"\n        >\n          {isSubmitting ? 'Adding...' : 'Add Joke'}\n        </button>\n      </div>\n    </form>\n  )\n}\n```\n\nWith this, our UI should look like this:\n![DevJoke App with Form to Add Jokes](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-devjokes-2.png)\n\n## Understanding How It All Works Together\n\nLet's break down how the different parts of our application work together:\n\n1. **Server Functions**: These run on the server and handle data operations\n   - `getJokes`: Reads the jokes from our JSON file\n   - `addJoke`: Adds a new joke to our JSON file\n\n2. **TanStack Router**: Handles routing and data loading\n   - The loader function fetches jokes data when the route is accessed\n   - `useLoaderData` makes this data available in our component\n   - `router.invalidate()` refreshes the data when we add a new joke\n\n3. **React Components**: Build the UI of our application\n   - `JokesList`: Displays the list of jokes\n   - `JokeForm`: Provides a form for adding new jokes\n\n4. **File-Based Storage**: Stores our jokes in a JSON file\n   - Reading and writing are handled by Node.js `fs` module\n   - Data is persisted between server restarts\n\n## How Data Flows Through the Application\n\n### Data Flow\n\n```mermaid\nsequenceDiagram\nautonumber\nactor User\nparticipant UI as Browser (HomePage + Form)\nparticipant Loader as Route Loader (loader)\nparticipant Server\nparticipant Store as jokes.json\n\n%% Visiting the Home Page\nUser ->> UI: Visit /\nUI ->> Loader: loader() calls getJokes()\nLoader ->> Server: getJokes()\nServer ->> Store: Read jokes.json\nStore -->> Server: jokes data\nServer -->> Loader: jokes[]\nLoader -->> UI: useLoaderData() → jokes[]\n\n%% Adding a New Joke\nUser ->> UI: Fill form and submit\nUI ->> Server: handleSubmit → addJoke(newJoke)\nServer ->> Store: Read jokes.json\nServer ->> Store: Write updated jokes.json\nServer -->> UI: addJoke() resolved\nUI ->> Loader: router.invalidate() (re-run loader)\nLoader ->> Server: getJokes()\nServer ->> Store: Read jokes.json\nStore -->> Server: updated jokes[]\nServer -->> Loader: updated jokes[]\nLoader -->> UI: useLoaderData() → updated jokes[]\n```\n\nWhen a user visits the home page:\n\n1. The `loader` function in the route calls `getJokes()` server function\n2. The server reads `jokes.json` and returns the jokes data\n3. This data is passed to the `HomePage` component through `useLoaderData()`\n4. The `HomePage` component passes the data to the `JokesList` component\n\nWhen a user adds a new joke:\n\n1. They fill out the form and submit it\n2. The `handleSubmit` function calls the `addJoke()` server function\n3. The server reads the current jokes, adds the new joke, and writes the updated data back to `jokes.json`\n4. After the operation completes, we call `router.invalidate()` to refresh the data\n5. This triggers the loader again, fetching the updated jokes\n6. The UI updates to show the new joke in the list\n\nHere's a demo of the app in action:\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/zd0rtKbtlgU?si=7W1Peoo0W0WvZmAd\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n\n## Common Issues and Debugging\n\nHere are some common issues you might encounter when building your TanStack Start application and how to resolve them:\n\n### Server Functions Not Working\n\nIf your server functions aren't working as expected:\n\n1. Check that you're using the correct HTTP method (`GET`, `POST`, etc.)\n2. Ensure file paths are correct and accessible to the server\n3. Check the server console for error messages\n4. Make sure you're not using client-only APIs in server functions\n\n### Route Data Not Loading\n\nIf route data isn't loading properly:\n\n1. Verify that your loader function is properly implemented\n2. Check that you're using `useLoaderData()` correctly\n3. Look for errors in the browser console\n4. Make sure your server function is working correctly\n\n### Form Submission Issues\n\nIf form submissions aren't working:\n\n1. Check for validation errors in your server function\n2. Verify that form event prevention (`e.preventDefault()`) is working\n3. Make sure state updates are happening correctly\n4. Look for network errors in the browser's Developer Tools\n\n### File Reading/Writing Issues\n\nWhen working with file-based storage:\n\n1. Ensure file paths are correct\n2. Check file permissions\n3. Make sure you're handling async operations properly with `await`\n4. Add proper error handling for file operations\n\n## Conclusion\n\nCongratulations! You've built a full-stack DevJokes app using TanStack Start. In this tutorial, you've learned:\n\n- How to set up a TanStack Start project\n- How to implement server functions for data operations\n- How to read and write data to files\n- How to build React components for your UI\n- How to use TanStack Router for routing and data fetching\n\nThis simple application demonstrates the power of TanStack Start for building full-stack applications with a minimal amount of code. You can extend this app by adding features like:\n\n- Joke categories\n- Ability to edit and delete jokes\n- User authentication\n- Voting for favorite jokes\n\nThe complete code for this tutorial is available on [GitHub](https://github.com/shrutikapoor08/devjokes).\n"
  },
  {
    "path": "docs/start/framework/solid/build-from-scratch.md",
    "content": "---\nid: build-from-scratch\ntitle: Build a Project from Scratch\n---\n\n> [!NOTE]\n> If you chose to quick start with an example or cloned project, you can skip this guide and move on to the [Routing](./guide/routing) guide.\n\n_So you want to build a TanStack Start project from scratch?_\n\nThis guide will help you build a **very** basic TanStack Start web application. Together, we will use TanStack Start to:\n\n- Serve an index page\n- Display a counter\n- Increment the counter on the server and client\n\nLet's create a new project directory and initialize it.\n\n```shell\nmkdir myApp\ncd myApp\nnpm init -y\n```\n\n> [!NOTE]\n> We use `npm` in all of these examples, but you can use your package manager of choice instead.\n\n## TypeScript Configuration\n\nWe highly recommend using TypeScript with TanStack Start. Create a `tsconfig.json` file with at least the following settings:\n\n```json\n{\n  \"compilerOptions\": {\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"target\": \"ES2022\",\n    \"skipLibCheck\": true,\n    \"strictNullChecks\": true\n  }\n}\n```\n\n> [!NOTE]\n> Enabling `verbatimModuleSyntax` can result in server bundles leaking into client bundles. It is recommended to keep this option disabled.\n\n## Install Dependencies\n\nTanStack Start is powered by [Vite](https://vite.dev/) and [TanStack Router](https://tanstack.com/router) and requires them as dependencies.\n\nTo install them, run:\n\n```shell\nnpm i @tanstack/solid-start @tanstack/solid-router vite\n```\n\nYou'll also need SolidJS:\n\n```shell\nnpm i solid-js vite-plugin-solid\n```\n\nand some TypeScript:\n\n```shell\nnpm i -D typescript @types/node\n```\n\n## Update Configuration Files\n\nWe'll then update our `package.json` to use Vite's CLI and set `\"type\": \"module\"`:\n\n```json\n{\n  // ...\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\"\n  }\n}\n```\n\nThen configure TanStack Start's Vite plugin in `vite.config.ts`:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tanstackStart(),\n    // solid's vite plugin must come after start's vite plugin\n    viteSolid({ ssr: true }),\n  ],\n})\n```\n\n## Add the Basic Templating\n\nThere are 2 required files for TanStack Start usage:\n\n1. The router configuration\n2. The root of your application\n\nOnce configuration is done, we'll have a file tree that looks like the following:\n\n```\n.\n├── src/\n│   ├── routes/\n│   │   └── `__root.tsx`\n│   ├── `router.tsx`\n│   ├── `routeTree.gen.ts`\n├── `vite.config.ts`\n├── `package.json`\n└── `tsconfig.json`\n```\n\n## The Router Configuration\n\nThis is the file that will dictate the behavior of TanStack Router used within Start. Here, you can configure everything\nfrom the default [preloading functionality](/router/latest/docs/framework/solid/guide/preloading) to [caching staleness](/router/latest/docs/framework/solid/guide/data-loading).\n\n> [!NOTE]\n> You won't have a `routeTree.gen.ts` file yet. This file will be generated when you run TanStack Start for the first time.\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n```\n\n## The Root of Your Application\n\nFinally, 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.\n\n```tsx\n// src/routes/__root.tsx\n/// <reference types=\"vite/client\" />\nimport * as Solid from 'solid-js'\nimport {\n  Outlet,\n  createRootRoute,\n  HeadContent,\n  Scripts,\n} from '@tanstack/solid-router'\nimport { HydrationScript } from 'solid-js/web'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: Readonly<{ children: Solid.JSX.Element }>) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <Solid.Suspense>{children}</Solid.Suspense>\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n## Writing Your First Route\n\nNow that we have the basic templating setup, we can write our first route. This is done by creating a new file in the `src/routes` directory.\n\n```tsx\nimport * as fs from 'node:fs'\nimport { createFileRoute, useRouter } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst filePath = 'count.txt'\n\nasync function readCount() {\n  return parseInt(\n    await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'),\n  )\n}\n\nconst getCount = createServerFn({\n  method: 'GET',\n}).handler(() => {\n  return readCount()\n})\n\nconst updateCount = createServerFn({ method: 'POST' })\n  .inputValidator((d: number) => d)\n  .handler(async ({ data }) => {\n    const count = await readCount()\n    await fs.promises.writeFile(filePath, `${count + data}`)\n  })\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => await getCount(),\n})\n\nfunction Home() {\n  const router = useRouter()\n  const state = Route.useLoaderData()\n\n  return (\n    <button\n      type=\"button\"\n      onClick={() => {\n        updateCount({ data: 1 }).then(() => {\n          router.invalidate()\n        })\n      }}\n    >\n      Add 1 to {state()}?\n    </button>\n  )\n}\n```\n\nThat's it! 🤯 You've now set up a TanStack Start project and written your first route. 🎉\n\nYou can now run `npm run dev` to start your server and navigate to `http://localhost:3000` to see your route in action.\n\nYou want to deploy your application? Check out the [hosting guide](./guide/hosting.md).\n"
  },
  {
    "path": "docs/start/framework/solid/getting-started.md",
    "content": "---\nid: getting-started\ntitle: Getting Started\n---\n\n## Start a new project from scratch\n\nChoose one of the following options to start building a _new_ TanStack Start project:\n\n- [TanStack Start CLI](https://tanstack.com/cli/latest) - Just run `npx @tanstack/cli@latest create --framework solid`. Local, fast, and optionally customizable\n- [TanStack Builder](https://tanstack.com/builder) (coming soon!) - A visual interface to configure new TanStack projects with a few clicks\n- [Quick Start Examples](./quick-start) Download or clone one of our official examples\n- [Build a project from scratch](./build-from-scratch) - A guide to building a TanStack Start project line-by-line, file-by-file.\n\n## Next Steps\n\nUnless you chose to build a project from scratch, you can now move on to the [Routing](./guide/routing) guide to learn how to use TanStack Start!\n"
  },
  {
    "path": "docs/start/framework/solid/guide/authentication-overview.md",
    "content": "---\nref: docs/start/framework/react/guide/authentication-overview.md\nreplace:\n  {\n    '@tanstack/react-start': '@tanstack/solid-start',\n    'React': 'SolidJS',\n    'react-router': 'solid-router',\n  }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/authentication.md",
    "content": "---\nid: authentication\ntitle: Authentication\n---\n\nThis guide covers authentication patterns and shows how to implement your own authentication system with TanStack Start.\n\n> **📋 Before You Start:** Check our [Authentication Overview](./authentication-overview.md) for all available options including partner solutions and hosted services.\n\n## Authentication Approaches\n\nYou have several options for authentication in your TanStack Start application:\n\n**Hosted Solutions:**\n\n1. **[Clerk](https://clerk.dev)** - Complete authentication platform with UI components\n2. **[WorkOS](https://workos.com)** - Enterprise-focused with SSO and compliance features\n3. **[Better Auth](https://www.better-auth.com/)** - Open-source TypeScript library\n4. **[Auth.js](https://authjs.dev/)** - Open-source library supporting 80+ OAuth providers\n\n**DIY Implementation Benefits:**\n\n- **Full Control**: Complete customization over authentication flow\n- **No Vendor Lock-in**: Own your authentication logic and user data\n- **Custom Requirements**: Implement specific business logic or compliance needs\n- **Cost Control**: No per-user pricing or usage limits\n\nAuthentication involves many considerations including password security, session management, rate limiting, CSRF protection, and various attack vectors.\n\n## Core Concepts\n\n### Authentication vs Authorization\n\n- **Authentication**: Who is this user? (Login/logout)\n- **Authorization**: What can this user do? (Permissions/roles)\n\nTanStack Start provides the tools for both through server functions, sessions, and route protection.\n\n## Essential Building Blocks\n\n### 1. Server Functions for Authentication\n\nServer functions handle sensitive authentication logic securely on the server:\n\n```tsx\nimport { createServerFn } from '@tanstack/solid-start'\nimport { redirect } from '@tanstack/solid-router'\n\n// Login server function\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator((data: { email: string; password: string }) => data)\n  .handler(async ({ data }) => {\n    // Verify credentials (replace with your auth logic)\n    const user = await authenticateUser(data.email, data.password)\n\n    if (!user) {\n      return { error: 'Invalid credentials' }\n    }\n\n    // Create session\n    const session = await useAppSession()\n    await session.update({\n      userId: user.id,\n      email: user.email,\n    })\n\n    // Redirect to protected area\n    throw redirect({ to: '/dashboard' })\n  })\n\n// Logout server function\nexport const logoutFn = createServerFn({ method: 'POST' }).handler(async () => {\n  const session = await useAppSession()\n  await session.clear()\n  throw redirect({ to: '/' })\n})\n\n// Get current user\nexport const getCurrentUserFn = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    const session = await useAppSession()\n    const userId = session.get('userId')\n\n    if (!userId) {\n      return null\n    }\n\n    return await getUserById(userId)\n  },\n)\n```\n\n### 2. Session Management\n\nTanStack Start provides secure HTTP-only cookie sessions:\n\n```tsx\n// utils/session.ts\nimport { useSession } from '@tanstack/solid-start/server'\n\ntype SessionData = {\n  userId?: string\n  email?: string\n  role?: string\n}\n\nexport function useAppSession() {\n  return useSession<SessionData>({\n    // Session configuration\n    name: 'app-session',\n    password: process.env.SESSION_SECRET!, // At least 32 characters\n    // Optional: customize cookie settings\n    cookie: {\n      secure: process.env.NODE_ENV === 'production',\n      sameSite: 'lax',\n      httpOnly: true,\n    },\n  })\n}\n```\n\n### 3. Authentication Context\n\nShare authentication state across your application:\n\n```tsx\n// contexts/auth.tsx\nimport { createContext, useContext } from 'solid-js'\nimport { useServerFn } from '@tanstack/solid-start'\nimport { getCurrentUserFn } from '../server/auth'\n\ntype User = {\n  id: string\n  email: string\n  role: string\n}\n\ntype AuthContextType = {\n  user: User | null\n  isLoading: boolean\n  refetch: () => void\n}\n\nconst AuthContext = createContext<AuthContextType | undefined>(undefined)\n\nexport function AuthProvider(props) {\n  const { data: user, isLoading, refetch } = useServerFn(getCurrentUserFn)\n\n  return (\n    <AuthContext.Provider value={{ user, isLoading, refetch }}>\n      {props.children}\n    </AuthContext.Provider>\n  )\n}\n\nexport function useAuth() {\n  const context = useContext(AuthContext)\n  if (!context) {\n    throw new Error('useAuth must be used within AuthProvider')\n  }\n  return context\n}\n```\n\n### 4. Route Protection\n\nProtect routes using `beforeLoad`:\n\n```tsx\n// routes/_authed.tsx - Layout route for protected pages\nimport { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { getCurrentUserFn } from '../server/auth'\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: async ({ location }) => {\n    const user = await getCurrentUserFn()\n\n    if (!user) {\n      throw redirect({\n        to: '/login',\n        search: { redirect: location.href },\n      })\n    }\n\n    // Pass user to child routes\n    return { user }\n  },\n})\n```\n\n```tsx\n// routes/_authed/dashboard.tsx - Protected route\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_authed/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  const context = Route.useRouteContext()\n\n  return (\n    <div>\n      <h1>Welcome, {context().user.email}!</h1>\n      {/* Dashboard content */}\n    </div>\n  )\n}\n```\n\n## Implementation Patterns\n\n### Basic Email/Password Authentication\n\n```tsx\n// server/auth.ts\nimport bcrypt from 'bcryptjs'\nimport { createServerFn } from '@tanstack/solid-start'\n\n// User registration\nexport const registerFn = createServerFn({ method: 'POST' })\n  .inputValidator(\n    (data: { email: string; password: string; name: string }) => data,\n  )\n  .handler(async ({ data }) => {\n    // Check if user exists\n    const existingUser = await getUserByEmail(data.email)\n    if (existingUser) {\n      return { error: 'User already exists' }\n    }\n\n    // Hash password\n    const hashedPassword = await bcrypt.hash(data.password, 12)\n\n    // Create user\n    const user = await createUser({\n      email: data.email,\n      password: hashedPassword,\n      name: data.name,\n    })\n\n    // Create session\n    const session = await useAppSession()\n    await session.update({ userId: user.id })\n\n    return { success: true, user: { id: user.id, email: user.email } }\n  })\n\nasync function authenticateUser(email: string, password: string) {\n  const user = await getUserByEmail(email)\n  if (!user) return null\n\n  const isValid = await bcrypt.compare(password, user.password)\n  return isValid ? user : null\n}\n```\n\n### Role-Based Access Control (RBAC)\n\n```tsx\n// utils/auth.ts\nexport const roles = {\n  USER: 'user',\n  ADMIN: 'admin',\n  MODERATOR: 'moderator',\n} as const\n\ntype Role = (typeof roles)[keyof typeof roles]\n\nexport function hasPermission(userRole: Role, requiredRole: Role): boolean {\n  const hierarchy = {\n    [roles.USER]: 0,\n    [roles.MODERATOR]: 1,\n    [roles.ADMIN]: 2,\n  }\n\n  return hierarchy[userRole] >= hierarchy[requiredRole]\n}\n\n// Protected route with role check\nexport const Route = createFileRoute('/_authed/admin/')({\n  beforeLoad: async ({ context }) => {\n    if (!hasPermission(context.user.role, roles.ADMIN)) {\n      throw redirect({ to: '/unauthorized' })\n    }\n  },\n})\n```\n\n### Social Authentication Integration\n\n```tsx\n// Example with OAuth providers\nexport const authProviders = {\n  google: {\n    clientId: process.env.GOOGLE_CLIENT_ID!,\n    redirectUri: `${process.env.APP_URL}/auth/google/callback`,\n  },\n  github: {\n    clientId: process.env.GITHUB_CLIENT_ID!,\n    redirectUri: `${process.env.APP_URL}/auth/github/callback`,\n  },\n}\n\nexport const initiateOAuthFn = createServerFn({ method: 'POST' })\n  .inputValidator((data: { provider: 'google' | 'github' }) => data)\n  .handler(async ({ data }) => {\n    const provider = authProviders[data.provider]\n    const state = generateRandomState()\n\n    // Store state in session for CSRF protection\n    const session = await useAppSession()\n    await session.update({ oauthState: state })\n\n    // Generate OAuth URL\n    const authUrl = generateOAuthUrl(provider, state)\n\n    throw redirect({ href: authUrl })\n  })\n```\n\n### Password Reset Flow\n\n```tsx\n// Password reset request\nexport const requestPasswordResetFn = createServerFn({ method: 'POST' })\n  .inputValidator((data: { email: string }) => data)\n  .handler(async ({ data }) => {\n    const user = await getUserByEmail(data.email)\n    if (!user) {\n      // Don't reveal if email exists\n      return { success: true }\n    }\n\n    const token = generateSecureToken()\n    const expires = new Date(Date.now() + 60 * 60 * 1000) // 1 hour\n\n    await savePasswordResetToken(user.id, token, expires)\n    await sendPasswordResetEmail(user.email, token)\n\n    return { success: true }\n  })\n\n// Password reset confirmation\nexport const resetPasswordFn = createServerFn({ method: 'POST' })\n  .inputValidator((data: { token: string; newPassword: string }) => data)\n  .handler(async ({ data }) => {\n    const resetToken = await getPasswordResetToken(data.token)\n\n    if (!resetToken || resetToken.expires < new Date()) {\n      return { error: 'Invalid or expired token' }\n    }\n\n    const hashedPassword = await bcrypt.hash(data.newPassword, 12)\n    await updateUserPassword(resetToken.userId, hashedPassword)\n    await deletePasswordResetToken(data.token)\n\n    return { success: true }\n  })\n```\n\n## Security Best Practices\n\n### 1. Password Security\n\n```tsx\n// Use strong hashing (bcrypt, scrypt, or argon2)\nimport bcrypt from 'bcryptjs'\n\nconst saltRounds = 12 // Adjust based on your security needs\nconst hashedPassword = await bcrypt.hash(password, saltRounds)\n```\n\n### 2. Session Security\n\n```tsx\n// Use secure session configuration\nexport function useAppSession() {\n  return useSession({\n    name: 'app-session',\n    password: process.env.SESSION_SECRET!, // 32+ characters\n    cookie: {\n      secure: process.env.NODE_ENV === 'production', // HTTPS only in production\n      sameSite: 'lax', // CSRF protection\n      httpOnly: true, // XSS protection\n      maxAge: 7 * 24 * 60 * 60, // 7 days\n    },\n  })\n}\n```\n\n### 3. Rate Limiting\n\n```tsx\n// Simple in-memory rate limiting (use Redis in production)\nconst loginAttempts = new Map<string, { count: number; resetTime: number }>()\n\nexport const rateLimitLogin = (ip: string): boolean => {\n  const now = Date.now()\n  const attempts = loginAttempts.get(ip)\n\n  if (!attempts || now > attempts.resetTime) {\n    loginAttempts.set(ip, { count: 1, resetTime: now + 15 * 60 * 1000 }) // 15 min\n    return true\n  }\n\n  if (attempts.count >= 5) {\n    return false // Too many attempts\n  }\n\n  attempts.count++\n  return true\n}\n```\n\n### 4. Input Validation\n\n```tsx\nimport { z } from 'zod'\n\nconst loginSchema = z.object({\n  email: z.string().email().max(255),\n  password: z.string().min(8).max(100),\n})\n\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator((data) => loginSchema.parse(data))\n  .handler(async ({ data }) => {\n    // data is now validated\n  })\n```\n\n## Testing Authentication\n\n### Unit Testing Server Functions\n\n```tsx\n// __tests__/auth.test.ts\nimport { describe, it, expect, beforeEach } from 'vitest'\nimport { loginFn } from '../server/auth'\n\ndescribe('Authentication', () => {\n  beforeEach(async () => {\n    await setupTestDatabase()\n  })\n\n  it('should login with valid credentials', async () => {\n    const result = await loginFn({\n      data: { email: 'test@example.com', password: 'password123' },\n    })\n\n    expect(result.error).toBeUndefined()\n    expect(result.user).toBeDefined()\n  })\n\n  it('should reject invalid credentials', async () => {\n    const result = await loginFn({\n      data: { email: 'test@example.com', password: 'wrongpassword' },\n    })\n\n    expect(result.error).toBe('Invalid credentials')\n  })\n})\n```\n\n### Integration Testing\n\n```tsx\n// __tests__/auth-flow.test.tsx\nimport { render, screen, fireEvent, waitFor } from '@solidjs/testing-library'\nimport { RouterProvider, createMemoryHistory } from '@tanstack/solid-router'\nimport { router } from '../router'\n\ndescribe('Authentication Flow', () => {\n  it('should redirect to login when accessing protected route', async () => {\n    const history = createMemoryHistory()\n    history.push('/dashboard') // Protected route\n\n    render(<RouterProvider router={router} history={history} />)\n\n    await waitFor(() => {\n      expect(screen.getByText('Login')).toBeInTheDocument()\n    })\n  })\n})\n```\n\n## Common Patterns\n\n### Loading States\n\n```tsx\nfunction LoginForm() {\n  const [isLoading, setIsLoading] = createSignal(false)\n  const loginMutation = useServerFn(loginFn)\n\n  const handleSubmit = async (data: LoginData) => {\n    setIsLoading(true)\n    try {\n      await loginMutation.mutate(data)\n    } catch (error) {\n      // Handle error\n    } finally {\n      setIsLoading(false)\n    }\n  }\n\n  return (\n    <form onSubmit={handleSubmit}>\n      {/* Form fields */}\n      <button disabled={isLoading()}>\n        {isLoading() ? 'Logging in...' : 'Login'}\n      </button>\n    </form>\n  )\n}\n```\n\n### Remember Me Functionality\n\n```tsx\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator(\n    (data: { email: string; password: string; rememberMe?: boolean }) => data,\n  )\n  .handler(async ({ data }) => {\n    const user = await authenticateUser(data.email, data.password)\n    if (!user) return { error: 'Invalid credentials' }\n\n    const session = await useAppSession()\n    await session.update(\n      { userId: user.id },\n      {\n        // Extend session if remember me is checked\n        maxAge: data.rememberMe ? 30 * 24 * 60 * 60 : undefined, // 30 days vs session\n      },\n    )\n\n    return { success: true }\n  })\n```\n\n## Migration from Other Solutions\n\n### From Client-Side Auth\n\nIf you're migrating from client-side authentication (localStorage, context only):\n\n1. Move authentication logic to server functions\n2. Replace localStorage with server sessions\n3. Update route protection to use `beforeLoad`\n4. Add proper security headers and CSRF protection\n\n### From Other Frameworks\n\n- **Next.js**: Replace API routes with server functions, migrate NextAuth sessions\n- **Remix**: Convert loaders/actions to server functions, adapt session patterns\n- **SvelteKit**: Move form actions to server functions, update route protection\n\n## Production Considerations\n\nWhen choosing your authentication approach, consider these factors:\n\n### Hosted vs DIY Comparison\n\n**Hosted Solutions (Clerk, WorkOS, Better Auth):**\n\n- Pre-built security measures and regular updates\n- UI components and user management features\n- Compliance certifications and audit trails\n- Support and documentation\n- Per-user or subscription pricing\n\n**DIY Implementation:**\n\n- Complete control over implementation and data\n- No ongoing subscription costs\n- Custom business logic and workflows\n- Responsibility for security updates and monitoring\n- Need to handle edge cases and attack vectors\n\n### Security Considerations\n\nAuthentication systems need to handle various security aspects:\n\n- Password hashing and timing attack prevention\n- Session management and fixation protection\n- CSRF and XSS protection\n- Rate limiting and brute force prevention\n- OAuth flow security\n- Compliance requirements (GDPR, CCPA, etc.)\n\n## Next Steps\n\nWhen implementing authentication, consider:\n\n- **Security Review**: Review your implementation for security best practices\n- **Performance**: Add caching for user lookups and session validation\n- **Monitoring**: Add logging and monitoring for authentication events\n- **Compliance**: Ensure compliance with relevant regulations if storing personal data\n\nFor other authentication approaches, check the [Authentication Overview](./authentication-overview.md). For specific integration help, see the [How-to Guides](/router/latest/docs/framework/solid/how-to/README.md#authentication) or explore our [working examples](https://github.com/TanStack/router/tree/main/examples/solid).\n"
  },
  {
    "path": "docs/start/framework/solid/guide/client-entry-point.md",
    "content": "---\nid: client-entry-point\ntitle: Client Entry Point\n---\n\n# Client Entry Point\n\n> [!NOTE]\n> The client entry point is **optional** out of the box. If not provided, TanStack Start will automatically handle the client entry point for you using the below as a default.\n\nGetting our html to the client is only half the battle. Once there, we need to hydrate our client-side JavaScript once the route resolves to the client. We do this by hydrating the root of our application with the `StartClient` component:\n\n```tsx\n// src/client.tsx\nimport { hydrate } from 'solid-js/web'\nimport { StartClient, hydrateStart } from '@tanstack/solid-start/client'\n\nhydrateStart().then((router) => {\n  hydrate(() => <StartClient router={router} />, document)\n})\n```\n\nThis enables us to kick off client-side routing once the user's initial server request has fulfilled.\n\n## Error Handling\n\nYou can wrap your client entry point with error boundaries to handle client-side errors gracefully:\n\n```tsx\n// src/client.tsx\nimport { StartClient } from '@tanstack/solid-start/client'\nimport { hydrate } from 'solid-js/web'\nimport { ErrorBoundary } from './components/ErrorBoundary'\n\nhydrate(\n  () => (\n    <ErrorBoundary>\n      <StartClient />\n    </ErrorBoundary>\n  ),\n  document.body,\n)\n```\n\n## Development vs Production\n\nYou may want different behavior in development vs production:\n\n```tsx\n// src/client.tsx\nimport { StartClient } from '@tanstack/solid-start/client'\nimport { hydrate } from 'solid-js/web'\n\nconst App = (\n  <>\n    {import.meta.env.DEV && <div>Development Mode</div>}\n    <StartClient />\n  </>\n)\n\nhydrate(() => <App />, document.body)\n```\n\nThe client entry point gives you full control over how your application initializes on the client side while working seamlessly with TanStack Start's server-side rendering.\n"
  },
  {
    "path": "docs/start/framework/solid/guide/code-execution-patterns.md",
    "content": "---\nid: code-execution-patterns\ntitle: Code Execution Patterns\n---\n\nThis guide covers patterns for controlling where code runs in your TanStack Start application - server-only, client-only, or isomorphic (both environments). For foundational concepts, see the [Execution Model](./execution-model.md) guide.\n\n## Quick Start\n\nSet up execution boundaries in your TanStack Start application:\n\n```tsx\nimport {\n  createServerFn,\n  createServerOnlyFn,\n  createClientOnlyFn,\n  createIsomorphicFn,\n} from '@tanstack/solid-start'\n\n// Server function (RPC call)\nconst getUsers = createServerFn().handler(async () => {\n  return await db.users.findMany()\n})\n\n// Server-only utility (crashes on client)\nconst getSecret = createServerOnlyFn(() => process.env.API_SECRET)\n\n// Client-only utility (crashes on server)\nconst saveToStorage = createClientOnlyFn((data: any) => {\n  localStorage.setItem('data', JSON.stringify(data))\n})\n\n// Different implementations per environment\nconst logger = createIsomorphicFn()\n  .server((msg) => console.log(`[SERVER]: ${msg}`))\n  .client((msg) => console.log(`[CLIENT]: ${msg}`))\n```\n\n## Implementation Patterns\n\n### Progressive Enhancement\n\n```tsx\n// Component works without JS, enhanced with JS\nfunction SearchForm() {\n  const [query, setQuery] = createSignal('')\n\n  return (\n    <form action=\"/search\" method=\"get\">\n      <input\n        name=\"q\"\n        value={query()}\n        onChange={(e) => setQuery(e.target.value)}\n      />\n      <ClientOnly fallback={<button type=\"submit\">Search</button>}>\n        <SearchButton onSearch={() => search(query())} />\n      </ClientOnly>\n    </form>\n  )\n}\n```\n\n### Environment-Aware Storage\n\n```tsx\nconst storage = createIsomorphicFn()\n  .server((key: string) => {\n    // Server: File-based cache\n    const fs = require('node:fs')\n    return JSON.parse(fs.readFileSync('.cache', 'utf-8'))[key]\n  })\n  .client((key: string) => {\n    // Client: localStorage\n    return JSON.parse(localStorage.getItem(key) || 'null')\n  })\n```\n\n## Common Problems\n\n### Environment Variable Exposure\n\n```tsx\n// ❌ Exposes to client bundle\nconst apiKey = process.env.SECRET_KEY\n\n// ✅ Server-only access\nconst apiKey = createServerOnlyFn(() => process.env.SECRET_KEY)\n```\n\n### Incorrect Loader Assumptions\n\n```tsx\n// ❌ Assuming loader is server-only\nexport const Route = createFileRoute('/users')({\n  loader: () => {\n    // This runs on BOTH server and client!\n    const secret = process.env.SECRET // Exposed to client\n    return fetch(`/api/users?key=${secret}`)\n  },\n})\n\n// ✅ Use server function for server-only operations\nconst getUsersSecurely = createServerFn().handler(() => {\n  const secret = process.env.SECRET // Server-only\n  return fetch(`/api/users?key=${secret}`)\n})\n\nexport const Route = createFileRoute('/users')({\n  loader: () => getUsersSecurely(), // Isomorphic call to server function\n})\n```\n\n### Hydration Mismatches\n\n```tsx\n// ❌ Different content server vs client\nfunction CurrentTime() {\n  return <div>{new Date().toLocaleString()}</div>\n}\n\n// ✅ Consistent rendering\nfunction CurrentTime() {\n  const [time, setTime] = createSignal<string>()\n\n  createEffect(() => {\n    setTime(new Date().toLocaleString())\n  })\n\n  return <div>{time() || 'Loading...'}</div>\n}\n```\n\n## Production Checklist\n\n- [ ] **Bundle Analysis**: Verify server-only code isn't in client bundle\n- [ ] **Environment Variables**: Ensure secrets use `createServerOnlyFn()` or `createServerFn()`\n- [ ] **Loader Logic**: Remember loaders are isomorphic, not server-only\n- [ ] **ClientOnly Fallbacks**: Provide appropriate fallbacks to prevent layout shift\n- [ ] **Error Boundaries**: Handle server/client execution errors gracefully\n\n## Related Resources\n\n- [Execution Model](./execution-model.md) - Core concepts and architectural patterns\n- [Server Functions](./server-functions.md) - Deep dive into server function patterns\n- [Environment Variables](./environment-variables.md) - Secure environment variable handling\n- [Middleware](./middleware.md) - Server function middleware patterns\n"
  },
  {
    "path": "docs/start/framework/solid/guide/databases.md",
    "content": "---\nref: docs/start/framework/react/guide/databases.md\nreplace:\n  { '@tanstack/react-start': '@tanstack/solid-start', 'React': 'SolidJS' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/environment-functions.md",
    "content": "---\nref: docs/start/framework/react/guide/environment-functions.md\nreplace: { 'react': 'solid' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/environment-variables.md",
    "content": "---\nid: environment-variables\ntitle: Environment Variables\n---\n\nLearn how to securely configure and use environment variables in your TanStack Start application across different contexts (server functions, client code, and build processes).\n\n## Quick Start\n\nTanStack Start automatically loads `.env` files and makes variables available in both server and client contexts with proper security boundaries.\n\n```bash\n# .env\nDATABASE_URL=postgresql://user:pass@localhost:5432/mydb\nVITE_APP_NAME=My TanStack Start App\n```\n\n```typescript\n// Server function - can access any environment variable\nconst getUser = createServerFn().handler(async () => {\n  const db = await connect(process.env.DATABASE_URL) // ✅ Server-only\n  return db.user.findFirst()\n})\n\n// Client component - only VITE_ prefixed variables\nexport function AppHeader() {\n  return <h1>{import.meta.env.VITE_APP_NAME}</h1> // ✅ Client-safe\n}\n```\n\n## Environment Variable Contexts\n\n### Server-Side Context (Server Functions & API Routes)\n\nServer functions can access **any** environment variable using `process.env`:\n\n```typescript\nimport { createServerFn } from '@tanstack/solid-start'\n\n// Database connection (server-only)\nconst connectToDatabase = createServerFn().handler(async () => {\n  const connectionString = process.env.DATABASE_URL // No prefix needed\n  const apiKey = process.env.EXTERNAL_API_SECRET // Stays on server\n\n  // These variables are never exposed to the client\n  return await database.connect(connectionString)\n})\n\n// Authentication (server-only)\nconst authenticateUser = createServerFn()\n  .inputValidator(z.object({ token: z.string() }))\n  .handler(async ({ data }) => {\n    const jwtSecret = process.env.JWT_SECRET // Server-only\n    return jwt.verify(data.token, jwtSecret)\n  })\n```\n\n### Client-Side Context (Components & Client Code)\n\nClient code can only access variables with the `VITE_` prefix:\n\n```typescript\n// Client configuration\nexport function ApiProvider(props) {\n  const apiUrl = import.meta.env.VITE_API_URL     // ✅ Public\n  const apiKey = import.meta.env.VITE_PUBLIC_KEY  // ✅ Public\n\n  // This would be undefined (security feature):\n  // const secret = import.meta.env.DATABASE_URL   // ❌ Undefined\n\n  return (\n    <ApiContext.Provider value={{ apiUrl, apiKey }}>\n      {props.children}\n    </ApiContext.Provider>\n  )\n}\n\n// Feature flags\nexport function FeatureGatedComponent() {\n  const enableNewFeature = import.meta.env.VITE_ENABLE_NEW_FEATURE === 'true'\n\n  if (!enableNewFeature) return null\n\n  return <NewFeature />\n}\n```\n\n## Environment File Setup\n\n### File Hierarchy (Loaded in Order)\n\nTanStack Start automatically loads environment files in this order:\n\n```\n.env.local          # Local overrides (add to .gitignore)\n.env.production     # Production-specific variables\n.env.development    # Development-specific variables\n.env                # Default variables (commit to git)\n```\n\n### Example Setup\n\n**.env** (committed to repository):\n\n```bash\n# Public configuration\nVITE_APP_NAME=My TanStack Start App\nVITE_API_URL=https://api.example.com\nVITE_SENTRY_DSN=https://...\n\n# Server configuration templates\nDATABASE_URL=postgresql://localhost:5432/myapp_dev\nREDIS_URL=redis://localhost:6379\n```\n\n**.env.local** (add to .gitignore):\n\n```bash\n# Override for local development\nDATABASE_URL=postgresql://user:password@localhost:5432/myapp_local\nSTRIPE_SECRET_KEY=sk_test_...\nJWT_SECRET=your-local-secret\n```\n\n**.env.production**:\n\n```bash\n# Production overrides\nVITE_API_URL=https://api.myapp.com\nDATABASE_POOL_SIZE=20\n```\n\n## Common Patterns\n\n### Database Configuration\n\n```typescript\n// src/lib/database.ts\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst getDatabaseConnection = createServerFn().handler(async () => {\n  const config = {\n    url: process.env.DATABASE_URL,\n    maxConnections: parseInt(process.env.DB_MAX_CONNECTIONS || '10'),\n    ssl: process.env.NODE_ENV === 'production',\n  }\n\n  return createConnection(config)\n})\n```\n\n### Authentication Provider Setup\n\n```typescript\n// src/lib/auth.ts (Server)\nexport const authConfig = {\n  secret: process.env.AUTH_SECRET,\n  providers: {\n    auth0: {\n      domain: process.env.AUTH0_DOMAIN,\n      clientId: process.env.AUTH0_CLIENT_ID,\n      clientSecret: process.env.AUTH0_CLIENT_SECRET, // Server-only\n    }\n  }\n}\n\n// src/components/AuthProvider.tsx (Client)\nexport function AuthProvider(props) {\n  return (\n    <Auth0Provider\n      domain={import.meta.env.VITE_AUTH0_DOMAIN}\n      clientId={import.meta.env.VITE_AUTH0_CLIENT_ID}\n      // No client secret here - it stays on the server\n    >\n      {props.children}\n    </Auth0Provider>\n  )\n}\n```\n\n### External API Integration\n\n```typescript\n// src/lib/external-api.ts\nimport { createServerFn } from '@tanstack/solid-start'\n\n// Server-side API calls (can use secret keys)\nconst fetchUserData = createServerFn()\n  .inputValidator(z.object({ userId: z.string() }))\n  .handler(async ({ data }) => {\n    const response = await fetch(\n      `${process.env.EXTERNAL_API_URL}/users/${data.userId}`,\n      {\n        headers: {\n          Authorization: `Bearer ${process.env.EXTERNAL_API_SECRET}`,\n          'Content-Type': 'application/json',\n        },\n      },\n    )\n\n    return response.json()\n  })\n\n// Client-side API calls (public endpoints only)\nexport function usePublicData() {\n  const apiUrl = import.meta.env.VITE_PUBLIC_API_URL\n\n  return useQuery({\n    queryKey: ['public-data'],\n    queryFn: () => fetch(`${apiUrl}/public/stats`).then((r) => r.json()),\n  })\n}\n```\n\n### Feature Flags and Configuration\n\n```typescript\n// src/config/features.ts\nexport const featureFlags = {\n  enableNewDashboard: import.meta.env.VITE_ENABLE_NEW_DASHBOARD === 'true',\n  enableAnalytics: import.meta.env.VITE_ENABLE_ANALYTICS === 'true',\n  debugMode: import.meta.env.VITE_DEBUG_MODE === 'true',\n}\n\n// Usage in components\nexport function Dashboard() {\n  if (featureFlags.enableNewDashboard) {\n    return <NewDashboard />\n  }\n\n  return <LegacyDashboard />\n}\n```\n\n## Type Safety\n\n### TypeScript Declarations\n\nCreate `src/env.d.ts` to add type safety:\n\n```typescript\n/// <reference types=\"vite/client\" />\n\ninterface ImportMetaEnv {\n  // Client-side environment variables\n  readonly VITE_APP_NAME: string\n  readonly VITE_API_URL: string\n  readonly VITE_AUTH0_DOMAIN: string\n  readonly VITE_AUTH0_CLIENT_ID: string\n  readonly VITE_SENTRY_DSN?: string\n  readonly VITE_ENABLE_NEW_DASHBOARD?: string\n}\n\ninterface ImportMeta {\n  readonly env: ImportMetaEnv\n}\n\n// Server-side environment variables\ndeclare global {\n  namespace NodeJS {\n    interface ProcessEnv {\n      readonly DATABASE_URL: string\n      readonly REDIS_URL: string\n      readonly JWT_SECRET: string\n      readonly AUTH0_CLIENT_SECRET: string\n      readonly STRIPE_SECRET_KEY: string\n      readonly NODE_ENV: 'development' | 'production' | 'test'\n    }\n  }\n}\n\nexport {}\n```\n\n### Runtime Validation\n\nUse Zod for runtime validation of environment variables:\n\n```typescript\n// src/config/env.ts\nimport { z } from 'zod'\n\nconst envSchema = z.object({\n  DATABASE_URL: z.string().url(),\n  JWT_SECRET: z.string().min(32),\n  NODE_ENV: z.enum(['development', 'production', 'test']),\n})\n\nconst clientEnvSchema = z.object({\n  VITE_APP_NAME: z.string(),\n  VITE_API_URL: z.string().url(),\n  VITE_AUTH0_DOMAIN: z.string(),\n  VITE_AUTH0_CLIENT_ID: z.string(),\n})\n\n// Validate server environment\nexport const serverEnv = envSchema.parse(process.env)\n\n// Validate client environment\nexport const clientEnv = clientEnvSchema.parse(import.meta.env)\n```\n\n## Security Best Practices\n\n### 1. Never Expose Secrets to Client\n\n```typescript\n// ❌ WRONG - Secret exposed to client bundle\nconst config = {\n  apiKey: import.meta.env.VITE_SECRET_API_KEY, // This will be in your JS bundle!\n}\n\n// ✅ CORRECT - Keep secrets on server\nconst getApiData = createServerFn().handler(async () => {\n  const response = await fetch(apiUrl, {\n    headers: { Authorization: `Bearer ${process.env.SECRET_API_KEY}` },\n  })\n  return response.json()\n})\n```\n\n### 2. Use Appropriate Prefixes\n\n```bash\n# ✅ Server-only (no prefix)\nDATABASE_URL=postgresql://...\nJWT_SECRET=super-secret-key\nSTRIPE_SECRET_KEY=sk_live_...\n\n# ✅ Client-safe (VITE_ prefix)\nVITE_APP_NAME=My App\nVITE_API_URL=https://api.example.com\nVITE_SENTRY_DSN=https://...\n```\n\n### 3. Validate Required Variables\n\n```typescript\n// src/config/validation.ts\nconst requiredServerEnv = ['DATABASE_URL', 'JWT_SECRET'] as const\n\nconst requiredClientEnv = ['VITE_APP_NAME', 'VITE_API_URL'] as const\n\n// Validate on server startup\nfor (const key of requiredServerEnv) {\n  if (!process.env[key]) {\n    throw new Error(`Missing required environment variable: ${key}`)\n  }\n}\n\n// Validate client environment at build time\nfor (const key of requiredClientEnv) {\n  if (!import.meta.env[key]) {\n    throw new Error(`Missing required environment variable: ${key}`)\n  }\n}\n```\n\n## Production Checklist\n\n- [ ] All sensitive variables are server-only (no `VITE_` prefix)\n- [ ] Client variables use `VITE_` prefix\n- [ ] `.env.local` is in `.gitignore`\n- [ ] Production environment variables are configured on hosting platform\n- [ ] Required environment variables are validated at startup\n- [ ] No hardcoded secrets in source code\n- [ ] Database URLs use connection pooling in production\n- [ ] API keys are rotated regularly\n\n## Common Problems\n\n### Environment Variable is Undefined\n\n**Problem**: `import.meta.env.MY_VARIABLE` returns `undefined`\n\n**Solutions**:\n\n1. **Add correct prefix**: Use `VITE_` prefix (e.g. `VITE_MY_VARIABLE`)\n2. **Restart development server** after adding new variables\n3. **Check file location**: `.env` file must be in project root\n4. **Verify bundler configuration**: Ensure variables are properly injected\n\n**Example**:\n\n```bash\n# ❌ Won't work in client code\nAPI_KEY=abc123\n\n# ✅ Works in client code\nVITE_API_KEY=abc123\n\n# ❌ Won't bundle the variable (assuming it is not set in the environment of the build)\nnpm run build\n\n# ✅ Works in client code and will bundle the variable for production\nVITE_API_KEY=abc123 npm run build\n```\n\n### Runtime Client Environment Variables in Production\n\n**Problem**: If `VITE_` variables are replaced at bundle time only, how to make runtime variables available on the client?\n\n**Solutions**:\n\nPass variables from the server down to the client:\n\n```tsx\nconst getRuntimeVar = createServerFn({ method: 'GET' }).handler(() => {\n  return process.env.MY_RUNTIME_VAR // notice `process.env` on the server, and no `VITE_` prefix\n})\n\nexport const Route = createFileRoute('/')({\n  loader: async () => {\n    const foo = await getRuntimeVar()\n    return { foo }\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { foo } = Route.useLoaderData()\n  // ... use your variable however you want\n}\n```\n\n### Variable Not Updating\n\n**Problem**: Environment variable changes aren't reflected\n\n**Solutions**:\n\n1. Restart development server\n2. Check if you're modifying the correct `.env` file\n3. Verify file hierarchy (`.env.local` overrides `.env`)\n\n### TypeScript Errors\n\n**Problem**: `Property 'VITE_MY_VAR' does not exist on type 'ImportMetaEnv'`\n\n**Solution**: Add to `src/env.d.ts`:\n\n```typescript\ninterface ImportMetaEnv {\n  readonly VITE_MY_VAR: string\n}\n```\n\n### Security: Secret Exposed to Client\n\n**Problem**: Sensitive data appearing in client bundle\n\n**Solutions**:\n\n1. Remove `VITE_` prefix from sensitive variables\n2. Move sensitive operations to server functions\n3. Use build tools to verify no secrets in client bundle\n\n### Build Errors in Production\n\n**Problem**: Missing environment variables in production build\n\n**Solutions**:\n\n1. Configure variables on hosting platform\n2. Validate required variables at build time\n3. Use deployment-specific `.env` files\n\n## Server Build Configuration\n\n### Static `NODE_ENV` Replacement\n\nBy default, TanStack Start statically replaces `process.env.NODE_ENV` in **server builds** at build time. This enables dead code elimination (tree-shaking) for development-only code paths in your server bundle.\n\n**Why this matters:** Vite automatically replaces `process.env.NODE_ENV` in client builds, but server builds run in Node.js where `process.env` is a real runtime object. Without static replacement, code like this would remain in your production server bundle:\n\n```typescript\nif (process.env.NODE_ENV === 'development') {\n  // This code would NOT be eliminated without static replacement\n  enableDevTools()\n  logDebugInfo()\n}\n```\n\nWith static replacement enabled (the default), the bundler sees `\"production\" === 'development'` and eliminates the entire block.\n\n### Configuring Static Replacement\n\nThe replacement is controlled by the `server.build.staticNodeEnv` option:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      server: {\n        build: {\n          // Replace process.env.NODE_ENV at build time (default: true)\n          staticNodeEnv: true,\n        },\n      },\n    }),\n  ],\n})\n```\n\nThe replacement value is determined in this order:\n\n1. `process.env.NODE_ENV` at build time (if set)\n2. Vite's `mode` (e.g., from `--mode staging`)\n3. `\"production\"` (fallback)\n\n### When to Disable Static Replacement\n\nSet `staticNodeEnv: false` if you need `NODE_ENV` to remain dynamic at runtime:\n\n```ts\ntanstackStart({\n  server: {\n    build: {\n      staticNodeEnv: false, // Keep NODE_ENV dynamic at runtime\n    },\n  },\n})\n```\n\nCommon reasons to disable:\n\n- **Same build, multiple environments**: Deploying one build artifact to staging and production\n- **Runtime environment detection**: Code that must check the actual runtime environment\n- **Testing production builds locally**: Running production builds with `NODE_ENV=development`\n\n> **Note:** Disabling static replacement means development-only code paths will remain in your production bundle and be evaluated at runtime.\n\n## Related Resources\n\n- [Code Execution Patterns](./code-execution-patterns.md) - Learn about server vs client code execution\n- [Server Functions](./server-functions.md) - Learn more about server-side code\n- [Hosting](./hosting.md) - Platform-specific environment variable configuration\n- [Vite Environment Variables](https://vitejs.dev/guide/env-and-mode.html) - Official Vite documentation\n"
  },
  {
    "path": "docs/start/framework/solid/guide/error-boundaries.md",
    "content": "---\nid: error-boundaries\n$title: Error Boundaries\n---\n\n## Error Boundaries (Solid Start)\n\nTanStack Start (Solid) uses TanStack Router's route-level error boundaries.\n\n- Set a default for all routes via the router\n- Override per-route with `errorComponent`\n\n### Configure a default\n\n```tsx\n// src/router.tsx\nimport { createRouter, ErrorComponent } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultErrorComponent: ({ error, reset }) => (\n      <ErrorComponent error={error} />\n    ),\n  })\n  return router\n}\n```\n\n### Per-route override\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute, ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nfunction PostError(props: ErrorComponentProps) {\n  return <ErrorComponent error={props.error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostComponent,\n  errorComponent: PostError,\n})\n```\n\nNotes:\n\n- `ErrorComponent` is a simple built-in UI you can replace.\n- Call `reset()` to retry rendering the route after fixing state.\n- Use `beforeLoad`/`loader` to throw errors that will be caught.\n"
  },
  {
    "path": "docs/start/framework/solid/guide/execution-model.md",
    "content": "---\nid: execution-model\ntitle: Execution Model\n---\n\nUnderstanding where code runs is fundamental to building TanStack Start applications. This guide explains TanStack Start's execution model and how to control where your code executes.\n\n## Core Principle: Isomorphic by Default\n\n**All code in TanStack Start is isomorphic by default** - it runs and is included in both server and client bundles unless explicitly constrained.\n\n```tsx\n// ✅ This runs on BOTH server and client\nfunction formatPrice(price: number) {\n  return new Intl.NumberFormat('en-US', {\n    style: 'currency',\n    currency: 'USD',\n  }).format(price)\n}\n\n// ✅ Route loaders are ISOMORPHIC\nexport const Route = createFileRoute('/products')({\n  loader: async () => {\n    // This runs on server during SSR AND on client during navigation\n    const response = await fetch('/api/products')\n    return response.json()\n  },\n})\n```\n\n> **Critical Understanding**: Route `loader`s are isomorphic - they run on both server and client, not just the server.\n\n## The Execution Boundary\n\nTanStack Start applications run in two environments:\n\n### Server Environment\n\n- **Node.js runtime** with access to file system, databases, environment variables\n- **During SSR** - Initial page renders on server\n- **API requests** - Server functions execute server-side\n- **Build time** - Static generation and pre-rendering\n\n### Client Environment\n\n- **Browser runtime** with access to DOM, localStorage, user interactions\n- **After hydration** - Client takes over after initial server render\n- **Navigation** - Route loaders run client-side during navigation\n- **User interactions** - Event handlers, form submissions, etc.\n\n## Execution Control APIs\n\n### Server-Only Execution\n\n| API                      | Use Case                  | Client Behavior           |\n| ------------------------ | ------------------------- | ------------------------- |\n| `createServerFn()`       | RPC calls, data mutations | Network request to server |\n| `createServerOnlyFn(fn)` | Utility functions         | Throws error              |\n\n```tsx\nimport { createServerFn, createServerOnlyFn } from '@tanstack/solid-start'\n\n// RPC: Server execution, callable from client\nconst updateUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: UserData) => data)\n  .handler(async ({ data }) => {\n    // Only runs on server, but client can call it\n    return await db.users.update(data)\n  })\n\n// Utility: Server-only, client crashes if called\nconst getEnvVar = createServerOnlyFn(() => process.env.DATABASE_URL)\n```\n\n### Client-Only Execution\n\n| API                      | Use Case                        | Server Behavior  |\n| ------------------------ | ------------------------------- | ---------------- |\n| `createClientOnlyFn(fn)` | Browser utilities               | Throws error     |\n| `<ClientOnly>`           | Components needing browser APIs | Renders fallback |\n\n```tsx\nimport { createClientOnlyFn } from '@tanstack/solid-start'\nimport { ClientOnly } from '@tanstack/solid-router'\n\n// Utility: Client-only, server crashes if called\nconst saveToStorage = createClientOnlyFn((key: string, value: any) => {\n  localStorage.setItem(key, JSON.stringify(value))\n})\n\n// Component: Only renders children after hydration\nfunction Analytics() {\n  return (\n    <ClientOnly fallback={null}>\n      <GoogleAnalyticsScript />\n    </ClientOnly>\n  )\n}\n```\n\n#### useHydrated Hook\n\nFor more granular control over hydration-dependent behavior, use the `useHydrated` hook. It returns an accessor (signal) indicating whether the client has been hydrated:\n\n```tsx\nimport { useHydrated } from '@tanstack/solid-router'\n\nfunction TimeZoneDisplay() {\n  const hydrated = useHydrated()\n  const timeZone = () =>\n    hydrated() ? Intl.DateTimeFormat().resolvedOptions().timeZone : 'UTC'\n\n  return <div>Your timezone: {timeZone()}</div>\n}\n```\n\n**Behavior:**\n\n- **During SSR**: Always returns `false`\n- **First client render**: Returns `false`\n- **After hydration**: Returns `true` (and stays `true` for all subsequent renders)\n\nThis is useful when you need to conditionally render content based on client-side data (like browser timezone, locale, or localStorage) while providing a sensible fallback for server rendering.\n\n### Environment-Specific Implementations\n\n```tsx\nimport { createIsomorphicFn } from '@tanstack/solid-start'\n\n// Different implementation per environment\nconst getDeviceInfo = createIsomorphicFn()\n  .server(() => ({ type: 'server', platform: process.platform }))\n  .client(() => ({ type: 'client', userAgent: navigator.userAgent }))\n```\n\n## Architectural Patterns\n\n### Progressive Enhancement\n\nBuild components that work without JavaScript and enhance with client-side functionality:\n\n```tsx\nfunction SearchForm() {\n  const [query, setQuery] = createSignal('')\n\n  return (\n    <form action=\"/search\" method=\"get\">\n      <input\n        name=\"q\"\n        value={query()}\n        onChange={(e) => setQuery(e.target.value)}\n      />\n      <ClientOnly fallback={<button type=\"submit\">Search</button>}>\n        <SearchButton onSearch={() => search(query())} />\n      </ClientOnly>\n    </form>\n  )\n}\n```\n\n### Environment-Aware Storage\n\n```tsx\nconst storage = createIsomorphicFn()\n  .server((key: string) => {\n    // Server: File-based cache\n    const fs = require('node:fs')\n    return JSON.parse(fs.readFileSync('.cache', 'utf-8'))[key]\n  })\n  .client((key: string) => {\n    // Client: localStorage\n    return JSON.parse(localStorage.getItem(key) || 'null')\n  })\n```\n\n### RPC vs Direct Function Calls\n\nUnderstanding when to use server functions vs server-only functions:\n\n```tsx\n// createServerFn: RPC pattern - server execution, client callable\nconst fetchUser = createServerFn().handler(async () => await db.users.find())\n\n// Usage from client component:\nconst user = await fetchUser() // ✅ Network request\n\n// createServerOnlyFn: Crashes if called from client\nconst getSecret = createServerOnlyFn(() => process.env.SECRET)\n\n// Usage from client:\nconst secret = getSecret() // ❌ Throws error\n```\n\n## Common Anti-Patterns\n\n### Environment Variable Exposure\n\n```tsx\n// ❌ Exposes to client bundle\nconst apiKey = process.env.SECRET_KEY\n\n// ✅ Server-only access\nconst apiKey = createServerOnlyFn(() => process.env.SECRET_KEY)\n```\n\n### Incorrect Loader Assumptions\n\n```tsx\n// ❌ Assuming loader is server-only\nexport const Route = createFileRoute('/users')({\n  loader: () => {\n    // This runs on BOTH server and client!\n    const secret = process.env.SECRET // Exposed to client\n    return fetch(`/api/users?key=${secret}`)\n  },\n})\n\n// ✅ Use server function for server-only operations\nconst getUsersSecurely = createServerFn().handler(() => {\n  const secret = process.env.SECRET // Server-only\n  return fetch(`/api/users?key=${secret}`)\n})\n\nexport const Route = createFileRoute('/users')({\n  loader: () => getUsersSecurely(), // Isomorphic call to server function\n})\n```\n\n### Hydration Mismatches\n\n```tsx\n// ❌ Different content server vs client\nfunction CurrentTime() {\n  return <div>{new Date().toLocaleString()}</div>\n}\n\n// ✅ Consistent rendering\nfunction CurrentTime() {\n  const [time, setTime] = createSignal<string>()\n\n  createEffect(() => {\n    setTime(new Date().toLocaleString())\n  })\n\n  return <div>{time() || 'Loading...'}</div>\n}\n```\n\n## Manual vs API-Driven Environment Detection\n\n```tsx\n// Manual: You handle the logic\nfunction logMessage(msg: string) {\n  if (typeof window === 'undefined') {\n    console.log(`[SERVER]: ${msg}`)\n  } else {\n    console.log(`[CLIENT]: ${msg}`)\n  }\n}\n\n// API: Framework handles it\nconst logMessage = createIsomorphicFn()\n  .server((msg) => console.log(`[SERVER]: ${msg}`))\n  .client((msg) => console.log(`[CLIENT]: ${msg}`))\n```\n\n## Architecture Decision Framework\n\n**Choose Server-Only when:**\n\n- Accessing sensitive data (environment variables, secrets)\n- File system operations\n- Database connections\n- External API keys\n\n**Choose Client-Only when:**\n\n- DOM manipulation\n- Browser APIs (localStorage, geolocation)\n- User interaction handling\n- Analytics/tracking\n\n**Choose Isomorphic when:**\n\n- Data formatting/transformation\n- Business logic\n- Shared utilities\n- Route loaders (they're isomorphic by nature)\n\n## Security Considerations\n\n### Bundle Analysis\n\nAlways verify server-only code isn't included in client bundles:\n\n```bash\n# Analyze client bundle\nnpm run build\n# Check dist/client for any server-only imports\n```\n\n### Environment Variable Strategy\n\n- **Client-exposed**: Use `VITE_` prefix for client-accessible variables\n- **Server-only**: Access via `createServerOnlyFn()` or `createServerFn()`\n- **Never expose**: Database URLs, API keys, secrets\n\n### Error Boundaries\n\nHandle server/client execution errors gracefully:\n\n```tsx\nfunction ErrorBoundary(props) {\n  return (\n    <ErrorBoundaryComponent\n      fallback={<div>Something went wrong</div>}\n      onError={(error) => {\n        if (typeof window === 'undefined') {\n          console.error('[SERVER ERROR]:', error)\n        } else {\n          console.error('[CLIENT ERROR]:', error)\n        }\n      }}\n    >\n      {props.children}\n    </ErrorBoundaryComponent>\n  )\n}\n```\n\nUnderstanding TanStack Start's execution model is crucial for building secure, performant, and maintainable applications. The isomorphic-by-default approach provides flexibility while the execution control APIs give you precise control when needed.\n"
  },
  {
    "path": "docs/start/framework/solid/guide/hosting.md",
    "content": "---\nid: hosting\ntitle: Hosting\n---\n\nHosting 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 Vite, a powerful dev/build platform that allows us to make it possible to deploy your application to any hosting provider.\n\n## What should I use?\n\nTanStack 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.\n\nHowever, since hosting is one of the most crucial aspects of your application's performance, reliability, and scalability, we recommend using one of our **Official Hosting Partners**: [Cloudflare](https://www.cloudflare.com?utm_source=tanstack), [Netlify](https://www.netlify.com?utm_source=tanstack), or [Railway](https://railway.com?utm_source=tanstack).\n\n## Deployment\n\nOnce you've chosen a deployment target, you can follow the deployment guidelines below to deploy your TanStack Start application to the hosting provider of your choice:\n\n- [`cloudflare-workers`](#cloudflare-workers--official-partner): Deploy to Cloudflare Workers\n- [`netlify`](#netlify--official-partner): Deploy to Netlify\n- [`railway`](#railway--official-partner): Deploy to Railway\n- [`nitro`](#nitro): Deploy using Nitro\n- [`vercel`](#vercel): Deploy to Vercel\n- [`node-server`](#nodejs--docker): Deploy to a Node.js server\n- [`bun`](#bun): Deploy to a Bun server\n- [`appwrite-sites`](#appwrite-sites): Deploy to Appwrite Sites\n- ... and more to come!\n\n### Cloudflare Workers ⭐ _Official Partner_\n\n<a href=\"https://www.cloudflare.com?utm_source=tanstack\" alt=\"Cloudflare Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/cloudflare-white.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/cloudflare-black.svg\" width=\"280\">\n    <img alt=\"Cloudflare logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/cloudflare-black.svg\" width=\"280\">\n  </picture>\n</a>\n\n### Cloudflare Workers\n\nWhen deploying to Cloudflare Workers, you'll need to complete a few extra steps before your users can start using your app.\n\n1. Install `@cloudflare/vite-plugin`\n\n```bash\npnpm install @cloudflare/vite-plugin -D\n```\n\n2. Update `vite.config.ts`\n\nAdd the cloudflare plugin to your `vite.config.ts` file.\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { cloudflare } from '@cloudflare/vite-plugin'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  plugins: [\n    cloudflare({ viteEnvironment: { name: 'ssr' } }),\n    tanstackStart(),\n    viteSolid({ ssr: true }),\n  ],\n})\n```\n\n3. Install `wrangler`\n\n```bash\npnpm add wrangler -D\n```\n\n4. Add a `wrangler.json` config file\n\n```json\n{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"tanstack-start-app\",\n  \"compatibility_date\": \"2025-09-02\",\n  \"compatibility_flags\": [\"nodejs_compat\"],\n  \"main\": \"@tanstack/solid-start/server-entry\",\n  \"vars\": {\n    \"MY_VAR\": \"Hello from Cloudflare\"\n  }\n}\n```\n\n5. Modify package.json script\n\n```json\n{\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"node .output/server/index.mjs\",\n    // ============ 👇 add this line ============\n    \"deploy\": \"npm run build && wrangler deploy\"\n  }\n}\n```\n\n6. Deploy\n\n```bash\npnpm run deploy\n```\n\nDeploy your application to Cloudflare Workers using their one-click deployment process, and you're ready to go!\n\n### Netlify ⭐ _Official Partner_\n\n<a href=\"https://www.netlify.com?utm_source=tanstack\" alt=\"Netlify Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/netlify-dark.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/netlify-light.svg\" width=\"280\">\n    <img alt=\"Netlify logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/netlify-light.svg\" width=\"280\">\n  </picture>\n</a>\n\nInstall and add the [`@netlify/vite-plugin-tanstack-start`](https://www.npmjs.com/package/@netlify/vite-plugin-tanstack-start) plugin, which configures your build for Netlify deployment and provides full Netlify production platform emulation in local dev:\n\n```bash\nnpm install --save-dev @netlify/vite-plugin-tanstack-start\n# or...\npnpm add --save-dev @netlify/vite-plugin-tanstack-start\n# or yarn, bun, etc.\n```\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport netlify from '@netlify/vite-plugin-tanstack-start' // ← add this\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart(),\n    netlify(), // ← add this (anywhere in the array is fine)\n    viteSolid({ ssr: true }),\n  ],\n})\n```\n\nFinally, use [Netlify CLI](https://developers.netlify.com/cli/) to deploy your app:\n\n```bash\nnpx netlify deploy\n```\n\nIf this is a new Netlify project, you'll be prompted to initialize it and build settings will be automatically configured for you.\n\nFor more detailed documentation, check out the full [TanStack Start on Netlify\ndocs](https://docs.netlify.com/build/frameworks/framework-setup-guides/tanstack-start/).\n\n#### Manual configuration\n\nAlternatively, if you prefer manual configuration, you can add a `netlify.toml` file to your project root:\n\n```toml\n[build]\n  command = \"vite build\"\n  publish = \"dist/client\"\n[dev]\n  command = \"vite dev\"\n  port = 3000\n```\n\nOr you can set the above settings directly [in the Netlify\napp](https://docs.netlify.com/build/configure-builds/overview/#build-settings).\n\n#### Other deployment methods\n\nNetlify also supports other deployment methods, such as [continuous deployment from a git repo\nhosted on GitHub, GitLab, or\nothers](https://docs.netlify.com/start/quickstarts/deploy-from-repository/), [starting from a\ntemplate](https://docs.netlify.com/start/quickstarts/deploy-from-template/), [deploying or\nimporting from an AI code generation\ntool](https://docs.netlify.com/start/quickstarts/deploy-from-ai-code-generation-tool/), and\n[more](https://docs.netlify.com/deploy/create-deploys/).\n\n### Railway ⭐ _Official Partner_\n\n<a href=\"https://railway.com?utm_source=tanstack\" alt=\"Railway Logo\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/railway-dark.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/railway-light.svg\" width=\"280\">\n    <img alt=\"Railway logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/railway-light.svg\" width=\"280\">\n  </picture>\n</a>\n\nRailway provides instant deployments with zero configuration. Follow the [`Nitro`](#nitro) deployment instructions, then deploy to Railway:\n\n1. Push your code to a GitHub repository\n\n2. Connect your repository to Railway at [railway.com](https://railway.com?utm_source=tanstack)\n\n3. Railway will automatically detect your build settings and deploy your application\n\nRailway automatically provides:\n\n- **Automatic deployments** on every push to your repository\n- **Built-in databases** (Postgres, MySQL, Redis, MongoDB)\n- **Preview environments** for pull requests\n- **Automatic HTTPS** and custom domains\n\nFor more details, see [Railway's documentation](https://docs.railway.com).\n\n### Nitro\n\n[Nitro](https://nitro.build/) is an agnostic layer that allows you to deploy TanStack Start applications to [a wide range of hostings](https://nitro.build/deploy).\n\n**⚠️ The [`nitro/vite`](https://nitro.build/) plugin natively integrates with Vite Environments API as the underlying build tool for TanStack Start. It is still under active development and receives regular updates. Please report any issues you encounter with reproduction so they can be investigated.**\n\n1. Install `nitro`:\n\n```bash\nnpm install nitro\n```\n\n2. Add the `nitro/vite` plugin to your `vite.config.ts` file:\n\n```tsx\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport { nitro } from 'nitro/vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  plugins: [tanstackStart(), nitro(), viteSolid({ ssr: true })],\n  nitro: {},\n})\n```\n\n#### Performance Tip: FastResponse\n\nIf you're deploying to Node.js with Nitro (which uses [srvx](https://srvx.h3.dev/) under the hood), you can get a ~5% throughput improvement by replacing the global `Response` constructor with srvx's optimized `FastResponse`.\n\nFirst, install srvx:\n\n```bash\npnpm install srvx\n```\n\nThen add this to your server entry point (`src/server.ts`):\n\n```ts\nimport { FastResponse } from 'srvx'\nglobalThis.Response = FastResponse\n```\n\nThis works because srvx's `FastResponse` includes an optimized `_toNodeResponse()` path that avoids the overhead of the standard Web `Response` to Node.js conversion. This optimization only applies to Node.js deployments using Nitro/h3/srvx.\n\n### Vercel\n\nFollow the [`Nitro`](#nitro) deployment instructions.\nDeploy your application to Vercel using their one-click deployment process, and you're ready to go!\n\n### Node.js / Docker\n\nFollow the [`Nitro`](#nitro) deployment instructions. Use the `node` command to start your application from the server from the build output files.\n\nEnsure `build` and `start` npm scripts are present in your `package.json` file:\n\n```json\n    \"build\": \"vite build\",\n    \"start\": \"node .output/server/index.mjs\"\n```\n\nThen you can run the following command to build your application:\n\n```sh\nnpm run build\n```\n\nYou can start your application by running:\n\n```sh\nnpm run start\n```\n\n### Bun\n\nFollow the [`Nitro`](#nitro) deployment instructions.\nDepending on how you invoke the build, you might need to set the `'bun'` preset in the Nitro configuration:\n\n```ts\n// vite.config.ts\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\nimport { nitro } from 'nitro/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart(),\n    nitro({ preset: 'bun' })\n    viteSolid({ssr: true}),\n  ],\n})\n```\n\n#### Production Server with Bun\n\nAlternatively, you can use a custom server implementation that leverages Bun's native APIs.\n\nWe provide a reference implementation that demonstrates one approach to building a production-ready Bun server. This example uses Bun-native functions for optimal performance and includes features like intelligent asset preloading and memory management.\n\n**This is a starting point - feel free to adapt it to your needs or simplify it for your use case.**\n\n**What this example demonstrates:**\n\n- Serving static assets using Bun's native file handling\n- Hybrid loading strategy (preload small files, serve large files on-demand)\n- Optional features like ETag support and Gzip compression\n- Production-ready caching headers\n\n**Quick Setup:**\n\n1. Copy the [`server.ts`](https://github.com/tanstack/router/blob/main/examples/react/start-bun/server.ts) file from the example repository to your project root (or use it as inspiration for your own implementation)\n\n2. Build your application:\n\n   ```sh\n   bun run build\n   ```\n\n3. Start the server:\n\n   ```sh\n   bun run server.ts\n   ```\n\n**Configuration (Optional):**\n\nThe reference server implementation includes several optional configuration options via environment variables. You can use these as-is, modify them, or remove features you don't need:\n\n```sh\n# Basic usage - just works out of the box\nbun run server.ts\n\n# Common configurations\nPORT=8080 bun run server.ts  # Custom port\nASSET_PRELOAD_VERBOSE_LOGGING=true bun run server.ts  # See what's happening\n```\n\n**Available Environment Variables:**\n\n| Variable                         | Description                                        | Default                                                                       |\n| -------------------------------- | -------------------------------------------------- | ----------------------------------------------------------------------------- |\n| `PORT`                           | Server port                                        | `3000`                                                                        |\n| `ASSET_PRELOAD_MAX_SIZE`         | Maximum file size to preload into memory (bytes)   | `5242880` (5MB)                                                               |\n| `ASSET_PRELOAD_INCLUDE_PATTERNS` | Comma-separated glob patterns for files to include | All files                                                                     |\n| `ASSET_PRELOAD_EXCLUDE_PATTERNS` | Comma-separated glob patterns for files to exclude | None                                                                          |\n| `ASSET_PRELOAD_VERBOSE_LOGGING`  | Enable detailed logging                            | `false`                                                                       |\n| `ASSET_PRELOAD_ENABLE_ETAG`      | Enable ETag generation                             | `true`                                                                        |\n| `ASSET_PRELOAD_ENABLE_GZIP`      | Enable Gzip compression                            | `true`                                                                        |\n| `ASSET_PRELOAD_GZIP_MIN_SIZE`    | Minimum file size for Gzip (bytes)                 | `1024` (1KB)                                                                  |\n| `ASSET_PRELOAD_GZIP_MIME_TYPES`  | MIME types eligible for Gzip                       | `text/,application/javascript,application/json,application/xml,image/svg+xml` |\n\n<details>\n<summary>Advanced configuration examples</summary>\n\n```sh\n# Optimize for minimal memory usage\nASSET_PRELOAD_MAX_SIZE=1048576 bun run server.ts\n\n# Preload only critical assets\nASSET_PRELOAD_INCLUDE_PATTERNS=\"*.js,*.css\" \\\nASSET_PRELOAD_EXCLUDE_PATTERNS=\"*.map,vendor-*\" \\\nbun run server.ts\n\n# Disable optional features\nASSET_PRELOAD_ENABLE_ETAG=false \\\nASSET_PRELOAD_ENABLE_GZIP=false \\\nbun run server.ts\n\n# Custom Gzip configuration\nASSET_PRELOAD_GZIP_MIN_SIZE=2048 \\\nASSET_PRELOAD_GZIP_MIME_TYPES=\"text/,application/javascript,application/json\" \\\nbun run server.ts\n```\n\n</details>\n\n**Example Output:**\n\n```txt\n📦 Loading static assets from ./dist/client...\n   Max preload size: 5.00 MB\n\n📁 Preloaded into memory:\n   /assets/index-a1b2c3d4.js           45.23 kB │ gzip:  15.83 kB\n   /assets/index-e5f6g7h8.css           12.45 kB │ gzip:   4.36 kB\n\n💾 Served on-demand:\n   /assets/vendor-i9j0k1l2.js          245.67 kB │ gzip:  86.98 kB\n\n✅ Preloaded 2 files (57.68 KB) into memory\n🚀 Server running at http://localhost:3000\n```\n\nFor a complete working example, check out the [TanStack Start + Bun example](https://github.com/TanStack/router/tree/main/examples/react/start-bun) in this repository.\n\n### Appwrite Sites\n\nWhen deploying to [Appwrite Sites](https://appwrite.io/products/sites), you'll need to complete a few steps:\n\n1. **Create a TanStack Start app** (or use an existing one)\n\n```bash\nnpx @tanstack/cli@latest create --framework solid\n```\n\n2. **Push your project to a GitHub repository**\n\nCreate a [GitHub repository](https://github.com/new) and push your code.\n\n3. **Create an Appwrite project**\n\nHead to [Appwrite Cloud](https://cloud.appwrite.io) and sign up if you haven't already, then create your first project.\n\n4. **Deploy your site**\n\nIn your Appwrite project, navigate to the **Sites** page from the sidebar. Click on the **Create site**, select **Connect a repository**, connect your GitHub account and select your repository.\n\n1. Select the **production branch** and **root directory**\n2. Verify **TanStack Start** is selected as the framework\n3. Confirm the build settings:\n   - **Install command:** `npm install`\n   - **Build command:** `npm run build`\n   - **Output directory:** `./dist` (if you're using Nitro v2 or v3, this should be `./.output`)\n\n4. Add any required **environment variables**\n5. Click **Deploy**\n\nAfter successful deployment, click the **Visit site** button to see your deployed application.\n"
  },
  {
    "path": "docs/start/framework/solid/guide/hydration-errors.md",
    "content": "---\nid: hydration-errors\ntitle: Hydration Errors\n---\n\n### Why it happens\n\n- **Mismatch**: Server HTML differs from client render during hydration\n- **Common causes**: `Intl` (locale/time zone), `Date.now()`, random IDs, responsive-only logic, feature flags, user prefs\n\n### Strategy 1 — Make server and client match\n\n- **Pick a deterministic locale/time zone on the server** and use the same on the client\n- **Source of truth**: cookie (preferred) or `Accept-Language` header\n- **Compute once on the server** and hydrate as initial state\n\n```tsx\n// src/start.ts\nimport { createStart, createMiddleware } from '@tanstack/solid-start'\nimport {\n  getRequestHeader,\n  getCookie,\n  setCookie,\n} from '@tanstack/solid-start/server'\n\nconst localeTzMiddleware = createMiddleware().server(async ({ next }) => {\n  const header = getRequestHeader('accept-language')\n  const headerLocale = header?.split(',')[0] || 'en-US'\n  const cookieLocale = getCookie('locale')\n  const cookieTz = getCookie('tz') // set by client later (see Strategy 2)\n\n  const locale = cookieLocale || headerLocale\n  const timeZone = cookieTz || 'UTC'\n\n  setCookie('locale', locale, { path: '/', maxAge: 60 * 60 * 24 * 365 })\n\n  return next({ context: { locale, timeZone } })\n})\n\nexport const startInstance = createStart(() => ({\n  requestMiddleware: [localeTzMiddleware],\n}))\n```\n\n```tsx\n// src/routes/index.tsx (example)\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { getCookie } from '@tanstack/solid-start/server'\n\nexport const getServerNow = createServerFn().handler(async () => {\n  const locale = getCookie('locale') || 'en-US'\n  const timeZone = getCookie('tz') || 'UTC'\n  return new Intl.DateTimeFormat(locale, {\n    dateStyle: 'medium',\n    timeStyle: 'short',\n    timeZone,\n  }).format(new Date())\n})\n\nexport const Route = createFileRoute('/')({\n  loader: () => getServerNow(),\n  component: () => {\n    const serverNow = Route.useLoaderData() as string\n    return <time dateTime={serverNow}>{serverNow}</time>\n  },\n})\n```\n\n### Strategy 2 — Let the client tell you its environment\n\n- On first visit, set a cookie with the client time zone; SSR uses `UTC` until then\n\n```tsx\nimport { ClientOnly } from '@tanstack/solid-router'\n\nfunction SetTimeZoneCookie() {\n  if (typeof window !== 'undefined') {\n    const tz = Intl.DateTimeFormat().resolvedOptions().timeZone\n    document.cookie = `tz=${tz}; path=/; max-age=31536000`\n  }\n  return null\n}\n\n;<ClientOnly fallback={null}>\n  <SetTimeZoneCookie />\n</ClientOnly>\n```\n\n### Strategy 3 — Make it client-only\n\n- Use `<ClientOnly>` or Solid’s `<NoHydration>` to avoid SSR/hydration\n\n```tsx\nimport { ClientOnly } from '@tanstack/solid-router'\nimport { NoHydration } from 'solid-js/web'\n\n<ClientOnly fallback={<span>—</span>}>\n  <RelativeTime ts={someTs} />\n</ClientOnly>\n\n<NoHydration>\n  <time>{new Date().toLocaleString()}</time>\n</NoHydration>\n```\n\n### Strategy 4 — Disable or limit SSR for the route\n\n- Use Selective SSR to avoid rendering the component on the server\n\n```tsx\nexport const Route = createFileRoute('/unstable')({\n  ssr: 'data-only', // or false\n  component: () => <ExpensiveViz />,\n})\n```\n\n### Strategy 5 — Last resort suppression\n\n- Prefer the tools above; avoid mismatches instead of hiding them\n\n### Checklist\n\n- **Deterministic inputs**: locale, time zone, feature flags\n- **Prefer cookies** for client context; fallback to `Accept-Language`\n- **Use `<ClientOnly>`/`<NoHydration>`** for inherently dynamic UI\n- **Use Selective SSR** when server HTML cannot be stable\n\nSee also: [Execution Model](./execution-model.md), [Code Execution Patterns](./code-execution-patterns.md), [Selective SSR](./selective-ssr.md), [Server Functions](./server-functions.md)\n"
  },
  {
    "path": "docs/start/framework/solid/guide/import-protection.md",
    "content": "---\nref: docs/start/framework/react/guide/import-protection.md\nreplace: { 'react': 'solid' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/llmo.md",
    "content": "---\nid: llmo\ntitle: LLM Optimization (LLMO)\n---\n\n> [!NOTE]\n> Looking for traditional search engine optimization? See the [SEO guide](./seo).\n\n## What is LLMO?\n\n**LLM Optimization (LLMO)**, also known as **AI Optimization (AIO)** or **Generative Engine Optimization (GEO)**, is the practice of structuring your content and data so that AI systems—like ChatGPT, Claude, Perplexity, and other LLM-powered tools—can accurately understand, cite, and recommend your content.\n\nWhile traditional SEO focuses on ranking in search engine results pages, LLMO focuses on being accurately represented in AI-generated responses. As more users get information through AI assistants rather than traditional search, this is becoming increasingly important.\n\n## How LLMO Differs from SEO\n\n| Aspect             | SEO                         | LLMO                                 |\n| ------------------ | --------------------------- | ------------------------------------ |\n| **Goal**           | Rank in search results      | Be cited/recommended by AI           |\n| **Audience**       | Search engine crawlers      | LLM training & retrieval systems     |\n| **Key signals**    | Links, keywords, page speed | Structured data, clarity, authority  |\n| **Content format** | Optimized for snippets      | Optimized for extraction & synthesis |\n\nThe good news: many LLMO best practices overlap with SEO. Clear structure, authoritative content, and good metadata help both.\n\n## What TanStack Start Provides\n\nTanStack Start's features that support LLMO:\n\n- **Server-Side Rendering** - Ensures AI crawlers see fully rendered content\n- **Structured Data** - JSON-LD support for machine-readable content\n- **Document Head Management** - Meta tags that AI systems can parse\n- **Server Routes** - Create machine-readable endpoints (APIs, feeds)\n\n## Structured Data for AI\n\nStructured data using schema.org vocabulary helps AI systems understand your content's meaning and context. This is perhaps the most important LLMO technique.\n\n### Article Schema\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [{ title: loaderData.post.title }],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'Article',\n          headline: loaderData.post.title,\n          description: loaderData.post.excerpt,\n          image: loaderData.post.coverImage,\n          author: {\n            '@type': 'Person',\n            name: loaderData.post.author.name,\n            url: loaderData.post.author.url,\n          },\n          publisher: {\n            '@type': 'Organization',\n            name: 'My Company',\n            logo: {\n              '@type': 'ImageObject',\n              url: 'https://myapp.com/logo.png',\n            },\n          },\n          datePublished: loaderData.post.publishedAt,\n          dateModified: loaderData.post.updatedAt,\n        }),\n      },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n### Product Schema\n\nFor e-commerce, product schema helps AI assistants provide accurate product information:\n\n```tsx\nexport const Route = createFileRoute('/products/$productId')({\n  loader: async ({ params }) => {\n    const product = await fetchProduct(params.productId)\n    return { product }\n  },\n  head: ({ loaderData }) => ({\n    meta: [{ title: loaderData.product.name }],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'Product',\n          name: loaderData.product.name,\n          description: loaderData.product.description,\n          image: loaderData.product.images,\n          brand: {\n            '@type': 'Brand',\n            name: loaderData.product.brand,\n          },\n          offers: {\n            '@type': 'Offer',\n            price: loaderData.product.price,\n            priceCurrency: 'USD',\n            availability: loaderData.product.inStock\n              ? 'https://schema.org/InStock'\n              : 'https://schema.org/OutOfStock',\n          },\n          aggregateRating: loaderData.product.rating\n            ? {\n                '@type': 'AggregateRating',\n                ratingValue: loaderData.product.rating,\n                reviewCount: loaderData.product.reviewCount,\n              }\n            : undefined,\n        }),\n      },\n    ],\n  }),\n  component: ProductPage,\n})\n```\n\n### Organization and Website Schema\n\nAdd organization schema to your root route for site-wide context:\n\n```tsx\n// src/routes/__root.tsx\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n    ],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'WebSite',\n          name: 'My App',\n          url: 'https://myapp.com',\n          publisher: {\n            '@type': 'Organization',\n            name: 'My Company',\n            url: 'https://myapp.com',\n            logo: 'https://myapp.com/logo.png',\n            sameAs: [\n              'https://twitter.com/mycompany',\n              'https://github.com/mycompany',\n            ],\n          },\n        }),\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n```\n\n### FAQ Schema\n\nFAQ schema is particularly effective for LLMO—AI systems often extract Q&A pairs:\n\n```tsx\nexport const Route = createFileRoute('/faq')({\n  loader: async () => {\n    const faqs = await fetchFAQs()\n    return { faqs }\n  },\n  head: ({ loaderData }) => ({\n    meta: [{ title: 'Frequently Asked Questions' }],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'FAQPage',\n          mainEntity: loaderData.faqs.map((faq) => ({\n            '@type': 'Question',\n            name: faq.question,\n            acceptedAnswer: {\n              '@type': 'Answer',\n              text: faq.answer,\n            },\n          })),\n        }),\n      },\n    ],\n  }),\n  component: FAQPage,\n})\n```\n\n## Machine-Readable Endpoints\n\nCreate API endpoints that AI systems and developers can consume directly:\n\n```ts\n// src/routes/api/products.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/api/products')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        const url = new URL(request.url)\n        const category = url.searchParams.get('category')\n\n        const products = await fetchProducts({ category })\n\n        return Response.json({\n          '@context': 'https://schema.org',\n          '@type': 'ItemList',\n          itemListElement: products.map((product, index) => ({\n            '@type': 'ListItem',\n            position: index + 1,\n            item: {\n              '@type': 'Product',\n              name: product.name,\n              description: product.description,\n              url: `https://myapp.com/products/${product.id}`,\n            },\n          })),\n        })\n      },\n    },\n  },\n})\n```\n\n## Content Best Practices\n\nBeyond technical implementation, content structure matters for LLMO:\n\n### Clear, Factual Statements\n\nAI systems extract factual claims. Make your key information explicit:\n\n```tsx\n// Good: Clear, extractable facts\nfunction ProductDetails(props) {\n  return (\n    <article>\n      <h1>{props.product.name}</h1>\n      <p>\n        {props.product.name} is a {props.product.category} made by{' '}\n        {props.product.brand}. It costs ${props.product.price} and is available\n        in {props.product.colors.join(', ')}.\n      </p>\n    </article>\n  )\n}\n```\n\n### Hierarchical Structure\n\nUse proper heading hierarchy—AI systems use this to understand content organization:\n\n```tsx\nfunction DocumentationPage() {\n  return (\n    <article>\n      <h1>Getting Started with TanStack Start</h1>\n\n      <section>\n        <h2>Installation</h2>\n        <p>Install TanStack Start using npm...</p>\n\n        <h3>Prerequisites</h3>\n        <p>You'll need Node.js 18 or later...</p>\n      </section>\n\n      <section>\n        <h2>Configuration</h2>\n        <p>Configure your app in vite.config.ts...</p>\n      </section>\n    </article>\n  )\n}\n```\n\n### Authoritative Attribution\n\nInclude author information and sources—AI systems consider authority signals:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  head: ({ loaderData }) => ({\n    meta: [\n      { title: loaderData.post.title },\n      { name: 'author', content: loaderData.post.author.name },\n      {\n        property: 'article:author',\n        content: loaderData.post.author.profileUrl,\n      },\n      {\n        property: 'article:published_time',\n        content: loaderData.post.publishedAt,\n      },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n## llms.txt\n\nSome sites are adopting a `llms.txt` file (similar to `robots.txt`) to provide guidance to AI systems:\n\n```ts\n// src/routes/llms[.]txt.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/llms.txt')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const content = `# My App\n\n> My App is a platform for building modern web applications.\n\n## Documentation\n- Getting Started: https://myapp.com/docs/getting-started\n- API Reference: https://myapp.com/docs/api\n\n## Key Facts\n- Built with TanStack Start\n- Supports React and Solid\n- Full TypeScript support\n\n## Contact\n- Website: https://myapp.com\n- GitHub: https://github.com/mycompany/myapp\n`\n\n        return new Response(content, {\n          headers: {\n            'Content-Type': 'text/plain',\n          },\n        })\n      },\n    },\n  },\n})\n```\n\n## Monitoring AI Citations\n\nUnlike traditional SEO with established analytics, LLMO monitoring is still evolving. Consider:\n\n- **Test with AI assistants** - Ask ChatGPT, Claude, and Perplexity about your product/content\n- **Monitor brand mentions** - Track how AI systems describe your offerings\n- **Validate structured data** - Use [Google's Rich Results Test](https://search.google.com/test/rich-results) and [Schema.org Validator](https://validator.schema.org/)\n- **Check AI search engines** - Monitor presence in Perplexity, Bing Chat, and Google AI Overviews\n"
  },
  {
    "path": "docs/start/framework/solid/guide/middleware.md",
    "content": "---\nref: docs/start/framework/react/guide/middleware.md\nreplace:\n  { '@tanstack/react-start': '@tanstack/solid-start', 'React': 'SolidJS' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/observability.md",
    "content": "---\nid: observability\ntitle: Observability\n---\n\nObservability is a critical aspect of modern web development, enabling you to monitor, trace, and debug your application's performance and errors. TanStack Start provides built-in patterns for observability and integrates seamlessly with external tools to give you comprehensive insights into your application.\n\n## Partner Solution: Sentry\n\n<a href=\"https://sentry.io?utm_source=tanstack\" alt='Sentry Logo'>\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/sentry-wordmark-light.svg\" width=\"280\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/sentry-wordmark-dark.svg\" width=\"280\">\n    <img alt=\"Sentry logo\" src=\"https://raw.githubusercontent.com/tanstack/tanstack.com/main/src/images/sentry-wordmark-light.svg\" width=\"280\">\n  </picture>\n</a>\n\nFor comprehensive observability, we recommend [Sentry](https://sentry.io?utm_source=tanstack) - our trusted partner for error tracking and performance monitoring. Sentry provides:\n\n- **Real-time Error Tracking** - Catch and debug errors across your entire stack\n- **Performance Monitoring** - Track slow transactions and optimize bottlenecks\n- **Release Health** - Monitor deployments and track error rates over time\n- **User Impact Analysis** - Understand how errors affect your users\n- **TanStack Start Integration** - Works seamlessly with server functions and client code\n\n**Quick Setup:**\n\n```tsx\n// Client-side (app.tsx)\nimport * as Sentry from '@sentry/solid'\n\nSentry.init({\n  dsn: import.meta.env.VITE_SENTRY_DSN,\n  environment: import.meta.env.NODE_ENV,\n})\n\n// Server functions\nimport * as Sentry from '@sentry/node'\n\nconst serverFn = createServerFn().handler(async () => {\n  try {\n    return await riskyOperation()\n  } catch (error) {\n    Sentry.captureException(error)\n    throw error\n  }\n})\n```\n\n[Get started with Sentry →](https://sentry.io/signup?utm_source=tanstack) | [View integration example →](https://github.com/TanStack/router/tree/main/e2e/solid-router/sentry-integration)\n\n## Built-in Observability Patterns\n\nTanStack Start's architecture provides several opportunities for built-in observability without external dependencies:\n\n### Server Function Logging\n\nAdd logging to your server functions to track execution, performance, and errors:\n\n```tsx\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst getUser = createServerFn({ method: 'GET' })\n  .inputValidator((id: string) => id)\n  .handler(async ({ data: id }) => {\n    const startTime = Date.now()\n\n    try {\n      console.log(`[SERVER] Fetching user ${id}`)\n\n      const user = await db.users.findUnique({ where: { id } })\n\n      if (!user) {\n        console.log(`[SERVER] User ${id} not found`)\n        throw new Error('User not found')\n      }\n\n      const duration = Date.now() - startTime\n      console.log(`[SERVER] User ${id} fetched in ${duration}ms`)\n\n      return user\n    } catch (error) {\n      const duration = Date.now() - startTime\n      console.error(\n        `[SERVER] Error fetching user ${id} after ${duration}ms:`,\n        error,\n      )\n      throw error\n    }\n  })\n```\n\n### Request/Response Middleware\n\nCreate middleware to log all requests and responses:\n\n```tsx\nimport { createMiddleware } from '@tanstack/solid-start'\n\nconst requestLogger = createMiddleware().handler(async ({ next }) => {\n  const startTime = Date.now()\n  const timestamp = new Date().toISOString()\n\n  console.log(`[${timestamp}] ${request.method} ${request.url} - Starting`)\n\n  try {\n    const response = await next()\n    const duration = Date.now() - startTime\n\n    console.log(\n      `[${timestamp}] ${request.method} ${request.url} - ${response.status} (${duration}ms)`,\n    )\n\n    return response\n  } catch (error) {\n    const duration = Date.now() - startTime\n    console.error(\n      `[${timestamp}] ${request.method} ${request.url} - Error (${duration}ms):`,\n      error,\n    )\n    throw error\n  }\n})\n\n// Apply to all server routes\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [requestLogger],\n    handlers: {\n      GET: async () => {\n        return Response.json({ users: await getUsers() })\n      },\n    },\n  },\n})\n```\n\n### Route Performance Monitoring\n\nTrack route loading performance on both client and server:\n\n```tsx\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  loader: async ({ context }) => {\n    const startTime = Date.now()\n\n    try {\n      const data = await loadDashboardData()\n      const duration = Date.now() - startTime\n\n      // Log server-side performance\n      if (typeof window === 'undefined') {\n        console.log(`[SSR] Dashboard loaded in ${duration}ms`)\n      }\n\n      return data\n    } catch (error) {\n      const duration = Date.now() - startTime\n      console.error(`[LOADER] Dashboard error after ${duration}ms:`, error)\n      throw error\n    }\n  },\n  component: Dashboard,\n})\n\nfunction Dashboard() {\n  const data = Route.useLoaderData()\n\n  // Track client-side render time\n  Solid.createEffect(() => {\n    const renderTime = performance.now()\n    console.log(`[CLIENT] Dashboard rendered in ${renderTime}ms`)\n  })\n\n  return <div>Dashboard content</div>\n}\n```\n\n### Health Check Endpoints\n\nCreate server routes for health monitoring:\n\n```tsx\n// routes/health.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/health')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const checks = {\n          status: 'healthy',\n          timestamp: new Date().toISOString(),\n          uptime: process.uptime(),\n          memory: process.memoryUsage(),\n          database: await checkDatabase(),\n          version: process.env.npm_package_version,\n        }\n\n        return Response.json(checks)\n      },\n    },\n  },\n})\n\nasync function checkDatabase() {\n  try {\n    await db.raw('SELECT 1')\n    return { status: 'connected', latency: 0 }\n  } catch (error) {\n    return { status: 'error', error: error.message }\n  }\n}\n```\n\n### Error Boundaries\n\nImplement comprehensive error handling:\n\n```tsx\n// Client-side error boundary\nimport { ErrorBoundary } from 'solid-error-boundary'\n\nfunction ErrorFallback({ error, resetErrorBoundary }: any) {\n  // Log client errors\n  console.error('[CLIENT ERROR]:', error)\n\n  // Could also send to external service\n  // sendErrorToService(error)\n\n  return (\n    <div role=\"alert\">\n      <h2>Something went wrong</h2>\n      <button onClick={resetErrorBoundary}>Try again</button>\n    </div>\n  )\n}\n\nexport function App() {\n  return (\n    <ErrorBoundary FallbackComponent={ErrorFallback}>\n      <Router />\n    </ErrorBoundary>\n  )\n}\n\n// Server function error handling\nconst riskyOperation = createServerFn().handler(async () => {\n  try {\n    return await performOperation()\n  } catch (error) {\n    // Log server errors with context\n    console.error('[SERVER ERROR]:', {\n      error: error.message,\n      stack: error.stack,\n      timestamp: new Date().toISOString(),\n      // Add request context if available\n    })\n\n    // Return user-friendly error\n    throw new Error('Operation failed. Please try again.')\n  }\n})\n```\n\n### Performance Metrics Collection\n\nCollect and expose basic performance metrics:\n\n```tsx\n// utils/metrics.ts\nclass MetricsCollector {\n  private metrics = new Map<string, number[]>()\n\n  recordTiming(name: string, duration: number) {\n    if (!this.metrics.has(name)) {\n      this.metrics.set(name, [])\n    }\n    this.metrics.get(name)!.push(duration)\n  }\n\n  getStats(name: string) {\n    const timings = this.metrics.get(name) || []\n    if (timings.length === 0) return null\n\n    const sorted = timings.sort((a, b) => a - b)\n    return {\n      count: timings.length,\n      avg: timings.reduce((a, b) => a + b, 0) / timings.length,\n      p50: sorted[Math.floor(sorted.length * 0.5)],\n      p95: sorted[Math.floor(sorted.length * 0.95)],\n      min: sorted[0],\n      max: sorted[sorted.length - 1],\n    }\n  }\n\n  getAllStats() {\n    const stats: Record<string, any> = {}\n    for (const [name] of this.metrics) {\n      stats[name] = this.getStats(name)\n    }\n    return stats\n  }\n}\n\nexport const metrics = new MetricsCollector()\n\n// Metrics endpoint\n// routes/metrics.ts\nexport const Route = createFileRoute('/metrics')({\n  server: {\n    handlers: {\n      GET: async () => {\n        return Response.json({\n          system: {\n            uptime: process.uptime(),\n            memory: process.memoryUsage(),\n            timestamp: new Date().toISOString(),\n          },\n          application: metrics.getAllStats(),\n        })\n      },\n    },\n  },\n})\n```\n\n### Debug Headers for Development\n\nAdd helpful debug information to responses:\n\n```tsx\nimport { createMiddleware } from '@tanstack/solid-start'\n\nconst debugMiddleware = createMiddleware().handler(async ({ next }) => {\n  const response = await next()\n\n  if (process.env.NODE_ENV === 'development') {\n    response.headers.set('X-Debug-Timestamp', new Date().toISOString())\n    response.headers.set('X-Debug-Node-Version', process.version)\n    response.headers.set('X-Debug-Uptime', process.uptime().toString())\n  }\n\n  return response\n})\n```\n\n### Environment-Specific Logging\n\nConfigure different logging strategies for development vs production:\n\n```tsx\n// utils/logger.ts\nimport { createIsomorphicFn } from '@tanstack/solid-start'\n\ntype LogLevel = 'debug' | 'info' | 'warn' | 'error'\n\nconst logger = createIsomorphicFn()\n  .server((level: LogLevel, message: string, data?: any) => {\n    const timestamp = new Date().toISOString()\n\n    if (process.env.NODE_ENV === 'development') {\n      // Development: Detailed console logging\n      console[level](`[${timestamp}] [${level.toUpperCase()}]`, message, data)\n    } else {\n      // Production: Structured JSON logging\n      console.log(\n        JSON.stringify({\n          timestamp,\n          level,\n          message,\n          data,\n          service: 'tanstack-start',\n          environment: process.env.NODE_ENV,\n        }),\n      )\n    }\n  })\n  .client((level: LogLevel, message: string, data?: any) => {\n    if (process.env.NODE_ENV === 'development') {\n      console[level](`[CLIENT] [${level.toUpperCase()}]`, message, data)\n    } else {\n      // Production: Send to analytics service\n      // analytics.track('client_log', { level, message, data })\n    }\n  })\n\n// Usage anywhere in your app\nexport { logger }\n\n// Example usage\nconst fetchUserData = createServerFn().handler(async ({ data: userId }) => {\n  logger('info', 'Fetching user data', { userId })\n\n  try {\n    const user = await db.users.findUnique({ where: { id: userId } })\n    logger('info', 'User data fetched successfully', { userId })\n    return user\n  } catch (error) {\n    logger('error', 'Failed to fetch user data', {\n      userId,\n      error: error.message,\n    })\n    throw error\n  }\n})\n```\n\n### Simple Error Reporting\n\nBasic error reporting without external dependencies:\n\n```tsx\n// utils/error-reporter.ts\nconst errorStore = new Map<\n  string,\n  { count: number; lastSeen: Date; error: any }\n>()\n\nexport function reportError(error: Error, context?: any) {\n  const key = `${error.name}:${error.message}`\n  const existing = errorStore.get(key)\n\n  if (existing) {\n    existing.count++\n    existing.lastSeen = new Date()\n  } else {\n    errorStore.set(key, {\n      count: 1,\n      lastSeen: new Date(),\n      error: {\n        name: error.name,\n        message: error.message,\n        stack: error.stack,\n        context,\n      },\n    })\n  }\n\n  // Log immediately\n  console.error('[ERROR REPORTED]:', {\n    error: error.message,\n    count: existing ? existing.count : 1,\n    context,\n  })\n}\n\n// Error reporting endpoint\n// routes/errors.ts\nexport const Route = createFileRoute('/admin/errors')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const errors = Array.from(errorStore.entries()).map(([key, data]) => ({\n          id: key,\n          ...data,\n        }))\n\n        return Response.json({ errors })\n      },\n    },\n  },\n})\n```\n\n## External Observability Tools\n\nWhile TanStack Start provides built-in observability patterns, external tools offer more comprehensive monitoring:\n\n### Other Popular Tools\n\n**Application Performance Monitoring:**\n\n- **[DataDog](https://www.datadoghq.com/)** - Full-stack monitoring with APM\n- **[New Relic](https://newrelic.com/)** - Performance monitoring and alerting\n- **[Honeycomb](https://honeycomb.io/)** - Observability for complex systems\n\n**Error Tracking:**\n\n- **[Bugsnag](https://bugsnag.com/)** - Error monitoring with deployment tracking\n- **[Rollbar](https://rollbar.com/)** - Real-time error alerting\n\n**Analytics & User Behavior:**\n\n- **[PostHog](https://posthog.com/)** - Product analytics with error tracking\n- **[Mixpanel](https://mixpanel.com/)** - Event tracking and user analytics\n\n### OpenTelemetry Integration (Experimental)\n\n[OpenTelemetry](https://opentelemetry.io/) is the industry standard for observability. Here's an experimental approach to integrate it with TanStack Start:\n\n```tsx\n// instrumentation.ts - Initialize before your app\nimport { NodeSDK } from '@opentelemetry/sdk-node'\nimport { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'\nimport { Resource } from '@opentelemetry/resources'\nimport { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'\n\nconst sdk = new NodeSDK({\n  resource: new Resource({\n    [SemanticResourceAttributes.SERVICE_NAME]: 'tanstack-start-app',\n    [SemanticResourceAttributes.SERVICE_VERSION]: '1.0.0',\n  }),\n  instrumentations: [getNodeAutoInstrumentations()],\n})\n\n// Initialize BEFORE importing your app\nsdk.start()\n```\n\n```tsx\n// Server function tracing\nimport { trace, SpanStatusCode } from '@opentelemetry/api'\n\nconst tracer = trace.getTracer('tanstack-start')\n\nconst getUserWithTracing = createServerFn({ method: 'GET' })\n  .inputValidator((id: string) => id)\n  .handler(async ({ data: id }) => {\n    return tracer.startActiveSpan('get-user', async (span) => {\n      span.setAttributes({\n        'user.id': id,\n        operation: 'database.query',\n      })\n\n      try {\n        const user = await db.users.findUnique({ where: { id } })\n        span.setStatus({ code: SpanStatusCode.OK })\n        return user\n      } catch (error) {\n        span.recordException(error)\n        span.setStatus({\n          code: SpanStatusCode.ERROR,\n          message: error.message,\n        })\n        throw error\n      } finally {\n        span.end()\n      }\n    })\n  })\n```\n\n```tsx\n// Middleware for automatic tracing\nimport { createMiddleware } from '@tanstack/solid-start'\nimport { trace, SpanStatusCode } from '@opentelemetry/api'\n\nconst tracer = trace.getTracer('tanstack-start')\n\nconst tracingMiddleware = createMiddleware().handler(\n  async ({ next, request }) => {\n    const url = new URL(request.url)\n\n    return tracer.startActiveSpan(\n      `${request.method} ${url.pathname}`,\n      async (span) => {\n        span.setAttributes({\n          'http.method': request.method,\n          'http.url': request.url,\n          'http.route': url.pathname,\n        })\n\n        try {\n          const response = await next()\n          span.setAttribute('http.status_code', response.status)\n          span.setStatus({ code: SpanStatusCode.OK })\n          return response\n        } catch (error) {\n          span.recordException(error)\n          span.setStatus({\n            code: SpanStatusCode.ERROR,\n            message: error.message,\n          })\n          throw error\n        } finally {\n          span.end()\n        }\n      },\n    )\n  },\n)\n```\n\n> **Note**: The above OpenTelemetry integration is experimental and requires manual setup. We're exploring first-class OpenTelemetry support that would provide automatic instrumentation for server functions, middleware, and route loaders.\n\n### Quick Integration Pattern\n\nMost observability tools follow a similar integration pattern with TanStack Start:\n\n```tsx\n// Initialize in app entry point\nimport { initObservabilityTool } from 'your-tool'\n\ninitObservabilityTool({\n  dsn: import.meta.env.VITE_TOOL_DSN,\n  environment: import.meta.env.NODE_ENV,\n})\n\n// Server function middleware\nconst observabilityMiddleware = createMiddleware().handler(async ({ next }) => {\n  return yourTool.withTracing('server-function', async () => {\n    try {\n      return await next()\n    } catch (error) {\n      yourTool.captureException(error)\n      throw error\n    }\n  })\n})\n```\n\n## Best Practices\n\n### Development vs Production\n\n```tsx\n// Different strategies per environment\nconst observabilityConfig = {\n  development: {\n    logLevel: 'debug',\n    enableTracing: true,\n    enableMetrics: false, // Too noisy in dev\n  },\n  production: {\n    logLevel: 'warn',\n    enableTracing: true,\n    enableMetrics: true,\n    enableAlerting: true,\n  },\n}\n```\n\n### Performance Monitoring Checklist\n\n- [ ] **Server Function Performance**: Track execution times\n- [ ] **Route Loading Times**: Monitor loader performance\n- [ ] **Database Query Performance**: Log slow queries\n- [ ] **External API Latency**: Monitor third-party service calls\n- [ ] **Memory Usage**: Track memory consumption patterns\n- [ ] **Error Rates**: Monitor error frequency and types\n\n### Security Considerations\n\n- Never log sensitive data (passwords, tokens, PII)\n- Use structured logging for better parsing\n- Implement log rotation in production\n- Consider compliance requirements (GDPR, CCPA)\n\n## Future OpenTelemetry Support\n\nDirect OpenTelemetry support is coming to TanStack Start, which will provide automatic instrumentation for server functions, middleware, and route loaders without the manual setup shown above.\n\n## Resources\n\n- **[Sentry Documentation](https://docs.sentry.io/)**\n- **[OpenTelemetry Documentation](https://opentelemetry.io/docs/)** - Industry standard observability\n- **[Working Example](https://github.com/TanStack/router/tree/main/examples/solid/start-basic)** - See observability patterns in action\n"
  },
  {
    "path": "docs/start/framework/solid/guide/path-aliases.md",
    "content": "---\nref: docs/start/framework/react/guide/path-aliases.md\nreplace:\n  { '@tanstack/react-start': '@tanstack/solid-start', 'React': 'SolidJS' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/reading-writing-file.md",
    "content": "---\nref: docs/start/framework/react/guide/reading-writing-file.md\nreplace:\n  { '@tanstack/react-start': '@tanstack/solid-start', 'React': 'SolidJS' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/routing.md",
    "content": "---\nid: routing\ntitle: Routing\n---\n\nTanStack Start is built on top of TanStack Router, so all of the features of TanStack Router are available to you.\n\n> [!NOTE]\n> We highly recommend reading the [TanStack Router documentation](/router/latest/docs/framework/solid/overview) to learn more about the features and capabilities of TanStack Router. What you learn here is more of a high-level overview of TanStack Router and how it works in Start.\n\n## The Router\n\nThe `router.tsx` file is the file that will dictate the behavior of TanStack Router used within Start. It's located in the `src` directory of your project.\n\n```\nsrc/\n├── router.tsx\n```\n\nHere, you can configure everything from the default [preloading functionality](/router/latest/docs/framework/solid/guide/preloading) to [caching staleness](/router/latest/docs/framework/solid/guide/data-loading).\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\n// You must export a getRouter function that\n// returns a new router instance each time\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n```\n\n## File-Based Routing\n\nStart uses TanStack Router's file-based routing approach to ensure proper code-splitting and advanced type-safety.\n\nYou can find your routes in the `src/routes` directory.\n\n```\nsrc/\n├── routes <-- This is where you put your routes\n│   ├── __root.tsx\n│   ├── index.tsx\n│   ├── about.tsx\n│   ├── posts.tsx\n│   ├── posts/$postId.tsx\n```\n\n## The Root Route\n\nThe root route is the top-most route in the entire tree and encapsulates all other routes as children. It's found in the `src/routes/__root.tsx` file and must be named `__root.tsx`.\n\n```\nsrc/\n├── routes\n│   ├── __root.tsx <-- The root route\n```\n\n- It has no path and is **always** matched\n- Its `component` is **always** rendered\n- This is where you render your document shell, e.g. `<html>`, `<body>`, etc.\n- Because it is **always rendered**, it is the perfect place to construct your application shell and take care of any global logic\n\n```tsx\n// src/routes/__root.tsx\nimport {\n  Outlet,\n  createRootRoute,\n  HeadContent,\n  Scripts,\n} from '@tanstack/solid-router'\nimport type { solidNode } from 'solid'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: Readonly<{ children: Solid.JSX.Element }>) {\n  return (\n    <>\n      <HeadContent />\n      {children}\n      <Scripts />\n    </>\n  )\n}\n```\n\nNotice the `Scripts` component at the bottom. This is used to load all of the client-side JavaScript for the application and should always be included for proper functionality.\n\n## The HeadContent Component\n\nThe `HeadContent` component is used to render the head, title, meta, link, and head-related script tags of the document.\n\nIt should be **rendered in the `<head>` tag of your root route's layout.**\n\n## The Outlet Component\n\nThe `Outlet` component is used to render the next potentially matching child route. `<Outlet />` doesn't take any props and can be rendered anywhere within a route's component tree. If there is no matching child route, `<Outlet />` will render `null`.\n\n## The Scripts Component\n\nThe `Scripts` component is used to render the body scripts of the document.\n\nIt should be **rendered in the `<body>` tag of your root route's layout.**\n\n## Route Tree Generation\n\nYou may notice a `routeTree.gen.ts` file in your project.\n\n```\nsrc/\n├── routeTree.gen.ts <-- The generated route tree file\n```\n\nThis file is automatically generated when you run TanStack Start (via `npm run dev` or `npm run start`). This file contains the generated route tree and a handful of TS utilities that make TanStack Start's type-safety extremely fast and fully inferred.\n\n## Nested Routing\n\nTanStack Router uses nested routing to match the URL with the correct component tree to render.\n\nFor example, given the following routes:\n\n```\nroutes/\n├── __root.tsx <-- Renders the <Root> component\n├── posts.tsx <-- Renders the <Posts> component\n├── posts.$postId.tsx <-- Renders the <Post> component\n```\n\nAnd the URL: `/posts/123`\n\nThe component tree would look like this:\n\n```\n<Root>\n  <Posts>\n    <Post />\n  </Posts>\n</Root>\n```\n\n## Types of Routes\n\nThere are a few different types of routes that you can create in your project.\n\n- Index Routes - Matched when the URL is exactly the same as the route's path\n- Dynamic/Wildcard/Splat Routes - Dynamically capture part or all of the URL path into a variable to use in your application\n\nThere are also a few different utility route types that you can use to group and organize your routes\n\n- Pathless Layout Routes (Apply layout or logic to a group of routes without nesting them in a path)\n- Non-Nested Routes (Un-nest a route from its parents and render its own component tree)\n- Grouped Routes (Group routes together in a directory simply for organization, without affecting the path hierarchy)\n\n## Route Tree Configuration\n\nThe route tree is configured in the `src/routes` directory.\n\n## Creating File Routes\n\nTo create a route, create a new file that corresponds to the path of the route you want to create. For example:\n\n| Path             | Filename            | Type           |\n| ---------------- | ------------------- | -------------- |\n| `/`              | `index.tsx`         | Index Route    |\n| `/about`         | `about.tsx`         | Static Route   |\n|                  | `posts.tsx`         | \"Layout\" Route |\n| `/posts/`        | `posts/index.tsx`   | Index Route    |\n| `/posts/:postId` | `posts/$postId.tsx` | Dynamic Route  |\n| `/rest/*`        | `rest/$.tsx`        | Wildcard Route |\n\n## Defining Routes\n\nTo define a route, use the `createFileRoute` function to export the route as the `Route` variable.\n\nFor example, to handle the `/posts/:postId` route, you would create a file named `posts/$postId.tsx` here:\n\n```\nsrc/\n├── routes\n│   ├── posts/$postId.tsx\n```\n\nThen, define the route like this:\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostComponent,\n})\n```\n\n> [!NOTE]\n> The path string passed to `createFileRoute` is **automatically written and managed by the router for you via the TanStack Router Bundler Plugin or Router CLI.** So, as you create new routes, move routes around or rename routes, the path will be updated for you automatically.\n\n## This is just the \"start\"\n\nThis has been just a high-level overview of how to configure routes using TanStack Router. For more detailed information, please refer to the [TanStack Router documentation](/router/latest/docs/framework/solid/routing/file-based-routing).\n"
  },
  {
    "path": "docs/start/framework/solid/guide/selective-ssr.md",
    "content": "---\nid: selective-ssr\ntitle: Selective Server-Side Rendering (SSR)\n---\n\n## What is Selective SSR?\n\nIn TanStack Start, routes matching the initial request are rendered on the server by default. This means `beforeLoad` and `loader` are executed on the server, followed by rendering the route components. The resulting HTML is sent to the client, which hydrates the markup into a fully interactive application.\n\nHowever, there are cases where you might want to disable SSR for certain routes or all routes, such as:\n\n- When `beforeLoad` or `loader` requires browser-only APIs (e.g., `localStorage`).\n- When the route component depends on browser-only APIs (e.g., `canvas`).\n\nTanStack Start's Selective SSR feature lets you configure:\n\n- Which routes should execute `beforeLoad` or `loader` on the server.\n- Which route components should be rendered on the server.\n\n## How does this compare to SPA mode?\n\nTanStack Start's [SPA mode](./spa-mode) completely disables server-side execution of `beforeLoad` and `loader`, as well as server-side rendering of route components. Selective SSR allows you to configure server-side handling on a per-route basis, either statically or dynamically.\n\n## Configuration\n\nYou can control how a route is handled during the initial server request using the `ssr` property. If this property is not set, it defaults to `true`. You can change this default using the `defaultSsr` option in `createStart`:\n\n```tsx\n// src/start.ts\nimport { createStart } from '@tanstack/solid-start'\n\nexport const startInstance = createStart(() => ({\n  // Disable SSR by default\n  defaultSsr: false,\n}))\n```\n\n### `ssr: true`\n\nThis is the default behavior unless otherwise configured. On the initial request, it will:\n\n- Run `beforeLoad` on the server and send the resulting context to the client.\n- Run `loader` on the server and send the loader data to the client.\n- Render the component on the server and send the HTML markup to the client.\n\n```tsx\n// src/routes/posts/$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  ssr: true,\n  beforeLoad: () => {\n    console.log('Executes on the server during the initial request')\n    console.log('Executes on the client for subsequent navigation')\n  },\n  loader: () => {\n    console.log('Executes on the server during the initial request')\n    console.log('Executes on the client for subsequent navigation')\n  },\n  component: () => <div>This component is rendered on the server</div>,\n})\n```\n\n### `ssr: false`\n\nThis disables server-side:\n\n- Execution of the route's `beforeLoad` and `loader`.\n- Rendering of the route component.\n\n```tsx\n// src/routes/posts/$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  ssr: false,\n  beforeLoad: () => {\n    console.log('Executes on the client during hydration')\n  },\n  loader: () => {\n    console.log('Executes on the client during hydration')\n  },\n  component: () => <div>This component is rendered on the client</div>,\n})\n```\n\n### `ssr: 'data-only'`\n\nThis hybrid option will:\n\n- Run `beforeLoad` on the server and send the resulting context to the client.\n- Run `loader` on the server and send the loader data to the client.\n- Disable server-side rendering of the route component.\n\n```tsx\n// src/routes/posts/$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  ssr: 'data-only',\n  beforeLoad: () => {\n    console.log('Executes on the server during the initial request')\n    console.log('Executes on the client for subsequent navigation')\n  },\n  loader: () => {\n    console.log('Executes on the server during the initial request')\n    console.log('Executes on the client for subsequent navigation')\n  },\n  component: () => <div>This component is rendered on the client</div>,\n})\n```\n\n### Functional Form\n\nFor more flexibility, you can use the functional form of the `ssr` property to decide at runtime whether to SSR a route:\n\n```tsx\n// src/routes/docs/$docType/$docId.tsx\nexport const Route = createFileRoute('/docs/$docType/$docId')({\n  validateSearch: z.object({ details: z.boolean().optional() }),\n  ssr: ({ params, search }) => {\n    if (params.status === 'success' && params.value.docType === 'sheet') {\n      return false\n    }\n    if (search.status === 'success' && search.value.details) {\n      return 'data-only'\n    }\n  },\n  beforeLoad: () => {\n    console.log('Executes on the server depending on the result of ssr()')\n  },\n  loader: () => {\n    console.log('Executes on the server depending on the result of ssr()')\n  },\n  component: () => <div>This component is rendered on the client</div>,\n})\n```\n\nThe `ssr` function runs only on the server during the initial request and is stripped from the client bundle.\n\n`search` and `params` are passed in after validation as a discriminated union:\n\n```tsx\nparams:\n    | { status: 'success'; value: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>> }\n    | { status: 'error'; error: unknown }\nsearch:\n    | { status: 'success'; value: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>> }\n    | { status: 'error'; error: unknown }\n```\n\nIf validation fails, `status` will be `error` and `error` will contain the failure details. Otherwise, `status` will be `success` and `value` will contain the validated data.\n\n### Inheritance\n\nAt runtime, a child route inherits the Selective SSR configuration of its parent. However, the inherited value can only be changed to be more restrictive (i.e. `true` to `data-only` or `false` and `data-only` to `false`). For example:\n\n```tsx\nroot { ssr: undefined }\n  posts { ssr: false }\n     $postId { ssr: true }\n```\n\n- `root` defaults to `ssr: true`.\n- `posts` explicitly sets `ssr: false`, so neither `beforeLoad` nor `loader` will run on the server, and the route component won't be rendered on the server.\n- `$postId` sets `ssr: true`, but inherits `ssr: false` from its parent. Because the inherited value can only be changed to be more restrictive, `ssr: true` has no effect and the inherited `ssr: false` will remain.\n\nAnother example:\n\n```tsx\nroot { ssr: undefined }\n  posts { ssr: 'data-only' }\n     $postId { ssr: true }\n       details { ssr: false }\n```\n\n- `root` defaults to `ssr: true`.\n- `posts` sets `ssr: 'data-only'`, so `beforeLoad` and `loader` run on the server, but the route component isn't rendered on the server.\n- `$postId` sets `ssr: true`, but inherits `ssr: 'data-only'` from its parent.\n- `details` sets `ssr: false`, so neither `beforeLoad` nor `loader` will run on the server, and the route component won't be rendered on the server. Here the inherited value is changed to be more restrictive, and therefore, the `ssr: false` will override the inherited value.\n\n## Fallback Rendering\n\nFor the first route with `ssr: false` or `ssr: 'data-only'`, the server will render the route's `pendingComponent` as a fallback. If `pendingComponent` isn't configured, the `defaultPendingComponent` will be rendered. If neither is configured, no fallback will be rendered.\n\nOn the client during hydration, this fallback will be displayed for at least `minPendingMs` (or `defaultPendingMinMs` if not configured), even if the route doesn't have `beforeLoad` or `loader` defined.\n\n## How to disable SSR of the root route?\n\nYou can disable server side rendering of the root route component, however the `<html>` shell still needs to be rendered on the server. This shell is configured via the `shellComponent` property and takes a single property `children`. The `shellComponent` is always SSRed and is wrapping around the root `component`, the root `errorComponent` or the root `notFound` component respectively.\n\nA minimal setup of a root route with disabled SSR for the route component looks like this:\n\n```tsx\nimport * as Solid from 'solid-js'\n\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  shellComponent: RootShell,\n  component: RootComponent,\n  errorComponent: () => <div>Error</div>,\n  notFoundComponent: () => <div>Not found</div>,\n  ssr: false, // or `defaultSsr: false` on the router\n})\n\nfunction RootShell(props) {\n  return (\n    <HeadContent />\n    {props.children}\n    <Scripts />\n  )\n}\n\nfunction RootComponent() {\n  return (\n    <div>\n      <h1>This component will be rendered on the client</h1>\n      <Outlet />\n    </div>\n  )\n}\n```\n"
  },
  {
    "path": "docs/start/framework/solid/guide/seo.md",
    "content": "---\nid: seo\ntitle: SEO\n---\n\n> [!NOTE]\n> Looking to optimize for AI assistants and LLMs? See the [LLM Optimization (LLMO) guide](./llmo).\n\n## What is SEO, really?\n\nSEO (Search Engine Optimization) is often misunderstood as simply \"showing up on Google\" or a checkbox that a library can magically provide. In reality, SEO is a broad discipline focused on delivering valuable content that people need and making it easy for them to find.\n\n**Technical SEO** is a subset of SEO that developers interact with most directly. It involves using tools and APIs that satisfy the technical requirements of search engines, crawlers, rankers, and even LLMs. When someone says a framework has \"good SEO support,\" they typically mean it provides the tools to make this process straightforward.\n\nTanStack Start provides comprehensive technical SEO capabilities, but you still need to put in the work to use them effectively.\n\n## What TanStack Start Provides\n\nTanStack Start gives you the building blocks for technical SEO:\n\n- **Server-Side Rendering (SSR)** - Ensures crawlers receive fully rendered HTML\n- **Static Prerendering** - Pre-generates pages for optimal performance and crawlability\n- **Document Head Management** - Full control over meta tags, titles, and structured data\n- **Performance** - Fast load times through code-splitting, streaming, and optimal bundling\n\n## Document Head Management\n\nThe `head` property on routes is your primary tool for SEO. It allows you to set page titles, meta descriptions, Open Graph tags, and more.\n\n### Basic Meta Tags\n\n```tsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  head: () => ({\n    meta: [\n      { title: 'My App - Home' },\n      {\n        name: 'description',\n        content: 'Welcome to My App, a platform for...',\n      },\n    ],\n  }),\n  component: HomePage,\n})\n```\n\n### Dynamic Meta Tags\n\nUse loader data to generate dynamic meta tags for content pages:\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [\n      { title: loaderData.post.title },\n      { name: 'description', content: loaderData.post.excerpt },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n### Open Graph and Social Sharing\n\nOpen Graph tags control how your pages appear when shared on social media:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [\n      { title: loaderData.post.title },\n      { name: 'description', content: loaderData.post.excerpt },\n      // Open Graph\n      { property: 'og:title', content: loaderData.post.title },\n      { property: 'og:description', content: loaderData.post.excerpt },\n      { property: 'og:image', content: loaderData.post.coverImage },\n      { property: 'og:type', content: 'article' },\n      // Twitter Card\n      { name: 'twitter:card', content: 'summary_large_image' },\n      { name: 'twitter:title', content: loaderData.post.title },\n      { name: 'twitter:description', content: loaderData.post.excerpt },\n      { name: 'twitter:image', content: loaderData.post.coverImage },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n### Canonical URLs\n\nCanonical URLs help prevent duplicate content issues:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  head: ({ params }) => ({\n    links: [\n      {\n        rel: 'canonical',\n        href: `https://myapp.com/posts/${params.postId}`,\n      },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n## Structured Data (JSON-LD)\n\nStructured data helps search engines understand your content and can enable rich results in search:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [{ title: loaderData.post.title }],\n    scripts: [\n      {\n        type: 'application/ld+json',\n        children: JSON.stringify({\n          '@context': 'https://schema.org',\n          '@type': 'Article',\n          headline: loaderData.post.title,\n          description: loaderData.post.excerpt,\n          image: loaderData.post.coverImage,\n          author: {\n            '@type': 'Person',\n            name: loaderData.post.author.name,\n          },\n          datePublished: loaderData.post.publishedAt,\n        }),\n      },\n    ],\n  }),\n  component: PostPage,\n})\n```\n\n## Server-Side Rendering\n\nSSR is enabled by default in TanStack Start. This ensures that search engine crawlers receive fully rendered HTML content, which is critical for SEO.\n\n```tsx\n// SSR is automatic - your pages are rendered on the server\nexport const Route = createFileRoute('/about')({\n  component: AboutPage,\n})\n```\n\nFor routes that don't need SSR, you can disable it selectively. However, be aware this may impact SEO for those pages:\n\n```tsx\n// Only disable SSR for pages that don't need SEO\nexport const Route = createFileRoute('/dashboard')({\n  ssr: false, // Dashboard doesn't need to be indexed\n  component: DashboardPage,\n})\n```\n\nSee the [Selective SSR guide](./selective-ssr) for more details.\n\n## Static Prerendering\n\nFor content that doesn't change frequently, static prerendering generates HTML at build time for optimal performance:\n\n```ts\n// vite.config.ts\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      prerender: {\n        enabled: true,\n        crawlLinks: true,\n      },\n    }),\n  ],\n})\n```\n\nPrerendered pages load faster and are easily crawlable. See the [Static Prerendering guide](./static-prerendering) for configuration options.\n\n## Sitemaps\n\n### Built-in Sitemap Generation\n\nTanStack Start can automatically generate a sitemap when you enable prerendering with link crawling:\n\n```ts\n// vite.config.ts\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      prerender: {\n        enabled: true,\n        crawlLinks: true, // Discovers all linkable pages\n      },\n      sitemap: {\n        enabled: true,\n        host: 'https://myapp.com',\n      },\n    }),\n  ],\n})\n```\n\nThe sitemap is generated at build time by crawling all discoverable pages from your routes. This is the recommended approach for static or mostly-static sites.\n\n### Static Sitemap\n\nFor simple sites, you can also place a static `sitemap.xml` file in your `public` directory:\n\n```xml\n<!-- public/sitemap.xml -->\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url>\n    <loc>https://myapp.com/</loc>\n    <changefreq>daily</changefreq>\n    <priority>1.0</priority>\n  </url>\n  <url>\n    <loc>https://myapp.com/about</loc>\n    <changefreq>monthly</changefreq>\n  </url>\n</urlset>\n```\n\nThis approach works well when your site structure is known and doesn't change often.\n\n### Dynamic Sitemap\n\nFor sites with dynamic content that can't be discovered at build time, you can create a dynamic sitemap using a [server route](./server-routes). Consider caching this at your CDN for performance:\n\n```ts\n// src/routes/sitemap[.]xml.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/sitemap.xml')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const posts = await fetchAllPosts()\n\n        const sitemap = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  <url>\n    <loc>https://myapp.com/</loc>\n    <changefreq>daily</changefreq>\n    <priority>1.0</priority>\n  </url>\n  ${posts\n    .map(\n      (post) => `\n  <url>\n    <loc>https://myapp.com/posts/${post.id}</loc>\n    <lastmod>${post.updatedAt}</lastmod>\n    <changefreq>weekly</changefreq>\n  </url>`,\n    )\n    .join('')}\n</urlset>`\n\n        return new Response(sitemap, {\n          headers: {\n            'Content-Type': 'application/xml',\n          },\n        })\n      },\n    },\n  },\n})\n```\n\n## robots.txt\n\n### Static robots.txt\n\nThe simplest approach is to place a static `robots.txt` file in your `public` directory:\n\n```txt\n// public/robots.txt\nUser-agent: *\nAllow: /\n\nSitemap: https://myapp.com/sitemap.xml\n```\n\nThis file will be served automatically at `/robots.txt`. This is the most common approach for most sites.\n\n### Dynamic robots.txt\n\nFor more complex scenarios (e.g., different rules per environment), you can create a robots.txt file using a [server route](./server-routes):\n\n```ts\n// src/routes/robots[.]txt.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/robots.txt')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const robots = `User-agent: *\nAllow: /\n\nSitemap: https://myapp.com/sitemap.xml`\n\n        return new Response(robots, {\n          headers: {\n            'Content-Type': 'text/plain',\n          },\n        })\n      },\n    },\n  },\n})\n```\n\n## Best Practices\n\n### Performance Matters\n\nPage speed is a ranking factor. TanStack Start helps with:\n\n- **Automatic code-splitting** - Only load the JavaScript needed for each page\n- **Streaming SSR** - Start sending HTML to the browser immediately\n- **Preloading** - Prefetch routes before users navigate to them\n\n### Content is King\n\nTechnical SEO is just one piece of the puzzle. The most important factors are:\n\n- **Quality content** - Create content that provides value to users\n- **Clear site structure** - Organize your routes logically\n- **Descriptive URLs** - Use meaningful path segments (`/posts/my-great-article` vs `/posts/123`)\n- **Internal linking** - Help users and crawlers discover your content\n\n### Test Your Implementation\n\nUse these tools to verify your SEO implementation:\n\n- [Google Search Console](https://search.google.com/search-console) - Monitor indexing and search performance\n- [Google Rich Results Test](https://search.google.com/test/rich-results) - Validate structured data\n- [Open Graph Debugger](https://developers.facebook.com/tools/debug/) - Preview social sharing cards\n- Browser DevTools - Inspect rendered HTML and meta tags\n\n### Track Your Rankings\n\nTo monitor your SEO performance over time, we recommend [Nozzle.io](https://nozzle.io?utm_source=tanstack). Nozzle provides enterprise-grade rank tracking that lets you monitor unlimited keywords, track SERP features, and analyze your visibility against competitors. Unlike traditional rank trackers, Nozzle stores the entire SERP for every query, giving you complete data to understand how your pages perform in search results.\n"
  },
  {
    "path": "docs/start/framework/solid/guide/server-entry-point.md",
    "content": "---\nref: docs/start/framework/react/guide/server-entry-point.md\nreplace:\n  { '@tanstack/react-start': '@tanstack/solid-start', 'React': 'SolidJS' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/server-functions.md",
    "content": "---\nref: docs/start/framework/react/guide/server-functions.md\nreplace:\n  {\n    '@tanstack/react-start': '@tanstack/solid-start',\n    'React': 'SolidJS',\n    '@tanstack/react-router': '@tanstack/solid-router',\n  }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/server-routes.md",
    "content": "---\nid: server-routes\ntitle: Server Routes\n---\n\nServer routes are a powerful feature of TanStack Start that allow you to create server-side endpoints in your application and are useful for handling raw HTTP requests, form submissions, user authentication, and much more.\n\nServer routes can be defined in your `./src/routes` directory of your project **right alongside your TanStack Router routes** and are automatically handled by the TanStack Start server.\n\nHere's what a simple server route looks like:\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World!')\n      },\n    },\n  },\n})\n```\n\n## Server Routes and App Routes\n\nBecause server routes can be defined in the same directory as your app routes, you can even use the same file for both!\n\n```tsx\n// routes/hello.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const body = await request.json()\n        return new Response(JSON.stringify({ message: `Hello, ${body.name}!` }))\n      },\n    },\n  },\n  component: HelloComponent,\n})\n\nfunction HelloComponent() {\n  const [reply, setReply] = createSignal('')\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          fetch('/hello', {\n            method: 'POST',\n            headers: {\n              'Content-Type': 'application/json',\n            },\n            body: JSON.stringify({ name: 'Tanner' }),\n          })\n            .then((res) => res.json())\n            .then((data) => setReply(data.message))\n        }}\n      >\n        Say Hello\n      </button>\n    </div>\n  )\n}\n```\n\n## File Route Conventions\n\nServer routes in TanStack Start follow the same file-based routing conventions as TanStack Router. This means that each file in your `routes` directory with a `server` property in the `createFileRoute` call will be treated as an API route. Here are a few examples:\n\n- `/routes/users.ts` will create an API route at `/users`\n- `/routes/users.index.ts` will **also** create an API route at `/users` (but will error if duplicate methods are defined)\n- `/routes/users/$id.ts` will create an API route at `/users/$id`\n- `/routes/users/$id/posts.ts` will create an API route at `/users/$id/posts`\n- `/routes/users.$id.posts.ts` will create an API route at `/users/$id/posts`\n- `/routes/api/file/$.ts` will create an API route at `/api/file/$`\n- `/routes/my-script[.]js.ts` will create an API route at `/my-script.js`\n\n## Unique Route Paths\n\nEach route can only have a single handler file associated with it. So, if you have a file named `routes/users.ts` which'd equal the request path of `/users`, you cannot have other files that'd also resolve to the same route. For example, the following files would all resolve to the same route and would error:\n\n- `/routes/users.index.ts`\n- `/routes/users.ts`\n- `/routes/users/index.ts`\n\n## Escaped Matching\n\nJust as with normal routes, server routes can match on escaped characters. For example, a file named `routes/users[.]json.ts` will create an API route at `/users.json`.\n\n## Pathless Layout Routes and Break-out Routes\n\nBecause of the unified routing system, pathless layout routes and break-out routes are supported for similar functionality around server route middleware.\n\n- Pathless layout routes can be used to add middleware to a group of routes\n- Break-out routes can be used to \"break out\" of parent middleware\n\n## Nested Directories vs File-names\n\nIn the examples above, you may have noticed that the file naming conventions are flexible and allow you to mix and match directories and file names. This is intentional and allows you to organize your Server routes in a way that makes sense for your application. You can read more about this in the [TanStack Router File-based Routing Guide](/router/latest/docs/framework/solid/routing/file-based-routing#s-or-s).\n\n## Handling Server Route Requests\n\nServer route requests are handled by Start automatically by default or by Start's `createStartHandler` in your custom `src/server.ts` entry point file.\n\nThe start handler is responsible for matching an incoming request to a server route and executing the appropriate middleware and handler.\n\nIf you need to customize the server handler, you can do so by creating a custom handler and then passing the event to the start handler. See [The Server Entry Point](./server-entry-point).\n\n## Defining a Server Route\n\nServer routes are created by adding a `server` property to your `createFileRoute` call. The `server` property contains:\n\n- `handlers` - Either an object mapping HTTP methods to handler functions, or a function that receives `createHandlers` for more advanced use cases\n- `middleware` - Optional route-level middleware array that applies to all handlers\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World! from ' + request.url)\n      },\n    },\n  },\n})\n```\n\n## Defining Server Route Handlers\n\nYou can define handlers in two ways:\n\n- **Simple handlers**: Provide handler functions directly in a handlers object\n- **Handlers with middleware**: Use the `createHandlers` function to define handlers with middleware\n\n### Simple handlers\n\nFor simple use cases, you can provide handler functions directly in a handlers object.\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World! from ' + request.url)\n      },\n    },\n  },\n})\n```\n\n### Adding middleware to specific handlers\n\nFor more complex use cases, you can add middleware to specific handlers. This requires using the `createHandlers` function:\n\n```tsx\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: ({ createHandlers }) =>\n      createHandlers({\n        GET: {\n          middleware: [loggerMiddleware],\n          handler: async ({ request }) => {\n            return new Response('Hello, World! from ' + request.url)\n          },\n        },\n      }),\n  },\n})\n```\n\n### Adding middleware to all handlers\n\nYou can also add middleware that applies to all handlers in a route by using the `middleware` property at the server level:\n\n```tsx\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    middleware: [authMiddleware, loggerMiddleware], // Applies to all handlers\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World! from ' + request.url)\n      },\n      POST: async ({ request }) => {\n        const body = await request.json()\n        return new Response(`Hello, ${body.name}!`)\n      },\n    },\n  },\n})\n```\n\n### Combining route-level and handler-specific middleware\n\nYou can combine both approaches - route-level middleware will run first, followed by handler-specific middleware:\n\n```tsx\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    middleware: [authMiddleware], // Runs first for all handlers\n    handlers: ({ createHandlers }) =>\n      createHandlers({\n        GET: async ({ request }) => {\n          return new Response('Hello, World!')\n        },\n        POST: {\n          middleware: [validationMiddleware], // Runs after authMiddleware, only for POST\n          handler: async ({ request }) => {\n            const body = await request.json()\n            return new Response(`Hello, ${body.name}!`)\n          },\n        },\n      }),\n  },\n})\n```\n\n## Handler Context\n\nEach HTTP method handler receives an object with the following properties:\n\n- `request`: The incoming request object. You can read more about the `Request` object in the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Request).\n- `params`: An object containing the dynamic path parameters of the route. For example, if the route path is `/users/$id`, and the request is made to `/users/123`, then `params` will be `{ id: '123' }`. We'll cover dynamic path parameters and wildcard parameters later in this guide.\n- `context`: An object containing the context of the request. This is useful for passing data between middleware.\n\nOnce you've processed the request, you can return a `Response` object or `Promise<Response>` or even use any of the helpers from `@tanstack/solid-start` to manipulate the response.\n\n## Dynamic Path Params\n\nServer routes support dynamic path parameters in the same way as TanStack Router. For example, a file named `routes/users/$id.ts` will create an API route at `/users/$id` that accepts a dynamic `id` parameter.\n\n```ts\n// routes/users/$id.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ params }) => {\n        const { id } = params\n        return new Response(`User ID: ${id}`)\n      },\n    },\n  },\n})\n\n// Visit /users/123 to see the response\n// User ID: 123\n```\n\nYou can also have multiple dynamic path parameters in a single route. For example, a file named `routes/users/$id/posts/$postId.ts` will create an API route at `/users/$id/posts/$postId` that accepts two dynamic parameters.\n\n```ts\n// routes/users/$id/posts/$postId.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/users/$id/posts/$postId')({\n  server: {\n    handlers: {\n      GET: async ({ params }) => {\n        const { id, postId } = params\n        return new Response(`User ID: ${id}, Post ID: ${postId}`)\n      },\n    },\n  },\n})\n\n// Visit /users/123/posts/456 to see the response\n// User ID: 123, Post ID: 456\n```\n\n## Wildcard/Splat Param\n\nServer routes also support wildcard parameters at the end of the path, which are denoted by a `$` followed by nothing. For example, a file named `routes/file/$.ts` will create an API route at `/file/$` that accepts a wildcard parameter.\n\n```ts\n// routes/file/$.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/file/$')({\n  server: {\n    handlers: {\n      GET: async ({ params }) => {\n        const { _splat } = params\n        return new Response(`File: ${_splat}`)\n      },\n    },\n  },\n})\n\n// Visit /file/hello.txt to see the response\n// File: hello.txt\n```\n\n## Handling requests with a body\n\nTo handle POST requests,you can add a `POST` handler to the route object. The handler will receive the request object as the first argument, and you can access the request body using the `request.json()` method.\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const body = await request.json()\n        return new Response(`Hello, ${body.name}!`)\n      },\n    },\n  },\n})\n\n// Send a POST request to /hello with a JSON body like { \"name\": \"Tanner\" }\n// Hello, Tanner!\n```\n\nThis also applies to other HTTP methods like `PUT`, `PATCH`, and `DELETE`. You can add handlers for these methods in the route object and access the request body using the appropriate method.\n\nIt's important to remember that the `request.json()` method returns a `Promise` that resolves to the parsed JSON body of the request. You need to `await` the result to access the body.\n\nThis is a common pattern for handling POST requests in Server routes/ You can also use other methods like `request.text()` or `request.formData()` to access the body of the request.\n\n## Responding with JSON\n\nWhen returning JSON using a Response object, this is a common pattern:\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response(JSON.stringify({ message: 'Hello, World!' }), {\n          headers: {\n            'Content-Type': 'application/json',\n          },\n        })\n      },\n    },\n  },\n})\n\n// Visit /hello to see the response\n// {\"message\":\"Hello, World!\"}\n```\n\n## Using the `Response.json` helper function\n\nOr you can use the [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) helper function to automatically set the `Content-Type` header to `application/json` and serialize the JSON object for you.\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return Response.json({ message: 'Hello, World!' })\n      },\n    },\n  },\n})\n\n// Visit /hello to see the response\n// {\"message\":\"Hello, World!\"}\n```\n\n## Responding with a status code\n\nYou can set the status code of the response by passing it as a property of the second argument to the `Response` constructor\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        const user = await findUser(params.id)\n        if (!user) {\n          return new Response('User not found', {\n            status: 404,\n          })\n        }\n        return Response.json(user)\n      },\n    },\n  },\n})\n```\n\nIn this example, we're returning a `404` status code if the user is not found. You can set any valid HTTP status code using this method.\n\n## Setting headers in the response\n\nSometimes you may need to set headers in the response. You can do this by passing an object as the second argument to the `Response` constructor.\n\n```ts\n// routes/hello.ts\nimport { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/hello')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        return new Response('Hello, World!', {\n          headers: {\n            'Content-Type': 'text/plain',\n          },\n        })\n      },\n    },\n  },\n})\n// Visit /hello to see the response\n// Hello, World!\n```\n"
  },
  {
    "path": "docs/start/framework/solid/guide/spa-mode.md",
    "content": "---\nref: docs/start/framework/react/guide/spa-mode.md\nreplace:\n  { '@tanstack/react-start': '@tanstack/solid-start', 'React': 'SolidJS' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/static-prerendering.md",
    "content": "---\nid: static-prerendering\ntitle: Static Prerendering\n---\n\nStatic prerendering is the process of generating static HTML files for your application. This can be useful for either improving the performance of your application, as it allows you to serve pre-rendered HTML files to users without having to generate them on the fly or for deploying static sites to platforms that do not support server-side rendering.\n\n## Prerendering\n\nTanStack Start can prerender your application to static HTML files, which can then be served to users without having to generate them on the fly. To prerender your application, you can add the `prerender` option to your tanstackStart configuration in `vite.config.ts` file:\n\n```ts\n// vite.config.ts\n\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart({\n      prerender: {\n        // Enable prerendering\n        enabled: true,\n\n        // Enable if you need pages to be at `/page/index.html` instead of `/page.html`\n        autoSubfolderIndex: true,\n\n        // If disabled, only the root path or the paths defined in the pages config will be prerendered\n        autoStaticPathsDiscovery: true,\n\n        // How many prerender jobs to run at once\n        concurrency: 14,\n\n        // Whether to extract links from the HTML and prerender them also\n        crawlLinks: true,\n\n        // Filter function takes the page object and returns whether it should prerender\n        filter: ({ path }) => !path.startsWith('/do-not-render-me'),\n\n        // Number of times to retry a failed prerender job\n        retryCount: 2,\n\n        // Delay between retries in milliseconds\n        retryDelay: 1000,\n\n        // Maximum number of redirects to follow during prerendering\n        maxRedirects: 5,\n\n        // Fail if an error occurs during prerendering\n        failOnError: true,\n\n        // Callback when page is successfully rendered\n        onSuccess: ({ page }) => {\n          console.log(`Rendered ${page.path}!`)\n        },\n      },\n      // Optional configuration for specific pages\n      // Note: When autoStaticPathsDiscovery is enabled (default), discovered static\n      // routes will be merged with the pages specified below\n      pages: [\n        {\n          path: '/my-page',\n          prerender: { enabled: true, outputPath: '/my-page/index.html' },\n        },\n      ],\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n```\n\n## Automatic Static Route Discovery\n\nAll static paths will be automatically discovered and seamlessly merged with the specified `pages` config\n\nRoutes are excluded from automatic discovery in the following cases:\n\n- Routes with path parameters (e.g., `/users/$userId`) since they require specific parameter values\n- Layout routes (prefixed with `_`) since they don't render standalone pages\n- Routes without components (e.g., API routes)\n\nNote: Dynamic routes can still be prerendered if they are linked from other pages when `crawlLinks` is enabled.\n\n## Crawling Links\n\nWhen `crawlLinks` is enabled (default: `true`), TanStack Start will extract links from prerendered pages and prerender those linked pages as well.\n\nFor example, if `/` contains a link to `/posts`, then `/posts` will also be automatically prerendered.\n"
  },
  {
    "path": "docs/start/framework/solid/guide/static-server-functions.md",
    "content": "---\nref: docs/start/framework/react/guide/static-server-functions.md\nreplace:\n  { '@tanstack/react-start': '@tanstack/solid-start', 'React': 'SolidJS' }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/guide/tailwind-integration.md",
    "content": "---\nid: tailwind-integration\ntitle: Tailwind CSS Integration\n---\n\n_So you want to use Tailwind CSS in your TanStack Start project?_\n\nThis guide will help you use Tailwind CSS in your TanStack Start project.\n\n## Tailwind CSS Version 4 (Latest)\n\nThe latest version of Tailwind CSS is 4. And it has some configuration changes that majorly differ from Tailwind CSS Version 3. It's **easier and recommended** to set up Tailwind CSS Version 4 in a TanStack Start project, as TanStack Start uses Vite as its build tool.\n\n### Install Tailwind CSS\n\nInstall Tailwind CSS and it's Vite plugin.\n\n```shell\nnpm install tailwindcss @tailwindcss/vite\n```\n\n### Configure The Vite Plugin\n\nAdd the `@tailwindcss/vite` plugin to your Vite configuration.\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport tsConfigPaths from 'vite-tsconfig-paths'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tsConfigPaths(),\n    tanstackStart(),\n    viteSolid({ ssr: true }),\n    tailwindcss(),\n  ],\n})\n```\n\n### Import Tailwind in your CSS file\n\nYou need to create a CSS file to configure Tailwind CSS instead of the configuration file in version 4. You can do this by creating a `src/styles/app.css` file or name it whatever you want.\n\n```css\n/* src/styles/app.css */\n@import 'tailwindcss' source('../');\n```\n\n## Import the CSS file in your `__root.tsx` file\n\nImport the CSS file in your `__root.tsx` file with the `?url` query and make sure to add the **triple slash** directive to the top of the file.\n\n```tsx\n// src/routes/__root.tsx\n/// <reference types=\"vite/client\" />\n// other imports...\n\nimport appCss from '../styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      // your meta tags and site config\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n    // other head config\n  }),\n  component: RootComponent,\n})\n```\n\n## Use Tailwind CSS anywhere in your project\n\nYou can now use Tailwind CSS anywhere in your project.\n\n```tsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return <div className=\"bg-red-500 text-white p-4\">Hello World</div>\n}\n```\n\nThat's it! You can now use Tailwind CSS anywhere in your project 🎉.\n\n## Tailwind CSS Version 3 (Legacy)\n\nIf you are want to use Tailwind CSS Version 3, you can use the following steps.\n\n### Install Tailwind CSS\n\nInstall Tailwind CSS and it's peer dependencies.\n\n```shell\nnpm install -D tailwindcss@3 postcss autoprefixer\n```\n\nThen generate the Tailwind and PostCSS configuration files.\n\n```shell\nnpx tailwindcss init -p\n```\n\n### Configure your template paths\n\nAdd the paths to all of your template files in the `tailwind.config.js` file.\n\n```js\n// tailwind.config.js\n/** @type {import('tailwindcss').Config} */\nexport default {\n  content: ['./src/**/*.{js,ts,jsx,tsx}'],\n  theme: {\n    extend: {},\n  },\n  plugins: [],\n}\n```\n\n### Add the Tailwind directives to your CSS file\n\nAdd the `@tailwind` directives for each of Tailwind's layers to your `src/styles/app.css` file.\n\n```css\n/* src/styles/app.css */\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n```\n\n> [!NOTE]\n> Jump to [Import the CSS file in your `__root.tsx` file](#import-the-css-file-in-your-__roottsx-file) to see how to import the CSS file in your `__root.tsx` file.\n"
  },
  {
    "path": "docs/start/framework/solid/overview.md",
    "content": "---\nref: docs/start/framework/react/overview.md\nreplace:\n  {\n    '@tanstack/react-start': '@tanstack/solid-start',\n    'React': 'SolidJS',\n    'react-router': 'solid-router',\n  }\n---\n"
  },
  {
    "path": "docs/start/framework/solid/quick-start.md",
    "content": "---\nid: quick-start\ntitle: Quick Start\n---\n\n## Impatient?\n\nThe fastest way to get a Start project up and running is with the cli. Just run\n\n```\nnpx @tanstack/cli@latest create --framework solid\n```\n\ndepending on your package manager of choice. You'll be prompted to add things like Tailwind, eslint, and a ton of other options.\n\nYou can also clone and run the [Basic](https://github.com/TanStack/router/tree/main/examples/solid/start-basic) example right away with the following commands:\n\n```bash\nnpx gitpick TanStack/router/tree/main/examples/solid/start-basic start-basic\ncd start-basic\nnpm install\nnpm run dev\n```\n\nIf you'd like to use a different example, you can replace `start-basic` above with the slug of the example you'd like to use from the list below.\n\nOnce you've cloned the example you want, head back to the [Routing](./guide/routing) guide to learn how to use TanStack Start!\n\n## Examples\n\nTanStack Start has loads of examples to get you started. Pick one of the examples below to get started!\n\n- [Bare](https://github.com/TanStack/router/tree/main/examples/solid/start-bare) (start-bare)\n- [Basic](https://github.com/TanStack/router/tree/main/examples/solid/start-basic) (start-basic)\n- [Basic Static](https://github.com/TanStack/router/tree/main/examples/solid/start-basic-stats) (start-basic-static)\n- [Counter](https://github.com/TanStack/router/tree/main/examples/solid/start-counter) (start-counter)\n\n### Stackblitz\n\nEach example above has an embedded stackblitz preview to find the one that feels like a good starting point\n\n### Quick Deploy\n\nTo quickly deploy an example, click the **Deploy to Netlify** button on an example's page to both clone and deploy the example to Netlify.\n\n### Manual Deploy\n\nTo manually clone and deploy the example to anywhere else you'd like, use the following commands replacing `EXAMPLE_SLUG` with the slug of the example you'd like to use from above:\n\n```bash\nnpx gitpick TanStack/router/tree/main/examples/solid/EXAMPLE_SLUG my-new-project\ncd my-new-project\nnpm install\nnpm run dev\n```\n\nOnce you've cloned or deployed an example, head back to the [Routing](./guide/routing) guide to learn how to use TanStack Start!\n"
  },
  {
    "path": "docs/start/framework/solid/tutorial/fetching-external-api.md",
    "content": "---\nid: fetching-external-api\ntitle: Calling an external API using TanStack Start\n---\n\nThis guide demonstrates how to integrate external API calls into your TanStack Start application using route loaders. We will use TMDB API to fetch popular movies using TanStack Start and understand how to fetch data in a TanStack Start app.\n\nThe complete code for this tutorial is available on [GitHub](https://github.com/shrutikapoor08/tanstack-start-movies).\n\n## What You'll Learn\n\n1. Setting up external API integration with TanStack Start\n1. Implementing route loaders for server-side data fetching\n1. Building responsive UI components with fetched data\n1. Handling loading states and error management\n\n## Prerequisites\n\n- Basic knowledge of Solid and TypeScript\n- Node.js (v18+) and `pnpm` installed on your machine\n- A TMDB API key (free at [themoviedb.org](https://www.themoviedb.org))\n\n## Nice to know\n\n- [TanStack Router](/router/latest/docs/framework/solid/routing/routing-concepts)\n\n## Setting up a TanStack Start Project\n\nFirst, let's create a new TanStack Start project:\n\n```bash\npnpx create-start-app movie-discovery\ncd movie-discovery\n```\n\nWhen this script runs, it will ask you a few setup questions. You can either pick choices that work for you or just press enter to accept the defaults.\n\nOptionally, you can pass in a `--add-on` flag to get options such as Shadcn, Clerk, Convex, TanStack Query, etc.\n\nOnce setup is complete, install dependencies and start the development server:\n\n```bash\npnpm i\npnpm dev\n```\n\n## Understanding the Project Structure\n\nAt this point, the project structure should look like this:\n\n```text\n/movie-discovery\n├── src/\n│   ├── routes/\n│   │   ├── __root.tsx                    # Root layout\n│   │   ├── index.tsx                     # Home page\n│   │   └── fetch-movies.tsx              # Movie fetching route\n│   ├── types/\n│   │   └── movie.ts                      # Movie type definitions\n│   ├── router.tsx                        # Router configuration\n│   ├── routeTree.gen.ts                  # Generated route tree\n│   └── styles.css                        # Global styles\n├── public/                               # Static assets\n├── vite.config.ts                         # TanStack Start configuration\n├── package.json                          # Project dependencies\n└── tsconfig.json                         # TypeScript configuration\n\n```\n\nOnce your project is set up, you can access your app at `localhost:3000`. You should see the default TanStack Start welcome page.\n\n## Step 1: Setup a `.env` file with TMDB_AUTH_TOKEN\n\nTo fetch movies from the TMDB API, you need an authentication token. You can get this for free at themoviedb.org.\n\nFirst, let's set up environment variables for our API key. Create a `.env` file in your project root:\n\n```bash\ntouch .env\n\n```\n\nAdd your TMDB API token to this file:\n\n```dotenv\nTMDB_AUTH_TOKEN=your_bearer_token_here\n```\n\n_Important_: Make sure to add `.env` to your `.gitignore` file to keep your API keys secure.\n\n## Step 2: Defining Data Types\n\nLet's create TypeScript interfaces for our movie data. Create a new file at `src/types/movie.ts`:\n\n```ts\n// src/types/movie.ts\nexport interface Movie {\n  id: number\n  title: string\n  overview: string\n  poster_path: string | null\n  backdrop_path: string | null\n  release_date: string\n  vote_average: number\n  popularity: number\n}\n\nexport interface TMDBResponse {\n  page: number\n  results: Movie[]\n  total_pages: number\n  total_results: number\n}\n```\n\n## Step 3: Creating the Route with API Fetch Function\n\nTo call the TMDB API, we're going to create a server function that fetches data on the server. This approach keeps our API credentials secure by never exposing them to the client.\nLet's create our route that fetches data from the TMDB API. Create a new file at `src/routes/fetch-movies.tsx`:\n\n```typescript\n// src/routes/fetch-movies.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\nimport type { Movie, TMDBResponse } from '../types/movie'\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst API_URL =\n  'https://api.themoviedb.org/3/discover/movie?include_adult=false&include_video=false&language=en-US&page=1&sort_by=popularity.desc'\n\nconst fetchPopularMovies = createServerFn().handler(\n  async (): Promise<TMDBResponse> => {\n    const response = await fetch(API_URL, {\n      headers: {\n        accept: 'application/json',\n        Authorization: `Bearer ${process.env.TMDB_AUTH_TOKEN}`,\n      },\n    })\n\n    if (!response.ok) {\n      throw new Error(`Failed to fetch movies: ${response.statusText}`)\n    }\n\n    return response.json()\n  },\n)\n\nexport const Route = createFileRoute('/fetch-movies')({\n  component: MoviesPage,\n  loader: async (): Promise<{ movies: Movie[]; error: string | null }> => {\n    try {\n      const moviesData = await fetchPopularMovies()\n      return { movies: moviesData.results, error: null }\n    } catch (error) {\n      console.error('Error fetching movies:', error)\n      return { movies: [], error: 'Failed to load movies' }\n    }\n  },\n})\n```\n\n_What's happening here:_\n\n- `createServerFn()` creates a server-only function that runs exclusively on the server, ensuring our `TMDB_AUTH_TOKEN` environment variable never gets exposed to the client. The server function makes an authenticated request to the TMDB API and returns the parsed JSON response.\n- The route loader runs on the server when a user visits /fetch-movies, calling our server function before the page renders\n- Error handling ensures the component always receives valid data structure - either the movies or an empty array with an error message\n- This pattern provides server-side rendering, automatic type safety, and secure API credential handling out of the box.\n\n## Step 4: Building the Movie Components\n\nNow let's create the components that will display our movie data. Add these components to the same `fetch-movies.tsx` file:\n\n```tsx\n// MovieCard component\nconst MovieCard = ({ movie }: { movie: Movie }) => {\n  return (\n    <div\n      class=\"bg-white/10 border border-white/20 rounded-lg overflow-hidden backdrop-blur-sm shadow-md hover:shadow-xl transition-all duration-300 hover:scale-105\"\n      aria-label={`Movie: ${movie.title}`}\n      role=\"group\"\n    >\n      {movie.poster_path && (\n        <img\n          src={`https://image.tmdb.org/t/p/w500${movie.poster_path}`}\n          alt={movie.title}\n          class=\"w-full h-64 object-cover\"\n        />\n      )}\n      <div class=\"p-4\">\n        <MovieDetails movie={movie} />\n      </div>\n    </div>\n  )\n}\n\n// MovieDetails component\nconst MovieDetails = ({ movie }: { movie: Movie }) => {\n  return (\n    <>\n      <h3 class=\"text-lg font-semibold mb-2 line-clamp-2\">{movie.title}</h3>\n      <p class=\"text-sm text-gray-300 mb-3 line-clamp-3 h-10\">\n        {movie.overview}\n      </p>\n      <div class=\"flex justify-between items-center text-xs text-gray-400\">\n        <span>{movie.release_date}</span>\n        <span class=\"flex items-center\">\n          ⭐️ {movie.vote_average.toFixed(1)}\n        </span>\n      </div>\n    </>\n  )\n}\n```\n\n## Step 5: Creating the MoviesPage Component\n\nFinally, let's create the main component that consumes the loader data:\n\n```tsx\n// MoviesPage component\nconst MoviesPage = () => {\n  const { movies, error } = Route.useLoaderData()\n\n  return (\n    <div\n      class=\"flex items-center justify-center min-h-screen p-4 text-white\"\n      style={{\n        backgroundColor: '#000',\n        backgroundImage:\n          'radial-gradient(ellipse 60% 60% at 0% 100%, #444 0%, #222 60%, #000 100%)',\n      }}\n      role=\"main\"\n      aria-label=\"Popular Movies Section\"\n    >\n      <div class=\"w-full max-w-6xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10\">\n        <h1 class=\"text-3xl mb-6 font-bold text-center\">Popular Movies</h1>\n\n        {error && (\n          <div\n            class=\"text-red-400 text-center mb-4 p-4 bg-red-900/20 rounded-lg\"\n            role=\"alert\"\n          >\n            {error}\n          </div>\n        )}\n\n        {movies.length > 0 ? (\n          <div\n            class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6\"\n            aria-label=\"Movie List\"\n          >\n            {movies.slice(0, 12).map((movie) => (\n              <MovieCard key={movie.id} movie={movie} />\n            ))}\n          </div>\n        ) : (\n          !error && (\n            <div class=\"text-center text-gray-400\" role=\"status\">\n              Loading movies...\n            </div>\n          )\n        )}\n      </div>\n    </div>\n  )\n}\n```\n\n### Understanding How It All Works Together\n\n```mermaid\nsequenceDiagram\n    autonumber\n    actor U as User\n    participant R as Router (TanStack Start)\n    participant L as Route Loader (/fetch-movies)\n    participant A as External API (TMDB)\n    participant V as MoviesPage (UI)\n\n    U->>R: Navigate to /fetch-movies\n    R->>L: Invoke loader (server-side)\n    L->>A: GET /movie/popular\\nAuthorization: Bearer <TOKEN>\n    A-->>L: JSON TMDBResponse\n    alt response.ok\n        L-->>R: { movies, error: null }\n        R->>V: Render SSR with movies\n        V-->>U: HTML with movie grid\n    else non-ok / error\n        L-->>R: { movies: [], error: \"Failed to load movies\" }\n        R->>V: Render SSR with error alert\n        V-->>U: HTML with error state\n    end\n\n    note over L,V: Loader validates response.ok,\\nreturns data or error for initial render\n```\n\nLet's break down how the different parts of our application work together:\n\n1. Route loader: When a user visits `/fetch-movies`, the loader function runs on the server\n2. API call: The loader calls `fetchPopularMovies()` which makes an HTTP request to TMDB\n3. Server-Side rendering: The data is fetched on the server reducing the load on the client side\n4. Component rendering: The `MoviesPage` component receives the data via `Route.useLoaderData()`\n5. Rendering UI: The movie cards are rendered with the fetched data\n\n## Step 6: Testing Your Application\n\nNow you can test your application by visiting [http://localhost:3000/fetch-movies](http://localhost:3000/fetch-movies). If everything is set up correctly, you should see a grid of popular movies with their posters, titles, and ratings. Your app should look like this:\n\n![Netflix style movie setup](https://res.cloudinary.com/dubc3wnbv/image/upload/v1756512946/Screenshot_2025-08-29_at_5.14.26_PM_iiex7o.png)\n\n## Conclusion\n\nYou've successfully built a movie discovery app that integrates with an external API using TanStack Start. This tutorial demonstrated how to use route loaders for server-side data fetching and building UI components with external data.\n\nWhile fetching data at build time in TanStack Start is perfect for static content like blog posts or product pages, it's not ideal for interactive apps. If you need features like real-time updates, caching, or infinite scrolling, you'll want to use [TanStack Query](/query/latest) on the client side instead. TanStack Query makes it easy to handle dynamic data with built-in caching, background updates, and smooth user interactions. By using TanStack Start for static content and TanStack Query for interactive features, you get fast loading pages plus all the modern functionality users expect.\n"
  },
  {
    "path": "docs/start/framework/solid/tutorial/reading-writing-file.md",
    "content": "---\nid: reading-and-writing-file\ntitle: Building a Full Stack DevJokes App with TanStack Start\n---\n\nThis tutorial will guide you through building a complete full-stack application using TanStack Start. You'll create a DevJokes app where users can view and add developer-themed jokes, demonstrating key concepts of TanStack Start including server functions, file-based data storage, and Solid components.\n\nHere's a demo of the app in action:\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/zd0rtKbtlgU?si=7W1Peoo0W0WvZmAd\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n\nThe complete code for this tutorial is available on [GitHub](https://github.com/shrutikapoor08/devjokes).\n\n## What You'll Learn\n\n1. Setting up a TanStack Start project\n2. Implementing server functions\n3. Reading and writing data to files\n4. Building a complete UI with Solid components\n5. Using TanStack Router for data fetching and navigation\n\n## Prerequisites\n\n- Basic knowledge of Solid and TypeScript.\n- Node.js and `pnpm` installed on your machine\n\n## Nice to know\n\n- [Server Side Rendering (SSR)](/router/latest/docs/framework/solid/guide/ssr)\n- [TanStack Router concepts](/router/latest/docs/framework/solid/routing/routing-concepts)\n- [Solid Query concepts](/query/latest/docs/framework/solid/overview)\n\n## Setting up a TanStack Start Project\n\nFirst, let's create a new TanStack Start project:\n\n```bash\npnpx @tanstack/cli@latest create --framework solid devjokes\ncd devjokes\n```\n\nWhen this script runs, it will ask you a few setup questions. You can either pick choices that work for you or just press enter to accept the defaults.\n\nOptionally, you can pass in a `--add-on` flag to get options such as Shadcn, Clerk, Convex, TanStack Query, etc.\n\nOnce setup is complete, install dependencies and start the development server:\n\n```bash\npnpm i\npnpm dev\n```\n\nFor this project, we'll need the `uuid` package:\n\n```bash\n# Install uuid for generating unique IDs\npnpm add uuid\n```\n\n## Understanding the project structure\n\nAt this point, the project structure should look like this -\n\n```\n/devjokes\n├── src/\n│   ├── routes/\n│   │   ├── demo/                         # Demo routes\n│   │   ├── __root.tsx                    # Root layout\n│   │   └── index.tsx                     # Home page\n│   ├── components/                       # Solid components\n│   ├── data/                             # Data files\n│   ├── router.tsx                        # Router configuration\n│   ├── routeTree.gen.ts                  # Generated route tree\n│   └── styles.css                        # Global styles\n├── public/                               # Static assets\n├── vite.config.ts                        # TanStack Start configuration\n├── package.json                          # Project dependencies\n└── tsconfig.json                         # TypeScript configuration\n```\n\nThis structure might seem overwhelming at first, but here are the key files you need to focus on:\n\n1. `src/router.tsx` - Sets up routing for your application\n2. `src/routes/__root.tsx` - The root layout component where you can add global styles and components\n3. `src/routes/index.tsx` - Your home page\n\nOnce your project is set up, you can access your app at `localhost:3000`. You should see the default TanStack Start welcome page.\n\nAt this point, your app will look like this:\n\n![TanStack Start Welcome Page After Setup](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-setup.png)\n\n## Step 1: Reading Data From a File\n\nLet's start by creating a file-based storage system for our jokes.\n\n### Step 1.1: Create a JSON File with Jokes\n\nLet's set up a list of jokes that we can use to render on the page. Create a `jokes.json` file within `src/data`:\n\n```bash\ntouch src/data/jokes.json\n```\n\nNow, let's add some sample jokes to this file:\n\n```json\n[\n  {\n    \"id\": \"1\",\n    \"question\": \"Why don't keyboards sleep?\",\n    \"answer\": \"Because they have two shifts\"\n  },\n  {\n    \"id\": \"2\",\n    \"question\": \"Are you a RESTful API?\",\n    \"answer\": \"Because you GET my attention, PUT some love, POST the cutest smile, and DELETE my bad day\"\n  },\n  {\n    \"id\": \"3\",\n    \"question\": \"I used to know a joke about Java\",\n    \"answer\": \"But I ran out of memory.\"\n  },\n  {\n    \"id\": \"4\",\n    \"question\": \"Why do Front-End Developers eat lunch alone?\",\n    \"answer\": \"Because, they don't know how to join tables.\"\n  },\n  {\n    \"id\": \"5\",\n    \"question\": \"I am declaring a war.\",\n    \"answer\": \"var war;\"\n  }\n]\n```\n\n### Step 1.2: Create Types for Our Data\n\nLet's create a file to define our data types. Create a new file at `src/types/index.ts`:\n\n```typescript\n// src/types/index.ts\nexport interface Joke {\n  id: string\n  question: string\n  answer: string\n}\n\nexport type JokesData = Joke[]\n```\n\n### Step 1.3: Create Server Functions to Read the File\n\nLet's create a new file `src/serverActions/jokesActions.ts` to create a server function to perform a read-write operation. We will be creating a server function using [`createServerFn`](https://tanstack.com/start/latest/docs/framework/solid/server-functions).\n\n```tsx\n// src/serverActions/jokesActions.ts\nimport { createServerFn } from '@tanstack/solid-start'\nimport * as fs from 'node:fs'\nimport type { JokesData } from '../types'\n\nconst JOKES_FILE = 'src/data/jokes.json'\n\nexport const getJokes = createServerFn({ method: 'GET' }).handler(async () => {\n  const jokes = await fs.promises.readFile(JOKES_FILE, 'utf-8')\n  return JSON.parse(jokes) as JokesData\n})\n```\n\nIn this code, we are using `createServerFn` to create a server function that reads the jokes from the JSON file. The `handler` function is where we are using the `fs` module to read the file.\n\n### Step 1.4: Consume Server Function on the Client Side\n\nNow to consume this server function, we can simply call it in our code using TanStack Router which already comes with TanStack Start!\n\nNow let's create a new component `JokesList` to render the jokes on the page with a little Tailwind styling sprinkle.\n\n```tsx\n// src/components/JokesList.tsx\nimport { Joke } from '../types'\n\ninterface JokesListProps {\n  jokes: Joke[]\n}\n\nexport function JokesList({ jokes }: JokesListProps) {\n  if (!jokes || jokes.length === 0) {\n    return <p class=\"text-gray-500 italic\">No jokes found. Add some!</p>\n  }\n\n  return (\n    <div class=\"space-y-4\">\n      <h2 class=\"text-xl font-semibold\">Jokes Collection</h2>\n      {jokes.map((joke) => (\n        <div\n          key={joke.id}\n          class=\"bg-white p-4 rounded-lg shadow-md border border-gray-200\"\n        >\n          <p class=\"font-bold text-lg mb-2\">{joke.question}</p>\n          <p class=\"text-gray-700\">{joke.answer}</p>\n        </div>\n      ))}\n    </div>\n  )\n}\n```\n\nNow let's call our server function inside `index.tsx` using TanStack Router which already comes with TanStack Start!\n\n```jsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { getJokes } from './serverActions/jokesActions'\nimport { JokesList } from './JokesList'\n\nexport const Route = createFileRoute('/')({\n  loader: async () => {\n    // Load jokes data when the route is accessed\n    return getJokes()\n  },\n  component: App,\n})\n\nconst App = () => {\n  const jokes = Route.useLoaderData() || []\n\n  return (\n    <div class=\"max-w-2xl mx-auto py-12 px-4 space-y-6\">\n      <h1 class=\"text-4xl font-bold text-center mb-10\">DevJokes</h1>\n      <JokesList jokes={jokes} />\n    </div>\n  )\n}\n```\n\nWhen the page loads, `jokes` will have data from the `jokes.json` file already!\n\nWith a little Tailwind styling, the app should look like this:\n\n![DevJoke App with 5 DevJokes](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-devjokes-1.png)\n\n## Step 2: Writing Data to a File\n\nSo far, we have been able to read from the file successfully! We can use the same approach to write to the `jokes.json` file using `createServerFunction`.\n\n### Step 2.1: Create Server Function to Write to the File\n\nIt's time to modify the `jokes.json` file so that we can add new jokes to it. Let's create another server function but this time with a `POST` method to write to the same file.\n\n```tsx\n// src/serverActions/jokesActions.ts\nimport { createServerFn } from '@tanstack/solid-start'\nimport * as fs from 'node:fs'\nimport { v4 as uuidv4 } from 'uuid' // Add this import\nimport type { Joke, JokesData } from '../types'\n\nconst JOKES_FILE = 'src/data/jokes.json'\n\nexport const getJokes = createServerFn({ method: 'GET' }).handler(async () => {\n  const jokes = await fs.promises.readFile(JOKES_FILE, 'utf-8')\n  return JSON.parse(jokes) as JokesData\n})\n\n// Add this new server function\nexport const addJoke = createServerFn({ method: 'POST' })\n  .inputValidator((data: { question: string; answer: string }) => {\n    // Validate input data\n    if (!data.question || !data.question.trim()) {\n      throw new Error('Joke question is required')\n    }\n    if (!data.answer || !data.answer.trim()) {\n      throw new Error('Joke answer is required')\n    }\n    return data\n  })\n  .handler(async ({ data }) => {\n    try {\n      // Read the existing jokes from the file\n      const jokesData = await getJokes()\n\n      // Create a new joke with a unique ID\n      const newJoke: Joke = {\n        id: uuidv4(),\n        question: data.question,\n        answer: data.answer,\n      }\n\n      // Add the new joke to the list\n      const updatedJokes = [...jokesData, newJoke]\n\n      // Write the updated jokes back to the file\n      await fs.promises.writeFile(\n        JOKES_FILE,\n        JSON.stringify(updatedJokes, null, 2),\n        'utf-8',\n      )\n\n      return newJoke\n    } catch (error) {\n      console.error('Failed to add joke:', error)\n      throw new Error('Failed to add joke')\n    }\n  })\n```\n\nIn this code:\n\n- We are using `createServerFn` to create server functions that run on the server but can be called from the client. This server function is used to write data to the file.\n- We are going to first use `inputValidator` to validate the input data. This is a good practice to ensure that the data we are receiving is in the correct format.\n- We are going to perform the actual write operation in the `handler` function.\n- `getJokes` reads the jokes from our JSON file.\n- `addJoke` validates the input data and adds a new joke to our file.\n- We're using `uuidv4()` to generate unique IDs for our jokes.\n\n### Step 2.2: Adding a Form to Add Jokes to our JSON File\n\nNow, let's modify our home page to display jokes and provide a form to add new ones. Let's create a new component called `JokeForm.jsx` and add the following form to it:\n\n```tsx\n// src/components/JokeForm.tsx\nimport { createSignal } from 'solid'\nimport { useRouter } from '@tanstack/solid-router'\nimport { addJoke } from '../serverActions/jokesActions'\n\nexport function JokeForm() {\n  const router = useRouter()\n  const [question, setQuestion] = createSignal('')\n  const [answer, setAnswer] = createSignal('')\n  const [isSubmitting, setIsSubmitting] = createSignal(false)\n  const [error, setError] = createSignal<string | null>(null)\n\n  return (\n    <form onSubmit={handleSubmit} class=\"mb-8\">\n      {error && (\n        <div class=\"bg-red-100 text-red-700 p-2 rounded mb-4\">{error}</div>\n      )}\n\n      <div class=\"flex flex-col sm:flex-row gap-4 mb-8\">\n        <input\n          id=\"question\"\n          type=\"text\"\n          placeholder=\"Enter joke question\"\n          class=\"w-full p-2 border rounded focus:ring focus:ring-blue-300 flex-1\"\n          value={question()}\n          onChange={(e) => setQuestion(e.target.value)}\n          required\n        />\n\n        <input\n          id=\"answer\"\n          type=\"text\"\n          placeholder=\"Enter joke answer\"\n          class=\"w-full p-2 border rounded focus:ring focus:ring-blue-300 flex-1 py-4\"\n          value={answer()}\n          onChange={(e) => setAnswer(e.target.value)}\n          required\n        />\n\n        <button\n          type=\"submit\"\n          disabled={isSubmitting()}\n          class=\"bg-blue-500 hover:bg-blue-600 text-white font-medium rounded disabled:opacity-50 px-4\"\n        >\n          {isSubmitting() ? 'Adding...' : 'Add Joke'}\n        </button>\n      </div>\n    </form>\n  )\n}\n```\n\n### Step 2.3: Wire Up the Form to the Server Function\n\nNow, let's wire the form up to our `addJoke` server function in the `handleSubmit` function. Calling a server action is simple! It's just a function call.\n\n```tsx\n//JokeForm.tsx\nimport { createSignal } from 'solid'\nimport { useRouter } from '@tanstack/solid-router'\nimport { addJoke } from '../serverActions/jokesActions'\n\nexport function JokeForm() {\n  const router = useRouter()\n  const [question, setQuestion] = createSignal('')\n  const [answer, setAnswer] = createSignal('')\n  const [isSubmitting, setIsSubmitting] = createSignal(false)\n  const [error, setError] = createSignal<string | null>(null)\n\n  const handleSubmit = async () => {\n    if (!question() || !answer() || isSubmitting()) return\n    try {\n      setIsSubmitting(true)\n      await addJoke({\n        data: { question(), answer() },\n      })\n\n      // Clear form\n      setQuestion('')\n      setAnswer('')\n\n      // Refresh data\n      router.invalidate()\n    } catch (error) {\n      console.error('Failed to add joke:', error)\n      setError('Failed to add joke')\n    } finally {\n      setIsSubmitting(false)\n    }\n  }\n\n  return (\n    <form onSubmit={handleSubmit} class=\"mb-8\">\n      {error && (\n        <div class=\"bg-red-100 text-red-700 p-2 rounded mb-4\">{error}</div>\n      )}\n      <div class=\"flex flex-col sm:flex-row gap-4 mb-8\">\n        <input\n          id=\"question\"\n          type=\"text\"\n          placeholder=\"Enter joke question\"\n          class=\"w-full p-2 border rounded focus:ring focus:ring-blue-300 flex-1\"\n          value={question()}\n          onChange={(e) => setQuestion(e.target.value)}\n          required\n        />\n        <input\n          id=\"answer\"\n          type=\"text\"\n          placeholder=\"Enter joke answer\"\n          class=\"w-full p-2 border rounded focus:ring focus:ring-blue-300 flex-1 py-4\"\n          value={answer()}\n          onChange={(e) => setAnswer(e.target.value)}\n          required\n        />\n        <button\n          type=\"submit\"\n          disabled={isSubmitting()}\n          class=\"bg-blue-500 hover:bg-blue-600 text-white font-medium rounded disabled:opacity-50 px-4\"\n        >\n          {isSubmitting() ? 'Adding...' : 'Add Joke'}\n        </button>\n      </div>\n    </form>\n  )\n}\n```\n\nWith this, our UI should look like this:\n![DevJoke App with Form to Add Jokes](https://raw.githubusercontent.com/TanStack/router/main/docs/router/assets/reading-writing-file-devjokes-2.png)\n\n## Understanding How It All Works Together\n\nLet's break down how the different parts of our application work together:\n\n1. **Server Functions**: These run on the server and handle data operations\n   - `getJokes`: Reads the jokes from our JSON file\n   - `addJoke`: Adds a new joke to our JSON file\n\n2. **TanStack Router**: Handles routing and data loading\n   - The loader function fetches jokes data when the route is accessed\n   - `useLoaderData` makes this data available in our component\n   - `router.invalidate()` refreshes the data when we add a new joke\n\n3. **Solid Components**: Build the UI of our application\n   - `JokesList`: Displays the list of jokes\n   - `JokeForm`: Provides a form for adding new jokes\n\n4. **File-Based Storage**: Stores our jokes in a JSON file\n   - Reading and writing are handled by Node.js `fs` module\n   - Data is persisted between server restarts\n\n## How Data Flows Through the Application\n\n### Data Flow\n\n```mermaid\nsequenceDiagram\nautonumber\nactor User\nparticipant UI as Browser (HomePage + Form)\nparticipant Loader as Route Loader (loader)\nparticipant Server\nparticipant Store as jokes.json\n\n%% Visiting the Home Page\nUser ->> UI: Visit /\nUI ->> Loader: loader() calls getJokes()\nLoader ->> Server: getJokes()\nServer ->> Store: Read jokes.json\nStore -->> Server: jokes data\nServer -->> Loader: jokes[]\nLoader -->> UI: useLoaderData() → jokes[]\n\n%% Adding a New Joke\nUser ->> UI: Fill form and submit\nUI ->> Server: handleSubmit → addJoke(newJoke)\nServer ->> Store: Read jokes.json\nServer ->> Store: Write updated jokes.json\nServer -->> UI: addJoke() resolved\nUI ->> Loader: router.invalidate() (re-run loader)\nLoader ->> Server: getJokes()\nServer ->> Store: Read jokes.json\nStore -->> Server: updated jokes[]\nServer -->> Loader: updated jokes[]\nLoader -->> UI: useLoaderData() → updated jokes[]\n```\n\nWhen a user visits the home page:\n\n1. The `loader` function in the route calls `getJokes()` server function\n2. The server reads `jokes.json` and returns the jokes data\n3. This data is passed to the `HomePage` component through `useLoaderData()`\n4. The `HomePage` component passes the data to the `JokesList` component\n\nWhen a user adds a new joke:\n\n1. They fill out the form and submit it\n2. The `handleSubmit` function calls the `addJoke()` server function\n3. The server reads the current jokes, adds the new joke, and writes the updated data back to `jokes.json`\n4. After the operation completes, we call `router.invalidate()` to refresh the data\n5. This triggers the loader again, fetching the updated jokes\n6. The UI updates to show the new joke in the list\n\nHere's a demo of the app in action:\n\n<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/zd0rtKbtlgU?si=7W1Peoo0W0WvZmAd\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n\n## Common Issues and Debugging\n\nHere are some common issues you might encounter when building your TanStack Start application and how to resolve them:\n\n### Server Functions Not Working\n\nIf your server functions aren't working as expected:\n\n1. Check that you're using the correct HTTP method (`GET`, `POST`, etc.)\n2. Ensure file paths are correct and accessible to the server\n3. Check the server console for error messages\n4. Make sure you're not using client-only APIs in server functions\n\n### Route Data Not Loading\n\nIf route data isn't loading properly:\n\n1. Verify that your loader function is properly implemented\n2. Check that you're using `useLoaderData()` correctly\n3. Look for errors in the browser console\n4. Make sure your server function is working correctly\n\n### Form Submission Issues\n\nIf form submissions aren't working:\n\n1. Check for validation errors in your server function\n2. Verify that form event prevention (`e.preventDefault()`) is working\n3. Make sure state updates are happening correctly\n4. Look for network errors in the browser's Developer Tools\n\n### File Reading/Writing Issues\n\nWhen working with file-based storage:\n\n1. Ensure file paths are correct\n2. Check file permissions\n3. Make sure you're handling async operations properly with `await`\n4. Add proper error handling for file operations\n\n## Conclusion\n\nCongratulations! You've built a full-stack DevJokes app using TanStack Start. In this tutorial, you've learned:\n\n- How to set up a TanStack Start project\n- How to implement server functions for data operations\n- How to read and write data to files\n- How to build Solid components for your UI\n- How to use TanStack Router for routing and data fetching\n\nThis simple application demonstrates the power of TanStack Start for building full-stack applications with a minimal amount of code. You can extend this app by adding features like:\n\n- Joke categories\n- Ability to edit and delete jokes\n- User authentication\n- Voting for favorite jokes\n\nThe complete code for this tutorial is available on [GitHub](https://github.com/shrutikapoor08/devjokes).\n"
  },
  {
    "path": "e2e/e2e-utils/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "e2e/e2e-utils/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-e2e-utils\",\n  \"private\": true,\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"build\": \"vite build\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:unit\": \"exit 0; vitest --typecheck\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/types/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/types/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/types/index.d.ts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {},\n  \"devDependencies\": {\n    \"get-port-please\": \"^3.2.0\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "e2e/e2e-utils/src/derivePort.ts",
    "content": "import fs from 'node:fs'\nimport { getRandomPort } from 'get-port-please'\n\n/**\n * Check if a port has been allocated, if it hasn't generate a random port and save it.\n * @param {string} input - port test allocation\n * @returns {number} A random port.\n */\nexport async function derivePort(input: string): Promise<number> {\n  const portFile = `port-${input}.txt`\n\n  if (!fs.existsSync(portFile)) {\n    fs.writeFileSync(portFile, (await getRandomPort()).toString())\n  }\n\n  const portNumber = parseInt(await fs.promises.readFile(portFile, 'utf-8'))\n  console.info(`Mapped \"${input}\" to port ${portNumber}`)\n  return portNumber\n}\n\nexport async function getDummyServerPort(input: string): Promise<number> {\n  return await derivePort(`${input}-external`)\n}\n\nexport async function getTestServerPort(input: string): Promise<number> {\n  return await derivePort(input)\n}\n"
  },
  {
    "path": "e2e/e2e-utils/src/e2eSetupTeardown.ts",
    "content": "import { localDummyServer } from './localDummyServer'\nimport { getDummyServerPort } from './derivePort'\n\nexport async function e2eStartDummyServer(input: string) {\n  const port = await getDummyServerPort(input)\n\n  return await localDummyServer(port)\n}\n\nexport async function e2eStopDummyServer(input: string) {\n  const port = await getDummyServerPort(input)\n\n  await fetch(`http://localhost:${port}/stop`, {\n    method: 'POST',\n  })\n}\n"
  },
  {
    "path": "e2e/e2e-utils/src/fixture.ts",
    "content": "import { test as base, expect } from '@playwright/test'\n\nexport interface TestFixtureOptions {\n  /**\n   * List of error message patterns to ignore in console output.\n   * Supports both strings (substring match) and RegExp patterns.\n   *\n   * @example\n   * test.use({\n   *   whitelistErrors: [\n   *     'Failed to load resource: net::ERR_NAME_NOT_RESOLVED',\n   *     /Failed to load resource/,\n   *   ],\n   * })\n   */\n  whitelistErrors: Array<RegExp | string>\n}\nexport const test = base.extend<TestFixtureOptions>({\n  whitelistErrors: [\n    // eslint-disable-next-line no-empty-pattern\n    async ({}, use) => {\n      await use([])\n    },\n    { option: true },\n  ],\n  page: async ({ page, whitelistErrors }, use) => {\n    const errorMessages: Array<string> = []\n    // Ensure whitelistErrors is always an array (defensive fallback)\n    const errors = Array.isArray(whitelistErrors) ? whitelistErrors : []\n    page.on('console', (m) => {\n      if (m.type() === 'error') {\n        const text = m.text()\n        for (const whitelistError of errors) {\n          if (\n            (typeof whitelistError === 'string' &&\n              text.includes(whitelistError)) ||\n            (whitelistError instanceof RegExp && whitelistError.test(text))\n          ) {\n            return\n          }\n        }\n        errorMessages.push(text)\n      }\n    })\n    await use(page)\n    expect(errorMessages).toEqual([])\n  },\n})\n"
  },
  {
    "path": "e2e/e2e-utils/src/index.ts",
    "content": "export { derivePort, getDummyServerPort, getTestServerPort } from './derivePort'\nexport { localDummyServer } from './localDummyServer'\nexport { toRuntimePath } from './to-runtime-path'\nexport { resolveRuntimeSuffix } from './resolve-runtime-suffix'\nexport { e2eStartDummyServer, e2eStopDummyServer } from './e2eSetupTeardown'\nexport type { Post } from './posts'\nexport { test } from './fixture'\n"
  },
  {
    "path": "e2e/e2e-utils/src/localDummyServer.ts",
    "content": "import http from 'node:http'\nimport { posts } from './posts'\nimport { users } from './users'\n\n// some tests redirect to an external host\n// however, in CI this is unstable due to network conditions\n// so here we spawn a local server to simulate the external host\n\nexport async function localDummyServer(port: number) {\n  const server = http.createServer((req, res) => {\n    // Set CORS headers\n    res.setHeader('Access-Control-Allow-Origin', '*')\n    res.setHeader('Access-Control-Request-Method', '*')\n    res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET, POST')\n    res.setHeader('Access-Control-Allow-Headers', '*')\n\n    if (req.method === 'OPTIONS') {\n      res.writeHead(200)\n      res.end()\n      return\n    }\n  })\n\n  server.on('request', (req, res) => {\n    const url = new URL(req.url!, 'http://localhost')\n\n    if (res.req.method === 'GET' && url.pathname === '/') {\n      res.writeHead(200, { 'Content-Type': 'text/html' })\n      res.end('Hello World')\n    }\n  })\n\n  server.on('request', (req, res) => {\n    const url = new URL(req.url!, `http://localhost`)\n\n    if (res.req.method === 'POST' && url.pathname === '/stop') {\n      server.close()\n      console.info(\n        `stopped local dummy server running at http://localhost:${port}`,\n      )\n\n      res.writeHead(200)\n      res.end()\n    }\n  })\n\n  server.on('request', (req, res) => {\n    const url = new URL(req.url ?? '/', `http://localhost`)\n\n    if (req.method === 'GET' && url.pathname.startsWith('/posts')) {\n      const parts = url.pathname.split('/')\n\n      if (parts.length === 2) {\n        res.writeHead(200, { 'content-type': 'application/json' })\n        res.end(JSON.stringify(posts))\n        return\n      }\n\n      if (parts[2]) {\n        const postId = parseInt(parts[2])\n\n        if (isNaN(postId)) {\n          res.writeHead(404)\n          res.end(JSON.stringify({ error: 'invalid post id' }))\n          return\n        }\n\n        const post = posts.find((post) => post.id === postId)\n\n        res.writeHead(200, { 'content-type': 'application/json' })\n        res.end(JSON.stringify(post))\n        return\n      }\n\n      res.writeHead(404)\n      res.end(JSON.stringify({ error: 'invalid posts path' }))\n      return\n    }\n  })\n\n  server.on('request', (req, res) => {\n    const url = new URL(req.url ?? '/', `http://localhost`)\n\n    if (req.method === 'GET' && url.pathname.startsWith('/users')) {\n      const parts = url.pathname.split('/')\n\n      if (parts.length === 2) {\n        res.writeHead(200, { 'content-type': 'application/json' })\n        res.end(JSON.stringify(users))\n        return\n      }\n\n      if (parts[2]) {\n        const userId = parseInt(parts[2])\n\n        if (isNaN(userId)) {\n          res.writeHead(404)\n          res.end(JSON.stringify({ error: 'invalid user id' }))\n          return\n        }\n\n        const user = users.find((user) => user.id === userId)\n\n        res.writeHead(200, { 'content-type': 'application/json' })\n        res.end(JSON.stringify(user))\n        return\n      }\n\n      res.writeHead(404)\n      res.end(JSON.stringify({ error: 'invalid users path' }))\n      return\n    }\n  })\n\n  const startServer = new Promise<void>((resolve) => {\n    server.listen(port, 'localhost', () => {\n      console.info(\n        `started local dummy server running at http://localhost:${port}`,\n      )\n      resolve()\n    })\n  })\n\n  await startServer\n\n  await new Promise((r) => setTimeout(r, 500))\n  return server\n}\n"
  },
  {
    "path": "e2e/e2e-utils/src/posts.ts",
    "content": "// dummy data from https://jsonplaceholder.typicode.com/posts\n\nexport type Post = {\n  userId: number\n  id: number\n  title: string\n  body: string\n}\n\nexport const posts: Array<Post> = [\n  {\n    userId: 1,\n    id: 1,\n    title:\n      'sunt aut facere repellat provident occaecati excepturi optio reprehenderit',\n    body: 'quia et suscipit\\nsuscipit recusandae consequuntur expedita et cum\\nreprehenderit molestiae ut ut quas totam\\nnostrum rerum est autem sunt rem eveniet architecto',\n  },\n  {\n    userId: 1,\n    id: 2,\n    title: 'qui est esse',\n    body: 'est rerum tempore vitae\\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\\nqui aperiam non debitis possimus qui neque nisi nulla',\n  },\n  {\n    userId: 1,\n    id: 3,\n    title: 'ea molestias quasi exercitationem repellat qui ipsa sit aut',\n    body: 'et iusto sed quo iure\\nvoluptatem occaecati omnis eligendi aut ad\\nvoluptatem doloribus vel accusantium quis pariatur\\nmolestiae porro eius odio et labore et velit aut',\n  },\n  {\n    userId: 1,\n    id: 4,\n    title: 'eum et est occaecati',\n    body: 'ullam et saepe reiciendis voluptatem adipisci\\nsit amet autem assumenda provident rerum culpa\\nquis hic commodi nesciunt rem tenetur doloremque ipsam iure\\nquis sunt voluptatem rerum illo velit',\n  },\n  {\n    userId: 1,\n    id: 5,\n    title: 'nesciunt quas odio',\n    body: 'repudiandae veniam quaerat sunt sed\\nalias aut fugiat sit autem sed est\\nvoluptatem omnis possimus esse voluptatibus quis\\nest aut tenetur dolor neque',\n  },\n  {\n    userId: 1,\n    id: 6,\n    title: 'dolorem eum magni eos aperiam quia',\n    body: 'ut aspernatur corporis harum nihil quis provident sequi\\nmollitia nobis aliquid molestiae\\nperspiciatis et ea nemo ab reprehenderit accusantium quas\\nvoluptate dolores velit et doloremque molestiae',\n  },\n  {\n    userId: 1,\n    id: 7,\n    title: 'magnam facilis autem',\n    body: 'dolore placeat quibusdam ea quo vitae\\nmagni quis enim qui quis quo nemo aut saepe\\nquidem repellat excepturi ut quia\\nsunt ut sequi eos ea sed quas',\n  },\n  {\n    userId: 1,\n    id: 8,\n    title: 'dolorem dolore est ipsam',\n    body: 'dignissimos aperiam dolorem qui eum\\nfacilis quibusdam animi sint suscipit qui sint possimus cum\\nquaerat magni maiores excepturi\\nipsam ut commodi dolor voluptatum modi aut vitae',\n  },\n  {\n    userId: 1,\n    id: 9,\n    title: 'nesciunt iure omnis dolorem tempora et accusantium',\n    body: 'consectetur animi nesciunt iure dolore\\nenim quia ad\\nveniam autem ut quam aut nobis\\net est aut quod aut provident voluptas autem voluptas',\n  },\n  {\n    userId: 1,\n    id: 10,\n    title: 'optio molestias id quia eum',\n    body: 'quo et expedita modi cum officia vel magni\\ndoloribus qui repudiandae\\nvero nisi sit\\nquos veniam quod sed accusamus veritatis error',\n  },\n  {\n    userId: 2,\n    id: 11,\n    title: 'et ea vero quia laudantium autem',\n    body: 'delectus reiciendis molestiae occaecati non minima eveniet qui voluptatibus\\naccusamus in eum beatae sit\\nvel qui neque voluptates ut commodi qui incidunt\\nut animi commodi',\n  },\n  {\n    userId: 2,\n    id: 12,\n    title: 'in quibusdam tempore odit est dolorem',\n    body: 'itaque id aut magnam\\npraesentium quia et ea odit et ea voluptas et\\nsapiente quia nihil amet occaecati quia id voluptatem\\nincidunt ea est distinctio odio',\n  },\n  {\n    userId: 2,\n    id: 13,\n    title: 'dolorum ut in voluptas mollitia et saepe quo animi',\n    body: 'aut dicta possimus sint mollitia voluptas commodi quo doloremque\\niste corrupti reiciendis voluptatem eius rerum\\nsit cumque quod eligendi laborum minima\\nperferendis recusandae assumenda consectetur porro architecto ipsum ipsam',\n  },\n  {\n    userId: 2,\n    id: 14,\n    title: 'voluptatem eligendi optio',\n    body: 'fuga et accusamus dolorum perferendis illo voluptas\\nnon doloremque neque facere\\nad qui dolorum molestiae beatae\\nsed aut voluptas totam sit illum',\n  },\n  {\n    userId: 2,\n    id: 15,\n    title: 'eveniet quod temporibus',\n    body: 'reprehenderit quos placeat\\nvelit minima officia dolores impedit repudiandae molestiae nam\\nvoluptas recusandae quis delectus\\nofficiis harum fugiat vitae',\n  },\n  {\n    userId: 2,\n    id: 16,\n    title:\n      'sint suscipit perspiciatis velit dolorum rerum ipsa laboriosam odio',\n    body: 'suscipit nam nisi quo aperiam aut\\nasperiores eos fugit maiores voluptatibus quia\\nvoluptatem quis ullam qui in alias quia est\\nconsequatur magni mollitia accusamus ea nisi voluptate dicta',\n  },\n  {\n    userId: 2,\n    id: 17,\n    title: 'fugit voluptas sed molestias voluptatem provident',\n    body: 'eos voluptas et aut odit natus earum\\naspernatur fuga molestiae ullam\\ndeserunt ratione qui eos\\nqui nihil ratione nemo velit ut aut id quo',\n  },\n  {\n    userId: 2,\n    id: 18,\n    title: 'voluptate et itaque vero tempora molestiae',\n    body: 'eveniet quo quis\\nlaborum totam consequatur non dolor\\nut et est repudiandae\\nest voluptatem vel debitis et magnam',\n  },\n  {\n    userId: 2,\n    id: 19,\n    title: 'adipisci placeat illum aut reiciendis qui',\n    body: 'illum quis cupiditate provident sit magnam\\nea sed aut omnis\\nveniam maiores ullam consequatur atque\\nadipisci quo iste expedita sit quos voluptas',\n  },\n  {\n    userId: 2,\n    id: 20,\n    title: 'doloribus ad provident suscipit at',\n    body: 'qui consequuntur ducimus possimus quisquam amet similique\\nsuscipit porro ipsam amet\\neos veritatis officiis exercitationem vel fugit aut necessitatibus totam\\nomnis rerum consequatur expedita quidem cumque explicabo',\n  },\n  {\n    userId: 3,\n    id: 21,\n    title: 'asperiores ea ipsam voluptatibus modi minima quia sint',\n    body: 'repellat aliquid praesentium dolorem quo\\nsed totam minus non itaque\\nnihil labore molestiae sunt dolor eveniet hic recusandae veniam\\ntempora et tenetur expedita sunt',\n  },\n  {\n    userId: 3,\n    id: 22,\n    title: 'dolor sint quo a velit explicabo quia nam',\n    body: 'eos qui et ipsum ipsam suscipit aut\\nsed omnis non odio\\nexpedita earum mollitia molestiae aut atque rem suscipit\\nnam impedit esse',\n  },\n  {\n    userId: 3,\n    id: 23,\n    title: 'maxime id vitae nihil numquam',\n    body: 'veritatis unde neque eligendi\\nquae quod architecto quo neque vitae\\nest illo sit tempora doloremque fugit quod\\net et vel beatae sequi ullam sed tenetur perspiciatis',\n  },\n  {\n    userId: 3,\n    id: 24,\n    title: 'autem hic labore sunt dolores incidunt',\n    body: 'enim et ex nulla\\nomnis voluptas quia qui\\nvoluptatem consequatur numquam aliquam sunt\\ntotam recusandae id dignissimos aut sed asperiores deserunt',\n  },\n  {\n    userId: 3,\n    id: 25,\n    title: 'rem alias distinctio quo quis',\n    body: 'ullam consequatur ut\\nomnis quis sit vel consequuntur\\nipsa eligendi ipsum molestiae et omnis error nostrum\\nmolestiae illo tempore quia et distinctio',\n  },\n  {\n    userId: 3,\n    id: 26,\n    title: 'est et quae odit qui non',\n    body: 'similique esse doloribus nihil accusamus\\nomnis dolorem fuga consequuntur reprehenderit fugit recusandae temporibus\\nperspiciatis cum ut laudantium\\nomnis aut molestiae vel vero',\n  },\n  {\n    userId: 3,\n    id: 27,\n    title: 'quasi id et eos tenetur aut quo autem',\n    body: 'eum sed dolores ipsam sint possimus debitis occaecati\\ndebitis qui qui et\\nut placeat enim earum aut odit facilis\\nconsequatur suscipit necessitatibus rerum sed inventore temporibus consequatur',\n  },\n  {\n    userId: 3,\n    id: 28,\n    title: 'delectus ullam et corporis nulla voluptas sequi',\n    body: 'non et quaerat ex quae ad maiores\\nmaiores recusandae totam aut blanditiis mollitia quas illo\\nut voluptatibus voluptatem\\nsimilique nostrum eum',\n  },\n  {\n    userId: 3,\n    id: 29,\n    title: 'iusto eius quod necessitatibus culpa ea',\n    body: 'odit magnam ut saepe sed non qui\\ntempora atque nihil\\naccusamus illum doloribus illo dolor\\neligendi repudiandae odit magni similique sed cum maiores',\n  },\n  {\n    userId: 3,\n    id: 30,\n    title: 'a quo magni similique perferendis',\n    body: 'alias dolor cumque\\nimpedit blanditiis non eveniet odio maxime\\nblanditiis amet eius quis tempora quia autem rem\\na provident perspiciatis quia',\n  },\n  {\n    userId: 4,\n    id: 31,\n    title: 'ullam ut quidem id aut vel consequuntur',\n    body: 'debitis eius sed quibusdam non quis consectetur vitae\\nimpedit ut qui consequatur sed aut in\\nquidem sit nostrum et maiores adipisci atque\\nquaerat voluptatem adipisci repudiandae',\n  },\n  {\n    userId: 4,\n    id: 32,\n    title: 'doloremque illum aliquid sunt',\n    body: 'deserunt eos nobis asperiores et hic\\nest debitis repellat molestiae optio\\nnihil ratione ut eos beatae quibusdam distinctio maiores\\nearum voluptates et aut adipisci ea maiores voluptas maxime',\n  },\n  {\n    userId: 4,\n    id: 33,\n    title: 'qui explicabo molestiae dolorem',\n    body: 'rerum ut et numquam laborum odit est sit\\nid qui sint in\\nquasi tenetur tempore aperiam et quaerat qui in\\nrerum officiis sequi cumque quod',\n  },\n  {\n    userId: 4,\n    id: 34,\n    title: 'magnam ut rerum iure',\n    body: 'ea velit perferendis earum ut voluptatem voluptate itaque iusto\\ntotam pariatur in\\nnemo voluptatem voluptatem autem magni tempora minima in\\nest distinctio qui assumenda accusamus dignissimos officia nesciunt nobis',\n  },\n  {\n    userId: 4,\n    id: 35,\n    title: 'id nihil consequatur molestias animi provident',\n    body: 'nisi error delectus possimus ut eligendi vitae\\nplaceat eos harum cupiditate facilis reprehenderit voluptatem beatae\\nmodi ducimus quo illum voluptas eligendi\\net nobis quia fugit',\n  },\n  {\n    userId: 4,\n    id: 36,\n    title: 'fuga nam accusamus voluptas reiciendis itaque',\n    body: 'ad mollitia et omnis minus architecto odit\\nvoluptas doloremque maxime aut non ipsa qui alias veniam\\nblanditiis culpa aut quia nihil cumque facere et occaecati\\nqui aspernatur quia eaque ut aperiam inventore',\n  },\n  {\n    userId: 4,\n    id: 37,\n    title: 'provident vel ut sit ratione est',\n    body: 'debitis et eaque non officia sed nesciunt pariatur vel\\nvoluptatem iste vero et ea\\nnumquam aut expedita ipsum nulla in\\nvoluptates omnis consequatur aut enim officiis in quam qui',\n  },\n  {\n    userId: 4,\n    id: 38,\n    title: 'explicabo et eos deleniti nostrum ab id repellendus',\n    body: 'animi esse sit aut sit nesciunt assumenda eum voluptas\\nquia voluptatibus provident quia necessitatibus ea\\nrerum repudiandae quia voluptatem delectus fugit aut id quia\\nratione optio eos iusto veniam iure',\n  },\n  {\n    userId: 4,\n    id: 39,\n    title: 'eos dolorem iste accusantium est eaque quam',\n    body: 'corporis rerum ducimus vel eum accusantium\\nmaxime aspernatur a porro possimus iste omnis\\nest in deleniti asperiores fuga aut\\nvoluptas sapiente vel dolore minus voluptatem incidunt ex',\n  },\n  {\n    userId: 4,\n    id: 40,\n    title: 'enim quo cumque',\n    body: 'ut voluptatum aliquid illo tenetur nemo sequi quo facilis\\nipsum rem optio mollitia quas\\nvoluptatem eum voluptas qui\\nunde omnis voluptatem iure quasi maxime voluptas nam',\n  },\n  {\n    userId: 5,\n    id: 41,\n    title: 'non est facere',\n    body: 'molestias id nostrum\\nexcepturi molestiae dolore omnis repellendus quaerat saepe\\nconsectetur iste quaerat tenetur asperiores accusamus ex ut\\nnam quidem est ducimus sunt debitis saepe',\n  },\n  {\n    userId: 5,\n    id: 42,\n    title:\n      'commodi ullam sint et excepturi error explicabo praesentium voluptas',\n    body: 'odio fugit voluptatum ducimus earum autem est incidunt voluptatem\\nodit reiciendis aliquam sunt sequi nulla dolorem\\nnon facere repellendus voluptates quia\\nratione harum vitae ut',\n  },\n  {\n    userId: 5,\n    id: 43,\n    title:\n      'eligendi iste nostrum consequuntur adipisci praesentium sit beatae perferendis',\n    body: 'similique fugit est\\nillum et dolorum harum et voluptate eaque quidem\\nexercitationem quos nam commodi possimus cum odio nihil nulla\\ndolorum exercitationem magnam ex et a et distinctio debitis',\n  },\n  {\n    userId: 5,\n    id: 44,\n    title: 'optio dolor molestias sit',\n    body: 'temporibus est consectetur dolore\\net libero debitis vel velit laboriosam quia\\nipsum quibusdam qui itaque fuga rem aut\\nea et iure quam sed maxime ut distinctio quae',\n  },\n  {\n    userId: 5,\n    id: 45,\n    title: 'ut numquam possimus omnis eius suscipit laudantium iure',\n    body: 'est natus reiciendis nihil possimus aut provident\\nex et dolor\\nrepellat pariatur est\\nnobis rerum repellendus dolorem autem',\n  },\n  {\n    userId: 5,\n    id: 46,\n    title: 'aut quo modi neque nostrum ducimus',\n    body: 'voluptatem quisquam iste\\nvoluptatibus natus officiis facilis dolorem\\nquis quas ipsam\\nvel et voluptatum in aliquid',\n  },\n  {\n    userId: 5,\n    id: 47,\n    title: 'quibusdam cumque rem aut deserunt',\n    body: 'voluptatem assumenda ut qui ut cupiditate aut impedit veniam\\noccaecati nemo illum voluptatem laudantium\\nmolestiae beatae rerum ea iure soluta nostrum\\neligendi et voluptate',\n  },\n  {\n    userId: 5,\n    id: 48,\n    title: 'ut voluptatem illum ea doloribus itaque eos',\n    body: 'voluptates quo voluptatem facilis iure occaecati\\nvel assumenda rerum officia et\\nillum perspiciatis ab deleniti\\nlaudantium repellat ad ut et autem reprehenderit',\n  },\n  {\n    userId: 5,\n    id: 49,\n    title: 'laborum non sunt aut ut assumenda perspiciatis voluptas',\n    body: 'inventore ab sint\\nnatus fugit id nulla sequi architecto nihil quaerat\\neos tenetur in in eum veritatis non\\nquibusdam officiis aspernatur cumque aut commodi aut',\n  },\n  {\n    userId: 5,\n    id: 50,\n    title:\n      'repellendus qui recusandae incidunt voluptates tenetur qui omnis exercitationem',\n    body: 'error suscipit maxime adipisci consequuntur recusandae\\nvoluptas eligendi et est et voluptates\\nquia distinctio ab amet quaerat molestiae et vitae\\nadipisci impedit sequi nesciunt quis consectetur',\n  },\n  {\n    userId: 6,\n    id: 51,\n    title: 'soluta aliquam aperiam consequatur illo quis voluptas',\n    body: 'sunt dolores aut doloribus\\ndolore doloribus voluptates tempora et\\ndoloremque et quo\\ncum asperiores sit consectetur dolorem',\n  },\n  {\n    userId: 6,\n    id: 52,\n    title: 'qui enim et consequuntur quia animi quis voluptate quibusdam',\n    body: 'iusto est quibusdam fuga quas quaerat molestias\\na enim ut sit accusamus enim\\ntemporibus iusto accusantium provident architecto\\nsoluta esse reprehenderit qui laborum',\n  },\n  {\n    userId: 6,\n    id: 53,\n    title: 'ut quo aut ducimus alias',\n    body: 'minima harum praesentium eum rerum illo dolore\\nquasi exercitationem rerum nam\\nporro quis neque quo\\nconsequatur minus dolor quidem veritatis sunt non explicabo similique',\n  },\n  {\n    userId: 6,\n    id: 54,\n    title: 'sit asperiores ipsam eveniet odio non quia',\n    body: 'totam corporis dignissimos\\nvitae dolorem ut occaecati accusamus\\nex velit deserunt\\net exercitationem vero incidunt corrupti mollitia',\n  },\n  {\n    userId: 6,\n    id: 55,\n    title: 'sit vel voluptatem et non libero',\n    body: 'debitis excepturi ea perferendis harum libero optio\\neos accusamus cum fuga ut sapiente repudiandae\\net ut incidunt omnis molestiae\\nnihil ut eum odit',\n  },\n  {\n    userId: 6,\n    id: 56,\n    title: 'qui et at rerum necessitatibus',\n    body: 'aut est omnis dolores\\nneque rerum quod ea rerum velit pariatur beatae excepturi\\net provident voluptas corrupti\\ncorporis harum reprehenderit dolores eligendi',\n  },\n  {\n    userId: 6,\n    id: 57,\n    title: 'sed ab est est',\n    body: 'at pariatur consequuntur earum quidem\\nquo est laudantium soluta voluptatem\\nqui ullam et est\\net cum voluptas voluptatum repellat est',\n  },\n  {\n    userId: 6,\n    id: 58,\n    title: 'voluptatum itaque dolores nisi et quasi',\n    body: 'veniam voluptatum quae adipisci id\\net id quia eos ad et dolorem\\naliquam quo nisi sunt eos impedit error\\nad similique veniam',\n  },\n  {\n    userId: 6,\n    id: 59,\n    title: 'qui commodi dolor at maiores et quis id accusantium',\n    body: 'perspiciatis et quam ea autem temporibus non voluptatibus qui\\nbeatae a earum officia nesciunt dolores suscipit voluptas et\\nanimi doloribus cum rerum quas et magni\\net hic ut ut commodi expedita sunt',\n  },\n  {\n    userId: 6,\n    id: 60,\n    title:\n      'consequatur placeat omnis quisquam quia reprehenderit fugit veritatis facere',\n    body: 'asperiores sunt ab assumenda cumque modi velit\\nqui esse omnis\\nvoluptate et fuga perferendis voluptas\\nillo ratione amet aut et omnis',\n  },\n  {\n    userId: 7,\n    id: 61,\n    title: 'voluptatem doloribus consectetur est ut ducimus',\n    body: 'ab nemo optio odio\\ndelectus tenetur corporis similique nobis repellendus rerum omnis facilis\\nvero blanditiis debitis in nesciunt doloribus dicta dolores\\nmagnam minus velit',\n  },\n  {\n    userId: 7,\n    id: 62,\n    title: 'beatae enim quia vel',\n    body: 'enim aspernatur illo distinctio quae praesentium\\nbeatae alias amet delectus qui voluptate distinctio\\nodit sint accusantium autem omnis\\nquo molestiae omnis ea eveniet optio',\n  },\n  {\n    userId: 7,\n    id: 63,\n    title:\n      'voluptas blanditiis repellendus animi ducimus error sapiente et suscipit',\n    body: 'enim adipisci aspernatur nemo\\nnumquam omnis facere dolorem dolor ex quis temporibus incidunt\\nab delectus culpa quo reprehenderit blanditiis asperiores\\naccusantium ut quam in voluptatibus voluptas ipsam dicta',\n  },\n  {\n    userId: 7,\n    id: 64,\n    title: 'et fugit quas eum in in aperiam quod',\n    body: 'id velit blanditiis\\neum ea voluptatem\\nmolestiae sint occaecati est eos perspiciatis\\nincidunt a error provident eaque aut aut qui',\n  },\n  {\n    userId: 7,\n    id: 65,\n    title: 'consequatur id enim sunt et et',\n    body: 'voluptatibus ex esse\\nsint explicabo est aliquid cumque adipisci fuga repellat labore\\nmolestiae corrupti ex saepe at asperiores et perferendis\\nnatus id esse incidunt pariatur',\n  },\n  {\n    userId: 7,\n    id: 66,\n    title: 'repudiandae ea animi iusto',\n    body: 'officia veritatis tenetur vero qui itaque\\nsint non ratione\\nsed et ut asperiores iusto eos molestiae nostrum\\nveritatis quibusdam et nemo iusto saepe',\n  },\n  {\n    userId: 7,\n    id: 67,\n    title: 'aliquid eos sed fuga est maxime repellendus',\n    body: 'reprehenderit id nostrum\\nvoluptas doloremque pariatur sint et accusantium quia quod aspernatur\\net fugiat amet\\nnon sapiente et consequatur necessitatibus molestiae',\n  },\n  {\n    userId: 7,\n    id: 68,\n    title: 'odio quis facere architecto reiciendis optio',\n    body: 'magnam molestiae perferendis quisquam\\nqui cum reiciendis\\nquaerat animi amet hic inventore\\nea quia deleniti quidem saepe porro velit',\n  },\n  {\n    userId: 7,\n    id: 69,\n    title: 'fugiat quod pariatur odit minima',\n    body: 'officiis error culpa consequatur modi asperiores et\\ndolorum assumenda voluptas et vel qui aut vel rerum\\nvoluptatum quisquam perspiciatis quia rerum consequatur totam quas\\nsequi commodi repudiandae asperiores et saepe a',\n  },\n  {\n    userId: 7,\n    id: 70,\n    title: 'voluptatem laborum magni',\n    body: 'sunt repellendus quae\\nest asperiores aut deleniti esse accusamus repellendus quia aut\\nquia dolorem unde\\neum tempora esse dolore',\n  },\n  {\n    userId: 8,\n    id: 71,\n    title: 'et iusto veniam et illum aut fuga',\n    body: 'occaecati a doloribus\\niste saepe consectetur placeat eum voluptate dolorem et\\nqui quo quia voluptas\\nrerum ut id enim velit est perferendis',\n  },\n  {\n    userId: 8,\n    id: 72,\n    title: 'sint hic doloribus consequatur eos non id',\n    body: 'quam occaecati qui deleniti consectetur\\nconsequatur aut facere quas exercitationem aliquam hic voluptas\\nneque id sunt ut aut accusamus\\nsunt consectetur expedita inventore velit',\n  },\n  {\n    userId: 8,\n    id: 73,\n    title: 'consequuntur deleniti eos quia temporibus ab aliquid at',\n    body: 'voluptatem cumque tenetur consequatur expedita ipsum nemo quia explicabo\\naut eum minima consequatur\\ntempore cumque quae est et\\net in consequuntur voluptatem voluptates aut',\n  },\n  {\n    userId: 8,\n    id: 74,\n    title: 'enim unde ratione doloribus quas enim ut sit sapiente',\n    body: 'odit qui et et necessitatibus sint veniam\\nmollitia amet doloremque molestiae commodi similique magnam et quam\\nblanditiis est itaque\\nquo et tenetur ratione occaecati molestiae tempora',\n  },\n  {\n    userId: 8,\n    id: 75,\n    title: 'dignissimos eum dolor ut enim et delectus in',\n    body: 'commodi non non omnis et voluptas sit\\nautem aut nobis magnam et sapiente voluptatem\\net laborum repellat qui delectus facilis temporibus\\nrerum amet et nemo voluptate expedita adipisci error dolorem',\n  },\n  {\n    userId: 8,\n    id: 76,\n    title: 'doloremque officiis ad et non perferendis',\n    body: 'ut animi facere\\ntotam iusto tempore\\nmolestiae eum aut et dolorem aperiam\\nquaerat recusandae totam odio',\n  },\n  {\n    userId: 8,\n    id: 77,\n    title: 'necessitatibus quasi exercitationem odio',\n    body: 'modi ut in nulla repudiandae dolorum nostrum eos\\naut consequatur omnis\\nut incidunt est omnis iste et quam\\nvoluptates sapiente aliquam asperiores nobis amet corrupti repudiandae provident',\n  },\n  {\n    userId: 8,\n    id: 78,\n    title: 'quam voluptatibus rerum veritatis',\n    body: 'nobis facilis odit tempore cupiditate quia\\nassumenda doloribus rerum qui ea\\nillum et qui totam\\naut veniam repellendus',\n  },\n  {\n    userId: 8,\n    id: 79,\n    title: 'pariatur consequatur quia magnam autem omnis non amet',\n    body: 'libero accusantium et et facere incidunt sit dolorem\\nnon excepturi qui quia sed laudantium\\nquisquam molestiae ducimus est\\nofficiis esse molestiae iste et quos',\n  },\n  {\n    userId: 8,\n    id: 80,\n    title: 'labore in ex et explicabo corporis aut quas',\n    body: 'ex quod dolorem ea eum iure qui provident amet\\nquia qui facere excepturi et repudiandae\\nasperiores molestias provident\\nminus incidunt vero fugit rerum sint sunt excepturi provident',\n  },\n  {\n    userId: 9,\n    id: 81,\n    title: 'tempora rem veritatis voluptas quo dolores vero',\n    body: 'facere qui nesciunt est voluptatum voluptatem nisi\\nsequi eligendi necessitatibus ea at rerum itaque\\nharum non ratione velit laboriosam quis consequuntur\\nex officiis minima doloremque voluptas ut aut',\n  },\n  {\n    userId: 9,\n    id: 82,\n    title: 'laudantium voluptate suscipit sunt enim enim',\n    body: 'ut libero sit aut totam inventore sunt\\nporro sint qui sunt molestiae\\nconsequatur cupiditate qui iste ducimus adipisci\\ndolor enim assumenda soluta laboriosam amet iste delectus hic',\n  },\n  {\n    userId: 9,\n    id: 83,\n    title: 'odit et voluptates doloribus alias odio et',\n    body: 'est molestiae facilis quis tempora numquam nihil qui\\nvoluptate sapiente consequatur est qui\\nnecessitatibus autem aut ipsa aperiam modi dolore numquam\\nreprehenderit eius rem quibusdam',\n  },\n  {\n    userId: 9,\n    id: 84,\n    title:\n      'optio ipsam molestias necessitatibus occaecati facilis veritatis dolores aut',\n    body: 'sint molestiae magni a et quos\\neaque et quasi\\nut rerum debitis similique veniam\\nrecusandae dignissimos dolor incidunt consequatur odio',\n  },\n  {\n    userId: 9,\n    id: 85,\n    title: 'dolore veritatis porro provident adipisci blanditiis et sunt',\n    body: 'similique sed nisi voluptas iusto omnis\\nmollitia et quo\\nassumenda suscipit officia magnam sint sed tempora\\nenim provident pariatur praesentium atque animi amet ratione',\n  },\n  {\n    userId: 9,\n    id: 86,\n    title: 'placeat quia et porro iste',\n    body: 'quasi excepturi consequatur iste autem temporibus sed molestiae beatae\\net quaerat et esse ut\\nvoluptatem occaecati et vel explicabo autem\\nasperiores pariatur deserunt optio',\n  },\n  {\n    userId: 9,\n    id: 87,\n    title: 'nostrum quis quasi placeat',\n    body: 'eos et molestiae\\nnesciunt ut a\\ndolores perspiciatis repellendus repellat aliquid\\nmagnam sint rem ipsum est',\n  },\n  {\n    userId: 9,\n    id: 88,\n    title: 'sapiente omnis fugit eos',\n    body: 'consequatur omnis est praesentium\\nducimus non iste\\nneque hic deserunt\\nvoluptatibus veniam cum et rerum sed',\n  },\n  {\n    userId: 9,\n    id: 89,\n    title: 'sint soluta et vel magnam aut ut sed qui',\n    body: 'repellat aut aperiam totam temporibus autem et\\narchitecto magnam ut\\nconsequatur qui cupiditate rerum quia soluta dignissimos nihil iure\\ntempore quas est',\n  },\n  {\n    userId: 9,\n    id: 90,\n    title: 'ad iusto omnis odit dolor voluptatibus',\n    body: 'minus omnis soluta quia\\nqui sed adipisci voluptates illum ipsam voluptatem\\neligendi officia ut in\\neos soluta similique molestias praesentium blanditiis',\n  },\n  {\n    userId: 10,\n    id: 91,\n    title: 'aut amet sed',\n    body: 'libero voluptate eveniet aperiam sed\\nsunt placeat suscipit molestias\\nsimilique fugit nam natus\\nexpedita consequatur consequatur dolores quia eos et placeat',\n  },\n  {\n    userId: 10,\n    id: 92,\n    title: 'ratione ex tenetur perferendis',\n    body: 'aut et excepturi dicta laudantium sint rerum nihil\\nlaudantium et at\\na neque minima officia et similique libero et\\ncommodi voluptate qui',\n  },\n  {\n    userId: 10,\n    id: 93,\n    title: 'beatae soluta recusandae',\n    body: 'dolorem quibusdam ducimus consequuntur dicta aut quo laboriosam\\nvoluptatem quis enim recusandae ut sed sunt\\nnostrum est odit totam\\nsit error sed sunt eveniet provident qui nulla',\n  },\n  {\n    userId: 10,\n    id: 94,\n    title: 'qui qui voluptates illo iste minima',\n    body: 'aspernatur expedita soluta quo ab ut similique\\nexpedita dolores amet\\nsed temporibus distinctio magnam saepe deleniti\\nomnis facilis nam ipsum natus sint similique omnis',\n  },\n  {\n    userId: 10,\n    id: 95,\n    title: 'id minus libero illum nam ad officiis',\n    body: 'earum voluptatem facere provident blanditiis velit laboriosam\\npariatur accusamus odio saepe\\ncumque dolor qui a dicta ab doloribus consequatur omnis\\ncorporis cupiditate eaque assumenda ad nesciunt',\n  },\n  {\n    userId: 10,\n    id: 96,\n    title: 'quaerat velit veniam amet cupiditate aut numquam ut sequi',\n    body: 'in non odio excepturi sint eum\\nlabore voluptates vitae quia qui et\\ninventore itaque rerum\\nveniam non exercitationem delectus aut',\n  },\n  {\n    userId: 10,\n    id: 97,\n    title: 'quas fugiat ut perspiciatis vero provident',\n    body: 'eum non blanditiis soluta porro quibusdam voluptas\\nvel voluptatem qui placeat dolores qui velit aut\\nvel inventore aut cumque culpa explicabo aliquid at\\nperspiciatis est et voluptatem dignissimos dolor itaque sit nam',\n  },\n  {\n    userId: 10,\n    id: 98,\n    title: 'laboriosam dolor voluptates',\n    body: 'doloremque ex facilis sit sint culpa\\nsoluta assumenda eligendi non ut eius\\nsequi ducimus vel quasi\\nveritatis est dolores',\n  },\n  {\n    userId: 10,\n    id: 99,\n    title: 'temporibus sit alias delectus eligendi possimus magni',\n    body: 'quo deleniti praesentium dicta non quod\\naut est molestias\\nmolestias et officia quis nihil\\nitaque dolorem quia',\n  },\n  {\n    userId: 10,\n    id: 100,\n    title: 'at nam consequatur ea labore ea harum',\n    body: 'cupiditate quo est a modi nesciunt soluta\\nipsa voluptas error itaque dicta in\\nautem qui minus magnam et distinctio eum\\naccusamus ratione error aut',\n  },\n]\n"
  },
  {
    "path": "e2e/e2e-utils/src/resolve-runtime-suffix.ts",
    "content": "/**\n * Resolves the runtime suffix based on the provided input or the environment variable `VITE_APP_HISTORY`.\n *\n * @param {string} [input] - Optional input to override the environment variable.\n * @returns {string} Returns 'hash' if the input or `VITE_APP_HISTORY` is set to 'hash', otherwise returns 'browser'.\n */\nexport function resolveRuntimeSuffix(input?: string): string {\n  const value =\n    input === 'hash' || process.env.VITE_APP_HISTORY === 'hash'\n      ? 'hash'\n      : 'browser'\n  return value\n}\n"
  },
  {
    "path": "e2e/e2e-utils/src/to-runtime-path.ts",
    "content": "/**\n * Converts the given input string to a valid runtime path based on the environment configuration.\n * If the environment variable `VITE_APP_HISTORY` is set to 'hash', the input will be prefixed with `/#`.\n * Otherwise, the input will be returned as is.\n *\n * @param {string} input - The input string to be converted.\n * @returns {string} - The converted test URL value.\n * @example\n * toRuntimePath('/normal-page') // '/normal-page'\n * // or\n * process.env.VITE_APP_HISTORY = 'hash'\n * toRuntimePath('/normal-page') // '/#/normal-page'\n */\nexport function toRuntimePath(input: string) {\n  const value = process.env.VITE_APP_HISTORY === 'hash' ? `/#${input}` : input\n  return value\n}\n"
  },
  {
    "path": "e2e/e2e-utils/src/users.ts",
    "content": "// dummy data from https://jsonplaceholder.typicode.com/users\n\nexport type User = {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: {\n    street: string\n    suite: string\n    city: string\n    zipcode: string\n    geo: {\n      lat: string\n      lng: string\n    }\n  }\n  phone: string\n  website: string\n  company: {\n    name: string\n    catchPhrase: string\n    bs: string\n  }\n}\n\nexport const users: Array<User> = [\n  {\n    id: 1,\n    name: 'Leanne Graham',\n    username: 'Bret',\n    email: 'Sincere@april.biz',\n    address: {\n      street: 'Kulas Light',\n      suite: 'Apt. 556',\n      city: 'Gwenborough',\n      zipcode: '92998-3874',\n      geo: {\n        lat: '-37.3159',\n        lng: '81.1496',\n      },\n    },\n    phone: '1-770-736-8031 x56442',\n    website: 'hildegard.org',\n    company: {\n      name: 'Romaguera-Crona',\n      catchPhrase: 'Multi-layered client-server neural-net',\n      bs: 'harness real-time e-markets',\n    },\n  },\n  {\n    id: 2,\n    name: 'Ervin Howell',\n    username: 'Antonette',\n    email: 'Shanna@melissa.tv',\n    address: {\n      street: 'Victor Plains',\n      suite: 'Suite 879',\n      city: 'Wisokyburgh',\n      zipcode: '90566-7771',\n      geo: {\n        lat: '-43.9509',\n        lng: '-34.4618',\n      },\n    },\n    phone: '010-692-6593 x09125',\n    website: 'anastasia.net',\n    company: {\n      name: 'Deckow-Crist',\n      catchPhrase: 'Proactive didactic contingency',\n      bs: 'synergize scalable supply-chains',\n    },\n  },\n  {\n    id: 3,\n    name: 'Clementine Bauch',\n    username: 'Samantha',\n    email: 'Nathan@yesenia.net',\n    address: {\n      street: 'Douglas Extension',\n      suite: 'Suite 847',\n      city: 'McKenziehaven',\n      zipcode: '59590-4157',\n      geo: {\n        lat: '-68.6102',\n        lng: '-47.0653',\n      },\n    },\n    phone: '1-463-123-4447',\n    website: 'ramiro.info',\n    company: {\n      name: 'Romaguera-Jacobson',\n      catchPhrase: 'Face to face bifurcated interface',\n      bs: 'e-enable strategic applications',\n    },\n  },\n  {\n    id: 4,\n    name: 'Patricia Lebsack',\n    username: 'Karianne',\n    email: 'Julianne.OConner@kory.org',\n    address: {\n      street: 'Hoeger Mall',\n      suite: 'Apt. 692',\n      city: 'South Elvis',\n      zipcode: '53919-4257',\n      geo: {\n        lat: '29.4572',\n        lng: '-164.2990',\n      },\n    },\n    phone: '493-170-9623 x156',\n    website: 'kale.biz',\n    company: {\n      name: 'Robel-Corkery',\n      catchPhrase: 'Multi-tiered zero tolerance productivity',\n      bs: 'transition cutting-edge web services',\n    },\n  },\n  {\n    id: 5,\n    name: 'Chelsey Dietrich',\n    username: 'Kamren',\n    email: 'Lucio_Hettinger@annie.ca',\n    address: {\n      street: 'Skiles Walks',\n      suite: 'Suite 351',\n      city: 'Roscoeview',\n      zipcode: '33263',\n      geo: {\n        lat: '-31.8129',\n        lng: '62.5342',\n      },\n    },\n    phone: '(254)954-1289',\n    website: 'demarco.info',\n    company: {\n      name: 'Keebler LLC',\n      catchPhrase: 'User-centric fault-tolerant solution',\n      bs: 'revolutionize end-to-end systems',\n    },\n  },\n  {\n    id: 6,\n    name: 'Mrs. Dennis Schulist',\n    username: 'Leopoldo_Corkery',\n    email: 'Karley_Dach@jasper.info',\n    address: {\n      street: 'Norberto Crossing',\n      suite: 'Apt. 950',\n      city: 'South Christy',\n      zipcode: '23505-1337',\n      geo: {\n        lat: '-71.4197',\n        lng: '71.7478',\n      },\n    },\n    phone: '1-477-935-8478 x6430',\n    website: 'ola.org',\n    company: {\n      name: 'Considine-Lockman',\n      catchPhrase: 'Synchronised bottom-line interface',\n      bs: 'e-enable innovative applications',\n    },\n  },\n  {\n    id: 7,\n    name: 'Kurtis Weissnat',\n    username: 'Elwyn.Skiles',\n    email: 'Telly.Hoeger@billy.biz',\n    address: {\n      street: 'Rex Trail',\n      suite: 'Suite 280',\n      city: 'Howemouth',\n      zipcode: '58804-1099',\n      geo: {\n        lat: '24.8918',\n        lng: '21.8984',\n      },\n    },\n    phone: '210.067.6132',\n    website: 'elvis.io',\n    company: {\n      name: 'Johns Group',\n      catchPhrase: 'Configurable multimedia task-force',\n      bs: 'generate enterprise e-tailers',\n    },\n  },\n  {\n    id: 8,\n    name: 'Nicholas Runolfsdottir V',\n    username: 'Maxime_Nienow',\n    email: 'Sherwood@rosamond.me',\n    address: {\n      street: 'Ellsworth Summit',\n      suite: 'Suite 729',\n      city: 'Aliyaview',\n      zipcode: '45169',\n      geo: {\n        lat: '-14.3990',\n        lng: '-120.7677',\n      },\n    },\n    phone: '586.493.6943 x140',\n    website: 'jacynthe.com',\n    company: {\n      name: 'Abernathy Group',\n      catchPhrase: 'Implemented secondary concept',\n      bs: 'e-enable extensible e-tailers',\n    },\n  },\n  {\n    id: 9,\n    name: 'Glenna Reichert',\n    username: 'Delphine',\n    email: 'Chaim_McDermott@dana.io',\n    address: {\n      street: 'Dayna Park',\n      suite: 'Suite 449',\n      city: 'Bartholomebury',\n      zipcode: '76495-3109',\n      geo: {\n        lat: '24.6463',\n        lng: '-168.8889',\n      },\n    },\n    phone: '(775)976-6794 x41206',\n    website: 'conrad.com',\n    company: {\n      name: 'Yost and Sons',\n      catchPhrase: 'Switchable contextually-based project',\n      bs: 'aggregate real-time technologies',\n    },\n  },\n  {\n    id: 10,\n    name: 'Clementina DuBuque',\n    username: 'Moriah.Stanton',\n    email: 'Rey.Padberg@karina.biz',\n    address: {\n      street: 'Kattie Turnpike',\n      suite: 'Suite 198',\n      city: 'Lebsackbury',\n      zipcode: '31428-2261',\n      geo: {\n        lat: '-38.2386',\n        lng: '57.2232',\n      },\n    },\n    phone: '024-648-3804',\n    website: 'ambrose.net',\n    company: {\n      name: 'Hoeger LLC',\n      catchPhrase: 'Centralized empowering task-force',\n      bs: 'target end-to-end models',\n    },\n  },\n]\n"
  },
  {
    "path": "e2e/e2e-utils/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\", \"tests\"]\n}\n"
  },
  {
    "path": "e2e/e2e-utils/vite.config.ts",
    "content": "import path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\n\nconst __dirname = fileURLToPath(new URL('.', import.meta.url))\n\nexport default defineConfig({\n  build: {\n    ssr: true,\n    emptyOutDir: true,\n    rolldownOptions: {\n      input: 'src/index.ts',\n      output: [\n        {\n          format: 'esm',\n          dir: './dist/esm',\n          entryFileNames: '[name].js',\n          preserveModules: true,\n          preserveModulesRoot: path.resolve(__dirname, 'src'),\n        },\n        {\n          format: 'cjs',\n          dir: './dist/cjs',\n          entryFileNames: '[name].cjs',\n          preserveModules: true,\n          preserveModulesRoot: path.resolve(__dirname, 'src'),\n        },\n      ],\n    },\n  },\n  plugins: [\n    dts({\n      copyDtsFiles: true,\n      entryRoot: './src',\n      outDir: './dist/types',\n    }),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basepath-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  basepath: '/app',\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ScrollErrorRouteImport } from './routes/scroll-error'\nimport { Route as RedirectReloadRouteImport } from './routes/redirectReload'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst ScrollErrorRoute = ScrollErrorRouteImport.update({\n  id: '/scroll-error',\n  path: '/scroll-error',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectReloadRoute = RedirectReloadRouteImport.update({\n  id: '/redirectReload',\n  path: '/redirectReload',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n  '/redirect': typeof RedirectRoute\n  '/redirectReload': typeof RedirectReloadRoute\n  '/scroll-error': typeof ScrollErrorRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n  '/redirect': typeof RedirectRoute\n  '/redirectReload': typeof RedirectReloadRoute\n  '/scroll-error': typeof ScrollErrorRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n  '/redirect': typeof RedirectRoute\n  '/redirectReload': typeof RedirectReloadRoute\n  '/scroll-error': typeof ScrollErrorRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about' | '/redirect' | '/redirectReload' | '/scroll-error'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about' | '/redirect' | '/redirectReload' | '/scroll-error'\n  id:\n    | '__root__'\n    | '/'\n    | '/about'\n    | '/redirect'\n    | '/redirectReload'\n    | '/scroll-error'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n  RedirectRoute: typeof RedirectRoute\n  RedirectReloadRoute: typeof RedirectReloadRoute\n  ScrollErrorRoute: typeof ScrollErrorRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/scroll-error': {\n      id: '/scroll-error'\n      path: '/scroll-error'\n      fullPath: '/scroll-error'\n      preLoaderRoute: typeof ScrollErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirectReload': {\n      id: '/redirectReload'\n      path: '/redirectReload'\n      fullPath: '/redirectReload'\n      preLoaderRoute: typeof RedirectReloadRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n  RedirectRoute: RedirectRoute,\n  RedirectReloadRoute: RedirectReloadRoute,\n  ScrollErrorRoute: ScrollErrorRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/src/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = Route.useNavigate()\n\n  return (\n    <div data-testid=\"about-component\">\n      <button\n        onClick={() => navigate({ to: '/', reloadDocument: true })}\n        data-testid=\"to-home-btn\"\n      >\n        Navigate to / with document reload\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n\nfunction App() {\n  const navigate = Route.useNavigate()\n\n  return (\n    <div data-testid=\"home-component\">\n      <button\n        data-testid=\"to-about-btn\"\n        onClick={() =>\n          navigate({\n            to: '/about',\n            reloadDocument: true,\n          })\n        }\n      >\n        Navigate to /about with document reload\n      </button>{' '}\n      <button\n        data-testid=\"to-redirect-btn\"\n        onClick={() =>\n          navigate({\n            to: '/redirect',\n          })\n        }\n      >\n        Navigate to /redirect\n      </button>{' '}\n      <button\n        data-testid=\"to-redirect-reload-btn\"\n        onClick={() =>\n          navigate({\n            to: '/redirectReload',\n          })\n        }\n      >\n        Navigate to /redirectReload\n      </button>{' '}\n      <button\n        data-testid=\"to-about-href-with-basepath-btn\"\n        onClick={() =>\n          navigate({\n            href: '/app/about',\n          })\n        }\n      >\n        Navigate to /about using href with basepath\n      </button>{' '}\n      <button\n        data-testid=\"to-about-href-with-basepath-reload-btn\"\n        onClick={() =>\n          navigate({\n            href: '/app/about',\n            reloadDocument: true,\n          })\n        }\n      >\n        Navigate to /about using href with basepath (reloadDocument)\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/src/routes/redirect.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: () => {\n    throw redirect({ to: '/about' })\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/redirect\"!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/src/routes/redirectReload.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirectReload')({\n  beforeLoad: () => {\n    throw redirect({ to: '/about', reloadDocument: true })\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/redirectReload\"!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/src/routes/scroll-error.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/scroll-error')({\n  component: ScrollErrorComponent,\n})\n\nfunction ScrollErrorComponent() {\n  return (\n    <div>\n      <Link to=\"/about\">About</Link>\n      <div style={{ height: '2000px' }}>\n        <h1>Scroll Error Test</h1>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/tests/reload-document.test.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('navigate() respects basepath for when reloadDocument=true', async ({\n  page,\n}) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const aboutBtn = page.getByTestId(`to-about-btn`)\n  await aboutBtn.click()\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n\n  const homeBtn = page.getByTestId(`to-home-btn`)\n  await homeBtn.click()\n  await page.waitForURL('/app/')\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n})\n\ntest('redirect respects basepath', async ({ page }) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const redirectBtn = page.getByTestId(`to-redirect-btn`)\n  await redirectBtn.click()\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n})\n\ntest('redirect respects basepath with reloadDocument = true on redirect', async ({\n  page,\n}) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const redirectBtn = page.getByTestId(`to-redirect-reload-btn`)\n  await redirectBtn.click()\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n})\n\ntest('navigate() with href containing basepath', async ({ page }) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const aboutBtn = page.getByTestId(`to-about-href-with-basepath-btn`)\n  await aboutBtn.click()\n  // Should navigate to /app/about, NOT /app/app/about\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n})\n\ntest('navigate() with href containing basepath and reloadDocument=true', async ({\n  page,\n}) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const aboutBtn = page.getByTestId(`to-about-href-with-basepath-reload-btn`)\n  await aboutBtn.click()\n  // Should navigate to /app/about, NOT stay on current page\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n})\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/tests/scroll-restoration-session-storage-error.test.ts",
    "content": "/* eslint-disable */\nimport { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\nconst trackConsole = (page: Page) => {\n  const consoleWarnings: Array<string> = []\n\n  page.on('console', (msg) => {\n    if (msg.type() === 'warning') {\n      consoleWarnings.push(msg.text())\n    }\n  })\n\n  return consoleWarnings\n}\n\ntest.describe('Scroll Restoration with Session Storage Error', () => {\n  test('should not crash when sessionStorage.setItem throws an error', async ({\n    page,\n  }) => {\n    const consoleWarnings = trackConsole(page)\n\n    await page.goto('/app/scroll-error')\n    await page.waitForLoadState('networkidle')\n\n    await page.evaluate(() => {\n      sessionStorage.setItem = () => {\n        throw new Error('Test Error')\n      }\n    })\n\n    await page.evaluate(() => window.scrollTo(0, 200))\n    await page.waitForTimeout(150)\n\n    await page.click('a[href=\"/app/about\"]')\n    await page.waitForLoadState('networkidle')\n\n    await page.goBack()\n    await page.waitForLoadState('networkidle')\n\n    expect(\n      consoleWarnings.some((warning) =>\n        warning.includes(\n          '[ts-router] Could not persist scroll restoration state to sessionStorage.',\n        ),\n      ),\n    ).toBeTruthy()\n\n    const heading = page.locator('h1:has-text(\"Scroll Error Test\")')\n    await expect(heading).toBeVisible()\n\n    const scrollPosition = await page.evaluate(() => window.scrollY)\n    expect(scrollPosition).not.toBe(200)\n  })\n\n  test('should surface warning when sessionStorage quota is exceeded', async ({\n    page,\n  }) => {\n    const consoleWarnings = trackConsole(page)\n\n    await page.goto('/app/scroll-error')\n    await page.waitForLoadState('networkidle')\n\n    await page.evaluate(() => {\n      let i = 0\n      const chunk = 'x'.repeat(32)\n\n      try {\n        while (true) {\n          sessionStorage.setItem(`key_${i}`, chunk)\n          i += 1\n        }\n      } catch {\n        console.log(`Stored ${i} keys in session storage`)\n      }\n    })\n\n    await page.evaluate(() => window.scrollTo(0, 200))\n    await page.waitForTimeout(150)\n\n    await page.click('a[href=\"/app/about\"]')\n    await page.waitForLoadState('networkidle')\n\n    await page.goBack()\n    await page.waitForLoadState('networkidle')\n\n    expect(\n      consoleWarnings.some((warning) =>\n        warning.includes(\n          '[ts-router] Could not persist scroll restoration state to sessionStorage.',\n        ),\n      ),\n    ).toBeTruthy()\n\n    const heading = page.locator('h1:has-text(\"Scroll Error Test\")')\n    await expect(heading).toBeVisible()\n\n    const scrollPosition = await page.evaluate(() => window.scrollY)\n    expect(scrollPosition).not.toBe(200)\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basepath-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  base: '/app/',\n  plugins: [tanstackRouter({ target: 'react' }), react()],\n})\n"
  },
  {
    "path": "e2e/react-router/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/react-router/basic/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basic\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic/src/main.tsx",
    "content": "import ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { NotFoundError, fetchPost, fetchPosts } from './posts'\nimport './styles.css'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link to=\"/posts\" viewTransition>\n          View Transition\n        </Link>{' '}\n        <Link to=\"/posts\" viewTransition={{ types: ['dummy'] }}>\n          View Transition types\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>{' '}\n        <div className=\"flex items-center\">\n          <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" role=\"img\">\n            <title id=\"rectTitle\">Link in SVG</title>\n            <Link to=\"/posts\" aria-label=\"Open posts from SVG\">\n              <rect\n                x=\"0\"\n                y=\"0\"\n                width=\"20\"\n                height=\"20\"\n                rx=\"4\"\n                fill=\"blue\"\n                strokeWidth=\"2\"\n              />\n            </Link>\n          </svg>\n        </div>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nexport const postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ params }) => fetchPost(params.postId),\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold\">{post.title}</h4>\n      <hr className=\"opacity-20\" />\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layout2Route = createRoute({\n  getParentRoute: () => layoutRoute,\n  id: '_layout-2',\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layoutARoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-a',\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n\nconst layoutBRoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-b',\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n\nconst paramsPsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/params-ps',\n})\n\nconst paramsPsIndexRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/',\n  component: function ParamsIndex() {\n    return (\n      <div>\n        <h3 className=\"pb-2\">Named path params</h3>\n        <ul className=\"grid mb-2\">\n          <li>\n            <Link\n              data-testid=\"l-to-named-foo\"\n              to=\"/params-ps/named/$foo\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/$foo\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-named-prefixfoo\"\n              to=\"/params-ps/named/prefix{$foo}\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/{'prefix{$foo}'}\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-named-foosuffix\"\n              to=\"/params-ps/named/{$foo}suffix\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/{'{$foo}suffix'}\n            </Link>\n          </li>\n        </ul>\n        <hr />\n        <h3 className=\"pb-2\">Wildcard path params</h3>\n        <ul className=\"grid mb-2\">\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-foo\"\n              to=\"/params-ps/wildcard/$\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/$\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-prefixfoo\"\n              to=\"/params-ps/wildcard/prefix{$}\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/{'prefix{$}'}\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-foosuffix\"\n              to=\"/params-ps/wildcard/{$}suffix\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/{'{$}suffix'}\n            </Link>\n          </li>\n        </ul>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/named',\n})\n\nconst paramsPsNamedIndexRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/',\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n\nconst paramsPsNamedFooRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/$foo',\n  component: function ParamsNamedFoo() {\n    const p = paramsPsNamedFooRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFoo</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedFooPrefixRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/prefix{$foo}',\n  component: function ParamsNamedFooMarkdown() {\n    const p = paramsPsNamedFooPrefixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFooPrefix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedFooSuffixRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/{$foo}suffix',\n  component: function ParamsNamedFooSuffix() {\n    const p = paramsPsNamedFooSuffixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFooSuffix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/wildcard',\n})\n\nconst paramsPsWildcardIndexRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '/',\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n\nconst paramsPsWildcardSplatRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '$',\n  component: function ParamsWildcardSplat() {\n    const p = paramsPsWildcardSplatRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplat</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardSplatPrefixRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: 'prefix{$}',\n  component: function ParamsWildcardSplatPrefix() {\n    const p = paramsPsWildcardSplatPrefixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplatPrefix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardSplatSuffixRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '{$}suffix',\n  component: function ParamsWildcardSplatSuffix() {\n    const p = paramsPsWildcardSplatSuffixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplatSuffix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n      </div>\n    )\n  },\n})\n\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute, postsIndexRoute]),\n  layoutRoute.addChildren([\n    layout2Route.addChildren([layoutARoute, layoutBRoute]),\n  ]),\n  paramsPsRoute.addChildren([\n    paramsPsNamedRoute.addChildren([\n      paramsPsNamedFooPrefixRoute,\n      paramsPsNamedFooSuffixRoute,\n      paramsPsNamedFooRoute,\n      paramsPsNamedIndexRoute,\n    ]),\n    paramsPsWildcardRoute.addChildren([\n      paramsPsWildcardSplatRoute,\n      paramsPsWildcardSplatPrefixRoute,\n      paramsPsWildcardSplatSuffixRoute,\n      paramsPsWildcardIndexRoute,\n    ]),\n    paramsPsIndexRoute,\n  ]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/basic/src/posts.lazy.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createLazyRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/react-router/basic/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/basic/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Navigating to a post page with viewTransition', async ({ page }) => {\n  await page.getByRole('link', { name: 'View Transition', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to a post page with viewTransition types', async ({\n  page,\n}) => {\n  await page.getByRole('link', { name: 'View Transition types' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Link in SVG does not trigger a full page reload', async ({ page }) => {\n  let fullPageLoad = false\n  page.on('domcontentloaded', () => {\n    fullPageLoad = true\n  })\n\n  await page.getByRole('link', { name: 'Open posts from SVG' }).click()\n  const url = `http://localhost:${PORT}/posts`\n  await page.waitForURL(url)\n\n  expect(fullPageLoad).toBeFalsy()\n})\n"
  },
  {
    "path": "e2e/react-router/basic/tests/params.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('params operations + prefix/suffix', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/params-ps')\n  })\n\n  test.describe('named params', () => {\n    const NAMED_PARAMS_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-named-foo',\n        pathname: '/params-ps/named/foo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFoo',\n      },\n      {\n        id: 'l-to-named-prefixfoo',\n        pathname: '/params-ps/named/prefixfoo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooPrefix',\n      },\n      {\n        id: 'l-to-named-foosuffix',\n        pathname: '/params-ps/named/foosuffix',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooSuffix',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n  })\n\n  test.describe('wildcard param', () => {\n    const WILDCARD_PARAM_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-wildcard-foo',\n        pathname: '/params-ps/wildcard/foo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n      {\n        id: 'l-to-wildcard-prefixfoo',\n        pathname: '/params-ps/wildcard/prefixfoo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatPrefix',\n      },\n      {\n        id: 'l-to-wildcard-foosuffix',\n        pathname: '/params-ps/wildcard/foosuffix',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatSuffix',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n    <script src=\"https://unpkg.com/@tailwindcss/browser@4\"></script>\n    <style type=\"text/tailwindcss\">\n      html {\n        color-scheme: light dark;\n      }\n      * {\n        @apply border-gray-200 dark:border-gray-800;\n      }\n      body {\n        @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n      }\n    </style>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/dist/main.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basic-esbuild-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"esbuild src/main.tsx --serve=5601 --bundle --outfile=dist/main.js --watch --servedir=.\",\n    \"build\": \"esbuild src/main.tsx --bundle --outfile=dist/main.js && tsc --noEmit\",\n    \"serve\": \"esbuild src/main.tsx --bundle --outfile=dist/main.js --servedir=.\",\n    \"start\": \"dev\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"esbuild\": \"^0.27.4\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm run build && pnpm run serve --serve=${PORT} --define:process.env.NODE_ENV=\\\\\"test\\\\\" --define:process.env.EXTERNAL_PORT=\"${EXTERNAL_PORT}\"`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/esbuild.config.js",
    "content": "import { tanstackRouter } from '@tanstack/router-plugin/esbuild'\n\nexport default {\n  // ...\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true,\n    }),\n  ],\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (process.env.NODE_ENV === 'test') {\n  queryURL = `http://localhost:${process.env.EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routeTree.gen.ts",
    "content": "/* prettier-ignore-start */\n\n/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file is auto-generated by TanStack Router\n\nimport { createFileRoute } from '@tanstack/react-router'\n\n// Import Routes\n\nimport { Route as rootRoute } from './routes/__root'\nimport { Route as PostsImport } from './routes/posts'\nimport { Route as LayoutImport } from './routes/_layout'\nimport { Route as IndexImport } from './routes/index'\nimport { Route as PostsIndexImport } from './routes/posts.index'\nimport { Route as PostsPostIdImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2Import } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideImport } from './routes/(group)/lazyinside'\nimport { Route as groupLayoutImport } from './routes/(group)/_layout'\nimport { Route as LayoutLayout2LayoutBImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutAImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupLayoutInsideImport } from './routes/(group)/_layout.inside'\n\n// Create Virtual Routes\n\nconst groupImport = createFileRoute('/(group)')()\n\n// Create/Update Routes\n\nconst groupRoute = groupImport.update({\n  id: '/(group)',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst PostsRoute = PostsImport.update({\n  path: '/posts',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst LayoutRoute = LayoutImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst IndexRoute = IndexImport.update({\n  path: '/',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst PostsIndexRoute = PostsIndexImport.update({\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nconst PostsPostIdRoute = PostsPostIdImport.update({\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nconst LayoutLayout2Route = LayoutLayout2Import.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\n\nconst groupLazyinsideRoute = groupLazyinsideImport\n  .update({\n    path: '/lazyinside',\n    getParentRoute: () => groupRoute,\n  } as any)\n  .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route))\n\nconst groupLayoutRoute = groupLayoutImport.update({\n  id: '/_layout',\n  getParentRoute: () => groupRoute,\n} as any)\n\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBImport.update({\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutAImport.update({\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nconst groupLayoutInsideRoute = groupLayoutInsideImport.update({\n  path: '/inside',\n  getParentRoute: () => groupLayoutRoute,\n} as any)\n\n// Populate the FileRoutesByPath interface\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexImport\n      parentRoute: typeof rootRoute\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof LayoutImport\n      parentRoute: typeof rootRoute\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsImport\n      parentRoute: typeof rootRoute\n    }\n    '/(group)': {\n      id: '/(group)'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof groupImport\n      parentRoute: typeof rootRoute\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof groupLayoutImport\n      parentRoute: typeof groupRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideImport\n      parentRoute: typeof groupImport\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof LayoutLayout2Import\n      parentRoute: typeof LayoutImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdImport\n      parentRoute: typeof PostsImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexImport\n      parentRoute: typeof PostsImport\n    }\n    '/(group)/_layout/inside': {\n      id: '/(group)/_layout/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupLayoutInsideImport\n      parentRoute: typeof groupLayoutImport\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutAImport\n      parentRoute: typeof LayoutLayout2Import\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBImport\n      parentRoute: typeof LayoutLayout2Import\n    }\n  }\n}\n\n// Create and export the route tree\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsideRoute: typeof groupLayoutInsideRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsideRoute: groupLayoutInsideRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\ninterface groupRouteChildren {\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n}\n\nconst groupRouteChildren: groupRouteChildren = {\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n}\n\nconst groupRouteWithChildren = groupRoute._addFileChildren(groupRouteChildren)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof groupLayoutRouteWithChildren\n  '': typeof LayoutLayout2RouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/inside': typeof groupLayoutInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\n\nexport interface FileRoutesByTo {\n  '/': typeof groupLayoutRouteWithChildren\n  '': typeof LayoutLayout2RouteWithChildren\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/inside': typeof groupLayoutInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\n\nexport interface FileRoutesById {\n  __root__: typeof rootRoute\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/(group)': typeof groupRouteWithChildren\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/(group)/_layout/inside': typeof groupLayoutInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n}\n\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | ''\n    | '/posts'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/inside'\n    | '/layout-a'\n    | '/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | ''\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts'\n    | '/inside'\n    | '/layout-a'\n    | '/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/(group)'\n    | '/(group)/_layout'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/(group)/_layout/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n  fileRoutesById: FileRoutesById\n}\n\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n  groupRoute: typeof groupRouteWithChildren\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n  groupRoute: groupRouteWithChildren,\n}\n\nexport const routeTree = rootRoute\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\n/* prettier-ignore-end */\n\n/* ROUTE_MANIFEST_START\n{\n  \"routes\": {\n    \"__root__\": {\n      \"filePath\": \"__root.tsx\",\n      \"children\": [\n        \"/\",\n        \"/_layout\",\n        \"/posts\",\n        \"/(group)\"\n      ]\n    },\n    \"/\": {\n      \"filePath\": \"index.tsx\"\n    },\n    \"/_layout\": {\n      \"filePath\": \"_layout.tsx\",\n      \"children\": [\n        \"/_layout/_layout-2\"\n      ]\n    },\n    \"/posts\": {\n      \"filePath\": \"posts.tsx\",\n      \"children\": [\n        \"/posts/$postId\",\n        \"/posts/\"\n      ]\n    },\n    \"/(group)\": {\n      \"filePath\": \"(group)\",\n      \"children\": [\n        \"/(group)/_layout\",\n        \"/(group)/lazyinside\"\n      ]\n    },\n    \"/(group)/_layout\": {\n      \"filePath\": \"(group)/_layout.tsx\",\n      \"parent\": \"/(group)\",\n      \"children\": [\n        \"/(group)/_layout/inside\"\n      ]\n    },\n    \"/(group)/lazyinside\": {\n      \"filePath\": \"(group)/lazyinside.tsx\",\n      \"parent\": \"/(group)\"\n    },\n    \"/_layout/_layout-2\": {\n      \"filePath\": \"_layout/_layout-2.tsx\",\n      \"parent\": \"/_layout\",\n      \"children\": [\n        \"/_layout/_layout-2/layout-a\",\n        \"/_layout/_layout-2/layout-b\"\n      ]\n    },\n    \"/posts/$postId\": {\n      \"filePath\": \"posts.$postId.tsx\",\n      \"parent\": \"/posts\"\n    },\n    \"/posts/\": {\n      \"filePath\": \"posts.index.tsx\",\n      \"parent\": \"/posts\"\n    },\n    \"/(group)/_layout/inside\": {\n      \"filePath\": \"(group)/_layout.inside.tsx\",\n      \"parent\": \"/(group)/_layout\"\n    },\n    \"/_layout/_layout-2/layout-a\": {\n      \"filePath\": \"_layout/_layout-2/layout-a.tsx\",\n      \"parent\": \"/_layout/_layout-2\"\n    },\n    \"/_layout/_layout-2/layout-b\": {\n      \"filePath\": \"_layout/_layout-2/layout-b.tsx\",\n      \"parent\": \"/_layout/_layout-2\"\n    }\n  }\n}\nROUTE_MANIFEST_END */\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/(group)/_layout.inside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(group)/_layout/inside')\n\nexport const Route = createFileRoute('/(group)/_layout/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/_layout/inside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook.hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook.hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">{searchViaRouteApi.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({\n  component: () => (\n    <>\n      <div>/(group)/_layout!</div>\n      <Outlet />\n    </>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.lazy.tsx",
    "content": "import {\n  createLazyFileRoute,\n  getRouteApi,\n  useSearch,\n} from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nexport const Route = createLazyFileRoute('/(group)/lazyinside')({\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/lazyinside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook.hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook.hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">{searchViaRouteApi.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/inside\"\n          data-testid=\"link-to-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/lazyinside\"\n          data-testid=\"link-to-lazy-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Lazy Inside Group\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/index.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx",
    "content": "import * as React from 'react'\nimport { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/posts.index.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/src/routes/posts.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.goto('/')\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Navigating to a route inside a route group', async ({ page }) => {\n  await page.getByTestId('link-to-route-inside-group').click()\n  await expect(page.getByTestId('search-via-hook')).toContainText('world')\n  await expect(page.getByTestId('search-via-route-hook')).toContainText('world')\n  await expect(page.getByTestId('search-via-route-api')).toContainText('world')\n})\n\ntest('Navigating to a lazy route inside a route group', async ({ page }) => {\n  await page.getByTestId('link-to-lazy-route-inside-group').click()\n  await expect(page.getByTestId('search-via-hook')).toContainText('world')\n  await expect(page.getByTestId('search-via-route-hook')).toContainText('world')\n  await expect(page.getByTestId('search-via-route-api')).toContainText('world')\n})\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-esbuild-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basic-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"pnpm run test:e2e:default\",\n    \"test:e2e:default\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"combinate\": \"^1.1.11\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\nconst command = `pnpm build && pnpm preview --port ${PORT}`\n\nconsole.info('Running with mode: ', process.env.MODE || 'default')\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      MODE: process.env.MODE || '',\n      VITE_MODE: process.env.MODE || '',\n      VITE_NODE_ENV: 'test',\n      VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),\n      VITE_SERVER_PORT: String(PORT),\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/components/RenderCounter.tsx",
    "content": "import { useRef } from 'react'\n\nexport const RenderCounter = () => {\n  const renderCounter = useRef(0)\n  renderCounter.current = renderCounter.current + 1\n  return <>{renderCounter.current}</>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  RouterProvider,\n  createRouteMask,\n  createRouter,\n} from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nconst mask = createRouteMask({\n  routeTree,\n  from: '/masks/admin/$userId',\n  to: '/masks/public/$username',\n  params: (prev) => ({\n    username: `user-${prev.userId}`,\n  }),\n})\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  routeMasks: [mask],\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as RemountDepsRouteImport } from './routes/remountDeps'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'\nimport { Route as MasksRouteImport } from './routes/masks'\nimport { Route as LazyErrorRouteImport } from './routes/lazy-error'\nimport { Route as HoverPreloadHashRouteImport } from './routes/hover-preload-hash'\nimport { Route as EditingBRouteImport } from './routes/editing-b'\nimport { Route as EditingARouteImport } from './routes/editing-a'\nimport { Route as ComponentTypesTestRouteImport } from './routes/component-types-test'\nimport { Route as AnchorRouteImport } from './routes/anchor'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as Char45824Char54620Char48124Char44397RouteRouteImport } from './routes/대한민국/route'\nimport { Route as SearchParamsRouteRouteImport } from './routes/search-params/route'\nimport { Route as PathlessLayoutRouteRouteImport } from './routes/pathless-layout/route'\nimport { Route as NonNestedRouteRouteImport } from './routes/non-nested/route'\nimport { Route as FullpathTestRouteRouteImport } from './routes/fullpath-test/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SearchParamsIndexRouteImport } from './routes/search-params/index'\nimport { Route as RelativeIndexRouteImport } from './routes/relative/index'\nimport { Route as RedirectIndexRouteImport } from './routes/redirect/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as ParamsPsIndexRouteImport } from './routes/params-ps/index'\nimport { Route as StructuralSharingEnabledRouteImport } from './routes/structural-sharing.$enabled'\nimport { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default'\nimport { Route as RedirectTargetRouteImport } from './routes/redirect/$target'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'\nimport { Route as groupInsideRouteImport } from './routes/(group)/inside'\nimport { Route as groupLayoutRouteImport } from './routes/(group)/_layout'\nimport { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside'\nimport { Route as RelativeUseNavigateRouteRouteImport } from './routes/relative/useNavigate/route'\nimport { Route as RelativeLinkRouteRouteImport } from './routes/relative/link/route'\nimport { Route as PathlessLayoutLayoutRouteRouteImport } from './routes/pathless-layout/_layout/route'\nimport { Route as ParamsPsStrictFalseRouteRouteImport } from './routes/params-ps/strict-false/route'\nimport { Route as ParamsPsNonNestedRouteRouteImport } from './routes/params-ps/non-nested/route'\nimport { Route as NonNestedSuffixRouteRouteImport } from './routes/non-nested/suffix/route'\nimport { Route as NonNestedPrefixRouteRouteImport } from './routes/non-nested/prefix/route'\nimport { Route as NonNestedPathRouteRouteImport } from './routes/non-nested/path/route'\nimport { Route as NonNestedNamedRouteRouteImport } from './routes/non-nested/named/route'\nimport { Route as NonNestedDeepRouteRouteImport } from './routes/non-nested/deep/route'\nimport { Route as FullpathTestLayoutRouteRouteImport } from './routes/fullpath-test/_layout/route'\nimport { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index'\nimport { Route as PathlessLayoutLayoutIndexRouteImport } from './routes/pathless-layout/_layout/index'\nimport { Route as ParamsPsWildcardIndexRouteImport } from './routes/params-ps/wildcard/index'\nimport { Route as ParamsPsNamedIndexRouteImport } from './routes/params-ps/named/index'\nimport { Route as FullpathTestLayoutIndexRouteImport } from './routes/fullpath-test/_layout/index'\nimport { Route as Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport } from './routes/대한민국/🚀.$id'\nimport { Route as Char45824Char54620Char48124Char44397WildcardSplatRouteImport } from './routes/대한민국/wildcard.$'\nimport { Route as RelativeUseNavigateRelativeUseNavigateBRouteImport } from './routes/relative/useNavigate/relative-useNavigate-b'\nimport { Route as RelativeUseNavigateRelativeUseNavigateARouteImport } from './routes/relative/useNavigate/relative-useNavigate-a'\nimport { Route as RelativeLinkRelativeLinkBRouteImport } from './routes/relative/link/relative-link-b'\nimport { Route as RelativeLinkRelativeLinkARouteImport } from './routes/relative/link/relative-link-a'\nimport { Route as RedirectPreloadThirdRouteImport } from './routes/redirect/preload/third'\nimport { Route as RedirectPreloadSecondRouteImport } from './routes/redirect/preload/second'\nimport { Route as RedirectPreloadFirstRouteImport } from './routes/redirect/preload/first'\nimport { Route as RedirectTargetViaRouteApiRedirectLoaderRouteImport } from './routes/redirect/$target/via-routeApi-redirect-loader'\nimport { Route as RedirectTargetViaRouteApiRedirectBeforeLoadRouteImport } from './routes/redirect/$target/via-routeApi-redirect-beforeLoad'\nimport { Route as RedirectTargetViaRouteRedirectLoaderRouteImport } from './routes/redirect/$target/via-route-redirect-loader'\nimport { Route as RedirectTargetViaRouteRedirectBeforeLoadRouteImport } from './routes/redirect/$target/via-route-redirect-beforeLoad'\nimport { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader'\nimport { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad'\nimport { Route as RedirectTargetDestinationRouteImport } from './routes/redirect/$target/destination'\nimport { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit'\nimport { Route as PathlessLayoutLayoutChildRouteImport } from './routes/pathless-layout/_layout/child'\nimport { Route as ParamsSingleValueRouteImport } from './routes/params.single.$value'\nimport { Route as ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport } from './routes/params-ps/wildcard/{$}suffix@대'\nimport { Route as ParamsPsWildcardChar123Char125suffixRouteImport } from './routes/params-ps/wildcard/{$}suffix'\nimport { Route as ParamsPsWildcardPrefixChar123Char125RouteImport } from './routes/params-ps/wildcard/prefix{$}'\nimport { Route as ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport } from './routes/params-ps/wildcard/prefix@대{$}'\nimport { Route as ParamsPsWildcardSplatRouteImport } from './routes/params-ps/wildcard/$'\nimport { Route as ParamsPsNamedChar123fooChar125suffixRouteImport } from './routes/params-ps/named/{$foo}suffix'\nimport { Route as ParamsPsNamedPrefixChar123fooChar125RouteImport } from './routes/params-ps/named/prefix{$foo}'\nimport { Route as MasksPublicUsernameRouteImport } from './routes/masks.public.$username'\nimport { Route as MasksAdminUserIdRouteImport } from './routes/masks.admin.$userId'\nimport { Route as FullpathTestLayoutIdRouteImport } from './routes/fullpath-test/_layout/$id'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside'\nimport { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout'\nimport { Route as ParamsPsStrictFalseVersionRouteRouteImport } from './routes/params-ps/strict-false/$version.route'\nimport { Route as ParamsPsNonNestedFooRouteRouteImport } from './routes/params-ps/non-nested/$foo_/route'\nimport { Route as ParamsPsNamedFooRouteRouteImport } from './routes/params-ps/named/$foo/route'\nimport { Route as NonNestedSuffixChar123bazChar125suffixRouteRouteImport } from './routes/non-nested/suffix/{$baz}suffix.route'\nimport { Route as NonNestedPrefixPrefixChar123bazChar125RouteRouteImport } from './routes/non-nested/prefix/prefix{$baz}.route'\nimport { Route as NonNestedPathBazRouteRouteImport } from './routes/non-nested/path/baz.route'\nimport { Route as NonNestedNamedBazRouteRouteImport } from './routes/non-nested/named/$baz.route'\nimport { Route as NonNestedDeepBazRouteRouteImport } from './routes/non-nested/deep/$baz.route'\nimport { Route as RelativeUseNavigateWithSearchIndexRouteImport } from './routes/relative/useNavigate/with-search/index'\nimport { Route as RelativeUseNavigatePathIndexRouteImport } from './routes/relative/useNavigate/path/index'\nimport { Route as RelativeUseNavigateNestedIndexRouteImport } from './routes/relative/useNavigate/nested/index'\nimport { Route as RelativeLinkWithSearchIndexRouteImport } from './routes/relative/link/with-search/index'\nimport { Route as RelativeLinkPathIndexRouteImport } from './routes/relative/link/path/index'\nimport { Route as RelativeLinkNestedIndexRouteImport } from './routes/relative/link/nested/index'\nimport { Route as NonNestedSuffixChar123bazChar125suffixIndexRouteImport } from './routes/non-nested/suffix/{$baz}suffix.index'\nimport { Route as NonNestedPrefixPrefixChar123bazChar125IndexRouteImport } from './routes/non-nested/prefix/prefix{$baz}.index'\nimport { Route as NonNestedPathBazIndexRouteImport } from './routes/non-nested/path/baz.index'\nimport { Route as NonNestedNamedBazIndexRouteImport } from './routes/non-nested/named/$baz.index'\nimport { Route as NonNestedDeepBazIndexRouteImport } from './routes/non-nested/deep/$baz.index'\nimport { Route as ParamsPsNonNestedFooBarRouteImport } from './routes/params-ps/non-nested/$foo_/$bar'\nimport { Route as NonNestedSuffixChar123bazChar125suffixBarRouteImport } from './routes/non-nested/suffix/{$baz}suffix_.bar'\nimport { Route as NonNestedSuffixChar123bazChar125suffixFooRouteImport } from './routes/non-nested/suffix/{$baz}suffix.foo'\nimport { Route as NonNestedPrefixPrefixChar123bazChar125BarRouteImport } from './routes/non-nested/prefix/prefix{$baz}_.bar'\nimport { Route as NonNestedPrefixPrefixChar123bazChar125FooRouteImport } from './routes/non-nested/prefix/prefix{$baz}.foo'\nimport { Route as NonNestedPathBazBarRouteImport } from './routes/non-nested/path/baz_.bar'\nimport { Route as NonNestedPathBazFooRouteImport } from './routes/non-nested/path/baz.foo'\nimport { Route as NonNestedNamedBazBarRouteImport } from './routes/non-nested/named/$baz_.bar'\nimport { Route as NonNestedNamedBazFooRouteImport } from './routes/non-nested/named/$baz.foo'\nimport { Route as ParamsPsNamedFooBarRouteRouteImport } from './routes/params-ps/named/$foo/$bar.route'\nimport { Route as NonNestedDeepBazBarRouteRouteImport } from './routes/non-nested/deep/$baz_.bar.route'\nimport { Route as RelativeUseNavigatePathPathIndexRouteImport } from './routes/relative/useNavigate/path/$path/index'\nimport { Route as RelativeUseNavigateNestedDeepIndexRouteImport } from './routes/relative/useNavigate/nested/deep/index'\nimport { Route as RelativeLinkPathPathIndexRouteImport } from './routes/relative/link/path/$path/index'\nimport { Route as RelativeLinkNestedDeepIndexRouteImport } from './routes/relative/link/nested/deep/index'\nimport { Route as NonNestedDeepBazBarIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.index'\nimport { Route as ParamsPsNamedFooBarBazRouteImport } from './routes/params-ps/named/$foo/$bar.$baz'\nimport { Route as NonNestedDeepBazBarQuxRouteImport } from './routes/non-nested/deep/$baz_.bar_.qux'\nimport { Route as NonNestedDeepBazBarFooRouteRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.route'\nimport { Route as NonNestedDeepBazBarFooIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.index'\nimport { Route as NonNestedDeepBazBarFooQuxRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo_.qux'\n\nconst RemountDepsRoute = RemountDepsRouteImport.update({\n  id: '/remountDeps',\n  path: '/remountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotRemountDepsRoute = NotRemountDepsRouteImport.update({\n  id: '/notRemountDeps',\n  path: '/notRemountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MasksRoute = MasksRouteImport.update({\n  id: '/masks',\n  path: '/masks',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LazyErrorRoute = LazyErrorRouteImport.update({\n  id: '/lazy-error',\n  path: '/lazy-error',\n  getParentRoute: () => rootRouteImport,\n} as any).lazy(() => import('./routes/lazy-error.lazy').then((d) => d.Route))\nconst HoverPreloadHashRoute = HoverPreloadHashRouteImport.update({\n  id: '/hover-preload-hash',\n  path: '/hover-preload-hash',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingBRoute = EditingBRouteImport.update({\n  id: '/editing-b',\n  path: '/editing-b',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingARoute = EditingARouteImport.update({\n  id: '/editing-a',\n  path: '/editing-a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ComponentTypesTestRoute = ComponentTypesTestRouteImport.update({\n  id: '/component-types-test',\n  path: '/component-types-test',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AnchorRoute = AnchorRouteImport.update({\n  id: '/anchor',\n  path: '/anchor',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Char45824Char54620Char48124Char44397RouteRoute =\n  Char45824Char54620Char48124Char44397RouteRouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({\n  id: '/search-params',\n  path: '/search-params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRouteRoute = PathlessLayoutRouteRouteImport.update({\n  id: '/pathless-layout',\n  path: '/pathless-layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NonNestedRouteRoute = NonNestedRouteRouteImport.update({\n  id: '/non-nested',\n  path: '/non-nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FullpathTestRouteRoute = FullpathTestRouteRouteImport.update({\n  id: '/fullpath-test',\n  path: '/fullpath-test',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RelativeIndexRoute = RelativeIndexRouteImport.update({\n  id: '/relative/',\n  path: '/relative/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectIndexRoute = RedirectIndexRouteImport.update({\n  id: '/redirect/',\n  path: '/redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ParamsPsIndexRoute = ParamsPsIndexRouteImport.update({\n  id: '/params-ps/',\n  path: '/params-ps/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst StructuralSharingEnabledRoute =\n  StructuralSharingEnabledRouteImport.update({\n    id: '/structural-sharing/$enabled',\n    path: '/structural-sharing/$enabled',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({\n  id: '/default',\n  path: '/default',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RedirectTargetRoute = RedirectTargetRouteImport.update({\n  id: '/redirect/$target',\n  path: '/redirect/$target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst groupLazyinsideRoute = groupLazyinsideRouteImport\n  .update({\n    id: '/(group)/lazyinside',\n    path: '/lazyinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route))\nconst groupInsideRoute = groupInsideRouteImport.update({\n  id: '/(group)/inside',\n  path: '/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutRoute = groupLayoutRouteImport.update({\n  id: '/(group)/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst anotherGroupOnlyrouteinsideRoute =\n  anotherGroupOnlyrouteinsideRouteImport.update({\n    id: '/(another-group)/onlyrouteinside',\n    path: '/onlyrouteinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst RelativeUseNavigateRouteRoute =\n  RelativeUseNavigateRouteRouteImport.update({\n    id: '/relative/useNavigate',\n    path: '/relative/useNavigate',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst RelativeLinkRouteRoute = RelativeLinkRouteRouteImport.update({\n  id: '/relative/link',\n  path: '/relative/link',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutLayoutRouteRoute =\n  PathlessLayoutLayoutRouteRouteImport.update({\n    id: '/_layout',\n    getParentRoute: () => PathlessLayoutRouteRoute,\n  } as any)\nconst ParamsPsStrictFalseRouteRoute =\n  ParamsPsStrictFalseRouteRouteImport.update({\n    id: '/params-ps/strict-false',\n    path: '/params-ps/strict-false',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsNonNestedRouteRoute = ParamsPsNonNestedRouteRouteImport.update({\n  id: '/params-ps/non-nested',\n  path: '/params-ps/non-nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NonNestedSuffixRouteRoute = NonNestedSuffixRouteRouteImport.update({\n  id: '/suffix',\n  path: '/suffix',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst NonNestedPrefixRouteRoute = NonNestedPrefixRouteRouteImport.update({\n  id: '/prefix',\n  path: '/prefix',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst NonNestedPathRouteRoute = NonNestedPathRouteRouteImport.update({\n  id: '/path',\n  path: '/path',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst NonNestedNamedRouteRoute = NonNestedNamedRouteRouteImport.update({\n  id: '/named',\n  path: '/named',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst NonNestedDeepRouteRoute = NonNestedDeepRouteRouteImport.update({\n  id: '/deep',\n  path: '/deep',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst FullpathTestLayoutRouteRoute = FullpathTestLayoutRouteRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => FullpathTestRouteRoute,\n} as any)\nconst RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst PathlessLayoutLayoutIndexRoute =\n  PathlessLayoutLayoutIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => PathlessLayoutLayoutRouteRoute,\n  } as any)\nconst ParamsPsWildcardIndexRoute = ParamsPsWildcardIndexRouteImport.update({\n  id: '/params-ps/wildcard/',\n  path: '/params-ps/wildcard/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsPsNamedIndexRoute = ParamsPsNamedIndexRouteImport.update({\n  id: '/params-ps/named/',\n  path: '/params-ps/named/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FullpathTestLayoutIndexRoute = FullpathTestLayoutIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => FullpathTestLayoutRouteRoute,\n} as any)\nconst Char45824Char54620Char48124Char44397Char55357Char56960IdRoute =\n  Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport.update({\n    id: '/🚀/$id',\n    path: '/🚀/$id',\n    getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,\n  } as any)\nconst Char45824Char54620Char48124Char44397WildcardSplatRoute =\n  Char45824Char54620Char48124Char44397WildcardSplatRouteImport.update({\n    id: '/wildcard/$',\n    path: '/wildcard/$',\n    getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,\n  } as any)\nconst RelativeUseNavigateRelativeUseNavigateBRoute =\n  RelativeUseNavigateRelativeUseNavigateBRouteImport.update({\n    id: '/relative-useNavigate-b',\n    path: '/relative-useNavigate-b',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeUseNavigateRelativeUseNavigateARoute =\n  RelativeUseNavigateRelativeUseNavigateARouteImport.update({\n    id: '/relative-useNavigate-a',\n    path: '/relative-useNavigate-a',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeLinkRelativeLinkBRoute =\n  RelativeLinkRelativeLinkBRouteImport.update({\n    id: '/relative-link-b',\n    path: '/relative-link-b',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst RelativeLinkRelativeLinkARoute =\n  RelativeLinkRelativeLinkARouteImport.update({\n    id: '/relative-link-a',\n    path: '/relative-link-a',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst RedirectPreloadThirdRoute = RedirectPreloadThirdRouteImport.update({\n  id: '/redirect/preload/third',\n  path: '/redirect/preload/third',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectPreloadSecondRoute = RedirectPreloadSecondRouteImport.update({\n  id: '/redirect/preload/second',\n  path: '/redirect/preload/second',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectPreloadFirstRoute = RedirectPreloadFirstRouteImport.update({\n  id: '/redirect/preload/first',\n  path: '/redirect/preload/first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTargetViaRouteApiRedirectLoaderRoute =\n  RedirectTargetViaRouteApiRedirectLoaderRouteImport.update({\n    id: '/via-routeApi-redirect-loader',\n    path: '/via-routeApi-redirect-loader',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetViaRouteApiRedirectBeforeLoadRoute =\n  RedirectTargetViaRouteApiRedirectBeforeLoadRouteImport.update({\n    id: '/via-routeApi-redirect-beforeLoad',\n    path: '/via-routeApi-redirect-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetViaRouteRedirectLoaderRoute =\n  RedirectTargetViaRouteRedirectLoaderRouteImport.update({\n    id: '/via-route-redirect-loader',\n    path: '/via-route-redirect-loader',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetViaRouteRedirectBeforeLoadRoute =\n  RedirectTargetViaRouteRedirectBeforeLoadRouteImport.update({\n    id: '/via-route-redirect-beforeLoad',\n    path: '/via-route-redirect-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({\n  id: '/via-loader',\n  path: '/via-loader',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst RedirectTargetViaBeforeLoadRoute =\n  RedirectTargetViaBeforeLoadRouteImport.update({\n    id: '/via-beforeLoad',\n    path: '/via-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetDestinationRoute =\n  RedirectTargetDestinationRouteImport.update({\n    id: '/destination',\n    path: '/destination',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({\n  id: '/posts_/$postId/edit',\n  path: '/posts/$postId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutLayoutChildRoute =\n  PathlessLayoutLayoutChildRouteImport.update({\n    id: '/child',\n    path: '/child',\n    getParentRoute: () => PathlessLayoutLayoutRouteRoute,\n  } as any)\nconst ParamsSingleValueRoute = ParamsSingleValueRouteImport.update({\n  id: '/params/single/$value',\n  path: '/params/single/$value',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsPsWildcardChar123Char125suffixAtChar45824Route =\n  ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport.update({\n    id: '/params-ps/wildcard/{$}suffix@대',\n    path: '/params-ps/wildcard/{$}suffix@대',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsWildcardChar123Char125suffixRoute =\n  ParamsPsWildcardChar123Char125suffixRouteImport.update({\n    id: '/params-ps/wildcard/{$}suffix',\n    path: '/params-ps/wildcard/{$}suffix',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsWildcardPrefixChar123Char125Route =\n  ParamsPsWildcardPrefixChar123Char125RouteImport.update({\n    id: '/params-ps/wildcard/prefix{$}',\n    path: '/params-ps/wildcard/prefix{$}',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsWildcardPrefixAtChar45824Char123Char125Route =\n  ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport.update({\n    id: '/params-ps/wildcard/prefix@대{$}',\n    path: '/params-ps/wildcard/prefix@대{$}',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsWildcardSplatRoute = ParamsPsWildcardSplatRouteImport.update({\n  id: '/params-ps/wildcard/$',\n  path: '/params-ps/wildcard/$',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsPsNamedChar123fooChar125suffixRoute =\n  ParamsPsNamedChar123fooChar125suffixRouteImport.update({\n    id: '/params-ps/named/{$foo}suffix',\n    path: '/params-ps/named/{$foo}suffix',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsNamedPrefixChar123fooChar125Route =\n  ParamsPsNamedPrefixChar123fooChar125RouteImport.update({\n    id: '/params-ps/named/prefix{$foo}',\n    path: '/params-ps/named/prefix{$foo}',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MasksPublicUsernameRoute = MasksPublicUsernameRouteImport.update({\n  id: '/public/$username',\n  path: '/public/$username',\n  getParentRoute: () => MasksRoute,\n} as any)\nconst MasksAdminUserIdRoute = MasksAdminUserIdRouteImport.update({\n  id: '/admin/$userId',\n  path: '/admin/$userId',\n  getParentRoute: () => MasksRoute,\n} as any)\nconst FullpathTestLayoutIdRoute = FullpathTestLayoutIdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => FullpathTestLayoutRouteRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst groupSubfolderInsideRoute = groupSubfolderInsideRouteImport.update({\n  id: '/(group)/subfolder/inside',\n  path: '/subfolder/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({\n  id: '/insidelayout',\n  path: '/insidelayout',\n  getParentRoute: () => groupLayoutRoute,\n} as any)\nconst ParamsPsStrictFalseVersionRouteRoute =\n  ParamsPsStrictFalseVersionRouteRouteImport.update({\n    id: '/$version',\n    path: '/$version',\n    getParentRoute: () => ParamsPsStrictFalseRouteRoute,\n  } as any)\nconst ParamsPsNonNestedFooRouteRoute =\n  ParamsPsNonNestedFooRouteRouteImport.update({\n    id: '/$foo_',\n    path: '/$foo',\n    getParentRoute: () => ParamsPsNonNestedRouteRoute,\n  } as any)\nconst ParamsPsNamedFooRouteRoute = ParamsPsNamedFooRouteRouteImport.update({\n  id: '/params-ps/named/$foo',\n  path: '/params-ps/named/$foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NonNestedSuffixChar123bazChar125suffixRouteRoute =\n  NonNestedSuffixChar123bazChar125suffixRouteRouteImport.update({\n    id: '/{$baz}suffix',\n    path: '/{$baz}suffix',\n    getParentRoute: () => NonNestedSuffixRouteRoute,\n  } as any)\nconst NonNestedPrefixPrefixChar123bazChar125RouteRoute =\n  NonNestedPrefixPrefixChar123bazChar125RouteRouteImport.update({\n    id: '/prefix{$baz}',\n    path: '/prefix{$baz}',\n    getParentRoute: () => NonNestedPrefixRouteRoute,\n  } as any)\nconst NonNestedPathBazRouteRoute = NonNestedPathBazRouteRouteImport.update({\n  id: '/baz',\n  path: '/baz',\n  getParentRoute: () => NonNestedPathRouteRoute,\n} as any)\nconst NonNestedNamedBazRouteRoute = NonNestedNamedBazRouteRouteImport.update({\n  id: '/$baz',\n  path: '/$baz',\n  getParentRoute: () => NonNestedNamedRouteRoute,\n} as any)\nconst NonNestedDeepBazRouteRoute = NonNestedDeepBazRouteRouteImport.update({\n  id: '/$baz',\n  path: '/$baz',\n  getParentRoute: () => NonNestedDeepRouteRoute,\n} as any)\nconst RelativeUseNavigateWithSearchIndexRoute =\n  RelativeUseNavigateWithSearchIndexRouteImport.update({\n    id: '/with-search/',\n    path: '/with-search/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeUseNavigatePathIndexRoute =\n  RelativeUseNavigatePathIndexRouteImport.update({\n    id: '/path/',\n    path: '/path/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeUseNavigateNestedIndexRoute =\n  RelativeUseNavigateNestedIndexRouteImport.update({\n    id: '/nested/',\n    path: '/nested/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeLinkWithSearchIndexRoute =\n  RelativeLinkWithSearchIndexRouteImport.update({\n    id: '/with-search/',\n    path: '/with-search/',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst RelativeLinkPathIndexRoute = RelativeLinkPathIndexRouteImport.update({\n  id: '/path/',\n  path: '/path/',\n  getParentRoute: () => RelativeLinkRouteRoute,\n} as any)\nconst RelativeLinkNestedIndexRoute = RelativeLinkNestedIndexRouteImport.update({\n  id: '/nested/',\n  path: '/nested/',\n  getParentRoute: () => RelativeLinkRouteRoute,\n} as any)\nconst NonNestedSuffixChar123bazChar125suffixIndexRoute =\n  NonNestedSuffixChar123bazChar125suffixIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,\n  } as any)\nconst NonNestedPrefixPrefixChar123bazChar125IndexRoute =\n  NonNestedPrefixPrefixChar123bazChar125IndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,\n  } as any)\nconst NonNestedPathBazIndexRoute = NonNestedPathBazIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NonNestedPathBazRouteRoute,\n} as any)\nconst NonNestedNamedBazIndexRoute = NonNestedNamedBazIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NonNestedNamedBazRouteRoute,\n} as any)\nconst NonNestedDeepBazIndexRoute = NonNestedDeepBazIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NonNestedDeepBazRouteRoute,\n} as any)\nconst ParamsPsNonNestedFooBarRoute = ParamsPsNonNestedFooBarRouteImport.update({\n  id: '/$bar',\n  path: '/$bar',\n  getParentRoute: () => ParamsPsNonNestedFooRouteRoute,\n} as any)\nconst NonNestedSuffixChar123bazChar125suffixBarRoute =\n  NonNestedSuffixChar123bazChar125suffixBarRouteImport.update({\n    id: '/{$baz}suffix_/bar',\n    path: '/{$baz}suffix/bar',\n    getParentRoute: () => NonNestedSuffixRouteRoute,\n  } as any)\nconst NonNestedSuffixChar123bazChar125suffixFooRoute =\n  NonNestedSuffixChar123bazChar125suffixFooRouteImport.update({\n    id: '/foo',\n    path: '/foo',\n    getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,\n  } as any)\nconst NonNestedPrefixPrefixChar123bazChar125BarRoute =\n  NonNestedPrefixPrefixChar123bazChar125BarRouteImport.update({\n    id: '/prefix{$baz}_/bar',\n    path: '/prefix{$baz}/bar',\n    getParentRoute: () => NonNestedPrefixRouteRoute,\n  } as any)\nconst NonNestedPrefixPrefixChar123bazChar125FooRoute =\n  NonNestedPrefixPrefixChar123bazChar125FooRouteImport.update({\n    id: '/foo',\n    path: '/foo',\n    getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,\n  } as any)\nconst NonNestedPathBazBarRoute = NonNestedPathBazBarRouteImport.update({\n  id: '/baz_/bar',\n  path: '/baz/bar',\n  getParentRoute: () => NonNestedPathRouteRoute,\n} as any)\nconst NonNestedPathBazFooRoute = NonNestedPathBazFooRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => NonNestedPathBazRouteRoute,\n} as any)\nconst NonNestedNamedBazBarRoute = NonNestedNamedBazBarRouteImport.update({\n  id: '/$baz_/bar',\n  path: '/$baz/bar',\n  getParentRoute: () => NonNestedNamedRouteRoute,\n} as any)\nconst NonNestedNamedBazFooRoute = NonNestedNamedBazFooRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => NonNestedNamedBazRouteRoute,\n} as any)\nconst ParamsPsNamedFooBarRouteRoute =\n  ParamsPsNamedFooBarRouteRouteImport.update({\n    id: '/$bar',\n    path: '/$bar',\n    getParentRoute: () => ParamsPsNamedFooRouteRoute,\n  } as any)\nconst NonNestedDeepBazBarRouteRoute =\n  NonNestedDeepBazBarRouteRouteImport.update({\n    id: '/$baz_/bar',\n    path: '/$baz/bar',\n    getParentRoute: () => NonNestedDeepRouteRoute,\n  } as any)\nconst RelativeUseNavigatePathPathIndexRoute =\n  RelativeUseNavigatePathPathIndexRouteImport.update({\n    id: '/path/$path/',\n    path: '/path/$path/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeUseNavigateNestedDeepIndexRoute =\n  RelativeUseNavigateNestedDeepIndexRouteImport.update({\n    id: '/nested/deep/',\n    path: '/nested/deep/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeLinkPathPathIndexRoute =\n  RelativeLinkPathPathIndexRouteImport.update({\n    id: '/path/$path/',\n    path: '/path/$path/',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst RelativeLinkNestedDeepIndexRoute =\n  RelativeLinkNestedDeepIndexRouteImport.update({\n    id: '/nested/deep/',\n    path: '/nested/deep/',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst NonNestedDeepBazBarIndexRoute =\n  NonNestedDeepBazBarIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NonNestedDeepBazBarRouteRoute,\n  } as any)\nconst ParamsPsNamedFooBarBazRoute = ParamsPsNamedFooBarBazRouteImport.update({\n  id: '/$baz',\n  path: '/$baz',\n  getParentRoute: () => ParamsPsNamedFooBarRouteRoute,\n} as any)\nconst NonNestedDeepBazBarQuxRoute = NonNestedDeepBazBarQuxRouteImport.update({\n  id: '/$baz_/bar_/qux',\n  path: '/$baz/bar/qux',\n  getParentRoute: () => NonNestedDeepRouteRoute,\n} as any)\nconst NonNestedDeepBazBarFooRouteRoute =\n  NonNestedDeepBazBarFooRouteRouteImport.update({\n    id: '/$foo',\n    path: '/$foo',\n    getParentRoute: () => NonNestedDeepBazBarRouteRoute,\n  } as any)\nconst NonNestedDeepBazBarFooIndexRoute =\n  NonNestedDeepBazBarFooIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NonNestedDeepBazBarFooRouteRoute,\n  } as any)\nconst NonNestedDeepBazBarFooQuxRoute =\n  NonNestedDeepBazBarFooQuxRouteImport.update({\n    id: '/$foo_/qux',\n    path: '/$foo/qux',\n    getParentRoute: () => NonNestedDeepBazBarRouteRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/fullpath-test': typeof FullpathTestLayoutRouteRouteWithChildren\n  '/non-nested': typeof NonNestedRouteRouteWithChildren\n  '/pathless-layout': typeof PathlessLayoutLayoutRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren\n  '/anchor': typeof AnchorRoute\n  '/component-types-test': typeof ComponentTypesTestRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/hover-preload-hash': typeof HoverPreloadHashRoute\n  '/lazy-error': typeof LazyErrorRoute\n  '/masks': typeof MasksRouteWithChildren\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren\n  '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren\n  '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren\n  '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren\n  '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren\n  '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren\n  '/params-ps/strict-false': typeof ParamsPsStrictFalseRouteRouteWithChildren\n  '/relative/link': typeof RelativeLinkRouteRouteWithChildren\n  '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/structural-sharing/$enabled': typeof StructuralSharingEnabledRoute\n  '/params-ps/': typeof ParamsPsIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/relative/': typeof RelativeIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/non-nested/deep/$baz': typeof NonNestedDeepBazRouteRouteWithChildren\n  '/non-nested/named/$baz': typeof NonNestedNamedBazRouteRouteWithChildren\n  '/non-nested/path/baz': typeof NonNestedPathBazRouteRouteWithChildren\n  '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren\n  '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren\n  '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren\n  '/params-ps/non-nested/$foo': typeof ParamsPsNonNestedFooRouteRouteWithChildren\n  '/params-ps/strict-false/$version': typeof ParamsPsStrictFalseVersionRouteRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/fullpath-test/$id': typeof FullpathTestLayoutIdRoute\n  '/masks/admin/$userId': typeof MasksAdminUserIdRoute\n  '/masks/public/$username': typeof MasksPublicUsernameRoute\n  '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route\n  '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute\n  '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute\n  '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route\n  '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route\n  '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute\n  '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route\n  '/params/single/$value': typeof ParamsSingleValueRoute\n  '/pathless-layout/child': typeof PathlessLayoutLayoutChildRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n  '/redirect/$target/destination': typeof RedirectTargetDestinationRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/redirect/$target/via-route-redirect-beforeLoad': typeof RedirectTargetViaRouteRedirectBeforeLoadRoute\n  '/redirect/$target/via-route-redirect-loader': typeof RedirectTargetViaRouteRedirectLoaderRoute\n  '/redirect/$target/via-routeApi-redirect-beforeLoad': typeof RedirectTargetViaRouteApiRedirectBeforeLoadRoute\n  '/redirect/$target/via-routeApi-redirect-loader': typeof RedirectTargetViaRouteApiRedirectLoaderRoute\n  '/redirect/preload/first': typeof RedirectPreloadFirstRoute\n  '/redirect/preload/second': typeof RedirectPreloadSecondRoute\n  '/redirect/preload/third': typeof RedirectPreloadThirdRoute\n  '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute\n  '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute\n  '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute\n  '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute\n  '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute\n  '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute\n  '/fullpath-test/': typeof FullpathTestLayoutIndexRoute\n  '/params-ps/named/': typeof ParamsPsNamedIndexRoute\n  '/params-ps/wildcard/': typeof ParamsPsWildcardIndexRoute\n  '/pathless-layout/': typeof PathlessLayoutLayoutIndexRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/non-nested/deep/$baz/bar': typeof NonNestedDeepBazBarRouteRouteWithChildren\n  '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren\n  '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute\n  '/non-nested/named/$baz/bar': typeof NonNestedNamedBazBarRoute\n  '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute\n  '/non-nested/path/baz/bar': typeof NonNestedPathBazBarRoute\n  '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute\n  '/non-nested/prefix/prefix{$baz}/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute\n  '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute\n  '/non-nested/suffix/{$baz}suffix/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute\n  '/params-ps/non-nested/$foo/$bar': typeof ParamsPsNonNestedFooBarRoute\n  '/non-nested/deep/$baz/': typeof NonNestedDeepBazIndexRoute\n  '/non-nested/named/$baz/': typeof NonNestedNamedBazIndexRoute\n  '/non-nested/path/baz/': typeof NonNestedPathBazIndexRoute\n  '/non-nested/prefix/prefix{$baz}/': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute\n  '/non-nested/suffix/{$baz}suffix/': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute\n  '/relative/link/nested/': typeof RelativeLinkNestedIndexRoute\n  '/relative/link/path/': typeof RelativeLinkPathIndexRoute\n  '/relative/link/with-search/': typeof RelativeLinkWithSearchIndexRoute\n  '/relative/useNavigate/nested/': typeof RelativeUseNavigateNestedIndexRoute\n  '/relative/useNavigate/path/': typeof RelativeUseNavigatePathIndexRoute\n  '/relative/useNavigate/with-search/': typeof RelativeUseNavigateWithSearchIndexRoute\n  '/non-nested/deep/$baz/bar/$foo': typeof NonNestedDeepBazBarFooRouteRouteWithChildren\n  '/non-nested/deep/$baz/bar/qux': typeof NonNestedDeepBazBarQuxRoute\n  '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute\n  '/non-nested/deep/$baz/bar/': typeof NonNestedDeepBazBarIndexRoute\n  '/relative/link/nested/deep/': typeof RelativeLinkNestedDeepIndexRoute\n  '/relative/link/path/$path/': typeof RelativeLinkPathPathIndexRoute\n  '/relative/useNavigate/nested/deep/': typeof RelativeUseNavigateNestedDeepIndexRoute\n  '/relative/useNavigate/path/$path/': typeof RelativeUseNavigatePathPathIndexRoute\n  '/non-nested/deep/$baz/bar/$foo/qux': typeof NonNestedDeepBazBarFooQuxRoute\n  '/non-nested/deep/$baz/bar/$foo/': typeof NonNestedDeepBazBarFooIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/fullpath-test': typeof FullpathTestLayoutIndexRoute\n  '/non-nested': typeof NonNestedRouteRouteWithChildren\n  '/pathless-layout': typeof PathlessLayoutLayoutIndexRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren\n  '/anchor': typeof AnchorRoute\n  '/component-types-test': typeof ComponentTypesTestRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/hover-preload-hash': typeof HoverPreloadHashRoute\n  '/lazy-error': typeof LazyErrorRoute\n  '/masks': typeof MasksRouteWithChildren\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/remountDeps': typeof RemountDepsRoute\n  '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren\n  '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren\n  '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren\n  '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren\n  '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren\n  '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren\n  '/params-ps/strict-false': typeof ParamsPsStrictFalseRouteRouteWithChildren\n  '/relative/link': typeof RelativeLinkRouteRouteWithChildren\n  '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/structural-sharing/$enabled': typeof StructuralSharingEnabledRoute\n  '/params-ps': typeof ParamsPsIndexRoute\n  '/posts': typeof PostsIndexRoute\n  '/redirect': typeof RedirectIndexRoute\n  '/relative': typeof RelativeIndexRoute\n  '/search-params': typeof SearchParamsIndexRoute\n  '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren\n  '/params-ps/non-nested/$foo': typeof ParamsPsNonNestedFooRouteRouteWithChildren\n  '/params-ps/strict-false/$version': typeof ParamsPsStrictFalseVersionRouteRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/fullpath-test/$id': typeof FullpathTestLayoutIdRoute\n  '/masks/admin/$userId': typeof MasksAdminUserIdRoute\n  '/masks/public/$username': typeof MasksPublicUsernameRoute\n  '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route\n  '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute\n  '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute\n  '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route\n  '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route\n  '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute\n  '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route\n  '/params/single/$value': typeof ParamsSingleValueRoute\n  '/pathless-layout/child': typeof PathlessLayoutLayoutChildRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n  '/redirect/$target/destination': typeof RedirectTargetDestinationRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/redirect/$target/via-route-redirect-beforeLoad': typeof RedirectTargetViaRouteRedirectBeforeLoadRoute\n  '/redirect/$target/via-route-redirect-loader': typeof RedirectTargetViaRouteRedirectLoaderRoute\n  '/redirect/$target/via-routeApi-redirect-beforeLoad': typeof RedirectTargetViaRouteApiRedirectBeforeLoadRoute\n  '/redirect/$target/via-routeApi-redirect-loader': typeof RedirectTargetViaRouteApiRedirectLoaderRoute\n  '/redirect/preload/first': typeof RedirectPreloadFirstRoute\n  '/redirect/preload/second': typeof RedirectPreloadSecondRoute\n  '/redirect/preload/third': typeof RedirectPreloadThirdRoute\n  '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute\n  '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute\n  '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute\n  '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute\n  '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute\n  '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute\n  '/params-ps/named': typeof ParamsPsNamedIndexRoute\n  '/params-ps/wildcard': typeof ParamsPsWildcardIndexRoute\n  '/redirect/$target': typeof RedirectTargetIndexRoute\n  '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren\n  '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute\n  '/non-nested/named/$baz/bar': typeof NonNestedNamedBazBarRoute\n  '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute\n  '/non-nested/path/baz/bar': typeof NonNestedPathBazBarRoute\n  '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute\n  '/non-nested/prefix/prefix{$baz}/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute\n  '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute\n  '/non-nested/suffix/{$baz}suffix/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute\n  '/params-ps/non-nested/$foo/$bar': typeof ParamsPsNonNestedFooBarRoute\n  '/non-nested/deep/$baz': typeof NonNestedDeepBazIndexRoute\n  '/non-nested/named/$baz': typeof NonNestedNamedBazIndexRoute\n  '/non-nested/path/baz': typeof NonNestedPathBazIndexRoute\n  '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute\n  '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute\n  '/relative/link/nested': typeof RelativeLinkNestedIndexRoute\n  '/relative/link/path': typeof RelativeLinkPathIndexRoute\n  '/relative/link/with-search': typeof RelativeLinkWithSearchIndexRoute\n  '/relative/useNavigate/nested': typeof RelativeUseNavigateNestedIndexRoute\n  '/relative/useNavigate/path': typeof RelativeUseNavigatePathIndexRoute\n  '/relative/useNavigate/with-search': typeof RelativeUseNavigateWithSearchIndexRoute\n  '/non-nested/deep/$baz/bar/qux': typeof NonNestedDeepBazBarQuxRoute\n  '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute\n  '/non-nested/deep/$baz/bar': typeof NonNestedDeepBazBarIndexRoute\n  '/relative/link/nested/deep': typeof RelativeLinkNestedDeepIndexRoute\n  '/relative/link/path/$path': typeof RelativeLinkPathPathIndexRoute\n  '/relative/useNavigate/nested/deep': typeof RelativeUseNavigateNestedDeepIndexRoute\n  '/relative/useNavigate/path/$path': typeof RelativeUseNavigatePathPathIndexRoute\n  '/non-nested/deep/$baz/bar/$foo/qux': typeof NonNestedDeepBazBarFooQuxRoute\n  '/non-nested/deep/$baz/bar/$foo': typeof NonNestedDeepBazBarFooIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/fullpath-test': typeof FullpathTestRouteRouteWithChildren\n  '/non-nested': typeof NonNestedRouteRouteWithChildren\n  '/pathless-layout': typeof PathlessLayoutRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren\n  '/_layout': typeof LayoutRouteWithChildren\n  '/anchor': typeof AnchorRoute\n  '/component-types-test': typeof ComponentTypesTestRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/hover-preload-hash': typeof HoverPreloadHashRoute\n  '/lazy-error': typeof LazyErrorRoute\n  '/masks': typeof MasksRouteWithChildren\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/fullpath-test/_layout': typeof FullpathTestLayoutRouteRouteWithChildren\n  '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren\n  '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren\n  '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren\n  '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren\n  '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren\n  '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren\n  '/params-ps/strict-false': typeof ParamsPsStrictFalseRouteRouteWithChildren\n  '/pathless-layout/_layout': typeof PathlessLayoutLayoutRouteRouteWithChildren\n  '/relative/link': typeof RelativeLinkRouteRouteWithChildren\n  '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren\n  '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/inside': typeof groupInsideRoute\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/structural-sharing/$enabled': typeof StructuralSharingEnabledRoute\n  '/params-ps/': typeof ParamsPsIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/relative/': typeof RelativeIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/non-nested/deep/$baz': typeof NonNestedDeepBazRouteRouteWithChildren\n  '/non-nested/named/$baz': typeof NonNestedNamedBazRouteRouteWithChildren\n  '/non-nested/path/baz': typeof NonNestedPathBazRouteRouteWithChildren\n  '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren\n  '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren\n  '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren\n  '/params-ps/non-nested/$foo_': typeof ParamsPsNonNestedFooRouteRouteWithChildren\n  '/params-ps/strict-false/$version': typeof ParamsPsStrictFalseVersionRouteRoute\n  '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/fullpath-test/_layout/$id': typeof FullpathTestLayoutIdRoute\n  '/masks/admin/$userId': typeof MasksAdminUserIdRoute\n  '/masks/public/$username': typeof MasksPublicUsernameRoute\n  '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route\n  '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute\n  '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute\n  '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route\n  '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route\n  '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute\n  '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route\n  '/params/single/$value': typeof ParamsSingleValueRoute\n  '/pathless-layout/_layout/child': typeof PathlessLayoutLayoutChildRoute\n  '/posts_/$postId/edit': typeof PostsPostIdEditRoute\n  '/redirect/$target/destination': typeof RedirectTargetDestinationRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/redirect/$target/via-route-redirect-beforeLoad': typeof RedirectTargetViaRouteRedirectBeforeLoadRoute\n  '/redirect/$target/via-route-redirect-loader': typeof RedirectTargetViaRouteRedirectLoaderRoute\n  '/redirect/$target/via-routeApi-redirect-beforeLoad': typeof RedirectTargetViaRouteApiRedirectBeforeLoadRoute\n  '/redirect/$target/via-routeApi-redirect-loader': typeof RedirectTargetViaRouteApiRedirectLoaderRoute\n  '/redirect/preload/first': typeof RedirectPreloadFirstRoute\n  '/redirect/preload/second': typeof RedirectPreloadSecondRoute\n  '/redirect/preload/third': typeof RedirectPreloadThirdRoute\n  '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute\n  '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute\n  '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute\n  '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute\n  '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute\n  '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute\n  '/fullpath-test/_layout/': typeof FullpathTestLayoutIndexRoute\n  '/params-ps/named/': typeof ParamsPsNamedIndexRoute\n  '/params-ps/wildcard/': typeof ParamsPsWildcardIndexRoute\n  '/pathless-layout/_layout/': typeof PathlessLayoutLayoutIndexRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/non-nested/deep/$baz_/bar': typeof NonNestedDeepBazBarRouteRouteWithChildren\n  '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren\n  '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute\n  '/non-nested/named/$baz_/bar': typeof NonNestedNamedBazBarRoute\n  '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute\n  '/non-nested/path/baz_/bar': typeof NonNestedPathBazBarRoute\n  '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute\n  '/non-nested/prefix/prefix{$baz}_/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute\n  '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute\n  '/non-nested/suffix/{$baz}suffix_/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute\n  '/params-ps/non-nested/$foo_/$bar': typeof ParamsPsNonNestedFooBarRoute\n  '/non-nested/deep/$baz/': typeof NonNestedDeepBazIndexRoute\n  '/non-nested/named/$baz/': typeof NonNestedNamedBazIndexRoute\n  '/non-nested/path/baz/': typeof NonNestedPathBazIndexRoute\n  '/non-nested/prefix/prefix{$baz}/': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute\n  '/non-nested/suffix/{$baz}suffix/': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute\n  '/relative/link/nested/': typeof RelativeLinkNestedIndexRoute\n  '/relative/link/path/': typeof RelativeLinkPathIndexRoute\n  '/relative/link/with-search/': typeof RelativeLinkWithSearchIndexRoute\n  '/relative/useNavigate/nested/': typeof RelativeUseNavigateNestedIndexRoute\n  '/relative/useNavigate/path/': typeof RelativeUseNavigatePathIndexRoute\n  '/relative/useNavigate/with-search/': typeof RelativeUseNavigateWithSearchIndexRoute\n  '/non-nested/deep/$baz_/bar/$foo': typeof NonNestedDeepBazBarFooRouteRouteWithChildren\n  '/non-nested/deep/$baz_/bar_/qux': typeof NonNestedDeepBazBarQuxRoute\n  '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute\n  '/non-nested/deep/$baz_/bar/': typeof NonNestedDeepBazBarIndexRoute\n  '/relative/link/nested/deep/': typeof RelativeLinkNestedDeepIndexRoute\n  '/relative/link/path/$path/': typeof RelativeLinkPathPathIndexRoute\n  '/relative/useNavigate/nested/deep/': typeof RelativeUseNavigateNestedDeepIndexRoute\n  '/relative/useNavigate/path/$path/': typeof RelativeUseNavigatePathPathIndexRoute\n  '/non-nested/deep/$baz_/bar/$foo_/qux': typeof NonNestedDeepBazBarFooQuxRoute\n  '/non-nested/deep/$baz_/bar/$foo/': typeof NonNestedDeepBazBarFooIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/fullpath-test'\n    | '/non-nested'\n    | '/pathless-layout'\n    | '/search-params'\n    | '/대한민국'\n    | '/anchor'\n    | '/component-types-test'\n    | '/editing-a'\n    | '/editing-b'\n    | '/hover-preload-hash'\n    | '/lazy-error'\n    | '/masks'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/non-nested/deep'\n    | '/non-nested/named'\n    | '/non-nested/path'\n    | '/non-nested/prefix'\n    | '/non-nested/suffix'\n    | '/params-ps/non-nested'\n    | '/params-ps/strict-false'\n    | '/relative/link'\n    | '/relative/useNavigate'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/structural-sharing/$enabled'\n    | '/params-ps/'\n    | '/posts/'\n    | '/redirect/'\n    | '/relative/'\n    | '/search-params/'\n    | '/non-nested/deep/$baz'\n    | '/non-nested/named/$baz'\n    | '/non-nested/path/baz'\n    | '/non-nested/prefix/prefix{$baz}'\n    | '/non-nested/suffix/{$baz}suffix'\n    | '/params-ps/named/$foo'\n    | '/params-ps/non-nested/$foo'\n    | '/params-ps/strict-false/$version'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/fullpath-test/$id'\n    | '/masks/admin/$userId'\n    | '/masks/public/$username'\n    | '/params-ps/named/prefix{$foo}'\n    | '/params-ps/named/{$foo}suffix'\n    | '/params-ps/wildcard/$'\n    | '/params-ps/wildcard/prefix@대{$}'\n    | '/params-ps/wildcard/prefix{$}'\n    | '/params-ps/wildcard/{$}suffix'\n    | '/params-ps/wildcard/{$}suffix@대'\n    | '/params/single/$value'\n    | '/pathless-layout/child'\n    | '/posts/$postId/edit'\n    | '/redirect/$target/destination'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/redirect/$target/via-route-redirect-beforeLoad'\n    | '/redirect/$target/via-route-redirect-loader'\n    | '/redirect/$target/via-routeApi-redirect-beforeLoad'\n    | '/redirect/$target/via-routeApi-redirect-loader'\n    | '/redirect/preload/first'\n    | '/redirect/preload/second'\n    | '/redirect/preload/third'\n    | '/relative/link/relative-link-a'\n    | '/relative/link/relative-link-b'\n    | '/relative/useNavigate/relative-useNavigate-a'\n    | '/relative/useNavigate/relative-useNavigate-b'\n    | '/대한민국/wildcard/$'\n    | '/대한민국/🚀/$id'\n    | '/fullpath-test/'\n    | '/params-ps/named/'\n    | '/params-ps/wildcard/'\n    | '/pathless-layout/'\n    | '/redirect/$target/'\n    | '/non-nested/deep/$baz/bar'\n    | '/params-ps/named/$foo/$bar'\n    | '/non-nested/named/$baz/foo'\n    | '/non-nested/named/$baz/bar'\n    | '/non-nested/path/baz/foo'\n    | '/non-nested/path/baz/bar'\n    | '/non-nested/prefix/prefix{$baz}/foo'\n    | '/non-nested/prefix/prefix{$baz}/bar'\n    | '/non-nested/suffix/{$baz}suffix/foo'\n    | '/non-nested/suffix/{$baz}suffix/bar'\n    | '/params-ps/non-nested/$foo/$bar'\n    | '/non-nested/deep/$baz/'\n    | '/non-nested/named/$baz/'\n    | '/non-nested/path/baz/'\n    | '/non-nested/prefix/prefix{$baz}/'\n    | '/non-nested/suffix/{$baz}suffix/'\n    | '/relative/link/nested/'\n    | '/relative/link/path/'\n    | '/relative/link/with-search/'\n    | '/relative/useNavigate/nested/'\n    | '/relative/useNavigate/path/'\n    | '/relative/useNavigate/with-search/'\n    | '/non-nested/deep/$baz/bar/$foo'\n    | '/non-nested/deep/$baz/bar/qux'\n    | '/params-ps/named/$foo/$bar/$baz'\n    | '/non-nested/deep/$baz/bar/'\n    | '/relative/link/nested/deep/'\n    | '/relative/link/path/$path/'\n    | '/relative/useNavigate/nested/deep/'\n    | '/relative/useNavigate/path/$path/'\n    | '/non-nested/deep/$baz/bar/$foo/qux'\n    | '/non-nested/deep/$baz/bar/$foo/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/fullpath-test'\n    | '/non-nested'\n    | '/pathless-layout'\n    | '/대한민국'\n    | '/anchor'\n    | '/component-types-test'\n    | '/editing-a'\n    | '/editing-b'\n    | '/hover-preload-hash'\n    | '/lazy-error'\n    | '/masks'\n    | '/notRemountDeps'\n    | '/remountDeps'\n    | '/non-nested/deep'\n    | '/non-nested/named'\n    | '/non-nested/path'\n    | '/non-nested/prefix'\n    | '/non-nested/suffix'\n    | '/params-ps/non-nested'\n    | '/params-ps/strict-false'\n    | '/relative/link'\n    | '/relative/useNavigate'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/search-params/default'\n    | '/structural-sharing/$enabled'\n    | '/params-ps'\n    | '/posts'\n    | '/redirect'\n    | '/relative'\n    | '/search-params'\n    | '/params-ps/named/$foo'\n    | '/params-ps/non-nested/$foo'\n    | '/params-ps/strict-false/$version'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/fullpath-test/$id'\n    | '/masks/admin/$userId'\n    | '/masks/public/$username'\n    | '/params-ps/named/prefix{$foo}'\n    | '/params-ps/named/{$foo}suffix'\n    | '/params-ps/wildcard/$'\n    | '/params-ps/wildcard/prefix@대{$}'\n    | '/params-ps/wildcard/prefix{$}'\n    | '/params-ps/wildcard/{$}suffix'\n    | '/params-ps/wildcard/{$}suffix@대'\n    | '/params/single/$value'\n    | '/pathless-layout/child'\n    | '/posts/$postId/edit'\n    | '/redirect/$target/destination'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/redirect/$target/via-route-redirect-beforeLoad'\n    | '/redirect/$target/via-route-redirect-loader'\n    | '/redirect/$target/via-routeApi-redirect-beforeLoad'\n    | '/redirect/$target/via-routeApi-redirect-loader'\n    | '/redirect/preload/first'\n    | '/redirect/preload/second'\n    | '/redirect/preload/third'\n    | '/relative/link/relative-link-a'\n    | '/relative/link/relative-link-b'\n    | '/relative/useNavigate/relative-useNavigate-a'\n    | '/relative/useNavigate/relative-useNavigate-b'\n    | '/대한민국/wildcard/$'\n    | '/대한민국/🚀/$id'\n    | '/params-ps/named'\n    | '/params-ps/wildcard'\n    | '/redirect/$target'\n    | '/params-ps/named/$foo/$bar'\n    | '/non-nested/named/$baz/foo'\n    | '/non-nested/named/$baz/bar'\n    | '/non-nested/path/baz/foo'\n    | '/non-nested/path/baz/bar'\n    | '/non-nested/prefix/prefix{$baz}/foo'\n    | '/non-nested/prefix/prefix{$baz}/bar'\n    | '/non-nested/suffix/{$baz}suffix/foo'\n    | '/non-nested/suffix/{$baz}suffix/bar'\n    | '/params-ps/non-nested/$foo/$bar'\n    | '/non-nested/deep/$baz'\n    | '/non-nested/named/$baz'\n    | '/non-nested/path/baz'\n    | '/non-nested/prefix/prefix{$baz}'\n    | '/non-nested/suffix/{$baz}suffix'\n    | '/relative/link/nested'\n    | '/relative/link/path'\n    | '/relative/link/with-search'\n    | '/relative/useNavigate/nested'\n    | '/relative/useNavigate/path'\n    | '/relative/useNavigate/with-search'\n    | '/non-nested/deep/$baz/bar/qux'\n    | '/params-ps/named/$foo/$bar/$baz'\n    | '/non-nested/deep/$baz/bar'\n    | '/relative/link/nested/deep'\n    | '/relative/link/path/$path'\n    | '/relative/useNavigate/nested/deep'\n    | '/relative/useNavigate/path/$path'\n    | '/non-nested/deep/$baz/bar/$foo/qux'\n    | '/non-nested/deep/$baz/bar/$foo'\n  id:\n    | '__root__'\n    | '/'\n    | '/fullpath-test'\n    | '/non-nested'\n    | '/pathless-layout'\n    | '/search-params'\n    | '/대한민국'\n    | '/_layout'\n    | '/anchor'\n    | '/component-types-test'\n    | '/editing-a'\n    | '/editing-b'\n    | '/hover-preload-hash'\n    | '/lazy-error'\n    | '/masks'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/fullpath-test/_layout'\n    | '/non-nested/deep'\n    | '/non-nested/named'\n    | '/non-nested/path'\n    | '/non-nested/prefix'\n    | '/non-nested/suffix'\n    | '/params-ps/non-nested'\n    | '/params-ps/strict-false'\n    | '/pathless-layout/_layout'\n    | '/relative/link'\n    | '/relative/useNavigate'\n    | '/(another-group)/onlyrouteinside'\n    | '/(group)/_layout'\n    | '/(group)/inside'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/structural-sharing/$enabled'\n    | '/params-ps/'\n    | '/posts/'\n    | '/redirect/'\n    | '/relative/'\n    | '/search-params/'\n    | '/non-nested/deep/$baz'\n    | '/non-nested/named/$baz'\n    | '/non-nested/path/baz'\n    | '/non-nested/prefix/prefix{$baz}'\n    | '/non-nested/suffix/{$baz}suffix'\n    | '/params-ps/named/$foo'\n    | '/params-ps/non-nested/$foo_'\n    | '/params-ps/strict-false/$version'\n    | '/(group)/_layout/insidelayout'\n    | '/(group)/subfolder/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/fullpath-test/_layout/$id'\n    | '/masks/admin/$userId'\n    | '/masks/public/$username'\n    | '/params-ps/named/prefix{$foo}'\n    | '/params-ps/named/{$foo}suffix'\n    | '/params-ps/wildcard/$'\n    | '/params-ps/wildcard/prefix@대{$}'\n    | '/params-ps/wildcard/prefix{$}'\n    | '/params-ps/wildcard/{$}suffix'\n    | '/params-ps/wildcard/{$}suffix@대'\n    | '/params/single/$value'\n    | '/pathless-layout/_layout/child'\n    | '/posts_/$postId/edit'\n    | '/redirect/$target/destination'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/redirect/$target/via-route-redirect-beforeLoad'\n    | '/redirect/$target/via-route-redirect-loader'\n    | '/redirect/$target/via-routeApi-redirect-beforeLoad'\n    | '/redirect/$target/via-routeApi-redirect-loader'\n    | '/redirect/preload/first'\n    | '/redirect/preload/second'\n    | '/redirect/preload/third'\n    | '/relative/link/relative-link-a'\n    | '/relative/link/relative-link-b'\n    | '/relative/useNavigate/relative-useNavigate-a'\n    | '/relative/useNavigate/relative-useNavigate-b'\n    | '/대한민국/wildcard/$'\n    | '/대한민국/🚀/$id'\n    | '/fullpath-test/_layout/'\n    | '/params-ps/named/'\n    | '/params-ps/wildcard/'\n    | '/pathless-layout/_layout/'\n    | '/redirect/$target/'\n    | '/non-nested/deep/$baz_/bar'\n    | '/params-ps/named/$foo/$bar'\n    | '/non-nested/named/$baz/foo'\n    | '/non-nested/named/$baz_/bar'\n    | '/non-nested/path/baz/foo'\n    | '/non-nested/path/baz_/bar'\n    | '/non-nested/prefix/prefix{$baz}/foo'\n    | '/non-nested/prefix/prefix{$baz}_/bar'\n    | '/non-nested/suffix/{$baz}suffix/foo'\n    | '/non-nested/suffix/{$baz}suffix_/bar'\n    | '/params-ps/non-nested/$foo_/$bar'\n    | '/non-nested/deep/$baz/'\n    | '/non-nested/named/$baz/'\n    | '/non-nested/path/baz/'\n    | '/non-nested/prefix/prefix{$baz}/'\n    | '/non-nested/suffix/{$baz}suffix/'\n    | '/relative/link/nested/'\n    | '/relative/link/path/'\n    | '/relative/link/with-search/'\n    | '/relative/useNavigate/nested/'\n    | '/relative/useNavigate/path/'\n    | '/relative/useNavigate/with-search/'\n    | '/non-nested/deep/$baz_/bar/$foo'\n    | '/non-nested/deep/$baz_/bar_/qux'\n    | '/params-ps/named/$foo/$bar/$baz'\n    | '/non-nested/deep/$baz_/bar/'\n    | '/relative/link/nested/deep/'\n    | '/relative/link/path/$path/'\n    | '/relative/useNavigate/nested/deep/'\n    | '/relative/useNavigate/path/$path/'\n    | '/non-nested/deep/$baz_/bar/$foo_/qux'\n    | '/non-nested/deep/$baz_/bar/$foo/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  FullpathTestRouteRoute: typeof FullpathTestRouteRouteWithChildren\n  NonNestedRouteRoute: typeof NonNestedRouteRouteWithChildren\n  PathlessLayoutRouteRoute: typeof PathlessLayoutRouteRouteWithChildren\n  SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren\n  Char45824Char54620Char48124Char44397RouteRoute: typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren\n  LayoutRoute: typeof LayoutRouteWithChildren\n  AnchorRoute: typeof AnchorRoute\n  ComponentTypesTestRoute: typeof ComponentTypesTestRoute\n  EditingARoute: typeof EditingARoute\n  EditingBRoute: typeof EditingBRoute\n  HoverPreloadHashRoute: typeof HoverPreloadHashRoute\n  LazyErrorRoute: typeof LazyErrorRoute\n  MasksRoute: typeof MasksRouteWithChildren\n  NotRemountDepsRoute: typeof NotRemountDepsRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RemountDepsRoute: typeof RemountDepsRoute\n  ParamsPsNonNestedRouteRoute: typeof ParamsPsNonNestedRouteRouteWithChildren\n  ParamsPsStrictFalseRouteRoute: typeof ParamsPsStrictFalseRouteRouteWithChildren\n  RelativeLinkRouteRoute: typeof RelativeLinkRouteRouteWithChildren\n  RelativeUseNavigateRouteRoute: typeof RelativeUseNavigateRouteRouteWithChildren\n  anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupInsideRoute: typeof groupInsideRoute\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n  RedirectTargetRoute: typeof RedirectTargetRouteWithChildren\n  StructuralSharingEnabledRoute: typeof StructuralSharingEnabledRoute\n  ParamsPsIndexRoute: typeof ParamsPsIndexRoute\n  RedirectIndexRoute: typeof RedirectIndexRoute\n  RelativeIndexRoute: typeof RelativeIndexRoute\n  ParamsPsNamedFooRouteRoute: typeof ParamsPsNamedFooRouteRouteWithChildren\n  groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute\n  ParamsPsNamedPrefixChar123fooChar125Route: typeof ParamsPsNamedPrefixChar123fooChar125Route\n  ParamsPsNamedChar123fooChar125suffixRoute: typeof ParamsPsNamedChar123fooChar125suffixRoute\n  ParamsPsWildcardSplatRoute: typeof ParamsPsWildcardSplatRoute\n  ParamsPsWildcardPrefixAtChar45824Char123Char125Route: typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route\n  ParamsPsWildcardPrefixChar123Char125Route: typeof ParamsPsWildcardPrefixChar123Char125Route\n  ParamsPsWildcardChar123Char125suffixRoute: typeof ParamsPsWildcardChar123Char125suffixRoute\n  ParamsPsWildcardChar123Char125suffixAtChar45824Route: typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route\n  ParamsSingleValueRoute: typeof ParamsSingleValueRoute\n  PostsPostIdEditRoute: typeof PostsPostIdEditRoute\n  RedirectPreloadFirstRoute: typeof RedirectPreloadFirstRoute\n  RedirectPreloadSecondRoute: typeof RedirectPreloadSecondRoute\n  RedirectPreloadThirdRoute: typeof RedirectPreloadThirdRoute\n  ParamsPsNamedIndexRoute: typeof ParamsPsNamedIndexRoute\n  ParamsPsWildcardIndexRoute: typeof ParamsPsWildcardIndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/remountDeps': {\n      id: '/remountDeps'\n      path: '/remountDeps'\n      fullPath: '/remountDeps'\n      preLoaderRoute: typeof RemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/notRemountDeps': {\n      id: '/notRemountDeps'\n      path: '/notRemountDeps'\n      fullPath: '/notRemountDeps'\n      preLoaderRoute: typeof NotRemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/masks': {\n      id: '/masks'\n      path: '/masks'\n      fullPath: '/masks'\n      preLoaderRoute: typeof MasksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/lazy-error': {\n      id: '/lazy-error'\n      path: '/lazy-error'\n      fullPath: '/lazy-error'\n      preLoaderRoute: typeof LazyErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/hover-preload-hash': {\n      id: '/hover-preload-hash'\n      path: '/hover-preload-hash'\n      fullPath: '/hover-preload-hash'\n      preLoaderRoute: typeof HoverPreloadHashRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-b': {\n      id: '/editing-b'\n      path: '/editing-b'\n      fullPath: '/editing-b'\n      preLoaderRoute: typeof EditingBRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-a': {\n      id: '/editing-a'\n      path: '/editing-a'\n      fullPath: '/editing-a'\n      preLoaderRoute: typeof EditingARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/component-types-test': {\n      id: '/component-types-test'\n      path: '/component-types-test'\n      fullPath: '/component-types-test'\n      preLoaderRoute: typeof ComponentTypesTestRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/anchor': {\n      id: '/anchor'\n      path: '/anchor'\n      fullPath: '/anchor'\n      preLoaderRoute: typeof AnchorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/대한민국': {\n      id: '/대한민국'\n      path: '/대한민국'\n      fullPath: '/대한민국'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params': {\n      id: '/search-params'\n      path: '/search-params'\n      fullPath: '/search-params'\n      preLoaderRoute: typeof SearchParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/pathless-layout': {\n      id: '/pathless-layout'\n      path: '/pathless-layout'\n      fullPath: '/pathless-layout'\n      preLoaderRoute: typeof PathlessLayoutRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/non-nested': {\n      id: '/non-nested'\n      path: '/non-nested'\n      fullPath: '/non-nested'\n      preLoaderRoute: typeof NonNestedRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/fullpath-test': {\n      id: '/fullpath-test'\n      path: '/fullpath-test'\n      fullPath: '/fullpath-test'\n      preLoaderRoute: typeof FullpathTestRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params/': {\n      id: '/search-params/'\n      path: '/'\n      fullPath: '/search-params/'\n      preLoaderRoute: typeof SearchParamsIndexRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/relative/': {\n      id: '/relative/'\n      path: '/relative'\n      fullPath: '/relative/'\n      preLoaderRoute: typeof RelativeIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect/': {\n      id: '/redirect/'\n      path: '/redirect'\n      fullPath: '/redirect/'\n      preLoaderRoute: typeof RedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/params-ps/': {\n      id: '/params-ps/'\n      path: '/params-ps'\n      fullPath: '/params-ps/'\n      preLoaderRoute: typeof ParamsPsIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/structural-sharing/$enabled': {\n      id: '/structural-sharing/$enabled'\n      path: '/structural-sharing/$enabled'\n      fullPath: '/structural-sharing/$enabled'\n      preLoaderRoute: typeof StructuralSharingEnabledRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params/default': {\n      id: '/search-params/default'\n      path: '/default'\n      fullPath: '/search-params/default'\n      preLoaderRoute: typeof SearchParamsDefaultRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/redirect/$target': {\n      id: '/redirect/$target'\n      path: '/redirect/$target'\n      fullPath: '/redirect/$target'\n      preLoaderRoute: typeof RedirectTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/inside': {\n      id: '/(group)/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(another-group)/onlyrouteinside': {\n      id: '/(another-group)/onlyrouteinside'\n      path: '/onlyrouteinside'\n      fullPath: '/onlyrouteinside'\n      preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/relative/useNavigate': {\n      id: '/relative/useNavigate'\n      path: '/relative/useNavigate'\n      fullPath: '/relative/useNavigate'\n      preLoaderRoute: typeof RelativeUseNavigateRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/relative/link': {\n      id: '/relative/link'\n      path: '/relative/link'\n      fullPath: '/relative/link'\n      preLoaderRoute: typeof RelativeLinkRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/pathless-layout/_layout': {\n      id: '/pathless-layout/_layout'\n      path: ''\n      fullPath: '/pathless-layout'\n      preLoaderRoute: typeof PathlessLayoutLayoutRouteRouteImport\n      parentRoute: typeof PathlessLayoutRouteRoute\n    }\n    '/params-ps/strict-false': {\n      id: '/params-ps/strict-false'\n      path: '/params-ps/strict-false'\n      fullPath: '/params-ps/strict-false'\n      preLoaderRoute: typeof ParamsPsStrictFalseRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/non-nested': {\n      id: '/params-ps/non-nested'\n      path: '/params-ps/non-nested'\n      fullPath: '/params-ps/non-nested'\n      preLoaderRoute: typeof ParamsPsNonNestedRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/non-nested/suffix': {\n      id: '/non-nested/suffix'\n      path: '/suffix'\n      fullPath: '/non-nested/suffix'\n      preLoaderRoute: typeof NonNestedSuffixRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/non-nested/prefix': {\n      id: '/non-nested/prefix'\n      path: '/prefix'\n      fullPath: '/non-nested/prefix'\n      preLoaderRoute: typeof NonNestedPrefixRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/non-nested/path': {\n      id: '/non-nested/path'\n      path: '/path'\n      fullPath: '/non-nested/path'\n      preLoaderRoute: typeof NonNestedPathRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/non-nested/named': {\n      id: '/non-nested/named'\n      path: '/named'\n      fullPath: '/non-nested/named'\n      preLoaderRoute: typeof NonNestedNamedRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/non-nested/deep': {\n      id: '/non-nested/deep'\n      path: '/deep'\n      fullPath: '/non-nested/deep'\n      preLoaderRoute: typeof NonNestedDeepRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/fullpath-test/_layout': {\n      id: '/fullpath-test/_layout'\n      path: ''\n      fullPath: '/fullpath-test'\n      preLoaderRoute: typeof FullpathTestLayoutRouteRouteImport\n      parentRoute: typeof FullpathTestRouteRoute\n    }\n    '/redirect/$target/': {\n      id: '/redirect/$target/'\n      path: '/'\n      fullPath: '/redirect/$target/'\n      preLoaderRoute: typeof RedirectTargetIndexRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/pathless-layout/_layout/': {\n      id: '/pathless-layout/_layout/'\n      path: '/'\n      fullPath: '/pathless-layout/'\n      preLoaderRoute: typeof PathlessLayoutLayoutIndexRouteImport\n      parentRoute: typeof PathlessLayoutLayoutRouteRoute\n    }\n    '/params-ps/wildcard/': {\n      id: '/params-ps/wildcard/'\n      path: '/params-ps/wildcard'\n      fullPath: '/params-ps/wildcard/'\n      preLoaderRoute: typeof ParamsPsWildcardIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/named/': {\n      id: '/params-ps/named/'\n      path: '/params-ps/named'\n      fullPath: '/params-ps/named/'\n      preLoaderRoute: typeof ParamsPsNamedIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/fullpath-test/_layout/': {\n      id: '/fullpath-test/_layout/'\n      path: '/'\n      fullPath: '/fullpath-test/'\n      preLoaderRoute: typeof FullpathTestLayoutIndexRouteImport\n      parentRoute: typeof FullpathTestLayoutRouteRoute\n    }\n    '/대한민국/🚀/$id': {\n      id: '/대한민국/🚀/$id'\n      path: '/🚀/$id'\n      fullPath: '/대한민국/🚀/$id'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport\n      parentRoute: typeof Char45824Char54620Char48124Char44397RouteRoute\n    }\n    '/대한민국/wildcard/$': {\n      id: '/대한민국/wildcard/$'\n      path: '/wildcard/$'\n      fullPath: '/대한민국/wildcard/$'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRouteImport\n      parentRoute: typeof Char45824Char54620Char48124Char44397RouteRoute\n    }\n    '/relative/useNavigate/relative-useNavigate-b': {\n      id: '/relative/useNavigate/relative-useNavigate-b'\n      path: '/relative-useNavigate-b'\n      fullPath: '/relative/useNavigate/relative-useNavigate-b'\n      preLoaderRoute: typeof RelativeUseNavigateRelativeUseNavigateBRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/useNavigate/relative-useNavigate-a': {\n      id: '/relative/useNavigate/relative-useNavigate-a'\n      path: '/relative-useNavigate-a'\n      fullPath: '/relative/useNavigate/relative-useNavigate-a'\n      preLoaderRoute: typeof RelativeUseNavigateRelativeUseNavigateARouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/link/relative-link-b': {\n      id: '/relative/link/relative-link-b'\n      path: '/relative-link-b'\n      fullPath: '/relative/link/relative-link-b'\n      preLoaderRoute: typeof RelativeLinkRelativeLinkBRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/relative/link/relative-link-a': {\n      id: '/relative/link/relative-link-a'\n      path: '/relative-link-a'\n      fullPath: '/relative/link/relative-link-a'\n      preLoaderRoute: typeof RelativeLinkRelativeLinkARouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/redirect/preload/third': {\n      id: '/redirect/preload/third'\n      path: '/redirect/preload/third'\n      fullPath: '/redirect/preload/third'\n      preLoaderRoute: typeof RedirectPreloadThirdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect/preload/second': {\n      id: '/redirect/preload/second'\n      path: '/redirect/preload/second'\n      fullPath: '/redirect/preload/second'\n      preLoaderRoute: typeof RedirectPreloadSecondRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect/preload/first': {\n      id: '/redirect/preload/first'\n      path: '/redirect/preload/first'\n      fullPath: '/redirect/preload/first'\n      preLoaderRoute: typeof RedirectPreloadFirstRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect/$target/via-routeApi-redirect-loader': {\n      id: '/redirect/$target/via-routeApi-redirect-loader'\n      path: '/via-routeApi-redirect-loader'\n      fullPath: '/redirect/$target/via-routeApi-redirect-loader'\n      preLoaderRoute: typeof RedirectTargetViaRouteApiRedirectLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-routeApi-redirect-beforeLoad': {\n      id: '/redirect/$target/via-routeApi-redirect-beforeLoad'\n      path: '/via-routeApi-redirect-beforeLoad'\n      fullPath: '/redirect/$target/via-routeApi-redirect-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetViaRouteApiRedirectBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-route-redirect-loader': {\n      id: '/redirect/$target/via-route-redirect-loader'\n      path: '/via-route-redirect-loader'\n      fullPath: '/redirect/$target/via-route-redirect-loader'\n      preLoaderRoute: typeof RedirectTargetViaRouteRedirectLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-route-redirect-beforeLoad': {\n      id: '/redirect/$target/via-route-redirect-beforeLoad'\n      path: '/via-route-redirect-beforeLoad'\n      fullPath: '/redirect/$target/via-route-redirect-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetViaRouteRedirectBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-loader': {\n      id: '/redirect/$target/via-loader'\n      path: '/via-loader'\n      fullPath: '/redirect/$target/via-loader'\n      preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-beforeLoad': {\n      id: '/redirect/$target/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/redirect/$target/via-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/destination': {\n      id: '/redirect/$target/destination'\n      path: '/destination'\n      fullPath: '/redirect/$target/destination'\n      preLoaderRoute: typeof RedirectTargetDestinationRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/posts_/$postId/edit': {\n      id: '/posts_/$postId/edit'\n      path: '/posts/$postId/edit'\n      fullPath: '/posts/$postId/edit'\n      preLoaderRoute: typeof PostsPostIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/pathless-layout/_layout/child': {\n      id: '/pathless-layout/_layout/child'\n      path: '/child'\n      fullPath: '/pathless-layout/child'\n      preLoaderRoute: typeof PathlessLayoutLayoutChildRouteImport\n      parentRoute: typeof PathlessLayoutLayoutRouteRoute\n    }\n    '/params/single/$value': {\n      id: '/params/single/$value'\n      path: '/params/single/$value'\n      fullPath: '/params/single/$value'\n      preLoaderRoute: typeof ParamsSingleValueRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/{$}suffix@대': {\n      id: '/params-ps/wildcard/{$}suffix@대'\n      path: '/params-ps/wildcard/{$}suffix@대'\n      fullPath: '/params-ps/wildcard/{$}suffix@대'\n      preLoaderRoute: typeof ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/{$}suffix': {\n      id: '/params-ps/wildcard/{$}suffix'\n      path: '/params-ps/wildcard/{$}suffix'\n      fullPath: '/params-ps/wildcard/{$}suffix'\n      preLoaderRoute: typeof ParamsPsWildcardChar123Char125suffixRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/prefix{$}': {\n      id: '/params-ps/wildcard/prefix{$}'\n      path: '/params-ps/wildcard/prefix{$}'\n      fullPath: '/params-ps/wildcard/prefix{$}'\n      preLoaderRoute: typeof ParamsPsWildcardPrefixChar123Char125RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/prefix@대{$}': {\n      id: '/params-ps/wildcard/prefix@대{$}'\n      path: '/params-ps/wildcard/prefix@대{$}'\n      fullPath: '/params-ps/wildcard/prefix@대{$}'\n      preLoaderRoute: typeof ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/$': {\n      id: '/params-ps/wildcard/$'\n      path: '/params-ps/wildcard/$'\n      fullPath: '/params-ps/wildcard/$'\n      preLoaderRoute: typeof ParamsPsWildcardSplatRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/named/{$foo}suffix': {\n      id: '/params-ps/named/{$foo}suffix'\n      path: '/params-ps/named/{$foo}suffix'\n      fullPath: '/params-ps/named/{$foo}suffix'\n      preLoaderRoute: typeof ParamsPsNamedChar123fooChar125suffixRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/named/prefix{$foo}': {\n      id: '/params-ps/named/prefix{$foo}'\n      path: '/params-ps/named/prefix{$foo}'\n      fullPath: '/params-ps/named/prefix{$foo}'\n      preLoaderRoute: typeof ParamsPsNamedPrefixChar123fooChar125RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/masks/public/$username': {\n      id: '/masks/public/$username'\n      path: '/public/$username'\n      fullPath: '/masks/public/$username'\n      preLoaderRoute: typeof MasksPublicUsernameRouteImport\n      parentRoute: typeof MasksRoute\n    }\n    '/masks/admin/$userId': {\n      id: '/masks/admin/$userId'\n      path: '/admin/$userId'\n      fullPath: '/masks/admin/$userId'\n      preLoaderRoute: typeof MasksAdminUserIdRouteImport\n      parentRoute: typeof MasksRoute\n    }\n    '/fullpath-test/_layout/$id': {\n      id: '/fullpath-test/_layout/$id'\n      path: '/$id'\n      fullPath: '/fullpath-test/$id'\n      preLoaderRoute: typeof FullpathTestLayoutIdRouteImport\n      parentRoute: typeof FullpathTestLayoutRouteRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/(group)/subfolder/inside': {\n      id: '/(group)/subfolder/inside'\n      path: '/subfolder/inside'\n      fullPath: '/subfolder/inside'\n      preLoaderRoute: typeof groupSubfolderInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout/insidelayout': {\n      id: '/(group)/_layout/insidelayout'\n      path: '/insidelayout'\n      fullPath: '/insidelayout'\n      preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport\n      parentRoute: typeof groupLayoutRoute\n    }\n    '/params-ps/strict-false/$version': {\n      id: '/params-ps/strict-false/$version'\n      path: '/$version'\n      fullPath: '/params-ps/strict-false/$version'\n      preLoaderRoute: typeof ParamsPsStrictFalseVersionRouteRouteImport\n      parentRoute: typeof ParamsPsStrictFalseRouteRoute\n    }\n    '/params-ps/non-nested/$foo_': {\n      id: '/params-ps/non-nested/$foo_'\n      path: '/$foo'\n      fullPath: '/params-ps/non-nested/$foo'\n      preLoaderRoute: typeof ParamsPsNonNestedFooRouteRouteImport\n      parentRoute: typeof ParamsPsNonNestedRouteRoute\n    }\n    '/params-ps/named/$foo': {\n      id: '/params-ps/named/$foo'\n      path: '/params-ps/named/$foo'\n      fullPath: '/params-ps/named/$foo'\n      preLoaderRoute: typeof ParamsPsNamedFooRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/non-nested/suffix/{$baz}suffix': {\n      id: '/non-nested/suffix/{$baz}suffix'\n      path: '/{$baz}suffix'\n      fullPath: '/non-nested/suffix/{$baz}suffix'\n      preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteImport\n      parentRoute: typeof NonNestedSuffixRouteRoute\n    }\n    '/non-nested/prefix/prefix{$baz}': {\n      id: '/non-nested/prefix/prefix{$baz}'\n      path: '/prefix{$baz}'\n      fullPath: '/non-nested/prefix/prefix{$baz}'\n      preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteImport\n      parentRoute: typeof NonNestedPrefixRouteRoute\n    }\n    '/non-nested/path/baz': {\n      id: '/non-nested/path/baz'\n      path: '/baz'\n      fullPath: '/non-nested/path/baz'\n      preLoaderRoute: typeof NonNestedPathBazRouteRouteImport\n      parentRoute: typeof NonNestedPathRouteRoute\n    }\n    '/non-nested/named/$baz': {\n      id: '/non-nested/named/$baz'\n      path: '/$baz'\n      fullPath: '/non-nested/named/$baz'\n      preLoaderRoute: typeof NonNestedNamedBazRouteRouteImport\n      parentRoute: typeof NonNestedNamedRouteRoute\n    }\n    '/non-nested/deep/$baz': {\n      id: '/non-nested/deep/$baz'\n      path: '/$baz'\n      fullPath: '/non-nested/deep/$baz'\n      preLoaderRoute: typeof NonNestedDeepBazRouteRouteImport\n      parentRoute: typeof NonNestedDeepRouteRoute\n    }\n    '/relative/useNavigate/with-search/': {\n      id: '/relative/useNavigate/with-search/'\n      path: '/with-search'\n      fullPath: '/relative/useNavigate/with-search/'\n      preLoaderRoute: typeof RelativeUseNavigateWithSearchIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/useNavigate/path/': {\n      id: '/relative/useNavigate/path/'\n      path: '/path'\n      fullPath: '/relative/useNavigate/path/'\n      preLoaderRoute: typeof RelativeUseNavigatePathIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/useNavigate/nested/': {\n      id: '/relative/useNavigate/nested/'\n      path: '/nested'\n      fullPath: '/relative/useNavigate/nested/'\n      preLoaderRoute: typeof RelativeUseNavigateNestedIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/link/with-search/': {\n      id: '/relative/link/with-search/'\n      path: '/with-search'\n      fullPath: '/relative/link/with-search/'\n      preLoaderRoute: typeof RelativeLinkWithSearchIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/relative/link/path/': {\n      id: '/relative/link/path/'\n      path: '/path'\n      fullPath: '/relative/link/path/'\n      preLoaderRoute: typeof RelativeLinkPathIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/relative/link/nested/': {\n      id: '/relative/link/nested/'\n      path: '/nested'\n      fullPath: '/relative/link/nested/'\n      preLoaderRoute: typeof RelativeLinkNestedIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/non-nested/suffix/{$baz}suffix/': {\n      id: '/non-nested/suffix/{$baz}suffix/'\n      path: '/'\n      fullPath: '/non-nested/suffix/{$baz}suffix/'\n      preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRouteImport\n      parentRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRoute\n    }\n    '/non-nested/prefix/prefix{$baz}/': {\n      id: '/non-nested/prefix/prefix{$baz}/'\n      path: '/'\n      fullPath: '/non-nested/prefix/prefix{$baz}/'\n      preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRouteImport\n      parentRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRoute\n    }\n    '/non-nested/path/baz/': {\n      id: '/non-nested/path/baz/'\n      path: '/'\n      fullPath: '/non-nested/path/baz/'\n      preLoaderRoute: typeof NonNestedPathBazIndexRouteImport\n      parentRoute: typeof NonNestedPathBazRouteRoute\n    }\n    '/non-nested/named/$baz/': {\n      id: '/non-nested/named/$baz/'\n      path: '/'\n      fullPath: '/non-nested/named/$baz/'\n      preLoaderRoute: typeof NonNestedNamedBazIndexRouteImport\n      parentRoute: typeof NonNestedNamedBazRouteRoute\n    }\n    '/non-nested/deep/$baz/': {\n      id: '/non-nested/deep/$baz/'\n      path: '/'\n      fullPath: '/non-nested/deep/$baz/'\n      preLoaderRoute: typeof NonNestedDeepBazIndexRouteImport\n      parentRoute: typeof NonNestedDeepBazRouteRoute\n    }\n    '/params-ps/non-nested/$foo_/$bar': {\n      id: '/params-ps/non-nested/$foo_/$bar'\n      path: '/$bar'\n      fullPath: '/params-ps/non-nested/$foo/$bar'\n      preLoaderRoute: typeof ParamsPsNonNestedFooBarRouteImport\n      parentRoute: typeof ParamsPsNonNestedFooRouteRoute\n    }\n    '/non-nested/suffix/{$baz}suffix_/bar': {\n      id: '/non-nested/suffix/{$baz}suffix_/bar'\n      path: '/{$baz}suffix/bar'\n      fullPath: '/non-nested/suffix/{$baz}suffix/bar'\n      preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixBarRouteImport\n      parentRoute: typeof NonNestedSuffixRouteRoute\n    }\n    '/non-nested/suffix/{$baz}suffix/foo': {\n      id: '/non-nested/suffix/{$baz}suffix/foo'\n      path: '/foo'\n      fullPath: '/non-nested/suffix/{$baz}suffix/foo'\n      preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRouteImport\n      parentRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRoute\n    }\n    '/non-nested/prefix/prefix{$baz}_/bar': {\n      id: '/non-nested/prefix/prefix{$baz}_/bar'\n      path: '/prefix{$baz}/bar'\n      fullPath: '/non-nested/prefix/prefix{$baz}/bar'\n      preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125BarRouteImport\n      parentRoute: typeof NonNestedPrefixRouteRoute\n    }\n    '/non-nested/prefix/prefix{$baz}/foo': {\n      id: '/non-nested/prefix/prefix{$baz}/foo'\n      path: '/foo'\n      fullPath: '/non-nested/prefix/prefix{$baz}/foo'\n      preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRouteImport\n      parentRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRoute\n    }\n    '/non-nested/path/baz_/bar': {\n      id: '/non-nested/path/baz_/bar'\n      path: '/baz/bar'\n      fullPath: '/non-nested/path/baz/bar'\n      preLoaderRoute: typeof NonNestedPathBazBarRouteImport\n      parentRoute: typeof NonNestedPathRouteRoute\n    }\n    '/non-nested/path/baz/foo': {\n      id: '/non-nested/path/baz/foo'\n      path: '/foo'\n      fullPath: '/non-nested/path/baz/foo'\n      preLoaderRoute: typeof NonNestedPathBazFooRouteImport\n      parentRoute: typeof NonNestedPathBazRouteRoute\n    }\n    '/non-nested/named/$baz_/bar': {\n      id: '/non-nested/named/$baz_/bar'\n      path: '/$baz/bar'\n      fullPath: '/non-nested/named/$baz/bar'\n      preLoaderRoute: typeof NonNestedNamedBazBarRouteImport\n      parentRoute: typeof NonNestedNamedRouteRoute\n    }\n    '/non-nested/named/$baz/foo': {\n      id: '/non-nested/named/$baz/foo'\n      path: '/foo'\n      fullPath: '/non-nested/named/$baz/foo'\n      preLoaderRoute: typeof NonNestedNamedBazFooRouteImport\n      parentRoute: typeof NonNestedNamedBazRouteRoute\n    }\n    '/params-ps/named/$foo/$bar': {\n      id: '/params-ps/named/$foo/$bar'\n      path: '/$bar'\n      fullPath: '/params-ps/named/$foo/$bar'\n      preLoaderRoute: typeof ParamsPsNamedFooBarRouteRouteImport\n      parentRoute: typeof ParamsPsNamedFooRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar': {\n      id: '/non-nested/deep/$baz_/bar'\n      path: '/$baz/bar'\n      fullPath: '/non-nested/deep/$baz/bar'\n      preLoaderRoute: typeof NonNestedDeepBazBarRouteRouteImport\n      parentRoute: typeof NonNestedDeepRouteRoute\n    }\n    '/relative/useNavigate/path/$path/': {\n      id: '/relative/useNavigate/path/$path/'\n      path: '/path/$path'\n      fullPath: '/relative/useNavigate/path/$path/'\n      preLoaderRoute: typeof RelativeUseNavigatePathPathIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/useNavigate/nested/deep/': {\n      id: '/relative/useNavigate/nested/deep/'\n      path: '/nested/deep'\n      fullPath: '/relative/useNavigate/nested/deep/'\n      preLoaderRoute: typeof RelativeUseNavigateNestedDeepIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/link/path/$path/': {\n      id: '/relative/link/path/$path/'\n      path: '/path/$path'\n      fullPath: '/relative/link/path/$path/'\n      preLoaderRoute: typeof RelativeLinkPathPathIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/relative/link/nested/deep/': {\n      id: '/relative/link/nested/deep/'\n      path: '/nested/deep'\n      fullPath: '/relative/link/nested/deep/'\n      preLoaderRoute: typeof RelativeLinkNestedDeepIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar/': {\n      id: '/non-nested/deep/$baz_/bar/'\n      path: '/'\n      fullPath: '/non-nested/deep/$baz/bar/'\n      preLoaderRoute: typeof NonNestedDeepBazBarIndexRouteImport\n      parentRoute: typeof NonNestedDeepBazBarRouteRoute\n    }\n    '/params-ps/named/$foo/$bar/$baz': {\n      id: '/params-ps/named/$foo/$bar/$baz'\n      path: '/$baz'\n      fullPath: '/params-ps/named/$foo/$bar/$baz'\n      preLoaderRoute: typeof ParamsPsNamedFooBarBazRouteImport\n      parentRoute: typeof ParamsPsNamedFooBarRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar_/qux': {\n      id: '/non-nested/deep/$baz_/bar_/qux'\n      path: '/$baz/bar/qux'\n      fullPath: '/non-nested/deep/$baz/bar/qux'\n      preLoaderRoute: typeof NonNestedDeepBazBarQuxRouteImport\n      parentRoute: typeof NonNestedDeepRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar/$foo': {\n      id: '/non-nested/deep/$baz_/bar/$foo'\n      path: '/$foo'\n      fullPath: '/non-nested/deep/$baz/bar/$foo'\n      preLoaderRoute: typeof NonNestedDeepBazBarFooRouteRouteImport\n      parentRoute: typeof NonNestedDeepBazBarRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar/$foo/': {\n      id: '/non-nested/deep/$baz_/bar/$foo/'\n      path: '/'\n      fullPath: '/non-nested/deep/$baz/bar/$foo/'\n      preLoaderRoute: typeof NonNestedDeepBazBarFooIndexRouteImport\n      parentRoute: typeof NonNestedDeepBazBarFooRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar/$foo_/qux': {\n      id: '/non-nested/deep/$baz_/bar/$foo_/qux'\n      path: '/$foo/qux'\n      fullPath: '/non-nested/deep/$baz/bar/$foo/qux'\n      preLoaderRoute: typeof NonNestedDeepBazBarFooQuxRouteImport\n      parentRoute: typeof NonNestedDeepBazBarRouteRoute\n    }\n  }\n}\n\ninterface FullpathTestLayoutRouteRouteChildren {\n  FullpathTestLayoutIdRoute: typeof FullpathTestLayoutIdRoute\n  FullpathTestLayoutIndexRoute: typeof FullpathTestLayoutIndexRoute\n}\n\nconst FullpathTestLayoutRouteRouteChildren: FullpathTestLayoutRouteRouteChildren =\n  {\n    FullpathTestLayoutIdRoute: FullpathTestLayoutIdRoute,\n    FullpathTestLayoutIndexRoute: FullpathTestLayoutIndexRoute,\n  }\n\nconst FullpathTestLayoutRouteRouteWithChildren =\n  FullpathTestLayoutRouteRoute._addFileChildren(\n    FullpathTestLayoutRouteRouteChildren,\n  )\n\ninterface FullpathTestRouteRouteChildren {\n  FullpathTestLayoutRouteRoute: typeof FullpathTestLayoutRouteRouteWithChildren\n}\n\nconst FullpathTestRouteRouteChildren: FullpathTestRouteRouteChildren = {\n  FullpathTestLayoutRouteRoute: FullpathTestLayoutRouteRouteWithChildren,\n}\n\nconst FullpathTestRouteRouteWithChildren =\n  FullpathTestRouteRoute._addFileChildren(FullpathTestRouteRouteChildren)\n\ninterface NonNestedDeepBazRouteRouteChildren {\n  NonNestedDeepBazIndexRoute: typeof NonNestedDeepBazIndexRoute\n}\n\nconst NonNestedDeepBazRouteRouteChildren: NonNestedDeepBazRouteRouteChildren = {\n  NonNestedDeepBazIndexRoute: NonNestedDeepBazIndexRoute,\n}\n\nconst NonNestedDeepBazRouteRouteWithChildren =\n  NonNestedDeepBazRouteRoute._addFileChildren(\n    NonNestedDeepBazRouteRouteChildren,\n  )\n\ninterface NonNestedDeepBazBarFooRouteRouteChildren {\n  NonNestedDeepBazBarFooIndexRoute: typeof NonNestedDeepBazBarFooIndexRoute\n}\n\nconst NonNestedDeepBazBarFooRouteRouteChildren: NonNestedDeepBazBarFooRouteRouteChildren =\n  {\n    NonNestedDeepBazBarFooIndexRoute: NonNestedDeepBazBarFooIndexRoute,\n  }\n\nconst NonNestedDeepBazBarFooRouteRouteWithChildren =\n  NonNestedDeepBazBarFooRouteRoute._addFileChildren(\n    NonNestedDeepBazBarFooRouteRouteChildren,\n  )\n\ninterface NonNestedDeepBazBarRouteRouteChildren {\n  NonNestedDeepBazBarFooRouteRoute: typeof NonNestedDeepBazBarFooRouteRouteWithChildren\n  NonNestedDeepBazBarIndexRoute: typeof NonNestedDeepBazBarIndexRoute\n  NonNestedDeepBazBarFooQuxRoute: typeof NonNestedDeepBazBarFooQuxRoute\n}\n\nconst NonNestedDeepBazBarRouteRouteChildren: NonNestedDeepBazBarRouteRouteChildren =\n  {\n    NonNestedDeepBazBarFooRouteRoute:\n      NonNestedDeepBazBarFooRouteRouteWithChildren,\n    NonNestedDeepBazBarIndexRoute: NonNestedDeepBazBarIndexRoute,\n    NonNestedDeepBazBarFooQuxRoute: NonNestedDeepBazBarFooQuxRoute,\n  }\n\nconst NonNestedDeepBazBarRouteRouteWithChildren =\n  NonNestedDeepBazBarRouteRoute._addFileChildren(\n    NonNestedDeepBazBarRouteRouteChildren,\n  )\n\ninterface NonNestedDeepRouteRouteChildren {\n  NonNestedDeepBazRouteRoute: typeof NonNestedDeepBazRouteRouteWithChildren\n  NonNestedDeepBazBarRouteRoute: typeof NonNestedDeepBazBarRouteRouteWithChildren\n  NonNestedDeepBazBarQuxRoute: typeof NonNestedDeepBazBarQuxRoute\n}\n\nconst NonNestedDeepRouteRouteChildren: NonNestedDeepRouteRouteChildren = {\n  NonNestedDeepBazRouteRoute: NonNestedDeepBazRouteRouteWithChildren,\n  NonNestedDeepBazBarRouteRoute: NonNestedDeepBazBarRouteRouteWithChildren,\n  NonNestedDeepBazBarQuxRoute: NonNestedDeepBazBarQuxRoute,\n}\n\nconst NonNestedDeepRouteRouteWithChildren =\n  NonNestedDeepRouteRoute._addFileChildren(NonNestedDeepRouteRouteChildren)\n\ninterface NonNestedNamedBazRouteRouteChildren {\n  NonNestedNamedBazFooRoute: typeof NonNestedNamedBazFooRoute\n  NonNestedNamedBazIndexRoute: typeof NonNestedNamedBazIndexRoute\n}\n\nconst NonNestedNamedBazRouteRouteChildren: NonNestedNamedBazRouteRouteChildren =\n  {\n    NonNestedNamedBazFooRoute: NonNestedNamedBazFooRoute,\n    NonNestedNamedBazIndexRoute: NonNestedNamedBazIndexRoute,\n  }\n\nconst NonNestedNamedBazRouteRouteWithChildren =\n  NonNestedNamedBazRouteRoute._addFileChildren(\n    NonNestedNamedBazRouteRouteChildren,\n  )\n\ninterface NonNestedNamedRouteRouteChildren {\n  NonNestedNamedBazRouteRoute: typeof NonNestedNamedBazRouteRouteWithChildren\n  NonNestedNamedBazBarRoute: typeof NonNestedNamedBazBarRoute\n}\n\nconst NonNestedNamedRouteRouteChildren: NonNestedNamedRouteRouteChildren = {\n  NonNestedNamedBazRouteRoute: NonNestedNamedBazRouteRouteWithChildren,\n  NonNestedNamedBazBarRoute: NonNestedNamedBazBarRoute,\n}\n\nconst NonNestedNamedRouteRouteWithChildren =\n  NonNestedNamedRouteRoute._addFileChildren(NonNestedNamedRouteRouteChildren)\n\ninterface NonNestedPathBazRouteRouteChildren {\n  NonNestedPathBazFooRoute: typeof NonNestedPathBazFooRoute\n  NonNestedPathBazIndexRoute: typeof NonNestedPathBazIndexRoute\n}\n\nconst NonNestedPathBazRouteRouteChildren: NonNestedPathBazRouteRouteChildren = {\n  NonNestedPathBazFooRoute: NonNestedPathBazFooRoute,\n  NonNestedPathBazIndexRoute: NonNestedPathBazIndexRoute,\n}\n\nconst NonNestedPathBazRouteRouteWithChildren =\n  NonNestedPathBazRouteRoute._addFileChildren(\n    NonNestedPathBazRouteRouteChildren,\n  )\n\ninterface NonNestedPathRouteRouteChildren {\n  NonNestedPathBazRouteRoute: typeof NonNestedPathBazRouteRouteWithChildren\n  NonNestedPathBazBarRoute: typeof NonNestedPathBazBarRoute\n}\n\nconst NonNestedPathRouteRouteChildren: NonNestedPathRouteRouteChildren = {\n  NonNestedPathBazRouteRoute: NonNestedPathBazRouteRouteWithChildren,\n  NonNestedPathBazBarRoute: NonNestedPathBazBarRoute,\n}\n\nconst NonNestedPathRouteRouteWithChildren =\n  NonNestedPathRouteRoute._addFileChildren(NonNestedPathRouteRouteChildren)\n\ninterface NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren {\n  NonNestedPrefixPrefixChar123bazChar125FooRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRoute\n  NonNestedPrefixPrefixChar123bazChar125IndexRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute\n}\n\nconst NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren: NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren =\n  {\n    NonNestedPrefixPrefixChar123bazChar125FooRoute:\n      NonNestedPrefixPrefixChar123bazChar125FooRoute,\n    NonNestedPrefixPrefixChar123bazChar125IndexRoute:\n      NonNestedPrefixPrefixChar123bazChar125IndexRoute,\n  }\n\nconst NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren =\n  NonNestedPrefixPrefixChar123bazChar125RouteRoute._addFileChildren(\n    NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren,\n  )\n\ninterface NonNestedPrefixRouteRouteChildren {\n  NonNestedPrefixPrefixChar123bazChar125RouteRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren\n  NonNestedPrefixPrefixChar123bazChar125BarRoute: typeof NonNestedPrefixPrefixChar123bazChar125BarRoute\n}\n\nconst NonNestedPrefixRouteRouteChildren: NonNestedPrefixRouteRouteChildren = {\n  NonNestedPrefixPrefixChar123bazChar125RouteRoute:\n    NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren,\n  NonNestedPrefixPrefixChar123bazChar125BarRoute:\n    NonNestedPrefixPrefixChar123bazChar125BarRoute,\n}\n\nconst NonNestedPrefixRouteRouteWithChildren =\n  NonNestedPrefixRouteRoute._addFileChildren(NonNestedPrefixRouteRouteChildren)\n\ninterface NonNestedSuffixChar123bazChar125suffixRouteRouteChildren {\n  NonNestedSuffixChar123bazChar125suffixFooRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRoute\n  NonNestedSuffixChar123bazChar125suffixIndexRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRoute\n}\n\nconst NonNestedSuffixChar123bazChar125suffixRouteRouteChildren: NonNestedSuffixChar123bazChar125suffixRouteRouteChildren =\n  {\n    NonNestedSuffixChar123bazChar125suffixFooRoute:\n      NonNestedSuffixChar123bazChar125suffixFooRoute,\n    NonNestedSuffixChar123bazChar125suffixIndexRoute:\n      NonNestedSuffixChar123bazChar125suffixIndexRoute,\n  }\n\nconst NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren =\n  NonNestedSuffixChar123bazChar125suffixRouteRoute._addFileChildren(\n    NonNestedSuffixChar123bazChar125suffixRouteRouteChildren,\n  )\n\ninterface NonNestedSuffixRouteRouteChildren {\n  NonNestedSuffixChar123bazChar125suffixRouteRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren\n  NonNestedSuffixChar123bazChar125suffixBarRoute: typeof NonNestedSuffixChar123bazChar125suffixBarRoute\n}\n\nconst NonNestedSuffixRouteRouteChildren: NonNestedSuffixRouteRouteChildren = {\n  NonNestedSuffixChar123bazChar125suffixRouteRoute:\n    NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren,\n  NonNestedSuffixChar123bazChar125suffixBarRoute:\n    NonNestedSuffixChar123bazChar125suffixBarRoute,\n}\n\nconst NonNestedSuffixRouteRouteWithChildren =\n  NonNestedSuffixRouteRoute._addFileChildren(NonNestedSuffixRouteRouteChildren)\n\ninterface NonNestedRouteRouteChildren {\n  NonNestedDeepRouteRoute: typeof NonNestedDeepRouteRouteWithChildren\n  NonNestedNamedRouteRoute: typeof NonNestedNamedRouteRouteWithChildren\n  NonNestedPathRouteRoute: typeof NonNestedPathRouteRouteWithChildren\n  NonNestedPrefixRouteRoute: typeof NonNestedPrefixRouteRouteWithChildren\n  NonNestedSuffixRouteRoute: typeof NonNestedSuffixRouteRouteWithChildren\n}\n\nconst NonNestedRouteRouteChildren: NonNestedRouteRouteChildren = {\n  NonNestedDeepRouteRoute: NonNestedDeepRouteRouteWithChildren,\n  NonNestedNamedRouteRoute: NonNestedNamedRouteRouteWithChildren,\n  NonNestedPathRouteRoute: NonNestedPathRouteRouteWithChildren,\n  NonNestedPrefixRouteRoute: NonNestedPrefixRouteRouteWithChildren,\n  NonNestedSuffixRouteRoute: NonNestedSuffixRouteRouteWithChildren,\n}\n\nconst NonNestedRouteRouteWithChildren = NonNestedRouteRoute._addFileChildren(\n  NonNestedRouteRouteChildren,\n)\n\ninterface PathlessLayoutLayoutRouteRouteChildren {\n  PathlessLayoutLayoutChildRoute: typeof PathlessLayoutLayoutChildRoute\n  PathlessLayoutLayoutIndexRoute: typeof PathlessLayoutLayoutIndexRoute\n}\n\nconst PathlessLayoutLayoutRouteRouteChildren: PathlessLayoutLayoutRouteRouteChildren =\n  {\n    PathlessLayoutLayoutChildRoute: PathlessLayoutLayoutChildRoute,\n    PathlessLayoutLayoutIndexRoute: PathlessLayoutLayoutIndexRoute,\n  }\n\nconst PathlessLayoutLayoutRouteRouteWithChildren =\n  PathlessLayoutLayoutRouteRoute._addFileChildren(\n    PathlessLayoutLayoutRouteRouteChildren,\n  )\n\ninterface PathlessLayoutRouteRouteChildren {\n  PathlessLayoutLayoutRouteRoute: typeof PathlessLayoutLayoutRouteRouteWithChildren\n}\n\nconst PathlessLayoutRouteRouteChildren: PathlessLayoutRouteRouteChildren = {\n  PathlessLayoutLayoutRouteRoute: PathlessLayoutLayoutRouteRouteWithChildren,\n}\n\nconst PathlessLayoutRouteRouteWithChildren =\n  PathlessLayoutRouteRoute._addFileChildren(PathlessLayoutRouteRouteChildren)\n\ninterface SearchParamsRouteRouteChildren {\n  SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute\n  SearchParamsIndexRoute: typeof SearchParamsIndexRoute\n}\n\nconst SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {\n  SearchParamsDefaultRoute: SearchParamsDefaultRoute,\n  SearchParamsIndexRoute: SearchParamsIndexRoute,\n}\n\nconst SearchParamsRouteRouteWithChildren =\n  SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)\n\ninterface Char45824Char54620Char48124Char44397RouteRouteChildren {\n  Char45824Char54620Char48124Char44397WildcardSplatRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRoute\n  Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute\n}\n\nconst Char45824Char54620Char48124Char44397RouteRouteChildren: Char45824Char54620Char48124Char44397RouteRouteChildren =\n  {\n    Char45824Char54620Char48124Char44397WildcardSplatRoute:\n      Char45824Char54620Char48124Char44397WildcardSplatRoute,\n    Char45824Char54620Char48124Char44397Char55357Char56960IdRoute:\n      Char45824Char54620Char48124Char44397Char55357Char56960IdRoute,\n  }\n\nconst Char45824Char54620Char48124Char44397RouteRouteWithChildren =\n  Char45824Char54620Char48124Char44397RouteRoute._addFileChildren(\n    Char45824Char54620Char48124Char44397RouteRouteChildren,\n  )\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface MasksRouteChildren {\n  MasksAdminUserIdRoute: typeof MasksAdminUserIdRoute\n  MasksPublicUsernameRoute: typeof MasksPublicUsernameRoute\n}\n\nconst MasksRouteChildren: MasksRouteChildren = {\n  MasksAdminUserIdRoute: MasksAdminUserIdRoute,\n  MasksPublicUsernameRoute: MasksPublicUsernameRoute,\n}\n\nconst MasksRouteWithChildren = MasksRoute._addFileChildren(MasksRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface ParamsPsNonNestedFooRouteRouteChildren {\n  ParamsPsNonNestedFooBarRoute: typeof ParamsPsNonNestedFooBarRoute\n}\n\nconst ParamsPsNonNestedFooRouteRouteChildren: ParamsPsNonNestedFooRouteRouteChildren =\n  {\n    ParamsPsNonNestedFooBarRoute: ParamsPsNonNestedFooBarRoute,\n  }\n\nconst ParamsPsNonNestedFooRouteRouteWithChildren =\n  ParamsPsNonNestedFooRouteRoute._addFileChildren(\n    ParamsPsNonNestedFooRouteRouteChildren,\n  )\n\ninterface ParamsPsNonNestedRouteRouteChildren {\n  ParamsPsNonNestedFooRouteRoute: typeof ParamsPsNonNestedFooRouteRouteWithChildren\n}\n\nconst ParamsPsNonNestedRouteRouteChildren: ParamsPsNonNestedRouteRouteChildren =\n  {\n    ParamsPsNonNestedFooRouteRoute: ParamsPsNonNestedFooRouteRouteWithChildren,\n  }\n\nconst ParamsPsNonNestedRouteRouteWithChildren =\n  ParamsPsNonNestedRouteRoute._addFileChildren(\n    ParamsPsNonNestedRouteRouteChildren,\n  )\n\ninterface ParamsPsStrictFalseRouteRouteChildren {\n  ParamsPsStrictFalseVersionRouteRoute: typeof ParamsPsStrictFalseVersionRouteRoute\n}\n\nconst ParamsPsStrictFalseRouteRouteChildren: ParamsPsStrictFalseRouteRouteChildren =\n  {\n    ParamsPsStrictFalseVersionRouteRoute: ParamsPsStrictFalseVersionRouteRoute,\n  }\n\nconst ParamsPsStrictFalseRouteRouteWithChildren =\n  ParamsPsStrictFalseRouteRoute._addFileChildren(\n    ParamsPsStrictFalseRouteRouteChildren,\n  )\n\ninterface RelativeLinkRouteRouteChildren {\n  RelativeLinkRelativeLinkARoute: typeof RelativeLinkRelativeLinkARoute\n  RelativeLinkRelativeLinkBRoute: typeof RelativeLinkRelativeLinkBRoute\n  RelativeLinkNestedIndexRoute: typeof RelativeLinkNestedIndexRoute\n  RelativeLinkPathIndexRoute: typeof RelativeLinkPathIndexRoute\n  RelativeLinkWithSearchIndexRoute: typeof RelativeLinkWithSearchIndexRoute\n  RelativeLinkNestedDeepIndexRoute: typeof RelativeLinkNestedDeepIndexRoute\n  RelativeLinkPathPathIndexRoute: typeof RelativeLinkPathPathIndexRoute\n}\n\nconst RelativeLinkRouteRouteChildren: RelativeLinkRouteRouteChildren = {\n  RelativeLinkRelativeLinkARoute: RelativeLinkRelativeLinkARoute,\n  RelativeLinkRelativeLinkBRoute: RelativeLinkRelativeLinkBRoute,\n  RelativeLinkNestedIndexRoute: RelativeLinkNestedIndexRoute,\n  RelativeLinkPathIndexRoute: RelativeLinkPathIndexRoute,\n  RelativeLinkWithSearchIndexRoute: RelativeLinkWithSearchIndexRoute,\n  RelativeLinkNestedDeepIndexRoute: RelativeLinkNestedDeepIndexRoute,\n  RelativeLinkPathPathIndexRoute: RelativeLinkPathPathIndexRoute,\n}\n\nconst RelativeLinkRouteRouteWithChildren =\n  RelativeLinkRouteRoute._addFileChildren(RelativeLinkRouteRouteChildren)\n\ninterface RelativeUseNavigateRouteRouteChildren {\n  RelativeUseNavigateRelativeUseNavigateARoute: typeof RelativeUseNavigateRelativeUseNavigateARoute\n  RelativeUseNavigateRelativeUseNavigateBRoute: typeof RelativeUseNavigateRelativeUseNavigateBRoute\n  RelativeUseNavigateNestedIndexRoute: typeof RelativeUseNavigateNestedIndexRoute\n  RelativeUseNavigatePathIndexRoute: typeof RelativeUseNavigatePathIndexRoute\n  RelativeUseNavigateWithSearchIndexRoute: typeof RelativeUseNavigateWithSearchIndexRoute\n  RelativeUseNavigateNestedDeepIndexRoute: typeof RelativeUseNavigateNestedDeepIndexRoute\n  RelativeUseNavigatePathPathIndexRoute: typeof RelativeUseNavigatePathPathIndexRoute\n}\n\nconst RelativeUseNavigateRouteRouteChildren: RelativeUseNavigateRouteRouteChildren =\n  {\n    RelativeUseNavigateRelativeUseNavigateARoute:\n      RelativeUseNavigateRelativeUseNavigateARoute,\n    RelativeUseNavigateRelativeUseNavigateBRoute:\n      RelativeUseNavigateRelativeUseNavigateBRoute,\n    RelativeUseNavigateNestedIndexRoute: RelativeUseNavigateNestedIndexRoute,\n    RelativeUseNavigatePathIndexRoute: RelativeUseNavigatePathIndexRoute,\n    RelativeUseNavigateWithSearchIndexRoute:\n      RelativeUseNavigateWithSearchIndexRoute,\n    RelativeUseNavigateNestedDeepIndexRoute:\n      RelativeUseNavigateNestedDeepIndexRoute,\n    RelativeUseNavigatePathPathIndexRoute:\n      RelativeUseNavigatePathPathIndexRoute,\n  }\n\nconst RelativeUseNavigateRouteRouteWithChildren =\n  RelativeUseNavigateRouteRoute._addFileChildren(\n    RelativeUseNavigateRouteRouteChildren,\n  )\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\ninterface RedirectTargetRouteChildren {\n  RedirectTargetDestinationRoute: typeof RedirectTargetDestinationRoute\n  RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute\n  RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute\n  RedirectTargetViaRouteRedirectBeforeLoadRoute: typeof RedirectTargetViaRouteRedirectBeforeLoadRoute\n  RedirectTargetViaRouteRedirectLoaderRoute: typeof RedirectTargetViaRouteRedirectLoaderRoute\n  RedirectTargetViaRouteApiRedirectBeforeLoadRoute: typeof RedirectTargetViaRouteApiRedirectBeforeLoadRoute\n  RedirectTargetViaRouteApiRedirectLoaderRoute: typeof RedirectTargetViaRouteApiRedirectLoaderRoute\n  RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute\n}\n\nconst RedirectTargetRouteChildren: RedirectTargetRouteChildren = {\n  RedirectTargetDestinationRoute: RedirectTargetDestinationRoute,\n  RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,\n  RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,\n  RedirectTargetViaRouteRedirectBeforeLoadRoute:\n    RedirectTargetViaRouteRedirectBeforeLoadRoute,\n  RedirectTargetViaRouteRedirectLoaderRoute:\n    RedirectTargetViaRouteRedirectLoaderRoute,\n  RedirectTargetViaRouteApiRedirectBeforeLoadRoute:\n    RedirectTargetViaRouteApiRedirectBeforeLoadRoute,\n  RedirectTargetViaRouteApiRedirectLoaderRoute:\n    RedirectTargetViaRouteApiRedirectLoaderRoute,\n  RedirectTargetIndexRoute: RedirectTargetIndexRoute,\n}\n\nconst RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(\n  RedirectTargetRouteChildren,\n)\n\ninterface ParamsPsNamedFooBarRouteRouteChildren {\n  ParamsPsNamedFooBarBazRoute: typeof ParamsPsNamedFooBarBazRoute\n}\n\nconst ParamsPsNamedFooBarRouteRouteChildren: ParamsPsNamedFooBarRouteRouteChildren =\n  {\n    ParamsPsNamedFooBarBazRoute: ParamsPsNamedFooBarBazRoute,\n  }\n\nconst ParamsPsNamedFooBarRouteRouteWithChildren =\n  ParamsPsNamedFooBarRouteRoute._addFileChildren(\n    ParamsPsNamedFooBarRouteRouteChildren,\n  )\n\ninterface ParamsPsNamedFooRouteRouteChildren {\n  ParamsPsNamedFooBarRouteRoute: typeof ParamsPsNamedFooBarRouteRouteWithChildren\n}\n\nconst ParamsPsNamedFooRouteRouteChildren: ParamsPsNamedFooRouteRouteChildren = {\n  ParamsPsNamedFooBarRouteRoute: ParamsPsNamedFooBarRouteRouteWithChildren,\n}\n\nconst ParamsPsNamedFooRouteRouteWithChildren =\n  ParamsPsNamedFooRouteRoute._addFileChildren(\n    ParamsPsNamedFooRouteRouteChildren,\n  )\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  FullpathTestRouteRoute: FullpathTestRouteRouteWithChildren,\n  NonNestedRouteRoute: NonNestedRouteRouteWithChildren,\n  PathlessLayoutRouteRoute: PathlessLayoutRouteRouteWithChildren,\n  SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,\n  Char45824Char54620Char48124Char44397RouteRoute:\n    Char45824Char54620Char48124Char44397RouteRouteWithChildren,\n  LayoutRoute: LayoutRouteWithChildren,\n  AnchorRoute: AnchorRoute,\n  ComponentTypesTestRoute: ComponentTypesTestRoute,\n  EditingARoute: EditingARoute,\n  EditingBRoute: EditingBRoute,\n  HoverPreloadHashRoute: HoverPreloadHashRoute,\n  LazyErrorRoute: LazyErrorRoute,\n  MasksRoute: MasksRouteWithChildren,\n  NotRemountDepsRoute: NotRemountDepsRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RemountDepsRoute: RemountDepsRoute,\n  ParamsPsNonNestedRouteRoute: ParamsPsNonNestedRouteRouteWithChildren,\n  ParamsPsStrictFalseRouteRoute: ParamsPsStrictFalseRouteRouteWithChildren,\n  RelativeLinkRouteRoute: RelativeLinkRouteRouteWithChildren,\n  RelativeUseNavigateRouteRoute: RelativeUseNavigateRouteRouteWithChildren,\n  anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupInsideRoute: groupInsideRoute,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n  RedirectTargetRoute: RedirectTargetRouteWithChildren,\n  StructuralSharingEnabledRoute: StructuralSharingEnabledRoute,\n  ParamsPsIndexRoute: ParamsPsIndexRoute,\n  RedirectIndexRoute: RedirectIndexRoute,\n  RelativeIndexRoute: RelativeIndexRoute,\n  ParamsPsNamedFooRouteRoute: ParamsPsNamedFooRouteRouteWithChildren,\n  groupSubfolderInsideRoute: groupSubfolderInsideRoute,\n  ParamsPsNamedPrefixChar123fooChar125Route:\n    ParamsPsNamedPrefixChar123fooChar125Route,\n  ParamsPsNamedChar123fooChar125suffixRoute:\n    ParamsPsNamedChar123fooChar125suffixRoute,\n  ParamsPsWildcardSplatRoute: ParamsPsWildcardSplatRoute,\n  ParamsPsWildcardPrefixAtChar45824Char123Char125Route:\n    ParamsPsWildcardPrefixAtChar45824Char123Char125Route,\n  ParamsPsWildcardPrefixChar123Char125Route:\n    ParamsPsWildcardPrefixChar123Char125Route,\n  ParamsPsWildcardChar123Char125suffixRoute:\n    ParamsPsWildcardChar123Char125suffixRoute,\n  ParamsPsWildcardChar123Char125suffixAtChar45824Route:\n    ParamsPsWildcardChar123Char125suffixAtChar45824Route,\n  ParamsSingleValueRoute: ParamsSingleValueRoute,\n  PostsPostIdEditRoute: PostsPostIdEditRoute,\n  RedirectPreloadFirstRoute: RedirectPreloadFirstRoute,\n  RedirectPreloadSecondRoute: RedirectPreloadSecondRoute,\n  RedirectPreloadThirdRoute: RedirectPreloadThirdRoute,\n  ParamsPsNamedIndexRoute: ParamsPsNamedIndexRoute,\n  ParamsPsWildcardIndexRoute: ParamsPsWildcardIndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/(another-group)/onlyrouteinside.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getRouteApi, useSearch } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(another-group)/onlyrouteinside')\n\nexport const Route = createFileRoute('/(another-group)/onlyrouteinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({\n      from: '/(another-group)/onlyrouteinside',\n    })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook.hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook.hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">{searchViaRouteApi.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/(group)/_layout.insidelayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getRouteApi, useSearch } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(group)/_layout/insidelayout')\n\nexport const Route = createFileRoute('/(group)/_layout/insidelayout')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook.hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook.hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">{searchViaRouteApi.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/(group)/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({\n  component: () => (\n    <>\n      <div>/(group)/_layout!</div>\n      <Outlet />\n    </>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/(group)/inside.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getRouteApi, useSearch } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(group)/inside')\n\nexport const Route = createFileRoute('/(group)/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/inside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook.hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook.hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">{searchViaRouteApi.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nimport { getRouteApi, useSearch } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nexport const Route = createLazyFileRoute('/(group)/lazyinside')({\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/lazyinside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook.hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook.hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">{searchViaRouteApi.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/(group)/subfolder/inside.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getRouteApi, useSearch } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(group)/subfolder/inside')\n\nexport const Route = createFileRoute('/(group)/subfolder/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/subfolder/inside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook.hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook.hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">{searchViaRouteApi.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n  useCanGoBack,\n  useRouter,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const canGoBack = useCanGoBack()\n  // test useRouterState doesn't crash client side navigation\n  const _state = useRouterState()\n\n  return (\n    <>\n      <HeadContent />\n      <div className=\"flex gap-2 p-2 text-lg border-b\">\n        <button\n          data-testid=\"back-button\"\n          disabled={!canGoBack}\n          onClick={() => router.history.back()}\n          className={!canGoBack ? 'line-through' : undefined}\n        >\n          Back\n        </button>{' '}\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/onlyrouteinside\"\n          data-testid=\"link-to-only-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Only Route Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/inside\"\n          data-testid=\"link-to-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/subfolder/inside\"\n          data-testid=\"link-to-route-inside-group-inside-subfolder\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Inside Subfolder Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/insidelayout\"\n          data-testid=\"link-to-route-inside-group-inside-layout\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Inside Group Inside Layout\n        </Link>{' '}\n        <Link\n          to=\"/lazyinside\"\n          data-testid=\"link-to-lazy-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Lazy Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/redirect\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          redirect\n        </Link>{' '}\n        <Link\n          to=\"/relative\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          relative routing\n        </Link>{' '}\n        <Link\n          to=\"/대한민국\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          unicode path\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>{' '}\n        <Link\n          to=\"/masks\"\n          data-testid=\"link-to-masks\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Masks\n        </Link>{' '}\n        <Link\n          to=\"/pathless-layout\"\n          data-testid=\"link-to-pathless-layout\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          to=\"/fullpath-test\"\n          data-testid=\"link-to-fullpath-test\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          FullPath Test\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/anchor.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { useLayoutEffect, useRef, useState } from 'react'\nimport { Link, useLocation, useNavigate } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/anchor')({\n  component: AnchorComponent,\n})\n\nconst anchors: Array<{\n  id: string\n  title: string\n  hashScrollIntoView?: boolean | ScrollIntoViewOptions\n}> = [\n  {\n    id: 'default-anchor',\n    title: 'Default Anchor',\n  },\n  {\n    id: 'false-anchor',\n    title: 'No Scroll Into View',\n    hashScrollIntoView: false,\n  },\n  {\n    id: 'smooth-scroll',\n    title: 'Smooth Scroll',\n    hashScrollIntoView: { behavior: 'smooth' },\n  },\n] as const\n\nfunction AnchorSection({ id, title }: { id: string; title: string }) {\n  const [hasShown, setHasShown] = useState(false)\n  const elementRef = useRef<HTMLHeadingElement>(null)\n\n  useLayoutEffect(() => {\n    const observer = new IntersectionObserver(\n      ([entry]) => {\n        if (!hasShown && entry.isIntersecting) {\n          setHasShown(true)\n        }\n      },\n      { threshold: 0.01 },\n    )\n\n    const currentRef = elementRef.current\n    if (currentRef) {\n      observer.observe(currentRef)\n    }\n\n    return () => {\n      if (currentRef) {\n        observer.unobserve(currentRef)\n      }\n    }\n  }, [hasShown])\n\n  return (\n    <div id={id} className=\"p-2 min-h-dvh\">\n      <h1\n        data-testid={`heading-${id}`}\n        className=\"font-bold text-xl pt-10\"\n        ref={elementRef}\n      >\n        {title}\n        {hasShown ? ' (shown)' : ''}\n      </h1>\n    </div>\n  )\n}\n\nfunction AnchorComponent() {\n  const navigate = useNavigate()\n  const location = useLocation()\n  const [withScroll, setWithScroll] = useState(true)\n\n  return (\n    <div className=\"flex flex-col w-full\">\n      <nav className=\"sticky top-0 z-10 p-2 bg-gray-50 dark:bg-gray-900 border-b\">\n        <ul className=\"inline-flex gap-2\">\n          {anchors.map((anchor) => (\n            <li key={anchor.id}>\n              <Link\n                from={Route.fullPath}\n                data-testid={`link-${anchor.id}`}\n                hash={anchor.id}\n                activeOptions={{ includeHash: true }}\n                activeProps={{\n                  className: 'font-bold active',\n                }}\n                hashScrollIntoView={anchor.hashScrollIntoView}\n              >\n                {anchor.title}\n              </Link>\n            </li>\n          ))}\n        </ul>\n      </nav>\n      <main className=\"overflow-auto\">\n        <form\n          className=\"p-2 space-y-2 min-h-dvh\"\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n\n            const toHash = formData.get('hash') as string\n\n            if (!toHash) {\n              return\n            }\n\n            const hashScrollIntoView = withScroll\n              ? ({\n                  behavior: formData.get('scrollBehavior') as ScrollBehavior,\n                  block: formData.get('scrollBlock') as ScrollLogicalPosition,\n                  inline: formData.get('scrollInline') as ScrollLogicalPosition,\n                } satisfies ScrollIntoViewOptions)\n              : false\n\n            navigate({ hash: toHash, hashScrollIntoView })\n          }}\n        >\n          <h1 className=\"font-bold text-xl\">Scroll with navigate</h1>\n          <div className=\"space-y-2\">\n            <label>\n              <span>Target Anchor</span>\n              <select\n                className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                data-testid=\"hash-select\"\n                defaultValue={location.hash || anchors[0].id}\n                name=\"hash\"\n              >\n                {anchors.map((anchor) => (\n                  <option key={anchor.id} value={anchor.id}>\n                    {anchor.title}\n                  </option>\n                ))}\n              </select>\n            </label>\n            <div>\n              <label>\n                <input\n                  checked={withScroll}\n                  data-testid=\"with-scroll\"\n                  onChange={(e) => setWithScroll(e.target.checked)}\n                  type=\"checkbox\"\n                />{' '}\n                Scroll Into View\n              </label>\n            </div>\n          </div>\n          {withScroll ? (\n            <>\n              <div className=\"space-y-2\">\n                <label>\n                  <span>Behavior</span>\n                  <select\n                    className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    data-testid=\"behavior-select\"\n                    defaultValue=\"instant\"\n                    name=\"scrollBehavior\"\n                  >\n                    <option value=\"instant\">instant</option>\n                    <option value=\"smooth\">smooth</option>\n                    <option value=\"auto\">auto</option>\n                  </select>\n                </label>\n              </div>\n\n              <div className=\"space-y-2\">\n                <label>\n                  <span>Block</span>\n                  <select\n                    className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    data-testid=\"block-select\"\n                    defaultValue=\"start\"\n                    name=\"scrollBlock\"\n                  >\n                    <option value=\"start\">start</option>\n                    <option value=\"center\">center</option>\n                    <option value=\"end\">end</option>\n                    <option value=\"nearest\">nearest</option>\n                  </select>\n                </label>\n              </div>\n\n              <div className=\"space-y-2\">\n                <label>\n                  <span>Inline</span>\n                  <select\n                    className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    data-testid=\"inline-select\"\n                    defaultValue=\"nearest\"\n                    name=\"scrollInline\"\n                  >\n                    <option value=\"start\">start</option>\n                    <option value=\"center\">center</option>\n                    <option value=\"end\">end</option>\n                    <option value=\"nearest\">nearest</option>\n                  </select>\n                </label>\n              </div>\n            </>\n          ) : null}\n          <div>\n            <button\n              className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              data-testid=\"navigate-button\"\n            >\n              Navigate\n            </button>\n          </div>\n        </form>\n\n        {anchors.map((anchor) => (\n          <AnchorSection key={anchor.id} id={anchor.id} title={anchor.title} />\n        ))}\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/component-types-test.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// Test route for type safety of different component types\n// This test should\n// - check that `false` can be set on the `errorComponent`\n// ...without causing build-time TypeScript errors\nexport const Route = createFileRoute('/component-types-test')({\n  component: () => <div>Testing test types</div>,\n  errorComponent: false, // Should not cause TypeScript error\n  pendingComponent: undefined, // Should not cause TypeScript error\n  notFoundComponent: undefined, // Should not cause TypeScript error\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/editing-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { useBlocker } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/editing-a')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = Route.useNavigate()\n  const [input, setInput] = React.useState('')\n\n  const { proceed, status } = useBlocker({\n    shouldBlockFn: ({ next }) => {\n      if (next.fullPath === '/editing-b' && input.length > 0) {\n        return true\n      }\n      return false\n    },\n    withResolver: true,\n  })\n\n  return (\n    <div>\n      <h1>Editing A</h1>\n      <label>\n        Enter your name:\n        <input\n          name=\"input\"\n          value={input}\n          onChange={(e) => setInput(e.target.value)}\n        />\n      </label>\n      <button\n        onClick={() => {\n          navigate({ to: '/editing-b' })\n        }}\n      >\n        Go to next step\n      </button>\n      {status === 'blocked' && (\n        <button onClick={() => proceed()}>Proceed</button>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/editing-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { useBlocker } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/editing-b')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = Route.useNavigate()\n  const [input, setInput] = React.useState('')\n\n  const { proceed, status } = useBlocker({\n    condition: input,\n  })\n\n  return (\n    <div>\n      <h1>Editing B</h1>\n      <label>\n        Enter your name:\n        <input\n          name=\"input\"\n          value={input}\n          onChange={(e) => setInput(e.target.value)}\n        />\n      </label>\n      <button\n        onClick={() => {\n          navigate({ to: '/editing-a' })\n        }}\n      >\n        Go back\n      </button>\n      {status === 'blocked' && (\n        <button onClick={() => proceed()}>Proceed</button>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/$id.tsx",
    "content": "import { createFileRoute, useMatches } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/fullpath-test/_layout/$id')({\n  component: IdComponent,\n})\n\nfunction IdComponent() {\n  const matches = useMatches()\n  const { id } = Route.useParams()\n  // Find this route's match by routeId\n  const idMatch = matches.find(\n    (m) => m.routeId === '/fullpath-test/_layout/$id',\n  )\n\n  return (\n    <div>\n      <div data-testid=\"param-route-fullpath\">\n        {idMatch?.fullPath ?? 'undefined'}\n      </div>\n      <div data-testid=\"fullpath-test-param\">Param: {id}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/index.tsx",
    "content": "import { createFileRoute, useMatches } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/fullpath-test/_layout/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const matches = useMatches()\n  // Find this index route's match by routeId\n  const indexMatch = matches.find(\n    (m) => m.routeId === '/fullpath-test/_layout/',\n  )\n\n  return (\n    <div>\n      <div data-testid=\"index-route-fullpath\">\n        {indexMatch?.fullPath ?? 'undefined'}\n      </div>\n      <div data-testid=\"index-route-to\">{Route.to}</div>\n      <div data-testid=\"fullpath-test-index\">FullPath Test Index</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/route.tsx",
    "content": "import { Outlet, createFileRoute, useMatches } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/fullpath-test/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  const matches = useMatches()\n  // Find this layout's match by routeId\n  const layoutMatch = matches.find(\n    (m) => m.routeId === '/fullpath-test/_layout',\n  )\n\n  return (\n    <div>\n      <div data-testid=\"pathless-layout-fullpath\">\n        {layoutMatch?.fullPath ?? 'undefined'}\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/fullpath-test/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/fullpath-test')({\n  component: () => (\n    <div>\n      <h2 data-testid=\"fullpath-test-header\">FullPath Test Section</h2>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/hover-preload-hash.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/hover-preload-hash')({\n  component: Page,\n})\n\nfunction Page() {\n  return (\n    <>\n      <div className=\"p-2\">Hello from About!</div>\n      <Link\n        to=\"/hover-preload-hash\"\n        hash={'position1'}\n        className=\"[&.active]:font-bold\"\n        data-testid=\"link-to-hash\"\n      >\n        To hash\n      </Link>\n\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <h2 id=\"position1\">Hash is here</h2>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/lazy-error.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/lazy-error')({\n  component: LazyErrorComponent,\n  errorComponent: () => (\n    <div data-testid=\"lazy-route-error-component\">\n      Lazy route error component\n    </div>\n  ),\n})\n\nfunction LazyErrorComponent() {\n  return <div data-testid=\"lazy-route-component\">Lazy route component</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/lazy-error.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/lazy-error')({\n  loader: () => {\n    throw new Error('Lazy route loader error')\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/masks.admin.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/masks/admin/$userId')({\n  component: AdminUserRoute,\n})\n\nfunction AdminUserRoute() {\n  const params = Route.useParams()\n\n  return (\n    <div data-testid=\"admin-user-component\">\n      <div data-testid=\"admin-user-id\">{params.userId}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/masks.public.$username.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/masks/public/$username')({\n  component: PublicUserRoute,\n})\n\nfunction PublicUserRoute() {\n  const params = Route.useParams()\n\n  return (\n    <div data-testid=\"public-user-component\">\n      <div data-testid=\"public-username\">{params.username}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/masks.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useRouterState,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/masks')({\n  component: MasksLayout,\n})\n\nfunction MasksLayout() {\n  const location = useRouterState({\n    select: (state) => state.location,\n  })\n\n  return (\n    <div>\n      <h2>Route Masks</h2>\n      <nav>\n        <Link\n          to=\"/masks/admin/$userId\"\n          params={{ userId: '42' }}\n          data-testid=\"link-to-admin-mask\"\n        >\n          Go to admin user\n        </Link>\n      </nav>\n      <div>\n        <div data-testid=\"router-pathname\">{location.pathname}</div>\n        <div data-testid=\"router-masked-pathname\">\n          {location.maskedLocation?.pathname ?? ''}\n        </div>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-index-heading\">\n        Hello deeply nested baz index\n      </div>\n      <div data-testid=\"non-nested-deep-baz-index-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-route-heading\">\n        Hello non-nested named baz route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-index-heading\">\n        Hello deeply nested baz/bar/foo index\n      </div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-index-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-route-heading\">\n        Hello deeply nested named baz/bar/foo route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo_.qux.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo_/qux')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-qux-heading\">\n        Hello deeply nested baz/bar/foo/qux\n      </div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-qux-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-index-heading\">\n        Hello deeply nested baz/bar index\n      </div>\n      <div data-testid=\"non-nested-deep-baz-bar-index-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-route-heading\">\n        Hello deeply nested baz/bar route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar_.qux.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar_/qux')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-qux-heading\">\n        Hello deeply nested baz/bar/qux\n      </div>\n      <div data-testid=\"non-nested-deep-baz-bar-qux-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/deep/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/deep')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-root-route-heading\">\n        Hello non-nested deep layout\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-deep-baz\"\n        >\n          To Baz\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar\"\n          params={{ baz: 'baz-bar' }}\n          data-testid=\"to-deep-baz-bar\"\n        >\n          To named baz/bar\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar/$foo\"\n          params={{ baz: 'baz-bar', foo: 'foo' }}\n          data-testid=\"to-deep-baz-bar-foo\"\n        >\n          To named baz/bar/foo\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar/$foo/qux\"\n          params={{ baz: 'baz-bar-qux', foo: 'foo' }}\n          data-testid=\"to-deep-baz-bar-foo-qux\"\n        >\n          To named baz/bar/foo/qux\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar/qux\"\n          params={{ baz: 'baz-bar-qux' }}\n          data-testid=\"to-deep-baz-bar-qux\"\n        >\n          To named baz/bar/qux\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/named/$baz/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-baz-foo-heading\">\n        Hello nested named baz foo page\n      </div>\n      <div data-testid=\"non-nested-named-baz-foo-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/named/$baz/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-baz-index-heading\">\n        Hello nested named baz index\n      </div>\n      <div data-testid=\"non-nested-named-baz-index-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/named/$baz')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-baz-route-heading\">\n        Hello non-nested named baz route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/named/$baz_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-baz-bar-heading\">\n        Hello non-nested named bar\n      </div>\n      <div data-testid=\"non-nested-named-baz-bar-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/named/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/named')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-root-route-heading\">\n        Hello non-nested named layout\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-named-index\"\n        >\n          To named index\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/foo\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-named-foo\"\n        >\n          To named foo\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/foo\"\n          params={{ baz: 'baz_' }}\n          data-testid=\"to-named-foo-2\"\n        >\n          To named foo 2\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-named-bar\"\n        >\n          To named bar\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar\"\n          params={{ baz: 'baz_' }}\n          data-testid=\"to-named-bar-2\"\n        >\n          To named bar 2\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/path/baz/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-baz-foo-heading\">\n        Hello nested path baz foo page\n      </div>\n      <div data-testid=\"non-nested-path-baz-foo-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/path/baz/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-baz-index-heading\">\n        Hello nested path baz index\n      </div>\n      <div data-testid=\"non-nested-path-baz-index-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/path/baz')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-baz-route-heading\">\n        Hello non-nested path baz route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/path/baz_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-baz-bar-heading\">\n        Hello non-nested path bar\n      </div>\n      <div data-testid=\"non-nested-path-baz-bar-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/path/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/path')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-root-route-heading\">\n        Hello non-nested path layout\n      </div>\n      <div>\n        <Link from={Route.fullPath} to=\"./baz\" data-testid=\"to-path-index\">\n          To path index\n        </Link>\n        <Link from={Route.fullPath} to=\"./baz/foo\" data-testid=\"to-path-foo\">\n          To path foo\n        </Link>\n        <Link from={Route.fullPath} to=\"./baz/foo\" data-testid=\"to-path-foo-2\">\n          To path foo 2\n        </Link>\n        <Link from={Route.fullPath} to=\"./baz/bar\" data-testid=\"to-path-bar\">\n          To path bar\n        </Link>\n        <Link from={Route.fullPath} to=\"./baz/bar\" data-testid=\"to-path-bar-2\">\n          To path bar 2\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-baz-foo-heading\">\n        Hello nested prefix foo page\n      </div>\n      <div data-testid=\"non-nested-prefix-baz-foo-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-baz-index-heading\">\n        Hello nested prefix index\n      </div>\n      <div data-testid=\"non-nested-prefix-baz-index-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/prefix/prefix{$baz}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-baz-route-heading\">\n        Hello non-nested prefix route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/prefix/prefix{$baz}_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-baz-bar-heading\">\n        Hello non-nested prefix bar\n      </div>\n      <div data-testid=\"non-nested-prefix-baz-bar-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/prefix/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/prefix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-root-route-heading\">\n        Hello non-nested prefix layout\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-prefix-index\"\n        >\n          To prefix index\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}/foo\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-prefix-foo\"\n        >\n          To prefix foo\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}/foo\"\n          params={{ baz: 'baz_' }}\n          data-testid=\"to-prefix-foo-2\"\n        >\n          To prefix foo 2\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}/bar\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-prefix-bar\"\n        >\n          To prefix bar\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}/bar\"\n          params={{ baz: 'baz_' }}\n          data-testid=\"to-prefix-bar-2\"\n        >\n          To prefix bar 2\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h3 className=\"pb-2\" data-testid=\"non-nested-path-heading\">\n        Non-nested paths\n      </h3>\n      <ul className=\"grid mb-2\">\n        <li>\n          <Link from={Route.fullPath} data-testid=\"l-to-named\" to=\"./named\">\n            To named param tests\n          </Link>\n          <Link from={Route.fullPath} data-testid=\"l-to-prefix\" to=\"./prefix\">\n            To prefix param tests\n          </Link>\n          <Link from={Route.fullPath} data-testid=\"l-to-suffix\" to=\"./suffix\">\n            To suffix param tests\n          </Link>\n          <Link from={Route.fullPath} data-testid=\"l-to-path\" to=\"./path\">\n            To path tests\n          </Link>\n        </li>\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/suffix/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-root-route-heading\">\n        Hello non-nested suffix layout\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-suffix-index\"\n        >\n          To suffix index\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix/foo\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-suffix-foo\"\n        >\n          To suffix foo\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix/foo\"\n          params={{ baz: 'baz2' }}\n          data-testid=\"to-suffix-foo-2\"\n        >\n          To suffix foo 2\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix/bar\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-suffix-bar\"\n        >\n          To suffix bar\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix/bar\"\n          params={{ baz: 'baz2' }}\n          data-testid=\"to-suffix-bar-2\"\n        >\n          To suffix bar 2\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/suffix/{$baz}suffix/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-baz-foo-heading\">\n        Hello nested suffix foo page\n      </div>\n      <div data-testid=\"non-nested-suffix-baz-foo-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/suffix/{$baz}suffix/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-baz-index-heading\">\n        Hello nested suffix index\n      </div>\n      <div data-testid=\"non-nested-suffix-baz-index-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/suffix/{$baz}suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-baz-route-heading\">\n        Hello non-nested suffix route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/non-nested/suffix/{$baz}suffix_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-baz-bar-heading\">\n        Hello non-nested suffix bar\n      </div>\n      <div data-testid=\"non-nested-suffix-baz-bar-param\">\n        {JSON.stringify(params)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/notRemountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/notRemountDeps')({\n  validateSearch(search: { searchParam: string }) {\n    return { searchParam: search.searchParam }\n  },\n  loaderDeps(opts) {\n    return opts.search\n  },\n  component: Home,\n  remountDeps(opts) {\n    return opts.params\n  },\n})\n\nlet counter = 0\n\nfunction Home() {\n  const search = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  const [mounts, setMounts] = React.useState(counter)\n  React.useEffect(() => {\n    setMounts(++counter)\n  }, [])\n\n  return (\n    <div className=\"p-2\">\n      <button\n        onClick={() => {\n          navigate({\n            search: { searchParam: Math.random().toString(36).substring(2, 8) },\n          })\n        }}\n      >\n        Regenerate search param\n      </button>\n\n      <div>Search: {search.searchParam}</div>\n      <div data-testid=\"component-mounts\">Page component mounts: {mounts}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h3 className=\"pb-2\">Named path params</h3>\n      <ul className=\"grid mb-2\">\n        <li>\n          <Link\n            data-testid=\"l-to-named-foo\"\n            to=\"/params-ps/named/$foo\"\n            params={{ foo: 'foo' }}\n          >\n            /params-ps/named/$foo\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-named-foo-special-characters\"\n            to=\"/params-ps/named/$foo\"\n            params={{ foo: 'foo%\\\\/🚀대' }}\n          >\n            /params-ps/named/$foo - with special characters\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-named-prefixfoo\"\n            to=\"/params-ps/named/prefix{$foo}\"\n            params={{ foo: 'foo' }}\n          >\n            /params-ps/named/{'prefix{$foo}'}\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-named-foosuffix\"\n            to=\"/params-ps/named/{$foo}suffix\"\n            params={{ foo: 'foo' }}\n          >\n            /params-ps/named/{'{$foo}suffix'}\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <h3 className=\"pb-2\">Wildcard path params</h3>\n      <ul className=\"grid mb-2\">\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-foo\"\n            to=\"/params-ps/wildcard/$\"\n            params={{ _splat: 'foo' }}\n          >\n            /params-ps/wildcard/$\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-escaped\"\n            to=\"/params-ps/wildcard/$\"\n            params={{ _splat: 'test[s\\\\/.\\\\/parameter%!🚀]' }}\n          >\n            /params-ps/wildcard/$ with escaped params\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-encoded\"\n            to=\"/params-ps/wildcard/$\"\n            params={{ _splat: '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD' }}\n          >\n            /params-ps/wildcard/$ with encoded params\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-prefixfoo\"\n            to=\"/params-ps/wildcard/prefix{$}\"\n            params={{ _splat: 'foo' }}\n          >\n            /params-ps/wildcard/{'prefix{$}'}\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-prefix-escaped\"\n            to=\"/params-ps/wildcard/prefix@대{$}\"\n            params={{ _splat: 'test[s\\\\/.\\\\/parameter%!🚀]' }}\n          >\n            /params-ps/wildcard/{'prefix@대{$}'}\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-foosuffix\"\n            to=\"/params-ps/wildcard/{$}suffix\"\n            params={{ _splat: 'foo' }}\n          >\n            /params-ps/wildcard/{'{$}suffix'}\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-suffix-escaped\"\n            to=\"/params-ps/wildcard/{$}suffix@대\"\n            params={{ _splat: 'test[s\\\\/.\\\\/parameter%!🚀]' }}\n          >\n            /params-ps/wildcard/{'{$}suffix@대'}\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <h3 className=\"pb-2\">Non-nested path params</h3>\n      <ul className=\"grid mb-2\">\n        <li>\n          <Link data-testid=\"l-to-non-nested\" to=\"/params-ps/non-nested\">\n            Non-nested\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <h3 className=\"pb-2\">Parsed params with strict false</h3>\n      <ul className=\"grid mb-2\">\n        <li>\n          <Link\n            data-testid=\"strict-false-version-1\"\n            to=\"/params-ps/strict-false/$version\"\n            params={{ version: 1 }}\n          >\n            /params-ps/strict-false/$version (1)\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"strict-false-version-2\"\n            to=\"/params-ps/strict-false/$version\"\n            params={{ version: 2 }}\n          >\n            /params-ps/strict-false/$version (2)\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.$baz.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/named/$foo/$bar/$baz')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { foo, bar, baz } = Route.useParams()\n  return (\n    <div>\n      Hello \"/params-ps/named/{foo}/{bar}/{baz}\"!\n      <div>\n        baz: <span data-testid=\"foo-bar-baz-value\">{baz}</span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.route.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useParams,\n} from '@tanstack/react-router'\nimport { RenderCounter } from '../../../../components/RenderCounter'\n\nexport const Route = createFileRoute('/params-ps/named/$foo/$bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { foo, bar, baz } = useParams({\n    strict: false,\n  })\n\n  return (\n    <div>\n      Hello \"/params-ps/named/{foo}/{bar}\"!\n      <div>\n        Bar Render Count:{' '}\n        <span data-testid=\"foo-bar-render-count\">\n          <RenderCounter />\n        </span>\n      </div>\n      <div>\n        Bar: <span data-testid=\"foo-bar-value\">{bar}</span>\n      </div>\n      <div>\n        Baz in Bar:{' '}\n        <span data-testid=\"foo-baz-in-bar-value\">{baz ?? 'no param'}</span>\n      </div>\n      <Link\n        data-testid=\"params-foo-bar-links-baz\"\n        from={Route.fullPath}\n        to=\"./$baz\"\n        params={{ baz: `${bar}_10` }}\n      >\n        To Baz\n      </Link>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { RenderCounter } from '../../../../components/RenderCounter'\n\nexport const Route = createFileRoute('/params-ps/named/$foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const foo = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsNamedFoo</h3>\n      <div>\n        RenderCount:{' '}\n        <span data-testid=\"foo-render-count\">\n          <RenderCounter />\n        </span>\n      </div>\n      <div data-testid=\"params-output\">{JSON.stringify(foo)}</div>\n      <Link from={Route.fullPath} to=\".\" data-testid=\"params-foo-links-index\">\n        Index\n      </Link>\n      <Link\n        from={Route.fullPath}\n        to=\"./$bar\"\n        params={{ bar: '1' }}\n        data-testid=\"params-foo-links-bar1\"\n      >\n        Bar1\n      </Link>\n      <Link\n        from={Route.fullPath}\n        to=\"./$bar\"\n        params={{ bar: '2' }}\n        data-testid=\"params-foo-links-bar2\"\n      >\n        Bar2\n      </Link>\n      <Link\n        from={Route.fullPath}\n        to=\"./$bar\"\n        params={{ bar: '🚀%2F/abc대' }}\n        data-testid=\"params-foo-links-bar-special-characters\"\n      >\n        Bar with special characters\n      </Link>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/named/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/named/')({\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/named/prefix{$foo}.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/params-ps/named/prefix{$foo}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsNamedFooPrefix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/named/{$foo}suffix.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/params-ps/named/{$foo}suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsNamedFooSuffix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx",
    "content": "import { createFileRoute, useParams } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/non-nested/$foo_/$bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const fooParams = useParams({ from: `/params-ps/non-nested/$foo_` })\n  const routeParams = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"foo-params-value\">{JSON.stringify(fooParams)}</div>\n      <div data-testid=\"foo-bar-params-value\">\n        {JSON.stringify(routeParams)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/non-nested/$foo_')()\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/non-nested')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h3 className=\"pb-2\">Non-nested path params</h3>\n      <ul className=\"grid mb-2\">\n        <li>\n          <Link\n            from={Route.fullPath}\n            data-testid=\"l-to-non-nested-foo-bar\"\n            to=\"./$foo/$bar\"\n            params={{ foo: 'foo', bar: 'bar' }}\n          >\n            /params-ps/non-nested/foo/bar\n          </Link>\n          <Link\n            from={Route.fullPath}\n            data-testid=\"l-to-non-nested-foo2-bar2\"\n            to=\"./$foo/$bar\"\n            params={{ foo: 'foo2', bar: 'bar2' }}\n          >\n            /params-ps/non-nested/foo2/bar2\n          </Link>\n        </li>\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/strict-false/$version.route.tsx",
    "content": "import { createFileRoute, useParams } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/strict-false/$version')({\n  params: {\n    parse: (params) => ({\n      ...params,\n      version: parseInt(params.version),\n    }),\n    stringify: (params) => ({\n      ...params,\n      version: `${params.version}`,\n    }),\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { version } = useParams({ strict: false })\n\n  return <div data-testid=\"strict-false-child-version\">{String(version)}</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/strict-false/route.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useParams,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/strict-false')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { version } = useParams({ strict: false })\n  return (\n    <div>\n      <h3>ParamsStrictFalseParse</h3>\n      <div>\n        Type:{' '}\n        <span data-testid=\"strict-false-version-type\">{typeof version}</span>\n      </div>\n      <div>\n        Value:{' '}\n        <span data-testid=\"strict-false-version-value\">{String(version)}</span>\n      </div>\n      <Link\n        data-testid=\"strict-false-version-1\"\n        from={Route.fullPath}\n        to=\"./$version\"\n        params={{ version: 1 }}\n      >\n        Version 1\n      </Link>\n      <Link\n        data-testid=\"strict-false-version-2\"\n        from={Route.fullPath}\n        to=\"./$version\"\n        params={{ version: 2 }}\n      >\n        Version 2\n      </Link>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/$.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/params-ps/wildcard/$')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplat</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/wildcard/')({\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/prefix@대{$}.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/wildcard/prefix@대{$}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplatPrefix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/prefix{$}.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/params-ps/wildcard/prefix{$}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplatPrefix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/params-ps/wildcard/{$}suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplatSuffix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix@대.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params-ps/wildcard/{$}suffix@대')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplatSuffix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p)}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/params.single.$value.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/params/single/$value')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const value = Route.useParams({ select: (s) => s.value })\n\n  return (\n    <div className=\"p-2 grid gap-4\">\n      <div>\n        <h2>What's the value???</h2>\n        <p>Check path param value is printed correctly for a single param.</p>\n      </div>\n      <p>\n        Value: <span data-testid=\"parsed-param-value\">{value}</span>\n      </p>\n      <div className=\"flex gap-2\">\n        <Link\n          to=\"/params/single/$value\"\n          params={{ value }}\n          reloadDocument\n          className=\"border p-2\"\n          data-testid=\"self-link-same\"\n        >\n          Self link to same\n        </Link>\n        <Link\n          to=\"/params/single/$value\"\n          params={{ value: `e2e${value}` }}\n          reloadDocument\n          className=\"border p-2\"\n          data-testid=\"self-link-amended\"\n        >\n          Self link to amended value {`e2e${value}`}\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/child.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/pathless-layout/_layout/child')({\n  component: () => (\n    <div data-testid=\"pathless-layout-child\">Pathless Layout Child Route</div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/pathless-layout/_layout/')({\n  component: () => (\n    <div data-testid=\"pathless-layout-index\">Pathless Layout Index</div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/pathless-layout/_layout')({\n  component: () => (\n    <div>\n      <div data-testid=\"pathless-layout-wrapper\">Pathless Layout Wrapper</div>\n      <nav>\n        <Link to=\"/pathless-layout/child\" data-testid=\"link-to-child\">\n          Go to Child\n        </Link>\n      </nav>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/pathless-layout/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/pathless-layout')({\n  component: () => (\n    <div>\n      <h2 data-testid=\"pathless-layout-header\">Pathless Layout Section</h2>\n      <Outlet />\n    </div>\n  ),\n  notFoundComponent: () => (\n    <div data-testid=\"pathless-layout-not-found\">\n      Not Found in Pathless Layout\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\" data-testid=\"post-title\">\n        {post.title}\n      </h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\" data-testid=\"posts-links\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx",
    "content": "import { createFileRoute, getRouteApi, useParams } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts_/$postId/edit')({\n  component: PostEditPage,\n})\n\nconst api = getRouteApi(`/posts_/$postId/edit`)\n\nfunction PostEditPage() {\n  const paramsViaApi = api.useParams()\n  const paramsViaHook = useParams({ from: `/posts_/$postId/edit` })\n\n  const paramsViaRouteHook = Route.useParams()\n\n  return (\n    <>\n      <div data-testid=\"params-via-hook\">{paramsViaHook.postId}</div>\n      <div data-testid=\"params-via-route-hook\">{paramsViaRouteHook.postId}</div>\n      <div data-testid=\"params-via-route-api\">{paramsViaApi.postId}</div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target/destination.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/$target/destination')({\n  component: () => (\n    <div data-testid=\"redirect-destination\">\n      Redirect destination for {Route.fullPath}\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/$target/')({\n  component: () => {\n    const preload = Route.useSearch({ select: (s) => s.preload })\n    return (\n      <div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid={'via-beforeLoad'}\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            search={{ reloadDocument: true }}\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid={'via-beforeLoad-reloadDocument'}\n          >\n            via-beforeLoad (reloadDocument=true)\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid={'via-loader'}\n          >\n            via-loader\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            search={{ reloadDocument: true }}\n            preload={preload}\n            data-testid={'via-loader-reloadDocument'}\n          >\n            via-loader (reloadDocument=true)\n          </Link>\n        </div>\n        {/* Route.redirect() tests - uses relative redirect to ./destination */}\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-route-redirect-beforeLoad\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid={'via-route-redirect-beforeLoad'}\n          >\n            via-route-redirect-beforeLoad\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-route-redirect-loader\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid={'via-route-redirect-loader'}\n          >\n            via-route-redirect-loader\n          </Link>\n        </div>\n        {/* getRouteApi().redirect() tests - uses relative redirect to ./destination */}\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-routeApi-redirect-beforeLoad\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid={'via-routeApi-redirect-beforeLoad'}\n          >\n            via-routeApi-redirect-beforeLoad\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-routeApi-redirect-loader\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid={'via-routeApi-redirect-loader'}\n          >\n            via-routeApi-redirect-loader\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target/via-beforeLoad.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-beforeLoad')({\n  beforeLoad: ({\n    params: { target },\n    search: { reloadDocument, externalHost },\n  }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        throw redirect({ href: externalHost ?? 'http://example.com' })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target/via-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-loader')({\n  loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({\n    reloadDocument,\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { externalHost, reloadDocument } }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        const href = externalHost ?? 'http://example.com'\n        throw redirect({ href })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target/via-route-redirect-beforeLoad.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/redirect/$target/via-route-redirect-beforeLoad',\n)({\n  beforeLoad: ({ params: { target }, search: { externalHost } }) => {\n    switch (target) {\n      case 'internal':\n        // Use relative redirect to sibling route - this is the key feature being tested\n        // Note: '../destination' is the correct relative path for sibling navigation\n        throw Route.redirect({ to: '../destination' })\n      case 'external':\n        throw Route.redirect({ href: externalHost ?? 'http://example.com' })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target/via-route-redirect-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/redirect/$target/via-route-redirect-loader',\n)({\n  loaderDeps: ({ search: { externalHost } }) => ({\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { externalHost } }) => {\n    switch (target) {\n      case 'internal':\n        // Use relative redirect to sibling route - this is the key feature being tested\n        // Note: '../destination' is the correct relative path for sibling navigation\n        throw Route.redirect({ to: '../destination' })\n      case 'external':\n        throw Route.redirect({ href: externalHost ?? 'http://example.com' })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target/via-routeApi-redirect-beforeLoad.tsx",
    "content": "import { createFileRoute, getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi(\n  '/redirect/$target/via-routeApi-redirect-beforeLoad',\n)\n\nexport const Route = createFileRoute(\n  '/redirect/$target/via-routeApi-redirect-beforeLoad',\n)({\n  beforeLoad: ({ params: { target }, search: { externalHost } }) => {\n    switch (target) {\n      case 'internal':\n        // Use relative redirect to sibling route - this is the key feature being tested\n        // Note: '../destination' is the correct relative path for sibling navigation\n        throw routeApi.redirect({ to: '../destination' })\n      case 'external':\n        throw routeApi.redirect({ href: externalHost ?? 'http://example.com' })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target/via-routeApi-redirect-loader.tsx",
    "content": "import { createFileRoute, getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/redirect/$target/via-routeApi-redirect-loader')\n\nexport const Route = createFileRoute(\n  '/redirect/$target/via-routeApi-redirect-loader',\n)({\n  loaderDeps: ({ search: { externalHost } }) => ({\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { externalHost } }) => {\n    switch (target) {\n      case 'internal':\n        // Use relative redirect to sibling route - this is the key feature being tested\n        // Note: '../destination' is the correct relative path for sibling navigation\n        throw routeApi.redirect({ to: '../destination' })\n      case 'external':\n        throw routeApi.redirect({ href: externalHost ?? 'http://example.com' })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/$target.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { retainSearchParams } from '@tanstack/react-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/redirect/$target')({\n  params: {\n    parse: (p) =>\n      z\n        .object({\n          target: z.union([z.literal('internal'), z.literal('external')]),\n        })\n        .parse(p),\n  },\n  validateSearch: z.object({\n    reloadDocument: z.boolean().optional(),\n    preload: z.literal(false).optional(),\n    externalHost: z.string().optional(),\n  }),\n  search: {\n    middlewares: [retainSearchParams(['externalHost'])],\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/')({\n  component: () => (\n    <div>\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'internal' }}\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        internal\n      </Link>{' '}\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'external' }}\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        external\n      </Link>\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/preload/first.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/preload/first')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"first\">\n      <Link\n        from={Route.fullPath}\n        to=\"../second\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n        preload=\"intent\"\n        data-testid={'link'}\n      >\n        go to second\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/preload/second.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/preload/second')({\n  loader: async () => {\n    await new Promise((r) => setTimeout(r, 1000))\n    throw redirect({ from: Route.fullPath, to: '../third' })\n  },\n  component: RouteComponent,\n  pendingComponent: () => <p>second pending</p>,\n})\n\nfunction RouteComponent() {\n  return <div data-testid=\"second\">Hello \"/redirect/preload/second\"!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/redirect/preload/third.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/redirect/preload/third')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div data-testid=\"third\">Hello \"/redirect/preload/third\"!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/index.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\" data-testid=\"relative-routing-home\">\n        Relative Routing Tests - Home\n      </div>\n      <div>\n        <Link to=\"/relative/link\">Using Links</Link>\n        <Link to=\"/relative/useNavigate\">Using useNavigate</Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/link/nested/deep/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/link/nested/deep/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-link-nested-deep-header\">\n      Hello \"/relative/link/nested/deep/\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/link/nested/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/link/nested/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-link-nested-header\">\n      Hello \"/relative/link/nested/\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/link/path/$path/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/link/path/$path/')({\n  component: RouteComponent,\n  loader: ({ params }) => {\n    return params\n  },\n})\n\nfunction RouteComponent() {\n  const { path } = Route.useParams()\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\" data-testid=\"relative-link-path-param-header\">\n        Hello from \"/relative/links/path/{path}\"!\n      </div>\n      <div>\n        <Link\n          from=\"/relative/link/path/\"\n          to=\"./$path\"\n          params={{ path: path === 'a' ? 'b' : 'a' }}\n          className=\"mr-2\"\n          data-testid=\"relative-link-path-param-switchAB\"\n        >\n          To {path === 'a' ? 'b' : 'a'}\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/link/path/index.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/link/path/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\" data-testid=\"relative-link-path-header\">\n        Relative Routing Tests - Path Params\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/link/relative-link-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/link/relative-link-a')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-link-a-header\">\n      Hello \"/relative/link/relative-link-a\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/link/relative-link-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/link/relative-link-b')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-link-b-header\">\n      Hello \"/relative/link/relative-link-b\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/link/route.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useNavigate,\n} from '@tanstack/react-router'\nimport { useEffect } from 'react'\n\nexport const Route = createFileRoute('/relative/link')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n\n  useEffect(() => {\n    console.log('navigate')\n  }, [navigate])\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\" data-testid=\"relative-link-header\">\n        Relative Routing - Links - Index\n      </div>\n      <div>\n        <Link\n          from=\"/relative/link\"\n          to=\"..\"\n          data-testid=\"relative-link-home\"\n          className=\"mr-2 underline\"\n        >\n          Return To Home\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\".\"\n          data-testid=\"relative-link-index\"\n          className=\"mr-2\"\n        >\n          Return To Index\n        </Link>\n        <Link\n          to=\".\"\n          data-testid=\"relative-link-reload\"\n          className=\"mr-2 underline\"\n        >\n          Reload\n        </Link>\n        <Link\n          to=\"..\"\n          data-testid=\"relative-link-back\"\n          className=\"mr-2 underline\"\n        >\n          Back\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\"./relative-link-a\"\n          data-testid=\"relative-link-a\"\n          className=\"mr-2 underline\"\n        >\n          To Relative Link A\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\"./relative-link-b\"\n          data-testid=\"relative-link-b\"\n          className=\"mr-2 underline\"\n        >\n          To Relative Link B\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\"./nested/deep\"\n          data-testid=\"relative-link-deeply-nested\"\n          className=\"mr-2 underline\"\n        >\n          To Deeply Nested\n        </Link>\n        <Link\n          to=\"/relative/link/path/$path\"\n          params={{ path: 'a' }}\n          data-testid=\"relative-link-path\"\n          className=\"mr-2 underline\"\n        >\n          To Path Param A\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\"./with-search\"\n          search={{ searchParam: '1' }}\n          data-testid=\"relative-link-withSearch\"\n          className=\"mr-2 underline\"\n        >\n          To With Search Params\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/link/with-search/index.tsx",
    "content": "import { createFileRoute, Link } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/relative/link/with-search/')({\n  component: RouteComponent,\n  validateSearch: z.object({\n    searchParam: z.string().default('1'),\n  }),\n})\n\nfunction RouteComponent() {\n  const { searchParam } = Route.useSearch()\n  return (\n    <>\n      <div data-testid=\"relative-link-withSearch-header\">\n        Hello \"/relative/link/with-search/\" searchParam: {searchParam}!\n      </div>\n      <hr />\n      <Link\n        to=\".\"\n        data-testid=\"relative-link-withSearch-update-param\"\n        search={{ searchParam: '2' }}\n      >\n        Update Search\n      </Link>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/useNavigate/nested/deep/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/useNavigate/nested/deep/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-useNavigate-nested-deep-header\">\n      Hello \"/relative/useNavigate/nested/deep/\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/useNavigate/nested/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/useNavigate/nested/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-useNavigate-nested-header\">\n      Hello \"/relative/useNavigate/nested/\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/useNavigate/path/$path/index.tsx",
    "content": "import { createFileRoute, useNavigate } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/useNavigate/path/$path/')({\n  component: RouteComponent,\n  loader: ({ params }) => {\n    return params\n  },\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n\n  const { path } = Route.useParams()\n\n  return (\n    <div className=\"p-2\">\n      <div\n        className=\"border-b\"\n        data-testid=\"relative-useNavigate-path-param-header\"\n      >\n        Hello from \"/relative/useNavigate/path/{path}\"!\n      </div>\n      <div>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate/path/',\n              to: './$path',\n              params: { path: path === 'a' ? 'b' : 'a' },\n            })\n          }\n          className=\"mr-2\"\n          data-testid=\"relative-useNavigate-path-param-switchAB\"\n        >\n          To {path === 'a' ? 'b' : 'a'}\n        </button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/useNavigate/path/index.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative/useNavigate/path/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\" data-testid=\"relative-useNavigate-path-header\">\n        Relative Routing Tests - Path Params\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/relative/useNavigate/relative-useNavigate-a',\n)({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-useNavigate-a-header\">\n      Hello \"/relative/useNavigate/relative-useNavigate-a\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/relative/useNavigate/relative-useNavigate-b',\n)({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-useNavigate-b-header\">\n      Hello \"/relative/useNavigate/relative-useNavigate-b\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/useNavigate/route.tsx",
    "content": "import { Outlet, createFileRoute, useNavigate } from '@tanstack/react-router'\nimport { useEffect } from 'react'\n\nexport const Route = createFileRoute('/relative/useNavigate')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n\n  useEffect(() => {\n    console.log('navigate')\n  }, [navigate])\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\" data-testid=\"relative-useNavigate-header\">\n        Relative Routing - Links - Index\n      </div>\n      <div>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: '..',\n            })\n          }\n          data-testid=\"relative-useNavigate-home\"\n          className=\"mr-2 underline\"\n        >\n          Return To Home\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: '.',\n            })\n          }\n          data-testid=\"relative-useNavigate-index\"\n          className=\"mr-2 underline\"\n        >\n          Return To Index\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '.',\n            })\n          }\n          data-testid=\"relative-useNavigate-reload\"\n          className=\"mr-2 underline\"\n        >\n          Reload\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '..',\n            })\n          }\n          data-testid=\"relative-useNavigate-back\"\n          className=\"mr-2 underline\"\n        >\n          Back\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: './relative-useNavigate-a',\n            })\n          }\n          data-testid=\"relative-useNavigate-a\"\n          className=\"mr-2 underline\"\n        >\n          To Relative useNavigate A\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: './relative-useNavigate-b',\n            })\n          }\n          data-testid=\"relative-useNavigate-b\"\n          className=\"mr-2 underline\"\n        >\n          To Relative Link B\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: './nested/deep',\n            })\n          }\n          data-testid=\"relative-useNavigate-deeply-nested\"\n          className=\"mr-2 underline\"\n        >\n          To Deeply Nested\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '/relative/useNavigate/path/$path',\n              params: { path: 'a' },\n            })\n          }\n          data-testid=\"relative-useNavigate-path\"\n          className=\"mr-2 underline\"\n        >\n          To Path Param A\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: './with-search',\n              search: { searchParam: '1' },\n            })\n          }\n          data-testid=\"relative-useNavigate-withSearch\"\n          className=\"mr-2 underline\"\n        >\n          To With Search Params\n        </button>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/relative/useNavigate/with-search/index.tsx",
    "content": "import { createFileRoute, useNavigate } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/relative/useNavigate/with-search/')({\n  component: RouteComponent,\n  validateSearch: z.object({\n    searchParam: z.string().default('1'),\n  }),\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n  const { searchParam } = Route.useSearch()\n\n  return (\n    <>\n      <div data-testid=\"relative-useNavigate-withSearch-header\">\n        Hello \"/relative/useNavigate/with-search/\" searchParam: {searchParam}!\n      </div>\n      <hr />\n      <button\n        onClick={() =>\n          navigate({\n            to: '.',\n            search: { searchParam: '2' },\n          })\n        }\n        data-testid=\"relative-useNavigate-withSearch-update-param\"\n      >\n        Update Search\n      </button>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/remountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/remountDeps')({\n  validateSearch(search: { searchParam: string }) {\n    return { searchParam: search.searchParam }\n  },\n  loaderDeps(opts) {\n    return opts.search\n  },\n  component: Home,\n  remountDeps(opts) {\n    return opts.search\n  },\n})\n\nlet counter = 0\n\nfunction Home() {\n  const search = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  const [mounts, setMounts] = React.useState(counter)\n  React.useEffect(() => {\n    setMounts(++counter)\n  }, [])\n\n  return (\n    <div className=\"p-2\">\n      <button\n        onClick={() => {\n          navigate({\n            search: { searchParam: Math.random().toString(36).substring(2, 8) },\n          })\n        }}\n      >\n        Regenerate search param\n      </button>\n\n      <div>Search: {search.searchParam}</div>\n      <div data-testid=\"component-mounts\">Page component mounts: {mounts}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/search-params/default.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/search-params/default')({\n  validateSearch: z.object({\n    default: z.string().default('d1'),\n  }),\n  beforeLoad: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  loader: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const context = Route.useRouteContext()\n    return (\n      <>\n        <div data-testid=\"search-default\">{search.default}</div>\n        <div data-testid=\"context-hello\">{context.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/search-params/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/search-params/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <Link\n        data-testid=\"link-to-default-without-search\"\n        to=\"/search-params/default\"\n      >\n        go to /search-params/default\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search\"\n        to=\"/search-params/default\"\n        search={{ default: 'd2' }}\n      >\n        go to /search-params/default?default=d2\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search-special-characters\"\n        to=\"/search-params/default\"\n        search={{ default: '🚀대한민국' }}\n      >\n        go to /search-params/default?default=🚀대한민국\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search-encoded-characters\"\n        to=\"/search-params/default\"\n        search={{ default: '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD' }}\n      >\n        go to\n        /search-params/default?default=%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/search-params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/search-params')({\n  beforeLoad: async () => {\n    await new Promise((resolve) => setTimeout(resolve, 100))\n    return { hello: 'world' as string }\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/structural-sharing.$enabled.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, getRouteApi, useSearch } from '@tanstack/react-router'\nimport React from 'react'\nimport { z } from 'zod'\n\nconst enabledSchema = {\n  enabled: z.preprocess((val) => {\n    if (typeof val === 'string') {\n      if (val.toLowerCase() === 'true') return true\n      if (val.toLowerCase() === 'false') return false\n    }\n    return val\n  }, z.boolean()),\n}\n\nexport const Route = createFileRoute('/structural-sharing/$enabled')({\n  component: RouteComponent,\n  params: {\n    parse: (p) => z.object(enabledSchema).parse(p),\n  },\n  validateSearch: z.object({ foo: z.string(), bar: z.string() }),\n})\n\nfunction useRenderCount() {\n  const count = React.useRef(0)\n  count.current++\n  return count.current\n}\n\nconst api = getRouteApi('/structural-sharing/$enabled')\nfunction RouteComponent() {\n  console.log('rendering')\n  const renderCount = useRenderCount()\n  const { enabled } = Route.useParams()\n\n  const searchViaRouteHook = Route.useSearch({\n    select: ({ foo, bar }) => {\n      return { values: [foo, bar] }\n    },\n    structuralSharing: enabled,\n  })\n\n  const searchViaHook = useSearch({\n    from: Route.id,\n    select: ({ foo, bar }) => {\n      return { values: [foo, bar] }\n    },\n    structuralSharing: enabled,\n  })\n\n  const searchViaRouteApiHook = api.useSearch({\n    select: ({ foo, bar }) => {\n      return { values: [foo, bar] }\n    },\n    structuralSharing: enabled,\n  })\n\n  return (\n    <>\n      <div data-testid=\"enabled\">{JSON.stringify(enabled)}</div>\n      <div data-testid=\"render-count\">{renderCount}</div>\n      <div data-testid=\"search-via-hook\">{JSON.stringify(searchViaHook)}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {JSON.stringify(searchViaRouteHook)}\n      </div>\n      <div data-testid=\"search-via-route-api-hook\">\n        {JSON.stringify(searchViaRouteApiHook)}\n      </div>\n\n      <br />\n      <Link\n        search={{ foo: 'f2', bar: 'b2' }}\n        from=\"/structural-sharing/$enabled\"\n        data-testid=\"link\"\n      >\n        go to f2/b2\n      </Link>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/대한민국/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/대한민국')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h3 className=\"pb-2\" data-testid=\"unicode-heading\">\n        Hello \"/대한민국\"!\n      </h3>\n      <ul className=\"grid mb-2\">\n        <li>\n          <Link\n            data-testid=\"l-to-named-latin\"\n            from={Route.fullPath}\n            to=\"./🚀/$id\"\n            params={{ id: 'foo' }}\n            activeProps={{ className: 'font-bold' }}\n          >\n            link to latin id\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-named-unicode\"\n            from={Route.fullPath}\n            to=\"./🚀/$id\"\n            params={{ id: 'foo%\\\\/🚀대' }}\n            activeProps={{ className: 'font-bold' }}\n          >\n            link to unicode id\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-latin\"\n            from={Route.fullPath}\n            to=\"./wildcard/$\"\n            params={{ _splat: 'foo/bar' }}\n            activeProps={{ className: 'font-bold' }}\n          >\n            link to foo/bar\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-unicode\"\n            from={Route.fullPath}\n            to=\"./wildcard/$\"\n            params={{ _splat: 'foo%\\\\/🚀대' }}\n            activeProps={{ className: 'font-bold' }}\n          >\n            link to foo%\\/🚀대\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/대한민국/wildcard.$.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/대한민국/wildcard/$')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <h3 data-testid=\"unicode-wildcard-heading\">Unicode Wildcard Params</h3>\n      <div>\n        Hello /대한민국/wildcard/\n        <span data-testid=\"unicode-wildcard-params\">{params._splat}</span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/routes/대한민국/🚀.$id.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/대한민국/🚀/$id')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <h3 data-testid=\"unicode-named-heading\">Unicode Named Params</h3>\n      <div>\n        Hello /대한민국/🚀/\n        <span data-testid=\"unicode-named-params\">{params.id}</span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('lazy file route errorComponent is rendered when the loader throws', async ({\n  page,\n}) => {\n  await page.goto('/lazy-error')\n\n  await expect(page.getByTestId('lazy-route-error-component')).toContainText(\n    'Lazy route error component',\n  )\n  await expect(page.locator('body')).not.toContainText('Something went wrong!')\n})\n\ntest(\"useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest('useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest(\"legacy useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('legacy useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('legacy Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('useCanGoBack correctly disables back button', async ({ page }) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goForward()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\ntest('useCanGoBack correctly disables back button, using router.history and window.history', async ({\n  page,\n}) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\nconst testCases = [\n  {\n    description: 'Navigating to a route inside a route group',\n    testId: 'link-to-route-inside-group',\n  },\n  {\n    description:\n      'Navigating to a route inside a subfolder inside a route group ',\n    testId: 'link-to-route-inside-group-inside-subfolder',\n  },\n  {\n    description: 'Navigating to a route inside a route group inside a layout',\n    testId: 'link-to-route-inside-group-inside-layout',\n  },\n  {\n    description: 'Navigating to a lazy route inside a route group',\n    testId: 'link-to-lazy-route-inside-group',\n  },\n\n  {\n    description: 'Navigating to the only route inside a route group ',\n    testId: 'link-to-only-route-inside-group',\n  },\n]\n\ntestCases.forEach(({ description, testId }) => {\n  test(description, async ({ page }) => {\n    await page.getByTestId(testId).click()\n    await expect(page.getByTestId('search-via-hook')).toContainText('world')\n    await expect(page.getByTestId('search-via-route-hook')).toContainText(\n      'world',\n    )\n    await expect(page.getByTestId('search-via-route-api')).toContainText(\n      'world',\n    )\n  })\n})\n\ntest('navigating to an unnested route', async ({ page }) => {\n  const postId = 'hello-world'\n  await page.goto(`/posts/${postId}/edit`)\n  await page.waitForURL(`/posts/${postId}/edit`)\n  await expect(page.getByTestId('params-via-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-api')).toContainText(postId)\n})\n\nasync function getRenderCount(page: Page) {\n  const renderCount = parseInt(\n    await page.getByTestId('render-count').innerText(),\n  )\n  return renderCount\n}\nasync function structuralSharingTest(page: Page, enabled: boolean) {\n  page.goto(`/structural-sharing/${enabled}/?foo=f1&bar=b1`)\n  await expect(page.getByTestId('enabled')).toHaveText(JSON.stringify(enabled))\n\n  async function checkSearch({ foo, bar }: { foo: string; bar: string }) {\n    expect(page.url().endsWith(`?foo=${foo}&bar=${bar}`)).toBe(true)\n    const expectedSearch = JSON.stringify({ values: [foo, bar] })\n    await expect(page.getByTestId('search-via-hook')).toHaveText(expectedSearch)\n    await expect(page.getByTestId('search-via-route-hook')).toHaveText(\n      expectedSearch,\n    )\n    await expect(page.getByTestId('search-via-route-api-hook')).toHaveText(\n      expectedSearch,\n    )\n  }\n\n  await checkSearch({ bar: 'b1', foo: 'f1' })\n  await page.getByTestId('link').click()\n  await checkSearch({ bar: 'b2', foo: 'f2' })\n}\n\ntest('structural sharing disabled', async ({ page }) => {\n  await structuralSharingTest(page, false)\n  expect(await getRenderCount(page)).toBe(2)\n  await page.getByTestId('link').click()\n  expect(await getRenderCount(page)).toBeGreaterThan(2)\n})\n\ntest('structural sharing enabled', async ({ page }) => {\n  await structuralSharingTest(page, true)\n  expect(await getRenderCount(page)).toBe(2)\n  await page.getByTestId('link').click()\n  expect(await getRenderCount(page)).toBe(2)\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n\ntest('Should change post navigating back and forth', async ({ page }) => {\n  await page.goto('/posts/1')\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n\n  await page.getByRole('link', { name: 'qui est esse' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('qui est esse')\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('sunt aut facere')\n})\n\ntest('Should not remount deps when remountDeps does not change ', async ({\n  page,\n}) => {\n  await page.goto('/notRemountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n})\n\ntest('Should remount deps when remountDeps does change ', async ({ page }) => {\n  await page.goto('/remountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 2',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 3',\n  )\n})\n\ntest.describe('Unicode route rendering', () => {\n  test('should render non-latin route correctly', async ({ page, baseURL }) => {\n    await page.goto('/대한민국')\n\n    await expect(page.locator('body')).toContainText('Hello \"/대한민국\"!')\n\n    expect(page.url()).toBe(`${baseURL}/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`)\n  })\n})\n\ntest.describe('Pathless layout routes', () => {\n  test('direct navigation to pathless layout route renders correctly', async ({\n    page,\n  }) => {\n    await page.goto('/pathless-layout')\n    await expect(page.getByTestId('pathless-layout-header')).toContainText(\n      'Pathless Layout Section',\n    )\n    await expect(page.getByTestId('pathless-layout-wrapper')).toContainText(\n      'Pathless Layout Wrapper',\n    )\n    await expect(page.getByTestId('pathless-layout-index')).toContainText(\n      'Pathless Layout Index',\n    )\n  })\n\n  test('client-side navigation to pathless layout route', async ({ page }) => {\n    await page.goto('/')\n    await page.getByTestId('link-to-pathless-layout').click()\n    await expect(page.getByTestId('pathless-layout-header')).toContainText(\n      'Pathless Layout Section',\n    )\n    await expect(page.getByTestId('pathless-layout-wrapper')).toContainText(\n      'Pathless Layout Wrapper',\n    )\n  })\n\n  test('navigation within pathless layout preserves layout', async ({\n    page,\n  }) => {\n    await page.goto('/pathless-layout')\n    await page.getByTestId('link-to-child').click()\n    await expect(page.getByTestId('pathless-layout-header')).toContainText(\n      'Pathless Layout Section',\n    )\n    await expect(page.getByTestId('pathless-layout-wrapper')).toContainText(\n      'Pathless Layout Wrapper',\n    )\n    await expect(page.getByTestId('pathless-layout-child')).toContainText(\n      'Pathless Layout Child Route',\n    )\n  })\n\n  test('direct navigation to child of pathless layout', async ({ page }) => {\n    await page.goto('/pathless-layout/child')\n    await expect(page.getByTestId('pathless-layout-header')).toContainText(\n      'Pathless Layout Section',\n    )\n    await expect(page.getByTestId('pathless-layout-wrapper')).toContainText(\n      'Pathless Layout Wrapper',\n    )\n    await expect(page.getByTestId('pathless-layout-child')).toContainText(\n      'Pathless Layout Child Route',\n    )\n  })\n\n  test('navigating to non-existent route under pathless layout shows not found', async ({\n    page,\n  }) => {\n    await page.goto('/pathless-layout/does-not-exist')\n    await expect(page.getByTestId('pathless-layout-not-found')).toContainText(\n      'Not Found in Pathless Layout',\n    )\n    await expect(page.locator('body')).toContainText('Not Found')\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/fullpath-types.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('FullPath type/runtime match (Issues #4892, #2675, #6403)', () => {\n  test.describe('Pathless layout routes should have parent fullPath, not empty string', () => {\n    test('direct navigation to pathless layout shows correct fullPath', async ({\n      page,\n    }) => {\n      await page.goto('/fullpath-test')\n      // The pathless layout's fullPath should be '/fullpath-test' (same as parent), not ''\n      await expect(page.getByTestId('pathless-layout-fullpath')).toHaveText(\n        '/fullpath-test',\n      )\n    })\n\n    test('client-side navigation to pathless layout shows correct fullPath', async ({\n      page,\n    }) => {\n      await page.goto('/')\n      await page.getByTestId('link-to-fullpath-test').click()\n      await expect(page.getByTestId('pathless-layout-fullpath')).toHaveText(\n        '/fullpath-test',\n      )\n    })\n  })\n\n  test.describe('Index routes should have trailing slash in fullPath', () => {\n    test('direct navigation to index route shows fullPath with trailing slash', async ({\n      page,\n    }) => {\n      await page.goto('/fullpath-test')\n      // The index route's fullPath should be '/fullpath-test/' (with trailing slash)\n      await expect(page.getByTestId('index-route-fullpath')).toHaveText(\n        '/fullpath-test/',\n      )\n    })\n\n    test('param route under pathless layout shows correct fullPath', async ({\n      page,\n    }) => {\n      await page.goto('/fullpath-test/123')\n      // The param route's fullPath should be '/fullpath-test/$id'\n      await expect(page.getByTestId('param-route-fullpath')).toHaveText(\n        '/fullpath-test/$id',\n      )\n      await expect(page.getByTestId('fullpath-test-param')).toHaveText(\n        'Param: 123',\n      )\n    })\n  })\n\n  test.describe('Route.to should NOT have trailing slash (Issue #3005)', () => {\n    test('index route Route.to should not have trailing slash', async ({\n      page,\n    }) => {\n      await page.goto('/fullpath-test')\n      // Route.to should be '/fullpath-test' (without trailing slash)\n      // while Route.fullPath is '/fullpath-test/' (with trailing slash)\n      await expect(page.getByTestId('index-route-to')).toHaveText(\n        '/fullpath-test',\n      )\n    })\n  })\n\n  test.describe('Existing pathless layout routes', () => {\n    test('existing pathless layout index shows correct fullPath at runtime', async ({\n      page,\n    }) => {\n      // This tests the existing /pathless-layout route which has a pathless _layout\n      await page.goto('/pathless-layout')\n      await expect(page.getByTestId('pathless-layout-header')).toContainText(\n        'Pathless Layout Section',\n      )\n      await expect(page.getByTestId('pathless-layout-wrapper')).toContainText(\n        'Pathless Layout Wrapper',\n      )\n      await expect(page.getByTestId('pathless-layout-index')).toContainText(\n        'Pathless Layout Index',\n      )\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/hover-preload-hash.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { toRuntimePath } from '@tanstack/router-e2e-utils'\n\ntest('clicking hash link then hovering another link does not scroll back to hash', async ({\n  page,\n}) => {\n  // Go to the page without hash\n  await page.goto(toRuntimePath('/hover-preload-hash'))\n\n  // Click the hash link to navigate to position1\n  await page.getByTestId('link-to-hash').click()\n  await expect(page.locator('#position1')).toBeInViewport()\n\n  // Scroll up so position1 is no longer in view\n  await page.evaluate(() => window.scrollTo(0, 0))\n  await expect(page.locator('#position1')).not.toBeInViewport()\n\n  // Hover the link to trigger intent preload (should NOT scroll back)\n  await page.getByTestId('link-to-only-route-inside-group').hover()\n  await page.waitForTimeout(400)\n\n  // Ensure we did not jump back to the hash target\n  await expect(page.locator('#position1')).not.toBeInViewport()\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/mask.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('route masks transform params and expose masked pathname in the browser (react)', async ({\n  page,\n}) => {\n  await page.goto('/')\n\n  await page.getByTestId('link-to-masks').click()\n  await expect(page.getByText('Route Masks')).toBeVisible()\n\n  const link = page.getByTestId('link-to-admin-mask')\n  await link.click()\n\n  await page.waitForURL('/masks/public/user-42')\n\n  await expect(page.getByTestId('admin-user-component')).toBeInViewport()\n  await expect(page.getByTestId('admin-user-id')).toHaveText('42')\n\n  await expect(page.getByTestId('router-pathname')).toHaveText(\n    '/masks/admin/42',\n  )\n\n  await expect(page.getByTestId('router-masked-pathname')).toHaveText(\n    '/masks/public/user-42',\n  )\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\nconst testCases: Array<{\n  name: string\n  testPathDesc: string\n  testPathPrefix: string\n  testPathSuffix: string\n  paramValue: Record<string, string>\n  paramValue2: Record<string, string>\n}> = [\n  {\n    name: 'Named path params',\n    testPathDesc: 'named',\n    testPathPrefix: '',\n    testPathSuffix: '',\n    paramValue: { baz: 'baz' },\n    paramValue2: { baz: 'baz_' },\n  },\n  {\n    name: 'prefix params',\n    testPathPrefix: 'prefix',\n    testPathSuffix: '',\n    testPathDesc: 'prefix',\n    paramValue: { baz: 'baz' },\n    paramValue2: { baz: 'baz_' },\n  },\n  {\n    name: 'suffix params',\n    testPathPrefix: '',\n    testPathSuffix: 'suffix',\n    testPathDesc: 'suffix',\n    paramValue: { baz: 'baz' },\n    paramValue2: { baz: 'baz2' },\n  },\n  {\n    name: 'path',\n    testPathPrefix: '',\n    testPathSuffix: '',\n    testPathDesc: 'path',\n    paramValue: {},\n    paramValue2: {},\n  },\n]\n\ntest.describe('Non-nested paths', () => {\n  testCases.forEach(\n    ({\n      name,\n      testPathDesc,\n      testPathPrefix,\n      testPathSuffix,\n      paramValue,\n      paramValue2,\n    }) => {\n      test.describe(name, () => {\n        const path = `/non-nested/${testPathDesc}`\n        const paramNameDesc = Object.keys(paramValue)[0] ?? 'baz'\n\n        test.beforeEach(async ({ page }) => {\n          await page.goto('/non-nested')\n          await page.waitForURL('/non-nested')\n        })\n\n        test('Should not un-nest nested paths', async ({ page }) => {\n          const nonNestedPathHeading = page.getByTestId(\n            'non-nested-path-heading',\n          )\n          await expect(nonNestedPathHeading).toBeVisible()\n\n          await page.getByTestId(`l-to-${testPathDesc}`).click()\n          await page.waitForURL(path)\n\n          const rootRouteHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-root-route-heading`,\n          )\n\n          await expect(rootRouteHeading).toBeVisible()\n\n          const pathRouteHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-route-heading`,\n          )\n\n          const indexHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-index-heading`,\n          )\n\n          const fooHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-foo-heading`,\n          )\n\n          const indexParams = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-index-param`,\n          )\n\n          const fooParams = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-foo-param`,\n          )\n\n          const indexLink = page.getByTestId(`to-${testPathDesc}-index`)\n          const fooLink = page.getByTestId(`to-${testPathDesc}-foo`)\n          const foo2Link = page.getByTestId(`to-${testPathDesc}-foo-2`)\n\n          const indexPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}`\n          const fooPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}/foo`\n          const foo2Path = `${path}/${testPathPrefix}${paramValue2[paramNameDesc] ?? 'baz'}${testPathSuffix}/foo`\n\n          console.log(await indexLink.getAttribute('href'))\n          await expect(indexLink).toHaveAttribute('href', indexPath)\n          await expect(fooLink).toHaveAttribute('href', fooPath)\n          await expect(foo2Link).toHaveAttribute('href', foo2Path)\n\n          await indexLink.click()\n          await page.waitForURL(indexPath)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).toBeVisible()\n          await expect(indexHeading).toBeVisible()\n          const indexParamValue = await indexParams.innerText()\n          expect(JSON.parse(indexParamValue)).toEqual(paramValue)\n\n          await fooLink.click()\n          await page.waitForURL(fooPath)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).toBeVisible()\n          await expect(fooHeading).toBeVisible()\n          const fooParamValue = await fooParams.innerText()\n          expect(JSON.parse(fooParamValue)).toEqual(paramValue)\n\n          await foo2Link.click()\n          await page.waitForURL(foo2Path)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).toBeVisible()\n          await expect(fooHeading).toBeVisible()\n          const foo2ParamValue = await fooParams.innerText()\n          expect(JSON.parse(foo2ParamValue)).toEqual(paramValue2)\n        })\n\n        test('Should not nest non-nested paths', async ({ page }) => {\n          const nonNestedPathHeading = page.getByTestId(\n            'non-nested-path-heading',\n          )\n          await expect(nonNestedPathHeading).toBeVisible()\n\n          await page.getByTestId(`l-to-${testPathDesc}`).click()\n          await page.waitForURL(path)\n\n          const rootRouteHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-root-route-heading`,\n          )\n\n          await expect(rootRouteHeading).toBeVisible()\n\n          const pathRouteHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-route-heading`,\n          )\n\n          const barHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-bar-heading`,\n          )\n\n          const barParams = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-bar-param`,\n          )\n\n          const barLink = page.getByTestId(`to-${testPathDesc}-bar`)\n          const bar2Link = page.getByTestId(`to-${testPathDesc}-bar-2`)\n\n          const barPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}/bar`\n          const bar2Path = `${path}/${testPathPrefix}${paramValue2[paramNameDesc] ?? 'baz'}${testPathSuffix}/bar`\n          await expect(barLink).toHaveAttribute('href', barPath)\n\n          await expect(bar2Link).toHaveAttribute('href', bar2Path)\n\n          await barLink.click()\n          await page.waitForURL(barPath)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).not.toBeVisible()\n          await expect(barHeading).toBeVisible()\n          const barParamValue = await barParams.innerText()\n          expect(JSON.parse(barParamValue)).toEqual(paramValue)\n\n          await bar2Link.click()\n          await page.waitForURL(bar2Path)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).not.toBeVisible()\n          await expect(barHeading).toBeVisible()\n          const bar2ParamValue = await barParams.innerText()\n          expect(JSON.parse(bar2ParamValue)).toEqual(paramValue2)\n        })\n      })\n    },\n  )\n})\n\ntest.describe('Deeply nested non-nested paths', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/non-nested/deep')\n    await page.waitForURL('/non-nested/deep')\n  })\n\n  test('It should nest nested paths 1 level deep', async ({ page }) => {\n    const rootRouteHeading = page.getByTestId(\n      `non-nested-deep-root-route-heading`,\n    )\n\n    await expect(rootRouteHeading).toBeVisible()\n\n    const bazLink = page.getByTestId('to-deep-baz')\n    await bazLink.click()\n    await page.waitForURL('/non-nested/deep/baz')\n    const bazRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-route-heading',\n    )\n    const bazIndexHeading = page.getByTestId(\n      'non-nested-deep-baz-index-heading',\n    )\n    const bazIndexParams = page.getByTestId('non-nested-deep-baz-index-param')\n\n    await expect(bazRouteHeading).toBeVisible()\n    await expect(bazIndexHeading).toBeVisible()\n    expect(await bazIndexParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz' }),\n    )\n  })\n\n  test('It should not nest non-nested paths 1 level deep', async ({ page }) => {\n    const rootRouteHeading = page.getByTestId(\n      `non-nested-deep-root-route-heading`,\n    )\n\n    await expect(rootRouteHeading).toBeVisible()\n    const bazBarLink = page.getByTestId('to-deep-baz-bar')\n\n    await bazBarLink.click()\n    await page.waitForURL('/non-nested/deep/baz-bar/bar')\n    const bazRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-route-heading',\n    )\n    const bazBarRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-route-heading',\n    )\n    const bazBarIndexHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-index-heading',\n    )\n    const bazBarIndexParams = page.getByTestId(\n      'non-nested-deep-baz-bar-index-param',\n    )\n\n    await expect(bazRouteHeading).not.toBeVisible()\n    await expect(bazBarRouteHeading).toBeVisible()\n    await expect(bazBarIndexHeading).toBeVisible()\n    expect(await bazBarIndexParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz-bar' }),\n    )\n  })\n\n  test('It should not nest non-nested paths 2 levels deep', async ({\n    page,\n  }) => {\n    const rootRouteHeading = page.getByTestId(\n      `non-nested-deep-root-route-heading`,\n    )\n\n    await expect(rootRouteHeading).toBeVisible()\n\n    const bazBarQuxLink = page.getByTestId('to-deep-baz-bar-qux')\n    await bazBarQuxLink.click()\n\n    await page.waitForURL('/non-nested/deep/baz-bar-qux/bar/qux')\n    const bazRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-route-heading',\n    )\n    const bazBarRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-route-heading',\n    )\n    const bazBarQuxHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-qux-heading',\n    )\n    const bazBarQuxParams = page.getByTestId(\n      'non-nested-deep-baz-bar-qux-param',\n    )\n\n    await expect(bazRouteHeading).not.toBeVisible()\n    await expect(bazBarRouteHeading).not.toBeVisible()\n    await expect(bazBarQuxHeading).toBeVisible()\n    await expect(bazBarQuxParams).toBeVisible()\n    expect(await bazBarQuxParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz-bar-qux' }),\n    )\n  })\n\n  test('It should nest and un-nest non-nested across paths multiple levels deep', async ({\n    page,\n  }) => {\n    const rootRouteHeading = page.getByTestId(\n      `non-nested-deep-root-route-heading`,\n    )\n\n    await expect(rootRouteHeading).toBeVisible()\n\n    const bazBarFooLink = page.getByTestId('to-deep-baz-bar-foo')\n    await bazBarFooLink.click()\n\n    await page.waitForURL('/non-nested/deep/baz-bar/bar/foo')\n\n    const bazRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-route-heading',\n    )\n    const bazBarRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-route-heading',\n    )\n    const bazBarFooRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-route-heading',\n    )\n    const bazBarFooIndexHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-index-heading',\n    )\n    const bazBarFooIndexParams = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-index-param',\n    )\n\n    await expect(bazRouteHeading).not.toBeVisible()\n    await expect(bazBarRouteHeading).toBeVisible()\n    await expect(bazBarFooRouteHeading).toBeVisible()\n    await expect(bazBarFooIndexHeading).toBeVisible()\n    await expect(bazBarFooIndexParams).toBeVisible()\n    expect(await bazBarFooIndexParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz-bar', foo: 'foo' }),\n    )\n\n    const bazBarFooQuxLink = page.getByTestId('to-deep-baz-bar-foo-qux')\n    await bazBarFooQuxLink.click()\n    await page.waitForURL('/non-nested/deep/baz-bar-qux/bar/foo/qux')\n\n    const bazBarFooQuxHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-qux-heading',\n    )\n    const bazBarFooQuxParams = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-qux-param',\n    )\n\n    await expect(bazRouteHeading).not.toBeVisible()\n    await expect(bazBarRouteHeading).toBeVisible()\n    await expect(bazBarFooRouteHeading).not.toBeVisible()\n    await expect(bazBarFooQuxHeading).toBeVisible()\n    await expect(bazBarFooQuxParams).toBeVisible()\n    expect(await bazBarFooQuxParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz-bar-qux', foo: 'foo' }),\n    )\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/open-redirect-prevention.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('Open redirect prevention', () => {\n  test.describe('CRLF injection attacks', () => {\n    test('should not redirect to external site via CR injection (%0d)', async ({\n      page,\n      baseURL,\n    }) => {\n      // This URL attempts to exploit CRLF injection to redirect to google.com\n      // %0d = \\r (carriage return)\n      // Without the fix, /\\r/google.com/ would be interpreted as //google.com/\n      // which browsers resolve as a protocol-relative URL to http://google.com/\n      await page.goto('/%0d/google.com/')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin - the path should be treated as a local path\n      // not as an external redirect\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      // The origin should be localhost, not google.com\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n    })\n\n    test('should not redirect to external site via LF injection (%0a)', async ({\n      page,\n      baseURL,\n    }) => {\n      // %0a = \\n (line feed)\n      await page.goto('/%0a/evil.com/')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n    })\n\n    test('should not redirect to external site via CRLF injection (%0d%0a)', async ({\n      page,\n      baseURL,\n    }) => {\n      // Combined CRLF injection attempt\n      await page.goto('/%0d%0a/attacker.com/')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n    })\n\n    test('should not redirect to external site via multiple control chars', async ({\n      page,\n      baseURL,\n    }) => {\n      // Multiple CR/LF characters\n      await page.goto('/%0d%0d%0a/malicious.com/path')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n    })\n  })\n\n  test.describe('Protocol-relative URL prevention', () => {\n    test('should handle paths that could be misinterpreted as protocol-relative URLs', async ({\n      page,\n      baseURL,\n    }) => {\n      // When control characters are stripped from paths like /%0d/evil.com/\n      // the result could be //evil.com/ which is a protocol-relative URL\n      // Our fix collapses these to /evil.com/ to prevent external redirects\n      // This is already tested above, but we verify the collapsed path works\n      await page.goto('/%0d/test-path/')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n      // Path should be collapsed to /test-path (not //test-path/)\n      expect(url.pathname).toMatch(/^\\/test-path\\/?$/)\n    })\n  })\n\n  test.describe('Normal navigation still works', () => {\n    test('should navigate to normal paths correctly', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/posts')\n      await page.waitForLoadState('networkidle')\n\n      expect(page.url()).toBe(`${baseURL}/posts`)\n    })\n\n    test('should handle URL-encoded characters in normal paths', async ({\n      page,\n      baseURL,\n    }) => {\n      // Normal URL encoding should still work\n      await page.goto('/params/single/hello%20world')\n      await page.waitForLoadState('networkidle')\n\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/params.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest.describe('ensure single params have been parsed correctly whilst being stable in the browser', () => {\n  const cases = [\n    { value: 'hello', expected: 'hello' },\n    {\n      value: '100%25',\n      expected: '100%',\n    },\n    {\n      value: '100%2525',\n      expected: '100%25',\n    },\n    {\n      value: '100%26',\n      expected: '100&',\n    },\n  ]\n\n  function getParsedValue(page: Page) {\n    return page.getByTestId('parsed-param-value').textContent()\n  }\n\n  for (const { value, expected } of cases) {\n    test(`navigating to /params/single/${value}`, async ({ page, baseURL }) => {\n      await page.goto(`/params/single/${value}`)\n\n      // on the first run, the value should be the same as the expected value\n      const valueOnFirstRun = await getParsedValue(page)\n      expect(valueOnFirstRun).toBe(expected)\n\n      // the url/pathname should be the same as the expected value\n      const urlOnFirstRun = page.url().replace(baseURL!, '')\n      expect(urlOnFirstRun).toBe(`/params/single/${value}`)\n\n      // click on the self link to the same value\n      await page.getByTestId('self-link-same').click()\n      const valueOnSecondRun = await getParsedValue(page)\n      expect(valueOnSecondRun).toBe(expected)\n\n      // click on the self link to the amended value\n      await page.getByTestId('self-link-amended').click()\n      const valueOnThirdRun = await getParsedValue(page)\n      expect(valueOnThirdRun).toBe(`e2e${expected}`)\n\n      // the url/pathname should be the same as the expected value\n      const urlOnThirdRun = page.url().replace(baseURL!, '')\n      expect(urlOnThirdRun).toBe(`/params/single/e2e${value}`)\n    })\n  }\n})\n\ntest.describe('params operations + non-nested routes', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/params-ps/non-nested')\n  })\n\n  test('useParams must resolve non-nested path params', async ({ page }) => {\n    await page.waitForURL('/params-ps/non-nested')\n\n    const fooBarLink = page.getByTestId('l-to-non-nested-foo-bar')\n\n    const foo2Bar2Link = page.getByTestId('l-to-non-nested-foo2-bar2')\n\n    await expect(fooBarLink).toHaveAttribute(\n      'href',\n      '/params-ps/non-nested/foo/bar',\n    )\n\n    await fooBarLink.click()\n    await page.waitForURL('/params-ps/non-nested/foo/bar')\n    const pagePathname = new URL(page.url()).pathname\n    expect(pagePathname).toBe('/params-ps/non-nested/foo/bar')\n\n    const fooParamsValue = page.getByTestId('foo-params-value')\n    const fooParamsText = await fooParamsValue.innerText()\n    const fooParamsObj = JSON.parse(fooParamsText)\n    expect(fooParamsObj).toEqual({ foo: 'foo' })\n\n    const paramsValue = page.getByTestId('foo-bar-params-value')\n    const paramsText = await paramsValue.innerText()\n    const paramsObj = JSON.parse(paramsText)\n    expect(paramsObj).toEqual({ foo: 'foo', bar: 'bar' })\n\n    await expect(foo2Bar2Link).toHaveAttribute(\n      'href',\n      '/params-ps/non-nested/foo2/bar2',\n    )\n    await foo2Bar2Link.click()\n    await page.waitForURL('/params-ps/non-nested/foo2/bar2')\n    const pagePathname2 = new URL(page.url()).pathname\n    expect(pagePathname2).toBe('/params-ps/non-nested/foo2/bar2')\n\n    const foo2ParamsValue = page.getByTestId('foo-params-value')\n    const foo2ParamsText = await foo2ParamsValue.innerText()\n    const foo2ParamsObj = JSON.parse(foo2ParamsText)\n    expect(foo2ParamsObj).toEqual({ foo: 'foo2' })\n\n    const params2Value = page.getByTestId('foo-bar-params-value')\n    const params2Text = await params2Value.innerText()\n    const params2Obj = JSON.parse(params2Text)\n    expect(params2Obj).toEqual({ foo: 'foo2', bar: 'bar2' })\n  })\n})\n\ntest.describe('params operations + prefix/suffix', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/params-ps')\n  })\n\n  test.describe('named params', () => {\n    const NAMED_PARAMS_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-named-foo',\n        pathname: '/params-ps/named/foo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFoo',\n      },\n      {\n        id: 'l-to-named-prefixfoo',\n        pathname: '/params-ps/named/prefixfoo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooPrefix',\n      },\n      {\n        id: 'l-to-named-foosuffix',\n        pathname: '/params-ps/named/foosuffix',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooSuffix',\n      },\n      {\n        id: 'l-to-named-foo-special-characters',\n        pathname: '/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80',\n        params: { foo: 'foo%\\\\/🚀대' },\n        destHeadingId: 'ParamsNamedFoo',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n\n    test(`ensure use params doesn't cause excess renders and is stable across various usage options`, async ({\n      page,\n    }) => {\n      await page.goto('/params-ps/named/foo')\n      await page.waitForLoadState('networkidle')\n\n      const pagePathname = new URL(page.url()).pathname\n      expect(pagePathname).toBe('/params-ps/named/foo')\n\n      const fooRenderCount = page.getByTestId('foo-render-count')\n      const fooIndexLink = page.getByTestId('params-foo-links-index')\n      const fooBar1Link = page.getByTestId('params-foo-links-bar1')\n      const fooBar2Link = page.getByTestId('params-foo-links-bar2')\n      const fooBarBazLink = page.getByTestId('params-foo-bar-links-baz')\n      const fooValue = page.getByTestId('params-output')\n      const fooBarValue = page.getByTestId('foo-bar-value')\n      const fooBazInBarValue = page.getByTestId('foo-baz-in-bar-value')\n      const fooBarRenderCount = page.getByTestId('foo-bar-render-count')\n      const fooBarBazValue = page.getByTestId('foo-bar-baz-value')\n\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooValue).toBeInViewport()\n      await expect(fooIndexLink).toBeInViewport()\n      await expect(fooBar1Link).toBeInViewport()\n      await expect(fooBar2Link).toBeInViewport()\n      await expect(fooRenderCount).toHaveText('1')\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n\n      await fooBar1Link.click()\n      await page.waitForLoadState('networkidle')\n      await expect(fooValue).toBeInViewport()\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooBarRenderCount).toBeInViewport()\n      await expect(fooBarValue).toBeInViewport()\n      await expect(fooBazInBarValue).toBeInViewport()\n      await expect(fooBarBazLink).toBeInViewport()\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n      await expect(fooRenderCount).toHaveText('1')\n      await expect(fooBarRenderCount).toHaveText('1')\n      await expect(fooBarValue).toHaveText('1')\n      await expect(fooBazInBarValue).toHaveText('no param')\n\n      await fooBarBazLink.click()\n      await page.waitForLoadState('networkidle')\n      await expect(fooValue).toBeInViewport()\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooBarRenderCount).toBeInViewport()\n      await expect(fooBarValue).toBeInViewport()\n      await expect(fooBazInBarValue).toBeInViewport()\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n      await expect(fooRenderCount).toHaveText('1')\n      await expect(fooBarRenderCount).toHaveText('2')\n      await expect(fooBarValue).toHaveText('1')\n      await expect(fooBazInBarValue).toHaveText('1_10')\n      await expect(fooBarBazValue).toHaveText('1_10')\n\n      await fooBar2Link.click()\n      await page.waitForLoadState('networkidle')\n      await expect(fooValue).toBeInViewport()\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooBarValue).toBeInViewport()\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n      await expect(fooRenderCount).toHaveText('1')\n      await expect(fooBarValue).toHaveText('2')\n\n      await fooIndexLink.click()\n      await page.waitForLoadState('networkidle')\n      await expect(fooValue).toBeInViewport()\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooBarValue).not.toBeInViewport()\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n      await expect(fooRenderCount).toHaveText('1')\n    })\n  })\n\n  test.describe('wildcard param', () => {\n    const WILDCARD_PARAM_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-wildcard-foo',\n        pathname: '/params-ps/wildcard/foo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n      {\n        id: 'l-to-wildcard-prefixfoo',\n        pathname: '/params-ps/wildcard/prefixfoo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatPrefix',\n      },\n      {\n        id: 'l-to-wildcard-foosuffix',\n        pathname: '/params-ps/wildcard/foosuffix',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatSuffix',\n      },\n      {\n        id: 'l-to-wildcard-escaped',\n        pathname: `/params-ps/wildcard/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]`,\n        params: {\n          _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n          '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n        },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n      {\n        id: 'l-to-wildcard-prefix-escaped',\n        pathname: `/params-ps/wildcard/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]`,\n        params: {\n          _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n          '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n        },\n        destHeadingId: 'ParamsWildcardSplatPrefix',\n      },\n      {\n        id: 'l-to-wildcard-suffix-escaped',\n        pathname: `/params-ps/wildcard/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]suffix@%EB%8C%80`,\n        params: {\n          _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n          '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n        },\n        destHeadingId: 'ParamsWildcardSplatSuffix',\n      },\n      {\n        id: 'l-to-wildcard-encoded',\n        pathname:\n          '/params-ps/wildcard/%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n        params: {\n          '*': '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n          _splat: '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n        },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n  })\n})\n\ntest.describe('Unicode params', () => {\n  test('should render non-latin route correctly across multiple params', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto('/params-ps')\n    await page.waitForURL('/params-ps')\n    const fooLink = page.getByTestId('l-to-named-foo-special-characters')\n\n    await fooLink.click()\n    await page.waitForURL('/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80')\n\n    expect(page.url()).toBe(\n      `${baseURL}/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80`,\n    )\n\n    const headingEl = page.getByRole('heading', { name: 'ParamsNamedFoo' })\n    await expect(headingEl).toBeVisible()\n    let paramsEl = page.getByTestId('params-output')\n    let paramsText = await paramsEl.innerText()\n    expect(paramsText).toEqual(JSON.stringify({ foo: 'foo%\\\\/🚀대' }))\n\n    const barLink = page.getByTestId('params-foo-links-bar-special-characters')\n\n    await barLink.click()\n\n    await page.waitForURL(\n      '/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80/%F0%9F%9A%80%252F%2Fabc%EB%8C%80',\n    )\n\n    expect(page.url()).toBe(\n      `${baseURL}/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80/%F0%9F%9A%80%252F%2Fabc%EB%8C%80`,\n    )\n\n    paramsEl = page.getByTestId('foo-bar-value')\n    paramsText = await paramsEl.innerText()\n    expect(paramsText).toEqual('🚀%2F/abc대')\n  })\n\n  test.describe('should handle routes with non-latin paths and params correctly', () => {\n    const testCases = [\n      {\n        name: 'named',\n        childPath: '🚀',\n        latinParams: 'foo',\n        unicodeParams: 'foo%\\\\/🚀대',\n      },\n      {\n        name: 'wildcard',\n        childPath: 'wildcard',\n        latinParams: 'foo/bar',\n        unicodeParams: 'foo%\\\\/🚀대',\n      },\n    ]\n\n    testCases.forEach(({ name, childPath, latinParams, unicodeParams }) => {\n      test(`${name} params`, async ({ page, baseURL }) => {\n        const pascalCaseName = name.charAt(0).toUpperCase() + name.slice(1)\n        const routeParentPath = '/대한민국'\n        const encodedRouteParentPath = encodeURI(routeParentPath)\n        const childRoutePath = `${routeParentPath}/${childPath}`\n        const encodedChildRoutePath = encodeURI(childRoutePath)\n\n        await page.goto(routeParentPath)\n        await page.waitForURL(encodedRouteParentPath)\n\n        const headingRootEl = page.getByTestId('unicode-heading')\n\n        expect(await headingRootEl.innerText()).toBe('Hello \"/대한민국\"!')\n\n        const latinLink = page.getByTestId(`l-to-${name}-latin`)\n        const unicodeLink = page.getByTestId(`l-to-${name}-unicode`)\n\n        await expect(latinLink).not.toContainClass('font-bold')\n        await expect(unicodeLink).not.toContainClass('font-bold')\n\n        await latinLink.click()\n\n        await page.waitForURL(`${encodedChildRoutePath}/${latinParams}`)\n\n        expect(page.url()).toBe(\n          `${baseURL}${encodedChildRoutePath}/${latinParams}`,\n        )\n\n        await expect(latinLink).toContainClass('font-bold')\n        await expect(unicodeLink).not.toContainClass('font-bold')\n\n        const headingEl = page.getByTestId(`unicode-${name}-heading`)\n        const paramsEl = page.getByTestId(`unicode-${name}-params`)\n\n        expect(await headingEl.innerText()).toBe(\n          `Unicode ${pascalCaseName} Params`,\n        )\n        expect(await paramsEl.innerText()).toBe(latinParams)\n\n        await unicodeLink.click()\n\n        const encodedParams =\n          name === 'wildcard'\n            ? encodeURI(unicodeParams)\n            : encodeURIComponent(unicodeParams)\n\n        await page.waitForURL(`${encodedChildRoutePath}/${encodedParams}`)\n\n        expect(page.url()).toBe(\n          `${baseURL}${encodedChildRoutePath}/${encodedParams}`,\n        )\n\n        await expect(latinLink).not.toContainClass('font-bold')\n        await expect(unicodeLink).toContainClass('font-bold')\n\n        expect(await headingEl.innerText()).toBe(\n          `Unicode ${pascalCaseName} Params`,\n        )\n        expect(await paramsEl.innerText()).toBe(unicodeParams)\n      })\n    })\n  })\n})\n\ntest.describe('useParams strict false uses parsed child params', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/params-ps')\n  })\n\n  test('parent receives parsed values after child navigation', async ({\n    page,\n  }) => {\n    await page.getByTestId('strict-false-version-1').click()\n    await page.waitForURL('/params-ps/strict-false/1')\n\n    await expect(page.getByTestId('strict-false-version-type')).toHaveText(\n      'number',\n    )\n    await expect(page.getByTestId('strict-false-version-value')).toHaveText('1')\n\n    await page.getByTestId('strict-false-version-2').click()\n    await page.waitForURL('/params-ps/strict-false/2')\n\n    await expect(page.getByTestId('strict-false-version-type')).toHaveText(\n      'number',\n    )\n    await expect(page.getByTestId('strict-false-version-value')).toHaveText('2')\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/redirect.spec.ts",
    "content": "import queryString from 'node:querystring'\nimport { expect, test } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_HOST_PORT = await getDummyServerPort(packageJson.name)\n\ntest.describe('redirects', () => {\n  const internalNavigationTestMatrix = combinate({\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n    preload: [false, true] as const,\n  })\n\n  internalNavigationTestMatrix.forEach(\n    ({ thrower, reloadDocument, preload }) => {\n      test(`internal target, navigation: thrower: ${thrower}, reloadDocument: ${reloadDocument}, preload: ${preload}`, async ({\n        page,\n      }) => {\n        await page.waitForLoadState('networkidle')\n        await page.goto(\n          `/redirect/internal${preload === false ? '?preload=false' : ''}`,\n        )\n        const link = page.getByTestId(\n          `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`,\n        )\n\n        await page.waitForLoadState('networkidle')\n        let requestHappened = false\n\n        const requestPromise = new Promise<void>((resolve) => {\n          page.on('request', (request) => {\n            if (\n              request.url() === `http://localhost:${EXTERNAL_HOST_PORT}/posts`\n            ) {\n              requestHappened = true\n              resolve()\n            }\n          })\n        })\n        await link.focus()\n\n        const expectRequestHappened = preload && !reloadDocument\n        const timeoutPromise = new Promise((resolve) =>\n          setTimeout(resolve, expectRequestHappened ? 5000 : 500),\n        )\n        await Promise.race([requestPromise, timeoutPromise])\n        await page.waitForLoadState('networkidle')\n        expect(requestHappened).toBe(expectRequestHappened)\n        await link.click()\n        let fullPageLoad = false\n        page.on('domcontentloaded', () => {\n          fullPageLoad = true\n        })\n\n        const url = `http://localhost:${PORT}/posts`\n\n        await page.waitForURL(url)\n        if (reloadDocument) {\n          await page.waitForLoadState('domcontentloaded')\n        }\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n        expect(fullPageLoad).toBe(reloadDocument)\n      })\n    },\n  )\n\n  const internalDirectVisitTestMatrix = combinate({\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n  })\n\n  internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => {\n    test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({\n      page,\n    }) => {\n      await page.waitForLoadState('networkidle')\n\n      await page.goto(`/redirect/internal/via-${thrower}`)\n\n      const url = `http://localhost:${PORT}/posts`\n\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n      await page.waitForLoadState('networkidle')\n      await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n    })\n  })\n\n  const externalTestMatrix = combinate({\n    scenario: ['navigate', 'direct_visit'] as const,\n    thrower: ['beforeLoad', 'loader'] as const,\n  })\n\n  externalTestMatrix.forEach(({ scenario, thrower }) => {\n    test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({\n      page,\n    }) => {\n      await page.waitForLoadState('networkidle')\n\n      const q = queryString.stringify({\n        externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n      })\n\n      if (scenario === 'navigate') {\n        await page.goto(`/redirect/external?${q}`)\n        await page.getByTestId(`via-${thrower}`).click()\n      } else {\n        await page.goto(`/redirect/external/via-${thrower}?${q}`)\n      }\n\n      const url = `http://localhost:${EXTERNAL_HOST_PORT}/`\n\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n    })\n  })\n\n  test('regression test for #3097', async ({ page }) => {\n    await page.goto(`/redirect/preload/first`)\n    const link = page.getByTestId(`link`)\n    await link.focus()\n    await link.click()\n    await page.waitForURL('/redirect/preload/third')\n    await expect(page.getByTestId(`third`)).toBeInViewport()\n  })\n\n  // Tests for Route.redirect() method - tests relative redirects\n  test.describe('Route.redirect()', () => {\n    const routeRedirectInternalTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n    })\n\n    // Test internal relative redirects (the key feature being tested)\n    routeRedirectInternalTestMatrix.forEach(({ thrower }) => {\n      test(`internal target (relative redirect), navigation: thrower: ${thrower}`, async ({\n        page,\n      }) => {\n        await page.goto('/redirect/internal')\n        await page.waitForLoadState('networkidle')\n\n        const link = page.getByTestId(`via-route-redirect-${thrower}`)\n        await link.click()\n\n        // Should redirect to the relative ./destination route\n        const url = `http://localhost:${PORT}/redirect/internal/destination`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('redirect-destination')).toBeInViewport()\n      })\n    })\n\n    routeRedirectInternalTestMatrix.forEach(({ thrower }) => {\n      test(`internal target (relative redirect), direct visit: thrower: ${thrower}`, async ({\n        page,\n      }) => {\n        await page.goto(`/redirect/internal/via-route-redirect-${thrower}`)\n\n        // Should redirect to the relative ./destination route\n        const url = `http://localhost:${PORT}/redirect/internal/destination`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('redirect-destination')).toBeInViewport()\n      })\n    })\n\n    // Test external redirects still work with Route.redirect()\n    const externalRouteRedirectTestMatrix = combinate({\n      scenario: ['navigate', 'direct_visit'] as const,\n      thrower: ['beforeLoad', 'loader'] as const,\n    })\n\n    externalRouteRedirectTestMatrix.forEach(({ scenario, thrower }) => {\n      test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({\n        page,\n      }) => {\n        const q = queryString.stringify({\n          externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n        })\n\n        if (scenario === 'navigate') {\n          await page.goto(`/redirect/external?${q}`)\n          await page.waitForLoadState('networkidle')\n          await page.getByTestId(`via-route-redirect-${thrower}`).click()\n        } else {\n          await page.goto(\n            `/redirect/external/via-route-redirect-${thrower}?${q}`,\n          )\n        }\n\n        const url = `http://localhost:${EXTERNAL_HOST_PORT}/`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n      })\n    })\n  })\n\n  // Tests for getRouteApi().redirect() method - tests relative redirects\n  test.describe('getRouteApi().redirect()', () => {\n    const routeApiRedirectInternalTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n    })\n\n    // Test internal relative redirects (the key feature being tested)\n    routeApiRedirectInternalTestMatrix.forEach(({ thrower }) => {\n      test(`internal target (relative redirect), navigation: thrower: ${thrower}`, async ({\n        page,\n      }) => {\n        await page.goto('/redirect/internal')\n        await page.waitForLoadState('networkidle')\n\n        const link = page.getByTestId(`via-routeApi-redirect-${thrower}`)\n        await link.click()\n\n        // Should redirect to the relative ./destination route\n        const url = `http://localhost:${PORT}/redirect/internal/destination`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('redirect-destination')).toBeInViewport()\n      })\n    })\n\n    routeApiRedirectInternalTestMatrix.forEach(({ thrower }) => {\n      test(`internal target (relative redirect), direct visit: thrower: ${thrower}`, async ({\n        page,\n      }) => {\n        await page.goto(`/redirect/internal/via-routeApi-redirect-${thrower}`)\n\n        // Should redirect to the relative ./destination route\n        const url = `http://localhost:${PORT}/redirect/internal/destination`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('redirect-destination')).toBeInViewport()\n      })\n    })\n\n    // Test external redirects still work with getRouteApi().redirect()\n    const externalRouteApiRedirectTestMatrix = combinate({\n      scenario: ['navigate', 'direct_visit'] as const,\n      thrower: ['beforeLoad', 'loader'] as const,\n    })\n\n    externalRouteApiRedirectTestMatrix.forEach(({ scenario, thrower }) => {\n      test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({\n        page,\n      }) => {\n        const q = queryString.stringify({\n          externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n        })\n\n        if (scenario === 'navigate') {\n          await page.goto(`/redirect/external?${q}`)\n          await page.waitForLoadState('networkidle')\n          await page.getByTestId(`via-routeApi-redirect-${thrower}`).click()\n        } else {\n          await page.goto(\n            `/redirect/external/via-routeApi-redirect-${thrower}?${q}`,\n          )\n        }\n\n        const url = `http://localhost:${EXTERNAL_HOST_PORT}/`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/relative.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\nconst PORT = await getTestServerPort(packageJson.name)\n\ntest.describe('relative_routing', () => {\n  const internalNavigationTestMatrix = combinate({\n    navigation: ['link', 'useNavigate'] as const,\n  })\n\n  internalNavigationTestMatrix.forEach(({ navigation }) => {\n    test(`simple relative navigation. navigation: ${navigation}`, async ({\n      page,\n    }) => {\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      const indexLink = page.getByTestId(`relative-${navigation}-index`)\n      const backLink = page.getByTestId(`relative-${navigation}-back`)\n      const relativeRouteA = page.getByTestId(`relative-${navigation}-a`)\n      const relativeRouteB = page.getByTestId(`relative-${navigation}-b`)\n\n      await relativeRouteA.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/relative-${navigation}-a`,\n      )\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-a-header`),\n      ).toBeInViewport()\n\n      await relativeRouteB.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/relative-${navigation}-b`,\n      )\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-b-header`),\n      ).toBeInViewport()\n\n      await indexLink.click()\n\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-b-header`),\n      ).not.toBeInViewport()\n\n      await backLink.click()\n\n      await page.waitForURL(`http://localhost:${PORT}/relative`)\n\n      await expect(page.getByTestId(`relative-routing-home`)).toBeInViewport()\n    })\n\n    test(`nested chilren. navigation: ${navigation}`, async ({ page }) => {\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      const backLink = page.getByTestId(`relative-${navigation}-back`)\n\n      const deeplyNestedChildRoute = page.getByTestId(\n        `relative-${navigation}-deeply-nested`,\n      )\n\n      await deeplyNestedChildRoute.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/nested/deep`,\n      )\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-nested-deep-header`),\n      ).toBeInViewport()\n\n      await backLink.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/nested`,\n      )\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-nested-header`),\n      ).toBeInViewport()\n    })\n\n    test(`with path params. navigation: ${navigation}`, async ({ page }) => {\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      const pathParamRoute = page.getByTestId(`relative-${navigation}-path`)\n\n      await pathParamRoute.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/path/a`,\n      )\n\n      expect(page.url().endsWith('/path/a')).toBe(true)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-path-param-header`),\n      ).toBeInViewport()\n\n      const switchParamLink = page.getByTestId(\n        `relative-${navigation}-path-param-switchAB`,\n      )\n\n      await switchParamLink.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/path/b`,\n      )\n\n      expect(page.url().endsWith('/path/b')).toBe(true)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-path-param-header`),\n      ).toBeInViewport()\n    })\n\n    test(`with search params. navigation: ${navigation}`, async ({ page }) => {\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      const searchParamRoute = page.getByTestId(\n        `relative-${navigation}-withSearch`,\n      )\n\n      await searchParamRoute.click()\n\n      let expectedUrl = new URL(\n        `http://localhost:${PORT}/relative/${navigation}/with-search?searchParam=\"1\"`,\n      )\n\n      await page.waitForLoadState('domcontentloaded')\n\n      expect(page.url().toString()).toBe(expectedUrl.toString())\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-withSearch-header`),\n      ).toBeInViewport()\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-withSearch-header`),\n      ).toContainText('searchParam: 1')\n\n      const updateSearchLink = page.getByTestId(\n        `relative-${navigation}-withSearch-update-param`,\n      )\n\n      await updateSearchLink.click()\n\n      await page.waitForLoadState('domcontentloaded')\n\n      expectedUrl = new URL(\n        `http://localhost:${PORT}/relative/${navigation}/with-search?searchParam=\"2\"`,\n      )\n\n      expect(page.url().toString()).toBe(expectedUrl.toString())\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-withSearch-header`),\n      ).toContainText('searchParam: 2')\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-withSearch-header`),\n      ).toBeInViewport()\n    })\n\n    test(`shouldn't cause excessive rendering. navigation: ${navigation}`, async ({\n      page,\n    }) => {\n      let navigateMsgs = 0\n\n      page.on('console', (msg) => {\n        if (msg.text() === 'navigate') {\n          navigateMsgs++\n        }\n      })\n\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      expect(navigateMsgs).toBe(1)\n      const indexLink = page.getByTestId(`relative-${navigation}-index`)\n      const backLink = page.getByTestId(`relative-${navigation}-back`)\n      const relativeRouteA = page.getByTestId(`relative-${navigation}-a`)\n      const relativeRouteB = page.getByTestId(`relative-${navigation}-b`)\n      const deeplyNestedChildRoute = page.getByTestId(\n        `relative-${navigation}-deeply-nested`,\n      )\n      const pathParamRoute = page.getByTestId(`relative-${navigation}-path`)\n      const searchParamRoute = page.getByTestId(\n        `relative-${navigation}-withSearch`,\n      )\n\n      await relativeRouteA.click()\n      await page.waitForLoadState('domcontentloaded')\n      await relativeRouteB.click()\n      await page.waitForLoadState('domcontentloaded')\n      await deeplyNestedChildRoute.click()\n      await page.waitForLoadState('domcontentloaded')\n      await backLink.click()\n      await page.waitForLoadState('domcontentloaded')\n      await pathParamRoute.click()\n      await page.waitForLoadState('domcontentloaded')\n      const switchParamLink = page.getByTestId(\n        `relative-${navigation}-path-param-switchAB`,\n      )\n      await switchParamLink.click()\n      await page.waitForLoadState('domcontentloaded')\n      await searchParamRoute.click()\n      await page.waitForLoadState('domcontentloaded')\n\n      const updateSearchLink = page.getByTestId(\n        `relative-${navigation}-withSearch-update-param`,\n      )\n\n      await updateSearchLink.click()\n      await page.waitForLoadState('domcontentloaded')\n\n      await indexLink.click()\n      await page.waitForLoadState('domcontentloaded')\n\n      expect(navigateMsgs).toBe(1)\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/scroll-into-view.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\nconst anchors = {\n  defaultAnchor: 'default-anchor',\n  noScrollIntoView: 'false-anchor',\n  smoothScroll: 'smooth-scroll',\n} as const\n\nconst formTestIds = {\n  targetAnchor: 'hash-select',\n  scrollIntoView: 'with-scroll',\n  behaviorSelect: 'behavior-select',\n  blockSelect: 'block-select',\n  inlineSelect: 'inline-select',\n  navigateButton: 'navigate-button',\n}\n\nconst shownSuffix = '(shown)'\n\nconst activeClass = 'font-bold active'\n\nfunction getAnchorTarget(page: Page, anchor: string) {\n  return page.getByTestId(`heading-${anchor}`)\n}\n\nfunction getAnchorLink(page: Page, anchor: string) {\n  return page.getByTestId(`link-${anchor}`)\n}\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/anchor')\n})\n\n// Testing the `Link` component with the `hashScrollIntoView` prop\ntest('Navigating via anchor `Link` with default hash scrolling behavior', async ({\n  page,\n}) => {\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  await getAnchorLink(page, anchors.defaultAnchor).click()\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).toBeVisible()\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.defaultAnchor)).toHaveClass(\n    activeClass,\n  )\n})\n\ntest('Navigating via anchor `Link` with hash scrolling disabled', async ({\n  page,\n}) => {\n  const initialScrollPosition = await page.evaluate(() => window.scrollY)\n\n  await expect(\n    getAnchorTarget(page, anchors.noScrollIntoView),\n  ).not.toContainText(shownSuffix)\n\n  await getAnchorLink(page, anchors.noScrollIntoView).click()\n\n  // The active anchor should have updated\n  await expect(getAnchorLink(page, anchors.noScrollIntoView)).toHaveClass(\n    activeClass,\n  )\n\n  // The anchor should not have been visible, because the scroll should not have been activated\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  // Expect the same scroll position as before\n  expect(await page.evaluate(() => window.scrollY)).toBe(initialScrollPosition)\n})\n\ntest('Navigating via anchor `Link` with smooth hash scrolling behavior', async ({\n  page,\n}) => {\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  await getAnchorLink(page, anchors.smoothScroll).click()\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).toBeVisible()\n\n  // Smooth scrolling should activate the IntersectionObserver on all headings, making them all render \"(shown)\"\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText(\n    shownSuffix,\n  )\n  await expect(getAnchorTarget(page, anchors.noScrollIntoView)).toContainText(\n    shownSuffix,\n  )\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass(\n    activeClass,\n  )\n})\n\n// Testing the `useNavigate` hook with the `hashScrollIntoView` option\ntest('Navigating via `useNavigate` with instant scroll behavior', async ({\n  page,\n}) => {\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  // Scroll to the last anchor instantly, should not activate Intersection Observers for the other anchors\n  await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll')\n  await page.getByTestId(formTestIds.scrollIntoView).check()\n  await page.getByTestId(formTestIds.behaviorSelect).selectOption('instant')\n  await page.getByTestId(formTestIds.blockSelect).selectOption('start')\n  await page.getByTestId(formTestIds.inlineSelect).selectOption('nearest')\n  await page.getByTestId(formTestIds.navigateButton).click()\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  await expect(\n    getAnchorTarget(page, anchors.noScrollIntoView),\n  ).not.toContainText(shownSuffix)\n\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toBeVisible()\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass(\n    activeClass,\n  )\n})\n\ntest('Navigating via `useNavigate` with scrollIntoView disabled', async ({\n  page,\n}) => {\n  const initialScrollPosition = await page.evaluate(() => window.scrollY)\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  await expect(\n    getAnchorTarget(page, anchors.noScrollIntoView),\n  ).not.toContainText(shownSuffix)\n\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  // Navigate to the last anchor, but with scrollIntoView disabled should not activate Intersection Observers for any anchors\n  await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll')\n  await page.getByTestId(formTestIds.scrollIntoView).uncheck()\n  await page.getByTestId(formTestIds.navigateButton).click()\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  await expect(\n    getAnchorTarget(page, anchors.noScrollIntoView),\n  ).not.toContainText(shownSuffix)\n\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass(\n    activeClass,\n  )\n\n  // Expect the same scroll position as before\n  expect(await page.evaluate(() => window.scrollY)).toBe(initialScrollPosition)\n})\n\ntest('Navigating via `useNavigate` with smooth scroll behavior', async ({\n  page,\n}) => {\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  // Scroll to the last anchor smoothly, should activate Intersection Observers for the other anchors, making them all render \"(shown)\"\n  await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll')\n  await page.getByTestId(formTestIds.scrollIntoView).check()\n  await page.getByTestId(formTestIds.behaviorSelect).selectOption('smooth')\n  await page.getByTestId(formTestIds.blockSelect).selectOption('start')\n  await page.getByTestId(formTestIds.inlineSelect).selectOption('nearest')\n  await page.getByTestId(formTestIds.navigateButton).click()\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorTarget(page, anchors.noScrollIntoView)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass(\n    activeClass,\n  )\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/search-params.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('/search-params/default', () => {\n  test('Directly visiting the route without search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/default')\n    await page.waitForURL('/search-params/default?default=d1')\n\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/default/?default=d2')\n    await page.waitForURL('/search-params/default?default=d2')\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with special character search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/default/?default=🚀대한민국')\n    await page.waitForURL(\n      '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n    )\n\n    await expect(page.getByTestId('search-default')).toContainText('🚀대한민국')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n\n    expect(\n      page\n        .url()\n        .endsWith(\n          '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n        ),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with encoded character search param set', async ({\n    page,\n  }) => {\n    await page.goto(\n      '/search-params/default/?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n    )\n    await page.waitForURL(\n      '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n    )\n\n    await expect(page.getByTestId('search-default')).toContainText(\n      '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n    )\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n\n    expect(\n      page\n        .url()\n        .endsWith(\n          '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n        ),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route without search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-without-search').click()\n    await page.waitForURL('/search-params/default?default=d1')\n\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-with-search').click()\n    await page.waitForURL('/search-params/default?default=d2')\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with special character search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/')\n    await page\n      .getByTestId('link-to-default-with-search-special-characters')\n      .click()\n    await page.waitForURL(\n      '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n    )\n\n    await expect(page.getByTestId('search-default')).toContainText('🚀대한민국')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page\n        .url()\n        .endsWith(\n          '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n        ),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with encoded character search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/')\n    await page\n      .getByTestId('link-to-default-with-search-encoded-characters')\n      .click()\n    await page.waitForURL(\n      '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n    )\n\n    await expect(page.getByTestId('search-default')).toContainText(\n      '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n    )\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page\n        .url()\n        .endsWith(\n          '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n        ),\n    ).toBeTruthy()\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basic-file-based-code-splitting\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e:verbose-routes:true\": \"rm -rf port*.txt; VERBOSE_FILE_ROUTES=1 playwright test --project=chromium\",\n    \"test:e2e:verbose-routes:false\": \"rm -rf port*.txt; VERBOSE_FILE_ROUTES=0 playwright test --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:verbose-routes:true && pnpm run test:e2e:verbose-routes:false\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as WithoutLoaderRouteImport } from './routes/without-loader'\nimport { Route as ViewportTestRouteImport } from './routes/viewport-test'\nimport { Route as SharedSingletonRouteImport } from './routes/shared-singleton'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst WithoutLoaderRoute = WithoutLoaderRouteImport.update({\n  id: '/without-loader',\n  path: '/without-loader',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ViewportTestRoute = ViewportTestRouteImport.update({\n  id: '/viewport-test',\n  path: '/viewport-test',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SharedSingletonRoute = SharedSingletonRouteImport.update({\n  id: '/shared-singleton',\n  path: '/shared-singleton',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/shared-singleton': typeof SharedSingletonRoute\n  '/viewport-test': typeof ViewportTestRoute\n  '/without-loader': typeof WithoutLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/shared-singleton': typeof SharedSingletonRoute\n  '/viewport-test': typeof ViewportTestRoute\n  '/without-loader': typeof WithoutLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/shared-singleton': typeof SharedSingletonRoute\n  '/viewport-test': typeof ViewportTestRoute\n  '/without-loader': typeof WithoutLoaderRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/shared-singleton'\n    | '/viewport-test'\n    | '/without-loader'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/layout-a'\n    | '/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/shared-singleton'\n    | '/viewport-test'\n    | '/without-loader'\n    | '/posts/$postId'\n    | '/posts'\n    | '/layout-a'\n    | '/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/shared-singleton'\n    | '/viewport-test'\n    | '/without-loader'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n  SharedSingletonRoute: typeof SharedSingletonRoute\n  ViewportTestRoute: typeof ViewportTestRoute\n  WithoutLoaderRoute: typeof WithoutLoaderRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/without-loader': {\n      id: '/without-loader'\n      path: '/without-loader'\n      fullPath: '/without-loader'\n      preLoaderRoute: typeof WithoutLoaderRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/viewport-test': {\n      id: '/viewport-test'\n      path: '/viewport-test'\n      fullPath: '/viewport-test'\n      preLoaderRoute: typeof ViewportTestRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/shared-singleton': {\n      id: '/shared-singleton'\n      path: '/shared-singleton'\n      fullPath: '/shared-singleton'\n      preLoaderRoute: typeof SharedSingletonRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ndeclare module './routes/index' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/_layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout',\n    FileRoutesByPath['/_layout']['parentRoute'],\n    FileRoutesByPath['/_layout']['id'],\n    FileRoutesByPath['/_layout']['path'],\n    FileRoutesByPath['/_layout']['fullPath']\n  >\n}\ndeclare module './routes/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/shared-singleton' {\n  const createFileRoute: CreateFileRoute<\n    '/shared-singleton',\n    FileRoutesByPath['/shared-singleton']['parentRoute'],\n    FileRoutesByPath['/shared-singleton']['id'],\n    FileRoutesByPath['/shared-singleton']['path'],\n    FileRoutesByPath['/shared-singleton']['fullPath']\n  >\n}\ndeclare module './routes/viewport-test' {\n  const createFileRoute: CreateFileRoute<\n    '/viewport-test',\n    FileRoutesByPath['/viewport-test']['parentRoute'],\n    FileRoutesByPath['/viewport-test']['id'],\n    FileRoutesByPath['/viewport-test']['path'],\n    FileRoutesByPath['/viewport-test']['fullPath']\n  >\n}\ndeclare module './routes/without-loader' {\n  const createFileRoute: CreateFileRoute<\n    '/without-loader',\n    FileRoutesByPath['/without-loader']['parentRoute'],\n    FileRoutesByPath['/without-loader']['id'],\n    FileRoutesByPath['/without-loader']['path'],\n    FileRoutesByPath['/without-loader']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2',\n    FileRoutesByPath['/_layout/_layout-2']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2']['id'],\n    FileRoutesByPath['/_layout/_layout-2']['path'],\n    FileRoutesByPath['/_layout/_layout-2']['fullPath']\n  >\n}\ndeclare module './routes/posts.$postId' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/posts.index' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2/layout-a' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2/layout-a',\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['id'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['path'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2/layout-b' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2/layout-b',\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['id'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['path'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['fullPath']\n  >\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n  SharedSingletonRoute: SharedSingletonRoute,\n  ViewportTestRoute: ViewportTestRoute,\n  WithoutLoaderRoute: WithoutLoaderRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/without-loader\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          without-loader\n        </Link>{' '}\n        <Link\n          to=\"/shared-singleton\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          data-testid=\"shared-singleton-link\"\n        >\n          shared-singleton\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <div style={{ height: '200vh' }} />\n      <Link\n        preload=\"viewport\"\n        to=\"/viewport-test\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        viewport-test\n      </Link>\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx",
    "content": "import { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx",
    "content": "import * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n  codeSplitGroupings: [\n    ['component'],\n    ['pendingComponent', 'errorComponent', 'notFoundComponent'],\n  ],\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/shared-singleton.tsx",
    "content": "import * as React from 'react'\n\n// All shared state lives in declarations — no bare expression statements.\n// The singleton tracks how many times this module scope executes.\nconst singleton = (() => {\n  const g = globalThis as any\n  g.__tsrSharedSingleton ??= { initCount: 0 }\n  g.__tsrSharedSingleton.initCount++\n  return { initCountAtCreate: g.__tsrSharedSingleton.initCount as number }\n})()\n\nfunction getInitCount() {\n  return (globalThis as any).__tsrSharedSingleton?.initCount as number\n}\n\nexport const Route = createFileRoute({\n  loader: () => {\n    return {\n      loaderSawInitCount: getInitCount(),\n      initCountAtCreateFromLoader: singleton.initCountAtCreate,\n    }\n  },\n  component: SharedSingletonComponent,\n})\n\nfunction SharedSingletonComponent() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <h3 className=\"text-lg font-bold\">Shared Singleton</h3>\n      <div>\n        initCount (global):{' '}\n        <span data-testid=\"shared-init-count\">{getInitCount()}</span>\n      </div>\n      <div>\n        loaderSawInitCount:{' '}\n        <span data-testid=\"shared-loader-saw\">{data.loaderSawInitCount}</span>\n      </div>\n      <div>\n        initCountAtCreate (loader module):{' '}\n        <span data-testid=\"shared-created-at-loader\">\n          {data.initCountAtCreateFromLoader}\n        </span>\n      </div>\n      <div>\n        initCountAtCreate (component module):{' '}\n        <span data-testid=\"shared-created-at-module\">\n          {singleton.initCountAtCreate}\n        </span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /viewport-test!</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /without-loader!</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/tests/preload.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('hovering a link with preload=intent to a route without a loader should preload route', async ({\n  page,\n}) => {\n  await page.waitForLoadState('networkidle')\n\n  const requestPromise = new Promise<string>((resolve) => {\n    page.on('request', (request) => {\n      resolve(request.url())\n    })\n  })\n\n  await page.getByRole('link', { name: 'without-loader' }).hover()\n  const url = await requestPromise\n  const expectedString =\n    process.env.NODE_ENV === 'development'\n      ? 'without-loader.tsx?tsr-split'\n      : '/assets/without-loader'\n  expect(url).toContain(expectedString)\n})\n\ntest('scrolling into viewport a link with preload=viewport to a route should preload route', async ({\n  page,\n}) => {\n  await page.waitForLoadState('networkidle')\n\n  const [request] = await Promise.all([\n    page.waitForRequest(() => true),\n    page.getByRole('link', { name: 'viewport-test' }).scrollIntoViewIfNeeded(),\n  ])\n\n  const expectedString =\n    process.env.NODE_ENV === 'development'\n      ? 'viewport-test.tsx?tsr-split'\n      : '/assets/viewport-test'\n  expect(request.url()).toEqual(expect.stringContaining(expectedString))\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/tests/shared-bindings.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('shared module bindings should init once', async ({ page }) => {\n  await page.getByTestId('shared-singleton-link').click()\n\n  // If module scope is duplicated between reference + split chunk, this becomes \"2\".\n  await expect(page.getByTestId('shared-init-count')).toHaveText('1')\n\n  // Extra signals (useful when debugging failures)\n  await expect(page.getByTestId('shared-loader-saw')).toHaveText('1')\n  await expect(page.getByTestId('shared-created-at-loader')).toHaveText('1')\n  await expect(page.getByTestId('shared-created-at-module')).toHaveText('1')\n})\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic-file-based-code-splitting/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst isVerboseFileRoutes = process.env.VERBOSE_FILE_ROUTES === '1' || false\nconsole.info(`Verbose file routes is set to: ${isVerboseFileRoutes}.`)\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n      verboseFileRoutes: isVerboseFileRoutes,\n      codeSplittingOptions: {\n        splitBehavior: ({ routeId }) => {\n          if (\n            // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n            routeId === undefined ||\n            routeId.startsWith('$$TSR_') ||\n            // @ts-expect-error\n            routeId === ''\n          ) {\n            console.error(\n              'The routeId is empty or undefined. This should not happen.',\n            )\n            process.exit(1)\n          }\n          if (routeId === '/posts') {\n            return [\n              ['loader'],\n              ['component'],\n              ['pendingComponent', 'notFoundComponent', 'errorComponent'],\n            ]\n          }\n        },\n      },\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-react-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/router-devtools\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  useRouter,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/router-devtools'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport {\n  QueryClient,\n  QueryClientProvider,\n  useQueryErrorResetBoundary,\n  useSuspenseQuery,\n} from '@tanstack/react-query'\nimport { NotFoundError, postQueryOptions, postsQueryOptions } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport './styles.css'\n\nconst rootRoute = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <ReactQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexRouteComponent,\n})\n\nfunction IndexRouteComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n  component: PostsIndexRouteComponent,\n})\n\nfunction PostsIndexRouteComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ context: { queryClient }, params: { postId } }) =>\n    queryClient.ensureQueryData(postQueryOptions(postId)),\n  component: PostRouteComponent,\n})\n\nfunction PostErrorComponent({ error, reset }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n  const queryErrorResetBoundary = useQueryErrorResetBoundary()\n\n  React.useEffect(() => {\n    queryErrorResetBoundary.reset()\n  }, [queryErrorResetBoundary])\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nfunction PostRouteComponent() {\n  const { postId } = postRoute.useParams()\n  const postQuery = useSuspenseQuery(postQueryOptions(postId))\n  const post = postQuery.data\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layout2Route = createRoute({\n  getParentRoute: () => layoutRoute,\n  id: '_layout-2',\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layoutARoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-a',\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n\nconst layoutBRoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-b',\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute, postsIndexRoute]),\n  layoutRoute.addChildren([\n    layout2Route.addChildren([layoutARoute, layoutBRoute]),\n  ]),\n  indexRoute,\n])\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  context: {\n    queryClient,\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(\n    <QueryClientProvider client={queryClient}>\n      <RouterProvider router={router} />\n    </QueryClientProvider>,\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/src/posts.lazy.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createLazyRoute } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { postsQueryOptions } from './posts'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useSuspenseQuery(postsQueryOptions)\n\n  const posts = postsQuery.data\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/src/posts.ts",
    "content": "import axios from 'redaxios'\nimport { queryOptions } from '@tanstack/react-query'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basic-react-query-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <QueryClientProvider client={queryClient}>\n      <RouterProvider router={router} />\n    </QueryClientProvider>,\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/postQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport { fetchPost } from './posts'\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/postsQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport { fetchPosts } from './posts'\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/layout-a'\n    | '/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <ReactQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent, useRouter } from '@tanstack/react-router'\nimport {\n  useQueryErrorResetBoundary,\n  useSuspenseQuery,\n} from '@tanstack/react-query'\nimport { PostNotFoundError } from '../posts'\nimport { postQueryOptions } from '../postQueryOptions'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ context: { queryClient }, params: { postId } }) => {\n    return queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof PostNotFoundError) {\n    return <div>{error.message}</div>\n  }\n  const queryErrorResetBoundary = useQueryErrorResetBoundary()\n\n  React.useEffect(() => {\n    queryErrorResetBoundary.reset()\n  }, [queryErrorResetBoundary])\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nfunction PostComponent() {\n  const postId = Route.useParams().postId\n  const { data: post } = useSuspenseQuery(postQueryOptions(postId))\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { postsQueryOptions } from '../postsQueryOptions'\n\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useSuspenseQuery(postsQueryOptions)\n  const posts = postsQuery.data\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { getDummyServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('GetPosts', async () => {\n  const port = await getDummyServerPort(packageJson.name)\n  const res = await fetch(`http://localhost:${port}/posts`)\n\n  expect(res.status).toBe(200)\n\n  const posts = await res.json()\n\n  expect(posts.length).toBeGreaterThan(0)\n\n  const postRes = await fetch(`http://localhost:${port}/posts/1`)\n  expect(postRes.status).toBe(200)\n  const post = await postRes.json()\n  expect(post).toEqual(posts[0])\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic-react-query-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basic-scroll-restoration\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-virtual\": \"^3.13.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/src/main.tsx",
    "content": "import React, { useLayoutEffect } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useElementScrollRestoration,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { useVirtualizer } from '@tanstack/react-virtual'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 sticky top-0 border-b bg-gray-100 dark:bg-gray-900\">\n        <Link to=\"/\" className=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" className=\"[&.active]:font-bold\">\n          About\n        </Link>\n        <Link to=\"/about\" resetScroll={false}>\n          About (No Reset)\n        </Link>\n        <Link to=\"/by-element\" className=\"[&.active]:font-bold\">\n          By-Element\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  useLayoutEffect(() => {\n    window.invokeOrders.push('index-useLayoutEffect')\n  }, [])\n\n  return (\n    <div className=\"p-2\">\n      <h3 id=\"greeting\" className=\"bg-red-600\">\n        Welcome Home!\n      </h3>\n      <div id=\"top-message\" />\n      <div className=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div\n            key={i}\n            className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n          >\n            Home Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  useLayoutEffect(() => {\n    window.invokeOrders.push('about-useLayoutEffect')\n  }, [])\n  return (\n    <div className=\"p-2\">\n      <h3 id=\"greeting\">Hello from About!</h3>\n      <div className=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div\n            key={i}\n            className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n          >\n            About Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst byElementRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/by-element',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: ByElementComponent,\n})\n\nfunction ByElementComponent() {\n  // We need a unique ID for manual scroll restoration on a specific element\n  // It should be as unique as possible for this element across your app\n  const scrollRestorationId = 'myVirtualizedContent'\n\n  // We use that ID to get the scroll entry for this element\n  const scrollEntry = useElementScrollRestoration({\n    id: scrollRestorationId,\n  })\n\n  // Let's use TanStack Virtual to virtualize some content!\n  const virtualizerParentRef = React.useRef<HTMLDivElement>(null)\n  const virtualizer = useVirtualizer({\n    count: 10000,\n    getScrollElement: () => virtualizerParentRef.current,\n    estimateSize: () => 100,\n    // We pass the scrollY from the scroll restoration entry to the virtualizer\n    // as the initial offset\n    initialOffset: scrollEntry?.scrollY,\n  })\n\n  return (\n    <div className=\"p-2 h-[calc(100vh-41px)] flex flex-col\">\n      <div>Hello from By-Element!</div>\n      <div className=\"h-full min-h-0 flex gap-4\">\n        <div\n          id=\"RegularList\"\n          className=\"border rounded-lg p-2 overflow-auto flex-1 space-y-2\"\n        >\n          <div className=\"h-[100px] p-2 rounded-lg bg-red-600 border\">\n            First Regular List Item\n            <div id=\"first-regular-list-item\" />\n          </div>\n          {Array.from({ length: 50 }).map((_, i) => (\n            <div\n              key={i}\n              className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n            >\n              Regular List Item {i + 1}\n            </div>\n          ))}\n        </div>\n        <div className=\"flex-1 overflow-auto flex flex-col gap-4\">\n          {Array.from({ length: 2 }).map((_, i) => (\n            <div key={i} className=\"flex-1 border rounded-lg p-2 overflow-auto\">\n              <div className=\"space-y-2\">\n                {Array.from({ length: 50 }).map((_, i) => (\n                  <div\n                    key={i}\n                    className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n                  >\n                    About Item {i + 1}\n                  </div>\n                ))}\n              </div>\n            </div>\n          ))}\n          <div className=\"flex-1 flex flex-col min-h-0\">\n            <div className=\"font-bold\">Virtualized</div>\n            <div\n              ref={virtualizerParentRef}\n              // We pass the scroll restoration ID to the element\n              // as a custom attribute that will get picked up by the\n              // scroll restoration watcher\n              data-scroll-restoration-id={scrollRestorationId}\n              className=\"flex-1 border rounded-lg overflow-auto relative\"\n            >\n              <div\n                style={{\n                  height: `${virtualizer.getTotalSize()}px`,\n                }}\n              >\n                {virtualizer.getVirtualItems().map((item) => (\n                  <div\n                    key={item.index}\n                    className=\"absolute p-2 pb-0 w-full\"\n                    style={{\n                      height: item.size,\n                      top: item.start,\n                    }}\n                  >\n                    <div className=\"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border h-full\">\n                      Virtualized Item {item.index + 1}\n                    </div>\n                  </div>\n                ))}\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  )\n}\n\nconst fooRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/foo',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: FooComponent,\n})\n\nfunction FooComponent() {\n  return (\n    <div data-testid=\"foo-route-component\" className=\"p-2\">\n      <h3 id=\"greeting\">Hello from Foo!</h3>\n      <Link to=\"/bar\" data-testid=\"go-to-bar-link\">\n        Go to Bar\n      </Link>\n      <div className=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div\n            key={i}\n            className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n          >\n            Foo Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst barRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/bar',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: BarComponent,\n})\n\nfunction BarComponent() {\n  return (\n    <div data-testid=\"bar-route-component\" className=\"p-2\">\n      <h3 id=\"greeting\">Hello from Bar!</h3>\n      <div className=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div\n            key={i}\n            className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n          >\n            Bar Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  aboutRoute,\n  byElementRoute,\n  fooRoute,\n  barRoute,\n])\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  getScrollRestorationKey: (location) => location.pathname,\n})\n\ndeclare global {\n  interface Window {\n    invokeOrders: Array<string>\n  }\n}\nwindow.invokeOrders = []\nrouter.subscribe('onBeforeRouteMount', (event) => {\n  window.invokeOrders.push(event.type)\n})\n\nrouter.subscribe('onResolved', (event) => {\n  window.invokeOrders.push(event.type)\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('restore scroll positions by page, home pages top message should not display on navigating back', async ({\n  page,\n}) => {\n  // Step 1: Navigate to the home page\n  await page.goto('/')\n  await page.waitForURL('/')\n\n  await expect(page.locator('#greeting')).toContainText('Welcome Home!')\n  await expect(page.locator('#top-message')).toBeInViewport()\n\n  // Step 2: Scroll to a position that hides the top\n  const targetScrollPosition = 1000\n  await page.evaluate(\n    (scrollPos: number) => window.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n\n  // Verify initial scroll position\n  const scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  await expect(page.locator('#top-message')).not.toBeInViewport()\n  await page.waitForTimeout(1000)\n\n  // Step 3: Navigate to the about page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  // Step 4: Go back to the home page and immediately check the message\n  await page.goBack()\n\n  // Wait for the home page to have rendered\n  await page.waitForSelector('#greeting')\n  await page.waitForTimeout(1000)\n  await expect(page.locator('#top-message')).not.toBeInViewport()\n\n  // Confirm the scroll position was restored correctly\n  const restoredScrollPosition = await page.evaluate(() => window.scrollY)\n  expect(restoredScrollPosition).toBe(targetScrollPosition)\n})\n\ntest('restore scroll positions by element, first regular list item should not display on navigating back', async ({\n  page,\n}) => {\n  // Step 1: Navigate to the by-element page\n  await page.goto('/by-element')\n  await page.waitForURL('/by-element')\n\n  // Step 2: Scroll to a position that hides the first list item in regular list\n  const targetScrollPosition = 1000\n  await page.waitForSelector('#RegularList')\n  await expect(page.locator('#first-regular-list-item')).toBeInViewport()\n\n  await page.evaluate(\n    (scrollPos: number) =>\n      document.querySelector('#RegularList')!.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n\n  // Verify initial scroll position\n  const scrollPosition = await page.evaluate(\n    () => document.querySelector('#RegularList')!.scrollTop,\n  )\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  await expect(page.locator('#first-regular-list-item')).not.toBeInViewport()\n\n  // Step 3: Navigate to the about page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  // Step 4: Go back to the by-element page and immediately check the message\n  await page.goBack()\n\n  // TODO: For some reason, this only works in headed mode.\n  // When someone can explain that to me, I'll fix this test.\n\n  // Confirm the scroll position was restored correctly\n  // const restoredScrollPosition = await page.evaluate(\n  //   () => document.querySelector('#RegularList')!.scrollTop,\n  // )\n  // expect(restoredScrollPosition).toBe(targetScrollPosition)\n})\n\ntest('scroll to top when not scrolled, regression test for #4782', async ({\n  page,\n}) => {\n  await page.goto('/foo')\n  await page.waitForURL('/foo')\n\n  await expect(page.getByTestId('foo-route-component')).toBeVisible()\n\n  let scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(0)\n\n  // do not scroll, just navigate to /bar\n  await page.getByTestId('go-to-bar-link').click()\n  await expect(page.getByTestId('bar-route-component')).toBeVisible()\n\n  const targetScrollPosition = 1000\n  await page.evaluate(\n    (scrollPos: number) => window.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n  scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  // navigate back to /foo\n  await page.goBack()\n  await expect(page.getByTestId('foo-route-component')).toBeVisible()\n\n  // check if scroll position is restored to 0 since we did not scroll on /foo\n  const restoredScrollPosition = await page.evaluate(() => window.scrollY)\n  expect(restoredScrollPosition).toBe(0)\n})\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/tests/router-events.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('after a navigation, should have emitted \"onBeforeRouteMount\",\"onResolved\" and useLayoutEffect setup in the correct order', async ({\n  page,\n}) => {\n  // Navigate to the Home page\n  await page.goto('/')\n  await expect(page.locator('#greeting')).toContainText('Welcome Home!')\n\n  let orders = await page.evaluate(() => window.invokeOrders)\n\n  expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved')\n  expectItemOrder(orders, 'onBeforeRouteMount', 'index-useLayoutEffect')\n\n  // Clear the invokeOrders array\n  orders = await page.evaluate(() => {\n    window.invokeOrders = []\n    return window.invokeOrders\n  })\n\n  // Navigate to the About page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  orders = await page.evaluate(() => window.invokeOrders)\n\n  expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved')\n  expectItemOrder(orders, 'onBeforeRouteMount', 'about-useLayoutEffect')\n})\n\nfunction expectItemOrder<TItem>(\n  array: Array<TItem>,\n  firstItem: TItem,\n  secondItem: TItem,\n) {\n  const firstIndex = array.findIndex((item) => item === firstItem)\n  const secondIndex = array.findIndex((item) => item === secondItem)\n\n  if (firstIndex === -1 || secondIndex === -1) {\n    throw new Error('One or both items were not found in the array ' + array)\n  }\n\n  expect(firstIndex).toBeLessThan(secondIndex)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic-scroll-restoration/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basic-virtual-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as postsPostsRouteImport } from './routes/posts/posts'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home'\nimport { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route'\nimport { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index'\nimport { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world'\nimport { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst postsPostsRoute = postsPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsDetailRoute = postsPostsDetailRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst postsPostsHomeRoute = postsPostsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({\n  id: '/classic/hello',\n  path: '/classic/hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({\n  id: '/world',\n  path: '/world',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({\n  id: '/universe',\n  path: '/universe',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/layout-a': typeof aRoute\n  '/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/layout-a': typeof aRoute\n  '/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello': typeof ClassicHelloIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/_first/_second': typeof layoutSecondLayoutRouteWithChildren\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/_first/_second/layout-a': typeof aRoute\n  '/_first/_second/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/_first/_second'\n    | '/posts/$postId'\n    | '/_first/_second/layout-a'\n    | '/_first/_second/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n  postsPostsRoute: typeof postsPostsRouteWithChildren\n  ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsPostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsPostsDetailRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/_first/_second': {\n      id: '/_first/_second'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsPostsHomeRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/classic/hello': {\n      id: '/classic/hello'\n      path: '/classic/hello'\n      fullPath: '/classic/hello'\n      preLoaderRoute: typeof ClassicHelloRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/classic/hello/': {\n      id: '/classic/hello/'\n      path: '/'\n      fullPath: '/classic/hello/'\n      preLoaderRoute: typeof ClassicHelloIndexRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/world': {\n      id: '/classic/hello/world'\n      path: '/world'\n      fullPath: '/classic/hello/world'\n      preLoaderRoute: typeof ClassicHelloWorldRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/universe': {\n      id: '/classic/hello/universe'\n      path: '/universe'\n      fullPath: '/classic/hello/universe'\n      preLoaderRoute: typeof ClassicHelloUniverseRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/_first/_second/layout-b': {\n      id: '/_first/_second/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second/layout-a': {\n      id: '/_first/_second/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ndeclare module './routes/home' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/layout/first-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first',\n    FileRoutesByPath['/_first']['parentRoute'],\n    FileRoutesByPath['/_first']['id'],\n    FileRoutesByPath['/_first']['path'],\n    FileRoutesByPath['/_first']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/route' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello',\n    FileRoutesByPath['/classic/hello']['parentRoute'],\n    FileRoutesByPath['/classic/hello']['id'],\n    FileRoutesByPath['/classic/hello']['path'],\n    FileRoutesByPath['/classic/hello']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/layout/second-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second',\n    FileRoutesByPath['/_first/_second']['parentRoute'],\n    FileRoutesByPath['/_first/_second']['id'],\n    FileRoutesByPath['/_first/_second']['path'],\n    FileRoutesByPath['/_first/_second']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-detail' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/a' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second/layout-a',\n    FileRoutesByPath['/_first/_second/layout-a']['parentRoute'],\n    FileRoutesByPath['/_first/_second/layout-a']['id'],\n    FileRoutesByPath['/_first/_second/layout-a']['path'],\n    FileRoutesByPath['/_first/_second/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/b' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second/layout-b',\n    FileRoutesByPath['/_first/_second/layout-b']['parentRoute'],\n    FileRoutesByPath['/_first/_second/layout-b']['id'],\n    FileRoutesByPath['/_first/_second/layout-b']['path'],\n    FileRoutesByPath['/_first/_second/layout-b']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/universe' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/universe',\n    FileRoutesByPath['/classic/hello/universe']['parentRoute'],\n    FileRoutesByPath['/classic/hello/universe']['id'],\n    FileRoutesByPath['/classic/hello/universe']['path'],\n    FileRoutesByPath['/classic/hello/universe']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/world' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/world',\n    FileRoutesByPath['/classic/hello/world']['parentRoute'],\n    FileRoutesByPath['/classic/hello/world']['id'],\n    FileRoutesByPath['/classic/hello/world']['path'],\n    FileRoutesByPath['/classic/hello/world']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/index' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/',\n    FileRoutesByPath['/classic/hello/']['parentRoute'],\n    FileRoutesByPath['/classic/hello/']['id'],\n    FileRoutesByPath['/classic/hello/']['path'],\n    FileRoutesByPath['/classic/hello/']['fullPath']\n  >\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\ninterface postsPostsRouteChildren {\n  postsPostsHomeRoute: typeof postsPostsHomeRoute\n  postsPostsDetailRoute: typeof postsPostsDetailRoute\n}\n\nconst postsPostsRouteChildren: postsPostsRouteChildren = {\n  postsPostsHomeRoute: postsPostsHomeRoute,\n  postsPostsDetailRoute: postsPostsDetailRoute,\n}\n\nconst postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(\n  postsPostsRouteChildren,\n)\n\ninterface ClassicHelloRouteRouteChildren {\n  ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute\n  ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute\n  ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute\n}\n\nconst ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {\n  ClassicHelloUniverseRoute: ClassicHelloUniverseRoute,\n  ClassicHelloWorldRoute: ClassicHelloWorldRoute,\n  ClassicHelloIndexRoute: ClassicHelloIndexRoute,\n}\n\nconst ClassicHelloRouteRouteWithChildren =\n  ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n  postsPostsRoute: postsPostsRouteWithChildren,\n  ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/home.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/posts/posts.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/routes/root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { routes } from './routes'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n      virtualRouteConfig: routes,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\nsrc/routeTree.gen.ts"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-basic-virtual-named-export-config-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/basic-virtual-named-export-config-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n      virtualRouteConfig: './routes.ts',\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/.gitignore",
    "content": "node_modules\ndist\nport*.txt\ntest-results\nplaywright-report\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Escaped Special Strings E2E Test</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-escaped-special-strings\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"pnpm run test:e2e:default\",\n    \"test:e2e:default\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\nconst command = `pnpm build && pnpm preview --port ${PORT}`\n\nconsole.info('Running with mode: ', process.env.MODE || 'default')\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      MODE: process.env.MODE || '',\n      VITE_MODE: process.env.MODE || '',\n      VITE_NODE_ENV: 'test',\n      VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),\n      VITE_SERVER_PORT: String(PORT),\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as Char91indexChar93RouteImport } from './routes/[index]'\nimport { Route as Char91routeChar93RouteImport } from './routes/[route]'\nimport { Route as Char91lazyChar93RouteImport } from './routes/[lazy]'\nimport { Route as BlogRouteImport } from './routes/blog[_]'\nimport { Route as LayoutRouteImport } from './routes/[_]layout'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst Char91indexChar93Route = Char91indexChar93RouteImport.update({\n  id: '/index',\n  path: '/index',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Char91routeChar93Route = Char91routeChar93RouteImport.update({\n  id: '/route',\n  path: '/route',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Char91lazyChar93Route = Char91lazyChar93RouteImport.update({\n  id: '/lazy',\n  path: '/lazy',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogRoute = BlogRouteImport.update({\n  id: '/blog_',\n  path: '/blog_',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  path: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRoute\n  '/blog_': typeof BlogRoute\n  '/index': typeof Char91indexChar93Route\n  '/lazy': typeof Char91lazyChar93Route\n  '/route': typeof Char91routeChar93Route\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRoute\n  '/blog_': typeof BlogRoute\n  '/index': typeof Char91indexChar93Route\n  '/lazy': typeof Char91lazyChar93Route\n  '/route': typeof Char91routeChar93Route\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRoute\n  '/blog_': typeof BlogRoute\n  '/index': typeof Char91indexChar93Route\n  '/lazy': typeof Char91lazyChar93Route\n  '/route': typeof Char91routeChar93Route\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/_layout' | '/blog_' | '/index' | '/lazy' | '/route'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/_layout' | '/blog_' | '/index' | '/lazy' | '/route'\n  id: '__root__' | '/' | '/_layout' | '/blog_' | '/index' | '/lazy' | '/route'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRoute\n  BlogRoute: typeof BlogRoute\n  Char91indexChar93Route: typeof Char91indexChar93Route\n  Char91lazyChar93Route: typeof Char91lazyChar93Route\n  Char91routeChar93Route: typeof Char91routeChar93Route\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/index': {\n      id: '/index'\n      path: '/index'\n      fullPath: '/index'\n      preLoaderRoute: typeof Char91indexChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/route': {\n      id: '/route'\n      path: '/route'\n      fullPath: '/route'\n      preLoaderRoute: typeof Char91routeChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/lazy': {\n      id: '/lazy'\n      path: '/lazy'\n      fullPath: '/lazy'\n      preLoaderRoute: typeof Char91lazyChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog_': {\n      id: '/blog_'\n      path: '/blog_'\n      fullPath: '/blog_'\n      preLoaderRoute: typeof BlogRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: '/_layout'\n      fullPath: '/_layout'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRoute,\n  BlogRoute: BlogRoute,\n  Char91indexChar93Route: Char91indexChar93Route,\n  Char91lazyChar93Route: Char91lazyChar93Route,\n  Char91routeChar93Route: Char91routeChar93Route,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/routes/[_]layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// This file uses [_]layout escaping to create a literal /_layout path\n// instead of being treated as a pathless layout route\nexport const Route = createFileRoute('/_layout')({\n  component: EscapedUnderscoreLayoutComponent,\n})\n\nfunction EscapedUnderscoreLayoutComponent() {\n  return (\n    <div>\n      <h2 data-testid=\"page-title\">Escaped Underscore Layout Page</h2>\n      <p data-testid=\"page-path\">/_layout</p>\n      <p data-testid=\"page-description\">\n        This route was created using [_]layout.tsx to escape the leading\n        underscore. It renders at the literal path /_layout instead of being a\n        pathless layout.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/routes/[index].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// This file uses [index] escaping to create a literal /index route\n// instead of being treated as an index route for the parent\nexport const Route = createFileRoute('/index')({\n  component: EscapedIndexComponent,\n})\n\nfunction EscapedIndexComponent() {\n  return (\n    <div>\n      <h2 data-testid=\"page-title\">Escaped Index Page</h2>\n      <p data-testid=\"page-path\">/index</p>\n      <p data-testid=\"page-description\">\n        This route was created using [index].tsx to escape the special \"index\"\n        token. It renders at the literal path /index instead of being the index\n        route.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/routes/[lazy].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// This file uses [lazy] escaping to create a literal /lazy path\n// instead of being treated as a lazy-loaded route\nexport const Route = createFileRoute('/lazy')({\n  component: EscapedLazyComponent,\n})\n\nfunction EscapedLazyComponent() {\n  return (\n    <div>\n      <h2 data-testid=\"page-title\">Escaped Lazy Page</h2>\n      <p data-testid=\"page-path\">/lazy</p>\n      <p data-testid=\"page-description\">\n        This route was created using [lazy].tsx to escape the special \"lazy\"\n        token. It renders at the literal path /lazy instead of being a\n        lazy-loaded route.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/routes/[route].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// This file uses [route] escaping to create a literal /route path\n// instead of being treated as a layout configuration file\nexport const Route = createFileRoute('/route')({\n  component: EscapedRouteComponent,\n})\n\nfunction EscapedRouteComponent() {\n  return (\n    <div>\n      <h2 data-testid=\"page-title\">Escaped Route Page</h2>\n      <p data-testid=\"page-path\">/route</p>\n      <p data-testid=\"page-description\">\n        This route was created using [route].tsx to escape the special \"route\"\n        token. It renders at the literal path /route instead of being a layout\n        configuration.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p data-testid=\"not-found\">Page not found</p>\n        <Link to=\"/index\">Go to /index</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <div>\n      <h1>Escaped Special Strings Test</h1>\n      <nav\n        style={{\n          display: 'flex',\n          gap: '1rem',\n          padding: '1rem',\n          borderBottom: '1px solid #ccc',\n        }}\n      >\n        <Link to=\"/\" data-testid=\"link-home\">\n          / (home)\n        </Link>\n        <Link to=\"/index\" data-testid=\"link-index\">\n          /index\n        </Link>\n        <Link to=\"/route\" data-testid=\"link-route\">\n          /route\n        </Link>\n        <Link to=\"/lazy\" data-testid=\"link-lazy\">\n          /lazy\n        </Link>\n        <Link to=\"/_layout\" data-testid=\"link-underscore-layout\">\n          /_layout\n        </Link>\n        <Link to=\"/blog_\" data-testid=\"link-blog-underscore\">\n          /blog_\n        </Link>\n      </nav>\n      <main style={{ padding: '1rem' }}>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/routes/blog[_].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// This file uses blog[_] escaping to create a literal /blog_ path\n// with the trailing underscore preserved in the URL\nexport const Route = createFileRoute('/blog_')({\n  component: EscapedBlogUnderscoreComponent,\n})\n\nfunction EscapedBlogUnderscoreComponent() {\n  return (\n    <div>\n      <h2 data-testid=\"page-title\">Escaped Blog Underscore Page</h2>\n      <p data-testid=\"page-path\">/blog_</p>\n      <p data-testid=\"page-description\">\n        This route was created using blog[_].tsx to escape the trailing\n        underscore. It renders at the literal path /blog_ with the underscore\n        preserved in the URL.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// This is the standard index route for the root path /\n// It coexists with [index].tsx which creates a literal /index route\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div>\n      <h2 data-testid=\"page-title\">Home Page</h2>\n      <p data-testid=\"page-path\">/</p>\n      <p data-testid=\"page-description\">\n        This is the home/index route at /. It coexists with the escaped [index]\n        route at /index.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/tests/escaped-routes.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('Escaped special strings routing', () => {\n  test('home index route renders at / path', async ({ page }) => {\n    await page.goto('/')\n\n    await expect(page.getByTestId('page-title')).toContainText('Home Page')\n    await expect(page.getByTestId('page-path')).toContainText('/')\n    await expect(page.getByTestId('page-description')).toContainText(\n      'home/index route at /',\n    )\n  })\n\n  test('escaped [index] route renders at /index path', async ({ page }) => {\n    await page.goto('/index')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Index Page',\n    )\n    await expect(page.getByTestId('page-path')).toContainText('/index')\n    await expect(page.getByTestId('page-description')).toContainText(\n      'escape the special \"index\" token',\n    )\n  })\n\n  test('escaped [route] route renders at /route path', async ({ page }) => {\n    await page.goto('/route')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Route Page',\n    )\n    await expect(page.getByTestId('page-path')).toContainText('/route')\n    await expect(page.getByTestId('page-description')).toContainText(\n      'escape the special \"route\" token',\n    )\n  })\n\n  test('escaped [lazy] route renders at /lazy path', async ({ page }) => {\n    await page.goto('/lazy')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Lazy Page',\n    )\n    await expect(page.getByTestId('page-path')).toContainText('/lazy')\n    await expect(page.getByTestId('page-description')).toContainText(\n      'escape the special \"lazy\" token',\n    )\n  })\n\n  test('escaped [_]layout route renders at /_layout path', async ({ page }) => {\n    await page.goto('/_layout')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Underscore Layout Page',\n    )\n    await expect(page.getByTestId('page-path')).toContainText('/_layout')\n    await expect(page.getByTestId('page-description')).toContainText(\n      'escape the leading underscore',\n    )\n  })\n\n  test('escaped blog[_] route renders at /blog_ path', async ({ page }) => {\n    await page.goto('/blog_')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Blog Underscore Page',\n    )\n    await expect(page.getByTestId('page-path')).toContainText('/blog_')\n    await expect(page.getByTestId('page-description')).toContainText(\n      'escape the trailing underscore',\n    )\n  })\n\n  test('client-side navigation to home / route', async ({ page }) => {\n    await page.goto('/index')\n    await page.getByTestId('link-home').click()\n    await page.waitForURL('/')\n\n    await expect(page.getByTestId('page-title')).toContainText('Home Page')\n  })\n\n  test('client-side navigation to escaped /index route', async ({ page }) => {\n    await page.goto('/route')\n    await page.getByTestId('link-index').click()\n    await page.waitForURL('/index')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Index Page',\n    )\n  })\n\n  test('client-side navigation to escaped /route route', async ({ page }) => {\n    await page.goto('/index')\n    await page.getByTestId('link-route').click()\n    await page.waitForURL('/route')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Route Page',\n    )\n  })\n\n  test('client-side navigation to escaped /lazy route', async ({ page }) => {\n    await page.goto('/index')\n    await page.getByTestId('link-lazy').click()\n    await page.waitForURL('/lazy')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Lazy Page',\n    )\n  })\n\n  test('client-side navigation to escaped /_layout route', async ({ page }) => {\n    await page.goto('/index')\n    await page.getByTestId('link-underscore-layout').click()\n    await page.waitForURL('/_layout')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Underscore Layout Page',\n    )\n  })\n\n  test('client-side navigation to escaped /blog_ route', async ({ page }) => {\n    await page.goto('/index')\n    await page.getByTestId('link-blog-underscore').click()\n    await page.waitForURL('/blog_')\n\n    await expect(page.getByTestId('page-title')).toContainText(\n      'Escaped Blog Underscore Page',\n    )\n  })\n\n  test('URL is correct for escaped routes with underscores', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto('/_layout')\n    expect(page.url()).toBe(`${baseURL}/_layout`)\n\n    await page.goto('/blog_')\n    expect(page.url()).toBe(`${baseURL}/blog_`)\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/escaped-special-strings/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/react-router/generator-cli-only/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-generator-cli-only\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"tsr generate && vite --port 3000\",\n    \"dev:e2e\": \"tsr generate && vite\",\n    \"build\": \"tsr generate && vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"tsr generate && vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-cli\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <RouterProvider router={router} />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/_pathlessLayout'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/routes/posts.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested pathless layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a pathless layout\")\n  await expect(page.locator('#app')).toContainText(\n    \"I'm a nested pathless layout\",\n  )\n\n  await page.getByRole('link', { name: 'Go to route A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Go to route B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\"\n}\n"
  },
  {
    "path": "e2e/react-router/generator-cli-only/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/.gitignore",
    "content": "node_modules\ndist\nsrc/routeTree.gen.ts\nsrc/paraglide\n*.local\nport*.txt\ntest-results\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/index.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <link rel=\"icon\" href=\"/favicon.ico\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <meta\n      name=\"description\"\n      content=\"TanStack Router i18n-paraglide e2e test\"\n    />\n    <title>TanStack Router i18n-paraglide e2e</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/messages/de.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Guten Tag {username}\",\n  \"hello_about\": \"Hallo /ueber!\",\n  \"home_page\": \"Startseite\",\n  \"about_page\": \"Über uns\"\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/messages/en.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Hello world {username}\",\n  \"hello_about\": \"Hello /about!\",\n  \"home_page\": \"Home page\",\n  \"about_page\": \"About page\"\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-i18n-paraglide\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@inlang/paraglide-js\": \"^2.4.0\",\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/project.inlang/.gitignore",
    "content": "cache\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/project.inlang/project_id",
    "content": "apLjNFHNH2yAHYTN5d"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/project.inlang/settings.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/project-settings\",\n  \"baseLocale\": \"en\",\n  \"locales\": [\"en\", \"de\"],\n  \"modules\": [\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js\",\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js\"\n  ],\n  \"plugin.inlang.messageFormat\": {\n    \"pathPattern\": \"./messages/{locale}.json\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/src/main.tsx",
    "content": "import { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport './styles.css'\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport { deLocalizeUrl, localizeUrl } from './paraglide/runtime.js'\n\n// Create a new router instance\nconst router = createRouter({\n  routeTree,\n  context: {},\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  defaultStructuralSharing: true,\n  defaultPreloadStaleTime: 0,\n\n  rewrite: {\n    input: ({ url }) => deLocalizeUrl(url),\n    output: ({ url }) => localizeUrl(url),\n  },\n})\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\n// Render the app\nconst rootElement = document.getElementById('app')\nif (rootElement && !rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute, redirect } from '@tanstack/react-router'\nimport {\n  getLocale,\n  locales,\n  setLocale,\n  shouldRedirect,\n} from '@/paraglide/runtime'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    document.documentElement.setAttribute('lang', getLocale())\n\n    const decision = await shouldRedirect({ url: window.location.href })\n\n    if (decision.redirectUrl) {\n      throw redirect({ href: decision.redirectUrl.href })\n    }\n  },\n  component: () => (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg justify-between\">\n        <div className=\"flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n            data-testid=\"home-link\"\n          >\n            {m.home_page()}\n          </Link>\n\n          <Link\n            to=\"/about\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            data-testid=\"about-link\"\n          >\n            {m.about_page()}\n          </Link>\n        </div>\n\n        <div className=\"flex gap-2 text-lg\">\n          {locales.map((locale) => (\n            <button\n              key={locale}\n              onClick={() => setLocale(locale)}\n              data-active-locale={locale === getLocale()}\n              data-testid={`locale-${locale}`}\n              className=\"rounded p-1 px-2 border border-gray-300 cursor-pointer [&[data-active-locale=true]]:bg-gray-500 [&[data-active-locale=true]]:text-white\"\n            >\n              {locale}\n            </button>\n          ))}\n        </div>\n      </div>\n\n      <hr />\n\n      <div className=\"p-2\">\n        <Outlet />\n      </div>\n    </>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/src/routes/about.tsx",
    "content": "import { m } from '@/paraglide/messages'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div data-testid=\"about-content\">{m.hello_about()}</div>\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n\nfunction App() {\n  return (\n    <div data-testid=\"home-content\">\n      <p>\n        {m.example_message({\n          username: 'TanStack Router!',\n        })}\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/tests/navigation.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\n// These tests verify that client-side i18n rewrites work correctly in a pure SPA\n// (no server-side rendering). The router uses the rewrite API to:\n// - input: de-localize URLs for route matching (e.g., /de/ueber -> /about)\n// - output: localize URLs for display (e.g., /about -> /de/ueber)\n\ntest.describe('Client-side i18n navigation', () => {\n  test('should load the home page without redirect loops', async ({ page }) => {\n    // Navigate to root - should work without any redirect loop issues\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Verify the page loaded successfully\n    await expect(page.getByTestId('home-content')).toBeVisible()\n    await expect(page.getByTestId('home-content')).toContainText('Hello world')\n  })\n\n  test('should load the German home page (/de)', async ({ page }) => {\n    await page.goto('/de')\n    await page.waitForLoadState('networkidle')\n\n    // Verify we're on the German page\n    await expect(page.getByTestId('home-content')).toBeVisible()\n    await expect(page.getByTestId('home-content')).toContainText('Guten Tag')\n\n    // URL should remain /de\n    expect(page.url()).toContain('/de')\n  })\n\n  test('should navigate to about page and update URL correctly', async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Click on about link\n    await page.getByTestId('about-link').click()\n    await page.waitForLoadState('networkidle')\n\n    // Verify we're on the about page\n    await expect(page.getByTestId('about-content')).toBeVisible()\n    await expect(page.getByTestId('about-content')).toContainText(\n      'Hello /about!',\n    )\n\n    // URL should be /about (English)\n    expect(page.url()).toContain('/about')\n  })\n\n  test('should navigate to German about page with translated URL', async ({\n    page,\n  }) => {\n    await page.goto('/de')\n    await page.waitForLoadState('networkidle')\n\n    // Click on about link (should navigate to /de/ueber)\n    await page.getByTestId('about-link').click()\n    await page.waitForLoadState('networkidle')\n\n    // Verify we're on the about page with German content\n    await expect(page.getByTestId('about-content')).toBeVisible()\n    await expect(page.getByTestId('about-content')).toContainText(\n      'Hallo /ueber!',\n    )\n\n    // URL should be /de/ueber (German translated path)\n    expect(page.url()).toContain('/de/ueber')\n  })\n\n  test('should directly access German about page (/de/ueber)', async ({\n    page,\n  }) => {\n    // Direct navigation to translated URL\n    await page.goto('/de/ueber')\n    await page.waitForLoadState('networkidle')\n\n    // Verify the page loaded correctly\n    await expect(page.getByTestId('about-content')).toBeVisible()\n    await expect(page.getByTestId('about-content')).toContainText(\n      'Hallo /ueber!',\n    )\n\n    // URL should stay /de/ueber\n    expect(page.url()).toContain('/de/ueber')\n  })\n\n  test('should switch locale and update URLs accordingly', async ({ page }) => {\n    // Start at English home page\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Verify English content\n    await expect(page.getByTestId('home-content')).toContainText('Hello world')\n\n    // Switch to German\n    await page.getByTestId('locale-de').click()\n    await page.waitForLoadState('networkidle')\n\n    // Verify German content\n    await expect(page.getByTestId('home-content')).toContainText('Guten Tag')\n\n    // URL should now include /de\n    expect(page.url()).toContain('/de')\n  })\n\n  test('should switch locale on about page and update translated URL', async ({\n    page,\n  }) => {\n    // Start at English about page\n    await page.goto('/about')\n    await page.waitForLoadState('networkidle')\n\n    // Verify English content\n    await expect(page.getByTestId('about-content')).toContainText(\n      'Hello /about!',\n    )\n\n    // Switch to German\n    await page.getByTestId('locale-de').click()\n    await page.waitForLoadState('networkidle')\n\n    // Verify German content\n    await expect(page.getByTestId('about-content')).toContainText(\n      'Hallo /ueber!',\n    )\n\n    // URL should now be /de/ueber (translated path)\n    expect(page.url()).toContain('/de/ueber')\n  })\n\n  test('should maintain correct links after locale switch', async ({\n    page,\n  }) => {\n    // Start at German home page\n    await page.goto('/de')\n    await page.waitForLoadState('networkidle')\n\n    // Verify about link has German translated href\n    const aboutLink = page.getByTestId('about-link')\n    await expect(aboutLink).toHaveAttribute('href', '/de/ueber')\n\n    // Switch to English\n    await page.getByTestId('locale-en').click()\n    await page.waitForLoadState('networkidle')\n\n    // Verify about link now has English href\n    await expect(aboutLink).toHaveAttribute('href', '/about')\n  })\n})\n\ntest.describe('Client-side navigation without redirect loops', () => {\n  test('navigating back and forth should not cause issues', async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Navigate to about\n    await page.getByTestId('about-link').click()\n    await page.waitForLoadState('networkidle')\n    await expect(page.getByTestId('about-content')).toBeVisible()\n\n    // Navigate back to home\n    await page.getByTestId('home-link').click()\n    await page.waitForLoadState('networkidle')\n    await expect(page.getByTestId('home-content')).toBeVisible()\n\n    // Navigate to about again\n    await page.getByTestId('about-link').click()\n    await page.waitForLoadState('networkidle')\n    await expect(page.getByTestId('about-content')).toBeVisible()\n  })\n\n  test('switching locales multiple times should work correctly', async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Switch to German\n    await page.getByTestId('locale-de').click()\n    await page.waitForLoadState('networkidle')\n    await expect(page.getByTestId('home-content')).toContainText('Guten Tag')\n\n    // Switch back to English\n    await page.getByTestId('locale-en').click()\n    await page.waitForLoadState('networkidle')\n    await expect(page.getByTestId('home-content')).toContainText('Hello world')\n\n    // Switch to German again\n    await page.getByTestId('locale-de').click()\n    await page.waitForLoadState('networkidle')\n    await expect(page.getByTestId('home-content')).toContainText('Guten Tag')\n  })\n\n  test('browser back/forward should work with locale changes', async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Navigate to about\n    await page.getByTestId('about-link').click()\n    await page.waitForLoadState('networkidle')\n\n    // Switch to German\n    await page.getByTestId('locale-de').click()\n    await page.waitForLoadState('networkidle')\n    expect(page.url()).toContain('/de/ueber')\n\n    // Go back\n    await page.goBack()\n    await page.waitForLoadState('networkidle')\n\n    // Should be on about page (English or previous state)\n    await expect(page.getByTestId('about-content')).toBeVisible()\n  })\n})\n\ntest.describe('URL rewrite consistency', () => {\n  test('internal navigation should use rewritten URLs in links', async ({\n    page,\n  }) => {\n    await page.goto('/de')\n    await page.waitForLoadState('networkidle')\n\n    // Check that links are properly localized\n    const homeLink = page.getByTestId('home-link')\n    const aboutLink = page.getByTestId('about-link')\n\n    await expect(homeLink).toHaveAttribute('href', '/de')\n    await expect(aboutLink).toHaveAttribute('href', '/de/ueber')\n  })\n\n  test('English links should not have locale prefix', async ({ page }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    const homeLink = page.getByTestId('home-link')\n    const aboutLink = page.getByTestId('about-link')\n\n    await expect(homeLink).toHaveAttribute('href', '/')\n    await expect(aboutLink).toHaveAttribute('href', '/about')\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"noImplicitAny\": false,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"skipLibCheck\": true,\n    \"allowJs\": true,\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  },\n  \"include\": [\"src\", \"tests\"]\n}\n"
  },
  {
    "path": "e2e/react-router/i18n-paraglide/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { resolve } from 'node:path'\nimport { paraglideVitePlugin } from '@inlang/paraglide-js'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    paraglideVitePlugin({\n      project: './project.inlang',\n      outdir: './src/paraglide',\n      outputStructure: 'message-modules',\n      cookieName: 'PARAGLIDE_LOCALE',\n      strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'],\n      urlPatterns: [\n        {\n          pattern: '/',\n          localized: [\n            ['en', '/'],\n            ['de', '/de'],\n          ],\n        },\n        {\n          pattern: '/about',\n          localized: [\n            ['en', '/about'],\n            ['de', '/de/ueber'],\n          ],\n        },\n        {\n          pattern: '/:path(.*)?',\n          localized: [\n            ['en', '/:path(.*)?'],\n            ['de', '/de/:path(.*)?'],\n          ],\n        },\n      ],\n    }),\n    tanstackRouter({ autoCodeSplitting: true }),\n    viteReact(),\n  ],\n  resolve: {\n    alias: {\n      '@': resolve(__dirname, './src'),\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/react-router/js-only-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.jsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-js-only-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/main.jsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\nconst rootElement = document.getElementById('app')\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <RouterProvider router={router} />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/posts.js",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios.get(`${queryURL}/posts`).then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routeTree.gen.js",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n})\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n})\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n})\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n})\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n})\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  })\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  })\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  })\n\nconst PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst PathlessLayoutNestedLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,\n  PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,\n}\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\nconst PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/__root.jsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/_pathlessLayout.jsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/index.jsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/posts.$postId.jsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/posts.index.jsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/routes/posts.route.jsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested pathless layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a pathless layout\")\n  await expect(page.locator('#app')).toContainText(\n    \"I'm a nested pathless layout\",\n  )\n\n  await page.getByRole('link', { name: 'Go to route A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Go to route B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/js-only-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      disableTypes: true,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\ndist-hash/\n\n# IDE\n.vscode/*\n!.vscode/extensions.json\n.idea\n\n# E2E\nsrc/routeTree.gen.ts\ntest-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `pnpm install`\n- `pnpm dev`\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-rspack-basic-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"rsbuild dev --port 3000\",\n    \"build\": \"rsbuild build && tsc --noEmit\",\n    \"preview\": \"rsbuild preview\",\n    \"start\": \"rsbuild preview\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@rsbuild/core\": \"^1.2.4\",\n    \"@rsbuild/plugin-react\": \"^1.1.0\",\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"postcss\": \"^8.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `PUBLIC_NODE_ENV=\"test\" PUBLIC_EXTERNAL_PORT=${EXTERNAL_PORT} PUBLIC_SERVER_PORT=${PORT} pnpm build && PUBLIC_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/rsbuild.config.ts",
    "content": "import { defineConfig } from '@rsbuild/core'\nimport { pluginReact } from '@rsbuild/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\n\nexport default defineConfig({\n  plugins: [pluginReact()],\n  tools: {\n    rspack: {\n      plugins: [\n        tanstackRouter({\n          target: 'react',\n          autoCodeSplitting: true,\n        }),\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/app.tsx",
    "content": "import * as React from 'react'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/env.d.ts",
    "content": "/// <reference types=\"@rsbuild/core/types\" />\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/index.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './app'\n\nconst rootEl = document.getElementById('root')\n\nif (rootEl) {\n  const root = ReactDOM.createRoot(rootEl)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.PUBLIC_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.PUBLIC_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#root')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#root')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"react-jsx\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"useDefineForClassFields\": true,\n    \"allowJs\": true\n  },\n  \"include\": [\"src\", \"playwright.config.ts\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\ndist-hash/\n\n# IDE\n.vscode/*\n!.vscode/extensions.json\n.idea\n\n# E2E\nsrc/routeTree.gen.ts\ntest-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `pnpm install`\n- `pnpm dev`\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-rspack-basic-virtual-named-export-config-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"rsbuild dev --port 3000\",\n    \"build\": \"rsbuild build && tsc --noEmit\",\n    \"preview\": \"rsbuild preview\",\n    \"start\": \"rsbuild preview\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@rsbuild/core\": \"^1.2.4\",\n    \"@rsbuild/plugin-react\": \"^1.1.0\",\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"postcss\": \"^8.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `PUBLIC_NODE_ENV=\"test\" PUBLIC_EXTERNAL_PORT=${EXTERNAL_PORT} PUBLIC_SERVER_PORT=${PORT} pnpm build && PUBLIC_SERVER_PORT=${PORT} pnpm start --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts",
    "content": "import { defineConfig } from '@rsbuild/core'\nimport { pluginReact } from '@rsbuild/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\n\nexport default defineConfig({\n  plugins: [pluginReact()],\n  tools: {\n    rspack: {\n      plugins: [\n        tanstackRouter({\n          target: 'react',\n          autoCodeSplitting: true,\n          virtualRouteConfig: './routes.ts',\n        }),\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx",
    "content": "import * as React from 'react'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts",
    "content": "/// <reference types=\"@rsbuild/core/types\" />\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './app'\n\nconst rootEl = document.getElementById('root')\n\nif (rootEl) {\n  const root = ReactDOM.createRoot(rootEl)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.PUBLIC_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.PUBLIC_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_first/_second/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_first/_second/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/classic/hello/')({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/classic/hello')({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/classic/hello/universe')({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/classic/hello/world')({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_first')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_first/_second')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#root')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#root')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"react-jsx\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"useDefineForClassFields\": true,\n    \"allowJs\": true\n  },\n  \"include\": [\"src\", \"playwright.config.ts\", \"tests\", \"./routes.ts\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\ndist-hash\n*.local\ntest-results\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/README.md",
    "content": "# Scroll Restoration Testing Sandbox with Vite\n\nTo run this example:\n\n- `npm install`\n- `npm start`\n\nThis sandbox is for testing the scroll restoration behavior.\n\n## Setup\n\n- Create your files in `src/routes` directory.\n- Make sure you update the arrays in the following files with the expected routes\n  - `tests/app.spec.ts` > routes array\n  - `src/routes/__root.tsx` > Nav component, routes array\n  - `src/routes/index.tsx` > Navigation test suite, routes array\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-react-scroll-restoration-sandbox-vite\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:hash\": \"VITE_APP_HISTORY=hash vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e:browser\": \"VITE_APP_HISTORY=browser playwright test --config=playwright.browser.config.ts --project=chromium\",\n    \"test:e2e:hash\": \"VITE_APP_HISTORY=hash playwright test --config=playwright.hash.config.ts --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:browser && pnpm run test:e2e:hash\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  resolveRuntimeSuffix,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  packageJson.name + `-${resolveRuntimeSuffix('browser')}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\n\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=browser pnpm build && VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=browser pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n\n  quiet: false,\n})\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  resolveRuntimeSuffix,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  packageJson.name + `-${resolveRuntimeSuffix('hash')}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\n\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=hash vite build --outDir dist-hash && VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=hash pnpm preview --port ${PORT} --outDir dist-hash`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  RouterProvider,\n  createHashHistory,\n  createRouter,\n} from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport type { RouterHistory } from '@tanstack/react-router'\nimport './styles.css'\n\nlet history: RouterHistory | undefined\n\nif (import.meta.env.VITE_APP_HISTORY === 'hash') {\n  history = createHashHistory()\n}\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  history,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport function sleep(ms: number) {\n  return new Promise((r) => setTimeout(r, ms))\n}\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as testsPageWithSearchRouteImport } from './routes/(tests)/page-with-search'\nimport { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'\nimport { Route as testsLazyWithLoaderPageRouteImport } from './routes/(tests)/lazy-with-loader-page'\nimport { Route as testsLazyPageRouteImport } from './routes/(tests)/lazy-page'\n\nconst testsVirtualPageLazyRouteImport = createFileRoute(\n  '/(tests)/virtual-page',\n)()\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport\n  .update({\n    id: '/(tests)/virtual-page',\n    path: '/virtual-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(tests)/virtual-page.lazy').then((d) => d.Route))\nconst testsPageWithSearchRoute = testsPageWithSearchRouteImport.update({\n  id: '/(tests)/page-with-search',\n  path: '/page-with-search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsNormalPageRoute = testsNormalPageRouteImport.update({\n  id: '/(tests)/normal-page',\n  path: '/normal-page',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport\n  .update({\n    id: '/(tests)/lazy-with-loader-page',\n    path: '/lazy-with-loader-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() =>\n    import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route),\n  )\nconst testsLazyPageRoute = testsLazyPageRouteImport\n  .update({\n    id: '/(tests)/lazy-page',\n    path: '/lazy-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(tests)/lazy-page.lazy').then((d) => d.Route))\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/lazy-page': typeof testsLazyPageRoute\n  '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/page-with-search': typeof testsPageWithSearchRoute\n  '/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/lazy-page': typeof testsLazyPageRoute\n  '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/page-with-search': typeof testsPageWithSearchRoute\n  '/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/(tests)/lazy-page': typeof testsLazyPageRoute\n  '/(tests)/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/(tests)/normal-page': typeof testsNormalPageRoute\n  '/(tests)/page-with-search': typeof testsPageWithSearchRoute\n  '/(tests)/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/lazy-page'\n    | '/lazy-with-loader-page'\n    | '/normal-page'\n    | '/page-with-search'\n    | '/virtual-page'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/lazy-page'\n    | '/lazy-with-loader-page'\n    | '/normal-page'\n    | '/page-with-search'\n    | '/virtual-page'\n  id:\n    | '__root__'\n    | '/'\n    | '/(tests)/lazy-page'\n    | '/(tests)/lazy-with-loader-page'\n    | '/(tests)/normal-page'\n    | '/(tests)/page-with-search'\n    | '/(tests)/virtual-page'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  testsLazyPageRoute: typeof testsLazyPageRoute\n  testsLazyWithLoaderPageRoute: typeof testsLazyWithLoaderPageRoute\n  testsNormalPageRoute: typeof testsNormalPageRoute\n  testsPageWithSearchRoute: typeof testsPageWithSearchRoute\n  testsVirtualPageLazyRoute: typeof testsVirtualPageLazyRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/virtual-page': {\n      id: '/(tests)/virtual-page'\n      path: '/virtual-page'\n      fullPath: '/virtual-page'\n      preLoaderRoute: typeof testsVirtualPageLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/page-with-search': {\n      id: '/(tests)/page-with-search'\n      path: '/page-with-search'\n      fullPath: '/page-with-search'\n      preLoaderRoute: typeof testsPageWithSearchRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/normal-page': {\n      id: '/(tests)/normal-page'\n      path: '/normal-page'\n      fullPath: '/normal-page'\n      preLoaderRoute: typeof testsNormalPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/lazy-with-loader-page': {\n      id: '/(tests)/lazy-with-loader-page'\n      path: '/lazy-with-loader-page'\n      fullPath: '/lazy-with-loader-page'\n      preLoaderRoute: typeof testsLazyWithLoaderPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/lazy-page': {\n      id: '/(tests)/lazy-page'\n      path: '/lazy-page'\n      fullPath: '/lazy-page'\n      preLoaderRoute: typeof testsLazyPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  testsLazyPageRoute: testsLazyPageRoute,\n  testsLazyWithLoaderPageRoute: testsLazyWithLoaderPageRoute,\n  testsNormalPageRoute: testsNormalPageRoute,\n  testsPageWithSearchRoute: testsPageWithSearchRoute,\n  testsVirtualPageLazyRoute: testsVirtualPageLazyRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/lazy-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div className=\"p-2\">\n      <h3>lazy-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(tests)/lazy-page')({})\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/lazy-with-loader-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div className=\"p-2\">\n      <h3>lazy-with-loader-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { sleep } from '../../posts'\n\nexport const Route = createFileRoute('/(tests)/lazy-with-loader-page')({\n  loader: async () => {\n    await sleep(1000)\n    return { foo: 'bar' }\n  },\n})\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/normal-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div className=\"p-2\">\n      <h3>normal-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/page-with-search')({\n  validateSearch: zodValidator(z.object({ where: z.string() })),\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div className=\"p-2\">\n      <h3>page-with-search</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/virtual-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div className=\"p-2\">\n      <h3>virtual-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx",
    "content": "export const atTheTopId = 'at-the-top'\nexport const atTheBottomId = 'at-the-bottom'\n\nexport function ScrollBlock({ number = 100 }: { number?: number }) {\n  return (\n    <>\n      <div id={atTheTopId} data-testid={atTheTopId}></div>\n      {Array.from({ length: number }).map((_, i) => (\n        <div key={`scroll-block-${i}`}>{i}</div>\n      ))}\n      <div id={atTheBottomId} data-testid={atTheBottomId}>\n        At the bottom\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  Link,\n  Outlet,\n  createRootRoute,\n  linkOptions,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <Nav type=\"header\" />\n      <hr />\n      <Outlet />\n      <hr />\n      <Nav type=\"footer\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nfunction Nav({ type }: { type: 'header' | 'footer' }) {\n  const Elem = type === 'header' ? 'header' : 'footer'\n  const prefix = type === 'header' ? 'Head' : 'Foot'\n  return (\n    <Elem className=\"p-2 flex gap-2 text-lg\">\n      <Link\n        to=\"/\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n        activeOptions={{ exact: true }}\n      >\n        {prefix}-/\n      </Link>{' '}\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/lazy-page' }),\n          linkOptions({ to: '/virtual-page' }),\n          linkOptions({ to: '/lazy-with-loader-page' }),\n          linkOptions({ to: '/page-with-search', search: { where: type } }),\n        ] as const\n      ).map((options, i) => (\n        <Link\n          key={`${prefix}-${options.to}-${i}`}\n          {...options}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          {prefix}-{options.to}\n        </Link>\n      ))}\n    </Elem>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, linkOptions } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-2 grid gap-2\">\n      <h3>Welcome Home!</h3>\n      <p>\n        The are the links to be tested when navigating away from the index page.\n        Otherwise known as NOT first-load tests, rather known as navigation\n        tests.\n      </p>\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/lazy-page' }),\n          linkOptions({ to: '/virtual-page' }),\n          linkOptions({ to: '/lazy-with-loader-page' }),\n          linkOptions({ to: '/page-with-search', search: { where: 'footer' } }),\n        ] as const\n      ).map((options, i) => (\n        <div key={`index-page-tests-${options.to}-${i}`} className=\"border p-2\">\n          <h4>{options.to} tests</h4>\n          <p>\n            <Link {...options} hash=\"at-the-bottom\">\n              {options.to}#at-the-bottom\n            </Link>\n          </p>\n        </div>\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { linkOptions } from '@tanstack/react-router'\nimport { toRuntimePath } from '@tanstack/router-e2e-utils'\n\ntest('Smoke - Renders home', async ({ page }) => {\n  await page.goto(toRuntimePath('/'))\n  await expect(\n    page.getByRole('heading', { name: 'Welcome Home!' }),\n  ).toBeVisible()\n})\n\nconst pages = [\n  linkOptions({ to: '/normal-page' }),\n  linkOptions({ to: '/lazy-page' }),\n  linkOptions({ to: '/virtual-page' }),\n  linkOptions({ to: '/lazy-with-loader-page' }),\n  linkOptions({ to: '/page-with-search', search: { where: 'footer' } }),\n] as const\n\npages.forEach((options, index) => {\n  const from = index === 0 ? pages[1].to : pages[0].to\n  test(`On navigate from ${from} to ${options.to} (from the footer), scroll should be at top`, async ({\n    page,\n  }) => {\n    await page.goto(toRuntimePath(from))\n    const link = page.getByRole('link', { name: `Foot-${options.to}` })\n    await link.scrollIntoViewIfNeeded()\n    await page.waitForTimeout(500)\n    await link.click()\n    await expect(page.getByTestId('at-the-top')).toBeInViewport()\n  })\n})\n\n// Test for scroll related stuff\npages.forEach((options) => {\n  test(`On navigate to ${options.to} (from the header), scroll should be at top`, async ({\n    page,\n  }) => {\n    await page.goto(toRuntimePath('/'))\n    await page.getByRole('link', { name: `Head-${options.to}` }).click()\n    await expect(page.getByTestId('at-the-top')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on navigation after the page is loaded\n  test(`On navigate via index page tests to ${options.to}, scroll should resolve at the bottom`, async ({\n    page,\n  }) => {\n    await page.goto(toRuntimePath('/'))\n    await page\n      .getByRole('link', { name: `${options.to}#at-the-bottom` })\n      .click()\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on first load\n  test(`On first load of ${options.to}, scroll should resolve resolve at the bottom`, async ({\n    page,\n  }) => {\n    let url: string = options.to\n    if ('search' in options) {\n      url = `${url}?where=${options.search.where}`\n    }\n    await page.goto(toRuntimePath(`${url}#at-the-bottom`))\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n})\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\", \"node\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/scroll-restoration-sandbox-vite/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), tanstackRouter({ target: 'react' }), react()],\n})\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/react-router/sentry-integration/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-sentry-integration\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@sentry/react\": \"^10.32.0\",\n    \"@sentry/tracing\": \"^7.120.4\",\n    \"@sentry/vite-plugin\": \"^4.6.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/src/main.tsx",
    "content": "import ReactDOM from 'react-dom/client'\nimport * as Sentry from '@sentry/react'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([indexRoute])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nSentry.init({\n  dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',\n  integrations: [Sentry.tanstackRouterBrowserTracingIntegration(router)],\n  transport: () => ({\n    send: (): Promise<any> => Promise.resolve(),\n    flush: () => Promise.resolve(true),\n  }),\n  tracesSampleRate: 0.2,\n  sendClientReports: false,\n})\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('should load', async ({ page }) => {\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/sentry-integration/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { sentryVitePlugin } from '@sentry/vite-plugin'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react(), sentryVitePlugin()],\n})\n"
  },
  {
    "path": "e2e/react-router/view-transitions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-router/view-transitions/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "e2e/react-router/view-transitions/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/react-router/view-transitions/package.json",
    "content": "{\n  \"name\": \"tanstack-e2e-router-react-example-view-transitions\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  /* \n  Using defaultViewTransition would prevent the need to\n  manually add `viewTransition: true` to every navigation.\n\n  If defaultViewTransition.types is a function, it will be called with the\n  location change info and should return an array of view transition types.\n  This is useful if you want to have different view transitions depending on\n  the navigation's specifics.\n\n  An example use case is sliding in a direction based on the index of the\n  previous and next routes when navigating via browser history back and forth.\n  */\n  // defaultViewTransition: true\n  // OR\n  // defaultViewTransition: {\n  //   types: ({ fromLocation, toLocation }) => {\n  //     let direction = 'none'\n\n  //     if (fromLocation) {\n  //       const fromIndex = fromLocation.state.__TSR_index\n  //       const toIndex = toLocation.state.__TSR_index\n\n  //       direction = fromIndex > toIndex ? 'right' : 'left'\n  //     }\n\n  //     return [`slide-${direction}`]\n  //   },\n  // },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 0))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 0))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as HowItWorksRouteImport } from './routes/how-it-works'\nimport { Route as ExploreRouteImport } from './routes/explore'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst HowItWorksRoute = HowItWorksRouteImport.update({\n  id: '/how-it-works',\n  path: '/how-it-works',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ExploreRoute = ExploreRouteImport.update({\n  id: '/explore',\n  path: '/explore',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  ExploreRoute: typeof ExploreRoute\n  HowItWorksRoute: typeof HowItWorksRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/how-it-works': {\n      id: '/how-it-works'\n      path: '/how-it-works'\n      fullPath: '/how-it-works'\n      preLoaderRoute: typeof HowItWorksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/explore': {\n      id: '/explore'\n      path: '/explore'\n      fullPath: '/explore'\n      preLoaderRoute: typeof ExploreRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  ExploreRoute: ExploreRoute,\n  HowItWorksRoute: HowItWorksRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n          viewTransition\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          viewTransition\n        >\n          Posts\n        </Link>{' '}\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/routes/explore.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/explore')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2 [view-transition-name:main-content]\">\n      <h3>\n        Explore the CSS to see how to use active-view-transition-type to create\n        new viewTransitions to use with Tanstack Router.\n      </h3>\n      <h4 className={'text-sm mt-2 italic'}>\n        Disclaimer: View Transition Types may not be supported in all browsers\n        and will fall back to the default browser transition if not available.\n      </h4>\n      <div className=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          className=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/routes/how-it-works.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/how-it-works')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2 [view-transition-name:main-content]\">\n      <h3>This example demonstrates a variety of custom page transitions.</h3>\n      <div className=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          className=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n        <Link\n          to={'/explore'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          className=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2 [view-transition-name:main-content]\">\n      <h3>Welcome To The View Transitions Example!</h3>\n      <div className=\"flex justify-center mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          className=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/routes/posts.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2  [view-transition-name:main-content]\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                  // see styles.css for 'warp' transition\n                  viewTransition={{ types: ['warp'] }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <div className=\"[view-transition-name:post]\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n\n/* Slide Left Transition */\nhtml:active-view-transition-type(slide-left) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-left;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-left;\n  }\n}\n\n@keyframes slide-out-left {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(-100%);\n  }\n}\n\n@keyframes slide-in-left {\n  from {\n    transform: translateX(100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Slide Right Transition */\nhtml:active-view-transition-type(slide-right) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-right;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-right;\n  }\n}\n\n@keyframes slide-out-right {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(100%);\n  }\n}\n\n@keyframes slide-in-right {\n  from {\n    transform: translateX(-100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Warp/Rotate Transition */\nhtml:active-view-transition-type(warp) {\n  &::view-transition-old(post) {\n    animation: 400ms ease-out both warp-out;\n  }\n\n  &::view-transition-new(post) {\n    animation: 400ms ease-out both warp-in;\n  }\n}\n\n@keyframes warp-out {\n  from {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n  to {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(1.1) rotate(90deg);\n  }\n}\n\n@keyframes warp-in {\n  from {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(0.9) rotate(-45deg);\n  }\n  to {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/tests/app.spec.ts",
    "content": "import { test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('placeholder test', async ({ page }) => {\n  // This is a placeholder test\n  await page.waitForLoadState('networkidle')\n})\n"
  },
  {
    "path": "e2e/react-router/view-transitions/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/react-router/view-transitions/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/basic/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-basic\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"build:spa\": \"MODE=spa vite build && tsc --noEmit\",\n    \"build:prerender\": \"MODE=prerender vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node server.js\",\n    \"test:e2e:startDummyServer\": \"node -e 'import(\\\"./tests/setup/global.setup.ts\\\").then(m => m.default())' &\",\n    \"test:e2e:stopDummyServer\": \"node -e 'import(\\\"./tests/setup/global.teardown.ts\\\").then(m => m.default())'\",\n    \"test:e2e:spaMode\": \"rm -rf dist; rm -rf port*.txt; MODE=spa playwright test --project=chromium\",\n    \"test:e2e:ssrMode\": \"rm -rf dist; rm -rf port*.txt; playwright test --project=chromium\",\n    \"test:e2e:prerender\": \"rm -rf dist; rm -rf port*.txt; MODE=prerender playwright test --project=chromium\",\n    \"test:e2e:preview\": \"rm -rf dist; rm -rf port*.txt; MODE=preview playwright test --project=chromium\",\n    \"test:e2e\": \"pnpm run test:e2e:spaMode && pnpm run test:e2e:ssrMode && pnpm run test:e2e:prerender && pnpm run test:e2e:preview\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"express\": \"^5.1.0\",\n    \"http-proxy-middleware\": \"^3.0.5\",\n    \"js-cookie\": \"^3.0.5\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from './tests/utils/isSpaMode'\nimport { isPrerender } from './tests/utils/isPrerender'\nimport { isPreview } from './tests/utils/isPreview'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa' : ''}${isPreview ? '_preview' : ''}`,\n)\nconst START_PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa_start' : ''}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\nconst spaModeCommand = `pnpm build:spa && pnpm start`\nconst ssrModeCommand = `pnpm build && pnpm start`\nconst prerenderModeCommand = `pnpm run test:e2e:startDummyServer && pnpm build:prerender && pnpm run test:e2e:stopDummyServer && pnpm start`\nconst previewModeCommand = `pnpm build && pnpm preview --port ${PORT}`\n\nconst getCommand = () => {\n  if (isSpaMode) return spaModeCommand\n  if (isPrerender) return prerenderModeCommand\n  if (isPreview) return previewModeCommand\n  return ssrModeCommand\n}\nconsole.log('running in spa mode: ', isSpaMode.toString())\nconsole.log('running in prerender mode: ', isPrerender.toString())\nconsole.log('running in preview mode: ', isPreview.toString())\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: getCommand(),\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      MODE: process.env.MODE || '',\n      VITE_NODE_ENV: 'test',\n      VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),\n      VITE_SERVER_PORT: String(PORT),\n      START_PORT: String(START_PORT),\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/basic/public/async-user-script.js",
    "content": "console.log('ASYNC_USER_SCRIPT loaded')\nwindow.ASYNC_USER_SCRIPT = true\n"
  },
  {
    "path": "e2e/react-start/basic/public/before-scripts-async-script.js",
    "content": "console.log('BEFORE_SCRIPTS_ASYNC_SCRIPT loaded')\nwindow.BEFORE_SCRIPTS_ASYNC_SCRIPT = true\n"
  },
  {
    "path": "e2e/react-start/basic/public/before-scripts-script.js",
    "content": "console.log('BEFORE_SCRIPTS_SCRIPT loaded')\nwindow.BEFORE_SCRIPTS_SCRIPT = true\n"
  },
  {
    "path": "e2e/react-start/basic/public/head-async-script.js",
    "content": "console.log('HEAD_ASYNC_SCRIPT loaded')\nwindow.HEAD_ASYNC_SCRIPT = true\n"
  },
  {
    "path": "e2e/react-start/basic/public/head-script.js",
    "content": "console.log('HEAD_SCRIPT loaded')\nwindow.HEAD_SCRIPT = true\n"
  },
  {
    "path": "e2e/react-start/basic/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/react-start/basic/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/react-start/basic/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic/public/user-script.js",
    "content": "console.log('USER_SCRIPT loaded')\nwindow.USER_SCRIPT = true\n"
  },
  {
    "path": "e2e/react-start/basic/server.js",
    "content": "import { toNodeHandler } from 'srvx/node'\nimport path from 'node:path'\nimport express from 'express'\nimport { createProxyMiddleware } from 'http-proxy-middleware'\n\nconst port = process.env.PORT || 3000\n\nconst startPort = process.env.START_PORT || 3001\n\nconst isSpaMode = process.env.MODE === 'spa'\nconst isPrerender = process.env.MODE === 'prerender'\n\nexport async function createStartServer() {\n  const server = (await import('./dist/server/server.js')).default\n  const nodeHandler = toNodeHandler(server.fetch)\n\n  const app = express()\n\n  // to keep testing uniform stop express from redirecting /posts to /posts/\n  // when serving pre-rendered pages\n  app.use(express.static('./dist/client', { redirect: !isPrerender }))\n\n  app.use(async (req, res, next) => {\n    try {\n      await nodeHandler(req, res)\n    } catch (error) {\n      next(error)\n    }\n  })\n\n  return { app }\n}\n\nexport async function createSpaServer() {\n  const app = express()\n\n  app.use(\n    '/api',\n    createProxyMiddleware({\n      target: `http://localhost:${startPort}/api`, // Replace with your target server's URL\n      changeOrigin: false, // Needed for virtual hosted sites,\n    }),\n  )\n\n  app.use(\n    '/_serverFn',\n    createProxyMiddleware({\n      target: `http://localhost:${startPort}/_serverFn`, // Replace with your target server's URL\n      changeOrigin: false, // Needed for virtual hosted sites,\n    }),\n  )\n\n  app.use(express.static('./dist/client'))\n\n  app.get('/{*splat}', (req, res) => {\n    res.sendFile(path.resolve('./dist/client/index.html'))\n  })\n\n  return { app }\n}\n\nif (isSpaMode) {\n  createSpaServer().then(async ({ app }) =>\n    app.listen(port, () => {\n      console.info(`Client Server: http://localhost:${port}`)\n    }),\n  )\n\n  createStartServer().then(async ({ app }) =>\n    app.listen(startPort, () => {\n      console.info(`Start Server: http://localhost:${startPort}`)\n    }),\n  )\n} else {\n  createStartServer().then(async ({ app }) =>\n    app.listen(port, () => {\n      console.info(`Start Server: http://localhost:${port}`)\n    }),\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/client.tsx",
    "content": "// DO NOT DELETE THIS FILE!!!\n// This file is a good smoke test to make sure the custom client entry is working\nimport { StrictMode, startTransition } from 'react'\nimport { hydrateRoot } from 'react-dom/client'\nimport { StartClient } from '@tanstack/react-start/client'\n\nconsole.log(\"[client-entry]: using custom client entry in 'src/client.tsx'\")\n\nstartTransition(() => {\n  hydrateRoot(\n    document,\n    <StrictMode>\n      <StartClient />\n    </StrictMode>,\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/components/CustomMessage.tsx",
    "content": "import * as React from 'react'\n\nexport function CustomMessage({ message }: { message: string }) {\n  return (\n    <div className=\"py-2\">\n      <div className=\"italic\">This is a custom message:</div>\n      <p>{message}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/components/RedirectOnClick.tsx",
    "content": "import { useServerFn } from '@tanstack/react-start'\nimport { throwRedirect } from './throwRedirect'\n\ninterface RedirectOnClickProps {\n  target: 'internal' | 'external'\n  reloadDocument?: boolean\n  externalHost?: string\n}\n\nexport function RedirectOnClick({\n  target,\n  reloadDocument,\n  externalHost,\n}: RedirectOnClickProps) {\n  const execute = useServerFn(throwRedirect)\n  return (\n    <button\n      data-testid=\"redirect-on-click\"\n      onClick={() =>\n        execute({ data: { target, reloadDocument, externalHost } })\n      }\n    >\n      click me\n    </button>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/components/WindowSize.tsx",
    "content": "/**\n * This component accesses `window` at module scope, which would throw\n * if this module is ever imported on the server. The compiler optimization\n * for <ClientOnly> ensures this module is DCE'd from the server bundle\n * entirely, preventing the error.\n */\n\n// This throws at module import time on the server since `window` doesn't exist\nconst initialWidth = window.innerWidth\nconst initialHeight = window.innerHeight\n\nexport function WindowSize() {\n  return (\n    <div data-testid=\"window-size\">\n      <p data-testid=\"window-width\">Window width: {initialWidth}</p>\n      <p data-testid=\"window-height\">Window height: {initialHeight}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/components/throwRedirect.ts",
    "content": "import { redirect } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const throwRedirect = createServerFn()\n  .inputValidator(\n    (opts: {\n      target: 'internal' | 'external'\n      reloadDocument?: boolean\n      externalHost?: string\n    }) => opts,\n  )\n  .handler((ctx) => {\n    if (ctx.data.target === 'internal') {\n      throw redirect({\n        to: '/posts',\n        reloadDocument: ctx.data.reloadDocument,\n      })\n    }\n    const href = ctx.data.externalHost ?? 'http://example.com'\n    throw redirect({\n      href,\n    })\n  })\n"
  },
  {
    "path": "e2e/react-start/basic/src/raw-stream-fns.ts",
    "content": "import { createServerFn, RawStream } from '@tanstack/react-start'\n\n// Helper to create a delayed Uint8Array stream\nfunction createDelayedStream(\n  chunks: Array<Uint8Array>,\n  delayMs: number,\n): ReadableStream<Uint8Array> {\n  return new ReadableStream<Uint8Array>({\n    async start(controller) {\n      for (const chunk of chunks) {\n        await new Promise((resolve) => setTimeout(resolve, delayMs))\n        controller.enqueue(chunk)\n      }\n      controller.close()\n    },\n  })\n}\n\n// Helper to create a stream with variable delays per chunk\n// Each entry is [chunk, delayBeforeMs] - delay happens BEFORE enqueueing the chunk\nfunction createVariableDelayStream(\n  chunksWithDelays: Array<[Uint8Array, number]>,\n): ReadableStream<Uint8Array> {\n  return new ReadableStream<Uint8Array>({\n    async start(controller) {\n      for (const [chunk, delayMs] of chunksWithDelays) {\n        await new Promise((resolve) => setTimeout(resolve, delayMs))\n        controller.enqueue(chunk)\n      }\n      controller.close()\n    },\n  })\n}\n\n// Helper to encode text to Uint8Array\nfunction encode(text: string): Uint8Array {\n  return new TextEncoder().encode(text)\n}\n\n// Export helpers for use in components and SSR routes\nexport { encode, createDelayedStream, concatBytes }\n\n// Expected data for hint tests - defined here for both server and client verification\n// Test 7: Text hint with pure text\nexport const TEST7_CHUNKS = [\n  encode('Hello, '),\n  encode('World! '),\n  encode('This is text.'),\n]\nexport const TEST7_EXPECTED = concatBytes(TEST7_CHUNKS)\n\n// Test 8: Text hint with pure binary (invalid UTF-8)\nexport const TEST8_CHUNKS = [\n  new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n  new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n]\nexport const TEST8_EXPECTED = concatBytes(TEST8_CHUNKS)\n\n// Test 9: Text hint with mixed content\nexport const TEST9_CHUNKS = [\n  encode('Valid UTF-8 text'),\n  new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n  encode(' More text'),\n]\nexport const TEST9_EXPECTED = concatBytes(TEST9_CHUNKS)\n\n// Test 10: Binary hint with text data\nexport const TEST10_CHUNKS = [encode('This is text but using binary hint')]\nexport const TEST10_EXPECTED = concatBytes(TEST10_CHUNKS)\n\n// Test 11: Binary hint with pure binary\nexport const TEST11_CHUNKS = [\n  new Uint8Array([0x00, 0x01, 0x02, 0xff, 0xfe, 0xfd]),\n]\nexport const TEST11_EXPECTED = concatBytes(TEST11_CHUNKS)\n\n// Helper to concatenate byte arrays\nfunction concatBytes(chunks: Array<Uint8Array>): Uint8Array {\n  const totalLength = chunks.reduce((acc, c) => acc + c.length, 0)\n  const result = new Uint8Array(totalLength)\n  let offset = 0\n  for (const chunk of chunks) {\n    result.set(chunk, offset)\n    offset += chunk.length\n  }\n  return result\n}\n\n// Test 1: Simple single raw stream\nexport const singleRawStreamFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(\n    [encode('chunk1'), encode('chunk2'), encode('chunk3')],\n    50,\n  )\n  return {\n    message: 'Single stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 2: Multiple raw streams\nexport const multipleRawStreamsFn = createServerFn().handler(async () => {\n  const stream1 = createDelayedStream(\n    [encode('stream1-a'), encode('stream1-b')],\n    30,\n  )\n  const stream2 = createDelayedStream(\n    [encode('stream2-a'), encode('stream2-b')],\n    50,\n  )\n  return {\n    message: 'Multiple streams test',\n    first: new RawStream(stream1),\n    second: new RawStream(stream2),\n  }\n})\n\n// Test 3: JSON streaming ends before raw stream\nexport const jsonEndsFirstFn = createServerFn().handler(async () => {\n  // Slow raw stream (takes 500ms total)\n  const slowStream = createDelayedStream(\n    [encode('slow-1'), encode('slow-2'), encode('slow-3'), encode('slow-4')],\n    125,\n  )\n  return {\n    message: 'JSON ends first test',\n    timestamp: Date.now(),\n    slowData: new RawStream(slowStream),\n  }\n})\n\n// Test 4: Raw stream ends before JSON streaming (fast stream, deferred JSON)\nexport const rawEndsFirstFn = createServerFn().handler(async () => {\n  // Fast raw stream (completes quickly)\n  const fastStream = createDelayedStream([encode('fast-done')], 10)\n\n  // Deferred promise - NOT awaited, so it streams as deferred JSON\n  const deferredData = new Promise<string>((resolve) =>\n    setTimeout(() => resolve('deferred-json-data'), 200),\n  )\n\n  return {\n    message: 'Raw ends first test',\n    deferredData,\n    fastData: new RawStream(fastStream),\n  }\n})\n\n// Test 5: Large binary data\nexport const largeBinaryFn = createServerFn().handler(async () => {\n  // Create 1KB chunks\n  const chunk = new Uint8Array(1024)\n  for (let i = 0; i < chunk.length; i++) {\n    chunk[i] = i % 256\n  }\n\n  const stream = createDelayedStream([chunk, chunk, chunk], 20)\n\n  return {\n    message: 'Large binary test',\n    size: 3072,\n    binary: new RawStream(stream),\n  }\n})\n\n// Test 6: Mixed streaming (promise + raw stream)\nexport const mixedStreamingFn = createServerFn().handler(async () => {\n  const rawStream = createDelayedStream(\n    [encode('mixed-raw-1'), encode('mixed-raw-2')],\n    50,\n  )\n\n  return {\n    immediate: 'immediate-value',\n    deferred: new Promise<string>((resolve) =>\n      setTimeout(() => resolve('deferred-value'), 100),\n    ),\n    raw: new RawStream(rawStream),\n  }\n})\n\n// Test 7: Text hint with pure text data (should use UTF-8 encoding)\nexport const textHintPureTextFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST7_CHUNKS, 30)\n  return {\n    message: 'Text hint with pure text',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 8: Text hint with pure binary data (should fallback to base64)\nexport const textHintPureBinaryFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST8_CHUNKS, 30)\n  return {\n    message: 'Text hint with pure binary',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 9: Text hint with mixed content (some UTF-8, some binary)\nexport const textHintMixedFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST9_CHUNKS, 30)\n  return {\n    message: 'Text hint with mixed content',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 10: Binary hint with text data (should still use base64)\nexport const binaryHintTextFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST10_CHUNKS, 30)\n  return {\n    message: 'Binary hint with text data',\n    data: new RawStream(stream, { hint: 'binary' }),\n  }\n})\n\n// Test 11: Binary hint with pure binary data\nexport const binaryHintBinaryFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST11_CHUNKS, 30)\n  return {\n    message: 'Binary hint with binary data',\n    data: new RawStream(stream, { hint: 'binary' }),\n  }\n})\n\n// ============================================================================\n// MULTIPLEXING TESTS - Verify correct interleaving of multiple streams\n// ============================================================================\n\n// Expected data for multiplexing tests\n// Test 12: Two streams with interleaved timing\n// Stream A: sends at 0ms, 150ms, 200ms (3 chunks with pauses)\n// Stream B: sends at 50ms, 100ms, 250ms (3 chunks, different rhythm)\nexport const TEST12_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('A1-first'), 0], // immediate\n  [encode('A2-after-pause'), 150], // 150ms pause\n  [encode('A3-quick'), 50], // 50ms after A2\n]\nexport const TEST12_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('B1-start'), 50], // 50ms after start\n  [encode('B2-continue'), 50], // 50ms after B1\n  [encode('B3-final'), 150], // 150ms pause then final\n]\nexport const TEST12_STREAM_A_EXPECTED = concatBytes(\n  TEST12_STREAM_A_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST12_STREAM_B_EXPECTED = concatBytes(\n  TEST12_STREAM_B_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 13: Burst-pause-burst pattern (single stream)\n// 3 chunks quickly, long pause, 3 more chunks quickly\nexport const TEST13_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('burst1-a'), 10],\n  [encode('burst1-b'), 10],\n  [encode('burst1-c'), 10],\n  [encode('pause-then-burst2-a'), 200], // long pause\n  [encode('burst2-b'), 10],\n  [encode('burst2-c'), 10],\n]\nexport const TEST13_EXPECTED = concatBytes(\n  TEST13_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 14: Three concurrent streams with different patterns\n// Stream A: fast steady (every 30ms)\n// Stream B: slow steady (every 100ms)\n// Stream C: burst pattern (quick-pause-quick)\nexport const TEST14_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('A1'), 30],\n  [encode('A2'), 30],\n  [encode('A3'), 30],\n  [encode('A4'), 30],\n]\nexport const TEST14_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('B1-slow'), 100],\n  [encode('B2-slow'), 100],\n]\nexport const TEST14_STREAM_C_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('C1-burst'), 20],\n  [encode('C2-burst'), 20],\n  [encode('C3-after-pause'), 150],\n]\nexport const TEST14_STREAM_A_EXPECTED = concatBytes(\n  TEST14_STREAM_A_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST14_STREAM_B_EXPECTED = concatBytes(\n  TEST14_STREAM_B_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST14_STREAM_C_EXPECTED = concatBytes(\n  TEST14_STREAM_C_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 12: Interleaved multiplexing - two streams with variable delays\nexport const interleavedStreamsFn = createServerFn().handler(async () => {\n  const streamA = createVariableDelayStream(TEST12_STREAM_A_CHUNKS)\n  const streamB = createVariableDelayStream(TEST12_STREAM_B_CHUNKS)\n\n  return {\n    message: 'Interleaved streams test',\n    streamA: new RawStream(streamA),\n    streamB: new RawStream(streamB),\n  }\n})\n\n// Test 13: Burst-pause-burst pattern\nexport const burstPauseBurstFn = createServerFn().handler(async () => {\n  const stream = createVariableDelayStream(TEST13_CHUNKS)\n\n  return {\n    message: 'Burst-pause-burst test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 14: Three concurrent streams\nexport const threeStreamsFn = createServerFn().handler(async () => {\n  const streamA = createVariableDelayStream(TEST14_STREAM_A_CHUNKS)\n  const streamB = createVariableDelayStream(TEST14_STREAM_B_CHUNKS)\n  const streamC = createVariableDelayStream(TEST14_STREAM_C_CHUNKS)\n\n  return {\n    message: 'Three concurrent streams test',\n    fast: new RawStream(streamA),\n    slow: new RawStream(streamB),\n    burst: new RawStream(streamC),\n  }\n})\n\n// ============================================================================\n// EDGE CASE TESTS\n// ============================================================================\n\n// Test 15: Empty stream (zero bytes)\nexport const emptyStreamFn = createServerFn().handler(async () => {\n  // Stream that immediately closes with no data\n  const stream = new ReadableStream<Uint8Array>({\n    start(controller) {\n      controller.close()\n    },\n  })\n\n  return {\n    message: 'Empty stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 16: Stream that errors mid-flight\nexport const errorStreamFn = createServerFn().handler(async () => {\n  // Stream that sends some data then errors\n  const stream = new ReadableStream<Uint8Array>({\n    async start(controller) {\n      controller.enqueue(encode('chunk-before-error'))\n      await new Promise((resolve) => setTimeout(resolve, 50))\n      controller.error(new Error('Intentional stream error'))\n    },\n  })\n\n  return {\n    message: 'Error stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Helpers for consuming streams (exported for use in components)\n// Note: RawStream is the marker class used in loaders/server functions,\n// but after SSR deserialization it becomes ReadableStream<Uint8Array>.\n// We accept both types to handle the TypeScript mismatch.\nexport function createStreamConsumer() {\n  const decoder = new TextDecoder()\n\n  return async function consumeStream(\n    stream: ReadableStream<Uint8Array> | RawStream,\n  ): Promise<string> {\n    // Handle both RawStream (from type system) and ReadableStream (runtime)\n    const actualStream =\n      stream instanceof RawStream\n        ? stream.stream\n        : (stream as ReadableStream<Uint8Array>)\n    const reader = actualStream.getReader()\n    const chunks: Array<string> = []\n\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n    while (true) {\n      const { done, value } = await reader.read()\n      if (done) break\n      chunks.push(decoder.decode(value, { stream: true }))\n    }\n\n    return chunks.join('')\n  }\n}\n\nexport async function consumeBinaryStream(\n  stream: ReadableStream<Uint8Array> | RawStream,\n): Promise<number> {\n  // Handle both RawStream (from type system) and ReadableStream (runtime)\n  const actualStream =\n    stream instanceof RawStream\n      ? stream.stream\n      : (stream as ReadableStream<Uint8Array>)\n  const reader = actualStream.getReader()\n  let totalBytes = 0\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  while (true) {\n    const { done, value } = await reader.read()\n    if (done) break\n    totalBytes += value.length\n  }\n\n  return totalBytes\n}\n\n// Helper to collect all bytes from a stream\nexport async function collectBytes(\n  stream: ReadableStream<Uint8Array> | RawStream,\n): Promise<Uint8Array> {\n  const actualStream =\n    stream instanceof RawStream\n      ? stream.stream\n      : (stream as ReadableStream<Uint8Array>)\n  const reader = actualStream.getReader()\n  const chunks: Array<Uint8Array> = []\n  let totalLength = 0\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  while (true) {\n    const { done, value } = await reader.read()\n    if (done) break\n    chunks.push(value)\n    totalLength += value.length\n  }\n\n  const result = new Uint8Array(totalLength)\n  let pos = 0\n  for (const chunk of chunks) {\n    result.set(chunk, pos)\n    pos += chunk.length\n  }\n  return result\n}\n\n// Compare two Uint8Arrays byte-by-byte\nexport function compareBytes(\n  actual: Uint8Array,\n  expected: Uint8Array,\n): {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n} {\n  if (actual.length !== expected.length) {\n    return {\n      match: false,\n      mismatchIndex: -1, // -1 indicates length mismatch\n      actualLength: actual.length,\n      expectedLength: expected.length,\n    }\n  }\n  for (let i = 0; i < actual.length; i++) {\n    if (actual[i] !== expected[i]) {\n      return {\n        match: false,\n        mismatchIndex: i,\n        actualLength: actual.length,\n        expectedLength: expected.length,\n      }\n    }\n  }\n  return {\n    match: true,\n    mismatchIndex: null,\n    actualLength: actual.length,\n    expectedLength: expected.length,\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as TypeOnlyReexportRouteImport } from './routes/type-only-reexport'\nimport { Route as StreamRouteImport } from './routes/stream'\nimport { Route as ScriptsRouteImport } from './routes/scripts'\nimport { Route as RawStreamRouteImport } from './routes/raw-stream'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LinksRouteImport } from './routes/links'\nimport { Route as InlineScriptsRouteImport } from './routes/inline-scripts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as ClientOnlyRouteImport } from './routes/client-only'\nimport { Route as AsyncScriptsRouteImport } from './routes/async-scripts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as SpecialCharsRouteRouteImport } from './routes/specialChars/route'\nimport { Route as SearchParamsRouteRouteImport } from './routes/search-params/route'\nimport { Route as NotFoundRouteRouteImport } from './routes/not-found/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as SearchParamsIndexRouteImport } from './routes/search-params/index'\nimport { Route as RedirectIndexRouteImport } from './routes/redirect/index'\nimport { Route as RawStreamIndexRouteImport } from './routes/raw-stream/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as NotFoundIndexRouteImport } from './routes/not-found/index'\nimport { Route as MultiCookieRedirectIndexRouteImport } from './routes/multi-cookie-redirect/index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as SpecialCharsChar45824Char54620Char48124Char44397RouteImport } from './routes/specialChars/대한민국'\nimport { Route as SpecialCharsSearchRouteImport } from './routes/specialChars/search'\nimport { Route as SpecialCharsHashRouteImport } from './routes/specialChars/hash'\nimport { Route as SpecialCharsParamRouteImport } from './routes/specialChars/$param'\nimport { Route as SearchParamsLoaderThrowsRedirectRouteImport } from './routes/search-params/loader-throws-redirect'\nimport { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default'\nimport { Route as RedirectTargetRouteImport } from './routes/redirect/$target'\nimport { Route as RawStreamSsrTextHintRouteImport } from './routes/raw-stream/ssr-text-hint'\nimport { Route as RawStreamSsrSingleRouteImport } from './routes/raw-stream/ssr-single'\nimport { Route as RawStreamSsrMultipleRouteImport } from './routes/raw-stream/ssr-multiple'\nimport { Route as RawStreamSsrMixedRouteImport } from './routes/raw-stream/ssr-mixed'\nimport { Route as RawStreamSsrBinaryHintRouteImport } from './routes/raw-stream/ssr-binary-hint'\nimport { Route as RawStreamClientCallRouteImport } from './routes/raw-stream/client-call'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as NotFoundViaLoaderRouteImport } from './routes/not-found/via-loader'\nimport { Route as NotFoundViaBeforeLoadTargetRootRouteImport } from './routes/not-found/via-beforeLoad-target-root'\nimport { Route as NotFoundViaBeforeLoadRouteImport } from './routes/not-found/via-beforeLoad'\nimport { Route as MultiCookieRedirectTargetRouteImport } from './routes/multi-cookie-redirect/target'\nimport { Route as ApiUsersRouteImport } from './routes/api.users'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as SpecialCharsMalformedRouteRouteImport } from './routes/specialChars/malformed/route'\nimport { Route as NotFoundParentBoundaryRouteRouteImport } from './routes/not-found/parent-boundary/route'\nimport { Route as NotFoundDeepRouteRouteImport } from './routes/not-found/deep/route'\nimport { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index'\nimport { Route as NotFoundParentBoundaryIndexRouteImport } from './routes/not-found/parent-boundary/index'\nimport { Route as NotFoundDeepIndexRouteImport } from './routes/not-found/deep/index'\nimport { Route as SpecialCharsMalformedSearchRouteImport } from './routes/specialChars/malformed/search'\nimport { Route as SpecialCharsMalformedParamRouteImport } from './routes/specialChars/malformed/$param'\nimport { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader'\nimport { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as NotFoundParentBoundaryViaBeforeLoadRouteImport } from './routes/not-found/parent-boundary/via-beforeLoad'\nimport { Route as ApiUsersIdRouteImport } from './routes/api/users.$id'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as NotFoundDeepBRouteRouteImport } from './routes/not-found/deep/b/route'\nimport { Route as RedirectTargetServerFnIndexRouteImport } from './routes/redirect/$target/serverFn/index'\nimport { Route as RedirectTargetServerFnViaUseServerFnRouteImport } from './routes/redirect/$target/serverFn/via-useServerFn'\nimport { Route as RedirectTargetServerFnViaLoaderRouteImport } from './routes/redirect/$target/serverFn/via-loader'\nimport { Route as RedirectTargetServerFnViaBeforeLoadRouteImport } from './routes/redirect/$target/serverFn/via-beforeLoad'\nimport { Route as FooBarQuxHereRouteImport } from './routes/foo/$bar/$qux/_here'\nimport { Route as NotFoundDeepBCRouteRouteImport } from './routes/not-found/deep/b/c/route'\nimport { Route as FooBarQuxHereIndexRouteImport } from './routes/foo/$bar/$qux/_here/index'\nimport { Route as NotFoundDeepBCDRouteImport } from './routes/not-found/deep/b/c/d'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst TypeOnlyReexportRoute = TypeOnlyReexportRouteImport.update({\n  id: '/type-only-reexport',\n  path: '/type-only-reexport',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst StreamRoute = StreamRouteImport.update({\n  id: '/stream',\n  path: '/stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ScriptsRoute = ScriptsRouteImport.update({\n  id: '/scripts',\n  path: '/scripts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamRoute = RawStreamRouteImport.update({\n  id: '/raw-stream',\n  path: '/raw-stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LinksRoute = LinksRouteImport.update({\n  id: '/links',\n  path: '/links',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst InlineScriptsRoute = InlineScriptsRouteImport.update({\n  id: '/inline-scripts',\n  path: '/inline-scripts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClientOnlyRoute = ClientOnlyRouteImport.update({\n  id: '/client-only',\n  path: '/client-only',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AsyncScriptsRoute = AsyncScriptsRouteImport.update({\n  id: '/async-scripts',\n  path: '/async-scripts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SpecialCharsRouteRoute = SpecialCharsRouteRouteImport.update({\n  id: '/specialChars',\n  path: '/specialChars',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({\n  id: '/search-params',\n  path: '/search-params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotFoundRouteRoute = NotFoundRouteRouteImport.update({\n  id: '/not-found',\n  path: '/not-found',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RedirectIndexRoute = RedirectIndexRouteImport.update({\n  id: '/redirect/',\n  path: '/redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamIndexRoute = RawStreamIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst NotFoundIndexRoute = NotFoundIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst MultiCookieRedirectIndexRoute =\n  MultiCookieRedirectIndexRouteImport.update({\n    id: '/multi-cookie-redirect/',\n    path: '/multi-cookie-redirect/',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst SpecialCharsChar45824Char54620Char48124Char44397Route =\n  SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => SpecialCharsRouteRoute,\n  } as any)\nconst SpecialCharsSearchRoute = SpecialCharsSearchRouteImport.update({\n  id: '/search',\n  path: '/search',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SpecialCharsHashRoute = SpecialCharsHashRouteImport.update({\n  id: '/hash',\n  path: '/hash',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SpecialCharsParamRoute = SpecialCharsParamRouteImport.update({\n  id: '/$param',\n  path: '/$param',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SearchParamsLoaderThrowsRedirectRoute =\n  SearchParamsLoaderThrowsRedirectRouteImport.update({\n    id: '/loader-throws-redirect',\n    path: '/loader-throws-redirect',\n    getParentRoute: () => SearchParamsRouteRoute,\n  } as any)\nconst SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({\n  id: '/default',\n  path: '/default',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RedirectTargetRoute = RedirectTargetRouteImport.update({\n  id: '/redirect/$target',\n  path: '/redirect/$target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamSsrTextHintRoute = RawStreamSsrTextHintRouteImport.update({\n  id: '/ssr-text-hint',\n  path: '/ssr-text-hint',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrSingleRoute = RawStreamSsrSingleRouteImport.update({\n  id: '/ssr-single',\n  path: '/ssr-single',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrMultipleRoute = RawStreamSsrMultipleRouteImport.update({\n  id: '/ssr-multiple',\n  path: '/ssr-multiple',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrMixedRoute = RawStreamSsrMixedRouteImport.update({\n  id: '/ssr-mixed',\n  path: '/ssr-mixed',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrBinaryHintRoute = RawStreamSsrBinaryHintRouteImport.update({\n  id: '/ssr-binary-hint',\n  path: '/ssr-binary-hint',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamClientCallRoute = RawStreamClientCallRouteImport.update({\n  id: '/client-call',\n  path: '/client-call',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({\n  id: '/via-loader',\n  path: '/via-loader',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst NotFoundViaBeforeLoadTargetRootRoute =\n  NotFoundViaBeforeLoadTargetRootRouteImport.update({\n    id: '/via-beforeLoad-target-root',\n    path: '/via-beforeLoad-target-root',\n    getParentRoute: () => NotFoundRouteRoute,\n  } as any)\nconst NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({\n  id: '/via-beforeLoad',\n  path: '/via-beforeLoad',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst MultiCookieRedirectTargetRoute =\n  MultiCookieRedirectTargetRouteImport.update({\n    id: '/multi-cookie-redirect/target',\n    path: '/multi-cookie-redirect/target',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst SpecialCharsMalformedRouteRoute =\n  SpecialCharsMalformedRouteRouteImport.update({\n    id: '/malformed',\n    path: '/malformed',\n    getParentRoute: () => SpecialCharsRouteRoute,\n  } as any)\nconst NotFoundParentBoundaryRouteRoute =\n  NotFoundParentBoundaryRouteRouteImport.update({\n    id: '/parent-boundary',\n    path: '/parent-boundary',\n    getParentRoute: () => NotFoundRouteRoute,\n  } as any)\nconst NotFoundDeepRouteRoute = NotFoundDeepRouteRouteImport.update({\n  id: '/deep',\n  path: '/deep',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst NotFoundParentBoundaryIndexRoute =\n  NotFoundParentBoundaryIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NotFoundParentBoundaryRouteRoute,\n  } as any)\nconst NotFoundDeepIndexRoute = NotFoundDeepIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NotFoundDeepRouteRoute,\n} as any)\nconst SpecialCharsMalformedSearchRoute =\n  SpecialCharsMalformedSearchRouteImport.update({\n    id: '/search',\n    path: '/search',\n    getParentRoute: () => SpecialCharsMalformedRouteRoute,\n  } as any)\nconst SpecialCharsMalformedParamRoute =\n  SpecialCharsMalformedParamRouteImport.update({\n    id: '/$param',\n    path: '/$param',\n    getParentRoute: () => SpecialCharsMalformedRouteRoute,\n  } as any)\nconst RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({\n  id: '/via-loader',\n  path: '/via-loader',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst RedirectTargetViaBeforeLoadRoute =\n  RedirectTargetViaBeforeLoadRouteImport.update({\n    id: '/via-beforeLoad',\n    path: '/via-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotFoundParentBoundaryViaBeforeLoadRoute =\n  NotFoundParentBoundaryViaBeforeLoadRouteImport.update({\n    id: '/via-beforeLoad',\n    path: '/via-beforeLoad',\n    getParentRoute: () => NotFoundParentBoundaryRouteRoute,\n  } as any)\nconst ApiUsersIdRoute = ApiUsersIdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst NotFoundDeepBRouteRoute = NotFoundDeepBRouteRouteImport.update({\n  id: '/b',\n  path: '/b',\n  getParentRoute: () => NotFoundDeepRouteRoute,\n} as any)\nconst RedirectTargetServerFnIndexRoute =\n  RedirectTargetServerFnIndexRouteImport.update({\n    id: '/serverFn/',\n    path: '/serverFn/',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaUseServerFnRoute =\n  RedirectTargetServerFnViaUseServerFnRouteImport.update({\n    id: '/serverFn/via-useServerFn',\n    path: '/serverFn/via-useServerFn',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaLoaderRoute =\n  RedirectTargetServerFnViaLoaderRouteImport.update({\n    id: '/serverFn/via-loader',\n    path: '/serverFn/via-loader',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaBeforeLoadRoute =\n  RedirectTargetServerFnViaBeforeLoadRouteImport.update({\n    id: '/serverFn/via-beforeLoad',\n    path: '/serverFn/via-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst FooBarQuxHereRoute = FooBarQuxHereRouteImport.update({\n  id: '/foo/$bar/$qux/_here',\n  path: '/foo/$bar/$qux',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotFoundDeepBCRouteRoute = NotFoundDeepBCRouteRouteImport.update({\n  id: '/c',\n  path: '/c',\n  getParentRoute: () => NotFoundDeepBRouteRoute,\n} as any)\nconst FooBarQuxHereIndexRoute = FooBarQuxHereIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => FooBarQuxHereRoute,\n} as any)\nconst NotFoundDeepBCDRoute = NotFoundDeepBCDRouteImport.update({\n  id: '/d',\n  path: '/d',\n  getParentRoute: () => NotFoundDeepBCRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/not-found': typeof NotFoundRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/async-scripts': typeof AsyncScriptsRoute\n  '/client-only': typeof ClientOnlyRoute\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/raw-stream': typeof RawStreamRouteWithChildren\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/type-only-reexport': typeof TypeOnlyReexportRoute\n  '/users': typeof UsersRouteWithChildren\n  '/not-found/deep': typeof NotFoundDeepRouteRouteWithChildren\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute\n  '/not-found/': typeof NotFoundIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/raw-stream/': typeof RawStreamIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/not-found/deep/b': typeof NotFoundDeepBRouteRouteWithChildren\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/not-found/deep/': typeof NotFoundDeepIndexRoute\n  '/not-found/parent-boundary/': typeof NotFoundParentBoundaryIndexRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/not-found/deep/b/c': typeof NotFoundDeepBCRouteRouteWithChildren\n  '/foo/$bar/$qux': typeof FooBarQuxHereRouteWithChildren\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute\n  '/not-found/deep/b/c/d': typeof NotFoundDeepBCDRoute\n  '/foo/$bar/$qux/': typeof FooBarQuxHereIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/async-scripts': typeof AsyncScriptsRoute\n  '/client-only': typeof ClientOnlyRoute\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/type-only-reexport': typeof TypeOnlyReexportRoute\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect': typeof MultiCookieRedirectIndexRoute\n  '/not-found': typeof NotFoundIndexRoute\n  '/posts': typeof PostsIndexRoute\n  '/raw-stream': typeof RawStreamIndexRoute\n  '/redirect': typeof RedirectIndexRoute\n  '/search-params': typeof SearchParamsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/not-found/deep/b': typeof NotFoundDeepBRouteRouteWithChildren\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/not-found/deep': typeof NotFoundDeepIndexRoute\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryIndexRoute\n  '/redirect/$target': typeof RedirectTargetIndexRoute\n  '/not-found/deep/b/c': typeof NotFoundDeepBCRouteRouteWithChildren\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn': typeof RedirectTargetServerFnIndexRoute\n  '/not-found/deep/b/c/d': typeof NotFoundDeepBCDRoute\n  '/foo/$bar/$qux': typeof FooBarQuxHereIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/not-found': typeof NotFoundRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/_layout': typeof LayoutRouteWithChildren\n  '/async-scripts': typeof AsyncScriptsRoute\n  '/client-only': typeof ClientOnlyRoute\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/raw-stream': typeof RawStreamRouteWithChildren\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/type-only-reexport': typeof TypeOnlyReexportRoute\n  '/users': typeof UsersRouteWithChildren\n  '/not-found/deep': typeof NotFoundDeepRouteRouteWithChildren\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute\n  '/not-found/': typeof NotFoundIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/raw-stream/': typeof RawStreamIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/not-found/deep/b': typeof NotFoundDeepBRouteRouteWithChildren\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/not-found/deep/': typeof NotFoundDeepIndexRoute\n  '/not-found/parent-boundary/': typeof NotFoundParentBoundaryIndexRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/not-found/deep/b/c': typeof NotFoundDeepBCRouteRouteWithChildren\n  '/foo/$bar/$qux/_here': typeof FooBarQuxHereRouteWithChildren\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute\n  '/not-found/deep/b/c/d': typeof NotFoundDeepBCDRoute\n  '/foo/$bar/$qux/_here/': typeof FooBarQuxHereIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/not-found'\n    | '/search-params'\n    | '/specialChars'\n    | '/async-scripts'\n    | '/client-only'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/posts'\n    | '/raw-stream'\n    | '/scripts'\n    | '/stream'\n    | '/type-only-reexport'\n    | '/users'\n    | '/not-found/deep'\n    | '/not-found/parent-boundary'\n    | '/specialChars/malformed'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect/'\n    | '/not-found/'\n    | '/posts/'\n    | '/raw-stream/'\n    | '/redirect/'\n    | '/search-params/'\n    | '/users/'\n    | '/not-found/deep/b'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$id'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/not-found/deep/'\n    | '/not-found/parent-boundary/'\n    | '/redirect/$target/'\n    | '/not-found/deep/b/c'\n    | '/foo/$bar/$qux'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn/'\n    | '/not-found/deep/b/c/d'\n    | '/foo/$bar/$qux/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/specialChars'\n    | '/async-scripts'\n    | '/client-only'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/scripts'\n    | '/stream'\n    | '/type-only-reexport'\n    | '/specialChars/malformed'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect'\n    | '/not-found'\n    | '/posts'\n    | '/raw-stream'\n    | '/redirect'\n    | '/search-params'\n    | '/users'\n    | '/not-found/deep/b'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$id'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/not-found/deep'\n    | '/not-found/parent-boundary'\n    | '/redirect/$target'\n    | '/not-found/deep/b/c'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn'\n    | '/not-found/deep/b/c/d'\n    | '/foo/$bar/$qux'\n  id:\n    | '__root__'\n    | '/'\n    | '/not-found'\n    | '/search-params'\n    | '/specialChars'\n    | '/_layout'\n    | '/async-scripts'\n    | '/client-only'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/posts'\n    | '/raw-stream'\n    | '/scripts'\n    | '/stream'\n    | '/type-only-reexport'\n    | '/users'\n    | '/not-found/deep'\n    | '/not-found/parent-boundary'\n    | '/specialChars/malformed'\n    | '/_layout/_layout-2'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect/'\n    | '/not-found/'\n    | '/posts/'\n    | '/raw-stream/'\n    | '/redirect/'\n    | '/search-params/'\n    | '/users/'\n    | '/not-found/deep/b'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/api/users/$id'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts_/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/not-found/deep/'\n    | '/not-found/parent-boundary/'\n    | '/redirect/$target/'\n    | '/not-found/deep/b/c'\n    | '/foo/$bar/$qux/_here'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn/'\n    | '/not-found/deep/b/c/d'\n    | '/foo/$bar/$qux/_here/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  NotFoundRouteRoute: typeof NotFoundRouteRouteWithChildren\n  SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren\n  SpecialCharsRouteRoute: typeof SpecialCharsRouteRouteWithChildren\n  LayoutRoute: typeof LayoutRouteWithChildren\n  AsyncScriptsRoute: typeof AsyncScriptsRoute\n  ClientOnlyRoute: typeof ClientOnlyRoute\n  DeferredRoute: typeof DeferredRoute\n  InlineScriptsRoute: typeof InlineScriptsRoute\n  LinksRoute: typeof LinksRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RawStreamRoute: typeof RawStreamRouteWithChildren\n  ScriptsRoute: typeof ScriptsRoute\n  StreamRoute: typeof StreamRoute\n  TypeOnlyReexportRoute: typeof TypeOnlyReexportRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  MultiCookieRedirectTargetRoute: typeof MultiCookieRedirectTargetRoute\n  RedirectTargetRoute: typeof RedirectTargetRouteWithChildren\n  MultiCookieRedirectIndexRoute: typeof MultiCookieRedirectIndexRoute\n  RedirectIndexRoute: typeof RedirectIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  FooBarQuxHereRoute: typeof FooBarQuxHereRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/type-only-reexport': {\n      id: '/type-only-reexport'\n      path: '/type-only-reexport'\n      fullPath: '/type-only-reexport'\n      preLoaderRoute: typeof TypeOnlyReexportRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/stream': {\n      id: '/stream'\n      path: '/stream'\n      fullPath: '/stream'\n      preLoaderRoute: typeof StreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/scripts': {\n      id: '/scripts'\n      path: '/scripts'\n      fullPath: '/scripts'\n      preLoaderRoute: typeof ScriptsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream': {\n      id: '/raw-stream'\n      path: '/raw-stream'\n      fullPath: '/raw-stream'\n      preLoaderRoute: typeof RawStreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/links': {\n      id: '/links'\n      path: '/links'\n      fullPath: '/links'\n      preLoaderRoute: typeof LinksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/inline-scripts': {\n      id: '/inline-scripts'\n      path: '/inline-scripts'\n      fullPath: '/inline-scripts'\n      preLoaderRoute: typeof InlineScriptsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/client-only': {\n      id: '/client-only'\n      path: '/client-only'\n      fullPath: '/client-only'\n      preLoaderRoute: typeof ClientOnlyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/async-scripts': {\n      id: '/async-scripts'\n      path: '/async-scripts'\n      fullPath: '/async-scripts'\n      preLoaderRoute: typeof AsyncScriptsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/specialChars': {\n      id: '/specialChars'\n      path: '/specialChars'\n      fullPath: '/specialChars'\n      preLoaderRoute: typeof SpecialCharsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params': {\n      id: '/search-params'\n      path: '/search-params'\n      fullPath: '/search-params'\n      preLoaderRoute: typeof SearchParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/not-found': {\n      id: '/not-found'\n      path: '/not-found'\n      fullPath: '/not-found'\n      preLoaderRoute: typeof NotFoundRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/search-params/': {\n      id: '/search-params/'\n      path: '/'\n      fullPath: '/search-params/'\n      preLoaderRoute: typeof SearchParamsIndexRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/redirect/': {\n      id: '/redirect/'\n      path: '/redirect'\n      fullPath: '/redirect/'\n      preLoaderRoute: typeof RedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream/': {\n      id: '/raw-stream/'\n      path: '/'\n      fullPath: '/raw-stream/'\n      preLoaderRoute: typeof RawStreamIndexRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/not-found/': {\n      id: '/not-found/'\n      path: '/'\n      fullPath: '/not-found/'\n      preLoaderRoute: typeof NotFoundIndexRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/multi-cookie-redirect/': {\n      id: '/multi-cookie-redirect/'\n      path: '/multi-cookie-redirect'\n      fullPath: '/multi-cookie-redirect/'\n      preLoaderRoute: typeof MultiCookieRedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/specialChars/대한민국': {\n      id: '/specialChars/대한민국'\n      path: '/대한민국'\n      fullPath: '/specialChars/대한민국'\n      preLoaderRoute: typeof SpecialCharsChar45824Char54620Char48124Char44397RouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/search': {\n      id: '/specialChars/search'\n      path: '/search'\n      fullPath: '/specialChars/search'\n      preLoaderRoute: typeof SpecialCharsSearchRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/hash': {\n      id: '/specialChars/hash'\n      path: '/hash'\n      fullPath: '/specialChars/hash'\n      preLoaderRoute: typeof SpecialCharsHashRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/$param': {\n      id: '/specialChars/$param'\n      path: '/$param'\n      fullPath: '/specialChars/$param'\n      preLoaderRoute: typeof SpecialCharsParamRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/search-params/loader-throws-redirect': {\n      id: '/search-params/loader-throws-redirect'\n      path: '/loader-throws-redirect'\n      fullPath: '/search-params/loader-throws-redirect'\n      preLoaderRoute: typeof SearchParamsLoaderThrowsRedirectRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/search-params/default': {\n      id: '/search-params/default'\n      path: '/default'\n      fullPath: '/search-params/default'\n      preLoaderRoute: typeof SearchParamsDefaultRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/redirect/$target': {\n      id: '/redirect/$target'\n      path: '/redirect/$target'\n      fullPath: '/redirect/$target'\n      preLoaderRoute: typeof RedirectTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream/ssr-text-hint': {\n      id: '/raw-stream/ssr-text-hint'\n      path: '/ssr-text-hint'\n      fullPath: '/raw-stream/ssr-text-hint'\n      preLoaderRoute: typeof RawStreamSsrTextHintRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-single': {\n      id: '/raw-stream/ssr-single'\n      path: '/ssr-single'\n      fullPath: '/raw-stream/ssr-single'\n      preLoaderRoute: typeof RawStreamSsrSingleRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-multiple': {\n      id: '/raw-stream/ssr-multiple'\n      path: '/ssr-multiple'\n      fullPath: '/raw-stream/ssr-multiple'\n      preLoaderRoute: typeof RawStreamSsrMultipleRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-mixed': {\n      id: '/raw-stream/ssr-mixed'\n      path: '/ssr-mixed'\n      fullPath: '/raw-stream/ssr-mixed'\n      preLoaderRoute: typeof RawStreamSsrMixedRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-binary-hint': {\n      id: '/raw-stream/ssr-binary-hint'\n      path: '/ssr-binary-hint'\n      fullPath: '/raw-stream/ssr-binary-hint'\n      preLoaderRoute: typeof RawStreamSsrBinaryHintRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/client-call': {\n      id: '/raw-stream/client-call'\n      path: '/client-call'\n      fullPath: '/raw-stream/client-call'\n      preLoaderRoute: typeof RawStreamClientCallRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/not-found/via-loader': {\n      id: '/not-found/via-loader'\n      path: '/via-loader'\n      fullPath: '/not-found/via-loader'\n      preLoaderRoute: typeof NotFoundViaLoaderRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/not-found/via-beforeLoad-target-root': {\n      id: '/not-found/via-beforeLoad-target-root'\n      path: '/via-beforeLoad-target-root'\n      fullPath: '/not-found/via-beforeLoad-target-root'\n      preLoaderRoute: typeof NotFoundViaBeforeLoadTargetRootRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/not-found/via-beforeLoad': {\n      id: '/not-found/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/not-found/via-beforeLoad'\n      preLoaderRoute: typeof NotFoundViaBeforeLoadRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/multi-cookie-redirect/target': {\n      id: '/multi-cookie-redirect/target'\n      path: '/multi-cookie-redirect/target'\n      fullPath: '/multi-cookie-redirect/target'\n      preLoaderRoute: typeof MultiCookieRedirectTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/specialChars/malformed': {\n      id: '/specialChars/malformed'\n      path: '/malformed'\n      fullPath: '/specialChars/malformed'\n      preLoaderRoute: typeof SpecialCharsMalformedRouteRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/not-found/parent-boundary': {\n      id: '/not-found/parent-boundary'\n      path: '/parent-boundary'\n      fullPath: '/not-found/parent-boundary'\n      preLoaderRoute: typeof NotFoundParentBoundaryRouteRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/not-found/deep': {\n      id: '/not-found/deep'\n      path: '/deep'\n      fullPath: '/not-found/deep'\n      preLoaderRoute: typeof NotFoundDeepRouteRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/redirect/$target/': {\n      id: '/redirect/$target/'\n      path: '/'\n      fullPath: '/redirect/$target/'\n      preLoaderRoute: typeof RedirectTargetIndexRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/not-found/parent-boundary/': {\n      id: '/not-found/parent-boundary/'\n      path: '/'\n      fullPath: '/not-found/parent-boundary/'\n      preLoaderRoute: typeof NotFoundParentBoundaryIndexRouteImport\n      parentRoute: typeof NotFoundParentBoundaryRouteRoute\n    }\n    '/not-found/deep/': {\n      id: '/not-found/deep/'\n      path: '/'\n      fullPath: '/not-found/deep/'\n      preLoaderRoute: typeof NotFoundDeepIndexRouteImport\n      parentRoute: typeof NotFoundDeepRouteRoute\n    }\n    '/specialChars/malformed/search': {\n      id: '/specialChars/malformed/search'\n      path: '/search'\n      fullPath: '/specialChars/malformed/search'\n      preLoaderRoute: typeof SpecialCharsMalformedSearchRouteImport\n      parentRoute: typeof SpecialCharsMalformedRouteRoute\n    }\n    '/specialChars/malformed/$param': {\n      id: '/specialChars/malformed/$param'\n      path: '/$param'\n      fullPath: '/specialChars/malformed/$param'\n      preLoaderRoute: typeof SpecialCharsMalformedParamRouteImport\n      parentRoute: typeof SpecialCharsMalformedRouteRoute\n    }\n    '/redirect/$target/via-loader': {\n      id: '/redirect/$target/via-loader'\n      path: '/via-loader'\n      fullPath: '/redirect/$target/via-loader'\n      preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-beforeLoad': {\n      id: '/redirect/$target/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/redirect/$target/via-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/not-found/parent-boundary/via-beforeLoad': {\n      id: '/not-found/parent-boundary/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/not-found/parent-boundary/via-beforeLoad'\n      preLoaderRoute: typeof NotFoundParentBoundaryViaBeforeLoadRouteImport\n      parentRoute: typeof NotFoundParentBoundaryRouteRoute\n    }\n    '/api/users/$id': {\n      id: '/api/users/$id'\n      path: '/$id'\n      fullPath: '/api/users/$id'\n      preLoaderRoute: typeof ApiUsersIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/not-found/deep/b': {\n      id: '/not-found/deep/b'\n      path: '/b'\n      fullPath: '/not-found/deep/b'\n      preLoaderRoute: typeof NotFoundDeepBRouteRouteImport\n      parentRoute: typeof NotFoundDeepRouteRoute\n    }\n    '/redirect/$target/serverFn/': {\n      id: '/redirect/$target/serverFn/'\n      path: '/serverFn'\n      fullPath: '/redirect/$target/serverFn/'\n      preLoaderRoute: typeof RedirectTargetServerFnIndexRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-useServerFn': {\n      id: '/redirect/$target/serverFn/via-useServerFn'\n      path: '/serverFn/via-useServerFn'\n      fullPath: '/redirect/$target/serverFn/via-useServerFn'\n      preLoaderRoute: typeof RedirectTargetServerFnViaUseServerFnRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-loader': {\n      id: '/redirect/$target/serverFn/via-loader'\n      path: '/serverFn/via-loader'\n      fullPath: '/redirect/$target/serverFn/via-loader'\n      preLoaderRoute: typeof RedirectTargetServerFnViaLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-beforeLoad': {\n      id: '/redirect/$target/serverFn/via-beforeLoad'\n      path: '/serverFn/via-beforeLoad'\n      fullPath: '/redirect/$target/serverFn/via-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetServerFnViaBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/foo/$bar/$qux/_here': {\n      id: '/foo/$bar/$qux/_here'\n      path: '/foo/$bar/$qux'\n      fullPath: '/foo/$bar/$qux'\n      preLoaderRoute: typeof FooBarQuxHereRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/not-found/deep/b/c': {\n      id: '/not-found/deep/b/c'\n      path: '/c'\n      fullPath: '/not-found/deep/b/c'\n      preLoaderRoute: typeof NotFoundDeepBCRouteRouteImport\n      parentRoute: typeof NotFoundDeepBRouteRoute\n    }\n    '/foo/$bar/$qux/_here/': {\n      id: '/foo/$bar/$qux/_here/'\n      path: '/'\n      fullPath: '/foo/$bar/$qux/'\n      preLoaderRoute: typeof FooBarQuxHereIndexRouteImport\n      parentRoute: typeof FooBarQuxHereRoute\n    }\n    '/not-found/deep/b/c/d': {\n      id: '/not-found/deep/b/c/d'\n      path: '/d'\n      fullPath: '/not-found/deep/b/c/d'\n      preLoaderRoute: typeof NotFoundDeepBCDRouteImport\n      parentRoute: typeof NotFoundDeepBCRouteRoute\n    }\n  }\n}\n\ninterface NotFoundDeepBCRouteRouteChildren {\n  NotFoundDeepBCDRoute: typeof NotFoundDeepBCDRoute\n}\n\nconst NotFoundDeepBCRouteRouteChildren: NotFoundDeepBCRouteRouteChildren = {\n  NotFoundDeepBCDRoute: NotFoundDeepBCDRoute,\n}\n\nconst NotFoundDeepBCRouteRouteWithChildren =\n  NotFoundDeepBCRouteRoute._addFileChildren(NotFoundDeepBCRouteRouteChildren)\n\ninterface NotFoundDeepBRouteRouteChildren {\n  NotFoundDeepBCRouteRoute: typeof NotFoundDeepBCRouteRouteWithChildren\n}\n\nconst NotFoundDeepBRouteRouteChildren: NotFoundDeepBRouteRouteChildren = {\n  NotFoundDeepBCRouteRoute: NotFoundDeepBCRouteRouteWithChildren,\n}\n\nconst NotFoundDeepBRouteRouteWithChildren =\n  NotFoundDeepBRouteRoute._addFileChildren(NotFoundDeepBRouteRouteChildren)\n\ninterface NotFoundDeepRouteRouteChildren {\n  NotFoundDeepBRouteRoute: typeof NotFoundDeepBRouteRouteWithChildren\n  NotFoundDeepIndexRoute: typeof NotFoundDeepIndexRoute\n}\n\nconst NotFoundDeepRouteRouteChildren: NotFoundDeepRouteRouteChildren = {\n  NotFoundDeepBRouteRoute: NotFoundDeepBRouteRouteWithChildren,\n  NotFoundDeepIndexRoute: NotFoundDeepIndexRoute,\n}\n\nconst NotFoundDeepRouteRouteWithChildren =\n  NotFoundDeepRouteRoute._addFileChildren(NotFoundDeepRouteRouteChildren)\n\ninterface NotFoundParentBoundaryRouteRouteChildren {\n  NotFoundParentBoundaryViaBeforeLoadRoute: typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  NotFoundParentBoundaryIndexRoute: typeof NotFoundParentBoundaryIndexRoute\n}\n\nconst NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren =\n  {\n    NotFoundParentBoundaryViaBeforeLoadRoute:\n      NotFoundParentBoundaryViaBeforeLoadRoute,\n    NotFoundParentBoundaryIndexRoute: NotFoundParentBoundaryIndexRoute,\n  }\n\nconst NotFoundParentBoundaryRouteRouteWithChildren =\n  NotFoundParentBoundaryRouteRoute._addFileChildren(\n    NotFoundParentBoundaryRouteRouteChildren,\n  )\n\ninterface NotFoundRouteRouteChildren {\n  NotFoundDeepRouteRoute: typeof NotFoundDeepRouteRouteWithChildren\n  NotFoundParentBoundaryRouteRoute: typeof NotFoundParentBoundaryRouteRouteWithChildren\n  NotFoundViaBeforeLoadRoute: typeof NotFoundViaBeforeLoadRoute\n  NotFoundViaBeforeLoadTargetRootRoute: typeof NotFoundViaBeforeLoadTargetRootRoute\n  NotFoundViaLoaderRoute: typeof NotFoundViaLoaderRoute\n  NotFoundIndexRoute: typeof NotFoundIndexRoute\n}\n\nconst NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = {\n  NotFoundDeepRouteRoute: NotFoundDeepRouteRouteWithChildren,\n  NotFoundParentBoundaryRouteRoute:\n    NotFoundParentBoundaryRouteRouteWithChildren,\n  NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute,\n  NotFoundViaBeforeLoadTargetRootRoute: NotFoundViaBeforeLoadTargetRootRoute,\n  NotFoundViaLoaderRoute: NotFoundViaLoaderRoute,\n  NotFoundIndexRoute: NotFoundIndexRoute,\n}\n\nconst NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(\n  NotFoundRouteRouteChildren,\n)\n\ninterface SearchParamsRouteRouteChildren {\n  SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute\n  SearchParamsLoaderThrowsRedirectRoute: typeof SearchParamsLoaderThrowsRedirectRoute\n  SearchParamsIndexRoute: typeof SearchParamsIndexRoute\n}\n\nconst SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {\n  SearchParamsDefaultRoute: SearchParamsDefaultRoute,\n  SearchParamsLoaderThrowsRedirectRoute: SearchParamsLoaderThrowsRedirectRoute,\n  SearchParamsIndexRoute: SearchParamsIndexRoute,\n}\n\nconst SearchParamsRouteRouteWithChildren =\n  SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)\n\ninterface SpecialCharsMalformedRouteRouteChildren {\n  SpecialCharsMalformedParamRoute: typeof SpecialCharsMalformedParamRoute\n  SpecialCharsMalformedSearchRoute: typeof SpecialCharsMalformedSearchRoute\n}\n\nconst SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren =\n  {\n    SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,\n    SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,\n  }\n\nconst SpecialCharsMalformedRouteRouteWithChildren =\n  SpecialCharsMalformedRouteRoute._addFileChildren(\n    SpecialCharsMalformedRouteRouteChildren,\n  )\n\ninterface SpecialCharsRouteRouteChildren {\n  SpecialCharsMalformedRouteRoute: typeof SpecialCharsMalformedRouteRouteWithChildren\n  SpecialCharsParamRoute: typeof SpecialCharsParamRoute\n  SpecialCharsHashRoute: typeof SpecialCharsHashRoute\n  SpecialCharsSearchRoute: typeof SpecialCharsSearchRoute\n  SpecialCharsChar45824Char54620Char48124Char44397Route: typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n}\n\nconst SpecialCharsRouteRouteChildren: SpecialCharsRouteRouteChildren = {\n  SpecialCharsMalformedRouteRoute: SpecialCharsMalformedRouteRouteWithChildren,\n  SpecialCharsParamRoute: SpecialCharsParamRoute,\n  SpecialCharsHashRoute: SpecialCharsHashRoute,\n  SpecialCharsSearchRoute: SpecialCharsSearchRoute,\n  SpecialCharsChar45824Char54620Char48124Char44397Route:\n    SpecialCharsChar45824Char54620Char48124Char44397Route,\n}\n\nconst SpecialCharsRouteRouteWithChildren =\n  SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface RawStreamRouteChildren {\n  RawStreamClientCallRoute: typeof RawStreamClientCallRoute\n  RawStreamSsrBinaryHintRoute: typeof RawStreamSsrBinaryHintRoute\n  RawStreamSsrMixedRoute: typeof RawStreamSsrMixedRoute\n  RawStreamSsrMultipleRoute: typeof RawStreamSsrMultipleRoute\n  RawStreamSsrSingleRoute: typeof RawStreamSsrSingleRoute\n  RawStreamSsrTextHintRoute: typeof RawStreamSsrTextHintRoute\n  RawStreamIndexRoute: typeof RawStreamIndexRoute\n}\n\nconst RawStreamRouteChildren: RawStreamRouteChildren = {\n  RawStreamClientCallRoute: RawStreamClientCallRoute,\n  RawStreamSsrBinaryHintRoute: RawStreamSsrBinaryHintRoute,\n  RawStreamSsrMixedRoute: RawStreamSsrMixedRoute,\n  RawStreamSsrMultipleRoute: RawStreamSsrMultipleRoute,\n  RawStreamSsrSingleRoute: RawStreamSsrSingleRoute,\n  RawStreamSsrTextHintRoute: RawStreamSsrTextHintRoute,\n  RawStreamIndexRoute: RawStreamIndexRoute,\n}\n\nconst RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(\n  RawStreamRouteChildren,\n)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersIdRoute: typeof ApiUsersIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersIdRoute: ApiUsersIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\ninterface RedirectTargetRouteChildren {\n  RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute\n  RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute\n  RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute\n  RedirectTargetServerFnViaBeforeLoadRoute: typeof RedirectTargetServerFnViaBeforeLoadRoute\n  RedirectTargetServerFnViaLoaderRoute: typeof RedirectTargetServerFnViaLoaderRoute\n  RedirectTargetServerFnViaUseServerFnRoute: typeof RedirectTargetServerFnViaUseServerFnRoute\n  RedirectTargetServerFnIndexRoute: typeof RedirectTargetServerFnIndexRoute\n}\n\nconst RedirectTargetRouteChildren: RedirectTargetRouteChildren = {\n  RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,\n  RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,\n  RedirectTargetIndexRoute: RedirectTargetIndexRoute,\n  RedirectTargetServerFnViaBeforeLoadRoute:\n    RedirectTargetServerFnViaBeforeLoadRoute,\n  RedirectTargetServerFnViaLoaderRoute: RedirectTargetServerFnViaLoaderRoute,\n  RedirectTargetServerFnViaUseServerFnRoute:\n    RedirectTargetServerFnViaUseServerFnRoute,\n  RedirectTargetServerFnIndexRoute: RedirectTargetServerFnIndexRoute,\n}\n\nconst RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(\n  RedirectTargetRouteChildren,\n)\n\ninterface FooBarQuxHereRouteChildren {\n  FooBarQuxHereIndexRoute: typeof FooBarQuxHereIndexRoute\n}\n\nconst FooBarQuxHereRouteChildren: FooBarQuxHereRouteChildren = {\n  FooBarQuxHereIndexRoute: FooBarQuxHereIndexRoute,\n}\n\nconst FooBarQuxHereRouteWithChildren = FooBarQuxHereRoute._addFileChildren(\n  FooBarQuxHereRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  NotFoundRouteRoute: NotFoundRouteRouteWithChildren,\n  SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,\n  SpecialCharsRouteRoute: SpecialCharsRouteRouteWithChildren,\n  LayoutRoute: LayoutRouteWithChildren,\n  AsyncScriptsRoute: AsyncScriptsRoute,\n  ClientOnlyRoute: ClientOnlyRoute,\n  DeferredRoute: DeferredRoute,\n  InlineScriptsRoute: InlineScriptsRoute,\n  LinksRoute: LinksRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RawStreamRoute: RawStreamRouteWithChildren,\n  ScriptsRoute: ScriptsRoute,\n  StreamRoute: StreamRoute,\n  TypeOnlyReexportRoute: TypeOnlyReexportRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  MultiCookieRedirectTargetRoute: MultiCookieRedirectTargetRoute,\n  RedirectTargetRoute: RedirectTargetRouteWithChildren,\n  MultiCookieRedirectIndexRoute: MultiCookieRedirectIndexRoute,\n  RedirectIndexRoute: RedirectIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  FooBarQuxHereRoute: FooBarQuxHereRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n    styles: [\n      {\n        media: 'all and (min-width: 500px)',\n        children: `\n        .inline-div {\n          color: white;\n          background-color: gray;\n          max-width: 250px;\n        }`,\n      },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nconst RouterDevtools =\n  process.env.NODE_ENV === 'production'\n    ? () => null // Render nothing in production\n    : React.lazy(() =>\n        // Lazy load in development\n        import('@tanstack/react-router-devtools').then((res) => ({\n          default: res.TanStackRouterDevtools,\n        })),\n      )\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n        <script src=\"/head-script.js\" />\n        <script src=\"/head-async-script.js\" async={true} />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/layout-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/scripts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Scripts\n          </Link>{' '}\n          <Link\n            to=\"/async-scripts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Async Scripts\n          </Link>{' '}\n          <Link\n            to=\"/inline-scripts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Inline Scripts\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            to=\"/redirect\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            redirect\n          </Link>{' '}\n          <Link\n            to=\"/not-found\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            not-found\n          </Link>{' '}\n          <Link\n            to=\"/client-only\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Client Only\n          </Link>{' '}\n          <Link\n            to=\"/raw-stream\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Raw Stream\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <div className=\"inline-div\">This is an inline styled div</div>\n        <React.Suspense fallback={null}>\n          <RouterDevtools position=\"bottom-right\" />\n        </React.Suspense>\n        <script src=\"/before-scripts-script.js\" />\n        <script src=\"/before-scripts-async-script.js\" async={true} />\n        <Scripts />\n        <script src=\"/user-script.js\" />\n        <script src=\"/async-user-script.js\" async={true} />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/api/users.$id.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport type { User } from '~/utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        console.info(`Fetching users by id=${params.id}... @`, request.url)\n        try {\n          const res = await axios.get<User>(`${queryURL}/users/` + params.id)\n\n          return Response.json({\n            id: res.data.id,\n            name: res.data.name,\n            email: res.data.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/api.users.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nimport type { User } from '~/utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await axios.get<Array<User>>(`${queryURL}/users`)\n\n        const list = res.data.slice(0, 10)\n\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/async-scripts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/async-scripts')({\n  head: () => ({\n    scripts: [\n      {\n        src: 'script.js',\n        async: true,\n      },\n      {\n        src: 'script2.js',\n        defer: true,\n      },\n    ],\n  }),\n  component: AsyncScriptsComponent,\n})\n\nfunction AsyncScriptsComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3 data-testid=\"async-scripts-test-heading\">Async Scripts Test</h3>\n      <p>This page tests scripts with async and defer attributes.</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/client-only.tsx",
    "content": "import { ClientOnly, createFileRoute } from '@tanstack/react-router'\nimport { WindowSize } from '~/components/WindowSize'\n\nexport const Route = createFileRoute('/client-only')({\n  component: ClientOnlyPage,\n})\n\nfunction ClientOnlyPage() {\n  return (\n    <div className=\"p-2\">\n      <h3 data-testid=\"client-only-heading\">Client Only Demo</h3>\n      <p>\n        The component below uses <code>window</code> APIs that only exist in the\n        browser.\n      </p>\n      <ClientOnly\n        fallback={\n          <div data-testid=\"loading-fallback\">Loading window size...</div>\n        }\n      >\n        <WindowSize />\n      </ClientOnly>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Suspense, useState } from 'react'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(({ data }) => {\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(async ({ data }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: { name: 'Tanner Linsley' } }),\n      person: await personServerFn({ data: { name: 'John Doe' } }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = useState(0)\n  const { deferredStuff, deferredPerson, person } = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {person.name} - {person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count}</div>\n      <div>\n        <button onClick={() => setCount(count + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/foo/$bar/$qux/_here/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/foo/$bar/$qux/_here/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>OK you got me</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/foo/$bar/$qux/_here.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/foo/$bar/$qux/_here')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a deeper layout with parameters</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { CustomMessage } from '~/components/CustomMessage'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <CustomMessage message=\"Hello from a custom component!\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/inline-scripts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/inline-scripts')({\n  head: () => ({\n    scripts: [\n      {\n        children:\n          'window.INLINE_SCRIPT_1 = true; console.log(\"Inline script 1 executed\");',\n      },\n      {\n        children:\n          'window.INLINE_SCRIPT_2 = \"test\"; console.log(\"Inline script 2 executed\");',\n        type: 'text/javascript',\n      },\n    ],\n  }),\n  component: InlineScriptsComponent,\n})\n\nfunction InlineScriptsComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3 data-testid=\"inline-scripts-test-heading\">Inline Scripts Test</h3>\n      <p>\n        This route tests inline script duplication prevention. Two inline\n        scripts should be loaded.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/links.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/links')({\n  component: () => {\n    const navigate = Route.useNavigate()\n    return (\n      <div>\n        <h1 className=\"mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl \">\n          link test\n        </h1>\n        <div className=\"mb-2\">\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Link to /posts\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            to=\"/posts\"\n            reloadDocument={true}\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Link to /posts (reloadDocument=true)\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <button onClick={() => navigate({ to: '/posts' })}>\n            navigate to /posts\n          </button>\n        </div>\n        <div className=\"mb-2\">\n          <button\n            onClick={() => navigate({ to: '/posts', reloadDocument: true })}\n          >\n            navigate to /posts (reloadDocument=true)\n          </button>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/multi-cookie-redirect/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { setCookie } from '@tanstack/react-start/server'\n\nconst setMultipleCookiesAndRedirect = createServerFn().handler(() => {\n  // Set multiple cookies before redirecting\n  // This tests that multiple Set-Cookie headers are preserved during redirect\n  setCookie('session', 'session-value', { path: '/' })\n  setCookie('csrf', 'csrf-token-value', { path: '/' })\n  setCookie('theme', 'dark', { path: '/' })\n\n  throw redirect({ to: '/multi-cookie-redirect/target' })\n})\n\nexport const Route = createFileRoute('/multi-cookie-redirect/')({\n  loader: () => setMultipleCookiesAndRedirect(),\n  component: () => null,\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/multi-cookie-redirect/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport Cookies from 'js-cookie'\nimport React, { useEffect } from 'react'\n\nexport const Route = createFileRoute('/multi-cookie-redirect/target')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [cookies, setCookies] = React.useState<Record<string, string>>({})\n\n  useEffect(() => {\n    setCookies({\n      session: Cookies.get('session') || '',\n      csrf: Cookies.get('csrf') || '',\n      theme: Cookies.get('theme') || '',\n    })\n  }, [])\n\n  return (\n    <div>\n      <h1 data-testid=\"multi-cookie-redirect-target\">\n        Multi Cookie Redirect Target\n      </h1>\n      <div>\n        <p>\n          Session cookie:{' '}\n          <span data-testid=\"cookie-session\">{cookies.session}</span>\n        </p>\n        <p>\n          CSRF cookie: <span data-testid=\"cookie-csrf\">{cookies.csrf}</span>\n        </p>\n        <p>\n          Theme cookie: <span data-testid=\"cookie-theme\">{cookies.theme}</span>\n        </p>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/deep/b/c/d.tsx",
    "content": "import { createFileRoute, notFound } from '@tanstack/react-router'\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/deep/b/c/d')({\n  loaderDeps: ({ search }) => ({\n    throwAt: search.throwAt,\n  }),\n  beforeLoad: ({ search }) => {\n    if (search.throwAt === 'd') {\n      throw notFound({\n        data: { source: 'd-beforeLoad' },\n      })\n    }\n  },\n  loader: ({ deps }) => {\n    if (deps.throwAt === 'c') {\n      throw new Error('d-loader-should-not-run-when-c-beforeLoad-throws')\n    }\n    return { ready: true }\n  },\n  component: RouteComponent,\n  notFoundComponent: (props: NotFoundRouteProps) => (\n    <div data-testid=\"deep-d-notFound-component\">\n      Not Found at /not-found/deep/b/c/d (\n      {(props.data as { source?: string })?.source ?? 'unknown'})\n    </div>\n  ),\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"deep-d-route-component\">\n      Hello \"/not-found/deep/b/c/d\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/deep/b/c/route.tsx",
    "content": "import { Outlet, createFileRoute, notFound } from '@tanstack/react-router'\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/deep/b/c')({\n  beforeLoad: ({ search }) => {\n    if (search.throwAt === 'c') {\n      throw notFound({\n        data: { source: 'c-beforeLoad' },\n      })\n    }\n  },\n  component: () => <Outlet />,\n  notFoundComponent: (props: NotFoundRouteProps) => (\n    <div data-testid=\"deep-c-notFound-component\">\n      Not Found at /not-found/deep/b/c (\n      {(props.data as { source?: string })?.source ?? 'unknown'})\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/deep/b/route.tsx",
    "content": "import { Outlet, createFileRoute, notFound } from '@tanstack/react-router'\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/deep/b')({\n  beforeLoad: ({ search }) => {\n    if (search.throwAt === 'b') {\n      throw notFound({\n        data: { source: 'b-beforeLoad' },\n      })\n    }\n  },\n  component: () => <Outlet />,\n  notFoundComponent: (props: NotFoundRouteProps) => (\n    <div data-testid=\"deep-b-notFound-component\">\n      Not Found at /not-found/deep/b (\n      {(props.data as { source?: string })?.source ?? 'unknown'})\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/deep/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/deep/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./b/c/d\"\n          search={{ throwAt: 'd' }}\n          data-testid=\"deep-throwAt-d\"\n        >\n          /not-found/deep/b/c/d?throwAt=d\n        </Link>\n      </div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./b/c/d\"\n          search={{ throwAt: 'c' }}\n          data-testid=\"deep-throwAt-c\"\n        >\n          /not-found/deep/b/c/d?throwAt=c\n        </Link>\n      </div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./b/c/d\"\n          search={{ throwAt: 'b' }}\n          data-testid=\"deep-throwAt-b\"\n        >\n          /not-found/deep/b/c/d?throwAt=b\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/deep/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/not-found/deep')({\n  validateSearch: z.object({\n    throwAt: z.enum(['b', 'c', 'd']).optional(),\n  }),\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/')({\n  component: () => {\n    const preload = Route.useSearch({ select: (s) => s.preload })\n    return (\n      <div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            preload={preload}\n            data-testid=\"via-beforeLoad\"\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            preload={preload}\n            data-testid=\"via-loader\"\n          >\n            via-loader\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad-target-root\"\n            preload={preload}\n            data-testid=\"via-beforeLoad-target-root\"\n          >\n            via-beforeLoad-target-root (shows global not-found)\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./parent-boundary\"\n            preload={preload}\n            data-testid=\"parent-boundary-index\"\n          >\n            parent-boundary test cases\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./deep\"\n            preload={preload}\n            data-testid=\"deep-index\"\n          >\n            deep test cases\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/parent-boundary/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/parent-boundary/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-beforeLoad\"\n          data-testid=\"parent-boundary-via-beforeLoad-with-routeId\"\n        >\n          via-beforeLoad (with routeId)\n        </Link>\n      </div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-beforeLoad\"\n          search={{ target: 'none' }}\n          data-testid=\"parent-boundary-via-beforeLoad-without-routeId\"\n        >\n          via-beforeLoad (without routeId)\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/parent-boundary/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/parent-boundary')({\n  loader: () => ({\n    parentLoaderData: 'ready',\n  }),\n  component: RouteComponent,\n  notFoundComponent: ParentBoundaryNotFoundComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <Outlet />\n    </div>\n  )\n}\n\nfunction ParentBoundaryNotFoundComponent(props: NotFoundRouteProps) {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div data-testid=\"parent-boundary-notFound-component\">\n      <div data-testid=\"parent-loader-data\">{loaderData.parentLoaderData}</div>\n      <div data-testid=\"parent-boundary-notFound-source\">\n        {(props.data as { source?: string })?.source ?? 'unknown'}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/parent-boundary/via-beforeLoad.tsx",
    "content": "import { createFileRoute, notFound } from '@tanstack/react-router'\nimport z from 'zod'\nimport { Route as ParentBoundaryRoute } from './route'\n\nexport const Route = createFileRoute(\n  '/not-found/parent-boundary/via-beforeLoad',\n)({\n  validateSearch: z.object({\n    target: z.enum(['parent', 'none']).optional(),\n  }),\n  beforeLoad: ({ search }) => {\n    if (search.target === 'none') {\n      throw notFound({\n        data: { source: 'without-routeId' },\n      })\n    }\n\n    throw notFound({\n      routeId: ParentBoundaryRoute.id,\n      data: { source: 'with-routeId' },\n    })\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"parent-boundary-child-route-component\">\n      Hello \"/not-found/parent-boundary/via-beforeLoad\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/not-found')({\n  validateSearch: z.object({\n    preload: z.literal(false).optional(),\n  }),\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/via-beforeLoad-target-root.tsx",
    "content": "import { createFileRoute, notFound, rootRouteId } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/via-beforeLoad-target-root')({\n  beforeLoad: () => {\n    throw notFound({ routeId: rootRouteId })\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-beforeLoad-target-root-route-component\">\n      Hello \"/not-found/via-beforeLoad-target-root\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/via-beforeLoad.tsx",
    "content": "import { createFileRoute, notFound } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/via-beforeLoad')({\n  beforeLoad: () => {\n    throw notFound()\n  },\n  component: RouteComponent,\n  notFoundComponent: () => {\n    return (\n      <div data-testid=\"via-beforeLoad-notFound-component\">\n        Not Found \"/not-found/via-beforeLoad\"!\n      </div>\n    )\n  },\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-beforeLoad-route-component\">\n      Hello \"/not-found/via-beforeLoad\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/not-found/via-loader.tsx",
    "content": "import { createFileRoute, notFound } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/not-found/via-loader')({\n  loader: () => {\n    throw notFound()\n  },\n  component: RouteComponent,\n  notFoundComponent: () => {\n    return (\n      <div data-testid=\"via-loader-notFound-component\">\n        Not Found \"/not-found/via-loader\"!\n      </div>\n    )\n  },\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-loader-route-component\" data-server={typeof window}>\n      Hello \"/not-found/via-loader\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport { fetchPost } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nimport { fetchPosts } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/posts_.$postId.deep.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { fetchPost } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostDeepErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/raw-stream/client-call.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport {\n  TEST10_EXPECTED,\n  TEST11_EXPECTED,\n  TEST12_STREAM_A_EXPECTED,\n  TEST12_STREAM_B_EXPECTED,\n  TEST13_EXPECTED,\n  TEST14_STREAM_A_EXPECTED,\n  TEST14_STREAM_B_EXPECTED,\n  TEST14_STREAM_C_EXPECTED,\n  TEST7_EXPECTED,\n  TEST8_EXPECTED,\n  TEST9_EXPECTED,\n  binaryHintBinaryFn,\n  binaryHintTextFn,\n  burstPauseBurstFn,\n  collectBytes,\n  compareBytes,\n  consumeBinaryStream,\n  createStreamConsumer,\n  emptyStreamFn,\n  errorStreamFn,\n  interleavedStreamsFn,\n  jsonEndsFirstFn,\n  largeBinaryFn,\n  mixedStreamingFn,\n  multipleRawStreamsFn,\n  rawEndsFirstFn,\n  singleRawStreamFn,\n  textHintMixedFn,\n  textHintPureBinaryFn,\n  textHintPureTextFn,\n  threeStreamsFn,\n} from '../../raw-stream-fns'\n\nexport const Route = createFileRoute('/raw-stream/client-call')({\n  component: ClientCallTests,\n})\n\nfunction ClientCallTests() {\n  const [results, setResults] = React.useState<Record<string, any>>({})\n  const [loading, setLoading] = React.useState<Record<string, boolean>>({})\n\n  const consumeStream = createStreamConsumer()\n\n  async function runTest(\n    testName: string,\n    fn: () => Promise<any>,\n    processor: (result: any) => Promise<any>,\n  ) {\n    setLoading((prev) => ({ ...prev, [testName]: true }))\n    try {\n      const result = await fn()\n      const processed = await processor(result)\n      setResults((prev) => ({ ...prev, [testName]: processed }))\n    } catch (error) {\n      setResults((prev) => ({\n        ...prev,\n        [testName]: { error: String(error) },\n      }))\n    } finally {\n      setLoading((prev) => ({ ...prev, [testName]: false }))\n    }\n  }\n\n  return (\n    <div className=\"space-y-4\">\n      <h2>Client-Side Server Function Calls (RPC)</h2>\n      <p className=\"text-gray-600\">\n        These tests invoke server functions directly from the client, using the\n        binary framing protocol for RawStream data.\n      </p>\n\n      {/* Test 1: Single Raw Stream */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test1-title\">Test 1: Single Raw Stream</h3>\n        <button\n          data-testid=\"test1-btn\"\n          onClick={() =>\n            runTest('test1', singleRawStreamFn, async (result) => ({\n              message: result.message,\n              streamContent: await consumeStream(result.data),\n            }))\n          }\n          disabled={loading.test1}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test1 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test1 ? '' : 'hidden'}\n          data-testid=\"test1-result\"\n        >\n          {JSON.stringify(results.test1)}\n        </pre>\n      </div>\n\n      {/* Test 2: Multiple Raw Streams */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test2-title\">Test 2: Multiple Raw Streams</h3>\n        <button\n          data-testid=\"test2-btn\"\n          onClick={() =>\n            runTest('test2', multipleRawStreamsFn, async (result) => ({\n              message: result.message,\n              firstContent: await consumeStream(result.first),\n              secondContent: await consumeStream(result.second),\n            }))\n          }\n          disabled={loading.test2}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test2 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test2 ? '' : 'hidden'}\n          data-testid=\"test2-result\"\n        >\n          {JSON.stringify(results.test2)}\n        </pre>\n      </div>\n\n      {/* Test 3: JSON Ends First */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test3-title\">Test 3: JSON Ends Before Raw Stream</h3>\n        <button\n          data-testid=\"test3-btn\"\n          onClick={() =>\n            runTest('test3', jsonEndsFirstFn, async (result) => ({\n              message: result.message,\n              hasTimestamp: typeof result.timestamp === 'number',\n              slowContent: await consumeStream(result.slowData),\n            }))\n          }\n          disabled={loading.test3}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test3 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test3 ? '' : 'hidden'}\n          data-testid=\"test3-result\"\n        >\n          {JSON.stringify(results.test3)}\n        </pre>\n      </div>\n\n      {/* Test 4: Raw Ends First */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test4-title\">Test 4: Raw Stream Ends Before JSON</h3>\n        <button\n          data-testid=\"test4-btn\"\n          onClick={() =>\n            runTest('test4', rawEndsFirstFn, async (result) => ({\n              message: result.message,\n              deferredData: await result.deferredData,\n              fastContent: await consumeStream(result.fastData),\n            }))\n          }\n          disabled={loading.test4}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test4 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test4 ? '' : 'hidden'}\n          data-testid=\"test4-result\"\n        >\n          {JSON.stringify(results.test4)}\n        </pre>\n      </div>\n\n      {/* Test 5: Large Binary */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test5-title\">Test 5: Large Binary Data</h3>\n        <button\n          data-testid=\"test5-btn\"\n          onClick={() =>\n            runTest('test5', largeBinaryFn, async (result) => {\n              const totalBytes = await consumeBinaryStream(result.binary)\n              return {\n                message: result.message,\n                expectedSize: result.size,\n                actualSize: totalBytes,\n                sizeMatch: totalBytes === result.size,\n              }\n            })\n          }\n          disabled={loading.test5}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test5 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test5 ? '' : 'hidden'}\n          data-testid=\"test5-result\"\n        >\n          {JSON.stringify(results.test5)}\n        </pre>\n      </div>\n\n      {/* Test 6: Mixed Streaming */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test6-title\">Test 6: Mixed Streaming</h3>\n        <button\n          data-testid=\"test6-btn\"\n          onClick={() =>\n            runTest('test6', mixedStreamingFn, async (result) => ({\n              immediate: result.immediate,\n              deferred: await result.deferred,\n              rawContent: await consumeStream(result.raw),\n            }))\n          }\n          disabled={loading.test6}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test6 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test6 ? '' : 'hidden'}\n          data-testid=\"test6-result\"\n        >\n          {JSON.stringify(results.test6)}\n        </pre>\n      </div>\n\n      {/* Hint Tests Section */}\n      <h2 className=\"mt-8\">Hint Parameter Tests (RPC)</h2>\n      <p className=\"text-gray-600\">\n        These tests verify that hint parameter works correctly for RPC calls.\n        Note: RPC always uses binary framing regardless of hint.\n      </p>\n\n      {/* Test 7: Text Hint with Pure Text */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test7-title\">Test 7: Text Hint - Pure Text</h3>\n        <button\n          data-testid=\"test7-btn\"\n          onClick={() =>\n            runTest('test7', textHintPureTextFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST7_EXPECTED)\n              const decoder = new TextDecoder()\n              return {\n                message: result.message,\n                asText: decoder.decode(bytes),\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading.test7}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test7 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test7 ? '' : 'hidden'}\n          data-testid=\"test7-result\"\n        >\n          {JSON.stringify(results.test7)}\n        </pre>\n      </div>\n\n      {/* Test 8: Text Hint with Pure Binary */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test8-title\">Test 8: Text Hint - Pure Binary</h3>\n        <button\n          data-testid=\"test8-btn\"\n          onClick={() =>\n            runTest('test8', textHintPureBinaryFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST8_EXPECTED)\n              return {\n                message: result.message,\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading.test8}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test8 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test8 ? '' : 'hidden'}\n          data-testid=\"test8-result\"\n        >\n          {JSON.stringify(results.test8)}\n        </pre>\n      </div>\n\n      {/* Test 9: Text Hint with Mixed Content */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test9-title\">Test 9: Text Hint - Mixed Content</h3>\n        <button\n          data-testid=\"test9-btn\"\n          onClick={() =>\n            runTest('test9', textHintMixedFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST9_EXPECTED)\n              return {\n                message: result.message,\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading.test9}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test9 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test9 ? '' : 'hidden'}\n          data-testid=\"test9-result\"\n        >\n          {JSON.stringify(results.test9)}\n        </pre>\n      </div>\n\n      {/* Test 10: Binary Hint with Text Data */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test10-title\">Test 10: Binary Hint - Text Data</h3>\n        <button\n          data-testid=\"test10-btn\"\n          onClick={() =>\n            runTest('test10', binaryHintTextFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST10_EXPECTED)\n              const decoder = new TextDecoder()\n              return {\n                message: result.message,\n                asText: decoder.decode(bytes),\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading.test10}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test10 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test10 ? '' : 'hidden'}\n          data-testid=\"test10-result\"\n        >\n          {JSON.stringify(results.test10)}\n        </pre>\n      </div>\n\n      {/* Test 11: Binary Hint with Binary Data */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test11-title\">Test 11: Binary Hint - Binary Data</h3>\n        <button\n          data-testid=\"test11-btn\"\n          onClick={() =>\n            runTest('test11', binaryHintBinaryFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST11_EXPECTED)\n              return {\n                message: result.message,\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading.test11}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test11 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test11 ? '' : 'hidden'}\n          data-testid=\"test11-result\"\n        >\n          {JSON.stringify(results.test11)}\n        </pre>\n      </div>\n\n      {/* Multiplexing Tests Section */}\n      <h2 className=\"mt-8\">Multiplexing Tests (RPC)</h2>\n      <p className=\"text-gray-600\">\n        These tests verify correct interleaving of multiple concurrent streams.\n      </p>\n\n      {/* Test 12: Interleaved Streams */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test12-title\">Test 12: Interleaved Streams</h3>\n        <button\n          data-testid=\"test12-btn\"\n          onClick={() =>\n            runTest('test12', interleavedStreamsFn, async (result) => {\n              const [bytesA, bytesB] = await Promise.all([\n                collectBytes(result.streamA),\n                collectBytes(result.streamB),\n              ])\n              const comparisonA = compareBytes(bytesA, TEST12_STREAM_A_EXPECTED)\n              const comparisonB = compareBytes(bytesB, TEST12_STREAM_B_EXPECTED)\n              return {\n                message: result.message,\n                streamA: comparisonA,\n                streamB: comparisonB,\n              }\n            })\n          }\n          disabled={loading.test12}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test12 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test12 ? '' : 'hidden'}\n          data-testid=\"test12-result\"\n        >\n          {JSON.stringify(results.test12)}\n        </pre>\n      </div>\n\n      {/* Test 13: Burst-Pause-Burst */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test13-title\">Test 13: Burst-Pause-Burst</h3>\n        <button\n          data-testid=\"test13-btn\"\n          onClick={() =>\n            runTest('test13', burstPauseBurstFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST13_EXPECTED)\n              return {\n                message: result.message,\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading.test13}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test13 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test13 ? '' : 'hidden'}\n          data-testid=\"test13-result\"\n        >\n          {JSON.stringify(results.test13)}\n        </pre>\n      </div>\n\n      {/* Test 14: Three Concurrent Streams */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test14-title\">Test 14: Three Concurrent Streams</h3>\n        <button\n          data-testid=\"test14-btn\"\n          onClick={() =>\n            runTest('test14', threeStreamsFn, async (result) => {\n              const [bytesA, bytesB, bytesC] = await Promise.all([\n                collectBytes(result.fast),\n                collectBytes(result.slow),\n                collectBytes(result.burst),\n              ])\n              const comparisonA = compareBytes(bytesA, TEST14_STREAM_A_EXPECTED)\n              const comparisonB = compareBytes(bytesB, TEST14_STREAM_B_EXPECTED)\n              const comparisonC = compareBytes(bytesC, TEST14_STREAM_C_EXPECTED)\n              return {\n                message: result.message,\n                fast: comparisonA,\n                slow: comparisonB,\n                burst: comparisonC,\n              }\n            })\n          }\n          disabled={loading.test14}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test14 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test14 ? '' : 'hidden'}\n          data-testid=\"test14-result\"\n        >\n          {JSON.stringify(results.test14)}\n        </pre>\n      </div>\n\n      {/* Edge Case Tests Section */}\n      <h2 className=\"mt-8\">Edge Case Tests (RPC)</h2>\n      <p className=\"text-gray-600\">\n        These tests verify edge cases like empty streams and error handling.\n      </p>\n\n      {/* Test 15: Empty Stream */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test15-title\">Test 15: Empty Stream</h3>\n        <button\n          data-testid=\"test15-btn\"\n          onClick={() =>\n            runTest('test15', emptyStreamFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              return {\n                message: result.message,\n                byteCount: bytes.length,\n                isEmpty: bytes.length === 0,\n              }\n            })\n          }\n          disabled={loading.test15}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test15 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test15 ? '' : 'hidden'}\n          data-testid=\"test15-result\"\n        >\n          {JSON.stringify(results.test15)}\n        </pre>\n      </div>\n\n      {/* Test 16: Stream Error */}\n      <div className=\"border p-4 rounded\">\n        <h3 data-testid=\"test16-title\">Test 16: Stream Error</h3>\n        <button\n          data-testid=\"test16-btn\"\n          onClick={() =>\n            runTest('test16', errorStreamFn, async (result) => {\n              try {\n                // Try to consume the stream - should error\n                const content = await consumeStream(result.data)\n                return {\n                  message: result.message,\n                  streamContent: content,\n                  errorCaught: false,\n                }\n              } catch (err) {\n                return {\n                  message: result.message,\n                  errorCaught: true,\n                  errorMessage: String(err),\n                }\n              }\n            })\n          }\n          disabled={loading.test16}\n          className=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading.test16 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre\n          className={results.test16 ? '' : 'hidden'}\n          data-testid=\"test16-result\"\n        >\n          {JSON.stringify(results.test16)}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/raw-stream/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/raw-stream/')({\n  component: RawStreamIndex,\n})\n\nfunction RawStreamIndex() {\n  return (\n    <div>\n      <p>Select a test category above to begin testing.</p>\n      <ul className=\"list-disc pl-6 mt-4 space-y-2\">\n        <li>\n          <Link\n            to=\"/raw-stream/client-call\"\n            className=\"text-blue-500 underline\"\n          >\n            Client Calls\n          </Link>{' '}\n          - Test RawStream via direct server function calls (RPC)\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-single\"\n            className=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Single\n          </Link>{' '}\n          - Test single RawStream from route loader (SSR)\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-multiple\"\n            className=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Multiple\n          </Link>{' '}\n          - Test multiple RawStreams from route loader (SSR)\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-mixed\"\n            className=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Mixed\n          </Link>{' '}\n          - Test RawStream mixed with deferred data from loader (SSR)\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-text-hint\"\n            className=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Text Hint\n          </Link>{' '}\n          - Test RawStream with hint: 'text' from loader (SSR)\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-binary-hint\"\n            className=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Binary Hint\n          </Link>{' '}\n          - Test RawStream with hint: 'binary' from loader (SSR)\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/raw-stream/ssr-binary-hint.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { RawStream } from '@tanstack/react-start'\nimport {\n  encode,\n  createDelayedStream,\n  concatBytes,\n  collectBytes,\n  compareBytes,\n} from '../../raw-stream-fns'\n\n// Expected data - defined at module level for client-side verification\nconst TEXT_CHUNKS = [encode('Binary '), encode('hint '), encode('with text')]\nconst TEXT_EXPECTED = concatBytes(TEXT_CHUNKS)\n\nconst BINARY_CHUNKS = [\n  new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n  new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]),\n]\nconst BINARY_EXPECTED = concatBytes(BINARY_CHUNKS)\n\nexport const Route = createFileRoute('/raw-stream/ssr-binary-hint')({\n  loader: async () => {\n    // Text data with binary hint - should still use base64 (default behavior)\n    const textStream = createDelayedStream(\n      [encode('Binary '), encode('hint '), encode('with text')],\n      30,\n    )\n\n    // Pure binary stream with binary hint\n    const binaryStream = createDelayedStream(\n      [\n        new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n        new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]),\n      ],\n      30,\n    )\n\n    return {\n      message: 'SSR Binary Hint Test',\n      textData: new RawStream(textStream, { hint: 'binary' }),\n      binaryData: new RawStream(binaryStream, { hint: 'binary' }),\n    }\n  },\n  component: SSRBinaryHintTest,\n})\n\nfunction SSRBinaryHintTest() {\n  const { message, textData, binaryData } = Route.useLoaderData()\n  const [textMatch, setTextMatch] = React.useState<{\n    match: boolean\n    mismatchIndex: number | null\n    actualLength: number\n    expectedLength: number\n    asText: string\n  } | null>(null)\n  const [binaryMatch, setBinaryMatch] = React.useState<{\n    match: boolean\n    mismatchIndex: number | null\n    actualLength: number\n    expectedLength: number\n  } | null>(null)\n  const [isLoading, setIsLoading] = React.useState(true)\n  const [error, setError] = React.useState<string | null>(null)\n\n  React.useEffect(() => {\n    Promise.all([collectBytes(textData), collectBytes(binaryData)])\n      .then(([textBytes, binaryBytes]) => {\n        const textComp = compareBytes(textBytes, TEXT_EXPECTED)\n        const decoder = new TextDecoder()\n        setTextMatch({\n          ...textComp,\n          actualLength: textBytes.length,\n          expectedLength: TEXT_EXPECTED.length,\n          asText: decoder.decode(textBytes),\n        })\n        const binaryComp = compareBytes(binaryBytes, BINARY_EXPECTED)\n        setBinaryMatch({\n          ...binaryComp,\n          actualLength: binaryBytes.length,\n          expectedLength: BINARY_EXPECTED.length,\n        })\n        setIsLoading(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsLoading(false)\n      })\n  }, [textData, binaryData])\n\n  return (\n    <div className=\"space-y-4\">\n      <h2>SSR Binary Hint Test</h2>\n      <p className=\"text-gray-600\">\n        This route tests RawStream with hint: 'binary' from loader. Binary hint\n        always uses base64 encoding (default behavior).\n      </p>\n\n      <div className=\"border p-4 rounded\">\n        <div data-testid=\"ssr-binary-hint-message\">Message: {message}</div>\n        <div data-testid=\"ssr-binary-hint-text\">\n          Text Data:{' '}\n          {error\n            ? `Error: ${error}`\n            : isLoading\n              ? 'Loading...'\n              : textMatch?.asText}\n        </div>\n        <div data-testid=\"ssr-binary-hint-text-match\">\n          Text Bytes Match:{' '}\n          {isLoading ? 'Loading...' : textMatch?.match ? 'true' : 'false'}\n        </div>\n        <div data-testid=\"ssr-binary-hint-binary-match\">\n          Binary Bytes Match:{' '}\n          {isLoading ? 'Loading...' : binaryMatch?.match ? 'true' : 'false'}\n        </div>\n        <pre data-testid=\"ssr-binary-hint-result\">\n          {JSON.stringify({\n            message,\n            textMatch,\n            binaryMatch,\n            isLoading,\n            error,\n          })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/raw-stream/ssr-mixed.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { RawStream } from '@tanstack/react-start'\nimport {\n  createDelayedStream,\n  createStreamConsumer,\n  encode,\n} from '../../raw-stream-fns'\n\nexport const Route = createFileRoute('/raw-stream/ssr-mixed')({\n  loader: () => {\n    const rawStream = createDelayedStream(\n      [encode('mixed-ssr-1'), encode('mixed-ssr-2')],\n      50,\n    )\n\n    // Deferred promise that resolves after a delay\n    const deferredData = new Promise<string>((resolve) =>\n      setTimeout(() => resolve('deferred-ssr-value'), 100),\n    )\n\n    return {\n      immediate: 'immediate-ssr-value',\n      deferred: deferredData,\n      rawData: new RawStream(rawStream),\n    }\n  },\n  component: SSRMixedTest,\n})\n\nfunction SSRMixedTest() {\n  const { immediate, deferred, rawData } = Route.useLoaderData()\n  const [streamContent, setStreamContent] = React.useState<string>('')\n  const [isConsuming, setIsConsuming] = React.useState(true)\n  const [error, setError] = React.useState<string | null>(null)\n\n  React.useEffect(() => {\n    const consumeStream = createStreamConsumer()\n    consumeStream(rawData)\n      .then((content) => {\n        setStreamContent(content)\n        setIsConsuming(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsConsuming(false)\n      })\n  }, [rawData])\n\n  return (\n    <div className=\"space-y-4\">\n      <h2>SSR Mixed Streaming Test</h2>\n      <p className=\"text-gray-600\">\n        This route returns a mix of immediate data, deferred promises, and\n        RawStream from its loader.\n      </p>\n\n      <div className=\"border p-4 rounded\">\n        <div data-testid=\"ssr-mixed-immediate\">Immediate: {immediate}</div>\n        <div data-testid=\"ssr-mixed-deferred\">\n          Deferred:{' '}\n          <React.Suspense fallback=\"Loading deferred...\">\n            <Await promise={deferred}>{(value) => <span>{value}</span>}</Await>\n          </React.Suspense>\n        </div>\n        <div data-testid=\"ssr-mixed-stream\">\n          Stream Content:{' '}\n          {error\n            ? `Error: ${error}`\n            : isConsuming\n              ? 'Loading...'\n              : streamContent}\n        </div>\n        <pre data-testid=\"ssr-mixed-result\">\n          {JSON.stringify({ immediate, streamContent, isConsuming, error })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/raw-stream/ssr-multiple.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { RawStream } from '@tanstack/react-start'\nimport {\n  encode,\n  createDelayedStream,\n  createStreamConsumer,\n} from '../../raw-stream-fns'\n\nexport const Route = createFileRoute('/raw-stream/ssr-multiple')({\n  loader: async () => {\n    const stream1 = createDelayedStream(\n      [encode('multi-1a'), encode('multi-1b')],\n      30,\n    )\n    const stream2 = createDelayedStream(\n      [encode('multi-2a'), encode('multi-2b')],\n      50,\n    )\n    return {\n      message: 'SSR Multiple Streams Test',\n      first: new RawStream(stream1),\n      second: new RawStream(stream2),\n    }\n  },\n  component: SSRMultipleTest,\n})\n\nfunction SSRMultipleTest() {\n  const { message, first, second } = Route.useLoaderData()\n  const [firstContent, setFirstContent] = React.useState<string>('')\n  const [secondContent, setSecondContent] = React.useState<string>('')\n  const [isConsuming, setIsConsuming] = React.useState(true)\n  const [error, setError] = React.useState<string | null>(null)\n\n  React.useEffect(() => {\n    const consumeStream = createStreamConsumer()\n    Promise.all([consumeStream(first), consumeStream(second)])\n      .then(([content1, content2]) => {\n        setFirstContent(content1)\n        setSecondContent(content2)\n        setIsConsuming(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsConsuming(false)\n      })\n  }, [first, second])\n\n  return (\n    <div className=\"space-y-4\">\n      <h2>SSR Multiple RawStreams Test</h2>\n      <p className=\"text-gray-600\">\n        This route returns multiple RawStreams from its loader. Each stream is\n        independently serialized during SSR.\n      </p>\n\n      <div className=\"border p-4 rounded\">\n        <div data-testid=\"ssr-multiple-message\">Message: {message}</div>\n        <div data-testid=\"ssr-multiple-first\">\n          First Stream:{' '}\n          {error\n            ? `Error: ${error}`\n            : isConsuming\n              ? 'Loading...'\n              : firstContent}\n        </div>\n        <div data-testid=\"ssr-multiple-second\">\n          Second Stream:{' '}\n          {error\n            ? `Error: ${error}`\n            : isConsuming\n              ? 'Loading...'\n              : secondContent}\n        </div>\n        <pre data-testid=\"ssr-multiple-result\">\n          {JSON.stringify({\n            message,\n            firstContent,\n            secondContent,\n            isConsuming,\n            error,\n          })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/raw-stream/ssr-single.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { RawStream } from '@tanstack/react-start'\nimport {\n  encode,\n  createDelayedStream,\n  createStreamConsumer,\n} from '../../raw-stream-fns'\n\nexport const Route = createFileRoute('/raw-stream/ssr-single')({\n  loader: async () => {\n    const stream = createDelayedStream(\n      [encode('ssr-chunk1'), encode('ssr-chunk2'), encode('ssr-chunk3')],\n      50,\n    )\n    return {\n      message: 'SSR Single Stream Test',\n      timestamp: Date.now(),\n      rawData: new RawStream(stream),\n    }\n  },\n  component: SSRSingleTest,\n})\n\nfunction SSRSingleTest() {\n  const { message, timestamp, rawData } = Route.useLoaderData()\n  const [streamContent, setStreamContent] = React.useState<string>('')\n  const [isConsuming, setIsConsuming] = React.useState(true)\n  const [error, setError] = React.useState<string | null>(null)\n\n  React.useEffect(() => {\n    const consumeStream = createStreamConsumer()\n    consumeStream(rawData)\n      .then((content) => {\n        setStreamContent(content)\n        setIsConsuming(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsConsuming(false)\n      })\n  }, [rawData])\n\n  return (\n    <div className=\"space-y-4\">\n      <h2>SSR Single RawStream Test</h2>\n      <p className=\"text-gray-600\">\n        This route returns a single RawStream from its loader. The stream is\n        serialized during SSR using base64 encoding.\n      </p>\n\n      <div className=\"border p-4 rounded\">\n        <div data-testid=\"ssr-single-message\">Message: {message}</div>\n        <div data-testid=\"ssr-single-timestamp\">\n          Has Timestamp: {typeof timestamp === 'number' ? 'true' : 'false'}\n        </div>\n        <div data-testid=\"ssr-single-stream\">\n          Stream Content:{' '}\n          {error\n            ? `Error: ${error}`\n            : isConsuming\n              ? 'Loading...'\n              : streamContent}\n        </div>\n        <div data-testid=\"ssr-single-rawdata-type\">\n          RawData Type: {typeof rawData} | hasStream:{' '}\n          {rawData && 'getReader' in rawData ? 'true' : 'false'}\n        </div>\n        <pre data-testid=\"ssr-single-result\">\n          {JSON.stringify({ message, streamContent, isConsuming, error })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/raw-stream/ssr-text-hint.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { RawStream } from '@tanstack/react-start'\nimport {\n  encode,\n  createDelayedStream,\n  concatBytes,\n  collectBytes,\n  compareBytes,\n} from '../../raw-stream-fns'\n\n// Expected data - defined at module level for client-side verification\nconst PURE_TEXT_CHUNKS = [\n  encode('Hello '),\n  encode('World '),\n  encode('from SSR!'),\n]\nconst PURE_TEXT_EXPECTED = concatBytes(PURE_TEXT_CHUNKS)\n\nconst MIXED_CHUNKS = [\n  encode('Valid text'),\n  new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n  encode(' more text'),\n]\nconst MIXED_EXPECTED = concatBytes(MIXED_CHUNKS)\n\n// Pure binary data (invalid UTF-8) - must use base64 fallback\nconst PURE_BINARY_CHUNKS = [\n  new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n  new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n]\nconst PURE_BINARY_EXPECTED = concatBytes(PURE_BINARY_CHUNKS)\n\nexport const Route = createFileRoute('/raw-stream/ssr-text-hint')({\n  loader: async () => {\n    // Pure text stream - should use UTF-8 encoding with text hint\n    const textStream = createDelayedStream(\n      [encode('Hello '), encode('World '), encode('from SSR!')],\n      30,\n    )\n\n    // Mixed content stream - text hint should use UTF-8 for valid text, base64 for binary\n    const mixedStream = createDelayedStream(\n      [\n        encode('Valid text'),\n        new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n        encode(' more text'),\n      ],\n      30,\n    )\n\n    // Pure binary stream - text hint must fallback to base64 for all chunks\n    const pureBinaryStream = createDelayedStream(\n      [\n        new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n        new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n      ],\n      30,\n    )\n\n    return {\n      message: 'SSR Text Hint Test',\n      pureText: new RawStream(textStream, { hint: 'text' }),\n      mixedContent: new RawStream(mixedStream, { hint: 'text' }),\n      pureBinary: new RawStream(pureBinaryStream, { hint: 'text' }),\n    }\n  },\n  component: SSRTextHintTest,\n})\n\nfunction SSRTextHintTest() {\n  const { message, pureText, mixedContent, pureBinary } = Route.useLoaderData()\n  const [pureTextMatch, setPureTextMatch] = React.useState<{\n    match: boolean\n    mismatchIndex: number | null\n    actualLength: number\n    expectedLength: number\n    asText: string\n  } | null>(null)\n  const [mixedMatch, setMixedMatch] = React.useState<{\n    match: boolean\n    mismatchIndex: number | null\n    actualLength: number\n    expectedLength: number\n  } | null>(null)\n  const [pureBinaryMatch, setPureBinaryMatch] = React.useState<{\n    match: boolean\n    mismatchIndex: number | null\n    actualLength: number\n    expectedLength: number\n  } | null>(null)\n  const [isLoading, setIsLoading] = React.useState(true)\n  const [error, setError] = React.useState<string | null>(null)\n\n  React.useEffect(() => {\n    Promise.all([\n      collectBytes(pureText),\n      collectBytes(mixedContent),\n      collectBytes(pureBinary),\n    ])\n      .then(([pureBytes, mixedBytes, pureBinaryBytes]) => {\n        const pureComp = compareBytes(pureBytes, PURE_TEXT_EXPECTED)\n        const decoder = new TextDecoder()\n        setPureTextMatch({\n          ...pureComp,\n          actualLength: pureBytes.length,\n          expectedLength: PURE_TEXT_EXPECTED.length,\n          asText: decoder.decode(pureBytes),\n        })\n        const mixedComp = compareBytes(mixedBytes, MIXED_EXPECTED)\n        setMixedMatch({\n          ...mixedComp,\n          actualLength: mixedBytes.length,\n          expectedLength: MIXED_EXPECTED.length,\n        })\n        const pureBinaryComp = compareBytes(\n          pureBinaryBytes,\n          PURE_BINARY_EXPECTED,\n        )\n        setPureBinaryMatch({\n          ...pureBinaryComp,\n          actualLength: pureBinaryBytes.length,\n          expectedLength: PURE_BINARY_EXPECTED.length,\n        })\n        setIsLoading(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsLoading(false)\n      })\n  }, [pureText, mixedContent, pureBinary])\n\n  return (\n    <div className=\"space-y-4\">\n      <h2>SSR Text Hint Test</h2>\n      <p className=\"text-gray-600\">\n        This route tests RawStream with hint: 'text' from loader. Text hint\n        optimizes for UTF-8 content but falls back to base64 for invalid UTF-8.\n      </p>\n\n      <div className=\"border p-4 rounded\">\n        <div data-testid=\"ssr-text-hint-message\">Message: {message}</div>\n        <div data-testid=\"ssr-text-hint-pure-text\">\n          Pure Text:{' '}\n          {error\n            ? `Error: ${error}`\n            : isLoading\n              ? 'Loading...'\n              : pureTextMatch?.asText}\n        </div>\n        <div data-testid=\"ssr-text-hint-pure-match\">\n          Pure Text Bytes Match:{' '}\n          {isLoading ? 'Loading...' : pureTextMatch?.match ? 'true' : 'false'}\n        </div>\n        <div data-testid=\"ssr-text-hint-mixed-match\">\n          Mixed Content Bytes Match:{' '}\n          {isLoading ? 'Loading...' : mixedMatch?.match ? 'true' : 'false'}\n        </div>\n        <div data-testid=\"ssr-text-hint-pure-binary-match\">\n          Pure Binary Bytes Match:{' '}\n          {isLoading ? 'Loading...' : pureBinaryMatch?.match ? 'true' : 'false'}\n        </div>\n        <pre data-testid=\"ssr-text-hint-result\">\n          {JSON.stringify({\n            message,\n            pureTextMatch,\n            mixedMatch,\n            pureBinaryMatch,\n            isLoading,\n            error,\n          })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/raw-stream.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/raw-stream')({\n  component: RawStreamLayout,\n})\n\nfunction RawStreamLayout() {\n  return (\n    <div className=\"p-4 space-y-4\">\n      <h1>Raw Stream Tests</h1>\n\n      <nav className=\"space-x-4\">\n        <Link\n          to=\"/raw-stream/client-call\"\n          className=\"text-blue-500 underline\"\n          activeProps={{ className: 'font-bold' }}\n        >\n          Client Calls\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-single\"\n          className=\"text-blue-500 underline\"\n          activeProps={{ className: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Single\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-multiple\"\n          className=\"text-blue-500 underline\"\n          activeProps={{ className: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Multiple\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-mixed\"\n          className=\"text-blue-500 underline\"\n          activeProps={{ className: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Mixed\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-text-hint\"\n          className=\"text-blue-500 underline\"\n          activeProps={{ className: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Text Hint\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-binary-hint\"\n          className=\"text-blue-500 underline\"\n          activeProps={{ className: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Binary Hint\n        </Link>\n        <Link to=\"/\" className=\"text-gray-500 underline\">\n          Back to Home\n        </Link>\n      </nav>\n\n      <hr />\n\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/$target/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/$target/')({\n  component: () => {\n    const preload = Route.useSearch({ select: (s) => s.preload })\n    return (\n      <div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid=\"via-beforeLoad\"\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            search={{ reloadDocument: true }}\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid=\"via-beforeLoad-reloadDocument\"\n          >\n            via-beforeLoad (reloadDocument=true)\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            preload={preload}\n            data-testid=\"via-loader\"\n          >\n            via-loader\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            search={{ reloadDocument: true }}\n            preload={preload}\n            data-testid=\"via-loader-reloadDocument\"\n          >\n            via-loader (reloadDocument=true)\n          </Link>\n        </div>\n        <div className=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./serverFn\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            serverFn\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/$target/serverFn/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/$target/serverFn/')({\n  component: () => (\n    <div>\n      <h1 className=\"mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl \">\n        redirect test with server functions (target {Route.useParams().target})\n      </h1>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-beforeLoad\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          data-testid=\"via-beforeLoad\"\n        >\n          via-beforeLoad\n        </Link>\n      </div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-beforeLoad\"\n          search={{ reloadDocument: true }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n          data-testid=\"via-beforeLoad-reloadDocument\"\n        >\n          via-beforeLoad (reloadDocument=true)\n        </Link>\n      </div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-loader\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          data-testid=\"via-loader\"\n        >\n          via-loader\n        </Link>\n      </div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-loader\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          search={{ reloadDocument: true }}\n          data-testid=\"via-loader-reloadDocument\"\n        >\n          via-loader (reloadDocument=true)\n        </Link>\n      </div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-useServerFn\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          data-testid=\"via-useServerFn\"\n        >\n          via-useServerFn\n        </Link>\n      </div>\n      <div className=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-useServerFn\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          search={{ reloadDocument: true }}\n          data-testid=\"via-useServerFn-reloadDocument\"\n        >\n          via-useServerFn (reloadDocument=true)\n        </Link>\n      </div>\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { throwRedirect } from '~/components/throwRedirect'\n\nexport const Route = createFileRoute(\n  '/redirect/$target/serverFn/via-beforeLoad',\n)({\n  beforeLoad: ({\n    params: { target },\n    search: { reloadDocument, externalHost },\n  }) => throwRedirect({ data: { target, reloadDocument, externalHost } }),\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { throwRedirect } from '~/components/throwRedirect'\n\nexport const Route = createFileRoute('/redirect/$target/serverFn/via-loader')({\n  loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({\n    reloadDocument,\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { reloadDocument, externalHost } }) =>\n    throwRedirect({ data: { target, reloadDocument, externalHost } }),\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { RedirectOnClick } from '~/components/RedirectOnClick'\n\nexport const Route = createFileRoute(\n  '/redirect/$target/serverFn/via-useServerFn',\n)({\n  component: () => {\n    const { target } = Route.useParams()\n    const { reloadDocument, externalHost } = Route.useSearch()\n    return (\n      <RedirectOnClick\n        target={target}\n        reloadDocument={reloadDocument}\n        externalHost={externalHost}\n      />\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-beforeLoad')({\n  beforeLoad: ({\n    params: { target },\n    search: { reloadDocument, externalHost },\n  }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        throw redirect({ href: externalHost })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/$target/via-loader.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-loader')({\n  loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({\n    reloadDocument,\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { externalHost, reloadDocument } }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        throw redirect({ href: externalHost })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/$target.tsx",
    "content": "import { createFileRoute, retainSearchParams } from '@tanstack/react-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/redirect/$target')({\n  params: {\n    parse: (p) =>\n      z\n        .object({\n          target: z.union([z.literal('internal'), z.literal('external')]),\n        })\n        .parse(p),\n  },\n  validateSearch: z.object({\n    reloadDocument: z.boolean().optional(),\n    preload: z.literal(false).optional(),\n    externalHost: z.string().optional(),\n  }),\n  search: {\n    middlewares: [retainSearchParams(['externalHost'])],\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/redirect/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/')({\n  component: () => (\n    <div>\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'internal' }}\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        internal\n      </Link>{' '}\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'external' }}\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        external\n      </Link>\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/scripts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst isProd = import.meta.env.PROD\n\nexport const Route = createFileRoute('/scripts')({\n  head: () => ({\n    scripts: [\n      {\n        src: 'script.js',\n      },\n      isProd\n        ? undefined\n        : {\n            src: 'script2.js',\n          },\n    ],\n  }),\n  component: ScriptsComponent,\n})\n\nfunction ScriptsComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3 data-testid=\"scripts-test-heading\">Scripts Test</h3>\n      <p>\n        Both `script.js` and `script2.js` are included in development, but only\n        `script.js` is included in production.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/search-params/default.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/search-params/default')({\n  validateSearch: z.object({\n    default: z.string().default('d1'),\n  }),\n  beforeLoad: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  loader: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const context = Route.useRouteContext()\n    return (\n      <>\n        <div data-testid=\"search-default\">{search.default}</div>\n        <div data-testid=\"context-hello\">{context.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/search-params/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/search-params/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <Link\n        data-testid=\"link-to-default-without-search\"\n        to=\"/search-params/default\"\n      >\n        go to /search-params/default\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search\"\n        to=\"/search-params/default\"\n        search={{ default: 'd2' }}\n      >\n        go to /search-params/default?default=d2\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/search-params/loader-throws-redirect.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/search-params/loader-throws-redirect')({\n  validateSearch: z.object({\n    step: z.enum(['a', 'b', 'c']).optional(),\n  }),\n  loaderDeps: ({ search: { step } }) => ({ step }),\n  loader: ({ deps: { step } }) => {\n    if (step === undefined) {\n      throw redirect({\n        to: '/search-params/loader-throws-redirect',\n        search: { step: 'a' },\n      })\n    }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    return (\n      <div>\n        <h1>SearchParams</h1>\n        <div data-testid=\"search-param\">{search.step}</div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/search-params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/search-params')({\n  beforeLoad: async () => {\n    await new Promise((resolve) => setTimeout(resolve, 1000))\n    return { hello: 'world' as string }\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/specialChars/$param.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/specialChars/$param')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { param } = Route.useParams()\n  return (\n    <div>\n      Hello \"/specialChars/$param\":{' '}\n      <span data-testid={'special-param'}>{param}</span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/specialChars/hash.tsx",
    "content": "import { createFileRoute, useLocation } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nexport const Route = createFileRoute('/specialChars/hash')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const l = useLocation()\n  const [toggleHashValue, setToggleHashValue] = useState(false)\n  return (\n    <div data-testid=\"special-hash-heading\">\n      <div>Hello \"/specialChars/hash\"!</div>\n      <button\n        className={\n          'mt-2 mb-2 px-1 py-1 bg-indigo-600 text-white rounded hover:bg-indigo-700 transition duration-200'\n        }\n        data-testid=\"toggle-hash-button\"\n        onClick={() => setToggleHashValue(!toggleHashValue)}\n      >\n        Toggle HashValue\n      </button>\n      <div>\n        {toggleHashValue && (\n          <div>\n            Hash Value<span data-testid=\"special-hash\">{l.hash}</span>\n          </div>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/specialChars/malformed/$param.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/specialChars/malformed/$param')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const { param } = Route.useParams()\n  return (\n    <div>\n      Hello \"/specialChars/malformed/$param\":{' '}\n      <span data-testid={'special-malformed-param'}>{param}</span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/specialChars/malformed/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/specialChars/malformed')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div>Hello \"/specialChars/malformed\"!</div>\n      <Link\n        from={Route.fullPath}\n        data-testid=\"special-malformed-path-link\"\n        href=\"/specialChars/malformed/%E0%A4\"\n      >\n        malformed path param\n      </Link>{' '}\n      <Link\n        from={Route.fullPath}\n        data-testid=\"special-malformed-search-link\"\n        href=\"/specialChars/malformed/search?searchParam=%E0%A4\"\n      >\n        malformed search param\n      </Link>{' '}\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/specialChars/malformed/search.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/specialChars/malformed/search')({\n  validateSearch: z.object({\n    searchParam: z.string(),\n  }),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n\n  return (\n    <div>\n      Hello \"/specialChars/malformed/search\"!\n      <span data-testid={'special-malformed-search-param'}>\n        {search.searchParam}\n      </span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/specialChars/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/specialChars')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div>Hello \"/specialChars\"!</div>\n      <Link\n        to=\"/specialChars/대한민국\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n        data-testid=\"special-non-latin-link\"\n      >\n        Unicode\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/$param\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n        data-testid=\"special-param-link\"\n        params={{ param: '대|' }}\n      >\n        Unicode param\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/search\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n        data-testid=\"special-searchParam-link\"\n        search={{ searchParam: '대|' }}\n      >\n        Unicode search param\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/hash\"\n        activeOptions={{\n          includeHash: true,\n        }}\n        activeProps={{\n          className: 'font-bold',\n        }}\n        hash={'대|'}\n        data-testid=\"special-hash-link-1\"\n      >\n        Unicode Hash 대|\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/hash\"\n        activeOptions={{\n          includeHash: true,\n        }}\n        activeProps={{\n          className: 'font-bold',\n        }}\n        hash={'abc'}\n        data-testid=\"special-hash-link-2\"\n      >\n        Unicode Hash abc\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/malformed\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n        data-testid=\"special-malformed-link\"\n      >\n        Malformed paths\n      </Link>{' '}\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/specialChars/search.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/specialChars/search')({\n  validateSearch: z.object({\n    searchParam: z.string(),\n  }),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n\n  return (\n    <div>\n      Hello \"/specialChars/search\"!\n      <span data-testid={'special-search-param'}>{search.searchParam}</span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/specialChars/대한민국.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/specialChars/대한민국')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"special-non-latin-heading\">\n      Hello \"/specialChars/대한민국\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/stream.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { useEffect, useState } from 'react'\n\nexport const Route = createFileRoute('/stream')({\n  component: Home,\n  loader() {\n    return {\n      promise: new Promise<string>((resolve) =>\n        setTimeout(() => resolve('promise-data'), 150),\n      ),\n      stream: new ReadableStream({\n        async start(controller) {\n          for (let i = 0; i < 5; i++) {\n            await new Promise((resolve) => setTimeout(resolve, 200))\n            controller.enqueue(`stream-data-${i} `)\n          }\n          controller.close()\n        },\n      }),\n    }\n  },\n})\n\nconst decoder = new TextDecoder('utf-8')\n\nfunction Home() {\n  const { promise, stream } = Route.useLoaderData()\n  const [streamData, setStreamData] = useState<Array<string>>([])\n\n  useEffect(() => {\n    async function fetchStream() {\n      const reader = stream.getReader()\n      let chunk\n\n      while (!(chunk = await reader.read()).done) {\n        let value = chunk.value\n        if (typeof value !== 'string') {\n          value = decoder.decode(value, { stream: !chunk.done })\n        }\n        setStreamData((prev) => [...prev, value])\n      }\n    }\n\n    fetchStream()\n  }, [])\n\n  return (\n    <>\n      <Await\n        promise={promise}\n        children={(promiseData) => (\n          <div className=\"p-2\" data-testid=\"promise-data\">\n            {promiseData}\n            <div data-testid=\"stream-data\">\n              {streamData.map((d) => (\n                <div key={d}>{d}</div>\n              ))}\n            </div>\n          </div>\n        )}\n      />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/type-only-reexport.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { loggingMiddleware } from '~/shared-lib'\n\n/**\n * This route tests that the compiler can handle re-exports through type-only modules.\n *\n * The loggingMiddleware is imported from ~/shared-lib, which re-exports from:\n * - ./middleware (has runtime code)\n * - ./types (has ONLY type exports - compiles to empty JS)\n *\n * If the compiler doesn't handle empty modules correctly, the build will fail with:\n * \"could not load module .../types/actions.ts\"\n */\n\nconst getMessage = createServerFn()\n  .middleware([loggingMiddleware])\n  .handler(async () => {\n    return 'Hello from server with type-only module re-exports!'\n  })\n\nexport const Route = createFileRoute('/type-only-reexport')({\n  component: TypeOnlyReexportPage,\n  loader: async () => {\n    const message = await getMessage()\n    return { message }\n  },\n})\n\nfunction TypeOnlyReexportPage() {\n  const { message } = Route.useLoaderData()\n  return (\n    <div className=\"p-2\">\n      <h3 data-testid=\"type-only-heading\">Type-Only Re-export Test</h3>\n      <p data-testid=\"message\">{message}</p>\n      <p>\n        This page tests that the compiler can handle barrel files that re-export\n        from type-only modules (which compile to empty JavaScript).\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/users.$userId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport { getRouterInstance } from '@tanstack/react-start'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport type { User } from '~/utils/users'\nimport { NotFound } from '~/components/NotFound'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    const router = await getRouterInstance()\n    return await axios\n      .get<User>('/api/users/' + userId, { baseURL: router.options.origin })\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch user')\n      })\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{user.name}</h4>\n      <div className=\"text-sm\">{user.email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { getRouterInstance } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const router = await getRouterInstance()\n    return await axios\n      .get<Array<User>>('/api/users', { baseURL: router.options.origin })\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch users')\n      })\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...users,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li key={user.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/server.ts",
    "content": "// DO NOT DELETE THIS FILE!!!\n// This file is a good smoke test to make sure the custom server entry is working\nimport handler from '@tanstack/react-start/server-entry'\n\nconsole.log(\"[server-entry]: using custom server entry in 'src/server.ts'\")\n\nexport default {\n  fetch(request: Request) {\n    return handler.fetch(request)\n  },\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/shared-lib/index.ts",
    "content": "/**\n * Library index - re-exports from middleware and types.\n *\n * This barrel file re-exports from both:\n * 1. ./middleware - has runtime code (createMiddleware)\n * 2. ./types - has ONLY type exports (compiles to empty JS)\n *\n * The compiler must handle the type-only module gracefully when\n * tracing exports through this barrel file.\n */\nexport * from './middleware'\nexport * from './typedefs'\n"
  },
  {
    "path": "e2e/react-start/basic/src/shared-lib/middleware.ts",
    "content": "/**\n * Middleware that logs server function calls.\n * This is exported through a barrel file that also re-exports type-only modules.\n */\nimport { createMiddleware } from '@tanstack/react-start'\n\nexport const loggingMiddleware = createMiddleware().server(({ next }) => {\n  console.log('[logging] Server function called')\n  return next()\n})\n"
  },
  {
    "path": "e2e/react-start/basic/src/shared-lib/typedefs/actions.ts",
    "content": "/**\n * This file contains ONLY type exports.\n * After TypeScript compilation, this becomes an empty JavaScript module.\n * This tests that the compiler can handle re-exports through type-only modules.\n *\n * See: https://github.com/TanStack/router/issues/6198\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: Generic server function type\nexport type Action = (...deps: any[]) => any\nexport type ActionParams<TFunction extends Action> = Parameters<TFunction>[0]\n"
  },
  {
    "path": "e2e/react-start/basic/src/shared-lib/typedefs/index.ts",
    "content": "/**\n * Types index - re-exports from type-only modules\n */\nexport * from './actions'\n"
  },
  {
    "path": "e2e/react-start/basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/basic/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/react-start/basic/tests/client-only.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\n/**\n * These tests verify the <ClientOnly> compiler optimization.\n *\n * The WindowSize component accesses `window` at module scope, which would\n * throw if the module is ever imported on the server. The compiler optimization\n * strips <ClientOnly> children from the server bundle, allowing DCE to remove\n * the WindowSize import entirely. This prevents the server from crashing.\n *\n * If these tests pass in SSR mode, it proves the compiler is correctly\n * removing client-only code from the server bundle.\n */\n\ntest('ClientOnly renders fallback on server, then client content after hydration', async ({\n  page,\n}) => {\n  // Navigate directly to the client-only route\n  // If the compiler optimization isn't working, this would crash the server\n  // because WindowSize.tsx accesses `window` at module scope\n  await page.goto('/client-only')\n  await page.waitForURL('/client-only')\n\n  // The heading should be visible\n  await expect(page.getByTestId('client-only-heading')).toContainText(\n    'Client Only Demo',\n  )\n\n  // After hydration, the WindowSize component should render with actual values\n  // Wait for the client-side component to render\n  await expect(page.getByTestId('window-size')).toBeVisible()\n  await expect(page.getByTestId('window-width')).toContainText('Window width:')\n  await expect(page.getByTestId('window-height')).toContainText(\n    'Window height:',\n  )\n})\n\ntest('ClientOnly works with client-side navigation', async ({ page }) => {\n  // Start from home\n  await page.goto('/')\n  await page.waitForURL('/')\n\n  // Navigate to client-only route via client-side navigation\n  await page.getByRole('link', { name: 'Client Only' }).click()\n  await page.waitForURL('/client-only')\n\n  // The WindowSize component should render\n  await expect(page.getByTestId('window-size')).toBeVisible()\n  await expect(page.getByTestId('window-width')).toContainText('Window width:')\n})\n\ntest('ClientOnly component displays actual window dimensions', async ({\n  page,\n}) => {\n  // Set a specific viewport size\n  await page.setViewportSize({ width: 800, height: 600 })\n\n  await page.goto('/client-only')\n  await page.waitForURL('/client-only')\n\n  // Wait for client-side hydration\n  await expect(page.getByTestId('window-size')).toBeVisible()\n\n  // Check that the displayed dimensions match the viewport\n  await expect(page.getByTestId('window-width')).toContainText(\n    'Window width: 800',\n  )\n  await expect(page.getByTestId('window-height')).toContainText(\n    'Window height: 600',\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/navigation.spec.ts",
    "content": "import { expect } from '@playwright/test'\n\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 404',\n  ],\n})\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.goto('/')\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('body')).toContainText(\"I'm a layout\")\n  await expect(page.locator('body')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout B!\")\n})\n\ntest('client side navigating to a route with scripts', async ({ page }) => {\n  await page.goto('/')\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n  await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n  expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  expect(await page.evaluate('window.SCRIPT_2')).toBe(undefined)\n})\n\ntest('directly going to a route with scripts', async ({ page }) => {\n  await page.goto('/scripts')\n  await page.waitForURL('/scripts')\n  await page.waitForLoadState('networkidle')\n  expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  expect(await page.evaluate('window.SCRIPT_2')).toBe(undefined)\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/not-found.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from '../tests/utils/isSpaMode'\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 404',\n  ],\n})\ntest.describe('not-found', () => {\n  test(`global not found`, async ({ page }) => {\n    const response = await page.goto(`/this-page-does-not-exist/foo/bar`)\n\n    expect(response?.status()).toBe(isSpaMode ? 200 : 404)\n\n    await expect(\n      page.getByTestId('default-not-found-component'),\n    ).toBeInViewport()\n  })\n\n  test.describe('throw notFound()', () => {\n    const navigationTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n      preload: [false, true] as const,\n    })\n\n    navigationTestMatrix.forEach(({ thrower, preload }) => {\n      test(`navigation: thrower: ${thrower}, preload: ${preload}`, async ({\n        page,\n      }) => {\n        await page.goto(\n          `/not-found/${preload === false ? '?preload=false' : ''}`,\n        )\n        const link = page.getByTestId(`via-${thrower}`)\n\n        if (preload) {\n          await link.focus()\n          await new Promise((r) => setTimeout(r, 250))\n        }\n\n        await link.click()\n\n        await expect(\n          page.getByTestId(`via-${thrower}-notFound-component`),\n        ).toBeInViewport()\n\n        await expect(\n          page.getByTestId(`via-${thrower}-route-component`),\n        ).not.toBeInViewport()\n      })\n    })\n    const directVisitTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n    })\n\n    directVisitTestMatrix.forEach(({ thrower }) => {\n      test(`direct visit: thrower: ${thrower}`, async ({ page }) => {\n        await page.goto(`/not-found/via-${thrower}`)\n        await page.waitForLoadState('networkidle')\n        await expect(\n          page.getByTestId(`via-${thrower}-notFound-component`),\n        ).toBeInViewport()\n        await expect(\n          page.getByTestId(`via-${thrower}-route-component`),\n        ).not.toBeInViewport()\n      })\n    })\n\n    test('direct visit: child beforeLoad notFound with routeId renders parent boundary with parent loader data', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/parent-boundary/via-beforeLoad')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('parent-boundary-notFound-component'),\n      ).toBeInViewport()\n      await expect(page.getByTestId('parent-loader-data')).toHaveText('ready')\n      await expect(\n        page.getByTestId('parent-boundary-notFound-source'),\n      ).toHaveText('with-routeId')\n      await expect(\n        page.getByTestId('parent-boundary-child-route-component'),\n      ).not.toBeInViewport()\n    })\n\n    test('direct visit: child beforeLoad notFound without routeId still hydrates and renders parent boundary', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/parent-boundary/via-beforeLoad?target=none')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('parent-boundary-notFound-component'),\n      ).toBeInViewport()\n      await expect(page.getByTestId('parent-loader-data')).toHaveText('ready')\n      await expect(\n        page.getByTestId('parent-boundary-notFound-source'),\n      ).toHaveText('without-routeId')\n      await expect(\n        page.getByTestId('parent-boundary-child-route-component'),\n      ).not.toBeInViewport()\n    })\n\n    test('direct visit: beforeLoad notFound with routeId targets root boundary', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/via-beforeLoad-target-root')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('default-not-found-component'),\n      ).toBeInViewport()\n      await expect(\n        page.getByTestId('via-beforeLoad-target-root-route-component'),\n      ).not.toBeInViewport()\n    })\n\n    test('direct visit: deep hierarchy d throws in beforeLoad and hydrates route d boundary', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/deep/b/c/d?throwAt=d')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('deep-d-notFound-component'),\n      ).toBeInViewport()\n      await expect(\n        page.getByTestId('deep-d-route-component'),\n      ).not.toBeInViewport()\n    })\n\n    test('direct visit: deep hierarchy c throws in beforeLoad, d loader does not run, and c boundary hydrates', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/deep/b/c/d?throwAt=c')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('deep-c-notFound-component'),\n      ).toBeInViewport()\n      await expect(\n        page.getByTestId('deep-d-route-component'),\n      ).not.toBeInViewport()\n    })\n\n    test('direct visit: deep hierarchy b throws in beforeLoad and b boundary hydrates', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/deep/b/c/d?throwAt=b')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('deep-b-notFound-component'),\n      ).toBeInViewport()\n      await expect(\n        page.getByTestId('deep-d-route-component'),\n      ).not.toBeInViewport()\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/open-redirect-prevention.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from './utils/isSpaMode'\n\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 404',\n  ],\n})\n\ntest.describe('Open redirect prevention', () => {\n  test.describe('CRLF injection attacks', () => {\n    test('should not redirect to external site via CR injection (%0d)', async ({\n      page,\n      baseURL,\n    }) => {\n      // This URL attempts to exploit CRLF injection to redirect to google.com\n      // %0d = \\r (carriage return)\n      // Without the fix, /\\r/google.com/ would be interpreted as //google.com/\n      // which browsers resolve as a protocol-relative URL to http://google.com/\n      await page.goto('/%0d/google.com/')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin - the path should be treated as a local path\n      // not as an external redirect\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      // The origin should be localhost, not google.com\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n    })\n\n    test('should not redirect to external site via LF injection (%0a)', async ({\n      page,\n      baseURL,\n    }) => {\n      // %0a = \\n (line feed)\n      await page.goto('/%0a/evil.com/')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n    })\n\n    test('should not redirect to external site via CRLF injection (%0d%0a)', async ({\n      page,\n      baseURL,\n    }) => {\n      // Combined CRLF injection attempt\n      await page.goto('/%0d%0a/attacker.com/')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n    })\n\n    test('should not redirect to external site via multiple control chars', async ({\n      page,\n      baseURL,\n    }) => {\n      // Multiple CR/LF characters\n      await page.goto('/%0d%0d%0a/malicious.com/path')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n    })\n  })\n\n  test.describe('Protocol-relative URL prevention', () => {\n    test('should handle paths that could be misinterpreted as protocol-relative URLs', async ({\n      page,\n      baseURL,\n    }) => {\n      // When control characters are stripped from paths like /%0d/evil.com/\n      // the result could be //evil.com/ which is a protocol-relative URL\n      // Our fix collapses these to /evil.com/ to prevent external redirects\n      // This is already tested above, but we verify the collapsed path works\n      const res = await page.goto('/%0d/test-path/')\n      await page.waitForLoadState('networkidle')\n\n      // Should stay on the same origin\n      expect(page.url().startsWith(baseURL!)).toBe(true)\n      const url = new URL(page.url())\n      expect(url.origin).toBe(new URL(baseURL!).origin)\n      // Path should be collapsed to /test-path (not //test-path/)\n      expect(url.pathname).toMatch(/^\\/test-path\\/?$/)\n      if (!isSpaMode) {\n        expect(res?.request().redirectedFrom()?.url()).not.toBe(undefined)\n      }\n    })\n  })\n\n  test.describe('Normal navigation still works', () => {\n    test('should navigate to normal paths correctly', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/posts')\n      await page.waitForLoadState('networkidle')\n\n      expect(page.url()).toBe(`${baseURL}/posts`)\n    })\n\n    test('should handle URL-encoded characters in normal paths', async ({\n      page,\n      baseURL,\n    }) => {\n      // Normal URL encoding should still work\n      await page.goto('/posts/1')\n      await page.waitForLoadState('networkidle')\n\n      expect(page.url()).toBe(`${baseURL}/posts/1`)\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/prerendering.spec.ts",
    "content": "import { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isPrerender } from './utils/isPrerender'\n\ntest.describe('Prerender Static Path Discovery', () => {\n  test.skip(!isPrerender, 'Skipping since not in prerender mode')\n  test.describe('Build Output Verification', () => {\n    test('should automatically discover and prerender static routes', () => {\n      // Check that static routes were automatically discovered and prerendered\n      const distDir = join(process.cwd(), 'dist', 'client')\n\n      // These static routes should be automatically discovered and prerendered\n      expect(existsSync(join(distDir, 'index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'deferred/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'scripts/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'inline-scripts/index.html'))).toBe(true)\n      expect(\n        existsSync(join(distDir, 'specialChars/대한민국/index.html')),\n      ).toBe(true)\n\n      // Pathless layouts should NOT be prerendered (they start with _)\n      expect(existsSync(join(distDir, '_layout', 'index.html'))).toBe(false) // /_layout\n\n      // API routes should NOT be prerendered\n\n      expect(existsSync(join(distDir, 'api', 'users', 'index.html'))).toBe(\n        false,\n      ) // /api/users\n    })\n  })\n\n  test.describe('Static Files Verification', () => {\n    test('should contain prerendered content in posts.html', () => {\n      const distDir = join(process.cwd(), 'dist', 'client')\n      expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true)\n\n      // \"Select a post.\" should be in the prerendered HTML\n      const html = readFileSync(join(distDir, 'posts/index.html'), 'utf-8')\n      expect(html).toContain('Select a post.')\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/raw-stream.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isPrerender } from './utils/isPrerender'\n\n/**\n * These tests verify the RawStream binary streaming functionality.\n *\n * RawStream allows returning ReadableStream<Uint8Array> from server functions\n * with efficient binary encoding:\n * - Server functions (RPC): Binary framing protocol\n * - SSR loaders: Base64 encoding via seroval's stream mechanism\n */\n\n// Wait time for hydration to complete after page load\n// This needs to be long enough for React hydration to attach event handlers\nconst HYDRATION_WAIT = 1000\n\ntest.describe('RawStream - Client RPC Tests', () => {\n  test('Single raw stream - returns stream with binary data', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    // Wait for hydration\n    await page.getByTestId('test1-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test1-btn').click()\n    await page\n      .getByTestId('test1-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n\n    const result = await page.getByTestId('test1-result').textContent()\n\n    expect(result).toContain('chunk1chunk2chunk3')\n    expect(result).toContain('Single stream test')\n  })\n\n  test('Multiple raw streams - returns multiple independent streams', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test2-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test2-btn').click()\n    await page\n      .getByTestId('test2-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n\n    const result = await page.getByTestId('test2-result').textContent()\n\n    expect(result).toContain('stream1-astream1-b')\n    expect(result).toContain('stream2-astream2-b')\n    expect(result).toContain('Multiple streams test')\n  })\n\n  test('JSON ends before raw stream - handles timing correctly', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test3-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test3-btn').click()\n    await page\n      .getByTestId('test3-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test3-result').textContent()\n\n    expect(result).toContain('slow-1slow-2slow-3slow-4')\n    expect(result).toContain('JSON ends first test')\n    expect(result).toContain('hasTimestamp')\n  })\n\n  test('Raw stream ends before JSON - handles timing correctly', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test4-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test4-btn').click()\n    await page\n      .getByTestId('test4-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test4-result').textContent()\n\n    expect(result).toContain('fast-done')\n    expect(result).toContain('deferred-json-data')\n    expect(result).toContain('Raw ends first test')\n  })\n\n  test('Large binary data - handles 3KB of binary correctly', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test5-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test5-btn').click()\n    await page\n      .getByTestId('test5-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test5-result').textContent()\n\n    expect(result).toContain('\"sizeMatch\":true')\n    expect(result).toContain('\"actualSize\":3072')\n    expect(result).toContain('Large binary test')\n  })\n\n  test('Mixed streaming - Promise and RawStream together', async ({ page }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test6-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test6-btn').click()\n    await page\n      .getByTestId('test6-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test6-result').textContent()\n\n    expect(result).toContain('immediate-value')\n    expect(result).toContain('deferred-value')\n    expect(result).toContain('mixed-raw-1mixed-raw-2')\n  })\n})\n\ntest.describe('RawStream - SSR Loader Tests', () => {\n  test('SSR single stream - direct navigation', async ({ page }) => {\n    // Direct navigation = full SSR with base64 encoding\n    await page.goto('/raw-stream/ssr-single')\n    await page.waitForURL('/raw-stream/ssr-single')\n\n    // Wait for stream to be consumed (SSR tests need hydration + stream consumption)\n    await expect(page.getByTestId('ssr-single-stream')).toContainText(\n      'ssr-chunk1ssr-chunk2ssr-chunk3',\n      { timeout: 10000 },\n    )\n    await expect(page.getByTestId('ssr-single-message')).toContainText(\n      'SSR Single Stream Test',\n    )\n    await expect(page.getByTestId('ssr-single-timestamp')).toContainText(\n      'Has Timestamp: true',\n    )\n  })\n\n  test('SSR multiple streams - direct navigation', async ({ page }) => {\n    await page.goto('/raw-stream/ssr-multiple')\n    await page.waitForURL('/raw-stream/ssr-multiple')\n\n    await expect(page.getByTestId('ssr-multiple-first')).toContainText(\n      'multi-1amulti-1b',\n      { timeout: 10000 },\n    )\n    await expect(page.getByTestId('ssr-multiple-second')).toContainText(\n      'multi-2amulti-2b',\n    )\n    await expect(page.getByTestId('ssr-multiple-message')).toContainText(\n      'SSR Multiple Streams Test',\n    )\n  })\n\n  // Skip in prerender mode: RawStream + deferred data causes stream chunks to be\n  // missing from prerendered HTML. This is a known limitation where the prerender\n  // process doesn't properly capture streaming data when deferred promises are present.\n  ;(isPrerender ? test.skip : test)(\n    'SSR mixed streaming - RawStream with deferred data',\n    async ({ page }) => {\n      await page.goto('/raw-stream/ssr-mixed')\n      await page.waitForURL('/raw-stream/ssr-mixed')\n\n      await expect(page.getByTestId('ssr-mixed-immediate')).toContainText(\n        'immediate-ssr-value',\n      )\n      await expect(page.getByTestId('ssr-mixed-stream')).toContainText(\n        'mixed-ssr-1mixed-ssr-2',\n        { timeout: 10000 },\n      )\n      // Deferred promise should also resolve\n      await expect(page.getByTestId('ssr-mixed-deferred')).toContainText(\n        'deferred-ssr-value',\n        { timeout: 10000 },\n      )\n    },\n  )\n\n  test('SSR single stream - client-side navigation', async ({ page }) => {\n    // Start from index, then navigate client-side to SSR route\n    await page.goto('/raw-stream')\n    await page.waitForURL('/raw-stream')\n\n    // Wait for hydration (use navigation to be specific)\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'SSR Single' })\n      .waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    // Client-side navigation\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'SSR Single' })\n      .click()\n    await page.waitForURL('/raw-stream/ssr-single')\n\n    // Stream should still work after client navigation\n    await expect(page.getByTestId('ssr-single-stream')).toContainText(\n      'ssr-chunk1ssr-chunk2ssr-chunk3',\n      { timeout: 10000 },\n    )\n  })\n\n  test('SSR multiple streams - client-side navigation', async ({ page }) => {\n    await page.goto('/raw-stream')\n    await page.waitForURL('/raw-stream')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'SSR Multiple' })\n      .waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'SSR Multiple' })\n      .click()\n    await page.waitForURL('/raw-stream/ssr-multiple')\n\n    await expect(page.getByTestId('ssr-multiple-first')).toContainText(\n      'multi-1amulti-1b',\n      { timeout: 10000 },\n    )\n    await expect(page.getByTestId('ssr-multiple-second')).toContainText(\n      'multi-2amulti-2b',\n    )\n  })\n})\n\ntest.describe('RawStream - Hint Parameter (RPC)', () => {\n  test('Text hint with pure text - uses UTF-8 encoding', async ({ page }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test7-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test7-btn').click()\n    await page\n      .getByTestId('test7-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test7-result').textContent()\n\n    expect(result).toContain('\"match\":true')\n    expect(result).toContain('Hello, World! This is text.')\n    expect(result).toContain('Text hint with pure text')\n  })\n\n  test('Text hint with pure binary - fallback to base64', async ({ page }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test8-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test8-btn').click()\n    await page\n      .getByTestId('test8-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test8-result').textContent()\n\n    expect(result).toContain('\"match\":true')\n    expect(result).toContain('\"expectedLength\":12')\n  })\n\n  test('Text hint with mixed content - handles both', async ({ page }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test9-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test9-btn').click()\n    await page\n      .getByTestId('test9-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test9-result').textContent()\n\n    expect(result).toContain('\"match\":true')\n    expect(result).toContain('\"expectedLength\":30')\n  })\n\n  test('Binary hint with text data - uses base64', async ({ page }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test10-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test10-btn').click()\n    await page\n      .getByTestId('test10-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test10-result').textContent()\n\n    expect(result).toContain('\"match\":true')\n    expect(result).toContain('This is text but using binary hint')\n  })\n\n  test('Binary hint with binary data - uses base64', async ({ page }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test11-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test11-btn').click()\n    await page\n      .getByTestId('test11-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n    const result = await page.getByTestId('test11-result').textContent()\n\n    expect(result).toContain('\"match\":true')\n    expect(result).toContain('\"expectedLength\":6')\n  })\n})\n\ntest.describe('RawStream - SSR Hint Parameter Tests', () => {\n  test('SSR text hint with pure text - direct navigation', async ({ page }) => {\n    await page.goto('/raw-stream/ssr-text-hint')\n    await page.waitForURL('/raw-stream/ssr-text-hint')\n\n    await expect(page.getByTestId('ssr-text-hint-pure-text')).toContainText(\n      'Hello World from SSR!',\n      { timeout: 10000 },\n    )\n    await expect(page.getByTestId('ssr-text-hint-pure-match')).toContainText(\n      'true',\n    )\n    await expect(page.getByTestId('ssr-text-hint-mixed-match')).toContainText(\n      'true',\n    )\n    await expect(\n      page.getByTestId('ssr-text-hint-pure-binary-match'),\n    ).toContainText('true')\n  })\n\n  test('SSR text hint - byte-by-byte verification', async ({ page }) => {\n    await page.goto('/raw-stream/ssr-text-hint')\n    await page.waitForURL('/raw-stream/ssr-text-hint')\n\n    // Wait for streams to be fully consumed\n    await expect(page.getByTestId('ssr-text-hint-result')).toContainText(\n      '\"match\":true',\n      { timeout: 10000 },\n    )\n    // Check pure text, mixed content, and pure binary all match\n    const result = await page.getByTestId('ssr-text-hint-result').textContent()\n    const parsed = JSON.parse(result || '{}')\n    expect(parsed.pureTextMatch?.match).toBe(true)\n    expect(parsed.mixedMatch?.match).toBe(true)\n    expect(parsed.pureBinaryMatch?.match).toBe(true)\n  })\n\n  test('SSR binary hint with text - direct navigation', async ({ page }) => {\n    await page.goto('/raw-stream/ssr-binary-hint')\n    await page.waitForURL('/raw-stream/ssr-binary-hint')\n\n    await expect(page.getByTestId('ssr-binary-hint-text')).toContainText(\n      'Binary hint with text',\n      { timeout: 10000 },\n    )\n    await expect(page.getByTestId('ssr-binary-hint-text-match')).toContainText(\n      'true',\n    )\n    await expect(\n      page.getByTestId('ssr-binary-hint-binary-match'),\n    ).toContainText('true')\n  })\n\n  test('SSR binary hint - byte-by-byte verification', async ({ page }) => {\n    await page.goto('/raw-stream/ssr-binary-hint')\n    await page.waitForURL('/raw-stream/ssr-binary-hint')\n\n    // Wait for streams to be fully consumed\n    await expect(page.getByTestId('ssr-binary-hint-result')).toContainText(\n      '\"match\":true',\n      { timeout: 10000 },\n    )\n    // Check both text and binary data match\n    const result = await page\n      .getByTestId('ssr-binary-hint-result')\n      .textContent()\n    const parsed = JSON.parse(result || '{}')\n    expect(parsed.textMatch?.match).toBe(true)\n    expect(parsed.binaryMatch?.match).toBe(true)\n  })\n\n  test('SSR text hint - client-side navigation', async ({ page }) => {\n    await page.goto('/raw-stream')\n    await page.waitForURL('/raw-stream')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'SSR Text Hint' })\n      .waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'SSR Text Hint' })\n      .click()\n    await page.waitForURL('/raw-stream/ssr-text-hint')\n\n    await expect(page.getByTestId('ssr-text-hint-pure-match')).toContainText(\n      'true',\n      { timeout: 10000 },\n    )\n    await expect(page.getByTestId('ssr-text-hint-mixed-match')).toContainText(\n      'true',\n    )\n    await expect(\n      page.getByTestId('ssr-text-hint-pure-binary-match'),\n    ).toContainText('true')\n  })\n\n  test('SSR binary hint - client-side navigation', async ({ page }) => {\n    await page.goto('/raw-stream')\n    await page.waitForURL('/raw-stream')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'SSR Binary Hint' })\n      .waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'SSR Binary Hint' })\n      .click()\n    await page.waitForURL('/raw-stream/ssr-binary-hint')\n\n    await expect(page.getByTestId('ssr-binary-hint-text-match')).toContainText(\n      'true',\n      { timeout: 10000 },\n    )\n    await expect(\n      page.getByTestId('ssr-binary-hint-binary-match'),\n    ).toContainText('true')\n  })\n})\n\ntest.describe('RawStream - Multiplexing Tests (RPC)', () => {\n  test('Interleaved streams - two concurrent streams with variable delays', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test12-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test12-btn').click()\n    await page\n      .getByTestId('test12-result')\n      .waitFor({ state: 'visible', timeout: 15000 })\n    const result = await page.getByTestId('test12-result').textContent()\n\n    // Both streams should have matching bytes\n    expect(result).toContain('\"match\":true')\n    // Verify both streams match\n    const parsed = JSON.parse(result || '{}')\n    expect(parsed.streamA?.match).toBe(true)\n    expect(parsed.streamB?.match).toBe(true)\n  })\n\n  test('Burst-pause-burst - single stream with variable timing', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test13-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test13-btn').click()\n    await page\n      .getByTestId('test13-result')\n      .waitFor({ state: 'visible', timeout: 15000 })\n    const result = await page.getByTestId('test13-result').textContent()\n\n    expect(result).toContain('\"match\":true')\n    expect(result).toContain('Burst-pause-burst test')\n  })\n\n  test('Three concurrent streams - different timing patterns', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test14-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test14-btn').click()\n    await page\n      .getByTestId('test14-result')\n      .waitFor({ state: 'visible', timeout: 15000 })\n    const result = await page.getByTestId('test14-result').textContent()\n\n    // All three streams should match\n    expect(result).toContain('\"match\":true')\n    // Verify all three streams match\n    const parsed = JSON.parse(result || '{}')\n    expect(parsed.fast?.match).toBe(true)\n    expect(parsed.slow?.match).toBe(true)\n    expect(parsed.burst?.match).toBe(true)\n  })\n})\n\ntest.describe('RawStream - Cross Navigation', () => {\n  test('Client RPC works after navigating from SSR route', async ({ page }) => {\n    // Start with SSR route\n    await page.goto('/raw-stream/ssr-single')\n    await page.waitForURL('/raw-stream/ssr-single')\n\n    // Wait for SSR stream to complete (ensures hydration is done)\n    await expect(page.getByTestId('ssr-single-stream')).toContainText(\n      'ssr-chunk1ssr-chunk2ssr-chunk3',\n      { timeout: 10000 },\n    )\n\n    // Navigate to client-call route (use first() to avoid strict mode on multiple matches)\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Client Calls' })\n      .click()\n    await page.waitForURL('/raw-stream/client-call')\n\n    // Wait for hydration\n    await page.getByTestId('test1-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    // Run RPC test\n    await page.getByTestId('test1-btn').click()\n\n    await expect(page.getByTestId('test1-result')).toContainText(\n      'chunk1chunk2chunk3',\n      { timeout: 10000 },\n    )\n  })\n\n  test('Navigation from home to raw-stream routes', async ({ page }) => {\n    // Start from home\n    await page.goto('/')\n    await page.waitForURL('/')\n\n    // Wait for hydration\n    await page\n      .getByRole('link', { name: 'Raw Stream' })\n      .waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    // Navigate via client-side to raw-stream\n    await page.getByRole('link', { name: 'Raw Stream' }).click()\n    await page.waitForURL('/raw-stream')\n\n    // Wait for hydration on the new page\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    // Then to client-call (use navigation area to avoid duplicates)\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Client Calls' })\n      .click()\n    await page.waitForURL('/raw-stream/client-call')\n\n    // Wait for button\n    await page.getByTestId('test1-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    // Run a test\n    await page.getByTestId('test1-btn').click()\n\n    await expect(page.getByTestId('test1-result')).toContainText(\n      'chunk1chunk2chunk3',\n      { timeout: 10000 },\n    )\n  })\n})\n\ntest.describe('RawStream - Edge Cases (RPC)', () => {\n  test('Empty stream - handles zero-byte stream correctly', async ({\n    page,\n  }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test15-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test15-btn').click()\n\n    await page\n      .getByTestId('test15-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n\n    const result = await page.getByTestId('test15-result').textContent()\n    expect(result).toContain('\"isEmpty\":true')\n    expect(result).toContain('\"byteCount\":0')\n    expect(result).toContain('Empty stream test')\n  })\n\n  test('Stream error - propagates error to client', async ({ page }) => {\n    await page.goto('/raw-stream/client-call')\n    await page.waitForURL('/raw-stream/client-call')\n\n    await page.getByTestId('test16-btn').waitFor({ state: 'visible' })\n    await page.waitForTimeout(HYDRATION_WAIT)\n\n    await page.getByTestId('test16-btn').click()\n\n    await page\n      .getByTestId('test16-result')\n      .waitFor({ state: 'visible', timeout: 10000 })\n\n    const result = await page.getByTestId('test16-result').textContent()\n\n    expect(result).toContain('\"errorCaught\":true')\n    expect(result).toContain('Intentional stream error')\n    expect(result).toContain('Error stream test')\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/redirect.spec.ts",
    "content": "import queryString from 'node:querystring'\nimport { expect } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  test,\n} from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from '../tests/utils/isSpaMode'\nimport { isPreview } from '../tests/utils/isPreview'\nimport packageJson from '../package.json' with { type: 'json' }\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\nconst PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa' : ''}${isPreview ? '_preview' : ''}`,\n)\n\nconst EXTERNAL_HOST_PORT = await getDummyServerPort(packageJson.name)\n\ntest.describe('redirects', () => {\n  test.describe('internal', () => {\n    const internalNavigationTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n      reloadDocument: [false, true] as const,\n      preload: [false, true] as const,\n    })\n\n    internalNavigationTestMatrix.forEach(\n      ({ thrower, reloadDocument, preload }) => {\n        test(`internal target, navigation: thrower: ${thrower}, reloadDocument: ${reloadDocument}, preload: ${preload}`, async ({\n          page,\n        }) => {\n          await page.goto(\n            `/redirect/internal${preload === false ? '?preload=false' : ''}`,\n          )\n\n          const link = page.getByTestId(\n            `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`,\n          )\n\n          await page.waitForLoadState('networkidle')\n          let requestHappened = false\n\n          const requestPromise = new Promise<void>((resolve) => {\n            page.on('request', (request) => {\n              if (\n                request.url().startsWith(`http://localhost:${PORT}/_serverFn/`)\n              ) {\n                requestHappened = true\n                resolve()\n              }\n            })\n          })\n          await link.focus()\n\n          const expectRequestHappened = preload && !reloadDocument\n          const timeoutPromise = new Promise((resolve) =>\n            setTimeout(resolve, expectRequestHappened ? 5000 : 500),\n          )\n          await Promise.race([requestPromise, timeoutPromise])\n          expect(requestHappened).toBe(expectRequestHappened)\n          let fullPageLoad = false\n          page.on('domcontentloaded', () => {\n            fullPageLoad = true\n          })\n\n          await link.click()\n\n          const url = `http://localhost:${PORT}/posts`\n          await page.waitForURL(url)\n          expect(page.url()).toBe(url)\n          await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n          expect(fullPageLoad).toBe(reloadDocument)\n        })\n      },\n    )\n\n    const internalDirectVisitTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n      reloadDocument: [false, true] as const,\n    })\n\n    internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => {\n      test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({\n        page,\n      }) => {\n        await page.goto(`/redirect/internal/via-${thrower}`)\n        await page.waitForLoadState('networkidle')\n\n        const url = `http://localhost:${PORT}/posts`\n\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n      })\n    })\n  })\n\n  test.describe('external', () => {\n    const externalTestMatrix = combinate({\n      scenario: ['navigate', 'direct_visit'] as const,\n      thrower: ['beforeLoad', 'loader'] as const,\n    })\n\n    externalTestMatrix.forEach(({ scenario, thrower }) => {\n      test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({\n        page,\n      }) => {\n        const q = queryString.stringify({\n          externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n        })\n\n        if (scenario === 'navigate') {\n          await page.goto(`/redirect/external?${q}`)\n          await page.waitForLoadState('networkidle')\n          const link = page.getByTestId(`via-${thrower}`)\n          await link.focus()\n          await link.click()\n        } else {\n          await page.goto(`/redirect/external/via-${thrower}?${q}`)\n        }\n\n        const url = `http://localhost:${EXTERNAL_HOST_PORT}/`\n\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n      })\n    })\n  })\n\n  test.describe('serverFn', () => {\n    const serverFnTestMatrix = combinate({\n      target: ['internal', 'external'] as const,\n      scenario: ['navigate', 'direct_visit'] as const,\n      thrower: ['beforeLoad', 'loader'] as const,\n      reloadDocument: [false, true] as const,\n    })\n\n    serverFnTestMatrix.forEach(\n      ({ target, thrower, scenario, reloadDocument }) => {\n        test(`serverFn redirects to target: ${target}, scenario: ${scenario}, thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({\n          page,\n        }) => {\n          let fullPageLoad = false\n          const q = queryString.stringify({\n            externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n            reloadDocument,\n          })\n\n          if (scenario === 'navigate') {\n            await page.goto(`/redirect/${target}/serverFn?${q}`)\n            await page.waitForLoadState('networkidle')\n\n            const link = page.getByTestId(\n              `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`,\n            )\n\n            page.on('domcontentloaded', () => {\n              fullPageLoad = true\n            })\n\n            await link.focus()\n            await page.waitForLoadState('networkidle')\n            await link.click()\n          } else {\n            await page.goto(`/redirect/${target}/serverFn/via-${thrower}?${q}`)\n          }\n\n          const url =\n            target === 'internal'\n              ? `http://localhost:${PORT}/posts`\n              : `http://localhost:${EXTERNAL_HOST_PORT}/`\n\n          await page.waitForURL(url)\n\n          expect(page.url()).toBe(url)\n\n          if (target === 'internal' && scenario === 'navigate') {\n            await expect(\n              page.getByTestId('PostsIndexComponent'),\n            ).toBeInViewport()\n            expect(fullPageLoad).toBe(reloadDocument)\n          }\n        })\n      },\n    )\n  })\n\n  test.describe('useServerFn', () => {\n    const useServerFnTestMatrix = combinate({\n      target: ['internal', 'external'] as const,\n      reloadDocument: [false, true] as const,\n    })\n\n    useServerFnTestMatrix.forEach(({ target, reloadDocument }) => {\n      test(`useServerFn redirects to target: ${target}, reloadDocument: ${reloadDocument}`, async ({\n        page,\n      }) => {\n        const q = queryString.stringify({\n          externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n          reloadDocument,\n        })\n\n        await page.goto(`/redirect/${target}/serverFn/via-useServerFn?${q}`)\n\n        await page.waitForLoadState('networkidle')\n\n        const button = page.getByTestId('redirect-on-click')\n\n        let fullPageLoad = false\n        page.on('domcontentloaded', () => {\n          fullPageLoad = true\n        })\n\n        await button.click()\n\n        const url =\n          target === 'internal'\n            ? `http://localhost:${PORT}/posts`\n            : `http://localhost:${EXTERNAL_HOST_PORT}/`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        if (target === 'internal') {\n          await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n          expect(fullPageLoad).toBe(reloadDocument)\n        }\n      })\n    })\n  })\n\n  test('multiple Set-Cookie headers are preserved on redirect', async ({\n    page,\n  }) => {\n    // This test verifies that multiple Set-Cookie headers are not lost during redirect\n    await page.goto('/multi-cookie-redirect')\n\n    // Wait for redirect to complete\n    await page.waitForURL(/\\/multi-cookie-redirect\\/target/)\n\n    // Should redirect to target page\n    await expect(page.getByTestId('multi-cookie-redirect-target')).toBeVisible()\n    expect(page.url()).toContain('/multi-cookie-redirect/target')\n\n    // Verify all three cookies were preserved during the redirect\n    await expect(page.getByTestId('cookie-session')).toHaveText('session-value')\n    await expect(page.getByTestId('cookie-csrf')).toHaveText('csrf-token-value')\n    await expect(page.getByTestId('cookie-theme')).toHaveText('dark')\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/root-scripts.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\n// All user-rendered scripts added in __root.tsx (not via head() API)\nconst ALL_USER_SCRIPTS = [\n  'USER_SCRIPT', // <script src=\"user-script.js\" /> after <Scripts />\n  'ASYNC_USER_SCRIPT', // <script src=\"async-user-script.js\" async /> after <Scripts />\n  'HEAD_SCRIPT', // <script src=\"head-script.js\" /> in <head>\n  'HEAD_ASYNC_SCRIPT', // <script src=\"head-async-script.js\" async /> in <head>\n  'BEFORE_SCRIPTS_SCRIPT', // <script src=\"before-scripts-script.js\" /> before <Scripts />\n  'BEFORE_SCRIPTS_ASYNC_SCRIPT', // <script src=\"before-scripts-async-script.js\" async /> before <Scripts />\n] as const\n\ntest.describe('User-rendered scripts in __root.tsx', () => {\n  test('should not cause hydration errors on SSR load', async ({ page }) => {\n    const consoleErrors: Array<string> = []\n    page.on('console', (m) => {\n      if (m.type() === 'error') {\n        consoleErrors.push(m.text())\n      }\n    })\n\n    await page.goto('/')\n\n    // All user-rendered scripts should have executed\n    for (const scriptVar of ALL_USER_SCRIPTS) {\n      await page.waitForFunction(\n        (v) => (window as any)[v] === true,\n        scriptVar,\n        { timeout: 5000 },\n      )\n    }\n\n    // Assert no hydration errors occurred\n    const hydrationErrors = consoleErrors.filter(\n      (e) =>\n        e.includes('Hydration') ||\n        e.includes('hydration') ||\n        e.includes(\"didn't match\"),\n    )\n    expect(hydrationErrors).toEqual([])\n  })\n\n  test('should execute on client-side navigation to another route', async ({\n    page,\n  }) => {\n    await page.goto('/posts')\n\n    await page.getByRole('link', { name: 'Home' }).click()\n    await expect(page.getByText('Welcome Home!!!')).toBeInViewport()\n\n    // Root layout scripts should have executed during the initial page load\n    for (const scriptVar of ALL_USER_SCRIPTS) {\n      await page.waitForFunction(\n        (v) => (window as any)[v] === true,\n        scriptVar,\n        { timeout: 5000 },\n      )\n    }\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/script-duplication.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.describe('Async Script Hydration', () => {\n  test('should not show hydration warning for async scripts', async ({\n    page,\n  }) => {\n    await page.goto('/async-scripts')\n    await expect(\n      page.getByTestId('async-scripts-test-heading'),\n    ).toBeInViewport()\n\n    await page.waitForFunction(() => (window as any).SCRIPT_1 === true)\n  })\n\n  test('should load async and defer scripts correctly', async ({ page }) => {\n    await page.goto('/async-scripts')\n    await expect(\n      page.getByTestId('async-scripts-test-heading'),\n    ).toBeInViewport()\n\n    // script.js (async) sets window.SCRIPT_1 = true\n    // script2.js (defer) sets window.SCRIPT_2 = true\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n    expect(await page.evaluate('window.SCRIPT_2')).toBe(true)\n  })\n})\n\ntest.describe('Script Duplication Prevention', () => {\n  test('should not create duplicate scripts on SSR route', async ({ page }) => {\n    await page.goto('/scripts')\n\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    // Wait for the script to execute — React 19 hoists <script src> as a\n    // resource during SSR hydration, so the DOM element may not persist in\n    // a queryable form.  Execution is the reliable check.\n    await page.waitForFunction(() => (window as any).SCRIPT_1 === true)\n\n    const scriptCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"/script.js\"]').length\n    })\n    expect(scriptCount).toBeLessThanOrEqual(1)\n\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate scripts during client-side navigation', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const firstNavCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(firstNavCount).toBe(1)\n\n    await page.getByRole('link', { name: 'Home' }).click()\n    await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const secondNavCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(secondNavCount).toBe(1)\n\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate scripts with multiple navigation cycles', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    for (let i = 0; i < 3; i++) {\n      await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n      await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n      await page.getByRole('link', { name: 'Home' }).click()\n      await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n    }\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const finalCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(finalCount).toBe(1)\n\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate inline scripts', async ({ page }) => {\n    await page.goto('/inline-scripts')\n\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    // Wait for scripts to execute — useEffect may need a tick after hydration.\n    // React 19 may hoist inline scripts as resources, so the DOM element may\n    // not persist; script execution is the reliable check for SSR routes.\n    await page.waitForFunction(() => (window as any).INLINE_SCRIPT_1 === true)\n    await page.waitForFunction(() => (window as any).INLINE_SCRIPT_2 === 'test')\n\n    // React 19 can hoist/dedupe <script> tags during hydration. Between that\n    // and TanStack Router's client-side imperative injection (which may\n    // intentionally skip injection if a matching script already exists), the\n    // resulting script node might not be consistently queryable in a single\n    // fixed place.\n    //\n    // What we *can* assert reliably for SSR routes is \"not duplicated\" (<= 1),\n    // not \"exactly one\".\n    const inlineScript1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n    expect(inlineScript1Count).toBeLessThanOrEqual(1)\n\n    const inlineScript2Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_2 = \"test\"'),\n      ).length\n    })\n    expect(inlineScript2Count).toBeLessThanOrEqual(1)\n\n    expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)\n    expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')\n  })\n\n  test('should not create duplicate inline scripts during client-side navigation', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    await page.getByRole('link', { name: 'Inline Scripts' }).click()\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    const firstNavScript1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n    expect(firstNavScript1Count).toBe(1)\n\n    await page.getByRole('link', { name: 'Home' }).click()\n    await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n\n    await page.getByRole('link', { name: 'Inline Scripts' }).click()\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    const secondNavScript1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n    expect(secondNavScript1Count).toBe(1)\n\n    // Verify the scripts are still working\n    expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)\n    expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/search-params.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from 'tests/utils/isSpaMode'\nimport { isPrerender } from './utils/isPrerender'\nimport type { Response } from '@playwright/test'\n\nfunction expectRedirect(response: Response | null, endsWith: string) {\n  expect(response).not.toBeNull()\n  expect(response!.request().redirectedFrom()).not.toBeNull()\n  const redirectUrl = response!\n    .request()\n    .redirectedFrom()!\n    .redirectedTo()\n    ?.url()\n  expect(redirectUrl).toBeDefined()\n  expect(redirectUrl!.endsWith(endsWith))\n}\n\nfunction expectNoRedirect(response: Response | null) {\n  expect(response).not.toBeNull()\n  const request = response!.request()\n  expect(request.redirectedFrom()).toBeNull()\n}\n\ntest.describe('/search-params/loader-throws-redirect', () => {\n  test('Directly visiting the route without search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/loader-throws-redirect')\n\n    if (!isSpaMode && !isPrerender) {\n      expectRedirect(response, '/search-params/loader-throws-redirect?step=a')\n    }\n\n    await expect(page.getByTestId('search-param')).toContainText('a')\n    expect(page.url().endsWith('/search-params/loader-throws-redirect?step=a'))\n  })\n\n  test('Directly visiting the route with search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto(\n      '/search-params/loader-throws-redirect?step=b',\n    )\n    expectNoRedirect(response)\n    await expect(page.getByTestId('search-param')).toContainText('b')\n    expect(page.url().endsWith('/search-params/loader-throws-redirect?step=b'))\n  })\n})\n\ntest.describe('/search-params/default', () => {\n  test('Directly visiting the route without search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/default')\n    if (!isSpaMode && !isPrerender) {\n      expectRedirect(response, '/search-params/default?default=d1')\n    }\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/default?default=d2')\n    expectNoRedirect(response)\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route without search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-without-search').click()\n\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-with-search').click()\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/basic/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/basic/tests/special-characters.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from './utils/isSpaMode'\n\ntest.use({\n  whitelistErrors: [\n    /Failed to load resource: the server responded with a status of 404/,\n  ],\n})\ntest.describe('Unicode route rendering', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/specialChars')\n  })\n\n  test('should render non-latin route correctly with direct navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto('/specialChars/대한민국')\n    await page.waitForURL(\n      `${baseURL}/specialChars/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`,\n    )\n\n    await expect(page.getByTestId('special-non-latin-heading')).toBeInViewport()\n  })\n\n  test('should render non-latin route correctly during router navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    const nonLatinLink = page.getByTestId('special-non-latin-link')\n\n    await nonLatinLink.click()\n    await page.waitForURL(\n      `${baseURL}/specialChars/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`,\n    )\n\n    await expect(page.getByTestId('special-non-latin-heading')).toBeInViewport()\n  })\n\n  test.describe('Special characters in path params', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/대|')\n      await page.waitForURL(`${baseURL}/specialChars/%EB%8C%80%7C`)\n\n      const param = await page.getByTestId('special-param').textContent()\n\n      expect(param).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const link = page.getByTestId('special-param-link')\n\n      await link.click()\n      await page.waitForURL(`${baseURL}/specialChars/%EB%8C%80%7C`)\n\n      const param = await page.getByTestId('special-param').textContent()\n\n      expect(param).toBe('대|')\n    })\n  })\n\n  test.describe('Special characters in search params', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/search?searchParam=대|')\n\n      await page.waitForURL(\n        `${baseURL}/specialChars/search?searchParam=%EB%8C%80|`,\n      )\n\n      const searchParam = await page\n        .getByTestId('special-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const link = page.getByTestId('special-searchParam-link')\n\n      await link.click()\n      await page.waitForURL(\n        `${baseURL}/specialChars/search?searchParam=%EB%8C%80%7C`,\n      )\n\n      const searchParam = await page\n        .getByTestId('special-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('대|')\n    })\n  })\n\n  test.describe('Special characters in url hash', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await expect(page.getByTestId('special-hash-link-1')).not.toContainClass(\n        'font-bold',\n      )\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.goto('/specialChars/hash#대|')\n\n      await page.waitForURL(`${baseURL}/specialChars/hash#%EB%8C%80|`)\n      await page.waitForLoadState('load')\n\n      await expect(page.getByTestId('special-hash-heading')).toBeInViewport()\n\n      await expect(page.getByTestId('special-hash-link-1')).toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.getByTestId('toggle-hash-button').click()\n\n      const hashValue = await page.getByTestId('special-hash').textContent()\n\n      expect(hashValue).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await expect(page.getByTestId('special-hash-link-1')).not.toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      const link = page.getByTestId('special-hash-link-1')\n\n      await link.click()\n\n      await page.waitForURL(`${baseURL}/specialChars/hash#%EB%8C%80|`)\n      await page.waitForLoadState('load')\n\n      await expect(page.getByTestId('special-hash-heading')).toBeInViewport()\n\n      await expect(page.getByTestId('special-hash-link-1')).toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.getByTestId('toggle-hash-button').click()\n\n      const hashValue = await page.getByTestId('special-hash').textContent()\n\n      expect(hashValue).toBe('대|')\n    })\n  })\n\n  test.describe('malformed paths', () => {\n    test.use({\n      whitelistErrors: [\n        'Failed to load resource: the server responded with a status of 404',\n        'Failed to load resource: the server responded with a status of 400 (Bad Request)',\n      ],\n    })\n\n    test('un-matched malformed paths should return not found on direct navigation', async ({\n      page,\n    }) => {\n      const res = await page.goto('/specialChars/malformed/%E0%A4')\n\n      await page.waitForLoadState(`load`)\n\n      // in spa mode this is caught and handled at server level\n      if (!isSpaMode) {\n        expect(res!.status()).toBe(404)\n\n        await expect(\n          page.getByTestId('default-not-found-component'),\n        ).toBeInViewport()\n      } else {\n        expect(res!.status()).toBe(400)\n      }\n    })\n\n    test('malformed path params should return not found on router link', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/malformed')\n      await page.waitForURL(`${baseURL}/specialChars/malformed`)\n\n      const link = page.getByTestId('special-malformed-path-link')\n\n      await link.click()\n\n      await page.waitForLoadState('load')\n\n      await expect(\n        page.getByTestId('default-not-found-component'),\n      ).toBeInViewport()\n    })\n\n    test('un-matched malformed paths should return not found on direct navigation in search params', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/malformed/search?searchParam=%E0%A4')\n\n      await page.waitForURL(\n        `${baseURL}/specialChars/malformed/search?searchParam=%E0%A4`,\n      )\n\n      await expect(\n        page.getByTestId('special-malformed-search-param'),\n      ).toBeInViewport()\n\n      const searchParam = await page\n        .getByTestId('special-malformed-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('�')\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/streaming.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('Navigating to deferred route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Deferred' }).click()\n\n  await expect(page.getByTestId('regular-person')).toContainText('John Doe')\n  await expect(page.getByTestId('deferred-person')).toContainText(\n    'Tanner Linsley',\n  )\n  await expect(page.getByTestId('deferred-stuff')).toContainText(\n    'Hello deferred!',\n  )\n})\n\ntest('Directly visiting the deferred route', async ({ page }) => {\n  await page.goto('/deferred')\n\n  await expect(page.getByTestId('regular-person')).toContainText('John Doe')\n  await expect(page.getByTestId('deferred-person')).toContainText(\n    'Tanner Linsley',\n  )\n  await expect(page.getByTestId('deferred-stuff')).toContainText(\n    'Hello deferred!',\n  )\n})\n\ntest('streaming loader data', async ({ page }) => {\n  await page.goto('/stream')\n\n  await expect(page.getByTestId('promise-data')).toContainText('promise-data')\n  await expect(page.getByTestId('stream-data')).toContainText('stream-data')\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/type-only-reexport.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\n/**\n * These tests verify the compiler can handle type-only module re-exports.\n *\n * The scenario:\n * 1. ~/shared-lib/index.ts re-exports from ./middleware and ./types\n * 2. ~/shared-lib/types/index.ts re-exports from ./actions.ts\n * 3. ~/shared-lib/types/actions.ts contains ONLY type exports (no runtime code)\n *\n * After TypeScript compilation, actions.ts becomes an empty JavaScript module.\n * The compiler must handle this gracefully when tracing exports through\n * barrel files. Without the fix, the build would fail with:\n * \"could not load module .../types/actions.ts\"\n *\n * If these tests pass, it proves the compiler correctly handles empty modules\n * when following re-export chains.\n */\n\ntest('page using middleware from barrel with type-only re-exports builds and renders', async ({\n  page,\n}) => {\n  // Navigate to the route that uses middleware from ~/shared-lib\n  // If the compiler fix isn't working, this page wouldn't exist because\n  // the build would have failed\n  await page.goto('/type-only-reexport')\n  await page.waitForURL('/type-only-reexport')\n\n  // The heading should be visible\n  await expect(page.getByTestId('type-only-heading')).toContainText(\n    'Type-Only Re-export Test',\n  )\n\n  // The server function should have executed and returned data\n  await expect(page.getByTestId('message')).toContainText(\n    'Hello from server with type-only module re-exports!',\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/basic/tests/utils/isPrerender.ts",
    "content": "export const isPrerender: boolean = process.env.MODE === 'prerender'\n"
  },
  {
    "path": "e2e/react-start/basic/tests/utils/isPreview.ts",
    "content": "export const isPreview: boolean = process.env.MODE === 'preview'\n"
  },
  {
    "path": "e2e/react-start/basic/tests/utils/isSpaMode.ts",
    "content": "export const isSpaMode: boolean = process.env.MODE === 'spa'\n"
  },
  {
    "path": "e2e/react-start/basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\nimport { isSpaMode } from './tests/utils/isSpaMode'\nimport { isPrerender } from './tests/utils/isPrerender'\n\nconst spaModeConfiguration = {\n  enabled: true,\n  prerender: {\n    outputPath: 'index.html',\n  },\n}\n\nconst prerenderConfiguration = {\n  enabled: true,\n  filter: (page: { path: string }) =>\n    ![\n      '/this-route-does-not-exist',\n      '/redirect',\n      '/i-do-not-exist',\n      '/not-found',\n      '/specialChars/search',\n      '/specialChars/hash',\n      '/specialChars/malformed',\n      '/users',\n    ].some((p) => page.path.includes(p)),\n  maxRedirects: 100,\n}\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      spa: isSpaMode ? spaModeConfiguration : undefined,\n      prerender: isPrerender ? prerenderConfiguration : undefined,\n    }),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-auth/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/.env",
    "content": "# Environment variables declared in this file are automatically made available to Prisma.\n# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema\n\n# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.\n# See the documentation for all the connection string options: https://pris.ly/d/connection-strings\n\nDATABASE_URL=\"file:./dev.db\""
  },
  {
    "path": "e2e/react-start/basic-auth/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n!.env\n.DS_Store\n.cache\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/basic-auth/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/basic-auth/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-basic-auth\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node .output/server/index.mjs\",\n    \"prisma-generate\": \"prisma generate\",\n    \"test:e2e\": \"exit 0; rm -rf port*.txt; pnpm run prisma-generate && playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@libsql/client\": \"^0.15.15\",\n    \"@prisma/adapter-libsql\": \"^7.0.0\",\n    \"@prisma/client\": \"^7.0.0\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"dotenv\": \"^17.2.3\",\n    \"prisma\": \"^7.0.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-auth/prisma/migrations/20240811183753_init/migration.sql",
    "content": "-- CreateTable\nCREATE TABLE \"User\" (\n    \"email\" TEXT NOT NULL PRIMARY KEY,\n    \"password\" TEXT NOT NULL\n);\n\n-- CreateIndex\nCREATE UNIQUE INDEX \"User_email_key\" ON \"User\"(\"email\");\n"
  },
  {
    "path": "e2e/react-start/basic-auth/prisma/migrations/migration_lock.toml",
    "content": "# Please do not edit this file manually\n# It should be added in your version-control system (i.e. Git)\nprovider = \"sqlite\""
  },
  {
    "path": "e2e/react-start/basic-auth/prisma/schema.prisma",
    "content": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n  provider = \"prisma-client\"\n  output   = \"../src/prisma-generated\"\n}\n\ndatasource db {\n  provider = \"sqlite\"\n}\n\nmodel User {\n  email String @id @unique\n  password String\n}"
  },
  {
    "path": "e2e/react-start/basic-auth/prisma.config.ts",
    "content": "import 'dotenv/config'\nimport { defineConfig, env } from 'prisma/config'\n\nexport default defineConfig({\n  schema: './prisma/schema.prisma',\n  migrations: {\n    path: './prisma/migrations',\n  },\n  datasource: {\n    url: env('DATABASE_URL'),\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic-auth/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/components/Auth.tsx",
    "content": "export function Auth({\n  actionText,\n  onSubmit,\n  status,\n  afterSubmit,\n}: {\n  actionText: string\n  onSubmit: (e: React.FormEvent<HTMLFormElement>) => void\n  status: 'pending' | 'idle' | 'success' | 'error'\n  afterSubmit?: React.ReactNode\n}) {\n  return (\n    <div className=\"fixed inset-0 bg-white dark:bg-black flex items-start justify-center p-8\">\n      <div className=\"bg-white dark:bg-gray-900 p-8 rounded-lg shadow-lg\">\n        <h1 className=\"text-2xl font-bold mb-4\">{actionText}</h1>\n        <form\n          onSubmit={(e) => {\n            e.preventDefault()\n            onSubmit(e)\n          }}\n          className=\"space-y-4\"\n        >\n          <div>\n            <label htmlFor=\"email\" className=\"block text-xs\">\n              Email\n            </label>\n            <input\n              type=\"email\"\n              name=\"email\"\n              id=\"email\"\n              className=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <div>\n            <label htmlFor=\"password\" className=\"block text-xs\">\n              Password\n            </label>\n            <input\n              type=\"password\"\n              name=\"password\"\n              id=\"password\"\n              className=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <button\n            type=\"submit\"\n            className=\"w-full bg-cyan-600 text-white rounded-sm py-2 font-black uppercase\"\n            disabled={status === 'pending'}\n          >\n            {status === 'pending' ? '...' : actionText}\n          </button>\n          {afterSubmit ? afterSubmit : null}\n        </form>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/components/Login.tsx",
    "content": "import { useRouter } from '@tanstack/react-router'\nimport { useServerFn } from '@tanstack/react-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { loginFn } from '../routes/_authed'\nimport { Auth } from './Auth'\nimport { signupFn } from '~/routes/signup'\n\nexport function Login() {\n  const router = useRouter()\n\n  const loginMutation = useMutation({\n    fn: loginFn,\n    onSuccess: async (ctx) => {\n      if (!ctx.data?.error) {\n        await router.invalidate()\n        router.navigate({ to: '/' })\n        return\n      }\n    },\n  })\n\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Login\"\n      status={loginMutation.status}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as HTMLFormElement)\n\n        loginMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        loginMutation.data ? (\n          <>\n            <div className=\"text-red-400\">{loginMutation.data.message}</div>\n            {loginMutation.data.userNotFound ? (\n              <div>\n                <button\n                  className=\"text-blue-500\"\n                  onClick={(e) => {\n                    const formData = new FormData(\n                      (e.target as HTMLButtonElement).form!,\n                    )\n\n                    signupMutation.mutate({\n                      data: {\n                        email: formData.get('email') as string,\n                        password: formData.get('password') as string,\n                      },\n                    })\n                  }}\n                  type=\"button\"\n                >\n                  Sign up instead?\n                </button>\n              </div>\n            ) : null}\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/hooks/useMutation.ts",
    "content": "import * as React from 'react'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = React.useState<number | undefined>()\n  const [variables, setVariables] = React.useState<TVariables | undefined>()\n  const [error, setError] = React.useState<TError | undefined>()\n  const [data, setData] = React.useState<TData | undefined>()\n  const [status, setStatus] = React.useState<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = React.useCallback(\n    async (variables: TVariables): Promise<TData | undefined> => {\n      setStatus('pending')\n      setSubmittedAt(Date.now())\n      setVariables(variables)\n      //\n      try {\n        const data = await opts.fn(variables)\n        await opts.onSuccess?.({ data })\n        setStatus('success')\n        setError(undefined)\n        setData(data)\n        return data\n      } catch (err: any) {\n        setStatus('error')\n        setError(err)\n      }\n    },\n    [opts.fn],\n  )\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/browser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma-related types and utilities in a browser.\n * Use it to get access to models, enums, and input types.\n *\n * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.\n * See `client.ts` for the standard, server-side entry point.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as Prisma from './internal/prismaNamespaceBrowser'\nexport { Prisma }\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/client.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.\n * If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as process from 'node:process'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nglobalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport * as $Class from './internal/class'\nimport * as Prisma from './internal/prismaNamespace'\n\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\nexport const PrismaClient = $Class.getPrismaClientClass()\nexport type PrismaClient<\n  LogOpts extends Prisma.LogLevel = never,\n  OmitOpts extends Prisma.PrismaClientOptions['omit'] =\n    Prisma.PrismaClientOptions['omit'],\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>\nexport { Prisma }\n\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/commonInputTypes.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports various common sort, input & filter types that are not directly linked to a particular model.\n *\n * 🟢 You can import this file directly.\n */\n\nimport type * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport type * as Prisma from './internal/prismaNamespace'\n\nexport type StringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type StringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedStringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type NestedStringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedIntFilter<$PrismaModel = never> = {\n  equals?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  in?: number[]\n  notIn?: number[]\n  lt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  lte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedIntFilter<$PrismaModel> | number\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/enums.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports all enum related types from the schema.\n *\n * 🟢 You can import this file directly.\n */\n\n// This file is empty because there are no enums in the schema.\nexport {}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/internal/class.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * Please import the `PrismaClient` class from the `client.ts` file instead.\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from './prismaNamespace'\n\nconst config: runtime.GetPrismaClientConfig = {\n  previewFeatures: [],\n  clientVersion: '7.0.0',\n  engineVersion: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n  activeProvider: 'sqlite',\n  inlineSchema:\n    '// This is your Prisma schema file,\\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\\n\\ngenerator client {\\n  provider = \"prisma-client\"\\n  output   = \"../src/prisma-generated\"\\n}\\n\\ndatasource db {\\n  provider = \"sqlite\"\\n}\\n\\nmodel User {\\n  email    String @id @unique\\n  password String\\n}\\n',\n  runtimeDataModel: {\n    models: {},\n    enums: {},\n    types: {},\n  },\n}\n\nconfig.runtimeDataModel = JSON.parse(\n  '{\"models\":{\"User\":{\"fields\":[{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}',\n)\n\nasync function decodeBase64AsWasm(\n  wasmBase64: string,\n): Promise<WebAssembly.Module> {\n  const { Buffer } = await import('node:buffer')\n  const wasmArray = Buffer.from(wasmBase64, 'base64')\n  return new WebAssembly.Module(wasmArray)\n}\n\nconfig.compilerWasm = {\n  getRuntime: async () =>\n    await import('@prisma/client/runtime/query_compiler_bg.sqlite.mjs'),\n\n  getQueryCompilerWasmModule: async () => {\n    const { wasm } =\n      await import('@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs')\n    return await decodeBase64AsWasm(wasm)\n  },\n}\n\nexport type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =\n  'log' extends keyof ClientOptions\n    ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition>\n      ? Prisma.GetEvents<ClientOptions['log']>\n      : never\n    : never\n\nexport interface PrismaClientConstructor {\n  /**\n   * ## Prisma Client\n   *\n   * Type-safe database client for TypeScript\n   * @example\n   * ```\n   * const prisma = new PrismaClient()\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n   */\n\n  new <\n    Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,\n    LogOpts extends LogOptions<Options> = LogOptions<Options>,\n    OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {\n      omit: infer U\n    }\n      ? U\n      : Prisma.PrismaClientOptions['omit'],\n    ExtArgs extends runtime.Types.Extensions.InternalArgs =\n      runtime.Types.Extensions.DefaultArgs,\n  >(\n    options: Prisma.Subset<Options, Prisma.PrismaClientOptions>,\n  ): PrismaClient<LogOpts, OmitOpts, ExtArgs>\n}\n\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\n\nexport interface PrismaClient<\n  in LogOpts extends Prisma.LogLevel = never,\n  in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,\n  in out ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> {\n  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }\n\n  $on<V extends LogOpts>(\n    eventType: V,\n    callback: (\n      event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent,\n    ) => void,\n  ): PrismaClient\n\n  /**\n   * Connect with the database\n   */\n  $connect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Disconnect from the database\n   */\n  $disconnect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Executes a prepared raw query and returns the number of affected rows.\n   * @example\n   * ```\n   * const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Executes a raw query and returns the number of affected rows.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Performs a prepared raw query and returns the `SELECT` data.\n   * @example\n   * ```\n   * const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Performs a raw query and returns the `SELECT` data.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.\n   * @example\n   * ```\n   * const [george, bob, alice] = await prisma.$transaction([\n   *   prisma.user.create({ data: { name: 'George' } }),\n   *   prisma.user.create({ data: { name: 'Bob' } }),\n   *   prisma.user.create({ data: { name: 'Alice' } }),\n   * ])\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).\n   */\n  $transaction<P extends Prisma.PrismaPromise<any>[]>(\n    arg: [...P],\n    options?: { isolationLevel?: Prisma.TransactionIsolationLevel },\n  ): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>\n\n  $transaction<R>(\n    fn: (\n      prisma: Omit<PrismaClient, runtime.ITXClientDenyList>,\n    ) => runtime.Types.Utils.JsPromise<R>,\n    options?: {\n      maxWait?: number\n      timeout?: number\n      isolationLevel?: Prisma.TransactionIsolationLevel\n    },\n  ): runtime.Types.Utils.JsPromise<R>\n\n  $extends: runtime.Types.Extensions.ExtendsHook<\n    'extends',\n    Prisma.TypeMapCb<OmitOpts>,\n    ExtArgs,\n    runtime.Types.Utils.Call<\n      Prisma.TypeMapCb<OmitOpts>,\n      {\n        extArgs: ExtArgs\n      }\n    >\n  >\n\n  /**\n   * `prisma.user`: Exposes CRUD operations for the **User** model.\n   * Example usage:\n   * ```ts\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   */\n  get user(): Prisma.UserDelegate<ExtArgs, { omit: OmitOpts }>\n}\n\nexport function getPrismaClientClass(): PrismaClientConstructor {\n  return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/internal/prismaNamespace.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the client.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from '../models'\nimport { type PrismaClient } from './class'\n\nexport type * from '../models'\n\nexport type DMMF = typeof runtime.DMMF\n\nexport type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>\n\n/**\n * Prisma Errors\n */\n\nexport const PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\nexport type PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\n\nexport const PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\nexport type PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\n\nexport const PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\nexport type PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\n\nexport const PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\nexport type PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\n\nexport const PrismaClientValidationError = runtime.PrismaClientValidationError\nexport type PrismaClientValidationError = runtime.PrismaClientValidationError\n\n/**\n * Re-export of sql-template-tag\n */\nexport const sql = runtime.sqltag\nexport const empty = runtime.empty\nexport const join = runtime.join\nexport const raw = runtime.raw\nexport const Sql = runtime.Sql\nexport type Sql = runtime.Sql\n\n/**\n * Decimal.js\n */\nexport const Decimal = runtime.Decimal\nexport type Decimal = runtime.Decimal\n\nexport type DecimalJsLike = runtime.DecimalJsLike\n\n/**\n * Extensions\n */\nexport type Extension = runtime.Types.Extensions.UserArgs\nexport const getExtensionContext = runtime.Extensions.getExtensionContext\nexport type Args<T, F extends runtime.Operation> = runtime.Types.Public.Args<\n  T,\n  F\n>\nexport type Payload<\n  T,\n  F extends runtime.Operation = never,\n> = runtime.Types.Public.Payload<T, F>\nexport type Result<\n  T,\n  A,\n  F extends runtime.Operation,\n> = runtime.Types.Public.Result<T, A, F>\nexport type Exact<A, W> = runtime.Types.Public.Exact<A, W>\n\nexport type PrismaVersion = {\n  client: string\n  engine: string\n}\n\n/**\n * Prisma Client JS version: 7.0.0\n * Query Engine version: 0c19ccc313cf9911a90d99d2ac2eb0280c76c513\n */\nexport const prismaVersion: PrismaVersion = {\n  client: '7.0.0',\n  engine: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n}\n\n/**\n * Utility Types\n */\n\nexport type Bytes = runtime.Bytes\nexport type JsonObject = runtime.JsonObject\nexport type JsonArray = runtime.JsonArray\nexport type JsonValue = runtime.JsonValue\nexport type InputJsonObject = runtime.InputJsonObject\nexport type InputJsonArray = runtime.InputJsonArray\nexport type InputJsonValue = runtime.InputJsonValue\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\ntype SelectAndInclude = {\n  select: any\n  include: any\n}\n\ntype SelectAndOmit = {\n  select: any\n  omit: any\n}\n\n/**\n * From T, pick a set of properties whose keys are in the union K\n */\ntype Prisma__Pick<T, K extends keyof T> = {\n  [P in K]: T[P]\n}\n\nexport type Enumerable<T> = T | Array<T>\n\n/**\n * Subset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection\n */\nexport type Subset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n}\n\n/**\n * SelectSubset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection.\n * Additionally, it validates, if both select and include are present. If the case, it errors.\n */\nexport type SelectSubset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & (T extends SelectAndInclude\n  ? 'Please either choose `select` or `include`.'\n  : T extends SelectAndOmit\n    ? 'Please either choose `select` or `omit`.'\n    : {})\n\n/**\n * Subset + Intersection\n * @desc From `T` pick properties that exist in `U` and intersect `K`\n */\nexport type SubsetIntersection<T, U, K> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & K\n\ntype Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }\n\n/**\n * XOR is needed to have a real mutually exclusive union type\n * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types\n */\nexport type XOR<T, U> = T extends object\n  ? U extends object\n    ? (Without<T, U> & U) | (Without<U, T> & T)\n    : U\n  : T\n\n/**\n * Is T a Record?\n */\ntype IsObject<T extends any> =\n  T extends Array<any>\n    ? False\n    : T extends Date\n      ? False\n      : T extends Uint8Array\n        ? False\n        : T extends BigInt\n          ? False\n          : T extends object\n            ? True\n            : False\n\n/**\n * If it's T[], return T\n */\nexport type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T\n\n/**\n * From ts-toolbelt\n */\n\ntype __Either<O extends object, K extends Key> = Omit<O, K> &\n  {\n    // Merge all but K\n    [P in K]: Prisma__Pick<O, P & keyof O> // With K possibilities\n  }[K]\n\ntype EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>\n\ntype EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>\n\ntype _Either<O extends object, K extends Key, strict extends Boolean> = {\n  1: EitherStrict<O, K>\n  0: EitherLoose<O, K>\n}[strict]\n\nexport type Either<\n  O extends object,\n  K extends Key,\n  strict extends Boolean = 1,\n> = O extends unknown ? _Either<O, K, strict> : never\n\nexport type Union = any\n\nexport type PatchUndefined<O extends object, O1 extends object> = {\n  [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K]\n} & {}\n\n/** Helper Types for \"Merge\" **/\nexport type IntersectOf<U extends Union> = (\n  U extends unknown ? (k: U) => void : never\n) extends (k: infer I) => void\n  ? I\n  : never\n\nexport type Overwrite<O extends object, O1 extends object> = {\n  [K in keyof O]: K extends keyof O1 ? O1[K] : O[K]\n} & {}\n\ntype _Merge<U extends object> = IntersectOf<\n  Overwrite<\n    U,\n    {\n      [K in keyof U]-?: At<U, K>\n    }\n  >\n>\n\ntype Key = string | number | symbol\ntype AtStrict<O extends object, K extends Key> = O[K & keyof O]\ntype AtLoose<O extends object, K extends Key> = O extends unknown\n  ? AtStrict<O, K>\n  : never\nexport type At<O extends object, K extends Key, strict extends Boolean = 1> = {\n  1: AtStrict<O, K>\n  0: AtLoose<O, K>\n}[strict]\n\nexport type ComputeRaw<A extends any> = A extends Function\n  ? A\n  : {\n      [K in keyof A]: A[K]\n    } & {}\n\nexport type OptionalFlat<O> = {\n  [K in keyof O]?: O[K]\n} & {}\n\ntype _Record<K extends keyof any, T> = {\n  [P in K]: T\n}\n\n// cause typescript not to expand types and preserve names\ntype NoExpand<T> = T extends unknown ? T : never\n\n// this type assumes the passed object is entirely optional\nexport type AtLeast<O extends object, K extends string> = NoExpand<\n  O extends unknown\n    ?\n        | (K extends keyof O ? { [P in K]: O[P] } & O : O)\n        | ({ [P in keyof O as P extends K ? P : never]-?: O[P] } & O)\n    : never\n>\n\ntype _Strict<U, _U = U> = U extends unknown\n  ? U & OptionalFlat<_Record<Exclude<Keys<_U>, keyof U>, never>>\n  : never\n\nexport type Strict<U extends object> = ComputeRaw<_Strict<U>>\n/** End Helper Types for \"Merge\" **/\n\nexport type Merge<U extends object> = ComputeRaw<_Merge<Strict<U>>>\n\nexport type Boolean = True | False\n\nexport type True = 1\n\nexport type False = 0\n\nexport type Not<B extends Boolean> = {\n  0: 1\n  1: 0\n}[B]\n\nexport type Extends<A1 extends any, A2 extends any> = [A1] extends [never]\n  ? 0 // anything `never` is false\n  : A1 extends A2\n    ? 1\n    : 0\n\nexport type Has<U extends Union, U1 extends Union> = Not<\n  Extends<Exclude<U1, U>, U1>\n>\n\nexport type Or<B1 extends Boolean, B2 extends Boolean> = {\n  0: {\n    0: 0\n    1: 1\n  }\n  1: {\n    0: 1\n    1: 1\n  }\n}[B1][B2]\n\nexport type Keys<U extends Union> = U extends unknown ? keyof U : never\n\nexport type GetScalarType<T, O> = O extends object\n  ? {\n      [P in keyof T]: P extends keyof O ? O[P] : never\n    }\n  : never\n\ntype FieldPaths<T, U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>> =\n  IsObject<T> extends True ? U : T\n\nexport type GetHavingFields<T> = {\n  [K in keyof T]: Or<\n    Or<Extends<'OR', K>, Extends<'AND', K>>,\n    Extends<'NOT', K>\n  > extends True\n    ? // infer is only needed to not hit TS limit\n      // based on the brilliant idea of Pierre-Antoine Mills\n      // https://github.com/microsoft/TypeScript/issues/30188#issuecomment-478938437\n      T[K] extends infer TK\n      ? GetHavingFields<\n          UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never\n        >\n      : never\n    : {} extends FieldPaths<T[K]>\n      ? never\n      : K\n}[keyof T]\n\n/**\n * Convert tuple to union\n */\ntype _TupleToUnion<T> = T extends (infer E)[] ? E : never\ntype TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>\nexport type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T\n\n/**\n * Like `Pick`, but additionally can also accept an array of keys\n */\nexport type PickEnumerable<\n  T,\n  K extends Enumerable<keyof T> | keyof T,\n> = Prisma__Pick<T, MaybeTupleToUnion<K>>\n\n/**\n * Exclude all keys with underscores\n */\nexport type ExcludeUnderscoreKeys<T extends string> = T extends `_${string}`\n  ? never\n  : T\n\nexport type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>\n\ntype FieldRefInputType<Model, FieldType> = Model extends never\n  ? never\n  : FieldRef<Model, FieldType>\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\nexport interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils\n  .Fn<\n  { extArgs: runtime.Types.Extensions.InternalArgs },\n  runtime.Types.Utils.Record<string, any>\n> {\n  returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>\n}\n\nexport type TypeMap<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> = {\n  globalOmitOptions: {\n    omit: GlobalOmitOptions\n  }\n  meta: {\n    modelProps: 'user'\n    txIsolationLevel: TransactionIsolationLevel\n  }\n  model: {\n    User: {\n      payload: Prisma.$UserPayload<ExtArgs>\n      fields: Prisma.UserFieldRefs\n      operations: {\n        findUnique: {\n          args: Prisma.UserFindUniqueArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findUniqueOrThrow: {\n          args: Prisma.UserFindUniqueOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findFirst: {\n          args: Prisma.UserFindFirstArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findFirstOrThrow: {\n          args: Prisma.UserFindFirstOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findMany: {\n          args: Prisma.UserFindManyArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        create: {\n          args: Prisma.UserCreateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        createMany: {\n          args: Prisma.UserCreateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        createManyAndReturn: {\n          args: Prisma.UserCreateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        delete: {\n          args: Prisma.UserDeleteArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        update: {\n          args: Prisma.UserUpdateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        deleteMany: {\n          args: Prisma.UserDeleteManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateMany: {\n          args: Prisma.UserUpdateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateManyAndReturn: {\n          args: Prisma.UserUpdateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        upsert: {\n          args: Prisma.UserUpsertArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        aggregate: {\n          args: Prisma.UserAggregateArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.AggregateUser>\n        }\n        groupBy: {\n          args: Prisma.UserGroupByArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.UserGroupByOutputType>[]\n        }\n        count: {\n          args: Prisma.UserCountArgs<ExtArgs>\n          result:\n            | runtime.Types.Utils.Optional<Prisma.UserCountAggregateOutputType>\n            | number\n        }\n      }\n    }\n  }\n} & {\n  other: {\n    payload: any\n    operations: {\n      $executeRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $executeRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n      $queryRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $queryRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n    }\n  }\n}\n\n/**\n * Enums\n */\n\nexport const TransactionIsolationLevel = runtime.makeStrictEnum({\n  Serializable: 'Serializable',\n} as const)\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n\n/**\n * Field references\n */\n\n/**\n * Reference to a field of type 'String'\n */\nexport type StringFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'String'\n>\n\n/**\n * Reference to a field of type 'Int'\n */\nexport type IntFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'Int'\n>\n\n/**\n * Batch Payload for updateMany & deleteMany & createMany\n */\nexport type BatchPayload = {\n  count: number\n}\n\nexport const defineExtension = runtime.Extensions\n  .defineExtension as unknown as runtime.Types.Extensions.ExtendsHook<\n  'define',\n  TypeMapCb,\n  runtime.Types.Extensions.DefaultArgs\n>\nexport type DefaultPrismaClient = PrismaClient\nexport type ErrorFormat = 'pretty' | 'colorless' | 'minimal'\nexport type PrismaClientOptions = (\n  | {\n      /**\n       * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`.\n       */\n      adapter: runtime.SqlDriverAdapterFactory\n      accelerateUrl?: never\n    }\n  | {\n      /**\n       * Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database.\n       */\n      accelerateUrl: string\n      adapter?: never\n    }\n) & {\n  /**\n   * @default \"colorless\"\n   */\n  errorFormat?: ErrorFormat\n  /**\n   * @example\n   * ```\n   * // Shorthand for `emit: 'stdout'`\n   * log: ['query', 'info', 'warn', 'error']\n   *\n   * // Emit as events only\n   * log: [\n   *   { emit: 'event', level: 'query' },\n   *   { emit: 'event', level: 'info' },\n   *   { emit: 'event', level: 'warn' }\n   *   { emit: 'event', level: 'error' }\n   * ]\n   *\n   * / Emit as events and log to stdout\n   * og: [\n   *  { emit: 'stdout', level: 'query' },\n   *  { emit: 'stdout', level: 'info' },\n   *  { emit: 'stdout', level: 'warn' }\n   *  { emit: 'stdout', level: 'error' }\n   *\n   * ```\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).\n   */\n  log?: (LogLevel | LogDefinition)[]\n  /**\n   * The default values for transactionOptions\n   * maxWait ?= 2000\n   * timeout ?= 5000\n   */\n  transactionOptions?: {\n    maxWait?: number\n    timeout?: number\n    isolationLevel?: TransactionIsolationLevel\n  }\n  /**\n   * Global configuration for omitting model fields by default.\n   *\n   * @example\n   * ```\n   * const prisma = new PrismaClient({\n   *   omit: {\n   *     user: {\n   *       password: true\n   *     }\n   *   }\n   * })\n   * ```\n   */\n  omit?: GlobalOmitConfig\n}\nexport type GlobalOmitConfig = {\n  user?: Prisma.UserOmit\n}\n\n/* Types for Logging */\nexport type LogLevel = 'info' | 'query' | 'warn' | 'error'\nexport type LogDefinition = {\n  level: LogLevel\n  emit: 'stdout' | 'event'\n}\n\nexport type CheckIsLogLevel<T> = T extends LogLevel ? T : never\n\nexport type GetLogType<T> = CheckIsLogLevel<\n  T extends LogDefinition ? T['level'] : T\n>\n\nexport type GetEvents<T extends any[]> =\n  T extends Array<LogLevel | LogDefinition> ? GetLogType<T[number]> : never\n\nexport type QueryEvent = {\n  timestamp: Date\n  query: string\n  params: string\n  duration: number\n  target: string\n}\n\nexport type LogEvent = {\n  timestamp: Date\n  message: string\n  target: string\n}\n/* End Types for Logging */\n\nexport type PrismaAction =\n  | 'findUnique'\n  | 'findUniqueOrThrow'\n  | 'findMany'\n  | 'findFirst'\n  | 'findFirstOrThrow'\n  | 'create'\n  | 'createMany'\n  | 'createManyAndReturn'\n  | 'update'\n  | 'updateMany'\n  | 'updateManyAndReturn'\n  | 'upsert'\n  | 'delete'\n  | 'deleteMany'\n  | 'executeRaw'\n  | 'queryRaw'\n  | 'aggregate'\n  | 'count'\n  | 'runCommandRaw'\n  | 'findRaw'\n  | 'groupBy'\n\n/**\n * `PrismaClient` proxy available in interactive transactions.\n */\nexport type TransactionClient = Omit<\n  DefaultPrismaClient,\n  runtime.ITXClientDenyList\n>\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/internal/prismaNamespaceBrowser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the browser.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/index-browser'\n\nexport type * from '../models'\nexport type * from './prismaNamespace'\n\nexport const Decimal = runtime.Decimal\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\n/*\n * Enums\n */\n\nexport const TransactionIsolationLevel = {\n  Serializable: 'Serializable',\n} as const\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/models/User.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports the `User` model and its related types.\n *\n * 🟢 You can import this file directly.\n */\nimport type * as runtime from '@prisma/client/runtime/client'\nimport type * as $Enums from '../enums'\nimport type * as Prisma from '../internal/prismaNamespace'\n\n/**\n * Model User\n *\n */\nexport type UserModel =\n  runtime.Types.Result.DefaultSelection<Prisma.$UserPayload>\n\nexport type AggregateUser = {\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\nexport type UserMinAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserMaxAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserCountAggregateOutputType = {\n  email: number\n  password: number\n  _all: number\n}\n\nexport type UserMinAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserMaxAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserCountAggregateInputType = {\n  email?: true\n  password?: true\n  _all?: true\n}\n\nexport type UserAggregateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which User to aggregate.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the start position\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Count returned Users\n   **/\n  _count?: true | UserCountAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the minimum value\n   **/\n  _min?: UserMinAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the maximum value\n   **/\n  _max?: UserMaxAggregateInputType\n}\n\nexport type GetUserAggregateType<T extends UserAggregateArgs> = {\n  [P in keyof T & keyof AggregateUser]: P extends '_count' | 'count'\n    ? T[P] extends true\n      ? number\n      : Prisma.GetScalarType<T[P], AggregateUser[P]>\n    : Prisma.GetScalarType<T[P], AggregateUser[P]>\n}\n\nexport type UserGroupByArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  where?: Prisma.UserWhereInput\n  orderBy?:\n    | Prisma.UserOrderByWithAggregationInput\n    | Prisma.UserOrderByWithAggregationInput[]\n  by: Prisma.UserScalarFieldEnum[] | Prisma.UserScalarFieldEnum\n  having?: Prisma.UserScalarWhereWithAggregatesInput\n  take?: number\n  skip?: number\n  _count?: UserCountAggregateInputType | true\n  _min?: UserMinAggregateInputType\n  _max?: UserMaxAggregateInputType\n}\n\nexport type UserGroupByOutputType = {\n  email: string\n  password: string\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\ntype GetUserGroupByPayload<T extends UserGroupByArgs> = Prisma.PrismaPromise<\n  Array<\n    Prisma.PickEnumerable<UserGroupByOutputType, T['by']> & {\n      [P in keyof T & keyof UserGroupByOutputType]: P extends '_count'\n        ? T[P] extends boolean\n          ? number\n          : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n        : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n    }\n  >\n>\n\nexport type UserWhereInput = {\n  AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  OR?: Prisma.UserWhereInput[]\n  NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  email?: Prisma.StringFilter<'User'> | string\n  password?: Prisma.StringFilter<'User'> | string\n}\n\nexport type UserOrderByWithRelationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserWhereUniqueInput = Prisma.AtLeast<\n  {\n    email?: string\n    AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    OR?: Prisma.UserWhereInput[]\n    NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    password?: Prisma.StringFilter<'User'> | string\n  },\n  'email' | 'email'\n>\n\nexport type UserOrderByWithAggregationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n  _count?: Prisma.UserCountOrderByAggregateInput\n  _max?: Prisma.UserMaxOrderByAggregateInput\n  _min?: Prisma.UserMinOrderByAggregateInput\n}\n\nexport type UserScalarWhereWithAggregatesInput = {\n  AND?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  OR?: Prisma.UserScalarWhereWithAggregatesInput[]\n  NOT?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  email?: Prisma.StringWithAggregatesFilter<'User'> | string\n  password?: Prisma.StringWithAggregatesFilter<'User'> | string\n}\n\nexport type UserCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUncheckedCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCreateManyInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateManyMutationInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateManyInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCountOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMaxOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMinOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type StringFieldUpdateOperationsInput = {\n  set?: string\n}\n\nexport type UserSelect<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectCreateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectUpdateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectScalar = {\n  email?: boolean\n  password?: boolean\n}\n\nexport type UserOmit<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetOmit<\n  'email' | 'password',\n  ExtArgs['result']['user']\n>\n\nexport type $UserPayload<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  name: 'User'\n  objects: {}\n  scalars: runtime.Types.Extensions.GetPayloadResult<\n    {\n      email: string\n      password: string\n    },\n    ExtArgs['result']['user']\n  >\n  composites: {}\n}\n\nexport type UserGetPayload<\n  S extends boolean | null | undefined | UserDefaultArgs,\n> = runtime.Types.Result.GetResult<Prisma.$UserPayload, S>\n\nexport type UserCountArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = Omit<UserFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {\n  select?: UserCountAggregateInputType | true\n}\n\nexport interface UserDelegate<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> {\n  [K: symbol]: {\n    types: Prisma.TypeMap<ExtArgs>['model']['User']\n    meta: { name: 'User' }\n  }\n  /**\n   * Find zero or one User that matches the filter.\n   * @param {UserFindUniqueArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUnique({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUnique<T extends UserFindUniqueArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUnique',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find one User that matches the filter or throw an error with `error.code='P2025'`\n   * if no matches were found.\n   * @param {UserFindUniqueOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUniqueOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUniqueOrThrow<T extends UserFindUniqueOrThrowArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUniqueOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirst({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirst<T extends UserFindFirstArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirst',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter or\n   * throw `PrismaKnownClientError` with `P2025` code if no matches were found.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirstOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirstOrThrow<T extends UserFindFirstOrThrowArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirstOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find zero or more Users that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindManyArgs} args - Arguments to filter and select certain fields only.\n   * @example\n   * // Get all Users\n   * const users = await prisma.user.findMany()\n   *\n   * // Get first 10 Users\n   * const users = await prisma.user.findMany({ take: 10 })\n   *\n   * // Only select the `email`\n   * const userWithEmailOnly = await prisma.user.findMany({ select: { email: true } })\n   *\n   */\n  findMany<T extends UserFindManyArgs>(\n    args?: Prisma.SelectSubset<T, UserFindManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findMany',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create a User.\n   * @param {UserCreateArgs} args - Arguments to create a User.\n   * @example\n   * // Create one User\n   * const User = await prisma.user.create({\n   *   data: {\n   *     // ... data to create a User\n   *   }\n   * })\n   *\n   */\n  create<T extends UserCreateArgs>(\n    args: Prisma.SelectSubset<T, UserCreateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'create',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Create many Users.\n   * @param {UserCreateManyArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createMany({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   */\n  createMany<T extends UserCreateManyArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Create many Users and returns the data saved in the database.\n   * @param {UserCreateManyAndReturnArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createManyAndReturn({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Create many Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.createManyAndReturn({\n   *   select: { email: true },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  createManyAndReturn<T extends UserCreateManyAndReturnArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'createManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Delete a User.\n   * @param {UserDeleteArgs} args - Arguments to delete one User.\n   * @example\n   * // Delete one User\n   * const User = await prisma.user.delete({\n   *   where: {\n   *     // ... filter to delete one User\n   *   }\n   * })\n   *\n   */\n  delete<T extends UserDeleteArgs>(\n    args: Prisma.SelectSubset<T, UserDeleteArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'delete',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Update one User.\n   * @param {UserUpdateArgs} args - Arguments to update one User.\n   * @example\n   * // Update one User\n   * const user = await prisma.user.update({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  update<T extends UserUpdateArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'update',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Delete zero or more Users.\n   * @param {UserDeleteManyArgs} args - Arguments to filter Users to delete.\n   * @example\n   * // Delete a few Users\n   * const { count } = await prisma.user.deleteMany({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   *\n   */\n  deleteMany<T extends UserDeleteManyArgs>(\n    args?: Prisma.SelectSubset<T, UserDeleteManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserUpdateManyArgs} args - Arguments to update one or more rows.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateMany({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  updateMany<T extends UserUpdateManyArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users and returns the data updated in the database.\n   * @param {UserUpdateManyAndReturnArgs} args - Arguments to update many Users.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateManyAndReturn({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Update zero or more Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.updateManyAndReturn({\n   *   select: { email: true },\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  updateManyAndReturn<T extends UserUpdateManyAndReturnArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'updateManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create or update one User.\n   * @param {UserUpsertArgs} args - Arguments to update or create a User.\n   * @example\n   * // Update or create a User\n   * const user = await prisma.user.upsert({\n   *   create: {\n   *     // ... data to create a User\n   *   },\n   *   update: {\n   *     // ... in case it already exists, update\n   *   },\n   *   where: {\n   *     // ... the filter for the User we want to update\n   *   }\n   * })\n   */\n  upsert<T extends UserUpsertArgs>(\n    args: Prisma.SelectSubset<T, UserUpsertArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'upsert',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Count the number of Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserCountArgs} args - Arguments to filter Users to count.\n   * @example\n   * // Count the number of Users\n   * const count = await prisma.user.count({\n   *   where: {\n   *     // ... the filter for the Users we want to count\n   *   }\n   * })\n   **/\n  count<T extends UserCountArgs>(\n    args?: Prisma.Subset<T, UserCountArgs>,\n  ): Prisma.PrismaPromise<\n    T extends runtime.Types.Utils.Record<'select', any>\n      ? T['select'] extends true\n        ? number\n        : Prisma.GetScalarType<T['select'], UserCountAggregateOutputType>\n      : number\n  >\n\n  /**\n   * Allows you to perform aggregations operations on a User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserAggregateArgs} args - Select which aggregations you would like to apply and on what fields.\n   * @example\n   * // Ordered by age ascending\n   * // Where email contains prisma.io\n   * // Limited to the 10 users\n   * const aggregations = await prisma.user.aggregate({\n   *   _avg: {\n   *     age: true,\n   *   },\n   *   where: {\n   *     email: {\n   *       contains: \"prisma.io\",\n   *     },\n   *   },\n   *   orderBy: {\n   *     age: \"asc\",\n   *   },\n   *   take: 10,\n   * })\n   **/\n  aggregate<T extends UserAggregateArgs>(\n    args: Prisma.Subset<T, UserAggregateArgs>,\n  ): Prisma.PrismaPromise<GetUserAggregateType<T>>\n\n  /**\n   * Group by User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserGroupByArgs} args - Group by arguments.\n   * @example\n   * // Group by city, order by createdAt, get count\n   * const result = await prisma.user.groupBy({\n   *   by: ['city', 'createdAt'],\n   *   orderBy: {\n   *     createdAt: true\n   *   },\n   *   _count: {\n   *     _all: true\n   *   },\n   * })\n   *\n   **/\n  groupBy<\n    T extends UserGroupByArgs,\n    HasSelectOrTake extends Prisma.Or<\n      Prisma.Extends<'skip', Prisma.Keys<T>>,\n      Prisma.Extends<'take', Prisma.Keys<T>>\n    >,\n    OrderByArg extends Prisma.True extends HasSelectOrTake\n      ? { orderBy: UserGroupByArgs['orderBy'] }\n      : { orderBy?: UserGroupByArgs['orderBy'] },\n    OrderFields extends Prisma.ExcludeUnderscoreKeys<\n      Prisma.Keys<Prisma.MaybeTupleToUnion<T['orderBy']>>\n    >,\n    ByFields extends Prisma.MaybeTupleToUnion<T['by']>,\n    ByValid extends Prisma.Has<ByFields, OrderFields>,\n    HavingFields extends Prisma.GetHavingFields<T['having']>,\n    HavingValid extends Prisma.Has<ByFields, HavingFields>,\n    ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False,\n    InputErrors extends ByEmpty extends Prisma.True\n      ? `Error: \"by\" must not be empty.`\n      : HavingValid extends Prisma.False\n        ? {\n            [P in HavingFields]: P extends ByFields\n              ? never\n              : P extends string\n                ? `Error: Field \"${P}\" used in \"having\" needs to be provided in \"by\".`\n                : [\n                    Error,\n                    'Field ',\n                    P,\n                    ` in \"having\" needs to be provided in \"by\"`,\n                  ]\n          }[HavingFields]\n        : 'take' extends Prisma.Keys<T>\n          ? 'orderBy' extends Prisma.Keys<T>\n            ? ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields]\n            : 'Error: If you provide \"take\", you also need to provide \"orderBy\"'\n          : 'skip' extends Prisma.Keys<T>\n            ? 'orderBy' extends Prisma.Keys<T>\n              ? ByValid extends Prisma.True\n                ? {}\n                : {\n                    [P in OrderFields]: P extends ByFields\n                      ? never\n                      : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                  }[OrderFields]\n              : 'Error: If you provide \"skip\", you also need to provide \"orderBy\"'\n            : ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields],\n  >(\n    args: Prisma.SubsetIntersection<T, UserGroupByArgs, OrderByArg> &\n      InputErrors,\n  ): {} extends InputErrors\n    ? GetUserGroupByPayload<T>\n    : Prisma.PrismaPromise<InputErrors>\n  /**\n   * Fields of the User model\n   */\n  readonly fields: UserFieldRefs\n}\n\n/**\n * The delegate class that acts as a \"Promise-like\" for User.\n * Why is this prefixed with `Prisma__`?\n * Because we want to prevent naming conflicts as mentioned in\n * https://github.com/prisma/prisma-client-js/issues/707\n */\nexport interface Prisma__UserClient<\n  T,\n  Null = never,\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> extends Prisma.PrismaPromise<T> {\n  readonly [Symbol.toStringTag]: 'PrismaPromise'\n  /**\n   * Attaches callbacks for the resolution and/or rejection of the Promise.\n   * @param onfulfilled The callback to execute when the Promise is resolved.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of which ever callback is executed.\n   */\n  then<TResult1 = T, TResult2 = never>(\n    onfulfilled?:\n      | ((value: T) => TResult1 | PromiseLike<TResult1>)\n      | undefined\n      | null,\n    onrejected?:\n      | ((reason: any) => TResult2 | PromiseLike<TResult2>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<TResult1 | TResult2>\n  /**\n   * Attaches a callback for only the rejection of the Promise.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of the callback.\n   */\n  catch<TResult = never>(\n    onrejected?:\n      | ((reason: any) => TResult | PromiseLike<TResult>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<T | TResult>\n  /**\n   * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The\n   * resolved value cannot be modified from the callback.\n   * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).\n   * @returns A Promise for the completion of the callback.\n   */\n  finally(\n    onfinally?: (() => void) | undefined | null,\n  ): runtime.Types.Utils.JsPromise<T>\n}\n\n/**\n * Fields of the User model\n */\nexport interface UserFieldRefs {\n  readonly email: Prisma.FieldRef<'User', 'String'>\n  readonly password: Prisma.FieldRef<'User', 'String'>\n}\n\n// Custom InputTypes\n/**\n * User findUnique\n */\nexport type UserFindUniqueArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findUniqueOrThrow\n */\nexport type UserFindUniqueOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findFirst\n */\nexport type UserFindFirstArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findFirstOrThrow\n */\nexport type UserFindFirstOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findMany\n */\nexport type UserFindManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which Users to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for listing Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User create\n */\nexport type UserCreateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to create a User.\n   */\n  data: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n}\n\n/**\n * User createMany\n */\nexport type UserCreateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User createManyAndReturn\n */\nexport type UserCreateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectCreateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User update\n */\nexport type UserUpdateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to update a User.\n   */\n  data: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n  /**\n   * Choose, which User to update.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User updateMany\n */\nexport type UserUpdateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User updateManyAndReturn\n */\nexport type UserUpdateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectUpdateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User upsert\n */\nexport type UserUpsertArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The filter to search for the User to update in case it exists.\n   */\n  where: Prisma.UserWhereUniqueInput\n  /**\n   * In case the User found by the `where` argument doesn't exist, create a new User with this data.\n   */\n  create: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n  /**\n   * In case the User was found with the provided `where` argument, update it with this data.\n   */\n  update: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n}\n\n/**\n * User delete\n */\nexport type UserDeleteArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter which User to delete.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User deleteMany\n */\nexport type UserDeleteManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which Users to delete\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to delete.\n   */\n  limit?: number\n}\n\n/**\n * User without action\n */\nexport type UserDefaultArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/prisma-generated/models.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This is a barrel export file for all models and their related types.\n *\n * 🟢 You can import this file directly.\n */\nexport type * from './models/User'\nexport type * from './commonInputTypes'\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SignupRouteImport } from './routes/signup'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteImport } from './routes/_authed/posts'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst SignupRoute = SignupRouteImport.update({\n  id: '/signup',\n  path: '/signup',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRoute = AuthedPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts': typeof AuthedPostsRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/_authed/posts': typeof AuthedPostsRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  LogoutRoute: typeof LogoutRoute\n  SignupRoute: typeof SignupRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/signup': {\n      id: '/signup'\n      path: '/signup'\n      fullPath: '/signup'\n      preLoaderRoute: typeof SignupRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteChildren: AuthedPostsRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(\n  AuthedPostsRouteChildren,\n)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRoute: typeof AuthedPostsRouteWithChildren\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRoute: AuthedPostsRouteWithChildren,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n  LoginRoute: LoginRoute,\n  LogoutRoute: LogoutRoute,\n  SignupRoute: SignupRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { createServerFn } from '@tanstack/react-start'\nimport * as React from 'react'\n\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'\nimport { NotFound } from '~/components/NotFound.js'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo.js'\nimport { useAppSession } from '~/utils/session.js'\n\nconst fetchUser = createServerFn({ method: 'GET' }).handler(async () => {\n  // We need to auth on the server so we have access to secure cookies\n  const session = await useAppSession()\n\n  if (!session.data.userEmail) {\n    return null\n  }\n\n  return {\n    email: session.data.userEmail,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const user = await fetchUser()\n\n    return {\n      user,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  const { user } = Route.useRouteContext()\n\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div className=\"ml-auto\">\n            {user ? (\n              <>\n                <span className=\"mr-2\">{user.email}</span>\n                <Link to=\"/logout\">Logout</Link>\n              </>\n            ) : (\n              <Link to=\"/login\">Login</Link>\n            )}\n          </div>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport { NotFound } from '~/components/NotFound.js'\nimport { fetchPost } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/_authed/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nimport { fetchPosts } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/_authed.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { Login } from '~/components/Login'\nimport { useAppSession } from '~/utils/session'\n\nexport const loginFn = createServerFn({\n  method: 'POST',\n})\n  .inputValidator((payload: { email: string; password: string }) => payload)\n  .handler(async ({ data }) => {\n    // Find the user\n    const user = await prismaClient.user.findUnique({\n      where: {\n        email: data.email,\n      },\n    })\n\n    // Check if the user exists\n    if (!user) {\n      return {\n        error: true,\n        userNotFound: true,\n        message: 'User not found',\n      }\n    }\n\n    // Check if the password is correct\n    const hashedPassword = await hashPassword(data.password)\n\n    if (user.password !== hashedPassword) {\n      return {\n        error: true,\n        message: 'Incorrect password',\n      }\n    }\n\n    // Create a session\n    const session = await useAppSession()\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n  })\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return <Login />\n    }\n\n    throw error\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Login } from '~/components/Login'\n\nexport const Route = createFileRoute('/login')({\n  component: LoginComp,\n})\n\nfunction LoginComp() {\n  return <Login />\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/logout.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nimport { useAppSession } from '~/utils/session'\n\nconst logoutFn = createServerFn({ method: 'POST' }).handler(async () => {\n  const session = await useAppSession()\n\n  session.clear()\n\n  throw redirect({\n    href: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  preload: false,\n  loader: () => logoutFn(),\n})\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/routes/signup.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn, useServerFn } from '@tanstack/react-start'\n\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { useMutation } from '~/hooks/useMutation'\nimport { Auth } from '~/components/Auth'\nimport { useAppSession } from '~/utils/session'\n\nexport const signupFn = createServerFn({\n  method: 'POST',\n})\n  .inputValidator(\n    (data: { email: string; password: string; redirectUrl?: string }) => data,\n  )\n  .handler(async ({ data: payload }) => {\n    // Check if the user already exists\n    const found = await prismaClient.user.findUnique({\n      where: {\n        email: payload.email,\n      },\n    })\n\n    // Encrypt the password using Sha256 into plaintext\n    const password = await hashPassword(payload.password)\n\n    // Create a session\n    const session = await useAppSession()\n\n    if (found) {\n      if (found.password !== password) {\n        return {\n          error: true,\n          userExists: true,\n          message: 'User already exists',\n        }\n      }\n\n      // Store the user's email in the session\n      await session.update({\n        userEmail: found.email,\n      })\n\n      // Redirect to the prev page stored in the \"redirect\" search param\n      throw redirect({\n        href: payload.redirectUrl || '/',\n      })\n    }\n\n    // Create the user\n    const user = await prismaClient.user.create({\n      data: {\n        email: payload.email,\n        password,\n      },\n    })\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n\n    // Redirect to the prev page stored in the \"redirect\" search param\n    throw redirect({\n      href: payload.redirectUrl || '/',\n    })\n  })\n\nexport const Route = createFileRoute('/signup')({\n  component: SignupComp,\n})\n\nfunction SignupComp() {\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Sign Up\"\n      status={signupMutation.status}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as HTMLFormElement)\n\n        signupMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        signupMutation.data?.error ? (\n          <>\n            <div className=\"text-red-400\">{signupMutation.data.message}</div>\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/utils/prisma.ts",
    "content": "import crypto from 'node:crypto'\nimport { PrismaLibSql } from '@prisma/adapter-libsql'\nimport { PrismaClient } from '../prisma-generated/client'\n\nconst adapter = new PrismaLibSql({\n  url: process.env.DATABASE_URL || 'file:./prisma/dev.db',\n})\nexport const prismaClient = new PrismaClient({ adapter })\n\nexport function hashPassword(password: string) {\n  return new Promise<string>((resolve, reject) => {\n    crypto.pbkdf2(password, 'salt', 100000, 64, 'sha256', (err, derivedKey) => {\n      if (err) {\n        reject(err)\n      } else {\n        resolve(derivedKey.toString('hex'))\n      }\n    })\n  })\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/src/utils/session.ts",
    "content": "// src/services/session.server.ts\nimport { useSession } from '@tanstack/react-start/server'\nimport type { User } from '@prisma/client'\n\ntype SessionUser = {\n  userEmail: User['email']\n}\n\nexport function useAppSession() {\n  return useSession<SessionUser>({\n    password: 'ChangeThisBeforeShippingToProdOrYouWillBeFired',\n  })\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\nasync function signup(\n  page: Page,\n  baseUrl: string,\n  email: string,\n  password: string,\n) {\n  await page.goto(baseUrl + '/signup')\n  await page.fill('input[name=\"email\"]', email)\n  await page.fill('input[name=\"password\"]', password)\n  await page.click('button[type=\"submit\"]')\n}\n\nasync function login(\n  page: Page,\n  email: string,\n  password: string,\n  signupOnFail = false,\n) {\n  await page.goto('/login')\n  await page.fill('input[name=\"email\"]', email)\n  await page.fill('input[name=\"password\"]', password)\n  await page.click('button[type=\"submit\"]')\n\n  if (signupOnFail) {\n    await page.waitForSelector('text=User not found')\n    await page.click('button:has-text(\"Sign up instead?\")')\n    await page.waitForSelector('text=Logout')\n  }\n}\n\ntest('Posts redirects to login when not authenticated', async ({ page }) => {\n  await page.goto('/posts')\n  await expect(page.locator('h1')).toContainText('Login')\n})\n\ntest('Login fails with user not found', async ({ page }) => {\n  await login(page, 'bad@gmail.com', 'badpassword')\n  expect(page.getByText('User not found')).toBeTruthy()\n})\n\ntest('Login fails with incorrect password', async ({ page }) => {\n  await signup(page, 'test@gmail.com', 'badpassword')\n  expect(page.getByText('Incorrect password')).toBeTruthy()\n})\n\ntest('Can sign up from a not found user', async ({ page }) => {\n  await login(page, 'test2@gmail.com', 'badpassword', true)\n  expect(page.getByText('test@gmail.com')).toBeTruthy()\n})\n\ntest('Navigating to post after logging in', async ({ page }) => {\n  await login(page, 'test@gmail.com', 'test')\n  await new Promise((r) => setTimeout(r, 1000))\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n"
  },
  {
    "path": "e2e/react-start/basic-auth/tests/mock-db-setup.test.ts",
    "content": "import { test as setup } from '@playwright/test'\n\nimport { PrismaClient } from '@prisma/client'\n\nconst prismaClient = new PrismaClient()\n\nsetup('create new database', async () => {\n  if (\n    await prismaClient.user.findUnique({\n      where: {\n        email: 'test2@gmail.com',\n      },\n    })\n  ) {\n    await prismaClient.user.delete({\n      where: {\n        email: 'test2@gmail.com',\n      },\n    })\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/basic-auth/tests/mock-db-teardown.test.ts",
    "content": "import { test as teardown } from '@playwright/test'\n\nimport { PrismaClient } from '@prisma/client'\n\nconst prismaClient = new PrismaClient()\n\nteardown('create new database', async () => {\n  if (\n    await prismaClient.user.findUnique({\n      where: {\n        email: 'test2@gmail.com',\n      },\n    })\n  ) {\n    await prismaClient.user.delete({\n      where: {\n        email: 'test2@gmail.com',\n      },\n    })\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/basic-auth/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-auth/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/.gitignore",
    "content": "node_modules\n.DS_Store\n.cache\n.env\ndist\n.wrangler\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/.prettierignore",
    "content": "**/public\npnpm-lock.yaml\nrouteTree.gen.ts\nworker-configuration.d.ts\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-basic-cloudflare\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"cf-typegen\": \"wrangler types\",\n    \"postinstall\": \"npm run cf-typegen\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@cloudflare/vite-plugin\": \"^1.29.0\",\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"wrangler\": \"^4.74.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as StaticRouteImport } from './routes/static'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst StaticRoute = StaticRouteImport.update({\n  id: '/static',\n  path: '/static',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/static'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/static'\n  id: '__root__' | '/' | '/static'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  StaticRoute: typeof StaticRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/static': {\n      id: '/static'\n      path: '/static'\n      fullPath: '/static'\n      preLoaderRoute: typeof StaticRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  StaticRoute: StaticRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { env } from 'cloudflare:workers'\n\nexport const Route = createFileRoute('/')({\n  loader: () => getData(),\n  component: Home,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    message: `Running in ${navigator.userAgent}`,\n    myVar: env.MY_VAR,\n  }\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <p data-testid=\"message\">{data.message}</p>\n      <p data-testid=\"myVar\">{data.myVar}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/routes/static.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { env } from 'cloudflare:workers'\n\nexport const Route = createFileRoute('/static')({\n  loader: () => getData(),\n  component: StaticPage,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    myVar: env.MY_VAR,\n  }\n})\n\nfunction StaticPage() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div>\n      <h1 data-testid=\"static-heading\">Static Page</h1>\n      <p data-testid=\"static-content\">The value is {data.myVar}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/tests/app.spec.ts",
    "content": "import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('returns the correct user agent', async ({ page }) => {\n  await page.goto('/')\n  await expect(page.getByTestId('message')).toHaveText(\n    'Running in Cloudflare-Workers',\n  )\n})\n\ntest('returns the correct value from a Cloudflare binding', async ({\n  page,\n}) => {\n  await page.goto('/')\n  await expect(page.getByTestId('myVar')).toHaveText('Hello from Cloudflare')\n})\n\ntest('prerender with Cloudflare Workers runtime', async ({ page }) => {\n  // Verify the static page was prerendered during build\n  const distDir = join(process.cwd(), 'dist', 'client')\n  expect(existsSync(join(distDir, 'static', 'index.html'))).toBe(true)\n\n  // Verify the page loads correctly\n  await page.goto('/static')\n  await expect(page.getByTestId('static-heading')).toHaveText('Static Page')\n  await expect(page.getByTestId('static-content')).toHaveText(\n    'The value is Hello from Cloudflare',\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { cloudflare } from '@cloudflare/vite-plugin'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [\n    tailwindcss(),\n    cloudflare({ viteEnvironment: { name: 'ssr' }, inspectorPort: false }),\n    tanstackStart({\n      prerender: {\n        enabled: true,\n        filter: (page) => page.path === '/static',\n      },\n    }),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/worker-configuration.d.ts",
    "content": "/* eslint-disable */\n// Generated by Wrangler by running `wrangler types` (hash: b11df627d8b3c51b1bf3230a546b0f20)\n// Runtime types generated with workerd@1.20260317.1 2025-09-24 nodejs_compat\ndeclare namespace Cloudflare {\n\tinterface Env {\n\t\tMY_VAR: \"Hello from Cloudflare\";\n\t}\n}\ninterface Env extends Cloudflare.Env {}\ntype StringifyValues<EnvType extends Record<string, unknown>> = {\n\t[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;\n};\ndeclare namespace NodeJS {\n\tinterface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, \"MY_VAR\">> {}\n}\n\n// Begin runtime types\n/*! *****************************************************************************\nCopyright (c) Cloudflare. All rights reserved.\nCopyright (c) Microsoft Corporation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n/* eslint-disable */\n// noinspection JSUnusedGlobalSymbols\ndeclare var onmessage: never;\n/**\n * The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)\n */\ndeclare class DOMException extends Error {\n    constructor(message?: string, name?: string);\n    /**\n     * The **`message`** read-only property of the a message or description associated with the given error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)\n     */\n    readonly message: string;\n    /**\n     * The **`name`** read-only property of the one of the strings associated with an error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)\n     */\n    readonly name: string;\n    /**\n     * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)\n     */\n    readonly code: number;\n    static readonly INDEX_SIZE_ERR: number;\n    static readonly DOMSTRING_SIZE_ERR: number;\n    static readonly HIERARCHY_REQUEST_ERR: number;\n    static readonly WRONG_DOCUMENT_ERR: number;\n    static readonly INVALID_CHARACTER_ERR: number;\n    static readonly NO_DATA_ALLOWED_ERR: number;\n    static readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    static readonly NOT_FOUND_ERR: number;\n    static readonly NOT_SUPPORTED_ERR: number;\n    static readonly INUSE_ATTRIBUTE_ERR: number;\n    static readonly INVALID_STATE_ERR: number;\n    static readonly SYNTAX_ERR: number;\n    static readonly INVALID_MODIFICATION_ERR: number;\n    static readonly NAMESPACE_ERR: number;\n    static readonly INVALID_ACCESS_ERR: number;\n    static readonly VALIDATION_ERR: number;\n    static readonly TYPE_MISMATCH_ERR: number;\n    static readonly SECURITY_ERR: number;\n    static readonly NETWORK_ERR: number;\n    static readonly ABORT_ERR: number;\n    static readonly URL_MISMATCH_ERR: number;\n    static readonly QUOTA_EXCEEDED_ERR: number;\n    static readonly TIMEOUT_ERR: number;\n    static readonly INVALID_NODE_TYPE_ERR: number;\n    static readonly DATA_CLONE_ERR: number;\n    get stack(): any;\n    set stack(value: any);\n}\ntype WorkerGlobalScopeEventMap = {\n    fetch: FetchEvent;\n    scheduled: ScheduledEvent;\n    queue: QueueEvent;\n    unhandledrejection: PromiseRejectionEvent;\n    rejectionhandled: PromiseRejectionEvent;\n};\ndeclare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {\n    EventTarget: typeof EventTarget;\n}\n/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *\n * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)\n */\ninterface Console {\n    \"assert\"(condition?: boolean, ...data: any[]): void;\n    /**\n     * The **`console.clear()`** static method clears the console if possible.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)\n     */\n    clear(): void;\n    /**\n     * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)\n     */\n    count(label?: string): void;\n    /**\n     * The **`console.countReset()`** static method resets counter used with console/count_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)\n     */\n    countReset(label?: string): void;\n    /**\n     * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)\n     */\n    debug(...data: any[]): void;\n    /**\n     * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)\n     */\n    dir(item?: any, options?: any): void;\n    /**\n     * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)\n     */\n    dirxml(...data: any[]): void;\n    /**\n     * The **`console.error()`** static method outputs a message to the console at the 'error' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)\n     */\n    error(...data: any[]): void;\n    /**\n     * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)\n     */\n    group(...data: any[]): void;\n    /**\n     * The **`console.groupCollapsed()`** static method creates a new inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)\n     */\n    groupCollapsed(...data: any[]): void;\n    /**\n     * The **`console.groupEnd()`** static method exits the current inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)\n     */\n    groupEnd(): void;\n    /**\n     * The **`console.info()`** static method outputs a message to the console at the 'info' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)\n     */\n    info(...data: any[]): void;\n    /**\n     * The **`console.log()`** static method outputs a message to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)\n     */\n    log(...data: any[]): void;\n    /**\n     * The **`console.table()`** static method displays tabular data as a table.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)\n     */\n    table(tabularData?: any, properties?: string[]): void;\n    /**\n     * The **`console.time()`** static method starts a timer you can use to track how long an operation takes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)\n     */\n    time(label?: string): void;\n    /**\n     * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)\n     */\n    timeEnd(label?: string): void;\n    /**\n     * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)\n     */\n    timeLog(label?: string, ...data: any[]): void;\n    timeStamp(label?: string): void;\n    /**\n     * The **`console.trace()`** static method outputs a stack trace to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)\n     */\n    trace(...data: any[]): void;\n    /**\n     * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)\n     */\n    warn(...data: any[]): void;\n}\ndeclare const console: Console;\ntype BufferSource = ArrayBufferView | ArrayBuffer;\ntype TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;\ndeclare namespace WebAssembly {\n    class CompileError extends Error {\n        constructor(message?: string);\n    }\n    class RuntimeError extends Error {\n        constructor(message?: string);\n    }\n    type ValueType = \"anyfunc\" | \"externref\" | \"f32\" | \"f64\" | \"i32\" | \"i64\" | \"v128\";\n    interface GlobalDescriptor {\n        value: ValueType;\n        mutable?: boolean;\n    }\n    class Global {\n        constructor(descriptor: GlobalDescriptor, value?: any);\n        value: any;\n        valueOf(): any;\n    }\n    type ImportValue = ExportValue | number;\n    type ModuleImports = Record<string, ImportValue>;\n    type Imports = Record<string, ModuleImports>;\n    type ExportValue = Function | Global | Memory | Table;\n    type Exports = Record<string, ExportValue>;\n    class Instance {\n        constructor(module: Module, imports?: Imports);\n        readonly exports: Exports;\n    }\n    interface MemoryDescriptor {\n        initial: number;\n        maximum?: number;\n        shared?: boolean;\n    }\n    class Memory {\n        constructor(descriptor: MemoryDescriptor);\n        readonly buffer: ArrayBuffer;\n        grow(delta: number): number;\n    }\n    type ImportExportKind = \"function\" | \"global\" | \"memory\" | \"table\";\n    interface ModuleExportDescriptor {\n        kind: ImportExportKind;\n        name: string;\n    }\n    interface ModuleImportDescriptor {\n        kind: ImportExportKind;\n        module: string;\n        name: string;\n    }\n    abstract class Module {\n        static customSections(module: Module, sectionName: string): ArrayBuffer[];\n        static exports(module: Module): ModuleExportDescriptor[];\n        static imports(module: Module): ModuleImportDescriptor[];\n    }\n    type TableKind = \"anyfunc\" | \"externref\";\n    interface TableDescriptor {\n        element: TableKind;\n        initial: number;\n        maximum?: number;\n    }\n    class Table {\n        constructor(descriptor: TableDescriptor, value?: any);\n        readonly length: number;\n        get(index: number): any;\n        grow(delta: number, value?: any): number;\n        set(index: number, value?: any): void;\n    }\n    function instantiate(module: Module, imports?: Imports): Promise<Instance>;\n    function validate(bytes: BufferSource): boolean;\n}\n/**\n * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)\n */\ninterface ServiceWorkerGlobalScope extends WorkerGlobalScope {\n    DOMException: typeof DOMException;\n    WorkerGlobalScope: typeof WorkerGlobalScope;\n    btoa(data: string): string;\n    atob(data: string): string;\n    setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n    setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearTimeout(timeoutId: number | null): void;\n    setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n    setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearInterval(timeoutId: number | null): void;\n    queueMicrotask(task: Function): void;\n    structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n    reportError(error: any): void;\n    fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\n    self: ServiceWorkerGlobalScope;\n    crypto: Crypto;\n    caches: CacheStorage;\n    scheduler: Scheduler;\n    performance: Performance;\n    Cloudflare: Cloudflare;\n    readonly origin: string;\n    Event: typeof Event;\n    ExtendableEvent: typeof ExtendableEvent;\n    CustomEvent: typeof CustomEvent;\n    PromiseRejectionEvent: typeof PromiseRejectionEvent;\n    FetchEvent: typeof FetchEvent;\n    TailEvent: typeof TailEvent;\n    TraceEvent: typeof TailEvent;\n    ScheduledEvent: typeof ScheduledEvent;\n    MessageEvent: typeof MessageEvent;\n    CloseEvent: typeof CloseEvent;\n    ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;\n    ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;\n    ReadableStream: typeof ReadableStream;\n    WritableStream: typeof WritableStream;\n    WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;\n    TransformStream: typeof TransformStream;\n    ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;\n    CountQueuingStrategy: typeof CountQueuingStrategy;\n    ErrorEvent: typeof ErrorEvent;\n    MessageChannel: typeof MessageChannel;\n    MessagePort: typeof MessagePort;\n    EventSource: typeof EventSource;\n    ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;\n    ReadableStreamDefaultController: typeof ReadableStreamDefaultController;\n    ReadableByteStreamController: typeof ReadableByteStreamController;\n    WritableStreamDefaultController: typeof WritableStreamDefaultController;\n    TransformStreamDefaultController: typeof TransformStreamDefaultController;\n    CompressionStream: typeof CompressionStream;\n    DecompressionStream: typeof DecompressionStream;\n    TextEncoderStream: typeof TextEncoderStream;\n    TextDecoderStream: typeof TextDecoderStream;\n    Headers: typeof Headers;\n    Body: typeof Body;\n    Request: typeof Request;\n    Response: typeof Response;\n    WebSocket: typeof WebSocket;\n    WebSocketPair: typeof WebSocketPair;\n    WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;\n    AbortController: typeof AbortController;\n    AbortSignal: typeof AbortSignal;\n    TextDecoder: typeof TextDecoder;\n    TextEncoder: typeof TextEncoder;\n    navigator: Navigator;\n    Navigator: typeof Navigator;\n    URL: typeof URL;\n    URLSearchParams: typeof URLSearchParams;\n    URLPattern: typeof URLPattern;\n    Blob: typeof Blob;\n    File: typeof File;\n    FormData: typeof FormData;\n    Crypto: typeof Crypto;\n    SubtleCrypto: typeof SubtleCrypto;\n    CryptoKey: typeof CryptoKey;\n    CacheStorage: typeof CacheStorage;\n    Cache: typeof Cache;\n    FixedLengthStream: typeof FixedLengthStream;\n    IdentityTransformStream: typeof IdentityTransformStream;\n    HTMLRewriter: typeof HTMLRewriter;\n}\ndeclare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\ndeclare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n/**\n * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n */\ndeclare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */\ndeclare function btoa(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */\ndeclare function atob(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */\ndeclare function clearTimeout(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */\ndeclare function clearInterval(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */\ndeclare function queueMicrotask(task: Function): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */\ndeclare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */\ndeclare function reportError(error: any): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */\ndeclare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\ndeclare const self: ServiceWorkerGlobalScope;\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare const crypto: Crypto;\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare const caches: CacheStorage;\ndeclare const scheduler: Scheduler;\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare const performance: Performance;\ndeclare const Cloudflare: Cloudflare;\ndeclare const origin: string;\ndeclare const navigator: Navigator;\ninterface TestController {\n}\ninterface ExecutionContext<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    passThroughOnException(): void;\n    readonly props: Props;\n}\ntype ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;\ntype ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\ntype ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ninterface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {\n    fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;\n    tail?: ExportedHandlerTailHandler<Env, Props>;\n    trace?: ExportedHandlerTraceHandler<Env, Props>;\n    tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;\n    scheduled?: ExportedHandlerScheduledHandler<Env, Props>;\n    test?: ExportedHandlerTestHandler<Env, Props>;\n    email?: EmailExportedHandler<Env, Props>;\n    queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;\n}\ninterface StructuredSerializeOptions {\n    transfer?: any[];\n}\ndeclare abstract class Navigator {\n    sendBeacon(url: string, body?: BodyInit): boolean;\n    readonly userAgent: string;\n    readonly hardwareConcurrency: number;\n    readonly language: string;\n    readonly languages: string[];\n}\ninterface AlarmInvocationInfo {\n    readonly isRetry: boolean;\n    readonly retryCount: number;\n}\ninterface Cloudflare {\n    readonly compatibilityFlags: Record<string, boolean>;\n}\ninterface DurableObject {\n    fetch(request: Request): Response | Promise<Response>;\n    alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n    webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n    webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n    webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n}\ntype DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, \"alarm\" | \"webSocketMessage\" | \"webSocketClose\" | \"webSocketError\"> & {\n    readonly id: DurableObjectId;\n    readonly name?: string;\n};\ninterface DurableObjectId {\n    toString(): string;\n    equals(other: DurableObjectId): boolean;\n    readonly name?: string;\n}\ndeclare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {\n    newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;\n    idFromName(name: string): DurableObjectId;\n    idFromString(id: string): DurableObjectId;\n    get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;\n}\ntype DurableObjectJurisdiction = \"eu\" | \"fedramp\" | \"fedramp-high\";\ninterface DurableObjectNamespaceNewUniqueIdOptions {\n    jurisdiction?: DurableObjectJurisdiction;\n}\ntype DurableObjectLocationHint = \"wnam\" | \"enam\" | \"sam\" | \"weur\" | \"eeur\" | \"apac\" | \"oc\" | \"afr\" | \"me\";\ntype DurableObjectRoutingMode = \"primary-only\";\ninterface DurableObjectNamespaceGetDurableObjectOptions {\n    locationHint?: DurableObjectLocationHint;\n    routingMode?: DurableObjectRoutingMode;\n}\ninterface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {\n}\ninterface DurableObjectState<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    readonly props: Props;\n    readonly id: DurableObjectId;\n    readonly storage: DurableObjectStorage;\n    container?: Container;\n    blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;\n    acceptWebSocket(ws: WebSocket, tags?: string[]): void;\n    getWebSockets(tag?: string): WebSocket[];\n    setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;\n    getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;\n    getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;\n    setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;\n    getHibernatableWebSocketEventTimeout(): number | null;\n    getTags(ws: WebSocket): string[];\n    abort(reason?: string): void;\n}\ninterface DurableObjectTransaction {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    rollback(): void;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n}\ninterface DurableObjectStorage {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    deleteAll(options?: DurableObjectPutOptions): Promise<void>;\n    transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n    sync(): Promise<void>;\n    sql: SqlStorage;\n    kv: SyncKvStorage;\n    transactionSync<T>(closure: () => T): T;\n    getCurrentBookmark(): Promise<string>;\n    getBookmarkForTime(timestamp: number | Date): Promise<string>;\n    onNextSessionRestoreBookmark(bookmark: string): Promise<string>;\n}\ninterface DurableObjectListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetOptions {\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetAlarmOptions {\n    allowConcurrency?: boolean;\n}\ninterface DurableObjectPutOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectSetAlarmOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n}\ndeclare class WebSocketRequestResponsePair {\n    constructor(request: string, response: string);\n    get request(): string;\n    get response(): string;\n}\ninterface AnalyticsEngineDataset {\n    writeDataPoint(event?: AnalyticsEngineDataPoint): void;\n}\ninterface AnalyticsEngineDataPoint {\n    indexes?: ((ArrayBuffer | string) | null)[];\n    doubles?: number[];\n    blobs?: ((ArrayBuffer | string) | null)[];\n}\n/**\n * The **`Event`** interface represents an event which takes place on an `EventTarget`.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)\n */\ndeclare class Event {\n    constructor(type: string, init?: EventInit);\n    /**\n     * The **`type`** read-only property of the Event interface returns a string containing the event's type.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)\n     */\n    get type(): string;\n    /**\n     * The **`eventPhase`** read-only property of the being evaluated.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)\n     */\n    get eventPhase(): number;\n    /**\n     * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)\n     */\n    get composed(): boolean;\n    /**\n     * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)\n     */\n    get bubbles(): boolean;\n    /**\n     * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)\n     */\n    get cancelable(): boolean;\n    /**\n     * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)\n     */\n    get defaultPrevented(): boolean;\n    /**\n     * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)\n     */\n    get returnValue(): boolean;\n    /**\n     * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)\n     */\n    get currentTarget(): EventTarget | undefined;\n    /**\n     * The read-only **`target`** property of the dispatched.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)\n     */\n    get target(): EventTarget | undefined;\n    /**\n     * The deprecated **`Event.srcElement`** is an alias for the Event.target property.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)\n     */\n    get srcElement(): EventTarget | undefined;\n    /**\n     * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)\n     */\n    get timeStamp(): number;\n    /**\n     * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)\n     */\n    get isTrusted(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    get cancelBubble(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    set cancelBubble(value: boolean);\n    /**\n     * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)\n     */\n    stopImmediatePropagation(): void;\n    /**\n     * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)\n     */\n    preventDefault(): void;\n    /**\n     * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)\n     */\n    stopPropagation(): void;\n    /**\n     * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)\n     */\n    composedPath(): EventTarget[];\n    static readonly NONE: number;\n    static readonly CAPTURING_PHASE: number;\n    static readonly AT_TARGET: number;\n    static readonly BUBBLING_PHASE: number;\n}\ninterface EventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n}\ntype EventListener<EventType extends Event = Event> = (event: EventType) => void;\ninterface EventListenerObject<EventType extends Event = Event> {\n    handleEvent(event: EventType): void;\n}\ntype EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;\n/**\n * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)\n */\ndeclare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {\n    constructor();\n    /**\n     * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)\n     */\n    addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\n    /**\n     * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)\n     */\n    removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n    /**\n     * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n     */\n    dispatchEvent(event: EventMap[keyof EventMap]): boolean;\n}\ninterface EventTargetEventListenerOptions {\n    capture?: boolean;\n}\ninterface EventTargetAddEventListenerOptions {\n    capture?: boolean;\n    passive?: boolean;\n    once?: boolean;\n    signal?: AbortSignal;\n}\ninterface EventTargetHandlerObject {\n    handleEvent: (event: Event) => any | undefined;\n}\n/**\n * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)\n */\ndeclare class AbortController {\n    constructor();\n    /**\n     * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)\n     */\n    abort(reason?: any): void;\n}\n/**\n * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)\n */\ndeclare abstract class AbortSignal extends EventTarget {\n    /**\n     * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)\n     */\n    static abort(reason?: any): AbortSignal;\n    /**\n     * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)\n     */\n    static timeout(delay: number): AbortSignal;\n    /**\n     * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)\n     */\n    static any(signals: AbortSignal[]): AbortSignal;\n    /**\n     * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)\n     */\n    get aborted(): boolean;\n    /**\n     * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)\n     */\n    get reason(): any;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    get onabort(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    set onabort(value: any | null);\n    /**\n     * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)\n     */\n    throwIfAborted(): void;\n}\ninterface Scheduler {\n    wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;\n}\ninterface SchedulerWaitOptions {\n    signal?: AbortSignal;\n}\n/**\n * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)\n */\ndeclare abstract class ExtendableEvent extends Event {\n    /**\n     * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)\n     */\n    waitUntil(promise: Promise<any>): void;\n}\n/**\n * The **`CustomEvent`** interface represents events initialized by an application for any purpose.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)\n */\ndeclare class CustomEvent<T = any> extends Event {\n    constructor(type: string, init?: CustomEventCustomEventInit);\n    /**\n     * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)\n     */\n    get detail(): T;\n}\ninterface CustomEventCustomEventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n    detail?: any;\n}\n/**\n * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)\n */\ndeclare class Blob {\n    constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);\n    /**\n     * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)\n     */\n    get size(): number;\n    /**\n     * The **`type`** read-only property of the Blob interface returns the MIME type of the file.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)\n     */\n    get type(): string;\n    /**\n     * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)\n     */\n    slice(start?: number, end?: number, type?: string): Blob;\n    /**\n     * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)\n     */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /**\n     * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)\n     */\n    bytes(): Promise<Uint8Array>;\n    /**\n     * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)\n     */\n    text(): Promise<string>;\n    /**\n     * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)\n     */\n    stream(): ReadableStream;\n}\ninterface BlobOptions {\n    type?: string;\n}\n/**\n * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)\n */\ndeclare class File extends Blob {\n    constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);\n    /**\n     * The **`name`** read-only property of the File interface returns the name of the file represented by a File object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)\n     */\n    get name(): string;\n    /**\n     * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)\n     */\n    get lastModified(): number;\n}\ninterface FileOptions {\n    type?: string;\n    lastModified?: number;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class CacheStorage {\n    /**\n     * The **`open()`** method of the the Cache object matching the `cacheName`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)\n     */\n    open(cacheName: string): Promise<Cache>;\n    readonly default: Cache;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class Cache {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */\n    delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */\n    match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */\n    put(request: RequestInfo | URL, response: Response): Promise<void>;\n}\ninterface CacheQueryOptions {\n    ignoreMethod?: boolean;\n}\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare abstract class Crypto {\n    /**\n     * The **`Crypto.subtle`** read-only property returns a cryptographic operations.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)\n     */\n    get subtle(): SubtleCrypto;\n    /**\n     * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)\n     */\n    getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;\n    /**\n     * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)\n     */\n    randomUUID(): string;\n    DigestStream: typeof DigestStream;\n}\n/**\n * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)\n */\ndeclare abstract class SubtleCrypto {\n    /**\n     * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)\n     */\n    encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)\n     */\n    decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)\n     */\n    sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)\n     */\n    verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;\n    /**\n     * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)\n     */\n    digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)\n     */\n    generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;\n    /**\n     * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)\n     */\n    deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`deriveBits()`** method of the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)\n     */\n    deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;\n    /**\n     * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)\n     */\n    importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)\n     */\n    exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;\n    /**\n     * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)\n     */\n    wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;\n    /**\n     * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)\n     */\n    unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;\n}\n/**\n * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)\n */\ndeclare abstract class CryptoKey {\n    /**\n     * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)\n     */\n    readonly type: string;\n    /**\n     * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)\n     */\n    readonly extractable: boolean;\n    /**\n     * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)\n     */\n    readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;\n    /**\n     * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)\n     */\n    readonly usages: string[];\n}\ninterface CryptoKeyPair {\n    publicKey: CryptoKey;\n    privateKey: CryptoKey;\n}\ninterface JsonWebKey {\n    kty: string;\n    use?: string;\n    key_ops?: string[];\n    alg?: string;\n    ext?: boolean;\n    crv?: string;\n    x?: string;\n    y?: string;\n    d?: string;\n    n?: string;\n    e?: string;\n    p?: string;\n    q?: string;\n    dp?: string;\n    dq?: string;\n    qi?: string;\n    oth?: RsaOtherPrimesInfo[];\n    k?: string;\n}\ninterface RsaOtherPrimesInfo {\n    r?: string;\n    d?: string;\n    t?: string;\n}\ninterface SubtleCryptoDeriveKeyAlgorithm {\n    name: string;\n    salt?: (ArrayBuffer | ArrayBufferView);\n    iterations?: number;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    $public?: CryptoKey;\n    info?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoEncryptAlgorithm {\n    name: string;\n    iv?: (ArrayBuffer | ArrayBufferView);\n    additionalData?: (ArrayBuffer | ArrayBufferView);\n    tagLength?: number;\n    counter?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    label?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoGenerateKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    modulusLength?: number;\n    publicExponent?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    namedCurve?: string;\n}\ninterface SubtleCryptoHashAlgorithm {\n    name: string;\n}\ninterface SubtleCryptoImportKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    length?: number;\n    namedCurve?: string;\n    compressed?: boolean;\n}\ninterface SubtleCryptoSignAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    dataLength?: number;\n    saltLength?: number;\n}\ninterface CryptoKeyKeyAlgorithm {\n    name: string;\n}\ninterface CryptoKeyAesKeyAlgorithm {\n    name: string;\n    length: number;\n}\ninterface CryptoKeyHmacKeyAlgorithm {\n    name: string;\n    hash: CryptoKeyKeyAlgorithm;\n    length: number;\n}\ninterface CryptoKeyRsaKeyAlgorithm {\n    name: string;\n    modulusLength: number;\n    publicExponent: ArrayBuffer | ArrayBufferView;\n    hash?: CryptoKeyKeyAlgorithm;\n}\ninterface CryptoKeyEllipticKeyAlgorithm {\n    name: string;\n    namedCurve: string;\n}\ninterface CryptoKeyArbitraryKeyAlgorithm {\n    name: string;\n    hash?: CryptoKeyKeyAlgorithm;\n    namedCurve?: string;\n    length?: number;\n}\ndeclare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {\n    constructor(algorithm: string | SubtleCryptoHashAlgorithm);\n    readonly digest: Promise<ArrayBuffer>;\n    get bytesWritten(): number | bigint;\n}\n/**\n * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)\n */\ndeclare class TextDecoder {\n    constructor(label?: string, options?: TextDecoderConstructorOptions);\n    /**\n     * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)\n     */\n    decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\n/**\n * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)\n */\ndeclare class TextEncoder {\n    constructor();\n    /**\n     * The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)\n     */\n    encode(input?: string): Uint8Array;\n    /**\n     * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)\n     */\n    encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;\n    get encoding(): string;\n}\ninterface TextDecoderConstructorOptions {\n    fatal: boolean;\n    ignoreBOM: boolean;\n}\ninterface TextDecoderDecodeOptions {\n    stream: boolean;\n}\ninterface TextEncoderEncodeIntoResult {\n    read: number;\n    written: number;\n}\n/**\n * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)\n */\ndeclare class ErrorEvent extends Event {\n    constructor(type: string, init?: ErrorEventErrorEventInit);\n    /**\n     * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)\n     */\n    get filename(): string;\n    /**\n     * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)\n     */\n    get message(): string;\n    /**\n     * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)\n     */\n    get lineno(): number;\n    /**\n     * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)\n     */\n    get colno(): number;\n    /**\n     * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)\n     */\n    get error(): any;\n}\ninterface ErrorEventErrorEventInit {\n    message?: string;\n    filename?: string;\n    lineno?: number;\n    colno?: number;\n    error?: any;\n}\n/**\n * The **`MessageEvent`** interface represents a message received by a target object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)\n */\ndeclare class MessageEvent extends Event {\n    constructor(type: string, initializer: MessageEventInit);\n    /**\n     * The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)\n     */\n    readonly data: any;\n    /**\n     * The **`origin`** read-only property of the origin of the message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)\n     */\n    readonly origin: string | null;\n    /**\n     * The **`lastEventId`** read-only property of the unique ID for the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)\n     */\n    readonly lastEventId: string;\n    /**\n     * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)\n     */\n    readonly source: MessagePort | null;\n    /**\n     * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)\n     */\n    readonly ports: MessagePort[];\n}\ninterface MessageEventInit {\n    data: ArrayBuffer | string;\n}\n/**\n * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)\n */\ndeclare abstract class PromiseRejectionEvent extends Event {\n    /**\n     * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)\n     */\n    readonly promise: Promise<any>;\n    /**\n     * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)\n     */\n    readonly reason: any;\n}\n/**\n * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)\n */\ndeclare class FormData {\n    constructor();\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string | Blob): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: Blob, filename?: string): void;\n    /**\n     * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)\n     */\n    delete(name: string): void;\n    /**\n     * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)\n     */\n    get(name: string): (File | string) | null;\n    /**\n     * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)\n     */\n    getAll(name: string): (File | string)[];\n    /**\n     * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string | Blob): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: Blob, filename?: string): void;\n    /* Returns an array of key, value pairs for every entry in the list. */\n    entries(): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n    /* Returns a list of keys in the list. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the list. */\n    values(): IterableIterator<(File | string)>;\n    forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n}\ninterface ContentOptions {\n    html?: boolean;\n}\ndeclare class HTMLRewriter {\n    constructor();\n    on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;\n    onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;\n    transform(response: Response): Response;\n}\ninterface HTMLRewriterElementContentHandlers {\n    element?(element: Element): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(element: Text): void | Promise<void>;\n}\ninterface HTMLRewriterDocumentContentHandlers {\n    doctype?(doctype: Doctype): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(text: Text): void | Promise<void>;\n    end?(end: DocumentEnd): void | Promise<void>;\n}\ninterface Doctype {\n    readonly name: string | null;\n    readonly publicId: string | null;\n    readonly systemId: string | null;\n}\ninterface Element {\n    tagName: string;\n    readonly attributes: IterableIterator<string[]>;\n    readonly removed: boolean;\n    readonly namespaceURI: string;\n    getAttribute(name: string): string | null;\n    hasAttribute(name: string): boolean;\n    setAttribute(name: string, value: string): Element;\n    removeAttribute(name: string): Element;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    append(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    remove(): Element;\n    removeAndKeepContent(): Element;\n    setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;\n}\ninterface EndTag {\n    name: string;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    remove(): EndTag;\n}\ninterface Comment {\n    text: string;\n    readonly removed: boolean;\n    before(content: string, options?: ContentOptions): Comment;\n    after(content: string, options?: ContentOptions): Comment;\n    replace(content: string, options?: ContentOptions): Comment;\n    remove(): Comment;\n}\ninterface Text {\n    readonly text: string;\n    readonly lastInTextNode: boolean;\n    readonly removed: boolean;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    remove(): Text;\n}\ninterface DocumentEnd {\n    append(content: string, options?: ContentOptions): DocumentEnd;\n}\n/**\n * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)\n */\ndeclare abstract class FetchEvent extends ExtendableEvent {\n    /**\n     * The **`request`** read-only property of the the event handler.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)\n     */\n    readonly request: Request;\n    /**\n     * The **`respondWith()`** method of allows you to provide a promise for a Response yourself.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)\n     */\n    respondWith(promise: Response | Promise<Response>): void;\n    passThroughOnException(): void;\n}\ntype HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;\n/**\n * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)\n */\ndeclare class Headers {\n    constructor(init?: HeadersInit);\n    /**\n     * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)\n     */\n    get(name: string): string | null;\n    getAll(name: string): string[];\n    /**\n     * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)\n     */\n    getSetCookie(): string[];\n    /**\n     * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)\n     */\n    delete(name: string): void;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;\n    /* Returns an iterator allowing to go through all key/value pairs contained in this object. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */\n    keys(): IterableIterator<string>;\n    /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */\n    values(): IterableIterator<string>;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ntype BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;\ndeclare abstract class Body {\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */\n    get body(): ReadableStream | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */\n    get bodyUsed(): boolean;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */\n    bytes(): Promise<Uint8Array>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */\n    text(): Promise<string>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */\n    json<T>(): Promise<T>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */\n    formData(): Promise<FormData>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */\n    blob(): Promise<Blob>;\n}\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ndeclare var Response: {\n    prototype: Response;\n    new (body?: BodyInit | null, init?: ResponseInit): Response;\n    error(): Response;\n    redirect(url: string, status?: number): Response;\n    json(any: any, maybeInit?: (ResponseInit | Response)): Response;\n};\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ninterface Response extends Body {\n    /**\n     * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)\n     */\n    clone(): Response;\n    /**\n     * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)\n     */\n    status: number;\n    /**\n     * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)\n     */\n    statusText: string;\n    /**\n     * The **`headers`** read-only property of the with the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)\n     */\n    ok: boolean;\n    /**\n     * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)\n     */\n    redirected: boolean;\n    /**\n     * The **`url`** read-only property of the Response interface contains the URL of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)\n     */\n    url: string;\n    webSocket: WebSocket | null;\n    cf: any | undefined;\n    /**\n     * The **`type`** read-only property of the Response interface contains the type of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)\n     */\n    type: \"default\" | \"error\";\n}\ninterface ResponseInit {\n    status?: number;\n    statusText?: string;\n    headers?: HeadersInit;\n    cf?: any;\n    webSocket?: (WebSocket | null);\n    encodeBody?: \"automatic\" | \"manual\";\n}\ntype RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ndeclare var Request: {\n    prototype: Request;\n    new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;\n};\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ninterface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {\n    /**\n     * The **`clone()`** method of the Request interface creates a copy of the current `Request` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)\n     */\n    clone(): Request<CfHostMetadata, Cf>;\n    /**\n     * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)\n     */\n    method: string;\n    /**\n     * The **`url`** read-only property of the Request interface contains the URL of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)\n     */\n    url: string;\n    /**\n     * The **`headers`** read-only property of the with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)\n     */\n    redirect: string;\n    fetcher: Fetcher | null;\n    /**\n     * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)\n     */\n    signal: AbortSignal;\n    cf?: Cf;\n    /**\n     * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)\n     */\n    integrity: string;\n    /**\n     * The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)\n     */\n    keepalive: boolean;\n    /**\n     * The **`cache`** read-only property of the Request interface contains the cache mode of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)\n     */\n    cache?: \"no-store\" | \"no-cache\";\n}\ninterface RequestInit<Cf = CfProperties> {\n    /* A string to set request's method. */\n    method?: string;\n    /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */\n    headers?: HeadersInit;\n    /* A BodyInit object or null to set request's body. */\n    body?: BodyInit | null;\n    /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */\n    redirect?: string;\n    fetcher?: (Fetcher | null);\n    cf?: Cf;\n    /* A string indicating how the request will interact with the browser's cache to set request's cache. */\n    cache?: \"no-store\" | \"no-cache\";\n    /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */\n    integrity?: string;\n    /* An AbortSignal to set request's signal. */\n    signal?: (AbortSignal | null);\n    encodeResponseBody?: \"automatic\" | \"manual\";\n}\ntype Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;\ntype Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | \"fetch\" | \"connect\"> : unknown) & {\n    fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;\n    connect(address: SocketAddress | string, options?: SocketOptions): Socket;\n};\ninterface KVNamespaceListKey<Metadata, Key extends string = string> {\n    name: Key;\n    expiration?: number;\n    metadata?: Metadata;\n}\ntype KVNamespaceListResult<Metadata, Key extends string = string> = {\n    list_complete: false;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cursor: string;\n    cacheStatus: string | null;\n} | {\n    list_complete: true;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cacheStatus: string | null;\n};\ninterface KVNamespace<Key extends string = string> {\n    get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;\n    get(key: Key, type: \"text\"): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, type: \"json\"): Promise<ExpectedValue | null>;\n    get(key: Key, type: \"arrayBuffer\"): Promise<ArrayBuffer | null>;\n    get(key: Key, type: \"stream\"): Promise<ReadableStream | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"text\">): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<\"json\">): Promise<ExpectedValue | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<ArrayBuffer | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"stream\">): Promise<ReadableStream | null>;\n    get(key: Array<Key>, type: \"text\"): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, ExpectedValue | null>>;\n    get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;\n    get(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, ExpectedValue | null>>;\n    list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;\n    put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;\n    getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"text\"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: \"json\"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"arrayBuffer\"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"stream\"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"text\">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"json\">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"stream\">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, type: \"text\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    delete(key: Key): Promise<void>;\n}\ninterface KVNamespaceListOptions {\n    limit?: number;\n    prefix?: (string | null);\n    cursor?: (string | null);\n}\ninterface KVNamespaceGetOptions<Type> {\n    type: Type;\n    cacheTtl?: number;\n}\ninterface KVNamespacePutOptions {\n    expiration?: number;\n    expirationTtl?: number;\n    metadata?: (any | null);\n}\ninterface KVNamespaceGetWithMetadataResult<Value, Metadata> {\n    value: Value | null;\n    metadata: Metadata | null;\n    cacheStatus: string | null;\n}\ntype QueueContentType = \"text\" | \"bytes\" | \"json\" | \"v8\";\ninterface Queue<Body = unknown> {\n    send(message: Body, options?: QueueSendOptions): Promise<void>;\n    sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>;\n}\ninterface QueueSendOptions {\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueSendBatchOptions {\n    delaySeconds?: number;\n}\ninterface MessageSendRequest<Body = unknown> {\n    body: Body;\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueRetryOptions {\n    delaySeconds?: number;\n}\ninterface Message<Body = unknown> {\n    readonly id: string;\n    readonly timestamp: Date;\n    readonly body: Body;\n    readonly attempts: number;\n    retry(options?: QueueRetryOptions): void;\n    ack(): void;\n}\ninterface QueueEvent<Body = unknown> extends ExtendableEvent {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface MessageBatch<Body = unknown> {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface R2Error extends Error {\n    readonly name: string;\n    readonly code: number;\n    readonly message: string;\n    readonly action: string;\n    readonly stack: any;\n}\ninterface R2ListOptions {\n    limit?: number;\n    prefix?: string;\n    cursor?: string;\n    delimiter?: string;\n    startAfter?: string;\n    include?: (\"httpMetadata\" | \"customMetadata\")[];\n}\ndeclare abstract class R2Bucket {\n    head(key: string): Promise<R2Object | null>;\n    get(key: string, options: R2GetOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2ObjectBody | R2Object | null>;\n    get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2Object | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;\n    createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;\n    resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;\n    delete(keys: string | string[]): Promise<void>;\n    list(options?: R2ListOptions): Promise<R2Objects>;\n}\ninterface R2MultipartUpload {\n    readonly key: string;\n    readonly uploadId: string;\n    uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;\n    abort(): Promise<void>;\n    complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;\n}\ninterface R2UploadedPart {\n    partNumber: number;\n    etag: string;\n}\ndeclare abstract class R2Object {\n    readonly key: string;\n    readonly version: string;\n    readonly size: number;\n    readonly etag: string;\n    readonly httpEtag: string;\n    readonly checksums: R2Checksums;\n    readonly uploaded: Date;\n    readonly httpMetadata?: R2HTTPMetadata;\n    readonly customMetadata?: Record<string, string>;\n    readonly range?: R2Range;\n    readonly storageClass: string;\n    readonly ssecKeyMd5?: string;\n    writeHttpMetadata(headers: Headers): void;\n}\ninterface R2ObjectBody extends R2Object {\n    get body(): ReadableStream;\n    get bodyUsed(): boolean;\n    arrayBuffer(): Promise<ArrayBuffer>;\n    bytes(): Promise<Uint8Array>;\n    text(): Promise<string>;\n    json<T>(): Promise<T>;\n    blob(): Promise<Blob>;\n}\ntype R2Range = {\n    offset: number;\n    length?: number;\n} | {\n    offset?: number;\n    length: number;\n} | {\n    suffix: number;\n};\ninterface R2Conditional {\n    etagMatches?: string;\n    etagDoesNotMatch?: string;\n    uploadedBefore?: Date;\n    uploadedAfter?: Date;\n    secondsGranularity?: boolean;\n}\ninterface R2GetOptions {\n    onlyIf?: (R2Conditional | Headers);\n    range?: (R2Range | Headers);\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2PutOptions {\n    onlyIf?: (R2Conditional | Headers);\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    md5?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha1?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha256?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha384?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha512?: ((ArrayBuffer | ArrayBufferView) | string);\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2MultipartOptions {\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2Checksums {\n    readonly md5?: ArrayBuffer;\n    readonly sha1?: ArrayBuffer;\n    readonly sha256?: ArrayBuffer;\n    readonly sha384?: ArrayBuffer;\n    readonly sha512?: ArrayBuffer;\n    toJSON(): R2StringChecksums;\n}\ninterface R2StringChecksums {\n    md5?: string;\n    sha1?: string;\n    sha256?: string;\n    sha384?: string;\n    sha512?: string;\n}\ninterface R2HTTPMetadata {\n    contentType?: string;\n    contentLanguage?: string;\n    contentDisposition?: string;\n    contentEncoding?: string;\n    cacheControl?: string;\n    cacheExpiry?: Date;\n}\ntype R2Objects = {\n    objects: R2Object[];\n    delimitedPrefixes: string[];\n} & ({\n    truncated: true;\n    cursor: string;\n} | {\n    truncated: false;\n});\ninterface R2UploadPartOptions {\n    ssecKey?: (ArrayBuffer | string);\n}\ndeclare abstract class ScheduledEvent extends ExtendableEvent {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface ScheduledController {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface QueuingStrategy<T = any> {\n    highWaterMark?: (number | bigint);\n    size?: (chunk: T) => number | bigint;\n}\ninterface UnderlyingSink<W = any> {\n    type?: string;\n    start?: (controller: WritableStreamDefaultController) => void | Promise<void>;\n    write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;\n    abort?: (reason: any) => void | Promise<void>;\n    close?: () => void | Promise<void>;\n}\ninterface UnderlyingByteSource {\n    type: \"bytes\";\n    autoAllocateChunkSize?: number;\n    start?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    pull?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n}\ninterface UnderlyingSource<R = any> {\n    type?: \"\" | undefined;\n    start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: (number | bigint);\n}\ninterface Transformer<I = any, O = any> {\n    readableType?: string;\n    writableType?: string;\n    start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: number;\n}\ninterface StreamPipeOptions {\n    preventAbort?: boolean;\n    preventCancel?: boolean;\n    /**\n     * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     *\n     * Errors and closures of the source and destination streams propagate as follows:\n     *\n     * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.\n     *\n     * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.\n     *\n     * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.\n     *\n     * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.\n     *\n     * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.\n     */\n    preventClose?: boolean;\n    signal?: AbortSignal;\n}\ntype ReadableStreamReadResult<R = any> = {\n    done: false;\n    value: R;\n} | {\n    done: true;\n    value?: undefined;\n};\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ninterface ReadableStream<R = any> {\n    /**\n     * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)\n     */\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(): ReadableStreamDefaultReader<R>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;\n    /**\n     * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)\n     */\n    pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;\n    /**\n     * The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)\n     */\n    pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;\n    /**\n     * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)\n     */\n    tee(): [\n        ReadableStream<R>,\n        ReadableStream<R>\n    ];\n    values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n    [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n}\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ndeclare const ReadableStream: {\n    prototype: ReadableStream;\n    new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;\n    new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;\n};\n/**\n * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)\n */\ndeclare class ReadableStreamDefaultReader<R = any> {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)\n     */\n    read(): Promise<ReadableStreamReadResult<R>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)\n */\ndeclare class ReadableStreamBYOBReader {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)\n     */\n    read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)\n     */\n    releaseLock(): void;\n    readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;\n}\ninterface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {\n    min?: number;\n}\ninterface ReadableStreamGetReaderOptions {\n    /**\n     * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.\n     *\n     * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.\n     */\n    mode: \"byob\";\n}\n/**\n * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)\n */\ndeclare abstract class ReadableStreamBYOBRequest {\n    /**\n     * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)\n     */\n    get view(): Uint8Array | null;\n    /**\n     * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)\n     */\n    respond(bytesWritten: number): void;\n    /**\n     * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)\n     */\n    respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;\n    get atLeast(): number | null;\n}\n/**\n * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)\n */\ndeclare abstract class ReadableStreamDefaultController<R = any> {\n    /**\n     * The **`desiredSize`** read-only property of the required to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: R): void;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)\n */\ndeclare abstract class ReadableByteStreamController {\n    /**\n     * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)\n     */\n    get byobRequest(): ReadableStreamBYOBRequest | null;\n    /**\n     * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)\n     */\n    enqueue(chunk: ArrayBuffer | ArrayBufferView): void;\n    /**\n     * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)\n */\ndeclare abstract class WritableStreamDefaultController {\n    /**\n     * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)\n     */\n    error(reason?: any): void;\n}\n/**\n * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)\n */\ndeclare abstract class TransformStreamDefaultController<O = any> {\n    /**\n     * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: O): void;\n    /**\n     * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)\n     */\n    error(reason: any): void;\n    /**\n     * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)\n     */\n    terminate(): void;\n}\ninterface ReadableWritablePair<R = any, W = any> {\n    readable: ReadableStream<R>;\n    /**\n     * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     */\n    writable: WritableStream<W>;\n}\n/**\n * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)\n */\ndeclare class WritableStream<W = any> {\n    constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);\n    /**\n     * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the WritableStream interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)\n     */\n    getWriter(): WritableStreamDefaultWriter<W>;\n}\n/**\n * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)\n */\ndeclare class WritableStreamDefaultWriter<W = any> {\n    constructor(stream: WritableStream);\n    /**\n     * The **`closed`** read-only property of the the stream errors or the writer's lock is released.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)\n     */\n    get closed(): Promise<void>;\n    /**\n     * The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)\n     */\n    get ready(): Promise<void>;\n    /**\n     * The **`desiredSize`** read-only property of the to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`write()`** method of the operation.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)\n     */\n    write(chunk?: W): Promise<void>;\n    /**\n     * The **`releaseLock()`** method of the corresponding stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)\n */\ndeclare class TransformStream<I = any, O = any> {\n    constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);\n    /**\n     * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)\n     */\n    get readable(): ReadableStream<O>;\n    /**\n     * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)\n     */\n    get writable(): WritableStream<I>;\n}\ndeclare class FixedLengthStream extends IdentityTransformStream {\n    constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ndeclare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ninterface IdentityTransformStreamQueuingStrategy {\n    highWaterMark?: (number | bigint);\n}\ninterface ReadableStreamValuesOptions {\n    preventCancel?: boolean;\n}\n/**\n * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)\n */\ndeclare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)\n */\ndeclare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)\n */\ndeclare class TextEncoderStream extends TransformStream<string, Uint8Array> {\n    constructor();\n    get encoding(): string;\n}\n/**\n * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)\n */\ndeclare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {\n    constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\ninterface TextDecoderStreamTextDecoderStreamInit {\n    fatal?: boolean;\n    ignoreBOM?: boolean;\n}\n/**\n * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)\n */\ndeclare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\n/**\n * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)\n */\ndeclare class CountQueuingStrategy implements QueuingStrategy {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\ninterface QueuingStrategyInit {\n    /**\n     * Creates a new ByteLengthQueuingStrategy with the provided high water mark.\n     *\n     * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.\n     */\n    highWaterMark: number;\n}\ninterface ScriptVersion {\n    id?: string;\n    tag?: string;\n    message?: string;\n}\ndeclare abstract class TailEvent extends ExtendableEvent {\n    readonly events: TraceItem[];\n    readonly traces: TraceItem[];\n}\ninterface TraceItem {\n    readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;\n    readonly eventTimestamp: number | null;\n    readonly logs: TraceLog[];\n    readonly exceptions: TraceException[];\n    readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];\n    readonly scriptName: string | null;\n    readonly entrypoint?: string;\n    readonly scriptVersion?: ScriptVersion;\n    readonly dispatchNamespace?: string;\n    readonly scriptTags?: string[];\n    readonly durableObjectId?: string;\n    readonly outcome: string;\n    readonly executionModel: string;\n    readonly truncated: boolean;\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface TraceItemAlarmEventInfo {\n    readonly scheduledTime: Date;\n}\ninterface TraceItemCustomEventInfo {\n}\ninterface TraceItemScheduledEventInfo {\n    readonly scheduledTime: number;\n    readonly cron: string;\n}\ninterface TraceItemQueueEventInfo {\n    readonly queue: string;\n    readonly batchSize: number;\n}\ninterface TraceItemEmailEventInfo {\n    readonly mailFrom: string;\n    readonly rcptTo: string;\n    readonly rawSize: number;\n}\ninterface TraceItemTailEventInfo {\n    readonly consumedEvents: TraceItemTailEventInfoTailItem[];\n}\ninterface TraceItemTailEventInfoTailItem {\n    readonly scriptName: string | null;\n}\ninterface TraceItemFetchEventInfo {\n    readonly response?: TraceItemFetchEventInfoResponse;\n    readonly request: TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoRequest {\n    readonly cf?: any;\n    readonly headers: Record<string, string>;\n    readonly method: string;\n    readonly url: string;\n    getUnredacted(): TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoResponse {\n    readonly status: number;\n}\ninterface TraceItemJsRpcEventInfo {\n    readonly rpcMethod: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfo {\n    readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;\n}\ninterface TraceItemHibernatableWebSocketEventInfoMessage {\n    readonly webSocketEventType: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfoClose {\n    readonly webSocketEventType: string;\n    readonly code: number;\n    readonly wasClean: boolean;\n}\ninterface TraceItemHibernatableWebSocketEventInfoError {\n    readonly webSocketEventType: string;\n}\ninterface TraceLog {\n    readonly timestamp: number;\n    readonly level: string;\n    readonly message: any;\n}\ninterface TraceException {\n    readonly timestamp: number;\n    readonly message: string;\n    readonly name: string;\n    readonly stack?: string;\n}\ninterface TraceDiagnosticChannelEvent {\n    readonly timestamp: number;\n    readonly channel: string;\n    readonly message: any;\n}\ninterface TraceMetrics {\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface UnsafeTraceMetrics {\n    fromTrace(item: TraceItem): TraceMetrics;\n}\n/**\n * The **`URL`** interface is used to parse, construct, normalize, and encode URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)\n */\ndeclare class URL {\n    constructor(url: string | URL, base?: string | URL);\n    /**\n     * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)\n     */\n    get origin(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    get href(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    set href(value: string);\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    get protocol(): string;\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    set protocol(value: string);\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    get username(): string;\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    set username(value: string);\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    get password(): string;\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    set password(value: string);\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    get host(): string;\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    set host(value: string);\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    get hostname(): string;\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    set hostname(value: string);\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    get port(): string;\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    set port(value: string);\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    get pathname(): string;\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    set pathname(value: string);\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    get search(): string;\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    set search(value: string);\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    get hash(): string;\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    set hash(value: string);\n    /**\n     * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)\n     */\n    get searchParams(): URLSearchParams;\n    /**\n     * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)\n     */\n    toJSON(): string;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    /**\n     * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)\n     */\n    static canParse(url: string, base?: string): boolean;\n    /**\n     * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)\n     */\n    static parse(url: string, base?: string): URL | null;\n    /**\n     * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)\n     */\n    static createObjectURL(object: File | Blob): string;\n    /**\n     * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)\n     */\n    static revokeObjectURL(object_url: string): void;\n}\n/**\n * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)\n */\ndeclare class URLSearchParams {\n    constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));\n    /**\n     * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)\n     */\n    get size(): number;\n    /**\n     * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)\n     */\n    delete(name: string, value?: string): void;\n    /**\n     * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)\n     */\n    get(name: string): string | null;\n    /**\n     * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)\n     */\n    getAll(name: string): string[];\n    /**\n     * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)\n     */\n    has(name: string, value?: string): boolean;\n    /**\n     * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)\n     */\n    sort(): void;\n    /* Returns an array of key, value pairs for every entry in the search params. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns a list of keys in the search params. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the search params. */\n    values(): IterableIterator<string>;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ndeclare class URLPattern {\n    constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);\n    get protocol(): string;\n    get username(): string;\n    get password(): string;\n    get hostname(): string;\n    get port(): string;\n    get pathname(): string;\n    get search(): string;\n    get hash(): string;\n    get hasRegExpGroups(): boolean;\n    test(input?: (string | URLPatternInit), baseURL?: string): boolean;\n    exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;\n}\ninterface URLPatternInit {\n    protocol?: string;\n    username?: string;\n    password?: string;\n    hostname?: string;\n    port?: string;\n    pathname?: string;\n    search?: string;\n    hash?: string;\n    baseURL?: string;\n}\ninterface URLPatternComponentResult {\n    input: string;\n    groups: Record<string, string>;\n}\ninterface URLPatternResult {\n    inputs: (string | URLPatternInit)[];\n    protocol: URLPatternComponentResult;\n    username: URLPatternComponentResult;\n    password: URLPatternComponentResult;\n    hostname: URLPatternComponentResult;\n    port: URLPatternComponentResult;\n    pathname: URLPatternComponentResult;\n    search: URLPatternComponentResult;\n    hash: URLPatternComponentResult;\n}\ninterface URLPatternOptions {\n    ignoreCase?: boolean;\n}\n/**\n * A `CloseEvent` is sent to clients using WebSockets when the connection is closed.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)\n */\ndeclare class CloseEvent extends Event {\n    constructor(type: string, initializer?: CloseEventInit);\n    /**\n     * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)\n     */\n    readonly code: number;\n    /**\n     * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)\n     */\n    readonly reason: string;\n    /**\n     * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)\n     */\n    readonly wasClean: boolean;\n}\ninterface CloseEventInit {\n    code?: number;\n    reason?: string;\n    wasClean?: boolean;\n}\ntype WebSocketEventMap = {\n    close: CloseEvent;\n    message: MessageEvent;\n    open: Event;\n    error: ErrorEvent;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ndeclare var WebSocket: {\n    prototype: WebSocket;\n    new (url: string, protocols?: (string[] | string)): WebSocket;\n    readonly READY_STATE_CONNECTING: number;\n    readonly CONNECTING: number;\n    readonly READY_STATE_OPEN: number;\n    readonly OPEN: number;\n    readonly READY_STATE_CLOSING: number;\n    readonly CLOSING: number;\n    readonly READY_STATE_CLOSED: number;\n    readonly CLOSED: number;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ninterface WebSocket extends EventTarget<WebSocketEventMap> {\n    accept(options?: WebSocketAcceptOptions): void;\n    /**\n     * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)\n     */\n    send(message: (ArrayBuffer | ArrayBufferView) | string): void;\n    /**\n     * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)\n     */\n    close(code?: number, reason?: string): void;\n    serializeAttachment(attachment: any): void;\n    deserializeAttachment(): any | null;\n    /**\n     * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)\n     */\n    readyState: number;\n    /**\n     * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)\n     */\n    url: string | null;\n    /**\n     * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)\n     */\n    protocol: string | null;\n    /**\n     * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)\n     */\n    extensions: string | null;\n    /**\n     * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)\n     */\n    binaryType: \"blob\" | \"arraybuffer\";\n}\ninterface WebSocketAcceptOptions {\n    /**\n     * When set to `true`, receiving a server-initiated WebSocket Close frame will not\n     * automatically send a reciprocal Close frame, leaving the connection in a half-open\n     * state. This is useful for proxying scenarios where you need to coordinate closing\n     * both sides independently. Defaults to `false` when the\n     * `no_web_socket_half_open_by_default` compatibility flag is enabled.\n     */\n    allowHalfOpen?: boolean;\n}\ndeclare const WebSocketPair: {\n    new (): {\n        0: WebSocket;\n        1: WebSocket;\n    };\n};\ninterface SqlStorage {\n    exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;\n    get databaseSize(): number;\n    Cursor: typeof SqlStorageCursor;\n    Statement: typeof SqlStorageStatement;\n}\ndeclare abstract class SqlStorageStatement {\n}\ntype SqlStorageValue = ArrayBuffer | string | number | null;\ndeclare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {\n    next(): {\n        done?: false;\n        value: T;\n    } | {\n        done: true;\n        value?: never;\n    };\n    toArray(): T[];\n    one(): T;\n    raw<U extends SqlStorageValue[]>(): IterableIterator<U>;\n    columnNames: string[];\n    get rowsRead(): number;\n    get rowsWritten(): number;\n    [Symbol.iterator](): IterableIterator<T>;\n}\ninterface Socket {\n    get readable(): ReadableStream;\n    get writable(): WritableStream;\n    get closed(): Promise<void>;\n    get opened(): Promise<SocketInfo>;\n    get upgraded(): boolean;\n    get secureTransport(): \"on\" | \"off\" | \"starttls\";\n    close(): Promise<void>;\n    startTls(options?: TlsOptions): Socket;\n}\ninterface SocketOptions {\n    secureTransport?: string;\n    allowHalfOpen: boolean;\n    highWaterMark?: (number | bigint);\n}\ninterface SocketAddress {\n    hostname: string;\n    port: number;\n}\ninterface TlsOptions {\n    expectedServerHostname?: string;\n}\ninterface SocketInfo {\n    remoteAddress?: string;\n    localAddress?: string;\n}\n/**\n * The **`EventSource`** interface is web content's interface to server-sent events.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)\n */\ndeclare class EventSource extends EventTarget {\n    constructor(url: string, init?: EventSourceEventSourceInit);\n    /**\n     * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)\n     */\n    close(): void;\n    /**\n     * The **`url`** read-only property of the URL of the source.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)\n     */\n    get url(): string;\n    /**\n     * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)\n     */\n    get withCredentials(): boolean;\n    /**\n     * The **`readyState`** read-only property of the connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)\n     */\n    get readyState(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    get onopen(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    set onopen(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    get onmessage(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    set onmessage(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    get onerror(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    set onerror(value: any | null);\n    static readonly CONNECTING: number;\n    static readonly OPEN: number;\n    static readonly CLOSED: number;\n    static from(stream: ReadableStream): EventSource;\n}\ninterface EventSourceEventSourceInit {\n    withCredentials?: boolean;\n    fetcher?: Fetcher;\n}\ninterface Container {\n    get running(): boolean;\n    start(options?: ContainerStartupOptions): void;\n    monitor(): Promise<void>;\n    destroy(error?: any): Promise<void>;\n    signal(signo: number): void;\n    getTcpPort(port: number): Fetcher;\n    setInactivityTimeout(durationMs: number | bigint): Promise<void>;\n    interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;\n    interceptAllOutboundHttp(binding: Fetcher): Promise<void>;\n}\ninterface ContainerStartupOptions {\n    entrypoint?: string[];\n    enableInternet: boolean;\n    env?: Record<string, string>;\n    hardTimeout?: (number | bigint);\n}\n/**\n * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)\n */\ndeclare abstract class MessagePort extends EventTarget {\n    /**\n     * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)\n     */\n    postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;\n    /**\n     * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)\n     */\n    close(): void;\n    /**\n     * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)\n     */\n    start(): void;\n    get onmessage(): any | null;\n    set onmessage(value: any | null);\n}\n/**\n * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)\n */\ndeclare class MessageChannel {\n    constructor();\n    /**\n     * The **`port1`** read-only property of the the port attached to the context that originated the channel.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)\n     */\n    readonly port1: MessagePort;\n    /**\n     * The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)\n     */\n    readonly port2: MessagePort;\n}\ninterface MessagePortPostMessageOptions {\n    transfer?: any[];\n}\ntype LoopbackForExport<T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub<InstanceType<T>> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass<InstanceType<T>> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;\ntype LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {\n    props?: Props;\n}) => Fetcher<T> : (opts: {\n    props?: any;\n}) => Fetcher<T>);\ntype LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {\n    props?: Props;\n}) => DurableObjectClass<T> : (opts: {\n    props?: any;\n}) => DurableObjectClass<T>);\ninterface SyncKvStorage {\n    get<T = unknown>(key: string): T | undefined;\n    list<T = unknown>(options?: SyncKvListOptions): Iterable<[\n        string,\n        T\n    ]>;\n    put<T>(key: string, value: T): void;\n    delete(key: string): boolean;\n}\ninterface SyncKvListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n}\ninterface WorkerStub {\n    getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;\n}\ninterface WorkerStubEntrypointOptions {\n    props?: any;\n}\ninterface WorkerLoader {\n    get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;\n    load(code: WorkerLoaderWorkerCode): WorkerStub;\n}\ninterface WorkerLoaderModule {\n    js?: string;\n    cjs?: string;\n    text?: string;\n    data?: ArrayBuffer;\n    json?: any;\n    py?: string;\n    wasm?: ArrayBuffer;\n}\ninterface WorkerLoaderWorkerCode {\n    compatibilityDate: string;\n    compatibilityFlags?: string[];\n    allowExperimental?: boolean;\n    mainModule: string;\n    modules: Record<string, WorkerLoaderModule | string>;\n    env?: any;\n    globalOutbound?: (Fetcher | null);\n    tails?: Fetcher[];\n    streamingTails?: Fetcher[];\n}\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare abstract class Performance {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */\n    get timeOrigin(): number;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */\n    now(): number;\n    /**\n     * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)\n     */\n    toJSON(): object;\n}\n// AI Search V2 API Error Interfaces\ninterface AiSearchInternalError extends Error {\n}\ninterface AiSearchNotFoundError extends Error {\n}\ninterface AiSearchNameNotSetError extends Error {\n}\n// AI Search V2 Request Types\ntype AiSearchSearchRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            /** Maximum number of results (1-50, default 10) */\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            /** Context expansion (0-3, default 0) */\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            /** Enable reranking (default false) */\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n};\ntype AiSearchChatCompletionsRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    model?: string;\n    stream?: boolean;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            match_threshold?: number;\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n    [key: string]: unknown;\n};\n// AI Search V2 Response Types\ntype AiSearchSearchResponse = {\n    search_query: string;\n    chunks: Array<{\n        id: string;\n        type: string;\n        /** Match score (0-1) */\n        score: number;\n        text: string;\n        item: {\n            timestamp?: number;\n            key: string;\n            metadata?: Record<string, unknown>;\n        };\n        scoring_details?: {\n            /** Keyword match score (0-1) */\n            keyword_score?: number;\n            /** Vector similarity score (0-1) */\n            vector_score?: number;\n        };\n    }>;\n};\ntype AiSearchListResponse = Array<{\n    id: string;\n    internal_id?: string;\n    account_id?: string;\n    account_tag?: string;\n    /** Whether the instance is enabled (default true) */\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n}>;\ntype AiSearchConfig = {\n    /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */\n    id: string;\n    type: 'r2' | 'web-crawler';\n    source: string;\n    source_params?: object;\n    /** Token ID (UUID format) */\n    token_id?: string;\n    ai_gateway_id?: string;\n    /** Enable query rewriting (default false) */\n    rewrite_query?: boolean;\n    /** Enable reranking (default false) */\n    reranking?: boolean;\n    embedding_model?: string;\n    ai_search_model?: string;\n};\ntype AiSearchInstance = {\n    id: string;\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n};\n// AI Search Instance Service - Instance-level operations\ndeclare abstract class AiSearchInstanceService {\n    /**\n     * Search the AI Search instance for relevant chunks.\n     * @param params Search request with messages and AI search options\n     * @returns Search response with matching chunks\n     */\n    search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;\n    /**\n     * Generate chat completions with AI Search context.\n     * @param params Chat completions request with optional streaming\n     * @returns Response object (if streaming) or chat completion result\n     */\n    chatCompletions(params: AiSearchChatCompletionsRequest): Promise<Response | object>;\n    /**\n     * Delete this AI Search instance.\n     */\n    delete(): Promise<void>;\n}\n// AI Search Account Service - Account-level operations\ndeclare abstract class AiSearchAccountService {\n    /**\n     * List all AI Search instances in the account.\n     * @returns Array of AI Search instances\n     */\n    list(): Promise<AiSearchListResponse>;\n    /**\n     * Get an AI Search instance by ID.\n     * @param name Instance ID\n     * @returns Instance service for performing operations\n     */\n    get(name: string): AiSearchInstanceService;\n    /**\n     * Create a new AI Search instance.\n     * @param config Instance configuration\n     * @returns Instance service for performing operations\n     */\n    create(config: AiSearchConfig): Promise<AiSearchInstanceService>;\n}\ntype AiImageClassificationInput = {\n    image: number[];\n};\ntype AiImageClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiImageClassification {\n    inputs: AiImageClassificationInput;\n    postProcessedOutputs: AiImageClassificationOutput;\n}\ntype AiImageToTextInput = {\n    image: number[];\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageToText {\n    inputs: AiImageToTextInput;\n    postProcessedOutputs: AiImageToTextOutput;\n}\ntype AiImageTextToTextInput = {\n    image: string;\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    ignore_eos?: boolean;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageTextToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageTextToText {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiMultimodalEmbeddingsInput = {\n    image: string;\n    text: string[];\n};\ntype AiIMultimodalEmbeddingsOutput = {\n    data: number[][];\n    shape: number[];\n};\ndeclare abstract class BaseAiMultimodalEmbeddings {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiObjectDetectionInput = {\n    image: number[];\n};\ntype AiObjectDetectionOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiObjectDetection {\n    inputs: AiObjectDetectionInput;\n    postProcessedOutputs: AiObjectDetectionOutput;\n}\ntype AiSentenceSimilarityInput = {\n    source: string;\n    sentences: string[];\n};\ntype AiSentenceSimilarityOutput = number[];\ndeclare abstract class BaseAiSentenceSimilarity {\n    inputs: AiSentenceSimilarityInput;\n    postProcessedOutputs: AiSentenceSimilarityOutput;\n}\ntype AiAutomaticSpeechRecognitionInput = {\n    audio: number[];\n};\ntype AiAutomaticSpeechRecognitionOutput = {\n    text?: string;\n    words?: {\n        word: string;\n        start: number;\n        end: number;\n    }[];\n    vtt?: string;\n};\ndeclare abstract class BaseAiAutomaticSpeechRecognition {\n    inputs: AiAutomaticSpeechRecognitionInput;\n    postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;\n}\ntype AiSummarizationInput = {\n    input_text: string;\n    max_length?: number;\n};\ntype AiSummarizationOutput = {\n    summary: string;\n};\ndeclare abstract class BaseAiSummarization {\n    inputs: AiSummarizationInput;\n    postProcessedOutputs: AiSummarizationOutput;\n}\ntype AiTextClassificationInput = {\n    text: string;\n};\ntype AiTextClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiTextClassification {\n    inputs: AiTextClassificationInput;\n    postProcessedOutputs: AiTextClassificationOutput;\n}\ntype AiTextEmbeddingsInput = {\n    text: string | string[];\n};\ntype AiTextEmbeddingsOutput = {\n    shape: number[];\n    data: number[][];\n};\ndeclare abstract class BaseAiTextEmbeddings {\n    inputs: AiTextEmbeddingsInput;\n    postProcessedOutputs: AiTextEmbeddingsOutput;\n}\ntype RoleScopedChatInput = {\n    role: \"user\" | \"assistant\" | \"system\" | \"tool\" | (string & NonNullable<unknown>);\n    content: string;\n    name?: string;\n};\ntype AiTextGenerationToolLegacyInput = {\n    name: string;\n    description: string;\n    parameters?: {\n        type: \"object\" | (string & NonNullable<unknown>);\n        properties: {\n            [key: string]: {\n                type: string;\n                description?: string;\n            };\n        };\n        required: string[];\n    };\n};\ntype AiTextGenerationToolInput = {\n    type: \"function\" | (string & NonNullable<unknown>);\n    function: {\n        name: string;\n        description: string;\n        parameters?: {\n            type: \"object\" | (string & NonNullable<unknown>);\n            properties: {\n                [key: string]: {\n                    type: string;\n                    description?: string;\n                };\n            };\n            required: string[];\n        };\n    };\n};\ntype AiTextGenerationFunctionsInput = {\n    name: string;\n    code: string;\n};\ntype AiTextGenerationResponseFormat = {\n    type: string;\n    json_schema?: any;\n};\ntype AiTextGenerationInput = {\n    prompt?: string;\n    raw?: boolean;\n    stream?: boolean;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    messages?: RoleScopedChatInput[];\n    response_format?: AiTextGenerationResponseFormat;\n    tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);\n    functions?: AiTextGenerationFunctionsInput[];\n};\ntype AiTextGenerationToolLegacyOutput = {\n    name: string;\n    arguments: unknown;\n};\ntype AiTextGenerationToolOutput = {\n    id: string;\n    type: \"function\";\n    function: {\n        name: string;\n        arguments: string;\n    };\n};\ntype UsageTags = {\n    prompt_tokens: number;\n    completion_tokens: number;\n    total_tokens: number;\n};\ntype AiTextGenerationOutput = {\n    response?: string;\n    tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];\n    usage?: UsageTags;\n};\ndeclare abstract class BaseAiTextGeneration {\n    inputs: AiTextGenerationInput;\n    postProcessedOutputs: AiTextGenerationOutput;\n}\ntype AiTextToSpeechInput = {\n    prompt: string;\n    lang?: string;\n};\ntype AiTextToSpeechOutput = Uint8Array | {\n    audio: string;\n};\ndeclare abstract class BaseAiTextToSpeech {\n    inputs: AiTextToSpeechInput;\n    postProcessedOutputs: AiTextToSpeechOutput;\n}\ntype AiTextToImageInput = {\n    prompt: string;\n    negative_prompt?: string;\n    height?: number;\n    width?: number;\n    image?: number[];\n    image_b64?: string;\n    mask?: number[];\n    num_steps?: number;\n    strength?: number;\n    guidance?: number;\n    seed?: number;\n};\ntype AiTextToImageOutput = ReadableStream<Uint8Array>;\ndeclare abstract class BaseAiTextToImage {\n    inputs: AiTextToImageInput;\n    postProcessedOutputs: AiTextToImageOutput;\n}\ntype AiTranslationInput = {\n    text: string;\n    target_lang: string;\n    source_lang?: string;\n};\ntype AiTranslationOutput = {\n    translated_text?: string;\n};\ndeclare abstract class BaseAiTranslation {\n    inputs: AiTranslationInput;\n    postProcessedOutputs: AiTranslationOutput;\n}\n/**\n * Workers AI support for OpenAI's Responses API\n * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts\n *\n * It's a stripped down version from its source.\n * It currently supports basic function calling, json mode and accepts images as input.\n *\n * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.\n * We plan to add those incrementally as model + platform capabilities evolve.\n */\ntype ResponsesInput = {\n    background?: boolean | null;\n    conversation?: string | ResponseConversationParam | null;\n    include?: Array<ResponseIncludable> | null;\n    input?: string | ResponseInput;\n    instructions?: string | null;\n    max_output_tokens?: number | null;\n    parallel_tool_calls?: boolean | null;\n    previous_response_id?: string | null;\n    prompt_cache_key?: string;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    stream?: boolean | null;\n    stream_options?: StreamOptions | null;\n    temperature?: number | null;\n    text?: ResponseTextConfig;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    truncation?: \"auto\" | \"disabled\" | null;\n};\ntype ResponsesOutput = {\n    id?: string;\n    created_at?: number;\n    output_text?: string;\n    error?: ResponseError | null;\n    incomplete_details?: ResponseIncompleteDetails | null;\n    instructions?: string | Array<ResponseInputItem> | null;\n    object?: \"response\";\n    output?: Array<ResponseOutputItem>;\n    parallel_tool_calls?: boolean;\n    temperature?: number | null;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    max_output_tokens?: number | null;\n    previous_response_id?: string | null;\n    prompt?: ResponsePrompt | null;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    status?: ResponseStatus;\n    text?: ResponseTextConfig;\n    truncation?: \"auto\" | \"disabled\" | null;\n    usage?: ResponseUsage;\n};\ntype EasyInputMessage = {\n    content: string | ResponseInputMessageContentList;\n    role: \"user\" | \"assistant\" | \"system\" | \"developer\";\n    type?: \"message\";\n};\ntype ResponsesFunctionTool = {\n    name: string;\n    parameters: {\n        [key: string]: unknown;\n    } | null;\n    strict: boolean | null;\n    type: \"function\";\n    description?: string | null;\n};\ntype ResponseIncompleteDetails = {\n    reason?: \"max_output_tokens\" | \"content_filter\";\n};\ntype ResponsePrompt = {\n    id: string;\n    variables?: {\n        [key: string]: string | ResponseInputText | ResponseInputImage;\n    } | null;\n    version?: string | null;\n};\ntype Reasoning = {\n    effort?: ReasoningEffort | null;\n    generate_summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n    summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n};\ntype ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;\ntype ResponseContentReasoningText = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseConversationParam = {\n    id: string;\n};\ntype ResponseCreatedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.created\";\n};\ntype ResponseCustomToolCallOutput = {\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"custom_tool_call_output\";\n    id?: string;\n};\ntype ResponseError = {\n    code: \"server_error\" | \"rate_limit_exceeded\" | \"invalid_prompt\" | \"vector_store_timeout\" | \"invalid_image\" | \"invalid_image_format\" | \"invalid_base64_image\" | \"invalid_image_url\" | \"image_too_large\" | \"image_too_small\" | \"image_parse_error\" | \"image_content_policy_violation\" | \"invalid_image_mode\" | \"image_file_too_large\" | \"unsupported_image_media_type\" | \"empty_image_file\" | \"failed_to_download_image\" | \"image_file_not_found\";\n    message: string;\n};\ntype ResponseErrorEvent = {\n    code: string | null;\n    message: string;\n    param: string | null;\n    sequence_number: number;\n    type: \"error\";\n};\ntype ResponseFailedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.failed\";\n};\ntype ResponseFormatText = {\n    type: \"text\";\n};\ntype ResponseFormatJSONObject = {\n    type: \"json_object\";\n};\ntype ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;\ntype ResponseFormatTextJSONSchemaConfig = {\n    name: string;\n    schema: {\n        [key: string]: unknown;\n    };\n    type: \"json_schema\";\n    description?: string;\n    strict?: boolean | null;\n};\ntype ResponseFunctionCallArgumentsDeltaEvent = {\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.delta\";\n};\ntype ResponseFunctionCallArgumentsDoneEvent = {\n    arguments: string;\n    item_id: string;\n    name: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.done\";\n};\ntype ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;\ntype ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;\ntype ResponseFunctionToolCall = {\n    arguments: string;\n    call_id: string;\n    name: string;\n    type: \"function_call\";\n    id?: string;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ninterface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {\n    id: string;\n}\ntype ResponseFunctionToolCallOutputItem = {\n    id: string;\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"function_call_output\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseIncludable = \"message.input_image.image_url\" | \"message.output_text.logprobs\";\ntype ResponseIncompleteEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.incomplete\";\n};\ntype ResponseInput = Array<ResponseInputItem>;\ntype ResponseInputContent = ResponseInputText | ResponseInputImage;\ntype ResponseInputImage = {\n    detail: \"low\" | \"high\" | \"auto\";\n    type: \"input_image\";\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputImageContent = {\n    type: \"input_image\";\n    detail?: \"low\" | \"high\" | \"auto\" | null;\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;\ntype ResponseInputItemFunctionCallOutput = {\n    call_id: string;\n    output: string | ResponseFunctionCallOutputItemList;\n    type: \"function_call_output\";\n    id?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\" | null;\n};\ntype ResponseInputItemMessage = {\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputMessageContentList = Array<ResponseInputContent>;\ntype ResponseInputMessageItem = {\n    id: string;\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputText = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseInputTextContent = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;\ntype ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;\ntype ResponseOutputItemAddedEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.added\";\n};\ntype ResponseOutputItemDoneEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.done\";\n};\ntype ResponseOutputMessage = {\n    id: string;\n    content: Array<ResponseOutputText | ResponseOutputRefusal>;\n    role: \"assistant\";\n    status: \"in_progress\" | \"completed\" | \"incomplete\";\n    type: \"message\";\n};\ntype ResponseOutputRefusal = {\n    refusal: string;\n    type: \"refusal\";\n};\ntype ResponseOutputText = {\n    text: string;\n    type: \"output_text\";\n    logprobs?: Array<Logprob>;\n};\ntype ResponseReasoningItem = {\n    id: string;\n    summary: Array<ResponseReasoningSummaryItem>;\n    type: \"reasoning\";\n    content?: Array<ResponseReasoningContentItem>;\n    encrypted_content?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseReasoningSummaryItem = {\n    text: string;\n    type: \"summary_text\";\n};\ntype ResponseReasoningContentItem = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseReasoningTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.reasoning_text.delta\";\n};\ntype ResponseReasoningTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.reasoning_text.done\";\n};\ntype ResponseRefusalDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.refusal.delta\";\n};\ntype ResponseRefusalDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    refusal: string;\n    sequence_number: number;\n    type: \"response.refusal.done\";\n};\ntype ResponseStatus = \"completed\" | \"failed\" | \"in_progress\" | \"cancelled\" | \"queued\" | \"incomplete\";\ntype ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;\ntype ResponseCompletedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.completed\";\n};\ntype ResponseTextConfig = {\n    format?: ResponseFormatTextConfig;\n    verbosity?: \"low\" | \"medium\" | \"high\" | null;\n};\ntype ResponseTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_text.delta\";\n};\ntype ResponseTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.output_text.done\";\n};\ntype Logprob = {\n    token: string;\n    logprob: number;\n    top_logprobs?: Array<TopLogprob>;\n};\ntype TopLogprob = {\n    token?: string;\n    logprob?: number;\n};\ntype ResponseUsage = {\n    input_tokens: number;\n    output_tokens: number;\n    total_tokens: number;\n};\ntype Tool = ResponsesFunctionTool;\ntype ToolChoiceFunction = {\n    name: string;\n    type: \"function\";\n};\ntype ToolChoiceOptions = \"none\";\ntype ReasoningEffort = \"minimal\" | \"low\" | \"medium\" | \"high\" | null;\ntype StreamOptions = {\n    include_obfuscation?: boolean;\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;\n}\ntype Ai_Cf_Openai_Whisper_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper {\n    inputs: Ai_Cf_Openai_Whisper_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;\n}\ntype Ai_Cf_Meta_M2M100_1_2B_Input = {\n    /**\n     * The text to be translated\n     */\n    text: string;\n    /**\n     * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n     */\n    source_lang?: string;\n    /**\n     * The language code to translate the text into (e.g., 'es' for Spanish)\n     */\n    target_lang: string;\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        /**\n         * The text to be translated\n         */\n        text: string;\n        /**\n         * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n         */\n        source_lang?: string;\n        /**\n         * The language code to translate the text into (e.g., 'es' for Spanish)\n         */\n        target_lang: string;\n    }[];\n};\ntype Ai_Cf_Meta_M2M100_1_2B_Output = {\n    /**\n     * The translated text in the target language\n     */\n    translated_text?: string;\n} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;\ninterface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {\n    inputs: Ai_Cf_Meta_M2M100_1_2B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;\n}\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;\n}\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;\n}\ntype Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt?: string;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    image: number[] | (string & NonNullable<unknown>);\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n};\ninterface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {\n    description?: string;\n}\ndeclare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {\n    inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;\n    postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;\n}\ntype Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Tiny_En_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {\n    inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {\n    /**\n     * Base64 encoded value of the audio data.\n     */\n    audio: string;\n    /**\n     * Supported tasks are 'translate' or 'transcribe'.\n     */\n    task?: string;\n    /**\n     * The language of the audio being transcribed or translated.\n     */\n    language?: string;\n    /**\n     * Preprocess the audio with a voice activity detection model.\n     */\n    vad_filter?: boolean;\n    /**\n     * A text prompt to help provide context to the model on the contents of the audio.\n     */\n    initial_prompt?: string;\n    /**\n     * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.\n     */\n    prefix?: string;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {\n    transcription_info?: {\n        /**\n         * The language of the audio being transcribed or translated.\n         */\n        language?: string;\n        /**\n         * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.\n         */\n        language_probability?: number;\n        /**\n         * The total duration of the original audio file, in seconds.\n         */\n        duration?: number;\n        /**\n         * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.\n         */\n        duration_after_vad?: number;\n    };\n    /**\n     * The complete transcription of the audio.\n     */\n    text: string;\n    /**\n     * The total number of words in the transcription.\n     */\n    word_count?: number;\n    segments?: {\n        /**\n         * The starting time of the segment within the audio, in seconds.\n         */\n        start?: number;\n        /**\n         * The ending time of the segment within the audio, in seconds.\n         */\n        end?: number;\n        /**\n         * The transcription of the segment.\n         */\n        text?: string;\n        /**\n         * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.\n         */\n        temperature?: number;\n        /**\n         * The average log probability of the predictions for the words in this segment, indicating overall confidence.\n         */\n        avg_logprob?: number;\n        /**\n         * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.\n         */\n        compression_ratio?: number;\n        /**\n         * The probability that the segment contains no speech, represented as a decimal between 0 and 1.\n         */\n        no_speech_prob?: number;\n        words?: {\n            /**\n             * The individual word transcribed from the audio.\n             */\n            word?: string;\n            /**\n             * The starting time of the word within the audio, in seconds.\n             */\n            start?: number;\n            /**\n             * The ending time of the word within the audio, in seconds.\n             */\n            end?: number;\n        }[];\n    }[];\n    /**\n     * The transcription in WebVTT format, which includes timing and text information for use in subtitles.\n     */\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {\n    inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;\n}\ntype Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];\n};\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ntype Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Ouput_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Ouput_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Query {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {\n    response?: number[][];\n    shape?: number[];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_M3 {\n    inputs: Ai_Cf_Baai_Bge_M3_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer.\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {\n    inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;\n    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages;\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    image?: number[] | (string & NonNullable<unknown>);\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n}\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    image?: number[] | (string & NonNullable<unknown>);\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * If true, the response will be streamed back incrementally.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response?: string;\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {\n    inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {\n    requests?: {\n        /**\n         * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique.\n         */\n        external_reference?: string;\n        /**\n         * Prompt for the text generation model\n         */\n        prompt?: string;\n        /**\n         * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n         */\n        stream?: boolean;\n        /**\n         * The maximum number of tokens to generate in the response.\n         */\n        max_tokens?: number;\n        /**\n         * Controls the randomness of the output; higher values produce more random results.\n         */\n        temperature?: number;\n        /**\n         * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n         */\n        top_p?: number;\n        /**\n         * Random seed for reproducibility of the generation.\n         */\n        seed?: number;\n        /**\n         * Penalty for repeated tokens; higher values discourage repetition.\n         */\n        repetition_penalty?: number;\n        /**\n         * Decreases the likelihood of the model repeating the same lines verbatim.\n         */\n        frequency_penalty?: number;\n        /**\n         * Increases the likelihood of the model introducing new topics.\n         */\n        presence_penalty?: number;\n        response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;\n    }[];\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {\n    inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Input {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender must alternate between 'user' and 'assistant'.\n         */\n        role: \"user\" | \"assistant\";\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Dictate the output format of the generated response.\n     */\n    response_format?: {\n        /**\n         * Set to json_object to process and output generated text as JSON.\n         */\n        type?: string;\n    };\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Output {\n    response?: string | {\n        /**\n         * Whether the conversation is safe or not.\n         */\n        safe?: boolean;\n        /**\n         * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.\n         */\n        categories?: string[];\n    };\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {\n    inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Input {\n    /**\n     * A query you wish to perform against the provided contexts.\n     */\n    /**\n     * Number of returned results starting with the best score.\n     */\n    top_k?: number;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Output {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {\n    inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages;\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {\n    inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;\ninterface Ai_Cf_Qwen_Qwq_32B_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwq_32B_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwq_32B {\n    inputs: Ai_Cf_Qwen_Qwq_32B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages;\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {\n    inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;\ninterface Ai_Cf_Google_Gemma_3_12B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Google_Gemma_3_12B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[];\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {\n    inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;\n    postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch;\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {\n    requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The tool call id.\n         */\n        id?: string;\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type?: string;\n        /**\n         * Details of the function tool.\n         */\n        function?: {\n            /**\n             * The name of the tool to be called\n             */\n            name?: string;\n            /**\n             * The arguments passed to be passed to the tool call request\n             */\n            arguments?: object;\n        };\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {\n    inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {\n    requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {\n    inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Input {\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.\n     */\n    custom_topic_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom topics you want the model to detect within your input audio or text if present Submit up to 100\n     */\n    custom_topic?: string;\n    /**\n     * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param\n     */\n    custom_intent_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom intents you want the model to detect within your input audio if present\n     */\n    custom_intent?: string;\n    /**\n     * Identifies and extracts key entities from content in submitted audio\n     */\n    detect_entities?: boolean;\n    /**\n     * Identifies the dominant language spoken in submitted audio\n     */\n    detect_language?: boolean;\n    /**\n     * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0\n     */\n    diarize?: boolean;\n    /**\n     * Identify and extract key entities from content in submitted audio\n     */\n    dictation?: boolean;\n    /**\n     * Specify the expected encoding of your submitted audio\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"amr-nb\" | \"amr-wb\" | \"opus\" | \"speex\" | \"g729\";\n    /**\n     * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing\n     */\n    extra?: string;\n    /**\n     * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'\n     */\n    filler_words?: boolean;\n    /**\n     * Key term prompting can boost or suppress specialized terminology and brands.\n     */\n    keyterm?: string;\n    /**\n     * Keywords can boost or suppress specialized terminology and brands.\n     */\n    keywords?: string;\n    /**\n     * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.\n     */\n    language?: string;\n    /**\n     * Spoken measurements will be converted to their corresponding abbreviations.\n     */\n    measurements?: boolean;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.\n     */\n    mip_opt_out?: boolean;\n    /**\n     * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio\n     */\n    mode?: \"general\" | \"medical\" | \"finance\";\n    /**\n     * Transcribe each audio channel independently.\n     */\n    multichannel?: boolean;\n    /**\n     * Numerals converts numbers from written format to numerical format.\n     */\n    numerals?: boolean;\n    /**\n     * Splits audio into paragraphs to improve transcript readability.\n     */\n    paragraphs?: boolean;\n    /**\n     * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.\n     */\n    profanity_filter?: boolean;\n    /**\n     * Add punctuation and capitalization to the transcript.\n     */\n    punctuate?: boolean;\n    /**\n     * Redaction removes sensitive information from your transcripts.\n     */\n    redact?: string;\n    /**\n     * Search for terms or phrases in submitted audio and replaces them.\n     */\n    replace?: string;\n    /**\n     * Search for terms or phrases in submitted audio.\n     */\n    search?: string;\n    /**\n     * Recognizes the sentiment throughout a transcript or text.\n     */\n    sentiment?: boolean;\n    /**\n     * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.\n     */\n    smart_format?: boolean;\n    /**\n     * Detect topics throughout a transcript or text.\n     */\n    topics?: boolean;\n    /**\n     * Segments speech into meaningful semantic units.\n     */\n    utterances?: boolean;\n    /**\n     * Seconds to wait before detecting a pause between words in submitted audio.\n     */\n    utt_split?: number;\n    /**\n     * The number of channels in the submitted audio\n     */\n    channels?: number;\n    /**\n     * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.\n     */\n    interim_results?: boolean;\n    /**\n     * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing\n     */\n    endpointing?: string;\n    /**\n     * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.\n     */\n    vad_events?: boolean;\n    /**\n     * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.\n     */\n    utterance_end_ms?: boolean;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Output {\n    results?: {\n        channels?: {\n            alternatives?: {\n                confidence?: number;\n                transcript?: string;\n                words?: {\n                    confidence?: number;\n                    end?: number;\n                    start?: number;\n                    word?: string;\n                }[];\n            }[];\n        }[];\n        summary?: {\n            result?: string;\n            short?: string;\n        };\n        sentiments?: {\n            segments?: {\n                text?: string;\n                start_word?: number;\n                end_word?: number;\n                sentiment?: string;\n                sentiment_score?: number;\n            }[];\n            average?: {\n                sentiment?: string;\n                sentiment_score?: number;\n            };\n        };\n    };\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Nova_3 {\n    inputs: Ai_Cf_Deepgram_Nova_3_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {\n    queries?: string | string[];\n    /**\n     * Optional instruction for the task\n     */\n    instruction?: string;\n    documents?: string | string[];\n    text?: string | string[];\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {\n    data?: number[][];\n    shape?: number[];\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {\n    inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;\n}\ntype Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {\n    /**\n     * readable stream with audio data and content-type specified for that data\n     */\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n} | {\n    /**\n     * base64 encoded audio data\n     */\n    audio: string;\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n};\ninterface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {\n    /**\n     * if true, end-of-turn was detected\n     */\n    is_complete?: boolean;\n    /**\n     * probability of the end-of-turn detection\n     */\n    probability?: number;\n}\ndeclare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {\n    inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;\n    postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ninterface Ai_Cf_Leonardo_Phoenix_1_0_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * Specify what to exclude from the generated images\n     */\n    negative_prompt?: string;\n}\n/**\n * The generated image in JPEG format\n */\ntype Ai_Cf_Leonardo_Phoenix_1_0_Output = string;\ndeclare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {\n    inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {\n    inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_1_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"angus\" | \"asteria\" | \"arcas\" | \"orion\" | \"orpheus\" | \"athena\" | \"luna\" | \"zeus\" | \"perseus\" | \"helios\" | \"hera\" | \"stella\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_1_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_1 {\n    inputs: Ai_Cf_Deepgram_Aura_1_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {\n    /**\n     * Input text to translate. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n    /**\n     * Target language to translate to\n     */\n    target_language: \"asm_Beng\" | \"awa_Deva\" | \"ben_Beng\" | \"bho_Deva\" | \"brx_Deva\" | \"doi_Deva\" | \"eng_Latn\" | \"gom_Deva\" | \"gon_Deva\" | \"guj_Gujr\" | \"hin_Deva\" | \"hne_Deva\" | \"kan_Knda\" | \"kas_Arab\" | \"kas_Deva\" | \"kha_Latn\" | \"lus_Latn\" | \"mag_Deva\" | \"mai_Deva\" | \"mal_Mlym\" | \"mar_Deva\" | \"mni_Beng\" | \"mni_Mtei\" | \"npi_Deva\" | \"ory_Orya\" | \"pan_Guru\" | \"san_Deva\" | \"sat_Olck\" | \"snd_Arab\" | \"snd_Deva\" | \"tam_Taml\" | \"tel_Telu\" | \"urd_Arab\" | \"unr_Deva\";\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {\n    /**\n     * Translated texts\n     */\n    translations: string[];\n}\ndeclare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {\n    inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;\n    postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {\n    requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {\n    inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;\n    postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {\n    /**\n     * Input text to embed. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {\n    /**\n     * Embedding vectors, where each vector is a list of floats.\n     */\n    data: number[][];\n    /**\n     * Shape of the embedding data as [number_of_embeddings, embedding_dimension].\n     *\n     * @minItems 2\n     * @maxItems 2\n     */\n    shape: [\n        number,\n        number\n    ];\n}\ndeclare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {\n    inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;\n    postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;\n}\ninterface Ai_Cf_Deepgram_Flux_Input {\n    /**\n     * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.\n     */\n    encoding: \"linear16\";\n    /**\n     * Sample rate of the audio stream in Hz.\n     */\n    sample_rate: string;\n    /**\n     * End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.\n     */\n    eager_eot_threshold?: string;\n    /**\n     * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.\n     */\n    eot_threshold?: string;\n    /**\n     * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.\n     */\n    eot_timeout_ms?: string;\n    /**\n     * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.\n     */\n    keyterm?: string;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip\n     */\n    mip_opt_out?: \"true\" | \"false\";\n    /**\n     * Label your requests for the purpose of identification during usage reporting\n     */\n    tag?: string;\n}\n/**\n * Output will be returned as websocket messages.\n */\ninterface Ai_Cf_Deepgram_Flux_Output {\n    /**\n     * The unique identifier of the request (uuid)\n     */\n    request_id?: string;\n    /**\n     * Starts at 0 and increments for each message the server sends to the client.\n     */\n    sequence_id?: number;\n    /**\n     * The type of event being reported.\n     */\n    event?: \"Update\" | \"StartOfTurn\" | \"EagerEndOfTurn\" | \"TurnResumed\" | \"EndOfTurn\";\n    /**\n     * The index of the current turn\n     */\n    turn_index?: number;\n    /**\n     * Start time in seconds of the audio range that was transcribed\n     */\n    audio_window_start?: number;\n    /**\n     * End time in seconds of the audio range that was transcribed\n     */\n    audio_window_end?: number;\n    /**\n     * Text that was said over the course of the current turn\n     */\n    transcript?: string;\n    /**\n     * The words in the transcript\n     */\n    words?: {\n        /**\n         * The individual punctuated, properly-cased word from the transcript\n         */\n        word: string;\n        /**\n         * Confidence that this word was transcribed correctly\n         */\n        confidence: number;\n    }[];\n    /**\n     * Confidence that no more speech is coming in this turn\n     */\n    end_of_turn_confidence?: number;\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Flux {\n    inputs: Ai_Cf_Deepgram_Flux_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_En_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"amalthea\" | \"andromeda\" | \"apollo\" | \"arcas\" | \"aries\" | \"asteria\" | \"athena\" | \"atlas\" | \"aurora\" | \"callista\" | \"cora\" | \"cordelia\" | \"delia\" | \"draco\" | \"electra\" | \"harmonia\" | \"helena\" | \"hera\" | \"hermes\" | \"hyperion\" | \"iris\" | \"janus\" | \"juno\" | \"jupiter\" | \"luna\" | \"mars\" | \"minerva\" | \"neptune\" | \"odysseus\" | \"ophelia\" | \"orion\" | \"orpheus\" | \"pandora\" | \"phoebe\" | \"pluto\" | \"saturn\" | \"thalia\" | \"theia\" | \"vesta\" | \"zeus\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_En_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {\n    inputs: Ai_Cf_Deepgram_Aura_2_En_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_Es_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"sirio\" | \"nestor\" | \"carina\" | \"celeste\" | \"alvaro\" | \"diana\" | \"aquila\" | \"selena\" | \"estrella\" | \"javier\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_Es_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {\n    inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;\n}\ninterface AiModels {\n    \"@cf/huggingface/distilbert-sst-2-int8\": BaseAiTextClassification;\n    \"@cf/stabilityai/stable-diffusion-xl-base-1.0\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-inpainting\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-img2img\": BaseAiTextToImage;\n    \"@cf/lykon/dreamshaper-8-lcm\": BaseAiTextToImage;\n    \"@cf/bytedance/stable-diffusion-xl-lightning\": BaseAiTextToImage;\n    \"@cf/myshell-ai/melotts\": BaseAiTextToSpeech;\n    \"@cf/google/embeddinggemma-300m\": BaseAiTextEmbeddings;\n    \"@cf/microsoft/resnet-50\": BaseAiImageClassification;\n    \"@cf/meta/llama-2-7b-chat-int8\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.1\": BaseAiTextGeneration;\n    \"@cf/meta/llama-2-7b-chat-fp16\": BaseAiTextGeneration;\n    \"@hf/thebloke/llama-2-13b-chat-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/mistral-7b-instruct-v0.1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/zephyr-7b-beta-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/openhermes-2.5-mistral-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/neural-chat-7b-v3-1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/llamaguard-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-base-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-math-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/defog/sqlcoder-7b-2\": BaseAiTextGeneration;\n    \"@cf/openchat/openchat-3.5-0106\": BaseAiTextGeneration;\n    \"@cf/tiiuae/falcon-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/thebloke/discolm-german-7b-v1-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-0.5b-chat\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-7b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-14b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/tinyllama/tinyllama-1.1b-chat-v1.0\": BaseAiTextGeneration;\n    \"@cf/microsoft/phi-2\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-1.8b-chat\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.2-lora\": BaseAiTextGeneration;\n    \"@hf/nousresearch/hermes-2-pro-mistral-7b\": BaseAiTextGeneration;\n    \"@hf/nexusflow/starling-lm-7b-beta\": BaseAiTextGeneration;\n    \"@hf/google/gemma-7b-it\": BaseAiTextGeneration;\n    \"@cf/meta-llama/llama-2-7b-chat-hf-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-2b-it-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-7b-it-lora\": BaseAiTextGeneration;\n    \"@hf/mistral/mistral-7b-instruct-v0.2\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct\": BaseAiTextGeneration;\n    \"@cf/fblgit/una-cybertron-7b-v2-bf16\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-fp8\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-3b-instruct\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-1b-instruct\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b\": BaseAiTextGeneration;\n    \"@cf/ibm-granite/granite-4.0-h-micro\": BaseAiTextGeneration;\n    \"@cf/facebook/bart-large-cnn\": BaseAiSummarization;\n    \"@cf/llava-hf/llava-1.5-7b-hf\": BaseAiImageToText;\n    \"@cf/baai/bge-base-en-v1.5\": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;\n    \"@cf/openai/whisper\": Base_Ai_Cf_Openai_Whisper;\n    \"@cf/meta/m2m100-1.2b\": Base_Ai_Cf_Meta_M2M100_1_2B;\n    \"@cf/baai/bge-small-en-v1.5\": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;\n    \"@cf/baai/bge-large-en-v1.5\": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;\n    \"@cf/unum/uform-gen2-qwen-500m\": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;\n    \"@cf/openai/whisper-tiny-en\": Base_Ai_Cf_Openai_Whisper_Tiny_En;\n    \"@cf/openai/whisper-large-v3-turbo\": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;\n    \"@cf/baai/bge-m3\": Base_Ai_Cf_Baai_Bge_M3;\n    \"@cf/black-forest-labs/flux-1-schnell\": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;\n    \"@cf/meta/llama-3.2-11b-vision-instruct\": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;\n    \"@cf/meta/llama-3.3-70b-instruct-fp8-fast\": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;\n    \"@cf/meta/llama-guard-3-8b\": Base_Ai_Cf_Meta_Llama_Guard_3_8B;\n    \"@cf/baai/bge-reranker-base\": Base_Ai_Cf_Baai_Bge_Reranker_Base;\n    \"@cf/qwen/qwen2.5-coder-32b-instruct\": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;\n    \"@cf/qwen/qwq-32b\": Base_Ai_Cf_Qwen_Qwq_32B;\n    \"@cf/mistralai/mistral-small-3.1-24b-instruct\": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;\n    \"@cf/google/gemma-3-12b-it\": Base_Ai_Cf_Google_Gemma_3_12B_It;\n    \"@cf/meta/llama-4-scout-17b-16e-instruct\": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;\n    \"@cf/qwen/qwen3-30b-a3b-fp8\": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;\n    \"@cf/deepgram/nova-3\": Base_Ai_Cf_Deepgram_Nova_3;\n    \"@cf/qwen/qwen3-embedding-0.6b\": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;\n    \"@cf/pipecat-ai/smart-turn-v2\": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;\n    \"@cf/openai/gpt-oss-120b\": Base_Ai_Cf_Openai_Gpt_Oss_120B;\n    \"@cf/openai/gpt-oss-20b\": Base_Ai_Cf_Openai_Gpt_Oss_20B;\n    \"@cf/leonardo/phoenix-1.0\": Base_Ai_Cf_Leonardo_Phoenix_1_0;\n    \"@cf/leonardo/lucid-origin\": Base_Ai_Cf_Leonardo_Lucid_Origin;\n    \"@cf/deepgram/aura-1\": Base_Ai_Cf_Deepgram_Aura_1;\n    \"@cf/ai4bharat/indictrans2-en-indic-1B\": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;\n    \"@cf/aisingapore/gemma-sea-lion-v4-27b-it\": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;\n    \"@cf/pfnet/plamo-embedding-1b\": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;\n    \"@cf/deepgram/flux\": Base_Ai_Cf_Deepgram_Flux;\n    \"@cf/deepgram/aura-2-en\": Base_Ai_Cf_Deepgram_Aura_2_En;\n    \"@cf/deepgram/aura-2-es\": Base_Ai_Cf_Deepgram_Aura_2_Es;\n}\ntype AiOptions = {\n    /**\n     * Send requests as an asynchronous batch job, only works for supported models\n     * https://developers.cloudflare.com/workers-ai/features/batch-api\n     */\n    queueRequest?: boolean;\n    /**\n     * Establish websocket connections, only works for supported models\n     */\n    websocket?: boolean;\n    /**\n     * Tag your requests to group and view them in Cloudflare dashboard.\n     *\n     * Rules:\n     * Tags must only contain letters, numbers, and the symbols: : - . / @\n     * Each tag can have maximum 50 characters.\n     * Maximum 5 tags are allowed each request.\n     * Duplicate tags will removed.\n     */\n    tags?: string[];\n    gateway?: GatewayOptions;\n    returnRawResponse?: boolean;\n    prefix?: string;\n    extraHeaders?: object;\n};\ntype AiModelsSearchParams = {\n    author?: string;\n    hide_experimental?: boolean;\n    page?: number;\n    per_page?: number;\n    search?: string;\n    source?: number;\n    task?: string;\n};\ntype AiModelsSearchObject = {\n    id: string;\n    source: number;\n    name: string;\n    description: string;\n    task: {\n        id: string;\n        name: string;\n        description: string;\n    };\n    tags: string[];\n    properties: {\n        property_id: string;\n        value: string;\n    }[];\n};\ninterface InferenceUpstreamError extends Error {\n}\ninterface AiInternalError extends Error {\n}\ntype AiModelListType = Record<string, any>;\ndeclare abstract class Ai<AiModelList extends AiModelListType = AiModels> {\n    aiGatewayLogId: string | null;\n    gateway(gatewayId: string): AiGateway;\n    /**\n     * Access the AI Search API for managing AI-powered search instances.\n     *\n     * This is the new API that replaces AutoRAG with better namespace separation:\n     * - Account-level operations: `list()`, `create()`\n     * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`\n     *\n     * @example\n     * ```typescript\n     * // List all AI Search instances\n     * const instances = await env.AI.aiSearch.list();\n     *\n     * // Search an instance\n     * const results = await env.AI.aiSearch.get('my-search').search({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   ai_search_options: {\n     *     retrieval: { max_num_results: 10 }\n     *   }\n     * });\n     *\n     * // Generate chat completions with AI Search context\n     * const response = await env.AI.aiSearch.get('my-search').chatCompletions({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'\n     * });\n     * ```\n     */\n    aiSearch(): AiSearchAccountService;\n    /**\n     * @deprecated AutoRAG has been replaced by AI Search.\n     * Use `env.AI.aiSearch` instead for better API design and new features.\n     *\n     * Migration guide:\n     * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n     * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`\n     * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n     *\n     * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.\n     *\n     * @see AiSearchAccountService\n     * @param autoragId Optional instance ID (omit for account-level operations)\n     */\n    autorag(autoragId: string): AutoRAG;\n    run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name][\"inputs\"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends {\n        returnRawResponse: true;\n    } | {\n        websocket: true;\n    } ? Response : InputOptions extends {\n        stream: true;\n    } ? ReadableStream : AiModelList[Name][\"postProcessedOutputs\"]>;\n    models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;\n    toMarkdown(): ToMarkdownService;\n    toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n}\ntype GatewayRetries = {\n    maxAttempts?: 1 | 2 | 3 | 4 | 5;\n    retryDelayMs?: number;\n    backoff?: 'constant' | 'linear' | 'exponential';\n};\ntype GatewayOptions = {\n    id: string;\n    cacheKey?: string;\n    cacheTtl?: number;\n    skipCache?: boolean;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    collectLog?: boolean;\n    eventId?: string;\n    requestTimeoutMs?: number;\n    retries?: GatewayRetries;\n};\ntype UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {\n    /**\n     ** @deprecated\n     */\n    id?: string;\n};\ntype AiGatewayPatchLog = {\n    score?: number | null;\n    feedback?: -1 | 1 | null;\n    metadata?: Record<string, number | string | boolean | null | bigint> | null;\n};\ntype AiGatewayLog = {\n    id: string;\n    provider: string;\n    model: string;\n    model_type?: string;\n    path: string;\n    duration: number;\n    request_type?: string;\n    request_content_type?: string;\n    status_code: number;\n    response_content_type?: string;\n    success: boolean;\n    cached: boolean;\n    tokens_in?: number;\n    tokens_out?: number;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    step?: number;\n    cost?: number;\n    custom_cost?: boolean;\n    request_size: number;\n    request_head?: string;\n    request_head_complete: boolean;\n    response_size: number;\n    response_head?: string;\n    response_head_complete: boolean;\n    created_at: Date;\n};\ntype AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | 'azure-openai' | 'google-vertex-ai' | 'huggingface' | 'openai' | 'perplexity-ai' | 'replicate' | 'groq' | 'cohere' | 'google-ai-studio' | 'mistral' | 'grok' | 'openrouter' | 'deepseek' | 'cerebras' | 'cartesia' | 'elevenlabs' | 'adobe-firefly';\ntype AIGatewayHeaders = {\n    'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;\n    'cf-aig-custom-cost': {\n        per_token_in?: number;\n        per_token_out?: number;\n    } | {\n        total_cost?: number;\n    } | string;\n    'cf-aig-cache-ttl': number | string;\n    'cf-aig-skip-cache': boolean | string;\n    'cf-aig-cache-key': string;\n    'cf-aig-event-id': string;\n    'cf-aig-request-timeout': number | string;\n    'cf-aig-max-attempts': number | string;\n    'cf-aig-retry-delay': number | string;\n    'cf-aig-backoff': string;\n    'cf-aig-collect-log': boolean | string;\n    Authorization: string;\n    'Content-Type': string;\n    [key: string]: string | number | boolean | object;\n};\ntype AIGatewayUniversalRequest = {\n    provider: AIGatewayProviders | string; // eslint-disable-line\n    endpoint: string;\n    headers: Partial<AIGatewayHeaders>;\n    query: unknown;\n};\ninterface AiGatewayInternalError extends Error {\n}\ninterface AiGatewayLogNotFound extends Error {\n}\ndeclare abstract class AiGateway {\n    patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;\n    getLog(logId: string): Promise<AiGatewayLog>;\n    run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {\n        gateway?: UniversalGatewayOptions;\n        extraHeaders?: object;\n    }): Promise<Response>;\n    getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.\n * @see AiSearchInternalError\n */\ninterface AutoRAGInternalError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.\n * @see AiSearchNotFoundError\n */\ninterface AutoRAGNotFoundError extends Error {\n}\n/**\n * @deprecated This error type is no longer used in the AI Search API.\n */\ninterface AutoRAGUnauthorizedError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.\n * @see AiSearchNameNotSetError\n */\ninterface AutoRAGNameNotSetError extends Error {\n}\ntype ComparisonFilter = {\n    key: string;\n    type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';\n    value: string | number | boolean;\n};\ntype CompoundFilter = {\n    type: 'and' | 'or';\n    filters: ComparisonFilter[];\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchRequest with the new API instead.\n * @see AiSearchSearchRequest\n */\ntype AutoRagSearchRequest = {\n    query: string;\n    filters?: CompoundFilter | ComparisonFilter;\n    max_num_results?: number;\n    ranking_options?: {\n        ranker?: string;\n        score_threshold?: number;\n    };\n    reranking?: {\n        enabled?: boolean;\n        model?: string;\n    };\n    rewrite_query?: boolean;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with the new API instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequest = AutoRagSearchRequest & {\n    stream?: boolean;\n    system_prompt?: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with stream: true instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {\n    stream: true;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchResponse with the new API instead.\n * @see AiSearchSearchResponse\n */\ntype AutoRagSearchResponse = {\n    object: 'vector_store.search_results.page';\n    search_query: string;\n    data: {\n        file_id: string;\n        filename: string;\n        score: number;\n        attributes: Record<string, string | number | boolean | null>;\n        content: {\n            type: 'text';\n            text: string;\n        }[];\n    }[];\n    has_more: boolean;\n    next_page: string | null;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchListResponse with the new API instead.\n * @see AiSearchListResponse\n */\ntype AutoRagListResponse = {\n    id: string;\n    enable: boolean;\n    type: string;\n    source: string;\n    vectorize_name: string;\n    paused: boolean;\n    status: string;\n}[];\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * The new API returns different response formats for chat completions.\n */\ntype AutoRagAiSearchResponse = AutoRagSearchResponse & {\n    response: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use the new AI Search API instead: `env.AI.aiSearch`\n *\n * Migration guide:\n * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`\n * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n *\n * @see AiSearchAccountService\n * @see AiSearchInstanceService\n */\ndeclare abstract class AutoRAG {\n    /**\n     * @deprecated Use `env.AI.aiSearch.list()` instead.\n     * @see AiSearchAccountService.list\n     */\n    list(): Promise<AutoRagListResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.\n     * Note: The new API uses a messages array instead of a query string.\n     * @see AiSearchInstanceService.search\n     */\n    search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;\n}\ninterface BasicImageTransformations {\n    /**\n     * Maximum width in image pixels. The value must be an integer.\n     */\n    width?: number;\n    /**\n     * Maximum height in image pixels. The value must be an integer.\n     */\n    height?: number;\n    /**\n     * Resizing mode as a string. It affects interpretation of width and height\n     * options:\n     *  - scale-down: Similar to contain, but the image is never enlarged. If\n     *    the image is larger than given width or height, it will be resized.\n     *    Otherwise its original size will be kept.\n     *  - contain: Resizes to maximum size that fits within the given width and\n     *    height. If only a single dimension is given (e.g. only width), the\n     *    image will be shrunk or enlarged to exactly match that dimension.\n     *    Aspect ratio is always preserved.\n     *  - cover: Resizes (shrinks or enlarges) to fill the entire area of width\n     *    and height. If the image has an aspect ratio different from the ratio\n     *    of width and height, it will be cropped to fit.\n     *  - crop: The image will be shrunk and cropped to fit within the area\n     *    specified by width and height. The image will not be enlarged. For images\n     *    smaller than the given dimensions it's the same as scale-down. For\n     *    images larger than the given dimensions, it's the same as cover.\n     *    See also trim.\n     *  - pad: Resizes to the maximum size that fits within the given width and\n     *    height, and then fills the remaining area with a background color\n     *    (white by default). Use of this mode is not recommended, as the same\n     *    effect can be more efficiently achieved with the contain mode and the\n     *    CSS object-fit: contain property.\n     *  - squeeze: Stretches and deforms to the width and height given, even if it\n     *    breaks aspect ratio\n     */\n    fit?: \"scale-down\" | \"contain\" | \"cover\" | \"crop\" | \"pad\" | \"squeeze\";\n    /**\n     * Image segmentation using artificial intelligence models. Sets pixels not\n     * within selected segment area to transparent e.g \"foreground\" sets every\n     * background pixel as transparent.\n     */\n    segment?: \"foreground\";\n    /**\n     * When cropping with fit: \"cover\", this defines the side or point that should\n     * be left uncropped. The value is either a string\n     * \"left\", \"right\", \"top\", \"bottom\", \"auto\", or \"center\" (the default),\n     * or an object {x, y} containing focal point coordinates in the original\n     * image expressed as fractions ranging from 0.0 (top or left) to 1.0\n     * (bottom or right), 0.5 being the center. {fit: \"cover\", gravity: \"top\"} will\n     * crop bottom or left and right sides as necessary, but won’t crop anything\n     * from the top. {fit: \"cover\", gravity: {x:0.5, y:0.2}} will crop each side to\n     * preserve as much as possible around a point at 20% of the height of the\n     * source image.\n     */\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;\n    /**\n     * Background color to add underneath the image. Applies only to images with\n     * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),\n     * hsl(…), etc.)\n     */\n    background?: string;\n    /**\n     * Number of degrees (90, 180, 270) to rotate the image by. width and height\n     * options refer to axes after rotation.\n     */\n    rotate?: 0 | 90 | 180 | 270 | 360;\n}\ninterface BasicImageTransformationsGravityCoordinates {\n    x?: number;\n    y?: number;\n    mode?: 'remainder' | 'box-center';\n}\n/**\n * In addition to the properties you can set in the RequestInit dict\n * that you pass as an argument to the Request constructor, you can\n * set certain properties of a `cf` object to control how Cloudflare\n * features are applied to that new Request.\n *\n * Note: Currently, these properties cannot be tested in the\n * playground.\n */\ninterface RequestInitCfProperties extends Record<string, unknown> {\n    cacheEverything?: boolean;\n    /**\n     * A request's cache key is what determines if two requests are\n     * \"the same\" for caching purposes. If a request has the same cache key\n     * as some previous request, then we can serve the same cached response for\n     * both. (e.g. 'some-key')\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheKey?: string;\n    /**\n     * This allows you to append additional Cache-Tag response headers\n     * to the origin response without modifications to the origin server.\n     * This will allow for greater control over the Purge by Cache Tag feature\n     * utilizing changes only in the Workers process.\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheTags?: string[];\n    /**\n     * Force response to be cached for a given number of seconds. (e.g. 300)\n     */\n    cacheTtl?: number;\n    /**\n     * Force response to be cached for a given number of seconds based on the Origin status code.\n     * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })\n     */\n    cacheTtlByStatus?: Record<string, number>;\n    scrapeShield?: boolean;\n    apps?: boolean;\n    image?: RequestInitCfPropertiesImage;\n    minify?: RequestInitCfPropertiesImageMinify;\n    mirage?: boolean;\n    polish?: \"lossy\" | \"lossless\" | \"off\";\n    r2?: RequestInitCfPropertiesR2;\n    /**\n     * Redirects the request to an alternate origin server. You can use this,\n     * for example, to implement load balancing across several origins.\n     * (e.g.us-east.example.com)\n     *\n     * Note - For security reasons, the hostname set in resolveOverride must\n     * be proxied on the same Cloudflare zone of the incoming request.\n     * Otherwise, the setting is ignored. CNAME hosts are allowed, so to\n     * resolve to a host under a different domain or a DNS only domain first\n     * declare a CNAME record within your own zone’s DNS mapping to the\n     * external hostname, set proxy on Cloudflare, then set resolveOverride\n     * to point to that CNAME record.\n     */\n    resolveOverride?: string;\n}\ninterface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {\n    /**\n     * Absolute URL of the image file to use for the drawing. It can be any of\n     * the supported file formats. For drawing of watermarks or non-rectangular\n     * overlays we recommend using PNG or WebP images.\n     */\n    url: string;\n    /**\n     * Floating-point number between 0 (transparent) and 1 (opaque).\n     * For example, opacity: 0.5 makes overlay semitransparent.\n     */\n    opacity?: number;\n    /**\n     * - If set to true, the overlay image will be tiled to cover the entire\n     *   area. This is useful for stock-photo-like watermarks.\n     * - If set to \"x\", the overlay image will be tiled horizontally only\n     *   (form a line).\n     * - If set to \"y\", the overlay image will be tiled vertically only\n     *   (form a line).\n     */\n    repeat?: true | \"x\" | \"y\";\n    /**\n     * Position of the overlay image relative to a given edge. Each property is\n     * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10\n     * positions left side of the overlay 10 pixels from the left edge of the\n     * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom\n     * of the background image.\n     *\n     * Setting both left & right, or both top & bottom is an error.\n     *\n     * If no position is specified, the image will be centered.\n     */\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n}\ninterface RequestInitCfPropertiesImage extends BasicImageTransformations {\n    /**\n     * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it\n     * easier to specify higher-DPI sizes in <img srcset>.\n     */\n    dpr?: number;\n    /**\n     * Allows you to trim your image. Takes dpr into account and is performed before\n     * resizing or rotation.\n     *\n     * It can be used as:\n     * - left, top, right, bottom - it will specify the number of pixels to cut\n     *   off each side\n     * - width, height - the width/height you'd like to end up with - can be used\n     *   in combination with the properties above\n     * - border - this will automatically trim the surroundings of an image based on\n     *   it's color. It consists of three properties:\n     *    - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)\n     *    - tolerance: difference from color to treat as color\n     *    - keep: the number of pixels of border to keep\n     */\n    trim?: \"border\" | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n    /**\n     * Quality setting from 1-100 (useful values are in 60-90 range). Lower values\n     * make images look worse, but load faster. The default is 85. It applies only\n     * to JPEG and WebP images. It doesn’t have any effect on PNG.\n     */\n    quality?: number | \"low\" | \"medium-low\" | \"medium-high\" | \"high\";\n    /**\n     * Output format to generate. It can be:\n     *  - avif: generate images in AVIF format.\n     *  - webp: generate images in Google WebP format. Set quality to 100 to get\n     *    the WebP-lossless format.\n     *  - json: instead of generating an image, outputs information about the\n     *    image, in JSON format. The JSON object will contain image size\n     *    (before and after resizing), source image’s MIME type, file size, etc.\n     * - jpeg: generate images in JPEG format.\n     * - png: generate images in PNG format.\n     */\n    format?: \"avif\" | \"webp\" | \"json\" | \"jpeg\" | \"png\" | \"baseline-jpeg\" | \"png-force\" | \"svg\";\n    /**\n     * Whether to preserve animation frames from input files. Default is true.\n     * Setting it to false reduces animations to still images. This setting is\n     * recommended when enlarging images or processing arbitrary user content,\n     * because large GIF animations can weigh tens or even hundreds of megabytes.\n     * It is also useful to set anim:false when using format:\"json\" to get the\n     * response quicker without the number of frames.\n     */\n    anim?: boolean;\n    /**\n     * What EXIF data should be preserved in the output image. Note that EXIF\n     * rotation and embedded color profiles are always applied (\"baked in\" into\n     * the image), and aren't affected by this option. Note that if the Polish\n     * feature is enabled, all metadata may have been removed already and this\n     * option may have no effect.\n     *  - keep: Preserve most of EXIF metadata, including GPS location if there's\n     *    any.\n     *  - copyright: Only keep the copyright tag, and discard everything else.\n     *    This is the default behavior for JPEG files.\n     *  - none: Discard all invisible EXIF metadata. Currently WebP and PNG\n     *    output formats always discard metadata.\n     */\n    metadata?: \"keep\" | \"copyright\" | \"none\";\n    /**\n     * Strength of sharpening filter to apply to the image. Floating-point\n     * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a\n     * recommended value for downscaled images.\n     */\n    sharpen?: number;\n    /**\n     * Radius of a blur filter (approximate gaussian). Maximum supported radius\n     * is 250.\n     */\n    blur?: number;\n    /**\n     * Overlays are drawn in the order they appear in the array (last array\n     * entry is the topmost layer).\n     */\n    draw?: RequestInitCfPropertiesImageDraw[];\n    /**\n     * Fetching image from authenticated origin. Setting this property will\n     * pass authentication headers (Authorization, Cookie, etc.) through to\n     * the origin.\n     */\n    \"origin-auth\"?: \"share-publicly\";\n    /**\n     * Adds a border around the image. The border is added after resizing. Border\n     * width takes dpr into account, and can be specified either using a single\n     * width property, or individually for each side.\n     */\n    border?: {\n        color: string;\n        width: number;\n    } | {\n        color: string;\n        top: number;\n        right: number;\n        bottom: number;\n        left: number;\n    };\n    /**\n     * Increase brightness by a factor. A value of 1.0 equals no change, a value\n     * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.\n     * 0 is ignored.\n     */\n    brightness?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    contrast?: number;\n    /**\n     * Increase exposure by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.\n     */\n    gamma?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    saturation?: number;\n    /**\n     * Flips the images horizontally, vertically, or both. Flipping is applied before\n     * rotation, so if you apply flip=h,rotate=90 then the image will be flipped\n     * horizontally, then rotated by 90 degrees.\n     */\n    flip?: 'h' | 'v' | 'hv';\n    /**\n     * Slightly reduces latency on a cache miss by selecting a\n     * quickest-to-compress file format, at a cost of increased file size and\n     * lower image quality. It will usually override the format option and choose\n     * JPEG over WebP or AVIF. We do not recommend using this option, except in\n     * unusual circumstances like resizing uncacheable dynamically-generated\n     * images.\n     */\n    compression?: \"fast\";\n}\ninterface RequestInitCfPropertiesImageMinify {\n    javascript?: boolean;\n    css?: boolean;\n    html?: boolean;\n}\ninterface RequestInitCfPropertiesR2 {\n    /**\n     * Colo id of bucket that an object is stored in\n     */\n    bucketColoId?: number;\n}\n/**\n * Request metadata provided by Cloudflare's edge.\n */\ntype IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;\ninterface IncomingRequestCfPropertiesBase extends Record<string, unknown> {\n    /**\n     * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.\n     *\n     * @example 395747\n     */\n    asn?: number;\n    /**\n     * The organization which owns the ASN of the incoming request.\n     *\n     * @example \"Google Cloud\"\n     */\n    asOrganization?: string;\n    /**\n     * The original value of the `Accept-Encoding` header if Cloudflare modified it.\n     *\n     * @example \"gzip, deflate, br\"\n     */\n    clientAcceptEncoding?: string;\n    /**\n     * The number of milliseconds it took for the request to reach your worker.\n     *\n     * @example 22\n     */\n    clientTcpRtt?: number;\n    /**\n     * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)\n     * airport code of the data center that the request hit.\n     *\n     * @example \"DFW\"\n     */\n    colo: string;\n    /**\n     * Represents the upstream's response to a\n     * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)\n     * from cloudflare.\n     *\n     * For workers with no upstream, this will always be `1`.\n     *\n     * @example 3\n     */\n    edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;\n    /**\n     * The HTTP Protocol the request used.\n     *\n     * @example \"HTTP/2\"\n     */\n    httpProtocol: string;\n    /**\n     * The browser-requested prioritization information in the request object.\n     *\n     * If no information was set, defaults to the empty string `\"\"`\n     *\n     * @example \"weight=192;exclusive=0;group=3;group-weight=127\"\n     * @default \"\"\n     */\n    requestPriority: string;\n    /**\n     * The TLS version of the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"TLSv1.3\"\n     */\n    tlsVersion: string;\n    /**\n     * The cipher for the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"AEAD-AES128-GCM-SHA256\"\n     */\n    tlsCipher: string;\n    /**\n     * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.\n     *\n     * If the incoming request was served over plaintext (without TLS) this field is undefined.\n     */\n    tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;\n}\ninterface IncomingRequestCfPropertiesBotManagementBase {\n    /**\n     * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,\n     * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).\n     *\n     * @example 54\n     */\n    score: number;\n    /**\n     * A boolean value that is true if the request comes from a good bot, like Google or Bing.\n     * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).\n     */\n    verifiedBot: boolean;\n    /**\n     * A boolean value that is true if the request originates from a\n     * Cloudflare-verified proxy service.\n     */\n    corporateProxy: boolean;\n    /**\n     * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.\n     */\n    staticResource: boolean;\n    /**\n     * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).\n     */\n    detectionIds: number[];\n}\ninterface IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase;\n    /**\n     * Duplicate of `botManagement.score`.\n     *\n     * @deprecated\n     */\n    clientTrustScore: number;\n}\ninterface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase & {\n        /**\n         * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients\n         * across different destination IPs, Ports, and X509 certificates.\n         */\n        ja3Hash: string;\n    };\n}\ninterface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {\n    /**\n     * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).\n     *\n     * This field is only present if you have Cloudflare for SaaS enabled on your account\n     * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).\n     */\n    hostMetadata?: HostMetadata;\n}\ninterface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {\n    /**\n     * Information about the client certificate presented to Cloudflare.\n     *\n     * This is populated when the incoming request is served over TLS using\n     * either Cloudflare Access or API Shield (mTLS)\n     * and the presented SSL certificate has a valid\n     * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)\n     * (i.e., not `null` or `\"\"`).\n     *\n     * Otherwise, a set of placeholder values are used.\n     *\n     * The property `certPresented` will be set to `\"1\"` when\n     * the object is populated (i.e. the above conditions were met).\n     */\n    tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;\n}\n/**\n * Metadata about the request's TLS handshake\n */\ninterface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {\n    /**\n     * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    clientHandshake: string;\n    /**\n     * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    serverHandshake: string;\n    /**\n     * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    clientFinished: string;\n    /**\n     * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    serverFinished: string;\n}\n/**\n * Geographic data about the request's origin.\n */\ninterface IncomingRequestCfPropertiesGeographicInformation {\n    /**\n     * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.\n     *\n     * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `\"T1\"`, indicating a request that originated over TOR.\n     *\n     * If Cloudflare is unable to determine where the request originated this property is omitted.\n     *\n     * The country code `\"T1\"` is used for requests originating on TOR.\n     *\n     * @example \"GB\"\n     */\n    country?: Iso3166Alpha2Code | \"T1\";\n    /**\n     * If present, this property indicates that the request originated in the EU\n     *\n     * @example \"1\"\n     */\n    isEUCountry?: \"1\";\n    /**\n     * A two-letter code indicating the continent the request originated from.\n     *\n     * @example \"AN\"\n     */\n    continent?: ContinentCode;\n    /**\n     * The city the request originated from\n     *\n     * @example \"Austin\"\n     */\n    city?: string;\n    /**\n     * Postal code of the incoming request\n     *\n     * @example \"78701\"\n     */\n    postalCode?: string;\n    /**\n     * Latitude of the incoming request\n     *\n     * @example \"30.27130\"\n     */\n    latitude?: string;\n    /**\n     * Longitude of the incoming request\n     *\n     * @example \"-97.74260\"\n     */\n    longitude?: string;\n    /**\n     * Timezone of the incoming request\n     *\n     * @example \"America/Chicago\"\n     */\n    timezone?: string;\n    /**\n     * If known, the ISO 3166-2 name for the first level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"Texas\"\n     */\n    region?: string;\n    /**\n     * If known, the ISO 3166-2 code for the first-level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"TX\"\n     */\n    regionCode?: string;\n    /**\n     * Metro code (DMA) of the incoming request\n     *\n     * @example \"635\"\n     */\n    metroCode?: string;\n}\n/** Data about the incoming request's TLS certificate */\ninterface IncomingRequestCfPropertiesTLSClientAuth {\n    /** Always `\"1\"`, indicating that the certificate was presented */\n    certPresented: \"1\";\n    /**\n     * Result of certificate verification.\n     *\n     * @example \"FAILED:self signed certificate\"\n     */\n    certVerified: Exclude<CertVerificationStatus, \"NONE\">;\n    /** The presented certificate's revokation status.\n     *\n     * - A value of `\"1\"` indicates the certificate has been revoked\n     * - A value of `\"0\"` indicates the certificate has not been revoked\n     */\n    certRevoked: \"1\" | \"0\";\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDN: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDN: string;\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDNRFC2253: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDNRFC2253: string;\n    /** The certificate issuer's distinguished name (legacy policies) */\n    certIssuerDNLegacy: string;\n    /** The certificate subject's distinguished name (legacy policies) */\n    certSubjectDNLegacy: string;\n    /**\n     * The certificate's serial number\n     *\n     * @example \"00936EACBE07F201DF\"\n     */\n    certSerial: string;\n    /**\n     * The certificate issuer's serial number\n     *\n     * @example \"2489002934BDFEA34\"\n     */\n    certIssuerSerial: string;\n    /**\n     * The certificate's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certSKI: string;\n    /**\n     * The certificate issuer's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certIssuerSKI: string;\n    /**\n     * The certificate's SHA-1 fingerprint\n     *\n     * @example \"6b9109f323999e52259cda7373ff0b4d26bd232e\"\n     */\n    certFingerprintSHA1: string;\n    /**\n     * The certificate's SHA-256 fingerprint\n     *\n     * @example \"acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea\"\n     */\n    certFingerprintSHA256: string;\n    /**\n     * The effective starting date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotBefore: string;\n    /**\n     * The effective expiration date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotAfter: string;\n}\n/** Placeholder values for TLS Client Authorization */\ninterface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {\n    certPresented: \"0\";\n    certVerified: \"NONE\";\n    certRevoked: \"0\";\n    certIssuerDN: \"\";\n    certSubjectDN: \"\";\n    certIssuerDNRFC2253: \"\";\n    certSubjectDNRFC2253: \"\";\n    certIssuerDNLegacy: \"\";\n    certSubjectDNLegacy: \"\";\n    certSerial: \"\";\n    certIssuerSerial: \"\";\n    certSKI: \"\";\n    certIssuerSKI: \"\";\n    certFingerprintSHA1: \"\";\n    certFingerprintSHA256: \"\";\n    certNotBefore: \"\";\n    certNotAfter: \"\";\n}\n/** Possible outcomes of TLS verification */\ndeclare type CertVerificationStatus = \n/** Authentication succeeded */\n\"SUCCESS\"\n/** No certificate was presented */\n | \"NONE\"\n/** Failed because the certificate was self-signed */\n | \"FAILED:self signed certificate\"\n/** Failed because the certificate failed a trust chain check */\n | \"FAILED:unable to verify the first certificate\"\n/** Failed because the certificate not yet valid */\n | \"FAILED:certificate is not yet valid\"\n/** Failed because the certificate is expired */\n | \"FAILED:certificate has expired\"\n/** Failed for another unspecified reason */\n | \"FAILED\";\n/**\n * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.\n */\ndeclare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = 0 /** Unknown */ | 1 /** no keepalives (not found) */ | 2 /** no connection re-use, opening keepalive connection failed */ | 3 /** no connection re-use, keepalive accepted and saved */ | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ | 5; /** connection re-use, accepted by the origin server */\n/** ISO 3166-1 Alpha-2 codes */\ndeclare type Iso3166Alpha2Code = \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\";\n/** The 2-letter continent codes Cloudflare uses */\ndeclare type ContinentCode = \"AF\" | \"AN\" | \"AS\" | \"EU\" | \"NA\" | \"OC\" | \"SA\";\ntype CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;\ninterface D1Meta {\n    duration: number;\n    size_after: number;\n    rows_read: number;\n    rows_written: number;\n    last_row_id: number;\n    changed_db: boolean;\n    changes: number;\n    /**\n     * The region of the database instance that executed the query.\n     */\n    served_by_region?: string;\n    /**\n     * The three letters airport code of the colo that executed the query.\n     */\n    served_by_colo?: string;\n    /**\n     * True if-and-only-if the database instance that executed the query was the primary.\n     */\n    served_by_primary?: boolean;\n    timings?: {\n        /**\n         * The duration of the SQL query execution by the database instance. It doesn't include any network time.\n         */\n        sql_duration_ms: number;\n    };\n    /**\n     * Number of total attempts to execute the query, due to automatic retries.\n     * Note: All other fields in the response like `timings` only apply to the last attempt.\n     */\n    total_attempts?: number;\n}\ninterface D1Response {\n    success: true;\n    meta: D1Meta & Record<string, unknown>;\n    error?: never;\n}\ntype D1Result<T = unknown> = D1Response & {\n    results: T[];\n};\ninterface D1ExecResult {\n    count: number;\n    duration: number;\n}\ntype D1SessionConstraint = \n// Indicates that the first query should go to the primary, and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n'first-primary'\n// Indicates that the first query can go anywhere (primary or replica), and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n | 'first-unconstrained';\ntype D1SessionBookmark = string;\ndeclare abstract class D1Database {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    exec(query: string): Promise<D1ExecResult>;\n    /**\n     * Creates a new D1 Session anchored at the given constraint or the bookmark.\n     * All queries executed using the created session will have sequential consistency,\n     * meaning that all writes done through the session will be visible in subsequent reads.\n     *\n     * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.\n     */\n    withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;\n    /**\n     * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.\n     */\n    dump(): Promise<ArrayBuffer>;\n}\ndeclare abstract class D1DatabaseSession {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    /**\n     * @returns The latest session bookmark across all executed queries on the session.\n     *          If no query has been executed yet, `null` is returned.\n     */\n    getBookmark(): D1SessionBookmark | null;\n}\ndeclare abstract class D1PreparedStatement {\n    bind(...values: unknown[]): D1PreparedStatement;\n    first<T = unknown>(colName: string): Promise<T | null>;\n    first<T = Record<string, unknown>>(): Promise<T | null>;\n    run<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    all<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    raw<T = unknown[]>(options: {\n        columnNames: true;\n    }): Promise<[\n        string[],\n        ...T[]\n    ]>;\n    raw<T = unknown[]>(options?: {\n        columnNames?: false;\n    }): Promise<T[]>;\n}\n// `Disposable` was added to TypeScript's standard lib types in version 5.2.\n// To support older TypeScript versions, define an empty `Disposable` interface.\n// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,\n// but this will ensure type checking on older versions still passes.\n// TypeScript's interface merging will ensure our empty interface is effectively\n// ignored when `Disposable` is included in the standard lib.\ninterface Disposable {\n}\n/**\n * The returned data after sending an email\n */\ninterface EmailSendResult {\n    /**\n     * The Email Message ID\n     */\n    messageId: string;\n}\n/**\n * An email message that can be sent from a Worker.\n */\ninterface EmailMessage {\n    /**\n     * Envelope From attribute of the email message.\n     */\n    readonly from: string;\n    /**\n     * Envelope To attribute of the email message.\n     */\n    readonly to: string;\n}\n/**\n * An email message that is sent to a consumer Worker and can be rejected/forwarded.\n */\ninterface ForwardableEmailMessage extends EmailMessage {\n    /**\n     * Stream of the email message content.\n     */\n    readonly raw: ReadableStream<Uint8Array>;\n    /**\n     * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     */\n    readonly headers: Headers;\n    /**\n     * Size of the email message content.\n     */\n    readonly rawSize: number;\n    /**\n     * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.\n     * @param reason The reject reason.\n     * @returns void\n     */\n    setReject(reason: string): void;\n    /**\n     * Forward this email message to a verified destination address of the account.\n     * @param rcptTo Verified destination address.\n     * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     * @returns A promise that resolves when the email message is forwarded.\n     */\n    forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;\n    /**\n     * Reply to the sender of this email message with a new EmailMessage object.\n     * @param message The reply message.\n     * @returns A promise that resolves when the email message is replied.\n     */\n    reply(message: EmailMessage): Promise<EmailSendResult>;\n}\n/** A file attachment for an email message */\ntype EmailAttachment = {\n    disposition: 'inline';\n    contentId: string;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n} | {\n    disposition: 'attachment';\n    contentId?: undefined;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n};\n/** An Email Address */\ninterface EmailAddress {\n    name: string;\n    email: string;\n}\n/**\n * A binding that allows a Worker to send email messages.\n */\ninterface SendEmail {\n    send(message: EmailMessage): Promise<EmailSendResult>;\n    send(builder: {\n        from: string | EmailAddress;\n        to: string | string[];\n        subject: string;\n        replyTo?: string | EmailAddress;\n        cc?: string | string[];\n        bcc?: string | string[];\n        headers?: Record<string, string>;\n        text?: string;\n        html?: string;\n        attachments?: EmailAttachment[];\n    }): Promise<EmailSendResult>;\n}\ndeclare abstract class EmailEvent extends ExtendableEvent {\n    readonly message: ForwardableEmailMessage;\n}\ndeclare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ndeclare module \"cloudflare:email\" {\n    let _EmailMessage: {\n        prototype: EmailMessage;\n        new (from: string, to: string, raw: ReadableStream | string): EmailMessage;\n    };\n    export { _EmailMessage as EmailMessage };\n}\n/**\n * Hello World binding to serve as an explanatory example. DO NOT USE\n */\ninterface HelloWorldBinding {\n    /**\n     * Retrieve the current stored value\n     */\n    get(): Promise<{\n        value: string;\n        ms?: number;\n    }>;\n    /**\n     * Set a new stored value\n     */\n    set(value: string): Promise<void>;\n}\ninterface Hyperdrive {\n    /**\n     * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.\n     *\n     * Calling this method returns an identical socket to if you call\n     * `connect(\"host:port\")` using the `host` and `port` fields from this object.\n     * Pick whichever approach works better with your preferred DB client library.\n     *\n     * Note that this socket is not yet authenticated -- it's expected that your\n     * code (or preferably, the client library of your choice) will authenticate\n     * using the information in this class's readonly fields.\n     */\n    connect(): Socket;\n    /**\n     * A valid DB connection string that can be passed straight into the typical\n     * client library/driver/ORM. This will typically be the easiest way to use\n     * Hyperdrive.\n     */\n    readonly connectionString: string;\n    /*\n     * A randomly generated hostname that is only valid within the context of the\n     * currently running Worker which, when passed into `connect()` function from\n     * the \"cloudflare:sockets\" module, will connect to the Hyperdrive instance\n     * for your database.\n     */\n    readonly host: string;\n    /*\n     * The port that must be paired the the host field when connecting.\n     */\n    readonly port: number;\n    /*\n     * The username to use when authenticating to your database via Hyperdrive.\n     * Unlike the host and password, this will be the same every time\n     */\n    readonly user: string;\n    /*\n     * The randomly generated password to use when authenticating to your\n     * database via Hyperdrive. Like the host field, this password is only valid\n     * within the context of the currently running Worker instance from which\n     * it's read.\n     */\n    readonly password: string;\n    /*\n     * The name of the database to connect to.\n     */\n    readonly database: string;\n}\n// Copyright (c) 2024 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ntype ImageInfoResponse = {\n    format: 'image/svg+xml';\n} | {\n    format: string;\n    fileSize: number;\n    width: number;\n    height: number;\n};\ntype ImageTransform = {\n    width?: number;\n    height?: number;\n    background?: string;\n    blur?: number;\n    border?: {\n        color?: string;\n        width?: number;\n    } | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n    };\n    brightness?: number;\n    contrast?: number;\n    fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';\n    flip?: 'h' | 'v' | 'hv';\n    gamma?: number;\n    segment?: 'foreground';\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {\n        x?: number;\n        y?: number;\n        mode: 'remainder' | 'box-center';\n    };\n    rotate?: 0 | 90 | 180 | 270;\n    saturation?: number;\n    sharpen?: number;\n    trim?: 'border' | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n};\ntype ImageDrawOptions = {\n    opacity?: number;\n    repeat?: boolean | string;\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n};\ntype ImageInputOptions = {\n    encoding?: 'base64';\n};\ntype ImageOutputOptions = {\n    format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';\n    quality?: number;\n    background?: string;\n    anim?: boolean;\n};\ninterface ImageMetadata {\n    id: string;\n    filename?: string;\n    uploaded?: string;\n    requireSignedURLs: boolean;\n    meta?: Record<string, unknown>;\n    variants: string[];\n    draft?: boolean;\n    creator?: string;\n}\ninterface ImageUploadOptions {\n    id?: string;\n    filename?: string;\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n    encoding?: 'base64';\n}\ninterface ImageUpdateOptions {\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n}\ninterface ImageListOptions {\n    limit?: number;\n    cursor?: string;\n    sortOrder?: 'asc' | 'desc';\n    creator?: string;\n}\ninterface ImageList {\n    images: ImageMetadata[];\n    cursor?: string;\n    listComplete: boolean;\n}\ninterface HostedImagesBinding {\n    /**\n     * Get detailed metadata for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns Image metadata, or null if not found\n     */\n    details(imageId: string): Promise<ImageMetadata | null>;\n    /**\n     * Get the raw image data for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns ReadableStream of image bytes, or null if not found\n     */\n    image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;\n    /**\n     * Upload a new hosted image\n     * @param image The image file to upload\n     * @param options Upload configuration\n     * @returns Metadata for the uploaded image\n     * @throws {@link ImagesError} if upload fails\n     */\n    upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;\n    /**\n     * Update hosted image metadata\n     * @param imageId The ID of the image\n     * @param options Properties to update\n     * @returns Updated image metadata\n     * @throws {@link ImagesError} if update fails\n     */\n    update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;\n    /**\n     * Delete a hosted image\n     * @param imageId The ID of the image\n     * @returns True if deleted, false if not found\n     */\n    delete(imageId: string): Promise<boolean>;\n    /**\n     * List hosted images with pagination\n     * @param options List configuration\n     * @returns List of images with pagination info\n     * @throws {@link ImagesError} if list fails\n     */\n    list(options?: ImageListOptions): Promise<ImageList>;\n}\ninterface ImagesBinding {\n    /**\n     * Get image metadata (type, width and height)\n     * @throws {@link ImagesError} with code 9412 if input is not an image\n     * @param stream The image bytes\n     */\n    info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;\n    /**\n     * Begin applying a series of transformations to an image\n     * @param stream The image bytes\n     * @returns A transform handle\n     */\n    input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;\n    /**\n     * Access hosted images CRUD operations\n     */\n    readonly hosted: HostedImagesBinding;\n}\ninterface ImageTransformer {\n    /**\n     * Apply transform next, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param transform\n     */\n    transform(transform: ImageTransform): ImageTransformer;\n    /**\n     * Draw an image on this transformer, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param image The image (or transformer that will give the image) to draw\n     * @param options The options configuring how to draw the image\n     */\n    draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;\n    /**\n     * Retrieve the image that results from applying the transforms to the\n     * provided input\n     * @param options Options that apply to the output e.g. output format\n     */\n    output(options: ImageOutputOptions): Promise<ImageTransformationResult>;\n}\ntype ImageTransformationOutputOptions = {\n    encoding?: 'base64';\n};\ninterface ImageTransformationResult {\n    /**\n     * The image as a response, ready to store in cache or return to users\n     */\n    response(): Response;\n    /**\n     * The content type of the returned image\n     */\n    contentType(): string;\n    /**\n     * The bytes of the response\n     */\n    image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;\n}\ninterface ImagesError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\n/**\n * Media binding for transforming media streams.\n * Provides the entry point for media transformation operations.\n */\ninterface MediaBinding {\n    /**\n     * Creates a media transformer from an input stream.\n     * @param media - The input media bytes\n     * @returns A MediaTransformer instance for applying transformations\n     */\n    input(media: ReadableStream<Uint8Array>): MediaTransformer;\n}\n/**\n * Media transformer for applying transformation operations to media content.\n * Handles sizing, fitting, and other input transformation parameters.\n */\ninterface MediaTransformer {\n    /**\n     * Applies transformation options to the media content.\n     * @param transform - Configuration for how the media should be transformed\n     * @returns A generator for producing the transformed media output\n     */\n    transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Generator for producing media transformation results.\n * Configures the output format and parameters for the transformed media.\n */\ninterface MediaTransformationGenerator {\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Result of a media transformation operation.\n * Provides multiple ways to access the transformed media content.\n */\ninterface MediaTransformationResult {\n    /**\n     * Returns the transformed media as a readable stream of bytes.\n     * @returns A promise containing a readable stream with the transformed media\n     */\n    media(): Promise<ReadableStream<Uint8Array>>;\n    /**\n     * Returns the transformed media as an HTTP response object.\n     * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users\n     */\n    response(): Promise<Response>;\n    /**\n     * Returns the MIME type of the transformed media.\n     * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')\n     */\n    contentType(): Promise<string>;\n}\n/**\n * Configuration options for transforming media input.\n * Controls how the media should be resized and fitted.\n */\ntype MediaTransformationInputOptions = {\n    /** How the media should be resized to fit the specified dimensions */\n    fit?: 'contain' | 'cover' | 'scale-down';\n    /** Target width in pixels */\n    width?: number;\n    /** Target height in pixels */\n    height?: number;\n};\n/**\n * Configuration options for Media Transformations output.\n * Controls the format, timing, and type of the generated output.\n */\ntype MediaTransformationOutputOptions = {\n    /**\n     * Output mode determining the type of media to generate\n     */\n    mode?: 'video' | 'spritesheet' | 'frame' | 'audio';\n    /** Whether to include audio in the output */\n    audio?: boolean;\n    /**\n     * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').\n     */\n    time?: string;\n    /**\n     * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').\n     */\n    duration?: string;\n    /**\n     * Number of frames in the spritesheet.\n     */\n    imageCount?: number;\n    /**\n     * Output format for the generated media.\n     */\n    format?: 'jpg' | 'png' | 'm4a';\n};\n/**\n * Error object for media transformation operations.\n * Extends the standard Error interface with additional media-specific information.\n */\ninterface MediaError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ndeclare module 'cloudflare:node' {\n    interface NodeStyleServer {\n        listen(...args: unknown[]): this;\n        address(): {\n            port?: number | null | undefined;\n        };\n    }\n    export function httpServerHandler(port: number): ExportedHandler;\n    export function httpServerHandler(options: {\n        port: number;\n    }): ExportedHandler;\n    export function httpServerHandler(server: NodeStyleServer): ExportedHandler;\n}\ntype Params<P extends string = any> = Record<P, string | string[]>;\ntype EventContext<Env, P extends string, Data> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n};\ntype PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;\ntype EventPluginContext<Env, P extends string, Data, PluginArgs> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n    pluginArgs: PluginArgs;\n};\ntype PagesPluginFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>, PluginArgs = unknown> = (context: EventPluginContext<Env, Params, Data, PluginArgs>) => Response | Promise<Response>;\ndeclare module \"assets:*\" {\n    export const onRequest: PagesFunction;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ndeclare module \"cloudflare:pipelines\" {\n    export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {\n        protected env: Env;\n        protected ctx: ExecutionContext;\n        constructor(ctx: ExecutionContext, env: Env);\n        /**\n         * run receives an array of PipelineRecord which can be\n         * transformed and returned to the pipeline\n         * @param records Incoming records from the pipeline to be transformed\n         * @param metadata Information about the specific pipeline calling the transformation entrypoint\n         * @returns A promise containing the transformed PipelineRecord array\n         */\n        public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;\n    }\n    export type PipelineRecord = Record<string, unknown>;\n    export type PipelineBatchMetadata = {\n        pipelineId: string;\n        pipelineName: string;\n    };\n    export interface Pipeline<T extends PipelineRecord = PipelineRecord> {\n        /**\n         * The Pipeline interface represents the type of a binding to a Pipeline\n         *\n         * @param records The records to send to the pipeline\n         */\n        send(records: T[]): Promise<void>;\n    }\n}\n// PubSubMessage represents an incoming PubSub message.\n// The message includes metadata about the broker, the client, and the payload\n// itself.\n// https://developers.cloudflare.com/pub-sub/\ninterface PubSubMessage {\n    // Message ID\n    readonly mid: number;\n    // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT\n    readonly broker: string;\n    // The MQTT topic the message was sent on.\n    readonly topic: string;\n    // The client ID of the client that published this message.\n    readonly clientId: string;\n    // The unique identifier (JWT ID) used by the client to authenticate, if token\n    // auth was used.\n    readonly jti?: string;\n    // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker\n    // received the message from the client.\n    readonly receivedAt: number;\n    // An (optional) string with the MIME type of the payload, if set by the\n    // client.\n    readonly contentType: string;\n    // Set to 1 when the payload is a UTF-8 string\n    // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063\n    readonly payloadFormatIndicator: number;\n    // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.\n    // You can use payloadFormatIndicator to inspect this before decoding.\n    payload: string | Uint8Array;\n}\n// JsonWebKey extended by kid parameter\ninterface JsonWebKeyWithKid extends JsonWebKey {\n    // Key Identifier of the JWK\n    readonly kid: string;\n}\ninterface RateLimitOptions {\n    key: string;\n}\ninterface RateLimitOutcome {\n    success: boolean;\n}\ninterface RateLimit {\n    /**\n     * Rate limit a request based on the provided options.\n     * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/\n     * @returns A promise that resolves with the outcome of the rate limit.\n     */\n    limit(options: RateLimitOptions): Promise<RateLimitOutcome>;\n}\n// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need\n// to referenced by `Fetcher`. This is included in the \"importable\" version of the types which\n// strips all `module` blocks.\ndeclare namespace Rpc {\n    // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.\n    // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.\n    // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to\n    // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)\n    export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';\n    export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';\n    export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';\n    export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';\n    export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';\n    export interface RpcTargetBranded {\n        [__RPC_TARGET_BRAND]: never;\n    }\n    export interface WorkerEntrypointBranded {\n        [__WORKER_ENTRYPOINT_BRAND]: never;\n    }\n    export interface DurableObjectBranded {\n        [__DURABLE_OBJECT_BRAND]: never;\n    }\n    export interface WorkflowEntrypointBranded {\n        [__WORKFLOW_ENTRYPOINT_BRAND]: never;\n    }\n    export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;\n    // Types that can be used through `Stub`s\n    export type Stubable = RpcTargetBranded | ((...args: any[]) => any);\n    // Types that can be passed over RPC\n    // The reason for using a generic type here is to build a serializable subset of structured\n    //   cloneable composite types. This allows types defined with the \"interface\" keyword to pass the\n    //   serializable check as well. Otherwise, only types defined with the \"type\" keyword would pass.\n    type Serializable<T> = \n    // Structured cloneables\n    BaseType\n    // Structured cloneable composites\n     | Map<T extends Map<infer U, unknown> ? Serializable<U> : never, T extends Map<unknown, infer U> ? Serializable<U> : never> | Set<T extends Set<infer U> ? Serializable<U> : never> | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never> | {\n        [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;\n    }\n    // Special types\n     | Stub<Stubable>\n    // Serialized as stubs, see `Stubify`\n     | Stubable;\n    // Base type for all RPC stubs, including common memory management methods.\n    // `T` is used as a marker type for unwrapping `Stub`s later.\n    interface StubBase<T extends Stubable> extends Disposable {\n        [__RPC_STUB_BRAND]: T;\n        dup(): this;\n    }\n    export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;\n    // This represents all the types that can be sent as-is over an RPC boundary\n    type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;\n    // Recursively rewrite all `Stubable` types with `Stub`s\n    // prettier-ignore\n    type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, infer V> ? Map<Stubify<K>, Stubify<V>> : T extends Set<infer V> ? Set<Stubify<V>> : T extends Array<infer V> ? Array<Stubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Stubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: any;\n    } ? {\n        [K in keyof T]: Stubify<T[K]>;\n    } : T;\n    // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.\n    // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:\n    // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.\n    // prettier-ignore\n    type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infer K, infer V> ? Map<Unstubify<K>, Unstubify<V>> : T extends Set<infer V> ? Set<Unstubify<V>> : T extends Array<infer V> ? Array<Unstubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Unstubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: unknown;\n    } ? {\n        [K in keyof T]: Unstubify<T[K]>;\n    } : T;\n    type UnstubifyAll<A extends any[]> = {\n        [I in keyof A]: Unstubify<A[I]>;\n    };\n    // Utility type for adding `Provider`/`Disposable`s to `object` types only.\n    // Note `unknown & T` is equivalent to `T`.\n    type MaybeProvider<T> = T extends object ? Provider<T> : unknown;\n    type MaybeDisposable<T> = T extends object ? Disposable : unknown;\n    // Type for method return or property on an RPC interface.\n    // - Stubable types are replaced by stubs.\n    // - Serializable types are passed by value, with stubable types replaced by stubs\n    //   and a top-level `Disposer`.\n    // Everything else can't be passed over PRC.\n    // Technically, we use custom thenables here, but they quack like `Promise`s.\n    // Intersecting with `(Maybe)Provider` allows pipelining.\n    // prettier-ignore\n    type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;\n    // Type for method or property on an RPC interface.\n    // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.\n    // Unwrapping `Stub`s allows calling with `Stubable` arguments.\n    // For properties, rewrite types to be `Result`s.\n    // In each case, unwrap `Promise`s.\n    type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;\n    // Type for the callable part of an `Provider` if `T` is callable.\n    // This is intersected with methods/properties.\n    type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;\n    // Base type for all other types providing RPC-like interfaces.\n    // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.\n    // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.\n    export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{\n        [K in keyof T]: MethodOrProperty<T[K]>;\n    }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;\n}\ndeclare namespace Cloudflare {\n    // Type of `env`.\n    //\n    // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript\n    // will merge all declarations.\n    //\n    // You can use `wrangler types` to generate the `Env` type automatically.\n    interface Env {\n    }\n    // Project-specific parameters used to inform types.\n    //\n    // This interface is, again, intended to be declared in project-specific files, and then that\n    // declaration will be merged with this one.\n    //\n    // A project should have a declaration like this:\n    //\n    //     interface GlobalProps {\n    //       // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type\n    //       // of `ctx.exports`.\n    //       mainModule: typeof import(\"my-main-module\");\n    //\n    //       // Declares which of the main module's exports are configured with durable storage, and\n    //       // thus should behave as Durable Object namsepace bindings.\n    //       durableNamespaces: \"MyDurableObject\" | \"AnotherDurableObject\";\n    //     }\n    //\n    // You can use `wrangler types` to generate `GlobalProps` automatically.\n    interface GlobalProps {\n    }\n    // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not\n    // present.\n    type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;\n    // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the\n    // `mainModule` property.\n    type MainModule = GlobalProp<\"mainModule\", {}>;\n    // The type of ctx.exports, which contains loopback bindings for all top-level exports.\n    type Exports = {\n        [K in keyof MainModule]: LoopbackForExport<MainModule[K]>\n        // If the export is listed in `durableNamespaces`, then it is also a\n        // DurableObjectNamespace.\n         & (K extends GlobalProp<\"durableNamespaces\", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});\n    };\n}\ndeclare namespace CloudflareWorkersModule {\n    export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;\n    export const RpcStub: {\n        new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;\n    };\n    export abstract class RpcTarget implements Rpc.RpcTargetBranded {\n        [Rpc.__RPC_TARGET_BRAND]: never;\n    }\n    // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC\n    export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {\n        [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext<Props>;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        email?(message: ForwardableEmailMessage): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        queue?(batch: MessageBatch<unknown>): void | Promise<void>;\n        scheduled?(controller: ScheduledController): void | Promise<void>;\n        tail?(events: TraceItem[]): void | Promise<void>;\n        tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\n        test?(controller: TestController): void | Promise<void>;\n        trace?(traces: TraceItem[]): void | Promise<void>;\n    }\n    export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {\n        [Rpc.__DURABLE_OBJECT_BRAND]: never;\n        protected ctx: DurableObjectState<Props>;\n        protected env: Env;\n        constructor(ctx: DurableObjectState, env: Env);\n        alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n        webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n        webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n    }\n    export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n    export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\n    export type WorkflowDelayDuration = WorkflowSleepDuration;\n    export type WorkflowTimeoutDuration = WorkflowSleepDuration;\n    export type WorkflowRetentionDuration = WorkflowSleepDuration;\n    export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';\n    export type WorkflowStepConfig = {\n        retries?: {\n            limit: number;\n            delay: WorkflowDelayDuration | number;\n            backoff?: WorkflowBackoff;\n        };\n        timeout?: WorkflowTimeoutDuration | number;\n    };\n    export type WorkflowEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        instanceId: string;\n    };\n    export type WorkflowStepEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        type: string;\n    };\n    export type WorkflowStepContext = {\n        attempt: number;\n    };\n    export abstract class WorkflowStep {\n        do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;\n        sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;\n        waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {\n            type: string;\n            timeout?: WorkflowTimeoutDuration | number;\n        }): Promise<WorkflowStepEvent<T>>;\n    }\n    export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';\n    export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {\n        [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;\n    }\n    export function waitUntil(promise: Promise<unknown>): void;\n    export function withEnv(newEnv: unknown, fn: () => unknown): unknown;\n    export function withExports(newExports: unknown, fn: () => unknown): unknown;\n    export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;\n    export const env: Cloudflare.Env;\n    export const exports: Cloudflare.Exports;\n}\ndeclare module 'cloudflare:workers' {\n    export = CloudflareWorkersModule;\n}\ninterface SecretsStoreSecret {\n    /**\n     * Get a secret from the Secrets Store, returning a string of the secret value\n     * if it exists, or throws an error if it does not exist\n     */\n    get(): Promise<string>;\n}\ndeclare module \"cloudflare:sockets\" {\n    function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;\n    export { _connect as connect };\n}\n/**\n * Binding entrypoint for Cloudflare Stream.\n *\n * Usage:\n * - Binding-level operations:\n *   `await env.STREAM.videos.upload`\n *   `await env.STREAM.videos.createDirectUpload`\n *   `await env.STREAM.videos.*`\n *   `await env.STREAM.watermarks.*`\n * - Per-video operations:\n *   `await env.STREAM.video(id).downloads.*`\n *   `await env.STREAM.video(id).captions.*`\n *\n * Example usage:\n * ```ts\n * await env.STREAM.video(id).downloads.generate();\n *\n * const video = env.STREAM.video(id)\n * const captions = video.captions.list();\n * const videoDetails = video.details()\n * ```\n */\ninterface StreamBinding {\n    /**\n     * Returns a handle scoped to a single video for per-video operations.\n     * @param id The unique identifier for the video.\n     * @returns A handle for per-video operations.\n     */\n    video(id: string): StreamVideoHandle;\n    /**\n     * Uploads a new video from a File.\n     * @param file The video file to upload.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(file: File): Promise<StreamVideo>;\n    /**\n     * Uploads a new video from a provided URL.\n     * @param url The URL to upload from.\n     * @param params Optional upload parameters.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {AlreadyUploadedError} if a video was already uploaded to this URL\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;\n    /**\n     * Creates a direct upload that allows video uploads without an API key.\n     * @param params Parameters for the direct upload\n     * @returns The direct upload details.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;\n    videos: StreamVideos;\n    watermarks: StreamWatermarks;\n}\n/**\n * Handle for operations scoped to a single Stream video.\n */\ninterface StreamVideoHandle {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * Get a full videos details\n     * @returns The full video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    details(): Promise<StreamVideo>;\n    /**\n     * Update details for a single video.\n     * @param params The fields to update for the video.\n     * @returns The updated video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    update(params: StreamUpdateVideoParams): Promise<StreamVideo>;\n    /**\n     * Deletes a video and its copies from Cloudflare Stream.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(): Promise<void>;\n    /**\n     * Creates a signed URL token for a video.\n     * @returns The signed token that was created.\n     * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed\n     */\n    generateToken(): Promise<string>;\n    downloads: StreamScopedDownloads;\n    captions: StreamScopedCaptions;\n}\ninterface StreamVideo {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator: string | null;\n    /**\n     * The thumbnail URL for the video.\n     */\n    thumbnail: string;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct: number;\n    /**\n     * Indicates whether the video is ready to stream.\n     */\n    readyToStream: boolean;\n    /**\n     * The date and time the video became ready to stream.\n     */\n    readyToStreamAt: string | null;\n    /**\n     * Processing status information.\n     */\n    status: StreamVideoStatus;\n    /**\n     * A user modifiable key-value store.\n     */\n    meta: Record<string, string>;\n    /**\n     * The date and time the video was created.\n     */\n    created: string;\n    /**\n     * The date and time the video was last modified.\n     */\n    modified: string;\n    /**\n     * The date and time at which the video will be deleted.\n     */\n    scheduledDeletion: string | null;\n    /**\n     * The size of the video in bytes.\n     */\n    size: number;\n    /**\n     * The preview URL for the video.\n     */\n    preview?: string;\n    /**\n     * Origins allowed to display the video.\n     */\n    allowedOrigins: Array<string>;\n    /**\n     * Indicates whether signed URLs are required.\n     */\n    requireSignedURLs: boolean | null;\n    /**\n     * The date and time the video was uploaded.\n     */\n    uploaded: string | null;\n    /**\n     * The date and time when the upload URL expires.\n     */\n    uploadExpiry: string | null;\n    /**\n     * The maximum size in bytes for direct uploads.\n     */\n    maxSizeBytes: number | null;\n    /**\n     * The maximum duration in seconds for direct uploads.\n     */\n    maxDurationSeconds: number | null;\n    /**\n     * The video duration in seconds. -1 indicates unknown.\n     */\n    duration: number;\n    /**\n     * Input metadata for the original upload.\n     */\n    input: StreamVideoInput;\n    /**\n     * Playback URLs for the video.\n     */\n    hlsPlaybackUrl: string;\n    dashPlaybackUrl: string;\n    /**\n     * The watermark applied to the video, if any.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The live input id associated with the video, if any.\n     */\n    liveInputId?: string | null;\n    /**\n     * The source video id if this is a clip.\n     */\n    clippedFromId: string | null;\n    /**\n     * Public details associated with the video.\n     */\n    publicDetails: StreamPublicDetails | null;\n}\ntype StreamVideoStatus = {\n    /**\n     * The current processing state.\n     */\n    state: string;\n    /**\n     * The current processing step.\n     */\n    step?: string;\n    /**\n     * The percent complete as a string.\n     */\n    pctComplete?: string;\n    /**\n     * An error reason code, if applicable.\n     */\n    errorReasonCode: string;\n    /**\n     * An error reason text, if applicable.\n     */\n    errorReasonText: string;\n};\ntype StreamVideoInput = {\n    /**\n     * The input width in pixels.\n     */\n    width: number;\n    /**\n     * The input height in pixels.\n     */\n    height: number;\n};\ntype StreamPublicDetails = {\n    /**\n     * The public title for the video.\n     */\n    title: string | null;\n    /**\n     * The public share link.\n     */\n    share_link: string | null;\n    /**\n     * The public channel link.\n     */\n    channel_link: string | null;\n    /**\n     * The public logo URL.\n     */\n    logo: string | null;\n};\ntype StreamDirectUpload = {\n    /**\n     * The URL an unauthenticated upload can use for a single multipart request.\n     */\n    uploadURL: string;\n    /**\n     * A Cloudflare-generated unique identifier for a media item.\n     */\n    id: string;\n    /**\n     * The watermark profile applied to the upload.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The scheduled deletion time, if any.\n     */\n    scheduledDeletion: string | null;\n};\ntype StreamDirectUploadCreateParams = {\n    /**\n     * The maximum duration in seconds for a video upload.\n     */\n    maxDurationSeconds: number;\n    /**\n     * The date and time after upload when videos will not be accepted.\n     */\n    expiry?: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of record for\n     * managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Lists the origins allowed to display the video.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * Indicates whether the video can be accessed using the id. When set to `true`,\n     * a signed token must be generated with a signing key to view the video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The date and time at which the video will be deleted. Include `null` to remove\n     * a scheduled deletion.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The watermark profile to apply.\n     */\n    watermark?: StreamDirectUploadWatermark;\n};\ntype StreamDirectUploadWatermark = {\n    /**\n     * The unique identifier for the watermark profile.\n     */\n    id: string;\n};\ntype StreamUrlUploadParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The identifier for the watermark profile\n     */\n    watermarkId?: string;\n};\ninterface StreamScopedCaptions {\n    /**\n     * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.\n     * One caption or subtitle file per language is allowed.\n     * @param language The BCP 47 language tag for the caption or subtitle.\n     * @param file The caption or subtitle file to upload.\n     * @returns The created caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language or file is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(language: string, file: File): Promise<StreamCaption>;\n    /**\n     * Generate captions or subtitles for the provided language via AI.\n     * @param language The BCP 47 language tag to generate.\n     * @returns The generated caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language is invalid\n     * @throws {StreamError} if a generated caption already exists\n     * @throws {StreamError} if the video duration is too long\n     * @throws {StreamError} if the video is missing audio\n     * @throws {StreamError} if the requested language is not supported\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(language: string): Promise<StreamCaption>;\n    /**\n     * Lists the captions or subtitles.\n     * Use the language parameter to filter by a specific language.\n     * @param language The optional BCP 47 language tag to filter by.\n     * @returns The list of captions or subtitles.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(language?: string): Promise<StreamCaption[]>;\n    /**\n     * Removes the captions or subtitles from a video.\n     * @param language The BCP 47 language tag to remove.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(language: string): Promise<void>;\n}\ninterface StreamScopedDownloads {\n    /**\n     * Generates a download for a video when a video is ready to view. Available\n     * types are `default` and `audio`. Defaults to `default` when omitted.\n     * @param downloadType The download type to create.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the download type is invalid\n     * @throws {StreamError} if the video duration is too long to generate a download\n     * @throws {StreamError} if the video is not ready to stream\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;\n    /**\n     * Lists the downloads created for a video.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(): Promise<StreamDownloadGetResponse>;\n    /**\n     * Delete the downloads for a video. Available types are `default` and `audio`.\n     * Defaults to `default` when omitted.\n     * @param downloadType The download type to delete.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(downloadType?: StreamDownloadType): Promise<void>;\n}\ninterface StreamVideos {\n    /**\n     * Lists all videos in a users account.\n     * @returns The list of videos.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(params?: StreamVideosListParams): Promise<StreamVideo[]>;\n}\ninterface StreamWatermarks {\n    /**\n     * Generate a new watermark profile\n     * @param file The image file to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(file: File, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Generate a new watermark profile\n     * @param url The image url to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Lists all watermark profiles for an account.\n     * @returns The list of watermark profiles.\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(): Promise<StreamWatermark[]>;\n    /**\n     * Retrieves details for a single watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns The watermark profile details.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(watermarkId: string): Promise<StreamWatermark>;\n    /**\n     * Deletes a watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(watermarkId: string): Promise<void>;\n}\ntype StreamUpdateVideoParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * The maximum duration in seconds for a video upload. Can be set for a\n     * video that is not yet uploaded to limit its duration. Uploads that exceed the\n     * specified duration will fail during processing. A value of `-1` means the value\n     * is unknown.\n     */\n    maxDurationSeconds?: number;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n};\ntype StreamCaption = {\n    /**\n     * Whether the caption was generated via AI.\n     */\n    generated?: boolean;\n    /**\n     * The language label displayed in the native language to users.\n     */\n    label: string;\n    /**\n     * The language tag in BCP 47 format.\n     */\n    language: string;\n    /**\n     * The status of a generated caption.\n     */\n    status?: 'ready' | 'inprogress' | 'error';\n};\ntype StreamDownloadStatus = 'ready' | 'inprogress' | 'error';\ntype StreamDownloadType = 'default' | 'audio';\ntype StreamDownload = {\n    /**\n     * Indicates the progress as a percentage between 0 and 100.\n     */\n    percentComplete: number;\n    /**\n     * The status of a generated download.\n     */\n    status: StreamDownloadStatus;\n    /**\n     * The URL to access the generated download.\n     */\n    url?: string;\n};\n/**\n * An object with download type keys. Each key is optional and only present if that\n * download type has been created.\n */\ntype StreamDownloadGetResponse = {\n    /**\n     * The audio-only download. Only present if this download type has been created.\n     */\n    audio?: StreamDownload;\n    /**\n     * The default video download. Only present if this download type has been created.\n     */\n    default?: StreamDownload;\n};\ntype StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';\ntype StreamWatermark = {\n    /**\n     * The unique identifier for a watermark profile.\n     */\n    id: string;\n    /**\n     * The size of the image in bytes.\n     */\n    size: number;\n    /**\n     * The height of the image in pixels.\n     */\n    height: number;\n    /**\n     * The width of the image in pixels.\n     */\n    width: number;\n    /**\n     * The date and a time a watermark profile was created.\n     */\n    created: string;\n    /**\n     * The source URL for a downloaded image. If the watermark profile was created via\n     * direct upload, this field is null.\n     */\n    downloadedFrom: string | null;\n    /**\n     * A short description of the watermark profile.\n     */\n    name: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the image\n     * is already semi-transparent, setting this to `1.0` will not make the image\n     * completely opaque.\n     */\n    opacity: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the video\n     * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded\n     * video width or length, as determined by the algorithm.\n     */\n    padding: number;\n    /**\n     * The size of the image relative to the overall size of the video. This parameter\n     * will adapt to horizontal and vertical videos automatically. `0.0` indicates no\n     * scaling (use the size of the image as-is), and `1.0 `fills the entire video.\n     */\n    scale: number;\n    /**\n     * The location of the image. Valid positions are: `upperRight`, `upperLeft`,\n     * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the\n     * `padding` parameter.\n     */\n    position: StreamWatermarkPosition;\n};\ntype StreamWatermarkCreateParams = {\n    /**\n     * A short description of the watermark profile.\n     */\n    name?: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the\n     * image is already semi-transparent, setting this to `1.0` will not make the\n     * image completely opaque.\n     */\n    opacity?: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the\n     * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully\n     * padded video width or length, as determined by the algorithm.\n     */\n    padding?: number;\n    /**\n     * The size of the image relative to the overall size of the video. This\n     * parameter will adapt to horizontal and vertical videos automatically. `0.0`\n     * indicates no scaling (use the size of the image as-is), and `1.0 `fills the\n     * entire video.\n     */\n    scale?: number;\n    /**\n     * The location of the image.\n     */\n    position?: StreamWatermarkPosition;\n};\ntype StreamVideosListParams = {\n    /**\n     * The maximum number of videos to return.\n     */\n    limit?: number;\n    /**\n     * Return videos created before this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    before?: string;\n    /**\n     * Comparison operator for the `before` field.\n     * @default 'lt'\n     */\n    beforeComp?: StreamPaginationComparison;\n    /**\n     * Return videos created after this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    after?: string;\n    /**\n     * Comparison operator for the `after` field.\n     * @default 'gte'\n     */\n    afterComp?: StreamPaginationComparison;\n};\ntype StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';\n/**\n * Error object for Stream binding operations.\n */\ninterface StreamError extends Error {\n    readonly code: number;\n    readonly statusCode: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ninterface InternalError extends StreamError {\n    name: 'InternalError';\n}\ninterface BadRequestError extends StreamError {\n    name: 'BadRequestError';\n}\ninterface NotFoundError extends StreamError {\n    name: 'NotFoundError';\n}\ninterface ForbiddenError extends StreamError {\n    name: 'ForbiddenError';\n}\ninterface RateLimitedError extends StreamError {\n    name: 'RateLimitedError';\n}\ninterface QuotaReachedError extends StreamError {\n    name: 'QuotaReachedError';\n}\ninterface MaxFileSizeError extends StreamError {\n    name: 'MaxFileSizeError';\n}\ninterface InvalidURLError extends StreamError {\n    name: 'InvalidURLError';\n}\ninterface AlreadyUploadedError extends StreamError {\n    name: 'AlreadyUploadedError';\n}\ninterface TooManyWatermarksError extends StreamError {\n    name: 'TooManyWatermarksError';\n}\ntype MarkdownDocument = {\n    name: string;\n    blob: Blob;\n};\ntype ConversionResponse = {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'markdown';\n    tokens: number;\n    data: string;\n} | {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'error';\n    error: string;\n};\ntype ImageConversionOptions = {\n    descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';\n};\ntype EmbeddedImageConversionOptions = ImageConversionOptions & {\n    convert?: boolean;\n    maxConvertedImages?: number;\n};\ntype ConversionOptions = {\n    html?: {\n        images?: EmbeddedImageConversionOptions & {\n            convertOGImage?: boolean;\n        };\n        hostname?: string;\n        cssSelector?: string;\n    };\n    docx?: {\n        images?: EmbeddedImageConversionOptions;\n    };\n    image?: ImageConversionOptions;\n    pdf?: {\n        images?: EmbeddedImageConversionOptions;\n        metadata?: boolean;\n    };\n};\ntype ConversionRequestOptions = {\n    gateway?: GatewayOptions;\n    extraHeaders?: object;\n    conversionOptions?: ConversionOptions;\n};\ntype SupportedFileFormat = {\n    mimeType: string;\n    extension: string;\n};\ndeclare abstract class ToMarkdownService {\n    transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n    supported(): Promise<SupportedFileFormat[]>;\n}\ndeclare namespace TailStream {\n    interface Header {\n        readonly name: string;\n        readonly value: string;\n    }\n    interface FetchEventInfo {\n        readonly type: \"fetch\";\n        readonly method: string;\n        readonly url: string;\n        readonly cfJson?: object;\n        readonly headers: Header[];\n    }\n    interface JsRpcEventInfo {\n        readonly type: \"jsrpc\";\n    }\n    interface ScheduledEventInfo {\n        readonly type: \"scheduled\";\n        readonly scheduledTime: Date;\n        readonly cron: string;\n    }\n    interface AlarmEventInfo {\n        readonly type: \"alarm\";\n        readonly scheduledTime: Date;\n    }\n    interface QueueEventInfo {\n        readonly type: \"queue\";\n        readonly queueName: string;\n        readonly batchSize: number;\n    }\n    interface EmailEventInfo {\n        readonly type: \"email\";\n        readonly mailFrom: string;\n        readonly rcptTo: string;\n        readonly rawSize: number;\n    }\n    interface TraceEventInfo {\n        readonly type: \"trace\";\n        readonly traces: (string | null)[];\n    }\n    interface HibernatableWebSocketEventInfoMessage {\n        readonly type: \"message\";\n    }\n    interface HibernatableWebSocketEventInfoError {\n        readonly type: \"error\";\n    }\n    interface HibernatableWebSocketEventInfoClose {\n        readonly type: \"close\";\n        readonly code: number;\n        readonly wasClean: boolean;\n    }\n    interface HibernatableWebSocketEventInfo {\n        readonly type: \"hibernatableWebSocket\";\n        readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;\n    }\n    interface CustomEventInfo {\n        readonly type: \"custom\";\n    }\n    interface FetchResponseInfo {\n        readonly type: \"fetch\";\n        readonly statusCode: number;\n    }\n    type EventOutcome = \"ok\" | \"canceled\" | \"exception\" | \"unknown\" | \"killSwitch\" | \"daemonDown\" | \"exceededCpu\" | \"exceededMemory\" | \"loadShed\" | \"responseStreamDisconnected\" | \"scriptNotFound\";\n    interface ScriptVersion {\n        readonly id: string;\n        readonly tag?: string;\n        readonly message?: string;\n    }\n    interface Onset {\n        readonly type: \"onset\";\n        readonly attributes: Attribute[];\n        // id for the span being opened by this Onset event.\n        readonly spanId: string;\n        readonly dispatchNamespace?: string;\n        readonly entrypoint?: string;\n        readonly executionModel: string;\n        readonly scriptName?: string;\n        readonly scriptTags?: string[];\n        readonly scriptVersion?: ScriptVersion;\n        readonly info: FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;\n    }\n    interface Outcome {\n        readonly type: \"outcome\";\n        readonly outcome: EventOutcome;\n        readonly cpuTime: number;\n        readonly wallTime: number;\n    }\n    interface SpanOpen {\n        readonly type: \"spanOpen\";\n        readonly name: string;\n        // id for the span being opened by this SpanOpen event.\n        readonly spanId: string;\n        readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;\n    }\n    interface SpanClose {\n        readonly type: \"spanClose\";\n        readonly outcome: EventOutcome;\n    }\n    interface DiagnosticChannelEvent {\n        readonly type: \"diagnosticChannel\";\n        readonly channel: string;\n        readonly message: any;\n    }\n    interface Exception {\n        readonly type: \"exception\";\n        readonly name: string;\n        readonly message: string;\n        readonly stack?: string;\n    }\n    interface Log {\n        readonly type: \"log\";\n        readonly level: \"debug\" | \"error\" | \"info\" | \"log\" | \"warn\";\n        readonly message: object;\n    }\n    interface DroppedEventsDiagnostic {\n        readonly diagnosticsType: \"droppedEvents\";\n        readonly count: number;\n    }\n    interface StreamDiagnostic {\n        readonly type: 'streamDiagnostic';\n        // To add new diagnostic types, define a new interface and add it to this union type.\n        readonly diagnostic: DroppedEventsDiagnostic;\n    }\n    // This marks the worker handler return information.\n    // This is separate from Outcome because the worker invocation can live for a long time after\n    // returning. For example - Websockets that return an http upgrade response but then continue\n    // streaming information or SSE http connections.\n    interface Return {\n        readonly type: \"return\";\n        readonly info?: FetchResponseInfo;\n    }\n    interface Attribute {\n        readonly name: string;\n        readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];\n    }\n    interface Attributes {\n        readonly type: \"attributes\";\n        readonly info: Attribute[];\n    }\n    type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;\n    // Context in which this trace event lives.\n    interface SpanContext {\n        // Single id for the entire top-level invocation\n        // This should be a new traceId for the first worker stage invoked in the eyeball request and then\n        // same-account service-bindings should reuse the same traceId but cross-account service-bindings\n        // should use a new traceId.\n        readonly traceId: string;\n        // spanId in which this event is handled\n        // for Onset and SpanOpen events this would be the parent span id\n        // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events\n        // For Hibernate and Mark this would be the span under which they were emitted.\n        // spanId is not set ONLY if:\n        //  1. This is an Onset event\n        //  2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)\n        readonly spanId?: string;\n    }\n    interface TailEvent<Event extends EventType> {\n        // invocation id of the currently invoked worker stage.\n        // invocation id will always be unique to every Onset event and will be the same until the Outcome event.\n        readonly invocationId: string;\n        // Inherited spanContext for this event.\n        readonly spanContext: SpanContext;\n        readonly timestamp: Date;\n        readonly sequence: number;\n        readonly event: Event;\n    }\n    type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;\n    type TailEventHandlerObject = {\n        outcome?: TailEventHandler<Outcome>;\n        spanOpen?: TailEventHandler<SpanOpen>;\n        spanClose?: TailEventHandler<SpanClose>;\n        diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;\n        exception?: TailEventHandler<Exception>;\n        log?: TailEventHandler<Log>;\n        return?: TailEventHandler<Return>;\n        attributes?: TailEventHandler<Attributes>;\n    };\n    type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\n/**\n * Data types supported for holding vector metadata.\n */\ntype VectorizeVectorMetadataValue = string | number | boolean | string[];\n/**\n * Additional information to associate with a vector.\n */\ntype VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;\ntype VectorFloatArray = Float32Array | Float64Array;\ninterface VectorizeError {\n    code?: number;\n    error: string;\n}\n/**\n * Comparison logic/operation to use for metadata filtering.\n *\n * This list is expected to grow as support for more operations are released.\n */\ntype VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';\ntype VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';\n/**\n * Filter criteria for vector metadata used to limit the retrieved query result set.\n */\ntype VectorizeVectorMetadataFilter = {\n    [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {\n        [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;\n    } | {\n        [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];\n    };\n};\n/**\n * Supported distance metrics for an index.\n * Distance metrics determine how other \"similar\" vectors are determined.\n */\ntype VectorizeDistanceMetric = \"euclidean\" | \"cosine\" | \"dot-product\";\n/**\n * Metadata return levels for a Vectorize query.\n *\n * Default to \"none\".\n *\n * @property all      Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.\n * @property indexed  Return all metadata fields configured for indexing in the vector return set. This level of retrieval is \"free\" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).\n * @property none     No indexed metadata will be returned.\n */\ntype VectorizeMetadataRetrievalLevel = \"all\" | \"indexed\" | \"none\";\ninterface VectorizeQueryOptions {\n    topK?: number;\n    namespace?: string;\n    returnValues?: boolean;\n    returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;\n    filter?: VectorizeVectorMetadataFilter;\n}\n/**\n * Information about the configuration of an index.\n */\ntype VectorizeIndexConfig = {\n    dimensions: number;\n    metric: VectorizeDistanceMetric;\n} | {\n    preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity\n};\n/**\n * Metadata about an existing index.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeIndexInfo} for its post-beta equivalent.\n */\ninterface VectorizeIndexDetails {\n    /** The unique ID of the index */\n    readonly id: string;\n    /** The name of the index. */\n    name: string;\n    /** (optional) A human readable description for the index. */\n    description?: string;\n    /** The index configuration, including the dimension size and distance metric. */\n    config: VectorizeIndexConfig;\n    /** The number of records containing vectors within the index. */\n    vectorsCount: number;\n}\n/**\n * Metadata about an existing index.\n */\ninterface VectorizeIndexInfo {\n    /** The number of records containing vectors within the index. */\n    vectorCount: number;\n    /** Number of dimensions the index has been configured for. */\n    dimensions: number;\n    /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToDatetime: number;\n    /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToMutation: number;\n}\n/**\n * Represents a single vector value set along with its associated metadata.\n */\ninterface VectorizeVector {\n    /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */\n    id: string;\n    /** The vector values */\n    values: VectorFloatArray | number[];\n    /** The namespace this vector belongs to. */\n    namespace?: string;\n    /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */\n    metadata?: Record<string, VectorizeVectorMetadata>;\n}\n/**\n * Represents a matched vector for a query along with its score and (if specified) the matching vector information.\n */\ntype VectorizeMatch = Pick<Partial<VectorizeVector>, \"values\"> & Omit<VectorizeVector, \"values\"> & {\n    /** The score or rank for similarity, when returned as a result */\n    score: number;\n};\n/**\n * A set of matching {@link VectorizeMatch} for a particular query.\n */\ninterface VectorizeMatches {\n    matches: VectorizeMatch[];\n    count: number;\n}\n/**\n * Results of an operation that performed a mutation on a set of vectors.\n * Here, `ids` is a list of vectors that were successfully processed.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeAsyncMutation} for its post-beta equivalent.\n */\ninterface VectorizeVectorMutation {\n    /* List of ids of vectors that were successfully processed. */\n    ids: string[];\n    /* Total count of the number of processed vectors. */\n    count: number;\n}\n/**\n * Result type indicating a mutation on the Vectorize Index.\n * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.\n */\ninterface VectorizeAsyncMutation {\n    /** The unique identifier for the async mutation operation containing the changeset. */\n    mutationId: string;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link Vectorize} for its new implementation.\n */\ndeclare abstract class VectorizeIndex {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexDetails>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * Mutations in this version are async, returning a mutation id.\n */\ndeclare abstract class Vectorize {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexInfo>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Use the provided vector-id to perform a similarity search across the index.\n     * @param vectorId Id for a vector in the index against which the index should be queried.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * The interface for \"version_metadata\" binding\n * providing metadata about the Worker Version using this binding.\n */\ntype WorkerVersionMetadata = {\n    /** The ID of the Worker Version using this binding */\n    id: string;\n    /** The tag of the Worker Version using this binding */\n    tag: string;\n    /** The timestamp of when the Worker Version was uploaded */\n    timestamp: string;\n};\ninterface DynamicDispatchLimits {\n    /**\n     * Limit CPU time in milliseconds.\n     */\n    cpuMs?: number;\n    /**\n     * Limit number of subrequests.\n     */\n    subRequests?: number;\n}\ninterface DynamicDispatchOptions {\n    /**\n     * Limit resources of invoked Worker script.\n     */\n    limits?: DynamicDispatchLimits;\n    /**\n     * Arguments for outbound Worker script, if configured.\n     */\n    outbound?: {\n        [key: string]: any;\n    };\n}\ninterface DispatchNamespace {\n    /**\n    * @param name Name of the Worker script.\n    * @param args Arguments to Worker script.\n    * @param options Options for Dynamic Dispatch invocation.\n    * @returns A Fetcher object that allows you to send requests to the Worker script.\n    * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.\n    */\n    get(name: string, args?: {\n        [key: string]: any;\n    }, options?: DynamicDispatchOptions): Fetcher;\n}\ndeclare module 'cloudflare:workflows' {\n    /**\n     * NonRetryableError allows for a user to throw a fatal error\n     * that makes a Workflow instance fail immediately without triggering a retry\n     */\n    export class NonRetryableError extends Error {\n        public constructor(message: string, name?: string);\n    }\n}\ndeclare abstract class Workflow<PARAMS = unknown> {\n    /**\n     * Get a handle to an existing instance of the Workflow.\n     * @param id Id for the instance of this Workflow\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public get(id: string): Promise<WorkflowInstance>;\n    /**\n     * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.\n     * @param options Options when creating an instance including id and params\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;\n    /**\n     * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.\n     * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.\n     * @param batch List of Options when creating an instance including name and params\n     * @returns A promise that resolves with a list of handles for the created instances.\n     */\n    public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;\n}\ntype WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\ntype WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\ntype WorkflowRetentionDuration = WorkflowSleepDuration;\ninterface WorkflowInstanceCreateOptions<PARAMS = unknown> {\n    /**\n     * An id for your Workflow instance. Must be unique within the Workflow.\n     */\n    id?: string;\n    /**\n     * The event payload the Workflow instance is triggered with\n     */\n    params?: PARAMS;\n    /**\n     * The retention policy for Workflow instance.\n     * Defaults to the maximum retention period available for the owner's account.\n     */\n    retention?: {\n        successRetention?: WorkflowRetentionDuration;\n        errorRetention?: WorkflowRetentionDuration;\n    };\n}\ntype InstanceStatus = {\n    status: 'queued' // means that instance is waiting to be started (see concurrency limits)\n     | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running\n     | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish\n     | 'waitingForPause' // instance is finishing the current work to pause\n     | 'unknown';\n    error?: {\n        name: string;\n        message: string;\n    };\n    output?: unknown;\n};\ninterface WorkflowError {\n    code?: number;\n    message: string;\n}\ndeclare abstract class WorkflowInstance {\n    public id: string;\n    /**\n     * Pause the instance.\n     */\n    public pause(): Promise<void>;\n    /**\n     * Resume the instance. If it is already running, an error will be thrown.\n     */\n    public resume(): Promise<void>;\n    /**\n     * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.\n     */\n    public terminate(): Promise<void>;\n    /**\n     * Restart the instance.\n     */\n    public restart(): Promise<void>;\n    /**\n     * Returns the current status of the instance.\n     */\n    public status(): Promise<InstanceStatus>;\n    /**\n     * Send an event to this instance.\n     */\n    public sendEvent({ type, payload, }: {\n        type: string;\n        payload: unknown;\n    }): Promise<void>;\n}\n"
  },
  {
    "path": "e2e/react-start/basic-cloudflare/wrangler.jsonc",
    "content": "{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"tanstack-start-app\",\n  \"compatibility_date\": \"2025-09-24\",\n  \"compatibility_flags\": [\"nodejs_compat\"],\n  \"main\": \"@tanstack/react-start/server-entry\",\n  \"vars\": {\n    \"MY_VAR\": \"Hello from Cloudflare\",\n  },\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/basic-react-query/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-basic-react-query\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^4.1.12\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\n\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as SuspenseTransitionRouteImport } from './routes/suspense-transition'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api.users'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as TransitionCountQueryRouteImport } from './routes/transition/count/query'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersIdRouteImport } from './routes/api/users.$id'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SuspenseTransitionRoute = SuspenseTransitionRouteImport.update({\n  id: '/suspense-transition',\n  path: '/suspense-transition',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst TransitionCountQueryRoute = TransitionCountQueryRouteImport.update({\n  id: '/transition/count/query',\n  path: '/transition/count/query',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersIdRoute = ApiUsersIdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/suspense-transition'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n    | '/transition/count/query'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/redirect'\n    | '/suspense-transition'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n    | '/transition/count/query'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/suspense-transition'\n    | '/users'\n    | '/_layout/_layout-2'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/api/users/$id'\n    | '/posts_/$postId/deep'\n    | '/transition/count/query'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  SuspenseTransitionRoute: typeof SuspenseTransitionRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  TransitionCountQueryRoute: typeof TransitionCountQueryRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/suspense-transition': {\n      id: '/suspense-transition'\n      path: '/suspense-transition'\n      fullPath: '/suspense-transition'\n      preLoaderRoute: typeof SuspenseTransitionRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/transition/count/query': {\n      id: '/transition/count/query'\n      path: '/transition/count/query'\n      fullPath: '/transition/count/query'\n      preLoaderRoute: typeof TransitionCountQueryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$id': {\n      id: '/api/users/$id'\n      path: '/$id'\n      fullPath: '/api/users/$id'\n      preLoaderRoute: typeof ApiUsersIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersIdRoute: typeof ApiUsersIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersIdRoute: ApiUsersIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  SuspenseTransitionRoute: SuspenseTransitionRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  TransitionCountQueryRoute: TransitionCountQueryRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/react-query'\nimport { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/layout-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtoolsInProd position=\"bottom-right\" />\n        <ReactQueryDevtools buttonPosition=\"bottom-left\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div>I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/api/users.$id.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport type { User } from '../../utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        console.info(`Fetching users by id=${params.id}... @`, request.url)\n        try {\n          const res = await axios.get<User>(`${queryURL}/users/` + params.id)\n          return Response.json({\n            id: res.data.id,\n            name: res.data.name,\n            email: res.data.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/api.users.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport type { User } from '../utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await axios.get<Array<User>>(`${queryURL}/users`)\n        const list = res.data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/deferred.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { queryOptions, useSuspenseQuery } from '@tanstack/react-query'\nimport {} from '@tanstack/react-router'\nimport { Suspense, useState } from 'react'\n\nconst deferredQueryOptions = () =>\n  queryOptions({\n    queryKey: ['deferred'],\n    queryFn: async () => {\n      await new Promise((r) => setTimeout(r, 3000))\n      return {\n        message: `Hello deferred from the server!`,\n        status: 'success',\n        time: new Date(),\n      }\n    },\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: ({ context }) => {\n    // Kick off loading as early as possible!\n    context.queryClient.prefetchQuery(deferredQueryOptions())\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = useState(0)\n\n  return (\n    <div className=\"p-2\">\n      <Suspense fallback=\"Loading Middleman...\">\n        <DeferredQuery />\n      </Suspense>\n      <div>Count: {count}</div>\n      <div>\n        <button onClick={() => setCount(count + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n\nfunction DeferredQuery() {\n  const deferredQuery = useSuspenseQuery(deferredQueryOptions())\n\n  return (\n    <div>\n      <h1>Deferred Query</h1>\n      <div>Status: {deferredQuery.data.status}</div>\n      <div>Message: {deferredQuery.data.message}</div>\n      <div>Time: {deferredQuery.data.time.toISOString()}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport { postQueryOptions } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId }, context }) => {\n    const data = await context.queryClient.ensureQueryData(\n      postQueryOptions(postId),\n    )\n\n    return {\n      title: data.title,\n    }\n  },\n  head: ({ loaderData }) => ({\n    meta: loaderData ? [{ title: loaderData.title }] : undefined,\n  }),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const { postId } = Route.useParams()\n  const postQuery = useSuspenseQuery(postQueryOptions(postId))\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{postQuery.data.title}</h4>\n      <div className=\"text-sm\">{postQuery.data.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: postQuery.data.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/posts.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nimport { postsQueryOptions } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(postsQueryOptions())\n  },\n  head: () => ({ meta: [{ title: 'Posts' }] }),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useSuspenseQuery(postsQueryOptions())\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...postsQuery.data,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li key={post.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { postQueryOptions } from '../utils/posts'\nimport { PostErrorComponent } from './posts.$postId'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId }, context }) => {\n    const data = await context.queryClient.ensureQueryData(\n      postQueryOptions(postId),\n    )\n\n    return {\n      title: data.title,\n    }\n  },\n  head: ({ loaderData }) => ({\n    meta: loaderData ? [{ title: loaderData.title }] : undefined,\n  }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const { postId } = Route.useParams()\n  const postQuery = useSuspenseQuery(postQueryOptions(postId))\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{postQuery.data.title}</h4>\n      <div className=\"text-sm\">{postQuery.data.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/redirect.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: async () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/suspense-transition.tsx",
    "content": "import { queryOptions, useQuery } from '@tanstack/react-query'\nimport { Link, createFileRoute } from '@tanstack/react-router'\nimport { Suspense } from 'react'\n\nconst doubleQueryOptions = (n: number) =>\n  queryOptions({\n    queryKey: ['double', n],\n    queryFn: async () => {\n      // Add a delay to make the transition observable\n      await new Promise((r) => setTimeout(r, 500))\n      return n * 2\n    },\n  })\n\nexport const Route = createFileRoute('/suspense-transition')({\n  validateSearch: (search: { n?: number }) => ({ n: search.n ?? 1 }),\n  component: SuspenseTransitionComponent,\n  ssr: false, // Disable SSR to avoid suspense issues during initial load\n})\n\nfunction SuspenseTransitionComponent() {\n  return (\n    <div className=\"p-2\">\n      <h1 data-testid=\"suspense-transition-title\">Suspense Transition Test</h1>\n\n      <div className=\"flex gap-2 my-4\">\n        <Link\n          data-testid=\"increase-button\"\n          className=\"border bg-gray-50 px-3 py-1\"\n          from=\"/suspense-transition\"\n          search={(s) => ({ n: s.n + 1 })}\n        >\n          Increase\n        </Link>\n      </div>\n\n      <Result />\n    </div>\n  )\n}\n\nfunction Result() {\n  const search = Route.useSearch()\n  const doubleQuery = useQuery(doubleQueryOptions(search.n))\n\n  return (\n    <div className=\"mt-2 border p-4\">\n      {/* This manual Suspense boundary should transition, not immediately show fallback */}\n      <Suspense\n        fallback={<div data-testid=\"suspense-fallback\">Loading...</div>}\n      >\n        <div data-testid=\"suspense-content\">\n          <div>\n            n: <span data-testid=\"n-value\">{search.n}</span>\n          </div>\n          <div>\n            double: <span data-testid=\"double-value\">{doubleQuery.data}</span>\n          </div>\n        </div>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/transition/count/query.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { Suspense } from 'react'\nimport { queryOptions, useQuery } from '@tanstack/react-query'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  n: z.number().default(1),\n})\n\nconst doubleQueryOptions = (n: number) =>\n  queryOptions({\n    queryKey: ['transition-double', n],\n    queryFn: async () => {\n      await new Promise((resolve) => setTimeout(resolve, 1000))\n      return { n, double: n * 2 }\n    },\n    placeholderData: (oldData) => oldData,\n  })\n\nexport const Route = createFileRoute('/transition/count/query')({\n  validateSearch: searchSchema,\n  loader: ({ context: { queryClient }, location }) => {\n    const { n } = searchSchema.parse(location.search)\n    return queryClient.ensureQueryData(doubleQueryOptions(n))\n  },\n  component: TransitionPage,\n})\n\nfunction TransitionPage() {\n  const search = Route.useSearch()\n\n  const doubleQuery = useQuery(doubleQueryOptions(search.n))\n\n  return (\n    <Suspense fallback=\"Loading...\">\n      <div className=\"p-2\">\n        <Link\n          data-testid=\"increase-button\"\n          className=\"border bg-gray-50 px-3 py-1\"\n          from=\"/transition/count/query\"\n          search={(s) => ({ n: s.n + 1 })}\n        >\n          Increase\n        </Link>\n\n        <div className=\"mt-2\">\n          <div data-testid=\"n-value\">n: {doubleQuery.data?.n}</div>\n          <div data-testid=\"double-value\">\n            double: {doubleQuery.data?.double}\n          </div>\n        </div>\n      </div>\n    </Suspense>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/users.$userId.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport { NotFound } from '~/components/NotFound'\nimport { userQueryOptions } from '~/utils/users'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ context, params: { userId } }) => {\n    await context.queryClient.ensureQueryData(userQueryOptions(userId))\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction UserComponent() {\n  const params = Route.useParams()\n  const userQuery = useSuspenseQuery(userQueryOptions(params.userId))\n  const user = userQuery.data\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{user.name}</h4>\n      <div className=\"text-sm\">{user.email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/routes/users.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nimport { usersQueryOptions } from '~/utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(usersQueryOptions())\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const usersQuery = useSuspenseQuery(usersQueryOptions())\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...usersQuery.data,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li key={user.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/utils/posts.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n\nexport const postsQueryOptions = () =>\n  queryOptions({\n    queryKey: ['posts'],\n    queryFn: () => fetchPosts(),\n  })\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['post', postId],\n    queryFn: () => fetchPost({ data: postId }),\n  })\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/src/utils/users.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport axios from 'redaxios'\n\nexport type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT =\n  import.meta.env.VITE_SERVER_PORT || process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n\nexport const usersQueryOptions = () =>\n  queryOptions({\n    queryKey: ['users'],\n    queryFn: () =>\n      axios\n        .get<Array<User>>(DEPLOY_URL + '/api/users')\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch users')\n        }),\n  })\n\nexport const userQueryOptions = (id: string) =>\n  queryOptions({\n    queryKey: ['users', id],\n    queryFn: () =>\n      axios\n        .get<User>(DEPLOY_URL + '/api/users/' + id)\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch user')\n        }),\n  })\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm A!\")\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Manual Suspense boundaries should transition on navigation', async ({\n  page,\n}) => {\n  // Navigate to the suspense transition test page\n  await page.goto('/suspense-transition')\n\n  // Wait for initial content to load\n  await expect(page.getByTestId('n-value')).toHaveText('1')\n  await expect(page.getByTestId('double-value')).toHaveText('2')\n\n  // Click the increase button to trigger navigation with search params change\n  await page.getByTestId('increase-button').click()\n\n  // During the transition, the old content should remain visible\n  // and the fallback should NOT be shown\n  await expect(page.getByTestId('suspense-fallback')).not.toBeVisible({\n    timeout: 100,\n  })\n\n  // The old content should still be visible during transition\n  await expect(page.getByTestId('suspense-content')).toBeVisible()\n\n  // After transition completes, new content should be visible\n  await expect(page.getByTestId('n-value')).toHaveText('2')\n  await expect(page.getByTestId('double-value')).toHaveText('4')\n})\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/tests/transition.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('transitions/count/query should keep old values visible during navigation', async ({\n  page,\n}) => {\n  await page.goto('/transition/count/query')\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1')\n  await expect(page.getByTestId('double-value')).toContainText('double: 2')\n\n  const bodyTexts: Array<string> = []\n\n  const pollInterval = setInterval(async () => {\n    const text = await page\n      .locator('body')\n      .textContent()\n      .catch(() => '')\n    if (text) bodyTexts.push(text)\n  }, 50)\n\n  // 1 click\n\n  page.getByTestId('increase-button').click()\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1', {\n    timeout: 2_000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 2', {\n    timeout: 2_000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n    timeout: 2000,\n  })\n\n  // 2 clicks\n\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n  //   timeout: 2000,\n  // })\n\n  // await page.waitForTimeout(200)\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n  //   timeout: 2000,\n  // })\n\n  // // 3 clicks\n\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n  //   timeout: 2000,\n  // })\n\n  // await page.waitForTimeout(200)\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 7', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 14', {\n  //   timeout: 2000,\n  // })\n\n  clearInterval(pollInterval)\n\n  // With proper transitions, old values should remain visible until new ones arrive\n  const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...'))\n\n  if (hasLoadingText) {\n    throw new Error(\n      'FAILED: \"Loading...\" appeared during navigation. ' +\n        'Solid Router should use transitions to keep old values visible.',\n    )\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-react-query/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/basic-rsc/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-basic-rsc\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"exit 0; vite build\",\n    \"start\": \"node .output/server/index.mjs\"\n  },\n  \"dependencies\": {\n    \"@babel/plugin-syntax-typescript\": \"^7.25.9\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  },\n  \"overrides\": {\n    \"react\": \"0.0.0-experimental-035a41c4e-20230704\",\n    \"react-dom\": \"0.0.0-experimental-035a41c4e-20230704\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts/$postId'\n    | '/posts'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <Link\n            to=\"/layout-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {/* <React.Suspense fallback={null}>{children}</React.Suspense> */}\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport { fetchPost } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\n\nconst renderPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    const post = await fetchPost(postId)\n\n    return (\n      <div className=\"space-y-2\">\n        <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n        <div className=\"text-sm\">{post.body}</div>\n        <Link\n          to=\"/posts/$postId/deep\"\n          params={{\n            postId: post.id,\n          }}\n          activeProps={{ className: 'text-black font-bold' }}\n          className=\"block py-1 text-blue-800 hover:text-blue-600\"\n        >\n          Deep View\n        </Link>\n      </div>\n    )\n  })\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => renderPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  return Route.useLoaderData()\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn, renderRsc } from '@tanstack/react-start'\nimport { renderPosts } from '~/utils/renderPosts'\n\nexport const serverRenderPosts = createServerFn({ method: 'GET' }).handler(\n  renderPosts,\n)\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => serverRenderPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  return renderRsc(Route.useLoaderData())\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../utils/posts'\nimport { PostErrorComponent } from './posts.$postId'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/utils/posts.tsx",
    "content": "// import { notFound } from '@tanstack/react-router'\n// import { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  'use server'\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        // throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  'use server'\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/utils/renderPosts.tsx",
    "content": "'use server'\n\nimport React from 'react'\nimport { fetchPosts } from './posts'\n\nexport async function renderPosts() {\n  const posts = await fetchPosts()\n\n  posts.state = posts.state || {\n    status: 'pending',\n    promise: Promise.resolve(),\n  }\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }]?.map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                {post.title.substring(0, 20)}\n                {/* <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link> */}\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <React.Suspense fallback={<div>Loading...</div>}>\n        <DelayedDateViaSuspense state={posts.state} />\n      </React.Suspense>\n    </div>\n  )\n}\n\nfunction DelayedDateViaSuspense({ state }) {\n  // a component that will suspend for 1 second and then show the current date\n  if (state.status === 'pending') {\n    state.promise = new Promise<void>((resolve) => {\n      setTimeout(() => {\n        state.status = 'success'\n        resolve()\n      }, 5000)\n    })\n    throw state.promise\n  }\n\n  return <div>{new Date().toISOString().replace('T', ' ').split('.')[0]}</div>\n}\n\n// ...fetchPosts\n// posts\n// ...5000\n// timestamp\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-rsc/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/README.md",
    "content": "# Welcome to TanStack.com!\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Development\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Editing and previewing the docs of TanStack projects locally\n\nThe documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app.\nIn 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.\n\nFollow 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 :\n\n1. Create a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter the directory and clone this repo and the repo of the project there.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/tanstack.com.git\ngit clone git@github.com:TanStack/form.git\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- form/\n>    |\n>    +-- tanstack.com/\n> ```\n\n> [!WARNING]\n> 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.\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`.\n\n> [!NOTE]\n> The updated pages need to be manually reloaded in the browser.\n\n> [!WARNING]\n> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page!\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-basic-tsr-config\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"rimraf ./count.txt && vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/src/routes/index.tsx",
    "content": "import fs from 'node:fs'\nimport { createFileRoute, useRouter } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst filePath = 'count.txt'\n\nconst getCount = createServerFn({\n  method: 'GET',\n}).handler(async () => {\n  const number = await fs.promises.readFile(filePath, 'utf-8').catch(() => '0')\n  return parseInt(number || '0')\n})\n\nconst updateCount = createServerFn({ method: 'POST' })\n  .inputValidator((d: number) => d)\n  .handler(async ({ data }) => {\n    const count = await getCount()\n    await fs.promises.writeFile(filePath, `${count + data}`)\n  })\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => await getCount(),\n})\n\nfunction Home() {\n  const router = useRouter()\n  const state = Route.useLoaderData()\n\n  return (\n    <button\n      data-testid=\"add-button\"\n      onClick={() => {\n        updateCount({ data: 1 }).then(() => {\n          router.invalidate()\n        })\n      }}\n    >\n      Add 1 to {state}?\n    </button>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('opening the app', async ({ page }) => {\n  await page.goto('/')\n  await page.waitForLoadState('networkidle')\n\n  const button = page.getByTestId('add-button')\n\n  await expect(button).toContainText('Add 1 to 0?')\n\n  await button.click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(button).toContainText('Add 1 to 1?')\n})\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/app/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/basic-tsr-config/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tanstackStart({\n      srcDirectory: './src/app',\n      router: {\n        entry: '../router.tsx',\n        routesDirectory: '../routes',\n        generatedRouteTree: '../routeTree.gen.ts',\n      },\n    }),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/.env",
    "content": "CLERK_PUBLISHABLE_KEY=[YOUR_CLERK_PUBLISHABLE_KEY]\nCLERK_SECRET_KEY=[YOUR_CLERK_SECRET_KEY]"
  },
  {
    "path": "e2e/react-start/clerk-basic/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n!.env\n.DS_Store\n.cache\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/clerk-basic/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-clerk-basic\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"exit 0; vite build\",\n    \"start\": \"node .output/server/index.mjs\",\n    \"test:e2e\": \"exit 0; rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@clerk/tanstack-react-start\": \"^0.19.0\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteImport } from './routes/_authed/posts'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedProfileSplatRouteImport } from './routes/_authed/profile.$'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRoute = AuthedPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\nconst AuthedProfileSplatRoute = AuthedProfileSplatRouteImport.update({\n  id: '/profile/$',\n  path: '/profile/$',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof AuthedPostsRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/profile/$': typeof AuthedProfileSplatRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/profile/$': typeof AuthedProfileSplatRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/_authed/posts': typeof AuthedPostsRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/profile/$': typeof AuthedProfileSplatRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$postId' | '/profile/$' | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/profile/$' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/profile/$'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n    '/_authed/profile/$': {\n      id: '/_authed/profile/$'\n      path: '/profile/$'\n      fullPath: '/profile/$'\n      preLoaderRoute: typeof AuthedProfileSplatRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteChildren: AuthedPostsRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(\n  AuthedPostsRouteChildren,\n)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRoute: typeof AuthedPostsRouteWithChildren\n  AuthedProfileSplatRoute: typeof AuthedProfileSplatRoute\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRoute: AuthedPostsRouteWithChildren,\n  AuthedProfileSplatRoute: AuthedProfileSplatRoute,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport {\n  ClerkProvider,\n  SignInButton,\n  SignedIn,\n  SignedOut,\n  UserButton,\n} from '@clerk/tanstack-react-start'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { createServerFn } from '@tanstack/react-start'\nimport * as React from 'react'\nimport { getAuth } from '@clerk/tanstack-react-start/server'\nimport { getRequest } from '@tanstack/react-start/server'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'\nimport { NotFound } from '~/components/NotFound.js'\nimport appCss from '~/styles/app.css?url'\n\nconst fetchClerkAuth = createServerFn({ method: 'GET' }).handler(async () => {\n  const user = await getAuth(getRequest()!)\n\n  return {\n    user,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const { user } = await fetchClerkAuth()\n\n    return {\n      user,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <ClerkProvider>\n      <RootDocument>\n        <Outlet />\n      </RootDocument>\n    </ClerkProvider>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div className=\"ml-auto\">\n            <SignedIn>\n              <UserButton />\n            </SignedIn>\n            <SignedOut>\n              <SignInButton mode=\"modal\" />\n            </SignedOut>\n          </div>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport { NotFound } from '~/components/NotFound.js'\nimport { fetchPost } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/routes/_authed/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nimport { fetchPosts } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/routes/_authed/profile.$.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nimport { fetchPosts } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/profile/$')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/routes/_authed.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { SignIn } from '@clerk/tanstack-react-start'\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.user.userId) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return (\n        <div className=\"flex items-center justify-center p-12\">\n          <SignIn routing=\"hash\" forceRedirectUrl={window.location.href} />\n        </div>\n      )\n    }\n\n    throw error\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h1>Hello Clerk!</h1>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/server.ts",
    "content": "import {\n  createStartHandler,\n  defaultStreamHandler,\n} from '@tanstack/react-start/server'\nimport { createClerkHandler } from '@clerk/tanstack-react-start/server'\nimport { createRouter } from './router'\n\nconst startHandler = createStartHandler({\n  createRouter,\n})\nconst fetch = createClerkHandler(startHandler)(defaultStreamHandler)\n\nexport default {\n  fetch,\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/tests/app.spec.ts",
    "content": "import { test } from '@playwright/test'\n\ntest('loads', async ({ page }) => {\n  await page.goto('/')\n})\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/clerk-basic/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/csp/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/csp/.gitignore",
    "content": "node_modules\n.output\ndist\n*.txt\n"
  },
  {
    "path": "e2e/react-start/csp/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-csp\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/csp/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/csp/public/external.css",
    "content": ".external-styled {\n  color: blue;\n  font-weight: bold;\n}\n"
  },
  {
    "path": "e2e/react-start/csp/public/external.js",
    "content": "// This script sets a window global when loaded\n// Using a global avoids race conditions with React and DOM ownership issues\nwindow.__EXTERNAL_SCRIPT_LOADED__ = true\n"
  },
  {
    "path": "e2e/react-start/csp/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/csp/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { createIsomorphicFn } from '@tanstack/react-start'\nimport { routeTree } from './routeTree.gen'\n\nconst getSSROptions = createIsomorphicFn().server(() => {\n  const array = new Uint8Array(16)\n  crypto.getRandomValues(array)\n  const nonce = Array.from(array, (b) => b.toString(16).padStart(2, '0')).join(\n    '',\n  )\n  return { nonce }\n})\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n    ssr: getSSROptions(),\n  })\n}\n"
  },
  {
    "path": "e2e/react-start/csp/src/routes/__root.tsx",
    "content": "import {\n  createRootRoute,\n  HeadContent,\n  Outlet,\n  Scripts,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  headers: ({ ssr }) => {\n    const nonce = ssr?.nonce\n    if (!nonce) return\n    return {\n      'Content-Security-Policy': [\n        \"default-src 'self'\",\n        `script-src 'self' 'nonce-${nonce}'`,\n        `style-src 'self' 'nonce-${nonce}'`,\n      ].join('; '),\n    }\n  },\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { title: 'CSP Nonce Test' },\n    ],\n    links: [{ rel: 'stylesheet', href: '/external.css' }],\n    scripts: [{ src: '/external.js' }],\n    styles: [\n      { children: '.inline-styled { color: green; font-weight: bold; }' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/csp/src/routes/index.tsx",
    "content": "import { useState } from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  const [count, setCount] = useState(0)\n\n  return (\n    <div>\n      <h1 data-testid=\"csp-heading\">CSP Nonce Test</h1>\n      <p data-testid=\"inline-styled\" className=\"inline-styled\">\n        This should be green if inline styles work\n      </p>\n      <p data-testid=\"external-styled\" className=\"external-styled\">\n        This should be blue if external styles work\n      </p>\n      <button data-testid=\"counter-btn\" onClick={() => setCount((c) => c + 1)}>\n        Count: <span data-testid=\"counter-value\">{count}</span>\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/csp/tests/csp.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('CSP header is set with nonce', async ({ page }) => {\n  const response = await page.goto('/')\n  const csp = response?.headers()['content-security-policy']\n  expect(csp).toContain(\"script-src 'self' 'nonce-\")\n  expect(csp).toContain(\"style-src 'self' 'nonce-\")\n})\n\ntest('Inline scripts have nonce attribute', async ({ page }) => {\n  await page.goto('/')\n  const scripts = await page.locator('script[nonce]').all()\n  expect(scripts.length).toBeGreaterThan(0)\n})\n\ntest('Inline styles have nonce attribute', async ({ page }) => {\n  await page.goto('/')\n  const styles = await page.locator('style[nonce]').all()\n  expect(styles.length).toBeGreaterThan(0)\n})\n\ntest('External script has nonce attribute', async ({ page }) => {\n  await page.goto('/')\n  const externalScript = page.locator('script[src=\"/external.js\"]')\n  await expect(externalScript).toHaveAttribute('nonce')\n})\n\ntest('External stylesheet has nonce attribute', async ({ page }) => {\n  await page.goto('/')\n  const externalStylesheet = page.locator('link[href=\"/external.css\"]')\n  await expect(externalStylesheet).toHaveAttribute('nonce')\n})\n\ntest('Nonces match between header and elements', async ({ page }) => {\n  // Intercept the HTML response to get raw content before browser strips nonces\n  let rawHtml = ''\n  await page.route('/', async (route) => {\n    const response = await route.fetch()\n    rawHtml = await response.text()\n    await route.fulfill({ response })\n  })\n\n  const response = await page.goto('/')\n  await page.unrouteAll({ behavior: 'ignoreErrors' })\n\n  const csp = response?.headers()['content-security-policy'] || ''\n\n  // Extract nonce from CSP header\n  const nonceMatch = csp.match(/nonce-([a-f0-9]+)/)\n  expect(nonceMatch).toBeTruthy()\n  const headerNonce = nonceMatch![1]\n\n  // Check script nonces match - look for nonce attribute anywhere in the script tag\n  const scriptNonces = [\n    ...rawHtml.matchAll(/<script[^>]*\\bnonce=\"([^\"]+)\"[^>]*>/g),\n  ].map((m) => m[1])\n  expect(scriptNonces.length).toBeGreaterThan(0)\n  for (const nonce of scriptNonces) {\n    expect(nonce).toBe(headerNonce)\n  }\n\n  // Check style nonces match\n  const styleNonces = [\n    ...rawHtml.matchAll(/<style[^>]*\\bnonce=\"([^\"]+)\"[^>]*>/g),\n  ].map((m) => m[1])\n  expect(styleNonces.length).toBeGreaterThan(0)\n  for (const nonce of styleNonces) {\n    expect(nonce).toBe(headerNonce)\n  }\n\n  // Check external script nonce matches (nonce can be before or after src)\n  const externalScriptMatch = rawHtml.match(\n    /<script[^>]*\\bsrc=\"\\/external\\.js\"[^>]*\\bnonce=\"([^\"]+)\"[^>]*>|<script[^>]*\\bnonce=\"([^\"]+)\"[^>]*\\bsrc=\"\\/external\\.js\"[^>]*>/,\n  )\n  expect(externalScriptMatch).toBeTruthy()\n  expect(externalScriptMatch![1] || externalScriptMatch![2]).toBe(headerNonce)\n\n  // Check external stylesheet nonce matches (nonce can be before or after href)\n  const externalStyleMatch = rawHtml.match(\n    /<link[^>]*\\bhref=\"\\/external\\.css\"[^>]*\\bnonce=\"([^\"]+)\"[^>]*>|<link[^>]*\\bnonce=\"([^\"]+)\"[^>]*\\bhref=\"\\/external\\.css\"[^>]*>/,\n  )\n  expect(externalStyleMatch).toBeTruthy()\n  expect(externalStyleMatch![1] || externalStyleMatch![2]).toBe(headerNonce)\n})\n\ntest('Hydration works - counter increments', async ({ page }) => {\n  await page.goto('/')\n  await expect(page.getByTestId('counter-value')).toContainText('0')\n\n  // Keep clicking until React hydrates and the counter increments\n  // This handles the race between test execution and hydration\n  await expect\n    .poll(\n      async () => {\n        await page.getByTestId('counter-btn').click()\n        return page.getByTestId('counter-value').textContent()\n      },\n      { timeout: 10000, intervals: [100, 200, 500, 1000] },\n    )\n    .not.toBe('0')\n\n  // Now that hydration is confirmed, verify further increments work\n  const currentValue = parseInt(\n    (await page.getByTestId('counter-value').textContent()) || '0',\n  )\n  await page.getByTestId('counter-btn').click()\n  await expect(page.getByTestId('counter-value')).toContainText(\n    String(currentValue + 1),\n  )\n})\n\ntest('Inline styles work with CSP', async ({ page }) => {\n  await page.goto('/')\n  const el = page.getByTestId('inline-styled')\n  await expect(el).toBeVisible()\n  // Verify the style was applied (green color)\n  const color = await el.evaluate((e) => getComputedStyle(e).color)\n  expect(color).toBe('rgb(0, 128, 0)') // green\n})\n\ntest('External styles work with CSP', async ({ page }) => {\n  await page.goto('/')\n  const el = page.getByTestId('external-styled')\n  await expect(el).toBeVisible()\n  // Verify the style was applied (blue color)\n  const color = await el.evaluate((e) => getComputedStyle(e).color)\n  expect(color).toBe('rgb(0, 0, 255)') // blue\n})\n\ntest('External script executes with CSP', async ({ page }) => {\n  await page.goto('/')\n  // Check that the external script set its window global\n  await expect\n    .poll(() => page.evaluate(() => (window as any).__EXTERNAL_SCRIPT_LOADED__))\n    .toBe(true)\n})\n\ntest('No CSP violations in console', async ({ page }) => {\n  const violations: string[] = []\n  page.on('console', (msg) => {\n    if (msg.text().toLowerCase().includes('content security policy')) {\n      violations.push(msg.text())\n    }\n  })\n  page.on('pageerror', (err) => {\n    if (err.message.toLowerCase().includes('content security policy')) {\n      violations.push(err.message)\n    }\n  })\n  await page.goto('/')\n  await page.getByTestId('counter-btn').click()\n  // Small wait to ensure any async violations are caught\n  await page.waitForTimeout(100)\n  expect(violations).toEqual([])\n})\n\ntest('Each request gets a unique nonce', async ({ page }) => {\n  const response1 = await page.goto('/')\n  const csp1 = response1?.headers()['content-security-policy'] || ''\n  const nonce1 = csp1.match(/nonce-([a-f0-9]+)/)?.[1]\n\n  const response2 = await page.goto('/')\n  const csp2 = response2?.headers()['content-security-policy'] || ''\n  const nonce2 = csp2.match(/nonce-([a-f0-9]+)/)?.[1]\n\n  expect(nonce1).toBeTruthy()\n  expect(nonce2).toBeTruthy()\n  expect(nonce1).not.toBe(nonce2)\n})\n"
  },
  {
    "path": "e2e/react-start/csp/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/csp/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [tanstackStart()],\n})\n"
  },
  {
    "path": "e2e/react-start/css-modules/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/.gitignore",
    "content": "node_modules\ndist\ntest-results\nplaywright-report\nport*.txt\n"
  },
  {
    "path": "e2e/react-start/css-modules/.prettierignore",
    "content": "src/routeTree.gen.ts\n"
  },
  {
    "path": "e2e/react-start/css-modules/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-css-modules\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev --port $PORT\",\n    \"dev:nitro\": \"VITE_USE_NITRO=true vite dev --port 3000\",\n    \"dev:e2e:nitro\": \"VITE_USE_NITRO=true vite dev --port $PORT\",\n    \"dev:basepath\": \"VITE_BASE_PATH=/my-app vite dev --port 3000\",\n    \"dev:e2e:basepath\": \"VITE_BASE_PATH=/my-app vite dev --port $PORT\",\n    \"dev:cloudflare\": \"echo 'Cloudflare dev mode has React duplication issues - use build+preview instead' && exit 1\",\n    \"dev:e2e:cloudflare\": \"echo 'Cloudflare dev mode has React duplication issues - use build+preview instead' && exit 1\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e:dev\": \"MODE=dev playwright test --project=chromium\",\n    \"test:e2e:dev:nitro\": \"MODE=dev VITE_CONFIG=nitro playwright test --project=chromium\",\n    \"test:e2e:dev:basepath\": \"MODE=dev VITE_CONFIG=basepath playwright test --project=chromium\",\n    \"_test:e2e:dev:cloudflare\": \"MODE=dev VITE_CONFIG=cloudflare playwright test --project=chromium\",\n    \"test:e2e:prod\": \"MODE=prod playwright test --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:dev && pnpm run test:e2e:prod\",\n    \"test:e2e:nitro\": \"rm -rf port*.txt; pnpm run test:e2e:dev:nitro\",\n    \"test:e2e:basepath\": \"rm -rf port*.txt; pnpm run test:e2e:dev:basepath\",\n    \"_test:e2e:cloudflare\": \"echo 'Cloudflare dev mode disabled - React duplication issues' && exit 0\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"@tanstack/react-start\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@cloudflare/vite-plugin\": \"^1.29.0\",\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:*\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"nitro\": \"^3.0.260311-beta\",\n    \"sass\": \"^1.97.2\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"wrangler\": \"^4.74.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst mode = process.env.MODE ?? 'prod'\nconst isDev = mode === 'dev'\nconst viteConfig = process.env.VITE_CONFIG // 'nitro' | 'basepath' | 'cloudflare' | undefined\nconst PORT = await getTestServerPort(\n  viteConfig ? `${packageJson.name}-${viteConfig}` : packageJson.name,\n)\n\n// When using basepath config, the app is served at /my-app\nconst basePath = viteConfig === 'basepath' ? '/my-app' : ''\nconst baseURL = `http://localhost:${PORT}${basePath}`\n\n// Select the appropriate dev command based on VITE_CONFIG\nconst devCommand = viteConfig ? `pnpm dev:e2e:${viteConfig}` : 'pnpm dev:e2e'\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: isDev ? devCommand : `pnpm build && PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      VITE_NODE_ENV: 'test',\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/components/shared-widget-lazy.tsx",
    "content": "import { SharedWidget } from './shared-widget'\n\nexport default function SharedWidgetLazy() {\n  return <SharedWidget />\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/components/shared-widget.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport styles from '~/styles/shared-widget.module.css'\n\nexport function SharedWidget() {\n  return (\n    <div className={styles.widget} data-testid=\"shared-widget\">\n      <div className={styles.title} data-testid=\"shared-widget-title\">\n        Shared widget styles\n      </div>\n      <div className={styles.content} data-testid=\"shared-widget-content\">\n        This widget uses a CSS module shared by a static route and a lazy route.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SassMixinRouteImport } from './routes/sass-mixin'\nimport { Route as QuotesRouteImport } from './routes/quotes'\nimport { Route as ModulesRouteImport } from './routes/modules'\nimport { Route as LazyCssStaticRouteImport } from './routes/lazy-css-static'\nimport { Route as LazyCssLazyRouteImport } from './routes/lazy-css-lazy'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst SassMixinRoute = SassMixinRouteImport.update({\n  id: '/sass-mixin',\n  path: '/sass-mixin',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst QuotesRoute = QuotesRouteImport.update({\n  id: '/quotes',\n  path: '/quotes',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ModulesRoute = ModulesRouteImport.update({\n  id: '/modules',\n  path: '/modules',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LazyCssStaticRoute = LazyCssStaticRouteImport.update({\n  id: '/lazy-css-static',\n  path: '/lazy-css-static',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LazyCssLazyRoute = LazyCssLazyRouteImport.update({\n  id: '/lazy-css-lazy',\n  path: '/lazy-css-lazy',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/lazy-css-lazy': typeof LazyCssLazyRoute\n  '/lazy-css-static': typeof LazyCssStaticRoute\n  '/modules': typeof ModulesRoute\n  '/quotes': typeof QuotesRoute\n  '/sass-mixin': typeof SassMixinRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/lazy-css-lazy': typeof LazyCssLazyRoute\n  '/lazy-css-static': typeof LazyCssStaticRoute\n  '/modules': typeof ModulesRoute\n  '/quotes': typeof QuotesRoute\n  '/sass-mixin': typeof SassMixinRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/lazy-css-lazy': typeof LazyCssLazyRoute\n  '/lazy-css-static': typeof LazyCssStaticRoute\n  '/modules': typeof ModulesRoute\n  '/quotes': typeof QuotesRoute\n  '/sass-mixin': typeof SassMixinRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/lazy-css-lazy'\n    | '/lazy-css-static'\n    | '/modules'\n    | '/quotes'\n    | '/sass-mixin'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/lazy-css-lazy'\n    | '/lazy-css-static'\n    | '/modules'\n    | '/quotes'\n    | '/sass-mixin'\n  id:\n    | '__root__'\n    | '/'\n    | '/lazy-css-lazy'\n    | '/lazy-css-static'\n    | '/modules'\n    | '/quotes'\n    | '/sass-mixin'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LazyCssLazyRoute: typeof LazyCssLazyRoute\n  LazyCssStaticRoute: typeof LazyCssStaticRoute\n  ModulesRoute: typeof ModulesRoute\n  QuotesRoute: typeof QuotesRoute\n  SassMixinRoute: typeof SassMixinRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/sass-mixin': {\n      id: '/sass-mixin'\n      path: '/sass-mixin'\n      fullPath: '/sass-mixin'\n      preLoaderRoute: typeof SassMixinRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/quotes': {\n      id: '/quotes'\n      path: '/quotes'\n      fullPath: '/quotes'\n      preLoaderRoute: typeof QuotesRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/modules': {\n      id: '/modules'\n      path: '/modules'\n      fullPath: '/modules'\n      preLoaderRoute: typeof ModulesRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/lazy-css-static': {\n      id: '/lazy-css-static'\n      path: '/lazy-css-static'\n      fullPath: '/lazy-css-static'\n      preLoaderRoute: typeof LazyCssStaticRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/lazy-css-lazy': {\n      id: '/lazy-css-lazy'\n      path: '/lazy-css-lazy'\n      fullPath: '/lazy-css-lazy'\n      preLoaderRoute: typeof LazyCssLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LazyCssLazyRoute: LazyCssLazyRoute,\n  LazyCssStaticRoute: LazyCssStaticRoute,\n  ModulesRoute: ModulesRoute,\n  QuotesRoute: QuotesRoute,\n  SassMixinRoute: SassMixinRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: false,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <nav\n          data-testid=\"main-nav\"\n          style={{\n            padding: '12px 20px',\n            borderBottom: '1px solid #e2e8f0',\n            display: 'flex',\n            alignItems: 'center',\n            gap: '16px',\n            backgroundColor: '#fff',\n          }}\n        >\n          <Link\n            to=\"/\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-home\"\n          >\n            Home (Global CSS)\n          </Link>\n          <Link\n            to=\"/modules\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-modules\"\n          >\n            CSS Modules\n          </Link>\n          <Link\n            to=\"/sass-mixin\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-sass-mixin\"\n          >\n            Sass Mixin\n          </Link>\n          <Link\n            to=\"/quotes\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-quotes\"\n          >\n            Quoted CSS\n          </Link>\n          <Link\n            to=\"/lazy-css-static\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-lazy-css-static\"\n          >\n            Lazy CSS Static\n          </Link>\n          <Link\n            to=\"/lazy-css-lazy\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-lazy-css-lazy\"\n          >\n            Lazy CSS Lazy\n          </Link>\n        </nav>\n\n        <main style={{ padding: '20px' }}>\n          <Outlet />\n        </main>\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport '~/styles/global.css'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div>\n      <h1>CSS Collection Test - Global CSS</h1>\n      <p>This page tests that global CSS is collected and served during SSR.</p>\n\n      <div className=\"global-container\" data-testid=\"global-styled\">\n        <div className=\"global-title\" data-testid=\"global-title\">\n          Global CSS Applied\n        </div>\n        <div className=\"global-description\" data-testid=\"global-description\">\n          This container should have a blue background, white text, and rounded\n          corners even with JavaScript disabled.\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/routes/lazy-css-lazy.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nconst LazySharedWidget = React.lazy(\n  () => import('~/components/shared-widget-lazy'),\n)\n\nexport const Route = createFileRoute('/lazy-css-lazy')({\n  component: LazyCssLazyRoute,\n})\n\nfunction LazyCssLazyRoute() {\n  return (\n    <div>\n      <h1 data-testid=\"lazy-css-lazy-heading\">Lazy CSS Repro - Lazy Route</h1>\n      <p>\n        This route renders the same widget through React.lazy so the CSS only\n        exists behind a dynamic import boundary.\n      </p>\n\n      <React.Suspense\n        fallback={<div data-testid=\"shared-widget-loading\">Loading...</div>}\n      >\n        <LazySharedWidget />\n      </React.Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/routes/lazy-css-static.tsx",
    "content": "import { ClientOnly, createFileRoute } from '@tanstack/react-router'\nimport { SharedWidget } from '~/components/shared-widget'\n\nexport const Route = createFileRoute('/lazy-css-static')({\n  component: LazyCssStaticRoute,\n})\n\nfunction LazyCssStaticRoute() {\n  return (\n    <div>\n      <h1>Lazy CSS Repro - Static Route</h1>\n      <p>\n        This route statically imports the shared widget so its CSS is present in\n        the SSR head.\n      </p>\n\n      <ClientOnly>\n        <div data-testid=\"lazy-css-static-hydrated\">hydrated</div>\n      </ClientOnly>\n\n      <SharedWidget />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/routes/modules.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { createFileRoute } from '@tanstack/react-router'\nimport styles from '~/styles/card.module.css'\n\nexport const Route = createFileRoute('/modules')({\n  component: Modules,\n})\n\nfunction Modules() {\n  return (\n    <div>\n      <h1>CSS Collection Test - CSS Modules</h1>\n      <p>\n        This page tests that CSS modules are collected and served during SSR.\n      </p>\n\n      <div className={styles.card} data-testid=\"module-card\">\n        <div className={styles.title} data-testid=\"module-title\">\n          CSS Module Applied\n        </div>\n        <div className={styles.content} data-testid=\"module-content\">\n          This card should have a green theme with scoped class names even with\n          JavaScript disabled.\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/routes/quotes.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport '~/styles/quotes.css'\n\nexport const Route = createFileRoute('/quotes')({\n  component: Quotes,\n})\n\nfunction Quotes() {\n  return (\n    <div>\n      <h1>CSS Collection Test - Quoted Content</h1>\n      <p>This page tests that CSS with quoted content is properly extracted.</p>\n\n      <div className=\"quote-test\" data-testid=\"quote-styled\">\n        This element uses CSS with content: \"...\" property\n      </div>\n\n      <div className=\"after-quote\" data-testid=\"after-quote-styled\">\n        This element's styles come after the quoted content - should still work\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/routes/sass-mixin.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport '~/styles/app.scss'\n\nexport const Route = createFileRoute('/sass-mixin')({\n  component: SassMixin,\n})\n\nfunction SassMixin() {\n  return (\n    <div>\n      <h1>CSS Collection Test - Sass Mixin</h1>\n      <p>\n        This page tests that Sass mixins imported in a parent file are available\n        to subsequent imports during dev mode SSR.\n      </p>\n\n      <div className=\"mixin-container\" data-testid=\"mixin-styled\">\n        <span data-testid=\"mixin-content\">\n          Sass Mixin Applied - Should be centered with purple background\n        </span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/styles/app.scss",
    "content": "// Import the mixin, which should make them available to future imports\n@import './center-mixin.scss';\n\n@import './mixin-consumer.scss';\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/styles/card.module.css",
    "content": "/* CSS Module for testing scoped styles in dev mode */\n\n.card {\n  background-color: #f0fdf4; /* green-50 */\n  padding: 16px;\n  border-radius: 8px;\n  border: 1px solid #22c55e; /* green-500 */\n}\n\n.title {\n  font-size: 18px;\n  font-weight: 600;\n  color: #166534; /* green-800 */\n  margin-bottom: 8px;\n}\n\n.content {\n  font-size: 14px;\n  color: #15803d; /* green-700 */\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/styles/center-mixin.scss",
    "content": "@mixin center-mixin {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/styles/global.css",
    "content": "/* Global styles for testing CSS collection in dev mode */\n\n.global-container {\n  background-color: #3b82f6; /* blue-500 */\n  padding: 24px;\n  border-radius: 12px;\n  color: white;\n}\n\n.global-title {\n  font-size: 24px;\n  font-weight: bold;\n  margin-bottom: 16px;\n}\n\n.global-description {\n  font-size: 16px;\n  opacity: 0.9;\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/styles/mixin-consumer.scss",
    "content": ".mixin-container {\n  // Use the center mixin, which is included in app.scss\n  // This works for the client build, but not for the dev server styles.css build\n  @include center-mixin;\n  background-color: #a855f7; /* purple-500 */\n  padding: 24px;\n  border-radius: 12px;\n  color: white;\n  min-height: 100px;\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/styles/quotes.css",
    "content": "/* CSS file with quotes that could break regex extraction */\n\n.quote-test {\n  /* Using content with quotes - common pattern that could break extraction */\n  content: 'Hello World';\n  background-color: #ef4444; /* red-500 */\n  padding: 20px;\n  border-radius: 8px;\n  color: white;\n}\n\n.after-quote {\n  /* This style comes after quoted content - should still be present */\n  background-color: #f59e0b; /* amber-500 */\n  padding: 16px;\n  font-weight: bold;\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/src/styles/shared-widget.module.css",
    "content": ".widget {\n  background: rgb(255, 247, 237);\n  border: 2px solid rgb(249, 115, 22);\n  border-radius: 14px;\n  padding: 20px;\n}\n\n.title {\n  color: rgb(154, 52, 18);\n  font-size: 20px;\n  font-weight: 700;\n  margin-bottom: 8px;\n}\n\n.content {\n  color: rgb(194, 65, 12);\n  font-size: 14px;\n  line-height: 1.5;\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/tests/css.dev.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\n// Whitelist errors that can occur in CI:\n// - net::ERR_NAME_NOT_RESOLVED: transient network issues\n// - 504 (Outdated Optimize Dep): Vite dependency optimization reload\nconst whitelistErrors = [\n  'Failed to load resource: net::ERR_NAME_NOT_RESOLVED',\n  'Failed to load resource: the server responded with a status of 504',\n]\ntest.skip(process.env.MODE === 'prod', 'Dev-only repro')\n\ntest.describe('CSS styles in SSR (dev mode)', () => {\n  test.use({ whitelistErrors })\n\n  // Helper to build full URL from baseURL and path\n  // Playwright's goto with absolute paths (like '/modules') ignores baseURL's path portion\n  // So we need to manually construct the full URL\n  const buildUrl = (baseURL: string, path: string) => {\n    return baseURL.replace(/\\/$/, '') + path\n  }\n\n  test.describe('with JavaScript disabled', () => {\n    test.use({ javaScriptEnabled: false, whitelistErrors })\n\n    test('global CSS is applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/'))\n\n      const element = page.getByTestId('global-styled')\n      await expect(element).toBeVisible()\n\n      // Verify the CSS is applied by checking computed styles\n      // #3b82f6 (blue-500) in RGB is rgb(59, 130, 246)\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(59, 130, 246)')\n\n      const padding = await element.evaluate(\n        (el) => getComputedStyle(el).padding,\n      )\n      expect(padding).toBe('24px')\n\n      const borderRadius = await element.evaluate(\n        (el) => getComputedStyle(el).borderRadius,\n      )\n      expect(borderRadius).toBe('12px')\n    })\n\n    test('CSS modules are applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/modules'))\n\n      const card = page.getByTestId('module-card')\n      await expect(card).toBeVisible()\n\n      // Verify class is scoped (hashed)\n      const className = await card.getAttribute('class')\n      expect(className).toBeTruthy()\n      expect(className).not.toBe('card')\n      // The class should contain some hash characters (CSS modules add a hash)\n      expect(className!.length).toBeGreaterThan(5)\n\n      // Verify computed styles from card.module.css\n      // #f0fdf4 (green-50) in RGB is rgb(240, 253, 244)\n      const backgroundColor = await card.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(240, 253, 244)')\n\n      const padding = await card.evaluate((el) => getComputedStyle(el).padding)\n      expect(padding).toBe('16px')\n\n      const borderRadius = await card.evaluate(\n        (el) => getComputedStyle(el).borderRadius,\n      )\n      expect(borderRadius).toBe('8px')\n    })\n\n    test('global CSS class names are NOT scoped', async ({ page, baseURL }) => {\n      await page.goto(buildUrl(baseURL!, '/'))\n\n      const element = page.getByTestId('global-styled')\n      await expect(element).toBeVisible()\n\n      // Get the class attribute - it should be the plain class name (not hashed)\n      const className = await element.getAttribute('class')\n      expect(className).toBe('global-container')\n    })\n\n    test('Sass mixin styles are applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/sass-mixin'))\n\n      const element = page.getByTestId('mixin-styled')\n      await expect(element).toBeVisible()\n\n      // Verify the mixin is applied (display: flex from center-mixin)\n      const display = await element.evaluate(\n        (el) => getComputedStyle(el).display,\n      )\n      expect(display).toBe('flex')\n\n      const justifyContent = await element.evaluate(\n        (el) => getComputedStyle(el).justifyContent,\n      )\n      expect(justifyContent).toBe('center')\n\n      const alignItems = await element.evaluate(\n        (el) => getComputedStyle(el).alignItems,\n      )\n      expect(alignItems).toBe('center')\n\n      // Verify other styles from mixin-consumer.scss\n      // #a855f7 (purple-500) in RGB is rgb(168, 85, 247)\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(168, 85, 247)')\n\n      const padding = await element.evaluate(\n        (el) => getComputedStyle(el).padding,\n      )\n      expect(padding).toBe('24px')\n    })\n\n    test('CSS with quoted content is fully extracted', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/quotes'))\n\n      // Verify the element using CSS with content:\"...\" is styled\n      const quoteElement = page.getByTestId('quote-styled')\n      await expect(quoteElement).toBeVisible()\n\n      // #ef4444 (red-500) in RGB is rgb(239, 68, 68)\n      const quoteBackgroundColor = await quoteElement.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(quoteBackgroundColor).toBe('rgb(239, 68, 68)')\n\n      // Verify styles AFTER the quoted content are also extracted\n      // This is the key test - the regex bug would cut off CSS at the first quote\n      const afterQuoteElement = page.getByTestId('after-quote-styled')\n      await expect(afterQuoteElement).toBeVisible()\n\n      // #f59e0b (amber-500) in RGB is rgb(245, 158, 11)\n      const afterQuoteBackgroundColor = await afterQuoteElement.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(afterQuoteBackgroundColor).toBe('rgb(245, 158, 11)')\n    })\n  })\n\n  test('styles persist after hydration', async ({ page, baseURL }) => {\n    await page.goto(buildUrl(baseURL!, '/'))\n\n    // Wait for hydration and styles to be applied\n    const element = page.getByTestId('global-styled')\n    await expect(element).toBeVisible()\n\n    // Wait for CSS to be applied (background color should not be transparent)\n    await expect(async () => {\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(59, 130, 246)')\n    }).toPass({ timeout: 5000 })\n  })\n\n  test('CSS modules styles persist after hydration', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto(buildUrl(baseURL!, '/modules'))\n\n    // Wait for hydration and styles to be applied\n    const card = page.getByTestId('module-card')\n    await expect(card).toBeVisible()\n\n    // Wait for CSS to be applied (background color should not be transparent)\n    await expect(async () => {\n      const backgroundColor = await card.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(240, 253, 244)')\n    }).toPass({ timeout: 5000 })\n  })\n\n  test('styles work correctly after client-side navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    // Start from home\n    await page.goto(buildUrl(baseURL!, '/'))\n\n    // Verify initial styles\n    const globalElement = page.getByTestId('global-styled')\n    await expect(globalElement).toBeVisible()\n    let backgroundColor = await globalElement.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(59, 130, 246)')\n\n    // Navigate to modules page\n    await page.getByTestId('nav-modules').click()\n    await page.waitForURL('**/modules')\n\n    // Verify CSS modules styles\n    const card = page.getByTestId('module-card')\n    await expect(card).toBeVisible()\n    backgroundColor = await card.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(240, 253, 244)')\n\n    // Navigate back to home\n    await page.getByTestId('nav-home').click()\n    await page.waitForURL(/\\/([^/]*)(\\/)?($|\\?)/)\n\n    // Verify global styles still work\n    await expect(globalElement).toBeVisible()\n    backgroundColor = await globalElement.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(59, 130, 246)')\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/css-modules/tests/css.prod.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.skip(process.env.MODE === 'dev', 'Prod-only repro')\n\ntest.describe('CSS styles in SSR (prod only)', () => {\n  const buildUrl = (baseURL: string, path: string) => {\n    return baseURL.replace(/\\/$/, '') + path\n  }\n\n  test('CSS modules stay applied when navigating from static to lazy route', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto(buildUrl(baseURL!, '/lazy-css-static'))\n\n    const widget = page.getByTestId('shared-widget')\n    await expect(widget).toBeVisible()\n\n    const backgroundColor = await widget.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(255, 247, 237)')\n\n    const borderTopColor = await widget.evaluate(\n      (el) => getComputedStyle(el).borderTopColor,\n    )\n    expect(borderTopColor).toBe('rgb(249, 115, 22)')\n\n    await expect(page.getByTestId('lazy-css-static-hydrated')).toBeVisible()\n\n    await page.getByTestId('nav-lazy-css-lazy').click()\n    await page.waitForURL('**/lazy-css-lazy')\n    await expect(page.getByTestId('lazy-css-lazy-heading')).toBeVisible()\n\n    const lazyWidget = page.getByTestId('shared-widget')\n    await expect(lazyWidget).toBeVisible()\n\n    await expect\n      .poll(\n        () => lazyWidget.evaluate((el) => getComputedStyle(el).backgroundColor),\n        { timeout: 5_000 },\n      )\n      .toBe('rgb(255, 247, 237)')\n  })\n\n  test('CSS modules stay applied when navigating from lazy to static route', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto(buildUrl(baseURL!, '/lazy-css-lazy'))\n    await expect(page.getByTestId('lazy-css-lazy-heading')).toBeVisible()\n\n    // Wait for lazy widget to load\n    const lazyWidget = page.getByTestId('shared-widget')\n    await expect(lazyWidget).toBeVisible()\n\n    await expect\n      .poll(\n        () => lazyWidget.evaluate((el) => getComputedStyle(el).backgroundColor),\n        { timeout: 5_000 },\n      )\n      .toBe('rgb(255, 247, 237)')\n\n    // Navigate to static route\n    await page.getByTestId('nav-lazy-css-static').click()\n    await page.waitForURL('**/lazy-css-static')\n\n    const staticWidget = page.getByTestId('shared-widget')\n    await expect(staticWidget).toBeVisible()\n\n    await expect\n      .poll(\n        () =>\n          staticWidget.evaluate((el) => getComputedStyle(el).backgroundColor),\n        { timeout: 5_000 },\n      )\n      .toBe('rgb(255, 247, 237)')\n\n    const borderTopColor = await staticWidget.evaluate(\n      (el) => getComputedStyle(el).borderTopColor,\n    )\n    expect(borderTopColor).toBe('rgb(249, 115, 22)')\n  })\n\n  test('CSS modules applied on direct navigation to lazy route', async ({\n    page,\n    baseURL,\n  }) => {\n    // Navigate directly to the lazy route (cold start, no prior static route)\n    await page.goto(buildUrl(baseURL!, '/lazy-css-lazy'))\n    await expect(page.getByTestId('lazy-css-lazy-heading')).toBeVisible()\n\n    const widget = page.getByTestId('shared-widget')\n    await expect(widget).toBeVisible()\n\n    await expect\n      .poll(\n        () => widget.evaluate((el) => getComputedStyle(el).backgroundColor),\n        { timeout: 5_000 },\n      )\n      .toBe('rgb(255, 247, 237)')\n\n    const borderTopColor = await widget.evaluate(\n      (el) => getComputedStyle(el).borderTopColor,\n    )\n    expect(borderTopColor).toBe('rgb(249, 115, 22)')\n  })\n\n  test('CSS persists after navigating away from lazy and back', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto(buildUrl(baseURL!, '/lazy-css-static'))\n    await expect(page.getByTestId('lazy-css-static-hydrated')).toBeVisible()\n\n    // Navigate to lazy\n    await page.getByTestId('nav-lazy-css-lazy').click()\n    await page.waitForURL('**/lazy-css-lazy')\n    await expect(page.getByTestId('shared-widget')).toBeVisible()\n\n    // Navigate away to home\n    await page.getByTestId('nav-home').click()\n    await page.waitForURL(/\\/([^/]*)(\\/)?($|\\?)/)\n\n    // Navigate back to lazy\n    await page.getByTestId('nav-lazy-css-lazy').click()\n    await page.waitForURL('**/lazy-css-lazy')\n\n    const widget = page.getByTestId('shared-widget')\n    await expect(widget).toBeVisible()\n\n    await expect\n      .poll(\n        () => widget.evaluate((el) => getComputedStyle(el).backgroundColor),\n        { timeout: 5_000 },\n      )\n      .toBe('rgb(255, 247, 237)')\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/css-modules/tests/setup/global.setup.ts",
    "content": "import { chromium } from '@playwright/test'\nimport {\n  e2eStartDummyServer,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nasync function waitForServer(url: string) {\n  const start = Date.now()\n  while (Date.now() - start < 30_000) {\n    const controller = new AbortController()\n    const timer = setTimeout(() => controller.abort(), 5_000)\n    try {\n      const res = await fetch(url, {\n        redirect: 'manual',\n        signal: controller.signal,\n      })\n      if (res.status >= 200 && res.status < 400) return\n    } catch {\n      // ignore aborted/network errors\n    } finally {\n      clearTimeout(timer)\n    }\n    await new Promise((r) => setTimeout(r, 250))\n  }\n  throw new Error(`Timed out waiting for dev server at ${url}`)\n}\n\nasync function preOptimizeDevServer(baseURL: string) {\n  const browser = await chromium.launch()\n  const context = await browser.newContext()\n  const page = await context.newPage()\n\n  try {\n    await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.goto(`${baseURL}/modules`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('module-card').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.goto(`${baseURL}/sass-mixin`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('mixin-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.goto(`${baseURL}/quotes`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('quote-styled').waitFor({ state: 'visible' })\n    await page.getByTestId('after-quote-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Exercise client-side navigation so Vite discovers any remaining deps\n    // that only load via the client router (not full-page navigations).\n    await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('nav-modules').click()\n    await page.waitForURL('**/modules')\n    await page.getByTestId('module-card').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('nav-home').click()\n    await page.waitForURL(/\\/([^/]*)(\\/)?($|\\?)/)\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Ensure we end in a stable state. Vite's optimize step triggers a reload;\n    // this waits until no further navigations happen for a short window.\n    for (let i = 0; i < 40; i++) {\n      const currentUrl = page.url()\n      await page.waitForTimeout(250)\n      if (page.url() === currentUrl) {\n        await page.waitForTimeout(250)\n        if (page.url() === currentUrl) return\n      }\n    }\n\n    throw new Error('Dev server did not reach a stable URL after warmup')\n  } finally {\n    await context.close()\n    await browser.close()\n  }\n}\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n\n  if (process.env.MODE !== 'dev') return\n\n  const viteConfig = process.env.VITE_CONFIG // 'nitro' | 'basepath' | 'cloudflare' | undefined\n  const port = await getTestServerPort(\n    viteConfig ? `${packageJson.name}-${viteConfig}` : packageJson.name,\n  )\n  const basePath = viteConfig === 'basepath' ? '/my-app' : ''\n  const baseURL = `http://localhost:${port}${basePath}`\n\n  await waitForServer(baseURL)\n  await preOptimizeDevServer(baseURL)\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/css-modules/vite.config.cloudflare.ts",
    "content": "import { defineConfig } from 'vite'\nimport { cloudflare } from '@cloudflare/vite-plugin'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [\n    cloudflare({ viteEnvironment: { name: 'ssr' }, inspectorPort: false }),\n    tanstackStart(),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/css-modules/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\n// Environment variables for different test configurations:\n// - VITE_BASE_PATH: Set to '/my-app' for basepath testing\n// - VITE_USE_NITRO: Set to 'true' to enable Nitro server\nconst basePath = process.env.VITE_BASE_PATH\nconst useNitro = process.env.VITE_USE_NITRO === 'true'\n\nexport default defineConfig(async () => {\n  // Dynamically import nitro only when needed to avoid loading it when not used\n  const nitroPlugin = useNitro ? [(await import('nitro/vite')).nitro()] : []\n\n  return {\n    resolve: { tsconfigPaths: true },\n    base: basePath,\n    server: {\n      port: 3000,\n    },\n    plugins: [\n      // Nitro is placed BEFORE tanstackStart to test that our CSS middleware\n      // works regardless of plugin order (nitro has a catch-all middleware)\n      ...nitroPlugin,\n      tanstackStart(),\n      viteReact(),\n    ],\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/css-modules/wrangler.jsonc",
    "content": "{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"tanstack-start-css-modules\",\n  \"compatibility_date\": \"2025-09-24\",\n  \"compatibility_flags\": [\"nodejs_compat\"],\n  \"main\": \"@tanstack/react-start/server-entry\",\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/custom-basepath/express-server.ts",
    "content": "import express from 'express'\nimport { toNodeHandler } from 'srvx/node'\nimport type { NodeHttp1Handler } from 'srvx'\n\nconst DEVELOPMENT = process.env.NODE_ENV === 'development'\nconst PORT = Number.parseInt(process.env.PORT || '3000')\n\nconst app = express()\n\nif (DEVELOPMENT) {\n  const viteDevServer = await import('vite').then((vite) =>\n    vite.createServer({\n      server: { middlewareMode: true },\n    }),\n  )\n  app.use(viteDevServer.middlewares)\n  app.use(async (req, res, next) => {\n    try {\n      const { default: serverEntry } =\n        await viteDevServer.ssrLoadModule('./src/server.ts')\n      const handler = toNodeHandler(serverEntry.fetch) as NodeHttp1Handler\n      await handler(req, res)\n    } catch (error) {\n      if (typeof error === 'object' && error instanceof Error) {\n        viteDevServer.ssrFixStacktrace(error)\n      }\n      next(error)\n    }\n  })\n} else {\n  const { default: handler } = await import('./dist/server/server.js')\n  const nodeHandler = toNodeHandler(handler.fetch) as NodeHttp1Handler\n  app.use('/custom/basepath', express.static('dist/client'))\n  app.use(async (req, res, next) => {\n    try {\n      await nodeHandler(req, res)\n    } catch (error) {\n      next(error)\n    }\n  })\n}\n\napp.listen(PORT, () => {\n  console.log(`Server is running on http://localhost:${PORT}`)\n})\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-custom-basepath\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"cross-env NODE_ENV=development tsx express-server.ts\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"tsx express-server.ts\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"express\": \"^5.1.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/express\": \"^5.0.3\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"cross-env\": \"^10.0.0\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"tsx\": \"^4.20.3\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}/custom/basepath`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/components/CustomMessage.tsx",
    "content": "import * as React from 'react'\n\nexport function CustomMessage({ message }: { message: string }) {\n  return (\n    <div className=\"py-2\">\n      <div className=\"italic\">This is a custom message:</div>\n      <p>{message}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NavigateTestRouteImport } from './routes/navigate-test'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as RedirectIndexRouteImport } from './routes/redirect/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as RedirectThrowItRouteImport } from './routes/redirect/throw-it'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api.users'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersIdRouteImport } from './routes/api/users.$id'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NavigateTestRoute = NavigateTestRouteImport.update({\n  id: '/navigate-test',\n  path: '/navigate-test',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst RedirectIndexRoute = RedirectIndexRouteImport.update({\n  id: '/redirect/',\n  path: '/redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst RedirectThrowItRoute = RedirectThrowItRouteImport.update({\n  id: '/redirect/throw-it',\n  path: '/redirect/throw-it',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersIdRoute = ApiUsersIdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/navigate-test': typeof NavigateTestRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/navigate-test': typeof NavigateTestRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/redirect': typeof RedirectIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/navigate-test': typeof NavigateTestRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/navigate-test'\n    | '/posts'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts/'\n    | '/redirect/'\n    | '/users/'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/navigate-test'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/navigate-test'\n    | '/posts'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts/'\n    | '/redirect/'\n    | '/users/'\n    | '/api/users/$id'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DeferredRoute: typeof DeferredRoute\n  LogoutRoute: typeof LogoutRoute\n  NavigateTestRoute: typeof NavigateTestRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  RedirectThrowItRoute: typeof RedirectThrowItRoute\n  RedirectIndexRoute: typeof RedirectIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/navigate-test': {\n      id: '/navigate-test'\n      path: '/navigate-test'\n      fullPath: '/navigate-test'\n      preLoaderRoute: typeof NavigateTestRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/redirect/': {\n      id: '/redirect/'\n      path: '/redirect'\n      fullPath: '/redirect/'\n      preLoaderRoute: typeof RedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/redirect/throw-it': {\n      id: '/redirect/throw-it'\n      path: '/redirect/throw-it'\n      fullPath: '/redirect/throw-it'\n      preLoaderRoute: typeof RedirectThrowItRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$id': {\n      id: '/api/users/$id'\n      path: '/$id'\n      fullPath: '/api/users/$id'\n      preLoaderRoute: typeof ApiUsersIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersIdRoute: typeof ApiUsersIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersIdRoute: ApiUsersIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DeferredRoute: DeferredRoute,\n  LogoutRoute: LogoutRoute,\n  NavigateTestRoute: NavigateTestRoute,\n  PostsRoute: PostsRouteWithChildren,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  RedirectThrowItRoute: RedirectThrowItRoute,\n  RedirectIndexRoute: RedirectIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\nimport { basepath } from './utils/basepath'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n    basepath: basepath,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nconst RouterDevtools =\n  process.env.NODE_ENV === 'production'\n    ? () => null // Render nothing in production\n    : React.lazy(() =>\n        // Lazy load in development\n        import('@tanstack/react-router-devtools').then((res) => ({\n          default: res.TanStackRouterDevtools,\n        })),\n      )\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <RouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/api/users.$id.ts",
    "content": "import axios from 'redaxios'\nimport type { User } from '~/utils/users'\nimport { createFileRoute } from '@tanstack/react-router'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        console.info(`Fetching users by id=${params.id}... @`, request.url)\n        try {\n          const res = await axios.get<User>(`${queryURL}/users/` + params.id)\n\n          return Response.json({\n            id: res.data.id,\n            name: res.data.name,\n            email: res.data.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/api.users.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nimport type { User } from '~/utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await axios.get<Array<User>>(`${queryURL}/users`)\n\n        const list = res.data.slice(0, 10)\n\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Suspense, useState } from 'react'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(({ data }) => {\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(async ({ data }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: { name: 'Tanner Linsley' } }),\n      person: await personServerFn({ data: { name: 'John Doe' } }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = useState(0)\n  const { deferredStuff, deferredPerson, person } = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {person.name} - {person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count}</div>\n      <div>\n        <button onClick={() => setCount(count + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { CustomMessage } from '~/components/CustomMessage'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <CustomMessage message=\"Hello from a custom component!\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/logout.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst logoutFn = createServerFn({\n  method: 'POST',\n}).handler(async () => {\n  // do logout stuff here\n  throw redirect({\n    to: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Logout Page</h3>\n      <p>\n        This form tests that server function URLs correctly include the app's\n        basepath. The form action should be '/custom/basepath/_serverFn/...' not\n        just '/_serverFn/...'\n      </p>\n      <form action={logoutFn.url} method=\"POST\">\n        <input type=\"hidden\" name=\"csrfToken\" value=\"123abc\" />\n        <button type=\"submit\">Logout</button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/navigate-test.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/navigate-test')({\n  component: NavigateTest,\n})\n\nfunction NavigateTest() {\n  const navigate = Route.useNavigate()\n\n  return (\n    <div className=\"p-2\">\n      <h3 data-testid=\"navigate-test-component\">Navigate Test</h3>\n      <button\n        data-testid=\"to-posts-href-with-basepath-btn\"\n        onClick={() =>\n          navigate({\n            href: '/custom/basepath/posts',\n          })\n        }\n      >\n        Navigate to /posts using href with basepath\n      </button>{' '}\n      <button\n        data-testid=\"to-posts-href-with-basepath-reload-btn\"\n        onClick={() =>\n          navigate({\n            href: '/custom/basepath/posts',\n            reloadDocument: true,\n          })\n        }\n      >\n        Navigate to /posts using href with basepath (reloadDocument)\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport { fetchPost } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\" data-testid=\"post-view\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nimport { fetchPosts } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\" data-testid=\"posts-component\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nimport { PostErrorComponent } from './posts.$postId'\nimport { fetchPost } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/redirect/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <Link to=\"/redirect/throw-it\">\n        <div data-testid=\"link-to-throw-it\">Throw It</div>\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/redirect/throw-it.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect/throw-it')({\n  beforeLoad: () => {\n    throw redirect({\n      to: '/posts/$postId',\n      params: { postId: '1' },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/users.$userId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nimport type { User } from '~/utils/users'\nimport { NotFound } from '~/components/NotFound'\nimport { basepath } from '~/utils/basepath'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    return await axios\n      .get<User>(basepath + '/api/users/' + userId)\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch user')\n      })\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{user.name}</h4>\n      <div className=\"text-sm\">{user.email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport type { User } from '~/utils/users'\nimport { basepath } from '~/utils/basepath'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    return await axios\n      .get<Array<User>>(basepath + '/api/users')\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch users')\n      })\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...users,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li key={user.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/server.ts",
    "content": "import handler from '@tanstack/react-start/server-entry'\n\nexport default {\n  fetch(request: Request) {\n    return handler.fetch(request)\n  },\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/utils/basepath.ts",
    "content": "export const basepath = '/custom/basepath'\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/tests/navigation.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n\ntest('Server function URLs correctly include app basepath', async ({\n  page,\n}) => {\n  await page.goto('/logout')\n\n  const form = page.locator('form')\n  const actionUrl = await form.getAttribute('action')\n\n  expect(actionUrl).toMatch(/^\\/custom\\/basepath\\/_serverFn\\//)\n})\n\ntest('client-side redirect', async ({ page, baseURL }) => {\n  await page.goto('/redirect')\n  await page.getByTestId('link-to-throw-it').click()\n  await page.waitForLoadState('networkidle')\n\n  expect(await page.getByTestId('post-view').isVisible()).toBe(true)\n  expect(page.url()).toBe(`${baseURL}/posts/1`)\n})\n\ntest('server-side redirect', async ({ page, baseURL }) => {\n  await page.goto('/redirect/throw-it')\n  await page.waitForLoadState('networkidle')\n\n  expect(await page.getByTestId('post-view').isVisible()).toBe(true)\n  expect(page.url()).toBe(`${baseURL}/posts/1`)\n\n  // do not follow redirects since we want to test the Location header\n  // first go to the route WITHOUT the base path, this will just add the base path\n  await page.request\n    .get('/redirect/throw-it', { maxRedirects: 0 })\n    .then((res) => {\n      const headers = new Headers(res.headers())\n      expect(headers.get('location')).toBe('/custom/basepath/redirect/throw-it')\n    })\n  await page.request\n    .get('/custom/basepath/redirect/throw-it', { maxRedirects: 0 })\n    .then((res) => {\n      const headers = new Headers(res.headers())\n      expect(headers.get('location')).toBe('/custom/basepath/posts/1')\n    })\n})\n\ntest('navigate() with href containing basepath', async ({ page, baseURL }) => {\n  await page.goto('/navigate-test')\n  await expect(page.getByTestId('navigate-test-component')).toBeVisible()\n\n  const btn = page.getByTestId('to-posts-href-with-basepath-btn')\n  await btn.click()\n  // Should navigate to /custom/basepath/posts, NOT /custom/basepath/custom/basepath/posts\n  await page.waitForURL(`${baseURL}/posts`)\n  await expect(page.getByTestId('posts-component')).toBeVisible()\n})\n\ntest('navigate() with href containing basepath and reloadDocument=true', async ({\n  page,\n  baseURL,\n}) => {\n  await page.goto('/navigate-test')\n  await expect(page.getByTestId('navigate-test-component')).toBeVisible()\n\n  const btn = page.getByTestId('to-posts-href-with-basepath-reload-btn')\n  await btn.click()\n  // Should navigate to /custom/basepath/posts, NOT stay on current page\n  await page.waitForURL(`${baseURL}/posts`)\n  await expect(page.getByTestId('posts-component')).toBeVisible()\n})\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/custom-basepath/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  base: '/custom/basepath',\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      vite: { installDevServerMiddleware: true },\n    }),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/.gitignore",
    "content": "node_modules\ndist\ntest-results\nplaywright-report\nport*.txt\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/.prettierignore",
    "content": "src/routeTree.gen.ts\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/env.ts",
    "content": "import { z } from 'zod'\n\nconst ssrStylesModeSchema = z\n  .enum(['default', 'disabled', 'custom-basepath'])\n  .default('default')\n\nexport type SsrStylesMode = z.infer<typeof ssrStylesModeSchema>\n\nexport const ssrStylesMode: SsrStylesMode = ssrStylesModeSchema.parse(\n  process.env.SSR_STYLES,\n)\n\nexport const useNitro = process.env.VITE_USE_NITRO === 'true'\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-dev-ssr-styles\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev --port $PORT\",\n    \"dev:e2e:disabled\": \"SSR_STYLES=disabled vite dev --port $PORT\",\n    \"dev:e2e:custom-basepath\": \"SSR_STYLES=custom-basepath vite dev --port $PORT\",\n    \"dev:e2e:nitro\": \"VITE_USE_NITRO=true vite dev --port $PORT\",\n    \"dev:e2e:disabled:nitro\": \"SSR_STYLES=disabled VITE_USE_NITRO=true vite dev --port $PORT\",\n    \"dev:e2e:custom-basepath:nitro\": \"SSR_STYLES=custom-basepath VITE_USE_NITRO=true vite dev --port $PORT\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e:dev\": \"MODE=dev playwright test --project=chromium\",\n    \"test:e2e:dev:disabled\": \"MODE=dev SSR_STYLES=disabled playwright test --project=chromium\",\n    \"test:e2e:dev:custom-basepath\": \"MODE=dev SSR_STYLES=custom-basepath playwright test --project=chromium\",\n    \"test:e2e:dev:nitro\": \"MODE=dev VITE_USE_NITRO=true playwright test --project=chromium\",\n    \"test:e2e:dev:disabled:nitro\": \"MODE=dev SSR_STYLES=disabled VITE_USE_NITRO=true playwright test --project=chromium\",\n    \"test:e2e:dev:custom-basepath:nitro\": \"MODE=dev SSR_STYLES=custom-basepath VITE_USE_NITRO=true playwright test --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:dev && pnpm run test:e2e:dev:disabled && pnpm run test:e2e:dev:custom-basepath\",\n    \"test:e2e:nitro\": \"rm -rf port*.txt; pnpm run test:e2e:dev:nitro && pnpm run test:e2e:dev:disabled:nitro && pnpm run test:e2e:dev:custom-basepath:nitro\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"@tanstack/react-start\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:*\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"nitro\": \"^3.0.260311-beta\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\nimport { ssrStylesMode, useNitro } from './env'\n\nconst mode = process.env.MODE ?? 'prod'\nconst isDev = mode === 'dev'\n\n// Build a unique port key per dimension combination (ssrStyles mode + nitro)\n// e.g. \"...dev-ssr-styles\", \"...dev-ssr-styles-disabled\", \"...dev-ssr-styles-nitro\",\n//      \"...dev-ssr-styles-disabled-nitro\"\nfunction getPortKey() {\n  let key = packageJson.name\n  if (ssrStylesMode !== 'default') {\n    key += `-${ssrStylesMode}`\n  }\n  if (useNitro) {\n    key += '-nitro'\n  }\n  return key\n}\n\nconst PORT = await getTestServerPort(getPortKey())\nconst baseURL = `http://localhost:${PORT}`\n\n// Select the appropriate dev command based on SSR_STYLES + VITE_USE_NITRO\nfunction getDevCommand() {\n  const scriptParts = ['dev:e2e']\n  if (ssrStylesMode !== 'default') {\n    scriptParts.push(ssrStylesMode)\n  }\n  if (useNitro) {\n    scriptParts.push('nitro')\n  }\n  return `pnpm ${scriptParts.join(':')}`\n}\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: isDev ? getDevCommand() : `pnpm build && PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      VITE_NODE_ENV: 'test',\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: false,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport '~/styles/app.css'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div>\n      <h1 data-testid=\"home-heading\">Dev SSR Styles Test</h1>\n      <div className=\"styled-box\" data-testid=\"styled-box\">\n        This box should have a blue background when dev styles are enabled.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/src/styles/app.css",
    "content": "body {\n  font-family: sans-serif;\n  margin: 0;\n  padding: 20px;\n  background-color: #f0f4f8;\n}\n\n.styled-box {\n  background-color: #3b82f6;\n  color: white;\n  padding: 24px;\n  border-radius: 12px;\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { ssrStylesMode } from '../env'\n\n// Whitelist errors that can occur in CI:\n// - net::ERR_NAME_NOT_RESOLVED: transient network issues\n// - 504 (Outdated Optimize Dep): Vite dependency optimization reload\nconst whitelistErrors = [\n  'Failed to load resource: net::ERR_NAME_NOT_RESOLVED',\n  'Failed to load resource: the server responded with a status of 504',\n]\n\ntest.describe(`dev.ssrStyles (mode=${ssrStylesMode})`, () => {\n  test.use({ whitelistErrors })\n\n  test('page renders correctly', async ({ page }) => {\n    await page.goto('/')\n    await expect(page.getByTestId('home-heading')).toHaveText(\n      'Dev SSR Styles Test',\n    )\n  })\n\n  if (ssrStylesMode === 'default') {\n    test.describe('default (enabled, basepath = vite base)', () => {\n      test.use({ javaScriptEnabled: false, whitelistErrors })\n\n      test('SSR HTML contains dev styles link tag', async ({ request }) => {\n        const response = await request.get('/')\n        expect(response.ok()).toBeTruthy()\n        const html = await response.text()\n\n        // Should have a link tag with data-tanstack-router-dev-styles\n        expect(html).toContain('data-tanstack-router-dev-styles')\n        expect(html).toContain('/@tanstack-start/styles.css')\n      })\n\n      test('dev styles link uses vite base (/) as basepath prefix', async ({\n        request,\n      }) => {\n        const response = await request.get('/')\n        expect(response.ok()).toBeTruthy()\n        const html = await response.text()\n\n        // With default vite base (/), the dev styles URL should be\n        // /@tanstack-start/styles.css (no extra prefix)\n        const match = html.match(\n          /href=\"([^\"]*@tanstack-start\\/styles\\.css[^\"]*)\"/,\n        )\n        expect(match).toBeTruthy()\n        const href = match![1]\n        expect(href).toMatch(/^\\/@tanstack-start\\/styles\\.css/)\n      })\n\n      test('CSS is applied on initial page load (SSR)', async ({ page }) => {\n        await page.goto('/')\n\n        const element = page.getByTestId('styled-box')\n        await expect(element).toBeVisible()\n\n        // Verify the CSS is applied: #3b82f6 (blue-500) in RGB is rgb(59, 130, 246)\n        const backgroundColor = await element.evaluate(\n          (el) => getComputedStyle(el).backgroundColor,\n        )\n        expect(backgroundColor).toBe('rgb(59, 130, 246)')\n      })\n    })\n  }\n\n  if (ssrStylesMode === 'disabled') {\n    test.describe('disabled (enabled=false)', () => {\n      test('SSR HTML does NOT contain dev styles link tag', async ({\n        request,\n      }) => {\n        const response = await request.get('/')\n        expect(response.ok()).toBeTruthy()\n        const html = await response.text()\n\n        // Should NOT have a link tag with data-tanstack-router-dev-styles\n        expect(html).not.toContain('data-tanstack-router-dev-styles')\n        expect(html).not.toContain('/@tanstack-start/styles.css')\n      })\n\n      test('page still renders without dev styles', async ({ page }) => {\n        await page.goto('/')\n        await expect(page.getByTestId('home-heading')).toHaveText(\n          'Dev SSR Styles Test',\n        )\n        // The styled box should exist but may not have CSS applied via SSR\n        await expect(page.getByTestId('styled-box')).toBeVisible()\n      })\n    })\n  }\n\n  if (ssrStylesMode === 'custom-basepath') {\n    test.describe('custom basepath (/custom-styles/)', () => {\n      test('SSR HTML contains dev styles link with custom basepath', async ({\n        request,\n      }) => {\n        const response = await request.get('/')\n        expect(response.ok()).toBeTruthy()\n        const html = await response.text()\n\n        // Should have a link tag with data-tanstack-router-dev-styles\n        expect(html).toContain('data-tanstack-router-dev-styles')\n\n        // The dev styles URL should use /custom-styles/ as the basepath prefix\n        const match = html.match(\n          /href=\"([^\"]*@tanstack-start\\/styles\\.css[^\"]*)\"/,\n        )\n        expect(match).toBeTruthy()\n        const href = match![1]\n        expect(href).toMatch(/^\\/custom-styles\\/@tanstack-start\\/styles\\.css/)\n      })\n\n      test.describe('with JavaScript disabled', () => {\n        test.use({ javaScriptEnabled: false, whitelistErrors })\n\n        test('CSS is applied on initial page load (SSR) with custom basepath', async ({\n          page,\n        }) => {\n          await page.goto('/')\n\n          const element = page.getByTestId('styled-box')\n          await expect(element).toBeVisible()\n\n          // Verify the CSS is applied: #3b82f6 (blue-500) in RGB is rgb(59, 130, 246)\n          const backgroundColor = await element.evaluate(\n            (el) => getComputedStyle(el).backgroundColor,\n          )\n          expect(backgroundColor).toBe('rgb(59, 130, 246)')\n        })\n      })\n    })\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/tests/setup/global.setup.ts",
    "content": "import { chromium } from '@playwright/test'\nimport {\n  e2eStartDummyServer,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\nimport { ssrStylesMode, useNitro } from '../../env'\n\nfunction getPortKey() {\n  let key = packageJson.name\n  if (ssrStylesMode !== 'default') {\n    key += `-${ssrStylesMode}`\n  }\n  if (useNitro) {\n    key += '-nitro'\n  }\n  return key\n}\n\nasync function waitForServer(url: string) {\n  const start = Date.now()\n  while (Date.now() - start < 30_000) {\n    const controller = new AbortController()\n    const timer = setTimeout(() => controller.abort(), 5_000)\n    try {\n      const res = await fetch(url, {\n        redirect: 'manual',\n        signal: controller.signal,\n      })\n      if (res.status >= 200 && res.status < 400) return\n    } catch {\n      // ignore aborted/network errors\n    } finally {\n      clearTimeout(timer)\n    }\n    await new Promise((r) => setTimeout(r, 250))\n  }\n  throw new Error(`Timed out waiting for dev server at ${url}`)\n}\n\nasync function preOptimizeDevServer(baseURL: string) {\n  const browser = await chromium.launch()\n  const context = await browser.newContext()\n  const page = await context.newPage()\n\n  try {\n    await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('home-heading').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Ensure we end in a stable state\n    for (let i = 0; i < 40; i++) {\n      const currentUrl = page.url()\n      await page.waitForTimeout(250)\n      if (page.url() === currentUrl) {\n        await page.waitForTimeout(250)\n        if (page.url() === currentUrl) return\n      }\n    }\n\n    throw new Error('Dev server did not reach a stable URL after warmup')\n  } finally {\n    await context.close()\n    await browser.close()\n  }\n}\n\nexport default async function setup() {\n  const portKey = getPortKey()\n\n  await e2eStartDummyServer(portKey)\n\n  if (process.env.MODE !== 'dev') return\n\n  const port = await getTestServerPort(portKey)\n  const baseURL = `http://localhost:${port}`\n\n  await waitForServer(baseURL)\n  await preOptimizeDevServer(baseURL)\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\nimport { ssrStylesMode, useNitro } from '../../env'\n\nfunction getPortKey() {\n  let key = packageJson.name\n  if (ssrStylesMode !== 'default') {\n    key += `-${ssrStylesMode}`\n  }\n  if (useNitro) {\n    key += '-nitro'\n  }\n  return key\n}\n\nexport default async function teardown() {\n  await e2eStopDummyServer(getPortKey())\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/dev-ssr-styles/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { ssrStylesMode, useNitro } from './env'\n\nfunction getSsrStylesConfig() {\n  switch (ssrStylesMode) {\n    case 'disabled':\n      return { enabled: false }\n    case 'custom-basepath':\n      return { enabled: true, basepath: '/custom-styles/' }\n    case 'default':\n      return {} // use defaults (enabled=true, basepath=vite base)\n  }\n}\n\nexport default defineConfig(async () => {\n  // Dynamically import nitro only when needed to avoid loading it when not used\n  const nitroPlugin = useNitro ? [(await import('nitro/vite')).nitro()] : []\n\n  return {\n    resolve: { tsconfigPaths: true },\n    server: {\n      port: 3000,\n    },\n    plugins: [\n      // Nitro is placed BEFORE tanstackStart to test that our CSS middleware\n      // works regardless of plugin order (nitro has a catch-all middleware)\n      ...nitroPlugin,\n      tanstackStart({\n        dev: {\n          ssrStyles: getSsrStylesConfig(),\n        },\n      }),\n      viteReact(),\n    ],\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/.gitignore",
    "content": "# Flamegraph profiles\n**/cpu-profile-*.md\n**/cpu-profile-*.html\n**/cpu-profile-*.pb\n**/heap-profile-*.html\n**/heap-profile-*.pb\n**/heap-profile-*.md"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-flamegraph-bench\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"NODE_ENV=production vite build --mode=production\",\n    \"start\": \"NODE_ENV=production node ./.output/server/index.mjs\",\n    \"start:prof\": \"NODE_ENV=production flame run --md-format=detailed ./.output/server/index.mjs\",\n    \"bench\": \"pnpm build && pnpm bench:run\",\n    \"bench:run\": \"concurrently -k -s first \\\"pnpm start:prof\\\" \\\"sleep 3 && node ./tests/bench.js\\\"\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"@tanstack/react-start\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"srvx\": \"^0.11.9\"\n  },\n  \"devDependencies\": {\n    \"@platformatic/flame\": \"latest\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"nitro\": \"^3.0.260311-beta\",\n    \"autocannon\": \"^8.0.0\",\n    \"concurrently\": \"9.2.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/client.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { hydrateRoot } from 'react-dom/client'\nimport { StartClient } from '@tanstack/react-start/client'\n\nhydrateRoot(document, <StartClient />)\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SearchRouteImport } from './routes/search'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PageIdRouteImport } from './routes/page.$id'\nimport { Route as NestedARouteImport } from './routes/nested/$a'\nimport { Route as NestedABRouteImport } from './routes/nested/$a.$b'\nimport { Route as NestedABCRouteImport } from './routes/nested/$a.$b.$c'\nimport { Route as NestedABCDRouteImport } from './routes/nested/$a.$b.$c.$d'\nimport { Route as NestedABCDERouteImport } from './routes/nested/$a.$b.$c.$d.$e'\nimport { Route as NestedABCDEFRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f'\nimport { Route as NestedABCDEFGRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g'\nimport { Route as NestedABCDEFGHRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h'\nimport { Route as NestedABCDEFGHIRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i'\nimport { Route as NestedABCDEFGHIJRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j'\nimport { Route as NestedABCDEFGHIJKRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k'\nimport { Route as NestedABCDEFGHIJKLRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l'\nimport { Route as NestedABCDEFGHIJKLMRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m'\nimport { Route as NestedABCDEFGHIJKLMNRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n'\nimport { Route as NestedABCDEFGHIJKLMNORouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o'\nimport { Route as NestedABCDEFGHIJKLMNOPRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p'\nimport { Route as NestedABCDEFGHIJKLMNOPQRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q'\nimport { Route as NestedABCDEFGHIJKLMNOPQRRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r'\nimport { Route as NestedABCDEFGHIJKLMNOPQRSRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s'\nimport { Route as NestedABCDEFGHIJKLMNOPQRSTRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t'\nimport { Route as NestedABCDEFGHIJKLMNOPQRSTURouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u'\nimport { Route as NestedABCDEFGHIJKLMNOPQRSTUVRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v'\nimport { Route as NestedABCDEFGHIJKLMNOPQRSTUVWRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.$w'\nimport { Route as NestedABCDEFGHIJKLMNOPQRSTUVWXRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.$w.$x'\nimport { Route as NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.$w.$x.$y'\nimport { Route as NestedABCDEFGHIJKLMNOPQRSTUVWXYZRouteImport } from './routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.$w.$x.$y.$z'\n\nconst SearchRoute = SearchRouteImport.update({\n  id: '/search',\n  path: '/search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PageIdRoute = PageIdRouteImport.update({\n  id: '/page/$id',\n  path: '/page/$id',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedARoute = NestedARouteImport.update({\n  id: '/nested/$a',\n  path: '/nested/$a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedABRoute = NestedABRouteImport.update({\n  id: '/$b',\n  path: '/$b',\n  getParentRoute: () => NestedARoute,\n} as any)\nconst NestedABCRoute = NestedABCRouteImport.update({\n  id: '/$c',\n  path: '/$c',\n  getParentRoute: () => NestedABRoute,\n} as any)\nconst NestedABCDRoute = NestedABCDRouteImport.update({\n  id: '/$d',\n  path: '/$d',\n  getParentRoute: () => NestedABCRoute,\n} as any)\nconst NestedABCDERoute = NestedABCDERouteImport.update({\n  id: '/$e',\n  path: '/$e',\n  getParentRoute: () => NestedABCDRoute,\n} as any)\nconst NestedABCDEFRoute = NestedABCDEFRouteImport.update({\n  id: '/$f',\n  path: '/$f',\n  getParentRoute: () => NestedABCDERoute,\n} as any)\nconst NestedABCDEFGRoute = NestedABCDEFGRouteImport.update({\n  id: '/$g',\n  path: '/$g',\n  getParentRoute: () => NestedABCDEFRoute,\n} as any)\nconst NestedABCDEFGHRoute = NestedABCDEFGHRouteImport.update({\n  id: '/$h',\n  path: '/$h',\n  getParentRoute: () => NestedABCDEFGRoute,\n} as any)\nconst NestedABCDEFGHIRoute = NestedABCDEFGHIRouteImport.update({\n  id: '/$i',\n  path: '/$i',\n  getParentRoute: () => NestedABCDEFGHRoute,\n} as any)\nconst NestedABCDEFGHIJRoute = NestedABCDEFGHIJRouteImport.update({\n  id: '/$j',\n  path: '/$j',\n  getParentRoute: () => NestedABCDEFGHIRoute,\n} as any)\nconst NestedABCDEFGHIJKRoute = NestedABCDEFGHIJKRouteImport.update({\n  id: '/$k',\n  path: '/$k',\n  getParentRoute: () => NestedABCDEFGHIJRoute,\n} as any)\nconst NestedABCDEFGHIJKLRoute = NestedABCDEFGHIJKLRouteImport.update({\n  id: '/$l',\n  path: '/$l',\n  getParentRoute: () => NestedABCDEFGHIJKRoute,\n} as any)\nconst NestedABCDEFGHIJKLMRoute = NestedABCDEFGHIJKLMRouteImport.update({\n  id: '/$m',\n  path: '/$m',\n  getParentRoute: () => NestedABCDEFGHIJKLRoute,\n} as any)\nconst NestedABCDEFGHIJKLMNRoute = NestedABCDEFGHIJKLMNRouteImport.update({\n  id: '/$n',\n  path: '/$n',\n  getParentRoute: () => NestedABCDEFGHIJKLMRoute,\n} as any)\nconst NestedABCDEFGHIJKLMNORoute = NestedABCDEFGHIJKLMNORouteImport.update({\n  id: '/$o',\n  path: '/$o',\n  getParentRoute: () => NestedABCDEFGHIJKLMNRoute,\n} as any)\nconst NestedABCDEFGHIJKLMNOPRoute = NestedABCDEFGHIJKLMNOPRouteImport.update({\n  id: '/$p',\n  path: '/$p',\n  getParentRoute: () => NestedABCDEFGHIJKLMNORoute,\n} as any)\nconst NestedABCDEFGHIJKLMNOPQRoute = NestedABCDEFGHIJKLMNOPQRouteImport.update({\n  id: '/$q',\n  path: '/$q',\n  getParentRoute: () => NestedABCDEFGHIJKLMNOPRoute,\n} as any)\nconst NestedABCDEFGHIJKLMNOPQRRoute =\n  NestedABCDEFGHIJKLMNOPQRRouteImport.update({\n    id: '/$r',\n    path: '/$r',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRoute,\n  } as any)\nconst NestedABCDEFGHIJKLMNOPQRSRoute =\n  NestedABCDEFGHIJKLMNOPQRSRouteImport.update({\n    id: '/$s',\n    path: '/$s',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRRoute,\n  } as any)\nconst NestedABCDEFGHIJKLMNOPQRSTRoute =\n  NestedABCDEFGHIJKLMNOPQRSTRouteImport.update({\n    id: '/$t',\n    path: '/$t',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRSRoute,\n  } as any)\nconst NestedABCDEFGHIJKLMNOPQRSTURoute =\n  NestedABCDEFGHIJKLMNOPQRSTURouteImport.update({\n    id: '/$u',\n    path: '/$u',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRSTRoute,\n  } as any)\nconst NestedABCDEFGHIJKLMNOPQRSTUVRoute =\n  NestedABCDEFGHIJKLMNOPQRSTUVRouteImport.update({\n    id: '/$v',\n    path: '/$v',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRSTURoute,\n  } as any)\nconst NestedABCDEFGHIJKLMNOPQRSTUVWRoute =\n  NestedABCDEFGHIJKLMNOPQRSTUVWRouteImport.update({\n    id: '/$w',\n    path: '/$w',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRSTUVRoute,\n  } as any)\nconst NestedABCDEFGHIJKLMNOPQRSTUVWXRoute =\n  NestedABCDEFGHIJKLMNOPQRSTUVWXRouteImport.update({\n    id: '/$x',\n    path: '/$x',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRSTUVWRoute,\n  } as any)\nconst NestedABCDEFGHIJKLMNOPQRSTUVWXYRoute =\n  NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteImport.update({\n    id: '/$y',\n    path: '/$y',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRSTUVWXRoute,\n  } as any)\nconst NestedABCDEFGHIJKLMNOPQRSTUVWXYZRoute =\n  NestedABCDEFGHIJKLMNOPQRSTUVWXYZRouteImport.update({\n    id: '/$z',\n    path: '/$z',\n    getParentRoute: () => NestedABCDEFGHIJKLMNOPQRSTUVWXYRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/search': typeof SearchRoute\n  '/nested/$a': typeof NestedARouteWithChildren\n  '/page/$id': typeof PageIdRoute\n  '/nested/$a/$b': typeof NestedABRouteWithChildren\n  '/nested/$a/$b/$c': typeof NestedABCRouteWithChildren\n  '/nested/$a/$b/$c/$d': typeof NestedABCDRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e': typeof NestedABCDERouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f': typeof NestedABCDEFRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g': typeof NestedABCDEFGRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h': typeof NestedABCDEFGHRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i': typeof NestedABCDEFGHIRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j': typeof NestedABCDEFGHIJRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k': typeof NestedABCDEFGHIJKRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l': typeof NestedABCDEFGHIJKLRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m': typeof NestedABCDEFGHIJKLMRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n': typeof NestedABCDEFGHIJKLMNRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o': typeof NestedABCDEFGHIJKLMNORouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p': typeof NestedABCDEFGHIJKLMNOPRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q': typeof NestedABCDEFGHIJKLMNOPQRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r': typeof NestedABCDEFGHIJKLMNOPQRRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s': typeof NestedABCDEFGHIJKLMNOPQRSRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t': typeof NestedABCDEFGHIJKLMNOPQRSTRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u': typeof NestedABCDEFGHIJKLMNOPQRSTURouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v': typeof NestedABCDEFGHIJKLMNOPQRSTUVRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w': typeof NestedABCDEFGHIJKLMNOPQRSTUVWRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYZRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/search': typeof SearchRoute\n  '/nested/$a': typeof NestedARouteWithChildren\n  '/page/$id': typeof PageIdRoute\n  '/nested/$a/$b': typeof NestedABRouteWithChildren\n  '/nested/$a/$b/$c': typeof NestedABCRouteWithChildren\n  '/nested/$a/$b/$c/$d': typeof NestedABCDRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e': typeof NestedABCDERouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f': typeof NestedABCDEFRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g': typeof NestedABCDEFGRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h': typeof NestedABCDEFGHRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i': typeof NestedABCDEFGHIRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j': typeof NestedABCDEFGHIJRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k': typeof NestedABCDEFGHIJKRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l': typeof NestedABCDEFGHIJKLRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m': typeof NestedABCDEFGHIJKLMRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n': typeof NestedABCDEFGHIJKLMNRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o': typeof NestedABCDEFGHIJKLMNORouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p': typeof NestedABCDEFGHIJKLMNOPRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q': typeof NestedABCDEFGHIJKLMNOPQRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r': typeof NestedABCDEFGHIJKLMNOPQRRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s': typeof NestedABCDEFGHIJKLMNOPQRSRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t': typeof NestedABCDEFGHIJKLMNOPQRSTRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u': typeof NestedABCDEFGHIJKLMNOPQRSTURouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v': typeof NestedABCDEFGHIJKLMNOPQRSTUVRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w': typeof NestedABCDEFGHIJKLMNOPQRSTUVWRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYZRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/search': typeof SearchRoute\n  '/nested/$a': typeof NestedARouteWithChildren\n  '/page/$id': typeof PageIdRoute\n  '/nested/$a/$b': typeof NestedABRouteWithChildren\n  '/nested/$a/$b/$c': typeof NestedABCRouteWithChildren\n  '/nested/$a/$b/$c/$d': typeof NestedABCDRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e': typeof NestedABCDERouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f': typeof NestedABCDEFRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g': typeof NestedABCDEFGRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h': typeof NestedABCDEFGHRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i': typeof NestedABCDEFGHIRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j': typeof NestedABCDEFGHIJRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k': typeof NestedABCDEFGHIJKRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l': typeof NestedABCDEFGHIJKLRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m': typeof NestedABCDEFGHIJKLMRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n': typeof NestedABCDEFGHIJKLMNRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o': typeof NestedABCDEFGHIJKLMNORouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p': typeof NestedABCDEFGHIJKLMNOPRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q': typeof NestedABCDEFGHIJKLMNOPQRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r': typeof NestedABCDEFGHIJKLMNOPQRRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s': typeof NestedABCDEFGHIJKLMNOPQRSRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t': typeof NestedABCDEFGHIJKLMNOPQRSTRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u': typeof NestedABCDEFGHIJKLMNOPQRSTURouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v': typeof NestedABCDEFGHIJKLMNOPQRSTUVRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w': typeof NestedABCDEFGHIJKLMNOPQRSTUVWRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteWithChildren\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z': typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYZRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/search'\n    | '/nested/$a'\n    | '/page/$id'\n    | '/nested/$a/$b'\n    | '/nested/$a/$b/$c'\n    | '/nested/$a/$b/$c/$d'\n    | '/nested/$a/$b/$c/$d/$e'\n    | '/nested/$a/$b/$c/$d/$e/$f'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/search'\n    | '/nested/$a'\n    | '/page/$id'\n    | '/nested/$a/$b'\n    | '/nested/$a/$b/$c'\n    | '/nested/$a/$b/$c/$d'\n    | '/nested/$a/$b/$c/$d/$e'\n    | '/nested/$a/$b/$c/$d/$e/$f'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z'\n  id:\n    | '__root__'\n    | '/'\n    | '/search'\n    | '/nested/$a'\n    | '/page/$id'\n    | '/nested/$a/$b'\n    | '/nested/$a/$b/$c'\n    | '/nested/$a/$b/$c/$d'\n    | '/nested/$a/$b/$c/$d/$e'\n    | '/nested/$a/$b/$c/$d/$e/$f'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y'\n    | '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  SearchRoute: typeof SearchRoute\n  NestedARoute: typeof NestedARouteWithChildren\n  PageIdRoute: typeof PageIdRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/search': {\n      id: '/search'\n      path: '/search'\n      fullPath: '/search'\n      preLoaderRoute: typeof SearchRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/page/$id': {\n      id: '/page/$id'\n      path: '/page/$id'\n      fullPath: '/page/$id'\n      preLoaderRoute: typeof PageIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/$a': {\n      id: '/nested/$a'\n      path: '/nested/$a'\n      fullPath: '/nested/$a'\n      preLoaderRoute: typeof NestedARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/$a/$b': {\n      id: '/nested/$a/$b'\n      path: '/$b'\n      fullPath: '/nested/$a/$b'\n      preLoaderRoute: typeof NestedABRouteImport\n      parentRoute: typeof NestedARoute\n    }\n    '/nested/$a/$b/$c': {\n      id: '/nested/$a/$b/$c'\n      path: '/$c'\n      fullPath: '/nested/$a/$b/$c'\n      preLoaderRoute: typeof NestedABCRouteImport\n      parentRoute: typeof NestedABRoute\n    }\n    '/nested/$a/$b/$c/$d': {\n      id: '/nested/$a/$b/$c/$d'\n      path: '/$d'\n      fullPath: '/nested/$a/$b/$c/$d'\n      preLoaderRoute: typeof NestedABCDRouteImport\n      parentRoute: typeof NestedABCRoute\n    }\n    '/nested/$a/$b/$c/$d/$e': {\n      id: '/nested/$a/$b/$c/$d/$e'\n      path: '/$e'\n      fullPath: '/nested/$a/$b/$c/$d/$e'\n      preLoaderRoute: typeof NestedABCDERouteImport\n      parentRoute: typeof NestedABCDRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f': {\n      id: '/nested/$a/$b/$c/$d/$e/$f'\n      path: '/$f'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f'\n      preLoaderRoute: typeof NestedABCDEFRouteImport\n      parentRoute: typeof NestedABCDERoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g'\n      path: '/$g'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g'\n      preLoaderRoute: typeof NestedABCDEFGRouteImport\n      parentRoute: typeof NestedABCDEFRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h'\n      path: '/$h'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h'\n      preLoaderRoute: typeof NestedABCDEFGHRouteImport\n      parentRoute: typeof NestedABCDEFGRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i'\n      path: '/$i'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i'\n      preLoaderRoute: typeof NestedABCDEFGHIRouteImport\n      parentRoute: typeof NestedABCDEFGHRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j'\n      path: '/$j'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j'\n      preLoaderRoute: typeof NestedABCDEFGHIJRouteImport\n      parentRoute: typeof NestedABCDEFGHIRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k'\n      path: '/$k'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k'\n      preLoaderRoute: typeof NestedABCDEFGHIJKRouteImport\n      parentRoute: typeof NestedABCDEFGHIJRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l'\n      path: '/$l'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m'\n      path: '/$m'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n'\n      path: '/$n'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o'\n      path: '/$o'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNORouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p'\n      path: '/$p'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNORoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q'\n      path: '/$q'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r'\n      path: '/$r'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s'\n      path: '/$s'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRSRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t'\n      path: '/$t'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRSTRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRSRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u'\n      path: '/$u'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRSTURouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRSTRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v'\n      path: '/$v'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRSTURoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w'\n      path: '/$w'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x'\n      path: '/$x'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWXRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y'\n      path: '/$y'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWXRoute\n    }\n    '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z': {\n      id: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z'\n      path: '/$z'\n      fullPath: '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z'\n      preLoaderRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYZRouteImport\n      parentRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYRoute\n    }\n  }\n}\n\ninterface NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRSTUVWXYZRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYZRoute\n}\n\nconst NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteChildren: NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRSTUVWXYZRoute:\n      NestedABCDEFGHIJKLMNOPQRSTUVWXYZRoute,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRSTUVWXYRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPQRSTUVWXRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRSTUVWXYRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPQRSTUVWXRouteChildren: NestedABCDEFGHIJKLMNOPQRSTUVWXRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRSTUVWXYRoute:\n      NestedABCDEFGHIJKLMNOPQRSTUVWXYRouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRSTUVWXRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRSTUVWXRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRSTUVWXRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPQRSTUVWRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRSTUVWXRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWXRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPQRSTUVWRouteChildren: NestedABCDEFGHIJKLMNOPQRSTUVWRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRSTUVWXRoute:\n      NestedABCDEFGHIJKLMNOPQRSTUVWXRouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRSTUVWRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRSTUVWRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRSTUVWRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPQRSTUVRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRSTUVWRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVWRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPQRSTUVRouteChildren: NestedABCDEFGHIJKLMNOPQRSTUVRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRSTUVWRoute:\n      NestedABCDEFGHIJKLMNOPQRSTUVWRouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRSTUVRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRSTUVRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRSTUVRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPQRSTURouteChildren {\n  NestedABCDEFGHIJKLMNOPQRSTUVRoute: typeof NestedABCDEFGHIJKLMNOPQRSTUVRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPQRSTURouteChildren: NestedABCDEFGHIJKLMNOPQRSTURouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRSTUVRoute:\n      NestedABCDEFGHIJKLMNOPQRSTUVRouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRSTURouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRSTURoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRSTURouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPQRSTRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRSTURoute: typeof NestedABCDEFGHIJKLMNOPQRSTURouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPQRSTRouteChildren: NestedABCDEFGHIJKLMNOPQRSTRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRSTURoute:\n      NestedABCDEFGHIJKLMNOPQRSTURouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRSTRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRSTRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRSTRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPQRSRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRSTRoute: typeof NestedABCDEFGHIJKLMNOPQRSTRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPQRSRouteChildren: NestedABCDEFGHIJKLMNOPQRSRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRSTRoute:\n      NestedABCDEFGHIJKLMNOPQRSTRouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRSRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRSRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRSRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPQRRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRSRoute: typeof NestedABCDEFGHIJKLMNOPQRSRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPQRRouteChildren: NestedABCDEFGHIJKLMNOPQRRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRSRoute: NestedABCDEFGHIJKLMNOPQRSRouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPQRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRRoute: typeof NestedABCDEFGHIJKLMNOPQRRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPQRouteChildren: NestedABCDEFGHIJKLMNOPQRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRRoute: NestedABCDEFGHIJKLMNOPQRRouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPQRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPQRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPQRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNOPRouteChildren {\n  NestedABCDEFGHIJKLMNOPQRoute: typeof NestedABCDEFGHIJKLMNOPQRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNOPRouteChildren: NestedABCDEFGHIJKLMNOPRouteChildren =\n  {\n    NestedABCDEFGHIJKLMNOPQRoute: NestedABCDEFGHIJKLMNOPQRouteWithChildren,\n  }\n\nconst NestedABCDEFGHIJKLMNOPRouteWithChildren =\n  NestedABCDEFGHIJKLMNOPRoute._addFileChildren(\n    NestedABCDEFGHIJKLMNOPRouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNORouteChildren {\n  NestedABCDEFGHIJKLMNOPRoute: typeof NestedABCDEFGHIJKLMNOPRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNORouteChildren: NestedABCDEFGHIJKLMNORouteChildren = {\n  NestedABCDEFGHIJKLMNOPRoute: NestedABCDEFGHIJKLMNOPRouteWithChildren,\n}\n\nconst NestedABCDEFGHIJKLMNORouteWithChildren =\n  NestedABCDEFGHIJKLMNORoute._addFileChildren(\n    NestedABCDEFGHIJKLMNORouteChildren,\n  )\n\ninterface NestedABCDEFGHIJKLMNRouteChildren {\n  NestedABCDEFGHIJKLMNORoute: typeof NestedABCDEFGHIJKLMNORouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMNRouteChildren: NestedABCDEFGHIJKLMNRouteChildren = {\n  NestedABCDEFGHIJKLMNORoute: NestedABCDEFGHIJKLMNORouteWithChildren,\n}\n\nconst NestedABCDEFGHIJKLMNRouteWithChildren =\n  NestedABCDEFGHIJKLMNRoute._addFileChildren(NestedABCDEFGHIJKLMNRouteChildren)\n\ninterface NestedABCDEFGHIJKLMRouteChildren {\n  NestedABCDEFGHIJKLMNRoute: typeof NestedABCDEFGHIJKLMNRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLMRouteChildren: NestedABCDEFGHIJKLMRouteChildren = {\n  NestedABCDEFGHIJKLMNRoute: NestedABCDEFGHIJKLMNRouteWithChildren,\n}\n\nconst NestedABCDEFGHIJKLMRouteWithChildren =\n  NestedABCDEFGHIJKLMRoute._addFileChildren(NestedABCDEFGHIJKLMRouteChildren)\n\ninterface NestedABCDEFGHIJKLRouteChildren {\n  NestedABCDEFGHIJKLMRoute: typeof NestedABCDEFGHIJKLMRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKLRouteChildren: NestedABCDEFGHIJKLRouteChildren = {\n  NestedABCDEFGHIJKLMRoute: NestedABCDEFGHIJKLMRouteWithChildren,\n}\n\nconst NestedABCDEFGHIJKLRouteWithChildren =\n  NestedABCDEFGHIJKLRoute._addFileChildren(NestedABCDEFGHIJKLRouteChildren)\n\ninterface NestedABCDEFGHIJKRouteChildren {\n  NestedABCDEFGHIJKLRoute: typeof NestedABCDEFGHIJKLRouteWithChildren\n}\n\nconst NestedABCDEFGHIJKRouteChildren: NestedABCDEFGHIJKRouteChildren = {\n  NestedABCDEFGHIJKLRoute: NestedABCDEFGHIJKLRouteWithChildren,\n}\n\nconst NestedABCDEFGHIJKRouteWithChildren =\n  NestedABCDEFGHIJKRoute._addFileChildren(NestedABCDEFGHIJKRouteChildren)\n\ninterface NestedABCDEFGHIJRouteChildren {\n  NestedABCDEFGHIJKRoute: typeof NestedABCDEFGHIJKRouteWithChildren\n}\n\nconst NestedABCDEFGHIJRouteChildren: NestedABCDEFGHIJRouteChildren = {\n  NestedABCDEFGHIJKRoute: NestedABCDEFGHIJKRouteWithChildren,\n}\n\nconst NestedABCDEFGHIJRouteWithChildren =\n  NestedABCDEFGHIJRoute._addFileChildren(NestedABCDEFGHIJRouteChildren)\n\ninterface NestedABCDEFGHIRouteChildren {\n  NestedABCDEFGHIJRoute: typeof NestedABCDEFGHIJRouteWithChildren\n}\n\nconst NestedABCDEFGHIRouteChildren: NestedABCDEFGHIRouteChildren = {\n  NestedABCDEFGHIJRoute: NestedABCDEFGHIJRouteWithChildren,\n}\n\nconst NestedABCDEFGHIRouteWithChildren = NestedABCDEFGHIRoute._addFileChildren(\n  NestedABCDEFGHIRouteChildren,\n)\n\ninterface NestedABCDEFGHRouteChildren {\n  NestedABCDEFGHIRoute: typeof NestedABCDEFGHIRouteWithChildren\n}\n\nconst NestedABCDEFGHRouteChildren: NestedABCDEFGHRouteChildren = {\n  NestedABCDEFGHIRoute: NestedABCDEFGHIRouteWithChildren,\n}\n\nconst NestedABCDEFGHRouteWithChildren = NestedABCDEFGHRoute._addFileChildren(\n  NestedABCDEFGHRouteChildren,\n)\n\ninterface NestedABCDEFGRouteChildren {\n  NestedABCDEFGHRoute: typeof NestedABCDEFGHRouteWithChildren\n}\n\nconst NestedABCDEFGRouteChildren: NestedABCDEFGRouteChildren = {\n  NestedABCDEFGHRoute: NestedABCDEFGHRouteWithChildren,\n}\n\nconst NestedABCDEFGRouteWithChildren = NestedABCDEFGRoute._addFileChildren(\n  NestedABCDEFGRouteChildren,\n)\n\ninterface NestedABCDEFRouteChildren {\n  NestedABCDEFGRoute: typeof NestedABCDEFGRouteWithChildren\n}\n\nconst NestedABCDEFRouteChildren: NestedABCDEFRouteChildren = {\n  NestedABCDEFGRoute: NestedABCDEFGRouteWithChildren,\n}\n\nconst NestedABCDEFRouteWithChildren = NestedABCDEFRoute._addFileChildren(\n  NestedABCDEFRouteChildren,\n)\n\ninterface NestedABCDERouteChildren {\n  NestedABCDEFRoute: typeof NestedABCDEFRouteWithChildren\n}\n\nconst NestedABCDERouteChildren: NestedABCDERouteChildren = {\n  NestedABCDEFRoute: NestedABCDEFRouteWithChildren,\n}\n\nconst NestedABCDERouteWithChildren = NestedABCDERoute._addFileChildren(\n  NestedABCDERouteChildren,\n)\n\ninterface NestedABCDRouteChildren {\n  NestedABCDERoute: typeof NestedABCDERouteWithChildren\n}\n\nconst NestedABCDRouteChildren: NestedABCDRouteChildren = {\n  NestedABCDERoute: NestedABCDERouteWithChildren,\n}\n\nconst NestedABCDRouteWithChildren = NestedABCDRoute._addFileChildren(\n  NestedABCDRouteChildren,\n)\n\ninterface NestedABCRouteChildren {\n  NestedABCDRoute: typeof NestedABCDRouteWithChildren\n}\n\nconst NestedABCRouteChildren: NestedABCRouteChildren = {\n  NestedABCDRoute: NestedABCDRouteWithChildren,\n}\n\nconst NestedABCRouteWithChildren = NestedABCRoute._addFileChildren(\n  NestedABCRouteChildren,\n)\n\ninterface NestedABRouteChildren {\n  NestedABCRoute: typeof NestedABCRouteWithChildren\n}\n\nconst NestedABRouteChildren: NestedABRouteChildren = {\n  NestedABCRoute: NestedABCRouteWithChildren,\n}\n\nconst NestedABRouteWithChildren = NestedABRoute._addFileChildren(\n  NestedABRouteChildren,\n)\n\ninterface NestedARouteChildren {\n  NestedABRoute: typeof NestedABRouteWithChildren\n}\n\nconst NestedARouteChildren: NestedARouteChildren = {\n  NestedABRoute: NestedABRouteWithChildren,\n}\n\nconst NestedARouteWithChildren =\n  NestedARoute._addFileChildren(NestedARouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  SearchRoute: SearchRoute,\n  NestedARoute: NestedARouteWithChildren,\n  PageIdRoute: PageIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <meta charSet=\"utf-8\" />\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n        <title>Flamegraph Benchmark</title>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div>\n      <h1 data-testid=\"page-title\">Flamegraph Benchmark - Index</h1>\n      <p>Navigate to any page to start:</p>\n      <div>\n        {Array.from({ length: 10 }, (_, i) => (\n          <Link\n            key={i}\n            to=\"/page/$id\"\n            params={{ id: String(i) }}\n            style={{ marginRight: '10px' }}\n          >\n            Page {i}\n          </Link>\n        ))}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.$w.$x.$y.$z.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y/$z',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { z } = Route.useParams()\n\n  return (\n    <div>\n      <p>{z}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.$w.$x.$y.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x/$y',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { y } = Route.useParams()\n\n  return (\n    <div>\n      <p>{y}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.$w.$x.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w/$x',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { x } = Route.useParams()\n\n  return (\n    <div>\n      <p>{x}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.$w.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v/$w',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { w } = Route.useParams()\n\n  return (\n    <div>\n      <p>{w}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.$v.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u/$v',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { v } = Route.useParams()\n\n  return (\n    <div>\n      <p>{v}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.$u.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t/$u',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { u } = Route.useParams()\n\n  return (\n    <div>\n      <p>{u}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.$t.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s/$t',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { t } = Route.useParams()\n\n  return (\n    <div>\n      <p>{t}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.$s.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r/$s',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { s } = Route.useParams()\n\n  return (\n    <div>\n      <p>{s}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.$r.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q/$r',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { r } = Route.useParams()\n\n  return (\n    <div>\n      <p>{r}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.$q.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p/$q',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { q } = Route.useParams()\n\n  return (\n    <div>\n      <p>{q}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.$p.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o/$p',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { p } = Route.useParams()\n\n  return (\n    <div>\n      <p>{p}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.$o.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n/$o',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { o } = Route.useParams()\n\n  return (\n    <div>\n      <p>{o}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.$n.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m/$n',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { n } = Route.useParams()\n\n  return (\n    <div>\n      <p>{n}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.$m.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l/$m',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { m } = Route.useParams()\n\n  return (\n    <div>\n      <p>{m}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.$l.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k/$l',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { l } = Route.useParams()\n\n  return (\n    <div>\n      <p>{l}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.$k.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j/$k',\n)({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { k } = Route.useParams()\n\n  return (\n    <div>\n      <p>{k}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.$j.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i/$j')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { j } = Route.useParams()\n\n  return (\n    <div>\n      <p>{j}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.$i.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b/$c/$d/$e/$f/$g/$h/$i')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { i } = Route.useParams()\n\n  return (\n    <div>\n      <p>{i}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.$h.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b/$c/$d/$e/$f/$g/$h')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { h } = Route.useParams()\n\n  return (\n    <div>\n      <p>{h}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.$g.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b/$c/$d/$e/$f/$g')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { g } = Route.useParams()\n\n  return (\n    <div>\n      <p>{g}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.$f.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b/$c/$d/$e/$f')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { f } = Route.useParams()\n\n  return (\n    <div>\n      <p>{f}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.$e.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b/$c/$d/$e')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { e } = Route.useParams()\n\n  return (\n    <div>\n      <p>{e}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.$d.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b/$c/$d')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { d } = Route.useParams()\n\n  return (\n    <div>\n      <p>{d}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.$c.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b/$c')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { c } = Route.useParams()\n\n  return (\n    <div>\n      <p>{c}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.$b.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a/$b')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { b } = Route.useParams()\n\n  return (\n    <div>\n      <p>{b}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/nested/$a.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/nested/$a')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { a } = Route.useParams()\n\n  return (\n    <div>\n      <p>{a}</p>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/page.$id.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/page/$id')({\n  component: PageComponent,\n})\n\nfunction PageComponent() {\n  const { id } = Route.useParams()\n\n  // 100 links = 100 buildLocation calls during SSR\n  return (\n    <div>\n      <h1 data-testid=\"page-title\">Page {id}</h1>\n      <div>\n        {Array.from({ length: 100 }, (_, i) => (\n          <Link\n            key={i}\n            to=\"/page/$id\"\n            params={{ id: String(i % 10) }}\n            data-testid={`link-${i}`}\n            style={{ display: 'block', margin: '2px 0' }}\n          >\n            Go to Page {i % 10}\n          </Link>\n        ))}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/routes/search.tsx",
    "content": "import {\n  createFileRoute,\n  useLoaderData,\n  useSearch,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: (search: Record<string, any>) => ({\n    q: search.q as string | undefined,\n    game: search.game as string | undefined,\n    set: search.set as string | undefined,\n    rarity: search.rarity as string | undefined,\n    page: Number(search.page) || 1,\n    limit: 24,\n    sort: search.sort,\n    order: search.order,\n    minPrice: search.minPrice ? Number(search.minPrice) : undefined,\n    maxPrice: search.maxPrice ? Number(search.maxPrice) : undefined,\n  }),\n  loaderDeps: ({ search }) => search,\n  loader: async ({ deps }) => {\n    return Promise.resolve(deps)\n  },\n  component: SearchPage,\n})\n\nfunction SearchPage() {\n  const q = useSearch({\n    from: '/search',\n    select: (s) => (s as any).q,\n  })\n  const page = useLoaderData({\n    from: '/search',\n    select: (d: any) => d.page,\n  })\n  return (\n    <div>\n      <p>q: {q as any}</p>\n      <p>page: {page as any}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/src/server.ts",
    "content": "import handler from '@tanstack/react-start/server-entry'\n\nexport default {\n  fetch(request: Request) {\n    return handler.fetch(request)\n  },\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/tests/bench.js",
    "content": "import autocannon from 'autocannon'\n\nconst BASE_URL = 'http://localhost:3000'\n\nconst instance = autocannon({\n  url: BASE_URL,\n  overallRate: 20000, // requests per second\n  duration: 30, // seconds\n\n  // Test links\n  // requests: [\n  //   {\n  //     setupRequest: (req) => {\n  //       // Pick a random page for each request\n  //       const randomPage = '/page/' + Math.floor(Math.random() * 1000)\n  //       return { ...req, path: randomPage }\n  //     },\n  //   },\n  // ],\n\n  // Test nested routes + useParams\n  // requests: [\n  //   {\n  //     setupRequest: (req) => {\n  //       // Shuffle the alphabet for each request\n  //       const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('')\n  //       for (let i = alphabet.length - 1; i > 0; i--) {\n  //         const j = Math.floor(Math.random() * (i + 1))\n  //         ;[alphabet[i], alphabet[j]] = [alphabet[j], alphabet[i]]\n  //       }\n  //       const path = '/nested/' + alphabet.join('/')\n  //       return { ...req, path }\n  //     },\n  //   },\n  // ],\n\n  // Test search params + loader + loader deps + useLoaderData\n  requests: [\n    {\n      setupRequest: (req) => {\n        return { ...req, path: `/search?q=${Math.random()}` }\n      },\n    },\n  ],\n})\n\nautocannon.track(instance, { renderProgressBar: true })\n\ninstance.on('done', (results) => {\n  console.log('\\n=== SSR Benchmark Results ===')\n  console.log(`Total requests: ${results.requests.total}`)\n  console.log(`Requests/sec: ${results.requests.average}`)\n  console.log(`Latency (avg): ${results.latency.average}ms`)\n  console.log(`Latency (p99): ${results.latency.p99}ms`)\n  console.log(\n    `Throughput: ${(results.throughput.average / 1024 / 1024).toFixed(2)} MB/s`,\n  )\n\n  if (results.errors) {\n    console.log(`Errors: ${results.errors}`)\n  }\n\n  // Exit after a short delay to allow the server profiler to finish\n  setTimeout(() => process.exit(0), 1000)\n})\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"noEmit\": true,\n    \"jsx\": \"react-jsx\",\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true\n  },\n  \"include\": [\"src\", \"tests\"]\n}\n"
  },
  {
    "path": "e2e/react-start/flamegraph-bench/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { nitro } from 'nitro/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [tanstackStart(), viteReact(), nitro()],\n})\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\ncount.txt\n.env\n.nitro\n.tanstack\n.output\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/.vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\"inlang.vs-code-extension\"]\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/messages/de.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Guten Tag {username}\",\n  \"server_message\": \"Server Nachricht {emoji}\",\n  \"about_message\": \"Über uns\",\n  \"home_page\": \"Startseite\",\n  \"about_page\": \"Über uns\"\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/messages/en.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Hello world {username}\",\n  \"server_message\": \"Server message {emoji}\",\n  \"about_message\": \"About message\",\n  \"home_page\": \"Home page\",\n  \"about_page\": \"About page\"\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-i18n-paraglide\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@inlang/paraglide-js\": \"^2.4.0\",\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/project.inlang/.gitignore",
    "content": "cache"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/project.inlang/project_id",
    "content": "UoZ15Q8qSGIbImRS3Y"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/project.inlang/settings.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/project-settings\",\n  \"baseLocale\": \"en\",\n  \"locales\": [\"en\", \"de\"],\n  \"modules\": [\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js\",\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js\"\n  ],\n  \"plugin.inlang.messageFormat\": {\n    \"pathPattern\": \"./messages/{locale}.json\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/public/manifest.json",
    "content": "{\n  \"short_name\": \"TanStack App\",\n  \"name\": \"Create TanStack App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport { deLocalizeUrl, localizeUrl } from './paraglide/runtime'\n\n// Create a new router instance\nexport const getRouter = () => {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreloadStaleTime: 0,\n    rewrite: {\n      input: ({ url }) => deLocalizeUrl(url),\n      output: ({ url }) => localizeUrl(url),\n    },\n  })\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport styles from '../styles.css?url'\nimport { getLocale, locales, setLocale } from '@/paraglide/runtime'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: styles }],\n  }),\n\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html lang={getLocale()}>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg justify-between\">\n          <div className=\"flex gap-2 text-lg\">\n            <Link\n              to=\"/\"\n              activeProps={{\n                className: 'font-bold',\n              }}\n              activeOptions={{ exact: true }}\n            >\n              {m.home_page()}\n            </Link>\n\n            <Link\n              to=\"/about\"\n              activeProps={{\n                className: 'font-bold',\n              }}\n            >\n              {m.about_page()}\n            </Link>\n          </div>\n\n          <div className=\"flex gap-2 text-lg\">\n            {locales.map((locale) => (\n              <button\n                key={locale}\n                onClick={() => setLocale(locale)}\n                data-active-locale={locale === getLocale()}\n                className=\"rounded p-1 px-2 border border-gray-300 cursor-pointer [&[data-active-locale=true]]:bg-gray-500 [&[data-active-locale=true]]:text-white\"\n              >\n                {locale}\n              </button>\n            ))}\n          </div>\n        </div>\n\n        <hr />\n\n        <div className=\"p-2\">\n          <Outlet />\n        </div>\n\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>{m.about_message()}</div>\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { m } from '@/paraglide/messages.js'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst getServerMessage = createServerFn()\n  .inputValidator((emoji: string) => emoji)\n  .handler((ctx) => {\n    return m.server_message({ emoji: ctx.data })\n  })\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => {\n    return {\n      messageFromLoader: m.example_message({ username: 'John Doe' }),\n      serverFunctionMessage: await getServerMessage({ data: '📩' }),\n    }\n  },\n})\n\nfunction Home() {\n  const { serverFunctionMessage, messageFromLoader } = Route.useLoaderData()\n  return (\n    <div className=\"p-2\">\n      <h2>Message from loader: {messageFromLoader}</h2>\n      <h2>Server function message: {serverFunctionMessage}:</h2>\n      <h2>{m.example_message({ username: 'John Doe' })}</h2>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/server.ts",
    "content": "import { paraglideMiddleware } from './paraglide/server.js'\nimport handler from '@tanstack/react-start/server-entry'\n\nexport default {\n  fetch(req: Request): Promise<Response> {\n    return paraglideMiddleware(req, () => handler.fetch(req))\n  },\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/utils/prerender.ts",
    "content": "import { localizeHref } from '../paraglide/runtime'\n\nexport const prerenderRoutes = ['/', '/about'].map((path) => ({\n  path: localizeHref(path),\n  prerender: {\n    enabled: true,\n  },\n}))\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/src/utils/translated-pathnames.ts",
    "content": "import { Locale } from '@/paraglide/runtime'\nimport { FileRoutesByTo } from '../routeTree.gen'\n\ntype RoutePath = keyof FileRoutesByTo\n\nconst excludedPaths = ['admin', 'docs', 'api'] as const\n\ntype PublicRoutePath = Exclude<\n  RoutePath,\n  `${string}${(typeof excludedPaths)[number]}${string}`\n>\n\ntype TranslatedPathname = {\n  pattern: string\n  localized: Array<[Locale, string]>\n}\n\nfunction toUrlPattern(path: string) {\n  return (\n    path\n      // catch-all\n      .replace(/\\/\\$$/, '/:path(.*)?')\n      // optional parameters: {-$param}\n      .replace(/\\{-\\$([a-zA-Z0-9_]+)\\}/g, ':$1?')\n      // named parameters: $param\n      .replace(/\\$([a-zA-Z0-9_]+)/g, ':$1')\n      // remove trailing slash\n      .replace(/\\/+$/, '')\n  )\n}\n\nfunction createTranslatedPathnames(\n  input: Record<PublicRoutePath, Record<Locale, string>>,\n): TranslatedPathname[] {\n  return Object.entries(input).map(([pattern, locales]) => ({\n    pattern: toUrlPattern(pattern),\n    localized: Object.entries(locales).map(\n      ([locale, path]) =>\n        [locale as Locale, `/${locale}${toUrlPattern(path)}`] satisfies [\n          Locale,\n          string,\n        ],\n    ),\n  }))\n}\n\nexport const translatedPathnames = createTranslatedPathnames({\n  '/': {\n    en: '/',\n    de: '/',\n  },\n  '/about': {\n    en: '/about',\n    de: '/ueber',\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/tests/navigation.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('should not cause redirect loops when accessing the home page', async ({\n  page,\n}) => {\n  // This test verifies that accessing the root URL does not cause a redirect loop\n  // The issue is that with i18n rewrites, the server may keep redirecting between\n  // / and /en (or similar locale prefixed paths) causing \"too many redirects\"\n\n  // Navigate to the root - should eventually land on a locale-prefixed page\n  await page.goto('/')\n  await page.waitForLoadState('networkidle')\n\n  // Verify the page loaded successfully and shows content\n  expect(await page.getByText('Hello world').first().isVisible()).toBe(true)\n})\n\ntest('should not cause redirect loops when accessing locale-prefixed home page', async ({\n  page,\n}) => {\n  // Navigate to the English home page\n  await page.goto('/en')\n  await page.waitForLoadState('networkidle')\n\n  // Verify the page loaded successfully\n  expect(await page.getByText('Hello world').first().isVisible()).toBe(true)\n})\n\ntest('should not cause redirect loops when accessing German home page', async ({\n  page,\n}) => {\n  // Navigate to the German home page\n  await page.goto('/de')\n  await page.waitForLoadState('networkidle')\n\n  // Verify the page loaded successfully - German message\n  expect(await page.getByText('Guten Tag').first().isVisible()).toBe(true)\n})\n\ntest('should navigate between locales without redirect loops', async ({\n  page,\n}) => {\n  // Start at English page\n  await page.goto('/en')\n  await page.waitForLoadState('networkidle')\n\n  // Click the German locale button\n  await page.getByRole('button', { name: 'de' }).click()\n  await page.waitForLoadState('networkidle')\n\n  // Verify we're now on the German page\n  expect(page.url()).toContain('/de')\n  expect(await page.getByText('Guten Tag').first().isVisible()).toBe(true)\n})\n\ntest('server-side navigation to about page should not cause redirect loops', async ({\n  page,\n}) => {\n  // Navigate directly to English about page\n  await page.goto('/en/about')\n  await page.waitForLoadState('networkidle')\n\n  // Verify the page loaded successfully\n  expect(await page.getByText('About message').isVisible()).toBe(true)\n})\n\ntest('server-side navigation to German about page should not cause redirect loops', async ({\n  page,\n}) => {\n  // Navigate directly to German about page (translated path)\n  await page.goto('/de/ueber')\n  await page.waitForLoadState('networkidle')\n\n  // Verify the page loaded successfully by checking the URL\n  expect(page.url()).toContain('/de/ueber')\n\n  // Verify the page content loaded - check for the German nav link which is always present\n  // The about page also contains \"Über uns\" as the content\n  await expect(page.locator('a[href=\"/de/ueber\"]')).toBeVisible()\n})\n\ntest('check redirect behavior does not loop', async ({ page }) => {\n  // Test that requesting the root without locale prefix works with a single redirect\n  const response = await page.request.get('/', { maxRedirects: 0 })\n\n  // We expect either a 200 (if no redirect needed) or a redirect to a locale-prefixed path\n  const status = response.status()\n  if (status >= 300 && status < 400) {\n    const location = response.headers()['location']\n    // The redirect should be to a locale-prefixed path\n    expect(location).toMatch(/^\\/(en|de)/)\n\n    // Following the redirect should not cause another redirect loop\n    const followUp = await page.request.get(location!, { maxRedirects: 0 })\n    // The follow-up should be a 200 or another valid response, not another redirect to the same location\n    expect(followUp.status()).toBeLessThan(400)\n  } else {\n    // If no redirect, the page should load successfully\n    expect(status).toBe(200)\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"types\": [\"vite/client\"],\n    \"allowJs\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": false,\n    \"noEmit\": true,\n\n    /* Linting */\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedSideEffectImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/i18n-paraglide/vite.config.ts",
    "content": "import { paraglideVitePlugin } from '@inlang/paraglide-js'\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst config = defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [\n    paraglideVitePlugin({\n      project: './project.inlang',\n      outdir: './src/paraglide',\n      outputStructure: 'message-modules',\n      cookieName: 'PARAGLIDE_LOCALE',\n      strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'],\n      urlPatterns: [\n        {\n          pattern: '/',\n          localized: [\n            ['en', '/en'],\n            ['de', '/de'],\n          ],\n        },\n        {\n          pattern: '/about',\n          localized: [\n            ['en', '/en/about'],\n            ['de', '/de/ueber'],\n          ],\n        },\n        {\n          pattern: '/:path(.*)?',\n          localized: [\n            ['en', '/en/:path(.*)?'],\n            ['de', '/de/:path(.*)?'],\n          ],\n        },\n      ],\n    }),\n    tanstackStart(),\n    viteReact(),\n    tailwindcss(),\n  ],\n})\n\nexport default config\n"
  },
  {
    "path": "e2e/react-start/import-protection/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\n# Import protection artifacts\ndist\nnode_modules/.vite\nsrc/routeTree.gen.ts\nviolations*.json\nport-*.txt\n\n.tanstack\n\nwebserver-*.log\nerror-build-result.json\nerror-build.log\nerror-dev-result.json\nerror-dev.log\n"
  },
  {
    "path": "e2e/react-start/import-protection/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-import-protection\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e:mockMode\": \"rm -rf node_modules/.vite; rm -rf port*.txt; playwright test --project=chromium\",\n    \"test:e2e:errorMode\": \"rm -rf node_modules/.vite; rm -rf port*.txt; BEHAVIOR=error playwright test --project=chromium\",\n    \"test:e2e\": \"pnpm run test:e2e:mockMode && pnpm run test:e2e:errorMode\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"react-tweet\": \"^3.3.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport { isErrorMode } from './tests/utils/isErrorMode'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\nconsole.log('running in error mode:', isErrorMode.toString())\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  globalSetup: isErrorMode\n    ? './tests/error-mode.setup.ts'\n    : './tests/violations.setup.ts',\n\n  reporter: [['line']],\n\n  use: {\n    baseURL,\n  },\n\n  // In error mode the build intentionally fails, so there is no server to\n  // start.  We skip the webServer entirely and only run error-mode.spec.ts.\n  ...(isErrorMode\n    ? {}\n    : {\n        webServer: {\n          command: `rm -f webserver-build.log webserver-dev.log violations.build.json violations.dev.json && VITE_SERVER_PORT=${PORT} pnpm build > webserver-build.log 2>&1 && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n          url: baseURL,\n          reuseExistingServer: !process.env.CI,\n          stdout: 'pipe',\n          cwd: import.meta.dirname,\n        },\n      }),\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n      testMatch: isErrorMode\n        ? 'error-mode.spec.ts'\n        : 'import-protection.spec.ts',\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/__root.tsx",
    "content": "import {\n  createRootRoute,\n  HeadContent,\n  Link,\n  linkOptions,\n  Outlet,\n  Scripts,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { title: 'Import Protection E2E Test' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nconst navLinks = linkOptions([\n  { to: '/', label: 'Home' },\n  { to: '/leaky-server-import', label: 'Leaky Import' },\n  { to: '/alias-path-namespace-leak', label: 'Alias path namespace leak' },\n  { to: '/client-only-violations', label: 'Client-Only Violations' },\n  { to: '/client-only-jsx', label: 'Client-Only JSX' },\n  { to: '/beforeload-leak', label: 'Beforeload Leak' },\n  { to: '/component-server-leak', label: 'Component Server Leak' },\n  { to: '/barrel-false-positive', label: 'Barrel False Positive' },\n  { to: '/noexternal-client-pkg', label: 'noExternal Client Pkg' },\n  { to: '/alias-path-leak', label: 'Alias Path Leak' },\n  { to: '/non-alias-namespace-leak', label: 'Non-Alias Namespace Leak' },\n])\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <nav>\n          {navLinks.map((link, index) => (\n            <span key={link.to}>\n              {index > 0 ? ' | ' : null}\n              <Link to={link.to}>{link.label}</Link>\n            </span>\n          ))}\n        </nav>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/alias-path-leak.tsx",
    "content": "import { ClientOnly, createFileRoute } from '@tanstack/react-router'\nimport { getSecret } from '~/violations/secret.server'\n\nexport const Route = createFileRoute('/alias-path-leak')({\n  component: AliasPathLeak,\n})\n\nfunction AliasPathLeak() {\n  const secret = getSecret()\n\n  return (\n    <div>\n      <h1 data-testid=\"alias-path-leak-heading\">Alias Path Leak</h1>\n      <p data-testid=\"alias-path-secret\">{secret}</p>\n      <ClientOnly>\n        <p data-testid=\"alias-path-secret-hydration\">hydrated</p>\n        <p data-testid=\"alias-path-secret-client\">{secret}</p>\n      </ClientOnly>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/alias-path-namespace-leak.tsx",
    "content": "import { ClientOnly, createFileRoute } from '@tanstack/react-router'\nimport * as secretModule from '~/violations/secret.server'\n\nexport const Route = createFileRoute('/alias-path-namespace-leak')({\n  component: AliasPathNamespaceLeak,\n})\n\nfunction AliasPathNamespaceLeak() {\n  const secret = secretModule.getSecret?.() ?? 'missing-secret'\n\n  return (\n    <div>\n      <h1 data-testid=\"alias-path-namespace-leak-heading\">\n        Alias Path Namespace Leak\n      </h1>\n      <p data-testid=\"alias-path-namespace-leak-secret\">{secret}</p>\n      <ClientOnly>\n        <p data-testid=\"alias-path-namespace-leak-secret-hydration\">hydrated</p>\n        <p data-testid=\"alias-path-namespace-leak-secret-client\">{secret}</p>\n      </ClientOnly>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/barrel-false-positive.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n// Import from the barrel — NOT directly from .server.\n// `getUsers` (from ./db.server) is only used inside a server fn (compiler strips it).\n// `userColumns` (from ./shared) is a plain object used in JSX — not server-only.\n// Tree-shaking should eliminate the ./db.server dependency entirely from the\n// client bundle, so no import-protection violation should fire for it.\nimport { getUsers, userColumns, type User } from '../violations/barrel-reexport'\n\nconst fetchUsers = createServerFn().handler(async () => {\n  return getUsers()\n})\n\nexport const Route = createFileRoute('/barrel-false-positive')({\n  loader: () => fetchUsers(),\n  component: BarrelFalsePositive,\n})\n\nfunction BarrelFalsePositive() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div>\n      <h1 data-testid=\"barrel-heading\">Barrel False Positive</h1>\n      <table>\n        <thead>\n          <tr>\n            <th data-testid=\"col-name\">{userColumns.name}</th>\n            <th data-testid=\"col-email\">{userColumns.email}</th>\n          </tr>\n        </thead>\n        <tbody>\n          {users.map((user: User) => (\n            <tr key={user.id}>\n              <td>{user.name}</td>\n              <td>{user.email}</td>\n            </tr>\n          ))}\n        </tbody>\n      </table>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/beforeload-leak.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getSessionFromRequest } from '../violations/beforeload-server-leak'\n\nexport const Route = createFileRoute('/beforeload-leak')({\n  // beforeLoad is NOT stripped by the compiler on the client side.\n  // It is not in splitRouteIdentNodes or deleteNodes, so this import\n  // chain survives: beforeload-leak.tsx -> beforeload-server-leak.ts\n  //   -> @tanstack/react-start/server\n  // This is a TRUE POSITIVE violation in the client environment.\n  beforeLoad: () => {\n    const session = getSessionFromRequest()\n    return { session }\n  },\n  component: BeforeloadLeakRoute,\n})\n\nfunction BeforeloadLeakRoute() {\n  return (\n    <div>\n      <h1 data-testid=\"beforeload-leak-heading\">Beforeload Leak</h1>\n      <p data-testid=\"beforeload-leak-status\">Route loaded</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/client-only-jsx.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// This import triggers a file-based violation in the SSR env:\n//   client-only-jsx.tsx -> violations/window-size.client.tsx (denied by **/*.client.*)\n// The binding is used directly in JSX, so the code snippet in the violation\n// message will contain JSX — triggering the `<ClientOnly>` suggestion.\nimport { WindowSize } from '../violations/window-size.client'\n\nexport const Route = createFileRoute('/client-only-jsx')({\n  component: ClientOnlyJsx,\n})\n\nfunction ClientOnlyJsx() {\n  return (\n    <div>\n      <h1 data-testid=\"client-only-jsx-heading\">Client-Only JSX</h1>\n      <p data-testid=\"window-size\">\n        Window:{' '}\n        <strong>\n          <WindowSize />\n        </strong>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/client-only-violations.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// This import triggers a file-based violation in the SSR env:\n//   client-only-violations.tsx -> violations/browser-api.client.ts (denied by **/*.client.*)\nimport { getBrowserTitle } from '../violations/browser-api.client'\n// This import chain triggers a marker violation in the SSR env:\n//   client-only-violations.tsx -> violations/marked-client-only-edge.ts -> violations/marked-client-only.ts\nimport { getClientOnlyDataViaEdge } from '../violations/marked-client-only-edge'\n\nexport const Route = createFileRoute('/client-only-violations')({\n  component: ClientOnlyViolations,\n})\n\nfunction ClientOnlyViolations() {\n  return (\n    <div>\n      <h1 data-testid=\"client-only-heading\">Client-Only Violations</h1>\n      <p data-testid=\"browser-title\">{getBrowserTitle()}</p>\n      <p data-testid=\"client-only-data\">{getClientOnlyDataViaEdge()}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/component-server-leak.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// This import is used ONLY inside the route component.\n// The router plugin code-splits the component into a lazy chunk,\n// moving this import into the split module.\n// Import protection must still catch this as a violation.\nimport { getComponentSecret } from '../violations/db-credentials.server'\n\nexport const Route = createFileRoute('/component-server-leak')({\n  component: ComponentServerLeak,\n})\n\nfunction ComponentServerLeak() {\n  return (\n    <div>\n      <h1 data-testid=\"component-leak-heading\">Component Server Leak</h1>\n      <p data-testid=\"component-leak-secret\">{getComponentSecret()}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// This import chain triggers a file-based violation in the CLIENT env:\n//   index.tsx -> violations/edge-a.ts -> violations/secret.server.ts\nimport { getWrappedSecret } from '../violations/edge-a'\nimport { getWrappedSecret1 } from '../violations/edge-1'\n// This import triggers a marker violation in the CLIENT env:\n//   index.tsx -> violations/marked-server-only-edge.ts -> violations/marked-server-only.ts\nimport { getServerOnlyDataViaEdge } from '../violations/marked-server-only-edge'\nimport { secretServerFn } from '../violations/compiler-leak'\nimport { factorySafeServerFn } from '../violations/factory-safe/usage'\nimport {\n  safeIsomorphic,\n  safeServerFn,\n  safeServerOnly,\n} from '../violations/boundary-safe'\nimport {\n  crossBoundarySafeServerFn,\n  crossBoundarySafeWithAuth,\n} from '../violations/cross-boundary-safe/usage'\nimport { safeFn } from '../violations/cross-boundary-leak/safe-consumer'\nimport { leakyGetSharedData } from '../violations/cross-boundary-leak/leaky-consumer'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div>\n      <h1 data-testid=\"heading\">Import Protection E2E</h1>\n      <p data-testid=\"status\">App loaded successfully with mock mode</p>\n      <p data-testid=\"secret\">{getWrappedSecret()}</p>\n      <p data-testid=\"secret-deep\">{getWrappedSecret1()}</p>\n      <p data-testid=\"server-only-data\">{getServerOnlyDataViaEdge()}</p>\n      <p data-testid=\"compiler-ok\">{String(typeof secretServerFn)}</p>\n      <p data-testid=\"factory-safe\">{String(typeof factorySafeServerFn)}</p>\n      <p data-testid=\"boundary-safe-so\">{String(typeof safeServerOnly)}</p>\n      <p data-testid=\"boundary-safe-sf\">{String(typeof safeServerFn)}</p>\n      <p data-testid=\"boundary-safe-iso\">{String(typeof safeIsomorphic)}</p>\n      <p data-testid=\"cross-boundary-safe-sf\">\n        {String(typeof crossBoundarySafeServerFn)}\n      </p>\n      <p data-testid=\"cross-boundary-safe-mw\">\n        {String(typeof crossBoundarySafeWithAuth)}\n      </p>\n      <p data-testid=\"cross-boundary-leak-safe\">{String(typeof safeFn)}</p>\n      <p data-testid=\"cross-boundary-leak-leaky\">\n        {String(typeof leakyGetSharedData)}\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/leaky-server-import.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { leakyGetRequestUsage } from '../violations/leaky-server-import'\n\nexport const Route = createFileRoute('/leaky-server-import')({\n  component: LeakyServerImportRoute,\n})\n\nfunction LeakyServerImportRoute() {\n  return (\n    <div>\n      <h1 data-testid=\"leaky-heading\">Leaky Server Import</h1>\n      <p data-testid=\"leaky-result\">{String(leakyGetRequestUsage())}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/noexternal-client-pkg.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Tweet } from 'react-tweet'\n\nexport const Route = createFileRoute('/noexternal-client-pkg')({\n  component: NoExternalClientPkg,\n})\n\nfunction NoExternalClientPkg() {\n  return (\n    <div>\n      <h1 data-testid=\"noexternal-heading\">noExternal .client Package</h1>\n      <div data-testid=\"noexternal-tweet\">\n        <Tweet id=\"2023917847961821693\" />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/routes/non-alias-namespace-leak.tsx",
    "content": "import { ClientOnly, createFileRoute } from '@tanstack/react-router'\nimport * as secretModule from '../violations/secret.server'\n\nexport const Route = createFileRoute('/non-alias-namespace-leak')({\n  component: NonAliasNamespaceLeak,\n})\n\nfunction NonAliasNamespaceLeak() {\n  const secret = secretModule.getSecret?.() ?? 'missing-secret'\n\n  return (\n    <div>\n      <h1 data-testid=\"non-alias-namespace-leak-heading\">\n        Non-Alias Namespace Leak\n      </h1>\n      <p data-testid=\"non-alias-namespace-leak-secret\">{secret}</p>\n      <ClientOnly>\n        <p data-testid=\"non-alias-namespace-leak-secret-hydration\">hydrated</p>\n        <p data-testid=\"non-alias-namespace-leak-secret-client\">{secret}</p>\n      </ClientOnly>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/barrel-reexport/db.server.ts",
    "content": "/**\n * Server-only database module.\n * Only exports server-only values: getUsers (DB access) and User type.\n * The side-effect (DATABASE_URL log) should NOT reach the client.\n */\n\nconst DATABASE_URL =\n  process.env.DATABASE_URL ?? 'postgres://admin:s3cret@localhost:5432/myapp'\n\nconsole.log(`[db] connecting to ${DATABASE_URL}`)\n\nexport interface User {\n  id: number\n  name: string\n  email: string\n}\n\nconst FAKE_USERS: Array<User> = [\n  { id: 1, name: 'Alice', email: 'alice@example.com' },\n  { id: 2, name: 'Bob', email: 'bob@example.com' },\n]\n\nexport async function getUsers(): Promise<Array<User>> {\n  await new Promise((r) => setTimeout(r, 50))\n  return FAKE_USERS\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/barrel-reexport/foo.ts",
    "content": "/**\n * Server-only module protected by the marker import pattern.\n * Re-exported through the barrel (index.ts) but never imported by\n * barrel-false-positive.tsx — tree-shaking eliminates it from the\n * client bundle, so no import-protection violation should fire.\n */\nimport '@tanstack/react-start/server-only'\n\nexport function foo(): string {\n  return 'server-only value from foo'\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/barrel-reexport/index.ts",
    "content": "/**\n * Barrel file — NOT a .server file itself.\n * Re-exports from a .server module, a marker-protected module, and a shared module.\n *\n * The key scenario: a consumer imports { getUsers, userColumns } from here.\n * - getUsers comes from ./db.server (server-only via file suffix)\n * - foo comes from ./foo (server-only via marker import)\n * - userColumns comes from ./shared (client-safe)\n *\n * If getUsers is only used inside a createServerFn handler (compiler strips it),\n * and foo is never imported by the consumer at all, tree-shaking should eliminate\n * both ./db.server and ./foo from the client bundle — so the import-protection\n * plugin should NOT fire violations for either.\n */\nexport { getUsers, type User } from './db.server'\nexport { foo } from './foo'\nexport { userColumns } from './shared'\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/barrel-reexport/shared.ts",
    "content": "/**\n * Shared (non-server) module with client-safe values.\n * These are safe to use on the client.\n */\nimport type { User } from './db.server'\n\nexport const userColumns = {\n  name: 'Full Name',\n  email: 'Email Address',\n} as const\n\n/** Placeholder for when no users have loaded yet. */\nexport const emptyUser: User = { id: 0, name: '', email: '' }\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/beforeload-server-leak.ts",
    "content": "import { getRequest } from '@tanstack/react-start/server'\n\n// This utility wraps a denied server import and is used in a route's\n// `beforeLoad` hook.  `beforeLoad` is NOT in the compiler's\n// splitRouteIdentNodes or deleteNodes lists, so it survives on the client.\n// Using this module in `beforeLoad` is therefore a TRUE POSITIVE violation.\nexport function getSessionFromRequest() {\n  const req = getRequest()\n  return { sessionId: req.headers.get('x-session-id') }\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/boundary-safe.ts",
    "content": "import {\n  createIsomorphicFn,\n  createServerFn,\n  createServerOnlyFn,\n} from '@tanstack/react-start'\n\nimport { getSecret } from './secret.server'\n\n// NOTE: `getSecret` is only referenced inside compiler-recognized boundaries.\n// The Start compiler should prune the `./secret.server` import from the client\n// build output.\n\nexport const safeServerOnly = createServerOnlyFn(() => {\n  return getSecret()\n})\n\nexport const safeServerFn = createServerFn().handler(async () => {\n  return getSecret()\n})\n\nexport const safeIsomorphic = createIsomorphicFn()\n  .server(() => {\n    return getSecret()\n  })\n  .client(() => {\n    return 'client'\n  })\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/browser-api.client.ts",
    "content": "/**\n * This file contains browser-only APIs.\n * It uses the `.client.ts` naming convention to mark it as client-only.\n *\n * Importing it from the server (SSR) environment should trigger a file-based\n * violation because the default server deny rules include `**\\/*.client.*`.\n */\nexport function getBrowserTitle() {\n  return typeof document !== 'undefined' ? document.title : 'no-document'\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/compiler-leak.ts",
    "content": "import { createServerFn } from '@tanstack/react-start'\nimport { getSecret } from './secret.server'\n\nexport const secretServerFn = createServerFn().handler(async () => {\n  return getSecret()\n})\n\nexport function leakyReference() {\n  // Intentionally outside createServerFn().handler() so the compiler can't\n  // compile away the import in client builds.\n  return getSecret()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/cross-boundary-leak/leaky-consumer.ts",
    "content": "import { getSharedData } from './shared-util'\n\n// Leaky: uses the shared utility OUTSIDE any compiler boundary.\n// This must still trigger a violation in the client environment\n// even if safe-consumer.ts already loaded shared-util.ts via\n// a fetchModule chain that silenced its resolveId.\nexport function leakyGetSharedData() {\n  return getSharedData()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/cross-boundary-leak/safe-consumer.ts",
    "content": "import { createServerFn } from '@tanstack/react-start'\nimport { getSharedData } from './shared-util'\n\n// Safe: uses the shared utility ONLY inside a compiler boundary.\n// The compiler strips this from the client; fetchModule adds shared-util.ts\n// to the serverFnLookupModules set.\nexport const safeFn = createServerFn().handler(async () => {\n  return getSharedData()\n})\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/cross-boundary-leak/shared-util.ts",
    "content": "import { getRequest } from '@tanstack/react-start/server'\n\n// Utility that wraps a denied server import.  It is consumed by BOTH a\n// safe consumer (inside compiler boundaries) AND a leaky consumer (outside\n// any boundary).  The leaky consumer must still trigger a violation even\n// if the safe consumer's fetchModule chain silences the initial resolve.\nexport function getSharedData() {\n  const req = getRequest()\n  return { method: req.method }\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/cross-boundary-safe/auth-wrapper.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { getSessionData } from './session-util'\n\n// This middleware uses the session utility inside a compiler boundary.\n// The compiler should strip the import of session-util from the client.\nconst authMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    const data = getSessionData()\n    return next({ context: { session: data } })\n  },\n)\n\n// Exports a pre-configured server fn with the middleware attached.\n// This mirrors the real-world `createAuthServerFn` pattern.\nexport const createAuthServerFn = createServerFn().middleware([authMiddleware])\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/cross-boundary-safe/session-util.ts",
    "content": "import { getRequest } from '@tanstack/react-start/server'\n\n// This utility wraps a denied server import but does NOT contain any\n// compiler boundaries.  All consumers use it ONLY inside compiler\n// boundaries (createServerFn().handler, createMiddleware().server, etc.)\n// so the compiler should prune this import from the client bundle.\n//\n// This mirrors the real-world pattern of a session utility that wraps\n// `useSession` from `@tanstack/react-start/server`.\nexport function getSessionData() {\n  const req = getRequest()\n  return { method: req.method }\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/cross-boundary-safe/usage.ts",
    "content": "import { createServerFn } from '@tanstack/react-start'\nimport { getSessionData } from './session-util'\nimport { createAuthServerFn } from './auth-wrapper'\n\n// Pattern 1: Direct use of session utility inside a server fn handler.\n// This mirrors login.tsx importing useAppSession and using it in\n// createServerFn().handler().\nexport const crossBoundarySafeServerFn = createServerFn().handler(async () => {\n  return getSessionData()\n})\n\n// Pattern 2: Using the pre-configured server fn from auth-wrapper.\n// This mirrors user.tsx importing createAuthServerFn().handler().\nexport const crossBoundarySafeWithAuth = createAuthServerFn().handler(\n  async () => {\n    return { ok: true }\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/db-credentials.server.ts",
    "content": "/**\n * Server-only secret used exclusively inside a route component.\n * The route component is code-split by the router plugin into a separate\n * lazy chunk, so the import to this file ends up in the split module —\n * NOT the original route file.  Import protection must still detect this.\n */\nexport const COMPONENT_SECRET = 'component-only-server-secret-99999'\n\nexport function getComponentSecret() {\n  return COMPONENT_SECRET\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/edge-1.ts",
    "content": "import { getWrappedSecret2 } from './edge-2'\n\nexport function getWrappedSecret1() {\n  return getWrappedSecret2()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/edge-2.ts",
    "content": "import { getWrappedSecret3 } from './edge-3'\n\nexport function getWrappedSecret2() {\n  return getWrappedSecret3()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/edge-3.ts",
    "content": "import { getSecret } from './secret.server'\n\nexport function getWrappedSecret3() {\n  return getSecret()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/edge-a.ts",
    "content": "/**\n * Intermediate module that re-exports from the server-only file.\n * This creates a 2-hop import chain:\n *   index.tsx -> edge-a.ts -> secret.server.ts\n */\nimport { getSecret } from './secret.server'\n\nexport function getWrappedSecret() {\n  return getSecret()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/factory-safe/createSecretFactory.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { getRequest } from '@tanstack/react-start/server'\n\nimport { getSecret } from '../secret.server'\n\n// This file intentionally contains denied imports (./secret.server and\n// @tanstack/react-start/server), but they are only referenced inside\n// compiler-recognized server boundaries.\n\nconst secretMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    const req = getRequest()\n    const secret = getSecret()\n    return next({\n      context: { method: req.method, secret } as const,\n    })\n  },\n)\n\nexport const createSecretFactoryServerFn = createServerFn().middleware([\n  secretMiddleware,\n])\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/factory-safe/usage.ts",
    "content": "import { createSecretFactoryServerFn } from './createSecretFactory'\n\nexport const factorySafeServerFn = createSecretFactoryServerFn().handler(\n  async ({ context, method }) => {\n    return {\n      name: 'factorySafeServerFn',\n      method,\n      context,\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/leaky-server-import.ts",
    "content": "import { getRequest } from '@tanstack/react-start/server'\n\n// This is intentionally NOT inside a compiler-recognized boundary.\n// We want the import to survive compilation and be denied in the client build.\nexport function leakyGetRequestUsage() {\n  // Any reference keeps the import alive.\n  return getRequest()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/marked-client-only-edge.ts",
    "content": "/**\n * Intermediate module that re-exports from the client-only marked module.\n * This creates a 2-hop import chain in the server environment:\n *   route -> marked-client-only-edge.ts -> marked-client-only.ts\n */\nimport { getClientOnlyData } from './marked-client-only'\n\nexport function getClientOnlyDataViaEdge() {\n  return getClientOnlyData()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/marked-client-only.ts",
    "content": "/**\n * This module is marked as client-only via the marker import.\n * Importing it from the server (SSR) environment should trigger a marker violation.\n */\nimport '@tanstack/react-start/client-only'\n\nexport const CLIENT_ONLY_DATA = 'only-on-client'\n\nexport function getClientOnlyData() {\n  return CLIENT_ONLY_DATA\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/marked-server-only-edge.ts",
    "content": "import { getServerOnlyData } from './marked-server-only'\n\nexport function getServerOnlyDataViaEdge() {\n  return getServerOnlyData()\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/marked-server-only.ts",
    "content": "/**\n * This module is marked as server-only via the marker import.\n * Importing it from the client environment should trigger a violation.\n */\nimport '@tanstack/react-start/server-only'\n\nexport const SERVER_ONLY_DATA = 'only-on-server'\n\nexport function getServerOnlyData() {\n  return SERVER_ONLY_DATA\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/secret.server.ts",
    "content": "/**\n * This file contains a secret that should only be available on the server.\n * It uses the `.server.ts` naming convention to mark it as server-only.\n */\nexport const SECRET_KEY = 'super-secret-server-key-12345'\n\nexport function getSecret() {\n  return SECRET_KEY\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/src/violations/window-size.client.tsx",
    "content": "/**\n * This file contains a browser-only React component for window dimensions.\n * It uses the `.client.tsx` naming convention to mark it as client-only.\n *\n * Importing it from the server (SSR) environment should trigger a file-based\n * violation because the default server deny rules include `**\\/*.client.*`.\n *\n * Because this exports a React component used in JSX, the violation snippet\n * in the importing route will show JSX usage (`<WindowSize />`), triggering\n * the `<ClientOnly>` suggestion.\n */\nexport function WindowSize() {\n  const w = typeof window !== 'undefined' ? window.innerWidth : 0\n  const h = typeof window !== 'undefined' ? window.innerHeight : 0\n  return (\n    <span>\n      {w}x{h}\n    </span>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/tests/error-mode.setup.ts",
    "content": "import fs from 'node:fs'\nimport path from 'node:path'\nimport { execSync, spawn } from 'node:child_process'\nimport { chromium } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\nimport type { FullConfig } from '@playwright/test'\n\n/**\n * Global setup for error-mode E2E tests.\n *\n * 1. Runs `BEHAVIOR=error pnpm build` — expected to fail because the plugin\n *    calls `this.error()` on the first violation, aborting the Rollup build.\n *    Output is written to `error-build-result.json`.\n *\n * 2. Starts a dev server with `BEHAVIOR=error`, navigates all violation\n *    routes, then captures the server log.  In dev mode `this.error()` causes\n *    a module-level 500 (the server stays up).  Output is written to\n *    `error-dev-result.json`.\n */\n\nasync function waitForHttpOk(url: string, timeoutMs: number): Promise<void> {\n  const start = Date.now()\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  while (true) {\n    if (Date.now() - start > timeoutMs) {\n      throw new Error(`Timed out waiting for ${url}`)\n    }\n    try {\n      const res = await fetch(url, { signal: AbortSignal.timeout(1000) })\n      if (res.ok) return\n    } catch {\n      // ignore\n    }\n    await new Promise((r) => setTimeout(r, 200))\n  }\n}\n\nasync function killChild(child: ReturnType<typeof spawn>): Promise<void> {\n  if (child.exitCode !== null || child.killed) return\n  await new Promise<void>((resolve) => {\n    let resolved = false\n    const done = () => {\n      if (resolved) return\n      resolved = true\n      resolve()\n    }\n    child.once('exit', done)\n    child.once('error', done)\n    try {\n      child.kill('SIGTERM')\n    } catch {\n      done()\n      return\n    }\n    setTimeout(() => {\n      try {\n        child.kill('SIGKILL')\n      } catch {\n        // ignore\n      }\n      setTimeout(done, 500)\n    }, 3000)\n  })\n}\n\nfunction captureBuild(cwd: string): void {\n  const outFile = path.resolve(cwd, 'error-build-result.json')\n  for (const f of ['error-build-result.json', 'error-build.log']) {\n    const p = path.resolve(cwd, f)\n    if (fs.existsSync(p)) fs.unlinkSync(p)\n  }\n\n  let stdout = ''\n  let stderr = ''\n  let exitCode = 0\n\n  try {\n    const output = execSync('pnpm build', {\n      cwd,\n      env: { ...process.env, BEHAVIOR: 'error' },\n      encoding: 'utf-8',\n      stdio: ['ignore', 'pipe', 'pipe'],\n      timeout: 120_000,\n    })\n    stdout = output\n  } catch (err: any) {\n    exitCode = err.status ?? 1\n    stdout = err.stdout ?? ''\n    stderr = err.stderr ?? ''\n  }\n\n  const combined = `${stdout}\\n${stderr}`\n  fs.writeFileSync(path.resolve(cwd, 'error-build.log'), combined)\n  fs.writeFileSync(\n    outFile,\n    JSON.stringify({ exitCode, stdout, stderr, combined }, null, 2),\n  )\n}\n\nconst routes = [\n  '/',\n  '/leaky-server-import',\n  '/client-only-violations',\n  '/client-only-jsx',\n  '/beforeload-leak',\n  '/barrel-false-positive',\n]\n\nasync function captureDev(cwd: string): Promise<void> {\n  const outFile = path.resolve(cwd, 'error-dev-result.json')\n  for (const f of ['error-dev-result.json', 'error-dev.log']) {\n    const p = path.resolve(cwd, f)\n    if (fs.existsSync(p)) fs.unlinkSync(p)\n  }\n\n  const port = await getTestServerPort(`${packageJson.name}_error_dev`)\n  const baseURL = `http://localhost:${port}`\n  const logFile = path.resolve(cwd, 'error-dev.log')\n\n  const out = fs.createWriteStream(logFile)\n  const child = spawn('pnpm', ['exec', 'vite', 'dev', '--port', String(port)], {\n    cwd,\n    env: {\n      ...process.env,\n      BEHAVIOR: 'error',\n      PORT: String(port),\n      VITE_SERVER_PORT: String(port),\n      VITE_NODE_ENV: 'test',\n    },\n    stdio: ['ignore', 'pipe', 'pipe'],\n  })\n\n  child.stdout?.on('data', (d: Buffer) => out.write(d))\n  child.stderr?.on('data', (d: Buffer) => out.write(d))\n\n  try {\n    await waitForHttpOk(baseURL, 30_000)\n\n    const browser = await chromium.launch()\n    try {\n      const context = await browser.newContext()\n      const page = await context.newPage()\n      for (const route of routes) {\n        try {\n          await page.goto(`${baseURL}${route}`, {\n            // Vite dev keeps long-lived connections; 'networkidle' can hang.\n            waitUntil: 'load',\n            timeout: 30_000,\n          })\n        } catch {\n          // expected — modules fail with 500 in error mode\n        }\n      }\n      await context.close()\n    } finally {\n      await browser.close()\n    }\n\n    await new Promise((r) => setTimeout(r, 750))\n  } finally {\n    await killChild(child)\n    await new Promise<void>((resolve) => out.end(resolve))\n  }\n\n  const combined = fs.existsSync(logFile)\n    ? fs.readFileSync(logFile, 'utf-8')\n    : ''\n  fs.writeFileSync(outFile, JSON.stringify({ combined }, null, 2))\n}\n\nexport default async function globalSetup(config: FullConfig) {\n  void config\n  const cwd = path.resolve(import.meta.dirname, '..')\n\n  captureBuild(cwd)\n  await captureDev(cwd)\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/tests/error-mode.spec.ts",
    "content": "import path from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\nimport { extractViolationsFromLog, stripAnsi } from './violations.utils'\n\ninterface ErrorResult {\n  exitCode?: number\n  stdout?: string\n  stderr?: string\n  combined: string\n}\n\nasync function readResult(name: string): Promise<ErrorResult> {\n  const p = path.resolve(import.meta.dirname, '..', name)\n  const mod: { default: ErrorResult } = await import(p, {\n    with: { type: 'json' },\n  })\n  return mod.default\n}\n\n// Build error mode tests\n\ntest('build fails with non-zero exit code in error mode', async () => {\n  const result = await readResult('error-build-result.json')\n  expect(result.exitCode).not.toBe(0)\n})\n\ntest('build output contains import-protection violation', async () => {\n  const result = await readResult('error-build-result.json')\n  const text = stripAnsi(result.combined)\n  expect(text).toContain('[import-protection] Import denied in')\n})\n\ntest('build violation mentions environment', async () => {\n  const result = await readResult('error-build-result.json')\n  const text = stripAnsi(result.combined)\n  const hasClient = text.includes('Import denied in client environment')\n  const hasServer = text.includes('Import denied in server environment')\n  expect(hasClient || hasServer).toBe(true)\n})\n\ntest('build violation includes importer and specifier', async () => {\n  const result = await readResult('error-build-result.json')\n  const text = stripAnsi(result.combined)\n  expect(text).toContain('Importer:')\n  expect(text).toContain('Import:')\n})\n\ntest('build violation includes denial reason', async () => {\n  const result = await readResult('error-build-result.json')\n  const text = stripAnsi(result.combined)\n  const hasFilePattern = text.includes('Denied by file pattern')\n  const hasSpecifierPattern = text.includes('Denied by specifier pattern')\n  const hasMarker = text.includes('Denied by marker')\n  expect(hasFilePattern || hasSpecifierPattern || hasMarker).toBe(true)\n})\n\ntest('build violation includes trace', async () => {\n  const result = await readResult('error-build-result.json')\n  const text = stripAnsi(result.combined)\n  expect(text).toContain('Trace:')\n  expect(text).toMatch(/\\d+\\.\\s+\\S+/)\n})\n\ntest('build violation is parseable', async () => {\n  const result = await readResult('error-build-result.json')\n  const violations = extractViolationsFromLog(result.combined)\n  expect(violations.length).toBeGreaterThanOrEqual(1)\n\n  const v = violations[0]\n  expect(v.envType).toMatch(/^(client|server)$/)\n  expect(v.importer).toBeTruthy()\n  expect(v.specifier).toBeTruthy()\n  expect(v.type).toMatch(/^(file|specifier|marker)$/)\n  expect(v.trace.length).toBeGreaterThanOrEqual(1)\n})\n\n// Dev error mode tests\n\ntest('dev server logs contain import-protection error', async () => {\n  const result = await readResult('error-dev-result.json')\n  const text = stripAnsi(result.combined)\n  expect(text).toContain('[import-protection] Import denied in')\n})\n\ntest('dev error violation mentions environment', async () => {\n  const result = await readResult('error-dev-result.json')\n  const text = stripAnsi(result.combined)\n  const hasClient = text.includes('Import denied in client environment')\n  const hasServer = text.includes('Import denied in server environment')\n  expect(hasClient || hasServer).toBe(true)\n})\n\ntest('dev error violation includes importer and specifier', async () => {\n  const result = await readResult('error-dev-result.json')\n  const text = stripAnsi(result.combined)\n  expect(text).toContain('Importer:')\n  expect(text).toContain('Import:')\n})\n\ntest('dev error violation includes denial reason', async () => {\n  const result = await readResult('error-dev-result.json')\n  const text = stripAnsi(result.combined)\n  const hasFilePattern = text.includes('Denied by file pattern')\n  const hasSpecifierPattern = text.includes('Denied by specifier pattern')\n  const hasMarker = text.includes('Denied by marker')\n  expect(hasFilePattern || hasSpecifierPattern || hasMarker).toBe(true)\n})\n\ntest('dev error violation is parseable', async () => {\n  const result = await readResult('error-dev-result.json')\n  const violations = extractViolationsFromLog(result.combined)\n  expect(violations.length).toBeGreaterThanOrEqual(1)\n\n  const v = violations[0]\n  expect(v.envType).toMatch(/^(client|server)$/)\n  expect(v.importer).toBeTruthy()\n  expect(v.specifier).toBeTruthy()\n  expect(v.type).toMatch(/^(file|specifier|marker)$/)\n  expect(v.trace.length).toBeGreaterThanOrEqual(1)\n})\n"
  },
  {
    "path": "e2e/react-start/import-protection/tests/import-protection.spec.ts",
    "content": "import path from 'node:path'\nimport fs from 'node:fs'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport type { Violation } from './violations.utils'\nimport type { Page } from '@playwright/test'\n\nasync function readViolations(\n  type: 'build' | 'dev' | 'dev.cold' | 'dev.warm',\n): Promise<Array<Violation>> {\n  const filename = `violations.${type}.json`\n  const violationsPath = path.resolve(import.meta.dirname, '..', filename)\n  const mod = await import(violationsPath, {\n    with: { type: 'json' },\n  } as any)\n  return (mod.default ?? []) as Array<Violation>\n}\n\nasync function expectRouteHeading(\n  page: Page,\n  route: string,\n  testId: string,\n  heading: string,\n): Promise<void> {\n  await page.goto(route)\n  await expect(page.getByTestId(testId)).toContainText(heading)\n}\n\nfunction findClientSecretServerFileViolation(\n  violations: Array<Violation>,\n  importerFragment: string,\n  specifierMatches: (specifier: string) => boolean,\n): Violation | undefined {\n  return violations.find(\n    (v) =>\n      v.envType === 'client' &&\n      v.type === 'file' &&\n      v.importer.includes(importerFragment) &&\n      (specifierMatches(v.specifier) ||\n        v.resolved?.includes('violations/secret.server')),\n  )\n}\n\ntest.use({\n  // The mock proxy returns undefined-ish values, which may cause\n  // React rendering warnings — whitelist those\n  whitelistErrors: [/mock/i, /Cannot read properties/i, /undefined/i],\n})\n\ntest.beforeEach(({}, testInfo) => {\n  const baseURL = testInfo.project.use.baseURL\n  if (!baseURL) {\n    throw new Error(\n      'Missing Playwright baseURL for import-protection e2e. Run with `pnpm exec playwright test -c e2e/react-start/import-protection/playwright.config.ts` (or configure `use.baseURL`).',\n    )\n  }\n})\n\ntest('app loads successfully with mock mode', async ({ page }) => {\n  await page.goto('/')\n  await expect(page.getByTestId('heading')).toContainText(\n    'Import Protection E2E',\n  )\n  await expect(page.getByTestId('status')).toContainText(\n    'App loaded successfully with mock mode',\n  )\n})\n\ntest('leaky server import route loads in mock mode', async ({ page }) => {\n  await page.goto('/leaky-server-import')\n  await expect(page.getByTestId('leaky-heading')).toContainText(\n    'Leaky Server Import',\n  )\n})\n\ntest('client-only violations route loads in mock mode', async ({ page }) => {\n  await page.goto('/client-only-violations')\n  await expect(page.getByTestId('client-only-heading')).toContainText(\n    'Client-Only Violations',\n  )\n})\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`violations.${mode}.json is written during ${mode}`, async () => {\n    const violations = await readViolations(mode)\n    expect(violations.length).toBeGreaterThan(0)\n  })\n}\n\ntest('file-based violation: client importing .server. file', async () => {\n  const violations = await readViolations('build')\n\n  // Find violation for the secret.server.ts file\n  const fileViolation = violations.find(\n    (v) =>\n      v.type === 'file' &&\n      v.importer.includes('edge-a') &&\n      (v.specifier.includes('secret.server') ||\n        v.resolved?.includes('secret.server')),\n  )\n\n  expect(fileViolation).toBeDefined()\n  expect(fileViolation!.envType).toBe('client')\n})\n\ntest('marker violation: client importing server-only marked module', async () => {\n  const violations = await readViolations('build')\n\n  // Find the marker violation — it could manifest in two ways:\n  // 1. As a 'marker' type when the marker import is processed\n  // 2. As the resolved file being marked server-only and then imported from client\n  const markerViolation = violations.find(\n    (v) =>\n      v.type === 'marker' &&\n      (v.importer.includes('marked-server-only') ||\n        v.resolved?.includes('marked-server-only') ||\n        v.specifier.includes('server-only')),\n  )\n\n  expect(markerViolation).toBeDefined()\n})\n\ntest('build log does not contain mock-edge missing export warnings', () => {\n  const buildLogPath = path.resolve(\n    import.meta.dirname,\n    '..',\n    'webserver-build.log',\n  )\n\n  if (!fs.existsSync(buildLogPath)) {\n    return\n  }\n\n  const log = fs.readFileSync(buildLogPath, 'utf-8')\n  expect(log).not.toMatch(/not exported by\\s+\"[^\"\\n]*mock:build:/)\n})\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`violations contain trace information in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const fileViolation = violations.find(\n      (v) =>\n        v.type === 'file' &&\n        (v.specifier.includes('secret.server') ||\n          v.resolved?.includes('secret.server')),\n    )\n\n    expect(fileViolation).toBeDefined()\n    expect(fileViolation!.trace).toBeDefined()\n    expect(fileViolation!.trace.length).toBeGreaterThanOrEqual(2)\n  })\n}\n\ntest('deep trace includes full chain', async () => {\n  const violations = await readViolations('build')\n\n  const v = violations.find(\n    (x) => x.type === 'file' && x.importer.includes('edge-3'),\n  )\n\n  expect(v).toBeDefined()\n  const traceText = v!.trace.map((s) => s.file).join(' -> ')\n  expect(traceText).toContain('routes/index')\n  expect(traceText).toContain('violations/edge-1')\n  expect(traceText).toContain('violations/edge-2')\n  expect(traceText).toContain('violations/edge-3')\n})\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`all trace steps include line numbers in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    // Find a violation with a multi-step trace\n    const v = violations.find(\n      (x) =>\n        x.type === 'file' &&\n        x.trace.length >= 3 &&\n        x.trace.some((s) => s.line != null),\n    )\n    expect(v).toBeDefined()\n\n    // Every non-entry trace step should have a line number, except:\n    // - Virtual specifiers (e.g. ?tsr-split=) injected by the router plugin\n    // - routeTree.gen.ts steps (generated code, import locations unreliable)\n    // - Steps immediately after ?tsr-split= (the re-entry from the split chunk)\n    for (let i = 1; i < v!.trace.length; i++) {\n      const step = v!.trace[i]\n      if (step.specifier?.includes('?tsr-split=')) continue\n      if (step.file.includes('routeTree.gen')) continue\n      // In dev mode, the step right after a ?tsr-split= virtual step\n      // re-enters the same file — its import may not be locatable.\n      const prev = v!.trace[i - 1]\n      if (prev?.specifier?.includes('?tsr-split=')) continue\n      if (\n        step.line == null &&\n        step.file.startsWith('src/routes/') &&\n        prev?.file.includes('routeTree.gen')\n      ) {\n        continue\n      }\n\n      expect(\n        step.line,\n        `trace step ${i} (${step.file}) should have a line number`,\n      ).toBeDefined()\n      expect(step.line).toBeGreaterThan(0)\n    }\n  })\n}\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`leaf trace step includes the denied import specifier in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const v = violations.find(\n      (x) =>\n        x.type === 'file' &&\n        x.envType === 'client' &&\n        (x.specifier.includes('secret.server') ||\n          x.resolved?.includes('secret.server')) &&\n        x.trace[x.trace.length - 1]?.line != null,\n    )\n    expect(v).toBeDefined()\n\n    const last = v!.trace[v!.trace.length - 1]\n    expect(last.specifier).toContain('secret.server')\n    expect(last.line).toBeDefined()\n    expect(last.line).toBeGreaterThan(0)\n  })\n}\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`violation includes code snippet showing offending usage in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const v = violations.find(\n      (x) =>\n        x.type === 'file' &&\n        x.envType === 'client' &&\n        (x.specifier.includes('secret.server') ||\n          x.resolved?.includes('secret.server')) &&\n        !!x.snippet,\n    )\n    expect(v).toBeDefined()\n    expect(v!.snippet).toBeDefined()\n    expect(v!.snippet!.lines.length).toBeGreaterThan(0)\n\n    const snippetText = v!.snippet!.lines.join('\\n')\n    expect(snippetText).toContain('getSecret')\n\n    if (v!.snippet!.location) {\n      expect(v!.snippet!.location).toMatch(/:\\d+:\\d+/)\n    }\n  })\n}\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`compiler leak violation includes line/col in importer in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n    const v = violations.find(\n      (x) =>\n        x.importer.includes('compiler-leak') &&\n        x.type === 'file' &&\n        /:\\d+:\\d+$/.test(x.importer),\n    )\n    expect(v).toBeDefined()\n    expect(v!.importer).toMatch(/:\\d+:\\d+$/)\n  })\n}\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`leaky @tanstack/react-start/server import points to usage site in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n    const v = violations.find(\n      (x) =>\n        x.type === 'specifier' &&\n        x.specifier === '@tanstack/react-start/server' &&\n        x.importer.includes('leaky-server-import') &&\n        /:\\d+:\\d+$/.test(x.importer),\n    )\n    expect(v).toBeDefined()\n    expect(v!.importer).toContain('violations/leaky-server-import')\n    expect(v!.importer).toMatch(/:\\d+:\\d+$/)\n  })\n}\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`client-env violations exist in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n    const clientViolations = violations.filter((v) => v.envType === 'client')\n    expect(clientViolations.length).toBeGreaterThanOrEqual(\n      mode === 'build' ? 2 : 1,\n    )\n  })\n}\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`no false positive for boundary-safe pattern in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    // boundary-safe.ts imports secret.server.ts but only uses it inside\n    // compiler boundaries (createServerFn/createServerOnlyFn/createIsomorphicFn).\n    const isBoundarySafe = (s: string) => /(?<![/-])boundary-safe/.test(s)\n    const safeHits = violations.filter(\n      (v) =>\n        v.envType === 'client' &&\n        (isBoundarySafe(v.importer) ||\n          v.trace.some((s) => isBoundarySafe(s.file))),\n    )\n\n    expect(safeHits).toEqual([])\n  })\n}\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`compiler-processed module has code snippet in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    // compiler-leak.ts is processed by the Start compiler (createServerFn),\n    // which shortens the output.  The snippet must still show the original\n    // source lines (mapped via sourcesContent in the compiler's sourcemap).\n    const compilerViolation = violations.find(\n      (v) =>\n        v.envType === 'client' &&\n        v.importer.includes('compiler-leak') &&\n        !!v.snippet,\n    )\n\n    expect(compilerViolation).toBeDefined()\n    expect(compilerViolation!.snippet).toBeDefined()\n    expect(compilerViolation!.snippet!.lines.length).toBeGreaterThan(0)\n\n    const snippetText = compilerViolation!.snippet!.lines.join('\\n')\n    expect(snippetText).toContain('getSecret')\n  })\n}\n\ntest('file-based violation: SSR importing .client. file', async () => {\n  const violations = await readViolations('build')\n\n  const v = violations.find(\n    (x) =>\n      x.type === 'file' &&\n      x.envType === 'server' &&\n      (x.specifier.includes('browser-api.client') ||\n        x.resolved?.includes('browser-api.client')),\n  )\n\n  expect(v).toBeDefined()\n  expect(v!.envType).toBe('server')\n  expect(v!.type).toBe('file')\n\n  // Should have trace info leading back through the route\n  expect(v!.trace.length).toBeGreaterThanOrEqual(2)\n})\n\ntest('marker violation: SSR importing client-only marked module', async () => {\n  const violations = await readViolations('build')\n\n  const v = violations.find(\n    (x) =>\n      x.type === 'marker' &&\n      x.envType === 'server' &&\n      (x.importer.includes('marked-client-only') ||\n        x.specifier.includes('client-only')),\n  )\n\n  expect(v).toBeDefined()\n  expect(v!.envType).toBe('server')\n  expect(v!.type).toBe('marker')\n})\n\ntest('client-only JSX route loads in mock mode', async ({ page }) => {\n  await page.goto('/client-only-jsx')\n  await expect(page.getByTestId('client-only-jsx-heading')).toContainText(\n    'Client-Only JSX',\n  )\n})\n\ntest('file-based violation: SSR importing .client. file with JSX usage', async () => {\n  const violations = await readViolations('build')\n\n  const v = violations.find(\n    (x) =>\n      x.type === 'file' &&\n      x.envType === 'server' &&\n      (x.specifier.includes('window-size.client') ||\n        x.resolved?.includes('window-size.client')),\n  )\n\n  expect(v).toBeDefined()\n  expect(v!.envType).toBe('server')\n  expect(v!.type).toBe('file')\n\n  // The snippet should show the JSX usage site where WindowSize() is called,\n  // not just the import statement.\n  expect(v!.snippet).toBeDefined()\n  expect(v!.snippet!.lines.length).toBeGreaterThan(0)\n\n  const snippetText = v!.snippet!.lines.join('\\n')\n  expect(snippetText).toContain('WindowSize')\n})\n\ntest('build has violations in both client and SSR environments', async () => {\n  const violations = await readViolations('build')\n\n  const clientViolations = violations.filter((v) => v.envType === 'client')\n  const ssrViolations = violations.filter((v) => v.envType === 'server')\n\n  expect(clientViolations.length).toBeGreaterThanOrEqual(2)\n  expect(ssrViolations.length).toBeGreaterThanOrEqual(2)\n})\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`no false positive for factory-safe middleware pattern in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    // createSecretFactory.ts uses @tanstack/react-start/server and ../secret.server\n    // ONLY inside createMiddleware().server() callbacks.  The compiler strips these\n    // on the client, so import-protection must not fire for them.\n    const factoryHits = violations.filter(\n      (v) =>\n        v.envType === 'client' &&\n        (v.importer.includes('createSecretFactory') ||\n          v.importer.includes('factory-safe') ||\n          v.trace.some(\n            (s) =>\n              s.file.includes('createSecretFactory') ||\n              s.file.includes('factory-safe'),\n          )),\n    )\n\n    expect(factoryHits).toEqual([])\n  })\n}\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`no false positive for cross-boundary-safe pattern in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    // session-util.ts imports @tanstack/react-start/server, but it's only ever\n    // imported by usage.ts which uses it exclusively inside compiler boundaries\n    // (createServerFn().handler, createMiddleware().server).  The compiler should\n    // prune the import chain from the client build.\n    const crossHits = violations.filter(\n      (v) =>\n        v.envType === 'client' &&\n        (v.importer.includes('cross-boundary-safe') ||\n          v.importer.includes('session-util') ||\n          v.trace.some(\n            (s) =>\n              s.file.includes('cross-boundary-safe') ||\n              s.file.includes('session-util'),\n          )),\n    )\n\n    expect(crossHits).toEqual([])\n  })\n}\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`cross-boundary-leak: leaky consumer still produces violation in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const leakHits = violations.filter(\n      (v) =>\n        v.envType === 'client' &&\n        (v.importer.includes('cross-boundary-leak') ||\n          v.importer.includes('shared-util') ||\n          v.trace.some(\n            (s) =>\n              s.file.includes('leaky-consumer') ||\n              s.file.includes('shared-util'),\n          )),\n    )\n\n    expect(leakHits.length).toBeGreaterThanOrEqual(1)\n  })\n}\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`beforeload-leak: server import via beforeLoad triggers client violation in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const hits = violations.filter(\n      (v) =>\n        v.envType === 'client' &&\n        (v.importer.includes('beforeload-server-leak') ||\n          v.importer.includes('beforeload-leak') ||\n          v.trace.some(\n            (s) =>\n              s.file.includes('beforeload-server-leak') ||\n              s.file.includes('beforeload-leak'),\n          )),\n    )\n\n    expect(hits.length).toBeGreaterThanOrEqual(1)\n\n    if (mode === 'build') {\n      const specHit = hits.find(\n        (v) =>\n          v.type === 'specifier' &&\n          v.specifier === '@tanstack/react-start/server',\n      )\n      expect(specHit).toBeDefined()\n    }\n  })\n}\n\ntest('beforeload-leak: violation trace includes the route file', async () => {\n  const violations = await readViolations('build')\n\n  const hit = violations.find(\n    (v) =>\n      v.envType === 'client' &&\n      v.type === 'specifier' &&\n      v.specifier === '@tanstack/react-start/server' &&\n      (v.importer.includes('beforeload-server-leak') ||\n        v.trace.some((s) => s.file.includes('beforeload-server-leak'))),\n  )\n\n  expect(hit).toBeDefined()\n  expect(hit!.trace.length).toBeGreaterThanOrEqual(2)\n\n  // The trace should include beforeload-leak route somewhere in the chain\n  const traceFiles = hit!.trace.map((s) => s.file).join(' -> ')\n  expect(traceFiles).toContain('beforeload-leak')\n})\n\n// Warm-start regression tests: second navigation (cached modules) must\n// still produce the same violations as the cold run.\n\ntest('warm run produces violations', async () => {\n  const warm = await readViolations('dev.warm')\n  expect(warm.length).toBeGreaterThan(0)\n})\n\ntest('warm run detects the same unique violations as cold run', async () => {\n  const cold = await readViolations('dev.cold')\n  const warm = await readViolations('dev.warm')\n\n  // Deduplicate by (envType, type, normalizedSpecifier, importer-file).\n  // On warm starts the specifier string may differ from cold starts\n  // (e.g. alias `~/foo` vs resolved relative `src/foo`, or with/without\n  // the `.ts` extension) because different detection code-paths fire.\n  // Normalize to the resolved path (without extension) for a stable key.\n  const normalizeSpec = (v: Violation) =>\n    (v.resolved ?? v.specifier).replace(/\\.[cm]?[tj]sx?$/, '')\n  const uniqueKey = (v: Violation) =>\n    `${v.envType}|${v.type}|${normalizeSpec(v)}|${v.importer.replace(/:.*/, '')}`\n\n  const coldUniq = [...new Set(cold.map(uniqueKey))].sort()\n  const warmUniq = [...new Set(warm.map(uniqueKey))].sort()\n  expect(warmUniq).toEqual(coldUniq)\n})\n\ntest('warm run traces include line numbers', async () => {\n  const warm = await readViolations('dev.warm')\n\n  const v = warm.find(\n    (x) =>\n      x.type === 'file' &&\n      x.trace.length >= 3 &&\n      x.trace.some((s) => s.line != null),\n  )\n  expect(v).toBeDefined()\n\n  for (let i = 1; i < v!.trace.length; i++) {\n    const step = v!.trace[i]\n    if (step.specifier?.includes('?tsr-split=')) continue\n    if (step.file.includes('routeTree.gen')) continue\n    const prev = v!.trace[i - 1]\n    if (prev.specifier?.includes('?tsr-split=')) continue\n    if (\n      step.line == null &&\n      step.file.startsWith('src/routes/') &&\n      prev.file.includes('routeTree.gen')\n    ) {\n      continue\n    }\n\n    expect(\n      step.line,\n      `warm trace step ${i} (${step.file}) should have a line number`,\n    ).toBeDefined()\n    expect(step.line).toBeGreaterThan(0)\n  }\n})\n\n// Regression: SERVER_FN_LOOKUP variant pollution + hasSeenEntry bug.\n//\n// The Start compiler excludes ?server-fn-module-lookup variants from its\n// transform, so they retain the original (untransformed) imports.  If the\n// reachability check considers those untransformed imports, it would see\n// edges the compiler has actually pruned, causing a false positive.\n//\n// Additionally, in Vite dev mode the client entry resolves through virtual\n// modules, so a naïve resolveId-based entry detection may never fire,\n// causing all deferred violations to be confirmed immediately.\n//\n// The cross-boundary-safe pattern exercises both bugs:\n//   auth-wrapper.ts exports createAuthServerFn (factory with middleware)\n//   → session-util.ts wraps @tanstack/react-start/server\n//   → usage.ts calls createAuthServerFn().handler()\n// All server imports are inside compiler boundaries and must be pruned.\n\nfor (const mode of ['dev', 'dev.warm'] as const) {\n  test(`regression: server-fn-lookup variant does not cause false positive in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    // Any violation touching the cross-boundary-safe chain where the importer\n    // or trace includes the ?server-fn-module-lookup query (or its normalized\n    // key) would indicate the lookup variant polluted the reachability check.\n    const lookupHits = violations.filter(\n      (v) =>\n        v.envType === 'client' &&\n        (v.importer.includes('auth-wrapper') ||\n          v.importer.includes('session-util') ||\n          v.importer.includes('cross-boundary-safe') ||\n          v.trace.some(\n            (s) =>\n              s.file.includes('auth-wrapper') ||\n              s.file.includes('session-util') ||\n              s.file.includes('cross-boundary-safe'),\n          )),\n    )\n\n    expect(lookupHits).toEqual([])\n  })\n}\n\n// Component-level server leak: the .server import is used exclusively inside\n// the route component function, which is code-split by the router plugin into\n// a separate lazy chunk.  Import protection must still detect this.\n\ntest('component-server-leak route loads in mock mode', async ({ page }) => {\n  await page.goto('/component-server-leak')\n  await expect(page.getByTestId('component-leak-heading')).toContainText(\n    'Component Server Leak',\n  )\n})\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`component-server-leak: .server import inside code-split component is caught in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const hits = violations.filter(\n      (v) =>\n        v.envType === 'client' &&\n        (v.specifier.includes('db-credentials.server') ||\n          v.resolved?.includes('db-credentials.server') ||\n          v.importer.includes('db-credentials.server') ||\n          v.trace.some(\n            (s) =>\n              s.file.includes('db-credentials.server') ||\n              s.file.includes('component-server-leak'),\n          )),\n    )\n\n    expect(hits.length).toBeGreaterThanOrEqual(1)\n  })\n}\n\n// Barrel re-export false positive: the barrel re-exports from a .server\n// module AND a marker-protected module (foo.ts with `import 'server-only'`),\n// but the component only uses values that would be tree-shaken away\n// (getUsers inside createServerFn) or originate from a safe source, and\n// never imports foo at all. Both the .server module and the marker module\n// should NOT survive tree-shaking in the client bundle, so import-protection\n// must NOT flag violations for either in build mode.\n// In dev mode there is no tree-shaking so the violation is expected (mock).\n\ntest('barrel-false-positive route loads in mock mode', async ({ page }) => {\n  await page.goto('/barrel-false-positive')\n  await expect(page.getByTestId('barrel-heading')).toContainText(\n    'Barrel False Positive',\n  )\n})\n\ntest('no false positive for barrel-reexport .server pattern in build', async () => {\n  const violations = await readViolations('build')\n\n  const barrelHits = violations.filter(\n    (v) =>\n      v.envType === 'client' &&\n      (v.importer.includes('barrel-reexport') ||\n        v.importer.includes('barrel-false-positive') ||\n        v.specifier.includes('db.server') ||\n        v.resolved?.includes('barrel-reexport') ||\n        v.trace.some(\n          (s) =>\n            s.file.includes('barrel-reexport') ||\n            s.file.includes('barrel-false-positive'),\n        )),\n  )\n\n  expect(barrelHits).toEqual([])\n})\n\ntest('no false positive for barrel-reexport marker pattern in build', async () => {\n  const violations = await readViolations('build')\n\n  // foo.ts uses `import '@tanstack/react-start/server-only'` marker and is\n  // re-exported through the barrel, but never imported by the route.\n  // Tree-shaking should eliminate it — no marker violation should fire.\n  const markerHits = violations.filter(\n    (v) =>\n      v.envType === 'client' &&\n      (v.specifier.includes('server-only') ||\n        v.specifier.includes('foo') ||\n        v.resolved?.includes('foo')) &&\n      v.trace.some(\n        (s) =>\n          s.file.includes('barrel-reexport') ||\n          s.file.includes('barrel-false-positive'),\n      ),\n  )\n\n  expect(markerHits).toEqual([])\n})\n\n// noExternal .client package false positive: react-tweet's package.json\n// exports resolve to `index.client.js` via the \"default\" condition.\n// When listed in ssr.noExternal, Vite bundles it and the resolved path\n// contains `.client.`, matching the default **/*.client.* deny pattern.\n// Import-protection must NOT flag node_modules paths with file-based\n// deny rules — these are third-party conventions, not user source code.\n\ntest('noexternal-client-pkg route loads in mock mode', async ({ page }) => {\n  await page.goto('/noexternal-client-pkg')\n  await expect(page.getByTestId('noexternal-heading')).toContainText(\n    'noExternal .client Package',\n  )\n})\n\ntest('alias-path-leak route loads in mock mode', async ({ page }) => {\n  await expectRouteHeading(\n    page,\n    '/alias-path-leak',\n    'alias-path-leak-heading',\n    'Alias Path Leak',\n  )\n})\n\ntest('alias-path-leak renders real secret in SSR HTML', async ({ page }) => {\n  const response = await page.request.get('/alias-path-leak')\n  expect(response.ok()).toBe(true)\n\n  const html = await response.text()\n  expect(html).toContain('data-testid=\"alias-path-secret\"')\n  expect(html).toContain('super-secret-server-key-12345')\n})\n\ntest('alias-path-leak does not expose real secret after hydration', async ({\n  page,\n}) => {\n  await page.goto('/alias-path-leak')\n  await expect(page.getByTestId('alias-path-secret-hydration')).toContainText(\n    'hydrated',\n  )\n\n  await expect(page.getByTestId('alias-path-secret-client')).not.toContainText(\n    'super-secret-server-key-12345',\n  )\n})\n\ntest('alias-path-namespace-leak route loads in mock mode', async ({ page }) => {\n  await expectRouteHeading(\n    page,\n    '/alias-path-namespace-leak',\n    'alias-path-namespace-leak-heading',\n    'Alias Path Namespace Leak',\n  )\n})\n\ntest('alias-path-namespace-leak renders real secret in SSR HTML', async ({\n  page,\n}) => {\n  const response = await page.request.get('/alias-path-namespace-leak')\n  expect(response.ok()).toBe(true)\n\n  const html = await response.text()\n  expect(html).toContain('data-testid=\"alias-path-namespace-leak-secret\"')\n  expect(html).toContain('super-secret-server-key-12345')\n})\n\ntest('alias-path-namespace-leak does not expose real secret after hydration', async ({\n  page,\n}) => {\n  await page.goto('/alias-path-namespace-leak')\n  await expect(\n    page.getByTestId('alias-path-namespace-leak-secret-hydration'),\n  ).toContainText('hydrated')\n\n  await expect(\n    page.getByTestId('alias-path-namespace-leak-secret-client'),\n  ).not.toContainText('super-secret-server-key-12345')\n})\n\ntest('non-alias-namespace-leak route loads in mock mode', async ({ page }) => {\n  await expectRouteHeading(\n    page,\n    '/non-alias-namespace-leak',\n    'non-alias-namespace-leak-heading',\n    'Non-Alias Namespace Leak',\n  )\n})\n\ntest('non-alias-namespace-leak renders real secret in SSR HTML', async ({\n  page,\n}) => {\n  const response = await page.request.get('/non-alias-namespace-leak')\n  expect(response.ok()).toBe(true)\n\n  const html = await response.text()\n  expect(html).toContain('data-testid=\"non-alias-namespace-leak-secret\"')\n  expect(html).toContain('super-secret-server-key-12345')\n})\n\ntest('non-alias-namespace-leak does not expose real secret after hydration', async ({\n  page,\n}) => {\n  await page.goto('/non-alias-namespace-leak')\n  await expect(\n    page.getByTestId('non-alias-namespace-leak-secret-hydration'),\n  ).toContainText('hydrated')\n\n  await expect(\n    page.getByTestId('non-alias-namespace-leak-secret-client'),\n  ).not.toContainText('super-secret-server-key-12345')\n})\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`no false positive for noExternal react-tweet (.client entry) in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const hits = violations.filter(\n      (v) =>\n        v.specifier.includes('react-tweet') ||\n        v.resolved?.includes('react-tweet') ||\n        v.importer.includes('noexternal-client-pkg'),\n    )\n\n    expect(hits).toEqual([])\n  })\n}\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`alias path mapping does not bypass .server file denial in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const hit = findClientSecretServerFileViolation(\n      violations,\n      'alias-path-leak',\n      (specifier) => specifier.includes('violations/secret.server'),\n    )\n\n    expect(hit).toBeDefined()\n  })\n}\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`alias path .server imports are not denied in server env in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const serverAliasHits = violations.filter(\n      (v) =>\n        v.envType === 'server' &&\n        (v.type === 'file' || v.type === 'marker' || v.type === 'specifier') &&\n        (v.importer.includes('alias-path-leak') ||\n          v.importer.includes('alias-path-namespace-leak')) &&\n        (v.specifier.includes('secret.server') ||\n          v.resolved?.includes('secret.server')),\n    )\n\n    expect(serverAliasHits).toEqual([])\n  })\n}\n\nfor (const mode of ['build', 'dev'] as const) {\n  test(`alias path namespace import does not bypass .server file denial in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const hit = findClientSecretServerFileViolation(\n      violations,\n      'alias-path-namespace-leak',\n      (specifier) => specifier === '~/violations/secret.server',\n    )\n\n    expect(hit).toBeDefined()\n  })\n}\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`alias routes both emit client file violations in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const aliasImporters = new Set(\n      violations\n        .filter(\n          (v) =>\n            v.envType === 'client' &&\n            v.type === 'file' &&\n            (v.specifier.includes('secret.server') ||\n              v.resolved?.includes('secret.server')) &&\n            (v.importer.includes('alias-path-leak') ||\n              v.importer.includes('alias-path-namespace-leak')),\n        )\n        .map((v) =>\n          v.importer.includes('alias-path-namespace-leak')\n            ? 'alias-path-namespace-leak'\n            : 'alias-path-leak',\n        ),\n    )\n\n    expect(aliasImporters).toEqual(\n      new Set(['alias-path-leak', 'alias-path-namespace-leak']),\n    )\n  })\n}\n\nfor (const mode of ['build', 'dev', 'dev.warm'] as const) {\n  test(`namespace import without path alias is denied in ${mode}`, async () => {\n    const violations = await readViolations(mode)\n\n    const hit = findClientSecretServerFileViolation(\n      violations,\n      'non-alias-namespace-leak',\n      (specifier) => specifier.includes('../violations/secret.server'),\n    )\n\n    expect(hit).toBeDefined()\n  })\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/tests/utils/isErrorMode.ts",
    "content": "export const isErrorMode: boolean = process.env.BEHAVIOR === 'error'\n"
  },
  {
    "path": "e2e/react-start/import-protection/tests/violations.setup.ts",
    "content": "import fs from 'node:fs'\nimport path from 'node:path'\nimport { spawn } from 'node:child_process'\nimport { chromium } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\nimport { extractViolationsFromLog } from './violations.utils'\nimport type { FullConfig } from '@playwright/test'\nimport type { Violation } from './violations.utils'\n\nasync function waitForHttpOk(url: string, timeoutMs: number): Promise<void> {\n  const start = Date.now()\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  while (true) {\n    if (Date.now() - start > timeoutMs) {\n      throw new Error(`Timed out waiting for ${url}`)\n    }\n\n    try {\n      const res = await fetch(url, {\n        signal: AbortSignal.timeout(1000),\n      })\n      if (res.ok) return\n    } catch {\n      // ignore\n    }\n\n    await new Promise((r) => setTimeout(r, 200))\n  }\n}\n\nfunction startDevServer(cwd: string, port: number): ReturnType<typeof spawn> {\n  return spawn('pnpm', ['exec', 'vite', 'dev', '--port', String(port)], {\n    cwd,\n    env: {\n      ...process.env,\n      PORT: String(port),\n      VITE_SERVER_PORT: String(port),\n      VITE_NODE_ENV: 'test',\n    },\n    stdio: ['ignore', 'pipe', 'pipe'],\n  })\n}\n\nasync function killChild(child: ReturnType<typeof spawn>): Promise<void> {\n  if (child.exitCode !== null || child.killed) return\n  await new Promise<void>((resolve) => {\n    let resolved = false\n    const done = () => {\n      if (resolved) return\n      resolved = true\n      resolve()\n    }\n    child.once('exit', done)\n    child.once('error', done)\n    try {\n      child.kill('SIGTERM')\n    } catch {\n      done()\n      return\n    }\n    setTimeout(() => {\n      try {\n        child.kill('SIGKILL')\n      } catch {\n        // ignore\n      }\n      // Resolve after a grace period even if 'exit' never fires.\n      setTimeout(done, 500)\n    }, 3000)\n  })\n}\n\nconst routeDefinitions = [\n  ['/', 'heading'],\n  ['/leaky-server-import', 'leaky-heading'],\n  ['/client-only-violations', 'client-only-heading'],\n  ['/client-only-jsx', 'client-only-jsx-heading'],\n  ['/beforeload-leak', 'beforeload-leak-heading'],\n  ['/component-server-leak', 'component-leak-heading'],\n  ['/barrel-false-positive', 'barrel-heading'],\n  ['/alias-path-leak', 'alias-path-leak-heading'],\n  ['/alias-path-namespace-leak', 'alias-path-namespace-leak-heading'],\n  ['/non-alias-namespace-leak', 'non-alias-namespace-leak-heading'],\n] as const\n\nconst routes = routeDefinitions.map(([route]) => route)\n\nconst routeReadyTestIds: Record<string, string> =\n  Object.fromEntries(routeDefinitions)\n\nasync function navigateAllRoutes(\n  baseURL: string,\n  browser: Awaited<ReturnType<typeof chromium.launch>>,\n): Promise<void> {\n  const context = await browser.newContext()\n  const page = await context.newPage()\n\n  for (const route of routes) {\n    try {\n      // Prefer 'networkidle' (ensures route chunks are actually fetched), but\n      // fall back if it hangs in certain CI environments.\n      try {\n        await page.goto(`${baseURL}${route}`, {\n          waitUntil: 'networkidle',\n          timeout: 15_000,\n        })\n      } catch {\n        await page.goto(`${baseURL}${route}`, {\n          waitUntil: 'load',\n          timeout: 30_000,\n        })\n      }\n\n      const testId = routeReadyTestIds[route]\n      if (testId) {\n        await page.getByTestId(testId).waitFor({ timeout: 10_000 })\n      }\n    } catch {\n      // ignore navigation errors — we only care about server logs\n    } finally {\n      // Allow deferred transforms/logging to flush even when navigation fails.\n      await new Promise((r) => setTimeout(r, 750))\n    }\n  }\n\n  await context.close()\n}\n\n/**\n * Starts a dev server, navigates all routes, captures violations.\n * Returns the extracted violations array.\n */\nasync function runDevPass(\n  cwd: string,\n  port: number,\n): Promise<Array<Violation>> {\n  const baseURL = `http://localhost:${port}`\n  const logChunks: Array<string> = []\n  const child = startDevServer(cwd, port)\n\n  child.stdout?.on('data', (d: Buffer) => logChunks.push(d.toString()))\n  child.stderr?.on('data', (d: Buffer) => logChunks.push(d.toString()))\n\n  try {\n    await waitForHttpOk(baseURL, 30_000)\n\n    const browser = await chromium.launch()\n    try {\n      await navigateAllRoutes(baseURL, browser)\n    } finally {\n      await browser.close()\n    }\n\n    await new Promise((r) => setTimeout(r, 750))\n  } finally {\n    await killChild(child)\n  }\n\n  const text = logChunks.join('')\n  return extractViolationsFromLog(text)\n}\n\n/**\n * Captures dev violations in two passes:\n *   1. Cold — fresh dev server, Vite compiles all modules from scratch.\n *   2. Warm — restart dev server (Vite's .vite cache persists on disk),\n *      modules are pre-transformed so resolveId/transform paths differ.\n */\nasync function captureDevViolations(cwd: string): Promise<void> {\n  const port = await getTestServerPort(`${packageJson.name}_dev`)\n\n  const coldViolations = await runDevPass(cwd, port)\n\n  fs.writeFileSync(\n    path.resolve(cwd, 'violations.dev.json'),\n    JSON.stringify(coldViolations, null, 2),\n  )\n  fs.writeFileSync(\n    path.resolve(cwd, 'violations.dev.cold.json'),\n    JSON.stringify(coldViolations, null, 2),\n  )\n\n  // Warm pass: the .vite cache from the cold run is still on disk.\n  const warmViolations = await runDevPass(cwd, port)\n\n  fs.writeFileSync(\n    path.resolve(cwd, 'violations.dev.warm.json'),\n    JSON.stringify(warmViolations, null, 2),\n  )\n}\n\nexport default async function globalSetup(config: FullConfig) {\n  void config\n  // This file lives in ./tests; fixture root is one directory up.\n  const cwd = path.resolve(import.meta.dirname, '..')\n\n  // webServer.command writes build output to this file.\n  const logFile = path.resolve(cwd, 'webserver-build.log')\n\n  if (!fs.existsSync(logFile)) {\n    // If the log doesn't exist, leave an empty violations file.\n    fs.writeFileSync(path.resolve(cwd, 'violations.build.json'), '[]')\n    return\n  }\n\n  const text = fs.readFileSync(logFile, 'utf-8')\n  const violations = extractViolationsFromLog(text)\n  fs.writeFileSync(\n    path.resolve(cwd, 'violations.build.json'),\n    JSON.stringify(violations, null, 2),\n  )\n\n  await captureDevViolations(cwd)\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/tests/violations.utils.ts",
    "content": "export type TraceStep = {\n  file: string\n  specifier?: string\n  line?: number\n  column?: number\n}\n\nexport type CodeSnippet = {\n  lines: Array<string>\n  location?: string\n}\n\nexport type Violation = {\n  envType?: string\n  type: string\n  specifier: string\n  importer: string\n  resolved?: string\n  trace: Array<TraceStep>\n  snippet?: CodeSnippet\n  message?: string\n}\n\nexport function stripAnsi(input: string): string {\n  // eslint-disable-next-line no-control-regex\n  return input.replace(/\\u001b\\[[0-9;]*m/g, '')\n}\n\nexport function extractViolationsFromLog(text: string): Array<Violation> {\n  const out: Array<Violation> = []\n  const lines = stripAnsi(text).split(/\\r?\\n/)\n\n  for (let i = 0; i < lines.length; i++) {\n    const line = lines[i] ?? ''\n    if (!line.includes('[import-protection] Import denied in')) continue\n\n    const envTypeMatch = line.match(\n      /Import denied in\\s+(client|server)\\s+environment/,\n    )\n    const envType = envTypeMatch?.[1]\n\n    const block: Array<string> = [line]\n    for (let j = i + 1; j < Math.min(lines.length, i + 200); j++) {\n      const l = lines[j] ?? ''\n      if (l.includes('[import-protection] Import denied in') && j !== i + 1) {\n        break\n      }\n      block.push(l)\n    }\n\n    const importerLine = block.find((b) =>\n      b.trimStart().startsWith('Importer:'),\n    )\n    const specLine = block.find((b) => b.trimStart().startsWith('Import:'))\n    const resolvedLine = block.find((b) =>\n      b.trimStart().startsWith('Resolved:'),\n    )\n\n    const importer = importerLine\n      ? importerLine.split('Importer:')[1]!.trim()\n      : ''\n    const specifier = specLine\n      ? specLine.split('Import:')[1]!.trim().replace(/^\"|\"$/g, '')\n      : ''\n    const resolved = resolvedLine\n      ? resolvedLine.split('Resolved:')[1]!.trim()\n      : undefined\n\n    const typeLine = block.find((b) => b.trimStart().startsWith('Denied by'))\n    const type = typeLine?.includes('marker')\n      ? 'marker'\n      : typeLine?.includes('specifier')\n        ? 'specifier'\n        : typeLine?.includes('file')\n          ? 'file'\n          : 'unknown'\n\n    const trace: Array<TraceStep> = []\n    const traceStart = block.findIndex((b) => b.trim() === 'Trace:')\n    if (traceStart !== -1) {\n      for (let k = traceStart + 1; k < block.length; k++) {\n        const l = block[k] ?? ''\n        const m = l.match(\n          /^\\s*\\d+\\.\\s+(.*?)(?:\\s+\\(entry\\))?\\s*(?:\\(import \"(.*)\"\\))?\\s*$/,\n        )\n        if (m) {\n          const rawFile = m[1]!.trim()\n          const spec = m[2]?.trim()\n\n          const locMatch = rawFile.match(/^(.*?):(\\d+):(\\d+)$/)\n          if (locMatch) {\n            trace.push({\n              file: locMatch[1]!,\n              line: Number(locMatch[2]),\n              column: Number(locMatch[3]),\n              specifier: spec,\n            })\n          } else {\n            trace.push({ file: rawFile, specifier: spec })\n          }\n          continue\n        }\n        if (l.trim() === '') {\n          if (trace.length) break\n        }\n      }\n    }\n\n    // Parse Code: snippet block\n    let snippet: CodeSnippet | undefined\n    const codeStart = block.findIndex((b) => b.trim() === 'Code:')\n    if (codeStart !== -1) {\n      const snippetLines: Array<string> = []\n      let location: string | undefined\n      for (let k = codeStart + 1; k < block.length; k++) {\n        const l = block[k] ?? ''\n        // Snippet lines start with \">  \" or \"   \" (marker + gutter + pipe)\n        if (/^\\s*[> ]\\s*\\d+\\s*\\|/.test(l) || /^\\s+\\|/.test(l)) {\n          snippetLines.push(l)\n          continue\n        }\n        // The clickable location line follows the snippet (after an empty line)\n        const locLine = l.trim()\n        if (\n          locLine &&\n          !locLine.startsWith('Suggestion') &&\n          snippetLines.length > 0\n        ) {\n          // Check if it looks like a file:line:col reference\n          if (/:\\d+:\\d+/.test(locLine)) {\n            location = locLine\n          }\n          break\n        }\n        if (l.trim() === '' && snippetLines.length > 0) {\n          continue\n        }\n        if (l.trim() === '') continue\n        break\n      }\n      if (snippetLines.length > 0) {\n        snippet = { lines: snippetLines, location }\n      }\n    }\n\n    out.push({\n      envType,\n      type,\n      specifier,\n      importer,\n      resolved,\n      trace,\n      snippet,\n      message: block.join('\\n'),\n    })\n  }\n\n  return out\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection/vite.config.ts",
    "content": "import path from 'node:path'\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\n// Allow env var to override the import protection behavior.\n// Default: 'mock' (build completes, violations logged as warnings).\n// Set BEHAVIOR=error to test that the build fails on violations.\nconst behavior = (process.env.BEHAVIOR ?? 'mock') as 'mock' | 'error'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tanstackStart({\n      importProtection: {\n        behavior,\n        log: 'always',\n        // Tests capture structured violations by overriding this hook.\n        // If unset, we avoid generating any violations*.json files.\n        onViolation: (info) => {\n          void info\n        },\n      },\n    }),\n  ],\n  // react-tweet's package.json exports resolve to `index.client.js` which\n  // matches the default **/*.client.* deny pattern.  Bundling it via\n  // noExternal must NOT trigger a false-positive import-protection violation.\n  ssr: {\n    noExternal: ['react-tweet'],\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/dist/\n*.log\nviolations.*.json\nerror-build-result.json\nerror-dev-result.json\n# The root .gitignore ignores `lib` globally (build output).\n# Override here so src/lib/ test fixtures are tracked.\n!src/lib/\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-import-protection-custom-config\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e:mockMode\": \"rm -rf port*.txt; playwright test --project=chromium\",\n    \"test:e2e:errorMode\": \"rm -rf port*.txt; BEHAVIOR=error playwright test --project=chromium\",\n    \"test:e2e\": \"pnpm run test:e2e:mockMode && pnpm run test:e2e:errorMode\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport { isErrorMode } from './tests/utils/isErrorMode'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\nconsole.log('running in error mode:', isErrorMode.toString())\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  globalSetup: isErrorMode\n    ? './tests/error-mode.setup.ts'\n    : './tests/violations.setup.ts',\n\n  reporter: [['line']],\n\n  use: {\n    baseURL,\n  },\n\n  ...(isErrorMode\n    ? {}\n    : {\n        webServer: {\n          command: `rm -f webserver-build.log violations.build.json violations.dev.json && VITE_SERVER_PORT=${PORT} pnpm build > webserver-build.log 2>&1 && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n          url: baseURL,\n          reuseExistingServer: !process.env.CI,\n          stdout: 'pipe',\n          cwd: import.meta.dirname,\n        },\n      }),\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n      testMatch: isErrorMode ? 'error-mode.spec.ts' : 'custom-config.spec.ts',\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as FrontendLeakRouteImport } from './routes/frontend-leak'\nimport { Route as BackendLeakRouteImport } from './routes/backend-leak'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst FrontendLeakRoute = FrontendLeakRouteImport.update({\n  id: '/frontend-leak',\n  path: '/frontend-leak',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BackendLeakRoute = BackendLeakRouteImport.update({\n  id: '/backend-leak',\n  path: '/backend-leak',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/backend-leak': typeof BackendLeakRoute\n  '/frontend-leak': typeof FrontendLeakRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/backend-leak': typeof BackendLeakRoute\n  '/frontend-leak': typeof FrontendLeakRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/backend-leak': typeof BackendLeakRoute\n  '/frontend-leak': typeof FrontendLeakRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/backend-leak' | '/frontend-leak'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/backend-leak' | '/frontend-leak'\n  id: '__root__' | '/' | '/backend-leak' | '/frontend-leak'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  BackendLeakRoute: typeof BackendLeakRoute\n  FrontendLeakRoute: typeof FrontendLeakRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/frontend-leak': {\n      id: '/frontend-leak'\n      path: '/frontend-leak'\n      fullPath: '/frontend-leak'\n      preLoaderRoute: typeof FrontendLeakRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/backend-leak': {\n      id: '/backend-leak'\n      path: '/backend-leak'\n      fullPath: '/backend-leak'\n      preLoaderRoute: typeof BackendLeakRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  BackendLeakRoute: BackendLeakRoute,\n  FrontendLeakRoute: FrontendLeakRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/src/routes/__root.tsx",
    "content": "import {\n  createRootRoute,\n  HeadContent,\n  Link,\n  linkOptions,\n  Outlet,\n  Scripts,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { title: 'Import Protection Custom Config E2E' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nconst navLinks = linkOptions([\n  { to: '/', label: 'Home' },\n  { to: '/backend-leak', label: 'Backend Leak' },\n  { to: '/frontend-leak', label: 'Frontend Leak' },\n])\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <nav>\n          {navLinks.map((link, index) => (\n            <span key={link.to}>\n              {index > 0 ? ' | ' : null}\n              <Link to={link.to}>{link.label}</Link>\n            </span>\n          ))}\n        </nav>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/src/routes/backend-leak.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// This import triggers a file-based violation in the CLIENT env:\n//   backend-leak.tsx -> lib/credentials.backend.ts\n// The custom deny pattern `**/*.backend.*` should catch this.\nimport { getBackendSecret } from '../lib/credentials.backend'\n\nexport const Route = createFileRoute('/backend-leak')({\n  component: BackendLeakRoute,\n})\n\nfunction BackendLeakRoute() {\n  return (\n    <div>\n      <h1 data-testid=\"backend-leak-heading\">Backend Leak</h1>\n      <p data-testid=\"backend-leak-result\">{String(getBackendSecret())}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/src/routes/frontend-leak.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// This import triggers a file-based violation in the SERVER (SSR) env:\n//   frontend-leak.tsx -> lib/browser-api.frontend.ts\n// The custom deny pattern `**/*.frontend.*` should catch this.\nimport { getBrowserInfo } from '../lib/browser-api.frontend'\n\nexport const Route = createFileRoute('/frontend-leak')({\n  component: FrontendLeakRoute,\n})\n\nfunction FrontendLeakRoute() {\n  return (\n    <div>\n      <h1 data-testid=\"frontend-leak-heading\">Frontend Leak</h1>\n      <p data-testid=\"frontend-leak-result\">{String(getBrowserInfo())}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div>\n      <h1 data-testid=\"heading\">Import Protection Custom Config E2E</h1>\n      <p data-testid=\"status\">\n        App loaded successfully with custom file patterns\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/tests/custom-config.spec.ts",
    "content": "import path from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport type { Violation } from './violations.utils'\n\nasync function readViolations(\n  type: 'build' | 'dev',\n): Promise<Array<Violation>> {\n  const filename = `violations.${type}.json`\n  const violationsPath = path.resolve(import.meta.dirname, '..', filename)\n  const mod = await import(violationsPath, {\n    with: { type: 'json' },\n  } as any)\n  return (mod.default ?? []) as Array<Violation>\n}\n\ntest.use({\n  whitelistErrors: [/mock/i, /Cannot read properties/i, /undefined/i],\n})\n\n// -----------------------------------------------------------------------\n// App loads\n// -----------------------------------------------------------------------\n\ntest('app loads successfully with custom config mock mode', async ({\n  page,\n}) => {\n  await page.goto('/')\n  await expect(page.getByTestId('heading')).toContainText(\n    'Import Protection Custom Config E2E',\n  )\n  await expect(page.getByTestId('status')).toContainText(\n    'App loaded successfully with custom file patterns',\n  )\n})\n\ntest('backend leak route loads in mock mode', async ({ page }) => {\n  await page.goto('/backend-leak')\n  await expect(page.getByTestId('backend-leak-heading')).toContainText(\n    'Backend Leak',\n  )\n})\n\ntest('frontend leak route loads in mock mode', async ({ page }) => {\n  await page.goto('/frontend-leak')\n  await expect(page.getByTestId('frontend-leak-heading')).toContainText(\n    'Frontend Leak',\n  )\n})\n\n// -----------------------------------------------------------------------\n// Build violations\n// -----------------------------------------------------------------------\n\ntest('violations.build.json is written', async () => {\n  const violations = await readViolations('build')\n  expect(violations.length).toBeGreaterThan(0)\n})\n\ntest('build: client violation for .backend. file (custom pattern)', async () => {\n  const violations = await readViolations('build')\n\n  const backendViolation = violations.find(\n    (v) =>\n      v.envType === 'client' &&\n      v.type === 'file' &&\n      (v.specifier.includes('credentials.backend') ||\n        v.resolved?.includes('credentials.backend')),\n  )\n\n  expect(backendViolation).toBeDefined()\n  expect(backendViolation!.envType).toBe('client')\n})\n\ntest('build: server violation for .frontend. file (custom pattern)', async () => {\n  const violations = await readViolations('build')\n\n  const frontendViolation = violations.find(\n    (v) =>\n      v.envType === 'server' &&\n      v.type === 'file' &&\n      (v.specifier.includes('browser-api.frontend') ||\n        v.resolved?.includes('browser-api.frontend')),\n  )\n\n  expect(frontendViolation).toBeDefined()\n  expect(frontendViolation!.envType).toBe('server')\n})\n\ntest('build: no false positives for default .server./.client. patterns', async () => {\n  const violations = await readViolations('build')\n\n  // Since we use custom patterns, .server. and .client. should NOT trigger\n  // violations (they are not in the deny lists).\n  const defaultPatternViolation = violations.find(\n    (v) =>\n      v.type === 'file' &&\n      (v.resolved?.includes('.server.') || v.resolved?.includes('.client.')),\n  )\n\n  expect(defaultPatternViolation).toBeUndefined()\n})\n\n// -----------------------------------------------------------------------\n// Build: mock integrity (no real secrets in client JS bundle)\n// -----------------------------------------------------------------------\n\ntest('build: client JS bundle does not contain real backend secret', async () => {\n  // Read all client JS chunks and verify the real secret string is absent.\n  // (The SSR-rendered HTML may contain the real value because the server env\n  // is allowed to use .backend. files — we only check the client JS here.)\n  const fs = await import('node:fs')\n  const path = await import('node:path')\n  const clientDir = path.resolve(\n    import.meta.dirname,\n    '..',\n    'dist',\n    'client',\n    'assets',\n  )\n  const jsFiles = fs.readdirSync(clientDir).filter((f) => f.endsWith('.js'))\n  const allClientCode = jsFiles\n    .map((f) => fs.readFileSync(path.join(clientDir, f), 'utf-8'))\n    .join('\\n')\n\n  expect(allClientCode).not.toContain('custom-backend-secret-99999')\n})\n\n// -----------------------------------------------------------------------\n// Dev violations\n// -----------------------------------------------------------------------\n\ntest('violations.dev.json is written', async () => {\n  const violations = await readViolations('dev')\n  expect(violations.length).toBeGreaterThan(0)\n})\n\ntest('dev: client violation for .backend. file (custom pattern)', async () => {\n  const violations = await readViolations('dev')\n\n  const backendViolation = violations.find(\n    (v) =>\n      v.envType === 'client' &&\n      v.type === 'file' &&\n      (v.specifier.includes('credentials.backend') ||\n        v.resolved?.includes('credentials.backend')),\n  )\n\n  expect(backendViolation).toBeDefined()\n  expect(backendViolation!.envType).toBe('client')\n})\n\ntest('dev: server violation for .frontend. file (custom pattern)', async () => {\n  const violations = await readViolations('dev')\n\n  const frontendViolation = violations.find(\n    (v) =>\n      v.envType === 'server' &&\n      v.type === 'file' &&\n      (v.specifier.includes('browser-api.frontend') ||\n        v.resolved?.includes('browser-api.frontend')),\n  )\n\n  expect(frontendViolation).toBeDefined()\n  expect(frontendViolation!.envType).toBe('server')\n})\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/tests/error-mode.setup.ts",
    "content": "import fs from 'node:fs'\nimport path from 'node:path'\nimport { execSync, spawn } from 'node:child_process'\nimport { chromium } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\nimport type { FullConfig } from '@playwright/test'\n\nasync function waitForHttpOk(url: string, timeoutMs: number): Promise<void> {\n  const start = Date.now()\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  while (true) {\n    if (Date.now() - start > timeoutMs) {\n      throw new Error(`Timed out waiting for ${url}`)\n    }\n    try {\n      const res = await fetch(url, { signal: AbortSignal.timeout(1000) })\n      if (res.ok) return\n    } catch {\n      // ignore\n    }\n    await new Promise((r) => setTimeout(r, 200))\n  }\n}\n\nasync function killChild(child: ReturnType<typeof spawn>): Promise<void> {\n  if (child.exitCode !== null || child.killed) return\n  await new Promise<void>((resolve) => {\n    let resolved = false\n    const done = () => {\n      if (resolved) return\n      resolved = true\n      resolve()\n    }\n    child.once('exit', done)\n    child.once('error', done)\n    try {\n      child.kill('SIGTERM')\n    } catch {\n      done()\n      return\n    }\n    setTimeout(() => {\n      try {\n        child.kill('SIGKILL')\n      } catch {\n        // ignore\n      }\n      setTimeout(done, 500)\n    }, 3000)\n  })\n}\n\nfunction captureBuild(cwd: string): void {\n  const outFile = path.resolve(cwd, 'error-build-result.json')\n  for (const f of ['error-build-result.json', 'error-build.log']) {\n    const p = path.resolve(cwd, f)\n    if (fs.existsSync(p)) fs.unlinkSync(p)\n  }\n\n  let stdout = ''\n  let stderr = ''\n  let exitCode = 0\n\n  try {\n    const output = execSync('pnpm build', {\n      cwd,\n      env: { ...process.env, BEHAVIOR: 'error' },\n      timeout: 120_000,\n      maxBuffer: 50 * 1024 * 1024,\n    })\n    stdout = output.toString()\n  } catch (err: any) {\n    exitCode = err.status ?? 1\n    stdout = err.stdout?.toString() ?? ''\n    stderr = err.stderr?.toString() ?? ''\n  }\n\n  const combined = stdout + '\\n' + stderr\n  fs.writeFileSync(\n    outFile,\n    JSON.stringify({ exitCode, stdout, stderr, combined }, null, 2),\n  )\n}\n\nasync function captureDevErrors(cwd: string): Promise<void> {\n  const port = await getTestServerPort(`${packageJson.name}_error_dev`)\n  const baseURL = `http://localhost:${port}`\n  const logChunks: Array<string> = []\n\n  const child = spawn('pnpm', ['exec', 'vite', 'dev', '--port', String(port)], {\n    cwd,\n    env: {\n      ...process.env,\n      PORT: String(port),\n      VITE_SERVER_PORT: String(port),\n      BEHAVIOR: 'error',\n    },\n    stdio: ['ignore', 'pipe', 'pipe'],\n  })\n\n  child.stdout?.on('data', (d: Buffer) => logChunks.push(d.toString()))\n  child.stderr?.on('data', (d: Buffer) => logChunks.push(d.toString()))\n\n  try {\n    await waitForHttpOk(baseURL, 30_000)\n\n    const browser = await chromium.launch()\n    try {\n      const context = await browser.newContext()\n      const page = await context.newPage()\n      for (const route of ['/', '/backend-leak', '/frontend-leak']) {\n        try {\n          await page.goto(`${baseURL}${route}`, {\n            waitUntil: 'load',\n            timeout: 15_000,\n          })\n        } catch {\n          // ignore\n        }\n        await new Promise((r) => setTimeout(r, 750))\n      }\n      await context.close()\n    } finally {\n      await browser.close()\n    }\n\n    await new Promise((r) => setTimeout(r, 750))\n  } finally {\n    await killChild(child)\n  }\n\n  const combined = logChunks.join('')\n  fs.writeFileSync(\n    path.resolve(cwd, 'error-dev-result.json'),\n    JSON.stringify(\n      { exitCode: 0, stdout: combined, stderr: '', combined },\n      null,\n      2,\n    ),\n  )\n}\n\nexport default async function globalSetup(config: FullConfig) {\n  void config\n  const cwd = path.resolve(import.meta.dirname, '..')\n\n  captureBuild(cwd)\n  await captureDevErrors(cwd)\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/tests/error-mode.spec.ts",
    "content": "import path from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\nimport { extractViolationsFromLog, stripAnsi } from './violations.utils'\n\ninterface ErrorResult {\n  exitCode?: number\n  stdout?: string\n  stderr?: string\n  combined: string\n}\n\nasync function readResult(name: string): Promise<ErrorResult> {\n  const p = path.resolve(import.meta.dirname, '..', name)\n  const mod: { default: ErrorResult } = await import(p, {\n    with: { type: 'json' },\n  })\n  return mod.default\n}\n\n// Build error mode tests\n\ntest('build fails with non-zero exit code in error mode', async () => {\n  const result = await readResult('error-build-result.json')\n  expect(result.exitCode).not.toBe(0)\n})\n\ntest('build output contains import-protection violation', async () => {\n  const result = await readResult('error-build-result.json')\n  const text = stripAnsi(result.combined)\n  expect(text).toContain('[import-protection] Import denied in')\n})\n\ntest('build violation mentions environment', async () => {\n  const result = await readResult('error-build-result.json')\n  const text = stripAnsi(result.combined)\n  const hasClient = text.includes('Import denied in client environment')\n  const hasServer = text.includes('Import denied in server environment')\n  expect(hasClient || hasServer).toBe(true)\n})\n\ntest('build violation references custom file pattern', async () => {\n  const result = await readResult('error-build-result.json')\n  const text = stripAnsi(result.combined)\n  // The violation should reference .backend. or .frontend. files\n  const hasBackend = text.includes('credentials.backend')\n  const hasFrontend = text.includes('browser-api.frontend')\n  expect(hasBackend || hasFrontend).toBe(true)\n})\n\ntest('build violation is parseable', async () => {\n  const result = await readResult('error-build-result.json')\n  const violations = extractViolationsFromLog(result.combined)\n  expect(violations.length).toBeGreaterThanOrEqual(1)\n\n  const v = violations[0]\n  expect(v.envType).toMatch(/^(client|server)$/)\n  expect(v.importer).toBeTruthy()\n  expect(v.specifier).toBeTruthy()\n  expect(v.type).toBe('file')\n})\n\n// Dev error mode tests\n\ntest('dev server logs contain import-protection error', async () => {\n  const result = await readResult('error-dev-result.json')\n  const text = stripAnsi(result.combined)\n  expect(text).toContain('[import-protection] Import denied in')\n})\n\ntest('dev error violation references custom file pattern', async () => {\n  const result = await readResult('error-dev-result.json')\n  const text = stripAnsi(result.combined)\n  const hasBackend = text.includes('credentials.backend')\n  const hasFrontend = text.includes('browser-api.frontend')\n  expect(hasBackend || hasFrontend).toBe(true)\n})\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/tests/utils/isErrorMode.ts",
    "content": "export const isErrorMode: boolean = process.env.BEHAVIOR === 'error'\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/tests/violations.setup.ts",
    "content": "import fs from 'node:fs'\nimport path from 'node:path'\nimport { spawn } from 'node:child_process'\nimport { chromium } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\nimport { extractViolationsFromLog } from './violations.utils'\nimport type { FullConfig } from '@playwright/test'\nimport type { Violation } from './violations.utils'\n\nasync function waitForHttpOk(url: string, timeoutMs: number): Promise<void> {\n  const start = Date.now()\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  while (true) {\n    if (Date.now() - start > timeoutMs) {\n      throw new Error(`Timed out waiting for ${url}`)\n    }\n\n    try {\n      const res = await fetch(url, {\n        signal: AbortSignal.timeout(1000),\n      })\n      if (res.ok) return\n    } catch {\n      // ignore\n    }\n\n    await new Promise((r) => setTimeout(r, 200))\n  }\n}\n\nfunction startDevServer(cwd: string, port: number): ReturnType<typeof spawn> {\n  return spawn('pnpm', ['exec', 'vite', 'dev', '--port', String(port)], {\n    cwd,\n    env: {\n      ...process.env,\n      PORT: String(port),\n      VITE_SERVER_PORT: String(port),\n      VITE_NODE_ENV: 'test',\n    },\n    stdio: ['ignore', 'pipe', 'pipe'],\n  })\n}\n\nasync function killChild(child: ReturnType<typeof spawn>): Promise<void> {\n  if (child.exitCode !== null || child.killed) return\n  await new Promise<void>((resolve) => {\n    let resolved = false\n    const done = () => {\n      if (resolved) return\n      resolved = true\n      resolve()\n    }\n    child.once('exit', done)\n    child.once('error', done)\n    try {\n      child.kill('SIGTERM')\n    } catch {\n      done()\n      return\n    }\n    setTimeout(() => {\n      try {\n        child.kill('SIGKILL')\n      } catch {\n        // ignore\n      }\n      setTimeout(done, 500)\n    }, 3000)\n  })\n}\n\nconst routes = ['/', '/backend-leak', '/frontend-leak'] as const\n\nconst routeReadyTestIds: Record<string, string> = {\n  '/': 'heading',\n  '/backend-leak': 'backend-leak-heading',\n  '/frontend-leak': 'frontend-leak-heading',\n}\n\nasync function navigateAllRoutes(\n  baseURL: string,\n  browser: Awaited<ReturnType<typeof chromium.launch>>,\n): Promise<void> {\n  const context = await browser.newContext()\n  const page = await context.newPage()\n\n  for (const route of routes) {\n    try {\n      try {\n        await page.goto(`${baseURL}${route}`, {\n          waitUntil: 'networkidle',\n          timeout: 15_000,\n        })\n      } catch {\n        await page.goto(`${baseURL}${route}`, {\n          waitUntil: 'load',\n          timeout: 30_000,\n        })\n      }\n\n      const testId = routeReadyTestIds[route]\n      if (testId) {\n        await page.getByTestId(testId).waitFor({ timeout: 10_000 })\n      }\n    } catch {\n      // ignore navigation errors — we only care about server logs\n    } finally {\n      await new Promise((r) => setTimeout(r, 750))\n    }\n  }\n\n  await context.close()\n}\n\nasync function runDevPass(\n  cwd: string,\n  port: number,\n): Promise<Array<Violation>> {\n  const baseURL = `http://localhost:${port}`\n  const logChunks: Array<string> = []\n  const child = startDevServer(cwd, port)\n\n  child.stdout?.on('data', (d: Buffer) => logChunks.push(d.toString()))\n  child.stderr?.on('data', (d: Buffer) => logChunks.push(d.toString()))\n\n  try {\n    await waitForHttpOk(baseURL, 30_000)\n\n    const browser = await chromium.launch()\n    try {\n      await navigateAllRoutes(baseURL, browser)\n    } finally {\n      await browser.close()\n    }\n\n    await new Promise((r) => setTimeout(r, 750))\n  } finally {\n    await killChild(child)\n  }\n\n  const text = logChunks.join('')\n  return extractViolationsFromLog(text)\n}\n\nasync function captureDevViolations(cwd: string): Promise<void> {\n  const port = await getTestServerPort(`${packageJson.name}_dev`)\n\n  const coldViolations = await runDevPass(cwd, port)\n\n  fs.writeFileSync(\n    path.resolve(cwd, 'violations.dev.json'),\n    JSON.stringify(coldViolations, null, 2),\n  )\n}\n\nexport default async function globalSetup(config: FullConfig) {\n  void config\n  const cwd = path.resolve(import.meta.dirname, '..')\n\n  // webServer.command writes build output to this file.\n  const logFile = path.resolve(cwd, 'webserver-build.log')\n\n  if (!fs.existsSync(logFile)) {\n    fs.writeFileSync(path.resolve(cwd, 'violations.build.json'), '[]')\n    return\n  }\n\n  const text = fs.readFileSync(logFile, 'utf-8')\n  const violations = extractViolationsFromLog(text)\n  fs.writeFileSync(\n    path.resolve(cwd, 'violations.build.json'),\n    JSON.stringify(violations, null, 2),\n  )\n\n  await captureDevViolations(cwd)\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/tests/violations.utils.ts",
    "content": "export type TraceStep = {\n  file: string\n  specifier?: string\n  line?: number\n  column?: number\n}\n\nexport type CodeSnippet = {\n  lines: Array<string>\n  location?: string\n}\n\nexport type Violation = {\n  envType?: string\n  type: string\n  specifier: string\n  importer: string\n  resolved?: string\n  trace: Array<TraceStep>\n  snippet?: CodeSnippet\n  message?: string\n}\n\nexport function stripAnsi(input: string): string {\n  // eslint-disable-next-line no-control-regex\n  return input.replace(/\\u001b\\[[0-9;]*m/g, '')\n}\n\nexport function extractViolationsFromLog(text: string): Array<Violation> {\n  const out: Array<Violation> = []\n  const lines = stripAnsi(text).split(/\\r?\\n/)\n\n  for (let i = 0; i < lines.length; i++) {\n    const line = lines[i] ?? ''\n    if (!line.includes('[import-protection] Import denied in')) continue\n\n    const envTypeMatch = line.match(\n      /Import denied in\\s+(client|server)\\s+environment/,\n    )\n    const envType = envTypeMatch?.[1]\n\n    const block: Array<string> = [line]\n    for (let j = i + 1; j < Math.min(lines.length, i + 200); j++) {\n      const l = lines[j] ?? ''\n      if (l.includes('[import-protection] Import denied in') && j !== i + 1) {\n        break\n      }\n      block.push(l)\n    }\n\n    const importerLine = block.find((b) =>\n      b.trimStart().startsWith('Importer:'),\n    )\n    const specLine = block.find((b) => b.trimStart().startsWith('Import:'))\n    const resolvedLine = block.find((b) =>\n      b.trimStart().startsWith('Resolved:'),\n    )\n\n    const importer = importerLine\n      ? importerLine.split('Importer:')[1]!.trim()\n      : ''\n    const specifier = specLine\n      ? specLine.split('Import:')[1]!.trim().replace(/^\"|\"$/g, '')\n      : ''\n    const resolved = resolvedLine\n      ? resolvedLine.split('Resolved:')[1]!.trim()\n      : undefined\n\n    const typeLine = block.find((b) => b.trimStart().startsWith('Denied by'))\n    const type = typeLine?.includes('marker')\n      ? 'marker'\n      : typeLine?.includes('specifier')\n        ? 'specifier'\n        : typeLine?.includes('file')\n          ? 'file'\n          : 'unknown'\n\n    const trace: Array<TraceStep> = []\n    const traceStart = block.findIndex((b) => b.trim() === 'Trace:')\n    if (traceStart !== -1) {\n      for (let k = traceStart + 1; k < block.length; k++) {\n        const l = block[k] ?? ''\n        const m = l.match(\n          /^\\s*\\d+\\.\\s+(.*?)(?:\\s+\\(entry\\))?\\s*(?:\\(import \"(.*)\"\\))?\\s*$/,\n        )\n        if (m) {\n          const rawFile = m[1]!.trim()\n          const spec = m[2]?.trim()\n\n          const locMatch = rawFile.match(/^(.*?):(\\d+):(\\d+)$/)\n          if (locMatch) {\n            trace.push({\n              file: locMatch[1]!,\n              line: Number(locMatch[2]),\n              column: Number(locMatch[3]),\n              specifier: spec,\n            })\n          } else {\n            trace.push({ file: rawFile, specifier: spec })\n          }\n        } else if (l.trim() === '' || l.match(/^\\s*$/)) {\n          break\n        }\n      }\n    }\n\n    out.push({ envType, type, specifier, importer, resolved, trace })\n  }\n\n  return out\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/import-protection-custom-config/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\n// Allow env var to override the import protection behavior.\n// Default: 'mock' (build completes, violations logged as warnings).\n// Set BEHAVIOR=error to test that the build fails on violations.\nconst behavior = (process.env.BEHAVIOR ?? 'mock') as 'mock' | 'error'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tanstackStart({\n      importProtection: {\n        behavior,\n        log: 'always',\n        // Custom file patterns: NOT the default `.server.*` / `.client.*`.\n        // Uses `.backend.*` for server-only files (denied in client env)\n        // and `.frontend.*` for client-only files (denied in server env).\n        client: {\n          files: ['**/*.backend.*'],\n        },\n        server: {\n          files: ['**/*.frontend.*'],\n        },\n        onViolation: (info) => {\n          void info\n        },\n      },\n    }),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/query-integration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/query-integration/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/query-integration/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-query-integration\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { derivePort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await derivePort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/queryOptions.ts",
    "content": "import { queryOptions } from '@tanstack/react-query'\n\nexport const makeQueryOptions = (key: string) =>\n  queryOptions({\n    queryKey: ['e2e-test-query-integration', key],\n    queryFn: async () => {\n      console.log('fetching query data')\n      await new Promise<void>((resolve) => {\n        setTimeout(resolve, 500)\n      })\n      const result = typeof window !== 'undefined' ? 'client' : 'server'\n      console.log('query data result', result)\n      return result\n    },\n    staleTime: Infinity,\n  })\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UseSuspenseQueryRouteImport } from './routes/useSuspenseQuery'\nimport { Route as UseQueryRouteImport } from './routes/useQuery'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as LoaderFetchQueryTypeRouteImport } from './routes/loader-fetchQuery/$type'\n\nconst UseSuspenseQueryRoute = UseSuspenseQueryRouteImport.update({\n  id: '/useSuspenseQuery',\n  path: '/useSuspenseQuery',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UseQueryRoute = UseQueryRouteImport.update({\n  id: '/useQuery',\n  path: '/useQuery',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoaderFetchQueryTypeRoute = LoaderFetchQueryTypeRouteImport.update({\n  id: '/loader-fetchQuery/$type',\n  path: '/loader-fetchQuery/$type',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/useSuspenseQuery': typeof UseSuspenseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/useSuspenseQuery': typeof UseSuspenseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/useSuspenseQuery': typeof UseSuspenseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/useQuery'\n    | '/useSuspenseQuery'\n    | '/loader-fetchQuery/$type'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/useQuery' | '/useSuspenseQuery' | '/loader-fetchQuery/$type'\n  id:\n    | '__root__'\n    | '/'\n    | '/useQuery'\n    | '/useSuspenseQuery'\n    | '/loader-fetchQuery/$type'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  UseQueryRoute: typeof UseQueryRoute\n  UseSuspenseQueryRoute: typeof UseSuspenseQueryRoute\n  LoaderFetchQueryTypeRoute: typeof LoaderFetchQueryTypeRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/useSuspenseQuery': {\n      id: '/useSuspenseQuery'\n      path: '/useSuspenseQuery'\n      fullPath: '/useSuspenseQuery'\n      preLoaderRoute: typeof UseSuspenseQueryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/useQuery': {\n      id: '/useQuery'\n      path: '/useQuery'\n      fullPath: '/useQuery'\n      preLoaderRoute: typeof UseQueryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/loader-fetchQuery/$type': {\n      id: '/loader-fetchQuery/$type'\n      path: '/loader-fetchQuery/$type'\n      fullPath: '/loader-fetchQuery/$type'\n      preLoaderRoute: typeof LoaderFetchQueryTypeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  UseQueryRoute: UseQueryRoute,\n  UseSuspenseQueryRoute: UseSuspenseQueryRoute,\n  LoaderFetchQueryTypeRoute: LoaderFetchQueryTypeRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/react-query'\nimport { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport type { QueryClient } from '@tanstack/react-query'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/loader-fetchQuery/$type\"\n            params={{ type: 'sync' }}\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            fetchQuery (sync)\n          </Link>{' '}\n          <Link\n            to=\"/loader-fetchQuery/$type\"\n            params={{ type: 'async' }}\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            fetchQuery (async)\n          </Link>{' '}\n          <Link\n            to=\"/useQuery\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            useQuery\n          </Link>{' '}\n          <Link\n            to=\"/useSuspenseQuery\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            useSuspenseQuery\n          </Link>{' '}\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtoolsInProd position=\"bottom-right\" />\n        <ReactQueryDevtools buttonPosition=\"bottom-left\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Query Integration E2E tests</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/routes/loader-fetchQuery/$type.tsx",
    "content": "import { useQuery } from '@tanstack/react-query'\nimport { createFileRoute } from '@tanstack/react-router'\nimport z from 'zod'\nimport { makeQueryOptions } from '~/queryOptions'\n\nexport const Route = createFileRoute('/loader-fetchQuery/$type')({\n  component: RouteComponent,\n  params: {\n    parse: ({ type }) =>\n      z\n        .object({\n          type: z.union([z.literal('sync'), z.literal('async')]),\n        })\n        .parse({ type }),\n  },\n  context: ({ params }) => ({\n    queryOptions: makeQueryOptions(`loader-fetchQuery-${params.type}`),\n  }),\n  loader: ({ context, params }) => {\n    const queryPromise = context.queryClient.fetchQuery(context.queryOptions)\n    if (params.type === 'sync') {\n      return queryPromise\n    }\n  },\n  ssr: 'data-only',\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n  const context = Route.useRouteContext()\n  const query = useQuery(context.queryOptions)\n  return (\n    <div>\n      <div>\n        loader data:{' '}\n        <div data-testid=\"loader-data\">{loaderData ?? 'undefined'}</div>\n      </div>\n      <div>\n        query data:{' '}\n        <div data-testid=\"query-data\">{query.data ?? 'loading...'}</div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/routes/useQuery.tsx",
    "content": "import { useQuery } from '@tanstack/react-query'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { makeQueryOptions } from '~/queryOptions'\n\nconst qOptions = makeQueryOptions('useQuery')\n\nexport const Route = createFileRoute('/useQuery')({\n  component: RouteComponent,\n  ssr: true,\n})\n\nfunction RouteComponent() {\n  const query = useQuery({ ...qOptions, gcTime: 0 })\n  return (\n    <div>\n      <div>\n        query data:{' '}\n        <div data-testid=\"query-data\">{query.data ?? 'loading...'}</div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/routes/useSuspenseQuery.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { makeQueryOptions } from '~/queryOptions'\n\nconst qOptions = makeQueryOptions('useSuspenseQuery')\n\nexport const Route = createFileRoute('/useSuspenseQuery')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const query = useSuspenseQuery(qOptions)\n  return (\n    <div>\n      <div>\n        query data: <div data-testid=\"query-data\">{query.data}</div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\n// if the query would not be streamed to the client, it would re-execute on the client\n// and thus cause a hydration mismatch since the query function returns 'client' when executed on the client\ntest.describe('queries are streamed from the server', () => {\n  test('direct visit - loader on server runs fetchQuery and awaits it', async ({\n    page,\n  }) => {\n    await page.goto('/loader-fetchQuery/sync')\n\n    // wait for the query data to be streamed from the server\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n\n    // the loader data should be the same as the query data\n    const loaderData = page.getByTestId('loader-data')\n    await expect(loaderData).toHaveText('server')\n  })\n  test('direct visit - loader on server runs fetchQuery and does not await it', async ({\n    page,\n  }) => {\n    await page.goto('/loader-fetchQuery/async')\n\n    // wait for the query data to be streamed from the server\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n\n    const loaderData = page.getByTestId('loader-data')\n    await expect(loaderData).toHaveText('undefined')\n  })\n\n  test('useSuspenseQuery', async ({ page }) => {\n    await page.goto('/useSuspenseQuery')\n\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n  })\n})\n\ntest('useQuery does not execute on the server and therefore does not stream data to the client', async ({\n  page,\n}) => {\n  await page.goto('/useQuery')\n\n  const queryData = page.getByTestId('query-data')\n  await expect(queryData).toHaveText('client')\n})\n"
  },
  {
    "path": "e2e/react-start/query-integration/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/query-integration/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart()],\n})\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/scroll-restoration/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-basic-scroll-restoration\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as testsWithSearchRouteImport } from './routes/(tests)/with-search'\nimport { Route as testsWithLoaderRouteImport } from './routes/(tests)/with-loader'\nimport { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsWithSearchRoute = testsWithSearchRouteImport.update({\n  id: '/(tests)/with-search',\n  path: '/with-search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsWithLoaderRoute = testsWithLoaderRouteImport.update({\n  id: '/(tests)/with-loader',\n  path: '/with-loader',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsNormalPageRoute = testsNormalPageRouteImport.update({\n  id: '/(tests)/normal-page',\n  path: '/normal-page',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/with-loader': typeof testsWithLoaderRoute\n  '/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/with-loader': typeof testsWithLoaderRoute\n  '/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/(tests)/normal-page': typeof testsNormalPageRoute\n  '/(tests)/with-loader': typeof testsWithLoaderRoute\n  '/(tests)/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/normal-page' | '/with-loader' | '/with-search'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/normal-page' | '/with-loader' | '/with-search'\n  id:\n    | '__root__'\n    | '/'\n    | '/(tests)/normal-page'\n    | '/(tests)/with-loader'\n    | '/(tests)/with-search'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  testsNormalPageRoute: typeof testsNormalPageRoute\n  testsWithLoaderRoute: typeof testsWithLoaderRoute\n  testsWithSearchRoute: typeof testsWithSearchRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/with-search': {\n      id: '/(tests)/with-search'\n      path: '/with-search'\n      fullPath: '/with-search'\n      preLoaderRoute: typeof testsWithSearchRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/with-loader': {\n      id: '/(tests)/with-loader'\n      path: '/with-loader'\n      fullPath: '/with-loader'\n      preLoaderRoute: typeof testsWithLoaderRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/normal-page': {\n      id: '/(tests)/normal-page'\n      path: '/normal-page'\n      fullPath: '/normal-page'\n      preLoaderRoute: typeof testsNormalPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  testsNormalPageRoute: testsNormalPageRoute,\n  testsWithLoaderRoute: testsWithLoaderRoute,\n  testsWithSearchRoute: testsWithSearchRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/routes/(tests)/normal-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/normal-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div className=\"p-2\">\n      <h3>normal-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/routes/(tests)/with-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { ScrollBlock } from '../-components/scroll-block'\nimport { sleep } from '~/utils/posts'\n\nexport const Route = createFileRoute('/(tests)/with-loader')({\n  loader: async () => {\n    await sleep(1000)\n    return { foo: 'bar' }\n  },\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div className=\"p-2\">\n      <h3>lazy-with-loader-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/routes/(tests)/with-search.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/with-search')({\n  validateSearch: zodValidator(z.object({ where: z.string() })),\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div className=\"p-2\">\n      <h3>page-with-search</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/routes/-components/scroll-block.tsx",
    "content": "export const atTheTopId = 'at-the-top'\nexport const atTheBottomId = 'at-the-bottom'\n\nexport function ScrollBlock({ number = 100 }: { number?: number }) {\n  return (\n    <>\n      <div id={atTheTopId} data-testid={atTheTopId}></div>\n      {Array.from({ length: number }).map((_, i) => (\n        <div key={`scroll-block-${i}`}>{i}</div>\n      ))}\n      <div id={atTheBottomId} data-testid={atTheBottomId}>\n        At the bottom\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  linkOptions,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Nav type=\"header\" />\n        <hr />\n        {children}\n        <hr />\n        <Nav type=\"footer\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n\nfunction Nav({ type }: { type: 'header' | 'footer' }) {\n  const Elem = type === 'header' ? 'header' : 'footer'\n  const prefix = type === 'header' ? 'Head' : 'Foot'\n  return (\n    <Elem className=\"p-2 flex gap-2 text-lg\">\n      <Link\n        to=\"/\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n        activeOptions={{ exact: true }}\n      >\n        {prefix}-/\n      </Link>{' '}\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/with-loader' }),\n          linkOptions({ to: '/with-search', search: { where: type } }),\n        ] as const\n      ).map((options, i) => (\n        <Link\n          key={`${prefix}-${options.to}-${i}`}\n          {...options}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          {prefix}-{options.to}\n        </Link>\n      ))}\n    </Elem>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/routes/index.tsx",
    "content": "import * as React from 'react'\nimport { Link, linkOptions, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-2 grid gap-2\">\n      <h3>Welcome Home!</h3>\n      <p>\n        The are the links to be tested when navigating away from the index page.\n        Otherwise known as NOT first-load tests, rather known as navigation\n        tests.\n      </p>\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/with-loader' }),\n          linkOptions({ to: '/with-search', search: { where: 'footer' } }),\n        ] as const\n      ).map((options, i) => (\n        <div key={`index-page-tests-${options.to}-${i}`} className=\"border p-2\">\n          <h4>{options.to} tests</h4>\n          <p>\n            <Link {...options} hash=\"at-the-bottom\">\n              {options.to}#at-the-bottom\n            </Link>\n          </p>\n        </div>\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/utils/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport function sleep(ms: number) {\n  return new Promise((r) => setTimeout(r, ms))\n}\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT =\n  import.meta.env.VITE_SERVER_PORT || process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { linkOptions } from '@tanstack/react-router'\n\ntest('Smoke - Renders home', async ({ page }) => {\n  await page.goto('/')\n  await expect(\n    page.getByRole('heading', { name: 'Welcome Home!' }),\n  ).toBeVisible()\n})\n\n// Test for scroll related stuff\n;[\n  linkOptions({ to: '/normal-page' }),\n  linkOptions({ to: '/with-loader' }),\n  linkOptions({ to: '/with-search', search: { where: 'footer' } }),\n].forEach((options) => {\n  test(`On navigate to ${options.to} (from the header), scroll should be at top`, async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page.getByRole('link', { name: `Head-${options.to}` }).click()\n    await expect(page.getByTestId('at-the-top')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on navigation after the page is loaded\n  test(`On navigate via index page tests to ${options.to}, scroll should resolve at the bottom`, async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page\n      .getByRole('link', { name: `${options.to}#at-the-bottom` })\n      .click()\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on first load\n  test(`On first load of ${options.to}, scroll should resolve resolve at the bottom`, async ({\n    page,\n  }) => {\n    let url: string = options.to\n    if ('search' in options) {\n      url = `${url}?where=${options.search}`\n    }\n    await page.goto(`${url}#at-the-bottom`)\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"types\": [\"vite/client\"],\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/scroll-restoration/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/selective-ssr/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-selective-ssr\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts' | '/posts/$postId'\n  id: '__root__' | '/' | '/posts' | '/posts/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  ClientOnly,\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { ssrSchema } from '~/search'\nimport appCss from '~/styles/app.css?url'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'Selective SSR E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  validateSearch: z.object({ root: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.root?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.root?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      root: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.root?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { root: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  shellComponent: RootDocument,\n  component: () => {\n    const search = Route.useSearch()\n    if (\n      typeof window === 'undefined' &&\n      search.root?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return (\n      <div data-testid=\"root-container\">\n        <h2 data-testid=\"root-heading\">root</h2>\n        <div>\n          ssr:{' '}\n          <b>{JSON.stringify(Route.useSearch().root?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"root-data-expected\">\n            {Route.useSearch().root?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader: <b data-testid=\"root-loader\">{Route.useLoaderData().root}</b>\n        </div>\n        <div>\n          context:{' '}\n          <b data-testid=\"root-context\">{Route.useRouteContext().root}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>__root Loading...</div>,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  const { isLoading, status } = useRouterState({\n    select: (state) => ({ isLoading: state.isLoading, status: state.status }),\n    structuralSharing: true,\n  })\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <h1>Selective SSR E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">{isLoading ? 'true' : 'false'}</b>\n          </div>\n          <div>\n            router status: <b data-testid=\"router-status\">{status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {children}\n        <Scripts />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/src/routes/index.tsx",
    "content": "import { Link, createFileRoute, linkOptions } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nconst baseTestCase = linkOptions({\n  to: '/posts/$postId',\n  params: { postId: '1' },\n})\n\nconst testCases = [\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: undefined,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        posts: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        posts: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: true,\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: 'data-only',\n          expected: { data: 'server', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: 'data-only',\n          expected: { data: 'server', render: 'client-only' },\n        },\n        posts: {\n          ssr: true,\n          expected: { data: 'server', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        postId: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n]\n\nfunction Home() {\n  const links = testCases.map((t, index) => {\n    const key = `testcase-${index}-link`\n\n    return (\n      <div key={key}>\n        <Link data-testid={key} {...t.link} reloadDocument={true}>\n          root: {JSON.stringify(t.link.search.root.ssr ?? 'undefined')} posts:{' '}\n          {JSON.stringify(t.link.search.posts.ssr ?? 'undefined')} $postId:{' '}\n          {JSON.stringify(t.link.search.postId.ssr ?? 'undefined')}\n        </Link>\n        <br />\n        <br />\n      </div>\n    )\n  })\n\n  return (\n    <>\n      <div>\n        test count: <b data-testid=\"test-count\">{links.length}</b>\n      </div>\n      <div>{links}</div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport z from 'zod'\nimport { ssrSchema } from '~/search'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  validateSearch: z.object({ postId: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.postId?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.postId?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      postId: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.postId?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { postId: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    if (\n      typeof window === 'undefined' &&\n      search.postId?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return (\n      <div data-testid=\"postId-container\">\n        <h4 data-testid=\"postId-heading\">postId</h4>\n        <div>\n          ssr:{' '}\n          <b>{JSON.stringify(Route.useSearch().postId?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"postId-data-expected\">\n            {Route.useSearch().postId?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader:{' '}\n          <b data-testid=\"postId-loader\">{Route.useLoaderData().postId}</b>\n        </div>\n        <div>\n          context:{' '}\n          <b data-testid=\"postId-context\">{Route.useRouteContext().postId}</b>\n        </div>\n      </div>\n    )\n  },\n  pendingComponent: () => <div>$postId Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/src/routes/posts.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport z from 'zod'\nimport { ssrSchema } from '~/search'\n\nexport const Route = createFileRoute('/posts')({\n  validateSearch: z.object({ posts: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.posts?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.posts?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      posts: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.posts?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { posts: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    if (\n      typeof window === 'undefined' &&\n      search.posts?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return (\n      <div data-testid=\"posts-container\">\n        <h3 data-testid=\"posts-heading\">posts</h3>\n        <div>\n          ssr:{' '}\n          <b>{JSON.stringify(Route.useSearch().posts?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"posts-data-expected\">\n            {Route.useSearch().posts?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader:{' '}\n          <b data-testid=\"posts-loader\">{Route.useLoaderData().posts}</b>\n        </div>\n        <div>\n          context:{' '}\n          <b data-testid=\"posts-context\">{Route.useRouteContext().posts}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>posts Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/src/search.ts",
    "content": "import { z } from 'zod'\n\nexport const ssrSchema = z\n  .object({\n    ssr: z.union([z.literal('data-only'), z.boolean()]).optional(),\n    expected: z\n      .object({\n        data: z.union([z.literal('client'), z.literal('server')]),\n        render: z.union([\n          z.literal('client-only'),\n          z.literal('server-and-client'),\n        ]),\n      })\n      .optional(),\n  })\n  .optional()\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\nconst testCount = 7\n\ntest.describe('selective ssr', () => {\n  test('testcount matches', async ({ page }) => {\n    await page.goto('/')\n\n    await expect(page.getByTestId('test-count')).toHaveText(`${testCount}`)\n  })\n\n  for (let i = 0; i < testCount; i++) {\n    test(`run test ${i}`, async ({ page }) => {\n      await page.goto('/')\n      const testId = `testcase-${i}-link`\n      await page.getByTestId(testId).click()\n\n      // wait for page to be loaded by waiting for the leaf route to be rendered\n      await expect(page.getByTestId('postId-heading')).toContainText('postId')\n\n      // check expectations\n      await Promise.all(\n        ['root', 'posts', 'postId'].map(async (route) => {\n          const expectedData = await page\n            .getByTestId(`${route}-data-expected`)\n            .textContent()\n          expect(expectedData).not.toBeNull()\n          await expect(page.getByTestId(`${route}-loader`)).toContainText(\n            expectedData!,\n          )\n          await expect(page.getByTestId(`${route}-context`)).toContainText(\n            expectedData!,\n          )\n        }),\n      )\n      await expect(page.getByTestId('router-isLoading')).toContainText('false')\n      await expect(page.getByTestId('router-status')).toContainText('idle')\n    })\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/selective-ssr/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/serialization-adapters/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-serialization-adapters\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/CustomError.ts",
    "content": "import { createSerializationAdapter } from '@tanstack/react-router'\n\nexport class CustomError extends Error {\n  public foo: string\n  public bar: bigint\n\n  constructor(message: string, options: { foo: string; bar: bigint }) {\n    super(message)\n\n    Object.setPrototypeOf(this, new.target.prototype)\n\n    this.name = this.constructor.name\n    this.foo = options.foo\n    this.bar = options.bar\n  }\n}\n\nexport const customErrorAdapter = createSerializationAdapter({\n  key: 'custom-error',\n  test: (v) => v instanceof CustomError,\n  toSerializable: ({ message, foo, bar }) => {\n    return {\n      message,\n      foo,\n      bar,\n    }\n  },\n  fromSerializable: ({ message, foo, bar }) => {\n    return new CustomError(message, { foo, bar })\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/data.tsx",
    "content": "import { createSerializationAdapter } from '@tanstack/react-router'\n\nexport class Foo {\n  constructor(public value: string) {}\n}\n\nexport interface Car {\n  __type: 'car'\n  make: string\n  model: string\n  year: number\n  honk: () => { message: string; make: string; model: string; year: number }\n}\n\nexport function makeCar(opts: {\n  make: string\n  model: string\n  year: number\n}): Car {\n  return {\n    ...opts,\n    __type: 'car',\n    honk: () => {\n      return { message: `Honk! Honk!`, ...opts }\n    },\n  }\n}\n\nexport const fooAdapter = createSerializationAdapter({\n  key: 'foo',\n  test: (value: any) => value instanceof Foo,\n  toSerializable: (foo) => foo.value,\n  fromSerializable: (value) => new Foo(value),\n})\n\nexport const carAdapter = createSerializationAdapter({\n  key: 'car',\n  test: (value: any): value is Car =>\n    '__type' in (value as Car) && value.__type === 'car',\n  toSerializable: (car) => ({\n    make: car.make,\n    model: car.model,\n    year: car.year,\n  }),\n  fromSerializable: (value: { make: string; model: string; year: number }) =>\n    makeCar(value),\n})\n\nexport function makeData() {\n  function makeFoo(suffix: string = '') {\n    return new Foo(typeof window === 'undefined' ? 'server' : 'client' + suffix)\n  }\n  return {\n    foo: {\n      singleInstance: makeFoo(),\n      array: [makeFoo('0'), makeFoo('1'), makeFoo('2')],\n      map: new Map([\n        [0, makeFoo('0')],\n        [1, makeFoo('1')],\n        [2, makeFoo('2')],\n      ]),\n      mapOfArrays: new Map([\n        [0, [makeFoo('0-a'), makeFoo('0-b')]],\n        [1, [makeFoo('1-a'), makeFoo('1-b')]],\n        [2, [makeFoo('2-a'), makeFoo('2-b')]],\n      ]),\n    },\n    car: {\n      singleInstance: makeCar({\n        make: 'Toyota',\n        model: 'Camry',\n        year: 2020,\n      }),\n      array: [\n        makeCar({ make: 'Honda', model: 'Accord', year: 2019 }),\n        makeCar({ make: 'Ford', model: 'Mustang', year: 2021 }),\n      ],\n      map: new Map([\n        [0, makeCar({ make: 'Chevrolet', model: 'Malibu', year: 2018 })],\n        [1, makeCar({ make: 'Nissan', model: 'Altima', year: 2020 })],\n        [2, makeCar({ make: 'Hyundai', model: 'Sonata', year: 2021 })],\n      ]),\n      mapOfArrays: new Map([\n        [0, [makeCar({ make: 'Kia', model: 'Optima', year: 2019 })]],\n        [1, [makeCar({ make: 'Subaru', model: 'Legacy', year: 2020 })]],\n        [2, [makeCar({ make: 'Volkswagen', model: 'Passat', year: 2021 })]],\n      ]),\n    },\n  }\n}\nexport class NestedOuter {\n  constructor(public inner: NestedInner) {}\n  whisper() {\n    return this.inner.value.toLowerCase()\n  }\n}\n\nexport class NestedInner {\n  constructor(public value: string) {}\n  shout() {\n    return this.value.toUpperCase()\n  }\n}\n\nexport const nestedInnerAdapter = createSerializationAdapter({\n  key: 'nestedInner',\n  test: (value): value is NestedInner => value instanceof NestedInner,\n  toSerializable: (inner) => inner.value,\n  fromSerializable: (value) => new NestedInner(value),\n})\n\nexport const nestedOuterAdapter = createSerializationAdapter({\n  key: 'nestedOuter',\n  extends: [nestedInnerAdapter],\n  test: (value) => value instanceof NestedOuter,\n  toSerializable: (outer) => outer.inner,\n  fromSerializable: (value) => new NestedOuter(value),\n})\n\nexport function makeNested() {\n  return new NestedOuter(new NestedInner('Hello World'))\n}\n\nexport function RenderData({\n  id,\n  data,\n}: {\n  id: string\n  data: ReturnType<typeof makeData>\n}) {\n  const localData = makeData()\n  return (\n    <div data-testid={`${id}-container`}>\n      <h3>Car</h3>\n      <h4>expected</h4>\n      <div data-testid={`${id}-car-expected`}>\n        {JSON.stringify({\n          make: localData.car.singleInstance.make,\n          model: localData.car.singleInstance.model,\n          year: localData.car.singleInstance.year,\n        })}\n      </div>\n      <h4>actual</h4>\n      <div data-testid={`${id}-car-actual`}>\n        {JSON.stringify({\n          make: data.car.singleInstance.make,\n          model: data.car.singleInstance.model,\n          year: data.car.singleInstance.year,\n        })}\n      </div>\n      <b>Foo</b>\n      <div data-testid={`${id}-foo`}>\n        {JSON.stringify({\n          value: data.foo.singleInstance.value,\n        })}\n      </div>\n    </div>\n  )\n}\n\nexport function RenderNestedData({ nested }: { nested: NestedOuter }) {\n  {\n    const localData = makeNested()\n    const expectedShoutState = localData.inner.shout()\n    const expectedWhisperState = localData.whisper()\n    const shoutState = nested.inner.shout()\n    const whisperState = nested.whisper()\n\n    return (\n      <div data-testid=\"data-only-container\">\n        <h2 data-testid=\"data-only-heading\">data-only</h2>\n        <div data-testid=\"shout-container\">\n          <h3>shout</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"shout-expected-state\">\n              {JSON.stringify(expectedShoutState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"shout-actual-state\">\n              {JSON.stringify(shoutState)}\n            </div>\n          </div>\n        </div>\n        <div data-testid=\"whisper-container\">\n          <h3>whisper</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"whisper-expected-state\">\n              {JSON.stringify(expectedWhisperState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"whisper-actual-state\">\n              {JSON.stringify(whisperState)}\n            </div>\n          </div>\n        </div>\n      </div>\n    )\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SsrStreamRouteImport } from './routes/ssr/stream'\nimport { Route as SsrNestedRouteImport } from './routes/ssr/nested'\nimport { Route as SsrDataOnlyRouteImport } from './routes/ssr/data-only'\nimport { Route as ServerFunctionNestedRouteImport } from './routes/server-function/nested'\nimport { Route as ServerFunctionCustomErrorRouteImport } from './routes/server-function/custom-error'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrStreamRoute = SsrStreamRouteImport.update({\n  id: '/ssr/stream',\n  path: '/ssr/stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrNestedRoute = SsrNestedRouteImport.update({\n  id: '/ssr/nested',\n  path: '/ssr/nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrDataOnlyRoute = SsrDataOnlyRouteImport.update({\n  id: '/ssr/data-only',\n  path: '/ssr/data-only',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ServerFunctionNestedRoute = ServerFunctionNestedRouteImport.update({\n  id: '/server-function/nested',\n  path: '/server-function/nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ServerFunctionCustomErrorRoute =\n  ServerFunctionCustomErrorRouteImport.update({\n    id: '/server-function/custom-error',\n    path: '/server-function/custom-error',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  id:\n    | '__root__'\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ServerFunctionCustomErrorRoute: typeof ServerFunctionCustomErrorRoute\n  ServerFunctionNestedRoute: typeof ServerFunctionNestedRoute\n  SsrDataOnlyRoute: typeof SsrDataOnlyRoute\n  SsrNestedRoute: typeof SsrNestedRoute\n  SsrStreamRoute: typeof SsrStreamRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/stream': {\n      id: '/ssr/stream'\n      path: '/ssr/stream'\n      fullPath: '/ssr/stream'\n      preLoaderRoute: typeof SsrStreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/nested': {\n      id: '/ssr/nested'\n      path: '/ssr/nested'\n      fullPath: '/ssr/nested'\n      preLoaderRoute: typeof SsrNestedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/data-only': {\n      id: '/ssr/data-only'\n      path: '/ssr/data-only'\n      fullPath: '/ssr/data-only'\n      preLoaderRoute: typeof SsrDataOnlyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/server-function/nested': {\n      id: '/server-function/nested'\n      path: '/server-function/nested'\n      fullPath: '/server-function/nested'\n      preLoaderRoute: typeof ServerFunctionNestedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/server-function/custom-error': {\n      id: '/server-function/custom-error'\n      path: '/server-function/custom-error'\n      fullPath: '/server-function/custom-error'\n      preLoaderRoute: typeof ServerFunctionCustomErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ServerFunctionCustomErrorRoute: ServerFunctionCustomErrorRoute,\n  ServerFunctionNestedRoute: ServerFunctionNestedRoute,\n  SsrDataOnlyRoute: SsrDataOnlyRoute,\n  SsrNestedRoute: SsrNestedRoute,\n  SsrStreamRoute: SsrStreamRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { startInstance } from './start.tsx'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n    config: Awaited<ReturnType<typeof startInstance.getOptions>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  ClientOnly,\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'Serialization Adapters E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  const { isLoading, status } = useRouterState({\n    select: (state) => ({ isLoading: state.isLoading, status: state.status }),\n    structuralSharing: true,\n  })\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <h1>Serialization Adapters E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">{isLoading ? 'true' : 'false'}</b>\n          </div>\n          <div>\n            router status: <b data-testid=\"router-status\">{status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {children}\n        <Scripts />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <>\n      <div>\n        <h2>SSR</h2>\n        <Link\n          data-testid=\"ssr-data-only-link\"\n          to=\"/ssr/data-only\"\n          reloadDocument={true}\n        >\n          Data Only\n        </Link>\n        <br />\n        <Link\n          data-testid=\"ssr-stream-link\"\n          to=\"/ssr/stream\"\n          reloadDocument={true}\n        >\n          Stream\n        </Link>\n        <br />\n        <Link\n          data-testid=\"ssr-nested-link\"\n          to=\"/ssr/nested\"\n          reloadDocument={true}\n        >\n          Nested Classes\n        </Link>\n      </div>\n      <div>\n        <h2>Server Functions</h2>\n        <Link\n          data-testid=\"server-function-custom-error-link\"\n          to=\"/server-function/custom-error\"\n          reloadDocument={true}\n        >\n          Custom Error Serialization\n        </Link>\n        <br />\n        <Link\n          data-testid=\"server-functions-nested-link\"\n          to=\"/server-function/nested\"\n          reloadDocument={true}\n        >\n          Nested Classes returned from Server Function\n        </Link>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/routes/server-function/custom-error.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { setResponseStatus } from '@tanstack/react-start/server'\nimport { useState } from 'react'\nimport { z } from 'zod'\nimport { CustomError } from '~/CustomError'\n\nconst schema = z.object({ hello: z.string() })\nconst serverFnThrowing = createServerFn()\n  .inputValidator(schema)\n  .handler(async ({ data }) => {\n    if (data.hello === 'world') {\n      return 'Hello, world!'\n    }\n    setResponseStatus(499)\n    throw new CustomError('Invalid input', { foo: 'bar', bar: BigInt(123) })\n  })\n\nexport const Route = createFileRoute('/server-function/custom-error')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [validResponse, setValidResponse] = useState<any>(null)\n  const [invalidResponse, setInvalidResponse] = useState<CustomError | null>(\n    null,\n  )\n\n  return (\n    <div>\n      <button\n        data-testid=\"server-function-valid-input\"\n        onClick={() =>\n          serverFnThrowing({ data: { hello: 'world' } }).then(setValidResponse)\n        }\n      >\n        trigger valid input\n      </button>\n      <div data-testid=\"server-function-valid-response\">\n        {JSON.stringify(validResponse)}\n      </div>\n\n      <br />\n      <button\n        data-testid=\"server-function-invalid-input\"\n        onClick={() =>\n          serverFnThrowing({ data: { hello: 'error' } }).catch((err) => {\n            if (err instanceof CustomError) {\n              setInvalidResponse(err)\n            } else {\n              throw new Error('expected CustomError')\n            }\n          })\n        }\n      >\n        trigger invalid input\n      </button>\n      <div data-testid=\"server-function-invalid-response\">\n        {invalidResponse\n          ? JSON.stringify({\n              message: invalidResponse.message,\n              foo: invalidResponse.foo,\n              bar: invalidResponse.bar.toString(),\n            })\n          : JSON.stringify(validResponse)}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/routes/server-function/nested.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { useState } from 'react'\nimport type { NestedOuter } from '~/data'\nimport { RenderNestedData, makeNested } from '~/data'\n\nconst serverFnReturningNested = createServerFn().handler(() => {\n  return makeNested()\n})\n\nexport const Route = createFileRoute('/server-function/nested')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [nestedResponse, setNestedResponse] = useState<NestedOuter>()\n\n  return (\n    <div>\n      <button\n        data-testid=\"server-function-trigger\"\n        onClick={() => serverFnReturningNested().then(setNestedResponse)}\n      >\n        trigger\n      </button>\n\n      {nestedResponse ? (\n        <RenderNestedData nested={nestedResponse} />\n      ) : (\n        <div data-testid=\"waiting-for-response\">waiting for response...</div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/routes/ssr/data-only.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport { RenderData, makeData } from '~/data'\n\nexport const Route = createFileRoute('/ssr/data-only')({\n  ssr: 'data-only',\n  beforeLoad: () => {\n    return makeData()\n  },\n  loader: ({ context }) => {\n    return context\n  },\n  component: () => {\n    const context = Route.useRouteContext()\n    const loaderData = Route.useLoaderData()\n\n    const localData = makeData()\n    const expectedHonkState = localData.car.singleInstance.honk()\n\n    const honkState = loaderData.car.singleInstance.honk()\n\n    return (\n      <div data-testid=\"data-only-container\">\n        <h2 data-testid=\"data-only-heading\">data-only</h2>\n        <div>\n          context: <RenderData id=\"context\" data={context} />\n        </div>\n        <div>\n          loader: <RenderData id=\"loader\" data={loaderData} />\n        </div>\n        <div data-testid=\"honk-container\">\n          <h3>honk</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"honk-expected-state\">\n              {JSON.stringify(expectedHonkState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"honk-actual-state\">\n              {JSON.stringify(honkState)}\n            </div>\n          </div>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>posts Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/routes/ssr/nested.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { RenderNestedData, makeNested } from '~/data'\n\nexport const Route = createFileRoute('/ssr/nested')({\n  beforeLoad: () => {\n    return { nested: makeNested() }\n  },\n  loader: ({ context }) => {\n    return context\n  },\n  component: () => {\n    return <RenderNestedData nested={Route.useLoaderData().nested} />\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/routes/ssr/stream.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { Suspense } from 'react'\nimport { RenderData, makeData } from '~/data'\n\nexport const Route = createFileRoute('/ssr/stream')({\n  loader: () => {\n    const dataPromise = new Promise<ReturnType<typeof makeData>>((r) =>\n      setTimeout(() => r(makeData()), 1000),\n    )\n    return {\n      someString: 'hello world',\n      dataPromise,\n    }\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n  return (\n    <div>\n      <h3 data-testid=\"stream-heading\">Stream</h3>\n      <div data-testid=\"some-data\">{loaderData.someString}</div>\n      <Suspense fallback={<div>Loading...</div>}>\n        <Await promise={loaderData.dataPromise}>\n          {(data) => <RenderData id=\"stream\" data={data} />}\n        </Await>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/start.tsx",
    "content": "import { createStart } from '@tanstack/react-start'\nimport { carAdapter, fooAdapter, nestedOuterAdapter } from './data'\nimport { customErrorAdapter } from './CustomError'\n\nexport const startInstance = createStart(() => {\n  return {\n    defaultSsr: true,\n    serializationAdapters: [\n      fooAdapter,\n      carAdapter,\n      customErrorAdapter,\n      // only register nestedOuterAdapter here, nestedInnerAdapter is registered as an \"extends\" of nestedOuterAdapter\n      nestedOuterAdapter,\n    ],\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport type { Page } from '@playwright/test'\n\nasync function awaitPageLoaded(page: Page) {\n  // wait for page to be loaded by waiting for the ClientOnly component to be rendered\n\n  await expect(page.getByTestId('router-isLoading')).toContainText('false')\n  await expect(page.getByTestId('router-status')).toContainText('idle')\n}\nasync function checkData(page: Page, id: string) {\n  const expectedData = await page\n    .getByTestId(`${id}-car-expected`)\n    .textContent()\n  expect(expectedData).not.toBeNull()\n  await expect(page.getByTestId(`${id}-car-actual`)).toContainText(\n    expectedData!,\n  )\n\n  await expect(page.getByTestId(`${id}-foo`)).toContainText(\n    '{\"value\":\"server\"}',\n  )\n}\n\nasync function checkNestedData(page: Page) {\n  const expectedShout = await page\n    .getByTestId(`shout-expected-state`)\n    .textContent()\n  expect(expectedShout).not.toBeNull()\n  await expect(page.getByTestId(`shout-actual-state`)).toContainText(\n    expectedShout!,\n  )\n\n  const expectedWhisper = await page\n    .getByTestId(`whisper-expected-state`)\n    .textContent()\n  expect(expectedWhisper).not.toBeNull()\n  await expect(page.getByTestId(`whisper-actual-state`)).toContainText(\n    expectedWhisper!,\n  )\n}\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 499',\n  ],\n})\ntest.describe('SSR serialization adapters', () => {\n  test(`data-only`, async ({ page }) => {\n    await page.goto('/ssr/data-only')\n    await awaitPageLoaded(page)\n\n    await Promise.all(\n      ['context', 'loader'].map(async (id) => checkData(page, id)),\n    )\n\n    const expectedHonkData = await page\n      .getByTestId('honk-expected-state')\n      .textContent()\n    expect(expectedHonkData).not.toBeNull()\n    await expect(page.getByTestId('honk-actual-state')).toContainText(\n      expectedHonkData!,\n    )\n  })\n\n  test('stream', async ({ page }) => {\n    await page.goto('/ssr/stream')\n    await awaitPageLoaded(page)\n    await checkData(page, 'stream')\n  })\n\n  test('nested', async ({ page }) => {\n    await page.goto('/ssr/nested')\n    await awaitPageLoaded(page)\n\n    await checkNestedData(page)\n  })\n})\n\ntest.describe('server functions serialization adapters', () => {\n  test('custom error', async ({ page }) => {\n    await page.goto('/server-function/custom-error')\n    await awaitPageLoaded(page)\n\n    await expect(\n      page.getByTestId('server-function-valid-response'),\n    ).toContainText('null')\n    await expect(\n      page.getByTestId('server-function-invalid-response'),\n    ).toContainText('null')\n\n    await page.getByTestId('server-function-valid-input').click()\n    await expect(\n      page.getByTestId('server-function-valid-response'),\n    ).toContainText('Hello, world!')\n\n    await page.getByTestId('server-function-invalid-input').click()\n    await expect(\n      page.getByTestId('server-function-invalid-response'),\n    ).toContainText('{\"message\":\"Invalid input\",\"foo\":\"bar\",\"bar\":\"123\"}')\n  })\n  test('nested', async ({ page }) => {\n    await page.goto('/server-function/nested')\n    await awaitPageLoaded(page)\n\n    await expect(page.getByTestId('waiting-for-response')).toContainText(\n      'waiting for response...',\n    )\n\n    await page.getByTestId('server-function-trigger').click()\n    await checkNestedData(page)\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/serialization-adapters/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/server-functions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/server-functions/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/server-functions/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-server-functions\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"js-cookie\": \"^3.0.5\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nexport const PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/functions/fnOnlyCalledByServer.ts",
    "content": "import { createServerFn } from '@tanstack/react-start'\n\n// This function is ONLY called from the server, never directly from client code\nexport const fnOnlyCalledByServer = createServerFn().handler(() => {\n  return { message: 'hello from server-only function', secret: 42 }\n})\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SubmitPostFormdataRouteImport } from './routes/submit-post-formdata'\nimport { Route as StatusRouteImport } from './routes/status'\nimport { Route as ServerOnlyFnRouteImport } from './routes/server-only-fn'\nimport { Route as ServerFnInClientOnlyFnRouteImport } from './routes/server-fn-in-client-only-fn'\nimport { Route as SerializeFormDataRouteImport } from './routes/serialize-form-data'\nimport { Route as ReturnNullRouteImport } from './routes/return-null'\nimport { Route as RawResponseRouteImport } from './routes/raw-response'\nimport { Route as MultipartRouteImport } from './routes/multipart'\nimport { Route as IsomorphicFnsRouteImport } from './routes/isomorphic-fns'\nimport { Route as HeadersRouteImport } from './routes/headers'\nimport { Route as FormdataContextRouteImport } from './routes/formdata-context'\nimport { Route as EnvOnlyRouteImport } from './routes/env-only'\nimport { Route as DeadCodePreserveRouteImport } from './routes/dead-code-preserve'\nimport { Route as CustomFetchRouteImport } from './routes/custom-fetch'\nimport { Route as ConsistentRouteImport } from './routes/consistent'\nimport { Route as AsyncValidationRouteImport } from './routes/async-validation'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as RedirectTestIndexRouteImport } from './routes/redirect-test/index'\nimport { Route as RedirectTestSsrIndexRouteImport } from './routes/redirect-test-ssr/index'\nimport { Route as PrimitivesIndexRouteImport } from './routes/primitives/index'\nimport { Route as MiddlewareIndexRouteImport } from './routes/middleware/index'\nimport { Route as MethodNotAllowedIndexRouteImport } from './routes/method-not-allowed/index'\nimport { Route as FunctionMethodIndexRouteImport } from './routes/function-method/index'\nimport { Route as FunctionMetadataIndexRouteImport } from './routes/function-metadata/index'\nimport { Route as FormdataRedirectIndexRouteImport } from './routes/formdata-redirect/index'\nimport { Route as FactoryIndexRouteImport } from './routes/factory/index'\nimport { Route as CookiesIndexRouteImport } from './routes/cookies/index'\nimport { Route as AbortSignalIndexRouteImport } from './routes/abort-signal/index'\nimport { Route as RedirectTestTargetRouteImport } from './routes/redirect-test/target'\nimport { Route as RedirectTestSsrTargetRouteImport } from './routes/redirect-test-ssr/target'\nimport { Route as MiddlewareUnhandledExceptionRouteImport } from './routes/middleware/unhandled-exception'\nimport { Route as MiddlewareServerImportMiddlewareRouteImport } from './routes/middleware/server-import-middleware'\nimport { Route as MiddlewareSendServerFnRouteImport } from './routes/middleware/send-serverFn'\nimport { Route as MiddlewareRequestMiddlewareRouteImport } from './routes/middleware/request-middleware'\nimport { Route as MiddlewareMiddlewareFactoryRouteImport } from './routes/middleware/middleware-factory'\nimport { Route as MiddlewareFunctionMetadataRouteImport } from './routes/middleware/function-metadata'\nimport { Route as MiddlewareClientMiddlewareRouterRouteImport } from './routes/middleware/client-middleware-router'\nimport { Route as MiddlewareCatchHandlerErrorRouteImport } from './routes/middleware/catch-handler-error'\nimport { Route as MethodNotAllowedMethodRouteImport } from './routes/method-not-allowed/$method'\nimport { Route as CookiesSetRouteImport } from './routes/cookies/set'\nimport { Route as AbortSignalMethodRouteImport } from './routes/abort-signal/$method'\nimport { Route as MiddlewareRedirectWithMiddlewareIndexRouteImport } from './routes/middleware/redirect-with-middleware/index'\nimport { Route as MiddlewareRedirectWithMiddlewareTargetRouteImport } from './routes/middleware/redirect-with-middleware/target'\nimport { Route as FormdataRedirectTargetNameRouteImport } from './routes/formdata-redirect/target.$name'\n\nconst SubmitPostFormdataRoute = SubmitPostFormdataRouteImport.update({\n  id: '/submit-post-formdata',\n  path: '/submit-post-formdata',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst StatusRoute = StatusRouteImport.update({\n  id: '/status',\n  path: '/status',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ServerOnlyFnRoute = ServerOnlyFnRouteImport.update({\n  id: '/server-only-fn',\n  path: '/server-only-fn',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ServerFnInClientOnlyFnRoute = ServerFnInClientOnlyFnRouteImport.update({\n  id: '/server-fn-in-client-only-fn',\n  path: '/server-fn-in-client-only-fn',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SerializeFormDataRoute = SerializeFormDataRouteImport.update({\n  id: '/serialize-form-data',\n  path: '/serialize-form-data',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ReturnNullRoute = ReturnNullRouteImport.update({\n  id: '/return-null',\n  path: '/return-null',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawResponseRoute = RawResponseRouteImport.update({\n  id: '/raw-response',\n  path: '/raw-response',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MultipartRoute = MultipartRouteImport.update({\n  id: '/multipart',\n  path: '/multipart',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IsomorphicFnsRoute = IsomorphicFnsRouteImport.update({\n  id: '/isomorphic-fns',\n  path: '/isomorphic-fns',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst HeadersRoute = HeadersRouteImport.update({\n  id: '/headers',\n  path: '/headers',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FormdataContextRoute = FormdataContextRouteImport.update({\n  id: '/formdata-context',\n  path: '/formdata-context',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EnvOnlyRoute = EnvOnlyRouteImport.update({\n  id: '/env-only',\n  path: '/env-only',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeadCodePreserveRoute = DeadCodePreserveRouteImport.update({\n  id: '/dead-code-preserve',\n  path: '/dead-code-preserve',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CustomFetchRoute = CustomFetchRouteImport.update({\n  id: '/custom-fetch',\n  path: '/custom-fetch',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ConsistentRoute = ConsistentRouteImport.update({\n  id: '/consistent',\n  path: '/consistent',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AsyncValidationRoute = AsyncValidationRouteImport.update({\n  id: '/async-validation',\n  path: '/async-validation',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestIndexRoute = RedirectTestIndexRouteImport.update({\n  id: '/redirect-test/',\n  path: '/redirect-test/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestSsrIndexRoute = RedirectTestSsrIndexRouteImport.update({\n  id: '/redirect-test-ssr/',\n  path: '/redirect-test-ssr/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PrimitivesIndexRoute = PrimitivesIndexRouteImport.update({\n  id: '/primitives/',\n  path: '/primitives/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareIndexRoute = MiddlewareIndexRouteImport.update({\n  id: '/middleware/',\n  path: '/middleware/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MethodNotAllowedIndexRoute = MethodNotAllowedIndexRouteImport.update({\n  id: '/method-not-allowed/',\n  path: '/method-not-allowed/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FunctionMethodIndexRoute = FunctionMethodIndexRouteImport.update({\n  id: '/function-method/',\n  path: '/function-method/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FunctionMetadataIndexRoute = FunctionMetadataIndexRouteImport.update({\n  id: '/function-metadata/',\n  path: '/function-metadata/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FormdataRedirectIndexRoute = FormdataRedirectIndexRouteImport.update({\n  id: '/formdata-redirect/',\n  path: '/formdata-redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FactoryIndexRoute = FactoryIndexRouteImport.update({\n  id: '/factory/',\n  path: '/factory/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CookiesIndexRoute = CookiesIndexRouteImport.update({\n  id: '/cookies/',\n  path: '/cookies/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbortSignalIndexRoute = AbortSignalIndexRouteImport.update({\n  id: '/abort-signal/',\n  path: '/abort-signal/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestTargetRoute = RedirectTestTargetRouteImport.update({\n  id: '/redirect-test/target',\n  path: '/redirect-test/target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestSsrTargetRoute = RedirectTestSsrTargetRouteImport.update({\n  id: '/redirect-test-ssr/target',\n  path: '/redirect-test-ssr/target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareUnhandledExceptionRoute =\n  MiddlewareUnhandledExceptionRouteImport.update({\n    id: '/middleware/unhandled-exception',\n    path: '/middleware/unhandled-exception',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareServerImportMiddlewareRoute =\n  MiddlewareServerImportMiddlewareRouteImport.update({\n    id: '/middleware/server-import-middleware',\n    path: '/middleware/server-import-middleware',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareSendServerFnRoute = MiddlewareSendServerFnRouteImport.update({\n  id: '/middleware/send-serverFn',\n  path: '/middleware/send-serverFn',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareRequestMiddlewareRoute =\n  MiddlewareRequestMiddlewareRouteImport.update({\n    id: '/middleware/request-middleware',\n    path: '/middleware/request-middleware',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareMiddlewareFactoryRoute =\n  MiddlewareMiddlewareFactoryRouteImport.update({\n    id: '/middleware/middleware-factory',\n    path: '/middleware/middleware-factory',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareFunctionMetadataRoute =\n  MiddlewareFunctionMetadataRouteImport.update({\n    id: '/middleware/function-metadata',\n    path: '/middleware/function-metadata',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareClientMiddlewareRouterRoute =\n  MiddlewareClientMiddlewareRouterRouteImport.update({\n    id: '/middleware/client-middleware-router',\n    path: '/middleware/client-middleware-router',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareCatchHandlerErrorRoute =\n  MiddlewareCatchHandlerErrorRouteImport.update({\n    id: '/middleware/catch-handler-error',\n    path: '/middleware/catch-handler-error',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MethodNotAllowedMethodRoute = MethodNotAllowedMethodRouteImport.update({\n  id: '/method-not-allowed/$method',\n  path: '/method-not-allowed/$method',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CookiesSetRoute = CookiesSetRouteImport.update({\n  id: '/cookies/set',\n  path: '/cookies/set',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbortSignalMethodRoute = AbortSignalMethodRouteImport.update({\n  id: '/abort-signal/$method',\n  path: '/abort-signal/$method',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareRedirectWithMiddlewareIndexRoute =\n  MiddlewareRedirectWithMiddlewareIndexRouteImport.update({\n    id: '/middleware/redirect-with-middleware/',\n    path: '/middleware/redirect-with-middleware/',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareRedirectWithMiddlewareTargetRoute =\n  MiddlewareRedirectWithMiddlewareTargetRouteImport.update({\n    id: '/middleware/redirect-with-middleware/target',\n    path: '/middleware/redirect-with-middleware/target',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst FormdataRedirectTargetNameRoute =\n  FormdataRedirectTargetNameRouteImport.update({\n    id: '/formdata-redirect/target/$name',\n    path: '/formdata-redirect/target/$name',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/async-validation': typeof AsyncValidationRoute\n  '/consistent': typeof ConsistentRoute\n  '/custom-fetch': typeof CustomFetchRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/formdata-context': typeof FormdataContextRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/server-fn-in-client-only-fn': typeof ServerFnInClientOnlyFnRoute\n  '/server-only-fn': typeof ServerOnlyFnRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/abort-signal/$method': typeof AbortSignalMethodRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/method-not-allowed/$method': typeof MethodNotAllowedMethodRoute\n  '/middleware/catch-handler-error': typeof MiddlewareCatchHandlerErrorRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/function-metadata': typeof MiddlewareFunctionMetadataRoute\n  '/middleware/middleware-factory': typeof MiddlewareMiddlewareFactoryRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/middleware/server-import-middleware': typeof MiddlewareServerImportMiddlewareRoute\n  '/middleware/unhandled-exception': typeof MiddlewareUnhandledExceptionRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/abort-signal/': typeof AbortSignalIndexRoute\n  '/cookies/': typeof CookiesIndexRoute\n  '/factory/': typeof FactoryIndexRoute\n  '/formdata-redirect/': typeof FormdataRedirectIndexRoute\n  '/function-metadata/': typeof FunctionMetadataIndexRoute\n  '/function-method/': typeof FunctionMethodIndexRoute\n  '/method-not-allowed/': typeof MethodNotAllowedIndexRoute\n  '/middleware/': typeof MiddlewareIndexRoute\n  '/primitives/': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr/': typeof RedirectTestSsrIndexRoute\n  '/redirect-test/': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n  '/middleware/redirect-with-middleware/target': typeof MiddlewareRedirectWithMiddlewareTargetRoute\n  '/middleware/redirect-with-middleware/': typeof MiddlewareRedirectWithMiddlewareIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/async-validation': typeof AsyncValidationRoute\n  '/consistent': typeof ConsistentRoute\n  '/custom-fetch': typeof CustomFetchRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/formdata-context': typeof FormdataContextRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/server-fn-in-client-only-fn': typeof ServerFnInClientOnlyFnRoute\n  '/server-only-fn': typeof ServerOnlyFnRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/abort-signal/$method': typeof AbortSignalMethodRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/method-not-allowed/$method': typeof MethodNotAllowedMethodRoute\n  '/middleware/catch-handler-error': typeof MiddlewareCatchHandlerErrorRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/function-metadata': typeof MiddlewareFunctionMetadataRoute\n  '/middleware/middleware-factory': typeof MiddlewareMiddlewareFactoryRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/middleware/server-import-middleware': typeof MiddlewareServerImportMiddlewareRoute\n  '/middleware/unhandled-exception': typeof MiddlewareUnhandledExceptionRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/abort-signal': typeof AbortSignalIndexRoute\n  '/cookies': typeof CookiesIndexRoute\n  '/factory': typeof FactoryIndexRoute\n  '/formdata-redirect': typeof FormdataRedirectIndexRoute\n  '/function-metadata': typeof FunctionMetadataIndexRoute\n  '/function-method': typeof FunctionMethodIndexRoute\n  '/method-not-allowed': typeof MethodNotAllowedIndexRoute\n  '/middleware': typeof MiddlewareIndexRoute\n  '/primitives': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr': typeof RedirectTestSsrIndexRoute\n  '/redirect-test': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n  '/middleware/redirect-with-middleware/target': typeof MiddlewareRedirectWithMiddlewareTargetRoute\n  '/middleware/redirect-with-middleware': typeof MiddlewareRedirectWithMiddlewareIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/async-validation': typeof AsyncValidationRoute\n  '/consistent': typeof ConsistentRoute\n  '/custom-fetch': typeof CustomFetchRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/formdata-context': typeof FormdataContextRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/server-fn-in-client-only-fn': typeof ServerFnInClientOnlyFnRoute\n  '/server-only-fn': typeof ServerOnlyFnRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/abort-signal/$method': typeof AbortSignalMethodRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/method-not-allowed/$method': typeof MethodNotAllowedMethodRoute\n  '/middleware/catch-handler-error': typeof MiddlewareCatchHandlerErrorRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/function-metadata': typeof MiddlewareFunctionMetadataRoute\n  '/middleware/middleware-factory': typeof MiddlewareMiddlewareFactoryRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/middleware/server-import-middleware': typeof MiddlewareServerImportMiddlewareRoute\n  '/middleware/unhandled-exception': typeof MiddlewareUnhandledExceptionRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/abort-signal/': typeof AbortSignalIndexRoute\n  '/cookies/': typeof CookiesIndexRoute\n  '/factory/': typeof FactoryIndexRoute\n  '/formdata-redirect/': typeof FormdataRedirectIndexRoute\n  '/function-metadata/': typeof FunctionMetadataIndexRoute\n  '/function-method/': typeof FunctionMethodIndexRoute\n  '/method-not-allowed/': typeof MethodNotAllowedIndexRoute\n  '/middleware/': typeof MiddlewareIndexRoute\n  '/primitives/': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr/': typeof RedirectTestSsrIndexRoute\n  '/redirect-test/': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n  '/middleware/redirect-with-middleware/target': typeof MiddlewareRedirectWithMiddlewareTargetRoute\n  '/middleware/redirect-with-middleware/': typeof MiddlewareRedirectWithMiddlewareIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/async-validation'\n    | '/consistent'\n    | '/custom-fetch'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/formdata-context'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/server-fn-in-client-only-fn'\n    | '/server-only-fn'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/abort-signal/$method'\n    | '/cookies/set'\n    | '/method-not-allowed/$method'\n    | '/middleware/catch-handler-error'\n    | '/middleware/client-middleware-router'\n    | '/middleware/function-metadata'\n    | '/middleware/middleware-factory'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/middleware/server-import-middleware'\n    | '/middleware/unhandled-exception'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/abort-signal/'\n    | '/cookies/'\n    | '/factory/'\n    | '/formdata-redirect/'\n    | '/function-metadata/'\n    | '/function-method/'\n    | '/method-not-allowed/'\n    | '/middleware/'\n    | '/primitives/'\n    | '/redirect-test-ssr/'\n    | '/redirect-test/'\n    | '/formdata-redirect/target/$name'\n    | '/middleware/redirect-with-middleware/target'\n    | '/middleware/redirect-with-middleware/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/async-validation'\n    | '/consistent'\n    | '/custom-fetch'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/formdata-context'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/server-fn-in-client-only-fn'\n    | '/server-only-fn'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/abort-signal/$method'\n    | '/cookies/set'\n    | '/method-not-allowed/$method'\n    | '/middleware/catch-handler-error'\n    | '/middleware/client-middleware-router'\n    | '/middleware/function-metadata'\n    | '/middleware/middleware-factory'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/middleware/server-import-middleware'\n    | '/middleware/unhandled-exception'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/abort-signal'\n    | '/cookies'\n    | '/factory'\n    | '/formdata-redirect'\n    | '/function-metadata'\n    | '/function-method'\n    | '/method-not-allowed'\n    | '/middleware'\n    | '/primitives'\n    | '/redirect-test-ssr'\n    | '/redirect-test'\n    | '/formdata-redirect/target/$name'\n    | '/middleware/redirect-with-middleware/target'\n    | '/middleware/redirect-with-middleware'\n  id:\n    | '__root__'\n    | '/'\n    | '/async-validation'\n    | '/consistent'\n    | '/custom-fetch'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/formdata-context'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/server-fn-in-client-only-fn'\n    | '/server-only-fn'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/abort-signal/$method'\n    | '/cookies/set'\n    | '/method-not-allowed/$method'\n    | '/middleware/catch-handler-error'\n    | '/middleware/client-middleware-router'\n    | '/middleware/function-metadata'\n    | '/middleware/middleware-factory'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/middleware/server-import-middleware'\n    | '/middleware/unhandled-exception'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/abort-signal/'\n    | '/cookies/'\n    | '/factory/'\n    | '/formdata-redirect/'\n    | '/function-metadata/'\n    | '/function-method/'\n    | '/method-not-allowed/'\n    | '/middleware/'\n    | '/primitives/'\n    | '/redirect-test-ssr/'\n    | '/redirect-test/'\n    | '/formdata-redirect/target/$name'\n    | '/middleware/redirect-with-middleware/target'\n    | '/middleware/redirect-with-middleware/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AsyncValidationRoute: typeof AsyncValidationRoute\n  ConsistentRoute: typeof ConsistentRoute\n  CustomFetchRoute: typeof CustomFetchRoute\n  DeadCodePreserveRoute: typeof DeadCodePreserveRoute\n  EnvOnlyRoute: typeof EnvOnlyRoute\n  FormdataContextRoute: typeof FormdataContextRoute\n  HeadersRoute: typeof HeadersRoute\n  IsomorphicFnsRoute: typeof IsomorphicFnsRoute\n  MultipartRoute: typeof MultipartRoute\n  RawResponseRoute: typeof RawResponseRoute\n  ReturnNullRoute: typeof ReturnNullRoute\n  SerializeFormDataRoute: typeof SerializeFormDataRoute\n  ServerFnInClientOnlyFnRoute: typeof ServerFnInClientOnlyFnRoute\n  ServerOnlyFnRoute: typeof ServerOnlyFnRoute\n  StatusRoute: typeof StatusRoute\n  SubmitPostFormdataRoute: typeof SubmitPostFormdataRoute\n  AbortSignalMethodRoute: typeof AbortSignalMethodRoute\n  CookiesSetRoute: typeof CookiesSetRoute\n  MethodNotAllowedMethodRoute: typeof MethodNotAllowedMethodRoute\n  MiddlewareCatchHandlerErrorRoute: typeof MiddlewareCatchHandlerErrorRoute\n  MiddlewareClientMiddlewareRouterRoute: typeof MiddlewareClientMiddlewareRouterRoute\n  MiddlewareFunctionMetadataRoute: typeof MiddlewareFunctionMetadataRoute\n  MiddlewareMiddlewareFactoryRoute: typeof MiddlewareMiddlewareFactoryRoute\n  MiddlewareRequestMiddlewareRoute: typeof MiddlewareRequestMiddlewareRoute\n  MiddlewareSendServerFnRoute: typeof MiddlewareSendServerFnRoute\n  MiddlewareServerImportMiddlewareRoute: typeof MiddlewareServerImportMiddlewareRoute\n  MiddlewareUnhandledExceptionRoute: typeof MiddlewareUnhandledExceptionRoute\n  RedirectTestSsrTargetRoute: typeof RedirectTestSsrTargetRoute\n  RedirectTestTargetRoute: typeof RedirectTestTargetRoute\n  AbortSignalIndexRoute: typeof AbortSignalIndexRoute\n  CookiesIndexRoute: typeof CookiesIndexRoute\n  FactoryIndexRoute: typeof FactoryIndexRoute\n  FormdataRedirectIndexRoute: typeof FormdataRedirectIndexRoute\n  FunctionMetadataIndexRoute: typeof FunctionMetadataIndexRoute\n  FunctionMethodIndexRoute: typeof FunctionMethodIndexRoute\n  MethodNotAllowedIndexRoute: typeof MethodNotAllowedIndexRoute\n  MiddlewareIndexRoute: typeof MiddlewareIndexRoute\n  PrimitivesIndexRoute: typeof PrimitivesIndexRoute\n  RedirectTestSsrIndexRoute: typeof RedirectTestSsrIndexRoute\n  RedirectTestIndexRoute: typeof RedirectTestIndexRoute\n  FormdataRedirectTargetNameRoute: typeof FormdataRedirectTargetNameRoute\n  MiddlewareRedirectWithMiddlewareTargetRoute: typeof MiddlewareRedirectWithMiddlewareTargetRoute\n  MiddlewareRedirectWithMiddlewareIndexRoute: typeof MiddlewareRedirectWithMiddlewareIndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/submit-post-formdata': {\n      id: '/submit-post-formdata'\n      path: '/submit-post-formdata'\n      fullPath: '/submit-post-formdata'\n      preLoaderRoute: typeof SubmitPostFormdataRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/status': {\n      id: '/status'\n      path: '/status'\n      fullPath: '/status'\n      preLoaderRoute: typeof StatusRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/server-only-fn': {\n      id: '/server-only-fn'\n      path: '/server-only-fn'\n      fullPath: '/server-only-fn'\n      preLoaderRoute: typeof ServerOnlyFnRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/server-fn-in-client-only-fn': {\n      id: '/server-fn-in-client-only-fn'\n      path: '/server-fn-in-client-only-fn'\n      fullPath: '/server-fn-in-client-only-fn'\n      preLoaderRoute: typeof ServerFnInClientOnlyFnRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/serialize-form-data': {\n      id: '/serialize-form-data'\n      path: '/serialize-form-data'\n      fullPath: '/serialize-form-data'\n      preLoaderRoute: typeof SerializeFormDataRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/return-null': {\n      id: '/return-null'\n      path: '/return-null'\n      fullPath: '/return-null'\n      preLoaderRoute: typeof ReturnNullRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-response': {\n      id: '/raw-response'\n      path: '/raw-response'\n      fullPath: '/raw-response'\n      preLoaderRoute: typeof RawResponseRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/multipart': {\n      id: '/multipart'\n      path: '/multipart'\n      fullPath: '/multipart'\n      preLoaderRoute: typeof MultipartRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/isomorphic-fns': {\n      id: '/isomorphic-fns'\n      path: '/isomorphic-fns'\n      fullPath: '/isomorphic-fns'\n      preLoaderRoute: typeof IsomorphicFnsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/headers': {\n      id: '/headers'\n      path: '/headers'\n      fullPath: '/headers'\n      preLoaderRoute: typeof HeadersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/formdata-context': {\n      id: '/formdata-context'\n      path: '/formdata-context'\n      fullPath: '/formdata-context'\n      preLoaderRoute: typeof FormdataContextRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/env-only': {\n      id: '/env-only'\n      path: '/env-only'\n      fullPath: '/env-only'\n      preLoaderRoute: typeof EnvOnlyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dead-code-preserve': {\n      id: '/dead-code-preserve'\n      path: '/dead-code-preserve'\n      fullPath: '/dead-code-preserve'\n      preLoaderRoute: typeof DeadCodePreserveRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/custom-fetch': {\n      id: '/custom-fetch'\n      path: '/custom-fetch'\n      fullPath: '/custom-fetch'\n      preLoaderRoute: typeof CustomFetchRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/consistent': {\n      id: '/consistent'\n      path: '/consistent'\n      fullPath: '/consistent'\n      preLoaderRoute: typeof ConsistentRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/async-validation': {\n      id: '/async-validation'\n      path: '/async-validation'\n      fullPath: '/async-validation'\n      preLoaderRoute: typeof AsyncValidationRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test/': {\n      id: '/redirect-test/'\n      path: '/redirect-test'\n      fullPath: '/redirect-test/'\n      preLoaderRoute: typeof RedirectTestIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test-ssr/': {\n      id: '/redirect-test-ssr/'\n      path: '/redirect-test-ssr'\n      fullPath: '/redirect-test-ssr/'\n      preLoaderRoute: typeof RedirectTestSsrIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/primitives/': {\n      id: '/primitives/'\n      path: '/primitives'\n      fullPath: '/primitives/'\n      preLoaderRoute: typeof PrimitivesIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/': {\n      id: '/middleware/'\n      path: '/middleware'\n      fullPath: '/middleware/'\n      preLoaderRoute: typeof MiddlewareIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/method-not-allowed/': {\n      id: '/method-not-allowed/'\n      path: '/method-not-allowed'\n      fullPath: '/method-not-allowed/'\n      preLoaderRoute: typeof MethodNotAllowedIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/function-method/': {\n      id: '/function-method/'\n      path: '/function-method'\n      fullPath: '/function-method/'\n      preLoaderRoute: typeof FunctionMethodIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/function-metadata/': {\n      id: '/function-metadata/'\n      path: '/function-metadata'\n      fullPath: '/function-metadata/'\n      preLoaderRoute: typeof FunctionMetadataIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/formdata-redirect/': {\n      id: '/formdata-redirect/'\n      path: '/formdata-redirect'\n      fullPath: '/formdata-redirect/'\n      preLoaderRoute: typeof FormdataRedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/factory/': {\n      id: '/factory/'\n      path: '/factory'\n      fullPath: '/factory/'\n      preLoaderRoute: typeof FactoryIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/cookies/': {\n      id: '/cookies/'\n      path: '/cookies'\n      fullPath: '/cookies/'\n      preLoaderRoute: typeof CookiesIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/abort-signal/': {\n      id: '/abort-signal/'\n      path: '/abort-signal'\n      fullPath: '/abort-signal/'\n      preLoaderRoute: typeof AbortSignalIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test/target': {\n      id: '/redirect-test/target'\n      path: '/redirect-test/target'\n      fullPath: '/redirect-test/target'\n      preLoaderRoute: typeof RedirectTestTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test-ssr/target': {\n      id: '/redirect-test-ssr/target'\n      path: '/redirect-test-ssr/target'\n      fullPath: '/redirect-test-ssr/target'\n      preLoaderRoute: typeof RedirectTestSsrTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/unhandled-exception': {\n      id: '/middleware/unhandled-exception'\n      path: '/middleware/unhandled-exception'\n      fullPath: '/middleware/unhandled-exception'\n      preLoaderRoute: typeof MiddlewareUnhandledExceptionRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/server-import-middleware': {\n      id: '/middleware/server-import-middleware'\n      path: '/middleware/server-import-middleware'\n      fullPath: '/middleware/server-import-middleware'\n      preLoaderRoute: typeof MiddlewareServerImportMiddlewareRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/send-serverFn': {\n      id: '/middleware/send-serverFn'\n      path: '/middleware/send-serverFn'\n      fullPath: '/middleware/send-serverFn'\n      preLoaderRoute: typeof MiddlewareSendServerFnRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/request-middleware': {\n      id: '/middleware/request-middleware'\n      path: '/middleware/request-middleware'\n      fullPath: '/middleware/request-middleware'\n      preLoaderRoute: typeof MiddlewareRequestMiddlewareRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/middleware-factory': {\n      id: '/middleware/middleware-factory'\n      path: '/middleware/middleware-factory'\n      fullPath: '/middleware/middleware-factory'\n      preLoaderRoute: typeof MiddlewareMiddlewareFactoryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/function-metadata': {\n      id: '/middleware/function-metadata'\n      path: '/middleware/function-metadata'\n      fullPath: '/middleware/function-metadata'\n      preLoaderRoute: typeof MiddlewareFunctionMetadataRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/client-middleware-router': {\n      id: '/middleware/client-middleware-router'\n      path: '/middleware/client-middleware-router'\n      fullPath: '/middleware/client-middleware-router'\n      preLoaderRoute: typeof MiddlewareClientMiddlewareRouterRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/catch-handler-error': {\n      id: '/middleware/catch-handler-error'\n      path: '/middleware/catch-handler-error'\n      fullPath: '/middleware/catch-handler-error'\n      preLoaderRoute: typeof MiddlewareCatchHandlerErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/method-not-allowed/$method': {\n      id: '/method-not-allowed/$method'\n      path: '/method-not-allowed/$method'\n      fullPath: '/method-not-allowed/$method'\n      preLoaderRoute: typeof MethodNotAllowedMethodRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/cookies/set': {\n      id: '/cookies/set'\n      path: '/cookies/set'\n      fullPath: '/cookies/set'\n      preLoaderRoute: typeof CookiesSetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/abort-signal/$method': {\n      id: '/abort-signal/$method'\n      path: '/abort-signal/$method'\n      fullPath: '/abort-signal/$method'\n      preLoaderRoute: typeof AbortSignalMethodRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/redirect-with-middleware/': {\n      id: '/middleware/redirect-with-middleware/'\n      path: '/middleware/redirect-with-middleware'\n      fullPath: '/middleware/redirect-with-middleware/'\n      preLoaderRoute: typeof MiddlewareRedirectWithMiddlewareIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/redirect-with-middleware/target': {\n      id: '/middleware/redirect-with-middleware/target'\n      path: '/middleware/redirect-with-middleware/target'\n      fullPath: '/middleware/redirect-with-middleware/target'\n      preLoaderRoute: typeof MiddlewareRedirectWithMiddlewareTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/formdata-redirect/target/$name': {\n      id: '/formdata-redirect/target/$name'\n      path: '/formdata-redirect/target/$name'\n      fullPath: '/formdata-redirect/target/$name'\n      preLoaderRoute: typeof FormdataRedirectTargetNameRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AsyncValidationRoute: AsyncValidationRoute,\n  ConsistentRoute: ConsistentRoute,\n  CustomFetchRoute: CustomFetchRoute,\n  DeadCodePreserveRoute: DeadCodePreserveRoute,\n  EnvOnlyRoute: EnvOnlyRoute,\n  FormdataContextRoute: FormdataContextRoute,\n  HeadersRoute: HeadersRoute,\n  IsomorphicFnsRoute: IsomorphicFnsRoute,\n  MultipartRoute: MultipartRoute,\n  RawResponseRoute: RawResponseRoute,\n  ReturnNullRoute: ReturnNullRoute,\n  SerializeFormDataRoute: SerializeFormDataRoute,\n  ServerFnInClientOnlyFnRoute: ServerFnInClientOnlyFnRoute,\n  ServerOnlyFnRoute: ServerOnlyFnRoute,\n  StatusRoute: StatusRoute,\n  SubmitPostFormdataRoute: SubmitPostFormdataRoute,\n  AbortSignalMethodRoute: AbortSignalMethodRoute,\n  CookiesSetRoute: CookiesSetRoute,\n  MethodNotAllowedMethodRoute: MethodNotAllowedMethodRoute,\n  MiddlewareCatchHandlerErrorRoute: MiddlewareCatchHandlerErrorRoute,\n  MiddlewareClientMiddlewareRouterRoute: MiddlewareClientMiddlewareRouterRoute,\n  MiddlewareFunctionMetadataRoute: MiddlewareFunctionMetadataRoute,\n  MiddlewareMiddlewareFactoryRoute: MiddlewareMiddlewareFactoryRoute,\n  MiddlewareRequestMiddlewareRoute: MiddlewareRequestMiddlewareRoute,\n  MiddlewareSendServerFnRoute: MiddlewareSendServerFnRoute,\n  MiddlewareServerImportMiddlewareRoute: MiddlewareServerImportMiddlewareRoute,\n  MiddlewareUnhandledExceptionRoute: MiddlewareUnhandledExceptionRoute,\n  RedirectTestSsrTargetRoute: RedirectTestSsrTargetRoute,\n  RedirectTestTargetRoute: RedirectTestTargetRoute,\n  AbortSignalIndexRoute: AbortSignalIndexRoute,\n  CookiesIndexRoute: CookiesIndexRoute,\n  FactoryIndexRoute: FactoryIndexRoute,\n  FormdataRedirectIndexRoute: FormdataRedirectIndexRoute,\n  FunctionMetadataIndexRoute: FunctionMetadataIndexRoute,\n  FunctionMethodIndexRoute: FunctionMethodIndexRoute,\n  MethodNotAllowedIndexRoute: MethodNotAllowedIndexRoute,\n  MiddlewareIndexRoute: MiddlewareIndexRoute,\n  PrimitivesIndexRoute: PrimitivesIndexRoute,\n  RedirectTestSsrIndexRoute: RedirectTestSsrIndexRoute,\n  RedirectTestIndexRoute: RedirectTestIndexRoute,\n  FormdataRedirectTargetNameRoute: FormdataRedirectTargetNameRoute,\n  MiddlewareRedirectWithMiddlewareTargetRoute:\n    MiddlewareRedirectWithMiddlewareTargetRoute,\n  MiddlewareRedirectWithMiddlewareIndexRoute:\n    MiddlewareRedirectWithMiddlewareIndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { startInstance } from './start.ts'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n    config: Awaited<ReturnType<typeof startInstance.getOptions>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { QueryClient } from '@tanstack/react-query'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n    context: {\n      foo: {\n        bar: 'baz',\n      },\n    },\n  })\n  setupRouterSsrQueryIntegration({ router, queryClient })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\n\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRouteWithContext<{ foo: { bar: string } }>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nconst RouterDevtools =\n  process.env.NODE_ENV === 'production'\n    ? () => null // Render nothing in production\n    : React.lazy(() =>\n        // Lazy load in development\n        import('@tanstack/react-router-devtools').then((res) => ({\n          default: res.TanStackRouterDevtools,\n        })),\n      )\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <RouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/abort-signal/$method.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn, createServerOnlyFn } from '@tanstack/react-start'\nimport { getRequest } from '@tanstack/react-start/server'\nimport React from 'react'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/abort-signal/$method')({\n  params: z.object({\n    method: z.union([z.literal('GET'), z.literal('POST')]),\n  }),\n  component: RouteComponent,\n})\n\nconst serverFnImpl = createServerOnlyFn(async () => {\n  const request = getRequest()\n  const signal = request.signal\n  console.log('server function started', { signal })\n  return new Promise<string>((resolve, reject) => {\n    if (signal.aborted) {\n      return reject(new Error('Aborted before start'))\n    }\n    const timerId = setTimeout(() => {\n      console.log('server function finished')\n      resolve('server function result')\n    }, 1000)\n    const onAbort = () => {\n      clearTimeout(timerId)\n      console.log('server function aborted')\n      reject(new Error('Aborted'))\n    }\n    signal.addEventListener('abort', onAbort, { once: true })\n  })\n})\n\nconst abortableServerFnGET = createServerFn().handler(serverFnImpl)\n\nconst abortableServerFnPOST = createServerFn({ method: 'POST' }).handler(\n  serverFnImpl,\n)\n\nfunction RouteComponent() {\n  const method = Route.useParams().method\n  const abortableServerFn =\n    method === 'GET' ? abortableServerFnGET : abortableServerFnPOST\n  const [errorMessage, setErrorMessage] = React.useState<string | undefined>(\n    undefined,\n  )\n  const [result, setResult] = React.useState<string | undefined>(undefined)\n\n  const reset = () => {\n    setErrorMessage(undefined)\n    setResult(undefined)\n  }\n  return (\n    <div>\n      <button\n        data-testid=\"run-with-abort-btn\"\n        onClick={async () => {\n          reset()\n          const controller = new AbortController()\n          const serverFnPromise = abortableServerFn({\n            signal: controller.signal,\n          })\n          const timeoutPromise = new Promise((resolve) =>\n            setTimeout(resolve, 500),\n          )\n          await timeoutPromise\n          controller.abort()\n          try {\n            const serverFnResult = await serverFnPromise\n            setResult(serverFnResult)\n          } catch (error) {\n            setErrorMessage((error as any).message)\n          }\n        }}\n      >\n        call server function with abort signal\n      </button>\n      <br />\n      <button\n        data-testid=\"run-without-abort-btn\"\n        onClick={async () => {\n          reset()\n          const serverFnResult = await abortableServerFn()\n          setResult(serverFnResult)\n        }}\n      >\n        call server function\n      </button>\n      <div className=\"p-2\">\n        result: <p data-testid=\"result\">{result ?? '$undefined'}</p>\n      </div>\n      <div className=\"p-2\">\n        message:{' '}\n        <p data-testid=\"errorMessage\">{errorMessage ?? '$undefined'}</p>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/abort-signal/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/abort-signal/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg\">\n        Server functions E2E Abort Signal Tests\n      </h1>\n      <ul className=\"list-disc p-4\">\n        <li>\n          <Link to=\"/abort-signal/$method\" params={{ method: 'GET' }}>\n            Abortable server function call with GET\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/abort-signal/$method\" params={{ method: 'POST' }}>\n            Abortable server function call with POST\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/async-validation.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport React from 'react'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/async-validation')({\n  component: RouteComponent,\n})\n\nconst asyncValidationSchema = z\n  .string()\n  .refine((data) => Promise.resolve(data !== 'invalid'))\n\nconst asyncValidationServerFn = createServerFn()\n  .inputValidator(asyncValidationSchema)\n  .handler(({ data }) => data)\n\nfunction RouteComponent() {\n  const [errorMessage, setErrorMessage] = React.useState<string | undefined>(\n    undefined,\n  )\n  const [result, setResult] = React.useState<string | undefined>(undefined)\n\n  const callServerFn = async (value: string) => {\n    setErrorMessage(undefined)\n    setResult(undefined)\n\n    try {\n      const serverFnResult = await asyncValidationServerFn({ data: value })\n      setResult(serverFnResult)\n    } catch (error) {\n      setErrorMessage(error instanceof Error ? error.message : 'unknown')\n    }\n  }\n\n  return (\n    <div>\n      <button\n        data-testid=\"run-with-valid-btn\"\n        onClick={() => {\n          callServerFn('valid')\n        }}\n      >\n        call server function with valid value\n      </button>\n      <br />\n      <button\n        data-testid=\"run-with-invalid-btn\"\n        onClick={() => {\n          callServerFn('invalid')\n        }}\n      >\n        call server function with invalid value\n      </button>\n      <div className=\"p-2\">\n        result: <p data-testid=\"result\">{result ?? '$undefined'}</p>\n      </div>\n      <div className=\"p-2\">\n        message:{' '}\n        <p data-testid=\"errorMessage\">{errorMessage ?? '$undefined'}</p>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/consistent.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { createServerFn } from '@tanstack/react-start'\n\n/**\n * This checks whether the returned payloads from a\n * server function are the same, regardless of whether the server function is\n * called directly from the client or from within the server function.\n * @link https://github.com/TanStack/router/issues/1866\n * @link https://github.com/TanStack/router/issues/2481\n */\n\nexport const Route = createFileRoute('/consistent')({\n  component: ConsistentServerFnCalls,\n  loader: async () => {\n    const data = await cons_serverGetFn1({ data: { username: 'TEST' } })\n    console.log('cons_serverGetFn1', data)\n    return { data }\n  },\n})\n\nconst cons_getFn1 = createServerFn()\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return { payload: data }\n  })\n\nconst cons_serverGetFn1 = createServerFn()\n  .inputValidator((d: { username: string }) => d)\n  .handler(async ({ data }) => {\n    return cons_getFn1({ data })\n  })\n\nconst cons_postFn1 = createServerFn({ method: 'POST' })\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return { payload: data }\n  })\n\nconst cons_serverPostFn1 = createServerFn({ method: 'POST' })\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return cons_postFn1({ data })\n  })\n\nfunction ConsistentServerFnCalls() {\n  const [getServerResult, setGetServerResult] = React.useState({})\n  const [getDirectResult, setGetDirectResult] = React.useState({})\n\n  const [postServerResult, setPostServerResult] = React.useState({})\n  const [postDirectResult, setPostDirectResult] = React.useState({})\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Consistent Server Fn GET Calls</h3>\n      <p>\n        This component checks whether the returned payloads from server function\n        are the same, regardless of whether the server function is called\n        directly from the client or from within the server function.\n      </p>\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-consistent-server-fns-result\">\n            {JSON.stringify({ payload: { username: 'TEST' } })}\n          </pre>\n        </code>\n      </div>\n      <p>\n        {`GET: cons_getFn1 called from server cons_serverGetFn1 returns`}\n        <br />\n        <span data-testid=\"cons_serverGetFn1-response\">\n          {JSON.stringify(getServerResult)}\n        </span>\n      </p>\n      <p>\n        {`GET: cons_getFn1 called directly returns`}\n        <br />\n        <span data-testid=\"cons_getFn1-response\">\n          {JSON.stringify(getDirectResult)}\n        </span>\n      </p>\n      <p>\n        {`POST: cons_postFn1 called from cons_serverPostFn1 returns`}\n        <br />\n        <span data-testid=\"cons_serverPostFn1-response\">\n          {JSON.stringify(postServerResult)}\n        </span>\n      </p>\n      <p>\n        {`POST: cons_postFn1 called directly returns`}\n        <br />\n        <span data-testid=\"cons_postFn1-response\">\n          {JSON.stringify(postDirectResult)}\n        </span>\n      </p>\n      <button\n        data-testid=\"test-consistent-server-fn-calls-btn\"\n        type=\"button\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          // GET calls\n          cons_serverGetFn1({ data: { username: 'TEST' } }).then(\n            setGetServerResult,\n          )\n          cons_getFn1({ data: { username: 'TEST' } }).then(setGetDirectResult)\n\n          // POST calls\n          cons_serverPostFn1({ data: { username: 'TEST' } }).then(\n            setPostServerResult,\n          )\n          cons_postFn1({ data: { username: 'TEST' } }).then(setPostDirectResult)\n\n          cons_postFn1({ data: { username: 'TEST' } }).then(setPostDirectResult)\n        }}\n      >\n        Test Consistent server function responses\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/cookies/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst cookieSchema = z\n  .object({ value: z.string() })\n  .catch(() => ({ value: `CLIENT-${Date.now()}` }))\nexport const Route = createFileRoute('/cookies/')({\n  validateSearch: cookieSchema,\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n  return (\n    <Link data-testid=\"link-to-set\" from=\"/cookies/\" to=\"./set\" search={search}>\n      got to route that sets the cookies with {JSON.stringify(search)}\n    </Link>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/cookies/set.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { setCookie } from '@tanstack/react-start/server'\nimport { z } from 'zod'\nimport Cookies from 'js-cookie'\nimport React, { useEffect } from 'react'\n\nconst cookieSchema = z.object({ value: z.string() })\n\nexport const Route = createFileRoute('/cookies/set')({\n  validateSearch: cookieSchema,\n  loaderDeps: ({ search }) => search,\n  loader: async ({ deps }) => {\n    await setCookieServerFn1({ data: deps })\n    await setCookieServerFn2({ data: deps })\n  },\n  component: RouteComponent,\n})\n\nexport const setCookieServerFn1 = createServerFn()\n  .inputValidator(cookieSchema)\n  .handler(({ data }) => {\n    setCookie(`cookie-1-${data.value}`, data.value)\n    setCookie(`cookie-2-${data.value}`, data.value)\n  })\n\nexport const setCookieServerFn2 = createServerFn()\n  .inputValidator(cookieSchema)\n  .handler(({ data }) => {\n    setCookie(`cookie-3-${data.value}`, data.value)\n    setCookie(`cookie-4-${data.value}`, data.value)\n  })\n\nfunction RouteComponent() {\n  const { value: expectedCookieValue } = Route.useSearch()\n  const [cookiesFromDocument, setCookiesFromDocument] = React.useState<\n    Record<string, string | undefined> | undefined\n  >(undefined)\n  useEffect(() => {\n    const tempCookies: Record<string, string | undefined> = {}\n    for (let i = 1; i <= 4; i++) {\n      const key = `cookie-${i}-${expectedCookieValue}`\n      tempCookies[key] = Cookies.get(key)\n    }\n    setCookiesFromDocument(tempCookies)\n  }, [])\n  return (\n    <div>\n      <h1 className=\"text-xl\">cookies result</h1>\n      <table>\n        <tbody>\n          <tr>\n            <td>cookie</td>\n            <td>value</td>\n          </tr>\n          {Object.entries(cookiesFromDocument || {}).map(([key, value]) => (\n            <tr key={key}>\n              <td>{key}</td>\n              <td data-testid={key}>{value}</td>\n            </tr>\n          ))}\n        </tbody>\n      </table>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/custom-fetch.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { getRequestHeaders } from '@tanstack/react-start/server'\nimport type { CustomFetch } from '@tanstack/react-start'\n\n/**\n * Custom Fetch Implementation Tests\n *\n * This route tests the custom fetch feature for server functions. Users can provide\n * a custom `fetch` implementation to control how server function requests are made.\n *\n * ## Fetch Override Precedence (highest to lowest priority):\n *\n * 1. **Direct call-site fetch** - When `serverFn({ fetch: customFetch })` is called,\n *    this fetch takes highest priority and overrides any middleware fetch.\n *\n * 2. **Later middleware fetch** - When multiple middlewares provide fetch, the LAST\n *    middleware in the chain wins. Middleware is executed in order, and each call to\n *    `next({ fetch })` can override the previous fetch.\n *\n * 3. **Earlier middleware fetch** - Middlewares earlier in the chain have lower priority.\n *    Their fetch will be used only if no later middleware or direct call provides one.\n *\n * 4. **Global serverFnFetch** - When `createStart({ serverFnFetch })` is configured,\n *    it's used if no middleware or call-site fetch is provided.\n *\n * 5. **Default global fetch** - If no custom fetch is provided anywhere, the global\n *    `fetch` function is used.\n *\n * ## Why This Design?\n *\n * - **Direct call wins**: Gives maximum control to the call site. Users can always\n *   override middleware behavior when needed for specific use cases.\n *\n * - **Later middleware wins**: Follows the middleware chain execution order. Each\n *   middleware can see and override what previous middlewares set, similar to how\n *   middleware can modify context or headers.\n *\n * - **Global serverFnFetch**: Provides a default for all server functions that can\n *   still be overridden per-function or per-call.\n *\n * - **Fallback to default**: Ensures backward compatibility. Existing code without\n *   custom fetch continues to work as expected.\n */\n\nexport const Route = createFileRoute('/custom-fetch')({\n  component: CustomFetchComponent,\n})\n\n/**\n * Basic server function that returns all request headers.\n * Used to verify which custom fetch implementation was actually used\n * by checking for the presence of custom headers.\n */\nconst getHeaders = createServerFn().handler(() => {\n  return Object.fromEntries(getRequestHeaders().entries())\n})\n\n/**\n * Middleware that injects 'x-custom-fetch-middleware: true' header.\n *\n * When used alone, this header should appear in the request.\n * When a direct call-site fetch is also provided, this middleware's fetch\n * should be OVERRIDDEN and this header should NOT appear.\n */\nconst customFetchMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const customFetch: CustomFetch = (input, init) => {\n      const headers = new Headers(init?.headers)\n      headers.set('x-custom-fetch-middleware', 'true')\n      return fetch(input, { ...init, headers })\n    }\n    return next({ fetch: customFetch })\n  },\n)\n\n/**\n * Server function using middleware for custom fetch.\n *\n * Expected behavior:\n * - When called without options: Uses customFetchMiddleware's fetch\n *   → Request should have 'x-custom-fetch-middleware: true'\n * - When called with { fetch: directFetch }: Direct fetch overrides middleware\n *   → Request should NOT have 'x-custom-fetch-middleware'\n */\nconst getHeadersWithMiddleware = createServerFn()\n  .middleware([customFetchMiddleware])\n  .handler(() => {\n    return Object.fromEntries(getRequestHeaders().entries())\n  })\n\n/**\n * First middleware in a chain - sets 'x-middleware-first: true' header.\n *\n * This middleware runs BEFORE secondMiddleware in the chain.\n * Its fetch should be OVERRIDDEN by secondMiddleware's fetch.\n */\nconst firstMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const customFetch: CustomFetch = (input, init) => {\n      const headers = new Headers(init?.headers)\n      headers.set('x-middleware-first', 'true')\n      return fetch(input, { ...init, headers })\n    }\n    return next({ fetch: customFetch })\n  },\n)\n\n/**\n * Second middleware in a chain - sets 'x-middleware-second: true' header.\n *\n * This middleware runs AFTER firstMiddleware in the chain.\n * Its fetch should WIN and override firstMiddleware's fetch because\n * later middlewares take precedence.\n */\nconst secondMiddleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const customFetch: CustomFetch = (input, init) => {\n      const headers = new Headers(init?.headers)\n      headers.set('x-middleware-second', 'true')\n      return fetch(input, { ...init, headers })\n    }\n    return next({ fetch: customFetch })\n  },\n)\n\n/**\n * Server function with chained middleware: [firstMiddleware, secondMiddleware]\n *\n * Expected behavior:\n * - secondMiddleware's fetch WINS (later middleware overrides earlier)\n * - Request should have 'x-middleware-second: true'\n * - Request should NOT have 'x-middleware-first' (overridden)\n *\n * Execution order:\n * 1. firstMiddleware sets its fetch, calls next({ fetch: firstFetch })\n * 2. secondMiddleware sets its fetch, calls next({ fetch: secondFetch })\n * 3. secondFetch overrides firstFetch because it came later\n * 4. Actual request uses secondFetch\n */\nconst getHeadersWithChainedMiddleware = createServerFn()\n  .middleware([firstMiddleware, secondMiddleware])\n  .handler(() => {\n    return Object.fromEntries(getRequestHeaders().entries())\n  })\n\n/**\n * Server function with middleware that can be overridden by direct call.\n *\n * Expected behavior:\n * - When called with { fetch: directFetch }: Direct fetch WINS\n *   → Request should have 'x-direct-override: true'\n *   → Request should NOT have 'x-custom-fetch-middleware' (overridden)\n *\n * This tests the highest priority rule: direct call-site fetch always wins\n * over any middleware-provided fetch.\n */\nconst getHeadersWithOverridableMiddleware = createServerFn()\n  .middleware([customFetchMiddleware])\n  .handler(() => {\n    return Object.fromEntries(getRequestHeaders().entries())\n  })\n\nfunction CustomFetchComponent() {\n  const [directResult, setDirectResult] = React.useState<Record<\n    string,\n    string\n  > | null>(null)\n  const [middlewareResult, setMiddlewareResult] = React.useState<Record<\n    string,\n    string\n  > | null>(null)\n  const [chainedResult, setChainedResult] = React.useState<Record<\n    string,\n    string\n  > | null>(null)\n  const [overrideResult, setOverrideResult] = React.useState<Record<\n    string,\n    string\n  > | null>(null)\n  const [noCustomFetchResult, setNoCustomFetchResult] = React.useState<Record<\n    string,\n    string\n  > | null>(null)\n  const [globalFetchResult, setGlobalFetchResult] = React.useState<Record<\n    string,\n    string\n  > | null>(null)\n  const [middlewareOverridesGlobalResult, setMiddlewareOverridesGlobalResult] =\n    React.useState<Record<string, string> | null>(null)\n  const [directOverridesGlobalResult, setDirectOverridesGlobalResult] =\n    React.useState<Record<string, string> | null>(null)\n\n  /**\n   * Test 1: Direct Custom Fetch\n   *\n   * Passes a custom fetch directly at the call site to a server function\n   * that has NO middleware.\n   *\n   * Expected: 'x-custom-fetch-direct: true' header should be present\n   * Precedence: Direct fetch is the only fetch configured → it wins\n   */\n  const handleDirectFetch = async () => {\n    const customFetch: CustomFetch = (input, init) => {\n      const headers = new Headers(init?.headers)\n      headers.set('x-custom-fetch-direct', 'true')\n      return fetch(input, { ...init, headers })\n    }\n    const result = await getHeaders({ fetch: customFetch })\n    setDirectResult(result)\n  }\n\n  /**\n   * Test 2: Middleware Custom Fetch\n   *\n   * Calls a server function that has middleware providing custom fetch.\n   * No direct fetch is passed at the call site.\n   *\n   * Expected: 'x-custom-fetch-middleware: true' header should be present\n   * Precedence: Middleware fetch is the only fetch configured → it wins\n   */\n  const handleMiddlewareFetch = async () => {\n    const result = await getHeadersWithMiddleware()\n    setMiddlewareResult(result)\n  }\n\n  /**\n   * Test 3: Chained Middleware - Later Overrides Earlier\n   *\n   * Calls a server function with TWO middlewares, each providing custom fetch:\n   * - firstMiddleware sets 'x-middleware-first: true'\n   * - secondMiddleware sets 'x-middleware-second: true'\n   *\n   * Expected:\n   * - 'x-middleware-second: true' SHOULD be present (later middleware wins)\n   * - 'x-middleware-first' should NOT be present (overridden by later middleware)\n   *\n   * Precedence: [firstMiddleware, secondMiddleware] → secondMiddleware wins\n   */\n  const handleChainedMiddlewareFetch = async () => {\n    const result = await getHeadersWithChainedMiddleware()\n    setChainedResult(result)\n  }\n\n  /**\n   * Test 4: Direct Fetch Overrides Middleware Fetch\n   *\n   * Calls a server function that has middleware providing custom fetch,\n   * BUT also passes a direct fetch at the call site.\n   *\n   * Expected:\n   * - 'x-direct-override: true' SHOULD be present (direct call wins)\n   * - 'x-custom-fetch-middleware' should NOT be present (overridden by direct)\n   *\n   * Precedence: Direct call > Middleware → Direct wins\n   *\n   * This is the most important override test: it verifies that users can\n   * always override middleware behavior at the call site when needed.\n   */\n  const handleOverrideFetch = async () => {\n    const customFetch: CustomFetch = (input, init) => {\n      const headers = new Headers(init?.headers)\n      headers.set('x-direct-override', 'true')\n      return fetch(input, { ...init, headers })\n    }\n    const result = await getHeadersWithOverridableMiddleware({\n      fetch: customFetch,\n    })\n    setOverrideResult(result)\n  }\n\n  /**\n   * Test 5: No Custom Fetch (Default Behavior)\n   *\n   * Calls a server function with NO middleware and NO direct fetch.\n   * This tests the fallback to the global serverFnFetch from createStart.\n   *\n   * Expected:\n   * - 'x-global-fetch: true' SHOULD be present (from createStart serverFnFetch)\n   * - Neither 'x-custom-fetch-direct' nor 'x-custom-fetch-middleware' should be present\n   * - Request should succeed using the global fetch from start.ts\n   *\n   * Precedence: No call-site or middleware fetch → Global serverFnFetch is used\n   */\n  const handleNoCustomFetch = async () => {\n    const result = await getHeaders()\n    setNoCustomFetchResult(result)\n  }\n\n  /**\n   * Test 6: Global Fetch from createStart\n   *\n   * Calls a server function with NO middleware and NO direct fetch.\n   * Verifies that the global serverFnFetch from createStart is used.\n   *\n   * Expected:\n   * - 'x-global-fetch: true' SHOULD be present (from createStart serverFnFetch)\n   *\n   * This explicitly tests the global serverFnFetch feature.\n   */\n  const handleGlobalFetch = async () => {\n    const result = await getHeaders()\n    setGlobalFetchResult(result)\n  }\n\n  /**\n   * Test 7: Middleware Overrides Global Fetch\n   *\n   * Calls a server function with middleware that provides custom fetch.\n   * Verifies that middleware fetch takes precedence over global serverFnFetch.\n   *\n   * Expected:\n   * - 'x-custom-fetch-middleware: true' SHOULD be present (middleware wins)\n   * - 'x-global-fetch' should NOT be present (overridden by middleware)\n   *\n   * Precedence: Middleware > Global serverFnFetch\n   */\n  const handleMiddlewareOverridesGlobal = async () => {\n    const result = await getHeadersWithMiddleware()\n    setMiddlewareOverridesGlobalResult(result)\n  }\n\n  /**\n   * Test 8: Direct Fetch Overrides Global Fetch\n   *\n   * Calls a server function with direct fetch at call site.\n   * Verifies that call-site fetch takes precedence over global serverFnFetch.\n   *\n   * Expected:\n   * - 'x-direct-override-global: true' SHOULD be present (call-site wins)\n   * - 'x-global-fetch' should NOT be present (overridden by call-site)\n   *\n   * Precedence: Call-site > Global serverFnFetch\n   */\n  const handleDirectOverridesGlobal = async () => {\n    const customFetch: CustomFetch = (input, init) => {\n      const headers = new Headers(init?.headers)\n      headers.set('x-direct-override-global', 'true')\n      return fetch(input, { ...init, headers })\n    }\n    const result = await getHeaders({ fetch: customFetch })\n    setDirectOverridesGlobalResult(result)\n  }\n\n  return (\n    <div className=\"p-2 m-2 grid gap-4\">\n      <h3>Custom Fetch Implementation Test</h3>\n      <p className=\"text-sm text-gray-600\">\n        Tests custom fetch override precedence: Direct call &gt; Later\n        middleware &gt; Earlier middleware &gt; Global serverFnFetch &gt;\n        Default fetch\n      </p>\n\n      <div>\n        <h4>Test 1: Direct Custom Fetch</h4>\n        <p className=\"text-xs text-gray-500\">\n          Expected: x-custom-fetch-direct header present\n        </p>\n        <button\n          type=\"button\"\n          data-testid=\"test-direct-custom-fetch-btn\"\n          onClick={handleDirectFetch}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Direct Custom Fetch\n        </button>\n        <pre data-testid=\"direct-custom-fetch-result\">\n          {directResult ? JSON.stringify(directResult, null, 2) : 'null'}\n        </pre>\n      </div>\n\n      <div>\n        <h4>Test 2: Middleware Custom Fetch</h4>\n        <p className=\"text-xs text-gray-500\">\n          Expected: x-custom-fetch-middleware header present\n        </p>\n        <button\n          type=\"button\"\n          data-testid=\"test-middleware-custom-fetch-btn\"\n          onClick={handleMiddlewareFetch}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Middleware Custom Fetch\n        </button>\n        <pre data-testid=\"middleware-custom-fetch-result\">\n          {middlewareResult\n            ? JSON.stringify(middlewareResult, null, 2)\n            : 'null'}\n        </pre>\n      </div>\n\n      <div>\n        <h4>Test 3: Chained Middleware (Later Wins)</h4>\n        <p className=\"text-xs text-gray-500\">\n          Expected: x-middleware-second present, x-middleware-first NOT present\n        </p>\n        <button\n          type=\"button\"\n          data-testid=\"test-chained-middleware-btn\"\n          onClick={handleChainedMiddlewareFetch}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Chained Middleware\n        </button>\n        <pre data-testid=\"chained-middleware-result\">\n          {chainedResult ? JSON.stringify(chainedResult, null, 2) : 'null'}\n        </pre>\n      </div>\n\n      <div>\n        <h4>Test 4: Direct Overrides Middleware</h4>\n        <p className=\"text-xs text-gray-500\">\n          Expected: x-direct-override present, x-custom-fetch-middleware NOT\n          present\n        </p>\n        <button\n          type=\"button\"\n          data-testid=\"test-direct-override-btn\"\n          onClick={handleOverrideFetch}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Direct Override\n        </button>\n        <pre data-testid=\"direct-override-result\">\n          {overrideResult ? JSON.stringify(overrideResult, null, 2) : 'null'}\n        </pre>\n      </div>\n\n      <div>\n        <h4>Test 5: No Custom Fetch (Uses Global)</h4>\n        <p className=\"text-xs text-gray-500\">\n          Expected: x-global-fetch header present (from createStart\n          serverFnFetch)\n        </p>\n        <button\n          type=\"button\"\n          data-testid=\"test-no-custom-fetch-btn\"\n          onClick={handleNoCustomFetch}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test No Custom Fetch\n        </button>\n        <pre data-testid=\"no-custom-fetch-result\">\n          {noCustomFetchResult\n            ? JSON.stringify(noCustomFetchResult, null, 2)\n            : 'null'}\n        </pre>\n      </div>\n\n      <div>\n        <h4>Test 6: Global Fetch from createStart</h4>\n        <p className=\"text-xs text-gray-500\">\n          Expected: x-global-fetch header present\n        </p>\n        <button\n          type=\"button\"\n          data-testid=\"test-global-fetch-btn\"\n          onClick={handleGlobalFetch}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Global Fetch\n        </button>\n        <pre data-testid=\"global-fetch-result\">\n          {globalFetchResult\n            ? JSON.stringify(globalFetchResult, null, 2)\n            : 'null'}\n        </pre>\n      </div>\n\n      <div>\n        <h4>Test 7: Middleware Overrides Global Fetch</h4>\n        <p className=\"text-xs text-gray-500\">\n          Expected: x-custom-fetch-middleware present, x-global-fetch NOT\n          present\n        </p>\n        <button\n          type=\"button\"\n          data-testid=\"test-middleware-overrides-global-btn\"\n          onClick={handleMiddlewareOverridesGlobal}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Middleware Overrides Global\n        </button>\n        <pre data-testid=\"middleware-overrides-global-result\">\n          {middlewareOverridesGlobalResult\n            ? JSON.stringify(middlewareOverridesGlobalResult, null, 2)\n            : 'null'}\n        </pre>\n      </div>\n\n      <div>\n        <h4>Test 8: Direct Fetch Overrides Global Fetch</h4>\n        <p className=\"text-xs text-gray-500\">\n          Expected: x-direct-override-global present, x-global-fetch NOT present\n        </p>\n        <button\n          type=\"button\"\n          data-testid=\"test-direct-overrides-global-btn\"\n          onClick={handleDirectOverridesGlobal}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Direct Overrides Global\n        </button>\n        <pre data-testid=\"direct-overrides-global-result\">\n          {directOverridesGlobalResult\n            ? JSON.stringify(directOverridesGlobalResult, null, 2)\n            : 'null'}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/dead-code-preserve.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as fs from 'node:fs'\nimport { createServerFn } from '@tanstack/react-start'\nimport { getRequestHeader } from '@tanstack/react-start/server'\nimport { useState } from 'react'\n\nexport const Route = createFileRoute('/dead-code-preserve')({\n  component: RouteComponent,\n})\n\n// by using this we make sure DCE still works - this errors when imported on the client\n\nconst filePath = 'count-effect.txt'\n\nasync function readCount() {\n  return parseInt(\n    await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'),\n  )\n}\n\nasync function updateCount() {\n  const count = await readCount()\n  await fs.promises.writeFile(filePath, `${count + 1}`)\n  return true\n}\n\nconst writeFileServerFn = createServerFn().handler(async () => {\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const test = await updateCount()\n  return getRequestHeader('X-Test')\n})\n\nconst readFileServerFn = createServerFn().handler(async () => {\n  const data = await readCount()\n  return data\n})\n\nfunction RouteComponent() {\n  const [serverFnOutput, setServerFnOutput] = useState<number>()\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Dead code test</h3>\n      <p>\n        This server function writes to a file as a side effect, then reads it.\n      </p>\n      <button\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        data-testid=\"test-dead-code-fn-call-btn\"\n        onClick={async () => {\n          await writeFileServerFn({ headers: { 'X-Test': 'test' } })\n          setServerFnOutput(await readFileServerFn())\n        }}\n      >\n        Call Dead Code Fn\n      </button>\n      <h4>Server output</h4>\n      <pre data-testid=\"dead-code-fn-call-response\">{serverFnOutput}</pre>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/env-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport {\n  createClientOnlyFn,\n  createServerFn,\n  createServerOnlyFn,\n} from '@tanstack/react-start'\nimport { useState } from 'react'\n\nconst serverEcho = createServerOnlyFn((input: string) => 'server got: ' + input)\nconst clientEcho = createClientOnlyFn((input: string) => 'client got: ' + input)\n\nconst testOnServer = createServerFn().handler(() => {\n  const serverOnServer = serverEcho('hello')\n  let clientOnServer: string\n  try {\n    clientOnServer = clientEcho('hello')\n  } catch (e) {\n    clientOnServer =\n      'clientEcho threw an error: ' +\n      (e instanceof Error ? e.message : String(e))\n  }\n  return { serverOnServer, clientOnServer }\n})\n\nexport const Route = createFileRoute('/env-only')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [results, setResults] = useState<Partial<Record<string, string>>>()\n\n  async function handleClick() {\n    const { serverOnServer, clientOnServer } = await testOnServer()\n    const clientOnClient = clientEcho('hello')\n    let serverOnClient: string\n    try {\n      serverOnClient = serverEcho('hello')\n    } catch (e) {\n      serverOnClient =\n        'serverEcho threw an error: ' +\n        (e instanceof Error ? e.message : String(e))\n    }\n    setResults({\n      serverOnServer,\n      clientOnServer,\n      clientOnClient,\n      serverOnClient,\n    })\n  }\n\n  const { serverOnServer, clientOnServer, clientOnClient, serverOnClient } =\n    results || {}\n\n  return (\n    <div>\n      <button onClick={handleClick} data-testid=\"test-env-only-results-btn\">\n        Run\n      </button>\n      {!!results && (\n        <div>\n          <h1>\n            <code>serverEcho</code>\n          </h1>\n          When we called the function on the server:\n          <pre data-testid=\"server-on-server\">{serverOnServer}</pre>\n          When we called the function on the client:\n          <pre data-testid=\"server-on-client\">{serverOnClient}</pre>\n          <br />\n          <h1>\n            <code>clientEcho</code>\n          </h1>\n          When we called the function on the server:\n          <pre data-testid=\"client-on-server\">{clientOnServer}</pre>\n          When we called the function on the client:\n          <pre data-testid=\"client-on-client\">{clientOnClient}</pre>\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts",
    "content": "import { createMiddleware } from '@tanstack/react-start'\nimport { createFooServerFn } from './createFooServerFn'\n\nconst barMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('Bar middleware triggered')\n    return next({\n      context: { bar: 'bar' } as const,\n    })\n  },\n)\n\nexport const createBarServerFn = createFooServerFn().middleware([barMiddleware])\n\nexport const barFnInsideFactoryFile = createBarServerFn().handler(\n  ({ context, method }) => {\n    return {\n      name: 'barFnInsideFactoryFile',\n      context,\n      method,\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/createFakeFn.ts",
    "content": "export function createFakeFn() {\n  return {\n    handler: (cb: () => Promise<any>) => cb,\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { getRequest } from '@tanstack/react-start/server'\n\nconst fooMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    const request = getRequest()\n    console.log('Foo middleware triggered')\n    return next({\n      context: { foo: 'foo', method: request.method } as const,\n    })\n  },\n)\n\nexport const createFooServerFn = createServerFn().middleware([fooMiddleware])\n\nexport const fooFnInsideFactoryFile = createFooServerFn().handler(\n  async ({ context, method }) => {\n    console.log('fooFnInsideFactoryFile handler triggered', context.method)\n    return {\n      name: 'fooFnInsideFactoryFile',\n      context,\n      method,\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/functions.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { createBarServerFn } from './createBarServerFn'\nimport { createFooServerFn } from './createFooServerFn'\nimport { createFakeFn } from './createFakeFn'\n// Test re-export syntax: `export { foo } from './module'`\nimport { reexportFactory } from './reexportIndex'\n// Test star re-export syntax: `export * from './module'`\nimport { starReexportFactory } from './starReexportIndex'\n// Test nested star re-export syntax: A -> B -> C chain\nimport { nestedReexportFactory } from './nestedReexportA'\n\nexport const fooFn = createFooServerFn().handler(({ context, method }) => {\n  return {\n    name: 'fooFn',\n    context,\n    method,\n  }\n})\n\nexport const fooFnPOST = createFooServerFn({ method: 'POST' }).handler(\n  ({ context, method }) => {\n    return {\n      name: 'fooFnPOST',\n      context,\n      method,\n    }\n  },\n)\n\nexport const barFn = createBarServerFn().handler(({ context, method }) => {\n  return {\n    name: 'barFn',\n    context,\n    method,\n  }\n})\n\nexport const barFnPOST = createBarServerFn({ method: 'POST' }).handler(\n  ({ context, method }) => {\n    return {\n      name: 'barFnPOST',\n      context,\n      method,\n    }\n  },\n)\n\nconst localMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('local middleware triggered')\n    return next({\n      context: { local: 'local' } as const,\n    })\n  },\n)\n\nconst localFnFactory = createBarServerFn.middleware([localMiddleware])\n\nconst anotherMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('another middleware triggered')\n    return next({\n      context: { another: 'another' } as const,\n    })\n  },\n)\n\nexport const localFn = localFnFactory()\n  .middleware([anotherMiddleware])\n  .handler(({ context, method }) => {\n    return {\n      name: 'localFn',\n      context,\n      method,\n    }\n  })\n\nexport const localFnPOST = localFnFactory({ method: 'POST' })\n  .middleware([anotherMiddleware])\n  .handler(({ context, method }) => {\n    return {\n      name: 'localFnPOST',\n      context,\n      method,\n    }\n  })\n\nexport const fakeFn = createFakeFn().handler(async () => {\n  return {\n    name: 'fakeFn',\n    window,\n  }\n})\n\nexport const composeFactory = createServerFn({ method: 'GET' }).middleware([\n  createBarServerFn,\n])\nexport const composedFn = composeFactory()\n  .middleware([anotherMiddleware, localFnFactory])\n  .handler(({ context, method }) => {\n    return {\n      name: 'composedFn',\n      context,\n      method,\n    }\n  })\n\n// Test that re-exported factories (using `export { foo } from './module'`) work correctly\n// The middleware from reexportFactory should execute and add { reexport: 'reexport-middleware-executed' } to context\nexport const reexportedFactoryFn = reexportFactory().handler(\n  ({ context, method }) => {\n    return {\n      name: 'reexportedFactoryFn',\n      context,\n      method,\n    }\n  },\n)\n\n// Test that star re-exported factories (using `export * from './module'`) work correctly\n// The middleware from starReexportFactory should execute and add { starReexport: 'star-reexport-middleware-executed' } to context\nexport const starReexportedFactoryFn = starReexportFactory().handler(\n  ({ context, method }) => {\n    return {\n      name: 'starReexportedFactoryFn',\n      context,\n      method,\n    }\n  },\n)\n\n// Test that nested star re-exported factories (A -> B -> C chain) work correctly\n// The middleware from nestedReexportFactory should execute and add { nested: 'nested-middleware-executed' } to context\nexport const nestedReexportedFactoryFn = nestedReexportFactory().handler(\n  ({ context, method }) => {\n    return {\n      name: 'nestedReexportedFactoryFn',\n      context,\n      method,\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/nestedReexportA.ts",
    "content": "/**\n * Top-level module in the nested re-export chain.\n * Re-exports everything from nestedReexportB.\n *\n * Chain: nestedReexportA (this file) -> nestedReexportB -> nestedReexportC\n */\nexport * from './nestedReexportB'\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/nestedReexportB.ts",
    "content": "/**\n * Middle module in the nested re-export chain.\n * Re-exports everything from nestedReexportC.\n *\n * Chain: nestedReexportA -> nestedReexportB (this file) -> nestedReexportC\n */\nexport * from './nestedReexportC'\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/nestedReexportC.ts",
    "content": "/**\n * This is the deepest module in the nested re-export chain.\n * It defines a server function factory with middleware.\n *\n * Chain: nestedReexportA -> nestedReexportB -> nestedReexportC (this file)\n */\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\n\nconst nestedMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('nested middleware triggered')\n    return next({\n      context: { nested: 'nested-middleware-executed' } as const,\n    })\n  },\n)\n\nexport const nestedReexportFactory = createServerFn({\n  method: 'GET',\n}).middleware([nestedMiddleware])\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/reexportIndex.ts",
    "content": "// This file tests re-exporting a factory function from another module\nexport { reexportFactory } from './reexportWrapper'\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/reexportWrapper.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/react-start'\n\nconst reexportMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('reexport middleware triggered')\n    return next({\n      context: { reexport: 'reexport-middleware-executed' } as const,\n    })\n  },\n)\n\nexport const reexportFactory = createServerFn().middleware([reexportMiddleware])\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/starReexportIndex.ts",
    "content": "// This file tests re-exporting a factory function from another module using the star syntax\nexport * from './starReexportWrapper'\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/-functions/starReexportWrapper.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/react-start'\n\nconst starReexportMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('star reexport middleware triggered')\n    return next({\n      context: { starReexport: 'star-reexport-middleware-executed' } as const,\n    })\n  },\n)\n\nexport const starReexportFactory = createServerFn().middleware([\n  starReexportMiddleware,\n])\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/factory/index.tsx",
    "content": "import { createFileRoute, deepEqual } from '@tanstack/react-router'\n\nimport React from 'react'\nimport { createServerFn } from '@tanstack/react-start'\nimport { fooFnInsideFactoryFile } from './-functions/createFooServerFn'\nimport {\n  barFn,\n  barFnPOST,\n  composedFn,\n  fakeFn,\n  fooFn,\n  fooFnPOST,\n  localFn,\n  localFnPOST,\n  nestedReexportedFactoryFn,\n  reexportedFactoryFn,\n  starReexportedFactoryFn,\n} from './-functions/functions'\n\nexport const Route = createFileRoute('/factory/')({\n  ssr: false,\n  component: RouteComponent,\n})\n\nconst fnInsideRoute = createServerFn({ method: 'GET' }).handler(\n  ({ method }) => {\n    return {\n      name: 'fnInsideRoute',\n      method,\n    }\n  },\n)\n\nconst functions = {\n  fnInsideRoute: {\n    fn: fnInsideRoute,\n    type: 'serverFn',\n    expected: {\n      name: 'fnInsideRoute',\n      method: 'GET',\n    },\n  },\n  fooFnInsideFactoryFile: {\n    fn: fooFnInsideFactoryFile,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFnInsideFactoryFile',\n      context: { foo: 'foo', method: 'GET' },\n      method: 'GET',\n    },\n  },\n  fooFn: {\n    fn: fooFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFn',\n      context: { foo: 'foo', method: 'GET' },\n      method: 'GET',\n    },\n  },\n  fooFnPOST: {\n    fn: fooFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFnPOST',\n      context: { foo: 'foo', method: 'POST' },\n      method: 'POST',\n    },\n  },\n  barFn: {\n    fn: barFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'barFn',\n      context: { foo: 'foo', method: 'GET', bar: 'bar' },\n      method: 'GET',\n    },\n  },\n  barFnPOST: {\n    fn: barFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'barFnPOST',\n      context: { foo: 'foo', method: 'POST', bar: 'bar' },\n      method: 'POST',\n    },\n  },\n  localFn: {\n    fn: localFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'localFn',\n      context: {\n        foo: 'foo',\n        method: 'GET',\n        bar: 'bar',\n        local: 'local',\n        another: 'another',\n      },\n      method: 'GET',\n    },\n  },\n  localFnPOST: {\n    fn: localFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'localFnPOST',\n      context: {\n        foo: 'foo',\n        method: 'POST',\n        bar: 'bar',\n        local: 'local',\n        another: 'another',\n      },\n      method: 'POST',\n    },\n  },\n  composedFn: {\n    fn: composedFn,\n    type: 'serverFn',\n    expected: {\n      name: 'composedFn',\n      context: {\n        foo: 'foo',\n        method: 'GET',\n        bar: 'bar',\n        another: 'another',\n        local: 'local',\n      },\n      method: 'GET',\n    },\n  },\n  fakeFn: {\n    fn: fakeFn,\n    type: 'localFn',\n    expected: {\n      name: 'fakeFn',\n      window,\n    },\n  },\n  // Test that re-exported factories (using `export { foo } from './module'`) work correctly\n  // The middleware from reexportFactory should execute and add { reexport: 'reexport-middleware-executed' } to context\n  reexportedFactoryFn: {\n    fn: reexportedFactoryFn,\n    type: 'serverFn',\n    expected: {\n      name: 'reexportedFactoryFn',\n      context: { reexport: 'reexport-middleware-executed' },\n      method: 'GET',\n    },\n  },\n  // Test that star re-exported factories (using `export * from './module'`) work correctly\n  // The middleware from starReexportFactory should execute and add { starReexport: 'star-reexport-middleware-executed' } to context\n  starReexportedFactoryFn: {\n    fn: starReexportedFactoryFn,\n    type: 'serverFn',\n    expected: {\n      name: 'starReexportedFactoryFn',\n      context: { starReexport: 'star-reexport-middleware-executed' },\n      method: 'GET',\n    },\n  },\n  // Test that nested star re-exported factories (A -> B -> C chain) work correctly\n  // The middleware from nestedReexportFactory should execute and add { nested: 'nested-middleware-executed' } to context\n  nestedReexportedFactoryFn: {\n    fn: nestedReexportedFactoryFn,\n    type: 'serverFn',\n    expected: {\n      name: 'nestedReexportedFactoryFn',\n      context: { nested: 'nested-middleware-executed' },\n      method: 'GET',\n    },\n  },\n} satisfies Record<string, TestCase>\n\ninterface TestCase {\n  fn: () => Promise<any>\n  expected: any\n  type: 'serverFn' | 'localFn'\n}\nfunction Test({ fn, type, expected }: TestCase) {\n  const [result, setResult] = React.useState<null | unknown>(null)\n  function comparison() {\n    if (result) {\n      const isEqual = deepEqual(result, expected)\n      return isEqual ? 'equal' : 'not equal'\n    }\n    return 'Loading...'\n  }\n\n  return (\n    <div\n      data-testid={`test-${expected.name}`}\n      className=\"p-2 border border-gray-200 rounded-md\"\n    >\n      <h2 className=\"font-bold text-lg\"></h2>\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid={`expected-fn-result-${expected.name}`}>\n            {type === 'serverFn' ? JSON.stringify(expected) : 'localFn'}\n          </pre>\n        </code>\n      </div>\n      <p>\n        fn returns:\n        <br />\n        <span data-testid={`fn-result-${expected.name}`}>\n          {result\n            ? type === 'serverFn'\n              ? JSON.stringify(result)\n              : 'localFn'\n            : 'Loading...'}\n        </span>{' '}\n        <span data-testid={`fn-comparison-${expected.name}`}>\n          {comparison()}\n        </span>\n      </p>\n      <button\n        data-testid={`btn-fn-${expected.name}`}\n        type=\"button\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          fn().then(setResult)\n        }}\n      >\n        Invoke Server Function\n      </button>\n    </div>\n  )\n}\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2 m-2 grid gap-2\" data-testid=\"factory-route-component\">\n      <h1 className=\"font-bold text-lg\">Server functions factory E2E tests</h1>\n      {Object.entries(functions).map(([name, testCase]) => (\n        <Test key={name} {...testCase} />\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/formdata-context.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport React from 'react'\nimport { z } from 'zod'\n\n// Middleware that creates context on client and sends it to server\nconst testMiddleware = createMiddleware({ type: 'function' })\n  .client(async ({ next }) => {\n    const testString = 'context-from-middleware-' + Date.now()\n    return next({\n      sendContext: { testString },\n    })\n  })\n  .server(async ({ next, context }) => {\n    if (!context.testString) {\n      throw new Error(\n        'BUG: testString is missing from server middleware context!',\n      )\n    }\n    return await next({ context: { ...context } })\n  })\n\n// Server function with FormData\nexport const formDataWithContextFn = createServerFn({ method: 'POST' })\n  .middleware([testMiddleware])\n  .inputValidator((data: unknown) => {\n    const formData = z.instanceof(FormData).parse(data)\n    return {\n      name: z.string().parse(formData.get('name')),\n    }\n  })\n  .handler(({ data, context }) => {\n    if (!context.testString) {\n      throw new Error('BUG: testString is missing in handler context!')\n    }\n    return {\n      success: true,\n      name: data.name,\n      testString: context.testString,\n      hasContext: true,\n    }\n  })\n\n// Server function without parameters\nexport const simpleTestFn = createServerFn({ method: 'POST' })\n  .middleware([testMiddleware])\n  .handler(({ context }) => {\n    if (!context.testString) {\n      throw new Error('BUG: testString is missing in handler context!')\n    }\n    return {\n      success: true,\n      testString: context.testString,\n      hasContext: true,\n    }\n  })\n\nexport const Route = createFileRoute('/formdata-context')({\n  component: FormDataContextComponent,\n})\n\nfunction FormDataContextComponent() {\n  const [result, setResult] = React.useState<any>(null)\n  const [error, setError] = React.useState<string | null>(null)\n  const [loading, setLoading] = React.useState<string | null>(null)\n\n  const testValues = {\n    name: 'TestUser',\n    expectedContextValue: 'context-from-middleware',\n  }\n\n  const handleClick = async (fn: () => Promise<any>, type: string) => {\n    setLoading(type)\n    setError(null)\n    setResult(null)\n    try {\n      const response = await fn()\n      setResult(response)\n    } catch (err) {\n      setError(err instanceof Error ? err.message : 'Unknown error')\n    } finally {\n      setLoading(null)\n    }\n  }\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>FormData with Context Test</h3>\n      <div className=\"overflow-y-auto\">\n        Expected context value:{' '}\n        <code>\n          <pre data-testid=\"expected-formdata-context-value\">\n            {testValues.expectedContextValue}\n          </pre>\n        </code>\n      </div>\n      <div className=\"flex gap-4\">\n        <button\n          type=\"button\"\n          onClick={() =>\n            handleClick(\n              () =>\n                formDataWithContextFn({\n                  data: (() => {\n                    const fd = new FormData()\n                    fd.append('name', testValues.name)\n                    return fd\n                  })(),\n                }),\n              'formdata',\n            )\n          }\n          disabled={!!loading}\n          data-testid=\"test-formdata-context-btn\"\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50 disabled:opacity-50\"\n        >\n          {loading === 'formdata'\n            ? 'Calling...'\n            : 'Call Server Function (FormData)'}\n        </button>\n        <button\n          type=\"button\"\n          onClick={() => handleClick(() => simpleTestFn(), 'simple')}\n          disabled={!!loading}\n          data-testid=\"test-simple-context-btn\"\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50 disabled:opacity-50\"\n        >\n          {loading === 'simple'\n            ? 'Calling...'\n            : 'Call Server Function (No Params)'}\n        </button>\n      </div>\n      {error && (\n        <div data-testid=\"formdata-context-error\" className=\"text-red-500\">\n          Error: {error}\n        </div>\n      )}\n      {result && (\n        <div className=\"overflow-y-auto\">\n          <pre data-testid=\"formdata-context-result\">\n            {JSON.stringify(result, null, 2)}\n          </pre>\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/formdata-redirect/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\nimport { createServerFn, useServerFn } from '@tanstack/react-start'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/formdata-redirect/')({\n  component: SubmitPostFormDataFn,\n  validateSearch: z.object({\n    mode: z.union([z.literal('js'), z.literal('no-js')]).default('js'),\n  }),\n})\n\nconst testValues = {\n  name: 'Sean',\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n\n    if (!name) {\n      throw new Error('Name is required')\n    }\n\n    return {\n      name: name.toString(),\n    }\n  })\n  .handler(({ data: { name } }) => {\n    throw redirect({ to: '/formdata-redirect/target/$name', params: { name } })\n  })\n\nfunction SubmitPostFormDataFn() {\n  const mode = Route.useSearch({ select: (search) => search.mode })\n  const greetUserFn = useServerFn(greetUser)\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Submit POST FormData Fn Call</h3>\n      <div className=\"overflow-y-auto\">\n        It should return redirect to /formdata-redirect/target/{testValues.name}{' '}\n        and greet the user with their name:\n        <code>\n          <pre data-testid=\"expected-submit-post-formdata-server-fn-result\">\n            {testValues.name}\n          </pre>\n        </code>\n      </div>\n      <form\n        className=\"flex flex-col gap-2\"\n        data-testid=\"submit-post-formdata-form\"\n        method=\"POST\"\n        action={greetUser.url}\n        onSubmit={async (evt) => {\n          if (mode === 'js') {\n            evt.preventDefault()\n            const data = new FormData(evt.currentTarget)\n            await greetUserFn({ data })\n          }\n        }}\n      >\n        <input type=\"text\" name=\"name\" defaultValue={testValues.name} />\n        <button\n          type=\"submit\"\n          data-testid=\"test-submit-post-formdata-fn-calls-btn\"\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/formdata-redirect/target.$name.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/formdata-redirect/target/$name')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"formdata-redirect-target\">\n      Hello{' '}\n      <span data-testid=\"formdata-redirect-target-name\">\n        {Route.useParams().name}\n      </span>\n      !\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/function-metadata/-functions/normalServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/react-start'\n\nexport const getServerFn = createServerFn().handler(({ serverFnMeta }) => {\n  return serverFnMeta\n})\n\nexport const postServerFn = createServerFn({ method: 'POST' }).handler(\n  ({ serverFnMeta }) => {\n    return serverFnMeta\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/function-metadata/-functions/serverFnCallingServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/react-start'\nimport { getServerFn, postServerFn } from './normalServerFn'\n\nexport const getServerFnCallingServerFn = createServerFn().handler(\n  async ({ serverFnMeta }) => {\n    const post = await postServerFn()\n    const get = await getServerFn()\n\n    return {\n      meta: serverFnMeta,\n      inner: {\n        get,\n        post,\n      },\n    }\n  },\n)\n\nexport const postServerFnCallingServerFn = createServerFn().handler(\n  async ({ serverFnMeta }) => {\n    const post = await postServerFn()\n    const get = await getServerFn()\n\n    return {\n      meta: serverFnMeta,\n      inner: {\n        get,\n        post,\n      },\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/function-metadata/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { getServerFn, postServerFn } from './-functions/normalServerFn'\nimport {\n  getServerFnCallingServerFn,\n  postServerFnCallingServerFn,\n} from './-functions/serverFnCallingServerFn'\n\nexport const Route = createFileRoute('/function-metadata/')({\n  component: RouteComponent,\n  loader: async () => {\n    const normalGet = await getServerFn()\n    const normalPost = await postServerFn()\n    const nestingGet = await getServerFnCallingServerFn()\n    const nestingPost = await postServerFnCallingServerFn()\n\n    return {\n      normalGet,\n      normalPost,\n      nestingGet,\n      nestingPost,\n    }\n  },\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\" data-testid=\"metadata-route-component\">\n      <h1 className=\"font-bold text-lg\">Server functions metadata E2E tests</h1>\n      <div>\n        <Link to=\"/middleware/function-metadata\">\n          Go to Function Metadata in Middleware E2E test\n        </Link>\n      </div>\n      <br />\n      <div data-testid=\"loader-data\">\n        <h3>Loader Data (SSR)</h3>\n        <h4>Server Captured Metadata:</h4>\n        <div>\n          Function Metadata:{' '}\n          <span data-testid=\"loader-normal-get-function-metadata\">\n            {JSON.stringify(loaderData.normalGet)}\n          </span>\n        </div>\n        <div>\n          Function Metadata:{' '}\n          <span data-testid=\"loader-normal-post-function-metadata\">\n            {JSON.stringify(loaderData.normalPost)}\n          </span>\n        </div>\n        <div>\n          Function Metadata:{' '}\n          <span data-testid=\"loader-nesting-get-function-metadata\">\n            {JSON.stringify(loaderData.nestingGet)}\n          </span>\n        </div>\n        <div>\n          Function Metadata:{' '}\n          <span data-testid=\"loader-nesting-post-function-metadata\">\n            {JSON.stringify(loaderData.nestingPost)}\n          </span>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/function-method/-functions/serverFnCallingServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/react-start'\n\nconst postServerFn = createServerFn({ method: 'POST' }).handler(\n  ({ method }) => {\n    return {\n      method,\n    }\n  },\n)\n\nconst getServerFn = createServerFn({ method: 'GET' }).handler(({ method }) => {\n  return {\n    method,\n  }\n})\n\nexport const getServerFnCallingPost = createServerFn({ method: 'GET' }).handler(\n  async ({ method }) => {\n    const innerFnResult = await postServerFn({})\n\n    return {\n      name: 'getServerFnCallingPost',\n      method,\n      innerFnResult,\n    }\n  },\n)\n\nexport const postServerFnCallingGet = createServerFn({\n  method: 'POST',\n}).handler(async ({ method }) => {\n  const innerFnResult = await getServerFn({})\n\n  return {\n    name: 'postServerFnCallingGet',\n    method,\n    innerFnResult,\n  }\n})\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/function-method/index.tsx",
    "content": "import { Link, createFileRoute, deepEqual } from '@tanstack/react-router'\nimport { useState } from 'react'\nimport {\n  getServerFnCallingPost,\n  postServerFnCallingGet,\n} from './-functions/serverFnCallingServerFn'\n\nexport const Route = createFileRoute('/function-method/')({\n  component: RouteComponent,\n})\n\nconst functions = {\n  getServerFnCallingPost: {\n    fn: getServerFnCallingPost,\n    expected: {\n      name: 'getServerFnCallingPost',\n      method: 'GET',\n      innerFnResult: {\n        method: 'POST',\n      },\n    },\n  },\n  postServerFnCallingGet: {\n    fn: postServerFnCallingGet,\n    expected: {\n      name: 'postServerFnCallingGet',\n      method: 'POST',\n      innerFnResult: {\n        method: 'GET',\n      },\n    },\n  },\n} satisfies Record<string, TestCase>\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2 m-2 grid gap-2\" data-testid=\"method-route-component\">\n      <h1 className=\"font-bold text-lg\">Server functions methods E2E tests</h1>\n      <div>\n        <Link className=\"inline\" to=\"/factory\">\n          <h2>Go to Factory Functions and request method E2E test</h2>\n        </Link>\n      </div>\n      {Object.entries(functions).map(([name, testCase]) => (\n        <Test key={name} {...testCase} />\n      ))}\n    </div>\n  )\n}\n\ninterface TestCase {\n  fn: () => Promise<any>\n  expected: any\n}\nfunction Test({ fn, expected }: TestCase) {\n  const [result, setResult] = useState<null | unknown>(null)\n  function comparison() {\n    if (result) {\n      const isEqual = deepEqual(result, expected)\n      return isEqual ? 'equal' : 'not equal'\n    }\n    return 'Loading...'\n  }\n\n  return (\n    <div\n      data-testid={`test-${expected.name}`}\n      className=\"p-2 border border-gray-200 rounded-md\"\n    >\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid={`expected-fn-result-${expected.name}`}>\n            {JSON.stringify(expected)}\n          </pre>\n        </code>\n      </div>\n      <p>\n        fn returns:\n        <br />\n        <span data-testid={`fn-result-${expected.name}`}>\n          {result ? JSON.stringify(result) : 'Loading...'}\n        </span>{' '}\n        <span data-testid={`fn-comparison-${expected.name}`}>\n          {comparison()}\n        </span>\n      </p>\n      <button\n        data-testid={`btn-fn-${expected.name}`}\n        type=\"button\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          fn().then(setResult)\n        }}\n      >\n        Invoke Server Function\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/headers.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { createServerFn } from '@tanstack/react-start'\nimport {\n  getRequestHeaders,\n  setResponseHeader,\n} from '@tanstack/react-start/server'\nimport type { RequestHeaderName } from '@tanstack/react-start/server'\n\nexport const Route = createFileRoute('/headers')({\n  loader: async () => {\n    return {\n      testHeaders: await getTestHeaders(),\n    }\n  },\n  component: () => {\n    const { testHeaders } = Route.useLoaderData()\n    return <ResponseHeaders initialTestHeaders={testHeaders} />\n  },\n})\n\nexport const getTestHeaders = createServerFn().handler(() => {\n  setResponseHeader('x-test-header', 'test-value')\n  const reqHeaders = Object.fromEntries(getRequestHeaders().entries())\n\n  return {\n    serverHeaders: reqHeaders,\n    headers: reqHeaders,\n  }\n})\n\ntype TestHeadersResult = {\n  headers?: Partial<Record<RequestHeaderName, string | undefined>>\n  serverHeaders?: Partial<Record<RequestHeaderName, string | undefined>>\n}\n\nfunction ResponseHeaders({\n  initialTestHeaders,\n}: {\n  initialTestHeaders: TestHeadersResult\n}) {\n  const [testHeadersResult, setTestHeadersResult] =\n    React.useState<TestHeadersResult | null>(null)\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Headers Test</h3>\n      <form\n        className=\"flex flex-col gap-2\"\n        data-testid=\"serialize-formdata-form\"\n        onSubmit={(evt) => {\n          evt.preventDefault()\n          getTestHeaders().then(setTestHeadersResult)\n        }}\n      >\n        <button\n          type=\"submit\"\n          data-testid=\"test-headers-btn\"\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Get Headers\n        </button>\n      </form>\n      <div className=\"overflow-y-auto\">\n        <h4>Initial Headers:</h4>\n        <pre data-testid=\"initial-headers-result\">\n          {JSON.stringify(initialTestHeaders.headers, null, 2)}\n        </pre>\n        {testHeadersResult && (\n          <>\n            <h4>Updated Headers:</h4>\n            <pre data-testid=\"updated-headers-result\">\n              {JSON.stringify(testHeadersResult.headers, null, 2)}\n            </pre>\n          </>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg\">Server functions E2E tests</h1>\n      <ul className=\"list-disc p-4\">\n        <li>\n          <Link to=\"/consistent\">\n            Consistent server function returns both on client and server for GET\n            and POST calls\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/multipart\">\n            submitting multipart/form-data as server function input\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/return-null\">\n            Server function can return null for GET and POST calls\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/serialize-form-data\">\n            Server function can correctly send and receive FormData\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/headers\">\n            server function can correctly send and receive headers\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/submit-post-formdata\">\n            Direct POST submitting FormData to a Server function returns the\n            correct message\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/status\">\n            invoking a server function with custom response status code\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/isomorphic-fns\">\n            isomorphic functions can have different implementations on client\n            and server\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/env-only\">\n            env-only functions can only be called on the server or client\n            respectively\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/cookies\">server function sets cookies</Link>\n        </li>\n        <li>\n          <Link to=\"/dead-code-preserve\">\n            dead code elimination only affects code after transformation\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/abort-signal\">aborting a server function call</Link>\n        </li>\n        <li>\n          <Link to=\"/async-validation\">\n            server function with async validation\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/raw-response\">server function returns raw response</Link>\n        </li>\n        <li>\n          <Link to=\"/formdata-redirect\" search={{ mode: 'js' }}>\n            server function redirects when FormData is submitted (via JS)\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/formdata-redirect\" search={{ mode: 'no-js' }}>\n            server function redirects when FormData is submitted (via no-JS)\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/middleware\">Server Functions Middleware E2E tests</Link>\n        </li>\n        <li>\n          <Link to=\"/factory\">Server Functions Factory E2E tests</Link>\n        </li>\n        <li>\n          <Link to=\"/server-only-fn\">\n            Server Function only called by Server Environment is kept in the\n            server build\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/middleware/unhandled-exception\">\n            Server Functions Middleware Unhandled Exception E2E tests\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/function-method\">Server Functions method E2E tests</Link>\n        </li>\n        <li>\n          <Link to=\"/function-metadata\">\n            Server Functions metadata E2E tests\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/custom-fetch\">\n            Server function with custom fetch implementation\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/method-not-allowed\">\n            Server function returns 405 when method is not allowed\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/isomorphic-fns.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createIsomorphicFn, createServerFn } from '@tanstack/react-start'\nimport { useState } from 'react'\n\nconst getEnv = createIsomorphicFn()\n  .server(() => 'server')\n  .client(() => 'client')\n\nconst getServerEnv = createServerFn().handler(() => getEnv())\n\nconst getEcho = createIsomorphicFn()\n  .server((input: string) => 'server received ' + input)\n  .client((input) => 'client received ' + input)\n\nconst getServerEcho = createServerFn()\n  .inputValidator((input: string) => input)\n  .handler(({ data }) => getEcho(data))\n\nexport const Route = createFileRoute('/isomorphic-fns')({\n  component: RouteComponent,\n  loader() {\n    return {\n      envOnLoad: getEnv(),\n    }\n  },\n})\n\nfunction RouteComponent() {\n  const { envOnLoad } = Route.useLoaderData()\n  const [results, setResults] = useState<Partial<Record<string, string>>>()\n  async function handleClick() {\n    const envOnClick = getEnv()\n    const echo = getEcho('hello')\n    const [serverEnv, serverEcho] = await Promise.all([\n      getServerEnv(),\n      getServerEcho({ data: 'hello' }),\n    ])\n    setResults({ envOnClick, echo, serverEnv, serverEcho })\n  }\n  const { envOnClick, echo, serverEnv, serverEcho } = results || {}\n  return (\n    <div>\n      <button onClick={handleClick} data-testid=\"test-isomorphic-results-btn\">\n        Run\n      </button>\n      {!!results && (\n        <div>\n          <h1>\n            <code>getEnv</code>\n          </h1>\n          When we called the function on the server it returned:\n          <pre data-testid=\"server-result\">{JSON.stringify(serverEnv)}</pre>\n          When we called the function on the client it returned:\n          <pre data-testid=\"client-result\">{JSON.stringify(envOnClick)}</pre>\n          When we called the function during SSR it returned:\n          <pre data-testid=\"ssr-result\">{JSON.stringify(envOnLoad)}</pre>\n          <br />\n          <h1>\n            <code>echo</code>\n          </h1>\n          When we called the function on the server it returned:\n          <pre data-testid=\"server-echo-result\">\n            {JSON.stringify(serverEcho)}\n          </pre>\n          When we called the function on the client it returned:\n          <pre data-testid=\"client-echo-result\">{JSON.stringify(echo)}</pre>\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/method-not-allowed/$method.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { useState } from 'react'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/method-not-allowed/$method')({\n  params: z.object({\n    method: z.union([\n      z.literal('undefined'),\n      z.literal('get'),\n      z.literal('post'),\n    ]),\n  }),\n  component: MethodNotAllowedFn,\n})\n\nexport const getableServerFn = createServerFn({ method: 'GET' }).handler(() => {\n  return new Response('Hello, World!')\n})\n\nexport const undefinedMethodServerFn = createServerFn().handler(() => {\n  return new Response('Hello, World!')\n})\n\nexport const postableServerFn = createServerFn({ method: 'POST' }).handler(\n  () => {\n    return new Response('Hello, World!')\n  },\n)\n\nconst TEST_METHODS = ['GET', 'POST', 'PUT', 'OPTIONS'] as const\nconst SERVER_FN_URLS = {\n  undefined: undefinedMethodServerFn.url,\n  get: getableServerFn.url,\n  post: postableServerFn.url,\n}\nfunction MethodButton({\n  testMethod,\n  serverFnUrl,\n}: {\n  testMethod: string\n  serverFnUrl: string\n}) {\n  const [fetchResult, setFetchResult] = useState<\n    readonly [number, string] | null\n  >(null)\n\n  const fetchFn = async () => {\n    const response = await fetch(serverFnUrl, {\n      method: testMethod,\n    })\n    setFetchResult([response.status, await response.text()])\n  }\n\n  const lower = testMethod.toLowerCase()\n\n  return (\n    <>\n      <button data-testid={`${lower}-button`} onClick={fetchFn}>\n        Fetch {testMethod}\n      </button>\n      <pre data-testid={`${lower}-fetch-result`}>\n        {JSON.stringify(fetchResult)}\n      </pre>\n    </>\n  )\n}\n\nfunction MethodNotAllowedFn() {\n  const { method } = Route.useParams()\n  const serverFnUrl = SERVER_FN_URLS[method]\n\n  return (\n    <div className=\"flex flex-col gap-2\">\n      <h1>Method Not Allowed {method.toUpperCase()}</h1>\n\n      {TEST_METHODS.map((testMethod) => (\n        <MethodButton\n          key={testMethod}\n          testMethod={testMethod}\n          serverFnUrl={serverFnUrl}\n        />\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/method-not-allowed/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/method-not-allowed/')({\n  component: MethodNotAllowedIndex,\n})\n\nfunction MethodNotAllowedIndex() {\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg\">\n        Server functions E2E Method Not Allowed Tests\n      </h1>\n      <ul className=\"list-disc p-4\">\n        <li>\n          <Link to=\"/method-not-allowed/$method\" params={{ method: 'get' }}>\n            Server function defined with GET method\n          </Link>\n        </li>\n        <li>\n          <Link\n            to=\"/method-not-allowed/$method\"\n            params={{ method: 'undefined' }}\n          >\n            Server function defined without explicit method\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/method-not-allowed/$method\" params={{ method: 'post' }}>\n            Server function defined with POST method\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/catch-handler-error.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { useState } from 'react'\n\nconst errorCatchingMiddleware = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    try {\n      return await next()\n    } catch (error) {\n      const originalMessage =\n        error instanceof Error ? error.message : 'Unknown error'\n      throw new Error(`Middleware caught and transformed: ${originalMessage}`)\n    }\n  },\n)\n\nconst $serverFnThatThrows = createServerFn({ method: 'GET' })\n  .middleware([errorCatchingMiddleware])\n  .handler(() => {\n    throw new Error('This error should be caught by middleware')\n  })\n\nexport const Route = createFileRoute('/middleware/catch-handler-error')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [error, setError] = useState<string | null>(null)\n  const [loading, setLoading] = useState(false)\n\n  const handleClick = async () => {\n    setLoading(true)\n    setError(null)\n    try {\n      await $serverFnThatThrows()\n    } catch (e) {\n      setError(e instanceof Error ? e.message : String(e))\n    } finally {\n      setLoading(false)\n    }\n  }\n\n  return (\n    <div className=\"p-4\">\n      <h1 data-testid=\"catch-handler-error-title\">\n        Middleware Error Catching Test\n      </h1>\n      <p className=\"mt-2\">\n        This tests that middleware can catch and transform errors thrown by\n        server function handlers\n      </p>\n      <button\n        data-testid=\"trigger-error-btn\"\n        className=\"mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600\"\n        onClick={handleClick}\n        disabled={loading}\n      >\n        {loading ? 'Loading' : 'Call Server Function That Throws'}\n      </button>\n      {error && (\n        <div data-testid=\"transformed-error\" className=\"mt-4 text-red-500\">\n          Error: {error}\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/client-middleware-router.tsx",
    "content": "import { createFileRoute, useRouter } from '@tanstack/react-router'\nimport {\n  createMiddleware,\n  createServerFn,\n  getRouterInstance,\n} from '@tanstack/react-start'\nimport React from 'react'\n\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const router = await getRouterInstance()\n    return next({\n      sendContext: {\n        routerContext: router.options.context,\n      },\n    })\n  },\n)\n\nconst serverFn = createServerFn()\n  .middleware([middleware])\n  .handler(({ context }) => {\n    return context.routerContext\n  })\nexport const Route = createFileRoute('/middleware/client-middleware-router')({\n  component: RouteComponent,\n  loader: async () => ({ serverFnLoaderResult: await serverFn() }),\n})\n\nfunction RouteComponent() {\n  const [serverFnClientResult, setServerFnClientResult] = React.useState({})\n  const { serverFnLoaderResult } = Route.useLoaderData()\n\n  const router = useRouter()\n  return (\n    <div\n      className=\"p-2 m-2 grid gap-2\"\n      data-testid=\"client-middleware-router-route-component\"\n    >\n      <h3>Client Middleware has access to router instance</h3>\n      <p>\n        This component checks that the client middleware has access to the\n        router instance and thus its context.\n      </p>\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-server-fn-result\">\n            {JSON.stringify(router.options.context)}\n          </pre>\n        </code>\n      </div>\n      <p>\n        serverFn when invoked in the loader returns:\n        <br />\n        <span data-testid=\"serverFn-loader-result\">\n          {JSON.stringify(serverFnClientResult)}\n        </span>\n      </p>\n      <p>\n        serverFn when invoked on the client returns:\n        <br />\n        <span data-testid=\"serverFn-client-result\">\n          {JSON.stringify(serverFnLoaderResult)}\n        </span>\n      </p>\n      <button\n        data-testid=\"btn-serverFn\"\n        type=\"button\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          serverFn().then(setServerFnClientResult)\n        }}\n      >\n        Invoke Server Function\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/function-metadata.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport React from 'react'\n\n// Request middleware that captures serverFnMeta\n// Note: Request middleware only runs server-side, so it receives full ServerFnMeta\n// serverFnMeta is only present for server function calls, undefined for regular page requests\nconst requestMetadataMiddleware = createMiddleware({ type: 'request' }).server(\n  async ({ next, serverFnMeta }) => {\n    return next({\n      context: {\n        requestCapturedMeta: serverFnMeta,\n      },\n    })\n  },\n)\n\n// Separate request middleware for route-level server middleware\n// This will receive serverFnMeta as undefined for page requests\nconst pageRequestMiddleware = createMiddleware({ type: 'request' }).server(\n  async ({ next, serverFnMeta }) => {\n    return next({\n      context: {\n        // For page requests (not server function calls), serverFnMeta should be undefined\n        // We use '$undefined' string to prove we actually executed and passed data through\n        pageRequestServerFnMeta:\n          serverFnMeta === undefined ? '$undefined' : serverFnMeta,\n      },\n    })\n  },\n)\n\nconst metadataMiddleware = createMiddleware({ type: 'function' })\n  .middleware([requestMetadataMiddleware])\n  .client(async ({ next, serverFnMeta }) => {\n    return next({\n      sendContext: {\n        clientCapturedMeta: serverFnMeta,\n      },\n    })\n  })\n  .server(async ({ next, serverFnMeta, context }) => {\n    return next({\n      context: {\n        serverCapturedMeta: serverFnMeta,\n        clientCapturedMeta: context.clientCapturedMeta,\n        requestCapturedMeta: context.requestCapturedMeta,\n      },\n    })\n  })\n\n// Server function that returns client, server, and request captured metadata\nconst getMetadataFn = createServerFn()\n  .middleware([metadataMiddleware])\n  .handler(async ({ context }) => {\n    return {\n      // Full metadata captured by server middleware\n      serverMeta: context.serverCapturedMeta,\n      // Metadata captured by client middleware and sent via sendContext\n      // Client middleware only has { id }, not { name, filename }\n      clientCapturedMeta: context.clientCapturedMeta,\n      // Metadata captured by request middleware\n      // Request middleware receives full ServerFnMeta for server function calls\n      // or undefined for regular page requests\n      requestCapturedMeta: context.requestCapturedMeta,\n    }\n  })\n\nexport const Route = createFileRoute('/middleware/function-metadata')({\n  // Server route configuration to test that serverFnMeta is undefined for page requests\n  server: {\n    middleware: [pageRequestMiddleware],\n    handlers: {\n      GET: async ({ next, context }) => {\n        // Pass the captured serverFnMeta (should be undefined for page requests) to serverContext\n        return next({\n          context: {\n            pageRequestServerFnMeta: context.pageRequestServerFnMeta,\n          },\n        })\n      },\n    },\n  },\n  // Access serverContext in beforeLoad to pass to route context\n  beforeLoad: async ({ serverContext }) => {\n    return {\n      // serverContext contains data from GET handler + middleware context\n      // For page requests, pageRequestServerFnMeta should be undefined\n      pageRequestServerFnMeta: serverContext?.pageRequestServerFnMeta,\n    }\n  },\n  loader: () => getMetadataFn(),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n  const routeContext = Route.useRouteContext()\n\n  const [clientData, setClientData] = React.useState<typeof loaderData | null>(\n    null,\n  )\n\n  return (\n    <div>\n      <h2>Function Metadata in Middleware</h2>\n      <p>\n        This test verifies that client, server, and request middleware receive\n        serverFnMeta in their options. Client middleware gets only the id, while\n        server and request middleware get the full metadata (id, name,\n        filename). Request middleware only receives serverFnMeta for server\n        function calls, not for regular page requests.\n      </p>\n      <br />\n      <div>\n        <div data-testid=\"page-request-data\">\n          <h3>Page Request Middleware Data (via serverContext)</h3>\n          <p>\n            For regular page requests (not server function calls), serverFnMeta\n            should be undefined:\n          </p>\n          <div>\n            Page Request serverFnMeta:{' '}\n            <span data-testid=\"page-request-server-fn-meta\">\n              {typeof routeContext.pageRequestServerFnMeta === 'string'\n                ? routeContext.pageRequestServerFnMeta\n                : JSON.stringify(routeContext.pageRequestServerFnMeta)}\n            </span>\n          </div>\n        </div>\n        <br />\n        <div data-testid=\"loader-data\">\n          <h3>Loader Data (SSR)</h3>\n          <h4>Server Captured Metadata:</h4>\n          <div>\n            Function ID:{' '}\n            <span data-testid=\"loader-function-id\">\n              {loaderData.serverMeta?.id}\n            </span>\n          </div>\n          <div>\n            Function Name:{' '}\n            <span data-testid=\"loader-function-name\">\n              {loaderData.serverMeta?.name}\n            </span>\n          </div>\n          <div>\n            Filename:{' '}\n            <span data-testid=\"loader-filename\">\n              {loaderData.serverMeta?.filename}\n            </span>\n          </div>\n          <h4>Client Captured Metadata (via sendContext):</h4>\n          <p>Client middleware only receives id, not name or filename:</p>\n          <div>\n            Client Captured ID:{' '}\n            <span data-testid=\"loader-client-captured-id\">\n              {loaderData.clientCapturedMeta?.id}\n            </span>\n          </div>\n          <div>\n            Client Captured Name:{' '}\n            <span data-testid=\"loader-client-captured-name\">\n              {/* Cast to any to test that name is not present at runtime */}\n              {(loaderData.clientCapturedMeta as any)?.name ?? 'undefined'}\n            </span>\n          </div>\n          <div>\n            Client Captured Filename:{' '}\n            <span data-testid=\"loader-client-captured-filename\">\n              {/* Cast to any to test that filename is not present at runtime */}\n              {(loaderData.clientCapturedMeta as any)?.filename ?? 'undefined'}\n            </span>\n          </div>\n          <h4>Request Middleware Captured Metadata:</h4>\n          <p>\n            Request middleware receives full ServerFnMeta for server function\n            calls:\n          </p>\n          <div>\n            Request Captured ID:{' '}\n            <span data-testid=\"loader-request-captured-id\">\n              {loaderData.requestCapturedMeta?.id ?? 'undefined'}\n            </span>\n          </div>\n          <div>\n            Request Captured Name:{' '}\n            <span data-testid=\"loader-request-captured-name\">\n              {loaderData.requestCapturedMeta?.name ?? 'undefined'}\n            </span>\n          </div>\n          <div>\n            Request Captured Filename:{' '}\n            <span data-testid=\"loader-request-captured-filename\">\n              {loaderData.requestCapturedMeta?.filename ?? 'undefined'}\n            </span>\n          </div>\n        </div>\n        <br />\n        <div>\n          <button\n            data-testid=\"call-server-fn-btn\"\n            onClick={async () => {\n              const data = await getMetadataFn()\n              setClientData(data)\n            }}\n          >\n            Call server function from client\n          </button>\n        </div>\n        <br />\n        {clientData && (\n          <div data-testid=\"client-data\">\n            <h3>Client Data</h3>\n            <h4>Server Captured Metadata:</h4>\n            <div>\n              Function ID:{' '}\n              <span data-testid=\"client-function-id\">\n                {clientData.serverMeta?.id}\n              </span>\n            </div>\n            <div>\n              Function Name:{' '}\n              <span data-testid=\"client-function-name\">\n                {clientData.serverMeta?.name}\n              </span>\n            </div>\n            <div>\n              Filename:{' '}\n              <span data-testid=\"client-filename\">\n                {clientData.serverMeta?.filename}\n              </span>\n            </div>\n            <h4>Client Captured Metadata (via sendContext):</h4>\n            <p>Client middleware only receives id, not name or filename:</p>\n            <div>\n              Client Captured ID:{' '}\n              <span data-testid=\"client-client-captured-id\">\n                {clientData.clientCapturedMeta?.id}\n              </span>\n            </div>\n            <div>\n              Client Captured Name:{' '}\n              <span data-testid=\"client-client-captured-name\">\n                {/* Cast to any to test that name is not present at runtime */}\n                {(clientData.clientCapturedMeta as any)?.name ?? 'undefined'}\n              </span>\n            </div>\n            <div>\n              Client Captured Filename:{' '}\n              <span data-testid=\"client-client-captured-filename\">\n                {/* Cast to any to test that filename is not present at runtime */}\n                {(clientData.clientCapturedMeta as any)?.filename ??\n                  'undefined'}\n              </span>\n            </div>\n            <h4>Request Middleware Captured Metadata:</h4>\n            <p>\n              Request middleware receives full ServerFnMeta for server function\n              calls:\n            </p>\n            <div>\n              Request Captured ID:{' '}\n              <span data-testid=\"client-request-captured-id\">\n                {clientData.requestCapturedMeta?.id ?? 'undefined'}\n              </span>\n            </div>\n            <div>\n              Request Captured Name:{' '}\n              <span data-testid=\"client-request-captured-name\">\n                {clientData.requestCapturedMeta?.name ?? 'undefined'}\n              </span>\n            </div>\n            <div>\n              Request Captured Filename:{' '}\n              <span data-testid=\"client-request-captured-filename\">\n                {clientData.requestCapturedMeta?.filename ?? 'undefined'}\n              </span>\n            </div>\n          </div>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/middleware/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg\">\n        Server functions middleware E2E tests\n      </h1>\n      <ul className=\"list-disc p-4\">\n        <li>\n          <Route.Link\n            to=\"./client-middleware-router\"\n            data-testid=\"client-middleware-router-link\"\n          >\n            Client Middleware has access to router instance\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link to=\"./send-serverFn\" data-testid=\"send-serverFn-link\">\n            Client Middleware can send server function reference in context\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link\n            to=\"./request-middleware\"\n            data-testid=\"request-middleware-link\"\n            reloadDocument={true}\n          >\n            Request Middleware in combination with server function\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link\n            to=\"./server-import-middleware\"\n            data-testid=\"server-import-middleware-link\"\n          >\n            Server imports in middleware are stripped from client build\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link\n            to=\"./middleware-factory\"\n            data-testid=\"middleware-factory-link\"\n          >\n            Middleware factories with server imports are stripped from client\n            build\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link\n            to=\"./redirect-with-middleware\"\n            data-testid=\"redirect-with-middleware-link\"\n          >\n            Redirect via server function with middleware\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link\n            to=\"./function-metadata\"\n            data-testid=\"function-metadata-link\"\n          >\n            Function middleware receives functionId and filename\n          </Route.Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/middleware-factory.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { getRequestHeaders } from '@tanstack/react-start/server'\nimport React from 'react'\n\n/**\n * This test verifies that middleware factories (functions that return createMiddleware().server())\n * have their server-only code properly stripped from the client bundle.\n *\n * If the .server() part inside the factory is not stripped from the client build, this will fail with:\n * \"Module node:async_hooks has been externalized for browser compatibility\"\n * because @tanstack/react-start/server uses node:async_hooks internally.\n */\n\n// Middleware factory function - returns a middleware with .server() call\nfunction createHeaderMiddleware(headerName: string) {\n  return createMiddleware({ type: 'function' }).server(async ({ next }) => {\n    // Use a server-only import - this should be stripped from client build\n    const headers = getRequestHeaders()\n    const headerValue = headers.get(headerName) ?? 'missing'\n\n    console.log(`[middleware-factory] ${headerName}:`, headerValue)\n\n    return next({\n      context: {\n        headerName,\n        headerValue,\n      },\n    })\n  })\n}\n\n// Arrow function factory variant\nconst createPrefixedHeaderMiddleware = (prefix: string) => {\n  return createMiddleware({ type: 'function' }).server(async ({ next }) => {\n    // Use a server-only import - this should be stripped from client build\n    const headers = getRequestHeaders()\n    const allHeaderNames = [...headers.keys()]\n    const prefixedHeaders = allHeaderNames.filter((name) =>\n      name.toLowerCase().startsWith(prefix.toLowerCase()),\n    )\n\n    console.log(\n      `[middleware-factory] Prefixed headers (${prefix}):`,\n      prefixedHeaders,\n    )\n\n    return next({\n      context: {\n        prefix,\n        matchedHeaders: prefixedHeaders,\n      },\n    })\n  })\n}\n\n// Create middleware instances using the factories\nconst customHeaderMiddleware = createHeaderMiddleware('x-custom-factory-header')\nconst prefixedMiddleware = createPrefixedHeaderMiddleware('x-factory-')\n\nconst serverFn = createServerFn()\n  .middleware([customHeaderMiddleware, prefixedMiddleware])\n  .handler(async ({ context }) => {\n    return {\n      headerName: context.headerName,\n      headerValue: context.headerValue,\n      prefix: context.prefix,\n      matchedHeaders: context.matchedHeaders,\n    }\n  })\n\nexport const Route = createFileRoute('/middleware/middleware-factory')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [result, setResult] = React.useState<{\n    headerName: string\n    headerValue: string\n    prefix: string\n    matchedHeaders: Array<string>\n  } | null>(null)\n  const [error, setError] = React.useState<string | null>(null)\n\n  async function handleClick() {\n    try {\n      const data = await serverFn({\n        headers: {\n          'x-custom-factory-header': 'factory-header-value',\n          'x-factory-one': 'one',\n          'x-factory-two': 'two',\n        },\n      })\n      setResult(data)\n      setError(null)\n    } catch (e) {\n      setResult(null)\n      setError(e instanceof Error ? e.message : String(e))\n    }\n  }\n\n  return (\n    <div>\n      <h2>Middleware Factory Test</h2>\n      <p>\n        This test verifies that middleware factories (functions returning\n        createMiddleware().server()) have their server-only code properly\n        stripped from the client build.\n      </p>\n      <button onClick={handleClick} data-testid=\"test-middleware-factory-btn\">\n        Call server function with factory middlewares\n      </button>\n      {result && (\n        <div data-testid=\"middleware-factory-result\">\n          <div data-testid=\"header-value\">{result.headerValue}</div>\n          <div data-testid=\"matched-headers\">\n            {result.matchedHeaders.join(',')}\n          </div>\n        </div>\n      )}\n      {error && (\n        <div data-testid=\"middleware-factory-error\">Error: {error}</div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/redirect-with-middleware/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\nimport {\n  createMiddleware,\n  createServerFn,\n  useServerFn,\n} from '@tanstack/react-start'\nimport { useState } from 'react'\n\n// Function middleware that adds context\n// Issue #5372: Middleware causes serialization error when throwing redirects via server function\nconst testMiddleware = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    return next({\n      context: {\n        fromMiddleware: true,\n      },\n    })\n  },\n)\n\n// Server function with middleware that throws redirect\nconst $redirectWithMiddleware = createServerFn({ method: 'POST' })\n  .middleware([testMiddleware])\n  .handler(async () => {\n    throw redirect({ to: '/middleware/redirect-with-middleware/target' })\n  })\n\nexport const Route = createFileRoute('/middleware/redirect-with-middleware/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const redirectFn = useServerFn($redirectWithMiddleware)\n  const [error, setError] = useState<string | null>(null)\n\n  return (\n    <div className=\"p-4\">\n      <h1 data-testid=\"middleware-redirect-source\">Middleware Redirect Test</h1>\n      <p className=\"mt-2\">\n        This tests that redirects thrown via server functions work correctly\n        when function middleware is attached (Issue #5372)\n      </p>\n      <button\n        data-testid=\"trigger-redirect-btn\"\n        className=\"mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600\"\n        onClick={async () => {\n          try {\n            setError(null)\n            await redirectFn()\n          } catch (e) {\n            // If there's a serialization error, it will be caught here\n            setError(e instanceof Error ? e.message : String(e))\n          }\n        }}\n      >\n        Trigger Redirect via Server Function\n      </button>\n      {error && (\n        <div data-testid=\"error-message\" className=\"mt-4 text-red-500\">\n          Error: {error}\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/redirect-with-middleware/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/middleware/redirect-with-middleware/target',\n)({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-4\">\n      <h1 data-testid=\"middleware-redirect-target\">\n        Redirect Target (Middleware)\n      </h1>\n      <p className=\"mt-2\">\n        Successfully redirected! Middleware did not cause serialization error.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/request-middleware.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { getRequest } from '@tanstack/react-start/server'\nimport React from 'react'\n\nconst requestMiddleware = createMiddleware({ type: 'request' }).server(\n  async ({ next, request }) => {\n    return next({\n      context: {\n        requestParam: request.url,\n        requestFunc: getRequest().url,\n      },\n    })\n  },\n)\n\nconst serverFn = createServerFn()\n  .middleware([requestMiddleware])\n  .handler(async ({ context: { requestParam, requestFunc } }) => {\n    return { requestParam, requestFunc }\n  })\n\nexport const Route = createFileRoute('/middleware/request-middleware')({\n  loader: () => serverFn(),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n\n  const [clientData, setClientData] = React.useState<typeof loaderData | null>(\n    null,\n  )\n\n  return (\n    <div>\n      <h2>Request Middleware in combination with server function</h2>\n      <br />\n      <div>\n        <div data-testid=\"loader-data\">\n          <h3>Loader Data</h3>Request Param:\n          <div data-testid=\"loader-data-request-param\">\n            {loaderData.requestParam}\n          </div>\n          Request Func:\n          <div data-testid=\"loader-data-request-func\">\n            {loaderData.requestFunc}\n          </div>\n        </div>\n        <br />\n        <div data-testid=\"client-call\">\n          <button\n            data-testid=\"client-call-button\"\n            onClick={async () => {\n              const data = await serverFn()\n              setClientData(data)\n            }}\n          >\n            Call server function from client\n          </button>\n        </div>\n        <br />\n        <div data-testid=\"client-data-container\">\n          <h3>Client Data</h3>\n          {clientData ? (\n            <div data-testid=\"client-data\">\n              Request Param:\n              <div data-testid=\"client-data-request-param\">\n                {clientData.requestParam}\n              </div>\n              Request Func:\n              <div data-testid=\"client-data-request-func\">\n                {clientData.requestFunc}\n              </div>\n            </div>\n          ) : (\n            ' Loading ...'\n          )}\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/send-serverFn.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport React from 'react'\n\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    return next({\n      sendContext: {\n        serverFn: barFn,\n      },\n    })\n  },\n)\n\nconst fooFn = createServerFn()\n  .middleware([middleware])\n  .handler(({ context }) => {\n    return context.serverFn()\n  })\nconst barFn = createServerFn().handler(() => {\n  return 'bar'\n})\n\nexport const Route = createFileRoute('/middleware/send-serverFn')({\n  component: RouteComponent,\n  loader: async () => ({ serverFnLoaderResult: await fooFn() }),\n})\n\nfunction RouteComponent() {\n  const [serverFnClientResult, setServerFnClientResult] = React.useState({})\n  const { serverFnLoaderResult } = Route.useLoaderData()\n\n  return (\n    <div\n      className=\"p-2 m-2 grid gap-2\"\n      data-testid=\"client-middleware-router-route-component\"\n    >\n      <h3>Send server function in context</h3>\n      <p>\n        This component checks that the client middleware can send a reference to\n        a server function in the context, which can then be invoked in the\n        server function handler.\n      </p>\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-server-fn-result\">\n            {JSON.stringify('bar')}\n          </pre>\n        </code>\n      </div>\n      <p>\n        serverFn when invoked in the loader returns:\n        <br />\n        <span data-testid=\"serverFn-loader-result\">\n          {JSON.stringify(serverFnClientResult)}\n        </span>\n      </p>\n      <p>\n        serverFn when invoked on the client returns:\n        <br />\n        <span data-testid=\"serverFn-client-result\">\n          {JSON.stringify(serverFnLoaderResult)}\n        </span>\n      </p>\n      <button\n        data-testid=\"btn-serverFn\"\n        type=\"button\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          fooFn().then(setServerFnClientResult)\n        }}\n      >\n        Invoke Server Function\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/server-import-middleware.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\nimport { getRequestHeaders } from '@tanstack/react-start/server'\nimport React from 'react'\n\n/**\n * This test verifies that server-only imports (like getRequestHeaders from @tanstack/react-start/server)\n * are properly removed from the client bundle when used inside createMiddleware().server().\n *\n * If the .server() part is not stripped from the client build, this will fail with:\n * \"Module node:async_hooks has been externalized for browser compatibility\"\n * because @tanstack/react-start/server uses node:async_hooks internally.\n */\nconst serverImportMiddleware = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    // Use a server-only import - this should be stripped from client build\n    const headers = getRequestHeaders()\n    const testHeader = headers.get('x-test-middleware') ?? 'missing'\n\n    console.log('[server-import-middleware] X-Test-Middleware:', testHeader)\n\n    return next({\n      context: {\n        testHeader,\n      },\n    })\n  },\n)\n\nconst serverFn = createServerFn()\n  .middleware([serverImportMiddleware])\n  .handler(async ({ context }) => {\n    return { testHeader: context.testHeader }\n  })\n\nexport const Route = createFileRoute('/middleware/server-import-middleware')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [result, setResult] = React.useState<{ testHeader: string } | null>(\n    null,\n  )\n  const [error, setError] = React.useState<string | null>(null)\n\n  async function handleClick() {\n    try {\n      const data = await serverFn({\n        headers: { 'x-test-middleware': 'test-header-value' },\n      })\n      setResult(data)\n      setError(null)\n    } catch (e) {\n      setResult(null)\n      setError(e instanceof Error ? e.message : String(e))\n    }\n  }\n\n  return (\n    <div>\n      <h2>Server Import in Middleware Test</h2>\n      <p>\n        This test verifies that server-only imports (getRequestHeaders) inside\n        createMiddleware().server() are properly stripped from the client build.\n      </p>\n      <button\n        onClick={handleClick}\n        data-testid=\"test-server-import-middleware-btn\"\n      >\n        Call server function with middleware\n      </button>\n      {result && (\n        <div data-testid=\"server-import-middleware-result\">\n          {result.testHeader}\n        </div>\n      )}\n      {error && (\n        <div data-testid=\"server-import-middleware-error\">Error: {error}</div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/middleware/unhandled-exception.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\n\n// Middleware that throws an unhandled exception\n// Issue #5266: Server crashes when unhandled exception in server function or middleware\nconst throwingMiddleware = createMiddleware({ type: 'function' }).server(\n  async () => {\n    throw new Error('Unhandled middleware exception')\n  },\n)\n\nconst serverFnWithThrowingMiddleware = createServerFn({ method: 'GET' })\n  .middleware([throwingMiddleware])\n  .handler(() => {\n    return { success: true }\n  })\n\nexport const Route = createFileRoute('/middleware/unhandled-exception')({\n  loader: async () => {\n    return {\n      result: await serverFnWithThrowingMiddleware(),\n    }\n  },\n  errorComponent: ({ error }) => {\n    return (\n      <div data-testid=\"unhandled-exception-error\">\n        <h1>Error Caught</h1>\n        <p data-testid=\"error-message\">\n          {error instanceof Error ? error.message : 'Unknown error'}\n        </p>\n      </div>\n    )\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div data-testid=\"route-success\">Should not render</div>\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/multipart.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const Route = createFileRoute('/multipart')({\n  component: MultipartServerFnCall,\n})\n\nconst multipartFormDataServerFn = createServerFn({ method: 'POST' })\n  .inputValidator((x: unknown) => {\n    if (!(x instanceof FormData)) {\n      throw new Error('Invalid form data')\n    }\n\n    const value = x.get('input_field')\n    const file = x.get('input_file')\n\n    if (typeof value !== 'string') {\n      throw new Error('Submitted value is not a string')\n    }\n\n    if (!(file instanceof File)) {\n      throw new Error('File is required')\n    }\n\n    return {\n      submittedValue: value,\n      file,\n    }\n  })\n  .handler(async ({ data }) => {\n    const contents = await data.file.text()\n    return {\n      value: data.submittedValue,\n      file: {\n        name: data.file.name,\n        size: data.file.size,\n        contents: contents,\n      },\n    }\n  })\n\nfunction MultipartServerFnCall() {\n  const formRef = React.useRef<HTMLFormElement | null>(null)\n  const [multipartResult, setMultipartResult] = React.useState({})\n\n  const handleSubmit = (e: React.MouseEvent<HTMLButtonElement>) => {\n    e.preventDefault()\n\n    if (!formRef.current) {\n      return\n    }\n\n    const formData = new FormData(formRef.current)\n    multipartFormDataServerFn({ data: formData }).then(setMultipartResult)\n  }\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Multipart Server Fn POST Call</h3>\n      <div className=\"overflow-y-auto\">\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-multipart-server-fn-result\">\n            {JSON.stringify({\n              value: 'test field value',\n              file: { name: 'my_file.txt', size: 9, contents: 'test data' },\n            })}\n          </pre>\n        </code>\n      </div>\n      <form\n        className=\"flex flex-col gap-2\"\n        action={multipartFormDataServerFn.url}\n        method=\"POST\"\n        encType=\"multipart/form-data\"\n        ref={formRef}\n        data-testid=\"multipart-form\"\n      >\n        <input type=\"text\" name=\"input_field\" defaultValue=\"test field value\" />\n        <input\n          type=\"file\"\n          name=\"input_file\"\n          data-testid=\"multipart-form-file-input\"\n        />\n        <button\n          type=\"submit\"\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit (native)\n        </button>\n        <button\n          type=\"button\"\n          onClick={handleSubmit}\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit (onClick)\n        </button>\n      </form>\n      <div className=\"overflow-y-auto\">\n        <pre data-testid=\"multipart-form-response\">\n          {JSON.stringify(multipartResult)}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/primitives/index.tsx",
    "content": "import { useQuery } from '@tanstack/react-query'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { useCallback } from 'react'\nimport { z } from 'zod'\nexport const Route = createFileRoute('/primitives/')({\n  component: RouteComponent,\n})\n\nfunction stringify(data: any) {\n  return JSON.stringify(data === undefined ? '$undefined' : data)\n}\n\nconst $stringPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.string())\n  .handler((ctx) => ctx.data)\n\nconst $stringGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.string())\n  .handler((ctx) => ctx.data)\n\nconst $undefinedPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.undefined())\n  .handler((ctx) => ctx.data)\n\nconst $undefinedGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.undefined())\n  .handler((ctx) => ctx.data)\n\nconst $nullPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.null())\n  .handler((ctx) => ctx.data)\n\nconst $nullGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.null())\n  .handler((ctx) => ctx.data)\n\ninterface PrimitiveComponentProps<T> {\n  serverFn: {\n    get: (opts: { data: T }) => Promise<T>\n    post: (opts: { data: T }) => Promise<T>\n  }\n  data: {\n    value: T\n    type: string\n  }\n}\n\ninterface TestProps<T> extends PrimitiveComponentProps<T> {\n  method: 'get' | 'post'\n}\nfunction Test<T>(props: TestProps<T>) {\n  const queryFn = useCallback(async () => {\n    const result = await props.serverFn[props.method]({\n      data: props.data.value,\n    })\n    if (result === undefined) {\n      return '$undefined'\n    }\n    return result\n  }, [props])\n  const query = useQuery({ queryKey: [props.data.type, props.method], queryFn })\n  const testId = `${props.method}-${props.data.type}`\n  return (\n    <div>\n      <h3>serverFn method={props.method}</h3>\n      <h4> expected </h4>\n      <div data-testid={`expected-${testId}`}>\n        {stringify(props.data.value)}\n      </div>\n      <h4> result</h4>\n      {query.isSuccess ? (\n        <div data-testid={`result-${testId}`}>{stringify(query.data)}</div>\n      ) : null}\n    </div>\n  )\n}\nfunction PrimitiveComponent<T>(props: PrimitiveComponentProps<T>) {\n  return (\n    <div>\n      <h2>data type: {props.data.type}</h2>\n      <Test {...props} method=\"post\" />\n      <br />\n      <Test {...props} method=\"get\" />\n      <br />\n      <br />\n    </div>\n  )\n}\n\nfunction makeTestCase<T>(props: PrimitiveComponentProps<T>) {\n  return props\n}\nconst testCases = [\n  makeTestCase({\n    data: {\n      value: null,\n      type: 'null',\n    },\n    serverFn: {\n      get: $nullGet,\n      post: $nullPost,\n    },\n  }),\n  makeTestCase({\n    data: {\n      value: undefined,\n      type: 'undefined',\n    },\n    serverFn: {\n      get: $undefinedGet,\n      post: $undefinedPost,\n    },\n  }),\n  makeTestCase({\n    data: {\n      value: 'foo-bar',\n      type: 'string',\n    },\n    serverFn: {\n      get: $stringGet,\n      post: $stringPost,\n    },\n  }),\n] as Array<PrimitiveComponentProps<any>>\n\nfunction RouteComponent() {\n  return testCases.map((t) => <PrimitiveComponent {...t} key={t.data.type} />)\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/raw-response.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const Route = createFileRoute('/raw-response')({\n  component: RouteComponent,\n})\n\nconst expectedValue = 'Hello from a server function!'\nexport const rawResponseFn = createServerFn().handler(() => {\n  return new Response(expectedValue)\n})\n\nfunction RouteComponent() {\n  const [formDataResult, setFormDataResult] = React.useState({})\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Raw Response</h3>\n      <div className=\"overflow-y-auto\">\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected\">{expectedValue}</pre>\n        </code>\n      </div>\n\n      <button\n        onClick={async () => {\n          const response = await rawResponseFn()\n          console.log('response', response)\n\n          const text = await response.text()\n          setFormDataResult(text)\n        }}\n        data-testid=\"button\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n      >\n        Submit\n      </button>\n\n      <div className=\"overflow-y-auto\">\n        <pre data-testid=\"response\">{JSON.stringify(formDataResult)}</pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/redirect-test/index.tsx",
    "content": "import { useQuery } from '@tanstack/react-query'\nimport { createFileRoute, redirect } from '@tanstack/react-router'\nimport { createServerFn, useServerFn } from '@tanstack/react-start'\nimport { Suspense } from 'react'\n\nconst $redirectServerFn = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    throw redirect({ to: '/redirect-test/target' })\n  },\n)\n\nexport const Route = createFileRoute('/redirect-test/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const redirectFn = useServerFn($redirectServerFn)\n  const query = useQuery({\n    queryKey: ['redirect-test'],\n    queryFn: () => redirectFn(),\n  })\n\n  return (\n    <div>\n      <h1 data-testid=\"redirect-source\">Redirect Source</h1>\n      <Suspense>\n        <div>{JSON.stringify(query.data)}</div>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/redirect-test/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect-test/target')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h1 data-testid=\"redirect-target\">Redirect Target</h1>\n      <p>Successfully redirected!</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/redirect-test-ssr/index.tsx",
    "content": "import { useQuery } from '@tanstack/react-query'\nimport { createFileRoute, redirect } from '@tanstack/react-router'\nimport { createServerFn, useServerFn } from '@tanstack/react-start'\nimport { Suspense } from 'react'\n\nconst $redirectServerFn = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    throw redirect({ to: '/redirect-test-ssr/target' })\n  },\n)\n\nexport const Route = createFileRoute('/redirect-test-ssr/')({\n  component: RouteComponent,\n  ssr: true,\n})\n\nfunction RouteComponent() {\n  const redirectFn = useServerFn($redirectServerFn)\n  const query = useQuery({\n    queryKey: ['redirect-test-ssr'],\n    queryFn: () => redirectFn(),\n  })\n\n  return (\n    <div>\n      <h1 data-testid=\"redirect-source-ssr\">Redirect Source SSR</h1>\n      <Suspense>\n        <div>{JSON.stringify(query.data)}</div>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/redirect-test-ssr/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect-test-ssr/target')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h1 data-testid=\"redirect-target-ssr\">Redirect Target SSR</h1>\n      <p>Successfully redirected!</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/return-null.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport * as React from 'react'\n\n/**\n * This checks whether the server function can\n * return null without throwing an error or returning something else.\n * @link https://github.com/TanStack/router/issues/2776\n */\n\nexport const Route = createFileRoute('/return-null')({\n  component: AllowServerFnReturnNull,\n})\n\nconst $allow_return_null_getFn = createServerFn().handler(async () => {\n  return null\n})\nconst $allow_return_null_postFn = createServerFn({ method: 'POST' }).handler(\n  async () => {\n    return null\n  },\n)\n\nfunction AllowServerFnReturnNull() {\n  const [getServerResult, setGetServerResult] = React.useState<any>('-')\n  const [postServerResult, setPostServerResult] = React.useState<any>('-')\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Allow ServerFn to return `null`</h3>\n      <p>\n        This component checks whether the server function can return null\n        without throwing an error.\n      </p>\n      <div>\n        It should return{' '}\n        <code>\n          <pre>{JSON.stringify(null)}</pre>\n        </code>\n      </div>\n      <p>\n        {`GET: $allow_return_null_getFn returns`}\n        <br />\n        <span data-testid=\"allow_return_null_getFn-response\">\n          {JSON.stringify(getServerResult)}\n        </span>\n      </p>\n      <p>\n        {`POST: $allow_return_null_postFn returns`}\n        <br />\n        <span data-testid=\"allow_return_null_postFn-response\">\n          {JSON.stringify(postServerResult)}\n        </span>\n      </p>\n      <button\n        data-testid=\"test-allow-server-fn-return-null-btn\"\n        type=\"button\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          $allow_return_null_getFn().then(setGetServerResult)\n          $allow_return_null_postFn().then(setPostServerResult)\n        }}\n      >\n        Test Allow Server Fn Return Null\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/serialize-form-data.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const Route = createFileRoute('/serialize-form-data')({\n  component: SerializeFormDataFnCall,\n})\n\nconst testValues = {\n  name: 'Sean',\n  age: 25,\n  pet1: 'dog',\n  pet2: 'cat',\n  __adder: 1,\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n    const age = data.get('age')\n    const pets = data.getAll('pet')\n\n    if (!name || !age || pets.length === 0) {\n      throw new Error('Name, age and pets are required')\n    }\n\n    return {\n      name: name.toString(),\n      age: parseInt(age.toString(), 10),\n      pets: pets.map((pet) => pet.toString()),\n    }\n  })\n  .handler(({ data: { name, age, pets } }) => {\n    return `Hello, ${name}! You are ${age + testValues.__adder} years old, and your favorite pets are ${pets.join(',')}.`\n  })\n\nexport function SerializeFormDataFnCall() {\n  const [formDataResult, setFormDataResult] = React.useState({})\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Serialize FormData Fn POST Call</h3>\n      <div className=\"overflow-y-auto\">\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-serialize-formdata-server-fn-result\">\n            Hello, {testValues.name}! You are{' '}\n            {testValues.age + testValues.__adder} years old, and your favorite{' '}\n            pets are {testValues.pet1},{testValues.pet2}.\n          </pre>\n        </code>\n      </div>\n      <form\n        className=\"flex flex-col gap-2\"\n        data-testid=\"serialize-formdata-form\"\n        onSubmit={(evt) => {\n          evt.preventDefault()\n          const data = new FormData(evt.currentTarget)\n          greetUser({ data }).then(setFormDataResult)\n        }}\n      >\n        <input type=\"text\" name=\"name\" defaultValue={testValues.name} />\n        <input type=\"number\" name=\"age\" defaultValue={testValues.age} />\n        <input type=\"text\" name=\"pet\" defaultValue={testValues.pet1} />\n        <input type=\"text\" name=\"pet\" defaultValue={testValues.pet2} />\n        <button\n          type=\"submit\"\n          data-testid=\"test-serialize-formdata-fn-calls-btn\"\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit\n        </button>\n      </form>\n      <div className=\"overflow-y-auto\">\n        <pre data-testid=\"serialize-formdata-form-response\">\n          {JSON.stringify(formDataResult)}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/server-fn-in-client-only-fn.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createClientOnlyFn, createServerFn } from '@tanstack/react-start'\nimport { useState } from 'react'\n\n// Server function that should be callable from client-only function\nconst serverFn = createServerFn().handler(() => {\n  return 'server function executed successfully'\n})\n\n// Client-only function that calls the server function\n// This scenario currently fails due to compilation order issues:\n// 1. createClientOnlyFn is processed first, removing the serverFn reference on server\n// 2. Dead code elimination removes the serverFn entirely\n// 3. The server function is never registered, causing runtime errors\nconst clientOnlyFnThatCallsServerFn = createClientOnlyFn(async () => {\n  const result = await serverFn()\n  return 'client-only fn received: ' + result\n})\n\nexport const Route = createFileRoute('/server-fn-in-client-only-fn')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [result, setResult] = useState<string | null>(null)\n  const [error, setError] = useState<string | null>(null)\n\n  async function handleClick() {\n    try {\n      const res = await clientOnlyFnThatCallsServerFn()\n      setResult(res)\n      setError(null)\n    } catch (e) {\n      setResult(null)\n      setError(e instanceof Error ? e.message : String(e))\n    }\n  }\n\n  return (\n    <div>\n      <h1>Server Function in Client-Only Function Test</h1>\n      <p>\n        This test verifies that a server function can be called from inside a\n        createClientOnlyFn.\n      </p>\n      <button\n        onClick={handleClick}\n        data-testid=\"test-server-fn-in-client-only-fn-btn\"\n      >\n        Call client-only function that calls server function\n      </button>\n      <pre data-testid=\"expected-result\">\n        client-only fn received: server function executed successfully\n      </pre>\n      {result && (\n        <pre data-testid=\"server-fn-in-client-only-fn-result\">{result}</pre>\n      )}\n      {error && (\n        <pre data-testid=\"server-fn-in-client-only-fn-error\">{error}</pre>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/server-only-fn.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { createServerFn } from '@tanstack/react-start'\nimport { fnOnlyCalledByServer } from '~/functions/fnOnlyCalledByServer'\n\n/**\n * This tests that server functions called only from the server (not from the client)\n * are still included in the build and work correctly at runtime.\n *\n * The `fnOnlyCalledByServer` is only called from `proxyFnThatCallsServerOnlyFn` on the server,\n * and is never referenced directly from client code.\n */\n\n// This function IS called from the client, and it calls serverOnlyFn on the server\nconst proxyFnThatCallsServerOnlyFn = createServerFn().handler(async () => {\n  // Call the server-only function from within another server function\n  const result = await fnOnlyCalledByServer()\n  return {\n    fromServerOnlyFn: result,\n    wrapper: 'client-callable wrapper',\n  }\n})\n\nconst getFnOnlyCalledByServer = createServerFn().handler(async () => {\n  return fnOnlyCalledByServer\n})\n\nexport const Route = createFileRoute('/server-only-fn')({\n  component: ServerOnlyFnTest,\n})\n\nfunction ServerOnlyFnTest() {\n  const [result, setResult] = React.useState<{\n    fromServerOnlyFn: { message: string; secret: number }\n    wrapper: string\n  } | null>(null)\n\n  const [callFromServerResult, setCallFromServerResult] = React.useState<\n    string | null\n  >(null)\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Server-Only Function Test</h3>\n      <p>\n        This tests that server functions which are only called from other server\n        functions (and never directly from the client) still work correctly.\n      </p>\n      <div>\n        Expected result:{' '}\n        <code>\n          <pre data-testid=\"expected-server-only-fn-result\">\n            {JSON.stringify({\n              fromServerOnlyFn: {\n                message: 'hello from server-only function',\n                secret: 42,\n              },\n              wrapper: 'client-callable wrapper',\n            })}\n          </pre>\n        </code>\n      </div>\n      <div>\n        Actual result:{' '}\n        <code>\n          <pre data-testid=\"server-only-fn-result\">\n            {result ? JSON.stringify(result) : 'null'}\n          </pre>\n        </code>\n      </div>\n      <button\n        data-testid=\"test-server-only-fn-btn\"\n        type=\"button\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={async () => {\n          const res = await proxyFnThatCallsServerOnlyFn()\n          setResult(res)\n        }}\n      >\n        Test Server-Only Function\n      </button>\n\n      <button\n        data-testid=\"call-server-fn-from-client-btn\"\n        className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={async () => {\n          try {\n            const fn = await getFnOnlyCalledByServer()\n            await fn()\n            setCallFromServerResult('success')\n          } catch (e) {\n            setCallFromServerResult('error')\n          }\n        }}\n      >\n        Call Server Fn From Client\n      </button>\n      {callFromServerResult && (\n        <div data-testid=\"call-server-fn-from-client-result\">\n          {callFromServerResult}\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/status.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn, useServerFn } from '@tanstack/react-start'\nimport { setResponseStatus } from '@tanstack/react-start/server'\n\nconst helloFn = createServerFn().handler(() => {\n  setResponseStatus(225, `hello`)\n  return {\n    hello: 'world',\n  }\n})\n\nexport const Route = createFileRoute('/status')({\n  component: StatusComponent,\n})\n\nfunction StatusComponent() {\n  const hello = useServerFn(helloFn)\n\n  return (\n    <div className=\"p-2\">\n      <button\n        data-testid=\"invoke-server-fn\"\n        className=\"px-4 py-2 bg-blue-500 text-white rounded-md\"\n        onClick={() => hello()}\n      >\n        click me\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/routes/submit-post-formdata.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const Route = createFileRoute('/submit-post-formdata')({\n  component: SubmitPostFormDataFn,\n})\n\nconst testValues = {\n  name: 'Sean',\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n\n    if (!name) {\n      throw new Error('Name is required')\n    }\n\n    return {\n      name: name.toString(),\n    }\n  })\n  .handler(({ data: { name } }) => {\n    return new Response(`Hello, ${name}!`)\n  })\n\nfunction SubmitPostFormDataFn() {\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Submit POST FormData Fn Call</h3>\n      <div className=\"overflow-y-auto\">\n        It should navigate to a raw response of {''}\n        <code>\n          <pre data-testid=\"expected-submit-post-formdata-server-fn-result\">\n            Hello, {testValues.name}!\n          </pre>\n        </code>\n      </div>\n      <form\n        className=\"flex flex-col gap-2\"\n        data-testid=\"submit-post-formdata-form\"\n        method=\"POST\"\n        action={greetUser.url}\n      >\n        <input type=\"text\" name=\"name\" defaultValue={testValues.name} />\n        <button\n          type=\"submit\"\n          data-testid=\"test-submit-post-formdata-fn-calls-btn\"\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit (native)\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/start.ts",
    "content": "import { createStart } from '@tanstack/react-start'\nimport type { CustomFetch } from '@tanstack/react-start'\n\n/**\n * Global custom fetch implementation for all server functions.\n * This adds an 'x-global-fetch' header to all requests, which can be used\n * to verify that the global fetch is being used.\n *\n * This fetch has lower priority than middleware and call-site fetch,\n * so it can be overridden when needed.\n */\nconst globalServerFnFetch: CustomFetch = (input, init) => {\n  const headers = new Headers(init?.headers)\n  headers.set('x-global-fetch', 'true')\n  return fetch(input, { ...init, headers })\n}\n\nexport const startInstance = createStart(() => ({\n  serverFns: {\n    fetch: globalServerFnFetch,\n  },\n}))\n"
  },
  {
    "path": "e2e/react-start/server-functions/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/tests/server-functions.spec.ts",
    "content": "import * as fs from 'node:fs'\nimport { expect } from '@playwright/test'\nimport { getTestServerPort, test } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\nimport type { Page } from '@playwright/test'\n\nconst PORT = await getTestServerPort(packageJson.name)\n\ntest('Server function URLs correctly include explicit ids', async ({\n  page,\n}) => {\n  const expectedIds: Record<string, string> = {\n    '/submit-post-formdata': 'submit-post-formdata-greetUser',\n    '/formdata-redirect': 'formdata-redirect-greetUser',\n  }\n\n  for (const [currentPage, expectedId] of Object.entries(expectedIds)) {\n    await page.goto(currentPage)\n    await page.waitForLoadState('networkidle')\n\n    const form = page.locator('form')\n    const actionUrl = await form.getAttribute('action')\n\n    expect(actionUrl).toMatch(`/_serverFn/${expectedId}`)\n  }\n})\n\ntest('invoking a server function with custom response status code', async ({\n  page,\n}) => {\n  await page.goto('/status')\n\n  await page.waitForLoadState('networkidle')\n\n  const requestPromise = new Promise<void>((resolve) => {\n    page.on('response', (response) => {\n      expect(response.status()).toBe(225)\n      expect(response.statusText()).toBe('hello')\n      expect(response.headers()['content-type']).toContain('application/json')\n      resolve()\n    })\n  })\n  await page.getByTestId('invoke-server-fn').click()\n  await requestPromise\n})\n\ntest('Consistent server function returns both on client and server for GET and POST calls', async ({\n  page,\n}) => {\n  await page.goto('/consistent')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-consistent-server-fns-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-consistent-server-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  // GET calls\n  await expect(page.getByTestId('cons_serverGetFn1-response')).toContainText(\n    expected,\n  )\n  await expect(page.getByTestId('cons_getFn1-response')).toContainText(expected)\n\n  // POST calls\n  await expect(page.getByTestId('cons_serverPostFn1-response')).toContainText(\n    expected,\n  )\n  await expect(page.getByTestId('cons_postFn1-response')).toContainText(\n    expected,\n  )\n})\n\ntest('submitting multipart/form-data as server function input', async ({\n  page,\n}) => {\n  await page.goto('/multipart')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-multipart-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  const fileChooserPromise = page.waitForEvent('filechooser')\n  await page.getByTestId('multipart-form-file-input').click()\n  const fileChooser = await fileChooserPromise\n  await fileChooser.setFiles({\n    name: 'my_file.txt',\n    mimeType: 'text/plain',\n    buffer: Buffer.from('test data', 'utf-8'),\n  })\n  await page.getByText('Submit (onClick)').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('multipart-form-response')).toContainText(\n    expected,\n  )\n})\n\ntest('isomorphic functions can have different implementations on client and server', async ({\n  page,\n}) => {\n  await page.goto('/isomorphic-fns')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-isomorphic-results-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('server-result')).toContainText('server')\n  await expect(page.getByTestId('client-result')).toContainText('client')\n  await expect(page.getByTestId('ssr-result')).toContainText('server')\n\n  await expect(page.getByTestId('server-echo-result')).toContainText(\n    'server received hello',\n  )\n  await expect(page.getByTestId('client-echo-result')).toContainText(\n    'client received hello',\n  )\n})\n\ntest('env-only functions can only be called on the server or client respectively', async ({\n  page,\n}) => {\n  await page.goto('/env-only')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-env-only-results-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('server-on-server')).toContainText(\n    'server got: hello',\n  )\n  await expect(page.getByTestId('server-on-client')).toContainText(\n    'serverEcho threw an error: createServerOnlyFn() functions can only be called on the server!',\n  )\n\n  await expect(page.getByTestId('client-on-server')).toContainText(\n    'clientEcho threw an error: createClientOnlyFn() functions can only be called on the client!',\n  )\n  await expect(page.getByTestId('client-on-client')).toContainText(\n    'client got: hello',\n  )\n})\n\ntest('Server function can return null for GET and POST calls', async ({\n  page,\n}) => {\n  await page.goto('/return-null')\n\n  await page.waitForLoadState('networkidle')\n  await page.getByTestId('test-allow-server-fn-return-null-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  // GET call\n  await expect(\n    page.getByTestId('allow_return_null_getFn-response'),\n  ).toContainText(JSON.stringify(null))\n\n  // POST call\n  await expect(\n    page.getByTestId('allow_return_null_postFn-response'),\n  ).toContainText(JSON.stringify(null))\n})\n\ntest('Server function can correctly send and receive FormData', async ({\n  page,\n}) => {\n  await page.goto('/serialize-form-data')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-serialize-formdata-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-serialize-formdata-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(\n    page.getByTestId('serialize-formdata-form-response'),\n  ).toContainText(expected)\n})\n\ntest('server function correctly passes context when using FormData', async ({\n  page,\n}) => {\n  await page.goto('/formdata-context')\n\n  await page.waitForLoadState('networkidle')\n\n  const expectedContextValue =\n    (await page.getByTestId('expected-formdata-context-value').textContent()) ||\n    ''\n  expect(expectedContextValue).toBe('context-from-middleware')\n\n  // Test FormData function\n  await page.getByTestId('test-formdata-context-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  // Wait for the result to appear\n  await page.waitForSelector('[data-testid=\"formdata-context-result\"]')\n\n  const resultText =\n    (await page.getByTestId('formdata-context-result').textContent()) || ''\n  expect(resultText).not.toBe('')\n\n  const result = JSON.parse(resultText)\n\n  // Verify context was passed correctly for FormData function\n  expect(result.success).toBe(true)\n  expect(result.hasContext).toBe(true)\n  expect(result.name).toBe('TestUser')\n  expect(result.testString).toBeDefined()\n  expect(result.testString).toContain('context-from-middleware')\n\n  // Test simple function (no parameters)\n  await page.getByTestId('test-simple-context-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  // Wait for the result to appear\n  await page.waitForSelector('[data-testid=\"formdata-context-result\"]')\n\n  const simpleResultText =\n    (await page.getByTestId('formdata-context-result').textContent()) || ''\n  expect(simpleResultText).not.toBe('')\n\n  const simpleResult = JSON.parse(simpleResultText)\n\n  // Verify context was passed correctly for simple function\n  expect(simpleResult.success).toBe(true)\n  expect(simpleResult.hasContext).toBe(true)\n  expect(simpleResult.testString).toBeDefined()\n  expect(simpleResult.testString).toContain('context-from-middleware')\n})\n\ntest('server function can correctly send and receive headers', async ({\n  page,\n}) => {\n  await page.goto('/headers')\n\n  await page.waitForLoadState('networkidle')\n  let headers = JSON.parse(\n    await page.getByTestId('initial-headers-result').innerText(),\n  )\n  expect(headers['host']).toBe(`localhost:${PORT}`)\n  expect(headers['user-agent']).toContain('Mozilla/5.0')\n  expect(headers['sec-fetch-mode']).toBe('navigate')\n\n  await page.getByTestId('test-headers-btn').click()\n  await page.waitForSelector('[data-testid=\"updated-headers-result\"]')\n\n  headers = JSON.parse(\n    await page.getByTestId('updated-headers-result').innerText(),\n  )\n\n  expect(headers['host']).toBe(`localhost:${PORT}`)\n  expect(headers['user-agent']).toContain('Mozilla/5.0')\n  expect(headers['sec-fetch-mode']).toBe('cors')\n  expect(headers['referer']).toBe(`http://localhost:${PORT}/headers`)\n})\n\ntest('Direct POST submitting FormData to a Server function returns the correct message', async ({\n  page,\n}) => {\n  await page.goto('/submit-post-formdata')\n\n  await page.waitForLoadState('networkidle')\n\n  const expected =\n    (await page\n      .getByTestId('expected-submit-post-formdata-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  const result = await page.innerText('body')\n  expect(result).toBe(expected)\n})\n\ntest(\"server function's dead code is preserved if already there\", async ({\n  page,\n}) => {\n  await page.goto('/dead-code-preserve')\n\n  await page.waitForLoadState('networkidle')\n  await page.getByTestId('test-dead-code-fn-call-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('dead-code-fn-call-response')).toContainText(\n    '1',\n  )\n\n  await fs.promises.rm('count-effect.txt')\n})\n\ntest.describe('server function sets cookies', () => {\n  async function runCookieTest(page: Page, expectedCookieValue: string) {\n    for (let i = 1; i <= 4; i++) {\n      const key = `cookie-${i}-${expectedCookieValue}`\n\n      const actualValue = await page.getByTestId(key).textContent()\n      expect(actualValue).toBe(expectedCookieValue)\n    }\n  }\n  test('SSR', async ({ page }) => {\n    const expectedCookieValue = `SSR-${Date.now()}`\n    await page.goto(`/cookies/set?value=${expectedCookieValue}`)\n    await runCookieTest(page, expectedCookieValue)\n  })\n\n  test('client side navigation', async ({ page }) => {\n    const expectedCookieValue = `CLIENT-${Date.now()}`\n    await page.goto(`/cookies?value=${expectedCookieValue}`)\n    await page.getByTestId('link-to-set').click()\n    await runCookieTest(page, expectedCookieValue)\n  })\n})\n;['GET', 'POST'].forEach((method) => {\n  test.describe(`aborting a server function call: method ${method}`, () => {\n    test('without aborting', async ({ page }) => {\n      await page.goto('/abort-signal/' + method)\n\n      await page.waitForLoadState('networkidle')\n\n      await page.getByTestId('run-without-abort-btn').click()\n      await page.waitForLoadState('networkidle')\n      await page.waitForSelector(\n        '[data-testid=\"result\"]:has-text(\"server function result\")',\n      )\n      await page.waitForSelector(\n        '[data-testid=\"errorMessage\"]:has-text(\"$undefined\")',\n      )\n\n      const result = (await page.getByTestId('result').textContent()) || ''\n      expect(result).toBe('server function result')\n\n      const errorMessage =\n        (await page.getByTestId('errorMessage').textContent()) || ''\n      expect(errorMessage).toBe('$undefined')\n    })\n\n    test('aborting', async ({ page }) => {\n      await page.goto('/abort-signal/' + method)\n      await page.waitForLoadState('networkidle')\n\n      await page.getByTestId('run-with-abort-btn').click()\n      await page.waitForLoadState('networkidle')\n      await page.waitForSelector(\n        '[data-testid=\"result\"]:has-text(\"$undefined\")',\n      )\n      await page.waitForSelector(\n        '[data-testid=\"errorMessage\"]:has-text(\"aborted\")',\n      )\n\n      const result = (await page.getByTestId('result').textContent()) || ''\n      expect(result).toBe('$undefined')\n\n      const errorMessage =\n        (await page.getByTestId('errorMessage').textContent()) || ''\n      expect(errorMessage).toContain('abort')\n    })\n  })\n})\n\ntest.describe('server functions with async validation', () => {\n  test.use({\n    whitelistErrors: [\n      'Failed to load resource: the server responded with a status of 500',\n    ],\n  })\n\n  test('with valid input', async ({ page }) => {\n    await page.goto('/async-validation')\n\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('run-with-valid-btn').click()\n    await page.waitForLoadState('networkidle')\n    await page.waitForSelector('[data-testid=\"result\"]:has-text(\"valid\")')\n    await page.waitForSelector(\n      '[data-testid=\"errorMessage\"]:has-text(\"$undefined\")',\n    )\n\n    const result = (await page.getByTestId('result').textContent()) || ''\n    expect(result).toBe('valid')\n\n    const errorMessage =\n      (await page.getByTestId('errorMessage').textContent()) || ''\n    expect(errorMessage).toBe('$undefined')\n  })\n\n  test('with invalid input', async ({ page }) => {\n    await page.goto('/async-validation')\n\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('run-with-invalid-btn').click()\n    await page.waitForLoadState('networkidle')\n    await page.waitForSelector('[data-testid=\"result\"]:has-text(\"$undefined\")')\n    await page.waitForSelector(\n      '[data-testid=\"errorMessage\"]:has-text(\"invalid\")',\n    )\n\n    const result = (await page.getByTestId('result').textContent()) || ''\n    expect(result).toBe('$undefined')\n\n    const errorMessage =\n      (await page.getByTestId('errorMessage').textContent()) || ''\n    expect(errorMessage).toContain('Invalid input')\n  })\n})\n\ntest('raw response', async ({ page }) => {\n  await page.goto('/raw-response')\n\n  await page.waitForLoadState('networkidle')\n\n  const expectedValue = (await page.getByTestId('expected').textContent()) || ''\n  expect(expectedValue).not.toBe('')\n\n  await page.getByTestId('button').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('response')).toContainText(expectedValue)\n})\n;[{ mode: 'js' }, { mode: 'no-js' }].forEach(({ mode }) => {\n  test(`Server function can redirect when sending formdata: mode = ${mode}`, async ({\n    page,\n  }) => {\n    await page.goto('/formdata-redirect?mode=' + mode)\n\n    await page.waitForLoadState('networkidle')\n    const expected =\n      (await page\n        .getByTestId('expected-submit-post-formdata-server-fn-result')\n        .textContent()) || ''\n    expect(expected).not.toBe('')\n\n    await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()\n\n    await page.waitForLoadState('networkidle')\n\n    await expect(\n      page.getByTestId('formdata-redirect-target-name'),\n    ).toContainText(expected)\n\n    expect(page.url().endsWith(`/formdata-redirect/target/${expected}`))\n  })\n})\n\ntest.describe('middleware', () => {\n  test.describe('client middleware should have access to router context via the router instance', () => {\n    async function runTest(page: Page) {\n      await page.waitForLoadState('networkidle')\n\n      const expected =\n        (await page.getByTestId('expected-server-fn-result').textContent()) ||\n        ''\n      expect(expected).not.toBe('')\n\n      await page.getByTestId('btn-serverFn').click()\n      await page.waitForLoadState('networkidle')\n      await expect(page.getByTestId('serverFn-loader-result')).toContainText(\n        expected,\n      )\n      await expect(page.getByTestId('serverFn-client-result')).toContainText(\n        expected,\n      )\n    }\n\n    test('direct visit', async ({ page }) => {\n      await page.goto('/middleware/client-middleware-router')\n      await runTest(page)\n    })\n\n    test('client navigation', async ({ page }) => {\n      await page.goto('/middleware')\n      await page.getByTestId('client-middleware-router-link').click()\n      await runTest(page)\n    })\n  })\n\n  test('server function in combination with request middleware', async ({\n    page,\n  }) => {\n    await page.goto('/middleware/request-middleware')\n\n    await page.waitForLoadState('networkidle')\n\n    async function checkEqual(prefix: string) {\n      const requestParam = await page\n        .getByTestId(`${prefix}-data-request-param`)\n        .textContent()\n      expect(requestParam).not.toBe('')\n      const requestFunc = await page\n        .getByTestId(`${prefix}-data-request-func`)\n        .textContent()\n      expect(requestParam).toBe(requestFunc)\n    }\n\n    await checkEqual('loader')\n\n    await page.getByTestId('client-call-button').click()\n    await page.waitForLoadState('networkidle')\n\n    await checkEqual('client')\n  })\n})\n\ntest('factory', async ({ page }) => {\n  await page.goto('/factory')\n\n  await expect(page.getByTestId('factory-route-component')).toBeInViewport()\n\n  const buttons = await page\n    .locator('[data-testid^=\"btn-fn-\"]')\n    .elementHandles()\n  for (const button of buttons) {\n    const testId = await button.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('Button is missing data-testid')\n    }\n\n    const suffix = testId.replace('btn-fn-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-fn-result-${suffix}`).textContent()) ||\n      ''\n    expect(expected).not.toBe('')\n\n    await button.click()\n\n    await expect(page.getByTestId(`fn-result-${suffix}`)).toContainText(\n      expected,\n    )\n\n    await expect(page.getByTestId(`fn-comparison-${suffix}`)).toContainText(\n      'equal',\n    )\n  }\n})\n\ntest('primitives', async ({ page }) => {\n  await page.goto('/primitives')\n\n  const testCases = await page\n    .locator('[data-testid^=\"expected-\"]')\n    .elementHandles()\n  expect(testCases.length).not.toBe(0)\n\n  for (const testCase of testCases) {\n    const testId = await testCase.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('testcase is missing data-testid')\n    }\n\n    const suffix = testId.replace('expected-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-${suffix}`).textContent()) || ''\n    expect(expected).not.toBe('')\n\n    await expect(page.getByTestId(`result-${suffix}`)).toContainText(expected)\n  }\n})\n\ntest('redirect in server function on direct navigation', async ({ page }) => {\n  // Test direct navigation to a route with a server function that redirects\n  await page.goto('/redirect-test')\n\n  // Should redirect to target page\n  await expect(page.getByTestId('redirect-target')).toBeVisible()\n  expect(page.url()).toContain('/redirect-test/target')\n})\n\ntest('redirect in server function called in query during SSR', async ({\n  page,\n}) => {\n  // Test direct navigation to a route with a server function that redirects\n  // when called inside a query with ssr: true\n  await page.goto('/redirect-test-ssr')\n\n  // Should redirect to target page\n  await expect(page.getByTestId('redirect-target-ssr')).toBeVisible()\n  expect(page.url()).toContain('/redirect-test-ssr/target')\n})\n\ntest('re-exported server function factory middleware executes correctly', async ({\n  page,\n}) => {\n  // This test specifically verifies that when a server function factory is re-exported\n  // using `export { foo } from './module'` syntax, the middleware still executes.\n  // Previously, this syntax caused middleware to be silently skipped.\n  await page.goto('/factory')\n\n  await expect(page.getByTestId('factory-route-component')).toBeInViewport()\n\n  // Click the button for the re-exported factory function\n  await page.getByTestId('btn-fn-reexportedFactoryFn').click()\n\n  // Wait for the result\n  await expect(page.getByTestId('fn-result-reexportedFactoryFn')).toContainText(\n    'reexport-middleware-executed',\n  )\n\n  // Verify the full context was returned (middleware executed)\n  await expect(\n    page.getByTestId('fn-comparison-reexportedFactoryFn'),\n  ).toContainText('equal')\n})\n\ntest('star re-exported server function factory middleware executes correctly', async ({\n  page,\n}) => {\n  // This test specifically verifies that when a server function factory is re-exported\n  // using `export * from './module'` syntax, the middleware still executes.\n  // Previously, this syntax caused middleware to be silently skipped.\n  await page.goto('/factory')\n\n  await expect(page.getByTestId('factory-route-component')).toBeInViewport()\n\n  // Click the button for the star re-exported factory function\n  await page.getByTestId('btn-fn-starReexportedFactoryFn').click()\n\n  // Wait for the result\n  await expect(\n    page.getByTestId('fn-result-starReexportedFactoryFn'),\n  ).toContainText('star-reexport-middleware-executed')\n\n  // Verify the full context was returned (middleware executed)\n  await expect(\n    page.getByTestId('fn-comparison-starReexportedFactoryFn'),\n  ).toContainText('equal')\n})\n\ntest('nested star re-exported server function factory middleware executes correctly', async ({\n  page,\n}) => {\n  // This test specifically verifies that when a server function factory is re-exported\n  // through a nested chain (A -> B -> C) using `export * from './module'` syntax,\n  // the middleware still executes correctly.\n  await page.goto('/factory')\n\n  await expect(page.getByTestId('factory-route-component')).toBeInViewport()\n\n  // Click the button for the nested re-exported factory function\n  await page.getByTestId('btn-fn-nestedReexportedFactoryFn').click()\n\n  // Wait for the result\n  await expect(\n    page.getByTestId('fn-result-nestedReexportedFactoryFn'),\n  ).toContainText('nested-middleware-executed')\n\n  // Verify the full context was returned (middleware executed)\n  await expect(\n    page.getByTestId('fn-comparison-nestedReexportedFactoryFn'),\n  ).toContainText('equal')\n})\n\ntest('server-only imports in middleware.server() are stripped from client build', async ({\n  page,\n}) => {\n  // This test verifies that server-only imports (like getRequestHeaders from @tanstack/react-start/server)\n  // inside createMiddleware().server() are properly stripped from the client build.\n  // If the .server() part is not removed, the build would fail with node:async_hooks externalization errors.\n  // The fact that this page loads at all proves the server code was stripped correctly.\n  await page.goto('/middleware/server-import-middleware')\n\n  await page.waitForLoadState('networkidle')\n\n  // Click the button to call the server function with middleware\n  await page.getByTestId('test-server-import-middleware-btn').click()\n\n  // Wait for the result - should contain our custom test header value\n  await expect(\n    page.getByTestId('server-import-middleware-result'),\n  ).toContainText('test-header-value')\n})\n\ntest('middleware factories with server-only imports are stripped from client build', async ({\n  page,\n}) => {\n  // This test verifies that middleware factories (functions returning createMiddleware().server())\n  // with server-only imports are properly stripped from the client build.\n  // If the .server() part inside the factory is not removed, the build would fail with\n  // node:async_hooks externalization errors because getRequestHeaders uses node:async_hooks internally.\n  // The fact that this page loads at all proves the server code was stripped correctly.\n  await page.goto('/middleware/middleware-factory')\n\n  await page.waitForLoadState('networkidle')\n\n  // Click the button to call the server function with factory middlewares\n  await page.getByTestId('test-middleware-factory-btn').click()\n\n  // Wait for the result - should contain our custom header value from the factory middleware\n  await expect(page.getByTestId('header-value')).toContainText(\n    'factory-header-value',\n  )\n\n  // Also verify the prefixed headers were matched correctly\n  await expect(page.getByTestId('matched-headers')).toContainText(\n    'x-factory-one',\n  )\n  await expect(page.getByTestId('matched-headers')).toContainText(\n    'x-factory-two',\n  )\n})\n\ntest('redirect via server function with middleware does not cause serialization error (issue #5372)', async ({\n  page,\n}) => {\n  // This test verifies that throwing a redirect from a server function\n  // that has middleware attached does not cause a SerovalUnsupportedTypeError.\n  // Issue #5372: Middleware causes serialization error when throwing redirects via server function\n  await page.goto('/middleware/redirect-with-middleware')\n\n  await page.waitForLoadState('networkidle')\n\n  // Verify we're on the source page\n  await expect(page.getByTestId('middleware-redirect-source')).toBeVisible()\n\n  // Click the button to trigger the redirect via server function with middleware\n  await page.getByTestId('trigger-redirect-btn').click()\n\n  // Should redirect to target page without serialization error\n  await expect(page.getByTestId('middleware-redirect-target')).toBeVisible()\n  expect(page.url()).toContain('/middleware/redirect-with-middleware/target')\n\n  // Verify no error was shown (would indicate serialization failure)\n  await expect(page.getByTestId('error-message')).not.toBeVisible()\n})\n\ntest.describe('unhandled exception in middleware (issue #5266)', () => {\n  // Whitelist the expected 500 error since this test verifies error handling\n  test.use({ whitelistErrors: ['500'] })\n\n  test('does not crash server and shows error component', async ({ page }) => {\n    // This test verifies that when a middleware throws an unhandled exception,\n    // the server does not crash and the error is properly caught and displayed.\n    // Issue #5266: Server crashes when unhandled exception in server function or middleware\n    await page.goto('/middleware/unhandled-exception')\n\n    // The error should be caught and displayed via errorComponent\n    await expect(page.getByTestId('unhandled-exception-error')).toBeVisible()\n\n    // Verify the error message is shown\n    await expect(page.getByTestId('error-message')).toBeVisible()\n\n    // The route component should NOT render since error was thrown\n    await expect(page.getByTestId('route-success')).not.toBeVisible()\n  })\n})\n\ntest('function middleware receives serverFnMeta in options', async ({\n  page,\n}) => {\n  // This test verifies that:\n  // 1. Client middleware receives serverFnMeta with just { id } - NOT name or filename\n  // 2. Server middleware receives serverFnMeta with full { id, name, filename }\n  // 3. Request middleware receives serverFnMeta with full { id, name, filename } for server function calls\n  // 4. Request middleware receives serverFnMeta as undefined for page requests (not server function calls)\n  // 5. Client middleware can send the function metadata to the server via sendContext\n  await page.goto('/middleware/function-metadata')\n\n  await page.waitForLoadState('networkidle')\n\n  // First, verify that for page requests, serverFnMeta is undefined\n  // This is captured by the route-level server middleware and passed via serverContext\n  // The middleware sets '$undefined' string to prove we actually executed and passed data through\n  const pageRequestServerFnMeta = await page\n    .getByTestId('page-request-server-fn-meta')\n    .textContent()\n  expect(pageRequestServerFnMeta).toBe('$undefined')\n\n  // Verify SSR data - server captured metadata should have full properties\n  const loaderFunctionId = await page\n    .getByTestId('loader-function-id')\n    .textContent()\n  const loaderFunctionName = await page\n    .getByTestId('loader-function-name')\n    .textContent()\n  const loaderFilename = await page.getByTestId('loader-filename').textContent()\n  const loaderClientCapturedId = await page\n    .getByTestId('loader-client-captured-id')\n    .textContent()\n  const loaderClientCapturedName = await page\n    .getByTestId('loader-client-captured-name')\n    .textContent()\n  const loaderClientCapturedFilename = await page\n    .getByTestId('loader-client-captured-filename')\n    .textContent()\n  const loaderRequestCapturedId = await page\n    .getByTestId('loader-request-captured-id')\n    .textContent()\n  const loaderRequestCapturedName = await page\n    .getByTestId('loader-request-captured-name')\n    .textContent()\n  const loaderRequestCapturedFilename = await page\n    .getByTestId('loader-request-captured-filename')\n    .textContent()\n\n  // id should be a non-empty string\n  expect(loaderFunctionId).toBeTruthy()\n  expect(loaderFunctionId!.length).toBeGreaterThan(0)\n\n  // name should be the variable name of the server function\n  expect(loaderFunctionName).toBeTruthy()\n  expect(loaderFunctionName).toBe('getMetadataFn')\n\n  // filename should be the exact route file path\n  expect(loaderFilename).toBe('src/routes/middleware/function-metadata.tsx')\n\n  // Client captured ID should match the server function id\n  // (sent via client middleware's sendContext)\n  expect(loaderClientCapturedId).toBe(loaderFunctionId)\n\n  // Client middleware should NOT have access to name or filename\n  // These should be \"undefined\" (the fallback value we display in the UI)\n  expect(loaderClientCapturedName).toBe('undefined')\n  expect(loaderClientCapturedFilename).toBe('undefined')\n\n  // Request middleware should have full metadata (id, name, filename)\n  // since it runs server-side during server function calls\n  expect(loaderRequestCapturedId).toBe(loaderFunctionId)\n  expect(loaderRequestCapturedName).toBe('getMetadataFn')\n  expect(loaderRequestCapturedFilename).toBe(\n    'src/routes/middleware/function-metadata.tsx',\n  )\n\n  // Now test client-side call\n  await page.getByTestId('call-server-fn-btn').click()\n  await page.waitForSelector('[data-testid=\"client-data\"]')\n\n  const clientFunctionId = await page\n    .getByTestId('client-function-id')\n    .textContent()\n  const clientFunctionName = await page\n    .getByTestId('client-function-name')\n    .textContent()\n  const clientFilename = await page.getByTestId('client-filename').textContent()\n  const clientClientCapturedId = await page\n    .getByTestId('client-client-captured-id')\n    .textContent()\n  const clientClientCapturedName = await page\n    .getByTestId('client-client-captured-name')\n    .textContent()\n  const clientClientCapturedFilename = await page\n    .getByTestId('client-client-captured-filename')\n    .textContent()\n  const clientRequestCapturedId = await page\n    .getByTestId('client-request-captured-id')\n    .textContent()\n  const clientRequestCapturedName = await page\n    .getByTestId('client-request-captured-name')\n    .textContent()\n  const clientRequestCapturedFilename = await page\n    .getByTestId('client-request-captured-filename')\n    .textContent()\n\n  // Client call should get the same server metadata\n  expect(clientFunctionId).toBe(loaderFunctionId)\n  expect(clientFunctionName).toBe(loaderFunctionName)\n  expect(clientFilename).toBe(loaderFilename)\n\n  // Client captured ID from client middleware should also match\n  expect(clientClientCapturedId).toBe(loaderFunctionId)\n\n  // Client middleware should NOT have access to name or filename\n  expect(clientClientCapturedName).toBe('undefined')\n  expect(clientClientCapturedFilename).toBe('undefined')\n\n  // Request middleware should have full metadata for client-side calls too\n  expect(clientRequestCapturedId).toBe(loaderFunctionId)\n  expect(clientRequestCapturedName).toBe('getMetadataFn')\n  expect(clientRequestCapturedFilename).toBe(\n    'src/routes/middleware/function-metadata.tsx',\n  )\n})\n\ntest('server function is called with correct method option', async ({\n  page,\n}) => {\n  await page.goto('/function-method', { waitUntil: 'networkidle' })\n\n  await expect(page.getByTestId('method-route-component')).toBeInViewport()\n\n  const buttons = await page\n    .locator('[data-testid^=\"btn-fn-\"]')\n    .elementHandles()\n  for (const button of buttons) {\n    const testId = await button.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('Button is missing data-testid')\n    }\n\n    const suffix = testId.replace('btn-fn-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-fn-result-${suffix}`).textContent()) ||\n      ''\n    expect(expected).not.toBe('')\n\n    await button.click()\n\n    await expect(page.getByTestId(`fn-result-${suffix}`)).toContainText(\n      expected,\n    )\n\n    await expect(page.getByTestId(`fn-comparison-${suffix}`)).toContainText(\n      'equal',\n    )\n  }\n})\n\ntest('server function receives serverFnMeta in options', async ({ page }) => {\n  // This test verifies that:\n  // 1. Server functions receive `serverFnMeta` with full { id, name, filename }\n  // 2. No1 works even when the said server function is called from another server function\n\n  await page.goto('/function-metadata', { waitUntil: 'networkidle' })\n\n  await expect(page.getByTestId('metadata-route-component')).toBeInViewport()\n\n  // Test for no1\n  const loaderNormalGet = await page\n    .getByTestId('loader-normal-get-function-metadata')\n    .textContent()\n  const loaderNormalPost = await page\n    .getByTestId('loader-normal-post-function-metadata')\n    .textContent()\n\n  // stringified metadata should not be empty string\n  expect(loaderNormalGet).toBeTruthy()\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const normalGetMetadata = JSON.parse(loaderNormalGet!)\n  expect(normalGetMetadata).toHaveProperty('id')\n  expect(normalGetMetadata).toHaveProperty('name')\n  expect(normalGetMetadata).toHaveProperty('filename')\n  expect(typeof normalGetMetadata.id).toBe('string')\n  expect(normalGetMetadata.id.length).toBeGreaterThan(0)\n  expect(typeof normalGetMetadata.name).toBe('string')\n  expect(normalGetMetadata.name.length).toBeGreaterThan(0)\n  expect(typeof normalGetMetadata.filename).toBe('string')\n  expect(normalGetMetadata.filename.length).toBeGreaterThan(0)\n\n  // stringified metadata should not be empty string\n  expect(loaderNormalPost).toBeTruthy()\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const normalPostMetadata = JSON.parse(loaderNormalPost!)\n  expect(normalPostMetadata).toHaveProperty('id')\n  expect(normalPostMetadata).toHaveProperty('name')\n  expect(normalPostMetadata).toHaveProperty('filename')\n  expect(typeof normalPostMetadata.id).toBe('string')\n  expect(normalPostMetadata.id.length).toBeGreaterThan(0)\n  expect(typeof normalPostMetadata.name).toBe('string')\n  expect(normalPostMetadata.name.length).toBeGreaterThan(0)\n  expect(typeof normalPostMetadata.filename).toBe('string')\n  expect(normalPostMetadata.filename.length).toBeGreaterThan(0)\n\n  // Test for no2\n  const loaderNestingGet = await page\n    .getByTestId('loader-nesting-get-function-metadata')\n    .textContent()\n  const loaderNestingPost = await page\n    .getByTestId('loader-nesting-post-function-metadata')\n    .textContent()\n\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const nestingGetMetadata = JSON.parse(loaderNestingGet!)\n  expect(nestingGetMetadata).toHaveProperty('meta.id')\n  expect(nestingGetMetadata).toHaveProperty('meta.name')\n  expect(nestingGetMetadata).toHaveProperty('meta.filename')\n  expect(typeof nestingGetMetadata.meta.id).toBe('string')\n  expect(nestingGetMetadata.meta.id.length).toBeGreaterThan(0)\n  expect(typeof nestingGetMetadata.meta.name).toBe('string')\n  expect(nestingGetMetadata.meta.name.length).toBeGreaterThan(0)\n  expect(typeof nestingGetMetadata.meta.filename).toBe('string')\n  expect(nestingGetMetadata.meta.filename.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata).toHaveProperty('inner.get.id')\n  expect(nestingGetMetadata).toHaveProperty('inner.get.name')\n  expect(nestingGetMetadata).toHaveProperty('inner.get.filename')\n  expect(nestingGetMetadata.inner.get.id.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.get.name.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.get.filename.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata).toHaveProperty('inner.post.id')\n  expect(nestingGetMetadata).toHaveProperty('inner.post.name')\n  expect(nestingGetMetadata).toHaveProperty('inner.post.filename')\n  expect(nestingGetMetadata.inner.post.id.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.post.name.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.post.filename.length).toBeGreaterThan(0)\n\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const nestingPostMetadata = JSON.parse(loaderNestingPost!)\n  expect(nestingPostMetadata).toHaveProperty('meta.id')\n  expect(nestingPostMetadata).toHaveProperty('meta.name')\n  expect(nestingPostMetadata).toHaveProperty('meta.filename')\n  expect(typeof nestingPostMetadata.meta.id).toBe('string')\n  expect(nestingPostMetadata.meta.id.length).toBeGreaterThan(0)\n  expect(typeof nestingPostMetadata.meta.name).toBe('string')\n  expect(nestingPostMetadata.meta.name.length).toBeGreaterThan(0)\n  expect(typeof nestingPostMetadata.meta.filename).toBe('string')\n  expect(nestingPostMetadata.meta.filename.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata).toHaveProperty('inner.get.id')\n  expect(nestingPostMetadata).toHaveProperty('inner.get.name')\n  expect(nestingPostMetadata).toHaveProperty('inner.get.filename')\n  expect(nestingPostMetadata.inner.get.id.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.get.name.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.get.filename.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata).toHaveProperty('inner.post.id')\n  expect(nestingPostMetadata).toHaveProperty('inner.post.name')\n  expect(nestingPostMetadata).toHaveProperty('inner.post.filename')\n  expect(nestingPostMetadata.inner.post.id.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.post.name.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.post.filename.length).toBeGreaterThan(0)\n})\n\ntest('middleware can catch errors thrown by server function handlers', async ({\n  page,\n}) => {\n  await page.goto('/middleware/catch-handler-error')\n\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('catch-handler-error-title')).toBeVisible()\n\n  await page.getByTestId('trigger-error-btn').click()\n\n  await expect(page.getByTestId('transformed-error')).toBeVisible()\n\n  await expect(page.getByTestId('transformed-error')).toContainText(\n    'Middleware caught and transformed',\n  )\n\n  await expect(page.getByTestId('transformed-error')).toContainText(\n    'This error should be caught by middleware',\n  )\n})\n\ntest('server function with custom fetch implementation passed directly', async ({\n  page,\n}) => {\n  await page.goto('/custom-fetch')\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-direct-custom-fetch-btn').click()\n  await page.waitForSelector(\n    '[data-testid=\"direct-custom-fetch-result\"]:not(:has-text(\"null\"))',\n  )\n\n  const result = await page\n    .getByTestId('direct-custom-fetch-result')\n    .textContent()\n  expect(result).toContain('x-custom-fetch-direct')\n})\n\ntest('server function with custom fetch implementation via middleware', async ({\n  page,\n}) => {\n  await page.goto('/custom-fetch')\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-middleware-custom-fetch-btn').click()\n  await page.waitForSelector(\n    '[data-testid=\"middleware-custom-fetch-result\"]:not(:has-text(\"null\"))',\n  )\n\n  const result = await page\n    .getByTestId('middleware-custom-fetch-result')\n    .textContent()\n  expect(result).toContain('x-custom-fetch-middleware')\n})\n\ntest('server function with chained middleware - later middleware overrides earlier', async ({\n  page,\n}) => {\n  await page.goto('/custom-fetch')\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-chained-middleware-btn').click()\n  await page.waitForSelector(\n    '[data-testid=\"chained-middleware-result\"]:not(:has-text(\"null\"))',\n  )\n\n  const result = await page\n    .getByTestId('chained-middleware-result')\n    .textContent()\n  // Second middleware should override first, so only x-middleware-second should be present\n  expect(result).toContain('x-middleware-second')\n  expect(result).not.toContain('x-middleware-first')\n})\n\ntest('server function with direct fetch overrides middleware fetch', async ({\n  page,\n}) => {\n  await page.goto('/custom-fetch')\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-direct-override-btn').click()\n  await page.waitForSelector(\n    '[data-testid=\"direct-override-result\"]:not(:has-text(\"null\"))',\n  )\n\n  const result = await page.getByTestId('direct-override-result').textContent()\n  // Direct fetch should override middleware, so x-direct-override should be present\n  // and x-custom-fetch-middleware should NOT be present\n  expect(result).toContain('x-direct-override')\n  expect(result).not.toContain('x-custom-fetch-middleware')\n})\n\ntest('server function without custom fetch uses global serverFnFetch from createStart', async ({\n  page,\n}) => {\n  await page.goto('/custom-fetch')\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-no-custom-fetch-btn').click()\n  await page.waitForLoadState('networkidle')\n  await page.waitForSelector(\n    '[data-testid=\"no-custom-fetch-result\"]:not(:has-text(\"null\"))',\n  )\n\n  const result = await page.getByTestId('no-custom-fetch-result').textContent()\n  // Global serverFnFetch header should be present\n  expect(result).toContain('x-global-fetch')\n  // No other custom headers should be present\n  expect(result).not.toContain('x-custom-fetch-direct')\n  expect(result).not.toContain('x-custom-fetch-middleware')\n  expect(result).not.toContain('x-middleware-first')\n  expect(result).not.toContain('x-middleware-second')\n  expect(result).not.toContain('x-direct-override')\n})\n\ntest('server function uses global serverFnFetch from createStart', async ({\n  page,\n}) => {\n  await page.goto('/custom-fetch')\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-global-fetch-btn').click()\n  await page.waitForSelector(\n    '[data-testid=\"global-fetch-result\"]:not(:has-text(\"null\"))',\n  )\n\n  const result = await page.getByTestId('global-fetch-result').textContent()\n  // Global serverFnFetch header should be present\n  expect(result).toContain('x-global-fetch')\n})\n\ntest('middleware fetch overrides global serverFnFetch from createStart', async ({\n  page,\n}) => {\n  await page.goto('/custom-fetch')\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-middleware-overrides-global-btn').click()\n  await page.waitForSelector(\n    '[data-testid=\"middleware-overrides-global-result\"]:not(:has-text(\"null\"))',\n  )\n\n  const result = await page\n    .getByTestId('middleware-overrides-global-result')\n    .textContent()\n  // Middleware fetch should override global, so x-custom-fetch-middleware should be present\n  expect(result).toContain('x-custom-fetch-middleware')\n  // Global fetch header should NOT be present (overridden by middleware)\n  expect(result).not.toContain('x-global-fetch')\n})\n\ntest('direct fetch overrides global serverFnFetch from createStart', async ({\n  page,\n}) => {\n  await page.goto('/custom-fetch')\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-direct-overrides-global-btn').click()\n  await page.waitForSelector(\n    '[data-testid=\"direct-overrides-global-result\"]:not(:has-text(\"null\"))',\n  )\n\n  const result = await page\n    .getByTestId('direct-overrides-global-result')\n    .textContent()\n  // Direct fetch should override global, so x-direct-override-global should be present\n  expect(result).toContain('x-direct-override-global')\n  // Global fetch header should NOT be present (overridden by direct fetch)\n  expect(result).not.toContain('x-global-fetch')\n})\n\ntest.describe('server function returns 405 when method is not allowed', () => {\n  // Whitelist the expected 405 error since this test verifies method mismatch handling\n  test.use({ whitelistErrors: ['405'] })\n\n  async function runMethodNotAllowedTest(\n    page: Page,\n    methodParam: string,\n    allowedMethod: string,\n  ) {\n    await page.goto(`/method-not-allowed/${methodParam}`)\n    await page.waitForLoadState('networkidle')\n\n    for (const testMethod of ['GET', 'POST', 'PUT', 'OPTIONS']) {\n      const lower = testMethod.toLowerCase()\n      await page.getByTestId(`${lower}-button`).click()\n      await page.waitForLoadState('networkidle')\n\n      if (testMethod === allowedMethod) {\n        await expect(page.getByTestId(`${lower}-fetch-result`)).toContainText(\n          '[200,\"Hello, World!\"]',\n        )\n      } else {\n        await expect(page.getByTestId(`${lower}-fetch-result`)).toContainText(\n          `[405,\"expected ${allowedMethod} method. Got ${testMethod}\"]`,\n        )\n      }\n    }\n  }\n\n  test('serverFn defined with GET method', async ({ page }) => {\n    await runMethodNotAllowedTest(page, 'get', 'GET')\n  })\n\n  test('serverFn without explicit method', async ({ page }) => {\n    await runMethodNotAllowedTest(page, 'undefined', 'GET')\n  })\n\n  test('serverFn defined with POST method', async ({ page }) => {\n    await runMethodNotAllowedTest(page, 'post', 'POST')\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/server-functions/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst FUNCTION_IDS: Record<string, Record<string, string>> = {\n  'src/routes/submit-post-formdata.tsx': {\n    greetUser_createServerFn_handler: 'submit-post-formdata-greetUser',\n  },\n  'src/routes/formdata-redirect/index.tsx': {\n    greetUser_createServerFn_handler: 'formdata-redirect-greetUser',\n  },\n}\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      serverFns: {\n        generateFunctionId: (opts) => {\n          return FUNCTION_IDS[opts.filename]?.[opts.functionName]\n        },\n      },\n    }),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/.gitignore",
    "content": "node_modules\ndist\n.nitro\n.output\nport*.txt\ntest-results\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-server-functions-global-middleware\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nexport const PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SimpleRouteImport } from './routes/simple'\nimport { Route as PathnameMiddlewareRouteImport } from './routes/pathname-middleware'\nimport { Route as MultipleServerFunctionsRouteImport } from './routes/multiple-server-functions'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst SimpleRoute = SimpleRouteImport.update({\n  id: '/simple',\n  path: '/simple',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathnameMiddlewareRoute = PathnameMiddlewareRouteImport.update({\n  id: '/pathname-middleware',\n  path: '/pathname-middleware',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MultipleServerFunctionsRoute = MultipleServerFunctionsRouteImport.update({\n  id: '/multiple-server-functions',\n  path: '/multiple-server-functions',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/multiple-server-functions': typeof MultipleServerFunctionsRoute\n  '/pathname-middleware': typeof PathnameMiddlewareRoute\n  '/simple': typeof SimpleRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/multiple-server-functions': typeof MultipleServerFunctionsRoute\n  '/pathname-middleware': typeof PathnameMiddlewareRoute\n  '/simple': typeof SimpleRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/multiple-server-functions': typeof MultipleServerFunctionsRoute\n  '/pathname-middleware': typeof PathnameMiddlewareRoute\n  '/simple': typeof SimpleRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/multiple-server-functions'\n    | '/pathname-middleware'\n    | '/simple'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/multiple-server-functions' | '/pathname-middleware' | '/simple'\n  id:\n    | '__root__'\n    | '/'\n    | '/multiple-server-functions'\n    | '/pathname-middleware'\n    | '/simple'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  MultipleServerFunctionsRoute: typeof MultipleServerFunctionsRoute\n  PathnameMiddlewareRoute: typeof PathnameMiddlewareRoute\n  SimpleRoute: typeof SimpleRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/simple': {\n      id: '/simple'\n      path: '/simple'\n      fullPath: '/simple'\n      preLoaderRoute: typeof SimpleRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/pathname-middleware': {\n      id: '/pathname-middleware'\n      path: '/pathname-middleware'\n      fullPath: '/pathname-middleware'\n      preLoaderRoute: typeof PathnameMiddlewareRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/multiple-server-functions': {\n      id: '/multiple-server-functions'\n      path: '/multiple-server-functions'\n      fullPath: '/multiple-server-functions'\n      preLoaderRoute: typeof MultipleServerFunctionsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  MultipleServerFunctionsRoute: MultipleServerFunctionsRoute,\n  PathnameMiddlewareRoute: PathnameMiddlewareRoute,\n  SimpleRoute: SimpleRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { startInstance } from './start.ts'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n    config: Awaited<ReturnType<typeof startInstance.getOptions>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg\">\n        Global Middleware Deduplication E2E Tests\n      </h1>\n      <p className=\"text-gray-600 mb-4\">\n        Tests for issue #5239: global request middleware is executed multiple\n        times for single request\n      </p>\n      <ul className=\"list-disc p-4\">\n        <li>\n          <Link to=\"/simple\" data-testid=\"link-simple\">\n            Simple test - single server function with global middleware\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/multiple-server-functions\" data-testid=\"link-multiple\">\n            Complex test - multiple server functions in loader with shared\n            global middleware\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/pathname-middleware\" data-testid=\"link-pathname\">\n            Pathname test - verify pathname is passed to global request\n            middleware\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/routes/multiple-server-functions.tsx",
    "content": "import { createFileRoute, Link } from '@tanstack/react-router'\nimport { createServerFn, createMiddleware } from '@tanstack/react-start'\nimport {\n  globalFunctionMiddleware,\n  loggingMiddleware,\n  getMiddlewareExecutionCounts,\n  trackMiddlewareExecution,\n} from '~/start'\n\n// Local middleware that should also be tracked\nconst localMiddleware = createMiddleware({ type: 'function' }).server(\n  async ({ next }) => {\n    trackMiddlewareExecution('localMiddleware')\n    return next({\n      context: {\n        localMiddlewareExecuted: true,\n      },\n    })\n  },\n)\n\n// Server function 1 - uses global middleware (implicit from start.ts)\n// Plus explicitly adds globalFunctionMiddleware again (should be deduped)\nconst serverFn1 = createServerFn()\n  .middleware([globalFunctionMiddleware])\n  .handler(async ({ context }) => {\n    const counts = getMiddlewareExecutionCounts()\n    return {\n      fn: 'serverFn1',\n      globalMiddlewareExecuted: (context as any).globalMiddlewareExecuted,\n      // Return counts for this specific request\n      counts,\n    }\n  })\n\n// Server function 2 - uses global middleware plus local middleware\nconst serverFn2 = createServerFn()\n  .middleware([globalFunctionMiddleware, localMiddleware])\n  .handler(async ({ context }) => {\n    const counts = getMiddlewareExecutionCounts()\n    return {\n      fn: 'serverFn2',\n      globalMiddlewareExecuted: (context as any).globalMiddlewareExecuted,\n      localMiddlewareExecuted: (context as any).localMiddlewareExecuted,\n      counts,\n    }\n  })\n\n// Server function 3 - uses loggingMiddleware (which is in requestMiddleware)\n// plus local middleware\nconst serverFn3 = createServerFn()\n  .middleware([loggingMiddleware, localMiddleware])\n  .handler(async ({ context }) => {\n    const counts = getMiddlewareExecutionCounts()\n    return {\n      fn: 'serverFn3',\n      loggingMiddlewareExecuted: (context as any).loggingMiddlewareExecuted,\n      localMiddlewareExecuted: (context as any).localMiddlewareExecuted,\n      counts,\n    }\n  })\n\n// Final server function to get execution counts after all others have run\nconst getExecutionCountsFn = createServerFn().handler(async () => {\n  const counts = getMiddlewareExecutionCounts()\n  return { counts }\n})\n\nexport const Route = createFileRoute('/multiple-server-functions')({\n  loader: async () => {\n    // Call multiple server functions in the same request\n    // Each one has global middleware, but it should only execute once per function call\n    // The BUG is that global middleware executes multiple times per function call\n    const [result1, result2, result3] = await Promise.all([\n      serverFn1(),\n      serverFn2(),\n      serverFn3(),\n    ])\n\n    // Get the final execution counts\n    const executionData = await getExecutionCountsFn()\n\n    return {\n      results: [result1, result2, result3],\n      executionCounts: executionData.counts,\n    }\n  },\n  component: MultipleServerFunctionsComponent,\n})\n\nfunction MultipleServerFunctionsComponent() {\n  const data = Route.useLoaderData()\n\n  // For SSR: all functions run in same request, counts accumulate\n  // For client-side: each function is separate request, counts are per-request\n  //\n  // What we're testing is deduplication WITHIN each server function call:\n  // - loggingMiddleware is in requestMiddleware AND serverFn3 - should run once per request\n  // - globalFunctionMiddleware is in functionMiddleware AND explicitly added - should run once per fn\n  //\n  // For SSR mode (accumulating counts):\n  // - loggingMiddleware: 1 (runs in request middleware, deduped in serverFn3)\n  // - globalFunctionMiddleware: 4 (once per server function call)\n  // - globalFunctionMiddleware2: 4 (once per server function call)\n  // - localMiddleware: 2 (serverFn2 and serverFn3)\n  //\n  // For client-side mode: we verify each function's individual counts show deduplication worked\n\n  const loggingCount = data.executionCounts['loggingMiddleware'] || 0\n  const globalCount = data.executionCounts['globalFunctionMiddleware'] || 0\n  const global2Count = data.executionCounts['globalFunctionMiddleware2'] || 0\n  const localCount = data.executionCounts['localMiddleware'] || 0\n\n  // Detect if we're in SSR mode by checking if counts are > 1\n  // (In client-side, last request is getExecutionCountsFn which only has global middlewares)\n  const isSSRMode = globalCount > 1\n\n  // Expected counts for SSR mode\n  const expectedLoggingCountSSR = 1\n  const expectedGlobalCountSSR = 4\n  const expectedGlobal2CountSSR = 4\n  const expectedLocalCountSSR = 2\n\n  // Expected counts for client-side mode (last request only has global middlewares running once)\n  const expectedLoggingCountClient = 1\n  const expectedGlobalCountClient = 1\n  const expectedGlobal2CountClient = 1\n  const expectedLocalCountClient = 0 // not in getExecutionCountsFn\n\n  const expectedLoggingCount = isSSRMode\n    ? expectedLoggingCountSSR\n    : expectedLoggingCountClient\n  const expectedGlobalCount = isSSRMode\n    ? expectedGlobalCountSSR\n    : expectedGlobalCountClient\n  const expectedGlobal2Count = isSSRMode\n    ? expectedGlobal2CountSSR\n    : expectedGlobal2CountClient\n  const expectedLocalCount = isSSRMode\n    ? expectedLocalCountSSR\n    : expectedLocalCountClient\n\n  // For client-side, also verify that individual function results show correct deduplication\n  // Each function should have its middlewares run exactly once PER REQUEST\n  // Note: In SSR mode, all functions share the same counts (accumulated), so we skip these checks\n  const fn1Counts = (data.results[0] as any).counts || {}\n  const fn2Counts = (data.results[1] as any).counts || {}\n  const fn3Counts = (data.results[2] as any).counts || {}\n\n  // Per-function deduplication check - only valid for client-side mode\n  // In SSR, all functions run in same request, so counts accumulate\n  // In client-side, each function is a separate request, so counts are per-request\n  let perFunctionDedupeOk = true\n  if (!isSSRMode) {\n    // serverFn1: globalFunctionMiddleware=1, globalFunctionMiddleware2=1, loggingMiddleware=1\n    // serverFn2: adds localMiddleware=1\n    // serverFn3: loggingMiddleware=1 (deduped with request middleware), localMiddleware=1\n    const fn1GlobalOk = fn1Counts['globalFunctionMiddleware'] === 1\n    const fn1Global2Ok = fn1Counts['globalFunctionMiddleware2'] === 1\n    const fn2LocalOk = fn2Counts['localMiddleware'] === 1\n    const fn3LoggingOk = fn3Counts['loggingMiddleware'] === 1 // deduped with request middleware\n\n    perFunctionDedupeOk =\n      fn1GlobalOk && fn1Global2Ok && fn2LocalOk && fn3LoggingOk\n  }\n\n  const isLoggingCorrect = loggingCount === expectedLoggingCount\n  const isGlobalDeduped = globalCount === expectedGlobalCount\n  const isGlobal2Deduped = global2Count === expectedGlobal2Count\n  const isLocalCorrect = localCount === expectedLocalCount\n\n  const allPassed = isSSRMode\n    ? isLoggingCorrect &&\n      isGlobalDeduped &&\n      isGlobal2Deduped &&\n      isLocalCorrect &&\n      perFunctionDedupeOk\n    : perFunctionDedupeOk // For client-side, just verify per-function deduplication\n\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg mb-4\">\n        Multiple Server Functions with Global Middleware (Issue #5239)\n      </h1>\n\n      <div className=\"mb-4\">\n        <Link to=\"/\" className=\"text-blue-600 underline\">\n          ← Back to Home\n        </Link>\n      </div>\n\n      <div className=\"mb-2 text-sm text-gray-500\">\n        Mode: {isSSRMode ? 'SSR (direct navigation)' : 'Client-side navigation'}\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Overall Test Result:</h2>\n        <div\n          data-testid=\"overall-status\"\n          className={allPassed ? 'text-green-600' : 'text-red-600'}\n        >\n          {allPassed\n            ? 'PASS: All middlewares executed correct number of times'\n            : 'FAIL: Middleware execution counts are incorrect'}\n        </div>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">\n          Middleware Execution Counts (Final Request):\n        </h2>\n        <table className=\"border-collapse border border-gray-300\">\n          <thead>\n            <tr>\n              <th className=\"border border-gray-300 p-2\">Middleware</th>\n              <th className=\"border border-gray-300 p-2\">Expected</th>\n              <th className=\"border border-gray-300 p-2\">Actual</th>\n              <th className=\"border border-gray-300 p-2\">Status</th>\n            </tr>\n          </thead>\n          <tbody>\n            <tr>\n              <td className=\"border border-gray-300 p-2\">loggingMiddleware</td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"expected-logging-count\"\n              >\n                {expectedLoggingCount}\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"actual-logging-count\"\n              >\n                {loggingCount}\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"logging-status\"\n              >\n                {isLoggingCorrect ? '✓' : '✗'}\n              </td>\n            </tr>\n            <tr>\n              <td className=\"border border-gray-300 p-2\">\n                globalFunctionMiddleware\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"expected-global-count\"\n              >\n                {expectedGlobalCount}\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"actual-global-count\"\n              >\n                {globalCount}\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"global-status\"\n              >\n                {isGlobalDeduped ? '✓' : '✗'}\n              </td>\n            </tr>\n            <tr>\n              <td className=\"border border-gray-300 p-2\">\n                globalFunctionMiddleware2\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"expected-global-2-count\"\n              >\n                {expectedGlobal2Count}\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"actual-global-2-count\"\n              >\n                {global2Count}\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"global-2-status\"\n              >\n                {isGlobal2Deduped ? '✓' : '✗'}\n              </td>\n            </tr>\n            <tr>\n              <td className=\"border border-gray-300 p-2\">localMiddleware</td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"expected-local-count\"\n              >\n                {expectedLocalCount}\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"actual-local-count\"\n              >\n                {localCount}\n              </td>\n              <td\n                className=\"border border-gray-300 p-2\"\n                data-testid=\"local-status\"\n              >\n                {isLocalCorrect ? '✓' : '✗'}\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Per-Function Deduplication Check:</h2>\n        <div className=\"text-sm\">\n          {isSSRMode ? (\n            <div>\n              (In SSR mode, all functions share the same request context, so\n              per-function checks are skipped)\n            </div>\n          ) : (\n            <>\n              <div>\n                serverFn1 globalFunctionMiddleware=1:{' '}\n                {fn1Counts['globalFunctionMiddleware'] === 1\n                  ? '✓'\n                  : '✗ got ' + fn1Counts['globalFunctionMiddleware']}\n              </div>\n              <div>\n                serverFn1 globalFunctionMiddleware2=1:{' '}\n                {fn1Counts['globalFunctionMiddleware2'] === 1\n                  ? '✓'\n                  : '✗ got ' + fn1Counts['globalFunctionMiddleware2']}\n              </div>\n              <div>\n                serverFn2 localMiddleware=1:{' '}\n                {fn2Counts['localMiddleware'] === 1\n                  ? '✓'\n                  : '✗ got ' + fn2Counts['localMiddleware']}\n              </div>\n              <div>\n                serverFn3 loggingMiddleware=1 (deduped):{' '}\n                {fn3Counts['loggingMiddleware'] === 1\n                  ? '✓'\n                  : '✗ got ' + fn3Counts['loggingMiddleware']}\n              </div>\n            </>\n          )}\n        </div>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Server Function Results:</h2>\n        <pre\n          data-testid=\"server-fn-results\"\n          className=\"bg-gray-100 p-2 rounded text-sm\"\n        >\n          {JSON.stringify(data.results, null, 2)}\n        </pre>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Raw Execution Counts (Final Request):</h2>\n        <pre\n          data-testid=\"raw-execution-counts\"\n          className=\"bg-gray-100 p-2 rounded text-sm\"\n        >\n          {JSON.stringify(data.executionCounts, null, 2)}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/routes/pathname-middleware.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\n// Regression test for issue #6647:\n// Global request middleware in createStartHandler was not receiving `pathname`.\n// The `pathnameMiddleware` (registered as requestMiddleware in start.ts)\n// captures `pathname` into context as `requestMiddlewarePathname`.\n// This route verifies that value is defined and matches the actual route path.\n\nconst getPathnameFromMiddleware = createServerFn().handler(\n  async ({ context }) => {\n    return {\n      requestMiddlewarePathname: context.requestMiddlewarePathname,\n    }\n  },\n)\n\nexport const Route = createFileRoute('/pathname-middleware')({\n  loader: async () => {\n    return await getPathnameFromMiddleware()\n  },\n  component: PathnameMiddlewareComponent,\n})\n\nfunction PathnameMiddlewareComponent() {\n  const data = Route.useLoaderData()\n  const pathname = data.requestMiddlewarePathname\n\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg mb-4\">\n        Pathname in Global Request Middleware (Issue #6647)\n      </h1>\n      <div>\n        <span data-testid=\"request-middleware-pathname\">\n          {String(pathname)}\n        </span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/routes/simple.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { loggingMiddleware, getMiddlewareExecutionCounts } from '~/start'\n\n// This test reproduces issue #5239:\n// - loggingMiddleware is registered as global REQUEST middleware in start.ts\n// - The same loggingMiddleware is also attached to this server function\n// - The bug is that it executes multiple times instead of being deduped\n\n// Simple server function that uses loggingMiddleware\n// loggingMiddleware is already in requestMiddleware in start.ts\n// If we also attach it here, it should be deduped and run only once per context\nconst simpleServerFn = createServerFn()\n  .middleware([loggingMiddleware]) // Same middleware as in requestMiddleware - should be deduped\n  .handler(async ({ context }) => {\n    const counts = getMiddlewareExecutionCounts()\n\n    return {\n      success: true,\n      loggingMiddlewareExecuted: (context as any).loggingMiddlewareExecuted,\n      globalMiddlewareExecuted: (context as any).globalMiddlewareExecuted,\n      globalMiddleware2Executed: (context as any).globalMiddleware2Executed,\n      middlewareExecutionCounts: counts,\n    }\n  })\n\nexport const Route = createFileRoute('/simple')({\n  loader: async () => {\n    const result = await simpleServerFn()\n    return result\n  },\n  component: SimpleComponent,\n})\n\nfunction SimpleComponent() {\n  const data = Route.useLoaderData()\n\n  // Check loggingMiddleware count\n  // loggingMiddleware is in BOTH requestMiddleware AND server function middleware\n  // With proper deduplication, it should only run once total for this request\n  const loggingCount = data.middlewareExecutionCounts['loggingMiddleware'] || 0\n  const globalCount =\n    data.middlewareExecutionCounts['globalFunctionMiddleware'] || 0\n  const global2Count =\n    data.middlewareExecutionCounts['globalFunctionMiddleware2'] || 0\n\n  // Expected: loggingMiddleware runs once (deduped across request and function middleware)\n  // globalFunctionMiddleware and globalFunctionMiddleware2 each run once\n  const expectedLoggingCount = 1 // Should be deduped\n  const expectedGlobalCount = 1\n  const expectedGlobal2Count = 1\n\n  const isDeduped =\n    loggingCount === expectedLoggingCount &&\n    globalCount === expectedGlobalCount &&\n    global2Count === expectedGlobal2Count\n\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg mb-4\">\n        Simple Global Middleware Test (Issue #5239)\n      </h1>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Test Result:</h2>\n        <div\n          data-testid=\"deduplication-status\"\n          className={isDeduped ? 'text-green-600' : 'text-red-600'}\n        >\n          {isDeduped\n            ? 'PASS: Middleware was deduped correctly'\n            : 'FAIL: Middleware executed multiple times'}\n        </div>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Middleware Execution Counts:</h2>\n        <pre data-testid=\"execution-counts\" className=\"bg-gray-100 p-2 rounded\">\n          {JSON.stringify(data.middlewareExecutionCounts, null, 2)}\n        </pre>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Context Values:</h2>\n        <div>\n          <span>loggingMiddlewareExecuted: </span>\n          <span data-testid=\"logging-middleware-executed\">\n            {String(data.loggingMiddlewareExecuted)}\n          </span>\n        </div>\n        <div>\n          <span>globalMiddlewareExecuted: </span>\n          <span data-testid=\"global-middleware-executed\">\n            {String(data.globalMiddlewareExecuted)}\n          </span>\n        </div>\n        <div>\n          <span>globalMiddleware2Executed: </span>\n          <span data-testid=\"global-middleware-2-executed\">\n            {String(data.globalMiddleware2Executed)}\n          </span>\n        </div>\n      </div>\n\n      <div className=\"text-sm text-gray-500\">\n        <p data-testid=\"logging-count\">\n          Logging Middleware Count: {loggingCount}\n        </p>\n        <p data-testid=\"global-count\">Global Middleware Count: {globalCount}</p>\n        <p data-testid=\"global-2-count\">\n          Global Middleware 2 Count: {global2Count}\n        </p>\n      </div>\n\n      {/* Hidden test values for e2e */}\n      <div className=\"hidden\">\n        <span data-testid=\"expected-logging-count\">{expectedLoggingCount}</span>\n        <span data-testid=\"expected-global-count\">{expectedGlobalCount}</span>\n        <span data-testid=\"expected-global-2-count\">\n          {expectedGlobal2Count}\n        </span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/start.ts",
    "content": "import {\n  createStart,\n  createMiddleware,\n  createServerOnlyFn,\n} from '@tanstack/react-start'\nimport { getRequest } from '@tanstack/react-start/server'\n\n// Use a WeakMap keyed by Request object for request-scoped tracking\n// This is cleaner than global state and automatically garbage collects\nconst requestMiddlewareCounts = new WeakMap<Request, Record<string, number>>()\n\n// Helper to track middleware execution - attaches to the Request object\n// This is server-only since it uses getRequest()\nexport const trackMiddlewareExecution = createServerOnlyFn(\n  (middlewareName: string) => {\n    const request = getRequest()\n    let counts = requestMiddlewareCounts.get(request)\n    if (!counts) {\n      counts = {}\n      requestMiddlewareCounts.set(request, counts)\n    }\n    counts[middlewareName] = (counts[middlewareName] || 0) + 1\n    console.log(\n      `[MIDDLEWARE] ${middlewareName} executed. Count: ${counts[middlewareName]}`,\n    )\n    return counts[middlewareName]\n  },\n)\n\n// Helper to get execution counts for the current request\n// Wrapped in createServerOnlyFn since it uses getRequest()\nexport const getMiddlewareExecutionCounts = createServerOnlyFn(\n  (): Record<string, number> => {\n    const request = getRequest()\n    return requestMiddlewareCounts.get(request) || {}\n  },\n)\n\n// This is the middleware from issue #5239 - it's registered as BOTH:\n// 1. Global request middleware (in startInstance)\n// 2. Server function middleware (attached to individual server functions)\n// The bug is that it executes multiple times instead of being deduped\nexport const loggingMiddleware = createMiddleware().server(async ({ next }) => {\n  trackMiddlewareExecution('loggingMiddleware')\n  return next({\n    context: {\n      loggingMiddlewareExecuted: true,\n    },\n  })\n})\n\n// Regression test for #6647: verify that pathname is correctly passed to\n// global request middleware by createStartHandler\nexport const pathnameMiddleware = createMiddleware().server(\n  async ({ next, pathname }) => {\n    return next({\n      context: {\n        requestMiddlewarePathname: pathname,\n      },\n    })\n  },\n)\n\n// Global function middleware that should be deduped across server functions\nexport const globalFunctionMiddleware = createMiddleware({\n  type: 'function',\n}).server(async ({ next }) => {\n  trackMiddlewareExecution('globalFunctionMiddleware')\n  return next({\n    context: {\n      globalMiddlewareExecuted: true,\n    },\n  })\n})\n\n// A second global middleware to test multiple global middlewares\nexport const globalFunctionMiddleware2 = createMiddleware({\n  type: 'function',\n}).server(async ({ next }) => {\n  trackMiddlewareExecution('globalFunctionMiddleware2')\n  return next({\n    context: {\n      globalMiddleware2Executed: true,\n    },\n  })\n})\n\n// Create the start instance with global middleware\nexport const startInstance = createStart(() => ({\n  // Global function middleware that applies to all server functions\n  functionMiddleware: [globalFunctionMiddleware, globalFunctionMiddleware2],\n  // Request middleware - includes loggingMiddleware (issue #5239 scenario)\n  // AND the same loggingMiddleware is also attached to server functions\n  requestMiddleware: [loggingMiddleware, pathnameMiddleware],\n}))\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/tests/global-middleware.spec.ts",
    "content": "import { expect, Page } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntype NavigationMethod = 'direct' | 'client-side'\n\nasync function navigateToRoute(\n  page: Page,\n  route: string,\n  linkTestId: string,\n  method: NavigationMethod,\n) {\n  if (method === 'direct') {\n    await page.goto(route)\n  } else {\n    // Client-side navigation: go to home first, then click link\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n    await page.getByTestId(linkTestId).click()\n  }\n  await page.waitForLoadState('networkidle')\n}\n\nasync function testSimpleMiddlewareDeduplication(\n  page: Page,\n  method: NavigationMethod,\n) {\n  await navigateToRoute(page, '/simple', 'link-simple', method)\n\n  // Check that both global middlewares were executed\n  await expect(page.getByTestId('global-middleware-executed')).toContainText(\n    'true',\n  )\n  await expect(page.getByTestId('global-middleware-2-executed')).toContainText(\n    'true',\n  )\n\n  // Check that deduplication worked - each global middleware should execute exactly once\n  const expectedGlobalCount = await page\n    .getByTestId('expected-global-count')\n    .textContent()\n  const actualGlobalCount = await page.getByTestId('global-count').textContent()\n\n  // Extract the count number from the text\n  const actualCount = actualGlobalCount?.match(/\\d+/)?.[0] || '0'\n\n  expect(actualCount).toBe(expectedGlobalCount)\n\n  // Check the deduplication status\n  await expect(page.getByTestId('deduplication-status')).toContainText('PASS')\n}\n\nasync function testMultipleServerFunctionsDeduplication(\n  page: Page,\n  method: NavigationMethod,\n) {\n  await navigateToRoute(\n    page,\n    '/multiple-server-functions',\n    'link-multiple',\n    method,\n  )\n\n  // For SSR (direct): all server functions run in same request, counts accumulate\n  // For client-side: each server function is a separate HTTP request\n  // The key thing we're testing is that middleware is deduped WITHIN each server fn call\n\n  // Check overall status - the component handles both cases\n  await expect(page.getByTestId('overall-status')).toContainText('PASS')\n\n  // For direct navigation, verify the accumulated counts\n  if (method === 'direct') {\n    const expectedGlobalCount = await page\n      .getByTestId('expected-global-count')\n      .textContent()\n    const actualGlobalCount = await page\n      .getByTestId('actual-global-count')\n      .textContent()\n    expect(actualGlobalCount).toBe(expectedGlobalCount)\n\n    const expectedGlobal2Count = await page\n      .getByTestId('expected-global-2-count')\n      .textContent()\n    const actualGlobal2Count = await page\n      .getByTestId('actual-global-2-count')\n      .textContent()\n    expect(actualGlobal2Count).toBe(expectedGlobal2Count)\n\n    const expectedLocalCount = await page\n      .getByTestId('expected-local-count')\n      .textContent()\n    const actualLocalCount = await page\n      .getByTestId('actual-local-count')\n      .textContent()\n    expect(actualLocalCount).toBe(expectedLocalCount)\n\n    // Verify the status indicators\n    await expect(page.getByTestId('global-status')).toContainText('✓')\n    await expect(page.getByTestId('global-2-status')).toContainText('✓')\n    await expect(page.getByTestId('local-status')).toContainText('✓')\n  }\n}\n\ntest.describe('Global middleware deduplication (issue #5239)', () => {\n  test.describe('direct navigation (SSR)', () => {\n    test('simple test - global middleware attached to server function should be deduped', async ({\n      page,\n    }) => {\n      await testSimpleMiddlewareDeduplication(page, 'direct')\n    })\n\n    test('multiple server functions - global middleware should be deduped per function call', async ({\n      page,\n    }) => {\n      await testMultipleServerFunctionsDeduplication(page, 'direct')\n    })\n  })\n\n  test.describe('client-side navigation', () => {\n    test('simple test - global middleware attached to server function should be deduped', async ({\n      page,\n    }) => {\n      await testSimpleMiddlewareDeduplication(page, 'client-side')\n    })\n\n    test('multiple server functions - global middleware should be deduped per function call', async ({\n      page,\n    }) => {\n      await testMultipleServerFunctionsDeduplication(page, 'client-side')\n    })\n  })\n})\n\ntest.describe('Request middleware pathname (issue #6647)', () => {\n  test('pathname should be the page path on SSR', async ({ page }) => {\n    await page.goto('/pathname-middleware')\n    await page.waitForLoadState('networkidle')\n    await expect(page.getByTestId('request-middleware-pathname')).toHaveText(\n      '/pathname-middleware',\n    )\n  })\n\n  test('pathname should be the server function path on client-side navigation', async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n    await page.getByTestId('link-pathname').click()\n    await page.waitForLoadState('networkidle')\n    const pathnameText = await page\n      .getByTestId('request-middleware-pathname')\n      .textContent()\n    expect(pathnameText).toBeTruthy()\n    expect(pathnameText!.startsWith('/_serverFn/')).toBe(true)\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-functions-global-middleware/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/server-routes/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/server-routes/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-server-routes\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"js-cookie\": \"^3.0.5\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nexport const PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as MergeMiddlewareContextRouteImport } from './routes/merge-middleware-context'\nimport { Route as MethodsRouteRouteImport } from './routes/methods/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as MethodsIndexRouteImport } from './routes/methods/index'\nimport { Route as MethodsOnlyAnyRouteImport } from './routes/methods/only-any'\nimport { Route as ApiOnlyAnyRouteImport } from './routes/api/only-any'\nimport { Route as ApiMiddlewareContextRouteImport } from './routes/api/middleware-context'\nimport { Route as ApiParamsFooRouteRouteImport } from './routes/api/params/$foo/route'\nimport { Route as ApiParamsFooBarRouteImport } from './routes/api/params/$foo/$bar'\n\nconst MergeMiddlewareContextRoute = MergeMiddlewareContextRouteImport.update({\n  id: '/merge-middleware-context',\n  path: '/merge-middleware-context',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MethodsRouteRoute = MethodsRouteRouteImport.update({\n  id: '/methods',\n  path: '/methods',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MethodsIndexRoute = MethodsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => MethodsRouteRoute,\n} as any)\nconst MethodsOnlyAnyRoute = MethodsOnlyAnyRouteImport.update({\n  id: '/only-any',\n  path: '/only-any',\n  getParentRoute: () => MethodsRouteRoute,\n} as any)\nconst ApiOnlyAnyRoute = ApiOnlyAnyRouteImport.update({\n  id: '/api/only-any',\n  path: '/api/only-any',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiMiddlewareContextRoute = ApiMiddlewareContextRouteImport.update({\n  id: '/api/middleware-context',\n  path: '/api/middleware-context',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiParamsFooRouteRoute = ApiParamsFooRouteRouteImport.update({\n  id: '/api/params/$foo',\n  path: '/api/params/$foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiParamsFooBarRoute = ApiParamsFooBarRouteImport.update({\n  id: '/$bar',\n  path: '/$bar',\n  getParentRoute: () => ApiParamsFooRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/methods': typeof MethodsRouteRouteWithChildren\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods/': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/methods': typeof MethodsRouteRouteWithChildren\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods/': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/methods'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods/'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  id:\n    | '__root__'\n    | '/'\n    | '/methods'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods/'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  MethodsRouteRoute: typeof MethodsRouteRouteWithChildren\n  MergeMiddlewareContextRoute: typeof MergeMiddlewareContextRoute\n  ApiMiddlewareContextRoute: typeof ApiMiddlewareContextRoute\n  ApiOnlyAnyRoute: typeof ApiOnlyAnyRoute\n  ApiParamsFooRouteRoute: typeof ApiParamsFooRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/merge-middleware-context': {\n      id: '/merge-middleware-context'\n      path: '/merge-middleware-context'\n      fullPath: '/merge-middleware-context'\n      preLoaderRoute: typeof MergeMiddlewareContextRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/methods': {\n      id: '/methods'\n      path: '/methods'\n      fullPath: '/methods'\n      preLoaderRoute: typeof MethodsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/methods/': {\n      id: '/methods/'\n      path: '/'\n      fullPath: '/methods/'\n      preLoaderRoute: typeof MethodsIndexRouteImport\n      parentRoute: typeof MethodsRouteRoute\n    }\n    '/methods/only-any': {\n      id: '/methods/only-any'\n      path: '/only-any'\n      fullPath: '/methods/only-any'\n      preLoaderRoute: typeof MethodsOnlyAnyRouteImport\n      parentRoute: typeof MethodsRouteRoute\n    }\n    '/api/only-any': {\n      id: '/api/only-any'\n      path: '/api/only-any'\n      fullPath: '/api/only-any'\n      preLoaderRoute: typeof ApiOnlyAnyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/middleware-context': {\n      id: '/api/middleware-context'\n      path: '/api/middleware-context'\n      fullPath: '/api/middleware-context'\n      preLoaderRoute: typeof ApiMiddlewareContextRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/params/$foo': {\n      id: '/api/params/$foo'\n      path: '/api/params/$foo'\n      fullPath: '/api/params/$foo'\n      preLoaderRoute: typeof ApiParamsFooRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/params/$foo/$bar': {\n      id: '/api/params/$foo/$bar'\n      path: '/$bar'\n      fullPath: '/api/params/$foo/$bar'\n      preLoaderRoute: typeof ApiParamsFooBarRouteImport\n      parentRoute: typeof ApiParamsFooRouteRoute\n    }\n  }\n}\n\ninterface MethodsRouteRouteChildren {\n  MethodsOnlyAnyRoute: typeof MethodsOnlyAnyRoute\n  MethodsIndexRoute: typeof MethodsIndexRoute\n}\n\nconst MethodsRouteRouteChildren: MethodsRouteRouteChildren = {\n  MethodsOnlyAnyRoute: MethodsOnlyAnyRoute,\n  MethodsIndexRoute: MethodsIndexRoute,\n}\n\nconst MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(\n  MethodsRouteRouteChildren,\n)\n\ninterface ApiParamsFooRouteRouteChildren {\n  ApiParamsFooBarRoute: typeof ApiParamsFooBarRoute\n}\n\nconst ApiParamsFooRouteRouteChildren: ApiParamsFooRouteRouteChildren = {\n  ApiParamsFooBarRoute: ApiParamsFooBarRoute,\n}\n\nconst ApiParamsFooRouteRouteWithChildren =\n  ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  MethodsRouteRoute: MethodsRouteRouteWithChildren,\n  MergeMiddlewareContextRoute: MergeMiddlewareContextRoute,\n  ApiMiddlewareContextRoute: ApiMiddlewareContextRoute,\n  ApiOnlyAnyRoute: ApiOnlyAnyRoute,\n  ApiParamsFooRouteRoute: ApiParamsFooRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport { QueryClient } from '@tanstack/react-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n  setupRouterSsrQueryIntegration({ router, queryClient })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nconst RouterDevtools =\n  process.env.NODE_ENV === 'production'\n    ? () => null // Render nothing in production\n    : React.lazy(() =>\n        // Lazy load in development\n        import('@tanstack/react-router-devtools').then((res) => ({\n          default: res.TanStackRouterDevtools,\n        })),\n      )\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <RouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/api/middleware-context.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createMiddleware } from '@tanstack/react-start'\n\nconst testParentMiddleware = createMiddleware().server(async ({ next }) => {\n  const result = await next({ context: { testParent: true } })\n  return result\n})\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next }) => {\n    const result = await next({ context: { test: true } })\n    return result\n  })\n\nexport const Route = createFileRoute('/api/middleware-context')({\n  server: {\n    middleware: [testMiddleware],\n    handlers: {\n      GET: ({ request, context }) => {\n        return Response.json({\n          url: request.url,\n          context: context,\n          expectedContext: { testParent: true, test: true },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/api/only-any.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/only-any')({\n  server: {\n    handlers: {\n      ANY: ({ request }) => {\n        return Response.json(\n          {\n            handler: 'ANY',\n            method: request.method,\n          },\n          { headers: { 'X-HANDLER': 'ANY', 'X-METHOD': request.method } },\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/api/params/$foo/$bar.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/params/$foo/$bar')({\n  server: {\n    handlers: {\n      GET: ({ params }) => {\n        return new Response('hello, ' + params.foo + ' and ' + params.bar)\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/api/params/$foo/route.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/params/$foo')({\n  server: {\n    handlers: {\n      GET: ({ params }) => {\n        return new Response('hello, ' + params.foo)\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg\">Server Routes E2E tests</h1>\n      <ul className=\"list-disc p-4\">\n        <li>\n          <Route.Link to=\"./merge-middleware-context\">\n            server route middleware context is merged correctly\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link to=\"./methods\">server route methods</Route.Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/merge-middleware-context.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/merge-middleware-context')({\n  component: MergeMiddlewareContext,\n})\n\nfunction MergeMiddlewareContext() {\n  const [apiResponse, setApiResponse] = React.useState<any>(null)\n\n  const fetchMiddlewareContext = async () => {\n    try {\n      const response = await fetch('/api/middleware-context')\n      const data = await response.json()\n      setApiResponse(data)\n    } catch (error) {\n      console.error('Error fetching middleware context:', error)\n      setApiResponse({ error: 'Failed to fetch' })\n    }\n  }\n\n  return (\n    <div className=\"p-2 m-2 grid gap-2\">\n      <h3>Merge Server Route Middleware Context Test</h3>\n      <div className=\"flex flex-col gap-2\">\n        <button\n          type=\"button\"\n          onClick={fetchMiddlewareContext}\n          data-testid=\"test-middleware-context-btn\"\n          className=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Middleware Context\n        </button>\n\n        {apiResponse && (\n          <div className=\"mt-4\">\n            <h4>API Response:</h4>\n            <pre\n              data-testid=\"api-response\"\n              className=\"bg-gray-100 p-2 rounded-sm text-black\"\n            >\n              {JSON.stringify(apiResponse, null, 2)}\n            </pre>\n\n            <div className=\"mt-4 grid gap-2\">\n              <h4>Context Verification:</h4>\n              <div\n                data-testid=\"context-result\"\n                className=\"bg-gray-100 p-2 rounded-sm text-black\"\n              >\n                {JSON.stringify(apiResponse.context, null, 2)}\n              </div>\n\n              <div\n                data-testid=\"has-test-parent\"\n                className=\"p-2 border rounded-sm\"\n              >\n                Has testParent:{' '}\n                {apiResponse.context?.testParent ? 'true' : 'false'}\n              </div>\n\n              <div data-testid=\"has-test\" className=\"p-2 border rounded-sm\">\n                Has test: {apiResponse.context?.test ? 'true' : 'false'}\n              </div>\n            </div>\n          </div>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/methods/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/methods/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-8\">\n      <ul className=\"list-disc p-4\">\n        <li>\n          <Route.Link to=\"./only-any\">\n            Server Route only has ANY handler\n          </Route.Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/methods/only-any.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { useQuery } from '@tanstack/react-query'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/methods/only-any')({\n  ssr: false,\n  component: RouteComponent,\n})\n\nconst HttpMethods = [\n  'GET',\n  'POST',\n  'PUT',\n  'DELETE',\n  'PATCH',\n  'OPTIONS',\n  'HEAD',\n] as const\ntype HttpMethods = (typeof HttpMethods)[number]\nfunction Test({ method }: { method: HttpMethods }) {\n  const queryFn = React.useCallback(async () => {\n    const response = await fetch(`/api/only-any`, {\n      method,\n    })\n    try {\n      const json = (await response.json()) as Promise<{\n        method: HttpMethods\n        handler: HttpMethods & 'ANY'\n      }>\n      return json\n    } catch (e) {}\n    // handle HEAD and OPTIONS that have no body\n    const result = {\n      handler: response.headers.get('x-handler') as HttpMethods & 'ANY',\n      method: response.headers.get('x-method') as HttpMethods,\n    }\n    return result\n  }, [method])\n\n  const query = useQuery({ queryKey: [method], queryFn })\n  return (\n    <div>\n      <h3>method={method}</h3>\n      <h4> expected </h4>\n      <div data-testid={`expected-${method}`}>{method}</div>\n      <h4> result</h4>\n      {query.data ? (\n        <div data-testid={`result-${method}`}>{query.data.method}</div>\n      ) : null}\n    </div>\n  )\n}\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2 m-2 grid gap-2\" data-testid=\"route-component\">\n      <h3>Server Route has only ANY handler</h3>\n      {HttpMethods.map((method) => (\n        <Test key={method} method={method} />\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/routes/methods/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/methods')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg\">Server Routes Methods E2E tests</h1>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/tests/server-routes.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('merge-middleware-context', async ({ page }) => {\n  await page.goto('/merge-middleware-context')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-middleware-context-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('has-test-parent')).toContainText('true')\n  await expect(page.getByTestId('has-test')).toContainText('true')\n\n  const contextResult = await page.getByTestId('context-result').textContent()\n  expect(contextResult).toContain('testParent')\n  expect(contextResult).toContain('test')\n})\n\ntest.describe('methods', () => {\n  test('only ANY', async ({ page }) => {\n    await page.goto('/methods/only-any')\n\n    // wait for page to be loaded by waiting for the route component to be rendered\n    await expect(page.getByTestId('route-component')).toBeInViewport()\n\n    const testCases = await page\n      .locator('[data-testid^=\"expected-\"]')\n      .elementHandles()\n    expect(testCases.length).not.toBe(0)\n    for (const testCase of testCases) {\n      const testId = await testCase.getAttribute('data-testid')\n\n      if (!testId) {\n        throw new Error('testcase is missing data-testid')\n      }\n\n      const suffix = testId.replace('expected-', '')\n\n      const expected =\n        (await page.getByTestId(`expected-${suffix}`).textContent()) || ''\n      expect(expected).not.toBe('')\n\n      await expect(page.getByTestId(`result-${suffix}`)).toContainText(expected)\n    }\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/.gitignore",
    "content": "node_modules\ndist\n.tanstack\nport-*.txt\ntest-results\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-server-routes-global-middleware\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nexport const PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ServerRouteWithMiddlewareRouteImport } from './routes/server-route-with-middleware'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst ServerRouteWithMiddlewareRoute =\n  ServerRouteWithMiddlewareRouteImport.update({\n    id: '/server-route-with-middleware',\n    path: '/server-route-with-middleware',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/server-route-with-middleware': typeof ServerRouteWithMiddlewareRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/server-route-with-middleware': typeof ServerRouteWithMiddlewareRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/server-route-with-middleware': typeof ServerRouteWithMiddlewareRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/server-route-with-middleware'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/server-route-with-middleware'\n  id: '__root__' | '/' | '/server-route-with-middleware'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ServerRouteWithMiddlewareRoute: typeof ServerRouteWithMiddlewareRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/server-route-with-middleware': {\n      id: '/server-route-with-middleware'\n      path: '/server-route-with-middleware'\n      fullPath: '/server-route-with-middleware'\n      preLoaderRoute: typeof ServerRouteWithMiddlewareRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ServerRouteWithMiddlewareRoute: ServerRouteWithMiddlewareRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { startInstance } from './start.ts'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n    config: Awaited<ReturnType<typeof startInstance.getOptions>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n          <Link\n            to=\"/server-route-with-middleware\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            data-testid=\"nav-link-server-route\"\n          >\n            Server Route Test\n          </Link>\n        </div>\n        <hr />\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg\">\n        Server Routes Global Middleware Deduplication E2E Tests\n      </h1>\n      <p className=\"text-gray-600 mb-4\">\n        Tests for issue #5239: global request middleware is executed multiple\n        times for single request (server routes variant)\n      </p>\n      <ul className=\"list-disc p-4\">\n        <li>\n          <Link\n            to=\"/server-route-with-middleware\"\n            data-testid=\"link-server-route\"\n          >\n            Server route with middleware - tests deduplication when same\n            middleware is in global requestMiddleware and server route\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/src/routes/server-route-with-middleware.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getMiddlewareExecutionCounts, loggingMiddleware } from '~/start'\n\nexport const Route = createFileRoute('/server-route-with-middleware')({\n  // Server route configuration\n  // loggingMiddleware is ALSO in global requestMiddleware (see start.ts)\n  // This tests that it only executes once, not twice\n  server: {\n    middleware: [loggingMiddleware],\n    handlers: {\n      GET: async ({ next, context }) => {\n        // Get the middleware execution counts at the time of the GET handler\n        const counts = await getMiddlewareExecutionCounts()\n\n        // Add counts to context - this will be passed to the router as serverContext\n        return next({\n          context: {\n            middlewareCountsAtHandler: counts,\n          },\n        })\n      },\n    },\n  },\n  // beforeLoad runs on server during SSR, can access serverContext\n  beforeLoad: async ({ context, serverContext }) => {\n    // On server, serverContext contains data from GET handler + middleware context\n    // On client (navigation), serverContext won't be present\n\n    // Get the final middleware execution counts\n    const finalCounts = await getMiddlewareExecutionCounts()\n\n    return {\n      serverContext,\n      middlewareCounts: finalCounts,\n    }\n  },\n  component: ServerRouteWithMiddleware,\n})\n\nfunction ServerRouteWithMiddleware() {\n  const { serverContext, middlewareCounts } = Route.useRouteContext()\n\n  return (\n    <div className=\"p-8\">\n      <h1 className=\"font-bold text-lg mb-4\">\n        Server Route with Global Middleware Test\n      </h1>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Middleware Execution Counts:</h2>\n        <pre\n          data-testid=\"middleware-counts\"\n          className=\"bg-gray-100 p-2 rounded text-black\"\n        >\n          {JSON.stringify(middlewareCounts, null, 2)}\n        </pre>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">loggingMiddleware Count:</h2>\n        <span data-testid=\"logging-middleware-count\">\n          {(middlewareCounts as any)?.loggingMiddleware ?? 'N/A'}\n        </span>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">authMiddleware Count:</h2>\n        <span data-testid=\"auth-middleware-count\">\n          {(middlewareCounts as any)?.authMiddleware ?? 'N/A'}\n        </span>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Server Context:</h2>\n        <pre\n          data-testid=\"server-context\"\n          className=\"bg-gray-100 p-2 rounded text-black\"\n        >\n          {JSON.stringify(serverContext, null, 2)}\n        </pre>\n      </div>\n\n      <div className=\"mb-4\">\n        <h2 className=\"font-semibold\">Deduplication Status:</h2>\n        <span\n          data-testid=\"dedup-status\"\n          className={\n            (middlewareCounts as any)?.loggingMiddleware === 1\n              ? 'text-green-600 font-bold'\n              : 'text-red-600 font-bold'\n          }\n        >\n          {(middlewareCounts as any)?.loggingMiddleware === 1\n            ? 'SUCCESS: loggingMiddleware executed exactly once'\n            : `FAILURE: loggingMiddleware executed ${(middlewareCounts as any)?.loggingMiddleware ?? 0} times (expected 1)`}\n        </span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/src/start.ts",
    "content": "import {\n  createIsomorphicFn,\n  createMiddleware,\n  createStart,\n} from '@tanstack/react-start'\nimport { getRequest } from '@tanstack/react-start/server'\n\n// Use a WeakMap keyed by Request object for request-scoped tracking\nconst requestMiddlewareCounts = new WeakMap<Request, Record<string, number>>()\n\n// Helper to track middleware execution - only runs on server\nexport const trackMiddlewareExecution = createIsomorphicFn().server(\n  (middlewareName: string) => {\n    const request = getRequest()\n    let counts = requestMiddlewareCounts.get(request)\n    if (!counts) {\n      counts = {}\n      requestMiddlewareCounts.set(request, counts)\n    }\n    counts[middlewareName] = (counts[middlewareName] || 0) + 1\n    console.log(\n      `[MIDDLEWARE] ${middlewareName} executed. Count: ${counts[middlewareName]}`,\n    )\n    return counts[middlewareName]\n  },\n)\n\n// Helper to get execution counts for the current request\n// Uses createIsomorphicFn so it can be called in beforeLoad without crashing on client\n// Returns undefined on client (no .client() impl), returns counts on server\nexport const getMiddlewareExecutionCounts = createIsomorphicFn().server(\n  (): Record<string, number> => {\n    const request = getRequest()\n    return requestMiddlewareCounts.get(request) || {}\n  },\n)\n\n// This middleware is registered as BOTH:\n// 1. Global request middleware (in startInstance)\n// 2. Server route middleware (attached to individual routes)\n// The bug would be that it executes multiple times instead of being deduped\nexport const loggingMiddleware = createMiddleware().server(async ({ next }) => {\n  trackMiddlewareExecution('loggingMiddleware')\n  return next({\n    context: {\n      loggingMiddlewareExecuted: true,\n      loggingMiddlewareTimestamp: Date.now(),\n    },\n  })\n})\n\n// Another global middleware for testing\nexport const authMiddleware = createMiddleware().server(async ({ next }) => {\n  trackMiddlewareExecution('authMiddleware')\n  return next({\n    context: {\n      authMiddlewareExecuted: true,\n      userId: 'test-user-123',\n    },\n  })\n})\n\n// Create the start instance with global request middleware\nexport const startInstance = createStart(() => ({\n  // Global request middleware - applies to all requests\n  requestMiddleware: [loggingMiddleware, authMiddleware],\n}))\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/tests/server-routes-global-middleware.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\n/**\n * E2E tests for server routes global middleware deduplication\n * Issue #5239: global request middleware is executed multiple times for single request\n *\n * These tests verify that when the same middleware is registered in BOTH:\n * 1. Global requestMiddleware (in start.ts)\n * 2. Server route middleware (in the route's server.middleware array)\n *\n * ...the middleware only executes ONCE per request, not twice.\n *\n * NOTE: Server route handlers (GET, POST, etc.) only execute on direct navigation (SSR).\n * Client-side navigation does NOT trigger the server route handler.\n */\n\ntest.describe('Server Routes Global Middleware Deduplication', () => {\n  test.describe('Direct Navigation (SSR)', () => {\n    test('loggingMiddleware should execute exactly once when in both global and route middleware', async ({\n      page,\n    }) => {\n      // Navigate directly to the server route\n      // This triggers SSR with the full server route handler execution\n      await page.goto('/server-route-with-middleware')\n\n      // Wait for the page to fully load\n      await expect(\n        page.locator('[data-testid=\"middleware-counts\"]'),\n      ).toBeVisible()\n\n      // Get the middleware execution count for loggingMiddleware\n      const loggingCount = await page\n        .locator('[data-testid=\"logging-middleware-count\"]')\n        .textContent()\n\n      // loggingMiddleware should execute exactly once\n      // It's in global requestMiddleware AND in the route's server.middleware\n      // With proper deduplication, it should only run once\n      expect(loggingCount).toBe('1')\n\n      // Verify the deduplication status message\n      const dedupStatus = await page\n        .locator('[data-testid=\"dedup-status\"]')\n        .textContent()\n      expect(dedupStatus).toContain('SUCCESS')\n    })\n\n    test('authMiddleware should execute exactly once (global only)', async ({\n      page,\n    }) => {\n      // Navigate directly to the server route\n      await page.goto('/server-route-with-middleware')\n\n      // Wait for the page to fully load\n      await expect(\n        page.locator('[data-testid=\"middleware-counts\"]'),\n      ).toBeVisible()\n\n      // Get the middleware execution count for authMiddleware\n      const authCount = await page\n        .locator('[data-testid=\"auth-middleware-count\"]')\n        .textContent()\n\n      // authMiddleware is only in global requestMiddleware, not in route middleware\n      // It should execute exactly once\n      expect(authCount).toBe('1')\n    })\n\n    test('server context should contain middleware data', async ({ page }) => {\n      // Navigate directly to the server route\n      await page.goto('/server-route-with-middleware')\n\n      // Wait for the page to fully load\n      await expect(page.locator('[data-testid=\"server-context\"]')).toBeVisible()\n\n      // Get the server context\n      const serverContextText = await page\n        .locator('[data-testid=\"server-context\"]')\n        .textContent()\n\n      const serverContext = JSON.parse(serverContextText || '{}')\n\n      // Verify middleware context data is present\n      expect(serverContext.loggingMiddlewareExecuted).toBe(true)\n      expect(serverContext.authMiddlewareExecuted).toBe(true)\n      expect(serverContext.userId).toBe('test-user-123')\n    })\n\n    test('middleware counts object should have correct structure', async ({\n      page,\n    }) => {\n      // Navigate directly to the server route\n      await page.goto('/server-route-with-middleware')\n\n      // Wait for the page to fully load\n      await expect(\n        page.locator('[data-testid=\"middleware-counts\"]'),\n      ).toBeVisible()\n\n      // Get the full middleware counts object\n      const countsText = await page\n        .locator('[data-testid=\"middleware-counts\"]')\n        .textContent()\n\n      const counts = JSON.parse(countsText || '{}')\n\n      // Both middlewares should have executed exactly once\n      expect(counts).toEqual({\n        loggingMiddleware: 1,\n        authMiddleware: 1,\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/server-routes-global-middleware/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/spa-mode/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/spa-mode/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/react-start/spa-mode/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/spa-mode/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-spa-mode\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"npx serve dist/client\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/spa-mode/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/spa-mode/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts' | '/posts/$postId'\n  id: '__root__' | '/' | '/posts' | '/posts/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/spa-mode/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/spa-mode/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  ClientOnly,\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'SPA Mode E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      root: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return { root: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  shellComponent: RootDocument,\n  component: () => {\n    return (\n      <div data-testid=\"root-container\">\n        <h2 data-testid=\"root-heading\">root</h2>\n        <div>\n          loader: <b data-testid=\"root-loader\">{Route.useLoaderData().root}</b>\n        </div>\n        <div>\n          context:{' '}\n          <b data-testid=\"root-context\">{Route.useRouteContext().root}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>__root Loading...</div>,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  const { isLoading, status } = useRouterState({\n    select: (state) => ({ isLoading: state.isLoading, status: state.status }),\n    structuralSharing: true,\n  })\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <h1>SPA Mode E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">{isLoading ? 'true' : 'false'}</b>\n          </div>\n          <div>\n            router status: <b data-testid=\"router-status\">{status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {children}\n        <Scripts />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/spa-mode/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div data-testid=\"home-container\">\n      <h1 data-testid=\"home-heading\">Home</h1>\n      <div>\n        <Link\n          to=\"/posts/$postId\"\n          params={{ postId: '1' }}\n          data-testid=\"link-posts-1\"\n        >\n          Go to /posts/1\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/spa-mode/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      postId: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return { postId: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    return (\n      <div data-testid=\"postId-container\">\n        <h4 data-testid=\"postId-heading\">postId</h4>\n        <div>\n          loader:{' '}\n          <b data-testid=\"postId-loader\">{Route.useLoaderData().postId}</b>\n        </div>\n        <div>\n          context:{' '}\n          <b data-testid=\"postId-context\">{Route.useRouteContext().postId}</b>\n        </div>\n      </div>\n    )\n  },\n  pendingComponent: () => <div>$postId Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/spa-mode/src/routes/posts.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      posts: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    return { posts: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    return (\n      <div data-testid=\"posts-container\">\n        <h3 data-testid=\"posts-heading\">posts</h3>\n        <div>\n          loader:{' '}\n          <b data-testid=\"posts-loader\">{Route.useLoaderData().posts}</b>\n        </div>\n        <div>\n          context:{' '}\n          <b data-testid=\"posts-context\">{Route.useRouteContext().posts}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>posts Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/spa-mode/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/spa-mode/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport type { Page } from '@playwright/test'\n\nasync function runTest(\n  page: Page,\n  expectedData: {\n    loader: {\n      root: 'server' | 'client'\n      posts: 'server' | 'client'\n      postId: 'server' | 'client'\n    }\n    context: {\n      root: 'server' | 'client'\n      posts: 'server' | 'client'\n      postId: 'server' | 'client'\n    }\n  },\n) {\n  // wait for page to be loaded by waiting for the leaf route to be rendered\n  await expect(page.getByTestId('postId-heading')).toContainText('postId')\n\n  // check expectations\n  await Promise.all(\n    Object.entries(expectedData.loader).map(async ([route, expectedLoader]) => {\n      await expect(page.getByTestId(`${route}-loader`)).toContainText(\n        expectedLoader,\n      )\n    }),\n  )\n  await Promise.all(\n    Object.entries(expectedData.context).map(\n      async ([route, expectedContext]) => {\n        await expect(page.getByTestId(`${route}-context`)).toContainText(\n          expectedContext,\n        )\n      },\n    ),\n  )\n  await expect(page.getByTestId('router-isLoading')).toContainText('false')\n  await expect(page.getByTestId('router-status')).toContainText('idle')\n}\ntest.describe('SPA mode', () => {\n  test(`directly visiting prerendered /posts/1`, async ({\n    page,\n  }: {\n    page: Page\n  }) => {\n    await page.goto('/posts/1')\n    await runTest(page, {\n      loader: {\n        root: 'server',\n        posts: 'server',\n        postId: 'server',\n      },\n      context: {\n        root: 'server',\n        posts: 'server',\n        postId: 'server',\n      },\n    })\n  })\n\n  test(`client-side navigation to /posts/1`, async ({\n    page,\n  }: {\n    page: Page\n  }) => {\n    await page.goto('/')\n    const testId = 'link-posts-1'\n    await page.getByTestId(testId).click()\n    await runTest(page, {\n      loader: {\n        root: 'server',\n        posts: 'client',\n        postId: 'client',\n      },\n      context: {\n        root: 'client',\n        posts: 'client',\n        postId: 'client',\n      },\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/spa-mode/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/spa-mode/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      spa: {\n        enabled: true,\n        prerender: {\n          outputPath: 'index.html',\n        },\n      },\n      pages: [\n        {\n          path: '/posts/1',\n          prerender: { enabled: true, outputPath: '/posts/1/index.html' },\n        },\n      ],\n    }),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-split-base-and-basepath\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev --port $PORT\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"node prod-server.js\",\n    \"test:e2e:dev\": \"MODE=dev playwright test --project=chromium\",\n    \"test:e2e:prod\": \"playwright test --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:dev && pnpm run test:e2e:prod\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"express\": \"^5.1.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst mode = process.env.MODE ?? 'prod'\nconst isDev = mode === 'dev'\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: isDev ? `pnpm dev:e2e` : `pnpm build && PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/prod-server.js",
    "content": "import express from 'express'\nimport { toNodeHandler } from 'srvx/node'\n\nconst PORT = Number.parseInt(process.env.PORT || '3000')\n\nconst app = express()\n\nconst { default: handler } = await import('./dist/server/server.js')\nconst nodeHandler = toNodeHandler(handler.fetch)\n\n// Serve built client assets at /_ui/ prefix\napp.use('/_ui', express.static('dist/client'))\n\n// All other requests go through the SSR handler\napp.use(async (req, res, next) => {\n  try {\n    await nodeHandler(req, res)\n  } catch (error) {\n    next(error)\n  }\n})\n\napp.listen(PORT, () => {\n  console.log(`Server is running on http://localhost:${PORT}`)\n})\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nimport '../styles/app.css'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <nav>\n          <Link\n            to=\"/\"\n            activeProps={{ className: 'active' }}\n            activeOptions={{ exact: true }}\n            data-testid=\"link-home\"\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/about\"\n            activeProps={{ className: 'active' }}\n            data-testid=\"link-about\"\n          >\n            About\n          </Link>\n        </nav>\n        <hr />\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: About,\n})\n\nfunction About() {\n  return (\n    <div>\n      <h1 data-testid=\"about-heading\">About Page</h1>\n      <p data-testid=\"about-content\">This is the about page.</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div>\n      <h1 data-testid=\"home-heading\">Welcome Home</h1>\n      <p data-testid=\"home-content\">\n        This page tests that split base and basepath work correctly.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/src/styles/app.css",
    "content": "body {\n  font-family: sans-serif;\n  margin: 0;\n  padding: 16px;\n}\n\n.app-styled {\n  color: #333;\n  background-color: #f0f0f0;\n}\n\nnav {\n  display: flex;\n  gap: 8px;\n  font-size: 1.1rem;\n}\n\nnav a.active {\n  font-weight: bold;\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\nconst whitelistErrors = [\n  'Failed to load resource: net::ERR_NAME_NOT_RESOLVED',\n  'Failed to load resource: the server responded with a status of 504',\n]\n\ntest.describe('split base and basepath', () => {\n  test.use({ whitelistErrors })\n  test('page renders at root /', async ({ page }) => {\n    await page.goto('/')\n    await expect(page.getByTestId('home-heading')).toHaveText('Welcome Home')\n  })\n\n  test('SSR HTML contains asset URLs prefixed with /_ui/', async ({\n    request,\n  }) => {\n    const response = await request.get('/')\n    expect(response.ok()).toBeTruthy()\n    const html = await response.text()\n\n    // Script tags should reference /_ui/ prefix\n    const scriptSrcMatches = html.match(/src=\"([^\"]+)\"/g) || []\n    const moduleScripts = scriptSrcMatches.filter(\n      (s) => s.includes('.js') || s.includes('.ts') || s.includes('@'),\n    )\n\n    for (const script of moduleScripts) {\n      // Extract the URL from src=\"...\"\n      const url = script.replace(/^src=\"/, '').replace(/\"$/, '')\n      // Asset URLs should start with /_ui/\n      expect(url, `Script URL should be prefixed with /_ui/: ${url}`).toMatch(\n        /^\\/_ui\\//,\n      )\n    }\n\n    // All stylesheet links (including dev styles) should reference /_ui/ prefix.\n    // Dev styles default basepath is the Vite base, so they get /_ui/ too.\n    const stylesheetMatches = html.match(/href=\"([^\"]+\\.css[^\"]*)\"/g) || []\n    for (const match of stylesheetMatches) {\n      const href = match.replace(/^href=\"/, '').replace(/\"$/, '')\n      expect(\n        href,\n        `Stylesheet URL should be prefixed with /_ui/: ${href}`,\n      ).toMatch(/^\\/_ui\\//)\n    }\n  })\n\n  test('CSS loads and applies correctly', async ({ page }) => {\n    await page.goto('/')\n    // The body should have font-family: sans-serif from our CSS\n    const fontFamily = await page.evaluate(() => {\n      return window.getComputedStyle(document.body).fontFamily\n    })\n    expect(fontFamily).toContain('sans-serif')\n  })\n\n  test('client-side navigation works', async ({ page }) => {\n    await page.goto('/')\n    await expect(page.getByTestId('home-heading')).toBeVisible()\n\n    // Click the About link\n    await page.getByTestId('link-about').click()\n\n    // Should navigate to /about\n    await expect(page.getByTestId('about-heading')).toHaveText('About Page')\n    await expect(page.getByTestId('about-content')).toBeVisible()\n\n    // URL should be at /about, not /_ui/about\n    expect(page.url()).toContain('/about')\n    expect(page.url()).not.toContain('/_ui/about')\n  })\n\n  test('navigation links do not have /_ui/ prefix', async ({ page }) => {\n    await page.goto('/')\n\n    // Check that the Home link href is at / (not /_ui/)\n    const homeHref = await page.getByTestId('link-home').getAttribute('href')\n    expect(homeHref).toBe('/')\n\n    // Check that the About link href is at /about (not /_ui/about)\n    const aboutHref = await page.getByTestId('link-about').getAttribute('href')\n    expect(aboutHref).toBe('/about')\n  })\n\n  test('navigating directly to /about works via SSR', async ({ page }) => {\n    await page.goto('/about')\n    await expect(page.getByTestId('about-heading')).toHaveText('About Page')\n  })\n\n  test('navigate back to home after visiting about', async ({ page }) => {\n    await page.goto('/')\n    await page.getByTestId('link-about').click()\n    await expect(page.getByTestId('about-heading')).toBeVisible()\n\n    await page.getByTestId('link-home').click()\n    await expect(page.getByTestId('home-heading')).toBeVisible()\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/tests/setup/global.setup.ts",
    "content": "import { chromium } from '@playwright/test'\nimport {\n  e2eStartDummyServer,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nasync function waitForServer(url: string) {\n  const start = Date.now()\n  while (Date.now() - start < 30_000) {\n    const controller = new AbortController()\n    const timer = setTimeout(() => controller.abort(), 5_000)\n    try {\n      const res = await fetch(url, {\n        redirect: 'manual',\n        signal: controller.signal,\n      })\n      if (res.status >= 200 && res.status < 400) return\n    } catch {\n      // ignore aborted/network errors\n    } finally {\n      clearTimeout(timer)\n    }\n    await new Promise((r) => setTimeout(r, 250))\n  }\n  throw new Error(`Timed out waiting for dev server at ${url}`)\n}\n\nasync function preOptimizeDevServer(baseURL: string) {\n  const browser = await chromium.launch()\n  const context = await browser.newContext()\n  const page = await context.newPage()\n\n  try {\n    await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('home-heading').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Exercise client-side navigation so Vite discovers all deps\n    await page.getByTestId('link-about').click()\n    await page.waitForURL('**/about')\n    await page.getByTestId('about-heading').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('link-home').click()\n    await page.waitForURL(/\\/([^/]*)(\\/)?($|\\?)/)\n    await page.getByTestId('home-heading').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Ensure we end in a stable state. Vite's optimize step triggers a reload;\n    // this waits until no further navigations happen for a short window.\n    for (let i = 0; i < 40; i++) {\n      const currentUrl = page.url()\n      await page.waitForTimeout(250)\n      if (page.url() === currentUrl) {\n        await page.waitForTimeout(250)\n        if (page.url() === currentUrl) return\n      }\n    }\n\n    throw new Error('Dev server did not reach a stable URL after warmup')\n  } finally {\n    await context.close()\n    await browser.close()\n  }\n}\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n\n  if (process.env.MODE !== 'dev') return\n\n  const port = await getTestServerPort(packageJson.name)\n  const baseURL = `http://localhost:${port}`\n\n  await waitForServer(baseURL)\n  await preOptimizeDevServer(baseURL)\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/split-base-and-basepath/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  base: '/_ui/',\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tanstackStart({\n      router: {\n        basepath: '/',\n      },\n    }),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-static-server-functions\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node .output/server/index.mjs\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"@tanstack/react-start\": \"workspace:*\",\n    \"@tanstack/start-static-server-functions\": \"workspace:*\",\n    \"nitro\": \"^3.0.1-alpha.2\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:*\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts'\n  id: '__root__' | '/' | '/posts' | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreloadStaleTime: 0,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { title: 'Static Server Functions E2E Test' },\n    ],\n  }),\n  shellComponent: RootDocument,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <div>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link to=\"/\" data-testid=\"link-home\">\n          Home\n        </Link>\n        <Link to=\"/posts\" data-testid=\"link-posts\">\n          Posts\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nconst fetchIndexData = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .handler(async () => {\n    return { message: 'Hello from static server function!' }\n  })\n\nexport const Route = createFileRoute('/')({\n  loader: async () => fetchIndexData(),\n  component: Home,\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n  return (\n    <div>\n      <h1 data-testid=\"index-heading\">Home</h1>\n      <p data-testid=\"index-message\">{data.message}</p>\n      <Link to=\"/posts\" data-testid=\"link-to-posts\">\n        Go to Posts\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"posts-index\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/src/routes/posts.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\ntype Post = {\n  id: string\n  title: string\n}\n\nconst fetchPosts = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .handler(async () => {\n    return [\n      { id: '1', title: 'First Post' },\n      { id: '2', title: 'Second Post' },\n      { id: '3', title: 'Third Post' },\n    ] as Array<Post>\n  })\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div>\n      <h2 data-testid=\"posts-heading\">Posts</h2>\n      <ul>\n        {posts.map((post) => (\n          <li key={post.id} data-testid={`post-${post.id}`}>\n            {post.title}\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/tests/app.spec.ts",
    "content": "import { existsSync, readdirSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.describe('Static Server Functions with Nitro', () => {\n  test.describe('Build Output Verification', () => {\n    test('should write staticServerFnCache files to the public output directory', () => {\n      const publicDir = join(process.cwd(), '.output', 'public')\n\n      // The static server function cache should be in the public directory\n      // (the directory served by Nitro), NOT in .output/dist/client/\n      const cacheDir = join(publicDir, '__tsr', 'staticServerFnCache')\n      expect(existsSync(cacheDir)).toBe(true)\n\n      // There should be JSON cache files\n      const files = readdirSync(cacheDir)\n      const jsonFiles = files.filter((f) => f.endsWith('.json'))\n      expect(jsonFiles.length).toBeGreaterThan(0)\n    })\n\n    test('should NOT have staticServerFnCache in dist/client', () => {\n      // The bug: cache files end up in .output/dist/client/ instead of .output/public/\n      const wrongDir = join(\n        process.cwd(),\n        '.output',\n        'dist',\n        'client',\n        '__tsr',\n        'staticServerFnCache',\n      )\n      expect(existsSync(wrongDir)).toBe(false)\n    })\n\n    test('should have prerendered HTML pages in public directory', () => {\n      const publicDir = join(process.cwd(), '.output', 'public')\n      expect(existsSync(join(publicDir, 'index.html'))).toBe(true)\n      expect(existsSync(join(publicDir, 'posts', 'index.html'))).toBe(true)\n    })\n  })\n\n  test.describe('Runtime Verification', () => {\n    test('should render the home page with data from static server function', async ({\n      page,\n    }) => {\n      await page.goto('/')\n      await expect(page.getByTestId('index-heading')).toHaveText('Home')\n      await expect(page.getByTestId('index-message')).toHaveText(\n        'Hello from static server function!',\n      )\n    })\n\n    test('should render the posts page with data from static server function', async ({\n      page,\n    }) => {\n      await page.goto('/posts')\n      await expect(page.getByTestId('posts-heading')).toHaveText('Posts')\n      await expect(page.getByTestId('post-1')).toHaveText('First Post')\n      await expect(page.getByTestId('post-2')).toHaveText('Second Post')\n      await expect(page.getByTestId('post-3')).toHaveText('Third Post')\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/static-server-functions/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { nitro } from 'nitro/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    nitro(),\n    tanstackStart({\n      prerender: {\n        enabled: true,\n        crawlLinks: false,\n      },\n    }),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n/dist/\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-streaming-ssr\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.80.7\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SyncOnlyRouteImport } from './routes/sync-only'\nimport { Route as StreamRouteImport } from './routes/stream'\nimport { Route as SlowRenderRouteImport } from './routes/slow-render'\nimport { Route as QueryHeavyRouteImport } from './routes/query-heavy'\nimport { Route as NestedDeferredRouteImport } from './routes/nested-deferred'\nimport { Route as ManyPromisesRouteImport } from './routes/many-promises'\nimport { Route as FastSerialRouteImport } from './routes/fast-serial'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as ConcurrentRouteImport } from './routes/concurrent'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst SyncOnlyRoute = SyncOnlyRouteImport.update({\n  id: '/sync-only',\n  path: '/sync-only',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst StreamRoute = StreamRouteImport.update({\n  id: '/stream',\n  path: '/stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SlowRenderRoute = SlowRenderRouteImport.update({\n  id: '/slow-render',\n  path: '/slow-render',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst QueryHeavyRoute = QueryHeavyRouteImport.update({\n  id: '/query-heavy',\n  path: '/query-heavy',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedDeferredRoute = NestedDeferredRouteImport.update({\n  id: '/nested-deferred',\n  path: '/nested-deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ManyPromisesRoute = ManyPromisesRouteImport.update({\n  id: '/many-promises',\n  path: '/many-promises',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FastSerialRoute = FastSerialRouteImport.update({\n  id: '/fast-serial',\n  path: '/fast-serial',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ConcurrentRoute = ConcurrentRouteImport.update({\n  id: '/concurrent',\n  path: '/concurrent',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/concurrent': typeof ConcurrentRoute\n  '/deferred': typeof DeferredRoute\n  '/fast-serial': typeof FastSerialRoute\n  '/many-promises': typeof ManyPromisesRoute\n  '/nested-deferred': typeof NestedDeferredRoute\n  '/query-heavy': typeof QueryHeavyRoute\n  '/slow-render': typeof SlowRenderRoute\n  '/stream': typeof StreamRoute\n  '/sync-only': typeof SyncOnlyRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/concurrent': typeof ConcurrentRoute\n  '/deferred': typeof DeferredRoute\n  '/fast-serial': typeof FastSerialRoute\n  '/many-promises': typeof ManyPromisesRoute\n  '/nested-deferred': typeof NestedDeferredRoute\n  '/query-heavy': typeof QueryHeavyRoute\n  '/slow-render': typeof SlowRenderRoute\n  '/stream': typeof StreamRoute\n  '/sync-only': typeof SyncOnlyRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/concurrent': typeof ConcurrentRoute\n  '/deferred': typeof DeferredRoute\n  '/fast-serial': typeof FastSerialRoute\n  '/many-promises': typeof ManyPromisesRoute\n  '/nested-deferred': typeof NestedDeferredRoute\n  '/query-heavy': typeof QueryHeavyRoute\n  '/slow-render': typeof SlowRenderRoute\n  '/stream': typeof StreamRoute\n  '/sync-only': typeof SyncOnlyRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/concurrent'\n    | '/deferred'\n    | '/fast-serial'\n    | '/many-promises'\n    | '/nested-deferred'\n    | '/query-heavy'\n    | '/slow-render'\n    | '/stream'\n    | '/sync-only'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/concurrent'\n    | '/deferred'\n    | '/fast-serial'\n    | '/many-promises'\n    | '/nested-deferred'\n    | '/query-heavy'\n    | '/slow-render'\n    | '/stream'\n    | '/sync-only'\n  id:\n    | '__root__'\n    | '/'\n    | '/concurrent'\n    | '/deferred'\n    | '/fast-serial'\n    | '/many-promises'\n    | '/nested-deferred'\n    | '/query-heavy'\n    | '/slow-render'\n    | '/stream'\n    | '/sync-only'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ConcurrentRoute: typeof ConcurrentRoute\n  DeferredRoute: typeof DeferredRoute\n  FastSerialRoute: typeof FastSerialRoute\n  ManyPromisesRoute: typeof ManyPromisesRoute\n  NestedDeferredRoute: typeof NestedDeferredRoute\n  QueryHeavyRoute: typeof QueryHeavyRoute\n  SlowRenderRoute: typeof SlowRenderRoute\n  StreamRoute: typeof StreamRoute\n  SyncOnlyRoute: typeof SyncOnlyRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/sync-only': {\n      id: '/sync-only'\n      path: '/sync-only'\n      fullPath: '/sync-only'\n      preLoaderRoute: typeof SyncOnlyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/stream': {\n      id: '/stream'\n      path: '/stream'\n      fullPath: '/stream'\n      preLoaderRoute: typeof StreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/slow-render': {\n      id: '/slow-render'\n      path: '/slow-render'\n      fullPath: '/slow-render'\n      preLoaderRoute: typeof SlowRenderRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/query-heavy': {\n      id: '/query-heavy'\n      path: '/query-heavy'\n      fullPath: '/query-heavy'\n      preLoaderRoute: typeof QueryHeavyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested-deferred': {\n      id: '/nested-deferred'\n      path: '/nested-deferred'\n      fullPath: '/nested-deferred'\n      preLoaderRoute: typeof NestedDeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/many-promises': {\n      id: '/many-promises'\n      path: '/many-promises'\n      fullPath: '/many-promises'\n      preLoaderRoute: typeof ManyPromisesRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/fast-serial': {\n      id: '/fast-serial'\n      path: '/fast-serial'\n      fullPath: '/fast-serial'\n      preLoaderRoute: typeof FastSerialRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/concurrent': {\n      id: '/concurrent'\n      path: '/concurrent'\n      fullPath: '/concurrent'\n      preLoaderRoute: typeof ConcurrentRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ConcurrentRoute: ConcurrentRoute,\n  DeferredRoute: DeferredRoute,\n  FastSerialRoute: FastSerialRoute,\n  ManyPromisesRoute: ManyPromisesRoute,\n  NestedDeferredRoute: NestedDeferredRoute,\n  QueryHeavyRoute: QueryHeavyRoute,\n  SlowRenderRoute: SlowRenderRoute,\n  StreamRoute: StreamRoute,\n  SyncOnlyRoute: SyncOnlyRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/react-query'\nimport { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    scrollRestoration: true,\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/__root.tsx",
    "content": "import { useState } from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'Streaming SSR Tests',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\n/**\n * Global hydration check component rendered in the root layout.\n * Tests can click the button and verify the status changes to confirm\n * that React has hydrated and the app is interactive.\n */\nfunction HydrationCheck() {\n  const [status, setStatus] = useState<'pending' | 'hydrated'>('pending')\n\n  return (\n    <div\n      data-testid=\"hydration-check\"\n      style={{\n        padding: '8px',\n        backgroundColor: status === 'hydrated' ? '#d4edda' : '#f8f9fa',\n        borderBottom: '1px solid #ccc',\n      }}\n    >\n      <button\n        data-testid=\"hydration-check-btn\"\n        onClick={() => setStatus('hydrated')}\n      >\n        {status === 'pending' ? 'Check Hydration' : 'Hydrated!'}\n      </button>\n      <span data-testid=\"hydration-status\" style={{ marginLeft: '10px' }}>\n        {status}\n      </span>\n    </div>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <HydrationCheck />\n        <nav style={{ padding: '10px', borderBottom: '1px solid #ccc' }}>\n          <Link to=\"/\" style={{ marginRight: '10px' }}>\n            Home\n          </Link>\n          <Link to=\"/sync-only\" style={{ marginRight: '10px' }}>\n            Sync Only\n          </Link>\n          <Link to=\"/deferred\" style={{ marginRight: '10px' }}>\n            Deferred\n          </Link>\n          <Link to=\"/stream\" style={{ marginRight: '10px' }}>\n            Stream\n          </Link>\n          <Link to=\"/fast-serial\" style={{ marginRight: '10px' }}>\n            Fast Serial\n          </Link>\n          <Link to=\"/slow-render\" style={{ marginRight: '10px' }}>\n            Slow Render\n          </Link>\n          <Link to=\"/nested-deferred\" style={{ marginRight: '10px' }}>\n            Nested Deferred\n          </Link>\n          <Link to=\"/many-promises\" style={{ marginRight: '10px' }}>\n            Many Promises\n          </Link>\n          <Link to=\"/query-heavy\" style={{ marginRight: '10px' }}>\n            Query Heavy\n          </Link>\n          <Link to=\"/concurrent\" style={{ marginRight: '10px' }}>\n            Concurrent\n          </Link>\n        </nav>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/concurrent.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { Suspense } from 'react'\n\n/**\n * Tests concurrent promise resolution - multiple promises resolving at the exact same time.\n * This can stress the serialization system and reveal race conditions.\n */\n\n// Shared delay function that resolves multiple promises at the same instant\nfunction createConcurrentPromises(\n  count: number,\n  delayMs: number,\n): Array<Promise<string>> {\n  const sharedPromise = new Promise<void>((resolve) =>\n    setTimeout(resolve, delayMs),\n  )\n  return Array.from({ length: count }, (_, i) =>\n    sharedPromise.then(() => `concurrent-${i + 1}`),\n  )\n}\n\nexport const Route = createFileRoute('/concurrent')({\n  loader: async () => {\n    // Create fresh batches of concurrent promises for each request\n    const batch1 = createConcurrentPromises(5, 100) // 5 promises resolving at 100ms\n    const batch2 = createConcurrentPromises(5, 200) // 5 promises resolving at 200ms\n    const batch3 = createConcurrentPromises(5, 300) // 5 promises resolving at 300ms\n\n    return {\n      // Batch 1: 5 promises resolving at exactly the same time (100ms)\n      concurrent1_1: batch1[0],\n      concurrent1_2: batch1[1],\n      concurrent1_3: batch1[2],\n      concurrent1_4: batch1[3],\n      concurrent1_5: batch1[4],\n\n      // Batch 2: 5 promises resolving at exactly the same time (200ms)\n      concurrent2_1: batch2[0],\n      concurrent2_2: batch2[1],\n      concurrent2_3: batch2[2],\n      concurrent2_4: batch2[3],\n      concurrent2_5: batch2[4],\n\n      // Batch 3: 5 promises resolving at exactly the same time (300ms)\n      concurrent3_1: batch3[0],\n      concurrent3_2: batch3[1],\n      concurrent3_3: batch3[2],\n      concurrent3_4: batch3[3],\n      concurrent3_5: batch3[4],\n    }\n  },\n  component: Concurrent,\n})\n\nfunction PromiseItem({\n  promise,\n  testId,\n}: {\n  promise: Promise<string>\n  testId: string\n}) {\n  return (\n    <Suspense\n      fallback={<div data-testid={`${testId}-loading`}>Loading...</div>}\n    >\n      <Await\n        promise={promise}\n        children={(data) => <div data-testid={testId}>{data}</div>}\n      />\n    </Suspense>\n  )\n}\n\nfunction Concurrent() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div style={{ padding: '20px' }}>\n      <h2>Concurrent Resolution Test (15 promises in 3 batches)</h2>\n      <p>Tests multiple promises resolving at the exact same instant.</p>\n\n      <div\n        style={{\n          display: 'grid',\n          gridTemplateColumns: 'repeat(3, 1fr)',\n          gap: '20px',\n        }}\n      >\n        {/* Batch 1: 100ms */}\n        <div>\n          <h3>Batch 1 (100ms)</h3>\n          <PromiseItem promise={data.concurrent1_1} testId=\"concurrent-1-1\" />\n          <PromiseItem promise={data.concurrent1_2} testId=\"concurrent-1-2\" />\n          <PromiseItem promise={data.concurrent1_3} testId=\"concurrent-1-3\" />\n          <PromiseItem promise={data.concurrent1_4} testId=\"concurrent-1-4\" />\n          <PromiseItem promise={data.concurrent1_5} testId=\"concurrent-1-5\" />\n        </div>\n\n        {/* Batch 2: 200ms */}\n        <div>\n          <h3>Batch 2 (200ms)</h3>\n          <PromiseItem promise={data.concurrent2_1} testId=\"concurrent-2-1\" />\n          <PromiseItem promise={data.concurrent2_2} testId=\"concurrent-2-2\" />\n          <PromiseItem promise={data.concurrent2_3} testId=\"concurrent-2-3\" />\n          <PromiseItem promise={data.concurrent2_4} testId=\"concurrent-2-4\" />\n          <PromiseItem promise={data.concurrent2_5} testId=\"concurrent-2-5\" />\n        </div>\n\n        {/* Batch 3: 300ms */}\n        <div>\n          <h3>Batch 3 (300ms)</h3>\n          <PromiseItem promise={data.concurrent3_1} testId=\"concurrent-3-1\" />\n          <PromiseItem promise={data.concurrent3_2} testId=\"concurrent-3-2\" />\n          <PromiseItem promise={data.concurrent3_3} testId=\"concurrent-3-3\" />\n          <PromiseItem promise={data.concurrent3_4} testId=\"concurrent-3-4\" />\n          <PromiseItem promise={data.concurrent3_5} testId=\"concurrent-3-5\" />\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Suspense } from 'react'\n\n// Server function that returns immediately\nconst getImmediateData = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(({ data }) => {\n    return {\n      name: data.name,\n      timestamp: Date.now(),\n      // Track where this data came from - should always be 'server' if SSR works\n      source: 'server' as const,\n    }\n  })\n\n// Server function that takes time to complete\nconst getSlowData = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string; delay: number }) => data)\n  .handler(async ({ data }) => {\n    await new Promise((r) => setTimeout(r, data.delay))\n    return {\n      name: data.name,\n      timestamp: Date.now(),\n      // Track where this data came from - should always be 'server' if SSR works\n      source: 'server' as const,\n    }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      // Deferred promise that resolves after 1 second\n      deferredData: new Promise<{ message: string; source: string }>((r) =>\n        setTimeout(\n          () =>\n            r({\n              message: 'Deferred data loaded!',\n              // Track where this data came from - should always be 'server' if SSR works\n              source: typeof window === 'undefined' ? 'server' : 'client',\n            }),\n          1000,\n        ),\n      ),\n      // Deferred server function call\n      deferredServerData: getSlowData({\n        data: { name: 'Slow User', delay: 800 },\n      }),\n      // Immediate data (awaited)\n      immediateData: await getImmediateData({ data: { name: 'Fast User' } }),\n      // Track where loader ran - should always be 'server' if SSR works\n      loaderSource: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const { deferredData, deferredServerData, immediateData, loaderSource } =\n    Route.useLoaderData()\n\n  return (\n    <div style={{ padding: '20px' }}>\n      <h2>Deferred Data Test</h2>\n\n      {/* Immediate data should be available right away */}\n      <div data-testid=\"immediate-data\">\n        Immediate: {immediateData.name} @ {immediateData.timestamp}\n      </div>\n\n      <div data-testid=\"immediate-source\">\n        Immediate source: {immediateData.source}\n      </div>\n\n      <div data-testid=\"loader-source\">Loader source: {loaderSource}</div>\n\n      {/* Deferred promise */}\n      <Suspense\n        fallback={<div data-testid=\"deferred-loading\">Loading deferred...</div>}\n      >\n        <Await\n          promise={deferredData}\n          children={(data) => (\n            <div data-testid=\"deferred-data\">\n              {data.message} (source: {data.source})\n            </div>\n          )}\n        />\n      </Suspense>\n\n      {/* Deferred server function */}\n      <Suspense\n        fallback={\n          <div data-testid=\"server-loading\">Loading server data...</div>\n        }\n      >\n        <Await\n          promise={deferredServerData}\n          children={(data) => (\n            <div data-testid=\"deferred-server-data\">\n              Server: {data.name} @ {data.timestamp} (source: {data.source})\n            </div>\n          )}\n        />\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/fast-serial.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\n// Server function that returns immediately with minimal data\nconst getSmallData = createServerFn({ method: 'GET' }).handler(() => {\n  return {\n    value: 'small-data',\n    timestamp: Date.now(),\n    // Track where this data came from - should always be 'server' if SSR works\n    source: 'server' as const,\n  }\n})\n\nexport const Route = createFileRoute('/fast-serial')({\n  loader: async () => {\n    // All data is awaited immediately - serialization should complete quickly\n    const data = await getSmallData()\n    return {\n      serverData: data,\n      staticData: 'This is static data',\n      timestamp: Date.now(),\n      // Track where loader ran - should always be 'server' if SSR works\n      loaderSource: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  component: FastSerial,\n})\n\nfunction FastSerial() {\n  const { serverData, staticData, timestamp, loaderSource } =\n    Route.useLoaderData()\n\n  return (\n    <div style={{ padding: '20px' }}>\n      <h2>Fast Serialization Test</h2>\n      <p>This route tests when serialization completes before render.</p>\n\n      <div data-testid=\"server-data\">\n        Server: {serverData.value} @ {serverData.timestamp}\n      </div>\n\n      <div data-testid=\"server-fn-source\">\n        Server function source: {serverData.source}\n      </div>\n\n      <div data-testid=\"loader-source\">Loader source: {loaderSource}</div>\n\n      <div data-testid=\"static-data\">Static: {staticData}</div>\n\n      <div data-testid=\"loader-timestamp\">Loader timestamp: {timestamp}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/index.tsx",
    "content": "import { createFileRoute, Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Index,\n})\n\nfunction Index() {\n  return (\n    <div style={{ padding: '20px' }}>\n      <h1 data-testid=\"index-title\">Streaming SSR Test Scenarios</h1>\n      <p>This e2e project tests various SSR streaming scenarios:</p>\n      <ul>\n        <li>\n          <Link to=\"/sync-only\" data-testid=\"link-sync-only\">\n            Sync Only\n          </Link>{' '}\n          - Tests synchronous serialization with no deferred/streaming data\n        </li>\n        <li>\n          <Link to=\"/deferred\" data-testid=\"link-deferred\">\n            Deferred Data\n          </Link>{' '}\n          - Tests deferred promises resolving after initial render\n        </li>\n        <li>\n          <Link to=\"/stream\" data-testid=\"link-stream\">\n            ReadableStream\n          </Link>{' '}\n          - Tests streaming data via ReadableStream\n        </li>\n        <li>\n          <Link to=\"/fast-serial\" data-testid=\"link-fast-serial\">\n            Fast Serialization\n          </Link>{' '}\n          - Tests when serialization completes before render finishes\n        </li>\n        <li>\n          <Link to=\"/slow-render\" data-testid=\"link-slow-render\">\n            Slow Render\n          </Link>{' '}\n          - Tests when render takes longer than serialization\n        </li>\n        <li>\n          <Link to=\"/nested-deferred\" data-testid=\"link-nested-deferred\">\n            Nested Deferred\n          </Link>{' '}\n          - Tests nested components with deferred data\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/many-promises.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { Suspense } from 'react'\n\n/**\n * Tests streaming with many (15+) deferred promises resolving in various orders.\n * This stresses the serialization system with concurrent promise resolutions.\n */\n\n// Helper to create a promise with a specific delay and value\nfunction createDelayedPromise<T>(value: T, delayMs: number): Promise<T> {\n  return new Promise((resolve) => setTimeout(() => resolve(value), delayMs))\n}\n\nexport const Route = createFileRoute('/many-promises')({\n  loader: async () => {\n    // Create 15 promises with varying delays to test ordering\n    // Some resolve quickly, some slowly, some at similar times\n    return {\n      // Immediate/very fast (0-50ms)\n      immediate1: createDelayedPromise('immediate-1', 0),\n      immediate2: createDelayedPromise('immediate-2', 10),\n      immediate3: createDelayedPromise('immediate-3', 20),\n\n      // Fast (50-150ms)\n      fast1: createDelayedPromise('fast-1', 50),\n      fast2: createDelayedPromise('fast-2', 75),\n      fast3: createDelayedPromise('fast-3', 100),\n      fast4: createDelayedPromise('fast-4', 125),\n\n      // Medium (150-300ms)\n      medium1: createDelayedPromise('medium-1', 150),\n      medium2: createDelayedPromise('medium-2', 200),\n      medium3: createDelayedPromise('medium-3', 250),\n\n      // Slow (300-600ms)\n      slow1: createDelayedPromise('slow-1', 300),\n      slow2: createDelayedPromise('slow-2', 400),\n      slow3: createDelayedPromise('slow-3', 500),\n\n      // Very slow (600ms+)\n      verySlow1: createDelayedPromise('very-slow-1', 600),\n      verySlow2: createDelayedPromise('very-slow-2', 800),\n    }\n  },\n  component: ManyPromises,\n})\n\nfunction PromiseItem({\n  promise,\n  testId,\n  label,\n}: {\n  promise: Promise<string>\n  testId: string\n  label: string\n}) {\n  return (\n    <Suspense\n      fallback={<div data-testid={`${testId}-loading`}>Loading {label}...</div>}\n    >\n      <Await\n        promise={promise}\n        children={(data) => (\n          <div data-testid={testId}>\n            {label}: {data}\n          </div>\n        )}\n      />\n    </Suspense>\n  )\n}\n\nfunction ManyPromises() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div style={{ padding: '20px' }}>\n      <h2>Many Promises Test (15 deferred)</h2>\n      <p>Tests streaming with many concurrent deferred promises.</p>\n\n      <div\n        style={{\n          display: 'grid',\n          gridTemplateColumns: 'repeat(3, 1fr)',\n          gap: '10px',\n        }}\n      >\n        {/* Immediate group */}\n        <div>\n          <h3>Immediate (0-20ms)</h3>\n          <PromiseItem\n            promise={data.immediate1}\n            testId=\"immediate-1\"\n            label=\"Immediate 1\"\n          />\n          <PromiseItem\n            promise={data.immediate2}\n            testId=\"immediate-2\"\n            label=\"Immediate 2\"\n          />\n          <PromiseItem\n            promise={data.immediate3}\n            testId=\"immediate-3\"\n            label=\"Immediate 3\"\n          />\n        </div>\n\n        {/* Fast group */}\n        <div>\n          <h3>Fast (50-125ms)</h3>\n          <PromiseItem promise={data.fast1} testId=\"fast-1\" label=\"Fast 1\" />\n          <PromiseItem promise={data.fast2} testId=\"fast-2\" label=\"Fast 2\" />\n          <PromiseItem promise={data.fast3} testId=\"fast-3\" label=\"Fast 3\" />\n          <PromiseItem promise={data.fast4} testId=\"fast-4\" label=\"Fast 4\" />\n        </div>\n\n        {/* Medium group */}\n        <div>\n          <h3>Medium (150-250ms)</h3>\n          <PromiseItem\n            promise={data.medium1}\n            testId=\"medium-1\"\n            label=\"Medium 1\"\n          />\n          <PromiseItem\n            promise={data.medium2}\n            testId=\"medium-2\"\n            label=\"Medium 2\"\n          />\n          <PromiseItem\n            promise={data.medium3}\n            testId=\"medium-3\"\n            label=\"Medium 3\"\n          />\n        </div>\n\n        {/* Slow group */}\n        <div>\n          <h3>Slow (300-500ms)</h3>\n          <PromiseItem promise={data.slow1} testId=\"slow-1\" label=\"Slow 1\" />\n          <PromiseItem promise={data.slow2} testId=\"slow-2\" label=\"Slow 2\" />\n          <PromiseItem promise={data.slow3} testId=\"slow-3\" label=\"Slow 3\" />\n        </div>\n\n        {/* Very slow group */}\n        <div>\n          <h3>Very Slow (600-800ms)</h3>\n          <PromiseItem\n            promise={data.verySlow1}\n            testId=\"very-slow-1\"\n            label=\"Very Slow 1\"\n          />\n          <PromiseItem\n            promise={data.verySlow2}\n            testId=\"very-slow-2\"\n            label=\"Very Slow 2\"\n          />\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/nested-deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Suspense } from 'react'\n\n// Multiple server functions with different delays\nconst getLevel1Data = createServerFn({ method: 'GET' }).handler(async () => {\n  await new Promise((r) => setTimeout(r, 200))\n  return { level: 1, timestamp: Date.now() }\n})\n\nconst getLevel2Data = createServerFn({ method: 'GET' }).handler(async () => {\n  await new Promise((r) => setTimeout(r, 400))\n  return { level: 2, timestamp: Date.now() }\n})\n\nconst getLevel3Data = createServerFn({ method: 'GET' }).handler(async () => {\n  await new Promise((r) => setTimeout(r, 600))\n  return { level: 3, timestamp: Date.now() }\n})\n\nexport const Route = createFileRoute('/nested-deferred')({\n  loader: async () => {\n    return {\n      // Multiple deferred promises that resolve at different times\n      level1: getLevel1Data(),\n      level2: getLevel2Data(),\n      level3: getLevel3Data(),\n      // Also a plain deferred promise\n      plainDeferred: new Promise<string>((r) =>\n        setTimeout(() => r('Plain deferred resolved!'), 300),\n      ),\n    }\n  },\n  component: NestedDeferred,\n})\n\n// Nested component that renders more Await components\nfunction Level1Content({\n  level2,\n  level3,\n}: {\n  level2: Promise<{ level: number; timestamp: number }>\n  level3: Promise<{ level: number; timestamp: number }>\n}) {\n  return (\n    <div\n      style={{\n        marginLeft: '20px',\n        borderLeft: '2px solid #ccc',\n        paddingLeft: '10px',\n      }}\n    >\n      <Suspense\n        fallback={<div data-testid=\"level2-loading\">Loading level 2...</div>}\n      >\n        <Await\n          promise={level2}\n          children={(data) => (\n            <div data-testid=\"level2-data\">\n              Level 2: {data.level} @ {data.timestamp}\n              <Level2Content level3={level3} />\n            </div>\n          )}\n        />\n      </Suspense>\n    </div>\n  )\n}\n\nfunction Level2Content({\n  level3,\n}: {\n  level3: Promise<{ level: number; timestamp: number }>\n}) {\n  return (\n    <div\n      style={{\n        marginLeft: '20px',\n        borderLeft: '2px solid #999',\n        paddingLeft: '10px',\n      }}\n    >\n      <Suspense\n        fallback={<div data-testid=\"level3-loading\">Loading level 3...</div>}\n      >\n        <Await\n          promise={level3}\n          children={(data) => (\n            <div data-testid=\"level3-data\">\n              Level 3: {data.level} @ {data.timestamp}\n            </div>\n          )}\n        />\n      </Suspense>\n    </div>\n  )\n}\n\nfunction NestedDeferred() {\n  const { level1, level2, level3, plainDeferred } = Route.useLoaderData()\n\n  return (\n    <div style={{ padding: '20px' }}>\n      <h2>Nested Deferred Test</h2>\n      <p>\n        Tests multiple nested deferred promises resolving at different times.\n      </p>\n\n      {/* Plain deferred */}\n      <Suspense\n        fallback={<div data-testid=\"plain-loading\">Loading plain...</div>}\n      >\n        <Await\n          promise={plainDeferred}\n          children={(data) => <div data-testid=\"plain-deferred\">{data}</div>}\n        />\n      </Suspense>\n\n      {/* Nested structure */}\n      <div style={{ marginTop: '20px' }}>\n        <Suspense\n          fallback={<div data-testid=\"level1-loading\">Loading level 1...</div>}\n        >\n          <Await\n            promise={level1}\n            children={(data) => (\n              <div data-testid=\"level1-data\">\n                Level 1: {data.level} @ {data.timestamp}\n                <Level1Content level2={level2} level3={level3} />\n              </div>\n            )}\n          />\n        </Suspense>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/query-heavy.tsx",
    "content": "import { queryOptions, useSuspenseQuery } from '@tanstack/react-query'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { Suspense } from 'react'\n\n/**\n * Tests multiple useSuspenseQuery calls on a single route.\n * Some queries have synchronous queryFn (return immediately),\n * some have async queryFn with various delays.\n *\n * This stresses the SSR query streaming integration.\n */\n\n// Synchronous query - returns immediately (no await)\nconst syncQuery1 = queryOptions({\n  queryKey: ['sync', 1],\n  queryFn: () => {\n    // Synchronous return - no Promise delay\n    return {\n      type: 'sync',\n      id: 1,\n      value: 'sync-value-1',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\nconst syncQuery2 = queryOptions({\n  queryKey: ['sync', 2],\n  queryFn: () => {\n    return {\n      type: 'sync',\n      id: 2,\n      value: 'sync-value-2',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\nconst syncQuery3 = queryOptions({\n  queryKey: ['sync', 3],\n  queryFn: () => {\n    return {\n      type: 'sync',\n      id: 3,\n      value: 'sync-value-3',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\n// Fast async queries (50-100ms)\nconst fastAsyncQuery1 = queryOptions({\n  queryKey: ['fast-async', 1],\n  queryFn: async () => {\n    await new Promise((r) => setTimeout(r, 50))\n    return {\n      type: 'fast-async',\n      id: 1,\n      value: 'fast-async-1',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\nconst fastAsyncQuery2 = queryOptions({\n  queryKey: ['fast-async', 2],\n  queryFn: async () => {\n    await new Promise((r) => setTimeout(r, 75))\n    return {\n      type: 'fast-async',\n      id: 2,\n      value: 'fast-async-2',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\nconst fastAsyncQuery3 = queryOptions({\n  queryKey: ['fast-async', 3],\n  queryFn: async () => {\n    await new Promise((r) => setTimeout(r, 100))\n    return {\n      type: 'fast-async',\n      id: 3,\n      value: 'fast-async-3',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\n// Slow async queries (200-400ms)\nconst slowAsyncQuery1 = queryOptions({\n  queryKey: ['slow-async', 1],\n  queryFn: async () => {\n    await new Promise((r) => setTimeout(r, 200))\n    return {\n      type: 'slow-async',\n      id: 1,\n      value: 'slow-async-1',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\nconst slowAsyncQuery2 = queryOptions({\n  queryKey: ['slow-async', 2],\n  queryFn: async () => {\n    await new Promise((r) => setTimeout(r, 300))\n    return {\n      type: 'slow-async',\n      id: 2,\n      value: 'slow-async-2',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\nconst slowAsyncQuery3 = queryOptions({\n  queryKey: ['slow-async', 3],\n  queryFn: async () => {\n    await new Promise((r) => setTimeout(r, 400))\n    return {\n      type: 'slow-async',\n      id: 3,\n      value: 'slow-async-3',\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  staleTime: Infinity,\n})\n\nexport const Route = createFileRoute('/query-heavy')({\n  component: QueryHeavy,\n})\n\n// Individual query components to test Suspense boundaries\nfunction SyncQueryDisplay({\n  queryOpts,\n  testId,\n}: {\n  queryOpts: typeof syncQuery1\n  testId: string\n}) {\n  const { data } = useSuspenseQuery(queryOpts)\n  return (\n    <div data-testid={testId}>\n      {data.value} (source: {data.source})\n    </div>\n  )\n}\n\nfunction AsyncQueryDisplay({\n  queryOpts,\n  testId,\n}: {\n  queryOpts: typeof fastAsyncQuery1\n  testId: string\n}) {\n  const { data } = useSuspenseQuery(queryOpts)\n  return (\n    <div data-testid={testId}>\n      {data.value} (source: {data.source})\n    </div>\n  )\n}\n\nfunction QueryHeavy() {\n  return (\n    <div style={{ padding: '20px' }}>\n      <h2>Query Heavy Test (9 useSuspenseQuery calls)</h2>\n      <p>Tests multiple useSuspenseQuery with mixed sync/async queryFn.</p>\n      <p>\n        All queries should show \"source: server\" if SSR streaming works\n        correctly.\n      </p>\n\n      <div\n        style={{\n          display: 'grid',\n          gridTemplateColumns: 'repeat(3, 1fr)',\n          gap: '20px',\n          marginTop: '20px',\n        }}\n      >\n        {/* Sync queries - should resolve immediately */}\n        <div>\n          <h3>Sync Queries (immediate)</h3>\n          <Suspense\n            fallback={<div data-testid=\"sync-1-loading\">Loading sync 1...</div>}\n          >\n            <SyncQueryDisplay queryOpts={syncQuery1} testId=\"sync-query-1\" />\n          </Suspense>\n          <Suspense\n            fallback={<div data-testid=\"sync-2-loading\">Loading sync 2...</div>}\n          >\n            <SyncQueryDisplay queryOpts={syncQuery2} testId=\"sync-query-2\" />\n          </Suspense>\n          <Suspense\n            fallback={<div data-testid=\"sync-3-loading\">Loading sync 3...</div>}\n          >\n            <SyncQueryDisplay queryOpts={syncQuery3} testId=\"sync-query-3\" />\n          </Suspense>\n        </div>\n\n        {/* Fast async queries */}\n        <div>\n          <h3>Fast Async Queries (50-100ms)</h3>\n          <Suspense\n            fallback={\n              <div data-testid=\"fast-async-1-loading\">Loading fast 1...</div>\n            }\n          >\n            <AsyncQueryDisplay\n              queryOpts={fastAsyncQuery1}\n              testId=\"fast-async-query-1\"\n            />\n          </Suspense>\n          <Suspense\n            fallback={\n              <div data-testid=\"fast-async-2-loading\">Loading fast 2...</div>\n            }\n          >\n            <AsyncQueryDisplay\n              queryOpts={fastAsyncQuery2}\n              testId=\"fast-async-query-2\"\n            />\n          </Suspense>\n          <Suspense\n            fallback={\n              <div data-testid=\"fast-async-3-loading\">Loading fast 3...</div>\n            }\n          >\n            <AsyncQueryDisplay\n              queryOpts={fastAsyncQuery3}\n              testId=\"fast-async-query-3\"\n            />\n          </Suspense>\n        </div>\n\n        {/* Slow async queries */}\n        <div>\n          <h3>Slow Async Queries (200-400ms)</h3>\n          <Suspense\n            fallback={\n              <div data-testid=\"slow-async-1-loading\">Loading slow 1...</div>\n            }\n          >\n            <AsyncQueryDisplay\n              queryOpts={slowAsyncQuery1}\n              testId=\"slow-async-query-1\"\n            />\n          </Suspense>\n          <Suspense\n            fallback={\n              <div data-testid=\"slow-async-2-loading\">Loading slow 2...</div>\n            }\n          >\n            <AsyncQueryDisplay\n              queryOpts={slowAsyncQuery2}\n              testId=\"slow-async-query-2\"\n            />\n          </Suspense>\n          <Suspense\n            fallback={\n              <div data-testid=\"slow-async-3-loading\">Loading slow 3...</div>\n            }\n          >\n            <AsyncQueryDisplay\n              queryOpts={slowAsyncQuery3}\n              testId=\"slow-async-query-3\"\n            />\n          </Suspense>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/slow-render.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Suspense } from 'react'\n\n// Server function that completes quickly\nconst getQuickData = createServerFn({ method: 'GET' }).handler(() => {\n  return {\n    name: 'Quick data',\n    timestamp: Date.now(),\n    // Track where this data came from - should always be 'server' if SSR works\n    source: 'server' as const,\n  }\n})\n\n// Simulate a slow component render by doing work during render\nfunction SlowComponent({ data, index }: { data: string; index: number }) {\n  // This simulates a component that takes time to render\n  const startTime = Date.now()\n  while (Date.now() - startTime < 100) {\n    // Blocking loop to simulate slow render\n  }\n  return <div data-testid={`slow-component-${index}`}>{data}</div>\n}\n\nexport const Route = createFileRoute('/slow-render')({\n  loader: async () => {\n    // All data loads quickly\n    const quickData = await getQuickData()\n    return {\n      quickData,\n      // Deferred data that resolves before render might complete\n      deferredData: new Promise<{ message: string; source: string }>((r) =>\n        setTimeout(\n          () =>\n            r({\n              message: 'Deferred resolved!',\n              // Track where this data came from - should always be 'server' if SSR works\n              source: typeof window === 'undefined' ? 'server' : 'client',\n            }),\n          50,\n        ),\n      ),\n      // Track where loader ran - should always be 'server' if SSR works\n      loaderSource: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  component: SlowRender,\n})\n\nfunction SlowRender() {\n  const { quickData, deferredData, loaderSource } = Route.useLoaderData()\n\n  return (\n    <div style={{ padding: '20px' }}>\n      <h2>Slow Render Test</h2>\n      <p>Tests when render takes longer than serialization.</p>\n\n      <div data-testid=\"quick-data\">\n        Quick: {quickData.name} @ {quickData.timestamp}\n      </div>\n\n      <div data-testid=\"quick-source\">\n        Quick data source: {quickData.source}\n      </div>\n\n      <div data-testid=\"loader-source\">Loader source: {loaderSource}</div>\n\n      <Suspense fallback={<div data-testid=\"deferred-loading\">Loading...</div>}>\n        <Await\n          promise={deferredData}\n          children={(data) => (\n            <div data-testid=\"deferred-resolved\">\n              {data.message} (source: {data.source})\n            </div>\n          )}\n        />\n      </Suspense>\n\n      {/* Multiple slow components to extend render time */}\n      <SlowComponent data=\"Slow component 1\" index={1} />\n      <SlowComponent data=\"Slow component 2\" index={2} />\n      <SlowComponent data=\"Slow component 3\" index={3} />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/stream.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { Suspense, useEffect, useRef, useState } from 'react'\n\nexport const Route = createFileRoute('/stream')({\n  component: StreamRoute,\n  loader() {\n    return {\n      // A promise that resolves after a short delay\n      promise: new Promise<string>((resolve) =>\n        setTimeout(() => resolve('promise-resolved'), 150),\n      ),\n      // A ReadableStream that emits chunks over time\n      stream: new ReadableStream({\n        async start(controller) {\n          for (let i = 0; i < 5; i++) {\n            await new Promise((resolve) => setTimeout(resolve, 200))\n            controller.enqueue(`chunk-${i}`)\n          }\n          controller.close()\n        },\n      }),\n    }\n  },\n})\n\nconst decoder = new TextDecoder('utf-8')\n\nfunction StreamRoute() {\n  const { promise, stream } = Route.useLoaderData()\n  const [streamData, setStreamData] = useState<Array<string>>([])\n  const [streamComplete, setStreamComplete] = useState(false)\n  const readerRef = useRef<ReadableStreamDefaultReader | null>(null)\n  const streamRef = useRef<ReadableStream | null>(null)\n\n  useEffect(() => {\n    // If we're already reading this exact stream, don't start again\n    if (streamRef.current === stream && readerRef.current) {\n      return\n    }\n\n    // Reset state for a new stream\n    if (streamRef.current !== stream) {\n      setStreamData([])\n      setStreamComplete(false)\n      streamRef.current = stream\n    }\n\n    // Check if stream is already locked (from a previous render)\n    if (stream.locked) {\n      return\n    }\n\n    async function fetchStream() {\n      try {\n        const reader = stream.getReader()\n        readerRef.current = reader\n        let chunk\n\n        while (!(chunk = await reader.read()).done) {\n          let value = chunk.value\n          if (typeof value !== 'string') {\n            value = decoder.decode(value, { stream: !chunk.done })\n          }\n          setStreamData((prev) => [...prev, value])\n        }\n        setStreamComplete(true)\n      } catch (e) {\n        // Stream was cancelled or errored, ignore\n        if (!(e instanceof TypeError && String(e).includes('cancelled'))) {\n          console.error('Stream error:', e)\n        }\n      }\n    }\n\n    fetchStream()\n\n    return () => {\n      // Cancel the reader on cleanup\n      if (readerRef.current) {\n        readerRef.current.cancel().catch(() => {})\n        readerRef.current = null\n      }\n    }\n  }, [stream])\n\n  return (\n    <div style={{ padding: '20px' }}>\n      <h2>ReadableStream Test</h2>\n\n      {/* Promise data */}\n      <Suspense\n        fallback={<div data-testid=\"promise-loading\">Loading promise...</div>}\n      >\n        <Await\n          promise={promise}\n          children={(data) => <div data-testid=\"promise-data\">{data}</div>}\n        />\n      </Suspense>\n\n      {/* Stream data */}\n      <div data-testid=\"stream-container\">\n        <h3>Stream chunks:</h3>\n        <div data-testid=\"stream-data\">\n          {streamData.map((chunk, i) => (\n            <div key={i} data-testid={`stream-chunk-${i}`}>\n              {chunk}\n            </div>\n          ))}\n        </div>\n        {streamComplete && (\n          <div data-testid=\"stream-complete\">Stream complete!</div>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/src/routes/sync-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n/**\n * This route tests synchronous serialization - no deferred data, no streaming.\n * The loader returns data synchronously (awaited), so crossSerializeStream\n * completes immediately and all bootstrap scripts should be in the initial HTML.\n */\nexport const Route = createFileRoute('/sync-only')({\n  loader: async () => {\n    // Simulate a fast synchronous data fetch\n    // This data is awaited, not deferred, so serialization completes synchronously\n    return {\n      message: 'Hello from sync loader!',\n      timestamp: Date.now(),\n      items: ['item-1', 'item-2', 'item-3'],\n      // Track where this data came from - should always be 'server' if SSR works\n      source: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  component: SyncOnly,\n})\n\nfunction SyncOnly() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div style={{ padding: '20px' }}>\n      <h1 data-testid=\"sync-title\">Synchronous Serialization Test</h1>\n      <p data-testid=\"sync-message\">{data.message}</p>\n      <p data-testid=\"sync-timestamp\">Loaded at: {data.timestamp}</p>\n      <p data-testid=\"sync-source\">Source: {data.source}</p>\n      <ul data-testid=\"sync-items\">\n        {data.items.map((item) => (\n          <li key={item} data-testid={`sync-item-${item}`}>\n            {item}\n          </li>\n        ))}\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/client-navigation.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Client-side navigation between all routes', () => {\n  test.beforeEach(async ({ page }) => {\n    // Start from home page\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n  })\n\n  test('home -> sync-only -> home works', async ({ page }) => {\n    // Navigate to sync-only\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Sync Only' })\n      .click()\n    await expect(page).toHaveURL('/sync-only')\n    await expect(page.getByTestId('sync-message')).toBeVisible()\n\n    // Navigate back to home\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n    await expect(page.getByTestId('index-title')).toBeVisible()\n  })\n\n  test('home -> deferred -> home works', async ({ page }) => {\n    // Navigate to deferred (use exact: true to avoid matching \"Nested Deferred\")\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Deferred', exact: true })\n      .click()\n    await expect(page).toHaveURL('/deferred')\n    await expect(page.getByTestId('immediate-data')).toBeVisible()\n\n    // Wait for deferred data\n    await expect(page.getByTestId('deferred-data')).toBeVisible({\n      timeout: 5000,\n    })\n\n    // Navigate back to home\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n  })\n\n  test('home -> stream -> home works (no stream locking error)', async ({\n    page,\n  }) => {\n    // This test specifically validates the ReadableStream locking fix\n    // Console errors are monitored by the fixture automatically\n\n    // Navigate to stream\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Stream' })\n      .click()\n    await expect(page).toHaveURL('/stream')\n\n    // Wait for stream to start (at least one chunk or promise resolved)\n    await expect(page.getByTestId('promise-data')).toBeVisible({\n      timeout: 5000,\n    })\n\n    // Navigate back to home before stream completes\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n  })\n\n  test('home -> stream -> wait for completion -> home works', async ({\n    page,\n  }) => {\n    // Navigate to stream\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Stream' })\n      .click()\n    await expect(page).toHaveURL('/stream')\n\n    // Wait for stream to complete\n    await expect(page.getByTestId('stream-complete')).toBeVisible({\n      timeout: 10000,\n    })\n\n    // Navigate back to home\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n    await expect(page.getByTestId('index-title')).toBeVisible()\n  })\n\n  test('home -> stream -> home -> stream again works (fresh stream each time)', async ({\n    page,\n  }) => {\n    // Console errors are monitored by the fixture automatically\n\n    // First navigation to stream\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Stream' })\n      .click()\n    await expect(page).toHaveURL('/stream')\n    await expect(page.getByTestId('promise-data')).toBeVisible({\n      timeout: 5000,\n    })\n\n    // Navigate back to home\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n\n    // Second navigation to stream - should get fresh stream without errors\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Stream' })\n      .click()\n    await expect(page).toHaveURL('/stream')\n\n    // Wait for stream to complete\n    await expect(page.getByTestId('stream-complete')).toBeVisible({\n      timeout: 10000,\n    })\n\n    // Verify all chunks are present\n    await expect(page.getByTestId('stream-chunk-0')).toBeVisible()\n    await expect(page.getByTestId('stream-chunk-4')).toBeVisible()\n  })\n\n  test('home -> fast-serial -> home works', async ({ page }) => {\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Fast Serial' })\n      .click()\n    await expect(page).toHaveURL('/fast-serial')\n    await expect(page.getByTestId('server-data')).toBeVisible()\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n  })\n\n  test('home -> slow-render -> home works', async ({ page }) => {\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Slow Render' })\n      .click()\n    await expect(page).toHaveURL('/slow-render')\n    await expect(page.getByTestId('quick-data')).toBeVisible()\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n  })\n\n  test('home -> nested-deferred -> home works', async ({ page }) => {\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Nested Deferred' })\n      .click()\n    await expect(page).toHaveURL('/nested-deferred')\n\n    // Wait for all levels to load\n    await expect(page.getByTestId('level3-data')).toBeVisible({ timeout: 5000 })\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n  })\n\n  test('rapid navigation between routes works', async ({ page }) => {\n    // Console errors are monitored by the fixture automatically\n\n    // Rapid navigation sequence\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Sync Only' })\n      .click()\n    await expect(page).toHaveURL('/sync-only')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Deferred', exact: true })\n      .click()\n    await expect(page).toHaveURL('/deferred')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Stream' })\n      .click()\n    await expect(page).toHaveURL('/stream')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Fast Serial' })\n      .click()\n    await expect(page).toHaveURL('/fast-serial')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Slow Render' })\n      .click()\n    await expect(page).toHaveURL('/slow-render')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Nested Deferred' })\n      .click()\n    await expect(page).toHaveURL('/nested-deferred')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n  })\n})\n\ntest.describe('Direct navigation followed by client navigation', () => {\n  test('direct to stream -> client nav to deferred works', async ({ page }) => {\n    // Direct navigation to stream\n    await page.goto('/stream')\n    await expect(page.getByTestId('promise-data')).toBeVisible({\n      timeout: 5000,\n    })\n\n    // Client navigation to deferred (use exact: true)\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Deferred', exact: true })\n      .click()\n    await expect(page).toHaveURL('/deferred')\n    await expect(page.getByTestId('immediate-data')).toBeVisible()\n  })\n\n  test('direct to deferred -> client nav to stream works', async ({ page }) => {\n    // Console errors are monitored by the fixture automatically\n\n    // Direct navigation to deferred\n    await page.goto('/deferred')\n    await expect(page.getByTestId('immediate-data')).toBeVisible()\n\n    // Client navigation to stream\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Stream' })\n      .click()\n    await expect(page).toHaveURL('/stream')\n    await expect(page.getByTestId('stream-complete')).toBeVisible({\n      timeout: 10000,\n    })\n  })\n\n  test('direct to sync-only -> client nav to all routes works', async ({\n    page,\n  }) => {\n    await page.goto('/sync-only')\n    await expect(page.getByTestId('sync-message')).toBeVisible()\n\n    // Navigate through all routes\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Deferred', exact: true })\n      .click()\n    await expect(page).toHaveURL('/deferred')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Stream' })\n      .click()\n    await expect(page).toHaveURL('/stream')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Fast Serial' })\n      .click()\n    await expect(page).toHaveURL('/fast-serial')\n\n    await page\n      .getByRole('navigation')\n      .getByRole('link', { name: 'Home' })\n      .click()\n    await expect(page).toHaveURL('/')\n  })\n})\n\ntestWithHydration.describe('Hydration after client navigation', () => {\n  testWithHydration(\n    'interactive elements work after navigating to deferred',\n    async ({ page }) => {\n      await page.goto('/')\n      await page.waitForLoadState('networkidle')\n\n      await page\n        .getByRole('navigation')\n        .getByRole('link', { name: 'Deferred', exact: true })\n        .click()\n      await expect(page).toHaveURL('/deferred')\n\n      // Wait for the page to be fully loaded\n      await expect(page.getByTestId('immediate-data')).toBeVisible()\n    },\n  )\n\n  testWithHydration(\n    'interactive elements work after navigating to fast-serial',\n    async ({ page }) => {\n      await page.goto('/')\n      await page.waitForLoadState('networkidle')\n\n      await page\n        .getByRole('navigation')\n        .getByRole('link', { name: 'Fast Serial' })\n        .click()\n      await expect(page).toHaveURL('/fast-serial')\n\n      // Wait for page to load\n      await expect(page.getByTestId('server-data')).toBeVisible()\n    },\n  )\n\n  testWithHydration(\n    'interactive elements work after navigating to nested-deferred',\n    async ({ page }) => {\n      await page.goto('/')\n      await page.waitForLoadState('networkidle')\n\n      await page\n        .getByRole('navigation')\n        .getByRole('link', { name: 'Nested Deferred' })\n        .click()\n      await expect(page).toHaveURL('/nested-deferred')\n\n      // Wait for page to load\n      await expect(page.getByTestId('plain-deferred')).toBeVisible({\n        timeout: 5000,\n      })\n    },\n  )\n\n  testWithHydration(\n    'interactive elements work after navigating to slow-render',\n    async ({ page }) => {\n      await page.goto('/')\n      await page.waitForLoadState('networkidle')\n\n      await page\n        .getByRole('navigation')\n        .getByRole('link', { name: 'Slow Render' })\n        .click()\n      await expect(page).toHaveURL('/slow-render')\n\n      // Wait for page to load (slow-render has blocking loops)\n      await expect(page.getByTestId('quick-data')).toBeVisible()\n    },\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/concurrent.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Concurrent promise resolution (15 promises in 3 batches)', () => {\n  test('all concurrent promises resolve correctly', async ({ page }) => {\n    await page.goto('/concurrent')\n\n    // Batch 1 (5 promises at 100ms)\n    await expect(page.getByTestId('concurrent-1-1')).toContainText(\n      'concurrent-1',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-1-2')).toContainText(\n      'concurrent-2',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-1-3')).toContainText(\n      'concurrent-3',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-1-4')).toContainText(\n      'concurrent-4',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-1-5')).toContainText(\n      'concurrent-5',\n      { timeout: 5000 },\n    )\n\n    // Batch 2 (5 promises at 200ms)\n    await expect(page.getByTestId('concurrent-2-1')).toContainText(\n      'concurrent-1',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-2-2')).toContainText(\n      'concurrent-2',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-2-3')).toContainText(\n      'concurrent-3',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-2-4')).toContainText(\n      'concurrent-4',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-2-5')).toContainText(\n      'concurrent-5',\n      { timeout: 5000 },\n    )\n\n    // Batch 3 (5 promises at 300ms)\n    await expect(page.getByTestId('concurrent-3-1')).toContainText(\n      'concurrent-1',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-3-2')).toContainText(\n      'concurrent-2',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-3-3')).toContainText(\n      'concurrent-3',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-3-4')).toContainText(\n      'concurrent-4',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('concurrent-3-5')).toContainText(\n      'concurrent-5',\n      { timeout: 5000 },\n    )\n  })\n\n  test('batch 1 resolves before batch 3', async ({ page }) => {\n    await page.goto('/concurrent', { waitUntil: 'commit' })\n\n    // Batch 1 should be visible before batch 3\n    await expect(page.getByTestId('concurrent-1-1')).toBeVisible({\n      timeout: 3000,\n    })\n\n    // Eventually batch 3 should also be visible\n    await expect(page.getByTestId('concurrent-3-5')).toBeVisible({\n      timeout: 5000,\n    })\n  })\n\n  testWithHydration(\n    'hydration works with concurrent resolutions',\n    async ({ page }) => {\n      await page.goto('/concurrent')\n      await page.waitForLoadState('networkidle')\n\n      // Wait for all batches\n      await expect(page.getByTestId('concurrent-3-5')).toBeVisible({\n        timeout: 5000,\n      })\n    },\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/deferred.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Deferred data streaming', () => {\n  test('shows immediate data right away and deferred data after loading', async ({\n    page,\n  }) => {\n    await page.goto('/deferred')\n\n    // Immediate data should be available right away\n    await expect(page.getByTestId('immediate-data')).toBeVisible()\n    await expect(page.getByTestId('immediate-data')).toContainText(\n      'Immediate: Fast User',\n    )\n\n    // Verify immediate data came from server\n    await expect(page.getByTestId('immediate-source')).toContainText(\n      'Immediate source: server',\n    )\n    await expect(page.getByTestId('loader-source')).toContainText(\n      'Loader source: server',\n    )\n\n    // Deferred data should eventually appear with server source\n    await expect(page.getByTestId('deferred-data')).toContainText(\n      'Deferred data loaded!',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('deferred-data')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('deferred-server-data')).toContainText(\n      'Server: Slow User',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('deferred-server-data')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n  })\n\n  test('shows loading states for deferred content', async ({ page }) => {\n    // Navigate with cache disabled to ensure fresh load\n    await page.goto('/deferred', { waitUntil: 'commit' })\n\n    // Should see loading states initially (may be very brief)\n    // We check that deferred content eventually shows\n    await expect(page.getByTestId('deferred-data')).toBeVisible({\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('deferred-server-data')).toBeVisible({\n      timeout: 5000,\n    })\n  })\n\n  testWithHydration(\n    'hydration works - interactive elements respond',\n    async ({ page }) => {\n      await page.goto('/deferred')\n      await page.waitForLoadState('networkidle')\n\n      // Wait for all deferred content to load\n      await expect(page.getByTestId('deferred-data')).toBeVisible({\n        timeout: 5000,\n      })\n\n      // Verify all data came from server after hydration\n      await expect(page.getByTestId('loader-source')).toContainText(\n        'Loader source: server',\n      )\n      await expect(page.getByTestId('deferred-data')).toContainText(\n        'source: server',\n      )\n    },\n  )\n\n  test('client-side navigation to deferred route works', async ({ page }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Navigate via client-side routing using nav link\n    await page.getByRole('link', { name: 'Deferred' }).first().click()\n    await expect(page).toHaveURL('/deferred')\n\n    // Data should load\n    await expect(page.getByTestId('immediate-data')).toContainText('Fast User')\n    await expect(page.getByTestId('deferred-data')).toContainText(\n      'Deferred data loaded!',\n      { timeout: 5000 },\n    )\n  })\n\n  test('all data sources are server - proves SSR streaming works', async ({\n    page,\n  }) => {\n    await page.goto('/deferred')\n\n    // Wait for all deferred content\n    await expect(page.getByTestId('deferred-data')).toBeVisible({\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('deferred-server-data')).toBeVisible({\n      timeout: 5000,\n    })\n\n    // Count all elements showing 'server' source - should be 4:\n    // 1. immediate-source\n    // 2. loader-source\n    // 3. deferred-data (contains \"source: server\")\n    // 4. deferred-server-data (contains \"source: server\")\n    await expect(page.getByTestId('immediate-source')).toContainText('server')\n    await expect(page.getByTestId('loader-source')).toContainText('server')\n    await expect(page.getByTestId('deferred-data')).toContainText(\n      'source: server',\n    )\n    await expect(page.getByTestId('deferred-server-data')).toContainText(\n      'source: server',\n    )\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/fast-serial.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Fast serialization (serialization completes before render)', () => {\n  test('initial HTML contains router bootstrap + barrier', async ({ page }) => {\n    let responseHtml = ''\n    await page.route('/fast-serial', async (route) => {\n      const response = await route.fetch()\n      responseHtml = await response.text()\n      await route.fulfill({ response })\n    })\n\n    await page.goto('/fast-serial')\n    await expect(page.getByTestId('server-data')).toBeVisible()\n\n    expect(responseHtml).toContain('$_TSR')\n    expect(responseHtml).toContain('$_TSR.router')\n    expect(responseHtml).toContain('$_TSR.e()')\n    expect(responseHtml).toContain('$tsr-stream-barrier')\n  })\n\n  test('all data is available immediately', async ({ page }) => {\n    await page.goto('/fast-serial')\n    await page.waitForLoadState('networkidle')\n\n    // All data should be visible\n    await expect(page.getByTestId('server-data')).toContainText('small-data')\n    await expect(page.getByTestId('static-data')).toContainText(\n      'This is static data',\n    )\n    await expect(page.getByTestId('loader-timestamp')).toBeVisible()\n\n    // Verify data came from server (proves SSR streaming worked)\n    await expect(page.getByTestId('loader-source')).toContainText(\n      'Loader source: server',\n    )\n    await expect(page.getByTestId('server-fn-source')).toContainText(\n      'Server function source: server',\n    )\n  })\n\n  testWithHydration('hydration works correctly', async ({ page }) => {\n    await page.goto('/fast-serial')\n    await page.waitForLoadState('networkidle')\n\n    // Verify data came from server after hydration\n    await expect(page.getByTestId('loader-source')).toContainText(\n      'Loader source: server',\n    )\n  })\n\n  test('direct navigation renders correctly', async ({ page }) => {\n    // Direct navigation (SSR)\n    await page.goto('/fast-serial')\n\n    // Should render without errors and show server source\n    await expect(page.getByTestId('server-data')).toBeVisible()\n    await expect(page.getByTestId('loader-source')).toContainText(\n      'Loader source: server',\n    )\n  })\n\n  test('client-side navigation works', async ({ page }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Navigate via nav link\n    await page.getByRole('link', { name: 'Fast Serial' }).first().click()\n    await expect(page).toHaveURL('/fast-serial')\n\n    await expect(page.getByTestId('server-data')).toContainText('small-data')\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/fixtures.ts",
    "content": "import { test as base, expect, type Page } from '@playwright/test'\n\n/**\n * Verifies that React hydration has completed by clicking the global\n * hydration check button and verifying the status changes.\n *\n * This is the canonical way to verify hydration in streaming-ssr tests.\n * The HydrationCheck component is rendered in the root layout (__root.tsx).\n *\n * The function retries clicking until the status changes to 'hydrated',\n * which handles the case where the button is visible from SSR before\n * React has finished hydrating.\n */\nasync function verifyHydration(\n  page: Page,\n  options: { timeout?: number } = {},\n): Promise<void> {\n  const timeout = options.timeout ?? 10000\n  const button = page.getByTestId('hydration-check-btn')\n  const status = page.getByTestId('hydration-status')\n\n  // Ensure the button is visible\n  await expect(button).toBeVisible()\n\n  // Retry clicking until hydration succeeds\n  // This handles the case where SSR renders the button before React hydrates\n  await expect(async () => {\n    // Click the button to trigger hydration verification\n    await button.click()\n\n    // Check if the status changed to 'hydrated'\n    await expect(status).toHaveText('hydrated', { timeout: 100 })\n  }).toPass({ timeout })\n}\n\nexport interface StreamingSsrOptions {\n  /**\n   * List of error message patterns to ignore in console output.\n   */\n  whitelistErrors: Array<RegExp | string>\n}\n\n/**\n * Base test fixture for streaming-ssr e2e tests.\n * Provides console error monitoring.\n */\nexport const test = base.extend<StreamingSsrOptions>({\n  whitelistErrors: [[], { option: true }],\n\n  page: async ({ page, whitelistErrors }, use) => {\n    const errorMessages: Array<string> = []\n\n    page.on('console', (m) => {\n      if (m.type() === 'error') {\n        const text = m.text()\n        for (const whitelistError of whitelistErrors) {\n          if (\n            (typeof whitelistError === 'string' &&\n              text.includes(whitelistError)) ||\n            (whitelistError instanceof RegExp && whitelistError.test(text))\n          ) {\n            return\n          }\n        }\n        errorMessages.push(text)\n      }\n    })\n\n    await use(page)\n\n    // Assert no unexpected console errors\n    expect(errorMessages).toEqual([])\n  },\n})\n\n/**\n * Extended test fixture that automatically verifies hydration at the end.\n * Use this for tests where you want to confirm React hydration succeeded.\n */\nexport const testWithHydration = test.extend({\n  page: async ({ page }, use) => {\n    await use(page)\n\n    // Automatically verify hydration at the end of the test\n    await verifyHydration(page)\n  },\n})\n\n// Re-export expect for convenience\nexport { expect }\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/home.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Home page', () => {\n  testWithHydration(\n    'renders index page with all navigation links',\n    async ({ page }) => {\n      await page.goto('/')\n      await page.waitForLoadState('networkidle')\n\n      await expect(page.getByTestId('index-title')).toContainText(\n        'Streaming SSR Test Scenarios',\n      )\n      // Check links exist (they're in the nav and the body)\n      await expect(\n        page.getByRole('link', { name: 'Deferred' }).first(),\n      ).toBeVisible()\n      await expect(\n        page.getByRole('link', { name: 'Stream' }).first(),\n      ).toBeVisible()\n    },\n  )\n\n  testWithHydration(\n    'navigation from home to routes works',\n    async ({ page }) => {\n      await page.goto('/')\n      await page.waitForLoadState('networkidle')\n\n      // Use the link in the content (not nav)\n      await page.getByTestId('link-deferred').click()\n      await expect(page).toHaveURL('/deferred')\n    },\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/many-promises.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Many promises streaming (15 deferred)', () => {\n  test('all 15 promises eventually resolve', async ({ page }) => {\n    await page.goto('/many-promises')\n\n    // Immediate group (0-20ms)\n    await expect(page.getByTestId('immediate-1')).toContainText('immediate-1', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('immediate-2')).toContainText('immediate-2', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('immediate-3')).toContainText('immediate-3', {\n      timeout: 5000,\n    })\n\n    // Fast group (50-125ms)\n    await expect(page.getByTestId('fast-1')).toContainText('fast-1', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('fast-2')).toContainText('fast-2', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('fast-3')).toContainText('fast-3', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('fast-4')).toContainText('fast-4', {\n      timeout: 5000,\n    })\n\n    // Medium group (150-250ms)\n    await expect(page.getByTestId('medium-1')).toContainText('medium-1', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('medium-2')).toContainText('medium-2', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('medium-3')).toContainText('medium-3', {\n      timeout: 5000,\n    })\n\n    // Slow group (300-500ms)\n    await expect(page.getByTestId('slow-1')).toContainText('slow-1', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('slow-2')).toContainText('slow-2', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('slow-3')).toContainText('slow-3', {\n      timeout: 5000,\n    })\n\n    // Very slow group (600-800ms)\n    await expect(page.getByTestId('very-slow-1')).toContainText('very-slow-1', {\n      timeout: 5000,\n    })\n    await expect(page.getByTestId('very-slow-2')).toContainText('very-slow-2', {\n      timeout: 5000,\n    })\n  })\n\n  testWithHydration('hydration works with many promises', async ({ page }) => {\n    await page.goto('/many-promises')\n    await page.waitForLoadState('networkidle')\n\n    // Wait for all promises to resolve\n    await expect(page.getByTestId('very-slow-2')).toBeVisible({ timeout: 5000 })\n  })\n\n  test('client-side navigation works', async ({ page }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Navigate via nav link\n    await page.getByRole('link', { name: 'Many Promises' }).click()\n    await expect(page).toHaveURL('/many-promises')\n\n    // All promises should eventually resolve\n    await expect(page.getByTestId('very-slow-2')).toBeVisible({ timeout: 5000 })\n  })\n\n  test('fast promises resolve before slow ones', async ({ page }) => {\n    // Navigate and check ordering - faster promises should be visible first\n    await page.goto('/many-promises', { waitUntil: 'commit' })\n\n    // Immediate promises should appear first\n    await expect(page.getByTestId('immediate-1')).toBeVisible({ timeout: 2000 })\n\n    // By the time we check very-slow, all should be visible\n    await expect(page.getByTestId('very-slow-2')).toBeVisible({ timeout: 5000 })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/nested-deferred.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Nested deferred (multiple levels of deferred data)', () => {\n  test('all levels of deferred data eventually resolve', async ({ page }) => {\n    await page.goto('/nested-deferred')\n\n    // Plain deferred should resolve first (300ms)\n    await expect(page.getByTestId('plain-deferred')).toContainText(\n      'Plain deferred resolved!',\n      { timeout: 5000 },\n    )\n\n    // Level 1 should resolve (200ms)\n    await expect(page.getByTestId('level1-data')).toContainText('Level 1:', {\n      timeout: 5000,\n    })\n\n    // Level 2 should resolve (400ms)\n    await expect(page.getByTestId('level2-data')).toContainText('Level 2:', {\n      timeout: 5000,\n    })\n\n    // Level 3 should resolve (600ms)\n    await expect(page.getByTestId('level3-data')).toContainText('Level 3:', {\n      timeout: 5000,\n    })\n  })\n\n  test('shows loading states while data is loading', async ({ page }) => {\n    // Use fast navigation to catch loading states\n    await page.goto('/nested-deferred', { waitUntil: 'commit' })\n\n    // Eventually all data should be visible\n    await expect(page.getByTestId('level3-data')).toBeVisible({\n      timeout: 10000,\n    })\n  })\n\n  testWithHydration(\n    'hydration works with nested deferred',\n    async ({ page }) => {\n      await page.goto('/nested-deferred')\n      await page.waitForLoadState('networkidle')\n\n      // Wait for all data\n      await expect(page.getByTestId('level3-data')).toBeVisible({\n        timeout: 10000,\n      })\n    },\n  )\n\n  test('client-side navigation works', async ({ page }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Navigate via nav link\n    await page.getByRole('link', { name: 'Nested Deferred' }).first().click()\n    await expect(page).toHaveURL('/nested-deferred')\n\n    // All levels should eventually render\n    await expect(page.getByTestId('level3-data')).toBeVisible({\n      timeout: 10000,\n    })\n  })\n\n  test('data resolves in expected order (fastest first)', async ({ page }) => {\n    await page.goto('/nested-deferred')\n\n    // Wait for all to be visible\n    await expect(page.getByTestId('level1-data')).toBeVisible({ timeout: 5000 })\n    await expect(page.getByTestId('level2-data')).toBeVisible({ timeout: 5000 })\n    await expect(page.getByTestId('level3-data')).toBeVisible({ timeout: 5000 })\n    await expect(page.getByTestId('plain-deferred')).toBeVisible({\n      timeout: 5000,\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/query-heavy.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Query heavy route (9 useSuspenseQuery)', () => {\n  test('all queries resolve with server data', async ({ page }) => {\n    await page.goto('/query-heavy')\n\n    // Sync queries should show server source\n    await expect(page.getByTestId('sync-query-1')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('sync-query-2')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('sync-query-3')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n\n    // Fast async queries should show server source\n    await expect(page.getByTestId('fast-async-query-1')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('fast-async-query-2')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('fast-async-query-3')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n\n    // Slow async queries should show server source\n    await expect(page.getByTestId('slow-async-query-1')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('slow-async-query-2')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('slow-async-query-3')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n  })\n\n  test('sync queries have correct values', async ({ page }) => {\n    await page.goto('/query-heavy')\n\n    await expect(page.getByTestId('sync-query-1')).toContainText('sync-value-1')\n    await expect(page.getByTestId('sync-query-2')).toContainText('sync-value-2')\n    await expect(page.getByTestId('sync-query-3')).toContainText('sync-value-3')\n  })\n\n  test('async queries have correct values', async ({ page }) => {\n    await page.goto('/query-heavy')\n\n    await expect(page.getByTestId('fast-async-query-1')).toContainText(\n      'fast-async-1',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('fast-async-query-2')).toContainText(\n      'fast-async-2',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('fast-async-query-3')).toContainText(\n      'fast-async-3',\n      { timeout: 5000 },\n    )\n\n    await expect(page.getByTestId('slow-async-query-1')).toContainText(\n      'slow-async-1',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('slow-async-query-2')).toContainText(\n      'slow-async-2',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('slow-async-query-3')).toContainText(\n      'slow-async-3',\n      { timeout: 5000 },\n    )\n  })\n\n  testWithHydration('hydration works with many queries', async ({ page }) => {\n    await page.goto('/query-heavy')\n    await page.waitForLoadState('networkidle')\n\n    // Wait for all queries to resolve\n    await expect(page.getByTestId('slow-async-query-3')).toBeVisible({\n      timeout: 5000,\n    })\n  })\n\n  test('client-side navigation works', async ({ page }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Navigate via nav link\n    await page.getByRole('link', { name: 'Query Heavy' }).click()\n    await expect(page).toHaveURL('/query-heavy')\n\n    // All queries should eventually resolve (on client)\n    await expect(page.getByTestId('slow-async-query-3')).toBeVisible({\n      timeout: 5000,\n    })\n  })\n\n  test('no hydration mismatch - queries streamed from server', async ({\n    page,\n  }) => {\n    // This test verifies that query data is streamed from server\n    // If it wasn't, the queries would re-execute on client and show 'client' as source\n    await page.goto('/query-heavy')\n\n    // Wait for all queries\n    await expect(page.getByTestId('slow-async-query-3')).toBeVisible({\n      timeout: 5000,\n    })\n\n    // Verify all show 'server' - this proves data was streamed, not re-fetched\n    const serverSourceCount = await page\n      .locator('[data-testid*=\"query-\"]')\n      .filter({ hasText: 'source: server' })\n      .count()\n    expect(serverSourceCount).toBe(9)\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/slow-render.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('Slow render (render takes longer than serialization)', () => {\n  test('all data eventually renders with server source', async ({ page }) => {\n    await page.goto('/slow-render')\n    await page.waitForLoadState('networkidle')\n\n    // Quick data should be available with server source\n    await expect(page.getByTestId('quick-data')).toContainText('Quick:')\n    await expect(page.getByTestId('quick-source')).toContainText(\n      'Quick data source: server',\n    )\n    await expect(page.getByTestId('loader-source')).toContainText(\n      'Loader source: server',\n    )\n\n    // Deferred data should resolve with server source\n    await expect(page.getByTestId('deferred-resolved')).toContainText(\n      'Deferred resolved!',\n      { timeout: 5000 },\n    )\n    await expect(page.getByTestId('deferred-resolved')).toContainText(\n      'source: server',\n      { timeout: 5000 },\n    )\n\n    // Slow components should have rendered\n    await expect(page.getByTestId('slow-component-1')).toBeVisible()\n    await expect(page.getByTestId('slow-component-2')).toBeVisible()\n    await expect(page.getByTestId('slow-component-3')).toBeVisible()\n  })\n\n  testWithHydration('hydration works after slow render', async ({ page }) => {\n    await page.goto('/slow-render')\n    await page.waitForLoadState('networkidle')\n\n    // Wait for content and verify server source\n    await expect(page.getByTestId('slow-component-1')).toBeVisible()\n    await expect(page.getByTestId('loader-source')).toContainText(\n      'Loader source: server',\n    )\n  })\n\n  test('client-side navigation works', async ({ page }) => {\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Navigate via nav link\n    await page.getByRole('link', { name: 'Slow Render' }).first().click()\n    await expect(page).toHaveURL('/slow-render')\n\n    await expect(page.getByTestId('quick-data')).toBeVisible({ timeout: 10000 })\n  })\n\n  test('all data sources are server - proves SSR streaming works', async ({\n    page,\n  }) => {\n    await page.goto('/slow-render')\n    await page.waitForLoadState('networkidle')\n\n    // Wait for deferred content\n    await expect(page.getByTestId('deferred-resolved')).toBeVisible({\n      timeout: 5000,\n    })\n\n    // Verify all sources are server\n    await expect(page.getByTestId('quick-source')).toContainText('server')\n    await expect(page.getByTestId('loader-source')).toContainText('server')\n    await expect(page.getByTestId('deferred-resolved')).toContainText(\n      'source: server',\n    )\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/stream.spec.ts",
    "content": "import { expect, test, testWithHydration } from './fixtures'\n\ntest.describe('ReadableStream streaming', () => {\n  testWithHydration('promise data resolves correctly', async ({ page }) => {\n    await page.goto('/stream')\n\n    // Promise should resolve\n    await expect(page.getByTestId('promise-data')).toContainText(\n      'promise-resolved',\n      { timeout: 5000 },\n    )\n  })\n\n  testWithHydration('stream chunks arrive incrementally', async ({ page }) => {\n    await page.goto('/stream')\n\n    // Wait for stream to complete\n    await expect(page.getByTestId('stream-complete')).toBeVisible({\n      timeout: 10000,\n    })\n\n    // All chunks should be present\n    await expect(page.getByTestId('stream-chunk-0')).toContainText('chunk-0')\n    await expect(page.getByTestId('stream-chunk-1')).toContainText('chunk-1')\n    await expect(page.getByTestId('stream-chunk-2')).toContainText('chunk-2')\n    await expect(page.getByTestId('stream-chunk-3')).toContainText('chunk-3')\n    await expect(page.getByTestId('stream-chunk-4')).toContainText('chunk-4')\n  })\n\n  testWithHydration(\n    'client-side navigation to stream route works',\n    async ({ page }) => {\n      await page.goto('/')\n      await page.waitForLoadState('networkidle')\n\n      // Navigate via nav link\n      await page.getByRole('link', { name: 'Stream' }).first().click()\n      await expect(page).toHaveURL('/stream')\n\n      // Wait for stream to complete\n      await expect(page.getByTestId('stream-complete')).toBeVisible({\n        timeout: 10000,\n      })\n    },\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tests/sync-only.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test, testWithHydration } from './fixtures'\n\n/**\n * Tests for synchronous serialization - no deferred data, no streaming.\n * This is the most common case where all loader data is immediately available.\n * The hydration scripts should be included in the initial HTML response.\n */\n\ntest('Sync-only route renders with loader data', async ({ page }) => {\n  await page.goto('/sync-only')\n\n  // Verify the page content is rendered\n  await expect(page.getByTestId('sync-title')).toContainText(\n    'Synchronous Serialization Test',\n  )\n  await expect(page.getByTestId('sync-message')).toContainText(\n    'Hello from sync loader!',\n  )\n\n  // Verify loader data items are rendered\n  await expect(page.getByTestId('sync-item-item-1')).toBeVisible()\n  await expect(page.getByTestId('sync-item-item-2')).toBeVisible()\n  await expect(page.getByTestId('sync-item-item-3')).toBeVisible()\n\n  // Verify data came from server (proves SSR streaming worked)\n  await expect(page.getByTestId('sync-source')).toContainText('Source: server')\n})\n\ntestWithHydration('Sync-only route hydrates correctly', async ({ page }) => {\n  await page.goto('/sync-only')\n\n  // Verify client-side navigation works (proves hydration succeeded)\n  await page.getByRole('navigation').getByRole('link', { name: 'Home' }).click()\n  await expect(page.getByTestId('index-title')).toBeVisible()\n\n  // Navigate back to sync-only via client-side navigation (use nav link to be specific)\n  await page\n    .getByRole('navigation')\n    .getByRole('link', { name: 'Sync Only' })\n    .click()\n  await expect(page.getByTestId('sync-title')).toBeVisible()\n})\n\ntest('Sync-only route has bootstrap scripts in initial HTML', async ({\n  page,\n}) => {\n  // Intercept the response to check the raw HTML\n  let responseHtml = ''\n  await page.route('/sync-only', async (route) => {\n    const response = await route.fetch()\n    responseHtml = await response.text()\n    await route.fulfill({ response })\n  })\n\n  await page.goto('/sync-only')\n\n  // Wait for page to load\n  await expect(page.getByTestId('sync-title')).toBeVisible()\n\n  // The HTML should contain the bootstrap scripts\n  // $_TSR.router should be present (the dehydrated router state)\n  expect(responseHtml).toContain('$_TSR')\n  expect(responseHtml).toContain('$_TSR.router')\n  // The serialization end marker should be present\n  expect(responseHtml).toContain('$_TSR.e()')\n\n  // SSR should include the barrier script tag in the HTML (rendered by <Scripts />)\n  // This is the critical marker transformStreamWithRouter can scan for.\n  expect(responseHtml).toContain('$tsr-stream-barrier')\n})\n\ntest('Navigating to sync-only from home page', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByTestId('link-sync-only').click()\n\n  await expect(page.getByTestId('sync-title')).toContainText(\n    'Synchronous Serialization Test',\n  )\n  await expect(page.getByTestId('sync-message')).toContainText(\n    'Hello from sync loader!',\n  )\n})\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/app/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/streaming-ssr/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [tanstackStart()],\n})\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-transform-asset-urls\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"manual:cdn\": \"CDN_PORT=3002 node tests/cdn-server.mjs\",\n    \"manual:app\": \"pnpm build && PORT=3000 CDN_ORIGIN=http://localhost:3002 pnpm start\",\n    \"manual:both\": \"sh -c \\\"CDN_PORT=3002 node tests/cdn-server.mjs & pnpm build && PORT=3000 CDN_ORIGIN=http://localhost:3002 pnpm start\\\"\",\n    \"manual:both:string\": \"TRANSFORM_ASSET_URLS_MODE=string pnpm manual:both\",\n    \"manual:both:function\": \"TRANSFORM_ASSET_URLS_MODE=function pnpm manual:both\",\n    \"manual:both:options\": \"TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=createTransform pnpm manual:both\",\n    \"manual:both:options:transform\": \"TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=transform pnpm manual:both\",\n    \"manual:both:options:createTransform\": \"TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=createTransform pnpm manual:both\",\n    \"test:e2e:string\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=string playwright test --project=chromium\",\n    \"test:e2e:function\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=function playwright test --project=chromium\",\n    \"test:e2e:options\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=transform playwright test --project=chromium\",\n    \"test:e2e:options:transform\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=transform playwright test --project=chromium\",\n    \"test:e2e:options:createTransform\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=createTransform playwright test --project=chromium\",\n    \"test:e2e:options:transform:cache-true:warmup-true\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=transform TRANSFORM_ASSET_URLS_OPTIONS_CACHE=true TRANSFORM_ASSET_URLS_OPTIONS_WARMUP=true playwright test --project=chromium\",\n    \"test:e2e:options:transform:cache-true:warmup-false\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=transform TRANSFORM_ASSET_URLS_OPTIONS_CACHE=true TRANSFORM_ASSET_URLS_OPTIONS_WARMUP=false playwright test --project=chromium\",\n    \"test:e2e:options:transform:cache-false:warmup-true\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=transform TRANSFORM_ASSET_URLS_OPTIONS_CACHE=false TRANSFORM_ASSET_URLS_OPTIONS_WARMUP=true playwright test --project=chromium\",\n    \"test:e2e:options:transform:cache-false:warmup-false\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=transform TRANSFORM_ASSET_URLS_OPTIONS_CACHE=false TRANSFORM_ASSET_URLS_OPTIONS_WARMUP=false playwright test --project=chromium\",\n    \"test:e2e:options:createTransform:cache-true:warmup-true\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=createTransform TRANSFORM_ASSET_URLS_OPTIONS_CACHE=true TRANSFORM_ASSET_URLS_OPTIONS_WARMUP=true playwright test --project=chromium\",\n    \"test:e2e:options:createTransform:cache-true:warmup-false\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=createTransform TRANSFORM_ASSET_URLS_OPTIONS_CACHE=true TRANSFORM_ASSET_URLS_OPTIONS_WARMUP=false playwright test --project=chromium\",\n    \"test:e2e:options:createTransform:cache-false:warmup-true\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=createTransform TRANSFORM_ASSET_URLS_OPTIONS_CACHE=false TRANSFORM_ASSET_URLS_OPTIONS_WARMUP=true playwright test --project=chromium\",\n    \"test:e2e:options:createTransform:cache-false:warmup-false\": \"rm -rf dist; rm -rf port*.txt; TRANSFORM_ASSET_URLS_MODE=options TRANSFORM_ASSET_URLS_OPTIONS_KIND=createTransform TRANSFORM_ASSET_URLS_OPTIONS_CACHE=false TRANSFORM_ASSET_URLS_OPTIONS_WARMUP=false playwright test --project=chromium\",\n    \"test:e2e:options:matrix\": \"pnpm test:e2e:options:transform:cache-true:warmup-true && pnpm test:e2e:options:transform:cache-true:warmup-false && pnpm test:e2e:options:transform:cache-false:warmup-true && pnpm test:e2e:options:transform:cache-false:warmup-false && pnpm test:e2e:options:createTransform:cache-true:warmup-true && pnpm test:e2e:options:createTransform:cache-true:warmup-false && pnpm test:e2e:options:createTransform:cache-false:warmup-true && pnpm test:e2e:options:createTransform:cache-false:warmup-false\",\n    \"test:e2e\": \"pnpm test:e2e:string && pnpm test:e2e:function && pnpm test:e2e:options:matrix\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"express\": \"^5.1.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst APP_PORT = await getTestServerPort(packageJson.name)\nconst CDN_PORT = await getTestServerPort(`${packageJson.name}_cdn`)\n\nconst baseURL = `http://localhost:${APP_PORT}`\nconst cdnOrigin = `http://localhost:${CDN_PORT}`\nconst transformMode = process.env.TRANSFORM_ASSET_URLS_MODE || 'string'\nconst optionsKind =\n  process.env.TRANSFORM_ASSET_URLS_OPTIONS_KIND || 'createTransform'\nconst optionsCache = process.env.TRANSFORM_ASSET_URLS_OPTIONS_CACHE || 'true'\nconst optionsWarmup = process.env.TRANSFORM_ASSET_URLS_OPTIONS_WARMUP || 'true'\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  use: {\n    baseURL,\n  },\n\n  webServer: [\n    {\n      // CDN server — serves built client assets on a separate port with CORS\n      command: `node tests/cdn-server.mjs`,\n      url: `http://localhost:${CDN_PORT}/health`,\n      reuseExistingServer: !process.env.CI,\n      stdout: 'pipe',\n      env: {\n        CDN_PORT: String(CDN_PORT),\n      },\n    },\n    {\n      // App server — builds the project then starts the srvx server\n      // with CDN_ORIGIN so that transformAssetUrls rewrites manifest URLs\n      command: `pnpm build && pnpm start`,\n      url: baseURL,\n      reuseExistingServer: !process.env.CI,\n      stdout: 'pipe',\n      env: {\n        PORT: String(APP_PORT),\n        CDN_ORIGIN: cdnOrigin,\n        TRANSFORM_ASSET_URLS_MODE: transformMode,\n        TRANSFORM_ASSET_URLS_OPTIONS_KIND: optionsKind,\n        TRANSFORM_ASSET_URLS_OPTIONS_CACHE: optionsCache,\n        TRANSFORM_ASSET_URLS_OPTIONS_WARMUP: optionsWarmup,\n      },\n      timeout: 120_000,\n    },\n  ],\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\n\nimport '~/styles/app.css'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"app-styled\">\n          <Outlet />\n        </div>\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/src/routes/about.module.css",
    "content": ".aboutCard {\n  background-color: #fff3c4;\n  border: 1px solid #e6d38b;\n  border-left: 6px solid #111;\n  padding: 12px 14px;\n}\n\n.title {\n  margin: 0 0 6px;\n}\n\n.content {\n  margin: 0;\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport styles from './about.module.css'\n\nexport const Route = createFileRoute('/about')({\n  component: About,\n})\n\nfunction About() {\n  return (\n    <div data-testid=\"about-card\" className={styles.aboutCard}>\n      <h1 data-testid=\"about-heading\" className={styles.title}>\n        About\n      </h1>\n      <p data-testid=\"about-content\" className={styles.content}>\n        This route is loaded on client navigation.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div>\n      <h1 data-testid=\"home-heading\">Welcome Home</h1>\n      <p data-testid=\"home-content\">\n        This page tests the transformAssetUrls feature.\n      </p>\n      <Link to=\"/about\" data-testid=\"link-to-about\">\n        About\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/src/server.ts",
    "content": "import {\n  createStartHandler,\n  defaultStreamHandler,\n} from '@tanstack/react-start/server'\nimport { createServerEntry } from '@tanstack/react-start/server-entry'\n\nconst cdnOrigin = process.env.CDN_ORIGIN\nconst transformMode = process.env.TRANSFORM_ASSET_URLS_MODE || 'string'\nconst optionsKind =\n  process.env.TRANSFORM_ASSET_URLS_OPTIONS_KIND || 'createTransform'\nconst optionsCache = process.env.TRANSFORM_ASSET_URLS_OPTIONS_CACHE || 'true'\nconst optionsWarmup = process.env.TRANSFORM_ASSET_URLS_OPTIONS_WARMUP || 'true'\n\nconst cache = optionsCache !== 'false'\nconst warmup = optionsWarmup === 'true'\n\nconsole.log(\n  `[server-entry]: using custom server entry with transformAssetUrls (${transformMode}${transformMode === 'options' ? `:${optionsKind}` : ''})${cdnOrigin ? ` (CDN: ${cdnOrigin})` : ' (no CDN)'}`,\n)\n\nconst handler = createStartHandler(\n  cdnOrigin\n    ? {\n        handler: defaultStreamHandler,\n        transformAssetUrls: (() => {\n          const cdn = cdnOrigin.replace(/\\/+$/, '')\n\n          if (transformMode === 'function') {\n            return ({ url }: { url: string }) => `${cdn}${url}`\n          }\n\n          if (transformMode === 'options') {\n            if (optionsKind === 'transform') {\n              return {\n                transform: ({ url }: { url: string }) => `${cdn}${url}`,\n                cache,\n                warmup,\n              }\n            }\n\n            return {\n              createTransform: async () => {\n                return ({ url }: { url: string }) => `${cdn}${url}`\n              },\n              cache,\n              warmup,\n            }\n          }\n\n          return cdn\n        })(),\n      }\n    : defaultStreamHandler,\n)\n\nexport default createServerEntry({ fetch: handler })\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/src/styles/app.css",
    "content": "body {\n  font-family: sans-serif;\n  margin: 0;\n  padding: 0;\n}\n\n.app-styled {\n  color: #333;\n  background-color: #f0f0f0;\n  padding: 16px;\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/tests/cdn-server.mjs",
    "content": "import express from 'express'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url))\nconst port = process.env.CDN_PORT || 3002\n\nconst app = express()\n\n// Health check endpoint for Playwright webServer readiness.\n// This should return 200 even before the client build exists.\napp.get('/health', (_req, res) => {\n  res.status(200).send('ok')\n})\n\n// Serve the built client assets with CORS headers to simulate a CDN\napp.use((req, res, next) => {\n  res.setHeader('Access-Control-Allow-Origin', '*')\n  res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS')\n  res.setHeader('Access-Control-Allow-Headers', '*')\n  next()\n})\n\napp.use(express.static(path.resolve(__dirname, '..', 'dist', 'client')))\n\napp.listen(port, () => {\n  console.info(`CDN Server: http://localhost:${port}`)\n})\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/tests/transform-asset-urls.spec.ts",
    "content": "import { expect, type Page } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\n/**\n * Helper: fetch the SSR HTML for the given path using Playwright's\n * APIRequestContext (no navigation/interception needed).\n */\nasync function getSSRHtml(page: Page, path = '/') {\n  const response = await page.request.get(path, {\n    headers: {\n      Accept: 'text/html',\n    },\n  })\n\n  expect(response.ok()).toBeTruthy()\n  const contentType = response.headers()['content-type'] || ''\n  expect(contentType).toContain('text/html')\n\n  return response.text()\n}\n\ntest.describe('transformAssetUrls with CDN prefix', () => {\n  test('test run mode is set (string|function|options)', async () => {\n    expect(process.env.TRANSFORM_ASSET_URLS_MODE).toMatch(\n      /^(string|function|options)$/,\n    )\n\n    if (process.env.TRANSFORM_ASSET_URLS_MODE === 'options') {\n      expect(process.env.TRANSFORM_ASSET_URLS_OPTIONS_KIND).toMatch(\n        /^(transform|createTransform)$/,\n      )\n\n      expect(process.env.TRANSFORM_ASSET_URLS_OPTIONS_CACHE).toMatch(\n        /^(true|false)$/,\n      )\n      expect(process.env.TRANSFORM_ASSET_URLS_OPTIONS_WARMUP).toMatch(\n        /^(true|false)$/,\n      )\n    }\n  })\n\n  test('SSR HTML contains CDN-prefixed modulepreload links', async ({\n    page,\n  }) => {\n    const html = await getSSRHtml(page)\n\n    // All modulepreload links should point to the CDN origin\n    const modulepreloads = html.match(/rel=\"modulepreload\"[^>]*href=\"([^\"]+)\"/g)\n    expect(modulepreloads).toBeTruthy()\n    expect(modulepreloads!.length).toBeGreaterThan(0)\n\n    for (const match of modulepreloads!) {\n      const href = match.match(/href=\"([^\"]+)\"/)?.[1]\n      expect(href).toBeTruthy()\n      expect(href).toMatch(/^http:\\/\\/localhost:\\d+\\//)\n    }\n  })\n\n  test('SSR HTML contains CDN-prefixed stylesheet link', async ({ page }) => {\n    const html = await getSSRHtml(page)\n\n    // The emitted stylesheet link should be CDN-prefixed\n    const stylesheetLinks = html.match(/rel=\"stylesheet\"[^>]*href=\"([^\"]+)\"/g)\n    expect(stylesheetLinks).toBeTruthy()\n\n    const firstStylesheetLink = stylesheetLinks![0]\n    expect(firstStylesheetLink).toBeTruthy()\n\n    const href = firstStylesheetLink!.match(/href=\"([^\"]+)\"/)?.[1]\n    expect(href).toBeTruthy()\n    expect(href).toMatch(/^http:\\/\\/localhost:\\d+\\//)\n    expect(href).toMatch(/\\.css(\\?|$)/)\n  })\n\n  test('SSR HTML for /about references CSS modules stylesheet and style applies', async ({\n    page,\n  }) => {\n    const html = await getSSRHtml(page, '/about')\n\n    // Ensure the /about route's CSS module chunk is referenced in SSR HTML.\n    // In production builds, Vite emits hashed assets like \"about.<hash>.css\".\n    const stylesheetHrefs = Array.from(\n      html.matchAll(/rel=\"stylesheet\"[^>]*href=\"([^\"]+)\"/g),\n    ).map((m) => m[1])\n\n    expect(stylesheetHrefs.length).toBeGreaterThan(0)\n\n    const aboutCssHrefs = stylesheetHrefs.filter((href) => {\n      if (!/^http:\\/\\/localhost:\\d+\\//.test(href)) return false\n\n      let pathname = ''\n      try {\n        pathname = new URL(href).pathname\n      } catch {\n        return false\n      }\n\n      const filename = pathname.split('/').pop() || ''\n      return filename.startsWith('about') && /\\.css$/.test(filename)\n    })\n\n    expect(aboutCssHrefs.length).toBeGreaterThan(0)\n\n    // Now load /about and verify the CSS module style is actually applied.\n    await page.goto('/about')\n    await expect(page.getByTestId('about-card')).toBeVisible()\n\n    const bgColor = await page\n      .getByTestId('about-card')\n      .evaluate((el) => getComputedStyle(el).backgroundColor)\n\n    // #fff3c4 = rgb(255, 243, 196)\n    expect(bgColor).toBe('rgb(255, 243, 196)')\n  })\n\n  test('SSR HTML contains CDN-prefixed client entry script', async ({\n    page,\n  }) => {\n    const html = await getSSRHtml(page)\n\n    // The client entry script should contain an import() with CDN-prefixed URL\n    // JSON.stringify produces double quotes; bundler optimisation may use single quotes\n    const clientEntryMatch = html.match(\n      /import\\([\"'](http:\\/\\/localhost:\\d+\\/[^\"']+)[\"']\\)/,\n    )\n    expect(clientEntryMatch).toBeTruthy()\n    expect(clientEntryMatch![1]).toMatch(/^http:\\/\\/localhost:\\d+\\//)\n  })\n\n  test('page renders correctly with CDN-served assets', async ({ page }) => {\n    await page.goto('/')\n\n    // Page content renders\n    await expect(page.getByTestId('home-heading')).toHaveText('Welcome Home')\n    await expect(page.getByTestId('home-content')).toContainText(\n      'transformAssetUrls',\n    )\n  })\n\n  test('CSS is applied correctly from CDN', async ({ page }) => {\n    await page.goto('/')\n    await expect(page.locator('.app-styled')).toBeVisible()\n\n    // Verify that the CSS from app.css is actually applied\n    // The .app-styled class sets background-color to #f0f0f0\n    const bgColor = await page\n      .locator('.app-styled')\n      .evaluate((el) => getComputedStyle(el).backgroundColor)\n\n    // #f0f0f0 = rgb(240, 240, 240)\n    expect(bgColor).toBe('rgb(240, 240, 240)')\n  })\n\n  test('browser fetches assets from CDN server', async ({ page }) => {\n    // Track network requests to verify JS/CSS assets are fetched from a\n    // different origin than the app server (i.e. the CDN)\n    const appOrigin = new URL(\n      test.info().project.use.baseURL || 'http://localhost:3000',\n    ).origin\n    const assetRequests: Array<{ url: string; fromCdn: boolean }> = []\n\n    page.on('request', (request) => {\n      const url = request.url()\n      // Look for JS/CSS asset requests\n      if (/\\.(js|css)(\\?|$)/.test(url)) {\n        const origin = new URL(url).origin\n        assetRequests.push({ url, fromCdn: origin !== appOrigin })\n      }\n    })\n\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Verify that at least some asset requests went to a non-app origin (the CDN)\n    const cdnRequests = assetRequests.filter((r) => r.fromCdn)\n    expect(cdnRequests.length).toBeGreaterThan(0)\n  })\n\n  test('client-side navigation to /about loads split chunk from CDN', async ({\n    page,\n  }) => {\n    const appOrigin = new URL(\n      test.info().project.use.baseURL || 'http://localhost:3000',\n    ).origin\n\n    await page.goto('/')\n    await page.waitForLoadState('networkidle')\n\n    // Start tracking network requests after initial page load so we only\n    // capture requests triggered by the client-side navigation\n    const navigationAssetRequests: Array<{\n      url: string\n      fromCdn: boolean\n    }> = []\n\n    page.on('request', (request) => {\n      const url = request.url()\n      if (/\\.(js|css)(\\?|$)/.test(url)) {\n        const origin = new URL(url).origin\n        navigationAssetRequests.push({ url, fromCdn: origin !== appOrigin })\n      }\n    })\n\n    await page.getByTestId('link-to-about').click()\n    await page.waitForURL('**/about')\n    await expect(page.getByTestId('about-heading')).toHaveText('About')\n\n    // Ensure CSS modules were loaded and applied after client navigation\n    await expect(page.getByTestId('about-card')).toBeVisible()\n    const bgColor = await page\n      .getByTestId('about-card')\n      .evaluate((el) => getComputedStyle(el).backgroundColor)\n    expect(bgColor).toBe('rgb(255, 243, 196)')\n\n    // With base: '', lazy-loaded route chunks should come from the CDN, not the app server.\n    // Filter to JS requests only (the route chunk import)\n    const jsRequests = navigationAssetRequests.filter((r) =>\n      /\\.js(\\?|$)/.test(r.url),\n    )\n    expect(jsRequests.length).toBeGreaterThan(0)\n\n    const cdnJsRequests = jsRequests.filter((r) => r.fromCdn)\n    expect(cdnJsRequests.length).toBeGreaterThan(0)\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/transform-asset-urls/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  base: '',\n  server: {\n    port: 3000,\n  },\n  plugins: [tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/virtual-routes/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-virtual-routes\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('layout/second-layout.tsx', [\n      route('route-without-file', [\n        route('/layout-a', 'a.tsx'),\n        route('/layout-b', 'b.tsx'),\n      ]),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n  route('/special|pipe', 'pipe.tsx'),\n])\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as pipeRouteImport } from './routes/pipe'\nimport { Route as postsPostsRouteImport } from './routes/posts/posts'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home'\nimport { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route'\nimport { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index'\nimport { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world'\nimport { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst pipeRoute = pipeRouteImport.update({\n  id: '/special|pipe',\n  path: '/special|pipe',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsRoute = postsPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsDetailRoute = postsPostsDetailRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second-layout',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst postsPostsHomeRoute = postsPostsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({\n  id: '/classic/hello',\n  path: '/classic/hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({\n  id: '/world',\n  path: '/world',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({\n  id: '/universe',\n  path: '/universe',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/route-without-file/layout-b',\n  path: '/route-without-file/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/route-without-file/layout-a',\n  path: '/route-without-file/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsRouteWithChildren\n  '/special|pipe': typeof pipeRoute\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/special|pipe': typeof pipeRoute\n  '/posts': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/posts': typeof postsPostsRouteWithChildren\n  '/special|pipe': typeof pipeRoute\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/_first/_second-layout': typeof layoutSecondLayoutRouteWithChildren\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/_first/_second-layout/route-without-file/layout-a': typeof aRoute\n  '/_first/_second-layout/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/special|pipe'\n    | '/classic/hello'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/special|pipe'\n    | '/posts'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/posts'\n    | '/special|pipe'\n    | '/classic/hello'\n    | '/posts/'\n    | '/_first/_second-layout'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/_first/_second-layout/route-without-file/layout-a'\n    | '/_first/_second-layout/route-without-file/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n  postsPostsRoute: typeof postsPostsRouteWithChildren\n  pipeRoute: typeof pipeRoute\n  ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/special|pipe': {\n      id: '/special|pipe'\n      path: '/special|pipe'\n      fullPath: '/special|pipe'\n      preLoaderRoute: typeof pipeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsPostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsPostsDetailRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/_first/_second-layout': {\n      id: '/_first/_second-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsPostsHomeRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/classic/hello': {\n      id: '/classic/hello'\n      path: '/classic/hello'\n      fullPath: '/classic/hello'\n      preLoaderRoute: typeof ClassicHelloRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/classic/hello/': {\n      id: '/classic/hello/'\n      path: '/'\n      fullPath: '/classic/hello/'\n      preLoaderRoute: typeof ClassicHelloIndexRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/world': {\n      id: '/classic/hello/world'\n      path: '/world'\n      fullPath: '/classic/hello/world'\n      preLoaderRoute: typeof ClassicHelloWorldRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/universe': {\n      id: '/classic/hello/universe'\n      path: '/universe'\n      fullPath: '/classic/hello/universe'\n      preLoaderRoute: typeof ClassicHelloUniverseRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-b': {\n      id: '/_first/_second-layout/route-without-file/layout-b'\n      path: '/route-without-file/layout-b'\n      fullPath: '/route-without-file/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-a': {\n      id: '/_first/_second-layout/route-without-file/layout-a'\n      path: '/route-without-file/layout-a'\n      fullPath: '/route-without-file/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\ninterface postsPostsRouteChildren {\n  postsPostsHomeRoute: typeof postsPostsHomeRoute\n  postsPostsDetailRoute: typeof postsPostsDetailRoute\n}\n\nconst postsPostsRouteChildren: postsPostsRouteChildren = {\n  postsPostsHomeRoute: postsPostsHomeRoute,\n  postsPostsDetailRoute: postsPostsDetailRoute,\n}\n\nconst postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(\n  postsPostsRouteChildren,\n)\n\ninterface ClassicHelloRouteRouteChildren {\n  ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute\n  ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute\n  ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute\n}\n\nconst ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {\n  ClassicHelloUniverseRoute: ClassicHelloUniverseRoute,\n  ClassicHelloWorldRoute: ClassicHelloWorldRoute,\n  ClassicHelloIndexRoute: ClassicHelloIndexRoute,\n}\n\nconst ClassicHelloRouteRouteWithChildren =\n  ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n  postsPostsRoute: postsPostsRouteWithChildren,\n  pipeRoute: pipeRoute,\n  ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute(\n  '/_first/_second-layout/route-without-file/layout-a',\n)({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute(\n  '/_first/_second-layout/route-without-file/layout-b',\n)({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/file-based-subtree/hello/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/classic/hello/')({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/classic/hello')({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/classic/hello/universe')({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/file-based-subtree/hello/world.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/classic/hello/world')({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_first')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_first/_second-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-without-file/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/route-without-file/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/pipe.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/special|pipe')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"special-pipe-route-heading\">Hello \"/special|pipe\"!</div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/posts/posts-detail.tsx",
    "content": "import * as React from 'react'\nimport { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/posts/posts-home.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/posts/posts.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/routes/root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n  head: () => {\n    return {\n      links: [{ rel: 'stylesheet', href: appCss }],\n    }\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg border-b\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/route-without-file/layout-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/classic/hello\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Subtree\n          </Link>{' '}\n          <Link\n            data-testid=\"special-pipe-link\"\n            to=\"/special|pipe\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Pipe\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        {/* Start rendering router matches */}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('body')).toContainText(\"I'm a layout\")\n  await expect(page.locator('body')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/tests/special-characters.spec.ts",
    "content": "import { expect } from '@playwright/test'\n\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.use({\n  whitelistErrors: [\n    /Failed to load resource: the server responded with a status of 404/,\n  ],\n})\ntest.describe('Unicode route rendering', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/')\n    await page.waitForURL('/')\n  })\n\n  test.describe('Special characters in route paths', () => {\n    test('should render route with pipe character in path on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/special|pipe')\n      await page.waitForURL(`${baseURL}/special%7Cpipe`)\n\n      await expect(\n        page.getByTestId('special-pipe-route-heading'),\n      ).toBeInViewport()\n    })\n\n    test('should render route with pipe character in path on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const pipeLink = page.getByTestId('special-pipe-link')\n\n      await pipeLink.click()\n      await page.waitForURL(`${baseURL}/special%7Cpipe`)\n\n      await expect(\n        page.getByTestId('special-pipe-route-heading'),\n      ).toBeInViewport()\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/virtual-routes/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      router: {\n        virtualRouteConfig: './routes.ts',\n      },\n    }),\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/website/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/react-start/website/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\n.tanstack"
  },
  {
    "path": "e2e/react-start/website/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/react-start/website/package.json",
    "content": "{\n  \"name\": \"tanstack-react-start-e2e-website\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/react-router-devtools\": \"workspace:^\",\n    \"@tanstack/react-start\": \"workspace:^\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/website/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/react-start/website/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LibraryRouteImport } from './routes/_library'\nimport { Route as LibraryIndexRouteImport } from './routes/_library.index'\nimport { Route as ProjectIndexRouteImport } from './routes/$project.index'\nimport { Route as LibraryProjectRouteImport } from './routes/_library.$project'\nimport { Route as LibraryProjectVersionIndexRouteImport } from './routes/_library.$project.$version.index'\nimport { Route as ProjectVersionDocsIndexRouteImport } from './routes/$project.$version.docs.index'\nimport { Route as ProjectVersionDocsFrameworkFrameworkRouteImport } from './routes/$project.$version.docs.framework.$framework'\nimport { Route as ProjectVersionDocsFrameworkFrameworkIndexRouteImport } from './routes/$project.$version.docs.framework.$framework.index'\nimport { Route as ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRouteImport } from './routes/$project.$version.docs.framework.$framework.{$}[.]md'\nimport { Route as ProjectVersionDocsFrameworkFrameworkSplatRouteImport } from './routes/$project.$version.docs.framework.$framework.$'\nimport { Route as ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport } from './routes/$project.$version.docs.framework.$framework.examples.$'\n\nconst LibraryRoute = LibraryRouteImport.update({\n  id: '/_library',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LibraryIndexRoute = LibraryIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => LibraryRoute,\n} as any)\nconst ProjectIndexRoute = ProjectIndexRouteImport.update({\n  id: '/$project/',\n  path: '/$project/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LibraryProjectRoute = LibraryProjectRouteImport.update({\n  id: '/$project',\n  path: '/$project',\n  getParentRoute: () => LibraryRoute,\n} as any)\nconst LibraryProjectVersionIndexRoute =\n  LibraryProjectVersionIndexRouteImport.update({\n    id: '/$version/',\n    path: '/$version/',\n    getParentRoute: () => LibraryProjectRoute,\n  } as any)\nconst ProjectVersionDocsIndexRoute = ProjectVersionDocsIndexRouteImport.update({\n  id: '/$project/$version/docs/',\n  path: '/$project/$version/docs/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ProjectVersionDocsFrameworkFrameworkRoute =\n  ProjectVersionDocsFrameworkFrameworkRouteImport.update({\n    id: '/$project/$version/docs/framework/$framework',\n    path: '/$project/$version/docs/framework/$framework',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkIndexRoute =\n  ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute =\n  ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRouteImport.update({\n    id: '/{$}.md',\n    path: '/{$}.md',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkSplatRoute =\n  ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({\n    id: '/$',\n    path: '/$',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute =\n  ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({\n    id: '/examples/$',\n    path: '/examples/$',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof LibraryIndexRoute\n  '/$project': typeof LibraryProjectRouteWithChildren\n  '/$project/': typeof ProjectIndexRoute\n  '/$project/$version/docs/': typeof ProjectVersionDocsIndexRoute\n  '/$project/$version/': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework/{$}.md': typeof ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute\n  '/$project/$version/docs/framework/$framework/': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRoutesByTo {\n  '/$project': typeof ProjectIndexRoute\n  '/': typeof LibraryIndexRoute\n  '/$project/$version/docs': typeof ProjectVersionDocsIndexRoute\n  '/$project/$version': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework/{$}.md': typeof ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/_library': typeof LibraryRouteWithChildren\n  '/_library/$project': typeof LibraryProjectRouteWithChildren\n  '/$project/': typeof ProjectIndexRoute\n  '/_library/': typeof LibraryIndexRoute\n  '/$project/$version/docs/': typeof ProjectVersionDocsIndexRoute\n  '/_library/$project/$version/': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework/{$}.md': typeof ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute\n  '/$project/$version/docs/framework/$framework/': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/$project'\n    | '/$project/'\n    | '/$project/$version/docs/'\n    | '/$project/$version/'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework/{$}.md'\n    | '/$project/$version/docs/framework/$framework/'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/$project'\n    | '/'\n    | '/$project/$version/docs'\n    | '/$project/$version'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework/{$}.md'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  id:\n    | '__root__'\n    | '/_library'\n    | '/_library/$project'\n    | '/$project/'\n    | '/_library/'\n    | '/$project/$version/docs/'\n    | '/_library/$project/$version/'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework/{$}.md'\n    | '/$project/$version/docs/framework/$framework/'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  LibraryRoute: typeof LibraryRouteWithChildren\n  ProjectIndexRoute: typeof ProjectIndexRoute\n  ProjectVersionDocsIndexRoute: typeof ProjectVersionDocsIndexRoute\n  ProjectVersionDocsFrameworkFrameworkRoute: typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_library': {\n      id: '/_library'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LibraryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_library/': {\n      id: '/_library/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof LibraryIndexRouteImport\n      parentRoute: typeof LibraryRoute\n    }\n    '/$project/': {\n      id: '/$project/'\n      path: '/$project'\n      fullPath: '/$project/'\n      preLoaderRoute: typeof ProjectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_library/$project': {\n      id: '/_library/$project'\n      path: '/$project'\n      fullPath: '/$project'\n      preLoaderRoute: typeof LibraryProjectRouteImport\n      parentRoute: typeof LibraryRoute\n    }\n    '/_library/$project/$version/': {\n      id: '/_library/$project/$version/'\n      path: '/$version'\n      fullPath: '/$project/$version/'\n      preLoaderRoute: typeof LibraryProjectVersionIndexRouteImport\n      parentRoute: typeof LibraryProjectRoute\n    }\n    '/$project/$version/docs/': {\n      id: '/$project/$version/docs/'\n      path: '/$project/$version/docs'\n      fullPath: '/$project/$version/docs/'\n      preLoaderRoute: typeof ProjectVersionDocsIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$project/$version/docs/framework/$framework': {\n      id: '/$project/$version/docs/framework/$framework'\n      path: '/$project/$version/docs/framework/$framework'\n      fullPath: '/$project/$version/docs/framework/$framework'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$project/$version/docs/framework/$framework/': {\n      id: '/$project/$version/docs/framework/$framework/'\n      path: '/'\n      fullPath: '/$project/$version/docs/framework/$framework/'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkIndexRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n    '/$project/$version/docs/framework/$framework/{$}.md': {\n      id: '/$project/$version/docs/framework/$framework/{$}.md'\n      path: '/{$}.md'\n      fullPath: '/$project/$version/docs/framework/$framework/{$}.md'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n    '/$project/$version/docs/framework/$framework/$': {\n      id: '/$project/$version/docs/framework/$framework/$'\n      path: '/$'\n      fullPath: '/$project/$version/docs/framework/$framework/$'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n    '/$project/$version/docs/framework/$framework/examples/$': {\n      id: '/$project/$version/docs/framework/$framework/examples/$'\n      path: '/examples/$'\n      fullPath: '/$project/$version/docs/framework/$framework/examples/$'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n  }\n}\n\ninterface LibraryProjectRouteChildren {\n  LibraryProjectVersionIndexRoute: typeof LibraryProjectVersionIndexRoute\n}\n\nconst LibraryProjectRouteChildren: LibraryProjectRouteChildren = {\n  LibraryProjectVersionIndexRoute: LibraryProjectVersionIndexRoute,\n}\n\nconst LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(\n  LibraryProjectRouteChildren,\n)\n\ninterface LibraryRouteChildren {\n  LibraryProjectRoute: typeof LibraryProjectRouteWithChildren\n  LibraryIndexRoute: typeof LibraryIndexRoute\n}\n\nconst LibraryRouteChildren: LibraryRouteChildren = {\n  LibraryProjectRoute: LibraryProjectRouteWithChildren,\n  LibraryIndexRoute: LibraryIndexRoute,\n}\n\nconst LibraryRouteWithChildren =\n  LibraryRoute._addFileChildren(LibraryRouteChildren)\n\ninterface ProjectVersionDocsFrameworkFrameworkRouteChildren {\n  ProjectVersionDocsFrameworkFrameworkSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute: typeof ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute\n  ProjectVersionDocsFrameworkFrameworkIndexRoute: typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\n\nconst ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren =\n  {\n    ProjectVersionDocsFrameworkFrameworkSplatRoute:\n      ProjectVersionDocsFrameworkFrameworkSplatRoute,\n    ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute:\n      ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute,\n    ProjectVersionDocsFrameworkFrameworkIndexRoute:\n      ProjectVersionDocsFrameworkFrameworkIndexRoute,\n    ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute:\n      ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,\n  }\n\nconst ProjectVersionDocsFrameworkFrameworkRouteWithChildren =\n  ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(\n    ProjectVersionDocsFrameworkFrameworkRouteChildren,\n  )\n\nconst rootRouteChildren: RootRouteChildren = {\n  LibraryRoute: LibraryRouteWithChildren,\n  ProjectIndexRoute: ProjectIndexRoute,\n  ProjectVersionDocsIndexRoute: ProjectVersionDocsIndexRoute,\n  ProjectVersionDocsFrameworkFrameworkRoute:\n    ProjectVersionDocsFrameworkFrameworkRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultStaleTime: 5000,\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/$project.$version.docs.framework.$framework.$.tsx",
    "content": "import {\n  ErrorComponent,\n  useLocation,\n  createFileRoute,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound'\nimport { getDocument } from '~/server/document'\nimport { capitalize, seo } from '~/utils/seo'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/$',\n)({\n  loader: ({ params: { _splat } }) =>\n    getDocument({\n      data: _splat!,\n    }),\n  head: ({ loaderData, params }) => ({\n    meta: seo({\n      title: `${loaderData?.title || 'Project'} | TanStack ${capitalize(params.project)} ${capitalize(params.framework)}`,\n    }),\n  }),\n  errorComponent: PostErrorComponent,\n  component: Page,\n  notFoundComponent: () => {\n    return <NotFound>Document not found</NotFound>\n  },\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction Page() {\n  const pathname = useLocation({ select: (s) => s.pathname })\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4\n        data-testid=\"selected-doc-heading\"\n        className=\"text-xl font-bold underline\"\n      >\n        {post.title}\n      </h4>\n      <div className=\"text-sm\">{post.content}</div>\n      <p className=\"py-2\">\n        <a href={pathname + '.md'} className=\"underline text-blue-500\">\n          View Raw Content\n        </a>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/$project.$version.docs.framework.$framework.examples.$.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound'\nimport { capitalize, seo } from '~/utils/seo'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/examples/$',\n)({\n  head: ({ params }) => ({\n    meta: seo({\n      title: `${capitalize(params._splat || '')} Example | TanStack ${capitalize(params.project)} ${capitalize(params.framework)}`,\n    }),\n  }),\n  component: Page,\n  notFoundComponent: () => {\n    return <NotFound>Example not found</NotFound>\n  },\n})\n\nfunction Page() {\n  const params = Route.useParams()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4\n        data-testid=\"selected-example-heading\"\n        className=\"text-xl font-bold underline\"\n      >\n        {params._splat} example\n      </h4>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/$project.$version.docs.framework.$framework.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/',\n)({\n  beforeLoad: () => {\n    throw redirect({\n      from: '/$project/$version/docs/framework/$framework/',\n      to: '/$project/$version/docs/framework/$framework/$',\n      params: {\n        _splat: 'overview',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/$project.$version.docs.framework.$framework.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  useLocation,\n  createFileRoute,\n} from '@tanstack/react-router'\nimport { getDocumentHeads } from '~/server/document'\nimport { getProject } from '~/server/projects'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework',\n)({\n  loader: async ({ params: { project } }) => {\n    const library = await getProject({ data: project })\n    const documents = await getDocumentHeads()\n    return {\n      library,\n      documents,\n    }\n  },\n  component: Page,\n})\n\nfunction Page() {\n  const project = Route.useLoaderData({ select: (s) => s.library })\n  const documents = Route.useLoaderData({ select: (s) => s.documents })\n  const pathname = useLocation({ select: (s) => s.pathname })\n\n  return (\n    <div className=\"grid lg:grid-cols-5 lg:divide-x min-h-dvh\">\n      <aside>\n        <div className=\"p-4\">\n          <Link\n            to=\"/\"\n            activeOptions={{ exact: true }}\n            className=\"aria-[current='page']:underline\"\n          >\n            Home\n          </Link>\n        </div>\n        <div className=\"p-4\">\n          <p className=\"mb-1 border-b\">Version</p>\n          <ul>\n            {project.versions.map((version) => (\n              <li key={version}>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ version }}\n                  className=\"aria-[current='page']:underline\"\n                  activeOptions={{ exact: false }}\n                >\n                  {version}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div className=\"p-4\">\n          <p className=\"mb-1 border-b\">Framework</p>\n          <ul>\n            {project.frameworks.map((framework) => (\n              <li key={framework}>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ framework }}\n                  className=\"aria-[current='page']:underline\"\n                  activeOptions={{ exact: false }}\n                >\n                  {framework}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div className=\"p-4\">\n          <p className=\"mb-1 border-b\">Content</p>\n          <ul>\n            {documents.map((doc) => (\n              <li key={doc.id}>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ _splat: doc.id }}\n                  className=\"aria-[current='page']:underline\"\n                >\n                  {doc.title}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div className=\"p-4\">\n          <p className=\"mb-1 border-b\">Examples</p>\n          <ul>\n            {project.examples.map((example) => (\n              <li key={example}>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/examples/$\"\n                  params={{ _splat: example }}\n                  className=\"aria-[current='page']:underline\"\n                >\n                  {example}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </aside>\n      <main className=\"lg:col-span-4 p-4\">\n        <p\n          className=\"text-sm lg:text-base pb-4 border-b break-all\"\n          data-testid=\"selected-route-label\"\n        >\n          {pathname}\n        </p>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/$project.$version.docs.framework.$framework.{$}[.]md.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getDocument } from '~/server/document'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/{$}.md',\n)({\n  server: {\n    handlers: {\n      GET: async ({ params }) => {\n        const splat = params['_splat'] || ''\n        const docPath = splat.split('.md')[0]\n        if (!docPath) {\n          return new Response('Document not found', { status: 404 })\n        }\n        const doc = await getDocument({ data: docPath })\n        const markdown = `# ${doc.title}\\n\\n${doc.content}`\n        return new Response(markdown, {\n          headers: {\n            'Content-Type': 'text/markdown',\n            'Content-Disposition': `inline; filename=\"${doc.title}.md\"`,\n          },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/$project.$version.docs.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/$project/$version/docs/')({\n  beforeLoad: () => {\n    throw redirect({\n      from: '/$project/$version/docs/',\n      to: '/$project/$version/docs/framework/$framework/$',\n      params: {\n        framework: 'react',\n        _splat: 'overview',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/$project.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/$project/')({\n  loader: ({ params }) => {\n    throw redirect({\n      to: '/$project/$version',\n      params: {\n        project: params.project,\n        version: 'latest',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title: 'TanStack Website',\n        description: `TanStack projects are type-safe!!!`,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/_library.$project.$version.index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_library/$project/$version/')({\n  component: Page,\n})\n\nfunction Page() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <h1 className=\"text-2xl mb-2\" data-testid=\"landing-page-heading\">\n        {params.project} landing page\n      </h1>\n      <p data-testid=\"landing-page-version\">version: {params.version}</p>\n      <p>\n        <Link\n          aria-label=\"Documentation\"\n          from=\"/$project/$version/\"\n          to=\"/$project/$version/docs\"\n        >\n          Get started with our documentation.\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/_library.$project.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\nimport { getProject } from '~/server/projects'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createFileRoute('/_library/$project')({\n  loader: ({ params: { project } }) => getProject({ data: project }),\n  head: ({ loaderData }) => ({\n    meta: seo({ title: `TanStack ${loaderData?.name || 'Project'}` }),\n  }),\n  component: () => (\n    <div className=\"p-2\">\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/_library.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_library/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3 className=\"text-2xl mb-2\">Website Landing Page</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/routes/_library.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  useLocation,\n  createFileRoute,\n} from '@tanstack/react-router'\nimport { getProjects } from '~/server/projects'\n\nexport const Route = createFileRoute('/_library')({\n  loader: async () => {\n    const projects = await getProjects()\n    return {\n      libraries: projects,\n    }\n  },\n  component: Layout,\n})\n\nfunction Layout() {\n  const { libraries } = Route.useLoaderData()\n  const pathname = useLocation({ select: (s) => s.pathname })\n  return (\n    <div className=\"grid lg:grid-cols-5 lg:divide-x min-h-dvh\">\n      <aside>\n        <div className=\"p-4\">\n          <Link\n            to=\"/\"\n            activeOptions={{ exact: true }}\n            className=\"aria-[current='page']:underline\"\n          >\n            Home\n          </Link>\n        </div>\n        <div className=\"p-4\">\n          <p className=\"mb-1 border-b\">Libraries</p>\n          <ul>\n            {libraries.map((library) => (\n              <li key={library}>\n                <Link\n                  to=\"/$project\"\n                  params={{ project: library }}\n                  className=\"aria-[current='page']:underline\"\n                >\n                  {library}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </aside>\n      <main className=\"lg:col-span-4 p-4\">\n        <p\n          className=\"text-sm lg:text-base pb-4 border-b break-all\"\n          data-testid=\"selected-route-label\"\n        >\n          {pathname}\n        </p>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/server/document.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst documents: Array<{ id: string; title: string; content: string }> = [\n  {\n    id: 'overview',\n    title: 'Overview',\n    content: 'This is the content of the overview document',\n  },\n  {\n    id: 'getting-started',\n    title: 'Getting Started',\n    content: 'To get started, you need to do the following...',\n  },\n  {\n    id: 'installation',\n    title: 'Installation',\n    content: 'To install this package, run the following command...',\n  },\n  {\n    id: 'ref/useQueryFunction',\n    title: 'useQuery Reference',\n    content: 'The useQuery function is used to...',\n  },\n  {\n    id: 'ref/useMutationFunction',\n    title: 'useMutation Reference',\n    content: 'The useMutation function is used to...',\n  },\n]\n\nexport const getDocumentHeads = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    return documents.map(({ id, title }) => ({\n      id,\n      title,\n    }))\n  },\n)\n\nexport const getDocument = createServerFn({ method: 'GET' })\n  .inputValidator((id: string) => id)\n  .handler(async ({ data: id }) => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    const document = documents.find((doc) => doc.id === id)\n\n    if (!document) {\n      throw notFound()\n    }\n\n    return document\n  })\n"
  },
  {
    "path": "e2e/react-start/website/src/server/projects.tsx",
    "content": "import { createServerFn } from '@tanstack/react-start'\nimport { notFound } from '@tanstack/react-router'\nimport { capitalize } from '~/utils/seo'\n\nconst projects = ['router', 'table', 'query', 'form', 'ranger']\n\nexport const getProjects = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    return projects\n  },\n)\n\nexport const getProject = createServerFn({ method: 'GET' })\n  .inputValidator((project: string) => project)\n  .handler(async (ctx) => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    const selectedProject = projects.find((p) => p === ctx.data.toLowerCase())\n\n    if (!selectedProject) {\n      throw notFound()\n    }\n\n    return {\n      id: selectedProject,\n      name: capitalize(selectedProject),\n      versions: ['latest', 'v2', 'v1'],\n      frameworks: ['react', 'vue', 'solidjs', 'svelte'],\n      examples: ['basic', 'kitchen-sink'],\n    }\n  })\n"
  },
  {
    "path": "e2e/react-start/website/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/website/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n\nexport const capitalize = (str: string) =>\n  str.charAt(0).toUpperCase() + str.slice(1)\n"
  },
  {
    "path": "e2e/react-start/website/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\nconst routeTestId = 'selected-route-label'\n\ntest('resolves to the latest version on load of a project like \"/router\"', async ({\n  page,\n}) => {\n  await page.goto('/router')\n\n  await expect(page.getByTestId(routeTestId)).toContainText('/router/latest')\n})\n\ntest('resolves to the overview docs page', async ({ page }) => {\n  await page.goto('/router/latest/docs')\n\n  await expect(page.getByTestId(routeTestId)).toContainText(\n    '/router/latest/docs/framework/react/overview',\n  )\n})\n\ntest('clicking on Documentation link navigates to the overview docs page', async ({\n  page,\n}) => {\n  await page.goto('/router')\n  await page.waitForLoadState('networkidle')\n\n  const documentationLink = page.getByLabel('Documentation')\n  await documentationLink.click()\n  await page.waitForLoadState('networkidle')\n\n  const pathname = new URL(page.url()).pathname\n  expect(pathname).toBe('/router/latest/docs/framework/react/overview')\n})\n"
  },
  {
    "path": "e2e/react-start/website/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/react-start/website/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basepath-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/src/main.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { render } from 'solid-js/web'\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  basepath: '/app',\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/src/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = Route.useNavigate()\n\n  return (\n    <div data-testid=\"about-component\">\n      <button\n        onClick={() => navigate({ to: '/', reloadDocument: true })}\n        data-testid=\"to-home-btn\"\n      >\n        Navigate to / with document reload\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n\nfunction App() {\n  const navigate = Route.useNavigate()\n\n  return (\n    <div data-testid=\"home-component\">\n      <button\n        data-testid=\"to-about-btn\"\n        onClick={() =>\n          navigate({\n            to: '/about',\n            reloadDocument: true,\n          })\n        }\n      >\n        Navigate to /about with document reload\n      </button>{' '}\n      <button\n        data-testid=\"to-about-href-with-basepath-btn\"\n        onClick={() =>\n          navigate({\n            href: '/app/about',\n          })\n        }\n      >\n        Navigate to /about using href with basepath\n      </button>{' '}\n      <button\n        data-testid=\"to-about-href-with-basepath-reload-btn\"\n        onClick={() =>\n          navigate({\n            href: '/app/about',\n            reloadDocument: true,\n          })\n        }\n      >\n        Navigate to /about using href with basepath (reloadDocument)\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/tests/reload-document.test.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('navigate() respects basepath for when reloadDocument=true', async ({\n  page,\n}) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const aboutBtn = page.getByTestId(`to-about-btn`)\n  await aboutBtn.click()\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n\n  const homeBtn = page.getByTestId(`to-home-btn`)\n  await homeBtn.click()\n  await page.waitForURL('/app/')\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n})\n\ntest('navigate() with href containing basepath', async ({ page }) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const aboutBtn = page.getByTestId(`to-about-href-with-basepath-btn`)\n  await aboutBtn.click()\n  // Should navigate to /app/about, NOT /app/app/about\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n})\n\ntest('navigate() with href containing basepath and reloadDocument=true', async ({\n  page,\n}) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const aboutBtn = page.getByTestId(`to-about-href-with-basepath-reload-btn`)\n  await aboutBtn.click()\n  // Should navigate to /app/about, NOT stay on current page\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n})\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basepath-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  base: '/app/',\n  plugins: [tanstackRouter({ target: 'solid' }), solid()],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/solid-router/basic/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basic\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  HeadContent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createLink,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { NotFoundError, fetchPost, fetchPosts } from './posts'\nimport './styles.css'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  const SvgLink = createLink('svg')\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link to=\"/posts\" viewTransition>\n          View Transition\n        </Link>{' '}\n        <Link to=\"/posts\" viewTransition={{ types: ['dummy'] }}>\n          View Transition types\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>{' '}\n        <div class=\"flex items-center\">\n          <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" role=\"img\">\n            <title id=\"rectTitle\">Link in SVG</title>\n            <SvgLink to=\"/posts\" aria-label=\"Open posts from SVG\">\n              <rect\n                x=\"0\"\n                y=\"0\"\n                width=\"20\"\n                height=\"20\"\n                rx=\"4\"\n                fill=\"blue\"\n                stroke-width=\"2\"\n              />\n            </SvgLink>\n          </svg>\n        </div>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nexport const postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ params }) => fetchPost(params.postId),\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold\">{post().title}</h4>\n      <hr class=\"opacity-20\" />\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layout2Route = createRoute({\n  getParentRoute: () => layoutRoute,\n  id: '_layout-2',\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layoutARoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-a',\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n\nconst layoutBRoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-b',\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n\nconst paramsPsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/params-ps',\n})\n\nconst paramsPsIndexRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/',\n  component: function ParamsIndex() {\n    return (\n      <div>\n        <h3 class=\"pb-2\">Named path params</h3>\n        <ul class=\"grid mb-2\">\n          <li>\n            <Link\n              data-testid=\"l-to-named-foo\"\n              to=\"/params-ps/named/$foo\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/$foo\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-named-prefixfoo\"\n              to=\"/params-ps/named/prefix{$foo}\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/{'prefix{$foo}'}\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-named-foosuffix\"\n              to=\"/params-ps/named/{$foo}suffix\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/{'{$foo}suffix'}\n            </Link>\n          </li>\n        </ul>\n        <hr />\n        <h3 class=\"pb-2\">Wildcard path params</h3>\n        <ul class=\"grid mb-2\">\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-foo\"\n              to=\"/params-ps/wildcard/$\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/$\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-prefixfoo\"\n              to=\"/params-ps/wildcard/prefix{$}\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/{'prefix{$}'}\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-foosuffix\"\n              to=\"/params-ps/wildcard/{$}suffix\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/{'{$}suffix'}\n            </Link>\n          </li>\n        </ul>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/named',\n})\n\nconst paramsPsNamedIndexRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/',\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n\nconst paramsPsNamedFooRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/$foo',\n  component: function ParamsNamedFoo() {\n    const p = paramsPsNamedFooRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFoo</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedFooPrefixRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/prefix{$foo}',\n  component: function ParamsNamedFooMarkdown() {\n    const p = paramsPsNamedFooPrefixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFooPrefix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedFooSuffixRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/{$foo}suffix',\n  component: function ParamsNamedFooSuffix() {\n    const p = paramsPsNamedFooSuffixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFooSuffix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/wildcard',\n})\n\nconst paramsPsWildcardIndexRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '/',\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n\nconst paramsPsWildcardSplatRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '$',\n  component: function ParamsWildcardSplat() {\n    const p = paramsPsWildcardSplatRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplat</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardSplatPrefixRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: 'prefix{$}',\n  component: function ParamsWildcardSplatPrefix() {\n    const p = paramsPsWildcardSplatPrefixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplatPrefix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardSplatSuffixRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '{$}suffix',\n  component: function ParamsWildcardSplatSuffix() {\n    const p = paramsPsWildcardSplatSuffixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplatSuffix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n      </div>\n    )\n  },\n})\n\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute, postsIndexRoute]),\n  layoutRoute.addChildren([\n    layout2Route.addChildren([layoutARoute, layoutBRoute]),\n  ]),\n  paramsPsRoute.addChildren([\n    paramsPsNamedRoute.addChildren([\n      paramsPsNamedFooPrefixRoute,\n      paramsPsNamedFooSuffixRoute,\n      paramsPsNamedFooRoute,\n      paramsPsNamedIndexRoute,\n    ]),\n    paramsPsWildcardRoute.addChildren([\n      paramsPsWildcardSplatRoute,\n      paramsPsWildcardSplatPrefixRoute,\n      paramsPsWildcardSplatSuffixRoute,\n      paramsPsWildcardIndexRoute,\n    ]),\n    paramsPsIndexRoute,\n  ]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/src/posts.lazy.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@tanstack/solid-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Navigating to a post page with viewTransition', async ({ page }) => {\n  await page.getByRole('link', { name: 'View Transition', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to a post page with viewTransition types', async ({\n  page,\n}) => {\n  await page.getByRole('link', { name: 'View Transition types' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Link in SVG does not trigger a full page reload', async ({ page }) => {\n  let fullPageLoad = false\n  page.on('domcontentloaded', () => {\n    fullPageLoad = true\n  })\n\n  await page.getByRole('link', { name: 'Open posts from SVG' }).click()\n  const url = `http://localhost:${PORT}/posts`\n  await page.waitForURL(url)\n\n  expect(fullPageLoad).toBeFalsy()\n})\n"
  },
  {
    "path": "e2e/solid-router/basic/tests/params.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('params operations + prefix/suffix', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/params-ps')\n  })\n\n  test.describe('named params', () => {\n    const NAMED_PARAMS_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-named-foo',\n        pathname: '/params-ps/named/foo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFoo',\n      },\n      {\n        id: 'l-to-named-prefixfoo',\n        pathname: '/params-ps/named/prefixfoo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooPrefix',\n      },\n      {\n        id: 'l-to-named-foosuffix',\n        pathname: '/params-ps/named/foosuffix',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooSuffix',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n  })\n\n  test.describe('wildcard param', () => {\n    const WILDCARD_PARAM_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-wildcard-foo',\n        pathname: '/params-ps/wildcard/foo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n      {\n        id: 'l-to-wildcard-prefixfoo',\n        pathname: '/params-ps/wildcard/prefixfoo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatPrefix',\n      },\n      {\n        id: 'l-to-wildcard-foosuffix',\n        pathname: '/params-ps/wildcard/foosuffix',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatSuffix',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/solid-router/basic/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n\n    <script src=\"https://unpkg.com/@tailwindcss/browser@4\"></script>\n    <style type=\"text/tailwindcss\">\n      html {\n        color-scheme: light dark;\n      }\n      * {\n        @apply border-gray-200 dark:border-gray-800;\n      }\n      body {\n        @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n      }\n    </style>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/dist/main.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basic-esbuild-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"esbuild src/main.tsx --jsx=preserve --jsx-import-source=solid-js --serve=5601 --bundle --outfile=dist/main.js --watch --servedir=.\",\n    \"build\": \"esbuild src/main.tsx --jsx=preserve --jsx-import-source=solid-js --bundle --outfile=dist/main.js && tsc --noEmit\",\n    \"serve\": \"esbuild src/main.tsx --jsx=preserve --jsx-import-source=solid-js --bundle --outfile=dist/main.js --servedir=.\",\n    \"start\": \"dev\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"esbuild\": \"^0.27.4\",\n    \"esbuild-plugin-solid\": \"^0.6.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm run build && pnpm run serve --serve=${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/esbuild.config.js",
    "content": "import { tanstackRouter } from '@tanstack/router-plugin/esbuild'\nimport { solidPlugin } from 'esbuild-plugin-solid'\n\nexport default {\n  // ...\n  plugins: [\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solidPlugin(),\n  ],\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routeTree.gen.ts",
    "content": "/* prettier-ignore-start */\n\n/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file is auto-generated by TanStack Router\n\nimport { createFileRoute } from '@tanstack/solid-router'\n\n// Import Routes\n\nimport { Route as rootRoute } from './routes/__root'\nimport { Route as PostsImport } from './routes/posts'\nimport { Route as LayoutImport } from './routes/_layout'\nimport { Route as IndexImport } from './routes/index'\nimport { Route as PostsIndexImport } from './routes/posts.index'\nimport { Route as PostsPostIdImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2Import } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideImport } from './routes/(group)/lazyinside'\nimport { Route as groupLayoutImport } from './routes/(group)/_layout'\nimport { Route as LayoutLayout2LayoutBImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutAImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupLayoutInsideImport } from './routes/(group)/_layout.inside'\n\n// Create Virtual Routes\n\nconst groupImport = createFileRoute('/(group)')()\n\n// Create/Update Routes\n\nconst groupRoute = groupImport.update({\n  id: '/(group)',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst PostsRoute = PostsImport.update({\n  path: '/posts',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst LayoutRoute = LayoutImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst IndexRoute = IndexImport.update({\n  path: '/',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst PostsIndexRoute = PostsIndexImport.update({\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nconst PostsPostIdRoute = PostsPostIdImport.update({\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nconst LayoutLayout2Route = LayoutLayout2Import.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\n\nconst groupLazyinsideRoute = groupLazyinsideImport\n  .update({\n    path: '/lazyinside',\n    getParentRoute: () => groupRoute,\n  } as any)\n  .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route))\n\nconst groupLayoutRoute = groupLayoutImport.update({\n  id: '/_layout',\n  getParentRoute: () => groupRoute,\n} as any)\n\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBImport.update({\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutAImport.update({\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nconst groupLayoutInsideRoute = groupLayoutInsideImport.update({\n  path: '/inside',\n  getParentRoute: () => groupLayoutRoute,\n} as any)\n\n// Populate the FileRoutesByPath interface\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexImport\n      parentRoute: typeof rootRoute\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof LayoutImport\n      parentRoute: typeof rootRoute\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsImport\n      parentRoute: typeof rootRoute\n    }\n    '/(group)': {\n      id: '/(group)'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof groupImport\n      parentRoute: typeof rootRoute\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof groupLayoutImport\n      parentRoute: typeof groupRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideImport\n      parentRoute: typeof groupImport\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof LayoutLayout2Import\n      parentRoute: typeof LayoutImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdImport\n      parentRoute: typeof PostsImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexImport\n      parentRoute: typeof PostsImport\n    }\n    '/(group)/_layout/inside': {\n      id: '/(group)/_layout/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupLayoutInsideImport\n      parentRoute: typeof groupLayoutImport\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutAImport\n      parentRoute: typeof LayoutLayout2Import\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBImport\n      parentRoute: typeof LayoutLayout2Import\n    }\n  }\n}\n\n// Create and export the route tree\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsideRoute: typeof groupLayoutInsideRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsideRoute: groupLayoutInsideRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\ninterface groupRouteChildren {\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n}\n\nconst groupRouteChildren: groupRouteChildren = {\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n}\n\nconst groupRouteWithChildren = groupRoute._addFileChildren(groupRouteChildren)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof groupLayoutRouteWithChildren\n  '': typeof LayoutLayout2RouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/inside': typeof groupLayoutInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\n\nexport interface FileRoutesByTo {\n  '/': typeof groupLayoutRouteWithChildren\n  '': typeof LayoutLayout2RouteWithChildren\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/inside': typeof groupLayoutInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\n\nexport interface FileRoutesById {\n  __root__: typeof rootRoute\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/(group)': typeof groupRouteWithChildren\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/(group)/_layout/inside': typeof groupLayoutInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n}\n\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | ''\n    | '/posts'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/inside'\n    | '/layout-a'\n    | '/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | ''\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts'\n    | '/inside'\n    | '/layout-a'\n    | '/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/(group)'\n    | '/(group)/_layout'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/(group)/_layout/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n  fileRoutesById: FileRoutesById\n}\n\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n  groupRoute: typeof groupRouteWithChildren\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n  groupRoute: groupRouteWithChildren,\n}\n\nexport const routeTree = rootRoute\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\n/* prettier-ignore-end */\n\n/* ROUTE_MANIFEST_START\n{\n  \"routes\": {\n    \"__root__\": {\n      \"filePath\": \"__root.tsx\",\n      \"children\": [\n        \"/\",\n        \"/_layout\",\n        \"/posts\",\n        \"/(group)\"\n      ]\n    },\n    \"/\": {\n      \"filePath\": \"index.tsx\"\n    },\n    \"/_layout\": {\n      \"filePath\": \"_layout.tsx\",\n      \"children\": [\n        \"/_layout/_layout-2\"\n      ]\n    },\n    \"/posts\": {\n      \"filePath\": \"posts.tsx\",\n      \"children\": [\n        \"/posts/$postId\",\n        \"/posts/\"\n      ]\n    },\n    \"/(group)\": {\n      \"filePath\": \"(group)\",\n      \"children\": [\n        \"/(group)/_layout\",\n        \"/(group)/lazyinside\"\n      ]\n    },\n    \"/(group)/_layout\": {\n      \"filePath\": \"(group)/_layout.tsx\",\n      \"parent\": \"/(group)\",\n      \"children\": [\n        \"/(group)/_layout/inside\"\n      ]\n    },\n    \"/(group)/lazyinside\": {\n      \"filePath\": \"(group)/lazyinside.tsx\",\n      \"parent\": \"/(group)\"\n    },\n    \"/_layout/_layout-2\": {\n      \"filePath\": \"_layout/_layout-2.tsx\",\n      \"parent\": \"/_layout\",\n      \"children\": [\n        \"/_layout/_layout-2/layout-a\",\n        \"/_layout/_layout-2/layout-b\"\n      ]\n    },\n    \"/posts/$postId\": {\n      \"filePath\": \"posts.$postId.tsx\",\n      \"parent\": \"/posts\"\n    },\n    \"/posts/\": {\n      \"filePath\": \"posts.index.tsx\",\n      \"parent\": \"/posts\"\n    },\n    \"/(group)/_layout/inside\": {\n      \"filePath\": \"(group)/_layout.inside.tsx\",\n      \"parent\": \"/(group)/_layout\"\n    },\n    \"/_layout/_layout-2/layout-a\": {\n      \"filePath\": \"_layout/_layout-2/layout-a.tsx\",\n      \"parent\": \"/_layout/_layout-2\"\n    },\n    \"/_layout/_layout-2/layout-b\": {\n      \"filePath\": \"_layout/_layout-2/layout-b.tsx\",\n      \"parent\": \"/_layout/_layout-2\"\n    }\n  }\n}\nROUTE_MANIFEST_END */\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/_layout.inside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(group)/_layout/inside')\n\nexport const Route = createFileRoute('/(group)/_layout/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/_layout/inside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook().hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook().hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">\n          {searchViaRouteApi().hello}\n        </div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({\n  component: () => (\n    <>\n      <div>/(group)/_layout!</div>\n      <Outlet />\n    </>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.lazy.tsx",
    "content": "import {\n  createLazyFileRoute,\n  getRouteApi,\n  useSearch,\n} from '@tanstack/solid-router'\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nexport const Route = createLazyFileRoute('/(group)/lazyinside')({\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/lazyinside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook().hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook().hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">\n          {searchViaRouteApi().hello}\n        </div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/inside\"\n          data-testid=\"link-to-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/lazyinside\"\n          data-testid=\"link-to-lazy-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Lazy Inside Group\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest.skip('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest.skip('Navigating nested layouts', async ({ page }) => {\n  await page.goto('/')\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest.skip('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest.skip('Navigating to a route inside a route group', async ({ page }) => {\n  await page.getByTestId('link-to-route-inside-group').click()\n  await expect(page.getByTestId('search-via-hook')).toContainText('world')\n  await expect(page.getByTestId('search-via-route-hook')).toContainText('world')\n  await expect(page.getByTestId('search-via-route-api')).toContainText('world')\n})\n\ntest.skip('Navigating to a lazy route inside a route group', async ({\n  page,\n}) => {\n  await page.getByTestId('link-to-lazy-route-inside-group').click()\n  await expect(page.getByTestId('search-via-hook')).toContainText('world')\n  await expect(page.getByTestId('search-via-route-hook')).toContainText('world')\n  await expect(page.getByTestId('search-via-route-api')).toContainText('world')\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-esbuild-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basic-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"pnpm run test:e2e:default\",\n    \"test:e2e:default\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"combinate\": \"^1.1.11\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\nconst command = `pnpm build && pnpm preview --port ${PORT}`\n\nconsole.info('Running with mode: ', process.env.MODE || 'default')\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      MODE: process.env.MODE || '',\n      VITE_MODE: process.env.MODE || '',\n      VITE_NODE_ENV: 'test',\n      VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),\n      VITE_SERVER_PORT: String(PORT),\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/main.tsx",
    "content": "import {\n  RouterProvider,\n  createRouteMask,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { render } from 'solid-js/web'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nconst mask = createRouteMask({\n  routeTree,\n  from: '/masks/admin/$userId',\n  to: '/masks/public/$username',\n  params: (prev) => ({\n    username: `user-${prev.userId}`,\n  }),\n})\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  routeMasks: [mask],\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as RemountDepsRouteImport } from './routes/remountDeps'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'\nimport { Route as MasksRouteImport } from './routes/masks'\nimport { Route as HoverPreloadHashRouteImport } from './routes/hover-preload-hash'\nimport { Route as EditingBRouteImport } from './routes/editing-b'\nimport { Route as EditingARouteImport } from './routes/editing-a'\nimport { Route as ComponentTypesTestRouteImport } from './routes/component-types-test'\nimport { Route as AnchorRouteImport } from './routes/anchor'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as Char45824Char54620Char48124Char44397RouteRouteImport } from './routes/대한민국/route'\nimport { Route as SearchParamsRouteRouteImport } from './routes/search-params/route'\nimport { Route as NonNestedRouteRouteImport } from './routes/non-nested/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SearchParamsIndexRouteImport } from './routes/search-params/index'\nimport { Route as RelativeIndexRouteImport } from './routes/relative/index'\nimport { Route as RedirectIndexRouteImport } from './routes/redirect/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as ParamsPsIndexRouteImport } from './routes/params-ps/index'\nimport { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default'\nimport { Route as RedirectTargetRouteImport } from './routes/redirect/$target'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'\nimport { Route as groupInsideRouteImport } from './routes/(group)/inside'\nimport { Route as groupLayoutRouteImport } from './routes/(group)/_layout'\nimport { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside'\nimport { Route as RelativeUseNavigateRouteRouteImport } from './routes/relative/useNavigate/route'\nimport { Route as RelativeLinkRouteRouteImport } from './routes/relative/link/route'\nimport { Route as ParamsPsNonNestedRouteRouteImport } from './routes/params-ps/non-nested/route'\nimport { Route as NonNestedSuffixRouteRouteImport } from './routes/non-nested/suffix/route'\nimport { Route as NonNestedPrefixRouteRouteImport } from './routes/non-nested/prefix/route'\nimport { Route as NonNestedPathRouteRouteImport } from './routes/non-nested/path/route'\nimport { Route as NonNestedNamedRouteRouteImport } from './routes/non-nested/named/route'\nimport { Route as NonNestedDeepRouteRouteImport } from './routes/non-nested/deep/route'\nimport { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index'\nimport { Route as ParamsPsWildcardIndexRouteImport } from './routes/params-ps/wildcard/index'\nimport { Route as ParamsPsNamedIndexRouteImport } from './routes/params-ps/named/index'\nimport { Route as Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport } from './routes/대한민국/🚀.$id'\nimport { Route as Char45824Char54620Char48124Char44397WildcardSplatRouteImport } from './routes/대한민국/wildcard.$'\nimport { Route as TransitionTypingCreateResourceRouteImport } from './routes/transition/typing/create-resource'\nimport { Route as TransitionCountCreateResourceRouteImport } from './routes/transition/count/create-resource'\nimport { Route as RelativeUseNavigateRelativeUseNavigateBRouteImport } from './routes/relative/useNavigate/relative-useNavigate-b'\nimport { Route as RelativeUseNavigateRelativeUseNavigateARouteImport } from './routes/relative/useNavigate/relative-useNavigate-a'\nimport { Route as RelativeLinkRelativeLinkBRouteImport } from './routes/relative/link/relative-link-b'\nimport { Route as RelativeLinkRelativeLinkARouteImport } from './routes/relative/link/relative-link-a'\nimport { Route as RedirectPreloadThirdRouteImport } from './routes/redirect/preload/third'\nimport { Route as RedirectPreloadSecondRouteImport } from './routes/redirect/preload/second'\nimport { Route as RedirectPreloadFirstRouteImport } from './routes/redirect/preload/first'\nimport { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader'\nimport { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad'\nimport { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit'\nimport { Route as ParamsSingleValueRouteImport } from './routes/params.single.$value'\nimport { Route as ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport } from './routes/params-ps/wildcard/{$}suffix@대'\nimport { Route as ParamsPsWildcardChar123Char125suffixRouteImport } from './routes/params-ps/wildcard/{$}suffix'\nimport { Route as ParamsPsWildcardPrefixChar123Char125RouteImport } from './routes/params-ps/wildcard/prefix{$}'\nimport { Route as ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport } from './routes/params-ps/wildcard/prefix@대{$}'\nimport { Route as ParamsPsWildcardSplatRouteImport } from './routes/params-ps/wildcard/$'\nimport { Route as ParamsPsNamedChar123fooChar125suffixRouteImport } from './routes/params-ps/named/{$foo}suffix'\nimport { Route as ParamsPsNamedPrefixChar123fooChar125RouteImport } from './routes/params-ps/named/prefix{$foo}'\nimport { Route as MasksPublicUsernameRouteImport } from './routes/masks.public.$username'\nimport { Route as MasksAdminUserIdRouteImport } from './routes/masks.admin.$userId'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside'\nimport { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout'\nimport { Route as ParamsPsNonNestedFooRouteRouteImport } from './routes/params-ps/non-nested/$foo_/route'\nimport { Route as ParamsPsNamedFooRouteRouteImport } from './routes/params-ps/named/$foo/route'\nimport { Route as NonNestedSuffixChar123bazChar125suffixRouteRouteImport } from './routes/non-nested/suffix/{$baz}suffix.route'\nimport { Route as NonNestedPrefixPrefixChar123bazChar125RouteRouteImport } from './routes/non-nested/prefix/prefix{$baz}.route'\nimport { Route as NonNestedPathBazRouteRouteImport } from './routes/non-nested/path/baz.route'\nimport { Route as NonNestedNamedBazRouteRouteImport } from './routes/non-nested/named/$baz.route'\nimport { Route as NonNestedDeepBazRouteRouteImport } from './routes/non-nested/deep/$baz.route'\nimport { Route as RelativeUseNavigateWithSearchIndexRouteImport } from './routes/relative/useNavigate/with-search/index'\nimport { Route as RelativeUseNavigatePathIndexRouteImport } from './routes/relative/useNavigate/path/index'\nimport { Route as RelativeUseNavigateNestedIndexRouteImport } from './routes/relative/useNavigate/nested/index'\nimport { Route as RelativeLinkWithSearchIndexRouteImport } from './routes/relative/link/with-search/index'\nimport { Route as RelativeLinkPathIndexRouteImport } from './routes/relative/link/path/index'\nimport { Route as RelativeLinkNestedIndexRouteImport } from './routes/relative/link/nested/index'\nimport { Route as NonNestedSuffixChar123bazChar125suffixIndexRouteImport } from './routes/non-nested/suffix/{$baz}suffix.index'\nimport { Route as NonNestedPrefixPrefixChar123bazChar125IndexRouteImport } from './routes/non-nested/prefix/prefix{$baz}.index'\nimport { Route as NonNestedPathBazIndexRouteImport } from './routes/non-nested/path/baz.index'\nimport { Route as NonNestedNamedBazIndexRouteImport } from './routes/non-nested/named/$baz.index'\nimport { Route as NonNestedDeepBazIndexRouteImport } from './routes/non-nested/deep/$baz.index'\nimport { Route as ParamsPsNonNestedFooBarRouteImport } from './routes/params-ps/non-nested/$foo_/$bar'\nimport { Route as NonNestedSuffixChar123bazChar125suffixBarRouteImport } from './routes/non-nested/suffix/{$baz}suffix_.bar'\nimport { Route as NonNestedSuffixChar123bazChar125suffixFooRouteImport } from './routes/non-nested/suffix/{$baz}suffix.foo'\nimport { Route as NonNestedPrefixPrefixChar123bazChar125BarRouteImport } from './routes/non-nested/prefix/prefix{$baz}_.bar'\nimport { Route as NonNestedPrefixPrefixChar123bazChar125FooRouteImport } from './routes/non-nested/prefix/prefix{$baz}.foo'\nimport { Route as NonNestedPathBazBarRouteImport } from './routes/non-nested/path/baz_.bar'\nimport { Route as NonNestedPathBazFooRouteImport } from './routes/non-nested/path/baz.foo'\nimport { Route as NonNestedNamedBazBarRouteImport } from './routes/non-nested/named/$baz_.bar'\nimport { Route as NonNestedNamedBazFooRouteImport } from './routes/non-nested/named/$baz.foo'\nimport { Route as ParamsPsNamedFooBarRouteRouteImport } from './routes/params-ps/named/$foo/$bar.route'\nimport { Route as NonNestedDeepBazBarRouteRouteImport } from './routes/non-nested/deep/$baz_.bar.route'\nimport { Route as RelativeUseNavigatePathPathIndexRouteImport } from './routes/relative/useNavigate/path/$path/index'\nimport { Route as RelativeUseNavigateNestedDeepIndexRouteImport } from './routes/relative/useNavigate/nested/deep/index'\nimport { Route as RelativeLinkPathPathIndexRouteImport } from './routes/relative/link/path/$path/index'\nimport { Route as RelativeLinkNestedDeepIndexRouteImport } from './routes/relative/link/nested/deep/index'\nimport { Route as NonNestedDeepBazBarIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.index'\nimport { Route as ParamsPsNamedFooBarBazRouteImport } from './routes/params-ps/named/$foo/$bar.$baz'\nimport { Route as NonNestedDeepBazBarQuxRouteImport } from './routes/non-nested/deep/$baz_.bar_.qux'\nimport { Route as NonNestedDeepBazBarFooRouteRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.route'\nimport { Route as NonNestedDeepBazBarFooIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.index'\nimport { Route as NonNestedDeepBazBarFooQuxRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo_.qux'\n\nconst RemountDepsRoute = RemountDepsRouteImport.update({\n  id: '/remountDeps',\n  path: '/remountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotRemountDepsRoute = NotRemountDepsRouteImport.update({\n  id: '/notRemountDeps',\n  path: '/notRemountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MasksRoute = MasksRouteImport.update({\n  id: '/masks',\n  path: '/masks',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst HoverPreloadHashRoute = HoverPreloadHashRouteImport.update({\n  id: '/hover-preload-hash',\n  path: '/hover-preload-hash',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingBRoute = EditingBRouteImport.update({\n  id: '/editing-b',\n  path: '/editing-b',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingARoute = EditingARouteImport.update({\n  id: '/editing-a',\n  path: '/editing-a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ComponentTypesTestRoute = ComponentTypesTestRouteImport.update({\n  id: '/component-types-test',\n  path: '/component-types-test',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AnchorRoute = AnchorRouteImport.update({\n  id: '/anchor',\n  path: '/anchor',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Char45824Char54620Char48124Char44397RouteRoute =\n  Char45824Char54620Char48124Char44397RouteRouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({\n  id: '/search-params',\n  path: '/search-params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NonNestedRouteRoute = NonNestedRouteRouteImport.update({\n  id: '/non-nested',\n  path: '/non-nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RelativeIndexRoute = RelativeIndexRouteImport.update({\n  id: '/relative/',\n  path: '/relative/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectIndexRoute = RedirectIndexRouteImport.update({\n  id: '/redirect/',\n  path: '/redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ParamsPsIndexRoute = ParamsPsIndexRouteImport.update({\n  id: '/params-ps/',\n  path: '/params-ps/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({\n  id: '/default',\n  path: '/default',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RedirectTargetRoute = RedirectTargetRouteImport.update({\n  id: '/redirect/$target',\n  path: '/redirect/$target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst groupLazyinsideRoute = groupLazyinsideRouteImport\n  .update({\n    id: '/(group)/lazyinside',\n    path: '/lazyinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route))\nconst groupInsideRoute = groupInsideRouteImport.update({\n  id: '/(group)/inside',\n  path: '/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutRoute = groupLayoutRouteImport.update({\n  id: '/(group)/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst anotherGroupOnlyrouteinsideRoute =\n  anotherGroupOnlyrouteinsideRouteImport.update({\n    id: '/(another-group)/onlyrouteinside',\n    path: '/onlyrouteinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst RelativeUseNavigateRouteRoute =\n  RelativeUseNavigateRouteRouteImport.update({\n    id: '/relative/useNavigate',\n    path: '/relative/useNavigate',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst RelativeLinkRouteRoute = RelativeLinkRouteRouteImport.update({\n  id: '/relative/link',\n  path: '/relative/link',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsPsNonNestedRouteRoute = ParamsPsNonNestedRouteRouteImport.update({\n  id: '/params-ps/non-nested',\n  path: '/params-ps/non-nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NonNestedSuffixRouteRoute = NonNestedSuffixRouteRouteImport.update({\n  id: '/suffix',\n  path: '/suffix',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst NonNestedPrefixRouteRoute = NonNestedPrefixRouteRouteImport.update({\n  id: '/prefix',\n  path: '/prefix',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst NonNestedPathRouteRoute = NonNestedPathRouteRouteImport.update({\n  id: '/path',\n  path: '/path',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst NonNestedNamedRouteRoute = NonNestedNamedRouteRouteImport.update({\n  id: '/named',\n  path: '/named',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst NonNestedDeepRouteRoute = NonNestedDeepRouteRouteImport.update({\n  id: '/deep',\n  path: '/deep',\n  getParentRoute: () => NonNestedRouteRoute,\n} as any)\nconst RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst ParamsPsWildcardIndexRoute = ParamsPsWildcardIndexRouteImport.update({\n  id: '/params-ps/wildcard/',\n  path: '/params-ps/wildcard/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsPsNamedIndexRoute = ParamsPsNamedIndexRouteImport.update({\n  id: '/params-ps/named/',\n  path: '/params-ps/named/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Char45824Char54620Char48124Char44397Char55357Char56960IdRoute =\n  Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport.update({\n    id: '/🚀/$id',\n    path: '/🚀/$id',\n    getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,\n  } as any)\nconst Char45824Char54620Char48124Char44397WildcardSplatRoute =\n  Char45824Char54620Char48124Char44397WildcardSplatRouteImport.update({\n    id: '/wildcard/$',\n    path: '/wildcard/$',\n    getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,\n  } as any)\nconst TransitionTypingCreateResourceRoute =\n  TransitionTypingCreateResourceRouteImport.update({\n    id: '/transition/typing/create-resource',\n    path: '/transition/typing/create-resource',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst TransitionCountCreateResourceRoute =\n  TransitionCountCreateResourceRouteImport.update({\n    id: '/transition/count/create-resource',\n    path: '/transition/count/create-resource',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst RelativeUseNavigateRelativeUseNavigateBRoute =\n  RelativeUseNavigateRelativeUseNavigateBRouteImport.update({\n    id: '/relative-useNavigate-b',\n    path: '/relative-useNavigate-b',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeUseNavigateRelativeUseNavigateARoute =\n  RelativeUseNavigateRelativeUseNavigateARouteImport.update({\n    id: '/relative-useNavigate-a',\n    path: '/relative-useNavigate-a',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeLinkRelativeLinkBRoute =\n  RelativeLinkRelativeLinkBRouteImport.update({\n    id: '/relative-link-b',\n    path: '/relative-link-b',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst RelativeLinkRelativeLinkARoute =\n  RelativeLinkRelativeLinkARouteImport.update({\n    id: '/relative-link-a',\n    path: '/relative-link-a',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst RedirectPreloadThirdRoute = RedirectPreloadThirdRouteImport.update({\n  id: '/redirect/preload/third',\n  path: '/redirect/preload/third',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectPreloadSecondRoute = RedirectPreloadSecondRouteImport.update({\n  id: '/redirect/preload/second',\n  path: '/redirect/preload/second',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectPreloadFirstRoute = RedirectPreloadFirstRouteImport.update({\n  id: '/redirect/preload/first',\n  path: '/redirect/preload/first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({\n  id: '/via-loader',\n  path: '/via-loader',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst RedirectTargetViaBeforeLoadRoute =\n  RedirectTargetViaBeforeLoadRouteImport.update({\n    id: '/via-beforeLoad',\n    path: '/via-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({\n  id: '/posts_/$postId/edit',\n  path: '/posts/$postId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsSingleValueRoute = ParamsSingleValueRouteImport.update({\n  id: '/params/single/$value',\n  path: '/params/single/$value',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsPsWildcardChar123Char125suffixAtChar45824Route =\n  ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport.update({\n    id: '/params-ps/wildcard/{$}suffix@대',\n    path: '/params-ps/wildcard/{$}suffix@대',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsWildcardChar123Char125suffixRoute =\n  ParamsPsWildcardChar123Char125suffixRouteImport.update({\n    id: '/params-ps/wildcard/{$}suffix',\n    path: '/params-ps/wildcard/{$}suffix',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsWildcardPrefixChar123Char125Route =\n  ParamsPsWildcardPrefixChar123Char125RouteImport.update({\n    id: '/params-ps/wildcard/prefix{$}',\n    path: '/params-ps/wildcard/prefix{$}',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsWildcardPrefixAtChar45824Char123Char125Route =\n  ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport.update({\n    id: '/params-ps/wildcard/prefix@대{$}',\n    path: '/params-ps/wildcard/prefix@대{$}',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsWildcardSplatRoute = ParamsPsWildcardSplatRouteImport.update({\n  id: '/params-ps/wildcard/$',\n  path: '/params-ps/wildcard/$',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsPsNamedChar123fooChar125suffixRoute =\n  ParamsPsNamedChar123fooChar125suffixRouteImport.update({\n    id: '/params-ps/named/{$foo}suffix',\n    path: '/params-ps/named/{$foo}suffix',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ParamsPsNamedPrefixChar123fooChar125Route =\n  ParamsPsNamedPrefixChar123fooChar125RouteImport.update({\n    id: '/params-ps/named/prefix{$foo}',\n    path: '/params-ps/named/prefix{$foo}',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MasksPublicUsernameRoute = MasksPublicUsernameRouteImport.update({\n  id: '/public/$username',\n  path: '/public/$username',\n  getParentRoute: () => MasksRoute,\n} as any)\nconst MasksAdminUserIdRoute = MasksAdminUserIdRouteImport.update({\n  id: '/admin/$userId',\n  path: '/admin/$userId',\n  getParentRoute: () => MasksRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst groupSubfolderInsideRoute = groupSubfolderInsideRouteImport.update({\n  id: '/(group)/subfolder/inside',\n  path: '/subfolder/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({\n  id: '/insidelayout',\n  path: '/insidelayout',\n  getParentRoute: () => groupLayoutRoute,\n} as any)\nconst ParamsPsNonNestedFooRouteRoute =\n  ParamsPsNonNestedFooRouteRouteImport.update({\n    id: '/$foo_',\n    path: '/$foo',\n    getParentRoute: () => ParamsPsNonNestedRouteRoute,\n  } as any)\nconst ParamsPsNamedFooRouteRoute = ParamsPsNamedFooRouteRouteImport.update({\n  id: '/params-ps/named/$foo',\n  path: '/params-ps/named/$foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NonNestedSuffixChar123bazChar125suffixRouteRoute =\n  NonNestedSuffixChar123bazChar125suffixRouteRouteImport.update({\n    id: '/{$baz}suffix',\n    path: '/{$baz}suffix',\n    getParentRoute: () => NonNestedSuffixRouteRoute,\n  } as any)\nconst NonNestedPrefixPrefixChar123bazChar125RouteRoute =\n  NonNestedPrefixPrefixChar123bazChar125RouteRouteImport.update({\n    id: '/prefix{$baz}',\n    path: '/prefix{$baz}',\n    getParentRoute: () => NonNestedPrefixRouteRoute,\n  } as any)\nconst NonNestedPathBazRouteRoute = NonNestedPathBazRouteRouteImport.update({\n  id: '/baz',\n  path: '/baz',\n  getParentRoute: () => NonNestedPathRouteRoute,\n} as any)\nconst NonNestedNamedBazRouteRoute = NonNestedNamedBazRouteRouteImport.update({\n  id: '/$baz',\n  path: '/$baz',\n  getParentRoute: () => NonNestedNamedRouteRoute,\n} as any)\nconst NonNestedDeepBazRouteRoute = NonNestedDeepBazRouteRouteImport.update({\n  id: '/$baz',\n  path: '/$baz',\n  getParentRoute: () => NonNestedDeepRouteRoute,\n} as any)\nconst RelativeUseNavigateWithSearchIndexRoute =\n  RelativeUseNavigateWithSearchIndexRouteImport.update({\n    id: '/with-search/',\n    path: '/with-search/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeUseNavigatePathIndexRoute =\n  RelativeUseNavigatePathIndexRouteImport.update({\n    id: '/path/',\n    path: '/path/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeUseNavigateNestedIndexRoute =\n  RelativeUseNavigateNestedIndexRouteImport.update({\n    id: '/nested/',\n    path: '/nested/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeLinkWithSearchIndexRoute =\n  RelativeLinkWithSearchIndexRouteImport.update({\n    id: '/with-search/',\n    path: '/with-search/',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst RelativeLinkPathIndexRoute = RelativeLinkPathIndexRouteImport.update({\n  id: '/path/',\n  path: '/path/',\n  getParentRoute: () => RelativeLinkRouteRoute,\n} as any)\nconst RelativeLinkNestedIndexRoute = RelativeLinkNestedIndexRouteImport.update({\n  id: '/nested/',\n  path: '/nested/',\n  getParentRoute: () => RelativeLinkRouteRoute,\n} as any)\nconst NonNestedSuffixChar123bazChar125suffixIndexRoute =\n  NonNestedSuffixChar123bazChar125suffixIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,\n  } as any)\nconst NonNestedPrefixPrefixChar123bazChar125IndexRoute =\n  NonNestedPrefixPrefixChar123bazChar125IndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,\n  } as any)\nconst NonNestedPathBazIndexRoute = NonNestedPathBazIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NonNestedPathBazRouteRoute,\n} as any)\nconst NonNestedNamedBazIndexRoute = NonNestedNamedBazIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NonNestedNamedBazRouteRoute,\n} as any)\nconst NonNestedDeepBazIndexRoute = NonNestedDeepBazIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NonNestedDeepBazRouteRoute,\n} as any)\nconst ParamsPsNonNestedFooBarRoute = ParamsPsNonNestedFooBarRouteImport.update({\n  id: '/$bar',\n  path: '/$bar',\n  getParentRoute: () => ParamsPsNonNestedFooRouteRoute,\n} as any)\nconst NonNestedSuffixChar123bazChar125suffixBarRoute =\n  NonNestedSuffixChar123bazChar125suffixBarRouteImport.update({\n    id: '/{$baz}suffix_/bar',\n    path: '/{$baz}suffix/bar',\n    getParentRoute: () => NonNestedSuffixRouteRoute,\n  } as any)\nconst NonNestedSuffixChar123bazChar125suffixFooRoute =\n  NonNestedSuffixChar123bazChar125suffixFooRouteImport.update({\n    id: '/foo',\n    path: '/foo',\n    getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,\n  } as any)\nconst NonNestedPrefixPrefixChar123bazChar125BarRoute =\n  NonNestedPrefixPrefixChar123bazChar125BarRouteImport.update({\n    id: '/prefix{$baz}_/bar',\n    path: '/prefix{$baz}/bar',\n    getParentRoute: () => NonNestedPrefixRouteRoute,\n  } as any)\nconst NonNestedPrefixPrefixChar123bazChar125FooRoute =\n  NonNestedPrefixPrefixChar123bazChar125FooRouteImport.update({\n    id: '/foo',\n    path: '/foo',\n    getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,\n  } as any)\nconst NonNestedPathBazBarRoute = NonNestedPathBazBarRouteImport.update({\n  id: '/baz_/bar',\n  path: '/baz/bar',\n  getParentRoute: () => NonNestedPathRouteRoute,\n} as any)\nconst NonNestedPathBazFooRoute = NonNestedPathBazFooRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => NonNestedPathBazRouteRoute,\n} as any)\nconst NonNestedNamedBazBarRoute = NonNestedNamedBazBarRouteImport.update({\n  id: '/$baz_/bar',\n  path: '/$baz/bar',\n  getParentRoute: () => NonNestedNamedRouteRoute,\n} as any)\nconst NonNestedNamedBazFooRoute = NonNestedNamedBazFooRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => NonNestedNamedBazRouteRoute,\n} as any)\nconst ParamsPsNamedFooBarRouteRoute =\n  ParamsPsNamedFooBarRouteRouteImport.update({\n    id: '/$bar',\n    path: '/$bar',\n    getParentRoute: () => ParamsPsNamedFooRouteRoute,\n  } as any)\nconst NonNestedDeepBazBarRouteRoute =\n  NonNestedDeepBazBarRouteRouteImport.update({\n    id: '/$baz_/bar',\n    path: '/$baz/bar',\n    getParentRoute: () => NonNestedDeepRouteRoute,\n  } as any)\nconst RelativeUseNavigatePathPathIndexRoute =\n  RelativeUseNavigatePathPathIndexRouteImport.update({\n    id: '/path/$path/',\n    path: '/path/$path/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeUseNavigateNestedDeepIndexRoute =\n  RelativeUseNavigateNestedDeepIndexRouteImport.update({\n    id: '/nested/deep/',\n    path: '/nested/deep/',\n    getParentRoute: () => RelativeUseNavigateRouteRoute,\n  } as any)\nconst RelativeLinkPathPathIndexRoute =\n  RelativeLinkPathPathIndexRouteImport.update({\n    id: '/path/$path/',\n    path: '/path/$path/',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst RelativeLinkNestedDeepIndexRoute =\n  RelativeLinkNestedDeepIndexRouteImport.update({\n    id: '/nested/deep/',\n    path: '/nested/deep/',\n    getParentRoute: () => RelativeLinkRouteRoute,\n  } as any)\nconst NonNestedDeepBazBarIndexRoute =\n  NonNestedDeepBazBarIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NonNestedDeepBazBarRouteRoute,\n  } as any)\nconst ParamsPsNamedFooBarBazRoute = ParamsPsNamedFooBarBazRouteImport.update({\n  id: '/$baz',\n  path: '/$baz',\n  getParentRoute: () => ParamsPsNamedFooBarRouteRoute,\n} as any)\nconst NonNestedDeepBazBarQuxRoute = NonNestedDeepBazBarQuxRouteImport.update({\n  id: '/$baz_/bar_/qux',\n  path: '/$baz/bar/qux',\n  getParentRoute: () => NonNestedDeepRouteRoute,\n} as any)\nconst NonNestedDeepBazBarFooRouteRoute =\n  NonNestedDeepBazBarFooRouteRouteImport.update({\n    id: '/$foo',\n    path: '/$foo',\n    getParentRoute: () => NonNestedDeepBazBarRouteRoute,\n  } as any)\nconst NonNestedDeepBazBarFooIndexRoute =\n  NonNestedDeepBazBarFooIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => NonNestedDeepBazBarFooRouteRoute,\n  } as any)\nconst NonNestedDeepBazBarFooQuxRoute =\n  NonNestedDeepBazBarFooQuxRouteImport.update({\n    id: '/$foo_/qux',\n    path: '/$foo/qux',\n    getParentRoute: () => NonNestedDeepBazBarRouteRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/non-nested': typeof NonNestedRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren\n  '/anchor': typeof AnchorRoute\n  '/component-types-test': typeof ComponentTypesTestRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/hover-preload-hash': typeof HoverPreloadHashRoute\n  '/masks': typeof MasksRouteWithChildren\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren\n  '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren\n  '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren\n  '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren\n  '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren\n  '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren\n  '/relative/link': typeof RelativeLinkRouteRouteWithChildren\n  '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/params-ps/': typeof ParamsPsIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/relative/': typeof RelativeIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/non-nested/deep/$baz': typeof NonNestedDeepBazRouteRouteWithChildren\n  '/non-nested/named/$baz': typeof NonNestedNamedBazRouteRouteWithChildren\n  '/non-nested/path/baz': typeof NonNestedPathBazRouteRouteWithChildren\n  '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren\n  '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren\n  '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren\n  '/params-ps/non-nested/$foo': typeof ParamsPsNonNestedFooRouteRouteWithChildren\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/masks/admin/$userId': typeof MasksAdminUserIdRoute\n  '/masks/public/$username': typeof MasksPublicUsernameRoute\n  '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route\n  '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute\n  '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute\n  '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route\n  '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route\n  '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute\n  '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route\n  '/params/single/$value': typeof ParamsSingleValueRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/redirect/preload/first': typeof RedirectPreloadFirstRoute\n  '/redirect/preload/second': typeof RedirectPreloadSecondRoute\n  '/redirect/preload/third': typeof RedirectPreloadThirdRoute\n  '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute\n  '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute\n  '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute\n  '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute\n  '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute\n  '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute\n  '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute\n  '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute\n  '/params-ps/named/': typeof ParamsPsNamedIndexRoute\n  '/params-ps/wildcard/': typeof ParamsPsWildcardIndexRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/non-nested/deep/$baz/bar': typeof NonNestedDeepBazBarRouteRouteWithChildren\n  '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren\n  '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute\n  '/non-nested/named/$baz/bar': typeof NonNestedNamedBazBarRoute\n  '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute\n  '/non-nested/path/baz/bar': typeof NonNestedPathBazBarRoute\n  '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute\n  '/non-nested/prefix/prefix{$baz}/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute\n  '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute\n  '/non-nested/suffix/{$baz}suffix/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute\n  '/params-ps/non-nested/$foo/$bar': typeof ParamsPsNonNestedFooBarRoute\n  '/non-nested/deep/$baz/': typeof NonNestedDeepBazIndexRoute\n  '/non-nested/named/$baz/': typeof NonNestedNamedBazIndexRoute\n  '/non-nested/path/baz/': typeof NonNestedPathBazIndexRoute\n  '/non-nested/prefix/prefix{$baz}/': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute\n  '/non-nested/suffix/{$baz}suffix/': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute\n  '/relative/link/nested/': typeof RelativeLinkNestedIndexRoute\n  '/relative/link/path/': typeof RelativeLinkPathIndexRoute\n  '/relative/link/with-search/': typeof RelativeLinkWithSearchIndexRoute\n  '/relative/useNavigate/nested/': typeof RelativeUseNavigateNestedIndexRoute\n  '/relative/useNavigate/path/': typeof RelativeUseNavigatePathIndexRoute\n  '/relative/useNavigate/with-search/': typeof RelativeUseNavigateWithSearchIndexRoute\n  '/non-nested/deep/$baz/bar/$foo': typeof NonNestedDeepBazBarFooRouteRouteWithChildren\n  '/non-nested/deep/$baz/bar/qux': typeof NonNestedDeepBazBarQuxRoute\n  '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute\n  '/non-nested/deep/$baz/bar/': typeof NonNestedDeepBazBarIndexRoute\n  '/relative/link/nested/deep/': typeof RelativeLinkNestedDeepIndexRoute\n  '/relative/link/path/$path/': typeof RelativeLinkPathPathIndexRoute\n  '/relative/useNavigate/nested/deep/': typeof RelativeUseNavigateNestedDeepIndexRoute\n  '/relative/useNavigate/path/$path/': typeof RelativeUseNavigatePathPathIndexRoute\n  '/non-nested/deep/$baz/bar/$foo/qux': typeof NonNestedDeepBazBarFooQuxRoute\n  '/non-nested/deep/$baz/bar/$foo/': typeof NonNestedDeepBazBarFooIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/non-nested': typeof NonNestedRouteRouteWithChildren\n  '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren\n  '/anchor': typeof AnchorRoute\n  '/component-types-test': typeof ComponentTypesTestRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/hover-preload-hash': typeof HoverPreloadHashRoute\n  '/masks': typeof MasksRouteWithChildren\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/remountDeps': typeof RemountDepsRoute\n  '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren\n  '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren\n  '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren\n  '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren\n  '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren\n  '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren\n  '/relative/link': typeof RelativeLinkRouteRouteWithChildren\n  '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/params-ps': typeof ParamsPsIndexRoute\n  '/posts': typeof PostsIndexRoute\n  '/redirect': typeof RedirectIndexRoute\n  '/relative': typeof RelativeIndexRoute\n  '/search-params': typeof SearchParamsIndexRoute\n  '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren\n  '/params-ps/non-nested/$foo': typeof ParamsPsNonNestedFooRouteRouteWithChildren\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/masks/admin/$userId': typeof MasksAdminUserIdRoute\n  '/masks/public/$username': typeof MasksPublicUsernameRoute\n  '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route\n  '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute\n  '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute\n  '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route\n  '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route\n  '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute\n  '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route\n  '/params/single/$value': typeof ParamsSingleValueRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/redirect/preload/first': typeof RedirectPreloadFirstRoute\n  '/redirect/preload/second': typeof RedirectPreloadSecondRoute\n  '/redirect/preload/third': typeof RedirectPreloadThirdRoute\n  '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute\n  '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute\n  '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute\n  '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute\n  '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute\n  '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute\n  '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute\n  '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute\n  '/params-ps/named': typeof ParamsPsNamedIndexRoute\n  '/params-ps/wildcard': typeof ParamsPsWildcardIndexRoute\n  '/redirect/$target': typeof RedirectTargetIndexRoute\n  '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren\n  '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute\n  '/non-nested/named/$baz/bar': typeof NonNestedNamedBazBarRoute\n  '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute\n  '/non-nested/path/baz/bar': typeof NonNestedPathBazBarRoute\n  '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute\n  '/non-nested/prefix/prefix{$baz}/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute\n  '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute\n  '/non-nested/suffix/{$baz}suffix/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute\n  '/params-ps/non-nested/$foo/$bar': typeof ParamsPsNonNestedFooBarRoute\n  '/non-nested/deep/$baz': typeof NonNestedDeepBazIndexRoute\n  '/non-nested/named/$baz': typeof NonNestedNamedBazIndexRoute\n  '/non-nested/path/baz': typeof NonNestedPathBazIndexRoute\n  '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute\n  '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute\n  '/relative/link/nested': typeof RelativeLinkNestedIndexRoute\n  '/relative/link/path': typeof RelativeLinkPathIndexRoute\n  '/relative/link/with-search': typeof RelativeLinkWithSearchIndexRoute\n  '/relative/useNavigate/nested': typeof RelativeUseNavigateNestedIndexRoute\n  '/relative/useNavigate/path': typeof RelativeUseNavigatePathIndexRoute\n  '/relative/useNavigate/with-search': typeof RelativeUseNavigateWithSearchIndexRoute\n  '/non-nested/deep/$baz/bar/qux': typeof NonNestedDeepBazBarQuxRoute\n  '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute\n  '/non-nested/deep/$baz/bar': typeof NonNestedDeepBazBarIndexRoute\n  '/relative/link/nested/deep': typeof RelativeLinkNestedDeepIndexRoute\n  '/relative/link/path/$path': typeof RelativeLinkPathPathIndexRoute\n  '/relative/useNavigate/nested/deep': typeof RelativeUseNavigateNestedDeepIndexRoute\n  '/relative/useNavigate/path/$path': typeof RelativeUseNavigatePathPathIndexRoute\n  '/non-nested/deep/$baz/bar/$foo/qux': typeof NonNestedDeepBazBarFooQuxRoute\n  '/non-nested/deep/$baz/bar/$foo': typeof NonNestedDeepBazBarFooIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/non-nested': typeof NonNestedRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren\n  '/_layout': typeof LayoutRouteWithChildren\n  '/anchor': typeof AnchorRoute\n  '/component-types-test': typeof ComponentTypesTestRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/hover-preload-hash': typeof HoverPreloadHashRoute\n  '/masks': typeof MasksRouteWithChildren\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren\n  '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren\n  '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren\n  '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren\n  '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren\n  '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren\n  '/relative/link': typeof RelativeLinkRouteRouteWithChildren\n  '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren\n  '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/inside': typeof groupInsideRoute\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/params-ps/': typeof ParamsPsIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/relative/': typeof RelativeIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/non-nested/deep/$baz': typeof NonNestedDeepBazRouteRouteWithChildren\n  '/non-nested/named/$baz': typeof NonNestedNamedBazRouteRouteWithChildren\n  '/non-nested/path/baz': typeof NonNestedPathBazRouteRouteWithChildren\n  '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren\n  '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren\n  '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren\n  '/params-ps/non-nested/$foo_': typeof ParamsPsNonNestedFooRouteRouteWithChildren\n  '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/masks/admin/$userId': typeof MasksAdminUserIdRoute\n  '/masks/public/$username': typeof MasksPublicUsernameRoute\n  '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route\n  '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute\n  '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute\n  '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route\n  '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route\n  '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute\n  '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route\n  '/params/single/$value': typeof ParamsSingleValueRoute\n  '/posts_/$postId/edit': typeof PostsPostIdEditRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/redirect/preload/first': typeof RedirectPreloadFirstRoute\n  '/redirect/preload/second': typeof RedirectPreloadSecondRoute\n  '/redirect/preload/third': typeof RedirectPreloadThirdRoute\n  '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute\n  '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute\n  '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute\n  '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute\n  '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute\n  '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute\n  '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute\n  '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute\n  '/params-ps/named/': typeof ParamsPsNamedIndexRoute\n  '/params-ps/wildcard/': typeof ParamsPsWildcardIndexRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/non-nested/deep/$baz_/bar': typeof NonNestedDeepBazBarRouteRouteWithChildren\n  '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren\n  '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute\n  '/non-nested/named/$baz_/bar': typeof NonNestedNamedBazBarRoute\n  '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute\n  '/non-nested/path/baz_/bar': typeof NonNestedPathBazBarRoute\n  '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute\n  '/non-nested/prefix/prefix{$baz}_/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute\n  '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute\n  '/non-nested/suffix/{$baz}suffix_/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute\n  '/params-ps/non-nested/$foo_/$bar': typeof ParamsPsNonNestedFooBarRoute\n  '/non-nested/deep/$baz/': typeof NonNestedDeepBazIndexRoute\n  '/non-nested/named/$baz/': typeof NonNestedNamedBazIndexRoute\n  '/non-nested/path/baz/': typeof NonNestedPathBazIndexRoute\n  '/non-nested/prefix/prefix{$baz}/': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute\n  '/non-nested/suffix/{$baz}suffix/': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute\n  '/relative/link/nested/': typeof RelativeLinkNestedIndexRoute\n  '/relative/link/path/': typeof RelativeLinkPathIndexRoute\n  '/relative/link/with-search/': typeof RelativeLinkWithSearchIndexRoute\n  '/relative/useNavigate/nested/': typeof RelativeUseNavigateNestedIndexRoute\n  '/relative/useNavigate/path/': typeof RelativeUseNavigatePathIndexRoute\n  '/relative/useNavigate/with-search/': typeof RelativeUseNavigateWithSearchIndexRoute\n  '/non-nested/deep/$baz_/bar/$foo': typeof NonNestedDeepBazBarFooRouteRouteWithChildren\n  '/non-nested/deep/$baz_/bar_/qux': typeof NonNestedDeepBazBarQuxRoute\n  '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute\n  '/non-nested/deep/$baz_/bar/': typeof NonNestedDeepBazBarIndexRoute\n  '/relative/link/nested/deep/': typeof RelativeLinkNestedDeepIndexRoute\n  '/relative/link/path/$path/': typeof RelativeLinkPathPathIndexRoute\n  '/relative/useNavigate/nested/deep/': typeof RelativeUseNavigateNestedDeepIndexRoute\n  '/relative/useNavigate/path/$path/': typeof RelativeUseNavigatePathPathIndexRoute\n  '/non-nested/deep/$baz_/bar/$foo_/qux': typeof NonNestedDeepBazBarFooQuxRoute\n  '/non-nested/deep/$baz_/bar/$foo/': typeof NonNestedDeepBazBarFooIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/non-nested'\n    | '/search-params'\n    | '/대한민국'\n    | '/anchor'\n    | '/component-types-test'\n    | '/editing-a'\n    | '/editing-b'\n    | '/hover-preload-hash'\n    | '/masks'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/non-nested/deep'\n    | '/non-nested/named'\n    | '/non-nested/path'\n    | '/non-nested/prefix'\n    | '/non-nested/suffix'\n    | '/params-ps/non-nested'\n    | '/relative/link'\n    | '/relative/useNavigate'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/params-ps/'\n    | '/posts/'\n    | '/redirect/'\n    | '/relative/'\n    | '/search-params/'\n    | '/non-nested/deep/$baz'\n    | '/non-nested/named/$baz'\n    | '/non-nested/path/baz'\n    | '/non-nested/prefix/prefix{$baz}'\n    | '/non-nested/suffix/{$baz}suffix'\n    | '/params-ps/named/$foo'\n    | '/params-ps/non-nested/$foo'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/masks/admin/$userId'\n    | '/masks/public/$username'\n    | '/params-ps/named/prefix{$foo}'\n    | '/params-ps/named/{$foo}suffix'\n    | '/params-ps/wildcard/$'\n    | '/params-ps/wildcard/prefix@대{$}'\n    | '/params-ps/wildcard/prefix{$}'\n    | '/params-ps/wildcard/{$}suffix'\n    | '/params-ps/wildcard/{$}suffix@대'\n    | '/params/single/$value'\n    | '/posts/$postId/edit'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/redirect/preload/first'\n    | '/redirect/preload/second'\n    | '/redirect/preload/third'\n    | '/relative/link/relative-link-a'\n    | '/relative/link/relative-link-b'\n    | '/relative/useNavigate/relative-useNavigate-a'\n    | '/relative/useNavigate/relative-useNavigate-b'\n    | '/transition/count/create-resource'\n    | '/transition/typing/create-resource'\n    | '/대한민국/wildcard/$'\n    | '/대한민국/🚀/$id'\n    | '/params-ps/named/'\n    | '/params-ps/wildcard/'\n    | '/redirect/$target/'\n    | '/non-nested/deep/$baz/bar'\n    | '/params-ps/named/$foo/$bar'\n    | '/non-nested/named/$baz/foo'\n    | '/non-nested/named/$baz/bar'\n    | '/non-nested/path/baz/foo'\n    | '/non-nested/path/baz/bar'\n    | '/non-nested/prefix/prefix{$baz}/foo'\n    | '/non-nested/prefix/prefix{$baz}/bar'\n    | '/non-nested/suffix/{$baz}suffix/foo'\n    | '/non-nested/suffix/{$baz}suffix/bar'\n    | '/params-ps/non-nested/$foo/$bar'\n    | '/non-nested/deep/$baz/'\n    | '/non-nested/named/$baz/'\n    | '/non-nested/path/baz/'\n    | '/non-nested/prefix/prefix{$baz}/'\n    | '/non-nested/suffix/{$baz}suffix/'\n    | '/relative/link/nested/'\n    | '/relative/link/path/'\n    | '/relative/link/with-search/'\n    | '/relative/useNavigate/nested/'\n    | '/relative/useNavigate/path/'\n    | '/relative/useNavigate/with-search/'\n    | '/non-nested/deep/$baz/bar/$foo'\n    | '/non-nested/deep/$baz/bar/qux'\n    | '/params-ps/named/$foo/$bar/$baz'\n    | '/non-nested/deep/$baz/bar/'\n    | '/relative/link/nested/deep/'\n    | '/relative/link/path/$path/'\n    | '/relative/useNavigate/nested/deep/'\n    | '/relative/useNavigate/path/$path/'\n    | '/non-nested/deep/$baz/bar/$foo/qux'\n    | '/non-nested/deep/$baz/bar/$foo/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/non-nested'\n    | '/대한민국'\n    | '/anchor'\n    | '/component-types-test'\n    | '/editing-a'\n    | '/editing-b'\n    | '/hover-preload-hash'\n    | '/masks'\n    | '/notRemountDeps'\n    | '/remountDeps'\n    | '/non-nested/deep'\n    | '/non-nested/named'\n    | '/non-nested/path'\n    | '/non-nested/prefix'\n    | '/non-nested/suffix'\n    | '/params-ps/non-nested'\n    | '/relative/link'\n    | '/relative/useNavigate'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/search-params/default'\n    | '/params-ps'\n    | '/posts'\n    | '/redirect'\n    | '/relative'\n    | '/search-params'\n    | '/params-ps/named/$foo'\n    | '/params-ps/non-nested/$foo'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/masks/admin/$userId'\n    | '/masks/public/$username'\n    | '/params-ps/named/prefix{$foo}'\n    | '/params-ps/named/{$foo}suffix'\n    | '/params-ps/wildcard/$'\n    | '/params-ps/wildcard/prefix@대{$}'\n    | '/params-ps/wildcard/prefix{$}'\n    | '/params-ps/wildcard/{$}suffix'\n    | '/params-ps/wildcard/{$}suffix@대'\n    | '/params/single/$value'\n    | '/posts/$postId/edit'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/redirect/preload/first'\n    | '/redirect/preload/second'\n    | '/redirect/preload/third'\n    | '/relative/link/relative-link-a'\n    | '/relative/link/relative-link-b'\n    | '/relative/useNavigate/relative-useNavigate-a'\n    | '/relative/useNavigate/relative-useNavigate-b'\n    | '/transition/count/create-resource'\n    | '/transition/typing/create-resource'\n    | '/대한민국/wildcard/$'\n    | '/대한민국/🚀/$id'\n    | '/params-ps/named'\n    | '/params-ps/wildcard'\n    | '/redirect/$target'\n    | '/params-ps/named/$foo/$bar'\n    | '/non-nested/named/$baz/foo'\n    | '/non-nested/named/$baz/bar'\n    | '/non-nested/path/baz/foo'\n    | '/non-nested/path/baz/bar'\n    | '/non-nested/prefix/prefix{$baz}/foo'\n    | '/non-nested/prefix/prefix{$baz}/bar'\n    | '/non-nested/suffix/{$baz}suffix/foo'\n    | '/non-nested/suffix/{$baz}suffix/bar'\n    | '/params-ps/non-nested/$foo/$bar'\n    | '/non-nested/deep/$baz'\n    | '/non-nested/named/$baz'\n    | '/non-nested/path/baz'\n    | '/non-nested/prefix/prefix{$baz}'\n    | '/non-nested/suffix/{$baz}suffix'\n    | '/relative/link/nested'\n    | '/relative/link/path'\n    | '/relative/link/with-search'\n    | '/relative/useNavigate/nested'\n    | '/relative/useNavigate/path'\n    | '/relative/useNavigate/with-search'\n    | '/non-nested/deep/$baz/bar/qux'\n    | '/params-ps/named/$foo/$bar/$baz'\n    | '/non-nested/deep/$baz/bar'\n    | '/relative/link/nested/deep'\n    | '/relative/link/path/$path'\n    | '/relative/useNavigate/nested/deep'\n    | '/relative/useNavigate/path/$path'\n    | '/non-nested/deep/$baz/bar/$foo/qux'\n    | '/non-nested/deep/$baz/bar/$foo'\n  id:\n    | '__root__'\n    | '/'\n    | '/non-nested'\n    | '/search-params'\n    | '/대한민국'\n    | '/_layout'\n    | '/anchor'\n    | '/component-types-test'\n    | '/editing-a'\n    | '/editing-b'\n    | '/hover-preload-hash'\n    | '/masks'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/non-nested/deep'\n    | '/non-nested/named'\n    | '/non-nested/path'\n    | '/non-nested/prefix'\n    | '/non-nested/suffix'\n    | '/params-ps/non-nested'\n    | '/relative/link'\n    | '/relative/useNavigate'\n    | '/(another-group)/onlyrouteinside'\n    | '/(group)/_layout'\n    | '/(group)/inside'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/params-ps/'\n    | '/posts/'\n    | '/redirect/'\n    | '/relative/'\n    | '/search-params/'\n    | '/non-nested/deep/$baz'\n    | '/non-nested/named/$baz'\n    | '/non-nested/path/baz'\n    | '/non-nested/prefix/prefix{$baz}'\n    | '/non-nested/suffix/{$baz}suffix'\n    | '/params-ps/named/$foo'\n    | '/params-ps/non-nested/$foo_'\n    | '/(group)/_layout/insidelayout'\n    | '/(group)/subfolder/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/masks/admin/$userId'\n    | '/masks/public/$username'\n    | '/params-ps/named/prefix{$foo}'\n    | '/params-ps/named/{$foo}suffix'\n    | '/params-ps/wildcard/$'\n    | '/params-ps/wildcard/prefix@대{$}'\n    | '/params-ps/wildcard/prefix{$}'\n    | '/params-ps/wildcard/{$}suffix'\n    | '/params-ps/wildcard/{$}suffix@대'\n    | '/params/single/$value'\n    | '/posts_/$postId/edit'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/redirect/preload/first'\n    | '/redirect/preload/second'\n    | '/redirect/preload/third'\n    | '/relative/link/relative-link-a'\n    | '/relative/link/relative-link-b'\n    | '/relative/useNavigate/relative-useNavigate-a'\n    | '/relative/useNavigate/relative-useNavigate-b'\n    | '/transition/count/create-resource'\n    | '/transition/typing/create-resource'\n    | '/대한민국/wildcard/$'\n    | '/대한민국/🚀/$id'\n    | '/params-ps/named/'\n    | '/params-ps/wildcard/'\n    | '/redirect/$target/'\n    | '/non-nested/deep/$baz_/bar'\n    | '/params-ps/named/$foo/$bar'\n    | '/non-nested/named/$baz/foo'\n    | '/non-nested/named/$baz_/bar'\n    | '/non-nested/path/baz/foo'\n    | '/non-nested/path/baz_/bar'\n    | '/non-nested/prefix/prefix{$baz}/foo'\n    | '/non-nested/prefix/prefix{$baz}_/bar'\n    | '/non-nested/suffix/{$baz}suffix/foo'\n    | '/non-nested/suffix/{$baz}suffix_/bar'\n    | '/params-ps/non-nested/$foo_/$bar'\n    | '/non-nested/deep/$baz/'\n    | '/non-nested/named/$baz/'\n    | '/non-nested/path/baz/'\n    | '/non-nested/prefix/prefix{$baz}/'\n    | '/non-nested/suffix/{$baz}suffix/'\n    | '/relative/link/nested/'\n    | '/relative/link/path/'\n    | '/relative/link/with-search/'\n    | '/relative/useNavigate/nested/'\n    | '/relative/useNavigate/path/'\n    | '/relative/useNavigate/with-search/'\n    | '/non-nested/deep/$baz_/bar/$foo'\n    | '/non-nested/deep/$baz_/bar_/qux'\n    | '/params-ps/named/$foo/$bar/$baz'\n    | '/non-nested/deep/$baz_/bar/'\n    | '/relative/link/nested/deep/'\n    | '/relative/link/path/$path/'\n    | '/relative/useNavigate/nested/deep/'\n    | '/relative/useNavigate/path/$path/'\n    | '/non-nested/deep/$baz_/bar/$foo_/qux'\n    | '/non-nested/deep/$baz_/bar/$foo/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  NonNestedRouteRoute: typeof NonNestedRouteRouteWithChildren\n  SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren\n  Char45824Char54620Char48124Char44397RouteRoute: typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren\n  LayoutRoute: typeof LayoutRouteWithChildren\n  AnchorRoute: typeof AnchorRoute\n  ComponentTypesTestRoute: typeof ComponentTypesTestRoute\n  EditingARoute: typeof EditingARoute\n  EditingBRoute: typeof EditingBRoute\n  HoverPreloadHashRoute: typeof HoverPreloadHashRoute\n  MasksRoute: typeof MasksRouteWithChildren\n  NotRemountDepsRoute: typeof NotRemountDepsRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RemountDepsRoute: typeof RemountDepsRoute\n  ParamsPsNonNestedRouteRoute: typeof ParamsPsNonNestedRouteRouteWithChildren\n  RelativeLinkRouteRoute: typeof RelativeLinkRouteRouteWithChildren\n  RelativeUseNavigateRouteRoute: typeof RelativeUseNavigateRouteRouteWithChildren\n  anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupInsideRoute: typeof groupInsideRoute\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n  RedirectTargetRoute: typeof RedirectTargetRouteWithChildren\n  ParamsPsIndexRoute: typeof ParamsPsIndexRoute\n  RedirectIndexRoute: typeof RedirectIndexRoute\n  RelativeIndexRoute: typeof RelativeIndexRoute\n  ParamsPsNamedFooRouteRoute: typeof ParamsPsNamedFooRouteRouteWithChildren\n  groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute\n  ParamsPsNamedPrefixChar123fooChar125Route: typeof ParamsPsNamedPrefixChar123fooChar125Route\n  ParamsPsNamedChar123fooChar125suffixRoute: typeof ParamsPsNamedChar123fooChar125suffixRoute\n  ParamsPsWildcardSplatRoute: typeof ParamsPsWildcardSplatRoute\n  ParamsPsWildcardPrefixAtChar45824Char123Char125Route: typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route\n  ParamsPsWildcardPrefixChar123Char125Route: typeof ParamsPsWildcardPrefixChar123Char125Route\n  ParamsPsWildcardChar123Char125suffixRoute: typeof ParamsPsWildcardChar123Char125suffixRoute\n  ParamsPsWildcardChar123Char125suffixAtChar45824Route: typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route\n  ParamsSingleValueRoute: typeof ParamsSingleValueRoute\n  PostsPostIdEditRoute: typeof PostsPostIdEditRoute\n  RedirectPreloadFirstRoute: typeof RedirectPreloadFirstRoute\n  RedirectPreloadSecondRoute: typeof RedirectPreloadSecondRoute\n  RedirectPreloadThirdRoute: typeof RedirectPreloadThirdRoute\n  TransitionCountCreateResourceRoute: typeof TransitionCountCreateResourceRoute\n  TransitionTypingCreateResourceRoute: typeof TransitionTypingCreateResourceRoute\n  ParamsPsNamedIndexRoute: typeof ParamsPsNamedIndexRoute\n  ParamsPsWildcardIndexRoute: typeof ParamsPsWildcardIndexRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/remountDeps': {\n      id: '/remountDeps'\n      path: '/remountDeps'\n      fullPath: '/remountDeps'\n      preLoaderRoute: typeof RemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/notRemountDeps': {\n      id: '/notRemountDeps'\n      path: '/notRemountDeps'\n      fullPath: '/notRemountDeps'\n      preLoaderRoute: typeof NotRemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/masks': {\n      id: '/masks'\n      path: '/masks'\n      fullPath: '/masks'\n      preLoaderRoute: typeof MasksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/hover-preload-hash': {\n      id: '/hover-preload-hash'\n      path: '/hover-preload-hash'\n      fullPath: '/hover-preload-hash'\n      preLoaderRoute: typeof HoverPreloadHashRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-b': {\n      id: '/editing-b'\n      path: '/editing-b'\n      fullPath: '/editing-b'\n      preLoaderRoute: typeof EditingBRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-a': {\n      id: '/editing-a'\n      path: '/editing-a'\n      fullPath: '/editing-a'\n      preLoaderRoute: typeof EditingARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/component-types-test': {\n      id: '/component-types-test'\n      path: '/component-types-test'\n      fullPath: '/component-types-test'\n      preLoaderRoute: typeof ComponentTypesTestRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/anchor': {\n      id: '/anchor'\n      path: '/anchor'\n      fullPath: '/anchor'\n      preLoaderRoute: typeof AnchorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/대한민국': {\n      id: '/대한민국'\n      path: '/대한민국'\n      fullPath: '/대한민국'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params': {\n      id: '/search-params'\n      path: '/search-params'\n      fullPath: '/search-params'\n      preLoaderRoute: typeof SearchParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/non-nested': {\n      id: '/non-nested'\n      path: '/non-nested'\n      fullPath: '/non-nested'\n      preLoaderRoute: typeof NonNestedRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params/': {\n      id: '/search-params/'\n      path: '/'\n      fullPath: '/search-params/'\n      preLoaderRoute: typeof SearchParamsIndexRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/relative/': {\n      id: '/relative/'\n      path: '/relative'\n      fullPath: '/relative/'\n      preLoaderRoute: typeof RelativeIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect/': {\n      id: '/redirect/'\n      path: '/redirect'\n      fullPath: '/redirect/'\n      preLoaderRoute: typeof RedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/params-ps/': {\n      id: '/params-ps/'\n      path: '/params-ps'\n      fullPath: '/params-ps/'\n      preLoaderRoute: typeof ParamsPsIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params/default': {\n      id: '/search-params/default'\n      path: '/default'\n      fullPath: '/search-params/default'\n      preLoaderRoute: typeof SearchParamsDefaultRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/redirect/$target': {\n      id: '/redirect/$target'\n      path: '/redirect/$target'\n      fullPath: '/redirect/$target'\n      preLoaderRoute: typeof RedirectTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/inside': {\n      id: '/(group)/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(another-group)/onlyrouteinside': {\n      id: '/(another-group)/onlyrouteinside'\n      path: '/onlyrouteinside'\n      fullPath: '/onlyrouteinside'\n      preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/relative/useNavigate': {\n      id: '/relative/useNavigate'\n      path: '/relative/useNavigate'\n      fullPath: '/relative/useNavigate'\n      preLoaderRoute: typeof RelativeUseNavigateRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/relative/link': {\n      id: '/relative/link'\n      path: '/relative/link'\n      fullPath: '/relative/link'\n      preLoaderRoute: typeof RelativeLinkRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/non-nested': {\n      id: '/params-ps/non-nested'\n      path: '/params-ps/non-nested'\n      fullPath: '/params-ps/non-nested'\n      preLoaderRoute: typeof ParamsPsNonNestedRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/non-nested/suffix': {\n      id: '/non-nested/suffix'\n      path: '/suffix'\n      fullPath: '/non-nested/suffix'\n      preLoaderRoute: typeof NonNestedSuffixRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/non-nested/prefix': {\n      id: '/non-nested/prefix'\n      path: '/prefix'\n      fullPath: '/non-nested/prefix'\n      preLoaderRoute: typeof NonNestedPrefixRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/non-nested/path': {\n      id: '/non-nested/path'\n      path: '/path'\n      fullPath: '/non-nested/path'\n      preLoaderRoute: typeof NonNestedPathRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/non-nested/named': {\n      id: '/non-nested/named'\n      path: '/named'\n      fullPath: '/non-nested/named'\n      preLoaderRoute: typeof NonNestedNamedRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/non-nested/deep': {\n      id: '/non-nested/deep'\n      path: '/deep'\n      fullPath: '/non-nested/deep'\n      preLoaderRoute: typeof NonNestedDeepRouteRouteImport\n      parentRoute: typeof NonNestedRouteRoute\n    }\n    '/redirect/$target/': {\n      id: '/redirect/$target/'\n      path: '/'\n      fullPath: '/redirect/$target/'\n      preLoaderRoute: typeof RedirectTargetIndexRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/params-ps/wildcard/': {\n      id: '/params-ps/wildcard/'\n      path: '/params-ps/wildcard'\n      fullPath: '/params-ps/wildcard/'\n      preLoaderRoute: typeof ParamsPsWildcardIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/named/': {\n      id: '/params-ps/named/'\n      path: '/params-ps/named'\n      fullPath: '/params-ps/named/'\n      preLoaderRoute: typeof ParamsPsNamedIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/대한민국/🚀/$id': {\n      id: '/대한민국/🚀/$id'\n      path: '/🚀/$id'\n      fullPath: '/대한민국/🚀/$id'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport\n      parentRoute: typeof Char45824Char54620Char48124Char44397RouteRoute\n    }\n    '/대한민국/wildcard/$': {\n      id: '/대한민국/wildcard/$'\n      path: '/wildcard/$'\n      fullPath: '/대한민국/wildcard/$'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRouteImport\n      parentRoute: typeof Char45824Char54620Char48124Char44397RouteRoute\n    }\n    '/transition/typing/create-resource': {\n      id: '/transition/typing/create-resource'\n      path: '/transition/typing/create-resource'\n      fullPath: '/transition/typing/create-resource'\n      preLoaderRoute: typeof TransitionTypingCreateResourceRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/transition/count/create-resource': {\n      id: '/transition/count/create-resource'\n      path: '/transition/count/create-resource'\n      fullPath: '/transition/count/create-resource'\n      preLoaderRoute: typeof TransitionCountCreateResourceRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/relative/useNavigate/relative-useNavigate-b': {\n      id: '/relative/useNavigate/relative-useNavigate-b'\n      path: '/relative-useNavigate-b'\n      fullPath: '/relative/useNavigate/relative-useNavigate-b'\n      preLoaderRoute: typeof RelativeUseNavigateRelativeUseNavigateBRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/useNavigate/relative-useNavigate-a': {\n      id: '/relative/useNavigate/relative-useNavigate-a'\n      path: '/relative-useNavigate-a'\n      fullPath: '/relative/useNavigate/relative-useNavigate-a'\n      preLoaderRoute: typeof RelativeUseNavigateRelativeUseNavigateARouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/link/relative-link-b': {\n      id: '/relative/link/relative-link-b'\n      path: '/relative-link-b'\n      fullPath: '/relative/link/relative-link-b'\n      preLoaderRoute: typeof RelativeLinkRelativeLinkBRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/relative/link/relative-link-a': {\n      id: '/relative/link/relative-link-a'\n      path: '/relative-link-a'\n      fullPath: '/relative/link/relative-link-a'\n      preLoaderRoute: typeof RelativeLinkRelativeLinkARouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/redirect/preload/third': {\n      id: '/redirect/preload/third'\n      path: '/redirect/preload/third'\n      fullPath: '/redirect/preload/third'\n      preLoaderRoute: typeof RedirectPreloadThirdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect/preload/second': {\n      id: '/redirect/preload/second'\n      path: '/redirect/preload/second'\n      fullPath: '/redirect/preload/second'\n      preLoaderRoute: typeof RedirectPreloadSecondRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect/preload/first': {\n      id: '/redirect/preload/first'\n      path: '/redirect/preload/first'\n      fullPath: '/redirect/preload/first'\n      preLoaderRoute: typeof RedirectPreloadFirstRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect/$target/via-loader': {\n      id: '/redirect/$target/via-loader'\n      path: '/via-loader'\n      fullPath: '/redirect/$target/via-loader'\n      preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-beforeLoad': {\n      id: '/redirect/$target/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/redirect/$target/via-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/posts_/$postId/edit': {\n      id: '/posts_/$postId/edit'\n      path: '/posts/$postId/edit'\n      fullPath: '/posts/$postId/edit'\n      preLoaderRoute: typeof PostsPostIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params/single/$value': {\n      id: '/params/single/$value'\n      path: '/params/single/$value'\n      fullPath: '/params/single/$value'\n      preLoaderRoute: typeof ParamsSingleValueRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/{$}suffix@대': {\n      id: '/params-ps/wildcard/{$}suffix@대'\n      path: '/params-ps/wildcard/{$}suffix@대'\n      fullPath: '/params-ps/wildcard/{$}suffix@대'\n      preLoaderRoute: typeof ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/{$}suffix': {\n      id: '/params-ps/wildcard/{$}suffix'\n      path: '/params-ps/wildcard/{$}suffix'\n      fullPath: '/params-ps/wildcard/{$}suffix'\n      preLoaderRoute: typeof ParamsPsWildcardChar123Char125suffixRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/prefix{$}': {\n      id: '/params-ps/wildcard/prefix{$}'\n      path: '/params-ps/wildcard/prefix{$}'\n      fullPath: '/params-ps/wildcard/prefix{$}'\n      preLoaderRoute: typeof ParamsPsWildcardPrefixChar123Char125RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/prefix@대{$}': {\n      id: '/params-ps/wildcard/prefix@대{$}'\n      path: '/params-ps/wildcard/prefix@대{$}'\n      fullPath: '/params-ps/wildcard/prefix@대{$}'\n      preLoaderRoute: typeof ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/wildcard/$': {\n      id: '/params-ps/wildcard/$'\n      path: '/params-ps/wildcard/$'\n      fullPath: '/params-ps/wildcard/$'\n      preLoaderRoute: typeof ParamsPsWildcardSplatRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/named/{$foo}suffix': {\n      id: '/params-ps/named/{$foo}suffix'\n      path: '/params-ps/named/{$foo}suffix'\n      fullPath: '/params-ps/named/{$foo}suffix'\n      preLoaderRoute: typeof ParamsPsNamedChar123fooChar125suffixRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params-ps/named/prefix{$foo}': {\n      id: '/params-ps/named/prefix{$foo}'\n      path: '/params-ps/named/prefix{$foo}'\n      fullPath: '/params-ps/named/prefix{$foo}'\n      preLoaderRoute: typeof ParamsPsNamedPrefixChar123fooChar125RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/masks/public/$username': {\n      id: '/masks/public/$username'\n      path: '/public/$username'\n      fullPath: '/masks/public/$username'\n      preLoaderRoute: typeof MasksPublicUsernameRouteImport\n      parentRoute: typeof MasksRoute\n    }\n    '/masks/admin/$userId': {\n      id: '/masks/admin/$userId'\n      path: '/admin/$userId'\n      fullPath: '/masks/admin/$userId'\n      preLoaderRoute: typeof MasksAdminUserIdRouteImport\n      parentRoute: typeof MasksRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/(group)/subfolder/inside': {\n      id: '/(group)/subfolder/inside'\n      path: '/subfolder/inside'\n      fullPath: '/subfolder/inside'\n      preLoaderRoute: typeof groupSubfolderInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout/insidelayout': {\n      id: '/(group)/_layout/insidelayout'\n      path: '/insidelayout'\n      fullPath: '/insidelayout'\n      preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport\n      parentRoute: typeof groupLayoutRoute\n    }\n    '/params-ps/non-nested/$foo_': {\n      id: '/params-ps/non-nested/$foo_'\n      path: '/$foo'\n      fullPath: '/params-ps/non-nested/$foo'\n      preLoaderRoute: typeof ParamsPsNonNestedFooRouteRouteImport\n      parentRoute: typeof ParamsPsNonNestedRouteRoute\n    }\n    '/params-ps/named/$foo': {\n      id: '/params-ps/named/$foo'\n      path: '/params-ps/named/$foo'\n      fullPath: '/params-ps/named/$foo'\n      preLoaderRoute: typeof ParamsPsNamedFooRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/non-nested/suffix/{$baz}suffix': {\n      id: '/non-nested/suffix/{$baz}suffix'\n      path: '/{$baz}suffix'\n      fullPath: '/non-nested/suffix/{$baz}suffix'\n      preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteImport\n      parentRoute: typeof NonNestedSuffixRouteRoute\n    }\n    '/non-nested/prefix/prefix{$baz}': {\n      id: '/non-nested/prefix/prefix{$baz}'\n      path: '/prefix{$baz}'\n      fullPath: '/non-nested/prefix/prefix{$baz}'\n      preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteImport\n      parentRoute: typeof NonNestedPrefixRouteRoute\n    }\n    '/non-nested/path/baz': {\n      id: '/non-nested/path/baz'\n      path: '/baz'\n      fullPath: '/non-nested/path/baz'\n      preLoaderRoute: typeof NonNestedPathBazRouteRouteImport\n      parentRoute: typeof NonNestedPathRouteRoute\n    }\n    '/non-nested/named/$baz': {\n      id: '/non-nested/named/$baz'\n      path: '/$baz'\n      fullPath: '/non-nested/named/$baz'\n      preLoaderRoute: typeof NonNestedNamedBazRouteRouteImport\n      parentRoute: typeof NonNestedNamedRouteRoute\n    }\n    '/non-nested/deep/$baz': {\n      id: '/non-nested/deep/$baz'\n      path: '/$baz'\n      fullPath: '/non-nested/deep/$baz'\n      preLoaderRoute: typeof NonNestedDeepBazRouteRouteImport\n      parentRoute: typeof NonNestedDeepRouteRoute\n    }\n    '/relative/useNavigate/with-search/': {\n      id: '/relative/useNavigate/with-search/'\n      path: '/with-search'\n      fullPath: '/relative/useNavigate/with-search/'\n      preLoaderRoute: typeof RelativeUseNavigateWithSearchIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/useNavigate/path/': {\n      id: '/relative/useNavigate/path/'\n      path: '/path'\n      fullPath: '/relative/useNavigate/path/'\n      preLoaderRoute: typeof RelativeUseNavigatePathIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/useNavigate/nested/': {\n      id: '/relative/useNavigate/nested/'\n      path: '/nested'\n      fullPath: '/relative/useNavigate/nested/'\n      preLoaderRoute: typeof RelativeUseNavigateNestedIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/link/with-search/': {\n      id: '/relative/link/with-search/'\n      path: '/with-search'\n      fullPath: '/relative/link/with-search/'\n      preLoaderRoute: typeof RelativeLinkWithSearchIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/relative/link/path/': {\n      id: '/relative/link/path/'\n      path: '/path'\n      fullPath: '/relative/link/path/'\n      preLoaderRoute: typeof RelativeLinkPathIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/relative/link/nested/': {\n      id: '/relative/link/nested/'\n      path: '/nested'\n      fullPath: '/relative/link/nested/'\n      preLoaderRoute: typeof RelativeLinkNestedIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/non-nested/suffix/{$baz}suffix/': {\n      id: '/non-nested/suffix/{$baz}suffix/'\n      path: '/'\n      fullPath: '/non-nested/suffix/{$baz}suffix/'\n      preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRouteImport\n      parentRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRoute\n    }\n    '/non-nested/prefix/prefix{$baz}/': {\n      id: '/non-nested/prefix/prefix{$baz}/'\n      path: '/'\n      fullPath: '/non-nested/prefix/prefix{$baz}/'\n      preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRouteImport\n      parentRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRoute\n    }\n    '/non-nested/path/baz/': {\n      id: '/non-nested/path/baz/'\n      path: '/'\n      fullPath: '/non-nested/path/baz/'\n      preLoaderRoute: typeof NonNestedPathBazIndexRouteImport\n      parentRoute: typeof NonNestedPathBazRouteRoute\n    }\n    '/non-nested/named/$baz/': {\n      id: '/non-nested/named/$baz/'\n      path: '/'\n      fullPath: '/non-nested/named/$baz/'\n      preLoaderRoute: typeof NonNestedNamedBazIndexRouteImport\n      parentRoute: typeof NonNestedNamedBazRouteRoute\n    }\n    '/non-nested/deep/$baz/': {\n      id: '/non-nested/deep/$baz/'\n      path: '/'\n      fullPath: '/non-nested/deep/$baz/'\n      preLoaderRoute: typeof NonNestedDeepBazIndexRouteImport\n      parentRoute: typeof NonNestedDeepBazRouteRoute\n    }\n    '/params-ps/non-nested/$foo_/$bar': {\n      id: '/params-ps/non-nested/$foo_/$bar'\n      path: '/$bar'\n      fullPath: '/params-ps/non-nested/$foo/$bar'\n      preLoaderRoute: typeof ParamsPsNonNestedFooBarRouteImport\n      parentRoute: typeof ParamsPsNonNestedFooRouteRoute\n    }\n    '/non-nested/suffix/{$baz}suffix_/bar': {\n      id: '/non-nested/suffix/{$baz}suffix_/bar'\n      path: '/{$baz}suffix/bar'\n      fullPath: '/non-nested/suffix/{$baz}suffix/bar'\n      preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixBarRouteImport\n      parentRoute: typeof NonNestedSuffixRouteRoute\n    }\n    '/non-nested/suffix/{$baz}suffix/foo': {\n      id: '/non-nested/suffix/{$baz}suffix/foo'\n      path: '/foo'\n      fullPath: '/non-nested/suffix/{$baz}suffix/foo'\n      preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRouteImport\n      parentRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRoute\n    }\n    '/non-nested/prefix/prefix{$baz}_/bar': {\n      id: '/non-nested/prefix/prefix{$baz}_/bar'\n      path: '/prefix{$baz}/bar'\n      fullPath: '/non-nested/prefix/prefix{$baz}/bar'\n      preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125BarRouteImport\n      parentRoute: typeof NonNestedPrefixRouteRoute\n    }\n    '/non-nested/prefix/prefix{$baz}/foo': {\n      id: '/non-nested/prefix/prefix{$baz}/foo'\n      path: '/foo'\n      fullPath: '/non-nested/prefix/prefix{$baz}/foo'\n      preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRouteImport\n      parentRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRoute\n    }\n    '/non-nested/path/baz_/bar': {\n      id: '/non-nested/path/baz_/bar'\n      path: '/baz/bar'\n      fullPath: '/non-nested/path/baz/bar'\n      preLoaderRoute: typeof NonNestedPathBazBarRouteImport\n      parentRoute: typeof NonNestedPathRouteRoute\n    }\n    '/non-nested/path/baz/foo': {\n      id: '/non-nested/path/baz/foo'\n      path: '/foo'\n      fullPath: '/non-nested/path/baz/foo'\n      preLoaderRoute: typeof NonNestedPathBazFooRouteImport\n      parentRoute: typeof NonNestedPathBazRouteRoute\n    }\n    '/non-nested/named/$baz_/bar': {\n      id: '/non-nested/named/$baz_/bar'\n      path: '/$baz/bar'\n      fullPath: '/non-nested/named/$baz/bar'\n      preLoaderRoute: typeof NonNestedNamedBazBarRouteImport\n      parentRoute: typeof NonNestedNamedRouteRoute\n    }\n    '/non-nested/named/$baz/foo': {\n      id: '/non-nested/named/$baz/foo'\n      path: '/foo'\n      fullPath: '/non-nested/named/$baz/foo'\n      preLoaderRoute: typeof NonNestedNamedBazFooRouteImport\n      parentRoute: typeof NonNestedNamedBazRouteRoute\n    }\n    '/params-ps/named/$foo/$bar': {\n      id: '/params-ps/named/$foo/$bar'\n      path: '/$bar'\n      fullPath: '/params-ps/named/$foo/$bar'\n      preLoaderRoute: typeof ParamsPsNamedFooBarRouteRouteImport\n      parentRoute: typeof ParamsPsNamedFooRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar': {\n      id: '/non-nested/deep/$baz_/bar'\n      path: '/$baz/bar'\n      fullPath: '/non-nested/deep/$baz/bar'\n      preLoaderRoute: typeof NonNestedDeepBazBarRouteRouteImport\n      parentRoute: typeof NonNestedDeepRouteRoute\n    }\n    '/relative/useNavigate/path/$path/': {\n      id: '/relative/useNavigate/path/$path/'\n      path: '/path/$path'\n      fullPath: '/relative/useNavigate/path/$path/'\n      preLoaderRoute: typeof RelativeUseNavigatePathPathIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/useNavigate/nested/deep/': {\n      id: '/relative/useNavigate/nested/deep/'\n      path: '/nested/deep'\n      fullPath: '/relative/useNavigate/nested/deep/'\n      preLoaderRoute: typeof RelativeUseNavigateNestedDeepIndexRouteImport\n      parentRoute: typeof RelativeUseNavigateRouteRoute\n    }\n    '/relative/link/path/$path/': {\n      id: '/relative/link/path/$path/'\n      path: '/path/$path'\n      fullPath: '/relative/link/path/$path/'\n      preLoaderRoute: typeof RelativeLinkPathPathIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/relative/link/nested/deep/': {\n      id: '/relative/link/nested/deep/'\n      path: '/nested/deep'\n      fullPath: '/relative/link/nested/deep/'\n      preLoaderRoute: typeof RelativeLinkNestedDeepIndexRouteImport\n      parentRoute: typeof RelativeLinkRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar/': {\n      id: '/non-nested/deep/$baz_/bar/'\n      path: '/'\n      fullPath: '/non-nested/deep/$baz/bar/'\n      preLoaderRoute: typeof NonNestedDeepBazBarIndexRouteImport\n      parentRoute: typeof NonNestedDeepBazBarRouteRoute\n    }\n    '/params-ps/named/$foo/$bar/$baz': {\n      id: '/params-ps/named/$foo/$bar/$baz'\n      path: '/$baz'\n      fullPath: '/params-ps/named/$foo/$bar/$baz'\n      preLoaderRoute: typeof ParamsPsNamedFooBarBazRouteImport\n      parentRoute: typeof ParamsPsNamedFooBarRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar_/qux': {\n      id: '/non-nested/deep/$baz_/bar_/qux'\n      path: '/$baz/bar/qux'\n      fullPath: '/non-nested/deep/$baz/bar/qux'\n      preLoaderRoute: typeof NonNestedDeepBazBarQuxRouteImport\n      parentRoute: typeof NonNestedDeepRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar/$foo': {\n      id: '/non-nested/deep/$baz_/bar/$foo'\n      path: '/$foo'\n      fullPath: '/non-nested/deep/$baz/bar/$foo'\n      preLoaderRoute: typeof NonNestedDeepBazBarFooRouteRouteImport\n      parentRoute: typeof NonNestedDeepBazBarRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar/$foo/': {\n      id: '/non-nested/deep/$baz_/bar/$foo/'\n      path: '/'\n      fullPath: '/non-nested/deep/$baz/bar/$foo/'\n      preLoaderRoute: typeof NonNestedDeepBazBarFooIndexRouteImport\n      parentRoute: typeof NonNestedDeepBazBarFooRouteRoute\n    }\n    '/non-nested/deep/$baz_/bar/$foo_/qux': {\n      id: '/non-nested/deep/$baz_/bar/$foo_/qux'\n      path: '/$foo/qux'\n      fullPath: '/non-nested/deep/$baz/bar/$foo/qux'\n      preLoaderRoute: typeof NonNestedDeepBazBarFooQuxRouteImport\n      parentRoute: typeof NonNestedDeepBazBarRouteRoute\n    }\n  }\n}\n\ninterface NonNestedDeepBazRouteRouteChildren {\n  NonNestedDeepBazIndexRoute: typeof NonNestedDeepBazIndexRoute\n}\n\nconst NonNestedDeepBazRouteRouteChildren: NonNestedDeepBazRouteRouteChildren = {\n  NonNestedDeepBazIndexRoute: NonNestedDeepBazIndexRoute,\n}\n\nconst NonNestedDeepBazRouteRouteWithChildren =\n  NonNestedDeepBazRouteRoute._addFileChildren(\n    NonNestedDeepBazRouteRouteChildren,\n  )\n\ninterface NonNestedDeepBazBarFooRouteRouteChildren {\n  NonNestedDeepBazBarFooIndexRoute: typeof NonNestedDeepBazBarFooIndexRoute\n}\n\nconst NonNestedDeepBazBarFooRouteRouteChildren: NonNestedDeepBazBarFooRouteRouteChildren =\n  {\n    NonNestedDeepBazBarFooIndexRoute: NonNestedDeepBazBarFooIndexRoute,\n  }\n\nconst NonNestedDeepBazBarFooRouteRouteWithChildren =\n  NonNestedDeepBazBarFooRouteRoute._addFileChildren(\n    NonNestedDeepBazBarFooRouteRouteChildren,\n  )\n\ninterface NonNestedDeepBazBarRouteRouteChildren {\n  NonNestedDeepBazBarFooRouteRoute: typeof NonNestedDeepBazBarFooRouteRouteWithChildren\n  NonNestedDeepBazBarIndexRoute: typeof NonNestedDeepBazBarIndexRoute\n  NonNestedDeepBazBarFooQuxRoute: typeof NonNestedDeepBazBarFooQuxRoute\n}\n\nconst NonNestedDeepBazBarRouteRouteChildren: NonNestedDeepBazBarRouteRouteChildren =\n  {\n    NonNestedDeepBazBarFooRouteRoute:\n      NonNestedDeepBazBarFooRouteRouteWithChildren,\n    NonNestedDeepBazBarIndexRoute: NonNestedDeepBazBarIndexRoute,\n    NonNestedDeepBazBarFooQuxRoute: NonNestedDeepBazBarFooQuxRoute,\n  }\n\nconst NonNestedDeepBazBarRouteRouteWithChildren =\n  NonNestedDeepBazBarRouteRoute._addFileChildren(\n    NonNestedDeepBazBarRouteRouteChildren,\n  )\n\ninterface NonNestedDeepRouteRouteChildren {\n  NonNestedDeepBazRouteRoute: typeof NonNestedDeepBazRouteRouteWithChildren\n  NonNestedDeepBazBarRouteRoute: typeof NonNestedDeepBazBarRouteRouteWithChildren\n  NonNestedDeepBazBarQuxRoute: typeof NonNestedDeepBazBarQuxRoute\n}\n\nconst NonNestedDeepRouteRouteChildren: NonNestedDeepRouteRouteChildren = {\n  NonNestedDeepBazRouteRoute: NonNestedDeepBazRouteRouteWithChildren,\n  NonNestedDeepBazBarRouteRoute: NonNestedDeepBazBarRouteRouteWithChildren,\n  NonNestedDeepBazBarQuxRoute: NonNestedDeepBazBarQuxRoute,\n}\n\nconst NonNestedDeepRouteRouteWithChildren =\n  NonNestedDeepRouteRoute._addFileChildren(NonNestedDeepRouteRouteChildren)\n\ninterface NonNestedNamedBazRouteRouteChildren {\n  NonNestedNamedBazFooRoute: typeof NonNestedNamedBazFooRoute\n  NonNestedNamedBazIndexRoute: typeof NonNestedNamedBazIndexRoute\n}\n\nconst NonNestedNamedBazRouteRouteChildren: NonNestedNamedBazRouteRouteChildren =\n  {\n    NonNestedNamedBazFooRoute: NonNestedNamedBazFooRoute,\n    NonNestedNamedBazIndexRoute: NonNestedNamedBazIndexRoute,\n  }\n\nconst NonNestedNamedBazRouteRouteWithChildren =\n  NonNestedNamedBazRouteRoute._addFileChildren(\n    NonNestedNamedBazRouteRouteChildren,\n  )\n\ninterface NonNestedNamedRouteRouteChildren {\n  NonNestedNamedBazRouteRoute: typeof NonNestedNamedBazRouteRouteWithChildren\n  NonNestedNamedBazBarRoute: typeof NonNestedNamedBazBarRoute\n}\n\nconst NonNestedNamedRouteRouteChildren: NonNestedNamedRouteRouteChildren = {\n  NonNestedNamedBazRouteRoute: NonNestedNamedBazRouteRouteWithChildren,\n  NonNestedNamedBazBarRoute: NonNestedNamedBazBarRoute,\n}\n\nconst NonNestedNamedRouteRouteWithChildren =\n  NonNestedNamedRouteRoute._addFileChildren(NonNestedNamedRouteRouteChildren)\n\ninterface NonNestedPathBazRouteRouteChildren {\n  NonNestedPathBazFooRoute: typeof NonNestedPathBazFooRoute\n  NonNestedPathBazIndexRoute: typeof NonNestedPathBazIndexRoute\n}\n\nconst NonNestedPathBazRouteRouteChildren: NonNestedPathBazRouteRouteChildren = {\n  NonNestedPathBazFooRoute: NonNestedPathBazFooRoute,\n  NonNestedPathBazIndexRoute: NonNestedPathBazIndexRoute,\n}\n\nconst NonNestedPathBazRouteRouteWithChildren =\n  NonNestedPathBazRouteRoute._addFileChildren(\n    NonNestedPathBazRouteRouteChildren,\n  )\n\ninterface NonNestedPathRouteRouteChildren {\n  NonNestedPathBazRouteRoute: typeof NonNestedPathBazRouteRouteWithChildren\n  NonNestedPathBazBarRoute: typeof NonNestedPathBazBarRoute\n}\n\nconst NonNestedPathRouteRouteChildren: NonNestedPathRouteRouteChildren = {\n  NonNestedPathBazRouteRoute: NonNestedPathBazRouteRouteWithChildren,\n  NonNestedPathBazBarRoute: NonNestedPathBazBarRoute,\n}\n\nconst NonNestedPathRouteRouteWithChildren =\n  NonNestedPathRouteRoute._addFileChildren(NonNestedPathRouteRouteChildren)\n\ninterface NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren {\n  NonNestedPrefixPrefixChar123bazChar125FooRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRoute\n  NonNestedPrefixPrefixChar123bazChar125IndexRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute\n}\n\nconst NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren: NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren =\n  {\n    NonNestedPrefixPrefixChar123bazChar125FooRoute:\n      NonNestedPrefixPrefixChar123bazChar125FooRoute,\n    NonNestedPrefixPrefixChar123bazChar125IndexRoute:\n      NonNestedPrefixPrefixChar123bazChar125IndexRoute,\n  }\n\nconst NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren =\n  NonNestedPrefixPrefixChar123bazChar125RouteRoute._addFileChildren(\n    NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren,\n  )\n\ninterface NonNestedPrefixRouteRouteChildren {\n  NonNestedPrefixPrefixChar123bazChar125RouteRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren\n  NonNestedPrefixPrefixChar123bazChar125BarRoute: typeof NonNestedPrefixPrefixChar123bazChar125BarRoute\n}\n\nconst NonNestedPrefixRouteRouteChildren: NonNestedPrefixRouteRouteChildren = {\n  NonNestedPrefixPrefixChar123bazChar125RouteRoute:\n    NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren,\n  NonNestedPrefixPrefixChar123bazChar125BarRoute:\n    NonNestedPrefixPrefixChar123bazChar125BarRoute,\n}\n\nconst NonNestedPrefixRouteRouteWithChildren =\n  NonNestedPrefixRouteRoute._addFileChildren(NonNestedPrefixRouteRouteChildren)\n\ninterface NonNestedSuffixChar123bazChar125suffixRouteRouteChildren {\n  NonNestedSuffixChar123bazChar125suffixFooRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRoute\n  NonNestedSuffixChar123bazChar125suffixIndexRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRoute\n}\n\nconst NonNestedSuffixChar123bazChar125suffixRouteRouteChildren: NonNestedSuffixChar123bazChar125suffixRouteRouteChildren =\n  {\n    NonNestedSuffixChar123bazChar125suffixFooRoute:\n      NonNestedSuffixChar123bazChar125suffixFooRoute,\n    NonNestedSuffixChar123bazChar125suffixIndexRoute:\n      NonNestedSuffixChar123bazChar125suffixIndexRoute,\n  }\n\nconst NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren =\n  NonNestedSuffixChar123bazChar125suffixRouteRoute._addFileChildren(\n    NonNestedSuffixChar123bazChar125suffixRouteRouteChildren,\n  )\n\ninterface NonNestedSuffixRouteRouteChildren {\n  NonNestedSuffixChar123bazChar125suffixRouteRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren\n  NonNestedSuffixChar123bazChar125suffixBarRoute: typeof NonNestedSuffixChar123bazChar125suffixBarRoute\n}\n\nconst NonNestedSuffixRouteRouteChildren: NonNestedSuffixRouteRouteChildren = {\n  NonNestedSuffixChar123bazChar125suffixRouteRoute:\n    NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren,\n  NonNestedSuffixChar123bazChar125suffixBarRoute:\n    NonNestedSuffixChar123bazChar125suffixBarRoute,\n}\n\nconst NonNestedSuffixRouteRouteWithChildren =\n  NonNestedSuffixRouteRoute._addFileChildren(NonNestedSuffixRouteRouteChildren)\n\ninterface NonNestedRouteRouteChildren {\n  NonNestedDeepRouteRoute: typeof NonNestedDeepRouteRouteWithChildren\n  NonNestedNamedRouteRoute: typeof NonNestedNamedRouteRouteWithChildren\n  NonNestedPathRouteRoute: typeof NonNestedPathRouteRouteWithChildren\n  NonNestedPrefixRouteRoute: typeof NonNestedPrefixRouteRouteWithChildren\n  NonNestedSuffixRouteRoute: typeof NonNestedSuffixRouteRouteWithChildren\n}\n\nconst NonNestedRouteRouteChildren: NonNestedRouteRouteChildren = {\n  NonNestedDeepRouteRoute: NonNestedDeepRouteRouteWithChildren,\n  NonNestedNamedRouteRoute: NonNestedNamedRouteRouteWithChildren,\n  NonNestedPathRouteRoute: NonNestedPathRouteRouteWithChildren,\n  NonNestedPrefixRouteRoute: NonNestedPrefixRouteRouteWithChildren,\n  NonNestedSuffixRouteRoute: NonNestedSuffixRouteRouteWithChildren,\n}\n\nconst NonNestedRouteRouteWithChildren = NonNestedRouteRoute._addFileChildren(\n  NonNestedRouteRouteChildren,\n)\n\ninterface SearchParamsRouteRouteChildren {\n  SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute\n  SearchParamsIndexRoute: typeof SearchParamsIndexRoute\n}\n\nconst SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {\n  SearchParamsDefaultRoute: SearchParamsDefaultRoute,\n  SearchParamsIndexRoute: SearchParamsIndexRoute,\n}\n\nconst SearchParamsRouteRouteWithChildren =\n  SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)\n\ninterface Char45824Char54620Char48124Char44397RouteRouteChildren {\n  Char45824Char54620Char48124Char44397WildcardSplatRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRoute\n  Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute\n}\n\nconst Char45824Char54620Char48124Char44397RouteRouteChildren: Char45824Char54620Char48124Char44397RouteRouteChildren =\n  {\n    Char45824Char54620Char48124Char44397WildcardSplatRoute:\n      Char45824Char54620Char48124Char44397WildcardSplatRoute,\n    Char45824Char54620Char48124Char44397Char55357Char56960IdRoute:\n      Char45824Char54620Char48124Char44397Char55357Char56960IdRoute,\n  }\n\nconst Char45824Char54620Char48124Char44397RouteRouteWithChildren =\n  Char45824Char54620Char48124Char44397RouteRoute._addFileChildren(\n    Char45824Char54620Char48124Char44397RouteRouteChildren,\n  )\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface MasksRouteChildren {\n  MasksAdminUserIdRoute: typeof MasksAdminUserIdRoute\n  MasksPublicUsernameRoute: typeof MasksPublicUsernameRoute\n}\n\nconst MasksRouteChildren: MasksRouteChildren = {\n  MasksAdminUserIdRoute: MasksAdminUserIdRoute,\n  MasksPublicUsernameRoute: MasksPublicUsernameRoute,\n}\n\nconst MasksRouteWithChildren = MasksRoute._addFileChildren(MasksRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface ParamsPsNonNestedFooRouteRouteChildren {\n  ParamsPsNonNestedFooBarRoute: typeof ParamsPsNonNestedFooBarRoute\n}\n\nconst ParamsPsNonNestedFooRouteRouteChildren: ParamsPsNonNestedFooRouteRouteChildren =\n  {\n    ParamsPsNonNestedFooBarRoute: ParamsPsNonNestedFooBarRoute,\n  }\n\nconst ParamsPsNonNestedFooRouteRouteWithChildren =\n  ParamsPsNonNestedFooRouteRoute._addFileChildren(\n    ParamsPsNonNestedFooRouteRouteChildren,\n  )\n\ninterface ParamsPsNonNestedRouteRouteChildren {\n  ParamsPsNonNestedFooRouteRoute: typeof ParamsPsNonNestedFooRouteRouteWithChildren\n}\n\nconst ParamsPsNonNestedRouteRouteChildren: ParamsPsNonNestedRouteRouteChildren =\n  {\n    ParamsPsNonNestedFooRouteRoute: ParamsPsNonNestedFooRouteRouteWithChildren,\n  }\n\nconst ParamsPsNonNestedRouteRouteWithChildren =\n  ParamsPsNonNestedRouteRoute._addFileChildren(\n    ParamsPsNonNestedRouteRouteChildren,\n  )\n\ninterface RelativeLinkRouteRouteChildren {\n  RelativeLinkRelativeLinkARoute: typeof RelativeLinkRelativeLinkARoute\n  RelativeLinkRelativeLinkBRoute: typeof RelativeLinkRelativeLinkBRoute\n  RelativeLinkNestedIndexRoute: typeof RelativeLinkNestedIndexRoute\n  RelativeLinkPathIndexRoute: typeof RelativeLinkPathIndexRoute\n  RelativeLinkWithSearchIndexRoute: typeof RelativeLinkWithSearchIndexRoute\n  RelativeLinkNestedDeepIndexRoute: typeof RelativeLinkNestedDeepIndexRoute\n  RelativeLinkPathPathIndexRoute: typeof RelativeLinkPathPathIndexRoute\n}\n\nconst RelativeLinkRouteRouteChildren: RelativeLinkRouteRouteChildren = {\n  RelativeLinkRelativeLinkARoute: RelativeLinkRelativeLinkARoute,\n  RelativeLinkRelativeLinkBRoute: RelativeLinkRelativeLinkBRoute,\n  RelativeLinkNestedIndexRoute: RelativeLinkNestedIndexRoute,\n  RelativeLinkPathIndexRoute: RelativeLinkPathIndexRoute,\n  RelativeLinkWithSearchIndexRoute: RelativeLinkWithSearchIndexRoute,\n  RelativeLinkNestedDeepIndexRoute: RelativeLinkNestedDeepIndexRoute,\n  RelativeLinkPathPathIndexRoute: RelativeLinkPathPathIndexRoute,\n}\n\nconst RelativeLinkRouteRouteWithChildren =\n  RelativeLinkRouteRoute._addFileChildren(RelativeLinkRouteRouteChildren)\n\ninterface RelativeUseNavigateRouteRouteChildren {\n  RelativeUseNavigateRelativeUseNavigateARoute: typeof RelativeUseNavigateRelativeUseNavigateARoute\n  RelativeUseNavigateRelativeUseNavigateBRoute: typeof RelativeUseNavigateRelativeUseNavigateBRoute\n  RelativeUseNavigateNestedIndexRoute: typeof RelativeUseNavigateNestedIndexRoute\n  RelativeUseNavigatePathIndexRoute: typeof RelativeUseNavigatePathIndexRoute\n  RelativeUseNavigateWithSearchIndexRoute: typeof RelativeUseNavigateWithSearchIndexRoute\n  RelativeUseNavigateNestedDeepIndexRoute: typeof RelativeUseNavigateNestedDeepIndexRoute\n  RelativeUseNavigatePathPathIndexRoute: typeof RelativeUseNavigatePathPathIndexRoute\n}\n\nconst RelativeUseNavigateRouteRouteChildren: RelativeUseNavigateRouteRouteChildren =\n  {\n    RelativeUseNavigateRelativeUseNavigateARoute:\n      RelativeUseNavigateRelativeUseNavigateARoute,\n    RelativeUseNavigateRelativeUseNavigateBRoute:\n      RelativeUseNavigateRelativeUseNavigateBRoute,\n    RelativeUseNavigateNestedIndexRoute: RelativeUseNavigateNestedIndexRoute,\n    RelativeUseNavigatePathIndexRoute: RelativeUseNavigatePathIndexRoute,\n    RelativeUseNavigateWithSearchIndexRoute:\n      RelativeUseNavigateWithSearchIndexRoute,\n    RelativeUseNavigateNestedDeepIndexRoute:\n      RelativeUseNavigateNestedDeepIndexRoute,\n    RelativeUseNavigatePathPathIndexRoute:\n      RelativeUseNavigatePathPathIndexRoute,\n  }\n\nconst RelativeUseNavigateRouteRouteWithChildren =\n  RelativeUseNavigateRouteRoute._addFileChildren(\n    RelativeUseNavigateRouteRouteChildren,\n  )\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\ninterface RedirectTargetRouteChildren {\n  RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute\n  RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute\n  RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute\n}\n\nconst RedirectTargetRouteChildren: RedirectTargetRouteChildren = {\n  RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,\n  RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,\n  RedirectTargetIndexRoute: RedirectTargetIndexRoute,\n}\n\nconst RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(\n  RedirectTargetRouteChildren,\n)\n\ninterface ParamsPsNamedFooBarRouteRouteChildren {\n  ParamsPsNamedFooBarBazRoute: typeof ParamsPsNamedFooBarBazRoute\n}\n\nconst ParamsPsNamedFooBarRouteRouteChildren: ParamsPsNamedFooBarRouteRouteChildren =\n  {\n    ParamsPsNamedFooBarBazRoute: ParamsPsNamedFooBarBazRoute,\n  }\n\nconst ParamsPsNamedFooBarRouteRouteWithChildren =\n  ParamsPsNamedFooBarRouteRoute._addFileChildren(\n    ParamsPsNamedFooBarRouteRouteChildren,\n  )\n\ninterface ParamsPsNamedFooRouteRouteChildren {\n  ParamsPsNamedFooBarRouteRoute: typeof ParamsPsNamedFooBarRouteRouteWithChildren\n}\n\nconst ParamsPsNamedFooRouteRouteChildren: ParamsPsNamedFooRouteRouteChildren = {\n  ParamsPsNamedFooBarRouteRoute: ParamsPsNamedFooBarRouteRouteWithChildren,\n}\n\nconst ParamsPsNamedFooRouteRouteWithChildren =\n  ParamsPsNamedFooRouteRoute._addFileChildren(\n    ParamsPsNamedFooRouteRouteChildren,\n  )\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  NonNestedRouteRoute: NonNestedRouteRouteWithChildren,\n  SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,\n  Char45824Char54620Char48124Char44397RouteRoute:\n    Char45824Char54620Char48124Char44397RouteRouteWithChildren,\n  LayoutRoute: LayoutRouteWithChildren,\n  AnchorRoute: AnchorRoute,\n  ComponentTypesTestRoute: ComponentTypesTestRoute,\n  EditingARoute: EditingARoute,\n  EditingBRoute: EditingBRoute,\n  HoverPreloadHashRoute: HoverPreloadHashRoute,\n  MasksRoute: MasksRouteWithChildren,\n  NotRemountDepsRoute: NotRemountDepsRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RemountDepsRoute: RemountDepsRoute,\n  ParamsPsNonNestedRouteRoute: ParamsPsNonNestedRouteRouteWithChildren,\n  RelativeLinkRouteRoute: RelativeLinkRouteRouteWithChildren,\n  RelativeUseNavigateRouteRoute: RelativeUseNavigateRouteRouteWithChildren,\n  anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupInsideRoute: groupInsideRoute,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n  RedirectTargetRoute: RedirectTargetRouteWithChildren,\n  ParamsPsIndexRoute: ParamsPsIndexRoute,\n  RedirectIndexRoute: RedirectIndexRoute,\n  RelativeIndexRoute: RelativeIndexRoute,\n  ParamsPsNamedFooRouteRoute: ParamsPsNamedFooRouteRouteWithChildren,\n  groupSubfolderInsideRoute: groupSubfolderInsideRoute,\n  ParamsPsNamedPrefixChar123fooChar125Route:\n    ParamsPsNamedPrefixChar123fooChar125Route,\n  ParamsPsNamedChar123fooChar125suffixRoute:\n    ParamsPsNamedChar123fooChar125suffixRoute,\n  ParamsPsWildcardSplatRoute: ParamsPsWildcardSplatRoute,\n  ParamsPsWildcardPrefixAtChar45824Char123Char125Route:\n    ParamsPsWildcardPrefixAtChar45824Char123Char125Route,\n  ParamsPsWildcardPrefixChar123Char125Route:\n    ParamsPsWildcardPrefixChar123Char125Route,\n  ParamsPsWildcardChar123Char125suffixRoute:\n    ParamsPsWildcardChar123Char125suffixRoute,\n  ParamsPsWildcardChar123Char125suffixAtChar45824Route:\n    ParamsPsWildcardChar123Char125suffixAtChar45824Route,\n  ParamsSingleValueRoute: ParamsSingleValueRoute,\n  PostsPostIdEditRoute: PostsPostIdEditRoute,\n  RedirectPreloadFirstRoute: RedirectPreloadFirstRoute,\n  RedirectPreloadSecondRoute: RedirectPreloadSecondRoute,\n  RedirectPreloadThirdRoute: RedirectPreloadThirdRoute,\n  TransitionCountCreateResourceRoute: TransitionCountCreateResourceRoute,\n  TransitionTypingCreateResourceRoute: TransitionTypingCreateResourceRoute,\n  ParamsPsNamedIndexRoute: ParamsPsNamedIndexRoute,\n  ParamsPsWildcardIndexRoute: ParamsPsWildcardIndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/(another-group)/onlyrouteinside.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { getRouteApi, useSearch } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(another-group)/onlyrouteinside')\n\nexport const Route = createFileRoute('/(another-group)/onlyrouteinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({\n      from: '/(another-group)/onlyrouteinside',\n    })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook().hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook().hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">\n          {searchViaRouteApi().hello}\n        </div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/(group)/_layout.insidelayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { getRouteApi, useSearch } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(group)/_layout/insidelayout')\n\nexport const Route = createFileRoute('/(group)/_layout/insidelayout')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook().hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook().hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">\n          {searchViaRouteApi().hello}\n        </div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/(group)/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({\n  component: () => (\n    <>\n      <div>/(group)/_layout!</div>\n      <Outlet />\n    </>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/(group)/inside.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { getRouteApi, useSearch } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(group)/inside')\n\nexport const Route = createFileRoute('/(group)/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/inside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook().hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook().hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">\n          {searchViaRouteApi().hello}\n        </div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/solid-router'\nimport { getRouteApi, useSearch } from '@tanstack/solid-router'\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nexport const Route = createLazyFileRoute('/(group)/lazyinside')({\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/lazyinside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook().hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook().hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">\n          {searchViaRouteApi().hello}\n        </div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/(group)/lazyinside.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/(group)/subfolder/inside.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { getRouteApi, useSearch } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nconst routeApi = getRouteApi('/(group)/subfolder/inside')\n\nexport const Route = createFileRoute('/(group)/subfolder/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: () => {\n    const searchViaHook = useSearch({ from: '/(group)/subfolder/inside' })\n    const searchViaRouteHook = Route.useSearch()\n    const searchViaRouteApi = routeApi.useSearch()\n    return (\n      <>\n        <div data-testid=\"search-via-hook\">{searchViaHook().hello}</div>\n        <div data-testid=\"search-via-route-hook\">\n          {searchViaRouteHook().hello}\n        </div>\n        <div data-testid=\"search-via-route-api\">\n          {searchViaRouteApi().hello}\n        </div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n  useCanGoBack,\n  useRouter,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const canGoBack = useCanGoBack()\n  // test useRouterState doesn't crash client side navigation\n  const _state = useRouterState()\n\n  return (\n    <>\n      <HeadContent />\n      <div class=\"flex gap-2 p-2 text-lg border-b\">\n        <button\n          data-testid=\"back-button\"\n          disabled={!canGoBack()}\n          onClick={() => router.history.back()}\n          class={!canGoBack() ? 'line-through' : undefined}\n        >\n          Back\n        </button>{' '}\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/onlyrouteinside\"\n          data-testid=\"link-to-only-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Only Route Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/inside\"\n          data-testid=\"link-to-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/subfolder/inside\"\n          data-testid=\"link-to-route-inside-group-inside-subfolder\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Inside Subfolder Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/insidelayout\"\n          data-testid=\"link-to-route-inside-group-inside-layout\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Inside Group Inside Layout\n        </Link>{' '}\n        <Link\n          to=\"/lazyinside\"\n          data-testid=\"link-to-lazy-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Lazy Inside Group\n        </Link>{' '}\n        <Link\n          to=\"/redirect\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          redirect\n        </Link>{' '}\n        <Link\n          to=\"/relative\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          relative routing\n        </Link>{' '}\n        <Link\n          to=\"/대한민국\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          unicode path\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>{' '}\n        <Link\n          to=\"/masks\"\n          data-testid=\"link-to-masks\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Masks\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/anchor.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, useLocation, useNavigate } from '@tanstack/solid-router'\nimport {\n  createEffect,\n  createRenderEffect,\n  createSignal,\n  onCleanup,\n} from 'solid-js'\n\nexport const Route = createFileRoute('/anchor')({\n  component: AnchorComponent,\n})\n\nconst anchors: Array<{\n  id: string\n  title: string\n  hashScrollIntoView?: boolean | ScrollIntoViewOptions\n}> = [\n  {\n    id: 'default-anchor',\n    title: 'Default Anchor',\n  },\n  {\n    id: 'false-anchor',\n    title: 'No Scroll Into View',\n    hashScrollIntoView: false,\n  },\n  {\n    id: 'smooth-scroll',\n    title: 'Smooth Scroll',\n    hashScrollIntoView: { behavior: 'smooth' },\n  },\n] as const\n\nfunction AnchorSection({ id, title }: { id: string; title: string }) {\n  const [hasShown, setHasShown] = createSignal(false)\n  let elementRef: HTMLHeadingElement | null = null\n\n  createEffect(() => {\n    const observer = new IntersectionObserver(\n      ([entry]) => {\n        if (!hasShown() && entry.isIntersecting) {\n          setHasShown(true)\n        }\n      },\n      { threshold: 0.01 },\n    )\n\n    const currentRef = elementRef\n    if (currentRef) {\n      observer.observe(currentRef)\n    }\n\n    onCleanup(() => {\n      if (currentRef) {\n        observer.unobserve(currentRef)\n      }\n    })\n  })\n\n  return (\n    <div id={id} class=\"p-2 min-h-dvh\">\n      <h1\n        data-testid={`heading-${id}`}\n        class=\"font-bold text-xl pt-10\"\n        ref={elementRef!}\n      >\n        {`${title} ${hasShown() ? '(shown)' : ''}`}\n      </h1>\n    </div>\n  )\n}\n\nfunction AnchorComponent() {\n  const navigate = useNavigate()\n  const location = useLocation()\n  const [withScroll, setWithScroll] = createSignal(true)\n\n  return (\n    <div class=\"flex flex-col w-full\">\n      <nav class=\"sticky top-0 z-10 p-2 bg-gray-50 dark:bg-gray-900 border-b\">\n        <ul class=\"inline-flex gap-2\">\n          {anchors.map((anchor) => (\n            <li>\n              <Link\n                from={Route.fullPath}\n                data-testid={`link-${anchor.id}`}\n                hash={anchor.id}\n                activeOptions={{ includeHash: true }}\n                activeProps={{\n                  class: 'font-bold active',\n                }}\n                hashScrollIntoView={anchor.hashScrollIntoView}\n              >\n                {anchor.title}\n              </Link>\n            </li>\n          ))}\n        </ul>\n      </nav>\n      <main class=\"overflow-auto\">\n        <form\n          class=\"p-2 space-y-2 min-h-dvh\"\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n\n            const toHash = formData.get('hash') as string\n\n            if (!toHash) {\n              return\n            }\n\n            const hashScrollIntoView = withScroll()\n              ? ({\n                  behavior: formData.get('scrollBehavior') as ScrollBehavior,\n                  block: formData.get('scrollBlock') as ScrollLogicalPosition,\n                  inline: formData.get('scrollInline') as ScrollLogicalPosition,\n                } satisfies ScrollIntoViewOptions)\n              : false\n\n            navigate({ hash: toHash, hashScrollIntoView })\n          }}\n        >\n          <h1 class=\"font-bold text-xl\">Scroll with navigate</h1>\n          <div class=\"space-y-2\">\n            <label>\n              <span>Target Anchor</span>\n              <select\n                class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                data-testid=\"hash-select\"\n                value={location().hash || anchors[0].id}\n                name=\"hash\"\n              >\n                {anchors.map((anchor) => (\n                  <option value={anchor.id}>{anchor.title}</option>\n                ))}\n              </select>\n            </label>\n            <div>\n              <label>\n                <input\n                  checked={withScroll()}\n                  data-testid=\"with-scroll\"\n                  onChange={(e) => setWithScroll(e.target.checked)}\n                  type=\"checkbox\"\n                />{' '}\n                Scroll Into View\n              </label>\n            </div>\n          </div>\n          {withScroll() ? (\n            <>\n              <div class=\"space-y-2\">\n                <label>\n                  <span>Behavior</span>\n                  <select\n                    class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    data-testid=\"behavior-select\"\n                    value=\"instant\"\n                    name=\"scrollBehavior\"\n                  >\n                    <option value=\"instant\">instant</option>\n                    <option value=\"smooth\">smooth</option>\n                    <option value=\"auto\">auto</option>\n                  </select>\n                </label>\n              </div>\n\n              <div class=\"space-y-2\">\n                <label>\n                  <span>Block</span>\n                  <select\n                    class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    data-testid=\"block-select\"\n                    value=\"start\"\n                    name=\"scrollBlock\"\n                  >\n                    <option value=\"start\">start</option>\n                    <option value=\"center\">center</option>\n                    <option value=\"end\">end</option>\n                    <option value=\"nearest\">nearest</option>\n                  </select>\n                </label>\n              </div>\n\n              <div class=\"space-y-2\">\n                <label>\n                  <span>Inline</span>\n                  <select\n                    class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    data-testid=\"inline-select\"\n                    value=\"nearest\"\n                    name=\"scrollInline\"\n                  >\n                    <option value=\"start\">start</option>\n                    <option value=\"center\">center</option>\n                    <option value=\"end\">end</option>\n                    <option value=\"nearest\">nearest</option>\n                  </select>\n                </label>\n              </div>\n            </>\n          ) : null}\n          <div>\n            <button\n              class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              data-testid=\"navigate-button\"\n            >\n              Navigate\n            </button>\n          </div>\n        </form>\n\n        {anchors.map((anchor) => (\n          <AnchorSection id={anchor.id} title={anchor.title} />\n        ))}\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/component-types-test.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\n// Test route for type safety of different component types\n// This test should\n// - check that `false` can be set on the `errorComponent`\n// ...without causing build-time TypeScript errors\nexport const Route = createFileRoute('/component-types-test')({\n  component: () => <div>Testing test types</div>,\n  errorComponent: false, // Should not cause TypeScript error\n  pendingComponent: undefined, // Should not cause TypeScript error\n  notFoundComponent: undefined, // Should not cause TypeScript error\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/editing-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { useBlocker } from '@tanstack/solid-router'\nimport { createSignal } from 'solid-js'\n\nexport const Route = createFileRoute('/editing-a')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = Route.useNavigate()\n  const [input, setInput] = createSignal('')\n\n  const blocker = useBlocker({\n    shouldBlockFn: ({ next }) => {\n      if (next.fullPath === '/editing-b' && input().length > 0) {\n        return true\n      }\n      return false\n    },\n    withResolver: true,\n  })\n\n  return (\n    <div>\n      <h1>Editing A</h1>\n      <label>\n        Enter your name:\n        <input\n          name=\"input\"\n          value={input()}\n          onChange={(e) => setInput(e.target.value)}\n        />\n      </label>\n      <button\n        onClick={() => {\n          navigate({ to: '/editing-b' })\n        }}\n      >\n        Go to next step\n      </button>\n      {blocker().status === 'blocked' && (\n        <button onClick={() => blocker().proceed?.()}>Proceed</button>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/editing-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { useBlocker } from '@tanstack/solid-router'\nimport { createEffect, createSignal, createMemo } from 'solid-js'\n\nexport const Route = createFileRoute('/editing-b')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = Route.useNavigate()\n  const [input, setInput] = createSignal('')\n\n  const blocker = createMemo(() =>\n    useBlocker({\n      condition: input(),\n    }),\n  )\n\n  return (\n    <div>\n      <h1>Editing B</h1>\n      <label>\n        Enter your name:\n        <input\n          name=\"input\"\n          value={input()}\n          onChange={(e) => setInput(e.target.value)}\n        />\n      </label>\n      <button\n        onClick={() => {\n          navigate({ to: '/editing-a' })\n        }}\n      >\n        Go back\n      </button>\n      {blocker()().status === 'blocked' && (\n        <button onClick={() => blocker()().proceed?.()}>Proceed</button>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/hover-preload-hash.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/hover-preload-hash')({\n  component: Page,\n})\n\nfunction Page() {\n  return (\n    <>\n      <div class=\"p-2\">Hello from About!</div>\n      <Link\n        to=\"/hover-preload-hash\"\n        hash={'position1'}\n        class=\"[&.active]:font-bold\"\n        data-testid=\"link-to-hash\"\n      >\n        To hash\n      </Link>\n\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <h2 id=\"position1\">Hash is here</h2>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n      <p>\n        Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy\n        eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam\n        voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet\n        clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit\n        amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam\n        nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,\n        sed diam voluptua. At vero eos et accusam et justo duo dolores et ea\n        rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem\n        ipsum dolor sit amet.\n      </p>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/masks.admin.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/masks/admin/$userId')({\n  component: AdminUserRoute,\n})\n\nfunction AdminUserRoute() {\n  const params = Route.useParams()\n\n  return (\n    <div data-testid=\"admin-user-component\">\n      <div data-testid=\"admin-user-id\">{params().userId}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/masks.public.$username.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/masks/public/$username')({\n  component: PublicUserRoute,\n})\n\nfunction PublicUserRoute() {\n  const params = Route.useParams()\n\n  return (\n    <div data-testid=\"public-user-component\">\n      <div data-testid=\"public-username\">{params().username}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/masks.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useRouterState,\n} from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/masks')({\n  component: MasksLayout,\n})\n\nfunction MasksLayout() {\n  const location = useRouterState({\n    select: (state) => state.location,\n  })\n\n  return (\n    <div>\n      <h2>Route Masks</h2>\n      <nav>\n        <Link\n          to=\"/masks/admin/$userId\"\n          params={{ userId: '42' }}\n          data-testid=\"link-to-admin-mask\"\n        >\n          Go to admin user\n        </Link>\n      </nav>\n      <div>\n        <div data-testid=\"router-pathname\">{location().pathname}</div>\n        <div data-testid=\"router-masked-pathname\">\n          {location().maskedLocation?.pathname ?? ''}\n        </div>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-index-heading\">\n        Hello deeply nested baz index\n      </div>\n      <div data-testid=\"non-nested-deep-baz-index-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-route-heading\">\n        Hello non-nested named baz route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-index-heading\">\n        Hello deeply nested baz/bar/foo index\n      </div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-index-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-route-heading\">\n        Hello deeply nested named baz/bar/foo route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo_.qux.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo_/qux')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-qux-heading\">\n        Hello deeply nested baz/bar/foo/qux\n      </div>\n      <div data-testid=\"non-nested-deep-baz-bar-foo-qux-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-index-heading\">\n        Hello deeply nested baz/bar index\n      </div>\n      <div data-testid=\"non-nested-deep-baz-bar-index-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-route-heading\">\n        Hello deeply nested baz/bar route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar_.qux.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep/$baz_/bar_/qux')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-baz-bar-qux-heading\">\n        Hello deeply nested baz/bar/qux\n      </div>\n      <div data-testid=\"non-nested-deep-baz-bar-qux-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/deep/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/deep')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-deep-root-route-heading\">\n        Hello non-nested deep layout\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-deep-baz\"\n        >\n          To Baz\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar\"\n          params={{ baz: 'baz-bar' }}\n          data-testid=\"to-deep-baz-bar\"\n        >\n          To named baz/bar\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar/$foo\"\n          params={{ baz: 'baz-bar', foo: 'foo' }}\n          data-testid=\"to-deep-baz-bar-foo\"\n        >\n          To named baz/bar/foo\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar/$foo/qux\"\n          params={{ baz: 'baz-bar-qux', foo: 'foo' }}\n          data-testid=\"to-deep-baz-bar-foo-qux\"\n        >\n          To named baz/bar/foo/qux\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar/qux\"\n          params={{ baz: 'baz-bar-qux' }}\n          data-testid=\"to-deep-baz-bar-qux\"\n        >\n          To named baz/bar/qux\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/named/$baz/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-baz-foo-heading\">\n        Hello nested named baz foo page\n      </div>\n      <div data-testid=\"non-nested-named-baz-foo-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/named/$baz/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-baz-index-heading\">\n        Hello nested named baz index\n      </div>\n      <div data-testid=\"non-nested-named-baz-index-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/named/$baz')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-baz-route-heading\">\n        Hello non-nested named baz route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/named/$baz_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-baz-bar-heading\">\n        Hello non-nested named bar\n      </div>\n      <div data-testid=\"non-nested-named-baz-bar-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/named/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/named')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-named-root-route-heading\">\n        Hello non-nested named layout\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-named-index\"\n        >\n          To named index\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/foo\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-named-foo\"\n        >\n          To named foo\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/foo\"\n          params={{ baz: 'baz_' }}\n          data-testid=\"to-named-foo-2\"\n        >\n          To named foo 2\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-named-bar\"\n        >\n          To named bar\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"./$baz/bar\"\n          params={{ baz: 'baz_' }}\n          data-testid=\"to-named-bar-2\"\n        >\n          To named bar 2\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/path/baz/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-baz-foo-heading\">\n        Hello nested path baz foo page\n      </div>\n      <div data-testid=\"non-nested-path-baz-foo-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/path/baz/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-baz-index-heading\">\n        Hello nested path baz index\n      </div>\n      <div data-testid=\"non-nested-path-baz-index-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/path/baz')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-baz-route-heading\">\n        Hello non-nested path baz route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/path/baz_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-baz-bar-heading\">\n        Hello non-nested path bar\n      </div>\n      <div data-testid=\"non-nested-path-baz-bar-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/path/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/path')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-path-root-route-heading\">\n        Hello non-nested path layout\n      </div>\n      <div>\n        <Link from={Route.fullPath} to=\"./baz\" data-testid=\"to-path-index\">\n          To path index\n        </Link>\n        <Link from={Route.fullPath} to=\"./baz/foo\" data-testid=\"to-path-foo\">\n          To path foo\n        </Link>\n        <Link from={Route.fullPath} to=\"./baz/foo\" data-testid=\"to-path-foo-2\">\n          To path foo 2\n        </Link>\n        <Link from={Route.fullPath} to=\"./baz/bar\" data-testid=\"to-path-bar\">\n          To path bar\n        </Link>\n        <Link from={Route.fullPath} to=\"./baz/bar\" data-testid=\"to-path-bar-2\">\n          To path bar 2\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-baz-foo-heading\">\n        Hello nested prefix foo page\n      </div>\n      <div data-testid=\"non-nested-prefix-baz-foo-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-baz-index-heading\">\n        Hello nested prefix index\n      </div>\n      <div data-testid=\"non-nested-prefix-baz-index-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/prefix/prefix{$baz}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-baz-route-heading\">\n        Hello non-nested prefix route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/prefix/prefix{$baz}_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-baz-bar-heading\">\n        Hello non-nested prefix bar\n      </div>\n      <div data-testid=\"non-nested-prefix-baz-bar-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/prefix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-prefix-root-route-heading\">\n        Hello non-nested prefix layout\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-prefix-index\"\n        >\n          To prefix index\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}/foo\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-prefix-foo\"\n        >\n          To prefix foo\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}/foo\"\n          params={{ baz: 'baz_' }}\n          data-testid=\"to-prefix-foo-2\"\n        >\n          To prefix foo 2\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}/bar\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-prefix-bar\"\n        >\n          To prefix bar\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"prefix{$baz}/bar\"\n          params={{ baz: 'baz_' }}\n          data-testid=\"to-prefix-bar-2\"\n        >\n          To prefix bar 2\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h3 class=\"pb-2\" data-testid=\"non-nested-path-heading\">\n        Non-nested paths\n      </h3>\n      <ul class=\"grid mb-2\">\n        <li>\n          <Link from={Route.fullPath} data-testid=\"l-to-named\" to=\"./named\">\n            To named param tests\n          </Link>\n          <Link from={Route.fullPath} data-testid=\"l-to-prefix\" to=\"./prefix\">\n            To prefix param tests\n          </Link>\n          <Link from={Route.fullPath} data-testid=\"l-to-suffix\" to=\"./suffix\">\n            To suffix param tests\n          </Link>\n          <Link from={Route.fullPath} data-testid=\"l-to-path\" to=\"./path\">\n            To path tests\n          </Link>\n        </li>\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-root-route-heading\">\n        Hello non-nested suffix layout\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-suffix-index\"\n        >\n          To suffix index\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix/foo\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-suffix-foo\"\n        >\n          To suffix foo\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix/foo\"\n          params={{ baz: 'baz2' }}\n          data-testid=\"to-suffix-foo-2\"\n        >\n          To suffix foo 2\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix/bar\"\n          params={{ baz: 'baz' }}\n          data-testid=\"to-suffix-bar\"\n        >\n          To suffix bar\n        </Link>\n        <Link\n          from={Route.fullPath}\n          to=\"{$baz}suffix/bar\"\n          params={{ baz: 'baz2' }}\n          data-testid=\"to-suffix-bar-2\"\n        >\n          To suffix bar 2\n        </Link>\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/suffix/{$baz}suffix/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-baz-foo-heading\">\n        Hello nested suffix foo page\n      </div>\n      <div data-testid=\"non-nested-suffix-baz-foo-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/suffix/{$baz}suffix/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-baz-index-heading\">\n        Hello nested suffix index\n      </div>\n      <div data-testid=\"non-nested-suffix-baz-index-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/suffix/{$baz}suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-baz-route-heading\">\n        Hello non-nested suffix route layout\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/non-nested/suffix/{$baz}suffix_/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      <div data-testid=\"non-nested-suffix-baz-bar-heading\">\n        Hello non-nested suffix bar\n      </div>\n      <div data-testid=\"non-nested-suffix-baz-bar-param\">\n        {JSON.stringify(params())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/notRemountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createSignal } from 'solid-js'\nimport { onMount } from 'solid-js'\n\nexport const Route = createFileRoute('/notRemountDeps')({\n  validateSearch(search: { searchParam: string }) {\n    return { searchParam: search.searchParam }\n  },\n  loaderDeps(opts) {\n    return opts.search\n  },\n  component: Home,\n  remountDeps(opts) {\n    return opts.params\n  },\n})\n\nconst [mounts, setMounts] = createSignal(0)\n\nfunction Home() {\n  const search = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  onMount(() => {\n    setMounts((m) => m + 1)\n  })\n\n  return (\n    <div class=\"p-2\">\n      <button\n        onClick={() => {\n          navigate({\n            search: { searchParam: Math.random().toString(36).substring(2, 8) },\n          })\n        }}\n      >\n        Regenerate search param\n      </button>\n\n      <div>Search: {search().searchParam}</div>\n      <div data-testid=\"component-mounts\">\n        Page component mounts: {mounts()}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h3 class=\"pb-2\">Named path params</h3>\n      <ul class=\"grid mb-2\">\n        <li>\n          <Link\n            data-testid=\"l-to-named-foo\"\n            to=\"/params-ps/named/$foo\"\n            params={{ foo: 'foo' }}\n          >\n            /params-ps/named/$foo\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-named-foo-special-characters\"\n            to=\"/params-ps/named/$foo\"\n            params={{ foo: 'foo%\\\\/🚀대' }}\n          >\n            /params-ps/named/$foo - with special characters\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-named-prefixfoo\"\n            to=\"/params-ps/named/prefix{$foo}\"\n            params={{ foo: 'foo' }}\n          >\n            /params-ps/named/{'prefix{$foo}'}\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-named-foosuffix\"\n            to=\"/params-ps/named/{$foo}suffix\"\n            params={{ foo: 'foo' }}\n          >\n            /params-ps/named/{'{$foo}suffix'}\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <h3 class=\"pb-2\">Wildcard path params</h3>\n      <ul class=\"grid mb-2\">\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-foo\"\n            to=\"/params-ps/wildcard/$\"\n            params={{ _splat: 'foo' }}\n          >\n            /params-ps/wildcard/$\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-escaped\"\n            to=\"/params-ps/wildcard/$\"\n            params={{ _splat: 'test[s\\\\/.\\\\/parameter%!🚀]' }}\n          >\n            /params-ps/wildcard/$ with escaped params\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-encoded\"\n            to=\"/params-ps/wildcard/$\"\n            params={{ _splat: '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD' }}\n          >\n            /params-ps/wildcard/$ with encoded params\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-prefixfoo\"\n            to=\"/params-ps/wildcard/prefix{$}\"\n            params={{ _splat: 'foo' }}\n          >\n            /params-ps/wildcard/{'prefix{$}'}\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-prefix-escaped\"\n            to=\"/params-ps/wildcard/prefix@대{$}\"\n            params={{ _splat: 'test[s\\\\/.\\\\/parameter%!🚀]' }}\n          >\n            /params-ps/wildcard/{'prefix@대{$}'}\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-foosuffix\"\n            to=\"/params-ps/wildcard/{$}suffix\"\n            params={{ _splat: 'foo' }}\n          >\n            /params-ps/wildcard/{'{$}suffix'}\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-suffix-escaped\"\n            to=\"/params-ps/wildcard/{$}suffix@대\"\n            params={{ _splat: 'test[s\\\\/.\\\\/parameter%!🚀]' }}\n          >\n            /params-ps/wildcard/{'{$}suffix@대'}\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <h3 class=\"pb-2\">Non-nested path params</h3>\n      <ul class=\"grid mb-2\">\n        <li>\n          <Link data-testid=\"l-to-non-nested\" to=\"/params-ps/non-nested\">\n            Non-nested\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.$baz.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/named/$foo/$bar/$baz')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      Hello \"/params-ps/named/$foo/$bar/$baz\"!\n      <div>\n        baz: <span data-testid=\"foo-bar-baz-value\">{params().baz}</span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.route.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useParams,\n} from '@tanstack/solid-router'\nimport { createEffect, createSignal } from 'solid-js'\n\nexport const Route = createFileRoute('/params-ps/named/$foo/$bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [renderBarCount, setBarRenderCount] = createSignal(0)\n  const [renderBazCount, setBazRenderCount] = createSignal(0)\n\n  const params = useParams({\n    strict: false,\n  })\n\n  createEffect(() => {\n    params().bar\n    setBarRenderCount((prev) => prev + 1)\n  })\n\n  createEffect(() => {\n    params().baz\n    setBazRenderCount((prev) => prev + 1)\n  })\n\n  return (\n    <div>\n      Hello \"/params-ps/named/$foo/$bar\"!\n      <div>\n        Bar Render Count:{' '}\n        <span data-testid=\"foo-bar-render-count\">{renderBarCount()}</span>\n      </div>\n      <div>\n        Bar: <span data-testid=\"foo-bar-value\">{params().bar}</span>\n      </div>\n      <div>\n        Baz in Bar Render Count:{' '}\n        <span data-testid=\"foo-baz-in-bar-render-count\">\n          {renderBazCount()}\n        </span>\n      </div>\n      <div>\n        Baz in Bar:{' '}\n        <span data-testid=\"foo-baz-in-bar-value\">\n          {params().baz ?? 'no param'}\n        </span>\n      </div>\n      <Link\n        data-testid=\"params-foo-bar-links-baz\"\n        from={Route.fullPath}\n        to=\"./$baz\"\n        params={{ baz: `${params().bar}_10` }}\n      >\n        To Baz\n      </Link>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { createEffect, createSignal } from 'solid-js'\n\nexport const Route = createFileRoute('/params-ps/named/$foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [renderCount, setRenderCount] = createSignal(0)\n  const params = Route.useParams()\n\n  createEffect(() => {\n    params().foo\n\n    setRenderCount((prev) => prev + 1)\n  })\n\n  return (\n    <div>\n      <h3>ParamsNamedFoo</h3>\n      <div>\n        RenderCount: <span data-testid=\"foo-render-count\">{renderCount()}</span>\n      </div>\n      <div data-testid=\"params-output\">{JSON.stringify(params())}</div>\n      <Link from={Route.fullPath} to=\".\" data-testid=\"params-foo-links-index\">\n        Index\n      </Link>\n      <Link\n        from={Route.fullPath}\n        to=\"./$bar\"\n        params={{ bar: '1' }}\n        data-testid=\"params-foo-links-bar1\"\n      >\n        Bar1\n      </Link>\n      <Link\n        from={Route.fullPath}\n        to=\"./$bar\"\n        params={{ bar: '2' }}\n        data-testid=\"params-foo-links-bar2\"\n      >\n        Bar2\n      </Link>\n      <Link\n        from={Route.fullPath}\n        to=\"./$bar\"\n        params={{ bar: '🚀%2F/abc대' }}\n        data-testid=\"params-foo-links-bar-special-characters\"\n      >\n        Bar with special characters\n      </Link>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/named/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/named/')({\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/named/prefix{$foo}.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/params-ps/named/prefix{$foo}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsNamedFooPrefix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/named/{$foo}suffix.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/params-ps/named/{$foo}suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsNamedFooSuffix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx",
    "content": "import { createFileRoute, useParams } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/non-nested/$foo_/$bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const fooParams = useParams({ from: `/params-ps/non-nested/$foo_` })\n  const routeParams = Route.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"foo-params-value\">{JSON.stringify(fooParams())}</div>\n      <div data-testid=\"foo-bar-params-value\">\n        {JSON.stringify(routeParams())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/non-nested/$foo_')()\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/non-nested')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h3 class=\"pb-2\">Non-nested path params</h3>\n      <ul class=\"grid mb-2\">\n        <li>\n          <Link\n            from={Route.fullPath}\n            data-testid=\"l-to-non-nested-foo-bar\"\n            to=\"./$foo/$bar\"\n            params={{ foo: 'foo', bar: 'bar' }}\n          >\n            /params-ps/non-nested/foo/bar\n          </Link>\n          <Link\n            from={Route.fullPath}\n            data-testid=\"l-to-non-nested-foo2-bar2\"\n            to=\"./$foo/$bar\"\n            params={{ foo: 'foo2', bar: 'bar2' }}\n          >\n            /params-ps/non-nested/foo2/bar2\n          </Link>\n        </li>\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/$.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/params-ps/wildcard/$')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplat</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/wildcard/')({\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/prefix@대{$}.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/wildcard/prefix@대{$}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplatPrefix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/prefix{$}.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/params-ps/wildcard/prefix{$}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplatPrefix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/params-ps/wildcard/{$}suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplatSuffix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix@대.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params-ps/wildcard/{$}suffix@대')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const p = Route.useParams()\n  return (\n    <div>\n      <h3>ParamsWildcardSplatSuffix</h3>\n      <div data-testid=\"params-output\">{JSON.stringify(p())}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/params.single.$value.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params/single/$value')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const value = Route.useParams({ select: (s) => s.value })\n\n  return (\n    <div class=\"p-2 grid gap-4\">\n      <div>\n        <h2>What's the value???</h2>\n        <p>Check path param value is printed correctly for a single param.</p>\n      </div>\n      <p>\n        Value: <span data-testid=\"parsed-param-value\">{value()}</span>\n      </p>\n      <div class=\"flex gap-2\">\n        <Link\n          to=\"/params/single/$value\"\n          params={{ value: value() }}\n          reloadDocument\n          class=\"border p-2\"\n          data-testid=\"self-link-same\"\n        >\n          Self link to same\n        </Link>\n        <Link\n          to=\"/params/single/$value\"\n          params={{ value: `e2e${value()}` }}\n          reloadDocument\n          class=\"border p-2\"\n          data-testid=\"self-link-amended\"\n        >\n          Self link to amended value {`e2e${value()}`}\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\" data-testid=\"post-title\">\n        {post().title}\n      </h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\" data-testid=\"posts-links\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx",
    "content": "import { createFileRoute, getRouteApi, useParams } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts_/$postId/edit')({\n  component: PostEditPage,\n})\n\nconst api = getRouteApi(`/posts_/$postId/edit`)\n\nfunction PostEditPage() {\n  const paramsViaApi = api.useParams()\n  const paramsViaHook = useParams({ from: `/posts_/$postId/edit` })\n  const paramsViaRouteHook = Route.useParams()\n\n  return (\n    <>\n      <div data-testid=\"params-via-hook\">{paramsViaHook().postId}</div>\n      <div data-testid=\"params-via-route-hook\">\n        {paramsViaRouteHook().postId}\n      </div>\n      <div data-testid=\"params-via-route-api\">{paramsViaApi().postId}</div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/redirect/$target/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/$target/')({\n  component: () => {\n    const preload = Route.useSearch({ select: (s) => s.preload })\n    return (\n      <div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload()}\n            data-testid={'via-beforeLoad'}\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            search={{ reloadDocument: true }}\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload()}\n            data-testid={'via-beforeLoad-reloadDocument'}\n          >\n            via-beforeLoad (reloadDocument=true)\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload()}\n            data-testid={'via-loader'}\n          >\n            via-loader\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            search={{ reloadDocument: true }}\n            preload={preload()}\n            data-testid={'via-loader-reloadDocument'}\n          >\n            via-loader (reloadDocument=true)\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/redirect/$target/via-beforeLoad.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-beforeLoad')({\n  beforeLoad: ({\n    params: { target },\n    search: { reloadDocument, externalHost },\n  }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        const href = externalHost ?? 'http://example.com'\n        throw redirect({ href })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/redirect/$target/via-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-loader')({\n  loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({\n    reloadDocument,\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { externalHost, reloadDocument } }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        const href = externalHost ?? 'http://example.com'\n        throw redirect({ href })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/redirect/$target.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { retainSearchParams } from '@tanstack/solid-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/redirect/$target')({\n  params: {\n    parse: (p) =>\n      z\n        .object({\n          target: z.union([z.literal('internal'), z.literal('external')]),\n        })\n        .parse(p),\n  },\n  validateSearch: z.object({\n    reloadDocument: z.boolean().optional(),\n    preload: z.literal(false).optional(),\n    externalHost: z.string().optional(),\n  }),\n  search: {\n    middlewares: [retainSearchParams(['externalHost'])],\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/redirect/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/')({\n  component: () => (\n    <div>\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'internal' }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        internal\n      </Link>{' '}\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'external' }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        external\n      </Link>\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/redirect/preload/first.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/preload/first')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"first\">\n      <Link\n        from={Route.fullPath}\n        to=\"../second\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        preload=\"intent\"\n        data-testid={'link'}\n      >\n        go to second\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/redirect/preload/second.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/preload/second')({\n  loader: async () => {\n    await new Promise((r) => setTimeout(r, 1000))\n    throw redirect({ from: Route.fullPath, to: '../third' })\n  },\n  component: RouteComponent,\n  pendingComponent: () => <p>second pending</p>,\n})\n\nfunction RouteComponent() {\n  return <div data-testid=\"second\">Hello \"/redirect/preload/second\"!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/redirect/preload/third.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/redirect/preload/third')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div data-testid=\"third\">Hello \"/redirect/preload/third\"!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/index.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\" data-testid=\"relative-routing-home\">\n        Relative Routing Tests - Home\n      </div>\n      <div>\n        <Link to=\"/relative/link\">Using Links</Link>\n        <Link to=\"/relative/useNavigate\">Using useNavigate</Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/link/nested/deep/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/link/nested/deep/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-link-nested-deep-header\">\n      Hello \"/relative/link/nested/deep/\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/link/nested/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/link/nested/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-link-nested-header\">\n      Hello \"/relative/link/nested/\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/link/path/$path/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/link/path/$path/')({\n  component: RouteComponent,\n  loader: ({ params }) => {\n    return params\n  },\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\" data-testid=\"relative-link-path-param-header\">\n        Hello from \"/relative/links/path/{params().path}\"!\n      </div>\n      <div>\n        <Link\n          from=\"/relative/link/path/\"\n          to=\"./$path\"\n          params={{ path: params().path === 'a' ? 'b' : 'a' }}\n          class=\"mr-2\"\n          data-testid=\"relative-link-path-param-switchAB\"\n        >\n          To {params().path === 'a' ? 'b' : 'a'}\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/link/path/index.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/link/path/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\" data-testid=\"relative-link-path-header\">\n        Relative Routing Tests - Path Params\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/link/relative-link-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/link/relative-link-a')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-link-a-header\">\n      Hello \"/relative/link/relative-link-a\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/link/relative-link-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/link/relative-link-b')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-link-b-header\">\n      Hello \"/relative/link/relative-link-b\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/link/route.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useNavigate,\n} from '@tanstack/solid-router'\nimport { createEffect } from 'solid-js'\n\nexport const Route = createFileRoute('/relative/link')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n\n  createEffect(() => {\n    console.log('navigate')\n  })\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\" data-testid=\"relative-link-header\">\n        Relative Routing - Links - Index\n      </div>\n      <div>\n        <Link\n          from=\"/relative/link\"\n          to=\"..\"\n          data-testid=\"relative-link-home\"\n          class=\"mr-2 underline\"\n        >\n          Return To Home\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\".\"\n          data-testid=\"relative-link-index\"\n          class=\"mr-2\"\n        >\n          Return To Index\n        </Link>\n        <Link to=\".\" data-testid=\"relative-link-reload\" class=\"mr-2 underline\">\n          Reload\n        </Link>\n        <Link to=\"..\" data-testid=\"relative-link-back\" class=\"mr-2 underline\">\n          Back\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\"./relative-link-a\"\n          data-testid=\"relative-link-a\"\n          class=\"mr-2 underline\"\n        >\n          To Relative Link A\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\"./relative-link-b\"\n          data-testid=\"relative-link-b\"\n          class=\"mr-2 underline\"\n        >\n          To Relative Link B\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\"./nested/deep\"\n          data-testid=\"relative-link-deeply-nested\"\n          class=\"mr-2 underline\"\n        >\n          To Deeply Nested\n        </Link>\n        <Link\n          to=\"/relative/link/path/$path\"\n          params={{ path: 'a' }}\n          data-testid=\"relative-link-path\"\n          class=\"mr-2 underline\"\n        >\n          To Path Param A\n        </Link>\n        <Link\n          from=\"/relative/link\"\n          to=\"./with-search\"\n          search={{ searchParam: '1' }}\n          data-testid=\"relative-link-withSearch\"\n          class=\"mr-2 underline\"\n        >\n          To With Search Params\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/link/with-search/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/relative/link/with-search/')({\n  component: RouteComponent,\n  validateSearch: z.object({\n    searchParam: z.string().default('1'),\n  }),\n})\n\nfunction RouteComponent() {\n  const searchParams = Route.useSearch()\n  return (\n    <>\n      <div data-testid=\"relative-link-withSearch-header\">\n        Hello \"/relative/link/with-search/\" searchParam:{' '}\n        {searchParams().searchParam}!\n      </div>\n      <hr />\n      <Link\n        to=\".\"\n        data-testid=\"relative-link-withSearch-update-param\"\n        search={{ searchParam: '2' }}\n      >\n        Update Search\n      </Link>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/nested/deep/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/useNavigate/nested/deep/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-useNavigate-nested-deep-header\">\n      Hello \"/relative/useNavigate/nested/deep/\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/nested/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/useNavigate/nested/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-useNavigate-nested-header\">\n      Hello \"/relative/useNavigate/nested/\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/path/$path/index.tsx",
    "content": "import { createFileRoute, useNavigate } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/useNavigate/path/$path/')({\n  component: RouteComponent,\n  loader: ({ params }) => {\n    return params\n  },\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n\n  const params = Route.useParams()\n\n  return (\n    <div class=\"p-2\">\n      <div\n        class=\"border-b\"\n        data-testid=\"relative-useNavigate-path-param-header\"\n      >\n        Hello from \"/relative/useNavigate/path/{params().path}\"!\n      </div>\n      <div>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate/path/',\n              to: './$path',\n              params: { path: params().path === 'a' ? 'b' : 'a' },\n            })\n          }\n          class=\"mr-2\"\n          data-testid=\"relative-useNavigate-path-param-switchAB\"\n        >\n          To {params().path === 'a' ? 'b' : 'a'}\n        </button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/path/index.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative/useNavigate/path/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\" data-testid=\"relative-useNavigate-path-header\">\n        Relative Routing Tests - Path Params\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute(\n  '/relative/useNavigate/relative-useNavigate-a',\n)({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-useNavigate-a-header\">\n      Hello \"/relative/useNavigate/relative-useNavigate-a\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute(\n  '/relative/useNavigate/relative-useNavigate-b',\n)({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"relative-useNavigate-b-header\">\n      Hello \"/relative/useNavigate/relative-useNavigate-b\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/route.tsx",
    "content": "import { Outlet, createFileRoute, useNavigate } from '@tanstack/solid-router'\nimport { createEffect } from 'solid-js'\n\nexport const Route = createFileRoute('/relative/useNavigate')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n\n  createEffect(() => {\n    console.log('navigate')\n  })\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\" data-testid=\"relative-useNavigate-header\">\n        Relative Routing - Links - Index\n      </div>\n      <div>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: '..',\n            })\n          }\n          data-testid=\"relative-useNavigate-home\"\n          class=\"mr-2 underline\"\n        >\n          Return To Home\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: '.',\n            })\n          }\n          data-testid=\"relative-useNavigate-index\"\n          class=\"mr-2 underline\"\n        >\n          Return To Index\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '.',\n            })\n          }\n          data-testid=\"relative-useNavigate-reload\"\n          class=\"mr-2 underline\"\n        >\n          Reload\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '..',\n            })\n          }\n          data-testid=\"relative-useNavigate-back\"\n          class=\"mr-2 underline\"\n        >\n          Back\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: './relative-useNavigate-a',\n            })\n          }\n          data-testid=\"relative-useNavigate-a\"\n          class=\"mr-2 underline\"\n        >\n          To Relative useNavigate A\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: './relative-useNavigate-b',\n            })\n          }\n          data-testid=\"relative-useNavigate-b\"\n          class=\"mr-2 underline\"\n        >\n          To Relative Link B\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: './nested/deep',\n            })\n          }\n          data-testid=\"relative-useNavigate-deeply-nested\"\n          class=\"mr-2 underline\"\n        >\n          To Deeply Nested\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '/relative/useNavigate/path/$path',\n              params: { path: 'a' },\n            })\n          }\n          data-testid=\"relative-useNavigate-path\"\n          class=\"mr-2 underline\"\n        >\n          To Path Param A\n        </button>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/relative/useNavigate',\n              to: './with-search',\n              search: { searchParam: '1' },\n            })\n          }\n          data-testid=\"relative-useNavigate-withSearch\"\n          class=\"mr-2 underline\"\n        >\n          To With Search Params\n        </button>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/with-search/index.tsx",
    "content": "import { createFileRoute, useNavigate } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/relative/useNavigate/with-search/')({\n  component: RouteComponent,\n  validateSearch: z.object({\n    searchParam: z.string().default('1'),\n  }),\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n  const searchParams = Route.useSearch()\n\n  return (\n    <>\n      <div data-testid=\"relative-useNavigate-withSearch-header\">\n        Hello \"/relative/useNavigate/with-search/\" searchParam:{' '}\n        {searchParams().searchParam}!\n      </div>\n      <hr />\n      <button\n        onClick={() =>\n          navigate({\n            to: '.',\n            search: { searchParam: '2' },\n          })\n        }\n        data-testid=\"relative-useNavigate-withSearch-update-param\"\n      >\n        Update Search\n      </button>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/remountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createSignal } from 'solid-js'\nimport { onMount } from 'solid-js'\n\nexport const Route = createFileRoute('/remountDeps')({\n  validateSearch(search: { searchParam: string }) {\n    return { searchParam: search.searchParam }\n  },\n  loaderDeps(opts) {\n    return opts.search\n  },\n  component: Home,\n  remountDeps(opts) {\n    return opts.search\n  },\n})\n\nconst [mounts, setMounts] = createSignal(0)\n\nfunction Home() {\n  const search = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  onMount(() => {\n    setMounts((m) => m + 1)\n  })\n\n  return (\n    <div class=\"p-2\">\n      <button\n        onClick={() => {\n          navigate({\n            search: { searchParam: Math.random().toString(36).substring(2, 8) },\n          })\n        }}\n      >\n        Regenerate search param\n      </button>\n\n      <div>Search: {search().searchParam}</div>\n      <div data-testid=\"component-mounts\">\n        Page component mounts: {mounts()}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/search-params/default.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/search-params/default')({\n  validateSearch: z.object({\n    default: z.string().default('d1'),\n  }),\n  beforeLoad: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  loader: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const context = Route.useRouteContext()\n    return (\n      <>\n        <div data-testid=\"search-default\">{search().default}</div>\n        <div data-testid=\"context-hello\">{context().hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/search-params/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/search-params/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <Link\n        data-testid=\"link-to-default-without-search\"\n        to=\"/search-params/default\"\n      >\n        go to /search-params/default\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search\"\n        to=\"/search-params/default\"\n        search={{ default: 'd2' }}\n      >\n        go to /search-params/default?default=d2\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search-special-characters\"\n        to=\"/search-params/default\"\n        search={{ default: '🚀대한민국' }}\n      >\n        go to /search-params/default?default=🚀대한민국\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search-encoded-characters\"\n        to=\"/search-params/default\"\n        search={{ default: '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD' }}\n      >\n        go to\n        /search-params/default?default=%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/search-params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/search-params')({\n  beforeLoad: async () => {\n    await new Promise((resolve) => setTimeout(resolve, 100))\n    return { hello: 'world' as string }\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/transition/count/create-resource.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { Suspense, createResource } from 'solid-js'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/transition/count/create-resource')({\n  validateSearch: z.object({\n    n: z.number().default(1),\n  }),\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <Link\n        data-testid=\"increase-button\"\n        class=\"border bg-gray-50 px-3 py-1\"\n        from=\"/transition/count/create-resource\"\n        search={(s) => ({ n: s.n + 1 })}\n      >\n        Increase\n      </Link>\n\n      <Result />\n    </div>\n  )\n}\n\nfunction Result() {\n  const searchQuery = Route.useSearch()\n\n  const [doubleQuery] = createResource(\n    () => searchQuery().n,\n    async (n) => {\n      await new Promise((r) => setTimeout(r, 1000))\n      return n * 2\n    },\n  )\n\n  return (\n    <div class=\"mt-2\">\n      <Suspense fallback=\"Loading...\">\n        <div data-testid=\"n-value\">n: {searchQuery().n}</div>\n        <div data-testid=\"double-value\">double: {doubleQuery()}</div>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/transition/typing/create-resource.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Suspense, createResource } from 'solid-js'\n\nexport const Route = createFileRoute('/transition/typing/create-resource')({\n  validateSearch: (search: { query?: string }) => ({\n    query: search.query ?? '',\n  }),\n  component: Home,\n  ssr: true,\n})\n\nfunction Home() {\n  const searchQuery = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  const [asyncResult] = createResource(\n    () => searchQuery().query,\n    async (query) => {\n      await new Promise((r) => setTimeout(r, 1000))\n      return query\n    },\n  )\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"mt-2\">\n        <input\n          class=\"border bg-gray-50 text-black px-3 py-1\"\n          value={''}\n          placeholder=\"Type to search...\"\n          onInput={(e) => {\n            navigate({ search: { query: e.currentTarget.value } })\n          }}\n        />\n\n        <br />\n\n        <Suspense fallback=\"Loading...\">\n          Query: {searchQuery().query}\n          <br />\n          Result: {asyncResult()}\n        </Suspense>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/대한민국/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/대한민국')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h3 class=\"pb-2\" data-testid=\"unicode-heading\">\n        Hello \"/대한민국\"!\n      </h3>\n      <ul class=\"grid mb-2\">\n        <li>\n          <Link\n            data-testid=\"l-to-named-latin\"\n            from={Route.fullPath}\n            to=\"./🚀/$id\"\n            params={{ id: 'foo' }}\n            activeProps={{ class: 'font-bold' }}\n          >\n            link to latin id\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-named-unicode\"\n            from={Route.fullPath}\n            to=\"./🚀/$id\"\n            params={{ id: 'foo%\\\\/🚀대' }}\n            activeProps={{ class: 'font-bold' }}\n          >\n            link to unicode id\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-latin\"\n            from={Route.fullPath}\n            to=\"./wildcard/$\"\n            params={{ _splat: 'foo/bar' }}\n            activeProps={{ class: 'font-bold' }}\n          >\n            link to foo/bar\n          </Link>\n        </li>\n        <li>\n          <Link\n            data-testid=\"l-to-wildcard-unicode\"\n            from={Route.fullPath}\n            to=\"./wildcard/$\"\n            params={{ _splat: 'foo%\\\\/🚀대' }}\n            activeProps={{ class: 'font-bold' }}\n          >\n            link to foo%\\/🚀대\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/대한민국/wildcard.$.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/대한민국/wildcard/$')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <h3 data-testid=\"unicode-wildcard-heading\">Unicode Wildcard Params</h3>\n      <div>\n        Hello /대한민국/wildcard/\n        <span data-testid=\"unicode-wildcard-params\">{params()._splat}</span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/routes/대한민국/🚀.$id.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/대한민국/🚀/$id')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <h3 data-testid=\"unicode-named-heading\">Unicode Named Params</h3>\n      <div>\n        Hello /대한민국/🚀/\n        <span data-testid=\"unicode-named-params\">{params().id}</span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest(\"useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest('useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest(\"legacy useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('legacy useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('legacy Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('useCanGoBack correctly disables back button', async ({ page }) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goForward()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\ntest('useCanGoBack correctly disables back button, using router.history and window.history', async ({\n  page,\n}) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\nconst testCases = [\n  {\n    description: 'Navigating to a route inside a route group',\n    testId: 'link-to-route-inside-group',\n  },\n  {\n    description:\n      'Navigating to a route inside a subfolder inside a route group ',\n    testId: 'link-to-route-inside-group-inside-subfolder',\n  },\n  {\n    description: 'Navigating to a route inside a route group inside a layout',\n    testId: 'link-to-route-inside-group-inside-layout',\n  },\n  {\n    description: 'Navigating to a lazy route inside a route group',\n    testId: 'link-to-lazy-route-inside-group',\n  },\n\n  {\n    description: 'Navigating to the only route inside a route group ',\n    testId: 'link-to-only-route-inside-group',\n  },\n]\n\ntestCases.forEach(({ description, testId }) => {\n  test(description, async ({ page }) => {\n    await page.getByTestId(testId).click()\n    await expect(page.getByTestId('search-via-hook')).toContainText('world')\n    await expect(page.getByTestId('search-via-route-hook')).toContainText(\n      'world',\n    )\n    await expect(page.getByTestId('search-via-route-api')).toContainText(\n      'world',\n    )\n  })\n})\n\ntest('navigating to an unnested route', async ({ page }) => {\n  const postId = 'hello-world'\n  page.goto(`/posts/${postId}/edit`)\n  await expect(page.getByTestId('params-via-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-api')).toContainText(postId)\n})\n\nasync function getRenderCount(page: Page) {\n  const renderCount = parseInt(\n    await page.getByTestId('render-count').innerText(),\n  )\n  return renderCount\n}\nasync function structuralSharingTest(page: Page, enabled: boolean) {\n  page.goto(`/structural-sharing/${enabled}/?foo=f1&bar=b1`)\n  await expect(page.getByTestId('enabled')).toHaveText(JSON.stringify(enabled))\n\n  async function checkSearch({ foo, bar }: { foo: string; bar: string }) {\n    expect(page.url().endsWith(`?foo=${foo}&bar=${bar}`)).toBe(true)\n    const expectedSearch = JSON.stringify({ values: [foo, bar] })\n    await expect(page.getByTestId('search-via-hook')).toHaveText(expectedSearch)\n    await expect(page.getByTestId('search-via-route-hook')).toHaveText(\n      expectedSearch,\n    )\n    await expect(page.getByTestId('search-via-route-api-hook')).toHaveText(\n      expectedSearch,\n    )\n  }\n\n  await checkSearch({ bar: 'b1', foo: 'f1' })\n  await page.getByTestId('link').click()\n  await checkSearch({ bar: 'b2', foo: 'f2' })\n}\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n\ntest('Should change post navigating back and forth', async ({ page }) => {\n  await page.goto('/posts/1')\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n\n  await page.getByRole('link', { name: 'qui est esse' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('qui est esse')\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('sunt aut facere')\n})\n\ntest('Should not remount deps when remountDeps does not change ', async ({\n  page,\n}) => {\n  await page.goto('/notRemountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n})\n\ntest('Should remount deps when remountDeps does change ', async ({ page }) => {\n  await page.goto('/remountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 2',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 3',\n  )\n})\n\ntest.describe('Unicode route rendering', () => {\n  test('should render non-latin route correctly', async ({ page, baseURL }) => {\n    await page.goto('/대한민국')\n\n    await expect(page.locator('body')).toContainText('Hello \"/대한민국\"!')\n\n    expect(page.url()).toBe(`${baseURL}/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`)\n  })\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/hover-preload-hash.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { toRuntimePath } from '@tanstack/router-e2e-utils'\n\ntest('clicking hash link then hovering another link does not scroll back to hash', async ({\n  page,\n}) => {\n  // Go to the page without hash\n  await page.goto(toRuntimePath('/hover-preload-hash'))\n\n  // Click the hash link to navigate to position1\n  await page.getByTestId('link-to-hash').click()\n  await expect(page.locator('#position1')).toBeInViewport()\n\n  // Scroll up so position1 is no longer in view\n  await page.evaluate(() => window.scrollTo(0, 0))\n  await expect(page.locator('#position1')).not.toBeInViewport()\n\n  // Hover the link to trigger intent preload (should NOT scroll back)\n  await page.getByTestId('link-to-only-route-inside-group').hover()\n  await page.waitForTimeout(400)\n\n  // Ensure we did not jump back to the hash target\n  await expect(page.locator('#position1')).not.toBeInViewport()\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/mask.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('route masks transform params and expose masked pathname in the browser (solid)', async ({\n  page,\n}) => {\n  await page.goto('/')\n\n  await page.getByTestId('link-to-masks').click()\n  await expect(page.getByText('Route Masks')).toBeVisible()\n\n  const link = page.getByTestId('link-to-admin-mask')\n  await link.click()\n\n  await page.waitForURL('/masks/public/user-42')\n\n  await expect(page.getByTestId('admin-user-component')).toBeInViewport()\n  await expect(page.getByTestId('admin-user-id')).toHaveText('42')\n\n  await expect(page.getByTestId('router-pathname')).toHaveText(\n    '/masks/admin/42',\n  )\n\n  await expect(page.getByTestId('router-masked-pathname')).toHaveText(\n    '/masks/public/user-42',\n  )\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/non-nested-paths.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\nconst testCases: Array<{\n  name: string\n  testPathDesc: string\n  testPathPrefix: string\n  testPathSuffix: string\n  paramValue: Record<string, string>\n  paramValue2: Record<string, string>\n}> = [\n  {\n    name: 'Named path params',\n    testPathDesc: 'named',\n    testPathPrefix: '',\n    testPathSuffix: '',\n    paramValue: { baz: 'baz' },\n    paramValue2: { baz: 'baz_' },\n  },\n  {\n    name: 'prefix params',\n    testPathPrefix: 'prefix',\n    testPathSuffix: '',\n    testPathDesc: 'prefix',\n    paramValue: { baz: 'baz' },\n    paramValue2: { baz: 'baz_' },\n  },\n  {\n    name: 'suffix params',\n    testPathPrefix: '',\n    testPathSuffix: 'suffix',\n    testPathDesc: 'suffix',\n    paramValue: { baz: 'baz' },\n    paramValue2: { baz: 'baz2' },\n  },\n  {\n    name: 'path',\n    testPathPrefix: '',\n    testPathSuffix: '',\n    testPathDesc: 'path',\n    paramValue: {},\n    paramValue2: {},\n  },\n]\n\ntest.describe('Non-nested paths', () => {\n  testCases.forEach(\n    ({\n      name,\n      testPathDesc,\n      testPathPrefix,\n      testPathSuffix,\n      paramValue,\n      paramValue2,\n    }) => {\n      test.describe(name, () => {\n        const path = `/non-nested/${testPathDesc}`\n        const paramNameDesc = Object.keys(paramValue)[0] ?? 'baz'\n\n        test.beforeEach(async ({ page }) => {\n          await page.goto('/non-nested')\n          await page.waitForURL('/non-nested')\n        })\n\n        test('Should not un-nest nested paths', async ({ page }) => {\n          const nonNestedPathHeading = page.getByTestId(\n            'non-nested-path-heading',\n          )\n          await expect(nonNestedPathHeading).toBeVisible()\n\n          await page.getByTestId(`l-to-${testPathDesc}`).click()\n          await page.waitForURL(path)\n\n          const rootRouteHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-root-route-heading`,\n          )\n\n          await expect(rootRouteHeading).toBeVisible()\n\n          const pathRouteHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-route-heading`,\n          )\n\n          const indexHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-index-heading`,\n          )\n\n          const fooHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-foo-heading`,\n          )\n\n          const indexParams = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-index-param`,\n          )\n\n          const fooParams = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-foo-param`,\n          )\n\n          const indexLink = page.getByTestId(`to-${testPathDesc}-index`)\n          const fooLink = page.getByTestId(`to-${testPathDesc}-foo`)\n          const foo2Link = page.getByTestId(`to-${testPathDesc}-foo-2`)\n\n          const indexPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}`\n          const fooPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}/foo`\n          const foo2Path = `${path}/${testPathPrefix}${paramValue2[paramNameDesc] ?? 'baz'}${testPathSuffix}/foo`\n\n          console.log(await indexLink.getAttribute('href'))\n          await expect(indexLink).toHaveAttribute('href', indexPath)\n          await expect(fooLink).toHaveAttribute('href', fooPath)\n          await expect(foo2Link).toHaveAttribute('href', foo2Path)\n\n          await indexLink.click()\n          await page.waitForURL(indexPath)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).toBeVisible()\n          await expect(indexHeading).toBeVisible()\n          const indexParamValue = await indexParams.innerText()\n          expect(JSON.parse(indexParamValue)).toEqual(paramValue)\n\n          await fooLink.click()\n          await page.waitForURL(fooPath)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).toBeVisible()\n          await expect(fooHeading).toBeVisible()\n          const fooParamValue = await fooParams.innerText()\n          expect(JSON.parse(fooParamValue)).toEqual(paramValue)\n\n          await foo2Link.click()\n          await page.waitForURL(foo2Path)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).toBeVisible()\n          await expect(fooHeading).toBeVisible()\n          const foo2ParamValue = await fooParams.innerText()\n          expect(JSON.parse(foo2ParamValue)).toEqual(paramValue2)\n        })\n\n        test('Should not nest non-nested paths', async ({ page }) => {\n          const nonNestedPathHeading = page.getByTestId(\n            'non-nested-path-heading',\n          )\n          await expect(nonNestedPathHeading).toBeVisible()\n\n          await page.getByTestId(`l-to-${testPathDesc}`).click()\n          await page.waitForURL(path)\n\n          const rootRouteHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-root-route-heading`,\n          )\n\n          await expect(rootRouteHeading).toBeVisible()\n\n          const pathRouteHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-route-heading`,\n          )\n\n          const barHeading = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-bar-heading`,\n          )\n\n          const barParams = page.getByTestId(\n            `non-nested-${testPathDesc}-${paramNameDesc}-bar-param`,\n          )\n\n          const barLink = page.getByTestId(`to-${testPathDesc}-bar`)\n          const bar2Link = page.getByTestId(`to-${testPathDesc}-bar-2`)\n\n          const barPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}/bar`\n          const bar2Path = `${path}/${testPathPrefix}${paramValue2[paramNameDesc] ?? 'baz'}${testPathSuffix}/bar`\n          await expect(barLink).toHaveAttribute('href', barPath)\n\n          await expect(bar2Link).toHaveAttribute('href', bar2Path)\n\n          await barLink.click()\n          await page.waitForURL(barPath)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).not.toBeVisible()\n          await expect(barHeading).toBeVisible()\n          const barParamValue = await barParams.innerText()\n          expect(JSON.parse(barParamValue)).toEqual(paramValue)\n\n          await bar2Link.click()\n          await page.waitForURL(bar2Path)\n          await expect(rootRouteHeading).toBeVisible()\n          await expect(pathRouteHeading).not.toBeVisible()\n          await expect(barHeading).toBeVisible()\n          const bar2ParamValue = await barParams.innerText()\n          expect(JSON.parse(bar2ParamValue)).toEqual(paramValue2)\n        })\n      })\n    },\n  )\n})\n\ntest.describe('Deeply nested non-nested paths', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/non-nested/deep')\n    await page.waitForURL('/non-nested/deep')\n  })\n\n  test('It should nest nested paths 1 level deep', async ({ page }) => {\n    const rootRouteHeading = page.getByTestId(\n      `non-nested-deep-root-route-heading`,\n    )\n\n    await expect(rootRouteHeading).toBeVisible()\n\n    const bazLink = page.getByTestId('to-deep-baz')\n    await bazLink.click()\n    await page.waitForURL('/non-nested/deep/baz')\n    const bazRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-route-heading',\n    )\n    const bazIndexHeading = page.getByTestId(\n      'non-nested-deep-baz-index-heading',\n    )\n    const bazIndexParams = page.getByTestId('non-nested-deep-baz-index-param')\n\n    await expect(bazRouteHeading).toBeVisible()\n    await expect(bazIndexHeading).toBeVisible()\n    expect(await bazIndexParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz' }),\n    )\n  })\n\n  test('It should not nest non-nested paths 1 level deep', async ({ page }) => {\n    const rootRouteHeading = page.getByTestId(\n      `non-nested-deep-root-route-heading`,\n    )\n\n    await expect(rootRouteHeading).toBeVisible()\n    const bazBarLink = page.getByTestId('to-deep-baz-bar')\n\n    await bazBarLink.click()\n    await page.waitForURL('/non-nested/deep/baz-bar/bar')\n    const bazRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-route-heading',\n    )\n    const bazBarRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-route-heading',\n    )\n    const bazBarIndexHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-index-heading',\n    )\n    const bazBarIndexParams = page.getByTestId(\n      'non-nested-deep-baz-bar-index-param',\n    )\n\n    await expect(bazRouteHeading).not.toBeVisible()\n    await expect(bazBarRouteHeading).toBeVisible()\n    await expect(bazBarIndexHeading).toBeVisible()\n    expect(await bazBarIndexParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz-bar' }),\n    )\n  })\n\n  test('It should not nest non-nested paths 2 levels deep', async ({\n    page,\n  }) => {\n    const rootRouteHeading = page.getByTestId(\n      `non-nested-deep-root-route-heading`,\n    )\n\n    await expect(rootRouteHeading).toBeVisible()\n\n    const bazBarQuxLink = page.getByTestId('to-deep-baz-bar-qux')\n    await bazBarQuxLink.click()\n\n    await page.waitForURL('/non-nested/deep/baz-bar-qux/bar/qux')\n    const bazRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-route-heading',\n    )\n    const bazBarRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-route-heading',\n    )\n    const bazBarQuxHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-qux-heading',\n    )\n    const bazBarQuxParams = page.getByTestId(\n      'non-nested-deep-baz-bar-qux-param',\n    )\n\n    await expect(bazRouteHeading).not.toBeVisible()\n    await expect(bazBarRouteHeading).not.toBeVisible()\n    await expect(bazBarQuxHeading).toBeVisible()\n    await expect(bazBarQuxParams).toBeVisible()\n    expect(await bazBarQuxParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz-bar-qux' }),\n    )\n  })\n\n  test('It should nest and un-nest non-nested across paths multiple levels deep', async ({\n    page,\n  }) => {\n    const rootRouteHeading = page.getByTestId(\n      `non-nested-deep-root-route-heading`,\n    )\n\n    await expect(rootRouteHeading).toBeVisible()\n\n    const bazBarFooLink = page.getByTestId('to-deep-baz-bar-foo')\n    await bazBarFooLink.click()\n\n    await page.waitForURL('/non-nested/deep/baz-bar/bar/foo')\n\n    const bazRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-route-heading',\n    )\n    const bazBarRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-route-heading',\n    )\n    const bazBarFooRouteHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-route-heading',\n    )\n    const bazBarFooIndexHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-index-heading',\n    )\n    const bazBarFooIndexParams = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-index-param',\n    )\n\n    await expect(bazRouteHeading).not.toBeVisible()\n    await expect(bazBarRouteHeading).toBeVisible()\n    await expect(bazBarFooRouteHeading).toBeVisible()\n    await expect(bazBarFooIndexHeading).toBeVisible()\n    await expect(bazBarFooIndexParams).toBeVisible()\n    expect(await bazBarFooIndexParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz-bar', foo: 'foo' }),\n    )\n\n    const bazBarFooQuxLink = page.getByTestId('to-deep-baz-bar-foo-qux')\n    await bazBarFooQuxLink.click()\n    await page.waitForURL('/non-nested/deep/baz-bar-qux/bar/foo/qux')\n\n    const bazBarFooQuxHeading = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-qux-heading',\n    )\n    const bazBarFooQuxParams = page.getByTestId(\n      'non-nested-deep-baz-bar-foo-qux-param',\n    )\n\n    await expect(bazRouteHeading).not.toBeVisible()\n    await expect(bazBarRouteHeading).toBeVisible()\n    await expect(bazBarFooRouteHeading).not.toBeVisible()\n    await expect(bazBarFooQuxHeading).toBeVisible()\n    await expect(bazBarFooQuxParams).toBeVisible()\n    expect(await bazBarFooQuxParams.innerText()).toBe(\n      JSON.stringify({ baz: 'baz-bar-qux', foo: 'foo' }),\n    )\n  })\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/params.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest.describe('ensure single params have been parsed correctly whilst being stable in the browser', () => {\n  const cases = [\n    { value: 'hello', expected: 'hello' },\n    {\n      value: '100%25',\n      expected: '100%',\n    },\n    {\n      value: '100%2525',\n      expected: '100%25',\n    },\n    {\n      value: '100%26',\n      expected: '100&',\n    },\n  ]\n\n  function getParsedValue(page: Page) {\n    return page.getByTestId('parsed-param-value').textContent()\n  }\n\n  for (const { value, expected } of cases) {\n    test(`navigating to /params/single/${value}`, async ({ page, baseURL }) => {\n      await page.goto(`/params/single/${value}`)\n\n      // on the first run, the value should be the same as the expected value\n      const valueOnFirstRun = await getParsedValue(page)\n      expect(valueOnFirstRun).toBe(expected)\n\n      // the url/pathname should be the same as the expected value\n      const urlOnFirstRun = page.url().replace(baseURL!, '')\n      expect(urlOnFirstRun).toBe(`/params/single/${value}`)\n\n      // click on the self link to the same value\n      await page.getByTestId('self-link-same').click()\n      const valueOnSecondRun = await getParsedValue(page)\n      expect(valueOnSecondRun).toBe(expected)\n\n      // click on the self link to the amended value\n      await page.getByTestId('self-link-amended').click()\n      const valueOnThirdRun = await getParsedValue(page)\n      expect(valueOnThirdRun).toBe(`e2e${expected}`)\n\n      // the url/pathname should be the same as the expected value\n      const urlOnThirdRun = page.url().replace(baseURL!, '')\n      expect(urlOnThirdRun).toBe(`/params/single/e2e${value}`)\n    })\n  }\n})\n\ntest.describe('params operations + non-nested routes', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/params-ps/non-nested')\n  })\n\n  test('useParams must resolve non-nested path params', async ({ page }) => {\n    await page.waitForURL('/params-ps/non-nested')\n\n    const fooBarLink = page.getByTestId('l-to-non-nested-foo-bar')\n\n    const foo2Bar2Link = page.getByTestId('l-to-non-nested-foo2-bar2')\n\n    await expect(fooBarLink).toHaveAttribute(\n      'href',\n      '/params-ps/non-nested/foo/bar',\n    )\n\n    await fooBarLink.click()\n    await page.waitForURL('/params-ps/non-nested/foo/bar')\n    const pagePathname = new URL(page.url()).pathname\n    expect(pagePathname).toBe('/params-ps/non-nested/foo/bar')\n\n    const fooParamsValue = page.getByTestId('foo-params-value')\n    const fooParamsText = await fooParamsValue.innerText()\n    const fooParamsObj = JSON.parse(fooParamsText)\n    expect(fooParamsObj).toEqual({ foo: 'foo' })\n\n    const paramsValue = page.getByTestId('foo-bar-params-value')\n    const paramsText = await paramsValue.innerText()\n    const paramsObj = JSON.parse(paramsText)\n    expect(paramsObj).toEqual({ foo: 'foo', bar: 'bar' })\n\n    await expect(foo2Bar2Link).toHaveAttribute(\n      'href',\n      '/params-ps/non-nested/foo2/bar2',\n    )\n    await foo2Bar2Link.click()\n    await page.waitForURL('/params-ps/non-nested/foo2/bar2')\n    const pagePathname2 = new URL(page.url()).pathname\n    expect(pagePathname2).toBe('/params-ps/non-nested/foo2/bar2')\n\n    const foo2ParamsValue = page.getByTestId('foo-params-value')\n    const foo2ParamsText = await foo2ParamsValue.innerText()\n    const foo2ParamsObj = JSON.parse(foo2ParamsText)\n    expect(foo2ParamsObj).toEqual({ foo: 'foo2' })\n\n    const params2Value = page.getByTestId('foo-bar-params-value')\n    const params2Text = await params2Value.innerText()\n    const params2Obj = JSON.parse(params2Text)\n    expect(params2Obj).toEqual({ foo: 'foo2', bar: 'bar2' })\n  })\n})\n\ntest.describe('params operations + prefix/suffix', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/params-ps')\n  })\n\n  test.describe('named params', () => {\n    const NAMED_PARAMS_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-named-foo',\n        pathname: '/params-ps/named/foo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFoo',\n      },\n      {\n        id: 'l-to-named-prefixfoo',\n        pathname: '/params-ps/named/prefixfoo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooPrefix',\n      },\n      {\n        id: 'l-to-named-foosuffix',\n        pathname: '/params-ps/named/foosuffix',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooSuffix',\n      },\n      {\n        id: 'l-to-named-foo-special-characters',\n        pathname: '/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80',\n        params: { foo: 'foo%\\\\/🚀대' },\n        destHeadingId: 'ParamsNamedFoo',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n\n    test(`ensure use params doesn't cause excess renders and is stable across various usage options`, async ({\n      page,\n    }) => {\n      await page.goto('/params-ps/named/foo')\n      await page.waitForLoadState('networkidle')\n\n      const pagePathname = new URL(page.url()).pathname\n      expect(pagePathname).toBe('/params-ps/named/foo')\n\n      const fooRenderCount = page.getByTestId('foo-render-count')\n      const fooIndexLink = page.getByTestId('params-foo-links-index')\n      const fooBar1Link = page.getByTestId('params-foo-links-bar1')\n      const fooBar2Link = page.getByTestId('params-foo-links-bar2')\n      const fooBarBazLink = page.getByTestId('params-foo-bar-links-baz')\n      const fooValue = page.getByTestId('params-output')\n      const fooBarValue = page.getByTestId('foo-bar-value')\n      const fooBazInBarValue = page.getByTestId('foo-baz-in-bar-value')\n      const fooBarRenderCount = page.getByTestId('foo-bar-render-count')\n      const fooBarBazValue = page.getByTestId('foo-bar-baz-value')\n\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooValue).toBeInViewport()\n      await expect(fooIndexLink).toBeInViewport()\n      await expect(fooBar1Link).toBeInViewport()\n      await expect(fooBar2Link).toBeInViewport()\n      await expect(fooRenderCount).toHaveText('1')\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n\n      await fooBar1Link.click()\n      await page.waitForLoadState('networkidle')\n      await expect(fooValue).toBeInViewport()\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooBarRenderCount).toBeInViewport()\n      await expect(fooBarValue).toBeInViewport()\n      await expect(fooBazInBarValue).toBeInViewport()\n      await expect(fooBarBazLink).toBeInViewport()\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n      await expect(fooRenderCount).toHaveText('1')\n      await expect(fooBarRenderCount).toHaveText('1')\n      await expect(fooBarValue).toHaveText('1')\n      await expect(fooBazInBarValue).toHaveText('no param')\n\n      await fooBarBazLink.click()\n      await page.waitForLoadState('networkidle')\n      await expect(fooValue).toBeInViewport()\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooBarRenderCount).toBeInViewport()\n      await expect(fooBarValue).toBeInViewport()\n      await expect(fooBazInBarValue).toBeInViewport()\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n      await expect(fooRenderCount).toHaveText('1')\n      await expect(fooBarRenderCount).toHaveText('2')\n      await expect(fooBarValue).toHaveText('1')\n      await expect(fooBazInBarValue).toHaveText('1_10')\n      await expect(fooBarBazValue).toHaveText('1_10')\n\n      await fooBar2Link.click()\n      await page.waitForLoadState('networkidle')\n      await expect(fooValue).toBeInViewport()\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooBarValue).toBeInViewport()\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n      await expect(fooRenderCount).toHaveText('1')\n      await expect(fooBarValue).toHaveText('2')\n\n      await fooIndexLink.click()\n      await page.waitForLoadState('networkidle')\n      await expect(fooValue).toBeInViewport()\n      await expect(fooRenderCount).toBeInViewport()\n      await expect(fooBarValue).not.toBeInViewport()\n      await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' }))\n      await expect(fooRenderCount).toHaveText('1')\n    })\n  })\n\n  test.describe('wildcard param', () => {\n    const WILDCARD_PARAM_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-wildcard-foo',\n        pathname: '/params-ps/wildcard/foo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n      {\n        id: 'l-to-wildcard-prefixfoo',\n        pathname: '/params-ps/wildcard/prefixfoo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatPrefix',\n      },\n      {\n        id: 'l-to-wildcard-foosuffix',\n        pathname: '/params-ps/wildcard/foosuffix',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatSuffix',\n      },\n      {\n        id: 'l-to-wildcard-escaped',\n        pathname: `/params-ps/wildcard/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]`,\n        params: {\n          _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n          '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n        },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n      {\n        id: 'l-to-wildcard-prefix-escaped',\n        pathname: `/params-ps/wildcard/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]`,\n        params: {\n          _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n          '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n        },\n        destHeadingId: 'ParamsWildcardSplatPrefix',\n      },\n      {\n        id: 'l-to-wildcard-suffix-escaped',\n        pathname: `/params-ps/wildcard/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]suffix@%EB%8C%80`,\n        params: {\n          _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n          '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n        },\n        destHeadingId: 'ParamsWildcardSplatSuffix',\n      },\n      {\n        id: 'l-to-wildcard-encoded',\n        pathname:\n          '/params-ps/wildcard/%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n        params: {\n          '*': '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n          _splat: '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n        },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n  })\n})\n\ntest.describe('Unicode params', () => {\n  test('should render non-latin route correctly across multiple params', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto('/params-ps')\n    await page.waitForURL('/params-ps')\n    const fooLink = page.getByTestId('l-to-named-foo-special-characters')\n\n    await fooLink.click()\n    await page.waitForURL('/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80')\n\n    expect(page.url()).toBe(\n      `${baseURL}/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80`,\n    )\n\n    const headingEl = page.getByRole('heading', { name: 'ParamsNamedFoo' })\n    await expect(headingEl).toBeVisible()\n    let paramsEl = page.getByTestId('params-output')\n    let paramsText = await paramsEl.innerText()\n    expect(paramsText).toEqual(JSON.stringify({ foo: 'foo%\\\\/🚀대' }))\n\n    const barLink = page.getByTestId('params-foo-links-bar-special-characters')\n\n    await barLink.click()\n\n    await page.waitForURL(\n      '/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80/%F0%9F%9A%80%252F%2Fabc%EB%8C%80',\n    )\n\n    expect(page.url()).toBe(\n      `${baseURL}/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80/%F0%9F%9A%80%252F%2Fabc%EB%8C%80`,\n    )\n\n    paramsEl = page.getByTestId('foo-bar-value')\n    paramsText = await paramsEl.innerText()\n    expect(paramsText).toEqual('🚀%2F/abc대')\n  })\n\n  test.describe('should handle routes with non-latin paths and params correctly', () => {\n    const testCases = [\n      {\n        name: 'named',\n        childPath: '🚀',\n        latinParams: 'foo',\n        unicodeParams: 'foo%\\\\/🚀대',\n      },\n      {\n        name: 'wildcard',\n        childPath: 'wildcard',\n        latinParams: 'foo/bar',\n        unicodeParams: 'foo%\\\\/🚀대',\n      },\n    ]\n\n    testCases.forEach(({ name, childPath, latinParams, unicodeParams }) => {\n      test(`${name} params`, async ({ page, baseURL }) => {\n        const pascalCaseName = name.charAt(0).toUpperCase() + name.slice(1)\n        const routeParentPath = '/대한민국'\n        const encodedRouteParentPath = encodeURI(routeParentPath)\n        const childRoutePath = `${routeParentPath}/${childPath}`\n        const encodedChildRoutePath = encodeURI(childRoutePath)\n\n        await page.goto(routeParentPath)\n        await page.waitForURL(encodedRouteParentPath)\n\n        const headingRootEl = page.getByTestId('unicode-heading')\n\n        expect(await headingRootEl.innerText()).toBe('Hello \"/대한민국\"!')\n\n        const latinLink = page.getByTestId(`l-to-${name}-latin`)\n        const unicodeLink = page.getByTestId(`l-to-${name}-unicode`)\n\n        await expect(latinLink).not.toContainClass('font-bold')\n        await expect(unicodeLink).not.toContainClass('font-bold')\n\n        await latinLink.click()\n\n        await page.waitForURL(`${encodedChildRoutePath}/${latinParams}`)\n\n        expect(page.url()).toBe(\n          `${baseURL}${encodedChildRoutePath}/${latinParams}`,\n        )\n\n        await expect(latinLink).toContainClass('font-bold')\n        await expect(unicodeLink).not.toContainClass('font-bold')\n\n        const headingEl = page.getByTestId(`unicode-${name}-heading`)\n        const paramsEl = page.getByTestId(`unicode-${name}-params`)\n\n        expect(await headingEl.innerText()).toBe(\n          `Unicode ${pascalCaseName} Params`,\n        )\n\n        expect(await paramsEl.innerText()).toBe(latinParams)\n\n        await unicodeLink.click()\n\n        const encodedParams =\n          name === 'wildcard'\n            ? encodeURI(unicodeParams)\n            : encodeURIComponent(unicodeParams)\n\n        await page.waitForURL(`${encodedChildRoutePath}/${encodedParams}`)\n\n        expect(page.url()).toBe(\n          `${baseURL}${encodedChildRoutePath}/${encodedParams}`,\n        )\n\n        await expect(latinLink).not.toContainClass('font-bold')\n        await expect(unicodeLink).toContainClass('font-bold')\n\n        expect(await headingEl.innerText()).toBe(\n          `Unicode ${pascalCaseName} Params`,\n        )\n        expect(await paramsEl.innerText()).toBe(unicodeParams)\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/redirect.spec.ts",
    "content": "import queryString from 'node:querystring'\nimport { expect, test } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  localDummyServer,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\nimport type { Server } from 'node:http'\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_HOST_PORT = await getDummyServerPort(packageJson.name)\n\ntest.describe('redirects', () => {\n  const internalNavigationTestMatrix = combinate({\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n    preload: [false, true] as const,\n  })\n\n  internalNavigationTestMatrix.forEach(\n    ({ thrower, reloadDocument, preload }) => {\n      test(`internal target, navigation: thrower: ${thrower}, reloadDocument: ${reloadDocument}, preload: ${preload}`, async ({\n        page,\n      }) => {\n        await page.waitForLoadState('networkidle')\n        await page.goto(\n          `/redirect/internal${preload === false ? '?preload=false' : ''}`,\n        )\n        const link = page.getByTestId(\n          `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`,\n        )\n\n        await page.waitForLoadState('networkidle')\n        let requestHappened = false\n\n        const requestPromise = new Promise<void>((resolve) => {\n          page.on('request', (request) => {\n            if (\n              request.url() === `http://localhost:${EXTERNAL_HOST_PORT}/posts`\n            ) {\n              requestHappened = true\n              resolve()\n            }\n          })\n        })\n        await link.focus()\n\n        const expectRequestHappened = preload && !reloadDocument\n        const timeoutPromise = new Promise((resolve) =>\n          setTimeout(resolve, expectRequestHappened ? 5000 : 500),\n        )\n        await Promise.race([requestPromise, timeoutPromise])\n        await page.waitForLoadState('networkidle')\n        expect(requestHappened).toBe(expectRequestHappened)\n        await link.click()\n        let fullPageLoad = false\n        page.on('domcontentloaded', () => {\n          fullPageLoad = true\n        })\n\n        const url = `http://localhost:${PORT}/posts`\n\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n        expect(fullPageLoad).toBe(reloadDocument)\n      })\n    },\n  )\n\n  const internalDirectVisitTestMatrix = combinate({\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n  })\n\n  internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => {\n    test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({\n      page,\n    }) => {\n      await page.waitForLoadState('networkidle')\n\n      await page.goto(`/redirect/internal/via-${thrower}`)\n\n      const url = `http://localhost:${PORT}/posts`\n\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n      await page.waitForLoadState('networkidle')\n      await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n    })\n  })\n\n  const externalTestMatrix = combinate({\n    scenario: ['navigate', 'direct_visit'] as const,\n    thrower: ['beforeLoad', 'loader'] as const,\n  })\n\n  externalTestMatrix.forEach(({ scenario, thrower }) => {\n    test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({\n      page,\n    }) => {\n      await page.waitForLoadState('networkidle')\n\n      let q = queryString.stringify({\n        externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n      })\n      if (scenario === 'navigate') {\n        await page.goto(`/redirect/external?${q}`)\n        await page.getByTestId(`via-${thrower}`).click()\n      } else {\n        await page.goto(`/redirect/external/via-${thrower}?${q}`)\n      }\n\n      const url = `http://localhost:${EXTERNAL_HOST_PORT}/`\n\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n    })\n  })\n\n  test('regression test for #3097', async ({ page }) => {\n    await page.goto(`/redirect/preload/first`)\n    const link = page.getByTestId(`link`)\n    await link.focus()\n    await link.click()\n    await page.waitForURL('/redirect/preload/third')\n    await expect(page.getByTestId(`third`)).toBeInViewport()\n  })\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/relative.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\nconst PORT = await getTestServerPort(packageJson.name)\n\ntest.describe('relative_routing', () => {\n  const internalNavigationTestMatrix = combinate({\n    navigation: ['link', 'useNavigate'] as const,\n  })\n\n  internalNavigationTestMatrix.forEach(({ navigation }) => {\n    test(`simple relative navigation. navigation: ${navigation}`, async ({\n      page,\n    }) => {\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      const indexLink = page.getByTestId(`relative-${navigation}-index`)\n      const backLink = page.getByTestId(`relative-${navigation}-back`)\n      const relativeRouteA = page.getByTestId(`relative-${navigation}-a`)\n      const relativeRouteB = page.getByTestId(`relative-${navigation}-b`)\n\n      await relativeRouteA.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/relative-${navigation}-a`,\n      )\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-a-header`),\n      ).toBeInViewport()\n\n      await relativeRouteB.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/relative-${navigation}-b`,\n      )\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-b-header`),\n      ).toBeInViewport()\n\n      await indexLink.click()\n\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-b-header`),\n      ).not.toBeInViewport()\n\n      await backLink.click()\n\n      await page.waitForURL(`http://localhost:${PORT}/relative`)\n\n      await expect(page.getByTestId(`relative-routing-home`)).toBeInViewport()\n    })\n\n    test(`nested chilren. navigation: ${navigation}`, async ({ page }) => {\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      const backLink = page.getByTestId(`relative-${navigation}-back`)\n\n      const deeplyNestedChildRoute = page.getByTestId(\n        `relative-${navigation}-deeply-nested`,\n      )\n\n      await deeplyNestedChildRoute.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/nested/deep`,\n      )\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-nested-deep-header`),\n      ).toBeInViewport()\n\n      await backLink.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/nested`,\n      )\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-nested-header`),\n      ).toBeInViewport()\n    })\n\n    test(`with path params. navigation: ${navigation}`, async ({ page }) => {\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      const pathParamRoute = page.getByTestId(`relative-${navigation}-path`)\n\n      await pathParamRoute.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/path/a`,\n      )\n\n      expect(page.url().endsWith('/path/a')).toBe(true)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-path-param-header`),\n      ).toBeInViewport()\n\n      const switchParamLink = page.getByTestId(\n        `relative-${navigation}-path-param-switchAB`,\n      )\n\n      await switchParamLink.click()\n\n      await page.waitForURL(\n        `http://localhost:${PORT}/relative/${navigation}/path/b`,\n      )\n\n      expect(page.url().endsWith('/path/b')).toBe(true)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-path-param-header`),\n      ).toBeInViewport()\n    })\n\n    test(`with search params. navigation: ${navigation}`, async ({ page }) => {\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      const searchParamRoute = page.getByTestId(\n        `relative-${navigation}-withSearch`,\n      )\n\n      await searchParamRoute.click()\n\n      let expectedUrl = new URL(\n        `http://localhost:${PORT}/relative/${navigation}/with-search?searchParam=\"1\"`,\n      )\n\n      await page.waitForLoadState('domcontentloaded')\n\n      expect(page.url().toString()).toBe(expectedUrl.toString())\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-withSearch-header`),\n      ).toBeInViewport()\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-withSearch-header`),\n      ).toContainText('searchParam: 1')\n\n      const updateSearchLink = page.getByTestId(\n        `relative-${navigation}-withSearch-update-param`,\n      )\n\n      await updateSearchLink.click()\n\n      await page.waitForLoadState('domcontentloaded')\n\n      expectedUrl = new URL(\n        `http://localhost:${PORT}/relative/${navigation}/with-search?searchParam=\"2\"`,\n      )\n\n      expect(page.url().toString()).toBe(expectedUrl.toString())\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-withSearch-header`),\n      ).toContainText('searchParam: 2')\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-withSearch-header`),\n      ).toBeInViewport()\n    })\n\n    test(`shouldn't cause excessive rendering. navigation: ${navigation}`, async ({\n      page,\n    }) => {\n      let navigateMsgs = 0\n\n      page.on('console', (msg) => {\n        if (msg.text() === 'navigate') {\n          navigateMsgs++\n        }\n      })\n\n      await page.waitForLoadState('networkidle')\n      await page.goto(`/relative/${navigation}`)\n      await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`)\n\n      await expect(\n        page.getByTestId(`relative-${navigation}-header`),\n      ).toBeInViewport()\n\n      expect(navigateMsgs).toBe(1)\n      const indexLink = page.getByTestId(`relative-${navigation}-index`)\n      const backLink = page.getByTestId(`relative-${navigation}-back`)\n      const relativeRouteA = page.getByTestId(`relative-${navigation}-a`)\n      const relativeRouteB = page.getByTestId(`relative-${navigation}-b`)\n      const deeplyNestedChildRoute = page.getByTestId(\n        `relative-${navigation}-deeply-nested`,\n      )\n      const pathParamRoute = page.getByTestId(`relative-${navigation}-path`)\n      const searchParamRoute = page.getByTestId(\n        `relative-${navigation}-withSearch`,\n      )\n\n      await relativeRouteA.click()\n      await page.waitForLoadState('domcontentloaded')\n      await relativeRouteB.click()\n      await page.waitForLoadState('domcontentloaded')\n      await deeplyNestedChildRoute.click()\n      await page.waitForLoadState('domcontentloaded')\n      await backLink.click()\n      await page.waitForLoadState('domcontentloaded')\n      await pathParamRoute.click()\n      await page.waitForLoadState('domcontentloaded')\n      const switchParamLink = page.getByTestId(\n        `relative-${navigation}-path-param-switchAB`,\n      )\n      await switchParamLink.click()\n      await page.waitForLoadState('domcontentloaded')\n      await searchParamRoute.click()\n      await page.waitForLoadState('domcontentloaded')\n\n      const updateSearchLink = page.getByTestId(\n        `relative-${navigation}-withSearch-update-param`,\n      )\n\n      await updateSearchLink.click()\n      await page.waitForLoadState('domcontentloaded')\n\n      await indexLink.click()\n      await page.waitForLoadState('domcontentloaded')\n\n      expect(navigateMsgs).toBe(1)\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/scroll-into-view.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\nconst anchors = {\n  defaultAnchor: 'default-anchor',\n  noScrollIntoView: 'false-anchor',\n  smoothScroll: 'smooth-scroll',\n} as const\n\nconst formTestIds = {\n  targetAnchor: 'hash-select',\n  scrollIntoView: 'with-scroll',\n  behaviorSelect: 'behavior-select',\n  blockSelect: 'block-select',\n  inlineSelect: 'inline-select',\n  navigateButton: 'navigate-button',\n}\n\nconst shownSuffix = '(shown)'\n\nconst activeClass = 'font-bold active'\n\nfunction getAnchorTarget(page: Page, anchor: string) {\n  return page.getByTestId(`heading-${anchor}`)\n}\n\nfunction getAnchorLink(page: Page, anchor: string) {\n  return page.getByTestId(`link-${anchor}`)\n}\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/anchor')\n})\n\n// Testing the `Link` component with the `hashScrollIntoView` prop\ntest('Navigating via anchor `Link` with default hash scrolling behavior', async ({\n  page,\n}) => {\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  await getAnchorLink(page, anchors.defaultAnchor).click()\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).toBeVisible()\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.defaultAnchor)).toHaveClass(\n    activeClass,\n  )\n})\n\ntest('Navigating via anchor `Link` with hash scrolling disabled', async ({\n  page,\n}) => {\n  const initialScrollPosition = await page.evaluate(() => window.scrollY)\n\n  await expect(\n    getAnchorTarget(page, anchors.noScrollIntoView),\n  ).not.toContainText(shownSuffix)\n\n  await getAnchorLink(page, anchors.noScrollIntoView).click()\n\n  // The active anchor should have updated\n  await expect(getAnchorLink(page, anchors.noScrollIntoView)).toHaveClass(\n    activeClass,\n  )\n\n  // The anchor should not have been visible, because the scroll should not have been activated\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  // Expect the same scroll position as before\n  expect(await page.evaluate(() => window.scrollY)).toBe(initialScrollPosition)\n})\n\ntest('Navigating via anchor `Link` with smooth hash scrolling behavior', async ({\n  page,\n}) => {\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  await getAnchorLink(page, anchors.smoothScroll).click()\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).toBeVisible()\n\n  // Smooth scrolling should activate the IntersectionObserver on all headings, making them all render \"(shown)\"\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText(\n    shownSuffix,\n  )\n  await expect(getAnchorTarget(page, anchors.noScrollIntoView)).toContainText(\n    shownSuffix,\n  )\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass(\n    activeClass,\n  )\n})\n\n// Testing the `useNavigate` hook with the `hashScrollIntoView` option\ntest('Navigating via `useNavigate` with instant scroll behavior', async ({\n  page,\n}) => {\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  // Scroll to the last anchor instantly, should not activate Intersection Observers for the other anchors\n  await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll')\n  await page.getByTestId(formTestIds.scrollIntoView).check()\n  await page.getByTestId(formTestIds.behaviorSelect).selectOption('instant')\n  await page.getByTestId(formTestIds.blockSelect).selectOption('start')\n  await page.getByTestId(formTestIds.inlineSelect).selectOption('nearest')\n  await page.getByTestId(formTestIds.navigateButton).click()\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  await expect(\n    getAnchorTarget(page, anchors.noScrollIntoView),\n  ).not.toContainText(shownSuffix)\n\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toBeVisible()\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass(\n    activeClass,\n  )\n})\n\ntest('Navigating via `useNavigate` with scrollIntoView disabled', async ({\n  page,\n}) => {\n  const initialScrollPosition = await page.evaluate(() => window.scrollY)\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  await expect(\n    getAnchorTarget(page, anchors.noScrollIntoView),\n  ).not.toContainText(shownSuffix)\n\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  // Navigate to the last anchor, but with scrollIntoView disabled should not activate Intersection Observers for any anchors\n  await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll')\n  await page.getByTestId(formTestIds.scrollIntoView).uncheck()\n  await page.getByTestId(formTestIds.navigateButton).click()\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText(\n    shownSuffix,\n  )\n\n  await expect(\n    getAnchorTarget(page, anchors.noScrollIntoView),\n  ).not.toContainText(shownSuffix)\n\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass(\n    activeClass,\n  )\n\n  // Expect the same scroll position as before\n  expect(await page.evaluate(() => window.scrollY)).toBe(initialScrollPosition)\n})\n\ntest('Navigating via `useNavigate` with smooth scroll behavior', async ({\n  page,\n}) => {\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText(\n    shownSuffix,\n  )\n\n  // Scroll to the last anchor smoothly, should activate Intersection Observers for the other anchors, making them all render \"(shown)\"\n  await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll')\n  await page.getByTestId(formTestIds.scrollIntoView).check()\n  await page.getByTestId(formTestIds.behaviorSelect).selectOption('smooth')\n  await page.getByTestId(formTestIds.blockSelect).selectOption('start')\n  await page.getByTestId(formTestIds.inlineSelect).selectOption('nearest')\n  await page.getByTestId(formTestIds.navigateButton).click()\n\n  await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorTarget(page, anchors.noScrollIntoView)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText(\n    shownSuffix,\n  )\n\n  await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass(\n    activeClass,\n  )\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/search-params.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('/search-params/default', () => {\n  test('Directly visiting the route without search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/default')\n    await page.waitForURL('/search-params/default?default=d1')\n\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/default/?default=d2')\n    await page.waitForURL('/search-params/default?default=d2')\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with special character search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/default/?default=🚀대한민국')\n    await page.waitForURL(\n      '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n    )\n\n    await expect(page.getByTestId('search-default')).toContainText('🚀대한민국')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n\n    expect(\n      page\n        .url()\n        .endsWith(\n          '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n        ),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with encoded character search param set', async ({\n    page,\n  }) => {\n    await page.goto(\n      '/search-params/default/?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n    )\n    await page.waitForURL(\n      '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n    )\n\n    await expect(page.getByTestId('search-default')).toContainText(\n      '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n    )\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n\n    expect(\n      page\n        .url()\n        .endsWith(\n          '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n        ),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route without search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-without-search').click()\n    await page.waitForURL('/search-params/default?default=d1')\n\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-with-search').click()\n    await page.waitForURL('/search-params/default?default=d2')\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with special character search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/')\n    await page\n      .getByTestId('link-to-default-with-search-special-characters')\n      .click()\n    await page.waitForURL(\n      '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n    )\n\n    await expect(page.getByTestId('search-default')).toContainText('🚀대한민국')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page\n        .url()\n        .endsWith(\n          '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n        ),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with encoded character search param set', async ({\n    page,\n  }) => {\n    await page.goto('/search-params/')\n    await page\n      .getByTestId('link-to-default-with-search-encoded-characters')\n      .click()\n    await page.waitForURL(\n      '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n    )\n\n    await expect(page.getByTestId('search-default')).toContainText(\n      '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD',\n    )\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page\n        .url()\n        .endsWith(\n          '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD',\n        ),\n    ).toBeTruthy()\n  })\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tests/transition.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('transitions/count/create-resource should keep old values visible during navigation', async ({\n  page,\n}) => {\n  await page.goto('/transition/count/create-resource')\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1')\n  await expect(page.getByTestId('double-value')).toContainText('double: 2')\n\n  const bodyTexts: Array<string> = []\n\n  const pollInterval = setInterval(async () => {\n    const text = await page\n      .locator('body')\n      .textContent()\n      .catch(() => '')\n    if (text) bodyTexts.push(text)\n  }, 50)\n\n  // 1 click\n\n  page.getByTestId('increase-button').click()\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1', {\n    timeout: 2_000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 2', {\n    timeout: 2_000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n    timeout: 2000,\n  })\n\n  // 2 clicks\n\n  page.getByTestId('increase-button').click()\n  page.getByTestId('increase-button').click()\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n    timeout: 2000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n    timeout: 2000,\n  })\n\n  // 3 clicks\n\n  page.getByTestId('increase-button').click()\n  page.getByTestId('increase-button').click()\n  page.getByTestId('increase-button').click()\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n    timeout: 2000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 7', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 14', {\n    timeout: 2000,\n  })\n\n  clearInterval(pollInterval)\n\n  // With proper transitions, old values should remain visible until new ones arrive\n  const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...'))\n\n  if (hasLoadingText) {\n    throw new Error(\n      'FAILED: \"Loading...\" appeared during navigation. ' +\n        'Solid Router should use transitions to keep old values visible.',\n    )\n  }\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basic-file-based-code-splitting\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e:verbose-routes:true\": \"rm -rf port*.txt; VERBOSE_FILE_ROUTES=1 playwright test --project=chromium\",\n    \"test:e2e:verbose-routes:false\": \"rm -rf port*.txt; VERBOSE_FILE_ROUTES=0 playwright test --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:verbose-routes:true && pnpm run test:e2e:verbose-routes:false\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/solid-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as WithoutLoaderRouteImport } from './routes/without-loader'\nimport { Route as ViewportTestRouteImport } from './routes/viewport-test'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst WithoutLoaderRoute = WithoutLoaderRouteImport.update({\n  id: '/without-loader',\n  path: '/without-loader',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ViewportTestRoute = ViewportTestRouteImport.update({\n  id: '/viewport-test',\n  path: '/viewport-test',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/viewport-test': typeof ViewportTestRoute\n  '/without-loader': typeof WithoutLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/viewport-test': typeof ViewportTestRoute\n  '/without-loader': typeof WithoutLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/viewport-test': typeof ViewportTestRoute\n  '/without-loader': typeof WithoutLoaderRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/viewport-test'\n    | '/without-loader'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/layout-a'\n    | '/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/viewport-test'\n    | '/without-loader'\n    | '/posts/$postId'\n    | '/posts'\n    | '/layout-a'\n    | '/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/viewport-test'\n    | '/without-loader'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n  ViewportTestRoute: typeof ViewportTestRoute\n  WithoutLoaderRoute: typeof WithoutLoaderRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/without-loader': {\n      id: '/without-loader'\n      path: '/without-loader'\n      fullPath: '/without-loader'\n      preLoaderRoute: typeof WithoutLoaderRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/viewport-test': {\n      id: '/viewport-test'\n      path: '/viewport-test'\n      fullPath: '/viewport-test'\n      preLoaderRoute: typeof ViewportTestRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ndeclare module './routes/index' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/_layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout',\n    FileRoutesByPath['/_layout']['parentRoute'],\n    FileRoutesByPath['/_layout']['id'],\n    FileRoutesByPath['/_layout']['path'],\n    FileRoutesByPath['/_layout']['fullPath']\n  >\n}\ndeclare module './routes/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/viewport-test' {\n  const createFileRoute: CreateFileRoute<\n    '/viewport-test',\n    FileRoutesByPath['/viewport-test']['parentRoute'],\n    FileRoutesByPath['/viewport-test']['id'],\n    FileRoutesByPath['/viewport-test']['path'],\n    FileRoutesByPath['/viewport-test']['fullPath']\n  >\n}\ndeclare module './routes/without-loader' {\n  const createFileRoute: CreateFileRoute<\n    '/without-loader',\n    FileRoutesByPath['/without-loader']['parentRoute'],\n    FileRoutesByPath['/without-loader']['id'],\n    FileRoutesByPath['/without-loader']['path'],\n    FileRoutesByPath['/without-loader']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2',\n    FileRoutesByPath['/_layout/_layout-2']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2']['id'],\n    FileRoutesByPath['/_layout/_layout-2']['path'],\n    FileRoutesByPath['/_layout/_layout-2']['fullPath']\n  >\n}\ndeclare module './routes/posts.$postId' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/posts.index' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2/layout-a' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2/layout-a',\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['id'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['path'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2/layout-b' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2/layout-b',\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['id'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['path'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['fullPath']\n  >\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n  ViewportTestRoute: ViewportTestRoute,\n  WithoutLoaderRoute: WithoutLoaderRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/without-loader\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          without-loader\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <div style={{ height: '200vh' }} />\n      <Link\n        preload=\"viewport\"\n        to=\"/viewport-test\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        viewport-test\n      </Link>\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx",
    "content": "import { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n  codeSplitGroupings: [\n    ['component'],\n    ['pendingComponent', 'errorComponent', 'notFoundComponent'],\n  ],\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx",
    "content": "export const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /viewport-test!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /without-loader!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/tests/preload.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('hovering a link with preload=intent to a route without a loader should preload route', async ({\n  page,\n}) => {\n  await page.waitForLoadState('networkidle')\n\n  const requestPromise = new Promise<string>((resolve) => {\n    page.on('request', (request) => {\n      resolve(request.url())\n    })\n  })\n\n  await page.getByRole('link', { name: 'without-loader' }).hover()\n  const url = await requestPromise\n  const expectedString =\n    process.env.NODE_ENV === 'development'\n      ? 'without-loader.tsx?tsr-split'\n      : '/assets/without-loader'\n  expect(url).toContain(expectedString)\n})\n\ntest('scrolling into viewport a link with preload=viewport to a route should preload route', async ({\n  page,\n}) => {\n  await page.waitForLoadState('networkidle')\n\n  const [request] = await Promise.all([\n    page.waitForRequest(() => true),\n    page.getByRole('link', { name: 'viewport-test' }).scrollIntoViewIfNeeded(),\n  ])\n\n  const expectedString =\n    process.env.NODE_ENV === 'development'\n      ? 'viewport-test.tsx?tsr-split'\n      : '/assets/viewport-test'\n  expect(request.url()).toEqual(expect.stringContaining(expectedString))\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-file-based-code-splitting/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst isVerboseFileRoutes = process.env.VERBOSE_FILE_ROUTES === '1' || false\nconsole.info(`Verbose file routes is set to: ${isVerboseFileRoutes}.`)\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n      verboseFileRoutes: isVerboseFileRoutes,\n      codeSplittingOptions: {\n        splitBehavior: ({ routeId }) => {\n          if (routeId === '/posts') {\n            return [\n              ['loader'],\n              ['component'],\n              ['pendingComponent', 'notFoundComponent', 'errorComponent'],\n            ]\n          }\n        },\n      },\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basic-scroll-restoration\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-virtual\": \"^3.13.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useElementScrollRestoration,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { createVirtualizer } from '@tanstack/solid-virtual'\nimport './styles.css'\nimport { createRenderEffect } from 'solid-js'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 sticky top-0 border-b bg-gray-100 dark:bg-gray-900\">\n        <Link to=\"/\" class=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" class=\"[&.active]:font-bold\">\n          About\n        </Link>\n        <Link to=\"/about\" resetScroll={false}>\n          About (No Reset)\n        </Link>\n        <Link to=\"/by-element\" class=\"[&.active]:font-bold\">\n          By-Element\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  createRenderEffect(() => {\n    window.invokeOrders.push('index-useLayoutEffect')\n  }, [])\n\n  return (\n    <div class=\"p-2\">\n      <h3 id=\"greeting\" class=\"bg-red-600\">\n        Welcome Home!\n      </h3>\n      <div id=\"top-message\" />\n      <div class=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n            Home Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  createRenderEffect(() => {\n    window.invokeOrders.push('about-useLayoutEffect')\n  }, [])\n  return (\n    <div class=\"p-2\">\n      <h3 id=\"greeting\">Hello from About!</h3>\n      <div class=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n            About Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst byElementRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/by-element',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: ByElementComponent,\n})\n\nfunction ByElementComponent() {\n  // We need a unique ID for manual scroll restoration on a specific element\n  // It should be as unique as possible for this element across your app\n  const scrollRestorationId = 'myVirtualizedContent'\n\n  // We use that ID to get the scroll entry for this element\n  const scrollEntry = useElementScrollRestoration({\n    id: scrollRestorationId,\n  })\n\n  // Let's use TanStack Virtual to virtualize some content!\n  let virtualizerParentRef: HTMLDivElement | undefined\n  const virtualizer = createVirtualizer({\n    count: 10000,\n    getScrollElement: () => virtualizerParentRef ?? null,\n    estimateSize: () => 100,\n    // We pass the scrollY from the scroll restoration entry to the virtualizer\n    // as the initial offset\n    initialOffset: scrollEntry?.scrollY,\n  })\n\n  return (\n    <div class=\"p-2 h-[calc(100vh-41px)] flex flex-col\">\n      <div>Hello from By-Element!</div>\n      <div class=\"h-full min-h-0 flex gap-4\">\n        <div\n          id=\"RegularList\"\n          class=\"border rounded-lg p-2 overflow-auto flex-1 space-y-2\"\n        >\n          <div class=\"h-[100px] p-2 rounded-lg bg-red-600 border\">\n            First Regular List Item\n            <div id=\"first-regular-list-item\" />\n          </div>\n          {Array.from({ length: 50 }).map((_, i) => (\n            <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n              Regular List Item {i + 1}\n            </div>\n          ))}\n        </div>\n        <div class=\"flex-1 overflow-auto flex flex-col gap-4\">\n          {Array.from({ length: 2 }).map((_, i) => (\n            <div class=\"flex-1 border rounded-lg p-2 overflow-auto\">\n              <div class=\"space-y-2\">\n                {Array.from({ length: 50 }).map((_, i) => (\n                  <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n                    About Item {i + 1}\n                  </div>\n                ))}\n              </div>\n            </div>\n          ))}\n          <div class=\"flex-1 flex flex-col min-h-0\">\n            <div class=\"font-bold\">Virtualized</div>\n            <div\n              ref={virtualizerParentRef}\n              // We pass the scroll restoration ID to the element\n              // as a custom attribute that will get picked up by the\n              // scroll restoration watcher\n              data-scroll-restoration-id={scrollRestorationId}\n              class=\"flex-1 border rounded-lg overflow-auto relative\"\n            >\n              <div\n                style={{\n                  height: `${virtualizer.getTotalSize()}px`,\n                }}\n              >\n                {virtualizer.getVirtualItems().map((item) => (\n                  <div\n                    class=\"absolute p-2 pb-0 w-full\"\n                    style={{\n                      height: item.size as any,\n                      top: item.start as any,\n                    }}\n                  >\n                    <div class=\"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border h-full\">\n                      Virtualized Item {item.index + 1}\n                    </div>\n                  </div>\n                ))}\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  )\n}\n\nconst fooRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/foo',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: FooComponent,\n})\n\nfunction FooComponent() {\n  return (\n    <div data-testid=\"foo-route-component\" class=\"p-2\">\n      <h3 id=\"greeting\">Hello from Foo!</h3>\n      <Link to=\"/bar\" data-testid=\"go-to-bar-link\">\n        Go to Bar\n      </Link>\n      <div class=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n            Foo Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst barRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/bar',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: BarComponent,\n})\n\nfunction BarComponent() {\n  return (\n    <div data-testid=\"bar-route-component\" class=\"p-2\">\n      <h3 id=\"greeting\">Hello from Bar!</h3>\n      <div class=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n            Bar Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  aboutRoute,\n  byElementRoute,\n  fooRoute,\n  barRoute,\n])\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  getScrollRestorationKey: (location) => location.pathname,\n})\n\ndeclare global {\n  interface Window {\n    invokeOrders: Array<string>\n  }\n}\nwindow.invokeOrders = []\nrouter.subscribe('onBeforeRouteMount', (event) => {\n  window.invokeOrders.push(event.type)\n})\n\nrouter.subscribe('onResolved', (event) => {\n  window.invokeOrders.push(event.type)\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('restore scroll positions by page, home pages top message should not display on navigating back', async ({\n  page,\n}) => {\n  // Step 1: Navigate to the home page\n  await page.goto('/')\n\n  await expect(page.locator('#greeting')).toContainText('Welcome Home!')\n  await expect(page.locator('#top-message')).toBeInViewport()\n\n  // Step 2: Scroll to a position that hides the top\n  const targetScrollPosition = 1000\n  await page.evaluate(\n    (scrollPos: number) => window.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n\n  // Verify initial scroll position\n  const scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  await expect(page.locator('#top-message')).not.toBeInViewport()\n  await page.waitForTimeout(1000)\n\n  // Step 3: Navigate to the about page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  // Step 4: Go back to the home page and immediately check the message\n  await page.goBack()\n\n  // Wait for the home page to have rendered\n  await page.waitForSelector('#greeting')\n  await page.waitForTimeout(1000)\n  await expect(page.locator('#top-message')).not.toBeInViewport()\n\n  // Confirm the scroll position was restored correctly\n  const restoredScrollPosition = await page.evaluate(() => window.scrollY)\n  expect(restoredScrollPosition).toBe(targetScrollPosition)\n})\n\ntest('restore scroll positions by element, first regular list item should not display on navigating back', async ({\n  page,\n}) => {\n  // Step 1: Navigate to the by-element page\n  await page.goto('/by-element')\n\n  // Step 2: Scroll to a position that hides the first list item in regular list\n  const targetScrollPosition = 1000\n  await page.waitForSelector('#RegularList')\n  await expect(page.locator('#first-regular-list-item')).toBeInViewport()\n\n  await page.evaluate(\n    (scrollPos: number) =>\n      document.querySelector('#RegularList')!.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n\n  // Verify initial scroll position\n  const scrollPosition = await page.evaluate(\n    () => document.querySelector('#RegularList')!.scrollTop,\n  )\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  await expect(page.locator('#first-regular-list-item')).not.toBeInViewport()\n\n  // Step 3: Navigate to the about page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  // Step 4: Go back to the by-element page and immediately check the message\n  await page.goBack()\n\n  // TODO: For some reason, this only works in headed mode.\n  // When someone can explain that to me, I'll fix this test.\n\n  // Confirm the scroll position was restored correctly\n  // const restoredScrollPosition = await page.evaluate(\n  //   () => document.querySelector('#RegularList')!.scrollTop,\n  // )\n  // expect(restoredScrollPosition).toBe(targetScrollPosition)\n})\n\ntest('scroll to top when not scrolled, regression test for #4782', async ({\n  page,\n}) => {\n  await page.goto('/foo')\n\n  await expect(page.getByTestId('foo-route-component')).toBeVisible()\n\n  let scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(0)\n\n  // do not scroll, just navigate to /bar\n  await page.getByTestId('go-to-bar-link').click()\n  await expect(page.getByTestId('bar-route-component')).toBeVisible()\n\n  const targetScrollPosition = 1000\n  await page.evaluate(\n    (scrollPos: number) => window.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n  scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  // navigate back to /foo\n  await page.goBack()\n  await expect(page.getByTestId('foo-route-component')).toBeVisible()\n\n  // check if scroll position is restored to 0 since we did not scroll on /foo\n  const restoredScrollPosition = await page.evaluate(() => window.scrollY)\n  expect(restoredScrollPosition).toBe(0)\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/tests/router-events.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('after a navigation, should have emitted \"onBeforeRouteMount\",\"onResolved\" and useRenderEffect setup in the correct order', async ({\n  page,\n}) => {\n  // Navigate to the Home page\n  await page.goto('/')\n  await expect(page.locator('#greeting')).toContainText('Welcome Home!')\n\n  let orders = await page.evaluate(() => window.invokeOrders)\n\n  expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved')\n  expectItemOrder(orders, 'onBeforeRouteMount', 'index-useLayoutEffect')\n\n  // Clear the invokeOrders array\n  orders = await page.evaluate(() => {\n    window.invokeOrders = []\n    return window.invokeOrders\n  })\n\n  // Navigate to the About page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  orders = await page.evaluate(() => window.invokeOrders)\n\n  expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved')\n  expectItemOrder(orders, 'onBeforeRouteMount', 'about-useLayoutEffect')\n})\n\nfunction expectItemOrder<TItem>(\n  array: Array<TItem>,\n  firstItem: TItem,\n  secondItem: TItem,\n) {\n  const firstIndex = array.findIndex((item) => item === firstItem)\n  const secondIndex = array.findIndex((item) => item === secondItem)\n\n  if (firstIndex === -1 || secondIndex === -1) {\n    throw new Error('One or both items were not found in the array ' + array)\n  }\n\n  expect(firstIndex).toBeLessThan(secondIndex)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-scroll-restoration/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-solid-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  HeadContent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  useRouter,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { SolidQueryDevtools } from '@tanstack/solid-query-devtools'\nimport {\n  QueryClient,\n  QueryClientProvider,\n  useQuery,\n} from '@tanstack/solid-query'\nimport { createEffect, createMemo } from 'solid-js'\nimport { NotFoundError, postQueryOptions, postsQueryOptions } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport './styles.css'\n\nconst rootRoute = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <SolidQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexRouteComponent,\n})\n\nfunction IndexRouteComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n  component: PostsIndexRouteComponent,\n})\n\nfunction PostsIndexRouteComponent() {\n  return <div>Select a post.</div>\n}\n\nfunction PostErrorComponent({ error, reset }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n  createEffect(() => {\n    reset()\n    queryClient.resetQueries()\n  })\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ context: { queryClient }, params: { postId } }) =>\n    queryClient.ensureQueryData(postQueryOptions(postId)),\n  component: PostRouteComponent,\n})\n\nfunction PostRouteComponent() {\n  const params = postRoute.useParams()\n  const postQuery = useQuery(() => postQueryOptions(params().postId))\n  const post = createMemo(() => postQuery.data)\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post()?.title}</h4>\n      <div class=\"text-sm\">{post()?.body}</div>\n    </div>\n  )\n}\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layout2Route = createRoute({\n  getParentRoute: () => layoutRoute,\n  id: '_layout-2',\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layoutARoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-a',\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n\nconst layoutBRoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-b',\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute, postsIndexRoute]),\n  layoutRoute.addChildren([\n    layout2Route.addChildren([layoutARoute, layoutBRoute]),\n  ]),\n  indexRoute,\n])\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  context: {\n    queryClient,\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(\n    () => (\n      <QueryClientProvider client={queryClient}>\n        <RouterProvider router={router} />\n      </QueryClientProvider>\n    ),\n    rootElement,\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/src/posts.lazy.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { Suspense, createMemo } from 'solid-js'\nimport { postsQueryOptions } from './posts'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useQuery(() => postsQueryOptions)\n\n  const posts = createMemo(() => {\n    if (postsQuery.data) {\n      return postsQuery.data\n    } else {\n      return []\n    }\n  })\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        <Suspense>\n          {[\n            ...posts(),\n            { id: 'i-do-not-exist', title: 'Non-existent Post' },\n          ].map((post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          })}\n        </Suspense>\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/src/posts.ts",
    "content": "import axios from 'redaxios'\nimport { queryOptions } from '@tanstack/solid-query'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basic-solid-query-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/solid-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nexport const queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(\n    () => (\n      <QueryClientProvider client={queryClient}>\n        <RouterProvider router={router} />\n      </QueryClientProvider>\n    ),\n    rootElement,\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/postQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport { fetchPost } from './posts'\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/postsQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport { fetchPosts } from './posts'\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/layout-a'\n    | '/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { SolidQueryDevtools } from '@tanstack/solid-query-devtools'\nimport type { QueryClient } from '@tanstack/solid-query'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <SolidQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { ErrorComponent, useRouter } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { createEffect, createMemo } from 'solid-js'\nimport { PostNotFoundError } from '../posts'\nimport { postQueryOptions } from '../postQueryOptions'\nimport { queryClient } from '../main'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error, reset }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof PostNotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  createEffect(() => {\n    reset()\n    queryClient.resetQueries()\n  })\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ context: { queryClient }, params: { postId } }) => {\n    return queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const params = Route.useParams()\n  const post = createMemo(() =>\n    useQuery(() => postQueryOptions(params().postId)),\n  )\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().data?.title}</h4>\n      <div class=\"text-sm\">{post().data?.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { createMemo } from 'solid-js'\nimport { postsQueryOptions } from '../postsQueryOptions'\n\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useQuery(() => postsQueryOptions)\n  const posts = createMemo(() => {\n    if (postsQuery.data) {\n      return postsQuery.data\n    } else {\n      return []\n    }\n  })\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-solid-query-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basic-virtual-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/solid-router'\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as postsPostsRouteImport } from './routes/posts/posts'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home'\nimport { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route'\nimport { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index'\nimport { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world'\nimport { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst postsPostsRoute = postsPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsDetailRoute = postsPostsDetailRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst postsPostsHomeRoute = postsPostsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({\n  id: '/classic/hello',\n  path: '/classic/hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({\n  id: '/world',\n  path: '/world',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({\n  id: '/universe',\n  path: '/universe',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/layout-a': typeof aRoute\n  '/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/layout-a': typeof aRoute\n  '/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello': typeof ClassicHelloIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/_first/_second': typeof layoutSecondLayoutRouteWithChildren\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/_first/_second/layout-a': typeof aRoute\n  '/_first/_second/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/_first/_second'\n    | '/posts/$postId'\n    | '/_first/_second/layout-a'\n    | '/_first/_second/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n  postsPostsRoute: typeof postsPostsRouteWithChildren\n  ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsPostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsPostsDetailRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/_first/_second': {\n      id: '/_first/_second'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsPostsHomeRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/classic/hello': {\n      id: '/classic/hello'\n      path: '/classic/hello'\n      fullPath: '/classic/hello'\n      preLoaderRoute: typeof ClassicHelloRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/classic/hello/': {\n      id: '/classic/hello/'\n      path: '/'\n      fullPath: '/classic/hello/'\n      preLoaderRoute: typeof ClassicHelloIndexRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/world': {\n      id: '/classic/hello/world'\n      path: '/world'\n      fullPath: '/classic/hello/world'\n      preLoaderRoute: typeof ClassicHelloWorldRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/universe': {\n      id: '/classic/hello/universe'\n      path: '/universe'\n      fullPath: '/classic/hello/universe'\n      preLoaderRoute: typeof ClassicHelloUniverseRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/_first/_second/layout-b': {\n      id: '/_first/_second/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second/layout-a': {\n      id: '/_first/_second/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ndeclare module './routes/home' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/layout/first-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first',\n    FileRoutesByPath['/_first']['parentRoute'],\n    FileRoutesByPath['/_first']['id'],\n    FileRoutesByPath['/_first']['path'],\n    FileRoutesByPath['/_first']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/route' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello',\n    FileRoutesByPath['/classic/hello']['parentRoute'],\n    FileRoutesByPath['/classic/hello']['id'],\n    FileRoutesByPath['/classic/hello']['path'],\n    FileRoutesByPath['/classic/hello']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/layout/second-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second',\n    FileRoutesByPath['/_first/_second']['parentRoute'],\n    FileRoutesByPath['/_first/_second']['id'],\n    FileRoutesByPath['/_first/_second']['path'],\n    FileRoutesByPath['/_first/_second']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-detail' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/a' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second/layout-a',\n    FileRoutesByPath['/_first/_second/layout-a']['parentRoute'],\n    FileRoutesByPath['/_first/_second/layout-a']['id'],\n    FileRoutesByPath['/_first/_second/layout-a']['path'],\n    FileRoutesByPath['/_first/_second/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/b' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second/layout-b',\n    FileRoutesByPath['/_first/_second/layout-b']['parentRoute'],\n    FileRoutesByPath['/_first/_second/layout-b']['id'],\n    FileRoutesByPath['/_first/_second/layout-b']['path'],\n    FileRoutesByPath['/_first/_second/layout-b']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/universe' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/universe',\n    FileRoutesByPath['/classic/hello/universe']['parentRoute'],\n    FileRoutesByPath['/classic/hello/universe']['id'],\n    FileRoutesByPath['/classic/hello/universe']['path'],\n    FileRoutesByPath['/classic/hello/universe']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/world' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/world',\n    FileRoutesByPath['/classic/hello/world']['parentRoute'],\n    FileRoutesByPath['/classic/hello/world']['id'],\n    FileRoutesByPath['/classic/hello/world']['path'],\n    FileRoutesByPath['/classic/hello/world']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/index' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/',\n    FileRoutesByPath['/classic/hello/']['parentRoute'],\n    FileRoutesByPath['/classic/hello/']['id'],\n    FileRoutesByPath['/classic/hello/']['path'],\n    FileRoutesByPath['/classic/hello/']['fullPath']\n  >\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\ninterface postsPostsRouteChildren {\n  postsPostsHomeRoute: typeof postsPostsHomeRoute\n  postsPostsDetailRoute: typeof postsPostsDetailRoute\n}\n\nconst postsPostsRouteChildren: postsPostsRouteChildren = {\n  postsPostsHomeRoute: postsPostsHomeRoute,\n  postsPostsDetailRoute: postsPostsDetailRoute,\n}\n\nconst postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(\n  postsPostsRouteChildren,\n)\n\ninterface ClassicHelloRouteRouteChildren {\n  ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute\n  ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute\n  ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute\n}\n\nconst ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {\n  ClassicHelloUniverseRoute: ClassicHelloUniverseRoute,\n  ClassicHelloWorldRoute: ClassicHelloWorldRoute,\n  ClassicHelloIndexRoute: ClassicHelloIndexRoute,\n}\n\nconst ClassicHelloRouteRouteWithChildren =\n  ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n  postsPostsRoute: postsPostsRouteWithChildren,\n  ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/home.tsx",
    "content": "export const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx",
    "content": "export const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/routes/root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { routes } from './routes'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n      virtualRouteConfig: routes,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\nsrc/routeTree.gen.ts"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-basic-virtual-named-export-config-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx",
    "content": "export const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx",
    "content": "export const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/basic-virtual-named-export-config-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n      virtualRouteConfig: './routes.ts',\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-generator-cli-only\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"tsr generate && vite --port 3000\",\n    \"dev:e2e\": \"tsr generate && vite\",\n    \"build\": \"tsr generate && vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"tsr generate && vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-cli\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/main.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { render } from 'solid-js/web'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/_pathlessLayout'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/routes/posts.route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested pathless layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a pathless layout\")\n  await expect(page.locator('#app')).toContainText(\n    \"I'm a nested pathless layout\",\n  )\n\n  await page.getByRole('link', { name: 'Go to route A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Go to route B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"target\": \"solid\"\n}\n"
  },
  {
    "path": "e2e/solid-router/generator-cli-only/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.jsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-js-only-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/main.jsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { render } from 'solid-js/web'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\nconst rootElement = document.getElementById('app')\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/posts.js",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios.get(`${queryURL}/posts`).then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routeTree.gen.js",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n})\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n})\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n})\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n})\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n})\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  })\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  })\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  })\n\nconst PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst PathlessLayoutNestedLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,\n  PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,\n}\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\nconst PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/__root.jsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout.jsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/index.jsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/posts.$postId.jsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nimport { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/posts.index.jsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/routes/posts.route.jsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nimport { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested pathless layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a pathless layout\")\n  await expect(page.locator('#app')).toContainText(\n    \"I'm a nested pathless layout\",\n  )\n\n  await page.getByRole('link', { name: 'Go to route A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Go to route B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/js-only-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      disableTypes: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\ndist-hash/\n\n# IDE\n.vscode/*\n!.vscode/extensions.json\n.idea\n\n# E2E\nsrc/routeTree.gen.ts\ntest-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `pnpm install`\n- `pnpm dev`\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-rspack-basic-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"rsbuild dev --port 3000\",\n    \"build\": \"rsbuild build && tsc --noEmit\",\n    \"preview\": \"rsbuild preview\",\n    \"start\": \"rsbuild preview\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@rsbuild/core\": \"^1.2.4\",\n    \"@rsbuild/plugin-babel\": \"^1.0.3\",\n    \"@rsbuild/plugin-solid\": \"^1.0.6\",\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"postcss\": \"^8.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `PUBLIC_NODE_ENV=\"test\" PUBLIC_EXTERNAL_PORT=${EXTERNAL_PORT} PUBLIC_SERVER_PORT=${PORT} pnpm build && PUBLIC_NODE_ENV=\"test\" PUBLIC_EXTERNAL_PORT=${EXTERNAL_PORT} PUBLIC_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/rsbuild.config.ts",
    "content": "import { defineConfig } from '@rsbuild/core'\nimport { pluginSolid } from '@rsbuild/plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\nimport { pluginBabel } from '@rsbuild/plugin-babel'\n\nexport default defineConfig({\n  plugins: [\n    pluginBabel({\n      include: /\\.(?:jsx|tsx)$/,\n    }),\n    pluginSolid(),\n  ],\n  tools: {\n    rspack: {\n      plugins: [tanstackRouter({ target: 'solid', autoCodeSplitting: true })],\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/app.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/env.d.ts",
    "content": "/// <reference types=\"@rsbuild/core/types\" />\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/index.tsx",
    "content": "import { render } from 'solid-js/web'\nimport App from './app'\n\nconst rootEl = document.getElementById('root')\n\nif (rootEl) {\n  render(() => <App />, rootEl)\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.PUBLIC_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.PUBLIC_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#root')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#root')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"useDefineForClassFields\": true,\n    \"allowJs\": true\n  },\n  \"include\": [\"src\", \"playwright.config.ts\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\ndist-hash/\n\n# IDE\n.vscode/*\n!.vscode/extensions.json\n.idea\n\n# E2E\nsrc/routeTree.gen.ts\ntest-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `pnpm install`\n- `pnpm dev`\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-rspack-basic-virtual-named-export-config-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"rsbuild dev --port 3000\",\n    \"build\": \"rsbuild build && tsc --noEmit\",\n    \"preview\": \"rsbuild preview\",\n    \"start\": \"rsbuild preview\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@rsbuild/core\": \"^1.2.4\",\n    \"@rsbuild/plugin-babel\": \"^1.0.3\",\n    \"@rsbuild/plugin-solid\": \"^1.0.6\",\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"postcss\": \"^8.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `PUBLIC_NODE_ENV=\"test\" PUBLIC_EXTERNAL_PORT=${EXTERNAL_PORT} PUBLIC_SERVER_PORT=${PORT} pnpm build && PUBLIC_SERVER_PORT=${PORT} pnpm start --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts",
    "content": "import { defineConfig } from '@rsbuild/core'\nimport { pluginSolid } from '@rsbuild/plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\nimport { pluginBabel } from '@rsbuild/plugin-babel'\n\nexport default defineConfig({\n  plugins: [\n    pluginBabel({\n      include: /\\.(?:jsx|tsx)$/,\n    }),\n    pluginSolid(),\n  ],\n  tools: {\n    rspack: {\n      plugins: [\n        tanstackRouter({\n          target: 'solid',\n          autoCodeSplitting: true,\n          virtualRouteConfig: './routes.ts',\n        }),\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts",
    "content": "/// <reference types=\"@rsbuild/core/types\" />\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx",
    "content": "import { render } from 'solid-js/web'\nimport App from './app'\n\nconst rootEl = document.getElementById('root')\n\nif (rootEl) {\n  render(() => <App />, rootEl)\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.PUBLIC_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.PUBLIC_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_first/_second/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_first/_second/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/classic/hello/')({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/classic/hello')({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/classic/hello/universe')({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/classic/hello/world')({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_first')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_first/_second')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#root')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#root')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"useDefineForClassFields\": true,\n    \"allowJs\": true\n  },\n  \"include\": [\"src\", \"playwright.config.ts\", \"tests\", \"./routes.ts\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\ndist-hash\n*.local\ntest-results\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/README.md",
    "content": "# Scroll Restoration Testing Sandbox with Vite\n\nTo run this example:\n\n- `npm install`\n- `npm start`\n\nThis sandbox is for testing the scroll restoration behavior.\n\n## Setup\n\n- Create your files in `src/routes` directory.\n- Make sure you update the arrays in the following files with the expected routes\n  - `tests/app.spec.ts` > routes array\n  - `src/routes/__root.tsx` > Nav component, routes array\n  - `src/routes/index.tsx` > Navigation test suite, routes array\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-solid-scroll-restoration-sandbox-vite\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:hash\": \"VITE_APP_HISTORY=hash vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e:browser\": \"VITE_APP_HISTORY=browser playwright test --config=playwright.browser.config.ts --project=chromium\",\n    \"test:e2e:hash\": \"VITE_APP_HISTORY=hash playwright test --config=playwright.hash.config.ts --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:browser && pnpm run test:e2e:hash\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  resolveRuntimeSuffix,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  packageJson.name + `-${resolveRuntimeSuffix('browser')}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=browser pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=browser pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  resolveRuntimeSuffix,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  packageJson.name + `-${resolveRuntimeSuffix('hash')}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=hash vite build --outDir dist-hash && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=hash pnpm preview --port ${PORT} --outDir dist-hash`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  RouterProvider,\n  createHashHistory,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport type { RouterHistory } from '@tanstack/solid-router'\nimport './styles.css'\n\nlet history: RouterHistory | undefined\n\nif (import.meta.env.VITE_APP_HISTORY === 'hash') {\n  history = createHashHistory()\n}\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  history,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport function sleep(ms: number) {\n  return new Promise((r) => setTimeout(r, ms))\n}\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/solid-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as testsPageWithSearchRouteImport } from './routes/(tests)/page-with-search'\nimport { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'\nimport { Route as testsLazyWithLoaderPageRouteImport } from './routes/(tests)/lazy-with-loader-page'\nimport { Route as testsLazyPageRouteImport } from './routes/(tests)/lazy-page'\n\nconst testsVirtualPageLazyRouteImport = createFileRoute(\n  '/(tests)/virtual-page',\n)()\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport\n  .update({\n    id: '/(tests)/virtual-page',\n    path: '/virtual-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(tests)/virtual-page.lazy').then((d) => d.Route))\nconst testsPageWithSearchRoute = testsPageWithSearchRouteImport.update({\n  id: '/(tests)/page-with-search',\n  path: '/page-with-search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsNormalPageRoute = testsNormalPageRouteImport.update({\n  id: '/(tests)/normal-page',\n  path: '/normal-page',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport\n  .update({\n    id: '/(tests)/lazy-with-loader-page',\n    path: '/lazy-with-loader-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() =>\n    import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route),\n  )\nconst testsLazyPageRoute = testsLazyPageRouteImport\n  .update({\n    id: '/(tests)/lazy-page',\n    path: '/lazy-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(tests)/lazy-page.lazy').then((d) => d.Route))\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/lazy-page': typeof testsLazyPageRoute\n  '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/page-with-search': typeof testsPageWithSearchRoute\n  '/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/lazy-page': typeof testsLazyPageRoute\n  '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/page-with-search': typeof testsPageWithSearchRoute\n  '/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/(tests)/lazy-page': typeof testsLazyPageRoute\n  '/(tests)/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/(tests)/normal-page': typeof testsNormalPageRoute\n  '/(tests)/page-with-search': typeof testsPageWithSearchRoute\n  '/(tests)/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/lazy-page'\n    | '/lazy-with-loader-page'\n    | '/normal-page'\n    | '/page-with-search'\n    | '/virtual-page'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/lazy-page'\n    | '/lazy-with-loader-page'\n    | '/normal-page'\n    | '/page-with-search'\n    | '/virtual-page'\n  id:\n    | '__root__'\n    | '/'\n    | '/(tests)/lazy-page'\n    | '/(tests)/lazy-with-loader-page'\n    | '/(tests)/normal-page'\n    | '/(tests)/page-with-search'\n    | '/(tests)/virtual-page'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  testsLazyPageRoute: typeof testsLazyPageRoute\n  testsLazyWithLoaderPageRoute: typeof testsLazyWithLoaderPageRoute\n  testsNormalPageRoute: typeof testsNormalPageRoute\n  testsPageWithSearchRoute: typeof testsPageWithSearchRoute\n  testsVirtualPageLazyRoute: typeof testsVirtualPageLazyRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/virtual-page': {\n      id: '/(tests)/virtual-page'\n      path: '/virtual-page'\n      fullPath: '/virtual-page'\n      preLoaderRoute: typeof testsVirtualPageLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/page-with-search': {\n      id: '/(tests)/page-with-search'\n      path: '/page-with-search'\n      fullPath: '/page-with-search'\n      preLoaderRoute: typeof testsPageWithSearchRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/normal-page': {\n      id: '/(tests)/normal-page'\n      path: '/normal-page'\n      fullPath: '/normal-page'\n      preLoaderRoute: typeof testsNormalPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/lazy-with-loader-page': {\n      id: '/(tests)/lazy-with-loader-page'\n      path: '/lazy-with-loader-page'\n      fullPath: '/lazy-with-loader-page'\n      preLoaderRoute: typeof testsLazyWithLoaderPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/lazy-page': {\n      id: '/(tests)/lazy-page'\n      path: '/lazy-page'\n      fullPath: '/lazy-page'\n      preLoaderRoute: typeof testsLazyPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  testsLazyPageRoute: testsLazyPageRoute,\n  testsLazyWithLoaderPageRoute: testsLazyWithLoaderPageRoute,\n  testsNormalPageRoute: testsNormalPageRoute,\n  testsPageWithSearchRoute: testsPageWithSearchRoute,\n  testsVirtualPageLazyRoute: testsVirtualPageLazyRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/solid-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/lazy-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>lazy-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/(tests)/lazy-page')({})\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/solid-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/lazy-with-loader-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>lazy-with-loader-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { sleep } from '../../posts'\n\nexport const Route = createFileRoute('/(tests)/lazy-with-loader-page')({\n  loader: async () => {\n    await sleep(1000)\n    return { foo: 'bar' }\n  },\n})\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/normal-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>normal-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/page-with-search')({\n  validateSearch: zodValidator(z.object({ where: z.string() })),\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>page-with-search</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/solid-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/virtual-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>virtual-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx",
    "content": "export const atTheTopId = 'at-the-top'\nexport const atTheBottomId = 'at-the-bottom'\n\nexport function ScrollBlock({ number = 100 }: { number?: number }) {\n  return (\n    <>\n      <div id={atTheTopId} data-testid={atTheTopId}></div>\n      {Array.from({ length: number }).map((_, i) => (\n        <div>{i}</div>\n      ))}\n      <div id={atTheBottomId} data-testid={atTheBottomId}>\n        At the bottom\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n  linkOptions,\n} from '@tanstack/solid-router'\nimport { Dynamic } from 'solid-js/web'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <Nav type=\"header\" />\n      <hr />\n      <Outlet />\n      <hr />\n      <Nav type=\"footer\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nfunction Nav({ type }: { type: 'header' | 'footer' }) {\n  const Elem = type === 'header' ? 'header' : 'footer'\n  const prefix = type === 'header' ? 'Head' : 'Foot'\n  return (\n    <Dynamic component={Elem} class=\"p-2 flex gap-2 text-lg\">\n      <Link\n        to=\"/\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        activeOptions={{ exact: true }}\n      >\n        {prefix}-/\n      </Link>{' '}\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/lazy-page' }),\n          linkOptions({ to: '/virtual-page' }),\n          linkOptions({ to: '/lazy-with-loader-page' }),\n          linkOptions({ to: '/page-with-search', search: { where: type } }),\n        ] as const\n      ).map((options, i) => (\n        <Link\n          {...options}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          {prefix}-{options.to}\n        </Link>\n      ))}\n    </Dynamic>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, linkOptions } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2 grid gap-2\">\n      <h3>Welcome Home!</h3>\n      <p>\n        The are the links to be tested when navigating away from the index page.\n        Otherwise known as NOT first-load tests, rather known as navigation\n        tests.\n      </p>\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/lazy-page' }),\n          linkOptions({ to: '/virtual-page' }),\n          linkOptions({ to: '/lazy-with-loader-page' }),\n          linkOptions({ to: '/page-with-search', search: { where: 'footer' } }),\n        ] as const\n      ).map((options, i) => (\n        <div class=\"border p-2\">\n          <h4>{options.to} tests</h4>\n          <p>\n            <Link {...options} hash=\"at-the-bottom\">\n              {options.to}#at-the-bottom\n            </Link>\n          </p>\n        </div>\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { toRuntimePath } from '@tanstack/router-e2e-utils'\n\ntest('Smoke - Renders home', async ({ page }) => {\n  await page.goto(toRuntimePath('/'))\n  await expect(\n    page.getByRole('heading', { name: 'Welcome Home!' }),\n  ).toBeVisible()\n})\n\n// Test for scroll related stuff\n;[\n  { to: '/normal-page' },\n  { to: '/lazy-page' },\n  { to: '/virtual-page' },\n  { to: '/lazy-with-loader-page' },\n  { to: '/page-with-search', search: { where: 'footer' } },\n].forEach((options) => {\n  test(`On navigate to ${options.to} (from the header), scroll should be at top`, async ({\n    page,\n  }) => {\n    await page.goto(toRuntimePath('/'))\n    await page.getByRole('link', { name: `Head-${options.to}` }).click()\n    await page.waitForTimeout(0)\n    await expect(page.getByTestId('at-the-top')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on navigation after the page is loaded\n  test(`On navigate via index page tests to ${options.to}, scroll should resolve at the bottom`, async ({\n    page,\n  }) => {\n    await page.goto(toRuntimePath('/'))\n    await page\n      .getByRole('link', { name: `${options.to}#at-the-bottom` })\n      .click()\n    await page.waitForTimeout(0)\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on first load\n  test(`On first load of ${options.to}, scroll should resolve resolve at the bottom`, async ({\n    page,\n  }) => {\n    let url: string = options.to\n    if ('search' in options) {\n      url = `${url}?where=${options.search?.where}`\n    }\n    await page.goto(toRuntimePath(`${url}#at-the-bottom`))\n    await page.waitForTimeout(0)\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n})\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\", \"node\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/scroll-restoration-sandbox-vite/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), tanstackRouter({ target: 'solid' }), solid()],\n})\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/solid-router/sentry-integration/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-router-e2e-sentry-integration\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@sentry/solid\": \"^10.32.0\",\n    \"@sentry/tracing\": \"^7.120.4\",\n    \"@sentry/vite-plugin\": \"^4.6.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\n\nimport { tanstackRouterBrowserTracingIntegration } from '@sentry/solid/tanstackrouter'\nimport * as Sentry from '@sentry/solid'\n\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([indexRoute])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nSentry.init({\n  dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',\n  integrations: [tanstackRouterBrowserTracingIntegration(router)],\n  transport: () => ({\n    send: (): Promise<any> => Promise.resolve(),\n    flush: () => Promise.resolve(true),\n  }),\n  tracesSampleRate: 0.2,\n  sendClientReports: false,\n})\n\nconst rootElement = document.getElementById('app')\nif (rootElement) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('should load', async ({ page }) => {\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/sentry-integration/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { sentryVitePlugin } from '@sentry/vite-plugin'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid(), sentryVitePlugin()],\n})\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/package.json",
    "content": "{\n  \"name\": \"tanstack-e2e-router-solid-example-view-transitions\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  /* \n  Using defaultViewTransition would prevent the need to\n  manually add `viewTransition: true` to every navigation.\n\n  If defaultViewTransition.types is a function, it will be called with the\n  location change info and should return an array of view transition types.\n  This is useful if you want to have different view transitions depending on\n  the navigation's specifics.\n\n  An example use case is sliding in a direction based on the index of the\n  previous and next routes when navigating via browser history back and forth.\n  */\n  // defaultViewTransition: true\n  // OR\n  // defaultViewTransition: {\n  //   types: ({ fromLocation, toLocation }) => {\n  //     let direction = 'none'\n\n  //     if (fromLocation) {\n  //       const fromIndex = fromLocation.state.__TSR_index\n  //       const toIndex = toLocation.state.__TSR_index\n\n  //       direction = fromIndex > toIndex ? 'right' : 'left'\n  //     }\n\n  //     return [`slide-${direction}`]\n  //   },\n  // },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 0))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 0))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as HowItWorksRouteImport } from './routes/how-it-works'\nimport { Route as ExploreRouteImport } from './routes/explore'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst HowItWorksRoute = HowItWorksRouteImport.update({\n  id: '/how-it-works',\n  path: '/how-it-works',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ExploreRoute = ExploreRouteImport.update({\n  id: '/explore',\n  path: '/explore',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  ExploreRoute: typeof ExploreRoute\n  HowItWorksRoute: typeof HowItWorksRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/how-it-works': {\n      id: '/how-it-works'\n      path: '/how-it-works'\n      fullPath: '/how-it-works'\n      preLoaderRoute: typeof HowItWorksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/explore': {\n      id: '/explore'\n      path: '/explore'\n      fullPath: '/explore'\n      preLoaderRoute: typeof ExploreRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  ExploreRoute: ExploreRoute,\n  HowItWorksRoute: HowItWorksRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n          viewTransition\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          viewTransition\n        >\n          Posts\n        </Link>{' '}\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/routes/explore.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/explore')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>\n        Explore the CSS to see how to use active-view-transition-type to create\n        new viewTransitions to use with Tanstack Router.\n      </h3>\n      <h4 class={'text-sm mt-2 italic'}>\n        Disclaimer: View Transition Types may not be supported in all browsers\n        and will fall back to the default browser transition if not available.\n      </h4>\n      <div class=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          class=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/routes/how-it-works.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/how-it-works')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>This example demonstrates a variety of custom page transitions.</h3>\n      <div class=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          class=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n        <Link\n          to={'/explore'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          class=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>Welcome To The View Transitions Example!</h3>\n      <div class=\"flex justify-center mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          class=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/routes/posts.route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2  [view-transition-name:main-content]\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                  // see styles.css for 'warp' transition\n                  viewTransition={{ types: ['warp'] }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <div class=\"[view-transition-name:post]\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n\n/* Slide Left Transition */\nhtml:active-view-transition-type(slide-left) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-left;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-left;\n  }\n}\n\n@keyframes slide-out-left {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(-100%);\n  }\n}\n\n@keyframes slide-in-left {\n  from {\n    transform: translateX(100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Slide Right Transition */\nhtml:active-view-transition-type(slide-right) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-right;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-right;\n  }\n}\n\n@keyframes slide-out-right {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(100%);\n  }\n}\n\n@keyframes slide-in-right {\n  from {\n    transform: translateX(-100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Warp/Rotate Transition */\nhtml:active-view-transition-type(warp) {\n  &::view-transition-old(post) {\n    animation: 400ms ease-out both warp-out;\n  }\n\n  &::view-transition-new(post) {\n    animation: 400ms ease-out both warp-in;\n  }\n}\n\n@keyframes warp-out {\n  from {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n  to {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(1.1) rotate(90deg);\n  }\n}\n\n@keyframes warp-in {\n  from {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(0.9) rotate(-45deg);\n  }\n  to {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/tests/app.spec.ts",
    "content": "import { test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('placeholder test', async ({ page }) => {\n  // This is a placeholder test\n  await page.waitForLoadState('networkidle')\n})\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/solid-router/view-transitions/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-start/basic/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-basic\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"build:spa\": \"MODE=spa vite build && tsc --noEmit\",\n    \"build:prerender\": \"MODE=prerender vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node server.js\",\n    \"test:e2e:startDummyServer\": \"node -e 'import(\\\"./tests/setup/global.setup.ts\\\").then(m => m.default())' &\",\n    \"test:e2e:stopDummyServer\": \"node -e 'import(\\\"./tests/setup/global.teardown.ts\\\").then(m => m.default())'\",\n    \"test:e2e:spaMode\": \"rm -rf port*.txt; MODE=spa playwright test --project=chromium\",\n    \"test:e2e:ssrMode\": \"rm -rf port*.txt; playwright test --project=chromium\",\n    \"test:e2e:prerender\": \"rm -rf port*.txt; MODE=prerender playwright test --project=chromium\",\n    \"test:e2e:preview\": \"rm -rf port*.txt; MODE=preview playwright test --project=chromium\",\n    \"test:e2e\": \"pnpm run test:e2e:spaMode && pnpm run test:e2e:ssrMode && pnpm run test:e2e:prerender && pnpm run test:e2e:preview\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"express\": \"^5.1.0\",\n    \"http-proxy-middleware\": \"^3.0.5\",\n    \"js-cookie\": \"^3.0.5\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from './tests/utils/isSpaMode'\nimport { isPrerender } from './tests/utils/isPrerender'\nimport { isPreview } from './tests/utils/isPreview'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa' : ''}${isPreview ? '_preview' : ''}`,\n)\nconst START_PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa_start' : ''}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\nconst spaModeCommand = `pnpm build:spa && pnpm start`\nconst ssrModeCommand = `pnpm build && pnpm start`\nconst prerenderModeCommand = `pnpm run test:e2e:startDummyServer && pnpm build:prerender && pnpm run test:e2e:stopDummyServer && pnpm start`\nconst previewModeCommand = `pnpm build && pnpm preview --port ${PORT}`\n\nconst getCommand = () => {\n  if (isSpaMode) return spaModeCommand\n  if (isPrerender) return prerenderModeCommand\n  if (isPreview) return previewModeCommand\n  return ssrModeCommand\n}\nconsole.log('running in spa mode: ', isSpaMode.toString())\nconsole.log('running in prerender mode: ', isPrerender.toString())\nconsole.log('running in preview mode: ', isPreview.toString())\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: getCommand(),\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      MODE: process.env.MODE || '',\n      VITE_NODE_ENV: 'test',\n      VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),\n      VITE_SERVER_PORT: String(PORT),\n      START_PORT: String(START_PORT),\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/solid-start/basic/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/solid-start/basic/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/server.js",
    "content": "import { toNodeHandler } from 'srvx/node'\nimport path from 'node:path'\nimport express from 'express'\nimport { createProxyMiddleware } from 'http-proxy-middleware'\n\nconst port = process.env.PORT || 3000\n\nconst startPort = process.env.START_PORT || 3001\n\nconst isSpaMode = process.env.MODE === 'spa'\nconst isPrerender = process.env.MODE === 'prerender'\n\nexport async function createStartServer() {\n  const server = (await import('./dist/server/server.js')).default\n  const nodeHandler = toNodeHandler(server.fetch)\n\n  const app = express()\n\n  // to keep testing uniform stop express from redirecting /posts to /posts/\n  // when serving pre-rendered pages\n  app.use(express.static('./dist/client', { redirect: !isPrerender }))\n\n  app.use(async (req, res, next) => {\n    try {\n      await nodeHandler(req, res)\n    } catch (error) {\n      next(error)\n    }\n  })\n\n  return { app }\n}\n\nexport async function createSpaServer() {\n  const app = express()\n\n  app.use(\n    '/api',\n    createProxyMiddleware({\n      target: `http://localhost:${startPort}/api`, // Replace with your target server's URL\n      changeOrigin: false, // Needed for virtual hosted sites,\n    }),\n  )\n\n  app.use(\n    '/_serverFn',\n    createProxyMiddleware({\n      target: `http://localhost:${startPort}/_serverFn`, // Replace with your target server's URL\n      changeOrigin: false, // Needed for virtual hosted sites,\n    }),\n  )\n\n  app.use(express.static('./dist/client'))\n\n  app.get('/{*splat}', (req, res) => {\n    res.sendFile(path.resolve('./dist/client/index.html'))\n  })\n\n  return { app }\n}\n\nif (isSpaMode) {\n  createSpaServer().then(async ({ app }) =>\n    app.listen(port, () => {\n      console.info(`Client Server: http://localhost:${port}`)\n    }),\n  )\n\n  createStartServer().then(async ({ app }) =>\n    app.listen(startPort, () => {\n      console.info(`Start Server: http://localhost:${startPort}`)\n    }),\n  )\n} else {\n  createStartServer().then(async ({ app }) =>\n    app.listen(port, () => {\n      console.info(`Start Server: http://localhost:${port}`)\n    }),\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/client.tsx",
    "content": "// DO NOT DELETE THIS FILE!!!\n// This file is a good smoke test to make sure the custom client entry is working\nimport { hydrate } from 'solid-js/web'\nimport { StartClient, hydrateStart } from '@tanstack/solid-start/client'\n\nconsole.log(\"[client-entry]: using custom client entry in 'src/client.tsx'\")\n\nhydrateStart().then((router) => {\n  hydrate(() => <StartClient router={router} />, document)\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/components/CustomMessage.tsx",
    "content": "export function CustomMessage({ message }: { message: string }) {\n  return (\n    <div class=\"py-2\">\n      <div class=\"italic\">This is a custom message:</div>\n      <p>{message}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/components/PostErrorComponent.tsx",
    "content": "import { ErrorComponent, ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/components/RedirectOnClick.tsx",
    "content": "import { useServerFn } from '@tanstack/solid-start'\nimport { throwRedirect } from './throwRedirect'\n\ninterface RedirectOnClickProps {\n  target: 'internal' | 'external'\n  reloadDocument?: boolean\n  externalHost?: string\n}\n\nexport function RedirectOnClick({\n  target,\n  reloadDocument,\n  externalHost,\n}: RedirectOnClickProps) {\n  const execute = useServerFn(throwRedirect)\n  return (\n    <button\n      data-testid=\"redirect-on-click\"\n      onClick={() =>\n        execute({ data: { target, reloadDocument, externalHost } })\n      }\n    >\n      click me\n    </button>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/components/UserErrorComponent.tsx",
    "content": "import { ErrorComponent, ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/components/throwRedirect.ts",
    "content": "import { redirect } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport const throwRedirect = createServerFn()\n  .inputValidator(\n    (opts: {\n      target: 'internal' | 'external'\n      reloadDocument?: boolean\n      externalHost?: string\n    }) => opts,\n  )\n  .handler((ctx) => {\n    if (ctx.data.target === 'internal') {\n      throw redirect({ to: '/posts', reloadDocument: ctx.data.reloadDocument })\n    }\n    const href = ctx.data.externalHost ?? 'http://example.com'\n    throw redirect({\n      href,\n    })\n  })\n"
  },
  {
    "path": "e2e/solid-start/basic/src/raw-stream-fns.ts",
    "content": "import { RawStream, createServerFn } from '@tanstack/solid-start'\n\n// Helper to create a delayed Uint8Array stream\nfunction createDelayedStream(\n  chunks: Array<Uint8Array>,\n  delayMs: number,\n): ReadableStream<Uint8Array> {\n  return new ReadableStream<Uint8Array>({\n    async start(controller) {\n      for (const chunk of chunks) {\n        await new Promise((resolve) => setTimeout(resolve, delayMs))\n        controller.enqueue(chunk)\n      }\n      controller.close()\n    },\n  })\n}\n\n// Helper to create a stream with variable delays per chunk\n// Each entry is [chunk, delayBeforeMs] - delay happens BEFORE enqueueing the chunk\nfunction createVariableDelayStream(\n  chunksWithDelays: Array<[Uint8Array, number]>,\n): ReadableStream<Uint8Array> {\n  return new ReadableStream<Uint8Array>({\n    async start(controller) {\n      for (const [chunk, delayMs] of chunksWithDelays) {\n        await new Promise((resolve) => setTimeout(resolve, delayMs))\n        controller.enqueue(chunk)\n      }\n      controller.close()\n    },\n  })\n}\n\n// Helper to encode text to Uint8Array\nfunction encode(text: string): Uint8Array {\n  return new TextEncoder().encode(text)\n}\n\n// Export helpers for use in components and SSR routes\nexport { encode, createDelayedStream, concatBytes }\n\n// Expected data for hint tests - defined here for both server and client verification\n// Test 7: Text hint with pure text\nexport const TEST7_CHUNKS = [\n  encode('Hello, '),\n  encode('World! '),\n  encode('This is text.'),\n]\nexport const TEST7_EXPECTED = concatBytes(TEST7_CHUNKS)\n\n// Test 8: Text hint with pure binary (invalid UTF-8)\nexport const TEST8_CHUNKS = [\n  new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n  new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n]\nexport const TEST8_EXPECTED = concatBytes(TEST8_CHUNKS)\n\n// Test 9: Text hint with mixed content\nexport const TEST9_CHUNKS = [\n  encode('Valid UTF-8 text'),\n  new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n  encode(' More text'),\n]\nexport const TEST9_EXPECTED = concatBytes(TEST9_CHUNKS)\n\n// Test 10: Binary hint with text data\nexport const TEST10_CHUNKS = [encode('This is text but using binary hint')]\nexport const TEST10_EXPECTED = concatBytes(TEST10_CHUNKS)\n\n// Test 11: Binary hint with pure binary\nexport const TEST11_CHUNKS = [\n  new Uint8Array([0x00, 0x01, 0x02, 0xff, 0xfe, 0xfd]),\n]\nexport const TEST11_EXPECTED = concatBytes(TEST11_CHUNKS)\n\n// Helper to concatenate byte arrays\nfunction concatBytes(chunks: Array<Uint8Array>): Uint8Array {\n  const totalLength = chunks.reduce((acc, c) => acc + c.length, 0)\n  const result = new Uint8Array(totalLength)\n  let offset = 0\n  for (const chunk of chunks) {\n    result.set(chunk, offset)\n    offset += chunk.length\n  }\n  return result\n}\n\n// Test 1: Simple single raw stream\nexport const singleRawStreamFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(\n    [encode('chunk1'), encode('chunk2'), encode('chunk3')],\n    50,\n  )\n  return {\n    message: 'Single stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 2: Multiple raw streams\nexport const multipleRawStreamsFn = createServerFn().handler(async () => {\n  const stream1 = createDelayedStream(\n    [encode('stream1-a'), encode('stream1-b')],\n    30,\n  )\n  const stream2 = createDelayedStream(\n    [encode('stream2-a'), encode('stream2-b')],\n    50,\n  )\n  return {\n    message: 'Multiple streams test',\n    first: new RawStream(stream1),\n    second: new RawStream(stream2),\n  }\n})\n\n// Test 3: JSON streaming ends before raw stream\nexport const jsonEndsFirstFn = createServerFn().handler(async () => {\n  // Slow raw stream (takes 500ms total)\n  const slowStream = createDelayedStream(\n    [encode('slow-1'), encode('slow-2'), encode('slow-3'), encode('slow-4')],\n    125,\n  )\n  return {\n    message: 'JSON ends first test',\n    timestamp: Date.now(),\n    slowData: new RawStream(slowStream),\n  }\n})\n\n// Test 4: Raw stream ends before JSON streaming (fast stream, deferred JSON)\nexport const rawEndsFirstFn = createServerFn().handler(async () => {\n  // Fast raw stream (completes quickly)\n  const fastStream = createDelayedStream([encode('fast-done')], 10)\n\n  // Deferred promise - NOT awaited, so it streams as deferred JSON\n  const deferredData = new Promise<string>((resolve) =>\n    setTimeout(() => resolve('deferred-json-data'), 200),\n  )\n\n  return {\n    message: 'Raw ends first test',\n    deferredData,\n    fastData: new RawStream(fastStream),\n  }\n})\n\n// Test 5: Large binary data\nexport const largeBinaryFn = createServerFn().handler(async () => {\n  // Create 1KB chunks\n  const chunk = new Uint8Array(1024)\n  for (let i = 0; i < chunk.length; i++) {\n    chunk[i] = i % 256\n  }\n\n  const stream = createDelayedStream([chunk, chunk, chunk], 20)\n\n  return {\n    message: 'Large binary test',\n    size: 3072,\n    binary: new RawStream(stream),\n  }\n})\n\n// Test 6: Mixed streaming (promise + raw stream)\nexport const mixedStreamingFn = createServerFn().handler(async () => {\n  const rawStream = createDelayedStream(\n    [encode('mixed-raw-1'), encode('mixed-raw-2')],\n    50,\n  )\n\n  return {\n    immediate: 'immediate-value',\n    deferred: new Promise<string>((resolve) =>\n      setTimeout(() => resolve('deferred-value'), 100),\n    ),\n    raw: new RawStream(rawStream),\n  }\n})\n\n// Test 7: Text hint with pure text data (should use UTF-8 encoding)\nexport const textHintPureTextFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST7_CHUNKS, 30)\n  return {\n    message: 'Text hint with pure text',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 8: Text hint with pure binary data (should fallback to base64)\nexport const textHintPureBinaryFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST8_CHUNKS, 30)\n  return {\n    message: 'Text hint with pure binary',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 9: Text hint with mixed content (some UTF-8, some binary)\nexport const textHintMixedFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST9_CHUNKS, 30)\n  return {\n    message: 'Text hint with mixed content',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 10: Binary hint with text data (should still use base64)\nexport const binaryHintTextFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST10_CHUNKS, 30)\n  return {\n    message: 'Binary hint with text data',\n    data: new RawStream(stream, { hint: 'binary' }),\n  }\n})\n\n// Test 11: Binary hint with pure binary data\nexport const binaryHintBinaryFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST11_CHUNKS, 30)\n  return {\n    message: 'Binary hint with binary data',\n    data: new RawStream(stream, { hint: 'binary' }),\n  }\n})\n\n// ============================================================================\n// MULTIPLEXING TESTS - Verify correct interleaving of multiple streams\n// ============================================================================\n\n// Expected data for multiplexing tests\n// Test 12: Two streams with interleaved timing\n// Stream A: sends at 0ms, 150ms, 200ms (3 chunks with pauses)\n// Stream B: sends at 50ms, 100ms, 250ms (3 chunks, different rhythm)\nexport const TEST12_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('A1-first'), 0], // immediate\n  [encode('A2-after-pause'), 150], // 150ms pause\n  [encode('A3-quick'), 50], // 50ms after A2\n]\nexport const TEST12_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('B1-start'), 50], // 50ms after start\n  [encode('B2-continue'), 50], // 50ms after B1\n  [encode('B3-final'), 150], // 150ms pause then final\n]\nexport const TEST12_STREAM_A_EXPECTED = concatBytes(\n  TEST12_STREAM_A_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST12_STREAM_B_EXPECTED = concatBytes(\n  TEST12_STREAM_B_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 13: Burst-pause-burst pattern (single stream)\n// 3 chunks quickly, long pause, 3 more chunks quickly\nexport const TEST13_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('burst1-a'), 10],\n  [encode('burst1-b'), 10],\n  [encode('burst1-c'), 10],\n  [encode('pause-then-burst2-a'), 200], // long pause\n  [encode('burst2-b'), 10],\n  [encode('burst2-c'), 10],\n]\nexport const TEST13_EXPECTED = concatBytes(\n  TEST13_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 14: Three concurrent streams with different patterns\n// Stream A: fast steady (every 30ms)\n// Stream B: slow steady (every 100ms)\n// Stream C: burst pattern (quick-pause-quick)\nexport const TEST14_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('A1'), 30],\n  [encode('A2'), 30],\n  [encode('A3'), 30],\n  [encode('A4'), 30],\n]\nexport const TEST14_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('B1-slow'), 100],\n  [encode('B2-slow'), 100],\n]\nexport const TEST14_STREAM_C_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('C1-burst'), 20],\n  [encode('C2-burst'), 20],\n  [encode('C3-after-pause'), 150],\n]\nexport const TEST14_STREAM_A_EXPECTED = concatBytes(\n  TEST14_STREAM_A_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST14_STREAM_B_EXPECTED = concatBytes(\n  TEST14_STREAM_B_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST14_STREAM_C_EXPECTED = concatBytes(\n  TEST14_STREAM_C_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 12: Interleaved multiplexing - two streams with variable delays\nexport const interleavedStreamsFn = createServerFn().handler(async () => {\n  const streamA = createVariableDelayStream(TEST12_STREAM_A_CHUNKS)\n  const streamB = createVariableDelayStream(TEST12_STREAM_B_CHUNKS)\n\n  return {\n    message: 'Interleaved streams test',\n    streamA: new RawStream(streamA),\n    streamB: new RawStream(streamB),\n  }\n})\n\n// Test 13: Burst-pause-burst pattern\nexport const burstPauseBurstFn = createServerFn().handler(async () => {\n  const stream = createVariableDelayStream(TEST13_CHUNKS)\n\n  return {\n    message: 'Burst-pause-burst test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 14: Three concurrent streams\nexport const threeStreamsFn = createServerFn().handler(async () => {\n  const streamA = createVariableDelayStream(TEST14_STREAM_A_CHUNKS)\n  const streamB = createVariableDelayStream(TEST14_STREAM_B_CHUNKS)\n  const streamC = createVariableDelayStream(TEST14_STREAM_C_CHUNKS)\n\n  return {\n    message: 'Three concurrent streams test',\n    fast: new RawStream(streamA),\n    slow: new RawStream(streamB),\n    burst: new RawStream(streamC),\n  }\n})\n\n// ============================================================================\n// EDGE CASE TESTS\n// ============================================================================\n\n// Test 15: Empty stream (zero bytes)\nexport const emptyStreamFn = createServerFn().handler(async () => {\n  // Stream that immediately closes with no data\n  const stream = new ReadableStream<Uint8Array>({\n    start(controller) {\n      controller.close()\n    },\n  })\n\n  return {\n    message: 'Empty stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 16: Stream that errors mid-flight\nexport const errorStreamFn = createServerFn().handler(async () => {\n  // Stream that sends some data then errors\n  const stream = new ReadableStream<Uint8Array>({\n    async start(controller) {\n      controller.enqueue(encode('chunk-before-error'))\n      await new Promise((resolve) => setTimeout(resolve, 50))\n      controller.error(new Error('Intentional stream error'))\n    },\n  })\n\n  return {\n    message: 'Error stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Helpers for consuming streams (exported for use in components)\n// Note: RawStream is the marker class used in loaders/server functions,\n// but after SSR deserialization it becomes ReadableStream<Uint8Array>.\n// We accept both types to handle the TypeScript mismatch.\nexport function createStreamConsumer() {\n  const decoder = new TextDecoder()\n\n  return async function consumeStream(\n    stream: ReadableStream<Uint8Array> | RawStream,\n  ): Promise<string> {\n    // Handle both RawStream (from type system) and ReadableStream (runtime)\n    const actualStream =\n      stream instanceof RawStream\n        ? stream.stream\n        : (stream as ReadableStream<Uint8Array>)\n    const reader = actualStream.getReader()\n    const chunks: Array<string> = []\n\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n    while (true) {\n      const { done, value } = await reader.read()\n      if (done) break\n      chunks.push(decoder.decode(value, { stream: true }))\n    }\n\n    return chunks.join('')\n  }\n}\n\nexport async function consumeBinaryStream(\n  stream: ReadableStream<Uint8Array> | RawStream,\n): Promise<number> {\n  // Handle both RawStream (from type system) and ReadableStream (runtime)\n  const actualStream =\n    stream instanceof RawStream\n      ? stream.stream\n      : (stream as ReadableStream<Uint8Array>)\n  const reader = actualStream.getReader()\n  let totalBytes = 0\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  while (true) {\n    const { done, value } = await reader.read()\n    if (done) break\n    totalBytes += value.length\n  }\n\n  return totalBytes\n}\n\n// Helper to collect all bytes from a stream\nexport async function collectBytes(\n  stream: ReadableStream<Uint8Array> | RawStream,\n): Promise<Uint8Array> {\n  const actualStream =\n    stream instanceof RawStream\n      ? stream.stream\n      : (stream as ReadableStream<Uint8Array>)\n  const reader = actualStream.getReader()\n  const chunks: Array<Uint8Array> = []\n  let totalLength = 0\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  while (true) {\n    const { done, value } = await reader.read()\n    if (done) break\n    chunks.push(value)\n    totalLength += value.length\n  }\n\n  const result = new Uint8Array(totalLength)\n  let pos = 0\n  for (const chunk of chunks) {\n    result.set(chunk, pos)\n    pos += chunk.length\n  }\n  return result\n}\n\n// Compare two Uint8Arrays byte-by-byte\nexport function compareBytes(\n  actual: Uint8Array,\n  expected: Uint8Array,\n): {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n} {\n  if (actual.length !== expected.length) {\n    return {\n      match: false,\n      mismatchIndex: -1, // -1 indicates length mismatch\n      actualLength: actual.length,\n      expectedLength: expected.length,\n    }\n  }\n  for (let i = 0; i < actual.length; i++) {\n    if (actual[i] !== expected[i]) {\n      return {\n        match: false,\n        mismatchIndex: i,\n        actualLength: actual.length,\n        expectedLength: expected.length,\n      }\n    }\n  }\n  return {\n    match: true,\n    mismatchIndex: null,\n    actualLength: actual.length,\n    expectedLength: expected.length,\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as StreamRouteImport } from './routes/stream'\nimport { Route as ScriptsRouteImport } from './routes/scripts'\nimport { Route as RawStreamRouteImport } from './routes/raw-stream'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LinksRouteImport } from './routes/links'\nimport { Route as InlineScriptsRouteImport } from './routes/inline-scripts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as SpecialCharsRouteRouteImport } from './routes/specialChars/route'\nimport { Route as SearchParamsRouteRouteImport } from './routes/search-params/route'\nimport { Route as NotFoundRouteRouteImport } from './routes/not-found/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as SearchParamsIndexRouteImport } from './routes/search-params/index'\nimport { Route as RedirectIndexRouteImport } from './routes/redirect/index'\nimport { Route as RawStreamIndexRouteImport } from './routes/raw-stream/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as NotFoundIndexRouteImport } from './routes/not-found/index'\nimport { Route as MultiCookieRedirectIndexRouteImport } from './routes/multi-cookie-redirect/index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as SpecialCharsChar45824Char54620Char48124Char44397RouteImport } from './routes/specialChars/대한민국'\nimport { Route as SpecialCharsSearchRouteImport } from './routes/specialChars/search'\nimport { Route as SpecialCharsHashRouteImport } from './routes/specialChars/hash'\nimport { Route as SpecialCharsParamRouteImport } from './routes/specialChars/$param'\nimport { Route as SearchParamsLoaderThrowsRedirectRouteImport } from './routes/search-params/loader-throws-redirect'\nimport { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default'\nimport { Route as RedirectTargetRouteImport } from './routes/redirect/$target'\nimport { Route as RawStreamSsrTextHintRouteImport } from './routes/raw-stream/ssr-text-hint'\nimport { Route as RawStreamSsrSingleRouteImport } from './routes/raw-stream/ssr-single'\nimport { Route as RawStreamSsrMultipleRouteImport } from './routes/raw-stream/ssr-multiple'\nimport { Route as RawStreamSsrMixedRouteImport } from './routes/raw-stream/ssr-mixed'\nimport { Route as RawStreamSsrBinaryHintRouteImport } from './routes/raw-stream/ssr-binary-hint'\nimport { Route as RawStreamClientCallRouteImport } from './routes/raw-stream/client-call'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as NotFoundViaLoaderRouteImport } from './routes/not-found/via-loader'\nimport { Route as NotFoundViaBeforeLoadTargetRootRouteImport } from './routes/not-found/via-beforeLoad-target-root'\nimport { Route as NotFoundViaBeforeLoadRouteImport } from './routes/not-found/via-beforeLoad'\nimport { Route as MultiCookieRedirectTargetRouteImport } from './routes/multi-cookie-redirect/target'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as SpecialCharsMalformedRouteRouteImport } from './routes/specialChars/malformed/route'\nimport { Route as NotFoundParentBoundaryRouteRouteImport } from './routes/not-found/parent-boundary/route'\nimport { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index'\nimport { Route as TransitionTypingCreateResourceRouteImport } from './routes/transition/typing/create-resource'\nimport { Route as TransitionCountCreateResourceRouteImport } from './routes/transition/count/create-resource'\nimport { Route as SpecialCharsMalformedSearchRouteImport } from './routes/specialChars/malformed/search'\nimport { Route as SpecialCharsMalformedParamRouteImport } from './routes/specialChars/malformed/$param'\nimport { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader'\nimport { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as NotFoundParentBoundaryViaBeforeLoadRouteImport } from './routes/not-found/parent-boundary/via-beforeLoad'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as RedirectTargetServerFnIndexRouteImport } from './routes/redirect/$target/serverFn/index'\nimport { Route as RedirectTargetServerFnViaUseServerFnRouteImport } from './routes/redirect/$target/serverFn/via-useServerFn'\nimport { Route as RedirectTargetServerFnViaLoaderRouteImport } from './routes/redirect/$target/serverFn/via-loader'\nimport { Route as RedirectTargetServerFnViaBeforeLoadRouteImport } from './routes/redirect/$target/serverFn/via-beforeLoad'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst StreamRoute = StreamRouteImport.update({\n  id: '/stream',\n  path: '/stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ScriptsRoute = ScriptsRouteImport.update({\n  id: '/scripts',\n  path: '/scripts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamRoute = RawStreamRouteImport.update({\n  id: '/raw-stream',\n  path: '/raw-stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LinksRoute = LinksRouteImport.update({\n  id: '/links',\n  path: '/links',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst InlineScriptsRoute = InlineScriptsRouteImport.update({\n  id: '/inline-scripts',\n  path: '/inline-scripts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SpecialCharsRouteRoute = SpecialCharsRouteRouteImport.update({\n  id: '/specialChars',\n  path: '/specialChars',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({\n  id: '/search-params',\n  path: '/search-params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotFoundRouteRoute = NotFoundRouteRouteImport.update({\n  id: '/not-found',\n  path: '/not-found',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RedirectIndexRoute = RedirectIndexRouteImport.update({\n  id: '/redirect/',\n  path: '/redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamIndexRoute = RawStreamIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst NotFoundIndexRoute = NotFoundIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst MultiCookieRedirectIndexRoute =\n  MultiCookieRedirectIndexRouteImport.update({\n    id: '/multi-cookie-redirect/',\n    path: '/multi-cookie-redirect/',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst SpecialCharsChar45824Char54620Char48124Char44397Route =\n  SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => SpecialCharsRouteRoute,\n  } as any)\nconst SpecialCharsSearchRoute = SpecialCharsSearchRouteImport.update({\n  id: '/search',\n  path: '/search',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SpecialCharsHashRoute = SpecialCharsHashRouteImport.update({\n  id: '/hash',\n  path: '/hash',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SpecialCharsParamRoute = SpecialCharsParamRouteImport.update({\n  id: '/$param',\n  path: '/$param',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SearchParamsLoaderThrowsRedirectRoute =\n  SearchParamsLoaderThrowsRedirectRouteImport.update({\n    id: '/loader-throws-redirect',\n    path: '/loader-throws-redirect',\n    getParentRoute: () => SearchParamsRouteRoute,\n  } as any)\nconst SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({\n  id: '/default',\n  path: '/default',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RedirectTargetRoute = RedirectTargetRouteImport.update({\n  id: '/redirect/$target',\n  path: '/redirect/$target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamSsrTextHintRoute = RawStreamSsrTextHintRouteImport.update({\n  id: '/ssr-text-hint',\n  path: '/ssr-text-hint',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrSingleRoute = RawStreamSsrSingleRouteImport.update({\n  id: '/ssr-single',\n  path: '/ssr-single',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrMultipleRoute = RawStreamSsrMultipleRouteImport.update({\n  id: '/ssr-multiple',\n  path: '/ssr-multiple',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrMixedRoute = RawStreamSsrMixedRouteImport.update({\n  id: '/ssr-mixed',\n  path: '/ssr-mixed',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrBinaryHintRoute = RawStreamSsrBinaryHintRouteImport.update({\n  id: '/ssr-binary-hint',\n  path: '/ssr-binary-hint',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamClientCallRoute = RawStreamClientCallRouteImport.update({\n  id: '/client-call',\n  path: '/client-call',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({\n  id: '/via-loader',\n  path: '/via-loader',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst NotFoundViaBeforeLoadTargetRootRoute =\n  NotFoundViaBeforeLoadTargetRootRouteImport.update({\n    id: '/via-beforeLoad-target-root',\n    path: '/via-beforeLoad-target-root',\n    getParentRoute: () => NotFoundRouteRoute,\n  } as any)\nconst NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({\n  id: '/via-beforeLoad',\n  path: '/via-beforeLoad',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst MultiCookieRedirectTargetRoute =\n  MultiCookieRedirectTargetRouteImport.update({\n    id: '/multi-cookie-redirect/target',\n    path: '/multi-cookie-redirect/target',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst SpecialCharsMalformedRouteRoute =\n  SpecialCharsMalformedRouteRouteImport.update({\n    id: '/malformed',\n    path: '/malformed',\n    getParentRoute: () => SpecialCharsRouteRoute,\n  } as any)\nconst NotFoundParentBoundaryRouteRoute =\n  NotFoundParentBoundaryRouteRouteImport.update({\n    id: '/parent-boundary',\n    path: '/parent-boundary',\n    getParentRoute: () => NotFoundRouteRoute,\n  } as any)\nconst RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst TransitionTypingCreateResourceRoute =\n  TransitionTypingCreateResourceRouteImport.update({\n    id: '/transition/typing/create-resource',\n    path: '/transition/typing/create-resource',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst TransitionCountCreateResourceRoute =\n  TransitionCountCreateResourceRouteImport.update({\n    id: '/transition/count/create-resource',\n    path: '/transition/count/create-resource',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst SpecialCharsMalformedSearchRoute =\n  SpecialCharsMalformedSearchRouteImport.update({\n    id: '/search',\n    path: '/search',\n    getParentRoute: () => SpecialCharsMalformedRouteRoute,\n  } as any)\nconst SpecialCharsMalformedParamRoute =\n  SpecialCharsMalformedParamRouteImport.update({\n    id: '/$param',\n    path: '/$param',\n    getParentRoute: () => SpecialCharsMalformedRouteRoute,\n  } as any)\nconst RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({\n  id: '/via-loader',\n  path: '/via-loader',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst RedirectTargetViaBeforeLoadRoute =\n  RedirectTargetViaBeforeLoadRouteImport.update({\n    id: '/via-beforeLoad',\n    path: '/via-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotFoundParentBoundaryViaBeforeLoadRoute =\n  NotFoundParentBoundaryViaBeforeLoadRouteImport.update({\n    id: '/via-beforeLoad',\n    path: '/via-beforeLoad',\n    getParentRoute: () => NotFoundParentBoundaryRouteRoute,\n  } as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst RedirectTargetServerFnIndexRoute =\n  RedirectTargetServerFnIndexRouteImport.update({\n    id: '/serverFn/',\n    path: '/serverFn/',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaUseServerFnRoute =\n  RedirectTargetServerFnViaUseServerFnRouteImport.update({\n    id: '/serverFn/via-useServerFn',\n    path: '/serverFn/via-useServerFn',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaLoaderRoute =\n  RedirectTargetServerFnViaLoaderRouteImport.update({\n    id: '/serverFn/via-loader',\n    path: '/serverFn/via-loader',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaBeforeLoadRoute =\n  RedirectTargetServerFnViaBeforeLoadRouteImport.update({\n    id: '/serverFn/via-beforeLoad',\n    path: '/serverFn/via-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/not-found': typeof NotFoundRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/raw-stream': typeof RawStreamRouteWithChildren\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/users': typeof UsersRouteWithChildren\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute\n  '/not-found/': typeof NotFoundIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/raw-stream/': typeof RawStreamIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute\n  '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect': typeof MultiCookieRedirectIndexRoute\n  '/not-found': typeof NotFoundIndexRoute\n  '/posts': typeof PostsIndexRoute\n  '/raw-stream': typeof RawStreamIndexRoute\n  '/redirect': typeof RedirectIndexRoute\n  '/search-params': typeof SearchParamsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute\n  '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute\n  '/redirect/$target': typeof RedirectTargetIndexRoute\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn': typeof RedirectTargetServerFnIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/not-found': typeof NotFoundRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/_layout': typeof LayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/raw-stream': typeof RawStreamRouteWithChildren\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/users': typeof UsersRouteWithChildren\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute\n  '/not-found/': typeof NotFoundIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/raw-stream/': typeof RawStreamIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute\n  '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/not-found'\n    | '/search-params'\n    | '/specialChars'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/posts'\n    | '/raw-stream'\n    | '/scripts'\n    | '/stream'\n    | '/users'\n    | '/not-found/parent-boundary'\n    | '/specialChars/malformed'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect/'\n    | '/not-found/'\n    | '/posts/'\n    | '/raw-stream/'\n    | '/redirect/'\n    | '/search-params/'\n    | '/users/'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$userId'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/transition/count/create-resource'\n    | '/transition/typing/create-resource'\n    | '/redirect/$target/'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/specialChars'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/scripts'\n    | '/stream'\n    | '/not-found/parent-boundary'\n    | '/specialChars/malformed'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect'\n    | '/not-found'\n    | '/posts'\n    | '/raw-stream'\n    | '/redirect'\n    | '/search-params'\n    | '/users'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$userId'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/transition/count/create-resource'\n    | '/transition/typing/create-resource'\n    | '/redirect/$target'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn'\n  id:\n    | '__root__'\n    | '/'\n    | '/not-found'\n    | '/search-params'\n    | '/specialChars'\n    | '/_layout'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/posts'\n    | '/raw-stream'\n    | '/scripts'\n    | '/stream'\n    | '/users'\n    | '/not-found/parent-boundary'\n    | '/specialChars/malformed'\n    | '/_layout/_layout-2'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect/'\n    | '/not-found/'\n    | '/posts/'\n    | '/raw-stream/'\n    | '/redirect/'\n    | '/search-params/'\n    | '/users/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/api/users/$userId'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts_/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/transition/count/create-resource'\n    | '/transition/typing/create-resource'\n    | '/redirect/$target/'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  NotFoundRouteRoute: typeof NotFoundRouteRouteWithChildren\n  SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren\n  SpecialCharsRouteRoute: typeof SpecialCharsRouteRouteWithChildren\n  LayoutRoute: typeof LayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  InlineScriptsRoute: typeof InlineScriptsRoute\n  LinksRoute: typeof LinksRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RawStreamRoute: typeof RawStreamRouteWithChildren\n  ScriptsRoute: typeof ScriptsRoute\n  StreamRoute: typeof StreamRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  MultiCookieRedirectTargetRoute: typeof MultiCookieRedirectTargetRoute\n  RedirectTargetRoute: typeof RedirectTargetRouteWithChildren\n  MultiCookieRedirectIndexRoute: typeof MultiCookieRedirectIndexRoute\n  RedirectIndexRoute: typeof RedirectIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  TransitionCountCreateResourceRoute: typeof TransitionCountCreateResourceRoute\n  TransitionTypingCreateResourceRoute: typeof TransitionTypingCreateResourceRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/stream': {\n      id: '/stream'\n      path: '/stream'\n      fullPath: '/stream'\n      preLoaderRoute: typeof StreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/scripts': {\n      id: '/scripts'\n      path: '/scripts'\n      fullPath: '/scripts'\n      preLoaderRoute: typeof ScriptsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream': {\n      id: '/raw-stream'\n      path: '/raw-stream'\n      fullPath: '/raw-stream'\n      preLoaderRoute: typeof RawStreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/links': {\n      id: '/links'\n      path: '/links'\n      fullPath: '/links'\n      preLoaderRoute: typeof LinksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/inline-scripts': {\n      id: '/inline-scripts'\n      path: '/inline-scripts'\n      fullPath: '/inline-scripts'\n      preLoaderRoute: typeof InlineScriptsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/specialChars': {\n      id: '/specialChars'\n      path: '/specialChars'\n      fullPath: '/specialChars'\n      preLoaderRoute: typeof SpecialCharsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params': {\n      id: '/search-params'\n      path: '/search-params'\n      fullPath: '/search-params'\n      preLoaderRoute: typeof SearchParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/not-found': {\n      id: '/not-found'\n      path: '/not-found'\n      fullPath: '/not-found'\n      preLoaderRoute: typeof NotFoundRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/search-params/': {\n      id: '/search-params/'\n      path: '/'\n      fullPath: '/search-params/'\n      preLoaderRoute: typeof SearchParamsIndexRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/redirect/': {\n      id: '/redirect/'\n      path: '/redirect'\n      fullPath: '/redirect/'\n      preLoaderRoute: typeof RedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream/': {\n      id: '/raw-stream/'\n      path: '/'\n      fullPath: '/raw-stream/'\n      preLoaderRoute: typeof RawStreamIndexRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/not-found/': {\n      id: '/not-found/'\n      path: '/'\n      fullPath: '/not-found/'\n      preLoaderRoute: typeof NotFoundIndexRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/multi-cookie-redirect/': {\n      id: '/multi-cookie-redirect/'\n      path: '/multi-cookie-redirect'\n      fullPath: '/multi-cookie-redirect/'\n      preLoaderRoute: typeof MultiCookieRedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/specialChars/대한민국': {\n      id: '/specialChars/대한민국'\n      path: '/대한민국'\n      fullPath: '/specialChars/대한민국'\n      preLoaderRoute: typeof SpecialCharsChar45824Char54620Char48124Char44397RouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/search': {\n      id: '/specialChars/search'\n      path: '/search'\n      fullPath: '/specialChars/search'\n      preLoaderRoute: typeof SpecialCharsSearchRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/hash': {\n      id: '/specialChars/hash'\n      path: '/hash'\n      fullPath: '/specialChars/hash'\n      preLoaderRoute: typeof SpecialCharsHashRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/$param': {\n      id: '/specialChars/$param'\n      path: '/$param'\n      fullPath: '/specialChars/$param'\n      preLoaderRoute: typeof SpecialCharsParamRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/search-params/loader-throws-redirect': {\n      id: '/search-params/loader-throws-redirect'\n      path: '/loader-throws-redirect'\n      fullPath: '/search-params/loader-throws-redirect'\n      preLoaderRoute: typeof SearchParamsLoaderThrowsRedirectRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/search-params/default': {\n      id: '/search-params/default'\n      path: '/default'\n      fullPath: '/search-params/default'\n      preLoaderRoute: typeof SearchParamsDefaultRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/redirect/$target': {\n      id: '/redirect/$target'\n      path: '/redirect/$target'\n      fullPath: '/redirect/$target'\n      preLoaderRoute: typeof RedirectTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream/ssr-text-hint': {\n      id: '/raw-stream/ssr-text-hint'\n      path: '/ssr-text-hint'\n      fullPath: '/raw-stream/ssr-text-hint'\n      preLoaderRoute: typeof RawStreamSsrTextHintRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-single': {\n      id: '/raw-stream/ssr-single'\n      path: '/ssr-single'\n      fullPath: '/raw-stream/ssr-single'\n      preLoaderRoute: typeof RawStreamSsrSingleRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-multiple': {\n      id: '/raw-stream/ssr-multiple'\n      path: '/ssr-multiple'\n      fullPath: '/raw-stream/ssr-multiple'\n      preLoaderRoute: typeof RawStreamSsrMultipleRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-mixed': {\n      id: '/raw-stream/ssr-mixed'\n      path: '/ssr-mixed'\n      fullPath: '/raw-stream/ssr-mixed'\n      preLoaderRoute: typeof RawStreamSsrMixedRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-binary-hint': {\n      id: '/raw-stream/ssr-binary-hint'\n      path: '/ssr-binary-hint'\n      fullPath: '/raw-stream/ssr-binary-hint'\n      preLoaderRoute: typeof RawStreamSsrBinaryHintRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/client-call': {\n      id: '/raw-stream/client-call'\n      path: '/client-call'\n      fullPath: '/raw-stream/client-call'\n      preLoaderRoute: typeof RawStreamClientCallRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/not-found/via-loader': {\n      id: '/not-found/via-loader'\n      path: '/via-loader'\n      fullPath: '/not-found/via-loader'\n      preLoaderRoute: typeof NotFoundViaLoaderRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/not-found/via-beforeLoad-target-root': {\n      id: '/not-found/via-beforeLoad-target-root'\n      path: '/via-beforeLoad-target-root'\n      fullPath: '/not-found/via-beforeLoad-target-root'\n      preLoaderRoute: typeof NotFoundViaBeforeLoadTargetRootRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/not-found/via-beforeLoad': {\n      id: '/not-found/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/not-found/via-beforeLoad'\n      preLoaderRoute: typeof NotFoundViaBeforeLoadRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/multi-cookie-redirect/target': {\n      id: '/multi-cookie-redirect/target'\n      path: '/multi-cookie-redirect/target'\n      fullPath: '/multi-cookie-redirect/target'\n      preLoaderRoute: typeof MultiCookieRedirectTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/specialChars/malformed': {\n      id: '/specialChars/malformed'\n      path: '/malformed'\n      fullPath: '/specialChars/malformed'\n      preLoaderRoute: typeof SpecialCharsMalformedRouteRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/not-found/parent-boundary': {\n      id: '/not-found/parent-boundary'\n      path: '/parent-boundary'\n      fullPath: '/not-found/parent-boundary'\n      preLoaderRoute: typeof NotFoundParentBoundaryRouteRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/redirect/$target/': {\n      id: '/redirect/$target/'\n      path: '/'\n      fullPath: '/redirect/$target/'\n      preLoaderRoute: typeof RedirectTargetIndexRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/transition/typing/create-resource': {\n      id: '/transition/typing/create-resource'\n      path: '/transition/typing/create-resource'\n      fullPath: '/transition/typing/create-resource'\n      preLoaderRoute: typeof TransitionTypingCreateResourceRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/transition/count/create-resource': {\n      id: '/transition/count/create-resource'\n      path: '/transition/count/create-resource'\n      fullPath: '/transition/count/create-resource'\n      preLoaderRoute: typeof TransitionCountCreateResourceRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/specialChars/malformed/search': {\n      id: '/specialChars/malformed/search'\n      path: '/search'\n      fullPath: '/specialChars/malformed/search'\n      preLoaderRoute: typeof SpecialCharsMalformedSearchRouteImport\n      parentRoute: typeof SpecialCharsMalformedRouteRoute\n    }\n    '/specialChars/malformed/$param': {\n      id: '/specialChars/malformed/$param'\n      path: '/$param'\n      fullPath: '/specialChars/malformed/$param'\n      preLoaderRoute: typeof SpecialCharsMalformedParamRouteImport\n      parentRoute: typeof SpecialCharsMalformedRouteRoute\n    }\n    '/redirect/$target/via-loader': {\n      id: '/redirect/$target/via-loader'\n      path: '/via-loader'\n      fullPath: '/redirect/$target/via-loader'\n      preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-beforeLoad': {\n      id: '/redirect/$target/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/redirect/$target/via-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/not-found/parent-boundary/via-beforeLoad': {\n      id: '/not-found/parent-boundary/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/not-found/parent-boundary/via-beforeLoad'\n      preLoaderRoute: typeof NotFoundParentBoundaryViaBeforeLoadRouteImport\n      parentRoute: typeof NotFoundParentBoundaryRouteRoute\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/redirect/$target/serverFn/': {\n      id: '/redirect/$target/serverFn/'\n      path: '/serverFn'\n      fullPath: '/redirect/$target/serverFn/'\n      preLoaderRoute: typeof RedirectTargetServerFnIndexRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-useServerFn': {\n      id: '/redirect/$target/serverFn/via-useServerFn'\n      path: '/serverFn/via-useServerFn'\n      fullPath: '/redirect/$target/serverFn/via-useServerFn'\n      preLoaderRoute: typeof RedirectTargetServerFnViaUseServerFnRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-loader': {\n      id: '/redirect/$target/serverFn/via-loader'\n      path: '/serverFn/via-loader'\n      fullPath: '/redirect/$target/serverFn/via-loader'\n      preLoaderRoute: typeof RedirectTargetServerFnViaLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-beforeLoad': {\n      id: '/redirect/$target/serverFn/via-beforeLoad'\n      path: '/serverFn/via-beforeLoad'\n      fullPath: '/redirect/$target/serverFn/via-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetServerFnViaBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n  }\n}\n\ninterface NotFoundParentBoundaryRouteRouteChildren {\n  NotFoundParentBoundaryViaBeforeLoadRoute: typeof NotFoundParentBoundaryViaBeforeLoadRoute\n}\n\nconst NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren =\n  {\n    NotFoundParentBoundaryViaBeforeLoadRoute:\n      NotFoundParentBoundaryViaBeforeLoadRoute,\n  }\n\nconst NotFoundParentBoundaryRouteRouteWithChildren =\n  NotFoundParentBoundaryRouteRoute._addFileChildren(\n    NotFoundParentBoundaryRouteRouteChildren,\n  )\n\ninterface NotFoundRouteRouteChildren {\n  NotFoundParentBoundaryRouteRoute: typeof NotFoundParentBoundaryRouteRouteWithChildren\n  NotFoundViaBeforeLoadRoute: typeof NotFoundViaBeforeLoadRoute\n  NotFoundViaBeforeLoadTargetRootRoute: typeof NotFoundViaBeforeLoadTargetRootRoute\n  NotFoundViaLoaderRoute: typeof NotFoundViaLoaderRoute\n  NotFoundIndexRoute: typeof NotFoundIndexRoute\n}\n\nconst NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = {\n  NotFoundParentBoundaryRouteRoute:\n    NotFoundParentBoundaryRouteRouteWithChildren,\n  NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute,\n  NotFoundViaBeforeLoadTargetRootRoute: NotFoundViaBeforeLoadTargetRootRoute,\n  NotFoundViaLoaderRoute: NotFoundViaLoaderRoute,\n  NotFoundIndexRoute: NotFoundIndexRoute,\n}\n\nconst NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(\n  NotFoundRouteRouteChildren,\n)\n\ninterface SearchParamsRouteRouteChildren {\n  SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute\n  SearchParamsLoaderThrowsRedirectRoute: typeof SearchParamsLoaderThrowsRedirectRoute\n  SearchParamsIndexRoute: typeof SearchParamsIndexRoute\n}\n\nconst SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {\n  SearchParamsDefaultRoute: SearchParamsDefaultRoute,\n  SearchParamsLoaderThrowsRedirectRoute: SearchParamsLoaderThrowsRedirectRoute,\n  SearchParamsIndexRoute: SearchParamsIndexRoute,\n}\n\nconst SearchParamsRouteRouteWithChildren =\n  SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)\n\ninterface SpecialCharsMalformedRouteRouteChildren {\n  SpecialCharsMalformedParamRoute: typeof SpecialCharsMalformedParamRoute\n  SpecialCharsMalformedSearchRoute: typeof SpecialCharsMalformedSearchRoute\n}\n\nconst SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren =\n  {\n    SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,\n    SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,\n  }\n\nconst SpecialCharsMalformedRouteRouteWithChildren =\n  SpecialCharsMalformedRouteRoute._addFileChildren(\n    SpecialCharsMalformedRouteRouteChildren,\n  )\n\ninterface SpecialCharsRouteRouteChildren {\n  SpecialCharsMalformedRouteRoute: typeof SpecialCharsMalformedRouteRouteWithChildren\n  SpecialCharsParamRoute: typeof SpecialCharsParamRoute\n  SpecialCharsHashRoute: typeof SpecialCharsHashRoute\n  SpecialCharsSearchRoute: typeof SpecialCharsSearchRoute\n  SpecialCharsChar45824Char54620Char48124Char44397Route: typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n}\n\nconst SpecialCharsRouteRouteChildren: SpecialCharsRouteRouteChildren = {\n  SpecialCharsMalformedRouteRoute: SpecialCharsMalformedRouteRouteWithChildren,\n  SpecialCharsParamRoute: SpecialCharsParamRoute,\n  SpecialCharsHashRoute: SpecialCharsHashRoute,\n  SpecialCharsSearchRoute: SpecialCharsSearchRoute,\n  SpecialCharsChar45824Char54620Char48124Char44397Route:\n    SpecialCharsChar45824Char54620Char48124Char44397Route,\n}\n\nconst SpecialCharsRouteRouteWithChildren =\n  SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface RawStreamRouteChildren {\n  RawStreamClientCallRoute: typeof RawStreamClientCallRoute\n  RawStreamSsrBinaryHintRoute: typeof RawStreamSsrBinaryHintRoute\n  RawStreamSsrMixedRoute: typeof RawStreamSsrMixedRoute\n  RawStreamSsrMultipleRoute: typeof RawStreamSsrMultipleRoute\n  RawStreamSsrSingleRoute: typeof RawStreamSsrSingleRoute\n  RawStreamSsrTextHintRoute: typeof RawStreamSsrTextHintRoute\n  RawStreamIndexRoute: typeof RawStreamIndexRoute\n}\n\nconst RawStreamRouteChildren: RawStreamRouteChildren = {\n  RawStreamClientCallRoute: RawStreamClientCallRoute,\n  RawStreamSsrBinaryHintRoute: RawStreamSsrBinaryHintRoute,\n  RawStreamSsrMixedRoute: RawStreamSsrMixedRoute,\n  RawStreamSsrMultipleRoute: RawStreamSsrMultipleRoute,\n  RawStreamSsrSingleRoute: RawStreamSsrSingleRoute,\n  RawStreamSsrTextHintRoute: RawStreamSsrTextHintRoute,\n  RawStreamIndexRoute: RawStreamIndexRoute,\n}\n\nconst RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(\n  RawStreamRouteChildren,\n)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\ninterface RedirectTargetRouteChildren {\n  RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute\n  RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute\n  RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute\n  RedirectTargetServerFnViaBeforeLoadRoute: typeof RedirectTargetServerFnViaBeforeLoadRoute\n  RedirectTargetServerFnViaLoaderRoute: typeof RedirectTargetServerFnViaLoaderRoute\n  RedirectTargetServerFnViaUseServerFnRoute: typeof RedirectTargetServerFnViaUseServerFnRoute\n  RedirectTargetServerFnIndexRoute: typeof RedirectTargetServerFnIndexRoute\n}\n\nconst RedirectTargetRouteChildren: RedirectTargetRouteChildren = {\n  RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,\n  RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,\n  RedirectTargetIndexRoute: RedirectTargetIndexRoute,\n  RedirectTargetServerFnViaBeforeLoadRoute:\n    RedirectTargetServerFnViaBeforeLoadRoute,\n  RedirectTargetServerFnViaLoaderRoute: RedirectTargetServerFnViaLoaderRoute,\n  RedirectTargetServerFnViaUseServerFnRoute:\n    RedirectTargetServerFnViaUseServerFnRoute,\n  RedirectTargetServerFnIndexRoute: RedirectTargetServerFnIndexRoute,\n}\n\nconst RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(\n  RedirectTargetRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  NotFoundRouteRoute: NotFoundRouteRouteWithChildren,\n  SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,\n  SpecialCharsRouteRoute: SpecialCharsRouteRouteWithChildren,\n  LayoutRoute: LayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  InlineScriptsRoute: InlineScriptsRoute,\n  LinksRoute: LinksRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RawStreamRoute: RawStreamRouteWithChildren,\n  ScriptsRoute: ScriptsRoute,\n  StreamRoute: StreamRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  MultiCookieRedirectTargetRoute: MultiCookieRedirectTargetRoute,\n  RedirectTargetRoute: RedirectTargetRouteWithChildren,\n  MultiCookieRedirectIndexRoute: MultiCookieRedirectIndexRoute,\n  RedirectIndexRoute: RedirectIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  TransitionCountCreateResourceRoute: TransitionCountCreateResourceRoute,\n  TransitionTypingCreateResourceRoute: TransitionTypingCreateResourceRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\n\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n    styles: [\n      {\n        media: 'all and (min-width: 500px)',\n        children: `\n        .inline-div {\n          color: white;\n          background-color: gray;\n          max-width: 250px;\n        }`,\n      },\n    ],\n  }),\n  errorComponent: (props) => <p>{props.error.stack}</p>,\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/layout-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/scripts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Scripts\n          </Link>{' '}\n          <Link\n            to=\"/inline-scripts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Inline Scripts\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            to=\"/redirect\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            redirect\n          </Link>{' '}\n          <Link\n            to=\"/raw-stream\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Raw Stream\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <Outlet />\n        <div class=\"inline-div\">This is an inline styled div</div>\n        <TanStackRouterDevtoolsInProd />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '~/utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(`${queryURL}/users/${params.userId}`)\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n          const user = (await res.json()) as User\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createMiddleware } from '@tanstack/solid-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: /users')\n    const result = await next()\n    result.response.headers.set('x-users', 'true')\n    console.info('Out: /users')\n    return result\n  },\n)\n\nconst testParentMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: testParentMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test-parent', 'true')\n    console.info('Out: testParentMiddleware')\n    return result\n  },\n)\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next, request }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware, testParentMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await fetch(`${queryURL}/users`)\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n        const data = (await res.json()) as Array<User>\n        const list = data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { Suspense, createSignal } from 'solid-js'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(({ data }) => {\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(async ({ data }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: { name: 'Tanner Linsley' } }),\n      person: await personServerFn({ data: { name: 'John Doe' } }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n  // const { deferredStuff, deferredPerson, person } = Route.useLoaderData()\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {loaderData().person.name} - {loaderData().person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={loaderData().deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={loaderData().deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount((count) => count + 1)}>\n          Increment\n        </button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { CustomMessage } from '~/components/CustomMessage'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <CustomMessage message=\"Hello from a custom component!\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/inline-scripts.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/inline-scripts')({\n  head: () => ({\n    scripts: [\n      {\n        children:\n          'window.INLINE_SCRIPT_1 = true; console.log(\"Inline script 1 executed\");',\n      },\n      {\n        children:\n          'window.INLINE_SCRIPT_2 = \"test\"; console.log(\"Inline script 2 executed\");',\n        type: 'text/javascript',\n      },\n    ],\n  }),\n  component: InlineScriptsComponent,\n})\n\nfunction InlineScriptsComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3 data-testid=\"inline-scripts-test-heading\">Inline Scripts Test</h3>\n      <p>\n        This route tests inline script duplication prevention. Two inline\n        scripts should be loaded.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/links.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/links')({\n  component: () => {\n    const navigate = Route.useNavigate()\n    return (\n      <div>\n        <h1 class=\"mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl \">\n          link test\n        </h1>\n        <div class=\"mb-2\">\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Link to /posts\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            to=\"/posts\"\n            reloadDocument={true}\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Link to /posts (reloadDocument=true)\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <button onClick={() => navigate({ to: '/posts' })}>\n            navigate to /posts\n          </button>\n        </div>\n        <div class=\"mb-2\">\n          <button\n            onClick={() => navigate({ to: '/posts', reloadDocument: true })}\n          >\n            navigate to /posts (reloadDocument=true)\n          </button>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/multi-cookie-redirect/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { setCookie } from '@tanstack/solid-start/server'\n\nconst setMultipleCookiesAndRedirect = createServerFn().handler(() => {\n  // Set multiple cookies before redirecting\n  // This tests that multiple Set-Cookie headers are preserved during redirect\n  setCookie('session', 'session-value', { path: '/' })\n  setCookie('csrf', 'csrf-token-value', { path: '/' })\n  setCookie('theme', 'dark', { path: '/' })\n\n  throw redirect({ to: '/multi-cookie-redirect/target' })\n})\n\nexport const Route = createFileRoute('/multi-cookie-redirect/')({\n  loader: () => setMultipleCookiesAndRedirect(),\n  component: () => null,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/multi-cookie-redirect/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport Cookies from 'js-cookie'\nimport * as Solid from 'solid-js'\n\nexport const Route = createFileRoute('/multi-cookie-redirect/target')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [cookies, setCookies] = Solid.createSignal<Record<string, string>>({})\n\n  Solid.onMount(() => {\n    setCookies({\n      session: Cookies.get('session') || '',\n      csrf: Cookies.get('csrf') || '',\n      theme: Cookies.get('theme') || '',\n    })\n  })\n\n  return (\n    <div>\n      <h1 data-testid=\"multi-cookie-redirect-target\">\n        Multi Cookie Redirect Target\n      </h1>\n      <div>\n        <p>\n          Session cookie:{' '}\n          <span data-testid=\"cookie-session\">{cookies().session}</span>\n        </p>\n        <p>\n          CSRF cookie: <span data-testid=\"cookie-csrf\">{cookies().csrf}</span>\n        </p>\n        <p>\n          Theme cookie:{' '}\n          <span data-testid=\"cookie-theme\">{cookies().theme}</span>\n        </p>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/not-found/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/not-found/')({\n  component: () => {\n    const preload = Route.useSearch({ select: (s) => s.preload })\n    return (\n      <div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            preload={preload()}\n            data-testid=\"via-beforeLoad\"\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            preload={preload()}\n            data-testid=\"via-loader\"\n          >\n            via-loader\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/not-found/parent-boundary/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/not-found/parent-boundary')({\n  loader: () => ({\n    parentLoaderData: 'ready',\n  }),\n  component: RouteComponent,\n  notFoundComponent: ParentBoundaryNotFoundComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <Outlet />\n    </div>\n  )\n}\n\nfunction ParentBoundaryNotFoundComponent() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div data-testid=\"parent-boundary-notFound-component\">\n      <div data-testid=\"parent-loader-data\">\n        {loaderData().parentLoaderData}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/not-found/parent-boundary/via-beforeLoad.tsx",
    "content": "import { createFileRoute, notFound } from '@tanstack/solid-router'\nimport { Route as ParentBoundaryRoute } from './route'\n\nexport const Route = createFileRoute(\n  '/not-found/parent-boundary/via-beforeLoad',\n)({\n  beforeLoad: () => {\n    throw notFound({ routeId: ParentBoundaryRoute.id })\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"parent-boundary-child-route-component\">\n      Hello \"/not-found/parent-boundary/via-beforeLoad\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/not-found/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/not-found')({\n  validateSearch: z.object({\n    preload: z.literal(false).optional(),\n  }),\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/not-found/via-beforeLoad-target-root.tsx",
    "content": "import { createFileRoute, notFound, rootRouteId } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/not-found/via-beforeLoad-target-root')({\n  beforeLoad: () => {\n    throw notFound({ routeId: rootRouteId })\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-beforeLoad-target-root-route-component\">\n      Hello \"/not-found/via-beforeLoad-target-root\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/not-found/via-beforeLoad.tsx",
    "content": "import { notFound, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/not-found/via-beforeLoad')({\n  beforeLoad: () => {\n    throw notFound()\n  },\n  component: RouteComponent,\n  notFoundComponent: () => {\n    return (\n      <div data-testid=\"via-beforeLoad-notFound-component\">\n        Not Found \"/not-found/via-beforeLoad\"!\n      </div>\n    )\n  },\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-beforeLoad-route-component\">\n      Hello \"/not-found/via-beforeLoad\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/not-found/via-loader.tsx",
    "content": "import { notFound, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/not-found/via-loader')({\n  loader: () => {\n    throw notFound()\n  },\n  component: RouteComponent,\n  notFoundComponent: () => {\n    return (\n      <div data-testid=\"via-loader-notFound-component\">\n        Not Found \"/not-found/via-loader\"!\n      </div>\n    )\n  },\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-loader-route-component\" data-server={typeof window}>\n      Hello \"/not-found/via-loader\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nimport { fetchPost } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostErrorComponent'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post().id,\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { For } from 'solid-js'\n\nimport { fetchPosts } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        <For each={posts()}>\n          {(post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          }}\n        </For>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { PostErrorComponent } from '~/components/PostErrorComponent'\n\nimport { fetchPost } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/raw-stream/client-call.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createSignal } from 'solid-js'\nimport {\n  TEST10_EXPECTED,\n  TEST11_EXPECTED,\n  TEST12_STREAM_A_EXPECTED,\n  TEST12_STREAM_B_EXPECTED,\n  TEST13_EXPECTED,\n  TEST14_STREAM_A_EXPECTED,\n  TEST14_STREAM_B_EXPECTED,\n  TEST14_STREAM_C_EXPECTED,\n  TEST7_EXPECTED,\n  TEST8_EXPECTED,\n  TEST9_EXPECTED,\n  binaryHintBinaryFn,\n  binaryHintTextFn,\n  burstPauseBurstFn,\n  collectBytes,\n  compareBytes,\n  consumeBinaryStream,\n  createStreamConsumer,\n  emptyStreamFn,\n  errorStreamFn,\n  interleavedStreamsFn,\n  jsonEndsFirstFn,\n  largeBinaryFn,\n  mixedStreamingFn,\n  multipleRawStreamsFn,\n  rawEndsFirstFn,\n  singleRawStreamFn,\n  textHintMixedFn,\n  textHintPureBinaryFn,\n  textHintPureTextFn,\n  threeStreamsFn,\n} from '../../raw-stream-fns'\n\nfunction ClientCallTests() {\n  const [results, setResults] = createSignal<Record<string, any>>({})\n  const [loading, setLoading] = createSignal<Record<string, boolean>>({})\n\n  const consumeStream = createStreamConsumer()\n\n  const runTest = async (\n    testName: string,\n    fn: () => Promise<any>,\n    processor: (result: any) => Promise<any>,\n  ) => {\n    setLoading((prev) => ({ ...prev, [testName]: true }))\n    try {\n      const result = await fn()\n      const processed = await processor(result)\n      setResults((prev) => ({ ...prev, [testName]: processed }))\n    } catch (error) {\n      setResults((prev) => ({\n        ...prev,\n        [testName]: { error: String(error) },\n      }))\n    } finally {\n      setLoading((prev) => ({ ...prev, [testName]: false }))\n    }\n  }\n\n  return (\n    <div class=\"space-y-4\">\n      <h2>Client-Side Server Function Calls (RPC)</h2>\n      <p class=\"text-gray-600\">\n        These tests invoke server functions directly from the client, using the\n        binary framing protocol for RawStream data.\n      </p>\n\n      {/* Test 1: Single Raw Stream */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test1-title\">Test 1: Single Raw Stream</h3>\n        <button\n          data-testid=\"test1-btn\"\n          onClick={() =>\n            runTest('test1', singleRawStreamFn, async (result) => ({\n              message: result.message,\n              streamContent: await consumeStream(result.data),\n            }))\n          }\n          disabled={loading().test1}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test1 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test1-result\">{JSON.stringify(results().test1)}</pre>\n      </div>\n\n      {/* Test 2: Multiple Raw Streams */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test2-title\">Test 2: Multiple Raw Streams</h3>\n        <button\n          data-testid=\"test2-btn\"\n          onClick={() =>\n            runTest('test2', multipleRawStreamsFn, async (result) => ({\n              message: result.message,\n              firstContent: await consumeStream(result.first),\n              secondContent: await consumeStream(result.second),\n            }))\n          }\n          disabled={loading().test2}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test2 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test2-result\">{JSON.stringify(results().test2)}</pre>\n      </div>\n\n      {/* Test 3: JSON Ends First */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test3-title\">Test 3: JSON Ends Before Raw Stream</h3>\n        <button\n          data-testid=\"test3-btn\"\n          onClick={() =>\n            runTest('test3', jsonEndsFirstFn, async (result) => ({\n              message: result.message,\n              hasTimestamp: typeof result.timestamp === 'number',\n              slowContent: await consumeStream(result.slowData),\n            }))\n          }\n          disabled={loading().test3}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test3 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test3-result\">{JSON.stringify(results().test3)}</pre>\n      </div>\n\n      {/* Test 4: Raw Ends First */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test4-title\">Test 4: Raw Stream Ends Before JSON</h3>\n        <button\n          data-testid=\"test4-btn\"\n          onClick={() =>\n            runTest('test4', rawEndsFirstFn, async (result) => ({\n              message: result.message,\n              deferredData: await result.deferredData,\n              fastContent: await consumeStream(result.fastData),\n            }))\n          }\n          disabled={loading().test4}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test4 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test4-result\">{JSON.stringify(results().test4)}</pre>\n      </div>\n\n      {/* Test 5: Large Binary */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test5-title\">Test 5: Large Binary Data</h3>\n        <button\n          data-testid=\"test5-btn\"\n          onClick={() =>\n            runTest('test5', largeBinaryFn, async (result) => {\n              const totalBytes = await consumeBinaryStream(result.binary)\n              return {\n                message: result.message,\n                expectedSize: result.size,\n                actualSize: totalBytes,\n                sizeMatch: totalBytes === result.size,\n              }\n            })\n          }\n          disabled={loading().test5}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test5 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test5-result\">{JSON.stringify(results().test5)}</pre>\n      </div>\n\n      {/* Test 6: Mixed Streaming */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test6-title\">Test 6: Mixed Streaming</h3>\n        <button\n          data-testid=\"test6-btn\"\n          onClick={() =>\n            runTest('test6', mixedStreamingFn, async (result) => ({\n              immediate: result.immediate,\n              deferred: await result.deferred,\n              rawContent: await consumeStream(result.raw),\n            }))\n          }\n          disabled={loading().test6}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test6 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test6-result\">{JSON.stringify(results().test6)}</pre>\n      </div>\n\n      {/* Hint Tests Section */}\n      <h2 class=\"mt-8\">Hint Parameter Tests (RPC)</h2>\n      <p class=\"text-gray-600\">\n        These tests verify that hint parameter works correctly for RPC calls.\n        Note: RPC always uses binary framing regardless of hint.\n      </p>\n\n      {/* Test 7: Text Hint with Pure Text */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test7-title\">Test 7: Text Hint - Pure Text</h3>\n        <button\n          data-testid=\"test7-btn\"\n          onClick={() =>\n            runTest('test7', textHintPureTextFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST7_EXPECTED)\n              const decoder = new TextDecoder()\n              return {\n                message: result.message,\n                asText: decoder.decode(bytes),\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading().test7}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test7 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test7-result\">{JSON.stringify(results().test7)}</pre>\n      </div>\n\n      {/* Test 8: Text Hint with Pure Binary */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test8-title\">Test 8: Text Hint - Pure Binary</h3>\n        <button\n          data-testid=\"test8-btn\"\n          onClick={() =>\n            runTest('test8', textHintPureBinaryFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST8_EXPECTED)\n              return {\n                message: result.message,\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading().test8}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test8 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test8-result\">{JSON.stringify(results().test8)}</pre>\n      </div>\n\n      {/* Test 9: Text Hint with Mixed Content */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test9-title\">Test 9: Text Hint - Mixed Content</h3>\n        <button\n          data-testid=\"test9-btn\"\n          onClick={() =>\n            runTest('test9', textHintMixedFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST9_EXPECTED)\n              return {\n                message: result.message,\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading().test9}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test9 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test9-result\">{JSON.stringify(results().test9)}</pre>\n      </div>\n\n      {/* Test 10: Binary Hint with Text Data */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test10-title\">Test 10: Binary Hint - Text Data</h3>\n        <button\n          data-testid=\"test10-btn\"\n          onClick={() =>\n            runTest('test10', binaryHintTextFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST10_EXPECTED)\n              const decoder = new TextDecoder()\n              return {\n                message: result.message,\n                asText: decoder.decode(bytes),\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading().test10}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test10 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test10-result\">\n          {JSON.stringify(results().test10)}\n        </pre>\n      </div>\n\n      {/* Test 11: Binary Hint with Binary Data */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test11-title\">Test 11: Binary Hint - Binary Data</h3>\n        <button\n          data-testid=\"test11-btn\"\n          onClick={() =>\n            runTest('test11', binaryHintBinaryFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST11_EXPECTED)\n              return {\n                message: result.message,\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading().test11}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test11 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test11-result\">\n          {JSON.stringify(results().test11)}\n        </pre>\n      </div>\n\n      {/* Multiplexing Tests Section */}\n      <h2 class=\"mt-8\">Multiplexing Tests (RPC)</h2>\n      <p class=\"text-gray-600\">\n        These tests verify correct interleaving of multiple concurrent streams.\n      </p>\n\n      {/* Test 12: Interleaved Streams */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test12-title\">Test 12: Interleaved Streams</h3>\n        <button\n          data-testid=\"test12-btn\"\n          onClick={() =>\n            runTest('test12', interleavedStreamsFn, async (result) => {\n              const [bytesA, bytesB] = await Promise.all([\n                collectBytes(result.streamA),\n                collectBytes(result.streamB),\n              ])\n              const comparisonA = compareBytes(bytesA, TEST12_STREAM_A_EXPECTED)\n              const comparisonB = compareBytes(bytesB, TEST12_STREAM_B_EXPECTED)\n              return {\n                message: result.message,\n                streamA: comparisonA,\n                streamB: comparisonB,\n              }\n            })\n          }\n          disabled={loading().test12}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test12 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test12-result\">\n          {JSON.stringify(results().test12)}\n        </pre>\n      </div>\n\n      {/* Test 13: Burst-Pause-Burst */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test13-title\">Test 13: Burst-Pause-Burst</h3>\n        <button\n          data-testid=\"test13-btn\"\n          onClick={() =>\n            runTest('test13', burstPauseBurstFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              const comparison = compareBytes(bytes, TEST13_EXPECTED)\n              return {\n                message: result.message,\n                ...comparison,\n              }\n            })\n          }\n          disabled={loading().test13}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test13 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test13-result\">\n          {JSON.stringify(results().test13)}\n        </pre>\n      </div>\n\n      {/* Test 14: Three Concurrent Streams */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test14-title\">Test 14: Three Concurrent Streams</h3>\n        <button\n          data-testid=\"test14-btn\"\n          onClick={() =>\n            runTest('test14', threeStreamsFn, async (result) => {\n              const [bytesA, bytesB, bytesC] = await Promise.all([\n                collectBytes(result.fast),\n                collectBytes(result.slow),\n                collectBytes(result.burst),\n              ])\n              const comparisonA = compareBytes(bytesA, TEST14_STREAM_A_EXPECTED)\n              const comparisonB = compareBytes(bytesB, TEST14_STREAM_B_EXPECTED)\n              const comparisonC = compareBytes(bytesC, TEST14_STREAM_C_EXPECTED)\n              return {\n                message: result.message,\n                fast: comparisonA,\n                slow: comparisonB,\n                burst: comparisonC,\n              }\n            })\n          }\n          disabled={loading().test14}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test14 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test14-result\">\n          {JSON.stringify(results().test14)}\n        </pre>\n      </div>\n\n      {/* Edge Case Tests Section */}\n      <h2 class=\"mt-8\">Edge Case Tests (RPC)</h2>\n      <p class=\"text-gray-600\">\n        These tests verify edge cases like empty streams and error handling.\n      </p>\n\n      {/* Test 15: Empty Stream */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test15-title\">Test 15: Empty Stream</h3>\n        <button\n          data-testid=\"test15-btn\"\n          onClick={() =>\n            runTest('test15', emptyStreamFn, async (result) => {\n              const bytes = await collectBytes(result.data)\n              return {\n                message: result.message,\n                byteCount: bytes.length,\n                isEmpty: bytes.length === 0,\n              }\n            })\n          }\n          disabled={loading().test15}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test15 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test15-result\">\n          {JSON.stringify(results().test15)}\n        </pre>\n      </div>\n\n      {/* Test 16: Stream Error */}\n      <div class=\"border p-4 rounded\">\n        <h3 data-testid=\"test16-title\">Test 16: Stream Error</h3>\n        <button\n          data-testid=\"test16-btn\"\n          onClick={() =>\n            runTest('test16', errorStreamFn, async (result) => {\n              try {\n                // Try to consume the stream - should error\n                const content = await consumeStream(result.data)\n                return {\n                  message: result.message,\n                  streamContent: content,\n                  errorCaught: false,\n                }\n              } catch (err) {\n                return {\n                  message: result.message,\n                  errorCaught: true,\n                  errorMessage: String(err),\n                }\n              }\n            })\n          }\n          disabled={loading().test16}\n          class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n        >\n          {loading().test16 ? 'Loading...' : 'Run Test'}\n        </button>\n        <pre data-testid=\"test16-result\">\n          {JSON.stringify(results().test16)}\n        </pre>\n      </div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/raw-stream/client-call')({\n  component: ClientCallTests,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/raw-stream/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/raw-stream/')({\n  component: RawStreamIndex,\n})\n\nfunction RawStreamIndex() {\n  return (\n    <div>\n      <p>Select a test category above to begin testing.</p>\n      <ul class=\"list-disc pl-6 mt-4 space-y-2\">\n        <li>\n          <Link to=\"/raw-stream/client-call\" class=\"text-blue-500 underline\">\n            Client Calls\n          </Link>\n          <span> - Test RawStream via direct server function calls (RPC)</span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-single\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Single\n          </Link>\n          <span> - Test single RawStream from route loader (SSR)</span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-multiple\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Multiple\n          </Link>\n          <span> - Test multiple RawStreams from route loader (SSR)</span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-mixed\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Mixed\n          </Link>\n          <span>\n            {' '}\n            - Test RawStream mixed with deferred data from loader (SSR)\n          </span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-text-hint\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Text Hint\n          </Link>\n          <span> - Test RawStream with hint: 'text' from loader (SSR)</span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-binary-hint\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Binary Hint\n          </Link>\n          <span> - Test RawStream with hint: 'binary' from loader (SSR)</span>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/raw-stream/ssr-binary-hint.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { RawStream } from '@tanstack/solid-start'\nimport { createEffect, createSignal } from 'solid-js'\nimport {\n  collectBytes,\n  compareBytes,\n  concatBytes,\n  createDelayedStream,\n  encode,\n} from '../../raw-stream-fns'\n\n// Expected data - defined at module level for client-side verification\nconst TEXT_CHUNKS = [encode('Binary '), encode('hint '), encode('with text')]\nconst TEXT_EXPECTED = concatBytes(TEXT_CHUNKS)\n\nconst BINARY_CHUNKS = [\n  new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n  new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]),\n]\nconst BINARY_EXPECTED = concatBytes(BINARY_CHUNKS)\n\ntype TextMatch = {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n  asText: string\n}\n\ntype BinaryMatch = {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n}\n\nfunction SSRBinaryHintTest() {\n  const loaderData = Route.useLoaderData()\n  const [textMatch, setTextMatch] = createSignal<TextMatch | null>(null)\n  const [binaryMatch, setBinaryMatch] = createSignal<BinaryMatch | null>(null)\n  const [isLoading, setIsLoading] = createSignal(true)\n  const [error, setError] = createSignal<string | null>(null)\n\n  createEffect(() => {\n    const { textData, binaryData } = loaderData()\n    if (!textData || !binaryData) {\n      return\n    }\n    setIsLoading(true)\n    setError(null)\n    Promise.all([collectBytes(textData), collectBytes(binaryData)])\n      .then(([textBytes, binaryBytes]) => {\n        const textComp = compareBytes(textBytes, TEXT_EXPECTED)\n        const decoder = new TextDecoder()\n        setTextMatch({\n          ...textComp,\n          actualLength: textBytes.length,\n          expectedLength: TEXT_EXPECTED.length,\n          asText: decoder.decode(textBytes),\n        })\n        const binaryComp = compareBytes(binaryBytes, BINARY_EXPECTED)\n        setBinaryMatch({\n          ...binaryComp,\n          actualLength: binaryBytes.length,\n          expectedLength: BINARY_EXPECTED.length,\n        })\n        setIsLoading(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsLoading(false)\n      })\n  })\n\n  return (\n    <div class=\"space-y-4\">\n      <h2>SSR Binary Hint Test</h2>\n      <p class=\"text-gray-600\">\n        This route tests RawStream with hint: 'binary' from loader. Binary hint\n        always uses base64 encoding (default behavior).\n      </p>\n\n      <div class=\"border p-4 rounded\">\n        <div data-testid=\"ssr-binary-hint-message\">\n          Message: {loaderData().message}\n        </div>\n        <div data-testid=\"ssr-binary-hint-text\">\n          Text Data:\n          {error()\n            ? `Error: ${error()}`\n            : isLoading()\n              ? 'Loading...'\n              : textMatch()?.asText}\n        </div>\n        <div data-testid=\"ssr-binary-hint-text-match\">\n          Text Bytes Match:\n          {isLoading() ? 'Loading...' : textMatch()?.match ? 'true' : 'false'}\n        </div>\n        <div data-testid=\"ssr-binary-hint-binary-match\">\n          Binary Bytes Match:\n          {isLoading() ? 'Loading...' : binaryMatch()?.match ? 'true' : 'false'}\n        </div>\n        <pre data-testid=\"ssr-binary-hint-result\">\n          {JSON.stringify({\n            message: loaderData().message,\n            textMatch: textMatch(),\n            binaryMatch: binaryMatch(),\n            isLoading: isLoading(),\n            error: error(),\n          })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/raw-stream/ssr-binary-hint')({\n  loader: async () => {\n    // Text data with binary hint - should still use base64 (default behavior)\n    const textStream = createDelayedStream(\n      [encode('Binary '), encode('hint '), encode('with text')],\n      30,\n    )\n\n    // Pure binary stream with binary hint\n    const binaryStream = createDelayedStream(\n      [\n        new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n        new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]),\n      ],\n      30,\n    )\n\n    return {\n      message: 'SSR Binary Hint Test',\n      textData: new RawStream(textStream, { hint: 'binary' }),\n      binaryData: new RawStream(binaryStream, { hint: 'binary' }),\n    }\n  },\n  component: SSRBinaryHintTest,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/raw-stream/ssr-mixed.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { RawStream } from '@tanstack/solid-start'\nimport { Suspense, createEffect, createSignal } from 'solid-js'\nimport {\n  createDelayedStream,\n  createStreamConsumer,\n  encode,\n} from '../../raw-stream-fns'\n\nfunction SSRMixedTest() {\n  const loaderData = Route.useLoaderData()\n  const [streamContent, setStreamContent] = createSignal('')\n  const [isConsuming, setIsConsuming] = createSignal(true)\n  const [error, setError] = createSignal<string | null>(null)\n\n  createEffect(() => {\n    const rawData = loaderData().rawData\n    if (!rawData) {\n      return\n    }\n    const consumeStream = createStreamConsumer()\n    setIsConsuming(true)\n    setError(null)\n    consumeStream(rawData)\n      .then((content) => {\n        setStreamContent(content)\n        setIsConsuming(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsConsuming(false)\n      })\n  })\n\n  return (\n    <div class=\"space-y-4\">\n      <h2>SSR Mixed Streaming Test</h2>\n      <p class=\"text-gray-600\">\n        This route returns a mix of immediate data, deferred promises, and\n        RawStream from its loader.\n      </p>\n\n      <div class=\"border p-4 rounded\">\n        <div data-testid=\"ssr-mixed-immediate\">\n          Immediate: {loaderData().immediate}\n        </div>\n        <div data-testid=\"ssr-mixed-deferred\">\n          Deferred:\n          <Suspense fallback={<span>Loading deferred...</span>}>\n            <Await\n              promise={loaderData().deferred}\n              children={(value: string) => <span>{value}</span>}\n            />\n          </Suspense>\n        </div>\n        <div data-testid=\"ssr-mixed-stream\">\n          Stream Content:\n          {error()\n            ? `Error: ${error()}`\n            : isConsuming()\n              ? 'Loading...'\n              : streamContent()}\n        </div>\n        <pre data-testid=\"ssr-mixed-result\">\n          {JSON.stringify({\n            immediate: loaderData().immediate,\n            streamContent: streamContent(),\n            isConsuming: isConsuming(),\n            error: error(),\n          })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/raw-stream/ssr-mixed')({\n  loader: () => {\n    const rawStream = createDelayedStream(\n      [encode('mixed-ssr-1'), encode('mixed-ssr-2')],\n      50,\n    )\n\n    // Deferred promise that resolves after a delay\n    const deferredData = new Promise<string>((resolve) =>\n      setTimeout(() => resolve('deferred-ssr-value'), 100),\n    )\n\n    return {\n      immediate: 'immediate-ssr-value',\n      deferred: deferredData,\n      rawData: new RawStream(rawStream),\n    }\n  },\n  component: SSRMixedTest,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/raw-stream/ssr-multiple.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { RawStream } from '@tanstack/solid-start'\nimport { createEffect, createSignal } from 'solid-js'\nimport {\n  createDelayedStream,\n  createStreamConsumer,\n  encode,\n} from '../../raw-stream-fns'\n\nfunction SSRMultipleTest() {\n  const loaderData = Route.useLoaderData()\n  const [firstContent, setFirstContent] = createSignal('')\n  const [secondContent, setSecondContent] = createSignal('')\n  const [isConsuming, setIsConsuming] = createSignal(true)\n  const [error, setError] = createSignal<string | null>(null)\n\n  createEffect(() => {\n    const first = loaderData().first\n    const second = loaderData().second\n    if (!first || !second) {\n      return\n    }\n    const consumeStream = createStreamConsumer()\n    setIsConsuming(true)\n    setError(null)\n    Promise.all([consumeStream(first), consumeStream(second)])\n      .then(([content1, content2]) => {\n        setFirstContent(content1)\n        setSecondContent(content2)\n        setIsConsuming(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsConsuming(false)\n      })\n  })\n\n  return (\n    <div class=\"space-y-4\">\n      <h2>SSR Multiple RawStreams Test</h2>\n      <p class=\"text-gray-600\">\n        This route returns multiple RawStreams from its loader. Each stream is\n        independently serialized during SSR.\n      </p>\n\n      <div class=\"border p-4 rounded\">\n        <div data-testid=\"ssr-multiple-message\">\n          Message: {loaderData().message}\n        </div>\n        <div data-testid=\"ssr-multiple-first\">\n          First Stream:\n          {error()\n            ? `Error: ${error()}`\n            : isConsuming()\n              ? 'Loading...'\n              : firstContent()}\n        </div>\n        <div data-testid=\"ssr-multiple-second\">\n          Second Stream:\n          {error()\n            ? `Error: ${error()}`\n            : isConsuming()\n              ? 'Loading...'\n              : secondContent()}\n        </div>\n        <pre data-testid=\"ssr-multiple-result\">\n          {JSON.stringify({\n            message: loaderData().message,\n            firstContent: firstContent(),\n            secondContent: secondContent(),\n            isConsuming: isConsuming(),\n            error: error(),\n          })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/raw-stream/ssr-multiple')({\n  loader: async () => {\n    const stream1 = createDelayedStream(\n      [encode('multi-1a'), encode('multi-1b')],\n      30,\n    )\n    const stream2 = createDelayedStream(\n      [encode('multi-2a'), encode('multi-2b')],\n      50,\n    )\n    return {\n      message: 'SSR Multiple Streams Test',\n      first: new RawStream(stream1),\n      second: new RawStream(stream2),\n    }\n  },\n  component: SSRMultipleTest,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/raw-stream/ssr-single.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { RawStream } from '@tanstack/solid-start'\nimport { createEffect, createSignal } from 'solid-js'\nimport {\n  createDelayedStream,\n  createStreamConsumer,\n  encode,\n} from '../../raw-stream-fns'\n\nfunction SSRSingleTest() {\n  const loaderData = Route.useLoaderData()\n  const [streamContent, setStreamContent] = createSignal('')\n  const [isConsuming, setIsConsuming] = createSignal(true)\n  const [error, setError] = createSignal<string | null>(null)\n\n  createEffect(() => {\n    const rawData = loaderData().rawData\n    if (!rawData) {\n      return\n    }\n    const consumeStream = createStreamConsumer()\n    setIsConsuming(true)\n    setError(null)\n    consumeStream(rawData)\n      .then((content) => {\n        setStreamContent(content)\n        setIsConsuming(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsConsuming(false)\n      })\n  })\n\n  return (\n    <div class=\"space-y-4\">\n      <h2>SSR Single RawStream Test</h2>\n      <p class=\"text-gray-600\">\n        This route returns a single RawStream from its loader. The stream is\n        serialized during SSR using base64 encoding.\n      </p>\n\n      <div class=\"border p-4 rounded\">\n        <div data-testid=\"ssr-single-message\">\n          Message: {loaderData().message}\n        </div>\n        <div data-testid=\"ssr-single-timestamp\">\n          Has Timestamp:{' '}\n          {typeof loaderData().timestamp === 'number' ? 'true' : 'false'}\n        </div>\n        <div data-testid=\"ssr-single-stream\">\n          Stream Content:\n          {error()\n            ? `Error: ${error()}`\n            : isConsuming()\n              ? 'Loading...'\n              : streamContent()}\n        </div>\n        <div data-testid=\"ssr-single-rawdata-type\">\n          RawData Type: {typeof loaderData().rawData} | hasStream:\n          {loaderData().rawData && 'getReader' in loaderData().rawData\n            ? 'true'\n            : 'false'}\n        </div>\n        <pre data-testid=\"ssr-single-result\">\n          {JSON.stringify({\n            message: loaderData().message,\n            streamContent: streamContent(),\n            isConsuming: isConsuming(),\n            error: error(),\n          })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/raw-stream/ssr-single')({\n  loader: async () => {\n    const stream = createDelayedStream(\n      [encode('ssr-chunk1'), encode('ssr-chunk2'), encode('ssr-chunk3')],\n      50,\n    )\n    return {\n      message: 'SSR Single Stream Test',\n      timestamp: Date.now(),\n      rawData: new RawStream(stream),\n    }\n  },\n  component: SSRSingleTest,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/raw-stream/ssr-text-hint.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { RawStream } from '@tanstack/solid-start'\nimport { createEffect, createSignal } from 'solid-js'\nimport {\n  collectBytes,\n  compareBytes,\n  concatBytes,\n  createDelayedStream,\n  encode,\n} from '../../raw-stream-fns'\n\n// Expected data - defined at module level for client-side verification\nconst PURE_TEXT_CHUNKS = [\n  encode('Hello '),\n  encode('World '),\n  encode('from SSR!'),\n]\nconst PURE_TEXT_EXPECTED = concatBytes(PURE_TEXT_CHUNKS)\n\nconst MIXED_CHUNKS = [\n  encode('Valid text'),\n  new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n  encode(' more text'),\n]\nconst MIXED_EXPECTED = concatBytes(MIXED_CHUNKS)\n\n// Pure binary data (invalid UTF-8) - must use base64 fallback\nconst PURE_BINARY_CHUNKS = [\n  new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n  new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n]\nconst PURE_BINARY_EXPECTED = concatBytes(PURE_BINARY_CHUNKS)\n\ntype TextMatch = {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n  asText: string\n}\n\ntype BinaryMatch = {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n}\n\nfunction SSRTextHintTest() {\n  const loaderData = Route.useLoaderData()\n  const [pureTextMatch, setPureTextMatch] = createSignal<TextMatch | null>(null)\n  const [mixedMatch, setMixedMatch] = createSignal<BinaryMatch | null>(null)\n  const [pureBinaryMatch, setPureBinaryMatch] =\n    createSignal<BinaryMatch | null>(null)\n  const [isLoading, setIsLoading] = createSignal(true)\n  const [error, setError] = createSignal<string | null>(null)\n\n  createEffect(() => {\n    const { pureText, mixedContent, pureBinary } = loaderData()\n    if (!pureText || !mixedContent || !pureBinary) {\n      return\n    }\n    setIsLoading(true)\n    setError(null)\n    Promise.all([\n      collectBytes(pureText),\n      collectBytes(mixedContent),\n      collectBytes(pureBinary),\n    ])\n      .then(([pureBytes, mixedBytes, pureBinaryBytes]) => {\n        const pureComp = compareBytes(pureBytes, PURE_TEXT_EXPECTED)\n        const decoder = new TextDecoder()\n        setPureTextMatch({\n          ...pureComp,\n          actualLength: pureBytes.length,\n          expectedLength: PURE_TEXT_EXPECTED.length,\n          asText: decoder.decode(pureBytes),\n        })\n        const mixedComp = compareBytes(mixedBytes, MIXED_EXPECTED)\n        setMixedMatch({\n          ...mixedComp,\n          actualLength: mixedBytes.length,\n          expectedLength: MIXED_EXPECTED.length,\n        })\n        const pureBinaryComp = compareBytes(\n          pureBinaryBytes,\n          PURE_BINARY_EXPECTED,\n        )\n        setPureBinaryMatch({\n          ...pureBinaryComp,\n          actualLength: pureBinaryBytes.length,\n          expectedLength: PURE_BINARY_EXPECTED.length,\n        })\n        setIsLoading(false)\n      })\n      .catch((err) => {\n        setError(String(err))\n        setIsLoading(false)\n      })\n  })\n\n  return (\n    <div class=\"space-y-4\">\n      <h2>SSR Text Hint Test</h2>\n      <p class=\"text-gray-600\">\n        This route tests RawStream with hint: 'text' from loader. Text hint\n        optimizes for UTF-8 content but falls back to base64 for invalid UTF-8.\n      </p>\n\n      <div class=\"border p-4 rounded\">\n        <div data-testid=\"ssr-text-hint-message\">\n          Message: {loaderData().message}\n        </div>\n        <div data-testid=\"ssr-text-hint-pure-text\">\n          Pure Text:\n          {error()\n            ? `Error: ${error()}`\n            : isLoading()\n              ? 'Loading...'\n              : pureTextMatch()?.asText}\n        </div>\n        <div data-testid=\"ssr-text-hint-pure-match\">\n          Pure Text Bytes Match:\n          {isLoading()\n            ? 'Loading...'\n            : pureTextMatch()?.match\n              ? 'true'\n              : 'false'}\n        </div>\n        <div data-testid=\"ssr-text-hint-mixed-match\">\n          Mixed Content Bytes Match:\n          {isLoading() ? 'Loading...' : mixedMatch()?.match ? 'true' : 'false'}\n        </div>\n        <div data-testid=\"ssr-text-hint-pure-binary-match\">\n          Pure Binary Bytes Match:\n          {isLoading()\n            ? 'Loading...'\n            : pureBinaryMatch()?.match\n              ? 'true'\n              : 'false'}\n        </div>\n        <pre data-testid=\"ssr-text-hint-result\">\n          {JSON.stringify({\n            message: loaderData().message,\n            pureTextMatch: pureTextMatch(),\n            mixedMatch: mixedMatch(),\n            pureBinaryMatch: pureBinaryMatch(),\n            isLoading: isLoading(),\n            error: error(),\n          })}\n        </pre>\n      </div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/raw-stream/ssr-text-hint')({\n  loader: async () => {\n    // Pure text stream - should use UTF-8 encoding with text hint\n    const textStream = createDelayedStream(\n      [encode('Hello '), encode('World '), encode('from SSR!')],\n      30,\n    )\n\n    // Mixed content stream - text hint should use UTF-8 for valid text, base64 for binary\n    const mixedStream = createDelayedStream(\n      [\n        encode('Valid text'),\n        new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n        encode(' more text'),\n      ],\n      30,\n    )\n\n    // Pure binary stream - text hint must fallback to base64 for all chunks\n    const pureBinaryStream = createDelayedStream(\n      [\n        new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n        new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n      ],\n      30,\n    )\n\n    return {\n      message: 'SSR Text Hint Test',\n      pureText: new RawStream(textStream, { hint: 'text' }),\n      mixedContent: new RawStream(mixedStream, { hint: 'text' }),\n      pureBinary: new RawStream(pureBinaryStream, { hint: 'text' }),\n    }\n  },\n  component: SSRTextHintTest,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/raw-stream.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/raw-stream')({\n  component: RawStreamLayout,\n})\n\nfunction RawStreamLayout() {\n  return (\n    <div class=\"p-4 space-y-4\">\n      <h1>Raw Stream Tests</h1>\n\n      <nav class=\"space-x-4\">\n        <Link\n          to=\"/raw-stream/client-call\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n        >\n          Client Calls\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-single\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Single\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-multiple\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Multiple\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-mixed\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Mixed\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-text-hint\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Text Hint\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-binary-hint\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Binary Hint\n        </Link>\n        <Link to=\"/\" class=\"text-gray-500 underline\">\n          Back to Home\n        </Link>\n      </nav>\n\n      <hr />\n\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/$target/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/$target/')({\n  component: () => {\n    const preload = Route.useSearch({ select: (s) => s.preload })\n    return (\n      <div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload()}\n            data-testid=\"via-beforeLoad\"\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            search={{ reloadDocument: true }}\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload()}\n            data-testid=\"via-beforeLoad-reloadDocument\"\n          >\n            via-beforeLoad (reloadDocument=true)\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload()}\n            data-testid=\"via-loader\"\n          >\n            via-loader\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            search={{ reloadDocument: true }}\n            preload={preload()}\n            data-testid=\"via-loader-reloadDocument\"\n          >\n            via-loader (reloadDocument=true)\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./serverFn\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            serverFn\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/$target/serverFn/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/$target/serverFn/')({\n  component: () => (\n    <div>\n      <h1 class=\"mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl \">\n        redirect test with server functions (target {Route.useParams()().target}\n        )\n      </h1>\n      <div class=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-beforeLoad\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          data-testid=\"via-beforeLoad\"\n        >\n          via-beforeLoad\n        </Link>\n      </div>\n      <div class=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-beforeLoad\"\n          search={{ reloadDocument: true }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n          data-testid=\"via-beforeLoad-reloadDocument\"\n        >\n          via-beforeLoad (reloadDocument=true)\n        </Link>\n      </div>\n      <div class=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-loader\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          data-testid=\"via-loader\"\n        >\n          via-loader\n        </Link>\n      </div>\n      <div class=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-loader\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          search={{ reloadDocument: true }}\n          data-testid=\"via-loader-reloadDocument\"\n        >\n          via-loader (reloadDocument=true)\n        </Link>\n      </div>\n      <div class=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-useServerFn\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          data-testid=\"via-useServerFn\"\n        >\n          via-useServerFn\n        </Link>\n      </div>\n      <div class=\"mb-2\">\n        <Link\n          from={Route.fullPath}\n          to=\"./via-useServerFn\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          search={{ reloadDocument: true }}\n          data-testid=\"via-useServerFn-reloadDocument\"\n        >\n          via-useServerFn (reloadDocument=true)\n        </Link>\n      </div>\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { throwRedirect } from '~/components/throwRedirect'\n\nexport const Route = createFileRoute(\n  '/redirect/$target/serverFn/via-beforeLoad',\n)({\n  beforeLoad: ({\n    params: { target },\n    search: { reloadDocument, externalHost },\n  }) => throwRedirect({ data: { target, reloadDocument, externalHost } }),\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { throwRedirect } from '~/components/throwRedirect'\n\nexport const Route = createFileRoute('/redirect/$target/serverFn/via-loader')({\n  loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({\n    reloadDocument,\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { reloadDocument, externalHost } }) =>\n    throwRedirect({ data: { target, reloadDocument, externalHost } }),\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { RedirectOnClick } from '~/components/RedirectOnClick'\n\nexport const Route = createFileRoute(\n  '/redirect/$target/serverFn/via-useServerFn',\n)({\n  component: () => {\n    const params = Route.useParams()\n    const search = Route.useSearch()\n    return (\n      <RedirectOnClick\n        target={params().target}\n        reloadDocument={search().reloadDocument}\n        externalHost={search().externalHost}\n      />\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-beforeLoad')({\n  beforeLoad: ({\n    params: { target },\n    search: { reloadDocument, externalHost },\n  }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        throw redirect({ href: externalHost })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/$target/via-loader.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-loader')({\n  loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({\n    reloadDocument,\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { externalHost, reloadDocument } }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        throw redirect({ href: externalHost })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/$target.tsx",
    "content": "import { retainSearchParams, createFileRoute } from '@tanstack/solid-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/redirect/$target')({\n  params: {\n    parse: (p) =>\n      z\n        .object({\n          target: z.union([z.literal('internal'), z.literal('external')]),\n        })\n        .parse(p),\n  },\n  validateSearch: z.object({\n    reloadDocument: z.boolean().optional(),\n    preload: z.literal(false).optional(),\n    externalHost: z.string().optional(),\n  }),\n  search: {\n    middlewares: [retainSearchParams(['externalHost'])],\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/redirect/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/')({\n  component: () => (\n    <div>\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'internal' }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        internal\n      </Link>{' '}\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'external' }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        external\n      </Link>\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/scripts.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nconst isProd = import.meta.env.PROD\n\nexport const Route = createFileRoute('/scripts')({\n  head: () => ({\n    scripts: [\n      {\n        src: 'script.js',\n      },\n      isProd\n        ? undefined\n        : {\n            src: 'script2.js',\n          },\n    ],\n  }),\n  component: ScriptsComponent,\n})\n\nfunction ScriptsComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3 data-testid=\"scripts-test-heading\">Scripts Test</h3>\n      <p>\n        Both `script.js` and `script2.js` are included in development, but only\n        `script.js` is included in production.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/search-params/default.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/search-params/default')({\n  validateSearch: z.object({\n    default: z.string().default('d1'),\n  }),\n  beforeLoad: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  loader: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const context = Route.useRouteContext()\n    return (\n      <>\n        <div data-testid=\"search-default\">{search().default}</div>\n        <div data-testid=\"context-hello\">{context().hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/search-params/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/search-params/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <Link\n        data-testid=\"link-to-default-without-search\"\n        to=\"/search-params/default\"\n      >\n        go to /search-params/default\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search\"\n        to=\"/search-params/default\"\n        search={{ default: 'd2' }}\n      >\n        go to /search-params/default?default=d2\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/search-params/loader-throws-redirect.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/search-params/loader-throws-redirect')({\n  validateSearch: z.object({\n    step: z.enum(['a', 'b', 'c']).optional(),\n  }),\n  loaderDeps: ({ search: { step } }) => ({ step }),\n  loader: ({ deps: { step } }) => {\n    if (step === undefined) {\n      throw redirect({\n        to: '/search-params/loader-throws-redirect',\n        search: { step: 'a' },\n      })\n    }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    return (\n      <div>\n        <h1>SearchParams</h1>\n        <div data-testid=\"search-param\">{search().step}</div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/search-params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/search-params')({\n  beforeLoad: async () => {\n    await new Promise((resolve) => setTimeout(resolve, 1000))\n    return { hello: 'world' as string }\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/specialChars/$param.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/specialChars/$param')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      Hello \"/specialChars/$param\":{' '}\n      <span data-testid={'special-param'}>{params().param}</span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/specialChars/hash.tsx",
    "content": "import { createFileRoute, useLocation } from '@tanstack/solid-router'\nimport { createSignal } from 'solid-js'\n\nexport const Route = createFileRoute('/specialChars/hash')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const location = useLocation()\n  const [toggleHashValue, setToggleHashValue] = createSignal(false)\n\n  return (\n    <div data-testid=\"special-hash-heading\">\n      <div>Hello \"/specialChars/hash\"!</div>\n      <button\n        class={\n          'mt-2 mb-2 px-1 py-1 bg-indigo-600 text-white rounded hover:bg-indigo-700 transition duration-200'\n        }\n        data-testid=\"toggle-hash-button\"\n        onClick={() => setToggleHashValue(!toggleHashValue())}\n      >\n        Toggle HashValue\n      </button>\n      <div>\n        {toggleHashValue() && (\n          <div>\n            Hash Value<span data-testid=\"special-hash\">{location().hash}</span>\n          </div>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/specialChars/malformed/$param.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/specialChars/malformed/$param')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      Hello \"/specialChars/malformed/$param\":{' '}\n      <span data-testid={'special-malformed-param'}>{params().param}</span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/specialChars/malformed/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/specialChars/malformed')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div>Hello \"/specialChars/malformed\"!</div>\n      <Link\n        from={Route.fullPath}\n        data-testid=\"special-malformed-path-link\"\n        href=\"/specialChars/malformed/%E0%A4\"\n      >\n        malformed path param\n      </Link>{' '}\n      <Link\n        from={Route.fullPath}\n        data-testid=\"special-malformed-search-link\"\n        href=\"/specialChars/malformed/search?searchParam=%E0%A4\"\n      >\n        malformed search param\n      </Link>{' '}\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/specialChars/malformed/search.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/specialChars/malformed/search')({\n  validateSearch: z.object({\n    searchParam: z.string(),\n  }),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n\n  return (\n    <div>\n      Hello \"/specialChars/malformed/search\"!\n      <span data-testid={'special-malformed-search-param'}>\n        {search().searchParam}\n      </span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/specialChars/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/specialChars')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div>Hello \"/specialChars\"!</div>\n      <Link\n        to=\"/specialChars/대한민국\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        data-testid=\"special-non-latin-link\"\n      >\n        Unicode\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/$param\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        data-testid=\"special-param-link\"\n        params={{ param: '대|' }}\n      >\n        Unicode param\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/search\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        data-testid=\"special-searchParam-link\"\n        search={{ searchParam: '대|' }}\n      >\n        Unicode search param\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/hash\"\n        activeOptions={{\n          includeHash: true,\n        }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n        hash={'대|'}\n        data-testid=\"special-hash-link-1\"\n      >\n        Unicode Hash\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/hash\"\n        activeOptions={{\n          includeHash: true,\n        }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n        hash={'abc'}\n        data-testid=\"special-hash-link-2\"\n      >\n        Unicode Hash abc\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/malformed\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        data-testid=\"special-malformed-link\"\n      >\n        Malformed paths\n      </Link>{' '}\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/specialChars/search.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/specialChars/search')({\n  validateSearch: z.object({\n    searchParam: z.string(),\n  }),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n\n  return (\n    <div>\n      Hello \"/specialChars/search\"!\n      <span data-testid={'special-search-param'}>{search().searchParam}</span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/specialChars/대한민국.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/specialChars/대한민국')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"special-non-latin-heading\">\n      Hello \"/specialChars/대한민국\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/stream.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { createEffect, createSignal, Suspense } from 'solid-js'\n\nexport const Route = createFileRoute('/stream')({\n  component: Home,\n  loader() {\n    return {\n      promise: new Promise<string>((resolve) =>\n        setTimeout(() => resolve('promise-data'), 150),\n      ),\n      stream: new ReadableStream({\n        async start(controller) {\n          for (let i = 0; i < 5; i++) {\n            await new Promise((resolve) => setTimeout(resolve, 200))\n            controller.enqueue(`stream-data-${i} `)\n          }\n          controller.close()\n        },\n      }),\n    }\n  },\n})\n\nconst decoder = new TextDecoder('utf-8')\n\nfunction Home() {\n  const loaderData = Route.useLoaderData()\n  const [streamData, setStreamData] = createSignal<Array<string>>([])\n\n  createEffect(() => {\n    async function fetchStream() {\n      const reader = loaderData().stream.getReader()\n      let chunk\n\n      while (!(chunk = await reader.read()).done) {\n        let value = chunk.value\n        if (typeof value !== 'string') {\n          value = decoder.decode(value, { stream: !chunk.done })\n        }\n        setStreamData((prev) => [...prev, value])\n      }\n    }\n\n    fetchStream()\n  })\n\n  return (\n    <Suspense>\n      <Await\n        promise={loaderData().promise}\n        children={(promiseData) => (\n          <div class=\"p-2\" data-testid=\"promise-data\">\n            {promiseData}\n            <div data-testid=\"stream-data\">\n              {streamData().map((d) => (\n                <div>{d}</div>\n              ))}\n            </div>\n          </div>\n        )}\n      />\n    </Suspense>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/transition/count/create-resource.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { Suspense, createResource } from 'solid-js'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/transition/count/create-resource')({\n  validateSearch: z.object({\n    n: z.number().default(1),\n  }),\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <Link\n        data-testid=\"increase-button\"\n        class=\"border bg-gray-50 px-3 py-1\"\n        from=\"/transition/count/create-resource\"\n        search={(s) => ({ n: s.n + 1 })}\n      >\n        Increase\n      </Link>\n\n      <Result />\n    </div>\n  )\n}\n\nfunction Result() {\n  const searchQuery = Route.useSearch()\n\n  const [doubleQuery] = createResource(\n    () => searchQuery().n,\n    async (n) => {\n      await new Promise((r) => setTimeout(r, 1000))\n      return n * 2\n    },\n  )\n\n  return (\n    <div class=\"mt-2\">\n      <Suspense fallback=\"Loading...\">\n        <div data-testid=\"n-value\">n: {searchQuery().n}</div>\n        <div data-testid=\"double-value\">double: {doubleQuery()}</div>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/transition/typing/create-resource.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Suspense, createResource } from 'solid-js'\n\nexport const Route = createFileRoute('/transition/typing/create-resource')({\n  validateSearch: (search: { query?: string }) => ({\n    query: search.query ?? '',\n  }),\n  component: Home,\n  ssr: true,\n})\n\nfunction Home() {\n  const searchQuery = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  const [asyncResult] = createResource(\n    () => searchQuery().query,\n    async (query) => {\n      await new Promise((r) => setTimeout(r, 1000))\n      return query\n    },\n  )\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"mt-2\">\n        <input\n          class=\"border bg-gray-50 text-black px-3 py-1\"\n          value={''}\n          placeholder=\"Type to search...\"\n          onInput={(e) => {\n            navigate({ search: { query: e.currentTarget.value } })\n          }}\n        />\n        <br />\n        <Suspense fallback=\"Loading...\">\n          Query: {searchQuery().query}\n          <br />\n          Result: {asyncResult()}\n        </Suspense>{' '}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nimport { getRouterInstance } from '@tanstack/solid-start'\nimport type { User } from '~/utils/users'\nimport { NotFound } from '~/components/NotFound'\nimport { UserErrorComponent } from '~/components/UserErrorComponent'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    const router = await getRouterInstance()\n    return await axios\n      .get<User>('/api/users/' + userId, { baseURL: router.options.origin })\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch user')\n      })\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user().name}</h4>\n      <div class=\"text-sm\">{user().email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { getRouterInstance } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const router = await getRouterInstance()\n    return await axios\n      .get<Array<User>>('/api/users', { baseURL: router.options.origin })\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch users')\n      })\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users(),\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/server.ts",
    "content": "// DO NOT DELETE THIS FILE!!!\n// This file is a good smoke test to make sure the custom server entry is working\nimport handler from '@tanstack/solid-start/server-entry'\n\nconsole.log(\"[server-entry]: using custom server entry in 'src/server.ts'\")\n\nexport default {\n  fetch(request: Request) {\n    return handler.fetch(request)\n  },\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/solid-start/basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/solid-start/basic/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/navigation.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 404',\n  ],\n})\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('body')).toContainText(\"I'm a layout\")\n  await expect(page.locator('body')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout B!\")\n})\n\ntest('client side navigating to a route with scripts', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n  await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n  expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  expect(await page.evaluate('window.SCRIPT_2')).toBe(undefined)\n})\n\ntest('directly going to a route with scripts', async ({ page }) => {\n  await page.goto('/scripts')\n\n  await page.waitForURL('/scripts')\n  await page.waitForLoadState('networkidle')\n  expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  expect(await page.evaluate('window.SCRIPT_2')).toBe(undefined)\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/not-found.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from '../tests/utils/isSpaMode'\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 404',\n  ],\n})\ntest.describe('not-found', () => {\n  test(`global not found`, async ({ page }) => {\n    const response = await page.goto(`/this-page-does-not-exist/foo/bar`)\n\n    expect(response?.status()).toBe(isSpaMode ? 200 : 404)\n\n    await expect(\n      page.getByTestId('default-not-found-component'),\n    ).toBeInViewport()\n  })\n\n  test.describe('throw notFound()', () => {\n    const navigationTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n      preload: [false, true] as const,\n    })\n\n    navigationTestMatrix.forEach(({ thrower, preload }) => {\n      test(`navigation: thrower: ${thrower}, preload: ${preload}`, async ({\n        page,\n      }) => {\n        await page.goto(\n          `/not-found/${preload === false ? '?preload=false' : ''}`,\n        )\n        const link = page.getByTestId(`via-${thrower}`)\n\n        if (preload) {\n          await link.focus()\n          await new Promise((r) => setTimeout(r, 250))\n        }\n\n        await link.click()\n\n        await expect(\n          page.getByTestId(`via-${thrower}-notFound-component`),\n        ).toBeInViewport()\n        await expect(\n          page.getByTestId(`via-${thrower}-route-component`),\n        ).not.toBeInViewport()\n      })\n    })\n    const directVisitTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n    })\n\n    directVisitTestMatrix.forEach(({ thrower }) => {\n      test(`direct visit: thrower: ${thrower}`, async ({ page }) => {\n        await page.goto(`/not-found/via-${thrower}`)\n        await page.waitForLoadState('networkidle')\n        await expect(\n          page.getByTestId(`via-${thrower}-notFound-component`),\n        ).toBeInViewport()\n        await expect(\n          page.getByTestId(`via-${thrower}-route-component`),\n        ).not.toBeInViewport()\n      })\n    })\n\n    test('direct visit: child beforeLoad notFound renders parent boundary with parent loader data', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/parent-boundary/via-beforeLoad')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('parent-boundary-notFound-component'),\n      ).toBeInViewport()\n      await expect(page.getByTestId('parent-loader-data')).toHaveText('ready')\n      await expect(\n        page.getByTestId('parent-boundary-child-route-component'),\n      ).not.toBeInViewport()\n    })\n\n    test('direct visit: beforeLoad notFound with routeId targets root boundary', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/via-beforeLoad-target-root')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('default-not-found-component'),\n      ).toBeInViewport()\n      await expect(\n        page.getByTestId('via-beforeLoad-target-root-route-component'),\n      ).not.toBeInViewport()\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/prerendering.spec.ts",
    "content": "import { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isPrerender } from './utils/isPrerender'\n\ntest.describe('Prerender Static Path Discovery', () => {\n  test.skip(!isPrerender, 'Skipping since not in prerender mode')\n  test.describe('Build Output Verification', () => {\n    test('should automatically discover and prerender static routes', () => {\n      // Check that static routes were automatically discovered and prerendered\n      const distDir = join(process.cwd(), 'dist', 'client')\n\n      // These static routes should be automatically discovered and prerendered\n      expect(existsSync(join(distDir, 'index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'deferred/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'scripts/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'inline-scripts/index.html'))).toBe(true)\n      expect(\n        existsSync(join(distDir, 'specialChars/대한민국/index.html')),\n      ).toBe(true)\n\n      // Pathless layouts should NOT be prerendered (they start with _)\n      expect(existsSync(join(distDir, '_layout', 'index.html'))).toBe(false) // /_layout\n\n      // API routes should NOT be prerendered\n\n      expect(existsSync(join(distDir, 'api', 'users', 'index.html'))).toBe(\n        false,\n      ) // /api/users\n    })\n  })\n\n  test.describe('Static Files Verification', () => {\n    test('should contain prerendered content in posts.html', () => {\n      const distDir = join(process.cwd(), 'dist', 'client')\n      expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true)\n\n      // \"Select a post.\" should be in the prerendered HTML\n      const html = readFileSync(join(distDir, 'posts/index.html'), 'utf-8')\n      expect(html).toContain('Select a post.')\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/redirect.spec.ts",
    "content": "import queryString from 'node:querystring'\nimport { expect } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  test,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\nimport { isSpaMode } from '../tests/utils/isSpaMode'\nimport { isPreview } from '../tests/utils/isPreview'\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\nconst PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa' : ''}${isPreview ? '_preview' : ''}`,\n)\nconst EXTERNAL_HOST_PORT = await getDummyServerPort(packageJson.name)\n\ntest.describe('redirects', () => {\n  const internalNavigationTestMatrix = combinate({\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n    preload: [false, true] as const,\n  })\n\n  internalNavigationTestMatrix.forEach(\n    ({ thrower, reloadDocument, preload }) => {\n      test(`internal target, navigation: thrower: ${thrower}, reloadDocument: ${reloadDocument}, preload: ${preload}`, async ({\n        page,\n      }) => {\n        await page.goto(\n          `/redirect/internal${preload === false ? '?preload=false' : ''}`,\n        )\n        const link = page.getByTestId(\n          `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`,\n        )\n\n        await page.waitForLoadState('networkidle')\n        let requestHappened = false\n\n        const requestPromise = new Promise<void>((resolve) => {\n          page.on('request', (request) => {\n            if (\n              request.url().startsWith(`http://localhost:${PORT}/_serverFn/`)\n            ) {\n              requestHappened = true\n              resolve()\n            }\n          })\n        })\n        await link.focus()\n\n        const expectRequestHappened = preload && !reloadDocument\n        const timeoutPromise = new Promise((resolve) =>\n          setTimeout(resolve, expectRequestHappened ? 5000 : 500),\n        )\n        await Promise.race([requestPromise, timeoutPromise])\n        expect(requestHappened).toBe(expectRequestHappened)\n        let fullPageLoad = false\n        page.on('domcontentloaded', () => {\n          fullPageLoad = true\n        })\n\n        await link.click()\n\n        const url = `http://localhost:${PORT}/posts`\n\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n        expect(fullPageLoad).toBe(reloadDocument)\n      })\n    },\n  )\n\n  const internalDirectVisitTestMatrix = combinate({\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n  })\n\n  internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => {\n    test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({\n      page,\n    }) => {\n      await page.goto(`/redirect/internal/via-${thrower}`)\n\n      const url = `http://localhost:${PORT}/posts`\n\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n      await page.waitForLoadState('networkidle')\n      await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n    })\n  })\n\n  const externalTestMatrix = combinate({\n    scenario: ['navigate', 'direct_visit'] as const,\n    thrower: ['beforeLoad', 'loader'] as const,\n  })\n\n  externalTestMatrix.forEach(({ scenario, thrower }) => {\n    test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({\n      page,\n    }) => {\n      const q = queryString.stringify({\n        externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n      })\n\n      if (scenario === 'navigate') {\n        await page.goto(`/redirect/external?${q}`)\n        await page.waitForLoadState('networkidle')\n        const link = page.getByTestId(`via-${thrower}`)\n        await link.focus()\n        await link.click()\n      } else {\n        await page.goto(`/redirect/external/via-${thrower}?${q}`)\n      }\n\n      const url = `http://localhost:${EXTERNAL_HOST_PORT}/`\n\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n    })\n  })\n\n  const serverFnTestMatrix = combinate({\n    target: ['internal', 'external'] as const,\n    scenario: ['navigate', 'direct_visit'] as const,\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n  })\n\n  serverFnTestMatrix.forEach(\n    ({ target, thrower, scenario, reloadDocument }) => {\n      test(`serverFn redirects to target: ${target}, scenario: ${scenario}, thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({\n        page,\n      }) => {\n        let fullPageLoad = false\n        const q = queryString.stringify({\n          externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n          reloadDocument,\n        })\n\n        if (scenario === 'navigate') {\n          await page.goto(`/redirect/${target}/serverFn?${q}`)\n          await page.waitForLoadState('networkidle')\n          const link = page.getByTestId(\n            `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`,\n          )\n          page.on('domcontentloaded', () => {\n            fullPageLoad = true\n          })\n          await link.focus()\n          await link.click()\n        } else {\n          await page.goto(`/redirect/${target}/serverFn/via-${thrower}?${q}`)\n        }\n\n        const url =\n          target === 'internal'\n            ? `http://localhost:${PORT}/posts`\n            : `http://localhost:${EXTERNAL_HOST_PORT}/`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        if (target === 'internal' && scenario === 'navigate') {\n          await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n          expect(fullPageLoad).toBe(reloadDocument)\n        }\n      })\n    },\n  )\n\n  const useServerFnTestMatrix = combinate({\n    target: ['internal', 'external'] as const,\n    reloadDocument: [false, true] as const,\n  })\n\n  useServerFnTestMatrix.forEach(({ target, reloadDocument }) => {\n    test(`useServerFn redirects to target: ${target}, reloadDocument: ${reloadDocument}`, async ({\n      page,\n    }) => {\n      const q = queryString.stringify({\n        externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n        reloadDocument,\n      })\n\n      await page.goto(`/redirect/${target}/serverFn/via-useServerFn?${q}`)\n\n      await page.waitForLoadState('networkidle')\n\n      const button = page.getByTestId('redirect-on-click')\n\n      let fullPageLoad = false\n      page.on('domcontentloaded', () => {\n        fullPageLoad = true\n      })\n\n      await button.click()\n\n      const url =\n        target === 'internal'\n          ? `http://localhost:${PORT}/posts`\n          : `http://localhost:${EXTERNAL_HOST_PORT}/`\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n      if (target === 'internal') {\n        await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n        expect(fullPageLoad).toBe(reloadDocument)\n      }\n    })\n  })\n\n  test('multiple Set-Cookie headers are preserved on redirect', async ({\n    page,\n  }) => {\n    // This test verifies that multiple Set-Cookie headers are not lost during redirect\n    await page.goto('/multi-cookie-redirect')\n\n    // Wait for redirect to complete\n    await page.waitForURL(/\\/multi-cookie-redirect\\/target/)\n\n    // Should redirect to target page\n    await expect(page.getByTestId('multi-cookie-redirect-target')).toBeVisible()\n    expect(page.url()).toContain('/multi-cookie-redirect/target')\n\n    // Verify all three cookies were preserved during the redirect\n    await expect(page.getByTestId('cookie-session')).toHaveText('session-value')\n    await expect(page.getByTestId('cookie-csrf')).toHaveText('csrf-token-value')\n    await expect(page.getByTestId('cookie-theme')).toHaveText('dark')\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/script-duplication.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('Script Duplication Prevention', () => {\n  test('should not create duplicate scripts on SSR route', async ({ page }) => {\n    await page.goto('/scripts')\n\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const scriptCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n\n    expect(scriptCount).toBe(1)\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate scripts during client-side navigation', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const firstNavCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(firstNavCount).toBe(1)\n\n    await page.getByRole('link', { name: 'Home' }).click()\n    await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const secondNavCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(secondNavCount).toBe(1)\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate scripts with multiple navigation cycles', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    for (let i = 0; i < 3; i++) {\n      await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n      await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n      await page.getByRole('link', { name: 'Home' }).click()\n      await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n    }\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const finalCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(finalCount).toBe(1)\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate inline scripts', async ({ page }) => {\n    await page.goto('/inline-scripts')\n\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    const script1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n\n    const script2Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_2 = \"test\"'),\n      ).length\n    })\n\n    expect(script1Count).toBe(1)\n    expect(script2Count).toBe(1)\n    expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)\n    expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')\n  })\n\n  test('should not create duplicate inline scripts during client-side navigation', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    await page.getByRole('link', { name: 'Inline Scripts' }).click()\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    const firstNavScript1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n    expect(firstNavScript1Count).toBe(1)\n\n    await page.getByRole('link', { name: 'Home' }).click()\n    await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n\n    await page.getByRole('link', { name: 'Inline Scripts' }).click()\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    const secondNavScript1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n    expect(secondNavScript1Count).toBe(1)\n\n    expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)\n    expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/search-params.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from 'tests/utils/isSpaMode'\nimport { isPrerender } from './utils/isPrerender'\nimport type { Response } from '@playwright/test'\n\nfunction expectRedirect(response: Response | null, endsWith: string) {\n  expect(response).not.toBeNull()\n  expect(response!.request().redirectedFrom()).not.toBeNull()\n  const redirectUrl = response!\n    .request()\n    .redirectedFrom()!\n    .redirectedTo()\n    ?.url()\n  expect(redirectUrl).toBeDefined()\n  expect(redirectUrl!.endsWith(endsWith))\n}\n\nfunction expectNoRedirect(response: Response | null) {\n  expect(response).not.toBeNull()\n  const request = response!.request()\n  expect(request.redirectedFrom()).toBeNull()\n}\n\ntest.describe('/search-params/loader-throws-redirect', () => {\n  test('Directly visiting the route without search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/loader-throws-redirect')\n\n    if (!isSpaMode && !isPrerender) {\n      expectRedirect(response, '/search-params/loader-throws-redirect?step=a')\n    }\n\n    await expect(page.getByTestId('search-param')).toContainText('a')\n    expect(page.url().endsWith('/search-params/loader-throws-redirect?step=a'))\n  })\n\n  test('Directly visiting the route with search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto(\n      '/search-params/loader-throws-redirect?step=b',\n    )\n    expectNoRedirect(response)\n    await expect(page.getByTestId('search-param')).toContainText('b')\n    expect(page.url().endsWith('/search-params/loader-throws-redirect?step=b'))\n  })\n})\n\ntest.describe('/search-params/default', () => {\n  test('Directly visiting the route without search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/default')\n    if (!isSpaMode && !isPrerender) {\n      expectRedirect(response, '/search-params/default?default=d1')\n    }\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/default?default=d2')\n    expectNoRedirect(response)\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route without search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-without-search').click()\n\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-with-search').click()\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/special-characters.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from './utils/isSpaMode'\n\ntest.use({\n  whitelistErrors: [\n    /Failed to load resource: the server responded with a status of 404/,\n  ],\n})\ntest.describe('Unicode route rendering', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/specialChars')\n  })\n\n  test('should render non-latin route correctly with direct navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto('/specialChars/대한민국')\n    await page.waitForURL(\n      `${baseURL}/specialChars/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`,\n    )\n\n    await expect(page.getByTestId('special-non-latin-heading')).toBeInViewport()\n  })\n\n  test('should render non-latin route correctly during router navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    const nonLatinLink = page.getByTestId('special-non-latin-link')\n\n    await nonLatinLink.click()\n    await page.waitForURL(\n      `${baseURL}/specialChars/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`,\n    )\n\n    await expect(page.getByTestId('special-non-latin-heading')).toBeInViewport()\n  })\n\n  test.describe('Special characters in path params', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/대|')\n      await page.waitForURL(`${baseURL}/specialChars/%EB%8C%80%7C`)\n\n      const param = await page.getByTestId('special-param').textContent()\n\n      expect(param).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const link = page.getByTestId('special-param-link')\n\n      await link.click()\n      await page.waitForURL(`${baseURL}/specialChars/%EB%8C%80%7C`)\n\n      const param = await page.getByTestId('special-param').textContent()\n\n      expect(param).toBe('대|')\n    })\n  })\n\n  test.describe('Special characters in search params', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/search?searchParam=대|')\n\n      await page.waitForURL(\n        `${baseURL}/specialChars/search?searchParam=%EB%8C%80|`,\n      )\n\n      const searchParam = await page\n        .getByTestId('special-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const link = page.getByTestId('special-searchParam-link')\n\n      await link.click()\n      await page.waitForURL(\n        `${baseURL}/specialChars/search?searchParam=%EB%8C%80%7C`,\n      )\n\n      const searchParam = await page\n        .getByTestId('special-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('대|')\n    })\n  })\n\n  test.describe('Special characters in url hash', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await expect(page.getByTestId('special-hash-link-1')).not.toContainClass(\n        'font-bold',\n      )\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.goto('/specialChars/hash#대|')\n\n      await page.waitForURL(`${baseURL}/specialChars/hash#%EB%8C%80|`)\n      await page.waitForLoadState('load')\n\n      await expect(page.getByTestId('special-hash-heading')).toBeInViewport()\n\n      await expect(page.getByTestId('special-hash-link-1')).toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.getByTestId('toggle-hash-button').click()\n\n      const hashValue = await page.getByTestId('special-hash').textContent()\n\n      expect(hashValue).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await expect(page.getByTestId('special-hash-link-1')).not.toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      const link = page.getByTestId('special-hash-link-1')\n\n      await link.click()\n\n      await page.waitForURL(`${baseURL}/specialChars/hash#%EB%8C%80|`)\n      await page.waitForLoadState('load')\n\n      await expect(page.getByTestId('special-hash-heading')).toBeInViewport()\n\n      await expect(page.getByTestId('special-hash-link-1')).toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.getByTestId('toggle-hash-button').click()\n\n      const hashValue = await page.getByTestId('special-hash').textContent()\n\n      expect(hashValue).toBe('대|')\n    })\n  })\n\n  test.describe('malformed paths', () => {\n    test.use({\n      whitelistErrors: [\n        'Failed to load resource: the server responded with a status of 404',\n        'Failed to load resource: the server responded with a status of 400 (Bad Request)',\n      ],\n    })\n\n    test('un-matched malformed paths should return not found on direct navigation', async ({\n      page,\n    }) => {\n      const res = await page.goto('/specialChars/malformed/%E0%A4')\n\n      await page.waitForLoadState(`load`)\n\n      // in spa mode this is caught and handled at server level\n      if (!isSpaMode) {\n        expect(res!.status()).toBe(404)\n\n        await expect(\n          page.getByTestId('default-not-found-component'),\n        ).toBeInViewport()\n      } else {\n        expect(res!.status()).toBe(400)\n      }\n    })\n\n    test('malformed path params should return not found on router link', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/malformed')\n      await page.waitForURL(`${baseURL}/specialChars/malformed`)\n\n      const link = page.getByTestId('special-malformed-path-link')\n\n      await link.click()\n      await page.waitForLoadState('load')\n\n      await expect(\n        page.getByTestId('default-not-found-component'),\n      ).toBeInViewport()\n    })\n\n    test('un-matched malformed paths should return not found on direct navigation in search params', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/malformed/search?searchParam=%E0%A4')\n\n      await page.waitForURL(\n        `${baseURL}/specialChars/malformed/search?searchParam=%E0%A4`,\n      )\n\n      await expect(\n        page.getByTestId('special-malformed-search-param'),\n      ).toBeInViewport()\n\n      const searchParam = await page\n        .getByTestId('special-malformed-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('�')\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/streaming.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('Navigating to deferred route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Deferred' }).click()\n\n  await expect(page.getByTestId('regular-person')).toContainText('John Doe')\n  await expect(page.getByTestId('deferred-person')).toContainText(\n    'Tanner Linsley',\n  )\n  await expect(page.getByTestId('deferred-stuff')).toContainText(\n    'Hello deferred!',\n  )\n})\n\ntest('Directly visiting the deferred route', async ({ page }) => {\n  await page.goto('/deferred')\n\n  await expect(page.getByTestId('regular-person')).toContainText('John Doe')\n  await expect(page.getByTestId('deferred-person')).toContainText(\n    'Tanner Linsley',\n  )\n  await expect(page.getByTestId('deferred-stuff')).toContainText(\n    'Hello deferred!',\n  )\n})\n\ntest('streaming loader data', async ({ page }) => {\n  await page.goto('/stream')\n\n  await expect(page.getByTestId('promise-data')).toContainText('promise-data')\n  await expect(page.getByTestId('stream-data')).toContainText('stream-data')\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/transition.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('transitions/count/create-resource should keep old values visible during navigation', async ({\n  page,\n}) => {\n  const burstClicks = async (count: number) => {\n    await page\n      .getByTestId('increase-button')\n      .evaluate((element, clickCount) => {\n        for (let index = 0; index < clickCount; index++) {\n          ;(element as HTMLAnchorElement).click()\n        }\n      }, count)\n  }\n\n  await page.goto('/transition/count/create-resource')\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1')\n  await expect(page.getByTestId('double-value')).toContainText('double: 2')\n\n  const bodyTexts: Array<string> = []\n\n  const pollInterval = setInterval(async () => {\n    const text = await page\n      .locator('body')\n      .textContent()\n      .catch(() => '')\n    if (text) bodyTexts.push(text)\n  }, 50)\n\n  // 1 click\n\n  await burstClicks(1)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1', {\n    timeout: 2_000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 2', {\n    timeout: 2_000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n    timeout: 2000,\n  })\n\n  // 2 clicks\n\n  await burstClicks(2)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n    timeout: 2000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n    timeout: 2000,\n  })\n\n  // 3 clicks\n\n  await burstClicks(3)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n    timeout: 2000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 7', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 14', {\n    timeout: 2000,\n  })\n\n  clearInterval(pollInterval)\n\n  // With proper transitions, old values should remain visible until new ones arrive\n  const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...'))\n\n  if (hasLoadingText) {\n    throw new Error(\n      'FAILED: \"Loading...\" appeared during navigation. ' +\n        'Solid Router should use transitions to keep old values visible.',\n    )\n  }\n})\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/utils/isPrerender.ts",
    "content": "export const isPrerender: boolean = process.env.MODE === 'prerender'\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/utils/isPreview.ts",
    "content": "export const isPreview: boolean = process.env.MODE === 'preview'\n"
  },
  {
    "path": "e2e/solid-start/basic/tests/utils/isSpaMode.ts",
    "content": "export const isSpaMode: boolean = process.env.MODE === 'spa'\n"
  },
  {
    "path": "e2e/solid-start/basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport { isSpaMode } from './tests/utils/isSpaMode'\nimport { isPrerender } from './tests/utils/isPrerender'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst spaModeConfiguration = {\n  enabled: true,\n  prerender: {\n    outputPath: 'index.html',\n  },\n}\n\nconst prerenderConfiguration = {\n  enabled: true,\n  filter: (page: { path: string }) =>\n    ![\n      '/this-route-does-not-exist',\n      '/redirect',\n      '/i-do-not-exist',\n      '/not-found',\n      '/specialChars/search',\n      '/specialChars/hash',\n      '/specialChars/malformed',\n      '/search-params/default',\n      '/transition',\n      '/users',\n    ].some((p) => page.path.includes(p)),\n  maxRedirects: 100,\n}\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      spa: isSpaMode ? spaModeConfiguration : undefined,\n      prerender: isPrerender ? prerenderConfiguration : undefined,\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/.env",
    "content": "# Environment variables declared in this file are automatically made available to Prisma.\n# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema\n\n# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.\n# See the documentation for all the connection string options: https://pris.ly/d/connection-strings\n\nDATABASE_URL=\"file:./dev.db\""
  },
  {
    "path": "e2e/solid-start/basic-auth/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n!.env\n.DS_Store\n.cache\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n.tmp/\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/basic-auth/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-basic-auth\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"prisma-generate\": \"prisma generate\",\n    \"test:e2e\": \"rm -rf port*.txt; mkdir -p .tmp; rm -f .tmp/dev.db .tmp/dev.db-journal .tmp/dev.db-wal .tmp/dev.db-shm; export DATABASE_URL=file:./.tmp/dev.db; pnpm run prisma-generate && pnpm exec prisma migrate deploy && playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@libsql/client\": \"^0.15.15\",\n    \"@prisma/adapter-libsql\": \"^7.0.0\",\n    \"@prisma/client\": \"^7.0.0\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"dotenv\": \"^17.2.3\",\n    \"prisma\": \"^7.0.0\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/playwright.config.ts",
    "content": "import { fileURLToPath } from 'node:url'\nimport path from 'node:path'\nimport { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\n// Ensure port file is written next to this config, even if Playwright loads it\n// from a different working directory.\nprocess.chdir(path.dirname(fileURLToPath(import.meta.url)))\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/prisma/migrations/20240811183753_init/migration.sql",
    "content": "-- CreateTable\nCREATE TABLE \"User\" (\n    \"email\" TEXT NOT NULL PRIMARY KEY,\n    \"password\" TEXT NOT NULL\n);\n\n-- CreateIndex\nCREATE UNIQUE INDEX \"User_email_key\" ON \"User\"(\"email\");\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/prisma/migrations/migration_lock.toml",
    "content": "# Please do not edit this file manually\n# It should be added in your version-control system (i.e. Git)\nprovider = \"sqlite\""
  },
  {
    "path": "e2e/solid-start/basic-auth/prisma/schema.prisma",
    "content": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n  provider = \"prisma-client\"\n  output   = \"../src/prisma-generated\"\n}\n\ndatasource db {\n  provider = \"sqlite\"\n}\n\nmodel User {\n  email String @id @unique\n  password String\n}"
  },
  {
    "path": "e2e/solid-start/basic-auth/prisma.config.ts",
    "content": "import 'dotenv/config'\nimport { defineConfig, env } from 'prisma/config'\n\nexport default defineConfig({\n  schema: './prisma/schema.prisma',\n  migrations: {\n    path: './prisma/migrations',\n  },\n  datasource: {\n    url: env('DATABASE_URL'),\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/components/Auth.tsx",
    "content": "import type { JSX } from 'solid-js'\n\nexport function Auth({\n  actionText,\n  onSubmit,\n  status,\n  afterSubmit,\n}: {\n  actionText: string\n  onSubmit: (e: HTMLFormElement) => void\n  status: 'pending' | 'idle' | 'success' | 'error'\n  afterSubmit?: () => JSX.Element\n}) {\n  return (\n    <div class=\"fixed inset-0 bg-white dark:bg-black flex items-start justify-center p-8\">\n      <div class=\"bg-white dark:bg-gray-900 p-8 rounded-lg shadow-lg\">\n        <h1 class=\"text-2xl font-bold mb-4\">{actionText}</h1>\n        <form\n          onSubmit={(e: any) => {\n            e.preventDefault()\n            onSubmit(e)\n          }}\n          class=\"space-y-4\"\n        >\n          <div>\n            <label for=\"email\" class=\"block text-xs\">\n              Email\n            </label>\n            <input\n              type=\"email\"\n              name=\"email\"\n              id=\"email\"\n              class=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <div>\n            <label for=\"password\" class=\"block text-xs\">\n              Password\n            </label>\n            <input\n              type=\"password\"\n              name=\"password\"\n              id=\"password\"\n              class=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <button\n            type=\"submit\"\n            class=\"w-full bg-cyan-600 text-white rounded-sm py-2 font-black uppercase\"\n            disabled={status === 'pending'}\n          >\n            {status === 'pending' ? '...' : actionText}\n          </button>\n          {afterSubmit ? afterSubmit() : null}\n        </form>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/components/Login.tsx",
    "content": "import { useRouter } from '@tanstack/solid-router'\nimport { useServerFn } from '@tanstack/solid-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { loginFn } from '../routes/_authed'\nimport { Auth } from './Auth'\nimport { signupFn } from '~/routes/signup'\n\nexport function Login() {\n  const router = useRouter()\n  const login = useServerFn(loginFn)\n\n  const loginMutation = useMutation({\n    fn: login,\n    onSuccess: async (ctx) => {\n      if (!ctx.data?.error) {\n        await router.invalidate()\n        router.navigate({ to: '/' })\n        return\n      }\n    },\n  })\n\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Login\"\n      status={loginMutation.status()}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as unknown as HTMLFormElement)\n\n        loginMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={() =>\n        loginMutation.data() ? (\n          <>\n            <div class=\"text-red-400\">{loginMutation.data()?.message}</div>\n            {loginMutation.data()?.userNotFound ? (\n              <div>\n                <button\n                  class=\"text-blue-500\"\n                  onClick={(e) => {\n                    const formData = new FormData(\n                      (e.target as HTMLButtonElement).form!,\n                    )\n\n                    signupMutation.mutate({\n                      data: {\n                        email: formData.get('email') as string,\n                        password: formData.get('password') as string,\n                      },\n                    })\n                  }}\n                  type=\"button\"\n                >\n                  Sign up instead?\n                </button>\n              </div>\n            ) : null}\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/hooks/useMutation.ts",
    "content": "import * as Solid from 'solid-js'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = Solid.createSignal<number | undefined>()\n  const [variables, setVariables] = Solid.createSignal<TVariables | undefined>()\n  const [error, setError] = Solid.createSignal<TError | undefined>()\n  const [data, setData] = Solid.createSignal<TData | undefined>()\n  const [status, setStatus] = Solid.createSignal<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = async (variables: TVariables): Promise<TData | undefined> => {\n    setStatus('pending')\n    setSubmittedAt(Date.now())\n    setVariables(variables as any)\n    //\n    try {\n      const data = await opts.fn(variables)\n      await opts.onSuccess?.({ data })\n      setStatus('success')\n      setError(undefined)\n      setData(data as any)\n      return data\n    } catch (err: any) {\n      setStatus('error')\n      setError(err)\n    }\n  }\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/browser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma-related types and utilities in a browser.\n * Use it to get access to models, enums, and input types.\n *\n * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.\n * See `client.ts` for the standard, server-side entry point.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as Prisma from './internal/prismaNamespaceBrowser'\nexport { Prisma }\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/client.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.\n * If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as process from 'node:process'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nglobalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport * as $Class from './internal/class'\nimport * as Prisma from './internal/prismaNamespace'\n\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\nexport const PrismaClient = $Class.getPrismaClientClass()\nexport type PrismaClient<\n  LogOpts extends Prisma.LogLevel = never,\n  OmitOpts extends Prisma.PrismaClientOptions['omit'] =\n    Prisma.PrismaClientOptions['omit'],\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>\nexport { Prisma }\n\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/commonInputTypes.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports various common sort, input & filter types that are not directly linked to a particular model.\n *\n * 🟢 You can import this file directly.\n */\n\nimport type * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport type * as Prisma from './internal/prismaNamespace'\n\nexport type StringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type StringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedStringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type NestedStringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedIntFilter<$PrismaModel = never> = {\n  equals?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  in?: number[]\n  notIn?: number[]\n  lt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  lte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedIntFilter<$PrismaModel> | number\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/enums.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports all enum related types from the schema.\n *\n * 🟢 You can import this file directly.\n */\n\n// This file is empty because there are no enums in the schema.\nexport {}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/internal/class.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * Please import the `PrismaClient` class from the `client.ts` file instead.\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from './prismaNamespace'\n\nconst config: runtime.GetPrismaClientConfig = {\n  previewFeatures: [],\n  clientVersion: '7.0.0',\n  engineVersion: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n  activeProvider: 'sqlite',\n  inlineSchema:\n    '// This is your Prisma schema file,\\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\\n\\ngenerator client {\\n  provider = \"prisma-client\"\\n  output   = \"../src/prisma-generated\"\\n}\\n\\ndatasource db {\\n  provider = \"sqlite\"\\n}\\n\\nmodel User {\\n  email    String @id @unique\\n  password String\\n}\\n',\n  runtimeDataModel: {\n    models: {},\n    enums: {},\n    types: {},\n  },\n}\n\nconfig.runtimeDataModel = JSON.parse(\n  '{\"models\":{\"User\":{\"fields\":[{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}',\n)\n\nasync function decodeBase64AsWasm(\n  wasmBase64: string,\n): Promise<WebAssembly.Module> {\n  const { Buffer } = await import('node:buffer')\n  const wasmArray = Buffer.from(wasmBase64, 'base64')\n  return new WebAssembly.Module(wasmArray)\n}\n\nconfig.compilerWasm = {\n  getRuntime: async () =>\n    await import('@prisma/client/runtime/query_compiler_bg.sqlite.mjs'),\n\n  getQueryCompilerWasmModule: async () => {\n    const { wasm } =\n      await import('@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs')\n    return await decodeBase64AsWasm(wasm)\n  },\n}\n\nexport type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =\n  'log' extends keyof ClientOptions\n    ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition>\n      ? Prisma.GetEvents<ClientOptions['log']>\n      : never\n    : never\n\nexport interface PrismaClientConstructor {\n  /**\n   * ## Prisma Client\n   *\n   * Type-safe database client for TypeScript\n   * @example\n   * ```\n   * const prisma = new PrismaClient()\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n   */\n\n  new <\n    Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,\n    LogOpts extends LogOptions<Options> = LogOptions<Options>,\n    OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {\n      omit: infer U\n    }\n      ? U\n      : Prisma.PrismaClientOptions['omit'],\n    ExtArgs extends runtime.Types.Extensions.InternalArgs =\n      runtime.Types.Extensions.DefaultArgs,\n  >(\n    options: Prisma.Subset<Options, Prisma.PrismaClientOptions>,\n  ): PrismaClient<LogOpts, OmitOpts, ExtArgs>\n}\n\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\n\nexport interface PrismaClient<\n  in LogOpts extends Prisma.LogLevel = never,\n  in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,\n  in out ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> {\n  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }\n\n  $on<V extends LogOpts>(\n    eventType: V,\n    callback: (\n      event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent,\n    ) => void,\n  ): PrismaClient\n\n  /**\n   * Connect with the database\n   */\n  $connect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Disconnect from the database\n   */\n  $disconnect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Executes a prepared raw query and returns the number of affected rows.\n   * @example\n   * ```\n   * const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Executes a raw query and returns the number of affected rows.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Performs a prepared raw query and returns the `SELECT` data.\n   * @example\n   * ```\n   * const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Performs a raw query and returns the `SELECT` data.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.\n   * @example\n   * ```\n   * const [george, bob, alice] = await prisma.$transaction([\n   *   prisma.user.create({ data: { name: 'George' } }),\n   *   prisma.user.create({ data: { name: 'Bob' } }),\n   *   prisma.user.create({ data: { name: 'Alice' } }),\n   * ])\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).\n   */\n  $transaction<P extends Prisma.PrismaPromise<any>[]>(\n    arg: [...P],\n    options?: { isolationLevel?: Prisma.TransactionIsolationLevel },\n  ): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>\n\n  $transaction<R>(\n    fn: (\n      prisma: Omit<PrismaClient, runtime.ITXClientDenyList>,\n    ) => runtime.Types.Utils.JsPromise<R>,\n    options?: {\n      maxWait?: number\n      timeout?: number\n      isolationLevel?: Prisma.TransactionIsolationLevel\n    },\n  ): runtime.Types.Utils.JsPromise<R>\n\n  $extends: runtime.Types.Extensions.ExtendsHook<\n    'extends',\n    Prisma.TypeMapCb<OmitOpts>,\n    ExtArgs,\n    runtime.Types.Utils.Call<\n      Prisma.TypeMapCb<OmitOpts>,\n      {\n        extArgs: ExtArgs\n      }\n    >\n  >\n\n  /**\n   * `prisma.user`: Exposes CRUD operations for the **User** model.\n   * Example usage:\n   * ```ts\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   */\n  get user(): Prisma.UserDelegate<ExtArgs, { omit: OmitOpts }>\n}\n\nexport function getPrismaClientClass(): PrismaClientConstructor {\n  return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/internal/prismaNamespace.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the client.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from '../models'\nimport { type PrismaClient } from './class'\n\nexport type * from '../models'\n\nexport type DMMF = typeof runtime.DMMF\n\nexport type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>\n\n/**\n * Prisma Errors\n */\n\nexport const PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\nexport type PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\n\nexport const PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\nexport type PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\n\nexport const PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\nexport type PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\n\nexport const PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\nexport type PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\n\nexport const PrismaClientValidationError = runtime.PrismaClientValidationError\nexport type PrismaClientValidationError = runtime.PrismaClientValidationError\n\n/**\n * Re-export of sql-template-tag\n */\nexport const sql = runtime.sqltag\nexport const empty = runtime.empty\nexport const join = runtime.join\nexport const raw = runtime.raw\nexport const Sql = runtime.Sql\nexport type Sql = runtime.Sql\n\n/**\n * Decimal.js\n */\nexport const Decimal = runtime.Decimal\nexport type Decimal = runtime.Decimal\n\nexport type DecimalJsLike = runtime.DecimalJsLike\n\n/**\n * Extensions\n */\nexport type Extension = runtime.Types.Extensions.UserArgs\nexport const getExtensionContext = runtime.Extensions.getExtensionContext\nexport type Args<T, F extends runtime.Operation> = runtime.Types.Public.Args<\n  T,\n  F\n>\nexport type Payload<\n  T,\n  F extends runtime.Operation = never,\n> = runtime.Types.Public.Payload<T, F>\nexport type Result<\n  T,\n  A,\n  F extends runtime.Operation,\n> = runtime.Types.Public.Result<T, A, F>\nexport type Exact<A, W> = runtime.Types.Public.Exact<A, W>\n\nexport type PrismaVersion = {\n  client: string\n  engine: string\n}\n\n/**\n * Prisma Client JS version: 7.0.0\n * Query Engine version: 0c19ccc313cf9911a90d99d2ac2eb0280c76c513\n */\nexport const prismaVersion: PrismaVersion = {\n  client: '7.0.0',\n  engine: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n}\n\n/**\n * Utility Types\n */\n\nexport type Bytes = runtime.Bytes\nexport type JsonObject = runtime.JsonObject\nexport type JsonArray = runtime.JsonArray\nexport type JsonValue = runtime.JsonValue\nexport type InputJsonObject = runtime.InputJsonObject\nexport type InputJsonArray = runtime.InputJsonArray\nexport type InputJsonValue = runtime.InputJsonValue\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\ntype SelectAndInclude = {\n  select: any\n  include: any\n}\n\ntype SelectAndOmit = {\n  select: any\n  omit: any\n}\n\n/**\n * From T, pick a set of properties whose keys are in the union K\n */\ntype Prisma__Pick<T, K extends keyof T> = {\n  [P in K]: T[P]\n}\n\nexport type Enumerable<T> = T | Array<T>\n\n/**\n * Subset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection\n */\nexport type Subset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n}\n\n/**\n * SelectSubset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection.\n * Additionally, it validates, if both select and include are present. If the case, it errors.\n */\nexport type SelectSubset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & (T extends SelectAndInclude\n  ? 'Please either choose `select` or `include`.'\n  : T extends SelectAndOmit\n    ? 'Please either choose `select` or `omit`.'\n    : {})\n\n/**\n * Subset + Intersection\n * @desc From `T` pick properties that exist in `U` and intersect `K`\n */\nexport type SubsetIntersection<T, U, K> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & K\n\ntype Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }\n\n/**\n * XOR is needed to have a real mutually exclusive union type\n * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types\n */\nexport type XOR<T, U> = T extends object\n  ? U extends object\n    ? (Without<T, U> & U) | (Without<U, T> & T)\n    : U\n  : T\n\n/**\n * Is T a Record?\n */\ntype IsObject<T extends any> =\n  T extends Array<any>\n    ? False\n    : T extends Date\n      ? False\n      : T extends Uint8Array\n        ? False\n        : T extends BigInt\n          ? False\n          : T extends object\n            ? True\n            : False\n\n/**\n * If it's T[], return T\n */\nexport type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T\n\n/**\n * From ts-toolbelt\n */\n\ntype __Either<O extends object, K extends Key> = Omit<O, K> &\n  {\n    // Merge all but K\n    [P in K]: Prisma__Pick<O, P & keyof O> // With K possibilities\n  }[K]\n\ntype EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>\n\ntype EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>\n\ntype _Either<O extends object, K extends Key, strict extends Boolean> = {\n  1: EitherStrict<O, K>\n  0: EitherLoose<O, K>\n}[strict]\n\nexport type Either<\n  O extends object,\n  K extends Key,\n  strict extends Boolean = 1,\n> = O extends unknown ? _Either<O, K, strict> : never\n\nexport type Union = any\n\nexport type PatchUndefined<O extends object, O1 extends object> = {\n  [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K]\n} & {}\n\n/** Helper Types for \"Merge\" **/\nexport type IntersectOf<U extends Union> = (\n  U extends unknown ? (k: U) => void : never\n) extends (k: infer I) => void\n  ? I\n  : never\n\nexport type Overwrite<O extends object, O1 extends object> = {\n  [K in keyof O]: K extends keyof O1 ? O1[K] : O[K]\n} & {}\n\ntype _Merge<U extends object> = IntersectOf<\n  Overwrite<\n    U,\n    {\n      [K in keyof U]-?: At<U, K>\n    }\n  >\n>\n\ntype Key = string | number | symbol\ntype AtStrict<O extends object, K extends Key> = O[K & keyof O]\ntype AtLoose<O extends object, K extends Key> = O extends unknown\n  ? AtStrict<O, K>\n  : never\nexport type At<O extends object, K extends Key, strict extends Boolean = 1> = {\n  1: AtStrict<O, K>\n  0: AtLoose<O, K>\n}[strict]\n\nexport type ComputeRaw<A extends any> = A extends Function\n  ? A\n  : {\n      [K in keyof A]: A[K]\n    } & {}\n\nexport type OptionalFlat<O> = {\n  [K in keyof O]?: O[K]\n} & {}\n\ntype _Record<K extends keyof any, T> = {\n  [P in K]: T\n}\n\n// cause typescript not to expand types and preserve names\ntype NoExpand<T> = T extends unknown ? T : never\n\n// this type assumes the passed object is entirely optional\nexport type AtLeast<O extends object, K extends string> = NoExpand<\n  O extends unknown\n    ?\n        | (K extends keyof O ? { [P in K]: O[P] } & O : O)\n        | ({ [P in keyof O as P extends K ? P : never]-?: O[P] } & O)\n    : never\n>\n\ntype _Strict<U, _U = U> = U extends unknown\n  ? U & OptionalFlat<_Record<Exclude<Keys<_U>, keyof U>, never>>\n  : never\n\nexport type Strict<U extends object> = ComputeRaw<_Strict<U>>\n/** End Helper Types for \"Merge\" **/\n\nexport type Merge<U extends object> = ComputeRaw<_Merge<Strict<U>>>\n\nexport type Boolean = True | False\n\nexport type True = 1\n\nexport type False = 0\n\nexport type Not<B extends Boolean> = {\n  0: 1\n  1: 0\n}[B]\n\nexport type Extends<A1 extends any, A2 extends any> = [A1] extends [never]\n  ? 0 // anything `never` is false\n  : A1 extends A2\n    ? 1\n    : 0\n\nexport type Has<U extends Union, U1 extends Union> = Not<\n  Extends<Exclude<U1, U>, U1>\n>\n\nexport type Or<B1 extends Boolean, B2 extends Boolean> = {\n  0: {\n    0: 0\n    1: 1\n  }\n  1: {\n    0: 1\n    1: 1\n  }\n}[B1][B2]\n\nexport type Keys<U extends Union> = U extends unknown ? keyof U : never\n\nexport type GetScalarType<T, O> = O extends object\n  ? {\n      [P in keyof T]: P extends keyof O ? O[P] : never\n    }\n  : never\n\ntype FieldPaths<T, U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>> =\n  IsObject<T> extends True ? U : T\n\nexport type GetHavingFields<T> = {\n  [K in keyof T]: Or<\n    Or<Extends<'OR', K>, Extends<'AND', K>>,\n    Extends<'NOT', K>\n  > extends True\n    ? // infer is only needed to not hit TS limit\n      // based on the brilliant idea of Pierre-Antoine Mills\n      // https://github.com/microsoft/TypeScript/issues/30188#issuecomment-478938437\n      T[K] extends infer TK\n      ? GetHavingFields<\n          UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never\n        >\n      : never\n    : {} extends FieldPaths<T[K]>\n      ? never\n      : K\n}[keyof T]\n\n/**\n * Convert tuple to union\n */\ntype _TupleToUnion<T> = T extends (infer E)[] ? E : never\ntype TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>\nexport type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T\n\n/**\n * Like `Pick`, but additionally can also accept an array of keys\n */\nexport type PickEnumerable<\n  T,\n  K extends Enumerable<keyof T> | keyof T,\n> = Prisma__Pick<T, MaybeTupleToUnion<K>>\n\n/**\n * Exclude all keys with underscores\n */\nexport type ExcludeUnderscoreKeys<T extends string> = T extends `_${string}`\n  ? never\n  : T\n\nexport type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>\n\ntype FieldRefInputType<Model, FieldType> = Model extends never\n  ? never\n  : FieldRef<Model, FieldType>\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\nexport interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils\n  .Fn<\n  { extArgs: runtime.Types.Extensions.InternalArgs },\n  runtime.Types.Utils.Record<string, any>\n> {\n  returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>\n}\n\nexport type TypeMap<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> = {\n  globalOmitOptions: {\n    omit: GlobalOmitOptions\n  }\n  meta: {\n    modelProps: 'user'\n    txIsolationLevel: TransactionIsolationLevel\n  }\n  model: {\n    User: {\n      payload: Prisma.$UserPayload<ExtArgs>\n      fields: Prisma.UserFieldRefs\n      operations: {\n        findUnique: {\n          args: Prisma.UserFindUniqueArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findUniqueOrThrow: {\n          args: Prisma.UserFindUniqueOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findFirst: {\n          args: Prisma.UserFindFirstArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findFirstOrThrow: {\n          args: Prisma.UserFindFirstOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findMany: {\n          args: Prisma.UserFindManyArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        create: {\n          args: Prisma.UserCreateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        createMany: {\n          args: Prisma.UserCreateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        createManyAndReturn: {\n          args: Prisma.UserCreateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        delete: {\n          args: Prisma.UserDeleteArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        update: {\n          args: Prisma.UserUpdateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        deleteMany: {\n          args: Prisma.UserDeleteManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateMany: {\n          args: Prisma.UserUpdateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateManyAndReturn: {\n          args: Prisma.UserUpdateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        upsert: {\n          args: Prisma.UserUpsertArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        aggregate: {\n          args: Prisma.UserAggregateArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.AggregateUser>\n        }\n        groupBy: {\n          args: Prisma.UserGroupByArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.UserGroupByOutputType>[]\n        }\n        count: {\n          args: Prisma.UserCountArgs<ExtArgs>\n          result:\n            | runtime.Types.Utils.Optional<Prisma.UserCountAggregateOutputType>\n            | number\n        }\n      }\n    }\n  }\n} & {\n  other: {\n    payload: any\n    operations: {\n      $executeRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $executeRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n      $queryRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $queryRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n    }\n  }\n}\n\n/**\n * Enums\n */\n\nexport const TransactionIsolationLevel = runtime.makeStrictEnum({\n  Serializable: 'Serializable',\n} as const)\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n\n/**\n * Field references\n */\n\n/**\n * Reference to a field of type 'String'\n */\nexport type StringFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'String'\n>\n\n/**\n * Reference to a field of type 'Int'\n */\nexport type IntFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'Int'\n>\n\n/**\n * Batch Payload for updateMany & deleteMany & createMany\n */\nexport type BatchPayload = {\n  count: number\n}\n\nexport const defineExtension = runtime.Extensions\n  .defineExtension as unknown as runtime.Types.Extensions.ExtendsHook<\n  'define',\n  TypeMapCb,\n  runtime.Types.Extensions.DefaultArgs\n>\nexport type DefaultPrismaClient = PrismaClient\nexport type ErrorFormat = 'pretty' | 'colorless' | 'minimal'\nexport type PrismaClientOptions = (\n  | {\n      /**\n       * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`.\n       */\n      adapter: runtime.SqlDriverAdapterFactory\n      accelerateUrl?: never\n    }\n  | {\n      /**\n       * Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database.\n       */\n      accelerateUrl: string\n      adapter?: never\n    }\n) & {\n  /**\n   * @default \"colorless\"\n   */\n  errorFormat?: ErrorFormat\n  /**\n   * @example\n   * ```\n   * // Shorthand for `emit: 'stdout'`\n   * log: ['query', 'info', 'warn', 'error']\n   *\n   * // Emit as events only\n   * log: [\n   *   { emit: 'event', level: 'query' },\n   *   { emit: 'event', level: 'info' },\n   *   { emit: 'event', level: 'warn' }\n   *   { emit: 'event', level: 'error' }\n   * ]\n   *\n   * / Emit as events and log to stdout\n   * og: [\n   *  { emit: 'stdout', level: 'query' },\n   *  { emit: 'stdout', level: 'info' },\n   *  { emit: 'stdout', level: 'warn' }\n   *  { emit: 'stdout', level: 'error' }\n   *\n   * ```\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).\n   */\n  log?: (LogLevel | LogDefinition)[]\n  /**\n   * The default values for transactionOptions\n   * maxWait ?= 2000\n   * timeout ?= 5000\n   */\n  transactionOptions?: {\n    maxWait?: number\n    timeout?: number\n    isolationLevel?: TransactionIsolationLevel\n  }\n  /**\n   * Global configuration for omitting model fields by default.\n   *\n   * @example\n   * ```\n   * const prisma = new PrismaClient({\n   *   omit: {\n   *     user: {\n   *       password: true\n   *     }\n   *   }\n   * })\n   * ```\n   */\n  omit?: GlobalOmitConfig\n}\nexport type GlobalOmitConfig = {\n  user?: Prisma.UserOmit\n}\n\n/* Types for Logging */\nexport type LogLevel = 'info' | 'query' | 'warn' | 'error'\nexport type LogDefinition = {\n  level: LogLevel\n  emit: 'stdout' | 'event'\n}\n\nexport type CheckIsLogLevel<T> = T extends LogLevel ? T : never\n\nexport type GetLogType<T> = CheckIsLogLevel<\n  T extends LogDefinition ? T['level'] : T\n>\n\nexport type GetEvents<T extends any[]> =\n  T extends Array<LogLevel | LogDefinition> ? GetLogType<T[number]> : never\n\nexport type QueryEvent = {\n  timestamp: Date\n  query: string\n  params: string\n  duration: number\n  target: string\n}\n\nexport type LogEvent = {\n  timestamp: Date\n  message: string\n  target: string\n}\n/* End Types for Logging */\n\nexport type PrismaAction =\n  | 'findUnique'\n  | 'findUniqueOrThrow'\n  | 'findMany'\n  | 'findFirst'\n  | 'findFirstOrThrow'\n  | 'create'\n  | 'createMany'\n  | 'createManyAndReturn'\n  | 'update'\n  | 'updateMany'\n  | 'updateManyAndReturn'\n  | 'upsert'\n  | 'delete'\n  | 'deleteMany'\n  | 'executeRaw'\n  | 'queryRaw'\n  | 'aggregate'\n  | 'count'\n  | 'runCommandRaw'\n  | 'findRaw'\n  | 'groupBy'\n\n/**\n * `PrismaClient` proxy available in interactive transactions.\n */\nexport type TransactionClient = Omit<\n  DefaultPrismaClient,\n  runtime.ITXClientDenyList\n>\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/internal/prismaNamespaceBrowser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the browser.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/index-browser'\n\nexport type * from '../models'\nexport type * from './prismaNamespace'\n\nexport const Decimal = runtime.Decimal\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\n/*\n * Enums\n */\n\nexport const TransactionIsolationLevel = {\n  Serializable: 'Serializable',\n} as const\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/models/User.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports the `User` model and its related types.\n *\n * 🟢 You can import this file directly.\n */\nimport type * as runtime from '@prisma/client/runtime/client'\nimport type * as $Enums from '../enums'\nimport type * as Prisma from '../internal/prismaNamespace'\n\n/**\n * Model User\n *\n */\nexport type UserModel =\n  runtime.Types.Result.DefaultSelection<Prisma.$UserPayload>\n\nexport type AggregateUser = {\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\nexport type UserMinAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserMaxAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserCountAggregateOutputType = {\n  email: number\n  password: number\n  _all: number\n}\n\nexport type UserMinAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserMaxAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserCountAggregateInputType = {\n  email?: true\n  password?: true\n  _all?: true\n}\n\nexport type UserAggregateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which User to aggregate.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the start position\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Count returned Users\n   **/\n  _count?: true | UserCountAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the minimum value\n   **/\n  _min?: UserMinAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the maximum value\n   **/\n  _max?: UserMaxAggregateInputType\n}\n\nexport type GetUserAggregateType<T extends UserAggregateArgs> = {\n  [P in keyof T & keyof AggregateUser]: P extends '_count' | 'count'\n    ? T[P] extends true\n      ? number\n      : Prisma.GetScalarType<T[P], AggregateUser[P]>\n    : Prisma.GetScalarType<T[P], AggregateUser[P]>\n}\n\nexport type UserGroupByArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  where?: Prisma.UserWhereInput\n  orderBy?:\n    | Prisma.UserOrderByWithAggregationInput\n    | Prisma.UserOrderByWithAggregationInput[]\n  by: Prisma.UserScalarFieldEnum[] | Prisma.UserScalarFieldEnum\n  having?: Prisma.UserScalarWhereWithAggregatesInput\n  take?: number\n  skip?: number\n  _count?: UserCountAggregateInputType | true\n  _min?: UserMinAggregateInputType\n  _max?: UserMaxAggregateInputType\n}\n\nexport type UserGroupByOutputType = {\n  email: string\n  password: string\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\ntype GetUserGroupByPayload<T extends UserGroupByArgs> = Prisma.PrismaPromise<\n  Array<\n    Prisma.PickEnumerable<UserGroupByOutputType, T['by']> & {\n      [P in keyof T & keyof UserGroupByOutputType]: P extends '_count'\n        ? T[P] extends boolean\n          ? number\n          : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n        : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n    }\n  >\n>\n\nexport type UserWhereInput = {\n  AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  OR?: Prisma.UserWhereInput[]\n  NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  email?: Prisma.StringFilter<'User'> | string\n  password?: Prisma.StringFilter<'User'> | string\n}\n\nexport type UserOrderByWithRelationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserWhereUniqueInput = Prisma.AtLeast<\n  {\n    email?: string\n    AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    OR?: Prisma.UserWhereInput[]\n    NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    password?: Prisma.StringFilter<'User'> | string\n  },\n  'email' | 'email'\n>\n\nexport type UserOrderByWithAggregationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n  _count?: Prisma.UserCountOrderByAggregateInput\n  _max?: Prisma.UserMaxOrderByAggregateInput\n  _min?: Prisma.UserMinOrderByAggregateInput\n}\n\nexport type UserScalarWhereWithAggregatesInput = {\n  AND?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  OR?: Prisma.UserScalarWhereWithAggregatesInput[]\n  NOT?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  email?: Prisma.StringWithAggregatesFilter<'User'> | string\n  password?: Prisma.StringWithAggregatesFilter<'User'> | string\n}\n\nexport type UserCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUncheckedCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCreateManyInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateManyMutationInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateManyInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCountOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMaxOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMinOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type StringFieldUpdateOperationsInput = {\n  set?: string\n}\n\nexport type UserSelect<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectCreateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectUpdateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectScalar = {\n  email?: boolean\n  password?: boolean\n}\n\nexport type UserOmit<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetOmit<\n  'email' | 'password',\n  ExtArgs['result']['user']\n>\n\nexport type $UserPayload<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  name: 'User'\n  objects: {}\n  scalars: runtime.Types.Extensions.GetPayloadResult<\n    {\n      email: string\n      password: string\n    },\n    ExtArgs['result']['user']\n  >\n  composites: {}\n}\n\nexport type UserGetPayload<\n  S extends boolean | null | undefined | UserDefaultArgs,\n> = runtime.Types.Result.GetResult<Prisma.$UserPayload, S>\n\nexport type UserCountArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = Omit<UserFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {\n  select?: UserCountAggregateInputType | true\n}\n\nexport interface UserDelegate<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> {\n  [K: symbol]: {\n    types: Prisma.TypeMap<ExtArgs>['model']['User']\n    meta: { name: 'User' }\n  }\n  /**\n   * Find zero or one User that matches the filter.\n   * @param {UserFindUniqueArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUnique({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUnique<T extends UserFindUniqueArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUnique',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find one User that matches the filter or throw an error with `error.code='P2025'`\n   * if no matches were found.\n   * @param {UserFindUniqueOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUniqueOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUniqueOrThrow<T extends UserFindUniqueOrThrowArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUniqueOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirst({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirst<T extends UserFindFirstArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirst',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter or\n   * throw `PrismaKnownClientError` with `P2025` code if no matches were found.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirstOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirstOrThrow<T extends UserFindFirstOrThrowArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirstOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find zero or more Users that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindManyArgs} args - Arguments to filter and select certain fields only.\n   * @example\n   * // Get all Users\n   * const users = await prisma.user.findMany()\n   *\n   * // Get first 10 Users\n   * const users = await prisma.user.findMany({ take: 10 })\n   *\n   * // Only select the `email`\n   * const userWithEmailOnly = await prisma.user.findMany({ select: { email: true } })\n   *\n   */\n  findMany<T extends UserFindManyArgs>(\n    args?: Prisma.SelectSubset<T, UserFindManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findMany',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create a User.\n   * @param {UserCreateArgs} args - Arguments to create a User.\n   * @example\n   * // Create one User\n   * const User = await prisma.user.create({\n   *   data: {\n   *     // ... data to create a User\n   *   }\n   * })\n   *\n   */\n  create<T extends UserCreateArgs>(\n    args: Prisma.SelectSubset<T, UserCreateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'create',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Create many Users.\n   * @param {UserCreateManyArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createMany({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   */\n  createMany<T extends UserCreateManyArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Create many Users and returns the data saved in the database.\n   * @param {UserCreateManyAndReturnArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createManyAndReturn({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Create many Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.createManyAndReturn({\n   *   select: { email: true },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  createManyAndReturn<T extends UserCreateManyAndReturnArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'createManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Delete a User.\n   * @param {UserDeleteArgs} args - Arguments to delete one User.\n   * @example\n   * // Delete one User\n   * const User = await prisma.user.delete({\n   *   where: {\n   *     // ... filter to delete one User\n   *   }\n   * })\n   *\n   */\n  delete<T extends UserDeleteArgs>(\n    args: Prisma.SelectSubset<T, UserDeleteArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'delete',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Update one User.\n   * @param {UserUpdateArgs} args - Arguments to update one User.\n   * @example\n   * // Update one User\n   * const user = await prisma.user.update({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  update<T extends UserUpdateArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'update',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Delete zero or more Users.\n   * @param {UserDeleteManyArgs} args - Arguments to filter Users to delete.\n   * @example\n   * // Delete a few Users\n   * const { count } = await prisma.user.deleteMany({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   *\n   */\n  deleteMany<T extends UserDeleteManyArgs>(\n    args?: Prisma.SelectSubset<T, UserDeleteManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserUpdateManyArgs} args - Arguments to update one or more rows.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateMany({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  updateMany<T extends UserUpdateManyArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users and returns the data updated in the database.\n   * @param {UserUpdateManyAndReturnArgs} args - Arguments to update many Users.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateManyAndReturn({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Update zero or more Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.updateManyAndReturn({\n   *   select: { email: true },\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  updateManyAndReturn<T extends UserUpdateManyAndReturnArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'updateManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create or update one User.\n   * @param {UserUpsertArgs} args - Arguments to update or create a User.\n   * @example\n   * // Update or create a User\n   * const user = await prisma.user.upsert({\n   *   create: {\n   *     // ... data to create a User\n   *   },\n   *   update: {\n   *     // ... in case it already exists, update\n   *   },\n   *   where: {\n   *     // ... the filter for the User we want to update\n   *   }\n   * })\n   */\n  upsert<T extends UserUpsertArgs>(\n    args: Prisma.SelectSubset<T, UserUpsertArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'upsert',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Count the number of Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserCountArgs} args - Arguments to filter Users to count.\n   * @example\n   * // Count the number of Users\n   * const count = await prisma.user.count({\n   *   where: {\n   *     // ... the filter for the Users we want to count\n   *   }\n   * })\n   **/\n  count<T extends UserCountArgs>(\n    args?: Prisma.Subset<T, UserCountArgs>,\n  ): Prisma.PrismaPromise<\n    T extends runtime.Types.Utils.Record<'select', any>\n      ? T['select'] extends true\n        ? number\n        : Prisma.GetScalarType<T['select'], UserCountAggregateOutputType>\n      : number\n  >\n\n  /**\n   * Allows you to perform aggregations operations on a User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserAggregateArgs} args - Select which aggregations you would like to apply and on what fields.\n   * @example\n   * // Ordered by age ascending\n   * // Where email contains prisma.io\n   * // Limited to the 10 users\n   * const aggregations = await prisma.user.aggregate({\n   *   _avg: {\n   *     age: true,\n   *   },\n   *   where: {\n   *     email: {\n   *       contains: \"prisma.io\",\n   *     },\n   *   },\n   *   orderBy: {\n   *     age: \"asc\",\n   *   },\n   *   take: 10,\n   * })\n   **/\n  aggregate<T extends UserAggregateArgs>(\n    args: Prisma.Subset<T, UserAggregateArgs>,\n  ): Prisma.PrismaPromise<GetUserAggregateType<T>>\n\n  /**\n   * Group by User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserGroupByArgs} args - Group by arguments.\n   * @example\n   * // Group by city, order by createdAt, get count\n   * const result = await prisma.user.groupBy({\n   *   by: ['city', 'createdAt'],\n   *   orderBy: {\n   *     createdAt: true\n   *   },\n   *   _count: {\n   *     _all: true\n   *   },\n   * })\n   *\n   **/\n  groupBy<\n    T extends UserGroupByArgs,\n    HasSelectOrTake extends Prisma.Or<\n      Prisma.Extends<'skip', Prisma.Keys<T>>,\n      Prisma.Extends<'take', Prisma.Keys<T>>\n    >,\n    OrderByArg extends Prisma.True extends HasSelectOrTake\n      ? { orderBy: UserGroupByArgs['orderBy'] }\n      : { orderBy?: UserGroupByArgs['orderBy'] },\n    OrderFields extends Prisma.ExcludeUnderscoreKeys<\n      Prisma.Keys<Prisma.MaybeTupleToUnion<T['orderBy']>>\n    >,\n    ByFields extends Prisma.MaybeTupleToUnion<T['by']>,\n    ByValid extends Prisma.Has<ByFields, OrderFields>,\n    HavingFields extends Prisma.GetHavingFields<T['having']>,\n    HavingValid extends Prisma.Has<ByFields, HavingFields>,\n    ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False,\n    InputErrors extends ByEmpty extends Prisma.True\n      ? `Error: \"by\" must not be empty.`\n      : HavingValid extends Prisma.False\n        ? {\n            [P in HavingFields]: P extends ByFields\n              ? never\n              : P extends string\n                ? `Error: Field \"${P}\" used in \"having\" needs to be provided in \"by\".`\n                : [\n                    Error,\n                    'Field ',\n                    P,\n                    ` in \"having\" needs to be provided in \"by\"`,\n                  ]\n          }[HavingFields]\n        : 'take' extends Prisma.Keys<T>\n          ? 'orderBy' extends Prisma.Keys<T>\n            ? ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields]\n            : 'Error: If you provide \"take\", you also need to provide \"orderBy\"'\n          : 'skip' extends Prisma.Keys<T>\n            ? 'orderBy' extends Prisma.Keys<T>\n              ? ByValid extends Prisma.True\n                ? {}\n                : {\n                    [P in OrderFields]: P extends ByFields\n                      ? never\n                      : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                  }[OrderFields]\n              : 'Error: If you provide \"skip\", you also need to provide \"orderBy\"'\n            : ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields],\n  >(\n    args: Prisma.SubsetIntersection<T, UserGroupByArgs, OrderByArg> &\n      InputErrors,\n  ): {} extends InputErrors\n    ? GetUserGroupByPayload<T>\n    : Prisma.PrismaPromise<InputErrors>\n  /**\n   * Fields of the User model\n   */\n  readonly fields: UserFieldRefs\n}\n\n/**\n * The delegate class that acts as a \"Promise-like\" for User.\n * Why is this prefixed with `Prisma__`?\n * Because we want to prevent naming conflicts as mentioned in\n * https://github.com/prisma/prisma-client-js/issues/707\n */\nexport interface Prisma__UserClient<\n  T,\n  Null = never,\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> extends Prisma.PrismaPromise<T> {\n  readonly [Symbol.toStringTag]: 'PrismaPromise'\n  /**\n   * Attaches callbacks for the resolution and/or rejection of the Promise.\n   * @param onfulfilled The callback to execute when the Promise is resolved.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of which ever callback is executed.\n   */\n  then<TResult1 = T, TResult2 = never>(\n    onfulfilled?:\n      | ((value: T) => TResult1 | PromiseLike<TResult1>)\n      | undefined\n      | null,\n    onrejected?:\n      | ((reason: any) => TResult2 | PromiseLike<TResult2>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<TResult1 | TResult2>\n  /**\n   * Attaches a callback for only the rejection of the Promise.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of the callback.\n   */\n  catch<TResult = never>(\n    onrejected?:\n      | ((reason: any) => TResult | PromiseLike<TResult>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<T | TResult>\n  /**\n   * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The\n   * resolved value cannot be modified from the callback.\n   * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).\n   * @returns A Promise for the completion of the callback.\n   */\n  finally(\n    onfinally?: (() => void) | undefined | null,\n  ): runtime.Types.Utils.JsPromise<T>\n}\n\n/**\n * Fields of the User model\n */\nexport interface UserFieldRefs {\n  readonly email: Prisma.FieldRef<'User', 'String'>\n  readonly password: Prisma.FieldRef<'User', 'String'>\n}\n\n// Custom InputTypes\n/**\n * User findUnique\n */\nexport type UserFindUniqueArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findUniqueOrThrow\n */\nexport type UserFindUniqueOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findFirst\n */\nexport type UserFindFirstArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findFirstOrThrow\n */\nexport type UserFindFirstOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findMany\n */\nexport type UserFindManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which Users to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for listing Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User create\n */\nexport type UserCreateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to create a User.\n   */\n  data: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n}\n\n/**\n * User createMany\n */\nexport type UserCreateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User createManyAndReturn\n */\nexport type UserCreateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectCreateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User update\n */\nexport type UserUpdateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to update a User.\n   */\n  data: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n  /**\n   * Choose, which User to update.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User updateMany\n */\nexport type UserUpdateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User updateManyAndReturn\n */\nexport type UserUpdateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectUpdateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User upsert\n */\nexport type UserUpsertArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The filter to search for the User to update in case it exists.\n   */\n  where: Prisma.UserWhereUniqueInput\n  /**\n   * In case the User found by the `where` argument doesn't exist, create a new User with this data.\n   */\n  create: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n  /**\n   * In case the User was found with the provided `where` argument, update it with this data.\n   */\n  update: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n}\n\n/**\n * User delete\n */\nexport type UserDeleteArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter which User to delete.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User deleteMany\n */\nexport type UserDeleteManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which Users to delete\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to delete.\n   */\n  limit?: number\n}\n\n/**\n * User without action\n */\nexport type UserDefaultArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/prisma-generated/models.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This is a barrel export file for all models and their related types.\n *\n * 🟢 You can import this file directly.\n */\nexport type * from './models/User'\nexport type * from './commonInputTypes'\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SignupRouteImport } from './routes/signup'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteImport } from './routes/_authed/posts'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst SignupRoute = SignupRouteImport.update({\n  id: '/signup',\n  path: '/signup',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRoute = AuthedPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts': typeof AuthedPostsRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/_authed/posts': typeof AuthedPostsRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  LogoutRoute: typeof LogoutRoute\n  SignupRoute: typeof SignupRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/signup': {\n      id: '/signup'\n      path: '/signup'\n      fullPath: '/signup'\n      preLoaderRoute: typeof SignupRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteChildren: AuthedPostsRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(\n  AuthedPostsRouteChildren,\n)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRoute: typeof AuthedPostsRouteWithChildren\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRoute: AuthedPostsRouteWithChildren,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n  LoginRoute: LoginRoute,\n  LogoutRoute: LogoutRoute,\n  SignupRoute: SignupRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { createServerFn } from '@tanstack/solid-start'\n\nimport type * as Solid from 'solid-js'\nimport { HydrationScript } from 'solid-js/web'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'\nimport { NotFound } from '~/components/NotFound.js'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo.js'\nimport { useAppSession } from '~/utils/session.js'\n\nconst fetchUser = createServerFn({ method: 'GET' }).handler(async () => {\n  // We need to auth on the server so we have access to secure cookies\n  const session = await useAppSession()\n\n  if (!session.data.userEmail) {\n    return null\n  }\n\n  return {\n    email: session.data.userEmail,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const user = await fetchUser()\n\n    return {\n      user,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  const routeContext = Route.useRouteContext()\n\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div class=\"ml-auto\">\n            {routeContext().user ? (\n              <>\n                <span class=\"mr-2\">{routeContext().user?.email}</span>\n                <Link to=\"/logout\">Logout</Link>\n              </>\n            ) : (\n              <Link to=\"/login\">Login</Link>\n            )}\n          </div>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nimport { NotFound } from '~/components/NotFound.js'\nimport { fetchPost } from '~/utils/posts.js'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/_authed/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nimport { fetchPosts } from '~/utils/posts.js'\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/_authed.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { Login } from '~/components/Login'\nimport { useAppSession } from '~/utils/session'\n\nexport const loginFn = createServerFn({\n  method: 'POST',\n})\n  .inputValidator((payload: { email: string; password: string }) => payload)\n  .handler(async ({ data }) => {\n    // Find the user\n    const user = await prismaClient.user.findUnique({\n      where: {\n        email: data.email,\n      },\n    })\n\n    // Check if the user exists\n    if (!user) {\n      return {\n        error: true,\n        userNotFound: true,\n        message: 'User not found',\n      }\n    }\n\n    // Check if the password is correct\n    const hashedPassword = await hashPassword(data.password)\n\n    if (user.password !== hashedPassword) {\n      return {\n        error: true,\n        message: 'Incorrect password',\n      }\n    }\n\n    // Create a session\n    const session = await useAppSession()\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n  })\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return <Login />\n    }\n\n    throw error\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Login } from '~/components/Login'\n\nexport const Route = createFileRoute('/login')({\n  component: LoginComp,\n})\n\nfunction LoginComp() {\n  return <Login />\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/logout.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nimport { useAppSession } from '~/utils/session'\n\nconst logoutFn = createServerFn({ method: 'POST' }).handler(async () => {\n  const session = await useAppSession()\n\n  session.clear()\n\n  throw redirect({\n    href: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  preload: false,\n  loader: () => logoutFn(),\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/routes/signup.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn, useServerFn } from '@tanstack/solid-start'\n\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { useMutation } from '~/hooks/useMutation'\nimport { Auth } from '~/components/Auth'\nimport { useAppSession } from '~/utils/session'\n\nexport const signupFn = createServerFn({\n  method: 'POST',\n})\n  .inputValidator(\n    (data: { email: string; password: string; redirectUrl?: string }) => data,\n  )\n  .handler(async ({ data: payload }) => {\n    // Check if the user already exists\n    const found = await prismaClient.user.findUnique({\n      where: {\n        email: payload.email,\n      },\n    })\n\n    // Encrypt the password using Sha256 into plaintext\n    const password = await hashPassword(payload.password)\n\n    // Create a session\n    const session = await useAppSession()\n\n    if (found) {\n      if (found.password !== password) {\n        return {\n          error: true,\n          userExists: true,\n          message: 'User already exists',\n        }\n      }\n\n      // Store the user's email in the session\n      await session.update({\n        userEmail: found.email,\n      })\n\n      // Redirect to the prev page stored in the \"redirect\" search param\n      throw redirect({\n        href: payload.redirectUrl || '/',\n      })\n    }\n\n    // Create the user\n    const user = await prismaClient.user.create({\n      data: {\n        email: payload.email,\n        password,\n      },\n    })\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n\n    // Redirect to the prev page stored in the \"redirect\" search param\n    throw redirect({\n      href: payload.redirectUrl || '/',\n    })\n  })\n\nexport const Route = createFileRoute('/signup')({\n  component: SignupComp,\n})\n\nfunction SignupComp() {\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Sign Up\"\n      status={signupMutation.status()}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as any as HTMLFormElement)\n\n        signupMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={() =>\n        signupMutation.data()?.error ? (\n          <>\n            <div class=\"text-red-400\">{signupMutation.data()?.message}</div>\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/utils/prisma.ts",
    "content": "import crypto from 'node:crypto'\nimport { PrismaLibSql } from '@prisma/adapter-libsql'\nimport { PrismaClient } from '../prisma-generated/client'\n\nconst adapter = new PrismaLibSql({\n  url: process.env.DATABASE_URL || 'file:./dev.db',\n})\nexport const prismaClient = new PrismaClient({ adapter })\n\nexport function hashPassword(password: string) {\n  return new Promise<string>((resolve, reject) => {\n    crypto.pbkdf2(password, 'salt', 100000, 64, 'sha256', (err, derivedKey) => {\n      if (err) {\n        reject(err)\n      } else {\n        resolve(derivedKey.toString('hex'))\n      }\n    })\n  })\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/src/utils/session.ts",
    "content": "// src/services/session.server.ts\nimport { useSession } from '@tanstack/solid-start/server'\nimport type { User } from '~/prisma-generated/client'\n\ntype SessionUser = {\n  userEmail: User['email']\n}\n\nexport function useAppSession() {\n  return useSession<SessionUser>({\n    password: 'ChangeThisBeforeShippingToProdOrYouWillBeFired',\n  })\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\nasync function waitForHydration(page: Page) {\n  await page.waitForFunction(() => typeof (window as any).$_TSR === 'undefined')\n}\n\nasync function signup(page: Page, email: string, password: string) {\n  await page.goto('/signup')\n  await waitForHydration(page)\n  await page.fill('input[name=\"email\"]', email)\n  await page.fill('input[name=\"password\"]', password)\n  await page.click('button[type=\"submit\"]')\n  await page.waitForSelector('text=Logout')\n}\n\nasync function login(\n  page: Page,\n  email: string,\n  password: string,\n  signupOnFail = false,\n) {\n  await page.goto('/login')\n  await waitForHydration(page)\n  await page.fill('input[name=\"email\"]', email)\n  await page.fill('input[name=\"password\"]', password)\n  await page.click('button[type=\"submit\"]')\n\n  if (signupOnFail) {\n    await page.waitForSelector('text=User not found')\n    await page.click('button:has-text(\"Sign up instead?\")')\n    await page.waitForSelector('text=Logout')\n  }\n}\n\ntest('Posts redirects to login when not authenticated', async ({ page }) => {\n  await page.goto('/posts')\n  await expect(page.locator('h1')).toContainText('Login')\n})\n\ntest('Login fails with user not found', async ({ page }) => {\n  const email = `missing-${Date.now()}@gmail.com`\n  await login(page, email, 'badpassword')\n  await expect(page.getByText('User not found')).toBeVisible()\n})\n\ntest('Login fails with incorrect password', async ({ page }) => {\n  const email = `incorrect-password-${Date.now()}@gmail.com`\n  await signup(page, email, 'test')\n  await page.goto('/logout')\n  await login(page, email, 'badpassword')\n  await expect(page.getByText('Incorrect password')).toBeVisible()\n})\n\ntest('Can sign up from a not found user', async ({ page }) => {\n  const email = `new-${Date.now()}@gmail.com`\n  await login(page, email, 'badpassword', true)\n  await expect(page.getByText(email)).toBeVisible()\n})\n\ntest('Navigating to post after logging in', async ({ page }) => {\n  const email = `posts-${Date.now()}@gmail.com`\n  await signup(page, email, 'test')\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/tests/mock-db-setup.test.ts",
    "content": "import { test as setup } from '@playwright/test'\n\nimport { hashPassword, prismaClient } from '../src/utils/prisma'\n\nsetup('create new database', async () => {\n  await prismaClient.user.deleteMany()\n\n  const email = 'test@gmail.com'\n  const password = await hashPassword('test')\n  await prismaClient.user.create({\n    data: {\n      email,\n      password,\n    },\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/tests/mock-db-teardown.test.ts",
    "content": "import { test as teardown } from '@playwright/test'\n\nimport { hashPassword, prismaClient } from '../src/utils/prisma'\n\nteardown('create new database', async () => {\n  await prismaClient.user.deleteMany()\n\n  const email = 'test@gmail.com'\n  const password = await hashPassword('test')\n  await prismaClient.user.create({\n    data: {\n      email,\n      password,\n    },\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-auth/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/.gitignore",
    "content": "node_modules\n.DS_Store\n.cache\n.env\ndist\n.wrangler\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/.prettierignore",
    "content": "**/public\npnpm-lock.yaml\nrouteTree.gen.ts\nworker-configuration.d.ts\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-basic-cloudflare\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"cf-typegen\": \"wrangler types\",\n    \"postinstall\": \"npm run cf-typegen\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@cloudflare/vite-plugin\": \"^1.29.0\",\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"wrangler\": \"^4.74.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as StaticRouteImport } from './routes/static'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst StaticRoute = StaticRouteImport.update({\n  id: '/static',\n  path: '/static',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/static'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/static'\n  id: '__root__' | '/' | '/static'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  StaticRoute: typeof StaticRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/static': {\n      id: '/static'\n      path: '/static'\n      fullPath: '/static'\n      preLoaderRoute: typeof StaticRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  StaticRoute: StaticRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { env } from 'cloudflare:workers'\n\nexport const Route = createFileRoute('/')({\n  loader: () => getData(),\n  component: Home,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    message: `Running in ${navigator.userAgent}`,\n    myVar: env.MY_VAR,\n  }\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <p data-testid=\"message\">{data().message}</p>\n      <p data-testid=\"myVar\">{data().myVar}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/routes/static.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { env } from 'cloudflare:workers'\n\nexport const Route = createFileRoute('/static')({\n  loader: () => getData(),\n  component: StaticPage,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    myVar: env.MY_VAR,\n  }\n})\n\nfunction StaticPage() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div>\n      <h1 data-testid=\"static-heading\">Static Page</h1>\n      <p data-testid=\"static-content\">The value is {data().myVar}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/tests/app.spec.ts",
    "content": "import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('returns the correct user agent', async ({ page }) => {\n  await page.goto('/')\n  await expect(page.getByTestId('message')).toHaveText(\n    'Running in Cloudflare-Workers',\n  )\n})\n\ntest('returns the correct value from a Cloudflare binding', async ({\n  page,\n}) => {\n  await page.goto('/')\n  await expect(page.getByTestId('myVar')).toHaveText('Hello from Cloudflare')\n})\n\ntest('prerender with Cloudflare Workers runtime', async ({ page }) => {\n  // Verify the static page was prerendered during build\n  const distDir = join(process.cwd(), 'dist', 'client')\n  expect(existsSync(join(distDir, 'static', 'index.html'))).toBe(true)\n\n  // Verify the page loads correctly\n  await page.goto('/static')\n  await expect(page.getByTestId('static-heading')).toHaveText('Static Page')\n  await expect(page.getByTestId('static-content')).toHaveText(\n    'The value is Hello from Cloudflare',\n  )\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { cloudflare } from '@cloudflare/vite-plugin'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [\n    tailwindcss(),\n    cloudflare({ viteEnvironment: { name: 'ssr' }, inspectorPort: false }),\n    tanstackStart({\n      prerender: {\n        enabled: true,\n        filter: (page) => page.path === '/static',\n      },\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/worker-configuration.d.ts",
    "content": "/* eslint-disable */\n// Generated by Wrangler by running `wrangler types` (hash: b11df627d8b3c51b1bf3230a546b0f20)\n// Runtime types generated with workerd@1.20260317.1 2025-09-24 nodejs_compat\ndeclare namespace Cloudflare {\n\tinterface Env {\n\t\tMY_VAR: \"Hello from Cloudflare\";\n\t}\n}\ninterface Env extends Cloudflare.Env {}\ntype StringifyValues<EnvType extends Record<string, unknown>> = {\n\t[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;\n};\ndeclare namespace NodeJS {\n\tinterface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, \"MY_VAR\">> {}\n}\n\n// Begin runtime types\n/*! *****************************************************************************\nCopyright (c) Cloudflare. All rights reserved.\nCopyright (c) Microsoft Corporation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n/* eslint-disable */\n// noinspection JSUnusedGlobalSymbols\ndeclare var onmessage: never;\n/**\n * The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)\n */\ndeclare class DOMException extends Error {\n    constructor(message?: string, name?: string);\n    /**\n     * The **`message`** read-only property of the a message or description associated with the given error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)\n     */\n    readonly message: string;\n    /**\n     * The **`name`** read-only property of the one of the strings associated with an error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)\n     */\n    readonly name: string;\n    /**\n     * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)\n     */\n    readonly code: number;\n    static readonly INDEX_SIZE_ERR: number;\n    static readonly DOMSTRING_SIZE_ERR: number;\n    static readonly HIERARCHY_REQUEST_ERR: number;\n    static readonly WRONG_DOCUMENT_ERR: number;\n    static readonly INVALID_CHARACTER_ERR: number;\n    static readonly NO_DATA_ALLOWED_ERR: number;\n    static readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    static readonly NOT_FOUND_ERR: number;\n    static readonly NOT_SUPPORTED_ERR: number;\n    static readonly INUSE_ATTRIBUTE_ERR: number;\n    static readonly INVALID_STATE_ERR: number;\n    static readonly SYNTAX_ERR: number;\n    static readonly INVALID_MODIFICATION_ERR: number;\n    static readonly NAMESPACE_ERR: number;\n    static readonly INVALID_ACCESS_ERR: number;\n    static readonly VALIDATION_ERR: number;\n    static readonly TYPE_MISMATCH_ERR: number;\n    static readonly SECURITY_ERR: number;\n    static readonly NETWORK_ERR: number;\n    static readonly ABORT_ERR: number;\n    static readonly URL_MISMATCH_ERR: number;\n    static readonly QUOTA_EXCEEDED_ERR: number;\n    static readonly TIMEOUT_ERR: number;\n    static readonly INVALID_NODE_TYPE_ERR: number;\n    static readonly DATA_CLONE_ERR: number;\n    get stack(): any;\n    set stack(value: any);\n}\ntype WorkerGlobalScopeEventMap = {\n    fetch: FetchEvent;\n    scheduled: ScheduledEvent;\n    queue: QueueEvent;\n    unhandledrejection: PromiseRejectionEvent;\n    rejectionhandled: PromiseRejectionEvent;\n};\ndeclare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {\n    EventTarget: typeof EventTarget;\n}\n/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *\n * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)\n */\ninterface Console {\n    \"assert\"(condition?: boolean, ...data: any[]): void;\n    /**\n     * The **`console.clear()`** static method clears the console if possible.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)\n     */\n    clear(): void;\n    /**\n     * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)\n     */\n    count(label?: string): void;\n    /**\n     * The **`console.countReset()`** static method resets counter used with console/count_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)\n     */\n    countReset(label?: string): void;\n    /**\n     * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)\n     */\n    debug(...data: any[]): void;\n    /**\n     * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)\n     */\n    dir(item?: any, options?: any): void;\n    /**\n     * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)\n     */\n    dirxml(...data: any[]): void;\n    /**\n     * The **`console.error()`** static method outputs a message to the console at the 'error' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)\n     */\n    error(...data: any[]): void;\n    /**\n     * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)\n     */\n    group(...data: any[]): void;\n    /**\n     * The **`console.groupCollapsed()`** static method creates a new inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)\n     */\n    groupCollapsed(...data: any[]): void;\n    /**\n     * The **`console.groupEnd()`** static method exits the current inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)\n     */\n    groupEnd(): void;\n    /**\n     * The **`console.info()`** static method outputs a message to the console at the 'info' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)\n     */\n    info(...data: any[]): void;\n    /**\n     * The **`console.log()`** static method outputs a message to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)\n     */\n    log(...data: any[]): void;\n    /**\n     * The **`console.table()`** static method displays tabular data as a table.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)\n     */\n    table(tabularData?: any, properties?: string[]): void;\n    /**\n     * The **`console.time()`** static method starts a timer you can use to track how long an operation takes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)\n     */\n    time(label?: string): void;\n    /**\n     * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)\n     */\n    timeEnd(label?: string): void;\n    /**\n     * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)\n     */\n    timeLog(label?: string, ...data: any[]): void;\n    timeStamp(label?: string): void;\n    /**\n     * The **`console.trace()`** static method outputs a stack trace to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)\n     */\n    trace(...data: any[]): void;\n    /**\n     * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)\n     */\n    warn(...data: any[]): void;\n}\ndeclare const console: Console;\ntype BufferSource = ArrayBufferView | ArrayBuffer;\ntype TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;\ndeclare namespace WebAssembly {\n    class CompileError extends Error {\n        constructor(message?: string);\n    }\n    class RuntimeError extends Error {\n        constructor(message?: string);\n    }\n    type ValueType = \"anyfunc\" | \"externref\" | \"f32\" | \"f64\" | \"i32\" | \"i64\" | \"v128\";\n    interface GlobalDescriptor {\n        value: ValueType;\n        mutable?: boolean;\n    }\n    class Global {\n        constructor(descriptor: GlobalDescriptor, value?: any);\n        value: any;\n        valueOf(): any;\n    }\n    type ImportValue = ExportValue | number;\n    type ModuleImports = Record<string, ImportValue>;\n    type Imports = Record<string, ModuleImports>;\n    type ExportValue = Function | Global | Memory | Table;\n    type Exports = Record<string, ExportValue>;\n    class Instance {\n        constructor(module: Module, imports?: Imports);\n        readonly exports: Exports;\n    }\n    interface MemoryDescriptor {\n        initial: number;\n        maximum?: number;\n        shared?: boolean;\n    }\n    class Memory {\n        constructor(descriptor: MemoryDescriptor);\n        readonly buffer: ArrayBuffer;\n        grow(delta: number): number;\n    }\n    type ImportExportKind = \"function\" | \"global\" | \"memory\" | \"table\";\n    interface ModuleExportDescriptor {\n        kind: ImportExportKind;\n        name: string;\n    }\n    interface ModuleImportDescriptor {\n        kind: ImportExportKind;\n        module: string;\n        name: string;\n    }\n    abstract class Module {\n        static customSections(module: Module, sectionName: string): ArrayBuffer[];\n        static exports(module: Module): ModuleExportDescriptor[];\n        static imports(module: Module): ModuleImportDescriptor[];\n    }\n    type TableKind = \"anyfunc\" | \"externref\";\n    interface TableDescriptor {\n        element: TableKind;\n        initial: number;\n        maximum?: number;\n    }\n    class Table {\n        constructor(descriptor: TableDescriptor, value?: any);\n        readonly length: number;\n        get(index: number): any;\n        grow(delta: number, value?: any): number;\n        set(index: number, value?: any): void;\n    }\n    function instantiate(module: Module, imports?: Imports): Promise<Instance>;\n    function validate(bytes: BufferSource): boolean;\n}\n/**\n * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)\n */\ninterface ServiceWorkerGlobalScope extends WorkerGlobalScope {\n    DOMException: typeof DOMException;\n    WorkerGlobalScope: typeof WorkerGlobalScope;\n    btoa(data: string): string;\n    atob(data: string): string;\n    setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n    setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearTimeout(timeoutId: number | null): void;\n    setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n    setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearInterval(timeoutId: number | null): void;\n    queueMicrotask(task: Function): void;\n    structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n    reportError(error: any): void;\n    fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\n    self: ServiceWorkerGlobalScope;\n    crypto: Crypto;\n    caches: CacheStorage;\n    scheduler: Scheduler;\n    performance: Performance;\n    Cloudflare: Cloudflare;\n    readonly origin: string;\n    Event: typeof Event;\n    ExtendableEvent: typeof ExtendableEvent;\n    CustomEvent: typeof CustomEvent;\n    PromiseRejectionEvent: typeof PromiseRejectionEvent;\n    FetchEvent: typeof FetchEvent;\n    TailEvent: typeof TailEvent;\n    TraceEvent: typeof TailEvent;\n    ScheduledEvent: typeof ScheduledEvent;\n    MessageEvent: typeof MessageEvent;\n    CloseEvent: typeof CloseEvent;\n    ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;\n    ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;\n    ReadableStream: typeof ReadableStream;\n    WritableStream: typeof WritableStream;\n    WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;\n    TransformStream: typeof TransformStream;\n    ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;\n    CountQueuingStrategy: typeof CountQueuingStrategy;\n    ErrorEvent: typeof ErrorEvent;\n    MessageChannel: typeof MessageChannel;\n    MessagePort: typeof MessagePort;\n    EventSource: typeof EventSource;\n    ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;\n    ReadableStreamDefaultController: typeof ReadableStreamDefaultController;\n    ReadableByteStreamController: typeof ReadableByteStreamController;\n    WritableStreamDefaultController: typeof WritableStreamDefaultController;\n    TransformStreamDefaultController: typeof TransformStreamDefaultController;\n    CompressionStream: typeof CompressionStream;\n    DecompressionStream: typeof DecompressionStream;\n    TextEncoderStream: typeof TextEncoderStream;\n    TextDecoderStream: typeof TextDecoderStream;\n    Headers: typeof Headers;\n    Body: typeof Body;\n    Request: typeof Request;\n    Response: typeof Response;\n    WebSocket: typeof WebSocket;\n    WebSocketPair: typeof WebSocketPair;\n    WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;\n    AbortController: typeof AbortController;\n    AbortSignal: typeof AbortSignal;\n    TextDecoder: typeof TextDecoder;\n    TextEncoder: typeof TextEncoder;\n    navigator: Navigator;\n    Navigator: typeof Navigator;\n    URL: typeof URL;\n    URLSearchParams: typeof URLSearchParams;\n    URLPattern: typeof URLPattern;\n    Blob: typeof Blob;\n    File: typeof File;\n    FormData: typeof FormData;\n    Crypto: typeof Crypto;\n    SubtleCrypto: typeof SubtleCrypto;\n    CryptoKey: typeof CryptoKey;\n    CacheStorage: typeof CacheStorage;\n    Cache: typeof Cache;\n    FixedLengthStream: typeof FixedLengthStream;\n    IdentityTransformStream: typeof IdentityTransformStream;\n    HTMLRewriter: typeof HTMLRewriter;\n}\ndeclare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\ndeclare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n/**\n * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n */\ndeclare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */\ndeclare function btoa(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */\ndeclare function atob(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */\ndeclare function clearTimeout(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */\ndeclare function clearInterval(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */\ndeclare function queueMicrotask(task: Function): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */\ndeclare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */\ndeclare function reportError(error: any): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */\ndeclare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\ndeclare const self: ServiceWorkerGlobalScope;\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare const crypto: Crypto;\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare const caches: CacheStorage;\ndeclare const scheduler: Scheduler;\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare const performance: Performance;\ndeclare const Cloudflare: Cloudflare;\ndeclare const origin: string;\ndeclare const navigator: Navigator;\ninterface TestController {\n}\ninterface ExecutionContext<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    passThroughOnException(): void;\n    readonly props: Props;\n}\ntype ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;\ntype ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\ntype ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ninterface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {\n    fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;\n    tail?: ExportedHandlerTailHandler<Env, Props>;\n    trace?: ExportedHandlerTraceHandler<Env, Props>;\n    tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;\n    scheduled?: ExportedHandlerScheduledHandler<Env, Props>;\n    test?: ExportedHandlerTestHandler<Env, Props>;\n    email?: EmailExportedHandler<Env, Props>;\n    queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;\n}\ninterface StructuredSerializeOptions {\n    transfer?: any[];\n}\ndeclare abstract class Navigator {\n    sendBeacon(url: string, body?: BodyInit): boolean;\n    readonly userAgent: string;\n    readonly hardwareConcurrency: number;\n    readonly language: string;\n    readonly languages: string[];\n}\ninterface AlarmInvocationInfo {\n    readonly isRetry: boolean;\n    readonly retryCount: number;\n}\ninterface Cloudflare {\n    readonly compatibilityFlags: Record<string, boolean>;\n}\ninterface DurableObject {\n    fetch(request: Request): Response | Promise<Response>;\n    alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n    webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n    webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n    webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n}\ntype DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, \"alarm\" | \"webSocketMessage\" | \"webSocketClose\" | \"webSocketError\"> & {\n    readonly id: DurableObjectId;\n    readonly name?: string;\n};\ninterface DurableObjectId {\n    toString(): string;\n    equals(other: DurableObjectId): boolean;\n    readonly name?: string;\n}\ndeclare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {\n    newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;\n    idFromName(name: string): DurableObjectId;\n    idFromString(id: string): DurableObjectId;\n    get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;\n}\ntype DurableObjectJurisdiction = \"eu\" | \"fedramp\" | \"fedramp-high\";\ninterface DurableObjectNamespaceNewUniqueIdOptions {\n    jurisdiction?: DurableObjectJurisdiction;\n}\ntype DurableObjectLocationHint = \"wnam\" | \"enam\" | \"sam\" | \"weur\" | \"eeur\" | \"apac\" | \"oc\" | \"afr\" | \"me\";\ntype DurableObjectRoutingMode = \"primary-only\";\ninterface DurableObjectNamespaceGetDurableObjectOptions {\n    locationHint?: DurableObjectLocationHint;\n    routingMode?: DurableObjectRoutingMode;\n}\ninterface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {\n}\ninterface DurableObjectState<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    readonly props: Props;\n    readonly id: DurableObjectId;\n    readonly storage: DurableObjectStorage;\n    container?: Container;\n    blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;\n    acceptWebSocket(ws: WebSocket, tags?: string[]): void;\n    getWebSockets(tag?: string): WebSocket[];\n    setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;\n    getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;\n    getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;\n    setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;\n    getHibernatableWebSocketEventTimeout(): number | null;\n    getTags(ws: WebSocket): string[];\n    abort(reason?: string): void;\n}\ninterface DurableObjectTransaction {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    rollback(): void;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n}\ninterface DurableObjectStorage {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    deleteAll(options?: DurableObjectPutOptions): Promise<void>;\n    transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n    sync(): Promise<void>;\n    sql: SqlStorage;\n    kv: SyncKvStorage;\n    transactionSync<T>(closure: () => T): T;\n    getCurrentBookmark(): Promise<string>;\n    getBookmarkForTime(timestamp: number | Date): Promise<string>;\n    onNextSessionRestoreBookmark(bookmark: string): Promise<string>;\n}\ninterface DurableObjectListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetOptions {\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetAlarmOptions {\n    allowConcurrency?: boolean;\n}\ninterface DurableObjectPutOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectSetAlarmOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n}\ndeclare class WebSocketRequestResponsePair {\n    constructor(request: string, response: string);\n    get request(): string;\n    get response(): string;\n}\ninterface AnalyticsEngineDataset {\n    writeDataPoint(event?: AnalyticsEngineDataPoint): void;\n}\ninterface AnalyticsEngineDataPoint {\n    indexes?: ((ArrayBuffer | string) | null)[];\n    doubles?: number[];\n    blobs?: ((ArrayBuffer | string) | null)[];\n}\n/**\n * The **`Event`** interface represents an event which takes place on an `EventTarget`.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)\n */\ndeclare class Event {\n    constructor(type: string, init?: EventInit);\n    /**\n     * The **`type`** read-only property of the Event interface returns a string containing the event's type.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)\n     */\n    get type(): string;\n    /**\n     * The **`eventPhase`** read-only property of the being evaluated.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)\n     */\n    get eventPhase(): number;\n    /**\n     * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)\n     */\n    get composed(): boolean;\n    /**\n     * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)\n     */\n    get bubbles(): boolean;\n    /**\n     * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)\n     */\n    get cancelable(): boolean;\n    /**\n     * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)\n     */\n    get defaultPrevented(): boolean;\n    /**\n     * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)\n     */\n    get returnValue(): boolean;\n    /**\n     * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)\n     */\n    get currentTarget(): EventTarget | undefined;\n    /**\n     * The read-only **`target`** property of the dispatched.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)\n     */\n    get target(): EventTarget | undefined;\n    /**\n     * The deprecated **`Event.srcElement`** is an alias for the Event.target property.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)\n     */\n    get srcElement(): EventTarget | undefined;\n    /**\n     * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)\n     */\n    get timeStamp(): number;\n    /**\n     * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)\n     */\n    get isTrusted(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    get cancelBubble(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    set cancelBubble(value: boolean);\n    /**\n     * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)\n     */\n    stopImmediatePropagation(): void;\n    /**\n     * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)\n     */\n    preventDefault(): void;\n    /**\n     * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)\n     */\n    stopPropagation(): void;\n    /**\n     * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)\n     */\n    composedPath(): EventTarget[];\n    static readonly NONE: number;\n    static readonly CAPTURING_PHASE: number;\n    static readonly AT_TARGET: number;\n    static readonly BUBBLING_PHASE: number;\n}\ninterface EventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n}\ntype EventListener<EventType extends Event = Event> = (event: EventType) => void;\ninterface EventListenerObject<EventType extends Event = Event> {\n    handleEvent(event: EventType): void;\n}\ntype EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;\n/**\n * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)\n */\ndeclare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {\n    constructor();\n    /**\n     * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)\n     */\n    addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\n    /**\n     * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)\n     */\n    removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n    /**\n     * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n     */\n    dispatchEvent(event: EventMap[keyof EventMap]): boolean;\n}\ninterface EventTargetEventListenerOptions {\n    capture?: boolean;\n}\ninterface EventTargetAddEventListenerOptions {\n    capture?: boolean;\n    passive?: boolean;\n    once?: boolean;\n    signal?: AbortSignal;\n}\ninterface EventTargetHandlerObject {\n    handleEvent: (event: Event) => any | undefined;\n}\n/**\n * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)\n */\ndeclare class AbortController {\n    constructor();\n    /**\n     * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)\n     */\n    abort(reason?: any): void;\n}\n/**\n * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)\n */\ndeclare abstract class AbortSignal extends EventTarget {\n    /**\n     * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)\n     */\n    static abort(reason?: any): AbortSignal;\n    /**\n     * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)\n     */\n    static timeout(delay: number): AbortSignal;\n    /**\n     * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)\n     */\n    static any(signals: AbortSignal[]): AbortSignal;\n    /**\n     * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)\n     */\n    get aborted(): boolean;\n    /**\n     * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)\n     */\n    get reason(): any;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    get onabort(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    set onabort(value: any | null);\n    /**\n     * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)\n     */\n    throwIfAborted(): void;\n}\ninterface Scheduler {\n    wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;\n}\ninterface SchedulerWaitOptions {\n    signal?: AbortSignal;\n}\n/**\n * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)\n */\ndeclare abstract class ExtendableEvent extends Event {\n    /**\n     * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)\n     */\n    waitUntil(promise: Promise<any>): void;\n}\n/**\n * The **`CustomEvent`** interface represents events initialized by an application for any purpose.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)\n */\ndeclare class CustomEvent<T = any> extends Event {\n    constructor(type: string, init?: CustomEventCustomEventInit);\n    /**\n     * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)\n     */\n    get detail(): T;\n}\ninterface CustomEventCustomEventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n    detail?: any;\n}\n/**\n * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)\n */\ndeclare class Blob {\n    constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);\n    /**\n     * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)\n     */\n    get size(): number;\n    /**\n     * The **`type`** read-only property of the Blob interface returns the MIME type of the file.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)\n     */\n    get type(): string;\n    /**\n     * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)\n     */\n    slice(start?: number, end?: number, type?: string): Blob;\n    /**\n     * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)\n     */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /**\n     * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)\n     */\n    bytes(): Promise<Uint8Array>;\n    /**\n     * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)\n     */\n    text(): Promise<string>;\n    /**\n     * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)\n     */\n    stream(): ReadableStream;\n}\ninterface BlobOptions {\n    type?: string;\n}\n/**\n * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)\n */\ndeclare class File extends Blob {\n    constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);\n    /**\n     * The **`name`** read-only property of the File interface returns the name of the file represented by a File object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)\n     */\n    get name(): string;\n    /**\n     * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)\n     */\n    get lastModified(): number;\n}\ninterface FileOptions {\n    type?: string;\n    lastModified?: number;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class CacheStorage {\n    /**\n     * The **`open()`** method of the the Cache object matching the `cacheName`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)\n     */\n    open(cacheName: string): Promise<Cache>;\n    readonly default: Cache;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class Cache {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */\n    delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */\n    match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */\n    put(request: RequestInfo | URL, response: Response): Promise<void>;\n}\ninterface CacheQueryOptions {\n    ignoreMethod?: boolean;\n}\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare abstract class Crypto {\n    /**\n     * The **`Crypto.subtle`** read-only property returns a cryptographic operations.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)\n     */\n    get subtle(): SubtleCrypto;\n    /**\n     * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)\n     */\n    getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;\n    /**\n     * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)\n     */\n    randomUUID(): string;\n    DigestStream: typeof DigestStream;\n}\n/**\n * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)\n */\ndeclare abstract class SubtleCrypto {\n    /**\n     * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)\n     */\n    encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)\n     */\n    decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)\n     */\n    sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)\n     */\n    verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;\n    /**\n     * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)\n     */\n    digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)\n     */\n    generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;\n    /**\n     * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)\n     */\n    deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`deriveBits()`** method of the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)\n     */\n    deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;\n    /**\n     * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)\n     */\n    importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)\n     */\n    exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;\n    /**\n     * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)\n     */\n    wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;\n    /**\n     * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)\n     */\n    unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;\n}\n/**\n * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)\n */\ndeclare abstract class CryptoKey {\n    /**\n     * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)\n     */\n    readonly type: string;\n    /**\n     * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)\n     */\n    readonly extractable: boolean;\n    /**\n     * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)\n     */\n    readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;\n    /**\n     * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)\n     */\n    readonly usages: string[];\n}\ninterface CryptoKeyPair {\n    publicKey: CryptoKey;\n    privateKey: CryptoKey;\n}\ninterface JsonWebKey {\n    kty: string;\n    use?: string;\n    key_ops?: string[];\n    alg?: string;\n    ext?: boolean;\n    crv?: string;\n    x?: string;\n    y?: string;\n    d?: string;\n    n?: string;\n    e?: string;\n    p?: string;\n    q?: string;\n    dp?: string;\n    dq?: string;\n    qi?: string;\n    oth?: RsaOtherPrimesInfo[];\n    k?: string;\n}\ninterface RsaOtherPrimesInfo {\n    r?: string;\n    d?: string;\n    t?: string;\n}\ninterface SubtleCryptoDeriveKeyAlgorithm {\n    name: string;\n    salt?: (ArrayBuffer | ArrayBufferView);\n    iterations?: number;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    $public?: CryptoKey;\n    info?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoEncryptAlgorithm {\n    name: string;\n    iv?: (ArrayBuffer | ArrayBufferView);\n    additionalData?: (ArrayBuffer | ArrayBufferView);\n    tagLength?: number;\n    counter?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    label?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoGenerateKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    modulusLength?: number;\n    publicExponent?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    namedCurve?: string;\n}\ninterface SubtleCryptoHashAlgorithm {\n    name: string;\n}\ninterface SubtleCryptoImportKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    length?: number;\n    namedCurve?: string;\n    compressed?: boolean;\n}\ninterface SubtleCryptoSignAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    dataLength?: number;\n    saltLength?: number;\n}\ninterface CryptoKeyKeyAlgorithm {\n    name: string;\n}\ninterface CryptoKeyAesKeyAlgorithm {\n    name: string;\n    length: number;\n}\ninterface CryptoKeyHmacKeyAlgorithm {\n    name: string;\n    hash: CryptoKeyKeyAlgorithm;\n    length: number;\n}\ninterface CryptoKeyRsaKeyAlgorithm {\n    name: string;\n    modulusLength: number;\n    publicExponent: ArrayBuffer | ArrayBufferView;\n    hash?: CryptoKeyKeyAlgorithm;\n}\ninterface CryptoKeyEllipticKeyAlgorithm {\n    name: string;\n    namedCurve: string;\n}\ninterface CryptoKeyArbitraryKeyAlgorithm {\n    name: string;\n    hash?: CryptoKeyKeyAlgorithm;\n    namedCurve?: string;\n    length?: number;\n}\ndeclare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {\n    constructor(algorithm: string | SubtleCryptoHashAlgorithm);\n    readonly digest: Promise<ArrayBuffer>;\n    get bytesWritten(): number | bigint;\n}\n/**\n * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)\n */\ndeclare class TextDecoder {\n    constructor(label?: string, options?: TextDecoderConstructorOptions);\n    /**\n     * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)\n     */\n    decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\n/**\n * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)\n */\ndeclare class TextEncoder {\n    constructor();\n    /**\n     * The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)\n     */\n    encode(input?: string): Uint8Array;\n    /**\n     * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)\n     */\n    encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;\n    get encoding(): string;\n}\ninterface TextDecoderConstructorOptions {\n    fatal: boolean;\n    ignoreBOM: boolean;\n}\ninterface TextDecoderDecodeOptions {\n    stream: boolean;\n}\ninterface TextEncoderEncodeIntoResult {\n    read: number;\n    written: number;\n}\n/**\n * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)\n */\ndeclare class ErrorEvent extends Event {\n    constructor(type: string, init?: ErrorEventErrorEventInit);\n    /**\n     * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)\n     */\n    get filename(): string;\n    /**\n     * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)\n     */\n    get message(): string;\n    /**\n     * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)\n     */\n    get lineno(): number;\n    /**\n     * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)\n     */\n    get colno(): number;\n    /**\n     * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)\n     */\n    get error(): any;\n}\ninterface ErrorEventErrorEventInit {\n    message?: string;\n    filename?: string;\n    lineno?: number;\n    colno?: number;\n    error?: any;\n}\n/**\n * The **`MessageEvent`** interface represents a message received by a target object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)\n */\ndeclare class MessageEvent extends Event {\n    constructor(type: string, initializer: MessageEventInit);\n    /**\n     * The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)\n     */\n    readonly data: any;\n    /**\n     * The **`origin`** read-only property of the origin of the message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)\n     */\n    readonly origin: string | null;\n    /**\n     * The **`lastEventId`** read-only property of the unique ID for the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)\n     */\n    readonly lastEventId: string;\n    /**\n     * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)\n     */\n    readonly source: MessagePort | null;\n    /**\n     * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)\n     */\n    readonly ports: MessagePort[];\n}\ninterface MessageEventInit {\n    data: ArrayBuffer | string;\n}\n/**\n * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)\n */\ndeclare abstract class PromiseRejectionEvent extends Event {\n    /**\n     * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)\n     */\n    readonly promise: Promise<any>;\n    /**\n     * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)\n     */\n    readonly reason: any;\n}\n/**\n * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)\n */\ndeclare class FormData {\n    constructor();\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string | Blob): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: Blob, filename?: string): void;\n    /**\n     * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)\n     */\n    delete(name: string): void;\n    /**\n     * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)\n     */\n    get(name: string): (File | string) | null;\n    /**\n     * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)\n     */\n    getAll(name: string): (File | string)[];\n    /**\n     * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string | Blob): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: Blob, filename?: string): void;\n    /* Returns an array of key, value pairs for every entry in the list. */\n    entries(): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n    /* Returns a list of keys in the list. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the list. */\n    values(): IterableIterator<(File | string)>;\n    forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n}\ninterface ContentOptions {\n    html?: boolean;\n}\ndeclare class HTMLRewriter {\n    constructor();\n    on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;\n    onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;\n    transform(response: Response): Response;\n}\ninterface HTMLRewriterElementContentHandlers {\n    element?(element: Element): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(element: Text): void | Promise<void>;\n}\ninterface HTMLRewriterDocumentContentHandlers {\n    doctype?(doctype: Doctype): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(text: Text): void | Promise<void>;\n    end?(end: DocumentEnd): void | Promise<void>;\n}\ninterface Doctype {\n    readonly name: string | null;\n    readonly publicId: string | null;\n    readonly systemId: string | null;\n}\ninterface Element {\n    tagName: string;\n    readonly attributes: IterableIterator<string[]>;\n    readonly removed: boolean;\n    readonly namespaceURI: string;\n    getAttribute(name: string): string | null;\n    hasAttribute(name: string): boolean;\n    setAttribute(name: string, value: string): Element;\n    removeAttribute(name: string): Element;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    append(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    remove(): Element;\n    removeAndKeepContent(): Element;\n    setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;\n}\ninterface EndTag {\n    name: string;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    remove(): EndTag;\n}\ninterface Comment {\n    text: string;\n    readonly removed: boolean;\n    before(content: string, options?: ContentOptions): Comment;\n    after(content: string, options?: ContentOptions): Comment;\n    replace(content: string, options?: ContentOptions): Comment;\n    remove(): Comment;\n}\ninterface Text {\n    readonly text: string;\n    readonly lastInTextNode: boolean;\n    readonly removed: boolean;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    remove(): Text;\n}\ninterface DocumentEnd {\n    append(content: string, options?: ContentOptions): DocumentEnd;\n}\n/**\n * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)\n */\ndeclare abstract class FetchEvent extends ExtendableEvent {\n    /**\n     * The **`request`** read-only property of the the event handler.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)\n     */\n    readonly request: Request;\n    /**\n     * The **`respondWith()`** method of allows you to provide a promise for a Response yourself.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)\n     */\n    respondWith(promise: Response | Promise<Response>): void;\n    passThroughOnException(): void;\n}\ntype HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;\n/**\n * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)\n */\ndeclare class Headers {\n    constructor(init?: HeadersInit);\n    /**\n     * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)\n     */\n    get(name: string): string | null;\n    getAll(name: string): string[];\n    /**\n     * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)\n     */\n    getSetCookie(): string[];\n    /**\n     * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)\n     */\n    delete(name: string): void;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;\n    /* Returns an iterator allowing to go through all key/value pairs contained in this object. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */\n    keys(): IterableIterator<string>;\n    /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */\n    values(): IterableIterator<string>;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ntype BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;\ndeclare abstract class Body {\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */\n    get body(): ReadableStream | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */\n    get bodyUsed(): boolean;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */\n    bytes(): Promise<Uint8Array>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */\n    text(): Promise<string>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */\n    json<T>(): Promise<T>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */\n    formData(): Promise<FormData>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */\n    blob(): Promise<Blob>;\n}\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ndeclare var Response: {\n    prototype: Response;\n    new (body?: BodyInit | null, init?: ResponseInit): Response;\n    error(): Response;\n    redirect(url: string, status?: number): Response;\n    json(any: any, maybeInit?: (ResponseInit | Response)): Response;\n};\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ninterface Response extends Body {\n    /**\n     * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)\n     */\n    clone(): Response;\n    /**\n     * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)\n     */\n    status: number;\n    /**\n     * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)\n     */\n    statusText: string;\n    /**\n     * The **`headers`** read-only property of the with the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)\n     */\n    ok: boolean;\n    /**\n     * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)\n     */\n    redirected: boolean;\n    /**\n     * The **`url`** read-only property of the Response interface contains the URL of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)\n     */\n    url: string;\n    webSocket: WebSocket | null;\n    cf: any | undefined;\n    /**\n     * The **`type`** read-only property of the Response interface contains the type of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)\n     */\n    type: \"default\" | \"error\";\n}\ninterface ResponseInit {\n    status?: number;\n    statusText?: string;\n    headers?: HeadersInit;\n    cf?: any;\n    webSocket?: (WebSocket | null);\n    encodeBody?: \"automatic\" | \"manual\";\n}\ntype RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ndeclare var Request: {\n    prototype: Request;\n    new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;\n};\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ninterface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {\n    /**\n     * The **`clone()`** method of the Request interface creates a copy of the current `Request` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)\n     */\n    clone(): Request<CfHostMetadata, Cf>;\n    /**\n     * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)\n     */\n    method: string;\n    /**\n     * The **`url`** read-only property of the Request interface contains the URL of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)\n     */\n    url: string;\n    /**\n     * The **`headers`** read-only property of the with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)\n     */\n    redirect: string;\n    fetcher: Fetcher | null;\n    /**\n     * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)\n     */\n    signal: AbortSignal;\n    cf?: Cf;\n    /**\n     * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)\n     */\n    integrity: string;\n    /**\n     * The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)\n     */\n    keepalive: boolean;\n    /**\n     * The **`cache`** read-only property of the Request interface contains the cache mode of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)\n     */\n    cache?: \"no-store\" | \"no-cache\";\n}\ninterface RequestInit<Cf = CfProperties> {\n    /* A string to set request's method. */\n    method?: string;\n    /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */\n    headers?: HeadersInit;\n    /* A BodyInit object or null to set request's body. */\n    body?: BodyInit | null;\n    /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */\n    redirect?: string;\n    fetcher?: (Fetcher | null);\n    cf?: Cf;\n    /* A string indicating how the request will interact with the browser's cache to set request's cache. */\n    cache?: \"no-store\" | \"no-cache\";\n    /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */\n    integrity?: string;\n    /* An AbortSignal to set request's signal. */\n    signal?: (AbortSignal | null);\n    encodeResponseBody?: \"automatic\" | \"manual\";\n}\ntype Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;\ntype Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | \"fetch\" | \"connect\"> : unknown) & {\n    fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;\n    connect(address: SocketAddress | string, options?: SocketOptions): Socket;\n};\ninterface KVNamespaceListKey<Metadata, Key extends string = string> {\n    name: Key;\n    expiration?: number;\n    metadata?: Metadata;\n}\ntype KVNamespaceListResult<Metadata, Key extends string = string> = {\n    list_complete: false;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cursor: string;\n    cacheStatus: string | null;\n} | {\n    list_complete: true;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cacheStatus: string | null;\n};\ninterface KVNamespace<Key extends string = string> {\n    get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;\n    get(key: Key, type: \"text\"): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, type: \"json\"): Promise<ExpectedValue | null>;\n    get(key: Key, type: \"arrayBuffer\"): Promise<ArrayBuffer | null>;\n    get(key: Key, type: \"stream\"): Promise<ReadableStream | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"text\">): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<\"json\">): Promise<ExpectedValue | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<ArrayBuffer | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"stream\">): Promise<ReadableStream | null>;\n    get(key: Array<Key>, type: \"text\"): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, ExpectedValue | null>>;\n    get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;\n    get(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, ExpectedValue | null>>;\n    list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;\n    put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;\n    getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"text\"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: \"json\"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"arrayBuffer\"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"stream\"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"text\">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"json\">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"stream\">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, type: \"text\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    delete(key: Key): Promise<void>;\n}\ninterface KVNamespaceListOptions {\n    limit?: number;\n    prefix?: (string | null);\n    cursor?: (string | null);\n}\ninterface KVNamespaceGetOptions<Type> {\n    type: Type;\n    cacheTtl?: number;\n}\ninterface KVNamespacePutOptions {\n    expiration?: number;\n    expirationTtl?: number;\n    metadata?: (any | null);\n}\ninterface KVNamespaceGetWithMetadataResult<Value, Metadata> {\n    value: Value | null;\n    metadata: Metadata | null;\n    cacheStatus: string | null;\n}\ntype QueueContentType = \"text\" | \"bytes\" | \"json\" | \"v8\";\ninterface Queue<Body = unknown> {\n    send(message: Body, options?: QueueSendOptions): Promise<void>;\n    sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>;\n}\ninterface QueueSendOptions {\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueSendBatchOptions {\n    delaySeconds?: number;\n}\ninterface MessageSendRequest<Body = unknown> {\n    body: Body;\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueRetryOptions {\n    delaySeconds?: number;\n}\ninterface Message<Body = unknown> {\n    readonly id: string;\n    readonly timestamp: Date;\n    readonly body: Body;\n    readonly attempts: number;\n    retry(options?: QueueRetryOptions): void;\n    ack(): void;\n}\ninterface QueueEvent<Body = unknown> extends ExtendableEvent {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface MessageBatch<Body = unknown> {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface R2Error extends Error {\n    readonly name: string;\n    readonly code: number;\n    readonly message: string;\n    readonly action: string;\n    readonly stack: any;\n}\ninterface R2ListOptions {\n    limit?: number;\n    prefix?: string;\n    cursor?: string;\n    delimiter?: string;\n    startAfter?: string;\n    include?: (\"httpMetadata\" | \"customMetadata\")[];\n}\ndeclare abstract class R2Bucket {\n    head(key: string): Promise<R2Object | null>;\n    get(key: string, options: R2GetOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2ObjectBody | R2Object | null>;\n    get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2Object | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;\n    createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;\n    resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;\n    delete(keys: string | string[]): Promise<void>;\n    list(options?: R2ListOptions): Promise<R2Objects>;\n}\ninterface R2MultipartUpload {\n    readonly key: string;\n    readonly uploadId: string;\n    uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;\n    abort(): Promise<void>;\n    complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;\n}\ninterface R2UploadedPart {\n    partNumber: number;\n    etag: string;\n}\ndeclare abstract class R2Object {\n    readonly key: string;\n    readonly version: string;\n    readonly size: number;\n    readonly etag: string;\n    readonly httpEtag: string;\n    readonly checksums: R2Checksums;\n    readonly uploaded: Date;\n    readonly httpMetadata?: R2HTTPMetadata;\n    readonly customMetadata?: Record<string, string>;\n    readonly range?: R2Range;\n    readonly storageClass: string;\n    readonly ssecKeyMd5?: string;\n    writeHttpMetadata(headers: Headers): void;\n}\ninterface R2ObjectBody extends R2Object {\n    get body(): ReadableStream;\n    get bodyUsed(): boolean;\n    arrayBuffer(): Promise<ArrayBuffer>;\n    bytes(): Promise<Uint8Array>;\n    text(): Promise<string>;\n    json<T>(): Promise<T>;\n    blob(): Promise<Blob>;\n}\ntype R2Range = {\n    offset: number;\n    length?: number;\n} | {\n    offset?: number;\n    length: number;\n} | {\n    suffix: number;\n};\ninterface R2Conditional {\n    etagMatches?: string;\n    etagDoesNotMatch?: string;\n    uploadedBefore?: Date;\n    uploadedAfter?: Date;\n    secondsGranularity?: boolean;\n}\ninterface R2GetOptions {\n    onlyIf?: (R2Conditional | Headers);\n    range?: (R2Range | Headers);\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2PutOptions {\n    onlyIf?: (R2Conditional | Headers);\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    md5?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha1?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha256?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha384?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha512?: ((ArrayBuffer | ArrayBufferView) | string);\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2MultipartOptions {\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2Checksums {\n    readonly md5?: ArrayBuffer;\n    readonly sha1?: ArrayBuffer;\n    readonly sha256?: ArrayBuffer;\n    readonly sha384?: ArrayBuffer;\n    readonly sha512?: ArrayBuffer;\n    toJSON(): R2StringChecksums;\n}\ninterface R2StringChecksums {\n    md5?: string;\n    sha1?: string;\n    sha256?: string;\n    sha384?: string;\n    sha512?: string;\n}\ninterface R2HTTPMetadata {\n    contentType?: string;\n    contentLanguage?: string;\n    contentDisposition?: string;\n    contentEncoding?: string;\n    cacheControl?: string;\n    cacheExpiry?: Date;\n}\ntype R2Objects = {\n    objects: R2Object[];\n    delimitedPrefixes: string[];\n} & ({\n    truncated: true;\n    cursor: string;\n} | {\n    truncated: false;\n});\ninterface R2UploadPartOptions {\n    ssecKey?: (ArrayBuffer | string);\n}\ndeclare abstract class ScheduledEvent extends ExtendableEvent {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface ScheduledController {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface QueuingStrategy<T = any> {\n    highWaterMark?: (number | bigint);\n    size?: (chunk: T) => number | bigint;\n}\ninterface UnderlyingSink<W = any> {\n    type?: string;\n    start?: (controller: WritableStreamDefaultController) => void | Promise<void>;\n    write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;\n    abort?: (reason: any) => void | Promise<void>;\n    close?: () => void | Promise<void>;\n}\ninterface UnderlyingByteSource {\n    type: \"bytes\";\n    autoAllocateChunkSize?: number;\n    start?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    pull?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n}\ninterface UnderlyingSource<R = any> {\n    type?: \"\" | undefined;\n    start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: (number | bigint);\n}\ninterface Transformer<I = any, O = any> {\n    readableType?: string;\n    writableType?: string;\n    start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: number;\n}\ninterface StreamPipeOptions {\n    preventAbort?: boolean;\n    preventCancel?: boolean;\n    /**\n     * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     *\n     * Errors and closures of the source and destination streams propagate as follows:\n     *\n     * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.\n     *\n     * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.\n     *\n     * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.\n     *\n     * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.\n     *\n     * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.\n     */\n    preventClose?: boolean;\n    signal?: AbortSignal;\n}\ntype ReadableStreamReadResult<R = any> = {\n    done: false;\n    value: R;\n} | {\n    done: true;\n    value?: undefined;\n};\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ninterface ReadableStream<R = any> {\n    /**\n     * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)\n     */\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(): ReadableStreamDefaultReader<R>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;\n    /**\n     * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)\n     */\n    pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;\n    /**\n     * The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)\n     */\n    pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;\n    /**\n     * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)\n     */\n    tee(): [\n        ReadableStream<R>,\n        ReadableStream<R>\n    ];\n    values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n    [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n}\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ndeclare const ReadableStream: {\n    prototype: ReadableStream;\n    new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;\n    new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;\n};\n/**\n * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)\n */\ndeclare class ReadableStreamDefaultReader<R = any> {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)\n     */\n    read(): Promise<ReadableStreamReadResult<R>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)\n */\ndeclare class ReadableStreamBYOBReader {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)\n     */\n    read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)\n     */\n    releaseLock(): void;\n    readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;\n}\ninterface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {\n    min?: number;\n}\ninterface ReadableStreamGetReaderOptions {\n    /**\n     * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.\n     *\n     * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.\n     */\n    mode: \"byob\";\n}\n/**\n * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)\n */\ndeclare abstract class ReadableStreamBYOBRequest {\n    /**\n     * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)\n     */\n    get view(): Uint8Array | null;\n    /**\n     * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)\n     */\n    respond(bytesWritten: number): void;\n    /**\n     * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)\n     */\n    respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;\n    get atLeast(): number | null;\n}\n/**\n * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)\n */\ndeclare abstract class ReadableStreamDefaultController<R = any> {\n    /**\n     * The **`desiredSize`** read-only property of the required to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: R): void;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)\n */\ndeclare abstract class ReadableByteStreamController {\n    /**\n     * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)\n     */\n    get byobRequest(): ReadableStreamBYOBRequest | null;\n    /**\n     * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)\n     */\n    enqueue(chunk: ArrayBuffer | ArrayBufferView): void;\n    /**\n     * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)\n */\ndeclare abstract class WritableStreamDefaultController {\n    /**\n     * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)\n     */\n    error(reason?: any): void;\n}\n/**\n * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)\n */\ndeclare abstract class TransformStreamDefaultController<O = any> {\n    /**\n     * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: O): void;\n    /**\n     * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)\n     */\n    error(reason: any): void;\n    /**\n     * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)\n     */\n    terminate(): void;\n}\ninterface ReadableWritablePair<R = any, W = any> {\n    readable: ReadableStream<R>;\n    /**\n     * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     */\n    writable: WritableStream<W>;\n}\n/**\n * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)\n */\ndeclare class WritableStream<W = any> {\n    constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);\n    /**\n     * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the WritableStream interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)\n     */\n    getWriter(): WritableStreamDefaultWriter<W>;\n}\n/**\n * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)\n */\ndeclare class WritableStreamDefaultWriter<W = any> {\n    constructor(stream: WritableStream);\n    /**\n     * The **`closed`** read-only property of the the stream errors or the writer's lock is released.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)\n     */\n    get closed(): Promise<void>;\n    /**\n     * The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)\n     */\n    get ready(): Promise<void>;\n    /**\n     * The **`desiredSize`** read-only property of the to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`write()`** method of the operation.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)\n     */\n    write(chunk?: W): Promise<void>;\n    /**\n     * The **`releaseLock()`** method of the corresponding stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)\n */\ndeclare class TransformStream<I = any, O = any> {\n    constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);\n    /**\n     * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)\n     */\n    get readable(): ReadableStream<O>;\n    /**\n     * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)\n     */\n    get writable(): WritableStream<I>;\n}\ndeclare class FixedLengthStream extends IdentityTransformStream {\n    constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ndeclare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ninterface IdentityTransformStreamQueuingStrategy {\n    highWaterMark?: (number | bigint);\n}\ninterface ReadableStreamValuesOptions {\n    preventCancel?: boolean;\n}\n/**\n * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)\n */\ndeclare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)\n */\ndeclare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)\n */\ndeclare class TextEncoderStream extends TransformStream<string, Uint8Array> {\n    constructor();\n    get encoding(): string;\n}\n/**\n * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)\n */\ndeclare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {\n    constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\ninterface TextDecoderStreamTextDecoderStreamInit {\n    fatal?: boolean;\n    ignoreBOM?: boolean;\n}\n/**\n * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)\n */\ndeclare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\n/**\n * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)\n */\ndeclare class CountQueuingStrategy implements QueuingStrategy {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\ninterface QueuingStrategyInit {\n    /**\n     * Creates a new ByteLengthQueuingStrategy with the provided high water mark.\n     *\n     * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.\n     */\n    highWaterMark: number;\n}\ninterface ScriptVersion {\n    id?: string;\n    tag?: string;\n    message?: string;\n}\ndeclare abstract class TailEvent extends ExtendableEvent {\n    readonly events: TraceItem[];\n    readonly traces: TraceItem[];\n}\ninterface TraceItem {\n    readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;\n    readonly eventTimestamp: number | null;\n    readonly logs: TraceLog[];\n    readonly exceptions: TraceException[];\n    readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];\n    readonly scriptName: string | null;\n    readonly entrypoint?: string;\n    readonly scriptVersion?: ScriptVersion;\n    readonly dispatchNamespace?: string;\n    readonly scriptTags?: string[];\n    readonly durableObjectId?: string;\n    readonly outcome: string;\n    readonly executionModel: string;\n    readonly truncated: boolean;\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface TraceItemAlarmEventInfo {\n    readonly scheduledTime: Date;\n}\ninterface TraceItemCustomEventInfo {\n}\ninterface TraceItemScheduledEventInfo {\n    readonly scheduledTime: number;\n    readonly cron: string;\n}\ninterface TraceItemQueueEventInfo {\n    readonly queue: string;\n    readonly batchSize: number;\n}\ninterface TraceItemEmailEventInfo {\n    readonly mailFrom: string;\n    readonly rcptTo: string;\n    readonly rawSize: number;\n}\ninterface TraceItemTailEventInfo {\n    readonly consumedEvents: TraceItemTailEventInfoTailItem[];\n}\ninterface TraceItemTailEventInfoTailItem {\n    readonly scriptName: string | null;\n}\ninterface TraceItemFetchEventInfo {\n    readonly response?: TraceItemFetchEventInfoResponse;\n    readonly request: TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoRequest {\n    readonly cf?: any;\n    readonly headers: Record<string, string>;\n    readonly method: string;\n    readonly url: string;\n    getUnredacted(): TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoResponse {\n    readonly status: number;\n}\ninterface TraceItemJsRpcEventInfo {\n    readonly rpcMethod: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfo {\n    readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;\n}\ninterface TraceItemHibernatableWebSocketEventInfoMessage {\n    readonly webSocketEventType: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfoClose {\n    readonly webSocketEventType: string;\n    readonly code: number;\n    readonly wasClean: boolean;\n}\ninterface TraceItemHibernatableWebSocketEventInfoError {\n    readonly webSocketEventType: string;\n}\ninterface TraceLog {\n    readonly timestamp: number;\n    readonly level: string;\n    readonly message: any;\n}\ninterface TraceException {\n    readonly timestamp: number;\n    readonly message: string;\n    readonly name: string;\n    readonly stack?: string;\n}\ninterface TraceDiagnosticChannelEvent {\n    readonly timestamp: number;\n    readonly channel: string;\n    readonly message: any;\n}\ninterface TraceMetrics {\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface UnsafeTraceMetrics {\n    fromTrace(item: TraceItem): TraceMetrics;\n}\n/**\n * The **`URL`** interface is used to parse, construct, normalize, and encode URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)\n */\ndeclare class URL {\n    constructor(url: string | URL, base?: string | URL);\n    /**\n     * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)\n     */\n    get origin(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    get href(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    set href(value: string);\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    get protocol(): string;\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    set protocol(value: string);\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    get username(): string;\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    set username(value: string);\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    get password(): string;\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    set password(value: string);\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    get host(): string;\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    set host(value: string);\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    get hostname(): string;\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    set hostname(value: string);\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    get port(): string;\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    set port(value: string);\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    get pathname(): string;\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    set pathname(value: string);\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    get search(): string;\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    set search(value: string);\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    get hash(): string;\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    set hash(value: string);\n    /**\n     * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)\n     */\n    get searchParams(): URLSearchParams;\n    /**\n     * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)\n     */\n    toJSON(): string;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    /**\n     * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)\n     */\n    static canParse(url: string, base?: string): boolean;\n    /**\n     * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)\n     */\n    static parse(url: string, base?: string): URL | null;\n    /**\n     * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)\n     */\n    static createObjectURL(object: File | Blob): string;\n    /**\n     * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)\n     */\n    static revokeObjectURL(object_url: string): void;\n}\n/**\n * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)\n */\ndeclare class URLSearchParams {\n    constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));\n    /**\n     * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)\n     */\n    get size(): number;\n    /**\n     * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)\n     */\n    delete(name: string, value?: string): void;\n    /**\n     * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)\n     */\n    get(name: string): string | null;\n    /**\n     * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)\n     */\n    getAll(name: string): string[];\n    /**\n     * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)\n     */\n    has(name: string, value?: string): boolean;\n    /**\n     * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)\n     */\n    sort(): void;\n    /* Returns an array of key, value pairs for every entry in the search params. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns a list of keys in the search params. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the search params. */\n    values(): IterableIterator<string>;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ndeclare class URLPattern {\n    constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);\n    get protocol(): string;\n    get username(): string;\n    get password(): string;\n    get hostname(): string;\n    get port(): string;\n    get pathname(): string;\n    get search(): string;\n    get hash(): string;\n    get hasRegExpGroups(): boolean;\n    test(input?: (string | URLPatternInit), baseURL?: string): boolean;\n    exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;\n}\ninterface URLPatternInit {\n    protocol?: string;\n    username?: string;\n    password?: string;\n    hostname?: string;\n    port?: string;\n    pathname?: string;\n    search?: string;\n    hash?: string;\n    baseURL?: string;\n}\ninterface URLPatternComponentResult {\n    input: string;\n    groups: Record<string, string>;\n}\ninterface URLPatternResult {\n    inputs: (string | URLPatternInit)[];\n    protocol: URLPatternComponentResult;\n    username: URLPatternComponentResult;\n    password: URLPatternComponentResult;\n    hostname: URLPatternComponentResult;\n    port: URLPatternComponentResult;\n    pathname: URLPatternComponentResult;\n    search: URLPatternComponentResult;\n    hash: URLPatternComponentResult;\n}\ninterface URLPatternOptions {\n    ignoreCase?: boolean;\n}\n/**\n * A `CloseEvent` is sent to clients using WebSockets when the connection is closed.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)\n */\ndeclare class CloseEvent extends Event {\n    constructor(type: string, initializer?: CloseEventInit);\n    /**\n     * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)\n     */\n    readonly code: number;\n    /**\n     * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)\n     */\n    readonly reason: string;\n    /**\n     * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)\n     */\n    readonly wasClean: boolean;\n}\ninterface CloseEventInit {\n    code?: number;\n    reason?: string;\n    wasClean?: boolean;\n}\ntype WebSocketEventMap = {\n    close: CloseEvent;\n    message: MessageEvent;\n    open: Event;\n    error: ErrorEvent;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ndeclare var WebSocket: {\n    prototype: WebSocket;\n    new (url: string, protocols?: (string[] | string)): WebSocket;\n    readonly READY_STATE_CONNECTING: number;\n    readonly CONNECTING: number;\n    readonly READY_STATE_OPEN: number;\n    readonly OPEN: number;\n    readonly READY_STATE_CLOSING: number;\n    readonly CLOSING: number;\n    readonly READY_STATE_CLOSED: number;\n    readonly CLOSED: number;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ninterface WebSocket extends EventTarget<WebSocketEventMap> {\n    accept(options?: WebSocketAcceptOptions): void;\n    /**\n     * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)\n     */\n    send(message: (ArrayBuffer | ArrayBufferView) | string): void;\n    /**\n     * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)\n     */\n    close(code?: number, reason?: string): void;\n    serializeAttachment(attachment: any): void;\n    deserializeAttachment(): any | null;\n    /**\n     * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)\n     */\n    readyState: number;\n    /**\n     * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)\n     */\n    url: string | null;\n    /**\n     * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)\n     */\n    protocol: string | null;\n    /**\n     * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)\n     */\n    extensions: string | null;\n    /**\n     * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)\n     */\n    binaryType: \"blob\" | \"arraybuffer\";\n}\ninterface WebSocketAcceptOptions {\n    /**\n     * When set to `true`, receiving a server-initiated WebSocket Close frame will not\n     * automatically send a reciprocal Close frame, leaving the connection in a half-open\n     * state. This is useful for proxying scenarios where you need to coordinate closing\n     * both sides independently. Defaults to `false` when the\n     * `no_web_socket_half_open_by_default` compatibility flag is enabled.\n     */\n    allowHalfOpen?: boolean;\n}\ndeclare const WebSocketPair: {\n    new (): {\n        0: WebSocket;\n        1: WebSocket;\n    };\n};\ninterface SqlStorage {\n    exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;\n    get databaseSize(): number;\n    Cursor: typeof SqlStorageCursor;\n    Statement: typeof SqlStorageStatement;\n}\ndeclare abstract class SqlStorageStatement {\n}\ntype SqlStorageValue = ArrayBuffer | string | number | null;\ndeclare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {\n    next(): {\n        done?: false;\n        value: T;\n    } | {\n        done: true;\n        value?: never;\n    };\n    toArray(): T[];\n    one(): T;\n    raw<U extends SqlStorageValue[]>(): IterableIterator<U>;\n    columnNames: string[];\n    get rowsRead(): number;\n    get rowsWritten(): number;\n    [Symbol.iterator](): IterableIterator<T>;\n}\ninterface Socket {\n    get readable(): ReadableStream;\n    get writable(): WritableStream;\n    get closed(): Promise<void>;\n    get opened(): Promise<SocketInfo>;\n    get upgraded(): boolean;\n    get secureTransport(): \"on\" | \"off\" | \"starttls\";\n    close(): Promise<void>;\n    startTls(options?: TlsOptions): Socket;\n}\ninterface SocketOptions {\n    secureTransport?: string;\n    allowHalfOpen: boolean;\n    highWaterMark?: (number | bigint);\n}\ninterface SocketAddress {\n    hostname: string;\n    port: number;\n}\ninterface TlsOptions {\n    expectedServerHostname?: string;\n}\ninterface SocketInfo {\n    remoteAddress?: string;\n    localAddress?: string;\n}\n/**\n * The **`EventSource`** interface is web content's interface to server-sent events.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)\n */\ndeclare class EventSource extends EventTarget {\n    constructor(url: string, init?: EventSourceEventSourceInit);\n    /**\n     * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)\n     */\n    close(): void;\n    /**\n     * The **`url`** read-only property of the URL of the source.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)\n     */\n    get url(): string;\n    /**\n     * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)\n     */\n    get withCredentials(): boolean;\n    /**\n     * The **`readyState`** read-only property of the connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)\n     */\n    get readyState(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    get onopen(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    set onopen(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    get onmessage(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    set onmessage(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    get onerror(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    set onerror(value: any | null);\n    static readonly CONNECTING: number;\n    static readonly OPEN: number;\n    static readonly CLOSED: number;\n    static from(stream: ReadableStream): EventSource;\n}\ninterface EventSourceEventSourceInit {\n    withCredentials?: boolean;\n    fetcher?: Fetcher;\n}\ninterface Container {\n    get running(): boolean;\n    start(options?: ContainerStartupOptions): void;\n    monitor(): Promise<void>;\n    destroy(error?: any): Promise<void>;\n    signal(signo: number): void;\n    getTcpPort(port: number): Fetcher;\n    setInactivityTimeout(durationMs: number | bigint): Promise<void>;\n    interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;\n    interceptAllOutboundHttp(binding: Fetcher): Promise<void>;\n}\ninterface ContainerStartupOptions {\n    entrypoint?: string[];\n    enableInternet: boolean;\n    env?: Record<string, string>;\n    hardTimeout?: (number | bigint);\n}\n/**\n * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)\n */\ndeclare abstract class MessagePort extends EventTarget {\n    /**\n     * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)\n     */\n    postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;\n    /**\n     * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)\n     */\n    close(): void;\n    /**\n     * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)\n     */\n    start(): void;\n    get onmessage(): any | null;\n    set onmessage(value: any | null);\n}\n/**\n * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)\n */\ndeclare class MessageChannel {\n    constructor();\n    /**\n     * The **`port1`** read-only property of the the port attached to the context that originated the channel.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)\n     */\n    readonly port1: MessagePort;\n    /**\n     * The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)\n     */\n    readonly port2: MessagePort;\n}\ninterface MessagePortPostMessageOptions {\n    transfer?: any[];\n}\ntype LoopbackForExport<T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub<InstanceType<T>> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass<InstanceType<T>> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;\ntype LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {\n    props?: Props;\n}) => Fetcher<T> : (opts: {\n    props?: any;\n}) => Fetcher<T>);\ntype LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {\n    props?: Props;\n}) => DurableObjectClass<T> : (opts: {\n    props?: any;\n}) => DurableObjectClass<T>);\ninterface SyncKvStorage {\n    get<T = unknown>(key: string): T | undefined;\n    list<T = unknown>(options?: SyncKvListOptions): Iterable<[\n        string,\n        T\n    ]>;\n    put<T>(key: string, value: T): void;\n    delete(key: string): boolean;\n}\ninterface SyncKvListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n}\ninterface WorkerStub {\n    getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;\n}\ninterface WorkerStubEntrypointOptions {\n    props?: any;\n}\ninterface WorkerLoader {\n    get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;\n    load(code: WorkerLoaderWorkerCode): WorkerStub;\n}\ninterface WorkerLoaderModule {\n    js?: string;\n    cjs?: string;\n    text?: string;\n    data?: ArrayBuffer;\n    json?: any;\n    py?: string;\n    wasm?: ArrayBuffer;\n}\ninterface WorkerLoaderWorkerCode {\n    compatibilityDate: string;\n    compatibilityFlags?: string[];\n    allowExperimental?: boolean;\n    mainModule: string;\n    modules: Record<string, WorkerLoaderModule | string>;\n    env?: any;\n    globalOutbound?: (Fetcher | null);\n    tails?: Fetcher[];\n    streamingTails?: Fetcher[];\n}\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare abstract class Performance {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */\n    get timeOrigin(): number;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */\n    now(): number;\n    /**\n     * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)\n     */\n    toJSON(): object;\n}\n// AI Search V2 API Error Interfaces\ninterface AiSearchInternalError extends Error {\n}\ninterface AiSearchNotFoundError extends Error {\n}\ninterface AiSearchNameNotSetError extends Error {\n}\n// AI Search V2 Request Types\ntype AiSearchSearchRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            /** Maximum number of results (1-50, default 10) */\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            /** Context expansion (0-3, default 0) */\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            /** Enable reranking (default false) */\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n};\ntype AiSearchChatCompletionsRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    model?: string;\n    stream?: boolean;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            match_threshold?: number;\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n    [key: string]: unknown;\n};\n// AI Search V2 Response Types\ntype AiSearchSearchResponse = {\n    search_query: string;\n    chunks: Array<{\n        id: string;\n        type: string;\n        /** Match score (0-1) */\n        score: number;\n        text: string;\n        item: {\n            timestamp?: number;\n            key: string;\n            metadata?: Record<string, unknown>;\n        };\n        scoring_details?: {\n            /** Keyword match score (0-1) */\n            keyword_score?: number;\n            /** Vector similarity score (0-1) */\n            vector_score?: number;\n        };\n    }>;\n};\ntype AiSearchListResponse = Array<{\n    id: string;\n    internal_id?: string;\n    account_id?: string;\n    account_tag?: string;\n    /** Whether the instance is enabled (default true) */\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n}>;\ntype AiSearchConfig = {\n    /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */\n    id: string;\n    type: 'r2' | 'web-crawler';\n    source: string;\n    source_params?: object;\n    /** Token ID (UUID format) */\n    token_id?: string;\n    ai_gateway_id?: string;\n    /** Enable query rewriting (default false) */\n    rewrite_query?: boolean;\n    /** Enable reranking (default false) */\n    reranking?: boolean;\n    embedding_model?: string;\n    ai_search_model?: string;\n};\ntype AiSearchInstance = {\n    id: string;\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n};\n// AI Search Instance Service - Instance-level operations\ndeclare abstract class AiSearchInstanceService {\n    /**\n     * Search the AI Search instance for relevant chunks.\n     * @param params Search request with messages and AI search options\n     * @returns Search response with matching chunks\n     */\n    search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;\n    /**\n     * Generate chat completions with AI Search context.\n     * @param params Chat completions request with optional streaming\n     * @returns Response object (if streaming) or chat completion result\n     */\n    chatCompletions(params: AiSearchChatCompletionsRequest): Promise<Response | object>;\n    /**\n     * Delete this AI Search instance.\n     */\n    delete(): Promise<void>;\n}\n// AI Search Account Service - Account-level operations\ndeclare abstract class AiSearchAccountService {\n    /**\n     * List all AI Search instances in the account.\n     * @returns Array of AI Search instances\n     */\n    list(): Promise<AiSearchListResponse>;\n    /**\n     * Get an AI Search instance by ID.\n     * @param name Instance ID\n     * @returns Instance service for performing operations\n     */\n    get(name: string): AiSearchInstanceService;\n    /**\n     * Create a new AI Search instance.\n     * @param config Instance configuration\n     * @returns Instance service for performing operations\n     */\n    create(config: AiSearchConfig): Promise<AiSearchInstanceService>;\n}\ntype AiImageClassificationInput = {\n    image: number[];\n};\ntype AiImageClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiImageClassification {\n    inputs: AiImageClassificationInput;\n    postProcessedOutputs: AiImageClassificationOutput;\n}\ntype AiImageToTextInput = {\n    image: number[];\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageToText {\n    inputs: AiImageToTextInput;\n    postProcessedOutputs: AiImageToTextOutput;\n}\ntype AiImageTextToTextInput = {\n    image: string;\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    ignore_eos?: boolean;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageTextToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageTextToText {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiMultimodalEmbeddingsInput = {\n    image: string;\n    text: string[];\n};\ntype AiIMultimodalEmbeddingsOutput = {\n    data: number[][];\n    shape: number[];\n};\ndeclare abstract class BaseAiMultimodalEmbeddings {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiObjectDetectionInput = {\n    image: number[];\n};\ntype AiObjectDetectionOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiObjectDetection {\n    inputs: AiObjectDetectionInput;\n    postProcessedOutputs: AiObjectDetectionOutput;\n}\ntype AiSentenceSimilarityInput = {\n    source: string;\n    sentences: string[];\n};\ntype AiSentenceSimilarityOutput = number[];\ndeclare abstract class BaseAiSentenceSimilarity {\n    inputs: AiSentenceSimilarityInput;\n    postProcessedOutputs: AiSentenceSimilarityOutput;\n}\ntype AiAutomaticSpeechRecognitionInput = {\n    audio: number[];\n};\ntype AiAutomaticSpeechRecognitionOutput = {\n    text?: string;\n    words?: {\n        word: string;\n        start: number;\n        end: number;\n    }[];\n    vtt?: string;\n};\ndeclare abstract class BaseAiAutomaticSpeechRecognition {\n    inputs: AiAutomaticSpeechRecognitionInput;\n    postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;\n}\ntype AiSummarizationInput = {\n    input_text: string;\n    max_length?: number;\n};\ntype AiSummarizationOutput = {\n    summary: string;\n};\ndeclare abstract class BaseAiSummarization {\n    inputs: AiSummarizationInput;\n    postProcessedOutputs: AiSummarizationOutput;\n}\ntype AiTextClassificationInput = {\n    text: string;\n};\ntype AiTextClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiTextClassification {\n    inputs: AiTextClassificationInput;\n    postProcessedOutputs: AiTextClassificationOutput;\n}\ntype AiTextEmbeddingsInput = {\n    text: string | string[];\n};\ntype AiTextEmbeddingsOutput = {\n    shape: number[];\n    data: number[][];\n};\ndeclare abstract class BaseAiTextEmbeddings {\n    inputs: AiTextEmbeddingsInput;\n    postProcessedOutputs: AiTextEmbeddingsOutput;\n}\ntype RoleScopedChatInput = {\n    role: \"user\" | \"assistant\" | \"system\" | \"tool\" | (string & NonNullable<unknown>);\n    content: string;\n    name?: string;\n};\ntype AiTextGenerationToolLegacyInput = {\n    name: string;\n    description: string;\n    parameters?: {\n        type: \"object\" | (string & NonNullable<unknown>);\n        properties: {\n            [key: string]: {\n                type: string;\n                description?: string;\n            };\n        };\n        required: string[];\n    };\n};\ntype AiTextGenerationToolInput = {\n    type: \"function\" | (string & NonNullable<unknown>);\n    function: {\n        name: string;\n        description: string;\n        parameters?: {\n            type: \"object\" | (string & NonNullable<unknown>);\n            properties: {\n                [key: string]: {\n                    type: string;\n                    description?: string;\n                };\n            };\n            required: string[];\n        };\n    };\n};\ntype AiTextGenerationFunctionsInput = {\n    name: string;\n    code: string;\n};\ntype AiTextGenerationResponseFormat = {\n    type: string;\n    json_schema?: any;\n};\ntype AiTextGenerationInput = {\n    prompt?: string;\n    raw?: boolean;\n    stream?: boolean;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    messages?: RoleScopedChatInput[];\n    response_format?: AiTextGenerationResponseFormat;\n    tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);\n    functions?: AiTextGenerationFunctionsInput[];\n};\ntype AiTextGenerationToolLegacyOutput = {\n    name: string;\n    arguments: unknown;\n};\ntype AiTextGenerationToolOutput = {\n    id: string;\n    type: \"function\";\n    function: {\n        name: string;\n        arguments: string;\n    };\n};\ntype UsageTags = {\n    prompt_tokens: number;\n    completion_tokens: number;\n    total_tokens: number;\n};\ntype AiTextGenerationOutput = {\n    response?: string;\n    tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];\n    usage?: UsageTags;\n};\ndeclare abstract class BaseAiTextGeneration {\n    inputs: AiTextGenerationInput;\n    postProcessedOutputs: AiTextGenerationOutput;\n}\ntype AiTextToSpeechInput = {\n    prompt: string;\n    lang?: string;\n};\ntype AiTextToSpeechOutput = Uint8Array | {\n    audio: string;\n};\ndeclare abstract class BaseAiTextToSpeech {\n    inputs: AiTextToSpeechInput;\n    postProcessedOutputs: AiTextToSpeechOutput;\n}\ntype AiTextToImageInput = {\n    prompt: string;\n    negative_prompt?: string;\n    height?: number;\n    width?: number;\n    image?: number[];\n    image_b64?: string;\n    mask?: number[];\n    num_steps?: number;\n    strength?: number;\n    guidance?: number;\n    seed?: number;\n};\ntype AiTextToImageOutput = ReadableStream<Uint8Array>;\ndeclare abstract class BaseAiTextToImage {\n    inputs: AiTextToImageInput;\n    postProcessedOutputs: AiTextToImageOutput;\n}\ntype AiTranslationInput = {\n    text: string;\n    target_lang: string;\n    source_lang?: string;\n};\ntype AiTranslationOutput = {\n    translated_text?: string;\n};\ndeclare abstract class BaseAiTranslation {\n    inputs: AiTranslationInput;\n    postProcessedOutputs: AiTranslationOutput;\n}\n/**\n * Workers AI support for OpenAI's Responses API\n * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts\n *\n * It's a stripped down version from its source.\n * It currently supports basic function calling, json mode and accepts images as input.\n *\n * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.\n * We plan to add those incrementally as model + platform capabilities evolve.\n */\ntype ResponsesInput = {\n    background?: boolean | null;\n    conversation?: string | ResponseConversationParam | null;\n    include?: Array<ResponseIncludable> | null;\n    input?: string | ResponseInput;\n    instructions?: string | null;\n    max_output_tokens?: number | null;\n    parallel_tool_calls?: boolean | null;\n    previous_response_id?: string | null;\n    prompt_cache_key?: string;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    stream?: boolean | null;\n    stream_options?: StreamOptions | null;\n    temperature?: number | null;\n    text?: ResponseTextConfig;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    truncation?: \"auto\" | \"disabled\" | null;\n};\ntype ResponsesOutput = {\n    id?: string;\n    created_at?: number;\n    output_text?: string;\n    error?: ResponseError | null;\n    incomplete_details?: ResponseIncompleteDetails | null;\n    instructions?: string | Array<ResponseInputItem> | null;\n    object?: \"response\";\n    output?: Array<ResponseOutputItem>;\n    parallel_tool_calls?: boolean;\n    temperature?: number | null;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    max_output_tokens?: number | null;\n    previous_response_id?: string | null;\n    prompt?: ResponsePrompt | null;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    status?: ResponseStatus;\n    text?: ResponseTextConfig;\n    truncation?: \"auto\" | \"disabled\" | null;\n    usage?: ResponseUsage;\n};\ntype EasyInputMessage = {\n    content: string | ResponseInputMessageContentList;\n    role: \"user\" | \"assistant\" | \"system\" | \"developer\";\n    type?: \"message\";\n};\ntype ResponsesFunctionTool = {\n    name: string;\n    parameters: {\n        [key: string]: unknown;\n    } | null;\n    strict: boolean | null;\n    type: \"function\";\n    description?: string | null;\n};\ntype ResponseIncompleteDetails = {\n    reason?: \"max_output_tokens\" | \"content_filter\";\n};\ntype ResponsePrompt = {\n    id: string;\n    variables?: {\n        [key: string]: string | ResponseInputText | ResponseInputImage;\n    } | null;\n    version?: string | null;\n};\ntype Reasoning = {\n    effort?: ReasoningEffort | null;\n    generate_summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n    summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n};\ntype ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;\ntype ResponseContentReasoningText = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseConversationParam = {\n    id: string;\n};\ntype ResponseCreatedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.created\";\n};\ntype ResponseCustomToolCallOutput = {\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"custom_tool_call_output\";\n    id?: string;\n};\ntype ResponseError = {\n    code: \"server_error\" | \"rate_limit_exceeded\" | \"invalid_prompt\" | \"vector_store_timeout\" | \"invalid_image\" | \"invalid_image_format\" | \"invalid_base64_image\" | \"invalid_image_url\" | \"image_too_large\" | \"image_too_small\" | \"image_parse_error\" | \"image_content_policy_violation\" | \"invalid_image_mode\" | \"image_file_too_large\" | \"unsupported_image_media_type\" | \"empty_image_file\" | \"failed_to_download_image\" | \"image_file_not_found\";\n    message: string;\n};\ntype ResponseErrorEvent = {\n    code: string | null;\n    message: string;\n    param: string | null;\n    sequence_number: number;\n    type: \"error\";\n};\ntype ResponseFailedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.failed\";\n};\ntype ResponseFormatText = {\n    type: \"text\";\n};\ntype ResponseFormatJSONObject = {\n    type: \"json_object\";\n};\ntype ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;\ntype ResponseFormatTextJSONSchemaConfig = {\n    name: string;\n    schema: {\n        [key: string]: unknown;\n    };\n    type: \"json_schema\";\n    description?: string;\n    strict?: boolean | null;\n};\ntype ResponseFunctionCallArgumentsDeltaEvent = {\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.delta\";\n};\ntype ResponseFunctionCallArgumentsDoneEvent = {\n    arguments: string;\n    item_id: string;\n    name: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.done\";\n};\ntype ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;\ntype ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;\ntype ResponseFunctionToolCall = {\n    arguments: string;\n    call_id: string;\n    name: string;\n    type: \"function_call\";\n    id?: string;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ninterface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {\n    id: string;\n}\ntype ResponseFunctionToolCallOutputItem = {\n    id: string;\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"function_call_output\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseIncludable = \"message.input_image.image_url\" | \"message.output_text.logprobs\";\ntype ResponseIncompleteEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.incomplete\";\n};\ntype ResponseInput = Array<ResponseInputItem>;\ntype ResponseInputContent = ResponseInputText | ResponseInputImage;\ntype ResponseInputImage = {\n    detail: \"low\" | \"high\" | \"auto\";\n    type: \"input_image\";\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputImageContent = {\n    type: \"input_image\";\n    detail?: \"low\" | \"high\" | \"auto\" | null;\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;\ntype ResponseInputItemFunctionCallOutput = {\n    call_id: string;\n    output: string | ResponseFunctionCallOutputItemList;\n    type: \"function_call_output\";\n    id?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\" | null;\n};\ntype ResponseInputItemMessage = {\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputMessageContentList = Array<ResponseInputContent>;\ntype ResponseInputMessageItem = {\n    id: string;\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputText = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseInputTextContent = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;\ntype ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;\ntype ResponseOutputItemAddedEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.added\";\n};\ntype ResponseOutputItemDoneEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.done\";\n};\ntype ResponseOutputMessage = {\n    id: string;\n    content: Array<ResponseOutputText | ResponseOutputRefusal>;\n    role: \"assistant\";\n    status: \"in_progress\" | \"completed\" | \"incomplete\";\n    type: \"message\";\n};\ntype ResponseOutputRefusal = {\n    refusal: string;\n    type: \"refusal\";\n};\ntype ResponseOutputText = {\n    text: string;\n    type: \"output_text\";\n    logprobs?: Array<Logprob>;\n};\ntype ResponseReasoningItem = {\n    id: string;\n    summary: Array<ResponseReasoningSummaryItem>;\n    type: \"reasoning\";\n    content?: Array<ResponseReasoningContentItem>;\n    encrypted_content?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseReasoningSummaryItem = {\n    text: string;\n    type: \"summary_text\";\n};\ntype ResponseReasoningContentItem = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseReasoningTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.reasoning_text.delta\";\n};\ntype ResponseReasoningTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.reasoning_text.done\";\n};\ntype ResponseRefusalDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.refusal.delta\";\n};\ntype ResponseRefusalDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    refusal: string;\n    sequence_number: number;\n    type: \"response.refusal.done\";\n};\ntype ResponseStatus = \"completed\" | \"failed\" | \"in_progress\" | \"cancelled\" | \"queued\" | \"incomplete\";\ntype ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;\ntype ResponseCompletedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.completed\";\n};\ntype ResponseTextConfig = {\n    format?: ResponseFormatTextConfig;\n    verbosity?: \"low\" | \"medium\" | \"high\" | null;\n};\ntype ResponseTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_text.delta\";\n};\ntype ResponseTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.output_text.done\";\n};\ntype Logprob = {\n    token: string;\n    logprob: number;\n    top_logprobs?: Array<TopLogprob>;\n};\ntype TopLogprob = {\n    token?: string;\n    logprob?: number;\n};\ntype ResponseUsage = {\n    input_tokens: number;\n    output_tokens: number;\n    total_tokens: number;\n};\ntype Tool = ResponsesFunctionTool;\ntype ToolChoiceFunction = {\n    name: string;\n    type: \"function\";\n};\ntype ToolChoiceOptions = \"none\";\ntype ReasoningEffort = \"minimal\" | \"low\" | \"medium\" | \"high\" | null;\ntype StreamOptions = {\n    include_obfuscation?: boolean;\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;\n}\ntype Ai_Cf_Openai_Whisper_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper {\n    inputs: Ai_Cf_Openai_Whisper_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;\n}\ntype Ai_Cf_Meta_M2M100_1_2B_Input = {\n    /**\n     * The text to be translated\n     */\n    text: string;\n    /**\n     * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n     */\n    source_lang?: string;\n    /**\n     * The language code to translate the text into (e.g., 'es' for Spanish)\n     */\n    target_lang: string;\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        /**\n         * The text to be translated\n         */\n        text: string;\n        /**\n         * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n         */\n        source_lang?: string;\n        /**\n         * The language code to translate the text into (e.g., 'es' for Spanish)\n         */\n        target_lang: string;\n    }[];\n};\ntype Ai_Cf_Meta_M2M100_1_2B_Output = {\n    /**\n     * The translated text in the target language\n     */\n    translated_text?: string;\n} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;\ninterface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {\n    inputs: Ai_Cf_Meta_M2M100_1_2B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;\n}\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;\n}\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;\n}\ntype Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt?: string;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    image: number[] | (string & NonNullable<unknown>);\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n};\ninterface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {\n    description?: string;\n}\ndeclare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {\n    inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;\n    postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;\n}\ntype Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Tiny_En_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {\n    inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {\n    /**\n     * Base64 encoded value of the audio data.\n     */\n    audio: string;\n    /**\n     * Supported tasks are 'translate' or 'transcribe'.\n     */\n    task?: string;\n    /**\n     * The language of the audio being transcribed or translated.\n     */\n    language?: string;\n    /**\n     * Preprocess the audio with a voice activity detection model.\n     */\n    vad_filter?: boolean;\n    /**\n     * A text prompt to help provide context to the model on the contents of the audio.\n     */\n    initial_prompt?: string;\n    /**\n     * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.\n     */\n    prefix?: string;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {\n    transcription_info?: {\n        /**\n         * The language of the audio being transcribed or translated.\n         */\n        language?: string;\n        /**\n         * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.\n         */\n        language_probability?: number;\n        /**\n         * The total duration of the original audio file, in seconds.\n         */\n        duration?: number;\n        /**\n         * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.\n         */\n        duration_after_vad?: number;\n    };\n    /**\n     * The complete transcription of the audio.\n     */\n    text: string;\n    /**\n     * The total number of words in the transcription.\n     */\n    word_count?: number;\n    segments?: {\n        /**\n         * The starting time of the segment within the audio, in seconds.\n         */\n        start?: number;\n        /**\n         * The ending time of the segment within the audio, in seconds.\n         */\n        end?: number;\n        /**\n         * The transcription of the segment.\n         */\n        text?: string;\n        /**\n         * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.\n         */\n        temperature?: number;\n        /**\n         * The average log probability of the predictions for the words in this segment, indicating overall confidence.\n         */\n        avg_logprob?: number;\n        /**\n         * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.\n         */\n        compression_ratio?: number;\n        /**\n         * The probability that the segment contains no speech, represented as a decimal between 0 and 1.\n         */\n        no_speech_prob?: number;\n        words?: {\n            /**\n             * The individual word transcribed from the audio.\n             */\n            word?: string;\n            /**\n             * The starting time of the word within the audio, in seconds.\n             */\n            start?: number;\n            /**\n             * The ending time of the word within the audio, in seconds.\n             */\n            end?: number;\n        }[];\n    }[];\n    /**\n     * The transcription in WebVTT format, which includes timing and text information for use in subtitles.\n     */\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {\n    inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;\n}\ntype Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];\n};\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ntype Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Ouput_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Ouput_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Query {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {\n    response?: number[][];\n    shape?: number[];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_M3 {\n    inputs: Ai_Cf_Baai_Bge_M3_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer.\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {\n    inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;\n    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages;\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    image?: number[] | (string & NonNullable<unknown>);\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n}\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    image?: number[] | (string & NonNullable<unknown>);\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * If true, the response will be streamed back incrementally.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response?: string;\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {\n    inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {\n    requests?: {\n        /**\n         * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique.\n         */\n        external_reference?: string;\n        /**\n         * Prompt for the text generation model\n         */\n        prompt?: string;\n        /**\n         * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n         */\n        stream?: boolean;\n        /**\n         * The maximum number of tokens to generate in the response.\n         */\n        max_tokens?: number;\n        /**\n         * Controls the randomness of the output; higher values produce more random results.\n         */\n        temperature?: number;\n        /**\n         * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n         */\n        top_p?: number;\n        /**\n         * Random seed for reproducibility of the generation.\n         */\n        seed?: number;\n        /**\n         * Penalty for repeated tokens; higher values discourage repetition.\n         */\n        repetition_penalty?: number;\n        /**\n         * Decreases the likelihood of the model repeating the same lines verbatim.\n         */\n        frequency_penalty?: number;\n        /**\n         * Increases the likelihood of the model introducing new topics.\n         */\n        presence_penalty?: number;\n        response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;\n    }[];\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {\n    inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Input {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender must alternate between 'user' and 'assistant'.\n         */\n        role: \"user\" | \"assistant\";\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Dictate the output format of the generated response.\n     */\n    response_format?: {\n        /**\n         * Set to json_object to process and output generated text as JSON.\n         */\n        type?: string;\n    };\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Output {\n    response?: string | {\n        /**\n         * Whether the conversation is safe or not.\n         */\n        safe?: boolean;\n        /**\n         * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.\n         */\n        categories?: string[];\n    };\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {\n    inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Input {\n    /**\n     * A query you wish to perform against the provided contexts.\n     */\n    /**\n     * Number of returned results starting with the best score.\n     */\n    top_k?: number;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Output {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {\n    inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages;\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {\n    inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;\ninterface Ai_Cf_Qwen_Qwq_32B_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwq_32B_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwq_32B {\n    inputs: Ai_Cf_Qwen_Qwq_32B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages;\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {\n    inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;\ninterface Ai_Cf_Google_Gemma_3_12B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Google_Gemma_3_12B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[];\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {\n    inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;\n    postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch;\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {\n    requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The tool call id.\n         */\n        id?: string;\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type?: string;\n        /**\n         * Details of the function tool.\n         */\n        function?: {\n            /**\n             * The name of the tool to be called\n             */\n            name?: string;\n            /**\n             * The arguments passed to be passed to the tool call request\n             */\n            arguments?: object;\n        };\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {\n    inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {\n    requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {\n    inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Input {\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.\n     */\n    custom_topic_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom topics you want the model to detect within your input audio or text if present Submit up to 100\n     */\n    custom_topic?: string;\n    /**\n     * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param\n     */\n    custom_intent_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom intents you want the model to detect within your input audio if present\n     */\n    custom_intent?: string;\n    /**\n     * Identifies and extracts key entities from content in submitted audio\n     */\n    detect_entities?: boolean;\n    /**\n     * Identifies the dominant language spoken in submitted audio\n     */\n    detect_language?: boolean;\n    /**\n     * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0\n     */\n    diarize?: boolean;\n    /**\n     * Identify and extract key entities from content in submitted audio\n     */\n    dictation?: boolean;\n    /**\n     * Specify the expected encoding of your submitted audio\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"amr-nb\" | \"amr-wb\" | \"opus\" | \"speex\" | \"g729\";\n    /**\n     * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing\n     */\n    extra?: string;\n    /**\n     * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'\n     */\n    filler_words?: boolean;\n    /**\n     * Key term prompting can boost or suppress specialized terminology and brands.\n     */\n    keyterm?: string;\n    /**\n     * Keywords can boost or suppress specialized terminology and brands.\n     */\n    keywords?: string;\n    /**\n     * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.\n     */\n    language?: string;\n    /**\n     * Spoken measurements will be converted to their corresponding abbreviations.\n     */\n    measurements?: boolean;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.\n     */\n    mip_opt_out?: boolean;\n    /**\n     * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio\n     */\n    mode?: \"general\" | \"medical\" | \"finance\";\n    /**\n     * Transcribe each audio channel independently.\n     */\n    multichannel?: boolean;\n    /**\n     * Numerals converts numbers from written format to numerical format.\n     */\n    numerals?: boolean;\n    /**\n     * Splits audio into paragraphs to improve transcript readability.\n     */\n    paragraphs?: boolean;\n    /**\n     * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.\n     */\n    profanity_filter?: boolean;\n    /**\n     * Add punctuation and capitalization to the transcript.\n     */\n    punctuate?: boolean;\n    /**\n     * Redaction removes sensitive information from your transcripts.\n     */\n    redact?: string;\n    /**\n     * Search for terms or phrases in submitted audio and replaces them.\n     */\n    replace?: string;\n    /**\n     * Search for terms or phrases in submitted audio.\n     */\n    search?: string;\n    /**\n     * Recognizes the sentiment throughout a transcript or text.\n     */\n    sentiment?: boolean;\n    /**\n     * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.\n     */\n    smart_format?: boolean;\n    /**\n     * Detect topics throughout a transcript or text.\n     */\n    topics?: boolean;\n    /**\n     * Segments speech into meaningful semantic units.\n     */\n    utterances?: boolean;\n    /**\n     * Seconds to wait before detecting a pause between words in submitted audio.\n     */\n    utt_split?: number;\n    /**\n     * The number of channels in the submitted audio\n     */\n    channels?: number;\n    /**\n     * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.\n     */\n    interim_results?: boolean;\n    /**\n     * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing\n     */\n    endpointing?: string;\n    /**\n     * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.\n     */\n    vad_events?: boolean;\n    /**\n     * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.\n     */\n    utterance_end_ms?: boolean;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Output {\n    results?: {\n        channels?: {\n            alternatives?: {\n                confidence?: number;\n                transcript?: string;\n                words?: {\n                    confidence?: number;\n                    end?: number;\n                    start?: number;\n                    word?: string;\n                }[];\n            }[];\n        }[];\n        summary?: {\n            result?: string;\n            short?: string;\n        };\n        sentiments?: {\n            segments?: {\n                text?: string;\n                start_word?: number;\n                end_word?: number;\n                sentiment?: string;\n                sentiment_score?: number;\n            }[];\n            average?: {\n                sentiment?: string;\n                sentiment_score?: number;\n            };\n        };\n    };\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Nova_3 {\n    inputs: Ai_Cf_Deepgram_Nova_3_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {\n    queries?: string | string[];\n    /**\n     * Optional instruction for the task\n     */\n    instruction?: string;\n    documents?: string | string[];\n    text?: string | string[];\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {\n    data?: number[][];\n    shape?: number[];\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {\n    inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;\n}\ntype Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {\n    /**\n     * readable stream with audio data and content-type specified for that data\n     */\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n} | {\n    /**\n     * base64 encoded audio data\n     */\n    audio: string;\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n};\ninterface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {\n    /**\n     * if true, end-of-turn was detected\n     */\n    is_complete?: boolean;\n    /**\n     * probability of the end-of-turn detection\n     */\n    probability?: number;\n}\ndeclare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {\n    inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;\n    postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ninterface Ai_Cf_Leonardo_Phoenix_1_0_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * Specify what to exclude from the generated images\n     */\n    negative_prompt?: string;\n}\n/**\n * The generated image in JPEG format\n */\ntype Ai_Cf_Leonardo_Phoenix_1_0_Output = string;\ndeclare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {\n    inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {\n    inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_1_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"angus\" | \"asteria\" | \"arcas\" | \"orion\" | \"orpheus\" | \"athena\" | \"luna\" | \"zeus\" | \"perseus\" | \"helios\" | \"hera\" | \"stella\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_1_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_1 {\n    inputs: Ai_Cf_Deepgram_Aura_1_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {\n    /**\n     * Input text to translate. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n    /**\n     * Target language to translate to\n     */\n    target_language: \"asm_Beng\" | \"awa_Deva\" | \"ben_Beng\" | \"bho_Deva\" | \"brx_Deva\" | \"doi_Deva\" | \"eng_Latn\" | \"gom_Deva\" | \"gon_Deva\" | \"guj_Gujr\" | \"hin_Deva\" | \"hne_Deva\" | \"kan_Knda\" | \"kas_Arab\" | \"kas_Deva\" | \"kha_Latn\" | \"lus_Latn\" | \"mag_Deva\" | \"mai_Deva\" | \"mal_Mlym\" | \"mar_Deva\" | \"mni_Beng\" | \"mni_Mtei\" | \"npi_Deva\" | \"ory_Orya\" | \"pan_Guru\" | \"san_Deva\" | \"sat_Olck\" | \"snd_Arab\" | \"snd_Deva\" | \"tam_Taml\" | \"tel_Telu\" | \"urd_Arab\" | \"unr_Deva\";\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {\n    /**\n     * Translated texts\n     */\n    translations: string[];\n}\ndeclare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {\n    inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;\n    postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {\n    requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {\n    inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;\n    postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {\n    /**\n     * Input text to embed. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {\n    /**\n     * Embedding vectors, where each vector is a list of floats.\n     */\n    data: number[][];\n    /**\n     * Shape of the embedding data as [number_of_embeddings, embedding_dimension].\n     *\n     * @minItems 2\n     * @maxItems 2\n     */\n    shape: [\n        number,\n        number\n    ];\n}\ndeclare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {\n    inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;\n    postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;\n}\ninterface Ai_Cf_Deepgram_Flux_Input {\n    /**\n     * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.\n     */\n    encoding: \"linear16\";\n    /**\n     * Sample rate of the audio stream in Hz.\n     */\n    sample_rate: string;\n    /**\n     * End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.\n     */\n    eager_eot_threshold?: string;\n    /**\n     * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.\n     */\n    eot_threshold?: string;\n    /**\n     * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.\n     */\n    eot_timeout_ms?: string;\n    /**\n     * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.\n     */\n    keyterm?: string;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip\n     */\n    mip_opt_out?: \"true\" | \"false\";\n    /**\n     * Label your requests for the purpose of identification during usage reporting\n     */\n    tag?: string;\n}\n/**\n * Output will be returned as websocket messages.\n */\ninterface Ai_Cf_Deepgram_Flux_Output {\n    /**\n     * The unique identifier of the request (uuid)\n     */\n    request_id?: string;\n    /**\n     * Starts at 0 and increments for each message the server sends to the client.\n     */\n    sequence_id?: number;\n    /**\n     * The type of event being reported.\n     */\n    event?: \"Update\" | \"StartOfTurn\" | \"EagerEndOfTurn\" | \"TurnResumed\" | \"EndOfTurn\";\n    /**\n     * The index of the current turn\n     */\n    turn_index?: number;\n    /**\n     * Start time in seconds of the audio range that was transcribed\n     */\n    audio_window_start?: number;\n    /**\n     * End time in seconds of the audio range that was transcribed\n     */\n    audio_window_end?: number;\n    /**\n     * Text that was said over the course of the current turn\n     */\n    transcript?: string;\n    /**\n     * The words in the transcript\n     */\n    words?: {\n        /**\n         * The individual punctuated, properly-cased word from the transcript\n         */\n        word: string;\n        /**\n         * Confidence that this word was transcribed correctly\n         */\n        confidence: number;\n    }[];\n    /**\n     * Confidence that no more speech is coming in this turn\n     */\n    end_of_turn_confidence?: number;\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Flux {\n    inputs: Ai_Cf_Deepgram_Flux_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_En_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"amalthea\" | \"andromeda\" | \"apollo\" | \"arcas\" | \"aries\" | \"asteria\" | \"athena\" | \"atlas\" | \"aurora\" | \"callista\" | \"cora\" | \"cordelia\" | \"delia\" | \"draco\" | \"electra\" | \"harmonia\" | \"helena\" | \"hera\" | \"hermes\" | \"hyperion\" | \"iris\" | \"janus\" | \"juno\" | \"jupiter\" | \"luna\" | \"mars\" | \"minerva\" | \"neptune\" | \"odysseus\" | \"ophelia\" | \"orion\" | \"orpheus\" | \"pandora\" | \"phoebe\" | \"pluto\" | \"saturn\" | \"thalia\" | \"theia\" | \"vesta\" | \"zeus\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_En_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {\n    inputs: Ai_Cf_Deepgram_Aura_2_En_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_Es_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"sirio\" | \"nestor\" | \"carina\" | \"celeste\" | \"alvaro\" | \"diana\" | \"aquila\" | \"selena\" | \"estrella\" | \"javier\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_Es_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {\n    inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;\n}\ninterface AiModels {\n    \"@cf/huggingface/distilbert-sst-2-int8\": BaseAiTextClassification;\n    \"@cf/stabilityai/stable-diffusion-xl-base-1.0\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-inpainting\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-img2img\": BaseAiTextToImage;\n    \"@cf/lykon/dreamshaper-8-lcm\": BaseAiTextToImage;\n    \"@cf/bytedance/stable-diffusion-xl-lightning\": BaseAiTextToImage;\n    \"@cf/myshell-ai/melotts\": BaseAiTextToSpeech;\n    \"@cf/google/embeddinggemma-300m\": BaseAiTextEmbeddings;\n    \"@cf/microsoft/resnet-50\": BaseAiImageClassification;\n    \"@cf/meta/llama-2-7b-chat-int8\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.1\": BaseAiTextGeneration;\n    \"@cf/meta/llama-2-7b-chat-fp16\": BaseAiTextGeneration;\n    \"@hf/thebloke/llama-2-13b-chat-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/mistral-7b-instruct-v0.1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/zephyr-7b-beta-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/openhermes-2.5-mistral-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/neural-chat-7b-v3-1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/llamaguard-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-base-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-math-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/defog/sqlcoder-7b-2\": BaseAiTextGeneration;\n    \"@cf/openchat/openchat-3.5-0106\": BaseAiTextGeneration;\n    \"@cf/tiiuae/falcon-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/thebloke/discolm-german-7b-v1-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-0.5b-chat\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-7b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-14b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/tinyllama/tinyllama-1.1b-chat-v1.0\": BaseAiTextGeneration;\n    \"@cf/microsoft/phi-2\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-1.8b-chat\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.2-lora\": BaseAiTextGeneration;\n    \"@hf/nousresearch/hermes-2-pro-mistral-7b\": BaseAiTextGeneration;\n    \"@hf/nexusflow/starling-lm-7b-beta\": BaseAiTextGeneration;\n    \"@hf/google/gemma-7b-it\": BaseAiTextGeneration;\n    \"@cf/meta-llama/llama-2-7b-chat-hf-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-2b-it-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-7b-it-lora\": BaseAiTextGeneration;\n    \"@hf/mistral/mistral-7b-instruct-v0.2\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct\": BaseAiTextGeneration;\n    \"@cf/fblgit/una-cybertron-7b-v2-bf16\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-fp8\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-3b-instruct\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-1b-instruct\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b\": BaseAiTextGeneration;\n    \"@cf/ibm-granite/granite-4.0-h-micro\": BaseAiTextGeneration;\n    \"@cf/facebook/bart-large-cnn\": BaseAiSummarization;\n    \"@cf/llava-hf/llava-1.5-7b-hf\": BaseAiImageToText;\n    \"@cf/baai/bge-base-en-v1.5\": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;\n    \"@cf/openai/whisper\": Base_Ai_Cf_Openai_Whisper;\n    \"@cf/meta/m2m100-1.2b\": Base_Ai_Cf_Meta_M2M100_1_2B;\n    \"@cf/baai/bge-small-en-v1.5\": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;\n    \"@cf/baai/bge-large-en-v1.5\": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;\n    \"@cf/unum/uform-gen2-qwen-500m\": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;\n    \"@cf/openai/whisper-tiny-en\": Base_Ai_Cf_Openai_Whisper_Tiny_En;\n    \"@cf/openai/whisper-large-v3-turbo\": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;\n    \"@cf/baai/bge-m3\": Base_Ai_Cf_Baai_Bge_M3;\n    \"@cf/black-forest-labs/flux-1-schnell\": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;\n    \"@cf/meta/llama-3.2-11b-vision-instruct\": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;\n    \"@cf/meta/llama-3.3-70b-instruct-fp8-fast\": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;\n    \"@cf/meta/llama-guard-3-8b\": Base_Ai_Cf_Meta_Llama_Guard_3_8B;\n    \"@cf/baai/bge-reranker-base\": Base_Ai_Cf_Baai_Bge_Reranker_Base;\n    \"@cf/qwen/qwen2.5-coder-32b-instruct\": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;\n    \"@cf/qwen/qwq-32b\": Base_Ai_Cf_Qwen_Qwq_32B;\n    \"@cf/mistralai/mistral-small-3.1-24b-instruct\": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;\n    \"@cf/google/gemma-3-12b-it\": Base_Ai_Cf_Google_Gemma_3_12B_It;\n    \"@cf/meta/llama-4-scout-17b-16e-instruct\": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;\n    \"@cf/qwen/qwen3-30b-a3b-fp8\": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;\n    \"@cf/deepgram/nova-3\": Base_Ai_Cf_Deepgram_Nova_3;\n    \"@cf/qwen/qwen3-embedding-0.6b\": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;\n    \"@cf/pipecat-ai/smart-turn-v2\": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;\n    \"@cf/openai/gpt-oss-120b\": Base_Ai_Cf_Openai_Gpt_Oss_120B;\n    \"@cf/openai/gpt-oss-20b\": Base_Ai_Cf_Openai_Gpt_Oss_20B;\n    \"@cf/leonardo/phoenix-1.0\": Base_Ai_Cf_Leonardo_Phoenix_1_0;\n    \"@cf/leonardo/lucid-origin\": Base_Ai_Cf_Leonardo_Lucid_Origin;\n    \"@cf/deepgram/aura-1\": Base_Ai_Cf_Deepgram_Aura_1;\n    \"@cf/ai4bharat/indictrans2-en-indic-1B\": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;\n    \"@cf/aisingapore/gemma-sea-lion-v4-27b-it\": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;\n    \"@cf/pfnet/plamo-embedding-1b\": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;\n    \"@cf/deepgram/flux\": Base_Ai_Cf_Deepgram_Flux;\n    \"@cf/deepgram/aura-2-en\": Base_Ai_Cf_Deepgram_Aura_2_En;\n    \"@cf/deepgram/aura-2-es\": Base_Ai_Cf_Deepgram_Aura_2_Es;\n}\ntype AiOptions = {\n    /**\n     * Send requests as an asynchronous batch job, only works for supported models\n     * https://developers.cloudflare.com/workers-ai/features/batch-api\n     */\n    queueRequest?: boolean;\n    /**\n     * Establish websocket connections, only works for supported models\n     */\n    websocket?: boolean;\n    /**\n     * Tag your requests to group and view them in Cloudflare dashboard.\n     *\n     * Rules:\n     * Tags must only contain letters, numbers, and the symbols: : - . / @\n     * Each tag can have maximum 50 characters.\n     * Maximum 5 tags are allowed each request.\n     * Duplicate tags will removed.\n     */\n    tags?: string[];\n    gateway?: GatewayOptions;\n    returnRawResponse?: boolean;\n    prefix?: string;\n    extraHeaders?: object;\n};\ntype AiModelsSearchParams = {\n    author?: string;\n    hide_experimental?: boolean;\n    page?: number;\n    per_page?: number;\n    search?: string;\n    source?: number;\n    task?: string;\n};\ntype AiModelsSearchObject = {\n    id: string;\n    source: number;\n    name: string;\n    description: string;\n    task: {\n        id: string;\n        name: string;\n        description: string;\n    };\n    tags: string[];\n    properties: {\n        property_id: string;\n        value: string;\n    }[];\n};\ninterface InferenceUpstreamError extends Error {\n}\ninterface AiInternalError extends Error {\n}\ntype AiModelListType = Record<string, any>;\ndeclare abstract class Ai<AiModelList extends AiModelListType = AiModels> {\n    aiGatewayLogId: string | null;\n    gateway(gatewayId: string): AiGateway;\n    /**\n     * Access the AI Search API for managing AI-powered search instances.\n     *\n     * This is the new API that replaces AutoRAG with better namespace separation:\n     * - Account-level operations: `list()`, `create()`\n     * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`\n     *\n     * @example\n     * ```typescript\n     * // List all AI Search instances\n     * const instances = await env.AI.aiSearch.list();\n     *\n     * // Search an instance\n     * const results = await env.AI.aiSearch.get('my-search').search({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   ai_search_options: {\n     *     retrieval: { max_num_results: 10 }\n     *   }\n     * });\n     *\n     * // Generate chat completions with AI Search context\n     * const response = await env.AI.aiSearch.get('my-search').chatCompletions({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'\n     * });\n     * ```\n     */\n    aiSearch(): AiSearchAccountService;\n    /**\n     * @deprecated AutoRAG has been replaced by AI Search.\n     * Use `env.AI.aiSearch` instead for better API design and new features.\n     *\n     * Migration guide:\n     * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n     * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`\n     * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n     *\n     * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.\n     *\n     * @see AiSearchAccountService\n     * @param autoragId Optional instance ID (omit for account-level operations)\n     */\n    autorag(autoragId: string): AutoRAG;\n    run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name][\"inputs\"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends {\n        returnRawResponse: true;\n    } | {\n        websocket: true;\n    } ? Response : InputOptions extends {\n        stream: true;\n    } ? ReadableStream : AiModelList[Name][\"postProcessedOutputs\"]>;\n    models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;\n    toMarkdown(): ToMarkdownService;\n    toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n}\ntype GatewayRetries = {\n    maxAttempts?: 1 | 2 | 3 | 4 | 5;\n    retryDelayMs?: number;\n    backoff?: 'constant' | 'linear' | 'exponential';\n};\ntype GatewayOptions = {\n    id: string;\n    cacheKey?: string;\n    cacheTtl?: number;\n    skipCache?: boolean;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    collectLog?: boolean;\n    eventId?: string;\n    requestTimeoutMs?: number;\n    retries?: GatewayRetries;\n};\ntype UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {\n    /**\n     ** @deprecated\n     */\n    id?: string;\n};\ntype AiGatewayPatchLog = {\n    score?: number | null;\n    feedback?: -1 | 1 | null;\n    metadata?: Record<string, number | string | boolean | null | bigint> | null;\n};\ntype AiGatewayLog = {\n    id: string;\n    provider: string;\n    model: string;\n    model_type?: string;\n    path: string;\n    duration: number;\n    request_type?: string;\n    request_content_type?: string;\n    status_code: number;\n    response_content_type?: string;\n    success: boolean;\n    cached: boolean;\n    tokens_in?: number;\n    tokens_out?: number;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    step?: number;\n    cost?: number;\n    custom_cost?: boolean;\n    request_size: number;\n    request_head?: string;\n    request_head_complete: boolean;\n    response_size: number;\n    response_head?: string;\n    response_head_complete: boolean;\n    created_at: Date;\n};\ntype AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | 'azure-openai' | 'google-vertex-ai' | 'huggingface' | 'openai' | 'perplexity-ai' | 'replicate' | 'groq' | 'cohere' | 'google-ai-studio' | 'mistral' | 'grok' | 'openrouter' | 'deepseek' | 'cerebras' | 'cartesia' | 'elevenlabs' | 'adobe-firefly';\ntype AIGatewayHeaders = {\n    'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;\n    'cf-aig-custom-cost': {\n        per_token_in?: number;\n        per_token_out?: number;\n    } | {\n        total_cost?: number;\n    } | string;\n    'cf-aig-cache-ttl': number | string;\n    'cf-aig-skip-cache': boolean | string;\n    'cf-aig-cache-key': string;\n    'cf-aig-event-id': string;\n    'cf-aig-request-timeout': number | string;\n    'cf-aig-max-attempts': number | string;\n    'cf-aig-retry-delay': number | string;\n    'cf-aig-backoff': string;\n    'cf-aig-collect-log': boolean | string;\n    Authorization: string;\n    'Content-Type': string;\n    [key: string]: string | number | boolean | object;\n};\ntype AIGatewayUniversalRequest = {\n    provider: AIGatewayProviders | string; // eslint-disable-line\n    endpoint: string;\n    headers: Partial<AIGatewayHeaders>;\n    query: unknown;\n};\ninterface AiGatewayInternalError extends Error {\n}\ninterface AiGatewayLogNotFound extends Error {\n}\ndeclare abstract class AiGateway {\n    patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;\n    getLog(logId: string): Promise<AiGatewayLog>;\n    run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {\n        gateway?: UniversalGatewayOptions;\n        extraHeaders?: object;\n    }): Promise<Response>;\n    getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.\n * @see AiSearchInternalError\n */\ninterface AutoRAGInternalError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.\n * @see AiSearchNotFoundError\n */\ninterface AutoRAGNotFoundError extends Error {\n}\n/**\n * @deprecated This error type is no longer used in the AI Search API.\n */\ninterface AutoRAGUnauthorizedError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.\n * @see AiSearchNameNotSetError\n */\ninterface AutoRAGNameNotSetError extends Error {\n}\ntype ComparisonFilter = {\n    key: string;\n    type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';\n    value: string | number | boolean;\n};\ntype CompoundFilter = {\n    type: 'and' | 'or';\n    filters: ComparisonFilter[];\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchRequest with the new API instead.\n * @see AiSearchSearchRequest\n */\ntype AutoRagSearchRequest = {\n    query: string;\n    filters?: CompoundFilter | ComparisonFilter;\n    max_num_results?: number;\n    ranking_options?: {\n        ranker?: string;\n        score_threshold?: number;\n    };\n    reranking?: {\n        enabled?: boolean;\n        model?: string;\n    };\n    rewrite_query?: boolean;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with the new API instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequest = AutoRagSearchRequest & {\n    stream?: boolean;\n    system_prompt?: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with stream: true instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {\n    stream: true;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchResponse with the new API instead.\n * @see AiSearchSearchResponse\n */\ntype AutoRagSearchResponse = {\n    object: 'vector_store.search_results.page';\n    search_query: string;\n    data: {\n        file_id: string;\n        filename: string;\n        score: number;\n        attributes: Record<string, string | number | boolean | null>;\n        content: {\n            type: 'text';\n            text: string;\n        }[];\n    }[];\n    has_more: boolean;\n    next_page: string | null;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchListResponse with the new API instead.\n * @see AiSearchListResponse\n */\ntype AutoRagListResponse = {\n    id: string;\n    enable: boolean;\n    type: string;\n    source: string;\n    vectorize_name: string;\n    paused: boolean;\n    status: string;\n}[];\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * The new API returns different response formats for chat completions.\n */\ntype AutoRagAiSearchResponse = AutoRagSearchResponse & {\n    response: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use the new AI Search API instead: `env.AI.aiSearch`\n *\n * Migration guide:\n * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`\n * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n *\n * @see AiSearchAccountService\n * @see AiSearchInstanceService\n */\ndeclare abstract class AutoRAG {\n    /**\n     * @deprecated Use `env.AI.aiSearch.list()` instead.\n     * @see AiSearchAccountService.list\n     */\n    list(): Promise<AutoRagListResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.\n     * Note: The new API uses a messages array instead of a query string.\n     * @see AiSearchInstanceService.search\n     */\n    search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;\n}\ninterface BasicImageTransformations {\n    /**\n     * Maximum width in image pixels. The value must be an integer.\n     */\n    width?: number;\n    /**\n     * Maximum height in image pixels. The value must be an integer.\n     */\n    height?: number;\n    /**\n     * Resizing mode as a string. It affects interpretation of width and height\n     * options:\n     *  - scale-down: Similar to contain, but the image is never enlarged. If\n     *    the image is larger than given width or height, it will be resized.\n     *    Otherwise its original size will be kept.\n     *  - contain: Resizes to maximum size that fits within the given width and\n     *    height. If only a single dimension is given (e.g. only width), the\n     *    image will be shrunk or enlarged to exactly match that dimension.\n     *    Aspect ratio is always preserved.\n     *  - cover: Resizes (shrinks or enlarges) to fill the entire area of width\n     *    and height. If the image has an aspect ratio different from the ratio\n     *    of width and height, it will be cropped to fit.\n     *  - crop: The image will be shrunk and cropped to fit within the area\n     *    specified by width and height. The image will not be enlarged. For images\n     *    smaller than the given dimensions it's the same as scale-down. For\n     *    images larger than the given dimensions, it's the same as cover.\n     *    See also trim.\n     *  - pad: Resizes to the maximum size that fits within the given width and\n     *    height, and then fills the remaining area with a background color\n     *    (white by default). Use of this mode is not recommended, as the same\n     *    effect can be more efficiently achieved with the contain mode and the\n     *    CSS object-fit: contain property.\n     *  - squeeze: Stretches and deforms to the width and height given, even if it\n     *    breaks aspect ratio\n     */\n    fit?: \"scale-down\" | \"contain\" | \"cover\" | \"crop\" | \"pad\" | \"squeeze\";\n    /**\n     * Image segmentation using artificial intelligence models. Sets pixels not\n     * within selected segment area to transparent e.g \"foreground\" sets every\n     * background pixel as transparent.\n     */\n    segment?: \"foreground\";\n    /**\n     * When cropping with fit: \"cover\", this defines the side or point that should\n     * be left uncropped. The value is either a string\n     * \"left\", \"right\", \"top\", \"bottom\", \"auto\", or \"center\" (the default),\n     * or an object {x, y} containing focal point coordinates in the original\n     * image expressed as fractions ranging from 0.0 (top or left) to 1.0\n     * (bottom or right), 0.5 being the center. {fit: \"cover\", gravity: \"top\"} will\n     * crop bottom or left and right sides as necessary, but won’t crop anything\n     * from the top. {fit: \"cover\", gravity: {x:0.5, y:0.2}} will crop each side to\n     * preserve as much as possible around a point at 20% of the height of the\n     * source image.\n     */\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;\n    /**\n     * Background color to add underneath the image. Applies only to images with\n     * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),\n     * hsl(…), etc.)\n     */\n    background?: string;\n    /**\n     * Number of degrees (90, 180, 270) to rotate the image by. width and height\n     * options refer to axes after rotation.\n     */\n    rotate?: 0 | 90 | 180 | 270 | 360;\n}\ninterface BasicImageTransformationsGravityCoordinates {\n    x?: number;\n    y?: number;\n    mode?: 'remainder' | 'box-center';\n}\n/**\n * In addition to the properties you can set in the RequestInit dict\n * that you pass as an argument to the Request constructor, you can\n * set certain properties of a `cf` object to control how Cloudflare\n * features are applied to that new Request.\n *\n * Note: Currently, these properties cannot be tested in the\n * playground.\n */\ninterface RequestInitCfProperties extends Record<string, unknown> {\n    cacheEverything?: boolean;\n    /**\n     * A request's cache key is what determines if two requests are\n     * \"the same\" for caching purposes. If a request has the same cache key\n     * as some previous request, then we can serve the same cached response for\n     * both. (e.g. 'some-key')\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheKey?: string;\n    /**\n     * This allows you to append additional Cache-Tag response headers\n     * to the origin response without modifications to the origin server.\n     * This will allow for greater control over the Purge by Cache Tag feature\n     * utilizing changes only in the Workers process.\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheTags?: string[];\n    /**\n     * Force response to be cached for a given number of seconds. (e.g. 300)\n     */\n    cacheTtl?: number;\n    /**\n     * Force response to be cached for a given number of seconds based on the Origin status code.\n     * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })\n     */\n    cacheTtlByStatus?: Record<string, number>;\n    scrapeShield?: boolean;\n    apps?: boolean;\n    image?: RequestInitCfPropertiesImage;\n    minify?: RequestInitCfPropertiesImageMinify;\n    mirage?: boolean;\n    polish?: \"lossy\" | \"lossless\" | \"off\";\n    r2?: RequestInitCfPropertiesR2;\n    /**\n     * Redirects the request to an alternate origin server. You can use this,\n     * for example, to implement load balancing across several origins.\n     * (e.g.us-east.example.com)\n     *\n     * Note - For security reasons, the hostname set in resolveOverride must\n     * be proxied on the same Cloudflare zone of the incoming request.\n     * Otherwise, the setting is ignored. CNAME hosts are allowed, so to\n     * resolve to a host under a different domain or a DNS only domain first\n     * declare a CNAME record within your own zone’s DNS mapping to the\n     * external hostname, set proxy on Cloudflare, then set resolveOverride\n     * to point to that CNAME record.\n     */\n    resolveOverride?: string;\n}\ninterface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {\n    /**\n     * Absolute URL of the image file to use for the drawing. It can be any of\n     * the supported file formats. For drawing of watermarks or non-rectangular\n     * overlays we recommend using PNG or WebP images.\n     */\n    url: string;\n    /**\n     * Floating-point number between 0 (transparent) and 1 (opaque).\n     * For example, opacity: 0.5 makes overlay semitransparent.\n     */\n    opacity?: number;\n    /**\n     * - If set to true, the overlay image will be tiled to cover the entire\n     *   area. This is useful for stock-photo-like watermarks.\n     * - If set to \"x\", the overlay image will be tiled horizontally only\n     *   (form a line).\n     * - If set to \"y\", the overlay image will be tiled vertically only\n     *   (form a line).\n     */\n    repeat?: true | \"x\" | \"y\";\n    /**\n     * Position of the overlay image relative to a given edge. Each property is\n     * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10\n     * positions left side of the overlay 10 pixels from the left edge of the\n     * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom\n     * of the background image.\n     *\n     * Setting both left & right, or both top & bottom is an error.\n     *\n     * If no position is specified, the image will be centered.\n     */\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n}\ninterface RequestInitCfPropertiesImage extends BasicImageTransformations {\n    /**\n     * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it\n     * easier to specify higher-DPI sizes in <img srcset>.\n     */\n    dpr?: number;\n    /**\n     * Allows you to trim your image. Takes dpr into account and is performed before\n     * resizing or rotation.\n     *\n     * It can be used as:\n     * - left, top, right, bottom - it will specify the number of pixels to cut\n     *   off each side\n     * - width, height - the width/height you'd like to end up with - can be used\n     *   in combination with the properties above\n     * - border - this will automatically trim the surroundings of an image based on\n     *   it's color. It consists of three properties:\n     *    - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)\n     *    - tolerance: difference from color to treat as color\n     *    - keep: the number of pixels of border to keep\n     */\n    trim?: \"border\" | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n    /**\n     * Quality setting from 1-100 (useful values are in 60-90 range). Lower values\n     * make images look worse, but load faster. The default is 85. It applies only\n     * to JPEG and WebP images. It doesn’t have any effect on PNG.\n     */\n    quality?: number | \"low\" | \"medium-low\" | \"medium-high\" | \"high\";\n    /**\n     * Output format to generate. It can be:\n     *  - avif: generate images in AVIF format.\n     *  - webp: generate images in Google WebP format. Set quality to 100 to get\n     *    the WebP-lossless format.\n     *  - json: instead of generating an image, outputs information about the\n     *    image, in JSON format. The JSON object will contain image size\n     *    (before and after resizing), source image’s MIME type, file size, etc.\n     * - jpeg: generate images in JPEG format.\n     * - png: generate images in PNG format.\n     */\n    format?: \"avif\" | \"webp\" | \"json\" | \"jpeg\" | \"png\" | \"baseline-jpeg\" | \"png-force\" | \"svg\";\n    /**\n     * Whether to preserve animation frames from input files. Default is true.\n     * Setting it to false reduces animations to still images. This setting is\n     * recommended when enlarging images or processing arbitrary user content,\n     * because large GIF animations can weigh tens or even hundreds of megabytes.\n     * It is also useful to set anim:false when using format:\"json\" to get the\n     * response quicker without the number of frames.\n     */\n    anim?: boolean;\n    /**\n     * What EXIF data should be preserved in the output image. Note that EXIF\n     * rotation and embedded color profiles are always applied (\"baked in\" into\n     * the image), and aren't affected by this option. Note that if the Polish\n     * feature is enabled, all metadata may have been removed already and this\n     * option may have no effect.\n     *  - keep: Preserve most of EXIF metadata, including GPS location if there's\n     *    any.\n     *  - copyright: Only keep the copyright tag, and discard everything else.\n     *    This is the default behavior for JPEG files.\n     *  - none: Discard all invisible EXIF metadata. Currently WebP and PNG\n     *    output formats always discard metadata.\n     */\n    metadata?: \"keep\" | \"copyright\" | \"none\";\n    /**\n     * Strength of sharpening filter to apply to the image. Floating-point\n     * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a\n     * recommended value for downscaled images.\n     */\n    sharpen?: number;\n    /**\n     * Radius of a blur filter (approximate gaussian). Maximum supported radius\n     * is 250.\n     */\n    blur?: number;\n    /**\n     * Overlays are drawn in the order they appear in the array (last array\n     * entry is the topmost layer).\n     */\n    draw?: RequestInitCfPropertiesImageDraw[];\n    /**\n     * Fetching image from authenticated origin. Setting this property will\n     * pass authentication headers (Authorization, Cookie, etc.) through to\n     * the origin.\n     */\n    \"origin-auth\"?: \"share-publicly\";\n    /**\n     * Adds a border around the image. The border is added after resizing. Border\n     * width takes dpr into account, and can be specified either using a single\n     * width property, or individually for each side.\n     */\n    border?: {\n        color: string;\n        width: number;\n    } | {\n        color: string;\n        top: number;\n        right: number;\n        bottom: number;\n        left: number;\n    };\n    /**\n     * Increase brightness by a factor. A value of 1.0 equals no change, a value\n     * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.\n     * 0 is ignored.\n     */\n    brightness?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    contrast?: number;\n    /**\n     * Increase exposure by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.\n     */\n    gamma?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    saturation?: number;\n    /**\n     * Flips the images horizontally, vertically, or both. Flipping is applied before\n     * rotation, so if you apply flip=h,rotate=90 then the image will be flipped\n     * horizontally, then rotated by 90 degrees.\n     */\n    flip?: 'h' | 'v' | 'hv';\n    /**\n     * Slightly reduces latency on a cache miss by selecting a\n     * quickest-to-compress file format, at a cost of increased file size and\n     * lower image quality. It will usually override the format option and choose\n     * JPEG over WebP or AVIF. We do not recommend using this option, except in\n     * unusual circumstances like resizing uncacheable dynamically-generated\n     * images.\n     */\n    compression?: \"fast\";\n}\ninterface RequestInitCfPropertiesImageMinify {\n    javascript?: boolean;\n    css?: boolean;\n    html?: boolean;\n}\ninterface RequestInitCfPropertiesR2 {\n    /**\n     * Colo id of bucket that an object is stored in\n     */\n    bucketColoId?: number;\n}\n/**\n * Request metadata provided by Cloudflare's edge.\n */\ntype IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;\ninterface IncomingRequestCfPropertiesBase extends Record<string, unknown> {\n    /**\n     * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.\n     *\n     * @example 395747\n     */\n    asn?: number;\n    /**\n     * The organization which owns the ASN of the incoming request.\n     *\n     * @example \"Google Cloud\"\n     */\n    asOrganization?: string;\n    /**\n     * The original value of the `Accept-Encoding` header if Cloudflare modified it.\n     *\n     * @example \"gzip, deflate, br\"\n     */\n    clientAcceptEncoding?: string;\n    /**\n     * The number of milliseconds it took for the request to reach your worker.\n     *\n     * @example 22\n     */\n    clientTcpRtt?: number;\n    /**\n     * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)\n     * airport code of the data center that the request hit.\n     *\n     * @example \"DFW\"\n     */\n    colo: string;\n    /**\n     * Represents the upstream's response to a\n     * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)\n     * from cloudflare.\n     *\n     * For workers with no upstream, this will always be `1`.\n     *\n     * @example 3\n     */\n    edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;\n    /**\n     * The HTTP Protocol the request used.\n     *\n     * @example \"HTTP/2\"\n     */\n    httpProtocol: string;\n    /**\n     * The browser-requested prioritization information in the request object.\n     *\n     * If no information was set, defaults to the empty string `\"\"`\n     *\n     * @example \"weight=192;exclusive=0;group=3;group-weight=127\"\n     * @default \"\"\n     */\n    requestPriority: string;\n    /**\n     * The TLS version of the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"TLSv1.3\"\n     */\n    tlsVersion: string;\n    /**\n     * The cipher for the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"AEAD-AES128-GCM-SHA256\"\n     */\n    tlsCipher: string;\n    /**\n     * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.\n     *\n     * If the incoming request was served over plaintext (without TLS) this field is undefined.\n     */\n    tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;\n}\ninterface IncomingRequestCfPropertiesBotManagementBase {\n    /**\n     * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,\n     * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).\n     *\n     * @example 54\n     */\n    score: number;\n    /**\n     * A boolean value that is true if the request comes from a good bot, like Google or Bing.\n     * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).\n     */\n    verifiedBot: boolean;\n    /**\n     * A boolean value that is true if the request originates from a\n     * Cloudflare-verified proxy service.\n     */\n    corporateProxy: boolean;\n    /**\n     * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.\n     */\n    staticResource: boolean;\n    /**\n     * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).\n     */\n    detectionIds: number[];\n}\ninterface IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase;\n    /**\n     * Duplicate of `botManagement.score`.\n     *\n     * @deprecated\n     */\n    clientTrustScore: number;\n}\ninterface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase & {\n        /**\n         * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients\n         * across different destination IPs, Ports, and X509 certificates.\n         */\n        ja3Hash: string;\n    };\n}\ninterface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {\n    /**\n     * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).\n     *\n     * This field is only present if you have Cloudflare for SaaS enabled on your account\n     * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).\n     */\n    hostMetadata?: HostMetadata;\n}\ninterface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {\n    /**\n     * Information about the client certificate presented to Cloudflare.\n     *\n     * This is populated when the incoming request is served over TLS using\n     * either Cloudflare Access or API Shield (mTLS)\n     * and the presented SSL certificate has a valid\n     * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)\n     * (i.e., not `null` or `\"\"`).\n     *\n     * Otherwise, a set of placeholder values are used.\n     *\n     * The property `certPresented` will be set to `\"1\"` when\n     * the object is populated (i.e. the above conditions were met).\n     */\n    tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;\n}\n/**\n * Metadata about the request's TLS handshake\n */\ninterface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {\n    /**\n     * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    clientHandshake: string;\n    /**\n     * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    serverHandshake: string;\n    /**\n     * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    clientFinished: string;\n    /**\n     * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    serverFinished: string;\n}\n/**\n * Geographic data about the request's origin.\n */\ninterface IncomingRequestCfPropertiesGeographicInformation {\n    /**\n     * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.\n     *\n     * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `\"T1\"`, indicating a request that originated over TOR.\n     *\n     * If Cloudflare is unable to determine where the request originated this property is omitted.\n     *\n     * The country code `\"T1\"` is used for requests originating on TOR.\n     *\n     * @example \"GB\"\n     */\n    country?: Iso3166Alpha2Code | \"T1\";\n    /**\n     * If present, this property indicates that the request originated in the EU\n     *\n     * @example \"1\"\n     */\n    isEUCountry?: \"1\";\n    /**\n     * A two-letter code indicating the continent the request originated from.\n     *\n     * @example \"AN\"\n     */\n    continent?: ContinentCode;\n    /**\n     * The city the request originated from\n     *\n     * @example \"Austin\"\n     */\n    city?: string;\n    /**\n     * Postal code of the incoming request\n     *\n     * @example \"78701\"\n     */\n    postalCode?: string;\n    /**\n     * Latitude of the incoming request\n     *\n     * @example \"30.27130\"\n     */\n    latitude?: string;\n    /**\n     * Longitude of the incoming request\n     *\n     * @example \"-97.74260\"\n     */\n    longitude?: string;\n    /**\n     * Timezone of the incoming request\n     *\n     * @example \"America/Chicago\"\n     */\n    timezone?: string;\n    /**\n     * If known, the ISO 3166-2 name for the first level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"Texas\"\n     */\n    region?: string;\n    /**\n     * If known, the ISO 3166-2 code for the first-level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"TX\"\n     */\n    regionCode?: string;\n    /**\n     * Metro code (DMA) of the incoming request\n     *\n     * @example \"635\"\n     */\n    metroCode?: string;\n}\n/** Data about the incoming request's TLS certificate */\ninterface IncomingRequestCfPropertiesTLSClientAuth {\n    /** Always `\"1\"`, indicating that the certificate was presented */\n    certPresented: \"1\";\n    /**\n     * Result of certificate verification.\n     *\n     * @example \"FAILED:self signed certificate\"\n     */\n    certVerified: Exclude<CertVerificationStatus, \"NONE\">;\n    /** The presented certificate's revokation status.\n     *\n     * - A value of `\"1\"` indicates the certificate has been revoked\n     * - A value of `\"0\"` indicates the certificate has not been revoked\n     */\n    certRevoked: \"1\" | \"0\";\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDN: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDN: string;\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDNRFC2253: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDNRFC2253: string;\n    /** The certificate issuer's distinguished name (legacy policies) */\n    certIssuerDNLegacy: string;\n    /** The certificate subject's distinguished name (legacy policies) */\n    certSubjectDNLegacy: string;\n    /**\n     * The certificate's serial number\n     *\n     * @example \"00936EACBE07F201DF\"\n     */\n    certSerial: string;\n    /**\n     * The certificate issuer's serial number\n     *\n     * @example \"2489002934BDFEA34\"\n     */\n    certIssuerSerial: string;\n    /**\n     * The certificate's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certSKI: string;\n    /**\n     * The certificate issuer's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certIssuerSKI: string;\n    /**\n     * The certificate's SHA-1 fingerprint\n     *\n     * @example \"6b9109f323999e52259cda7373ff0b4d26bd232e\"\n     */\n    certFingerprintSHA1: string;\n    /**\n     * The certificate's SHA-256 fingerprint\n     *\n     * @example \"acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea\"\n     */\n    certFingerprintSHA256: string;\n    /**\n     * The effective starting date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotBefore: string;\n    /**\n     * The effective expiration date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotAfter: string;\n}\n/** Placeholder values for TLS Client Authorization */\ninterface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {\n    certPresented: \"0\";\n    certVerified: \"NONE\";\n    certRevoked: \"0\";\n    certIssuerDN: \"\";\n    certSubjectDN: \"\";\n    certIssuerDNRFC2253: \"\";\n    certSubjectDNRFC2253: \"\";\n    certIssuerDNLegacy: \"\";\n    certSubjectDNLegacy: \"\";\n    certSerial: \"\";\n    certIssuerSerial: \"\";\n    certSKI: \"\";\n    certIssuerSKI: \"\";\n    certFingerprintSHA1: \"\";\n    certFingerprintSHA256: \"\";\n    certNotBefore: \"\";\n    certNotAfter: \"\";\n}\n/** Possible outcomes of TLS verification */\ndeclare type CertVerificationStatus = \n/** Authentication succeeded */\n\"SUCCESS\"\n/** No certificate was presented */\n | \"NONE\"\n/** Failed because the certificate was self-signed */\n | \"FAILED:self signed certificate\"\n/** Failed because the certificate failed a trust chain check */\n | \"FAILED:unable to verify the first certificate\"\n/** Failed because the certificate not yet valid */\n | \"FAILED:certificate is not yet valid\"\n/** Failed because the certificate is expired */\n | \"FAILED:certificate has expired\"\n/** Failed for another unspecified reason */\n | \"FAILED\";\n/**\n * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.\n */\ndeclare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = 0 /** Unknown */ | 1 /** no keepalives (not found) */ | 2 /** no connection re-use, opening keepalive connection failed */ | 3 /** no connection re-use, keepalive accepted and saved */ | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ | 5; /** connection re-use, accepted by the origin server */\n/** ISO 3166-1 Alpha-2 codes */\ndeclare type Iso3166Alpha2Code = \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\";\n/** The 2-letter continent codes Cloudflare uses */\ndeclare type ContinentCode = \"AF\" | \"AN\" | \"AS\" | \"EU\" | \"NA\" | \"OC\" | \"SA\";\ntype CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;\ninterface D1Meta {\n    duration: number;\n    size_after: number;\n    rows_read: number;\n    rows_written: number;\n    last_row_id: number;\n    changed_db: boolean;\n    changes: number;\n    /**\n     * The region of the database instance that executed the query.\n     */\n    served_by_region?: string;\n    /**\n     * The three letters airport code of the colo that executed the query.\n     */\n    served_by_colo?: string;\n    /**\n     * True if-and-only-if the database instance that executed the query was the primary.\n     */\n    served_by_primary?: boolean;\n    timings?: {\n        /**\n         * The duration of the SQL query execution by the database instance. It doesn't include any network time.\n         */\n        sql_duration_ms: number;\n    };\n    /**\n     * Number of total attempts to execute the query, due to automatic retries.\n     * Note: All other fields in the response like `timings` only apply to the last attempt.\n     */\n    total_attempts?: number;\n}\ninterface D1Response {\n    success: true;\n    meta: D1Meta & Record<string, unknown>;\n    error?: never;\n}\ntype D1Result<T = unknown> = D1Response & {\n    results: T[];\n};\ninterface D1ExecResult {\n    count: number;\n    duration: number;\n}\ntype D1SessionConstraint = \n// Indicates that the first query should go to the primary, and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n'first-primary'\n// Indicates that the first query can go anywhere (primary or replica), and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n | 'first-unconstrained';\ntype D1SessionBookmark = string;\ndeclare abstract class D1Database {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    exec(query: string): Promise<D1ExecResult>;\n    /**\n     * Creates a new D1 Session anchored at the given constraint or the bookmark.\n     * All queries executed using the created session will have sequential consistency,\n     * meaning that all writes done through the session will be visible in subsequent reads.\n     *\n     * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.\n     */\n    withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;\n    /**\n     * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.\n     */\n    dump(): Promise<ArrayBuffer>;\n}\ndeclare abstract class D1DatabaseSession {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    /**\n     * @returns The latest session bookmark across all executed queries on the session.\n     *          If no query has been executed yet, `null` is returned.\n     */\n    getBookmark(): D1SessionBookmark | null;\n}\ndeclare abstract class D1PreparedStatement {\n    bind(...values: unknown[]): D1PreparedStatement;\n    first<T = unknown>(colName: string): Promise<T | null>;\n    first<T = Record<string, unknown>>(): Promise<T | null>;\n    run<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    all<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    raw<T = unknown[]>(options: {\n        columnNames: true;\n    }): Promise<[\n        string[],\n        ...T[]\n    ]>;\n    raw<T = unknown[]>(options?: {\n        columnNames?: false;\n    }): Promise<T[]>;\n}\n// `Disposable` was added to TypeScript's standard lib types in version 5.2.\n// To support older TypeScript versions, define an empty `Disposable` interface.\n// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,\n// but this will ensure type checking on older versions still passes.\n// TypeScript's interface merging will ensure our empty interface is effectively\n// ignored when `Disposable` is included in the standard lib.\ninterface Disposable {\n}\n/**\n * The returned data after sending an email\n */\ninterface EmailSendResult {\n    /**\n     * The Email Message ID\n     */\n    messageId: string;\n}\n/**\n * An email message that can be sent from a Worker.\n */\ninterface EmailMessage {\n    /**\n     * Envelope From attribute of the email message.\n     */\n    readonly from: string;\n    /**\n     * Envelope To attribute of the email message.\n     */\n    readonly to: string;\n}\n/**\n * An email message that is sent to a consumer Worker and can be rejected/forwarded.\n */\ninterface ForwardableEmailMessage extends EmailMessage {\n    /**\n     * Stream of the email message content.\n     */\n    readonly raw: ReadableStream<Uint8Array>;\n    /**\n     * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     */\n    readonly headers: Headers;\n    /**\n     * Size of the email message content.\n     */\n    readonly rawSize: number;\n    /**\n     * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.\n     * @param reason The reject reason.\n     * @returns void\n     */\n    setReject(reason: string): void;\n    /**\n     * Forward this email message to a verified destination address of the account.\n     * @param rcptTo Verified destination address.\n     * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     * @returns A promise that resolves when the email message is forwarded.\n     */\n    forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;\n    /**\n     * Reply to the sender of this email message with a new EmailMessage object.\n     * @param message The reply message.\n     * @returns A promise that resolves when the email message is replied.\n     */\n    reply(message: EmailMessage): Promise<EmailSendResult>;\n}\n/** A file attachment for an email message */\ntype EmailAttachment = {\n    disposition: 'inline';\n    contentId: string;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n} | {\n    disposition: 'attachment';\n    contentId?: undefined;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n};\n/** An Email Address */\ninterface EmailAddress {\n    name: string;\n    email: string;\n}\n/**\n * A binding that allows a Worker to send email messages.\n */\ninterface SendEmail {\n    send(message: EmailMessage): Promise<EmailSendResult>;\n    send(builder: {\n        from: string | EmailAddress;\n        to: string | string[];\n        subject: string;\n        replyTo?: string | EmailAddress;\n        cc?: string | string[];\n        bcc?: string | string[];\n        headers?: Record<string, string>;\n        text?: string;\n        html?: string;\n        attachments?: EmailAttachment[];\n    }): Promise<EmailSendResult>;\n}\ndeclare abstract class EmailEvent extends ExtendableEvent {\n    readonly message: ForwardableEmailMessage;\n}\ndeclare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ndeclare module \"cloudflare:email\" {\n    let _EmailMessage: {\n        prototype: EmailMessage;\n        new (from: string, to: string, raw: ReadableStream | string): EmailMessage;\n    };\n    export { _EmailMessage as EmailMessage };\n}\n/**\n * Hello World binding to serve as an explanatory example. DO NOT USE\n */\ninterface HelloWorldBinding {\n    /**\n     * Retrieve the current stored value\n     */\n    get(): Promise<{\n        value: string;\n        ms?: number;\n    }>;\n    /**\n     * Set a new stored value\n     */\n    set(value: string): Promise<void>;\n}\ninterface Hyperdrive {\n    /**\n     * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.\n     *\n     * Calling this method returns an identical socket to if you call\n     * `connect(\"host:port\")` using the `host` and `port` fields from this object.\n     * Pick whichever approach works better with your preferred DB client library.\n     *\n     * Note that this socket is not yet authenticated -- it's expected that your\n     * code (or preferably, the client library of your choice) will authenticate\n     * using the information in this class's readonly fields.\n     */\n    connect(): Socket;\n    /**\n     * A valid DB connection string that can be passed straight into the typical\n     * client library/driver/ORM. This will typically be the easiest way to use\n     * Hyperdrive.\n     */\n    readonly connectionString: string;\n    /*\n     * A randomly generated hostname that is only valid within the context of the\n     * currently running Worker which, when passed into `connect()` function from\n     * the \"cloudflare:sockets\" module, will connect to the Hyperdrive instance\n     * for your database.\n     */\n    readonly host: string;\n    /*\n     * The port that must be paired the the host field when connecting.\n     */\n    readonly port: number;\n    /*\n     * The username to use when authenticating to your database via Hyperdrive.\n     * Unlike the host and password, this will be the same every time\n     */\n    readonly user: string;\n    /*\n     * The randomly generated password to use when authenticating to your\n     * database via Hyperdrive. Like the host field, this password is only valid\n     * within the context of the currently running Worker instance from which\n     * it's read.\n     */\n    readonly password: string;\n    /*\n     * The name of the database to connect to.\n     */\n    readonly database: string;\n}\n// Copyright (c) 2024 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ntype ImageInfoResponse = {\n    format: 'image/svg+xml';\n} | {\n    format: string;\n    fileSize: number;\n    width: number;\n    height: number;\n};\ntype ImageTransform = {\n    width?: number;\n    height?: number;\n    background?: string;\n    blur?: number;\n    border?: {\n        color?: string;\n        width?: number;\n    } | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n    };\n    brightness?: number;\n    contrast?: number;\n    fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';\n    flip?: 'h' | 'v' | 'hv';\n    gamma?: number;\n    segment?: 'foreground';\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {\n        x?: number;\n        y?: number;\n        mode: 'remainder' | 'box-center';\n    };\n    rotate?: 0 | 90 | 180 | 270;\n    saturation?: number;\n    sharpen?: number;\n    trim?: 'border' | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n};\ntype ImageDrawOptions = {\n    opacity?: number;\n    repeat?: boolean | string;\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n};\ntype ImageInputOptions = {\n    encoding?: 'base64';\n};\ntype ImageOutputOptions = {\n    format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';\n    quality?: number;\n    background?: string;\n    anim?: boolean;\n};\ninterface ImageMetadata {\n    id: string;\n    filename?: string;\n    uploaded?: string;\n    requireSignedURLs: boolean;\n    meta?: Record<string, unknown>;\n    variants: string[];\n    draft?: boolean;\n    creator?: string;\n}\ninterface ImageUploadOptions {\n    id?: string;\n    filename?: string;\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n    encoding?: 'base64';\n}\ninterface ImageUpdateOptions {\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n}\ninterface ImageListOptions {\n    limit?: number;\n    cursor?: string;\n    sortOrder?: 'asc' | 'desc';\n    creator?: string;\n}\ninterface ImageList {\n    images: ImageMetadata[];\n    cursor?: string;\n    listComplete: boolean;\n}\ninterface HostedImagesBinding {\n    /**\n     * Get detailed metadata for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns Image metadata, or null if not found\n     */\n    details(imageId: string): Promise<ImageMetadata | null>;\n    /**\n     * Get the raw image data for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns ReadableStream of image bytes, or null if not found\n     */\n    image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;\n    /**\n     * Upload a new hosted image\n     * @param image The image file to upload\n     * @param options Upload configuration\n     * @returns Metadata for the uploaded image\n     * @throws {@link ImagesError} if upload fails\n     */\n    upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;\n    /**\n     * Update hosted image metadata\n     * @param imageId The ID of the image\n     * @param options Properties to update\n     * @returns Updated image metadata\n     * @throws {@link ImagesError} if update fails\n     */\n    update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;\n    /**\n     * Delete a hosted image\n     * @param imageId The ID of the image\n     * @returns True if deleted, false if not found\n     */\n    delete(imageId: string): Promise<boolean>;\n    /**\n     * List hosted images with pagination\n     * @param options List configuration\n     * @returns List of images with pagination info\n     * @throws {@link ImagesError} if list fails\n     */\n    list(options?: ImageListOptions): Promise<ImageList>;\n}\ninterface ImagesBinding {\n    /**\n     * Get image metadata (type, width and height)\n     * @throws {@link ImagesError} with code 9412 if input is not an image\n     * @param stream The image bytes\n     */\n    info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;\n    /**\n     * Begin applying a series of transformations to an image\n     * @param stream The image bytes\n     * @returns A transform handle\n     */\n    input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;\n    /**\n     * Access hosted images CRUD operations\n     */\n    readonly hosted: HostedImagesBinding;\n}\ninterface ImageTransformer {\n    /**\n     * Apply transform next, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param transform\n     */\n    transform(transform: ImageTransform): ImageTransformer;\n    /**\n     * Draw an image on this transformer, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param image The image (or transformer that will give the image) to draw\n     * @param options The options configuring how to draw the image\n     */\n    draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;\n    /**\n     * Retrieve the image that results from applying the transforms to the\n     * provided input\n     * @param options Options that apply to the output e.g. output format\n     */\n    output(options: ImageOutputOptions): Promise<ImageTransformationResult>;\n}\ntype ImageTransformationOutputOptions = {\n    encoding?: 'base64';\n};\ninterface ImageTransformationResult {\n    /**\n     * The image as a response, ready to store in cache or return to users\n     */\n    response(): Response;\n    /**\n     * The content type of the returned image\n     */\n    contentType(): string;\n    /**\n     * The bytes of the response\n     */\n    image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;\n}\ninterface ImagesError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\n/**\n * Media binding for transforming media streams.\n * Provides the entry point for media transformation operations.\n */\ninterface MediaBinding {\n    /**\n     * Creates a media transformer from an input stream.\n     * @param media - The input media bytes\n     * @returns A MediaTransformer instance for applying transformations\n     */\n    input(media: ReadableStream<Uint8Array>): MediaTransformer;\n}\n/**\n * Media transformer for applying transformation operations to media content.\n * Handles sizing, fitting, and other input transformation parameters.\n */\ninterface MediaTransformer {\n    /**\n     * Applies transformation options to the media content.\n     * @param transform - Configuration for how the media should be transformed\n     * @returns A generator for producing the transformed media output\n     */\n    transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Generator for producing media transformation results.\n * Configures the output format and parameters for the transformed media.\n */\ninterface MediaTransformationGenerator {\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Result of a media transformation operation.\n * Provides multiple ways to access the transformed media content.\n */\ninterface MediaTransformationResult {\n    /**\n     * Returns the transformed media as a readable stream of bytes.\n     * @returns A promise containing a readable stream with the transformed media\n     */\n    media(): Promise<ReadableStream<Uint8Array>>;\n    /**\n     * Returns the transformed media as an HTTP response object.\n     * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users\n     */\n    response(): Promise<Response>;\n    /**\n     * Returns the MIME type of the transformed media.\n     * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')\n     */\n    contentType(): Promise<string>;\n}\n/**\n * Configuration options for transforming media input.\n * Controls how the media should be resized and fitted.\n */\ntype MediaTransformationInputOptions = {\n    /** How the media should be resized to fit the specified dimensions */\n    fit?: 'contain' | 'cover' | 'scale-down';\n    /** Target width in pixels */\n    width?: number;\n    /** Target height in pixels */\n    height?: number;\n};\n/**\n * Configuration options for Media Transformations output.\n * Controls the format, timing, and type of the generated output.\n */\ntype MediaTransformationOutputOptions = {\n    /**\n     * Output mode determining the type of media to generate\n     */\n    mode?: 'video' | 'spritesheet' | 'frame' | 'audio';\n    /** Whether to include audio in the output */\n    audio?: boolean;\n    /**\n     * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').\n     */\n    time?: string;\n    /**\n     * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').\n     */\n    duration?: string;\n    /**\n     * Number of frames in the spritesheet.\n     */\n    imageCount?: number;\n    /**\n     * Output format for the generated media.\n     */\n    format?: 'jpg' | 'png' | 'm4a';\n};\n/**\n * Error object for media transformation operations.\n * Extends the standard Error interface with additional media-specific information.\n */\ninterface MediaError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ndeclare module 'cloudflare:node' {\n    interface NodeStyleServer {\n        listen(...args: unknown[]): this;\n        address(): {\n            port?: number | null | undefined;\n        };\n    }\n    export function httpServerHandler(port: number): ExportedHandler;\n    export function httpServerHandler(options: {\n        port: number;\n    }): ExportedHandler;\n    export function httpServerHandler(server: NodeStyleServer): ExportedHandler;\n}\ntype Params<P extends string = any> = Record<P, string | string[]>;\ntype EventContext<Env, P extends string, Data> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n};\ntype PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;\ntype EventPluginContext<Env, P extends string, Data, PluginArgs> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n    pluginArgs: PluginArgs;\n};\ntype PagesPluginFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>, PluginArgs = unknown> = (context: EventPluginContext<Env, Params, Data, PluginArgs>) => Response | Promise<Response>;\ndeclare module \"assets:*\" {\n    export const onRequest: PagesFunction;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ndeclare module \"cloudflare:pipelines\" {\n    export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {\n        protected env: Env;\n        protected ctx: ExecutionContext;\n        constructor(ctx: ExecutionContext, env: Env);\n        /**\n         * run receives an array of PipelineRecord which can be\n         * transformed and returned to the pipeline\n         * @param records Incoming records from the pipeline to be transformed\n         * @param metadata Information about the specific pipeline calling the transformation entrypoint\n         * @returns A promise containing the transformed PipelineRecord array\n         */\n        public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;\n    }\n    export type PipelineRecord = Record<string, unknown>;\n    export type PipelineBatchMetadata = {\n        pipelineId: string;\n        pipelineName: string;\n    };\n    export interface Pipeline<T extends PipelineRecord = PipelineRecord> {\n        /**\n         * The Pipeline interface represents the type of a binding to a Pipeline\n         *\n         * @param records The records to send to the pipeline\n         */\n        send(records: T[]): Promise<void>;\n    }\n}\n// PubSubMessage represents an incoming PubSub message.\n// The message includes metadata about the broker, the client, and the payload\n// itself.\n// https://developers.cloudflare.com/pub-sub/\ninterface PubSubMessage {\n    // Message ID\n    readonly mid: number;\n    // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT\n    readonly broker: string;\n    // The MQTT topic the message was sent on.\n    readonly topic: string;\n    // The client ID of the client that published this message.\n    readonly clientId: string;\n    // The unique identifier (JWT ID) used by the client to authenticate, if token\n    // auth was used.\n    readonly jti?: string;\n    // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker\n    // received the message from the client.\n    readonly receivedAt: number;\n    // An (optional) string with the MIME type of the payload, if set by the\n    // client.\n    readonly contentType: string;\n    // Set to 1 when the payload is a UTF-8 string\n    // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063\n    readonly payloadFormatIndicator: number;\n    // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.\n    // You can use payloadFormatIndicator to inspect this before decoding.\n    payload: string | Uint8Array;\n}\n// JsonWebKey extended by kid parameter\ninterface JsonWebKeyWithKid extends JsonWebKey {\n    // Key Identifier of the JWK\n    readonly kid: string;\n}\ninterface RateLimitOptions {\n    key: string;\n}\ninterface RateLimitOutcome {\n    success: boolean;\n}\ninterface RateLimit {\n    /**\n     * Rate limit a request based on the provided options.\n     * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/\n     * @returns A promise that resolves with the outcome of the rate limit.\n     */\n    limit(options: RateLimitOptions): Promise<RateLimitOutcome>;\n}\n// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need\n// to referenced by `Fetcher`. This is included in the \"importable\" version of the types which\n// strips all `module` blocks.\ndeclare namespace Rpc {\n    // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.\n    // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.\n    // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to\n    // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)\n    export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';\n    export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';\n    export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';\n    export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';\n    export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';\n    export interface RpcTargetBranded {\n        [__RPC_TARGET_BRAND]: never;\n    }\n    export interface WorkerEntrypointBranded {\n        [__WORKER_ENTRYPOINT_BRAND]: never;\n    }\n    export interface DurableObjectBranded {\n        [__DURABLE_OBJECT_BRAND]: never;\n    }\n    export interface WorkflowEntrypointBranded {\n        [__WORKFLOW_ENTRYPOINT_BRAND]: never;\n    }\n    export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;\n    // Types that can be used through `Stub`s\n    export type Stubable = RpcTargetBranded | ((...args: any[]) => any);\n    // Types that can be passed over RPC\n    // The reason for using a generic type here is to build a serializable subset of structured\n    //   cloneable composite types. This allows types defined with the \"interface\" keyword to pass the\n    //   serializable check as well. Otherwise, only types defined with the \"type\" keyword would pass.\n    type Serializable<T> = \n    // Structured cloneables\n    BaseType\n    // Structured cloneable composites\n     | Map<T extends Map<infer U, unknown> ? Serializable<U> : never, T extends Map<unknown, infer U> ? Serializable<U> : never> | Set<T extends Set<infer U> ? Serializable<U> : never> | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never> | {\n        [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;\n    }\n    // Special types\n     | Stub<Stubable>\n    // Serialized as stubs, see `Stubify`\n     | Stubable;\n    // Base type for all RPC stubs, including common memory management methods.\n    // `T` is used as a marker type for unwrapping `Stub`s later.\n    interface StubBase<T extends Stubable> extends Disposable {\n        [__RPC_STUB_BRAND]: T;\n        dup(): this;\n    }\n    export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;\n    // This represents all the types that can be sent as-is over an RPC boundary\n    type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;\n    // Recursively rewrite all `Stubable` types with `Stub`s\n    // prettier-ignore\n    type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, infer V> ? Map<Stubify<K>, Stubify<V>> : T extends Set<infer V> ? Set<Stubify<V>> : T extends Array<infer V> ? Array<Stubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Stubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: any;\n    } ? {\n        [K in keyof T]: Stubify<T[K]>;\n    } : T;\n    // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.\n    // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:\n    // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.\n    // prettier-ignore\n    type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infer K, infer V> ? Map<Unstubify<K>, Unstubify<V>> : T extends Set<infer V> ? Set<Unstubify<V>> : T extends Array<infer V> ? Array<Unstubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Unstubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: unknown;\n    } ? {\n        [K in keyof T]: Unstubify<T[K]>;\n    } : T;\n    type UnstubifyAll<A extends any[]> = {\n        [I in keyof A]: Unstubify<A[I]>;\n    };\n    // Utility type for adding `Provider`/`Disposable`s to `object` types only.\n    // Note `unknown & T` is equivalent to `T`.\n    type MaybeProvider<T> = T extends object ? Provider<T> : unknown;\n    type MaybeDisposable<T> = T extends object ? Disposable : unknown;\n    // Type for method return or property on an RPC interface.\n    // - Stubable types are replaced by stubs.\n    // - Serializable types are passed by value, with stubable types replaced by stubs\n    //   and a top-level `Disposer`.\n    // Everything else can't be passed over PRC.\n    // Technically, we use custom thenables here, but they quack like `Promise`s.\n    // Intersecting with `(Maybe)Provider` allows pipelining.\n    // prettier-ignore\n    type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;\n    // Type for method or property on an RPC interface.\n    // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.\n    // Unwrapping `Stub`s allows calling with `Stubable` arguments.\n    // For properties, rewrite types to be `Result`s.\n    // In each case, unwrap `Promise`s.\n    type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;\n    // Type for the callable part of an `Provider` if `T` is callable.\n    // This is intersected with methods/properties.\n    type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;\n    // Base type for all other types providing RPC-like interfaces.\n    // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.\n    // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.\n    export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{\n        [K in keyof T]: MethodOrProperty<T[K]>;\n    }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;\n}\ndeclare namespace Cloudflare {\n    // Type of `env`.\n    //\n    // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript\n    // will merge all declarations.\n    //\n    // You can use `wrangler types` to generate the `Env` type automatically.\n    interface Env {\n    }\n    // Project-specific parameters used to inform types.\n    //\n    // This interface is, again, intended to be declared in project-specific files, and then that\n    // declaration will be merged with this one.\n    //\n    // A project should have a declaration like this:\n    //\n    //     interface GlobalProps {\n    //       // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type\n    //       // of `ctx.exports`.\n    //       mainModule: typeof import(\"my-main-module\");\n    //\n    //       // Declares which of the main module's exports are configured with durable storage, and\n    //       // thus should behave as Durable Object namsepace bindings.\n    //       durableNamespaces: \"MyDurableObject\" | \"AnotherDurableObject\";\n    //     }\n    //\n    // You can use `wrangler types` to generate `GlobalProps` automatically.\n    interface GlobalProps {\n    }\n    // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not\n    // present.\n    type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;\n    // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the\n    // `mainModule` property.\n    type MainModule = GlobalProp<\"mainModule\", {}>;\n    // The type of ctx.exports, which contains loopback bindings for all top-level exports.\n    type Exports = {\n        [K in keyof MainModule]: LoopbackForExport<MainModule[K]>\n        // If the export is listed in `durableNamespaces`, then it is also a\n        // DurableObjectNamespace.\n         & (K extends GlobalProp<\"durableNamespaces\", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});\n    };\n}\ndeclare namespace CloudflareWorkersModule {\n    export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;\n    export const RpcStub: {\n        new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;\n    };\n    export abstract class RpcTarget implements Rpc.RpcTargetBranded {\n        [Rpc.__RPC_TARGET_BRAND]: never;\n    }\n    // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC\n    export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {\n        [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext<Props>;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        email?(message: ForwardableEmailMessage): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        queue?(batch: MessageBatch<unknown>): void | Promise<void>;\n        scheduled?(controller: ScheduledController): void | Promise<void>;\n        tail?(events: TraceItem[]): void | Promise<void>;\n        tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\n        test?(controller: TestController): void | Promise<void>;\n        trace?(traces: TraceItem[]): void | Promise<void>;\n    }\n    export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {\n        [Rpc.__DURABLE_OBJECT_BRAND]: never;\n        protected ctx: DurableObjectState<Props>;\n        protected env: Env;\n        constructor(ctx: DurableObjectState, env: Env);\n        alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n        webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n        webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n    }\n    export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n    export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\n    export type WorkflowDelayDuration = WorkflowSleepDuration;\n    export type WorkflowTimeoutDuration = WorkflowSleepDuration;\n    export type WorkflowRetentionDuration = WorkflowSleepDuration;\n    export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';\n    export type WorkflowStepConfig = {\n        retries?: {\n            limit: number;\n            delay: WorkflowDelayDuration | number;\n            backoff?: WorkflowBackoff;\n        };\n        timeout?: WorkflowTimeoutDuration | number;\n    };\n    export type WorkflowEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        instanceId: string;\n    };\n    export type WorkflowStepEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        type: string;\n    };\n    export type WorkflowStepContext = {\n        attempt: number;\n    };\n    export abstract class WorkflowStep {\n        do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;\n        sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;\n        waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {\n            type: string;\n            timeout?: WorkflowTimeoutDuration | number;\n        }): Promise<WorkflowStepEvent<T>>;\n    }\n    export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';\n    export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {\n        [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;\n    }\n    export function waitUntil(promise: Promise<unknown>): void;\n    export function withEnv(newEnv: unknown, fn: () => unknown): unknown;\n    export function withExports(newExports: unknown, fn: () => unknown): unknown;\n    export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;\n    export const env: Cloudflare.Env;\n    export const exports: Cloudflare.Exports;\n}\ndeclare module 'cloudflare:workers' {\n    export = CloudflareWorkersModule;\n}\ninterface SecretsStoreSecret {\n    /**\n     * Get a secret from the Secrets Store, returning a string of the secret value\n     * if it exists, or throws an error if it does not exist\n     */\n    get(): Promise<string>;\n}\ndeclare module \"cloudflare:sockets\" {\n    function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;\n    export { _connect as connect };\n}\n/**\n * Binding entrypoint for Cloudflare Stream.\n *\n * Usage:\n * - Binding-level operations:\n *   `await env.STREAM.videos.upload`\n *   `await env.STREAM.videos.createDirectUpload`\n *   `await env.STREAM.videos.*`\n *   `await env.STREAM.watermarks.*`\n * - Per-video operations:\n *   `await env.STREAM.video(id).downloads.*`\n *   `await env.STREAM.video(id).captions.*`\n *\n * Example usage:\n * ```ts\n * await env.STREAM.video(id).downloads.generate();\n *\n * const video = env.STREAM.video(id)\n * const captions = video.captions.list();\n * const videoDetails = video.details()\n * ```\n */\ninterface StreamBinding {\n    /**\n     * Returns a handle scoped to a single video for per-video operations.\n     * @param id The unique identifier for the video.\n     * @returns A handle for per-video operations.\n     */\n    video(id: string): StreamVideoHandle;\n    /**\n     * Uploads a new video from a File.\n     * @param file The video file to upload.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(file: File): Promise<StreamVideo>;\n    /**\n     * Uploads a new video from a provided URL.\n     * @param url The URL to upload from.\n     * @param params Optional upload parameters.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {AlreadyUploadedError} if a video was already uploaded to this URL\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;\n    /**\n     * Creates a direct upload that allows video uploads without an API key.\n     * @param params Parameters for the direct upload\n     * @returns The direct upload details.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;\n    videos: StreamVideos;\n    watermarks: StreamWatermarks;\n}\n/**\n * Handle for operations scoped to a single Stream video.\n */\ninterface StreamVideoHandle {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * Get a full videos details\n     * @returns The full video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    details(): Promise<StreamVideo>;\n    /**\n     * Update details for a single video.\n     * @param params The fields to update for the video.\n     * @returns The updated video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    update(params: StreamUpdateVideoParams): Promise<StreamVideo>;\n    /**\n     * Deletes a video and its copies from Cloudflare Stream.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(): Promise<void>;\n    /**\n     * Creates a signed URL token for a video.\n     * @returns The signed token that was created.\n     * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed\n     */\n    generateToken(): Promise<string>;\n    downloads: StreamScopedDownloads;\n    captions: StreamScopedCaptions;\n}\ninterface StreamVideo {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator: string | null;\n    /**\n     * The thumbnail URL for the video.\n     */\n    thumbnail: string;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct: number;\n    /**\n     * Indicates whether the video is ready to stream.\n     */\n    readyToStream: boolean;\n    /**\n     * The date and time the video became ready to stream.\n     */\n    readyToStreamAt: string | null;\n    /**\n     * Processing status information.\n     */\n    status: StreamVideoStatus;\n    /**\n     * A user modifiable key-value store.\n     */\n    meta: Record<string, string>;\n    /**\n     * The date and time the video was created.\n     */\n    created: string;\n    /**\n     * The date and time the video was last modified.\n     */\n    modified: string;\n    /**\n     * The date and time at which the video will be deleted.\n     */\n    scheduledDeletion: string | null;\n    /**\n     * The size of the video in bytes.\n     */\n    size: number;\n    /**\n     * The preview URL for the video.\n     */\n    preview?: string;\n    /**\n     * Origins allowed to display the video.\n     */\n    allowedOrigins: Array<string>;\n    /**\n     * Indicates whether signed URLs are required.\n     */\n    requireSignedURLs: boolean | null;\n    /**\n     * The date and time the video was uploaded.\n     */\n    uploaded: string | null;\n    /**\n     * The date and time when the upload URL expires.\n     */\n    uploadExpiry: string | null;\n    /**\n     * The maximum size in bytes for direct uploads.\n     */\n    maxSizeBytes: number | null;\n    /**\n     * The maximum duration in seconds for direct uploads.\n     */\n    maxDurationSeconds: number | null;\n    /**\n     * The video duration in seconds. -1 indicates unknown.\n     */\n    duration: number;\n    /**\n     * Input metadata for the original upload.\n     */\n    input: StreamVideoInput;\n    /**\n     * Playback URLs for the video.\n     */\n    hlsPlaybackUrl: string;\n    dashPlaybackUrl: string;\n    /**\n     * The watermark applied to the video, if any.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The live input id associated with the video, if any.\n     */\n    liveInputId?: string | null;\n    /**\n     * The source video id if this is a clip.\n     */\n    clippedFromId: string | null;\n    /**\n     * Public details associated with the video.\n     */\n    publicDetails: StreamPublicDetails | null;\n}\ntype StreamVideoStatus = {\n    /**\n     * The current processing state.\n     */\n    state: string;\n    /**\n     * The current processing step.\n     */\n    step?: string;\n    /**\n     * The percent complete as a string.\n     */\n    pctComplete?: string;\n    /**\n     * An error reason code, if applicable.\n     */\n    errorReasonCode: string;\n    /**\n     * An error reason text, if applicable.\n     */\n    errorReasonText: string;\n};\ntype StreamVideoInput = {\n    /**\n     * The input width in pixels.\n     */\n    width: number;\n    /**\n     * The input height in pixels.\n     */\n    height: number;\n};\ntype StreamPublicDetails = {\n    /**\n     * The public title for the video.\n     */\n    title: string | null;\n    /**\n     * The public share link.\n     */\n    share_link: string | null;\n    /**\n     * The public channel link.\n     */\n    channel_link: string | null;\n    /**\n     * The public logo URL.\n     */\n    logo: string | null;\n};\ntype StreamDirectUpload = {\n    /**\n     * The URL an unauthenticated upload can use for a single multipart request.\n     */\n    uploadURL: string;\n    /**\n     * A Cloudflare-generated unique identifier for a media item.\n     */\n    id: string;\n    /**\n     * The watermark profile applied to the upload.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The scheduled deletion time, if any.\n     */\n    scheduledDeletion: string | null;\n};\ntype StreamDirectUploadCreateParams = {\n    /**\n     * The maximum duration in seconds for a video upload.\n     */\n    maxDurationSeconds: number;\n    /**\n     * The date and time after upload when videos will not be accepted.\n     */\n    expiry?: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of record for\n     * managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Lists the origins allowed to display the video.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * Indicates whether the video can be accessed using the id. When set to `true`,\n     * a signed token must be generated with a signing key to view the video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The date and time at which the video will be deleted. Include `null` to remove\n     * a scheduled deletion.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The watermark profile to apply.\n     */\n    watermark?: StreamDirectUploadWatermark;\n};\ntype StreamDirectUploadWatermark = {\n    /**\n     * The unique identifier for the watermark profile.\n     */\n    id: string;\n};\ntype StreamUrlUploadParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The identifier for the watermark profile\n     */\n    watermarkId?: string;\n};\ninterface StreamScopedCaptions {\n    /**\n     * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.\n     * One caption or subtitle file per language is allowed.\n     * @param language The BCP 47 language tag for the caption or subtitle.\n     * @param file The caption or subtitle file to upload.\n     * @returns The created caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language or file is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(language: string, file: File): Promise<StreamCaption>;\n    /**\n     * Generate captions or subtitles for the provided language via AI.\n     * @param language The BCP 47 language tag to generate.\n     * @returns The generated caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language is invalid\n     * @throws {StreamError} if a generated caption already exists\n     * @throws {StreamError} if the video duration is too long\n     * @throws {StreamError} if the video is missing audio\n     * @throws {StreamError} if the requested language is not supported\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(language: string): Promise<StreamCaption>;\n    /**\n     * Lists the captions or subtitles.\n     * Use the language parameter to filter by a specific language.\n     * @param language The optional BCP 47 language tag to filter by.\n     * @returns The list of captions or subtitles.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(language?: string): Promise<StreamCaption[]>;\n    /**\n     * Removes the captions or subtitles from a video.\n     * @param language The BCP 47 language tag to remove.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(language: string): Promise<void>;\n}\ninterface StreamScopedDownloads {\n    /**\n     * Generates a download for a video when a video is ready to view. Available\n     * types are `default` and `audio`. Defaults to `default` when omitted.\n     * @param downloadType The download type to create.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the download type is invalid\n     * @throws {StreamError} if the video duration is too long to generate a download\n     * @throws {StreamError} if the video is not ready to stream\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;\n    /**\n     * Lists the downloads created for a video.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(): Promise<StreamDownloadGetResponse>;\n    /**\n     * Delete the downloads for a video. Available types are `default` and `audio`.\n     * Defaults to `default` when omitted.\n     * @param downloadType The download type to delete.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(downloadType?: StreamDownloadType): Promise<void>;\n}\ninterface StreamVideos {\n    /**\n     * Lists all videos in a users account.\n     * @returns The list of videos.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(params?: StreamVideosListParams): Promise<StreamVideo[]>;\n}\ninterface StreamWatermarks {\n    /**\n     * Generate a new watermark profile\n     * @param file The image file to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(file: File, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Generate a new watermark profile\n     * @param url The image url to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Lists all watermark profiles for an account.\n     * @returns The list of watermark profiles.\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(): Promise<StreamWatermark[]>;\n    /**\n     * Retrieves details for a single watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns The watermark profile details.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(watermarkId: string): Promise<StreamWatermark>;\n    /**\n     * Deletes a watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(watermarkId: string): Promise<void>;\n}\ntype StreamUpdateVideoParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * The maximum duration in seconds for a video upload. Can be set for a\n     * video that is not yet uploaded to limit its duration. Uploads that exceed the\n     * specified duration will fail during processing. A value of `-1` means the value\n     * is unknown.\n     */\n    maxDurationSeconds?: number;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n};\ntype StreamCaption = {\n    /**\n     * Whether the caption was generated via AI.\n     */\n    generated?: boolean;\n    /**\n     * The language label displayed in the native language to users.\n     */\n    label: string;\n    /**\n     * The language tag in BCP 47 format.\n     */\n    language: string;\n    /**\n     * The status of a generated caption.\n     */\n    status?: 'ready' | 'inprogress' | 'error';\n};\ntype StreamDownloadStatus = 'ready' | 'inprogress' | 'error';\ntype StreamDownloadType = 'default' | 'audio';\ntype StreamDownload = {\n    /**\n     * Indicates the progress as a percentage between 0 and 100.\n     */\n    percentComplete: number;\n    /**\n     * The status of a generated download.\n     */\n    status: StreamDownloadStatus;\n    /**\n     * The URL to access the generated download.\n     */\n    url?: string;\n};\n/**\n * An object with download type keys. Each key is optional and only present if that\n * download type has been created.\n */\ntype StreamDownloadGetResponse = {\n    /**\n     * The audio-only download. Only present if this download type has been created.\n     */\n    audio?: StreamDownload;\n    /**\n     * The default video download. Only present if this download type has been created.\n     */\n    default?: StreamDownload;\n};\ntype StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';\ntype StreamWatermark = {\n    /**\n     * The unique identifier for a watermark profile.\n     */\n    id: string;\n    /**\n     * The size of the image in bytes.\n     */\n    size: number;\n    /**\n     * The height of the image in pixels.\n     */\n    height: number;\n    /**\n     * The width of the image in pixels.\n     */\n    width: number;\n    /**\n     * The date and a time a watermark profile was created.\n     */\n    created: string;\n    /**\n     * The source URL for a downloaded image. If the watermark profile was created via\n     * direct upload, this field is null.\n     */\n    downloadedFrom: string | null;\n    /**\n     * A short description of the watermark profile.\n     */\n    name: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the image\n     * is already semi-transparent, setting this to `1.0` will not make the image\n     * completely opaque.\n     */\n    opacity: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the video\n     * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded\n     * video width or length, as determined by the algorithm.\n     */\n    padding: number;\n    /**\n     * The size of the image relative to the overall size of the video. This parameter\n     * will adapt to horizontal and vertical videos automatically. `0.0` indicates no\n     * scaling (use the size of the image as-is), and `1.0 `fills the entire video.\n     */\n    scale: number;\n    /**\n     * The location of the image. Valid positions are: `upperRight`, `upperLeft`,\n     * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the\n     * `padding` parameter.\n     */\n    position: StreamWatermarkPosition;\n};\ntype StreamWatermarkCreateParams = {\n    /**\n     * A short description of the watermark profile.\n     */\n    name?: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the\n     * image is already semi-transparent, setting this to `1.0` will not make the\n     * image completely opaque.\n     */\n    opacity?: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the\n     * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully\n     * padded video width or length, as determined by the algorithm.\n     */\n    padding?: number;\n    /**\n     * The size of the image relative to the overall size of the video. This\n     * parameter will adapt to horizontal and vertical videos automatically. `0.0`\n     * indicates no scaling (use the size of the image as-is), and `1.0 `fills the\n     * entire video.\n     */\n    scale?: number;\n    /**\n     * The location of the image.\n     */\n    position?: StreamWatermarkPosition;\n};\ntype StreamVideosListParams = {\n    /**\n     * The maximum number of videos to return.\n     */\n    limit?: number;\n    /**\n     * Return videos created before this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    before?: string;\n    /**\n     * Comparison operator for the `before` field.\n     * @default 'lt'\n     */\n    beforeComp?: StreamPaginationComparison;\n    /**\n     * Return videos created after this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    after?: string;\n    /**\n     * Comparison operator for the `after` field.\n     * @default 'gte'\n     */\n    afterComp?: StreamPaginationComparison;\n};\ntype StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';\n/**\n * Error object for Stream binding operations.\n */\ninterface StreamError extends Error {\n    readonly code: number;\n    readonly statusCode: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ninterface InternalError extends StreamError {\n    name: 'InternalError';\n}\ninterface BadRequestError extends StreamError {\n    name: 'BadRequestError';\n}\ninterface NotFoundError extends StreamError {\n    name: 'NotFoundError';\n}\ninterface ForbiddenError extends StreamError {\n    name: 'ForbiddenError';\n}\ninterface RateLimitedError extends StreamError {\n    name: 'RateLimitedError';\n}\ninterface QuotaReachedError extends StreamError {\n    name: 'QuotaReachedError';\n}\ninterface MaxFileSizeError extends StreamError {\n    name: 'MaxFileSizeError';\n}\ninterface InvalidURLError extends StreamError {\n    name: 'InvalidURLError';\n}\ninterface AlreadyUploadedError extends StreamError {\n    name: 'AlreadyUploadedError';\n}\ninterface TooManyWatermarksError extends StreamError {\n    name: 'TooManyWatermarksError';\n}\ntype MarkdownDocument = {\n    name: string;\n    blob: Blob;\n};\ntype ConversionResponse = {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'markdown';\n    tokens: number;\n    data: string;\n} | {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'error';\n    error: string;\n};\ntype ImageConversionOptions = {\n    descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';\n};\ntype EmbeddedImageConversionOptions = ImageConversionOptions & {\n    convert?: boolean;\n    maxConvertedImages?: number;\n};\ntype ConversionOptions = {\n    html?: {\n        images?: EmbeddedImageConversionOptions & {\n            convertOGImage?: boolean;\n        };\n        hostname?: string;\n        cssSelector?: string;\n    };\n    docx?: {\n        images?: EmbeddedImageConversionOptions;\n    };\n    image?: ImageConversionOptions;\n    pdf?: {\n        images?: EmbeddedImageConversionOptions;\n        metadata?: boolean;\n    };\n};\ntype ConversionRequestOptions = {\n    gateway?: GatewayOptions;\n    extraHeaders?: object;\n    conversionOptions?: ConversionOptions;\n};\ntype SupportedFileFormat = {\n    mimeType: string;\n    extension: string;\n};\ndeclare abstract class ToMarkdownService {\n    transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n    supported(): Promise<SupportedFileFormat[]>;\n}\ndeclare namespace TailStream {\n    interface Header {\n        readonly name: string;\n        readonly value: string;\n    }\n    interface FetchEventInfo {\n        readonly type: \"fetch\";\n        readonly method: string;\n        readonly url: string;\n        readonly cfJson?: object;\n        readonly headers: Header[];\n    }\n    interface JsRpcEventInfo {\n        readonly type: \"jsrpc\";\n    }\n    interface ScheduledEventInfo {\n        readonly type: \"scheduled\";\n        readonly scheduledTime: Date;\n        readonly cron: string;\n    }\n    interface AlarmEventInfo {\n        readonly type: \"alarm\";\n        readonly scheduledTime: Date;\n    }\n    interface QueueEventInfo {\n        readonly type: \"queue\";\n        readonly queueName: string;\n        readonly batchSize: number;\n    }\n    interface EmailEventInfo {\n        readonly type: \"email\";\n        readonly mailFrom: string;\n        readonly rcptTo: string;\n        readonly rawSize: number;\n    }\n    interface TraceEventInfo {\n        readonly type: \"trace\";\n        readonly traces: (string | null)[];\n    }\n    interface HibernatableWebSocketEventInfoMessage {\n        readonly type: \"message\";\n    }\n    interface HibernatableWebSocketEventInfoError {\n        readonly type: \"error\";\n    }\n    interface HibernatableWebSocketEventInfoClose {\n        readonly type: \"close\";\n        readonly code: number;\n        readonly wasClean: boolean;\n    }\n    interface HibernatableWebSocketEventInfo {\n        readonly type: \"hibernatableWebSocket\";\n        readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;\n    }\n    interface CustomEventInfo {\n        readonly type: \"custom\";\n    }\n    interface FetchResponseInfo {\n        readonly type: \"fetch\";\n        readonly statusCode: number;\n    }\n    type EventOutcome = \"ok\" | \"canceled\" | \"exception\" | \"unknown\" | \"killSwitch\" | \"daemonDown\" | \"exceededCpu\" | \"exceededMemory\" | \"loadShed\" | \"responseStreamDisconnected\" | \"scriptNotFound\";\n    interface ScriptVersion {\n        readonly id: string;\n        readonly tag?: string;\n        readonly message?: string;\n    }\n    interface Onset {\n        readonly type: \"onset\";\n        readonly attributes: Attribute[];\n        // id for the span being opened by this Onset event.\n        readonly spanId: string;\n        readonly dispatchNamespace?: string;\n        readonly entrypoint?: string;\n        readonly executionModel: string;\n        readonly scriptName?: string;\n        readonly scriptTags?: string[];\n        readonly scriptVersion?: ScriptVersion;\n        readonly info: FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;\n    }\n    interface Outcome {\n        readonly type: \"outcome\";\n        readonly outcome: EventOutcome;\n        readonly cpuTime: number;\n        readonly wallTime: number;\n    }\n    interface SpanOpen {\n        readonly type: \"spanOpen\";\n        readonly name: string;\n        // id for the span being opened by this SpanOpen event.\n        readonly spanId: string;\n        readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;\n    }\n    interface SpanClose {\n        readonly type: \"spanClose\";\n        readonly outcome: EventOutcome;\n    }\n    interface DiagnosticChannelEvent {\n        readonly type: \"diagnosticChannel\";\n        readonly channel: string;\n        readonly message: any;\n    }\n    interface Exception {\n        readonly type: \"exception\";\n        readonly name: string;\n        readonly message: string;\n        readonly stack?: string;\n    }\n    interface Log {\n        readonly type: \"log\";\n        readonly level: \"debug\" | \"error\" | \"info\" | \"log\" | \"warn\";\n        readonly message: object;\n    }\n    interface DroppedEventsDiagnostic {\n        readonly diagnosticsType: \"droppedEvents\";\n        readonly count: number;\n    }\n    interface StreamDiagnostic {\n        readonly type: 'streamDiagnostic';\n        // To add new diagnostic types, define a new interface and add it to this union type.\n        readonly diagnostic: DroppedEventsDiagnostic;\n    }\n    // This marks the worker handler return information.\n    // This is separate from Outcome because the worker invocation can live for a long time after\n    // returning. For example - Websockets that return an http upgrade response but then continue\n    // streaming information or SSE http connections.\n    interface Return {\n        readonly type: \"return\";\n        readonly info?: FetchResponseInfo;\n    }\n    interface Attribute {\n        readonly name: string;\n        readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];\n    }\n    interface Attributes {\n        readonly type: \"attributes\";\n        readonly info: Attribute[];\n    }\n    type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;\n    // Context in which this trace event lives.\n    interface SpanContext {\n        // Single id for the entire top-level invocation\n        // This should be a new traceId for the first worker stage invoked in the eyeball request and then\n        // same-account service-bindings should reuse the same traceId but cross-account service-bindings\n        // should use a new traceId.\n        readonly traceId: string;\n        // spanId in which this event is handled\n        // for Onset and SpanOpen events this would be the parent span id\n        // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events\n        // For Hibernate and Mark this would be the span under which they were emitted.\n        // spanId is not set ONLY if:\n        //  1. This is an Onset event\n        //  2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)\n        readonly spanId?: string;\n    }\n    interface TailEvent<Event extends EventType> {\n        // invocation id of the currently invoked worker stage.\n        // invocation id will always be unique to every Onset event and will be the same until the Outcome event.\n        readonly invocationId: string;\n        // Inherited spanContext for this event.\n        readonly spanContext: SpanContext;\n        readonly timestamp: Date;\n        readonly sequence: number;\n        readonly event: Event;\n    }\n    type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;\n    type TailEventHandlerObject = {\n        outcome?: TailEventHandler<Outcome>;\n        spanOpen?: TailEventHandler<SpanOpen>;\n        spanClose?: TailEventHandler<SpanClose>;\n        diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;\n        exception?: TailEventHandler<Exception>;\n        log?: TailEventHandler<Log>;\n        return?: TailEventHandler<Return>;\n        attributes?: TailEventHandler<Attributes>;\n    };\n    type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\n/**\n * Data types supported for holding vector metadata.\n */\ntype VectorizeVectorMetadataValue = string | number | boolean | string[];\n/**\n * Additional information to associate with a vector.\n */\ntype VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;\ntype VectorFloatArray = Float32Array | Float64Array;\ninterface VectorizeError {\n    code?: number;\n    error: string;\n}\n/**\n * Comparison logic/operation to use for metadata filtering.\n *\n * This list is expected to grow as support for more operations are released.\n */\ntype VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';\ntype VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';\n/**\n * Filter criteria for vector metadata used to limit the retrieved query result set.\n */\ntype VectorizeVectorMetadataFilter = {\n    [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {\n        [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;\n    } | {\n        [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];\n    };\n};\n/**\n * Supported distance metrics for an index.\n * Distance metrics determine how other \"similar\" vectors are determined.\n */\ntype VectorizeDistanceMetric = \"euclidean\" | \"cosine\" | \"dot-product\";\n/**\n * Metadata return levels for a Vectorize query.\n *\n * Default to \"none\".\n *\n * @property all      Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.\n * @property indexed  Return all metadata fields configured for indexing in the vector return set. This level of retrieval is \"free\" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).\n * @property none     No indexed metadata will be returned.\n */\ntype VectorizeMetadataRetrievalLevel = \"all\" | \"indexed\" | \"none\";\ninterface VectorizeQueryOptions {\n    topK?: number;\n    namespace?: string;\n    returnValues?: boolean;\n    returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;\n    filter?: VectorizeVectorMetadataFilter;\n}\n/**\n * Information about the configuration of an index.\n */\ntype VectorizeIndexConfig = {\n    dimensions: number;\n    metric: VectorizeDistanceMetric;\n} | {\n    preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity\n};\n/**\n * Metadata about an existing index.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeIndexInfo} for its post-beta equivalent.\n */\ninterface VectorizeIndexDetails {\n    /** The unique ID of the index */\n    readonly id: string;\n    /** The name of the index. */\n    name: string;\n    /** (optional) A human readable description for the index. */\n    description?: string;\n    /** The index configuration, including the dimension size and distance metric. */\n    config: VectorizeIndexConfig;\n    /** The number of records containing vectors within the index. */\n    vectorsCount: number;\n}\n/**\n * Metadata about an existing index.\n */\ninterface VectorizeIndexInfo {\n    /** The number of records containing vectors within the index. */\n    vectorCount: number;\n    /** Number of dimensions the index has been configured for. */\n    dimensions: number;\n    /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToDatetime: number;\n    /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToMutation: number;\n}\n/**\n * Represents a single vector value set along with its associated metadata.\n */\ninterface VectorizeVector {\n    /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */\n    id: string;\n    /** The vector values */\n    values: VectorFloatArray | number[];\n    /** The namespace this vector belongs to. */\n    namespace?: string;\n    /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */\n    metadata?: Record<string, VectorizeVectorMetadata>;\n}\n/**\n * Represents a matched vector for a query along with its score and (if specified) the matching vector information.\n */\ntype VectorizeMatch = Pick<Partial<VectorizeVector>, \"values\"> & Omit<VectorizeVector, \"values\"> & {\n    /** The score or rank for similarity, when returned as a result */\n    score: number;\n};\n/**\n * A set of matching {@link VectorizeMatch} for a particular query.\n */\ninterface VectorizeMatches {\n    matches: VectorizeMatch[];\n    count: number;\n}\n/**\n * Results of an operation that performed a mutation on a set of vectors.\n * Here, `ids` is a list of vectors that were successfully processed.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeAsyncMutation} for its post-beta equivalent.\n */\ninterface VectorizeVectorMutation {\n    /* List of ids of vectors that were successfully processed. */\n    ids: string[];\n    /* Total count of the number of processed vectors. */\n    count: number;\n}\n/**\n * Result type indicating a mutation on the Vectorize Index.\n * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.\n */\ninterface VectorizeAsyncMutation {\n    /** The unique identifier for the async mutation operation containing the changeset. */\n    mutationId: string;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link Vectorize} for its new implementation.\n */\ndeclare abstract class VectorizeIndex {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexDetails>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * Mutations in this version are async, returning a mutation id.\n */\ndeclare abstract class Vectorize {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexInfo>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Use the provided vector-id to perform a similarity search across the index.\n     * @param vectorId Id for a vector in the index against which the index should be queried.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * The interface for \"version_metadata\" binding\n * providing metadata about the Worker Version using this binding.\n */\ntype WorkerVersionMetadata = {\n    /** The ID of the Worker Version using this binding */\n    id: string;\n    /** The tag of the Worker Version using this binding */\n    tag: string;\n    /** The timestamp of when the Worker Version was uploaded */\n    timestamp: string;\n};\ninterface DynamicDispatchLimits {\n    /**\n     * Limit CPU time in milliseconds.\n     */\n    cpuMs?: number;\n    /**\n     * Limit number of subrequests.\n     */\n    subRequests?: number;\n}\ninterface DynamicDispatchOptions {\n    /**\n     * Limit resources of invoked Worker script.\n     */\n    limits?: DynamicDispatchLimits;\n    /**\n     * Arguments for outbound Worker script, if configured.\n     */\n    outbound?: {\n        [key: string]: any;\n    };\n}\ninterface DispatchNamespace {\n    /**\n    * @param name Name of the Worker script.\n    * @param args Arguments to Worker script.\n    * @param options Options for Dynamic Dispatch invocation.\n    * @returns A Fetcher object that allows you to send requests to the Worker script.\n    * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.\n    */\n    get(name: string, args?: {\n        [key: string]: any;\n    }, options?: DynamicDispatchOptions): Fetcher;\n}\ndeclare module 'cloudflare:workflows' {\n    /**\n     * NonRetryableError allows for a user to throw a fatal error\n     * that makes a Workflow instance fail immediately without triggering a retry\n     */\n    export class NonRetryableError extends Error {\n        public constructor(message: string, name?: string);\n    }\n}\ndeclare abstract class Workflow<PARAMS = unknown> {\n    /**\n     * Get a handle to an existing instance of the Workflow.\n     * @param id Id for the instance of this Workflow\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public get(id: string): Promise<WorkflowInstance>;\n    /**\n     * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.\n     * @param options Options when creating an instance including id and params\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;\n    /**\n     * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.\n     * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.\n     * @param batch List of Options when creating an instance including name and params\n     * @returns A promise that resolves with a list of handles for the created instances.\n     */\n    public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;\n}\ntype WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\ntype WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\ntype WorkflowRetentionDuration = WorkflowSleepDuration;\ninterface WorkflowInstanceCreateOptions<PARAMS = unknown> {\n    /**\n     * An id for your Workflow instance. Must be unique within the Workflow.\n     */\n    id?: string;\n    /**\n     * The event payload the Workflow instance is triggered with\n     */\n    params?: PARAMS;\n    /**\n     * The retention policy for Workflow instance.\n     * Defaults to the maximum retention period available for the owner's account.\n     */\n    retention?: {\n        successRetention?: WorkflowRetentionDuration;\n        errorRetention?: WorkflowRetentionDuration;\n    };\n}\ntype InstanceStatus = {\n    status: 'queued' // means that instance is waiting to be started (see concurrency limits)\n     | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running\n     | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish\n     | 'waitingForPause' // instance is finishing the current work to pause\n     | 'unknown';\n    error?: {\n        name: string;\n        message: string;\n    };\n    output?: unknown;\n};\ninterface WorkflowError {\n    code?: number;\n    message: string;\n}\ndeclare abstract class WorkflowInstance {\n    public id: string;\n    /**\n     * Pause the instance.\n     */\n    public pause(): Promise<void>;\n    /**\n     * Resume the instance. If it is already running, an error will be thrown.\n     */\n    public resume(): Promise<void>;\n    /**\n     * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.\n     */\n    public terminate(): Promise<void>;\n    /**\n     * Restart the instance.\n     */\n    public restart(): Promise<void>;\n    /**\n     * Returns the current status of the instance.\n     */\n    public status(): Promise<InstanceStatus>;\n    /**\n     * Send an event to this instance.\n     */\n    public sendEvent({ type, payload, }: {\n        type: string;\n        payload: unknown;\n    }): Promise<void>;\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-cloudflare/wrangler.jsonc",
    "content": "{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"tanstack-start-app\",\n  \"compatibility_date\": \"2025-09-24\",\n  \"compatibility_flags\": [\"nodejs_compat\"],\n  \"main\": \"@tanstack/solid-start/server-entry\",\n  \"vars\": {\n    \"MY_VAR\": \"Hello from Cloudflare\",\n  },\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-basic-solid-query\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^4.1.12\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\n\nconst baseURL = `http://localhost:${PORT}`\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  type ErrorComponentProps,\n} from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary(props: ErrorComponentProps) {\n  return <ErrorComponent {...props} />\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\nimport type { JSX } from 'solid-js'\n\nexport function NotFound(props?: { children?: JSX.Element }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div>\n        {props?.children || 'The page you are looking for does not exist.'}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as SuspenseTransitionRouteImport } from './routes/suspense-transition'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api.users'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as TransitionCountQueryRouteImport } from './routes/transition/count/query'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersIdRouteImport } from './routes/api/users.$id'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SuspenseTransitionRoute = SuspenseTransitionRouteImport.update({\n  id: '/suspense-transition',\n  path: '/suspense-transition',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst TransitionCountQueryRoute = TransitionCountQueryRouteImport.update({\n  id: '/transition/count/query',\n  path: '/transition/count/query',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersIdRoute = ApiUsersIdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/posts'\n    | '/suspense-transition'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n    | '/transition/count/query'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/suspense-transition'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n    | '/transition/count/query'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/deferred'\n    | '/posts'\n    | '/suspense-transition'\n    | '/users'\n    | '/_layout/_layout-2'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/api/users/$id'\n    | '/posts_/$postId/deep'\n    | '/transition/count/query'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  SuspenseTransitionRoute: typeof SuspenseTransitionRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  TransitionCountQueryRoute: typeof TransitionCountQueryRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/suspense-transition': {\n      id: '/suspense-transition'\n      path: '/suspense-transition'\n      fullPath: '/suspense-transition'\n      preLoaderRoute: typeof SuspenseTransitionRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/transition/count/query': {\n      id: '/transition/count/query'\n      path: '/transition/count/query'\n      fullPath: '/transition/count/query'\n      preLoaderRoute: typeof TransitionCountQueryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$id': {\n      id: '/api/users/$id'\n      path: '/$id'\n      fullPath: '/api/users/$id'\n      preLoaderRoute: typeof ApiUsersIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersIdRoute: typeof ApiUsersIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersIdRoute: ApiUsersIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  SuspenseTransitionRoute: SuspenseTransitionRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  TransitionCountQueryRoute: TransitionCountQueryRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/solid-query'\nimport { createRouter } from '@tanstack/solid-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type { QueryClient } from '@tanstack/solid-query'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack Solid Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack Solid framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument(props: { children?: any }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/layout-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {props.children}\n        <TanStackRouterDevtoolsInProd position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div>I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/api/users.$id.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\nimport type { User } from '../../utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        console.info(`Fetching users by id=${params.id}... @`, request.url)\n        try {\n          const res = await axios.get<User>(`${queryURL}/users/` + params.id)\n          return Response.json({\n            id: res.data.id,\n            name: res.data.name,\n            email: res.data.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/api.users.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\nimport type { User } from '../utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await axios.get<Array<User>>(`${queryURL}/users`)\n        const list = res.data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/deferred.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { queryOptions, useQuery } from '@tanstack/solid-query'\nimport { Suspense, createSignal } from 'solid-js'\n\nconst deferredQueryOptions = () =>\n  queryOptions({\n    queryKey: ['deferred'],\n    queryFn: async () => {\n      await new Promise((r) => setTimeout(r, 3000))\n      return {\n        message: `Hello deferred from the server!`,\n        status: 'success',\n        time: new Date(),\n      }\n    },\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: ({ context }) => {\n    // Kick off loading as early as possible!\n    context.queryClient.prefetchQuery(deferredQueryOptions())\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n\n  return (\n    <div class=\"p-2\">\n      <Suspense fallback=\"Loading Middleman...\">\n        <DeferredQuery />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount(count() + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n\nfunction DeferredQuery() {\n  const deferredQuery = useQuery(() => deferredQueryOptions())\n  const data = () => deferredQuery.data\n\n  return (\n    <div>\n      <h1>Deferred Query</h1>\n      <div>Status: {data()?.status ?? 'loading...'}</div>\n      <div>Message: {data()?.message ?? ''}</div>\n      <div>Time: {data() ? new Date(data()!.time).toISOString() : ''}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/posts.$postId.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { ErrorComponent, Link, createFileRoute } from '@tanstack/solid-router'\nimport { postQueryOptions } from '~/utils/posts'\n\nexport function PostErrorComponent({ error }: { error: any }) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ context, params }) => {\n    await context.queryClient.ensureQueryData(postQueryOptions(params.postId))\n  },\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const params = Route.useParams()\n  const postQuery = useQuery(() => postQueryOptions(params().postId))\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{postQuery.data?.title}</h4>\n      <div class=\"text-sm\">{postQuery.data?.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: postQuery.data?.id ?? '',\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/posts.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { For, Suspense } from 'solid-js'\nimport { postsQueryOptions } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(postsQueryOptions())\n  },\n  head: () => ({ meta: [{ title: 'Posts' }] }),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useQuery(() => postsQueryOptions())\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        <Suspense fallback={<div>Loading posts...</div>}>\n          <For\n            each={[\n              ...(postsQuery.data || []),\n              { id: 'i-do-not-exist', title: 'Non-existent Post' },\n            ]}\n          >\n            {(post) => (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )}\n          </For>\n        </Suspense>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { postQueryOptions } from '../utils/posts'\nimport { PostErrorComponent } from './posts.$postId'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId }, context }) => {\n    const data = await context.queryClient.ensureQueryData(\n      postQueryOptions(postId),\n    )\n\n    return {\n      title: data.title,\n    }\n  },\n  head: ({ loaderData }) => ({\n    meta: loaderData ? [{ title: loaderData.title }] : undefined,\n  }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const params = Route.useParams()\n  const postQuery = useQuery(() => postQueryOptions(params().postId))\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{postQuery.data?.title}</h4>\n      <div class=\"text-sm\">{postQuery.data?.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/suspense-transition.tsx",
    "content": "import { queryOptions, useQuery } from '@tanstack/solid-query'\nimport { Link, createFileRoute } from '@tanstack/solid-router'\nimport { Suspense } from 'solid-js'\n\nconst doubleQueryOptions = (n: number) =>\n  queryOptions({\n    queryKey: ['double', n],\n    queryFn: async () => {\n      // Add a delay to make the transition observable\n      await new Promise((r) => setTimeout(r, 500))\n      return n * 2\n    },\n    placeholderData: (previousData) => previousData,\n  })\n\nexport const Route = createFileRoute('/suspense-transition')({\n  validateSearch: (search: { n?: number }) => ({ n: search.n ?? 1 }),\n  component: SuspenseTransitionComponent,\n  ssr: false, // Disable SSR to avoid suspense issues during initial load\n})\n\nfunction SuspenseTransitionComponent() {\n  return (\n    <div class=\"p-2\">\n      <h1 data-testid=\"suspense-transition-title\">Suspense Transition Test</h1>\n\n      <div class=\"flex gap-2 my-4\">\n        <Link\n          data-testid=\"increase-button\"\n          class=\"border bg-gray-50 px-3 py-1\"\n          from=\"/suspense-transition\"\n          search={(s) => ({ n: s.n + 1 })}\n        >\n          Increase\n        </Link>\n      </div>\n\n      <Result />\n    </div>\n  )\n}\n\nfunction Result() {\n  const search = Route.useSearch()\n  const doubleQuery = useQuery(() => doubleQueryOptions(search().n))\n\n  return (\n    <div class=\"mt-2 border p-4\">\n      {/* This manual Suspense boundary should transition, not immediately show fallback */}\n      <Suspense\n        fallback={<div data-testid=\"suspense-fallback\">Loading...</div>}\n      >\n        <div data-testid=\"suspense-content\">\n          <div>\n            n: <span data-testid=\"n-value\">{search().n}</span>\n          </div>\n          <div>\n            double: <span data-testid=\"double-value\">{doubleQuery.data}</span>\n          </div>\n        </div>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/transition/count/query.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { Suspense } from 'solid-js'\nimport { queryOptions, useQuery } from '@tanstack/solid-query'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  n: z.number().default(1),\n})\n\nconst doubleQueryOptions = (n: number) =>\n  queryOptions({\n    queryKey: ['transition-double', n],\n    queryFn: async () => {\n      await new Promise((resolve) => setTimeout(resolve, 1000))\n      return { n, double: n * 2 }\n    },\n    placeholderData: (oldData) => oldData,\n  })\n\nexport const Route = createFileRoute('/transition/count/query')({\n  validateSearch: searchSchema,\n  loader: ({ context: { queryClient }, location }) => {\n    const { n } = searchSchema.parse(location.search)\n    return queryClient.ensureQueryData(doubleQueryOptions(n))\n  },\n  component: TransitionPage,\n})\n\nfunction TransitionPage() {\n  const search = Route.useSearch()\n\n  const doubleQuery = useQuery(() => doubleQueryOptions(search().n))\n\n  return (\n    <Suspense fallback=\"Loading...\">\n      <div class=\"p-2\">\n        <Link\n          data-testid=\"increase-button\"\n          class=\"border bg-gray-50 px-3 py-1\"\n          from=\"/transition/count/query\"\n          search={(s) => ({ n: s.n + 1 })}\n        >\n          Increase\n        </Link>\n\n        <div class=\"mt-2\">\n          <div data-testid=\"n-value\">n: {doubleQuery.data?.n}</div>\n          <div data-testid=\"double-value\">\n            double: {doubleQuery.data?.double}\n          </div>\n        </div>\n      </div>\n    </Suspense>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/users.$userId.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nimport { NotFound } from '~/components/NotFound'\nimport { userQueryOptions } from '~/utils/users'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ context, params: { userId } }) => {\n    await context.queryClient.ensureQueryData(userQueryOptions(userId))\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserErrorComponent(props: ErrorComponentProps) {\n  return <ErrorComponent error={props.error} />\n}\n\nfunction UserComponent() {\n  const params = Route.useParams()\n  const userQuery = useQuery(() => userQueryOptions(params().userId))\n  const user = () => userQuery.data\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">\n        {user()?.name ?? 'loading...'}\n      </h4>\n      <div class=\"text-sm\">{user()?.email ?? ''}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/routes/users.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { For } from 'solid-js'\n\nimport { usersQueryOptions } from '~/utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(usersQueryOptions())\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const usersQuery = useQuery(() => usersQueryOptions())\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        <For\n          each={[\n            ...(usersQuery.data ?? []),\n            { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n          ]}\n        >\n          {(user) => (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )}\n        </For>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nbody {\n  @apply text-base;\n  font-family: system-ui, sans-serif;\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/utils/posts.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const postsQueryOptions = () =>\n  queryOptions({\n    queryKey: ['posts'],\n    queryFn: async () => {\n      console.info('Fetching posts...')\n      await new Promise((r) => setTimeout(r, 500))\n      return axios\n        .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n        .then((r) => r.data.slice(0, 10))\n    },\n  })\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', postId],\n    queryFn: async () => {\n      console.info(`Fetching post with id ${postId}...`)\n      await new Promise((r) => setTimeout(r, 500))\n\n      return axios\n        .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n        .then((r) => r.data)\n    },\n  })\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/utils/seo.ts",
    "content": "export function seo(params: {\n  title: string\n  description?: string\n  keywords?: string\n  image?: string\n}) {\n  const { title, description, keywords, image } = params\n\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/src/utils/users.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport axios from 'redaxios'\n\nexport type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT =\n  import.meta.env.VITE_SERVER_PORT || process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n\nexport const usersQueryOptions = () =>\n  queryOptions({\n    queryKey: ['users'],\n    queryFn: () =>\n      axios\n        .get<Array<User>>(DEPLOY_URL + '/api/users')\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch users')\n        }),\n  })\n\nexport const userQueryOptions = (id: string) =>\n  queryOptions({\n    queryKey: ['users', id],\n    queryFn: () =>\n      axios\n        .get<User>(DEPLOY_URL + '/api/users/' + id)\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch user')\n        }),\n  })\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm A!\")\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Manual Suspense boundaries should transition on navigation', async ({\n  page,\n}) => {\n  // Navigate to the suspense transition test page\n  await page.goto('/suspense-transition')\n\n  // Wait for initial content to load\n  await expect(page.getByTestId('n-value')).toHaveText('1')\n  await expect(page.getByTestId('double-value')).toHaveText('2')\n\n  // Click the increase button to trigger navigation with search params change\n  await page.getByTestId('increase-button').click()\n\n  // During the transition, the old content should remain visible\n  // and the fallback should NOT be shown\n  await expect(page.getByTestId('suspense-fallback')).not.toBeVisible({\n    timeout: 100,\n  })\n\n  // The old content should still be visible during transition\n  await expect(page.getByTestId('suspense-content')).toBeVisible()\n\n  // After transition completes, new content should be visible\n  await expect(page.getByTestId('n-value')).toHaveText('2')\n  await expect(page.getByTestId('double-value')).toHaveText('4')\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/tests/transition.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('transitions/count/query should keep old values visible during navigation', async ({\n  page,\n}) => {\n  await page.goto('/transition/count/query')\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1')\n  await expect(page.getByTestId('double-value')).toContainText('double: 2')\n\n  const bodyTexts: Array<string> = []\n\n  const pollInterval = setInterval(async () => {\n    const text = await page\n      .locator('body')\n      .textContent()\n      .catch(() => '')\n    if (text) bodyTexts.push(text)\n  }, 50)\n\n  // 1 click\n\n  page.getByTestId('increase-button').click()\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1', {\n    timeout: 2_000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 2', {\n    timeout: 2_000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n    timeout: 2000,\n  })\n\n  // 2 clicks\n\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n  //   timeout: 2000,\n  // })\n\n  // await page.waitForTimeout(200)\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n  //   timeout: 2000,\n  // })\n\n  // // 3 clicks\n\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n  //   timeout: 2000,\n  // })\n\n  // await page.waitForTimeout(200)\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 7', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 14', {\n  //   timeout: 2000,\n  // })\n\n  clearInterval(pollInterval)\n\n  // With proper transitions, old values should remain visible until new ones arrive\n  const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...'))\n\n  if (hasLoadingText) {\n    throw new Error(\n      'FAILED: \"Loading...\" appeared during navigation. ' +\n        'Solid Router should use transitions to keep old values visible.',\n    )\n  }\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-solid-query/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), solid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/README.md",
    "content": "# Welcome to TanStack.com!\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Development\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Editing and previewing the docs of TanStack projects locally\n\nThe documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app.\nIn 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.\n\nFollow 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 :\n\n1. Create a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter the directory and clone this repo and the repo of the project there.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/tanstack.com.git\ngit clone git@github.com:TanStack/form.git\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- form/\n>    |\n>    +-- tanstack.com/\n> ```\n\n> [!WARNING]\n> 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.\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`.\n\n> [!NOTE]\n> The updated pages need to be manually reloaded in the browser.\n\n> [!WARNING]\n> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page!\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-basic-tsr-config\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"rimraf ./count.txt && vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/src/app/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/src/app/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <Outlet />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/src/app/routes/index.tsx",
    "content": "import fs from 'node:fs'\nimport { useRouter, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst filePath = 'count.txt'\n\nconst getCount = createServerFn({\n  method: 'GET',\n}).handler(async () => {\n  const number = await fs.promises.readFile(filePath, 'utf-8').catch(() => '0')\n  return parseInt(number || '0')\n})\n\nconst updateCount = createServerFn({ method: 'POST' })\n  .inputValidator((d: number) => d)\n  .handler(async ({ data }) => {\n    const count = await getCount()\n    await fs.promises.writeFile(filePath, `${count + data}`)\n  })\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => await getCount(),\n})\n\nfunction Home() {\n  const router = useRouter()\n  const state = Route.useLoaderData()\n\n  return (\n    <button\n      data-testid=\"add-button\"\n      onClick={() => {\n        updateCount({ data: 1 }).then(() => {\n          router.invalidate()\n        })\n      }}\n    >\n      Add 1 to {state()}?\n    </button>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/src/app/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('opening the app', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForLoadState('networkidle')\n  await expect(page.getByTestId('add-button')).toContainText('Add 1 to 0?')\n  await page.getByTestId('add-button').click()\n  await page.waitForLoadState('networkidle')\n  await expect(page.getByTestId('add-button')).toContainText('Add 1 to 1?')\n})\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/app/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/basic-tsr-config/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tanstackStart({\n      srcDirectory: './src/app',\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/csp/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/csp/.gitignore",
    "content": "node_modules\ndist\n.output\ntest-results\nplaywright-report\n"
  },
  {
    "path": "e2e/solid-start/csp/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-csp\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/csp/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/csp/public/external.css",
    "content": ".external-styled {\n  color: blue;\n  font-weight: bold;\n}\n"
  },
  {
    "path": "e2e/solid-start/csp/public/external.js",
    "content": "// This script sets a window global when loaded\n// Using a global avoids race conditions with Solid and DOM ownership issues\nwindow.__EXTERNAL_SCRIPT_LOADED__ = true\n"
  },
  {
    "path": "e2e/solid-start/csp/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/csp/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { createIsomorphicFn } from '@tanstack/solid-start'\nimport { routeTree } from './routeTree.gen'\n\nconst getSSROptions = createIsomorphicFn().server(() => {\n  const array = new Uint8Array(16)\n  crypto.getRandomValues(array)\n  const nonce = Array.from(array, (b) => b.toString(16).padStart(2, '0')).join(\n    '',\n  )\n  return { nonce }\n})\n\nexport function getRouter() {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n    ssr: getSSROptions(),\n  })\n}\n"
  },
  {
    "path": "e2e/solid-start/csp/src/routes/__root.tsx",
    "content": "import {\n  createRootRoute,\n  HeadContent,\n  Outlet,\n  Scripts,\n} from '@tanstack/solid-router'\nimport { HydrationScript } from 'solid-js/web'\n\nexport const Route = createRootRoute({\n  headers: ({ ssr }) => {\n    const nonce = ssr?.nonce\n    if (!nonce) return\n    return {\n      'Content-Security-Policy': [\n        \"default-src 'self'\",\n        `script-src 'self' 'nonce-${nonce}'`,\n        `style-src 'self' 'nonce-${nonce}'`,\n      ].join('; '),\n    }\n  },\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { title: 'CSP Nonce Test' },\n    ],\n    links: [{ rel: 'stylesheet', href: '/external.css' }],\n    scripts: [{ src: '/external.js' }],\n    styles: [\n      { children: '.inline-styled { color: green; font-weight: bold; }' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/csp/src/routes/index.tsx",
    "content": "import { createSignal } from 'solid-js'\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  const [count, setCount] = createSignal(0)\n\n  return (\n    <div>\n      <h1 data-testid=\"csp-heading\">CSP Nonce Test</h1>\n      <p data-testid=\"inline-styled\" class=\"inline-styled\">\n        This should be green if inline styles work\n      </p>\n      <p data-testid=\"external-styled\" class=\"external-styled\">\n        This should be blue if external styles work\n      </p>\n      <button data-testid=\"counter-btn\" onClick={() => setCount((c) => c + 1)}>\n        Count: <span data-testid=\"counter-value\">{count()}</span>\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/csp/tests/csp.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('CSP header is set with nonce', async ({ page }) => {\n  const response = await page.goto('/')\n  const csp = response?.headers()['content-security-policy']\n  expect(csp).toContain(\"script-src 'self' 'nonce-\")\n  expect(csp).toContain(\"style-src 'self' 'nonce-\")\n})\n\ntest('Inline scripts have nonce attribute', async ({ page }) => {\n  await page.goto('/')\n  const scripts = await page.locator('script[nonce]').all()\n  expect(scripts.length).toBeGreaterThan(0)\n})\n\ntest('Inline styles have nonce attribute', async ({ page }) => {\n  await page.goto('/')\n  const styles = await page.locator('style[nonce]').all()\n  expect(styles.length).toBeGreaterThan(0)\n})\n\ntest('External script has nonce attribute', async ({ page }) => {\n  await page.goto('/')\n  const externalScript = page.locator('script[src=\"/external.js\"]')\n  await expect(externalScript).toHaveAttribute('nonce')\n})\n\ntest('External stylesheet has nonce attribute', async ({ page }) => {\n  await page.goto('/')\n  const externalStylesheet = page.locator('link[href=\"/external.css\"]')\n  await expect(externalStylesheet).toHaveAttribute('nonce')\n})\n\ntest('Nonces match between header and elements', async ({ page }) => {\n  // Intercept the HTML response to get raw content before browser strips nonces\n  let rawHtml = ''\n  await page.route('/', async (route) => {\n    const response = await route.fetch()\n    rawHtml = await response.text()\n    await route.fulfill({ response })\n  })\n\n  const response = await page.goto('/')\n  await page.unrouteAll({ behavior: 'ignoreErrors' })\n\n  const csp = response?.headers()['content-security-policy'] || ''\n\n  // Extract nonce from CSP header\n  const nonceMatch = csp.match(/nonce-([a-f0-9]+)/)\n  expect(nonceMatch).toBeTruthy()\n  const headerNonce = nonceMatch![1]\n\n  // Check script nonces match - look for nonce attribute anywhere in the script tag\n  const scriptNonces = [\n    ...rawHtml.matchAll(/<script[^>]*\\bnonce=\"([^\"]+)\"[^>]*>/g),\n  ].map((m) => m[1])\n  expect(scriptNonces.length).toBeGreaterThan(0)\n  for (const nonce of scriptNonces) {\n    expect(nonce).toBe(headerNonce)\n  }\n\n  // Check style nonces match\n  const styleNonces = [\n    ...rawHtml.matchAll(/<style[^>]*\\bnonce=\"([^\"]+)\"[^>]*>/g),\n  ].map((m) => m[1])\n  expect(styleNonces.length).toBeGreaterThan(0)\n  for (const nonce of styleNonces) {\n    expect(nonce).toBe(headerNonce)\n  }\n\n  // Check external script nonce matches (nonce can be before or after src)\n  const externalScriptMatch = rawHtml.match(\n    /<script[^>]*\\bsrc=\"\\/external\\.js\"[^>]*\\bnonce=\"([^\"]+)\"[^>]*>|<script[^>]*\\bnonce=\"([^\"]+)\"[^>]*\\bsrc=\"\\/external\\.js\"[^>]*>/,\n  )\n  expect(externalScriptMatch).toBeTruthy()\n  expect(externalScriptMatch![1] || externalScriptMatch![2]).toBe(headerNonce)\n\n  // Check external stylesheet nonce matches (nonce can be before or after href)\n  const externalStyleMatch = rawHtml.match(\n    /<link[^>]*\\bhref=\"\\/external\\.css\"[^>]*\\bnonce=\"([^\"]+)\"[^>]*>|<link[^>]*\\bnonce=\"([^\"]+)\"[^>]*\\bhref=\"\\/external\\.css\"[^>]*>/,\n  )\n  expect(externalStyleMatch).toBeTruthy()\n  expect(externalStyleMatch![1] || externalStyleMatch![2]).toBe(headerNonce)\n})\n\ntest('Hydration works - counter increments', async ({ page }) => {\n  await page.goto('/')\n  await expect(page.getByTestId('counter-value')).toContainText('0')\n\n  // Keep clicking until Solid hydrates and the counter increments\n  // This handles the race between test execution and hydration\n  await expect\n    .poll(\n      async () => {\n        await page.getByTestId('counter-btn').click()\n        return page.getByTestId('counter-value').textContent()\n      },\n      { timeout: 10000, intervals: [100, 200, 500, 1000] },\n    )\n    .not.toBe('0')\n\n  // Now that hydration is confirmed, verify further increments work\n  const currentValue = parseInt(\n    (await page.getByTestId('counter-value').textContent()) || '0',\n  )\n  await page.getByTestId('counter-btn').click()\n  await expect(page.getByTestId('counter-value')).toContainText(\n    String(currentValue + 1),\n  )\n})\n\ntest('Inline styles work with CSP', async ({ page }) => {\n  await page.goto('/')\n  const el = page.getByTestId('inline-styled')\n  await expect(el).toBeVisible()\n  // Verify the style was applied (green color)\n  const color = await el.evaluate((e) => getComputedStyle(e).color)\n  expect(color).toBe('rgb(0, 128, 0)') // green\n})\n\ntest('External styles work with CSP', async ({ page }) => {\n  await page.goto('/')\n  const el = page.getByTestId('external-styled')\n  await expect(el).toBeVisible()\n  // Verify the style was applied (blue color)\n  const color = await el.evaluate((e) => getComputedStyle(e).color)\n  expect(color).toBe('rgb(0, 0, 255)') // blue\n})\n\ntest('External script executes with CSP', async ({ page }) => {\n  await page.goto('/')\n  // Check that the external script set its window global\n  await expect\n    .poll(() => page.evaluate(() => (window as any).__EXTERNAL_SCRIPT_LOADED__))\n    .toBe(true)\n})\n\ntest('No CSP violations in console', async ({ page }) => {\n  const violations: string[] = []\n  page.on('console', (msg) => {\n    if (msg.text().toLowerCase().includes('content security policy')) {\n      violations.push(msg.text())\n    }\n  })\n  page.on('pageerror', (err) => {\n    if (err.message.toLowerCase().includes('content security policy')) {\n      violations.push(err.message)\n    }\n  })\n  await page.goto('/')\n  await page.getByTestId('counter-btn').click()\n  // Small wait to ensure any async violations are caught\n  await page.waitForTimeout(100)\n  expect(violations).toEqual([])\n})\n\ntest('Each request gets a unique nonce', async ({ page }) => {\n  const response1 = await page.goto('/')\n  const csp1 = response1?.headers()['content-security-policy'] || ''\n  const nonce1 = csp1.match(/nonce-([a-f0-9]+)/)?.[1]\n\n  const response2 = await page.goto('/')\n  const csp2 = response2?.headers()['content-security-policy'] || ''\n  const nonce2 = csp2.match(/nonce-([a-f0-9]+)/)?.[1]\n\n  expect(nonce1).toBeTruthy()\n  expect(nonce2).toBeTruthy()\n  expect(nonce1).not.toBe(nonce2)\n})\n"
  },
  {
    "path": "e2e/solid-start/csp/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/csp/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/css-modules/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/.gitignore",
    "content": "node_modules\ndist\n.routeTree.gen.ts\nsrc/routeTree.gen.ts\ntest-results\nplaywright-report\nport*.txt\n"
  },
  {
    "path": "e2e/solid-start/css-modules/.prettierignore",
    "content": "src/routeTree.gen.ts\n"
  },
  {
    "path": "e2e/solid-start/css-modules/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-css-modules\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev --port $PORT\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e:dev\": \"MODE=dev playwright test --project=chromium\",\n    \"test:e2e:prod\": \"playwright test --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:*\",\n    \"@tanstack/solid-start\": \"workspace:*\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:*\",\n    \"@types/node\": \"^22.10.2\",\n    \"sass\": \"^1.97.2\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst mode = process.env.MODE ?? 'prod'\nconst isDev = mode === 'dev'\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: isDev ? `pnpm dev:e2e` : `pnpm build && PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      VITE_NODE_ENV: 'test',\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: false,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { HydrationScript } from 'solid-js/web'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n        <HeadContent />\n      </head>\n      <body>\n        <nav\n          data-testid=\"main-nav\"\n          style={{\n            padding: '12px 20px',\n            'border-bottom': '1px solid #e2e8f0',\n            display: 'flex',\n            'align-items': 'center',\n            gap: '16px',\n            'background-color': '#fff',\n          }}\n        >\n          <Link\n            to=\"/\"\n            style={{ color: '#0284c7', 'text-decoration': 'none' }}\n            data-testid=\"nav-home\"\n          >\n            Home (Global CSS)\n          </Link>\n          <Link\n            to=\"/modules\"\n            style={{ color: '#0284c7', 'text-decoration': 'none' }}\n            data-testid=\"nav-modules\"\n          >\n            CSS Modules\n          </Link>\n          <Link\n            to=\"/sass-mixin\"\n            style={{ color: '#0284c7', 'text-decoration': 'none' }}\n            data-testid=\"nav-sass-mixin\"\n          >\n            Sass Mixin\n          </Link>\n        </nav>\n\n        <main style={{ padding: '20px' }}>\n          <Outlet />\n        </main>\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport '~/styles/global.css'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div>\n      <h1>CSS Collection Test - Global CSS</h1>\n      <p>This page tests that global CSS is collected and served during SSR.</p>\n\n      <div class=\"global-container\" data-testid=\"global-styled\">\n        <div class=\"global-title\" data-testid=\"global-title\">\n          Global CSS Applied\n        </div>\n        <div class=\"global-description\" data-testid=\"global-description\">\n          This container should have a blue background, white text, and rounded\n          corners even with JavaScript disabled.\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/routes/modules.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { createFileRoute } from '@tanstack/solid-router'\nimport styles from '~/styles/card.module.css'\n\nexport const Route = createFileRoute('/modules')({\n  component: Modules,\n})\n\nfunction Modules() {\n  return (\n    <div>\n      <h1>CSS Collection Test - CSS Modules</h1>\n      <p>\n        This page tests that CSS modules are collected and served during SSR.\n      </p>\n\n      <div class={styles.card} data-testid=\"module-card\">\n        <div class={styles.title} data-testid=\"module-title\">\n          CSS Module Applied\n        </div>\n        <div class={styles.content} data-testid=\"module-content\">\n          This card should have a green theme with scoped class names even with\n          JavaScript disabled.\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/routes/sass-mixin.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport '~/styles/app.scss'\n\nexport const Route = createFileRoute('/sass-mixin')({\n  component: SassMixin,\n})\n\nfunction SassMixin() {\n  return (\n    <div>\n      <h1>CSS Collection Test - Sass Mixin</h1>\n      <p>\n        This page tests that Sass mixins imported in a parent file are available\n        to subsequent imports during dev mode SSR.\n      </p>\n\n      <div class=\"mixin-container\" data-testid=\"mixin-styled\">\n        <span data-testid=\"mixin-content\">\n          Sass Mixin Applied - Should be centered with purple background\n        </span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/styles/app.scss",
    "content": "// Import the mixin, which should make them available to future imports\n@import './center-mixin.scss';\n\n@import './mixin-consumer.scss';\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/styles/card.module.css",
    "content": "/* CSS Module for testing scoped styles in dev mode */\n\n.card {\n  background-color: #f0fdf4; /* green-50 */\n  padding: 16px;\n  border-radius: 8px;\n  border: 1px solid #22c55e; /* green-500 */\n}\n\n.title {\n  font-size: 18px;\n  font-weight: 600;\n  color: #166534; /* green-800 */\n  margin-bottom: 8px;\n}\n\n.content {\n  font-size: 14px;\n  color: #15803d; /* green-700 */\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/styles/center-mixin.scss",
    "content": "@mixin center-mixin {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/styles/global.css",
    "content": "/* Global styles for testing CSS collection in dev mode */\n\n.global-container {\n  background-color: #3b82f6; /* blue-500 */\n  padding: 24px;\n  border-radius: 12px;\n  color: white;\n}\n\n.global-title {\n  font-size: 24px;\n  font-weight: bold;\n  margin-bottom: 16px;\n}\n\n.global-description {\n  font-size: 16px;\n  opacity: 0.9;\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/src/styles/mixin-consumer.scss",
    "content": ".mixin-container {\n  // Use the center mixin, which is included in app.scss\n  // This works for the client build, but not for the dev server styles.css build\n  @include center-mixin;\n  background-color: #a855f7; /* purple-500 */\n  padding: 24px;\n  border-radius: 12px;\n  color: white;\n  min-height: 100px;\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/tests/css.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\n// Whitelist errors that can occur in CI:\n// - net::ERR_NAME_NOT_RESOLVED: transient network issues\n// - 504 (Outdated Optimize Dep): Vite dependency optimization reload\nconst whitelistErrors = [\n  'Failed to load resource: net::ERR_NAME_NOT_RESOLVED',\n  'Failed to load resource: the server responded with a status of 504',\n]\n\ntest.describe('CSS styles in SSR (dev mode)', () => {\n  test.use({ whitelistErrors })\n\n  // Helper to build full URL from baseURL and path\n  // Playwright's goto with absolute paths (like '/modules') ignores baseURL's path portion\n  // So we need to manually construct the full URL\n  const buildUrl = (baseURL: string, path: string) => {\n    return baseURL.replace(/\\/$/, '') + path\n  }\n\n  test.describe('with JavaScript disabled', () => {\n    test.use({ javaScriptEnabled: false, whitelistErrors })\n\n    test('global CSS is applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/'))\n\n      const element = page.getByTestId('global-styled')\n      await expect(element).toBeVisible()\n\n      // Verify the CSS is applied by checking computed styles\n      // #3b82f6 (blue-500) in RGB is rgb(59, 130, 246)\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(59, 130, 246)')\n\n      const padding = await element.evaluate(\n        (el) => getComputedStyle(el).padding,\n      )\n      expect(padding).toBe('24px')\n\n      const borderRadius = await element.evaluate(\n        (el) => getComputedStyle(el).borderRadius,\n      )\n      expect(borderRadius).toBe('12px')\n    })\n\n    test('CSS modules are applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/modules'))\n\n      const card = page.getByTestId('module-card')\n      await expect(card).toBeVisible()\n\n      // Verify class is scoped (hashed)\n      const className = await card.getAttribute('class')\n      expect(className).toBeTruthy()\n      expect(className).not.toBe('card')\n      // The class should contain some hash characters (CSS modules add a hash)\n      expect(className!.length).toBeGreaterThan(5)\n\n      // Verify computed styles from card.module.css\n      // #f0fdf4 (green-50) in RGB is rgb(240, 253, 244)\n      const backgroundColor = await card.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(240, 253, 244)')\n\n      const padding = await card.evaluate((el) => getComputedStyle(el).padding)\n      expect(padding).toBe('16px')\n\n      const borderRadius = await card.evaluate(\n        (el) => getComputedStyle(el).borderRadius,\n      )\n      expect(borderRadius).toBe('8px')\n    })\n\n    test('global CSS class names are NOT scoped', async ({ page, baseURL }) => {\n      await page.goto(buildUrl(baseURL!, '/'))\n\n      const element = page.getByTestId('global-styled')\n      await expect(element).toBeVisible()\n\n      // Get the class attribute - it should be the plain class name (not hashed)\n      const className = await element.getAttribute('class')\n      expect(className).toBe('global-container')\n    })\n\n    test('Sass mixin styles are applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/sass-mixin'))\n\n      const element = page.getByTestId('mixin-styled')\n      await expect(element).toBeVisible()\n\n      // Verify the mixin is applied (display: flex from center-mixin)\n      const display = await element.evaluate(\n        (el) => getComputedStyle(el).display,\n      )\n      expect(display).toBe('flex')\n\n      const justifyContent = await element.evaluate(\n        (el) => getComputedStyle(el).justifyContent,\n      )\n      expect(justifyContent).toBe('center')\n\n      const alignItems = await element.evaluate(\n        (el) => getComputedStyle(el).alignItems,\n      )\n      expect(alignItems).toBe('center')\n\n      // Verify other styles from mixin-consumer.scss\n      // #a855f7 (purple-500) in RGB is rgb(168, 85, 247)\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(168, 85, 247)')\n\n      const padding = await element.evaluate(\n        (el) => getComputedStyle(el).padding,\n      )\n      expect(padding).toBe('24px')\n    })\n  })\n\n  test('styles persist after hydration', async ({ page, baseURL }) => {\n    await page.goto(buildUrl(baseURL!, '/'))\n\n    // Wait for hydration and styles to be applied\n    const element = page.getByTestId('global-styled')\n    await expect(element).toBeVisible()\n\n    // Wait for CSS to be applied (background color should not be transparent)\n    await expect(async () => {\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(59, 130, 246)')\n    }).toPass({ timeout: 5000 })\n  })\n\n  test('CSS modules styles persist after hydration', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto(buildUrl(baseURL!, '/modules'))\n\n    // Wait for hydration and styles to be applied\n    const card = page.getByTestId('module-card')\n    await expect(card).toBeVisible()\n\n    // Wait for CSS to be applied (background color should not be transparent)\n    await expect(async () => {\n      const backgroundColor = await card.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(240, 253, 244)')\n    }).toPass({ timeout: 5000 })\n  })\n\n  test('styles work correctly after client-side navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    // Start from home\n    await page.goto(buildUrl(baseURL!, '/'))\n\n    // Verify initial styles\n    const globalElement = page.getByTestId('global-styled')\n    await expect(globalElement).toBeVisible()\n    let backgroundColor = await globalElement.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(59, 130, 246)')\n\n    // Navigate to modules page\n    await page.getByTestId('nav-modules').click()\n    await page.waitForURL('**/modules')\n\n    // Verify CSS modules styles\n    const card = page.getByTestId('module-card')\n    await expect(card).toBeVisible()\n    backgroundColor = await card.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(240, 253, 244)')\n\n    // Navigate back to home\n    await page.getByTestId('nav-home').click()\n    await page.waitForURL(/\\/([^/]*)(\\/)?($|\\?)/)\n\n    // Verify global styles still work\n    await expect(globalElement).toBeVisible()\n    backgroundColor = await globalElement.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(59, 130, 246)')\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/css-modules/tests/setup/global.setup.ts",
    "content": "import { chromium } from '@playwright/test'\nimport {\n  e2eStartDummyServer,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nasync function waitForServer(url: string) {\n  const start = Date.now()\n  while (Date.now() - start < 30_000) {\n    const controller = new AbortController()\n    const timer = setTimeout(() => controller.abort(), 5_000)\n    try {\n      const res = await fetch(url, {\n        redirect: 'manual',\n        signal: controller.signal,\n      })\n      if (res.ok) return\n    } catch {\n      // ignore aborted/network errors\n    } finally {\n      clearTimeout(timer)\n    }\n    await new Promise((r) => setTimeout(r, 250))\n  }\n  throw new Error(`Timed out waiting for dev server at ${url}`)\n}\n\nasync function preOptimizeDevServer(baseURL: string) {\n  const browser = await chromium.launch()\n  const context = await browser.newContext()\n  const page = await context.newPage()\n\n  try {\n    await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.goto(`${baseURL}/modules`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('module-card').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.goto(`${baseURL}/sass-mixin`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('mixin-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Exercise client-side navigation so Vite discovers any remaining deps\n    // that only load via the client router (not full-page navigations).\n    await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('nav-modules').click()\n    await page.waitForURL('**/modules')\n    await page.getByTestId('module-card').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('nav-home').click()\n    await page.waitForURL(/\\/([^/]*)(\\/)?($|\\?)/)\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Ensure we end in a stable state. Vite's optimize step triggers a reload;\n    // this waits until no further navigations happen for a short window.\n    for (let i = 0; i < 40; i++) {\n      const currentUrl = page.url()\n      await page.waitForTimeout(250)\n      if (page.url() === currentUrl) {\n        await page.waitForTimeout(250)\n        if (page.url() === currentUrl) return\n      }\n    }\n\n    throw new Error('Dev server did not reach a stable URL after warmup')\n  } finally {\n    await context.close()\n    await browser.close()\n  }\n}\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n\n  if (process.env.MODE !== 'dev') return\n\n  const port = await getTestServerPort(packageJson.name)\n  const baseURL = `http://localhost:${port}`\n\n  await waitForServer(baseURL)\n  await preOptimizeDevServer(baseURL)\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/css-modules/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/custom-basepath/express-server.ts",
    "content": "import express from 'express'\nimport { toNodeHandler } from 'srvx/node'\nimport type { NodeHttp1Handler } from 'srvx'\n\nconst DEVELOPMENT = process.env.NODE_ENV === 'development'\nconst PORT = Number.parseInt(process.env.PORT || '3000')\n\nconst app = express()\n\nif (DEVELOPMENT) {\n  const viteDevServer = await import('vite').then((vite) =>\n    vite.createServer({\n      server: { middlewareMode: true },\n    }),\n  )\n  app.use(viteDevServer.middlewares)\n  app.use(async (req, res, next) => {\n    try {\n      const { default: serverEntry } =\n        await viteDevServer.ssrLoadModule('./src/server.ts')\n      const handler = toNodeHandler(serverEntry.fetch) as NodeHttp1Handler\n      await handler(req, res)\n    } catch (error) {\n      if (typeof error === 'object' && error instanceof Error) {\n        viteDevServer.ssrFixStacktrace(error)\n      }\n      next(error)\n    }\n  })\n} else {\n  const { default: handler } = await import('./dist/server/server.js')\n  const nodeHandler = toNodeHandler(handler.fetch) as NodeHttp1Handler\n  app.use('/custom/basepath', express.static('dist/client'))\n  app.use(async (req, res, next) => {\n    try {\n      await nodeHandler(req, res)\n    } catch (error) {\n      next(error)\n    }\n  })\n}\n\napp.listen(PORT, () => {\n  console.log(`Server is running on http://localhost:${PORT}`)\n})\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-custom-basepath\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"cross-env NODE_ENV=development tsx express-server.ts\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"tsx express-server.ts\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"express\": \"^5.1.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/express\": \"^5.0.3\",\n    \"@types/node\": \"^22.10.2\",\n    \"cross-env\": \"^10.0.0\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"tsx\": \"^4.20.3\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}/custom/basepath`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/components/CustomMessage.tsx",
    "content": "export function CustomMessage({ message }: { message: string }) {\n  return (\n    <div class=\"py-2\">\n      <div class=\"italic\">This is a custom message:</div>\n      <p>{message}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/components/PostErrorComponent.tsx",
    "content": "import { ErrorComponent, ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/components/UserErrorComponent.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NavigateTestRouteImport } from './routes/navigate-test'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as RedirectIndexRouteImport } from './routes/redirect.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as RedirectThrowItRouteImport } from './routes/redirect.throw-it'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NavigateTestRoute = NavigateTestRouteImport.update({\n  id: '/navigate-test',\n  path: '/navigate-test',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst RedirectIndexRoute = RedirectIndexRouteImport.update({\n  id: '/redirect/',\n  path: '/redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst RedirectThrowItRoute = RedirectThrowItRouteImport.update({\n  id: '/redirect/throw-it',\n  path: '/redirect/throw-it',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/navigate-test': typeof NavigateTestRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/navigate-test': typeof NavigateTestRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/redirect': typeof RedirectIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/navigate-test': typeof NavigateTestRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/navigate-test'\n    | '/posts'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts/'\n    | '/redirect/'\n    | '/users/'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/navigate-test'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/navigate-test'\n    | '/posts'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts/'\n    | '/redirect/'\n    | '/users/'\n    | '/api/users/$userId'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DeferredRoute: typeof DeferredRoute\n  LogoutRoute: typeof LogoutRoute\n  NavigateTestRoute: typeof NavigateTestRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  RedirectThrowItRoute: typeof RedirectThrowItRoute\n  RedirectIndexRoute: typeof RedirectIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/navigate-test': {\n      id: '/navigate-test'\n      path: '/navigate-test'\n      fullPath: '/navigate-test'\n      preLoaderRoute: typeof NavigateTestRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/redirect/': {\n      id: '/redirect/'\n      path: '/redirect'\n      fullPath: '/redirect/'\n      preLoaderRoute: typeof RedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/redirect/throw-it': {\n      id: '/redirect/throw-it'\n      path: '/redirect/throw-it'\n      fullPath: '/redirect/throw-it'\n      preLoaderRoute: typeof RedirectThrowItRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DeferredRoute: DeferredRoute,\n  LogoutRoute: LogoutRoute,\n  NavigateTestRoute: NavigateTestRoute,\n  PostsRoute: PostsRouteWithChildren,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  RedirectThrowItRoute: RedirectThrowItRoute,\n  RedirectIndexRoute: RedirectIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\nimport { basepath } from './utils/basepath'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n    basepath: basepath,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\n\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => <p>{props.error.stack}</p>,\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <Outlet />\n        <TanStackRouterDevtoolsInProd />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '~/utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(`${queryURL}/users/${params.userId}`)\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n          const user = (await res.json()) as User\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createMiddleware } from '@tanstack/solid-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: /users')\n    const result = await next()\n    result.response.headers.set('x-users', 'true')\n    console.info('Out: /users')\n    return result\n  },\n)\n\nconst testParentMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: testParentMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test-parent', 'true')\n    console.info('Out: testParentMiddleware')\n    return result\n  },\n)\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next, request }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware, testParentMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await fetch(`${queryURL}/users`)\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n        const data = (await res.json()) as Array<User>\n        const list = data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { Suspense, createSignal } from 'solid-js'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(({ data }) => {\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(async ({ data }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: { name: 'Tanner Linsley' } }),\n      person: await personServerFn({ data: { name: 'John Doe' } }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n  // const { deferredStuff, deferredPerson, person } = Route.useLoaderData()\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {loaderData().person.name} - {loaderData().person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={loaderData().deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={loaderData().deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount((count) => count + 1)}>\n          Increment\n        </button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { CustomMessage } from '~/components/CustomMessage'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <CustomMessage message=\"Hello from a custom component!\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/logout.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst logoutFn = createServerFn({\n  method: 'POST',\n}).handler(async () => {\n  // do logout stuff here\n  throw redirect({\n    to: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Logout Page</h3>\n      <p>\n        This form tests that server function URLs correctly include the app's\n        basepath. The form action should be '/custom/basepath/_serverFn/...' not\n        just '/_serverFn/...'\n      </p>\n      <form action={logoutFn.url} method=\"post\">\n        <input type=\"hidden\" name=\"csrfToken\" value=\"123abc\" />\n        <button type=\"submit\">Logout</button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/navigate-test.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/navigate-test')({\n  component: NavigateTest,\n})\n\nfunction NavigateTest() {\n  const navigate = Route.useNavigate()\n\n  return (\n    <div class=\"p-2\">\n      <h3 data-testid=\"navigate-test-component\">Navigate Test</h3>\n      <button\n        data-testid=\"to-posts-href-with-basepath-btn\"\n        onClick={() =>\n          navigate({\n            href: '/custom/basepath/posts',\n          })\n        }\n      >\n        Navigate to /posts using href with basepath\n      </button>{' '}\n      <button\n        data-testid=\"to-posts-href-with-basepath-reload-btn\"\n        onClick={() =>\n          navigate({\n            href: '/custom/basepath/posts',\n            reloadDocument: true,\n          })\n        }\n      >\n        Navigate to /posts using href with basepath (reloadDocument)\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nimport { fetchPost } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostErrorComponent'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\" data-testid=\"post-view\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post().id,\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { For } from 'solid-js'\n\nimport { fetchPosts } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\" data-testid=\"posts-component\">\n      <ul class=\"list-disc pl-4\">\n        <For each={posts()}>\n          {(post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          }}\n        </For>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { PostErrorComponent } from '~/components/PostErrorComponent'\n\nimport { fetchPost } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <Link to=\"/redirect/throw-it\">\n        <div data-testid=\"link-to-throw-it\">Throw It</div>\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect/throw-it')({\n  beforeLoad: () => {\n    throw redirect({\n      to: '/posts/$postId',\n      params: { postId: '1' },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nimport type { User } from '~/utils/users'\nimport { NotFound } from '~/components/NotFound'\nimport { UserErrorComponent } from '~/components/UserErrorComponent'\nimport { basepath } from '~/utils/basepath'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    return await axios\n      .get<User>(basepath + '/api/users/' + userId)\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch user')\n      })\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user().name}</h4>\n      <div class=\"text-sm\">{user().email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\nimport type { User } from '~/utils/users'\nimport { basepath } from '~/utils/basepath'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    return await axios\n      .get<Array<User>>(basepath + '/api/users')\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch users')\n      })\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users(),\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/server.ts",
    "content": "import handler from '@tanstack/solid-start/server-entry'\n\nexport default {\n  fetch(request: Request) {\n    return handler.fetch(request)\n  },\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/utils/basepath.ts",
    "content": "export const basepath = '/custom/basepath'\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/tests/navigation.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n\ntest('Server function URLs correctly include app basepath', async ({\n  page,\n}) => {\n  await page.goto('/logout')\n\n  const form = page.locator('form')\n  const actionUrl = await form.getAttribute('action')\n\n  expect(actionUrl).toMatch(/^\\/custom\\/basepath\\/_serverFn\\//)\n})\n\ntest('client-side redirect', async ({ page, baseURL }) => {\n  await page.goto('/redirect')\n  await page.getByTestId('link-to-throw-it').click()\n  await page.waitForLoadState('networkidle')\n\n  expect(await page.getByTestId('post-view').isVisible()).toBe(true)\n  expect(page.url()).toBe(`${baseURL}/posts/1`)\n})\n\ntest('server-side redirect', async ({ page, baseURL }) => {\n  await page.goto('/redirect/throw-it')\n  await page.waitForLoadState('networkidle')\n\n  expect(await page.getByTestId('post-view').isVisible()).toBe(true)\n  expect(page.url()).toBe(`${baseURL}/posts/1`)\n\n  // do not follow redirects since we want to test the Location header\n  // first go to the route WITHOUT the base path, this will just add the base path\n  await page.request\n    .get('/redirect/throw-it', { maxRedirects: 0 })\n    .then((res) => {\n      const headers = new Headers(res.headers())\n      expect(headers.get('location')).toBe('/custom/basepath/redirect/throw-it')\n    })\n  await page.request\n    .get('/custom/basepath/redirect/throw-it', { maxRedirects: 0 })\n    .then((res) => {\n      const headers = new Headers(res.headers())\n      expect(headers.get('location')).toBe('/custom/basepath/posts/1')\n    })\n})\n\ntest('navigate() with href containing basepath', async ({ page, baseURL }) => {\n  await page.goto('/navigate-test')\n  await expect(page.getByTestId('navigate-test-component')).toBeVisible()\n\n  const btn = page.getByTestId('to-posts-href-with-basepath-btn')\n  await btn.click()\n  // Should navigate to /custom/basepath/posts, NOT /custom/basepath/custom/basepath/posts\n  await page.waitForURL(`${baseURL}/posts`)\n  await expect(page.getByTestId('posts-component')).toBeVisible()\n})\n\ntest('navigate() with href containing basepath and reloadDocument=true', async ({\n  page,\n  baseURL,\n}) => {\n  await page.goto('/navigate-test')\n  await expect(page.getByTestId('navigate-test-component')).toBeVisible()\n\n  const btn = page.getByTestId('to-posts-href-with-basepath-reload-btn')\n  await btn.click()\n  // Should navigate to /custom/basepath/posts, NOT stay on current page\n  await page.waitForURL(`${baseURL}/posts`)\n  await expect(page.getByTestId('posts-component')).toBeVisible()\n})\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/custom-basepath/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  base: '/custom/basepath',\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/query-integration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/query-integration/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-query-integration\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\n\nconst baseURL = `http://localhost:${PORT}`\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/query-integration/src/queryOptions.ts",
    "content": "import { queryOptions } from '@tanstack/solid-query'\n\nexport const makeQueryOptions = (key: string) =>\n  queryOptions({\n    queryKey: ['e2e-test-query-integration', key],\n    queryFn: async () => {\n      console.log('fetching query data')\n      await new Promise<void>((resolve) => {\n        setTimeout(resolve, 500)\n      })\n      const result = typeof window !== 'undefined' ? 'client' : 'server'\n      console.log('query data result', result)\n      return result\n    },\n    staleTime: Infinity,\n  })\n"
  },
  {
    "path": "e2e/solid-start/query-integration/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UseQueryRouteImport } from './routes/useQuery'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as LoaderFetchQueryTypeRouteImport } from './routes/loader-fetchQuery/$type'\n\nconst UseQueryRoute = UseQueryRouteImport.update({\n  id: '/useQuery',\n  path: '/useQuery',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoaderFetchQueryTypeRoute = LoaderFetchQueryTypeRouteImport.update({\n  id: '/loader-fetchQuery/$type',\n  path: '/loader-fetchQuery/$type',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/useQuery' | '/loader-fetchQuery/$type'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/useQuery' | '/loader-fetchQuery/$type'\n  id: '__root__' | '/' | '/useQuery' | '/loader-fetchQuery/$type'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  UseQueryRoute: typeof UseQueryRoute\n  LoaderFetchQueryTypeRoute: typeof LoaderFetchQueryTypeRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/useQuery': {\n      id: '/useQuery'\n      path: '/useQuery'\n      fullPath: '/useQuery'\n      preLoaderRoute: typeof UseQueryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/loader-fetchQuery/$type': {\n      id: '/loader-fetchQuery/$type'\n      path: '/loader-fetchQuery/$type'\n      fullPath: '/loader-fetchQuery/$type'\n      preLoaderRoute: typeof LoaderFetchQueryTypeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  UseQueryRoute: UseQueryRoute,\n  LoaderFetchQueryTypeRoute: LoaderFetchQueryTypeRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/solid-query'\nimport { createRouter } from '@tanstack/solid-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type { QueryClient } from '@tanstack/solid-query'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument(props: { children?: any }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/loader-fetchQuery/$type\"\n            params={{ type: 'sync' }}\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            fetchQuery (sync)\n          </Link>{' '}\n          <Link\n            to=\"/loader-fetchQuery/$type\"\n            params={{ type: 'async' }}\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            fetchQuery (async)\n          </Link>{' '}\n          <Link\n            to=\"/useQuery\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            useQuery\n          </Link>{' '}\n          {/* <Link\n            to=\"/useSuspenseQuery\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            useSuspenseQuery\n          </Link>{' '} */}\n        </div>\n        <hr />\n        {props.children}\n        <TanStackRouterDevtoolsInProd position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Query Integration E2E tests</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/src/routes/loader-fetchQuery/$type.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { createFileRoute } from '@tanstack/solid-router'\nimport z from 'zod'\nimport { makeQueryOptions } from '~/queryOptions'\n\nexport const Route = createFileRoute('/loader-fetchQuery/$type')({\n  component: RouteComponent,\n  params: {\n    parse: ({ type }) =>\n      z\n        .object({\n          type: z.union([z.literal('sync'), z.literal('async')]),\n        })\n        .parse({ type }),\n  },\n  context: ({ params }) => ({\n    queryOptions: makeQueryOptions(`loader-fetchQuery-${params.type}`),\n  }),\n  loader: ({ context, params }) => {\n    const queryPromise = context.queryClient.fetchQuery(context.queryOptions)\n    if (params.type === 'sync') {\n      return queryPromise\n    }\n  },\n  ssr: 'data-only',\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n  const context = Route.useRouteContext()\n  const query = useQuery(() => context().queryOptions)\n  return (\n    <div>\n      <div>\n        loader data:{' '}\n        <div data-testid=\"loader-data\">{loaderData() ?? 'undefined'}</div>\n      </div>\n      <div>\n        query data:{' '}\n        <div data-testid=\"query-data\">{query.data ?? 'loading...'}</div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/src/routes/useQuery.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { makeQueryOptions } from '~/queryOptions'\n\nconst qOptions = makeQueryOptions('useQuery')\n\nexport const Route = createFileRoute('/useQuery')({\n  loader: ({ context }) => context.queryClient.ensureQueryData(qOptions),\n  component: RouteComponent,\n  ssr: true,\n})\n\nfunction RouteComponent() {\n  const query = useQuery(() => qOptions)\n\n  return (\n    <div>\n      <div>\n        query data:{' '}\n        <div data-testid=\"query-data\">{query.data ?? 'loading...'}</div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nbody {\n  @apply text-base;\n  font-family: system-ui, sans-serif;\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.describe('queries are streamed from the server', () => {\n  test('direct visit - loader on server runs fetchQuery and awaits it', async ({\n    page,\n  }) => {\n    await page.goto('/loader-fetchQuery/sync')\n\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n\n    const loaderData = page.getByTestId('loader-data')\n    await expect(loaderData).toHaveText('server')\n  })\n  test('direct visit - loader on server runs fetchQuery and does not await it', async ({\n    page,\n  }) => {\n    await page.goto('/loader-fetchQuery/async')\n\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n\n    const loaderData = page.getByTestId('loader-data')\n    await expect(loaderData).toHaveText('undefined')\n  })\n\n  test('useQuery', async ({ page }) => {\n    await page.goto('/useQuery')\n\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/query-integration/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/query-integration/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), solid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-basic-scroll-restoration\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as testsWithSearchRouteImport } from './routes/(tests)/with-search'\nimport { Route as testsWithLoaderRouteImport } from './routes/(tests)/with-loader'\nimport { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsWithSearchRoute = testsWithSearchRouteImport.update({\n  id: '/(tests)/with-search',\n  path: '/with-search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsWithLoaderRoute = testsWithLoaderRouteImport.update({\n  id: '/(tests)/with-loader',\n  path: '/with-loader',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsNormalPageRoute = testsNormalPageRouteImport.update({\n  id: '/(tests)/normal-page',\n  path: '/normal-page',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/with-loader': typeof testsWithLoaderRoute\n  '/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/with-loader': typeof testsWithLoaderRoute\n  '/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/(tests)/normal-page': typeof testsNormalPageRoute\n  '/(tests)/with-loader': typeof testsWithLoaderRoute\n  '/(tests)/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/normal-page' | '/with-loader' | '/with-search'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/normal-page' | '/with-loader' | '/with-search'\n  id:\n    | '__root__'\n    | '/'\n    | '/(tests)/normal-page'\n    | '/(tests)/with-loader'\n    | '/(tests)/with-search'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  testsNormalPageRoute: typeof testsNormalPageRoute\n  testsWithLoaderRoute: typeof testsWithLoaderRoute\n  testsWithSearchRoute: typeof testsWithSearchRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/with-search': {\n      id: '/(tests)/with-search'\n      path: '/with-search'\n      fullPath: '/with-search'\n      preLoaderRoute: typeof testsWithSearchRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/with-loader': {\n      id: '/(tests)/with-loader'\n      path: '/with-loader'\n      fullPath: '/with-loader'\n      preLoaderRoute: typeof testsWithLoaderRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/normal-page': {\n      id: '/(tests)/normal-page'\n      path: '/normal-page'\n      fullPath: '/normal-page'\n      preLoaderRoute: typeof testsNormalPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  testsNormalPageRoute: testsNormalPageRoute,\n  testsWithLoaderRoute: testsWithLoaderRoute,\n  testsWithSearchRoute: testsWithSearchRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/routes/(tests)/normal-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\n\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/normal-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>normal-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/routes/(tests)/with-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { sleep } from 'src/utils/posts'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/with-loader')({\n  loader: async () => {\n    await sleep(1000)\n    return { foo: 'bar' }\n  },\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>lazy-with-loader-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/routes/(tests)/with-search.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/with-search')({\n  validateSearch: zodValidator(z.object({ where: z.string() })),\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>page-with-search</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/routes/-components/scroll-block.tsx",
    "content": "export const atTheTopId = 'at-the-top'\nexport const atTheBottomId = 'at-the-bottom'\n\nexport function ScrollBlock({ number = 100 }: { number?: number }) {\n  return (\n    <>\n      <div id={atTheTopId} data-testid={atTheTopId}></div>\n      {Array.from({ length: number }).map((_, i) => (\n        <div>{i}</div>\n      ))}\n      <div id={atTheBottomId} data-testid={atTheBottomId}>\n        At the bottom\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  linkOptions,\n} from '@tanstack/solid-router'\nimport { Dynamic, HydrationScript } from 'solid-js/web'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return <p>{props.error.stack}</p>\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <Nav type=\"header\" />\n        <hr />\n        <Outlet />\n        <hr />\n        <Nav type=\"footer\" />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n\nfunction Nav({ type }: { type: 'header' | 'footer' }) {\n  const Elem = type === 'header' ? 'header' : 'footer'\n  const prefix = type === 'header' ? 'Head' : 'Foot'\n  return (\n    <Dynamic component={Elem} class=\"p-2 flex gap-2 text-lg\">\n      <Link\n        to=\"/\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        activeOptions={{ exact: true }}\n      >\n        {prefix}-/\n      </Link>{' '}\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/with-loader' }),\n          linkOptions({ to: '/with-search', search: { where: type } }),\n        ] as const\n      ).map((options, i) => (\n        <Link\n          {...options}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          {prefix}-{options.to}\n        </Link>\n      ))}\n    </Dynamic>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/routes/index.tsx",
    "content": "import { Link, createFileRoute, linkOptions } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2 grid gap-2\">\n      <h3>Welcome Home!</h3>\n      <p>\n        The are the links to be tested when navigating away from the index page.\n        Otherwise known as NOT first-load tests, rather known as navigation\n        tests.\n      </p>\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/with-loader' }),\n          linkOptions({ to: '/with-search', search: { where: 'footer' } }),\n        ] as const\n      ).map((options, i) => (\n        <div class=\"border p-2\">\n          <h4>{options.to} tests</h4>\n          <p>\n            <Link {...options} hash=\"at-the-bottom\">\n              {options.to}#at-the-bottom\n            </Link>\n          </p>\n        </div>\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/utils/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport function sleep(ms: number) {\n  return new Promise((r) => setTimeout(r, ms))\n}\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('Smoke - Renders home', async ({ page }) => {\n  await page.goto('/')\n  await expect(\n    page.getByRole('heading', { name: 'Welcome Home!' }),\n  ).toBeVisible()\n})\n\n// Test for scroll related stuff\n;[\n  { to: '/normal-page' },\n  { to: '/with-loader' },\n  { to: '/with-search', search: { where: 'footer' } },\n].forEach((options) => {\n  test(`On navigate to ${options.to} (from the header), scroll should be at top`, async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page.getByRole('link', { name: `Head-${options.to}` }).click()\n    await expect(page.getByTestId('at-the-top')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on navigation after the page is loaded\n  test(`On navigate via index page tests to ${options.to}, scroll should resolve at the bottom`, async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page\n      .getByRole('link', { name: `${options.to}#at-the-bottom` })\n      .click()\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on first load\n  test(`On first load of ${options.to}, scroll should resolve resolve at the bottom`, async ({\n    page,\n  }) => {\n    let url: string = options.to\n    if ('search' in options) {\n      url = `${url}?where=${options.search}`\n    }\n    await page.goto(`${url}#at-the-bottom`)\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/scroll-restoration/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/selective-ssr/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-selective-ssr\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts' | '/posts/$postId'\n  id: '__root__' | '/' | '/posts' | '/posts/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  ClientOnly,\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport { ssrSchema } from '~/search'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'Selective SSR E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  validateSearch: z.object({ root: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.root?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.root?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      root: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.root?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { root: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  shellComponent: RootDocument,\n  component: () => {\n    const search = Route.useSearch()\n    if (\n      typeof window === 'undefined' &&\n      search().root?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    return (\n      <div data-testid=\"root-container\">\n        <h2 data-testid=\"root-heading\">root</h2>\n        <div>\n          ssr: <b>{JSON.stringify(search().root?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"root-data-expected\">\n            {search().root?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader: <b data-testid=\"root-loader\">{loaderData().root}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"root-context\">{context().root}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n})\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  const routerState = useRouterState({\n    select: (state) => ({ isLoading: state.isLoading, status: state.status }),\n  })\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <h1>Selective SSR E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">\n              {routerState().isLoading ? 'true' : 'false'}\n            </b>\n          </div>\n          <div>\n            router status:{' '}\n            <b data-testid=\"router-status\">{routerState().status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/src/routes/index.tsx",
    "content": "import { Link, createFileRoute, linkOptions } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nconst baseTestCase = linkOptions({\n  to: '/posts/$postId',\n  params: { postId: '1' },\n})\n\nconst testCases = [\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: undefined,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        posts: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        posts: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: true,\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: 'data-only',\n          expected: { data: 'server', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: 'data-only',\n          expected: { data: 'server', render: 'client-only' },\n        },\n        posts: {\n          ssr: true,\n          expected: { data: 'server', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        postId: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n]\n\nfunction Home() {\n  const links = testCases.map((t, index) => {\n    const key = `testcase-${index}-link`\n\n    return (\n      <div>\n        <Link data-testid={key} {...t.link} reloadDocument={true}>\n          root: {JSON.stringify(t.link.search.root.ssr ?? 'undefined')} posts:{' '}\n          {JSON.stringify(t.link.search.posts.ssr ?? 'undefined')} $postId:{' '}\n          {JSON.stringify(t.link.search.postId.ssr ?? 'undefined')}\n        </Link>\n        <br />\n        <br />\n      </div>\n    )\n  })\n\n  return (\n    <>\n      <div>\n        test count: <b data-testid=\"test-count\">{links.length}</b>\n      </div>\n      <div>{links}</div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport z from 'zod'\nimport { ssrSchema } from '~/search'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  validateSearch: z.object({ postId: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.postId?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.postId?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      postId: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.postId?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { postId: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    if (\n      typeof window === 'undefined' &&\n      search().postId?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return (\n      <div data-testid=\"postId-container\">\n        <h4 data-testid=\"postId-heading\">postId</h4>\n        <div>\n          ssr: <b>{JSON.stringify(search().postId?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"postId-data-expected\">\n            {search().postId?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader: <b data-testid=\"postId-loader\">{loaderData().postId}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"postId-context\">{context().postId}</b>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/src/routes/posts.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\nimport z from 'zod'\nimport { ssrSchema } from '~/search'\n\nexport const Route = createFileRoute('/posts')({\n  validateSearch: z.object({ posts: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.posts?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.posts?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      posts: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.posts?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { posts: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    if (\n      typeof window === 'undefined' &&\n      search().posts?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return (\n      <div data-testid=\"posts-container\">\n        <h3 data-testid=\"posts-heading\">posts</h3>\n        <div>\n          ssr: <b>{JSON.stringify(search().posts?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"posts-data-expected\">\n            {search().posts?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader: <b data-testid=\"posts-loader\">{loaderData().posts}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"posts-context\">{context().posts}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/src/search.ts",
    "content": "import { z } from 'zod'\n\nexport const ssrSchema = z\n  .object({\n    ssr: z.union([z.literal('data-only'), z.boolean()]).optional(),\n    expected: z\n      .object({\n        data: z.union([z.literal('client'), z.literal('server')]),\n        render: z.union([\n          z.literal('client-only'),\n          z.literal('server-and-client'),\n        ]),\n      })\n      .optional(),\n  })\n  .optional()\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\nconst testCount = 7\n\ntest.describe('selective ssr', () => {\n  test('testcount matches', async ({ page }) => {\n    await page.goto('/')\n\n    await expect(page.getByTestId('test-count')).toHaveText(`${testCount}`)\n  })\n\n  for (let i = 0; i < testCount; i++) {\n    test(`run test ${i}`, async ({ page }) => {\n      await page.goto('/')\n      const testId = `testcase-${i}-link`\n      await page.getByTestId(testId).click()\n\n      // wait for page to be loaded by waiting for the leaf route to be rendered\n      await expect(page.getByTestId('postId-heading')).toContainText('postId')\n\n      // check expectations\n      await Promise.all(\n        ['root', 'posts', 'postId'].map(async (route) => {\n          const expectedData = await page\n            .getByTestId(`${route}-data-expected`)\n            .textContent()\n          expect(expectedData).not.toBeNull()\n          await expect(page.getByTestId(`${route}-loader`)).toContainText(\n            expectedData!,\n          )\n          await expect(page.getByTestId(`${route}-context`)).toContainText(\n            expectedData!,\n          )\n        }),\n      )\n      await expect(page.getByTestId('router-isLoading')).toContainText('false')\n      await expect(page.getByTestId('router-status')).toContainText('idle')\n    })\n  }\n})\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/selective-ssr/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-serialization-adapters\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/CustomError.ts",
    "content": "import { createSerializationAdapter } from '@tanstack/solid-router'\n\nexport class CustomError extends Error {\n  public foo: string\n  public bar: bigint\n\n  constructor(message: string, options: { foo: string; bar: bigint }) {\n    super(message)\n\n    Object.setPrototypeOf(this, new.target.prototype)\n\n    this.name = this.constructor.name\n    this.foo = options.foo\n    this.bar = options.bar\n  }\n}\n\nexport const customErrorAdapter = createSerializationAdapter({\n  key: 'custom-error',\n  test: (v) => v instanceof CustomError,\n  toSerializable: ({ message, foo, bar }) => {\n    return {\n      message,\n      foo,\n      bar,\n    }\n  },\n  fromSerializable: ({ message, foo, bar }) => {\n    return new CustomError(message, { foo, bar })\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/data.tsx",
    "content": "import { createSerializationAdapter } from '@tanstack/solid-router'\n\nexport class Foo {\n  constructor(public value: string) {}\n}\n\nexport interface Car {\n  __type: 'car'\n  make: string\n  model: string\n  year: number\n  honk: () => { message: string; make: string; model: string; year: number }\n}\n\nexport function makeCar(opts: {\n  make: string\n  model: string\n  year: number\n}): Car {\n  return {\n    ...opts,\n    __type: 'car',\n    honk: () => {\n      return { message: `Honk! Honk!`, ...opts }\n    },\n  }\n}\n\nexport const fooAdapter = createSerializationAdapter({\n  key: 'foo',\n  test: (value: any) => value instanceof Foo,\n  toSerializable: (foo) => foo.value,\n  fromSerializable: (value) => new Foo(value),\n})\n\nexport const carAdapter = createSerializationAdapter({\n  key: 'car',\n  test: (value: any): value is Car =>\n    '__type' in (value as Car) && value.__type === 'car',\n  toSerializable: (car) => ({\n    make: car.make,\n    model: car.model,\n    year: car.year,\n  }),\n  fromSerializable: (value: { make: string; model: string; year: number }) =>\n    makeCar(value),\n})\n\nexport function makeData() {\n  function makeFoo(suffix: string = '') {\n    return new Foo(typeof window === 'undefined' ? 'server' : 'client' + suffix)\n  }\n  return {\n    foo: {\n      singleInstance: makeFoo(),\n      array: [makeFoo('0'), makeFoo('1'), makeFoo('2')],\n      map: new Map([\n        [0, makeFoo('0')],\n        [1, makeFoo('1')],\n        [2, makeFoo('2')],\n      ]),\n      mapOfArrays: new Map([\n        [0, [makeFoo('0-a'), makeFoo('0-b')]],\n        [1, [makeFoo('1-a'), makeFoo('1-b')]],\n        [2, [makeFoo('2-a'), makeFoo('2-b')]],\n      ]),\n    },\n    car: {\n      singleInstance: makeCar({\n        make: 'Toyota',\n        model: 'Camry',\n        year: 2020,\n      }),\n      array: [\n        makeCar({ make: 'Honda', model: 'Accord', year: 2019 }),\n        makeCar({ make: 'Ford', model: 'Mustang', year: 2021 }),\n      ],\n      map: new Map([\n        [0, makeCar({ make: 'Chevrolet', model: 'Malibu', year: 2018 })],\n        [1, makeCar({ make: 'Nissan', model: 'Altima', year: 2020 })],\n        [2, makeCar({ make: 'Hyundai', model: 'Sonata', year: 2021 })],\n      ]),\n      mapOfArrays: new Map([\n        [0, [makeCar({ make: 'Kia', model: 'Optima', year: 2019 })]],\n        [1, [makeCar({ make: 'Subaru', model: 'Legacy', year: 2020 })]],\n        [2, [makeCar({ make: 'Volkswagen', model: 'Passat', year: 2021 })]],\n      ]),\n    },\n  }\n}\nexport class NestedOuter {\n  constructor(public inner: NestedInner) {}\n  whisper() {\n    return this.inner.value.toLowerCase()\n  }\n}\n\nexport class NestedInner {\n  constructor(public value: string) {}\n  shout() {\n    return this.value.toUpperCase()\n  }\n}\n\nexport const nestedInnerAdapter = createSerializationAdapter({\n  key: 'nestedInner',\n  test: (value): value is NestedInner => value instanceof NestedInner,\n  toSerializable: (inner) => inner.value,\n  fromSerializable: (value) => new NestedInner(value),\n})\n\nexport const nestedOuterAdapter = createSerializationAdapter({\n  key: 'nestedOuter',\n  extends: [nestedInnerAdapter],\n  test: (value) => value instanceof NestedOuter,\n  toSerializable: (outer) => outer.inner,\n  fromSerializable: (value) => new NestedOuter(value),\n})\n\nexport function makeNested() {\n  return new NestedOuter(new NestedInner('Hello World'))\n}\n\nexport function RenderData({\n  id,\n  data,\n}: {\n  id: string\n  data: ReturnType<typeof makeData>\n}) {\n  const localData = makeData()\n  return (\n    <div data-testid={`${id}-container`}>\n      <h3>Car</h3>\n      <h4>expected</h4>\n      <div data-testid={`${id}-car-expected`}>\n        {JSON.stringify({\n          make: localData.car.singleInstance.make,\n          model: localData.car.singleInstance.model,\n          year: localData.car.singleInstance.year,\n        })}\n      </div>\n      <h4>actual</h4>\n      <div data-testid={`${id}-car-actual`}>\n        {JSON.stringify({\n          make: data.car.singleInstance.make,\n          model: data.car.singleInstance.model,\n          year: data.car.singleInstance.year,\n        })}\n      </div>\n      <b>Foo</b>\n      <div data-testid={`${id}-foo`}>\n        {JSON.stringify({\n          value: data.foo.singleInstance.value,\n        })}\n      </div>\n    </div>\n  )\n}\n\nexport function RenderNestedData({ nested }: { nested: NestedOuter }) {\n  {\n    const localData = makeNested()\n    const expectedShoutState = localData.inner.shout()\n    const expectedWhisperState = localData.whisper()\n    const shoutState = nested.inner.shout()\n    const whisperState = nested.whisper()\n\n    return (\n      <div data-testid=\"data-only-container\">\n        <h2 data-testid=\"data-only-heading\">data-only</h2>\n        <div data-testid=\"shout-container\">\n          <h3>shout</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"shout-expected-state\">\n              {JSON.stringify(expectedShoutState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"shout-actual-state\">\n              {JSON.stringify(shoutState)}\n            </div>\n          </div>\n        </div>\n        <div data-testid=\"whisper-container\">\n          <h3>whisper</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"whisper-expected-state\">\n              {JSON.stringify(expectedWhisperState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"whisper-actual-state\">\n              {JSON.stringify(whisperState)}\n            </div>\n          </div>\n        </div>\n      </div>\n    )\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SsrStreamRouteImport } from './routes/ssr/stream'\nimport { Route as SsrNestedRouteImport } from './routes/ssr/nested'\nimport { Route as SsrDataOnlyRouteImport } from './routes/ssr/data-only'\nimport { Route as ServerFunctionNestedRouteImport } from './routes/server-function/nested'\nimport { Route as ServerFunctionCustomErrorRouteImport } from './routes/server-function/custom-error'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrStreamRoute = SsrStreamRouteImport.update({\n  id: '/ssr/stream',\n  path: '/ssr/stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrNestedRoute = SsrNestedRouteImport.update({\n  id: '/ssr/nested',\n  path: '/ssr/nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrDataOnlyRoute = SsrDataOnlyRouteImport.update({\n  id: '/ssr/data-only',\n  path: '/ssr/data-only',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ServerFunctionNestedRoute = ServerFunctionNestedRouteImport.update({\n  id: '/server-function/nested',\n  path: '/server-function/nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ServerFunctionCustomErrorRoute =\n  ServerFunctionCustomErrorRouteImport.update({\n    id: '/server-function/custom-error',\n    path: '/server-function/custom-error',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  id:\n    | '__root__'\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ServerFunctionCustomErrorRoute: typeof ServerFunctionCustomErrorRoute\n  ServerFunctionNestedRoute: typeof ServerFunctionNestedRoute\n  SsrDataOnlyRoute: typeof SsrDataOnlyRoute\n  SsrNestedRoute: typeof SsrNestedRoute\n  SsrStreamRoute: typeof SsrStreamRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/stream': {\n      id: '/ssr/stream'\n      path: '/ssr/stream'\n      fullPath: '/ssr/stream'\n      preLoaderRoute: typeof SsrStreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/nested': {\n      id: '/ssr/nested'\n      path: '/ssr/nested'\n      fullPath: '/ssr/nested'\n      preLoaderRoute: typeof SsrNestedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/data-only': {\n      id: '/ssr/data-only'\n      path: '/ssr/data-only'\n      fullPath: '/ssr/data-only'\n      preLoaderRoute: typeof SsrDataOnlyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/server-function/nested': {\n      id: '/server-function/nested'\n      path: '/server-function/nested'\n      fullPath: '/server-function/nested'\n      preLoaderRoute: typeof ServerFunctionNestedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/server-function/custom-error': {\n      id: '/server-function/custom-error'\n      path: '/server-function/custom-error'\n      fullPath: '/server-function/custom-error'\n      preLoaderRoute: typeof ServerFunctionCustomErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ServerFunctionCustomErrorRoute: ServerFunctionCustomErrorRoute,\n  ServerFunctionNestedRoute: ServerFunctionNestedRoute,\n  SsrDataOnlyRoute: SsrDataOnlyRoute,\n  SsrNestedRoute: SsrNestedRoute,\n  SsrStreamRoute: SsrStreamRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { startInstance } from './start.tsx'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n    config: Awaited<ReturnType<typeof startInstance.getOptions>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  ClientOnly,\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type { JSX } from 'solid-js'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'Serialization Adapters E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  shellComponent: RootDocument,\n  notFoundComponent: (e) => <div>404 - Not Found {JSON.stringify(e.data)}</div>,\n})\n\nfunction RootDocument({ children }: { children: JSX.Element }) {\n  const { isLoading, status } = useRouterState({\n    select: (state) => ({ isLoading: state.isLoading, status: state.status }),\n  })()\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <h1>Serialization Adapters E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">{isLoading ? 'true' : 'false'}</b>\n          </div>\n          <div>\n            router status: <b data-testid=\"router-status\">{status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {children}\n        <Scripts />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  errorComponent: (e) => <div>{e.error.message} </div>,\n})\n\nfunction Home() {\n  return (\n    <>\n      <div>\n        <h2>SSR</h2>\n        <Link\n          data-testid=\"ssr-data-only-link\"\n          to=\"/ssr/data-only\"\n          reloadDocument={true}\n        >\n          Data Only\n        </Link>\n        <br />\n        <Link\n          data-testid=\"ssr-stream-link\"\n          to=\"/ssr/stream\"\n          reloadDocument={true}\n        >\n          Stream\n        </Link>\n        <br />\n        <Link\n          data-testid=\"ssr-nested-link\"\n          to=\"/ssr/nested\"\n          reloadDocument={true}\n        >\n          Nested Classes\n        </Link>\n      </div>\n      <div>\n        <h2>Server Functions</h2>\n        <Link\n          data-testid=\"server-function-custom-error-link\"\n          to=\"/server-function/custom-error\"\n          reloadDocument={true}\n        >\n          Custom Error Serialization\n        </Link>\n        <br />\n        <Link\n          data-testid=\"server-functions-nested-link\"\n          to=\"/server-function/nested\"\n          reloadDocument={true}\n        >\n          Nested Classes returned from Server Function\n        </Link>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/routes/server-function/custom-error.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { setResponseStatus } from '@tanstack/solid-start/server'\nimport { createSignal } from 'solid-js'\nimport { z } from 'zod'\nimport { CustomError } from '~/CustomError'\n\nconst schema = z.object({ hello: z.string() })\nconst serverFnThrowing = createServerFn()\n  .inputValidator(schema)\n  .handler(async ({ data }) => {\n    if (data.hello === 'world') {\n      return 'Hello, world!'\n    }\n    setResponseStatus(499)\n    throw new CustomError('Invalid input', { foo: 'bar', bar: BigInt(123) })\n  })\n\nexport const Route = createFileRoute('/server-function/custom-error')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [validResponse, setValidResponse] = createSignal<any>(null)\n  const [invalidResponse, setInvalidResponse] =\n    createSignal<CustomError | null>(null)\n\n  return (\n    <div>\n      <button\n        data-testid=\"server-function-valid-input\"\n        onClick={() =>\n          serverFnThrowing({ data: { hello: 'world' } }).then(setValidResponse)\n        }\n      >\n        trigger valid input\n      </button>\n      <div data-testid=\"server-function-valid-response\">\n        {JSON.stringify(validResponse())}\n      </div>\n\n      <br />\n      <button\n        data-testid=\"server-function-invalid-input\"\n        onClick={() =>\n          serverFnThrowing({ data: { hello: 'error' } }).catch((err) => {\n            if (err instanceof CustomError) {\n              setInvalidResponse(err)\n            } else {\n              throw new Error('expected CustomError')\n            }\n          })\n        }\n      >\n        trigger invalid input\n      </button>\n      <div data-testid=\"server-function-invalid-response\">\n        {invalidResponse()\n          ? JSON.stringify({\n              message: invalidResponse()?.message,\n              foo: invalidResponse()?.foo,\n              bar: invalidResponse()?.bar.toString(),\n            })\n          : JSON.stringify(invalidResponse())}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/routes/server-function/nested.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { createSignal } from 'solid-js'\nimport type { NestedOuter } from '~/data'\nimport { RenderNestedData, makeNested } from '~/data'\n\nconst serverFnReturningNested = createServerFn().handler(() => {\n  return makeNested()\n})\n\nexport const Route = createFileRoute('/server-function/nested')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [nestedResponse, setNestedResponse] = createSignal<NestedOuter>()\n\n  return (\n    <div>\n      <button\n        data-testid=\"server-function-trigger\"\n        onClick={() => serverFnReturningNested().then(setNestedResponse)}\n      >\n        trigger\n      </button>\n\n      {nestedResponse() ? (\n        <RenderNestedData nested={nestedResponse()!} />\n      ) : (\n        <div data-testid=\"waiting-for-response\">waiting for response...</div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/routes/ssr/data-only.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { RenderData, makeData } from '~/data'\n\nexport const Route = createFileRoute('/ssr/data-only')({\n  ssr: 'data-only',\n  beforeLoad: () => {\n    return makeData()\n  },\n  loader: ({ context }) => {\n    return context\n  },\n  component: () => {\n    const context = Route.useRouteContext()\n    const loaderData = Route.useLoaderData()\n\n    const localData = makeData()\n    const expectedHonkState = localData.car.singleInstance.honk()\n\n    const honkState = loaderData().car.singleInstance.honk()\n\n    return (\n      <div data-testid=\"data-only-container\">\n        <h2 data-testid=\"data-only-heading\">data-only</h2>\n        <div>\n          context: <RenderData id=\"context\" data={context()} />\n        </div>\n        <div>\n          loader: <RenderData id=\"loader\" data={loaderData()} />\n        </div>\n        <div data-testid=\"honk-container\">\n          <h3>honk</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"honk-expected-state\">\n              {JSON.stringify(expectedHonkState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"honk-actual-state\">\n              {JSON.stringify(honkState)}\n            </div>\n          </div>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>posts Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/routes/ssr/nested.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { RenderNestedData, makeNested } from '~/data'\n\nexport const Route = createFileRoute('/ssr/nested')({\n  beforeLoad: () => {\n    return { nested: makeNested() }\n  },\n  loader: ({ context }) => {\n    return context\n  },\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    return <RenderNestedData nested={loaderData().nested} />\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/routes/ssr/stream.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { Suspense } from 'solid-js'\nimport { RenderData, makeData } from '~/data'\n\nexport const Route = createFileRoute('/ssr/stream')({\n  loader: () => {\n    const dataPromise = new Promise<ReturnType<typeof makeData>>((r) =>\n      setTimeout(() => r(makeData()), 1000),\n    )\n    return {\n      someString: 'hello world',\n      dataPromise,\n    }\n  },\n\n  errorComponent: (e) => <div>{e.error.message} </div>,\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n  return (\n    <div>\n      <h3 data-testid=\"stream-heading\">Stream</h3>\n      <div data-testid=\"some-data\">{loaderData().someString}</div>\n      <Suspense fallback={<div>Loading...</div>}>\n        <Await promise={loaderData().dataPromise}>\n          {(data) => <RenderData id=\"stream\" data={data} />}\n        </Await>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/start.tsx",
    "content": "import { createStart } from '@tanstack/solid-start'\nimport { carAdapter, fooAdapter, nestedOuterAdapter } from './data'\nimport { customErrorAdapter } from './CustomError'\n\nexport const startInstance = createStart(() => {\n  return {\n    defaultSsr: true,\n    serializationAdapters: [\n      fooAdapter,\n      carAdapter,\n      customErrorAdapter,\n      // only register nestedOuterAdapter here, nestedInnerAdapter is registered as an \"extends\" of nestedOuterAdapter\n      nestedOuterAdapter,\n    ],\n  }\n})\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport type { Page } from '@playwright/test'\n\nasync function awaitPageLoaded(page: Page) {\n  // wait for page to be loaded by waiting for the ClientOnly component to be rendered\n\n  await expect(page.getByTestId('router-isLoading')).toContainText('false')\n  await expect(page.getByTestId('router-status')).toContainText('idle')\n}\nasync function checkData(page: Page, id: string) {\n  const expectedData = await page\n    .getByTestId(`${id}-car-expected`)\n    .textContent()\n  expect(expectedData).not.toBeNull()\n  await expect(page.getByTestId(`${id}-car-actual`)).toContainText(\n    expectedData!,\n  )\n\n  await expect(page.getByTestId(`${id}-foo`)).toContainText(\n    '{\"value\":\"server\"}',\n  )\n}\n\nasync function checkNestedData(page: Page) {\n  const expectedShout = await page\n    .getByTestId(`shout-expected-state`)\n    .textContent()\n  expect(expectedShout).not.toBeNull()\n  await expect(page.getByTestId(`shout-actual-state`)).toContainText(\n    expectedShout!,\n  )\n\n  const expectedWhisper = await page\n    .getByTestId(`whisper-expected-state`)\n    .textContent()\n  expect(expectedWhisper).not.toBeNull()\n  await expect(page.getByTestId(`whisper-actual-state`)).toContainText(\n    expectedWhisper!,\n  )\n}\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 499',\n  ],\n})\ntest.describe('SSR serialization adapters', () => {\n  test(`data-only`, async ({ page }) => {\n    await page.goto('/ssr/data-only')\n    await awaitPageLoaded(page)\n\n    await Promise.all(\n      ['context', 'loader'].map(async (id) => checkData(page, id)),\n    )\n\n    const expectedHonkData = await page\n      .getByTestId('honk-expected-state')\n      .textContent()\n    expect(expectedHonkData).not.toBeNull()\n    await expect(page.getByTestId('honk-actual-state')).toContainText(\n      expectedHonkData!,\n    )\n  })\n\n  test('stream', async ({ page }) => {\n    await page.goto('/ssr/stream')\n    await awaitPageLoaded(page)\n    await checkData(page, 'stream')\n  })\n\n  test('nested', async ({ page }) => {\n    await page.goto('/ssr/nested')\n    await awaitPageLoaded(page)\n\n    await checkNestedData(page)\n  })\n})\n\ntest.describe('server functions serialization adapters', () => {\n  test('custom error', async ({ page }) => {\n    await page.goto('/server-function/custom-error')\n    await awaitPageLoaded(page)\n\n    await expect(\n      page.getByTestId('server-function-valid-response'),\n    ).toContainText('null')\n    await expect(\n      page.getByTestId('server-function-invalid-response'),\n    ).toContainText('null')\n\n    await page.getByTestId('server-function-valid-input').click()\n    await expect(\n      page.getByTestId('server-function-valid-response'),\n    ).toContainText('Hello, world!')\n\n    await page.getByTestId('server-function-invalid-input').click()\n    await expect(\n      page.getByTestId('server-function-invalid-response'),\n    ).toContainText('{\"message\":\"Invalid input\",\"foo\":\"bar\",\"bar\":\"123\"}')\n  })\n  test('nested', async ({ page }) => {\n    await page.goto('/server-function/nested')\n    await awaitPageLoaded(page)\n\n    await expect(page.getByTestId('waiting-for-response')).toContainText(\n      'waiting for response...',\n    )\n\n    await page.getByTestId('server-function-trigger').click()\n    await checkNestedData(page)\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/serialization-adapters/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/server-functions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-start/server-functions/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/server-functions/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-server-functions\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"js-cookie\": \"^3.0.5\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nexport const PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SubmitPostFormdataRouteImport } from './routes/submit-post-formdata'\nimport { Route as StatusRouteImport } from './routes/status'\nimport { Route as SerializeFormDataRouteImport } from './routes/serialize-form-data'\nimport { Route as ReturnNullRouteImport } from './routes/return-null'\nimport { Route as RawResponseRouteImport } from './routes/raw-response'\nimport { Route as MultipartRouteImport } from './routes/multipart'\nimport { Route as IsomorphicFnsRouteImport } from './routes/isomorphic-fns'\nimport { Route as HeadersRouteImport } from './routes/headers'\nimport { Route as EnvOnlyRouteImport } from './routes/env-only'\nimport { Route as DeadCodePreserveRouteImport } from './routes/dead-code-preserve'\nimport { Route as ConsistentRouteImport } from './routes/consistent'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as RedirectTestIndexRouteImport } from './routes/redirect-test/index'\nimport { Route as RedirectTestSsrIndexRouteImport } from './routes/redirect-test-ssr/index'\nimport { Route as PrimitivesIndexRouteImport } from './routes/primitives/index'\nimport { Route as MiddlewareIndexRouteImport } from './routes/middleware/index'\nimport { Route as FunctionMethodIndexRouteImport } from './routes/function-method/index'\nimport { Route as FunctionMetadataIndexRouteImport } from './routes/function-metadata/index'\nimport { Route as FormdataRedirectIndexRouteImport } from './routes/formdata-redirect/index'\nimport { Route as FactoryIndexRouteImport } from './routes/factory/index'\nimport { Route as CookiesIndexRouteImport } from './routes/cookies/index'\nimport { Route as AbortSignalIndexRouteImport } from './routes/abort-signal/index'\nimport { Route as RedirectTestTargetRouteImport } from './routes/redirect-test/target'\nimport { Route as RedirectTestSsrTargetRouteImport } from './routes/redirect-test-ssr/target'\nimport { Route as MiddlewareSendServerFnRouteImport } from './routes/middleware/send-serverFn'\nimport { Route as MiddlewareRequestMiddlewareRouteImport } from './routes/middleware/request-middleware'\nimport { Route as MiddlewareClientMiddlewareRouterRouteImport } from './routes/middleware/client-middleware-router'\nimport { Route as CookiesSetRouteImport } from './routes/cookies/set'\nimport { Route as AbortSignalMethodRouteImport } from './routes/abort-signal/$method'\nimport { Route as FormdataRedirectTargetNameRouteImport } from './routes/formdata-redirect/target.$name'\n\nconst SubmitPostFormdataRoute = SubmitPostFormdataRouteImport.update({\n  id: '/submit-post-formdata',\n  path: '/submit-post-formdata',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst StatusRoute = StatusRouteImport.update({\n  id: '/status',\n  path: '/status',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SerializeFormDataRoute = SerializeFormDataRouteImport.update({\n  id: '/serialize-form-data',\n  path: '/serialize-form-data',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ReturnNullRoute = ReturnNullRouteImport.update({\n  id: '/return-null',\n  path: '/return-null',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawResponseRoute = RawResponseRouteImport.update({\n  id: '/raw-response',\n  path: '/raw-response',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MultipartRoute = MultipartRouteImport.update({\n  id: '/multipart',\n  path: '/multipart',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IsomorphicFnsRoute = IsomorphicFnsRouteImport.update({\n  id: '/isomorphic-fns',\n  path: '/isomorphic-fns',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst HeadersRoute = HeadersRouteImport.update({\n  id: '/headers',\n  path: '/headers',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EnvOnlyRoute = EnvOnlyRouteImport.update({\n  id: '/env-only',\n  path: '/env-only',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeadCodePreserveRoute = DeadCodePreserveRouteImport.update({\n  id: '/dead-code-preserve',\n  path: '/dead-code-preserve',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ConsistentRoute = ConsistentRouteImport.update({\n  id: '/consistent',\n  path: '/consistent',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestIndexRoute = RedirectTestIndexRouteImport.update({\n  id: '/redirect-test/',\n  path: '/redirect-test/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestSsrIndexRoute = RedirectTestSsrIndexRouteImport.update({\n  id: '/redirect-test-ssr/',\n  path: '/redirect-test-ssr/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PrimitivesIndexRoute = PrimitivesIndexRouteImport.update({\n  id: '/primitives/',\n  path: '/primitives/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareIndexRoute = MiddlewareIndexRouteImport.update({\n  id: '/middleware/',\n  path: '/middleware/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FunctionMethodIndexRoute = FunctionMethodIndexRouteImport.update({\n  id: '/function-method/',\n  path: '/function-method/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FunctionMetadataIndexRoute = FunctionMetadataIndexRouteImport.update({\n  id: '/function-metadata/',\n  path: '/function-metadata/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FormdataRedirectIndexRoute = FormdataRedirectIndexRouteImport.update({\n  id: '/formdata-redirect/',\n  path: '/formdata-redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FactoryIndexRoute = FactoryIndexRouteImport.update({\n  id: '/factory/',\n  path: '/factory/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CookiesIndexRoute = CookiesIndexRouteImport.update({\n  id: '/cookies/',\n  path: '/cookies/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbortSignalIndexRoute = AbortSignalIndexRouteImport.update({\n  id: '/abort-signal/',\n  path: '/abort-signal/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestTargetRoute = RedirectTestTargetRouteImport.update({\n  id: '/redirect-test/target',\n  path: '/redirect-test/target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestSsrTargetRoute = RedirectTestSsrTargetRouteImport.update({\n  id: '/redirect-test-ssr/target',\n  path: '/redirect-test-ssr/target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareSendServerFnRoute = MiddlewareSendServerFnRouteImport.update({\n  id: '/middleware/send-serverFn',\n  path: '/middleware/send-serverFn',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareRequestMiddlewareRoute =\n  MiddlewareRequestMiddlewareRouteImport.update({\n    id: '/middleware/request-middleware',\n    path: '/middleware/request-middleware',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareClientMiddlewareRouterRoute =\n  MiddlewareClientMiddlewareRouterRouteImport.update({\n    id: '/middleware/client-middleware-router',\n    path: '/middleware/client-middleware-router',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst CookiesSetRoute = CookiesSetRouteImport.update({\n  id: '/cookies/set',\n  path: '/cookies/set',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbortSignalMethodRoute = AbortSignalMethodRouteImport.update({\n  id: '/abort-signal/$method',\n  path: '/abort-signal/$method',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FormdataRedirectTargetNameRoute =\n  FormdataRedirectTargetNameRouteImport.update({\n    id: '/formdata-redirect/target/$name',\n    path: '/formdata-redirect/target/$name',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/consistent': typeof ConsistentRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/abort-signal/$method': typeof AbortSignalMethodRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/abort-signal/': typeof AbortSignalIndexRoute\n  '/cookies/': typeof CookiesIndexRoute\n  '/factory/': typeof FactoryIndexRoute\n  '/formdata-redirect/': typeof FormdataRedirectIndexRoute\n  '/function-metadata/': typeof FunctionMetadataIndexRoute\n  '/function-method/': typeof FunctionMethodIndexRoute\n  '/middleware/': typeof MiddlewareIndexRoute\n  '/primitives/': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr/': typeof RedirectTestSsrIndexRoute\n  '/redirect-test/': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/consistent': typeof ConsistentRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/abort-signal/$method': typeof AbortSignalMethodRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/abort-signal': typeof AbortSignalIndexRoute\n  '/cookies': typeof CookiesIndexRoute\n  '/factory': typeof FactoryIndexRoute\n  '/formdata-redirect': typeof FormdataRedirectIndexRoute\n  '/function-metadata': typeof FunctionMetadataIndexRoute\n  '/function-method': typeof FunctionMethodIndexRoute\n  '/middleware': typeof MiddlewareIndexRoute\n  '/primitives': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr': typeof RedirectTestSsrIndexRoute\n  '/redirect-test': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/consistent': typeof ConsistentRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/abort-signal/$method': typeof AbortSignalMethodRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/abort-signal/': typeof AbortSignalIndexRoute\n  '/cookies/': typeof CookiesIndexRoute\n  '/factory/': typeof FactoryIndexRoute\n  '/formdata-redirect/': typeof FormdataRedirectIndexRoute\n  '/function-metadata/': typeof FunctionMetadataIndexRoute\n  '/function-method/': typeof FunctionMethodIndexRoute\n  '/middleware/': typeof MiddlewareIndexRoute\n  '/primitives/': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr/': typeof RedirectTestSsrIndexRoute\n  '/redirect-test/': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/consistent'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/abort-signal/$method'\n    | '/cookies/set'\n    | '/middleware/client-middleware-router'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/abort-signal/'\n    | '/cookies/'\n    | '/factory/'\n    | '/formdata-redirect/'\n    | '/function-metadata/'\n    | '/function-method/'\n    | '/middleware/'\n    | '/primitives/'\n    | '/redirect-test-ssr/'\n    | '/redirect-test/'\n    | '/formdata-redirect/target/$name'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/consistent'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/abort-signal/$method'\n    | '/cookies/set'\n    | '/middleware/client-middleware-router'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/abort-signal'\n    | '/cookies'\n    | '/factory'\n    | '/formdata-redirect'\n    | '/function-metadata'\n    | '/function-method'\n    | '/middleware'\n    | '/primitives'\n    | '/redirect-test-ssr'\n    | '/redirect-test'\n    | '/formdata-redirect/target/$name'\n  id:\n    | '__root__'\n    | '/'\n    | '/consistent'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/abort-signal/$method'\n    | '/cookies/set'\n    | '/middleware/client-middleware-router'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/abort-signal/'\n    | '/cookies/'\n    | '/factory/'\n    | '/formdata-redirect/'\n    | '/function-metadata/'\n    | '/function-method/'\n    | '/middleware/'\n    | '/primitives/'\n    | '/redirect-test-ssr/'\n    | '/redirect-test/'\n    | '/formdata-redirect/target/$name'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ConsistentRoute: typeof ConsistentRoute\n  DeadCodePreserveRoute: typeof DeadCodePreserveRoute\n  EnvOnlyRoute: typeof EnvOnlyRoute\n  HeadersRoute: typeof HeadersRoute\n  IsomorphicFnsRoute: typeof IsomorphicFnsRoute\n  MultipartRoute: typeof MultipartRoute\n  RawResponseRoute: typeof RawResponseRoute\n  ReturnNullRoute: typeof ReturnNullRoute\n  SerializeFormDataRoute: typeof SerializeFormDataRoute\n  StatusRoute: typeof StatusRoute\n  SubmitPostFormdataRoute: typeof SubmitPostFormdataRoute\n  AbortSignalMethodRoute: typeof AbortSignalMethodRoute\n  CookiesSetRoute: typeof CookiesSetRoute\n  MiddlewareClientMiddlewareRouterRoute: typeof MiddlewareClientMiddlewareRouterRoute\n  MiddlewareRequestMiddlewareRoute: typeof MiddlewareRequestMiddlewareRoute\n  MiddlewareSendServerFnRoute: typeof MiddlewareSendServerFnRoute\n  RedirectTestSsrTargetRoute: typeof RedirectTestSsrTargetRoute\n  RedirectTestTargetRoute: typeof RedirectTestTargetRoute\n  AbortSignalIndexRoute: typeof AbortSignalIndexRoute\n  CookiesIndexRoute: typeof CookiesIndexRoute\n  FactoryIndexRoute: typeof FactoryIndexRoute\n  FormdataRedirectIndexRoute: typeof FormdataRedirectIndexRoute\n  FunctionMetadataIndexRoute: typeof FunctionMetadataIndexRoute\n  FunctionMethodIndexRoute: typeof FunctionMethodIndexRoute\n  MiddlewareIndexRoute: typeof MiddlewareIndexRoute\n  PrimitivesIndexRoute: typeof PrimitivesIndexRoute\n  RedirectTestSsrIndexRoute: typeof RedirectTestSsrIndexRoute\n  RedirectTestIndexRoute: typeof RedirectTestIndexRoute\n  FormdataRedirectTargetNameRoute: typeof FormdataRedirectTargetNameRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/submit-post-formdata': {\n      id: '/submit-post-formdata'\n      path: '/submit-post-formdata'\n      fullPath: '/submit-post-formdata'\n      preLoaderRoute: typeof SubmitPostFormdataRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/status': {\n      id: '/status'\n      path: '/status'\n      fullPath: '/status'\n      preLoaderRoute: typeof StatusRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/serialize-form-data': {\n      id: '/serialize-form-data'\n      path: '/serialize-form-data'\n      fullPath: '/serialize-form-data'\n      preLoaderRoute: typeof SerializeFormDataRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/return-null': {\n      id: '/return-null'\n      path: '/return-null'\n      fullPath: '/return-null'\n      preLoaderRoute: typeof ReturnNullRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-response': {\n      id: '/raw-response'\n      path: '/raw-response'\n      fullPath: '/raw-response'\n      preLoaderRoute: typeof RawResponseRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/multipart': {\n      id: '/multipart'\n      path: '/multipart'\n      fullPath: '/multipart'\n      preLoaderRoute: typeof MultipartRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/isomorphic-fns': {\n      id: '/isomorphic-fns'\n      path: '/isomorphic-fns'\n      fullPath: '/isomorphic-fns'\n      preLoaderRoute: typeof IsomorphicFnsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/headers': {\n      id: '/headers'\n      path: '/headers'\n      fullPath: '/headers'\n      preLoaderRoute: typeof HeadersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/env-only': {\n      id: '/env-only'\n      path: '/env-only'\n      fullPath: '/env-only'\n      preLoaderRoute: typeof EnvOnlyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dead-code-preserve': {\n      id: '/dead-code-preserve'\n      path: '/dead-code-preserve'\n      fullPath: '/dead-code-preserve'\n      preLoaderRoute: typeof DeadCodePreserveRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/consistent': {\n      id: '/consistent'\n      path: '/consistent'\n      fullPath: '/consistent'\n      preLoaderRoute: typeof ConsistentRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test/': {\n      id: '/redirect-test/'\n      path: '/redirect-test'\n      fullPath: '/redirect-test/'\n      preLoaderRoute: typeof RedirectTestIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test-ssr/': {\n      id: '/redirect-test-ssr/'\n      path: '/redirect-test-ssr'\n      fullPath: '/redirect-test-ssr/'\n      preLoaderRoute: typeof RedirectTestSsrIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/primitives/': {\n      id: '/primitives/'\n      path: '/primitives'\n      fullPath: '/primitives/'\n      preLoaderRoute: typeof PrimitivesIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/': {\n      id: '/middleware/'\n      path: '/middleware'\n      fullPath: '/middleware/'\n      preLoaderRoute: typeof MiddlewareIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/function-method/': {\n      id: '/function-method/'\n      path: '/function-method'\n      fullPath: '/function-method/'\n      preLoaderRoute: typeof FunctionMethodIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/function-metadata/': {\n      id: '/function-metadata/'\n      path: '/function-metadata'\n      fullPath: '/function-metadata/'\n      preLoaderRoute: typeof FunctionMetadataIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/formdata-redirect/': {\n      id: '/formdata-redirect/'\n      path: '/formdata-redirect'\n      fullPath: '/formdata-redirect/'\n      preLoaderRoute: typeof FormdataRedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/factory/': {\n      id: '/factory/'\n      path: '/factory'\n      fullPath: '/factory/'\n      preLoaderRoute: typeof FactoryIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/cookies/': {\n      id: '/cookies/'\n      path: '/cookies'\n      fullPath: '/cookies/'\n      preLoaderRoute: typeof CookiesIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/abort-signal/': {\n      id: '/abort-signal/'\n      path: '/abort-signal'\n      fullPath: '/abort-signal/'\n      preLoaderRoute: typeof AbortSignalIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test/target': {\n      id: '/redirect-test/target'\n      path: '/redirect-test/target'\n      fullPath: '/redirect-test/target'\n      preLoaderRoute: typeof RedirectTestTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test-ssr/target': {\n      id: '/redirect-test-ssr/target'\n      path: '/redirect-test-ssr/target'\n      fullPath: '/redirect-test-ssr/target'\n      preLoaderRoute: typeof RedirectTestSsrTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/send-serverFn': {\n      id: '/middleware/send-serverFn'\n      path: '/middleware/send-serverFn'\n      fullPath: '/middleware/send-serverFn'\n      preLoaderRoute: typeof MiddlewareSendServerFnRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/request-middleware': {\n      id: '/middleware/request-middleware'\n      path: '/middleware/request-middleware'\n      fullPath: '/middleware/request-middleware'\n      preLoaderRoute: typeof MiddlewareRequestMiddlewareRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/client-middleware-router': {\n      id: '/middleware/client-middleware-router'\n      path: '/middleware/client-middleware-router'\n      fullPath: '/middleware/client-middleware-router'\n      preLoaderRoute: typeof MiddlewareClientMiddlewareRouterRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/cookies/set': {\n      id: '/cookies/set'\n      path: '/cookies/set'\n      fullPath: '/cookies/set'\n      preLoaderRoute: typeof CookiesSetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/abort-signal/$method': {\n      id: '/abort-signal/$method'\n      path: '/abort-signal/$method'\n      fullPath: '/abort-signal/$method'\n      preLoaderRoute: typeof AbortSignalMethodRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/formdata-redirect/target/$name': {\n      id: '/formdata-redirect/target/$name'\n      path: '/formdata-redirect/target/$name'\n      fullPath: '/formdata-redirect/target/$name'\n      preLoaderRoute: typeof FormdataRedirectTargetNameRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ConsistentRoute: ConsistentRoute,\n  DeadCodePreserveRoute: DeadCodePreserveRoute,\n  EnvOnlyRoute: EnvOnlyRoute,\n  HeadersRoute: HeadersRoute,\n  IsomorphicFnsRoute: IsomorphicFnsRoute,\n  MultipartRoute: MultipartRoute,\n  RawResponseRoute: RawResponseRoute,\n  ReturnNullRoute: ReturnNullRoute,\n  SerializeFormDataRoute: SerializeFormDataRoute,\n  StatusRoute: StatusRoute,\n  SubmitPostFormdataRoute: SubmitPostFormdataRoute,\n  AbortSignalMethodRoute: AbortSignalMethodRoute,\n  CookiesSetRoute: CookiesSetRoute,\n  MiddlewareClientMiddlewareRouterRoute: MiddlewareClientMiddlewareRouterRoute,\n  MiddlewareRequestMiddlewareRoute: MiddlewareRequestMiddlewareRoute,\n  MiddlewareSendServerFnRoute: MiddlewareSendServerFnRoute,\n  RedirectTestSsrTargetRoute: RedirectTestSsrTargetRoute,\n  RedirectTestTargetRoute: RedirectTestTargetRoute,\n  AbortSignalIndexRoute: AbortSignalIndexRoute,\n  CookiesIndexRoute: CookiesIndexRoute,\n  FactoryIndexRoute: FactoryIndexRoute,\n  FormdataRedirectIndexRoute: FormdataRedirectIndexRoute,\n  FunctionMetadataIndexRoute: FunctionMetadataIndexRoute,\n  FunctionMethodIndexRoute: FunctionMethodIndexRoute,\n  MiddlewareIndexRoute: MiddlewareIndexRoute,\n  PrimitivesIndexRoute: PrimitivesIndexRoute,\n  RedirectTestSsrIndexRoute: RedirectTestSsrIndexRoute,\n  RedirectTestIndexRoute: RedirectTestIndexRoute,\n  FormdataRedirectTargetNameRoute: FormdataRedirectTargetNameRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query'\nimport { QueryClient } from '@tanstack/solid-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n    context: {\n      foo: {\n        bar: 'baz',\n      },\n    },\n  })\n\n  setupRouterSsrQueryIntegration({ router, queryClient })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\n\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  errorComponent: (props) => {\n    return <p>{props.error.stack}</p>\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <Outlet />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/abort-signal/$method.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn, createServerOnlyFn } from '@tanstack/solid-start'\nimport { getRequest } from '@tanstack/solid-start/server'\nimport * as Solid from 'solid-js'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/abort-signal/$method')({\n  params: z.object({\n    method: z.union([z.literal('GET'), z.literal('POST')]),\n  }),\n  component: RouteComponent,\n})\n\nconst serverFnImpl = createServerOnlyFn(async () => {\n  const request = getRequest()\n  const signal = request.signal\n  console.log('server function started', { signal })\n  return new Promise<string>((resolve, reject) => {\n    if (signal.aborted) {\n      return reject(new Error('Aborted before start'))\n    }\n    const timerId = setTimeout(() => {\n      console.log('server function finished')\n      resolve('server function result')\n    }, 1000)\n    const onAbort = () => {\n      clearTimeout(timerId)\n      console.log('server function aborted')\n      reject(new Error('Aborted'))\n    }\n    signal.addEventListener('abort', onAbort, { once: true })\n  })\n})\nconst abortableServerFnGET = createServerFn().handler(serverFnImpl)\n\nconst abortableServerFnPOST = createServerFn({ method: 'POST' }).handler(\n  serverFnImpl,\n)\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  const abortableServerFn = () =>\n    params().method === 'GET' ? abortableServerFnGET : abortableServerFnPOST\n  const [errorMessage, setErrorMessage] = Solid.createSignal<\n    string | undefined\n  >(undefined)\n  const [result, setResult] = Solid.createSignal<string | undefined>(undefined)\n\n  const reset = () => {\n    setErrorMessage(undefined)\n    setResult(undefined)\n  }\n  return (\n    <div>\n      <button\n        data-testid=\"run-with-abort-btn\"\n        onClick={async () => {\n          reset()\n          const controller = new AbortController()\n          const serverFnPromise = abortableServerFn()({\n            signal: controller.signal,\n          })\n          const timeoutPromise = new Promise((resolve) =>\n            setTimeout(resolve, 500),\n          )\n          await timeoutPromise\n          controller.abort()\n          try {\n            const serverFnResult = await serverFnPromise\n            setResult(serverFnResult)\n          } catch (error) {\n            setErrorMessage((error as any).message)\n          }\n        }}\n      >\n        call server function with abort signal\n      </button>\n      <br />\n      <button\n        data-testid=\"run-without-abort-btn\"\n        onClick={async () => {\n          reset()\n          const serverFnResult = await abortableServerFn()()\n          setResult(serverFnResult)\n        }}\n      >\n        call server function\n      </button>\n      <div class=\"p-2\">\n        result: <p data-testid=\"result\">{result() ?? '$undefined'}</p>\n      </div>\n      <div class=\"p-2\">\n        message:{' '}\n        <p data-testid=\"errorMessage\">{errorMessage() ?? '$undefined'}</p>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/abort-signal/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/abort-signal/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server functions E2E Abort Signal Tests</h1>\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Link to=\"/abort-signal/$method\" params={{ method: 'GET' }}>\n            Abortable server function call with GET\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/abort-signal/$method\" params={{ method: 'POST' }}>\n            Abortable server function call with POST\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/consistent.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { createServerFn } from '@tanstack/solid-start'\n\n/**\n * This checks whether the returned payloads from a\n * server function are the same, regardless of whether the server function is\n * called directly from the client or from within the server function.\n * @link https://github.com/TanStack/router/issues/1866\n * @link https://github.com/TanStack/router/issues/2481\n */\n\nexport const Route = createFileRoute('/consistent')({\n  component: ConsistentServerFnCalls,\n  loader: async () => {\n    const data = await cons_serverGetFn1({ data: { username: 'TEST' } })\n    console.log('cons_serverGetFn1', data)\n    return { data }\n  },\n})\n\nconst cons_getFn1 = createServerFn()\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return { payload: data }\n  })\n\nconst cons_serverGetFn1 = createServerFn()\n  .inputValidator((d: { username: string }) => d)\n  .handler(async ({ data }) => {\n    return cons_getFn1({ data })\n  })\n\nconst cons_postFn1 = createServerFn({ method: 'POST' })\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return { payload: data }\n  })\n\nconst cons_serverPostFn1 = createServerFn({ method: 'POST' })\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return cons_postFn1({ data })\n  })\n\nfunction ConsistentServerFnCalls() {\n  const [getServerResult, setGetServerResult] = Solid.createSignal({})\n  const [getDirectResult, setGetDirectResult] = Solid.createSignal({})\n\n  const [postServerResult, setPostServerResult] = Solid.createSignal({})\n  const [postDirectResult, setPostDirectResult] = Solid.createSignal({})\n\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Consistent Server Fn GET Calls</h3>\n      <p>\n        This component checks whether the returned payloads from server function\n        are the same, regardless of whether the server function is called\n        directly from the client or from within the server function.\n      </p>\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-consistent-server-fns-result\">\n            {JSON.stringify({ payload: { username: 'TEST' } })}\n          </pre>\n        </code>\n      </div>\n      <p>\n        {`GET: cons_getFn1 called from server cons_serverGetFn1 returns`}\n        <br />\n        <span data-testid=\"cons_serverGetFn1-response\">\n          {JSON.stringify(getServerResult())}\n        </span>\n      </p>\n      <p>\n        {`GET: cons_getFn1 called directly returns`}\n        <br />\n        <span data-testid=\"cons_getFn1-response\">\n          {JSON.stringify(getDirectResult())}\n        </span>\n      </p>\n      <p>\n        {`POST: cons_postFn1 called from cons_serverPostFn1 returns`}\n        <br />\n        <span data-testid=\"cons_serverPostFn1-response\">\n          {JSON.stringify(postServerResult())}\n        </span>\n      </p>\n      <p>\n        {`POST: cons_postFn1 called directly returns`}\n        <br />\n        <span data-testid=\"cons_postFn1-response\">\n          {JSON.stringify(postDirectResult())}\n        </span>\n      </p>\n      <button\n        data-testid=\"test-consistent-server-fn-calls-btn\"\n        type=\"button\"\n        class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          // GET calls\n          cons_serverGetFn1({ data: { username: 'TEST' } }).then(\n            setGetServerResult,\n          )\n          cons_getFn1({ data: { username: 'TEST' } }).then(setGetDirectResult)\n\n          // POST calls\n          cons_serverPostFn1({ data: { username: 'TEST' } }).then(\n            setPostServerResult,\n          )\n          cons_postFn1({ data: { username: 'TEST' } }).then(setPostDirectResult)\n\n          cons_postFn1({ data: { username: 'TEST' } }).then(setPostDirectResult)\n        }}\n      >\n        Test Consistent server function responses\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/cookies/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nconst cookieSchema = z\n  .object({ value: z.string() })\n  .catch(() => ({ value: `CLIENT-${Date.now()}` }))\nexport const Route = createFileRoute('/cookies/')({\n  validateSearch: cookieSchema,\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n  return (\n    <Link\n      data-testid=\"link-to-set\"\n      from=\"/cookies/\"\n      to=\"./set\"\n      search={search()}\n    >\n      got to route that sets the cookies with {JSON.stringify(search())}\n    </Link>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/cookies/set.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { setCookie } from '@tanstack/solid-start/server'\nimport { z } from 'zod'\nimport Cookies from 'js-cookie'\nimport * as Solid from 'solid-js'\n\nconst cookieSchema = z.object({ value: z.string() })\n\nexport const Route = createFileRoute('/cookies/set')({\n  validateSearch: cookieSchema,\n  loaderDeps: ({ search }) => search,\n  loader: async ({ deps }) => {\n    await setCookieServerFn1({ data: deps })\n    await setCookieServerFn2({ data: deps })\n  },\n  component: RouteComponent,\n})\n\nexport const setCookieServerFn1 = createServerFn()\n  .inputValidator(cookieSchema)\n  .handler(({ data }) => {\n    setCookie(`cookie-1-${data.value}`, data.value)\n    setCookie(`cookie-2-${data.value}`, data.value)\n  })\n\nexport const setCookieServerFn2 = createServerFn()\n  .inputValidator(cookieSchema)\n  .handler(({ data }) => {\n    setCookie(`cookie-3-${data.value}`, data.value)\n    setCookie(`cookie-4-${data.value}`, data.value)\n  })\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n  const [cookiesFromDocument, setCookiesFromDocument] = Solid.createSignal<\n    Record<string, string | undefined> | undefined\n  >(undefined)\n  Solid.createEffect(() => {\n    const tempCookies: Record<string, string | undefined> = {}\n    for (let i = 1; i <= 4; i++) {\n      const key = `cookie-${i}-${search().value}`\n      tempCookies[key] = Cookies.get(key)\n    }\n    setCookiesFromDocument(tempCookies)\n  }, [])\n  return (\n    <div>\n      <h1 class=\"text-xl\">cookies result</h1>\n      <table>\n        <tbody>\n          <tr>\n            <td>cookie</td>\n            <td>value</td>\n          </tr>\n          {Object.entries(cookiesFromDocument() || {}).map(([key, value]) => (\n            <tr>\n              <td>{key}</td>\n              <td data-testid={key}>{value}</td>\n            </tr>\n          ))}\n        </tbody>\n      </table>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/dead-code-preserve.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as fs from 'node:fs'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { getRequestHeader } from '@tanstack/solid-start/server'\nimport { createSignal } from 'solid-js'\nimport {} from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dead-code-preserve')({\n  component: RouteComponent,\n})\n\n// by using this we make sure DCE still works - this errors when imported on the client\n\nconst filePath = 'count-effect.txt'\n\nasync function readCount() {\n  return parseInt(\n    await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'),\n  )\n}\n\nasync function updateCount() {\n  const count = await readCount()\n  await fs.promises.writeFile(filePath, `${count + 1}`)\n  return true\n}\n\nconst writeFileServerFn = createServerFn().handler(async () => {\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const test = await updateCount()\n  return getRequestHeader('X-Test')\n})\n\nconst readFileServerFn = createServerFn().handler(async () => {\n  const data = await readCount()\n  return data\n})\n\nfunction RouteComponent() {\n  const [serverFnOutput, setServerFnOutput] = createSignal<number>()\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Dead code test</h3>\n      <p>\n        This server function writes to a file as a side effect, then reads it.\n      </p>\n      <button\n        class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        data-testid=\"test-dead-code-fn-call-btn\"\n        onClick={async () => {\n          await writeFileServerFn({ headers: { 'X-Test': 'test' } })\n          setServerFnOutput(await readFileServerFn())\n        }}\n      >\n        Call Dead Code Fn\n      </button>\n      <h4>Server output</h4>\n      <pre data-testid=\"dead-code-fn-call-response\">{serverFnOutput()}</pre>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/env-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport {\n  createClientOnlyFn,\n  createServerFn,\n  createServerOnlyFn,\n} from '@tanstack/solid-start'\nimport { createSignal } from 'solid-js'\n\nconst serverEcho = createServerOnlyFn((input: string) => 'server got: ' + input)\nconst clientEcho = createClientOnlyFn((input: string) => 'client got: ' + input)\n\nconst testOnServer = createServerFn().handler(() => {\n  const serverOnServer = serverEcho('hello')\n  let clientOnServer: string\n  try {\n    clientOnServer = clientEcho('hello')\n  } catch (e) {\n    clientOnServer =\n      'clientEcho threw an error: ' +\n      (e instanceof Error ? e.message : String(e))\n  }\n  return { serverOnServer, clientOnServer }\n})\n\nexport const Route = createFileRoute('/env-only')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [results, setResults] = createSignal<Partial<Record<string, string>>>()\n\n  async function handleClick() {\n    const { serverOnServer, clientOnServer } = await testOnServer()\n    const clientOnClient = clientEcho('hello')\n    let serverOnClient: string\n    try {\n      serverOnClient = serverEcho('hello')\n    } catch (e) {\n      serverOnClient =\n        'serverEcho threw an error: ' +\n        (e instanceof Error ? e.message : String(e))\n    }\n    setResults({\n      serverOnServer,\n      clientOnServer,\n      clientOnClient,\n      serverOnClient,\n    })\n  }\n\n  return (\n    <div>\n      <button onClick={handleClick} data-testid=\"test-env-only-results-btn\">\n        Run\n      </button>\n      {!!results() && (\n        <div>\n          <h1>\n            <code>serverEcho</code>\n          </h1>\n          When we called the function on the server:\n          <pre data-testid=\"server-on-server\">{results()?.serverOnServer}</pre>\n          When we called the function on the client:\n          <pre data-testid=\"server-on-client\">{results()?.serverOnClient}</pre>\n          <br />\n          <h1>\n            <code>clientEcho</code>\n          </h1>\n          When we called the function on the server:\n          <pre data-testid=\"client-on-server\">{results()?.clientOnServer}</pre>\n          When we called the function on the client:\n          <pre data-testid=\"client-on-client\">{results()?.clientOnClient}</pre>\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts",
    "content": "import { createMiddleware } from '@tanstack/solid-start'\nimport { createFooServerFn } from './createFooServerFn'\n\nconst barMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('Bar middleware triggered')\n    return next({\n      context: { bar: 'bar' } as const,\n    })\n  },\n)\n\nexport const createBarServerFn = createFooServerFn().middleware([barMiddleware])\n\nexport const barFnInsideFactoryFile = createBarServerFn().handler(\n  ({ context, method }) => {\n    return {\n      name: 'barFnInsideFactoryFile',\n      context,\n      method,\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/factory/-functions/createFakeFn.ts",
    "content": "export function createFakeFn() {\n  return {\n    handler: (cb: () => Promise<any>) => cb,\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/solid-start'\nimport { getRequest } from '@tanstack/solid-start/server'\n\nconst fooMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    const request = getRequest()\n    console.log('Foo middleware triggered')\n    return next({\n      context: { foo: 'foo', method: request.method } as const,\n    })\n  },\n)\n\nexport const createFooServerFn = createServerFn().middleware([fooMiddleware])\n\nexport const fooFnInsideFactoryFile = createFooServerFn().handler(\n  async ({ context, method }) => {\n    console.log('fooFnInsideFactoryFile handler triggered', context.method)\n    return {\n      name: 'fooFnInsideFactoryFile',\n      context,\n      method,\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/factory/-functions/functions.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/solid-start'\nimport { createBarServerFn } from './createBarServerFn'\nimport { createFooServerFn } from './createFooServerFn'\nimport { createFakeFn } from './createFakeFn'\n\nexport const fooFn = createFooServerFn().handler(({ context, method }) => {\n  return {\n    name: 'fooFn',\n    context,\n    method,\n  }\n})\n\nexport const fooFnPOST = createFooServerFn({ method: 'POST' }).handler(\n  ({ context, method }) => {\n    return {\n      name: 'fooFnPOST',\n      context,\n      method,\n    }\n  },\n)\n\nexport const barFn = createBarServerFn().handler(({ context, method }) => {\n  return {\n    name: 'barFn',\n    context,\n    method,\n  }\n})\n\nexport const barFnPOST = createBarServerFn({ method: 'POST' }).handler(\n  ({ context, method }) => {\n    return {\n      name: 'barFnPOST',\n      context,\n      method,\n    }\n  },\n)\n\nconst localMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('local middleware triggered')\n    return next({\n      context: { local: 'local' } as const,\n    })\n  },\n)\n\nconst localFnFactory = createBarServerFn.middleware([localMiddleware])\n\nconst anotherMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('another middleware triggered')\n    return next({\n      context: { another: 'another' } as const,\n    })\n  },\n)\n\nexport const localFn = localFnFactory()\n  .middleware([anotherMiddleware])\n  .handler(({ context, method }) => {\n    return {\n      name: 'localFn',\n      context,\n      method,\n    }\n  })\n\nexport const localFnPOST = localFnFactory({ method: 'POST' })\n  .middleware([anotherMiddleware])\n  .handler(({ context, method }) => {\n    return {\n      name: 'localFnPOST',\n      context,\n      method,\n    }\n  })\n\nexport const fakeFn = createFakeFn().handler(async () => {\n  return {\n    name: 'fakeFn',\n    window,\n  }\n})\n\nexport const composeFactory = createServerFn({ method: 'GET' }).middleware([\n  createBarServerFn,\n])\nexport const composedFn = composeFactory()\n  .middleware([anotherMiddleware, localFnFactory])\n  .handler(({ context, method }) => {\n    return {\n      name: 'composedFn',\n      context,\n      method,\n    }\n  })\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/factory/index.tsx",
    "content": "import { createFileRoute, deepEqual } from '@tanstack/solid-router'\n\nimport { createSignal, For } from 'solid-js'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { fooFnInsideFactoryFile } from './-functions/createFooServerFn'\nimport {\n  barFn,\n  barFnPOST,\n  composedFn,\n  fakeFn,\n  fooFn,\n  fooFnPOST,\n  localFn,\n  localFnPOST,\n} from './-functions/functions'\n\nexport const Route = createFileRoute('/factory/')({\n  ssr: false,\n  component: RouteComponent,\n})\n\nconst fnInsideRoute = createServerFn({ method: 'GET' }).handler(\n  ({ method }) => {\n    return {\n      name: 'fnInsideRoute',\n      method,\n    }\n  },\n)\n\nconst functions = {\n  fnInsideRoute: {\n    fn: fnInsideRoute,\n    type: 'serverFn',\n    expected: {\n      name: 'fnInsideRoute',\n      method: 'GET',\n    },\n  },\n  fooFnInsideFactoryFile: {\n    fn: fooFnInsideFactoryFile,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFnInsideFactoryFile',\n      context: { foo: 'foo', method: 'GET' },\n      method: 'GET',\n    },\n  },\n  fooFn: {\n    fn: fooFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFn',\n      context: { foo: 'foo', method: 'GET' },\n      method: 'GET',\n    },\n  },\n  fooFnPOST: {\n    fn: fooFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFnPOST',\n      context: { foo: 'foo', method: 'POST' },\n      method: 'POST',\n    },\n  },\n  barFn: {\n    fn: barFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'barFn',\n      context: { foo: 'foo', method: 'GET', bar: 'bar' },\n      method: 'GET',\n    },\n  },\n  barFnPOST: {\n    fn: barFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'barFnPOST',\n      context: { foo: 'foo', method: 'POST', bar: 'bar' },\n      method: 'POST',\n    },\n  },\n  localFn: {\n    fn: localFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'localFn',\n      context: {\n        foo: 'foo',\n        method: 'GET',\n        bar: 'bar',\n        local: 'local',\n        another: 'another',\n      },\n      method: 'GET',\n    },\n  },\n  localFnPOST: {\n    fn: localFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'localFnPOST',\n      context: {\n        foo: 'foo',\n        method: 'POST',\n        bar: 'bar',\n        local: 'local',\n        another: 'another',\n      },\n      method: 'POST',\n    },\n  },\n  composedFn: {\n    fn: composedFn,\n    type: 'serverFn',\n    expected: {\n      name: 'composedFn',\n      context: {\n        foo: 'foo',\n        method: 'GET',\n        bar: 'bar',\n        another: 'another',\n        local: 'local',\n      },\n      method: 'GET',\n    },\n  },\n  fakeFn: {\n    fn: fakeFn,\n    type: 'localFn',\n    expected: {\n      name: 'fakeFn',\n      window,\n    },\n  },\n} satisfies Record<string, TestCase>\n\ninterface TestCase {\n  fn: () => Promise<any>\n  expected: any\n  type: 'serverFn' | 'localFn'\n}\nfunction Test(props: TestCase) {\n  const [result, setResult] = createSignal<null | unknown>(null)\n  function comparison() {\n    if (result()) {\n      const isEqual = deepEqual(result(), props.expected)\n      return isEqual ? 'equal' : 'not equal'\n    }\n    return 'Loading...'\n  }\n\n  return (\n    <div\n      data-testid={`test-${props.expected.name}`}\n      class=\"p-2 border border-gray-200 rounded-md\"\n    >\n      <h2 class=\"font-bold text-lg\"></h2>\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid={`expected-fn-result-${props.expected.name}`}>\n            {props.type === 'serverFn'\n              ? JSON.stringify(props.expected)\n              : 'localFn'}\n          </pre>\n        </code>\n      </div>\n      <p>\n        fn returns:\n        <br />\n        <span data-testid={`fn-result-${props.expected.name}`}>\n          {result()\n            ? props.type === 'serverFn'\n              ? JSON.stringify(result())\n              : 'localFn'\n            : 'Loading...'}\n        </span>{' '}\n        <span data-testid={`fn-comparison-${props.expected.name}`}>\n          {comparison()}\n        </span>\n      </p>\n      <button\n        data-testid={`btn-fn-${props.expected.name}`}\n        type=\"button\"\n        class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          props.fn().then(setResult)\n        }}\n      >\n        Invoke Server Function\n      </button>\n    </div>\n  )\n}\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 m-2 grid gap-2\" data-testid=\"factory-route-component\">\n      <h1 class=\"font-bold text-lg\">Server functions middleware E2E tests</h1>\n      <For each={Object.entries(functions)}>\n        {([name, testCase]) => <Test {...testCase} />}\n      </For>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/formdata-redirect/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn, useServerFn } from '@tanstack/solid-start'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/formdata-redirect/')({\n  component: SubmitPostFormDataFn,\n  validateSearch: z.object({\n    mode: z.union([z.literal('js'), z.literal('no-js')]).default('js'),\n  }),\n})\n\nconst testValues = {\n  name: 'Sean',\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n\n    if (!name) {\n      throw new Error('Name is required')\n    }\n\n    return {\n      name: name.toString(),\n    }\n  })\n  .handler(({ data: { name } }) => {\n    throw redirect({ to: '/formdata-redirect/target/$name', params: { name } })\n  })\n\nfunction SubmitPostFormDataFn() {\n  const mode = Route.useSearch({ select: (search) => search.mode })\n  const greetUserFn = useServerFn(greetUser)\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Submit POST FormData Fn Call</h3>\n      <div class=\"overflow-y-auto\">\n        It should return redirect to /formdata-redirect/target/{testValues.name}{' '}\n        and greet the user with their name:\n        <code>\n          <pre data-testid=\"expected-submit-post-formdata-server-fn-result\">\n            {testValues.name}\n          </pre>\n        </code>\n      </div>\n      <form\n        class=\"flex flex-col gap-2\"\n        data-testid=\"submit-post-formdata-form\"\n        method=\"post\"\n        action={greetUser.url}\n        onSubmit={async (evt) => {\n          if (mode() === 'js') {\n            evt.preventDefault()\n            const data = new FormData(evt.currentTarget)\n            await greetUserFn({ data })\n          }\n        }}\n      >\n        <input type=\"text\" name=\"name\" value={testValues.name} />\n        <button\n          type=\"submit\"\n          data-testid=\"test-submit-post-formdata-fn-calls-btn\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/formdata-redirect/target.$name.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/formdata-redirect/target/$name')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div data-testid=\"formdata-redirect-target\">\n      Hello{' '}\n      <span data-testid=\"formdata-redirect-target-name\">{params().name}</span>!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/function-metadata/-functions/normalServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/solid-start'\n\nexport const getServerFn = createServerFn().handler(({ serverFnMeta }) => {\n  return serverFnMeta\n})\n\nexport const postServerFn = createServerFn({ method: 'POST' }).handler(\n  ({ serverFnMeta }) => {\n    return serverFnMeta\n  },\n)\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/function-metadata/-functions/serverFnCallingServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/solid-start'\nimport { getServerFn, postServerFn } from './normalServerFn'\n\nexport const getServerFnCallingServerFn = createServerFn().handler(\n  async ({ serverFnMeta }) => {\n    const post = await postServerFn()\n    const get = await getServerFn()\n\n    return {\n      meta: serverFnMeta,\n      inner: {\n        get,\n        post,\n      },\n    }\n  },\n)\n\nexport const postServerFnCallingServerFn = createServerFn().handler(\n  async ({ serverFnMeta }) => {\n    const post = await postServerFn()\n    const get = await getServerFn()\n\n    return {\n      meta: serverFnMeta,\n      inner: {\n        get,\n        post,\n      },\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/function-metadata/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { getServerFn, postServerFn } from './-functions/normalServerFn'\nimport {\n  getServerFnCallingServerFn,\n  postServerFnCallingServerFn,\n} from './-functions/serverFnCallingServerFn'\n\nexport const Route = createFileRoute('/function-metadata/')({\n  component: RouteComponent,\n  loader: async () => {\n    const normalGet = await getServerFn()\n    const normalPost = await postServerFn()\n    const nestingGet = await getServerFnCallingServerFn()\n    const nestingPost = await postServerFnCallingServerFn()\n\n    return {\n      normalGet,\n      normalPost,\n      nestingGet,\n      nestingPost,\n    }\n  },\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 m-2 grid gap-2\" data-testid=\"metadata-route-component\">\n      <h1 class=\"font-bold text-lg\">Server functions metadata E2E tests</h1>\n      <br />\n      <div data-testid=\"loader-data\">\n        <h3>Loader Data (SSR)</h3>\n        <h4>Server Captured Metadata:</h4>\n        <div>\n          Function Metadata:{' '}\n          <span data-testid=\"loader-normal-get-function-metadata\">\n            {JSON.stringify(loaderData().normalGet)}\n          </span>\n        </div>\n        <div>\n          Function Metadata:{' '}\n          <span data-testid=\"loader-normal-post-function-metadata\">\n            {JSON.stringify(loaderData().normalPost)}\n          </span>\n        </div>\n        <div>\n          Function Metadata:{' '}\n          <span data-testid=\"loader-nesting-get-function-metadata\">\n            {JSON.stringify(loaderData().nestingGet)}\n          </span>\n        </div>\n        <div>\n          Function Metadata:{' '}\n          <span data-testid=\"loader-nesting-post-function-metadata\">\n            {JSON.stringify(loaderData().nestingPost)}\n          </span>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/function-method/-functions/serverFnCallingServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/solid-start'\n\nconst postServerFn = createServerFn({ method: 'POST' }).handler(\n  ({ method }) => {\n    return {\n      method,\n    }\n  },\n)\n\nconst getServerFn = createServerFn({ method: 'GET' }).handler(({ method }) => {\n  return {\n    method,\n  }\n})\n\nexport const getServerFnCallingPost = createServerFn({ method: 'GET' }).handler(\n  async ({ method }) => {\n    const innerFnResult = await postServerFn({})\n\n    return {\n      name: 'getServerFnCallingPost',\n      method,\n      innerFnResult,\n    }\n  },\n)\n\nexport const postServerFnCallingGet = createServerFn({\n  method: 'POST',\n}).handler(async ({ method }) => {\n  const innerFnResult = await getServerFn({})\n\n  return {\n    name: 'postServerFnCallingGet',\n    method,\n    innerFnResult,\n  }\n})\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/function-method/index.tsx",
    "content": "import { For, createSignal } from 'solid-js'\nimport { Link, createFileRoute, deepEqual } from '@tanstack/solid-router'\nimport {\n  getServerFnCallingPost,\n  postServerFnCallingGet,\n} from './-functions/serverFnCallingServerFn'\n\nexport const Route = createFileRoute('/function-method/')({\n  component: RouteComponent,\n})\n\nconst functions = {\n  getServerFnCallingPost: {\n    fn: getServerFnCallingPost,\n    expected: {\n      name: 'getServerFnCallingPost',\n      method: 'GET',\n      innerFnResult: {\n        method: 'POST',\n      },\n    },\n  },\n  postServerFnCallingGet: {\n    fn: postServerFnCallingGet,\n    expected: {\n      name: 'postServerFnCallingGet',\n      method: 'POST',\n      innerFnResult: {\n        method: 'GET',\n      },\n    },\n  },\n} satisfies Record<string, TestCase>\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 m-2 grid gap-2\" data-testid=\"method-route-component\">\n      <h1 class=\"font-bold text-lg\">Server functions methods E2E tests</h1>\n      <div>\n        <Link class=\"inline\" to=\"/factory\">\n          <h2>Go to Factory Functions and request method E2E test</h2>\n        </Link>\n      </div>\n      <For each={Object.entries(functions)}>\n        {([, testCase]) => <Test {...testCase} />}\n      </For>\n    </div>\n  )\n}\n\ninterface TestCase {\n  fn: () => Promise<any>\n  expected: any\n}\nfunction Test({ fn, expected }: TestCase) {\n  const [result, setResult] = createSignal<null | unknown>(null)\n  function comparison() {\n    if (result()) {\n      const isEqual = deepEqual(result(), expected)\n      return isEqual ? 'equal' : 'not equal'\n    }\n    return 'Loading...'\n  }\n\n  return (\n    <div\n      data-testid={`test-${expected.name}`}\n      class=\"p-2 border border-gray-200 rounded-md\"\n    >\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid={`expected-fn-result-${expected.name}`}>\n            {JSON.stringify(expected)}\n          </pre>\n        </code>\n      </div>\n      <p>\n        fn returns:\n        <br />\n        <span data-testid={`fn-result-${expected.name}`}>\n          {result() ? JSON.stringify(result()) : 'Loading...'}\n        </span>{' '}\n        <span data-testid={`fn-comparison-${expected.name}`}>\n          {comparison()}\n        </span>\n      </p>\n      <button\n        data-testid={`btn-fn-${expected.name}`}\n        type=\"button\"\n        class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          fn().then(setResult)\n        }}\n      >\n        Invoke Server Function\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/headers.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { createServerFn } from '@tanstack/solid-start'\nimport {\n  getRequestHeaders,\n  setResponseHeader,\n} from '@tanstack/solid-start/server'\nimport type { RequestHeaderName } from '@tanstack/solid-start/server'\n\nexport const Route = createFileRoute('/headers')({\n  loader: async () => {\n    return {\n      testHeaders: await getTestHeaders(),\n    }\n  },\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    return <ResponseHeaders initialTestHeaders={loaderData().testHeaders} />\n  },\n})\n\nexport const getTestHeaders = createServerFn().handler(() => {\n  setResponseHeader('x-test-header', 'test-value')\n  const reqHeaders = Object.fromEntries(getRequestHeaders().entries())\n\n  return {\n    serverHeaders: reqHeaders,\n    headers: reqHeaders,\n  }\n})\n\ntype TestHeadersResult = {\n  headers?: Partial<Record<RequestHeaderName, string | undefined>>\n  serverHeaders?: Partial<Record<RequestHeaderName, string | undefined>>\n}\n\nfunction ResponseHeaders({\n  initialTestHeaders,\n}: {\n  initialTestHeaders: TestHeadersResult\n}) {\n  const [testHeadersResult, setTestHeadersResult] =\n    Solid.createSignal<TestHeadersResult | null>(null)\n\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Headers Test</h3>\n      <form\n        class=\"flex flex-col gap-2\"\n        data-testid=\"serialize-formdata-form\"\n        onSubmit={(evt) => {\n          evt.preventDefault()\n          getTestHeaders().then(setTestHeadersResult)\n        }}\n      >\n        <button\n          type=\"submit\"\n          data-testid=\"test-headers-btn\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Get Headers\n        </button>\n      </form>\n      <div class=\"overflow-y-auto\">\n        <h4>Initial Headers:</h4>\n        <pre data-testid=\"initial-headers-result\">\n          {JSON.stringify(initialTestHeaders.headers, null, 2)}\n        </pre>\n        {testHeadersResult() && (\n          <>\n            <h4>Updated Headers:</h4>\n            <pre data-testid=\"updated-headers-result\">\n              {JSON.stringify(testHeadersResult()?.headers, null, 2)}\n            </pre>\n          </>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server functions E2E tests</h1>\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Link to=\"/consistent\">\n            Consistent server function returns both on client and server for GET\n            and POST calls\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/multipart\">\n            submitting multipart/form-data as server function input\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/return-null\">\n            Server function can return null for GET and POST calls\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/serialize-form-data\">\n            Server function can correctly send and receive FormData\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/headers\">\n            server function can correctly send and receive headers\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/submit-post-formdata\">\n            Direct POST submitting FormData to a Server function returns the\n            correct message\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/status\">\n            invoking a server function with custom response status code\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/isomorphic-fns\">\n            isomorphic functions can have different implementations on client\n            and server\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/env-only\">\n            env-only functions can only be called on the server or client\n            respectively\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/cookies\">server function sets cookies</Link>\n        </li>\n        <li>\n          <Link to=\"/dead-code-preserve\">\n            dead code elimation only affects code after transformation\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/abort-signal\">aborting a server function call</Link>\n        </li>\n        <li>\n          <Link to=\"/raw-response\">server function returns raw response</Link>\n        </li>\n        <li>\n          <Link to=\"/function-method\">Server Functions method E2E tests</Link>\n        </li>\n        <li>\n          <Link to=\"/function-metadata\">\n            Server Functions metadata E2E tests\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/isomorphic-fns.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createIsomorphicFn, createServerFn } from '@tanstack/solid-start'\nimport { createSignal } from 'solid-js'\n\nconst getEnv = createIsomorphicFn()\n  .server(() => 'server')\n  .client(() => 'client')\n\nconst getServerEnv = createServerFn().handler(() => getEnv())\n\nconst getEcho = createIsomorphicFn()\n  .server((input: string) => 'server received ' + input)\n  .client((input) => 'client received ' + input)\n\nconst getServerEcho = createServerFn()\n  .inputValidator((input: string) => input)\n  .handler(({ data }) => getEcho(data))\n\nexport const Route = createFileRoute('/isomorphic-fns')({\n  component: RouteComponent,\n  loader() {\n    return {\n      envOnLoad: getEnv(),\n    }\n  },\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n  const [results, setResults] = createSignal<Partial<Record<string, string>>>()\n  async function handleClick() {\n    const envOnClick = getEnv()\n    const echo = getEcho('hello')\n    const [serverEnv, serverEcho] = await Promise.all([\n      getServerEnv(),\n      getServerEcho({ data: 'hello' }),\n    ])\n    setResults({ envOnClick, echo, serverEnv, serverEcho })\n  }\n\n  return (\n    <div>\n      <button onClick={handleClick} data-testid=\"test-isomorphic-results-btn\">\n        Run\n      </button>\n      {!!results() && (\n        <div>\n          <h1>\n            <code>getEnv</code>\n          </h1>\n          When we called the function on the server it returned:\n          <pre data-testid=\"server-result\">\n            {JSON.stringify(results()?.serverEnv)}\n          </pre>\n          When we called the function on the client it returned:\n          <pre data-testid=\"client-result\">\n            {JSON.stringify(results()?.envOnClick)}\n          </pre>\n          When we called the function during SSR it returned:\n          <pre data-testid=\"ssr-result\">\n            {JSON.stringify(loaderData().envOnLoad)}\n          </pre>\n          <br />\n          <h1>\n            <code>echo</code>\n          </h1>\n          When we called the function on the server it returned:\n          <pre data-testid=\"server-echo-result\">\n            {JSON.stringify(results()?.serverEcho)}\n          </pre>\n          When we called the function on the client it returned:\n          <pre data-testid=\"client-echo-result\">\n            {JSON.stringify(results()?.echo)}\n          </pre>\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/middleware/client-middleware-router.tsx",
    "content": "import { createFileRoute, useRouter } from '@tanstack/solid-router'\nimport {\n  createMiddleware,\n  createServerFn,\n  getRouterInstance,\n} from '@tanstack/solid-start'\nimport { createSignal } from 'solid-js'\n\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const router = await getRouterInstance()\n    return next({\n      sendContext: {\n        routerContext: router.options.context,\n      },\n    })\n  },\n)\n\nconst serverFn = createServerFn()\n  .middleware([middleware])\n  .handler(({ context }) => {\n    return context.routerContext\n  })\nexport const Route = createFileRoute('/middleware/client-middleware-router')({\n  component: RouteComponent,\n  loader: async () => ({ serverFnLoaderResult: await serverFn() }),\n})\n\nfunction RouteComponent() {\n  const [serverFnClientResult, setServerFnClientResult] = createSignal({})\n  const loaderData = Route.useLoaderData()\n\n  const router = useRouter()\n  return (\n    <div\n      class=\"p-2 m-2 grid gap-2\"\n      data-testid=\"client-middleware-router-route-component\"\n    >\n      <h3>Client Middleware has access to router instance</h3>\n      <p>\n        This component checks that the client middleware has access to the\n        router instance and thus its context.\n      </p>\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-server-fn-result\">\n            {JSON.stringify(router.options.context)}\n          </pre>\n        </code>\n      </div>\n      <p>\n        serverFn when invoked in the loader returns:\n        <br />\n        <span data-testid=\"serverFn-loader-result\">\n          {JSON.stringify(serverFnClientResult())}\n        </span>\n      </p>\n      <p>\n        serverFn when invoked on the client returns:\n        <br />\n        <span data-testid=\"serverFn-client-result\">\n          {JSON.stringify(loaderData().serverFnLoaderResult)}\n        </span>\n      </p>\n      <button\n        data-testid=\"btn-serverFn\"\n        type=\"button\"\n        class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          serverFn().then(setServerFnClientResult)\n        }}\n      >\n        Invoke Server Function\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/middleware/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/middleware/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server functions middleware E2E tests</h1>\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Route.Link\n            to=\"./client-middleware-router\"\n            data-testid=\"client-middleware-router-link\"\n          >\n            Client Middleware has access to router instance\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link to=\"./send-serverFn\" data-testid=\"send-serverFn-link\">\n            Client Middleware can send server function reference in context\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link\n            to=\"./request-middleware\"\n            data-testid=\"request-middleware-link\"\n            reloadDocument={true}\n          >\n            Request Middleware in combination with server function\n          </Route.Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/middleware/request-middleware.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createMiddleware, createServerFn } from '@tanstack/solid-start'\nimport { getRequest } from '@tanstack/solid-start/server'\nimport { createSignal, Show } from 'solid-js'\n\nconst requestMiddleware = createMiddleware({ type: 'request' }).server(\n  async ({ next, request }) => {\n    return next({\n      context: {\n        requestParam: request.url,\n        requestFunc: getRequest().url,\n      },\n    })\n  },\n)\n\nconst serverFn = createServerFn()\n  .middleware([requestMiddleware])\n  .handler(async ({ context: { requestParam, requestFunc } }) => {\n    return { requestParam, requestFunc }\n  })\n\nexport const Route = createFileRoute('/middleware/request-middleware')({\n  loader: () => serverFn(),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n\n  const [clientData, setClientData] = createSignal<ReturnType<\n    typeof loaderData\n  > | null>(null)\n\n  return (\n    <div>\n      <h2>Request Middleware in combination with server function</h2>\n      <br />\n      <div>\n        <div data-testid=\"loader-data\">\n          <h3>Loader Data</h3>Request Param:\n          <div data-testid=\"loader-data-request-param\">\n            {loaderData().requestParam}\n          </div>\n          Request Func:\n          <div data-testid=\"loader-data-request-func\">\n            {loaderData().requestFunc}\n          </div>\n        </div>\n        <br />\n        <div data-testid=\"client-call\">\n          <button\n            data-testid=\"client-call-button\"\n            onClick={async () => {\n              const data = await serverFn()\n              setClientData(data)\n            }}\n          >\n            Call server function from client\n          </button>\n        </div>\n        <br />\n        <div data-testid=\"client-data-container\">\n          <h3>Client Data</h3>\n          <Show when={clientData()} fallback=\" Loading ...\">\n            {(data) => (\n              <div data-testid=\"client-data\">\n                Request Param:\n                <div data-testid=\"client-data-request-param\">\n                  {data().requestParam}\n                </div>\n                Request Func:\n                <div data-testid=\"client-data-request-func\">\n                  {data().requestFunc}\n                </div>\n              </div>\n            )}\n          </Show>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/middleware/send-serverFn.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createMiddleware, createServerFn } from '@tanstack/solid-start'\nimport { createSignal } from 'solid-js'\n\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    return next({\n      sendContext: {\n        serverFn: barFn,\n      },\n    })\n  },\n)\n\nconst fooFn = createServerFn()\n  .middleware([middleware])\n  .handler(({ context }) => {\n    return context.serverFn()\n  })\nconst barFn = createServerFn().handler(() => {\n  return 'bar'\n})\n\nexport const Route = createFileRoute('/middleware/send-serverFn')({\n  component: RouteComponent,\n  loader: async () => ({ serverFnLoaderResult: await fooFn() }),\n})\n\nfunction RouteComponent() {\n  const [serverFnClientResult, setServerFnClientResult] = createSignal({})\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div\n      class=\"p-2 m-2 grid gap-2\"\n      data-testid=\"client-middleware-router-route-component\"\n    >\n      <h3>Send server function in context</h3>\n      <p>\n        This component checks that the client middleware can send a reference to\n        a server function in the context, which can then be invoked in the\n        server function handler.\n      </p>\n      <div>\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-server-fn-result\">\n            {JSON.stringify('bar')}\n          </pre>\n        </code>\n      </div>\n      <p>\n        serverFn when invoked in the loader returns:\n        <br />\n        <span data-testid=\"serverFn-loader-result\">\n          {JSON.stringify(serverFnClientResult())}\n        </span>\n      </p>\n      <p>\n        serverFn when invoked on the client returns:\n        <br />\n        <span data-testid=\"serverFn-client-result\">\n          {JSON.stringify(loaderData().serverFnLoaderResult)}\n        </span>\n      </p>\n      <button\n        data-testid=\"btn-serverFn\"\n        type=\"button\"\n        class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          fooFn().then(setServerFnClientResult)\n        }}\n      >\n        Invoke Server Function\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/multipart.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport const Route = createFileRoute('/multipart')({\n  component: MultipartServerFnCall,\n})\n\nconst multipartFormDataServerFn = createServerFn({ method: 'POST' })\n  .inputValidator((x: unknown) => {\n    if (!(x instanceof FormData)) {\n      throw new Error('Invalid form data')\n    }\n\n    const value = x.get('input_field')\n    const file = x.get('input_file')\n\n    if (typeof value !== 'string') {\n      throw new Error('Submitted value is not a string')\n    }\n\n    if (!(file instanceof File)) {\n      throw new Error('File is required')\n    }\n\n    return {\n      submittedValue: value,\n      file,\n    }\n  })\n  .handler(async ({ data }) => {\n    const contents = await data.file.text()\n    return {\n      value: data.submittedValue,\n      file: {\n        name: data.file.name,\n        size: data.file.size,\n        contents: contents,\n      },\n    }\n  })\n\nfunction MultipartServerFnCall() {\n  let formRef: HTMLFormElement | undefined\n  const [multipartResult, setMultipartResult] = Solid.createSignal({})\n\n  const handleSubmit = (e: any) => {\n    e.preventDefault()\n\n    if (!formRef) {\n      return\n    }\n\n    const formData = new FormData(formRef)\n    multipartFormDataServerFn({ data: formData }).then(setMultipartResult)\n  }\n\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Multipart Server Fn POST Call</h3>\n      <div class=\"overflow-y-auto\">\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-multipart-server-fn-result\">\n            {JSON.stringify({\n              value: 'test field value',\n              file: { name: 'my_file.txt', size: 9, contents: 'test data' },\n            })}\n          </pre>\n        </code>\n      </div>\n      <form\n        class=\"flex flex-col gap-2\"\n        action={multipartFormDataServerFn.url}\n        method=\"post\"\n        enctype=\"multipart/form-data\"\n        ref={formRef}\n        data-testid=\"multipart-form\"\n      >\n        <input type=\"text\" name=\"input_field\" value=\"test field value\" />\n        <input\n          type=\"file\"\n          name=\"input_file\"\n          data-testid=\"multipart-form-file-input\"\n        />\n        <button\n          type=\"submit\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit (native)\n        </button>\n        <button\n          type=\"button\"\n          onClick={handleSubmit}\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit (onClick)\n        </button>\n      </form>\n      <div class=\"overflow-y-auto\">\n        <pre data-testid=\"multipart-form-response\">\n          {JSON.stringify(multipartResult())}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/primitives/index.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { For, Show } from 'solid-js'\nimport { z } from 'zod'\nexport const Route = createFileRoute('/primitives/')({\n  component: RouteComponent,\n  ssr: true,\n})\n\nfunction stringify(data: any) {\n  return JSON.stringify(data === undefined ? '$undefined' : data)\n}\n\nconst $stringPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.string())\n  .handler((ctx) => ctx.data)\n\nconst $stringGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.string())\n  .handler((ctx) => ctx.data)\n\nconst $undefinedPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.undefined())\n  .handler((ctx) => ctx.data)\n\nconst $undefinedGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.undefined())\n  .handler((ctx) => ctx.data)\n\nconst $nullPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.null())\n  .handler((ctx) => ctx.data)\n\nconst $nullGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.null())\n  .handler((ctx) => ctx.data)\n\ninterface PrimitiveComponentProps<T> {\n  serverFn: {\n    get: (opts: { data: T }) => Promise<T>\n    post: (opts: { data: T }) => Promise<T>\n  }\n  data: {\n    value: T\n    type: string\n  }\n}\n\ninterface TestProps<T> extends PrimitiveComponentProps<T> {\n  method: 'get' | 'post'\n}\nfunction Test<T>(props: TestProps<T>) {\n  const query = useQuery(() => ({\n    queryKey: [props.data.type, props.method],\n    queryFn: async () => {\n      const result = await props.serverFn[props.method]({\n        data: props.data.value,\n      })\n      if (result === undefined) {\n        return '$undefined'\n      }\n      return result\n    },\n  }))\n  const testId = `${props.method}-${props.data.type}`\n  return (\n    <div>\n      <h3>serverFn method={props.method}</h3>\n      <h4> expected </h4>\n      <div data-testid={`expected-${testId}`}>\n        {stringify(props.data.value)}\n      </div>\n      <h4> result</h4>\n      <Show when={query.isSuccess}>\n        <div data-testid={`result-${testId}`}>{stringify(query.data)}</div>\n      </Show>\n    </div>\n  )\n}\nfunction PrimitiveComponent<T>(props: PrimitiveComponentProps<T>) {\n  return (\n    <div>\n      <h2>data type: {props.data.type}</h2>\n      <Test {...props} method=\"post\" />\n      <br />\n      <Test {...props} method=\"get\" />\n      <br />\n      <br />\n    </div>\n  )\n}\n\nfunction makeTestCase<T>(props: PrimitiveComponentProps<T>) {\n  return props\n}\nconst testCases = [\n  makeTestCase({\n    data: {\n      value: null,\n      type: 'null',\n    },\n    serverFn: {\n      get: $nullGet,\n      post: $nullPost,\n    },\n  }),\n  makeTestCase({\n    data: {\n      value: undefined,\n      type: 'undefined',\n    },\n    serverFn: {\n      get: $undefinedGet,\n      post: $undefinedPost,\n    },\n  }),\n  makeTestCase({\n    data: {\n      value: 'foo-bar',\n      type: 'string',\n    },\n    serverFn: {\n      get: $stringGet,\n      post: $stringPost,\n    },\n  }),\n] as Array<PrimitiveComponentProps<any>>\n\nfunction RouteComponent() {\n  return <For each={testCases}>{(t) => <PrimitiveComponent {...t} />}</For>\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/raw-response.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\n\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport const Route = createFileRoute('/raw-response')({\n  component: RouteComponent,\n})\n\nconst expectedValue = 'Hello from a server function!'\nexport const rawResponseFn = createServerFn().handler(() => {\n  return new Response(expectedValue)\n})\n\nfunction RouteComponent() {\n  const [formDataResult, setFormDataResult] = Solid.createSignal({})\n\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Raw Response</h3>\n      <div class=\"overflow-y-auto\">\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected\">{expectedValue}</pre>\n        </code>\n      </div>\n\n      <button\n        onClick={async () => {\n          const response = await rawResponseFn()\n          console.log('response', response)\n\n          const text = await response.text()\n          setFormDataResult(text)\n        }}\n        data-testid=\"button\"\n        class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n      >\n        Submit\n      </button>\n\n      <div class=\"overflow-y-auto\">\n        <pre data-testid=\"response\">{JSON.stringify(formDataResult())}</pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/redirect-test/index.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn, useServerFn } from '@tanstack/solid-start'\nimport { Suspense } from 'solid-js'\n\nconst $redirectServerFn = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    throw redirect({ to: '/redirect-test/target' })\n  },\n)\n\nexport const Route = createFileRoute('/redirect-test/')({\n  component: RouteComponent,\n  ssr: 'data-only',\n})\n\nfunction RouteComponent() {\n  const redirectFn = useServerFn($redirectServerFn)\n  const query = useQuery(() => ({\n    queryKey: ['redirect-test'],\n    queryFn: () => redirectFn(),\n  }))\n\n  return (\n    <div>\n      <h1 data-testid=\"redirect-source\">Redirect Source</h1>\n      <Suspense>\n        <div>{JSON.stringify(query.data)}</div>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/redirect-test/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect-test/target')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h1 data-testid=\"redirect-target\">Redirect Target</h1>\n      <p>Successfully redirected!</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/redirect-test-ssr/index.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn, useServerFn } from '@tanstack/solid-start'\nimport { Suspense } from 'solid-js'\n\nconst $redirectServerFn = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    throw redirect({ to: '/redirect-test-ssr/target' })\n  },\n)\n\nexport const Route = createFileRoute('/redirect-test-ssr/')({\n  component: RouteComponent,\n  ssr: true,\n})\n\nfunction RouteComponent() {\n  const redirectFn = useServerFn($redirectServerFn)\n  const query = useQuery(() => ({\n    queryKey: ['redirect-test-ssr'],\n    queryFn: () => redirectFn(),\n  }))\n\n  return (\n    <div>\n      <h1 data-testid=\"redirect-source-ssr\">Redirect Source SSR</h1>\n      <Suspense>\n        <div>{JSON.stringify(query.data)}</div>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/redirect-test-ssr/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect-test-ssr/target')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h1 data-testid=\"redirect-target-ssr\">Redirect Target SSR</h1>\n      <p>Successfully redirected!</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/return-null.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport * as Solid from 'solid-js'\n\n/**\n * This checks whether the server function can\n * return null without throwing an error or returning something else.\n * @link https://github.com/TanStack/router/issues/2776\n */\n\nexport const Route = createFileRoute('/return-null')({\n  component: AllowServerFnReturnNull,\n})\n\nconst $allow_return_null_getFn = createServerFn().handler(async () => {\n  return null\n})\nconst $allow_return_null_postFn = createServerFn({ method: 'POST' }).handler(\n  async () => {\n    return null\n  },\n)\n\nfunction AllowServerFnReturnNull() {\n  const [getServerResult, setGetServerResult] = Solid.createSignal<any>('-')\n  const [postServerResult, setPostServerResult] = Solid.createSignal<any>('-')\n\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Allow ServerFn to return `null`</h3>\n      <p>\n        This component checks whether the server function can return null\n        without throwing an error.\n      </p>\n      <div>\n        It should return{' '}\n        <code>\n          <pre>{JSON.stringify(null)}</pre>\n        </code>\n      </div>\n      <p>\n        {`GET: $allow_return_null_getFn returns`}\n        <br />\n        <span data-testid=\"allow_return_null_getFn-response\">\n          {JSON.stringify(getServerResult())}\n        </span>\n      </p>\n      <p>\n        {`POST: $allow_return_null_postFn returns`}\n        <br />\n        <span data-testid=\"allow_return_null_postFn-response\">\n          {JSON.stringify(postServerResult())}\n        </span>\n      </p>\n      <button\n        data-testid=\"test-allow-server-fn-return-null-btn\"\n        type=\"button\"\n        class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        onClick={() => {\n          $allow_return_null_getFn().then(setGetServerResult)\n          $allow_return_null_postFn().then(setPostServerResult)\n        }}\n      >\n        Test Allow Server Fn Return Null\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/serialize-form-data.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\n\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst testValues = {\n  name: 'Sean',\n  age: 25,\n  pet1: 'dog',\n  pet2: 'cat',\n  __adder: 1,\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n    const age = data.get('age')\n    const pets = data.getAll('pet')\n\n    if (!name || !age || pets.length === 0) {\n      throw new Error('Name, age and pets are required')\n    }\n\n    return {\n      name: name.toString(),\n      age: parseInt(age.toString(), 10),\n      pets: pets.map((pet) => pet.toString()),\n    }\n  })\n  .handler(({ data: { name, age, pets } }) => {\n    return `Hello, ${name}! You are ${age + testValues.__adder} years old, and your favorite pets are ${pets.join(',')}.`\n  })\n\nexport function SerializeFormDataFnCall() {\n  const [formDataResult, setFormDataResult] = Solid.createSignal({})\n\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Serialize FormData Fn POST Call</h3>\n      <div class=\"overflow-y-auto\">\n        It should return{' '}\n        <code>\n          <pre data-testid=\"expected-serialize-formdata-server-fn-result\">\n            Hello, {testValues.name}! You are{' '}\n            {testValues.age + testValues.__adder} years old, and your favorite{' '}\n            pets are {testValues.pet1},{testValues.pet2}.\n          </pre>\n        </code>\n      </div>\n      <form\n        class=\"flex flex-col gap-2\"\n        data-testid=\"serialize-formdata-form\"\n        onSubmit={(evt) => {\n          evt.preventDefault()\n          const data = new FormData(evt.currentTarget)\n          greetUser({ data }).then(setFormDataResult)\n        }}\n      >\n        <input type=\"text\" name=\"name\" value={testValues.name} />\n        <input type=\"number\" name=\"age\" value={testValues.age} />\n        <input type=\"text\" name=\"pet\" value={testValues.pet1} />\n        <input type=\"text\" name=\"pet\" value={testValues.pet2} />\n        <button\n          type=\"submit\"\n          data-testid=\"test-serialize-formdata-fn-calls-btn\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit\n        </button>\n      </form>\n      <div class=\"overflow-y-auto\">\n        <pre data-testid=\"serialize-formdata-form-response\">\n          {JSON.stringify(formDataResult())}\n        </pre>\n      </div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/serialize-form-data')({\n  component: SerializeFormDataFnCall,\n})\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/status.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn, useServerFn } from '@tanstack/solid-start'\nimport { setResponseStatus } from '@tanstack/solid-start/server'\n\nconst helloFn = createServerFn().handler(() => {\n  setResponseStatus(225, `hello`)\n  return {\n    hello: 'world',\n  }\n})\n\nexport const Route = createFileRoute('/status')({\n  component: StatusComponent,\n})\n\nfunction StatusComponent() {\n  const hello = useServerFn(helloFn)\n\n  return (\n    <div class=\"p-2\">\n      <button\n        data-testid=\"invoke-server-fn\"\n        class=\"px-4 py-2 bg-blue-500 text-white rounded-md\"\n        onClick={() => hello()}\n      >\n        click me\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/routes/submit-post-formdata.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport const Route = createFileRoute('/submit-post-formdata')({\n  component: SubmitPostFormDataFn,\n})\n\nconst testValues = {\n  name: 'Sean',\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n\n    if (!name) {\n      throw new Error('Name is required')\n    }\n\n    return {\n      name: name.toString(),\n    }\n  })\n  .handler(({ data: { name } }) => {\n    return new Response(`Hello, ${name}!`)\n  })\n\nfunction SubmitPostFormDataFn() {\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Submit POST FormData Fn Call</h3>\n      <div class=\"overflow-y-auto\">\n        It should return navigate and return{' '}\n        <code>\n          <pre data-testid=\"expected-submit-post-formdata-server-fn-result\">\n            Hello, {testValues.name}!\n          </pre>\n        </code>\n      </div>\n      <form\n        class=\"flex flex-col gap-2\"\n        data-testid=\"submit-post-formdata-form\"\n        method=\"post\"\n        action={greetUser.url}\n      >\n        <input type=\"text\" name=\"name\" value={testValues.name} />\n        <button\n          type=\"submit\"\n          data-testid=\"test-submit-post-formdata-fn-calls-btn\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit (native)\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/tests/server-functions.spec.ts",
    "content": "import * as fs from 'node:fs'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { PORT } from '../playwright.config'\nimport type { Page } from '@playwright/test'\n\ntest('Server function URLs correctly include constant ids', async ({\n  page,\n}) => {\n  for (const currentPage of ['/submit-post-formdata', '/formdata-redirect']) {\n    await page.goto(currentPage)\n    await page.waitForLoadState('networkidle')\n\n    const form = page.locator('form')\n    const actionUrl = await form.getAttribute('action')\n\n    expect(actionUrl).toMatch(/^\\/_serverFn\\/constant_id/)\n  }\n})\n\ntest('invoking a server function with custom response status code', async ({\n  page,\n}) => {\n  await page.goto('/status')\n\n  await page.waitForLoadState('networkidle')\n\n  const requestPromise = new Promise<void>((resolve) => {\n    page.on('response', (response) => {\n      expect(response.status()).toBe(225)\n      expect(response.statusText()).toBe('hello')\n      expect(response.headers()['content-type']).toContain('application/json')\n      resolve()\n    })\n  })\n  await page.getByTestId('invoke-server-fn').click()\n  await requestPromise\n})\n\ntest('Consistent server function returns both on client and server for GET and POST calls', async ({\n  page,\n}) => {\n  await page.goto('/consistent')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-consistent-server-fns-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-consistent-server-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  // GET calls\n  await expect(page.getByTestId('cons_serverGetFn1-response')).toContainText(\n    expected,\n  )\n  await expect(page.getByTestId('cons_getFn1-response')).toContainText(expected)\n\n  // POST calls\n  await expect(page.getByTestId('cons_serverPostFn1-response')).toContainText(\n    expected,\n  )\n  await expect(page.getByTestId('cons_postFn1-response')).toContainText(\n    expected,\n  )\n})\n\ntest('submitting multipart/form-data as server function input', async ({\n  page,\n}) => {\n  await page.goto('/multipart')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-multipart-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  const fileChooserPromise = page.waitForEvent('filechooser')\n  await page.getByTestId('multipart-form-file-input').click()\n  const fileChooser = await fileChooserPromise\n  await fileChooser.setFiles({\n    name: 'my_file.txt',\n    mimeType: 'text/plain',\n    buffer: Buffer.from('test data', 'utf-8'),\n  })\n  await page.getByText('Submit (onClick)').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('multipart-form-response')).toContainText(\n    expected,\n  )\n})\n\ntest('isomorphic functions can have different implementations on client and server', async ({\n  page,\n}) => {\n  await page.goto('/isomorphic-fns')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-isomorphic-results-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('server-result')).toContainText('server')\n  await expect(page.getByTestId('client-result')).toContainText('client')\n  await expect(page.getByTestId('ssr-result')).toContainText('server')\n\n  await expect(page.getByTestId('server-echo-result')).toContainText(\n    'server received hello',\n  )\n  await expect(page.getByTestId('client-echo-result')).toContainText(\n    'client received hello',\n  )\n})\n\ntest('env-only functions can only be called on the server or client respectively', async ({\n  page,\n}) => {\n  await page.goto('/env-only')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-env-only-results-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('server-on-server')).toContainText(\n    'server got: hello',\n  )\n  await expect(page.getByTestId('server-on-client')).toContainText(\n    'serverEcho threw an error: createServerOnlyFn() functions can only be called on the server!',\n  )\n\n  await expect(page.getByTestId('client-on-server')).toContainText(\n    'clientEcho threw an error: createClientOnlyFn() functions can only be called on the client!',\n  )\n  await expect(page.getByTestId('client-on-client')).toContainText(\n    'client got: hello',\n  )\n})\n\ntest('Server function can return null for GET and POST calls', async ({\n  page,\n}) => {\n  await page.goto('/return-null')\n\n  await page.waitForLoadState('networkidle')\n  await page.getByTestId('test-allow-server-fn-return-null-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  // GET call\n  await expect(\n    page.getByTestId('allow_return_null_getFn-response'),\n  ).toContainText(JSON.stringify(null))\n\n  // POST call\n  await expect(\n    page.getByTestId('allow_return_null_postFn-response'),\n  ).toContainText(JSON.stringify(null))\n})\n\ntest('Server function can correctly send and receive FormData', async ({\n  page,\n}) => {\n  await page.goto('/serialize-form-data')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-serialize-formdata-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-serialize-formdata-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(\n    page.getByTestId('serialize-formdata-form-response'),\n  ).toContainText(expected)\n})\n\ntest('server function can correctly send and receive headers', async ({\n  page,\n}) => {\n  await page.goto('/headers')\n\n  await page.waitForLoadState('networkidle')\n  let headers = JSON.parse(\n    await page.getByTestId('initial-headers-result').innerText(),\n  )\n  expect(headers['host']).toBe(`localhost:${PORT}`)\n  expect(headers['user-agent']).toContain('Mozilla/5.0')\n  expect(headers['sec-fetch-mode']).toBe('navigate')\n\n  await page.getByTestId('test-headers-btn').click()\n  await page.waitForSelector('[data-testid=\"updated-headers-result\"]')\n\n  headers = JSON.parse(\n    await page.getByTestId('updated-headers-result').innerText(),\n  )\n\n  expect(headers['host']).toBe(`localhost:${PORT}`)\n  expect(headers['user-agent']).toContain('Mozilla/5.0')\n  expect(headers['sec-fetch-mode']).toBe('cors')\n  expect(headers['referer']).toBe(`http://localhost:${PORT}/headers`)\n})\n\ntest('Direct POST submitting FormData to a Server function returns the correct message', async ({\n  page,\n}) => {\n  await page.goto('/submit-post-formdata')\n\n  await page.waitForLoadState('networkidle')\n\n  const expected =\n    (await page\n      .getByTestId('expected-submit-post-formdata-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  const result = await page.innerText('body')\n  expect(result).toBe(expected)\n})\n\ntest(\"server function's dead code is preserved if already there\", async ({\n  page,\n}) => {\n  await page.goto('/dead-code-preserve')\n\n  await page.waitForLoadState('networkidle')\n  await page.getByTestId('test-dead-code-fn-call-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('dead-code-fn-call-response')).toContainText(\n    '1',\n  )\n\n  await fs.promises.rm('count-effect.txt')\n})\n\ntest.describe('server function sets cookies', () => {\n  async function runCookieTest(page: Page, expectedCookieValue: string) {\n    for (let i = 1; i <= 4; i++) {\n      const key = `cookie-${i}-${expectedCookieValue}`\n\n      const actualValue = await page.getByTestId(key).textContent()\n      expect(actualValue).toBe(expectedCookieValue)\n    }\n  }\n  test('SSR', async ({ page }) => {\n    const expectedCookieValue = `SSR-${Date.now()}`\n    await page.goto(`/cookies/set?value=${expectedCookieValue}`)\n    await runCookieTest(page, expectedCookieValue)\n  })\n\n  test('client side navigation', async ({ page }) => {\n    const expectedCookieValue = `CLIENT-${Date.now()}`\n    await page.goto(`/cookies?value=${expectedCookieValue}`)\n    await page.getByTestId('link-to-set').click()\n    await runCookieTest(page, expectedCookieValue)\n  })\n})\n;['GET', 'POST'].forEach((method) => {\n  test.describe(`aborting a server function call: method ${method}`, () => {\n    test('without aborting', async ({ page }) => {\n      await page.goto('/abort-signal/' + method)\n\n      await page.waitForLoadState('networkidle')\n\n      await page.getByTestId('run-without-abort-btn').click()\n      await page.waitForLoadState('networkidle')\n      await page.waitForSelector(\n        '[data-testid=\"result\"]:has-text(\"server function result\")',\n      )\n      await page.waitForSelector(\n        '[data-testid=\"errorMessage\"]:has-text(\"$undefined\")',\n      )\n\n      const result = (await page.getByTestId('result').textContent()) || ''\n      expect(result).toBe('server function result')\n\n      const errorMessage =\n        (await page.getByTestId('errorMessage').textContent()) || ''\n      expect(errorMessage).toBe('$undefined')\n    })\n\n    test('aborting', async ({ page }) => {\n      await page.goto('/abort-signal/' + method)\n      await page.waitForLoadState('networkidle')\n\n      await page.getByTestId('run-with-abort-btn').click()\n      await page.waitForLoadState('networkidle')\n      await page.waitForSelector(\n        '[data-testid=\"result\"]:has-text(\"$undefined\")',\n      )\n      await page.waitForSelector(\n        '[data-testid=\"errorMessage\"]:has-text(\"aborted\")',\n      )\n\n      const result = (await page.getByTestId('result').textContent()) || ''\n      expect(result).toBe('$undefined')\n\n      const errorMessage =\n        (await page.getByTestId('errorMessage').textContent()) || ''\n      expect(errorMessage).toContain('abort')\n    })\n  })\n})\n\ntest('raw response', async ({ page }) => {\n  await page.goto('/raw-response')\n\n  await page.waitForLoadState('networkidle')\n\n  const expectedValue = (await page.getByTestId('expected').textContent()) || ''\n  expect(expectedValue).not.toBe('')\n\n  await page.getByTestId('button').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('response')).toContainText(expectedValue)\n})\n\ntest.describe('formdata redirect modes', () => {\n  for (const mode of ['js', 'no-js']) {\n    test(`Server function can redirect when sending formdata: mode = ${mode}`, async ({\n      page,\n    }) => {\n      await page.goto('/formdata-redirect?mode=' + mode)\n\n      await page.waitForLoadState('networkidle')\n      const expected =\n        (await page\n          .getByTestId('expected-submit-post-formdata-server-fn-result')\n          .textContent()) || ''\n      expect(expected).not.toBe('')\n\n      await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()\n\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('formdata-redirect-target-name'),\n      ).toContainText(expected)\n\n      expect(page.url().endsWith(`/formdata-redirect/target/${expected}`))\n    })\n  }\n})\n\ntest.describe('middleware', () => {\n  test.describe('client middleware should have access to router context via the router instance', () => {\n    async function runTest(page: Page) {\n      await page.waitForLoadState('networkidle')\n\n      const expected =\n        (await page.getByTestId('expected-server-fn-result').textContent()) ||\n        ''\n      expect(expected).not.toBe('')\n\n      await page.getByTestId('btn-serverFn').click()\n      await page.waitForLoadState('networkidle')\n      await expect(page.getByTestId('serverFn-loader-result')).toContainText(\n        expected,\n      )\n      await expect(page.getByTestId('serverFn-client-result')).toContainText(\n        expected,\n      )\n    }\n\n    test('direct visit', async ({ page }) => {\n      await page.goto('/middleware/client-middleware-router')\n      await runTest(page)\n    })\n\n    test('client navigation', async ({ page }) => {\n      await page.goto('/middleware')\n      await page.getByTestId('client-middleware-router-link').click()\n      await runTest(page)\n    })\n  })\n\n  test('server function in combination with request middleware', async ({\n    page,\n  }) => {\n    await page.goto('/middleware/request-middleware')\n\n    await page.waitForLoadState('networkidle')\n\n    async function checkEqual(prefix: string) {\n      const requestParam = await page\n        .getByTestId(`${prefix}-data-request-param`)\n        .textContent()\n      expect(requestParam).not.toBe('')\n      const requestFunc = await page\n        .getByTestId(`${prefix}-data-request-func`)\n        .textContent()\n      expect(requestParam).toBe(requestFunc)\n    }\n\n    await checkEqual('loader')\n\n    await page.getByTestId('client-call-button').click()\n    await page.waitForLoadState('networkidle')\n\n    await checkEqual('client')\n  })\n})\n\ntest('factory', async ({ page }) => {\n  await page.goto('/factory')\n\n  await expect(page.getByTestId('factory-route-component')).toBeInViewport()\n\n  const buttons = await page\n    .locator('[data-testid^=\"btn-fn-\"]')\n    .elementHandles()\n  for (const button of buttons) {\n    const testId = await button.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('Button is missing data-testid')\n    }\n\n    const suffix = testId.replace('btn-fn-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-fn-result-${suffix}`).textContent()) ||\n      ''\n    expect(expected).not.toBe('')\n\n    await button.click()\n\n    await expect(page.getByTestId(`fn-result-${suffix}`)).toContainText(\n      expected,\n    )\n\n    await expect(page.getByTestId(`fn-comparison-${suffix}`)).toContainText(\n      'equal',\n    )\n  }\n})\n\ntest('primitives', async ({ page }) => {\n  await page.goto('/primitives')\n\n  await page.waitForLoadState('networkidle')\n\n  // Wait for client-side hydration to complete\n  await expect(page.locator('[data-testid^=\"expected-\"]').first()).toBeVisible()\n\n  const testCases = await page\n    .locator('[data-testid^=\"expected-\"]')\n    .elementHandles()\n  expect(testCases.length).not.toBe(0)\n\n  for (const testCase of testCases) {\n    const testId = await testCase.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('testcase is missing data-testid')\n    }\n\n    const suffix = testId.replace('expected-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-${suffix}`).textContent()) || ''\n    expect(expected).not.toBe('')\n\n    await expect(page.getByTestId(`result-${suffix}`)).toContainText(expected)\n  }\n})\n\ntest('redirect in server function on direct navigation', async ({ page }) => {\n  // Test direct navigation to a route with a server function that redirects\n  await page.goto('/redirect-test')\n\n  // Should redirect to target page\n  await expect(page.getByTestId('redirect-target')).toBeVisible()\n  expect(page.url()).toContain('/redirect-test/target')\n})\n\ntest('redirect in server function called in query during SSR', async ({\n  page,\n}) => {\n  // Test direct navigation to a route with a server function that redirects\n  // when called inside a query with ssr: true\n  await page.goto('/redirect-test-ssr')\n\n  // Should redirect to target page\n  await expect(page.getByTestId('redirect-target-ssr')).toBeVisible()\n  expect(page.url()).toContain('/redirect-test-ssr/target')\n})\n\ntest('server function is called with correct method option', async ({\n  page,\n}) => {\n  await page.goto('/function-method', { waitUntil: 'networkidle' })\n\n  await expect(page.getByTestId('method-route-component')).toBeInViewport()\n\n  const buttons = await page\n    .locator('[data-testid^=\"btn-fn-\"]')\n    .elementHandles()\n  for (const button of buttons) {\n    const testId = await button.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('Button is missing data-testid')\n    }\n\n    const suffix = testId.replace('btn-fn-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-fn-result-${suffix}`).textContent()) ||\n      ''\n    expect(expected).not.toBe('')\n\n    await button.click()\n\n    await expect(page.getByTestId(`fn-result-${suffix}`)).toContainText(\n      expected,\n    )\n\n    await expect(page.getByTestId(`fn-comparison-${suffix}`)).toContainText(\n      'equal',\n    )\n  }\n})\n\ntest('server function receives serverFnMeta in options', async ({ page }) => {\n  // This test verifies that:\n  // 1. Server functions receive `serverFnMeta` with full { id, name, filename }\n  // 2. No1 works even when the said server function is called from another server function\n\n  await page.goto('/function-metadata', { waitUntil: 'networkidle' })\n\n  await expect(page.getByTestId('metadata-route-component')).toBeInViewport()\n\n  // Test for no1\n  const loaderNormalGet = await page\n    .getByTestId('loader-normal-get-function-metadata')\n    .textContent()\n  const loaderNormalPost = await page\n    .getByTestId('loader-normal-post-function-metadata')\n    .textContent()\n\n  // stringified metadata should not be empty string\n  expect(loaderNormalGet).toBeTruthy()\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const normalGetMetadata = JSON.parse(loaderNormalGet!)\n  expect(normalGetMetadata).toHaveProperty('id')\n  expect(normalGetMetadata).toHaveProperty('name')\n  expect(normalGetMetadata).toHaveProperty('filename')\n  expect(typeof normalGetMetadata.id).toBe('string')\n  expect(normalGetMetadata.id.length).toBeGreaterThan(0)\n  expect(typeof normalGetMetadata.name).toBe('string')\n  expect(normalGetMetadata.name.length).toBeGreaterThan(0)\n  expect(typeof normalGetMetadata.filename).toBe('string')\n  expect(normalGetMetadata.filename.length).toBeGreaterThan(0)\n\n  // stringified metadata should not be empty string\n  expect(loaderNormalPost).toBeTruthy()\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const normalPostMetadata = JSON.parse(loaderNormalPost!)\n  expect(normalPostMetadata).toHaveProperty('id')\n  expect(normalPostMetadata).toHaveProperty('name')\n  expect(normalPostMetadata).toHaveProperty('filename')\n  expect(typeof normalPostMetadata.id).toBe('string')\n  expect(normalPostMetadata.id.length).toBeGreaterThan(0)\n  expect(typeof normalPostMetadata.name).toBe('string')\n  expect(normalPostMetadata.name.length).toBeGreaterThan(0)\n  expect(typeof normalPostMetadata.filename).toBe('string')\n  expect(normalPostMetadata.filename.length).toBeGreaterThan(0)\n\n  // Test for no2\n  const loaderNestingGet = await page\n    .getByTestId('loader-nesting-get-function-metadata')\n    .textContent()\n  const loaderNestingPost = await page\n    .getByTestId('loader-nesting-post-function-metadata')\n    .textContent()\n\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const nestingGetMetadata = JSON.parse(loaderNestingGet!)\n  expect(nestingGetMetadata).toHaveProperty('meta.id')\n  expect(nestingGetMetadata).toHaveProperty('meta.name')\n  expect(nestingGetMetadata).toHaveProperty('meta.filename')\n  expect(typeof nestingGetMetadata.meta.id).toBe('string')\n  expect(nestingGetMetadata.meta.id.length).toBeGreaterThan(0)\n  expect(typeof nestingGetMetadata.meta.name).toBe('string')\n  expect(nestingGetMetadata.meta.name.length).toBeGreaterThan(0)\n  expect(typeof nestingGetMetadata.meta.filename).toBe('string')\n  expect(nestingGetMetadata.meta.filename.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata).toHaveProperty('inner.get.id')\n  expect(nestingGetMetadata).toHaveProperty('inner.get.name')\n  expect(nestingGetMetadata).toHaveProperty('inner.get.filename')\n  expect(nestingGetMetadata.inner.get.id.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.get.name.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.get.filename.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata).toHaveProperty('inner.post.id')\n  expect(nestingGetMetadata).toHaveProperty('inner.post.name')\n  expect(nestingGetMetadata).toHaveProperty('inner.post.filename')\n  expect(nestingGetMetadata.inner.post.id.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.post.name.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.post.filename.length).toBeGreaterThan(0)\n\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const nestingPostMetadata = JSON.parse(loaderNestingPost!)\n  expect(nestingPostMetadata).toHaveProperty('meta.id')\n  expect(nestingPostMetadata).toHaveProperty('meta.name')\n  expect(nestingPostMetadata).toHaveProperty('meta.filename')\n  expect(typeof nestingPostMetadata.meta.id).toBe('string')\n  expect(nestingPostMetadata.meta.id.length).toBeGreaterThan(0)\n  expect(typeof nestingPostMetadata.meta.name).toBe('string')\n  expect(nestingPostMetadata.meta.name.length).toBeGreaterThan(0)\n  expect(typeof nestingPostMetadata.meta.filename).toBe('string')\n  expect(nestingPostMetadata.meta.filename.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata).toHaveProperty('inner.get.id')\n  expect(nestingPostMetadata).toHaveProperty('inner.get.name')\n  expect(nestingPostMetadata).toHaveProperty('inner.get.filename')\n  expect(nestingPostMetadata.inner.get.id.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.get.name.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.get.filename.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata).toHaveProperty('inner.post.id')\n  expect(nestingPostMetadata).toHaveProperty('inner.post.name')\n  expect(nestingPostMetadata).toHaveProperty('inner.post.filename')\n  expect(nestingPostMetadata.inner.post.id.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.post.name.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.post.filename.length).toBeGreaterThan(0)\n})\n"
  },
  {
    "path": "e2e/solid-start/server-functions/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-functions/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst FUNCTIONS_WITH_CONSTANT_ID = [\n  'src/routes/submit-post-formdata.tsx/greetUser_createServerFn_handler',\n  'src/routes/formdata-redirect/index.tsx/greetUser_createServerFn_handler',\n]\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      serverFns: {\n        generateFunctionId: (opts) => {\n          const id = `${opts.filename}/${opts.functionName}`\n          if (FUNCTIONS_WITH_CONSTANT_ID.includes(id)) return 'constant_id'\n          else return undefined\n        },\n      },\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/server-routes/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-start/server-routes/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/server-routes/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-server-routes\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"js-cookie\": \"^3.0.5\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nexport const PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as MergeMiddlewareContextRouteImport } from './routes/merge-middleware-context'\nimport { Route as MethodsRouteRouteImport } from './routes/methods/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as MethodsIndexRouteImport } from './routes/methods/index'\nimport { Route as MethodsOnlyAnyRouteImport } from './routes/methods/only-any'\nimport { Route as ApiOnlyAnyRouteImport } from './routes/api/only-any'\nimport { Route as ApiMiddlewareContextRouteImport } from './routes/api/middleware-context'\nimport { Route as ApiParamsFooRouteRouteImport } from './routes/api/params/$foo/route'\nimport { Route as ApiParamsFooBarRouteImport } from './routes/api/params/$foo/$bar'\n\nconst MergeMiddlewareContextRoute = MergeMiddlewareContextRouteImport.update({\n  id: '/merge-middleware-context',\n  path: '/merge-middleware-context',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MethodsRouteRoute = MethodsRouteRouteImport.update({\n  id: '/methods',\n  path: '/methods',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MethodsIndexRoute = MethodsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => MethodsRouteRoute,\n} as any)\nconst MethodsOnlyAnyRoute = MethodsOnlyAnyRouteImport.update({\n  id: '/only-any',\n  path: '/only-any',\n  getParentRoute: () => MethodsRouteRoute,\n} as any)\nconst ApiOnlyAnyRoute = ApiOnlyAnyRouteImport.update({\n  id: '/api/only-any',\n  path: '/api/only-any',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiMiddlewareContextRoute = ApiMiddlewareContextRouteImport.update({\n  id: '/api/middleware-context',\n  path: '/api/middleware-context',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiParamsFooRouteRoute = ApiParamsFooRouteRouteImport.update({\n  id: '/api/params/$foo',\n  path: '/api/params/$foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiParamsFooBarRoute = ApiParamsFooBarRouteImport.update({\n  id: '/$bar',\n  path: '/$bar',\n  getParentRoute: () => ApiParamsFooRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/methods': typeof MethodsRouteRouteWithChildren\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods/': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/methods': typeof MethodsRouteRouteWithChildren\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods/': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/methods'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods/'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  id:\n    | '__root__'\n    | '/'\n    | '/methods'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods/'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  MethodsRouteRoute: typeof MethodsRouteRouteWithChildren\n  MergeMiddlewareContextRoute: typeof MergeMiddlewareContextRoute\n  ApiMiddlewareContextRoute: typeof ApiMiddlewareContextRoute\n  ApiOnlyAnyRoute: typeof ApiOnlyAnyRoute\n  ApiParamsFooRouteRoute: typeof ApiParamsFooRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/merge-middleware-context': {\n      id: '/merge-middleware-context'\n      path: '/merge-middleware-context'\n      fullPath: '/merge-middleware-context'\n      preLoaderRoute: typeof MergeMiddlewareContextRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/methods': {\n      id: '/methods'\n      path: '/methods'\n      fullPath: '/methods'\n      preLoaderRoute: typeof MethodsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/methods/': {\n      id: '/methods/'\n      path: '/'\n      fullPath: '/methods/'\n      preLoaderRoute: typeof MethodsIndexRouteImport\n      parentRoute: typeof MethodsRouteRoute\n    }\n    '/methods/only-any': {\n      id: '/methods/only-any'\n      path: '/only-any'\n      fullPath: '/methods/only-any'\n      preLoaderRoute: typeof MethodsOnlyAnyRouteImport\n      parentRoute: typeof MethodsRouteRoute\n    }\n    '/api/only-any': {\n      id: '/api/only-any'\n      path: '/api/only-any'\n      fullPath: '/api/only-any'\n      preLoaderRoute: typeof ApiOnlyAnyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/middleware-context': {\n      id: '/api/middleware-context'\n      path: '/api/middleware-context'\n      fullPath: '/api/middleware-context'\n      preLoaderRoute: typeof ApiMiddlewareContextRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/params/$foo': {\n      id: '/api/params/$foo'\n      path: '/api/params/$foo'\n      fullPath: '/api/params/$foo'\n      preLoaderRoute: typeof ApiParamsFooRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/params/$foo/$bar': {\n      id: '/api/params/$foo/$bar'\n      path: '/$bar'\n      fullPath: '/api/params/$foo/$bar'\n      preLoaderRoute: typeof ApiParamsFooBarRouteImport\n      parentRoute: typeof ApiParamsFooRouteRoute\n    }\n  }\n}\n\ninterface MethodsRouteRouteChildren {\n  MethodsOnlyAnyRoute: typeof MethodsOnlyAnyRoute\n  MethodsIndexRoute: typeof MethodsIndexRoute\n}\n\nconst MethodsRouteRouteChildren: MethodsRouteRouteChildren = {\n  MethodsOnlyAnyRoute: MethodsOnlyAnyRoute,\n  MethodsIndexRoute: MethodsIndexRoute,\n}\n\nconst MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(\n  MethodsRouteRouteChildren,\n)\n\ninterface ApiParamsFooRouteRouteChildren {\n  ApiParamsFooBarRoute: typeof ApiParamsFooBarRoute\n}\n\nconst ApiParamsFooRouteRouteChildren: ApiParamsFooRouteRouteChildren = {\n  ApiParamsFooBarRoute: ApiParamsFooBarRoute,\n}\n\nconst ApiParamsFooRouteRouteWithChildren =\n  ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  MethodsRouteRoute: MethodsRouteRouteWithChildren,\n  MergeMiddlewareContextRoute: MergeMiddlewareContextRoute,\n  ApiMiddlewareContextRoute: ApiMiddlewareContextRoute,\n  ApiOnlyAnyRoute: ApiOnlyAnyRoute,\n  ApiParamsFooRouteRoute: ApiParamsFooRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query'\nimport { QueryClient } from '@tanstack/solid-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n  setupRouterSsrQueryIntegration({ router, queryClient })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\n\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  errorComponent: (props) => {\n    return <p>{props.error.stack}</p>\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <Outlet />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/api/middleware-context.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createMiddleware } from '@tanstack/solid-start'\n\nconst testParentMiddleware = createMiddleware().server(async ({ next }) => {\n  const result = await next({ context: { testParent: true } })\n  return result\n})\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next }) => {\n    const result = await next({ context: { test: true } })\n    return result\n  })\n\nexport const Route = createFileRoute('/api/middleware-context')({\n  server: {\n    middleware: [testMiddleware],\n    handlers: {\n      GET: ({ request, context }) => {\n        return Response.json({\n          url: request.url,\n          context: context,\n          expectedContext: { testParent: true, test: true },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/api/only-any.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/api/only-any')({\n  server: {\n    handlers: {\n      ANY: ({ request }) => {\n        return Response.json(\n          {\n            handler: 'ANY',\n            method: request.method,\n          },\n          { headers: { 'X-HANDLER': 'ANY', 'X-METHOD': request.method } },\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/api/params/$foo/$bar.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/api/params/$foo/$bar')({\n  server: {\n    handlers: {\n      GET: ({ params }) => {\n        return new Response('hello, ' + params.foo + ' and ' + params.bar)\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/api/params/$foo/route.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/api/params/$foo')({\n  server: {\n    handlers: {\n      GET: ({ params }) => {\n        return new Response('hello, ' + params.foo)\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server routes E2E tests</h1>\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Link to=\"/merge-middleware-context\">\n            server route middleware context is merged correctly\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/methods\">server route methods</Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/merge-middleware-context.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createSignal } from 'solid-js'\n\nexport const Route = createFileRoute('/merge-middleware-context')({\n  component: () => <MergeMiddlewareContext />,\n})\n\nfunction MergeMiddlewareContext() {\n  const [apiResponse, setApiResponse] = createSignal<any>(null)\n\n  const fetchMiddlewareContext = async () => {\n    try {\n      const response = await fetch('/api/middleware-context')\n      const data = await response.json()\n      setApiResponse(data)\n    } catch (error) {\n      console.error('Error fetching middleware context:', error)\n      setApiResponse({ error: 'Failed to fetch' })\n    }\n  }\n\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Merge Server Route Middleware Context Test</h3>\n      <div class=\"flex flex-col gap-2\">\n        <button\n          type=\"button\"\n          onClick={fetchMiddlewareContext}\n          data-testid=\"test-middleware-context-btn\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Test Middleware Context\n        </button>\n\n        {apiResponse() && (\n          <div class=\"mt-4\">\n            <h4>API Response:</h4>\n            <pre\n              data-testid=\"api-response\"\n              class=\"bg-gray-100 p-2 rounded-sm text-black\"\n            >\n              {JSON.stringify(apiResponse(), null, 2)}\n            </pre>\n\n            <div class=\"mt-4 grid gap-2\">\n              <h4>Context Verification:</h4>\n              <div\n                data-testid=\"context-result\"\n                class=\"bg-gray-100 p-2 rounded-sm text-black\"\n              >\n                {JSON.stringify(apiResponse()?.context, null, 2)}\n              </div>\n\n              <div data-testid=\"has-test-parent\" class=\"p-2 border rounded-sm\">\n                Has testParent:{' '}\n                {apiResponse()?.context?.testParent ? 'true' : 'false'}\n              </div>\n\n              <div data-testid=\"has-test\" class=\"p-2 border rounded-sm\">\n                Has test: {apiResponse()?.context?.test ? 'true' : 'false'}\n              </div>\n            </div>\n          </div>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/methods/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/methods/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-8\">\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Route.Link to=\"./only-any\">\n            Server Route only has ANY handler\n          </Route.Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/methods/only-any.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { For } from 'solid-js'\n\nexport const Route = createFileRoute('/methods/only-any')({\n  ssr: false,\n  component: RouteComponent,\n})\n\nconst HttpMethods = [\n  'GET',\n  'POST',\n  'PUT',\n  'DELETE',\n  'PATCH',\n  'OPTIONS',\n  'HEAD',\n] as const\ntype HttpMethods = (typeof HttpMethods)[number]\n\nfunction Test(props: { method: HttpMethods }) {\n  const query = useQuery(() => ({\n    queryKey: [props.method],\n    queryFn: async () => {\n      const response = await fetch(`/api/only-any`, {\n        method: props.method,\n      })\n      try {\n        const json = (await response.json()) as Promise<{\n          method: HttpMethods\n          handler: HttpMethods & 'ANY'\n        }>\n        return json\n      } catch (e) {}\n      // handle HEAD and OPTIONS that have no body\n      const result = {\n        handler: response.headers.get('x-handler') as HttpMethods & 'ANY',\n        method: response.headers.get('x-method') as HttpMethods,\n      }\n      return result\n    },\n  }))\n\n  return (\n    <div>\n      <h3>method={props.method}</h3>\n      <h4> expected </h4>\n      <div data-testid={`expected-${props.method}`}>{props.method}</div>\n      <h4> result</h4>\n      {query.data ? (\n        <div data-testid={`result-${props.method}`}>{query.data.method}</div>\n      ) : null}\n    </div>\n  )\n}\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 m-2 grid gap-2\" data-testid=\"route-component\">\n      <h3>Server Route has only ANY handler</h3>\n      <For each={HttpMethods}>{(method) => <Test method={method} />}</For>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/routes/methods/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/methods')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server Routes Methods E2E tests</h1>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/tests/server-routes.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('merge-middleware-context', async ({ page }) => {\n  await page.goto('/merge-middleware-context')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-middleware-context-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('has-test-parent')).toContainText('true')\n  await expect(page.getByTestId('has-test')).toContainText('true')\n\n  const contextResult = await page.getByTestId('context-result').textContent()\n  expect(contextResult).toContain('testParent')\n  expect(contextResult).toContain('test')\n})\n\ntest.describe('methods', () => {\n  test('only ANY', async ({ page }) => {\n    await page.goto('/methods/only-any')\n\n    // wait for page to be loaded by waiting for the route component to be rendered\n    await expect(page.getByTestId('route-component')).toBeInViewport()\n\n    const testCases = await page\n      .locator('[data-testid^=\"expected-\"]')\n      .elementHandles()\n    expect(testCases.length).not.toBe(0)\n    for (const testCase of testCases) {\n      const testId = await testCase.getAttribute('data-testid')\n\n      if (!testId) {\n        throw new Error('testcase is missing data-testid')\n      }\n\n      const suffix = testId.replace('expected-', '')\n\n      const expected =\n        (await page.getByTestId(`expected-${suffix}`).textContent()) || ''\n      expect(expected).not.toBe('')\n\n      await expect(page.getByTestId(`result-${suffix}`)).toContainText(expected)\n    }\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/server-routes/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/server-routes/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/spa-mode/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-spa-mode\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"npx serve dist/client\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"solid-js\": \"^1.9.10\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts' | '/posts/$postId'\n  id: '__root__' | '/' | '/posts' | '/posts/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  ClientOnly,\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'SPA Mode E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      root: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return { root: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  shellComponent: RootDocument,\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    return (\n      <div data-testid=\"root-container\">\n        <h2 data-testid=\"root-heading\">root</h2>\n        <div>\n          loader: <b data-testid=\"root-loader\">{loaderData().root}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"root-context\">{context().root}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>__root Loading...</div>,\n})\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  const routerState = useRouterState({\n    select: (state) => ({ isLoading: state.isLoading, status: state.status }),\n  })\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <h1>SPA Mode E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">\n              {routerState().isLoading ? 'true' : 'false'}\n            </b>\n          </div>\n          <div>\n            router status:{' '}\n            <b data-testid=\"router-status\">{routerState().status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {children}\n        <Scripts />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div data-testid=\"home-container\">\n      <h1 data-testid=\"home-heading\">Home</h1>\n      <div>\n        <Link\n          to=\"/posts/$postId\"\n          params={{ postId: '1' }}\n          data-testid=\"link-posts-1\"\n        >\n          Go to /posts/1\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      postId: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return { postId: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    return (\n      <div data-testid=\"postId-container\">\n        <h4 data-testid=\"postId-heading\">postId</h4>\n        <div>\n          loader: <b data-testid=\"postId-loader\">{loaderData().postId}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"postId-context\">{context().postId}</b>\n        </div>\n      </div>\n    )\n  },\n  pendingComponent: () => <div>$postId Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/src/routes/posts.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts')({\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      posts: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    return { posts: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    return (\n      <div data-testid=\"posts-container\">\n        <h3 data-testid=\"posts-heading\">posts</h3>\n        <div>\n          loader: <b data-testid=\"posts-loader\">{loaderData().posts}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"posts-context\">{context().posts}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>posts Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport type { Page } from '@playwright/test'\n\nasync function runTest(\n  page: Page,\n  expectedData: {\n    loader: {\n      root: 'server' | 'client'\n      posts: 'server' | 'client'\n      postId: 'server' | 'client'\n    }\n    context: {\n      root: 'server' | 'client'\n      posts: 'server' | 'client'\n      postId: 'server' | 'client'\n    }\n  },\n) {\n  // wait for page to be loaded by waiting for the leaf route to be rendered\n  await expect(page.getByTestId('postId-heading')).toContainText('postId')\n\n  // check expectations\n  await Promise.all(\n    Object.entries(expectedData.loader).map(async ([route, expectedLoader]) => {\n      await expect(page.getByTestId(`${route}-loader`)).toContainText(\n        expectedLoader,\n      )\n    }),\n  )\n  await Promise.all(\n    Object.entries(expectedData.context).map(\n      async ([route, expectedContext]) => {\n        await expect(page.getByTestId(`${route}-context`)).toContainText(\n          expectedContext,\n        )\n      },\n    ),\n  )\n  await expect(page.getByTestId('router-isLoading')).toContainText('false')\n  await expect(page.getByTestId('router-status')).toContainText('idle')\n}\ntest.describe('SPA mode', () => {\n  test(`directly visiting prerendered /posts/1`, async ({\n    page,\n  }: {\n    page: Page\n  }) => {\n    await page.goto('/posts/1')\n    await runTest(page, {\n      loader: {\n        root: 'server',\n        posts: 'server',\n        postId: 'server',\n      },\n      context: {\n        root: 'server',\n        posts: 'server',\n        postId: 'server',\n      },\n    })\n  })\n\n  test(`client-side navigation to /posts/1`, async ({\n    page,\n  }: {\n    page: Page\n  }) => {\n    await page.goto('/')\n    const testId = 'link-posts-1'\n    await page.getByTestId(testId).click()\n    await runTest(page, {\n      loader: {\n        root: 'server',\n        posts: 'client',\n        postId: 'client',\n      },\n      context: {\n        root: 'client',\n        posts: 'client',\n        postId: 'client',\n      },\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/spa-mode/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      spa: {\n        enabled: true,\n        prerender: {\n          outputPath: 'index.html',\n          crawlLinks: true,\n        },\n      },\n      pages: [\n        {\n          path: '/posts/1',\n          prerender: { enabled: true, outputPath: '/posts/1/index.html' },\n        },\n      ],\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/virtual-routes/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-virtual-routes\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('layout/second-layout.tsx', [\n      route('route-without-file', [\n        route('/layout-a', 'a.tsx'),\n        route('/layout-b', 'b.tsx'),\n      ]),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n  route('/special|pipe', 'pipe.tsx'),\n])\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as pipeRouteImport } from './routes/pipe'\nimport { Route as postsPostsRouteImport } from './routes/posts/posts'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home'\nimport { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route'\nimport { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index'\nimport { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world'\nimport { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst pipeRoute = pipeRouteImport.update({\n  id: '/special|pipe',\n  path: '/special|pipe',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsRoute = postsPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsDetailRoute = postsPostsDetailRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second-layout',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst postsPostsHomeRoute = postsPostsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({\n  id: '/classic/hello',\n  path: '/classic/hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({\n  id: '/world',\n  path: '/world',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({\n  id: '/universe',\n  path: '/universe',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/route-without-file/layout-b',\n  path: '/route-without-file/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/route-without-file/layout-a',\n  path: '/route-without-file/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsRouteWithChildren\n  '/special|pipe': typeof pipeRoute\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/special|pipe': typeof pipeRoute\n  '/posts': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/posts': typeof postsPostsRouteWithChildren\n  '/special|pipe': typeof pipeRoute\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/_first/_second-layout': typeof layoutSecondLayoutRouteWithChildren\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/_first/_second-layout/route-without-file/layout-a': typeof aRoute\n  '/_first/_second-layout/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/special|pipe'\n    | '/classic/hello'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/special|pipe'\n    | '/posts'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/posts'\n    | '/special|pipe'\n    | '/classic/hello'\n    | '/posts/'\n    | '/_first/_second-layout'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/_first/_second-layout/route-without-file/layout-a'\n    | '/_first/_second-layout/route-without-file/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n  postsPostsRoute: typeof postsPostsRouteWithChildren\n  pipeRoute: typeof pipeRoute\n  ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/special|pipe': {\n      id: '/special|pipe'\n      path: '/special|pipe'\n      fullPath: '/special|pipe'\n      preLoaderRoute: typeof pipeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsPostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsPostsDetailRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/_first/_second-layout': {\n      id: '/_first/_second-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsPostsHomeRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/classic/hello': {\n      id: '/classic/hello'\n      path: '/classic/hello'\n      fullPath: '/classic/hello'\n      preLoaderRoute: typeof ClassicHelloRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/classic/hello/': {\n      id: '/classic/hello/'\n      path: '/'\n      fullPath: '/classic/hello/'\n      preLoaderRoute: typeof ClassicHelloIndexRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/world': {\n      id: '/classic/hello/world'\n      path: '/world'\n      fullPath: '/classic/hello/world'\n      preLoaderRoute: typeof ClassicHelloWorldRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/universe': {\n      id: '/classic/hello/universe'\n      path: '/universe'\n      fullPath: '/classic/hello/universe'\n      preLoaderRoute: typeof ClassicHelloUniverseRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-b': {\n      id: '/_first/_second-layout/route-without-file/layout-b'\n      path: '/route-without-file/layout-b'\n      fullPath: '/route-without-file/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-a': {\n      id: '/_first/_second-layout/route-without-file/layout-a'\n      path: '/route-without-file/layout-a'\n      fullPath: '/route-without-file/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\ninterface postsPostsRouteChildren {\n  postsPostsHomeRoute: typeof postsPostsHomeRoute\n  postsPostsDetailRoute: typeof postsPostsDetailRoute\n}\n\nconst postsPostsRouteChildren: postsPostsRouteChildren = {\n  postsPostsHomeRoute: postsPostsHomeRoute,\n  postsPostsDetailRoute: postsPostsDetailRoute,\n}\n\nconst postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(\n  postsPostsRouteChildren,\n)\n\ninterface ClassicHelloRouteRouteChildren {\n  ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute\n  ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute\n  ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute\n}\n\nconst ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {\n  ClassicHelloUniverseRoute: ClassicHelloUniverseRoute,\n  ClassicHelloWorldRoute: ClassicHelloWorldRoute,\n  ClassicHelloIndexRoute: ClassicHelloIndexRoute,\n}\n\nconst ClassicHelloRouteRouteWithChildren =\n  ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n  postsPostsRoute: postsPostsRouteWithChildren,\n  pipeRoute: pipeRoute,\n  ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute(\n  '/_first/_second-layout/route-without-file/layout-a',\n)({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute(\n  '/_first/_second-layout/route-without-file/layout-b',\n)({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/file-based-subtree/hello/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/classic/hello/')({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/classic/hello')({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/classic/hello/universe')({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/file-based-subtree/hello/world.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/classic/hello/world')({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_first')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_first/_second-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-without-file/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/route-without-file/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/pipe.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/special|pipe')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"special-pipe-route-heading\">Hello \"/special|pipe\"!</div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/posts/posts-detail.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/posts/posts-home.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/posts/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/routes/root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type { JSX } from 'solid-js'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n  head: () => {\n    return {\n      links: [{ rel: 'stylesheet', href: appCss }],\n    }\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div class=\"p-2 flex gap-2 text-lg border-b\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/route-without-file/layout-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/classic/hello\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Subtree\n          </Link>{' '}\n          <Link\n            data-testid=\"special-pipe-link\"\n            to=\"/special|pipe\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Pipe\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        {/* Start rendering router matches */}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('body')).toContainText(\"I'm a layout\")\n  await expect(page.locator('body')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/tests/special-characters.spec.ts",
    "content": "import { expect } from '@playwright/test'\n\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.use({\n  whitelistErrors: [\n    /Failed to load resource: the server responded with a status of 404/,\n  ],\n})\ntest.describe('Unicode route rendering', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/')\n    await page.waitForURL('/')\n  })\n\n  test.describe('Special characters in route paths', () => {\n    test('should render route with pipe character in path on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/special|pipe')\n      await page.waitForURL(`${baseURL}/special%7Cpipe`)\n\n      await expect(\n        page.getByTestId('special-pipe-route-heading'),\n      ).toBeInViewport()\n    })\n\n    test('should render route with pipe character in path on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const pipeLink = page.getByTestId('special-pipe-link')\n\n      await pipeLink.click()\n      await page.waitForURL(`${baseURL}/special%7Cpipe`)\n\n      await expect(\n        page.getByTestId('special-pipe-route-heading'),\n      ).toBeInViewport()\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/virtual-routes/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      router: {\n        virtualRouteConfig: './routes.ts',\n      },\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/website/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/solid-start/website/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/solid-start/website/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/solid-start/website/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-e2e-website\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"workspace:^\",\n    \"@tanstack/solid-router-devtools\": \"workspace:^\",\n    \"@tanstack/solid-start\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/website/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/solid-start/website/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LibraryRouteImport } from './routes/_library'\nimport { Route as LibraryIndexRouteImport } from './routes/_library.index'\nimport { Route as ProjectIndexRouteImport } from './routes/$project.index'\nimport { Route as LibraryProjectRouteImport } from './routes/_library.$project'\nimport { Route as LibraryProjectVersionIndexRouteImport } from './routes/_library.$project.$version.index'\nimport { Route as ProjectVersionDocsIndexRouteImport } from './routes/$project.$version.docs.index'\nimport { Route as ProjectVersionDocsFrameworkFrameworkRouteImport } from './routes/$project.$version.docs.framework.$framework'\nimport { Route as ProjectVersionDocsFrameworkFrameworkIndexRouteImport } from './routes/$project.$version.docs.framework.$framework.index'\nimport { Route as ProjectVersionDocsFrameworkFrameworkSplatRouteImport } from './routes/$project.$version.docs.framework.$framework.$'\nimport { Route as ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport } from './routes/$project.$version.docs.framework.$framework.examples.$'\n\nconst LibraryRoute = LibraryRouteImport.update({\n  id: '/_library',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LibraryIndexRoute = LibraryIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => LibraryRoute,\n} as any)\nconst ProjectIndexRoute = ProjectIndexRouteImport.update({\n  id: '/$project/',\n  path: '/$project/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LibraryProjectRoute = LibraryProjectRouteImport.update({\n  id: '/$project',\n  path: '/$project',\n  getParentRoute: () => LibraryRoute,\n} as any)\nconst LibraryProjectVersionIndexRoute =\n  LibraryProjectVersionIndexRouteImport.update({\n    id: '/$version/',\n    path: '/$version/',\n    getParentRoute: () => LibraryProjectRoute,\n  } as any)\nconst ProjectVersionDocsIndexRoute = ProjectVersionDocsIndexRouteImport.update({\n  id: '/$project/$version/docs/',\n  path: '/$project/$version/docs/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ProjectVersionDocsFrameworkFrameworkRoute =\n  ProjectVersionDocsFrameworkFrameworkRouteImport.update({\n    id: '/$project/$version/docs/framework/$framework',\n    path: '/$project/$version/docs/framework/$framework',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkIndexRoute =\n  ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkSplatRoute =\n  ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({\n    id: '/$',\n    path: '/$',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute =\n  ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({\n    id: '/examples/$',\n    path: '/examples/$',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof LibraryIndexRoute\n  '/$project': typeof LibraryProjectRouteWithChildren\n  '/$project/': typeof ProjectIndexRoute\n  '/$project/$version/docs/': typeof ProjectVersionDocsIndexRoute\n  '/$project/$version/': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework/': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRoutesByTo {\n  '/$project': typeof ProjectIndexRoute\n  '/': typeof LibraryIndexRoute\n  '/$project/$version/docs': typeof ProjectVersionDocsIndexRoute\n  '/$project/$version': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/_library': typeof LibraryRouteWithChildren\n  '/_library/$project': typeof LibraryProjectRouteWithChildren\n  '/$project/': typeof ProjectIndexRoute\n  '/_library/': typeof LibraryIndexRoute\n  '/$project/$version/docs/': typeof ProjectVersionDocsIndexRoute\n  '/_library/$project/$version/': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework/': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/$project'\n    | '/$project/'\n    | '/$project/$version/docs/'\n    | '/$project/$version/'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework/'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/$project'\n    | '/'\n    | '/$project/$version/docs'\n    | '/$project/$version'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  id:\n    | '__root__'\n    | '/_library'\n    | '/_library/$project'\n    | '/$project/'\n    | '/_library/'\n    | '/$project/$version/docs/'\n    | '/_library/$project/$version/'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework/'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  LibraryRoute: typeof LibraryRouteWithChildren\n  ProjectIndexRoute: typeof ProjectIndexRoute\n  ProjectVersionDocsIndexRoute: typeof ProjectVersionDocsIndexRoute\n  ProjectVersionDocsFrameworkFrameworkRoute: typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/_library': {\n      id: '/_library'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LibraryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_library/': {\n      id: '/_library/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof LibraryIndexRouteImport\n      parentRoute: typeof LibraryRoute\n    }\n    '/$project/': {\n      id: '/$project/'\n      path: '/$project'\n      fullPath: '/$project/'\n      preLoaderRoute: typeof ProjectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_library/$project': {\n      id: '/_library/$project'\n      path: '/$project'\n      fullPath: '/$project'\n      preLoaderRoute: typeof LibraryProjectRouteImport\n      parentRoute: typeof LibraryRoute\n    }\n    '/_library/$project/$version/': {\n      id: '/_library/$project/$version/'\n      path: '/$version'\n      fullPath: '/$project/$version/'\n      preLoaderRoute: typeof LibraryProjectVersionIndexRouteImport\n      parentRoute: typeof LibraryProjectRoute\n    }\n    '/$project/$version/docs/': {\n      id: '/$project/$version/docs/'\n      path: '/$project/$version/docs'\n      fullPath: '/$project/$version/docs/'\n      preLoaderRoute: typeof ProjectVersionDocsIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$project/$version/docs/framework/$framework': {\n      id: '/$project/$version/docs/framework/$framework'\n      path: '/$project/$version/docs/framework/$framework'\n      fullPath: '/$project/$version/docs/framework/$framework'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$project/$version/docs/framework/$framework/': {\n      id: '/$project/$version/docs/framework/$framework/'\n      path: '/'\n      fullPath: '/$project/$version/docs/framework/$framework/'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkIndexRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n    '/$project/$version/docs/framework/$framework/$': {\n      id: '/$project/$version/docs/framework/$framework/$'\n      path: '/$'\n      fullPath: '/$project/$version/docs/framework/$framework/$'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n    '/$project/$version/docs/framework/$framework/examples/$': {\n      id: '/$project/$version/docs/framework/$framework/examples/$'\n      path: '/examples/$'\n      fullPath: '/$project/$version/docs/framework/$framework/examples/$'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n  }\n}\n\ninterface LibraryProjectRouteChildren {\n  LibraryProjectVersionIndexRoute: typeof LibraryProjectVersionIndexRoute\n}\n\nconst LibraryProjectRouteChildren: LibraryProjectRouteChildren = {\n  LibraryProjectVersionIndexRoute: LibraryProjectVersionIndexRoute,\n}\n\nconst LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(\n  LibraryProjectRouteChildren,\n)\n\ninterface LibraryRouteChildren {\n  LibraryProjectRoute: typeof LibraryProjectRouteWithChildren\n  LibraryIndexRoute: typeof LibraryIndexRoute\n}\n\nconst LibraryRouteChildren: LibraryRouteChildren = {\n  LibraryProjectRoute: LibraryProjectRouteWithChildren,\n  LibraryIndexRoute: LibraryIndexRoute,\n}\n\nconst LibraryRouteWithChildren =\n  LibraryRoute._addFileChildren(LibraryRouteChildren)\n\ninterface ProjectVersionDocsFrameworkFrameworkRouteChildren {\n  ProjectVersionDocsFrameworkFrameworkSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  ProjectVersionDocsFrameworkFrameworkIndexRoute: typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\n\nconst ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren =\n  {\n    ProjectVersionDocsFrameworkFrameworkSplatRoute:\n      ProjectVersionDocsFrameworkFrameworkSplatRoute,\n    ProjectVersionDocsFrameworkFrameworkIndexRoute:\n      ProjectVersionDocsFrameworkFrameworkIndexRoute,\n    ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute:\n      ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,\n  }\n\nconst ProjectVersionDocsFrameworkFrameworkRouteWithChildren =\n  ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(\n    ProjectVersionDocsFrameworkFrameworkRouteChildren,\n  )\n\nconst rootRouteChildren: RootRouteChildren = {\n  LibraryRoute: LibraryRouteWithChildren,\n  ProjectIndexRoute: ProjectIndexRoute,\n  ProjectVersionDocsIndexRoute: ProjectVersionDocsIndexRoute,\n  ProjectVersionDocsFrameworkFrameworkRoute:\n    ProjectVersionDocsFrameworkFrameworkRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultStaleTime: 5000,\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/$project.$version.docs.framework.$framework.$.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport { NotFound } from '~/components/NotFound'\nimport { getDocument } from '~/server/document'\nimport { capitalize, seo } from '~/utils/seo'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/$',\n)({\n  loader: ({ params: { _splat } }) =>\n    getDocument({\n      data: _splat!,\n    }),\n  head: ({ loaderData, params }) => ({\n    meta: seo({\n      title: `${loaderData?.title || 'Project'} | TanStack ${capitalize(params.project)} ${capitalize(params.framework)}`,\n    }),\n  }),\n  errorComponent: PostErrorComponent,\n  component: Page,\n  notFoundComponent: () => {\n    return <NotFound>Document not found</NotFound>\n  },\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction Page() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4\n        data-testid=\"selected-doc-heading\"\n        class=\"text-xl font-bold underline\"\n      >\n        {post().title}\n      </h4>\n      <div class=\"text-sm\">{post().content}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/$project.$version.docs.framework.$framework.examples.$.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { NotFound } from '~/components/NotFound'\nimport { capitalize, seo } from '~/utils/seo'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/examples/$',\n)({\n  head: ({ params }) => ({\n    meta: seo({\n      title: `${capitalize(params._splat || '')} Example | TanStack ${capitalize(params.project)} ${capitalize(params.framework)}`,\n    }),\n  }),\n  component: Page,\n  notFoundComponent: () => {\n    return <NotFound>Example not found</NotFound>\n  },\n})\n\nfunction Page() {\n  const params = Route.useParams()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4\n        data-testid=\"selected-example-heading\"\n        class=\"text-xl font-bold underline\"\n      >\n        {params()._splat} example\n      </h4>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/$project.$version.docs.framework.$framework.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/',\n)({\n  beforeLoad: () => {\n    throw redirect({\n      from: '/$project/$version/docs/framework/$framework/',\n      to: '/$project/$version/docs/framework/$framework/$',\n      params: {\n        _splat: 'overview',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/$project.$version.docs.framework.$framework.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useLocation,\n} from '@tanstack/solid-router'\nimport { getDocumentHeads } from '~/server/document'\nimport { getProject } from '~/server/projects'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework',\n)({\n  loader: async ({ params: { project } }) => {\n    const library = await getProject({ data: project })\n    const documents = await getDocumentHeads()\n    return {\n      library,\n      documents,\n    }\n  },\n  component: Page,\n})\n\nfunction Page() {\n  const project = Route.useLoaderData({ select: (s) => s.library })\n  const documents = Route.useLoaderData({ select: (s) => s.documents })\n  const pathname = useLocation({ select: (s) => s.pathname })\n\n  return (\n    <div class=\"grid lg:grid-cols-5 lg:divide-x min-h-dvh\">\n      <aside>\n        <div class=\"p-4\">\n          <Link\n            to=\"/\"\n            activeOptions={{ exact: true }}\n            class=\"aria-[current='page']:underline\"\n          >\n            Home\n          </Link>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Version</p>\n          <ul>\n            {project().versions.map((version) => (\n              <li>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ version }}\n                  class=\"aria-[current='page']:underline\"\n                  activeOptions={{ exact: false }}\n                >\n                  {version}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Framework</p>\n          <ul>\n            {project().frameworks.map((framework) => (\n              <li>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ framework }}\n                  class=\"aria-[current='page']:underline\"\n                  activeOptions={{ exact: false }}\n                >\n                  {framework}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Content</p>\n          <ul>\n            {documents().map((doc) => (\n              <li>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ _splat: doc.id }}\n                  class=\"aria-[current='page']:underline\"\n                >\n                  {doc.title}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Examples</p>\n          <ul>\n            {project().examples.map((example) => (\n              <li>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/examples/$\"\n                  params={{ _splat: example }}\n                  class=\"aria-[current='page']:underline\"\n                >\n                  {example}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </aside>\n      <main class=\"lg:col-span-4 p-4\">\n        <p\n          class=\"text-sm lg:text-base pb-4 border-b break-all\"\n          data-testid=\"selected-route-label\"\n        >\n          {pathname()}\n        </p>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/$project.$version.docs.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/$project/$version/docs/')({\n  beforeLoad: () => {\n    throw redirect({\n      from: '/$project/$version/docs/',\n      to: '/$project/$version/docs/framework/$framework/$',\n      params: {\n        framework: 'solid',\n        _splat: 'overview',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/$project.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/$project/')({\n  loader: ({ params }) => {\n    throw redirect({\n      to: '/$project/$version',\n      params: {\n        project: params.project,\n        version: 'latest',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title: 'TanStack Website',\n        description: `TanStack projects are type-safe!!!`,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return <p>{props.error.stack}</p>\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <Outlet />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/_library.$project.$version.index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_library/$project/$version/')({\n  component: Page,\n})\n\nfunction Page() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <h1 class=\"text-2xl mb-2\" data-testid=\"landing-page-heading\">\n        {params().project} landing page\n      </h1>\n      <p data-testid=\"landing-page-version\">version: {params().version}</p>\n      <p>\n        <Link aria-label=\"Documentation\" from=\"/$project/$version/\" to=\"./docs\">\n          Get started with our documentation.\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/_library.$project.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { getProject } from '~/server/projects'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createFileRoute('/_library/$project')({\n  loader: ({ params: { project } }) => getProject({ data: project }),\n  head: ({ loaderData }) => ({\n    meta: seo({ title: `TanStack ${loaderData?.name || 'Project'}` }),\n  }),\n  component: () => (\n    <div class=\"p-2\">\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/_library.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_library/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3 class=\"text-2xl mb-2\">Website Landing Page</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/routes/_library.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useLocation,\n} from '@tanstack/solid-router'\nimport { getProjects } from '~/server/projects'\n\nexport const Route = createFileRoute('/_library')({\n  loader: async () => {\n    const projects = await getProjects()\n    return {\n      libraries: projects,\n    }\n  },\n  component: Layout,\n})\n\nfunction Layout() {\n  const loaderData = Route.useLoaderData()\n  const pathname = useLocation({ select: (s) => s.pathname })\n  return (\n    <div class=\"grid lg:grid-cols-5 lg:divide-x min-h-dvh\">\n      <aside>\n        <div class=\"p-4\">\n          <Link\n            to=\"/\"\n            activeOptions={{ exact: true }}\n            class=\"aria-[current='page']:underline\"\n          >\n            Home\n          </Link>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Libraries</p>\n          <ul>\n            {loaderData().libraries.map((library) => (\n              <li>\n                <Link\n                  to=\"/$project\"\n                  params={{ project: library }}\n                  class=\"aria-[current='page']:underline\"\n                >\n                  {library}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </aside>\n      <main class=\"lg:col-span-4 p-4\">\n        <p\n          class=\"text-sm lg:text-base pb-4 border-b break-all\"\n          data-testid=\"selected-route-label\"\n        >\n          {pathname()}\n        </p>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/server/document.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst documents: Array<{ id: string; title: string; content: string }> = [\n  {\n    id: 'overview',\n    title: 'Overview',\n    content: 'This is the content of the overview document',\n  },\n  {\n    id: 'getting-started',\n    title: 'Getting Started',\n    content: 'To get started, you need to do the following...',\n  },\n  {\n    id: 'installation',\n    title: 'Installation',\n    content: 'To install this package, run the following command...',\n  },\n  {\n    id: 'ref/useQueryFunction',\n    title: 'useQuery Reference',\n    content: 'The useQuery function is used to...',\n  },\n  {\n    id: 'ref/useMutationFunction',\n    title: 'useMutation Reference',\n    content: 'The useMutation function is used to...',\n  },\n]\n\nexport const getDocumentHeads = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    return documents.map(({ id, title }) => ({\n      id,\n      title,\n    }))\n  },\n)\n\nexport const getDocument = createServerFn({ method: 'GET' })\n  .inputValidator((id: string) => id)\n  .handler(async ({ data: id }) => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    const document = documents.find((doc) => doc.id === id)\n\n    if (!document) {\n      throw notFound()\n    }\n\n    return document\n  })\n"
  },
  {
    "path": "e2e/solid-start/website/src/server/projects.tsx",
    "content": "import { createServerFn } from '@tanstack/solid-start'\nimport { notFound } from '@tanstack/solid-router'\nimport { capitalize } from '~/utils/seo'\n\nconst projects = ['router', 'table', 'query', 'form', 'ranger']\n\nexport const getProjects = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    return projects\n  },\n)\n\nexport const getProject = createServerFn({ method: 'GET' })\n  .inputValidator((project: string) => project)\n  .handler(async (ctx) => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    const selectedProject = projects.find((p) => p === ctx.data.toLowerCase())\n\n    if (!selectedProject) {\n      throw notFound()\n    }\n\n    return {\n      id: selectedProject,\n      name: capitalize(selectedProject),\n      versions: ['latest', 'v2', 'v1'],\n      frameworks: ['solid', 'react', 'vue', 'solidjs', 'svelte'],\n      examples: ['basic', 'kitchen-sink'],\n    }\n  })\n"
  },
  {
    "path": "e2e/solid-start/website/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/website/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n\nexport const capitalize = (str: string) =>\n  str.charAt(0).toUpperCase() + str.slice(1)\n"
  },
  {
    "path": "e2e/solid-start/website/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/solid-start/website/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\nconst routeTestId = 'selected-route-label'\n\ntest('resolves to the latest version on load of a project like \"/router\"', async ({\n  page,\n}) => {\n  await page.goto('/router')\n\n  await expect(page.getByTestId(routeTestId)).toContainText('/router/latest')\n})\n\ntest('resolves to the overview docs page', async ({ page }) => {\n  await page.goto('/router/latest/docs')\n\n  await expect(page.getByTestId(routeTestId)).toContainText(\n    '/router/latest/docs/framework/solid/overview',\n  )\n})\n\ntest('clicking on Documentation link navigates to the overview docs page', async ({\n  page,\n}) => {\n  await page.goto('/router')\n  await page.waitForLoadState('networkidle')\n\n  const documentationLink = page.getByLabel('Documentation')\n  await documentationLink.click()\n  await page.waitForLoadState('networkidle')\n\n  const pathname = new URL(page.url()).pathname\n  expect(pathname).toBe('/router/latest/docs/framework/solid/overview')\n})\n"
  },
  {
    "path": "e2e/solid-start/website/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/solid-start/website/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basepath-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/vue-query\": \"^5.90.0\",\n    \"@tanstack/vue-query-devtools\": \"^6.1.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/src/main.tsx",
    "content": "import { createApp, h } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  basepath: '/app/',\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const app = createApp({\n    setup() {\n      return () => h(RouterProvider, { router })\n    },\n  })\n  app.mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/src/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/vue-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = Route.useNavigate()\n\n  return (\n    <div data-testid=\"about-component\">\n      <button\n        onClick={() => navigate({ to: '/', reloadDocument: true })}\n        data-testid=\"to-home-btn\"\n      >\n        Navigate to / with document reload\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n\nfunction App() {\n  const navigate = Route.useNavigate()\n\n  return (\n    <div data-testid=\"home-component\">\n      <button\n        data-testid=\"to-about-btn\"\n        onClick={() =>\n          navigate({\n            to: '/about',\n            reloadDocument: true,\n          })\n        }\n      >\n        Navigate to /about with document reload\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/tests/reload-document.test.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('navigate() respects basepath for when reloadDocument=true', async ({\n  page,\n}) => {\n  await page.goto(`/app/`)\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n\n  const aboutBtn = page.getByTestId(`to-about-btn`)\n  await aboutBtn.click()\n  await page.waitForURL('/app/about')\n  await expect(page.getByTestId(`about-component`)).toBeInViewport()\n\n  const homeBtn = page.getByTestId(`to-home-btn`)\n  await homeBtn.click()\n  await page.waitForURL('/app/')\n  await expect(page.getByTestId(`home-component`)).toBeInViewport()\n})\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basepath-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  base: '/app/',\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/.gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndist-ssr\n*.local\n\n# Editor directories and files\n.vscode/*\n!.vscode/extensions.json\n.idea\n.DS_Store\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?\n"
  },
  {
    "path": "e2e/vue-router/basic/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && vue-tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createLink,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { NotFoundError, fetchPost, fetchPosts } from './posts'\nimport './styles.css'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  const SvgLink = createLink('svg')\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link to=\"/posts\" viewTransition>\n          View Transition\n        </Link>{' '}\n        <Link to=\"/posts\" viewTransition={{ types: ['dummy'] }}>\n          View Transition types\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>{' '}\n        <div class=\"flex items-center\">\n          <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" role=\"img\">\n            <title id=\"rectTitle\">Link in SVG</title>\n            <SvgLink to=\"/posts\" aria-label=\"Open posts from SVG\">\n              <rect\n                x=\"0\"\n                y=\"0\"\n                width=\"20\"\n                height=\"20\"\n                rx=\"4\"\n                fill=\"blue\"\n                stroke-width=\"2\"\n              />\n            </SvgLink>\n          </svg>\n        </div>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nexport const postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ params }) => fetchPost(params.postId),\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold\">{post.value.title}</h4>\n      <hr class=\"opacity-20\" />\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layout2Route = createRoute({\n  getParentRoute: () => layoutRoute,\n  id: '_layout-2',\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layoutARoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-a',\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n\nconst layoutBRoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-b',\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n\nconst paramsPsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/params-ps',\n})\n\nconst paramsPsIndexRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/',\n  component: function ParamsIndex() {\n    return (\n      <div>\n        <h3 class=\"pb-2\">Named path params</h3>\n        <ul class=\"grid mb-2\">\n          <li>\n            <Link\n              data-testid=\"l-to-named-foo\"\n              to=\"/params-ps/named/$foo\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/$foo\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-named-prefixfoo\"\n              to=\"/params-ps/named/prefix{$foo}\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/{'prefix{$foo}'}\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-named-foosuffix\"\n              to=\"/params-ps/named/{$foo}suffix\"\n              params={{ foo: 'foo' }}\n            >\n              /params-ps/named/{'{$foo}suffix'}\n            </Link>\n          </li>\n        </ul>\n        <hr />\n        <h3 class=\"pb-2\">Wildcard path params</h3>\n        <ul class=\"grid mb-2\">\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-foo\"\n              to=\"/params-ps/wildcard/$\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/$\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-prefixfoo\"\n              to=\"/params-ps/wildcard/prefix{$}\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/{'prefix{$}'}\n            </Link>\n          </li>\n          <li>\n            <Link\n              data-testid=\"l-to-wildcard-foosuffix\"\n              to=\"/params-ps/wildcard/{$}suffix\"\n              params={{ _splat: 'foo' }}\n            >\n              /params-ps/wildcard/{'{$}suffix'}\n            </Link>\n          </li>\n        </ul>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/named',\n})\n\nconst paramsPsNamedIndexRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/',\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n\nconst paramsPsNamedFooRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/$foo',\n  component: function ParamsNamedFoo() {\n    const p = paramsPsNamedFooRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFoo</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p.value)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedFooPrefixRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/prefix{$foo}',\n  component: function ParamsNamedFooMarkdown() {\n    const p = paramsPsNamedFooPrefixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFooPrefix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p.value)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsNamedFooSuffixRoute = createRoute({\n  getParentRoute: () => paramsPsNamedRoute,\n  path: '/{$foo}suffix',\n  component: function ParamsNamedFooSuffix() {\n    const p = paramsPsNamedFooSuffixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsNamedFooSuffix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p.value)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardRoute = createRoute({\n  getParentRoute: () => paramsPsRoute,\n  path: '/wildcard',\n})\n\nconst paramsPsWildcardIndexRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '/',\n  beforeLoad: () => {\n    throw redirect({ to: '/params-ps' })\n  },\n})\n\nconst paramsPsWildcardSplatRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '$',\n  component: function ParamsWildcardSplat() {\n    const p = paramsPsWildcardSplatRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplat</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p.value)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardSplatPrefixRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: 'prefix{$}',\n  component: function ParamsWildcardSplatPrefix() {\n    const p = paramsPsWildcardSplatPrefixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplatPrefix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p.value)}</div>\n      </div>\n    )\n  },\n})\n\nconst paramsPsWildcardSplatSuffixRoute = createRoute({\n  getParentRoute: () => paramsPsWildcardRoute,\n  path: '{$}suffix',\n  component: function ParamsWildcardSplatSuffix() {\n    const p = paramsPsWildcardSplatSuffixRoute.useParams()\n    return (\n      <div>\n        <h3>ParamsWildcardSplatSuffix</h3>\n        <div data-testid=\"params-output\">{JSON.stringify(p.value)}</div>\n      </div>\n    )\n  },\n})\n\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute, postsIndexRoute]),\n  layoutRoute.addChildren([\n    layout2Route.addChildren([layoutARoute, layoutBRoute]),\n  ]),\n  paramsPsRoute.addChildren([\n    paramsPsNamedRoute.addChildren([\n      paramsPsNamedFooPrefixRoute,\n      paramsPsNamedFooSuffixRoute,\n      paramsPsNamedFooRoute,\n      paramsPsNamedIndexRoute,\n    ]),\n    paramsPsWildcardRoute.addChildren([\n      paramsPsWildcardSplatRoute,\n      paramsPsWildcardSplatPrefixRoute,\n      paramsPsWildcardSplatSuffixRoute,\n      paramsPsWildcardIndexRoute,\n    ]),\n    paramsPsIndexRoute,\n  ]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/src/posts.lazy.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@tanstack/vue-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Navigating to a post page with viewTransition', async ({ page }) => {\n  await page.getByRole('link', { name: 'View Transition', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to a post page with viewTransition types', async ({\n  page,\n}) => {\n  await page.getByRole('link', { name: 'View Transition types' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Link in SVG does not trigger a full page reload', async ({ page }) => {\n  let fullPageLoad = false\n  page.on('domcontentloaded', () => {\n    fullPageLoad = true\n  })\n\n  await page.getByRole('link', { name: 'Open posts from SVG' }).click()\n  const url = `http://localhost:${PORT}/posts`\n  await page.waitForURL(url)\n\n  expect(fullPageLoad).toBeFalsy()\n})\n"
  },
  {
    "path": "e2e/vue-router/basic/tests/params.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('params operations + prefix/suffix', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/params-ps')\n  })\n\n  test.describe('named params', () => {\n    const NAMED_PARAMS_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-named-foo',\n        pathname: '/params-ps/named/foo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFoo',\n      },\n      {\n        id: 'l-to-named-prefixfoo',\n        pathname: '/params-ps/named/prefixfoo',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooPrefix',\n      },\n      {\n        id: 'l-to-named-foosuffix',\n        pathname: '/params-ps/named/foosuffix',\n        params: { foo: 'foo' },\n        destHeadingId: 'ParamsNamedFooSuffix',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n  })\n\n  test.describe('wildcard param', () => {\n    const WILDCARD_PARAM_PAIRS = [\n      // Test ID | Expected href\n      {\n        id: 'l-to-wildcard-foo',\n        pathname: '/params-ps/wildcard/foo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplat',\n      },\n      {\n        id: 'l-to-wildcard-prefixfoo',\n        pathname: '/params-ps/wildcard/prefixfoo',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatPrefix',\n      },\n      {\n        id: 'l-to-wildcard-foosuffix',\n        pathname: '/params-ps/wildcard/foosuffix',\n        params: { '*': 'foo', _splat: 'foo' },\n        destHeadingId: 'ParamsWildcardSplatSuffix',\n      },\n    ] satisfies Array<{\n      id: string\n      pathname: string\n      params: Record<string, string>\n      destHeadingId: string\n    }>\n\n    test.describe('Link', () => {\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`interpolation for testid=\"${id}\" has href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await expect(link).toHaveAttribute('href', pathname)\n        })\n      })\n\n      WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => {\n        test(`navigation for testid=\"${id}\" succeeds to href=\"${pathname}\"`, async ({\n          page,\n        }) => {\n          const link = page.getByTestId(id)\n          await link.click()\n          await page.waitForLoadState('networkidle')\n          const pagePathname = new URL(page.url()).pathname\n          expect(pagePathname).toBe(pathname)\n        })\n      })\n    })\n\n    WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => {\n      test(`on first-load to \"${pathname}\" has correct params`, async ({\n        page,\n      }) => {\n        await page.goto(pathname)\n        await page.waitForLoadState('networkidle')\n        const pagePathname = new URL(page.url()).pathname\n        expect(pagePathname).toBe(pathname)\n\n        const headingEl = page.getByRole('heading', { name: destHeadingId })\n        await expect(headingEl).toBeVisible()\n\n        const paramsEl = page.getByTestId('params-output')\n        const paramsText = await paramsEl.innerText()\n        const paramsObj = JSON.parse(paramsText)\n        expect(paramsObj).toEqual(params)\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/vue-router/basic/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"strict\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"noEmit\": true,\n    \"resolveJsonModule\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"include\": [\"src\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/eslint.config.js",
    "content": "import js from '@eslint/js'\nimport typescript from '@typescript-eslint/eslint-plugin'\nimport typescriptParser from '@typescript-eslint/parser'\nimport vue from 'eslint-plugin-vue'\nimport vueParser from 'vue-eslint-parser'\n\nexport default [\n  js.configs.recommended,\n  ...vue.configs['flat/recommended'],\n  {\n    files: ['**/*.{js,jsx,ts,tsx,vue}'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n        ecmaVersion: 'latest',\n        sourceType: 'module',\n        ecmaFeatures: {\n          jsx: true,\n        },\n      },\n    },\n    plugins: {\n      '@typescript-eslint': typescript,\n      vue,\n    },\n    rules: {\n      // Vue specific rules\n      'vue/multi-word-component-names': 'off',\n      'vue/no-unused-vars': 'error',\n\n      // TypeScript rules\n      '@typescript-eslint/no-unused-vars': 'error',\n      '@typescript-eslint/no-explicit-any': 'warn',\n\n      // General rules\n      'no-unused-vars': 'off', // Let TypeScript handle this\n    },\n  },\n  {\n    files: ['**/*.vue'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n      },\n    },\n  },\n]\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n\n    <script src=\"https://unpkg.com/@tailwindcss/browser@4\"></script>\n    <style type=\"text/tailwindcss\">\n      html {\n        color-scheme: light dark;\n      }\n      * {\n        @apply border-gray-200 dark:border-gray-800;\n      }\n      body {\n        @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n      }\n    </style>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/dist/main.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic-esbuild-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"node src/esbuild.run.js dev --port 5601\",\n    \"build\": \"node src/esbuild.run.js build && vue-tsc --noEmit\",\n    \"preview\": \"node src/esbuild.run.js preview\",\n    \"start\": \"pnpm dev\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"postcss\": \"^8.5.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"vue\": \"^3.5.16\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@eslint/js\": \"^9.36.0\",\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@typescript-eslint/eslint-plugin\": \"^8.44.1\",\n    \"@typescript-eslint/parser\": \"^8.44.1\",\n    \"esbuild\": \"^0.27.4\",\n    \"esbuild-plugin-vue3\": \"^0.5.1\",\n    \"eslint-plugin-vue\": \"^9.33.0\",\n    \"typescript\": \"^5.8.3\",\n    \"vue-eslint-parser\": \"^9.4.3\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/components/EditingAComponent.tsx",
    "content": "import { ref, defineComponent } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nexport const EditingAComponent = defineComponent({\n  setup() {\n    const navigate = useNavigate()\n    const input = ref('')\n\n    const blocker = useBlocker({\n      shouldBlockFn: ({ next }) => {\n        if (next.fullPath === '/editing-b' && input.value.length > 0) {\n          return true\n        }\n        return false\n      },\n      withResolver: true,\n    })\n\n    return () => (\n      <div>\n        <h1>Editing A</h1>\n        <label>\n          Enter your name:\n          <input\n            name=\"input\"\n            value={input.value}\n            onInput={(e) =>\n              (input.value = (e.target as HTMLInputElement).value)\n            }\n          />\n        </label>\n        <button onClick={() => navigate({ to: '/editing-b' })}>\n          Go to next step\n        </button>\n        {blocker.value.status === 'blocked' && (\n          <button onClick={() => blocker.value.proceed?.()}>Proceed</button>\n        )}\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/components/EditingBComponent.tsx",
    "content": "import { ref, toValue, defineComponent } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nexport const EditingBComponent = defineComponent({\n  setup() {\n    const navigate = useNavigate()\n    const input = ref('')\n\n    const blocker = useBlocker({\n      shouldBlockFn: () => !!toValue(input),\n      withResolver: true,\n    })\n\n    return () => (\n      <div>\n        <h1>Editing B</h1>\n        <label>\n          Enter your name:\n          <input\n            name=\"input\"\n            value={input.value}\n            onInput={(e) =>\n              (input.value = (e.target as HTMLInputElement).value)\n            }\n          />\n        </label>\n        <button onClick={() => navigate({ to: '/editing-a' })}>Go back</button>\n        {blocker.value.status === 'blocked' && (\n          <button onClick={() => blocker.value.proceed?.()}>Proceed</button>\n        )}\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/components/NotFoundComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <p>This is the notFoundComponent configured on root route</p>\n    <Link to=\"/\">Start Over</Link>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/components/NotRemountDepsComponent.tsx",
    "content": "import { ref, onMounted, defineComponent } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\nexport const NotRemountDepsComponent = defineComponent({\n  setup() {\n    // Component-scoped ref - will be recreated on component remount\n    const mounts = ref(0)\n    const search = useSearch({ from: '/notRemountDeps' })\n    const navigate = useNavigate()\n\n    onMounted(() => {\n      mounts.value++\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <button\n          onClick={() =>\n            navigate({\n              to: '/notRemountDeps',\n              search: {\n                searchParam: Math.random().toString(36).substring(2, 8),\n              },\n            })\n          }\n        >\n          Regenerate search param\n        </button>\n\n        <div>Search: {search.value.searchParam}</div>\n        <div data-testid=\"component-mounts\">\n          Page component mounts: {mounts.value}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/components/PostErrorComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { ErrorComponent } from '@tanstack/vue-router'\n\ndefineProps<{\n  error: any\n}>()\n</script>\n\n<template>\n  <ErrorComponent :error=\"error\" />\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/components/RemountDepsComponent.tsx",
    "content": "import { ref, onMounted, defineComponent } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\n// Module-scoped ref to persist across component remounts\nconst mounts = ref(0)\n\nexport const RemountDepsComponent = defineComponent({\n  setup() {\n    const search = useSearch({ from: '/remountDeps' })\n    const navigate = useNavigate()\n\n    onMounted(() => {\n      mounts.value++\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <button\n          onClick={() =>\n            navigate({\n              to: '/remountDeps',\n              search: {\n                searchParam: Math.random().toString(36).substring(2, 8),\n              },\n            })\n          }\n        >\n          Regenerate search param\n        </button>\n\n        <div>Search: {search.value.searchParam}</div>\n        <div data-testid=\"component-mounts\">\n          Page component mounts: {mounts.value}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/components/VueLogo.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, computed } from 'vue'\n\nconst props = withDefaults(\n  defineProps<{\n    /**\n     * Accepts any valid CSS color value as a string.\n     * Note: TypeScript cannot strictly check for all valid CSS colors at type level.\n     * For runtime validation, you could use a library or custom validator if desired.\n     */\n    textColor?: string\n  }>(),\n  {\n    textColor: 'gray',\n  },\n)\n\nconst count = ref(0)\n\nconst countLabel = computed(() => {\n  if (count.value === 0) return 'Click the logo!'\n  if (count.value === 1) return '1 click'\n  return `${count.value} clicks`\n})\n\nfunction increment() {\n  count.value++\n}\n\nfunction reset() {\n  count.value = 0\n}\n</script>\n\n<template>\n  <div class=\"vue-logo-container\">\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 261.76 226.69\"\n      class=\"vue-logo\"\n      @click=\"increment\"\n    >\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H-.005L130.872 226.69 261.749 0z\"\n        fill=\"#41b883\"\n      />\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H52.346l78.526 136.01L209.398.001z\"\n        fill=\"#34495e\"\n      />\n    </svg>\n    <p class=\"count-label\" :style=\"{ color: props.textColor }\">\n      {{ countLabel }}\n    </p>\n    <button v-if=\"count > 0\" class=\"reset-btn\" @click=\"reset\">Reset</button>\n  </div>\n</template>\n\n<style scoped>\n.vue-logo-container {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5rem;\n  margin: 1rem 0;\n}\n\n.vue-logo {\n  width: 64px;\n  height: 64px;\n  cursor: pointer;\n  transition: transform 0.2s ease;\n}\n\n.vue-logo:hover {\n  transform: scale(1.1);\n}\n\n.vue-logo:active {\n  transform: scale(0.95);\n}\n\n.count-label {\n  margin: 0;\n  font-size: 0.875rem;\n  color: #666;\n}\n\n.reset-btn {\n  padding: 0.25rem 0.5rem;\n  font-size: 0.75rem;\n  background: #41b883;\n  color: white;\n  border: none;\n  border-radius: 4px;\n  cursor: pointer;\n}\n\n.reset-btn:hover {\n  background: #34495e;\n}\n</style>\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/esbuild.config.js",
    "content": "import { tanstackRouter } from '@tanstack/router-plugin/esbuild'\nimport vuePlugin from 'esbuild-plugin-vue3'\n\nexport default {\n  // ...\n  plugins: [\n    vuePlugin({\n      cssInline: true,\n    }),\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n    }),\n  ],\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/esbuild.run.js",
    "content": "import * as esbuild from 'esbuild'\nimport http from 'node:http'\nimport { createReadStream } from 'node:fs'\nimport { promises as fs } from 'node:fs'\nimport path from 'node:path'\nimport esbuildConfig from './esbuild.config.js'\n\nconst args = process.argv.slice(2)\nconst command = args[0] ?? 'build'\n\nfunction getArgValue(name) {\n  const idx = args.indexOf(name)\n  if (idx === -1) return\n  return args[idx + 1]\n}\n\nfunction getPort() {\n  const fromArg = getArgValue('--port')\n  const fromEnv = process.env.VITE_SERVER_PORT\n  const port = Number(fromArg ?? fromEnv ?? 5601)\n  if (!Number.isFinite(port) || port <= 0) {\n    throw new Error(`Invalid port: ${String(fromArg ?? fromEnv)}`)\n  }\n  return port\n}\n\nfunction getMimeType(filePath) {\n  const ext = path.extname(filePath).toLowerCase()\n  switch (ext) {\n    case '.html':\n      return 'text/html; charset=utf-8'\n    case '.js':\n      return 'text/javascript; charset=utf-8'\n    case '.css':\n      return 'text/css; charset=utf-8'\n    case '.json':\n      return 'application/json; charset=utf-8'\n    case '.map':\n      return 'application/json; charset=utf-8'\n    case '.svg':\n      return 'image/svg+xml'\n    case '.png':\n      return 'image/png'\n    case '.jpg':\n    case '.jpeg':\n      return 'image/jpeg'\n    case '.webp':\n      return 'image/webp'\n    case '.ico':\n      return 'image/x-icon'\n    case '.woff':\n      return 'font/woff'\n    case '.woff2':\n      return 'font/woff2'\n    case '.ttf':\n      return 'font/ttf'\n    default:\n      return 'application/octet-stream'\n  }\n}\n\nasync function fileExists(filePath) {\n  try {\n    await fs.stat(filePath)\n    return true\n  } catch {\n    return false\n  }\n}\n\nasync function buildOnce() {\n  const entry = path.join(process.cwd(), 'src/main.tsx')\n  const outfile = path.join(process.cwd(), 'dist/main.js')\n  const inject = [path.join(process.cwd(), 'src/jsx-shim.ts')]\n\n  await esbuild.build({\n    entryPoints: [entry],\n    bundle: true,\n    outfile,\n    platform: 'browser',\n    format: 'esm',\n    jsx: 'transform',\n    jsxFactory: 'h',\n    jsxFragment: 'Fragment',\n    inject,\n    sourcemap: true,\n    define: {\n      'process.env.NODE_ENV': JSON.stringify(\n        process.env.VITE_NODE_ENV ?? process.env.NODE_ENV ?? 'development',\n      ),\n    },\n    ...esbuildConfig,\n  })\n}\n\nfunction startStaticServer({ port }) {\n  const rootDir = process.cwd()\n  const indexPath = path.join(rootDir, 'index.html')\n\n  const server = http.createServer(async (req, res) => {\n    try {\n      const url = new URL(\n        req.url ?? '/',\n        `http://${req.headers.host ?? 'localhost'}`,\n      )\n      const requestPath = decodeURIComponent(url.pathname)\n\n      const normalizedPath = path.posix\n        .normalize(requestPath)\n        .replace(/^(\\.\\.(\\/|\\\\|$))+/, '')\n        .replace(/^\\/+/, '')\n\n      const filePath = path.join(rootDir, normalizedPath)\n\n      const hasExtension = path.posix.basename(normalizedPath).includes('.')\n\n      const servedPath =\n        (await fileExists(filePath)) && !(await fs.stat(filePath)).isDirectory()\n          ? filePath\n          : !hasExtension\n            ? indexPath\n            : undefined\n\n      if (!servedPath) {\n        res.statusCode = 404\n        res.end('Not found')\n        return\n      }\n\n      res.statusCode = 200\n      res.setHeader('Content-Type', getMimeType(servedPath))\n      createReadStream(servedPath).pipe(res)\n    } catch (err) {\n      res.statusCode = 500\n      res.end(String(err))\n    }\n  })\n\n  return new Promise((resolve) => {\n    server.listen(port, () => {\n      console.log(`http://localhost:${port}`)\n      resolve(server)\n    })\n  })\n}\n\nasync function main() {\n  if (command === 'build') {\n    await buildOnce()\n    return\n  }\n\n  if (command === 'preview') {\n    const port = getPort()\n    await startStaticServer({ port })\n    return\n  }\n\n  if (command === 'dev') {\n    const port = getPort()\n    const inject = [path.join(process.cwd(), 'src/jsx-shim.ts')]\n    const ctx = await esbuild.context({\n      entryPoints: [path.join(process.cwd(), 'src/main.tsx')],\n      bundle: true,\n      outfile: path.join(process.cwd(), 'dist/main.js'),\n      platform: 'browser',\n      format: 'esm',\n      jsx: 'transform',\n      jsxFactory: 'h',\n      jsxFragment: 'Fragment',\n      inject,\n      sourcemap: true,\n      define: {\n        'process.env.NODE_ENV': JSON.stringify(\n          process.env.VITE_NODE_ENV ?? process.env.NODE_ENV ?? 'development',\n        ),\n      },\n      ...esbuildConfig,\n    })\n\n    await ctx.watch()\n    await startStaticServer({ port })\n    return\n  }\n\n  throw new Error(`Unknown command: ${command}`)\n}\n\nmain().catch((err) => {\n  console.error(err)\n  process.exit(1)\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/jsx-shim.ts",
    "content": "import { Fragment, h } from 'vue'\n\nexport { Fragment, h }\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/main.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport { createApp } from 'vue'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { lazyRouteComponent } from '@tanstack/vue-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as Char45824Char54620Char48124Char44397RouteImport } from './routes/대한민국'\nimport { Route as SfcComponentRouteImport } from './routes/sfcComponent'\nimport { Route as RemountDepsRouteImport } from './routes/remountDeps'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'\nimport { Route as EditingBRouteImport } from './routes/editing-b'\nimport { Route as EditingARouteImport } from './routes/editing-a'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'\nimport { Route as groupInsideRouteImport } from './routes/(group)/inside'\nimport { Route as groupLayoutRouteImport } from './routes/(group)/_layout'\nimport { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside'\nimport { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside'\nimport { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout'\n\nconst Char45824Char54620Char48124Char44397Route =\n  Char45824Char54620Char48124Char44397RouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst SfcComponentRoute = SfcComponentRouteImport.update({\n  id: '/sfcComponent',\n  path: '/sfcComponent',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/sfcComponent.component.vue'),\n    'default',\n  ),\n})\nconst RemountDepsRoute = RemountDepsRouteImport.update({\n  id: '/remountDeps',\n  path: '/remountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotRemountDepsRoute = NotRemountDepsRouteImport.update({\n  id: '/notRemountDeps',\n  path: '/notRemountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingBRoute = EditingBRouteImport.update({\n  id: '/editing-b',\n  path: '/editing-b',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingARoute = EditingARouteImport.update({\n  id: '/editing-a',\n  path: '/editing-a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst groupLazyinsideRoute = groupLazyinsideRouteImport.update({\n  id: '/(group)/lazyinside',\n  path: '/lazyinside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupInsideRoute = groupInsideRouteImport.update({\n  id: '/(group)/inside',\n  path: '/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutRoute = groupLayoutRouteImport.update({\n  id: '/(group)/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst anotherGroupOnlyrouteinsideRoute =\n  anotherGroupOnlyrouteinsideRouteImport.update({\n    id: '/(another-group)/onlyrouteinside',\n    path: '/onlyrouteinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({\n  id: '/posts_/$postId/edit',\n  path: '/posts/$postId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst groupSubfolderInsideRoute = groupSubfolderInsideRouteImport.update({\n  id: '/(group)/subfolder/inside',\n  path: '/subfolder/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({\n  id: '/insidelayout',\n  path: '/insidelayout',\n  getParentRoute: () => groupLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/inside': typeof groupInsideRoute\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts_/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/(another-group)/onlyrouteinside'\n    | '/(group)/_layout'\n    | '/(group)/inside'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/(group)/_layout/insidelayout'\n    | '/(group)/subfolder/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/posts_/$postId/edit'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  EditingARoute: typeof EditingARoute\n  EditingBRoute: typeof EditingBRoute\n  NotRemountDepsRoute: typeof NotRemountDepsRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RemountDepsRoute: typeof RemountDepsRoute\n  SfcComponentRoute: typeof SfcComponentRoute\n  Char45824Char54620Char48124Char44397Route: typeof Char45824Char54620Char48124Char44397Route\n  anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupInsideRoute: typeof groupInsideRoute\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n  groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute\n  PostsPostIdEditRoute: typeof PostsPostIdEditRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/대한민국': {\n      id: '/대한민국'\n      path: '/대한민국'\n      fullPath: '/대한민국'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/sfcComponent': {\n      id: '/sfcComponent'\n      path: '/sfcComponent'\n      fullPath: '/sfcComponent'\n      preLoaderRoute: typeof SfcComponentRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/remountDeps': {\n      id: '/remountDeps'\n      path: '/remountDeps'\n      fullPath: '/remountDeps'\n      preLoaderRoute: typeof RemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/notRemountDeps': {\n      id: '/notRemountDeps'\n      path: '/notRemountDeps'\n      fullPath: '/notRemountDeps'\n      preLoaderRoute: typeof NotRemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-b': {\n      id: '/editing-b'\n      path: '/editing-b'\n      fullPath: '/editing-b'\n      preLoaderRoute: typeof EditingBRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-a': {\n      id: '/editing-a'\n      path: '/editing-a'\n      fullPath: '/editing-a'\n      preLoaderRoute: typeof EditingARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/inside': {\n      id: '/(group)/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(another-group)/onlyrouteinside': {\n      id: '/(another-group)/onlyrouteinside'\n      path: '/onlyrouteinside'\n      fullPath: '/onlyrouteinside'\n      preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/edit': {\n      id: '/posts_/$postId/edit'\n      path: '/posts/$postId/edit'\n      fullPath: '/posts/$postId/edit'\n      preLoaderRoute: typeof PostsPostIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/(group)/subfolder/inside': {\n      id: '/(group)/subfolder/inside'\n      path: '/subfolder/inside'\n      fullPath: '/subfolder/inside'\n      preLoaderRoute: typeof groupSubfolderInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout/insidelayout': {\n      id: '/(group)/_layout/insidelayout'\n      path: '/insidelayout'\n      fullPath: '/insidelayout'\n      preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport\n      parentRoute: typeof groupLayoutRoute\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  EditingARoute: EditingARoute,\n  EditingBRoute: EditingBRoute,\n  NotRemountDepsRoute: NotRemountDepsRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RemountDepsRoute: RemountDepsRoute,\n  SfcComponentRoute: SfcComponentRoute,\n  Char45824Char54620Char48124Char44397Route:\n    Char45824Char54620Char48124Char44397Route,\n  anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupInsideRoute: groupInsideRoute,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n  groupSubfolderInsideRoute: groupSubfolderInsideRoute,\n  PostsPostIdEditRoute: PostsPostIdEditRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/(another-group)/onlyrouteinside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(another-group)/onlyrouteinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: OnlyRouteInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(another-group)/onlyrouteinside')\n\nfunction OnlyRouteInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(another-group)/onlyrouteinside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/(group)/_layout.insidelayout.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/_layout/insidelayout')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: InsideLayoutComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/_layout/insidelayout')\n\nfunction InsideLayoutComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({\n  component: GroupLayoutComponent,\n})\n\nfunction GroupLayoutComponent() {\n  return (\n    <div>\n      <div>Layout inside group</div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/(group)/inside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: InsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/inside')\n\nfunction InsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/inside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: LazyInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nfunction LazyInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/lazyinside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/(group)/subfolder/inside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/subfolder/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: SubfolderInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/subfolder/inside')\n\nfunction SubfolderInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/subfolder/inside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n  useCanGoBack,\n  useRouter,\n  useRouterState,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport NotFoundComponent from '../components/NotFoundComponent.vue'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: NotFoundComponent,\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const canGoBack = useCanGoBack()\n  // test useRouterState doesn't crash client side navigation\n  const _state = useRouterState()\n\n  return (\n    <>\n      <HeadContent />\n      <div class=\"flex gap-2 p-2 text-lg border-b\">\n        <button\n          data-testid=\"back-button\"\n          disabled={!canGoBack.value}\n          onClick={() => router.history.back()}\n          class={!canGoBack.value ? 'line-through' : ''}\n        >\n          Back\n        </button>\n        <Link\n          to=\"/\"\n          activeProps={{ class: 'font-bold' }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>\n        <Link to=\"/posts\" activeProps={{ class: 'font-bold' }}>\n          Posts\n        </Link>\n        <Link to=\"/layout-a\" activeProps={{ class: 'font-bold' }}>\n          Layout\n        </Link>\n        <Link\n          to=\"/onlyrouteinside\"\n          data-testid=\"link-to-only-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Only Route Inside Group\n        </Link>\n        <Link\n          to=\"/inside\"\n          data-testid=\"link-to-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Group\n        </Link>\n        <Link\n          to=\"/subfolder/inside\"\n          data-testid=\"link-to-route-inside-group-inside-subfolder\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Subfolder Inside Group\n        </Link>\n        <Link\n          to=\"/insidelayout\"\n          data-testid=\"link-to-route-inside-group-inside-layout\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Group Inside Layout\n        </Link>\n        <Link\n          to=\"/lazyinside\"\n          data-testid=\"link-to-lazy-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Lazy Inside Group\n        </Link>\n        <Link to=\"/대한민국\" activeProps={{ class: 'font-bold' }}>\n          unicode path\n        </Link>\n        <Link\n          to={'/this-route-does-not-exist' as any}\n          activeProps={{ class: 'font-bold' }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link to=\"/layout-a\" activeProps={{ class: 'font-bold' }}>\n          Layout A\n        </Link>\n        <Link to=\"/layout-b\" activeProps={{ class: 'font-bold' }}>\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/editing-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { EditingAComponent } from '../components/EditingAComponent'\n\nexport const Route = createFileRoute('/editing-a')({\n  component: EditingAComponent,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/editing-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { EditingBComponent } from '../components/EditingBComponent'\n\nexport const Route = createFileRoute('/editing-b')({\n  component: EditingBComponent,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport VueLogo from '../components/VueLogo.vue'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <VueLogo textColor=\"orange\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/notRemountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { NotRemountDepsComponent } from '../components/NotRemountDepsComponent'\n\nexport const Route = createFileRoute('/notRemountDeps')({\n  validateSearch: (search: Record<string, unknown>) => ({\n    searchParam: (search.searchParam as string) || '',\n  }),\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.params\n  },\n  component: NotRemountDepsComponent,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport PostErrorComponent from '../components/PostErrorComponent.vue'\nimport { fetchPost } from '../posts'\nimport type { PostType } from '../posts'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  component: PostComponent,\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => <p>Post not found</p>,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\" data-testid=\"post-title\">\n        {(post.value as PostType).title}\n      </h4>\n      <div class=\"text-sm\">{(post.value as PostType).body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../posts'\nimport type { PostType } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\" data-testid=\"posts-links\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...(posts.value as Array<PostType>),\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => (\n          <li key={post.id} class=\"whitespace-nowrap\">\n            <Link\n              to=\"/posts/$postId\"\n              params={{ postId: post.id }}\n              class=\"block py-1 text-blue-600 hover:opacity-75\"\n              activeProps={{ class: 'font-bold underline' }}\n            >\n              <div>{post.title.substring(0, 20)}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/posts_.$postId.edit.tsx",
    "content": "import { createFileRoute, getRouteApi, useParams } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts_/$postId/edit')({\n  component: PostEditComponent,\n})\n\nconst api = getRouteApi('/posts_/$postId/edit')\n\nfunction PostEditComponent() {\n  const paramsViaApi = api.useParams()\n  const paramsViaHook = useParams({ from: '/posts_/$postId/edit' })\n  const paramsViaRouteHook = api.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"params-via-hook\">{paramsViaHook.value.postId}</div>\n      <div data-testid=\"params-via-route-hook\">\n        {paramsViaRouteHook.value.postId}\n      </div>\n      <div data-testid=\"params-via-route-api\">{paramsViaApi.value.postId}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/remountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { RemountDepsComponent } from '../components/RemountDepsComponent'\n\nexport const Route = createFileRoute('/remountDeps')({\n  validateSearch: (search: Record<string, unknown>) => ({\n    searchParam: (search.searchParam as string) || '',\n  }),\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.search\n  },\n  component: RemountDepsComponent,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/sfcComponent.component.vue",
    "content": "<script setup lang=\"ts\">\nimport VueLogo from '../components/VueLogo.vue'\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <h3>Vue SFC!</h3>\n    <VueLogo text-color=\"orange\" />\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/sfcComponent.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/sfcComponent')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Will be overwritten by the SFC component!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/routes/대한민국.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/대한민국')({\n  component: UnicodeComponent,\n})\n\nfunction UnicodeComponent() {\n  return (\n    <div>\n      <h3 class=\"pb-2\" data-testid=\"unicode-heading\">\n        Hello \"/대한민국\"!\n      </h3>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/styles.css",
    "content": "@source \"./**/*.tsx\";\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/src/vue-shims.d.ts",
    "content": "declare module '*.vue' {\n  import type { DefineComponent } from 'vue'\n  const component: DefineComponent<{}, {}, any>\n  export default component\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest(\"useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest('useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest(\"legacy useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('legacy useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('legacy Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('useCanGoBack correctly disables back button', async ({ page }) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goForward()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\ntest('useCanGoBack correctly disables back button, using router.history and window.history', async ({\n  page,\n}) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\nconst testCases = [\n  {\n    description: 'Navigating to a route inside a route group',\n    testId: 'link-to-route-inside-group',\n  },\n  {\n    description:\n      'Navigating to a route inside a subfolder inside a route group ',\n    testId: 'link-to-route-inside-group-inside-subfolder',\n  },\n  {\n    description: 'Navigating to a route inside a route group inside a layout',\n    testId: 'link-to-route-inside-group-inside-layout',\n  },\n  {\n    description: 'Navigating to a lazy route inside a route group',\n    testId: 'link-to-lazy-route-inside-group',\n  },\n\n  {\n    description: 'Navigating to the only route inside a route group ',\n    testId: 'link-to-only-route-inside-group',\n  },\n]\n\ntestCases.forEach(({ description, testId }) => {\n  test(description, async ({ page }) => {\n    await page.getByTestId(testId).click()\n    await expect(page.getByTestId('search-via-hook')).toContainText('world')\n    await expect(page.getByTestId('search-via-route-hook')).toContainText(\n      'world',\n    )\n    await expect(page.getByTestId('search-via-route-api')).toContainText(\n      'world',\n    )\n  })\n})\n\ntest('navigating to an unnested route', async ({ page }) => {\n  const postId = 'hello-world'\n  page.goto(`/posts/${postId}/edit`)\n  await expect(page.getByTestId('params-via-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-api')).toContainText(postId)\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n\ntest('Should change post navigating back and forth', async ({ page }) => {\n  await page.goto('/posts/1')\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n\n  await page.getByRole('link', { name: 'qui est esse' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('qui est esse')\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('sunt aut facere')\n})\n\ntest('Should not remount deps when remountDeps does not change ', async ({\n  page,\n}) => {\n  await page.goto('/notRemountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n})\n\ntest('Should remount deps when remountDeps does change ', async ({ page }) => {\n  await page.goto('/remountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 2',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 3',\n  )\n})\n\ntest.describe('Unicode route rendering', () => {\n  test('should render non-latin route correctly', async ({ page, baseURL }) => {\n    await page.goto('/대한민국')\n\n    await expect(page.locator('body')).toContainText('Hello \"/대한민국\"!')\n\n    expect(page.url()).toBe(`${baseURL}/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`)\n  })\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-esbuild-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"strict\": true,\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"noEmit\": true,\n    \"resolveJsonModule\": true,\n    \"types\": [\"vite/client\"],\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\"\n  },\n  \"include\": [\"src\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/eslint.config.js",
    "content": "import js from '@eslint/js'\nimport typescript from '@typescript-eslint/eslint-plugin'\nimport typescriptParser from '@typescript-eslint/parser'\nimport vue from 'eslint-plugin-vue'\nimport vueParser from 'vue-eslint-parser'\n\nexport default [\n  js.configs.recommended,\n  ...vue.configs['flat/recommended'],\n  {\n    files: ['**/*.{js,jsx,ts,tsx,vue}'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n        ecmaVersion: 'latest',\n        sourceType: 'module',\n        ecmaFeatures: {\n          jsx: true,\n        },\n      },\n    },\n    plugins: {\n      '@typescript-eslint': typescript,\n      vue,\n    },\n    rules: {\n      // Vue specific rules\n      'vue/multi-word-component-names': 'off',\n      'vue/no-unused-vars': 'error',\n\n      // TypeScript rules\n      '@typescript-eslint/no-unused-vars': 'error',\n      '@typescript-eslint/no-explicit-any': 'warn',\n\n      // General rules\n      'no-unused-vars': 'off', // Let TypeScript handle this\n    },\n  },\n  {\n    files: ['**/*.vue'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n      },\n    },\n  },\n]\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic-file-based-jsx\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && vue-tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@eslint/js\": \"^9.36.0\",\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@typescript-eslint/eslint-plugin\": \"^8.44.1\",\n    \"@typescript-eslint/parser\": \"^8.44.1\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"eslint-plugin-vue\": \"^9.33.0\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-eslint-parser\": \"^9.4.3\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/components/EditingAComponent.tsx",
    "content": "import { ref, defineComponent } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nexport const EditingAComponent = defineComponent({\n  setup() {\n    const navigate = useNavigate()\n    const input = ref('')\n\n    const blocker = useBlocker({\n      shouldBlockFn: ({ next }) => {\n        if (next.fullPath === '/editing-b' && input.value.length > 0) {\n          return true\n        }\n        return false\n      },\n      withResolver: true,\n    })\n\n    return () => (\n      <div>\n        <h1>Editing A</h1>\n        <label>\n          Enter your name:\n          <input\n            name=\"input\"\n            value={input.value}\n            onInput={(e) =>\n              (input.value = (e.target as HTMLInputElement).value)\n            }\n          />\n        </label>\n        <button onClick={() => navigate({ to: '/editing-b' })}>\n          Go to next step\n        </button>\n        {blocker.value.status === 'blocked' && (\n          <button onClick={() => blocker.value.proceed?.()}>Proceed</button>\n        )}\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/components/EditingBComponent.tsx",
    "content": "import { ref, toValue, defineComponent } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nexport const EditingBComponent = defineComponent({\n  setup() {\n    const navigate = useNavigate()\n    const input = ref('')\n\n    const blocker = useBlocker({\n      shouldBlockFn: () => !!toValue(input),\n      withResolver: true,\n    })\n\n    return () => (\n      <div>\n        <h1>Editing B</h1>\n        <label>\n          Enter your name:\n          <input\n            name=\"input\"\n            value={input.value}\n            onInput={(e) =>\n              (input.value = (e.target as HTMLInputElement).value)\n            }\n          />\n        </label>\n        <button onClick={() => navigate({ to: '/editing-a' })}>Go back</button>\n        {blocker.value.status === 'blocked' && (\n          <button onClick={() => blocker.value.proceed?.()}>Proceed</button>\n        )}\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/components/NotFoundComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <p>This is the notFoundComponent configured on root route</p>\n    <Link to=\"/\">Start Over</Link>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/components/NotRemountDepsComponent.tsx",
    "content": "import { ref, onMounted, defineComponent } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\nexport const NotRemountDepsComponent = defineComponent({\n  setup() {\n    // Component-scoped ref - will be recreated on component remount\n    const mounts = ref(0)\n    const search = useSearch({ from: '/notRemountDeps' })\n    const navigate = useNavigate()\n\n    onMounted(() => {\n      mounts.value++\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <button\n          onClick={() =>\n            navigate({\n              to: '/notRemountDeps',\n              search: {\n                searchParam: Math.random().toString(36).substring(2, 8),\n              },\n            })\n          }\n        >\n          Regenerate search param\n        </button>\n\n        <div>Search: {search.value.searchParam}</div>\n        <div data-testid=\"component-mounts\">\n          Page component mounts: {mounts.value}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/components/PostErrorComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { ErrorComponent } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\ndefineProps<ErrorComponentProps>()\n</script>\n\n<template>\n  <ErrorComponent :error=\"error\" />\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/components/RemountDepsComponent.tsx",
    "content": "import { ref, onMounted, defineComponent } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\n// Module-scoped ref to persist across component remounts\nconst mounts = ref(0)\n\nexport const RemountDepsComponent = defineComponent({\n  setup() {\n    const search = useSearch({ from: '/remountDeps' })\n    const navigate = useNavigate()\n\n    onMounted(() => {\n      mounts.value++\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <button\n          onClick={() =>\n            navigate({\n              to: '/remountDeps',\n              search: {\n                searchParam: Math.random().toString(36).substring(2, 8),\n              },\n            })\n          }\n        >\n          Regenerate search param\n        </button>\n\n        <div>Search: {search.value.searchParam}</div>\n        <div data-testid=\"component-mounts\">\n          Page component mounts: {mounts.value}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/components/VueLogo.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, computed } from 'vue'\n\nconst props = withDefaults(\n  defineProps<{\n    /**\n     * Accepts any valid CSS color value as a string.\n     * Note: TypeScript cannot strictly check for all valid CSS colors at type level.\n     * For runtime validation, you could use a library or custom validator if desired.\n     */\n    textColor?: string\n  }>(),\n  {\n    textColor: 'gray',\n  },\n)\n\nconst count = ref(0)\n\nconst countLabel = computed(() => {\n  if (count.value === 0) return 'Click the logo!'\n  if (count.value === 1) return '1 click'\n  return `${count.value} clicks`\n})\n\nfunction increment() {\n  count.value++\n}\n\nfunction reset() {\n  count.value = 0\n}\n</script>\n\n<template>\n  <div class=\"vue-logo-container\">\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 261.76 226.69\"\n      class=\"vue-logo\"\n      @click=\"increment\"\n    >\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H-.005L130.872 226.69 261.749 0z\"\n        fill=\"#41b883\"\n      />\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H52.346l78.526 136.01L209.398.001z\"\n        fill=\"#34495e\"\n      />\n    </svg>\n    <p class=\"count-label\" :style=\"{ color: props.textColor }\">\n      {{ countLabel }}\n    </p>\n    <button v-if=\"count > 0\" class=\"reset-btn\" @click=\"reset\">Reset</button>\n  </div>\n</template>\n\n<style scoped>\n.vue-logo-container {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5rem;\n  margin: 1rem 0;\n}\n\n.vue-logo {\n  width: 64px;\n  height: 64px;\n  cursor: pointer;\n  transition: transform 0.2s ease;\n}\n\n.vue-logo:hover {\n  transform: scale(1.1);\n}\n\n.vue-logo:active {\n  transform: scale(0.95);\n}\n\n.count-label {\n  margin: 0;\n  font-size: 0.875rem;\n  color: #666;\n}\n\n.reset-btn {\n  padding: 0.25rem 0.5rem;\n  font-size: 0.75rem;\n  background: #41b883;\n  color: white;\n  border: none;\n  border-radius: 4px;\n  cursor: pointer;\n}\n\n.reset-btn:hover {\n  background: #34495e;\n}\n</style>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/main.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\nimport { createApp } from 'vue'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { lazyRouteComponent } from '@tanstack/vue-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as Char45824Char54620Char48124Char44397RouteImport } from './routes/대한민국'\nimport { Route as SfcComponentRouteImport } from './routes/sfcComponent'\nimport { Route as RemountDepsRouteImport } from './routes/remountDeps'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'\nimport { Route as EditingBRouteImport } from './routes/editing-b'\nimport { Route as EditingARouteImport } from './routes/editing-a'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'\nimport { Route as groupInsideRouteImport } from './routes/(group)/inside'\nimport { Route as groupLayoutRouteImport } from './routes/(group)/_layout'\nimport { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside'\nimport { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside'\nimport { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout'\n\nconst Char45824Char54620Char48124Char44397Route =\n  Char45824Char54620Char48124Char44397RouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst SfcComponentRoute = SfcComponentRouteImport.update({\n  id: '/sfcComponent',\n  path: '/sfcComponent',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/sfcComponent.component.vue'),\n    'default',\n  ),\n})\nconst RemountDepsRoute = RemountDepsRouteImport.update({\n  id: '/remountDeps',\n  path: '/remountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotRemountDepsRoute = NotRemountDepsRouteImport.update({\n  id: '/notRemountDeps',\n  path: '/notRemountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingBRoute = EditingBRouteImport.update({\n  id: '/editing-b',\n  path: '/editing-b',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingARoute = EditingARouteImport.update({\n  id: '/editing-a',\n  path: '/editing-a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst groupLazyinsideRoute = groupLazyinsideRouteImport.update({\n  id: '/(group)/lazyinside',\n  path: '/lazyinside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupInsideRoute = groupInsideRouteImport.update({\n  id: '/(group)/inside',\n  path: '/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutRoute = groupLayoutRouteImport.update({\n  id: '/(group)/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst anotherGroupOnlyrouteinsideRoute =\n  anotherGroupOnlyrouteinsideRouteImport.update({\n    id: '/(another-group)/onlyrouteinside',\n    path: '/onlyrouteinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({\n  id: '/posts_/$postId/edit',\n  path: '/posts/$postId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst groupSubfolderInsideRoute = groupSubfolderInsideRouteImport.update({\n  id: '/(group)/subfolder/inside',\n  path: '/subfolder/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({\n  id: '/insidelayout',\n  path: '/insidelayout',\n  getParentRoute: () => groupLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/inside': typeof groupInsideRoute\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts_/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/(another-group)/onlyrouteinside'\n    | '/(group)/_layout'\n    | '/(group)/inside'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/(group)/_layout/insidelayout'\n    | '/(group)/subfolder/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/posts_/$postId/edit'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  EditingARoute: typeof EditingARoute\n  EditingBRoute: typeof EditingBRoute\n  NotRemountDepsRoute: typeof NotRemountDepsRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RemountDepsRoute: typeof RemountDepsRoute\n  SfcComponentRoute: typeof SfcComponentRoute\n  Char45824Char54620Char48124Char44397Route: typeof Char45824Char54620Char48124Char44397Route\n  anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupInsideRoute: typeof groupInsideRoute\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n  groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute\n  PostsPostIdEditRoute: typeof PostsPostIdEditRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/대한민국': {\n      id: '/대한민국'\n      path: '/대한민국'\n      fullPath: '/대한민국'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/sfcComponent': {\n      id: '/sfcComponent'\n      path: '/sfcComponent'\n      fullPath: '/sfcComponent'\n      preLoaderRoute: typeof SfcComponentRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/remountDeps': {\n      id: '/remountDeps'\n      path: '/remountDeps'\n      fullPath: '/remountDeps'\n      preLoaderRoute: typeof RemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/notRemountDeps': {\n      id: '/notRemountDeps'\n      path: '/notRemountDeps'\n      fullPath: '/notRemountDeps'\n      preLoaderRoute: typeof NotRemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-b': {\n      id: '/editing-b'\n      path: '/editing-b'\n      fullPath: '/editing-b'\n      preLoaderRoute: typeof EditingBRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-a': {\n      id: '/editing-a'\n      path: '/editing-a'\n      fullPath: '/editing-a'\n      preLoaderRoute: typeof EditingARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/inside': {\n      id: '/(group)/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(another-group)/onlyrouteinside': {\n      id: '/(another-group)/onlyrouteinside'\n      path: '/onlyrouteinside'\n      fullPath: '/onlyrouteinside'\n      preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/edit': {\n      id: '/posts_/$postId/edit'\n      path: '/posts/$postId/edit'\n      fullPath: '/posts/$postId/edit'\n      preLoaderRoute: typeof PostsPostIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/(group)/subfolder/inside': {\n      id: '/(group)/subfolder/inside'\n      path: '/subfolder/inside'\n      fullPath: '/subfolder/inside'\n      preLoaderRoute: typeof groupSubfolderInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout/insidelayout': {\n      id: '/(group)/_layout/insidelayout'\n      path: '/insidelayout'\n      fullPath: '/insidelayout'\n      preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport\n      parentRoute: typeof groupLayoutRoute\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  EditingARoute: EditingARoute,\n  EditingBRoute: EditingBRoute,\n  NotRemountDepsRoute: NotRemountDepsRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RemountDepsRoute: RemountDepsRoute,\n  SfcComponentRoute: SfcComponentRoute,\n  Char45824Char54620Char48124Char44397Route:\n    Char45824Char54620Char48124Char44397Route,\n  anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupInsideRoute: groupInsideRoute,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n  groupSubfolderInsideRoute: groupSubfolderInsideRoute,\n  PostsPostIdEditRoute: PostsPostIdEditRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/(another-group)/onlyrouteinside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(another-group)/onlyrouteinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: OnlyRouteInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(another-group)/onlyrouteinside')\n\nfunction OnlyRouteInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(another-group)/onlyrouteinside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/(group)/_layout.insidelayout.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/_layout/insidelayout')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: InsideLayoutComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/_layout/insidelayout')\n\nfunction InsideLayoutComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/(group)/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({\n  component: GroupLayoutComponent,\n})\n\nfunction GroupLayoutComponent() {\n  return (\n    <div>\n      <div>Layout inside group</div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/(group)/inside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: InsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/inside')\n\nfunction InsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/inside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/(group)/lazyinside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: LazyInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nfunction LazyInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/lazyinside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/(group)/subfolder/inside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/subfolder/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: SubfolderInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/subfolder/inside')\n\nfunction SubfolderInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/subfolder/inside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n  useCanGoBack,\n  useRouter,\n  useRouterState,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport NotFoundComponent from '../components/NotFoundComponent.vue'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: NotFoundComponent,\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const canGoBack = useCanGoBack()\n  // test useRouterState doesn't crash client side navigation\n  const _state = useRouterState()\n\n  return (\n    <>\n      <HeadContent />\n      <div class=\"flex gap-2 p-2 text-lg border-b\">\n        <button\n          data-testid=\"back-button\"\n          disabled={!canGoBack.value}\n          onClick={() => router.history.back()}\n          class={!canGoBack.value ? 'line-through' : ''}\n        >\n          Back\n        </button>\n        <Link\n          to=\"/\"\n          activeProps={{ class: 'font-bold' }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>\n        <Link to=\"/posts\" activeProps={{ class: 'font-bold' }}>\n          Posts\n        </Link>\n        <Link to=\"/layout-a\" activeProps={{ class: 'font-bold' }}>\n          Layout\n        </Link>\n        <Link\n          to=\"/onlyrouteinside\"\n          data-testid=\"link-to-only-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Only Route Inside Group\n        </Link>\n        <Link\n          to=\"/inside\"\n          data-testid=\"link-to-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Group\n        </Link>\n        <Link\n          to=\"/subfolder/inside\"\n          data-testid=\"link-to-route-inside-group-inside-subfolder\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Subfolder Inside Group\n        </Link>\n        <Link\n          to=\"/insidelayout\"\n          data-testid=\"link-to-route-inside-group-inside-layout\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Group Inside Layout\n        </Link>\n        <Link\n          to=\"/lazyinside\"\n          data-testid=\"link-to-lazy-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Lazy Inside Group\n        </Link>\n        <Link to=\"/대한민국\" activeProps={{ class: 'font-bold' }}>\n          unicode path\n        </Link>\n        <Link\n          to={'/this-route-does-not-exist' as any}\n          activeProps={{ class: 'font-bold' }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link to=\"/layout-a\" activeProps={{ class: 'font-bold' }}>\n          Layout A\n        </Link>\n        <Link to=\"/layout-b\" activeProps={{ class: 'font-bold' }}>\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/editing-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { EditingAComponent } from '../components/EditingAComponent'\n\nexport const Route = createFileRoute('/editing-a')({\n  component: EditingAComponent,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/editing-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { EditingBComponent } from '../components/EditingBComponent'\n\nexport const Route = createFileRoute('/editing-b')({\n  component: EditingBComponent,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport VueLogo from '../components/VueLogo.vue'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <VueLogo textColor=\"orange\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/notRemountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { NotRemountDepsComponent } from '../components/NotRemountDepsComponent'\n\nexport const Route = createFileRoute('/notRemountDeps')({\n  validateSearch: (search: Record<string, unknown>) => ({\n    searchParam: (search.searchParam as string) || '',\n  }),\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.params\n  },\n  component: NotRemountDepsComponent,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport PostErrorComponent from '../components/PostErrorComponent.vue'\nimport { fetchPost } from '../posts'\nimport type { PostType } from '../posts'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  component: PostComponent,\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => <p>Post not found</p>,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\" data-testid=\"post-title\">\n        {(post.value as PostType).title}\n      </h4>\n      <div class=\"text-sm\">{(post.value as PostType).body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../posts'\nimport type { PostType } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\" data-testid=\"posts-links\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...(posts.value as Array<PostType>),\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => (\n          <li key={post.id} class=\"whitespace-nowrap\">\n            <Link\n              to=\"/posts/$postId\"\n              params={{ postId: post.id }}\n              class=\"block py-1 text-blue-600 hover:opacity-75\"\n              activeProps={{ class: 'font-bold underline' }}\n            >\n              <div>{post.title.substring(0, 20)}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/posts_.$postId.edit.tsx",
    "content": "import { createFileRoute, getRouteApi, useParams } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts_/$postId/edit')({\n  component: PostEditComponent,\n})\n\nconst api = getRouteApi('/posts_/$postId/edit')\n\nfunction PostEditComponent() {\n  const paramsViaApi = api.useParams()\n  const paramsViaHook = useParams({ from: '/posts_/$postId/edit' })\n  const paramsViaRouteHook = api.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"params-via-hook\">{paramsViaHook.value.postId}</div>\n      <div data-testid=\"params-via-route-hook\">\n        {paramsViaRouteHook.value.postId}\n      </div>\n      <div data-testid=\"params-via-route-api\">{paramsViaApi.value.postId}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/remountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { RemountDepsComponent } from '../components/RemountDepsComponent'\n\nexport const Route = createFileRoute('/remountDeps')({\n  validateSearch: (search: Record<string, unknown>) => ({\n    searchParam: (search.searchParam as string) || '',\n  }),\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.search\n  },\n  component: RemountDepsComponent,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/sfcComponent.component.vue",
    "content": "<script setup lang=\"ts\">\nimport VueLogo from '../components/VueLogo.vue'\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <h3>Vue SFC!</h3>\n    <VueLogo text-color=\"orange\" />\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/sfcComponent.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/sfcComponent')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Will be overwritten by the SFC component!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/routes/대한민국.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/대한민국')({\n  component: UnicodeComponent,\n})\n\nfunction UnicodeComponent() {\n  return (\n    <div>\n      <h3 class=\"pb-2\" data-testid=\"unicode-heading\">\n        Hello \"/대한민국\"!\n      </h3>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source \"./**/*.tsx\";\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest(\"useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest('useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest(\"legacy useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('legacy useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('legacy Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('useCanGoBack correctly disables back button', async ({ page }) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goForward()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\ntest('useCanGoBack correctly disables back button, using router.history and window.history', async ({\n  page,\n}) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\nconst testCases = [\n  {\n    description: 'Navigating to a route inside a route group',\n    testId: 'link-to-route-inside-group',\n  },\n  {\n    description:\n      'Navigating to a route inside a subfolder inside a route group ',\n    testId: 'link-to-route-inside-group-inside-subfolder',\n  },\n  {\n    description: 'Navigating to a route inside a route group inside a layout',\n    testId: 'link-to-route-inside-group-inside-layout',\n  },\n  {\n    description: 'Navigating to a lazy route inside a route group',\n    testId: 'link-to-lazy-route-inside-group',\n  },\n\n  {\n    description: 'Navigating to the only route inside a route group ',\n    testId: 'link-to-only-route-inside-group',\n  },\n]\n\ntestCases.forEach(({ description, testId }) => {\n  test(description, async ({ page }) => {\n    await page.getByTestId(testId).click()\n    await expect(page.getByTestId('search-via-hook')).toContainText('world')\n    await expect(page.getByTestId('search-via-route-hook')).toContainText(\n      'world',\n    )\n    await expect(page.getByTestId('search-via-route-api')).toContainText(\n      'world',\n    )\n  })\n})\n\ntest('navigating to an unnested route', async ({ page }) => {\n  const postId = 'hello-world'\n  page.goto(`/posts/${postId}/edit`)\n  await expect(page.getByTestId('params-via-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-api')).toContainText(postId)\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n\ntest('Should change post navigating back and forth', async ({ page }) => {\n  await page.goto('/posts/1')\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n\n  await page.getByRole('link', { name: 'qui est esse' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('qui est esse')\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('sunt aut facere')\n})\n\ntest('Should not remount deps when remountDeps does not change ', async ({\n  page,\n}) => {\n  await page.goto('/notRemountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n})\n\ntest('Should remount deps when remountDeps does change ', async ({ page }) => {\n  await page.goto('/remountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 2',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 3',\n  )\n})\n\ntest.describe('Unicode route rendering', () => {\n  test('should render non-latin route correctly', async ({ page, baseURL }) => {\n    await page.goto('/대한민국')\n\n    await expect(page.locator('body')).toContainText('Hello \"/대한민국\"!')\n\n    expect(page.url()).toBe(`${baseURL}/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`)\n  })\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"strict\": true,\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"noEmit\": true,\n    \"resolveJsonModule\": true,\n    \"types\": [\"vite/client\"],\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\"\n  },\n  \"include\": [\"src\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-jsx/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/eslint.config.js",
    "content": "import js from '@eslint/js'\nimport typescript from '@typescript-eslint/eslint-plugin'\nimport typescriptParser from '@typescript-eslint/parser'\nimport vue from 'eslint-plugin-vue'\nimport vueParser from 'vue-eslint-parser'\n\nexport default [\n  js.configs.recommended,\n  ...vue.configs['flat/recommended'],\n  {\n    files: ['**/*.{js,jsx,ts,tsx,vue}'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n        ecmaVersion: 'latest',\n        sourceType: 'module',\n        ecmaFeatures: {\n          jsx: true,\n        },\n      },\n    },\n    plugins: {\n      '@typescript-eslint': typescript,\n      vue,\n    },\n    rules: {\n      // Vue specific rules\n      'vue/multi-word-component-names': 'off',\n      'vue/no-unused-vars': 'error',\n\n      // TypeScript rules\n      '@typescript-eslint/no-unused-vars': 'error',\n      '@typescript-eslint/no-explicit-any': 'warn',\n\n      // General rules\n      'no-unused-vars': 'off', // Let TypeScript handle this\n    },\n  },\n  {\n    files: ['**/*.vue'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n      },\n    },\n  },\n]\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.ts\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic-file-sfc\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && vue-tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/components/EditingAComponent.tsx",
    "content": "import { ref, defineComponent } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nexport const EditingAComponent = defineComponent({\n  setup() {\n    const navigate = useNavigate()\n    const input = ref('')\n\n    const blocker = useBlocker({\n      shouldBlockFn: ({ next }) => {\n        if (next.fullPath === '/editing-b' && input.value.length > 0) {\n          return true\n        }\n        return false\n      },\n      withResolver: true,\n    })\n\n    return () => (\n      <div>\n        <h1>Editing A</h1>\n        <label>\n          Enter your name:\n          <input\n            name=\"input\"\n            value={input.value}\n            onInput={(e) =>\n              (input.value = (e.target as HTMLInputElement).value)\n            }\n          />\n        </label>\n        <button onClick={() => navigate({ to: '/editing-b' })}>\n          Go to next step\n        </button>\n        {blocker.value.status === 'blocked' && (\n          <button onClick={() => blocker.value.proceed?.()}>Proceed</button>\n        )}\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/components/EditingBComponent.tsx",
    "content": "import { ref, toValue, defineComponent } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nexport const EditingBComponent = defineComponent({\n  setup() {\n    const navigate = useNavigate()\n    const input = ref('')\n\n    const blocker = useBlocker({\n      shouldBlockFn: () => !!toValue(input),\n      withResolver: true,\n    })\n\n    return () => (\n      <div>\n        <h1>Editing B</h1>\n        <label>\n          Enter your name:\n          <input\n            name=\"input\"\n            value={input.value}\n            onInput={(e) =>\n              (input.value = (e.target as HTMLInputElement).value)\n            }\n          />\n        </label>\n        <button onClick={() => navigate({ to: '/editing-a' })}>Go back</button>\n        {blocker.value.status === 'blocked' && (\n          <button onClick={() => blocker.value.proceed?.()}>Proceed</button>\n        )}\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/components/NotFoundComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <p>This is the notFoundComponent configured on root route</p>\n    <Link to=\"/\">Start Over</Link>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/components/NotRemountDepsComponent.tsx",
    "content": "import { ref, onMounted, defineComponent } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\nexport const NotRemountDepsComponent = defineComponent({\n  setup() {\n    // Component-scoped ref - will be recreated on component remount\n    const mounts = ref(0)\n    const search = useSearch({ from: '/notRemountDeps' })\n    const navigate = useNavigate()\n\n    onMounted(() => {\n      mounts.value++\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <button\n          onClick={() =>\n            navigate({\n              to: '/notRemountDeps',\n              search: {\n                searchParam: Math.random().toString(36).substring(2, 8),\n              },\n            })\n          }\n        >\n          Regenerate search param\n        </button>\n\n        <div>Search: {search.value.searchParam}</div>\n        <div data-testid=\"component-mounts\">\n          Page component mounts: {mounts.value}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/components/PostErrorComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { ErrorComponent } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\ndefineProps<ErrorComponentProps>()\n</script>\n\n<template>\n  <ErrorComponent :error=\"error\" />\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/components/RemountDepsComponent.tsx",
    "content": "import { ref, onMounted, defineComponent } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\n// Module-scoped ref to persist across component remounts\nconst mounts = ref(0)\n\nexport const RemountDepsComponent = defineComponent({\n  setup() {\n    const search = useSearch({ from: '/remountDeps' })\n    const navigate = useNavigate()\n\n    onMounted(() => {\n      mounts.value++\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <button\n          onClick={() =>\n            navigate({\n              to: '/remountDeps',\n              search: {\n                searchParam: Math.random().toString(36).substring(2, 8),\n              },\n            })\n          }\n        >\n          Regenerate search param\n        </button>\n\n        <div>Search: {search.value.searchParam}</div>\n        <div data-testid=\"component-mounts\">\n          Page component mounts: {mounts.value}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/components/VueLogo.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, computed } from 'vue'\n\nconst props = withDefaults(\n  defineProps<{\n    /**\n     * Accepts any valid CSS color value as a string.\n     * Note: TypeScript cannot strictly check for all valid CSS colors at type level.\n     * For runtime validation, you could use a library or custom validator if desired.\n     */\n    textColor?: string\n  }>(),\n  {\n    textColor: 'gray',\n  },\n)\n\nconst count = ref(0)\n\nconst countLabel = computed(() => {\n  if (count.value === 0) return 'Click the logo!'\n  if (count.value === 1) return '1 click'\n  return `${count.value} clicks`\n})\n\nfunction increment() {\n  count.value++\n}\n\nfunction reset() {\n  count.value = 0\n}\n</script>\n\n<template>\n  <div class=\"vue-logo-container\">\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 261.76 226.69\"\n      class=\"vue-logo\"\n      @click=\"increment\"\n    >\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H-.005L130.872 226.69 261.749 0z\"\n        fill=\"#41b883\"\n      />\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H52.346l78.526 136.01L209.398.001z\"\n        fill=\"#34495e\"\n      />\n    </svg>\n    <p class=\"count-label\" :style=\"{ color: props.textColor }\">\n      {{ countLabel }}\n    </p>\n    <button v-if=\"count > 0\" class=\"reset-btn\" @click=\"reset\">Reset</button>\n  </div>\n</template>\n\n<style scoped>\n.vue-logo-container {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5rem;\n  margin: 1rem 0;\n}\n\n.vue-logo {\n  width: 64px;\n  height: 64px;\n  cursor: pointer;\n  transition: transform 0.2s ease;\n}\n\n.vue-logo:hover {\n  transform: scale(1.1);\n}\n\n.vue-logo:active {\n  transform: scale(0.95);\n}\n\n.count-label {\n  margin: 0;\n  font-size: 0.875rem;\n  color: #666;\n}\n\n.reset-btn {\n  padding: 0.25rem 0.5rem;\n  font-size: 0.75rem;\n  background: #41b883;\n  color: white;\n  border: none;\n  border-radius: 4px;\n  cursor: pointer;\n}\n\n.reset-btn:hover {\n  background: #34495e;\n}\n</style>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/main.ts",
    "content": "import { createApp, h } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const app = createApp({\n    setup() {\n      return () => h(RouterProvider, { router })\n    },\n  })\n  app.mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/posts.ts",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { lazyRouteComponent } from '@tanstack/vue-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as Char45824Char54620Char48124Char44397RouteImport } from './routes/대한민국'\nimport { Route as RemountDepsRouteImport } from './routes/remountDeps'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'\nimport { Route as EditingBRouteImport } from './routes/editing-b'\nimport { Route as EditingARouteImport } from './routes/editing-a'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'\nimport { Route as groupInsideRouteImport } from './routes/(group)/inside'\nimport { Route as groupLayoutRouteImport } from './routes/(group)/_layout'\nimport { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside'\nimport { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside'\nimport { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout'\n\nconst Char45824Char54620Char48124Char44397Route =\n  Char45824Char54620Char48124Char44397RouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => rootRouteImport,\n  } as any).update({\n    component: lazyRouteComponent(\n      () => import('./routes/대한민국.component.vue'),\n      'default',\n    ),\n  })\nconst RemountDepsRoute = RemountDepsRouteImport.update({\n  id: '/remountDeps',\n  path: '/remountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/remountDeps.component.vue'),\n    'default',\n  ),\n})\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/posts.component.vue'),\n    'default',\n  ),\n})\nconst NotRemountDepsRoute = NotRemountDepsRouteImport.update({\n  id: '/notRemountDeps',\n  path: '/notRemountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/notRemountDeps.component.vue'),\n    'default',\n  ),\n})\nconst EditingBRoute = EditingBRouteImport.update({\n  id: '/editing-b',\n  path: '/editing-b',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/editing-b.component.vue'),\n    'default',\n  ),\n})\nconst EditingARoute = EditingARouteImport.update({\n  id: '/editing-a',\n  path: '/editing-a',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/editing-a.component.vue'),\n    'default',\n  ),\n})\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/_layout.component.vue'),\n    'default',\n  ),\n})\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/index.component.vue'),\n    'default',\n  ),\n})\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/posts.index.component.vue'),\n    'default',\n  ),\n})\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/posts.$postId.component.vue'),\n    'default',\n  ),\n  errorComponent: lazyRouteComponent(\n    () => import('./routes/posts.$postId.errorComponent.vue'),\n    'default',\n  ),\n})\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/_layout/_layout-2.component.vue'),\n    'default',\n  ),\n})\nconst groupLazyinsideRoute = groupLazyinsideRouteImport\n  .update({\n    id: '/(group)/lazyinside',\n    path: '/lazyinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/lazyinside.component.vue'),\n      'default',\n    ),\n  })\nconst groupInsideRoute = groupInsideRouteImport\n  .update({\n    id: '/(group)/inside',\n    path: '/inside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/inside.component.vue'),\n      'default',\n    ),\n  })\nconst groupLayoutRoute = groupLayoutRouteImport\n  .update({\n    id: '/(group)/_layout',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/_layout.component.vue'),\n      'default',\n    ),\n  })\nconst anotherGroupOnlyrouteinsideRoute = anotherGroupOnlyrouteinsideRouteImport\n  .update({\n    id: '/(another-group)/onlyrouteinside',\n    path: '/onlyrouteinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(another-group)/onlyrouteinside.component.vue'),\n      'default',\n    ),\n  })\nconst PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({\n  id: '/posts_/$postId/edit',\n  path: '/posts/$postId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/posts_.$postId.edit.component.vue'),\n    'default',\n  ),\n})\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/_layout/_layout-2/layout-b.component.vue'),\n    'default',\n  ),\n})\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/_layout/_layout-2/layout-a.component.vue'),\n    'default',\n  ),\n})\nconst groupSubfolderInsideRoute = groupSubfolderInsideRouteImport\n  .update({\n    id: '/(group)/subfolder/inside',\n    path: '/subfolder/inside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/subfolder/inside.component.vue'),\n      'default',\n    ),\n  })\nconst groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport\n  .update({\n    id: '/insidelayout',\n    path: '/insidelayout',\n    getParentRoute: () => groupLayoutRoute,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/_layout.insidelayout.component.vue'),\n      'default',\n    ),\n  })\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/remountDeps': typeof RemountDepsRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/inside': typeof groupInsideRoute\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts_/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/remountDeps'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/대한민국'\n    | '/(another-group)/onlyrouteinside'\n    | '/(group)/_layout'\n    | '/(group)/inside'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/(group)/_layout/insidelayout'\n    | '/(group)/subfolder/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/posts_/$postId/edit'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  EditingARoute: typeof EditingARoute\n  EditingBRoute: typeof EditingBRoute\n  NotRemountDepsRoute: typeof NotRemountDepsRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RemountDepsRoute: typeof RemountDepsRoute\n  Char45824Char54620Char48124Char44397Route: typeof Char45824Char54620Char48124Char44397Route\n  anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupInsideRoute: typeof groupInsideRoute\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n  groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute\n  PostsPostIdEditRoute: typeof PostsPostIdEditRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/대한민국': {\n      id: '/대한민국'\n      path: '/대한민국'\n      fullPath: '/대한민국'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/remountDeps': {\n      id: '/remountDeps'\n      path: '/remountDeps'\n      fullPath: '/remountDeps'\n      preLoaderRoute: typeof RemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/notRemountDeps': {\n      id: '/notRemountDeps'\n      path: '/notRemountDeps'\n      fullPath: '/notRemountDeps'\n      preLoaderRoute: typeof NotRemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-b': {\n      id: '/editing-b'\n      path: '/editing-b'\n      fullPath: '/editing-b'\n      preLoaderRoute: typeof EditingBRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-a': {\n      id: '/editing-a'\n      path: '/editing-a'\n      fullPath: '/editing-a'\n      preLoaderRoute: typeof EditingARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/inside': {\n      id: '/(group)/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(another-group)/onlyrouteinside': {\n      id: '/(another-group)/onlyrouteinside'\n      path: '/onlyrouteinside'\n      fullPath: '/onlyrouteinside'\n      preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/edit': {\n      id: '/posts_/$postId/edit'\n      path: '/posts/$postId/edit'\n      fullPath: '/posts/$postId/edit'\n      preLoaderRoute: typeof PostsPostIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/(group)/subfolder/inside': {\n      id: '/(group)/subfolder/inside'\n      path: '/subfolder/inside'\n      fullPath: '/subfolder/inside'\n      preLoaderRoute: typeof groupSubfolderInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout/insidelayout': {\n      id: '/(group)/_layout/insidelayout'\n      path: '/insidelayout'\n      fullPath: '/insidelayout'\n      preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport\n      parentRoute: typeof groupLayoutRoute\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  EditingARoute: EditingARoute,\n  EditingBRoute: EditingBRoute,\n  NotRemountDepsRoute: NotRemountDepsRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RemountDepsRoute: RemountDepsRoute,\n  Char45824Char54620Char48124Char44397Route:\n    Char45824Char54620Char48124Char44397Route,\n  anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupInsideRoute: groupInsideRoute,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n  groupSubfolderInsideRoute: groupSubfolderInsideRoute,\n  PostsPostIdEditRoute: PostsPostIdEditRoute,\n}\nexport const routeTree = rootRouteImport\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/__root.component.vue'),\n      'default',\n    ),\n    notFoundComponent: lazyRouteComponent(\n      () => import('./routes/__root.notFoundComponent.vue'),\n      'default',\n    ),\n  })\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(another-group)/onlyrouteinside.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useSearch, getRouteApi } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(another-group)/onlyrouteinside')\n\nconst searchViaHook = useSearch({ from: '/(another-group)/onlyrouteinside' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(another-group)/onlyrouteinside.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(another-group)/onlyrouteinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/_layout.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Outlet } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <div>Layout inside group</div>\n    <Outlet />\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/_layout.insidelayout.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { getRouteApi, useSearch } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(group)/_layout/insidelayout')\n\nconst searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/_layout.insidelayout.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/_layout/insidelayout')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/_layout.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/inside.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useSearch, getRouteApi } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(group)/inside')\n\nconst searchViaHook = useSearch({ from: '/(group)/inside' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/inside.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/lazyinside.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useSearch, getRouteApi } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nconst searchViaHook = useSearch({ from: '/(group)/lazyinside' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/lazyinside.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/subfolder/inside.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useSearch, getRouteApi } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(group)/subfolder/inside')\n\nconst searchViaHook = useSearch({ from: '/(group)/subfolder/inside' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/(group)/subfolder/inside.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/subfolder/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/__root.component.vue",
    "content": "<script setup lang=\"ts\">\nimport {\n  Link,\n  Outlet,\n  HeadContent,\n  useRouter,\n  useCanGoBack,\n  useRouterState,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nconst router = useRouter()\nconst canGoBack = useCanGoBack()\n// test useRouterState doesn't crash client side navigation\nconst _state = useRouterState()\n</script>\n\n<template>\n  <HeadContent />\n  <div class=\"flex gap-2 p-2 text-lg border-b\">\n    <button\n      data-testid=\"back-button\"\n      :disabled=\"!canGoBack\"\n      @click=\"router.history.back()\"\n      :class=\"{ 'line-through': !canGoBack }\"\n    >\n      Back\n    </button>\n    <Link\n      to=\"/\"\n      :activeProps=\"{ class: 'font-bold' }\"\n      :activeOptions=\"{ exact: true }\"\n    >\n      Home\n    </Link>\n    <Link to=\"/posts\" :activeProps=\"{ class: 'font-bold' }\">Posts</Link>\n    <Link to=\"/layout-a\" :activeProps=\"{ class: 'font-bold' }\">Layout</Link>\n    <Link\n      to=\"/onlyrouteinside\"\n      data-testid=\"link-to-only-route-inside-group\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Only Route Inside Group\n    </Link>\n    <Link\n      to=\"/inside\"\n      data-testid=\"link-to-route-inside-group\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Inside Group\n    </Link>\n    <Link\n      to=\"/subfolder/inside\"\n      data-testid=\"link-to-route-inside-group-inside-subfolder\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Inside Subfolder Inside Group\n    </Link>\n    <Link\n      to=\"/insidelayout\"\n      data-testid=\"link-to-route-inside-group-inside-layout\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Inside Group Inside Layout\n    </Link>\n    <Link\n      to=\"/lazyinside\"\n      data-testid=\"link-to-lazy-route-inside-group\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Lazy Inside Group\n    </Link>\n    <Link to=\"/대한민국\" :activeProps=\"{ class: 'font-bold' }\"\n      >unicode path</Link\n    >\n    <Link\n      :activeProps=\"{ class: 'font-bold' }\"\n      :to=\"'/this-route-does-not-exist' as any\"\n    >\n      This Route Does Not Exist\n    </Link>\n  </div>\n  <hr />\n  <Outlet />\n  <TanStackRouterDevtools position=\"bottom-right\" />\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/__root.notFoundComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <p>This is the notFoundComponent configured on root route</p>\n    <Link to=\"/\">Start Over</Link>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/__root.ts",
    "content": "import { createRootRoute } from '@tanstack/vue-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/_layout/_layout-2/layout-a.component.vue",
    "content": "<template>\n  <div>I'm layout A!</div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/_layout/_layout-2/layout-a.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  // component is loaded from layout-a.component.vue\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/_layout/_layout-2/layout-b.component.vue",
    "content": "<template>\n  <div>I'm layout B!</div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/_layout/_layout-2/layout-b.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  // component is loaded from layout-b.component.vue\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/_layout/_layout-2.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link, Outlet } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <div>I'm a nested layout</div>\n    <div class=\"flex gap-2 border-b\">\n      <Link to=\"/layout-a\" :activeProps=\"{ class: 'font-bold' }\">\n        Layout A\n      </Link>\n      <Link to=\"/layout-b\" :activeProps=\"{ class: 'font-bold' }\">\n        Layout B\n      </Link>\n    </div>\n    <div>\n      <Outlet />\n    </div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/_layout/_layout-2.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  // component is loaded from _layout-2.component.vue\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/_layout.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Outlet } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <div class=\"border-b\">I'm a layout</div>\n    <div>\n      <Outlet />\n    </div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/_layout.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  // component is loaded from _layout.component.vue\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/editing-a.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nconst navigate = useNavigate()\nconst input = ref('')\n\nconst blocker = useBlocker({\n  shouldBlockFn: ({ next }) => {\n    if (next.fullPath === '/editing-b' && input.value.length > 0) {\n      return true\n    }\n    return false\n  },\n  withResolver: true,\n})\n</script>\n\n<template>\n  <div>\n    <h1>Editing A</h1>\n    <label>\n      Enter your name:\n      <input name=\"input\" v-model=\"input\" />\n    </label>\n    <button @click=\"navigate({ to: '/editing-b' })\">Go to next step</button>\n    <button v-if=\"blocker.status === 'blocked'\" @click=\"blocker.proceed?.()\">\n      Proceed\n    </button>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/editing-a.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/editing-a')({})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/editing-b.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, toValue } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nconst navigate = useNavigate()\nconst input = ref('')\n\nconst blocker = useBlocker({\n  shouldBlockFn: () => !!toValue(input),\n  withResolver: true,\n})\n</script>\n\n<template>\n  <div>\n    <h1>Editing B</h1>\n    <label>\n      Enter your name:\n      <input name=\"input\" v-model=\"input\" />\n    </label>\n    <button @click=\"navigate({ to: '/editing-a' })\">Go back</button>\n    <button v-if=\"blocker.status === 'blocked'\" @click=\"blocker.proceed?.()\">\n      Proceed\n    </button>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/editing-b.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/editing-b')({})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/index.component.vue",
    "content": "<script setup lang=\"ts\">\nimport VueLogo from '../components/VueLogo.vue'\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <h3>Welcome Home!</h3>\n    <VueLogo text-color=\"orange\" />\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/index.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  // component is loaded from index.component.vue\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/notRemountDeps.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, onMounted } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\nconst mounts = ref(0)\nconst search = useSearch({ from: '/notRemountDeps' })\nconst navigate = useNavigate()\n\nonMounted(() => {\n  mounts.value++\n})\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <button\n      @click=\"\n        navigate({\n          to: '/notRemountDeps',\n          search: { searchParam: Math.random().toString(36).substring(2, 8) },\n        })\n      \"\n    >\n      Regenerate search param\n    </button>\n\n    <div>Search: {{ search.searchParam }}</div>\n    <div data-testid=\"component-mounts\">\n      Page component mounts: {{ mounts }}\n    </div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/notRemountDeps.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/notRemountDeps')({\n  validateSearch(search: { searchParam: string }) {\n    return { searchParam: search.searchParam }\n  },\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.params\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts.$postId.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useLoaderData } from '@tanstack/vue-router'\nimport type { PostType } from '../posts'\n\nconst post = useLoaderData({ from: '/posts/$postId' }) as unknown as PostType\n</script>\n\n<template>\n  <div class=\"space-y-2\">\n    <h4 class=\"text-xl font-bold underline\" data-testid=\"post-title\">\n      {{ post.title }}\n    </h4>\n    <div class=\"text-sm\">{{ post.body }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts.$postId.errorComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { ErrorComponent } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nconst props = defineProps<ErrorComponentProps>()\n</script>\n\n<template>\n  <ErrorComponent :error=\"props.error\" />\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts.$postId.ts",
    "content": "import { h } from 'vue'\nimport { createFileRoute } from '@tanstack/vue-router'\nimport { fetchPost } from '../posts'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  notFoundComponent: () => h('p', 'Post not found'),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link, Outlet, useLoaderData } from '@tanstack/vue-router'\nimport type { PostType } from '../posts'\n\nconst posts = useLoaderData({ from: '/posts' }) as unknown as Array<PostType>\n</script>\n\n<template>\n  <div class=\"p-2 flex gap-2\" data-testid=\"posts-links\">\n    <ul class=\"list-disc pl-4\">\n      <li\n        v-for=\"post in [\n          ...posts,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ]\"\n        :key=\"post.id\"\n        class=\"whitespace-nowrap\"\n      >\n        <Link\n          to=\"/posts/$postId\"\n          :params=\"{ postId: post.id }\"\n          class=\"block py-1 text-blue-600 hover:opacity-75\"\n          :activeProps=\"{ class: 'font-bold underline' }\"\n        >\n          <div>{{ post.title.substring(0, 20) }}</div>\n        </Link>\n      </li>\n    </ul>\n    <hr />\n    <Outlet />\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts.index.component.vue",
    "content": "<template>\n  <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts.index.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  // component is loaded from posts.index.component.vue\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: fetchPosts,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts_.$postId.edit.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useParams, getRouteApi } from '@tanstack/vue-router'\n\nconst api = getRouteApi('/posts_/$postId/edit')\n\nconst paramsViaApi = api.useParams()\nconst paramsViaHook = useParams({ from: '/posts_/$postId/edit' })\nconst paramsViaRouteHook = api.useParams()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"params-via-hook\">{{ paramsViaHook.postId }}</div>\n    <div data-testid=\"params-via-route-hook\">\n      {{ paramsViaRouteHook.postId }}\n    </div>\n    <div data-testid=\"params-via-route-api\">{{ paramsViaApi.postId }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/posts_.$postId.edit.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts_/$postId/edit')({})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/remountDeps.component.vue",
    "content": "<script lang=\"ts\">\nimport { ref } from 'vue'\n// Module-scoped ref to persist across component remounts\nconst mounts = ref(0)\nexport { mounts }\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\nconst search = useSearch({ from: '/remountDeps' })\nconst navigate = useNavigate()\n\nonMounted(() => {\n  mounts.value++\n})\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <button\n      @click=\"\n        navigate({\n          to: '/remountDeps',\n          search: { searchParam: Math.random().toString(36).substring(2, 8) },\n        })\n      \"\n    >\n      Regenerate search param\n    </button>\n\n    <div>Search: {{ search.searchParam }}</div>\n    <div data-testid=\"component-mounts\">\n      Page component mounts: {{ mounts }}\n    </div>\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/remountDeps.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/remountDeps')({\n  validateSearch(search: { searchParam: string }) {\n    return { searchParam: search.searchParam }\n  },\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.search\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/대한민국.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Outlet } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <h3 class=\"pb-2\" data-testid=\"unicode-heading\">Hello \"/대한민국\"!</h3>\n    <hr />\n    <Outlet />\n  </div>\n</template>\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/routes/대한민국.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/대한민국')({})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source \"./**/*.vue\";\n@source \"./**/*.ts\";\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/src/vue-shims.d.ts",
    "content": "declare module '*.vue' {\n  import type { DefineComponent } from 'vue'\n  const component: DefineComponent<{}, {}, any>\n  export default component\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest(\"useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest('useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-a')\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go to next step' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n})\n\ntest(\"legacy useBlocker doesn't block navigation if condition is not met\", async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('legacy useBlocker does block navigation if condition is met', async ({\n  page,\n}) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible()\n})\n\ntest('legacy Proceeding through blocked navigation works', async ({ page }) => {\n  await page.goto('/editing-b')\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByLabel('Enter your name:').fill('foo')\n\n  await page.getByRole('button', { name: 'Go back' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing B')\n\n  await page.getByRole('button', { name: 'Proceed' }).click()\n  await expect(page.getByRole('heading')).toContainText('Editing A')\n})\n\ntest('useCanGoBack correctly disables back button', async ({ page }) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goForward()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.goBack()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\ntest('useCanGoBack correctly disables back button, using router.history and window.history', async ({\n  page,\n}) => {\n  const getBackButtonDisabled = async () => {\n    const backButton = page.getByTestId('back-button')\n    const isDisabled = (await backButton.getAttribute('disabled')) !== null\n    return isDisabled\n  }\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await expect(page.getByTestId('posts-links')).toBeInViewport()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toBeInViewport()\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.getByTestId('back-button').click()\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.forward()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(false)\n\n  await page.evaluate('window.history.back()')\n  expect(await getBackButtonDisabled()).toBe(true)\n\n  await page.reload()\n  expect(await getBackButtonDisabled()).toBe(true)\n})\n\nconst testCases = [\n  {\n    description: 'Navigating to a route inside a route group',\n    testId: 'link-to-route-inside-group',\n  },\n  {\n    description:\n      'Navigating to a route inside a subfolder inside a route group ',\n    testId: 'link-to-route-inside-group-inside-subfolder',\n  },\n  {\n    description: 'Navigating to a route inside a route group inside a layout',\n    testId: 'link-to-route-inside-group-inside-layout',\n  },\n  {\n    description: 'Navigating to a lazy route inside a route group',\n    testId: 'link-to-lazy-route-inside-group',\n  },\n\n  {\n    description: 'Navigating to the only route inside a route group ',\n    testId: 'link-to-only-route-inside-group',\n  },\n]\n\ntestCases.forEach(({ description, testId }) => {\n  test(description, async ({ page }) => {\n    await page.getByTestId(testId).click()\n    await expect(page.getByTestId('search-via-hook')).toContainText('world')\n    await expect(page.getByTestId('search-via-route-hook')).toContainText(\n      'world',\n    )\n    await expect(page.getByTestId('search-via-route-api')).toContainText(\n      'world',\n    )\n  })\n})\n\ntest('navigating to an unnested route', async ({ page }) => {\n  const postId = 'hello-world'\n  page.goto(`/posts/${postId}/edit`)\n  await expect(page.getByTestId('params-via-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-hook')).toContainText(postId)\n  await expect(page.getByTestId('params-via-route-api')).toContainText(postId)\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n\ntest('Should change post navigating back and forth', async ({ page }) => {\n  await page.goto('/posts/1')\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n\n  await page.getByRole('link', { name: 'qui est esse' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('qui est esse')\n\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByTestId('post-title')).toContainText('sunt aut facere')\n})\n\ntest('Should not remount deps when remountDeps does not change ', async ({\n  page,\n}) => {\n  await page.goto('/notRemountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n})\n\ntest('Should remount deps when remountDeps does change ', async ({ page }) => {\n  await page.goto('/remountDeps')\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 1',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 2',\n  )\n  await page.getByRole('button', { name: 'Regenerate search param' }).click()\n  await expect(page.getByTestId('component-mounts')).toContainText(\n    'Page component mounts: 3',\n  )\n})\n\ntest.describe('Unicode route rendering', () => {\n  test('should render non-latin route correctly', async ({ page, baseURL }) => {\n    await page.goto('/대한민국')\n\n    await expect(page.locator('body')).toContainText('Hello \"/대한민국\"!')\n\n    expect(page.url()).toBe(`${baseURL}/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`)\n  })\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"strict\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"noEmit\": true,\n    \"resolveJsonModule\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"include\": [\"src\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-file-based-sfc/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic-scroll-restoration\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-virtual\": \"^3.13.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"vue\": \"^3.5.16\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/src/main.tsx",
    "content": "import { createApp, defineComponent, onMounted, ref } from 'vue'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useElementScrollRestoration,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { useVirtualizer } from '@tanstack/vue-virtual'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 sticky top-0 border-b bg-gray-100 dark:bg-gray-900\">\n        <Link to=\"/\" class=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" class=\"[&.active]:font-bold\">\n          About\n        </Link>\n        <Link to=\"/about\" resetScroll={false}>\n          About (No Reset)\n        </Link>\n        <Link to=\"/by-element\" class=\"[&.active]:font-bold\">\n          By-Element\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  )\n}\n\nconst IndexComponent = defineComponent({\n  name: 'IndexComponent',\n  setup() {\n    onMounted(() => {\n      window.invokeOrders.push('index-useLayoutEffect')\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <h3 id=\"greeting\" class=\"bg-red-600\">\n          Welcome Home!\n        </h3>\n        <div id=\"top-message\" />\n        <div class=\"space-y-2\">\n          {Array.from({ length: 50 }).map((_, i) => (\n            <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n              Home Item {i + 1}\n            </div>\n          ))}\n        </div>\n      </div>\n    )\n  },\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: IndexComponent,\n})\n\nconst AboutComponent = defineComponent({\n  name: 'AboutComponent',\n  setup() {\n    onMounted(() => {\n      window.invokeOrders.push('about-useLayoutEffect')\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <h3 id=\"greeting\">Hello from About!</h3>\n        <div class=\"space-y-2\">\n          {Array.from({ length: 50 }).map((_, i) => (\n            <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n              About Item {i + 1}\n            </div>\n          ))}\n        </div>\n      </div>\n    )\n  },\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: AboutComponent,\n})\n\nconst ByElementComponent = defineComponent({\n  name: 'ByElementComponent',\n  setup() {\n    // We need a unique ID for manual scroll restoration on a specific element\n    // It should be as unique as possible for this element across your app\n    const scrollRestorationId = 'myVirtualizedContent'\n\n    // We use that ID to get the scroll entry for this element\n    const scrollEntry = useElementScrollRestoration({\n      id: scrollRestorationId,\n    })\n\n    // Let's use TanStack Virtual to virtualize some content!\n    const virtualizerParentRef = ref<HTMLDivElement | null>(null)\n    const virtualizer = useVirtualizer({\n      count: 10000,\n      getScrollElement: () => virtualizerParentRef.value,\n      estimateSize: () => 100,\n      // We pass the scrollY from the scroll restoration entry to the virtualizer\n      // as the initial offset\n      initialOffset: scrollEntry?.scrollY,\n    })\n\n    return () => (\n      <div class=\"p-2 h-[calc(100vh-41px)] flex flex-col\">\n        <div>Hello from By-Element!</div>\n        <div class=\"h-full min-h-0 flex gap-4\">\n          <div\n            id=\"RegularList\"\n            class=\"border rounded-lg p-2 overflow-auto flex-1 space-y-2\"\n          >\n            <div class=\"h-[100px] p-2 rounded-lg bg-red-600 border\">\n              First Regular List Item\n              <div id=\"first-regular-list-item\" />\n            </div>\n            {Array.from({ length: 50 }).map((_, i) => (\n              <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n                Regular List Item {i + 1}\n              </div>\n            ))}\n          </div>\n          <div class=\"flex-1 overflow-auto flex flex-col gap-4\">\n            {Array.from({ length: 2 }).map((_, i) => (\n              <div class=\"flex-1 border rounded-lg p-2 overflow-auto\">\n                <div class=\"space-y-2\">\n                  {Array.from({ length: 50 }).map((_, i) => (\n                    <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n                      About Item {i + 1}\n                    </div>\n                  ))}\n                </div>\n              </div>\n            ))}\n            <div class=\"flex-1 flex flex-col min-h-0\">\n              <div class=\"font-bold\">Virtualized</div>\n              <div\n                ref={virtualizerParentRef}\n                // We pass the scroll restoration ID to the element\n                // as a custom attribute that will get picked up by the\n                // scroll restoration watcher\n                data-scroll-restoration-id={scrollRestorationId}\n                class=\"flex-1 border rounded-lg overflow-auto relative\"\n              >\n                <div\n                  style={{\n                    height: `${virtualizer.value.getTotalSize()}px`,\n                  }}\n                >\n                  {virtualizer.value.getVirtualItems().map((item) => (\n                    <div\n                      class=\"absolute p-2 pb-0 w-full\"\n                      style={{\n                        height: item.size,\n                        top: item.start,\n                      }}\n                    >\n                      <div class=\"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border h-full\">\n                        Virtualized Item {item.index + 1}\n                      </div>\n                    </div>\n                  ))}\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    )\n  },\n})\n\nconst byElementRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/by-element',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: ByElementComponent,\n})\n\nconst fooRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/foo',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: FooComponent,\n})\n\nfunction FooComponent() {\n  return (\n    <div data-testid=\"foo-route-component\" class=\"p-2\">\n      <h3 id=\"greeting\">Hello from Foo!</h3>\n      <Link to=\"/bar\" data-testid=\"go-to-bar-link\">\n        Go to Bar\n      </Link>\n      <div class=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n            Foo Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst barRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/bar',\n  loader: () => new Promise<any>((r) => setTimeout(r, 500)),\n  component: BarComponent,\n})\n\nfunction BarComponent() {\n  return (\n    <div data-testid=\"bar-route-component\" class=\"p-2\">\n      <h3 id=\"greeting\">Hello from Bar!</h3>\n      <div class=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n            Bar Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  aboutRoute,\n  byElementRoute,\n  fooRoute,\n  barRoute,\n])\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  getScrollRestorationKey: (location) => location.pathname,\n})\n\ndeclare global {\n  interface Window {\n    invokeOrders: Array<string>\n  }\n}\n\nlet invokeOrders: Array<string> = []\nlet shouldRecordRouterEvents = true\n\nObject.defineProperty(window, 'invokeOrders', {\n  configurable: true,\n  get: () => invokeOrders,\n  set: (next) => {\n    invokeOrders = next\n    // Tests reset this between navigations; ignore any in-flight events from\n    // the previous navigation until the next navigation begins.\n    shouldRecordRouterEvents = false\n  },\n})\n\nrouter.subscribe('onBeforeLoad', () => {\n  shouldRecordRouterEvents = true\n})\n\nrouter.subscribe('onBeforeRouteMount', (event) => {\n  if (!shouldRecordRouterEvents) return\n  invokeOrders.push(event.type)\n})\n\nrouter.subscribe('onResolved', (event) => {\n  if (!shouldRecordRouterEvents) return\n  invokeOrders.push(event.type)\n})\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('restore scroll positions by page, home pages top message should not display on navigating back', async ({\n  page,\n}) => {\n  // Step 1: Navigate to the home page\n  await page.goto('/')\n\n  await expect(page.locator('#greeting')).toContainText('Welcome Home!')\n  await expect(page.locator('#top-message')).toBeInViewport()\n\n  // Step 2: Scroll to a position that hides the top\n  const targetScrollPosition = 1000\n  await page.evaluate(\n    (scrollPos: number) => window.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n\n  // Verify initial scroll position\n  const scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  await expect(page.locator('#top-message')).not.toBeInViewport()\n  await page.waitForTimeout(1000)\n\n  // Step 3: Navigate to the about page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  // Step 4: Go back to the home page and immediately check the message\n  await page.goBack()\n\n  // Wait for the home page to have rendered\n  await page.waitForSelector('#greeting')\n  await page.waitForTimeout(1000)\n  await expect(page.locator('#top-message')).not.toBeInViewport()\n\n  // Confirm the scroll position was restored correctly\n  const restoredScrollPosition = await page.evaluate(() => window.scrollY)\n  expect(restoredScrollPosition).toBe(targetScrollPosition)\n})\n\ntest('restore scroll positions by element, first regular list item should not display on navigating back', async ({\n  page,\n}) => {\n  // Step 1: Navigate to the by-element page\n  await page.goto('/by-element')\n\n  // Step 2: Scroll to a position that hides the first list item in regular list\n  const targetScrollPosition = 1000\n  await page.waitForSelector('#RegularList')\n  await expect(page.locator('#first-regular-list-item')).toBeInViewport()\n\n  await page.evaluate(\n    (scrollPos: number) =>\n      document.querySelector('#RegularList')!.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n\n  // Verify initial scroll position\n  const scrollPosition = await page.evaluate(\n    () => document.querySelector('#RegularList')!.scrollTop,\n  )\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  await expect(page.locator('#first-regular-list-item')).not.toBeInViewport()\n\n  // Step 3: Navigate to the about page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  // Step 4: Go back to the by-element page and immediately check the message\n  await page.goBack()\n\n  // TODO: For some reason, this only works in headed mode.\n  // When someone can explain that to me, I'll fix this test.\n\n  // Confirm the scroll position was restored correctly\n  // const restoredScrollPosition = await page.evaluate(\n  //   () => document.querySelector('#RegularList')!.scrollTop,\n  // )\n  // expect(restoredScrollPosition).toBe(targetScrollPosition)\n})\n\ntest('scroll to top when not scrolled, regression test for #4782', async ({\n  page,\n}) => {\n  await page.goto('/foo')\n\n  await expect(page.getByTestId('foo-route-component')).toBeVisible()\n\n  let scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(0)\n\n  // do not scroll, just navigate to /bar\n  await page.getByTestId('go-to-bar-link').click()\n  await expect(page.getByTestId('bar-route-component')).toBeVisible()\n\n  const targetScrollPosition = 1000\n  await page.evaluate(\n    (scrollPos: number) => window.scrollTo(0, scrollPos),\n    targetScrollPosition,\n  )\n  scrollPosition = await page.evaluate(() => window.scrollY)\n  expect(scrollPosition).toBe(targetScrollPosition)\n\n  // navigate back to /foo\n  await page.goBack()\n  await expect(page.getByTestId('foo-route-component')).toBeVisible()\n\n  // check if scroll position is restored to 0 since we did not scroll on /foo\n  const restoredScrollPosition = await page.evaluate(() => window.scrollY)\n  expect(restoredScrollPosition).toBe(0)\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/tests/router-events.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('after a navigation, should have emitted \"onBeforeRouteMount\",\"onResolved\" and useRenderEffect setup in the correct order', async ({\n  page,\n}) => {\n  // Navigate to the Home page\n  await page.goto('/')\n  await expect(page.locator('#greeting')).toContainText('Welcome Home!')\n\n  let orders = await page.evaluate(() => window.invokeOrders)\n\n  expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved')\n  expectItemOrder(orders, 'onBeforeRouteMount', 'index-useLayoutEffect')\n\n  // Clear the invokeOrders array\n  orders = await page.evaluate(() => {\n    window.invokeOrders = []\n    return window.invokeOrders\n  })\n\n  // Navigate to the About page\n  await page.getByRole('link', { name: 'About', exact: true }).click()\n  await expect(page.locator('#greeting')).toContainText('Hello from About!')\n\n  orders = await page.evaluate(() => window.invokeOrders)\n\n  expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved')\n  expectItemOrder(orders, 'onBeforeRouteMount', 'about-useLayoutEffect')\n})\n\nfunction expectItemOrder<TItem>(\n  array: Array<TItem>,\n  firstItem: TItem,\n  secondItem: TItem,\n) {\n  const firstIndex = array.findIndex((item) => item === firstItem)\n  const secondIndex = array.findIndex((item) => item === secondItem)\n\n  if (firstIndex === -1 || secondIndex === -1) {\n    throw new Error('One or both items were not found in the array ' + array)\n  }\n\n  expect(firstIndex).toBeLessThan(secondIndex)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-scroll-restoration/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic-virtual-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"@tanstack/vue-query\": \"^5.90.0\",\n    \"@tanstack/vue-query-devtools\": \"^6.1.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/vue-router'\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as postsPostsRouteImport } from './routes/posts/posts'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home'\nimport { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route'\nimport { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index'\nimport { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world'\nimport { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst postsPostsRoute = postsPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsDetailRoute = postsPostsDetailRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst postsPostsHomeRoute = postsPostsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({\n  id: '/classic/hello',\n  path: '/classic/hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({\n  id: '/world',\n  path: '/world',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({\n  id: '/universe',\n  path: '/universe',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/layout-a': typeof aRoute\n  '/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/layout-a': typeof aRoute\n  '/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello': typeof ClassicHelloIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/_first/_second': typeof layoutSecondLayoutRouteWithChildren\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/_first/_second/layout-a': typeof aRoute\n  '/_first/_second/layout-b': typeof bRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/_first/_second'\n    | '/posts/$postId'\n    | '/_first/_second/layout-a'\n    | '/_first/_second/layout-b'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n  postsPostsRoute: typeof postsPostsRouteWithChildren\n  ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsPostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsPostsDetailRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/_first/_second': {\n      id: '/_first/_second'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsPostsHomeRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/classic/hello': {\n      id: '/classic/hello'\n      path: '/classic/hello'\n      fullPath: '/classic/hello'\n      preLoaderRoute: typeof ClassicHelloRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/classic/hello/': {\n      id: '/classic/hello/'\n      path: '/'\n      fullPath: '/classic/hello/'\n      preLoaderRoute: typeof ClassicHelloIndexRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/world': {\n      id: '/classic/hello/world'\n      path: '/world'\n      fullPath: '/classic/hello/world'\n      preLoaderRoute: typeof ClassicHelloWorldRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/universe': {\n      id: '/classic/hello/universe'\n      path: '/universe'\n      fullPath: '/classic/hello/universe'\n      preLoaderRoute: typeof ClassicHelloUniverseRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/_first/_second/layout-b': {\n      id: '/_first/_second/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second/layout-a': {\n      id: '/_first/_second/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ndeclare module './routes/home' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/layout/first-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first',\n    FileRoutesByPath['/_first']['parentRoute'],\n    FileRoutesByPath['/_first']['id'],\n    FileRoutesByPath['/_first']['path'],\n    FileRoutesByPath['/_first']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/route' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello',\n    FileRoutesByPath['/classic/hello']['parentRoute'],\n    FileRoutesByPath['/classic/hello']['id'],\n    FileRoutesByPath['/classic/hello']['path'],\n    FileRoutesByPath['/classic/hello']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/layout/second-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second',\n    FileRoutesByPath['/_first/_second']['parentRoute'],\n    FileRoutesByPath['/_first/_second']['id'],\n    FileRoutesByPath['/_first/_second']['path'],\n    FileRoutesByPath['/_first/_second']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-detail' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/a' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second/layout-a',\n    FileRoutesByPath['/_first/_second/layout-a']['parentRoute'],\n    FileRoutesByPath['/_first/_second/layout-a']['id'],\n    FileRoutesByPath['/_first/_second/layout-a']['path'],\n    FileRoutesByPath['/_first/_second/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/b' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second/layout-b',\n    FileRoutesByPath['/_first/_second/layout-b']['parentRoute'],\n    FileRoutesByPath['/_first/_second/layout-b']['id'],\n    FileRoutesByPath['/_first/_second/layout-b']['path'],\n    FileRoutesByPath['/_first/_second/layout-b']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/universe' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/universe',\n    FileRoutesByPath['/classic/hello/universe']['parentRoute'],\n    FileRoutesByPath['/classic/hello/universe']['id'],\n    FileRoutesByPath['/classic/hello/universe']['path'],\n    FileRoutesByPath['/classic/hello/universe']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/world' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/world',\n    FileRoutesByPath['/classic/hello/world']['parentRoute'],\n    FileRoutesByPath['/classic/hello/world']['id'],\n    FileRoutesByPath['/classic/hello/world']['path'],\n    FileRoutesByPath['/classic/hello/world']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/index' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/',\n    FileRoutesByPath['/classic/hello/']['parentRoute'],\n    FileRoutesByPath['/classic/hello/']['id'],\n    FileRoutesByPath['/classic/hello/']['path'],\n    FileRoutesByPath['/classic/hello/']['fullPath']\n  >\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\ninterface postsPostsRouteChildren {\n  postsPostsHomeRoute: typeof postsPostsHomeRoute\n  postsPostsDetailRoute: typeof postsPostsDetailRoute\n}\n\nconst postsPostsRouteChildren: postsPostsRouteChildren = {\n  postsPostsHomeRoute: postsPostsHomeRoute,\n  postsPostsDetailRoute: postsPostsDetailRoute,\n}\n\nconst postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(\n  postsPostsRouteChildren,\n)\n\ninterface ClassicHelloRouteRouteChildren {\n  ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute\n  ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute\n  ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute\n}\n\nconst ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {\n  ClassicHelloUniverseRoute: ClassicHelloUniverseRoute,\n  ClassicHelloWorldRoute: ClassicHelloWorldRoute,\n  ClassicHelloIndexRoute: ClassicHelloIndexRoute,\n}\n\nconst ClassicHelloRouteRouteWithChildren =\n  ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n  postsPostsRoute: postsPostsRouteWithChildren,\n  ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/home.tsx",
    "content": "export const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import { ErrorComponent } from '@tanstack/vue-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value?.title}</h4>\n      <div class=\"text-sm\">{post.value?.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx",
    "content": "export const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/posts/posts.tsx",
    "content": "import { Link, Outlet } from '@tanstack/vue-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/routes/root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { routes } from './routes'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n      virtualRouteConfig: routes,\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\nsrc/routeTree.gen.ts"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic-virtual-named-export-config-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"@tanstack/vue-query\": \"^5.90.0\",\n    \"@tanstack/vue-query-devtools\": \"^6.1.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx",
    "content": "export const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import { ErrorComponent } from '@tanstack/vue-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value?.title}</h4>\n      <div class=\"text-sm\">{post.value?.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx",
    "content": "export const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx",
    "content": "import { Link, Outlet } from '@tanstack/vue-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-virtual-named-export-config-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n      virtualRouteConfig: './routes.ts',\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic-vue-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && vue-tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/vue-query\": \"^5.90.0\",\n    \"@tanstack/vue-query-devtools\": \"^6.1.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  useRouter,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { VueQueryDevtools } from '@tanstack/vue-query-devtools'\nimport { QueryClient, VueQueryPlugin, useQuery } from '@tanstack/vue-query'\nimport { NotFoundError, postQueryOptions, postsQueryOptions } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\nimport './styles.css'\n\nconst rootRoute = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <VueQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexRouteComponent,\n})\n\nfunction IndexRouteComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n  component: PostsIndexRouteComponent,\n})\n\nfunction PostsIndexRouteComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ context: { queryClient }, params: { postId } }) =>\n    queryClient.ensureQueryData(postQueryOptions(postId)),\n  component: PostRouteComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nfunction PostRouteComponent() {\n  const postId = postRoute.useParams().value.postId\n  useQuery(postQueryOptions(postId))\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layout2Route = createRoute({\n  getParentRoute: () => layoutRoute,\n  id: '_layout-2',\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst layoutARoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-a',\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n\nconst layoutBRoute = createRoute({\n  getParentRoute: () => layout2Route,\n  path: '/layout-b',\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute, postsIndexRoute]),\n  layoutRoute.addChildren([\n    layout2Route.addChildren([layoutARoute, layoutBRoute]),\n  ]),\n  indexRoute,\n])\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  // Since we're using Vue Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  context: {\n    queryClient,\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  })\n    .use(VueQueryPlugin, { queryClient })\n    .mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/src/posts.lazy.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@tanstack/vue-router'\nimport { useQuery } from '@tanstack/vue-query'\nimport { postsQueryOptions } from './posts'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useQuery(postsQueryOptions)\n  const posts = postsQuery.data\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...((posts.value ?? []) as Array<{ id: string; title: string }>),\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li key={post.id} class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/src/posts.ts",
    "content": "import axios from 'redaxios'\nimport { queryOptions } from '@tanstack/vue-query'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"moduleResolution\": \"Bundler\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"noEmit\": true,\n    \"resolveJsonModule\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"include\": [\"src\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-basic-vue-query-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && vue-tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/vue-query\": \"^5.90.0\",\n    \"@tanstack/vue-query-devtools\": \"^6.1.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  // Since we're using Vue Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  })\n    .use(VueQueryPlugin, { queryClient })\n    .mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/postQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/vue-query'\nimport { fetchPost } from './posts'\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/postsQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/vue-query'\nimport { fetchPosts } from './posts'\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/layout-a'\n    | '/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRouteWithContext } from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { VueQueryDevtools } from '@tanstack/vue-query-devtools'\nimport type { QueryClient } from '@tanstack/vue-query'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <VueQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { ErrorComponent, useRouter } from '@tanstack/vue-router'\nimport { useQuery } from '@tanstack/vue-query'\nimport { PostNotFoundError } from '../posts'\nimport { postQueryOptions } from '../postQueryOptions'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ context: { queryClient }, params: { postId } }) => {\n    return queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof PostNotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nfunction PostComponent() {\n  const postId = Route.useParams().value.postId\n  useQuery(postQueryOptions(postId))\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { useQuery } from '@tanstack/vue-query'\nimport { postsQueryOptions } from '../postsQueryOptions'\n\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  useQuery(postsQueryOptions)\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li key={post.id} class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { getDummyServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('GetPosts', async () => {\n  const port = await getDummyServerPort(packageJson.name)\n  const res = await fetch(`http://localhost:${port}/posts`)\n\n  expect(res.status).toBe(200)\n\n  const posts = await res.json()\n\n  expect(posts.length).toBeGreaterThan(0)\n\n  const postRes = await fetch(`http://localhost:${port}/posts/1`)\n  expect(postRes.status).toBe(200)\n  const post = await postRes.json()\n  expect(post).toEqual(posts[0])\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#app')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"moduleResolution\": \"Bundler\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"noEmit\": true,\n    \"resolveJsonModule\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"include\": [\"src\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/basic-vue-query-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'vue', autoCodeSplitting: true }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-generator-cli-only\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"tsr generate && vite --port 3000\",\n    \"dev:e2e\": \"tsr generate && vite\",\n    \"build\": \"tsr generate && vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"tsr generate && vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/router-cli\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"vue\": \"^3.5.16\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/main.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { createApp } from 'vue'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/_pathlessLayout'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/routes/posts.route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested pathless layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a pathless layout\")\n  await expect(page.locator('#app')).toContainText(\n    \"I'm a nested pathless layout\",\n  )\n\n  await page.getByRole('link', { name: 'Go to route A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Go to route B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"target\": \"vue\"\n}\n"
  },
  {
    "path": "e2e/vue-router/generator-cli-only/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.jsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-js-only-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/vue-query\": \"^5.90.0\",\n    \"@tanstack/vue-query-devtools\": \"^6.1.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/main.jsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport { createApp } from 'vue'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\nconst rootElement = document.getElementById('app')\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/posts.js",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios.get(`${queryURL}/posts`).then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routeTree.gen.js",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n})\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n})\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n})\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n})\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n})\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  })\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  })\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  })\n\nconst PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst PathlessLayoutNestedLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,\n  PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,\n}\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\nconst PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/_pathlessLayout'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/__root.jsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { Link, Outlet } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/_pathlessLayout.jsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { Outlet } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/index.jsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/posts.$postId.jsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nimport { ErrorComponent } from '@tanstack/vue-router'\nimport { fetchPost } from '../posts'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/posts.index.jsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/routes/posts.route.jsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nimport { Link, Outlet } from '@tanstack/vue-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts', exact: true }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested pathless layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click()\n\n  await expect(page.locator('#app')).toContainText(\"I'm a pathless layout\")\n  await expect(page.locator('#app')).toContainText(\n    \"I'm a nested pathless layout\",\n  )\n\n  await page.getByRole('link', { name: 'Go to route A' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Go to route B' }).click()\n  await expect(page.locator('#app')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/js-only-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'vue', autoCodeSplitting: true }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\ndist-hash/\n\n# IDE\n.vscode/*\n!.vscode/extensions.json\n.idea\n\n# E2E\nsrc/routeTree.gen.ts\ntest-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `pnpm install`\n- `pnpm dev`\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-rspack-basic-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"rsbuild dev --port 3000\",\n    \"build\": \"rsbuild build && tsc --noEmit\",\n    \"preview\": \"rsbuild preview\",\n    \"start\": \"rsbuild preview\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@rsbuild/core\": \"^1.2.4\",\n    \"@rsbuild/plugin-babel\": \"^1.0.6\",\n    \"@rsbuild/plugin-vue\": \"^1.2.2\",\n    \"@rsbuild/plugin-vue-jsx\": \"^1.1.1\",\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"postcss\": \"^8.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `PUBLIC_NODE_ENV=\"test\" PUBLIC_EXTERNAL_PORT=${EXTERNAL_PORT} PUBLIC_SERVER_PORT=${PORT} pnpm build && PUBLIC_NODE_ENV=\"test\" PUBLIC_EXTERNAL_PORT=${EXTERNAL_PORT} PUBLIC_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/rsbuild.config.ts",
    "content": "import { defineConfig } from '@rsbuild/core'\nimport { pluginVue } from '@rsbuild/plugin-vue'\nimport { pluginVueJsx } from '@rsbuild/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\nimport { pluginBabel } from '@rsbuild/plugin-babel'\n\nexport default defineConfig({\n  plugins: [\n    pluginBabel({\n      include: /\\.(?:jsx|tsx)$/,\n    }),\n    pluginVue(),\n    pluginVueJsx(),\n  ],\n  source: {\n    define: {\n      // Rsbuild only defines `import.meta.env.PUBLIC_*` when the env var exists.\n      // When it doesn't, rspack can transform `import.meta.env` to `void 0`, which\n      // makes `import.meta.env.PUBLIC_*` crash at runtime.\n      'import.meta.env.PUBLIC_NODE_ENV': JSON.stringify(\n        process.env.PUBLIC_NODE_ENV ?? '',\n      ),\n      'import.meta.env.PUBLIC_EXTERNAL_PORT': JSON.stringify(\n        process.env.PUBLIC_EXTERNAL_PORT ?? '',\n      ),\n    },\n  },\n  tools: {\n    rspack: {\n      plugins: [tanstackRouter({ target: 'vue', autoCodeSplitting: true })],\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/app.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/vue-router'\n\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/env.d.ts",
    "content": "/// <reference types=\"@rsbuild/core/types\" />\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/index.tsx",
    "content": "import { createApp } from 'vue'\nimport App from './app'\n\nconst rootEl = document.getElementById('root')\n\nif (!rootEl?.innerHTML) {\n  createApp({\n    setup() {\n      return () => <App />\n    },\n  }).mount('#root')\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.PUBLIC_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.PUBLIC_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#root')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#root')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"useDefineForClassFields\": true,\n    \"allowJs\": true\n  },\n  \"include\": [\"src\", \"playwright.config.ts\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\ndist-hash/\n\n# IDE\n.vscode/*\n!.vscode/extensions.json\n.idea\n\n# E2E\nsrc/routeTree.gen.ts\ntest-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `pnpm install`\n- `pnpm dev`\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-rspack-basic-virtual-named-export-config-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"rsbuild dev --port 3000\",\n    \"build\": \"rsbuild build && tsc --noEmit\",\n    \"preview\": \"rsbuild preview\",\n    \"start\": \"rsbuild preview\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@rsbuild/core\": \"^1.2.4\",\n    \"@rsbuild/plugin-babel\": \"^1.0.6\",\n    \"@rsbuild/plugin-vue\": \"^1.2.2\",\n    \"@rsbuild/plugin-vue-jsx\": \"^1.1.1\",\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"postcss\": \"^8.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `PUBLIC_NODE_ENV=\"test\" PUBLIC_EXTERNAL_PORT=${EXTERNAL_PORT} PUBLIC_SERVER_PORT=${PORT} pnpm build && PUBLIC_SERVER_PORT=${PORT} pnpm start --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('second', 'layout/second-layout.tsx', [\n      route('/layout-a', 'a.tsx'),\n      route('/layout-b', 'b.tsx'),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts",
    "content": "import { defineConfig } from '@rsbuild/core'\nimport { pluginVue } from '@rsbuild/plugin-vue'\nimport { pluginVueJsx } from '@rsbuild/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\nimport { pluginBabel } from '@rsbuild/plugin-babel'\n\nexport default defineConfig({\n  plugins: [\n    pluginBabel({\n      include: /\\.(?:jsx|tsx)$/,\n    }),\n    pluginVue(),\n    pluginVueJsx(),\n  ],\n  source: {\n    define: {\n      // Rsbuild only defines `import.meta.env.PUBLIC_*` when the env var exists.\n      // When it doesn't, rspack can transform `import.meta.env` to `void 0`, which\n      // makes `import.meta.env.PUBLIC_*` crash at runtime.\n      'import.meta.env.PUBLIC_NODE_ENV': JSON.stringify(\n        process.env.PUBLIC_NODE_ENV ?? '',\n      ),\n      'import.meta.env.PUBLIC_EXTERNAL_PORT': JSON.stringify(\n        process.env.PUBLIC_EXTERNAL_PORT ?? '',\n      ),\n    },\n  },\n  tools: {\n    rspack: {\n      plugins: [\n        tanstackRouter({\n          target: 'vue',\n          autoCodeSplitting: true,\n          virtualRouteConfig: './routes.ts',\n        }),\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/vue-router'\n\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts",
    "content": "/// <reference types=\"@rsbuild/core/types\" />\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx",
    "content": "import { createApp } from 'vue'\nimport App from './app'\n\nconst rootEl = document.getElementById('root')\n\nif (!rootEl?.innerHTML) {\n  createApp({\n    setup() {\n      return () => <App />\n    },\n  }).mount('#root')\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.PUBLIC_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.PUBLIC_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_first/_second/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_first/_second/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/classic/hello/')({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/classic/hello')({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/classic/hello/universe')({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/classic/hello/world')({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_first')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_first/_second')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{js,jsx,ts,tsx}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('#root')).toContainText(\"I'm a layout\")\n  await expect(page.locator('#root')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('#root')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"useDefineForClassFields\": true,\n    \"allowJs\": true\n  },\n  \"include\": [\"src\", \"playwright.config.ts\", \"tests\", \"./routes.ts\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\ndist-hash\n*.local\ntest-results\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/README.md",
    "content": "# Scroll Restoration Testing Sandbox with Vite\n\nTo run this example:\n\n- `npm install`\n- `npm start`\n\nThis sandbox is for testing the scroll restoration behavior.\n\n## Setup\n\n- Create your files in `src/routes` directory.\n- Make sure you update the arrays in the following files with the expected routes\n  - `tests/app.spec.ts` > routes array\n  - `src/routes/__root.tsx` > Nav component, routes array\n  - `src/routes/index.tsx` > Navigation test suite, routes array\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/package.json",
    "content": "{\n  \"name\": \"tanstack-router-e2e-vue-scroll-restoration-sandbox-vite\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:hash\": \"VITE_APP_HISTORY=hash vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e:browser\": \"VITE_APP_HISTORY=browser playwright test --config=playwright.browser.config.ts --project=chromium\",\n    \"test:e2e:hash\": \"VITE_APP_HISTORY=hash playwright test --config=playwright.hash.config.ts --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:browser && pnpm run test:e2e:hash\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  resolveRuntimeSuffix,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  packageJson.name + `-${resolveRuntimeSuffix('browser')}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=browser pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=browser pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  resolveRuntimeSuffix,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  packageJson.name + `-${resolveRuntimeSuffix('hash')}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=hash vite build --outDir dist-hash && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} VITE_APP_HISTORY=hash pnpm preview --port ${PORT} --outDir dist-hash`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport {\n  RouterProvider,\n  createHashHistory,\n  createRouter,\n} from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport type { RouterHistory } from '@tanstack/vue-router'\nimport './styles.css'\n\nlet history: RouterHistory | undefined\n\nif (import.meta.env.VITE_APP_HISTORY === 'hash') {\n  history = createHashHistory()\n}\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  history,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')\n\nif (!rootElement?.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport function sleep(ms: number) {\n  return new Promise((r) => setTimeout(r, ms))\n}\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/vue-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as testsPageWithSearchRouteImport } from './routes/(tests)/page-with-search'\nimport { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'\nimport { Route as testsLazyWithLoaderPageRouteImport } from './routes/(tests)/lazy-with-loader-page'\nimport { Route as testsLazyPageRouteImport } from './routes/(tests)/lazy-page'\n\nconst testsVirtualPageLazyRouteImport = createFileRoute(\n  '/(tests)/virtual-page',\n)()\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport\n  .update({\n    id: '/(tests)/virtual-page',\n    path: '/virtual-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(tests)/virtual-page.lazy').then((d) => d.Route))\nconst testsPageWithSearchRoute = testsPageWithSearchRouteImport.update({\n  id: '/(tests)/page-with-search',\n  path: '/page-with-search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsNormalPageRoute = testsNormalPageRouteImport.update({\n  id: '/(tests)/normal-page',\n  path: '/normal-page',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport\n  .update({\n    id: '/(tests)/lazy-with-loader-page',\n    path: '/lazy-with-loader-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() =>\n    import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route),\n  )\nconst testsLazyPageRoute = testsLazyPageRouteImport\n  .update({\n    id: '/(tests)/lazy-page',\n    path: '/lazy-page',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(tests)/lazy-page.lazy').then((d) => d.Route))\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/lazy-page': typeof testsLazyPageRoute\n  '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/page-with-search': typeof testsPageWithSearchRoute\n  '/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/lazy-page': typeof testsLazyPageRoute\n  '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/page-with-search': typeof testsPageWithSearchRoute\n  '/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/(tests)/lazy-page': typeof testsLazyPageRoute\n  '/(tests)/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute\n  '/(tests)/normal-page': typeof testsNormalPageRoute\n  '/(tests)/page-with-search': typeof testsPageWithSearchRoute\n  '/(tests)/virtual-page': typeof testsVirtualPageLazyRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/lazy-page'\n    | '/lazy-with-loader-page'\n    | '/normal-page'\n    | '/page-with-search'\n    | '/virtual-page'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/lazy-page'\n    | '/lazy-with-loader-page'\n    | '/normal-page'\n    | '/page-with-search'\n    | '/virtual-page'\n  id:\n    | '__root__'\n    | '/'\n    | '/(tests)/lazy-page'\n    | '/(tests)/lazy-with-loader-page'\n    | '/(tests)/normal-page'\n    | '/(tests)/page-with-search'\n    | '/(tests)/virtual-page'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  testsLazyPageRoute: typeof testsLazyPageRoute\n  testsLazyWithLoaderPageRoute: typeof testsLazyWithLoaderPageRoute\n  testsNormalPageRoute: typeof testsNormalPageRoute\n  testsPageWithSearchRoute: typeof testsPageWithSearchRoute\n  testsVirtualPageLazyRoute: typeof testsVirtualPageLazyRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/virtual-page': {\n      id: '/(tests)/virtual-page'\n      path: '/virtual-page'\n      fullPath: '/virtual-page'\n      preLoaderRoute: typeof testsVirtualPageLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/page-with-search': {\n      id: '/(tests)/page-with-search'\n      path: '/page-with-search'\n      fullPath: '/page-with-search'\n      preLoaderRoute: typeof testsPageWithSearchRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/normal-page': {\n      id: '/(tests)/normal-page'\n      path: '/normal-page'\n      fullPath: '/normal-page'\n      preLoaderRoute: typeof testsNormalPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/lazy-with-loader-page': {\n      id: '/(tests)/lazy-with-loader-page'\n      path: '/lazy-with-loader-page'\n      fullPath: '/lazy-with-loader-page'\n      preLoaderRoute: typeof testsLazyWithLoaderPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/lazy-page': {\n      id: '/(tests)/lazy-page'\n      path: '/lazy-page'\n      fullPath: '/lazy-page'\n      preLoaderRoute: typeof testsLazyPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  testsLazyPageRoute: testsLazyPageRoute,\n  testsLazyWithLoaderPageRoute: testsLazyWithLoaderPageRoute,\n  testsNormalPageRoute: testsNormalPageRoute,\n  testsPageWithSearchRoute: testsPageWithSearchRoute,\n  testsVirtualPageLazyRoute: testsVirtualPageLazyRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/vue-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/lazy-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>lazy-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/(tests)/lazy-page')({})\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/vue-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/lazy-with-loader-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>lazy-with-loader-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { sleep } from '../../posts'\n\nexport const Route = createFileRoute('/(tests)/lazy-with-loader-page')({\n  loader: async () => {\n    await sleep(1000)\n    return { foo: 'bar' }\n  },\n})\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/normal-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>normal-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/page-with-search')({\n  validateSearch: zodValidator(z.object({ where: z.string() })),\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>page-with-search</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/vue-router'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createLazyFileRoute('/(tests)/virtual-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>virtual-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx",
    "content": "export const atTheTopId = 'at-the-top'\nexport const atTheBottomId = 'at-the-bottom'\n\nexport function ScrollBlock({ number = 100 }: { number?: number }) {\n  return (\n    <>\n      <div id={atTheTopId} data-testid={atTheTopId}></div>\n      {Array.from({ length: number }).map((_, i) => (\n        <div>{i}</div>\n      ))}\n      <div id={atTheBottomId} data-testid={atTheBottomId}>\n        At the bottom\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n  linkOptions,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <Nav type=\"header\" />\n      <hr />\n      <Outlet />\n      <hr />\n      <Nav type=\"footer\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nfunction Nav({ type }: { type: 'header' | 'footer' }) {\n  const Elem = type === 'header' ? 'header' : 'footer'\n  const prefix = type === 'header' ? 'Head' : 'Foot'\n  return (\n    <Elem class=\"p-2 flex gap-2 text-lg\">\n      <Link\n        to=\"/\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        activeOptions={{ exact: true }}\n      >\n        {prefix}-/\n      </Link>{' '}\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/lazy-page' }),\n          linkOptions({ to: '/virtual-page' }),\n          linkOptions({ to: '/lazy-with-loader-page' }),\n          linkOptions({ to: '/page-with-search', search: { where: type } }),\n        ] as const\n      ).map((options) => (\n        <Link\n          {...options}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          {prefix}-{options.to}\n        </Link>\n      ))}\n    </Elem>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { Link, linkOptions } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2 grid gap-2\">\n      <h3>Welcome Home!</h3>\n      <p>\n        The are the links to be tested when navigating away from the index page.\n        Otherwise known as NOT first-load tests, rather known as navigation\n        tests.\n      </p>\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/lazy-page' }),\n          linkOptions({ to: '/virtual-page' }),\n          linkOptions({ to: '/lazy-with-loader-page' }),\n          linkOptions({ to: '/page-with-search', search: { where: 'footer' } }),\n        ] as const\n      ).map((options, i) => (\n        <div class=\"border p-2\">\n          <h4>{options.to} tests</h4>\n          <p>\n            <Link {...options} hash=\"at-the-bottom\">\n              {options.to}#at-the-bottom\n            </Link>\n          </p>\n        </div>\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport { toRuntimePath } from '@tanstack/router-e2e-utils'\n\ntest('Smoke - Renders home', async ({ page }) => {\n  await page.goto(toRuntimePath('/'))\n  await expect(\n    page.getByRole('heading', { name: 'Welcome Home!' }),\n  ).toBeVisible()\n})\n\n// Test for scroll related stuff\n;[\n  { to: '/normal-page' },\n  { to: '/lazy-page' },\n  { to: '/virtual-page' },\n  { to: '/lazy-with-loader-page' },\n  { to: '/page-with-search', search: { where: 'footer' } },\n].forEach((options) => {\n  test(`On navigate to ${options.to} (from the header), scroll should be at top`, async ({\n    page,\n  }) => {\n    await page.goto(toRuntimePath('/'))\n    await page.getByRole('link', { name: `Head-${options.to}` }).click()\n    await page.waitForTimeout(0)\n    await expect(page.getByTestId('at-the-top')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on navigation after the page is loaded\n  test(`On navigate via index page tests to ${options.to}, scroll should resolve at the bottom`, async ({\n    page,\n  }) => {\n    await page.goto(toRuntimePath('/'))\n    await page\n      .getByRole('link', { name: `${options.to}#at-the-bottom` })\n      .click()\n    await page.waitForTimeout(0)\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on first load\n  test(`On first load of ${options.to}, scroll should resolve resolve at the bottom`, async ({\n    page,\n  }) => {\n    let url: string = options.to\n    if ('search' in options) {\n      url = `${url}?where=${options.search?.where}`\n    }\n    await page.goto(toRuntimePath(`${url}#at-the-bottom`))\n    await page.waitForTimeout(0)\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n})\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"types\": [\"vite/client\", \"node\"]\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/scroll-restoration-sandbox-vite/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'vue', autoCodeSplitting: true }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-hash\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "e2e/vue-router/sentry-integration/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-router-e2e-sentry-integration\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@sentry/vue\": \"^10.32.0\",\n    \"@sentry/tracing\": \"^7.120.4\",\n    \"@sentry/vite-plugin\": \"^4.6.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/src/main.tsx",
    "content": "import { createApp } from 'vue'\n\nimport { tanstackRouterBrowserTracingIntegration } from '@sentry/vue/tanstackrouter'\nimport * as Sentry from '@sentry/vue'\n\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([indexRoute])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nSentry.init({\n  dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0',\n  integrations: [tanstackRouterBrowserTracingIntegration(router)],\n  transport: () => ({\n    send: (): Promise<any> => Promise.resolve(),\n    flush: () => Promise.resolve(true),\n  }),\n  tracesSampleRate: 0.2,\n  sendClientReports: false,\n})\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('should load', async ({ page }) => {\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/sentry-integration/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport { sentryVitePlugin } from '@sentry/vite-plugin'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), vueJsx(), sentryVitePlugin()],\n})\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/package.json",
    "content": "{\n  \"name\": \"tanstack-e2e-router-vue-example-view-transitions\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"workspace:^\",\n    \"@tanstack/vue-query\": \"^5.90.0\",\n    \"@tanstack/vue-query-devtools\": \"^6.1.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { QueryClient, VueQueryPlugin } from '@tanstack/vue-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  // Since we're using Vue Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  })\n    .use(VueQueryPlugin, { queryClient })\n    .mount('#app')\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 0))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 0))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as HowItWorksRouteImport } from './routes/how-it-works'\nimport { Route as ExploreRouteImport } from './routes/explore'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst HowItWorksRoute = HowItWorksRouteImport.update({\n  id: '/how-it-works',\n  path: '/how-it-works',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ExploreRoute = ExploreRouteImport.update({\n  id: '/explore',\n  path: '/explore',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  ExploreRoute: typeof ExploreRoute\n  HowItWorksRoute: typeof HowItWorksRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/how-it-works': {\n      id: '/how-it-works'\n      path: '/how-it-works'\n      fullPath: '/how-it-works'\n      preLoaderRoute: typeof HowItWorksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/explore': {\n      id: '/explore'\n      path: '/explore'\n      fullPath: '/explore'\n      preLoaderRoute: typeof ExploreRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  ExploreRoute: ExploreRoute,\n  HowItWorksRoute: HowItWorksRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n          viewTransition\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          viewTransition\n        >\n          Posts\n        </Link>{' '}\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/routes/explore.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/explore')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>\n        Explore the CSS to see how to use active-view-transition-type to create\n        new viewTransitions to use with Tanstack Router.\n      </h3>\n      <h4 class={'text-sm mt-2 italic'}>\n        Disclaimer: View Transition Types may not be supported in all browsers\n        and will fall back to the default browser transition if not available.\n      </h4>\n      <div class=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          class=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/routes/how-it-works.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/how-it-works')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>This example demonstrates a variety of custom page transitions.</h3>\n      <div class=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          class=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n        <Link\n          to={'/explore'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          class=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>Welcome To The View Transitions Example!</h3>\n      <div class=\"flex justify-center mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          class=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/routes/posts.route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2  [view-transition-name:main-content]\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n                // see styles.css for 'warp' transition\n                viewTransition={{ types: ['warp'] }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <div class=\"[view-transition-name:post]\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n\n/* Slide Left Transition */\nhtml:active-view-transition-type(slide-left) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-left;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-left;\n  }\n}\n\n@keyframes slide-out-left {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(-100%);\n  }\n}\n\n@keyframes slide-in-left {\n  from {\n    transform: translateX(100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Slide Right Transition */\nhtml:active-view-transition-type(slide-right) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-right;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-right;\n  }\n}\n\n@keyframes slide-out-right {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(100%);\n  }\n}\n\n@keyframes slide-in-right {\n  from {\n    transform: translateX(-100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Warp/Rotate Transition */\nhtml:active-view-transition-type(warp) {\n  &::view-transition-old(post) {\n    animation: 400ms ease-out both warp-out;\n  }\n\n  &::view-transition-new(post) {\n    animation: 400ms ease-out both warp-in;\n  }\n}\n\n@keyframes warp-out {\n  from {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n  to {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(1.1) rotate(90deg);\n  }\n}\n\n@keyframes warp-in {\n  from {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(0.9) rotate(-45deg);\n  }\n  to {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/tests/app.spec.ts",
    "content": "import { test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('placeholder test', async ({ page }) => {\n  // This is a placeholder test\n  await page.waitForLoadState('networkidle')\n})\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/tests/view-transitions.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.addInitScript(() => {\n    ;(window as any).__viewTransitionCalls = []\n    ;(document as any).startViewTransition = (arg: any) => {\n      ;(window as any).__viewTransitionCalls.push(arg)\n\n      try {\n        if (\n          arg &&\n          typeof arg === 'object' &&\n          typeof arg.update === 'function'\n        ) {\n          arg.update()\n        } else if (typeof arg === 'function') {\n          arg()\n        }\n      } catch {\n        // ignore\n      }\n\n      return { finished: Promise.resolve() }\n    }\n  })\n\n  await page.goto('/')\n})\n\ntest('navigation uses View Transitions API', async ({ page }) => {\n  await page.getByRole('link', { name: 'Next Page ->' }).click()\n  await expect(page).toHaveURL(/\\/how-it-works$/)\n\n  await expect\n    .poll(async () => {\n      const calls = await page.evaluate(\n        () => (window as any).__viewTransitionCalls,\n      )\n      return calls.length\n    })\n    .toBeGreaterThan(0)\n})\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"resolveJsonModule\": true,\n    \"allowJs\": true,\n    \"skipLibCheck\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "e2e/vue-router/view-transitions/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'vue', autoCodeSplitting: true }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/basic/.prettierignore",
    "content": "routeTree.gen.ts\n"
  },
  {
    "path": "e2e/vue-start/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-basic\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"build:spa\": \"MODE=spa vite build && tsc --noEmit\",\n    \"build:prerender\": \"MODE=prerender vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node server.js\",\n    \"test:e2e:startDummyServer\": \"node -e 'import(\\\"./tests/setup/global.setup.ts\\\").then(m => m.default())' &\",\n    \"test:e2e:stopDummyServer\": \"node -e 'import(\\\"./tests/setup/global.teardown.ts\\\").then(m => m.default())'\",\n    \"test:e2e:spaMode\": \"rm -rf port*.txt; MODE=spa playwright test --project=chromium\",\n    \"test:e2e:ssrMode\": \"rm -rf port*.txt; playwright test --project=chromium\",\n    \"test:e2e:prerender\": \"rm -rf port*.txt; MODE=prerender playwright test --project=chromium\",\n    \"test:e2e:preview\": \"rm -rf port*.txt; MODE=preview playwright test --project=chromium\",\n    \"test:e2e\": \"pnpm run test:e2e:spaMode && pnpm run test:e2e:ssrMode && pnpm run test:e2e:prerender && pnpm run test:e2e:preview\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"express\": \"^5.1.0\",\n    \"http-proxy-middleware\": \"^3.0.5\",\n    \"js-cookie\": \"^3.0.5\",\n    \"redaxios\": \"^0.5.1\",\n    \"vue\": \"^3.5.16\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from './tests/utils/isSpaMode'\nimport { isPrerender } from './tests/utils/isPrerender'\nimport { isPreview } from './tests/utils/isPreview'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa' : ''}${isPreview ? '_preview' : ''}`,\n)\nconst START_PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa_start' : ''}`,\n)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\nconst spaModeCommand = `pnpm build:spa && pnpm start`\nconst ssrModeCommand = `pnpm build && pnpm start`\nconst prerenderModeCommand = `pnpm run test:e2e:startDummyServer && pnpm build:prerender && pnpm run test:e2e:stopDummyServer && pnpm start`\nconst previewModeCommand = `pnpm build && pnpm preview --port ${PORT}`\n\nconst getCommand = () => {\n  if (isSpaMode) return spaModeCommand\n  if (isPrerender) return prerenderModeCommand\n  if (isPreview) return previewModeCommand\n  return ssrModeCommand\n}\nconsole.log('running in spa mode: ', isSpaMode.toString())\nconsole.log('running in prerender mode: ', isPrerender.toString())\nconsole.log('running in preview mode: ', isPreview.toString())\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: getCommand(),\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      MODE: process.env.MODE || '',\n      VITE_NODE_ENV: 'test',\n      VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),\n      VITE_SERVER_PORT: String(PORT),\n      START_PORT: String(START_PORT),\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/vue-start/basic/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/vue-start/basic/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/server.js",
    "content": "import { toNodeHandler } from 'srvx/node'\nimport path from 'node:path'\nimport express from 'express'\nimport { createProxyMiddleware } from 'http-proxy-middleware'\n\nconst port = process.env.PORT || 3000\n\nconst startPort = process.env.START_PORT || 3001\n\nconst isSpaMode = process.env.MODE === 'spa'\nconst isPrerender = process.env.MODE === 'prerender'\n\nexport async function createStartServer() {\n  const server = (await import('./dist/server/server.js')).default\n  const nodeHandler = toNodeHandler(server.fetch)\n\n  const app = express()\n\n  // to keep testing uniform stop express from redirecting /posts to /posts/\n  // when serving pre-rendered pages\n  app.use(express.static('./dist/client', { redirect: !isPrerender }))\n\n  app.use(async (req, res, next) => {\n    try {\n      await nodeHandler(req, res)\n    } catch (error) {\n      next(error)\n    }\n  })\n\n  return { app }\n}\n\nexport async function createSpaServer() {\n  const app = express()\n\n  app.use(\n    '/api',\n    createProxyMiddleware({\n      target: `http://localhost:${startPort}/api`, // Replace with your target server's URL\n      changeOrigin: false, // Needed for virtual hosted sites,\n    }),\n  )\n\n  app.use(\n    '/_serverFn',\n    createProxyMiddleware({\n      target: `http://localhost:${startPort}/_serverFn`, // Replace with your target server's URL\n      changeOrigin: false, // Needed for virtual hosted sites,\n    }),\n  )\n\n  app.use(express.static('./dist/client'))\n\n  app.get('/{*splat}', (req, res) => {\n    res.sendFile(path.resolve('./dist/client/index.html'))\n  })\n\n  return { app }\n}\n\nif (isSpaMode) {\n  createSpaServer().then(async ({ app }) =>\n    app.listen(port, () => {\n      console.info(`Client Server: http://localhost:${port}`)\n    }),\n  )\n\n  createStartServer().then(async ({ app }) =>\n    app.listen(startPort, () => {\n      console.info(`Start Server: http://localhost:${startPort}`)\n    }),\n  )\n} else {\n  createStartServer().then(async ({ app }) =>\n    app.listen(port, () => {\n      console.info(`Start Server: http://localhost:${port}`)\n    }),\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/client.tsx",
    "content": "// DO NOT DELETE THIS FILE!!!\n// This file is a good smoke test to make sure the custom client entry is working\nimport { createSSRApp } from 'vue'\nimport {\n  StartClient,\n  configureHydrationSuppressions,\n  hydrateStart,\n} from '@tanstack/vue-start/client'\n\nconsole.log(\"[client-entry]: using custom client entry in 'src/client.tsx'\")\n\nhydrateStart().then((router) => {\n  const app = createSSRApp(StartClient, { router })\n  // Suppress expected hydration mismatch warnings for routes with ssr: false or 'data-only'\n  // Must be called before mount() - this uses Vue's warnHandler for dev mode warnings\n  configureHydrationSuppressions(app, router)\n  // Mount to #__app wrapper div for proper Vue hydration\n  // The Body component creates this wrapper on the server\n  app.mount('#__app')\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/components/CustomMessage.tsx",
    "content": "import { defineComponent } from 'vue'\n\nexport const CustomMessage = defineComponent({\n  props: {\n    message: {\n      type: String,\n      required: true,\n    },\n  },\n  setup(props) {\n    return () => (\n      <div class=\"py-2\">\n        <div class=\"italic\">This is a custom message:</div>\n        <p>{props.message}</p>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\nimport { defineComponent } from 'vue'\n\nexport const DefaultCatchBoundary = defineComponent({\n  props: {\n    error: {\n      type: Error,\n      required: true,\n    },\n  },\n  setup(props) {\n    const router = useRouter()\n    const isRoot = useMatch({\n      strict: false,\n      select: (state) => state.id === rootRouteId,\n    })\n\n    console.error(props.error)\n\n    return () => (\n      <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n        <ErrorComponent error={props.error} />\n        <div class=\"flex gap-2 items-center flex-wrap\">\n          <button\n            onClick={() => {\n              router.invalidate()\n            }}\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Try Again\n          </button>\n          {isRoot.value ? (\n            <Link\n              to=\"/\"\n              class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            >\n              Home\n            </Link>\n          ) : (\n            <Link\n              to=\"/\"\n              class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n              onClick={(e: MouseEvent) => {\n                e.preventDefault()\n                window.history.back()\n              }}\n            >\n              Go Back\n            </Link>\n          )}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\nimport { defineComponent } from 'vue'\n\nexport const NotFound = defineComponent({\n  props: {\n    children: {\n      type: String,\n      default: undefined,\n    },\n  },\n  setup(props, { slots }) {\n    return () => (\n      <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n        <div class=\"text-gray-600 dark:text-gray-400\">\n          {slots.default ? (\n            slots.default()\n          ) : (\n            <p>The page you are looking for does not exist.</p>\n          )}\n        </div>\n        <p class=\"flex items-center gap-2 flex-wrap\">\n          <button\n            onClick={() => window.history.back()}\n            class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n          >\n            Go back\n          </button>\n          <Link\n            to=\"/\"\n            class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n          >\n            Start Over\n          </Link>\n        </p>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/components/PostErrorComponent.tsx",
    "content": "import { ErrorComponent } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\nimport { defineComponent } from 'vue'\n\nexport const PostErrorComponent = defineComponent({\n  props: {\n    error: {\n      type: Error,\n      required: true,\n    },\n  },\n  setup(props) {\n    return () => <ErrorComponent error={props.error} />\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/components/RedirectOnClick.tsx",
    "content": "import { useServerFn } from '@tanstack/vue-start'\nimport { throwRedirect } from './throwRedirect'\nimport { defineComponent } from 'vue'\n\nexport const RedirectOnClick = defineComponent({\n  props: {\n    target: {\n      type: String as () => 'internal' | 'external',\n      required: true,\n    },\n    reloadDocument: {\n      type: Boolean,\n      default: undefined,\n    },\n    externalHost: {\n      type: String,\n      default: undefined,\n    },\n  },\n  setup(props) {\n    const execute = useServerFn(throwRedirect)\n    return () => (\n      <button\n        data-testid=\"redirect-on-click\"\n        onClick={() =>\n          execute({\n            data: {\n              target: props.target,\n              reloadDocument: props.reloadDocument,\n              externalHost: props.externalHost,\n            },\n          })\n        }\n      >\n        click me\n      </button>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/components/UserErrorComponent.tsx",
    "content": "import { ErrorComponent } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\nimport { defineComponent } from 'vue'\n\nexport const UserErrorComponent = defineComponent({\n  props: {\n    error: {\n      type: Error,\n      required: true,\n    },\n  },\n  setup(props) {\n    return () => <ErrorComponent error={props.error} />\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/components/throwRedirect.ts",
    "content": "import { redirect } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\n\nexport const throwRedirect = createServerFn()\n  .inputValidator(\n    (opts: {\n      target: 'internal' | 'external'\n      reloadDocument?: boolean\n      externalHost?: string\n    }) => opts,\n  )\n  .handler((ctx) => {\n    if (ctx.data.target === 'internal') {\n      throw redirect({ to: '/posts', reloadDocument: ctx.data.reloadDocument })\n    }\n    const href = ctx.data.externalHost ?? 'http://example.com'\n    throw redirect({\n      href,\n    })\n  })\n"
  },
  {
    "path": "e2e/vue-start/basic/src/raw-stream-fns.ts",
    "content": "import { RawStream, createServerFn } from '@tanstack/vue-start'\n\n// Helper to create a delayed Uint8Array stream\nfunction createDelayedStream(\n  chunks: Array<Uint8Array>,\n  delayMs: number,\n): ReadableStream<Uint8Array> {\n  return new ReadableStream<Uint8Array>({\n    async start(controller) {\n      for (const chunk of chunks) {\n        await new Promise((resolve) => setTimeout(resolve, delayMs))\n        controller.enqueue(chunk)\n      }\n      controller.close()\n    },\n  })\n}\n\n// Helper to create a stream with variable delays per chunk\n// Each entry is [chunk, delayBeforeMs] - delay happens BEFORE enqueueing the chunk\nfunction createVariableDelayStream(\n  chunksWithDelays: Array<[Uint8Array, number]>,\n): ReadableStream<Uint8Array> {\n  return new ReadableStream<Uint8Array>({\n    async start(controller) {\n      for (const [chunk, delayMs] of chunksWithDelays) {\n        await new Promise((resolve) => setTimeout(resolve, delayMs))\n        controller.enqueue(chunk)\n      }\n      controller.close()\n    },\n  })\n}\n\n// Helper to encode text to Uint8Array\nfunction encode(text: string): Uint8Array {\n  return new TextEncoder().encode(text)\n}\n\n// Export helpers for use in components and SSR routes\nexport { encode, createDelayedStream, concatBytes }\n\n// Expected data for hint tests - defined here for both server and client verification\n// Test 7: Text hint with pure text\nexport const TEST7_CHUNKS = [\n  encode('Hello, '),\n  encode('World! '),\n  encode('This is text.'),\n]\nexport const TEST7_EXPECTED = concatBytes(TEST7_CHUNKS)\n\n// Test 8: Text hint with pure binary (invalid UTF-8)\nexport const TEST8_CHUNKS = [\n  new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n  new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n]\nexport const TEST8_EXPECTED = concatBytes(TEST8_CHUNKS)\n\n// Test 9: Text hint with mixed content\nexport const TEST9_CHUNKS = [\n  encode('Valid UTF-8 text'),\n  new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n  encode(' More text'),\n]\nexport const TEST9_EXPECTED = concatBytes(TEST9_CHUNKS)\n\n// Test 10: Binary hint with text data\nexport const TEST10_CHUNKS = [encode('This is text but using binary hint')]\nexport const TEST10_EXPECTED = concatBytes(TEST10_CHUNKS)\n\n// Test 11: Binary hint with pure binary\nexport const TEST11_CHUNKS = [\n  new Uint8Array([0x00, 0x01, 0x02, 0xff, 0xfe, 0xfd]),\n]\nexport const TEST11_EXPECTED = concatBytes(TEST11_CHUNKS)\n\n// Helper to concatenate byte arrays\nfunction concatBytes(chunks: Array<Uint8Array>): Uint8Array {\n  const totalLength = chunks.reduce((acc, c) => acc + c.length, 0)\n  const result = new Uint8Array(totalLength)\n  let offset = 0\n  for (const chunk of chunks) {\n    result.set(chunk, offset)\n    offset += chunk.length\n  }\n  return result\n}\n\n// Test 1: Simple single raw stream\nexport const singleRawStreamFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(\n    [encode('chunk1'), encode('chunk2'), encode('chunk3')],\n    50,\n  )\n  return {\n    message: 'Single stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 2: Multiple raw streams\nexport const multipleRawStreamsFn = createServerFn().handler(async () => {\n  const stream1 = createDelayedStream(\n    [encode('stream1-a'), encode('stream1-b')],\n    30,\n  )\n  const stream2 = createDelayedStream(\n    [encode('stream2-a'), encode('stream2-b')],\n    50,\n  )\n  return {\n    message: 'Multiple streams test',\n    first: new RawStream(stream1),\n    second: new RawStream(stream2),\n  }\n})\n\n// Test 3: JSON streaming ends before raw stream\nexport const jsonEndsFirstFn = createServerFn().handler(async () => {\n  // Slow raw stream (takes 500ms total)\n  const slowStream = createDelayedStream(\n    [encode('slow-1'), encode('slow-2'), encode('slow-3'), encode('slow-4')],\n    125,\n  )\n  return {\n    message: 'JSON ends first test',\n    timestamp: Date.now(),\n    slowData: new RawStream(slowStream),\n  }\n})\n\n// Test 4: Raw stream ends before JSON streaming (fast stream, deferred JSON)\nexport const rawEndsFirstFn = createServerFn().handler(async () => {\n  // Fast raw stream (completes quickly)\n  const fastStream = createDelayedStream([encode('fast-done')], 10)\n\n  // Deferred promise - NOT awaited, so it streams as deferred JSON\n  const deferredData = new Promise<string>((resolve) =>\n    setTimeout(() => resolve('deferred-json-data'), 200),\n  )\n\n  return {\n    message: 'Raw ends first test',\n    deferredData,\n    fastData: new RawStream(fastStream),\n  }\n})\n\n// Test 5: Large binary data\nexport const largeBinaryFn = createServerFn().handler(async () => {\n  // Create 1KB chunks\n  const chunk = new Uint8Array(1024)\n  for (let i = 0; i < chunk.length; i++) {\n    chunk[i] = i % 256\n  }\n\n  const stream = createDelayedStream([chunk, chunk, chunk], 20)\n\n  return {\n    message: 'Large binary test',\n    size: 3072,\n    binary: new RawStream(stream),\n  }\n})\n\n// Test 6: Mixed streaming (promise + raw stream)\nexport const mixedStreamingFn = createServerFn().handler(async () => {\n  const rawStream = createDelayedStream(\n    [encode('mixed-raw-1'), encode('mixed-raw-2')],\n    50,\n  )\n\n  return {\n    immediate: 'immediate-value',\n    deferred: new Promise<string>((resolve) =>\n      setTimeout(() => resolve('deferred-value'), 100),\n    ),\n    raw: new RawStream(rawStream),\n  }\n})\n\n// Test 7: Text hint with pure text data (should use UTF-8 encoding)\nexport const textHintPureTextFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST7_CHUNKS, 30)\n  return {\n    message: 'Text hint with pure text',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 8: Text hint with pure binary data (should fallback to base64)\nexport const textHintPureBinaryFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST8_CHUNKS, 30)\n  return {\n    message: 'Text hint with pure binary',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 9: Text hint with mixed content (some UTF-8, some binary)\nexport const textHintMixedFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST9_CHUNKS, 30)\n  return {\n    message: 'Text hint with mixed content',\n    data: new RawStream(stream, { hint: 'text' }),\n  }\n})\n\n// Test 10: Binary hint with text data (should still use base64)\nexport const binaryHintTextFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST10_CHUNKS, 30)\n  return {\n    message: 'Binary hint with text data',\n    data: new RawStream(stream, { hint: 'binary' }),\n  }\n})\n\n// Test 11: Binary hint with pure binary data\nexport const binaryHintBinaryFn = createServerFn().handler(async () => {\n  const stream = createDelayedStream(TEST11_CHUNKS, 30)\n  return {\n    message: 'Binary hint with binary data',\n    data: new RawStream(stream, { hint: 'binary' }),\n  }\n})\n\n// ============================================================================\n// MULTIPLEXING TESTS - Verify correct interleaving of multiple streams\n// ============================================================================\n\n// Expected data for multiplexing tests\n// Test 12: Two streams with interleaved timing\n// Stream A: sends at 0ms, 150ms, 200ms (3 chunks with pauses)\n// Stream B: sends at 50ms, 100ms, 250ms (3 chunks, different rhythm)\nexport const TEST12_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('A1-first'), 0], // immediate\n  [encode('A2-after-pause'), 150], // 150ms pause\n  [encode('A3-quick'), 50], // 50ms after A2\n]\nexport const TEST12_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('B1-start'), 50], // 50ms after start\n  [encode('B2-continue'), 50], // 50ms after B1\n  [encode('B3-final'), 150], // 150ms pause then final\n]\nexport const TEST12_STREAM_A_EXPECTED = concatBytes(\n  TEST12_STREAM_A_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST12_STREAM_B_EXPECTED = concatBytes(\n  TEST12_STREAM_B_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 13: Burst-pause-burst pattern (single stream)\n// 3 chunks quickly, long pause, 3 more chunks quickly\nexport const TEST13_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('burst1-a'), 10],\n  [encode('burst1-b'), 10],\n  [encode('burst1-c'), 10],\n  [encode('pause-then-burst2-a'), 200], // long pause\n  [encode('burst2-b'), 10],\n  [encode('burst2-c'), 10],\n]\nexport const TEST13_EXPECTED = concatBytes(\n  TEST13_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 14: Three concurrent streams with different patterns\n// Stream A: fast steady (every 30ms)\n// Stream B: slow steady (every 100ms)\n// Stream C: burst pattern (quick-pause-quick)\nexport const TEST14_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('A1'), 30],\n  [encode('A2'), 30],\n  [encode('A3'), 30],\n  [encode('A4'), 30],\n]\nexport const TEST14_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('B1-slow'), 100],\n  [encode('B2-slow'), 100],\n]\nexport const TEST14_STREAM_C_CHUNKS: Array<[Uint8Array, number]> = [\n  [encode('C1-burst'), 20],\n  [encode('C2-burst'), 20],\n  [encode('C3-after-pause'), 150],\n]\nexport const TEST14_STREAM_A_EXPECTED = concatBytes(\n  TEST14_STREAM_A_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST14_STREAM_B_EXPECTED = concatBytes(\n  TEST14_STREAM_B_CHUNKS.map(([chunk]) => chunk),\n)\nexport const TEST14_STREAM_C_EXPECTED = concatBytes(\n  TEST14_STREAM_C_CHUNKS.map(([chunk]) => chunk),\n)\n\n// Test 12: Interleaved multiplexing - two streams with variable delays\nexport const interleavedStreamsFn = createServerFn().handler(async () => {\n  const streamA = createVariableDelayStream(TEST12_STREAM_A_CHUNKS)\n  const streamB = createVariableDelayStream(TEST12_STREAM_B_CHUNKS)\n\n  return {\n    message: 'Interleaved streams test',\n    streamA: new RawStream(streamA),\n    streamB: new RawStream(streamB),\n  }\n})\n\n// Test 13: Burst-pause-burst pattern\nexport const burstPauseBurstFn = createServerFn().handler(async () => {\n  const stream = createVariableDelayStream(TEST13_CHUNKS)\n\n  return {\n    message: 'Burst-pause-burst test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 14: Three concurrent streams\nexport const threeStreamsFn = createServerFn().handler(async () => {\n  const streamA = createVariableDelayStream(TEST14_STREAM_A_CHUNKS)\n  const streamB = createVariableDelayStream(TEST14_STREAM_B_CHUNKS)\n  const streamC = createVariableDelayStream(TEST14_STREAM_C_CHUNKS)\n\n  return {\n    message: 'Three concurrent streams test',\n    fast: new RawStream(streamA),\n    slow: new RawStream(streamB),\n    burst: new RawStream(streamC),\n  }\n})\n\n// ============================================================================\n// EDGE CASE TESTS\n// ============================================================================\n\n// Test 15: Empty stream (zero bytes)\nexport const emptyStreamFn = createServerFn().handler(async () => {\n  // Stream that immediately closes with no data\n  const stream = new ReadableStream<Uint8Array>({\n    start(controller) {\n      controller.close()\n    },\n  })\n\n  return {\n    message: 'Empty stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Test 16: Stream that errors mid-flight\nexport const errorStreamFn = createServerFn().handler(async () => {\n  // Stream that sends some data then errors\n  const stream = new ReadableStream<Uint8Array>({\n    async start(controller) {\n      controller.enqueue(encode('chunk-before-error'))\n      await new Promise((resolve) => setTimeout(resolve, 50))\n      controller.error(new Error('Intentional stream error'))\n    },\n  })\n\n  return {\n    message: 'Error stream test',\n    data: new RawStream(stream),\n  }\n})\n\n// Helpers for consuming streams (exported for use in components)\n// Note: RawStream is the marker class used in loaders/server functions,\n// but after SSR deserialization it becomes ReadableStream<Uint8Array>.\n// We accept both types to handle the TypeScript mismatch.\nfunction getActualStream(\n  stream: ReadableStream<Uint8Array> | RawStream,\n): ReadableStream<Uint8Array> {\n  return stream instanceof RawStream\n    ? stream.stream\n    : (stream as ReadableStream<Uint8Array>)\n}\n\nconst streamTextCache = new WeakMap<\n  ReadableStream<Uint8Array>,\n  Promise<string>\n>()\nconst streamBytesCache = new WeakMap<\n  ReadableStream<Uint8Array>,\n  Promise<Uint8Array>\n>()\nconst streamByteCountCache = new WeakMap<\n  ReadableStream<Uint8Array>,\n  Promise<number>\n>()\n\nexport function createStreamConsumer() {\n  const decoder = new TextDecoder()\n\n  return async function consumeStream(\n    stream: ReadableStream<Uint8Array> | RawStream,\n  ): Promise<string> {\n    const actualStream = getActualStream(stream)\n    const cached = streamTextCache.get(actualStream)\n    if (cached) {\n      return cached\n    }\n\n    const promise = (async () => {\n      const reader = actualStream.getReader()\n      const chunks: Array<string> = []\n\n      try {\n        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n        while (true) {\n          const { done, value } = await reader.read()\n          if (done) break\n          chunks.push(decoder.decode(value, { stream: true }))\n        }\n      } finally {\n        reader.releaseLock()\n      }\n\n      return chunks.join('')\n    })()\n\n    streamTextCache.set(actualStream, promise)\n    return promise\n  }\n}\n\nexport async function consumeBinaryStream(\n  stream: ReadableStream<Uint8Array> | RawStream,\n): Promise<number> {\n  const actualStream = getActualStream(stream)\n  const cached = streamByteCountCache.get(actualStream)\n  if (cached) {\n    return cached\n  }\n\n  const promise = (async () => {\n    const reader = actualStream.getReader()\n    let totalBytes = 0\n\n    try {\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      while (true) {\n        const { done, value } = await reader.read()\n        if (done) break\n        totalBytes += value.length\n      }\n    } finally {\n      reader.releaseLock()\n    }\n\n    return totalBytes\n  })()\n\n  streamByteCountCache.set(actualStream, promise)\n  return promise\n}\n\n// Helper to collect all bytes from a stream\nexport async function collectBytes(\n  stream: ReadableStream<Uint8Array> | RawStream,\n): Promise<Uint8Array> {\n  const actualStream = getActualStream(stream)\n  const cached = streamBytesCache.get(actualStream)\n  if (cached) {\n    return cached\n  }\n\n  const promise = (async () => {\n    const reader = actualStream.getReader()\n    const chunks: Array<Uint8Array> = []\n    let totalLength = 0\n\n    try {\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      while (true) {\n        const { done, value } = await reader.read()\n        if (done) break\n        chunks.push(value)\n        totalLength += value.length\n      }\n    } finally {\n      reader.releaseLock()\n    }\n\n    const result = new Uint8Array(totalLength)\n    let pos = 0\n    for (const chunk of chunks) {\n      result.set(chunk, pos)\n      pos += chunk.length\n    }\n    return result\n  })()\n\n  streamBytesCache.set(actualStream, promise)\n  return promise\n}\n\n// Compare two Uint8Arrays byte-by-byte\nexport function compareBytes(\n  actual: Uint8Array,\n  expected: Uint8Array,\n): {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n} {\n  if (actual.length !== expected.length) {\n    return {\n      match: false,\n      mismatchIndex: -1, // -1 indicates length mismatch\n      actualLength: actual.length,\n      expectedLength: expected.length,\n    }\n  }\n  for (let i = 0; i < actual.length; i++) {\n    if (actual[i] !== expected[i]) {\n      return {\n        match: false,\n        mismatchIndex: i,\n        actualLength: actual.length,\n        expectedLength: expected.length,\n      }\n    }\n  }\n  return {\n    match: true,\n    mismatchIndex: null,\n    actualLength: actual.length,\n    expectedLength: expected.length,\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as StreamRouteImport } from './routes/stream'\nimport { Route as ScriptsRouteImport } from './routes/scripts'\nimport { Route as RawStreamRouteImport } from './routes/raw-stream'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LinksRouteImport } from './routes/links'\nimport { Route as InlineScriptsRouteImport } from './routes/inline-scripts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as SpecialCharsRouteRouteImport } from './routes/specialChars/route'\nimport { Route as SearchParamsRouteRouteImport } from './routes/search-params/route'\nimport { Route as NotFoundRouteRouteImport } from './routes/not-found/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as SearchParamsIndexRouteImport } from './routes/search-params/index'\nimport { Route as RedirectIndexRouteImport } from './routes/redirect/index'\nimport { Route as RawStreamIndexRouteImport } from './routes/raw-stream/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as NotFoundIndexRouteImport } from './routes/not-found/index'\nimport { Route as MultiCookieRedirectIndexRouteImport } from './routes/multi-cookie-redirect/index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as SpecialCharsChar45824Char54620Char48124Char44397RouteImport } from './routes/specialChars/대한민국'\nimport { Route as SpecialCharsSearchRouteImport } from './routes/specialChars/search'\nimport { Route as SpecialCharsHashRouteImport } from './routes/specialChars/hash'\nimport { Route as SpecialCharsParamRouteImport } from './routes/specialChars/$param'\nimport { Route as SearchParamsLoaderThrowsRedirectRouteImport } from './routes/search-params/loader-throws-redirect'\nimport { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default'\nimport { Route as RedirectTargetRouteImport } from './routes/redirect/$target'\nimport { Route as RawStreamSsrTextHintRouteImport } from './routes/raw-stream/ssr-text-hint'\nimport { Route as RawStreamSsrSingleRouteImport } from './routes/raw-stream/ssr-single'\nimport { Route as RawStreamSsrMultipleRouteImport } from './routes/raw-stream/ssr-multiple'\nimport { Route as RawStreamSsrMixedRouteImport } from './routes/raw-stream/ssr-mixed'\nimport { Route as RawStreamSsrBinaryHintRouteImport } from './routes/raw-stream/ssr-binary-hint'\nimport { Route as RawStreamClientCallRouteImport } from './routes/raw-stream/client-call'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as NotFoundViaLoaderRouteImport } from './routes/not-found/via-loader'\nimport { Route as NotFoundViaBeforeLoadTargetRootRouteImport } from './routes/not-found/via-beforeLoad-target-root'\nimport { Route as NotFoundViaBeforeLoadRouteImport } from './routes/not-found/via-beforeLoad'\nimport { Route as MultiCookieRedirectTargetRouteImport } from './routes/multi-cookie-redirect/target'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as SpecialCharsMalformedRouteRouteImport } from './routes/specialChars/malformed/route'\nimport { Route as NotFoundParentBoundaryRouteRouteImport } from './routes/not-found/parent-boundary/route'\nimport { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index'\nimport { Route as SpecialCharsMalformedSearchRouteImport } from './routes/specialChars/malformed/search'\nimport { Route as SpecialCharsMalformedParamRouteImport } from './routes/specialChars/malformed/$param'\nimport { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader'\nimport { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as NotFoundParentBoundaryViaBeforeLoadRouteImport } from './routes/not-found/parent-boundary/via-beforeLoad'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as RedirectTargetServerFnIndexRouteImport } from './routes/redirect/$target/serverFn/index'\nimport { Route as RedirectTargetServerFnViaUseServerFnRouteImport } from './routes/redirect/$target/serverFn/via-useServerFn'\nimport { Route as RedirectTargetServerFnViaLoaderRouteImport } from './routes/redirect/$target/serverFn/via-loader'\nimport { Route as RedirectTargetServerFnViaBeforeLoadRouteImport } from './routes/redirect/$target/serverFn/via-beforeLoad'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst StreamRoute = StreamRouteImport.update({\n  id: '/stream',\n  path: '/stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ScriptsRoute = ScriptsRouteImport.update({\n  id: '/scripts',\n  path: '/scripts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamRoute = RawStreamRouteImport.update({\n  id: '/raw-stream',\n  path: '/raw-stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LinksRoute = LinksRouteImport.update({\n  id: '/links',\n  path: '/links',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst InlineScriptsRoute = InlineScriptsRouteImport.update({\n  id: '/inline-scripts',\n  path: '/inline-scripts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SpecialCharsRouteRoute = SpecialCharsRouteRouteImport.update({\n  id: '/specialChars',\n  path: '/specialChars',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({\n  id: '/search-params',\n  path: '/search-params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotFoundRouteRoute = NotFoundRouteRouteImport.update({\n  id: '/not-found',\n  path: '/not-found',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RedirectIndexRoute = RedirectIndexRouteImport.update({\n  id: '/redirect/',\n  path: '/redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamIndexRoute = RawStreamIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst NotFoundIndexRoute = NotFoundIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst MultiCookieRedirectIndexRoute =\n  MultiCookieRedirectIndexRouteImport.update({\n    id: '/multi-cookie-redirect/',\n    path: '/multi-cookie-redirect/',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst SpecialCharsChar45824Char54620Char48124Char44397Route =\n  SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => SpecialCharsRouteRoute,\n  } as any)\nconst SpecialCharsSearchRoute = SpecialCharsSearchRouteImport.update({\n  id: '/search',\n  path: '/search',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SpecialCharsHashRoute = SpecialCharsHashRouteImport.update({\n  id: '/hash',\n  path: '/hash',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SpecialCharsParamRoute = SpecialCharsParamRouteImport.update({\n  id: '/$param',\n  path: '/$param',\n  getParentRoute: () => SpecialCharsRouteRoute,\n} as any)\nconst SearchParamsLoaderThrowsRedirectRoute =\n  SearchParamsLoaderThrowsRedirectRouteImport.update({\n    id: '/loader-throws-redirect',\n    path: '/loader-throws-redirect',\n    getParentRoute: () => SearchParamsRouteRoute,\n  } as any)\nconst SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({\n  id: '/default',\n  path: '/default',\n  getParentRoute: () => SearchParamsRouteRoute,\n} as any)\nconst RedirectTargetRoute = RedirectTargetRouteImport.update({\n  id: '/redirect/$target',\n  path: '/redirect/$target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawStreamSsrTextHintRoute = RawStreamSsrTextHintRouteImport.update({\n  id: '/ssr-text-hint',\n  path: '/ssr-text-hint',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrSingleRoute = RawStreamSsrSingleRouteImport.update({\n  id: '/ssr-single',\n  path: '/ssr-single',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrMultipleRoute = RawStreamSsrMultipleRouteImport.update({\n  id: '/ssr-multiple',\n  path: '/ssr-multiple',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrMixedRoute = RawStreamSsrMixedRouteImport.update({\n  id: '/ssr-mixed',\n  path: '/ssr-mixed',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamSsrBinaryHintRoute = RawStreamSsrBinaryHintRouteImport.update({\n  id: '/ssr-binary-hint',\n  path: '/ssr-binary-hint',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst RawStreamClientCallRoute = RawStreamClientCallRouteImport.update({\n  id: '/client-call',\n  path: '/client-call',\n  getParentRoute: () => RawStreamRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({\n  id: '/via-loader',\n  path: '/via-loader',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst NotFoundViaBeforeLoadTargetRootRoute =\n  NotFoundViaBeforeLoadTargetRootRouteImport.update({\n    id: '/via-beforeLoad-target-root',\n    path: '/via-beforeLoad-target-root',\n    getParentRoute: () => NotFoundRouteRoute,\n  } as any)\nconst NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({\n  id: '/via-beforeLoad',\n  path: '/via-beforeLoad',\n  getParentRoute: () => NotFoundRouteRoute,\n} as any)\nconst MultiCookieRedirectTargetRoute =\n  MultiCookieRedirectTargetRouteImport.update({\n    id: '/multi-cookie-redirect/target',\n    path: '/multi-cookie-redirect/target',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst SpecialCharsMalformedRouteRoute =\n  SpecialCharsMalformedRouteRouteImport.update({\n    id: '/malformed',\n    path: '/malformed',\n    getParentRoute: () => SpecialCharsRouteRoute,\n  } as any)\nconst NotFoundParentBoundaryRouteRoute =\n  NotFoundParentBoundaryRouteRouteImport.update({\n    id: '/parent-boundary',\n    path: '/parent-boundary',\n    getParentRoute: () => NotFoundRouteRoute,\n  } as any)\nconst RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst SpecialCharsMalformedSearchRoute =\n  SpecialCharsMalformedSearchRouteImport.update({\n    id: '/search',\n    path: '/search',\n    getParentRoute: () => SpecialCharsMalformedRouteRoute,\n  } as any)\nconst SpecialCharsMalformedParamRoute =\n  SpecialCharsMalformedParamRouteImport.update({\n    id: '/$param',\n    path: '/$param',\n    getParentRoute: () => SpecialCharsMalformedRouteRoute,\n  } as any)\nconst RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({\n  id: '/via-loader',\n  path: '/via-loader',\n  getParentRoute: () => RedirectTargetRoute,\n} as any)\nconst RedirectTargetViaBeforeLoadRoute =\n  RedirectTargetViaBeforeLoadRouteImport.update({\n    id: '/via-beforeLoad',\n    path: '/via-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotFoundParentBoundaryViaBeforeLoadRoute =\n  NotFoundParentBoundaryViaBeforeLoadRouteImport.update({\n    id: '/via-beforeLoad',\n    path: '/via-beforeLoad',\n    getParentRoute: () => NotFoundParentBoundaryRouteRoute,\n  } as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst RedirectTargetServerFnIndexRoute =\n  RedirectTargetServerFnIndexRouteImport.update({\n    id: '/serverFn/',\n    path: '/serverFn/',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaUseServerFnRoute =\n  RedirectTargetServerFnViaUseServerFnRouteImport.update({\n    id: '/serverFn/via-useServerFn',\n    path: '/serverFn/via-useServerFn',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaLoaderRoute =\n  RedirectTargetServerFnViaLoaderRouteImport.update({\n    id: '/serverFn/via-loader',\n    path: '/serverFn/via-loader',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\nconst RedirectTargetServerFnViaBeforeLoadRoute =\n  RedirectTargetServerFnViaBeforeLoadRouteImport.update({\n    id: '/serverFn/via-beforeLoad',\n    path: '/serverFn/via-beforeLoad',\n    getParentRoute: () => RedirectTargetRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/not-found': typeof NotFoundRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/raw-stream': typeof RawStreamRouteWithChildren\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/users': typeof UsersRouteWithChildren\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute\n  '/not-found/': typeof NotFoundIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/raw-stream/': typeof RawStreamIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect': typeof MultiCookieRedirectIndexRoute\n  '/not-found': typeof NotFoundIndexRoute\n  '/posts': typeof PostsIndexRoute\n  '/raw-stream': typeof RawStreamIndexRoute\n  '/redirect': typeof RedirectIndexRoute\n  '/search-params': typeof SearchParamsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/redirect/$target': typeof RedirectTargetIndexRoute\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn': typeof RedirectTargetServerFnIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/not-found': typeof NotFoundRouteRouteWithChildren\n  '/search-params': typeof SearchParamsRouteRouteWithChildren\n  '/specialChars': typeof SpecialCharsRouteRouteWithChildren\n  '/_layout': typeof LayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/inline-scripts': typeof InlineScriptsRoute\n  '/links': typeof LinksRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/raw-stream': typeof RawStreamRouteWithChildren\n  '/scripts': typeof ScriptsRoute\n  '/stream': typeof StreamRoute\n  '/users': typeof UsersRouteWithChildren\n  '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren\n  '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute\n  '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute\n  '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute\n  '/not-found/via-loader': typeof NotFoundViaLoaderRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/raw-stream/client-call': typeof RawStreamClientCallRoute\n  '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute\n  '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute\n  '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute\n  '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute\n  '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute\n  '/redirect/$target': typeof RedirectTargetRouteWithChildren\n  '/search-params/default': typeof SearchParamsDefaultRoute\n  '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute\n  '/specialChars/$param': typeof SpecialCharsParamRoute\n  '/specialChars/hash': typeof SpecialCharsHashRoute\n  '/specialChars/search': typeof SpecialCharsSearchRoute\n  '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n  '/users/$userId': typeof UsersUserIdRoute\n  '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute\n  '/not-found/': typeof NotFoundIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/raw-stream/': typeof RawStreamIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/search-params/': typeof SearchParamsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n  '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute\n  '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute\n  '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute\n  '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute\n  '/redirect/$target/': typeof RedirectTargetIndexRoute\n  '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute\n  '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute\n  '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute\n  '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/not-found'\n    | '/search-params'\n    | '/specialChars'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/posts'\n    | '/raw-stream'\n    | '/scripts'\n    | '/stream'\n    | '/users'\n    | '/not-found/parent-boundary'\n    | '/specialChars/malformed'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect/'\n    | '/not-found/'\n    | '/posts/'\n    | '/raw-stream/'\n    | '/redirect/'\n    | '/search-params/'\n    | '/users/'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$userId'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/redirect/$target/'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/specialChars'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/scripts'\n    | '/stream'\n    | '/not-found/parent-boundary'\n    | '/specialChars/malformed'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect'\n    | '/not-found'\n    | '/posts'\n    | '/raw-stream'\n    | '/redirect'\n    | '/search-params'\n    | '/users'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$userId'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/redirect/$target'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn'\n  id:\n    | '__root__'\n    | '/'\n    | '/not-found'\n    | '/search-params'\n    | '/specialChars'\n    | '/_layout'\n    | '/deferred'\n    | '/inline-scripts'\n    | '/links'\n    | '/posts'\n    | '/raw-stream'\n    | '/scripts'\n    | '/stream'\n    | '/users'\n    | '/not-found/parent-boundary'\n    | '/specialChars/malformed'\n    | '/_layout/_layout-2'\n    | '/api/users'\n    | '/multi-cookie-redirect/target'\n    | '/not-found/via-beforeLoad'\n    | '/not-found/via-beforeLoad-target-root'\n    | '/not-found/via-loader'\n    | '/posts/$postId'\n    | '/raw-stream/client-call'\n    | '/raw-stream/ssr-binary-hint'\n    | '/raw-stream/ssr-mixed'\n    | '/raw-stream/ssr-multiple'\n    | '/raw-stream/ssr-single'\n    | '/raw-stream/ssr-text-hint'\n    | '/redirect/$target'\n    | '/search-params/default'\n    | '/search-params/loader-throws-redirect'\n    | '/specialChars/$param'\n    | '/specialChars/hash'\n    | '/specialChars/search'\n    | '/specialChars/대한민국'\n    | '/users/$userId'\n    | '/multi-cookie-redirect/'\n    | '/not-found/'\n    | '/posts/'\n    | '/raw-stream/'\n    | '/redirect/'\n    | '/search-params/'\n    | '/users/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/api/users/$userId'\n    | '/not-found/parent-boundary/via-beforeLoad'\n    | '/posts_/$postId/deep'\n    | '/redirect/$target/via-beforeLoad'\n    | '/redirect/$target/via-loader'\n    | '/specialChars/malformed/$param'\n    | '/specialChars/malformed/search'\n    | '/redirect/$target/'\n    | '/redirect/$target/serverFn/via-beforeLoad'\n    | '/redirect/$target/serverFn/via-loader'\n    | '/redirect/$target/serverFn/via-useServerFn'\n    | '/redirect/$target/serverFn/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  NotFoundRouteRoute: typeof NotFoundRouteRouteWithChildren\n  SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren\n  SpecialCharsRouteRoute: typeof SpecialCharsRouteRouteWithChildren\n  LayoutRoute: typeof LayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  InlineScriptsRoute: typeof InlineScriptsRoute\n  LinksRoute: typeof LinksRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RawStreamRoute: typeof RawStreamRouteWithChildren\n  ScriptsRoute: typeof ScriptsRoute\n  StreamRoute: typeof StreamRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  MultiCookieRedirectTargetRoute: typeof MultiCookieRedirectTargetRoute\n  RedirectTargetRoute: typeof RedirectTargetRouteWithChildren\n  MultiCookieRedirectIndexRoute: typeof MultiCookieRedirectIndexRoute\n  RedirectIndexRoute: typeof RedirectIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/stream': {\n      id: '/stream'\n      path: '/stream'\n      fullPath: '/stream'\n      preLoaderRoute: typeof StreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/scripts': {\n      id: '/scripts'\n      path: '/scripts'\n      fullPath: '/scripts'\n      preLoaderRoute: typeof ScriptsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream': {\n      id: '/raw-stream'\n      path: '/raw-stream'\n      fullPath: '/raw-stream'\n      preLoaderRoute: typeof RawStreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/links': {\n      id: '/links'\n      path: '/links'\n      fullPath: '/links'\n      preLoaderRoute: typeof LinksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/inline-scripts': {\n      id: '/inline-scripts'\n      path: '/inline-scripts'\n      fullPath: '/inline-scripts'\n      preLoaderRoute: typeof InlineScriptsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/specialChars': {\n      id: '/specialChars'\n      path: '/specialChars'\n      fullPath: '/specialChars'\n      preLoaderRoute: typeof SpecialCharsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search-params': {\n      id: '/search-params'\n      path: '/search-params'\n      fullPath: '/search-params'\n      preLoaderRoute: typeof SearchParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/not-found': {\n      id: '/not-found'\n      path: '/not-found'\n      fullPath: '/not-found'\n      preLoaderRoute: typeof NotFoundRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/search-params/': {\n      id: '/search-params/'\n      path: '/'\n      fullPath: '/search-params/'\n      preLoaderRoute: typeof SearchParamsIndexRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/redirect/': {\n      id: '/redirect/'\n      path: '/redirect'\n      fullPath: '/redirect/'\n      preLoaderRoute: typeof RedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream/': {\n      id: '/raw-stream/'\n      path: '/'\n      fullPath: '/raw-stream/'\n      preLoaderRoute: typeof RawStreamIndexRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/not-found/': {\n      id: '/not-found/'\n      path: '/'\n      fullPath: '/not-found/'\n      preLoaderRoute: typeof NotFoundIndexRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/multi-cookie-redirect/': {\n      id: '/multi-cookie-redirect/'\n      path: '/multi-cookie-redirect'\n      fullPath: '/multi-cookie-redirect/'\n      preLoaderRoute: typeof MultiCookieRedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/specialChars/대한민국': {\n      id: '/specialChars/대한민국'\n      path: '/대한민국'\n      fullPath: '/specialChars/대한민국'\n      preLoaderRoute: typeof SpecialCharsChar45824Char54620Char48124Char44397RouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/search': {\n      id: '/specialChars/search'\n      path: '/search'\n      fullPath: '/specialChars/search'\n      preLoaderRoute: typeof SpecialCharsSearchRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/hash': {\n      id: '/specialChars/hash'\n      path: '/hash'\n      fullPath: '/specialChars/hash'\n      preLoaderRoute: typeof SpecialCharsHashRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/specialChars/$param': {\n      id: '/specialChars/$param'\n      path: '/$param'\n      fullPath: '/specialChars/$param'\n      preLoaderRoute: typeof SpecialCharsParamRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/search-params/loader-throws-redirect': {\n      id: '/search-params/loader-throws-redirect'\n      path: '/loader-throws-redirect'\n      fullPath: '/search-params/loader-throws-redirect'\n      preLoaderRoute: typeof SearchParamsLoaderThrowsRedirectRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/search-params/default': {\n      id: '/search-params/default'\n      path: '/default'\n      fullPath: '/search-params/default'\n      preLoaderRoute: typeof SearchParamsDefaultRouteImport\n      parentRoute: typeof SearchParamsRouteRoute\n    }\n    '/redirect/$target': {\n      id: '/redirect/$target'\n      path: '/redirect/$target'\n      fullPath: '/redirect/$target'\n      preLoaderRoute: typeof RedirectTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-stream/ssr-text-hint': {\n      id: '/raw-stream/ssr-text-hint'\n      path: '/ssr-text-hint'\n      fullPath: '/raw-stream/ssr-text-hint'\n      preLoaderRoute: typeof RawStreamSsrTextHintRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-single': {\n      id: '/raw-stream/ssr-single'\n      path: '/ssr-single'\n      fullPath: '/raw-stream/ssr-single'\n      preLoaderRoute: typeof RawStreamSsrSingleRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-multiple': {\n      id: '/raw-stream/ssr-multiple'\n      path: '/ssr-multiple'\n      fullPath: '/raw-stream/ssr-multiple'\n      preLoaderRoute: typeof RawStreamSsrMultipleRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-mixed': {\n      id: '/raw-stream/ssr-mixed'\n      path: '/ssr-mixed'\n      fullPath: '/raw-stream/ssr-mixed'\n      preLoaderRoute: typeof RawStreamSsrMixedRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/ssr-binary-hint': {\n      id: '/raw-stream/ssr-binary-hint'\n      path: '/ssr-binary-hint'\n      fullPath: '/raw-stream/ssr-binary-hint'\n      preLoaderRoute: typeof RawStreamSsrBinaryHintRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/raw-stream/client-call': {\n      id: '/raw-stream/client-call'\n      path: '/client-call'\n      fullPath: '/raw-stream/client-call'\n      preLoaderRoute: typeof RawStreamClientCallRouteImport\n      parentRoute: typeof RawStreamRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/not-found/via-loader': {\n      id: '/not-found/via-loader'\n      path: '/via-loader'\n      fullPath: '/not-found/via-loader'\n      preLoaderRoute: typeof NotFoundViaLoaderRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/not-found/via-beforeLoad-target-root': {\n      id: '/not-found/via-beforeLoad-target-root'\n      path: '/via-beforeLoad-target-root'\n      fullPath: '/not-found/via-beforeLoad-target-root'\n      preLoaderRoute: typeof NotFoundViaBeforeLoadTargetRootRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/not-found/via-beforeLoad': {\n      id: '/not-found/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/not-found/via-beforeLoad'\n      preLoaderRoute: typeof NotFoundViaBeforeLoadRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/multi-cookie-redirect/target': {\n      id: '/multi-cookie-redirect/target'\n      path: '/multi-cookie-redirect/target'\n      fullPath: '/multi-cookie-redirect/target'\n      preLoaderRoute: typeof MultiCookieRedirectTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/specialChars/malformed': {\n      id: '/specialChars/malformed'\n      path: '/malformed'\n      fullPath: '/specialChars/malformed'\n      preLoaderRoute: typeof SpecialCharsMalformedRouteRouteImport\n      parentRoute: typeof SpecialCharsRouteRoute\n    }\n    '/not-found/parent-boundary': {\n      id: '/not-found/parent-boundary'\n      path: '/parent-boundary'\n      fullPath: '/not-found/parent-boundary'\n      preLoaderRoute: typeof NotFoundParentBoundaryRouteRouteImport\n      parentRoute: typeof NotFoundRouteRoute\n    }\n    '/redirect/$target/': {\n      id: '/redirect/$target/'\n      path: '/'\n      fullPath: '/redirect/$target/'\n      preLoaderRoute: typeof RedirectTargetIndexRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/specialChars/malformed/search': {\n      id: '/specialChars/malformed/search'\n      path: '/search'\n      fullPath: '/specialChars/malformed/search'\n      preLoaderRoute: typeof SpecialCharsMalformedSearchRouteImport\n      parentRoute: typeof SpecialCharsMalformedRouteRoute\n    }\n    '/specialChars/malformed/$param': {\n      id: '/specialChars/malformed/$param'\n      path: '/$param'\n      fullPath: '/specialChars/malformed/$param'\n      preLoaderRoute: typeof SpecialCharsMalformedParamRouteImport\n      parentRoute: typeof SpecialCharsMalformedRouteRoute\n    }\n    '/redirect/$target/via-loader': {\n      id: '/redirect/$target/via-loader'\n      path: '/via-loader'\n      fullPath: '/redirect/$target/via-loader'\n      preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/via-beforeLoad': {\n      id: '/redirect/$target/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/redirect/$target/via-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/not-found/parent-boundary/via-beforeLoad': {\n      id: '/not-found/parent-boundary/via-beforeLoad'\n      path: '/via-beforeLoad'\n      fullPath: '/not-found/parent-boundary/via-beforeLoad'\n      preLoaderRoute: typeof NotFoundParentBoundaryViaBeforeLoadRouteImport\n      parentRoute: typeof NotFoundParentBoundaryRouteRoute\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/redirect/$target/serverFn/': {\n      id: '/redirect/$target/serverFn/'\n      path: '/serverFn'\n      fullPath: '/redirect/$target/serverFn/'\n      preLoaderRoute: typeof RedirectTargetServerFnIndexRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-useServerFn': {\n      id: '/redirect/$target/serverFn/via-useServerFn'\n      path: '/serverFn/via-useServerFn'\n      fullPath: '/redirect/$target/serverFn/via-useServerFn'\n      preLoaderRoute: typeof RedirectTargetServerFnViaUseServerFnRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-loader': {\n      id: '/redirect/$target/serverFn/via-loader'\n      path: '/serverFn/via-loader'\n      fullPath: '/redirect/$target/serverFn/via-loader'\n      preLoaderRoute: typeof RedirectTargetServerFnViaLoaderRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n    '/redirect/$target/serverFn/via-beforeLoad': {\n      id: '/redirect/$target/serverFn/via-beforeLoad'\n      path: '/serverFn/via-beforeLoad'\n      fullPath: '/redirect/$target/serverFn/via-beforeLoad'\n      preLoaderRoute: typeof RedirectTargetServerFnViaBeforeLoadRouteImport\n      parentRoute: typeof RedirectTargetRoute\n    }\n  }\n}\n\ninterface NotFoundParentBoundaryRouteRouteChildren {\n  NotFoundParentBoundaryViaBeforeLoadRoute: typeof NotFoundParentBoundaryViaBeforeLoadRoute\n}\n\nconst NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren =\n  {\n    NotFoundParentBoundaryViaBeforeLoadRoute:\n      NotFoundParentBoundaryViaBeforeLoadRoute,\n  }\n\nconst NotFoundParentBoundaryRouteRouteWithChildren =\n  NotFoundParentBoundaryRouteRoute._addFileChildren(\n    NotFoundParentBoundaryRouteRouteChildren,\n  )\n\ninterface NotFoundRouteRouteChildren {\n  NotFoundParentBoundaryRouteRoute: typeof NotFoundParentBoundaryRouteRouteWithChildren\n  NotFoundViaBeforeLoadRoute: typeof NotFoundViaBeforeLoadRoute\n  NotFoundViaBeforeLoadTargetRootRoute: typeof NotFoundViaBeforeLoadTargetRootRoute\n  NotFoundViaLoaderRoute: typeof NotFoundViaLoaderRoute\n  NotFoundIndexRoute: typeof NotFoundIndexRoute\n}\n\nconst NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = {\n  NotFoundParentBoundaryRouteRoute:\n    NotFoundParentBoundaryRouteRouteWithChildren,\n  NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute,\n  NotFoundViaBeforeLoadTargetRootRoute: NotFoundViaBeforeLoadTargetRootRoute,\n  NotFoundViaLoaderRoute: NotFoundViaLoaderRoute,\n  NotFoundIndexRoute: NotFoundIndexRoute,\n}\n\nconst NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(\n  NotFoundRouteRouteChildren,\n)\n\ninterface SearchParamsRouteRouteChildren {\n  SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute\n  SearchParamsLoaderThrowsRedirectRoute: typeof SearchParamsLoaderThrowsRedirectRoute\n  SearchParamsIndexRoute: typeof SearchParamsIndexRoute\n}\n\nconst SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {\n  SearchParamsDefaultRoute: SearchParamsDefaultRoute,\n  SearchParamsLoaderThrowsRedirectRoute: SearchParamsLoaderThrowsRedirectRoute,\n  SearchParamsIndexRoute: SearchParamsIndexRoute,\n}\n\nconst SearchParamsRouteRouteWithChildren =\n  SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)\n\ninterface SpecialCharsMalformedRouteRouteChildren {\n  SpecialCharsMalformedParamRoute: typeof SpecialCharsMalformedParamRoute\n  SpecialCharsMalformedSearchRoute: typeof SpecialCharsMalformedSearchRoute\n}\n\nconst SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren =\n  {\n    SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,\n    SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,\n  }\n\nconst SpecialCharsMalformedRouteRouteWithChildren =\n  SpecialCharsMalformedRouteRoute._addFileChildren(\n    SpecialCharsMalformedRouteRouteChildren,\n  )\n\ninterface SpecialCharsRouteRouteChildren {\n  SpecialCharsMalformedRouteRoute: typeof SpecialCharsMalformedRouteRouteWithChildren\n  SpecialCharsParamRoute: typeof SpecialCharsParamRoute\n  SpecialCharsHashRoute: typeof SpecialCharsHashRoute\n  SpecialCharsSearchRoute: typeof SpecialCharsSearchRoute\n  SpecialCharsChar45824Char54620Char48124Char44397Route: typeof SpecialCharsChar45824Char54620Char48124Char44397Route\n}\n\nconst SpecialCharsRouteRouteChildren: SpecialCharsRouteRouteChildren = {\n  SpecialCharsMalformedRouteRoute: SpecialCharsMalformedRouteRouteWithChildren,\n  SpecialCharsParamRoute: SpecialCharsParamRoute,\n  SpecialCharsHashRoute: SpecialCharsHashRoute,\n  SpecialCharsSearchRoute: SpecialCharsSearchRoute,\n  SpecialCharsChar45824Char54620Char48124Char44397Route:\n    SpecialCharsChar45824Char54620Char48124Char44397Route,\n}\n\nconst SpecialCharsRouteRouteWithChildren =\n  SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface RawStreamRouteChildren {\n  RawStreamClientCallRoute: typeof RawStreamClientCallRoute\n  RawStreamSsrBinaryHintRoute: typeof RawStreamSsrBinaryHintRoute\n  RawStreamSsrMixedRoute: typeof RawStreamSsrMixedRoute\n  RawStreamSsrMultipleRoute: typeof RawStreamSsrMultipleRoute\n  RawStreamSsrSingleRoute: typeof RawStreamSsrSingleRoute\n  RawStreamSsrTextHintRoute: typeof RawStreamSsrTextHintRoute\n  RawStreamIndexRoute: typeof RawStreamIndexRoute\n}\n\nconst RawStreamRouteChildren: RawStreamRouteChildren = {\n  RawStreamClientCallRoute: RawStreamClientCallRoute,\n  RawStreamSsrBinaryHintRoute: RawStreamSsrBinaryHintRoute,\n  RawStreamSsrMixedRoute: RawStreamSsrMixedRoute,\n  RawStreamSsrMultipleRoute: RawStreamSsrMultipleRoute,\n  RawStreamSsrSingleRoute: RawStreamSsrSingleRoute,\n  RawStreamSsrTextHintRoute: RawStreamSsrTextHintRoute,\n  RawStreamIndexRoute: RawStreamIndexRoute,\n}\n\nconst RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(\n  RawStreamRouteChildren,\n)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\ninterface RedirectTargetRouteChildren {\n  RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute\n  RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute\n  RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute\n  RedirectTargetServerFnViaBeforeLoadRoute: typeof RedirectTargetServerFnViaBeforeLoadRoute\n  RedirectTargetServerFnViaLoaderRoute: typeof RedirectTargetServerFnViaLoaderRoute\n  RedirectTargetServerFnViaUseServerFnRoute: typeof RedirectTargetServerFnViaUseServerFnRoute\n  RedirectTargetServerFnIndexRoute: typeof RedirectTargetServerFnIndexRoute\n}\n\nconst RedirectTargetRouteChildren: RedirectTargetRouteChildren = {\n  RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,\n  RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,\n  RedirectTargetIndexRoute: RedirectTargetIndexRoute,\n  RedirectTargetServerFnViaBeforeLoadRoute:\n    RedirectTargetServerFnViaBeforeLoadRoute,\n  RedirectTargetServerFnViaLoaderRoute: RedirectTargetServerFnViaLoaderRoute,\n  RedirectTargetServerFnViaUseServerFnRoute:\n    RedirectTargetServerFnViaUseServerFnRoute,\n  RedirectTargetServerFnIndexRoute: RedirectTargetServerFnIndexRoute,\n}\n\nconst RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(\n  RedirectTargetRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  NotFoundRouteRoute: NotFoundRouteRouteWithChildren,\n  SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,\n  SpecialCharsRouteRoute: SpecialCharsRouteRouteWithChildren,\n  LayoutRoute: LayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  InlineScriptsRoute: InlineScriptsRoute,\n  LinksRoute: LinksRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RawStreamRoute: RawStreamRouteWithChildren,\n  ScriptsRoute: ScriptsRoute,\n  StreamRoute: StreamRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  MultiCookieRedirectTargetRoute: MultiCookieRedirectTargetRoute,\n  RedirectTargetRoute: RedirectTargetRouteWithChildren,\n  MultiCookieRedirectIndexRoute: MultiCookieRedirectIndexRoute,\n  RedirectIndexRoute: RedirectIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary as any,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\n\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/vue-router-devtools'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack Vue Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack Vue framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n    styles: [\n      {\n        media: 'all and (min-width: 500px)',\n        children: `\n        .inline-div {\n          color: white;\n          background-color: gray;\n          max-width: 250px;\n        }`,\n      },\n    ],\n  }),\n  errorComponent: (props) => <p>{props.error.stack}</p>,\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/layout-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/scripts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Scripts\n          </Link>{' '}\n          <Link\n            to=\"/inline-scripts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Inline Scripts\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            to=\"/redirect\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            redirect\n          </Link>{' '}\n          <Link\n            to=\"/raw-stream\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Raw Stream\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <Outlet />\n        <div class=\"inline-div\">This is an inline styled div</div>\n        <TanStackRouterDevtoolsInProd />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport type { User } from '~/utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(`${queryURL}/users/${params.userId}`)\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n          const user = (await res.json()) as User\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createMiddleware } from '@tanstack/vue-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: /users')\n    const result = await next()\n    result.response.headers.set('x-users', 'true')\n    console.info('Out: /users')\n    return result\n  },\n)\n\nconst testParentMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: testParentMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test-parent', 'true')\n    console.info('Out: testParentMiddleware')\n    return result\n  },\n)\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next, request }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware, testParentMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await fetch(`${queryURL}/users`)\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n        const data = (await res.json()) as Array<User>\n        const list = data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { Suspense, ref, defineComponent } from 'vue'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(({ data }) => {\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(async ({ data }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst Deferred = defineComponent({\n  setup() {\n    const count = ref(0)\n    const loaderData = Route.useLoaderData()\n\n    return () => (\n      <div class=\"p-2\">\n        <div data-testid=\"regular-person\">\n          {loaderData.value.person.name} -{' '}\n          {loaderData.value.person.randomNumber}\n        </div>\n        <Suspense>\n          {{\n            default: () => (\n              <Await\n                promise={loaderData.value.deferredPerson}\n                children={(data: { name: string; randomNumber: number }) => (\n                  <div data-testid=\"deferred-person\">\n                    {data.name} - {data.randomNumber}\n                  </div>\n                )}\n              />\n            ),\n            fallback: () => <div>Loading person...</div>,\n          }}\n        </Suspense>\n        <Suspense>\n          {{\n            default: () => (\n              <Await\n                promise={loaderData.value.deferredStuff}\n                children={(data: string) => (\n                  <h3 data-testid=\"deferred-stuff\">{data}</h3>\n                )}\n              />\n            ),\n            fallback: () => <div>Loading stuff...</div>,\n          }}\n        </Suspense>\n        <div data-testid=\"count\">Count: {count.value}</div>\n        <div>\n          <button data-testid=\"increment\" onClick={() => count.value++}>\n            Increment\n          </button>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: { name: 'Tanner Linsley' } }),\n      person: await personServerFn({ data: { name: 'John Doe' } }),\n    }\n  },\n  component: Deferred,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { CustomMessage } from '~/components/CustomMessage'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <CustomMessage message=\"Hello from a custom component!\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/inline-scripts.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/inline-scripts')({\n  head: () => ({\n    scripts: [\n      {\n        children: `window.INLINE_SCRIPT_1 = true`,\n      },\n      {\n        children: `window.INLINE_SCRIPT_2 = \"test\"`,\n      },\n    ],\n  }),\n  component: InlineScriptsComponent,\n})\n\nfunction InlineScriptsComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3 data-testid=\"inline-scripts-test-heading\">Inline Scripts Test</h3>\n      <p>Check console for inline script logs.</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/links.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/links')({\n  component: LinksComponent,\n})\n\nfunction LinksComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Links</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/multi-cookie-redirect/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { setCookie } from '@tanstack/vue-start/server'\n\nconst setMultipleCookiesAndRedirect = createServerFn().handler(() => {\n  // Set multiple cookies before redirecting\n  // This tests that multiple Set-Cookie headers are preserved during redirect\n  setCookie('session', 'session-value', { path: '/' })\n  setCookie('csrf', 'csrf-token-value', { path: '/' })\n  setCookie('theme', 'dark', { path: '/' })\n\n  throw redirect({ to: '/multi-cookie-redirect/target' })\n})\n\nexport const Route = createFileRoute('/multi-cookie-redirect/')({\n  loader: () => setMultipleCookiesAndRedirect(),\n  component: () => <div></div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/multi-cookie-redirect/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport Cookies from 'js-cookie'\nimport { defineComponent, onMounted, ref } from 'vue'\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const cookies = ref<Record<string, string>>({})\n\n    onMounted(() => {\n      cookies.value = {\n        session: Cookies.get('session') || '',\n        csrf: Cookies.get('csrf') || '',\n        theme: Cookies.get('theme') || '',\n      }\n    })\n\n    return () => (\n      <div>\n        <h1 data-testid=\"multi-cookie-redirect-target\">\n          Multi Cookie Redirect Target\n        </h1>\n        <div>\n          <p>\n            Session cookie:{' '}\n            <span data-testid=\"cookie-session\">{cookies.value.session}</span>\n          </p>\n          <p>\n            CSRF cookie:{' '}\n            <span data-testid=\"cookie-csrf\">{cookies.value.csrf}</span>\n          </p>\n          <p>\n            Theme cookie:{' '}\n            <span data-testid=\"cookie-theme\">{cookies.value.theme}</span>\n          </p>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/multi-cookie-redirect/target')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/not-found/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/not-found/')({\n  component: () => {\n    const preload = Route.useSearch({ select: (s) => s.preload })\n    return (\n      <div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            preload={preload.value}\n            data-testid=\"via-beforeLoad\"\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            preload={preload.value}\n            data-testid=\"via-loader\"\n          >\n            via-loader\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/not-found/parent-boundary/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/not-found/parent-boundary')({\n  loader: () => ({\n    parentLoaderData: 'ready',\n  }),\n  component: RouteComponent,\n  notFoundComponent: ParentBoundaryNotFoundComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <Outlet />\n    </div>\n  )\n}\n\nfunction ParentBoundaryNotFoundComponent() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div data-testid=\"parent-boundary-notFound-component\">\n      <div data-testid=\"parent-loader-data\">\n        {loaderData.value.parentLoaderData}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/not-found/parent-boundary/via-beforeLoad.tsx",
    "content": "import { createFileRoute, notFound } from '@tanstack/vue-router'\nimport { Route as ParentBoundaryRoute } from './route'\n\nexport const Route = createFileRoute(\n  '/not-found/parent-boundary/via-beforeLoad',\n)({\n  beforeLoad: () => {\n    throw notFound({ routeId: ParentBoundaryRoute.id })\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"parent-boundary-child-route-component\">\n      Hello \"/not-found/parent-boundary/via-beforeLoad\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/not-found/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/not-found')({\n  validateSearch: z.object({\n    preload: z.literal(false).optional(),\n  }),\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/not-found/via-beforeLoad-target-root.tsx",
    "content": "import { createFileRoute, notFound, rootRouteId } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/not-found/via-beforeLoad-target-root')({\n  beforeLoad: () => {\n    throw notFound({ routeId: rootRouteId })\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-beforeLoad-target-root-route-component\">\n      Hello \"/not-found/via-beforeLoad-target-root\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/not-found/via-beforeLoad.tsx",
    "content": "import { notFound, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/not-found/via-beforeLoad')({\n  beforeLoad: () => {\n    throw notFound()\n  },\n  component: RouteComponent,\n  notFoundComponent: () => {\n    return (\n      <div data-testid=\"via-beforeLoad-notFound-component\">\n        Not Found \"/not-found/via-beforeLoad\"!\n      </div>\n    )\n  },\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-beforeLoad-route-component\">\n      Hello \"/not-found/via-beforeLoad\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/not-found/via-loader.tsx",
    "content": "import { notFound, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/not-found/via-loader')({\n  loader: () => {\n    throw notFound()\n  },\n  component: RouteComponent,\n  notFoundComponent: () => {\n    return (\n      <div data-testid=\"via-loader-notFound-component\">\n        Not Found \"/not-found/via-loader\"!\n      </div>\n    )\n  },\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"via-loader-route-component\" data-server={typeof window}>\n      Hello \"/not-found/via-loader\"!\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nimport { fetchPost } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostErrorComponent'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.value.id,\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nimport { fetchPosts } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {posts.value.map((post) => (\n          <li class=\"whitespace-nowrap\" key={post.id}>\n            <Link\n              to=\"/posts/$postId\"\n              params={{\n                postId: post.id,\n              }}\n              class=\"block py-1 text-blue-800 hover:text-blue-600\"\n              activeProps={{ class: 'text-black font-bold' }}\n            >\n              <div>{post.title.substring(0, 20)}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\nimport { PostErrorComponent } from '~/components/PostErrorComponent'\n\nimport { fetchPost } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/raw-stream/client-call.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { defineComponent, ref } from 'vue'\nimport {\n  TEST10_EXPECTED,\n  TEST11_EXPECTED,\n  TEST12_STREAM_A_EXPECTED,\n  TEST12_STREAM_B_EXPECTED,\n  TEST13_EXPECTED,\n  TEST14_STREAM_A_EXPECTED,\n  TEST14_STREAM_B_EXPECTED,\n  TEST14_STREAM_C_EXPECTED,\n  TEST7_EXPECTED,\n  TEST8_EXPECTED,\n  TEST9_EXPECTED,\n  binaryHintBinaryFn,\n  binaryHintTextFn,\n  burstPauseBurstFn,\n  collectBytes,\n  compareBytes,\n  consumeBinaryStream,\n  createStreamConsumer,\n  emptyStreamFn,\n  errorStreamFn,\n  interleavedStreamsFn,\n  jsonEndsFirstFn,\n  largeBinaryFn,\n  mixedStreamingFn,\n  multipleRawStreamsFn,\n  rawEndsFirstFn,\n  singleRawStreamFn,\n  textHintMixedFn,\n  textHintPureBinaryFn,\n  textHintPureTextFn,\n  threeStreamsFn,\n} from '../../raw-stream-fns'\n\nconst ClientCallTests = defineComponent({\n  setup() {\n    const results = ref<Record<string, any>>({})\n    const loading = ref<Record<string, boolean>>({})\n\n    const consumeStream = createStreamConsumer()\n\n    const runTest = async (\n      testName: string,\n      fn: () => Promise<any>,\n      processor: (result: any) => Promise<any>,\n    ) => {\n      loading.value = { ...loading.value, [testName]: true }\n      try {\n        const result = await fn()\n        const processed = await processor(result)\n        results.value = { ...results.value, [testName]: processed }\n      } catch (error) {\n        results.value = {\n          ...results.value,\n          [testName]: { error: String(error) },\n        }\n      } finally {\n        loading.value = { ...loading.value, [testName]: false }\n      }\n    }\n\n    return () => (\n      <div class=\"space-y-4\">\n        <h2>Client-Side Server Function Calls (RPC)</h2>\n        <p class=\"text-gray-600\">\n          These tests invoke server functions directly from the client, using\n          the binary framing protocol for RawStream data.\n        </p>\n\n        {/* Test 1: Single Raw Stream */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test1-title\">Test 1: Single Raw Stream</h3>\n          <button\n            data-testid=\"test1-btn\"\n            onClick={() =>\n              runTest('test1', singleRawStreamFn, async (result) => ({\n                message: result.message,\n                streamContent: await consumeStream(result.data),\n              }))\n            }\n            disabled={loading.value.test1}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test1 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test1-result\">\n            {JSON.stringify(results.value.test1)}\n          </pre>\n        </div>\n\n        {/* Test 2: Multiple Raw Streams */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test2-title\">Test 2: Multiple Raw Streams</h3>\n          <button\n            data-testid=\"test2-btn\"\n            onClick={() =>\n              runTest('test2', multipleRawStreamsFn, async (result) => ({\n                message: result.message,\n                firstContent: await consumeStream(result.first),\n                secondContent: await consumeStream(result.second),\n              }))\n            }\n            disabled={loading.value.test2}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test2 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test2-result\">\n            {JSON.stringify(results.value.test2)}\n          </pre>\n        </div>\n\n        {/* Test 3: JSON Ends First */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test3-title\">Test 3: JSON Ends Before Raw Stream</h3>\n          <button\n            data-testid=\"test3-btn\"\n            onClick={() =>\n              runTest('test3', jsonEndsFirstFn, async (result) => ({\n                message: result.message,\n                hasTimestamp: typeof result.timestamp === 'number',\n                slowContent: await consumeStream(result.slowData),\n              }))\n            }\n            disabled={loading.value.test3}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test3 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test3-result\">\n            {JSON.stringify(results.value.test3)}\n          </pre>\n        </div>\n\n        {/* Test 4: Raw Ends First */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test4-title\">Test 4: Raw Stream Ends Before JSON</h3>\n          <button\n            data-testid=\"test4-btn\"\n            onClick={() =>\n              runTest('test4', rawEndsFirstFn, async (result) => ({\n                message: result.message,\n                deferredData: await result.deferredData,\n                fastContent: await consumeStream(result.fastData),\n              }))\n            }\n            disabled={loading.value.test4}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test4 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test4-result\">\n            {JSON.stringify(results.value.test4)}\n          </pre>\n        </div>\n\n        {/* Test 5: Large Binary */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test5-title\">Test 5: Large Binary Data</h3>\n          <button\n            data-testid=\"test5-btn\"\n            onClick={() =>\n              runTest('test5', largeBinaryFn, async (result) => {\n                const totalBytes = await consumeBinaryStream(result.binary)\n                return {\n                  message: result.message,\n                  expectedSize: result.size,\n                  actualSize: totalBytes,\n                  sizeMatch: totalBytes === result.size,\n                }\n              })\n            }\n            disabled={loading.value.test5}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test5 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test5-result\">\n            {JSON.stringify(results.value.test5)}\n          </pre>\n        </div>\n\n        {/* Test 6: Mixed Streaming */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test6-title\">Test 6: Mixed Streaming</h3>\n          <button\n            data-testid=\"test6-btn\"\n            onClick={() =>\n              runTest('test6', mixedStreamingFn, async (result) => ({\n                immediate: result.immediate,\n                deferred: await result.deferred,\n                rawContent: await consumeStream(result.raw),\n              }))\n            }\n            disabled={loading.value.test6}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test6 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test6-result\">\n            {JSON.stringify(results.value.test6)}\n          </pre>\n        </div>\n\n        {/* Hint Tests Section */}\n        <h2 class=\"mt-8\">Hint Parameter Tests (RPC)</h2>\n        <p class=\"text-gray-600\">\n          These tests verify that hint parameter works correctly for RPC calls.\n          Note: RPC always uses binary framing regardless of hint.\n        </p>\n\n        {/* Test 7: Text Hint with Pure Text */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test7-title\">Test 7: Text Hint - Pure Text</h3>\n          <button\n            data-testid=\"test7-btn\"\n            onClick={() =>\n              runTest('test7', textHintPureTextFn, async (result) => {\n                const bytes = await collectBytes(result.data)\n                const comparison = compareBytes(bytes, TEST7_EXPECTED)\n                const decoder = new TextDecoder()\n                return {\n                  message: result.message,\n                  asText: decoder.decode(bytes),\n                  ...comparison,\n                }\n              })\n            }\n            disabled={loading.value.test7}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test7 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test7-result\">\n            {JSON.stringify(results.value.test7)}\n          </pre>\n        </div>\n\n        {/* Test 8: Text Hint with Pure Binary */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test8-title\">Test 8: Text Hint - Pure Binary</h3>\n          <button\n            data-testid=\"test8-btn\"\n            onClick={() =>\n              runTest('test8', textHintPureBinaryFn, async (result) => {\n                const bytes = await collectBytes(result.data)\n                const comparison = compareBytes(bytes, TEST8_EXPECTED)\n                return {\n                  message: result.message,\n                  ...comparison,\n                }\n              })\n            }\n            disabled={loading.value.test8}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test8 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test8-result\">\n            {JSON.stringify(results.value.test8)}\n          </pre>\n        </div>\n\n        {/* Test 9: Text Hint with Mixed Content */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test9-title\">Test 9: Text Hint - Mixed Content</h3>\n          <button\n            data-testid=\"test9-btn\"\n            onClick={() =>\n              runTest('test9', textHintMixedFn, async (result) => {\n                const bytes = await collectBytes(result.data)\n                const comparison = compareBytes(bytes, TEST9_EXPECTED)\n                return {\n                  message: result.message,\n                  ...comparison,\n                }\n              })\n            }\n            disabled={loading.value.test9}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test9 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test9-result\">\n            {JSON.stringify(results.value.test9)}\n          </pre>\n        </div>\n\n        {/* Test 10: Binary Hint with Text Data */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test10-title\">Test 10: Binary Hint - Text Data</h3>\n          <button\n            data-testid=\"test10-btn\"\n            onClick={() =>\n              runTest('test10', binaryHintTextFn, async (result) => {\n                const bytes = await collectBytes(result.data)\n                const comparison = compareBytes(bytes, TEST10_EXPECTED)\n                const decoder = new TextDecoder()\n                return {\n                  message: result.message,\n                  asText: decoder.decode(bytes),\n                  ...comparison,\n                }\n              })\n            }\n            disabled={loading.value.test10}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test10 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test10-result\">\n            {JSON.stringify(results.value.test10)}\n          </pre>\n        </div>\n\n        {/* Test 11: Binary Hint with Binary Data */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test11-title\">Test 11: Binary Hint - Binary Data</h3>\n          <button\n            data-testid=\"test11-btn\"\n            onClick={() =>\n              runTest('test11', binaryHintBinaryFn, async (result) => {\n                const bytes = await collectBytes(result.data)\n                const comparison = compareBytes(bytes, TEST11_EXPECTED)\n                return {\n                  message: result.message,\n                  ...comparison,\n                }\n              })\n            }\n            disabled={loading.value.test11}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test11 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test11-result\">\n            {JSON.stringify(results.value.test11)}\n          </pre>\n        </div>\n\n        {/* Multiplexing Tests Section */}\n        <h2 class=\"mt-8\">Multiplexing Tests (RPC)</h2>\n        <p class=\"text-gray-600\">\n          These tests verify correct interleaving of multiple concurrent\n          streams.\n        </p>\n\n        {/* Test 12: Interleaved Streams */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test12-title\">Test 12: Interleaved Streams</h3>\n          <button\n            data-testid=\"test12-btn\"\n            onClick={() =>\n              runTest('test12', interleavedStreamsFn, async (result) => {\n                const [bytesA, bytesB] = await Promise.all([\n                  collectBytes(result.streamA),\n                  collectBytes(result.streamB),\n                ])\n                const comparisonA = compareBytes(\n                  bytesA,\n                  TEST12_STREAM_A_EXPECTED,\n                )\n                const comparisonB = compareBytes(\n                  bytesB,\n                  TEST12_STREAM_B_EXPECTED,\n                )\n                return {\n                  message: result.message,\n                  streamA: comparisonA,\n                  streamB: comparisonB,\n                }\n              })\n            }\n            disabled={loading.value.test12}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test12 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test12-result\">\n            {JSON.stringify(results.value.test12)}\n          </pre>\n        </div>\n\n        {/* Test 13: Burst-Pause-Burst */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test13-title\">Test 13: Burst-Pause-Burst</h3>\n          <button\n            data-testid=\"test13-btn\"\n            onClick={() =>\n              runTest('test13', burstPauseBurstFn, async (result) => {\n                const bytes = await collectBytes(result.data)\n                const comparison = compareBytes(bytes, TEST13_EXPECTED)\n                return {\n                  message: result.message,\n                  ...comparison,\n                }\n              })\n            }\n            disabled={loading.value.test13}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test13 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test13-result\">\n            {JSON.stringify(results.value.test13)}\n          </pre>\n        </div>\n\n        {/* Test 14: Three Concurrent Streams */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test14-title\">Test 14: Three Concurrent Streams</h3>\n          <button\n            data-testid=\"test14-btn\"\n            onClick={() =>\n              runTest('test14', threeStreamsFn, async (result) => {\n                const [bytesA, bytesB, bytesC] = await Promise.all([\n                  collectBytes(result.fast),\n                  collectBytes(result.slow),\n                  collectBytes(result.burst),\n                ])\n                const comparisonA = compareBytes(\n                  bytesA,\n                  TEST14_STREAM_A_EXPECTED,\n                )\n                const comparisonB = compareBytes(\n                  bytesB,\n                  TEST14_STREAM_B_EXPECTED,\n                )\n                const comparisonC = compareBytes(\n                  bytesC,\n                  TEST14_STREAM_C_EXPECTED,\n                )\n                return {\n                  message: result.message,\n                  fast: comparisonA,\n                  slow: comparisonB,\n                  burst: comparisonC,\n                }\n              })\n            }\n            disabled={loading.value.test14}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test14 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test14-result\">\n            {JSON.stringify(results.value.test14)}\n          </pre>\n        </div>\n\n        {/* Edge Case Tests Section */}\n        <h2 class=\"mt-8\">Edge Case Tests (RPC)</h2>\n        <p class=\"text-gray-600\">\n          These tests verify edge cases like empty streams and error handling.\n        </p>\n\n        {/* Test 15: Empty Stream */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test15-title\">Test 15: Empty Stream</h3>\n          <button\n            data-testid=\"test15-btn\"\n            onClick={() =>\n              runTest('test15', emptyStreamFn, async (result) => {\n                const bytes = await collectBytes(result.data)\n                return {\n                  message: result.message,\n                  byteCount: bytes.length,\n                  isEmpty: bytes.length === 0,\n                }\n              })\n            }\n            disabled={loading.value.test15}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test15 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test15-result\">\n            {JSON.stringify(results.value.test15)}\n          </pre>\n        </div>\n\n        {/* Test 16: Stream Error */}\n        <div class=\"border p-4 rounded\">\n          <h3 data-testid=\"test16-title\">Test 16: Stream Error</h3>\n          <button\n            data-testid=\"test16-btn\"\n            onClick={() =>\n              runTest('test16', errorStreamFn, async (result) => {\n                try {\n                  // Try to consume the stream - should error\n                  const content = await consumeStream(result.data)\n                  return {\n                    message: result.message,\n                    streamContent: content,\n                    errorCaught: false,\n                  }\n                } catch (err) {\n                  return {\n                    message: result.message,\n                    errorCaught: true,\n                    errorMessage: String(err),\n                  }\n                }\n              })\n            }\n            disabled={loading.value.test16}\n            class=\"bg-blue-500 text-white px-4 py-2 rounded disabled:opacity-50\"\n          >\n            {loading.value.test16 ? 'Loading...' : 'Run Test'}\n          </button>\n          <pre data-testid=\"test16-result\">\n            {JSON.stringify(results.value.test16)}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/raw-stream/client-call')({\n  component: ClientCallTests,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/raw-stream/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/raw-stream/')({\n  component: RawStreamIndex,\n})\n\nfunction RawStreamIndex() {\n  return (\n    <div>\n      <p>Select a test category above to begin testing.</p>\n      <ul class=\"list-disc pl-6 mt-4 space-y-2\">\n        <li>\n          <Link to=\"/raw-stream/client-call\" class=\"text-blue-500 underline\">\n            Client Calls\n          </Link>\n          <span> - Test RawStream via direct server function calls (RPC)</span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-single\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Single\n          </Link>\n          <span> - Test single RawStream from route loader (SSR)</span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-multiple\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Multiple\n          </Link>\n          <span> - Test multiple RawStreams from route loader (SSR)</span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-mixed\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Mixed\n          </Link>\n          <span>\n            {' '}\n            - Test RawStream mixed with deferred data from loader (SSR)\n          </span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-text-hint\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Text Hint\n          </Link>\n          <span> - Test RawStream with hint: 'text' from loader (SSR)</span>\n        </li>\n        <li>\n          <Link\n            to=\"/raw-stream/ssr-binary-hint\"\n            class=\"text-blue-500 underline\"\n            reloadDocument={true}\n          >\n            SSR Binary Hint\n          </Link>\n          <span> - Test RawStream with hint: 'binary' from loader (SSR)</span>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/raw-stream/ssr-binary-hint.tsx",
    "content": "import { createFileRoute, useRouter } from '@tanstack/vue-router'\nimport { RawStream } from '@tanstack/vue-start'\nimport { defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport {\n  collectBytes,\n  compareBytes,\n  concatBytes,\n  createDelayedStream,\n  encode,\n} from '../../raw-stream-fns'\n\n// Expected data - defined at module level for client-side verification\nconst TEXT_CHUNKS = [encode('Binary '), encode('hint '), encode('with text')]\nconst TEXT_EXPECTED = concatBytes(TEXT_CHUNKS)\n\nconst BINARY_CHUNKS = [\n  new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n  new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]),\n]\nconst BINARY_EXPECTED = concatBytes(BINARY_CHUNKS)\n\ntype TextMatch = {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n  asText: string\n}\n\ntype BinaryMatch = {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n}\n\nconst SSRBinaryHintTest = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n    const router = useRouter()\n    const textMatch = ref<TextMatch | null>(null)\n    const binaryMatch = ref<BinaryMatch | null>(null)\n    const isLoading = ref(true)\n    const error = ref<string | null>(null)\n\n    let consumeRunId = 0\n    const consumeHintStreams = (\n      textData: ReadableStream<Uint8Array> | RawStream | undefined,\n      binaryData: ReadableStream<Uint8Array> | RawStream | undefined,\n    ) => {\n      if (!textData || !binaryData) {\n        return Promise.resolve()\n      }\n      const currentRun = ++consumeRunId\n      isLoading.value = true\n      error.value = null\n      return Promise.all([collectBytes(textData), collectBytes(binaryData)])\n        .then(([textBytes, binaryBytes]) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          const textComp = compareBytes(textBytes, TEXT_EXPECTED)\n          const decoder = new TextDecoder()\n          textMatch.value = {\n            ...textComp,\n            actualLength: textBytes.length,\n            expectedLength: TEXT_EXPECTED.length,\n            asText: decoder.decode(textBytes),\n          }\n          const binaryComp = compareBytes(binaryBytes, BINARY_EXPECTED)\n          binaryMatch.value = {\n            ...binaryComp,\n            actualLength: binaryBytes.length,\n            expectedLength: BINARY_EXPECTED.length,\n          }\n          isLoading.value = false\n        })\n        .catch((err) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          error.value = String(err)\n          isLoading.value = false\n        })\n    }\n\n    let stopWatcher: (() => void) | undefined\n    let lastStreams:\n      | [\n          ReadableStream<Uint8Array> | RawStream,\n          ReadableStream<Uint8Array> | RawStream,\n        ]\n      | undefined\n    let didInvalidate = false\n\n    onMounted(() => {\n      stopWatcher = watch(\n        () => [loaderData.value.textData, loaderData.value.binaryData],\n        ([textData, binaryData]) => {\n          if (!textData || !binaryData) {\n            return\n          }\n          if (\n            lastStreams &&\n            lastStreams[0] === textData &&\n            lastStreams[1] === binaryData\n          ) {\n            return\n          }\n          lastStreams = [textData, binaryData]\n          void consumeHintStreams(textData, binaryData)\n        },\n        { immediate: true },\n      )\n\n      if (__TSR_PRERENDER__ && !didInvalidate) {\n        didInvalidate = true\n        void router.invalidate({\n          filter: (match) => match.routeId === Route.id,\n        })\n      }\n    })\n\n    onBeforeUnmount(() => {\n      stopWatcher?.()\n    })\n\n    return () => (\n      <div class=\"space-y-4\">\n        <h2>SSR Binary Hint Test</h2>\n        <p class=\"text-gray-600\">\n          This route tests RawStream with hint: 'binary' from loader. Binary\n          hint always uses base64 encoding (default behavior).\n        </p>\n\n        <div class=\"border p-4 rounded\">\n          <div data-testid=\"ssr-binary-hint-message\">\n            Message: {loaderData.value.message}\n          </div>\n          <div data-testid=\"ssr-binary-hint-text\">\n            Text Data:\n            {error.value\n              ? `Error: ${error.value}`\n              : isLoading.value\n                ? 'Loading...'\n                : textMatch.value?.asText}\n          </div>\n          <div data-testid=\"ssr-binary-hint-text-match\">\n            Text Bytes Match:\n            {isLoading.value\n              ? 'Loading...'\n              : textMatch.value?.match\n                ? 'true'\n                : 'false'}\n          </div>\n          <div data-testid=\"ssr-binary-hint-binary-match\">\n            Binary Bytes Match:\n            {isLoading.value\n              ? 'Loading...'\n              : binaryMatch.value?.match\n                ? 'true'\n                : 'false'}\n          </div>\n          <pre data-testid=\"ssr-binary-hint-result\">\n            {JSON.stringify({\n              message: loaderData.value.message,\n              textMatch: textMatch.value,\n              binaryMatch: binaryMatch.value,\n              isLoading: isLoading.value,\n              error: error.value,\n            })}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/raw-stream/ssr-binary-hint')({\n  loader: async () => {\n    // Text data with binary hint - should still use base64 (default behavior)\n    const textStream = createDelayedStream(\n      [encode('Binary '), encode('hint '), encode('with text')],\n      30,\n    )\n\n    // Pure binary stream with binary hint\n    const binaryStream = createDelayedStream(\n      [\n        new Uint8Array([0x00, 0x01, 0x02, 0x03]),\n        new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]),\n      ],\n      30,\n    )\n\n    return {\n      message: 'SSR Binary Hint Test',\n      textData: new RawStream(textStream, { hint: 'binary' }),\n      binaryData: new RawStream(binaryStream, { hint: 'binary' }),\n    }\n  },\n  shouldReload: __TSR_PRERENDER__,\n  component: SSRBinaryHintTest,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/raw-stream/ssr-mixed.tsx",
    "content": "import { Await, createFileRoute, useRouter } from '@tanstack/vue-router'\nimport { RawStream } from '@tanstack/vue-start'\nimport {\n  Suspense,\n  defineComponent,\n  onBeforeUnmount,\n  onMounted,\n  ref,\n  watch,\n} from 'vue'\nimport {\n  createDelayedStream,\n  createStreamConsumer,\n  encode,\n} from '../../raw-stream-fns'\n\nconst SSRMixedTest = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n    const router = useRouter()\n    const streamContent = ref('')\n    const isConsuming = ref(true)\n    const error = ref<string | null>(null)\n\n    let consumeRunId = 0\n    const consumeRawStream = (\n      rawData: ReadableStream<Uint8Array> | RawStream | undefined,\n    ) => {\n      if (!rawData) {\n        return Promise.resolve()\n      }\n      const consumeStream = createStreamConsumer()\n      const currentRun = ++consumeRunId\n      isConsuming.value = true\n      error.value = null\n      return consumeStream(rawData)\n        .then((content) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          streamContent.value = content\n          isConsuming.value = false\n        })\n        .catch((err) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          error.value = String(err)\n          isConsuming.value = false\n        })\n    }\n\n    let stopWatcher: (() => void) | undefined\n    let lastRawData: ReadableStream<Uint8Array> | RawStream | undefined\n    let didInvalidate = false\n\n    onMounted(() => {\n      stopWatcher = watch(\n        () => loaderData.value.rawData,\n        (rawData) => {\n          if (!rawData || rawData === lastRawData) {\n            return\n          }\n          lastRawData = rawData\n          void consumeRawStream(rawData)\n        },\n        { immediate: true },\n      )\n\n      if (__TSR_PRERENDER__ && !didInvalidate) {\n        didInvalidate = true\n        void router.invalidate({\n          filter: (match) => match.routeId === Route.id,\n        })\n      }\n    })\n\n    onBeforeUnmount(() => {\n      stopWatcher?.()\n    })\n\n    return () => (\n      <div class=\"space-y-4\">\n        <h2>SSR Mixed Streaming Test</h2>\n        <p class=\"text-gray-600\">\n          This route returns a mix of immediate data, deferred promises, and\n          RawStream from its loader.\n        </p>\n\n        <div class=\"border p-4 rounded\">\n          <div data-testid=\"ssr-mixed-immediate\">\n            Immediate: {loaderData.value.immediate}\n          </div>\n          <div data-testid=\"ssr-mixed-deferred\">\n            Deferred:\n            <Suspense>\n              {{\n                default: () => (\n                  <Await\n                    promise={loaderData.value.deferred}\n                    children={(value: string) => <span>{value}</span>}\n                  />\n                ),\n                fallback: () => <span>Loading deferred...</span>,\n              }}\n            </Suspense>\n          </div>\n          <div data-testid=\"ssr-mixed-stream\">\n            Stream Content:\n            {error.value\n              ? `Error: ${error.value}`\n              : isConsuming.value\n                ? 'Loading...'\n                : streamContent.value}\n          </div>\n          <pre data-testid=\"ssr-mixed-result\">\n            {JSON.stringify({\n              immediate: loaderData.value.immediate,\n              streamContent: streamContent.value,\n              isConsuming: isConsuming.value,\n              error: error.value,\n            })}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/raw-stream/ssr-mixed')({\n  loader: () => {\n    const rawStream = createDelayedStream(\n      [encode('mixed-ssr-1'), encode('mixed-ssr-2')],\n      50,\n    )\n\n    // Deferred promise that resolves after a delay\n    const deferredData = new Promise<string>((resolve) =>\n      setTimeout(() => resolve('deferred-ssr-value'), 100),\n    )\n\n    return {\n      immediate: 'immediate-ssr-value',\n      deferred: deferredData,\n      rawData: new RawStream(rawStream),\n    }\n  },\n  shouldReload: __TSR_PRERENDER__,\n  component: SSRMixedTest,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/raw-stream/ssr-multiple.tsx",
    "content": "import { createFileRoute, useRouter } from '@tanstack/vue-router'\nimport { RawStream } from '@tanstack/vue-start'\nimport { defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport {\n  createDelayedStream,\n  createStreamConsumer,\n  encode,\n} from '../../raw-stream-fns'\n\nconst SSRMultipleTest = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n    const router = useRouter()\n    const firstContent = ref('')\n    const secondContent = ref('')\n    const isConsuming = ref(true)\n    const error = ref<string | null>(null)\n\n    let consumeRunId = 0\n    const consumeRawStreams = (\n      first: ReadableStream<Uint8Array> | RawStream | undefined,\n      second: ReadableStream<Uint8Array> | RawStream | undefined,\n    ) => {\n      if (!first || !second) {\n        return Promise.resolve()\n      }\n      const consumeStream = createStreamConsumer()\n      const currentRun = ++consumeRunId\n      isConsuming.value = true\n      error.value = null\n      return Promise.all([consumeStream(first), consumeStream(second)])\n        .then(([content1, content2]) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          firstContent.value = content1\n          secondContent.value = content2\n          isConsuming.value = false\n        })\n        .catch((err) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          error.value = String(err)\n          isConsuming.value = false\n        })\n    }\n\n    let stopWatcher: (() => void) | undefined\n    let lastStreams:\n      | [\n          ReadableStream<Uint8Array> | RawStream,\n          ReadableStream<Uint8Array> | RawStream,\n        ]\n      | undefined\n    let didInvalidate = false\n\n    onMounted(() => {\n      stopWatcher = watch(\n        () => [loaderData.value.first, loaderData.value.second],\n        ([first, second]) => {\n          if (!first || !second) {\n            return\n          }\n          if (\n            lastStreams &&\n            lastStreams[0] === first &&\n            lastStreams[1] === second\n          ) {\n            return\n          }\n          lastStreams = [first, second]\n          void consumeRawStreams(first, second)\n        },\n        { immediate: true },\n      )\n\n      if (__TSR_PRERENDER__ && !didInvalidate) {\n        didInvalidate = true\n        void router.invalidate({\n          filter: (match) => match.routeId === Route.id,\n        })\n      }\n    })\n\n    onBeforeUnmount(() => {\n      stopWatcher?.()\n    })\n\n    return () => (\n      <div class=\"space-y-4\">\n        <h2>SSR Multiple RawStreams Test</h2>\n        <p class=\"text-gray-600\">\n          This route returns multiple RawStreams from its loader. Each stream is\n          independently serialized during SSR.\n        </p>\n\n        <div class=\"border p-4 rounded\">\n          <div data-testid=\"ssr-multiple-message\">\n            Message: {loaderData.value.message}\n          </div>\n          <div data-testid=\"ssr-multiple-first\">\n            First Stream:\n            {error.value\n              ? `Error: ${error.value}`\n              : isConsuming.value\n                ? 'Loading...'\n                : firstContent.value}\n          </div>\n          <div data-testid=\"ssr-multiple-second\">\n            Second Stream:\n            {error.value\n              ? `Error: ${error.value}`\n              : isConsuming.value\n                ? 'Loading...'\n                : secondContent.value}\n          </div>\n          <pre data-testid=\"ssr-multiple-result\">\n            {JSON.stringify({\n              message: loaderData.value.message,\n              firstContent: firstContent.value,\n              secondContent: secondContent.value,\n              isConsuming: isConsuming.value,\n              error: error.value,\n            })}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/raw-stream/ssr-multiple')({\n  loader: async () => {\n    const stream1 = createDelayedStream(\n      [encode('multi-1a'), encode('multi-1b')],\n      30,\n    )\n    const stream2 = createDelayedStream(\n      [encode('multi-2a'), encode('multi-2b')],\n      50,\n    )\n    return {\n      message: 'SSR Multiple Streams Test',\n      first: new RawStream(stream1),\n      second: new RawStream(stream2),\n    }\n  },\n  shouldReload: __TSR_PRERENDER__,\n  component: SSRMultipleTest,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/raw-stream/ssr-single.tsx",
    "content": "import { createFileRoute, useRouter } from '@tanstack/vue-router'\nimport { RawStream } from '@tanstack/vue-start'\nimport { defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport {\n  createDelayedStream,\n  createStreamConsumer,\n  encode,\n} from '../../raw-stream-fns'\n\nconst SSRSingleTest = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n    const router = useRouter()\n    const streamContent = ref('')\n    const isConsuming = ref(true)\n    const error = ref<string | null>(null)\n\n    let consumeRunId = 0\n    const consumeRawStream = (\n      rawData: ReadableStream<Uint8Array> | RawStream | undefined,\n    ) => {\n      if (!rawData) {\n        return Promise.resolve()\n      }\n      const consumeStream = createStreamConsumer()\n      const currentRun = ++consumeRunId\n      isConsuming.value = true\n      error.value = null\n      return consumeStream(rawData)\n        .then((content) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          streamContent.value = content\n          isConsuming.value = false\n        })\n        .catch((err) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          error.value = String(err)\n          isConsuming.value = false\n        })\n    }\n\n    let stopWatcher: (() => void) | undefined\n    let lastRawData: ReadableStream<Uint8Array> | RawStream | undefined\n    let didInvalidate = false\n\n    onMounted(() => {\n      stopWatcher = watch(\n        () => loaderData.value.rawData,\n        (rawData) => {\n          if (!rawData || rawData === lastRawData) {\n            return\n          }\n          lastRawData = rawData\n          void consumeRawStream(rawData)\n        },\n        { immediate: true },\n      )\n\n      if (__TSR_PRERENDER__ && !didInvalidate) {\n        didInvalidate = true\n        void router.invalidate({\n          filter: (match) => match.routeId === Route.id,\n        })\n      }\n    })\n\n    onBeforeUnmount(() => {\n      stopWatcher?.()\n    })\n\n    return () => (\n      <div class=\"space-y-4\">\n        <h2>SSR Single RawStream Test</h2>\n        <p class=\"text-gray-600\">\n          This route returns a single RawStream from its loader. The stream is\n          serialized during SSR using base64 encoding.\n        </p>\n\n        <div class=\"border p-4 rounded\">\n          <div data-testid=\"ssr-single-message\">\n            Message: {loaderData.value.message}\n          </div>\n          <div data-testid=\"ssr-single-timestamp\">\n            Has Timestamp:{' '}\n            {typeof loaderData.value.timestamp === 'number' ? 'true' : 'false'}\n          </div>\n          <div data-testid=\"ssr-single-stream\">\n            Stream Content:\n            {error.value\n              ? `Error: ${error.value}`\n              : isConsuming.value\n                ? 'Loading...'\n                : streamContent.value}\n          </div>\n          <div data-testid=\"ssr-single-rawdata-type\">\n            RawData Type: {typeof loaderData.value.rawData} | hasStream:\n            {loaderData.value.rawData && 'getReader' in loaderData.value.rawData\n              ? 'true'\n              : 'false'}\n          </div>\n          <pre data-testid=\"ssr-single-result\">\n            {JSON.stringify({\n              message: loaderData.value.message,\n              streamContent: streamContent.value,\n              isConsuming: isConsuming.value,\n              error: error.value,\n            })}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/raw-stream/ssr-single')({\n  loader: async () => {\n    const stream = createDelayedStream(\n      [encode('ssr-chunk1'), encode('ssr-chunk2'), encode('ssr-chunk3')],\n      50,\n    )\n    return {\n      message: 'SSR Single Stream Test',\n      timestamp: Date.now(),\n      rawData: new RawStream(stream),\n    }\n  },\n  shouldReload: __TSR_PRERENDER__,\n  component: SSRSingleTest,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/raw-stream/ssr-text-hint.tsx",
    "content": "import { createFileRoute, useRouter } from '@tanstack/vue-router'\nimport { RawStream } from '@tanstack/vue-start'\nimport { defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport {\n  collectBytes,\n  compareBytes,\n  concatBytes,\n  createDelayedStream,\n  encode,\n} from '../../raw-stream-fns'\n\n// Expected data - defined at module level for client-side verification\nconst PURE_TEXT_CHUNKS = [\n  encode('Hello '),\n  encode('World '),\n  encode('from SSR!'),\n]\nconst PURE_TEXT_EXPECTED = concatBytes(PURE_TEXT_CHUNKS)\n\nconst MIXED_CHUNKS = [\n  encode('Valid text'),\n  new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n  encode(' more text'),\n]\nconst MIXED_EXPECTED = concatBytes(MIXED_CHUNKS)\n\n// Pure binary data (invalid UTF-8) - must use base64 fallback\nconst PURE_BINARY_CHUNKS = [\n  new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n  new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n]\nconst PURE_BINARY_EXPECTED = concatBytes(PURE_BINARY_CHUNKS)\n\ntype TextMatch = {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n  asText: string\n}\n\ntype BinaryMatch = {\n  match: boolean\n  mismatchIndex: number | null\n  actualLength: number\n  expectedLength: number\n}\n\nconst SSRTextHintTest = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n    const router = useRouter()\n    const pureTextMatch = ref<TextMatch | null>(null)\n    const mixedMatch = ref<BinaryMatch | null>(null)\n    const pureBinaryMatch = ref<BinaryMatch | null>(null)\n    const isLoading = ref(true)\n    const error = ref<string | null>(null)\n\n    let consumeRunId = 0\n    const consumeHintStreams = (\n      pureText: ReadableStream<Uint8Array> | RawStream | undefined,\n      mixedContent: ReadableStream<Uint8Array> | RawStream | undefined,\n      pureBinary: ReadableStream<Uint8Array> | RawStream | undefined,\n    ) => {\n      if (!pureText || !mixedContent || !pureBinary) {\n        return Promise.resolve()\n      }\n      const currentRun = ++consumeRunId\n      isLoading.value = true\n      error.value = null\n      return Promise.all([\n        collectBytes(pureText),\n        collectBytes(mixedContent),\n        collectBytes(pureBinary),\n      ])\n        .then(([pureBytes, mixedBytes, pureBinaryBytes]) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          const pureComp = compareBytes(pureBytes, PURE_TEXT_EXPECTED)\n          const decoder = new TextDecoder()\n          pureTextMatch.value = {\n            ...pureComp,\n            actualLength: pureBytes.length,\n            expectedLength: PURE_TEXT_EXPECTED.length,\n            asText: decoder.decode(pureBytes),\n          }\n          const mixedComp = compareBytes(mixedBytes, MIXED_EXPECTED)\n          mixedMatch.value = {\n            ...mixedComp,\n            actualLength: mixedBytes.length,\n            expectedLength: MIXED_EXPECTED.length,\n          }\n          const pureBinaryComp = compareBytes(\n            pureBinaryBytes,\n            PURE_BINARY_EXPECTED,\n          )\n          pureBinaryMatch.value = {\n            ...pureBinaryComp,\n            actualLength: pureBinaryBytes.length,\n            expectedLength: PURE_BINARY_EXPECTED.length,\n          }\n          isLoading.value = false\n        })\n        .catch((err) => {\n          if (currentRun !== consumeRunId) {\n            return\n          }\n          error.value = String(err)\n          isLoading.value = false\n        })\n    }\n\n    let stopWatcher: (() => void) | undefined\n    let lastStreams:\n      | [\n          ReadableStream<Uint8Array> | RawStream,\n          ReadableStream<Uint8Array> | RawStream,\n          ReadableStream<Uint8Array> | RawStream,\n        ]\n      | undefined\n    let didInvalidate = false\n\n    onMounted(() => {\n      stopWatcher = watch(\n        () => [\n          loaderData.value.pureText,\n          loaderData.value.mixedContent,\n          loaderData.value.pureBinary,\n        ],\n        ([pureText, mixedContent, pureBinary]) => {\n          if (!pureText || !mixedContent || !pureBinary) {\n            return\n          }\n          if (\n            lastStreams &&\n            lastStreams[0] === pureText &&\n            lastStreams[1] === mixedContent &&\n            lastStreams[2] === pureBinary\n          ) {\n            return\n          }\n          lastStreams = [pureText, mixedContent, pureBinary]\n          void consumeHintStreams(pureText, mixedContent, pureBinary)\n        },\n        { immediate: true },\n      )\n\n      if (__TSR_PRERENDER__ && !didInvalidate) {\n        didInvalidate = true\n        void router.invalidate({\n          filter: (match) => match.routeId === Route.id,\n        })\n      }\n    })\n\n    onBeforeUnmount(() => {\n      stopWatcher?.()\n    })\n\n    return () => (\n      <div class=\"space-y-4\">\n        <h2>SSR Text Hint Test</h2>\n        <p class=\"text-gray-600\">\n          This route tests RawStream with hint: 'text' from loader. Text hint\n          optimizes for UTF-8 content but falls back to base64 for invalid\n          UTF-8.\n        </p>\n\n        <div class=\"border p-4 rounded\">\n          <div data-testid=\"ssr-text-hint-message\">\n            Message: {loaderData.value.message}\n          </div>\n          <div data-testid=\"ssr-text-hint-pure-text\">\n            Pure Text:\n            {error.value\n              ? `Error: ${error.value}`\n              : isLoading.value\n                ? 'Loading...'\n                : pureTextMatch.value?.asText}\n          </div>\n          <div data-testid=\"ssr-text-hint-pure-match\">\n            Pure Text Bytes Match:\n            {isLoading.value\n              ? 'Loading...'\n              : pureTextMatch.value?.match\n                ? 'true'\n                : 'false'}\n          </div>\n          <div data-testid=\"ssr-text-hint-mixed-match\">\n            Mixed Content Bytes Match:\n            {isLoading.value\n              ? 'Loading...'\n              : mixedMatch.value?.match\n                ? 'true'\n                : 'false'}\n          </div>\n          <div data-testid=\"ssr-text-hint-pure-binary-match\">\n            Pure Binary Bytes Match:\n            {isLoading.value\n              ? 'Loading...'\n              : pureBinaryMatch.value?.match\n                ? 'true'\n                : 'false'}\n          </div>\n          <pre data-testid=\"ssr-text-hint-result\">\n            {JSON.stringify({\n              message: loaderData.value.message,\n              pureTextMatch: pureTextMatch.value,\n              mixedMatch: mixedMatch.value,\n              pureBinaryMatch: pureBinaryMatch.value,\n              isLoading: isLoading.value,\n              error: error.value,\n            })}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/raw-stream/ssr-text-hint')({\n  loader: async () => {\n    // Pure text stream - should use UTF-8 encoding with text hint\n    const textStream = createDelayedStream(\n      [encode('Hello '), encode('World '), encode('from SSR!')],\n      30,\n    )\n\n    // Mixed content stream - text hint should use UTF-8 for valid text, base64 for binary\n    const mixedStream = createDelayedStream(\n      [\n        encode('Valid text'),\n        new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8\n        encode(' more text'),\n      ],\n      30,\n    )\n\n    // Pure binary stream - text hint must fallback to base64 for all chunks\n    const pureBinaryStream = createDelayedStream(\n      [\n        new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]),\n        new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]),\n      ],\n      30,\n    )\n\n    return {\n      message: 'SSR Text Hint Test',\n      pureText: new RawStream(textStream, { hint: 'text' }),\n      mixedContent: new RawStream(mixedStream, { hint: 'text' }),\n      pureBinary: new RawStream(pureBinaryStream, { hint: 'text' }),\n    }\n  },\n  shouldReload: __TSR_PRERENDER__,\n  component: SSRTextHintTest,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/raw-stream.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/raw-stream')({\n  component: RawStreamLayout,\n})\n\nfunction RawStreamLayout() {\n  return (\n    <div class=\"p-4 space-y-4\">\n      <h1>Raw Stream Tests</h1>\n\n      <nav class=\"space-x-4\">\n        <Link\n          to=\"/raw-stream/client-call\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n        >\n          Client Calls\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-single\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Single\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-multiple\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Multiple\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-mixed\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Mixed\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-text-hint\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Text Hint\n        </Link>\n        <Link\n          to=\"/raw-stream/ssr-binary-hint\"\n          class=\"text-blue-500 underline\"\n          activeProps={{ class: 'font-bold' }}\n          reloadDocument={true}\n        >\n          SSR Binary Hint\n        </Link>\n        <Link to=\"/\" class=\"text-gray-500 underline\">\n          Back to Home\n        </Link>\n      </nav>\n\n      <hr />\n\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/$target/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect/$target/')({\n  component: () => {\n    const preload = Route.useSearch({ select: (s) => s.preload })\n    return (\n      <div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload.value}\n            data-testid=\"via-beforeLoad\"\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            search={{ reloadDocument: true }}\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload.value}\n            data-testid=\"via-beforeLoad-reloadDocument\"\n          >\n            via-beforeLoad (reloadDocument=true)\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            preload={preload.value}\n            data-testid=\"via-loader\"\n          >\n            via-loader\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            search={{ reloadDocument: true }}\n            preload={preload.value}\n            data-testid=\"via-loader-reloadDocument\"\n          >\n            via-loader (reloadDocument=true)\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./serverFn\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            serverFn\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/$target/serverFn/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect/$target/serverFn/')({\n  component: () => {\n    const params = Route.useParams()\n    return (\n      <div>\n        <h1 class=\"mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl \">\n          redirect test with server functions (target {params.value.target})\n        </h1>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            data-testid=\"via-beforeLoad\"\n          >\n            via-beforeLoad\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-beforeLoad\"\n            search={{ reloadDocument: true }}\n            activeProps={{\n              class: 'font-bold',\n            }}\n            data-testid=\"via-beforeLoad-reloadDocument\"\n          >\n            via-beforeLoad (reloadDocument=true)\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            data-testid=\"via-loader\"\n          >\n            via-loader\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-loader\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            search={{ reloadDocument: true }}\n            data-testid=\"via-loader-reloadDocument\"\n          >\n            via-loader (reloadDocument=true)\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-useServerFn\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            data-testid=\"via-useServerFn\"\n          >\n            via-useServerFn\n          </Link>\n        </div>\n        <div class=\"mb-2\">\n          <Link\n            from={Route.fullPath}\n            to=\"./via-useServerFn\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            search={{ reloadDocument: true }}\n            data-testid=\"via-useServerFn-reloadDocument\"\n          >\n            via-useServerFn (reloadDocument=true)\n          </Link>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { throwRedirect } from '~/components/throwRedirect'\n\nexport const Route = createFileRoute(\n  '/redirect/$target/serverFn/via-beforeLoad',\n)({\n  beforeLoad: ({\n    params: { target },\n    search: { reloadDocument, externalHost },\n  }) => throwRedirect({ data: { target, reloadDocument, externalHost } }),\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { throwRedirect } from '~/components/throwRedirect'\n\nexport const Route = createFileRoute('/redirect/$target/serverFn/via-loader')({\n  loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({\n    reloadDocument,\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { reloadDocument, externalHost } }) =>\n    throwRedirect({ data: { target, reloadDocument, externalHost } }),\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { RedirectOnClick } from '~/components/RedirectOnClick'\n\nexport const Route = createFileRoute(\n  '/redirect/$target/serverFn/via-useServerFn',\n)({\n  component: () => {\n    const params = Route.useParams()\n    const search = Route.useSearch()\n    return (\n      <RedirectOnClick\n        target={params.value.target}\n        reloadDocument={search.value.reloadDocument}\n        externalHost={search.value.externalHost}\n      />\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-beforeLoad')({\n  beforeLoad: ({\n    params: { target },\n    search: { reloadDocument, externalHost },\n  }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        throw redirect({ href: externalHost })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/$target/via-loader.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect/$target/via-loader')({\n  loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({\n    reloadDocument,\n    externalHost,\n  }),\n  loader: ({ params: { target }, deps: { externalHost, reloadDocument } }) => {\n    switch (target) {\n      case 'internal':\n        throw redirect({ to: '/posts', reloadDocument })\n      case 'external':\n        throw redirect({ href: externalHost })\n    }\n  },\n  component: () => <div>{Route.fullPath}</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/$target.tsx",
    "content": "import { retainSearchParams, createFileRoute } from '@tanstack/vue-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/redirect/$target')({\n  params: {\n    parse: (p) =>\n      z\n        .object({\n          target: z.union([z.literal('internal'), z.literal('external')]),\n        })\n        .parse(p),\n  },\n  validateSearch: z.object({\n    reloadDocument: z.boolean().optional(),\n    preload: z.literal(false).optional(),\n    externalHost: z.string().optional(),\n  }),\n  search: {\n    middlewares: [retainSearchParams(['externalHost'])],\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/redirect/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect/')({\n  component: () => (\n    <div>\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'internal' }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        internal\n      </Link>{' '}\n      <Link\n        from={Route.fullPath}\n        to=\"./$target\"\n        params={{ target: 'external' }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        external\n      </Link>\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/scripts.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nconst isProd = import.meta.env.PROD\n\nexport const Route = createFileRoute('/scripts')({\n  head: () => ({\n    scripts: [\n      {\n        src: 'script.js',\n      },\n      isProd\n        ? undefined\n        : {\n            src: 'script2.js',\n          },\n    ],\n  }),\n  component: ScriptsComponent,\n})\n\nfunction ScriptsComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3 data-testid=\"scripts-test-heading\">Scripts Test</h3>\n      <p>\n        Both `script.js` and `script2.js` are included in development, but only\n        `script.js` is included in production.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/search-params/default.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/search-params/default')({\n  validateSearch: z.object({\n    default: z.string().default('d1'),\n  }),\n  beforeLoad: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  loader: ({ context }) => {\n    if (context.hello !== 'world') {\n      throw new Error('Context hello is not \"world\"')\n    }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const context = Route.useRouteContext()\n    return (\n      <>\n        <div data-testid=\"search-default\">{search.value.default}</div>\n        <div data-testid=\"context-hello\">{context.value.hello}</div>\n      </>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/search-params/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/search-params/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <Link\n        data-testid=\"link-to-default-without-search\"\n        to=\"/search-params/default\"\n      >\n        go to /search-params/default\n      </Link>\n      <br />\n      <Link\n        data-testid=\"link-to-default-with-search\"\n        to=\"/search-params/default\"\n        search={{ default: 'd2' }}\n      >\n        go to /search-params/default?default=d2\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/search-params/loader-throws-redirect.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/search-params/loader-throws-redirect')({\n  validateSearch: z.object({\n    step: z.enum(['a', 'b', 'c']).optional(),\n  }),\n  loaderDeps: ({ search: { step } }) => ({ step }),\n  loader: ({ deps: { step } }) => {\n    if (step === undefined) {\n      throw redirect({\n        to: '/search-params/loader-throws-redirect',\n        search: { step: 'a' },\n      })\n    }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    return (\n      <div>\n        <h1>SearchParams</h1>\n        <div data-testid=\"search-param\">{search.value.step}</div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/search-params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/search-params')({\n  beforeLoad: async () => {\n    await new Promise((resolve) => setTimeout(resolve, 1000))\n    return { hello: 'world' as string }\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/specialChars/$param.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/specialChars/$param')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      Hello \"/specialChars/$param\":{' '}\n      <span data-testid={'special-param'}>{params.value.param}</span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/specialChars/hash.tsx",
    "content": "import { createFileRoute, useLocation } from '@tanstack/vue-router'\nimport { defineComponent, ref } from 'vue'\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const l = useLocation()\n    const toggleHashValue = ref(false)\n\n    const toggle = () => {\n      toggleHashValue.value = !toggleHashValue.value\n    }\n\n    return () => (\n      <div data-testid=\"special-hash-heading\">\n        <div>Hello \"/specialChars/hash\"!</div>\n        <button\n          class={\n            'mt-2 mb-2 px-1 py-1 bg-indigo-600 text-white rounded hover:bg-indigo-700 transition duration-200'\n          }\n          data-testid=\"toggle-hash-button\"\n          onClick={toggle}\n        >\n          Toggle HashValue\n        </button>\n        <div>\n          {toggleHashValue.value && (\n            <div>\n              Hash Value<span data-testid=\"special-hash\">{l.value.hash}</span>\n            </div>\n          )}\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/specialChars/hash')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/specialChars/malformed/$param.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/specialChars/malformed/$param')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div>\n      Hello \"/specialChars/malformed/$param\":{' '}\n      <span data-testid={'special-malformed-param'}>{params.value.param}</span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/specialChars/malformed/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/specialChars/malformed')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div>Hello \"/specialChars/malformed\"!</div>\n      <Link\n        from={Route.fullPath}\n        data-testid=\"special-malformed-path-link\"\n        href=\"/specialChars/malformed/%E0%A4\"\n      >\n        malformed path param\n      </Link>{' '}\n      <Link\n        from={Route.fullPath}\n        data-testid=\"special-malformed-search-link\"\n        href=\"/specialChars/malformed/search?searchParam=%E0%A4\"\n      >\n        malformed search param\n      </Link>{' '}\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/specialChars/malformed/search.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/specialChars/malformed/search')({\n  validateSearch: z.object({\n    searchParam: z.string(),\n  }),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n\n  return (\n    <div>\n      Hello \"/specialChars/malformed/search\"!\n      <span data-testid={'special-malformed-search-param'}>\n        {search.value.searchParam}\n      </span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/specialChars/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/specialChars')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <div>Hello \"/specialChars\"!</div>\n      <Link\n        to=\"/specialChars/대한민국\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        data-testid=\"special-non-latin-link\"\n      >\n        Unicode\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/$param\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        data-testid=\"special-param-link\"\n        params={{ param: '대|' }}\n      >\n        Unicode param\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/search\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        data-testid=\"special-searchParam-link\"\n        search={{ searchParam: '대|' }}\n      >\n        Unicode search param\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/hash\"\n        activeOptions={{\n          includeHash: true,\n        }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n        hash={'대|'}\n        data-testid=\"special-hash-link-1\"\n      >\n        Unicode Hash\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/hash\"\n        activeOptions={{\n          includeHash: true,\n        }}\n        activeProps={{\n          class: 'font-bold',\n        }}\n        hash={'abc'}\n        data-testid=\"special-hash-link-2\"\n      >\n        Unicode Hash abc\n      </Link>{' '}\n      <Link\n        to=\"/specialChars/malformed\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        data-testid=\"special-malformed-link\"\n      >\n        Malformed paths\n      </Link>{' '}\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/specialChars/search.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport z from 'zod'\n\nexport const Route = createFileRoute('/specialChars/search')({\n  validateSearch: z.object({\n    searchParam: z.string(),\n  }),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n\n  return (\n    <div>\n      Hello \"/specialChars/search\"!\n      <span data-testid={'special-search-param'}>\n        {search.value.searchParam}\n      </span>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/specialChars/대한민국.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/specialChars/대한민국')({\n  component: KoreaComponent,\n})\n\nfunction KoreaComponent() {\n  return (\n    <div class=\"p-2\">\n      Test\n      <h3 data-testid=\"special-non-latin-heading\">\n        Hello /specialChars/대한민국\n      </h3>\n      <p>This is a route with a non-ASCII path.</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/stream.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/stream')({\n  component: StreamComponent,\n})\n\nfunction StreamComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Stream Test</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nimport { getRouterInstance } from '@tanstack/vue-start'\nimport type { User } from '~/utils/users'\nimport { NotFound } from '~/components/NotFound'\nimport { UserErrorComponent } from '~/components/UserErrorComponent'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    const router = await getRouterInstance()\n    return await axios\n      .get<User>('/api/users/' + userId, { baseURL: router.options.origin })\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch user')\n      })\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user.value.name}</h4>\n      <div class=\"text-sm\">{user.value.email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { getRouterInstance } from '@tanstack/vue-start'\nimport axios from 'redaxios'\n\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const router = await getRouterInstance()\n    return await axios\n      .get<Array<User>>('/api/users', { baseURL: router.options.origin })\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch users')\n      })\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users.value,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => (\n          <li class=\"whitespace-nowrap\" key={user.id}>\n            <Link\n              to=\"/users/$userId\"\n              params={{\n                userId: String(user.id),\n              }}\n              class=\"block py-1 text-blue-800 hover:text-blue-600\"\n              activeProps={{ class: 'text-black font-bold' }}\n            >\n              <div>{user.name}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/server.ts",
    "content": "// DO NOT DELETE THIS FILE!!!\n// This file is a good smoke test to make sure the custom server entry is working\nimport handler from '@tanstack/vue-start/server-entry'\n\nconsole.log(\"[server-entry]: using custom server entry in 'src/server.ts'\")\n\nexport default {\n  fetch(request: Request) {\n    return handler.fetch(request)\n  },\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/vue-start/basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/vue-start/basic/src/vite-env.d.ts",
    "content": "/// <reference types=\"vite/client\" />\n\ninterface ImportMetaEnv {\n  readonly VITE_NODE_ENV: string\n  readonly VITE_EXTERNAL_PORT: string\n  readonly VITE_SERVER_PORT: string\n}\n\ninterface ImportMeta {\n  readonly env: ImportMetaEnv\n}\n\ndeclare const __TSR_PRERENDER__: boolean\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/navigation.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 404',\n  ],\n})\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('body')).toContainText(\"I'm a layout\")\n  await expect(page.locator('body')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout B!\")\n})\n\ntest('client side navigating to a route with scripts', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n  await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n  await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n  expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  expect(await page.evaluate('window.SCRIPT_2')).toBe(undefined)\n})\n\ntest('directly going to a route with scripts', async ({ page }) => {\n  await page.goto('/scripts')\n\n  await page.waitForURL('/scripts')\n  await page.waitForLoadState('networkidle')\n  expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  expect(await page.evaluate('window.SCRIPT_2')).toBe(undefined)\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForURL('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/not-found.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from '../tests/utils/isSpaMode'\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 404',\n  ],\n})\ntest.describe('not-found', () => {\n  test(`global not found`, async ({ page }) => {\n    const response = await page.goto(`/this-page-does-not-exist/foo/bar`)\n\n    expect(response?.status()).toBe(isSpaMode ? 200 : 404)\n\n    await expect(\n      page.getByTestId('default-not-found-component'),\n    ).toBeInViewport()\n  })\n\n  test.describe('throw notFound()', () => {\n    const navigationTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n      preload: [false, true] as const,\n    })\n\n    navigationTestMatrix.forEach(({ thrower, preload }) => {\n      test(`navigation: thrower: ${thrower}, preload: ${preload}`, async ({\n        page,\n      }) => {\n        await page.goto(\n          `/not-found/${preload === false ? '?preload=false' : ''}`,\n        )\n        const link = page.getByTestId(`via-${thrower}`)\n\n        if (preload) {\n          await link.focus()\n          await new Promise((r) => setTimeout(r, 250))\n        }\n\n        await link.click()\n\n        await expect(\n          page.getByTestId(`via-${thrower}-notFound-component`),\n        ).toBeInViewport()\n        await expect(\n          page.getByTestId(`via-${thrower}-route-component`),\n        ).not.toBeInViewport()\n      })\n    })\n    const directVisitTestMatrix = combinate({\n      thrower: ['beforeLoad', 'loader'] as const,\n    })\n\n    directVisitTestMatrix.forEach(({ thrower }) => {\n      test(`direct visit: thrower: ${thrower}`, async ({ page }) => {\n        await page.goto(`/not-found/via-${thrower}`)\n        await page.waitForLoadState('networkidle')\n        await expect(\n          page.getByTestId(`via-${thrower}-notFound-component`),\n        ).toBeInViewport()\n        await expect(\n          page.getByTestId(`via-${thrower}-route-component`),\n        ).not.toBeInViewport()\n      })\n    })\n\n    test('direct visit: child beforeLoad notFound renders parent boundary with parent loader data', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/parent-boundary/via-beforeLoad')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('parent-boundary-notFound-component'),\n      ).toBeInViewport()\n      await expect(page.getByTestId('parent-loader-data')).toHaveText('ready')\n      await expect(\n        page.getByTestId('parent-boundary-child-route-component'),\n      ).not.toBeInViewport()\n    })\n\n    test('direct visit: beforeLoad notFound with routeId targets root boundary', async ({\n      page,\n    }) => {\n      await page.goto('/not-found/via-beforeLoad-target-root')\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('default-not-found-component'),\n      ).toBeInViewport()\n      await expect(\n        page.getByTestId('via-beforeLoad-target-root-route-component'),\n      ).not.toBeInViewport()\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/prerendering.spec.ts",
    "content": "import { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isPrerender } from './utils/isPrerender'\n\ntest.describe('Prerender Static Path Discovery', () => {\n  test.skip(!isPrerender, 'Skipping since not in prerender mode')\n  test.describe('Build Output Verification', () => {\n    test('should automatically discover and prerender static routes', () => {\n      // Check that static routes were automatically discovered and prerendered\n      const distDir = join(process.cwd(), 'dist', 'client')\n\n      // These static routes should be automatically discovered and prerendered\n      expect(existsSync(join(distDir, 'index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'deferred/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'scripts/index.html'))).toBe(true)\n      expect(existsSync(join(distDir, 'inline-scripts/index.html'))).toBe(true)\n      expect(\n        existsSync(join(distDir, 'specialChars/대한민국/index.html')),\n      ).toBe(true)\n\n      // Pathless layouts should NOT be prerendered (they start with _)\n      expect(existsSync(join(distDir, '_layout', 'index.html'))).toBe(false) // /_layout\n\n      // API routes should NOT be prerendered\n\n      expect(existsSync(join(distDir, 'api', 'users', 'index.html'))).toBe(\n        false,\n      ) // /api/users\n    })\n  })\n\n  test.describe('Static Files Verification', () => {\n    test('should contain prerendered content in posts.html', () => {\n      const distDir = join(process.cwd(), 'dist', 'client')\n      expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true)\n\n      // \"Select a post.\" should be in the prerendered HTML\n      const html = readFileSync(join(distDir, 'posts/index.html'), 'utf-8')\n      expect(html).toContain('Select a post.')\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/redirect.spec.ts",
    "content": "import queryString from 'node:querystring'\nimport { expect } from '@playwright/test'\nimport combinateImport from 'combinate'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n  test,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../package.json' with { type: 'json' }\nimport { isSpaMode } from '../tests/utils/isSpaMode'\nimport { isPreview } from '../tests/utils/isPreview'\n\n// somehow playwright does not correctly import default exports\nconst combinate = (combinateImport as any).default as typeof combinateImport\n\nconst PORT = await getTestServerPort(\n  `${packageJson.name}${isSpaMode ? '_spa' : ''}${isPreview ? '_preview' : ''}`,\n)\nconst EXTERNAL_HOST_PORT = await getDummyServerPort(packageJson.name)\n\ntest.describe('redirects', () => {\n  const internalNavigationTestMatrix = combinate({\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n    preload: [false, true] as const,\n  })\n\n  internalNavigationTestMatrix.forEach(\n    ({ thrower, reloadDocument, preload }) => {\n      test(`internal target, navigation: thrower: ${thrower}, reloadDocument: ${reloadDocument}, preload: ${preload}`, async ({\n        page,\n      }) => {\n        await page.goto(\n          `/redirect/internal${preload === false ? '?preload=false' : ''}`,\n        )\n        const link = page.getByTestId(\n          `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`,\n        )\n\n        await page.waitForLoadState('networkidle')\n        let requestHappened = false\n\n        const requestPromise = new Promise<void>((resolve) => {\n          page.on('request', (request) => {\n            if (\n              request.url().startsWith(`http://localhost:${PORT}/_serverFn/`)\n            ) {\n              requestHappened = true\n              resolve()\n            }\n          })\n        })\n        await link.focus()\n\n        const expectRequestHappened = preload && !reloadDocument\n        const timeoutPromise = new Promise((resolve) =>\n          setTimeout(resolve, expectRequestHappened ? 5000 : 500),\n        )\n        await Promise.race([requestPromise, timeoutPromise])\n        expect(requestHappened).toBe(expectRequestHappened)\n        let fullPageLoad = false\n        page.on('domcontentloaded', () => {\n          fullPageLoad = true\n        })\n\n        await link.click()\n\n        const url = `http://localhost:${PORT}/posts`\n\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n        expect(fullPageLoad).toBe(reloadDocument)\n      })\n    },\n  )\n\n  const internalDirectVisitTestMatrix = combinate({\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n  })\n\n  internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => {\n    test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({\n      page,\n    }) => {\n      await page.goto(`/redirect/internal/via-${thrower}`)\n\n      const url = `http://localhost:${PORT}/posts`\n\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n      await page.waitForLoadState('networkidle')\n      await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n    })\n  })\n\n  const externalTestMatrix = combinate({\n    scenario: ['navigate', 'direct_visit'] as const,\n    thrower: ['beforeLoad', 'loader'] as const,\n  })\n\n  externalTestMatrix.forEach(({ scenario, thrower }) => {\n    test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({\n      page,\n    }) => {\n      const q = queryString.stringify({\n        externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n      })\n\n      if (scenario === 'navigate') {\n        await page.goto(`/redirect/external?${q}`)\n        await page.waitForLoadState('networkidle')\n        const link = page.getByTestId(`via-${thrower}`)\n        await link.focus()\n        await link.click()\n      } else {\n        await page.goto(`/redirect/external/via-${thrower}?${q}`)\n      }\n\n      const url = `http://localhost:${EXTERNAL_HOST_PORT}/`\n\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n    })\n  })\n\n  const serverFnTestMatrix = combinate({\n    target: ['internal', 'external'] as const,\n    scenario: ['navigate', 'direct_visit'] as const,\n    thrower: ['beforeLoad', 'loader'] as const,\n    reloadDocument: [false, true] as const,\n  })\n\n  serverFnTestMatrix.forEach(\n    ({ target, thrower, scenario, reloadDocument }) => {\n      test(`serverFn redirects to target: ${target}, scenario: ${scenario}, thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({\n        page,\n      }) => {\n        let fullPageLoad = false\n        const q = queryString.stringify({\n          externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n          reloadDocument,\n        })\n\n        if (scenario === 'navigate') {\n          await page.goto(`/redirect/${target}/serverFn?${q}`)\n          await page.waitForLoadState('networkidle')\n          const link = page.getByTestId(\n            `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`,\n          )\n          page.on('domcontentloaded', () => {\n            fullPageLoad = true\n          })\n          await link.focus()\n          await link.click()\n        } else {\n          await page.goto(`/redirect/${target}/serverFn/via-${thrower}?${q}`)\n        }\n\n        const url =\n          target === 'internal'\n            ? `http://localhost:${PORT}/posts`\n            : `http://localhost:${EXTERNAL_HOST_PORT}/`\n        await page.waitForURL(url)\n        expect(page.url()).toBe(url)\n        if (target === 'internal' && scenario === 'navigate') {\n          await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n          expect(fullPageLoad).toBe(reloadDocument)\n        }\n      })\n    },\n  )\n\n  const useServerFnTestMatrix = combinate({\n    target: ['internal', 'external'] as const,\n    reloadDocument: [false, true] as const,\n  })\n\n  useServerFnTestMatrix.forEach(({ target, reloadDocument }) => {\n    test(`useServerFn redirects to target: ${target}, reloadDocument: ${reloadDocument}`, async ({\n      page,\n    }) => {\n      const q = queryString.stringify({\n        externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/`,\n        reloadDocument,\n      })\n\n      await page.goto(`/redirect/${target}/serverFn/via-useServerFn?${q}`)\n\n      await page.waitForLoadState('networkidle')\n\n      const button = page.getByTestId('redirect-on-click')\n\n      let fullPageLoad = false\n      page.on('domcontentloaded', () => {\n        fullPageLoad = true\n      })\n\n      await button.click()\n\n      const url =\n        target === 'internal'\n          ? `http://localhost:${PORT}/posts`\n          : `http://localhost:${EXTERNAL_HOST_PORT}/`\n      await page.waitForURL(url)\n      expect(page.url()).toBe(url)\n      if (target === 'internal') {\n        await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport()\n        expect(fullPageLoad).toBe(reloadDocument)\n      }\n    })\n  })\n\n  test('multiple Set-Cookie headers are preserved on redirect', async ({\n    page,\n  }) => {\n    // This test verifies that multiple Set-Cookie headers are not lost during redirect\n    await page.goto('/multi-cookie-redirect')\n\n    // Wait for redirect to complete\n    await page.waitForURL(/\\/multi-cookie-redirect\\/target/)\n\n    // Should redirect to target page\n    await expect(page.getByTestId('multi-cookie-redirect-target')).toBeVisible()\n    expect(page.url()).toContain('/multi-cookie-redirect/target')\n\n    // Verify all three cookies were preserved during the redirect\n    await expect(page.getByTestId('cookie-session')).toHaveText('session-value')\n    await expect(page.getByTestId('cookie-csrf')).toHaveText('csrf-token-value')\n    await expect(page.getByTestId('cookie-theme')).toHaveText('dark')\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/script-duplication.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.describe('Script Duplication Prevention', () => {\n  test('should not create duplicate scripts on SSR route', async ({ page }) => {\n    await page.goto('/scripts')\n\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const scriptCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n\n    expect(scriptCount).toBe(1)\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate scripts during client-side navigation', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const firstNavCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(firstNavCount).toBe(1)\n\n    await page.getByRole('link', { name: 'Home' }).click()\n    await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const secondNavCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(secondNavCount).toBe(1)\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate scripts with multiple navigation cycles', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    for (let i = 0; i < 3; i++) {\n      await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n      await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n      await page.getByRole('link', { name: 'Home' }).click()\n      await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n    }\n\n    await page.getByRole('link', { name: 'Scripts', exact: true }).click()\n    await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()\n\n    const finalCount = await page.evaluate(() => {\n      return document.querySelectorAll('script[src=\"script.js\"]').length\n    })\n    expect(finalCount).toBe(1)\n    expect(await page.evaluate('window.SCRIPT_1')).toBe(true)\n  })\n\n  test('should not create duplicate inline scripts', async ({ page }) => {\n    await page.goto('/inline-scripts')\n\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    const script1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n\n    const script2Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_2 = \"test\"'),\n      ).length\n    })\n\n    expect(script1Count).toBe(1)\n    expect(script2Count).toBe(1)\n    expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)\n    expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')\n  })\n\n  test('should not create duplicate inline scripts during client-side navigation', async ({\n    page,\n  }) => {\n    await page.goto('/')\n\n    await page.getByRole('link', { name: 'Inline Scripts' }).click()\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    const firstNavScript1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n    expect(firstNavScript1Count).toBe(1)\n\n    await page.getByRole('link', { name: 'Home' }).click()\n    await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible()\n\n    await page.getByRole('link', { name: 'Inline Scripts' }).click()\n    await expect(\n      page.getByTestId('inline-scripts-test-heading'),\n    ).toBeInViewport()\n\n    const secondNavScript1Count = await page.evaluate(() => {\n      const scripts = Array.from(document.querySelectorAll('script:not([src])'))\n      return scripts.filter(\n        (script) =>\n          script.textContent &&\n          script.textContent.includes('window.INLINE_SCRIPT_1 = true'),\n      ).length\n    })\n    expect(secondNavScript1Count).toBe(1)\n\n    expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true)\n    expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test')\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/search-params.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from 'tests/utils/isSpaMode'\nimport { isPrerender } from './utils/isPrerender'\nimport type { Response } from '@playwright/test'\n\nfunction expectRedirect(response: Response | null, endsWith: string) {\n  expect(response).not.toBeNull()\n  expect(response!.request().redirectedFrom()).not.toBeNull()\n  const redirectUrl = response!\n    .request()\n    .redirectedFrom()!\n    .redirectedTo()\n    ?.url()\n  expect(redirectUrl).toBeDefined()\n  expect(redirectUrl!.endsWith(endsWith))\n}\n\nfunction expectNoRedirect(response: Response | null) {\n  expect(response).not.toBeNull()\n  const request = response!.request()\n  expect(request.redirectedFrom()).toBeNull()\n}\n\ntest.describe('/search-params/loader-throws-redirect', () => {\n  test('Directly visiting the route without search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/loader-throws-redirect')\n\n    if (!isSpaMode && !isPrerender) {\n      expectRedirect(response, '/search-params/loader-throws-redirect?step=a')\n    }\n\n    await expect(page.getByTestId('search-param')).toContainText('a')\n    expect(page.url().endsWith('/search-params/loader-throws-redirect?step=a'))\n  })\n\n  test('Directly visiting the route with search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto(\n      '/search-params/loader-throws-redirect?step=b',\n    )\n    expectNoRedirect(response)\n    await expect(page.getByTestId('search-param')).toContainText('b')\n    expect(page.url().endsWith('/search-params/loader-throws-redirect?step=b'))\n  })\n})\n\ntest.describe('/search-params/default', () => {\n  test('Directly visiting the route without search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/default')\n    if (!isSpaMode && !isPrerender) {\n      expectRedirect(response, '/search-params/default?default=d1')\n    }\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('Directly visiting the route with search param set', async ({\n    page,\n  }) => {\n    const response = await page.goto('/search-params/default?default=d2')\n    expectNoRedirect(response)\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route without search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-without-search').click()\n\n    await expect(page.getByTestId('search-default')).toContainText('d1')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d1'),\n    ).toBeTruthy()\n  })\n\n  test('navigating to the route with search param set', async ({ page }) => {\n    await page.goto('/search-params/')\n    await page.getByTestId('link-to-default-with-search').click()\n\n    await expect(page.getByTestId('search-default')).toContainText('d2')\n    await expect(page.getByTestId('context-hello')).toContainText('world')\n    expect(\n      page.url().endsWith('/search-params/default?default=d2'),\n    ).toBeTruthy()\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/special-characters.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { isSpaMode } from './utils/isSpaMode'\n\ntest.use({\n  whitelistErrors: [\n    /Failed to load resource: the server responded with a status of 404/,\n  ],\n})\ntest.describe('Unicode route rendering', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/specialChars')\n  })\n\n  test('should render non-latin route correctly with direct navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto('/specialChars/대한민국')\n    await page.waitForURL(\n      `${baseURL}/specialChars/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`,\n    )\n\n    await expect(page.getByTestId('special-non-latin-heading')).toBeInViewport()\n  })\n\n  test('should render non-latin route correctly during router navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    const nonLatinLink = page.getByTestId('special-non-latin-link')\n\n    await nonLatinLink.click()\n    await page.waitForURL(\n      `${baseURL}/specialChars/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`,\n    )\n\n    await expect(page.getByTestId('special-non-latin-heading')).toBeInViewport()\n  })\n\n  test.describe('Special characters in path params', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/대|')\n      await page.waitForURL(`${baseURL}/specialChars/%EB%8C%80%7C`)\n\n      const param = await page.getByTestId('special-param').textContent()\n\n      expect(param).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const link = page.getByTestId('special-param-link')\n\n      await link.click()\n      await page.waitForURL(`${baseURL}/specialChars/%EB%8C%80%7C`)\n\n      const param = await page.getByTestId('special-param').textContent()\n\n      expect(param).toBe('대|')\n    })\n  })\n\n  test.describe('Special characters in search params', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/search?searchParam=대|')\n\n      await page.waitForURL(\n        `${baseURL}/specialChars/search?searchParam=%EB%8C%80|`,\n      )\n\n      const searchParam = await page\n        .getByTestId('special-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const link = page.getByTestId('special-searchParam-link')\n\n      await link.click()\n      await page.waitForURL(\n        `${baseURL}/specialChars/search?searchParam=%EB%8C%80%7C`,\n      )\n\n      const searchParam = await page\n        .getByTestId('special-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('대|')\n    })\n  })\n\n  test.describe('Special characters in url hash', () => {\n    test('should render route correctly on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await expect(page.getByTestId('special-hash-link-1')).not.toContainClass(\n        'font-bold',\n      )\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.goto('/specialChars/hash#대|')\n\n      await page.waitForURL(`${baseURL}/specialChars/hash#%EB%8C%80|`)\n      await page.waitForLoadState('load')\n\n      await expect(page.getByTestId('special-hash-heading')).toBeInViewport()\n\n      await expect(page.getByTestId('special-hash-link-1')).toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.getByTestId('toggle-hash-button').click()\n\n      const hashValue = await page.getByTestId('special-hash').textContent()\n\n      expect(hashValue).toBe('대|')\n    })\n\n    test('should render route correctly on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await expect(page.getByTestId('special-hash-link-1')).not.toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      const link = page.getByTestId('special-hash-link-1')\n\n      await link.click()\n\n      await page.waitForURL(`${baseURL}/specialChars/hash#%EB%8C%80|`)\n      await page.waitForLoadState('load')\n\n      await expect(page.getByTestId('special-hash-heading')).toBeInViewport()\n\n      await expect(page.getByTestId('special-hash-link-1')).toContainClass(\n        'font-bold',\n      )\n\n      await expect(page.getByTestId('special-hash-link-2')).not.toContainClass(\n        'font-bold',\n      )\n\n      await page.getByTestId('toggle-hash-button').click()\n\n      const hashValue = await page.getByTestId('special-hash').textContent()\n\n      expect(hashValue).toBe('대|')\n    })\n  })\n\n  test.describe('malformed paths', () => {\n    test.use({\n      whitelistErrors: [\n        'Failed to load resource: the server responded with a status of 404',\n        'Failed to load resource: the server responded with a status of 400 (Bad Request)',\n      ],\n    })\n\n    test('un-matched malformed paths should return not found on direct navigation', async ({\n      page,\n    }) => {\n      const res = await page.goto('/specialChars/malformed/%E0%A4')\n\n      await page.waitForLoadState(`load`)\n\n      // in spa mode this is caught and handled at server level\n      if (!isSpaMode) {\n        expect(res!.status()).toBe(404)\n\n        await expect(\n          page.getByTestId('default-not-found-component'),\n        ).toBeInViewport()\n      } else {\n        expect(res!.status()).toBe(400)\n      }\n    })\n\n    test('malformed path params should return not found on router link', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/malformed')\n      await page.waitForURL(`${baseURL}/specialChars/malformed`)\n\n      const link = page.getByTestId('special-malformed-path-link')\n\n      await link.click()\n      await page.waitForLoadState('load')\n\n      await expect(\n        page.getByTestId('default-not-found-component'),\n      ).toBeInViewport()\n    })\n\n    test('un-matched malformed paths should return not found on direct navigation in search params', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/specialChars/malformed/search?searchParam=%E0%A4')\n\n      await page.waitForURL(\n        `${baseURL}/specialChars/malformed/search?searchParam=%E0%A4`,\n      )\n\n      await expect(\n        page.getByTestId('special-malformed-search-param'),\n      ).toBeInViewport()\n\n      const searchParam = await page\n        .getByTestId('special-malformed-search-param')\n        .textContent()\n\n      expect(searchParam).toBe('�')\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/streaming.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('Navigating to deferred route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Deferred' }).click()\n\n  await expect(page.getByTestId('regular-person')).toContainText('John Doe')\n  await expect(page.getByTestId('deferred-person')).toContainText(\n    'Tanner Linsley',\n  )\n  await expect(page.getByTestId('deferred-stuff')).toContainText(\n    'Hello deferred!',\n  )\n})\n\ntest('Directly visiting the deferred route', async ({ page }) => {\n  await page.goto('/deferred')\n\n  await expect(page.getByTestId('regular-person')).toContainText('John Doe')\n  await expect(page.getByTestId('deferred-person')).toContainText(\n    'Tanner Linsley',\n  )\n  await expect(page.getByTestId('deferred-stuff')).toContainText(\n    'Hello deferred!',\n  )\n})\n\ntest('Counter increments on click', async ({ page }) => {\n  await page.goto('/deferred')\n\n  // Wait for content to load\n  await expect(page.getByTestId('regular-person')).toContainText('John Doe')\n\n  // Wait for Vue hydration to complete by checking that the app is interactive\n  // The Scripts component adds scripts after hydration, so wait for network idle\n  await page.waitForLoadState('networkidle')\n\n  // Check initial count\n  await expect(page.getByTestId('count')).toContainText('Count: 0')\n\n  // Click increment button\n  await page.getByTestId('increment').click()\n\n  // Check updated count\n  await expect(page.getByTestId('count')).toContainText('Count: 1')\n\n  // Click again\n  await page.getByTestId('increment').click()\n  await expect(page.getByTestId('count')).toContainText('Count: 2')\n})\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/utils/isPrerender.ts",
    "content": "export const isPrerender: boolean = process.env.MODE === 'prerender'\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/utils/isPreview.ts",
    "content": "export const isPreview: boolean = process.env.MODE === 'preview'\n"
  },
  {
    "path": "e2e/vue-start/basic/tests/utils/isSpaMode.ts",
    "content": "export const isSpaMode: boolean = process.env.MODE === 'spa'\n"
  },
  {
    "path": "e2e/vue-start/basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { isSpaMode } from './tests/utils/isSpaMode'\nimport { isPrerender } from './tests/utils/isPrerender'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst spaModeConfiguration = {\n  enabled: true,\n  prerender: {\n    outputPath: 'index.html',\n  },\n}\n\nconst prerenderConfiguration = {\n  enabled: true,\n  filter: (page: { path: string }) =>\n    ![\n      '/this-route-does-not-exist',\n      '/redirect',\n      '/i-do-not-exist',\n      '/not-found',\n      '/specialChars/search',\n      '/specialChars/hash',\n      '/specialChars/malformed',\n      '/search-params', // search-param routes have dynamic content based on query params\n      '/transition',\n      '/users',\n    ].some((p) => page.path.includes(p)),\n  maxRedirects: 100,\n}\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  define: {\n    __TSR_PRERENDER__: JSON.stringify(isPrerender),\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      spa: isSpaMode ? spaModeConfiguration : undefined,\n      prerender: isPrerender ? prerenderConfiguration : undefined,\n    }),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/.env",
    "content": "# Environment variables declared in this file are automatically made available to Prisma.\n# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema\n\n# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.\n# See the documentation for all the connection string options: https://pris.ly/d/connection-strings\n\nDATABASE_URL=\"file:./dev.db\""
  },
  {
    "path": "e2e/vue-start/basic-auth/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n!.env\n.DS_Store\n.cache\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n.tmp/\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/basic-auth/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-basic-auth\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"prisma-generate\": \"prisma generate\",\n    \"test:e2e\": \"rm -rf port*.txt; mkdir -p .tmp; rm -f .tmp/dev.db .tmp/dev.db-journal .tmp/dev.db-wal .tmp/dev.db-shm; export DATABASE_URL=file:./.tmp/dev.db; pnpm run prisma-generate && pnpm exec prisma migrate deploy && playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@libsql/client\": \"^0.15.15\",\n    \"@prisma/adapter-libsql\": \"^7.0.0\",\n    \"@prisma/client\": \"^7.0.0\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"vue\": \"^3.5.25\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"dotenv\": \"^17.2.3\",\n    \"prisma\": \"^7.0.0\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/prisma/migrations/20240811183753_init/migration.sql",
    "content": "-- CreateTable\nCREATE TABLE \"User\" (\n    \"email\" TEXT NOT NULL PRIMARY KEY,\n    \"password\" TEXT NOT NULL\n);\n\n-- CreateIndex\nCREATE UNIQUE INDEX \"User_email_key\" ON \"User\"(\"email\");\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/prisma/migrations/migration_lock.toml",
    "content": "# Please do not edit this file manually\n# It should be added in your version-control system (i.e. Git)\nprovider = \"sqlite\""
  },
  {
    "path": "e2e/vue-start/basic-auth/prisma/schema.prisma",
    "content": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n  provider = \"prisma-client\"\n  output   = \"../src/prisma-generated\"\n}\n\ndatasource db {\n  provider = \"sqlite\"\n}\n\nmodel User {\n  email String @id @unique\n  password String\n}"
  },
  {
    "path": "e2e/vue-start/basic-auth/prisma.config.ts",
    "content": "import 'dotenv/config'\nimport { defineConfig, env } from 'prisma/config'\n\nexport default defineConfig({\n  schema: './prisma/schema.prisma',\n  migrations: {\n    path: './prisma/migrations',\n  },\n  datasource: {\n    url: env('DATABASE_URL'),\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/components/Auth.tsx",
    "content": "import type { VNode } from 'vue'\n\nexport function Auth({\n  actionText,\n  onSubmit,\n  status,\n  afterSubmit,\n}: {\n  actionText: string\n  onSubmit: (form: HTMLFormElement) => void\n  status: 'pending' | 'idle' | 'success' | 'error'\n  afterSubmit?: VNode | null\n}) {\n  return (\n    <div class=\"fixed inset-0 bg-white dark:bg-black flex items-start justify-center p-8\">\n      <div class=\"bg-white dark:bg-gray-900 p-8 rounded-lg shadow-lg\">\n        <h1 class=\"text-2xl font-bold mb-4\">{actionText}</h1>\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            onSubmit(event.currentTarget as HTMLFormElement)\n          }}\n          class=\"space-y-4\"\n        >\n          <div>\n            <label for=\"email\" class=\"block text-xs\">\n              Email\n            </label>\n            <input\n              type=\"email\"\n              name=\"email\"\n              id=\"email\"\n              class=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <div>\n            <label for=\"password\" class=\"block text-xs\">\n              Password\n            </label>\n            <input\n              type=\"password\"\n              name=\"password\"\n              id=\"password\"\n              class=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <button\n            type=\"button\"\n            class=\"w-full bg-cyan-600 text-white rounded-sm py-2 font-black uppercase\"\n            disabled={status === 'pending'}\n            onClick={(event) => {\n              const form = (event.currentTarget as HTMLButtonElement).form\n              if (form) {\n                onSubmit(form)\n              }\n            }}\n          >\n            {status === 'pending' ? '...' : actionText}\n          </button>\n          {afterSubmit ? afterSubmit : null}\n        </form>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot.value ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/components/Login.tsx",
    "content": "import { useRouter } from '@tanstack/vue-router'\nimport { useServerFn } from '@tanstack/vue-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { loginFn } from '../routes/_authed'\nimport { Auth } from './Auth'\nimport { signupFn } from '~/routes/signup'\nimport { defineComponent } from 'vue'\n\nexport const Login = defineComponent({\n  name: 'Login',\n  setup() {\n    const router = useRouter()\n    const login = useServerFn(loginFn)\n    const signup = useServerFn(signupFn)\n\n    const loginMutation = useMutation({\n      fn: login,\n      onSuccess: async (ctx) => {\n        if (!ctx.data?.error) {\n          await router.invalidate()\n          router.navigate({ to: '/' })\n          return\n        }\n      },\n    })\n\n    const signupMutation = useMutation({\n      fn: signup,\n    })\n\n    return () => (\n      <Auth\n        actionText=\"Login\"\n        status={loginMutation.status.value}\n        onSubmit={(form) => {\n          const formData = new FormData(form)\n\n          loginMutation.mutate({\n            data: {\n              email: formData.get('email') as string,\n              password: formData.get('password') as string,\n            },\n          })\n        }}\n        afterSubmit={\n          loginMutation.data.value ? (\n            <>\n              <div class=\"text-red-400\">\n                {loginMutation.data.value?.message}\n              </div>\n              {loginMutation.data.value?.userNotFound ? (\n                <div>\n                  <button\n                    class=\"text-blue-500\"\n                    onClick={(e) => {\n                      const formData = new FormData(\n                        (e.target as HTMLButtonElement).form!,\n                      )\n\n                      signupMutation.mutate({\n                        data: {\n                          email: formData.get('email') as string,\n                          password: formData.get('password') as string,\n                        },\n                      })\n                    }}\n                    type=\"button\"\n                  >\n                    Sign up instead?\n                  </button>\n                </div>\n              ) : null}\n            </>\n          ) : null\n        }\n      />\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/hooks/useMutation.ts",
    "content": "import { shallowRef } from 'vue'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const submittedAt = shallowRef<number | undefined>(undefined)\n  const variables = shallowRef<TVariables | undefined>(undefined)\n  const error = shallowRef<TError | undefined>(undefined)\n  const data = shallowRef<TData | undefined>(undefined)\n  const status = shallowRef<'idle' | 'pending' | 'success' | 'error'>('idle')\n\n  const mutate = async (\n    variablesInput: TVariables,\n  ): Promise<TData | undefined> => {\n    status.value = 'pending'\n    submittedAt.value = Date.now()\n    variables.value = variablesInput\n    try {\n      const result = await opts.fn(variablesInput)\n      await opts.onSuccess?.({ data: result })\n      status.value = 'success'\n      error.value = undefined\n      data.value = result\n      return result\n    } catch (err) {\n      status.value = 'error'\n      error.value = err as TError\n    }\n  }\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/browser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma-related types and utilities in a browser.\n * Use it to get access to models, enums, and input types.\n *\n * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.\n * See `client.ts` for the standard, server-side entry point.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as Prisma from './internal/prismaNamespaceBrowser'\nexport { Prisma }\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/client.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.\n * If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as process from 'node:process'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nglobalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport * as $Class from './internal/class'\nimport * as Prisma from './internal/prismaNamespace'\n\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\nexport const PrismaClient = $Class.getPrismaClientClass()\nexport type PrismaClient<\n  LogOpts extends Prisma.LogLevel = never,\n  OmitOpts extends Prisma.PrismaClientOptions['omit'] =\n    Prisma.PrismaClientOptions['omit'],\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>\nexport { Prisma }\n\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/commonInputTypes.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports various common sort, input & filter types that are not directly linked to a particular model.\n *\n * 🟢 You can import this file directly.\n */\n\nimport type * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport type * as Prisma from './internal/prismaNamespace'\n\nexport type StringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type StringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedStringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type NestedStringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedIntFilter<$PrismaModel = never> = {\n  equals?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  in?: number[]\n  notIn?: number[]\n  lt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  lte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedIntFilter<$PrismaModel> | number\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/enums.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports all enum related types from the schema.\n *\n * 🟢 You can import this file directly.\n */\n\n// This file is empty because there are no enums in the schema.\nexport {}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/internal/class.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * Please import the `PrismaClient` class from the `client.ts` file instead.\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from './prismaNamespace'\n\nconst config: runtime.GetPrismaClientConfig = {\n  previewFeatures: [],\n  clientVersion: '7.0.0',\n  engineVersion: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n  activeProvider: 'sqlite',\n  inlineSchema:\n    '// This is your Prisma schema file,\\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\\n\\ngenerator client {\\n  provider = \"prisma-client\"\\n  output   = \"../src/prisma-generated\"\\n}\\n\\ndatasource db {\\n  provider = \"sqlite\"\\n}\\n\\nmodel User {\\n  email    String @id @unique\\n  password String\\n}\\n',\n  runtimeDataModel: {\n    models: {},\n    enums: {},\n    types: {},\n  },\n}\n\nconfig.runtimeDataModel = JSON.parse(\n  '{\"models\":{\"User\":{\"fields\":[{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}',\n)\n\nasync function decodeBase64AsWasm(\n  wasmBase64: string,\n): Promise<WebAssembly.Module> {\n  const { Buffer } = await import('node:buffer')\n  const wasmArray = Buffer.from(wasmBase64, 'base64')\n  return new WebAssembly.Module(wasmArray)\n}\n\nconfig.compilerWasm = {\n  getRuntime: async () =>\n    await import('@prisma/client/runtime/query_compiler_bg.sqlite.mjs'),\n\n  getQueryCompilerWasmModule: async () => {\n    const { wasm } =\n      await import('@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs')\n    return await decodeBase64AsWasm(wasm)\n  },\n}\n\nexport type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =\n  'log' extends keyof ClientOptions\n    ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition>\n      ? Prisma.GetEvents<ClientOptions['log']>\n      : never\n    : never\n\nexport interface PrismaClientConstructor {\n  /**\n   * ## Prisma Client\n   *\n   * Type-safe database client for TypeScript\n   * @example\n   * ```\n   * const prisma = new PrismaClient()\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n   */\n\n  new <\n    Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,\n    LogOpts extends LogOptions<Options> = LogOptions<Options>,\n    OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {\n      omit: infer U\n    }\n      ? U\n      : Prisma.PrismaClientOptions['omit'],\n    ExtArgs extends runtime.Types.Extensions.InternalArgs =\n      runtime.Types.Extensions.DefaultArgs,\n  >(\n    options: Prisma.Subset<Options, Prisma.PrismaClientOptions>,\n  ): PrismaClient<LogOpts, OmitOpts, ExtArgs>\n}\n\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\n\nexport interface PrismaClient<\n  in LogOpts extends Prisma.LogLevel = never,\n  in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,\n  in out ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> {\n  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }\n\n  $on<V extends LogOpts>(\n    eventType: V,\n    callback: (\n      event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent,\n    ) => void,\n  ): PrismaClient\n\n  /**\n   * Connect with the database\n   */\n  $connect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Disconnect from the database\n   */\n  $disconnect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Executes a prepared raw query and returns the number of affected rows.\n   * @example\n   * ```\n   * const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Executes a raw query and returns the number of affected rows.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Performs a prepared raw query and returns the `SELECT` data.\n   * @example\n   * ```\n   * const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Performs a raw query and returns the `SELECT` data.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.\n   * @example\n   * ```\n   * const [george, bob, alice] = await prisma.$transaction([\n   *   prisma.user.create({ data: { name: 'George' } }),\n   *   prisma.user.create({ data: { name: 'Bob' } }),\n   *   prisma.user.create({ data: { name: 'Alice' } }),\n   * ])\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).\n   */\n  $transaction<P extends Prisma.PrismaPromise<any>[]>(\n    arg: [...P],\n    options?: { isolationLevel?: Prisma.TransactionIsolationLevel },\n  ): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>\n\n  $transaction<R>(\n    fn: (\n      prisma: Omit<PrismaClient, runtime.ITXClientDenyList>,\n    ) => runtime.Types.Utils.JsPromise<R>,\n    options?: {\n      maxWait?: number\n      timeout?: number\n      isolationLevel?: Prisma.TransactionIsolationLevel\n    },\n  ): runtime.Types.Utils.JsPromise<R>\n\n  $extends: runtime.Types.Extensions.ExtendsHook<\n    'extends',\n    Prisma.TypeMapCb<OmitOpts>,\n    ExtArgs,\n    runtime.Types.Utils.Call<\n      Prisma.TypeMapCb<OmitOpts>,\n      {\n        extArgs: ExtArgs\n      }\n    >\n  >\n\n  /**\n   * `prisma.user`: Exposes CRUD operations for the **User** model.\n   * Example usage:\n   * ```ts\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   */\n  get user(): Prisma.UserDelegate<ExtArgs, { omit: OmitOpts }>\n}\n\nexport function getPrismaClientClass(): PrismaClientConstructor {\n  return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/internal/prismaNamespace.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the client.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from '../models'\nimport { type PrismaClient } from './class'\n\nexport type * from '../models'\n\nexport type DMMF = typeof runtime.DMMF\n\nexport type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>\n\n/**\n * Prisma Errors\n */\n\nexport const PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\nexport type PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\n\nexport const PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\nexport type PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\n\nexport const PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\nexport type PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\n\nexport const PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\nexport type PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\n\nexport const PrismaClientValidationError = runtime.PrismaClientValidationError\nexport type PrismaClientValidationError = runtime.PrismaClientValidationError\n\n/**\n * Re-export of sql-template-tag\n */\nexport const sql = runtime.sqltag\nexport const empty = runtime.empty\nexport const join = runtime.join\nexport const raw = runtime.raw\nexport const Sql = runtime.Sql\nexport type Sql = runtime.Sql\n\n/**\n * Decimal.js\n */\nexport const Decimal = runtime.Decimal\nexport type Decimal = runtime.Decimal\n\nexport type DecimalJsLike = runtime.DecimalJsLike\n\n/**\n * Extensions\n */\nexport type Extension = runtime.Types.Extensions.UserArgs\nexport const getExtensionContext = runtime.Extensions.getExtensionContext\nexport type Args<T, F extends runtime.Operation> = runtime.Types.Public.Args<\n  T,\n  F\n>\nexport type Payload<\n  T,\n  F extends runtime.Operation = never,\n> = runtime.Types.Public.Payload<T, F>\nexport type Result<\n  T,\n  A,\n  F extends runtime.Operation,\n> = runtime.Types.Public.Result<T, A, F>\nexport type Exact<A, W> = runtime.Types.Public.Exact<A, W>\n\nexport type PrismaVersion = {\n  client: string\n  engine: string\n}\n\n/**\n * Prisma Client JS version: 7.0.0\n * Query Engine version: 0c19ccc313cf9911a90d99d2ac2eb0280c76c513\n */\nexport const prismaVersion: PrismaVersion = {\n  client: '7.0.0',\n  engine: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n}\n\n/**\n * Utility Types\n */\n\nexport type Bytes = runtime.Bytes\nexport type JsonObject = runtime.JsonObject\nexport type JsonArray = runtime.JsonArray\nexport type JsonValue = runtime.JsonValue\nexport type InputJsonObject = runtime.InputJsonObject\nexport type InputJsonArray = runtime.InputJsonArray\nexport type InputJsonValue = runtime.InputJsonValue\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\ntype SelectAndInclude = {\n  select: any\n  include: any\n}\n\ntype SelectAndOmit = {\n  select: any\n  omit: any\n}\n\n/**\n * From T, pick a set of properties whose keys are in the union K\n */\ntype Prisma__Pick<T, K extends keyof T> = {\n  [P in K]: T[P]\n}\n\nexport type Enumerable<T> = T | Array<T>\n\n/**\n * Subset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection\n */\nexport type Subset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n}\n\n/**\n * SelectSubset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection.\n * Additionally, it validates, if both select and include are present. If the case, it errors.\n */\nexport type SelectSubset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & (T extends SelectAndInclude\n  ? 'Please either choose `select` or `include`.'\n  : T extends SelectAndOmit\n    ? 'Please either choose `select` or `omit`.'\n    : {})\n\n/**\n * Subset + Intersection\n * @desc From `T` pick properties that exist in `U` and intersect `K`\n */\nexport type SubsetIntersection<T, U, K> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & K\n\ntype Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }\n\n/**\n * XOR is needed to have a real mutually exclusive union type\n * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types\n */\nexport type XOR<T, U> = T extends object\n  ? U extends object\n    ? (Without<T, U> & U) | (Without<U, T> & T)\n    : U\n  : T\n\n/**\n * Is T a Record?\n */\ntype IsObject<T extends any> =\n  T extends Array<any>\n    ? False\n    : T extends Date\n      ? False\n      : T extends Uint8Array\n        ? False\n        : T extends BigInt\n          ? False\n          : T extends object\n            ? True\n            : False\n\n/**\n * If it's T[], return T\n */\nexport type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T\n\n/**\n * From ts-toolbelt\n */\n\ntype __Either<O extends object, K extends Key> = Omit<O, K> &\n  {\n    // Merge all but K\n    [P in K]: Prisma__Pick<O, P & keyof O> // With K possibilities\n  }[K]\n\ntype EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>\n\ntype EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>\n\ntype _Either<O extends object, K extends Key, strict extends Boolean> = {\n  1: EitherStrict<O, K>\n  0: EitherLoose<O, K>\n}[strict]\n\nexport type Either<\n  O extends object,\n  K extends Key,\n  strict extends Boolean = 1,\n> = O extends unknown ? _Either<O, K, strict> : never\n\nexport type Union = any\n\nexport type PatchUndefined<O extends object, O1 extends object> = {\n  [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K]\n} & {}\n\n/** Helper Types for \"Merge\" **/\nexport type IntersectOf<U extends Union> = (\n  U extends unknown ? (k: U) => void : never\n) extends (k: infer I) => void\n  ? I\n  : never\n\nexport type Overwrite<O extends object, O1 extends object> = {\n  [K in keyof O]: K extends keyof O1 ? O1[K] : O[K]\n} & {}\n\ntype _Merge<U extends object> = IntersectOf<\n  Overwrite<\n    U,\n    {\n      [K in keyof U]-?: At<U, K>\n    }\n  >\n>\n\ntype Key = string | number | symbol\ntype AtStrict<O extends object, K extends Key> = O[K & keyof O]\ntype AtLoose<O extends object, K extends Key> = O extends unknown\n  ? AtStrict<O, K>\n  : never\nexport type At<O extends object, K extends Key, strict extends Boolean = 1> = {\n  1: AtStrict<O, K>\n  0: AtLoose<O, K>\n}[strict]\n\nexport type ComputeRaw<A extends any> = A extends Function\n  ? A\n  : {\n      [K in keyof A]: A[K]\n    } & {}\n\nexport type OptionalFlat<O> = {\n  [K in keyof O]?: O[K]\n} & {}\n\ntype _Record<K extends keyof any, T> = {\n  [P in K]: T\n}\n\n// cause typescript not to expand types and preserve names\ntype NoExpand<T> = T extends unknown ? T : never\n\n// this type assumes the passed object is entirely optional\nexport type AtLeast<O extends object, K extends string> = NoExpand<\n  O extends unknown\n    ?\n        | (K extends keyof O ? { [P in K]: O[P] } & O : O)\n        | ({ [P in keyof O as P extends K ? P : never]-?: O[P] } & O)\n    : never\n>\n\ntype _Strict<U, _U = U> = U extends unknown\n  ? U & OptionalFlat<_Record<Exclude<Keys<_U>, keyof U>, never>>\n  : never\n\nexport type Strict<U extends object> = ComputeRaw<_Strict<U>>\n/** End Helper Types for \"Merge\" **/\n\nexport type Merge<U extends object> = ComputeRaw<_Merge<Strict<U>>>\n\nexport type Boolean = True | False\n\nexport type True = 1\n\nexport type False = 0\n\nexport type Not<B extends Boolean> = {\n  0: 1\n  1: 0\n}[B]\n\nexport type Extends<A1 extends any, A2 extends any> = [A1] extends [never]\n  ? 0 // anything `never` is false\n  : A1 extends A2\n    ? 1\n    : 0\n\nexport type Has<U extends Union, U1 extends Union> = Not<\n  Extends<Exclude<U1, U>, U1>\n>\n\nexport type Or<B1 extends Boolean, B2 extends Boolean> = {\n  0: {\n    0: 0\n    1: 1\n  }\n  1: {\n    0: 1\n    1: 1\n  }\n}[B1][B2]\n\nexport type Keys<U extends Union> = U extends unknown ? keyof U : never\n\nexport type GetScalarType<T, O> = O extends object\n  ? {\n      [P in keyof T]: P extends keyof O ? O[P] : never\n    }\n  : never\n\ntype FieldPaths<T, U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>> =\n  IsObject<T> extends True ? U : T\n\nexport type GetHavingFields<T> = {\n  [K in keyof T]: Or<\n    Or<Extends<'OR', K>, Extends<'AND', K>>,\n    Extends<'NOT', K>\n  > extends True\n    ? // infer is only needed to not hit TS limit\n      // based on the brilliant idea of Pierre-Antoine Mills\n      // https://github.com/microsoft/TypeScript/issues/30188#issuecomment-478938437\n      T[K] extends infer TK\n      ? GetHavingFields<\n          UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never\n        >\n      : never\n    : {} extends FieldPaths<T[K]>\n      ? never\n      : K\n}[keyof T]\n\n/**\n * Convert tuple to union\n */\ntype _TupleToUnion<T> = T extends (infer E)[] ? E : never\ntype TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>\nexport type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T\n\n/**\n * Like `Pick`, but additionally can also accept an array of keys\n */\nexport type PickEnumerable<\n  T,\n  K extends Enumerable<keyof T> | keyof T,\n> = Prisma__Pick<T, MaybeTupleToUnion<K>>\n\n/**\n * Exclude all keys with underscores\n */\nexport type ExcludeUnderscoreKeys<T extends string> = T extends `_${string}`\n  ? never\n  : T\n\nexport type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>\n\ntype FieldRefInputType<Model, FieldType> = Model extends never\n  ? never\n  : FieldRef<Model, FieldType>\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\nexport interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils\n  .Fn<\n  { extArgs: runtime.Types.Extensions.InternalArgs },\n  runtime.Types.Utils.Record<string, any>\n> {\n  returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>\n}\n\nexport type TypeMap<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> = {\n  globalOmitOptions: {\n    omit: GlobalOmitOptions\n  }\n  meta: {\n    modelProps: 'user'\n    txIsolationLevel: TransactionIsolationLevel\n  }\n  model: {\n    User: {\n      payload: Prisma.$UserPayload<ExtArgs>\n      fields: Prisma.UserFieldRefs\n      operations: {\n        findUnique: {\n          args: Prisma.UserFindUniqueArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findUniqueOrThrow: {\n          args: Prisma.UserFindUniqueOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findFirst: {\n          args: Prisma.UserFindFirstArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findFirstOrThrow: {\n          args: Prisma.UserFindFirstOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findMany: {\n          args: Prisma.UserFindManyArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        create: {\n          args: Prisma.UserCreateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        createMany: {\n          args: Prisma.UserCreateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        createManyAndReturn: {\n          args: Prisma.UserCreateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        delete: {\n          args: Prisma.UserDeleteArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        update: {\n          args: Prisma.UserUpdateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        deleteMany: {\n          args: Prisma.UserDeleteManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateMany: {\n          args: Prisma.UserUpdateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateManyAndReturn: {\n          args: Prisma.UserUpdateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        upsert: {\n          args: Prisma.UserUpsertArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        aggregate: {\n          args: Prisma.UserAggregateArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.AggregateUser>\n        }\n        groupBy: {\n          args: Prisma.UserGroupByArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.UserGroupByOutputType>[]\n        }\n        count: {\n          args: Prisma.UserCountArgs<ExtArgs>\n          result:\n            | runtime.Types.Utils.Optional<Prisma.UserCountAggregateOutputType>\n            | number\n        }\n      }\n    }\n  }\n} & {\n  other: {\n    payload: any\n    operations: {\n      $executeRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $executeRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n      $queryRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $queryRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n    }\n  }\n}\n\n/**\n * Enums\n */\n\nexport const TransactionIsolationLevel = runtime.makeStrictEnum({\n  Serializable: 'Serializable',\n} as const)\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n\n/**\n * Field references\n */\n\n/**\n * Reference to a field of type 'String'\n */\nexport type StringFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'String'\n>\n\n/**\n * Reference to a field of type 'Int'\n */\nexport type IntFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'Int'\n>\n\n/**\n * Batch Payload for updateMany & deleteMany & createMany\n */\nexport type BatchPayload = {\n  count: number\n}\n\nexport const defineExtension = runtime.Extensions\n  .defineExtension as unknown as runtime.Types.Extensions.ExtendsHook<\n  'define',\n  TypeMapCb,\n  runtime.Types.Extensions.DefaultArgs\n>\nexport type DefaultPrismaClient = PrismaClient\nexport type ErrorFormat = 'pretty' | 'colorless' | 'minimal'\nexport type PrismaClientOptions = (\n  | {\n      /**\n       * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`.\n       */\n      adapter: runtime.SqlDriverAdapterFactory\n      accelerateUrl?: never\n    }\n  | {\n      /**\n       * Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database.\n       */\n      accelerateUrl: string\n      adapter?: never\n    }\n) & {\n  /**\n   * @default \"colorless\"\n   */\n  errorFormat?: ErrorFormat\n  /**\n   * @example\n   * ```\n   * // Shorthand for `emit: 'stdout'`\n   * log: ['query', 'info', 'warn', 'error']\n   *\n   * // Emit as events only\n   * log: [\n   *   { emit: 'event', level: 'query' },\n   *   { emit: 'event', level: 'info' },\n   *   { emit: 'event', level: 'warn' }\n   *   { emit: 'event', level: 'error' }\n   * ]\n   *\n   * / Emit as events and log to stdout\n   * og: [\n   *  { emit: 'stdout', level: 'query' },\n   *  { emit: 'stdout', level: 'info' },\n   *  { emit: 'stdout', level: 'warn' }\n   *  { emit: 'stdout', level: 'error' }\n   *\n   * ```\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).\n   */\n  log?: (LogLevel | LogDefinition)[]\n  /**\n   * The default values for transactionOptions\n   * maxWait ?= 2000\n   * timeout ?= 5000\n   */\n  transactionOptions?: {\n    maxWait?: number\n    timeout?: number\n    isolationLevel?: TransactionIsolationLevel\n  }\n  /**\n   * Global configuration for omitting model fields by default.\n   *\n   * @example\n   * ```\n   * const prisma = new PrismaClient({\n   *   omit: {\n   *     user: {\n   *       password: true\n   *     }\n   *   }\n   * })\n   * ```\n   */\n  omit?: GlobalOmitConfig\n}\nexport type GlobalOmitConfig = {\n  user?: Prisma.UserOmit\n}\n\n/* Types for Logging */\nexport type LogLevel = 'info' | 'query' | 'warn' | 'error'\nexport type LogDefinition = {\n  level: LogLevel\n  emit: 'stdout' | 'event'\n}\n\nexport type CheckIsLogLevel<T> = T extends LogLevel ? T : never\n\nexport type GetLogType<T> = CheckIsLogLevel<\n  T extends LogDefinition ? T['level'] : T\n>\n\nexport type GetEvents<T extends any[]> =\n  T extends Array<LogLevel | LogDefinition> ? GetLogType<T[number]> : never\n\nexport type QueryEvent = {\n  timestamp: Date\n  query: string\n  params: string\n  duration: number\n  target: string\n}\n\nexport type LogEvent = {\n  timestamp: Date\n  message: string\n  target: string\n}\n/* End Types for Logging */\n\nexport type PrismaAction =\n  | 'findUnique'\n  | 'findUniqueOrThrow'\n  | 'findMany'\n  | 'findFirst'\n  | 'findFirstOrThrow'\n  | 'create'\n  | 'createMany'\n  | 'createManyAndReturn'\n  | 'update'\n  | 'updateMany'\n  | 'updateManyAndReturn'\n  | 'upsert'\n  | 'delete'\n  | 'deleteMany'\n  | 'executeRaw'\n  | 'queryRaw'\n  | 'aggregate'\n  | 'count'\n  | 'runCommandRaw'\n  | 'findRaw'\n  | 'groupBy'\n\n/**\n * `PrismaClient` proxy available in interactive transactions.\n */\nexport type TransactionClient = Omit<\n  DefaultPrismaClient,\n  runtime.ITXClientDenyList\n>\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/internal/prismaNamespaceBrowser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the browser.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/index-browser'\n\nexport type * from '../models'\nexport type * from './prismaNamespace'\n\nexport const Decimal = runtime.Decimal\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\n/*\n * Enums\n */\n\nexport const TransactionIsolationLevel = {\n  Serializable: 'Serializable',\n} as const\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/models/User.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports the `User` model and its related types.\n *\n * 🟢 You can import this file directly.\n */\nimport type * as runtime from '@prisma/client/runtime/client'\nimport type * as $Enums from '../enums'\nimport type * as Prisma from '../internal/prismaNamespace'\n\n/**\n * Model User\n *\n */\nexport type UserModel =\n  runtime.Types.Result.DefaultSelection<Prisma.$UserPayload>\n\nexport type AggregateUser = {\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\nexport type UserMinAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserMaxAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserCountAggregateOutputType = {\n  email: number\n  password: number\n  _all: number\n}\n\nexport type UserMinAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserMaxAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserCountAggregateInputType = {\n  email?: true\n  password?: true\n  _all?: true\n}\n\nexport type UserAggregateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which User to aggregate.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the start position\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Count returned Users\n   **/\n  _count?: true | UserCountAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the minimum value\n   **/\n  _min?: UserMinAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the maximum value\n   **/\n  _max?: UserMaxAggregateInputType\n}\n\nexport type GetUserAggregateType<T extends UserAggregateArgs> = {\n  [P in keyof T & keyof AggregateUser]: P extends '_count' | 'count'\n    ? T[P] extends true\n      ? number\n      : Prisma.GetScalarType<T[P], AggregateUser[P]>\n    : Prisma.GetScalarType<T[P], AggregateUser[P]>\n}\n\nexport type UserGroupByArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  where?: Prisma.UserWhereInput\n  orderBy?:\n    | Prisma.UserOrderByWithAggregationInput\n    | Prisma.UserOrderByWithAggregationInput[]\n  by: Prisma.UserScalarFieldEnum[] | Prisma.UserScalarFieldEnum\n  having?: Prisma.UserScalarWhereWithAggregatesInput\n  take?: number\n  skip?: number\n  _count?: UserCountAggregateInputType | true\n  _min?: UserMinAggregateInputType\n  _max?: UserMaxAggregateInputType\n}\n\nexport type UserGroupByOutputType = {\n  email: string\n  password: string\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\ntype GetUserGroupByPayload<T extends UserGroupByArgs> = Prisma.PrismaPromise<\n  Array<\n    Prisma.PickEnumerable<UserGroupByOutputType, T['by']> & {\n      [P in keyof T & keyof UserGroupByOutputType]: P extends '_count'\n        ? T[P] extends boolean\n          ? number\n          : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n        : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n    }\n  >\n>\n\nexport type UserWhereInput = {\n  AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  OR?: Prisma.UserWhereInput[]\n  NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  email?: Prisma.StringFilter<'User'> | string\n  password?: Prisma.StringFilter<'User'> | string\n}\n\nexport type UserOrderByWithRelationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserWhereUniqueInput = Prisma.AtLeast<\n  {\n    email?: string\n    AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    OR?: Prisma.UserWhereInput[]\n    NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    password?: Prisma.StringFilter<'User'> | string\n  },\n  'email' | 'email'\n>\n\nexport type UserOrderByWithAggregationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n  _count?: Prisma.UserCountOrderByAggregateInput\n  _max?: Prisma.UserMaxOrderByAggregateInput\n  _min?: Prisma.UserMinOrderByAggregateInput\n}\n\nexport type UserScalarWhereWithAggregatesInput = {\n  AND?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  OR?: Prisma.UserScalarWhereWithAggregatesInput[]\n  NOT?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  email?: Prisma.StringWithAggregatesFilter<'User'> | string\n  password?: Prisma.StringWithAggregatesFilter<'User'> | string\n}\n\nexport type UserCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUncheckedCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCreateManyInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateManyMutationInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateManyInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCountOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMaxOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMinOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type StringFieldUpdateOperationsInput = {\n  set?: string\n}\n\nexport type UserSelect<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectCreateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectUpdateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectScalar = {\n  email?: boolean\n  password?: boolean\n}\n\nexport type UserOmit<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetOmit<\n  'email' | 'password',\n  ExtArgs['result']['user']\n>\n\nexport type $UserPayload<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  name: 'User'\n  objects: {}\n  scalars: runtime.Types.Extensions.GetPayloadResult<\n    {\n      email: string\n      password: string\n    },\n    ExtArgs['result']['user']\n  >\n  composites: {}\n}\n\nexport type UserGetPayload<\n  S extends boolean | null | undefined | UserDefaultArgs,\n> = runtime.Types.Result.GetResult<Prisma.$UserPayload, S>\n\nexport type UserCountArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = Omit<UserFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {\n  select?: UserCountAggregateInputType | true\n}\n\nexport interface UserDelegate<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> {\n  [K: symbol]: {\n    types: Prisma.TypeMap<ExtArgs>['model']['User']\n    meta: { name: 'User' }\n  }\n  /**\n   * Find zero or one User that matches the filter.\n   * @param {UserFindUniqueArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUnique({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUnique<T extends UserFindUniqueArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUnique',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find one User that matches the filter or throw an error with `error.code='P2025'`\n   * if no matches were found.\n   * @param {UserFindUniqueOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUniqueOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUniqueOrThrow<T extends UserFindUniqueOrThrowArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUniqueOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirst({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirst<T extends UserFindFirstArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirst',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter or\n   * throw `PrismaKnownClientError` with `P2025` code if no matches were found.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirstOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirstOrThrow<T extends UserFindFirstOrThrowArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirstOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find zero or more Users that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindManyArgs} args - Arguments to filter and select certain fields only.\n   * @example\n   * // Get all Users\n   * const users = await prisma.user.findMany()\n   *\n   * // Get first 10 Users\n   * const users = await prisma.user.findMany({ take: 10 })\n   *\n   * // Only select the `email`\n   * const userWithEmailOnly = await prisma.user.findMany({ select: { email: true } })\n   *\n   */\n  findMany<T extends UserFindManyArgs>(\n    args?: Prisma.SelectSubset<T, UserFindManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findMany',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create a User.\n   * @param {UserCreateArgs} args - Arguments to create a User.\n   * @example\n   * // Create one User\n   * const User = await prisma.user.create({\n   *   data: {\n   *     // ... data to create a User\n   *   }\n   * })\n   *\n   */\n  create<T extends UserCreateArgs>(\n    args: Prisma.SelectSubset<T, UserCreateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'create',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Create many Users.\n   * @param {UserCreateManyArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createMany({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   */\n  createMany<T extends UserCreateManyArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Create many Users and returns the data saved in the database.\n   * @param {UserCreateManyAndReturnArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createManyAndReturn({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Create many Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.createManyAndReturn({\n   *   select: { email: true },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  createManyAndReturn<T extends UserCreateManyAndReturnArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'createManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Delete a User.\n   * @param {UserDeleteArgs} args - Arguments to delete one User.\n   * @example\n   * // Delete one User\n   * const User = await prisma.user.delete({\n   *   where: {\n   *     // ... filter to delete one User\n   *   }\n   * })\n   *\n   */\n  delete<T extends UserDeleteArgs>(\n    args: Prisma.SelectSubset<T, UserDeleteArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'delete',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Update one User.\n   * @param {UserUpdateArgs} args - Arguments to update one User.\n   * @example\n   * // Update one User\n   * const user = await prisma.user.update({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  update<T extends UserUpdateArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'update',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Delete zero or more Users.\n   * @param {UserDeleteManyArgs} args - Arguments to filter Users to delete.\n   * @example\n   * // Delete a few Users\n   * const { count } = await prisma.user.deleteMany({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   *\n   */\n  deleteMany<T extends UserDeleteManyArgs>(\n    args?: Prisma.SelectSubset<T, UserDeleteManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserUpdateManyArgs} args - Arguments to update one or more rows.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateMany({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  updateMany<T extends UserUpdateManyArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users and returns the data updated in the database.\n   * @param {UserUpdateManyAndReturnArgs} args - Arguments to update many Users.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateManyAndReturn({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Update zero or more Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.updateManyAndReturn({\n   *   select: { email: true },\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  updateManyAndReturn<T extends UserUpdateManyAndReturnArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'updateManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create or update one User.\n   * @param {UserUpsertArgs} args - Arguments to update or create a User.\n   * @example\n   * // Update or create a User\n   * const user = await prisma.user.upsert({\n   *   create: {\n   *     // ... data to create a User\n   *   },\n   *   update: {\n   *     // ... in case it already exists, update\n   *   },\n   *   where: {\n   *     // ... the filter for the User we want to update\n   *   }\n   * })\n   */\n  upsert<T extends UserUpsertArgs>(\n    args: Prisma.SelectSubset<T, UserUpsertArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'upsert',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Count the number of Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserCountArgs} args - Arguments to filter Users to count.\n   * @example\n   * // Count the number of Users\n   * const count = await prisma.user.count({\n   *   where: {\n   *     // ... the filter for the Users we want to count\n   *   }\n   * })\n   **/\n  count<T extends UserCountArgs>(\n    args?: Prisma.Subset<T, UserCountArgs>,\n  ): Prisma.PrismaPromise<\n    T extends runtime.Types.Utils.Record<'select', any>\n      ? T['select'] extends true\n        ? number\n        : Prisma.GetScalarType<T['select'], UserCountAggregateOutputType>\n      : number\n  >\n\n  /**\n   * Allows you to perform aggregations operations on a User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserAggregateArgs} args - Select which aggregations you would like to apply and on what fields.\n   * @example\n   * // Ordered by age ascending\n   * // Where email contains prisma.io\n   * // Limited to the 10 users\n   * const aggregations = await prisma.user.aggregate({\n   *   _avg: {\n   *     age: true,\n   *   },\n   *   where: {\n   *     email: {\n   *       contains: \"prisma.io\",\n   *     },\n   *   },\n   *   orderBy: {\n   *     age: \"asc\",\n   *   },\n   *   take: 10,\n   * })\n   **/\n  aggregate<T extends UserAggregateArgs>(\n    args: Prisma.Subset<T, UserAggregateArgs>,\n  ): Prisma.PrismaPromise<GetUserAggregateType<T>>\n\n  /**\n   * Group by User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserGroupByArgs} args - Group by arguments.\n   * @example\n   * // Group by city, order by createdAt, get count\n   * const result = await prisma.user.groupBy({\n   *   by: ['city', 'createdAt'],\n   *   orderBy: {\n   *     createdAt: true\n   *   },\n   *   _count: {\n   *     _all: true\n   *   },\n   * })\n   *\n   **/\n  groupBy<\n    T extends UserGroupByArgs,\n    HasSelectOrTake extends Prisma.Or<\n      Prisma.Extends<'skip', Prisma.Keys<T>>,\n      Prisma.Extends<'take', Prisma.Keys<T>>\n    >,\n    OrderByArg extends Prisma.True extends HasSelectOrTake\n      ? { orderBy: UserGroupByArgs['orderBy'] }\n      : { orderBy?: UserGroupByArgs['orderBy'] },\n    OrderFields extends Prisma.ExcludeUnderscoreKeys<\n      Prisma.Keys<Prisma.MaybeTupleToUnion<T['orderBy']>>\n    >,\n    ByFields extends Prisma.MaybeTupleToUnion<T['by']>,\n    ByValid extends Prisma.Has<ByFields, OrderFields>,\n    HavingFields extends Prisma.GetHavingFields<T['having']>,\n    HavingValid extends Prisma.Has<ByFields, HavingFields>,\n    ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False,\n    InputErrors extends ByEmpty extends Prisma.True\n      ? `Error: \"by\" must not be empty.`\n      : HavingValid extends Prisma.False\n        ? {\n            [P in HavingFields]: P extends ByFields\n              ? never\n              : P extends string\n                ? `Error: Field \"${P}\" used in \"having\" needs to be provided in \"by\".`\n                : [\n                    Error,\n                    'Field ',\n                    P,\n                    ` in \"having\" needs to be provided in \"by\"`,\n                  ]\n          }[HavingFields]\n        : 'take' extends Prisma.Keys<T>\n          ? 'orderBy' extends Prisma.Keys<T>\n            ? ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields]\n            : 'Error: If you provide \"take\", you also need to provide \"orderBy\"'\n          : 'skip' extends Prisma.Keys<T>\n            ? 'orderBy' extends Prisma.Keys<T>\n              ? ByValid extends Prisma.True\n                ? {}\n                : {\n                    [P in OrderFields]: P extends ByFields\n                      ? never\n                      : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                  }[OrderFields]\n              : 'Error: If you provide \"skip\", you also need to provide \"orderBy\"'\n            : ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields],\n  >(\n    args: Prisma.SubsetIntersection<T, UserGroupByArgs, OrderByArg> &\n      InputErrors,\n  ): {} extends InputErrors\n    ? GetUserGroupByPayload<T>\n    : Prisma.PrismaPromise<InputErrors>\n  /**\n   * Fields of the User model\n   */\n  readonly fields: UserFieldRefs\n}\n\n/**\n * The delegate class that acts as a \"Promise-like\" for User.\n * Why is this prefixed with `Prisma__`?\n * Because we want to prevent naming conflicts as mentioned in\n * https://github.com/prisma/prisma-client-js/issues/707\n */\nexport interface Prisma__UserClient<\n  T,\n  Null = never,\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> extends Prisma.PrismaPromise<T> {\n  readonly [Symbol.toStringTag]: 'PrismaPromise'\n  /**\n   * Attaches callbacks for the resolution and/or rejection of the Promise.\n   * @param onfulfilled The callback to execute when the Promise is resolved.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of which ever callback is executed.\n   */\n  then<TResult1 = T, TResult2 = never>(\n    onfulfilled?:\n      | ((value: T) => TResult1 | PromiseLike<TResult1>)\n      | undefined\n      | null,\n    onrejected?:\n      | ((reason: any) => TResult2 | PromiseLike<TResult2>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<TResult1 | TResult2>\n  /**\n   * Attaches a callback for only the rejection of the Promise.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of the callback.\n   */\n  catch<TResult = never>(\n    onrejected?:\n      | ((reason: any) => TResult | PromiseLike<TResult>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<T | TResult>\n  /**\n   * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The\n   * resolved value cannot be modified from the callback.\n   * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).\n   * @returns A Promise for the completion of the callback.\n   */\n  finally(\n    onfinally?: (() => void) | undefined | null,\n  ): runtime.Types.Utils.JsPromise<T>\n}\n\n/**\n * Fields of the User model\n */\nexport interface UserFieldRefs {\n  readonly email: Prisma.FieldRef<'User', 'String'>\n  readonly password: Prisma.FieldRef<'User', 'String'>\n}\n\n// Custom InputTypes\n/**\n * User findUnique\n */\nexport type UserFindUniqueArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findUniqueOrThrow\n */\nexport type UserFindUniqueOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findFirst\n */\nexport type UserFindFirstArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findFirstOrThrow\n */\nexport type UserFindFirstOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findMany\n */\nexport type UserFindManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which Users to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for listing Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User create\n */\nexport type UserCreateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to create a User.\n   */\n  data: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n}\n\n/**\n * User createMany\n */\nexport type UserCreateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User createManyAndReturn\n */\nexport type UserCreateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectCreateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User update\n */\nexport type UserUpdateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to update a User.\n   */\n  data: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n  /**\n   * Choose, which User to update.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User updateMany\n */\nexport type UserUpdateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User updateManyAndReturn\n */\nexport type UserUpdateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectUpdateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User upsert\n */\nexport type UserUpsertArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The filter to search for the User to update in case it exists.\n   */\n  where: Prisma.UserWhereUniqueInput\n  /**\n   * In case the User found by the `where` argument doesn't exist, create a new User with this data.\n   */\n  create: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n  /**\n   * In case the User was found with the provided `where` argument, update it with this data.\n   */\n  update: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n}\n\n/**\n * User delete\n */\nexport type UserDeleteArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter which User to delete.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User deleteMany\n */\nexport type UserDeleteManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which Users to delete\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to delete.\n   */\n  limit?: number\n}\n\n/**\n * User without action\n */\nexport type UserDefaultArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/prisma-generated/models.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This is a barrel export file for all models and their related types.\n *\n * 🟢 You can import this file directly.\n */\nexport type * from './models/User'\nexport type * from './commonInputTypes'\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SignupRouteImport } from './routes/signup'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteImport } from './routes/_authed/posts'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst SignupRoute = SignupRouteImport.update({\n  id: '/signup',\n  path: '/signup',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRoute = AuthedPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts': typeof AuthedPostsRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/_authed/posts': typeof AuthedPostsRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  LogoutRoute: typeof LogoutRoute\n  SignupRoute: typeof SignupRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/signup': {\n      id: '/signup'\n      path: '/signup'\n      fullPath: '/signup'\n      preLoaderRoute: typeof SignupRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteChildren: AuthedPostsRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(\n  AuthedPostsRouteChildren,\n)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRoute: typeof AuthedPostsRouteWithChildren\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRoute: AuthedPostsRouteWithChildren,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n  LoginRoute: LoginRoute,\n  LogoutRoute: LogoutRoute,\n  SignupRoute: SignupRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { createServerFn } from '@tanstack/vue-start'\n\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'\nimport { NotFound } from '~/components/NotFound.js'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo.js'\nimport { useAppSession } from '~/utils/session.js'\n\nconst fetchUser = createServerFn({ method: 'GET' }).handler(async () => {\n  // We need to auth on the server so we have access to secure cookies\n  const session = await useAppSession()\n\n  if (!session.data.userEmail) {\n    return null\n  }\n\n  return {\n    email: session.data.userEmail,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const user = await fetchUser()\n\n    return {\n      user,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack Vue Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack Vue framework.`,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  shellComponent: RootShell,\n  errorComponent: (props) => <DefaultCatchBoundary {...props} />,\n  notFoundComponent: () => <NotFound />,\n  component: () => <Outlet />,\n})\n\nfunction RootShell(_: unknown, { slots }: { slots: any }) {\n  const routeContext = Route.useRouteContext()\n\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div class=\"ml-auto\">\n            {routeContext.value.user ? (\n              <>\n                <span class=\"mr-2\">{routeContext.value.user.email}</span>\n                <Link to=\"/logout\">Logout</Link>\n              </>\n            ) : (\n              <Link to=\"/login\">Login</Link>\n            )}\n          </div>\n        </div>\n        <hr />\n        {slots.default?.()}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nimport { NotFound } from '~/components/NotFound.js'\nimport { fetchPost } from '~/utils/posts.js'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/_authed/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nimport { fetchPosts } from '~/utils/posts.js'\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => (\n          <li class=\"whitespace-nowrap\" key={post.id}>\n            <Link\n              to=\"/posts/$postId\"\n              params={{\n                postId: post.id,\n              }}\n              class=\"block py-1 text-blue-800 hover:text-blue-600\"\n              activeProps={{ class: 'text-black font-bold' }}\n            >\n              <div>{post.title.substring(0, 20)}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/_authed.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\n\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { Login } from '~/components/Login'\nimport { useAppSession } from '~/utils/session'\n\nexport const loginFn = createServerFn({\n  method: 'POST',\n})\n  .inputValidator((payload: { email: string; password: string }) => payload)\n  .handler(async ({ data }) => {\n    // Find the user\n    const user = await prismaClient.user.findUnique({\n      where: {\n        email: data.email,\n      },\n    })\n\n    // Check if the user exists\n    if (!user) {\n      return {\n        error: true,\n        userNotFound: true,\n        message: 'User not found',\n      }\n    }\n\n    // Check if the password is correct\n    const hashedPassword = await hashPassword(data.password)\n\n    if (user.password !== hashedPassword) {\n      return {\n        error: true,\n        message: 'Incorrect password',\n      }\n    }\n\n    // Create a session\n    const session = await useAppSession()\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n  })\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return <Login />\n    }\n\n    throw error\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { Login } from '~/components/Login'\n\nexport const Route = createFileRoute('/login')({\n  component: LoginComp,\n})\n\nfunction LoginComp() {\n  return <Login />\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/logout.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\n\nimport { useAppSession } from '~/utils/session'\n\nconst logoutFn = createServerFn({ method: 'POST' }).handler(async () => {\n  const session = await useAppSession()\n\n  session.clear()\n\n  throw redirect({\n    href: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  preload: false,\n  loader: () => logoutFn(),\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/routes/signup.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/vue-router'\nimport { createServerFn, useServerFn } from '@tanstack/vue-start'\nimport { defineComponent } from 'vue'\n\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { useMutation } from '~/hooks/useMutation'\nimport { Auth } from '~/components/Auth'\nimport { useAppSession } from '~/utils/session'\n\nexport const signupFn = createServerFn({\n  method: 'POST',\n})\n  .inputValidator(\n    (data: { email: string; password: string; redirectUrl?: string }) => data,\n  )\n  .handler(async ({ data: payload }) => {\n    // Check if the user already exists\n    const found = await prismaClient.user.findUnique({\n      where: {\n        email: payload.email,\n      },\n    })\n\n    // Encrypt the password using Sha256 into plaintext\n    const password = await hashPassword(payload.password)\n\n    // Create a session\n    const session = await useAppSession()\n\n    if (found) {\n      if (found.password !== password) {\n        return {\n          error: true,\n          userExists: true,\n          message: 'User already exists',\n        }\n      }\n\n      // Store the user's email in the session\n      await session.update({\n        userEmail: found.email,\n      })\n\n      // Redirect to the prev page stored in the \"redirect\" search param\n      throw redirect({\n        href: payload.redirectUrl || '/',\n      })\n    }\n\n    // Create the user\n    const user = await prismaClient.user.create({\n      data: {\n        email: payload.email,\n        password,\n      },\n    })\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n\n    // Redirect to the prev page stored in the \"redirect\" search param\n    throw redirect({\n      href: payload.redirectUrl || '/',\n    })\n  })\n\nconst SignupComp = defineComponent({\n  name: 'Signup',\n  setup() {\n    const signup = useServerFn(signupFn)\n\n    const signupMutation = useMutation({\n      fn: signup,\n    })\n\n    return () => (\n      <Auth\n        actionText=\"Sign Up\"\n        status={signupMutation.status.value}\n        onSubmit={(form) => {\n          const formData = new FormData(form)\n\n          signupMutation.mutate({\n            data: {\n              email: formData.get('email') as string,\n              password: formData.get('password') as string,\n            },\n          })\n        }}\n        afterSubmit={\n          signupMutation.data.value?.error ? (\n            <>\n              <div class=\"text-red-400\">\n                {signupMutation.data.value?.message}\n              </div>\n            </>\n          ) : null\n        }\n      />\n    )\n  },\n})\n\nexport const Route = createFileRoute('/signup')({\n  component: SignupComp,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/utils/prisma.ts",
    "content": "import crypto from 'node:crypto'\nimport { PrismaLibSql } from '@prisma/adapter-libsql'\nimport { PrismaClient } from '../prisma-generated/client'\n\nconst adapter = new PrismaLibSql({\n  url: process.env.DATABASE_URL || 'file:./dev.db',\n})\nexport const prismaClient = new PrismaClient({ adapter })\n\nexport function hashPassword(password: string) {\n  return new Promise<string>((resolve, reject) => {\n    crypto.pbkdf2(password, 'salt', 100000, 64, 'sha256', (err, derivedKey) => {\n      if (err) {\n        reject(err)\n      } else {\n        resolve(derivedKey.toString('hex'))\n      }\n    })\n  })\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/src/utils/session.ts",
    "content": "// src/services/session.server.ts\nimport { useSession } from '@tanstack/vue-start/server'\nimport type { User } from '~/prisma-generated/client'\n\ntype SessionUser = {\n  userEmail: User['email']\n}\n\nexport function useAppSession() {\n  return useSession<SessionUser>({\n    password: 'ChangeThisBeforeShippingToProdOrYouWillBeFired',\n  })\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\nimport type { Page } from '@playwright/test'\n\nasync function waitForHydration(page: Page) {\n  await page.waitForFunction(() => typeof (window as any).$_TSR === 'undefined')\n}\n\nasync function signup(page: Page, email: string, password: string) {\n  await page.goto('/signup')\n  await waitForHydration(page)\n  await page.fill('input[name=\"email\"]', email)\n  await page.fill('input[name=\"password\"]', password)\n  await page.getByRole('button', { name: 'Sign Up' }).click()\n  await page.waitForSelector('text=Logout')\n}\n\nasync function login(\n  page: Page,\n  email: string,\n  password: string,\n  signupOnFail = false,\n) {\n  await page.goto('/login')\n  await waitForHydration(page)\n  await page.fill('input[name=\"email\"]', email)\n  await page.fill('input[name=\"password\"]', password)\n  await page.getByRole('button', { name: 'Login' }).click()\n\n  if (signupOnFail) {\n    await page.waitForSelector('text=User not found')\n    await page.click('button:has-text(\"Sign up instead?\")')\n    await page.waitForSelector('text=Logout')\n  }\n}\n\ntest('Posts redirects to login when not authenticated', async ({ page }) => {\n  await page.goto('/posts')\n  await expect(page.locator('h1')).toContainText('Login')\n})\n\ntest('Login fails with user not found', async ({ page }) => {\n  const email = `missing-${Date.now()}@gmail.com`\n  await login(page, email, 'badpassword')\n  await expect(page.getByText('User not found')).toBeVisible()\n})\n\ntest('Login fails with incorrect password', async ({ page }) => {\n  const email = `incorrect-password-${Date.now()}@gmail.com`\n  await signup(page, email, 'test')\n  await page.goto('/logout')\n  await login(page, email, 'badpassword')\n  await expect(page.getByText('Incorrect password')).toBeVisible()\n})\n\ntest('Can sign up from a not found user', async ({ page }) => {\n  const email = `new-${Date.now()}@gmail.com`\n  await login(page, email, 'badpassword', true)\n  await expect(page.getByText(email)).toBeVisible()\n})\n\ntest('Navigating to post after logging in', async ({ page }) => {\n  const email = `posts-${Date.now()}@gmail.com`\n  await signup(page, email, 'test')\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/tests/mock-db-setup.test.ts",
    "content": "import { test as setup } from '@playwright/test'\n\nimport { hashPassword, prismaClient } from '../src/utils/prisma'\n\nsetup('create new database', async () => {\n  await prismaClient.user.deleteMany()\n\n  const email = 'test@gmail.com'\n  const password = await hashPassword('test')\n  await prismaClient.user.create({\n    data: {\n      email,\n      password,\n    },\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/tests/mock-db-teardown.test.ts",
    "content": "import { test as teardown } from '@playwright/test'\n\nimport { hashPassword, prismaClient } from '../src/utils/prisma'\n\nteardown('create new database', async () => {\n  await prismaClient.user.deleteMany()\n\n  const email = 'test@gmail.com'\n  const password = await hashPassword('test')\n  await prismaClient.user.create({\n    data: {\n      email,\n      password,\n    },\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-auth/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/.gitignore",
    "content": "node_modules\n.DS_Store\n.cache\n.env\ndist\n.wrangler\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/.prettierignore",
    "content": "**/public\npnpm-lock.yaml\nrouteTree.gen.ts\nworker-configuration.d.ts\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-basic-cloudflare\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"cf-typegen\": \"wrangler types\",\n    \"postinstall\": \"npm run cf-typegen\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"vue\": \"^3.5.25\"\n  },\n  \"devDependencies\": {\n    \"@cloudflare/vite-plugin\": \"^1.29.0\",\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"wrangler\": \"^4.74.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && pnpm preview --port ${PORT}`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot.value ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as StaticRouteImport } from './routes/static'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst StaticRoute = StaticRouteImport.update({\n  id: '/static',\n  path: '/static',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/static': typeof StaticRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/static'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/static'\n  id: '__root__' | '/' | '/static'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  StaticRoute: typeof StaticRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/static': {\n      id: '/static'\n      path: '/static'\n      fullPath: '/static'\n      preLoaderRoute: typeof StaticRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  StaticRoute: StaticRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack Vue Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack Vue framework.`,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n  component: () => <Outlet />,\n})\n\nfunction RootDocument(_: unknown, { slots }: { slots: any }) {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        {slots.default?.()}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { env } from 'cloudflare:workers'\n\nexport const Route = createFileRoute('/')({\n  loader: () => getData(),\n  component: Home,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    message: `Running in ${navigator.userAgent}`,\n    myVar: env.MY_VAR,\n  }\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <p data-testid=\"message\">{data.value.message}</p>\n      <p data-testid=\"myVar\">{data.value.myVar}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/routes/static.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { env } from 'cloudflare:workers'\n\nexport const Route = createFileRoute('/static')({\n  loader: () => getData(),\n  component: StaticPage,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    myVar: env.MY_VAR,\n  }\n})\n\nfunction StaticPage() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div>\n      <h1 data-testid=\"static-heading\">Static Page</h1>\n      <p data-testid=\"static-content\">The value is {data.value.myVar}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/tests/app.spec.ts",
    "content": "import { existsSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('returns the correct user agent', async ({ page }) => {\n  await page.goto('/')\n  await expect(page.getByTestId('message')).toHaveText(\n    'Running in Cloudflare-Workers',\n  )\n})\n\ntest('returns the correct value from a Cloudflare binding', async ({\n  page,\n}) => {\n  await page.goto('/')\n  await expect(page.getByTestId('myVar')).toHaveText('Hello from Cloudflare')\n})\n\ntest('prerender with Cloudflare Workers runtime', async ({ page }) => {\n  // Verify the static page was prerendered during build\n  const distDir = join(process.cwd(), 'dist', 'client')\n  expect(existsSync(join(distDir, 'static', 'index.html'))).toBe(true)\n\n  // Verify the page loads correctly\n  await page.goto('/static')\n  await expect(page.getByTestId('static-heading')).toHaveText('Static Page')\n  await expect(page.getByTestId('static-content')).toHaveText(\n    'The value is Hello from Cloudflare',\n  )\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { cloudflare } from '@cloudflare/vite-plugin'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    cloudflare({ viteEnvironment: { name: 'ssr' }, inspectorPort: false }),\n    tanstackStart({\n      prerender: {\n        enabled: true,\n        filter: (page) => page.path === '/static',\n      },\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/worker-configuration.d.ts",
    "content": "/* eslint-disable */\n// Generated by Wrangler by running `wrangler types` (hash: b11df627d8b3c51b1bf3230a546b0f20)\n// Runtime types generated with workerd@1.20260317.1 2025-09-24 nodejs_compat\ndeclare namespace Cloudflare {\n\tinterface Env {\n\t\tMY_VAR: \"Hello from Cloudflare\";\n\t}\n}\ninterface Env extends Cloudflare.Env {}\ntype StringifyValues<EnvType extends Record<string, unknown>> = {\n\t[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;\n};\ndeclare namespace NodeJS {\n\tinterface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, \"MY_VAR\">> {}\n}\n\n// Begin runtime types\n/*! *****************************************************************************\nCopyright (c) Cloudflare. All rights reserved.\nCopyright (c) Microsoft Corporation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n/* eslint-disable */\n// noinspection JSUnusedGlobalSymbols\ndeclare var onmessage: never;\n/**\n * The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)\n */\ndeclare class DOMException extends Error {\n    constructor(message?: string, name?: string);\n    /**\n     * The **`message`** read-only property of the a message or description associated with the given error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)\n     */\n    readonly message: string;\n    /**\n     * The **`name`** read-only property of the one of the strings associated with an error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)\n     */\n    readonly name: string;\n    /**\n     * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)\n     */\n    readonly code: number;\n    static readonly INDEX_SIZE_ERR: number;\n    static readonly DOMSTRING_SIZE_ERR: number;\n    static readonly HIERARCHY_REQUEST_ERR: number;\n    static readonly WRONG_DOCUMENT_ERR: number;\n    static readonly INVALID_CHARACTER_ERR: number;\n    static readonly NO_DATA_ALLOWED_ERR: number;\n    static readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    static readonly NOT_FOUND_ERR: number;\n    static readonly NOT_SUPPORTED_ERR: number;\n    static readonly INUSE_ATTRIBUTE_ERR: number;\n    static readonly INVALID_STATE_ERR: number;\n    static readonly SYNTAX_ERR: number;\n    static readonly INVALID_MODIFICATION_ERR: number;\n    static readonly NAMESPACE_ERR: number;\n    static readonly INVALID_ACCESS_ERR: number;\n    static readonly VALIDATION_ERR: number;\n    static readonly TYPE_MISMATCH_ERR: number;\n    static readonly SECURITY_ERR: number;\n    static readonly NETWORK_ERR: number;\n    static readonly ABORT_ERR: number;\n    static readonly URL_MISMATCH_ERR: number;\n    static readonly QUOTA_EXCEEDED_ERR: number;\n    static readonly TIMEOUT_ERR: number;\n    static readonly INVALID_NODE_TYPE_ERR: number;\n    static readonly DATA_CLONE_ERR: number;\n    get stack(): any;\n    set stack(value: any);\n}\ntype WorkerGlobalScopeEventMap = {\n    fetch: FetchEvent;\n    scheduled: ScheduledEvent;\n    queue: QueueEvent;\n    unhandledrejection: PromiseRejectionEvent;\n    rejectionhandled: PromiseRejectionEvent;\n};\ndeclare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {\n    EventTarget: typeof EventTarget;\n}\n/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *\n * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)\n */\ninterface Console {\n    \"assert\"(condition?: boolean, ...data: any[]): void;\n    /**\n     * The **`console.clear()`** static method clears the console if possible.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)\n     */\n    clear(): void;\n    /**\n     * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)\n     */\n    count(label?: string): void;\n    /**\n     * The **`console.countReset()`** static method resets counter used with console/count_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)\n     */\n    countReset(label?: string): void;\n    /**\n     * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)\n     */\n    debug(...data: any[]): void;\n    /**\n     * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)\n     */\n    dir(item?: any, options?: any): void;\n    /**\n     * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)\n     */\n    dirxml(...data: any[]): void;\n    /**\n     * The **`console.error()`** static method outputs a message to the console at the 'error' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)\n     */\n    error(...data: any[]): void;\n    /**\n     * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)\n     */\n    group(...data: any[]): void;\n    /**\n     * The **`console.groupCollapsed()`** static method creates a new inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)\n     */\n    groupCollapsed(...data: any[]): void;\n    /**\n     * The **`console.groupEnd()`** static method exits the current inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)\n     */\n    groupEnd(): void;\n    /**\n     * The **`console.info()`** static method outputs a message to the console at the 'info' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)\n     */\n    info(...data: any[]): void;\n    /**\n     * The **`console.log()`** static method outputs a message to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)\n     */\n    log(...data: any[]): void;\n    /**\n     * The **`console.table()`** static method displays tabular data as a table.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)\n     */\n    table(tabularData?: any, properties?: string[]): void;\n    /**\n     * The **`console.time()`** static method starts a timer you can use to track how long an operation takes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)\n     */\n    time(label?: string): void;\n    /**\n     * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)\n     */\n    timeEnd(label?: string): void;\n    /**\n     * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)\n     */\n    timeLog(label?: string, ...data: any[]): void;\n    timeStamp(label?: string): void;\n    /**\n     * The **`console.trace()`** static method outputs a stack trace to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)\n     */\n    trace(...data: any[]): void;\n    /**\n     * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)\n     */\n    warn(...data: any[]): void;\n}\ndeclare const console: Console;\ntype BufferSource = ArrayBufferView | ArrayBuffer;\ntype TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;\ndeclare namespace WebAssembly {\n    class CompileError extends Error {\n        constructor(message?: string);\n    }\n    class RuntimeError extends Error {\n        constructor(message?: string);\n    }\n    type ValueType = \"anyfunc\" | \"externref\" | \"f32\" | \"f64\" | \"i32\" | \"i64\" | \"v128\";\n    interface GlobalDescriptor {\n        value: ValueType;\n        mutable?: boolean;\n    }\n    class Global {\n        constructor(descriptor: GlobalDescriptor, value?: any);\n        value: any;\n        valueOf(): any;\n    }\n    type ImportValue = ExportValue | number;\n    type ModuleImports = Record<string, ImportValue>;\n    type Imports = Record<string, ModuleImports>;\n    type ExportValue = Function | Global | Memory | Table;\n    type Exports = Record<string, ExportValue>;\n    class Instance {\n        constructor(module: Module, imports?: Imports);\n        readonly exports: Exports;\n    }\n    interface MemoryDescriptor {\n        initial: number;\n        maximum?: number;\n        shared?: boolean;\n    }\n    class Memory {\n        constructor(descriptor: MemoryDescriptor);\n        readonly buffer: ArrayBuffer;\n        grow(delta: number): number;\n    }\n    type ImportExportKind = \"function\" | \"global\" | \"memory\" | \"table\";\n    interface ModuleExportDescriptor {\n        kind: ImportExportKind;\n        name: string;\n    }\n    interface ModuleImportDescriptor {\n        kind: ImportExportKind;\n        module: string;\n        name: string;\n    }\n    abstract class Module {\n        static customSections(module: Module, sectionName: string): ArrayBuffer[];\n        static exports(module: Module): ModuleExportDescriptor[];\n        static imports(module: Module): ModuleImportDescriptor[];\n    }\n    type TableKind = \"anyfunc\" | \"externref\";\n    interface TableDescriptor {\n        element: TableKind;\n        initial: number;\n        maximum?: number;\n    }\n    class Table {\n        constructor(descriptor: TableDescriptor, value?: any);\n        readonly length: number;\n        get(index: number): any;\n        grow(delta: number, value?: any): number;\n        set(index: number, value?: any): void;\n    }\n    function instantiate(module: Module, imports?: Imports): Promise<Instance>;\n    function validate(bytes: BufferSource): boolean;\n}\n/**\n * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)\n */\ninterface ServiceWorkerGlobalScope extends WorkerGlobalScope {\n    DOMException: typeof DOMException;\n    WorkerGlobalScope: typeof WorkerGlobalScope;\n    btoa(data: string): string;\n    atob(data: string): string;\n    setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n    setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearTimeout(timeoutId: number | null): void;\n    setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n    setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearInterval(timeoutId: number | null): void;\n    queueMicrotask(task: Function): void;\n    structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n    reportError(error: any): void;\n    fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\n    self: ServiceWorkerGlobalScope;\n    crypto: Crypto;\n    caches: CacheStorage;\n    scheduler: Scheduler;\n    performance: Performance;\n    Cloudflare: Cloudflare;\n    readonly origin: string;\n    Event: typeof Event;\n    ExtendableEvent: typeof ExtendableEvent;\n    CustomEvent: typeof CustomEvent;\n    PromiseRejectionEvent: typeof PromiseRejectionEvent;\n    FetchEvent: typeof FetchEvent;\n    TailEvent: typeof TailEvent;\n    TraceEvent: typeof TailEvent;\n    ScheduledEvent: typeof ScheduledEvent;\n    MessageEvent: typeof MessageEvent;\n    CloseEvent: typeof CloseEvent;\n    ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;\n    ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;\n    ReadableStream: typeof ReadableStream;\n    WritableStream: typeof WritableStream;\n    WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;\n    TransformStream: typeof TransformStream;\n    ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;\n    CountQueuingStrategy: typeof CountQueuingStrategy;\n    ErrorEvent: typeof ErrorEvent;\n    MessageChannel: typeof MessageChannel;\n    MessagePort: typeof MessagePort;\n    EventSource: typeof EventSource;\n    ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;\n    ReadableStreamDefaultController: typeof ReadableStreamDefaultController;\n    ReadableByteStreamController: typeof ReadableByteStreamController;\n    WritableStreamDefaultController: typeof WritableStreamDefaultController;\n    TransformStreamDefaultController: typeof TransformStreamDefaultController;\n    CompressionStream: typeof CompressionStream;\n    DecompressionStream: typeof DecompressionStream;\n    TextEncoderStream: typeof TextEncoderStream;\n    TextDecoderStream: typeof TextDecoderStream;\n    Headers: typeof Headers;\n    Body: typeof Body;\n    Request: typeof Request;\n    Response: typeof Response;\n    WebSocket: typeof WebSocket;\n    WebSocketPair: typeof WebSocketPair;\n    WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;\n    AbortController: typeof AbortController;\n    AbortSignal: typeof AbortSignal;\n    TextDecoder: typeof TextDecoder;\n    TextEncoder: typeof TextEncoder;\n    navigator: Navigator;\n    Navigator: typeof Navigator;\n    URL: typeof URL;\n    URLSearchParams: typeof URLSearchParams;\n    URLPattern: typeof URLPattern;\n    Blob: typeof Blob;\n    File: typeof File;\n    FormData: typeof FormData;\n    Crypto: typeof Crypto;\n    SubtleCrypto: typeof SubtleCrypto;\n    CryptoKey: typeof CryptoKey;\n    CacheStorage: typeof CacheStorage;\n    Cache: typeof Cache;\n    FixedLengthStream: typeof FixedLengthStream;\n    IdentityTransformStream: typeof IdentityTransformStream;\n    HTMLRewriter: typeof HTMLRewriter;\n}\ndeclare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\ndeclare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n/**\n * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n */\ndeclare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */\ndeclare function btoa(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */\ndeclare function atob(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */\ndeclare function clearTimeout(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */\ndeclare function clearInterval(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */\ndeclare function queueMicrotask(task: Function): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */\ndeclare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */\ndeclare function reportError(error: any): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */\ndeclare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\ndeclare const self: ServiceWorkerGlobalScope;\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare const crypto: Crypto;\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare const caches: CacheStorage;\ndeclare const scheduler: Scheduler;\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare const performance: Performance;\ndeclare const Cloudflare: Cloudflare;\ndeclare const origin: string;\ndeclare const navigator: Navigator;\ninterface TestController {\n}\ninterface ExecutionContext<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    passThroughOnException(): void;\n    readonly props: Props;\n}\ntype ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;\ntype ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\ntype ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ninterface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {\n    fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;\n    tail?: ExportedHandlerTailHandler<Env, Props>;\n    trace?: ExportedHandlerTraceHandler<Env, Props>;\n    tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;\n    scheduled?: ExportedHandlerScheduledHandler<Env, Props>;\n    test?: ExportedHandlerTestHandler<Env, Props>;\n    email?: EmailExportedHandler<Env, Props>;\n    queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;\n}\ninterface StructuredSerializeOptions {\n    transfer?: any[];\n}\ndeclare abstract class Navigator {\n    sendBeacon(url: string, body?: BodyInit): boolean;\n    readonly userAgent: string;\n    readonly hardwareConcurrency: number;\n    readonly language: string;\n    readonly languages: string[];\n}\ninterface AlarmInvocationInfo {\n    readonly isRetry: boolean;\n    readonly retryCount: number;\n}\ninterface Cloudflare {\n    readonly compatibilityFlags: Record<string, boolean>;\n}\ninterface DurableObject {\n    fetch(request: Request): Response | Promise<Response>;\n    alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n    webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n    webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n    webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n}\ntype DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, \"alarm\" | \"webSocketMessage\" | \"webSocketClose\" | \"webSocketError\"> & {\n    readonly id: DurableObjectId;\n    readonly name?: string;\n};\ninterface DurableObjectId {\n    toString(): string;\n    equals(other: DurableObjectId): boolean;\n    readonly name?: string;\n}\ndeclare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {\n    newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;\n    idFromName(name: string): DurableObjectId;\n    idFromString(id: string): DurableObjectId;\n    get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;\n}\ntype DurableObjectJurisdiction = \"eu\" | \"fedramp\" | \"fedramp-high\";\ninterface DurableObjectNamespaceNewUniqueIdOptions {\n    jurisdiction?: DurableObjectJurisdiction;\n}\ntype DurableObjectLocationHint = \"wnam\" | \"enam\" | \"sam\" | \"weur\" | \"eeur\" | \"apac\" | \"oc\" | \"afr\" | \"me\";\ntype DurableObjectRoutingMode = \"primary-only\";\ninterface DurableObjectNamespaceGetDurableObjectOptions {\n    locationHint?: DurableObjectLocationHint;\n    routingMode?: DurableObjectRoutingMode;\n}\ninterface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {\n}\ninterface DurableObjectState<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    readonly props: Props;\n    readonly id: DurableObjectId;\n    readonly storage: DurableObjectStorage;\n    container?: Container;\n    blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;\n    acceptWebSocket(ws: WebSocket, tags?: string[]): void;\n    getWebSockets(tag?: string): WebSocket[];\n    setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;\n    getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;\n    getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;\n    setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;\n    getHibernatableWebSocketEventTimeout(): number | null;\n    getTags(ws: WebSocket): string[];\n    abort(reason?: string): void;\n}\ninterface DurableObjectTransaction {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    rollback(): void;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n}\ninterface DurableObjectStorage {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    deleteAll(options?: DurableObjectPutOptions): Promise<void>;\n    transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n    sync(): Promise<void>;\n    sql: SqlStorage;\n    kv: SyncKvStorage;\n    transactionSync<T>(closure: () => T): T;\n    getCurrentBookmark(): Promise<string>;\n    getBookmarkForTime(timestamp: number | Date): Promise<string>;\n    onNextSessionRestoreBookmark(bookmark: string): Promise<string>;\n}\ninterface DurableObjectListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetOptions {\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetAlarmOptions {\n    allowConcurrency?: boolean;\n}\ninterface DurableObjectPutOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectSetAlarmOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n}\ndeclare class WebSocketRequestResponsePair {\n    constructor(request: string, response: string);\n    get request(): string;\n    get response(): string;\n}\ninterface AnalyticsEngineDataset {\n    writeDataPoint(event?: AnalyticsEngineDataPoint): void;\n}\ninterface AnalyticsEngineDataPoint {\n    indexes?: ((ArrayBuffer | string) | null)[];\n    doubles?: number[];\n    blobs?: ((ArrayBuffer | string) | null)[];\n}\n/**\n * The **`Event`** interface represents an event which takes place on an `EventTarget`.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)\n */\ndeclare class Event {\n    constructor(type: string, init?: EventInit);\n    /**\n     * The **`type`** read-only property of the Event interface returns a string containing the event's type.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)\n     */\n    get type(): string;\n    /**\n     * The **`eventPhase`** read-only property of the being evaluated.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)\n     */\n    get eventPhase(): number;\n    /**\n     * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)\n     */\n    get composed(): boolean;\n    /**\n     * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)\n     */\n    get bubbles(): boolean;\n    /**\n     * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)\n     */\n    get cancelable(): boolean;\n    /**\n     * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)\n     */\n    get defaultPrevented(): boolean;\n    /**\n     * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)\n     */\n    get returnValue(): boolean;\n    /**\n     * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)\n     */\n    get currentTarget(): EventTarget | undefined;\n    /**\n     * The read-only **`target`** property of the dispatched.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)\n     */\n    get target(): EventTarget | undefined;\n    /**\n     * The deprecated **`Event.srcElement`** is an alias for the Event.target property.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)\n     */\n    get srcElement(): EventTarget | undefined;\n    /**\n     * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)\n     */\n    get timeStamp(): number;\n    /**\n     * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)\n     */\n    get isTrusted(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    get cancelBubble(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    set cancelBubble(value: boolean);\n    /**\n     * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)\n     */\n    stopImmediatePropagation(): void;\n    /**\n     * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)\n     */\n    preventDefault(): void;\n    /**\n     * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)\n     */\n    stopPropagation(): void;\n    /**\n     * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)\n     */\n    composedPath(): EventTarget[];\n    static readonly NONE: number;\n    static readonly CAPTURING_PHASE: number;\n    static readonly AT_TARGET: number;\n    static readonly BUBBLING_PHASE: number;\n}\ninterface EventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n}\ntype EventListener<EventType extends Event = Event> = (event: EventType) => void;\ninterface EventListenerObject<EventType extends Event = Event> {\n    handleEvent(event: EventType): void;\n}\ntype EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;\n/**\n * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)\n */\ndeclare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {\n    constructor();\n    /**\n     * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)\n     */\n    addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\n    /**\n     * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)\n     */\n    removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n    /**\n     * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n     */\n    dispatchEvent(event: EventMap[keyof EventMap]): boolean;\n}\ninterface EventTargetEventListenerOptions {\n    capture?: boolean;\n}\ninterface EventTargetAddEventListenerOptions {\n    capture?: boolean;\n    passive?: boolean;\n    once?: boolean;\n    signal?: AbortSignal;\n}\ninterface EventTargetHandlerObject {\n    handleEvent: (event: Event) => any | undefined;\n}\n/**\n * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)\n */\ndeclare class AbortController {\n    constructor();\n    /**\n     * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)\n     */\n    abort(reason?: any): void;\n}\n/**\n * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)\n */\ndeclare abstract class AbortSignal extends EventTarget {\n    /**\n     * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)\n     */\n    static abort(reason?: any): AbortSignal;\n    /**\n     * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)\n     */\n    static timeout(delay: number): AbortSignal;\n    /**\n     * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)\n     */\n    static any(signals: AbortSignal[]): AbortSignal;\n    /**\n     * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)\n     */\n    get aborted(): boolean;\n    /**\n     * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)\n     */\n    get reason(): any;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    get onabort(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    set onabort(value: any | null);\n    /**\n     * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)\n     */\n    throwIfAborted(): void;\n}\ninterface Scheduler {\n    wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;\n}\ninterface SchedulerWaitOptions {\n    signal?: AbortSignal;\n}\n/**\n * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)\n */\ndeclare abstract class ExtendableEvent extends Event {\n    /**\n     * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)\n     */\n    waitUntil(promise: Promise<any>): void;\n}\n/**\n * The **`CustomEvent`** interface represents events initialized by an application for any purpose.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)\n */\ndeclare class CustomEvent<T = any> extends Event {\n    constructor(type: string, init?: CustomEventCustomEventInit);\n    /**\n     * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)\n     */\n    get detail(): T;\n}\ninterface CustomEventCustomEventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n    detail?: any;\n}\n/**\n * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)\n */\ndeclare class Blob {\n    constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);\n    /**\n     * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)\n     */\n    get size(): number;\n    /**\n     * The **`type`** read-only property of the Blob interface returns the MIME type of the file.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)\n     */\n    get type(): string;\n    /**\n     * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)\n     */\n    slice(start?: number, end?: number, type?: string): Blob;\n    /**\n     * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)\n     */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /**\n     * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)\n     */\n    bytes(): Promise<Uint8Array>;\n    /**\n     * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)\n     */\n    text(): Promise<string>;\n    /**\n     * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)\n     */\n    stream(): ReadableStream;\n}\ninterface BlobOptions {\n    type?: string;\n}\n/**\n * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)\n */\ndeclare class File extends Blob {\n    constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);\n    /**\n     * The **`name`** read-only property of the File interface returns the name of the file represented by a File object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)\n     */\n    get name(): string;\n    /**\n     * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)\n     */\n    get lastModified(): number;\n}\ninterface FileOptions {\n    type?: string;\n    lastModified?: number;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class CacheStorage {\n    /**\n     * The **`open()`** method of the the Cache object matching the `cacheName`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)\n     */\n    open(cacheName: string): Promise<Cache>;\n    readonly default: Cache;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class Cache {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */\n    delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */\n    match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */\n    put(request: RequestInfo | URL, response: Response): Promise<void>;\n}\ninterface CacheQueryOptions {\n    ignoreMethod?: boolean;\n}\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare abstract class Crypto {\n    /**\n     * The **`Crypto.subtle`** read-only property returns a cryptographic operations.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)\n     */\n    get subtle(): SubtleCrypto;\n    /**\n     * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)\n     */\n    getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;\n    /**\n     * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)\n     */\n    randomUUID(): string;\n    DigestStream: typeof DigestStream;\n}\n/**\n * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)\n */\ndeclare abstract class SubtleCrypto {\n    /**\n     * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)\n     */\n    encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)\n     */\n    decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)\n     */\n    sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)\n     */\n    verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;\n    /**\n     * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)\n     */\n    digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)\n     */\n    generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;\n    /**\n     * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)\n     */\n    deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`deriveBits()`** method of the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)\n     */\n    deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;\n    /**\n     * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)\n     */\n    importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)\n     */\n    exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;\n    /**\n     * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)\n     */\n    wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;\n    /**\n     * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)\n     */\n    unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;\n}\n/**\n * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)\n */\ndeclare abstract class CryptoKey {\n    /**\n     * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)\n     */\n    readonly type: string;\n    /**\n     * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)\n     */\n    readonly extractable: boolean;\n    /**\n     * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)\n     */\n    readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;\n    /**\n     * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)\n     */\n    readonly usages: string[];\n}\ninterface CryptoKeyPair {\n    publicKey: CryptoKey;\n    privateKey: CryptoKey;\n}\ninterface JsonWebKey {\n    kty: string;\n    use?: string;\n    key_ops?: string[];\n    alg?: string;\n    ext?: boolean;\n    crv?: string;\n    x?: string;\n    y?: string;\n    d?: string;\n    n?: string;\n    e?: string;\n    p?: string;\n    q?: string;\n    dp?: string;\n    dq?: string;\n    qi?: string;\n    oth?: RsaOtherPrimesInfo[];\n    k?: string;\n}\ninterface RsaOtherPrimesInfo {\n    r?: string;\n    d?: string;\n    t?: string;\n}\ninterface SubtleCryptoDeriveKeyAlgorithm {\n    name: string;\n    salt?: (ArrayBuffer | ArrayBufferView);\n    iterations?: number;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    $public?: CryptoKey;\n    info?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoEncryptAlgorithm {\n    name: string;\n    iv?: (ArrayBuffer | ArrayBufferView);\n    additionalData?: (ArrayBuffer | ArrayBufferView);\n    tagLength?: number;\n    counter?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    label?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoGenerateKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    modulusLength?: number;\n    publicExponent?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    namedCurve?: string;\n}\ninterface SubtleCryptoHashAlgorithm {\n    name: string;\n}\ninterface SubtleCryptoImportKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    length?: number;\n    namedCurve?: string;\n    compressed?: boolean;\n}\ninterface SubtleCryptoSignAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    dataLength?: number;\n    saltLength?: number;\n}\ninterface CryptoKeyKeyAlgorithm {\n    name: string;\n}\ninterface CryptoKeyAesKeyAlgorithm {\n    name: string;\n    length: number;\n}\ninterface CryptoKeyHmacKeyAlgorithm {\n    name: string;\n    hash: CryptoKeyKeyAlgorithm;\n    length: number;\n}\ninterface CryptoKeyRsaKeyAlgorithm {\n    name: string;\n    modulusLength: number;\n    publicExponent: ArrayBuffer | ArrayBufferView;\n    hash?: CryptoKeyKeyAlgorithm;\n}\ninterface CryptoKeyEllipticKeyAlgorithm {\n    name: string;\n    namedCurve: string;\n}\ninterface CryptoKeyArbitraryKeyAlgorithm {\n    name: string;\n    hash?: CryptoKeyKeyAlgorithm;\n    namedCurve?: string;\n    length?: number;\n}\ndeclare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {\n    constructor(algorithm: string | SubtleCryptoHashAlgorithm);\n    readonly digest: Promise<ArrayBuffer>;\n    get bytesWritten(): number | bigint;\n}\n/**\n * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)\n */\ndeclare class TextDecoder {\n    constructor(label?: string, options?: TextDecoderConstructorOptions);\n    /**\n     * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)\n     */\n    decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\n/**\n * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)\n */\ndeclare class TextEncoder {\n    constructor();\n    /**\n     * The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)\n     */\n    encode(input?: string): Uint8Array;\n    /**\n     * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)\n     */\n    encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;\n    get encoding(): string;\n}\ninterface TextDecoderConstructorOptions {\n    fatal: boolean;\n    ignoreBOM: boolean;\n}\ninterface TextDecoderDecodeOptions {\n    stream: boolean;\n}\ninterface TextEncoderEncodeIntoResult {\n    read: number;\n    written: number;\n}\n/**\n * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)\n */\ndeclare class ErrorEvent extends Event {\n    constructor(type: string, init?: ErrorEventErrorEventInit);\n    /**\n     * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)\n     */\n    get filename(): string;\n    /**\n     * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)\n     */\n    get message(): string;\n    /**\n     * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)\n     */\n    get lineno(): number;\n    /**\n     * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)\n     */\n    get colno(): number;\n    /**\n     * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)\n     */\n    get error(): any;\n}\ninterface ErrorEventErrorEventInit {\n    message?: string;\n    filename?: string;\n    lineno?: number;\n    colno?: number;\n    error?: any;\n}\n/**\n * The **`MessageEvent`** interface represents a message received by a target object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)\n */\ndeclare class MessageEvent extends Event {\n    constructor(type: string, initializer: MessageEventInit);\n    /**\n     * The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)\n     */\n    readonly data: any;\n    /**\n     * The **`origin`** read-only property of the origin of the message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)\n     */\n    readonly origin: string | null;\n    /**\n     * The **`lastEventId`** read-only property of the unique ID for the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)\n     */\n    readonly lastEventId: string;\n    /**\n     * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)\n     */\n    readonly source: MessagePort | null;\n    /**\n     * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)\n     */\n    readonly ports: MessagePort[];\n}\ninterface MessageEventInit {\n    data: ArrayBuffer | string;\n}\n/**\n * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)\n */\ndeclare abstract class PromiseRejectionEvent extends Event {\n    /**\n     * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)\n     */\n    readonly promise: Promise<any>;\n    /**\n     * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)\n     */\n    readonly reason: any;\n}\n/**\n * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)\n */\ndeclare class FormData {\n    constructor();\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string | Blob): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: Blob, filename?: string): void;\n    /**\n     * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)\n     */\n    delete(name: string): void;\n    /**\n     * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)\n     */\n    get(name: string): (File | string) | null;\n    /**\n     * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)\n     */\n    getAll(name: string): (File | string)[];\n    /**\n     * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string | Blob): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: Blob, filename?: string): void;\n    /* Returns an array of key, value pairs for every entry in the list. */\n    entries(): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n    /* Returns a list of keys in the list. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the list. */\n    values(): IterableIterator<(File | string)>;\n    forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n}\ninterface ContentOptions {\n    html?: boolean;\n}\ndeclare class HTMLRewriter {\n    constructor();\n    on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;\n    onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;\n    transform(response: Response): Response;\n}\ninterface HTMLRewriterElementContentHandlers {\n    element?(element: Element): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(element: Text): void | Promise<void>;\n}\ninterface HTMLRewriterDocumentContentHandlers {\n    doctype?(doctype: Doctype): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(text: Text): void | Promise<void>;\n    end?(end: DocumentEnd): void | Promise<void>;\n}\ninterface Doctype {\n    readonly name: string | null;\n    readonly publicId: string | null;\n    readonly systemId: string | null;\n}\ninterface Element {\n    tagName: string;\n    readonly attributes: IterableIterator<string[]>;\n    readonly removed: boolean;\n    readonly namespaceURI: string;\n    getAttribute(name: string): string | null;\n    hasAttribute(name: string): boolean;\n    setAttribute(name: string, value: string): Element;\n    removeAttribute(name: string): Element;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    append(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    remove(): Element;\n    removeAndKeepContent(): Element;\n    setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;\n}\ninterface EndTag {\n    name: string;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    remove(): EndTag;\n}\ninterface Comment {\n    text: string;\n    readonly removed: boolean;\n    before(content: string, options?: ContentOptions): Comment;\n    after(content: string, options?: ContentOptions): Comment;\n    replace(content: string, options?: ContentOptions): Comment;\n    remove(): Comment;\n}\ninterface Text {\n    readonly text: string;\n    readonly lastInTextNode: boolean;\n    readonly removed: boolean;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    remove(): Text;\n}\ninterface DocumentEnd {\n    append(content: string, options?: ContentOptions): DocumentEnd;\n}\n/**\n * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)\n */\ndeclare abstract class FetchEvent extends ExtendableEvent {\n    /**\n     * The **`request`** read-only property of the the event handler.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)\n     */\n    readonly request: Request;\n    /**\n     * The **`respondWith()`** method of allows you to provide a promise for a Response yourself.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)\n     */\n    respondWith(promise: Response | Promise<Response>): void;\n    passThroughOnException(): void;\n}\ntype HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;\n/**\n * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)\n */\ndeclare class Headers {\n    constructor(init?: HeadersInit);\n    /**\n     * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)\n     */\n    get(name: string): string | null;\n    getAll(name: string): string[];\n    /**\n     * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)\n     */\n    getSetCookie(): string[];\n    /**\n     * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)\n     */\n    delete(name: string): void;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;\n    /* Returns an iterator allowing to go through all key/value pairs contained in this object. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */\n    keys(): IterableIterator<string>;\n    /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */\n    values(): IterableIterator<string>;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ntype BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;\ndeclare abstract class Body {\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */\n    get body(): ReadableStream | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */\n    get bodyUsed(): boolean;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */\n    bytes(): Promise<Uint8Array>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */\n    text(): Promise<string>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */\n    json<T>(): Promise<T>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */\n    formData(): Promise<FormData>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */\n    blob(): Promise<Blob>;\n}\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ndeclare var Response: {\n    prototype: Response;\n    new (body?: BodyInit | null, init?: ResponseInit): Response;\n    error(): Response;\n    redirect(url: string, status?: number): Response;\n    json(any: any, maybeInit?: (ResponseInit | Response)): Response;\n};\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ninterface Response extends Body {\n    /**\n     * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)\n     */\n    clone(): Response;\n    /**\n     * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)\n     */\n    status: number;\n    /**\n     * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)\n     */\n    statusText: string;\n    /**\n     * The **`headers`** read-only property of the with the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)\n     */\n    ok: boolean;\n    /**\n     * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)\n     */\n    redirected: boolean;\n    /**\n     * The **`url`** read-only property of the Response interface contains the URL of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)\n     */\n    url: string;\n    webSocket: WebSocket | null;\n    cf: any | undefined;\n    /**\n     * The **`type`** read-only property of the Response interface contains the type of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)\n     */\n    type: \"default\" | \"error\";\n}\ninterface ResponseInit {\n    status?: number;\n    statusText?: string;\n    headers?: HeadersInit;\n    cf?: any;\n    webSocket?: (WebSocket | null);\n    encodeBody?: \"automatic\" | \"manual\";\n}\ntype RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ndeclare var Request: {\n    prototype: Request;\n    new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;\n};\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ninterface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {\n    /**\n     * The **`clone()`** method of the Request interface creates a copy of the current `Request` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)\n     */\n    clone(): Request<CfHostMetadata, Cf>;\n    /**\n     * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)\n     */\n    method: string;\n    /**\n     * The **`url`** read-only property of the Request interface contains the URL of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)\n     */\n    url: string;\n    /**\n     * The **`headers`** read-only property of the with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)\n     */\n    redirect: string;\n    fetcher: Fetcher | null;\n    /**\n     * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)\n     */\n    signal: AbortSignal;\n    cf?: Cf;\n    /**\n     * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)\n     */\n    integrity: string;\n    /**\n     * The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)\n     */\n    keepalive: boolean;\n    /**\n     * The **`cache`** read-only property of the Request interface contains the cache mode of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)\n     */\n    cache?: \"no-store\" | \"no-cache\";\n}\ninterface RequestInit<Cf = CfProperties> {\n    /* A string to set request's method. */\n    method?: string;\n    /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */\n    headers?: HeadersInit;\n    /* A BodyInit object or null to set request's body. */\n    body?: BodyInit | null;\n    /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */\n    redirect?: string;\n    fetcher?: (Fetcher | null);\n    cf?: Cf;\n    /* A string indicating how the request will interact with the browser's cache to set request's cache. */\n    cache?: \"no-store\" | \"no-cache\";\n    /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */\n    integrity?: string;\n    /* An AbortSignal to set request's signal. */\n    signal?: (AbortSignal | null);\n    encodeResponseBody?: \"automatic\" | \"manual\";\n}\ntype Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;\ntype Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | \"fetch\" | \"connect\"> : unknown) & {\n    fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;\n    connect(address: SocketAddress | string, options?: SocketOptions): Socket;\n};\ninterface KVNamespaceListKey<Metadata, Key extends string = string> {\n    name: Key;\n    expiration?: number;\n    metadata?: Metadata;\n}\ntype KVNamespaceListResult<Metadata, Key extends string = string> = {\n    list_complete: false;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cursor: string;\n    cacheStatus: string | null;\n} | {\n    list_complete: true;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cacheStatus: string | null;\n};\ninterface KVNamespace<Key extends string = string> {\n    get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;\n    get(key: Key, type: \"text\"): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, type: \"json\"): Promise<ExpectedValue | null>;\n    get(key: Key, type: \"arrayBuffer\"): Promise<ArrayBuffer | null>;\n    get(key: Key, type: \"stream\"): Promise<ReadableStream | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"text\">): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<\"json\">): Promise<ExpectedValue | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<ArrayBuffer | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"stream\">): Promise<ReadableStream | null>;\n    get(key: Array<Key>, type: \"text\"): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, ExpectedValue | null>>;\n    get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;\n    get(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, ExpectedValue | null>>;\n    list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;\n    put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;\n    getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"text\"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: \"json\"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"arrayBuffer\"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"stream\"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"text\">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"json\">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"stream\">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, type: \"text\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    delete(key: Key): Promise<void>;\n}\ninterface KVNamespaceListOptions {\n    limit?: number;\n    prefix?: (string | null);\n    cursor?: (string | null);\n}\ninterface KVNamespaceGetOptions<Type> {\n    type: Type;\n    cacheTtl?: number;\n}\ninterface KVNamespacePutOptions {\n    expiration?: number;\n    expirationTtl?: number;\n    metadata?: (any | null);\n}\ninterface KVNamespaceGetWithMetadataResult<Value, Metadata> {\n    value: Value | null;\n    metadata: Metadata | null;\n    cacheStatus: string | null;\n}\ntype QueueContentType = \"text\" | \"bytes\" | \"json\" | \"v8\";\ninterface Queue<Body = unknown> {\n    send(message: Body, options?: QueueSendOptions): Promise<void>;\n    sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>;\n}\ninterface QueueSendOptions {\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueSendBatchOptions {\n    delaySeconds?: number;\n}\ninterface MessageSendRequest<Body = unknown> {\n    body: Body;\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueRetryOptions {\n    delaySeconds?: number;\n}\ninterface Message<Body = unknown> {\n    readonly id: string;\n    readonly timestamp: Date;\n    readonly body: Body;\n    readonly attempts: number;\n    retry(options?: QueueRetryOptions): void;\n    ack(): void;\n}\ninterface QueueEvent<Body = unknown> extends ExtendableEvent {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface MessageBatch<Body = unknown> {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface R2Error extends Error {\n    readonly name: string;\n    readonly code: number;\n    readonly message: string;\n    readonly action: string;\n    readonly stack: any;\n}\ninterface R2ListOptions {\n    limit?: number;\n    prefix?: string;\n    cursor?: string;\n    delimiter?: string;\n    startAfter?: string;\n    include?: (\"httpMetadata\" | \"customMetadata\")[];\n}\ndeclare abstract class R2Bucket {\n    head(key: string): Promise<R2Object | null>;\n    get(key: string, options: R2GetOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2ObjectBody | R2Object | null>;\n    get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2Object | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;\n    createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;\n    resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;\n    delete(keys: string | string[]): Promise<void>;\n    list(options?: R2ListOptions): Promise<R2Objects>;\n}\ninterface R2MultipartUpload {\n    readonly key: string;\n    readonly uploadId: string;\n    uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;\n    abort(): Promise<void>;\n    complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;\n}\ninterface R2UploadedPart {\n    partNumber: number;\n    etag: string;\n}\ndeclare abstract class R2Object {\n    readonly key: string;\n    readonly version: string;\n    readonly size: number;\n    readonly etag: string;\n    readonly httpEtag: string;\n    readonly checksums: R2Checksums;\n    readonly uploaded: Date;\n    readonly httpMetadata?: R2HTTPMetadata;\n    readonly customMetadata?: Record<string, string>;\n    readonly range?: R2Range;\n    readonly storageClass: string;\n    readonly ssecKeyMd5?: string;\n    writeHttpMetadata(headers: Headers): void;\n}\ninterface R2ObjectBody extends R2Object {\n    get body(): ReadableStream;\n    get bodyUsed(): boolean;\n    arrayBuffer(): Promise<ArrayBuffer>;\n    bytes(): Promise<Uint8Array>;\n    text(): Promise<string>;\n    json<T>(): Promise<T>;\n    blob(): Promise<Blob>;\n}\ntype R2Range = {\n    offset: number;\n    length?: number;\n} | {\n    offset?: number;\n    length: number;\n} | {\n    suffix: number;\n};\ninterface R2Conditional {\n    etagMatches?: string;\n    etagDoesNotMatch?: string;\n    uploadedBefore?: Date;\n    uploadedAfter?: Date;\n    secondsGranularity?: boolean;\n}\ninterface R2GetOptions {\n    onlyIf?: (R2Conditional | Headers);\n    range?: (R2Range | Headers);\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2PutOptions {\n    onlyIf?: (R2Conditional | Headers);\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    md5?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha1?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha256?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha384?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha512?: ((ArrayBuffer | ArrayBufferView) | string);\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2MultipartOptions {\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2Checksums {\n    readonly md5?: ArrayBuffer;\n    readonly sha1?: ArrayBuffer;\n    readonly sha256?: ArrayBuffer;\n    readonly sha384?: ArrayBuffer;\n    readonly sha512?: ArrayBuffer;\n    toJSON(): R2StringChecksums;\n}\ninterface R2StringChecksums {\n    md5?: string;\n    sha1?: string;\n    sha256?: string;\n    sha384?: string;\n    sha512?: string;\n}\ninterface R2HTTPMetadata {\n    contentType?: string;\n    contentLanguage?: string;\n    contentDisposition?: string;\n    contentEncoding?: string;\n    cacheControl?: string;\n    cacheExpiry?: Date;\n}\ntype R2Objects = {\n    objects: R2Object[];\n    delimitedPrefixes: string[];\n} & ({\n    truncated: true;\n    cursor: string;\n} | {\n    truncated: false;\n});\ninterface R2UploadPartOptions {\n    ssecKey?: (ArrayBuffer | string);\n}\ndeclare abstract class ScheduledEvent extends ExtendableEvent {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface ScheduledController {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface QueuingStrategy<T = any> {\n    highWaterMark?: (number | bigint);\n    size?: (chunk: T) => number | bigint;\n}\ninterface UnderlyingSink<W = any> {\n    type?: string;\n    start?: (controller: WritableStreamDefaultController) => void | Promise<void>;\n    write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;\n    abort?: (reason: any) => void | Promise<void>;\n    close?: () => void | Promise<void>;\n}\ninterface UnderlyingByteSource {\n    type: \"bytes\";\n    autoAllocateChunkSize?: number;\n    start?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    pull?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n}\ninterface UnderlyingSource<R = any> {\n    type?: \"\" | undefined;\n    start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: (number | bigint);\n}\ninterface Transformer<I = any, O = any> {\n    readableType?: string;\n    writableType?: string;\n    start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: number;\n}\ninterface StreamPipeOptions {\n    preventAbort?: boolean;\n    preventCancel?: boolean;\n    /**\n     * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     *\n     * Errors and closures of the source and destination streams propagate as follows:\n     *\n     * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.\n     *\n     * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.\n     *\n     * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.\n     *\n     * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.\n     *\n     * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.\n     */\n    preventClose?: boolean;\n    signal?: AbortSignal;\n}\ntype ReadableStreamReadResult<R = any> = {\n    done: false;\n    value: R;\n} | {\n    done: true;\n    value?: undefined;\n};\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ninterface ReadableStream<R = any> {\n    /**\n     * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)\n     */\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(): ReadableStreamDefaultReader<R>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;\n    /**\n     * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)\n     */\n    pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;\n    /**\n     * The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)\n     */\n    pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;\n    /**\n     * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)\n     */\n    tee(): [\n        ReadableStream<R>,\n        ReadableStream<R>\n    ];\n    values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n    [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n}\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ndeclare const ReadableStream: {\n    prototype: ReadableStream;\n    new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;\n    new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;\n};\n/**\n * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)\n */\ndeclare class ReadableStreamDefaultReader<R = any> {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)\n     */\n    read(): Promise<ReadableStreamReadResult<R>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)\n */\ndeclare class ReadableStreamBYOBReader {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)\n     */\n    read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)\n     */\n    releaseLock(): void;\n    readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;\n}\ninterface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {\n    min?: number;\n}\ninterface ReadableStreamGetReaderOptions {\n    /**\n     * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.\n     *\n     * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.\n     */\n    mode: \"byob\";\n}\n/**\n * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)\n */\ndeclare abstract class ReadableStreamBYOBRequest {\n    /**\n     * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)\n     */\n    get view(): Uint8Array | null;\n    /**\n     * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)\n     */\n    respond(bytesWritten: number): void;\n    /**\n     * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)\n     */\n    respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;\n    get atLeast(): number | null;\n}\n/**\n * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)\n */\ndeclare abstract class ReadableStreamDefaultController<R = any> {\n    /**\n     * The **`desiredSize`** read-only property of the required to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: R): void;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)\n */\ndeclare abstract class ReadableByteStreamController {\n    /**\n     * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)\n     */\n    get byobRequest(): ReadableStreamBYOBRequest | null;\n    /**\n     * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)\n     */\n    enqueue(chunk: ArrayBuffer | ArrayBufferView): void;\n    /**\n     * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)\n */\ndeclare abstract class WritableStreamDefaultController {\n    /**\n     * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)\n     */\n    error(reason?: any): void;\n}\n/**\n * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)\n */\ndeclare abstract class TransformStreamDefaultController<O = any> {\n    /**\n     * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: O): void;\n    /**\n     * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)\n     */\n    error(reason: any): void;\n    /**\n     * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)\n     */\n    terminate(): void;\n}\ninterface ReadableWritablePair<R = any, W = any> {\n    readable: ReadableStream<R>;\n    /**\n     * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     */\n    writable: WritableStream<W>;\n}\n/**\n * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)\n */\ndeclare class WritableStream<W = any> {\n    constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);\n    /**\n     * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the WritableStream interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)\n     */\n    getWriter(): WritableStreamDefaultWriter<W>;\n}\n/**\n * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)\n */\ndeclare class WritableStreamDefaultWriter<W = any> {\n    constructor(stream: WritableStream);\n    /**\n     * The **`closed`** read-only property of the the stream errors or the writer's lock is released.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)\n     */\n    get closed(): Promise<void>;\n    /**\n     * The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)\n     */\n    get ready(): Promise<void>;\n    /**\n     * The **`desiredSize`** read-only property of the to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`write()`** method of the operation.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)\n     */\n    write(chunk?: W): Promise<void>;\n    /**\n     * The **`releaseLock()`** method of the corresponding stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)\n */\ndeclare class TransformStream<I = any, O = any> {\n    constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);\n    /**\n     * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)\n     */\n    get readable(): ReadableStream<O>;\n    /**\n     * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)\n     */\n    get writable(): WritableStream<I>;\n}\ndeclare class FixedLengthStream extends IdentityTransformStream {\n    constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ndeclare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ninterface IdentityTransformStreamQueuingStrategy {\n    highWaterMark?: (number | bigint);\n}\ninterface ReadableStreamValuesOptions {\n    preventCancel?: boolean;\n}\n/**\n * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)\n */\ndeclare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)\n */\ndeclare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)\n */\ndeclare class TextEncoderStream extends TransformStream<string, Uint8Array> {\n    constructor();\n    get encoding(): string;\n}\n/**\n * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)\n */\ndeclare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {\n    constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\ninterface TextDecoderStreamTextDecoderStreamInit {\n    fatal?: boolean;\n    ignoreBOM?: boolean;\n}\n/**\n * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)\n */\ndeclare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\n/**\n * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)\n */\ndeclare class CountQueuingStrategy implements QueuingStrategy {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\ninterface QueuingStrategyInit {\n    /**\n     * Creates a new ByteLengthQueuingStrategy with the provided high water mark.\n     *\n     * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.\n     */\n    highWaterMark: number;\n}\ninterface ScriptVersion {\n    id?: string;\n    tag?: string;\n    message?: string;\n}\ndeclare abstract class TailEvent extends ExtendableEvent {\n    readonly events: TraceItem[];\n    readonly traces: TraceItem[];\n}\ninterface TraceItem {\n    readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;\n    readonly eventTimestamp: number | null;\n    readonly logs: TraceLog[];\n    readonly exceptions: TraceException[];\n    readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];\n    readonly scriptName: string | null;\n    readonly entrypoint?: string;\n    readonly scriptVersion?: ScriptVersion;\n    readonly dispatchNamespace?: string;\n    readonly scriptTags?: string[];\n    readonly durableObjectId?: string;\n    readonly outcome: string;\n    readonly executionModel: string;\n    readonly truncated: boolean;\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface TraceItemAlarmEventInfo {\n    readonly scheduledTime: Date;\n}\ninterface TraceItemCustomEventInfo {\n}\ninterface TraceItemScheduledEventInfo {\n    readonly scheduledTime: number;\n    readonly cron: string;\n}\ninterface TraceItemQueueEventInfo {\n    readonly queue: string;\n    readonly batchSize: number;\n}\ninterface TraceItemEmailEventInfo {\n    readonly mailFrom: string;\n    readonly rcptTo: string;\n    readonly rawSize: number;\n}\ninterface TraceItemTailEventInfo {\n    readonly consumedEvents: TraceItemTailEventInfoTailItem[];\n}\ninterface TraceItemTailEventInfoTailItem {\n    readonly scriptName: string | null;\n}\ninterface TraceItemFetchEventInfo {\n    readonly response?: TraceItemFetchEventInfoResponse;\n    readonly request: TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoRequest {\n    readonly cf?: any;\n    readonly headers: Record<string, string>;\n    readonly method: string;\n    readonly url: string;\n    getUnredacted(): TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoResponse {\n    readonly status: number;\n}\ninterface TraceItemJsRpcEventInfo {\n    readonly rpcMethod: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfo {\n    readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;\n}\ninterface TraceItemHibernatableWebSocketEventInfoMessage {\n    readonly webSocketEventType: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfoClose {\n    readonly webSocketEventType: string;\n    readonly code: number;\n    readonly wasClean: boolean;\n}\ninterface TraceItemHibernatableWebSocketEventInfoError {\n    readonly webSocketEventType: string;\n}\ninterface TraceLog {\n    readonly timestamp: number;\n    readonly level: string;\n    readonly message: any;\n}\ninterface TraceException {\n    readonly timestamp: number;\n    readonly message: string;\n    readonly name: string;\n    readonly stack?: string;\n}\ninterface TraceDiagnosticChannelEvent {\n    readonly timestamp: number;\n    readonly channel: string;\n    readonly message: any;\n}\ninterface TraceMetrics {\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface UnsafeTraceMetrics {\n    fromTrace(item: TraceItem): TraceMetrics;\n}\n/**\n * The **`URL`** interface is used to parse, construct, normalize, and encode URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)\n */\ndeclare class URL {\n    constructor(url: string | URL, base?: string | URL);\n    /**\n     * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)\n     */\n    get origin(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    get href(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    set href(value: string);\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    get protocol(): string;\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    set protocol(value: string);\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    get username(): string;\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    set username(value: string);\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    get password(): string;\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    set password(value: string);\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    get host(): string;\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    set host(value: string);\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    get hostname(): string;\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    set hostname(value: string);\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    get port(): string;\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    set port(value: string);\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    get pathname(): string;\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    set pathname(value: string);\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    get search(): string;\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    set search(value: string);\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    get hash(): string;\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    set hash(value: string);\n    /**\n     * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)\n     */\n    get searchParams(): URLSearchParams;\n    /**\n     * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)\n     */\n    toJSON(): string;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    /**\n     * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)\n     */\n    static canParse(url: string, base?: string): boolean;\n    /**\n     * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)\n     */\n    static parse(url: string, base?: string): URL | null;\n    /**\n     * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)\n     */\n    static createObjectURL(object: File | Blob): string;\n    /**\n     * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)\n     */\n    static revokeObjectURL(object_url: string): void;\n}\n/**\n * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)\n */\ndeclare class URLSearchParams {\n    constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));\n    /**\n     * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)\n     */\n    get size(): number;\n    /**\n     * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)\n     */\n    delete(name: string, value?: string): void;\n    /**\n     * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)\n     */\n    get(name: string): string | null;\n    /**\n     * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)\n     */\n    getAll(name: string): string[];\n    /**\n     * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)\n     */\n    has(name: string, value?: string): boolean;\n    /**\n     * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)\n     */\n    sort(): void;\n    /* Returns an array of key, value pairs for every entry in the search params. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns a list of keys in the search params. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the search params. */\n    values(): IterableIterator<string>;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ndeclare class URLPattern {\n    constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);\n    get protocol(): string;\n    get username(): string;\n    get password(): string;\n    get hostname(): string;\n    get port(): string;\n    get pathname(): string;\n    get search(): string;\n    get hash(): string;\n    get hasRegExpGroups(): boolean;\n    test(input?: (string | URLPatternInit), baseURL?: string): boolean;\n    exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;\n}\ninterface URLPatternInit {\n    protocol?: string;\n    username?: string;\n    password?: string;\n    hostname?: string;\n    port?: string;\n    pathname?: string;\n    search?: string;\n    hash?: string;\n    baseURL?: string;\n}\ninterface URLPatternComponentResult {\n    input: string;\n    groups: Record<string, string>;\n}\ninterface URLPatternResult {\n    inputs: (string | URLPatternInit)[];\n    protocol: URLPatternComponentResult;\n    username: URLPatternComponentResult;\n    password: URLPatternComponentResult;\n    hostname: URLPatternComponentResult;\n    port: URLPatternComponentResult;\n    pathname: URLPatternComponentResult;\n    search: URLPatternComponentResult;\n    hash: URLPatternComponentResult;\n}\ninterface URLPatternOptions {\n    ignoreCase?: boolean;\n}\n/**\n * A `CloseEvent` is sent to clients using WebSockets when the connection is closed.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)\n */\ndeclare class CloseEvent extends Event {\n    constructor(type: string, initializer?: CloseEventInit);\n    /**\n     * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)\n     */\n    readonly code: number;\n    /**\n     * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)\n     */\n    readonly reason: string;\n    /**\n     * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)\n     */\n    readonly wasClean: boolean;\n}\ninterface CloseEventInit {\n    code?: number;\n    reason?: string;\n    wasClean?: boolean;\n}\ntype WebSocketEventMap = {\n    close: CloseEvent;\n    message: MessageEvent;\n    open: Event;\n    error: ErrorEvent;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ndeclare var WebSocket: {\n    prototype: WebSocket;\n    new (url: string, protocols?: (string[] | string)): WebSocket;\n    readonly READY_STATE_CONNECTING: number;\n    readonly CONNECTING: number;\n    readonly READY_STATE_OPEN: number;\n    readonly OPEN: number;\n    readonly READY_STATE_CLOSING: number;\n    readonly CLOSING: number;\n    readonly READY_STATE_CLOSED: number;\n    readonly CLOSED: number;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ninterface WebSocket extends EventTarget<WebSocketEventMap> {\n    accept(options?: WebSocketAcceptOptions): void;\n    /**\n     * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)\n     */\n    send(message: (ArrayBuffer | ArrayBufferView) | string): void;\n    /**\n     * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)\n     */\n    close(code?: number, reason?: string): void;\n    serializeAttachment(attachment: any): void;\n    deserializeAttachment(): any | null;\n    /**\n     * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)\n     */\n    readyState: number;\n    /**\n     * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)\n     */\n    url: string | null;\n    /**\n     * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)\n     */\n    protocol: string | null;\n    /**\n     * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)\n     */\n    extensions: string | null;\n    /**\n     * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)\n     */\n    binaryType: \"blob\" | \"arraybuffer\";\n}\ninterface WebSocketAcceptOptions {\n    /**\n     * When set to `true`, receiving a server-initiated WebSocket Close frame will not\n     * automatically send a reciprocal Close frame, leaving the connection in a half-open\n     * state. This is useful for proxying scenarios where you need to coordinate closing\n     * both sides independently. Defaults to `false` when the\n     * `no_web_socket_half_open_by_default` compatibility flag is enabled.\n     */\n    allowHalfOpen?: boolean;\n}\ndeclare const WebSocketPair: {\n    new (): {\n        0: WebSocket;\n        1: WebSocket;\n    };\n};\ninterface SqlStorage {\n    exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;\n    get databaseSize(): number;\n    Cursor: typeof SqlStorageCursor;\n    Statement: typeof SqlStorageStatement;\n}\ndeclare abstract class SqlStorageStatement {\n}\ntype SqlStorageValue = ArrayBuffer | string | number | null;\ndeclare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {\n    next(): {\n        done?: false;\n        value: T;\n    } | {\n        done: true;\n        value?: never;\n    };\n    toArray(): T[];\n    one(): T;\n    raw<U extends SqlStorageValue[]>(): IterableIterator<U>;\n    columnNames: string[];\n    get rowsRead(): number;\n    get rowsWritten(): number;\n    [Symbol.iterator](): IterableIterator<T>;\n}\ninterface Socket {\n    get readable(): ReadableStream;\n    get writable(): WritableStream;\n    get closed(): Promise<void>;\n    get opened(): Promise<SocketInfo>;\n    get upgraded(): boolean;\n    get secureTransport(): \"on\" | \"off\" | \"starttls\";\n    close(): Promise<void>;\n    startTls(options?: TlsOptions): Socket;\n}\ninterface SocketOptions {\n    secureTransport?: string;\n    allowHalfOpen: boolean;\n    highWaterMark?: (number | bigint);\n}\ninterface SocketAddress {\n    hostname: string;\n    port: number;\n}\ninterface TlsOptions {\n    expectedServerHostname?: string;\n}\ninterface SocketInfo {\n    remoteAddress?: string;\n    localAddress?: string;\n}\n/**\n * The **`EventSource`** interface is web content's interface to server-sent events.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)\n */\ndeclare class EventSource extends EventTarget {\n    constructor(url: string, init?: EventSourceEventSourceInit);\n    /**\n     * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)\n     */\n    close(): void;\n    /**\n     * The **`url`** read-only property of the URL of the source.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)\n     */\n    get url(): string;\n    /**\n     * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)\n     */\n    get withCredentials(): boolean;\n    /**\n     * The **`readyState`** read-only property of the connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)\n     */\n    get readyState(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    get onopen(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    set onopen(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    get onmessage(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    set onmessage(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    get onerror(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    set onerror(value: any | null);\n    static readonly CONNECTING: number;\n    static readonly OPEN: number;\n    static readonly CLOSED: number;\n    static from(stream: ReadableStream): EventSource;\n}\ninterface EventSourceEventSourceInit {\n    withCredentials?: boolean;\n    fetcher?: Fetcher;\n}\ninterface Container {\n    get running(): boolean;\n    start(options?: ContainerStartupOptions): void;\n    monitor(): Promise<void>;\n    destroy(error?: any): Promise<void>;\n    signal(signo: number): void;\n    getTcpPort(port: number): Fetcher;\n    setInactivityTimeout(durationMs: number | bigint): Promise<void>;\n    interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;\n    interceptAllOutboundHttp(binding: Fetcher): Promise<void>;\n}\ninterface ContainerStartupOptions {\n    entrypoint?: string[];\n    enableInternet: boolean;\n    env?: Record<string, string>;\n    hardTimeout?: (number | bigint);\n}\n/**\n * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)\n */\ndeclare abstract class MessagePort extends EventTarget {\n    /**\n     * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)\n     */\n    postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;\n    /**\n     * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)\n     */\n    close(): void;\n    /**\n     * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)\n     */\n    start(): void;\n    get onmessage(): any | null;\n    set onmessage(value: any | null);\n}\n/**\n * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)\n */\ndeclare class MessageChannel {\n    constructor();\n    /**\n     * The **`port1`** read-only property of the the port attached to the context that originated the channel.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)\n     */\n    readonly port1: MessagePort;\n    /**\n     * The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)\n     */\n    readonly port2: MessagePort;\n}\ninterface MessagePortPostMessageOptions {\n    transfer?: any[];\n}\ntype LoopbackForExport<T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub<InstanceType<T>> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass<InstanceType<T>> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;\ntype LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {\n    props?: Props;\n}) => Fetcher<T> : (opts: {\n    props?: any;\n}) => Fetcher<T>);\ntype LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {\n    props?: Props;\n}) => DurableObjectClass<T> : (opts: {\n    props?: any;\n}) => DurableObjectClass<T>);\ninterface SyncKvStorage {\n    get<T = unknown>(key: string): T | undefined;\n    list<T = unknown>(options?: SyncKvListOptions): Iterable<[\n        string,\n        T\n    ]>;\n    put<T>(key: string, value: T): void;\n    delete(key: string): boolean;\n}\ninterface SyncKvListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n}\ninterface WorkerStub {\n    getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;\n}\ninterface WorkerStubEntrypointOptions {\n    props?: any;\n}\ninterface WorkerLoader {\n    get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;\n    load(code: WorkerLoaderWorkerCode): WorkerStub;\n}\ninterface WorkerLoaderModule {\n    js?: string;\n    cjs?: string;\n    text?: string;\n    data?: ArrayBuffer;\n    json?: any;\n    py?: string;\n    wasm?: ArrayBuffer;\n}\ninterface WorkerLoaderWorkerCode {\n    compatibilityDate: string;\n    compatibilityFlags?: string[];\n    allowExperimental?: boolean;\n    mainModule: string;\n    modules: Record<string, WorkerLoaderModule | string>;\n    env?: any;\n    globalOutbound?: (Fetcher | null);\n    tails?: Fetcher[];\n    streamingTails?: Fetcher[];\n}\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare abstract class Performance {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */\n    get timeOrigin(): number;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */\n    now(): number;\n    /**\n     * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)\n     */\n    toJSON(): object;\n}\n// AI Search V2 API Error Interfaces\ninterface AiSearchInternalError extends Error {\n}\ninterface AiSearchNotFoundError extends Error {\n}\ninterface AiSearchNameNotSetError extends Error {\n}\n// AI Search V2 Request Types\ntype AiSearchSearchRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            /** Maximum number of results (1-50, default 10) */\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            /** Context expansion (0-3, default 0) */\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            /** Enable reranking (default false) */\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n};\ntype AiSearchChatCompletionsRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    model?: string;\n    stream?: boolean;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            match_threshold?: number;\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n    [key: string]: unknown;\n};\n// AI Search V2 Response Types\ntype AiSearchSearchResponse = {\n    search_query: string;\n    chunks: Array<{\n        id: string;\n        type: string;\n        /** Match score (0-1) */\n        score: number;\n        text: string;\n        item: {\n            timestamp?: number;\n            key: string;\n            metadata?: Record<string, unknown>;\n        };\n        scoring_details?: {\n            /** Keyword match score (0-1) */\n            keyword_score?: number;\n            /** Vector similarity score (0-1) */\n            vector_score?: number;\n        };\n    }>;\n};\ntype AiSearchListResponse = Array<{\n    id: string;\n    internal_id?: string;\n    account_id?: string;\n    account_tag?: string;\n    /** Whether the instance is enabled (default true) */\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n}>;\ntype AiSearchConfig = {\n    /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */\n    id: string;\n    type: 'r2' | 'web-crawler';\n    source: string;\n    source_params?: object;\n    /** Token ID (UUID format) */\n    token_id?: string;\n    ai_gateway_id?: string;\n    /** Enable query rewriting (default false) */\n    rewrite_query?: boolean;\n    /** Enable reranking (default false) */\n    reranking?: boolean;\n    embedding_model?: string;\n    ai_search_model?: string;\n};\ntype AiSearchInstance = {\n    id: string;\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n};\n// AI Search Instance Service - Instance-level operations\ndeclare abstract class AiSearchInstanceService {\n    /**\n     * Search the AI Search instance for relevant chunks.\n     * @param params Search request with messages and AI search options\n     * @returns Search response with matching chunks\n     */\n    search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;\n    /**\n     * Generate chat completions with AI Search context.\n     * @param params Chat completions request with optional streaming\n     * @returns Response object (if streaming) or chat completion result\n     */\n    chatCompletions(params: AiSearchChatCompletionsRequest): Promise<Response | object>;\n    /**\n     * Delete this AI Search instance.\n     */\n    delete(): Promise<void>;\n}\n// AI Search Account Service - Account-level operations\ndeclare abstract class AiSearchAccountService {\n    /**\n     * List all AI Search instances in the account.\n     * @returns Array of AI Search instances\n     */\n    list(): Promise<AiSearchListResponse>;\n    /**\n     * Get an AI Search instance by ID.\n     * @param name Instance ID\n     * @returns Instance service for performing operations\n     */\n    get(name: string): AiSearchInstanceService;\n    /**\n     * Create a new AI Search instance.\n     * @param config Instance configuration\n     * @returns Instance service for performing operations\n     */\n    create(config: AiSearchConfig): Promise<AiSearchInstanceService>;\n}\ntype AiImageClassificationInput = {\n    image: number[];\n};\ntype AiImageClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiImageClassification {\n    inputs: AiImageClassificationInput;\n    postProcessedOutputs: AiImageClassificationOutput;\n}\ntype AiImageToTextInput = {\n    image: number[];\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageToText {\n    inputs: AiImageToTextInput;\n    postProcessedOutputs: AiImageToTextOutput;\n}\ntype AiImageTextToTextInput = {\n    image: string;\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    ignore_eos?: boolean;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageTextToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageTextToText {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiMultimodalEmbeddingsInput = {\n    image: string;\n    text: string[];\n};\ntype AiIMultimodalEmbeddingsOutput = {\n    data: number[][];\n    shape: number[];\n};\ndeclare abstract class BaseAiMultimodalEmbeddings {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiObjectDetectionInput = {\n    image: number[];\n};\ntype AiObjectDetectionOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiObjectDetection {\n    inputs: AiObjectDetectionInput;\n    postProcessedOutputs: AiObjectDetectionOutput;\n}\ntype AiSentenceSimilarityInput = {\n    source: string;\n    sentences: string[];\n};\ntype AiSentenceSimilarityOutput = number[];\ndeclare abstract class BaseAiSentenceSimilarity {\n    inputs: AiSentenceSimilarityInput;\n    postProcessedOutputs: AiSentenceSimilarityOutput;\n}\ntype AiAutomaticSpeechRecognitionInput = {\n    audio: number[];\n};\ntype AiAutomaticSpeechRecognitionOutput = {\n    text?: string;\n    words?: {\n        word: string;\n        start: number;\n        end: number;\n    }[];\n    vtt?: string;\n};\ndeclare abstract class BaseAiAutomaticSpeechRecognition {\n    inputs: AiAutomaticSpeechRecognitionInput;\n    postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;\n}\ntype AiSummarizationInput = {\n    input_text: string;\n    max_length?: number;\n};\ntype AiSummarizationOutput = {\n    summary: string;\n};\ndeclare abstract class BaseAiSummarization {\n    inputs: AiSummarizationInput;\n    postProcessedOutputs: AiSummarizationOutput;\n}\ntype AiTextClassificationInput = {\n    text: string;\n};\ntype AiTextClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiTextClassification {\n    inputs: AiTextClassificationInput;\n    postProcessedOutputs: AiTextClassificationOutput;\n}\ntype AiTextEmbeddingsInput = {\n    text: string | string[];\n};\ntype AiTextEmbeddingsOutput = {\n    shape: number[];\n    data: number[][];\n};\ndeclare abstract class BaseAiTextEmbeddings {\n    inputs: AiTextEmbeddingsInput;\n    postProcessedOutputs: AiTextEmbeddingsOutput;\n}\ntype RoleScopedChatInput = {\n    role: \"user\" | \"assistant\" | \"system\" | \"tool\" | (string & NonNullable<unknown>);\n    content: string;\n    name?: string;\n};\ntype AiTextGenerationToolLegacyInput = {\n    name: string;\n    description: string;\n    parameters?: {\n        type: \"object\" | (string & NonNullable<unknown>);\n        properties: {\n            [key: string]: {\n                type: string;\n                description?: string;\n            };\n        };\n        required: string[];\n    };\n};\ntype AiTextGenerationToolInput = {\n    type: \"function\" | (string & NonNullable<unknown>);\n    function: {\n        name: string;\n        description: string;\n        parameters?: {\n            type: \"object\" | (string & NonNullable<unknown>);\n            properties: {\n                [key: string]: {\n                    type: string;\n                    description?: string;\n                };\n            };\n            required: string[];\n        };\n    };\n};\ntype AiTextGenerationFunctionsInput = {\n    name: string;\n    code: string;\n};\ntype AiTextGenerationResponseFormat = {\n    type: string;\n    json_schema?: any;\n};\ntype AiTextGenerationInput = {\n    prompt?: string;\n    raw?: boolean;\n    stream?: boolean;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    messages?: RoleScopedChatInput[];\n    response_format?: AiTextGenerationResponseFormat;\n    tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);\n    functions?: AiTextGenerationFunctionsInput[];\n};\ntype AiTextGenerationToolLegacyOutput = {\n    name: string;\n    arguments: unknown;\n};\ntype AiTextGenerationToolOutput = {\n    id: string;\n    type: \"function\";\n    function: {\n        name: string;\n        arguments: string;\n    };\n};\ntype UsageTags = {\n    prompt_tokens: number;\n    completion_tokens: number;\n    total_tokens: number;\n};\ntype AiTextGenerationOutput = {\n    response?: string;\n    tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];\n    usage?: UsageTags;\n};\ndeclare abstract class BaseAiTextGeneration {\n    inputs: AiTextGenerationInput;\n    postProcessedOutputs: AiTextGenerationOutput;\n}\ntype AiTextToSpeechInput = {\n    prompt: string;\n    lang?: string;\n};\ntype AiTextToSpeechOutput = Uint8Array | {\n    audio: string;\n};\ndeclare abstract class BaseAiTextToSpeech {\n    inputs: AiTextToSpeechInput;\n    postProcessedOutputs: AiTextToSpeechOutput;\n}\ntype AiTextToImageInput = {\n    prompt: string;\n    negative_prompt?: string;\n    height?: number;\n    width?: number;\n    image?: number[];\n    image_b64?: string;\n    mask?: number[];\n    num_steps?: number;\n    strength?: number;\n    guidance?: number;\n    seed?: number;\n};\ntype AiTextToImageOutput = ReadableStream<Uint8Array>;\ndeclare abstract class BaseAiTextToImage {\n    inputs: AiTextToImageInput;\n    postProcessedOutputs: AiTextToImageOutput;\n}\ntype AiTranslationInput = {\n    text: string;\n    target_lang: string;\n    source_lang?: string;\n};\ntype AiTranslationOutput = {\n    translated_text?: string;\n};\ndeclare abstract class BaseAiTranslation {\n    inputs: AiTranslationInput;\n    postProcessedOutputs: AiTranslationOutput;\n}\n/**\n * Workers AI support for OpenAI's Responses API\n * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts\n *\n * It's a stripped down version from its source.\n * It currently supports basic function calling, json mode and accepts images as input.\n *\n * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.\n * We plan to add those incrementally as model + platform capabilities evolve.\n */\ntype ResponsesInput = {\n    background?: boolean | null;\n    conversation?: string | ResponseConversationParam | null;\n    include?: Array<ResponseIncludable> | null;\n    input?: string | ResponseInput;\n    instructions?: string | null;\n    max_output_tokens?: number | null;\n    parallel_tool_calls?: boolean | null;\n    previous_response_id?: string | null;\n    prompt_cache_key?: string;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    stream?: boolean | null;\n    stream_options?: StreamOptions | null;\n    temperature?: number | null;\n    text?: ResponseTextConfig;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    truncation?: \"auto\" | \"disabled\" | null;\n};\ntype ResponsesOutput = {\n    id?: string;\n    created_at?: number;\n    output_text?: string;\n    error?: ResponseError | null;\n    incomplete_details?: ResponseIncompleteDetails | null;\n    instructions?: string | Array<ResponseInputItem> | null;\n    object?: \"response\";\n    output?: Array<ResponseOutputItem>;\n    parallel_tool_calls?: boolean;\n    temperature?: number | null;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    max_output_tokens?: number | null;\n    previous_response_id?: string | null;\n    prompt?: ResponsePrompt | null;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    status?: ResponseStatus;\n    text?: ResponseTextConfig;\n    truncation?: \"auto\" | \"disabled\" | null;\n    usage?: ResponseUsage;\n};\ntype EasyInputMessage = {\n    content: string | ResponseInputMessageContentList;\n    role: \"user\" | \"assistant\" | \"system\" | \"developer\";\n    type?: \"message\";\n};\ntype ResponsesFunctionTool = {\n    name: string;\n    parameters: {\n        [key: string]: unknown;\n    } | null;\n    strict: boolean | null;\n    type: \"function\";\n    description?: string | null;\n};\ntype ResponseIncompleteDetails = {\n    reason?: \"max_output_tokens\" | \"content_filter\";\n};\ntype ResponsePrompt = {\n    id: string;\n    variables?: {\n        [key: string]: string | ResponseInputText | ResponseInputImage;\n    } | null;\n    version?: string | null;\n};\ntype Reasoning = {\n    effort?: ReasoningEffort | null;\n    generate_summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n    summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n};\ntype ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;\ntype ResponseContentReasoningText = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseConversationParam = {\n    id: string;\n};\ntype ResponseCreatedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.created\";\n};\ntype ResponseCustomToolCallOutput = {\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"custom_tool_call_output\";\n    id?: string;\n};\ntype ResponseError = {\n    code: \"server_error\" | \"rate_limit_exceeded\" | \"invalid_prompt\" | \"vector_store_timeout\" | \"invalid_image\" | \"invalid_image_format\" | \"invalid_base64_image\" | \"invalid_image_url\" | \"image_too_large\" | \"image_too_small\" | \"image_parse_error\" | \"image_content_policy_violation\" | \"invalid_image_mode\" | \"image_file_too_large\" | \"unsupported_image_media_type\" | \"empty_image_file\" | \"failed_to_download_image\" | \"image_file_not_found\";\n    message: string;\n};\ntype ResponseErrorEvent = {\n    code: string | null;\n    message: string;\n    param: string | null;\n    sequence_number: number;\n    type: \"error\";\n};\ntype ResponseFailedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.failed\";\n};\ntype ResponseFormatText = {\n    type: \"text\";\n};\ntype ResponseFormatJSONObject = {\n    type: \"json_object\";\n};\ntype ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;\ntype ResponseFormatTextJSONSchemaConfig = {\n    name: string;\n    schema: {\n        [key: string]: unknown;\n    };\n    type: \"json_schema\";\n    description?: string;\n    strict?: boolean | null;\n};\ntype ResponseFunctionCallArgumentsDeltaEvent = {\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.delta\";\n};\ntype ResponseFunctionCallArgumentsDoneEvent = {\n    arguments: string;\n    item_id: string;\n    name: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.done\";\n};\ntype ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;\ntype ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;\ntype ResponseFunctionToolCall = {\n    arguments: string;\n    call_id: string;\n    name: string;\n    type: \"function_call\";\n    id?: string;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ninterface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {\n    id: string;\n}\ntype ResponseFunctionToolCallOutputItem = {\n    id: string;\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"function_call_output\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseIncludable = \"message.input_image.image_url\" | \"message.output_text.logprobs\";\ntype ResponseIncompleteEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.incomplete\";\n};\ntype ResponseInput = Array<ResponseInputItem>;\ntype ResponseInputContent = ResponseInputText | ResponseInputImage;\ntype ResponseInputImage = {\n    detail: \"low\" | \"high\" | \"auto\";\n    type: \"input_image\";\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputImageContent = {\n    type: \"input_image\";\n    detail?: \"low\" | \"high\" | \"auto\" | null;\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;\ntype ResponseInputItemFunctionCallOutput = {\n    call_id: string;\n    output: string | ResponseFunctionCallOutputItemList;\n    type: \"function_call_output\";\n    id?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\" | null;\n};\ntype ResponseInputItemMessage = {\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputMessageContentList = Array<ResponseInputContent>;\ntype ResponseInputMessageItem = {\n    id: string;\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputText = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseInputTextContent = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;\ntype ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;\ntype ResponseOutputItemAddedEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.added\";\n};\ntype ResponseOutputItemDoneEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.done\";\n};\ntype ResponseOutputMessage = {\n    id: string;\n    content: Array<ResponseOutputText | ResponseOutputRefusal>;\n    role: \"assistant\";\n    status: \"in_progress\" | \"completed\" | \"incomplete\";\n    type: \"message\";\n};\ntype ResponseOutputRefusal = {\n    refusal: string;\n    type: \"refusal\";\n};\ntype ResponseOutputText = {\n    text: string;\n    type: \"output_text\";\n    logprobs?: Array<Logprob>;\n};\ntype ResponseReasoningItem = {\n    id: string;\n    summary: Array<ResponseReasoningSummaryItem>;\n    type: \"reasoning\";\n    content?: Array<ResponseReasoningContentItem>;\n    encrypted_content?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseReasoningSummaryItem = {\n    text: string;\n    type: \"summary_text\";\n};\ntype ResponseReasoningContentItem = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseReasoningTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.reasoning_text.delta\";\n};\ntype ResponseReasoningTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.reasoning_text.done\";\n};\ntype ResponseRefusalDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.refusal.delta\";\n};\ntype ResponseRefusalDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    refusal: string;\n    sequence_number: number;\n    type: \"response.refusal.done\";\n};\ntype ResponseStatus = \"completed\" | \"failed\" | \"in_progress\" | \"cancelled\" | \"queued\" | \"incomplete\";\ntype ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;\ntype ResponseCompletedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.completed\";\n};\ntype ResponseTextConfig = {\n    format?: ResponseFormatTextConfig;\n    verbosity?: \"low\" | \"medium\" | \"high\" | null;\n};\ntype ResponseTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_text.delta\";\n};\ntype ResponseTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.output_text.done\";\n};\ntype Logprob = {\n    token: string;\n    logprob: number;\n    top_logprobs?: Array<TopLogprob>;\n};\ntype TopLogprob = {\n    token?: string;\n    logprob?: number;\n};\ntype ResponseUsage = {\n    input_tokens: number;\n    output_tokens: number;\n    total_tokens: number;\n};\ntype Tool = ResponsesFunctionTool;\ntype ToolChoiceFunction = {\n    name: string;\n    type: \"function\";\n};\ntype ToolChoiceOptions = \"none\";\ntype ReasoningEffort = \"minimal\" | \"low\" | \"medium\" | \"high\" | null;\ntype StreamOptions = {\n    include_obfuscation?: boolean;\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;\n}\ntype Ai_Cf_Openai_Whisper_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper {\n    inputs: Ai_Cf_Openai_Whisper_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;\n}\ntype Ai_Cf_Meta_M2M100_1_2B_Input = {\n    /**\n     * The text to be translated\n     */\n    text: string;\n    /**\n     * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n     */\n    source_lang?: string;\n    /**\n     * The language code to translate the text into (e.g., 'es' for Spanish)\n     */\n    target_lang: string;\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        /**\n         * The text to be translated\n         */\n        text: string;\n        /**\n         * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n         */\n        source_lang?: string;\n        /**\n         * The language code to translate the text into (e.g., 'es' for Spanish)\n         */\n        target_lang: string;\n    }[];\n};\ntype Ai_Cf_Meta_M2M100_1_2B_Output = {\n    /**\n     * The translated text in the target language\n     */\n    translated_text?: string;\n} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;\ninterface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {\n    inputs: Ai_Cf_Meta_M2M100_1_2B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;\n}\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;\n}\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;\n}\ntype Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt?: string;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    image: number[] | (string & NonNullable<unknown>);\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n};\ninterface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {\n    description?: string;\n}\ndeclare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {\n    inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;\n    postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;\n}\ntype Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Tiny_En_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {\n    inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {\n    /**\n     * Base64 encoded value of the audio data.\n     */\n    audio: string;\n    /**\n     * Supported tasks are 'translate' or 'transcribe'.\n     */\n    task?: string;\n    /**\n     * The language of the audio being transcribed or translated.\n     */\n    language?: string;\n    /**\n     * Preprocess the audio with a voice activity detection model.\n     */\n    vad_filter?: boolean;\n    /**\n     * A text prompt to help provide context to the model on the contents of the audio.\n     */\n    initial_prompt?: string;\n    /**\n     * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.\n     */\n    prefix?: string;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {\n    transcription_info?: {\n        /**\n         * The language of the audio being transcribed or translated.\n         */\n        language?: string;\n        /**\n         * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.\n         */\n        language_probability?: number;\n        /**\n         * The total duration of the original audio file, in seconds.\n         */\n        duration?: number;\n        /**\n         * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.\n         */\n        duration_after_vad?: number;\n    };\n    /**\n     * The complete transcription of the audio.\n     */\n    text: string;\n    /**\n     * The total number of words in the transcription.\n     */\n    word_count?: number;\n    segments?: {\n        /**\n         * The starting time of the segment within the audio, in seconds.\n         */\n        start?: number;\n        /**\n         * The ending time of the segment within the audio, in seconds.\n         */\n        end?: number;\n        /**\n         * The transcription of the segment.\n         */\n        text?: string;\n        /**\n         * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.\n         */\n        temperature?: number;\n        /**\n         * The average log probability of the predictions for the words in this segment, indicating overall confidence.\n         */\n        avg_logprob?: number;\n        /**\n         * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.\n         */\n        compression_ratio?: number;\n        /**\n         * The probability that the segment contains no speech, represented as a decimal between 0 and 1.\n         */\n        no_speech_prob?: number;\n        words?: {\n            /**\n             * The individual word transcribed from the audio.\n             */\n            word?: string;\n            /**\n             * The starting time of the word within the audio, in seconds.\n             */\n            start?: number;\n            /**\n             * The ending time of the word within the audio, in seconds.\n             */\n            end?: number;\n        }[];\n    }[];\n    /**\n     * The transcription in WebVTT format, which includes timing and text information for use in subtitles.\n     */\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {\n    inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;\n}\ntype Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];\n};\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ntype Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Ouput_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Ouput_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Query {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {\n    response?: number[][];\n    shape?: number[];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_M3 {\n    inputs: Ai_Cf_Baai_Bge_M3_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer.\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {\n    inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;\n    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages;\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    image?: number[] | (string & NonNullable<unknown>);\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n}\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    image?: number[] | (string & NonNullable<unknown>);\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * If true, the response will be streamed back incrementally.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response?: string;\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {\n    inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {\n    requests?: {\n        /**\n         * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique.\n         */\n        external_reference?: string;\n        /**\n         * Prompt for the text generation model\n         */\n        prompt?: string;\n        /**\n         * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n         */\n        stream?: boolean;\n        /**\n         * The maximum number of tokens to generate in the response.\n         */\n        max_tokens?: number;\n        /**\n         * Controls the randomness of the output; higher values produce more random results.\n         */\n        temperature?: number;\n        /**\n         * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n         */\n        top_p?: number;\n        /**\n         * Random seed for reproducibility of the generation.\n         */\n        seed?: number;\n        /**\n         * Penalty for repeated tokens; higher values discourage repetition.\n         */\n        repetition_penalty?: number;\n        /**\n         * Decreases the likelihood of the model repeating the same lines verbatim.\n         */\n        frequency_penalty?: number;\n        /**\n         * Increases the likelihood of the model introducing new topics.\n         */\n        presence_penalty?: number;\n        response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;\n    }[];\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {\n    inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Input {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender must alternate between 'user' and 'assistant'.\n         */\n        role: \"user\" | \"assistant\";\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Dictate the output format of the generated response.\n     */\n    response_format?: {\n        /**\n         * Set to json_object to process and output generated text as JSON.\n         */\n        type?: string;\n    };\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Output {\n    response?: string | {\n        /**\n         * Whether the conversation is safe or not.\n         */\n        safe?: boolean;\n        /**\n         * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.\n         */\n        categories?: string[];\n    };\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {\n    inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Input {\n    /**\n     * A query you wish to perform against the provided contexts.\n     */\n    /**\n     * Number of returned results starting with the best score.\n     */\n    top_k?: number;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Output {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {\n    inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages;\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {\n    inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;\ninterface Ai_Cf_Qwen_Qwq_32B_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwq_32B_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwq_32B {\n    inputs: Ai_Cf_Qwen_Qwq_32B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages;\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {\n    inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;\ninterface Ai_Cf_Google_Gemma_3_12B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Google_Gemma_3_12B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[];\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {\n    inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;\n    postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch;\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {\n    requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The tool call id.\n         */\n        id?: string;\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type?: string;\n        /**\n         * Details of the function tool.\n         */\n        function?: {\n            /**\n             * The name of the tool to be called\n             */\n            name?: string;\n            /**\n             * The arguments passed to be passed to the tool call request\n             */\n            arguments?: object;\n        };\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {\n    inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {\n    requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {\n    inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Input {\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.\n     */\n    custom_topic_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom topics you want the model to detect within your input audio or text if present Submit up to 100\n     */\n    custom_topic?: string;\n    /**\n     * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param\n     */\n    custom_intent_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom intents you want the model to detect within your input audio if present\n     */\n    custom_intent?: string;\n    /**\n     * Identifies and extracts key entities from content in submitted audio\n     */\n    detect_entities?: boolean;\n    /**\n     * Identifies the dominant language spoken in submitted audio\n     */\n    detect_language?: boolean;\n    /**\n     * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0\n     */\n    diarize?: boolean;\n    /**\n     * Identify and extract key entities from content in submitted audio\n     */\n    dictation?: boolean;\n    /**\n     * Specify the expected encoding of your submitted audio\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"amr-nb\" | \"amr-wb\" | \"opus\" | \"speex\" | \"g729\";\n    /**\n     * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing\n     */\n    extra?: string;\n    /**\n     * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'\n     */\n    filler_words?: boolean;\n    /**\n     * Key term prompting can boost or suppress specialized terminology and brands.\n     */\n    keyterm?: string;\n    /**\n     * Keywords can boost or suppress specialized terminology and brands.\n     */\n    keywords?: string;\n    /**\n     * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.\n     */\n    language?: string;\n    /**\n     * Spoken measurements will be converted to their corresponding abbreviations.\n     */\n    measurements?: boolean;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.\n     */\n    mip_opt_out?: boolean;\n    /**\n     * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio\n     */\n    mode?: \"general\" | \"medical\" | \"finance\";\n    /**\n     * Transcribe each audio channel independently.\n     */\n    multichannel?: boolean;\n    /**\n     * Numerals converts numbers from written format to numerical format.\n     */\n    numerals?: boolean;\n    /**\n     * Splits audio into paragraphs to improve transcript readability.\n     */\n    paragraphs?: boolean;\n    /**\n     * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.\n     */\n    profanity_filter?: boolean;\n    /**\n     * Add punctuation and capitalization to the transcript.\n     */\n    punctuate?: boolean;\n    /**\n     * Redaction removes sensitive information from your transcripts.\n     */\n    redact?: string;\n    /**\n     * Search for terms or phrases in submitted audio and replaces them.\n     */\n    replace?: string;\n    /**\n     * Search for terms or phrases in submitted audio.\n     */\n    search?: string;\n    /**\n     * Recognizes the sentiment throughout a transcript or text.\n     */\n    sentiment?: boolean;\n    /**\n     * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.\n     */\n    smart_format?: boolean;\n    /**\n     * Detect topics throughout a transcript or text.\n     */\n    topics?: boolean;\n    /**\n     * Segments speech into meaningful semantic units.\n     */\n    utterances?: boolean;\n    /**\n     * Seconds to wait before detecting a pause between words in submitted audio.\n     */\n    utt_split?: number;\n    /**\n     * The number of channels in the submitted audio\n     */\n    channels?: number;\n    /**\n     * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.\n     */\n    interim_results?: boolean;\n    /**\n     * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing\n     */\n    endpointing?: string;\n    /**\n     * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.\n     */\n    vad_events?: boolean;\n    /**\n     * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.\n     */\n    utterance_end_ms?: boolean;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Output {\n    results?: {\n        channels?: {\n            alternatives?: {\n                confidence?: number;\n                transcript?: string;\n                words?: {\n                    confidence?: number;\n                    end?: number;\n                    start?: number;\n                    word?: string;\n                }[];\n            }[];\n        }[];\n        summary?: {\n            result?: string;\n            short?: string;\n        };\n        sentiments?: {\n            segments?: {\n                text?: string;\n                start_word?: number;\n                end_word?: number;\n                sentiment?: string;\n                sentiment_score?: number;\n            }[];\n            average?: {\n                sentiment?: string;\n                sentiment_score?: number;\n            };\n        };\n    };\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Nova_3 {\n    inputs: Ai_Cf_Deepgram_Nova_3_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {\n    queries?: string | string[];\n    /**\n     * Optional instruction for the task\n     */\n    instruction?: string;\n    documents?: string | string[];\n    text?: string | string[];\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {\n    data?: number[][];\n    shape?: number[];\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {\n    inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;\n}\ntype Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {\n    /**\n     * readable stream with audio data and content-type specified for that data\n     */\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n} | {\n    /**\n     * base64 encoded audio data\n     */\n    audio: string;\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n};\ninterface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {\n    /**\n     * if true, end-of-turn was detected\n     */\n    is_complete?: boolean;\n    /**\n     * probability of the end-of-turn detection\n     */\n    probability?: number;\n}\ndeclare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {\n    inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;\n    postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ninterface Ai_Cf_Leonardo_Phoenix_1_0_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * Specify what to exclude from the generated images\n     */\n    negative_prompt?: string;\n}\n/**\n * The generated image in JPEG format\n */\ntype Ai_Cf_Leonardo_Phoenix_1_0_Output = string;\ndeclare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {\n    inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {\n    inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_1_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"angus\" | \"asteria\" | \"arcas\" | \"orion\" | \"orpheus\" | \"athena\" | \"luna\" | \"zeus\" | \"perseus\" | \"helios\" | \"hera\" | \"stella\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_1_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_1 {\n    inputs: Ai_Cf_Deepgram_Aura_1_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {\n    /**\n     * Input text to translate. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n    /**\n     * Target language to translate to\n     */\n    target_language: \"asm_Beng\" | \"awa_Deva\" | \"ben_Beng\" | \"bho_Deva\" | \"brx_Deva\" | \"doi_Deva\" | \"eng_Latn\" | \"gom_Deva\" | \"gon_Deva\" | \"guj_Gujr\" | \"hin_Deva\" | \"hne_Deva\" | \"kan_Knda\" | \"kas_Arab\" | \"kas_Deva\" | \"kha_Latn\" | \"lus_Latn\" | \"mag_Deva\" | \"mai_Deva\" | \"mal_Mlym\" | \"mar_Deva\" | \"mni_Beng\" | \"mni_Mtei\" | \"npi_Deva\" | \"ory_Orya\" | \"pan_Guru\" | \"san_Deva\" | \"sat_Olck\" | \"snd_Arab\" | \"snd_Deva\" | \"tam_Taml\" | \"tel_Telu\" | \"urd_Arab\" | \"unr_Deva\";\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {\n    /**\n     * Translated texts\n     */\n    translations: string[];\n}\ndeclare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {\n    inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;\n    postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {\n    requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {\n    inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;\n    postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {\n    /**\n     * Input text to embed. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {\n    /**\n     * Embedding vectors, where each vector is a list of floats.\n     */\n    data: number[][];\n    /**\n     * Shape of the embedding data as [number_of_embeddings, embedding_dimension].\n     *\n     * @minItems 2\n     * @maxItems 2\n     */\n    shape: [\n        number,\n        number\n    ];\n}\ndeclare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {\n    inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;\n    postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;\n}\ninterface Ai_Cf_Deepgram_Flux_Input {\n    /**\n     * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.\n     */\n    encoding: \"linear16\";\n    /**\n     * Sample rate of the audio stream in Hz.\n     */\n    sample_rate: string;\n    /**\n     * End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.\n     */\n    eager_eot_threshold?: string;\n    /**\n     * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.\n     */\n    eot_threshold?: string;\n    /**\n     * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.\n     */\n    eot_timeout_ms?: string;\n    /**\n     * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.\n     */\n    keyterm?: string;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip\n     */\n    mip_opt_out?: \"true\" | \"false\";\n    /**\n     * Label your requests for the purpose of identification during usage reporting\n     */\n    tag?: string;\n}\n/**\n * Output will be returned as websocket messages.\n */\ninterface Ai_Cf_Deepgram_Flux_Output {\n    /**\n     * The unique identifier of the request (uuid)\n     */\n    request_id?: string;\n    /**\n     * Starts at 0 and increments for each message the server sends to the client.\n     */\n    sequence_id?: number;\n    /**\n     * The type of event being reported.\n     */\n    event?: \"Update\" | \"StartOfTurn\" | \"EagerEndOfTurn\" | \"TurnResumed\" | \"EndOfTurn\";\n    /**\n     * The index of the current turn\n     */\n    turn_index?: number;\n    /**\n     * Start time in seconds of the audio range that was transcribed\n     */\n    audio_window_start?: number;\n    /**\n     * End time in seconds of the audio range that was transcribed\n     */\n    audio_window_end?: number;\n    /**\n     * Text that was said over the course of the current turn\n     */\n    transcript?: string;\n    /**\n     * The words in the transcript\n     */\n    words?: {\n        /**\n         * The individual punctuated, properly-cased word from the transcript\n         */\n        word: string;\n        /**\n         * Confidence that this word was transcribed correctly\n         */\n        confidence: number;\n    }[];\n    /**\n     * Confidence that no more speech is coming in this turn\n     */\n    end_of_turn_confidence?: number;\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Flux {\n    inputs: Ai_Cf_Deepgram_Flux_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_En_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"amalthea\" | \"andromeda\" | \"apollo\" | \"arcas\" | \"aries\" | \"asteria\" | \"athena\" | \"atlas\" | \"aurora\" | \"callista\" | \"cora\" | \"cordelia\" | \"delia\" | \"draco\" | \"electra\" | \"harmonia\" | \"helena\" | \"hera\" | \"hermes\" | \"hyperion\" | \"iris\" | \"janus\" | \"juno\" | \"jupiter\" | \"luna\" | \"mars\" | \"minerva\" | \"neptune\" | \"odysseus\" | \"ophelia\" | \"orion\" | \"orpheus\" | \"pandora\" | \"phoebe\" | \"pluto\" | \"saturn\" | \"thalia\" | \"theia\" | \"vesta\" | \"zeus\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_En_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {\n    inputs: Ai_Cf_Deepgram_Aura_2_En_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_Es_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"sirio\" | \"nestor\" | \"carina\" | \"celeste\" | \"alvaro\" | \"diana\" | \"aquila\" | \"selena\" | \"estrella\" | \"javier\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_Es_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {\n    inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;\n}\ninterface AiModels {\n    \"@cf/huggingface/distilbert-sst-2-int8\": BaseAiTextClassification;\n    \"@cf/stabilityai/stable-diffusion-xl-base-1.0\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-inpainting\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-img2img\": BaseAiTextToImage;\n    \"@cf/lykon/dreamshaper-8-lcm\": BaseAiTextToImage;\n    \"@cf/bytedance/stable-diffusion-xl-lightning\": BaseAiTextToImage;\n    \"@cf/myshell-ai/melotts\": BaseAiTextToSpeech;\n    \"@cf/google/embeddinggemma-300m\": BaseAiTextEmbeddings;\n    \"@cf/microsoft/resnet-50\": BaseAiImageClassification;\n    \"@cf/meta/llama-2-7b-chat-int8\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.1\": BaseAiTextGeneration;\n    \"@cf/meta/llama-2-7b-chat-fp16\": BaseAiTextGeneration;\n    \"@hf/thebloke/llama-2-13b-chat-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/mistral-7b-instruct-v0.1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/zephyr-7b-beta-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/openhermes-2.5-mistral-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/neural-chat-7b-v3-1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/llamaguard-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-base-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-math-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/defog/sqlcoder-7b-2\": BaseAiTextGeneration;\n    \"@cf/openchat/openchat-3.5-0106\": BaseAiTextGeneration;\n    \"@cf/tiiuae/falcon-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/thebloke/discolm-german-7b-v1-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-0.5b-chat\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-7b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-14b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/tinyllama/tinyllama-1.1b-chat-v1.0\": BaseAiTextGeneration;\n    \"@cf/microsoft/phi-2\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-1.8b-chat\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.2-lora\": BaseAiTextGeneration;\n    \"@hf/nousresearch/hermes-2-pro-mistral-7b\": BaseAiTextGeneration;\n    \"@hf/nexusflow/starling-lm-7b-beta\": BaseAiTextGeneration;\n    \"@hf/google/gemma-7b-it\": BaseAiTextGeneration;\n    \"@cf/meta-llama/llama-2-7b-chat-hf-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-2b-it-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-7b-it-lora\": BaseAiTextGeneration;\n    \"@hf/mistral/mistral-7b-instruct-v0.2\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct\": BaseAiTextGeneration;\n    \"@cf/fblgit/una-cybertron-7b-v2-bf16\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-fp8\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-3b-instruct\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-1b-instruct\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b\": BaseAiTextGeneration;\n    \"@cf/ibm-granite/granite-4.0-h-micro\": BaseAiTextGeneration;\n    \"@cf/facebook/bart-large-cnn\": BaseAiSummarization;\n    \"@cf/llava-hf/llava-1.5-7b-hf\": BaseAiImageToText;\n    \"@cf/baai/bge-base-en-v1.5\": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;\n    \"@cf/openai/whisper\": Base_Ai_Cf_Openai_Whisper;\n    \"@cf/meta/m2m100-1.2b\": Base_Ai_Cf_Meta_M2M100_1_2B;\n    \"@cf/baai/bge-small-en-v1.5\": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;\n    \"@cf/baai/bge-large-en-v1.5\": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;\n    \"@cf/unum/uform-gen2-qwen-500m\": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;\n    \"@cf/openai/whisper-tiny-en\": Base_Ai_Cf_Openai_Whisper_Tiny_En;\n    \"@cf/openai/whisper-large-v3-turbo\": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;\n    \"@cf/baai/bge-m3\": Base_Ai_Cf_Baai_Bge_M3;\n    \"@cf/black-forest-labs/flux-1-schnell\": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;\n    \"@cf/meta/llama-3.2-11b-vision-instruct\": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;\n    \"@cf/meta/llama-3.3-70b-instruct-fp8-fast\": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;\n    \"@cf/meta/llama-guard-3-8b\": Base_Ai_Cf_Meta_Llama_Guard_3_8B;\n    \"@cf/baai/bge-reranker-base\": Base_Ai_Cf_Baai_Bge_Reranker_Base;\n    \"@cf/qwen/qwen2.5-coder-32b-instruct\": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;\n    \"@cf/qwen/qwq-32b\": Base_Ai_Cf_Qwen_Qwq_32B;\n    \"@cf/mistralai/mistral-small-3.1-24b-instruct\": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;\n    \"@cf/google/gemma-3-12b-it\": Base_Ai_Cf_Google_Gemma_3_12B_It;\n    \"@cf/meta/llama-4-scout-17b-16e-instruct\": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;\n    \"@cf/qwen/qwen3-30b-a3b-fp8\": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;\n    \"@cf/deepgram/nova-3\": Base_Ai_Cf_Deepgram_Nova_3;\n    \"@cf/qwen/qwen3-embedding-0.6b\": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;\n    \"@cf/pipecat-ai/smart-turn-v2\": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;\n    \"@cf/openai/gpt-oss-120b\": Base_Ai_Cf_Openai_Gpt_Oss_120B;\n    \"@cf/openai/gpt-oss-20b\": Base_Ai_Cf_Openai_Gpt_Oss_20B;\n    \"@cf/leonardo/phoenix-1.0\": Base_Ai_Cf_Leonardo_Phoenix_1_0;\n    \"@cf/leonardo/lucid-origin\": Base_Ai_Cf_Leonardo_Lucid_Origin;\n    \"@cf/deepgram/aura-1\": Base_Ai_Cf_Deepgram_Aura_1;\n    \"@cf/ai4bharat/indictrans2-en-indic-1B\": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;\n    \"@cf/aisingapore/gemma-sea-lion-v4-27b-it\": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;\n    \"@cf/pfnet/plamo-embedding-1b\": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;\n    \"@cf/deepgram/flux\": Base_Ai_Cf_Deepgram_Flux;\n    \"@cf/deepgram/aura-2-en\": Base_Ai_Cf_Deepgram_Aura_2_En;\n    \"@cf/deepgram/aura-2-es\": Base_Ai_Cf_Deepgram_Aura_2_Es;\n}\ntype AiOptions = {\n    /**\n     * Send requests as an asynchronous batch job, only works for supported models\n     * https://developers.cloudflare.com/workers-ai/features/batch-api\n     */\n    queueRequest?: boolean;\n    /**\n     * Establish websocket connections, only works for supported models\n     */\n    websocket?: boolean;\n    /**\n     * Tag your requests to group and view them in Cloudflare dashboard.\n     *\n     * Rules:\n     * Tags must only contain letters, numbers, and the symbols: : - . / @\n     * Each tag can have maximum 50 characters.\n     * Maximum 5 tags are allowed each request.\n     * Duplicate tags will removed.\n     */\n    tags?: string[];\n    gateway?: GatewayOptions;\n    returnRawResponse?: boolean;\n    prefix?: string;\n    extraHeaders?: object;\n};\ntype AiModelsSearchParams = {\n    author?: string;\n    hide_experimental?: boolean;\n    page?: number;\n    per_page?: number;\n    search?: string;\n    source?: number;\n    task?: string;\n};\ntype AiModelsSearchObject = {\n    id: string;\n    source: number;\n    name: string;\n    description: string;\n    task: {\n        id: string;\n        name: string;\n        description: string;\n    };\n    tags: string[];\n    properties: {\n        property_id: string;\n        value: string;\n    }[];\n};\ninterface InferenceUpstreamError extends Error {\n}\ninterface AiInternalError extends Error {\n}\ntype AiModelListType = Record<string, any>;\ndeclare abstract class Ai<AiModelList extends AiModelListType = AiModels> {\n    aiGatewayLogId: string | null;\n    gateway(gatewayId: string): AiGateway;\n    /**\n     * Access the AI Search API for managing AI-powered search instances.\n     *\n     * This is the new API that replaces AutoRAG with better namespace separation:\n     * - Account-level operations: `list()`, `create()`\n     * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`\n     *\n     * @example\n     * ```typescript\n     * // List all AI Search instances\n     * const instances = await env.AI.aiSearch.list();\n     *\n     * // Search an instance\n     * const results = await env.AI.aiSearch.get('my-search').search({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   ai_search_options: {\n     *     retrieval: { max_num_results: 10 }\n     *   }\n     * });\n     *\n     * // Generate chat completions with AI Search context\n     * const response = await env.AI.aiSearch.get('my-search').chatCompletions({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'\n     * });\n     * ```\n     */\n    aiSearch(): AiSearchAccountService;\n    /**\n     * @deprecated AutoRAG has been replaced by AI Search.\n     * Use `env.AI.aiSearch` instead for better API design and new features.\n     *\n     * Migration guide:\n     * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n     * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`\n     * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n     *\n     * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.\n     *\n     * @see AiSearchAccountService\n     * @param autoragId Optional instance ID (omit for account-level operations)\n     */\n    autorag(autoragId: string): AutoRAG;\n    run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name][\"inputs\"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends {\n        returnRawResponse: true;\n    } | {\n        websocket: true;\n    } ? Response : InputOptions extends {\n        stream: true;\n    } ? ReadableStream : AiModelList[Name][\"postProcessedOutputs\"]>;\n    models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;\n    toMarkdown(): ToMarkdownService;\n    toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n}\ntype GatewayRetries = {\n    maxAttempts?: 1 | 2 | 3 | 4 | 5;\n    retryDelayMs?: number;\n    backoff?: 'constant' | 'linear' | 'exponential';\n};\ntype GatewayOptions = {\n    id: string;\n    cacheKey?: string;\n    cacheTtl?: number;\n    skipCache?: boolean;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    collectLog?: boolean;\n    eventId?: string;\n    requestTimeoutMs?: number;\n    retries?: GatewayRetries;\n};\ntype UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {\n    /**\n     ** @deprecated\n     */\n    id?: string;\n};\ntype AiGatewayPatchLog = {\n    score?: number | null;\n    feedback?: -1 | 1 | null;\n    metadata?: Record<string, number | string | boolean | null | bigint> | null;\n};\ntype AiGatewayLog = {\n    id: string;\n    provider: string;\n    model: string;\n    model_type?: string;\n    path: string;\n    duration: number;\n    request_type?: string;\n    request_content_type?: string;\n    status_code: number;\n    response_content_type?: string;\n    success: boolean;\n    cached: boolean;\n    tokens_in?: number;\n    tokens_out?: number;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    step?: number;\n    cost?: number;\n    custom_cost?: boolean;\n    request_size: number;\n    request_head?: string;\n    request_head_complete: boolean;\n    response_size: number;\n    response_head?: string;\n    response_head_complete: boolean;\n    created_at: Date;\n};\ntype AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | 'azure-openai' | 'google-vertex-ai' | 'huggingface' | 'openai' | 'perplexity-ai' | 'replicate' | 'groq' | 'cohere' | 'google-ai-studio' | 'mistral' | 'grok' | 'openrouter' | 'deepseek' | 'cerebras' | 'cartesia' | 'elevenlabs' | 'adobe-firefly';\ntype AIGatewayHeaders = {\n    'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;\n    'cf-aig-custom-cost': {\n        per_token_in?: number;\n        per_token_out?: number;\n    } | {\n        total_cost?: number;\n    } | string;\n    'cf-aig-cache-ttl': number | string;\n    'cf-aig-skip-cache': boolean | string;\n    'cf-aig-cache-key': string;\n    'cf-aig-event-id': string;\n    'cf-aig-request-timeout': number | string;\n    'cf-aig-max-attempts': number | string;\n    'cf-aig-retry-delay': number | string;\n    'cf-aig-backoff': string;\n    'cf-aig-collect-log': boolean | string;\n    Authorization: string;\n    'Content-Type': string;\n    [key: string]: string | number | boolean | object;\n};\ntype AIGatewayUniversalRequest = {\n    provider: AIGatewayProviders | string; // eslint-disable-line\n    endpoint: string;\n    headers: Partial<AIGatewayHeaders>;\n    query: unknown;\n};\ninterface AiGatewayInternalError extends Error {\n}\ninterface AiGatewayLogNotFound extends Error {\n}\ndeclare abstract class AiGateway {\n    patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;\n    getLog(logId: string): Promise<AiGatewayLog>;\n    run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {\n        gateway?: UniversalGatewayOptions;\n        extraHeaders?: object;\n    }): Promise<Response>;\n    getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.\n * @see AiSearchInternalError\n */\ninterface AutoRAGInternalError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.\n * @see AiSearchNotFoundError\n */\ninterface AutoRAGNotFoundError extends Error {\n}\n/**\n * @deprecated This error type is no longer used in the AI Search API.\n */\ninterface AutoRAGUnauthorizedError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.\n * @see AiSearchNameNotSetError\n */\ninterface AutoRAGNameNotSetError extends Error {\n}\ntype ComparisonFilter = {\n    key: string;\n    type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';\n    value: string | number | boolean;\n};\ntype CompoundFilter = {\n    type: 'and' | 'or';\n    filters: ComparisonFilter[];\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchRequest with the new API instead.\n * @see AiSearchSearchRequest\n */\ntype AutoRagSearchRequest = {\n    query: string;\n    filters?: CompoundFilter | ComparisonFilter;\n    max_num_results?: number;\n    ranking_options?: {\n        ranker?: string;\n        score_threshold?: number;\n    };\n    reranking?: {\n        enabled?: boolean;\n        model?: string;\n    };\n    rewrite_query?: boolean;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with the new API instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequest = AutoRagSearchRequest & {\n    stream?: boolean;\n    system_prompt?: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with stream: true instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {\n    stream: true;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchResponse with the new API instead.\n * @see AiSearchSearchResponse\n */\ntype AutoRagSearchResponse = {\n    object: 'vector_store.search_results.page';\n    search_query: string;\n    data: {\n        file_id: string;\n        filename: string;\n        score: number;\n        attributes: Record<string, string | number | boolean | null>;\n        content: {\n            type: 'text';\n            text: string;\n        }[];\n    }[];\n    has_more: boolean;\n    next_page: string | null;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchListResponse with the new API instead.\n * @see AiSearchListResponse\n */\ntype AutoRagListResponse = {\n    id: string;\n    enable: boolean;\n    type: string;\n    source: string;\n    vectorize_name: string;\n    paused: boolean;\n    status: string;\n}[];\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * The new API returns different response formats for chat completions.\n */\ntype AutoRagAiSearchResponse = AutoRagSearchResponse & {\n    response: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use the new AI Search API instead: `env.AI.aiSearch`\n *\n * Migration guide:\n * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`\n * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n *\n * @see AiSearchAccountService\n * @see AiSearchInstanceService\n */\ndeclare abstract class AutoRAG {\n    /**\n     * @deprecated Use `env.AI.aiSearch.list()` instead.\n     * @see AiSearchAccountService.list\n     */\n    list(): Promise<AutoRagListResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.\n     * Note: The new API uses a messages array instead of a query string.\n     * @see AiSearchInstanceService.search\n     */\n    search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;\n}\ninterface BasicImageTransformations {\n    /**\n     * Maximum width in image pixels. The value must be an integer.\n     */\n    width?: number;\n    /**\n     * Maximum height in image pixels. The value must be an integer.\n     */\n    height?: number;\n    /**\n     * Resizing mode as a string. It affects interpretation of width and height\n     * options:\n     *  - scale-down: Similar to contain, but the image is never enlarged. If\n     *    the image is larger than given width or height, it will be resized.\n     *    Otherwise its original size will be kept.\n     *  - contain: Resizes to maximum size that fits within the given width and\n     *    height. If only a single dimension is given (e.g. only width), the\n     *    image will be shrunk or enlarged to exactly match that dimension.\n     *    Aspect ratio is always preserved.\n     *  - cover: Resizes (shrinks or enlarges) to fill the entire area of width\n     *    and height. If the image has an aspect ratio different from the ratio\n     *    of width and height, it will be cropped to fit.\n     *  - crop: The image will be shrunk and cropped to fit within the area\n     *    specified by width and height. The image will not be enlarged. For images\n     *    smaller than the given dimensions it's the same as scale-down. For\n     *    images larger than the given dimensions, it's the same as cover.\n     *    See also trim.\n     *  - pad: Resizes to the maximum size that fits within the given width and\n     *    height, and then fills the remaining area with a background color\n     *    (white by default). Use of this mode is not recommended, as the same\n     *    effect can be more efficiently achieved with the contain mode and the\n     *    CSS object-fit: contain property.\n     *  - squeeze: Stretches and deforms to the width and height given, even if it\n     *    breaks aspect ratio\n     */\n    fit?: \"scale-down\" | \"contain\" | \"cover\" | \"crop\" | \"pad\" | \"squeeze\";\n    /**\n     * Image segmentation using artificial intelligence models. Sets pixels not\n     * within selected segment area to transparent e.g \"foreground\" sets every\n     * background pixel as transparent.\n     */\n    segment?: \"foreground\";\n    /**\n     * When cropping with fit: \"cover\", this defines the side or point that should\n     * be left uncropped. The value is either a string\n     * \"left\", \"right\", \"top\", \"bottom\", \"auto\", or \"center\" (the default),\n     * or an object {x, y} containing focal point coordinates in the original\n     * image expressed as fractions ranging from 0.0 (top or left) to 1.0\n     * (bottom or right), 0.5 being the center. {fit: \"cover\", gravity: \"top\"} will\n     * crop bottom or left and right sides as necessary, but won’t crop anything\n     * from the top. {fit: \"cover\", gravity: {x:0.5, y:0.2}} will crop each side to\n     * preserve as much as possible around a point at 20% of the height of the\n     * source image.\n     */\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;\n    /**\n     * Background color to add underneath the image. Applies only to images with\n     * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),\n     * hsl(…), etc.)\n     */\n    background?: string;\n    /**\n     * Number of degrees (90, 180, 270) to rotate the image by. width and height\n     * options refer to axes after rotation.\n     */\n    rotate?: 0 | 90 | 180 | 270 | 360;\n}\ninterface BasicImageTransformationsGravityCoordinates {\n    x?: number;\n    y?: number;\n    mode?: 'remainder' | 'box-center';\n}\n/**\n * In addition to the properties you can set in the RequestInit dict\n * that you pass as an argument to the Request constructor, you can\n * set certain properties of a `cf` object to control how Cloudflare\n * features are applied to that new Request.\n *\n * Note: Currently, these properties cannot be tested in the\n * playground.\n */\ninterface RequestInitCfProperties extends Record<string, unknown> {\n    cacheEverything?: boolean;\n    /**\n     * A request's cache key is what determines if two requests are\n     * \"the same\" for caching purposes. If a request has the same cache key\n     * as some previous request, then we can serve the same cached response for\n     * both. (e.g. 'some-key')\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheKey?: string;\n    /**\n     * This allows you to append additional Cache-Tag response headers\n     * to the origin response without modifications to the origin server.\n     * This will allow for greater control over the Purge by Cache Tag feature\n     * utilizing changes only in the Workers process.\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheTags?: string[];\n    /**\n     * Force response to be cached for a given number of seconds. (e.g. 300)\n     */\n    cacheTtl?: number;\n    /**\n     * Force response to be cached for a given number of seconds based on the Origin status code.\n     * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })\n     */\n    cacheTtlByStatus?: Record<string, number>;\n    scrapeShield?: boolean;\n    apps?: boolean;\n    image?: RequestInitCfPropertiesImage;\n    minify?: RequestInitCfPropertiesImageMinify;\n    mirage?: boolean;\n    polish?: \"lossy\" | \"lossless\" | \"off\";\n    r2?: RequestInitCfPropertiesR2;\n    /**\n     * Redirects the request to an alternate origin server. You can use this,\n     * for example, to implement load balancing across several origins.\n     * (e.g.us-east.example.com)\n     *\n     * Note - For security reasons, the hostname set in resolveOverride must\n     * be proxied on the same Cloudflare zone of the incoming request.\n     * Otherwise, the setting is ignored. CNAME hosts are allowed, so to\n     * resolve to a host under a different domain or a DNS only domain first\n     * declare a CNAME record within your own zone’s DNS mapping to the\n     * external hostname, set proxy on Cloudflare, then set resolveOverride\n     * to point to that CNAME record.\n     */\n    resolveOverride?: string;\n}\ninterface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {\n    /**\n     * Absolute URL of the image file to use for the drawing. It can be any of\n     * the supported file formats. For drawing of watermarks or non-rectangular\n     * overlays we recommend using PNG or WebP images.\n     */\n    url: string;\n    /**\n     * Floating-point number between 0 (transparent) and 1 (opaque).\n     * For example, opacity: 0.5 makes overlay semitransparent.\n     */\n    opacity?: number;\n    /**\n     * - If set to true, the overlay image will be tiled to cover the entire\n     *   area. This is useful for stock-photo-like watermarks.\n     * - If set to \"x\", the overlay image will be tiled horizontally only\n     *   (form a line).\n     * - If set to \"y\", the overlay image will be tiled vertically only\n     *   (form a line).\n     */\n    repeat?: true | \"x\" | \"y\";\n    /**\n     * Position of the overlay image relative to a given edge. Each property is\n     * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10\n     * positions left side of the overlay 10 pixels from the left edge of the\n     * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom\n     * of the background image.\n     *\n     * Setting both left & right, or both top & bottom is an error.\n     *\n     * If no position is specified, the image will be centered.\n     */\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n}\ninterface RequestInitCfPropertiesImage extends BasicImageTransformations {\n    /**\n     * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it\n     * easier to specify higher-DPI sizes in <img srcset>.\n     */\n    dpr?: number;\n    /**\n     * Allows you to trim your image. Takes dpr into account and is performed before\n     * resizing or rotation.\n     *\n     * It can be used as:\n     * - left, top, right, bottom - it will specify the number of pixels to cut\n     *   off each side\n     * - width, height - the width/height you'd like to end up with - can be used\n     *   in combination with the properties above\n     * - border - this will automatically trim the surroundings of an image based on\n     *   it's color. It consists of three properties:\n     *    - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)\n     *    - tolerance: difference from color to treat as color\n     *    - keep: the number of pixels of border to keep\n     */\n    trim?: \"border\" | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n    /**\n     * Quality setting from 1-100 (useful values are in 60-90 range). Lower values\n     * make images look worse, but load faster. The default is 85. It applies only\n     * to JPEG and WebP images. It doesn’t have any effect on PNG.\n     */\n    quality?: number | \"low\" | \"medium-low\" | \"medium-high\" | \"high\";\n    /**\n     * Output format to generate. It can be:\n     *  - avif: generate images in AVIF format.\n     *  - webp: generate images in Google WebP format. Set quality to 100 to get\n     *    the WebP-lossless format.\n     *  - json: instead of generating an image, outputs information about the\n     *    image, in JSON format. The JSON object will contain image size\n     *    (before and after resizing), source image’s MIME type, file size, etc.\n     * - jpeg: generate images in JPEG format.\n     * - png: generate images in PNG format.\n     */\n    format?: \"avif\" | \"webp\" | \"json\" | \"jpeg\" | \"png\" | \"baseline-jpeg\" | \"png-force\" | \"svg\";\n    /**\n     * Whether to preserve animation frames from input files. Default is true.\n     * Setting it to false reduces animations to still images. This setting is\n     * recommended when enlarging images or processing arbitrary user content,\n     * because large GIF animations can weigh tens or even hundreds of megabytes.\n     * It is also useful to set anim:false when using format:\"json\" to get the\n     * response quicker without the number of frames.\n     */\n    anim?: boolean;\n    /**\n     * What EXIF data should be preserved in the output image. Note that EXIF\n     * rotation and embedded color profiles are always applied (\"baked in\" into\n     * the image), and aren't affected by this option. Note that if the Polish\n     * feature is enabled, all metadata may have been removed already and this\n     * option may have no effect.\n     *  - keep: Preserve most of EXIF metadata, including GPS location if there's\n     *    any.\n     *  - copyright: Only keep the copyright tag, and discard everything else.\n     *    This is the default behavior for JPEG files.\n     *  - none: Discard all invisible EXIF metadata. Currently WebP and PNG\n     *    output formats always discard metadata.\n     */\n    metadata?: \"keep\" | \"copyright\" | \"none\";\n    /**\n     * Strength of sharpening filter to apply to the image. Floating-point\n     * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a\n     * recommended value for downscaled images.\n     */\n    sharpen?: number;\n    /**\n     * Radius of a blur filter (approximate gaussian). Maximum supported radius\n     * is 250.\n     */\n    blur?: number;\n    /**\n     * Overlays are drawn in the order they appear in the array (last array\n     * entry is the topmost layer).\n     */\n    draw?: RequestInitCfPropertiesImageDraw[];\n    /**\n     * Fetching image from authenticated origin. Setting this property will\n     * pass authentication headers (Authorization, Cookie, etc.) through to\n     * the origin.\n     */\n    \"origin-auth\"?: \"share-publicly\";\n    /**\n     * Adds a border around the image. The border is added after resizing. Border\n     * width takes dpr into account, and can be specified either using a single\n     * width property, or individually for each side.\n     */\n    border?: {\n        color: string;\n        width: number;\n    } | {\n        color: string;\n        top: number;\n        right: number;\n        bottom: number;\n        left: number;\n    };\n    /**\n     * Increase brightness by a factor. A value of 1.0 equals no change, a value\n     * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.\n     * 0 is ignored.\n     */\n    brightness?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    contrast?: number;\n    /**\n     * Increase exposure by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.\n     */\n    gamma?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    saturation?: number;\n    /**\n     * Flips the images horizontally, vertically, or both. Flipping is applied before\n     * rotation, so if you apply flip=h,rotate=90 then the image will be flipped\n     * horizontally, then rotated by 90 degrees.\n     */\n    flip?: 'h' | 'v' | 'hv';\n    /**\n     * Slightly reduces latency on a cache miss by selecting a\n     * quickest-to-compress file format, at a cost of increased file size and\n     * lower image quality. It will usually override the format option and choose\n     * JPEG over WebP or AVIF. We do not recommend using this option, except in\n     * unusual circumstances like resizing uncacheable dynamically-generated\n     * images.\n     */\n    compression?: \"fast\";\n}\ninterface RequestInitCfPropertiesImageMinify {\n    javascript?: boolean;\n    css?: boolean;\n    html?: boolean;\n}\ninterface RequestInitCfPropertiesR2 {\n    /**\n     * Colo id of bucket that an object is stored in\n     */\n    bucketColoId?: number;\n}\n/**\n * Request metadata provided by Cloudflare's edge.\n */\ntype IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;\ninterface IncomingRequestCfPropertiesBase extends Record<string, unknown> {\n    /**\n     * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.\n     *\n     * @example 395747\n     */\n    asn?: number;\n    /**\n     * The organization which owns the ASN of the incoming request.\n     *\n     * @example \"Google Cloud\"\n     */\n    asOrganization?: string;\n    /**\n     * The original value of the `Accept-Encoding` header if Cloudflare modified it.\n     *\n     * @example \"gzip, deflate, br\"\n     */\n    clientAcceptEncoding?: string;\n    /**\n     * The number of milliseconds it took for the request to reach your worker.\n     *\n     * @example 22\n     */\n    clientTcpRtt?: number;\n    /**\n     * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)\n     * airport code of the data center that the request hit.\n     *\n     * @example \"DFW\"\n     */\n    colo: string;\n    /**\n     * Represents the upstream's response to a\n     * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)\n     * from cloudflare.\n     *\n     * For workers with no upstream, this will always be `1`.\n     *\n     * @example 3\n     */\n    edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;\n    /**\n     * The HTTP Protocol the request used.\n     *\n     * @example \"HTTP/2\"\n     */\n    httpProtocol: string;\n    /**\n     * The browser-requested prioritization information in the request object.\n     *\n     * If no information was set, defaults to the empty string `\"\"`\n     *\n     * @example \"weight=192;exclusive=0;group=3;group-weight=127\"\n     * @default \"\"\n     */\n    requestPriority: string;\n    /**\n     * The TLS version of the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"TLSv1.3\"\n     */\n    tlsVersion: string;\n    /**\n     * The cipher for the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"AEAD-AES128-GCM-SHA256\"\n     */\n    tlsCipher: string;\n    /**\n     * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.\n     *\n     * If the incoming request was served over plaintext (without TLS) this field is undefined.\n     */\n    tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;\n}\ninterface IncomingRequestCfPropertiesBotManagementBase {\n    /**\n     * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,\n     * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).\n     *\n     * @example 54\n     */\n    score: number;\n    /**\n     * A boolean value that is true if the request comes from a good bot, like Google or Bing.\n     * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).\n     */\n    verifiedBot: boolean;\n    /**\n     * A boolean value that is true if the request originates from a\n     * Cloudflare-verified proxy service.\n     */\n    corporateProxy: boolean;\n    /**\n     * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.\n     */\n    staticResource: boolean;\n    /**\n     * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).\n     */\n    detectionIds: number[];\n}\ninterface IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase;\n    /**\n     * Duplicate of `botManagement.score`.\n     *\n     * @deprecated\n     */\n    clientTrustScore: number;\n}\ninterface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase & {\n        /**\n         * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients\n         * across different destination IPs, Ports, and X509 certificates.\n         */\n        ja3Hash: string;\n    };\n}\ninterface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {\n    /**\n     * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).\n     *\n     * This field is only present if you have Cloudflare for SaaS enabled on your account\n     * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).\n     */\n    hostMetadata?: HostMetadata;\n}\ninterface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {\n    /**\n     * Information about the client certificate presented to Cloudflare.\n     *\n     * This is populated when the incoming request is served over TLS using\n     * either Cloudflare Access or API Shield (mTLS)\n     * and the presented SSL certificate has a valid\n     * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)\n     * (i.e., not `null` or `\"\"`).\n     *\n     * Otherwise, a set of placeholder values are used.\n     *\n     * The property `certPresented` will be set to `\"1\"` when\n     * the object is populated (i.e. the above conditions were met).\n     */\n    tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;\n}\n/**\n * Metadata about the request's TLS handshake\n */\ninterface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {\n    /**\n     * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    clientHandshake: string;\n    /**\n     * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    serverHandshake: string;\n    /**\n     * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    clientFinished: string;\n    /**\n     * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    serverFinished: string;\n}\n/**\n * Geographic data about the request's origin.\n */\ninterface IncomingRequestCfPropertiesGeographicInformation {\n    /**\n     * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.\n     *\n     * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `\"T1\"`, indicating a request that originated over TOR.\n     *\n     * If Cloudflare is unable to determine where the request originated this property is omitted.\n     *\n     * The country code `\"T1\"` is used for requests originating on TOR.\n     *\n     * @example \"GB\"\n     */\n    country?: Iso3166Alpha2Code | \"T1\";\n    /**\n     * If present, this property indicates that the request originated in the EU\n     *\n     * @example \"1\"\n     */\n    isEUCountry?: \"1\";\n    /**\n     * A two-letter code indicating the continent the request originated from.\n     *\n     * @example \"AN\"\n     */\n    continent?: ContinentCode;\n    /**\n     * The city the request originated from\n     *\n     * @example \"Austin\"\n     */\n    city?: string;\n    /**\n     * Postal code of the incoming request\n     *\n     * @example \"78701\"\n     */\n    postalCode?: string;\n    /**\n     * Latitude of the incoming request\n     *\n     * @example \"30.27130\"\n     */\n    latitude?: string;\n    /**\n     * Longitude of the incoming request\n     *\n     * @example \"-97.74260\"\n     */\n    longitude?: string;\n    /**\n     * Timezone of the incoming request\n     *\n     * @example \"America/Chicago\"\n     */\n    timezone?: string;\n    /**\n     * If known, the ISO 3166-2 name for the first level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"Texas\"\n     */\n    region?: string;\n    /**\n     * If known, the ISO 3166-2 code for the first-level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"TX\"\n     */\n    regionCode?: string;\n    /**\n     * Metro code (DMA) of the incoming request\n     *\n     * @example \"635\"\n     */\n    metroCode?: string;\n}\n/** Data about the incoming request's TLS certificate */\ninterface IncomingRequestCfPropertiesTLSClientAuth {\n    /** Always `\"1\"`, indicating that the certificate was presented */\n    certPresented: \"1\";\n    /**\n     * Result of certificate verification.\n     *\n     * @example \"FAILED:self signed certificate\"\n     */\n    certVerified: Exclude<CertVerificationStatus, \"NONE\">;\n    /** The presented certificate's revokation status.\n     *\n     * - A value of `\"1\"` indicates the certificate has been revoked\n     * - A value of `\"0\"` indicates the certificate has not been revoked\n     */\n    certRevoked: \"1\" | \"0\";\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDN: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDN: string;\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDNRFC2253: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDNRFC2253: string;\n    /** The certificate issuer's distinguished name (legacy policies) */\n    certIssuerDNLegacy: string;\n    /** The certificate subject's distinguished name (legacy policies) */\n    certSubjectDNLegacy: string;\n    /**\n     * The certificate's serial number\n     *\n     * @example \"00936EACBE07F201DF\"\n     */\n    certSerial: string;\n    /**\n     * The certificate issuer's serial number\n     *\n     * @example \"2489002934BDFEA34\"\n     */\n    certIssuerSerial: string;\n    /**\n     * The certificate's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certSKI: string;\n    /**\n     * The certificate issuer's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certIssuerSKI: string;\n    /**\n     * The certificate's SHA-1 fingerprint\n     *\n     * @example \"6b9109f323999e52259cda7373ff0b4d26bd232e\"\n     */\n    certFingerprintSHA1: string;\n    /**\n     * The certificate's SHA-256 fingerprint\n     *\n     * @example \"acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea\"\n     */\n    certFingerprintSHA256: string;\n    /**\n     * The effective starting date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotBefore: string;\n    /**\n     * The effective expiration date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotAfter: string;\n}\n/** Placeholder values for TLS Client Authorization */\ninterface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {\n    certPresented: \"0\";\n    certVerified: \"NONE\";\n    certRevoked: \"0\";\n    certIssuerDN: \"\";\n    certSubjectDN: \"\";\n    certIssuerDNRFC2253: \"\";\n    certSubjectDNRFC2253: \"\";\n    certIssuerDNLegacy: \"\";\n    certSubjectDNLegacy: \"\";\n    certSerial: \"\";\n    certIssuerSerial: \"\";\n    certSKI: \"\";\n    certIssuerSKI: \"\";\n    certFingerprintSHA1: \"\";\n    certFingerprintSHA256: \"\";\n    certNotBefore: \"\";\n    certNotAfter: \"\";\n}\n/** Possible outcomes of TLS verification */\ndeclare type CertVerificationStatus = \n/** Authentication succeeded */\n\"SUCCESS\"\n/** No certificate was presented */\n | \"NONE\"\n/** Failed because the certificate was self-signed */\n | \"FAILED:self signed certificate\"\n/** Failed because the certificate failed a trust chain check */\n | \"FAILED:unable to verify the first certificate\"\n/** Failed because the certificate not yet valid */\n | \"FAILED:certificate is not yet valid\"\n/** Failed because the certificate is expired */\n | \"FAILED:certificate has expired\"\n/** Failed for another unspecified reason */\n | \"FAILED\";\n/**\n * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.\n */\ndeclare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = 0 /** Unknown */ | 1 /** no keepalives (not found) */ | 2 /** no connection re-use, opening keepalive connection failed */ | 3 /** no connection re-use, keepalive accepted and saved */ | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ | 5; /** connection re-use, accepted by the origin server */\n/** ISO 3166-1 Alpha-2 codes */\ndeclare type Iso3166Alpha2Code = \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\";\n/** The 2-letter continent codes Cloudflare uses */\ndeclare type ContinentCode = \"AF\" | \"AN\" | \"AS\" | \"EU\" | \"NA\" | \"OC\" | \"SA\";\ntype CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;\ninterface D1Meta {\n    duration: number;\n    size_after: number;\n    rows_read: number;\n    rows_written: number;\n    last_row_id: number;\n    changed_db: boolean;\n    changes: number;\n    /**\n     * The region of the database instance that executed the query.\n     */\n    served_by_region?: string;\n    /**\n     * The three letters airport code of the colo that executed the query.\n     */\n    served_by_colo?: string;\n    /**\n     * True if-and-only-if the database instance that executed the query was the primary.\n     */\n    served_by_primary?: boolean;\n    timings?: {\n        /**\n         * The duration of the SQL query execution by the database instance. It doesn't include any network time.\n         */\n        sql_duration_ms: number;\n    };\n    /**\n     * Number of total attempts to execute the query, due to automatic retries.\n     * Note: All other fields in the response like `timings` only apply to the last attempt.\n     */\n    total_attempts?: number;\n}\ninterface D1Response {\n    success: true;\n    meta: D1Meta & Record<string, unknown>;\n    error?: never;\n}\ntype D1Result<T = unknown> = D1Response & {\n    results: T[];\n};\ninterface D1ExecResult {\n    count: number;\n    duration: number;\n}\ntype D1SessionConstraint = \n// Indicates that the first query should go to the primary, and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n'first-primary'\n// Indicates that the first query can go anywhere (primary or replica), and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n | 'first-unconstrained';\ntype D1SessionBookmark = string;\ndeclare abstract class D1Database {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    exec(query: string): Promise<D1ExecResult>;\n    /**\n     * Creates a new D1 Session anchored at the given constraint or the bookmark.\n     * All queries executed using the created session will have sequential consistency,\n     * meaning that all writes done through the session will be visible in subsequent reads.\n     *\n     * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.\n     */\n    withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;\n    /**\n     * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.\n     */\n    dump(): Promise<ArrayBuffer>;\n}\ndeclare abstract class D1DatabaseSession {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    /**\n     * @returns The latest session bookmark across all executed queries on the session.\n     *          If no query has been executed yet, `null` is returned.\n     */\n    getBookmark(): D1SessionBookmark | null;\n}\ndeclare abstract class D1PreparedStatement {\n    bind(...values: unknown[]): D1PreparedStatement;\n    first<T = unknown>(colName: string): Promise<T | null>;\n    first<T = Record<string, unknown>>(): Promise<T | null>;\n    run<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    all<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    raw<T = unknown[]>(options: {\n        columnNames: true;\n    }): Promise<[\n        string[],\n        ...T[]\n    ]>;\n    raw<T = unknown[]>(options?: {\n        columnNames?: false;\n    }): Promise<T[]>;\n}\n// `Disposable` was added to TypeScript's standard lib types in version 5.2.\n// To support older TypeScript versions, define an empty `Disposable` interface.\n// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,\n// but this will ensure type checking on older versions still passes.\n// TypeScript's interface merging will ensure our empty interface is effectively\n// ignored when `Disposable` is included in the standard lib.\ninterface Disposable {\n}\n/**\n * The returned data after sending an email\n */\ninterface EmailSendResult {\n    /**\n     * The Email Message ID\n     */\n    messageId: string;\n}\n/**\n * An email message that can be sent from a Worker.\n */\ninterface EmailMessage {\n    /**\n     * Envelope From attribute of the email message.\n     */\n    readonly from: string;\n    /**\n     * Envelope To attribute of the email message.\n     */\n    readonly to: string;\n}\n/**\n * An email message that is sent to a consumer Worker and can be rejected/forwarded.\n */\ninterface ForwardableEmailMessage extends EmailMessage {\n    /**\n     * Stream of the email message content.\n     */\n    readonly raw: ReadableStream<Uint8Array>;\n    /**\n     * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     */\n    readonly headers: Headers;\n    /**\n     * Size of the email message content.\n     */\n    readonly rawSize: number;\n    /**\n     * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.\n     * @param reason The reject reason.\n     * @returns void\n     */\n    setReject(reason: string): void;\n    /**\n     * Forward this email message to a verified destination address of the account.\n     * @param rcptTo Verified destination address.\n     * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     * @returns A promise that resolves when the email message is forwarded.\n     */\n    forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;\n    /**\n     * Reply to the sender of this email message with a new EmailMessage object.\n     * @param message The reply message.\n     * @returns A promise that resolves when the email message is replied.\n     */\n    reply(message: EmailMessage): Promise<EmailSendResult>;\n}\n/** A file attachment for an email message */\ntype EmailAttachment = {\n    disposition: 'inline';\n    contentId: string;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n} | {\n    disposition: 'attachment';\n    contentId?: undefined;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n};\n/** An Email Address */\ninterface EmailAddress {\n    name: string;\n    email: string;\n}\n/**\n * A binding that allows a Worker to send email messages.\n */\ninterface SendEmail {\n    send(message: EmailMessage): Promise<EmailSendResult>;\n    send(builder: {\n        from: string | EmailAddress;\n        to: string | string[];\n        subject: string;\n        replyTo?: string | EmailAddress;\n        cc?: string | string[];\n        bcc?: string | string[];\n        headers?: Record<string, string>;\n        text?: string;\n        html?: string;\n        attachments?: EmailAttachment[];\n    }): Promise<EmailSendResult>;\n}\ndeclare abstract class EmailEvent extends ExtendableEvent {\n    readonly message: ForwardableEmailMessage;\n}\ndeclare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ndeclare module \"cloudflare:email\" {\n    let _EmailMessage: {\n        prototype: EmailMessage;\n        new (from: string, to: string, raw: ReadableStream | string): EmailMessage;\n    };\n    export { _EmailMessage as EmailMessage };\n}\n/**\n * Hello World binding to serve as an explanatory example. DO NOT USE\n */\ninterface HelloWorldBinding {\n    /**\n     * Retrieve the current stored value\n     */\n    get(): Promise<{\n        value: string;\n        ms?: number;\n    }>;\n    /**\n     * Set a new stored value\n     */\n    set(value: string): Promise<void>;\n}\ninterface Hyperdrive {\n    /**\n     * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.\n     *\n     * Calling this method returns an identical socket to if you call\n     * `connect(\"host:port\")` using the `host` and `port` fields from this object.\n     * Pick whichever approach works better with your preferred DB client library.\n     *\n     * Note that this socket is not yet authenticated -- it's expected that your\n     * code (or preferably, the client library of your choice) will authenticate\n     * using the information in this class's readonly fields.\n     */\n    connect(): Socket;\n    /**\n     * A valid DB connection string that can be passed straight into the typical\n     * client library/driver/ORM. This will typically be the easiest way to use\n     * Hyperdrive.\n     */\n    readonly connectionString: string;\n    /*\n     * A randomly generated hostname that is only valid within the context of the\n     * currently running Worker which, when passed into `connect()` function from\n     * the \"cloudflare:sockets\" module, will connect to the Hyperdrive instance\n     * for your database.\n     */\n    readonly host: string;\n    /*\n     * The port that must be paired the the host field when connecting.\n     */\n    readonly port: number;\n    /*\n     * The username to use when authenticating to your database via Hyperdrive.\n     * Unlike the host and password, this will be the same every time\n     */\n    readonly user: string;\n    /*\n     * The randomly generated password to use when authenticating to your\n     * database via Hyperdrive. Like the host field, this password is only valid\n     * within the context of the currently running Worker instance from which\n     * it's read.\n     */\n    readonly password: string;\n    /*\n     * The name of the database to connect to.\n     */\n    readonly database: string;\n}\n// Copyright (c) 2024 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ntype ImageInfoResponse = {\n    format: 'image/svg+xml';\n} | {\n    format: string;\n    fileSize: number;\n    width: number;\n    height: number;\n};\ntype ImageTransform = {\n    width?: number;\n    height?: number;\n    background?: string;\n    blur?: number;\n    border?: {\n        color?: string;\n        width?: number;\n    } | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n    };\n    brightness?: number;\n    contrast?: number;\n    fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';\n    flip?: 'h' | 'v' | 'hv';\n    gamma?: number;\n    segment?: 'foreground';\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {\n        x?: number;\n        y?: number;\n        mode: 'remainder' | 'box-center';\n    };\n    rotate?: 0 | 90 | 180 | 270;\n    saturation?: number;\n    sharpen?: number;\n    trim?: 'border' | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n};\ntype ImageDrawOptions = {\n    opacity?: number;\n    repeat?: boolean | string;\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n};\ntype ImageInputOptions = {\n    encoding?: 'base64';\n};\ntype ImageOutputOptions = {\n    format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';\n    quality?: number;\n    background?: string;\n    anim?: boolean;\n};\ninterface ImageMetadata {\n    id: string;\n    filename?: string;\n    uploaded?: string;\n    requireSignedURLs: boolean;\n    meta?: Record<string, unknown>;\n    variants: string[];\n    draft?: boolean;\n    creator?: string;\n}\ninterface ImageUploadOptions {\n    id?: string;\n    filename?: string;\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n    encoding?: 'base64';\n}\ninterface ImageUpdateOptions {\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n}\ninterface ImageListOptions {\n    limit?: number;\n    cursor?: string;\n    sortOrder?: 'asc' | 'desc';\n    creator?: string;\n}\ninterface ImageList {\n    images: ImageMetadata[];\n    cursor?: string;\n    listComplete: boolean;\n}\ninterface HostedImagesBinding {\n    /**\n     * Get detailed metadata for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns Image metadata, or null if not found\n     */\n    details(imageId: string): Promise<ImageMetadata | null>;\n    /**\n     * Get the raw image data for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns ReadableStream of image bytes, or null if not found\n     */\n    image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;\n    /**\n     * Upload a new hosted image\n     * @param image The image file to upload\n     * @param options Upload configuration\n     * @returns Metadata for the uploaded image\n     * @throws {@link ImagesError} if upload fails\n     */\n    upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;\n    /**\n     * Update hosted image metadata\n     * @param imageId The ID of the image\n     * @param options Properties to update\n     * @returns Updated image metadata\n     * @throws {@link ImagesError} if update fails\n     */\n    update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;\n    /**\n     * Delete a hosted image\n     * @param imageId The ID of the image\n     * @returns True if deleted, false if not found\n     */\n    delete(imageId: string): Promise<boolean>;\n    /**\n     * List hosted images with pagination\n     * @param options List configuration\n     * @returns List of images with pagination info\n     * @throws {@link ImagesError} if list fails\n     */\n    list(options?: ImageListOptions): Promise<ImageList>;\n}\ninterface ImagesBinding {\n    /**\n     * Get image metadata (type, width and height)\n     * @throws {@link ImagesError} with code 9412 if input is not an image\n     * @param stream The image bytes\n     */\n    info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;\n    /**\n     * Begin applying a series of transformations to an image\n     * @param stream The image bytes\n     * @returns A transform handle\n     */\n    input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;\n    /**\n     * Access hosted images CRUD operations\n     */\n    readonly hosted: HostedImagesBinding;\n}\ninterface ImageTransformer {\n    /**\n     * Apply transform next, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param transform\n     */\n    transform(transform: ImageTransform): ImageTransformer;\n    /**\n     * Draw an image on this transformer, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param image The image (or transformer that will give the image) to draw\n     * @param options The options configuring how to draw the image\n     */\n    draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;\n    /**\n     * Retrieve the image that results from applying the transforms to the\n     * provided input\n     * @param options Options that apply to the output e.g. output format\n     */\n    output(options: ImageOutputOptions): Promise<ImageTransformationResult>;\n}\ntype ImageTransformationOutputOptions = {\n    encoding?: 'base64';\n};\ninterface ImageTransformationResult {\n    /**\n     * The image as a response, ready to store in cache or return to users\n     */\n    response(): Response;\n    /**\n     * The content type of the returned image\n     */\n    contentType(): string;\n    /**\n     * The bytes of the response\n     */\n    image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;\n}\ninterface ImagesError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\n/**\n * Media binding for transforming media streams.\n * Provides the entry point for media transformation operations.\n */\ninterface MediaBinding {\n    /**\n     * Creates a media transformer from an input stream.\n     * @param media - The input media bytes\n     * @returns A MediaTransformer instance for applying transformations\n     */\n    input(media: ReadableStream<Uint8Array>): MediaTransformer;\n}\n/**\n * Media transformer for applying transformation operations to media content.\n * Handles sizing, fitting, and other input transformation parameters.\n */\ninterface MediaTransformer {\n    /**\n     * Applies transformation options to the media content.\n     * @param transform - Configuration for how the media should be transformed\n     * @returns A generator for producing the transformed media output\n     */\n    transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Generator for producing media transformation results.\n * Configures the output format and parameters for the transformed media.\n */\ninterface MediaTransformationGenerator {\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Result of a media transformation operation.\n * Provides multiple ways to access the transformed media content.\n */\ninterface MediaTransformationResult {\n    /**\n     * Returns the transformed media as a readable stream of bytes.\n     * @returns A promise containing a readable stream with the transformed media\n     */\n    media(): Promise<ReadableStream<Uint8Array>>;\n    /**\n     * Returns the transformed media as an HTTP response object.\n     * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users\n     */\n    response(): Promise<Response>;\n    /**\n     * Returns the MIME type of the transformed media.\n     * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')\n     */\n    contentType(): Promise<string>;\n}\n/**\n * Configuration options for transforming media input.\n * Controls how the media should be resized and fitted.\n */\ntype MediaTransformationInputOptions = {\n    /** How the media should be resized to fit the specified dimensions */\n    fit?: 'contain' | 'cover' | 'scale-down';\n    /** Target width in pixels */\n    width?: number;\n    /** Target height in pixels */\n    height?: number;\n};\n/**\n * Configuration options for Media Transformations output.\n * Controls the format, timing, and type of the generated output.\n */\ntype MediaTransformationOutputOptions = {\n    /**\n     * Output mode determining the type of media to generate\n     */\n    mode?: 'video' | 'spritesheet' | 'frame' | 'audio';\n    /** Whether to include audio in the output */\n    audio?: boolean;\n    /**\n     * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').\n     */\n    time?: string;\n    /**\n     * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').\n     */\n    duration?: string;\n    /**\n     * Number of frames in the spritesheet.\n     */\n    imageCount?: number;\n    /**\n     * Output format for the generated media.\n     */\n    format?: 'jpg' | 'png' | 'm4a';\n};\n/**\n * Error object for media transformation operations.\n * Extends the standard Error interface with additional media-specific information.\n */\ninterface MediaError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ndeclare module 'cloudflare:node' {\n    interface NodeStyleServer {\n        listen(...args: unknown[]): this;\n        address(): {\n            port?: number | null | undefined;\n        };\n    }\n    export function httpServerHandler(port: number): ExportedHandler;\n    export function httpServerHandler(options: {\n        port: number;\n    }): ExportedHandler;\n    export function httpServerHandler(server: NodeStyleServer): ExportedHandler;\n}\ntype Params<P extends string = any> = Record<P, string | string[]>;\ntype EventContext<Env, P extends string, Data> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n};\ntype PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;\ntype EventPluginContext<Env, P extends string, Data, PluginArgs> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n    pluginArgs: PluginArgs;\n};\ntype PagesPluginFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>, PluginArgs = unknown> = (context: EventPluginContext<Env, Params, Data, PluginArgs>) => Response | Promise<Response>;\ndeclare module \"assets:*\" {\n    export const onRequest: PagesFunction;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ndeclare module \"cloudflare:pipelines\" {\n    export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {\n        protected env: Env;\n        protected ctx: ExecutionContext;\n        constructor(ctx: ExecutionContext, env: Env);\n        /**\n         * run receives an array of PipelineRecord which can be\n         * transformed and returned to the pipeline\n         * @param records Incoming records from the pipeline to be transformed\n         * @param metadata Information about the specific pipeline calling the transformation entrypoint\n         * @returns A promise containing the transformed PipelineRecord array\n         */\n        public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;\n    }\n    export type PipelineRecord = Record<string, unknown>;\n    export type PipelineBatchMetadata = {\n        pipelineId: string;\n        pipelineName: string;\n    };\n    export interface Pipeline<T extends PipelineRecord = PipelineRecord> {\n        /**\n         * The Pipeline interface represents the type of a binding to a Pipeline\n         *\n         * @param records The records to send to the pipeline\n         */\n        send(records: T[]): Promise<void>;\n    }\n}\n// PubSubMessage represents an incoming PubSub message.\n// The message includes metadata about the broker, the client, and the payload\n// itself.\n// https://developers.cloudflare.com/pub-sub/\ninterface PubSubMessage {\n    // Message ID\n    readonly mid: number;\n    // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT\n    readonly broker: string;\n    // The MQTT topic the message was sent on.\n    readonly topic: string;\n    // The client ID of the client that published this message.\n    readonly clientId: string;\n    // The unique identifier (JWT ID) used by the client to authenticate, if token\n    // auth was used.\n    readonly jti?: string;\n    // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker\n    // received the message from the client.\n    readonly receivedAt: number;\n    // An (optional) string with the MIME type of the payload, if set by the\n    // client.\n    readonly contentType: string;\n    // Set to 1 when the payload is a UTF-8 string\n    // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063\n    readonly payloadFormatIndicator: number;\n    // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.\n    // You can use payloadFormatIndicator to inspect this before decoding.\n    payload: string | Uint8Array;\n}\n// JsonWebKey extended by kid parameter\ninterface JsonWebKeyWithKid extends JsonWebKey {\n    // Key Identifier of the JWK\n    readonly kid: string;\n}\ninterface RateLimitOptions {\n    key: string;\n}\ninterface RateLimitOutcome {\n    success: boolean;\n}\ninterface RateLimit {\n    /**\n     * Rate limit a request based on the provided options.\n     * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/\n     * @returns A promise that resolves with the outcome of the rate limit.\n     */\n    limit(options: RateLimitOptions): Promise<RateLimitOutcome>;\n}\n// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need\n// to referenced by `Fetcher`. This is included in the \"importable\" version of the types which\n// strips all `module` blocks.\ndeclare namespace Rpc {\n    // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.\n    // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.\n    // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to\n    // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)\n    export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';\n    export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';\n    export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';\n    export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';\n    export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';\n    export interface RpcTargetBranded {\n        [__RPC_TARGET_BRAND]: never;\n    }\n    export interface WorkerEntrypointBranded {\n        [__WORKER_ENTRYPOINT_BRAND]: never;\n    }\n    export interface DurableObjectBranded {\n        [__DURABLE_OBJECT_BRAND]: never;\n    }\n    export interface WorkflowEntrypointBranded {\n        [__WORKFLOW_ENTRYPOINT_BRAND]: never;\n    }\n    export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;\n    // Types that can be used through `Stub`s\n    export type Stubable = RpcTargetBranded | ((...args: any[]) => any);\n    // Types that can be passed over RPC\n    // The reason for using a generic type here is to build a serializable subset of structured\n    //   cloneable composite types. This allows types defined with the \"interface\" keyword to pass the\n    //   serializable check as well. Otherwise, only types defined with the \"type\" keyword would pass.\n    type Serializable<T> = \n    // Structured cloneables\n    BaseType\n    // Structured cloneable composites\n     | Map<T extends Map<infer U, unknown> ? Serializable<U> : never, T extends Map<unknown, infer U> ? Serializable<U> : never> | Set<T extends Set<infer U> ? Serializable<U> : never> | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never> | {\n        [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;\n    }\n    // Special types\n     | Stub<Stubable>\n    // Serialized as stubs, see `Stubify`\n     | Stubable;\n    // Base type for all RPC stubs, including common memory management methods.\n    // `T` is used as a marker type for unwrapping `Stub`s later.\n    interface StubBase<T extends Stubable> extends Disposable {\n        [__RPC_STUB_BRAND]: T;\n        dup(): this;\n    }\n    export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;\n    // This represents all the types that can be sent as-is over an RPC boundary\n    type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;\n    // Recursively rewrite all `Stubable` types with `Stub`s\n    // prettier-ignore\n    type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, infer V> ? Map<Stubify<K>, Stubify<V>> : T extends Set<infer V> ? Set<Stubify<V>> : T extends Array<infer V> ? Array<Stubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Stubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: any;\n    } ? {\n        [K in keyof T]: Stubify<T[K]>;\n    } : T;\n    // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.\n    // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:\n    // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.\n    // prettier-ignore\n    type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infer K, infer V> ? Map<Unstubify<K>, Unstubify<V>> : T extends Set<infer V> ? Set<Unstubify<V>> : T extends Array<infer V> ? Array<Unstubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Unstubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: unknown;\n    } ? {\n        [K in keyof T]: Unstubify<T[K]>;\n    } : T;\n    type UnstubifyAll<A extends any[]> = {\n        [I in keyof A]: Unstubify<A[I]>;\n    };\n    // Utility type for adding `Provider`/`Disposable`s to `object` types only.\n    // Note `unknown & T` is equivalent to `T`.\n    type MaybeProvider<T> = T extends object ? Provider<T> : unknown;\n    type MaybeDisposable<T> = T extends object ? Disposable : unknown;\n    // Type for method return or property on an RPC interface.\n    // - Stubable types are replaced by stubs.\n    // - Serializable types are passed by value, with stubable types replaced by stubs\n    //   and a top-level `Disposer`.\n    // Everything else can't be passed over PRC.\n    // Technically, we use custom thenables here, but they quack like `Promise`s.\n    // Intersecting with `(Maybe)Provider` allows pipelining.\n    // prettier-ignore\n    type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;\n    // Type for method or property on an RPC interface.\n    // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.\n    // Unwrapping `Stub`s allows calling with `Stubable` arguments.\n    // For properties, rewrite types to be `Result`s.\n    // In each case, unwrap `Promise`s.\n    type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;\n    // Type for the callable part of an `Provider` if `T` is callable.\n    // This is intersected with methods/properties.\n    type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;\n    // Base type for all other types providing RPC-like interfaces.\n    // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.\n    // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.\n    export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{\n        [K in keyof T]: MethodOrProperty<T[K]>;\n    }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;\n}\ndeclare namespace Cloudflare {\n    // Type of `env`.\n    //\n    // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript\n    // will merge all declarations.\n    //\n    // You can use `wrangler types` to generate the `Env` type automatically.\n    interface Env {\n    }\n    // Project-specific parameters used to inform types.\n    //\n    // This interface is, again, intended to be declared in project-specific files, and then that\n    // declaration will be merged with this one.\n    //\n    // A project should have a declaration like this:\n    //\n    //     interface GlobalProps {\n    //       // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type\n    //       // of `ctx.exports`.\n    //       mainModule: typeof import(\"my-main-module\");\n    //\n    //       // Declares which of the main module's exports are configured with durable storage, and\n    //       // thus should behave as Durable Object namsepace bindings.\n    //       durableNamespaces: \"MyDurableObject\" | \"AnotherDurableObject\";\n    //     }\n    //\n    // You can use `wrangler types` to generate `GlobalProps` automatically.\n    interface GlobalProps {\n    }\n    // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not\n    // present.\n    type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;\n    // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the\n    // `mainModule` property.\n    type MainModule = GlobalProp<\"mainModule\", {}>;\n    // The type of ctx.exports, which contains loopback bindings for all top-level exports.\n    type Exports = {\n        [K in keyof MainModule]: LoopbackForExport<MainModule[K]>\n        // If the export is listed in `durableNamespaces`, then it is also a\n        // DurableObjectNamespace.\n         & (K extends GlobalProp<\"durableNamespaces\", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});\n    };\n}\ndeclare namespace CloudflareWorkersModule {\n    export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;\n    export const RpcStub: {\n        new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;\n    };\n    export abstract class RpcTarget implements Rpc.RpcTargetBranded {\n        [Rpc.__RPC_TARGET_BRAND]: never;\n    }\n    // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC\n    export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {\n        [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext<Props>;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        email?(message: ForwardableEmailMessage): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        queue?(batch: MessageBatch<unknown>): void | Promise<void>;\n        scheduled?(controller: ScheduledController): void | Promise<void>;\n        tail?(events: TraceItem[]): void | Promise<void>;\n        tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\n        test?(controller: TestController): void | Promise<void>;\n        trace?(traces: TraceItem[]): void | Promise<void>;\n    }\n    export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {\n        [Rpc.__DURABLE_OBJECT_BRAND]: never;\n        protected ctx: DurableObjectState<Props>;\n        protected env: Env;\n        constructor(ctx: DurableObjectState, env: Env);\n        alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n        webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n        webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n    }\n    export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n    export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\n    export type WorkflowDelayDuration = WorkflowSleepDuration;\n    export type WorkflowTimeoutDuration = WorkflowSleepDuration;\n    export type WorkflowRetentionDuration = WorkflowSleepDuration;\n    export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';\n    export type WorkflowStepConfig = {\n        retries?: {\n            limit: number;\n            delay: WorkflowDelayDuration | number;\n            backoff?: WorkflowBackoff;\n        };\n        timeout?: WorkflowTimeoutDuration | number;\n    };\n    export type WorkflowEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        instanceId: string;\n    };\n    export type WorkflowStepEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        type: string;\n    };\n    export type WorkflowStepContext = {\n        attempt: number;\n    };\n    export abstract class WorkflowStep {\n        do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;\n        sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;\n        waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {\n            type: string;\n            timeout?: WorkflowTimeoutDuration | number;\n        }): Promise<WorkflowStepEvent<T>>;\n    }\n    export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';\n    export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {\n        [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;\n    }\n    export function waitUntil(promise: Promise<unknown>): void;\n    export function withEnv(newEnv: unknown, fn: () => unknown): unknown;\n    export function withExports(newExports: unknown, fn: () => unknown): unknown;\n    export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;\n    export const env: Cloudflare.Env;\n    export const exports: Cloudflare.Exports;\n}\ndeclare module 'cloudflare:workers' {\n    export = CloudflareWorkersModule;\n}\ninterface SecretsStoreSecret {\n    /**\n     * Get a secret from the Secrets Store, returning a string of the secret value\n     * if it exists, or throws an error if it does not exist\n     */\n    get(): Promise<string>;\n}\ndeclare module \"cloudflare:sockets\" {\n    function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;\n    export { _connect as connect };\n}\n/**\n * Binding entrypoint for Cloudflare Stream.\n *\n * Usage:\n * - Binding-level operations:\n *   `await env.STREAM.videos.upload`\n *   `await env.STREAM.videos.createDirectUpload`\n *   `await env.STREAM.videos.*`\n *   `await env.STREAM.watermarks.*`\n * - Per-video operations:\n *   `await env.STREAM.video(id).downloads.*`\n *   `await env.STREAM.video(id).captions.*`\n *\n * Example usage:\n * ```ts\n * await env.STREAM.video(id).downloads.generate();\n *\n * const video = env.STREAM.video(id)\n * const captions = video.captions.list();\n * const videoDetails = video.details()\n * ```\n */\ninterface StreamBinding {\n    /**\n     * Returns a handle scoped to a single video for per-video operations.\n     * @param id The unique identifier for the video.\n     * @returns A handle for per-video operations.\n     */\n    video(id: string): StreamVideoHandle;\n    /**\n     * Uploads a new video from a File.\n     * @param file The video file to upload.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(file: File): Promise<StreamVideo>;\n    /**\n     * Uploads a new video from a provided URL.\n     * @param url The URL to upload from.\n     * @param params Optional upload parameters.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {AlreadyUploadedError} if a video was already uploaded to this URL\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;\n    /**\n     * Creates a direct upload that allows video uploads without an API key.\n     * @param params Parameters for the direct upload\n     * @returns The direct upload details.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;\n    videos: StreamVideos;\n    watermarks: StreamWatermarks;\n}\n/**\n * Handle for operations scoped to a single Stream video.\n */\ninterface StreamVideoHandle {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * Get a full videos details\n     * @returns The full video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    details(): Promise<StreamVideo>;\n    /**\n     * Update details for a single video.\n     * @param params The fields to update for the video.\n     * @returns The updated video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    update(params: StreamUpdateVideoParams): Promise<StreamVideo>;\n    /**\n     * Deletes a video and its copies from Cloudflare Stream.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(): Promise<void>;\n    /**\n     * Creates a signed URL token for a video.\n     * @returns The signed token that was created.\n     * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed\n     */\n    generateToken(): Promise<string>;\n    downloads: StreamScopedDownloads;\n    captions: StreamScopedCaptions;\n}\ninterface StreamVideo {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator: string | null;\n    /**\n     * The thumbnail URL for the video.\n     */\n    thumbnail: string;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct: number;\n    /**\n     * Indicates whether the video is ready to stream.\n     */\n    readyToStream: boolean;\n    /**\n     * The date and time the video became ready to stream.\n     */\n    readyToStreamAt: string | null;\n    /**\n     * Processing status information.\n     */\n    status: StreamVideoStatus;\n    /**\n     * A user modifiable key-value store.\n     */\n    meta: Record<string, string>;\n    /**\n     * The date and time the video was created.\n     */\n    created: string;\n    /**\n     * The date and time the video was last modified.\n     */\n    modified: string;\n    /**\n     * The date and time at which the video will be deleted.\n     */\n    scheduledDeletion: string | null;\n    /**\n     * The size of the video in bytes.\n     */\n    size: number;\n    /**\n     * The preview URL for the video.\n     */\n    preview?: string;\n    /**\n     * Origins allowed to display the video.\n     */\n    allowedOrigins: Array<string>;\n    /**\n     * Indicates whether signed URLs are required.\n     */\n    requireSignedURLs: boolean | null;\n    /**\n     * The date and time the video was uploaded.\n     */\n    uploaded: string | null;\n    /**\n     * The date and time when the upload URL expires.\n     */\n    uploadExpiry: string | null;\n    /**\n     * The maximum size in bytes for direct uploads.\n     */\n    maxSizeBytes: number | null;\n    /**\n     * The maximum duration in seconds for direct uploads.\n     */\n    maxDurationSeconds: number | null;\n    /**\n     * The video duration in seconds. -1 indicates unknown.\n     */\n    duration: number;\n    /**\n     * Input metadata for the original upload.\n     */\n    input: StreamVideoInput;\n    /**\n     * Playback URLs for the video.\n     */\n    hlsPlaybackUrl: string;\n    dashPlaybackUrl: string;\n    /**\n     * The watermark applied to the video, if any.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The live input id associated with the video, if any.\n     */\n    liveInputId?: string | null;\n    /**\n     * The source video id if this is a clip.\n     */\n    clippedFromId: string | null;\n    /**\n     * Public details associated with the video.\n     */\n    publicDetails: StreamPublicDetails | null;\n}\ntype StreamVideoStatus = {\n    /**\n     * The current processing state.\n     */\n    state: string;\n    /**\n     * The current processing step.\n     */\n    step?: string;\n    /**\n     * The percent complete as a string.\n     */\n    pctComplete?: string;\n    /**\n     * An error reason code, if applicable.\n     */\n    errorReasonCode: string;\n    /**\n     * An error reason text, if applicable.\n     */\n    errorReasonText: string;\n};\ntype StreamVideoInput = {\n    /**\n     * The input width in pixels.\n     */\n    width: number;\n    /**\n     * The input height in pixels.\n     */\n    height: number;\n};\ntype StreamPublicDetails = {\n    /**\n     * The public title for the video.\n     */\n    title: string | null;\n    /**\n     * The public share link.\n     */\n    share_link: string | null;\n    /**\n     * The public channel link.\n     */\n    channel_link: string | null;\n    /**\n     * The public logo URL.\n     */\n    logo: string | null;\n};\ntype StreamDirectUpload = {\n    /**\n     * The URL an unauthenticated upload can use for a single multipart request.\n     */\n    uploadURL: string;\n    /**\n     * A Cloudflare-generated unique identifier for a media item.\n     */\n    id: string;\n    /**\n     * The watermark profile applied to the upload.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The scheduled deletion time, if any.\n     */\n    scheduledDeletion: string | null;\n};\ntype StreamDirectUploadCreateParams = {\n    /**\n     * The maximum duration in seconds for a video upload.\n     */\n    maxDurationSeconds: number;\n    /**\n     * The date and time after upload when videos will not be accepted.\n     */\n    expiry?: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of record for\n     * managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Lists the origins allowed to display the video.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * Indicates whether the video can be accessed using the id. When set to `true`,\n     * a signed token must be generated with a signing key to view the video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The date and time at which the video will be deleted. Include `null` to remove\n     * a scheduled deletion.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The watermark profile to apply.\n     */\n    watermark?: StreamDirectUploadWatermark;\n};\ntype StreamDirectUploadWatermark = {\n    /**\n     * The unique identifier for the watermark profile.\n     */\n    id: string;\n};\ntype StreamUrlUploadParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The identifier for the watermark profile\n     */\n    watermarkId?: string;\n};\ninterface StreamScopedCaptions {\n    /**\n     * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.\n     * One caption or subtitle file per language is allowed.\n     * @param language The BCP 47 language tag for the caption or subtitle.\n     * @param file The caption or subtitle file to upload.\n     * @returns The created caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language or file is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(language: string, file: File): Promise<StreamCaption>;\n    /**\n     * Generate captions or subtitles for the provided language via AI.\n     * @param language The BCP 47 language tag to generate.\n     * @returns The generated caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language is invalid\n     * @throws {StreamError} if a generated caption already exists\n     * @throws {StreamError} if the video duration is too long\n     * @throws {StreamError} if the video is missing audio\n     * @throws {StreamError} if the requested language is not supported\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(language: string): Promise<StreamCaption>;\n    /**\n     * Lists the captions or subtitles.\n     * Use the language parameter to filter by a specific language.\n     * @param language The optional BCP 47 language tag to filter by.\n     * @returns The list of captions or subtitles.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(language?: string): Promise<StreamCaption[]>;\n    /**\n     * Removes the captions or subtitles from a video.\n     * @param language The BCP 47 language tag to remove.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(language: string): Promise<void>;\n}\ninterface StreamScopedDownloads {\n    /**\n     * Generates a download for a video when a video is ready to view. Available\n     * types are `default` and `audio`. Defaults to `default` when omitted.\n     * @param downloadType The download type to create.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the download type is invalid\n     * @throws {StreamError} if the video duration is too long to generate a download\n     * @throws {StreamError} if the video is not ready to stream\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;\n    /**\n     * Lists the downloads created for a video.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(): Promise<StreamDownloadGetResponse>;\n    /**\n     * Delete the downloads for a video. Available types are `default` and `audio`.\n     * Defaults to `default` when omitted.\n     * @param downloadType The download type to delete.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(downloadType?: StreamDownloadType): Promise<void>;\n}\ninterface StreamVideos {\n    /**\n     * Lists all videos in a users account.\n     * @returns The list of videos.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(params?: StreamVideosListParams): Promise<StreamVideo[]>;\n}\ninterface StreamWatermarks {\n    /**\n     * Generate a new watermark profile\n     * @param file The image file to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(file: File, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Generate a new watermark profile\n     * @param url The image url to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Lists all watermark profiles for an account.\n     * @returns The list of watermark profiles.\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(): Promise<StreamWatermark[]>;\n    /**\n     * Retrieves details for a single watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns The watermark profile details.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(watermarkId: string): Promise<StreamWatermark>;\n    /**\n     * Deletes a watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(watermarkId: string): Promise<void>;\n}\ntype StreamUpdateVideoParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * The maximum duration in seconds for a video upload. Can be set for a\n     * video that is not yet uploaded to limit its duration. Uploads that exceed the\n     * specified duration will fail during processing. A value of `-1` means the value\n     * is unknown.\n     */\n    maxDurationSeconds?: number;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n};\ntype StreamCaption = {\n    /**\n     * Whether the caption was generated via AI.\n     */\n    generated?: boolean;\n    /**\n     * The language label displayed in the native language to users.\n     */\n    label: string;\n    /**\n     * The language tag in BCP 47 format.\n     */\n    language: string;\n    /**\n     * The status of a generated caption.\n     */\n    status?: 'ready' | 'inprogress' | 'error';\n};\ntype StreamDownloadStatus = 'ready' | 'inprogress' | 'error';\ntype StreamDownloadType = 'default' | 'audio';\ntype StreamDownload = {\n    /**\n     * Indicates the progress as a percentage between 0 and 100.\n     */\n    percentComplete: number;\n    /**\n     * The status of a generated download.\n     */\n    status: StreamDownloadStatus;\n    /**\n     * The URL to access the generated download.\n     */\n    url?: string;\n};\n/**\n * An object with download type keys. Each key is optional and only present if that\n * download type has been created.\n */\ntype StreamDownloadGetResponse = {\n    /**\n     * The audio-only download. Only present if this download type has been created.\n     */\n    audio?: StreamDownload;\n    /**\n     * The default video download. Only present if this download type has been created.\n     */\n    default?: StreamDownload;\n};\ntype StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';\ntype StreamWatermark = {\n    /**\n     * The unique identifier for a watermark profile.\n     */\n    id: string;\n    /**\n     * The size of the image in bytes.\n     */\n    size: number;\n    /**\n     * The height of the image in pixels.\n     */\n    height: number;\n    /**\n     * The width of the image in pixels.\n     */\n    width: number;\n    /**\n     * The date and a time a watermark profile was created.\n     */\n    created: string;\n    /**\n     * The source URL for a downloaded image. If the watermark profile was created via\n     * direct upload, this field is null.\n     */\n    downloadedFrom: string | null;\n    /**\n     * A short description of the watermark profile.\n     */\n    name: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the image\n     * is already semi-transparent, setting this to `1.0` will not make the image\n     * completely opaque.\n     */\n    opacity: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the video\n     * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded\n     * video width or length, as determined by the algorithm.\n     */\n    padding: number;\n    /**\n     * The size of the image relative to the overall size of the video. This parameter\n     * will adapt to horizontal and vertical videos automatically. `0.0` indicates no\n     * scaling (use the size of the image as-is), and `1.0 `fills the entire video.\n     */\n    scale: number;\n    /**\n     * The location of the image. Valid positions are: `upperRight`, `upperLeft`,\n     * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the\n     * `padding` parameter.\n     */\n    position: StreamWatermarkPosition;\n};\ntype StreamWatermarkCreateParams = {\n    /**\n     * A short description of the watermark profile.\n     */\n    name?: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the\n     * image is already semi-transparent, setting this to `1.0` will not make the\n     * image completely opaque.\n     */\n    opacity?: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the\n     * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully\n     * padded video width or length, as determined by the algorithm.\n     */\n    padding?: number;\n    /**\n     * The size of the image relative to the overall size of the video. This\n     * parameter will adapt to horizontal and vertical videos automatically. `0.0`\n     * indicates no scaling (use the size of the image as-is), and `1.0 `fills the\n     * entire video.\n     */\n    scale?: number;\n    /**\n     * The location of the image.\n     */\n    position?: StreamWatermarkPosition;\n};\ntype StreamVideosListParams = {\n    /**\n     * The maximum number of videos to return.\n     */\n    limit?: number;\n    /**\n     * Return videos created before this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    before?: string;\n    /**\n     * Comparison operator for the `before` field.\n     * @default 'lt'\n     */\n    beforeComp?: StreamPaginationComparison;\n    /**\n     * Return videos created after this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    after?: string;\n    /**\n     * Comparison operator for the `after` field.\n     * @default 'gte'\n     */\n    afterComp?: StreamPaginationComparison;\n};\ntype StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';\n/**\n * Error object for Stream binding operations.\n */\ninterface StreamError extends Error {\n    readonly code: number;\n    readonly statusCode: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ninterface InternalError extends StreamError {\n    name: 'InternalError';\n}\ninterface BadRequestError extends StreamError {\n    name: 'BadRequestError';\n}\ninterface NotFoundError extends StreamError {\n    name: 'NotFoundError';\n}\ninterface ForbiddenError extends StreamError {\n    name: 'ForbiddenError';\n}\ninterface RateLimitedError extends StreamError {\n    name: 'RateLimitedError';\n}\ninterface QuotaReachedError extends StreamError {\n    name: 'QuotaReachedError';\n}\ninterface MaxFileSizeError extends StreamError {\n    name: 'MaxFileSizeError';\n}\ninterface InvalidURLError extends StreamError {\n    name: 'InvalidURLError';\n}\ninterface AlreadyUploadedError extends StreamError {\n    name: 'AlreadyUploadedError';\n}\ninterface TooManyWatermarksError extends StreamError {\n    name: 'TooManyWatermarksError';\n}\ntype MarkdownDocument = {\n    name: string;\n    blob: Blob;\n};\ntype ConversionResponse = {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'markdown';\n    tokens: number;\n    data: string;\n} | {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'error';\n    error: string;\n};\ntype ImageConversionOptions = {\n    descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';\n};\ntype EmbeddedImageConversionOptions = ImageConversionOptions & {\n    convert?: boolean;\n    maxConvertedImages?: number;\n};\ntype ConversionOptions = {\n    html?: {\n        images?: EmbeddedImageConversionOptions & {\n            convertOGImage?: boolean;\n        };\n        hostname?: string;\n        cssSelector?: string;\n    };\n    docx?: {\n        images?: EmbeddedImageConversionOptions;\n    };\n    image?: ImageConversionOptions;\n    pdf?: {\n        images?: EmbeddedImageConversionOptions;\n        metadata?: boolean;\n    };\n};\ntype ConversionRequestOptions = {\n    gateway?: GatewayOptions;\n    extraHeaders?: object;\n    conversionOptions?: ConversionOptions;\n};\ntype SupportedFileFormat = {\n    mimeType: string;\n    extension: string;\n};\ndeclare abstract class ToMarkdownService {\n    transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n    supported(): Promise<SupportedFileFormat[]>;\n}\ndeclare namespace TailStream {\n    interface Header {\n        readonly name: string;\n        readonly value: string;\n    }\n    interface FetchEventInfo {\n        readonly type: \"fetch\";\n        readonly method: string;\n        readonly url: string;\n        readonly cfJson?: object;\n        readonly headers: Header[];\n    }\n    interface JsRpcEventInfo {\n        readonly type: \"jsrpc\";\n    }\n    interface ScheduledEventInfo {\n        readonly type: \"scheduled\";\n        readonly scheduledTime: Date;\n        readonly cron: string;\n    }\n    interface AlarmEventInfo {\n        readonly type: \"alarm\";\n        readonly scheduledTime: Date;\n    }\n    interface QueueEventInfo {\n        readonly type: \"queue\";\n        readonly queueName: string;\n        readonly batchSize: number;\n    }\n    interface EmailEventInfo {\n        readonly type: \"email\";\n        readonly mailFrom: string;\n        readonly rcptTo: string;\n        readonly rawSize: number;\n    }\n    interface TraceEventInfo {\n        readonly type: \"trace\";\n        readonly traces: (string | null)[];\n    }\n    interface HibernatableWebSocketEventInfoMessage {\n        readonly type: \"message\";\n    }\n    interface HibernatableWebSocketEventInfoError {\n        readonly type: \"error\";\n    }\n    interface HibernatableWebSocketEventInfoClose {\n        readonly type: \"close\";\n        readonly code: number;\n        readonly wasClean: boolean;\n    }\n    interface HibernatableWebSocketEventInfo {\n        readonly type: \"hibernatableWebSocket\";\n        readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;\n    }\n    interface CustomEventInfo {\n        readonly type: \"custom\";\n    }\n    interface FetchResponseInfo {\n        readonly type: \"fetch\";\n        readonly statusCode: number;\n    }\n    type EventOutcome = \"ok\" | \"canceled\" | \"exception\" | \"unknown\" | \"killSwitch\" | \"daemonDown\" | \"exceededCpu\" | \"exceededMemory\" | \"loadShed\" | \"responseStreamDisconnected\" | \"scriptNotFound\";\n    interface ScriptVersion {\n        readonly id: string;\n        readonly tag?: string;\n        readonly message?: string;\n    }\n    interface Onset {\n        readonly type: \"onset\";\n        readonly attributes: Attribute[];\n        // id for the span being opened by this Onset event.\n        readonly spanId: string;\n        readonly dispatchNamespace?: string;\n        readonly entrypoint?: string;\n        readonly executionModel: string;\n        readonly scriptName?: string;\n        readonly scriptTags?: string[];\n        readonly scriptVersion?: ScriptVersion;\n        readonly info: FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;\n    }\n    interface Outcome {\n        readonly type: \"outcome\";\n        readonly outcome: EventOutcome;\n        readonly cpuTime: number;\n        readonly wallTime: number;\n    }\n    interface SpanOpen {\n        readonly type: \"spanOpen\";\n        readonly name: string;\n        // id for the span being opened by this SpanOpen event.\n        readonly spanId: string;\n        readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;\n    }\n    interface SpanClose {\n        readonly type: \"spanClose\";\n        readonly outcome: EventOutcome;\n    }\n    interface DiagnosticChannelEvent {\n        readonly type: \"diagnosticChannel\";\n        readonly channel: string;\n        readonly message: any;\n    }\n    interface Exception {\n        readonly type: \"exception\";\n        readonly name: string;\n        readonly message: string;\n        readonly stack?: string;\n    }\n    interface Log {\n        readonly type: \"log\";\n        readonly level: \"debug\" | \"error\" | \"info\" | \"log\" | \"warn\";\n        readonly message: object;\n    }\n    interface DroppedEventsDiagnostic {\n        readonly diagnosticsType: \"droppedEvents\";\n        readonly count: number;\n    }\n    interface StreamDiagnostic {\n        readonly type: 'streamDiagnostic';\n        // To add new diagnostic types, define a new interface and add it to this union type.\n        readonly diagnostic: DroppedEventsDiagnostic;\n    }\n    // This marks the worker handler return information.\n    // This is separate from Outcome because the worker invocation can live for a long time after\n    // returning. For example - Websockets that return an http upgrade response but then continue\n    // streaming information or SSE http connections.\n    interface Return {\n        readonly type: \"return\";\n        readonly info?: FetchResponseInfo;\n    }\n    interface Attribute {\n        readonly name: string;\n        readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];\n    }\n    interface Attributes {\n        readonly type: \"attributes\";\n        readonly info: Attribute[];\n    }\n    type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;\n    // Context in which this trace event lives.\n    interface SpanContext {\n        // Single id for the entire top-level invocation\n        // This should be a new traceId for the first worker stage invoked in the eyeball request and then\n        // same-account service-bindings should reuse the same traceId but cross-account service-bindings\n        // should use a new traceId.\n        readonly traceId: string;\n        // spanId in which this event is handled\n        // for Onset and SpanOpen events this would be the parent span id\n        // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events\n        // For Hibernate and Mark this would be the span under which they were emitted.\n        // spanId is not set ONLY if:\n        //  1. This is an Onset event\n        //  2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)\n        readonly spanId?: string;\n    }\n    interface TailEvent<Event extends EventType> {\n        // invocation id of the currently invoked worker stage.\n        // invocation id will always be unique to every Onset event and will be the same until the Outcome event.\n        readonly invocationId: string;\n        // Inherited spanContext for this event.\n        readonly spanContext: SpanContext;\n        readonly timestamp: Date;\n        readonly sequence: number;\n        readonly event: Event;\n    }\n    type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;\n    type TailEventHandlerObject = {\n        outcome?: TailEventHandler<Outcome>;\n        spanOpen?: TailEventHandler<SpanOpen>;\n        spanClose?: TailEventHandler<SpanClose>;\n        diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;\n        exception?: TailEventHandler<Exception>;\n        log?: TailEventHandler<Log>;\n        return?: TailEventHandler<Return>;\n        attributes?: TailEventHandler<Attributes>;\n    };\n    type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\n/**\n * Data types supported for holding vector metadata.\n */\ntype VectorizeVectorMetadataValue = string | number | boolean | string[];\n/**\n * Additional information to associate with a vector.\n */\ntype VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;\ntype VectorFloatArray = Float32Array | Float64Array;\ninterface VectorizeError {\n    code?: number;\n    error: string;\n}\n/**\n * Comparison logic/operation to use for metadata filtering.\n *\n * This list is expected to grow as support for more operations are released.\n */\ntype VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';\ntype VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';\n/**\n * Filter criteria for vector metadata used to limit the retrieved query result set.\n */\ntype VectorizeVectorMetadataFilter = {\n    [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {\n        [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;\n    } | {\n        [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];\n    };\n};\n/**\n * Supported distance metrics for an index.\n * Distance metrics determine how other \"similar\" vectors are determined.\n */\ntype VectorizeDistanceMetric = \"euclidean\" | \"cosine\" | \"dot-product\";\n/**\n * Metadata return levels for a Vectorize query.\n *\n * Default to \"none\".\n *\n * @property all      Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.\n * @property indexed  Return all metadata fields configured for indexing in the vector return set. This level of retrieval is \"free\" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).\n * @property none     No indexed metadata will be returned.\n */\ntype VectorizeMetadataRetrievalLevel = \"all\" | \"indexed\" | \"none\";\ninterface VectorizeQueryOptions {\n    topK?: number;\n    namespace?: string;\n    returnValues?: boolean;\n    returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;\n    filter?: VectorizeVectorMetadataFilter;\n}\n/**\n * Information about the configuration of an index.\n */\ntype VectorizeIndexConfig = {\n    dimensions: number;\n    metric: VectorizeDistanceMetric;\n} | {\n    preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity\n};\n/**\n * Metadata about an existing index.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeIndexInfo} for its post-beta equivalent.\n */\ninterface VectorizeIndexDetails {\n    /** The unique ID of the index */\n    readonly id: string;\n    /** The name of the index. */\n    name: string;\n    /** (optional) A human readable description for the index. */\n    description?: string;\n    /** The index configuration, including the dimension size and distance metric. */\n    config: VectorizeIndexConfig;\n    /** The number of records containing vectors within the index. */\n    vectorsCount: number;\n}\n/**\n * Metadata about an existing index.\n */\ninterface VectorizeIndexInfo {\n    /** The number of records containing vectors within the index. */\n    vectorCount: number;\n    /** Number of dimensions the index has been configured for. */\n    dimensions: number;\n    /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToDatetime: number;\n    /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToMutation: number;\n}\n/**\n * Represents a single vector value set along with its associated metadata.\n */\ninterface VectorizeVector {\n    /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */\n    id: string;\n    /** The vector values */\n    values: VectorFloatArray | number[];\n    /** The namespace this vector belongs to. */\n    namespace?: string;\n    /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */\n    metadata?: Record<string, VectorizeVectorMetadata>;\n}\n/**\n * Represents a matched vector for a query along with its score and (if specified) the matching vector information.\n */\ntype VectorizeMatch = Pick<Partial<VectorizeVector>, \"values\"> & Omit<VectorizeVector, \"values\"> & {\n    /** The score or rank for similarity, when returned as a result */\n    score: number;\n};\n/**\n * A set of matching {@link VectorizeMatch} for a particular query.\n */\ninterface VectorizeMatches {\n    matches: VectorizeMatch[];\n    count: number;\n}\n/**\n * Results of an operation that performed a mutation on a set of vectors.\n * Here, `ids` is a list of vectors that were successfully processed.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeAsyncMutation} for its post-beta equivalent.\n */\ninterface VectorizeVectorMutation {\n    /* List of ids of vectors that were successfully processed. */\n    ids: string[];\n    /* Total count of the number of processed vectors. */\n    count: number;\n}\n/**\n * Result type indicating a mutation on the Vectorize Index.\n * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.\n */\ninterface VectorizeAsyncMutation {\n    /** The unique identifier for the async mutation operation containing the changeset. */\n    mutationId: string;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link Vectorize} for its new implementation.\n */\ndeclare abstract class VectorizeIndex {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexDetails>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * Mutations in this version are async, returning a mutation id.\n */\ndeclare abstract class Vectorize {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexInfo>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Use the provided vector-id to perform a similarity search across the index.\n     * @param vectorId Id for a vector in the index against which the index should be queried.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * The interface for \"version_metadata\" binding\n * providing metadata about the Worker Version using this binding.\n */\ntype WorkerVersionMetadata = {\n    /** The ID of the Worker Version using this binding */\n    id: string;\n    /** The tag of the Worker Version using this binding */\n    tag: string;\n    /** The timestamp of when the Worker Version was uploaded */\n    timestamp: string;\n};\ninterface DynamicDispatchLimits {\n    /**\n     * Limit CPU time in milliseconds.\n     */\n    cpuMs?: number;\n    /**\n     * Limit number of subrequests.\n     */\n    subRequests?: number;\n}\ninterface DynamicDispatchOptions {\n    /**\n     * Limit resources of invoked Worker script.\n     */\n    limits?: DynamicDispatchLimits;\n    /**\n     * Arguments for outbound Worker script, if configured.\n     */\n    outbound?: {\n        [key: string]: any;\n    };\n}\ninterface DispatchNamespace {\n    /**\n    * @param name Name of the Worker script.\n    * @param args Arguments to Worker script.\n    * @param options Options for Dynamic Dispatch invocation.\n    * @returns A Fetcher object that allows you to send requests to the Worker script.\n    * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.\n    */\n    get(name: string, args?: {\n        [key: string]: any;\n    }, options?: DynamicDispatchOptions): Fetcher;\n}\ndeclare module 'cloudflare:workflows' {\n    /**\n     * NonRetryableError allows for a user to throw a fatal error\n     * that makes a Workflow instance fail immediately without triggering a retry\n     */\n    export class NonRetryableError extends Error {\n        public constructor(message: string, name?: string);\n    }\n}\ndeclare abstract class Workflow<PARAMS = unknown> {\n    /**\n     * Get a handle to an existing instance of the Workflow.\n     * @param id Id for the instance of this Workflow\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public get(id: string): Promise<WorkflowInstance>;\n    /**\n     * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.\n     * @param options Options when creating an instance including id and params\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;\n    /**\n     * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.\n     * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.\n     * @param batch List of Options when creating an instance including name and params\n     * @returns A promise that resolves with a list of handles for the created instances.\n     */\n    public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;\n}\ntype WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\ntype WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\ntype WorkflowRetentionDuration = WorkflowSleepDuration;\ninterface WorkflowInstanceCreateOptions<PARAMS = unknown> {\n    /**\n     * An id for your Workflow instance. Must be unique within the Workflow.\n     */\n    id?: string;\n    /**\n     * The event payload the Workflow instance is triggered with\n     */\n    params?: PARAMS;\n    /**\n     * The retention policy for Workflow instance.\n     * Defaults to the maximum retention period available for the owner's account.\n     */\n    retention?: {\n        successRetention?: WorkflowRetentionDuration;\n        errorRetention?: WorkflowRetentionDuration;\n    };\n}\ntype InstanceStatus = {\n    status: 'queued' // means that instance is waiting to be started (see concurrency limits)\n     | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running\n     | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish\n     | 'waitingForPause' // instance is finishing the current work to pause\n     | 'unknown';\n    error?: {\n        name: string;\n        message: string;\n    };\n    output?: unknown;\n};\ninterface WorkflowError {\n    code?: number;\n    message: string;\n}\ndeclare abstract class WorkflowInstance {\n    public id: string;\n    /**\n     * Pause the instance.\n     */\n    public pause(): Promise<void>;\n    /**\n     * Resume the instance. If it is already running, an error will be thrown.\n     */\n    public resume(): Promise<void>;\n    /**\n     * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.\n     */\n    public terminate(): Promise<void>;\n    /**\n     * Restart the instance.\n     */\n    public restart(): Promise<void>;\n    /**\n     * Returns the current status of the instance.\n     */\n    public status(): Promise<InstanceStatus>;\n    /**\n     * Send an event to this instance.\n     */\n    public sendEvent({ type, payload, }: {\n        type: string;\n        payload: unknown;\n    }): Promise<void>;\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-cloudflare/wrangler.jsonc",
    "content": "{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"tanstack-start-app\",\n  \"compatibility_date\": \"2025-09-24\",\n  \"compatibility_flags\": [\"nodejs_compat\"],\n  \"main\": \"@tanstack/vue-start/server-entry\",\n  \"vars\": {\n    \"MY_VAR\": \"Hello from Cloudflare\",\n  },\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/README.md",
    "content": "# Welcome to TanStack.com!\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Development\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Editing and previewing the docs of TanStack projects locally\n\nThe documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app.\nIn 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.\n\nFollow 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 :\n\n1. Create a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter the directory and clone this repo and the repo of the project there.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/tanstack.com.git\ngit clone git@github.com:TanStack/form.git\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- form/\n>    |\n>    +-- tanstack.com/\n> ```\n\n> [!WARNING]\n> 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.\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`.\n\n> [!NOTE]\n> The updated pages need to be manually reloaded in the browser.\n\n> [!WARNING]\n> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page!\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-basic-tsr-config\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"rimraf ./count.txt && vite build && tsc --noEmit\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"vite\": \"^8.0.0\",\n    \"vue\": \"^3.5.25\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/src/app/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/src/app/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/src/app/routes/__root.tsx",
    "content": "import {\n  Body,\n  HeadContent,\n  Html,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <Outlet />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/src/app/routes/index.tsx",
    "content": "import * as fs from 'node:fs'\nimport { createFileRoute, useRouter } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\n\nconst filePath = 'count.txt'\n\nconst getCount = createServerFn({\n  method: 'GET',\n}).handler(async () => {\n  const number = await fs.promises.readFile(filePath, 'utf-8').catch(() => '0')\n  return parseInt(number || '0')\n})\n\nconst updateCount = createServerFn({ method: 'POST' })\n  .inputValidator((d: number) => d)\n  .handler(async ({ data }) => {\n    const count = await getCount()\n    await fs.promises.writeFile(filePath, `${count + data}`)\n  })\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => await getCount(),\n})\n\nfunction Home() {\n  const router = useRouter()\n  const state = Route.useLoaderData()\n\n  return (\n    <button\n      data-testid=\"add-button\"\n      onClick={() => {\n        updateCount({ data: 1 }).then(() => {\n          router.invalidate()\n        })\n      }}\n    >\n      Add 1 to {state.value}?\n    </button>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/src/app/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('opening the app', async ({ page }) => {\n  await page.goto('/')\n\n  await page.waitForLoadState('networkidle')\n  await expect(page.getByTestId('add-button')).toContainText('Add 1 to 0?')\n  await page.getByTestId('add-button').click()\n  await page.waitForLoadState('networkidle')\n  await expect(page.getByTestId('add-button')).toContainText('Add 1 to 1?')\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/app/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-tsr-config/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tanstackStart({\n      srcDirectory: './src/app',\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-basic-vue-query\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-query\": \"^5.92.1\",\n    \"@tanstack/vue-query-devtools\": \"^6.1.2\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^4.1.12\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\n\nconst baseURL = `http://localhost:${PORT}`\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/components/DefaultCatchBoundary.tsx",
    "content": "import { ErrorComponent, type ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function DefaultCatchBoundary(props: ErrorComponentProps) {\n  return <ErrorComponent {...props} />\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\n\nexport function NotFound(props?: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div>\n        {props?.children || 'The page you are looking for does not exist.'}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as SuspenseTransitionRouteImport } from './routes/suspense-transition'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api.users'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as TransitionCountQueryRouteImport } from './routes/transition/count/query'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersIdRouteImport } from './routes/api/users.$id'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SuspenseTransitionRoute = SuspenseTransitionRouteImport.update({\n  id: '/suspense-transition',\n  path: '/suspense-transition',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst TransitionCountQueryRoute = TransitionCountQueryRouteImport.update({\n  id: '/transition/count/query',\n  path: '/transition/count/query',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersIdRoute = ApiUsersIdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/suspense-transition': typeof SuspenseTransitionRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n  '/transition/count/query': typeof TransitionCountQueryRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/posts'\n    | '/suspense-transition'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n    | '/transition/count/query'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/suspense-transition'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/layout-a'\n    | '/layout-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n    | '/transition/count/query'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/deferred'\n    | '/posts'\n    | '/suspense-transition'\n    | '/users'\n    | '/_layout/_layout-2'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/api/users/$id'\n    | '/posts_/$postId/deep'\n    | '/transition/count/query'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  SuspenseTransitionRoute: typeof SuspenseTransitionRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  TransitionCountQueryRoute: typeof TransitionCountQueryRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/suspense-transition': {\n      id: '/suspense-transition'\n      path: '/suspense-transition'\n      fullPath: '/suspense-transition'\n      preLoaderRoute: typeof SuspenseTransitionRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/transition/count/query': {\n      id: '/transition/count/query'\n      path: '/transition/count/query'\n      fullPath: '/transition/count/query'\n      preLoaderRoute: typeof TransitionCountQueryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$id': {\n      id: '/api/users/$id'\n      path: '/$id'\n      fullPath: '/api/users/$id'\n      preLoaderRoute: typeof ApiUsersIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersIdRoute: typeof ApiUsersIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersIdRoute: ApiUsersIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  SuspenseTransitionRoute: SuspenseTransitionRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  TransitionCountQueryRoute: TransitionCountQueryRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/vue-query'\nimport { createRouter } from '@tanstack/vue-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/vue-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n  return router\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/vue-router-devtools'\nimport type { QueryClient } from '@tanstack/vue-query'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack Vue Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack Vue framework.`,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument(_: unknown, { slots }: { slots: any }) {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/layout-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {slots.default?.()}\n        <TanStackRouterDevtoolsInProd position=\"bottom-right\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div>I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/api/users.$id.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport axios from 'redaxios'\nimport type { User } from '../../utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        console.info(`Fetching users by id=${params.id}... @`, request.url)\n        try {\n          const res = await axios.get<User>(`${queryURL}/users/` + params.id)\n          return Response.json({\n            id: res.data.id,\n            name: res.data.name,\n            email: res.data.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/api.users.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport axios from 'redaxios'\nimport type { User } from '../utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await axios.get<Array<User>>(`${queryURL}/users`)\n        const list = res.data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/deferred.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { queryOptions, useQuery } from '@tanstack/vue-query'\nimport { Suspense, defineComponent, ref } from 'vue'\n\nconst deferredQueryOptions = () =>\n  queryOptions({\n    queryKey: ['deferred'],\n    queryFn: async () => {\n      await new Promise((r) => setTimeout(r, 3000))\n      return {\n        message: `Hello deferred from the server!`,\n        status: 'success',\n        time: new Date(),\n      }\n    },\n  })\n\nconst Deferred = defineComponent({\n  setup() {\n    const count = ref(0)\n\n    return () => (\n      <div class=\"p-2\">\n        <Suspense>\n          {{\n            default: () => <DeferredQuery />,\n            fallback: () => 'Loading Middleman...',\n          }}\n        </Suspense>\n        <div>Count: {count.value}</div>\n        <div>\n          <button onClick={() => (count.value += 1)}>Increment</button>\n        </div>\n      </div>\n    )\n  },\n})\n\nconst DeferredQuery = defineComponent({\n  async setup() {\n    const deferredQuery = useQuery(deferredQueryOptions())\n    await deferredQuery.suspense()\n\n    return () => {\n      const data = deferredQuery.data.value\n\n      return (\n        <div>\n          <h1>Deferred Query</h1>\n          <div>Status: {data?.status ?? 'loading...'}</div>\n          <div>Message: {data?.message ?? ''}</div>\n          <div>Time: {data ? new Date(data.time).toISOString() : ''}</div>\n        </div>\n      )\n    }\n  },\n})\n\nexport const Route = createFileRoute('/deferred')({\n  loader: ({ context }) => {\n    // Kick off loading as early as possible!\n    context.queryClient.prefetchQuery(deferredQueryOptions())\n  },\n  component: Deferred,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/posts.$postId.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport {\n  ErrorComponent,\n  Link,\n  createFileRoute,\n  type ErrorComponentProps,\n} from '@tanstack/vue-router'\nimport { postQueryOptions } from '~/utils/posts'\n\nexport function PostErrorComponent(props: ErrorComponentProps) {\n  return <ErrorComponent error={props.error} />\n}\n\nfunction PostComponent() {\n  const params = Route.useParams()\n  const postQuery = useQuery(() => postQueryOptions(params.value.postId))\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{postQuery.data.value?.title}</h4>\n      <div class=\"text-sm\">{postQuery.data.value?.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: postQuery.data.value?.id ?? '',\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ context, params }) => {\n    await context.queryClient.ensureQueryData(postQueryOptions(params.postId))\n  },\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/posts.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { Suspense, defineComponent } from 'vue'\nimport { postsQueryOptions } from '~/utils/posts'\n\nconst PostsList = defineComponent({\n  async setup() {\n    const postsQuery = useQuery(postsQueryOptions())\n    await postsQuery.suspense()\n\n    return () => {\n      const posts = [\n        ...(postsQuery.data.value ?? []),\n        { id: 'i-do-not-exist', title: 'Non-existent Post' },\n      ]\n\n      return (\n        <ul class=\"list-disc pl-4\">\n          {posts.map((post) => (\n            <li class=\"whitespace-nowrap\" key={post.id}>\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          ))}\n        </ul>\n      )\n    }\n  },\n})\n\nconst PostsComponent = defineComponent({\n  setup() {\n    return () => {\n      return (\n        <div class=\"p-2 flex gap-2\">\n          <Suspense>\n            {{\n              default: () => <PostsList />,\n              fallback: () => <div>Loading posts...</div>,\n            }}\n          </Suspense>\n          <hr />\n          <Outlet />\n        </div>\n      )\n    }\n  },\n})\n\nexport const Route = createFileRoute('/posts')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(postsQueryOptions())\n  },\n  head: () => ({ meta: [{ title: 'Posts' }] }),\n  component: PostsComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\nimport { useQuery } from '@tanstack/vue-query'\nimport { postQueryOptions } from '../utils/posts'\nimport { PostErrorComponent } from './posts.$postId'\n\nfunction PostDeepComponent() {\n  const params = Route.useParams()\n  const postQuery = useQuery(() => postQueryOptions(params.value.postId))\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{postQuery.data.value?.title}</h4>\n      <div class=\"text-sm\">{postQuery.data.value?.body}</div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId }, context }) => {\n    const data = await context.queryClient.ensureQueryData(\n      postQueryOptions(postId),\n    )\n\n    return {\n      title: data.title,\n    }\n  },\n  head: ({ loaderData }) => ({\n    meta: loaderData ? [{ title: loaderData.title }] : undefined,\n  }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/suspense-transition.tsx",
    "content": "import { queryOptions, useQuery } from '@tanstack/vue-query'\nimport { Link, createFileRoute } from '@tanstack/vue-router'\nimport { ref, watchEffect } from 'vue'\n\nconst doubleQueryOptions = (n: number) =>\n  queryOptions({\n    queryKey: ['double', n],\n    queryFn: async () => {\n      // Add a delay to make the transition observable\n      await new Promise((r) => setTimeout(r, 500))\n      return n * 2\n    },\n    placeholderData: (previousData) => previousData,\n  })\n\nexport const Route = createFileRoute('/suspense-transition')({\n  validateSearch: (search: { n?: number }) => ({ n: search.n ?? 1 }),\n  component: SuspenseTransitionComponent,\n  ssr: false, // Disable SSR to avoid suspense issues during initial load\n})\n\nfunction SuspenseTransitionComponent() {\n  return (\n    <div class=\"p-2\">\n      <h1 data-testid=\"suspense-transition-title\">Suspense Transition Test</h1>\n\n      <div class=\"flex gap-2 my-4\">\n        <Link\n          data-testid=\"increase-button\"\n          class=\"border bg-gray-50 px-3 py-1\"\n          from=\"/suspense-transition\"\n          search={(s) => ({ n: s.n + 1 })}\n        >\n          Increase\n        </Link>\n      </div>\n\n      <Result />\n    </div>\n  )\n}\n\nfunction Result() {\n  const search = Route.useSearch()\n  const doubleQuery = useQuery(() => doubleQueryOptions(search.value.n))\n  const displayedN = ref(search.value.n)\n  const displayedDouble = ref<number | undefined>(undefined)\n\n  watchEffect(() => {\n    if (doubleQuery.data.value !== undefined) {\n      displayedN.value = search.value.n\n      displayedDouble.value = doubleQuery.data.value\n    }\n  })\n\n  return (\n    <div class=\"mt-2 border p-4\">\n      <div data-testid=\"suspense-fallback\" style={{ display: 'none' }}>\n        Loading...\n      </div>\n      <div data-testid=\"suspense-content\">\n        <div>\n          n: <span data-testid=\"n-value\">{displayedN.value}</span>\n        </div>\n        <div>\n          double:{' '}\n          <span data-testid=\"double-value\">{displayedDouble.value}</span>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/transition/count/query.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\nimport { queryOptions, useQuery } from '@tanstack/vue-query'\nimport { z } from 'zod'\n\nconst searchSchema = z.object({\n  n: z.number().default(1),\n})\n\nconst doubleQueryOptions = (n: number) =>\n  queryOptions({\n    queryKey: ['transition-double', n],\n    queryFn: async () => {\n      await new Promise((resolve) => setTimeout(resolve, 1000))\n      return { n, double: n * 2 }\n    },\n    placeholderData: (oldData) => oldData,\n  })\n\nexport const Route = createFileRoute('/transition/count/query')({\n  validateSearch: searchSchema,\n  loader: ({ context: { queryClient }, location }) => {\n    const { n } = searchSchema.parse(location.search)\n    return queryClient.ensureQueryData(doubleQueryOptions(n))\n  },\n  component: TransitionPage,\n})\n\nfunction TransitionPage() {\n  const search = Route.useSearch()\n  const doubleQuery = useQuery(() => doubleQueryOptions(search.value.n))\n\n  return (\n    <div class=\"p-2\">\n      <Link\n        data-testid=\"increase-button\"\n        class=\"border bg-gray-50 px-3 py-1\"\n        from=\"/transition/count/query\"\n        search={(s) => ({ n: s.n + 1 })}\n      >\n        Increase\n      </Link>\n\n      <div class=\"mt-2\">\n        <div data-testid=\"n-value\">n: {doubleQuery.data.value?.n}</div>\n        <div data-testid=\"double-value\">\n          double: {doubleQuery.data.value?.double}\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/users.$userId.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport { ErrorComponent, createFileRoute } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nimport { NotFound } from '~/components/NotFound'\nimport { userQueryOptions } from '~/utils/users'\n\nfunction UserComponent() {\n  const params = Route.useParams()\n  const userQuery = useQuery(() => userQueryOptions(params.value.userId))\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">\n        {userQuery.data.value?.name ?? 'loading...'}\n      </h4>\n      <div class=\"text-sm\">{userQuery.data.value?.email ?? ''}</div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ context, params: { userId } }) => {\n    await context.queryClient.ensureQueryData(userQueryOptions(userId))\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserErrorComponent(props: ErrorComponentProps) {\n  return <ErrorComponent error={props.error} />\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/routes/users.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { defineComponent } from 'vue'\n\nimport { usersQueryOptions } from '~/utils/users'\n\nconst UsersComponent = defineComponent({\n  setup() {\n    const usersQuery = useQuery(usersQueryOptions())\n\n    return () => {\n      const users = [\n        ...(usersQuery.data.value ?? []),\n        { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n      ]\n\n      return (\n        <div class=\"p-2 flex gap-2\">\n          <ul class=\"list-disc pl-4\">\n            {users.map((user) => (\n              <li class=\"whitespace-nowrap\" key={user.id}>\n                <Link\n                  to=\"/users/$userId\"\n                  params={{\n                    userId: String(user.id),\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{user.name}</div>\n                </Link>\n              </li>\n            ))}\n          </ul>\n          <hr />\n          <Outlet />\n        </div>\n      )\n    }\n  },\n})\n\nexport const Route = createFileRoute('/users')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(usersQueryOptions())\n  },\n  component: UsersComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nbody {\n  @apply text-base;\n  font-family: system-ui, sans-serif;\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/utils/posts.tsx",
    "content": "import { queryOptions } from '@tanstack/vue-query'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const postsQueryOptions = () =>\n  queryOptions({\n    queryKey: ['posts'],\n    queryFn: async () => {\n      console.info('Fetching posts...')\n      await new Promise((r) => setTimeout(r, 500))\n      return axios\n        .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n        .then((r) => r.data.slice(0, 10))\n    },\n  })\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', postId],\n    queryFn: async () => {\n      console.info(`Fetching post with id ${postId}...`)\n      await new Promise((r) => setTimeout(r, 500))\n\n      return axios\n        .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n        .then((r) => r.data)\n    },\n  })\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/utils/seo.ts",
    "content": "export function seo(params: {\n  title: string\n  description?: string\n  keywords?: string\n  image?: string\n}) {\n  const { title, description, keywords, image } = params\n\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/src/utils/users.tsx",
    "content": "import { queryOptions } from '@tanstack/vue-query'\nimport axios from 'redaxios'\n\nexport type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT =\n  import.meta.env.VITE_SERVER_PORT || process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n\nexport const usersQueryOptions = () =>\n  queryOptions({\n    queryKey: ['users'],\n    queryFn: () =>\n      axios\n        .get<Array<User>>(DEPLOY_URL + '/api/users')\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch users')\n        }),\n  })\n\nexport const userQueryOptions = (id: string) =>\n  queryOptions({\n    queryKey: ['users', id],\n    queryFn: () =>\n      axios\n        .get<User>(DEPLOY_URL + '/api/users/' + id)\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch user')\n        }),\n  })\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm A!\")\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Manual Suspense boundaries should transition on navigation', async ({\n  page,\n}) => {\n  // Navigate to the suspense transition test page\n  await page.goto('/suspense-transition')\n\n  // Wait for initial content to load\n  await expect(page.getByTestId('n-value')).toHaveText('1')\n  await expect(page.getByTestId('double-value')).toHaveText('2')\n\n  // Click the increase button to trigger navigation with search params change\n  await page.getByTestId('increase-button').click()\n\n  // During the transition, the old content should remain visible\n  // and the fallback should NOT be shown\n  await expect(page.getByTestId('suspense-fallback')).not.toBeVisible({\n    timeout: 100,\n  })\n\n  // The old content should still be visible during transition\n  await expect(page.getByTestId('suspense-content')).toBeVisible()\n\n  // After transition completes, new content should be visible\n  await expect(page.getByTestId('n-value')).toHaveText('2')\n  await expect(page.getByTestId('double-value')).toHaveText('4')\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/tests/transition.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('transitions/count/query should keep old values visible during navigation', async ({\n  page,\n}) => {\n  await page.goto('/transition/count/query')\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1')\n  await expect(page.getByTestId('double-value')).toContainText('double: 2')\n\n  const bodyTexts: Array<string> = []\n\n  const pollInterval = setInterval(async () => {\n    const text = await page\n      .locator('body')\n      .textContent()\n      .catch(() => '')\n    if (text) bodyTexts.push(text)\n  }, 50)\n\n  // 1 click\n\n  page.getByTestId('increase-button').click()\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 1', {\n    timeout: 2_000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 2', {\n    timeout: 2_000,\n  })\n\n  await page.waitForTimeout(200)\n\n  await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n    timeout: 2000,\n  })\n  await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n    timeout: 2000,\n  })\n\n  // 2 clicks\n\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 2', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 4', {\n  //   timeout: 2000,\n  // })\n\n  // await page.waitForTimeout(200)\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n  //   timeout: 2000,\n  // })\n\n  // // 3 clicks\n\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n  // page.getByTestId('increase-button').click()\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 4', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 8', {\n  //   timeout: 2000,\n  // })\n\n  // await page.waitForTimeout(200)\n\n  // await expect(page.getByTestId('n-value')).toContainText('n: 7', {\n  //   timeout: 2000,\n  // })\n  // await expect(page.getByTestId('double-value')).toContainText('double: 14', {\n  //   timeout: 2000,\n  // })\n\n  clearInterval(pollInterval)\n\n  // With proper transitions, old values should remain visible until new ones arrive\n  const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...'))\n\n  if (hasLoadingText) {\n    throw new Error(\n      'FAILED: \"Loading...\" appeared during navigation. ' +\n        'Solid Router should use transitions to keep old values visible.',\n    )\n  }\n})\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/basic-vue-query/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/css-modules/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/.gitignore",
    "content": "node_modules\ndist\n.routeTree.gen.ts\nsrc/routeTree.gen.ts\ntest-results\nplaywright-report\nport*.txt\n"
  },
  {
    "path": "e2e/vue-start/css-modules/.prettierignore",
    "content": "src/routeTree.gen.ts\n"
  },
  {
    "path": "e2e/vue-start/css-modules/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-css-modules\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev --port $PORT\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e:dev\": \"MODE=dev playwright test --project=chromium\",\n    \"test:e2e:prod\": \"playwright test --project=chromium\",\n    \"test:e2e\": \"rm -rf port*.txt; pnpm run test:e2e:dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:*\",\n    \"@tanstack/vue-start\": \"workspace:*\",\n    \"vue\": \"^3.5.16\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tanstack/router-e2e-utils\": \"workspace:*\",\n    \"@types/node\": \"^22.10.2\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"sass\": \"^1.97.2\",\n    \"srvx\": \"^0.11.9\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst mode = process.env.MODE ?? 'prod'\nconst isDev = mode === 'dev'\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    baseURL,\n  },\n\n  webServer: {\n    command: isDev ? `pnpm dev:e2e` : `pnpm build && PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n    env: {\n      VITE_NODE_ENV: 'test',\n      PORT: String(PORT),\n    },\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: {\n        ...devices['Desktop Chrome'],\n      },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: false,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/routes/__root.tsx",
    "content": "import {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <nav\n          data-testid=\"main-nav\"\n          style={{\n            padding: '12px 20px',\n            borderBottom: '1px solid #e2e8f0',\n            display: 'flex',\n            alignItems: 'center',\n            gap: '16px',\n            backgroundColor: '#fff',\n          }}\n        >\n          <Link\n            to=\"/\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-home\"\n          >\n            Home (Global CSS)\n          </Link>\n          <Link\n            to=\"/modules\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-modules\"\n          >\n            CSS Modules\n          </Link>\n          <Link\n            to=\"/sass-mixin\"\n            style={{ color: '#0284c7', textDecoration: 'none' }}\n            data-testid=\"nav-sass-mixin\"\n          >\n            Sass Mixin\n          </Link>\n        </nav>\n\n        <main style={{ padding: '20px' }}>\n          <Outlet />\n        </main>\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport '~/styles/global.css'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div>\n      <h1>CSS Collection Test - Global CSS</h1>\n      <p>This page tests that global CSS is collected and served during SSR.</p>\n\n      <div class=\"global-container\" data-testid=\"global-styled\">\n        <div class=\"global-title\" data-testid=\"global-title\">\n          Global CSS Applied\n        </div>\n        <div class=\"global-description\" data-testid=\"global-description\">\n          This container should have a blue background, white text, and rounded\n          corners even with JavaScript disabled.\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/routes/modules.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { createFileRoute } from '@tanstack/vue-router'\nimport styles from '~/styles/card.module.css'\n\nexport const Route = createFileRoute('/modules')({\n  component: Modules,\n})\n\nfunction Modules() {\n  return (\n    <div>\n      <h1>CSS Collection Test - CSS Modules</h1>\n      <p>\n        This page tests that CSS modules are collected and served during SSR.\n      </p>\n\n      <div class={styles.card} data-testid=\"module-card\">\n        <div class={styles.title} data-testid=\"module-title\">\n          CSS Module Applied\n        </div>\n        <div class={styles.content} data-testid=\"module-content\">\n          This card should have a green theme with scoped class names even with\n          JavaScript disabled.\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/routes/sass-mixin.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport '~/styles/app.scss'\n\nexport const Route = createFileRoute('/sass-mixin')({\n  component: SassMixin,\n})\n\nfunction SassMixin() {\n  return (\n    <div>\n      <h1>CSS Collection Test - Sass Mixin</h1>\n      <p>\n        This page tests that Sass mixins imported in a parent file are available\n        to subsequent imports during dev mode SSR.\n      </p>\n\n      <div class=\"mixin-container\" data-testid=\"mixin-styled\">\n        <span data-testid=\"mixin-content\">\n          Sass Mixin Applied - Should be centered with purple background\n        </span>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/styles/app.scss",
    "content": "// Import the mixin, which should make them available to future imports\n@import './center-mixin.scss';\n\n@import './mixin-consumer.scss';\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/styles/card.module.css",
    "content": "/* CSS Module for testing scoped styles in dev mode */\n\n.card {\n  background-color: #f0fdf4; /* green-50 */\n  padding: 16px;\n  border-radius: 8px;\n  border: 1px solid #22c55e; /* green-500 */\n}\n\n.title {\n  font-size: 18px;\n  font-weight: 600;\n  color: #166534; /* green-800 */\n  margin-bottom: 8px;\n}\n\n.content {\n  font-size: 14px;\n  color: #15803d; /* green-700 */\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/styles/center-mixin.scss",
    "content": "@mixin center-mixin {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/styles/global.css",
    "content": "/* Global styles for testing CSS collection in dev mode */\n\n.global-container {\n  background-color: #3b82f6; /* blue-500 */\n  padding: 24px;\n  border-radius: 12px;\n  color: white;\n}\n\n.global-title {\n  font-size: 24px;\n  font-weight: bold;\n  margin-bottom: 16px;\n}\n\n.global-description {\n  font-size: 16px;\n  opacity: 0.9;\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/src/styles/mixin-consumer.scss",
    "content": ".mixin-container {\n  // Use the center mixin, which is included in app.scss\n  // This works for the client build, but not for the dev server styles.css build\n  @include center-mixin;\n  background-color: #a855f7; /* purple-500 */\n  padding: 24px;\n  border-radius: 12px;\n  color: white;\n  min-height: 100px;\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/tests/css.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\n// Whitelist errors that can occur in CI:\n// - net::ERR_NAME_NOT_RESOLVED: transient network issues\n// - 504 (Outdated Optimize Dep): Vite dependency optimization reload\n// - net::ERR_INTERNET_DISCONNECTED: transient network issues\nconst whitelistErrors = [\n  'Failed to load resource: net::ERR_NAME_NOT_RESOLVED',\n  'Failed to load resource: net::ERR_INTERNET_DISCONNECTED',\n  'Failed to load resource: the server responded with a status of 504',\n]\n\ntest.describe('CSS styles in SSR (dev mode)', () => {\n  test.use({ whitelistErrors })\n\n  // Helper to build full URL from baseURL and path\n  // Playwright's goto with absolute paths (like '/modules') ignores baseURL's path portion\n  // So we need to manually construct the full URL\n  const buildUrl = (baseURL: string, path: string) => {\n    return baseURL.replace(/\\/$/, '') + path\n  }\n\n  test.describe('with JavaScript disabled', () => {\n    test.use({ javaScriptEnabled: false, whitelistErrors })\n\n    test('global CSS is applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/'))\n\n      const element = page.getByTestId('global-styled')\n      await expect(element).toBeVisible()\n\n      // Verify the CSS is applied by checking computed styles\n      // #3b82f6 (blue-500) in RGB is rgb(59, 130, 246)\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(59, 130, 246)')\n\n      const padding = await element.evaluate(\n        (el) => getComputedStyle(el).padding,\n      )\n      expect(padding).toBe('24px')\n\n      const borderRadius = await element.evaluate(\n        (el) => getComputedStyle(el).borderRadius,\n      )\n      expect(borderRadius).toBe('12px')\n    })\n\n    test('CSS modules are applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/modules'))\n\n      const card = page.getByTestId('module-card')\n      await expect(card).toBeVisible()\n\n      // Verify class is scoped (hashed)\n      const className = await card.getAttribute('class')\n      expect(className).toBeTruthy()\n      expect(className).not.toBe('card')\n      // The class should contain some hash characters (CSS modules add a hash)\n      expect(className!.length).toBeGreaterThan(5)\n\n      // Verify computed styles from card.module.css\n      // #f0fdf4 (green-50) in RGB is rgb(240, 253, 244)\n      const backgroundColor = await card.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(240, 253, 244)')\n\n      const padding = await card.evaluate((el) => getComputedStyle(el).padding)\n      expect(padding).toBe('16px')\n\n      const borderRadius = await card.evaluate(\n        (el) => getComputedStyle(el).borderRadius,\n      )\n      expect(borderRadius).toBe('8px')\n    })\n\n    test('global CSS class names are NOT scoped', async ({ page, baseURL }) => {\n      await page.goto(buildUrl(baseURL!, '/'))\n\n      const element = page.getByTestId('global-styled')\n      await expect(element).toBeVisible()\n\n      // Get the class attribute - it should be the plain class name (not hashed)\n      const className = await element.getAttribute('class')\n      expect(className).toBe('global-container')\n    })\n\n    test('Sass mixin styles are applied on initial page load', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto(buildUrl(baseURL!, '/sass-mixin'))\n\n      const element = page.getByTestId('mixin-styled')\n      await expect(element).toBeVisible()\n\n      // Verify the mixin is applied (display: flex from center-mixin)\n      const display = await element.evaluate(\n        (el) => getComputedStyle(el).display,\n      )\n      expect(display).toBe('flex')\n\n      const justifyContent = await element.evaluate(\n        (el) => getComputedStyle(el).justifyContent,\n      )\n      expect(justifyContent).toBe('center')\n\n      const alignItems = await element.evaluate(\n        (el) => getComputedStyle(el).alignItems,\n      )\n      expect(alignItems).toBe('center')\n\n      // Verify other styles from mixin-consumer.scss\n      // #a855f7 (purple-500) in RGB is rgb(168, 85, 247)\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(168, 85, 247)')\n\n      const padding = await element.evaluate(\n        (el) => getComputedStyle(el).padding,\n      )\n      expect(padding).toBe('24px')\n    })\n  })\n\n  test('styles persist after hydration', async ({ page, baseURL }) => {\n    await page.goto(buildUrl(baseURL!, '/'))\n\n    // Wait for hydration and styles to be applied\n    const element = page.getByTestId('global-styled')\n    await expect(element).toBeVisible()\n\n    // Wait for CSS to be applied (background color should not be transparent)\n    await expect(async () => {\n      const backgroundColor = await element.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(59, 130, 246)')\n    }).toPass({ timeout: 5000 })\n  })\n\n  test('CSS modules styles persist after hydration', async ({\n    page,\n    baseURL,\n  }) => {\n    await page.goto(buildUrl(baseURL!, '/modules'))\n\n    // Wait for hydration and styles to be applied\n    const card = page.getByTestId('module-card')\n    await expect(card).toBeVisible()\n\n    // Wait for CSS to be applied (background color should not be transparent)\n    await expect(async () => {\n      const backgroundColor = await card.evaluate(\n        (el) => getComputedStyle(el).backgroundColor,\n      )\n      expect(backgroundColor).toBe('rgb(240, 253, 244)')\n    }).toPass({ timeout: 5000 })\n  })\n\n  test('styles work correctly after client-side navigation', async ({\n    page,\n    baseURL,\n  }) => {\n    // Start from home\n    await page.goto(buildUrl(baseURL!, '/'))\n\n    // Verify initial styles\n    const globalElement = page.getByTestId('global-styled')\n    await expect(globalElement).toBeVisible()\n    let backgroundColor = await globalElement.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(59, 130, 246)')\n\n    // Navigate to modules page\n    await page.getByTestId('nav-modules').click()\n    await page.waitForURL('**/modules')\n\n    // Verify CSS modules styles\n    const card = page.getByTestId('module-card')\n    await expect(card).toBeVisible()\n    backgroundColor = await card.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(240, 253, 244)')\n\n    // Navigate back to home\n    await page.getByTestId('nav-home').click()\n    await page.waitForURL(/\\/([^/]*)(\\/)?($|\\?)/)\n\n    // Verify global styles still work\n    await expect(globalElement).toBeVisible()\n    backgroundColor = await globalElement.evaluate(\n      (el) => getComputedStyle(el).backgroundColor,\n    )\n    expect(backgroundColor).toBe('rgb(59, 130, 246)')\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/css-modules/tests/setup/global.setup.ts",
    "content": "import { chromium } from '@playwright/test'\nimport {\n  e2eStartDummyServer,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nasync function waitForServer(url: string) {\n  const start = Date.now()\n  while (Date.now() - start < 30_000) {\n    const controller = new AbortController()\n    const timer = setTimeout(() => controller.abort(), 5_000)\n    try {\n      const res = await fetch(url, {\n        redirect: 'manual',\n        signal: controller.signal,\n      })\n      if (res.ok) return\n    } catch {\n      // ignore aborted/network errors\n    } finally {\n      clearTimeout(timer)\n    }\n    await new Promise((r) => setTimeout(r, 250))\n  }\n  throw new Error(`Timed out waiting for dev server at ${url}`)\n}\n\nasync function preOptimizeDevServer(baseURL: string) {\n  const browser = await chromium.launch()\n  const context = await browser.newContext()\n  const page = await context.newPage()\n\n  try {\n    await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.goto(`${baseURL}/modules`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('module-card').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.goto(`${baseURL}/sass-mixin`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('mixin-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Exercise client-side navigation so Vite discovers any remaining deps\n    // that only load via the client router (not full-page navigations).\n    await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' })\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('nav-modules').click()\n    await page.waitForURL('**/modules')\n    await page.getByTestId('module-card').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('nav-home').click()\n    await page.waitForURL(/\\/([^/]*)(\\/)?($|\\?)/)\n    await page.getByTestId('global-styled').waitFor({ state: 'visible' })\n    await page.waitForLoadState('networkidle')\n\n    // Ensure we end in a stable state. Vite's optimize step triggers a reload;\n    // this waits until no further navigations happen for a short window.\n    for (let i = 0; i < 40; i++) {\n      const currentUrl = page.url()\n      await page.waitForTimeout(250)\n      if (page.url() === currentUrl) {\n        await page.waitForTimeout(250)\n        if (page.url() === currentUrl) return\n      }\n    }\n\n    throw new Error('Dev server did not reach a stable URL after warmup')\n  } finally {\n    await context.close()\n    await browser.close()\n  }\n}\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n\n  if (process.env.MODE !== 'dev') return\n\n  const port = await getTestServerPort(packageJson.name)\n  const baseURL = `http://localhost:${port}`\n\n  await waitForServer(baseURL)\n  await preOptimizeDevServer(baseURL)\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/css-modules/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tanstackStart(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/custom-basepath/express-server.ts",
    "content": "import express from 'express'\nimport { toNodeHandler } from 'srvx/node'\nimport type { NodeHttp1Handler } from 'srvx'\n\nconst DEVELOPMENT = process.env.NODE_ENV === 'development'\nconst PORT = Number.parseInt(process.env.PORT || '3000')\n\nconst app = express()\n\nif (DEVELOPMENT) {\n  const viteDevServer = await import('vite').then((vite) =>\n    vite.createServer({\n      server: { middlewareMode: true },\n    }),\n  )\n  app.use(viteDevServer.middlewares)\n  app.use(async (req, res, next) => {\n    try {\n      const { default: serverEntry } =\n        await viteDevServer.ssrLoadModule('./src/server.ts')\n      const handler = toNodeHandler(serverEntry.fetch) as NodeHttp1Handler\n      await handler(req, res)\n    } catch (error) {\n      if (typeof error === 'object' && error instanceof Error) {\n        viteDevServer.ssrFixStacktrace(error)\n      }\n      next(error)\n    }\n  })\n} else {\n  const { default: handler } = await import('./dist/server/server.js')\n  const nodeHandler = toNodeHandler(handler.fetch) as NodeHttp1Handler\n  app.use('/custom/basepath', express.static('dist/client'))\n  app.use(async (req, res, next) => {\n    try {\n      await nodeHandler(req, res)\n    } catch (error) {\n      next(error)\n    }\n  })\n}\n\napp.listen(PORT, () => {\n  console.log(`Server is running on http://localhost:${PORT}`)\n})\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-custom-basepath\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"cross-env NODE_ENV=development tsx express-server.ts\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"tsx express-server.ts\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"express\": \"^5.1.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"vue\": \"^3.5.25\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/express\": \"^5.0.3\",\n    \"@types/node\": \"^22.10.2\",\n    \"cross-env\": \"^10.0.0\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"tsx\": \"^4.20.3\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}/custom/basepath`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/components/CustomMessage.tsx",
    "content": "export function CustomMessage({ message }: { message: string }) {\n  return (\n    <div class=\"py-2\">\n      <div class=\"italic\">This is a custom message:</div>\n      <p>{message}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot.value ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e: MouseEvent) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/components/PostErrorComponent.tsx",
    "content": "import { ErrorComponent, ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/components/UserErrorComponent.tsx",
    "content": "import { ErrorComponent } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as RedirectIndexRouteImport } from './routes/redirect.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as RedirectThrowItRouteImport } from './routes/redirect.throw-it'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst RedirectIndexRoute = RedirectIndexRouteImport.update({\n  id: '/redirect/',\n  path: '/redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst RedirectThrowItRoute = RedirectThrowItRouteImport.update({\n  id: '/redirect/throw-it',\n  path: '/redirect/throw-it',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/redirect': typeof RedirectIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/logout': typeof LogoutRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/redirect/throw-it': typeof RedirectThrowItRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/redirect/': typeof RedirectIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/posts'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts/'\n    | '/redirect/'\n    | '/users/'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/deferred'\n    | '/logout'\n    | '/posts'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/redirect/throw-it'\n    | '/users/$userId'\n    | '/posts/'\n    | '/redirect/'\n    | '/users/'\n    | '/api/users/$userId'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DeferredRoute: typeof DeferredRoute\n  LogoutRoute: typeof LogoutRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  RedirectThrowItRoute: typeof RedirectThrowItRoute\n  RedirectIndexRoute: typeof RedirectIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/redirect/': {\n      id: '/redirect/'\n      path: '/redirect'\n      fullPath: '/redirect/'\n      preLoaderRoute: typeof RedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/redirect/throw-it': {\n      id: '/redirect/throw-it'\n      path: '/redirect/throw-it'\n      fullPath: '/redirect/throw-it'\n      preLoaderRoute: typeof RedirectThrowItRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DeferredRoute: DeferredRoute,\n  LogoutRoute: LogoutRoute,\n  PostsRoute: PostsRouteWithChildren,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  RedirectThrowItRoute: RedirectThrowItRoute,\n  RedirectIndexRoute: RedirectIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\nimport { basepath } from './utils/basepath'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n    basepath: basepath,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/__root.tsx",
    "content": "import {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\n\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/vue-router-devtools'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack Vue Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack Vue framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => <p>{props.error.stack}</p>,\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <Outlet />\n        <TanStackRouterDevtoolsInProd />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport type { User } from '~/utils/users'\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(`${queryURL}/users/${params.userId}`)\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n          const user = (await res.json()) as User\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createMiddleware } from '@tanstack/vue-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: /users')\n    const result = await next()\n    result.response.headers.set('x-users', 'true')\n    console.info('Out: /users')\n    return result\n  },\n)\n\nconst testParentMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: testParentMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test-parent', 'true')\n    console.info('Out: testParentMiddleware')\n    return result\n  },\n)\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next, request }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware, testParentMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await fetch(`${queryURL}/users`)\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n        const data = (await res.json()) as Array<User>\n        const list = data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { Suspense, defineComponent, ref } from 'vue'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(({ data }) => {\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((data: { name: string }) => data)\n  .handler(async ({ data }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name: data.name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst Deferred = defineComponent({\n  setup() {\n    const count = ref(0)\n    const loaderData = Route.useLoaderData()\n\n    return () => (\n      <div class=\"p-2\">\n        <div data-testid=\"regular-person\">\n          {loaderData.value.person.name} -{' '}\n          {loaderData.value.person.randomNumber}\n        </div>\n        <Suspense>\n          {{\n            default: () => (\n              <Await\n                promise={loaderData.value.deferredPerson}\n                children={(data: { name: string; randomNumber: number }) => (\n                  <div data-testid=\"deferred-person\">\n                    {data.name} - {data.randomNumber}\n                  </div>\n                )}\n              />\n            ),\n            fallback: () => <div>Loading person...</div>,\n          }}\n        </Suspense>\n        <Suspense>\n          {{\n            default: () => (\n              <Await\n                promise={loaderData.value.deferredStuff}\n                children={(data: string) => (\n                  <h3 data-testid=\"deferred-stuff\">{data}</h3>\n                )}\n              />\n            ),\n            fallback: () => <div>Loading stuff...</div>,\n          }}\n        </Suspense>\n        <div data-testid=\"count\">Count: {count.value}</div>\n        <div>\n          <button data-testid=\"increment\" onClick={() => count.value++}>\n            Increment\n          </button>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: { name: 'Tanner Linsley' } }),\n      person: await personServerFn({ data: { name: 'John Doe' } }),\n    }\n  },\n  component: Deferred,\n})\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { CustomMessage } from '~/components/CustomMessage'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <CustomMessage message=\"Hello from a custom component!\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/logout.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\n\nconst logoutFn = createServerFn({\n  method: 'POST',\n}).handler(async () => {\n  // do logout stuff here\n  throw redirect({\n    to: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Logout Page</h3>\n      <p>\n        This form tests that server function URLs correctly include the app's\n        basepath. The form action should be '/custom/basepath/_serverFn/...' not\n        just '/_serverFn/...'\n      </p>\n      <form action={logoutFn.url} method=\"post\">\n        <input type=\"hidden\" name=\"csrfToken\" value=\"123abc\" />\n        <button type=\"submit\">Logout</button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nimport { fetchPost } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostErrorComponent'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\" data-testid=\"post-view\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.value.id,\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nimport { fetchPosts } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {posts.value.map((post) => (\n          <li class=\"whitespace-nowrap\" key={post.id}>\n            <Link\n              to=\"/posts/$postId\"\n              params={{\n                postId: post.id,\n              }}\n              class=\"block py-1 text-blue-800 hover:text-blue-600\"\n              activeProps={{ class: 'text-black font-bold' }}\n            >\n              <div>{post.title.substring(0, 20)}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\nimport { PostErrorComponent } from '~/components/PostErrorComponent'\n\nimport { fetchPost } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/redirect.index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <Link to=\"/redirect/throw-it\">\n        <div data-testid=\"link-to-throw-it\">Throw It</div>\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/redirect.throw-it.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect/throw-it')({\n  beforeLoad: () => {\n    throw redirect({\n      to: '/posts/$postId',\n      params: { postId: '1' },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nimport type { User } from '~/utils/users'\nimport { NotFound } from '~/components/NotFound'\nimport { UserErrorComponent } from '~/components/UserErrorComponent'\nimport { basepath } from '~/utils/basepath'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    return await axios\n      .get<User>(basepath + '/api/users/' + userId)\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch user')\n      })\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user.value.name}</h4>\n      <div class=\"text-sm\">{user.value.email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport axios from 'redaxios'\nimport type { User } from '~/utils/users'\nimport { basepath } from '~/utils/basepath'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    return await axios\n      .get<Array<User>>(basepath + '/api/users')\n      .then((r) => r.data)\n      .catch(() => {\n        throw new Error('Failed to fetch users')\n      })\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users.value,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => (\n          <li class=\"whitespace-nowrap\" key={user.id}>\n            <Link\n              to=\"/users/$userId\"\n              params={{\n                userId: String(user.id),\n              }}\n              class=\"block py-1 text-blue-800 hover:text-blue-600\"\n              activeProps={{ class: 'text-black font-bold' }}\n            >\n              <div>{user.name}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/server.ts",
    "content": "import handler from '@tanstack/vue-start/server-entry'\n\nexport default {\n  fetch(request: Request) {\n    return handler.fetch(request)\n  },\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/utils/basepath.ts",
    "content": "export const basepath = '/custom/basepath'\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/tests/navigation.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('Navigating to post', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await page.getByRole('link', { name: 'Deep View' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating to user', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Users' }).click()\n  await page.getByRole('link', { name: 'Leanne Graham' }).click()\n  await expect(page.getByRole('heading')).toContainText('Leanne Graham')\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n\ntest('Should change title on client side navigation', async ({ page }) => {\n  await page.goto('/')\n\n  await page.getByRole('link', { name: 'Posts' }).click()\n\n  await expect(page).toHaveTitle('Posts page')\n})\n\ntest('Server function URLs correctly include app basepath', async ({\n  page,\n}) => {\n  await page.goto('/logout')\n\n  const form = page.locator('form')\n  const actionUrl = await form.getAttribute('action')\n\n  expect(actionUrl).toMatch(/^\\/custom\\/basepath\\/_serverFn\\//)\n})\n\ntest('client-side redirect', async ({ page, baseURL }) => {\n  await page.goto('/redirect')\n  await page.getByTestId('link-to-throw-it').click()\n  await page.waitForLoadState('networkidle')\n\n  expect(await page.getByTestId('post-view').isVisible()).toBe(true)\n  expect(page.url()).toBe(`${baseURL}/posts/1`)\n})\n\ntest('server-side redirect', async ({ page, baseURL }) => {\n  await page.goto('/redirect/throw-it')\n  await page.waitForLoadState('networkidle')\n\n  expect(await page.getByTestId('post-view').isVisible()).toBe(true)\n  expect(page.url()).toBe(`${baseURL}/posts/1`)\n\n  // do not follow redirects since we want to test the Location header\n  // first go to the route WITHOUT the base path, this will just add the base path\n  await page.request\n    .get('/redirect/throw-it', { maxRedirects: 0 })\n    .then((res) => {\n      const headers = new Headers(res.headers())\n      expect(headers.get('location')).toBe('/custom/basepath/redirect/throw-it')\n    })\n  await page.request\n    .get('/custom/basepath/redirect/throw-it', { maxRedirects: 0 })\n    .then((res) => {\n      const headers = new Headers(res.headers())\n      expect(headers.get('location')).toBe('/custom/basepath/posts/1')\n    })\n})\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/custom-basepath/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  base: '/custom/basepath',\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/query-integration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/query-integration/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/query-integration/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-query-integration\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-query\": \"^5.90.0\",\n    \"@tanstack/vue-query-devtools\": \"^5.90.0\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"vue\": \"^3.5.16\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { derivePort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await derivePort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/query-integration/src/queryOptions.ts",
    "content": "import { queryOptions } from '@tanstack/vue-query'\n\nexport const makeQueryOptions = (key: string) =>\n  queryOptions({\n    queryKey: ['e2e-test-query-integration', key],\n    queryFn: async () => {\n      console.log('fetching query data')\n      await new Promise<void>((resolve) => {\n        setTimeout(resolve, 500)\n      })\n      const result = typeof window !== 'undefined' ? 'client' : 'server'\n      console.log('query data result', result)\n      return result\n    },\n    staleTime: Infinity,\n  })\n"
  },
  {
    "path": "e2e/vue-start/query-integration/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UseQueryRouteImport } from './routes/useQuery'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as LoaderFetchQueryTypeRouteImport } from './routes/loader-fetchQuery/$type'\n\nconst UseQueryRoute = UseQueryRouteImport.update({\n  id: '/useQuery',\n  path: '/useQuery',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoaderFetchQueryTypeRoute = LoaderFetchQueryTypeRouteImport.update({\n  id: '/loader-fetchQuery/$type',\n  path: '/loader-fetchQuery/$type',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/useQuery': typeof UseQueryRoute\n  '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/useQuery' | '/loader-fetchQuery/$type'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/useQuery' | '/loader-fetchQuery/$type'\n  id: '__root__' | '/' | '/useQuery' | '/loader-fetchQuery/$type'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  UseQueryRoute: typeof UseQueryRoute\n  LoaderFetchQueryTypeRoute: typeof LoaderFetchQueryTypeRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/useQuery': {\n      id: '/useQuery'\n      path: '/useQuery'\n      fullPath: '/useQuery'\n      preLoaderRoute: typeof UseQueryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/loader-fetchQuery/$type': {\n      id: '/loader-fetchQuery/$type'\n      path: '/loader-fetchQuery/$type'\n      fullPath: '/loader-fetchQuery/$type'\n      preLoaderRoute: typeof LoaderFetchQueryTypeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  UseQueryRoute: UseQueryRoute,\n  LoaderFetchQueryTypeRoute: LoaderFetchQueryTypeRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/vue-query'\nimport { createRouter } from '@tanstack/vue-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/vue-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/vue-router'\nimport { VueQueryDevtools } from '@tanstack/vue-query-devtools'\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/vue-router-devtools'\nimport type { QueryClient } from '@tanstack/vue-query'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/loader-fetchQuery/$type\"\n            params={{ type: 'sync' }}\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            fetchQuery (sync)\n          </Link>{' '}\n          <Link\n            to=\"/loader-fetchQuery/$type\"\n            params={{ type: 'async' }}\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            fetchQuery (async)\n          </Link>{' '}\n          <Link\n            to=\"/useQuery\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            useQuery\n          </Link>{' '}\n        </div>\n        <hr />\n        <Outlet />\n        <TanStackRouterDevtoolsInProd position=\"bottom-right\" />\n        <VueQueryDevtools buttonPosition=\"bottom-left\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Query Integration E2E tests</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/src/routes/loader-fetchQuery/$type.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport { createFileRoute } from '@tanstack/vue-router'\nimport z from 'zod'\nimport { makeQueryOptions } from '~/queryOptions'\n\nexport const Route = createFileRoute('/loader-fetchQuery/$type')({\n  component: RouteComponent,\n  params: {\n    parse: ({ type }) =>\n      z\n        .object({\n          type: z.union([z.literal('sync'), z.literal('async')]),\n        })\n        .parse({ type }),\n  },\n  context: ({ params }) => ({\n    queryOptions: makeQueryOptions(`loader-fetchQuery-${params.type}`),\n  }),\n  loader: ({ context, params }) => {\n    const queryPromise = context.queryClient.fetchQuery(context.queryOptions)\n    if (params.type === 'sync') {\n      return queryPromise\n    }\n  },\n  ssr: 'data-only',\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n  const context = Route.useRouteContext()\n  const query = useQuery(context.value.queryOptions)\n  return (\n    <div>\n      <div>\n        loader data:{' '}\n        <div data-testid=\"loader-data\">{loaderData.value ?? 'undefined'}</div>\n      </div>\n      <div>\n        query data:{' '}\n        <div data-testid=\"query-data\">{query.data.value ?? 'loading...'}</div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/src/routes/useQuery.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport { createFileRoute } from '@tanstack/vue-router'\nimport { makeQueryOptions } from '~/queryOptions'\n\nconst qOptions = makeQueryOptions('useQuery')\n\nexport const Route = createFileRoute('/useQuery')({\n  loader: ({ context }) => context.queryClient.ensureQueryData(qOptions),\n  component: RouteComponent,\n  ssr: true,\n})\n\nfunction RouteComponent() {\n  const query = useQuery(qOptions)\n  return (\n    <div>\n      <div>\n        query data:{' '}\n        <div data-testid=\"query-data\">{query.data.value ?? 'loading...'}</div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.describe('queries are streamed from the server', () => {\n  test('direct visit - loader on server runs fetchQuery and awaits it', async ({\n    page,\n  }) => {\n    await page.goto('/loader-fetchQuery/sync')\n\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n\n    const loaderData = page.getByTestId('loader-data')\n    await expect(loaderData).toHaveText('server')\n  })\n  test('direct visit - loader on server runs fetchQuery and does not await it', async ({\n    page,\n  }) => {\n    await page.goto('/loader-fetchQuery/async')\n\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n\n    const loaderData = page.getByTestId('loader-data')\n    await expect(loaderData).toHaveText('undefined')\n  })\n\n  test('useQuery', async ({ page }) => {\n    await page.goto('/useQuery')\n\n    const queryData = page.getByTestId('query-data')\n    await expect(queryData).toHaveText('server')\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/query-integration/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/query-integration/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  plugins: [tailwindcss(), tanstackStart(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-basic-scroll-restoration\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"@tanstack/zod-adapter\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot.value ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e: MouseEvent) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as testsWithSearchRouteImport } from './routes/(tests)/with-search'\nimport { Route as testsWithLoaderRouteImport } from './routes/(tests)/with-loader'\nimport { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsWithSearchRoute = testsWithSearchRouteImport.update({\n  id: '/(tests)/with-search',\n  path: '/with-search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsWithLoaderRoute = testsWithLoaderRouteImport.update({\n  id: '/(tests)/with-loader',\n  path: '/with-loader',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testsNormalPageRoute = testsNormalPageRouteImport.update({\n  id: '/(tests)/normal-page',\n  path: '/normal-page',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/with-loader': typeof testsWithLoaderRoute\n  '/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/normal-page': typeof testsNormalPageRoute\n  '/with-loader': typeof testsWithLoaderRoute\n  '/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/(tests)/normal-page': typeof testsNormalPageRoute\n  '/(tests)/with-loader': typeof testsWithLoaderRoute\n  '/(tests)/with-search': typeof testsWithSearchRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/normal-page' | '/with-loader' | '/with-search'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/normal-page' | '/with-loader' | '/with-search'\n  id:\n    | '__root__'\n    | '/'\n    | '/(tests)/normal-page'\n    | '/(tests)/with-loader'\n    | '/(tests)/with-search'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  testsNormalPageRoute: typeof testsNormalPageRoute\n  testsWithLoaderRoute: typeof testsWithLoaderRoute\n  testsWithSearchRoute: typeof testsWithSearchRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/with-search': {\n      id: '/(tests)/with-search'\n      path: '/with-search'\n      fullPath: '/with-search'\n      preLoaderRoute: typeof testsWithSearchRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/with-loader': {\n      id: '/(tests)/with-loader'\n      path: '/with-loader'\n      fullPath: '/with-loader'\n      preLoaderRoute: typeof testsWithLoaderRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(tests)/normal-page': {\n      id: '/(tests)/normal-page'\n      path: '/normal-page'\n      fullPath: '/normal-page'\n      preLoaderRoute: typeof testsNormalPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  testsNormalPageRoute: testsNormalPageRoute,\n  testsWithLoaderRoute: testsWithLoaderRoute,\n  testsWithSearchRoute: testsWithSearchRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/routes/(tests)/normal-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/normal-page')({\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>normal-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/routes/(tests)/with-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { sleep } from 'src/utils/posts'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/with-loader')({\n  loader: async () => {\n    await sleep(1000)\n    return { foo: 'bar' }\n  },\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>lazy-with-loader-page</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/routes/(tests)/with-search.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\nimport { ScrollBlock } from '../-components/scroll-block'\n\nexport const Route = createFileRoute('/(tests)/with-search')({\n  validateSearch: zodValidator(z.object({ where: z.string() })),\n  component: Component,\n})\n\nfunction Component() {\n  return (\n    <div class=\"p-2\">\n      <h3>page-with-search</h3>\n      <hr />\n      <ScrollBlock />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/routes/-components/scroll-block.tsx",
    "content": "export const atTheTopId = 'at-the-top'\nexport const atTheBottomId = 'at-the-bottom'\n\nexport function ScrollBlock({ number = 100 }: { number?: number }) {\n  return (\n    <>\n      <div id={atTheTopId} data-testid={atTheTopId}></div>\n      {Array.from({ length: number }).map((_, i) => (\n        <div>{i}</div>\n      ))}\n      <div id={atTheBottomId} data-testid={atTheBottomId}>\n        At the bottom\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/routes/__root.tsx",
    "content": "import {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  linkOptions,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack Vue Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack Vue framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return <p>{props.error.stack}</p>\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <Nav type=\"header\" />\n        <hr />\n        <Outlet />\n        <hr />\n        <Nav type=\"footer\" />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n\nfunction Nav({ type }: { type: 'header' | 'footer' }) {\n  const prefix = type === 'header' ? 'Head' : 'Foot'\n  const optionsList = [\n    linkOptions({ to: '/normal-page' }),\n    linkOptions({ to: '/with-loader' }),\n    linkOptions({ to: '/with-search', search: { where: type } }),\n  ] as const\n\n  const content = (\n    <>\n      <Link\n        to=\"/\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n        activeOptions={{ exact: true }}\n      >\n        {prefix}-/\n      </Link>{' '}\n      {optionsList.map((options, i) => (\n        <Link\n          key={i}\n          {...options}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          {prefix}-{options.to}\n        </Link>\n      ))}\n    </>\n  )\n\n  return type === 'header' ? (\n    <header class=\"p-2 flex gap-2 text-lg\">{content}</header>\n  ) : (\n    <footer class=\"p-2 flex gap-2 text-lg\">{content}</footer>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/routes/index.tsx",
    "content": "import { Link, createFileRoute, linkOptions } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2 grid gap-2\">\n      <h3>Welcome Home!</h3>\n      <p>\n        The are the links to be tested when navigating away from the index page.\n        Otherwise known as NOT first-load tests, rather known as navigation\n        tests.\n      </p>\n      {(\n        [\n          linkOptions({ to: '/normal-page' }),\n          linkOptions({ to: '/with-loader' }),\n          linkOptions({ to: '/with-search', search: { where: 'footer' } }),\n        ] as const\n      ).map((options, i) => (\n        <div class=\"border p-2\">\n          <h4>{options.to} tests</h4>\n          <p>\n            <Link {...options} hash=\"at-the-bottom\">\n              {options.to}#at-the-bottom\n            </Link>\n          </p>\n        </div>\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/utils/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport function sleep(ms: number) {\n  return new Promise((r) => setTimeout(r, ms))\n}\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest('Smoke - Renders home', async ({ page }) => {\n  await page.goto('/')\n  await expect(\n    page.getByRole('heading', { name: 'Welcome Home!' }),\n  ).toBeVisible()\n})\n\n// Test for scroll related stuff\n;[\n  { to: '/normal-page' },\n  { to: '/with-loader' },\n  { to: '/with-search', search: { where: 'footer' } },\n].forEach((options) => {\n  test(`On navigate to ${options.to} (from the header), scroll should be at top`, async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page.getByRole('link', { name: `Head-${options.to}` }).click()\n    await expect(page.getByTestId('at-the-top')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on navigation after the page is loaded\n  test(`On navigate via index page tests to ${options.to}, scroll should resolve at the bottom`, async ({\n    page,\n  }) => {\n    await page.goto('/')\n    await page\n      .getByRole('link', { name: `${options.to}#at-the-bottom` })\n      .click()\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n\n  // scroll should be at the bottom on first load\n  test(`On first load of ${options.to}, scroll should resolve resolve at the bottom`, async ({\n    page,\n  }) => {\n    let url: string = options.to\n    if ('search' in options) {\n      url = `${url}?where=${options.search}`\n    }\n    await page.goto(`${url}#at-the-bottom`)\n    await expect(page.getByTestId('at-the-bottom')).toBeInViewport()\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/scroll-restoration/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/selective-ssr/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-selective-ssr\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"vue-tsc\": \"^3.1.8\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts' | '/posts/$postId'\n  id: '__root__' | '/' | '/posts' | '/posts/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  ClientOnly,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { ssrSchema } from '~/search'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'Selective SSR E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  validateSearch: z.object({ root: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.root?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.root?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      root: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.root?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { root: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  shellComponent: RootDocument,\n  component: () => {\n    const search = Route.useSearch()\n    if (\n      typeof window === 'undefined' &&\n      search.value.root?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    return (\n      <div data-testid=\"root-container\">\n        <h2 data-testid=\"root-heading\">root</h2>\n        <div>\n          ssr: <b>{JSON.stringify(search.value.root?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"root-data-expected\">\n            {search.value.root?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader: <b data-testid=\"root-loader\">{loaderData.value.root}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"root-context\">{context.value.root}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n})\n\nfunction RootDocument(_: unknown, { slots }: { slots: any }) {\n  const routerState = useRouterState({\n    select: (state) => ({\n      isLoading: state.isLoading,\n      status: state.status,\n    }),\n  })\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <h1>Selective SSR E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">\n              {routerState.value.isLoading ? 'true' : 'false'}\n            </b>\n          </div>\n          <div>\n            router status:{' '}\n            <b data-testid=\"router-status\">{routerState.value.status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {slots.default?.()}\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/src/routes/index.tsx",
    "content": "import { Link, createFileRoute, linkOptions } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nconst baseTestCase = linkOptions({\n  to: '/posts/$postId',\n  params: { postId: '1' },\n})\n\nconst testCases = [\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: undefined,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        posts: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        posts: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: true,\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: 'data-only',\n          expected: { data: 'server', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: 'data-only',\n          expected: { data: 'server', render: 'client-only' },\n        },\n        posts: {\n          ssr: true,\n          expected: { data: 'server', render: 'client-only' },\n        },\n        postId: {\n          ssr: undefined,\n\n          expected: { data: 'server', render: 'client-only' },\n        },\n      },\n    }),\n  },\n  {\n    link: linkOptions({\n      ...baseTestCase,\n      search: {\n        root: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        posts: {\n          ssr: true,\n          expected: { data: 'server', render: 'server-and-client' },\n        },\n        postId: {\n          ssr: false,\n          expected: { data: 'client', render: 'client-only' },\n        },\n      },\n    }),\n  },\n]\n\nfunction Home() {\n  const links = testCases.map((t, index) => {\n    const key = `testcase-${index}-link`\n\n    return (\n      <div>\n        <Link data-testid={key} {...t.link} reloadDocument={true}>\n          root: {JSON.stringify(t.link.search.root.ssr ?? 'undefined')} posts:{' '}\n          {JSON.stringify(t.link.search.posts.ssr ?? 'undefined')} $postId:{' '}\n          {JSON.stringify(t.link.search.postId.ssr ?? 'undefined')}\n        </Link>\n        <br />\n        <br />\n      </div>\n    )\n  })\n\n  return (\n    <>\n      <div>\n        test count: <b data-testid=\"test-count\">{links.length}</b>\n      </div>\n      <div>{links}</div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport z from 'zod'\nimport { ssrSchema } from '~/search'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  validateSearch: z.object({ postId: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.postId?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.postId?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      postId: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.postId?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { postId: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    if (\n      typeof window === 'undefined' &&\n      search.value.postId?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return (\n      <div data-testid=\"postId-container\">\n        <h4 data-testid=\"postId-heading\">postId</h4>\n        <div>\n          ssr: <b>{JSON.stringify(search.value.postId?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"postId-data-expected\">\n            {search.value.postId?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader: <b data-testid=\"postId-loader\">{loaderData.value.postId}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"postId-context\">{context.value.postId}</b>\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/src/routes/posts.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\nimport z from 'zod'\nimport { ssrSchema } from '~/search'\n\nexport const Route = createFileRoute('/posts')({\n  validateSearch: z.object({ posts: ssrSchema }),\n  ssr: ({ search }) => {\n    if (typeof window !== 'undefined') {\n      const error = `ssr() for ${Route.id} should not be called on the client`\n      console.error(error)\n      throw new Error(error)\n    }\n    if (search.status === 'success') {\n      return search.value.posts?.ssr\n    }\n  },\n  beforeLoad: ({ search }) => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    if (\n      search.posts?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected beforeLoad for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return {\n      posts: typeof window === 'undefined' ? 'server' : 'client',\n      search,\n    }\n  },\n  loader: ({ context }) => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    if (\n      context.search.posts?.expected?.data === 'client' &&\n      typeof window === 'undefined'\n    ) {\n      const error = `Expected loader for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return { posts: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const search = Route.useSearch()\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    if (\n      typeof window === 'undefined' &&\n      search.value.posts?.expected?.render === 'client-only'\n    ) {\n      const error = `Expected component for ${Route.id} to be executed on the client, but it is running on the server`\n      console.error(error)\n      throw new Error(error)\n    }\n    return (\n      <div data-testid=\"posts-container\">\n        <h3 data-testid=\"posts-heading\">posts</h3>\n        <div>\n          ssr: <b>{JSON.stringify(search.value.posts?.ssr ?? 'undefined')}</b>\n        </div>\n        <div>\n          expected data location execution:{' '}\n          <b data-testid=\"posts-data-expected\">\n            {search.value.posts?.expected?.data}\n          </b>\n        </div>\n        <div>\n          loader: <b data-testid=\"posts-loader\">{loaderData.value.posts}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"posts-context\">{context.value.posts}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/src/search.ts",
    "content": "import { z } from 'zod'\n\nexport const ssrSchema = z\n  .object({\n    ssr: z.union([z.literal('data-only'), z.boolean()]).optional(),\n    expected: z\n      .object({\n        data: z.union([z.literal('client'), z.literal('server')]),\n        render: z.union([\n          z.literal('client-only'),\n          z.literal('server-and-client'),\n        ]),\n      })\n      .optional(),\n  })\n  .optional()\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\nconst testCount = 7\n\ntest.describe('selective ssr', () => {\n  test('testcount matches', async ({ page }) => {\n    await page.goto('/')\n\n    await expect(page.getByTestId('test-count')).toHaveText(`${testCount}`)\n  })\n\n  for (let i = 0; i < testCount; i++) {\n    test(`run test ${i}`, async ({ page }) => {\n      await page.goto('/')\n      const testId = `testcase-${i}-link`\n      await page.getByTestId(testId).click()\n\n      // wait for page to be loaded by waiting for the leaf route to be rendered\n      await expect(page.getByTestId('postId-heading')).toContainText('postId')\n\n      // check expectations\n      await Promise.all(\n        ['root', 'posts', 'postId'].map(async (route) => {\n          const expectedData = await page\n            .getByTestId(`${route}-data-expected`)\n            .textContent()\n          expect(expectedData).not.toBeNull()\n          await expect(page.getByTestId(`${route}-loader`)).toContainText(\n            expectedData!,\n          )\n          await expect(page.getByTestId(`${route}-context`)).toContainText(\n            expectedData!,\n          )\n        }),\n      )\n      await expect(page.getByTestId('router-isLoading')).toContainText('false')\n      await expect(page.getByTestId('router-status')).toContainText('idle')\n    })\n  }\n})\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/selective-ssr/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-serialization-adapters\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"vue-tsc\": \"^3.1.8\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/CustomError.ts",
    "content": "import { createSerializationAdapter } from '@tanstack/vue-router'\n\nexport class CustomError extends Error {\n  public foo: string\n  public bar: bigint\n\n  constructor(message: string, options: { foo: string; bar: bigint }) {\n    super(message)\n\n    Object.setPrototypeOf(this, new.target.prototype)\n\n    this.name = this.constructor.name\n    this.foo = options.foo\n    this.bar = options.bar\n  }\n}\n\nexport const customErrorAdapter = createSerializationAdapter({\n  key: 'custom-error',\n  test: (v) => v instanceof CustomError,\n  toSerializable: ({ message, foo, bar }) => {\n    return {\n      message,\n      foo,\n      bar,\n    }\n  },\n  fromSerializable: ({ message, foo, bar }) => {\n    return new CustomError(message, { foo, bar })\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/data.tsx",
    "content": "import { createSerializationAdapter } from '@tanstack/vue-router'\n\nexport class Foo {\n  constructor(public value: string) {}\n}\n\nexport interface Car {\n  __type: 'car'\n  make: string\n  model: string\n  year: number\n  honk: () => { message: string; make: string; model: string; year: number }\n}\n\nexport function makeCar(opts: {\n  make: string\n  model: string\n  year: number\n}): Car {\n  return {\n    ...opts,\n    __type: 'car',\n    honk: () => {\n      return { message: `Honk! Honk!`, ...opts }\n    },\n  }\n}\n\nexport const fooAdapter = createSerializationAdapter({\n  key: 'foo',\n  test: (value: any) => value instanceof Foo,\n  toSerializable: (foo) => foo.value,\n  fromSerializable: (value) => new Foo(value),\n})\n\nexport const carAdapter = createSerializationAdapter({\n  key: 'car',\n  test: (value: any): value is Car =>\n    '__type' in (value as Car) && value.__type === 'car',\n  toSerializable: (car) => ({\n    make: car.make,\n    model: car.model,\n    year: car.year,\n  }),\n  fromSerializable: (value: { make: string; model: string; year: number }) =>\n    makeCar(value),\n})\n\nexport function makeData() {\n  function makeFoo(suffix: string = '') {\n    return new Foo(typeof window === 'undefined' ? 'server' : 'client' + suffix)\n  }\n  return {\n    foo: {\n      singleInstance: makeFoo(),\n      array: [makeFoo('0'), makeFoo('1'), makeFoo('2')],\n      map: new Map([\n        [0, makeFoo('0')],\n        [1, makeFoo('1')],\n        [2, makeFoo('2')],\n      ]),\n      mapOfArrays: new Map([\n        [0, [makeFoo('0-a'), makeFoo('0-b')]],\n        [1, [makeFoo('1-a'), makeFoo('1-b')]],\n        [2, [makeFoo('2-a'), makeFoo('2-b')]],\n      ]),\n    },\n    car: {\n      singleInstance: makeCar({\n        make: 'Toyota',\n        model: 'Camry',\n        year: 2020,\n      }),\n      array: [\n        makeCar({ make: 'Honda', model: 'Accord', year: 2019 }),\n        makeCar({ make: 'Ford', model: 'Mustang', year: 2021 }),\n      ],\n      map: new Map([\n        [0, makeCar({ make: 'Chevrolet', model: 'Malibu', year: 2018 })],\n        [1, makeCar({ make: 'Nissan', model: 'Altima', year: 2020 })],\n        [2, makeCar({ make: 'Hyundai', model: 'Sonata', year: 2021 })],\n      ]),\n      mapOfArrays: new Map([\n        [0, [makeCar({ make: 'Kia', model: 'Optima', year: 2019 })]],\n        [1, [makeCar({ make: 'Subaru', model: 'Legacy', year: 2020 })]],\n        [2, [makeCar({ make: 'Volkswagen', model: 'Passat', year: 2021 })]],\n      ]),\n    },\n  }\n}\nexport class NestedOuter {\n  constructor(public inner: NestedInner) {}\n  whisper() {\n    return this.inner.value.toLowerCase()\n  }\n}\n\nexport class NestedInner {\n  constructor(public value: string) {}\n  shout() {\n    return this.value.toUpperCase()\n  }\n}\n\nexport const nestedInnerAdapter = createSerializationAdapter({\n  key: 'nestedInner',\n  test: (value): value is NestedInner => value instanceof NestedInner,\n  toSerializable: (inner) => inner.value,\n  fromSerializable: (value) => new NestedInner(value),\n})\n\nexport const nestedOuterAdapter = createSerializationAdapter({\n  key: 'nestedOuter',\n  extends: [nestedInnerAdapter],\n  test: (value) => value instanceof NestedOuter,\n  toSerializable: (outer) => outer.inner,\n  fromSerializable: (value) => new NestedOuter(value),\n})\n\nexport function makeNested() {\n  return new NestedOuter(new NestedInner('Hello World'))\n}\n\nexport function RenderData({\n  id,\n  data,\n}: {\n  id: string\n  data: ReturnType<typeof makeData>\n}) {\n  const localData = makeData()\n  return (\n    <div data-testid={`${id}-container`}>\n      <h3>Car</h3>\n      <h4>expected</h4>\n      <div data-testid={`${id}-car-expected`}>\n        {JSON.stringify({\n          make: localData.car.singleInstance.make,\n          model: localData.car.singleInstance.model,\n          year: localData.car.singleInstance.year,\n        })}\n      </div>\n      <h4>actual</h4>\n      <div data-testid={`${id}-car-actual`}>\n        {JSON.stringify({\n          make: data.car.singleInstance.make,\n          model: data.car.singleInstance.model,\n          year: data.car.singleInstance.year,\n        })}\n      </div>\n      <b>Foo</b>\n      <div data-testid={`${id}-foo`}>\n        {JSON.stringify({\n          value: data.foo.singleInstance.value,\n        })}\n      </div>\n    </div>\n  )\n}\n\nexport function RenderNestedData({ nested }: { nested: NestedOuter }) {\n  {\n    const localData = makeNested()\n    const expectedShoutState = localData.inner.shout()\n    const expectedWhisperState = localData.whisper()\n    const shoutState = nested.inner.shout()\n    const whisperState = nested.whisper()\n\n    return (\n      <div data-testid=\"data-only-container\">\n        <h2 data-testid=\"data-only-heading\">data-only</h2>\n        <div data-testid=\"shout-container\">\n          <h3>shout</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"shout-expected-state\">\n              {JSON.stringify(expectedShoutState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"shout-actual-state\">\n              {JSON.stringify(shoutState)}\n            </div>\n          </div>\n        </div>\n        <div data-testid=\"whisper-container\">\n          <h3>whisper</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"whisper-expected-state\">\n              {JSON.stringify(expectedWhisperState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"whisper-actual-state\">\n              {JSON.stringify(whisperState)}\n            </div>\n          </div>\n        </div>\n      </div>\n    )\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SsrStreamRouteImport } from './routes/ssr/stream'\nimport { Route as SsrNestedRouteImport } from './routes/ssr/nested'\nimport { Route as SsrDataOnlyRouteImport } from './routes/ssr/data-only'\nimport { Route as ServerFunctionNestedRouteImport } from './routes/server-function/nested'\nimport { Route as ServerFunctionCustomErrorRouteImport } from './routes/server-function/custom-error'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrStreamRoute = SsrStreamRouteImport.update({\n  id: '/ssr/stream',\n  path: '/ssr/stream',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrNestedRoute = SsrNestedRouteImport.update({\n  id: '/ssr/nested',\n  path: '/ssr/nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SsrDataOnlyRoute = SsrDataOnlyRouteImport.update({\n  id: '/ssr/data-only',\n  path: '/ssr/data-only',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ServerFunctionNestedRoute = ServerFunctionNestedRouteImport.update({\n  id: '/server-function/nested',\n  path: '/server-function/nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ServerFunctionCustomErrorRoute =\n  ServerFunctionCustomErrorRouteImport.update({\n    id: '/server-function/custom-error',\n    path: '/server-function/custom-error',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/server-function/custom-error': typeof ServerFunctionCustomErrorRoute\n  '/server-function/nested': typeof ServerFunctionNestedRoute\n  '/ssr/data-only': typeof SsrDataOnlyRoute\n  '/ssr/nested': typeof SsrNestedRoute\n  '/ssr/stream': typeof SsrStreamRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  id:\n    | '__root__'\n    | '/'\n    | '/server-function/custom-error'\n    | '/server-function/nested'\n    | '/ssr/data-only'\n    | '/ssr/nested'\n    | '/ssr/stream'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ServerFunctionCustomErrorRoute: typeof ServerFunctionCustomErrorRoute\n  ServerFunctionNestedRoute: typeof ServerFunctionNestedRoute\n  SsrDataOnlyRoute: typeof SsrDataOnlyRoute\n  SsrNestedRoute: typeof SsrNestedRoute\n  SsrStreamRoute: typeof SsrStreamRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/stream': {\n      id: '/ssr/stream'\n      path: '/ssr/stream'\n      fullPath: '/ssr/stream'\n      preLoaderRoute: typeof SsrStreamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/nested': {\n      id: '/ssr/nested'\n      path: '/ssr/nested'\n      fullPath: '/ssr/nested'\n      preLoaderRoute: typeof SsrNestedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/ssr/data-only': {\n      id: '/ssr/data-only'\n      path: '/ssr/data-only'\n      fullPath: '/ssr/data-only'\n      preLoaderRoute: typeof SsrDataOnlyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/server-function/nested': {\n      id: '/server-function/nested'\n      path: '/server-function/nested'\n      fullPath: '/server-function/nested'\n      preLoaderRoute: typeof ServerFunctionNestedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/server-function/custom-error': {\n      id: '/server-function/custom-error'\n      path: '/server-function/custom-error'\n      fullPath: '/server-function/custom-error'\n      preLoaderRoute: typeof ServerFunctionCustomErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ServerFunctionCustomErrorRoute: ServerFunctionCustomErrorRoute,\n  ServerFunctionNestedRoute: ServerFunctionNestedRoute,\n  SsrDataOnlyRoute: SsrDataOnlyRoute,\n  SsrNestedRoute: SsrNestedRoute,\n  SsrStreamRoute: SsrStreamRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { startInstance } from './start.tsx'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n    config: Awaited<ReturnType<typeof startInstance.getOptions>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  ClientOnly,\n  HeadContent,\n  Html,\n  Link,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/vue-router-devtools'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'Serialization Adapters E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  shellComponent: RootDocument,\n  notFoundComponent: (e) => <div>404 - Not Found {JSON.stringify(e.data)}</div>,\n})\n\nfunction RootDocument(_: unknown, { slots }: { slots: any }) {\n  const routerState = useRouterState({\n    select: (state) => ({ isLoading: state.isLoading, status: state.status }),\n  })\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <h1>Serialization Adapters E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">\n              {routerState.value.isLoading ? 'true' : 'false'}\n            </b>\n          </div>\n          <div>\n            router status:{' '}\n            <b data-testid=\"router-status\">{routerState.value.status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {slots.default?.()}\n        <Scripts />\n        <TanStackRouterDevtoolsInProd position=\"bottom-right\" />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  errorComponent: (e) => <div>{e.error.message} </div>,\n})\n\nfunction Home() {\n  return (\n    <>\n      <div>\n        <h2>SSR</h2>\n        <Link\n          data-testid=\"ssr-data-only-link\"\n          to=\"/ssr/data-only\"\n          reloadDocument={true}\n        >\n          Data Only\n        </Link>\n        <br />\n        <Link\n          data-testid=\"ssr-stream-link\"\n          to=\"/ssr/stream\"\n          reloadDocument={true}\n        >\n          Stream\n        </Link>\n        <br />\n        <Link\n          data-testid=\"ssr-nested-link\"\n          to=\"/ssr/nested\"\n          reloadDocument={true}\n        >\n          Nested Classes\n        </Link>\n      </div>\n      <div>\n        <h2>Server Functions</h2>\n        <Link\n          data-testid=\"server-function-custom-error-link\"\n          to=\"/server-function/custom-error\"\n          reloadDocument={true}\n        >\n          Custom Error Serialization\n        </Link>\n        <br />\n        <Link\n          data-testid=\"server-functions-nested-link\"\n          to=\"/server-function/nested\"\n          reloadDocument={true}\n        >\n          Nested Classes returned from Server Function\n        </Link>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/routes/server-function/custom-error.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { setResponseStatus } from '@tanstack/vue-start/server'\nimport { defineComponent, ref } from 'vue'\nimport { z } from 'zod'\nimport { CustomError } from '~/CustomError'\n\nconst schema = z.object({ hello: z.string() })\nconst serverFnThrowing = createServerFn()\n  .inputValidator(schema)\n  .handler(async ({ data }) => {\n    if (data.hello === 'world') {\n      return 'Hello, world!'\n    }\n    setResponseStatus(499)\n    throw new CustomError('Invalid input', { foo: 'bar', bar: BigInt(123) })\n  })\n\nconst RouteComponent = defineComponent({\n  name: 'ServerFunctionCustomErrorRoute',\n  setup() {\n    const validResponse = ref<any>(null)\n    const invalidResponse = ref<CustomError | null>(null)\n\n    return () => (\n      <div>\n        <button\n          data-testid=\"server-function-valid-input\"\n          onClick={() =>\n            serverFnThrowing({ data: { hello: 'world' } }).then(\n              (res) => (validResponse.value = res),\n            )\n          }\n        >\n          trigger valid input\n        </button>\n        <div data-testid=\"server-function-valid-response\">\n          {JSON.stringify(validResponse.value)}\n        </div>\n\n        <br />\n        <button\n          data-testid=\"server-function-invalid-input\"\n          onClick={() =>\n            serverFnThrowing({ data: { hello: 'error' } }).catch((err) => {\n              if (err instanceof CustomError) {\n                invalidResponse.value = err\n              } else {\n                throw new Error('expected CustomError')\n              }\n            })\n          }\n        >\n          trigger invalid input\n        </button>\n        <div data-testid=\"server-function-invalid-response\">\n          {invalidResponse.value\n            ? JSON.stringify({\n                message: invalidResponse.value.message,\n                foo: invalidResponse.value.foo,\n                bar: invalidResponse.value.bar.toString(),\n              })\n            : JSON.stringify(invalidResponse.value)}\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/server-function/custom-error')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/routes/server-function/nested.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\nimport type { NestedOuter } from '~/data'\nimport { RenderNestedData, makeNested } from '~/data'\n\nconst serverFnReturningNested = createServerFn().handler(() => {\n  return makeNested()\n})\n\nconst RouteComponent = defineComponent({\n  name: 'ServerFunctionNestedRoute',\n  setup() {\n    const nestedResponse = ref<NestedOuter>()\n\n    return () => (\n      <div>\n        <button\n          data-testid=\"server-function-trigger\"\n          onClick={() =>\n            serverFnReturningNested().then(\n              (res) => (nestedResponse.value = res),\n            )\n          }\n        >\n          trigger\n        </button>\n\n        {nestedResponse.value ? (\n          <RenderNestedData nested={nestedResponse.value} />\n        ) : (\n          <div data-testid=\"waiting-for-response\">waiting for response...</div>\n        )}\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/server-function/nested')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/routes/ssr/data-only.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { RenderData, makeData } from '~/data'\n\nexport const Route = createFileRoute('/ssr/data-only')({\n  ssr: 'data-only',\n  beforeLoad: () => {\n    return makeData()\n  },\n  loader: ({ context }) => {\n    return context\n  },\n  component: () => {\n    const context = Route.useRouteContext()\n    const loaderData = Route.useLoaderData()\n\n    const localData = makeData()\n    const expectedHonkState = localData.car.singleInstance.honk()\n\n    const honkState = loaderData.value.car.singleInstance.honk()\n\n    return (\n      <div data-testid=\"data-only-container\">\n        <h2 data-testid=\"data-only-heading\">data-only</h2>\n        <div>\n          context: <RenderData id=\"context\" data={context.value} />\n        </div>\n        <div>\n          loader: <RenderData id=\"loader\" data={loaderData.value} />\n        </div>\n        <div data-testid=\"honk-container\">\n          <h3>honk</h3>\n          <div>\n            expected:{' '}\n            <div data-testid=\"honk-expected-state\">\n              {JSON.stringify(expectedHonkState)}\n            </div>\n          </div>\n          <div>\n            actual:{' '}\n            <div data-testid=\"honk-actual-state\">\n              {JSON.stringify(honkState)}\n            </div>\n          </div>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>posts Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/routes/ssr/nested.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { RenderNestedData, makeNested } from '~/data'\n\nexport const Route = createFileRoute('/ssr/nested')({\n  beforeLoad: () => {\n    return { nested: makeNested() }\n  },\n  loader: ({ context }) => {\n    return context\n  },\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    return <RenderNestedData nested={loaderData.value.nested} />\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/routes/ssr/stream.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/vue-router'\nimport { Suspense } from 'vue'\nimport { RenderData, makeData } from '~/data'\n\nexport const Route = createFileRoute('/ssr/stream')({\n  loader: () => {\n    const dataPromise = new Promise<ReturnType<typeof makeData>>((r) =>\n      setTimeout(() => r(makeData()), 1000),\n    )\n    return {\n      someString: 'hello world',\n      dataPromise,\n    }\n  },\n\n  errorComponent: (e) => <div>{e.error.message} </div>,\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const loaderData = Route.useLoaderData()\n  return (\n    <div>\n      <h3 data-testid=\"stream-heading\">Stream</h3>\n      <div data-testid=\"some-data\">{loaderData.value.someString}</div>\n      <Suspense>\n        {{\n          default: () => (\n            <Await\n              promise={loaderData.value.dataPromise}\n              children={(data: ReturnType<typeof makeData>) => (\n                <RenderData id=\"stream\" data={data} />\n              )}\n            />\n          ),\n          fallback: () => <div>Loading...</div>,\n        }}\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/start.tsx",
    "content": "import { createStart } from '@tanstack/vue-start'\nimport { carAdapter, fooAdapter, nestedOuterAdapter } from './data'\nimport { customErrorAdapter } from './CustomError'\n\nexport const startInstance = createStart(() => {\n  return {\n    defaultSsr: true,\n    serializationAdapters: [\n      fooAdapter,\n      carAdapter,\n      customErrorAdapter,\n      // only register nestedOuterAdapter here, nestedInnerAdapter is registered as an \"extends\" of nestedOuterAdapter\n      nestedOuterAdapter,\n    ],\n  }\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport type { Page } from '@playwright/test'\n\nasync function awaitPageLoaded(page: Page) {\n  // wait for page to be loaded by waiting for the ClientOnly component to be rendered\n\n  await expect(page.getByTestId('router-isLoading')).toContainText('false')\n  await expect(page.getByTestId('router-status')).toContainText('idle')\n}\nasync function checkData(page: Page, id: string) {\n  const expectedData = await page\n    .getByTestId(`${id}-car-expected`)\n    .textContent()\n  expect(expectedData).not.toBeNull()\n  await expect(page.getByTestId(`${id}-car-actual`)).toContainText(\n    expectedData!,\n  )\n\n  await expect(page.getByTestId(`${id}-foo`)).toContainText(\n    '{\"value\":\"server\"}',\n  )\n}\n\nasync function checkNestedData(page: Page) {\n  const expectedShout = await page\n    .getByTestId(`shout-expected-state`)\n    .textContent()\n  expect(expectedShout).not.toBeNull()\n  await expect(page.getByTestId(`shout-actual-state`)).toContainText(\n    expectedShout!,\n  )\n\n  const expectedWhisper = await page\n    .getByTestId(`whisper-expected-state`)\n    .textContent()\n  expect(expectedWhisper).not.toBeNull()\n  await expect(page.getByTestId(`whisper-actual-state`)).toContainText(\n    expectedWhisper!,\n  )\n}\ntest.use({\n  whitelistErrors: [\n    'Failed to load resource: the server responded with a status of 499',\n  ],\n})\ntest.describe('SSR serialization adapters', () => {\n  test(`data-only`, async ({ page }) => {\n    await page.goto('/ssr/data-only')\n    await awaitPageLoaded(page)\n\n    await Promise.all(\n      ['context', 'loader'].map(async (id) => checkData(page, id)),\n    )\n\n    const expectedHonkData = await page\n      .getByTestId('honk-expected-state')\n      .textContent()\n    expect(expectedHonkData).not.toBeNull()\n    await expect(page.getByTestId('honk-actual-state')).toContainText(\n      expectedHonkData!,\n    )\n  })\n\n  test('stream', async ({ page }) => {\n    await page.goto('/ssr/stream')\n    await awaitPageLoaded(page)\n    await checkData(page, 'stream')\n  })\n\n  test('nested', async ({ page }) => {\n    await page.goto('/ssr/nested')\n    await awaitPageLoaded(page)\n\n    await checkNestedData(page)\n  })\n})\n\ntest.describe('server functions serialization adapters', () => {\n  test('custom error', async ({ page }) => {\n    await page.goto('/server-function/custom-error')\n    await awaitPageLoaded(page)\n\n    await expect(\n      page.getByTestId('server-function-valid-response'),\n    ).toContainText('null')\n    await expect(\n      page.getByTestId('server-function-invalid-response'),\n    ).toContainText('null')\n\n    await page.getByTestId('server-function-valid-input').click()\n    await expect(\n      page.getByTestId('server-function-valid-response'),\n    ).toContainText('Hello, world!')\n\n    await page.getByTestId('server-function-invalid-input').click()\n    await expect(\n      page.getByTestId('server-function-invalid-response'),\n    ).toContainText('{\"message\":\"Invalid input\",\"foo\":\"bar\",\"bar\":\"123\"}')\n  })\n  test('nested', async ({ page }) => {\n    await page.goto('/server-function/nested')\n    await awaitPageLoaded(page)\n\n    await expect(page.getByTestId('waiting-for-response')).toContainText(\n      'waiting for response...',\n    )\n\n    await page.getByTestId('server-function-trigger').click()\n    await checkNestedData(page)\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/serialization-adapters/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/server-functions/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/server-functions/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-server-functions\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-query\": \"^5.90.9\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"js-cookie\": \"^3.0.5\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nexport const PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot.value ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e: MouseEvent) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SubmitPostFormdataRouteImport } from './routes/submit-post-formdata'\nimport { Route as StatusRouteImport } from './routes/status'\nimport { Route as SerializeFormDataRouteImport } from './routes/serialize-form-data'\nimport { Route as ReturnNullRouteImport } from './routes/return-null'\nimport { Route as RawResponseRouteImport } from './routes/raw-response'\nimport { Route as MultipartRouteImport } from './routes/multipart'\nimport { Route as IsomorphicFnsRouteImport } from './routes/isomorphic-fns'\nimport { Route as HeadersRouteImport } from './routes/headers'\nimport { Route as EnvOnlyRouteImport } from './routes/env-only'\nimport { Route as DeadCodePreserveRouteImport } from './routes/dead-code-preserve'\nimport { Route as ConsistentRouteImport } from './routes/consistent'\nimport { Route as AbortSignalRouteImport } from './routes/abort-signal'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as RedirectTestIndexRouteImport } from './routes/redirect-test/index'\nimport { Route as RedirectTestSsrIndexRouteImport } from './routes/redirect-test-ssr/index'\nimport { Route as PrimitivesIndexRouteImport } from './routes/primitives/index'\nimport { Route as MiddlewareIndexRouteImport } from './routes/middleware/index'\nimport { Route as FunctionMethodIndexRouteImport } from './routes/function-method/index'\nimport { Route as FunctionMetadataIndexRouteImport } from './routes/function-metadata/index'\nimport { Route as FormdataRedirectIndexRouteImport } from './routes/formdata-redirect/index'\nimport { Route as FactoryIndexRouteImport } from './routes/factory/index'\nimport { Route as CookiesIndexRouteImport } from './routes/cookies/index'\nimport { Route as RedirectTestTargetRouteImport } from './routes/redirect-test/target'\nimport { Route as RedirectTestSsrTargetRouteImport } from './routes/redirect-test-ssr/target'\nimport { Route as MiddlewareSendServerFnRouteImport } from './routes/middleware/send-serverFn'\nimport { Route as MiddlewareRequestMiddlewareRouteImport } from './routes/middleware/request-middleware'\nimport { Route as MiddlewareClientMiddlewareRouterRouteImport } from './routes/middleware/client-middleware-router'\nimport { Route as CookiesSetRouteImport } from './routes/cookies/set'\nimport { Route as FormdataRedirectTargetNameRouteImport } from './routes/formdata-redirect/target.$name'\n\nconst SubmitPostFormdataRoute = SubmitPostFormdataRouteImport.update({\n  id: '/submit-post-formdata',\n  path: '/submit-post-formdata',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst StatusRoute = StatusRouteImport.update({\n  id: '/status',\n  path: '/status',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SerializeFormDataRoute = SerializeFormDataRouteImport.update({\n  id: '/serialize-form-data',\n  path: '/serialize-form-data',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ReturnNullRoute = ReturnNullRouteImport.update({\n  id: '/return-null',\n  path: '/return-null',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RawResponseRoute = RawResponseRouteImport.update({\n  id: '/raw-response',\n  path: '/raw-response',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MultipartRoute = MultipartRouteImport.update({\n  id: '/multipart',\n  path: '/multipart',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IsomorphicFnsRoute = IsomorphicFnsRouteImport.update({\n  id: '/isomorphic-fns',\n  path: '/isomorphic-fns',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst HeadersRoute = HeadersRouteImport.update({\n  id: '/headers',\n  path: '/headers',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EnvOnlyRoute = EnvOnlyRouteImport.update({\n  id: '/env-only',\n  path: '/env-only',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeadCodePreserveRoute = DeadCodePreserveRouteImport.update({\n  id: '/dead-code-preserve',\n  path: '/dead-code-preserve',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ConsistentRoute = ConsistentRouteImport.update({\n  id: '/consistent',\n  path: '/consistent',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbortSignalRoute = AbortSignalRouteImport.update({\n  id: '/abort-signal',\n  path: '/abort-signal',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestIndexRoute = RedirectTestIndexRouteImport.update({\n  id: '/redirect-test/',\n  path: '/redirect-test/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestSsrIndexRoute = RedirectTestSsrIndexRouteImport.update({\n  id: '/redirect-test-ssr/',\n  path: '/redirect-test-ssr/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PrimitivesIndexRoute = PrimitivesIndexRouteImport.update({\n  id: '/primitives/',\n  path: '/primitives/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareIndexRoute = MiddlewareIndexRouteImport.update({\n  id: '/middleware/',\n  path: '/middleware/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FunctionMethodIndexRoute = FunctionMethodIndexRouteImport.update({\n  id: '/function-method/',\n  path: '/function-method/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FunctionMetadataIndexRoute = FunctionMetadataIndexRouteImport.update({\n  id: '/function-metadata/',\n  path: '/function-metadata/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FormdataRedirectIndexRoute = FormdataRedirectIndexRouteImport.update({\n  id: '/formdata-redirect/',\n  path: '/formdata-redirect/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FactoryIndexRoute = FactoryIndexRouteImport.update({\n  id: '/factory/',\n  path: '/factory/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CookiesIndexRoute = CookiesIndexRouteImport.update({\n  id: '/cookies/',\n  path: '/cookies/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestTargetRoute = RedirectTestTargetRouteImport.update({\n  id: '/redirect-test/target',\n  path: '/redirect-test/target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectTestSsrTargetRoute = RedirectTestSsrTargetRouteImport.update({\n  id: '/redirect-test-ssr/target',\n  path: '/redirect-test-ssr/target',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareSendServerFnRoute = MiddlewareSendServerFnRouteImport.update({\n  id: '/middleware/send-serverFn',\n  path: '/middleware/send-serverFn',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MiddlewareRequestMiddlewareRoute =\n  MiddlewareRequestMiddlewareRouteImport.update({\n    id: '/middleware/request-middleware',\n    path: '/middleware/request-middleware',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst MiddlewareClientMiddlewareRouterRoute =\n  MiddlewareClientMiddlewareRouterRouteImport.update({\n    id: '/middleware/client-middleware-router',\n    path: '/middleware/client-middleware-router',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst CookiesSetRoute = CookiesSetRouteImport.update({\n  id: '/cookies/set',\n  path: '/cookies/set',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FormdataRedirectTargetNameRoute =\n  FormdataRedirectTargetNameRouteImport.update({\n    id: '/formdata-redirect/target/$name',\n    path: '/formdata-redirect/target/$name',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/abort-signal': typeof AbortSignalRoute\n  '/consistent': typeof ConsistentRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/cookies/': typeof CookiesIndexRoute\n  '/factory/': typeof FactoryIndexRoute\n  '/formdata-redirect/': typeof FormdataRedirectIndexRoute\n  '/function-metadata/': typeof FunctionMetadataIndexRoute\n  '/function-method/': typeof FunctionMethodIndexRoute\n  '/middleware/': typeof MiddlewareIndexRoute\n  '/primitives/': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr/': typeof RedirectTestSsrIndexRoute\n  '/redirect-test/': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/abort-signal': typeof AbortSignalRoute\n  '/consistent': typeof ConsistentRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/cookies': typeof CookiesIndexRoute\n  '/factory': typeof FactoryIndexRoute\n  '/formdata-redirect': typeof FormdataRedirectIndexRoute\n  '/function-metadata': typeof FunctionMetadataIndexRoute\n  '/function-method': typeof FunctionMethodIndexRoute\n  '/middleware': typeof MiddlewareIndexRoute\n  '/primitives': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr': typeof RedirectTestSsrIndexRoute\n  '/redirect-test': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/abort-signal': typeof AbortSignalRoute\n  '/consistent': typeof ConsistentRoute\n  '/dead-code-preserve': typeof DeadCodePreserveRoute\n  '/env-only': typeof EnvOnlyRoute\n  '/headers': typeof HeadersRoute\n  '/isomorphic-fns': typeof IsomorphicFnsRoute\n  '/multipart': typeof MultipartRoute\n  '/raw-response': typeof RawResponseRoute\n  '/return-null': typeof ReturnNullRoute\n  '/serialize-form-data': typeof SerializeFormDataRoute\n  '/status': typeof StatusRoute\n  '/submit-post-formdata': typeof SubmitPostFormdataRoute\n  '/cookies/set': typeof CookiesSetRoute\n  '/middleware/client-middleware-router': typeof MiddlewareClientMiddlewareRouterRoute\n  '/middleware/request-middleware': typeof MiddlewareRequestMiddlewareRoute\n  '/middleware/send-serverFn': typeof MiddlewareSendServerFnRoute\n  '/redirect-test-ssr/target': typeof RedirectTestSsrTargetRoute\n  '/redirect-test/target': typeof RedirectTestTargetRoute\n  '/cookies/': typeof CookiesIndexRoute\n  '/factory/': typeof FactoryIndexRoute\n  '/formdata-redirect/': typeof FormdataRedirectIndexRoute\n  '/function-metadata/': typeof FunctionMetadataIndexRoute\n  '/function-method/': typeof FunctionMethodIndexRoute\n  '/middleware/': typeof MiddlewareIndexRoute\n  '/primitives/': typeof PrimitivesIndexRoute\n  '/redirect-test-ssr/': typeof RedirectTestSsrIndexRoute\n  '/redirect-test/': typeof RedirectTestIndexRoute\n  '/formdata-redirect/target/$name': typeof FormdataRedirectTargetNameRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/abort-signal'\n    | '/consistent'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/cookies/set'\n    | '/middleware/client-middleware-router'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/cookies/'\n    | '/factory/'\n    | '/formdata-redirect/'\n    | '/function-metadata/'\n    | '/function-method/'\n    | '/middleware/'\n    | '/primitives/'\n    | '/redirect-test-ssr/'\n    | '/redirect-test/'\n    | '/formdata-redirect/target/$name'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/abort-signal'\n    | '/consistent'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/cookies/set'\n    | '/middleware/client-middleware-router'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/cookies'\n    | '/factory'\n    | '/formdata-redirect'\n    | '/function-metadata'\n    | '/function-method'\n    | '/middleware'\n    | '/primitives'\n    | '/redirect-test-ssr'\n    | '/redirect-test'\n    | '/formdata-redirect/target/$name'\n  id:\n    | '__root__'\n    | '/'\n    | '/abort-signal'\n    | '/consistent'\n    | '/dead-code-preserve'\n    | '/env-only'\n    | '/headers'\n    | '/isomorphic-fns'\n    | '/multipart'\n    | '/raw-response'\n    | '/return-null'\n    | '/serialize-form-data'\n    | '/status'\n    | '/submit-post-formdata'\n    | '/cookies/set'\n    | '/middleware/client-middleware-router'\n    | '/middleware/request-middleware'\n    | '/middleware/send-serverFn'\n    | '/redirect-test-ssr/target'\n    | '/redirect-test/target'\n    | '/cookies/'\n    | '/factory/'\n    | '/formdata-redirect/'\n    | '/function-metadata/'\n    | '/function-method/'\n    | '/middleware/'\n    | '/primitives/'\n    | '/redirect-test-ssr/'\n    | '/redirect-test/'\n    | '/formdata-redirect/target/$name'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AbortSignalRoute: typeof AbortSignalRoute\n  ConsistentRoute: typeof ConsistentRoute\n  DeadCodePreserveRoute: typeof DeadCodePreserveRoute\n  EnvOnlyRoute: typeof EnvOnlyRoute\n  HeadersRoute: typeof HeadersRoute\n  IsomorphicFnsRoute: typeof IsomorphicFnsRoute\n  MultipartRoute: typeof MultipartRoute\n  RawResponseRoute: typeof RawResponseRoute\n  ReturnNullRoute: typeof ReturnNullRoute\n  SerializeFormDataRoute: typeof SerializeFormDataRoute\n  StatusRoute: typeof StatusRoute\n  SubmitPostFormdataRoute: typeof SubmitPostFormdataRoute\n  CookiesSetRoute: typeof CookiesSetRoute\n  MiddlewareClientMiddlewareRouterRoute: typeof MiddlewareClientMiddlewareRouterRoute\n  MiddlewareRequestMiddlewareRoute: typeof MiddlewareRequestMiddlewareRoute\n  MiddlewareSendServerFnRoute: typeof MiddlewareSendServerFnRoute\n  RedirectTestSsrTargetRoute: typeof RedirectTestSsrTargetRoute\n  RedirectTestTargetRoute: typeof RedirectTestTargetRoute\n  CookiesIndexRoute: typeof CookiesIndexRoute\n  FactoryIndexRoute: typeof FactoryIndexRoute\n  FormdataRedirectIndexRoute: typeof FormdataRedirectIndexRoute\n  FunctionMetadataIndexRoute: typeof FunctionMetadataIndexRoute\n  FunctionMethodIndexRoute: typeof FunctionMethodIndexRoute\n  MiddlewareIndexRoute: typeof MiddlewareIndexRoute\n  PrimitivesIndexRoute: typeof PrimitivesIndexRoute\n  RedirectTestSsrIndexRoute: typeof RedirectTestSsrIndexRoute\n  RedirectTestIndexRoute: typeof RedirectTestIndexRoute\n  FormdataRedirectTargetNameRoute: typeof FormdataRedirectTargetNameRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/submit-post-formdata': {\n      id: '/submit-post-formdata'\n      path: '/submit-post-formdata'\n      fullPath: '/submit-post-formdata'\n      preLoaderRoute: typeof SubmitPostFormdataRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/status': {\n      id: '/status'\n      path: '/status'\n      fullPath: '/status'\n      preLoaderRoute: typeof StatusRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/serialize-form-data': {\n      id: '/serialize-form-data'\n      path: '/serialize-form-data'\n      fullPath: '/serialize-form-data'\n      preLoaderRoute: typeof SerializeFormDataRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/return-null': {\n      id: '/return-null'\n      path: '/return-null'\n      fullPath: '/return-null'\n      preLoaderRoute: typeof ReturnNullRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/raw-response': {\n      id: '/raw-response'\n      path: '/raw-response'\n      fullPath: '/raw-response'\n      preLoaderRoute: typeof RawResponseRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/multipart': {\n      id: '/multipart'\n      path: '/multipart'\n      fullPath: '/multipart'\n      preLoaderRoute: typeof MultipartRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/isomorphic-fns': {\n      id: '/isomorphic-fns'\n      path: '/isomorphic-fns'\n      fullPath: '/isomorphic-fns'\n      preLoaderRoute: typeof IsomorphicFnsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/headers': {\n      id: '/headers'\n      path: '/headers'\n      fullPath: '/headers'\n      preLoaderRoute: typeof HeadersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/env-only': {\n      id: '/env-only'\n      path: '/env-only'\n      fullPath: '/env-only'\n      preLoaderRoute: typeof EnvOnlyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dead-code-preserve': {\n      id: '/dead-code-preserve'\n      path: '/dead-code-preserve'\n      fullPath: '/dead-code-preserve'\n      preLoaderRoute: typeof DeadCodePreserveRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/consistent': {\n      id: '/consistent'\n      path: '/consistent'\n      fullPath: '/consistent'\n      preLoaderRoute: typeof ConsistentRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/abort-signal': {\n      id: '/abort-signal'\n      path: '/abort-signal'\n      fullPath: '/abort-signal'\n      preLoaderRoute: typeof AbortSignalRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test/': {\n      id: '/redirect-test/'\n      path: '/redirect-test'\n      fullPath: '/redirect-test/'\n      preLoaderRoute: typeof RedirectTestIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test-ssr/': {\n      id: '/redirect-test-ssr/'\n      path: '/redirect-test-ssr'\n      fullPath: '/redirect-test-ssr/'\n      preLoaderRoute: typeof RedirectTestSsrIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/primitives/': {\n      id: '/primitives/'\n      path: '/primitives'\n      fullPath: '/primitives/'\n      preLoaderRoute: typeof PrimitivesIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/': {\n      id: '/middleware/'\n      path: '/middleware'\n      fullPath: '/middleware/'\n      preLoaderRoute: typeof MiddlewareIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/function-method/': {\n      id: '/function-method/'\n      path: '/function-method'\n      fullPath: '/function-method/'\n      preLoaderRoute: typeof FunctionMethodIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/function-metadata/': {\n      id: '/function-metadata/'\n      path: '/function-metadata'\n      fullPath: '/function-metadata/'\n      preLoaderRoute: typeof FunctionMetadataIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/formdata-redirect/': {\n      id: '/formdata-redirect/'\n      path: '/formdata-redirect'\n      fullPath: '/formdata-redirect/'\n      preLoaderRoute: typeof FormdataRedirectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/factory/': {\n      id: '/factory/'\n      path: '/factory'\n      fullPath: '/factory/'\n      preLoaderRoute: typeof FactoryIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/cookies/': {\n      id: '/cookies/'\n      path: '/cookies'\n      fullPath: '/cookies/'\n      preLoaderRoute: typeof CookiesIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test/target': {\n      id: '/redirect-test/target'\n      path: '/redirect-test/target'\n      fullPath: '/redirect-test/target'\n      preLoaderRoute: typeof RedirectTestTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect-test-ssr/target': {\n      id: '/redirect-test-ssr/target'\n      path: '/redirect-test-ssr/target'\n      fullPath: '/redirect-test-ssr/target'\n      preLoaderRoute: typeof RedirectTestSsrTargetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/send-serverFn': {\n      id: '/middleware/send-serverFn'\n      path: '/middleware/send-serverFn'\n      fullPath: '/middleware/send-serverFn'\n      preLoaderRoute: typeof MiddlewareSendServerFnRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/request-middleware': {\n      id: '/middleware/request-middleware'\n      path: '/middleware/request-middleware'\n      fullPath: '/middleware/request-middleware'\n      preLoaderRoute: typeof MiddlewareRequestMiddlewareRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/middleware/client-middleware-router': {\n      id: '/middleware/client-middleware-router'\n      path: '/middleware/client-middleware-router'\n      fullPath: '/middleware/client-middleware-router'\n      preLoaderRoute: typeof MiddlewareClientMiddlewareRouterRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/cookies/set': {\n      id: '/cookies/set'\n      path: '/cookies/set'\n      fullPath: '/cookies/set'\n      preLoaderRoute: typeof CookiesSetRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/formdata-redirect/target/$name': {\n      id: '/formdata-redirect/target/$name'\n      path: '/formdata-redirect/target/$name'\n      fullPath: '/formdata-redirect/target/$name'\n      preLoaderRoute: typeof FormdataRedirectTargetNameRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AbortSignalRoute: AbortSignalRoute,\n  ConsistentRoute: ConsistentRoute,\n  DeadCodePreserveRoute: DeadCodePreserveRoute,\n  EnvOnlyRoute: EnvOnlyRoute,\n  HeadersRoute: HeadersRoute,\n  IsomorphicFnsRoute: IsomorphicFnsRoute,\n  MultipartRoute: MultipartRoute,\n  RawResponseRoute: RawResponseRoute,\n  ReturnNullRoute: ReturnNullRoute,\n  SerializeFormDataRoute: SerializeFormDataRoute,\n  StatusRoute: StatusRoute,\n  SubmitPostFormdataRoute: SubmitPostFormdataRoute,\n  CookiesSetRoute: CookiesSetRoute,\n  MiddlewareClientMiddlewareRouterRoute: MiddlewareClientMiddlewareRouterRoute,\n  MiddlewareRequestMiddlewareRoute: MiddlewareRequestMiddlewareRoute,\n  MiddlewareSendServerFnRoute: MiddlewareSendServerFnRoute,\n  RedirectTestSsrTargetRoute: RedirectTestSsrTargetRoute,\n  RedirectTestTargetRoute: RedirectTestTargetRoute,\n  CookiesIndexRoute: CookiesIndexRoute,\n  FactoryIndexRoute: FactoryIndexRoute,\n  FormdataRedirectIndexRoute: FormdataRedirectIndexRoute,\n  FunctionMetadataIndexRoute: FunctionMetadataIndexRoute,\n  FunctionMethodIndexRoute: FunctionMethodIndexRoute,\n  MiddlewareIndexRoute: MiddlewareIndexRoute,\n  PrimitivesIndexRoute: PrimitivesIndexRoute,\n  RedirectTestSsrIndexRoute: RedirectTestSsrIndexRoute,\n  RedirectTestIndexRoute: RedirectTestIndexRoute,\n  FormdataRedirectTargetNameRoute: FormdataRedirectTargetNameRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/vue-router-ssr-query'\nimport { QueryClient } from '@tanstack/vue-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n    context: {\n      foo: {\n        bar: 'baz',\n      },\n    },\n  })\n\n  setupRouterSsrQueryIntegration({ router, queryClient })\n\n  return router\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/__root.tsx",
    "content": "import {\n  Body,\n  HeadContent,\n  Html,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\n\nimport { TanStackRouterDevtoolsInProd } from '@tanstack/vue-router-devtools'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  errorComponent: (props) => {\n    return <p>{props.error.stack}</p>\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <Outlet />\n        <TanStackRouterDevtoolsInProd />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/abort-signal.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { getRequest } from '@tanstack/vue-start/server'\nimport { defineComponent, ref } from 'vue'\n\nconst abortableServerFn = createServerFn().handler(async ({ context }) => {\n  console.log('server function started', { context })\n  const signal = getRequest().signal\n  return new Promise<string>((resolve, reject) => {\n    if (signal.aborted) {\n      return reject(new Error('Aborted before start'))\n    }\n    const timerId = setTimeout(() => {\n      console.log('server function finished')\n      resolve('server function result')\n    }, 1000)\n    const onAbort = () => {\n      clearTimeout(timerId)\n      console.log('server function aborted')\n      reject(new Error('Aborted'))\n    }\n    signal.addEventListener('abort', onAbort, { once: true })\n  })\n})\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const errorMessage = ref<string | undefined>(undefined)\n    const result = ref<string | undefined>(undefined)\n\n    const reset = () => {\n      errorMessage.value = undefined\n      result.value = undefined\n    }\n\n    return () => (\n      <div>\n        <button\n          data-testid=\"run-with-abort-btn\"\n          onClick={async () => {\n            reset()\n            const controller = new AbortController()\n            const serverFnPromise = abortableServerFn({\n              signal: controller.signal,\n            })\n            const timeoutPromise = new Promise((resolve) =>\n              setTimeout(resolve, 500),\n            )\n            await timeoutPromise\n            controller.abort()\n            try {\n              const serverFnResult = await serverFnPromise\n              result.value = serverFnResult\n            } catch (error) {\n              errorMessage.value = (error as any).message\n            }\n          }}\n        >\n          call server function with abort signal\n        </button>\n        <br />\n        <button\n          data-testid=\"run-without-abort-btn\"\n          onClick={async () => {\n            reset()\n            const serverFnResult = await abortableServerFn()\n            result.value = serverFnResult\n          }}\n        >\n          call server function\n        </button>\n        <div class=\"p-2\">\n          result: <p data-testid=\"result\">{result.value ?? '$undefined'}</p>\n        </div>\n        <div class=\"p-2\">\n          message:{' '}\n          <p data-testid=\"errorMessage\">{errorMessage.value ?? '$undefined'}</p>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/abort-signal')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/consistent.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\n/**\n * This checks whether the returned payloads from a\n * server function are the same, regardless of whether the server function is\n * called directly from the client or from within the server function.\n * @link https://github.com/TanStack/router/issues/1866\n * @link https://github.com/TanStack/router/issues/2481\n */\n\nconst cons_getFn1 = createServerFn()\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return { payload: data }\n  })\n\nconst cons_serverGetFn1 = createServerFn()\n  .inputValidator((d: { username: string }) => d)\n  .handler(async ({ data }) => {\n    return cons_getFn1({ data })\n  })\n\nconst cons_postFn1 = createServerFn({ method: 'POST' })\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return { payload: data }\n  })\n\nconst cons_serverPostFn1 = createServerFn({ method: 'POST' })\n  .inputValidator((d: { username: string }) => d)\n  .handler(({ data }) => {\n    return cons_postFn1({ data })\n  })\n\nconst ConsistentServerFnCalls = defineComponent({\n  setup() {\n    const getServerResult = ref<unknown>({})\n    const getDirectResult = ref<unknown>({})\n\n    const postServerResult = ref<unknown>({})\n    const postDirectResult = ref<unknown>({})\n\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\">\n        <h3>Consistent Server Fn GET Calls</h3>\n        <p>\n          This component checks whether the returned payloads from server\n          function are the same, regardless of whether the server function is\n          called directly from the client or from within the server function.\n        </p>\n        <div>\n          It should return{' '}\n          <code>\n            <pre data-testid=\"expected-consistent-server-fns-result\">\n              {JSON.stringify({ payload: { username: 'TEST' } })}\n            </pre>\n          </code>\n        </div>\n        <p>\n          {`GET: cons_getFn1 called from server cons_serverGetFn1 returns`}\n          <br />\n          <span data-testid=\"cons_serverGetFn1-response\">\n            {JSON.stringify(getServerResult.value)}\n          </span>\n        </p>\n        <p>\n          {`GET: cons_getFn1 called directly returns`}\n          <br />\n          <span data-testid=\"cons_getFn1-response\">\n            {JSON.stringify(getDirectResult.value)}\n          </span>\n        </p>\n        <p>\n          {`POST: cons_postFn1 called from cons_serverPostFn1 returns`}\n          <br />\n          <span data-testid=\"cons_serverPostFn1-response\">\n            {JSON.stringify(postServerResult.value)}\n          </span>\n        </p>\n        <p>\n          {`POST: cons_postFn1 called directly returns`}\n          <br />\n          <span data-testid=\"cons_postFn1-response\">\n            {JSON.stringify(postDirectResult.value)}\n          </span>\n        </p>\n        <button\n          data-testid=\"test-consistent-server-fn-calls-btn\"\n          type=\"button\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          onClick={() => {\n            // GET calls\n            cons_serverGetFn1({ data: { username: 'TEST' } }).then((data) => {\n              getServerResult.value = data\n            })\n            cons_getFn1({ data: { username: 'TEST' } }).then((data) => {\n              getDirectResult.value = data\n            })\n\n            // POST calls\n            cons_serverPostFn1({ data: { username: 'TEST' } }).then((data) => {\n              postServerResult.value = data\n            })\n            cons_postFn1({ data: { username: 'TEST' } }).then((data) => {\n              postDirectResult.value = data\n            })\n\n            cons_postFn1({ data: { username: 'TEST' } }).then((data) => {\n              postDirectResult.value = data\n            })\n          }}\n        >\n          Test Consistent server function responses\n        </button>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/consistent')({\n  component: ConsistentServerFnCalls,\n  loader: async () => {\n    const data = await cons_serverGetFn1({ data: { username: 'TEST' } })\n    console.log('cons_serverGetFn1', data)\n    return { data }\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/cookies/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\n\nconst cookieSchema = z\n  .object({ value: z.string() })\n  .catch(() => ({ value: `CLIENT-${Date.now()}` }))\nexport const Route = createFileRoute('/cookies/')({\n  validateSearch: cookieSchema,\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const search = Route.useSearch()\n  return (\n    <Link\n      data-testid=\"link-to-set\"\n      from=\"/cookies/\"\n      to=\"./set\"\n      search={search.value}\n    >\n      got to route that sets the cookies with {JSON.stringify(search.value)}\n    </Link>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/cookies/set.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { setCookie } from '@tanstack/vue-start/server'\nimport { z } from 'zod'\nimport Cookies from 'js-cookie'\nimport { defineComponent, ref, watch } from 'vue'\n\nconst cookieSchema = z.object({ value: z.string() })\n\nexport const setCookieServerFn1 = createServerFn()\n  .inputValidator(cookieSchema)\n  .handler(({ data }) => {\n    setCookie(`cookie-1-${data.value}`, data.value)\n    setCookie(`cookie-2-${data.value}`, data.value)\n  })\n\nexport const setCookieServerFn2 = createServerFn()\n  .inputValidator(cookieSchema)\n  .handler(({ data }) => {\n    setCookie(`cookie-3-${data.value}`, data.value)\n    setCookie(`cookie-4-${data.value}`, data.value)\n  })\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const search = Route.useSearch()\n    const cookiesFromDocument = ref<Record<string, string | undefined>>({})\n\n    const updateCookies = () => {\n      const tempCookies: Record<string, string | undefined> = {}\n      for (let i = 1; i <= 4; i++) {\n        const key = `cookie-${i}-${search.value.value}`\n        tempCookies[key] = Cookies.get(key)\n      }\n      cookiesFromDocument.value = tempCookies\n    }\n\n    if (typeof window !== 'undefined') {\n      watch(\n        () => search.value.value,\n        () => {\n          updateCookies()\n        },\n        { immediate: true },\n      )\n    }\n\n    return () => (\n      <div>\n        <h1 class=\"text-xl\">cookies result</h1>\n        <table>\n          <tbody>\n            <tr>\n              <td>cookie</td>\n              <td>value</td>\n            </tr>\n            {Object.entries(cookiesFromDocument.value).map(([key, value]) => (\n              <tr>\n                <td>{key}</td>\n                <td data-testid={key}>{value}</td>\n              </tr>\n            ))}\n          </tbody>\n        </table>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/cookies/set')({\n  validateSearch: cookieSchema,\n  loaderDeps: ({ search }) => search,\n  loader: async ({ deps }) => {\n    await setCookieServerFn1({ data: deps })\n    await setCookieServerFn2({ data: deps })\n  },\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/dead-code-preserve.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport * as fs from 'node:fs'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { getRequestHeader } from '@tanstack/vue-start/server'\nimport { defineComponent, ref } from 'vue'\n\n// by using this we make sure DCE still works - this errors when imported on the client\n\nconst filePath = 'count-effect.txt'\n\nasync function readCount() {\n  return parseInt(\n    await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'),\n  )\n}\n\nasync function updateCount() {\n  const count = await readCount()\n  await fs.promises.writeFile(filePath, `${count + 1}`)\n  return true\n}\n\nconst writeFileServerFn = createServerFn().handler(async () => {\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const test = await updateCount()\n  return getRequestHeader('X-Test')\n})\n\nconst readFileServerFn = createServerFn().handler(async () => {\n  const data = await readCount()\n  return data\n})\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const serverFnOutput = ref<number | undefined>(undefined)\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\">\n        <h3>Dead code test</h3>\n        <p>\n          This server function writes to a file as a side effect, then reads it.\n        </p>\n        <button\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          data-testid=\"test-dead-code-fn-call-btn\"\n          onClick={async () => {\n            await writeFileServerFn({ headers: { 'X-Test': 'test' } })\n            serverFnOutput.value = await readFileServerFn()\n          }}\n        >\n          Call Dead Code Fn\n        </button>\n        <h4>Server output</h4>\n        <pre data-testid=\"dead-code-fn-call-response\">\n          {serverFnOutput.value}\n        </pre>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/dead-code-preserve')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/env-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport {\n  createClientOnlyFn,\n  createServerFn,\n  createServerOnlyFn,\n} from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\nconst serverEcho = createServerOnlyFn((input: string) => 'server got: ' + input)\nconst clientEcho = createClientOnlyFn((input: string) => 'client got: ' + input)\n\nconst testOnServer = createServerFn().handler(() => {\n  const serverOnServer = serverEcho('hello')\n  let clientOnServer: string\n  try {\n    clientOnServer = clientEcho('hello')\n  } catch (e) {\n    clientOnServer =\n      'clientEcho threw an error: ' +\n      (e instanceof Error ? e.message : String(e))\n  }\n  return { serverOnServer, clientOnServer }\n})\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const results = ref<Partial<Record<string, string>> | undefined>()\n\n    async function handleClick() {\n      const { serverOnServer, clientOnServer } = await testOnServer()\n      const clientOnClient = clientEcho('hello')\n      let serverOnClient: string\n      try {\n        serverOnClient = serverEcho('hello')\n      } catch (e) {\n        serverOnClient =\n          'serverEcho threw an error: ' +\n          (e instanceof Error ? e.message : String(e))\n      }\n      results.value = {\n        serverOnServer,\n        clientOnServer,\n        clientOnClient,\n        serverOnClient,\n      }\n    }\n\n    return () => (\n      <div>\n        <button onClick={handleClick} data-testid=\"test-env-only-results-btn\">\n          Run\n        </button>\n        {!!results.value && (\n          <div>\n            <h1>\n              <code>serverEcho</code>\n            </h1>\n            When we called the function on the server:\n            <pre data-testid=\"server-on-server\">\n              {results.value.serverOnServer}\n            </pre>\n            When we called the function on the client:\n            <pre data-testid=\"server-on-client\">\n              {results.value.serverOnClient}\n            </pre>\n            <br />\n            <h1>\n              <code>clientEcho</code>\n            </h1>\n            When we called the function on the server:\n            <pre data-testid=\"client-on-server\">\n              {results.value.clientOnServer}\n            </pre>\n            When we called the function on the client:\n            <pre data-testid=\"client-on-client\">\n              {results.value.clientOnClient}\n            </pre>\n          </div>\n        )}\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/env-only')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/factory/-functions/createBarServerFn.ts",
    "content": "import { createMiddleware } from '@tanstack/vue-start'\nimport { createFooServerFn } from './createFooServerFn'\n\nconst barMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('Bar middleware triggered')\n    return next({\n      context: { bar: 'bar' } as const,\n    })\n  },\n)\n\nexport const createBarServerFn = createFooServerFn().middleware([barMiddleware])\n\nexport const barFnInsideFactoryFile = createBarServerFn().handler(\n  ({ context, method }) => {\n    return {\n      name: 'barFnInsideFactoryFile',\n      context,\n      method,\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/factory/-functions/createFakeFn.ts",
    "content": "export function createFakeFn() {\n  return {\n    handler: (cb: () => Promise<any>) => cb,\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/factory/-functions/createFooServerFn.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/vue-start'\nimport { getRequest } from '@tanstack/vue-start/server'\n\nconst fooMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    const request = getRequest()\n    console.log('Foo middleware triggered')\n    return next({\n      context: { foo: 'foo', method: request.method } as const,\n    })\n  },\n)\n\nexport const createFooServerFn = createServerFn().middleware([fooMiddleware])\n\nexport const fooFnInsideFactoryFile = createFooServerFn().handler(\n  async ({ context, method }) => {\n    console.log('fooFnInsideFactoryFile handler triggered', context.method)\n    return {\n      name: 'fooFnInsideFactoryFile',\n      context,\n      method,\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/factory/-functions/functions.ts",
    "content": "import { createMiddleware, createServerFn } from '@tanstack/vue-start'\nimport { createBarServerFn } from './createBarServerFn'\nimport { createFooServerFn } from './createFooServerFn'\nimport { createFakeFn } from './createFakeFn'\n\nexport const fooFn = createFooServerFn().handler(({ context, method }) => {\n  return {\n    name: 'fooFn',\n    context,\n    method,\n  }\n})\n\nexport const fooFnPOST = createFooServerFn({ method: 'POST' }).handler(\n  ({ context, method }) => {\n    return {\n      name: 'fooFnPOST',\n      context,\n      method,\n    }\n  },\n)\n\nexport const barFn = createBarServerFn().handler(({ context, method }) => {\n  return {\n    name: 'barFn',\n    context,\n    method,\n  }\n})\n\nexport const barFnPOST = createBarServerFn({ method: 'POST' }).handler(\n  ({ context, method }) => {\n    return {\n      name: 'barFnPOST',\n      context,\n      method,\n    }\n  },\n)\n\nconst localMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('local middleware triggered')\n    return next({\n      context: { local: 'local' } as const,\n    })\n  },\n)\n\nconst localFnFactory = createBarServerFn.middleware([localMiddleware])\n\nconst anotherMiddleware = createMiddleware({ type: 'function' }).server(\n  ({ next }) => {\n    console.log('another middleware triggered')\n    return next({\n      context: { another: 'another' } as const,\n    })\n  },\n)\n\nexport const localFn = localFnFactory()\n  .middleware([anotherMiddleware])\n  .handler(({ context, method }) => {\n    return {\n      name: 'localFn',\n      context,\n      method,\n    }\n  })\n\nexport const localFnPOST = localFnFactory({ method: 'POST' })\n  .middleware([anotherMiddleware])\n  .handler(({ context, method }) => {\n    return {\n      name: 'localFnPOST',\n      context,\n      method,\n    }\n  })\n\nexport const fakeFn = createFakeFn().handler(async () => {\n  return {\n    name: 'fakeFn',\n    window,\n  }\n})\n\nexport const composeFactory = createServerFn({ method: 'GET' }).middleware([\n  createBarServerFn,\n])\nexport const composedFn = composeFactory()\n  .middleware([anotherMiddleware, localFnFactory])\n  .handler(({ context, method }) => {\n    return {\n      name: 'composedFn',\n      context,\n      method,\n    }\n  })\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/factory/index.tsx",
    "content": "import { createFileRoute, deepEqual } from '@tanstack/vue-router'\n\nimport { createServerFn } from '@tanstack/vue-start'\nimport { fooFnInsideFactoryFile } from './-functions/createFooServerFn'\nimport {\n  barFn,\n  barFnPOST,\n  composedFn,\n  fakeFn,\n  fooFn,\n  fooFnPOST,\n  localFn,\n  localFnPOST,\n} from './-functions/functions'\nimport { computed, defineComponent, ref } from 'vue'\nimport type { PropType } from 'vue'\n\nconst fnInsideRoute = createServerFn({ method: 'GET' }).handler(\n  ({ method }) => {\n    return {\n      name: 'fnInsideRoute',\n      method,\n    }\n  },\n)\n\nconst functions = {\n  fnInsideRoute: {\n    fn: fnInsideRoute,\n    type: 'serverFn',\n    expected: {\n      name: 'fnInsideRoute',\n      method: 'GET',\n    },\n  },\n  fooFnInsideFactoryFile: {\n    fn: fooFnInsideFactoryFile,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFnInsideFactoryFile',\n      context: { foo: 'foo', method: 'GET' },\n      method: 'GET',\n    },\n  },\n  fooFn: {\n    fn: fooFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFn',\n      context: { foo: 'foo', method: 'GET' },\n      method: 'GET',\n    },\n  },\n  fooFnPOST: {\n    fn: fooFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'fooFnPOST',\n      context: { foo: 'foo', method: 'POST' },\n      method: 'POST',\n    },\n  },\n  barFn: {\n    fn: barFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'barFn',\n      context: { foo: 'foo', method: 'GET', bar: 'bar' },\n      method: 'GET',\n    },\n  },\n  barFnPOST: {\n    fn: barFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'barFnPOST',\n      context: { foo: 'foo', method: 'POST', bar: 'bar' },\n      method: 'POST',\n    },\n  },\n  localFn: {\n    fn: localFn,\n    type: 'serverFn',\n\n    expected: {\n      name: 'localFn',\n      context: {\n        foo: 'foo',\n        method: 'GET',\n        bar: 'bar',\n        local: 'local',\n        another: 'another',\n      },\n      method: 'GET',\n    },\n  },\n  localFnPOST: {\n    fn: localFnPOST,\n    type: 'serverFn',\n\n    expected: {\n      name: 'localFnPOST',\n      context: {\n        foo: 'foo',\n        method: 'POST',\n        bar: 'bar',\n        local: 'local',\n        another: 'another',\n      },\n      method: 'POST',\n    },\n  },\n  composedFn: {\n    fn: composedFn,\n    type: 'serverFn',\n    expected: {\n      name: 'composedFn',\n      context: {\n        foo: 'foo',\n        method: 'GET',\n        bar: 'bar',\n        another: 'another',\n        local: 'local',\n      },\n      method: 'GET',\n    },\n  },\n  fakeFn: {\n    fn: fakeFn,\n    type: 'localFn',\n    expected: {\n      name: 'fakeFn',\n      window,\n    },\n  },\n} satisfies Record<string, TestCase>\n\ninterface TestCase {\n  fn: () => Promise<any>\n  expected: any\n  type: 'serverFn' | 'localFn'\n}\nconst Test = defineComponent({\n  props: {\n    fn: {\n      type: Function as PropType<() => Promise<any>>,\n      required: true,\n    },\n    expected: {\n      type: Object as PropType<any>,\n      required: true,\n    },\n    type: {\n      type: String as PropType<TestCase['type']>,\n      required: true,\n    },\n  },\n  setup(props) {\n    const result = ref<null | unknown>(null)\n    const comparison = computed(() => {\n      if (result.value) {\n        const isEqual = deepEqual(result.value, props.expected)\n        return isEqual ? 'equal' : 'not equal'\n      }\n      return 'Loading...'\n    })\n\n    return () => (\n      <div\n        data-testid={`test-${props.expected.name}`}\n        class=\"p-2 border border-gray-200 rounded-md\"\n      >\n        <h2 class=\"font-bold text-lg\"></h2>\n        <div>\n          It should return{' '}\n          <code>\n            <pre data-testid={`expected-fn-result-${props.expected.name}`}>\n              {props.type === 'serverFn'\n                ? JSON.stringify(props.expected)\n                : 'localFn'}\n            </pre>\n          </code>\n        </div>\n        <p>\n          fn returns:\n          <br />\n          <span data-testid={`fn-result-${props.expected.name}`}>\n            {result.value\n              ? props.type === 'serverFn'\n                ? JSON.stringify(result.value)\n                : 'localFn'\n              : 'Loading...'}\n          </span>{' '}\n          <span data-testid={`fn-comparison-${props.expected.name}`}>\n            {comparison.value}\n          </span>\n        </p>\n        <button\n          data-testid={`btn-fn-${props.expected.name}`}\n          type=\"button\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          onClick={() => {\n            props.fn().then((data) => {\n              result.value = data\n            })\n          }}\n        >\n          Invoke Server Function\n        </button>\n      </div>\n    )\n  },\n})\n\nconst RouteComponent = defineComponent({\n  setup() {\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\" data-testid=\"factory-route-component\">\n        <h1 class=\"font-bold text-lg\">Server functions middleware E2E tests</h1>\n        {Object.entries(functions).map(([name, testCase]) => (\n          <Test key={name} {...testCase} />\n        ))}\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/factory/')({\n  ssr: false,\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/formdata-redirect/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/vue-router'\nimport { createServerFn, useServerFn } from '@tanstack/vue-start'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/formdata-redirect/')({\n  component: SubmitPostFormDataFn,\n  validateSearch: z.object({\n    mode: z.union([z.literal('js'), z.literal('no-js')]).default('js'),\n  }),\n})\n\nconst testValues = {\n  name: 'Sean',\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n\n    if (!name) {\n      throw new Error('Name is required')\n    }\n\n    return {\n      name: name.toString(),\n    }\n  })\n  .handler(({ data: { name } }) => {\n    throw redirect({ to: '/formdata-redirect/target/$name', params: { name } })\n  })\n\nfunction SubmitPostFormDataFn() {\n  const mode = Route.useSearch({ select: (search) => search.mode })\n  const greetUserFn = useServerFn(greetUser)\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Submit POST FormData Fn Call</h3>\n      <div class=\"overflow-y-auto\">\n        It should return redirect to /formdata-redirect/target/{testValues.name}{' '}\n        and greet the user with their name:\n        <code>\n          <pre data-testid=\"expected-submit-post-formdata-server-fn-result\">\n            {testValues.name}\n          </pre>\n        </code>\n      </div>\n      <form\n        class=\"flex flex-col gap-2\"\n        data-testid=\"submit-post-formdata-form\"\n        method=\"post\"\n        action={greetUser.url}\n        onSubmit={async (evt) => {\n          if (mode.value === 'js') {\n            evt.preventDefault()\n            const data = new FormData(evt.currentTarget as HTMLFormElement)\n            await greetUserFn({ data })\n          }\n        }}\n      >\n        <input type=\"text\" name=\"name\" value={testValues.name} />\n        <button\n          type=\"submit\"\n          data-testid=\"test-submit-post-formdata-fn-calls-btn\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/formdata-redirect/target.$name.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/formdata-redirect/target/$name')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const params = Route.useParams()\n  return (\n    <div data-testid=\"formdata-redirect-target\">\n      Hello{' '}\n      <span data-testid=\"formdata-redirect-target-name\">\n        {params.value.name}\n      </span>\n      !\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/function-metadata/-functions/normalServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/vue-start'\n\nexport const getServerFn = createServerFn().handler(({ serverFnMeta }) => {\n  return serverFnMeta\n})\n\nexport const postServerFn = createServerFn({ method: 'POST' }).handler(\n  ({ serverFnMeta }) => {\n    return serverFnMeta\n  },\n)\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/function-metadata/-functions/serverFnCallingServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/vue-start'\nimport { getServerFn, postServerFn } from './normalServerFn'\n\nexport const getServerFnCallingServerFn = createServerFn().handler(\n  async ({ serverFnMeta }) => {\n    const post = await postServerFn()\n    const get = await getServerFn()\n\n    return {\n      meta: serverFnMeta,\n      inner: {\n        get,\n        post,\n      },\n    }\n  },\n)\n\nexport const postServerFnCallingServerFn = createServerFn().handler(\n  async ({ serverFnMeta }) => {\n    const post = await postServerFn()\n    const get = await getServerFn()\n\n    return {\n      meta: serverFnMeta,\n      inner: {\n        get,\n        post,\n      },\n    }\n  },\n)\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/function-metadata/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { defineComponent } from 'vue'\nimport { getServerFn, postServerFn } from './-functions/normalServerFn'\nimport {\n  getServerFnCallingServerFn,\n  postServerFnCallingServerFn,\n} from './-functions/serverFnCallingServerFn'\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\" data-testid=\"metadata-route-component\">\n        <h1 class=\"font-bold text-lg\">Server functions metadata E2E tests</h1>\n        <br />\n        <div data-testid=\"loader-data\">\n          <h3>Loader Data (SSR)</h3>\n          <h4>Server Captured Metadata:</h4>\n          <div>\n            Function Metadata:{' '}\n            <span data-testid=\"loader-normal-get-function-metadata\">\n              {JSON.stringify(loaderData.value.normalGet)}\n            </span>\n          </div>\n          <div>\n            Function Metadata:{' '}\n            <span data-testid=\"loader-normal-post-function-metadata\">\n              {JSON.stringify(loaderData.value.normalPost)}\n            </span>\n          </div>\n          <div>\n            Function Metadata:{' '}\n            <span data-testid=\"loader-nesting-get-function-metadata\">\n              {JSON.stringify(loaderData.value.nestingGet)}\n            </span>\n          </div>\n          <div>\n            Function Metadata:{' '}\n            <span data-testid=\"loader-nesting-post-function-metadata\">\n              {JSON.stringify(loaderData.value.nestingPost)}\n            </span>\n          </div>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/function-metadata/')({\n  component: RouteComponent,\n  loader: async () => {\n    const normalGet = await getServerFn()\n    const normalPost = await postServerFn()\n    const nestingGet = await getServerFnCallingServerFn()\n    const nestingPost = await postServerFnCallingServerFn()\n\n    return {\n      normalGet,\n      normalPost,\n      nestingGet,\n      nestingPost,\n    }\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/function-method/-functions/serverFnCallingServerFn.ts",
    "content": "import { createServerFn } from '@tanstack/vue-start'\n\nconst postServerFn = createServerFn({ method: 'POST' }).handler(\n  ({ method }) => {\n    return {\n      method,\n    }\n  },\n)\n\nconst getServerFn = createServerFn({ method: 'GET' }).handler(({ method }) => {\n  return {\n    method,\n  }\n})\n\nexport const getServerFnCallingPost = createServerFn({ method: 'GET' }).handler(\n  async ({ method }) => {\n    const innerFnResult = await postServerFn({})\n\n    return {\n      name: 'getServerFnCallingPost',\n      method,\n      innerFnResult,\n    }\n  },\n)\n\nexport const postServerFnCallingGet = createServerFn({\n  method: 'POST',\n}).handler(async ({ method }) => {\n  const innerFnResult = await getServerFn({})\n\n  return {\n    name: 'postServerFnCallingGet',\n    method,\n    innerFnResult,\n  }\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/function-method/index.tsx",
    "content": "import { Link, createFileRoute, deepEqual } from '@tanstack/vue-router'\nimport { computed, defineComponent, ref } from 'vue'\nimport {\n  getServerFnCallingPost,\n  postServerFnCallingGet,\n} from './-functions/serverFnCallingServerFn'\nimport type { PropType } from 'vue'\n\nconst functions = {\n  getServerFnCallingPost: {\n    fn: getServerFnCallingPost,\n    expected: {\n      name: 'getServerFnCallingPost',\n      method: 'GET',\n      innerFnResult: {\n        method: 'POST',\n      },\n    },\n  },\n  postServerFnCallingGet: {\n    fn: postServerFnCallingGet,\n    expected: {\n      name: 'postServerFnCallingGet',\n      method: 'POST',\n      innerFnResult: {\n        method: 'GET',\n      },\n    },\n  },\n} satisfies Record<string, TestCase>\n\ninterface TestCase {\n  fn: () => Promise<any>\n  expected: any\n}\nconst Test = defineComponent({\n  props: {\n    fn: {\n      type: Function as PropType<() => Promise<any>>,\n      required: true,\n    },\n    expected: {\n      type: Object as PropType<any>,\n      required: true,\n    },\n  },\n  setup(props) {\n    const result = ref<null | unknown>(null)\n    const comparison = computed(() => {\n      if (result.value) {\n        const isEqual = deepEqual(result.value, props.expected)\n        return isEqual ? 'equal' : 'not equal'\n      }\n      return 'Loading...'\n    })\n\n    return () => (\n      <div\n        data-testid={`test-${props.expected.name}`}\n        class=\"p-2 border border-gray-200 rounded-md\"\n      >\n        <div>\n          It should return{' '}\n          <code>\n            <pre data-testid={`expected-fn-result-${props.expected.name}`}>\n              {JSON.stringify(props.expected)}\n            </pre>\n          </code>\n        </div>\n        <p>\n          fn returns:\n          <br />\n          <span data-testid={`fn-result-${props.expected.name}`}>\n            {result.value ? JSON.stringify(result.value) : 'Loading...'}\n          </span>{' '}\n          <span data-testid={`fn-comparison-${props.expected.name}`}>\n            {comparison.value}\n          </span>\n        </p>\n        <button\n          data-testid={`btn-fn-${props.expected.name}`}\n          type=\"button\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          onClick={() => {\n            props.fn().then((data) => {\n              result.value = data\n            })\n          }}\n        >\n          Invoke Server Function\n        </button>\n      </div>\n    )\n  },\n})\n\nconst RouteComponent = defineComponent({\n  setup() {\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\" data-testid=\"method-route-component\">\n        <h1 class=\"font-bold text-lg\">Server functions methods E2E tests</h1>\n        <div>\n          <Link class=\"inline\" to=\"/factory\">\n            <h2>Go to Factory Functions and request method E2E test</h2>\n          </Link>\n        </div>\n        {Object.entries(functions).map(([name, testCase]) => (\n          <Test key={name} {...testCase} />\n        ))}\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/function-method/')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/headers.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport {\n  getRequestHeaders,\n  setResponseHeader,\n} from '@tanstack/vue-start/server'\nimport type { RequestHeaderName } from '@tanstack/vue-start/server'\nimport { defineComponent, ref } from 'vue'\n\nexport const getTestHeaders = createServerFn().handler(() => {\n  setResponseHeader('x-test-header', 'test-value')\n  const reqHeaders = Object.fromEntries(getRequestHeaders().entries())\n\n  return {\n    serverHeaders: reqHeaders,\n    headers: reqHeaders,\n  }\n})\n\ntype TestHeadersResult = {\n  headers?: Partial<Record<RequestHeaderName, string | undefined>>\n  serverHeaders?: Partial<Record<RequestHeaderName, string | undefined>>\n}\n\nconst HeadersRouteComponent = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n    const testHeadersResult = ref<TestHeadersResult | null>(null)\n\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\">\n        <h3>Headers Test</h3>\n        <form\n          class=\"flex flex-col gap-2\"\n          data-testid=\"serialize-formdata-form\"\n          onSubmit={(evt) => {\n            evt.preventDefault()\n            getTestHeaders().then((data) => {\n              testHeadersResult.value = data\n            })\n          }}\n        >\n          <button\n            type=\"submit\"\n            data-testid=\"test-headers-btn\"\n            class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          >\n            Get Headers\n          </button>\n        </form>\n        <div class=\"overflow-y-auto\">\n          <h4>Initial Headers:</h4>\n          <pre data-testid=\"initial-headers-result\">\n            {JSON.stringify(loaderData.value.testHeaders.headers, null, 2)}\n          </pre>\n          {testHeadersResult.value && (\n            <>\n              <h4>Updated Headers:</h4>\n              <pre data-testid=\"updated-headers-result\">\n                {JSON.stringify(testHeadersResult.value.headers, null, 2)}\n              </pre>\n            </>\n          )}\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/headers')({\n  loader: async () => {\n    return {\n      testHeaders: await getTestHeaders(),\n    }\n  },\n  component: HeadersRouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server functions E2E tests</h1>\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Link to=\"/consistent\">\n            Consistent server function returns both on client and server for GET\n            and POST calls\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/multipart\">\n            submitting multipart/form-data as server function input\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/return-null\">\n            Server function can return null for GET and POST calls\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/serialize-form-data\">\n            Server function can correctly send and receive FormData\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/headers\">\n            server function can correctly send and receive headers\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/submit-post-formdata\">\n            Direct POST submitting FormData to a Server function returns the\n            correct message\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/status\">\n            invoking a server function with custom response status code\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/isomorphic-fns\">\n            isomorphic functions can have different implementations on client\n            and server\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/env-only\">\n            env-only functions can only be called on the server or client\n            respectively\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/cookies\">server function sets cookies</Link>\n        </li>\n        <li>\n          <Link to=\"/dead-code-preserve\">\n            dead code elimation only affects code after transformation\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/abort-signal\">aborting a server function call</Link>\n        </li>\n        <li>\n          <Link to=\"/raw-response\">server function returns raw response</Link>\n        </li>\n        <li>\n          <Link to=\"/function-method\">Server Functions method E2E tests</Link>\n        </li>\n        <li>\n          <Link to=\"/function-metadata\">\n            Server Functions metadata E2E tests\n          </Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/isomorphic-fns.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createIsomorphicFn, createServerFn } from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\nconst getEnv = createIsomorphicFn()\n  .server(() => 'server')\n  .client(() => 'client')\n\nconst getServerEnv = createServerFn().handler(() => getEnv())\n\nconst getEcho = createIsomorphicFn()\n  .server((input: string) => 'server received ' + input)\n  .client((input) => 'client received ' + input)\n\nconst getServerEcho = createServerFn()\n  .inputValidator((input: string) => input)\n  .handler(({ data }) => getEcho(data))\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n    const results = ref<Partial<Record<string, string>> | undefined>()\n\n    async function handleClick() {\n      const envOnClick = getEnv()\n      const echo = getEcho('hello')\n      const [serverEnv, serverEcho] = await Promise.all([\n        getServerEnv(),\n        getServerEcho({ data: 'hello' }),\n      ])\n      results.value = { envOnClick, echo, serverEnv, serverEcho }\n    }\n\n    return () => (\n      <div>\n        <button onClick={handleClick} data-testid=\"test-isomorphic-results-btn\">\n          Run\n        </button>\n        {!!results.value && (\n          <div>\n            <h1>\n              <code>getEnv</code>\n            </h1>\n            When we called the function on the server it returned:\n            <pre data-testid=\"server-result\">\n              {JSON.stringify(results.value.serverEnv)}\n            </pre>\n            When we called the function on the client it returned:\n            <pre data-testid=\"client-result\">\n              {JSON.stringify(results.value.envOnClick)}\n            </pre>\n            When we called the function during SSR it returned:\n            <pre data-testid=\"ssr-result\">\n              {JSON.stringify(loaderData.value.envOnLoad)}\n            </pre>\n            <br />\n            <h1>\n              <code>echo</code>\n            </h1>\n            When we called the function on the server it returned:\n            <pre data-testid=\"server-echo-result\">\n              {JSON.stringify(results.value.serverEcho)}\n            </pre>\n            When we called the function on the client it returned:\n            <pre data-testid=\"client-echo-result\">\n              {JSON.stringify(results.value.echo)}\n            </pre>\n          </div>\n        )}\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/isomorphic-fns')({\n  component: RouteComponent,\n  loader() {\n    return {\n      envOnLoad: getEnv(),\n    }\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/middleware/client-middleware-router.tsx",
    "content": "import { createFileRoute, useRouter } from '@tanstack/vue-router'\nimport {\n  createMiddleware,\n  createServerFn,\n  getRouterInstance,\n} from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    const router = await getRouterInstance()\n    return next({\n      sendContext: {\n        routerContext: router.options.context,\n      },\n    })\n  },\n)\n\nconst serverFn = createServerFn()\n  .middleware([middleware])\n  .handler(({ context }) => {\n    return context.routerContext\n  })\nconst RouteComponent = defineComponent({\n  setup() {\n    const serverFnClientResult = ref<unknown>({})\n    const loaderData = Route.useLoaderData()\n    const router = useRouter()\n\n    return () => (\n      <div\n        class=\"p-2 m-2 grid gap-2\"\n        data-testid=\"client-middleware-router-route-component\"\n      >\n        <h3>Client Middleware has access to router instance</h3>\n        <p>\n          This component checks that the client middleware has access to the\n          router instance and thus its context.\n        </p>\n        <div>\n          It should return{' '}\n          <code>\n            <pre data-testid=\"expected-server-fn-result\">\n              {JSON.stringify(router.options.context)}\n            </pre>\n          </code>\n        </div>\n        <p>\n          serverFn when invoked in the loader returns:\n          <br />\n          <span data-testid=\"serverFn-loader-result\">\n            {JSON.stringify(serverFnClientResult.value)}\n          </span>\n        </p>\n        <p>\n          serverFn when invoked on the client returns:\n          <br />\n          <span data-testid=\"serverFn-client-result\">\n            {JSON.stringify(loaderData.value.serverFnLoaderResult)}\n          </span>\n        </p>\n        <button\n          data-testid=\"btn-serverFn\"\n          type=\"button\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          onClick={() => {\n            serverFn().then((data) => {\n              serverFnClientResult.value = data\n            })\n          }}\n        >\n          Invoke Server Function\n        </button>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/middleware/client-middleware-router')({\n  component: RouteComponent,\n  loader: async () => ({ serverFnLoaderResult: await serverFn() }),\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/middleware/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/middleware/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server functions middleware E2E tests</h1>\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Route.Link\n            to=\"./client-middleware-router\"\n            data-testid=\"client-middleware-router-link\"\n          >\n            Client Middleware has access to router instance\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link to=\"./send-serverFn\" data-testid=\"send-serverFn-link\">\n            Client Middleware can send server function reference in context\n          </Route.Link>\n        </li>\n        <li>\n          <Route.Link\n            to=\"./request-middleware\"\n            data-testid=\"request-middleware-link\"\n            reloadDocument={true}\n          >\n            Request Middleware in combination with server function\n          </Route.Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/middleware/request-middleware.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createMiddleware, createServerFn } from '@tanstack/vue-start'\nimport { getRequest } from '@tanstack/vue-start/server'\nimport { defineComponent, ref } from 'vue'\n\nconst requestMiddleware = createMiddleware({ type: 'request' }).server(\n  async ({ next, request }) => {\n    return next({\n      context: {\n        requestParam: request.url,\n        requestFunc: getRequest().url,\n      },\n    })\n  },\n)\n\nconst serverFn = createServerFn()\n  .middleware([requestMiddleware])\n  .handler(async ({ context: { requestParam, requestFunc } }) => {\n    return { requestParam, requestFunc }\n  })\n\ntype ServerFnResult = Awaited<ReturnType<typeof serverFn>>\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const loaderData = Route.useLoaderData()\n    const clientData = ref<ServerFnResult | null>(null)\n\n    return () => (\n      <div>\n        <h2>Request Middleware in combination with server function</h2>\n        <br />\n        <div>\n          <div data-testid=\"loader-data\">\n            <h3>Loader Data</h3>Request Param:\n            <div data-testid=\"loader-data-request-param\">\n              {loaderData.value.requestParam}\n            </div>\n            Request Func:\n            <div data-testid=\"loader-data-request-func\">\n              {loaderData.value.requestFunc}\n            </div>\n          </div>\n          <br />\n          <div data-testid=\"client-call\">\n            <button\n              data-testid=\"client-call-button\"\n              onClick={async () => {\n                const data = await serverFn()\n                clientData.value = data\n              }}\n            >\n              Call server function from client\n            </button>\n          </div>\n          <br />\n          <div data-testid=\"client-data-container\">\n            <h3>Client Data</h3>\n            {clientData.value ? (\n              <div data-testid=\"client-data\">\n                Request Param:\n                <div data-testid=\"client-data-request-param\">\n                  {clientData.value.requestParam}\n                </div>\n                Request Func:\n                <div data-testid=\"client-data-request-func\">\n                  {clientData.value.requestFunc}\n                </div>\n              </div>\n            ) : (\n              ' Loading ...'\n            )}\n          </div>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/middleware/request-middleware')({\n  loader: () => serverFn(),\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/middleware/send-serverFn.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createMiddleware, createServerFn } from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\nconst middleware = createMiddleware({ type: 'function' }).client(\n  async ({ next }) => {\n    return next({\n      sendContext: {\n        serverFn: barFn,\n      },\n    })\n  },\n)\n\nconst fooFn = createServerFn()\n  .middleware([middleware])\n  .handler(({ context }) => {\n    return context.serverFn()\n  })\nconst barFn = createServerFn().handler(() => {\n  return 'bar'\n})\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const serverFnClientResult = ref<unknown>({})\n    const loaderData = Route.useLoaderData()\n\n    return () => (\n      <div\n        class=\"p-2 m-2 grid gap-2\"\n        data-testid=\"client-middleware-router-route-component\"\n      >\n        <h3>Send server function in context</h3>\n        <p>\n          This component checks that the client middleware can send a reference\n          to a server function in the context, which can then be invoked in the\n          server function handler.\n        </p>\n        <div>\n          It should return{' '}\n          <code>\n            <pre data-testid=\"expected-server-fn-result\">\n              {JSON.stringify('bar')}\n            </pre>\n          </code>\n        </div>\n        <p>\n          serverFn when invoked in the loader returns:\n          <br />\n          <span data-testid=\"serverFn-loader-result\">\n            {JSON.stringify(serverFnClientResult.value)}\n          </span>\n        </p>\n        <p>\n          serverFn when invoked on the client returns:\n          <br />\n          <span data-testid=\"serverFn-client-result\">\n            {JSON.stringify(loaderData.value.serverFnLoaderResult)}\n          </span>\n        </p>\n        <button\n          data-testid=\"btn-serverFn\"\n          type=\"button\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          onClick={() => {\n            fooFn().then((data) => {\n              serverFnClientResult.value = data\n            })\n          }}\n        >\n          Invoke Server Function\n        </button>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/middleware/send-serverFn')({\n  component: RouteComponent,\n  loader: async () => ({ serverFnLoaderResult: await fooFn() }),\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/multipart.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\nconst multipartFormDataServerFn = createServerFn({ method: 'POST' })\n  .inputValidator((x: unknown) => {\n    if (!(x instanceof FormData)) {\n      throw new Error('Invalid form data')\n    }\n\n    const value = x.get('input_field')\n    const file = x.get('input_file')\n\n    if (typeof value !== 'string') {\n      throw new Error('Submitted value is not a string')\n    }\n\n    if (!(file instanceof File)) {\n      throw new Error('File is required')\n    }\n\n    return {\n      submittedValue: value,\n      file,\n    }\n  })\n  .handler(async ({ data }) => {\n    const contents = await data.file.text()\n    return {\n      value: data.submittedValue,\n      file: {\n        name: data.file.name,\n        size: data.file.size,\n        contents: contents,\n      },\n    }\n  })\n\nconst MultipartServerFnCall = defineComponent({\n  setup() {\n    const formRef = ref<HTMLFormElement | null>(null)\n    const multipartResult = ref<unknown>({})\n\n    const handleSubmit = (e: Event) => {\n      e.preventDefault()\n\n      if (!formRef.value) {\n        return\n      }\n\n      const formData = new FormData(formRef.value)\n      multipartFormDataServerFn({ data: formData }).then((data) => {\n        multipartResult.value = data\n      })\n    }\n\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\">\n        <h3>Multipart Server Fn POST Call</h3>\n        <div class=\"overflow-y-auto\">\n          It should return{' '}\n          <code>\n            <pre data-testid=\"expected-multipart-server-fn-result\">\n              {JSON.stringify({\n                value: 'test field value',\n                file: { name: 'my_file.txt', size: 9, contents: 'test data' },\n              })}\n            </pre>\n          </code>\n        </div>\n        <form\n          class=\"flex flex-col gap-2\"\n          action={multipartFormDataServerFn.url}\n          method=\"post\"\n          enctype=\"multipart/form-data\"\n          ref={(el) => {\n            formRef.value = el as HTMLFormElement\n          }}\n          data-testid=\"multipart-form\"\n        >\n          <input type=\"text\" name=\"input_field\" value=\"test field value\" />\n          <input\n            type=\"file\"\n            name=\"input_file\"\n            data-testid=\"multipart-form-file-input\"\n          />\n          <button\n            type=\"submit\"\n            class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          >\n            Submit (native)\n          </button>\n          <button\n            type=\"button\"\n            onClick={handleSubmit}\n            class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          >\n            Submit (onClick)\n          </button>\n        </form>\n        <div class=\"overflow-y-auto\">\n          <pre data-testid=\"multipart-form-response\">\n            {JSON.stringify(multipartResult.value)}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/multipart')({\n  component: MultipartServerFnCall,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/primitives/index.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { defineComponent } from 'vue'\nimport { z } from 'zod'\n\nfunction stringify(data: any) {\n  return JSON.stringify(data === undefined ? '$undefined' : data)\n}\n\nconst $stringPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.string())\n  .handler((ctx) => ctx.data)\n\nconst $stringGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.string())\n  .handler((ctx) => ctx.data)\n\nconst $undefinedPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.undefined())\n  .handler((ctx) => ctx.data)\n\nconst $undefinedGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.undefined())\n  .handler((ctx) => ctx.data)\n\nconst $nullPost = createServerFn({ method: 'POST' })\n  .inputValidator(z.null())\n  .handler((ctx) => ctx.data)\n\nconst $nullGet = createServerFn({ method: 'GET' })\n  .inputValidator(z.null())\n  .handler((ctx) => ctx.data)\n\ninterface PrimitiveComponentProps<T> {\n  serverFn: {\n    get: (opts: { data: T }) => Promise<T>\n    post: (opts: { data: T }) => Promise<T>\n  }\n  data: {\n    value: T\n    type: string\n  }\n}\n\nfunction makeTestCase<T>(props: PrimitiveComponentProps<T>) {\n  return props\n}\nconst testCases = [\n  makeTestCase({\n    data: {\n      value: null,\n      type: 'null',\n    },\n    serverFn: {\n      get: $nullGet,\n      post: $nullPost,\n    },\n  }),\n  makeTestCase({\n    data: {\n      value: undefined,\n      type: 'undefined',\n    },\n    serverFn: {\n      get: $undefinedGet,\n      post: $undefinedPost,\n    },\n  }),\n  makeTestCase({\n    data: {\n      value: 'foo-bar',\n      type: 'string',\n    },\n    serverFn: {\n      get: $stringGet,\n      post: $stringPost,\n    },\n  }),\n] as Array<PrimitiveComponentProps<any>>\n\ntype Method = 'get' | 'post'\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const testQueries = testCases.map((testCase) => {\n      const makeQuery = (method: Method) =>\n        useQuery(() => ({\n          queryKey: [testCase.data.type, method],\n          queryFn: async () => {\n            const result = await testCase.serverFn[method]({\n              data: testCase.data.value,\n            })\n            if (result === undefined) {\n              return '$undefined'\n            }\n            return result\n          },\n        }))\n\n      return {\n        testCase,\n        queries: {\n          post: makeQuery('post'),\n          get: makeQuery('get'),\n        },\n      }\n    })\n\n    return () => (\n      <>\n        {testQueries.map(({ testCase, queries }) => (\n          <div key={testCase.data.type}>\n            <h2>data type: {testCase.data.type}</h2>\n\n            {(['post', 'get'] as const).map((method) => {\n              const testId = `${method}-${testCase.data.type}`\n              const query = queries[method]\n              return (\n                <div key={testId}>\n                  <h3>serverFn method={method}</h3>\n                  <h4> expected </h4>\n                  <div data-testid={`expected-${testId}`}>\n                    {stringify(testCase.data.value)}\n                  </div>\n                  <h4> result</h4>\n                  <div data-testid={`result-${testId}`}>\n                    {query.isSuccess.value ? stringify(query.data.value) : ''}\n                  </div>\n                  <br />\n                </div>\n              )\n            })}\n            <br />\n            <br />\n          </div>\n        ))}\n      </>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/primitives/')({\n  component: RouteComponent,\n  ssr: true,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/raw-response.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\nconst expectedValue = 'Hello from a server function!'\nexport const rawResponseFn = createServerFn().handler(() => {\n  return new Response(expectedValue)\n})\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const formDataResult = ref<unknown>('')\n\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\">\n        <h3>Raw Response</h3>\n        <div class=\"overflow-y-auto\">\n          It should return{' '}\n          <code>\n            <pre data-testid=\"expected\">{expectedValue}</pre>\n          </code>\n        </div>\n\n        <button\n          onClick={async () => {\n            const response = await rawResponseFn()\n            console.log('response', response)\n\n            const text = await response.text()\n            formDataResult.value = text\n          }}\n          data-testid=\"button\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit\n        </button>\n\n        <div class=\"overflow-y-auto\">\n          <pre data-testid=\"response\">\n            {JSON.stringify(formDataResult.value)}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/raw-response')({\n  component: RouteComponent,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/redirect-test/index.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport { createFileRoute, redirect } from '@tanstack/vue-router'\nimport { createServerFn, useServerFn } from '@tanstack/vue-start'\nimport { Suspense, defineComponent } from 'vue'\n\nconst $redirectServerFn = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    throw redirect({ to: '/redirect-test/target' })\n  },\n)\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const redirectFn = useServerFn($redirectServerFn)\n    const query = useQuery(() => ({\n      queryKey: ['redirect-test'],\n      queryFn: () => redirectFn(),\n      suspense: true,\n    }))\n\n    return () => (\n      <div>\n        <h1 data-testid=\"redirect-source\">Redirect Source</h1>\n        <Suspense>\n          {{\n            default: () => <div>{JSON.stringify(query.data.value)}</div>,\n            fallback: () => <div>Loading...</div>,\n          }}\n        </Suspense>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/redirect-test/')({\n  component: RouteComponent,\n  ssr: 'data-only',\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/redirect-test/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect-test/target')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h1 data-testid=\"redirect-target\">Redirect Target</h1>\n      <p>Successfully redirected!</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/redirect-test-ssr/index.tsx",
    "content": "import { useQuery } from '@tanstack/vue-query'\nimport { createFileRoute, redirect } from '@tanstack/vue-router'\nimport { createServerFn, useServerFn } from '@tanstack/vue-start'\nimport { Suspense, defineComponent } from 'vue'\n\nconst $redirectServerFn = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    throw redirect({ to: '/redirect-test-ssr/target' })\n  },\n)\n\nconst RouteComponent = defineComponent({\n  setup() {\n    const redirectFn = useServerFn($redirectServerFn)\n    const query = useQuery(() => ({\n      queryKey: ['redirect-test-ssr'],\n      queryFn: () => redirectFn(),\n      suspense: true,\n    }))\n\n    return () => (\n      <div>\n        <h1 data-testid=\"redirect-source-ssr\">Redirect Source SSR</h1>\n        <Suspense>\n          {{\n            default: () => <div>{JSON.stringify(query.data.value)}</div>,\n            fallback: () => <div>Loading...</div>,\n          }}\n        </Suspense>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/redirect-test-ssr/')({\n  component: RouteComponent,\n  ssr: true,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/redirect-test-ssr/target.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/redirect-test-ssr/target')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div>\n      <h1 data-testid=\"redirect-target-ssr\">Redirect Target SSR</h1>\n      <p>Successfully redirected!</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/return-null.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\n/**\n * This checks whether the server function can\n * return null without throwing an error or returning something else.\n * @link https://github.com/TanStack/router/issues/2776\n */\n\nconst $allow_return_null_getFn = createServerFn().handler(async () => {\n  return null\n})\nconst $allow_return_null_postFn = createServerFn({ method: 'POST' }).handler(\n  async () => {\n    return null\n  },\n)\n\nconst AllowServerFnReturnNull = defineComponent({\n  setup() {\n    const getServerResult = ref<any>('-')\n    const postServerResult = ref<any>('-')\n\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\">\n        <h3>Allow ServerFn to return `null`</h3>\n        <p>\n          This component checks whether the server function can return null\n          without throwing an error.\n        </p>\n        <div>\n          It should return{' '}\n          <code>\n            <pre>{JSON.stringify(null)}</pre>\n          </code>\n        </div>\n        <p>\n          {`GET: $allow_return_null_getFn returns`}\n          <br />\n          <span data-testid=\"allow_return_null_getFn-response\">\n            {JSON.stringify(getServerResult.value)}\n          </span>\n        </p>\n        <p>\n          {`POST: $allow_return_null_postFn returns`}\n          <br />\n          <span data-testid=\"allow_return_null_postFn-response\">\n            {JSON.stringify(postServerResult.value)}\n          </span>\n        </p>\n        <button\n          data-testid=\"test-allow-server-fn-return-null-btn\"\n          type=\"button\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          onClick={() => {\n            $allow_return_null_getFn().then((data) => {\n              getServerResult.value = data\n            })\n            $allow_return_null_postFn().then((data) => {\n              postServerResult.value = data\n            })\n          }}\n        >\n          Test Allow Server Fn Return Null\n        </button>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/return-null')({\n  component: AllowServerFnReturnNull,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/serialize-form-data.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport { defineComponent, ref } from 'vue'\n\nconst testValues = {\n  name: 'Sean',\n  age: 25,\n  pet1: 'dog',\n  pet2: 'cat',\n  __adder: 1,\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n    const age = data.get('age')\n    const pets = data.getAll('pet')\n\n    if (!name || !age || pets.length === 0) {\n      throw new Error('Name, age and pets are required')\n    }\n\n    return {\n      name: name.toString(),\n      age: parseInt(age.toString(), 10),\n      pets: pets.map((pet) => pet.toString()),\n    }\n  })\n  .handler(({ data: { name, age, pets } }) => {\n    return `Hello, ${name}! You are ${age + testValues.__adder} years old, and your favorite pets are ${pets.join(',')}.`\n  })\n\nexport const SerializeFormDataFnCall = defineComponent({\n  setup() {\n    const formDataResult = ref<unknown>('')\n\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\">\n        <h3>Serialize FormData Fn POST Call</h3>\n        <div class=\"overflow-y-auto\">\n          It should return{' '}\n          <code>\n            <pre data-testid=\"expected-serialize-formdata-server-fn-result\">\n              Hello, {testValues.name}! You are{' '}\n              {testValues.age + testValues.__adder} years old, and your favorite\n              pets are {testValues.pet1},{testValues.pet2}.\n            </pre>\n          </code>\n        </div>\n        <form\n          class=\"flex flex-col gap-2\"\n          data-testid=\"serialize-formdata-form\"\n          onSubmit={(evt: SubmitEvent) => {\n            evt.preventDefault()\n            const data = new FormData(evt.currentTarget as HTMLFormElement)\n            greetUser({ data }).then((result) => {\n              formDataResult.value = result\n            })\n          }}\n        >\n          <input type=\"text\" name=\"name\" value={testValues.name} />\n          <input type=\"number\" name=\"age\" value={testValues.age} />\n          <input type=\"text\" name=\"pet\" value={testValues.pet1} />\n          <input type=\"text\" name=\"pet\" value={testValues.pet2} />\n          <button\n            type=\"submit\"\n            data-testid=\"test-serialize-formdata-fn-calls-btn\"\n            class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          >\n            Submit\n          </button>\n        </form>\n        <div class=\"overflow-y-auto\">\n          <pre data-testid=\"serialize-formdata-form-response\">\n            {JSON.stringify(formDataResult.value)}\n          </pre>\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/serialize-form-data')({\n  component: SerializeFormDataFnCall,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/status.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn, useServerFn } from '@tanstack/vue-start'\nimport { setResponseStatus } from '@tanstack/vue-start/server'\n\nconst helloFn = createServerFn().handler(() => {\n  setResponseStatus(225, `hello`)\n  return {\n    hello: 'world',\n  }\n})\n\nexport const Route = createFileRoute('/status')({\n  component: StatusComponent,\n})\n\nfunction StatusComponent() {\n  const hello = useServerFn(helloFn)\n\n  return (\n    <div class=\"p-2\">\n      <button\n        data-testid=\"invoke-server-fn\"\n        class=\"px-4 py-2 bg-blue-500 text-white rounded-md\"\n        onClick={() => hello()}\n      >\n        click me\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/routes/submit-post-formdata.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\n\nexport const Route = createFileRoute('/submit-post-formdata')({\n  component: SubmitPostFormDataFn,\n})\n\nconst testValues = {\n  name: 'Sean',\n}\n\nexport const greetUser = createServerFn({ method: 'POST' })\n  .inputValidator((data: FormData) => {\n    if (!(data instanceof FormData)) {\n      throw new Error('Invalid! FormData is required')\n    }\n    const name = data.get('name')\n\n    if (!name) {\n      throw new Error('Name is required')\n    }\n\n    return {\n      name: name.toString(),\n    }\n  })\n  .handler(({ data: { name } }) => {\n    return new Response(`Hello, ${name}!`)\n  })\n\nfunction SubmitPostFormDataFn() {\n  return (\n    <div class=\"p-2 m-2 grid gap-2\">\n      <h3>Submit POST FormData Fn Call</h3>\n      <div class=\"overflow-y-auto\">\n        It should return navigate and return{' '}\n        <code>\n          <pre data-testid=\"expected-submit-post-formdata-server-fn-result\">\n            Hello, {testValues.name}!\n          </pre>\n        </code>\n      </div>\n      <form\n        class=\"flex flex-col gap-2\"\n        data-testid=\"submit-post-formdata-form\"\n        method=\"post\"\n        action={greetUser.url}\n      >\n        <input type=\"text\" name=\"name\" value={testValues.name} />\n        <button\n          type=\"submit\"\n          data-testid=\"test-submit-post-formdata-fn-calls-btn\"\n          class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n        >\n          Submit (native)\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/tests/server-functions.spec.ts",
    "content": "import * as fs from 'node:fs'\nimport { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport { PORT } from '../playwright.config'\nimport type { Page } from '@playwright/test'\n\ntest('Server function URLs correctly include constant ids', async ({\n  page,\n}) => {\n  for (const currentPage of ['/submit-post-formdata', '/formdata-redirect']) {\n    await page.goto(currentPage)\n    await page.waitForLoadState('networkidle')\n\n    const form = page.locator('form')\n    const actionUrl = await form.getAttribute('action')\n\n    expect(actionUrl).toMatch(/^\\/_serverFn\\/constant_id/)\n  }\n})\n\ntest('invoking a server function with custom response status code', async ({\n  page,\n}) => {\n  await page.goto('/status')\n\n  await page.waitForLoadState('networkidle')\n\n  const requestPromise = new Promise<void>((resolve) => {\n    page.on('response', (response) => {\n      expect(response.status()).toBe(225)\n      expect(response.statusText()).toBe('hello')\n      expect(response.headers()['content-type']).toContain('application/json')\n      resolve()\n    })\n  })\n  await page.getByTestId('invoke-server-fn').click()\n  await requestPromise\n})\n\ntest('Consistent server function returns both on client and server for GET and POST calls', async ({\n  page,\n}) => {\n  await page.goto('/consistent')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-consistent-server-fns-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-consistent-server-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  // GET calls\n  await expect(page.getByTestId('cons_serverGetFn1-response')).toContainText(\n    expected,\n  )\n  await expect(page.getByTestId('cons_getFn1-response')).toContainText(expected)\n\n  // POST calls\n  await expect(page.getByTestId('cons_serverPostFn1-response')).toContainText(\n    expected,\n  )\n  await expect(page.getByTestId('cons_postFn1-response')).toContainText(\n    expected,\n  )\n})\n\ntest('submitting multipart/form-data as server function input', async ({\n  page,\n}) => {\n  await page.goto('/multipart')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-multipart-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  const fileChooserPromise = page.waitForEvent('filechooser')\n  await page.getByTestId('multipart-form-file-input').click()\n  const fileChooser = await fileChooserPromise\n  await fileChooser.setFiles({\n    name: 'my_file.txt',\n    mimeType: 'text/plain',\n    buffer: Buffer.from('test data', 'utf-8'),\n  })\n  await page.getByText('Submit (onClick)').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('multipart-form-response')).toContainText(\n    expected,\n  )\n})\n\ntest('isomorphic functions can have different implementations on client and server', async ({\n  page,\n}) => {\n  await page.goto('/isomorphic-fns')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-isomorphic-results-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('server-result')).toContainText('server')\n  await expect(page.getByTestId('client-result')).toContainText('client')\n  await expect(page.getByTestId('ssr-result')).toContainText('server')\n\n  await expect(page.getByTestId('server-echo-result')).toContainText(\n    'server received hello',\n  )\n  await expect(page.getByTestId('client-echo-result')).toContainText(\n    'client received hello',\n  )\n})\n\ntest('env-only functions can only be called on the server or client respectively', async ({\n  page,\n}) => {\n  await page.goto('/env-only')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-env-only-results-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('server-on-server')).toContainText(\n    'server got: hello',\n  )\n  await expect(page.getByTestId('server-on-client')).toContainText(\n    'serverEcho threw an error: createServerOnlyFn() functions can only be called on the server!',\n  )\n\n  await expect(page.getByTestId('client-on-server')).toContainText(\n    'clientEcho threw an error: createClientOnlyFn() functions can only be called on the client!',\n  )\n  await expect(page.getByTestId('client-on-client')).toContainText(\n    'client got: hello',\n  )\n})\n\ntest('Server function can return null for GET and POST calls', async ({\n  page,\n}) => {\n  await page.goto('/return-null')\n\n  await page.waitForLoadState('networkidle')\n  await page.getByTestId('test-allow-server-fn-return-null-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  // GET call\n  await expect(\n    page.getByTestId('allow_return_null_getFn-response'),\n  ).toContainText(JSON.stringify(null))\n\n  // POST call\n  await expect(\n    page.getByTestId('allow_return_null_postFn-response'),\n  ).toContainText(JSON.stringify(null))\n})\n\ntest('Server function can correctly send and receive FormData', async ({\n  page,\n}) => {\n  await page.goto('/serialize-form-data')\n\n  await page.waitForLoadState('networkidle')\n  const expected =\n    (await page\n      .getByTestId('expected-serialize-formdata-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-serialize-formdata-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(\n    page.getByTestId('serialize-formdata-form-response'),\n  ).toContainText(expected)\n})\n\ntest('server function can correctly send and receive headers', async ({\n  page,\n}) => {\n  await page.goto('/headers')\n\n  await page.waitForLoadState('networkidle')\n  let headers = JSON.parse(\n    await page.getByTestId('initial-headers-result').innerText(),\n  )\n  expect(headers['host']).toBe(`localhost:${PORT}`)\n  expect(headers['user-agent']).toContain('Mozilla/5.0')\n  expect(headers['sec-fetch-mode']).toBe('navigate')\n\n  await page.getByTestId('test-headers-btn').click()\n  await page.waitForSelector('[data-testid=\"updated-headers-result\"]')\n\n  headers = JSON.parse(\n    await page.getByTestId('updated-headers-result').innerText(),\n  )\n\n  expect(headers['host']).toBe(`localhost:${PORT}`)\n  expect(headers['user-agent']).toContain('Mozilla/5.0')\n  expect(headers['sec-fetch-mode']).toBe('cors')\n  expect(headers['referer']).toBe(`http://localhost:${PORT}/headers`)\n})\n\ntest('Direct POST submitting FormData to a Server function returns the correct message', async ({\n  page,\n}) => {\n  await page.goto('/submit-post-formdata')\n\n  await page.waitForLoadState('networkidle')\n\n  const expected =\n    (await page\n      .getByTestId('expected-submit-post-formdata-server-fn-result')\n      .textContent()) || ''\n  expect(expected).not.toBe('')\n\n  await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  const result = await page.innerText('body')\n  expect(result).toBe(expected)\n})\n\ntest(\"server function's dead code is preserved if already there\", async ({\n  page,\n}) => {\n  await page.goto('/dead-code-preserve')\n\n  await page.waitForLoadState('networkidle')\n  await page.getByTestId('test-dead-code-fn-call-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('dead-code-fn-call-response')).toContainText(\n    '1',\n  )\n\n  await fs.promises.rm('count-effect.txt')\n})\n\ntest.describe('server function sets cookies', () => {\n  async function runCookieTest(page: Page, expectedCookieValue: string) {\n    for (let i = 1; i <= 4; i++) {\n      const key = `cookie-${i}-${expectedCookieValue}`\n\n      const actualValue = await page.getByTestId(key).textContent()\n      expect(actualValue).toBe(expectedCookieValue)\n    }\n  }\n  test('SSR', async ({ page }) => {\n    const expectedCookieValue = `SSR-${Date.now()}`\n    await page.goto(`/cookies/set?value=${expectedCookieValue}`)\n    await runCookieTest(page, expectedCookieValue)\n  })\n\n  test('client side navigation', async ({ page }) => {\n    const expectedCookieValue = `CLIENT-${Date.now()}`\n    await page.goto(`/cookies?value=${expectedCookieValue}`)\n    await page.getByTestId('link-to-set').click()\n    await runCookieTest(page, expectedCookieValue)\n  })\n})\n\ntest.describe('aborting a server function call', () => {\n  test('without aborting', async ({ page }) => {\n    await page.goto('/abort-signal')\n\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('run-without-abort-btn').click()\n    await page.waitForLoadState('networkidle')\n    await page.waitForSelector(\n      '[data-testid=\"result\"]:has-text(\"server function result\")',\n    )\n    await page.waitForSelector(\n      '[data-testid=\"errorMessage\"]:has-text(\"$undefined\")',\n    )\n\n    const result = (await page.getByTestId('result').textContent()) || ''\n    expect(result).toBe('server function result')\n\n    const errorMessage =\n      (await page.getByTestId('errorMessage').textContent()) || ''\n    expect(errorMessage).toBe('$undefined')\n  })\n\n  test('aborting', async ({ page }) => {\n    await page.goto('/abort-signal')\n\n    await page.waitForLoadState('networkidle')\n\n    await page.getByTestId('run-with-abort-btn').click()\n    await page.waitForLoadState('networkidle')\n    await page.waitForSelector('[data-testid=\"result\"]:has-text(\"$undefined\")')\n    await page.waitForSelector(\n      '[data-testid=\"errorMessage\"]:has-text(\"aborted\")',\n    )\n\n    const result = (await page.getByTestId('result').textContent()) || ''\n    expect(result).toBe('$undefined')\n\n    const errorMessage =\n      (await page.getByTestId('errorMessage').textContent()) || ''\n    expect(errorMessage).toContain('abort')\n  })\n})\n\ntest('raw response', async ({ page }) => {\n  await page.goto('/raw-response')\n\n  await page.waitForLoadState('networkidle')\n\n  const expectedValue = (await page.getByTestId('expected').textContent()) || ''\n  expect(expectedValue).not.toBe('')\n\n  await page.getByTestId('button').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('response')).toContainText(expectedValue)\n})\n\ntest.describe('formdata redirect modes', () => {\n  for (const mode of ['js', 'no-js']) {\n    test(`Server function can redirect when sending formdata: mode = ${mode}`, async ({\n      page,\n    }) => {\n      await page.goto('/formdata-redirect?mode=' + mode)\n\n      await page.waitForLoadState('networkidle')\n      const expected =\n        (await page\n          .getByTestId('expected-submit-post-formdata-server-fn-result')\n          .textContent()) || ''\n      expect(expected).not.toBe('')\n\n      await page.getByTestId('test-submit-post-formdata-fn-calls-btn').click()\n\n      await page.waitForLoadState('networkidle')\n\n      await expect(\n        page.getByTestId('formdata-redirect-target-name'),\n      ).toContainText(expected)\n\n      expect(page.url().endsWith(`/formdata-redirect/target/${expected}`))\n    })\n  }\n})\n\ntest.describe('middleware', () => {\n  test.describe('client middleware should have access to router context via the router instance', () => {\n    async function runTest(page: Page) {\n      await page.waitForLoadState('networkidle')\n\n      const expected =\n        (await page.getByTestId('expected-server-fn-result').textContent()) ||\n        ''\n      expect(expected).not.toBe('')\n\n      await page.getByTestId('btn-serverFn').click()\n      await page.waitForLoadState('networkidle')\n      await expect(page.getByTestId('serverFn-loader-result')).toContainText(\n        expected,\n      )\n      await expect(page.getByTestId('serverFn-client-result')).toContainText(\n        expected,\n      )\n    }\n\n    test('direct visit', async ({ page }) => {\n      await page.goto('/middleware/client-middleware-router')\n      await runTest(page)\n    })\n\n    test('client navigation', async ({ page }) => {\n      await page.goto('/middleware')\n      await page.getByTestId('client-middleware-router-link').click()\n      await runTest(page)\n    })\n  })\n\n  test('server function in combination with request middleware', async ({\n    page,\n  }) => {\n    await page.goto('/middleware/request-middleware')\n\n    await page.waitForLoadState('networkidle')\n\n    async function checkEqual(prefix: string) {\n      const requestParam = await page\n        .getByTestId(`${prefix}-data-request-param`)\n        .textContent()\n      expect(requestParam).not.toBe('')\n      const requestFunc = await page\n        .getByTestId(`${prefix}-data-request-func`)\n        .textContent()\n      expect(requestParam).toBe(requestFunc)\n    }\n\n    await checkEqual('loader')\n\n    await page.getByTestId('client-call-button').click()\n    await page.waitForLoadState('networkidle')\n\n    await checkEqual('client')\n  })\n})\n\ntest('factory', async ({ page }) => {\n  await page.goto('/factory')\n\n  await expect(page.getByTestId('factory-route-component')).toBeInViewport()\n\n  const buttons = await page\n    .locator('[data-testid^=\"btn-fn-\"]')\n    .elementHandles()\n  for (const button of buttons) {\n    const testId = await button.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('Button is missing data-testid')\n    }\n\n    const suffix = testId.replace('btn-fn-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-fn-result-${suffix}`).textContent()) ||\n      ''\n    expect(expected).not.toBe('')\n\n    await button.click()\n\n    await expect(page.getByTestId(`fn-result-${suffix}`)).toContainText(\n      expected,\n    )\n\n    await expect(page.getByTestId(`fn-comparison-${suffix}`)).toContainText(\n      'equal',\n    )\n  }\n})\n\ntest('primitives', async ({ page }) => {\n  await page.goto('/primitives')\n\n  await page.waitForLoadState('networkidle')\n\n  // Wait for client-side hydration to complete\n  await expect(page.locator('[data-testid^=\"expected-\"]').first()).toBeVisible()\n\n  const testCases = await page\n    .locator('[data-testid^=\"expected-\"]')\n    .elementHandles()\n  expect(testCases.length).not.toBe(0)\n\n  for (const testCase of testCases) {\n    const testId = await testCase.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('testcase is missing data-testid')\n    }\n\n    const suffix = testId.replace('expected-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-${suffix}`).textContent()) || ''\n    expect(expected).not.toBe('')\n\n    await expect(page.getByTestId(`result-${suffix}`)).toContainText(expected)\n  }\n})\n\ntest('redirect in server function on direct navigation', async ({ page }) => {\n  // Test direct navigation to a route with a server function that redirects\n  await page.goto('/redirect-test')\n\n  // Should redirect to target page\n  await expect(page.getByTestId('redirect-target')).toBeVisible()\n  expect(page.url()).toContain('/redirect-test/target')\n})\n\ntest('redirect in server function called in query during SSR', async ({\n  page,\n}) => {\n  // Test direct navigation to a route with a server function that redirects\n  // when called inside a query with ssr: true\n  await page.goto('/redirect-test-ssr')\n\n  // Should redirect to target page\n  await expect(page.getByTestId('redirect-target-ssr')).toBeVisible()\n  expect(page.url()).toContain('/redirect-test-ssr/target')\n})\n\ntest('server function is called with correct method option', async ({\n  page,\n}) => {\n  await page.goto('/function-method', { waitUntil: 'networkidle' })\n\n  await expect(page.getByTestId('method-route-component')).toBeInViewport()\n\n  const buttons = await page\n    .locator('[data-testid^=\"btn-fn-\"]')\n    .elementHandles()\n  for (const button of buttons) {\n    const testId = await button.getAttribute('data-testid')\n\n    if (!testId) {\n      throw new Error('Button is missing data-testid')\n    }\n\n    const suffix = testId.replace('btn-fn-', '')\n\n    const expected =\n      (await page.getByTestId(`expected-fn-result-${suffix}`).textContent()) ||\n      ''\n    expect(expected).not.toBe('')\n\n    await button.click()\n\n    await expect(page.getByTestId(`fn-result-${suffix}`)).toContainText(\n      expected,\n    )\n\n    await expect(page.getByTestId(`fn-comparison-${suffix}`)).toContainText(\n      'equal',\n    )\n  }\n})\n\ntest('server function receives serverFnMeta in options', async ({ page }) => {\n  // This test verifies that:\n  // 1. Server functions receive `serverFnMeta` with full { id, name, filename }\n  // 2. No1 works even when the said server function is called from another server function\n\n  await page.goto('/function-metadata', { waitUntil: 'networkidle' })\n\n  await expect(page.getByTestId('metadata-route-component')).toBeInViewport()\n\n  // Test for no1\n  const loaderNormalGet = await page\n    .getByTestId('loader-normal-get-function-metadata')\n    .textContent()\n  const loaderNormalPost = await page\n    .getByTestId('loader-normal-post-function-metadata')\n    .textContent()\n\n  // stringified metadata should not be empty string\n  expect(loaderNormalGet).toBeTruthy()\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const normalGetMetadata = JSON.parse(loaderNormalGet!)\n  expect(normalGetMetadata).toHaveProperty('id')\n  expect(normalGetMetadata).toHaveProperty('name')\n  expect(normalGetMetadata).toHaveProperty('filename')\n  expect(typeof normalGetMetadata.id).toBe('string')\n  expect(normalGetMetadata.id.length).toBeGreaterThan(0)\n  expect(typeof normalGetMetadata.name).toBe('string')\n  expect(normalGetMetadata.name.length).toBeGreaterThan(0)\n  expect(typeof normalGetMetadata.filename).toBe('string')\n  expect(normalGetMetadata.filename.length).toBeGreaterThan(0)\n\n  // stringified metadata should not be empty string\n  expect(loaderNormalPost).toBeTruthy()\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const normalPostMetadata = JSON.parse(loaderNormalPost!)\n  expect(normalPostMetadata).toHaveProperty('id')\n  expect(normalPostMetadata).toHaveProperty('name')\n  expect(normalPostMetadata).toHaveProperty('filename')\n  expect(typeof normalPostMetadata.id).toBe('string')\n  expect(normalPostMetadata.id.length).toBeGreaterThan(0)\n  expect(typeof normalPostMetadata.name).toBe('string')\n  expect(normalPostMetadata.name.length).toBeGreaterThan(0)\n  expect(typeof normalPostMetadata.filename).toBe('string')\n  expect(normalPostMetadata.filename.length).toBeGreaterThan(0)\n\n  // Test for no2\n  const loaderNestingGet = await page\n    .getByTestId('loader-nesting-get-function-metadata')\n    .textContent()\n  const loaderNestingPost = await page\n    .getByTestId('loader-nesting-post-function-metadata')\n    .textContent()\n\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const nestingGetMetadata = JSON.parse(loaderNestingGet!)\n  expect(nestingGetMetadata).toHaveProperty('meta.id')\n  expect(nestingGetMetadata).toHaveProperty('meta.name')\n  expect(nestingGetMetadata).toHaveProperty('meta.filename')\n  expect(typeof nestingGetMetadata.meta.id).toBe('string')\n  expect(nestingGetMetadata.meta.id.length).toBeGreaterThan(0)\n  expect(typeof nestingGetMetadata.meta.name).toBe('string')\n  expect(nestingGetMetadata.meta.name.length).toBeGreaterThan(0)\n  expect(typeof nestingGetMetadata.meta.filename).toBe('string')\n  expect(nestingGetMetadata.meta.filename.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata).toHaveProperty('inner.get.id')\n  expect(nestingGetMetadata).toHaveProperty('inner.get.name')\n  expect(nestingGetMetadata).toHaveProperty('inner.get.filename')\n  expect(nestingGetMetadata.inner.get.id.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.get.name.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.get.filename.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata).toHaveProperty('inner.post.id')\n  expect(nestingGetMetadata).toHaveProperty('inner.post.name')\n  expect(nestingGetMetadata).toHaveProperty('inner.post.filename')\n  expect(nestingGetMetadata.inner.post.id.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.post.name.length).toBeGreaterThan(0)\n  expect(nestingGetMetadata.inner.post.filename.length).toBeGreaterThan(0)\n\n  // metadata should have `id`, `name`, and `filename` property, with all of them being a non-empty string\n  const nestingPostMetadata = JSON.parse(loaderNestingPost!)\n  expect(nestingPostMetadata).toHaveProperty('meta.id')\n  expect(nestingPostMetadata).toHaveProperty('meta.name')\n  expect(nestingPostMetadata).toHaveProperty('meta.filename')\n  expect(typeof nestingPostMetadata.meta.id).toBe('string')\n  expect(nestingPostMetadata.meta.id.length).toBeGreaterThan(0)\n  expect(typeof nestingPostMetadata.meta.name).toBe('string')\n  expect(nestingPostMetadata.meta.name.length).toBeGreaterThan(0)\n  expect(typeof nestingPostMetadata.meta.filename).toBe('string')\n  expect(nestingPostMetadata.meta.filename.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata).toHaveProperty('inner.get.id')\n  expect(nestingPostMetadata).toHaveProperty('inner.get.name')\n  expect(nestingPostMetadata).toHaveProperty('inner.get.filename')\n  expect(nestingPostMetadata.inner.get.id.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.get.name.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.get.filename.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata).toHaveProperty('inner.post.id')\n  expect(nestingPostMetadata).toHaveProperty('inner.post.name')\n  expect(nestingPostMetadata).toHaveProperty('inner.post.filename')\n  expect(nestingPostMetadata.inner.post.id.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.post.name.length).toBeGreaterThan(0)\n  expect(nestingPostMetadata.inner.post.filename.length).toBeGreaterThan(0)\n})\n"
  },
  {
    "path": "e2e/vue-start/server-functions/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-functions/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst FUNCTIONS_WITH_CONSTANT_ID = [\n  'src/routes/submit-post-formdata.tsx/greetUser_createServerFn_handler',\n  'src/routes/formdata-redirect/index.tsx/greetUser_createServerFn_handler',\n]\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      serverFns: {\n        generateFunctionId: (opts) => {\n          const id = `${opts.filename}/${opts.functionName}`\n          if (FUNCTIONS_WITH_CONSTANT_ID.includes(id)) return 'constant_id'\n          else return undefined\n        },\n      },\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/server-routes/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/server-routes/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/server-routes/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-server-routes\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-query\": \"^5.90.9\",\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-router-ssr-query\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"js-cookie\": \"^3.0.5\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/js-cookie\": \"^3.0.6\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nexport const PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot.value ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e: MouseEvent) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\" data-testid=\"default-not-found-component\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as MergeMiddlewareContextRouteImport } from './routes/merge-middleware-context'\nimport { Route as MethodsRouteRouteImport } from './routes/methods/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as MethodsIndexRouteImport } from './routes/methods/index'\nimport { Route as MethodsOnlyAnyRouteImport } from './routes/methods/only-any'\nimport { Route as ApiOnlyAnyRouteImport } from './routes/api/only-any'\nimport { Route as ApiMiddlewareContextRouteImport } from './routes/api/middleware-context'\nimport { Route as ApiParamsFooRouteRouteImport } from './routes/api/params/$foo/route'\nimport { Route as ApiParamsFooBarRouteImport } from './routes/api/params/$foo/$bar'\n\nconst MergeMiddlewareContextRoute = MergeMiddlewareContextRouteImport.update({\n  id: '/merge-middleware-context',\n  path: '/merge-middleware-context',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MethodsRouteRoute = MethodsRouteRouteImport.update({\n  id: '/methods',\n  path: '/methods',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst MethodsIndexRoute = MethodsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => MethodsRouteRoute,\n} as any)\nconst MethodsOnlyAnyRoute = MethodsOnlyAnyRouteImport.update({\n  id: '/only-any',\n  path: '/only-any',\n  getParentRoute: () => MethodsRouteRoute,\n} as any)\nconst ApiOnlyAnyRoute = ApiOnlyAnyRouteImport.update({\n  id: '/api/only-any',\n  path: '/api/only-any',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiMiddlewareContextRoute = ApiMiddlewareContextRouteImport.update({\n  id: '/api/middleware-context',\n  path: '/api/middleware-context',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiParamsFooRouteRoute = ApiParamsFooRouteRouteImport.update({\n  id: '/api/params/$foo',\n  path: '/api/params/$foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiParamsFooBarRoute = ApiParamsFooBarRouteImport.update({\n  id: '/$bar',\n  path: '/$bar',\n  getParentRoute: () => ApiParamsFooRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/methods': typeof MethodsRouteRouteWithChildren\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods/': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/methods': typeof MethodsRouteRouteWithChildren\n  '/merge-middleware-context': typeof MergeMiddlewareContextRoute\n  '/api/middleware-context': typeof ApiMiddlewareContextRoute\n  '/api/only-any': typeof ApiOnlyAnyRoute\n  '/methods/only-any': typeof MethodsOnlyAnyRoute\n  '/methods/': typeof MethodsIndexRoute\n  '/api/params/$foo': typeof ApiParamsFooRouteRouteWithChildren\n  '/api/params/$foo/$bar': typeof ApiParamsFooBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/methods'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods/'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  id:\n    | '__root__'\n    | '/'\n    | '/methods'\n    | '/merge-middleware-context'\n    | '/api/middleware-context'\n    | '/api/only-any'\n    | '/methods/only-any'\n    | '/methods/'\n    | '/api/params/$foo'\n    | '/api/params/$foo/$bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  MethodsRouteRoute: typeof MethodsRouteRouteWithChildren\n  MergeMiddlewareContextRoute: typeof MergeMiddlewareContextRoute\n  ApiMiddlewareContextRoute: typeof ApiMiddlewareContextRoute\n  ApiOnlyAnyRoute: typeof ApiOnlyAnyRoute\n  ApiParamsFooRouteRoute: typeof ApiParamsFooRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/merge-middleware-context': {\n      id: '/merge-middleware-context'\n      path: '/merge-middleware-context'\n      fullPath: '/merge-middleware-context'\n      preLoaderRoute: typeof MergeMiddlewareContextRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/methods': {\n      id: '/methods'\n      path: '/methods'\n      fullPath: '/methods'\n      preLoaderRoute: typeof MethodsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/methods/': {\n      id: '/methods/'\n      path: '/'\n      fullPath: '/methods/'\n      preLoaderRoute: typeof MethodsIndexRouteImport\n      parentRoute: typeof MethodsRouteRoute\n    }\n    '/methods/only-any': {\n      id: '/methods/only-any'\n      path: '/only-any'\n      fullPath: '/methods/only-any'\n      preLoaderRoute: typeof MethodsOnlyAnyRouteImport\n      parentRoute: typeof MethodsRouteRoute\n    }\n    '/api/only-any': {\n      id: '/api/only-any'\n      path: '/api/only-any'\n      fullPath: '/api/only-any'\n      preLoaderRoute: typeof ApiOnlyAnyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/middleware-context': {\n      id: '/api/middleware-context'\n      path: '/api/middleware-context'\n      fullPath: '/api/middleware-context'\n      preLoaderRoute: typeof ApiMiddlewareContextRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/params/$foo': {\n      id: '/api/params/$foo'\n      path: '/api/params/$foo'\n      fullPath: '/api/params/$foo'\n      preLoaderRoute: typeof ApiParamsFooRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/params/$foo/$bar': {\n      id: '/api/params/$foo/$bar'\n      path: '/$bar'\n      fullPath: '/api/params/$foo/$bar'\n      preLoaderRoute: typeof ApiParamsFooBarRouteImport\n      parentRoute: typeof ApiParamsFooRouteRoute\n    }\n  }\n}\n\ninterface MethodsRouteRouteChildren {\n  MethodsOnlyAnyRoute: typeof MethodsOnlyAnyRoute\n  MethodsIndexRoute: typeof MethodsIndexRoute\n}\n\nconst MethodsRouteRouteChildren: MethodsRouteRouteChildren = {\n  MethodsOnlyAnyRoute: MethodsOnlyAnyRoute,\n  MethodsIndexRoute: MethodsIndexRoute,\n}\n\nconst MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(\n  MethodsRouteRouteChildren,\n)\n\ninterface ApiParamsFooRouteRouteChildren {\n  ApiParamsFooBarRoute: typeof ApiParamsFooBarRoute\n}\n\nconst ApiParamsFooRouteRouteChildren: ApiParamsFooRouteRouteChildren = {\n  ApiParamsFooBarRoute: ApiParamsFooBarRoute,\n}\n\nconst ApiParamsFooRouteRouteWithChildren =\n  ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  MethodsRouteRoute: MethodsRouteRouteWithChildren,\n  MergeMiddlewareContextRoute: MergeMiddlewareContextRoute,\n  ApiMiddlewareContextRoute: ApiMiddlewareContextRoute,\n  ApiOnlyAnyRoute: ApiOnlyAnyRoute,\n  ApiParamsFooRouteRoute: ApiParamsFooRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/vue-router-ssr-query'\nimport { QueryClient } from '@tanstack/vue-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n  setupRouterSsrQueryIntegration({ router, queryClient })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/__root.tsx",
    "content": "import {\n  Body,\n  HeadContent,\n  Html,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\n\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  errorComponent: (props) => {\n    return <p>{props.error.stack}</p>\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <Outlet />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/api/middleware-context.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { createMiddleware } from '@tanstack/vue-start'\n\nconst testParentMiddleware = createMiddleware().server(async ({ next }) => {\n  const result = await next({ context: { testParent: true } })\n  return result\n})\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next }) => {\n    const result = await next({ context: { test: true } })\n    return result\n  })\n\nexport const Route = createFileRoute('/api/middleware-context')({\n  server: {\n    middleware: [testMiddleware],\n    handlers: {\n      GET: ({ request, context }) => {\n        return Response.json({\n          url: request.url,\n          context: context,\n          expectedContext: { testParent: true, test: true },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/api/only-any.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/api/only-any')({\n  server: {\n    handlers: {\n      ANY: ({ request }) => {\n        return Response.json(\n          {\n            handler: 'ANY',\n            method: request.method,\n          },\n          { headers: { 'X-HANDLER': 'ANY', 'X-METHOD': request.method } },\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/api/params/$foo/$bar.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/api/params/$foo/$bar')({\n  server: {\n    handlers: {\n      GET: ({ params }) => {\n        return new Response('hello, ' + params.foo + ' and ' + params.bar)\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/api/params/$foo/route.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/api/params/$foo')({\n  server: {\n    handlers: {\n      GET: ({ params }) => {\n        return new Response('hello, ' + params.foo)\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server routes E2E tests</h1>\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Link to=\"/merge-middleware-context\">\n            server route middleware context is merged correctly\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/methods\">server route methods</Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/merge-middleware-context.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { defineComponent, ref } from 'vue'\n\nconst MergeMiddlewareContext = defineComponent({\n  name: 'MergeMiddlewareContext',\n  setup() {\n    const apiResponse = ref<any>(null)\n\n    const fetchMiddlewareContext = async () => {\n      try {\n        const response = await fetch('/api/middleware-context')\n        const data = await response.json()\n        apiResponse.value = data\n      } catch (error) {\n        console.error('Error fetching middleware context:', error)\n        apiResponse.value = { error: 'Failed to fetch' }\n      }\n    }\n\n    return () => (\n      <div class=\"p-2 m-2 grid gap-2\">\n        <h3>Merge Server Route Middleware Context Test</h3>\n        <div class=\"flex flex-col gap-2\">\n          <button\n            type=\"button\"\n            onClick={fetchMiddlewareContext}\n            data-testid=\"test-middleware-context-btn\"\n            class=\"rounded-md bg-white px-2.5 py-1.5 text-sm font-semibold text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 hover:bg-gray-50\"\n          >\n            Test Middleware Context\n          </button>\n\n          {apiResponse.value ? (\n            <div class=\"mt-4\">\n              <h4>API Response:</h4>\n              <pre\n                data-testid=\"api-response\"\n                class=\"bg-gray-100 p-2 rounded-sm text-black\"\n              >\n                {JSON.stringify(apiResponse.value, null, 2)}\n              </pre>\n\n              <div class=\"mt-4 grid gap-2\">\n                <h4>Context Verification:</h4>\n                <div\n                  data-testid=\"context-result\"\n                  class=\"bg-gray-100 p-2 rounded-sm text-black\"\n                >\n                  {JSON.stringify(apiResponse.value?.context, null, 2)}\n                </div>\n\n                <div\n                  data-testid=\"has-test-parent\"\n                  class=\"p-2 border rounded-sm\"\n                >\n                  Has testParent:{' '}\n                  {apiResponse.value?.context?.testParent ? 'true' : 'false'}\n                </div>\n\n                <div data-testid=\"has-test\" class=\"p-2 border rounded-sm\">\n                  Has test:{' '}\n                  {apiResponse.value?.context?.test ? 'true' : 'false'}\n                </div>\n              </div>\n            </div>\n          ) : null}\n        </div>\n      </div>\n    )\n  },\n})\n\nexport const Route = createFileRoute('/merge-middleware-context')({\n  component: MergeMiddlewareContext,\n})\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/methods/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/methods/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-8\">\n      <ul class=\"list-disc p-4\">\n        <li>\n          <Route.Link to=\"./only-any\">\n            Server Route only has ANY handler\n          </Route.Link>\n        </li>\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/methods/only-any.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { useQuery } from '@tanstack/vue-query'\nimport { defineComponent } from 'vue'\n\nexport const Route = createFileRoute('/methods/only-any')({\n  ssr: false,\n  component: RouteComponent,\n})\n\nconst HttpMethods = [\n  'GET',\n  'POST',\n  'PUT',\n  'DELETE',\n  'PATCH',\n  'OPTIONS',\n  'HEAD',\n] as const\ntype HttpMethods = (typeof HttpMethods)[number]\n\ntype OnlyAnyApiResponse = {\n  method: HttpMethods\n  handler: 'ANY'\n}\n\nconst Test = defineComponent({\n  name: 'OnlyAnyTest',\n  props: {\n    method: {\n      type: String,\n      required: true,\n    },\n  },\n  setup(props) {\n    const query = useQuery(() => ({\n      queryKey: ['only-any', props.method],\n      queryFn: async () => {\n        const method = props.method as HttpMethods\n        const response = await fetch(`/api/only-any`, { method })\n\n        try {\n          return (await response.json()) as OnlyAnyApiResponse\n        } catch {\n          // handle HEAD and OPTIONS that have no body\n          return {\n            handler: (response.headers.get('x-handler') ??\n              'ANY') as OnlyAnyApiResponse['handler'],\n            method: (response.headers.get('x-method') ??\n              method) as OnlyAnyApiResponse['method'],\n          }\n        }\n      },\n    }))\n\n    return () => (\n      <div>\n        <h3>method={props.method}</h3>\n        <h4> expected </h4>\n        <div data-testid={`expected-${props.method}`}>{props.method}</div>\n        <h4> result</h4>\n        {query.data.value ? (\n          <div data-testid={`result-${props.method}`}>\n            {query.data.value.method}\n          </div>\n        ) : null}\n      </div>\n    )\n  },\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 m-2 grid gap-2\" data-testid=\"route-component\">\n      <h3>Server Route has only ANY handler</h3>\n      {HttpMethods.map((method) => (\n        <Test method={method} />\n      ))}\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/routes/methods/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/methods')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-8\">\n      <h1 class=\"font-bold text-lg\">Server Routes Methods E2E tests</h1>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/tests/server-routes.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest('merge-middleware-context', async ({ page }) => {\n  await page.goto('/merge-middleware-context')\n\n  await page.waitForLoadState('networkidle')\n\n  await page.getByTestId('test-middleware-context-btn').click()\n  await page.waitForLoadState('networkidle')\n\n  await expect(page.getByTestId('has-test-parent')).toContainText('true')\n  await expect(page.getByTestId('has-test')).toContainText('true')\n\n  const contextResult = await page.getByTestId('context-result').textContent()\n  expect(contextResult).toContain('testParent')\n  expect(contextResult).toContain('test')\n})\n\ntest.describe('methods', () => {\n  test('only ANY', async ({ page }) => {\n    await page.goto('/methods/only-any')\n\n    // wait for page to be loaded by waiting for the route component to be rendered\n    await expect(page.getByTestId('route-component')).toBeInViewport()\n\n    const testCases = await page\n      .locator('[data-testid^=\"expected-\"]')\n      .elementHandles()\n    expect(testCases.length).not.toBe(0)\n    for (const testCase of testCases) {\n      const testId = await testCase.getAttribute('data-testid')\n\n      if (!testId) {\n        throw new Error('testcase is missing data-testid')\n      }\n\n      const suffix = testId.replace('expected-', '')\n\n      const expected =\n        (await page.getByTestId(`expected-${suffix}`).textContent()) || ''\n      expect(expected).not.toBe('')\n\n      await expect(page.getByTestId(`result-${suffix}`)).toContainText(expected)\n    }\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/server-routes/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/server-routes/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/spa-mode/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-spa-mode\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"npx serve dist/client\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_SERVER_PORT=${PORT} pnpm build && NODE_ENV=production PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts' | '/posts/$postId'\n  id: '__root__' | '/' | '/posts' | '/posts/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  ClientOnly,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n  useRouterState,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'SPA Mode E2E Test',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      root: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return { root: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  shellComponent: RootDocument,\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    return (\n      <div data-testid=\"root-container\">\n        <h2 data-testid=\"root-heading\">root</h2>\n        <div>\n          loader: <b data-testid=\"root-loader\">{loaderData.value.root}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"root-context\">{context.value.root}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>__root Loading...</div>,\n})\n\nfunction RootDocument(_: unknown, { slots }: { slots: any }) {\n  const routerState = useRouterState({\n    select: (state) => ({ isLoading: state.isLoading, status: state.status }),\n  })\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <h1>SPA Mode E2E Test</h1>\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        <ClientOnly>\n          <div>\n            router isLoading:{' '}\n            <b data-testid=\"router-isLoading\">\n              {routerState.value.isLoading ? 'true' : 'false'}\n            </b>\n          </div>\n          <div>\n            router status:{' '}\n            <b data-testid=\"router-status\">{routerState.value.status}</b>\n          </div>\n        </ClientOnly>\n        <hr />\n        {slots.default?.()}\n        <Scripts />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div data-testid=\"home-container\">\n      <h1 data-testid=\"home-heading\">Home</h1>\n      <div>\n        <Link\n          to=\"/posts/$postId\"\n          params={{ postId: '1' }}\n          data-testid=\"link-posts-1\"\n        >\n          Go to /posts/1\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      postId: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return { postId: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    return (\n      <div data-testid=\"postId-container\">\n        <h4 data-testid=\"postId-heading\">postId</h4>\n        <div>\n          loader: <b data-testid=\"postId-loader\">{loaderData.value.postId}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"postId-context\">{context.value.postId}</b>\n        </div>\n      </div>\n    )\n  },\n  pendingComponent: () => <div>$postId Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/src/routes/posts.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts')({\n  beforeLoad: () => {\n    console.log(\n      `beforeLoad for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n    return {\n      posts: typeof window === 'undefined' ? 'server' : 'client',\n    }\n  },\n  loader: () => {\n    console.log(\n      `loader for ${Route.id} called on the ${typeof window !== 'undefined' ? 'client' : 'server'}`,\n    )\n\n    return { posts: typeof window === 'undefined' ? 'server' : 'client' }\n  },\n  component: () => {\n    const loaderData = Route.useLoaderData()\n    const context = Route.useRouteContext()\n    return (\n      <div data-testid=\"posts-container\">\n        <h3 data-testid=\"posts-heading\">posts</h3>\n        <div>\n          loader: <b data-testid=\"posts-loader\">{loaderData.value.posts}</b>\n        </div>\n        <div>\n          context: <b data-testid=\"posts-context\">{context.value.posts}</b>\n        </div>\n        <hr />\n        <Outlet />\n      </div>\n    )\n  },\n  pendingComponent: () => <div>posts Loading...</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/tests/app.spec.ts",
    "content": "import { expect } from '@playwright/test'\nimport { test } from '@tanstack/router-e2e-utils'\nimport type { Page } from '@playwright/test'\n\nasync function runTest(\n  page: Page,\n  expectedData: {\n    loader: {\n      root: 'server' | 'client'\n      posts: 'server' | 'client'\n      postId: 'server' | 'client'\n    }\n    context: {\n      root: 'server' | 'client'\n      posts: 'server' | 'client'\n      postId: 'server' | 'client'\n    }\n  },\n) {\n  // wait for page to be loaded by waiting for the leaf route to be rendered\n  await expect(page.getByTestId('postId-heading')).toContainText('postId')\n\n  // check expectations\n  await Promise.all(\n    Object.entries(expectedData.loader).map(async ([route, expectedLoader]) => {\n      await expect(page.getByTestId(`${route}-loader`)).toContainText(\n        expectedLoader,\n      )\n    }),\n  )\n  await Promise.all(\n    Object.entries(expectedData.context).map(\n      async ([route, expectedContext]) => {\n        await expect(page.getByTestId(`${route}-context`)).toContainText(\n          expectedContext,\n        )\n      },\n    ),\n  )\n  await expect(page.getByTestId('router-isLoading')).toContainText('false')\n  await expect(page.getByTestId('router-status')).toContainText('idle')\n}\ntest.describe('SPA mode', () => {\n  test(`directly visiting prerendered /posts/1`, async ({\n    page,\n  }: {\n    page: Page\n  }) => {\n    await page.goto('/posts/1')\n    await runTest(page, {\n      loader: {\n        root: 'server',\n        posts: 'server',\n        postId: 'server',\n      },\n      context: {\n        root: 'server',\n        posts: 'server',\n        postId: 'server',\n      },\n    })\n  })\n\n  test(`client-side navigation to /posts/1`, async ({\n    page,\n  }: {\n    page: Page\n  }) => {\n    await page.goto('/')\n    const testId = 'link-posts-1'\n    await page.getByTestId(testId).click()\n    await runTest(page, {\n      loader: {\n        root: 'server',\n        posts: 'client',\n        postId: 'client',\n      },\n      context: {\n        root: 'client',\n        posts: 'client',\n        postId: 'client',\n      },\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/spa-mode/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      spa: {\n        enabled: true,\n        prerender: {\n          outputPath: 'index.html',\n          crawlLinks: true,\n        },\n      },\n      pages: [\n        {\n          path: '/posts/1',\n          prerender: { enabled: true, outputPath: '/posts/1/index.html' },\n        },\n      ],\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/virtual-routes/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-virtual-routes\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"@tanstack/virtual-file-routes\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport {\n  getDummyServerPort,\n  getTestServerPort,\n} from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst EXTERNAL_PORT = await getDummyServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  globalSetup: './tests/setup/global.setup.ts',\n  globalTeardown: './tests/setup/global.teardown.ts',\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && VITE_NODE_ENV=\"test\" VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/public/script.js",
    "content": "console.log('SCRIPT_1 loaded')\nwindow.SCRIPT_1 = true\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/public/script2.js",
    "content": "console.log('SCRIPT_2 loaded')\nwindow.SCRIPT_2 = true\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('layout/second-layout.tsx', [\n      route('route-without-file', [\n        route('/layout-a', 'a.tsx'),\n        route('/layout-b', 'b.tsx'),\n      ]),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n  route('/special|pipe', 'pipe.tsx'),\n])\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as pipeRouteImport } from './routes/pipe'\nimport { Route as postsPostsRouteImport } from './routes/posts/posts'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home'\nimport { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route'\nimport { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index'\nimport { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world'\nimport { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst pipeRoute = pipeRouteImport.update({\n  id: '/special|pipe',\n  path: '/special|pipe',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsRoute = postsPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsDetailRoute = postsPostsDetailRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second-layout',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst postsPostsHomeRoute = postsPostsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({\n  id: '/classic/hello',\n  path: '/classic/hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({\n  id: '/world',\n  path: '/world',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({\n  id: '/universe',\n  path: '/universe',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/route-without-file/layout-b',\n  path: '/route-without-file/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/route-without-file/layout-a',\n  path: '/route-without-file/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsRouteWithChildren\n  '/special|pipe': typeof pipeRoute\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/special|pipe': typeof pipeRoute\n  '/posts': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/posts': typeof postsPostsRouteWithChildren\n  '/special|pipe': typeof pipeRoute\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/_first/_second-layout': typeof layoutSecondLayoutRouteWithChildren\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/_first/_second-layout/route-without-file/layout-a': typeof aRoute\n  '/_first/_second-layout/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/special|pipe'\n    | '/classic/hello'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/special|pipe'\n    | '/posts'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/posts'\n    | '/special|pipe'\n    | '/classic/hello'\n    | '/posts/'\n    | '/_first/_second-layout'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/_first/_second-layout/route-without-file/layout-a'\n    | '/_first/_second-layout/route-without-file/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n  postsPostsRoute: typeof postsPostsRouteWithChildren\n  pipeRoute: typeof pipeRoute\n  ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/special|pipe': {\n      id: '/special|pipe'\n      path: '/special|pipe'\n      fullPath: '/special|pipe'\n      preLoaderRoute: typeof pipeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsPostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsPostsDetailRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/_first/_second-layout': {\n      id: '/_first/_second-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsPostsHomeRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/classic/hello': {\n      id: '/classic/hello'\n      path: '/classic/hello'\n      fullPath: '/classic/hello'\n      preLoaderRoute: typeof ClassicHelloRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/classic/hello/': {\n      id: '/classic/hello/'\n      path: '/'\n      fullPath: '/classic/hello/'\n      preLoaderRoute: typeof ClassicHelloIndexRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/world': {\n      id: '/classic/hello/world'\n      path: '/world'\n      fullPath: '/classic/hello/world'\n      preLoaderRoute: typeof ClassicHelloWorldRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/universe': {\n      id: '/classic/hello/universe'\n      path: '/universe'\n      fullPath: '/classic/hello/universe'\n      preLoaderRoute: typeof ClassicHelloUniverseRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-b': {\n      id: '/_first/_second-layout/route-without-file/layout-b'\n      path: '/route-without-file/layout-b'\n      fullPath: '/route-without-file/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-a': {\n      id: '/_first/_second-layout/route-without-file/layout-a'\n      path: '/route-without-file/layout-a'\n      fullPath: '/route-without-file/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\ninterface postsPostsRouteChildren {\n  postsPostsHomeRoute: typeof postsPostsHomeRoute\n  postsPostsDetailRoute: typeof postsPostsDetailRoute\n}\n\nconst postsPostsRouteChildren: postsPostsRouteChildren = {\n  postsPostsHomeRoute: postsPostsHomeRoute,\n  postsPostsDetailRoute: postsPostsDetailRoute,\n}\n\nconst postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(\n  postsPostsRouteChildren,\n)\n\ninterface ClassicHelloRouteRouteChildren {\n  ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute\n  ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute\n  ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute\n}\n\nconst ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {\n  ClassicHelloUniverseRoute: ClassicHelloUniverseRoute,\n  ClassicHelloWorldRoute: ClassicHelloWorldRoute,\n  ClassicHelloIndexRoute: ClassicHelloIndexRoute,\n}\n\nconst ClassicHelloRouteRouteWithChildren =\n  ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n  postsPostsRoute: postsPostsRouteWithChildren,\n  pipeRoute: pipeRoute,\n  ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute(\n  '/_first/_second-layout/route-without-file/layout-a',\n)({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute(\n  '/_first/_second-layout/route-without-file/layout-b',\n)({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/file-based-subtree/hello/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/classic/hello/')({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/classic/hello')({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/classic/hello/universe')({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/file-based-subtree/hello/world.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/classic/hello/world')({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_first')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_first/_second-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-without-file/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/route-without-file/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/pipe.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/special|pipe')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div data-testid=\"special-pipe-route-heading\">Hello \"/special|pipe\"!</div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/posts/posts-detail.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post.value.title}</h4>\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/posts/posts-home.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/posts/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => (\n          <li class=\"whitespace-nowrap\" key={post.id}>\n            <Link\n              to=\"/posts/$postId\"\n              params={{\n                postId: post.id,\n              }}\n              class=\"block py-1 text-blue-600 hover:opacity-75\"\n              activeProps={{ class: 'font-bold underline' }}\n            >\n              <div>{post.title.substring(0, 20)}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/routes/root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  HeadContent,\n  Html,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n  head: () => {\n    return {\n      links: [{ rel: 'stylesheet', href: appCss }],\n    }\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <div class=\"p-2 flex gap-2 text-lg border-b\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/route-without-file/layout-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Layout\n          </Link>{' '}\n          <Link\n            to=\"/classic/hello\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Subtree\n          </Link>{' '}\n          <Link\n            data-testid=\"special-pipe-link\"\n            to=\"/special|pipe\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Pipe\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        <Outlet />\n        {/* Start rendering router matches */}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`${queryURL}/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>(`${queryURL}/posts`)\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nconst PORT = process.env.VITE_SERVER_PORT || 3000\n\nexport const DEPLOY_URL = `http://localhost:${PORT}`\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\ntest.beforeEach(async ({ page }) => {\n  await page.goto('/')\n})\n\ntest('Navigating to a post page', async ({ page }) => {\n  await page.getByRole('link', { name: 'Posts' }).click()\n  await page.getByRole('link', { name: 'sunt aut facere repe' }).click()\n  await expect(page.getByRole('heading')).toContainText('sunt aut facere')\n})\n\ntest('Navigating nested layouts', async ({ page }) => {\n  await page.getByRole('link', { name: 'Layout', exact: true }).click()\n\n  await expect(page.locator('body')).toContainText(\"I'm a layout\")\n  await expect(page.locator('body')).toContainText(\"I'm a nested layout\")\n\n  await page.getByRole('link', { name: 'Layout A' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout A!\")\n\n  await page.getByRole('link', { name: 'Layout B' }).click()\n  await expect(page.locator('body')).toContainText(\"I'm layout B!\")\n})\n\ntest('Navigating to a not-found route', async ({ page }) => {\n  await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()\n  await expect(page.getByRole('paragraph')).toContainText(\n    'This is the notFoundComponent configured on root route',\n  )\n  await page.getByRole('link', { name: 'Start Over' }).click()\n  await expect(page.getByRole('heading')).toContainText('Welcome Home!')\n})\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/tests/setup/global.setup.ts",
    "content": "import { e2eStartDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function setup() {\n  await e2eStartDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/tests/setup/global.teardown.ts",
    "content": "import { e2eStopDummyServer } from '@tanstack/router-e2e-utils'\nimport packageJson from '../../package.json' with { type: 'json' }\n\nexport default async function teardown() {\n  await e2eStopDummyServer(packageJson.name)\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/tests/special-characters.spec.ts",
    "content": "import { expect } from '@playwright/test'\n\nimport { test } from '@tanstack/router-e2e-utils'\n\ntest.use({\n  whitelistErrors: [\n    /Failed to load resource: the server responded with a status of 404/,\n  ],\n})\ntest.describe('Unicode route rendering', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/')\n    await page.waitForURL('/')\n  })\n\n  test.describe('Special characters in route paths', () => {\n    test('should render route with pipe character in path on direct navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      await page.goto('/special|pipe')\n      await page.waitForURL(`${baseURL}/special%7Cpipe`)\n\n      await expect(\n        page.getByTestId('special-pipe-route-heading'),\n      ).toBeInViewport()\n    })\n\n    test('should render route with pipe character in path on router navigation', async ({\n      page,\n      baseURL,\n    }) => {\n      const pipeLink = page.getByTestId('special-pipe-link')\n\n      await pipeLink.click()\n      await page.waitForURL(`${baseURL}/special%7Cpipe`)\n\n      await expect(\n        page.getByTestId('special-pipe-route-heading'),\n      ).toBeInViewport()\n    })\n  })\n})\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true,\n    \"types\": [\"vite/client\"]\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/virtual-routes/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      router: {\n        virtualRouteConfig: './routes.ts',\n      },\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/website/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "e2e/vue-start/website/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "e2e/vue-start/website/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "e2e/vue-start/website/package.json",
    "content": "{\n  \"name\": \"tanstack-vue-start-e2e-website\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"dev:e2e\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"test:e2e\": \"rm -rf port*.txt; playwright test --project=chromium\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"workspace:^\",\n    \"@tanstack/vue-router-devtools\": \"workspace:^\",\n    \"@tanstack/vue-start\": \"workspace:^\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"vite\": \"^8.0.0\",\n    \"vue\": \"^3.5.25\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.50.1\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-e2e-utils\": \"workspace:^\",\n    \"@types/node\": \"^22.10.2\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\"\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/website/playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test'\nimport { getTestServerPort } from '@tanstack/router-e2e-utils'\nimport packageJson from './package.json' with { type: 'json' }\n\nconst PORT = await getTestServerPort(packageJson.name)\nconst baseURL = `http://localhost:${PORT}`\n\n/**\n * See https://playwright.dev/docs/test-configuration.\n */\nexport default defineConfig({\n  testDir: './tests',\n  workers: 1,\n\n  reporter: [['line']],\n\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL,\n  },\n\n  webServer: {\n    command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`,\n    url: baseURL,\n    reuseExistingServer: !process.env.CI,\n    stdout: 'pipe',\n  },\n\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n  ],\n})\n"
  },
  {
    "path": "e2e/vue-start/website/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot.value ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e: MouseEvent) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/vue-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LibraryRouteImport } from './routes/_library'\nimport { Route as LibraryIndexRouteImport } from './routes/_library.index'\nimport { Route as ProjectIndexRouteImport } from './routes/$project.index'\nimport { Route as LibraryProjectRouteImport } from './routes/_library.$project'\nimport { Route as LibraryProjectVersionIndexRouteImport } from './routes/_library.$project.$version.index'\nimport { Route as ProjectVersionDocsIndexRouteImport } from './routes/$project.$version.docs.index'\nimport { Route as ProjectVersionDocsFrameworkFrameworkRouteImport } from './routes/$project.$version.docs.framework.$framework'\nimport { Route as ProjectVersionDocsFrameworkFrameworkIndexRouteImport } from './routes/$project.$version.docs.framework.$framework.index'\nimport { Route as ProjectVersionDocsFrameworkFrameworkSplatRouteImport } from './routes/$project.$version.docs.framework.$framework.$'\nimport { Route as ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport } from './routes/$project.$version.docs.framework.$framework.examples.$'\n\nconst LibraryRoute = LibraryRouteImport.update({\n  id: '/_library',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LibraryIndexRoute = LibraryIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => LibraryRoute,\n} as any)\nconst ProjectIndexRoute = ProjectIndexRouteImport.update({\n  id: '/$project/',\n  path: '/$project/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LibraryProjectRoute = LibraryProjectRouteImport.update({\n  id: '/$project',\n  path: '/$project',\n  getParentRoute: () => LibraryRoute,\n} as any)\nconst LibraryProjectVersionIndexRoute =\n  LibraryProjectVersionIndexRouteImport.update({\n    id: '/$version/',\n    path: '/$version/',\n    getParentRoute: () => LibraryProjectRoute,\n  } as any)\nconst ProjectVersionDocsIndexRoute = ProjectVersionDocsIndexRouteImport.update({\n  id: '/$project/$version/docs/',\n  path: '/$project/$version/docs/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ProjectVersionDocsFrameworkFrameworkRoute =\n  ProjectVersionDocsFrameworkFrameworkRouteImport.update({\n    id: '/$project/$version/docs/framework/$framework',\n    path: '/$project/$version/docs/framework/$framework',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkIndexRoute =\n  ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({\n    id: '/',\n    path: '/',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkSplatRoute =\n  ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({\n    id: '/$',\n    path: '/$',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\nconst ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute =\n  ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({\n    id: '/examples/$',\n    path: '/examples/$',\n    getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof LibraryIndexRoute\n  '/$project': typeof LibraryProjectRouteWithChildren\n  '/$project/': typeof ProjectIndexRoute\n  '/$project/$version/docs/': typeof ProjectVersionDocsIndexRoute\n  '/$project/$version/': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework/': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRoutesByTo {\n  '/$project': typeof ProjectIndexRoute\n  '/': typeof LibraryIndexRoute\n  '/$project/$version/docs': typeof ProjectVersionDocsIndexRoute\n  '/$project/$version': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/_library': typeof LibraryRouteWithChildren\n  '/_library/$project': typeof LibraryProjectRouteWithChildren\n  '/$project/': typeof ProjectIndexRoute\n  '/_library/': typeof LibraryIndexRoute\n  '/$project/$version/docs/': typeof ProjectVersionDocsIndexRoute\n  '/_library/$project/$version/': typeof LibraryProjectVersionIndexRoute\n  '/$project/$version/docs/framework/$framework': typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n  '/$project/$version/docs/framework/$framework/$': typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  '/$project/$version/docs/framework/$framework/': typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  '/$project/$version/docs/framework/$framework/examples/$': typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/$project'\n    | '/$project/'\n    | '/$project/$version/docs/'\n    | '/$project/$version/'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework/'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/$project'\n    | '/'\n    | '/$project/$version/docs'\n    | '/$project/$version'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  id:\n    | '__root__'\n    | '/_library'\n    | '/_library/$project'\n    | '/$project/'\n    | '/_library/'\n    | '/$project/$version/docs/'\n    | '/_library/$project/$version/'\n    | '/$project/$version/docs/framework/$framework'\n    | '/$project/$version/docs/framework/$framework/$'\n    | '/$project/$version/docs/framework/$framework/'\n    | '/$project/$version/docs/framework/$framework/examples/$'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  LibraryRoute: typeof LibraryRouteWithChildren\n  ProjectIndexRoute: typeof ProjectIndexRoute\n  ProjectVersionDocsIndexRoute: typeof ProjectVersionDocsIndexRoute\n  ProjectVersionDocsFrameworkFrameworkRoute: typeof ProjectVersionDocsFrameworkFrameworkRouteWithChildren\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/_library': {\n      id: '/_library'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LibraryRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_library/': {\n      id: '/_library/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof LibraryIndexRouteImport\n      parentRoute: typeof LibraryRoute\n    }\n    '/$project/': {\n      id: '/$project/'\n      path: '/$project'\n      fullPath: '/$project/'\n      preLoaderRoute: typeof ProjectIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_library/$project': {\n      id: '/_library/$project'\n      path: '/$project'\n      fullPath: '/$project'\n      preLoaderRoute: typeof LibraryProjectRouteImport\n      parentRoute: typeof LibraryRoute\n    }\n    '/_library/$project/$version/': {\n      id: '/_library/$project/$version/'\n      path: '/$version'\n      fullPath: '/$project/$version/'\n      preLoaderRoute: typeof LibraryProjectVersionIndexRouteImport\n      parentRoute: typeof LibraryProjectRoute\n    }\n    '/$project/$version/docs/': {\n      id: '/$project/$version/docs/'\n      path: '/$project/$version/docs'\n      fullPath: '/$project/$version/docs/'\n      preLoaderRoute: typeof ProjectVersionDocsIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$project/$version/docs/framework/$framework': {\n      id: '/$project/$version/docs/framework/$framework'\n      path: '/$project/$version/docs/framework/$framework'\n      fullPath: '/$project/$version/docs/framework/$framework'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$project/$version/docs/framework/$framework/': {\n      id: '/$project/$version/docs/framework/$framework/'\n      path: '/'\n      fullPath: '/$project/$version/docs/framework/$framework/'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkIndexRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n    '/$project/$version/docs/framework/$framework/$': {\n      id: '/$project/$version/docs/framework/$framework/$'\n      path: '/$'\n      fullPath: '/$project/$version/docs/framework/$framework/$'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n    '/$project/$version/docs/framework/$framework/examples/$': {\n      id: '/$project/$version/docs/framework/$framework/examples/$'\n      path: '/examples/$'\n      fullPath: '/$project/$version/docs/framework/$framework/examples/$'\n      preLoaderRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport\n      parentRoute: typeof ProjectVersionDocsFrameworkFrameworkRoute\n    }\n  }\n}\n\ninterface LibraryProjectRouteChildren {\n  LibraryProjectVersionIndexRoute: typeof LibraryProjectVersionIndexRoute\n}\n\nconst LibraryProjectRouteChildren: LibraryProjectRouteChildren = {\n  LibraryProjectVersionIndexRoute: LibraryProjectVersionIndexRoute,\n}\n\nconst LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(\n  LibraryProjectRouteChildren,\n)\n\ninterface LibraryRouteChildren {\n  LibraryProjectRoute: typeof LibraryProjectRouteWithChildren\n  LibraryIndexRoute: typeof LibraryIndexRoute\n}\n\nconst LibraryRouteChildren: LibraryRouteChildren = {\n  LibraryProjectRoute: LibraryProjectRouteWithChildren,\n  LibraryIndexRoute: LibraryIndexRoute,\n}\n\nconst LibraryRouteWithChildren =\n  LibraryRoute._addFileChildren(LibraryRouteChildren)\n\ninterface ProjectVersionDocsFrameworkFrameworkRouteChildren {\n  ProjectVersionDocsFrameworkFrameworkSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRoute\n  ProjectVersionDocsFrameworkFrameworkIndexRoute: typeof ProjectVersionDocsFrameworkFrameworkIndexRoute\n  ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute\n}\n\nconst ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren =\n  {\n    ProjectVersionDocsFrameworkFrameworkSplatRoute:\n      ProjectVersionDocsFrameworkFrameworkSplatRoute,\n    ProjectVersionDocsFrameworkFrameworkIndexRoute:\n      ProjectVersionDocsFrameworkFrameworkIndexRoute,\n    ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute:\n      ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,\n  }\n\nconst ProjectVersionDocsFrameworkFrameworkRouteWithChildren =\n  ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(\n    ProjectVersionDocsFrameworkFrameworkRouteChildren,\n  )\n\nconst rootRouteChildren: RootRouteChildren = {\n  LibraryRoute: LibraryRouteWithChildren,\n  ProjectIndexRoute: ProjectIndexRoute,\n  ProjectVersionDocsIndexRoute: ProjectVersionDocsIndexRoute,\n  ProjectVersionDocsFrameworkFrameworkRoute:\n    ProjectVersionDocsFrameworkFrameworkRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/vue-start'\ndeclare module '@tanstack/vue-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    defaultStaleTime: 5000,\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/$project.$version.docs.framework.$framework.$.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\nimport { NotFound } from '~/components/NotFound'\nimport { getDocument } from '~/server/document'\nimport { capitalize, seo } from '~/utils/seo'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/$',\n)({\n  loader: ({ params: { _splat } }) =>\n    getDocument({\n      data: _splat!,\n    }),\n  head: ({ loaderData, params }) => ({\n    meta: seo({\n      title: `${loaderData?.title || 'Project'} | TanStack ${capitalize(params.project)} ${capitalize(params.framework)}`,\n    }),\n  }),\n  errorComponent: PostErrorComponent,\n  component: Page,\n  notFoundComponent: () => {\n    return <NotFound>Document not found</NotFound>\n  },\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction Page() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4\n        data-testid=\"selected-doc-heading\"\n        class=\"text-xl font-bold underline\"\n      >\n        {post.value.title}\n      </h4>\n      <div class=\"text-sm\">{post.value.content}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/$project.$version.docs.framework.$framework.examples.$.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { NotFound } from '~/components/NotFound'\nimport { capitalize, seo } from '~/utils/seo'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/examples/$',\n)({\n  head: ({ params }) => ({\n    meta: seo({\n      title: `${capitalize(params._splat || '')} Example | TanStack ${capitalize(params.project)} ${capitalize(params.framework)}`,\n    }),\n  }),\n  component: Page,\n  notFoundComponent: () => {\n    return <NotFound>Example not found</NotFound>\n  },\n})\n\nfunction Page() {\n  const params = Route.useParams()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4\n        data-testid=\"selected-example-heading\"\n        class=\"text-xl font-bold underline\"\n      >\n        {params.value._splat} example\n      </h4>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/$project.$version.docs.framework.$framework.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework/',\n)({\n  beforeLoad: () => {\n    throw redirect({\n      from: '/$project/$version/docs/framework/$framework/',\n      to: '/$project/$version/docs/framework/$framework/$',\n      params: {\n        _splat: 'overview',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/$project.$version.docs.framework.$framework.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useLocation,\n} from '@tanstack/vue-router'\nimport { getDocumentHeads } from '~/server/document'\nimport { getProject } from '~/server/projects'\n\nexport const Route = createFileRoute(\n  '/$project/$version/docs/framework/$framework',\n)({\n  loader: async ({ params: { project } }) => {\n    const library = await getProject({ data: project })\n    const documents = await getDocumentHeads()\n    return {\n      library,\n      documents,\n    }\n  },\n  component: Page,\n})\n\nfunction Page() {\n  const project = Route.useLoaderData({ select: (s) => s.library })\n  const documents = Route.useLoaderData({ select: (s) => s.documents })\n  const pathname = useLocation({ select: (s) => s.pathname })\n\n  return (\n    <div class=\"grid lg:grid-cols-5 lg:divide-x min-h-dvh\">\n      <aside>\n        <div class=\"p-4\">\n          <Link\n            to=\"/\"\n            activeOptions={{ exact: true }}\n            class=\"aria-[current='page']:underline\"\n          >\n            Home\n          </Link>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Version</p>\n          <ul>\n            {project.value.versions.map((version) => (\n              <li key={version}>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ version }}\n                  class=\"aria-[current='page']:underline\"\n                  activeOptions={{ exact: false }}\n                >\n                  {version}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Framework</p>\n          <ul>\n            {project.value.frameworks.map((framework) => (\n              <li key={framework}>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ framework }}\n                  class=\"aria-[current='page']:underline\"\n                  activeOptions={{ exact: false }}\n                >\n                  {framework}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Content</p>\n          <ul>\n            {documents.value.map((doc) => (\n              <li key={doc.id}>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/$\"\n                  params={{ _splat: doc.id }}\n                  class=\"aria-[current='page']:underline\"\n                >\n                  {doc.title}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Examples</p>\n          <ul>\n            {project.value.examples.map((example) => (\n              <li key={example}>\n                <Link\n                  from=\"/$project/$version/docs/framework/$framework\"\n                  to=\"/$project/$version/docs/framework/$framework/examples/$\"\n                  params={{ _splat: example }}\n                  class=\"aria-[current='page']:underline\"\n                >\n                  {example}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </aside>\n      <main class=\"lg:col-span-4 p-4\">\n        <p\n          class=\"text-sm lg:text-base pb-4 border-b break-all\"\n          data-testid=\"selected-route-label\"\n        >\n          {pathname.value}\n        </p>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/$project.$version.docs.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/$project/$version/docs/')({\n  beforeLoad: () => {\n    throw redirect({\n      from: '/$project/$version/docs/',\n      to: '/$project/$version/docs/framework/$framework/$',\n      params: {\n        framework: 'vue',\n        _splat: 'overview',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/$project.index.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/$project/')({\n  loader: ({ params }) => {\n    throw redirect({\n      to: '/$project/$version',\n      params: {\n        project: params.project,\n        version: 'latest',\n      },\n    })\n  },\n})\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  Body,\n  HeadContent,\n  Html,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title: 'TanStack Website',\n        description: `TanStack projects are type-safe!!!`,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return <p>{props.error.stack}</p>\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <Html>\n      <head>\n        <HeadContent />\n      </head>\n      <Body>\n        <Outlet />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </Body>\n    </Html>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/_library.$project.$version.index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_library/$project/$version/')({\n  component: Page,\n})\n\nfunction Page() {\n  const params = Route.useParams()\n\n  return (\n    <div>\n      <h1 class=\"text-2xl mb-2\" data-testid=\"landing-page-heading\">\n        {params.value.project} landing page\n      </h1>\n      <p data-testid=\"landing-page-version\">version: {params.value.version}</p>\n      <p>\n        <Link aria-label=\"Documentation\" from=\"/$project/$version/\" to=\"./docs\">\n          Get started with our documentation.\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/_library.$project.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { getProject } from '~/server/projects'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createFileRoute('/_library/$project')({\n  loader: ({ params: { project } }) => getProject({ data: project }),\n  head: ({ loaderData }) => ({\n    meta: seo({ title: `TanStack ${loaderData?.name || 'Project'}` }),\n  }),\n  component: () => (\n    <div class=\"p-2\">\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/_library.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nexport const Route = createFileRoute('/_library/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3 class=\"text-2xl mb-2\">Website Landing Page</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/routes/_library.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  useLocation,\n} from '@tanstack/vue-router'\nimport { getProjects } from '~/server/projects'\n\nexport const Route = createFileRoute('/_library')({\n  loader: async () => {\n    const projects = await getProjects()\n    return {\n      libraries: projects,\n    }\n  },\n  component: Layout,\n})\n\nfunction Layout() {\n  const loaderData = Route.useLoaderData()\n  const pathname = useLocation({ select: (s) => s.pathname })\n  return (\n    <div class=\"grid lg:grid-cols-5 lg:divide-x min-h-dvh\">\n      <aside>\n        <div class=\"p-4\">\n          <Link\n            to=\"/\"\n            activeOptions={{ exact: true }}\n            class=\"aria-[current='page']:underline\"\n          >\n            Home\n          </Link>\n        </div>\n        <div class=\"p-4\">\n          <p class=\"mb-1 border-b\">Libraries</p>\n          <ul>\n            {loaderData.value.libraries.map((library) => (\n              <li key={library}>\n                <Link\n                  to=\"/$project\"\n                  params={{ project: library }}\n                  class=\"aria-[current='page']:underline\"\n                >\n                  {library}\n                </Link>\n              </li>\n            ))}\n          </ul>\n        </div>\n      </aside>\n      <main class=\"lg:col-span-4 p-4\">\n        <p\n          class=\"text-sm lg:text-base pb-4 border-b break-all\"\n          data-testid=\"selected-route-label\"\n        >\n          {pathname.value}\n        </p>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/server/document.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport { createServerFn } from '@tanstack/vue-start'\n\nconst documents: Array<{ id: string; title: string; content: string }> = [\n  {\n    id: 'overview',\n    title: 'Overview',\n    content: 'This is the content of the overview document',\n  },\n  {\n    id: 'getting-started',\n    title: 'Getting Started',\n    content: 'To get started, you need to do the following...',\n  },\n  {\n    id: 'installation',\n    title: 'Installation',\n    content: 'To install this package, run the following command...',\n  },\n  {\n    id: 'ref/useQueryFunction',\n    title: 'useQuery Reference',\n    content: 'The useQuery function is used to...',\n  },\n  {\n    id: 'ref/useMutationFunction',\n    title: 'useMutation Reference',\n    content: 'The useMutation function is used to...',\n  },\n]\n\nexport const getDocumentHeads = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    return documents.map(({ id, title }) => ({\n      id,\n      title,\n    }))\n  },\n)\n\nexport const getDocument = createServerFn({ method: 'GET' })\n  .inputValidator((id: string) => id)\n  .handler(async ({ data: id }) => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    const document = documents.find((doc) => doc.id === id)\n\n    if (!document) {\n      throw notFound()\n    }\n\n    return document\n  })\n"
  },
  {
    "path": "e2e/vue-start/website/src/server/projects.tsx",
    "content": "import { createServerFn } from '@tanstack/vue-start'\nimport { notFound } from '@tanstack/vue-router'\nimport { capitalize } from '~/utils/seo'\n\nconst projects = ['router', 'table', 'query', 'form', 'ranger']\n\nexport const getProjects = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    return projects\n  },\n)\n\nexport const getProject = createServerFn({ method: 'GET' })\n  .inputValidator((project: string) => project)\n  .handler(async (ctx) => {\n    await new Promise((resolve) => setTimeout(resolve, 200))\n\n    const selectedProject = projects.find((p) => p === ctx.data.toLowerCase())\n\n    if (!selectedProject) {\n      throw notFound()\n    }\n\n    return {\n      id: selectedProject,\n      name: capitalize(selectedProject),\n      versions: ['latest', 'v2', 'v1'],\n      frameworks: ['solid', 'react', 'vue', 'solidjs', 'svelte'],\n      examples: ['basic', 'kitchen-sink'],\n    }\n  })\n"
  },
  {
    "path": "e2e/vue-start/website/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/website/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n\nexport const capitalize = (str: string) =>\n  str.charAt(0).toUpperCase() + str.slice(1)\n"
  },
  {
    "path": "e2e/vue-start/website/src/vite-env.d.ts",
    "content": "declare module '*?url' {\n  const url: string\n  export default url\n}\n"
  },
  {
    "path": "e2e/vue-start/website/tests/app.spec.ts",
    "content": "import { expect, test } from '@playwright/test'\n\nconst routeTestId = 'selected-route-label'\n\ntest('resolves to the latest version on load of a project like \"/router\"', async ({\n  page,\n}) => {\n  await page.goto('/router')\n\n  await expect(page.getByTestId(routeTestId)).toContainText('/router/latest')\n})\n\ntest('resolves to the overview docs page', async ({ page }) => {\n  await page.goto('/router/latest/docs')\n\n  await expect(page.getByTestId(routeTestId)).toContainText(\n    '/router/latest/docs/framework/vue/overview',\n  )\n})\n\ntest('clicking on Documentation link navigates to the overview docs page', async ({\n  page,\n}) => {\n  await page.goto('/router')\n  await page.waitForLoadState('networkidle')\n\n  const documentationLink = page.getByLabel('Documentation')\n  await documentationLink.click()\n  await page.waitForLoadState('networkidle')\n\n  const pathname = new URL(page.url()).pathname\n  expect(pathname).toBe('/router/latest/docs/framework/vue/overview')\n})\n"
  },
  {
    "path": "e2e/vue-start/website/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "e2e/vue-start/website/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/vue-start/plugin/vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  resolve: { tsconfigPaths: true },\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "eslint.config.js",
    "content": "// @ts-check\n\nimport { tanstackConfig } from '@tanstack/eslint-config'\n\nimport unusedImports from 'eslint-plugin-unused-imports'\n\n/** @type {import('eslint').Linter.Config[]} */\nexport default [\n  ...tanstackConfig,\n  {\n    name: 'tanstack/temp',\n    rules: {\n      '@typescript-eslint/no-unsafe-function-type': 'off',\n      'no-shadow': 'off',\n    },\n  },\n  {\n    plugins: {\n      'unused-imports': unusedImports,\n    },\n    rules: {\n      '@typescript-eslint/no-unused-vars': 'off',\n      'unused-imports/no-unused-imports': 'error',\n      'unused-imports/no-unused-vars': [\n        'warn',\n        {\n          vars: 'all',\n          varsIgnorePattern: '^_',\n          args: 'after-used',\n          argsIgnorePattern: '^_',\n        },\n      ],\n    },\n  },\n]\n"
  },
  {
    "path": "examples/react/authenticated-routes/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/authenticated-routes/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/README.md",
    "content": "# TanStack Router - Authenticated Routes Example\n\nAn example demonstrating authentication and protected routes.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/authenticated-routes authenticated-routes\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Authentication flow\n- Protected routes\n- Route guards\n- Login/logout functionality\n- Redirect after authentication\n- Public vs private routes\n"
  },
  {
    "path": "examples/react/authenticated-routes/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/authenticated-routes/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-authenticated-routes\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/auth.tsx",
    "content": "import * as React from 'react'\n\nimport { sleep } from './utils'\n\nexport interface AuthContext {\n  isAuthenticated: boolean\n  login: (username: string) => Promise<void>\n  logout: () => Promise<void>\n  user: string | null\n}\n\nconst AuthContext = React.createContext<AuthContext | null>(null)\n\nconst key = 'tanstack.auth.user'\n\nfunction getStoredUser() {\n  return localStorage.getItem(key)\n}\n\nfunction setStoredUser(user: string | null) {\n  if (user) {\n    localStorage.setItem(key, user)\n  } else {\n    localStorage.removeItem(key)\n  }\n}\n\nexport function AuthProvider({ children }: { children: React.ReactNode }) {\n  const [user, setUser] = React.useState<string | null>(getStoredUser())\n  const isAuthenticated = !!user\n\n  const logout = React.useCallback(async () => {\n    await sleep(250)\n\n    setStoredUser(null)\n    setUser(null)\n  }, [])\n\n  const login = React.useCallback(async (username: string) => {\n    await sleep(500)\n\n    setStoredUser(username)\n    setUser(username)\n  }, [])\n\n  React.useEffect(() => {\n    setUser(getStoredUser())\n  }, [])\n\n  return (\n    <AuthContext.Provider value={{ isAuthenticated, user, login, logout }}>\n      {children}\n    </AuthContext.Provider>\n  )\n}\n\nexport function useAuth() {\n  const context = React.useContext(AuthContext)\n  if (!context) {\n    throw new Error('useAuth must be used within an AuthProvider')\n  }\n  return context\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\nimport { AuthProvider, useAuth } from './auth'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  context: {\n    auth: undefined!, // This will be set after we wrap the app in an AuthProvider\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction InnerApp() {\n  const auth = useAuth()\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthProvider>\n      <InnerApp />\n    </AuthProvider>\n  )\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nasync function loaderDelayFn<T>(fn: (...args: Array<any>) => Promise<T> | T) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\ntype Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nlet invoices: Array<Invoice> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthRouteImport } from './routes/_auth'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthInvoicesRouteImport } from './routes/_auth.invoices'\nimport { Route as AuthDashboardRouteImport } from './routes/_auth.dashboard'\nimport { Route as AuthInvoicesIndexRouteImport } from './routes/_auth.invoices.index'\nimport { Route as AuthInvoicesInvoiceIdRouteImport } from './routes/_auth.invoices.$invoiceId'\n\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthRoute = AuthRouteImport.update({\n  id: '/_auth',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthInvoicesRoute = AuthInvoicesRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst AuthDashboardRoute = AuthDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst AuthInvoicesIndexRoute = AuthInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthInvoicesRoute,\n} as any)\nconst AuthInvoicesInvoiceIdRoute = AuthInvoicesInvoiceIdRouteImport.update({\n  id: '/$invoiceId',\n  path: '/$invoiceId',\n  getParentRoute: () => AuthInvoicesRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/dashboard': typeof AuthDashboardRoute\n  '/invoices': typeof AuthInvoicesRouteWithChildren\n  '/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/invoices/': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/dashboard': typeof AuthDashboardRoute\n  '/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/invoices': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_auth': typeof AuthRouteWithChildren\n  '/login': typeof LoginRoute\n  '/_auth/dashboard': typeof AuthDashboardRoute\n  '/_auth/invoices': typeof AuthInvoicesRouteWithChildren\n  '/_auth/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/_auth/invoices/': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/dashboard'\n    | '/invoices'\n    | '/invoices/$invoiceId'\n    | '/invoices/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/dashboard' | '/invoices/$invoiceId' | '/invoices'\n  id:\n    | '__root__'\n    | '/'\n    | '/_auth'\n    | '/login'\n    | '/_auth/dashboard'\n    | '/_auth/invoices'\n    | '/_auth/invoices/$invoiceId'\n    | '/_auth/invoices/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthRoute: typeof AuthRouteWithChildren\n  LoginRoute: typeof LoginRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth/invoices': {\n      id: '/_auth/invoices'\n      path: '/invoices'\n      fullPath: '/invoices'\n      preLoaderRoute: typeof AuthInvoicesRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/_auth/dashboard': {\n      id: '/_auth/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof AuthDashboardRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/_auth/invoices/': {\n      id: '/_auth/invoices/'\n      path: '/'\n      fullPath: '/invoices/'\n      preLoaderRoute: typeof AuthInvoicesIndexRouteImport\n      parentRoute: typeof AuthInvoicesRoute\n    }\n    '/_auth/invoices/$invoiceId': {\n      id: '/_auth/invoices/$invoiceId'\n      path: '/$invoiceId'\n      fullPath: '/invoices/$invoiceId'\n      preLoaderRoute: typeof AuthInvoicesInvoiceIdRouteImport\n      parentRoute: typeof AuthInvoicesRoute\n    }\n  }\n}\n\ninterface AuthInvoicesRouteChildren {\n  AuthInvoicesInvoiceIdRoute: typeof AuthInvoicesInvoiceIdRoute\n  AuthInvoicesIndexRoute: typeof AuthInvoicesIndexRoute\n}\n\nconst AuthInvoicesRouteChildren: AuthInvoicesRouteChildren = {\n  AuthInvoicesInvoiceIdRoute: AuthInvoicesInvoiceIdRoute,\n  AuthInvoicesIndexRoute: AuthInvoicesIndexRoute,\n}\n\nconst AuthInvoicesRouteWithChildren = AuthInvoicesRoute._addFileChildren(\n  AuthInvoicesRouteChildren,\n)\n\ninterface AuthRouteChildren {\n  AuthDashboardRoute: typeof AuthDashboardRoute\n  AuthInvoicesRoute: typeof AuthInvoicesRouteWithChildren\n}\n\nconst AuthRouteChildren: AuthRouteChildren = {\n  AuthDashboardRoute: AuthDashboardRoute,\n  AuthInvoicesRoute: AuthInvoicesRouteWithChildren,\n}\n\nconst AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthRoute: AuthRouteWithChildren,\n  LoginRoute: LoginRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routes/__root.tsx",
    "content": "import { Outlet, createRootRouteWithContext } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nimport type { AuthContext } from '../auth'\n\ninterface MyRouterContext {\n  auth: AuthContext\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => (\n    <>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" initialIsOpen={false} />\n    </>\n  ),\n})\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routes/_auth.dashboard.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport { useAuth } from '../auth'\n\nexport const Route = createFileRoute('/_auth/dashboard')({\n  component: DashboardPage,\n})\n\nfunction DashboardPage() {\n  const auth = useAuth()\n\n  return (\n    <section className=\"grid gap-2 p-2\">\n      <p>Hi {auth.user}!</p>\n      <p>You are currently on the dashboard route.</p>\n    </section>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routes/_auth.invoices.$invoiceId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { fetchInvoiceById } from '../posts'\n\nexport const Route = createFileRoute('/_auth/invoices/$invoiceId')({\n  loader: async ({ params: { invoiceId } }) => {\n    return {\n      invoice: await fetchInvoiceById(parseInt(invoiceId)),\n    }\n  },\n  component: InvoicePage,\n})\n\nfunction InvoicePage() {\n  const { invoice } = Route.useLoaderData()\n\n  return (\n    <section className=\"grid gap-2\">\n      <h2 className=\"text-lg\">\n        <strong>Invoice No.</strong> #{invoice.id.toString().padStart(2, '0')}\n      </h2>\n      <p>\n        <strong>Invoice title:</strong> {invoice.title}\n      </p>\n      <p>\n        <strong>Invoice body:</strong> {invoice.body}\n      </p>\n    </section>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routes/_auth.invoices.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_auth/invoices/')({\n  component: () => <div>Select an invoice to view it!</div>,\n})\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routes/_auth.invoices.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nimport { fetchInvoices } from '../posts'\n\nexport const Route = createFileRoute('/_auth/invoices')({\n  loader: async () => ({\n    invoices: await fetchInvoices(),\n  }),\n  component: InvoicesRoute,\n})\n\nfunction InvoicesRoute() {\n  const { invoices } = Route.useLoaderData()\n\n  return (\n    <div className=\"grid grid-cols-3 md:grid-cols-5 min-h-[500px]\">\n      <div className=\"col-span-1 py-2 pl-2 pr-4 md:border-r\">\n        <p className=\"mb-2\">Choose an invoice from the list below.</p>\n        <ol className=\"grid gap-2\">\n          {invoices.map((invoice) => (\n            <li key={invoice.id}>\n              <Link\n                to=\"/invoices/$invoiceId\"\n                params={{ invoiceId: invoice.id.toString() }}\n                className=\"text-blue-600 hover:opacity-75\"\n                activeProps={{ className: 'font-bold underline' }}\n              >\n                <span className=\"tabular-nums\">\n                  #{invoice.id.toString().padStart(2, '0')}\n                </span>{' '}\n                - {invoice.title.slice(0, 16)}...\n              </Link>\n            </li>\n          ))}\n        </ol>\n      </div>\n      <div className=\"col-span-2 md:col-span-4 py-2 px-4\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routes/_auth.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet, redirect, useRouter } from '@tanstack/react-router'\n\nimport { useAuth } from '../auth'\n\nexport const Route = createFileRoute('/_auth')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({\n        to: '/login',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n  },\n  component: AuthLayout,\n})\n\nfunction AuthLayout() {\n  const router = useRouter()\n  const navigate = Route.useNavigate()\n  const auth = useAuth()\n\n  const handleLogout = () => {\n    if (window.confirm('Are you sure you want to logout?')) {\n      auth.logout().then(() => {\n        router.invalidate().finally(() => {\n          navigate({ to: '/' })\n        })\n      })\n    }\n  }\n\n  return (\n    <div className=\"p-2 h-full\">\n      <h1>Authenticated Route</h1>\n      <p>This route's content is only visible to authenticated users.</p>\n      <ul className=\"py-2 flex gap-2\">\n        <li>\n          <Link\n            to=\"/dashboard\"\n            className=\"hover:underline data-[status='active']:font-semibold\"\n          >\n            Dashboard\n          </Link>\n        </li>\n        <li>\n          <Link\n            to=\"/invoices\"\n            className=\"hover:underline data-[status='active']:font-semibold\"\n          >\n            Invoices\n          </Link>\n        </li>\n        <li>\n          <button\n            type=\"button\"\n            className=\"hover:underline\"\n            onClick={handleLogout}\n          >\n            Logout\n          </button>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-2 grid gap-2\">\n      <h1 className=\"text-xl\">Welcome!</h1>\n      <p className=\"py-4 px-2 italic bg-slate-100 dark:bg-slate-800\">\n        <strong className=\"text-red-500\">IMPORTANT!!!</strong> This is just an\n        example of how to use authenticated routes with TanStack Router.\n        <br />\n        This is NOT an example how you'd write a production-level authentication\n        system.\n        <br />\n        You'll need to take the concepts and patterns used in this example and\n        adapt then to work with your authentication flow/system for your app.\n      </p>\n      <p>\n        You are currently on the index route of the{' '}\n        <strong>authenticated-routes</strong> example.\n      </p>\n      <p>You can try going through these options.</p>\n      <ol className=\"list-disc list-inside px-2\">\n        <li>\n          <Link to=\"/login\" className=\"text-blue-500 hover:opacity-75\">\n            Go to the public login page.\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/dashboard\" className=\"text-blue-500 hover:opacity-75\">\n            Go to the auth-only dashboard page.\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/invoices\" className=\"text-blue-500 hover:opacity-75\">\n            Go to the auth-only invoices page.\n          </Link>\n        </li>\n      </ol>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { redirect, useRouter, useRouterState } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nimport { useAuth } from '../auth'\nimport { sleep } from '../utils'\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst fallback = '/dashboard' as const\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: z.object({\n    redirect: z.string().optional().catch(''),\n  }),\n  beforeLoad: ({ context, search }) => {\n    if (context.auth.isAuthenticated) {\n      throw redirect({ to: search.redirect || fallback })\n    }\n  },\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const auth = useAuth()\n  const router = useRouter()\n  const isLoading = useRouterState({ select: (s) => s.isLoading })\n  const navigate = Route.useNavigate()\n  const [isSubmitting, setIsSubmitting] = React.useState(false)\n\n  const search = Route.useSearch()\n\n  const onFormSubmit = async (evt: React.FormEvent<HTMLFormElement>) => {\n    setIsSubmitting(true)\n    try {\n      evt.preventDefault()\n      const data = new FormData(evt.currentTarget)\n      const fieldValue = data.get('username')\n\n      if (!fieldValue) return\n      const username = fieldValue.toString()\n      await auth.login(username)\n\n      await router.invalidate()\n\n      // This is just a hack being used to wait for the auth state to update\n      // in a real app, you'd want to use a more robust solution\n      await sleep(1)\n\n      await navigate({ to: search.redirect || fallback })\n    } catch (error) {\n      console.error('Error logging in: ', error)\n    } finally {\n      setIsSubmitting(false)\n    }\n  }\n\n  const isLoggingIn = isLoading || isSubmitting\n\n  return (\n    <div className=\"p-2 grid gap-2 place-items-center\">\n      <h3 className=\"text-xl\">Login page</h3>\n      {search.redirect ? (\n        <p className=\"text-red-500\">You need to login to access this page.</p>\n      ) : (\n        <p>Login to see all the cool content in here.</p>\n      )}\n      <form className=\"mt-4 max-w-lg\" onSubmit={onFormSubmit}>\n        <fieldset disabled={isLoggingIn} className=\"w-full grid gap-2\">\n          <div className=\"grid gap-2 items-center min-w-[300px]\">\n            <label htmlFor=\"username-input\" className=\"text-sm font-medium\">\n              Username\n            </label>\n            <input\n              id=\"username-input\"\n              name=\"username\"\n              placeholder=\"Enter your name\"\n              type=\"text\"\n              className=\"border rounded-md p-2 w-full\"\n              required\n            />\n          </div>\n          <button\n            type=\"submit\"\n            className=\"bg-blue-500 text-white py-2 px-4 rounded-md w-full disabled:bg-gray-300 disabled:text-gray-500\"\n          >\n            {isLoggingIn ? 'Loading...' : 'Login'}\n          </button>\n        </fieldset>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/src/utils.ts",
    "content": "export async function sleep(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"useDefineForClassFields\": true,\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"Bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": true,\n    \"noEmit\": true,\n    \"jsx\": \"react-jsx\",\n\n    /* Linting */\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/.env.example",
    "content": "# Firebase Configuration: Copy this file to `.env.local` and add your Firebase credentials\n# Obtain these values from your Firebase Console (see README.md for detailed setup instructions)\nVITE_PUBLIC_FIREBASE_API_KEY=\nVITE_PUBLIC_FIREBASE_AUTH_DOMAIN=\nVITE_PUBLIC_FIREBASE_PROJECT_ID=\nVITE_PUBLIC_FIREBASE_STORAGE_BUCKET=\nVITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=\nVITE_PUBLIC_FIREBASE_APP_ID=\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n.env.*\n!.env.example\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/README.md",
    "content": "# TanStack Router - Authenticated Routes with Firebase Example\n\nAn example demonstrating authentication with Firebase and protected routes.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Firebase Documentation](https://firebase.google.com/docs)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/authenticated-routes-firebase authenticated-routes-firebase\n```\n\n## Firebase Setup\n\n1. Create a [Firebase project](https://console.firebase.google.com/)\n   1. By default, firebase will configure an accepted domain for localhost...update if necessary!\n2. Enable Authentication in the Firebase console\n3. Add GitHub as an authentication provider:\n   - Go to **Authentication** > **Sign-in method** > **GitHub**\n   - Enable GitHub authentication\n   - You'll need to set up OAuth in your GitHub account:\n     - Go to [GitHub Developer Settings](https://github.com/settings/developers)\n     - Create a new OAuth app\n     - Set the homepage URL to your local or production URL\n     - Set the callback URL to: `https://your-firebase-project-id.firebaseapp.com/__/auth/handler`\n     - Copy the Client ID and Client Secret\n   - Return to Firebase console and paste the GitHub Client ID and Client Secret\n   - Save the changes\n\n4. Create a web app in your Firebase project:\n   - Go to **Project Overview** > **Add app** > **Web**\n   - Register the app with a nickname\n   - Copy the Firebase configuration object for later use\n\n## Setup .env.local\n\nCopy the .env.example provided and configure with your firebase credentials:\n\n```\nVITE_FIREBASE_API_KEY=\nVITE_FIREBASE_AUTH_DOMAIN=\nVITE_FIREBASE_PROJECT_ID=\nVITE_FIREBASE_STORAGE_BUCKET=\nVITE_FIREBASE_MESSAGING_SENDER_ID=\nVITE_FIREBASE_APP_ID=\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Firebase authentication integration\n- Protected routes with Firebase Auth\n- Route guards\n- Login/logout with Firebase\n- User session management\n- Public vs private routes\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-authenticated-routes-firebase\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"firebase\": \"^11.4.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"simple-icons\": \"^14.9.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/auth.tsx",
    "content": "import * as React from 'react'\n\nimport {\n  onAuthStateChanged,\n  type User,\n  type AuthProvider,\n  signInWithPopup,\n  signOut,\n} from 'firebase/auth'\nimport { flushSync } from 'react-dom'\nimport { auth } from './firebase/config'\n\nexport type AuthContextType = {\n  isAuthenticated: boolean\n  isInitialLoading: boolean\n  login: (provider: AuthProvider) => Promise<void>\n  logout: () => Promise<void>\n  user: User | null\n}\n\nconst AuthContext = React.createContext<AuthContextType | null>(null)\n\nexport function AuthContextProvider({\n  children,\n}: {\n  children: React.ReactNode\n}) {\n  const [user, setUser] = React.useState<User | null>(auth.currentUser)\n  const [isInitialLoading, setIsInitialLoading] = React.useState(true)\n  const isAuthenticated = !!user\n\n  React.useEffect(() => {\n    const unsubscribe = onAuthStateChanged(auth, (user) => {\n      flushSync(() => {\n        setUser(user)\n        setIsInitialLoading(false)\n      })\n    })\n    return () => unsubscribe()\n  }, [])\n\n  const logout = React.useCallback(async () => {\n    console.log('Logging out...')\n    await signOut(auth)\n    setUser(null)\n    setIsInitialLoading(false)\n  }, [])\n\n  const login = React.useCallback(async (provider: AuthProvider) => {\n    const result = await signInWithPopup(auth, provider)\n    flushSync(() => {\n      setUser(result.user)\n      setIsInitialLoading(false)\n    })\n  }, [])\n\n  return (\n    <AuthContext.Provider\n      value={{ isInitialLoading, isAuthenticated, user, login, logout }}\n    >\n      {children}\n    </AuthContext.Provider>\n  )\n}\n\nexport function useAuth() {\n  const context = React.useContext(AuthContext)\n  if (!context) {\n    throw new Error('useAuth must be used within an AuthProvider')\n  }\n  return context\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/firebase/config.ts",
    "content": "// Import the functions you need from the SDKs you need\nimport { initializeApp } from 'firebase/app'\nimport { getAuth } from 'firebase/auth'\n// TODO: Add SDKs for Firebase products that you want to use\n// https://firebase.google.com/docs/web/setup#available-libraries\n\n// Your web app's Firebase configuration\nconst firebaseConfig = {\n  apiKey: import.meta.env.VITE_PUBLIC_FIREBASE_API_KEY,\n  authDomain: import.meta.env.VITE_PUBLIC_FIREBASE_AUTH_DOMAIN,\n  projectId: import.meta.env.VITE_PUBLIC_FIREBASE_PROJECT_ID,\n  storageBucket: import.meta.env.VITE_PUBLIC_FIREBASE_STORAGE_BUCKET,\n  messagingSenderId: import.meta.env.VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,\n  appId: import.meta.env.VITE_PUBLIC_FIREBASE_APP_ID,\n}\n\n// Initialize Firebase\nconst app = initializeApp(firebaseConfig)\nexport const auth = getAuth(app)\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\nimport { AuthContextProvider, useAuth } from './auth'\n\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  context: {\n    auth: undefined!, // This will be set after we wrap the app in AuthContextProvider\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction InnerApp() {\n  const auth = useAuth()\n\n  // If the provider is initially loading, do not render the router\n  if (auth.isInitialLoading) {\n    return (\n      <div className=\"flex h-screen w-full items-center justify-center p-4\">\n        <div className=\"size-10 rounded-full border-4 border-gray-200 border-t-foreground animate-spin\" />\n      </div>\n    )\n  }\n\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthContextProvider>\n      <InnerApp />\n    </AuthContextProvider>\n  )\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nasync function loaderDelayFn<T>(fn: (...args: Array<any>) => Promise<T> | T) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\ntype Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nlet invoices: Array<Invoice> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthRouteImport } from './routes/_auth'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthInvoicesRouteImport } from './routes/_auth.invoices'\nimport { Route as AuthDashboardRouteImport } from './routes/_auth.dashboard'\nimport { Route as AuthInvoicesIndexRouteImport } from './routes/_auth.invoices.index'\nimport { Route as AuthInvoicesInvoiceIdRouteImport } from './routes/_auth.invoices.$invoiceId'\n\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthRoute = AuthRouteImport.update({\n  id: '/_auth',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthInvoicesRoute = AuthInvoicesRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst AuthDashboardRoute = AuthDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst AuthInvoicesIndexRoute = AuthInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthInvoicesRoute,\n} as any)\nconst AuthInvoicesInvoiceIdRoute = AuthInvoicesInvoiceIdRouteImport.update({\n  id: '/$invoiceId',\n  path: '/$invoiceId',\n  getParentRoute: () => AuthInvoicesRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/dashboard': typeof AuthDashboardRoute\n  '/invoices': typeof AuthInvoicesRouteWithChildren\n  '/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/invoices/': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/dashboard': typeof AuthDashboardRoute\n  '/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/invoices': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_auth': typeof AuthRouteWithChildren\n  '/login': typeof LoginRoute\n  '/_auth/dashboard': typeof AuthDashboardRoute\n  '/_auth/invoices': typeof AuthInvoicesRouteWithChildren\n  '/_auth/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/_auth/invoices/': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/dashboard'\n    | '/invoices'\n    | '/invoices/$invoiceId'\n    | '/invoices/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/dashboard' | '/invoices/$invoiceId' | '/invoices'\n  id:\n    | '__root__'\n    | '/'\n    | '/_auth'\n    | '/login'\n    | '/_auth/dashboard'\n    | '/_auth/invoices'\n    | '/_auth/invoices/$invoiceId'\n    | '/_auth/invoices/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthRoute: typeof AuthRouteWithChildren\n  LoginRoute: typeof LoginRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth/invoices': {\n      id: '/_auth/invoices'\n      path: '/invoices'\n      fullPath: '/invoices'\n      preLoaderRoute: typeof AuthInvoicesRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/_auth/dashboard': {\n      id: '/_auth/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof AuthDashboardRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/_auth/invoices/': {\n      id: '/_auth/invoices/'\n      path: '/'\n      fullPath: '/invoices/'\n      preLoaderRoute: typeof AuthInvoicesIndexRouteImport\n      parentRoute: typeof AuthInvoicesRoute\n    }\n    '/_auth/invoices/$invoiceId': {\n      id: '/_auth/invoices/$invoiceId'\n      path: '/$invoiceId'\n      fullPath: '/invoices/$invoiceId'\n      preLoaderRoute: typeof AuthInvoicesInvoiceIdRouteImport\n      parentRoute: typeof AuthInvoicesRoute\n    }\n  }\n}\n\ninterface AuthInvoicesRouteChildren {\n  AuthInvoicesInvoiceIdRoute: typeof AuthInvoicesInvoiceIdRoute\n  AuthInvoicesIndexRoute: typeof AuthInvoicesIndexRoute\n}\n\nconst AuthInvoicesRouteChildren: AuthInvoicesRouteChildren = {\n  AuthInvoicesInvoiceIdRoute: AuthInvoicesInvoiceIdRoute,\n  AuthInvoicesIndexRoute: AuthInvoicesIndexRoute,\n}\n\nconst AuthInvoicesRouteWithChildren = AuthInvoicesRoute._addFileChildren(\n  AuthInvoicesRouteChildren,\n)\n\ninterface AuthRouteChildren {\n  AuthDashboardRoute: typeof AuthDashboardRoute\n  AuthInvoicesRoute: typeof AuthInvoicesRouteWithChildren\n}\n\nconst AuthRouteChildren: AuthRouteChildren = {\n  AuthDashboardRoute: AuthDashboardRoute,\n  AuthInvoicesRoute: AuthInvoicesRouteWithChildren,\n}\n\nconst AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthRoute: AuthRouteWithChildren,\n  LoginRoute: LoginRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routes/__root.tsx",
    "content": "import { Outlet, createRootRouteWithContext } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport type { AuthContextType } from '../auth'\n\nexport type MyRouterContext = {\n  auth: AuthContextType\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => (\n    <>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" initialIsOpen={false} />\n    </>\n  ),\n})\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport { useAuth } from '../auth'\n\nexport const Route = createFileRoute('/_auth/dashboard')({\n  component: DashboardPage,\n})\n\nfunction DashboardPage() {\n  const { user } = useAuth()\n\n  return (\n    <section className=\"grid gap-2 p-2\">\n      <p>Hi {user?.displayName || user?.email || 'there'}!</p>\n      <p>You are currently on the dashboard route.</p>\n    </section>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport { fetchInvoiceById } from '../posts'\n\nexport const Route = createFileRoute('/_auth/invoices/$invoiceId')({\n  loader: async ({ params: { invoiceId } }) => {\n    return {\n      invoice: await fetchInvoiceById(Number.parseInt(invoiceId)),\n    }\n  },\n  component: InvoicePage,\n})\n\nfunction InvoicePage() {\n  const { invoice } = Route.useLoaderData()\n\n  return (\n    <section className=\"grid gap-2\">\n      <h2 className=\"text-lg\">\n        <strong>Invoice No.</strong> #{invoice.id.toString().padStart(2, '0')}\n      </h2>\n      <p>\n        <strong>Invoice title:</strong> {invoice.title}\n      </p>\n      <p>\n        <strong>Invoice body:</strong> {invoice.body}\n      </p>\n    </section>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_auth/invoices/')({\n  component: () => <div>Select an invoice to view it!</div>,\n})\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routes/_auth.invoices.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nimport { fetchInvoices } from '../posts'\n\nexport const Route = createFileRoute('/_auth/invoices')({\n  loader: async () => ({\n    invoices: await fetchInvoices(),\n  }),\n  component: InvoicesRoute,\n})\n\nfunction InvoicesRoute() {\n  const { invoices } = Route.useLoaderData()\n\n  return (\n    <div className=\"grid grid-cols-3 md:grid-cols-5 min-h-[500px]\">\n      <div className=\"col-span-1 py-2 pl-2 pr-4 md:border-r\">\n        <p className=\"mb-2\">Choose an invoice from the list below.</p>\n        <ol className=\"grid gap-2\">\n          {invoices.map((invoice) => (\n            <li key={invoice.id}>\n              <Link\n                to=\"/invoices/$invoiceId\"\n                params={{ invoiceId: invoice.id.toString() }}\n                className=\"text-blue-600 hover:opacity-75\"\n                activeProps={{ className: 'font-bold underline' }}\n              >\n                <span className=\"tabular-nums\">\n                  #{invoice.id.toString().padStart(2, '0')}\n                </span>{' '}\n                - {invoice.title.slice(0, 16)}...\n              </Link>\n            </li>\n          ))}\n        </ol>\n      </div>\n      <div className=\"col-span-2 md:col-span-4 py-2 px-4\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routes/_auth.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet, redirect, useRouter } from '@tanstack/react-router'\nimport { useAuth } from '../auth'\n\nexport const Route = createFileRoute('/_auth')({\n  beforeLoad: ({ context, location }) => {\n    // Check if user is authenticated\n    if (!context.auth.isAuthenticated) {\n      console.log('User not authenticated, redirecting to login...')\n      throw redirect({\n        to: '/login',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n    console.log('User authenticated, proceeding...')\n  },\n  component: AuthLayout,\n})\n\nfunction AuthLayout() {\n  const router = useRouter()\n  const navigate = Route.useNavigate()\n  const auth = useAuth()\n\n  const handleLogout = () => {\n    if (window.confirm('Are you sure you want to logout?')) {\n      auth.logout().then(() => {\n        router.invalidate().finally(() => {\n          navigate({ to: '/login' })\n        })\n      })\n    }\n  }\n\n  return (\n    <div className=\"p-2 h-full\">\n      <h1>Authenticated Route</h1>\n      <p>This route's content is only visible to authenticated users.</p>\n      <ul className=\"py-2 flex gap-2\">\n        <li>\n          <Link\n            to=\"/dashboard\"\n            className=\"hover:underline data-[status='active']:font-semibold\"\n          >\n            Dashboard\n          </Link>\n        </li>\n        <li>\n          <Link\n            to=\"/invoices\"\n            className=\"hover:underline data-[status='active']:font-semibold\"\n          >\n            Invoices\n          </Link>\n        </li>\n        <li>\n          <button\n            type=\"button\"\n            className=\"hover:underline\"\n            onClick={handleLogout}\n          >\n            Logout\n          </button>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  beforeLoad: ({ context }) => {\n    // Log for debugging\n    console.log('Checking context on index.tsx:', context) // Check if user is authenticated\n    if (context.auth.isAuthenticated) {\n      console.log('User authenticated, proceeding...')\n      throw redirect({\n        to: '/dashboard',\n      })\n    }\n  },\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-4 max-w-3xl mx-auto\">\n      <h1 className=\"text-2xl font-bold mb-4\">\n        Welcome to TS Router + Firebase\n      </h1>\n\n      <section className=\"mb-6 p-4 bg-slate-100 dark:bg-slate-800 rounded-lg\">\n        <h2 className=\"text-xl font-semibold mb-2\">About This Template</h2>\n        <p className=\"mb-2\">\n          This template demonstrates a SPA architecture using:\n        </p>\n        <ul className=\"list-disc list-inside mb-4\">\n          <li>TanStack Router for type-safe routing</li>\n          <li>Firebase Client SDK for authentication</li>\n        </ul>\n        <p>\n          <strong>Project Organization:</strong> Routes under <code>_auth</code>{' '}\n          are protected, while other routes are public. The{' '}\n          <code>(public)</code> folder is used purely for organization and\n          doesn't affect routing.\n        </p>\n      </section>\n\n      <section className=\"mb-6\">\n        <h2 className=\"text-xl font-semibold mb-2\">How It Works</h2>\n        <p className=\"mb-3\">\n          This page (<code>index.tsx</code>) serves as your public landing/sales\n          page. When an authenticated user visits this route, they're\n          automatically redirected to <code>/dashboard</code>.\n        </p>\n      </section>\n\n      <section className=\"mt-6\">\n        <h2 className=\"text-xl font-semibold mb-2\">Navigation</h2>\n        <div className=\"flex gap-4\">\n          <Link\n            to=\"/login\"\n            className=\"px-4 py-2 bg-blue-500 text-white rounded-sm hover:bg-blue-600\"\n          >\n            Login\n          </Link>\n          <Link\n            to=\"/dashboard\"\n            className=\"px-4 py-2 border border-gray-300 rounded-sm hover:bg-gray-100 dark:hover:bg-gray-800\"\n          >\n            Dashboard (Protected)\n          </Link>\n        </div>\n      </section>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { redirect, useRouter } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nimport { useAuth } from '../auth'\nimport { siGithub } from 'simple-icons'\n\nimport { GithubAuthProvider } from 'firebase/auth'\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst fallback = '/dashboard' as const\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: z.object({\n    redirect: z.string().optional().catch(''),\n  }),\n  beforeLoad: ({ context, search }) => {\n    if (context.auth.isAuthenticated) {\n      throw redirect({ to: search.redirect || fallback })\n    }\n  },\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const { login } = useAuth()\n\n  const handleSignIn = async (provider: 'github') => {\n    console.log(`Clicked ${provider} sign in!`)\n    try {\n      const providers = {\n        github: new GithubAuthProvider(),\n        // Other providers can be allocated here\n      }\n\n      const typedProvider =\n        providers[provider] ??\n        (() => {\n          throw new Error('Invalid provider')\n        })()\n\n      await login(typedProvider)\n      router.invalidate() // This should force the user to route to /dashboard\n    } catch (error) {\n      console.error('Sign in error:', error)\n    }\n  }\n\n  return (\n    <div className=\"flex justify-center items-center min-h-screen\">\n      <div className=\"w-full max-w-md px-4 animate-fade-up relative z-10\">\n        <div className=\"w-full backdrop-blur-xs bg-card/80 p-8 space-y-8 shadow-md border border-border\">\n          <div className=\"space-y-4\">\n            {/* biome-ignore lint/a11y/useButtonType: <explanation> */}\n            <button\n              className=\"w-full h-12 font-medium bg-background hover:bg-secondary border-2 transition-all hover:scale-[1.02]\"\n              onClick={() => handleSignIn('github')}\n            >\n              <div className=\"flex items-center justify-center w-full\">\n                <svg\n                  xmlns=\"http://www.w3.org/2000/svg\"\n                  viewBox=\"0 0 24 24\"\n                  className=\"mr-2 h-5 w-5\"\n                  fill=\"currentColor\"\n                  aria-labelledby=\"githubIconTitle\"\n                  role=\"img\"\n                  style={{ minWidth: '20px' }}\n                >\n                  <title id=\"githubIconTitle\">GitHub Logo</title>\n                  <path d={siGithub.path} />\n                </svg>\n                <span>Continue with GitHub</span>\n              </div>\n            </button>\n          </div>\n\n          <div className=\"text-center text-sm text-muted-foreground\">\n            By continuing, you agree to our{' '}\n            <a\n              href=\"#\"\n              className=\"underline underline-offset-4 hover:text-primary transition-colors\"\n            >\n              Terms of Service\n            </a>{' '}\n            and{' '}\n            <a\n              href=\"#\"\n              className=\"underline underline-offset-4 hover:text-primary transition-colors\"\n            >\n              Privacy Policy\n            </a>\n          </div>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/utils.ts",
    "content": "export async function sleep(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/src/vite.d.ts",
    "content": "/// <reference types=\"vite/client\" />\n\ninterface ImportMetaEnv {\n  readonly VITE_PUBLIC_FIREBASE_API_KEY: string\n  readonly VITE_PUBLIC_FIREBASE_AUTH_DOMAIN: string\n  readonly VITE_PUBLIC_FIREBASE_PROJECT_ID: string\n  readonly VITE_PUBLIC_FIREBASE_STORAGE_BUCKET: string\n  readonly VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: string\n  readonly VITE_PUBLIC_FIREBASE_APP_ID: string\n}\n\ninterface ImportMeta {\n  readonly env: ImportMetaEnv\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"useDefineForClassFields\": true,\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"Bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": true,\n    \"noEmit\": true,\n    \"jsx\": \"react-jsx\",\n\n    /* Linting */\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/react/authenticated-routes-firebase/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "examples/react/basic/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic/README.md",
    "content": "# TanStack Router - Basic Example\n\nA basic example demonstrating the fundamentals of TanStack Router.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic basic\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Basic routing setup\n- Route configuration\n- Navigation\n- Route parameters\n- TanStack Router DevTools\n"
  },
  {
    "path": "examples/react/basic/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic/src/main.tsx",
    "content": "import ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { NotFoundError, fetchPost, fetchPosts } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nexport const postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ params }) => fetchPost(params.postId),\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold\">{post.title}</h4>\n      <hr className=\"opacity-20\" />\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst nestedPathlessLayout2Route = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  id: '_nestedPathlessLayout',\n  component: PathlessLayout2Component,\n})\n\nfunction PathlessLayout2Component() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to Route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to Route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return <div>I'm route A!</div>\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return <div>I'm route B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  pathlessLayoutRoute.addChildren([\n    nestedPathlessLayout2Route.addChildren([\n      pathlessLayoutARoute,\n      pathlessLayoutBRoute,\n    ]),\n  ]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/basic/src/posts.lazy.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createLazyRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "examples/react/basic/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/basic/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/basic-default-search-params/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-default-search-params/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/basic-default-search-params/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-default-search-params/README.md",
    "content": "# TanStack Router - Default Search Params Example\n\nAn example demonstrating default search parameters.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-default-search-params basic-default-search-params\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Default search parameter values\n- Type-safe search params\n- Search param validation\n- URL state management\n"
  },
  {
    "path": "examples/react/basic-default-search-params/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic-default-search-params/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-default-search-params\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-default-search-params/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport axios from 'redaxios'\nimport { z } from 'zod'\nimport type {\n  ErrorComponentProps,\n  SearchSchemaInput,\n} from '@tanstack/react-router'\nimport './styles.css'\n\ntype PostType = {\n  id: number\n  title: string\n  body: string\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 300))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: number) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 300))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n    .then((r) => r.data)\n\n  return post\n}\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return <p>This is the notFoundComponent configured on root route</p>\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <div className=\"bg-linear-to-r from-green-700 to-lime-600 text-white\">\n      <div className=\"p-2 flex gap-2 text-lg bg-black/40 shadow-xl\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </div>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = postsLayoutRoute.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <div className=\"list-disc bg-gray-800/70 rounded-lg divide-y divide-green-500/30\">\n        {posts.map((post, index) => {\n          return (\n            <div key={post.id} className=\"whitespace-nowrap\">\n              <Link\n                to={postRoute.to}\n                search={{\n                  postId: post.id,\n                  color: index % 2 ? 'red' : undefined,\n                }}\n                className=\"block py-1 px-2 text-green-300 hover:text-green-200\"\n                activeProps={{ className: 'text-white! font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nclass NotFoundError extends Error {}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: 'post',\n  validateSearch: (\n    input: {\n      postId: number\n      color?: 'white' | 'red' | 'green'\n    } & SearchSchemaInput,\n  ) =>\n    z\n      .object({\n        postId: z.number().catch(1),\n        color: z.enum(['white', 'red', 'green']).catch('white'),\n      })\n      .parse(input),\n  loaderDeps: ({ search: { postId } }) => ({\n    postId,\n  }),\n  errorComponent: PostErrorComponent,\n  loader: ({ deps: { postId } }) => fetchPost(postId),\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n  const { color } = postRoute.useSearch()\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold\">{post.title}</h4>\n      <hr className=\"opacity-20\" />\n      <div className={`text-sm  text-${color}-300`}>{post.body}</div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/basic-default-search-params/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-default-search-params/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-default-search-params/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "examples/react/basic-devtools-panel/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/README.md",
    "content": "# TanStack Router - DevTools Panel Example\n\nAn example demonstrating the TanStack Router DevTools panel.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-devtools-panel basic-devtools-panel\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- TanStack Router DevTools integration\n- DevTools panel configuration\n- Route debugging\n- State inspection\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-devtools-panel\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query-devtools\": \"^5.67.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/src/App.tsx",
    "content": "import { useState } from 'react'\n\nfunction App() {\n  const [count, setCount] = useState(0)\n\n  return (\n    <>\n      <div></div>\n      <div className=\"card\">\n        <button onClick={() => setCount((count) => count + 1)}>\n          count is {count}\n        </button>\n        <p>\n          Edit <code>src/App.tsx</code> and save to test HMR\n        </p>\n      </div>\n      <p className=\"read-the-docs\">\n        Click on the Vite and React logos to learn more\n      </p>\n    </>\n  )\n}\n\nexport default App\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './App'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport {\n  Outlet,\n  RouterProvider,\n  Link,\n  createRouter,\n  createRoute,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: () => (\n    <>\n      <div className=\"p-2 flex gap-2\">\n        <Link to=\"/\">Home</Link> <Link to=\"/about\">About</Link>\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  ),\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: function Index() {\n    return (\n      <div className=\"p-2\">\n        <h3>Welcome Home!</h3>\n        <App />\n      </div>\n    )\n  },\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  component: function About() {\n    return <div className=\"p-2\">Hello from About!</div>\n  },\n})\n\nconst routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\nconst router = createRouter({ routeTree })\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst element = document.getElementById('app')!\nconst shadowContainer = element.attachShadow({ mode: 'open' })\nconst shadowRootElement = document.createElement('div')\nshadowContainer.appendChild(shadowRootElement)\n\nconst queryClient = new QueryClient()\nReactDOM.createRoot(shadowRootElement).render(\n  <React.StrictMode>\n    <RouterProvider router={router} />\n    <TanStackRouterDevtoolsPanel\n      shadowDOMTarget={shadowContainer}\n      router={router}\n    />\n  </React.StrictMode>,\n)\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-devtools-panel/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/basic-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/basic-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/README.md",
    "content": "# TanStack Router - File-Based Routing Example\n\nAn example demonstrating file-based routing with TanStack Router.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-file-based basic-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- File-based route generation\n- Automatic route tree creation\n- Route file conventions\n- Type-safe routing with file-based routes\n"
  },
  {
    "path": "examples/react/basic-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AnchorRouteImport } from './routes/anchor'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst AnchorRoute = AnchorRouteImport.update({\n  id: '/anchor',\n  path: '/anchor',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/anchor': typeof AnchorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/anchor': typeof AnchorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/anchor': typeof AnchorRoute\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/anchor'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/anchor' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/_pathlessLayout'\n    | '/anchor'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  AnchorRoute: typeof AnchorRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/anchor': {\n      id: '/anchor'\n      path: '/anchor'\n      fullPath: '/anchor'\n      preLoaderRoute: typeof AnchorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  AnchorRoute: AnchorRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          to=\"/anchor\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Anchor\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/anchor.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { useLayoutEffect, useRef, useState } from 'react'\nimport { Link, useLocation, useNavigate } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/anchor')({\n  component: AnchorComponent,\n})\n\nconst anchors: Array<{\n  id: string\n  title: string\n  hashScrollIntoView?: boolean | ScrollIntoViewOptions\n}> = [\n  {\n    id: 'default-anchor',\n    title: 'Default Anchor',\n  },\n  {\n    id: 'false-anchor',\n    title: 'No Scroll Into View',\n    hashScrollIntoView: false,\n  },\n  {\n    id: 'smooth-scroll',\n    title: 'Smooth Scroll',\n    hashScrollIntoView: { behavior: 'smooth' },\n  },\n] as const\n\nfunction AnchorSection({ id, title }: { id: string; title: string }) {\n  const [hasShown, setHasShown] = useState(false)\n  const elementRef = useRef<HTMLHeadingElement>(null)\n\n  useLayoutEffect(() => {\n    const observer = new IntersectionObserver(\n      ([entry]) => {\n        if (!hasShown && entry.isIntersecting) {\n          setHasShown(true)\n        }\n      },\n      { threshold: 0.01 },\n    )\n\n    const currentRef = elementRef.current\n    if (currentRef) {\n      observer.observe(currentRef)\n    }\n\n    return () => {\n      if (currentRef) {\n        observer.unobserve(currentRef)\n      }\n    }\n  }, [hasShown])\n\n  return (\n    <div id={id} className=\"p-2 min-h-dvh\">\n      <h1 className=\"font-bold text-xl pt-10\" ref={elementRef}>\n        {title}\n        {hasShown ? ' (shown)' : ''}\n      </h1>\n    </div>\n  )\n}\n\nfunction AnchorComponent() {\n  const navigate = useNavigate()\n  const location = useLocation()\n  const [withScroll, setWithScroll] = useState(true)\n\n  return (\n    <div className=\"flex flex-col w-full\">\n      <nav className=\"sticky top-0 z-10 p-2 bg-gray-50 dark:bg-gray-900 border-b\">\n        <ul className=\"inline-flex gap-2\">\n          {anchors.map((anchor) => (\n            <li key={anchor.id}>\n              <Link\n                from={Route.fullPath}\n                hash={anchor.id}\n                activeOptions={{ includeHash: true }}\n                activeProps={{\n                  className: 'font-bold active',\n                }}\n                hashScrollIntoView={anchor.hashScrollIntoView}\n              >\n                {anchor.title}\n              </Link>\n            </li>\n          ))}\n        </ul>\n      </nav>\n      <main className=\"overflow-auto\">\n        <form\n          className=\"p-2 space-y-2 min-h-dvh\"\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n\n            const toHash = formData.get('hash') as string\n\n            if (!toHash) {\n              return\n            }\n\n            const hashScrollIntoView = withScroll\n              ? ({\n                  behavior: formData.get('scrollBehavior') as ScrollBehavior,\n                  block: formData.get('scrollBlock') as ScrollLogicalPosition,\n                  inline: formData.get('scrollInline') as ScrollLogicalPosition,\n                } satisfies ScrollIntoViewOptions)\n              : false\n\n            navigate({ hash: toHash, hashScrollIntoView })\n          }}\n        >\n          <h1 className=\"font-bold text-xl\">Scroll with navigate</h1>\n          <div className=\"space-y-2\">\n            <label>\n              <span>Target Anchor</span>\n              <select\n                className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                defaultValue={location.hash || anchors[0].id}\n                name=\"hash\"\n              >\n                {anchors.map((anchor) => (\n                  <option key={anchor.id} value={anchor.id}>\n                    {anchor.title}\n                  </option>\n                ))}\n              </select>\n            </label>\n            <div>\n              <label>\n                <input\n                  checked={withScroll}\n                  onChange={(e) => setWithScroll(e.target.checked)}\n                  type=\"checkbox\"\n                />{' '}\n                Scroll Into View\n              </label>\n            </div>\n          </div>\n          {withScroll ? (\n            <>\n              <div className=\"space-y-2\">\n                <label>\n                  <span>Behavior</span>\n                  <select\n                    className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    defaultValue=\"instant\"\n                    name=\"scrollBehavior\"\n                  >\n                    <option value=\"instant\">instant</option>\n                    <option value=\"smooth\">smooth</option>\n                    <option value=\"auto\">auto</option>\n                  </select>\n                </label>\n              </div>\n\n              <div className=\"space-y-2\">\n                <label>\n                  <span>Block</span>\n                  <select\n                    className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    defaultValue=\"start\"\n                    name=\"scrollBlock\"\n                  >\n                    <option value=\"start\">start</option>\n                    <option value=\"center\">center</option>\n                    <option value=\"end\">end</option>\n                    <option value=\"nearest\">nearest</option>\n                  </select>\n                </label>\n              </div>\n\n              <div className=\"space-y-2\">\n                <label>\n                  <span>Inline</span>\n                  <select\n                    className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n                    defaultValue=\"nearest\"\n                    name=\"scrollInline\"\n                  >\n                    <option value=\"start\">start</option>\n                    <option value=\"center\">center</option>\n                    <option value=\"end\">end</option>\n                    <option value=\"nearest\">nearest</option>\n                  </select>\n                </label>\n              </div>\n            </>\n          ) : null}\n          <div>\n            <button className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\">\n              Navigate\n            </button>\n          </div>\n        </form>\n\n        {anchors.map((anchor) => (\n          <AnchorSection key={anchor.id} id={anchor.id} title={anchor.title} />\n        ))}\n      </main>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/routes/posts.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/README.md",
    "content": "# TanStack Router - Non-Nested DevTools Example\n\nAn example demonstrating TanStack Router DevTools in a non-nested configuration.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-non-nested-devtools basic-non-nested-devtools\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- TanStack Router DevTools\n- Non-nested DevTools configuration\n- Alternative DevTools placement\n- DevTools customization\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-non-nested-devtools\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/src/main.tsx",
    "content": "import ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { NotFoundError, fetchPost, fetchPosts } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <Outlet />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nexport const postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ params }) => fetchPost(params.postId),\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold\">{post.title}</h4>\n      <hr className=\"opacity-20\" />\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst nestedPathlessLayout2Route = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  id: '_nestedPathlessLayout',\n  component: PathlessLayout2Component,\n})\n\nfunction PathlessLayout2Component() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to Route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to Route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return <div>I'm route A!</div>\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return <div>I'm route B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  pathlessLayoutRoute.addChildren([\n    nestedPathlessLayout2Route.addChildren([\n      pathlessLayoutARoute,\n      pathlessLayoutBRoute,\n    ]),\n  ]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(\n    <>\n      <RouterProvider router={router} />\n      <TanStackRouterDevtools router={router} />\n    </>,\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/src/posts.lazy.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createLazyRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-non-nested-devtools/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/basic-react-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-react-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/basic-react-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-react-query/README.md",
    "content": "# TanStack Router - React Query Example\n\nAn example demonstrating integration between TanStack Router and TanStack Query.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [TanStack Query Docs](https://tanstack.com/query)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-react-query basic-react-query\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Integrating TanStack Query with TanStack Router\n- Data fetching with queries\n- Route-level data loading\n- Cache management\n- Prefetching data on route navigation\n"
  },
  {
    "path": "examples/react/basic-react-query/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic-react-query/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-react-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-react-query/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  useRouter,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport {\n  QueryClient,\n  QueryClientProvider,\n  useQueryErrorResetBoundary,\n  useSuspenseQuery,\n} from '@tanstack/react-query'\nimport { NotFoundError, postQueryOptions, postsQueryOptions } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport './styles.css'\n\nconst rootRoute = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <ReactQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexRouteComponent,\n})\n\nfunction IndexRouteComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexRouteComponent,\n})\n\nfunction PostsIndexRouteComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ context: { queryClient }, params: { postId } }) =>\n    queryClient.ensureQueryData(postQueryOptions(postId)),\n  component: PostRouteComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n  const queryErrorResetBoundary = useQueryErrorResetBoundary()\n\n  React.useEffect(() => {\n    queryErrorResetBoundary.reset()\n  }, [queryErrorResetBoundary])\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nfunction PostRouteComponent() {\n  const { postId } = postRoute.useParams()\n  const postQuery = useSuspenseQuery(postQueryOptions(postId))\n  const post = postQuery.data\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst nestedPathlessLayoutRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  id: '_nestedPathlessLayout',\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => nestedPathlessLayoutRoute,\n  path: '/route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => nestedPathlessLayoutRoute,\n  path: '/route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  pathlessLayoutRoute.addChildren([\n    nestedPathlessLayoutRoute.addChildren([\n      pathlessLayoutARoute,\n      pathlessLayoutBRoute,\n    ]),\n  ]),\n  indexRoute,\n])\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n  context: {\n    queryClient,\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(\n    <QueryClientProvider client={queryClient}>\n      <RouterProvider router={router} />\n    </QueryClientProvider>,\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query/src/posts.lazy.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createLazyRoute } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { postsQueryOptions } from './posts'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const postsQuery = useSuspenseQuery(postsQueryOptions)\n\n  const posts = postsQuery.data\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query/src/posts.ts",
    "content": "import axios from 'redaxios'\nimport { queryOptions } from '@tanstack/react-query'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "examples/react/basic-react-query/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/basic-react-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-react-query/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/README.md",
    "content": "# TanStack Router - React Query File-Based Example\n\nAn example combining file-based routing with TanStack Query integration.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [TanStack Query Docs](https://tanstack.com/query)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-react-query-file-based basic-react-query-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- File-based routing with TanStack Router\n- TanStack Query integration\n- Type-safe data fetching\n- Automatic route generation\n- Query-based data loading per route\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-react-query-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <QueryClientProvider client={queryClient}>\n      <RouterProvider router={router} />\n    </QueryClientProvider>,\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/postQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport { fetchPost } from './posts'\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/postsQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport { fetchPosts } from './posts'\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/_pathlessLayout'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <ReactQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent, useRouter } from '@tanstack/react-router'\nimport {\n  useQueryErrorResetBoundary,\n  useSuspenseQuery,\n} from '@tanstack/react-query'\nimport { PostNotFoundError } from '../posts'\nimport { postQueryOptions } from '../postQueryOptions'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ context: { queryClient }, params: { postId } }) => {\n    return queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof PostNotFoundError) {\n    return <div>{error.message}</div>\n  }\n  const queryErrorResetBoundary = useQueryErrorResetBoundary()\n\n  React.useEffect(() => {\n    queryErrorResetBoundary.reset()\n  }, [queryErrorResetBoundary])\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nfunction PostComponent() {\n  const postId = Route.useParams().postId\n  const { data: post } = useSuspenseQuery(postQueryOptions(postId))\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/routes/posts.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { postsQueryOptions } from '../postsQueryOptions'\n\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const postsQuery = useSuspenseQuery(postsQueryOptions)\n  const posts = postsQuery.data\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-react-query-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/README.md",
    "content": "# TanStack Router - SSR File-Based Example\n\nAn example demonstrating server-side rendering (SSR) with file-based routing.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-ssr-file-based basic-ssr-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Server-side rendering with TanStack Router\n- File-based routing\n- SSR data loading\n- Hydration\n- SEO-friendly routing\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-ssr-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"node server\",\n    \"build\": \"npm run build:client && npm run build:server\",\n    \"build:client\": \"vite build\",\n    \"build:server\": \"vite build --ssr\",\n    \"serve\": \"NODE_ENV=production node server\",\n    \"debug\": \"node --inspect-brk server\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"compression\": \"^1.8.0\",\n    \"express\": \"^4.21.2\",\n    \"get-port\": \"^7.1.0\",\n    \"node-fetch\": \"^3.3.2\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@types/express\": \"^4.17.23\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.1\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.8.3\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/server.js",
    "content": "import path from 'node:path'\nimport express from 'express'\nimport getPort, { portNumbers } from 'get-port'\nimport * as zlib from 'node:zlib'\n\nconst isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD\n\nexport async function createServer(\n  root = process.cwd(),\n  isProd = process.env.NODE_ENV === 'production',\n  hmrPort,\n) {\n  const app = express()\n\n  /**\n   * @type {import('vite').ViteDevServer}\n   */\n  let vite\n  if (!isProd) {\n    vite = await (\n      await import('vite')\n    ).createServer({\n      root,\n      logLevel: isTest ? 'error' : 'info',\n      server: {\n        middlewareMode: true,\n        watch: {\n          // During tests we edit the files too fast and sometimes chokidar\n          // misses change events, so enforce polling for consistency\n          usePolling: true,\n          interval: 100,\n        },\n        hmr: {\n          port: hmrPort,\n        },\n      },\n      appType: 'custom',\n    })\n    // use vite's connect instance as middleware\n    app.use(vite.middlewares)\n  } else {\n    app.use(\n      (await import('compression')).default({\n        brotli: {\n          flush: zlib.constants.BROTLI_OPERATION_FLUSH,\n        },\n        flush: zlib.constants.Z_SYNC_FLUSH,\n      }),\n    )\n  }\n\n  if (isProd) app.use(express.static('./dist/client'))\n\n  app.use('*', async (req, res) => {\n    try {\n      const url = req.originalUrl\n\n      if (path.extname(url) !== '') {\n        console.warn(`${url} is not valid router path`)\n        res.status(404)\n        res.end(`${url} is not valid router path`)\n        return\n      }\n\n      // Best effort extraction of the head from vite's index transformation hook\n      let viteHead = !isProd\n        ? await vite.transformIndexHtml(\n            url,\n            `<html><head></head><body></body></html>`,\n          )\n        : ''\n\n      viteHead = viteHead.substring(\n        viteHead.indexOf('<head>') + 6,\n        viteHead.indexOf('</head>'),\n      )\n\n      const entry = await (async () => {\n        if (!isProd) {\n          return vite.ssrLoadModule('/src/entry-server.tsx')\n        } else {\n          return import('./dist/server/entry-server.js')\n        }\n      })()\n\n      console.info('Rendering: ', url, '...')\n      entry.render({ req, res, head: viteHead })\n    } catch (e) {\n      !isProd && vite.ssrFixStacktrace(e)\n      console.info(e.stack)\n      res.status(500).end(e.stack)\n    }\n  })\n\n  return { app, vite }\n}\n\nif (!isTest) {\n  createServer().then(async ({ app }) =>\n    app.listen(await getPort({ port: portNumbers(3000, 3100) }), () => {\n      console.info('Client Server: http://localhost:3000')\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/entry-client.tsx",
    "content": "import { hydrateRoot } from 'react-dom/client'\nimport { RouterClient } from '@tanstack/react-router/ssr/client'\nimport { createRouter } from './router'\n\nconst router = createRouter()\n\nhydrateRoot(document, <RouterClient router={router} />)\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/entry-server.tsx",
    "content": "import { pipeline } from 'node:stream/promises'\nimport {\n  RouterServer,\n  createRequestHandler,\n  renderRouterToString,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\nimport type express from 'express'\nimport './fetch-polyfill'\n\nexport async function render({\n  req,\n  res,\n  head,\n}: {\n  head: string\n  req: express.Request\n  res: express.Response\n}) {\n  // Convert the express request to a fetch request\n  const url = new URL(req.originalUrl || req.url, 'http://localhost:3000').href\n\n  const request = new Request(url, {\n    method: req.method,\n    headers: (() => {\n      const headers = new Headers()\n      for (const [key, value] of Object.entries(req.headers)) {\n        headers.set(key, value as any)\n      }\n      return headers\n    })(),\n  })\n\n  // Create a request handler\n  const handler = createRequestHandler({\n    request,\n    createRouter: () => {\n      const router = createRouter()\n\n      // Update each router instance with the head info from vite\n      router.update({\n        context: {\n          ...router.options.context,\n          head: head,\n        },\n      })\n      return router\n    },\n  })\n\n  // Let's use the default stream handler to create the response\n  const response = await handler(({ responseHeaders, router }) =>\n    renderRouterToString({\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n\n  // Convert the fetch response back to an express response\n  res.statusMessage = response.statusText\n  res.status(response.status)\n\n  response.headers.forEach((value, name) => {\n    res.setHeader(name, value)\n  })\n\n  // Stream the response body\n  return pipeline(response.body as any, res)\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/fetch-polyfill.js",
    "content": "// fetch-polyfill.js\nimport fetch, {\n  Blob,\n  blobFrom,\n  blobFromSync,\n  File,\n  fileFrom,\n  fileFromSync,\n  FormData,\n  Headers,\n  Request,\n  Response,\n} from 'node-fetch'\n\nif (!globalThis.fetch) {\n  globalThis.fetch = fetch\n  globalThis.Headers = Headers\n  globalThis.Request = Request\n  globalThis.Response = Response\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ErrorRouteImport } from './routes/error'\nimport { Route as PostsRouteRouteImport } from './routes/posts/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts/$postId'\n\nconst ErrorRoute = ErrorRouteImport.update({\n  id: '/error',\n  path: '/error',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/error' | '/posts/$postId' | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/error' | '/posts/$postId' | '/posts'\n  id: '__root__' | '/' | '/posts' | '/error' | '/posts/$postId' | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  ErrorRoute: typeof ErrorRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/error': {\n      id: '/error'\n      path: '/error'\n      fullPath: '/error'\n      preLoaderRoute: typeof ErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  ErrorRoute: ErrorRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/router.tsx",
    "content": "import { createRouter as createReactRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function createRouter() {\n  return createReactRouter({\n    routeTree,\n    context: {\n      head: '',\n    },\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/routerContext.tsx",
    "content": "export type RouterContext = {\n  head: string\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/routes/__root.tsx",
    "content": "import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport type { RouterContext } from '../routerContext'\n\nexport const Route = createRootRouteWithContext<RouterContext>()({\n  head: () => ({\n    links: [{ rel: 'icon', href: '/images/favicon.ico' }],\n    meta: [\n      {\n        title: 'TanStack Router SSR Basic File Based Streaming',\n      },\n      {\n        charSet: 'UTF-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1.0',\n      },\n    ],\n    scripts: [\n      {\n        src: 'https://unpkg.com/@tailwindcss/browser@4',\n      },\n      ...(!import.meta.env.PROD\n        ? [\n            {\n              type: 'module',\n              children: `import RefreshRuntime from \"/@react-refresh\"\n  RefreshRuntime.injectIntoGlobalHook(window)\n  window.$RefreshReg$ = () => {}\n  window.$RefreshSig$ = () => (type) => type\n  window.__vite_plugin_react_preamble_installed__ = true`,\n            },\n            {\n              type: 'module',\n              src: '/@vite/client',\n            },\n          ]\n        : []),\n      {\n        type: 'module',\n        src: import.meta.env.PROD\n          ? '/static/entry-client.js'\n          : '/src/entry-client.tsx',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html lang=\"en\">\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/error\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Error\n          </Link>\n        </div>\n        <hr />\n        <Outlet /> {/* Start rendering router matches */}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/routes/error.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/error')({\n  component: ErrorComponent,\n  loader: () => {\n    if (Math.random() > 0.5) throw new Error('Random error!')\n  },\n  pendingComponent: () => <p>Loading..</p>,\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return (\n      <div className=\"p-2\">\n        <h3>Caught: {error.message}</h3>\n        <p>(This page has a 75% chance of throwing an error)</p>\n      </div>\n    )\n  },\n})\n\nfunction ErrorComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>\n        The loader of this page will have a 75% chance of throwing an error!\n      </h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/routes/index.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  loader: () => ({\n    date: new Date(),\n  }),\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <p>Data: {data.date.getDate()}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/routes/posts/$postId.tsx",
    "content": "import { Await, createFileRoute, notFound } from '@tanstack/react-router'\nimport * as React from 'react'\nimport type { PostType } from './route'\n\nasync function fetchPostById(postId: string) {\n  console.info(`Fetching post with id ${postId}...`)\n\n  await new Promise((r) => setTimeout(r, 100 + Math.round(Math.random() * 100)))\n\n  const res = await fetch(\n    `https://jsonplaceholder.typicode.com/posts/${postId}`,\n  )\n\n  if (res.status === 404) throw notFound()\n\n  return res.json() as Promise<PostType>\n}\n\nexport type CommentType = {\n  id: string\n  postId: string\n  name: string\n  email: string\n  body: string\n}\n\nasync function fetchComments(postId: string) {\n  await new Promise((r) => setTimeout(r, 2000))\n\n  return fetch(\n    `https://jsonplaceholder.typicode.com/comments?postId=${postId}`,\n  ).then((r) => r.json() as Promise<Array<CommentType>>)\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const commentsPromise = fetchComments(postId)\n    const post = await fetchPostById(postId)\n\n    return {\n      post,\n      commentsPromise: commentsPromise,\n    }\n  },\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return <div>Failed to load post: {(error as any).message}</div>\n  },\n  notFoundComponent: () => {\n    return <div>Post not found</div>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const { post, commentsPromise } = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Await\n        promise={commentsPromise}\n        fallback={<div>Loading comments...</div>}\n        key={post.id}\n      >\n        {(comments) => {\n          return (\n            <div className=\"space-y-2\">\n              <h5 className=\"text-lg font-bold underline\">Comments</h5>\n              {comments.map((comment) => {\n                return (\n                  <div key={comment.id}>\n                    <h6 className=\"text-md font-bold\">{comment.name}</h6>\n                    <div className=\"text-sm italic opacity-50\">\n                      {comment.email}\n                    </div>\n                    <div className=\"text-sm\">{comment.body}</div>\n                  </div>\n                )\n              })}\n            </div>\n          )\n        }}\n      </Await>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/routes/posts/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return (\n      <div className=\"text-red-500\">Failed to load post: {error.message}</div>\n    )\n  },\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/src/routes/posts/route.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) =>\n      setTimeout(r, 300 + Math.round(Math.random() * 300)),\n    )\n    return fetch('https://jsonplaceholder.typicode.com/posts')\n      .then((d) => d.json() as Promise<Array<PostType>>)\n      .then((d) => d.slice(0, 10))\n  },\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {posts.map((post) => {\n          return (\n            <li key={post.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n        <li className=\"whitespace-nowrap\">\n          <Link\n            to=\"/posts/$postId\"\n            params={{\n              postId: 'does-not-exist',\n            }}\n            className=\"block py-1 text-blue-800 hover:text-blue-600\"\n            activeProps={{ className: 'text-black font-bold' }}\n          >\n            <div>This post does not exist</div>\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"esnext\",\n    \"types\": [\"vite/client\"],\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-file-based/vite.config.ts",
    "content": "import path from 'node:path'\nimport url from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport type { BuildEnvironmentOptions } from 'vite'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\n// SSR configuration\nconst ssrBuildConfig: BuildEnvironmentOptions = {\n  ssr: true,\n  outDir: 'dist/server',\n  ssrEmitAssets: true,\n  copyPublicDir: false,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-server.tsx'),\n    output: {\n      entryFileNames: '[name].js',\n      chunkFileNames: 'assets/[name]-[hash].js',\n      assetFileNames: 'assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// Client-specific configuration\nconst clientBuildConfig: BuildEnvironmentOptions = {\n  outDir: 'dist/client',\n  emitAssets: true,\n  copyPublicDir: true,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-client.tsx'),\n    output: {\n      entryFileNames: 'static/[name].js',\n      chunkFileNames: 'static/assets/[name]-[hash].js',\n      assetFileNames: 'static/assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// https://vitejs.dev/config/\nexport default defineConfig((configEnv) => {\n  return {\n    plugins: [\n      tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n      react(),\n    ],\n    build: configEnv.isSsrBuild ? ssrBuildConfig : clientBuildConfig,\n  }\n})\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/README.md",
    "content": "# TanStack Router - SSR Streaming File-Based Example\n\nAn example demonstrating server-side rendering with streaming and file-based routing.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-ssr-streaming-file-based basic-ssr-streaming-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Server-side rendering with streaming\n- File-based routing\n- Progressive rendering\n- Suspense boundaries\n- Optimized time-to-first-byte\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-ssr-streaming-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"node server\",\n    \"build\": \"npm run build:client && npm run build:server\",\n    \"build:client\": \"vite build\",\n    \"build:server\": \"vite build --ssr\",\n    \"serve\": \"NODE_ENV=production node server\",\n    \"debug\": \"node --inspect-brk server\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"compression\": \"^1.8.0\",\n    \"express\": \"^4.21.2\",\n    \"get-port\": \"^7.1.0\",\n    \"node-fetch\": \"^3.3.2\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@types/express\": \"^4.17.23\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.1\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/server.js",
    "content": "import path from 'node:path'\nimport express from 'express'\nimport getPort, { portNumbers } from 'get-port'\nimport * as zlib from 'node:zlib'\n\nconst isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD\n\nexport async function createServer(\n  root = process.cwd(),\n  isProd = process.env.NODE_ENV === 'production',\n  hmrPort,\n) {\n  const app = express()\n\n  /**\n   * @type {import('vite').ViteDevServer}\n   */\n  let vite\n  if (!isProd) {\n    vite = await (\n      await import('vite')\n    ).createServer({\n      root,\n      logLevel: isTest ? 'error' : 'info',\n      server: {\n        middlewareMode: true,\n        watch: {\n          // During tests we edit the files too fast and sometimes chokidar\n          // misses change events, so enforce polling for consistency\n          usePolling: true,\n          interval: 100,\n        },\n        hmr: {\n          port: hmrPort,\n        },\n      },\n      appType: 'custom',\n    })\n    // use vite's connect instance as middleware\n    app.use(vite.middlewares)\n  } else {\n    app.use(\n      (await import('compression')).default({\n        brotli: {\n          flush: zlib.constants.BROTLI_OPERATION_FLUSH,\n        },\n        flush: zlib.constants.Z_SYNC_FLUSH,\n      }),\n    )\n  }\n\n  if (isProd) app.use(express.static('./dist/client'))\n\n  app.use('*', async (req, res) => {\n    try {\n      const url = req.originalUrl\n\n      if (path.extname(url) !== '') {\n        console.warn(`${url} is not valid router path`)\n        res.status(404)\n        res.end(`${url} is not valid router path`)\n        return\n      }\n\n      // Best effort extraction of the head from vite's index transformation hook\n      let viteHead = !isProd\n        ? await vite.transformIndexHtml(\n            url,\n            `<html><head></head><body></body></html>`,\n          )\n        : ''\n\n      viteHead = viteHead.substring(\n        viteHead.indexOf('<head>') + 6,\n        viteHead.indexOf('</head>'),\n      )\n\n      const entry = await (async () => {\n        if (!isProd) {\n          return vite.ssrLoadModule('/src/entry-server.tsx')\n        } else {\n          return import('./dist/server/entry-server.js')\n        }\n      })()\n\n      console.info('Rendering: ', url, '...')\n      entry.render({ req, res, head: viteHead })\n    } catch (e) {\n      !isProd && vite.ssrFixStacktrace(e)\n      console.info(e.stack)\n      res.status(500).end(e.stack)\n    }\n  })\n\n  return { app, vite }\n}\n\nif (!isTest) {\n  createServer().then(async ({ app }) =>\n    app.listen(await getPort({ port: portNumbers(3000, 3100) }), () => {\n      console.info('Client Server: http://localhost:3000')\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/entry-client.tsx",
    "content": "import { hydrateRoot } from 'react-dom/client'\nimport { RouterClient } from '@tanstack/react-router/ssr/client'\nimport { createRouter } from './router'\n\nconst router = createRouter()\n\nhydrateRoot(document, <RouterClient router={router} />)\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/entry-server.tsx",
    "content": "import { pipeline } from 'node:stream/promises'\nimport {\n  RouterServer,\n  createRequestHandler,\n  renderRouterToStream,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\nimport type express from 'express'\nimport './fetch-polyfill'\n\nexport async function render({\n  req,\n  res,\n  head,\n}: {\n  head: string\n  req: express.Request\n  res: express.Response\n}) {\n  // Convert the express request to a fetch request\n  const url = new URL(req.originalUrl || req.url, 'http://localhost:3000').href\n\n  const request = new Request(url, {\n    method: req.method,\n    headers: (() => {\n      const headers = new Headers()\n      for (const [key, value] of Object.entries(req.headers)) {\n        headers.set(key, value as any)\n      }\n      return headers\n    })(),\n  })\n\n  // Create a request handler\n  const handler = createRequestHandler({\n    request,\n    createRouter: () => {\n      const router = createRouter()\n\n      // Update each router instance with the head info from vite\n      router.update({\n        context: {\n          ...router.options.context,\n          head: head,\n        },\n      })\n      return router\n    },\n  })\n\n  // Let's use the default stream handler to create the response\n  const response = await handler(({ request, responseHeaders, router }) =>\n    renderRouterToStream({\n      request,\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n\n  // Convert the fetch response back to an express response\n  res.statusMessage = response.statusText\n  res.status(response.status)\n\n  response.headers.forEach((value, name) => {\n    res.setHeader(name, value)\n  })\n\n  // Stream the response body\n  return pipeline(response.body as any, res)\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/fetch-polyfill.js",
    "content": "// fetch-polyfill.js\nimport fetch, {\n  Blob,\n  blobFrom,\n  blobFromSync,\n  File,\n  fileFrom,\n  fileFromSync,\n  FormData,\n  Headers,\n  Request,\n  Response,\n} from 'node-fetch'\n\nif (!globalThis.fetch) {\n  globalThis.fetch = fetch\n  globalThis.Headers = Headers\n  globalThis.Request = Request\n  globalThis.Response = Response\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ErrorRouteImport } from './routes/error'\nimport { Route as PostsRouteRouteImport } from './routes/posts/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts/$postId'\n\nconst ErrorRoute = ErrorRouteImport.update({\n  id: '/error',\n  path: '/error',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/error' | '/posts/$postId' | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/error' | '/posts/$postId' | '/posts'\n  id: '__root__' | '/' | '/posts' | '/error' | '/posts/$postId' | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  ErrorRoute: typeof ErrorRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/error': {\n      id: '/error'\n      path: '/error'\n      fullPath: '/error'\n      preLoaderRoute: typeof ErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  ErrorRoute: ErrorRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/router.tsx",
    "content": "import { createRouter as createReactRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\n\nexport function createRouter() {\n  return createReactRouter({\n    routeTree,\n    context: {\n      head: '',\n    },\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/routerContext.tsx",
    "content": "export type RouterContext = {\n  head: string\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/routes/__root.tsx",
    "content": "import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport type { RouterContext } from '../routerContext'\n\nexport const Route = createRootRouteWithContext<RouterContext>()({\n  head: () => ({\n    links: [{ rel: 'icon', href: '/images/favicon.ico' }],\n    meta: [\n      {\n        title: 'TanStack Router SSR Basic File Based Streaming',\n      },\n      {\n        charSet: 'UTF-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1.0',\n      },\n    ],\n    scripts: [\n      {\n        src: 'https://unpkg.com/@tailwindcss/browser@4',\n      },\n      ...(!import.meta.env.PROD\n        ? [\n            {\n              type: 'module',\n              children: `import RefreshRuntime from \"/@react-refresh\"\n  RefreshRuntime.injectIntoGlobalHook(window)\n  window.$RefreshReg$ = () => {}\n  window.$RefreshSig$ = () => (type) => type\n  window.__vite_plugin_react_preamble_installed__ = true`,\n            },\n            {\n              type: 'module',\n              src: '/@vite/client',\n            },\n          ]\n        : []),\n      {\n        type: 'module',\n        src: import.meta.env.PROD\n          ? '/static/entry-client.js'\n          : '/src/entry-client.tsx',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html lang=\"en\">\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/error\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Error\n          </Link>\n        </div>\n        <hr />\n        <Outlet /> {/* Start rendering router matches */}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/routes/error.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nasync function loadData() {\n  await new Promise((r) => setTimeout(r, 2000))\n  if (Math.random() > 0.5) throw new Error('Random error in streaming!')\n  return 'Hello!'\n}\n\nexport const Route = createFileRoute('/error')({\n  component: ErrorComponent,\n  loader: () => {\n    if (Math.random() > 0.5) throw new Error('Random error!')\n    return {\n      deferredData: loadData(),\n    }\n  },\n  pendingComponent: () => <p>Loading..</p>,\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return (\n      <div className=\"p-2\">\n        <h3>Caught: {error.message}</h3>\n        <p>(This page has a 75% chance of throwing an error)</p>\n      </div>\n    )\n  },\n})\n\nfunction ErrorComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>\n        The loader of this page will have a 75% chance of throwing an error!\n      </h3>\n\n      <Await promise={Route.useLoaderData().deferredData}>\n        {(data) => <p>Streaming data loaded successfully: {data}</p>}\n      </Await>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/routes/index.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  loader: () => ({\n    date: new Date(),\n    deferred: new Promise<{ date: Date }>((r) =>\n      setTimeout(() => r({ date: new Date() }), 1000),\n    ),\n  }),\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <p>Data: {data.date.getDate()}</p>\n      <Await promise={data.deferred} fallback=\"Loading...\">\n        {(data) => <p>Deferred: {new Date(data.date).getDate()}</p>}\n      </Await>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/routes/posts/$postId.tsx",
    "content": "import { Await, createFileRoute, notFound } from '@tanstack/react-router'\nimport * as React from 'react'\nimport type { PostType } from './route'\n\nasync function fetchPostById(postId: string) {\n  console.info(`Fetching post with id ${postId}...`)\n\n  await new Promise((r) => setTimeout(r, 100 + Math.round(Math.random() * 100)))\n\n  const res = await fetch(\n    `https://jsonplaceholder.typicode.com/posts/${postId}`,\n  )\n\n  if (res.status === 404) throw notFound()\n\n  return res.json() as Promise<PostType>\n}\n\nexport type CommentType = {\n  id: string\n  postId: string\n  name: string\n  email: string\n  body: string\n}\n\nasync function fetchComments(postId: string) {\n  await new Promise((r) => setTimeout(r, 2000))\n\n  return fetch(\n    `https://jsonplaceholder.typicode.com/comments?postId=${postId}`,\n  ).then((r) => r.json() as Promise<Array<CommentType>>)\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const commentsPromise = fetchComments(postId)\n    const post = await fetchPostById(postId)\n\n    return {\n      post,\n      commentsPromise: commentsPromise,\n    }\n  },\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return <div>Failed to load post: {(error as any).message}</div>\n  },\n  notFoundComponent: () => {\n    return <div>Post not found</div>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const { post, commentsPromise } = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Await\n        promise={commentsPromise}\n        fallback={<div>Loading comments...</div>}\n        key={post.id}\n      >\n        {(comments) => {\n          return (\n            <div className=\"space-y-2\">\n              <h5 className=\"text-lg font-bold underline\">Comments</h5>\n              {comments.map((comment) => {\n                return (\n                  <div key={comment.id}>\n                    <h6 className=\"text-md font-bold\">{comment.name}</h6>\n                    <div className=\"text-sm italic opacity-50\">\n                      {comment.email}\n                    </div>\n                    <div className=\"text-sm\">{comment.body}</div>\n                  </div>\n                )\n              })}\n            </div>\n          )\n        }}\n      </Await>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/routes/posts/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return (\n      <div className=\"text-red-500\">Failed to load post: {error.message}</div>\n    )\n  },\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/src/routes/posts/route.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) =>\n      setTimeout(r, 300 + Math.round(Math.random() * 300)),\n    )\n    return fetch('https://jsonplaceholder.typicode.com/posts')\n      .then((d) => d.json() as Promise<Array<PostType>>)\n      .then((d) => d.slice(0, 10))\n  },\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {posts.map((post) => {\n          return (\n            <li key={post.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n        <li className=\"whitespace-nowrap\">\n          <Link\n            to=\"/posts/$postId\"\n            params={{\n              postId: 'does-not-exist',\n            }}\n            className=\"block py-1 text-blue-800 hover:text-blue-600\"\n            activeProps={{ className: 'text-black font-bold' }}\n          >\n            <div>This post does not exist</div>\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"esnext\",\n    \"module\": \"esnext\",\n    \"types\": [\"vite/client\"],\n    \"moduleResolution\": \"bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "examples/react/basic-ssr-streaming-file-based/vite.config.ts",
    "content": "import path from 'node:path'\nimport url from 'node:url'\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport type { BuildEnvironmentOptions } from 'vite'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\n// SSR configuration\nconst ssrBuildConfig: BuildEnvironmentOptions = {\n  ssr: true,\n  outDir: 'dist/server',\n  ssrEmitAssets: true,\n  copyPublicDir: false,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-server.tsx'),\n    output: {\n      entryFileNames: '[name].js',\n      chunkFileNames: 'assets/[name]-[hash].js',\n      assetFileNames: 'assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// Client-specific configuration\nconst clientBuildConfig: BuildEnvironmentOptions = {\n  outDir: 'dist/client',\n  emitAssets: true,\n  copyPublicDir: true,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-client.tsx'),\n    output: {\n      entryFileNames: 'static/[name].js',\n      chunkFileNames: 'static/assets/[name]-[hash].js',\n      assetFileNames: 'static/assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// https://vitejs.dev/config/\nexport default defineConfig((configEnv) => {\n  return {\n    plugins: [\n      tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n      react(),\n    ],\n    build: configEnv.isSsrBuild ? ssrBuildConfig : clientBuildConfig,\n  }\n})\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/README.md",
    "content": "# TanStack Router - Virtual File-Based Routing Example\n\nAn example demonstrating virtual file-based routing.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-virtual-file-based basic-virtual-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Virtual file-based routing\n- Dynamic route generation\n- Programmatic route creation\n- Type-safe virtual routes\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-virtual-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/virtual-file-routes\": \"^1.161.7\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('layout/second-layout.tsx', [\n      route('route-without-file', [\n        route('/layout-a', 'a.tsx'),\n        route('/layout-b', 'b.tsx'),\n      ]),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as postsPostsRouteImport } from './routes/posts/posts'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home'\nimport { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route'\nimport { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index'\nimport { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world'\nimport { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst postsPostsRoute = postsPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsDetailRoute = postsPostsDetailRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second-layout',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst postsPostsHomeRoute = postsPostsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({\n  id: '/classic/hello',\n  path: '/classic/hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({\n  id: '/world',\n  path: '/world',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({\n  id: '/universe',\n  path: '/universe',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/route-without-file/layout-b',\n  path: '/route-without-file/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/route-without-file/layout-a',\n  path: '/route-without-file/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/_first/_second-layout': typeof layoutSecondLayoutRouteWithChildren\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/_first/_second-layout/route-without-file/layout-a': typeof aRoute\n  '/_first/_second-layout/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/_first/_second-layout'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/_first/_second-layout/route-without-file/layout-a'\n    | '/_first/_second-layout/route-without-file/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n  postsPostsRoute: typeof postsPostsRouteWithChildren\n  ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsPostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsPostsDetailRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/_first/_second-layout': {\n      id: '/_first/_second-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsPostsHomeRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/classic/hello': {\n      id: '/classic/hello'\n      path: '/classic/hello'\n      fullPath: '/classic/hello'\n      preLoaderRoute: typeof ClassicHelloRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/classic/hello/': {\n      id: '/classic/hello/'\n      path: '/'\n      fullPath: '/classic/hello/'\n      preLoaderRoute: typeof ClassicHelloIndexRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/world': {\n      id: '/classic/hello/world'\n      path: '/world'\n      fullPath: '/classic/hello/world'\n      preLoaderRoute: typeof ClassicHelloWorldRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/universe': {\n      id: '/classic/hello/universe'\n      path: '/universe'\n      fullPath: '/classic/hello/universe'\n      preLoaderRoute: typeof ClassicHelloUniverseRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-b': {\n      id: '/_first/_second-layout/route-without-file/layout-b'\n      path: '/route-without-file/layout-b'\n      fullPath: '/route-without-file/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-a': {\n      id: '/_first/_second-layout/route-without-file/layout-a'\n      path: '/route-without-file/layout-a'\n      fullPath: '/route-without-file/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ndeclare module './routes/home' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/layout/first-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first',\n    FileRoutesByPath['/_first']['parentRoute'],\n    FileRoutesByPath['/_first']['id'],\n    FileRoutesByPath['/_first']['path'],\n    FileRoutesByPath['/_first']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/route' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello',\n    FileRoutesByPath['/classic/hello']['parentRoute'],\n    FileRoutesByPath['/classic/hello']['id'],\n    FileRoutesByPath['/classic/hello']['path'],\n    FileRoutesByPath['/classic/hello']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/layout/second-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second-layout',\n    FileRoutesByPath['/_first/_second-layout']['parentRoute'],\n    FileRoutesByPath['/_first/_second-layout']['id'],\n    FileRoutesByPath['/_first/_second-layout']['path'],\n    FileRoutesByPath['/_first/_second-layout']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-detail' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/universe' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/universe',\n    FileRoutesByPath['/classic/hello/universe']['parentRoute'],\n    FileRoutesByPath['/classic/hello/universe']['id'],\n    FileRoutesByPath['/classic/hello/universe']['path'],\n    FileRoutesByPath['/classic/hello/universe']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/world' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/world',\n    FileRoutesByPath['/classic/hello/world']['parentRoute'],\n    FileRoutesByPath['/classic/hello/world']['id'],\n    FileRoutesByPath['/classic/hello/world']['path'],\n    FileRoutesByPath['/classic/hello/world']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/index' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/',\n    FileRoutesByPath['/classic/hello/']['parentRoute'],\n    FileRoutesByPath['/classic/hello/']['id'],\n    FileRoutesByPath['/classic/hello/']['path'],\n    FileRoutesByPath['/classic/hello/']['fullPath']\n  >\n}\ndeclare module './routes/a' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second-layout/route-without-file/layout-a',\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-a']['parentRoute'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-a']['id'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-a']['path'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/b' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second-layout/route-without-file/layout-b',\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-b']['parentRoute'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-b']['id'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-b']['path'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-b']['fullPath']\n  >\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\ninterface postsPostsRouteChildren {\n  postsPostsHomeRoute: typeof postsPostsHomeRoute\n  postsPostsDetailRoute: typeof postsPostsDetailRoute\n}\n\nconst postsPostsRouteChildren: postsPostsRouteChildren = {\n  postsPostsHomeRoute: postsPostsHomeRoute,\n  postsPostsDetailRoute: postsPostsDetailRoute,\n}\n\nconst postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(\n  postsPostsRouteChildren,\n)\n\ninterface ClassicHelloRouteRouteChildren {\n  ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute\n  ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute\n  ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute\n}\n\nconst ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {\n  ClassicHelloUniverseRoute: ClassicHelloUniverseRoute,\n  ClassicHelloWorldRoute: ClassicHelloWorldRoute,\n  ClassicHelloIndexRoute: ClassicHelloIndexRoute,\n}\n\nconst ClassicHelloRouteRouteWithChildren =\n  ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n  postsPostsRoute: postsPostsRouteWithChildren,\n  ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          className: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/home.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-without-file/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/route-without-file/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/posts/posts-home.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/posts/posts.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/routes/root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-without-file/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"Preserve\",\n    \"moduleResolution\": \"Bundler\",\n    \"target\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n      virtualRouteConfig: './routes.ts',\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/README.md",
    "content": "# TanStack Router - Virtual Inside File-Based Routing Example\n\nAn example demonstrating virtual routes within a file-based routing structure.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/basic-virtual-inside-file-based basic-virtual-inside-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Combining virtual and file-based routing\n- Hybrid routing approach\n- Dynamic route generation within file-based structure\n- Flexible route configuration\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-virtual-inside-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/virtual-file-routes\": \"^1.161.7\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as postsDetailsRouteImport } from './routes/posts/details'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as postsHomeRouteImport } from './routes/posts/home'\nimport { Route as postsLetsGoIndexRouteImport } from './routes/posts/lets-go/index'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as postsLetsGoDeeperHomeRouteImport } from './routes/posts/lets-go/deeper/home'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsDetailsRoute = postsDetailsRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst postsHomeRoute = postsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst postsLetsGoIndexRoute = postsLetsGoIndexRouteImport.update({\n  id: '/inception/',\n  path: '/inception/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst postsLetsGoDeeperHomeRoute = postsLetsGoDeeperHomeRouteImport.update({\n  id: '/inception/deeper/',\n  path: '/inception/deeper/',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/': typeof postsHomeRoute\n  '/posts/$postId': typeof postsDetailsRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/inception/': typeof postsLetsGoIndexRoute\n  '/posts/inception/deeper/': typeof postsLetsGoDeeperHomeRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof postsHomeRoute\n  '/posts/$postId': typeof postsDetailsRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/inception': typeof postsLetsGoIndexRoute\n  '/posts/inception/deeper': typeof postsLetsGoDeeperHomeRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/': typeof postsHomeRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof postsDetailsRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/inception/': typeof postsLetsGoIndexRoute\n  '/posts/inception/deeper/': typeof postsLetsGoDeeperHomeRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/inception/'\n    | '/posts/inception/deeper/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/inception'\n    | '/posts/inception/deeper'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/posts/'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/posts/inception/'\n    | '/posts/inception/deeper/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsDetailsRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsHomeRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/inception/': {\n      id: '/posts/inception/'\n      path: '/inception'\n      fullPath: '/posts/inception/'\n      preLoaderRoute: typeof postsLetsGoIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/posts/inception/deeper/': {\n      id: '/posts/inception/deeper/'\n      path: '/inception/deeper'\n      fullPath: '/posts/inception/deeper/'\n      preLoaderRoute: typeof postsLetsGoDeeperHomeRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ndeclare module './routes/index' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/_layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout',\n    FileRoutesByPath['/_layout']['parentRoute'],\n    FileRoutesByPath['/_layout']['id'],\n    FileRoutesByPath['/_layout']['path'],\n    FileRoutesByPath['/_layout']['fullPath']\n  >\n}\ndeclare module './routes/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/posts/home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2',\n    FileRoutesByPath['/_layout/_layout-2']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2']['id'],\n    FileRoutesByPath['/_layout/_layout-2']['path'],\n    FileRoutesByPath['/_layout/_layout-2']['fullPath']\n  >\n}\ndeclare module './routes/posts/details' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2/layout-a' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2/layout-a',\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['id'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['path'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2/layout-b' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2/layout-b',\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['id'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['path'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['fullPath']\n  >\n}\ndeclare module './routes/posts/lets-go/index' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/inception/',\n    FileRoutesByPath['/posts/inception/']['parentRoute'],\n    FileRoutesByPath['/posts/inception/']['id'],\n    FileRoutesByPath['/posts/inception/']['path'],\n    FileRoutesByPath['/posts/inception/']['fullPath']\n  >\n}\ndeclare module './routes/posts/lets-go/deeper/home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/inception/deeper/',\n    FileRoutesByPath['/posts/inception/deeper/']['parentRoute'],\n    FileRoutesByPath['/posts/inception/deeper/']['id'],\n    FileRoutesByPath['/posts/inception/deeper/']['path'],\n    FileRoutesByPath['/posts/inception/deeper/']['fullPath']\n  >\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  postsHomeRoute: typeof postsHomeRoute\n  postsDetailsRoute: typeof postsDetailsRoute\n  postsLetsGoIndexRoute: typeof postsLetsGoIndexRoute\n  postsLetsGoDeeperHomeRoute: typeof postsLetsGoDeeperHomeRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  postsHomeRoute: postsHomeRoute,\n  postsDetailsRoute: postsDetailsRoute,\n  postsLetsGoIndexRoute: postsLetsGoIndexRoute,\n  postsLetsGoDeeperHomeRoute: postsLetsGoDeeperHomeRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/_layout.tsx",
    "content": "import { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/index.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/posts/__virtual.ts",
    "content": "import {\n  defineVirtualSubtreeConfig,\n  index,\n  physical,\n  route,\n} from '@tanstack/virtual-file-routes'\n\n// this just shows that you can use an async function to define your virtual routes\nexport default defineVirtualSubtreeConfig(async () => [\n  index('home.tsx'),\n  route('$postId', 'details.tsx'),\n  physical('/inception', 'lets-go'),\n])\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/posts/details.tsx",
    "content": "import * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/posts/home.tsx",
    "content": "import * as React from 'react'\n\nexport const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/posts/lets-go/deeper/__virtual.ts",
    "content": "import {\n  defineVirtualSubtreeConfig,\n  index,\n} from '@tanstack/virtual-file-routes'\n\nexport default defineVirtualSubtreeConfig([index('home.tsx')])\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/posts/lets-go/deeper/home.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /posts/inception/deeper/!</div>,\n})\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/posts/lets-go/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /posts/inception/!</div>,\n})\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/routes/posts.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"module\": \"Preserve\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/basic-virtual-inside-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/deferred-data/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/deferred-data/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/deferred-data/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/deferred-data/README.md",
    "content": "# TanStack Router - Deferred Data Example\n\nAn example demonstrating deferred data loading.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/deferred-data deferred-data\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Deferred data loading\n- Progressive enhancement\n- Streaming data\n- Suspense boundaries\n- Optimized loading states\n"
  },
  {
    "path": "examples/react/deferred-data/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/deferred-data/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-deferred-data\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/deferred-data/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  Await,\n  ErrorComponent,\n  Link,\n  MatchRoute,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  defer,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport axios from 'redaxios'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport './styles.css'\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\ntype CommentType = {\n  id: string\n  postId: string\n  name: string\n  email: string\n  body: string\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 100))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n\n  const commentsPromise = new Promise((r) => setTimeout(r, 2000))\n    .then(() =>\n      axios.get<Array<CommentType>>(\n        `https://jsonplaceholder.typicode.com/comments?postId=${postId}`,\n      ),\n    )\n    .then((r) => r.data)\n\n  const post = await new Promise((r) => setTimeout(r, 1000))\n    .then(() =>\n      axios.get<PostType>(\n        `https://jsonplaceholder.typicode.com/posts/${postId}`,\n      ),\n    )\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n    .then((r) => r.data)\n\n  return {\n    post,\n    commentsPromise: defer(commentsPromise),\n  }\n}\n\nfunction Spinner({ show, wait }: { show?: boolean; wait?: `delay-${number}` }) {\n  return (\n    <div\n      className={`inline-block animate-spin px-3 transition ${\n        (show ?? true)\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n}).update({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = postsRoute.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to={postRoute.to}\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"flex py-1 text-blue-600 hover:opacity-75 gap-2 items-center\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                  <MatchRoute\n                    to={postRoute.to}\n                    params={{\n                      postId: post.id,\n                    }}\n                    pending\n                  >\n                    {(match) => {\n                      return <Spinner show={!!match} wait=\"delay-0\" />\n                    }}\n                  </MatchRoute>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nclass NotFoundError extends Error {}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const { post, commentsPromise } = postRoute.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <React.Suspense\n        fallback={\n          <div className=\"flex items-center gap-2\">\n            <Spinner />\n            Loading comments...\n          </div>\n        }\n        key={post.id}\n      >\n        <Await promise={commentsPromise}>\n          {(comments) => {\n            return (\n              <div className=\"space-y-2\">\n                <h5 className=\"text-lg font-bold underline\">Comments</h5>\n                {comments.map((comment) => {\n                  return (\n                    <div key={comment.id}>\n                      <h6 className=\"text-md font-bold\">{comment.name}</h6>\n                      <div className=\"text-sm italic opacity-50\">\n                        {comment.email}\n                      </div>\n                      <div className=\"text-sm\">{comment.body}</div>\n                    </div>\n                  )\n                })}\n              </div>\n            )\n          }}\n        </Await>\n      </React.Suspense>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/deferred-data/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/deferred-data/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/deferred-data/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/i18n-paraglide/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\ncount.txt\n.env\n.nitro\n.tanstack\n"
  },
  {
    "path": "examples/react/i18n-paraglide/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/README.md",
    "content": "# TanStack Router - i18n with Paraglide Example\n\nThis example shows how to use Paraglide with TanStack Router.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Paraglide Documentation](https://inlang.com/m/gerre34r/library-inlang-paraglideJs)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/i18n-paraglide i18n-paraglide\n```\n\n## Getting started\n\n1. Init Paraglide JS\n\n```bash\nnpx @inlang/paraglide-js@latest init\n```\n\n2. Add the vite plugin to your `vite.config.ts`:\n\n```diff\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n+import { paraglideVitePlugin } from \"@inlang/paraglide-js\";\n\nexport default defineConfig({\n       plugins: [\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n+              paraglideVitePlugin({\n+                      project: \"./project.inlang\",\n+                      outdir: \"./app/paraglide\",\n+              }),\n       ],\n});\n```\n\n3. Done :)\n\nRun the app and start translating. See the [basics documentation](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/basics) for information on how to use Paraglide's messages, parameters, and locale management.\n\n## Rewrite URL\n\nIf you want to handle how the URL looks when the user changes the locale, you can rewrite the URL in the router.\n\n```diff\nimport { createRouter } from \"@tanstack/react-router\";\nimport { routeTree } from \"./routeTree.gen\";\n+import { deLocalizeUrl, localizeUrl } from \"./paraglide/runtime.js\";\n\nconst router = createRouter({\n  routeTree,\n+ rewrite: {\n+   input: ({ url }) => deLocalizeUrl(url),\n+   output: ({ url }) => localizeUrl(url),\n  },\n});\n```\n\nIn `__root.tsx` add a `beforeLoad` hook to check if the user should be redirected and set the html `lang` attribute.\n\nIntercept the request in `server.ts` with the paraglideMiddleware:\n\n```ts\nimport { paraglideMiddleware } from './paraglide/server.js'\nimport handler from '@tanstack/react-start/server-entry'\nexport default {\n  fetch(req: Request): Promise<Response> {\n    return paraglideMiddleware(req, ({ request }) => handler.fetch(request))\n  },\n}\n```\n\nIn `__root.tsx` change the html lang attribute to the current locale.\n\n```tsx\nimport { getLocale } from '../paraglide/runtime.js'\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html lang={getLocale()}>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n## Offline redirect\n\nIf you have an application that needs to work offline, you will need to handle the redirect in the client like this.\n\n```ts\nimport { shouldRedirect } from \"../paraglide/runtime\";\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const decision = await shouldRedirect({ url: window.location.href });\n\n    if (decision.redirectUrl) {\n      throw redirect({ href: decision.redirectUrl.href });\n    }\n  },\n  ...\n});\n```\n\n## Typesafe translated pathnames\n\nIf you don't want to miss any translated path, you can create a `createTranslatedPathnames` function and pass it to the vite plugin.\n\n```ts\nimport { Locale } from '@/paraglide/runtime'\nimport { FileRoutesByTo } from '../routeTree.gen'\n\ntype RoutePath = keyof FileRoutesByTo\n\nconst excludedPaths = ['admin', 'docs', 'api'] as const\n\ntype PublicRoutePath = Exclude<\n  RoutePath,\n  `${string}${(typeof excludedPaths)[number]}${string}`\n>\n\ntype TranslatedPathname = {\n  pattern: string\n  localized: Array<[Locale, string]>\n}\n\nfunction toUrlPattern(path: string) {\n  return (\n    path\n      // catch-all\n      .replace(/\\/\\$$/, '/:path(.*)?')\n      // optional parameters: {-$param}\n      .replace(/\\{-\\$([a-zA-Z0-9_]+)\\}/g, ':$1?')\n      // named parameters: $param\n      .replace(/\\$([a-zA-Z0-9_]+)/g, ':$1')\n      // remove trailing slash\n      .replace(/\\/+$/, '')\n  )\n}\n\nfunction createTranslatedPathnames(\n  input: Record<PublicRoutePath, Record<Locale, string>>,\n): TranslatedPathname[] {\n  return Object.entries(input).map(([pattern, locales]) => ({\n    pattern: toUrlPattern(pattern),\n    localized: Object.entries(locales).map(\n      ([locale, path]) =>\n        [locale as Locale, `/${locale}${toUrlPattern(path)}`] satisfies [\n          Locale,\n          string,\n        ],\n    ),\n  }))\n}\n\nexport const translatedPathnames = createTranslatedPathnames({\n  '/': {\n    en: '/',\n    de: '/',\n  },\n  '/about': {\n    en: '/about',\n    de: '/ueber',\n  },\n})\n```\n\nAnd import into the Paraglide Vite plugin.\n\n## Server-side rendering\n\nFor server-side rendering, check out the [TanStack Start guide](https://github.com/TanStack/router/tree/main/examples/react/start-i18n-paraglide).\n\n## Prerender routes\n\nYou can use the `localizeHref` function to map the routes to localized versions and import into the pages option in the TanStack Start plugin. For this to work you will need to compile paraglide before the build with the CLI.\n\n```ts\nimport { localizeHref } from './paraglide/runtime'\nexport const prerenderRoutes = ['/', '/about'].map((path) => ({\n  path: localizeHref(path),\n  prerender: {\n    enabled: true,\n  },\n}))\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Multi-language support with Paraglide\n- Type-safe translations\n- Locale-based routing\n- Language switching\n- i18n best practices\n"
  },
  {
    "path": "examples/react/i18n-paraglide/index.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <link rel=\"icon\" href=\"/favicon.ico\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <meta\n      name=\"description\"\n      content=\"Web site created using create-tsrouter-app\"\n    />\n    <link rel=\"apple-touch-icon\" href=\"/logo192.png\" />\n    <link rel=\"manifest\" href=\"/manifest.json\" />\n    <title>Create TanStack App - i18n-paraglide</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/i18n-paraglide/messages/de.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Guten Tag {username}\",\n  \"hello_about\": \"Hallo /ueber!\",\n  \"home_page\": \"Startseite\",\n  \"about_page\": \"Über uns\"\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/messages/en.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Hello world {username}\",\n  \"hello_about\": \"Hello /about!\",\n  \"home_page\": \"Home page\",\n  \"about_page\": \"About page\"\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/package.json",
    "content": "{\n  \"name\": \"tanstack-router-i18n-paraglide\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"start\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc\",\n    \"preview\": \"vite preview\",\n    \"test\": \"vitest run\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.1.1\",\n    \"react-dom\": \"^19.1.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.18.6\",\n    \"@types/react\": \"^19.1.13\",\n    \"@types/react-dom\": \"^19.1.9\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.9.2\",\n    \"vite\": \"^8.0.0\",\n    \"@inlang/paraglide-js\": \"^2.4.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/project.inlang/.gitignore",
    "content": "cache"
  },
  {
    "path": "examples/react/i18n-paraglide/project.inlang/project_id",
    "content": "72AJsIR0c0ewzkN33F"
  },
  {
    "path": "examples/react/i18n-paraglide/project.inlang/settings.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/project-settings\",\n  \"baseLocale\": \"en\",\n  \"locales\": [\"en\", \"de\"],\n  \"modules\": [\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js\",\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js\"\n  ],\n  \"plugin.inlang.messageFormat\": {\n    \"pathPattern\": \"./messages/{locale}.json\"\n  }\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/public/manifest.json",
    "content": "{\n  \"short_name\": \"TanStack App\",\n  \"name\": \"Create TanStack App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "examples/react/i18n-paraglide/src/main.tsx",
    "content": "import { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport './styles.css'\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport { deLocalizeUrl, localizeUrl } from './paraglide/runtime.js'\n\n// Create a new router instance\nconst router = createRouter({\n  routeTree,\n  context: {},\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  defaultStructuralSharing: true,\n  defaultPreloadStaleTime: 0,\n\n  rewrite: {\n    input: ({ url }) => deLocalizeUrl(url),\n    output: ({ url }) => localizeUrl(url),\n  },\n})\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\n// Render the app\nconst rootElement = document.getElementById('app')\nif (rootElement && !rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/i18n-paraglide/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute, redirect } from '@tanstack/react-router'\nimport {\n  getLocale,\n  locales,\n  setLocale,\n  shouldRedirect,\n} from '@/paraglide/runtime'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    document.documentElement.setAttribute('lang', getLocale())\n\n    const decision = await shouldRedirect({ url: window.location.href })\n\n    if (decision.redirectUrl) {\n      throw redirect({ href: decision.redirectUrl.href })\n    }\n  },\n  component: () => (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg justify-between\">\n        <div className=\"flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            {m.home_page()}\n          </Link>\n\n          <Link\n            to=\"/about\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            {m.about_page()}\n          </Link>\n        </div>\n\n        <div className=\"flex gap-2 text-lg\">\n          {locales.map((locale) => (\n            <button\n              key={locale}\n              onClick={() => setLocale(locale)}\n              data-active-locale={locale === getLocale()}\n              className=\"rounded p-1 px-2 border border-gray-300 cursor-pointer [&[data-active-locale=true]]:bg-gray-500 [&[data-active-locale=true]]:text-white\"\n            >\n              {locale}\n            </button>\n          ))}\n        </div>\n      </div>\n\n      <hr />\n\n      <div className=\"p-2\">\n        <Outlet />\n      </div>\n    </>\n  ),\n})\n"
  },
  {
    "path": "examples/react/i18n-paraglide/src/routes/about.tsx",
    "content": "import { m } from '@/paraglide/messages'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>{m.hello_about()}</div>\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n\nfunction App() {\n  return (\n    <div>\n      <p>\n        {m.example_message({\n          username: 'TanStack Router!',\n        })}\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "examples/react/i18n-paraglide/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"types\": [\"vite/client\"],\n    \"allowJs\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": true,\n    \"noEmit\": true,\n\n    /* Linting */\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedSideEffectImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  }\n}\n"
  },
  {
    "path": "examples/react/i18n-paraglide/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { resolve } from 'node:path'\nimport { paraglideVitePlugin } from '@inlang/paraglide-js'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    paraglideVitePlugin({\n      project: './project.inlang',\n      outdir: './src/paraglide',\n      outputStructure: 'message-modules',\n      cookieName: 'PARAGLIDE_LOCALE',\n      strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'],\n      urlPatterns: [\n        {\n          pattern: '/',\n          localized: [\n            ['en', '/'],\n            ['de', '/de'],\n          ],\n        },\n        {\n          pattern: '/about',\n          localized: [\n            ['en', '/about'],\n            ['de', '/de/ueber'],\n          ],\n        },\n        {\n          pattern: '/:path(.*)?',\n          localized: [\n            ['en', '/:path(.*)?'],\n            ['de', '/de/:path(.*)?'],\n          ],\n        },\n      ],\n    }),\n    tanstackRouter({ autoCodeSplitting: true }),\n    viteReact(),\n  ],\n  resolve: {\n    alias: {\n      '@': resolve(__dirname, './src'),\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/kitchen-sink/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/README.md",
    "content": "# TanStack Router - Kitchen Sink Example\n\nA comprehensive example demonstrating many TanStack Router features.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/kitchen-sink kitchen-sink\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis \"kitchen sink\" example demonstrates:\n\n- Advanced routing patterns\n- Nested routes\n- Route parameters and search params\n- Data loading\n- Error handling\n- Route guards\n- And many more TanStack Router features\n"
  },
  {
    "path": "examples/react/kitchen-sink/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/kitchen-sink/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-kitchen-sink\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"immer\": \"^10.1.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/src/Expensive.tsx",
    "content": "import * as React from 'react'\n\nexport default function Expensive() {\n  return (\n    <div className={`p-2`}>\n      I am an \"expensive\" component... which really just means that I was\n      code-split 😉\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/src/main.tsx",
    "content": "/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport * as React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  MatchRoute,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  lazyRouteComponent,\n  notFound,\n  redirect,\n  retainSearchParams,\n  useNavigate,\n  useRouter,\n  useRouterState,\n  useSearch,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { z } from 'zod'\nimport {\n  fetchInvoiceById,\n  fetchInvoices,\n  fetchUserById,\n  fetchUsers,\n  patchInvoice,\n  postInvoice,\n} from './mockTodos'\nimport { useMutation } from './useMutation'\nimport type { NotFoundRouteProps } from '@tanstack/react-router'\nimport type { Invoice } from './mockTodos'\nimport './styles.css'\n\n//\n\ntype UsersViewSortBy = 'name' | 'id' | 'email'\n\ntype MissingUserData = {\n  userId: number\n}\n\nfunction isMissingUserData(data: unknown): data is MissingUserData {\n  return (\n    typeof data === 'object' &&\n    data !== null &&\n    typeof (data as { userId?: unknown }).userId === 'number'\n  )\n}\n\nfunction UsersNotFoundComponent({ data, routeId }: NotFoundRouteProps) {\n  const userId = isMissingUserData(data) ? data.userId : undefined\n\n  return (\n    <div className=\"p-4 space-y-2\">\n      <h4 className=\"text-lg font-bold\">User not found</h4>\n      <p>\n        {typeof userId === 'number'\n          ? `We couldn't find a user with ID ${userId}.`\n          : \"We couldn't find the requested user.\"}\n      </p>\n      <p className=\"text-xs text-gray-500\">\n        Rendered by the \"{routeId}\" route.\n      </p>\n      <p className=\"text-sm text-gray-500\">\n        Pick another user from the list on the left to continue.\n      </p>\n    </div>\n  )\n}\n\nconst rootRoute = createRootRouteWithContext<{\n  auth: Auth\n}>()({\n  component: RootComponent,\n})\n\nfunction RouterSpinner() {\n  const isLoading = useRouterState({ select: (s) => s.status === 'pending' })\n  return <Spinner show={isLoading} />\n}\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className={`min-h-screen flex flex-col`}>\n        <div className={`flex items-center border-b gap-2`}>\n          <h1 className={`text-3xl p-2`}>Kitchen Sink</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div className={`text-3xl`}>\n            <RouterSpinner />\n          </div>\n        </div>\n        <div className={`flex-1 flex`}>\n          <div className={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n                ['/expensive', 'Expensive'],\n                ['/route-a', 'Pathless Layout A'],\n                ['/route-b', 'Pathless Layout B'],\n                ['/profile', 'Profile'],\n                ...(auth.status === 'loggedOut' ? [['/login', 'Login']] : []),\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div key={to}>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    className={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ className: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div className={`flex-1 border-l`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className={`p-2`}>\n      <div className={`text-lg`}>Welcome Home!</div>\n      <hr className={`my-2`} />\n      <Link\n        to={invoiceRoute.to}\n        params={{\n          invoiceId: 3,\n        }}\n        className={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr className={`my-2`} />\n      <div className={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr className={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr className={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n\nconst dashboardLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'dashboard',\n  component: DashboardLayoutComponent,\n})\n\nfunction DashboardLayoutComponent() {\n  return (\n    <>\n      <div className=\"flex items-center border-b\">\n        <h2 className=\"text-xl p-2\">Dashboard</h2>\n      </div>\n      <div className=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['/dashboard', 'Summary', true],\n            ['/dashboard/invoices', 'Invoices'],\n            ['/dashboard/users', 'Users'],\n          ] as const\n        ).map(([to, label, exact]) => {\n          return (\n            <Link\n              key={to}\n              to={to}\n              activeOptions={{ exact }}\n              activeProps={{ className: `font-bold` }}\n              className=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n\nconst dashboardIndexRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: '/',\n  loader: () => fetchInvoices(),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const invoices = dashboardIndexRoute.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{invoices.length} total invoices</strong>.\n      </div>\n    </div>\n  )\n}\n\nconst invoicesLayoutRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: 'invoices',\n  loader: () => fetchInvoices(),\n  component: InvoicesLayoutComponent,\n})\n\nfunction InvoicesLayoutComponent() {\n  const invoices = invoicesLayoutRoute.useLoaderData()\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y w-48\">\n        {invoices.map((invoice) => {\n          return (\n            <div key={invoice.id}>\n              <Link\n                to=\"/dashboard/invoices/$invoiceId\"\n                params={{\n                  invoiceId: invoice.id,\n                }}\n                preload=\"intent\"\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold ` }}\n              >\n                <pre className=\"text-sm\">\n                  #{invoice.id} - {invoice.title.slice(0, 10)}{' '}\n                  {/* {updateSubmission ? (\n                      <Spinner />\n                    ) : ( */}\n                  <MatchRoute\n                    to={invoiceRoute.to}\n                    params={{\n                      invoiceId: invoice.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                  {/* )} */}\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex-1 border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesLayoutRoute,\n  path: '/',\n  component: InvoicesIndexComponent,\n})\n\nfunction InvoicesIndexComponent() {\n  const createInvoiceMutation = useMutation({\n    fn: postInvoice,\n    onSuccess: () => router.invalidate(),\n  })\n\n  return (\n    <>\n      <div className=\"p-2\">\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n            createInvoiceMutation.mutate({\n              title: formData.get('title') as string,\n              body: formData.get('body') as string,\n            })\n          }}\n          className=\"space-y-2\"\n        >\n          <div>Create a new Invoice:</div>\n          <InvoiceFields invoice={{} as Invoice} />\n          <div>\n            <button\n              className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              disabled={createInvoiceMutation.status === 'pending'}\n            >\n              {createInvoiceMutation.status === 'pending' ? (\n                <>\n                  Creating <Spinner />\n                </>\n              ) : (\n                'Create'\n              )}\n            </button>\n          </div>\n          {createInvoiceMutation.status === 'success' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Created!\n            </div>\n          ) : createInvoiceMutation.status === 'error' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to create.\n            </div>\n          ) : null}\n        </form>\n      </div>\n    </>\n  )\n}\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesLayoutRoute,\n  path: '$invoiceId',\n  params: {\n    parse: (params) => ({\n      invoiceId: z.number().int().parse(Number(params.invoiceId)),\n    }),\n    stringify: ({ invoiceId }) => ({ invoiceId: `${invoiceId}` }),\n  },\n  validateSearch: (search) =>\n    z\n      .object({\n        showNotes: z.boolean().optional(),\n        notes: z.string().optional(),\n      })\n      .parse(search),\n  loader: ({ params: { invoiceId } }) => fetchInvoiceById(invoiceId),\n  component: InvoiceComponent,\n  pendingComponent: () => <Spinner />,\n})\n\nfunction InvoiceComponent() {\n  const search = invoiceRoute.useSearch()\n  const navigate = useNavigate({ from: invoiceRoute.fullPath })\n  const invoice = invoiceRoute.useLoaderData()\n  const updateInvoiceMutation = useMutation({\n    fn: patchInvoice,\n    onSuccess: () => router.invalidate(),\n  })\n  const [notes, setNotes] = React.useState(search.notes ?? '')\n  React.useEffect(() => {\n    navigate({\n      search: (old) => ({\n        ...old,\n        notes: notes ? notes : undefined,\n      }),\n      params: true,\n      replace: true,\n    })\n  }, [notes])\n\n  return (\n    <form\n      key={invoice.id}\n      onSubmit={(event) => {\n        event.preventDefault()\n        event.stopPropagation()\n        const formData = new FormData(event.target as HTMLFormElement)\n        updateInvoiceMutation.mutate({\n          id: invoice.id,\n          title: formData.get('title') as string,\n          body: formData.get('body') as string,\n        })\n      }}\n      className=\"p-2 space-y-2\"\n    >\n      <InvoiceFields\n        invoice={invoice}\n        disabled={updateInvoiceMutation.status === 'pending'}\n      />\n      <div>\n        <Link\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          className=\"text-blue-700\"\n          from={invoiceRoute.fullPath}\n          params={true}\n        >\n          {search.showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search.showNotes ? (\n          <>\n            <div>\n              <div className=\"h-2\" />\n              <textarea\n                value={notes}\n                onChange={(e) => {\n                  setNotes(e.target.value)\n                }}\n                rows={5}\n                className=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div className=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n      <div>\n        <button\n          className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n          disabled={updateInvoiceMutation.status === 'pending'}\n        >\n          Save\n        </button>\n      </div>\n      {updateInvoiceMutation.variables?.id === invoice.id ? (\n        <div key={updateInvoiceMutation.submittedAt}>\n          {updateInvoiceMutation.status === 'success' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Saved!\n            </div>\n          ) : updateInvoiceMutation.status === 'error' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to save.\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n    </form>\n  )\n}\n\nconst usersLayoutRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: 'users',\n  validateSearch: z.object({\n    usersView: z\n      .object({\n        sortBy: z.enum(['name', 'id', 'email']).optional(),\n        filterBy: z.string().optional(),\n      })\n      .optional(),\n  }).parse,\n  search: {\n    // Retain the usersView search param while navigating\n    // within or to this route (or it's children!)\n    middlewares: [retainSearchParams(['usersView'])],\n  },\n  loaderDeps: ({ search: { usersView } }) => ({\n    filterBy: usersView?.filterBy,\n    sortBy: usersView?.sortBy ?? 'name',\n  }),\n  loader: ({ deps }) => fetchUsers(deps),\n  notFoundComponent: UsersNotFoundComponent,\n  component: UsersLayoutComponent,\n})\n\nfunction UsersLayoutComponent() {\n  const navigate = useNavigate({ from: usersLayoutRoute.fullPath })\n  const { usersView } = usersLayoutRoute.useSearch()\n  const users = usersLayoutRoute.useLoaderData()\n  const sortBy = usersView?.sortBy ?? 'name'\n  const filterBy = usersView?.filterBy\n\n  const [filterDraft, setFilterDraft] = React.useState(filterBy ?? '')\n\n  React.useEffect(() => {\n    setFilterDraft(filterBy ?? '')\n  }, [filterBy])\n\n  const sortedUsers = React.useMemo(() => {\n    if (!users) return []\n\n    return !sortBy\n      ? users\n      : [...users].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n  }, [users, sortBy])\n\n  const filteredUsers = React.useMemo(() => {\n    if (!filterBy) return sortedUsers\n\n    return sortedUsers.filter((user) =>\n      user.name.toLowerCase().includes(filterBy.toLowerCase()),\n    )\n  }, [sortedUsers, filterBy])\n\n  const setSortBy = (sortBy: UsersViewSortBy) =>\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...(old.usersView ?? {}),\n            sortBy,\n          },\n        }\n      },\n      replace: true,\n    })\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...old.usersView,\n            filterBy: filterDraft || undefined,\n          },\n        }\n      },\n      replace: true,\n    })\n  }, [filterDraft])\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y\">\n        <div className=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Sort By:</div>\n          <select\n            value={sortBy}\n            onChange={(e) => setSortBy(e.target.value as UsersViewSortBy)}\n            className=\"flex-1 border p-1 px-2 rounded-sm\"\n          >\n            {['name', 'id', 'email'].map((d) => {\n              return <option key={d} value={d} children={d} />\n            })}\n          </select>\n        </div>\n        <div className=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Filter By:</div>\n          <input\n            value={filterDraft}\n            onChange={(e) => setFilterDraft(e.target.value)}\n            placeholder=\"Search Names...\"\n            className=\"min-w-0 flex-1 border p-1 px-2 rounded-sm\"\n          />\n        </div>\n        {filteredUsers.map((user) => {\n          return (\n            <div key={user.id}>\n              <Link\n                to=\"/dashboard/users/user\"\n                search={{\n                  userId: user.id,\n                }}\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  {user.name}{' '}\n                  <MatchRoute\n                    to={userRoute.to}\n                    search={{\n                      userId: user.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n        <div className=\"px-3 py-2 text-xs text-gray-500 bg-gray-100 dark:bg-gray-800/60\">\n          Need to see how not-found errors look?{' '}\n          <Link\n            to={userRoute.to}\n            search={{\n              userId: 404,\n            }}\n            className=\"text-blue-700\"\n          >\n            Try loading user 404\n          </Link>\n        </div>\n      </div>\n      <div className=\"flex-initial border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst usersIndexRoute = createRoute({\n  getParentRoute: () => usersLayoutRoute,\n  path: '/',\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <p>\n        Normally, setting default search parameters would either need to be done\n        manually in every link to a page, or as a side-effect (not a great\n        experience).\n      </p>\n      <p>\n        Instead, we can use <strong>search filters</strong> to provide defaults\n        or even persist search params for links to routes (and child routes).\n      </p>\n      <p>\n        A good example of this is the sorting and filtering of the users list.\n        In a traditional router, both would be lost while navigating around\n        individual users or even changing each sort/filter option unless each\n        state was manually passed from the current route into each new link we\n        created (that's a lot of tedious and error-prone work). With TanStack\n        router and search filters, they are persisted with little effort.\n      </p>\n    </div>\n  )\n}\n\nconst userRoute = createRoute({\n  getParentRoute: () => usersLayoutRoute,\n  path: 'user',\n  validateSearch: z.object({\n    userId: z.number(),\n  }),\n  loaderDeps: ({ search: { userId } }) => ({\n    userId,\n  }),\n  loader: async ({ deps: { userId } }) => {\n    const user = await fetchUserById(userId)\n\n    if (!user) {\n      throw notFound({\n        data: {\n          userId,\n        },\n      })\n    }\n\n    return user\n  },\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const user = userRoute.useLoaderData()\n\n  return (\n    <>\n      <h4 className=\"p-2 font-bold\">{user?.name}</h4>\n      <pre className=\"text-sm whitespace-pre-wrap\">\n        {JSON.stringify(user, null, 2)}\n      </pre>\n    </>\n  )\n}\n\nconst expensiveRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  // Your elements can be asynchronous, which means you can code-split!\n  path: 'expensive',\n  component: lazyRouteComponent(() => import('./Expensive')),\n})\n\nconst authPathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'auth',\n  // Before loading, authenticate the user via our auth context\n  // This will also happen during prefetching (e.g. hovering over links, etc)\n  beforeLoad: ({ context, location }) => {\n    // If the user is logged out, redirect them to the login page\n    if (context.auth.status === 'loggedOut') {\n      console.log(location)\n      throw redirect({\n        to: loginRoute.to,\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n\n    // Otherwise, return the user in context\n    return {\n      username: auth.username,\n    }\n  },\n})\n\nconst profileRoute = createRoute({\n  getParentRoute: () => authPathlessLayoutRoute,\n  path: 'profile',\n  component: ProfileComponent,\n})\n\nfunction ProfileComponent() {\n  const { username } = profileRoute.useRouteContext()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <div>\n        Username:<strong>{username}</strong>\n      </div>\n      <button\n        className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n        onClick={() => {\n          auth.logout()\n          router.invalidate()\n        }}\n      >\n        Log out\n      </button>\n    </div>\n  )\n}\n\nconst loginRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'login',\n  validateSearch: z.object({\n    redirect: z.string().optional(),\n  }),\n}).update({\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const { auth, status } = loginRoute.useRouteContext({\n    select: ({ auth }) => ({ auth, status: auth.status }),\n  })\n  const search = useSearch({ from: loginRoute.fullPath })\n  const [username, setUsername] = React.useState('')\n\n  const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n    e.preventDefault()\n    auth.login(username)\n    router.invalidate()\n  }\n\n  // Ah, the subtle nuances of client side auth. 🙄\n  React.useLayoutEffect(() => {\n    if (status === 'loggedIn' && search.redirect) {\n      router.history.push(search.redirect)\n    }\n  }, [status, search.redirect])\n\n  return status === 'loggedIn' ? (\n    <div>\n      Logged in as <strong>{auth.username}</strong>\n      <div className=\"h-2\" />\n      <button\n        onClick={() => {\n          auth.logout()\n          router.invalidate()\n        }}\n        className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n      >\n        Log out\n      </button>\n      <div className=\"h-2\" />\n    </div>\n  ) : (\n    <div className=\"p-2\">\n      <div>You must log in!</div>\n      <div className=\"h-2\" />\n      <form onSubmit={onSubmit} className=\"flex gap-2\">\n        <input\n          value={username}\n          onChange={(e) => setUsername(e.target.value)}\n          placeholder=\"Username\"\n          className=\"border p-1 px-2 rounded-sm\"\n        />\n        <button className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\">\n          Login\n        </button>\n      </form>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'pathless-layout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>Pathless Layout</div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return (\n    <div>\n      <div>I'm A</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return (\n    <div>\n      <div>I'm B</div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  dashboardLayoutRoute.addChildren([\n    dashboardIndexRoute,\n    invoicesLayoutRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n    usersLayoutRoute.addChildren([usersIndexRoute, userRoute]),\n  ]),\n  expensiveRoute,\n  authPathlessLayoutRoute.addChildren([profileRoute]),\n  loginRoute,\n  pathlessLayoutRoute.addChildren([pathlessLayoutARoute, pathlessLayoutBRoute]),\n])\n\nconst router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div className={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,\n  context: {\n    auth: undefined!, // We'll inject this when we render\n  },\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst auth: Auth = {\n  status: 'loggedOut',\n  username: undefined,\n  login: (username: string) => {\n    auth.username = username\n    auth.status = 'loggedIn'\n  },\n  logout: () => {\n    auth.status = 'loggedOut'\n    auth.username = undefined\n  },\n}\n\nfunction App() {\n  // This stuff is just to tweak our sandbox setup in real-time\n  const [loaderDelay, setLoaderDelay] = useSessionStorage('loaderDelay', 500)\n  const [pendingMs, setPendingMs] = useSessionStorage('pendingMs', 1000)\n  const [pendingMinMs, setPendingMinMs] = useSessionStorage('pendingMinMs', 500)\n\n  return (\n    <>\n      <div className=\"text-xs fixed w-52 shadow-md shadow-black/20 rounded-sm bottom-2 left-2 bg-white dark:bg-gray-800 bg-opacity-75 border-b flex flex-col gap-1 flex-wrap items-left divide-y\">\n        <div className=\"p-2 space-y-2\">\n          <div className=\"flex gap-2\">\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(150)\n              }}\n            >\n              Fast\n            </button>\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(500)\n              }}\n            >\n              Fast 3G\n            </button>\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(2000)\n              }}\n            >\n              Slow 3G\n            </button>\n          </div>\n          <div>\n            <div>Loader Delay: {loaderDelay}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={loaderDelay}\n              onChange={(e) => setLoaderDelay(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n        </div>\n        <div className=\"p-2 space-y-2\">\n          <div className=\"flex gap-2\">\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setPendingMs(1000)\n                setPendingMinMs(500)\n              }}\n            >\n              Reset to Default\n            </button>\n          </div>\n          <div>\n            <div>defaultPendingMs: {pendingMs}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMs}\n              onChange={(e) => setPendingMs(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n          <div>\n            <div>defaultPendingMinMs: {pendingMinMs}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMinMs}\n              onChange={(e) => setPendingMinMs(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n        </div>\n      </div>\n      <RouterProvider\n        router={router}\n        defaultPreload=\"intent\"\n        defaultPendingMs={pendingMs}\n        defaultPendingMinMs={pendingMinMs}\n        context={{\n          auth,\n        }}\n      />\n    </>\n  )\n}\n\nfunction InvoiceFields({\n  invoice,\n  disabled,\n}: {\n  invoice: Invoice\n  disabled?: boolean\n}) {\n  return (\n    <div className=\"space-y-2\">\n      <h2 className=\"font-bold text-lg\">\n        <input\n          name=\"title\"\n          defaultValue={invoice.title}\n          placeholder=\"Invoice Title\"\n          className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n          disabled={disabled}\n        />\n      </h2>\n      <div>\n        <textarea\n          name=\"body\"\n          defaultValue={invoice.body}\n          rows={6}\n          placeholder=\"Invoice Body...\"\n          className=\"border border-opacity-50 p-2 rounded-sm w-full\"\n          disabled={disabled}\n        />\n      </div>\n    </div>\n  )\n}\n\ntype Auth = {\n  login: (username: string) => void\n  logout: () => void\n  status: 'loggedOut' | 'loggedIn'\n  username?: string\n}\n\nfunction Spinner({ show, wait }: { show?: boolean; wait?: `delay-${number}` }) {\n  return (\n    <div\n      className={`inline-block animate-spin px-3 transition ${\n        (show ?? true)\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n\nfunction useSessionStorage<T>(key: string, initialValue: T) {\n  const state = React.useState<T>(() => {\n    const stored = sessionStorage.getItem(key)\n    return stored ? JSON.parse(stored) : initialValue\n  })\n\n  React.useEffect(() => {\n    sessionStorage.setItem(key, JSON.stringify(state[0]))\n  }, [state[0]])\n\n  return state\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/src/mockTodos.ts",
    "content": "import axios from 'redaxios'\nimport { produce } from 'immer'\nimport { actionDelayFn, loaderDelayFn, shuffle } from './utils'\n\ntype PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> &\n  Required<Pick<TValue, TKey>>\n\nexport type Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nlet invoices: Array<Invoice> = null!\nlet users: Array<User> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\nlet usersPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nconst ensureUsers = async () => {\n  if (!usersPromise) {\n    usersPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/users',\n      )\n      users = data.slice(0, 10)\n    })\n  }\n\n  await usersPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n\nexport async function postInvoice(partialInvoice: Partial<Invoice>) {\n  return actionDelayFn(() => {\n    if (partialInvoice.title?.includes('error')) {\n      console.error('error')\n      throw new Error('Ouch!')\n    }\n    const invoice = {\n      id: invoices.length + 1,\n      title:\n        partialInvoice.title ?? `New Invoice ${String(Date.now()).slice(0, 5)}`,\n      body:\n        partialInvoice.body ??\n        shuffle(\n          `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n      Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. \n      Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna.  Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.\n      `.split(' '),\n        ).join(' '),\n    }\n    invoices = [...invoices, invoice]\n    return invoice\n  })\n}\n\nexport async function patchInvoice({\n  id,\n  ...updatedInvoice\n}: PickAsRequired<Partial<Invoice>, 'id'>) {\n  return actionDelayFn(() => {\n    invoices = produce(invoices, (draft) => {\n      const invoice = draft.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found.')\n      }\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (updatedInvoice.title?.toLocaleLowerCase()?.includes('error')) {\n        throw new Error('Ouch!')\n      }\n      Object.assign(invoice, updatedInvoice)\n    })\n\n    return invoices.find((d) => d.id === id)\n  })\n}\n\nexport type UsersSortBy = 'name' | 'id' | 'email'\n\nexport async function fetchUsers({\n  filterBy,\n  sortBy,\n}: { filterBy?: string; sortBy?: UsersSortBy } = {}) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => {\n      let usersDraft = users\n\n      if (filterBy) {\n        usersDraft = usersDraft.filter((d) =>\n          d.name.toLowerCase().includes(filterBy.toLowerCase()),\n        )\n      }\n\n      if (sortBy) {\n        usersDraft = [...usersDraft].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n      }\n\n      return usersDraft\n    }),\n  )\n}\n\nexport async function fetchUserById(id: number) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => users.find((d) => d.id === id)),\n  )\n}\n\nexport async function fetchRandomNumber() {\n  return loaderDelayFn(() => {\n    return Math.random()\n  })\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/src/useMutation.tsx",
    "content": "import * as React from 'react'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = React.useState<number | undefined>()\n  const [variables, setVariables] = React.useState<TVariables | undefined>()\n  const [error, setError] = React.useState<TError | undefined>()\n  const [data, setData] = React.useState<TData | undefined>()\n  const [status, setStatus] = React.useState<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = React.useCallback(\n    async (variables: TVariables): Promise<TData | undefined> => {\n      setStatus('pending')\n      setSubmittedAt(Date.now())\n      setVariables(variables)\n      //\n      try {\n        const data = await opts.fn(variables)\n        await opts.onSuccess?.({ data })\n        setStatus('success')\n        setError(undefined)\n        setData(data)\n        return data\n      } catch (err: any) {\n        setStatus('error')\n        setError(err)\n      }\n    },\n    [opts.fn],\n  )\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/src/utils.tsx",
    "content": "export async function loaderDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\nexport async function actionDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('actionDelay') ?? 0)\n  await new Promise((r) => setTimeout(r, delay))\n  return fn()\n}\n\nexport function shuffle<T>(arr: Array<T>): Array<T> {\n  let i = arr.length\n  if (i == 0) return arr\n  const copy = [...arr]\n  while (--i) {\n    const j = Math.floor(Math.random() * (i + 1))\n    const a = copy[i]\n    const b = copy[j]\n    copy[i] = b!\n    copy[j] = a!\n  }\n  return copy\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/README.md",
    "content": "# TanStack Router - Kitchen Sink File-Based Example\n\nA comprehensive file-based routing example demonstrating many TanStack Router features.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/kitchen-sink-file-based kitchen-sink-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis \"kitchen sink\" example with file-based routing demonstrates:\n\n- File-based route generation\n- Advanced routing patterns\n- Nested routes\n- Route parameters and search params\n- Data loading\n- Error handling\n- Route guards\n- Type-safe file-based routes\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-kitchen-sink-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"immer\": \"^10.1.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/components/Breadcrumbs.tsx",
    "content": "import { isMatch, Link, useMatches } from '@tanstack/react-router'\n\nexport const Breadcrumbs = () => {\n  const matches = useMatches()\n\n  if (matches.some((match) => match.status === 'pending')) return null\n\n  const matchesWithCrumbs = matches.filter((match) =>\n    isMatch(match, 'loaderData.crumb'),\n  )\n\n  return (\n    <nav>\n      <ul className=\"flex gap-2 items-center\">\n        {matchesWithCrumbs.map((match, i) => (\n          <li className=\"flex gap-2\">\n            <Link className=\"text-blue-700\" from={match.fullPath}>\n              {match.loaderData?.crumb}\n            </Link>\n            {i + 1 < matchesWithCrumbs.length ? (\n              <span className=\"\">{'>'}</span>\n            ) : null}\n          </li>\n        ))}\n      </ul>\n    </nav>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/components/InvoiceFields.tsx",
    "content": "/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport * as React from 'react'\nimport type { Invoice } from '../utils/mockTodos'\n\nexport function InvoiceFields({\n  invoice,\n  disabled,\n}: {\n  invoice: Invoice\n  disabled?: boolean\n}) {\n  return (\n    <div className=\"space-y-2\">\n      <h2 className=\"font-bold text-lg\">\n        <input\n          name=\"title\"\n          defaultValue={invoice?.title}\n          placeholder=\"Invoice Title\"\n          className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n          disabled={disabled}\n        />\n      </h2>\n      <div>\n        <textarea\n          name=\"body\"\n          defaultValue={invoice?.body}\n          rows={6}\n          placeholder=\"Invoice Body...\"\n          className=\"border border-opacity-50 p-2 rounded-sm w-full\"\n          disabled={disabled}\n        />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/components/Spinner.tsx",
    "content": "import * as React from 'react'\n\nexport function Spinner({\n  show,\n  wait,\n}: {\n  show?: boolean\n  wait?: `delay-${number}`\n}) {\n  return (\n    <div\n      className={`inline-block animate-spin px-3 transition ${\n        (show ?? true)\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/hooks/useMutation.tsx",
    "content": "import * as React from 'react'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = React.useState<number | undefined>()\n  const [variables, setVariables] = React.useState<TVariables | undefined>()\n  const [error, setError] = React.useState<TError | undefined>()\n  const [data, setData] = React.useState<TData | undefined>()\n  const [status, setStatus] = React.useState<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = React.useCallback(\n    async (variables: TVariables): Promise<TData | undefined> => {\n      setStatus('pending')\n      setSubmittedAt(Date.now())\n      setVariables(variables)\n      //\n      try {\n        const data = await opts.fn(variables)\n        await opts.onSuccess?.({ data })\n        setStatus('success')\n        setError(undefined)\n        setData(data)\n        return data\n      } catch (err: any) {\n        setStatus('error')\n        setError(err)\n      }\n    },\n    [opts.fn],\n  )\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/hooks/useSessionStorage.tsx",
    "content": "import * as React from 'react'\n\nexport function useSessionStorage<T>(key: string, initialValue: T) {\n  const state = React.useState<T>(() => {\n    const stored = sessionStorage.getItem(key)\n    return stored ? JSON.parse(stored) : initialValue\n  })\n\n  React.useEffect(() => {\n    sessionStorage.setItem(key, JSON.stringify(state[0]))\n  }, [state[0]])\n\n  return state\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/main.tsx",
    "content": "import * as React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  RouterProvider,\n  createRouter,\n} from '@tanstack/react-router'\nimport { auth } from './utils/auth'\nimport { Spinner } from './components/Spinner'\nimport { routeTree } from './routeTree.gen'\nimport { useSessionStorage } from './hooks/useSessionStorage'\nimport './styles.css'\n\n//\n\nconst router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div className={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,\n  context: {\n    auth: undefined!, // We'll inject this when we render\n  },\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction App() {\n  // This stuff is just to tweak our sandbox setup in real-time\n  const [loaderDelay, setLoaderDelay] = useSessionStorage('loaderDelay', 500)\n  const [pendingMs, setPendingMs] = useSessionStorage('pendingMs', 1000)\n  const [pendingMinMs, setPendingMinMs] = useSessionStorage('pendingMinMs', 500)\n\n  return (\n    <>\n      <div className=\"text-xs fixed w-52 shadow-md shadow-black/20 rounded-sm bottom-2 left-2 bg-white dark:bg-gray-800 bg-opacity-75 border-b flex flex-col gap-1 flex-wrap items-left divide-y\">\n        <div className=\"p-2 space-y-2\">\n          <div className=\"flex gap-2\">\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(150)\n              }}\n            >\n              Fast\n            </button>\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(500)\n              }}\n            >\n              Fast 3G\n            </button>\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(2000)\n              }}\n            >\n              Slow 3G\n            </button>\n          </div>\n          <div>\n            <div>Loader Delay: {loaderDelay}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={loaderDelay}\n              onChange={(e) => setLoaderDelay(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n        </div>\n        <div className=\"p-2 space-y-2\">\n          <div className=\"flex gap-2\">\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setPendingMs(1000)\n                setPendingMinMs(500)\n              }}\n            >\n              Reset to Default\n            </button>\n          </div>\n          <div>\n            <div>defaultPendingMs: {pendingMs}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMs}\n              onChange={(e) => setPendingMs(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n          <div>\n            <div>defaultPendingMinMs: {pendingMinMs}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMinMs}\n              onChange={(e) => setPendingMinMs(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n        </div>\n      </div>\n      <RouterProvider\n        router={router}\n        defaultPreload=\"intent\"\n        defaultPendingMs={pendingMs}\n        defaultPendingMinMs={pendingMinMs}\n        context={{\n          auth,\n        }}\n      />\n    </>\n  )\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\n// Import Routes\n\nimport { Route as rootRoute } from './routes/__root'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as AuthRouteImport } from './routes/_auth'\nimport { Route as DashboardRouteRouteImport } from './routes/dashboard.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ExpensiveIndexRouteImport } from './routes/expensive/index'\nimport { Route as DashboardIndexRouteImport } from './routes/dashboard.index'\nimport { Route as PathlessLayoutRouteBRouteImport } from './routes/_pathlessLayout.route-b'\nimport { Route as PathlessLayoutRouteARouteImport } from './routes/_pathlessLayout.route-a'\nimport { Route as AuthProfileRouteImport } from './routes/_auth.profile'\nimport { Route as thisFolderIsNotInTheUrlRouteGroupRouteImport } from './routes/(this-folder-is-not-in-the-url)/route-group'\nimport { Route as DashboardUsersRouteRouteImport } from './routes/dashboard.users.route'\nimport { Route as DashboardInvoicesRouteRouteImport } from './routes/dashboard.invoices.route'\nimport { Route as DashboardUsersIndexRouteImport } from './routes/dashboard.users.index'\nimport { Route as DashboardInvoicesIndexRouteImport } from './routes/dashboard.invoices.index'\nimport { Route as DashboardUsersUserRouteImport } from './routes/dashboard.users.user'\nimport { Route as DashboardInvoicesInvoiceIdRouteImport } from './routes/dashboard.invoices.$invoiceId'\n\n// Create/Update Routes\n\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst AuthRoute = AuthRouteImport.update({\n  id: '/_auth',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst DashboardRouteRoute = DashboardRouteRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst ExpensiveIndexRoute = ExpensiveIndexRouteImport.update({\n  id: '/expensive/',\n  path: '/expensive/',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst DashboardIndexRoute = DashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\n\nconst PathlessLayoutRouteBRoute = PathlessLayoutRouteBRouteImport.update({\n  id: '/route-b',\n  path: '/route-b',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\n\nconst PathlessLayoutRouteARoute = PathlessLayoutRouteARouteImport.update({\n  id: '/route-a',\n  path: '/route-a',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\n\nconst AuthProfileRoute = AuthProfileRouteImport.update({\n  id: '/profile',\n  path: '/profile',\n  getParentRoute: () => AuthRoute,\n} as any)\n\nconst thisFolderIsNotInTheUrlRouteGroupRoute =\n  thisFolderIsNotInTheUrlRouteGroupRouteImport.update({\n    id: '/(this-folder-is-not-in-the-url)/route-group',\n    path: '/route-group',\n    getParentRoute: () => rootRoute,\n  } as any)\n\nconst DashboardUsersRouteRoute = DashboardUsersRouteRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\n\nconst DashboardInvoicesRouteRoute = DashboardInvoicesRouteRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\n\nconst DashboardUsersIndexRoute = DashboardUsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardUsersRouteRoute,\n} as any)\n\nconst DashboardInvoicesIndexRoute = DashboardInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardInvoicesRouteRoute,\n} as any)\n\nconst DashboardUsersUserRoute = DashboardUsersUserRouteImport.update({\n  id: '/user',\n  path: '/user',\n  getParentRoute: () => DashboardUsersRouteRoute,\n} as any)\n\nconst DashboardInvoicesInvoiceIdRoute =\n  DashboardInvoicesInvoiceIdRouteImport.update({\n    id: '/$invoiceId',\n    path: '/$invoiceId',\n    getParentRoute: () => DashboardInvoicesRouteRoute,\n  } as any)\n\n// Populate the FileRoutesByPath interface\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardRouteRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof AuthRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/dashboard/invoices': {\n      id: '/dashboard/invoices'\n      path: '/invoices'\n      fullPath: '/dashboard/invoices'\n      preLoaderRoute: typeof DashboardInvoicesRouteRouteImport\n      parentRoute: typeof DashboardRouteRouteImport\n    }\n    '/dashboard/users': {\n      id: '/dashboard/users'\n      path: '/users'\n      fullPath: '/dashboard/users'\n      preLoaderRoute: typeof DashboardUsersRouteRouteImport\n      parentRoute: typeof DashboardRouteRouteImport\n    }\n    '/(this-folder-is-not-in-the-url)/route-group': {\n      id: '/(this-folder-is-not-in-the-url)/route-group'\n      path: '/route-group'\n      fullPath: '/route-group'\n      preLoaderRoute: typeof thisFolderIsNotInTheUrlRouteGroupRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/_auth/profile': {\n      id: '/_auth/profile'\n      path: '/profile'\n      fullPath: '/profile'\n      preLoaderRoute: typeof AuthProfileRouteImport\n      parentRoute: typeof AuthRouteImport\n    }\n    '/_pathlessLayout/route-a': {\n      id: '/_pathlessLayout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutRouteImport\n    }\n    '/_pathlessLayout/route-b': {\n      id: '/_pathlessLayout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardIndexRouteImport\n      parentRoute: typeof DashboardRouteRouteImport\n    }\n    '/expensive/': {\n      id: '/expensive/'\n      path: '/expensive'\n      fullPath: '/expensive'\n      preLoaderRoute: typeof ExpensiveIndexRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/dashboard/invoices/$invoiceId': {\n      id: '/dashboard/invoices/$invoiceId'\n      path: '/$invoiceId'\n      fullPath: '/dashboard/invoices/$invoiceId'\n      preLoaderRoute: typeof DashboardInvoicesInvoiceIdRouteImport\n      parentRoute: typeof DashboardInvoicesRouteRouteImport\n    }\n    '/dashboard/users/user': {\n      id: '/dashboard/users/user'\n      path: '/user'\n      fullPath: '/dashboard/users/user'\n      preLoaderRoute: typeof DashboardUsersUserRouteImport\n      parentRoute: typeof DashboardUsersRouteRouteImport\n    }\n    '/dashboard/invoices/': {\n      id: '/dashboard/invoices/'\n      path: '/'\n      fullPath: '/dashboard/invoices/'\n      preLoaderRoute: typeof DashboardInvoicesIndexRouteImport\n      parentRoute: typeof DashboardInvoicesRouteRouteImport\n    }\n    '/dashboard/users/': {\n      id: '/dashboard/users/'\n      path: '/'\n      fullPath: '/dashboard/users/'\n      preLoaderRoute: typeof DashboardUsersIndexRouteImport\n      parentRoute: typeof DashboardUsersRouteRouteImport\n    }\n  }\n}\n\n// Create and export the route tree\n\ninterface DashboardInvoicesRouteRouteChildren {\n  DashboardInvoicesInvoiceIdRoute: typeof DashboardInvoicesInvoiceIdRoute\n  DashboardInvoicesIndexRoute: typeof DashboardInvoicesIndexRoute\n}\n\nconst DashboardInvoicesRouteRouteChildren: DashboardInvoicesRouteRouteChildren =\n  {\n    DashboardInvoicesInvoiceIdRoute: DashboardInvoicesInvoiceIdRoute,\n    DashboardInvoicesIndexRoute: DashboardInvoicesIndexRoute,\n  }\n\nconst DashboardInvoicesRouteRouteWithChildren =\n  DashboardInvoicesRouteRoute._addFileChildren(\n    DashboardInvoicesRouteRouteChildren,\n  )\n\ninterface DashboardUsersRouteRouteChildren {\n  DashboardUsersUserRoute: typeof DashboardUsersUserRoute\n  DashboardUsersIndexRoute: typeof DashboardUsersIndexRoute\n}\n\nconst DashboardUsersRouteRouteChildren: DashboardUsersRouteRouteChildren = {\n  DashboardUsersUserRoute: DashboardUsersUserRoute,\n  DashboardUsersIndexRoute: DashboardUsersIndexRoute,\n}\n\nconst DashboardUsersRouteRouteWithChildren =\n  DashboardUsersRouteRoute._addFileChildren(DashboardUsersRouteRouteChildren)\n\ninterface DashboardRouteRouteChildren {\n  DashboardInvoicesRouteRoute: typeof DashboardInvoicesRouteRouteWithChildren\n  DashboardUsersRouteRoute: typeof DashboardUsersRouteRouteWithChildren\n  DashboardIndexRoute: typeof DashboardIndexRoute\n}\n\nconst DashboardRouteRouteChildren: DashboardRouteRouteChildren = {\n  DashboardInvoicesRouteRoute: DashboardInvoicesRouteRouteWithChildren,\n  DashboardUsersRouteRoute: DashboardUsersRouteRouteWithChildren,\n  DashboardIndexRoute: DashboardIndexRoute,\n}\n\nconst DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren(\n  DashboardRouteRouteChildren,\n)\n\ninterface AuthRouteChildren {\n  AuthProfileRoute: typeof AuthProfileRoute\n}\n\nconst AuthRouteChildren: AuthRouteChildren = {\n  AuthProfileRoute: AuthProfileRoute,\n}\n\nconst AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutRouteARoute: typeof PathlessLayoutRouteARoute\n  PathlessLayoutRouteBRoute: typeof PathlessLayoutRouteBRoute\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutRouteARoute: PathlessLayoutRouteARoute,\n  PathlessLayoutRouteBRoute: PathlessLayoutRouteBRoute,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteRouteWithChildren\n  '': typeof PathlessLayoutRouteWithChildren\n  '/login': typeof LoginRoute\n  '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren\n  '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren\n  '/route-group': typeof thisFolderIsNotInTheUrlRouteGroupRoute\n  '/profile': typeof AuthProfileRoute\n  '/route-a': typeof PathlessLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutRouteBRoute\n  '/dashboard/': typeof DashboardIndexRoute\n  '/expensive': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users/': typeof DashboardUsersIndexRoute\n}\n\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '': typeof PathlessLayoutRouteWithChildren\n  '/login': typeof LoginRoute\n  '/route-group': typeof thisFolderIsNotInTheUrlRouteGroupRoute\n  '/profile': typeof AuthProfileRoute\n  '/route-a': typeof PathlessLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutRouteBRoute\n  '/dashboard': typeof DashboardIndexRoute\n  '/expensive': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users': typeof DashboardUsersIndexRoute\n}\n\nexport interface FileRoutesById {\n  __root__: typeof rootRoute\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteRouteWithChildren\n  '/_auth': typeof AuthRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/login': typeof LoginRoute\n  '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren\n  '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren\n  '/(this-folder-is-not-in-the-url)/route-group': typeof thisFolderIsNotInTheUrlRouteGroupRoute\n  '/_auth/profile': typeof AuthProfileRoute\n  '/_pathlessLayout/route-a': typeof PathlessLayoutRouteARoute\n  '/_pathlessLayout/route-b': typeof PathlessLayoutRouteBRoute\n  '/dashboard/': typeof DashboardIndexRoute\n  '/expensive/': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users/': typeof DashboardUsersIndexRoute\n}\n\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/dashboard'\n    | ''\n    | '/login'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n    | '/route-group'\n    | '/profile'\n    | '/route-a'\n    | '/route-b'\n    | '/dashboard/'\n    | '/expensive'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices/'\n    | '/dashboard/users/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | ''\n    | '/login'\n    | '/route-group'\n    | '/profile'\n    | '/route-a'\n    | '/route-b'\n    | '/dashboard'\n    | '/expensive'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n  id:\n    | '__root__'\n    | '/'\n    | '/dashboard'\n    | '/_auth'\n    | '/_pathlessLayout'\n    | '/login'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n    | '/(this-folder-is-not-in-the-url)/route-group'\n    | '/_auth/profile'\n    | '/_pathlessLayout/route-a'\n    | '/_pathlessLayout/route-b'\n    | '/dashboard/'\n    | '/expensive/'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices/'\n    | '/dashboard/users/'\n  fileRoutesById: FileRoutesById\n}\n\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DashboardRouteRoute: typeof DashboardRouteRouteWithChildren\n  AuthRoute: typeof AuthRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  thisFolderIsNotInTheUrlRouteGroupRoute: typeof thisFolderIsNotInTheUrlRouteGroupRoute\n  ExpensiveIndexRoute: typeof ExpensiveIndexRoute\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DashboardRouteRoute: DashboardRouteRouteWithChildren,\n  AuthRoute: AuthRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  LoginRoute: LoginRoute,\n  thisFolderIsNotInTheUrlRouteGroupRoute:\n    thisFolderIsNotInTheUrlRouteGroupRoute,\n  ExpensiveIndexRoute: ExpensiveIndexRoute,\n}\n\nexport const routeTree = rootRoute\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\n/* ROUTE_MANIFEST_START\n{\n  \"routes\": {\n    \"__root__\": {\n      \"filePath\": \"__root.tsx\",\n      \"children\": [\n        \"/\",\n        \"/dashboard\",\n        \"/_auth\",\n        \"/_pathlessLayout\",\n        \"/login\",\n        \"/(this-folder-is-not-in-the-url)/route-group\",\n        \"/expensive/\"\n      ]\n    },\n    \"/\": {\n      \"filePath\": \"index.tsx\"\n    },\n    \"/dashboard\": {\n      \"filePath\": \"dashboard.route.tsx\",\n      \"children\": [\n        \"/dashboard/invoices\",\n        \"/dashboard/users\",\n        \"/dashboard/\"\n      ]\n    },\n    \"/_auth\": {\n      \"filePath\": \"_auth.tsx\",\n      \"children\": [\n        \"/_auth/profile\"\n      ]\n    },\n    \"/_pathlessLayout\": {\n      \"filePath\": \"_pathlessLayout.tsx\",\n      \"children\": [\n        \"/_pathlessLayout/route-a\",\n        \"/_pathlessLayout/route-b\"\n      ]\n    },\n    \"/login\": {\n      \"filePath\": \"login.tsx\"\n    },\n    \"/dashboard/invoices\": {\n      \"filePath\": \"dashboard.invoices.route.tsx\",\n      \"parent\": \"/dashboard\",\n      \"children\": [\n        \"/dashboard/invoices/$invoiceId\",\n        \"/dashboard/invoices/\"\n      ]\n    },\n    \"/dashboard/users\": {\n      \"filePath\": \"dashboard.users.route.tsx\",\n      \"parent\": \"/dashboard\",\n      \"children\": [\n        \"/dashboard/users/user\",\n        \"/dashboard/users/\"\n      ]\n    },\n    \"/(this-folder-is-not-in-the-url)/route-group\": {\n      \"filePath\": \"(this-folder-is-not-in-the-url)/route-group.tsx\"\n    },\n    \"/_auth/profile\": {\n      \"filePath\": \"_auth.profile.tsx\",\n      \"parent\": \"/_auth\"\n    },\n    \"/_pathlessLayout/route-a\": {\n      \"filePath\": \"_pathlessLayout.route-a.tsx\",\n      \"parent\": \"/_pathlessLayout\"\n    },\n    \"/_pathlessLayout/route-b\": {\n      \"filePath\": \"_pathlessLayout.route-b.tsx\",\n      \"parent\": \"/_pathlessLayout\"\n    },\n    \"/dashboard/\": {\n      \"filePath\": \"dashboard.index.tsx\",\n      \"parent\": \"/dashboard\"\n    },\n    \"/expensive/\": {\n      \"filePath\": \"expensive/index.tsx\"\n    },\n    \"/dashboard/invoices/$invoiceId\": {\n      \"filePath\": \"dashboard.invoices.$invoiceId.tsx\",\n      \"parent\": \"/dashboard/invoices\"\n    },\n    \"/dashboard/users/user\": {\n      \"filePath\": \"dashboard.users.user.tsx\",\n      \"parent\": \"/dashboard/users\"\n    },\n    \"/dashboard/invoices/\": {\n      \"filePath\": \"dashboard.invoices.index.tsx\",\n      \"parent\": \"/dashboard/invoices\"\n    },\n    \"/dashboard/users/\": {\n      \"filePath\": \"dashboard.users.index.tsx\",\n      \"parent\": \"/dashboard/users\"\n    }\n  }\n}\nROUTE_MANIFEST_END */\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/(this-folder-is-not-in-the-url)/route-group.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute(\n  '/(this-folder-is-not-in-the-url)/route-group',\n)({\n  component: RouteGroupExample,\n})\n\nfunction RouteGroupExample() {\n  return (\n    <div className={`p-2`}>\n      <div className={`text-lg`}>Welcome to the Route Group Example!</div>\n      <hr className={`my-2`} />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { Spinner } from '../components/Spinner'\nimport { Breadcrumbs } from '../components/Breadcrumbs'\nimport type { Auth } from '../utils/auth'\n\nfunction RouterSpinner() {\n  const isLoading = useRouterState({ select: (s) => s.status === 'pending' })\n  return <Spinner show={isLoading} />\n}\n\nexport const Route = createRootRouteWithContext<{\n  auth: Auth\n}>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className={`min-h-screen flex flex-col`}>\n        <div className={`flex items-center border-b gap-2`}>\n          <h1 className={`text-3xl p-2`}>Kitchen Sink</h1>\n          <Breadcrumbs />\n          {/* Show a global spinner when the router is transitioning */}\n          <div className={`text-3xl`}>\n            <RouterSpinner />\n          </div>\n        </div>\n        <div className={`flex-1 flex`}>\n          <div className={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n                ['/expensive', 'Expensive'],\n                ['/route-a', 'Pathless Layout A'],\n                ['/route-b', 'Pathless Layout B'],\n                ['/profile', 'Profile'],\n                ['/login', 'Login'],\n                ['/route-group', 'Route Group'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div key={to}>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    className={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ className: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div className={`flex-1 border-l`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/_auth.profile.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/_auth/profile')({\n  component: ProfileComponent,\n})\n\nfunction ProfileComponent() {\n  const { username } = Route.useRouteContext()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <div>\n        Username:<strong>{username}</strong>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/_auth.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { redirect } from '@tanstack/react-router'\nimport { auth } from '../utils/auth'\n\nexport const Route = createFileRoute('/_auth')({\n  // Before loading, authenticate the user via our auth context\n  // This will also happen during prefetching (e.g. hovering over links, etc)\n  beforeLoad: ({ context, location }) => {\n    // If the user is logged out, redirect them to the login page\n    if (context.auth.status === 'loggedOut') {\n      throw redirect({\n        to: '/login',\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n\n    // Otherwise, return the user in context\n    return {\n      username: auth.username,\n    }\n  },\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/_pathlessLayout.route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/_pathlessLayout/route-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/_pathlessLayout.route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/_pathlessLayout/route-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>Pathless Layout</div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/dashboard.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { fetchInvoices } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/')({\n  loader: () => fetchInvoices(),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const invoices = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{invoices.length} total invoices</strong>.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/dashboard.invoices.$invoiceId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, useNavigate, useRouter } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { InvoiceFields } from '../components/InvoiceFields'\nimport { useMutation } from '../hooks/useMutation'\nimport { fetchInvoiceById, patchInvoice } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/invoices/$invoiceId')({\n  params: {\n    parse: (params) => ({\n      invoiceId: z.number().int().parse(Number(params.invoiceId)),\n    }),\n    stringify: ({ invoiceId }) => ({ invoiceId: `${invoiceId}` }),\n  },\n  validateSearch: (search) =>\n    z\n      .object({\n        showNotes: z.boolean().optional(),\n        notes: z.string().optional(),\n      })\n      .parse(search),\n  loader: ({ params: { invoiceId } }) => fetchInvoiceById(invoiceId),\n  component: InvoiceComponent,\n})\n\nfunction InvoiceComponent() {\n  const search = Route.useSearch()\n  const navigate = useNavigate({ from: Route.fullPath })\n  const invoice = Route.useLoaderData()\n  const router = useRouter()\n  const updateInvoiceMutation = useMutation({\n    fn: patchInvoice,\n    onSuccess: () => router.invalidate(),\n  })\n  const [notes, setNotes] = React.useState(search.notes ?? '')\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => ({\n        ...old,\n        notes: notes ? notes : undefined,\n      }),\n      replace: true,\n      params: true,\n    })\n  }, [notes])\n\n  return (\n    <form\n      key={invoice.id}\n      onSubmit={(event) => {\n        event.preventDefault()\n        event.stopPropagation()\n        const formData = new FormData(event.target as HTMLFormElement)\n        updateInvoiceMutation.mutate({\n          id: invoice.id,\n          title: formData.get('title') as string,\n          body: formData.get('body') as string,\n        })\n      }}\n      className=\"p-2 space-y-2\"\n    >\n      <InvoiceFields\n        invoice={invoice}\n        disabled={updateInvoiceMutation.status === 'pending'}\n      />\n      <div>\n        <Link\n          from={Route.fullPath}\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          className=\"text-blue-700\"\n          params={true}\n        >\n          {search.showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search.showNotes ? (\n          <>\n            <div>\n              <div className=\"h-2\" />\n              <textarea\n                value={notes}\n                onChange={(e) => {\n                  setNotes(e.target.value)\n                }}\n                rows={5}\n                className=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div className=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n      <div>\n        <button\n          className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n          disabled={updateInvoiceMutation.status === 'pending'}\n        >\n          Save\n        </button>\n      </div>\n      {updateInvoiceMutation.variables?.id === invoice.id ? (\n        <div key={updateInvoiceMutation.submittedAt}>\n          {updateInvoiceMutation.status === 'success' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Saved!\n            </div>\n          ) : updateInvoiceMutation.status === 'error' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to save.\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n    </form>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/dashboard.invoices.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { useRouter } from '@tanstack/react-router'\nimport { InvoiceFields } from '../components/InvoiceFields'\nimport { Spinner } from '../components/Spinner'\nimport { useMutation } from '../hooks/useMutation'\nimport { postInvoice } from '../utils/mockTodos'\nimport type { Invoice } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/invoices/')({\n  component: InvoicesIndexComponent,\n})\n\nfunction InvoicesIndexComponent() {\n  const router = useRouter()\n\n  const createInvoiceMutation = useMutation({\n    fn: postInvoice,\n    onSuccess: () => router.invalidate(),\n  })\n\n  return (\n    <>\n      <div className=\"p-2\">\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n            createInvoiceMutation.mutate({\n              title: formData.get('title') as string,\n              body: formData.get('body') as string,\n            })\n          }}\n          className=\"space-y-2\"\n        >\n          <div>Create a new Invoice:</div>\n          <InvoiceFields invoice={{} as Invoice} />\n          <div>\n            <button\n              className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              disabled={createInvoiceMutation.status === 'pending'}\n            >\n              {createInvoiceMutation.status === 'pending' ? (\n                <>\n                  Creating <Spinner />\n                </>\n              ) : (\n                'Create'\n              )}\n            </button>\n          </div>\n          {createInvoiceMutation.status === 'success' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Created!\n            </div>\n          ) : createInvoiceMutation.status === 'error' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to create.\n            </div>\n          ) : null}\n        </form>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/dashboard.invoices.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, MatchRoute, Outlet } from '@tanstack/react-router'\nimport { Spinner } from '../components/Spinner'\nimport { fetchInvoices } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/invoices')({\n  loader: () => fetchInvoices(),\n  component: InvoicesComponent,\n})\n\nfunction InvoicesComponent() {\n  const invoices = Route.useLoaderData()\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y w-48\">\n        {invoices.map((invoice) => {\n          return (\n            <div key={invoice.id}>\n              <Link\n                to=\"/dashboard/invoices/$invoiceId\"\n                params={{\n                  invoiceId: invoice.id,\n                }}\n                preload=\"intent\"\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  #{invoice.id} - {invoice.title.slice(0, 10)}{' '}\n                  <MatchRoute\n                    to=\"/dashboard/invoices/$invoiceId\"\n                    params={{\n                      invoiceId: invoice.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex-1 border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/dashboard.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet, linkOptions } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: DashboardComponent,\n  loader: () => ({\n    crumb: 'Dashboard',\n  }),\n})\n\nconst options = [\n  linkOptions({\n    to: '/dashboard',\n    label: 'Summary',\n    activeOptions: { exact: true },\n  }),\n  linkOptions({\n    to: '/dashboard/invoices',\n    label: 'Invoices',\n  }),\n  linkOptions({\n    to: '/dashboard/users',\n    label: 'Users',\n  }),\n]\n\nfunction DashboardComponent() {\n  return (\n    <>\n      <div className=\"flex items-center border-b\">\n        <h2 className=\"text-xl p-2\">Dashboard</h2>\n      </div>\n\n      <div className=\"flex flex-wrap divide-x\">\n        {options.map((option) => {\n          return (\n            <Link\n              key={option.to}\n              {...option}\n              activeProps={{ className: `font-bold` }}\n              className=\"p-2\"\n            >\n              {option.label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/dashboard.users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/dashboard/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <p>\n        Normally, setting default search parameters would either need to be done\n        manually in every link to a page, or as a side-effect (not a great\n        experience).\n      </p>\n      <p>\n        Instead, we can use <strong>search filters</strong> to provide defaults\n        or even persist search params for links to routes (and child routes).\n      </p>\n      <p>\n        A good example of this is the sorting and filtering of the users list.\n        In a traditional router, both would be lost while navigating around\n        individual users or even changing each sort/filter option unless each\n        state was manually passed from the current route into each new link we\n        created (that's a lot of tedious and error-prone work). With TanStack\n        router and search filters, they are persisted with little effort.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/dashboard.users.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport {\n  Link,\n  MatchRoute,\n  Outlet,\n  retainSearchParams,\n  useNavigate,\n} from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { Spinner } from '../components/Spinner'\nimport { fetchUsers } from '../utils/mockTodos'\n\ntype UsersViewSortBy = 'name' | 'id' | 'email'\n\nexport const Route = createFileRoute('/dashboard/users')({\n  validateSearch: z.object({\n    usersView: z\n      .object({\n        sortBy: z.enum(['name', 'id', 'email']).optional(),\n        filterBy: z.string().optional(),\n      })\n      .optional(),\n  }).parse,\n  search: {\n    // Retain the usersView search param while navigating\n    // within or to this route (or it's children!)\n    middlewares: [retainSearchParams(['usersView'])],\n  },\n  loaderDeps: ({ search }) => ({\n    filterBy: search.usersView?.filterBy,\n    sortBy: search.usersView?.sortBy,\n  }),\n  loader: async ({ deps }) => {\n    const users = await fetchUsers(deps)\n    return { users, crumb: 'Users' }\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const navigate = useNavigate({ from: Route.fullPath })\n  const { usersView } = Route.useSearch()\n  const { users } = Route.useLoaderData()\n  const sortBy = usersView?.sortBy ?? 'name'\n  const filterBy = usersView?.filterBy\n\n  const [filterDraft, setFilterDraft] = React.useState(filterBy ?? '')\n\n  React.useEffect(() => {\n    setFilterDraft(filterBy ?? '')\n  }, [filterBy])\n\n  const setSortBy = (sortBy: UsersViewSortBy) =>\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...(old.usersView ?? {}),\n            sortBy,\n          },\n        }\n      },\n      replace: true,\n    })\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...old.usersView,\n            filterBy: filterDraft || undefined,\n          },\n        }\n      },\n      replace: true,\n    })\n  }, [filterDraft])\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y\">\n        <div className=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Sort By:</div>\n          <select\n            value={sortBy}\n            onChange={(e) => setSortBy(e.target.value as UsersViewSortBy)}\n            className=\"flex-1 border p-1 px-2 rounded-sm\"\n          >\n            {['name', 'id', 'email'].map((d) => {\n              return <option key={d} value={d} children={d} />\n            })}\n          </select>\n        </div>\n        <div className=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Filter By:</div>\n          <input\n            value={filterDraft}\n            onChange={(e) => setFilterDraft(e.target.value)}\n            placeholder=\"Search Names...\"\n            className=\"min-w-0 flex-1 border p-1 px-2 rounded-sm\"\n          />\n        </div>\n        {users.map((user) => {\n          return (\n            <div key={user.id}>\n              <Link\n                to=\"/dashboard/users/user\"\n                search={{\n                  userId: user.id,\n                }}\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  {user.name}{' '}\n                  <MatchRoute\n                    to=\"/dashboard/users/user\"\n                    search={{\n                      userId: user.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex-initial border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/dashboard.users.user.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { z } from 'zod'\nimport { fetchUserById } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/users/user')({\n  validateSearch: z.object({\n    userId: z.number(),\n  }),\n  loaderDeps: ({ search: { userId } }) => ({ userId }),\n  loader: async ({ deps: { userId } }) => {\n    const user = await fetchUserById(userId)\n    return {\n      user,\n      crumb: user?.name,\n    }\n  },\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const data = Route.useLoaderData()\n\n  return (\n    <>\n      <h4 className=\"p-2 font-bold\">{data.user?.name}</h4>\n      <pre className=\"text-sm whitespace-pre-wrap\">\n        {JSON.stringify(data.user, null, 2)}\n      </pre>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/expensive/-components/Expensive.tsx",
    "content": "import * as React from 'react'\n\nexport default function Expensive() {\n  return (\n    <div className={`p-2`}>\n      I am an \"expensive\" component... which really just means that I was\n      code-split 😉\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/expensive/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport Expensive from './-components/Expensive'\n\nexport const Route = createFileRoute('/expensive/')({\n  component: Expensive,\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className={`p-2`}>\n      <div className={`text-lg`}>Welcome Home!</div>\n      <hr className={`my-2`} />\n      <Link\n        to=\"/dashboard/invoices/$invoiceId\"\n        params={{\n          invoiceId: 3,\n        }}\n        className={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr className={`my-2`} />\n      <div className={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr className={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr className={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { useRouter } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: z.object({\n    redirect: z.string().optional(),\n  }),\n}).update({\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const { auth, status } = Route.useRouteContext({\n    select: ({ auth }) => ({ auth, status: auth.status }),\n  })\n  const search = Route.useSearch()\n  const [username, setUsername] = React.useState('')\n\n  const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n    e.preventDefault()\n    auth.login(username)\n    router.invalidate()\n  }\n\n  // Ah, the subtle nuances of client side auth. 🙄\n  React.useLayoutEffect(() => {\n    if (status === 'loggedIn' && search.redirect) {\n      router.history.push(search.redirect)\n    }\n  }, [status, search.redirect])\n\n  return status === 'loggedIn' ? (\n    <div>\n      Logged in as <strong>{auth.username}</strong>\n      <div className=\"h-2\" />\n      <button\n        onClick={() => {\n          auth.logout()\n          router.invalidate()\n        }}\n        className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n      >\n        Log out\n      </button>\n      <div className=\"h-2\" />\n    </div>\n  ) : (\n    <div className=\"p-2\">\n      <div>You must log in!</div>\n      <div className=\"h-2\" />\n      <form onSubmit={onSubmit} className=\"flex gap-2\">\n        <input\n          value={username}\n          onChange={(e) => setUsername(e.target.value)}\n          placeholder=\"Username\"\n          className=\"border p-1 px-2 rounded-sm\"\n        />\n        <button\n          type=\"submit\"\n          className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n        >\n          Login\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/utils/auth.tsx",
    "content": "export const auth: Auth = {\n  status: 'loggedOut',\n  username: undefined,\n  login: (username: string) => {\n    auth.status = 'loggedIn'\n    auth.username = username\n  },\n  logout: () => {\n    auth.status = 'loggedOut'\n    auth.username = undefined\n  },\n}\n\nexport type Auth = {\n  login: (username: string) => void\n  logout: () => void\n  status: 'loggedOut' | 'loggedIn'\n  username?: string\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/utils/mockTodos.ts",
    "content": "import axios from 'redaxios'\nimport { produce } from 'immer'\nimport { actionDelayFn, loaderDelayFn, shuffle } from './utils'\n\ntype PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> &\n  Required<Pick<TValue, TKey>>\n\nexport type Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nlet invoices: Array<Invoice> = null!\nlet users: Array<User> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\nlet usersPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nconst ensureUsers = async () => {\n  if (!usersPromise) {\n    usersPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/users',\n      )\n      users = data.slice(0, 10)\n    })\n  }\n\n  await usersPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n\nexport async function postInvoice(partialInvoice: Partial<Invoice>) {\n  return actionDelayFn(() => {\n    if (partialInvoice.title?.includes('error')) {\n      console.error('error')\n      throw new Error('Ouch!')\n    }\n    const invoice = {\n      id: invoices.length + 1,\n      title:\n        partialInvoice.title ?? `New Invoice ${String(Date.now()).slice(0, 5)}`,\n      body:\n        partialInvoice.body ??\n        shuffle(\n          `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n      Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. \n      Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna.  Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.\n      `.split(' '),\n        ).join(' '),\n    }\n    invoices = [...invoices, invoice]\n    return invoice\n  })\n}\n\nexport async function patchInvoice({\n  id,\n  ...updatedInvoice\n}: PickAsRequired<Partial<Invoice>, 'id'>) {\n  return actionDelayFn(() => {\n    invoices = produce(invoices, (draft) => {\n      const invoice = draft.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found.')\n      }\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (updatedInvoice.title?.toLocaleLowerCase()?.includes('error')) {\n        throw new Error('Ouch!')\n      }\n      Object.assign(invoice, updatedInvoice)\n    })\n\n    return invoices.find((d) => d.id === id)\n  })\n}\n\nexport type UsersSortBy = 'name' | 'id' | 'email'\n\nexport async function fetchUsers({\n  filterBy,\n  sortBy,\n}: { filterBy?: string; sortBy?: UsersSortBy } = {}) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => {\n      let usersDraft = users\n\n      if (filterBy) {\n        usersDraft = usersDraft.filter((d) =>\n          d.name.toLowerCase().includes(filterBy.toLowerCase()),\n        )\n      }\n\n      if (sortBy) {\n        usersDraft = [...usersDraft].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n      }\n\n      return usersDraft\n    }),\n  )\n}\n\nexport async function fetchUserById(id: number) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => users.find((d) => d.id === id)),\n  )\n}\n\nexport async function fetchRandomNumber() {\n  return loaderDelayFn(() => {\n    return Math.random()\n  })\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/src/utils/utils.tsx",
    "content": "export async function loaderDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\nexport async function actionDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('actionDelay') ?? 0)\n  await new Promise((r) => setTimeout(r, delay))\n  return fn()\n}\n\nexport function shuffle<T>(arr: Array<T>): Array<T> {\n  let i = arr.length\n  if (i == 0) return arr\n  const copy = [...arr]\n  while (--i) {\n    const j = Math.floor(Math.random() * (i + 1))\n    const a = copy[i]\n    const b = copy[j]\n    copy[i] = b!\n    copy[j] = a!\n  }\n  return copy\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/README.md",
    "content": "# TanStack Router - Kitchen Sink React Query Example\n\nA comprehensive example combining TanStack Router with TanStack Query.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [TanStack Query Docs](https://tanstack.com/query)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/kitchen-sink-react-query kitchen-sink-react-query\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis \"kitchen sink\" example demonstrates:\n\n- Advanced routing patterns with TanStack Router\n- TanStack Query integration\n- Complex data fetching scenarios\n- Cache management\n- Optimistic updates\n- Error handling\n- Loading states\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-kitchen-sink-react-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"immer\": \"^10.1.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/src/Expensive.tsx",
    "content": "import * as React from 'react'\n\nexport default function Expensive() {\n  return (\n    <div className={`p-2`}>\n      I am an \"expensive\" component... which really just means that I was\n      code-split 😉\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/src/main.tsx",
    "content": "/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport * as React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  MatchRoute,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  lazyRouteComponent,\n  redirect,\n  retainSearchParams,\n  useNavigate,\n  useRouter,\n  useRouterState,\n  useSearch,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport {\n  QueryClient,\n  QueryClientProvider,\n  queryOptions,\n  useMutation,\n  useSuspenseQuery,\n} from '@tanstack/react-query'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport { z } from 'zod'\nimport {\n  fetchInvoiceById,\n  fetchInvoices,\n  fetchUserById,\n  fetchUsers,\n  patchInvoice,\n  postInvoice,\n} from './mockTodos'\nimport type { Invoice } from './mockTodos'\nimport './styles.css'\n\n//\n\ntype UsersViewSortBy = 'name' | 'id' | 'email'\n\nconst invoicesQueryOptions = () =>\n  queryOptions({\n    queryKey: ['invoices'],\n    queryFn: () => fetchInvoices(),\n  })\n\nconst invoiceQueryOptions = (invoiceId: number) =>\n  queryOptions({\n    queryKey: ['invoices', invoiceId],\n    queryFn: () => fetchInvoiceById(invoiceId),\n  })\n\nconst usersQueryOptions = ({\n  filterBy,\n  sortBy,\n}: {\n  filterBy?: string\n  sortBy?: UsersViewSortBy\n}) =>\n  queryOptions({\n    queryKey: ['users', { filterBy, sortBy }],\n    queryFn: () =>\n      fetchUsers({\n        filterBy,\n        sortBy,\n      }),\n  })\n\nconst userQueryOptions = (userId: number) =>\n  queryOptions({\n    queryKey: ['users', userId],\n    queryFn: async () => {\n      const user = await fetchUserById(userId)\n      if (!user) {\n        throw new Error('User not found.')\n      }\n      return user\n    },\n  })\n\nconst useCreateInvoiceMutation = () => {\n  return useMutation({\n    mutationKey: ['invoices', 'create'],\n    mutationFn: postInvoice,\n    onSuccess: () => queryClient.invalidateQueries(),\n  })\n}\n\nconst useUpdateInvoiceMutation = (invoiceId: number) => {\n  return useMutation({\n    mutationKey: ['invoices', 'update', invoiceId],\n    mutationFn: patchInvoice,\n    onSuccess: () => queryClient.invalidateQueries(),\n    gcTime: 1000 * 10,\n  })\n}\n\nfunction RouterSpinner() {\n  const isLoading = useRouterState({ select: (s) => s.status === 'pending' })\n  return <Spinner show={isLoading} />\n}\n\n// Routes\n\n// Build our routes. We could do this in our component, too.\nconst rootRoute = createRootRouteWithContext<{\n  auth: Auth\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className={`min-h-screen flex flex-col`}>\n        <div className={`flex items-center border-b gap-2`}>\n          <h1 className={`text-3xl p-2`}>Kitchen Sink</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div className={`text-3xl`}>\n            <RouterSpinner />\n          </div>\n        </div>\n        <div className={`flex-1 flex`}>\n          <div className={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n                ['/expensive', 'Expensive'],\n                ['/route-a', 'Pathless Layout A'],\n                ['/route-b', 'Pathless Layout B'],\n                ['/profile', 'Profile'],\n                ['/login', 'Login'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div key={to}>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    className={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ className: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div className={`flex-1 border-l`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <TanStackRouterDevtools position=\"bottom-right\" />\n      <ReactQueryDevtools buttonPosition=\"top-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className={`p-2`}>\n      <div className={`text-lg`}>Welcome Home!</div>\n      <hr className={`my-2`} />\n      <Link\n        to={invoiceRoute.to}\n        params={{\n          invoiceId: 3,\n        }}\n        className={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr className={`my-2`} />\n      <div className={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr className={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr className={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n\nconst dashboardLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'dashboard',\n  component: DashboardLayoutComponent,\n})\n\nfunction DashboardLayoutComponent() {\n  return (\n    <>\n      <div className=\"flex items-center border-b\">\n        <h2 className=\"text-xl p-2\">Dashboard</h2>\n      </div>\n      <div className=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['/dashboard', 'Summary', true],\n            ['/dashboard/invoices', 'Invoices'],\n            ['/dashboard/users', 'Users'],\n          ] as const\n        ).map(([to, label, exact]) => {\n          return (\n            <Link\n              key={to}\n              to={to}\n              activeOptions={{ exact }}\n              activeProps={{ className: `font-bold` }}\n              className=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n\nconst dashboardIndexRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: '/',\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(invoicesQueryOptions()),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const invoicesQuery = useSuspenseQuery(invoicesQueryOptions())\n  const invoices = invoicesQuery.data\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{invoices.length} total invoices</strong>.\n      </div>\n    </div>\n  )\n}\n\nconst invoicesLayoutRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: 'invoices',\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(invoicesQueryOptions()),\n  component: InvoicesLayoutComponent,\n})\n\nfunction InvoicesLayoutComponent() {\n  const invoicesQuery = useSuspenseQuery(invoicesQueryOptions())\n  const invoices = invoicesQuery.data\n  // const updateInvoiceMutation = useUpdateInvoiceMutation()\n  // const createInvoiceMutation = useCreateInvoiceMutation()\n\n  return (\n    <div className=\"flex-1 flex\">\n      {/* {routerTransitionIsPending ? 'pending' : 'null'} */}\n      <div className=\"divide-y w-48\">\n        {invoices.map((invoice) => {\n          // const updateSubmission = updateInvoiceMutation.submissions.find(\n          //   (d) => d.variables?.id === invoice.id,\n          // )\n\n          // if (updateSubmission) {\n          //   invoice = {\n          //     ...invoice,\n          //     ...updateSubmission.variables,\n          //   }\n          // }\n\n          return (\n            <div key={invoice.id}>\n              <Link\n                to=\"/dashboard/invoices/$invoiceId\"\n                params={{\n                  invoiceId: invoice.id,\n                }}\n                preload=\"intent\"\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  #{invoice.id} - {invoice.title.slice(0, 10)}{' '}\n                  {/* {updateSubmission ? (\n                      <Spinner />\n                    ) : ( */}\n                  <MatchRoute\n                    to={invoiceRoute.to}\n                    params={{\n                      invoiceId: invoice.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                  {/* )} */}\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n        {/* {createSubmissions.map((action) => (\n            <div key={action.submittedAt}>\n              <a href=\"#\" className=\"block py-2 px-3 text-blue-700\">\n                <pre className=\"text-sm\">\n                  #<Spinner /> - {action.variables.title?.slice(0, 10)}\n                </pre>\n              </a>\n            </div>\n          ))} */}\n      </div>\n      <div className=\"flex-1 border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesLayoutRoute,\n  path: '/',\n  component: InvoicesIndexComponent,\n})\n\nfunction InvoicesIndexComponent() {\n  const createInvoiceMutation = useCreateInvoiceMutation()\n\n  return (\n    <>\n      <div className=\"p-2\">\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n            createInvoiceMutation.mutate({\n              title: formData.get('title') as string,\n              body: formData.get('body') as string,\n            })\n          }}\n          className=\"space-y-2\"\n        >\n          <div>Create a new Invoice:</div>\n          <InvoiceFields invoice={{} as Invoice} />\n          <div>\n            <button\n              className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              disabled={createInvoiceMutation.status === 'pending'}\n            >\n              {createInvoiceMutation.status === 'pending' ? (\n                <>\n                  Creating <Spinner />\n                </>\n              ) : (\n                'Create'\n              )}\n            </button>\n          </div>\n          {createInvoiceMutation.status === 'success' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Created!\n            </div>\n          ) : createInvoiceMutation.status === 'error' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to create.\n            </div>\n          ) : null}\n        </form>\n      </div>\n    </>\n  )\n}\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesLayoutRoute,\n  path: '$invoiceId',\n  params: {\n    parse: (params) => ({\n      invoiceId: z.number().int().parse(Number(params.invoiceId)),\n    }),\n    stringify: ({ invoiceId }) => ({ invoiceId: `${invoiceId}` }),\n  },\n  validateSearch: (search) =>\n    z\n      .object({\n        showNotes: z.boolean().optional(),\n        notes: z.string().optional(),\n      })\n      .parse(search),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(\n      invoiceQueryOptions(opts.params.invoiceId),\n    ),\n  component: InvoiceComponent,\n})\n\nfunction InvoiceComponent() {\n  const params = invoiceRoute.useParams()\n  const search = invoiceRoute.useSearch()\n  const navigate = useNavigate({ from: invoiceRoute.fullPath })\n  const invoiceQuery = useSuspenseQuery(invoiceQueryOptions(params.invoiceId))\n  const invoice = invoiceQuery.data\n  const updateInvoiceMutation = useUpdateInvoiceMutation(params.invoiceId)\n  const [notes, setNotes] = React.useState(search.notes ?? '')\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => ({\n        ...old,\n        notes: notes ? notes : undefined,\n      }),\n      replace: true,\n      params: true,\n    })\n  }, [notes])\n\n  return (\n    <form\n      key={invoice.id}\n      onSubmit={(event) => {\n        event.preventDefault()\n        event.stopPropagation()\n        const formData = new FormData(event.target as HTMLFormElement)\n        updateInvoiceMutation.mutate({\n          id: invoice.id,\n          title: formData.get('title') as string,\n          body: formData.get('body') as string,\n        })\n      }}\n      className=\"p-2 space-y-2\"\n    >\n      <InvoiceFields\n        invoice={invoice}\n        disabled={updateInvoiceMutation.status === 'pending'}\n      />\n      <div>\n        <Link\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          className=\"text-blue-700\"\n          from={invoiceRoute.fullPath}\n          params={true}\n        >\n          {search.showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search.showNotes ? (\n          <>\n            <div>\n              <div className=\"h-2\" />\n              <textarea\n                value={notes}\n                onChange={(e) => {\n                  setNotes(e.target.value)\n                }}\n                rows={5}\n                className=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div className=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n      <div>\n        <button\n          className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n          disabled={updateInvoiceMutation.status === 'pending'}\n        >\n          Save\n        </button>\n      </div>\n      {updateInvoiceMutation.variables?.id === invoice.id ? (\n        <div key={updateInvoiceMutation.submittedAt}>\n          {updateInvoiceMutation.status === 'success' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Saved!\n            </div>\n          ) : updateInvoiceMutation.status === 'error' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to save.\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n    </form>\n  )\n}\n\nconst usersLayoutRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: 'users',\n  validateSearch: z.object({\n    usersView: z\n      .object({\n        sortBy: z.enum(['name', 'id', 'email']).optional(),\n        filterBy: z.string().optional(),\n      })\n      .optional(),\n  }).parse,\n  search: {\n    // Retain the usersView search param while navigating\n    // within or to this route (or it's children!)\n    middlewares: [retainSearchParams(['usersView'])],\n  },\n  loaderDeps: ({ search }) => ({\n    filterBy: search.usersView?.filterBy,\n    sortBy: search.usersView?.sortBy,\n  }),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(usersQueryOptions(opts.deps)),\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const navigate = useNavigate({ from: usersLayoutRoute.fullPath })\n  const { usersView } = usersLayoutRoute.useSearch()\n  const usersQuery = useSuspenseQuery(\n    usersQueryOptions(usersLayoutRoute.useLoaderDeps()),\n  )\n  const users = usersQuery.data\n  const sortBy = usersView?.sortBy ?? 'name'\n  const filterBy = usersView?.filterBy\n\n  const [filterDraft, setFilterDraft] = React.useState(filterBy ?? '')\n\n  React.useEffect(() => {\n    setFilterDraft(filterBy ?? '')\n  }, [filterBy])\n\n  const sortedUsers = React.useMemo(() => {\n    if (!users) return []\n\n    return !sortBy\n      ? users\n      : [...users].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n  }, [users, sortBy])\n\n  const filteredUsers = React.useMemo(() => {\n    if (!filterBy) return sortedUsers\n\n    return sortedUsers.filter((user) =>\n      user.name.toLowerCase().includes(filterBy.toLowerCase()),\n    )\n  }, [sortedUsers, filterBy])\n\n  const setSortBy = (sortBy: UsersViewSortBy) =>\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...(old.usersView ?? {}),\n            sortBy,\n          },\n        }\n      },\n      replace: true,\n    })\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...old.usersView,\n            filterBy: filterDraft || undefined,\n          },\n        }\n      },\n      replace: true,\n    })\n  }, [filterDraft])\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y\">\n        <div className=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Sort By:</div>\n          <select\n            value={sortBy}\n            onChange={(e) => setSortBy(e.target.value as UsersViewSortBy)}\n            className=\"flex-1 border p-1 px-2 rounded-sm\"\n          >\n            {['name', 'id', 'email'].map((d) => {\n              return <option key={d} value={d} children={d} />\n            })}\n          </select>\n        </div>\n        <div className=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Filter By:</div>\n          <input\n            value={filterDraft}\n            onChange={(e) => setFilterDraft(e.target.value)}\n            placeholder=\"Search Names...\"\n            className=\"min-w-0 flex-1 border p-1 px-2 rounded-sm\"\n          />\n        </div>\n        {filteredUsers.map((user) => {\n          return (\n            <div key={user.id}>\n              <Link\n                to=\"/dashboard/users/user\"\n                search={{\n                  userId: user.id,\n                }}\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  {user.name}{' '}\n                  <MatchRoute\n                    to={userRoute.to}\n                    search={{\n                      userId: user.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex-initial border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst usersIndexRoute = createRoute({\n  getParentRoute: () => usersLayoutRoute,\n  path: '/',\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <p>\n        Normally, setting default search parameters would either need to be done\n        manually in every link to a page, or as a side-effect (not a great\n        experience).\n      </p>\n      <p>\n        Instead, we can use <strong>search filters</strong> to provide defaults\n        or even persist search params for links to routes (and child routes).\n      </p>\n      <p>\n        A good example of this is the sorting and filtering of the users list.\n        In a traditional router, both would be lost while navigating around\n        individual users or even changing each sort/filter option unless each\n        state was manually passed from the current route into each new link we\n        created (that's a lot of tedious and error-prone work). With TanStack\n        router and search filters, they are persisted with little effort.\n      </p>\n    </div>\n  )\n}\n\nconst userRoute = createRoute({\n  getParentRoute: () => usersLayoutRoute,\n  path: 'user',\n  validateSearch: z.object({\n    userId: z.number(),\n  }),\n  loaderDeps: ({ search }) => ({\n    userId: search.userId,\n  }),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(\n      userQueryOptions(opts.deps.userId),\n    ),\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const search = userRoute.useSearch()\n  const userQuery = useSuspenseQuery(userQueryOptions(search.userId))\n  const user = userQuery.data\n\n  return (\n    <>\n      <h4 className=\"p-2 font-bold\">{user?.name}</h4>\n      <pre className=\"text-sm whitespace-pre-wrap\">\n        {JSON.stringify(user, null, 2)}\n      </pre>\n    </>\n  )\n}\n\nconst expensiveRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  // Your elements can be asynchronous, which means you can code-split!\n  path: 'expensive',\n  component: lazyRouteComponent(() => import('./Expensive')),\n})\n\nconst authPathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'auth',\n  // Before loading, authenticate the user via our auth context\n  // This will also happen during prefetching (e.g. hovering over links, etc)\n  beforeLoad: ({ context, location }) => {\n    // If the user is logged out, redirect them to the login page\n    if (context.auth.status === 'loggedOut') {\n      throw redirect({\n        to: loginRoute.to,\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n\n    // Otherwise, return the user in context\n    return {\n      username: auth.username,\n    }\n  },\n})\n\nconst profileRoute = createRoute({\n  getParentRoute: () => authPathlessLayoutRoute,\n  path: 'profile',\n  component: ProfileComponent,\n})\n\nfunction ProfileComponent() {\n  const { username } = profileRoute.useRouteContext()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <div>\n        Username:<strong>{username}</strong>\n      </div>\n    </div>\n  )\n}\n\nconst loginRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'login',\n  validateSearch: z.object({\n    redirect: z.string().optional(),\n  }),\n}).update({\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const { auth, status } = loginRoute.useRouteContext({\n    select: ({ auth }) => ({ auth, status: auth.status }),\n  })\n  const search = useSearch({ from: loginRoute.fullPath })\n  const [username, setUsername] = React.useState('')\n\n  const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n    e.preventDefault()\n    auth.login(username)\n    router.invalidate()\n  }\n\n  // Ah, the subtle nuances of client side auth. 🙄\n  React.useLayoutEffect(() => {\n    if (status === 'loggedIn' && search.redirect) {\n      router.history.push(search.redirect)\n    }\n  }, [status, search.redirect])\n\n  return status === 'loggedIn' ? (\n    <div>\n      Logged in as <strong>{auth.username}</strong>\n      <div className=\"h-2\" />\n      <button\n        onClick={() => auth.logout()}\n        className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n      >\n        Log out\n      </button>\n      <div className=\"h-2\" />\n    </div>\n  ) : (\n    <div className=\"p-2\">\n      <div>You must log in!</div>\n      <div className=\"h-2\" />\n      <form onSubmit={onSubmit} className=\"flex gap-2\">\n        <input\n          value={username}\n          onChange={(e) => setUsername(e.target.value)}\n          placeholder=\"Username\"\n          className=\"border p-1 px-2 rounded-sm\"\n        />\n        <button\n          onClick={() => auth.logout()}\n          className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n        >\n          Login\n        </button>\n      </form>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>Pathless Layout</div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return (\n    <div>\n      <div>I'm A</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return (\n    <div>\n      <div>i\"m B</div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  dashboardLayoutRoute.addChildren([\n    dashboardIndexRoute,\n    invoicesLayoutRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n    usersLayoutRoute.addChildren([usersIndexRoute, userRoute]),\n  ]),\n  expensiveRoute,\n  authPathlessLayoutRoute.addChildren([profileRoute]),\n  loginRoute,\n  pathlessLayoutRoute.addChildren([pathlessLayoutARoute, pathlessLayoutBRoute]),\n])\n\nconst queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div className={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,\n  context: {\n    auth: undefined!, // We'll inject this when we render\n    queryClient,\n  },\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst auth: Auth = {\n  status: 'loggedOut',\n  username: undefined,\n  login: (username: string) => {\n    auth.status = 'loggedIn'\n    auth.username = username\n  },\n  logout: () => {\n    auth.status = 'loggedOut'\n    auth.username = undefined\n  },\n}\n\nfunction App() {\n  // This stuff is just to tweak our sandbox setup in real-time\n  const [loaderDelay, setLoaderDelay] = useSessionStorage('loaderDelay', 500)\n  const [pendingMs, setPendingMs] = useSessionStorage('pendingMs', 1000)\n  const [pendingMinMs, setPendingMinMs] = useSessionStorage('pendingMinMs', 500)\n\n  return (\n    <>\n      <div className=\"text-xs fixed w-52 shadow-md shadow-black/20 rounded-sm bottom-2 left-2 bg-white dark:bg-gray-800 bg-opacity-75 border-b flex flex-col gap-1 flex-wrap items-left divide-y\">\n        <div className=\"p-2 space-y-2\">\n          <div className=\"flex gap-2\">\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(150)\n              }}\n            >\n              Fast\n            </button>\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(500)\n              }}\n            >\n              Fast 3G\n            </button>\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(2000)\n              }}\n            >\n              Slow 3G\n            </button>\n          </div>\n          <div>\n            <div>Loader Delay: {loaderDelay}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={loaderDelay}\n              onChange={(e) => setLoaderDelay(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n        </div>\n        <div className=\"p-2 space-y-2\">\n          <div className=\"flex gap-2\">\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setPendingMs(1000)\n                setPendingMinMs(500)\n              }}\n            >\n              Reset to Default\n            </button>\n          </div>\n          <div>\n            <div>defaultPendingMs: {pendingMs}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMs}\n              onChange={(e) => setPendingMs(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n          <div>\n            <div>defaultPendingMinMs: {pendingMinMs}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMinMs}\n              onChange={(e) => setPendingMinMs(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n        </div>\n      </div>\n      <QueryClientProvider client={queryClient}>\n        <RouterProvider\n          router={router}\n          defaultPreload=\"intent\"\n          defaultPendingMs={pendingMs}\n          defaultPendingMinMs={pendingMinMs}\n          context={{\n            auth,\n          }}\n        />\n      </QueryClientProvider>\n    </>\n  )\n}\n\nfunction InvoiceFields({\n  invoice,\n  disabled,\n}: {\n  invoice: Invoice\n  disabled?: boolean\n}) {\n  return (\n    <div className=\"space-y-2\">\n      <h2 className=\"font-bold text-lg\">\n        <input\n          name=\"title\"\n          defaultValue={invoice.title}\n          placeholder=\"Invoice Title\"\n          className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n          disabled={disabled}\n        />\n      </h2>\n      <div>\n        <textarea\n          name=\"body\"\n          defaultValue={invoice.body}\n          rows={6}\n          placeholder=\"Invoice Body...\"\n          className=\"border border-opacity-50 p-2 rounded-sm w-full\"\n          disabled={disabled}\n        />\n      </div>\n    </div>\n  )\n}\n\ntype Auth = {\n  login: (username: string) => void\n  logout: () => void\n  status: 'loggedOut' | 'loggedIn'\n  username?: string\n}\n\nfunction Spinner({ show, wait }: { show?: boolean; wait?: `delay-${number}` }) {\n  return (\n    <div\n      className={`inline-block animate-spin px-3 transition ${\n        (show ?? true)\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n\nfunction useSessionStorage<T>(key: string, initialValue: T) {\n  const state = React.useState<T>(() => {\n    const stored = sessionStorage.getItem(key)\n    return stored ? JSON.parse(stored) : initialValue\n  })\n\n  React.useEffect(() => {\n    sessionStorage.setItem(key, JSON.stringify(state[0]))\n  }, [state[0]])\n\n  return state\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/src/mockTodos.ts",
    "content": "import axios from 'redaxios'\nimport { produce } from 'immer'\nimport { actionDelayFn, loaderDelayFn, shuffle } from './utils'\n\ntype PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> &\n  Required<Pick<TValue, TKey>>\n\nexport type Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nlet invoices: Array<Invoice> = null!\nlet users: Array<User> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\nlet usersPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nconst ensureUsers = async () => {\n  if (!usersPromise) {\n    usersPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/users',\n      )\n      users = data.slice(0, 10)\n    })\n  }\n\n  await usersPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n\nexport async function postInvoice(partialInvoice: Partial<Invoice>) {\n  return actionDelayFn(() => {\n    if (partialInvoice.title?.includes('error')) {\n      console.error('error')\n      throw new Error('Ouch!')\n    }\n    const invoice = {\n      id: invoices.length + 1,\n      title:\n        partialInvoice.title ?? `New Invoice ${String(Date.now()).slice(0, 5)}`,\n      body:\n        partialInvoice.body ??\n        shuffle(\n          `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n      Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. \n      Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna.  Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.\n      `.split(' '),\n        ).join(' '),\n    }\n    invoices = [...invoices, invoice]\n    return invoice\n  })\n}\n\nexport async function patchInvoice({\n  id,\n  ...updatedInvoice\n}: PickAsRequired<Partial<Invoice>, 'id'>) {\n  return actionDelayFn(() => {\n    invoices = produce(invoices, (draft) => {\n      const invoice = draft.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found.')\n      }\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (updatedInvoice.title?.toLocaleLowerCase()?.includes('error')) {\n        throw new Error('Ouch!')\n      }\n      Object.assign(invoice, updatedInvoice)\n    })\n\n    return invoices.find((d) => d.id === id)\n  })\n}\n\nexport type UsersSortBy = 'name' | 'id' | 'email'\n\nexport async function fetchUsers({\n  filterBy,\n  sortBy,\n}: { filterBy?: string; sortBy?: UsersSortBy } = {}) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => {\n      let usersDraft = users\n\n      if (filterBy) {\n        usersDraft = usersDraft.filter((d) =>\n          d.name.toLowerCase().includes(filterBy.toLowerCase()),\n        )\n      }\n\n      if (sortBy) {\n        usersDraft = [...usersDraft].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n      }\n\n      return usersDraft\n    }),\n  )\n}\n\nexport async function fetchUserById(id: number) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => users.find((d) => d.id === id)),\n  )\n}\n\nexport async function fetchRandomNumber() {\n  return loaderDelayFn(() => {\n    return Math.random()\n  })\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/src/utils.tsx",
    "content": "export async function loaderDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\nexport async function actionDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('actionDelay') ?? 0)\n  await new Promise((r) => setTimeout(r, delay))\n  return fn()\n}\n\nexport function shuffle<T>(arr: Array<T>): Array<T> {\n  let i = arr.length\n  if (i == 0) return arr\n  const copy = [...arr]\n  while (--i) {\n    const j = Math.floor(Math.random() * (i + 1))\n    const a = copy[i]\n    const b = copy[j]\n    copy[i] = b!\n    copy[j] = a!\n  }\n  return copy\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/README.md",
    "content": "# TanStack Router - Kitchen Sink React Query File-Based Example\n\nA comprehensive file-based routing example with TanStack Query integration.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [TanStack Query Docs](https://tanstack.com/query)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/kitchen-sink-react-query-file-based kitchen-sink-react-query-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis \"kitchen sink\" example demonstrates:\n\n- File-based routing with TanStack Router\n- TanStack Query integration\n- Advanced routing patterns\n- Type-safe data fetching\n- Complex data loading scenarios\n- Cache management\n- Automatic route generation\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-kitchen-sink-react-query-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"immer\": \"^10.1.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/components/InvoiceFields.tsx",
    "content": "import * as React from 'react'\nimport type { Invoice } from '../utils/mockTodos'\n\nexport function InvoiceFields({\n  invoice,\n  disabled,\n}: {\n  invoice: Invoice\n  disabled?: boolean\n}) {\n  return (\n    <div className=\"space-y-2\">\n      <h2 className=\"font-bold text-lg\">\n        <input\n          name=\"title\"\n          defaultValue={invoice.title}\n          placeholder=\"Invoice Title\"\n          className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n          disabled={disabled}\n        />\n      </h2>\n      <div>\n        <textarea\n          name=\"body\"\n          defaultValue={invoice.body}\n          rows={6}\n          placeholder=\"Invoice Body...\"\n          className=\"border border-opacity-50 p-2 rounded-sm w-full\"\n          disabled={disabled}\n        />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/components/Spinner.tsx",
    "content": "import * as React from 'react'\n\nexport function Spinner({\n  show,\n  wait,\n}: {\n  show?: boolean\n  wait?: `delay-${number}`\n}) {\n  return (\n    <div\n      className={`inline-block animate-spin px-3 transition ${\n        (show ?? true)\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/hooks/useSessionStorage.tsx",
    "content": "import * as React from 'react'\n\nexport function useSessionStorage<T>(key: string, initialValue: T) {\n  const state = React.useState<T>(() => {\n    const stored = sessionStorage.getItem(key)\n    return stored ? JSON.parse(stored) : initialValue\n  })\n\n  React.useEffect(() => {\n    sessionStorage.setItem(key, JSON.stringify(state[0]))\n  }, [state[0]])\n\n  return state\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/main.tsx",
    "content": "import * as React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  RouterProvider,\n  createRouter,\n} from '@tanstack/react-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { auth } from './utils/auth'\nimport { Spinner } from './components/Spinner'\nimport { routeTree } from './routeTree.gen'\nimport { useSessionStorage } from './hooks/useSessionStorage'\nimport './styles.css'\n\n//\n\nexport const queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div className={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,\n  context: {\n    auth: undefined!, // We'll inject this when we render\n    queryClient,\n  },\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction App() {\n  // This stuff is just to tweak our sandbox setup in real-time\n  const [loaderDelay, setLoaderDelay] = useSessionStorage('loaderDelay', 500)\n  const [pendingMs, setPendingMs] = useSessionStorage('pendingMs', 1000)\n  const [pendingMinMs, setPendingMinMs] = useSessionStorage('pendingMinMs', 500)\n\n  return (\n    <>\n      <div className=\"text-xs fixed w-52 shadow-md shadow-black/20 rounded-sm bottom-2 left-2 bg-white dark:bg-gray-800 bg-opacity-75 border-b flex flex-col gap-1 flex-wrap items-left divide-y\">\n        <div className=\"p-2 space-y-2\">\n          <div className=\"flex gap-2\">\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(150)\n              }}\n            >\n              Fast\n            </button>\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(500)\n              }}\n            >\n              Fast 3G\n            </button>\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(2000)\n              }}\n            >\n              Slow 3G\n            </button>\n          </div>\n          <div>\n            <div>Loader Delay: {loaderDelay}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={loaderDelay}\n              onChange={(e) => setLoaderDelay(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n        </div>\n        <div className=\"p-2 space-y-2\">\n          <div className=\"flex gap-2\">\n            <button\n              className=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setPendingMs(1000)\n                setPendingMinMs(500)\n              }}\n            >\n              Reset to Default\n            </button>\n          </div>\n          <div>\n            <div>defaultPendingMs: {pendingMs}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMs}\n              onChange={(e) => setPendingMs(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n          <div>\n            <div>defaultPendingMinMs: {pendingMinMs}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMinMs}\n              onChange={(e) => setPendingMinMs(e.target.valueAsNumber)}\n              className=\"w-full\"\n            />\n          </div>\n        </div>\n      </div>\n      <RouterProvider\n        router={router}\n        defaultPreload=\"intent\"\n        defaultPendingMs={pendingMs}\n        defaultPendingMinMs={pendingMinMs}\n        context={{\n          auth,\n        }}\n      />\n    </>\n  )\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    // <React.StrictMode>\n    <QueryClientProvider client={queryClient}>\n      <App />\n    </QueryClientProvider>,\n    // </React.StrictMode>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as AuthRouteImport } from './routes/_auth'\nimport { Route as DashboardRouteRouteImport } from './routes/dashboard.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ExpensiveIndexRouteImport } from './routes/expensive/index'\nimport { Route as DashboardIndexRouteImport } from './routes/dashboard.index'\nimport { Route as FooBarRouteImport } from './routes/foo/bar'\nimport { Route as PathlessLayoutRouteBRouteImport } from './routes/_pathlessLayout.route-b'\nimport { Route as PathlessLayoutRouteARouteImport } from './routes/_pathlessLayout.route-a'\nimport { Route as AuthProfileRouteImport } from './routes/_auth.profile'\nimport { Route as DashboardUsersRouteRouteImport } from './routes/dashboard.users.route'\nimport { Route as DashboardInvoicesRouteRouteImport } from './routes/dashboard.invoices.route'\nimport { Route as DashboardUsersIndexRouteImport } from './routes/dashboard.users.index'\nimport { Route as DashboardInvoicesIndexRouteImport } from './routes/dashboard.invoices.index'\nimport { Route as DashboardUsersUserRouteImport } from './routes/dashboard.users.user'\nimport { Route as DashboardInvoicesInvoiceIdRouteImport } from './routes/dashboard.invoices.$invoiceId'\n\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthRoute = AuthRouteImport.update({\n  id: '/_auth',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardRouteRoute = DashboardRouteRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ExpensiveIndexRoute = ExpensiveIndexRouteImport.update({\n  id: '/expensive/',\n  path: '/expensive/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardIndexRoute = DashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\nconst FooBarRoute = FooBarRouteImport.update({\n  id: '/foo/bar',\n  path: '/foo/bar',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRouteBRoute = PathlessLayoutRouteBRouteImport.update({\n  id: '/route-b',\n  path: '/route-b',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst PathlessLayoutRouteARoute = PathlessLayoutRouteARouteImport.update({\n  id: '/route-a',\n  path: '/route-a',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst AuthProfileRoute = AuthProfileRouteImport.update({\n  id: '/profile',\n  path: '/profile',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst DashboardUsersRouteRoute = DashboardUsersRouteRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\nconst DashboardInvoicesRouteRoute = DashboardInvoicesRouteRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\nconst DashboardUsersIndexRoute = DashboardUsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardUsersRouteRoute,\n} as any)\nconst DashboardInvoicesIndexRoute = DashboardInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardInvoicesRouteRoute,\n} as any)\nconst DashboardUsersUserRoute = DashboardUsersUserRouteImport.update({\n  id: '/user',\n  path: '/user',\n  getParentRoute: () => DashboardUsersRouteRoute,\n} as any)\nconst DashboardInvoicesInvoiceIdRoute =\n  DashboardInvoicesInvoiceIdRouteImport.update({\n    id: '/$invoiceId',\n    path: '/$invoiceId',\n    getParentRoute: () => DashboardInvoicesRouteRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteRouteWithChildren\n  '/login': typeof LoginRoute\n  '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren\n  '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren\n  '/profile': typeof AuthProfileRoute\n  '/route-a': typeof PathlessLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutRouteBRoute\n  '/foo/bar': typeof FooBarRoute\n  '/dashboard/': typeof DashboardIndexRoute\n  '/expensive/': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users/': typeof DashboardUsersIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/profile': typeof AuthProfileRoute\n  '/route-a': typeof PathlessLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutRouteBRoute\n  '/foo/bar': typeof FooBarRoute\n  '/dashboard': typeof DashboardIndexRoute\n  '/expensive': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users': typeof DashboardUsersIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteRouteWithChildren\n  '/_auth': typeof AuthRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/login': typeof LoginRoute\n  '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren\n  '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren\n  '/_auth/profile': typeof AuthProfileRoute\n  '/_pathlessLayout/route-a': typeof PathlessLayoutRouteARoute\n  '/_pathlessLayout/route-b': typeof PathlessLayoutRouteBRoute\n  '/foo/bar': typeof FooBarRoute\n  '/dashboard/': typeof DashboardIndexRoute\n  '/expensive/': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users/': typeof DashboardUsersIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/dashboard'\n    | '/login'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n    | '/profile'\n    | '/route-a'\n    | '/route-b'\n    | '/foo/bar'\n    | '/dashboard/'\n    | '/expensive/'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices/'\n    | '/dashboard/users/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/login'\n    | '/profile'\n    | '/route-a'\n    | '/route-b'\n    | '/foo/bar'\n    | '/dashboard'\n    | '/expensive'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n  id:\n    | '__root__'\n    | '/'\n    | '/dashboard'\n    | '/_auth'\n    | '/_pathlessLayout'\n    | '/login'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n    | '/_auth/profile'\n    | '/_pathlessLayout/route-a'\n    | '/_pathlessLayout/route-b'\n    | '/foo/bar'\n    | '/dashboard/'\n    | '/expensive/'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices/'\n    | '/dashboard/users/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DashboardRouteRoute: typeof DashboardRouteRouteWithChildren\n  AuthRoute: typeof AuthRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  FooBarRoute: typeof FooBarRoute\n  ExpensiveIndexRoute: typeof ExpensiveIndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/expensive/': {\n      id: '/expensive/'\n      path: '/expensive'\n      fullPath: '/expensive/'\n      preLoaderRoute: typeof ExpensiveIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardIndexRouteImport\n      parentRoute: typeof DashboardRouteRoute\n    }\n    '/foo/bar': {\n      id: '/foo/bar'\n      path: '/foo/bar'\n      fullPath: '/foo/bar'\n      preLoaderRoute: typeof FooBarRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/route-b': {\n      id: '/_pathlessLayout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/route-a': {\n      id: '/_pathlessLayout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_auth/profile': {\n      id: '/_auth/profile'\n      path: '/profile'\n      fullPath: '/profile'\n      preLoaderRoute: typeof AuthProfileRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/dashboard/users': {\n      id: '/dashboard/users'\n      path: '/users'\n      fullPath: '/dashboard/users'\n      preLoaderRoute: typeof DashboardUsersRouteRouteImport\n      parentRoute: typeof DashboardRouteRoute\n    }\n    '/dashboard/invoices': {\n      id: '/dashboard/invoices'\n      path: '/invoices'\n      fullPath: '/dashboard/invoices'\n      preLoaderRoute: typeof DashboardInvoicesRouteRouteImport\n      parentRoute: typeof DashboardRouteRoute\n    }\n    '/dashboard/users/': {\n      id: '/dashboard/users/'\n      path: '/'\n      fullPath: '/dashboard/users/'\n      preLoaderRoute: typeof DashboardUsersIndexRouteImport\n      parentRoute: typeof DashboardUsersRouteRoute\n    }\n    '/dashboard/invoices/': {\n      id: '/dashboard/invoices/'\n      path: '/'\n      fullPath: '/dashboard/invoices/'\n      preLoaderRoute: typeof DashboardInvoicesIndexRouteImport\n      parentRoute: typeof DashboardInvoicesRouteRoute\n    }\n    '/dashboard/users/user': {\n      id: '/dashboard/users/user'\n      path: '/user'\n      fullPath: '/dashboard/users/user'\n      preLoaderRoute: typeof DashboardUsersUserRouteImport\n      parentRoute: typeof DashboardUsersRouteRoute\n    }\n    '/dashboard/invoices/$invoiceId': {\n      id: '/dashboard/invoices/$invoiceId'\n      path: '/$invoiceId'\n      fullPath: '/dashboard/invoices/$invoiceId'\n      preLoaderRoute: typeof DashboardInvoicesInvoiceIdRouteImport\n      parentRoute: typeof DashboardInvoicesRouteRoute\n    }\n  }\n}\n\ninterface DashboardInvoicesRouteRouteChildren {\n  DashboardInvoicesInvoiceIdRoute: typeof DashboardInvoicesInvoiceIdRoute\n  DashboardInvoicesIndexRoute: typeof DashboardInvoicesIndexRoute\n}\n\nconst DashboardInvoicesRouteRouteChildren: DashboardInvoicesRouteRouteChildren =\n  {\n    DashboardInvoicesInvoiceIdRoute: DashboardInvoicesInvoiceIdRoute,\n    DashboardInvoicesIndexRoute: DashboardInvoicesIndexRoute,\n  }\n\nconst DashboardInvoicesRouteRouteWithChildren =\n  DashboardInvoicesRouteRoute._addFileChildren(\n    DashboardInvoicesRouteRouteChildren,\n  )\n\ninterface DashboardUsersRouteRouteChildren {\n  DashboardUsersUserRoute: typeof DashboardUsersUserRoute\n  DashboardUsersIndexRoute: typeof DashboardUsersIndexRoute\n}\n\nconst DashboardUsersRouteRouteChildren: DashboardUsersRouteRouteChildren = {\n  DashboardUsersUserRoute: DashboardUsersUserRoute,\n  DashboardUsersIndexRoute: DashboardUsersIndexRoute,\n}\n\nconst DashboardUsersRouteRouteWithChildren =\n  DashboardUsersRouteRoute._addFileChildren(DashboardUsersRouteRouteChildren)\n\ninterface DashboardRouteRouteChildren {\n  DashboardInvoicesRouteRoute: typeof DashboardInvoicesRouteRouteWithChildren\n  DashboardUsersRouteRoute: typeof DashboardUsersRouteRouteWithChildren\n  DashboardIndexRoute: typeof DashboardIndexRoute\n}\n\nconst DashboardRouteRouteChildren: DashboardRouteRouteChildren = {\n  DashboardInvoicesRouteRoute: DashboardInvoicesRouteRouteWithChildren,\n  DashboardUsersRouteRoute: DashboardUsersRouteRouteWithChildren,\n  DashboardIndexRoute: DashboardIndexRoute,\n}\n\nconst DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren(\n  DashboardRouteRouteChildren,\n)\n\ninterface AuthRouteChildren {\n  AuthProfileRoute: typeof AuthProfileRoute\n}\n\nconst AuthRouteChildren: AuthRouteChildren = {\n  AuthProfileRoute: AuthProfileRoute,\n}\n\nconst AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutRouteARoute: typeof PathlessLayoutRouteARoute\n  PathlessLayoutRouteBRoute: typeof PathlessLayoutRouteBRoute\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutRouteARoute: PathlessLayoutRouteARoute,\n  PathlessLayoutRouteBRoute: PathlessLayoutRouteBRoute,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DashboardRouteRoute: DashboardRouteRouteWithChildren,\n  AuthRoute: AuthRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  LoginRoute: LoginRoute,\n  FooBarRoute: FooBarRoute,\n  ExpensiveIndexRoute: ExpensiveIndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport { Spinner } from '../components/Spinner'\nimport type { QueryClient } from '@tanstack/react-query'\nimport type { Auth } from '../utils/auth'\n\nfunction RouterSpinner() {\n  const isLoading = useRouterState({ select: (s) => s.status === 'pending' })\n  return <Spinner show={isLoading} />\n}\n\nexport const Route = createRootRouteWithContext<{\n  auth: Auth\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className={`min-h-screen flex flex-col`}>\n        <div className={`flex items-center border-b gap-2`}>\n          <h1 className={`text-3xl p-2`}>Kitchen Sink</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div className={`text-3xl`}>\n            <RouterSpinner />\n          </div>\n        </div>\n        <div className={`flex-1 flex`}>\n          <div className={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n                ['/expensive', 'Expensive'],\n                ['/route-a', 'Pathless Layout A'],\n                ['/route-b', 'Pathless Layout B'],\n                ['/profile', 'Profile'],\n                ['/login', 'Login'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div key={to}>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    className={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ className: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div className={`flex-1 border-l`}>\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <ReactQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/_auth.profile.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/_auth/profile')({\n  component: ProfileComponent,\n})\n\nfunction ProfileComponent() {\n  const { username } = Route.useRouteContext()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <div>\n        Username:<strong>{username}</strong>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/_auth.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { redirect } from '@tanstack/react-router'\nimport { auth } from '../utils/auth'\n\nexport const Route = createFileRoute('/_auth')({\n  // Before loading, authenticate the user via our auth context\n  // This will also happen during prefetching (e.g. hovering over links, etc)\n  beforeLoad: ({ context, location }) => {\n    // If the user is logged out, redirect them to the login page\n    if (context.auth.status === 'loggedOut') {\n      throw redirect({\n        to: '/login',\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n\n    // Otherwise, return the user in context\n    return {\n      username: auth.username,\n    }\n  },\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/_pathlessLayout.route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/_pathlessLayout/route-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/_pathlessLayout.route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/_pathlessLayout/route-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>Layout</div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/dashboard.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { invoicesQueryOptions } from '../utils/queryOptions'\n\nexport const Route = createFileRoute('/dashboard/')({\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(invoicesQueryOptions()),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const invoicesQuery = useSuspenseQuery(invoicesQueryOptions())\n  const invoices = invoicesQuery.data\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{invoices.length} total invoices</strong>.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/dashboard.invoices.$invoiceId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, useNavigate } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { z } from 'zod'\nimport { InvoiceFields } from '../components/InvoiceFields'\nimport {\n  invoiceQueryOptions,\n  useUpdateInvoiceMutation,\n} from '../utils/queryOptions'\n\nexport const Route = createFileRoute('/dashboard/invoices/$invoiceId')({\n  params: {\n    parse: (params) => ({\n      invoiceId: z.number().int().parse(Number(params.invoiceId)),\n    }),\n    stringify: ({ invoiceId }) => ({ invoiceId: `${invoiceId}` }),\n  },\n  validateSearch: (search) =>\n    z\n      .object({\n        showNotes: z.boolean().optional(),\n        notes: z.string().optional(),\n      })\n      .parse(search),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(\n      invoiceQueryOptions(opts.params.invoiceId),\n    ),\n  component: InvoiceComponent,\n})\n\nfunction InvoiceComponent() {\n  const search = Route.useSearch()\n  const params = Route.useParams()\n  const navigate = useNavigate({ from: Route.fullPath })\n  const invoiceQuery = useSuspenseQuery(invoiceQueryOptions(params.invoiceId))\n  const invoice = invoiceQuery.data\n  const updateInvoiceMutation = useUpdateInvoiceMutation(params.invoiceId)\n  const [notes, setNotes] = React.useState(search.notes ?? '')\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => ({\n        ...old,\n        notes: notes ? notes : undefined,\n      }),\n      replace: true,\n      params: true,\n    })\n  }, [notes])\n\n  return (\n    <form\n      key={invoice.id}\n      onSubmit={(event) => {\n        event.preventDefault()\n        event.stopPropagation()\n        const formData = new FormData(event.target as HTMLFormElement)\n        updateInvoiceMutation.mutate({\n          id: invoice.id,\n          title: formData.get('title') as string,\n          body: formData.get('body') as string,\n        })\n      }}\n      className=\"p-2 space-y-2\"\n    >\n      <InvoiceFields\n        invoice={invoice}\n        disabled={updateInvoiceMutation.status === 'pending'}\n      />\n      <div>\n        <Link\n          from={Route.fullPath}\n          params={true}\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          className=\"text-blue-700\"\n        >\n          {search.showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search.showNotes ? (\n          <>\n            <div>\n              <div className=\"h-2\" />\n              <textarea\n                value={notes}\n                onChange={(e) => {\n                  setNotes(e.target.value)\n                }}\n                rows={5}\n                className=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div className=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n      <div>\n        <button\n          className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n          disabled={updateInvoiceMutation.status === 'pending'}\n        >\n          Save\n        </button>\n      </div>\n      {updateInvoiceMutation.variables?.id === invoice.id ? (\n        <div key={updateInvoiceMutation.submittedAt}>\n          {updateInvoiceMutation.status === 'success' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Saved!\n            </div>\n          ) : updateInvoiceMutation.status === 'error' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to save.\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n    </form>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/dashboard.invoices.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { InvoiceFields } from '../components/InvoiceFields'\nimport { Spinner } from '../components/Spinner'\nimport { useCreateInvoiceMutation } from '../utils/queryOptions'\nimport type { Invoice } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/invoices/')({\n  component: InvoicesIndexComponent,\n})\n\nfunction InvoicesIndexComponent() {\n  const createInvoiceMutation = useCreateInvoiceMutation()\n\n  return (\n    <>\n      <div className=\"p-2\">\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n            createInvoiceMutation.mutate({\n              title: formData.get('title') as string,\n              body: formData.get('body') as string,\n            })\n          }}\n          className=\"space-y-2\"\n        >\n          <div>Create a new Invoice:</div>\n          <InvoiceFields invoice={{} as Invoice} />\n          <div>\n            <button\n              className=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              disabled={createInvoiceMutation.status === 'pending'}\n            >\n              {createInvoiceMutation.status === 'pending' ? (\n                <>\n                  Creating <Spinner />\n                </>\n              ) : (\n                'Create'\n              )}\n            </button>\n          </div>\n          {createInvoiceMutation.status === 'success' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Created!\n            </div>\n          ) : createInvoiceMutation.status === 'error' ? (\n            <div className=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to create.\n            </div>\n          ) : null}\n        </form>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/dashboard.invoices.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, MatchRoute, Outlet } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { Spinner } from '../components/Spinner'\nimport { invoicesQueryOptions } from '../utils/queryOptions'\n\nexport const Route = createFileRoute('/dashboard/invoices')({\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(invoicesQueryOptions()),\n  component: InvoicesComponent,\n})\n\nfunction InvoicesComponent() {\n  const invoicesQuery = useSuspenseQuery(invoicesQueryOptions())\n  const invoices = invoicesQuery.data\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y w-48\">\n        {invoices.map((invoice) => {\n          return (\n            <div key={invoice.id}>\n              <Link\n                to=\"/dashboard/invoices/$invoiceId\"\n                params={{\n                  invoiceId: invoice.id,\n                }}\n                preload=\"intent\"\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  #{invoice.id} - {invoice.title.slice(0, 10)}{' '}\n                  <MatchRoute\n                    to=\"/dashboard/invoices/$invoiceId\"\n                    params={{\n                      invoiceId: invoice.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex-1 border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/dashboard.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  return (\n    <>\n      <div className=\"flex items-center border-b\">\n        <h2 className=\"text-xl p-2\">Dashboard</h2>\n      </div>\n      <div className=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['/dashboard', 'Summary', true],\n            ['/dashboard/invoices', 'Invoices'],\n            ['/dashboard/users', 'Users'],\n          ] as const\n        ).map(([to, label, exact]) => {\n          return (\n            <Link\n              key={to}\n              to={to}\n              activeOptions={{ exact }}\n              activeProps={{ className: `font-bold` }}\n              className=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/dashboard.users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/dashboard/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <p>\n        Normally, setting default search parameters would either need to be done\n        manually in every link to a page, or as a side-effect (not a great\n        experience).\n      </p>\n      <p>\n        Instead, we can use <strong>search filters</strong> to provide defaults\n        or even persist search params for links to routes (and child routes).\n      </p>\n      <p>\n        A good example of this is the sorting and filtering of the users list.\n        In a traditional router, both would be lost while navigating around\n        individual users or even changing each sort/filter option unless each\n        state was manually passed from the current route into each new link we\n        created (that's a lot of tedious and error-prone work). With TanStack\n        router and search filters, they are persisted with little effort.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/dashboard.users.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport * as React from 'react'\nimport {\n  Link,\n  MatchRoute,\n  Outlet,\n  retainSearchParams,\n  useNavigate,\n} from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { z } from 'zod'\nimport { Spinner } from '../components/Spinner'\nimport { usersQueryOptions } from '../utils/queryOptions'\n\ntype UsersViewSortBy = 'name' | 'id' | 'email'\n\nexport const Route = createFileRoute('/dashboard/users')({\n  validateSearch: z.object({\n    usersView: z\n      .object({\n        sortBy: z.enum(['name', 'id', 'email']).optional(),\n        filterBy: z.string().optional(),\n      })\n      .optional(),\n  }).parse,\n  search: {\n    // Retain the usersView search param while navigating\n    // within or to this route (or it's children!)\n    middlewares: [retainSearchParams(['usersView'])],\n  },\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(usersQueryOptions({})),\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const navigate = useNavigate({ from: Route.fullPath })\n  const { usersView } = Route.useSearch()\n  const usersQuery = useSuspenseQuery(usersQueryOptions(Route.useLoaderDeps()))\n  const users = usersQuery.data\n  const sortBy = usersView?.sortBy ?? 'name'\n  const filterBy = usersView?.filterBy\n\n  const [filterDraft, setFilterDraft] = React.useState(filterBy ?? '')\n\n  React.useEffect(() => {\n    setFilterDraft(filterBy ?? '')\n  }, [filterBy])\n\n  const sortedUsers = React.useMemo(() => {\n    if (!users) return []\n\n    return !sortBy\n      ? users\n      : [...users].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n  }, [users, sortBy])\n\n  const filteredUsers = React.useMemo(() => {\n    if (!filterBy) return sortedUsers\n\n    return sortedUsers.filter((user) =>\n      user.name.toLowerCase().includes(filterBy.toLowerCase()),\n    )\n  }, [sortedUsers, filterBy])\n\n  const setSortBy = (sortBy: UsersViewSortBy) =>\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...(old?.usersView ?? {}),\n            sortBy,\n          },\n        }\n      },\n      replace: true,\n    })\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...old?.usersView,\n            filterBy: filterDraft || undefined,\n          },\n        }\n      },\n      replace: true,\n    })\n  }, [filterDraft])\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y\">\n        <div className=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Sort By:</div>\n          <select\n            value={sortBy}\n            onChange={(e) => setSortBy(e.target.value as UsersViewSortBy)}\n            className=\"flex-1 border p-1 px-2 rounded-sm\"\n          >\n            {['name', 'id', 'email'].map((d) => {\n              return <option key={d} value={d} children={d} />\n            })}\n          </select>\n        </div>\n        <div className=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Filter By:</div>\n          <input\n            value={filterDraft}\n            onChange={(e) => setFilterDraft(e.target.value)}\n            placeholder=\"Search Names...\"\n            className=\"min-w-0 flex-1 border p-1 px-2 rounded-sm\"\n          />\n        </div>\n        {filteredUsers?.map((user) => {\n          return (\n            <div key={user.id}>\n              <Link\n                to=\"/dashboard/users/user\"\n                search={{\n                  userId: user.id,\n                }}\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  {user.name}{' '}\n                  <MatchRoute\n                    to=\"/dashboard/users/user\"\n                    search={{\n                      userId: user.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex-initial border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/dashboard.users.user.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { z } from 'zod'\nimport { userQueryOptions } from '../utils/queryOptions'\n\nexport const Route = createFileRoute('/dashboard/users/user')({\n  validateSearch: z.object({\n    userId: z.number(),\n  }),\n  loaderDeps: ({ search: { userId } }) => ({ userId }),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(\n      userQueryOptions(opts.deps.userId),\n    ),\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const search = Route.useSearch()\n  const userQuery = useSuspenseQuery(userQueryOptions(search.userId))\n  const user = userQuery.data\n\n  return (\n    <>\n      <h4 className=\"p-2 font-bold\">{user?.name}</h4>\n      <pre className=\"text-sm whitespace-pre-wrap\">\n        {JSON.stringify(user, null, 2)}\n      </pre>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/expensive/-components/Expensive.tsx",
    "content": "import * as React from 'react'\n\nexport default function Expensive() {\n  return (\n    <div className={`p-2`}>\n      I am an \"expensive\" component... which really just means that I was\n      code-split 😉\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/expensive/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport Expensive from './-components/Expensive'\n\nexport const Route = createFileRoute('/expensive/')({\n  component: Expensive,\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/foo/bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/foo/bar')({\n  component: () => <div>{JSON.stringify(Route.useSearch())}</div>,\n  validateSearch: z.object({ asdf: z.string() }),\n})\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className={`p-2`}>\n      <div className={`text-lg`}>Welcome Home!</div>\n      <hr className={`my-2`} />\n      <Link\n        to=\"/dashboard/invoices/$invoiceId\"\n        params={{\n          invoiceId: 3,\n        }}\n        className={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr className={`my-2`} />\n      <div className={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr className={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr className={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { useRouter } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: z.object({\n    redirect: z.string().optional(),\n  }),\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const { auth, status } = Route.useRouteContext({\n    select: ({ auth }) => ({ auth, status: auth.status }),\n  })\n  const search = Route.useSearch()\n  const [username, setUsername] = React.useState('')\n\n  const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {\n    e.preventDefault()\n    auth.login(username)\n    router.invalidate()\n  }\n\n  // Ah, the subtle nuances of client side auth. 🙄\n  React.useLayoutEffect(() => {\n    if (status === 'loggedIn' && search.redirect) {\n      router.history.push(search.redirect)\n    }\n  }, [status, search.redirect])\n\n  return status === 'loggedIn' ? (\n    <div>\n      Logged in as <strong>{auth.username}</strong>\n      <div className=\"h-2\" />\n      <button\n        onClick={() => {\n          auth.logout()\n          router.invalidate()\n        }}\n        className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n      >\n        Log out\n      </button>\n      <div className=\"h-2\" />\n    </div>\n  ) : (\n    <div className=\"p-2\">\n      <div>You must log in!</div>\n      <div className=\"h-2\" />\n      <form onSubmit={onSubmit} className=\"flex gap-2\">\n        <input\n          value={username}\n          onChange={(e) => setUsername(e.target.value)}\n          placeholder=\"Username\"\n          className=\"border p-1 px-2 rounded-sm\"\n        />\n        <button\n          type=\"submit\"\n          className=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n        >\n          Login\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/utils/auth.tsx",
    "content": "export const auth: Auth = {\n  status: 'loggedOut',\n  username: undefined,\n  login: (username: string) => {\n    auth.status = 'loggedIn'\n    auth.username = username\n  },\n  logout: () => {\n    auth.status = 'loggedOut'\n    auth.username = undefined\n  },\n}\n\nexport type Auth = {\n  login: (username: string) => void\n  logout: () => void\n  status: 'loggedOut' | 'loggedIn'\n  username?: string\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/utils/mockTodos.ts",
    "content": "import axios from 'redaxios'\nimport { produce } from 'immer'\nimport { actionDelayFn, loaderDelayFn, shuffle } from './utils'\n\ntype PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> &\n  Required<Pick<TValue, TKey>>\n\nexport type Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nlet invoices: Array<Invoice> = null!\nlet users: Array<User> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\nlet usersPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nconst ensureUsers = async () => {\n  if (!usersPromise) {\n    usersPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/users',\n      )\n      users = data.slice(0, 10)\n    })\n  }\n\n  await usersPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n\nexport async function postInvoice(partialInvoice: Partial<Invoice>) {\n  return actionDelayFn(() => {\n    if (partialInvoice.title?.includes('error')) {\n      console.error('error')\n      throw new Error('Ouch!')\n    }\n    const invoice = {\n      id: invoices.length + 1,\n      title:\n        partialInvoice.title ?? `New Invoice ${String(Date.now()).slice(0, 5)}`,\n      body:\n        partialInvoice.body ??\n        shuffle(\n          `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n      Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. \n      Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna.  Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.\n      `.split(' '),\n        ).join(' '),\n    }\n    invoices = [...invoices, invoice]\n    return invoice\n  })\n}\n\nexport async function patchInvoice({\n  id,\n  ...updatedInvoice\n}: PickAsRequired<Partial<Invoice>, 'id'>) {\n  return actionDelayFn(() => {\n    invoices = produce(invoices, (draft) => {\n      const invoice = draft.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found.')\n      }\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (updatedInvoice.title?.toLocaleLowerCase()?.includes('error')) {\n        throw new Error('Ouch!')\n      }\n      Object.assign(invoice, updatedInvoice)\n    })\n\n    return invoices.find((d) => d.id === id)\n  })\n}\n\nexport type UsersSortBy = 'name' | 'id' | 'email'\n\nexport async function fetchUsers({\n  filterBy,\n  sortBy,\n}: { filterBy?: string; sortBy?: UsersSortBy } = {}) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => {\n      let usersDraft = users\n\n      if (filterBy) {\n        usersDraft = usersDraft.filter((d) =>\n          d.name.toLowerCase().includes(filterBy.toLowerCase()),\n        )\n      }\n\n      if (sortBy) {\n        usersDraft = [...usersDraft].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n      }\n\n      return usersDraft\n    }),\n  )\n}\n\nexport async function fetchUserById(id: number) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => users.find((d) => d.id === id)),\n  )\n}\n\nexport async function fetchRandomNumber() {\n  return loaderDelayFn(() => {\n    return Math.random()\n  })\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/utils/queryOptions.ts",
    "content": "import { queryOptions, useMutation } from '@tanstack/react-query'\nimport {\n  fetchInvoiceById,\n  fetchInvoices,\n  fetchUserById,\n  fetchUsers,\n  patchInvoice,\n  postInvoice,\n} from './mockTodos'\n\nimport { queryClient } from '../main'\n\nexport const invoicesQueryOptions = () =>\n  queryOptions({\n    queryKey: ['invoices'],\n    queryFn: () => fetchInvoices(),\n  })\n\nexport const invoiceQueryOptions = (invoiceId: number) =>\n  queryOptions({\n    queryKey: ['invoices', invoiceId],\n    queryFn: () => fetchInvoiceById(invoiceId),\n  })\n\nexport const usersQueryOptions = (opts: {\n  filterBy?: string\n  sortBy?: 'name' | 'id' | 'email'\n}) =>\n  queryOptions({\n    queryKey: ['users', opts],\n    queryFn: () => fetchUsers(opts),\n  })\n\nexport const userQueryOptions = (userId: number) =>\n  queryOptions({\n    queryKey: ['users', userId],\n    queryFn: () => fetchUserById(userId),\n  })\n\nexport const useCreateInvoiceMutation = () => {\n  return useMutation({\n    // mutationKey: ['invoices', 'create'],\n    mutationFn: postInvoice,\n    onSuccess: () => queryClient.invalidateQueries(),\n  })\n}\n\nexport const useUpdateInvoiceMutation = (invoiceId: number) => {\n  return useMutation({\n    mutationKey: ['invoices', 'update', invoiceId],\n    mutationFn: patchInvoice,\n    onSuccess: () => queryClient.invalidateQueries(),\n    gcTime: 1000 * 10,\n  })\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/src/utils/utils.tsx",
    "content": "export async function loaderDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\nexport async function actionDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('actionDelay') ?? 0)\n  await new Promise((r) => setTimeout(r, delay))\n  return fn()\n}\n\nexport function shuffle<T>(arr: Array<T>): Array<T> {\n  let i = arr.length\n  if (i == 0) return arr\n  const copy = [...arr]\n  while (--i) {\n    const j = Math.floor(Math.random() * (i + 1))\n    const a = copy[i]\n    const b = copy[j]\n    copy[i] = b!\n    copy[j] = a!\n  }\n  return copy\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/kitchen-sink-react-query-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/large-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/large-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n(gen)\n"
  },
  {
    "path": "examples/react/large-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/large-file-based/README.md",
    "content": "# TanStack Router - Large File-Based Example\n\nA large-scale file-based routing example demonstrating performance with many routes.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/large-file-based large-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Large-scale file-based routing\n- Performance with many routes\n- Code splitting\n- Lazy loading\n- Scalability patterns\n"
  },
  {
    "path": "examples/react/large-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/large-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-large-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"gen\": \"node ./src/createRoutes.mjs\",\n    \"test:types\": \"tsc --extendedDiagnostics\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/createRoutes.mjs",
    "content": "import { readFile, writeFile, mkdir } from 'fs/promises'\nimport { existsSync } from 'fs'\n\nconst length = 100\n\nconst main = async () => {\n  const absolute = (await readFile('./src/routes/absolute.tsx')).toString()\n  const relative = (await readFile('./src/routes/relative.tsx')).toString()\n  const searchRoute = (\n    await readFile('./src/routes/search/route.tsx')\n  ).toString()\n  const search = (\n    await readFile('./src/routes/search/searchPlaceholder.tsx')\n  ).toString()\n  const paramsRoute = (\n    await readFile('./src/routes/params/route.tsx')\n  ).toString()\n  const params = await (\n    await readFile('./src/routes/params/$paramsPlaceholder.tsx')\n  ).toString()\n\n  if (!existsSync('./src/routes/(gen)')) {\n    await mkdir('./src/routes/(gen)')\n  }\n\n  if (!existsSync('./src/routes/(gen)/search')) {\n    await mkdir('./src/routes/(gen)/search')\n  }\n\n  if (!existsSync('./src/routes/(gen)/params')) {\n    await mkdir('./src/routes/(gen)/params')\n  }\n\n  await writeFile('./src/routes/(gen)/search/route.tsx', searchRoute)\n  await writeFile('./src/routes/(gen)/params/route.tsx', paramsRoute)\n\n  for (let y = 0; y < length; y = y + 1) {\n    const replacedAbsolute = absolute.replaceAll('/absolute', `/absolute${y}`)\n    const replacedRelative = relative.replaceAll('/relative', `/relative${y}`)\n    const replacedSearch = search.replaceAll('searchPlaceholder', `search${y}`)\n    const replacedParams = params.replaceAll('paramsPlaceholder', `param${y}`)\n    await writeFile(`./src/routes/(gen)/absolute${y}.tsx`, replacedAbsolute)\n    await writeFile(`./src/routes/(gen)/relative${y}.tsx`, replacedRelative)\n    await writeFile(`./src/routes/(gen)/search/search${y}.tsx`, replacedSearch)\n    await writeFile(`./src/routes/(gen)/params/$param${y}.tsx`, replacedParams)\n  }\n}\n\nmain()\n"
  },
  {
    "path": "examples/react/large-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { QueryClient } from '@tanstack/react-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nexport const queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as RelativeRouteImport } from './routes/relative'\nimport { Route as LinkPropsRouteImport } from './routes/linkProps'\nimport { Route as AbsoluteRouteImport } from './routes/absolute'\nimport { Route as SearchRouteRouteImport } from './routes/search/route'\nimport { Route as ParamsRouteRouteImport } from './routes/params/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SearchSearchPlaceholderRouteImport } from './routes/search/searchPlaceholder'\nimport { Route as ParamsParamsPlaceholderRouteImport } from './routes/params/$paramsPlaceholder'\n\nconst RelativeRoute = RelativeRouteImport.update({\n  id: '/relative',\n  path: '/relative',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LinkPropsRoute = LinkPropsRouteImport.update({\n  id: '/linkProps',\n  path: '/linkProps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbsoluteRoute = AbsoluteRouteImport.update({\n  id: '/absolute',\n  path: '/absolute',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchRouteRoute = SearchRouteRouteImport.update({\n  id: '/search',\n  path: '/search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsRouteRoute = ParamsRouteRouteImport.update({\n  id: '/params',\n  path: '/params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchSearchPlaceholderRoute = SearchSearchPlaceholderRouteImport.update({\n  id: '/searchPlaceholder',\n  path: '/searchPlaceholder',\n  getParentRoute: () => SearchRouteRoute,\n} as any)\nconst ParamsParamsPlaceholderRoute = ParamsParamsPlaceholderRouteImport.update({\n  id: '/$paramsPlaceholder',\n  path: '/$paramsPlaceholder',\n  getParentRoute: () => ParamsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  id:\n    | '__root__'\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ParamsRouteRoute: typeof ParamsRouteRouteWithChildren\n  SearchRouteRoute: typeof SearchRouteRouteWithChildren\n  AbsoluteRoute: typeof AbsoluteRoute\n  LinkPropsRoute: typeof LinkPropsRoute\n  RelativeRoute: typeof RelativeRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/relative': {\n      id: '/relative'\n      path: '/relative'\n      fullPath: '/relative'\n      preLoaderRoute: typeof RelativeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/linkProps': {\n      id: '/linkProps'\n      path: '/linkProps'\n      fullPath: '/linkProps'\n      preLoaderRoute: typeof LinkPropsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/absolute': {\n      id: '/absolute'\n      path: '/absolute'\n      fullPath: '/absolute'\n      preLoaderRoute: typeof AbsoluteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search': {\n      id: '/search'\n      path: '/search'\n      fullPath: '/search'\n      preLoaderRoute: typeof SearchRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params': {\n      id: '/params'\n      path: '/params'\n      fullPath: '/params'\n      preLoaderRoute: typeof ParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search/searchPlaceholder': {\n      id: '/search/searchPlaceholder'\n      path: '/searchPlaceholder'\n      fullPath: '/search/searchPlaceholder'\n      preLoaderRoute: typeof SearchSearchPlaceholderRouteImport\n      parentRoute: typeof SearchRouteRoute\n    }\n    '/params/$paramsPlaceholder': {\n      id: '/params/$paramsPlaceholder'\n      path: '/$paramsPlaceholder'\n      fullPath: '/params/$paramsPlaceholder'\n      preLoaderRoute: typeof ParamsParamsPlaceholderRouteImport\n      parentRoute: typeof ParamsRouteRoute\n    }\n  }\n}\n\ninterface ParamsRouteRouteChildren {\n  ParamsParamsPlaceholderRoute: typeof ParamsParamsPlaceholderRoute\n}\n\nconst ParamsRouteRouteChildren: ParamsRouteRouteChildren = {\n  ParamsParamsPlaceholderRoute: ParamsParamsPlaceholderRoute,\n}\n\nconst ParamsRouteRouteWithChildren = ParamsRouteRoute._addFileChildren(\n  ParamsRouteRouteChildren,\n)\n\ninterface SearchRouteRouteChildren {\n  SearchSearchPlaceholderRoute: typeof SearchSearchPlaceholderRoute\n}\n\nconst SearchRouteRouteChildren: SearchRouteRouteChildren = {\n  SearchSearchPlaceholderRoute: SearchSearchPlaceholderRoute,\n}\n\nconst SearchRouteRouteWithChildren = SearchRouteRoute._addFileChildren(\n  SearchRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ParamsRouteRoute: ParamsRouteRouteWithChildren,\n  SearchRouteRoute: SearchRouteRouteWithChildren,\n  AbsoluteRoute: AbsoluteRoute,\n  LinkPropsRoute: LinkPropsRoute,\n  RelativeRoute: RelativeRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { type QueryClient } from '@tanstack/react-query'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport interface Context {\n  queryClient: QueryClient\n}\n\nexport const Route = createRootRouteWithContext<Context>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return <p>Not Found (on root route)</p>\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/absolute.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/absolute')({\n  component: AbsoluteComponent,\n})\n\nfunction AbsoluteComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/absolute\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Absolute\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/linkProps.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, linkOptions } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/linkProps')({\n  component: LinkPropsPage,\n})\n\nfunction LinkPropsPage() {\n  const linkProps = linkOptions({\n    to: '/absolute',\n  })\n\n  return <Link {...linkProps} />\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/params/$paramsPlaceholder.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { queryOptions } from '@tanstack/react-query'\n\nconst params = z.object({\n  oneParamsPlaceholder: z.literal('oneParamsPlaceholder'),\n  twoParamsPlaceholder: z.literal('twoParamsPlaceholder'),\n  threeParamsPlaceholder: z.literal('threeParamsPlaceholder'),\n})\n\nconst loaderResult = z.object({\n  params,\n})\n\nconst paramsQueryOptions = queryOptions({\n  queryKey: ['paramsPlaceholder'],\n  queryFn: () => {\n    return loaderResult.parse({})\n  },\n})\n\nexport const Route = createFileRoute('/params/$paramsPlaceholder')({\n  component: ParamsComponent,\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(paramsQueryOptions),\n})\n\nfunction ParamsComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/params/$paramsPlaceholder\"\n        params={{\n          paramsPlaceholder: 'params',\n        }}\n      />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/params')({\n  component: () => <div>Hello /params!</div>,\n})\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/relative.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative')({\n  component: RelativeComponent,\n})\n\nfunction RelativeComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        from={Route.fullPath}\n        to=\"../relative\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Relative\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/search/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nimport { z } from 'zod'\n\nconst search = z.object({\n  rootSearch: z.number(),\n})\n\nexport const Route = createFileRoute('/search')({\n  component: () => <div>Hello /search!</div>,\n  validateSearch: search,\n})\n"
  },
  {
    "path": "examples/react/large-file-based/src/routes/search/searchPlaceholder.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\n\nimport { z } from 'zod'\nimport { queryOptions } from '@tanstack/react-query'\n\nconst search = z.object({\n  searchPlaceholder: z.literal('searchPlaceholder'),\n  page: z.number(),\n  offset: z.number(),\n  search: z.string(),\n})\n\nconst loaderResult = z.object({\n  searchPlaceholder: z.number(),\n})\n\nconst searchQueryOptions = queryOptions({\n  queryKey: ['searchPlaceholder'],\n  queryFn: () => {\n    const result = loaderResult.parse({\n      searchPlaceholder: 0,\n    })\n\n    return result\n  },\n})\n\nexport const Route = createFileRoute('/search/searchPlaceholder')({\n  component: SearchComponent,\n  validateSearch: search,\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(searchQueryOptions),\n})\n\nfunction SearchComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/search/searchPlaceholder\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n        search={{\n          searchPlaceholder: 'searchPlaceholder',\n          page: 0,\n          offset: 10,\n          search: 'search',\n          rootSearch: 0,\n        }}\n      >\n        Search\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/large-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/large-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"noEmit\": true,\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"]\n  }\n}\n"
  },
  {
    "path": "examples/react/large-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/location-masking/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/location-masking/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/location-masking/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/location-masking/README.md",
    "content": "# TanStack Router - Location Masking Example\n\nAn example demonstrating location masking for URL privacy.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/location-masking location-masking\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Location masking\n- URL privacy\n- Hiding sensitive route information\n- Custom URL display\n- Security patterns\n"
  },
  {
    "path": "examples/react/location-masking/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/location-masking/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-location-masking\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@radix-ui/react-dialog\": \"^1.1.6\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/location-masking/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouteMask,\n  createRouter,\n  useNavigate,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as Dialog from '@radix-ui/react-dialog'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport './styles.css'\n\ntype PhotoType = {\n  id: string\n  title: string\n  url: string\n  thumbnailUrl: string\n  albumId: string\n}\n\nclass NotFoundError extends Error {}\n\nconst fetchPhotos = async () => {\n  console.info('Fetching photos...')\n  await new Promise((r) => setTimeout(r, 500))\n  // Generate mock photos using picsum.photos since via.placeholder.com is down\n  return Array.from({ length: 10 }, (_, i) => ({\n    id: String(i + 1),\n    title: `Photo ${i + 1}`,\n    url: `https://picsum.photos/600/400?random=${i + 1}`,\n    thumbnailUrl: `https://picsum.photos/200/200?random=${i + 1}`,\n    albumId: '1',\n  }))\n}\n\nconst fetchPhoto = async (photoId: string) => {\n  console.info(`Fetching photo with id ${photoId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n\n  // Simulate photo not found for invalid IDs\n  const photoIdNum = parseInt(photoId, 10)\n  if (isNaN(photoIdNum) || photoIdNum < 1 || photoIdNum > 10) {\n    throw new NotFoundError(`Photo with id \"${photoId}\" not found!`)\n  }\n\n  // Generate mock photo using picsum.photos\n  return {\n    id: photoId,\n    title: `Photo ${photoId}`,\n    url: `https://picsum.photos/600/400?random=${photoId}`,\n    thumbnailUrl: `https://picsum.photos/200/200?random=${photoId}`,\n    albumId: '1',\n  }\n}\n\ntype PhotoModal = {\n  id: 'photo'\n  photoId: string\n}\n\ntype ModalObject = PhotoModal\n\nexport function Spinner() {\n  return (\n    <div className=\"animate-spin px-3 text-xl inline-flex items-center justify-center\">\n      ⍥\n    </div>\n  )\n}\n\nconst rootRoute = createRootRoute({\n  validateSearch: (search) =>\n    search as {\n      modal?: ModalObject\n    },\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const status = useRouterState({ select: (s) => s.status })\n\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/photos\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Photos\n        </Link>{' '}\n        {status === 'pending' ? <Spinner /> : null}\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nfunction Modal(props: Dialog.DialogProps) {\n  return (\n    <Dialog.Root open {...props}>\n      <Dialog.Portal>\n        <Dialog.Overlay className=\"fixed inset-0 bg-black/70\" />\n        <Dialog.DialogContent className=\"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\">\n          {props.children}\n        </Dialog.DialogContent>\n      </Dialog.Portal>\n    </Dialog.Root>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: () => {\n    return (\n      <div className=\"p-2\">\n        <h3>Welcome Home!</h3>\n      </div>\n    )\n  },\n})\nconst photosLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'photos',\n  loader: fetchPhotos,\n  component: PhotosRoute,\n})\n\nfunction PhotosRoute() {\n  const photos = photosLayoutRoute.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <ul className=\"grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-2\">\n        {[\n          ...photos,\n          { id: 'i-do-not-exist', title: 'Missing Photo Test', url: '' },\n        ].map((photo) => {\n          return (\n            <li key={photo.id} className=\"\">\n              <Link\n                to={photoModalRoute.to}\n                params={{\n                  photoId: photo.id,\n                }}\n                // If you want to use a mask, you can do so like this, but\n                // it's generally safer to set up a route mask instead.\n                // mask={{\n                //   to: photoRoute.to,\n                //   params: {\n                //     photoId: photo.id,\n                //   },\n                // }}\n                className=\"whitespace-nowrap border rounded-lg shadow-xs flex items-center hover:shadow-lg text-blue-600 hover:scale-[1.1] overflow-hidden transition-all\"\n              >\n                <img src={photo.url} alt={photo.title} className=\"max-w-full\" />\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n\nconst photoRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'photos/$photoId',\n  loader: async ({ params: { photoId } }) => fetchPhoto(photoId),\n  errorComponent: PhotoErrorComponent,\n  component: PhotoComponent,\n})\n\nfunction PhotoErrorComponent({ error }: ErrorComponentProps) {\n  return (\n    <div className=\"p-4\">\n      {(() => {\n        if (error instanceof NotFoundError) {\n          return <div>{error.message}</div>\n        }\n        return <ErrorComponent error={error} />\n      })()}\n    </div>\n  )\n}\n\nfunction PhotoComponent() {\n  const photo = photoRoute.useLoaderData()\n\n  return (\n    <div className=\"p-4\">\n      <Photo photo={photo} />\n    </div>\n  )\n}\n\nconst photoModalRoute = createRoute({\n  getParentRoute: () => photosLayoutRoute,\n  path: '$photoId/modal',\n  loader: async ({ params: { photoId } }) => fetchPhoto(photoId),\n  errorComponent: PhotoModalErrorComponent,\n  // pendingComponent: PhotoModalPendingComponent,\n  component: PhotoModalComponent,\n})\n\nfunction PhotoModalErrorComponent({ error }: ErrorComponentProps) {\n  const navigate = useNavigate()\n\n  return (\n    <Modal\n      onOpenChange={(open) => {\n        if (!open) {\n          navigate({\n            to: photosLayoutRoute.to,\n          })\n        }\n      }}\n    >\n      <div className=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-lg\">\n        {(() => {\n          if (error instanceof NotFoundError) {\n            return <div>{error.message}</div>\n          }\n          return <ErrorComponent error={error} />\n        })()}\n      </div>\n    </Modal>\n  )\n}\n\nfunction PhotoModalPendingComponent() {\n  const navigate = useNavigate()\n\n  return (\n    <Modal\n      onOpenChange={(open) => {\n        if (!open) {\n          navigate({\n            to: photosLayoutRoute.to,\n          })\n        }\n      }}\n    >\n      <div className=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-lg\">\n        <Spinner />\n      </div>\n    </Modal>\n  )\n}\n\nfunction PhotoModalComponent() {\n  const navigate = useNavigate()\n  const photo = photoModalRoute.useLoaderData()\n\n  return (\n    <Modal\n      onOpenChange={(open) => {\n        if (!open) {\n          navigate({\n            to: photosLayoutRoute.to,\n          })\n        }\n      }}\n    >\n      <div className=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-lg\">\n        <Link\n          to=\".\"\n          target=\"_blank\"\n          className=\"text-blue-600 hover:opacity-75 underline\"\n        >\n          Open in new tab (to test de-masking)\n        </Link>\n        <Photo photo={photo} />\n      </div>\n    </Modal>\n  )\n}\n\nfunction Photo({ photo }: { photo: PhotoType }) {\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{photo.title}</h4>\n      <div className=\"\">\n        <img src={photo.url} alt={photo.title} className=\"max-w-full\" />\n      </div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  photoRoute,\n  photosLayoutRoute.addChildren([photoModalRoute]),\n  indexRoute,\n])\n\nconst photoModalToPhotoMask = createRouteMask({\n  routeTree,\n  from: '/photos/$photoId/modal',\n  to: '/photos/$photoId',\n  params: true,\n})\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  routeMasks: [photoModalToPhotoMask],\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/location-masking/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/location-masking/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/location-masking/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/navigation-blocking/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/navigation-blocking/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/navigation-blocking/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/navigation-blocking/README.md",
    "content": "# TanStack Router - Navigation Blocking Example\n\nAn example demonstrating navigation blocking and confirmation.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/navigation-blocking navigation-blocking\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Navigation blocking\n- Unsaved changes detection\n- Navigation confirmation dialogs\n- Form protection\n- User experience patterns\n"
  },
  {
    "path": "examples/react/navigation-blocking/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/navigation-blocking/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-navigation-blocking\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/navigation-blocking/src/main.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useBlocker,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  // block going from editor-1 to /foo/123?hello=world\n  const { proceed, reset, status } = useBlocker({\n    shouldBlockFn: ({ current, next }) => {\n      if (\n        current.routeId === '/editor-1' &&\n        next.fullPath === '/foo/$id' &&\n        next.params.id === '123' &&\n        next.search.hello === 'world'\n      ) {\n        return true\n      }\n      return false\n    },\n    enableBeforeUnload: false,\n    withResolver: true,\n  })\n\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/editor-1\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Editor 1\n        </Link>{' '}\n        <Link\n          to={'/editor-1/editor-2'}\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Editor 2\n        </Link>{' '}\n        <Link\n          to=\"/foo/$id\"\n          params={{ id: '123' }}\n          search={{ hello: 'world' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true, includeSearch: true }}\n        >\n          foo 123\n        </Link>{' '}\n        <Link\n          to=\"/foo/$id\"\n          params={{ id: '456' }}\n          search={{ hello: 'universe' }}\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true, includeSearch: true }}\n        >\n          foo 456\n        </Link>{' '}\n      </div>\n      <hr />\n\n      {status === 'blocked' && (\n        <div className=\"mt-2\">\n          <div>\n            Are you sure you want to leave editor 1 for /foo/123?hello=world ?\n          </div>\n          <button\n            className=\"bg-lime-500 text-white rounded-sm p-1 px-2 mr-2\"\n            onClick={proceed}\n          >\n            YES\n          </button>\n          <button\n            className=\"bg-red-500 text-white rounded-sm p-1 px-2\"\n            onClick={reset}\n          >\n            NO\n          </button>\n        </div>\n      )}\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst fooRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'foo/$id',\n  validateSearch: (search) => ({ hello: search.hello }) as { hello: string },\n  component: () => <>foo {fooRoute.useParams().id}</>,\n})\n\nconst editor1Route = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'editor-1',\n  component: Editor1Component,\n})\n\nfunction Editor1Component() {\n  const [value, setValue] = React.useState('')\n\n  // Block leaving editor-1 if there is text in the input\n  const { proceed, reset, next, current, status } = useBlocker({\n    shouldBlockFn: () => value !== '',\n    enableBeforeUnload: () => value !== '',\n    withResolver: true,\n  })\n\n  return (\n    <div className=\"flex flex-col p-2\">\n      <h3>Editor 1</h3>\n      <div>\n        <input\n          value={value}\n          onChange={(e) => setValue(e.target.value)}\n          className=\"border\"\n        />\n      </div>\n      <hr className=\"m-2\" />\n      <Link to=\"/editor-1/editor-2\">Go to Editor 2</Link>\n      <Outlet />\n\n      {status === 'blocked' && (\n        <div className=\"mt-2\">\n          <div>Are you sure you want to leave editor 1?</div>\n          <div>\n            You are going from {current.pathname} to {next.pathname}\n          </div>\n          <button\n            className=\"bg-lime-500 text-white rounded-sm p-1 px-2 mr-2\"\n            onClick={proceed}\n          >\n            YES\n          </button>\n          <button\n            className=\"bg-red-500 text-white rounded-sm p-1 px-2\"\n            onClick={reset}\n          >\n            NO\n          </button>\n        </div>\n      )}\n    </div>\n  )\n}\n\nconst editor2Route = createRoute({\n  getParentRoute: () => editor1Route,\n  path: 'editor-2',\n  component: Editor2Component,\n})\n\nfunction Editor2Component() {\n  const [value, setValue] = React.useState('')\n\n  return (\n    <div className=\"p-2\">\n      <h3>Editor 2</h3>\n      <input\n        value={value}\n        onChange={(e) => setValue(e.target.value)}\n        className=\"border\"\n      />\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  fooRoute,\n  editor1Route.addChildren([editor2Route]),\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/navigation-blocking/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/navigation-blocking/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/navigation-blocking/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/quickstart/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/quickstart/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/quickstart/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart/README.md",
    "content": "# TanStack Router - Quickstart Example\n\nA quickstart example to get started with TanStack Router quickly.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/quickstart quickstart\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nA minimal example demonstrating:\n\n- Quick setup of TanStack Router\n- Basic routing configuration\n- Simple navigation\n- Getting started guide\n"
  },
  {
    "path": "examples/react/quickstart/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/quickstart/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-quickstart\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart/src/main.tsx",
    "content": "import React, { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: () => (\n    <>\n      <div className=\"p-2 flex gap-2\">\n        <Link to=\"/\" className=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" className=\"[&.active]:font-bold\">\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: function Index() {\n    return (\n      <div className=\"p-2\">\n        <h3>Welcome Home!</h3>\n      </div>\n    )\n  },\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  component: function About() {\n    return <div className=\"p-2\">Hello from About!</div>\n  },\n})\n\nconst routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/quickstart/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/README.md",
    "content": "# TanStack Router - esbuild File-Based Quickstart\n\nA quickstart example using esbuild as the bundler with file-based routing.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [esbuild Documentation](https://esbuild.github.io/)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/quickstart-esbuild-file-based quickstart-esbuild-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- esbuild bundler integration\n- File-based routing\n- Fast build times\n- Minimal configuration\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/esbuild.config.js",
    "content": "import { tanstackRouter } from '@tanstack/router-plugin/esbuild'\n\nexport default {\n  jsx: 'transform',\n  minify: true,\n  sourcemap: true,\n  bundle: true,\n  format: 'esm',\n  target: ['esnext'],\n  plugins: [tanstackRouter({ target: 'react', autoCodeSplitting: true })],\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n    <script src=\"https://unpkg.com/@tailwindcss/browser@4\"></script>\n    <style type=\"text/tailwindcss\">\n      html {\n        color-scheme: light dark;\n      }\n      * {\n        @apply border-gray-200 dark:border-gray-800;\n      }\n      body {\n        @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n      }\n    </style>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/dist/main.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-quickstart-esbuild-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"esbuild src/main.tsx --serve=3001 --bundle --outfile=dist/main.js --watch --servedir=.\",\n    \"build\": \"esbuild src/main.tsx --bundle --outfile=dist/main.js\",\n    \"serve\": \"esbuild src/main.tsx --bundle --outfile=dist/main.js --servedir=.\",\n    \"start\": \"dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"esbuild\": \"^0.27.4\"\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<PostType[]>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/src/routeTree.gen.ts",
    "content": "/* prettier-ignore-start */\n\n/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file is auto-generated by TanStack Router\n\n// Import Routes\n\nimport { Route as rootRoute } from './routes/__root'\nimport { Route as AboutImport } from './routes/about'\nimport { Route as IndexImport } from './routes/index'\n\n// Create/Update Routes\n\nconst AboutRoute = AboutImport.update({\n  path: '/about',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst IndexRoute = IndexImport.update({\n  path: '/',\n  getParentRoute: () => rootRoute,\n} as any)\n\n// Populate the FileRoutesByPath interface\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexImport\n      parentRoute: typeof rootRoute\n    }\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutImport\n      parentRoute: typeof rootRoute\n    }\n  }\n}\n\n// Create and export the route tree\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\n\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\n\nexport interface FileRoutesById {\n  __root__: typeof rootRoute\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\n\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\n\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\n\nexport const routeTree = rootRoute\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\n/* prettier-ignore-end */\n\n/* ROUTE_MANIFEST_START\n{\n  \"routes\": {\n    \"__root__\": {\n      \"filePath\": \"__root.tsx\",\n      \"children\": [\n        \"/\",\n        \"/about\"\n      ]\n    },\n    \"/\": {\n      \"filePath\": \"index.tsx\"\n    },\n    \"/about\": {\n      \"filePath\": \"about.tsx\"\n    }\n  }\n}\nROUTE_MANIFEST_END */\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/about\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/src/routes/about.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/src/routes/index.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-esbuild-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/quickstart-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/README.md",
    "content": "# TanStack Router - File-Based Quickstart Example\n\nA quickstart example using file-based routing.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/quickstart-file-based quickstart-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Quick setup with file-based routing\n- Automatic route generation\n- Minimal configuration\n- Type-safe routes\n"
  },
  {
    "path": "examples/react/quickstart-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/quickstart-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-quickstart-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<PostType[]>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/quickstart-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/about\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\n\n# IDE\n.idea\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/README.md",
    "content": "# TanStack Router - Rspack File-Based Quickstart\n\nA quickstart example using Rspack as the bundler with file-based routing.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Rspack Documentation](https://www.rspack.dev/)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/quickstart-rspack-file-based quickstart-rspack-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Rspack bundler integration\n- File-based routing\n- Fast build times with Rust-based tooling\n- Webpack-compatible configuration\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-quickstart-rspack-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"rsbuild dev --port 3000\",\n    \"build\": \"rsbuild build && tsc --noEmit\",\n    \"preview\": \"rsbuild preview\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"postcss\": \"^8.5.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@rsbuild/core\": \"^1.2.4\",\n    \"@rsbuild/plugin-react\": \"^1.1.0\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"typescript\": \"^5.6.2\"\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/rsbuild.config.ts",
    "content": "import { defineConfig } from '@rsbuild/core'\nimport { pluginReact } from '@rsbuild/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\n\nexport default defineConfig({\n  plugins: [pluginReact()],\n  tools: {\n    rspack: {\n      plugins: [tanstackRouter({ target: 'react', autoCodeSplitting: true })],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/src/app.tsx",
    "content": "import * as React from 'react'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/src/env.d.ts",
    "content": "/// <reference types=\"@rsbuild/core/types\" />\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/src/index.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './app'\n\nconst rootEl = document.getElementById('root')\n\nif (rootEl) {\n  const root = ReactDOM.createRoot(rootEl)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/about\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/quickstart-rspack-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"react-jsx\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"moduleResolution\": \"bundler\",\n    \"useDefineForClassFields\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\n\n# IDE\n.idea\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/.swcrc",
    "content": "{\n  \"$schema\": \"https://swc.rs/schema.json\",\n  \"jsc\": {\n    \"target\": \"es2015\",\n    \"parser\": {\n      \"syntax\": \"typescript\",\n      \"tsx\": true\n    },\n    \"transform\": {\n      \"react\": {\n        \"runtime\": \"automatic\"\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/README.md",
    "content": "# TanStack Router - Webpack File-Based Quickstart\n\nA quickstart example using Webpack as the bundler with file-based routing.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Webpack Documentation](https://webpack.js.org/)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/quickstart-webpack-file-based quickstart-webpack-file-based\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Webpack bundler integration\n- File-based routing\n- Traditional bundler setup\n- Webpack configuration for TanStack Router\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-quickstart-webpack-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"webpack serve --port 3001 --no-open\",\n    \"build\": \"webpack build && tsc --noEmit\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@swc/core\": \"^1.10.15\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"html-webpack-plugin\": \"^5.6.3\",\n    \"swc-loader\": \"^0.2.6\",\n    \"typescript\": \"^5.7.2\",\n    \"webpack\": \"^5.97.1\",\n    \"webpack-cli\": \"^5.1.4\",\n    \"webpack-dev-server\": \"^5.2.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/public/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>TanStack router</title>\n    <script src=\"https://unpkg.com/@tailwindcss/browser@4\"></script>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/src/app.tsx",
    "content": "import { createRouter, RouterProvider } from '@tanstack/react-router'\n\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/src/index.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport App from './app'\n\nconst rootEl = document.getElementById('root')\n\nif (rootEl) {\n  const root = ReactDOM.createRoot(rootEl)\n  root.render(\n    <React.StrictMode>\n      <App />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/about\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"react-jsx\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"moduleResolution\": \"bundler\",\n    \"useDefineForClassFields\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/react/quickstart-webpack-file-based/webpack.config.js",
    "content": "import path from 'path'\nimport { fileURLToPath } from 'url'\nimport HtmlWebpackPlugin from 'html-webpack-plugin'\nimport { tanstackRouter } from '@tanstack/router-plugin/webpack'\n\nconst __dirname = fileURLToPath(new URL('.', import.meta.url))\n\n/** @type import('webpack').Configuration */\nexport default ({ WEBPACK_SERVE }) => ({\n  target: 'web',\n  mode: WEBPACK_SERVE ? 'development' : 'production',\n  entry: path.resolve(__dirname, './src/index.tsx'),\n  output: {\n    path: path.resolve(__dirname, './dist'),\n    filename: '[name].bundle.js',\n    publicPath: '/',\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: path.resolve(__dirname, './public/index.html'),\n      filename: 'index.html',\n    }),\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n  ],\n  module: {\n    rules: [\n      {\n        test: /\\.tsx?$/,\n        exclude: /(node_modules)/,\n        use: { loader: 'swc-loader' },\n      },\n    ],\n  },\n  devServer: {\n    open: true,\n    hot: true,\n    historyApiFallback: {\n      rewrites: [{ from: /./, to: '/index.html' }],\n    },\n    static: ['public'],\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n*.js\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\npnpm-workspace.yaml"
  },
  {
    "path": "examples/react/router-monorepo-react-query/.stackblitzrc",
    "content": "{\n  \"startCommand\": \"cp pnpm-workspace.yaml.example pnpm-workspace.yaml && pnpm install && pnpm dev\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/README.md",
    "content": "# Example of a monorepo with router and feature libraries\n\nAn example demonstrating TanStack Router in a monorepo setup with React Query.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [TanStack Query Docs](https://tanstack.com/query)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/router-monorepo-react-query router-monorepo-react-query\n```\n\n## Monorepo Setup\n\nA challenge with TanStack Router in a monorepo setup is that it requires TypeScript type augmentations. However, if you set this up directly in the final app, the links inside the libraries won't be type-safe. To solve this in a monorepo, you need a separate library just for the router, without any components, and then integrate it with the app.\n\nThis example showcases this approach using the following packages:\n\n- `packages/router` is the router library\n- `packages/post-query` is the post query collection library\n- `packages/post-feature` is the posts ui library\n- `packages/app` is the app\n\nWith this approach, we can use the query options from the data library both in the router and the feature library without creating circular dependencies.\n\nSince the router library re-exports the router components, importing them in the feature library ensures they remain type-safe, as they’re linked to the TypeScript augmentations.\n\nFinally, in the app, we can create a map of routes to components ([`packages/app/src/main.tsx`](./packages/app/src/main.tsx)), which ties the router to the components. **We could enforce lazy loading here, but it was left out for simplicity.** With this setup, we now have a fully type-safe router!\n\nHere is what it looks like in the monorepo:\n\n![graph](./assets/graph.png)\n\n- **Router library**: Contains route definitions and type augmentations\n- **Feature libraries**: Contain components and business logic\n- **App**: Integrates the router and feature libraries\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Monorepo structure with TanStack Router\n- TanStack Query integration\n- Shared data fetching logic\n- Workspace configuration\n- Code sharing across applications\n- Type-safe routing in a monorepo\n\n## Stackblitz limitation\n\n### TypeScript IDE feedback\n\nDue to a limitation on Stackblitz, the example's types are not properly inferred in the IDE, however as soon as you click on fork in the bottom right corner, the types should be correctly inferred.\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/package.json",
    "content": "{\n  \"name\": \"router-monorepo-react-query\",\n  \"private\": true,\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n    \"post-query\": \"pnpm --filter @router-mono-react-query/post-query\",\n    \"post-feature\": \"pnpm --filter @router-mono-react-query/post-feature\",\n    \"router\": \"pnpm --filter @router-mono-react-query/router\",\n    \"app\": \"pnpm --filter @router-mono-react-query/app\",\n    \"dev\": \"pnpm post-query build && pnpm router build && pnpm post-feature build && pnpm app dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"typescript\": \"^5.7.2\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/app/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/app/package.json",
    "content": "{\n  \"name\": \"@router-mono-react-query/app\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3001\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@router-mono-react-query/post-feature\": \"workspace:*\",\n    \"@router-mono-react-query/router\": \"workspace:*\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  },\n  \"nx\": {\n    \"targets\": {\n      \"dev\": {\n        \"dependsOn\": [\n          \"^build\"\n        ]\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/app/src/main.tsx",
    "content": "import React, { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider } from '@tanstack/react-router'\nimport { QueryClientProvider } from '@tanstack/react-query'\nimport { queryClient, router } from '@router-mono-react-query/router'\nimport {\n  PostErrorComponent,\n  PostIdComponent,\n  PostsListComponent,\n} from '@router-mono-react-query/post-feature'\nimport { RootComponent } from './rootComponent'\nimport type { RouterIds } from '@router-mono-react-query/router'\nimport './style.css'\n\n// Not lazy loaded for simplicity, but you could expose from your library component\n// individually, and enforce here to use react lazy components via typings\n// so that you have code splitting\nconst routerMap = {\n  '/': PostsListComponent,\n  '/$postId': PostIdComponent,\n  __root__: RootComponent,\n} as const satisfies Record<RouterIds, () => React.ReactElement>\n\nObject.entries(routerMap).forEach(([path, component]) => {\n  const foundRoute = router.routesById[path as RouterIds]\n\n  foundRoute.update({\n    component: component,\n  })\n})\n\n// And you can do the same logic with custom error pages, and any other properties\nconst errorComponentMap = {\n  '/': null,\n  '/$postId': PostErrorComponent,\n  __root__: null,\n} as const satisfies Record<RouterIds, React.ComponentType<any> | null>\n\nObject.entries(errorComponentMap).forEach(([path, component]) => {\n  if (!component) {\n    return\n  }\n\n  const foundRoute = router.routesById[path as RouterIds]\n  foundRoute.update({\n    errorComponent: component,\n  })\n})\n\n// Render the app\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <QueryClientProvider client={queryClient}>\n        <RouterProvider router={router} />\n      </QueryClientProvider>\n    </StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/app/src/rootComponent.tsx",
    "content": "import { Link, Outlet } from '@router-mono-react-query/router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\n\nexport function RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Posts list\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <ReactQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/app/src/style.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../../post-feature/src/**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/app/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/app/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n\n  server: {\n    port: 4200,\n    host: 'localhost',\n  },\n\n  preview: {\n    port: 4300,\n    host: 'localhost',\n  },\n  plugins: [\n    tailwindcss(),\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-feature/package.json",
    "content": "{\n  \"name\": \"@router-mono-react-query/post-feature\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@router-mono-react-query/post-query\": \"workspace:*\",\n    \"@router-mono-react-query/router\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-feature/src/PostError.tsx",
    "content": "import * as React from 'react'\nimport { PostNotFoundError } from '@router-mono-react-query/post-query'\nimport {\n  useRouter,\n  ErrorComponent,\n  ErrorComponentProps,\n} from '@router-mono-react-query/router'\nimport { useQueryErrorResetBoundary } from '@tanstack/react-query'\n\nexport function PostErrorComponent({ error, reset }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof PostNotFoundError) {\n    return <div>{error.message}</div>\n  }\n  const queryErrorResetBoundary = useQueryErrorResetBoundary()\n\n  React.useEffect(() => {\n    queryErrorResetBoundary.reset()\n  }, [queryErrorResetBoundary])\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-feature/src/PostIdPage.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { postQueryOptions } from '@router-mono-react-query/post-query'\n\nimport { getRouteApi } from '@router-mono-react-query/router'\n\nconst route = getRouteApi('/$postId')\n\nexport function PostIdComponent() {\n  const postId = route.useParams().postId\n  const { data: post } = useSuspenseQuery(postQueryOptions(postId))\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-feature/src/PostList.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { postsQueryOptions } from '@router-mono-react-query/post-query'\nimport { Link, Outlet } from '@router-mono-react-query/router'\n\nexport function PostsListComponent() {\n  const postsQuery = useSuspenseQuery(postsQueryOptions)\n  const posts = postsQuery.data\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-feature/src/index.ts",
    "content": "export * from './PostIdPage'\nexport * from './PostList'\nexport * from './PostError'\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-feature/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-feature/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport react from '@vitejs/plugin-react'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'react',\n        'react-dom',\n        'react/jsx-runtime',\n        '@tanstack/react-query',\n        '@tanstack/react-router',\n        '@router-mono-react-query/post-query',\n        '@router-mono-react-query/router',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-query/package.json",
    "content": "{\n  \"name\": \"@router-mono-react-query/post-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-query/src/index.ts",
    "content": "export * from './postQueryOptions'\nexport * from './postsQueryOptions'\nexport { PostNotFoundError } from './posts'\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-query/src/postQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport { fetchPost } from './posts'\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-query/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-query/src/postsQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport { fetchPosts } from './posts'\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/post-query/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'react',\n        'react-dom',\n        'react/jsx-runtime',\n        '@tanstack/react-query',\n        'redaxios',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/package.json",
    "content": "{\n  \"name\": \"@router-mono-react-query/router\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/history\": \"^1.161.6\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@router-mono-react-query/post-query\": \"workspace:*\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/src/index.ts",
    "content": "import { queryClient, router } from './router'\n\nexport type { RouterType, RouterIds } from './router'\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport { router, queryClient }\n\n// By re exporting the api from TanStack router, we can enforce that other packages\n// rely on this one instead, making the type register being applied\nexport {\n  Outlet,\n  Link,\n  useRouteContext,\n  useRouter,\n  RouterProvider,\n  getRouteApi,\n  ErrorComponent,\n} from '@tanstack/react-router'\nexport type { ErrorComponentProps } from '@tanstack/react-router'\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostIdRouteImport } from './routes/$postId'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst PostIdRoute = PostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/$postId'\n  id: '__root__' | '/' | '/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostIdRoute: typeof PostIdRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/$postId': {\n      id: '/$postId'\n      path: '/$postId'\n      fullPath: '/$postId'\n      preLoaderRoute: typeof PostIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostIdRoute: PostIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/src/router.tsx",
    "content": "import React from 'react'\nimport { createRouter } from '@tanstack/react-router'\n\n// Import the generated route tree\nimport { QueryClient } from '@tanstack/react-query'\nimport { routeTree } from './routeTree.gen'\nimport type { RouteIds } from '@tanstack/react-router'\n\nexport const queryClient = new QueryClient()\n\n// Set up a Router instance\nexport const router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  defaultPendingComponent: () => (\n    <div>Loading form global pending component...</div>\n  ),\n  // This make the loader only wait 200ms before showing the pending component, instead of the default 1000ms\n  defaultPendingMs: 200,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n})\n\nexport type RouterType = typeof router\nexport type RouterIds = RouteIds<RouterType['routeTree']>\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/src/routes/$postId.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { postQueryOptions } from '@router-mono-react-query/post-query'\n\nexport const Route = createFileRoute('/$postId')({\n  loader: ({ context: { queryClient }, params: { postId } }) => {\n    return queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/src/routes/__root.tsx",
    "content": "import { Link, createRootRouteWithContext } from '@tanstack/react-router'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/src/routes/index.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { postsQueryOptions } from '@router-mono-react-query/post-query'\n\nexport const Route = createFileRoute('/')({\n  loader: ({ context: { queryClient } }) => {\n    return queryClient.ensureQueryData(postsQueryOptions)\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/packages/router/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport react from '@vitejs/plugin-react'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n    tanstackRouter(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'react',\n        'react-dom',\n        'react/jsx-runtime',\n        '@tanstack/react-query',\n        '@tanstack/react-router',\n        '@router-mono-react-query/post-query',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-react-query/pnpm-workspace.yaml.example",
    "content": "packages:\n  - 'packages/*'"
  },
  {
    "path": "examples/react/router-monorepo-simple/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n*.js\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\npnpm-workspace.yaml"
  },
  {
    "path": "examples/react/router-monorepo-simple/.stackblitzrc",
    "content": "{\n  \"startCommand\": \"cp pnpm-workspace.yaml.example pnpm-workspace.yaml && pnpm install && pnpm dev\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/README.md",
    "content": "# Example of a monorepo with router and feature libraries\n\nAn example demonstrating TanStack Router in a monorepo setup.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/router-monorepo-simple router-monorepo-simple\n```\n\n## Monorepo Setup\n\nA challenge with TanStack Router in a monorepo setup is that it requires TypeScript type augmentations. However, if you set this up directly in the final app, the links inside the libraries won't be type-safe. To solve this in a monorepo, you need a separate library just for the router, without any components, and then integrate it with the app.\n\nThis example showcases this approach using the following packages:\n\n- `packages/router` is the router library\n- `packages/post-feature` is the posts UI library\n- `packages/app` is the app\n\nWith this approach, we can use loaders in the router and the feature library without creating circular dependencies.\n\nSince the router library re-exports the router components, importing them in the feature library ensures they remain type-safe, as they’re linked to the TypeScript augmentations.\n\nFinally, in the app, we can create a map of routes to components ([`packages/app/src/main.tsx`](./packages/app/src/main.tsx)), which ties the router to the components. **We could enforce lazy loading here, but it was left out for simplicity.** With this setup, we now have a fully type-safe router!\n\n- **Router library**: Contains route definitions and type augmentations\n- **Feature libraries**: Contain components and business logic\n- **App**: Integrates the router and feature libraries\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Monorepo structure with TanStack Router\n- Shared packages\n- Workspace configuration\n- Code sharing across applications\n- Type-safe routing in a monorepo\n\nHere is what it looks like in the monorepo:\n\n![graph](./assets/graph.png)\n\n## Stackblitz limitation\n\n### Typescript IDE feedback\n\nDue to a limitation on Stackblitz, the example's types are not properly inferred in the IDE, however as soon as you click on fork in the bottom right corner, the types should be correctly inferred.\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/package.json",
    "content": "{\n  \"name\": \"router-mono-simple\",\n  \"private\": true,\n  \"scripts\": {\n    \"post-feature\": \"pnpm --filter @router-mono-simple/post-feature\",\n    \"router\": \"pnpm --filter @router-mono-simple/router\",\n    \"app\": \"pnpm --filter @router-mono-simple/app\",\n    \"dev\": \"pnpm router build && pnpm post-feature build && pnpm app dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.7.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/app/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/app/package.json",
    "content": "{\n  \"name\": \"@router-mono-simple/app\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3001\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@router-mono-simple/post-feature\": \"workspace:*\",\n    \"@router-mono-simple/router\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  },\n  \"nx\": {\n    \"targets\": {\n      \"dev\": {\n        \"dependsOn\": [\n          \"^build\"\n        ]\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/app/src/main.tsx",
    "content": "import React, { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider } from '@tanstack/react-router'\nimport { Outlet, router } from '@router-mono-simple/router'\nimport {\n  PostErrorComponent,\n  PostIdComponent,\n  PostsListComponent,\n} from '@router-mono-simple/post-feature'\nimport { RootComponent } from './rootComponent'\nimport type { RouterIds } from '@router-mono-simple/router'\nimport './style.css'\n// Not lazy loaded for simplicity, but you could expose from your library component\n// individually, and enforce here to use react lazy components via typings\n// so that you have code splitting\nconst routerMap = {\n  '/': PostsListComponent,\n  '/$postId': PostIdComponent,\n  __root__: RootComponent,\n} as const satisfies Record<RouterIds, (() => React.ReactElement) | null>\n\nfunction EmptyComponent() {\n  return <Outlet />\n}\n\nObject.entries(routerMap).forEach(([path, component]) => {\n  const foundRoute = router.routesById[path as RouterIds]\n  foundRoute.update({\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n    component: component ?? EmptyComponent,\n  })\n})\n\n// And you can do the same logic with custom error pages, and any other properties\nconst errorComponentMap = {\n  '/': null,\n  '/$postId': PostErrorComponent,\n  __root__: null,\n} as const satisfies Record<RouterIds, React.ComponentType<any> | null>\n\nObject.entries(errorComponentMap).forEach(([path, component]) => {\n  if (!component) {\n    return\n  }\n\n  const foundRoute = router.routesById[path as RouterIds]\n  foundRoute.update({\n    errorComponent: component,\n  })\n})\n\n// Render the app\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/app/src/rootComponent.tsx",
    "content": "import { Link, Outlet } from '@router-mono-simple/router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport function RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Posts list\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/app/src/style.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../../post-feature/src/**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/app/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/app/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n\n  server: {\n    port: 4200,\n    host: 'localhost',\n  },\n\n  preview: {\n    port: 4300,\n    host: 'localhost',\n  },\n  plugins: [\n    tailwindcss(),\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/post-feature/package.json",
    "content": "{\n  \"name\": \"@router-mono-simple/post-feature\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@router-mono-simple/router\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/post-feature/src/PostError.tsx",
    "content": "import { ErrorComponent, PostNotFoundError } from '@router-mono-simple/router'\nimport type { ErrorComponentProps } from '@router-mono-simple/router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof PostNotFoundError) {\n    return <div>Not found from api: {error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/post-feature/src/PostIdPage.tsx",
    "content": "import { getRouteApi } from '@router-mono-simple/router'\n\nconst route = getRouteApi('/$postId')\n\nexport function PostIdComponent() {\n  const post = route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/post-feature/src/PostList.tsx",
    "content": "import { Link, Outlet, getRouteApi } from '@router-mono-simple/router'\n\nconst route = getRouteApi('/')\n\nexport function PostsListComponent() {\n  const posts = route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/post-feature/src/index.ts",
    "content": "export * from './PostIdPage'\nexport * from './PostList'\nexport * from './PostError'\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/post-feature/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/post-feature/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport react from '@vitejs/plugin-react'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'react',\n        'react-dom',\n        'react/jsx-runtime',\n        '@tanstack/react-router',\n        '@router-mono-simple/post-query',\n        '@router-mono-simple/router',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/package.json",
    "content": "{\n  \"name\": \"@router-mono-simple/router\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/history\": \"^1.161.6\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/src/fetch/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/src/index.ts",
    "content": "import { router } from './router'\n\nexport type { RouterType, RouterIds } from './router'\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport { router }\n\nexport { PostNotFoundError } from './fetch/posts'\n\n// By re exporting the api from TanStack router, we can enforce that other packages\n// rely on this one instead, making the type register being applied\nexport {\n  Outlet,\n  Link,\n  useRouteContext,\n  useRouter,\n  RouterProvider,\n  getRouteApi,\n  ErrorComponent,\n} from '@tanstack/react-router'\nexport type { ErrorComponentProps } from '@tanstack/react-router'\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostIdRouteImport } from './routes/$postId'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst PostIdRoute = PostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/$postId'\n  id: '__root__' | '/' | '/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostIdRoute: typeof PostIdRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/$postId': {\n      id: '/$postId'\n      path: '/$postId'\n      fullPath: '/$postId'\n      preLoaderRoute: typeof PostIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostIdRoute: PostIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/src/router.tsx",
    "content": "import React from 'react'\nimport { createRouter } from '@tanstack/react-router'\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport type { RouteIds } from '@tanstack/react-router'\n\n// Set up a Router instance\nexport const router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div>Loading form global pending component...</div>\n  ),\n  scrollRestoration: true,\n})\n\nexport type RouterType = typeof router\nexport type RouterIds = RouteIds<RouterType['routeTree']>\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/src/routes/$postId.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../fetch/posts'\n\nexport const Route = createFileRoute('/$postId')({\n  loader: ({ params }) => fetchPost(params.postId),\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/src/routes/__root.tsx",
    "content": "import { Link, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/src/routes/index.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../fetch/posts'\n\nexport const Route = createFileRoute('/')({\n  loader: () => {\n    return fetchPosts()\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/packages/router/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport react from '@vitejs/plugin-react'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n    tanstackRouter(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'react',\n        'react-dom',\n        'react/jsx-runtime',\n        '@tanstack/react-router',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple/pnpm-workspace.yaml.example",
    "content": "packages:\n  - 'packages/*'"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n*.js\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\npnpm-workspace.yaml"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/.stackblitzrc",
    "content": "{\n  \"startCommand\": \"cp pnpm-workspace.yaml.example pnpm-workspace.yaml && pnpm install && pnpm dev\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/README.md",
    "content": "# Example of a monorepo with router and feature libraries, using lazy loading\n\nAn example demonstrating TanStack Router in a monorepo with lazy loading.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/router-monorepo-simple-lazy router-monorepo-simple-lazy\n```\n\n## Monorepo Setup\n\nA challenge with TanStack Router in a monorepo setup is that it requires TypeScript type augmentations. However, if you set this up directly in the final app, the links inside the libraries won't be type-safe. To solve this in a monorepo, you need a separate library just for the router, without any components, and then integrate it with the app.\n\nThis example showcases this approach using the following packages:\n\n- `packages/router` is the router library\n- `packages/post-feature` is the posts UI library\n- `packages/app` is the app\n\nWith this approach, we can use loaders in the router and the feature library without creating circular dependencies.\n\nSince the router library re-exports the router components, importing them in the feature library ensures they remain type-safe, as they’re linked to the TypeScript augmentations.\n\nFinally, in the app, we can create a map of routes to components ([`packages/app/src/main.tsx`](./packages/app/src/main.tsx)), which ties the router to the components.\n\n- **Router library**: Contains route definitions and type augmentations\n- **Feature libraries**: Contain components and business logic\n- **App**: Integrates the router and feature libraries\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Monorepo structure with TanStack Router\n- Lazy loading routes\n- Code splitting in monorepos\n- Shared packages\n- Optimized bundle sizes\n- Type-safe routing in a monorepo\n\n## How lazy loading works\n\nEach feature exports a `createLazyRoute` function that returns a lazy route. This lazy route is then used in the router map to bind the lazy route to the actual route. This allows the library to define their component, pending, error and not found components directly.\n\nThe types on the ([`packages/app/src/main.tsx`](./packages/app/src/main.tsx)) are used to map the route to the lazy route, and enforce they match the route path.\n\n**Note: if you match a lazy route with a different id of the route, you will get a runtime error, hence the mapped types to ensure we are also warned by typescript.**\n\nHere is what it looks like in the monorepo:\n\n![graph](./assets/graph.png)\n\n## Stackblitz limitation\n\n### Typescript IDE feedback\n\nDue to a limitation on Stackblitz, the example's types are not properly inferred in the IDE, however as soon as you click on fork in the bottom right corner, the types should be correctly inferred.\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/package.json",
    "content": "{\n  \"name\": \"router-mono-simple-lazy\",\n  \"private\": true,\n  \"scripts\": {\n    \"post-feature\": \"pnpm --filter @router-mono-simple-lazy/post-feature\",\n    \"router\": \"pnpm --filter @router-mono-simple-lazy/router\",\n    \"app\": \"pnpm --filter @router-mono-simple-lazy/app\",\n    \"dev\": \"pnpm router build && pnpm post-feature build && pnpm app dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.7.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/app/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/app/package.json",
    "content": "{\n  \"name\": \"@router-mono-simple-lazy/app\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3001\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@router-mono-simple-lazy/post-feature\": \"workspace:*\",\n    \"@router-mono-simple-lazy/router\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  },\n  \"nx\": {\n    \"targets\": {\n      \"dev\": {\n        \"dependsOn\": [\n          \"^build\"\n        ]\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/app/src/main.tsx",
    "content": "import React, { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider } from '@tanstack/react-router'\nimport { router } from '@router-mono-simple-lazy/router'\nimport { RootComponent } from './rootComponent'\nimport type { RouteById, RouterIds } from '@router-mono-simple-lazy/router'\nimport type { LazyRoute } from '@tanstack/react-router'\nimport './style.css'\n\n// Generic to enforce that the route returned matches the route path\ntype LazyRouteFn<TRoutePath extends RouterIds> = () => Promise<\n  LazyRoute<RouteById<(typeof router)['routeTree'], TRoutePath>>\n>\n\ntype RouterMap = {\n  // __root__ is a special route that isn't lazy loaded, so we need to manually bind it\n  // You could consider adding null to the returned type to have routes without rendering\n  [K in Exclude<RouterIds, '__root__'>]: LazyRouteFn<K>\n}\n\nconst routerMap: RouterMap = {\n  '/': () =>\n    import('@router-mono-simple-lazy/post-feature/post-list').then(\n      (d) => d.PostRoute,\n    ),\n  '/$postId': () =>\n    import('@router-mono-simple-lazy/post-feature/post-id-page').then(\n      (d) => d.PostIdRoute,\n    ),\n}\n\n// Given __root__ is a special route that isn't lazy loaded, we need to update it manually\nrouter.routesById['__root__'].update({\n  component: RootComponent,\n})\n\nObject.entries(routerMap).forEach(([path, component]) => {\n  const foundRoute = router.routesById[path as RouterIds]\n  // Bind the lazy route to the actual route\n  foundRoute.lazy(component)\n})\n\n// Render the app\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  console.log('Rendering')\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/app/src/rootComponent.tsx",
    "content": "import { Link, Outlet } from '@router-mono-simple-lazy/router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport function RootComponent() {\n  console.log('RootComponent')\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Posts list\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/app/src/style.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../../post-feature/src/**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/app/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/app/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n\n  server: {\n    port: 4200,\n    host: 'localhost',\n  },\n\n  preview: {\n    port: 4300,\n    host: 'localhost',\n  },\n  plugins: [\n    tailwindcss(),\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/post-feature/package.json",
    "content": "{\n  \"name\": \"@router-mono-simple-lazy/post-feature\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"exports\": {\n    \"./post-id-page\": {\n      \"types\": \"./dist/PostIdPage.d.ts\",\n      \"import\": \"./dist/PostIdPage.js\"\n    },\n    \"./post-list\": {\n      \"types\": \"./dist/PostList.d.ts\",\n      \"import\": \"./dist/PostList.js\"\n    }\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@router-mono-simple-lazy/router\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/post-feature/src/PostIdPage.tsx",
    "content": "import { createLazyRoute } from '@router-mono-simple-lazy/router'\n\nexport const PostIdRoute = createLazyRoute('/$postId')({\n  component: PostIdComponent,\n})\n\nexport function PostIdComponent() {\n  const post = PostIdRoute.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/post-feature/src/PostList.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@router-mono-simple-lazy/router'\n\nexport const PostRoute = createLazyRoute('/')({\n  component: PostsListComponent,\n})\n\nexport function PostsListComponent() {\n  const posts = PostRoute.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/post-feature/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/post-feature/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport react from '@vitejs/plugin-react'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/post-feature',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: ['src/PostIdPage.tsx', 'src/PostList.tsx'],\n      name: 'post-feature',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'react',\n        'react-dom',\n        'react/jsx-runtime',\n        '@tanstack/react-router',\n        '@router-mono-simple-lazy/post-query',\n        '@router-mono-simple-lazy/router',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/package.json",
    "content": "{\n  \"name\": \"@router-mono-simple-lazy/router\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/history\": \"^1.161.6\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/src/fetch/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/src/index.ts",
    "content": "import { router } from './router'\n\nexport type { RouterType, RouterIds } from './router'\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport { router }\n\nexport { PostNotFoundError } from './fetch/posts'\n\n// By re exporting the api from TanStack router, we can enforce that other packages\n// rely on this one instead, making the type register being applied\nexport {\n  Outlet,\n  Link,\n  useRouteContext,\n  useRouter,\n  RouterProvider,\n  getRouteApi,\n  ErrorComponent,\n  createLazyRoute,\n} from '@tanstack/react-router'\nexport type {\n  ErrorComponentProps,\n  RouteById,\n  RegisteredRouter,\n} from '@tanstack/react-router'\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostIdRouteImport } from './routes/$postId'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst PostIdRoute = PostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/$postId'\n  id: '__root__' | '/' | '/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostIdRoute: typeof PostIdRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/$postId': {\n      id: '/$postId'\n      path: '/$postId'\n      fullPath: '/$postId'\n      preLoaderRoute: typeof PostIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostIdRoute: PostIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/src/router.tsx",
    "content": "import React from 'react'\nimport { createRouter } from '@tanstack/react-router'\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport type { RouteIds } from '@tanstack/react-router'\n\n// Set up a Router instance\nexport const router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultPendingComponent: () => (\n    <div>Loading form global pending component...</div>\n  ),\n  scrollRestoration: true,\n})\n\nexport type RouterType = typeof router\nexport type RouterIds = RouteIds<RouterType['routeTree']>\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/src/routes/$postId.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../fetch/posts'\n\nexport const Route = createFileRoute('/$postId')({\n  loader: ({ params }) => fetchPost(params.postId),\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/src/routes/__root.tsx",
    "content": "import { Link, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/src/routes/index.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../fetch/posts'\n\nexport const Route = createFileRoute('/')({\n  loader: () => {\n    return fetchPosts()\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/packages/router/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport react from '@vitejs/plugin-react'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    react(),\n    tanstackRouter(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'react',\n        'react-dom',\n        'react/jsx-runtime',\n        '@tanstack/react-router',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/router-monorepo-simple-lazy/pnpm-workspace.yaml.example",
    "content": "packages:\n  - 'packages/*'"
  },
  {
    "path": "examples/react/scroll-restoration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/scroll-restoration/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/scroll-restoration/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/scroll-restoration/README.md",
    "content": "# TanStack Router - Scroll Restoration Example\n\nAn example demonstrating scroll position restoration.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/scroll-restoration scroll-restoration\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Scroll position restoration\n- Browser back/forward scroll behavior\n- Custom scroll restoration logic\n- User experience optimization\n"
  },
  {
    "path": "examples/react/scroll-restoration/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/scroll-restoration/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-scroll-restoration\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-virtual\": \"^3.13.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/scroll-restoration/src/main.tsx",
    "content": "import React, { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useElementScrollRestoration,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { useVirtualizer } from '@tanstack/react-virtual'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 sticky top-0 border-b bg-gray-100 dark:bg-gray-900\">\n        <Link to=\"/\" className=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" className=\"[&.active]:font-bold\">\n          About\n        </Link>\n        <Link to=\"/about\" resetScroll={false}>\n          About (No Reset)\n        </Link>\n        <Link to=\"/by-element\" className=\"[&.active]:font-bold\">\n          By-Element\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  loader: () => new Promise<void>((r) => setTimeout(r, 500)),\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <div className=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div\n            key={i}\n            className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n          >\n            Home Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  loader: () => new Promise<void>((r) => setTimeout(r, 500)),\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div>Hello from About!</div>\n      <div className=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div\n            key={i}\n            className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n          >\n            About Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst byElementRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/by-element',\n  loader: () => new Promise<void>((r) => setTimeout(r, 500)),\n  component: ByElementComponent,\n})\n\nfunction ByElementComponent() {\n  // We need a unique ID for manual scroll restoration on a specific element\n  // It should be as unique as possible for this element across your app\n  const scrollRestorationId = 'myVirtualizedContent'\n\n  // We use that ID to get the scroll entry for this element\n  const scrollEntry = useElementScrollRestoration({\n    id: scrollRestorationId,\n  })\n\n  // Let's use TanStack Virtual to virtualize some content!\n  const virtualizerParentRef = React.useRef<HTMLDivElement>(null)\n  const virtualizer = useVirtualizer({\n    count: 10000,\n    getScrollElement: () => virtualizerParentRef.current,\n    estimateSize: () => 100,\n    // We pass the scrollY from the scroll restoration entry to the virtualizer\n    // as the initial offset\n    initialOffset: scrollEntry?.scrollY,\n  })\n\n  return (\n    <div className=\"p-2 h-[calc(100vh-41px)] flex flex-col\">\n      <div>Hello from By-Element!</div>\n      <div className=\"h-full min-h-0 flex gap-4\">\n        <div className=\"border rounded-lg p-2 overflow-auto flex-1 space-y-2\">\n          {Array.from({ length: 50 }).map((_, i) => (\n            <div\n              key={i}\n              className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n            >\n              About Item {i + 1}\n            </div>\n          ))}\n        </div>\n        <div className=\"flex-1 overflow-auto flex flex-col gap-4\">\n          {Array.from({ length: 2 }).map((_, i) => (\n            <div key={i} className=\"flex-1 border rounded-lg p-2 overflow-auto\">\n              <div className=\"space-y-2\">\n                {Array.from({ length: 50 }).map((_, i) => (\n                  <div\n                    key={i}\n                    className=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\"\n                  >\n                    About Item {i + 1}\n                  </div>\n                ))}\n              </div>\n            </div>\n          ))}\n          <div className=\"flex-1 flex flex-col min-h-0\">\n            <div className=\"font-bold\">Virtualized</div>\n            <div\n              ref={virtualizerParentRef}\n              // We pass the scroll restoration ID to the element\n              // as a custom attribute that will get picked up by the\n              // scroll restoration watcher\n              data-scroll-restoration-id={scrollRestorationId}\n              className=\"flex-1 border rounded-lg overflow-auto relative\"\n            >\n              <div\n                style={{\n                  height: `${virtualizer.getTotalSize()}px`,\n                }}\n              >\n                {virtualizer.getVirtualItems().map((item) => (\n                  <div\n                    key={item.index}\n                    className=\"absolute p-2 pb-0 w-full\"\n                    style={{\n                      height: item.size,\n                      top: item.start,\n                    }}\n                  >\n                    <div className=\"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border h-full\">\n                      Virtualized Item {item.index + 1}\n                    </div>\n                  </div>\n                ))}\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  aboutRoute,\n  byElementRoute,\n])\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/scroll-restoration/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/scroll-restoration/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/scroll-restoration/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/search-validator-adapters/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/README.md",
    "content": "# TanStack Router - Search Validator Adapters Example\n\nAn example demonstrating search parameter validation with various adapters.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/search-validator-adapters search-validator-adapters\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Search parameter validation\n- Multiple validator adapters (Zod, Valibot, etc.)\n- Type-safe search params\n- Schema validation\n- URL state management\n"
  },
  {
    "path": "examples/react/search-validator-adapters/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/search-validator-adapters/package.json",
    "content": "{\n  \"name\": \"tanstack-search-validator-adapters\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:unit\": \"vitest\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/arktype-adapter\": \"^1.166.9\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/valibot-adapter\": \"^1.166.9\",\n    \"@tanstack/zod-adapter\": \"^1.166.9\",\n    \"arktype\": \"^2.1.7\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"valibot\": \"1.0.0-beta.15\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@testing-library/jest-dom\": \"^6.6.3\",\n    \"@testing-library/react\": \"^16.2.0\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/components/Content.tsx",
    "content": "export interface ContentProps {\n  readonly children: React.ReactNode\n}\n\nexport const Content: React.FunctionComponent<ContentProps> = ({\n  children,\n}) => {\n  return <section className=\"my-2 flex flex-col gap-2\">{children}</section>\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/components/Header.tsx",
    "content": "import { Link } from '@tanstack/react-router'\nimport * as React from 'react'\n\nconst HeaderLink: typeof Link = (props) => {\n  return <Link className=\"text-lg text-blue-700\" {...props} />\n}\n\nexport interface HeaderProps {\n  readonly title: string\n}\n\nexport const Header: React.FunctionComponent<HeaderProps> = ({ title }) => {\n  return (\n    <header className=\"flex items-end gap-8 border-b-2 border-slate-150 py-4\">\n      <h1 className=\"text-4xl\">{title}</h1>\n      <nav className=\"flex gap-4\">\n        <HeaderLink to=\"/users/zod\">Zod</HeaderLink>\n        <HeaderLink to=\"/users/valibot\">Valibot</HeaderLink>\n        <HeaderLink to=\"/users/arktype\">Arktype</HeaderLink>\n      </nav>\n    </header>\n  )\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/components/Search.tsx",
    "content": "export interface SearchProps {\n  search: string\n  onChange: (search: string) => void\n}\n\nexport const Search = ({ search, onChange }: SearchProps) => {\n  return (\n    <div className=\"flex gap-2 align-center items-center\">\n      <label>Search</label>\n      <input\n        type=\"search\"\n        className=\"border p-1 px-2 rounded-sm\"\n        value={search}\n        onChange={(e) => onChange(e.target.value)}\n      ></input>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/components/Users.tsx",
    "content": "import { queryOptions, useSuspenseQuery } from '@tanstack/react-query'\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport const getUsers = async (): Promise<Array<User>> => {\n  const response = await fetch('https://jsonplaceholder.typicode.com/users')\n  const users: Array<User> = await response.json()\n  return users\n}\n\nexport const searchUsers = async (search: string): Promise<Array<User>> => {\n  const users = await getUsers()\n  const normalizedSearch = search.toLowerCase()\n  return users.filter(\n    (user) =>\n      user.name.toLowerCase().includes(normalizedSearch) ||\n      user.username.toLowerCase().includes(normalizedSearch),\n  )\n}\n\nexport const usersQueryOptions = (search: string) =>\n  queryOptions({\n    queryKey: ['users', search],\n    queryFn: async () => {\n      return await searchUsers(search)\n    },\n  })\n\nexport interface UsersProps {\n  search: string\n}\n\nexport const Users = ({ search }: UsersProps) => {\n  const { data: users } = useSuspenseQuery(usersQueryOptions(search))\n\n  return (\n    <table className=\"table-auto\">\n      <thead>\n        <tr className=\"border text-left\">\n          <th className=\"p-4\">Username</th>\n          <th className=\"p-4\">Name</th>\n          <th className=\"p-4\">Email</th>\n        </tr>\n      </thead>\n      <tbody>\n        {users.map((user) => (\n          <tr key={user.id} className=\"border\">\n            <td className=\"p-4\">{user.username}</td>\n            <td className=\"p-4\">{user.name}</td>\n            <td className=\"p-4\">{user.email}</td>\n          </tr>\n        ))}\n      </tbody>\n    </table>\n  )\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/main.tsx",
    "content": "import * as React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nexport const queryClient = new QueryClient()\n\nexport const router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport function App() {\n  return <RouterProvider router={router} />\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <QueryClientProvider client={queryClient}>\n        <App />\n      </QueryClientProvider>\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersZodIndexRouteImport } from './routes/users/zod.index'\nimport { Route as UsersValibotIndexRouteImport } from './routes/users/valibot.index'\nimport { Route as UsersArktypeIndexRouteImport } from './routes/users/arktype.index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersZodIndexRoute = UsersZodIndexRouteImport.update({\n  id: '/users/zod/',\n  path: '/users/zod/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersValibotIndexRoute = UsersValibotIndexRouteImport.update({\n  id: '/users/valibot/',\n  path: '/users/valibot/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersArktypeIndexRoute = UsersArktypeIndexRouteImport.update({\n  id: '/users/arktype/',\n  path: '/users/arktype/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/users/arktype/': typeof UsersArktypeIndexRoute\n  '/users/valibot/': typeof UsersValibotIndexRoute\n  '/users/zod/': typeof UsersZodIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/users/arktype': typeof UsersArktypeIndexRoute\n  '/users/valibot': typeof UsersValibotIndexRoute\n  '/users/zod': typeof UsersZodIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/users/arktype/': typeof UsersArktypeIndexRoute\n  '/users/valibot/': typeof UsersValibotIndexRoute\n  '/users/zod/': typeof UsersZodIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/users/arktype/' | '/users/valibot/' | '/users/zod/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/users/arktype' | '/users/valibot' | '/users/zod'\n  id: '__root__' | '/' | '/users/arktype/' | '/users/valibot/' | '/users/zod/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  UsersArktypeIndexRoute: typeof UsersArktypeIndexRoute\n  UsersValibotIndexRoute: typeof UsersValibotIndexRoute\n  UsersZodIndexRoute: typeof UsersZodIndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/zod/': {\n      id: '/users/zod/'\n      path: '/users/zod'\n      fullPath: '/users/zod/'\n      preLoaderRoute: typeof UsersZodIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/valibot/': {\n      id: '/users/valibot/'\n      path: '/users/valibot'\n      fullPath: '/users/valibot/'\n      preLoaderRoute: typeof UsersValibotIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/arktype/': {\n      id: '/users/arktype/'\n      path: '/users/arktype'\n      fullPath: '/users/arktype/'\n      preLoaderRoute: typeof UsersArktypeIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\ndeclare module './routes/index' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/users/arktype.index' {\n  const createFileRoute: CreateFileRoute<\n    '/users/arktype/',\n    FileRoutesByPath['/users/arktype/']['parentRoute'],\n    FileRoutesByPath['/users/arktype/']['id'],\n    FileRoutesByPath['/users/arktype/']['path'],\n    FileRoutesByPath['/users/arktype/']['fullPath']\n  >\n}\ndeclare module './routes/users/valibot.index' {\n  const createFileRoute: CreateFileRoute<\n    '/users/valibot/',\n    FileRoutesByPath['/users/valibot/']['parentRoute'],\n    FileRoutesByPath['/users/valibot/']['id'],\n    FileRoutesByPath['/users/valibot/']['path'],\n    FileRoutesByPath['/users/valibot/']['fullPath']\n  >\n}\ndeclare module './routes/users/zod.index' {\n  const createFileRoute: CreateFileRoute<\n    '/users/zod/',\n    FileRoutesByPath['/users/zod/']['parentRoute'],\n    FileRoutesByPath['/users/zod/']['id'],\n    FileRoutesByPath['/users/zod/']['path'],\n    FileRoutesByPath['/users/zod/']['fullPath']\n  >\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  UsersArktypeIndexRoute: UsersArktypeIndexRoute,\n  UsersValibotIndexRoute: UsersValibotIndexRoute,\n  UsersZodIndexRoute: UsersZodIndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/routes/__root.tsx",
    "content": "import { type QueryClient } from '@tanstack/react-query'\nimport { Outlet, createRootRouteWithContext } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport interface Context {\n  queryClient: QueryClient\n}\n\nexport const Route = createRootRouteWithContext<Context>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <div className=\"m-4\">\n      <Outlet />\n      <TanStackRouterDevtools />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/routes/index.tsx",
    "content": "import * as React from 'react'\n\nimport { Header } from '../components/Header'\nimport { Content } from '../components/Content'\n\nexport const Index: React.FunctionComponent = () => {\n  return (\n    <>\n      <Header title=\"Home\" />\n      <Content>Welcome home</Content>\n    </>\n  )\n}\n\nexport const Route = createFileRoute({\n  component: Index,\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/routes/users/arktype.index.tsx",
    "content": "import * as React from 'react'\nimport { useNavigate } from '@tanstack/react-router'\nimport { type } from 'arktype'\nimport { Header } from '../../components/Header'\nimport { Users, usersQueryOptions } from '../../components/Users'\nimport { Content } from '../../components/Content'\nimport { Search } from '../../components/Search'\n\nconst ArkType = () => {\n  const search = Route.useSearch({\n    select: (search) => search.search,\n  })\n  const navigate = useNavigate({ from: Route.fullPath })\n\n  return (\n    <>\n      <Header title=\"ArkType\" />\n      <Content>\n        <Search\n          search={search}\n          onChange={(search) => navigate({ search: { search }, replace: true })}\n        />\n        <React.Suspense>\n          <Users search={search} />\n        </React.Suspense>\n      </Content>\n    </>\n  )\n}\n\nconst search = type({\n  search: 'string = \"\"',\n})\n\nexport const Route = createFileRoute({\n  validateSearch: search,\n  loaderDeps: (opt) => ({ search: opt.search }),\n  loader: (opt) => {\n    opt.context.queryClient.ensureQueryData(\n      usersQueryOptions(opt.deps.search.search),\n    )\n  },\n  component: ArkType,\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/routes/users/valibot.index.tsx",
    "content": "import * as React from 'react'\nimport { useNavigate } from '@tanstack/react-router'\nimport * as v from 'valibot'\nimport { Header } from '../../components/Header'\nimport { Users, usersQueryOptions } from '../../components/Users'\nimport { Content } from '../../components/Content'\nimport { Search } from '../../components/Search'\n\nconst Valibot = () => {\n  const search = Route.useSearch()\n  const navigate = useNavigate({ from: Route.fullPath })\n\n  return (\n    <>\n      <Header title=\"Valibot\" />\n      <Content>\n        <Search\n          search={search.search}\n          onChange={(search) => navigate({ search: { search }, replace: true })}\n        />\n        <React.Suspense>\n          <Users search={search.search} />\n        </React.Suspense>\n      </Content>\n    </>\n  )\n}\n\nexport const Route = createFileRoute({\n  validateSearch: v.object({\n    search: v.fallback(v.optional(v.string(), ''), ''),\n  }),\n  loaderDeps: (opt) => ({ search: opt.search }),\n  loader: (opt) => {\n    opt.context.queryClient.ensureQueryData(\n      usersQueryOptions(opt.deps.search.search),\n    )\n  },\n  component: Valibot,\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/routes/users/zod.index.tsx",
    "content": "import * as React from 'react'\nimport { useNavigate } from '@tanstack/react-router'\nimport { fallback, zodValidator } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\nimport { Header } from '../../components/Header'\nimport { Users, usersQueryOptions } from '../../components/Users'\nimport { Content } from '../../components/Content'\nimport { Search } from '../../components/Search'\n\nconst Zod = () => {\n  const search = Route.useSearch({\n    select: (search) => search.search ?? '',\n  })\n  const navigate = useNavigate({ from: Route.fullPath })\n\n  return (\n    <>\n      <Header title=\"Zod\" />\n      <Content>\n        <Search\n          search={search}\n          onChange={(search) => navigate({ search: { search }, replace: true })}\n        />\n        <React.Suspense>\n          <Users search={search} />\n        </React.Suspense>\n      </Content>\n    </>\n  )\n}\n\nexport const Route = createFileRoute({\n  validateSearch: zodValidator(\n    z.object({\n      search: fallback(z.string().optional(), undefined),\n    }),\n  ),\n  loaderDeps: (opt) => ({ search: opt.search }),\n  loader: (opt) => {\n    opt.context.queryClient.ensureQueryData(\n      usersQueryOptions(opt.deps.search.search ?? ''),\n    )\n  },\n  component: Zod,\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/tests/arktype.test-d.tsx",
    "content": "import { Link } from '@tanstack/react-router'\nimport { expectTypeOf, test } from 'vitest'\nimport { Route as ArkTypeRoute } from '../src/routes/users/arktype.index'\nimport type { router } from '../src/main'\n\ntest('infers correct input and output type for valibot', () => {\n  expectTypeOf(Link<typeof router, string, '/users/arktype'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<boolean | ((...args: ReadonlyArray<any>) => any)>()\n    .toEqualTypeOf<{ search?: string } | undefined>()\n\n  expectTypeOf(ArkTypeRoute.useSearch()).toEqualTypeOf<{\n    search: string\n  }>()\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/tests/arktype.test.tsx",
    "content": "import { fireEvent, render, screen } from '@testing-library/react'\nimport { expect, test } from 'vitest'\nimport {\n  Link,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\n\nimport '@testing-library/jest-dom/vitest'\nimport { type } from 'arktype'\n\ntest('can navigate to the route', async () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <Link to=\"/users/arktype\">Arktype</Link>,\n  })\n\n  const ArkType = () => {\n    const { search } = arkTypeRoute.useSearch()\n\n    return (\n      <div>\n        <div>{search}</div>\n        <Link from=\"/users/arktype/\" search={{ search: 'updated' }}>\n          Update\n        </Link>\n      </div>\n    )\n  }\n\n  const search = type({\n    search: 'string = \"default\"',\n  })\n\n  const arkTypeRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/users/arkType',\n    validateSearch: search,\n    component: ArkType,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, arkTypeRoute])\n\n  const router = createRouter({ routeTree, scrollRestoration: true })\n\n  render(<RouterProvider router={router as any} />)\n\n  const link = await screen.findByText('Arktype')\n\n  fireEvent.click(link)\n\n  expect(await screen.findByText('default')).toBeInTheDocument()\n\n  const updateLink = await screen.findByText('Update')\n\n  fireEvent.click(updateLink)\n\n  expect(await screen.findByText('updated')).toBeInTheDocument()\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/tests/valibot.test-d.tsx",
    "content": "import { Link } from '@tanstack/react-router'\nimport { expectTypeOf, test } from 'vitest'\nimport { Route as ValibotRoute } from '../src/routes/users/valibot.index'\nimport type { router } from '../src/main'\n\ntest('infers correct input and output type for valibot', () => {\n  expectTypeOf(Link<typeof router, string, '/users/valibot'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<boolean | ((...args: ReadonlyArray<any>) => any)>()\n    .toEqualTypeOf<{ search?: string } | undefined>()\n\n  expectTypeOf(ValibotRoute.useSearch()).toEqualTypeOf<{ search: string }>()\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/tests/valibot.test.tsx",
    "content": "import { fireEvent, render, screen } from '@testing-library/react'\nimport { expect, test } from 'vitest'\nimport {\n  Link,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport * as v from 'valibot'\nimport '@testing-library/jest-dom/vitest'\n\ntest('can navigate to the route', async () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <Link to=\"/users/valibot\">Valibot</Link>,\n  })\n\n  const Valibot = () => {\n    const { search } = valibotRoute.useSearch()\n\n    return (\n      <div>\n        <div>{search}</div>\n        <Link from=\"/users/valibot/\" search={{ search: 'updated' }}>\n          Update\n        </Link>\n      </div>\n    )\n  }\n\n  const valibotRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/users/valibot',\n    validateSearch: v.object({\n      search: v.optional(v.string(), 'default'),\n    }),\n    component: Valibot,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, valibotRoute])\n\n  const router = createRouter({ routeTree, scrollRestoration: true })\n\n  render(<RouterProvider router={router as any} />)\n\n  const link = await screen.findByText('Valibot')\n\n  fireEvent.click(link)\n\n  expect(await screen.findByText('default')).toBeInTheDocument()\n\n  const updateLink = await screen.findByText('Update')\n\n  fireEvent.click(updateLink)\n\n  expect(await screen.findByText('updated')).toBeInTheDocument()\n})\n"
  },
  {
    "path": "examples/react/search-validator-adapters/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"]\n  }\n}\n"
  },
  {
    "path": "examples/react/search-validator-adapters/vite.config.ts",
    "content": "import { defineConfig } from 'vitest/config'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport packageJson from './package.json'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/start-bare/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-bare/README.md",
    "content": "# TanStack Start - Bare Example\n\nA minimal TanStack Start example demonstrating the bare essentials.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-bare start-bare\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n"
  },
  {
    "path": "examples/react/start-bare/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-bare\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-bare/src/components/Counter.css",
    "content": ".increment {\n  font-family: inherit;\n  font-size: inherit;\n  padding: 1em 2em;\n  color: #335d92;\n  background-color: rgba(68, 107, 158, 0.1);\n  border-radius: 2em;\n  border: 2px solid rgba(68, 107, 158, 0);\n  outline: none;\n  width: 200px;\n  font-variant-numeric: tabular-nums;\n  cursor: pointer;\n}\n\n.increment:focus {\n  border: 2px solid #335d92;\n}\n\n.increment:active {\n  background-color: rgba(68, 107, 158, 0.2);\n}\n"
  },
  {
    "path": "examples/react/start-bare/src/components/Counter.tsx",
    "content": "import { useState } from 'react'\nimport './Counter.css'\n\nexport default function Counter() {\n  const [count, setCount] = useState(0)\n  return (\n    <button\n      className=\"increment\"\n      onClick={() => setCount(count + 1)}\n      type=\"button\"\n    >\n      Clicks: {count}\n    </button>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bare/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-bare/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: (err) => <p>{err.error.stack}</p>,\n    defaultNotFoundComponent: () => <p>not found</p>,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-bare/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div>\n          <Link to=\"/\">Index</Link>\n          <Link to=\"/about\">About</Link>\n        </div>\n\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bare/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport Counter from '~/components/Counter'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <main>\n      <h1>About</h1>\n      <Counter />\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bare/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <main>\n      <h1>Hello world!</h1>\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bare/src/styles/app.css",
    "content": "body {\n  font-family:\n    Gordita, Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',\n    sans-serif;\n}\n\na {\n  margin-right: 1rem;\n}\n\nmain {\n  text-align: center;\n  padding: 1em;\n  margin: 0 auto;\n}\n"
  },
  {
    "path": "examples/react/start-bare/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-bare/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-basic/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n.nitro\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n.tanstack"
  },
  {
    "path": "examples/react/start-basic/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-basic/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic/README.md",
    "content": "# TanStack Start - Basic Example\n\nThis is the basic TanStack Start example, demonstrating the fundamentals of building applications with TanStack Router and TanStack Start.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-basic start-basic\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n"
  },
  {
    "path": "examples/react/start-basic/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-basic\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node .output/server/index.mjs\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"nitro\": \"^3.0.260311-beta\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/components/PostError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/components/UserError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as CustomScriptDotjsRouteImport } from './routes/customScript[.]js'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CustomScriptDotjsRoute = CustomScriptDotjsRouteImport.update({\n  id: '/customScript.js',\n  path: '/customScript.js',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/_pathlessLayout/_nested-layout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/api/users/$userId'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  CustomScriptDotjsRoute: typeof CustomScriptDotjsRoute\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/customScript.js': {\n      id: '/customScript.js'\n      path: '/customScript.js'\n      fullPath: '/customScript.js'\n      preLoaderRoute: typeof CustomScriptDotjsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  CustomScriptDotjsRoute: CustomScriptDotjsRoute,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n  return router\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n    scripts: [\n      {\n        src: '/customScript.js',\n        type: 'text/javascript',\n      },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(\n            'https://jsonplaceholder.typicode.com/users/' + params.userId,\n          )\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n\n          const user = (await res.json()) as User\n\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getRequestHeaders } from '@tanstack/react-start/server'\nimport { createMiddleware } from '@tanstack/react-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: /users')\n  console.info('Request Headers:', getRequestHeaders())\n  const result = await next()\n  result.response.headers.set('x-users', 'true')\n  console.info('Out: /users')\n  return result\n})\n\nconst testParentMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: testParentMiddleware')\n  const result = await next()\n  result.response.headers.set('x-test-parent', 'true')\n  console.info('Out: testParentMiddleware')\n  return result\n})\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('GET /api/users @', request.url)\n        console.info('Fetching users... @', request.url)\n        const res = await fetch('https://jsonplaceholder.typicode.com/users')\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n\n        const data = (await res.json()) as Array<User>\n\n        const list = data.slice(0, 10)\n\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/customScript[.]js.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/customScript.js')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response('console.log(\"Hello from customScript.js!\")', {\n          headers: {\n            'Content-Type': 'application/javascript',\n          },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Suspense, useState } from 'react'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(({ data: name }) => {\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: name }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: 'Tanner Linsley' }),\n      person: await personServerFn({ data: 'John Doe' }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = useState(0)\n  const { deferredStuff, deferredPerson, person } = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {person.name} - {person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count}</div>\n      <div>\n        <button onClick={() => setCount(count + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: String(post.id),\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: String(post.id),\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../utils/posts'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) =>\n    fetchPost({\n      data: postId,\n    }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/redirect.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { NotFound } from 'src/components/NotFound'\nimport { UserErrorComponent } from 'src/components/UserError'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    try {\n      const res = await fetch('/api/users/' + userId)\n      if (!res.ok) {\n        throw new Error('Unexpected status code')\n      }\n\n      const data = await res.json()\n\n      return data as User\n    } catch {\n      throw new Error('Failed to fetch user')\n    }\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{user.name}</h4>\n      <div className=\"text-sm\">{user.email}</div>\n      <div>\n        <a\n          href={`/api/users/${user.id}`}\n          className=\"text-blue-800 hover:text-blue-600 underline\"\n        >\n          View as JSON\n        </a>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div>\n      Select a user or{' '}\n      <a\n        href=\"/api/users\"\n        className=\"text-blue-800 hover:text-blue-600 underline\"\n      >\n        view as JSON\n      </a>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const res = await fetch('/api/users')\n\n    if (!res.ok) {\n      throw new Error('Unexpected status code')\n    }\n\n    const data = await res.json()\n\n    return data as Array<User>\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...users,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li key={user.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/utils/loggingMiddleware.tsx",
    "content": "import { createMiddleware } from '@tanstack/react-start'\n\nconst preLogMiddleware = createMiddleware({ type: 'function' })\n  .client(async (ctx) => {\n    const clientTime = new Date()\n\n    return ctx.next({\n      context: {\n        clientTime,\n      },\n      sendContext: {\n        clientTime,\n      },\n    })\n  })\n  .server(async (ctx) => {\n    const serverTime = new Date()\n\n    return ctx.next({\n      sendContext: {\n        serverTime,\n        durationToServer:\n          serverTime.getTime() - ctx.context.clientTime.getTime(),\n      },\n    })\n  })\n\nexport const logMiddleware = createMiddleware({ type: 'function' })\n  .middleware([preLogMiddleware])\n  .client(async (ctx) => {\n    const res = await ctx.next()\n\n    const now = new Date()\n    console.log('Client Req/Res:', {\n      duration: now.getTime() - res.context.clientTime.getTime(),\n      durationToServer: res.context.durationToServer,\n      durationFromServer: now.getTime() - res.context.serverTime.getTime(),\n    })\n\n    return res\n  })\n"
  },
  {
    "path": "examples/react/start-basic/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nexport type PostType = {\n  id: number\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'POST' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const res = await fetch(\n      `https://jsonplaceholder.typicode.com/posts/${data}`,\n    )\n    if (!res.ok) {\n      if (res.status === 404) {\n        throw notFound()\n      }\n\n      throw new Error('Failed to fetch post')\n    }\n\n    const post = await res.json()\n\n    return post as PostType\n  })\n\nexport const fetchPosts = createServerFn().handler(async () => {\n  console.info('Fetching posts...')\n  const res = await fetch('https://jsonplaceholder.typicode.com/posts')\n  if (!res.ok) {\n    throw new Error('Failed to fetch posts')\n  }\n\n  const posts = await res.json()\n\n  return (posts as Array<PostType>).slice(0, 10)\n})\n"
  },
  {
    "path": "examples/react/start-basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-basic/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n"
  },
  {
    "path": "examples/react/start-basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\nimport { nitro } from 'nitro/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      srcDirectory: 'src',\n    }),\n    viteReact(),\n    nitro(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/start-basic-auth/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/.env",
    "content": "# Environment variables declared in this file are automatically made available to Prisma.\n# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema\n\n# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.\n# See the documentation for all the connection string options: https://pris.ly/d/connection-strings\n\nDATABASE_URL=\"file:./dev.db\""
  },
  {
    "path": "examples/react/start-basic-auth/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n!.env\n.DS_Store\n.cache\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/start-basic-auth/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-basic-auth/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/README.md",
    "content": "# TanStack Start - Basic Auth Example\n\nA TanStack Start example demonstrating authentication patterns and protected routes.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-basic-auth start-basic-auth\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## Authentication Features\n\nThis example demonstrates:\n\n- User authentication flow\n- Protected routes\n- Login/logout functionality\n- Redirect after authentication\n"
  },
  {
    "path": "examples/react/start-basic-auth/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-basic-auth\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"prisma-generate\": \"prisma generate\"\n  },\n  \"dependencies\": {\n    \"@libsql/client\": \"^0.15.15\",\n    \"@prisma/adapter-libsql\": \"^7.0.0\",\n    \"@prisma/client\": \"^7.0.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"dotenv\": \"^17.2.3\",\n    \"prisma\": \"^7.0.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/prisma/migrations/20240811183753_init/migration.sql",
    "content": "-- CreateTable\nCREATE TABLE \"User\" (\n    \"email\" TEXT NOT NULL PRIMARY KEY,\n    \"password\" TEXT NOT NULL\n);\n\n-- CreateIndex\nCREATE UNIQUE INDEX \"User_email_key\" ON \"User\"(\"email\");\n"
  },
  {
    "path": "examples/react/start-basic-auth/prisma/migrations/migration_lock.toml",
    "content": "# Please do not edit this file manually\n# It should be added in your version-control system (i.e. Git)\nprovider = \"sqlite\""
  },
  {
    "path": "examples/react/start-basic-auth/prisma/schema.prisma",
    "content": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n  provider = \"prisma-client\"\n  output   = \"../src/prisma-generated\"\n}\n\ndatasource db {\n  provider = \"sqlite\"\n}\n\nmodel User {\n  email String @id @unique\n  password String\n}"
  },
  {
    "path": "examples/react/start-basic-auth/prisma.config.ts",
    "content": "import 'dotenv/config'\nimport { defineConfig, env } from 'prisma/config'\n\nexport default defineConfig({\n  schema: './prisma/schema.prisma',\n  migrations: {\n    path: './prisma/migrations',\n  },\n  datasource: {\n    url: env('DATABASE_URL'),\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-auth/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/components/Auth.tsx",
    "content": "export function Auth({\n  actionText,\n  onSubmit,\n  status,\n  afterSubmit,\n}: {\n  actionText: string\n  onSubmit: (e: React.FormEvent<HTMLFormElement>) => void\n  status: 'pending' | 'idle' | 'success' | 'error'\n  afterSubmit?: React.ReactNode\n}) {\n  return (\n    <div className=\"fixed inset-0 bg-white dark:bg-black flex items-start justify-center p-8\">\n      <div className=\"bg-white dark:bg-gray-900 p-8 rounded-lg shadow-lg\">\n        <h1 className=\"text-2xl font-bold mb-4\">{actionText}</h1>\n        <form\n          onSubmit={(e) => {\n            e.preventDefault()\n            onSubmit(e)\n          }}\n          className=\"space-y-4\"\n        >\n          <div>\n            <label htmlFor=\"email\" className=\"block text-xs\">\n              Email\n            </label>\n            <input\n              type=\"email\"\n              name=\"email\"\n              id=\"email\"\n              className=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <div>\n            <label htmlFor=\"password\" className=\"block text-xs\">\n              Password\n            </label>\n            <input\n              type=\"password\"\n              name=\"password\"\n              id=\"password\"\n              className=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <button\n            type=\"submit\"\n            className=\"w-full bg-cyan-600 text-white rounded-sm py-2 font-black uppercase\"\n            disabled={status === 'pending'}\n          >\n            {status === 'pending' ? '...' : actionText}\n          </button>\n          {afterSubmit ? afterSubmit : null}\n        </form>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/components/Login.tsx",
    "content": "import { useRouter } from '@tanstack/react-router'\nimport { useServerFn } from '@tanstack/react-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { loginFn } from '../routes/_authed'\nimport { Auth } from './Auth'\nimport { signupFn } from '~/routes/signup'\n\nexport function Login() {\n  const router = useRouter()\n\n  const loginMutation = useMutation({\n    fn: loginFn,\n    onSuccess: async (ctx) => {\n      if (!ctx.data?.error) {\n        await router.invalidate()\n        router.navigate({ to: '/' })\n        return\n      }\n    },\n  })\n\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Login\"\n      status={loginMutation.status}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as HTMLFormElement)\n\n        loginMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        loginMutation.data ? (\n          <>\n            <div className=\"text-red-400\">{loginMutation.data.message}</div>\n            {loginMutation.data.userNotFound ? (\n              <div>\n                <button\n                  className=\"text-blue-500\"\n                  onClick={(e) => {\n                    const formData = new FormData(\n                      (e.target as HTMLButtonElement).form!,\n                    )\n\n                    signupMutation.mutate({\n                      data: {\n                        email: formData.get('email') as string,\n                        password: formData.get('password') as string,\n                      },\n                    })\n                  }}\n                  type=\"button\"\n                >\n                  Sign up instead?\n                </button>\n              </div>\n            ) : null}\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/hooks/useMutation.ts",
    "content": "import * as React from 'react'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = React.useState<number | undefined>()\n  const [variables, setVariables] = React.useState<TVariables | undefined>()\n  const [error, setError] = React.useState<TError | undefined>()\n  const [data, setData] = React.useState<TData | undefined>()\n  const [status, setStatus] = React.useState<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = React.useCallback(\n    async (variables: TVariables): Promise<TData | undefined> => {\n      setStatus('pending')\n      setSubmittedAt(Date.now())\n      setVariables(variables)\n      //\n      try {\n        const data = await opts.fn(variables)\n        await opts.onSuccess?.({ data })\n        setStatus('success')\n        setError(undefined)\n        setData(data)\n        return data\n      } catch (err: any) {\n        setStatus('error')\n        setError(err)\n      }\n    },\n    [opts.fn],\n  )\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/browser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma-related types and utilities in a browser.\n * Use it to get access to models, enums, and input types.\n *\n * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.\n * See `client.ts` for the standard, server-side entry point.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as Prisma from './internal/prismaNamespaceBrowser'\nexport { Prisma }\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/client.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.\n * If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as process from 'node:process'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nglobalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport * as $Class from './internal/class'\nimport * as Prisma from './internal/prismaNamespace'\n\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\nexport const PrismaClient = $Class.getPrismaClientClass()\nexport type PrismaClient<\n  LogOpts extends Prisma.LogLevel = never,\n  OmitOpts extends Prisma.PrismaClientOptions['omit'] =\n    Prisma.PrismaClientOptions['omit'],\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>\nexport { Prisma }\n\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/commonInputTypes.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports various common sort, input & filter types that are not directly linked to a particular model.\n *\n * 🟢 You can import this file directly.\n */\n\nimport type * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport type * as Prisma from './internal/prismaNamespace'\n\nexport type StringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type StringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedStringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type NestedStringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedIntFilter<$PrismaModel = never> = {\n  equals?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  in?: number[]\n  notIn?: number[]\n  lt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  lte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedIntFilter<$PrismaModel> | number\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/enums.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports all enum related types from the schema.\n *\n * 🟢 You can import this file directly.\n */\n\n// This file is empty because there are no enums in the schema.\nexport {}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/internal/class.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * Please import the `PrismaClient` class from the `client.ts` file instead.\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from './prismaNamespace'\n\nconst config: runtime.GetPrismaClientConfig = {\n  previewFeatures: [],\n  clientVersion: '7.0.0',\n  engineVersion: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n  activeProvider: 'sqlite',\n  inlineSchema:\n    '// This is your Prisma schema file,\\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\\n\\ngenerator client {\\n  provider = \"prisma-client\"\\n  output   = \"../src/prisma-generated\"\\n}\\n\\ndatasource db {\\n  provider = \"sqlite\"\\n}\\n\\nmodel User {\\n  email    String @id @unique\\n  password String\\n}\\n',\n  runtimeDataModel: {\n    models: {},\n    enums: {},\n    types: {},\n  },\n}\n\nconfig.runtimeDataModel = JSON.parse(\n  '{\"models\":{\"User\":{\"fields\":[{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}',\n)\n\nasync function decodeBase64AsWasm(\n  wasmBase64: string,\n): Promise<WebAssembly.Module> {\n  const { Buffer } = await import('node:buffer')\n  const wasmArray = Buffer.from(wasmBase64, 'base64')\n  return new WebAssembly.Module(wasmArray)\n}\n\nconfig.compilerWasm = {\n  getRuntime: async () =>\n    await import('@prisma/client/runtime/query_compiler_bg.sqlite.mjs'),\n\n  getQueryCompilerWasmModule: async () => {\n    const { wasm } =\n      await import('@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs')\n    return await decodeBase64AsWasm(wasm)\n  },\n}\n\nexport type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =\n  'log' extends keyof ClientOptions\n    ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition>\n      ? Prisma.GetEvents<ClientOptions['log']>\n      : never\n    : never\n\nexport interface PrismaClientConstructor {\n  /**\n   * ## Prisma Client\n   *\n   * Type-safe database client for TypeScript\n   * @example\n   * ```\n   * const prisma = new PrismaClient()\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n   */\n\n  new <\n    Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,\n    LogOpts extends LogOptions<Options> = LogOptions<Options>,\n    OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {\n      omit: infer U\n    }\n      ? U\n      : Prisma.PrismaClientOptions['omit'],\n    ExtArgs extends runtime.Types.Extensions.InternalArgs =\n      runtime.Types.Extensions.DefaultArgs,\n  >(\n    options: Prisma.Subset<Options, Prisma.PrismaClientOptions>,\n  ): PrismaClient<LogOpts, OmitOpts, ExtArgs>\n}\n\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\n\nexport interface PrismaClient<\n  in LogOpts extends Prisma.LogLevel = never,\n  in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,\n  in out ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> {\n  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }\n\n  $on<V extends LogOpts>(\n    eventType: V,\n    callback: (\n      event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent,\n    ) => void,\n  ): PrismaClient\n\n  /**\n   * Connect with the database\n   */\n  $connect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Disconnect from the database\n   */\n  $disconnect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Executes a prepared raw query and returns the number of affected rows.\n   * @example\n   * ```\n   * const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Executes a raw query and returns the number of affected rows.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Performs a prepared raw query and returns the `SELECT` data.\n   * @example\n   * ```\n   * const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Performs a raw query and returns the `SELECT` data.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.\n   * @example\n   * ```\n   * const [george, bob, alice] = await prisma.$transaction([\n   *   prisma.user.create({ data: { name: 'George' } }),\n   *   prisma.user.create({ data: { name: 'Bob' } }),\n   *   prisma.user.create({ data: { name: 'Alice' } }),\n   * ])\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).\n   */\n  $transaction<P extends Prisma.PrismaPromise<any>[]>(\n    arg: [...P],\n    options?: { isolationLevel?: Prisma.TransactionIsolationLevel },\n  ): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>\n\n  $transaction<R>(\n    fn: (\n      prisma: Omit<PrismaClient, runtime.ITXClientDenyList>,\n    ) => runtime.Types.Utils.JsPromise<R>,\n    options?: {\n      maxWait?: number\n      timeout?: number\n      isolationLevel?: Prisma.TransactionIsolationLevel\n    },\n  ): runtime.Types.Utils.JsPromise<R>\n\n  $extends: runtime.Types.Extensions.ExtendsHook<\n    'extends',\n    Prisma.TypeMapCb<OmitOpts>,\n    ExtArgs,\n    runtime.Types.Utils.Call<\n      Prisma.TypeMapCb<OmitOpts>,\n      {\n        extArgs: ExtArgs\n      }\n    >\n  >\n\n  /**\n   * `prisma.user`: Exposes CRUD operations for the **User** model.\n   * Example usage:\n   * ```ts\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   */\n  get user(): Prisma.UserDelegate<ExtArgs, { omit: OmitOpts }>\n}\n\nexport function getPrismaClientClass(): PrismaClientConstructor {\n  return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/internal/prismaNamespace.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the client.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from '../models'\nimport { type PrismaClient } from './class'\n\nexport type * from '../models'\n\nexport type DMMF = typeof runtime.DMMF\n\nexport type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>\n\n/**\n * Prisma Errors\n */\n\nexport const PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\nexport type PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\n\nexport const PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\nexport type PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\n\nexport const PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\nexport type PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\n\nexport const PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\nexport type PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\n\nexport const PrismaClientValidationError = runtime.PrismaClientValidationError\nexport type PrismaClientValidationError = runtime.PrismaClientValidationError\n\n/**\n * Re-export of sql-template-tag\n */\nexport const sql = runtime.sqltag\nexport const empty = runtime.empty\nexport const join = runtime.join\nexport const raw = runtime.raw\nexport const Sql = runtime.Sql\nexport type Sql = runtime.Sql\n\n/**\n * Decimal.js\n */\nexport const Decimal = runtime.Decimal\nexport type Decimal = runtime.Decimal\n\nexport type DecimalJsLike = runtime.DecimalJsLike\n\n/**\n * Extensions\n */\nexport type Extension = runtime.Types.Extensions.UserArgs\nexport const getExtensionContext = runtime.Extensions.getExtensionContext\nexport type Args<T, F extends runtime.Operation> = runtime.Types.Public.Args<\n  T,\n  F\n>\nexport type Payload<\n  T,\n  F extends runtime.Operation = never,\n> = runtime.Types.Public.Payload<T, F>\nexport type Result<\n  T,\n  A,\n  F extends runtime.Operation,\n> = runtime.Types.Public.Result<T, A, F>\nexport type Exact<A, W> = runtime.Types.Public.Exact<A, W>\n\nexport type PrismaVersion = {\n  client: string\n  engine: string\n}\n\n/**\n * Prisma Client JS version: 7.0.0\n * Query Engine version: 0c19ccc313cf9911a90d99d2ac2eb0280c76c513\n */\nexport const prismaVersion: PrismaVersion = {\n  client: '7.0.0',\n  engine: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n}\n\n/**\n * Utility Types\n */\n\nexport type Bytes = runtime.Bytes\nexport type JsonObject = runtime.JsonObject\nexport type JsonArray = runtime.JsonArray\nexport type JsonValue = runtime.JsonValue\nexport type InputJsonObject = runtime.InputJsonObject\nexport type InputJsonArray = runtime.InputJsonArray\nexport type InputJsonValue = runtime.InputJsonValue\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\ntype SelectAndInclude = {\n  select: any\n  include: any\n}\n\ntype SelectAndOmit = {\n  select: any\n  omit: any\n}\n\n/**\n * From T, pick a set of properties whose keys are in the union K\n */\ntype Prisma__Pick<T, K extends keyof T> = {\n  [P in K]: T[P]\n}\n\nexport type Enumerable<T> = T | Array<T>\n\n/**\n * Subset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection\n */\nexport type Subset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n}\n\n/**\n * SelectSubset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection.\n * Additionally, it validates, if both select and include are present. If the case, it errors.\n */\nexport type SelectSubset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & (T extends SelectAndInclude\n  ? 'Please either choose `select` or `include`.'\n  : T extends SelectAndOmit\n    ? 'Please either choose `select` or `omit`.'\n    : {})\n\n/**\n * Subset + Intersection\n * @desc From `T` pick properties that exist in `U` and intersect `K`\n */\nexport type SubsetIntersection<T, U, K> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & K\n\ntype Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }\n\n/**\n * XOR is needed to have a real mutually exclusive union type\n * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types\n */\nexport type XOR<T, U> = T extends object\n  ? U extends object\n    ? (Without<T, U> & U) | (Without<U, T> & T)\n    : U\n  : T\n\n/**\n * Is T a Record?\n */\ntype IsObject<T extends any> =\n  T extends Array<any>\n    ? False\n    : T extends Date\n      ? False\n      : T extends Uint8Array\n        ? False\n        : T extends BigInt\n          ? False\n          : T extends object\n            ? True\n            : False\n\n/**\n * If it's T[], return T\n */\nexport type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T\n\n/**\n * From ts-toolbelt\n */\n\ntype __Either<O extends object, K extends Key> = Omit<O, K> &\n  {\n    // Merge all but K\n    [P in K]: Prisma__Pick<O, P & keyof O> // With K possibilities\n  }[K]\n\ntype EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>\n\ntype EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>\n\ntype _Either<O extends object, K extends Key, strict extends Boolean> = {\n  1: EitherStrict<O, K>\n  0: EitherLoose<O, K>\n}[strict]\n\nexport type Either<\n  O extends object,\n  K extends Key,\n  strict extends Boolean = 1,\n> = O extends unknown ? _Either<O, K, strict> : never\n\nexport type Union = any\n\nexport type PatchUndefined<O extends object, O1 extends object> = {\n  [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K]\n} & {}\n\n/** Helper Types for \"Merge\" **/\nexport type IntersectOf<U extends Union> = (\n  U extends unknown ? (k: U) => void : never\n) extends (k: infer I) => void\n  ? I\n  : never\n\nexport type Overwrite<O extends object, O1 extends object> = {\n  [K in keyof O]: K extends keyof O1 ? O1[K] : O[K]\n} & {}\n\ntype _Merge<U extends object> = IntersectOf<\n  Overwrite<\n    U,\n    {\n      [K in keyof U]-?: At<U, K>\n    }\n  >\n>\n\ntype Key = string | number | symbol\ntype AtStrict<O extends object, K extends Key> = O[K & keyof O]\ntype AtLoose<O extends object, K extends Key> = O extends unknown\n  ? AtStrict<O, K>\n  : never\nexport type At<O extends object, K extends Key, strict extends Boolean = 1> = {\n  1: AtStrict<O, K>\n  0: AtLoose<O, K>\n}[strict]\n\nexport type ComputeRaw<A extends any> = A extends Function\n  ? A\n  : {\n      [K in keyof A]: A[K]\n    } & {}\n\nexport type OptionalFlat<O> = {\n  [K in keyof O]?: O[K]\n} & {}\n\ntype _Record<K extends keyof any, T> = {\n  [P in K]: T\n}\n\n// cause typescript not to expand types and preserve names\ntype NoExpand<T> = T extends unknown ? T : never\n\n// this type assumes the passed object is entirely optional\nexport type AtLeast<O extends object, K extends string> = NoExpand<\n  O extends unknown\n    ?\n        | (K extends keyof O ? { [P in K]: O[P] } & O : O)\n        | ({ [P in keyof O as P extends K ? P : never]-?: O[P] } & O)\n    : never\n>\n\ntype _Strict<U, _U = U> = U extends unknown\n  ? U & OptionalFlat<_Record<Exclude<Keys<_U>, keyof U>, never>>\n  : never\n\nexport type Strict<U extends object> = ComputeRaw<_Strict<U>>\n/** End Helper Types for \"Merge\" **/\n\nexport type Merge<U extends object> = ComputeRaw<_Merge<Strict<U>>>\n\nexport type Boolean = True | False\n\nexport type True = 1\n\nexport type False = 0\n\nexport type Not<B extends Boolean> = {\n  0: 1\n  1: 0\n}[B]\n\nexport type Extends<A1 extends any, A2 extends any> = [A1] extends [never]\n  ? 0 // anything `never` is false\n  : A1 extends A2\n    ? 1\n    : 0\n\nexport type Has<U extends Union, U1 extends Union> = Not<\n  Extends<Exclude<U1, U>, U1>\n>\n\nexport type Or<B1 extends Boolean, B2 extends Boolean> = {\n  0: {\n    0: 0\n    1: 1\n  }\n  1: {\n    0: 1\n    1: 1\n  }\n}[B1][B2]\n\nexport type Keys<U extends Union> = U extends unknown ? keyof U : never\n\nexport type GetScalarType<T, O> = O extends object\n  ? {\n      [P in keyof T]: P extends keyof O ? O[P] : never\n    }\n  : never\n\ntype FieldPaths<T, U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>> =\n  IsObject<T> extends True ? U : T\n\nexport type GetHavingFields<T> = {\n  [K in keyof T]: Or<\n    Or<Extends<'OR', K>, Extends<'AND', K>>,\n    Extends<'NOT', K>\n  > extends True\n    ? // infer is only needed to not hit TS limit\n      // based on the brilliant idea of Pierre-Antoine Mills\n      // https://github.com/microsoft/TypeScript/issues/30188#issuecomment-478938437\n      T[K] extends infer TK\n      ? GetHavingFields<\n          UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never\n        >\n      : never\n    : {} extends FieldPaths<T[K]>\n      ? never\n      : K\n}[keyof T]\n\n/**\n * Convert tuple to union\n */\ntype _TupleToUnion<T> = T extends (infer E)[] ? E : never\ntype TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>\nexport type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T\n\n/**\n * Like `Pick`, but additionally can also accept an array of keys\n */\nexport type PickEnumerable<\n  T,\n  K extends Enumerable<keyof T> | keyof T,\n> = Prisma__Pick<T, MaybeTupleToUnion<K>>\n\n/**\n * Exclude all keys with underscores\n */\nexport type ExcludeUnderscoreKeys<T extends string> = T extends `_${string}`\n  ? never\n  : T\n\nexport type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>\n\ntype FieldRefInputType<Model, FieldType> = Model extends never\n  ? never\n  : FieldRef<Model, FieldType>\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\nexport interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils\n  .Fn<\n  { extArgs: runtime.Types.Extensions.InternalArgs },\n  runtime.Types.Utils.Record<string, any>\n> {\n  returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>\n}\n\nexport type TypeMap<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> = {\n  globalOmitOptions: {\n    omit: GlobalOmitOptions\n  }\n  meta: {\n    modelProps: 'user'\n    txIsolationLevel: TransactionIsolationLevel\n  }\n  model: {\n    User: {\n      payload: Prisma.$UserPayload<ExtArgs>\n      fields: Prisma.UserFieldRefs\n      operations: {\n        findUnique: {\n          args: Prisma.UserFindUniqueArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findUniqueOrThrow: {\n          args: Prisma.UserFindUniqueOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findFirst: {\n          args: Prisma.UserFindFirstArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findFirstOrThrow: {\n          args: Prisma.UserFindFirstOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findMany: {\n          args: Prisma.UserFindManyArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        create: {\n          args: Prisma.UserCreateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        createMany: {\n          args: Prisma.UserCreateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        createManyAndReturn: {\n          args: Prisma.UserCreateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        delete: {\n          args: Prisma.UserDeleteArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        update: {\n          args: Prisma.UserUpdateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        deleteMany: {\n          args: Prisma.UserDeleteManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateMany: {\n          args: Prisma.UserUpdateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateManyAndReturn: {\n          args: Prisma.UserUpdateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        upsert: {\n          args: Prisma.UserUpsertArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        aggregate: {\n          args: Prisma.UserAggregateArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.AggregateUser>\n        }\n        groupBy: {\n          args: Prisma.UserGroupByArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.UserGroupByOutputType>[]\n        }\n        count: {\n          args: Prisma.UserCountArgs<ExtArgs>\n          result:\n            | runtime.Types.Utils.Optional<Prisma.UserCountAggregateOutputType>\n            | number\n        }\n      }\n    }\n  }\n} & {\n  other: {\n    payload: any\n    operations: {\n      $executeRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $executeRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n      $queryRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $queryRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n    }\n  }\n}\n\n/**\n * Enums\n */\n\nexport const TransactionIsolationLevel = runtime.makeStrictEnum({\n  Serializable: 'Serializable',\n} as const)\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n\n/**\n * Field references\n */\n\n/**\n * Reference to a field of type 'String'\n */\nexport type StringFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'String'\n>\n\n/**\n * Reference to a field of type 'Int'\n */\nexport type IntFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'Int'\n>\n\n/**\n * Batch Payload for updateMany & deleteMany & createMany\n */\nexport type BatchPayload = {\n  count: number\n}\n\nexport const defineExtension = runtime.Extensions\n  .defineExtension as unknown as runtime.Types.Extensions.ExtendsHook<\n  'define',\n  TypeMapCb,\n  runtime.Types.Extensions.DefaultArgs\n>\nexport type DefaultPrismaClient = PrismaClient\nexport type ErrorFormat = 'pretty' | 'colorless' | 'minimal'\nexport type PrismaClientOptions = (\n  | {\n      /**\n       * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`.\n       */\n      adapter: runtime.SqlDriverAdapterFactory\n      accelerateUrl?: never\n    }\n  | {\n      /**\n       * Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database.\n       */\n      accelerateUrl: string\n      adapter?: never\n    }\n) & {\n  /**\n   * @default \"colorless\"\n   */\n  errorFormat?: ErrorFormat\n  /**\n   * @example\n   * ```\n   * // Shorthand for `emit: 'stdout'`\n   * log: ['query', 'info', 'warn', 'error']\n   *\n   * // Emit as events only\n   * log: [\n   *   { emit: 'event', level: 'query' },\n   *   { emit: 'event', level: 'info' },\n   *   { emit: 'event', level: 'warn' }\n   *   { emit: 'event', level: 'error' }\n   * ]\n   *\n   * / Emit as events and log to stdout\n   * og: [\n   *  { emit: 'stdout', level: 'query' },\n   *  { emit: 'stdout', level: 'info' },\n   *  { emit: 'stdout', level: 'warn' }\n   *  { emit: 'stdout', level: 'error' }\n   *\n   * ```\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).\n   */\n  log?: (LogLevel | LogDefinition)[]\n  /**\n   * The default values for transactionOptions\n   * maxWait ?= 2000\n   * timeout ?= 5000\n   */\n  transactionOptions?: {\n    maxWait?: number\n    timeout?: number\n    isolationLevel?: TransactionIsolationLevel\n  }\n  /**\n   * Global configuration for omitting model fields by default.\n   *\n   * @example\n   * ```\n   * const prisma = new PrismaClient({\n   *   omit: {\n   *     user: {\n   *       password: true\n   *     }\n   *   }\n   * })\n   * ```\n   */\n  omit?: GlobalOmitConfig\n}\nexport type GlobalOmitConfig = {\n  user?: Prisma.UserOmit\n}\n\n/* Types for Logging */\nexport type LogLevel = 'info' | 'query' | 'warn' | 'error'\nexport type LogDefinition = {\n  level: LogLevel\n  emit: 'stdout' | 'event'\n}\n\nexport type CheckIsLogLevel<T> = T extends LogLevel ? T : never\n\nexport type GetLogType<T> = CheckIsLogLevel<\n  T extends LogDefinition ? T['level'] : T\n>\n\nexport type GetEvents<T extends any[]> =\n  T extends Array<LogLevel | LogDefinition> ? GetLogType<T[number]> : never\n\nexport type QueryEvent = {\n  timestamp: Date\n  query: string\n  params: string\n  duration: number\n  target: string\n}\n\nexport type LogEvent = {\n  timestamp: Date\n  message: string\n  target: string\n}\n/* End Types for Logging */\n\nexport type PrismaAction =\n  | 'findUnique'\n  | 'findUniqueOrThrow'\n  | 'findMany'\n  | 'findFirst'\n  | 'findFirstOrThrow'\n  | 'create'\n  | 'createMany'\n  | 'createManyAndReturn'\n  | 'update'\n  | 'updateMany'\n  | 'updateManyAndReturn'\n  | 'upsert'\n  | 'delete'\n  | 'deleteMany'\n  | 'executeRaw'\n  | 'queryRaw'\n  | 'aggregate'\n  | 'count'\n  | 'runCommandRaw'\n  | 'findRaw'\n  | 'groupBy'\n\n/**\n * `PrismaClient` proxy available in interactive transactions.\n */\nexport type TransactionClient = Omit<\n  DefaultPrismaClient,\n  runtime.ITXClientDenyList\n>\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/internal/prismaNamespaceBrowser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the browser.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/index-browser'\n\nexport type * from '../models'\nexport type * from './prismaNamespace'\n\nexport const Decimal = runtime.Decimal\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\n/*\n * Enums\n */\n\nexport const TransactionIsolationLevel = {\n  Serializable: 'Serializable',\n} as const\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/models/User.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports the `User` model and its related types.\n *\n * 🟢 You can import this file directly.\n */\nimport type * as runtime from '@prisma/client/runtime/client'\nimport type * as $Enums from '../enums'\nimport type * as Prisma from '../internal/prismaNamespace'\n\n/**\n * Model User\n *\n */\nexport type UserModel =\n  runtime.Types.Result.DefaultSelection<Prisma.$UserPayload>\n\nexport type AggregateUser = {\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\nexport type UserMinAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserMaxAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserCountAggregateOutputType = {\n  email: number\n  password: number\n  _all: number\n}\n\nexport type UserMinAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserMaxAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserCountAggregateInputType = {\n  email?: true\n  password?: true\n  _all?: true\n}\n\nexport type UserAggregateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which User to aggregate.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the start position\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Count returned Users\n   **/\n  _count?: true | UserCountAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the minimum value\n   **/\n  _min?: UserMinAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the maximum value\n   **/\n  _max?: UserMaxAggregateInputType\n}\n\nexport type GetUserAggregateType<T extends UserAggregateArgs> = {\n  [P in keyof T & keyof AggregateUser]: P extends '_count' | 'count'\n    ? T[P] extends true\n      ? number\n      : Prisma.GetScalarType<T[P], AggregateUser[P]>\n    : Prisma.GetScalarType<T[P], AggregateUser[P]>\n}\n\nexport type UserGroupByArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  where?: Prisma.UserWhereInput\n  orderBy?:\n    | Prisma.UserOrderByWithAggregationInput\n    | Prisma.UserOrderByWithAggregationInput[]\n  by: Prisma.UserScalarFieldEnum[] | Prisma.UserScalarFieldEnum\n  having?: Prisma.UserScalarWhereWithAggregatesInput\n  take?: number\n  skip?: number\n  _count?: UserCountAggregateInputType | true\n  _min?: UserMinAggregateInputType\n  _max?: UserMaxAggregateInputType\n}\n\nexport type UserGroupByOutputType = {\n  email: string\n  password: string\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\ntype GetUserGroupByPayload<T extends UserGroupByArgs> = Prisma.PrismaPromise<\n  Array<\n    Prisma.PickEnumerable<UserGroupByOutputType, T['by']> & {\n      [P in keyof T & keyof UserGroupByOutputType]: P extends '_count'\n        ? T[P] extends boolean\n          ? number\n          : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n        : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n    }\n  >\n>\n\nexport type UserWhereInput = {\n  AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  OR?: Prisma.UserWhereInput[]\n  NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  email?: Prisma.StringFilter<'User'> | string\n  password?: Prisma.StringFilter<'User'> | string\n}\n\nexport type UserOrderByWithRelationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserWhereUniqueInput = Prisma.AtLeast<\n  {\n    email?: string\n    AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    OR?: Prisma.UserWhereInput[]\n    NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    password?: Prisma.StringFilter<'User'> | string\n  },\n  'email' | 'email'\n>\n\nexport type UserOrderByWithAggregationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n  _count?: Prisma.UserCountOrderByAggregateInput\n  _max?: Prisma.UserMaxOrderByAggregateInput\n  _min?: Prisma.UserMinOrderByAggregateInput\n}\n\nexport type UserScalarWhereWithAggregatesInput = {\n  AND?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  OR?: Prisma.UserScalarWhereWithAggregatesInput[]\n  NOT?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  email?: Prisma.StringWithAggregatesFilter<'User'> | string\n  password?: Prisma.StringWithAggregatesFilter<'User'> | string\n}\n\nexport type UserCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUncheckedCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCreateManyInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateManyMutationInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateManyInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCountOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMaxOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMinOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type StringFieldUpdateOperationsInput = {\n  set?: string\n}\n\nexport type UserSelect<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectCreateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectUpdateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectScalar = {\n  email?: boolean\n  password?: boolean\n}\n\nexport type UserOmit<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetOmit<\n  'email' | 'password',\n  ExtArgs['result']['user']\n>\n\nexport type $UserPayload<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  name: 'User'\n  objects: {}\n  scalars: runtime.Types.Extensions.GetPayloadResult<\n    {\n      email: string\n      password: string\n    },\n    ExtArgs['result']['user']\n  >\n  composites: {}\n}\n\nexport type UserGetPayload<\n  S extends boolean | null | undefined | UserDefaultArgs,\n> = runtime.Types.Result.GetResult<Prisma.$UserPayload, S>\n\nexport type UserCountArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = Omit<UserFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {\n  select?: UserCountAggregateInputType | true\n}\n\nexport interface UserDelegate<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> {\n  [K: symbol]: {\n    types: Prisma.TypeMap<ExtArgs>['model']['User']\n    meta: { name: 'User' }\n  }\n  /**\n   * Find zero or one User that matches the filter.\n   * @param {UserFindUniqueArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUnique({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUnique<T extends UserFindUniqueArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUnique',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find one User that matches the filter or throw an error with `error.code='P2025'`\n   * if no matches were found.\n   * @param {UserFindUniqueOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUniqueOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUniqueOrThrow<T extends UserFindUniqueOrThrowArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUniqueOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirst({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirst<T extends UserFindFirstArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirst',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter or\n   * throw `PrismaKnownClientError` with `P2025` code if no matches were found.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirstOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirstOrThrow<T extends UserFindFirstOrThrowArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirstOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find zero or more Users that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindManyArgs} args - Arguments to filter and select certain fields only.\n   * @example\n   * // Get all Users\n   * const users = await prisma.user.findMany()\n   *\n   * // Get first 10 Users\n   * const users = await prisma.user.findMany({ take: 10 })\n   *\n   * // Only select the `email`\n   * const userWithEmailOnly = await prisma.user.findMany({ select: { email: true } })\n   *\n   */\n  findMany<T extends UserFindManyArgs>(\n    args?: Prisma.SelectSubset<T, UserFindManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findMany',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create a User.\n   * @param {UserCreateArgs} args - Arguments to create a User.\n   * @example\n   * // Create one User\n   * const User = await prisma.user.create({\n   *   data: {\n   *     // ... data to create a User\n   *   }\n   * })\n   *\n   */\n  create<T extends UserCreateArgs>(\n    args: Prisma.SelectSubset<T, UserCreateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'create',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Create many Users.\n   * @param {UserCreateManyArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createMany({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   */\n  createMany<T extends UserCreateManyArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Create many Users and returns the data saved in the database.\n   * @param {UserCreateManyAndReturnArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createManyAndReturn({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Create many Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.createManyAndReturn({\n   *   select: { email: true },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  createManyAndReturn<T extends UserCreateManyAndReturnArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'createManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Delete a User.\n   * @param {UserDeleteArgs} args - Arguments to delete one User.\n   * @example\n   * // Delete one User\n   * const User = await prisma.user.delete({\n   *   where: {\n   *     // ... filter to delete one User\n   *   }\n   * })\n   *\n   */\n  delete<T extends UserDeleteArgs>(\n    args: Prisma.SelectSubset<T, UserDeleteArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'delete',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Update one User.\n   * @param {UserUpdateArgs} args - Arguments to update one User.\n   * @example\n   * // Update one User\n   * const user = await prisma.user.update({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  update<T extends UserUpdateArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'update',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Delete zero or more Users.\n   * @param {UserDeleteManyArgs} args - Arguments to filter Users to delete.\n   * @example\n   * // Delete a few Users\n   * const { count } = await prisma.user.deleteMany({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   *\n   */\n  deleteMany<T extends UserDeleteManyArgs>(\n    args?: Prisma.SelectSubset<T, UserDeleteManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserUpdateManyArgs} args - Arguments to update one or more rows.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateMany({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  updateMany<T extends UserUpdateManyArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users and returns the data updated in the database.\n   * @param {UserUpdateManyAndReturnArgs} args - Arguments to update many Users.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateManyAndReturn({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Update zero or more Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.updateManyAndReturn({\n   *   select: { email: true },\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  updateManyAndReturn<T extends UserUpdateManyAndReturnArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'updateManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create or update one User.\n   * @param {UserUpsertArgs} args - Arguments to update or create a User.\n   * @example\n   * // Update or create a User\n   * const user = await prisma.user.upsert({\n   *   create: {\n   *     // ... data to create a User\n   *   },\n   *   update: {\n   *     // ... in case it already exists, update\n   *   },\n   *   where: {\n   *     // ... the filter for the User we want to update\n   *   }\n   * })\n   */\n  upsert<T extends UserUpsertArgs>(\n    args: Prisma.SelectSubset<T, UserUpsertArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'upsert',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Count the number of Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserCountArgs} args - Arguments to filter Users to count.\n   * @example\n   * // Count the number of Users\n   * const count = await prisma.user.count({\n   *   where: {\n   *     // ... the filter for the Users we want to count\n   *   }\n   * })\n   **/\n  count<T extends UserCountArgs>(\n    args?: Prisma.Subset<T, UserCountArgs>,\n  ): Prisma.PrismaPromise<\n    T extends runtime.Types.Utils.Record<'select', any>\n      ? T['select'] extends true\n        ? number\n        : Prisma.GetScalarType<T['select'], UserCountAggregateOutputType>\n      : number\n  >\n\n  /**\n   * Allows you to perform aggregations operations on a User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserAggregateArgs} args - Select which aggregations you would like to apply and on what fields.\n   * @example\n   * // Ordered by age ascending\n   * // Where email contains prisma.io\n   * // Limited to the 10 users\n   * const aggregations = await prisma.user.aggregate({\n   *   _avg: {\n   *     age: true,\n   *   },\n   *   where: {\n   *     email: {\n   *       contains: \"prisma.io\",\n   *     },\n   *   },\n   *   orderBy: {\n   *     age: \"asc\",\n   *   },\n   *   take: 10,\n   * })\n   **/\n  aggregate<T extends UserAggregateArgs>(\n    args: Prisma.Subset<T, UserAggregateArgs>,\n  ): Prisma.PrismaPromise<GetUserAggregateType<T>>\n\n  /**\n   * Group by User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserGroupByArgs} args - Group by arguments.\n   * @example\n   * // Group by city, order by createdAt, get count\n   * const result = await prisma.user.groupBy({\n   *   by: ['city', 'createdAt'],\n   *   orderBy: {\n   *     createdAt: true\n   *   },\n   *   _count: {\n   *     _all: true\n   *   },\n   * })\n   *\n   **/\n  groupBy<\n    T extends UserGroupByArgs,\n    HasSelectOrTake extends Prisma.Or<\n      Prisma.Extends<'skip', Prisma.Keys<T>>,\n      Prisma.Extends<'take', Prisma.Keys<T>>\n    >,\n    OrderByArg extends Prisma.True extends HasSelectOrTake\n      ? { orderBy: UserGroupByArgs['orderBy'] }\n      : { orderBy?: UserGroupByArgs['orderBy'] },\n    OrderFields extends Prisma.ExcludeUnderscoreKeys<\n      Prisma.Keys<Prisma.MaybeTupleToUnion<T['orderBy']>>\n    >,\n    ByFields extends Prisma.MaybeTupleToUnion<T['by']>,\n    ByValid extends Prisma.Has<ByFields, OrderFields>,\n    HavingFields extends Prisma.GetHavingFields<T['having']>,\n    HavingValid extends Prisma.Has<ByFields, HavingFields>,\n    ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False,\n    InputErrors extends ByEmpty extends Prisma.True\n      ? `Error: \"by\" must not be empty.`\n      : HavingValid extends Prisma.False\n        ? {\n            [P in HavingFields]: P extends ByFields\n              ? never\n              : P extends string\n                ? `Error: Field \"${P}\" used in \"having\" needs to be provided in \"by\".`\n                : [\n                    Error,\n                    'Field ',\n                    P,\n                    ` in \"having\" needs to be provided in \"by\"`,\n                  ]\n          }[HavingFields]\n        : 'take' extends Prisma.Keys<T>\n          ? 'orderBy' extends Prisma.Keys<T>\n            ? ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields]\n            : 'Error: If you provide \"take\", you also need to provide \"orderBy\"'\n          : 'skip' extends Prisma.Keys<T>\n            ? 'orderBy' extends Prisma.Keys<T>\n              ? ByValid extends Prisma.True\n                ? {}\n                : {\n                    [P in OrderFields]: P extends ByFields\n                      ? never\n                      : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                  }[OrderFields]\n              : 'Error: If you provide \"skip\", you also need to provide \"orderBy\"'\n            : ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields],\n  >(\n    args: Prisma.SubsetIntersection<T, UserGroupByArgs, OrderByArg> &\n      InputErrors,\n  ): {} extends InputErrors\n    ? GetUserGroupByPayload<T>\n    : Prisma.PrismaPromise<InputErrors>\n  /**\n   * Fields of the User model\n   */\n  readonly fields: UserFieldRefs\n}\n\n/**\n * The delegate class that acts as a \"Promise-like\" for User.\n * Why is this prefixed with `Prisma__`?\n * Because we want to prevent naming conflicts as mentioned in\n * https://github.com/prisma/prisma-client-js/issues/707\n */\nexport interface Prisma__UserClient<\n  T,\n  Null = never,\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> extends Prisma.PrismaPromise<T> {\n  readonly [Symbol.toStringTag]: 'PrismaPromise'\n  /**\n   * Attaches callbacks for the resolution and/or rejection of the Promise.\n   * @param onfulfilled The callback to execute when the Promise is resolved.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of which ever callback is executed.\n   */\n  then<TResult1 = T, TResult2 = never>(\n    onfulfilled?:\n      | ((value: T) => TResult1 | PromiseLike<TResult1>)\n      | undefined\n      | null,\n    onrejected?:\n      | ((reason: any) => TResult2 | PromiseLike<TResult2>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<TResult1 | TResult2>\n  /**\n   * Attaches a callback for only the rejection of the Promise.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of the callback.\n   */\n  catch<TResult = never>(\n    onrejected?:\n      | ((reason: any) => TResult | PromiseLike<TResult>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<T | TResult>\n  /**\n   * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The\n   * resolved value cannot be modified from the callback.\n   * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).\n   * @returns A Promise for the completion of the callback.\n   */\n  finally(\n    onfinally?: (() => void) | undefined | null,\n  ): runtime.Types.Utils.JsPromise<T>\n}\n\n/**\n * Fields of the User model\n */\nexport interface UserFieldRefs {\n  readonly email: Prisma.FieldRef<'User', 'String'>\n  readonly password: Prisma.FieldRef<'User', 'String'>\n}\n\n// Custom InputTypes\n/**\n * User findUnique\n */\nexport type UserFindUniqueArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findUniqueOrThrow\n */\nexport type UserFindUniqueOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findFirst\n */\nexport type UserFindFirstArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findFirstOrThrow\n */\nexport type UserFindFirstOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findMany\n */\nexport type UserFindManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which Users to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for listing Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User create\n */\nexport type UserCreateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to create a User.\n   */\n  data: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n}\n\n/**\n * User createMany\n */\nexport type UserCreateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User createManyAndReturn\n */\nexport type UserCreateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectCreateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User update\n */\nexport type UserUpdateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to update a User.\n   */\n  data: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n  /**\n   * Choose, which User to update.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User updateMany\n */\nexport type UserUpdateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User updateManyAndReturn\n */\nexport type UserUpdateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectUpdateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User upsert\n */\nexport type UserUpsertArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The filter to search for the User to update in case it exists.\n   */\n  where: Prisma.UserWhereUniqueInput\n  /**\n   * In case the User found by the `where` argument doesn't exist, create a new User with this data.\n   */\n  create: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n  /**\n   * In case the User was found with the provided `where` argument, update it with this data.\n   */\n  update: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n}\n\n/**\n * User delete\n */\nexport type UserDeleteArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter which User to delete.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User deleteMany\n */\nexport type UserDeleteManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which Users to delete\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to delete.\n   */\n  limit?: number\n}\n\n/**\n * User without action\n */\nexport type UserDefaultArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/prisma-generated/models.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This is a barrel export file for all models and their related types.\n *\n * 🟢 You can import this file directly.\n */\nexport type * from './models/User'\nexport type * from './commonInputTypes'\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SignupRouteImport } from './routes/signup'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteRouteImport } from './routes/_authed/posts.route'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst SignupRoute = SignupRouteImport.update({\n  id: '/signup',\n  path: '/signup',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRouteRoute = AuthedPostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRouteRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts': typeof AuthedPostsRouteRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/_authed/posts': typeof AuthedPostsRouteRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  LogoutRoute: typeof LogoutRoute\n  SignupRoute: typeof SignupRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/signup': {\n      id: '/signup'\n      path: '/signup'\n      fullPath: '/signup'\n      preLoaderRoute: typeof SignupRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRouteRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRouteRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteRouteChildren: AuthedPostsRouteRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteRouteWithChildren =\n  AuthedPostsRouteRoute._addFileChildren(AuthedPostsRouteRouteChildren)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRouteRoute: typeof AuthedPostsRouteRouteWithChildren\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRouteRoute: AuthedPostsRouteRouteWithChildren,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n  LoginRoute: LoginRoute,\n  LogoutRoute: LogoutRoute,\n  SignupRoute: SignupRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { createServerFn } from '@tanstack/react-start'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'\nimport { NotFound } from '~/components/NotFound.js'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo.js'\nimport { useAppSession } from '~/utils/session.js'\n\nconst fetchUser = createServerFn({ method: 'GET' }).handler(async () => {\n  // We need to auth on the server so we have access to secure cookies\n  const session = await useAppSession()\n\n  if (!session.data.userEmail) {\n    return null\n  }\n\n  return {\n    email: session.data.userEmail,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const user = await fetchUser()\n\n    return {\n      user,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  const { user } = Route.useRouteContext()\n\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div className=\"ml-auto\">\n            {user ? (\n              <>\n                <span className=\"mr-2\">{user.email}</span>\n                <Link to=\"/logout\">Logout</Link>\n              </>\n            ) : (\n              <Link to=\"/login\">Login</Link>\n            )}\n          </div>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound.js'\nimport { fetchPost } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/_authed/posts.route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/_authed.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { Login } from '~/components/Login'\nimport { useAppSession } from '~/utils/session'\n\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator((d: { email: string; password: string }) => d)\n  .handler(async ({ data }) => {\n    // Find the user\n    const user = await prismaClient.user.findUnique({\n      where: {\n        email: data.email,\n      },\n    })\n\n    // Check if the user exists\n    if (!user) {\n      return {\n        error: true,\n        userNotFound: true,\n        message: 'User not found',\n      }\n    }\n\n    // Check if the password is correct\n    const hashedPassword = await hashPassword(data.password)\n\n    if (user.password !== hashedPassword) {\n      return {\n        error: true,\n        message: 'Incorrect password',\n      }\n    }\n\n    // Create a session\n    const session = await useAppSession()\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n  })\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return <Login />\n    }\n\n    throw error\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Login } from '~/components/Login'\n\nexport const Route = createFileRoute('/login')({\n  component: LoginComp,\n})\n\nfunction LoginComp() {\n  return <Login />\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/logout.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { useAppSession } from '~/utils/session'\n\nconst logoutFn = createServerFn().handler(async () => {\n  const session = await useAppSession()\n\n  session.clear()\n\n  throw redirect({\n    href: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  preload: false,\n  loader: () => logoutFn(),\n})\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/routes/signup.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn, useServerFn } from '@tanstack/react-start'\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { useMutation } from '~/hooks/useMutation'\nimport { Auth } from '~/components/Auth'\nimport { useAppSession } from '~/utils/session'\n\nexport const signupFn = createServerFn({ method: 'POST' })\n  .inputValidator(\n    (d: { email: string; password: string; redirectUrl?: string }) => d,\n  )\n  .handler(async ({ data }) => {\n    // Check if the user already exists\n    const found = await prismaClient.user.findUnique({\n      where: {\n        email: data.email,\n      },\n    })\n\n    // Encrypt the password using Sha256 into plaintext\n    const password = await hashPassword(data.password)\n\n    // Create a session\n    const session = await useAppSession()\n\n    if (found) {\n      if (found.password !== password) {\n        return {\n          error: true,\n          userExists: true,\n          message: 'User already exists',\n        }\n      }\n\n      // Store the user's email in the session\n      await session.update({\n        userEmail: found.email,\n      })\n\n      // Redirect to the prev page stored in the \"redirect\" search param\n      throw redirect({\n        href: data.redirectUrl || '/',\n      })\n    }\n\n    // Create the user\n    const user = await prismaClient.user.create({\n      data: {\n        email: data.email,\n        password,\n      },\n    })\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n\n    // Redirect to the prev page stored in the \"redirect\" search param\n    throw redirect({\n      href: data.redirectUrl || '/',\n    })\n  })\n\nexport const Route = createFileRoute('/signup')({\n  component: SignupComp,\n})\n\nfunction SignupComp() {\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Sign Up\"\n      status={signupMutation.status}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as HTMLFormElement)\n\n        signupMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        signupMutation.data?.error ? (\n          <>\n            <div className=\"text-red-400\">{signupMutation.data.message}</div>\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/utils/prisma.ts",
    "content": "import crypto from 'node:crypto'\nimport { PrismaLibSql } from '@prisma/adapter-libsql'\nimport { PrismaClient } from '../prisma-generated/client'\n\nconst adapter = new PrismaLibSql({\n  url: process.env.DATABASE_URL || 'file:./prisma/dev.db',\n})\nexport const prismaClient = new PrismaClient({ adapter })\n\nexport function hashPassword(password: string) {\n  return new Promise<string>((resolve, reject) => {\n    crypto.pbkdf2(password, 'salt', 100000, 64, 'sha256', (err, derivedKey) => {\n      if (err) {\n        reject(err)\n      } else {\n        resolve(derivedKey.toString('hex'))\n      }\n    })\n  })\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/src/utils/session.ts",
    "content": "// src/services/session.server.ts\nimport { useSession } from '@tanstack/react-start/server'\nimport type { User } from '@prisma/client'\n\ntype SessionUser = {\n  userEmail: User['email']\n}\n\nexport function useAppSession() {\n  return useSession<SessionUser>({\n    password: 'ChangeThisBeforeShippingToProdOrYouWillBeFired',\n  })\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-auth/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-basic-authjs/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/.gitignore",
    "content": "node_modules\ndist\n.env\n*.local\n.DS_Store\n.tanstack"
  },
  {
    "path": "examples/react/start-basic-authjs/README.md",
    "content": "# TanStack Start - Auth.js Example\n\nA TanStack Start example demonstrating authentication with Auth.js (NextAuth.js).\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Auth.js Documentation](https://authjs.dev/)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-basic-authjs start-basic-authjs\n```\n\n## Setup\n\nThis example requires environment variables for Auth.js configuration. Copy the `.env.example` file to `.env` and fill in your authentication provider credentials:\n\n```sh\ncp .env.example .env\n```\n\nEdit `.env` and add your authentication provider credentials.\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## Authentication Configuration\n\nThis example demonstrates how to integrate Auth.js with TanStack Start. Check the source code for examples of:\n\n- Configuring authentication providers\n- Protecting routes with authentication\n- Accessing session data in server functions\n"
  },
  {
    "path": "examples/react/start-basic-authjs/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-basic-authjs\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@auth/core\": \"^0.41.1\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"start-authjs\": \"^1.0.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"@vitejs/plugin-react\": \"^6.0.1\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ProtectedRouteImport } from './routes/protected'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'\n\nconst ProtectedRoute = ProtectedRouteImport.update({\n  id: '/protected',\n  path: '/protected',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({\n  id: '/api/auth/$',\n  path: '/api/auth/$',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/protected': typeof ProtectedRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/protected': typeof ProtectedRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/protected': typeof ProtectedRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/login' | '/protected' | '/api/auth/$'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/protected' | '/api/auth/$'\n  id: '__root__' | '/' | '/login' | '/protected' | '/api/auth/$'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LoginRoute: typeof LoginRoute\n  ProtectedRoute: typeof ProtectedRoute\n  ApiAuthSplatRoute: typeof ApiAuthSplatRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/protected': {\n      id: '/protected'\n      path: '/protected'\n      fullPath: '/protected'\n      preLoaderRoute: typeof ProtectedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/auth/$': {\n      id: '/api/auth/$'\n      path: '/api/auth/$'\n      fullPath: '/api/auth/$'\n      preLoaderRoute: typeof ApiAuthSplatRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LoginRoute: LoginRoute,\n  ProtectedRoute: ProtectedRoute,\n  ApiAuthSplatRoute: ApiAuthSplatRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n  return router\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport type { ReactNode } from 'react'\nimport type { AuthSession } from 'start-authjs'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { createServerFn } from '@tanstack/react-start'\nimport { getRequest } from '@tanstack/react-start/server'\nimport { getSession } from 'start-authjs'\nimport { authConfig } from '~/utils/auth'\nimport appCss from '~/styles/app.css?url'\n\ninterface RouterContext {\n  session: AuthSession | null\n}\n\nconst fetchSession = createServerFn({ method: 'GET' }).handler(async () => {\n  const request = getRequest()\n  const session = await getSession(request, authConfig)\n  return session\n})\n\nexport const Route = createRootRouteWithContext<RouterContext>()({\n  beforeLoad: async () => {\n    const session = await fetchSession()\n    return {\n      session,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Auth Example',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <NavBar />\n        <main className=\"p-4\">{children}</main>\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n\nfunction NavBar() {\n  const routeContext = Route.useRouteContext()\n\n  return (\n    <nav className=\"p-4 flex gap-4 items-center bg-gray-100\">\n      <Link\n        to=\"/\"\n        activeProps={{ className: 'font-bold' }}\n        activeOptions={{ exact: true }}\n      >\n        Home\n      </Link>\n      <Link to=\"/protected\" activeProps={{ className: 'font-bold' }}>\n        Protected\n      </Link>\n      <div className=\"ml-auto flex items-center gap-4\">\n        {routeContext.session ? (\n          <>\n            <span className=\"text-gray-600\">\n              {routeContext.session?.user?.name ||\n                routeContext.session?.user?.email}\n            </span>\n            <a\n              href=\"/api/auth/signout\"\n              className=\"px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600\"\n            >\n              Sign Out\n            </a>\n          </>\n        ) : (\n          <Link\n            to=\"/login\"\n            className=\"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600\"\n          >\n            Sign In\n          </Link>\n        )}\n      </div>\n    </nav>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/routes/api/auth/$.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { StartAuthJS } from 'start-authjs'\nimport { authConfig } from '~/utils/auth'\n\n/**\n * Auth.js API route handler\n * Handles all auth routes: /api/auth/*\n */\nconst { GET, POST } = StartAuthJS(authConfig)\n\nexport const Route = createFileRoute('/api/auth/$')({\n  server: {\n    handlers: {\n      GET: ({ request }) => GET({ request, response: new Response() }),\n      POST: ({ request }) => POST({ request, response: new Response() }),\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  const { session } = Route.useRouteContext()\n  const user = session?.user\n\n  return (\n    <div className=\"max-w-2xl mx-auto\">\n      <h1 className=\"text-3xl font-bold mb-4\">\n        TanStack Start Auth.js Example\n      </h1>\n      <p className=\"text-gray-600 mb-8\">\n        This example demonstrates auth.js integration with TanStack Start using\n        Auth0 OAuth.\n      </p>\n\n      <div className=\"bg-gray-50 rounded-lg p-6\">\n        <h2 className=\"text-xl font-semibold mb-4\">Auth Status</h2>\n\n        {session ? (\n          <div className=\"space-y-2\">\n            <p className=\"text-green-600 font-medium\">Authenticated</p>\n            {user?.image && (\n              <img\n                src={user.image}\n                alt=\"Avatar\"\n                className=\"w-16 h-16 rounded-full\"\n              />\n            )}\n            <p>\n              <strong>Name:</strong> {user?.name ?? 'N/A'}\n            </p>\n            <p>\n              <strong>Email:</strong> {user?.email ?? 'N/A'}\n            </p>\n          </div>\n        ) : (\n          <p className=\"text-gray-500\">\n            You are not signed in. Click \"Sign In\" in the navigation bar to\n            authenticate with Auth0.\n          </p>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/routes/login.tsx",
    "content": "import { useState, useEffect, Suspense } from 'react'\nimport { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/login')({\n  beforeLoad: ({ context }) => {\n    // Redirect if already authenticated\n    if (context.session) {\n      throw redirect({ to: '/' })\n    }\n  },\n  component: Login,\n})\n\nfunction Login() {\n  const [csrfToken, setCsrfToken] = useState<string>('')\n\n  useEffect(() => {\n    fetch('/api/auth/csrf')\n      .then((res) => res.json())\n      .then((data) => setCsrfToken(data.csrfToken))\n  }, [])\n\n  return (\n    <div className=\"max-w-md mx-auto mt-10\">\n      <h1 className=\"text-2xl font-bold mb-6 text-center\">Sign In</h1>\n\n      <div className=\"space-y-4\">\n        <form action=\"/api/auth/signin/auth0\" method=\"POST\">\n          <input type=\"hidden\" name=\"csrfToken\" value={csrfToken} />\n          <input type=\"hidden\" name=\"callbackUrl\" value=\"/\" />\n          <button\n            type=\"submit\"\n            className=\"w-full flex items-center justify-center gap-3 px-4 py-3 bg-orange-500 text-white rounded-lg hover:bg-orange-600 transition-colors cursor-pointer\"\n          >\n            <svg className=\"w-5 h-5\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n              <path d=\"M21.98 7.448L19.62 0H4.347L2.02 7.448c-1.352 4.312.03 9.206 3.815 12.015L12.007 24l6.157-4.552c3.755-2.81 5.182-7.688 3.815-12.015l-6.16 4.58 2.343 7.45-6.157-4.597-6.158 4.58 2.358-7.433-6.188-4.55 7.63-.045L12.008 0l2.356 7.404 7.615.044z\" />\n            </svg>\n            Continue with Auth0\n          </button>\n        </form>\n\n        <p className=\"text-center text-sm text-gray-500 mt-4\">\n          You'll be redirected to Auth0 to complete the sign-in process.\n        </p>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/routes/protected.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/protected')({\n  beforeLoad: ({ context }) => {\n    if (!context.session) {\n      throw redirect({ to: '/login' })\n    }\n  },\n  component: Protected,\n})\n\nfunction Protected() {\n  const { session } = Route.useRouteContext()\n  const user = session?.user\n\n  return (\n    <div className=\"max-w-2xl mx-auto\">\n      <h1 className=\"text-3xl font-bold mb-4\">Protected Page</h1>\n      <p className=\"text-gray-600 mb-8\">\n        This page is only accessible to authenticated users.\n      </p>\n\n      <div className=\"bg-green-50 border border-green-200 rounded-lg p-6\">\n        <h2 className=\"text-xl font-semibold mb-4 text-green-800\">\n          Welcome, {user?.name ?? 'User'}!\n        </h2>\n\n        {user && (\n          <div className=\"space-y-2 text-green-700\">\n            <p>\n              <strong>Email:</strong> {user?.email ?? 'N/A'}\n            </p>\n            {user?.image && (\n              <div>\n                <strong>Avatar:</strong>\n                <img\n                  src={user.image}\n                  alt=\"User avatar\"\n                  className=\"w-20 h-20 rounded-full mt-2\"\n                />\n              </div>\n            )}\n          </div>\n        )}\n      </div>\n\n      <div className=\"mt-8 p-4 bg-gray-100 rounded-lg\">\n        <h3 className=\"font-semibold mb-2\">Session Data (Debug)</h3>\n        <pre className=\"text-xs overflow-auto bg-gray-800 text-green-400 p-4 rounded\">\n          {JSON.stringify(session, null, 2)}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "examples/react/start-basic-authjs/src/utils/auth.ts",
    "content": "import Auth0 from '@auth/core/providers/auth0'\nimport { setCookie } from '@tanstack/react-start/server'\nimport type { Profile } from '@auth/core/types'\nimport type { StartAuthJSConfig } from 'start-authjs'\n\ndeclare module '@auth/core/types' {\n  export interface Session {\n    user: {\n      name: string\n      email: string\n      sub: string\n      email_verified: boolean\n    } & Profile\n    account: {\n      access_token: string\n    }\n    expires: Date\n  }\n}\n\n/**\n * Auth.js configuration for TanStack Start with Auth0\n */\nexport const authConfig: StartAuthJSConfig = {\n  // basePath is derived from AUTH_URL env var\n  secret: process.env.AUTH_SECRET,\n  providers: [\n    Auth0({\n      // Auth.js auto-reads AUTH_AUTH0_ID, AUTH_AUTH0_SECRET, AUTH_AUTH0_ISSUER from env\n      authorization: {\n        params: {\n          scope: 'email email_verified openid profile',\n          prompt: 'login',\n        },\n      },\n      async profile(profile, tokens) {\n        await setCookie(\n          'auth0Token',\n          encodeURIComponent(tokens.access_token ?? ''),\n        )\n        await setCookie(\n          'auth0User',\n          encodeURIComponent(JSON.stringify(profile)),\n        )\n\n        return profile\n      },\n    }),\n  ],\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"noEmit\": true,\n    \"jsx\": \"react-jsx\",\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    }\n  },\n  \"include\": [\"src\", \"env.d.ts\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "examples/react/start-basic-authjs/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 10000,\n    strictPort: true,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/.gitignore",
    "content": "node_modules\n.DS_Store\n.cache\n.env\ndist\n.wrangler\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/.prettierignore",
    "content": "**/public\npnpm-lock.yaml\nrouteTree.gen.ts\nworker-configuration.d.ts\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/README.md",
    "content": "# TanStack Start - Cloudflare Example\n\nA TanStack Start example demonstrating deployment to Cloudflare Workers.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Cloudflare Workers Documentation](https://developers.cloudflare.com/workers/)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-basic-cloudflare start-basic-cloudflare\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## Preview\n\nTo preview the production build locally:\n\n```sh\npnpm preview\n```\n\n## Deploy to Cloudflare\n\nTo deploy your app to Cloudflare Workers:\n\n```sh\npnpm run deploy\n```\n\n## Accessing Cloudflare Bindings\n\nYou can access Cloudflare bindings in server functions by using importable `env`:\n\n```ts\nimport { env } from 'cloudflare:workers'\n```\n\nSee `src/routes/index.tsx` for an example.\n\n## Cloudflare Configuration\n\nThis example includes:\n\n- Wrangler configuration for Cloudflare Workers\n- Type generation for Cloudflare bindings\n- Server-side rendering on the edge\n- Access to Cloudflare platform features (KV, D1, R2, etc.)\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-basic-cloudflare\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"deploy\": \"npm run build && wrangler deploy\",\n    \"cf-typegen\": \"wrangler types\",\n    \"postinstall\": \"npm run cf-typegen\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@cloudflare/vite-plugin\": \"^1.29.0\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"wrangler\": \"^4.74.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/components/PostError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/components/UserError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as CustomScriptDotjsRouteImport } from './routes/customScript[.]js'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CustomScriptDotjsRoute = CustomScriptDotjsRouteImport.update({\n  id: '/customScript.js',\n  path: '/customScript.js',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/_pathlessLayout/_nested-layout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/api/users/$userId'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  CustomScriptDotjsRoute: typeof CustomScriptDotjsRoute\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/customScript.js': {\n      id: '/customScript.js'\n      path: '/customScript.js'\n      fullPath: '/customScript.js'\n      preLoaderRoute: typeof CustomScriptDotjsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  CustomScriptDotjsRoute: CustomScriptDotjsRoute,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n    scripts: [\n      {\n        src: '/customScript.js',\n        type: 'text/javascript',\n      },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(\n            'https://jsonplaceholder.typicode.com/users/' + params.userId,\n          )\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n\n          const user = (await res.json()) as User\n\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { getRequestHeaders } from '@tanstack/react-start/server'\nimport { createMiddleware } from '@tanstack/react-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: /users')\n  console.info('Request Headers:', getRequestHeaders())\n  const result = await next()\n  result.response.headers.set('x-users', 'true')\n  console.info('Out: /users')\n  return result\n})\n\nconst testParentMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: testParentMiddleware')\n  const result = await next()\n  result.response.headers.set('x-test-parent', 'true')\n  console.info('Out: testParentMiddleware')\n  return result\n})\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('GET /api/users @', request.url)\n        console.info('Fetching users... @', request.url)\n        const res = await fetch('https://jsonplaceholder.typicode.com/users')\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n\n        const data = (await res.json()) as Array<User>\n\n        const list = data.slice(0, 10)\n\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/customScript[.]js.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/customScript.js')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response('console.log(\"Hello from customScript.js!\")', {\n          headers: {\n            'Content-Type': 'application/javascript',\n          },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Suspense, useState } from 'react'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(({ data: name }) => {\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: name }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: 'Tanner Linsley' }),\n      person: await personServerFn({ data: 'John Doe' }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = useState(0)\n  const { deferredStuff, deferredPerson, person } = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {person.name} - {person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count}</div>\n      <div>\n        <button onClick={() => setCount(count + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { env } from 'cloudflare:workers'\n\nexport const Route = createFileRoute('/')({\n  loader: () => getData(),\n  component: Home,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    message: `Running in ${navigator.userAgent}`,\n    myVar: env.MY_VAR,\n  }\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <p>{data.message}</p>\n      <p>{data.myVar}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '~/utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: String(post.id),\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '~/utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: String(post.id),\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '~/utils/posts'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) =>\n    fetchPost({\n      data: postId,\n    }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/redirect.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { NotFound } from 'src/components/NotFound'\nimport { UserErrorComponent } from 'src/components/UserError'\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    try {\n      const res = await fetch('/api/users/' + userId)\n      if (!res.ok) {\n        throw new Error('Unexpected status code')\n      }\n\n      const data = await res.json()\n\n      return data as User\n    } catch {\n      throw new Error('Failed to fetch user')\n    }\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{user.name}</h4>\n      <div className=\"text-sm\">{user.email}</div>\n      <div>\n        <a\n          href={`/api/users/${user.id}`}\n          className=\"text-blue-800 hover:text-blue-600 underline\"\n        >\n          View as JSON\n        </a>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div>\n      Select a user or{' '}\n      <a\n        href=\"/api/users\"\n        className=\"text-blue-800 hover:text-blue-600 underline\"\n      >\n        view as JSON\n      </a>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const res = await fetch('/api/users')\n\n    if (!res.ok) {\n      throw new Error('Unexpected status code')\n    }\n\n    const data = await res.json()\n\n    return data as Array<User>\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...users,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li key={user.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/utils/loggingMiddleware.tsx",
    "content": "import { createMiddleware } from '@tanstack/react-start'\n\nconst preLogMiddleware = createMiddleware({ type: 'function' })\n  .client(async (ctx) => {\n    const clientTime = new Date()\n\n    return ctx.next({\n      context: {\n        clientTime,\n      },\n      sendContext: {\n        clientTime,\n      },\n    })\n  })\n  .server(async (ctx) => {\n    const serverTime = new Date()\n\n    return ctx.next({\n      sendContext: {\n        serverTime,\n        durationToServer:\n          serverTime.getTime() - ctx.context.clientTime.getTime(),\n      },\n    })\n  })\n\nexport const logMiddleware = createMiddleware({ type: 'function' })\n  .middleware([preLogMiddleware])\n  .client(async (ctx) => {\n    const res = await ctx.next()\n\n    const now = new Date()\n    console.log('Client Req/Res:', {\n      duration: now.getTime() - res.context.clientTime.getTime(),\n      durationToServer: res.context.durationToServer,\n      durationFromServer: now.getTime() - res.context.serverTime.getTime(),\n    })\n\n    return res\n  })\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nexport type PostType = {\n  id: number\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'POST' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const res = await fetch(\n      `https://jsonplaceholder.typicode.com/posts/${data}`,\n    )\n    if (!res.ok) {\n      if (res.status === 404) {\n        throw notFound()\n      }\n\n      throw new Error('Failed to fetch post')\n    }\n\n    const post = await res.json()\n\n    return post as PostType\n  })\n\nexport const fetchPosts = createServerFn().handler(async () => {\n  console.info('Fetching posts...')\n  const res = await fetch('https://jsonplaceholder.typicode.com/posts')\n  if (!res.ok) {\n    throw new Error('Failed to fetch posts')\n  }\n\n  const posts = await res.json()\n\n  return (posts as Array<PostType>).slice(0, 10)\n})\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { cloudflare } from '@cloudflare/vite-plugin'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tailwindcss(),\n    cloudflare({ viteEnvironment: { name: 'ssr' } }),\n    tanstackStart(),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/worker-configuration.d.ts",
    "content": "/* eslint-disable */\n// Generated by Wrangler by running `wrangler types` (hash: b11df627d8b3c51b1bf3230a546b0f20)\n// Runtime types generated with workerd@1.20260317.1 2025-09-24 nodejs_compat\ndeclare namespace Cloudflare {\n\tinterface Env {\n\t\tMY_VAR: \"Hello from Cloudflare\";\n\t}\n}\ninterface Env extends Cloudflare.Env {}\ntype StringifyValues<EnvType extends Record<string, unknown>> = {\n\t[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;\n};\ndeclare namespace NodeJS {\n\tinterface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, \"MY_VAR\">> {}\n}\n\n// Begin runtime types\n/*! *****************************************************************************\nCopyright (c) Cloudflare. All rights reserved.\nCopyright (c) Microsoft Corporation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n/* eslint-disable */\n// noinspection JSUnusedGlobalSymbols\ndeclare var onmessage: never;\n/**\n * The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)\n */\ndeclare class DOMException extends Error {\n    constructor(message?: string, name?: string);\n    /**\n     * The **`message`** read-only property of the a message or description associated with the given error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)\n     */\n    readonly message: string;\n    /**\n     * The **`name`** read-only property of the one of the strings associated with an error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)\n     */\n    readonly name: string;\n    /**\n     * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)\n     */\n    readonly code: number;\n    static readonly INDEX_SIZE_ERR: number;\n    static readonly DOMSTRING_SIZE_ERR: number;\n    static readonly HIERARCHY_REQUEST_ERR: number;\n    static readonly WRONG_DOCUMENT_ERR: number;\n    static readonly INVALID_CHARACTER_ERR: number;\n    static readonly NO_DATA_ALLOWED_ERR: number;\n    static readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    static readonly NOT_FOUND_ERR: number;\n    static readonly NOT_SUPPORTED_ERR: number;\n    static readonly INUSE_ATTRIBUTE_ERR: number;\n    static readonly INVALID_STATE_ERR: number;\n    static readonly SYNTAX_ERR: number;\n    static readonly INVALID_MODIFICATION_ERR: number;\n    static readonly NAMESPACE_ERR: number;\n    static readonly INVALID_ACCESS_ERR: number;\n    static readonly VALIDATION_ERR: number;\n    static readonly TYPE_MISMATCH_ERR: number;\n    static readonly SECURITY_ERR: number;\n    static readonly NETWORK_ERR: number;\n    static readonly ABORT_ERR: number;\n    static readonly URL_MISMATCH_ERR: number;\n    static readonly QUOTA_EXCEEDED_ERR: number;\n    static readonly TIMEOUT_ERR: number;\n    static readonly INVALID_NODE_TYPE_ERR: number;\n    static readonly DATA_CLONE_ERR: number;\n    get stack(): any;\n    set stack(value: any);\n}\ntype WorkerGlobalScopeEventMap = {\n    fetch: FetchEvent;\n    scheduled: ScheduledEvent;\n    queue: QueueEvent;\n    unhandledrejection: PromiseRejectionEvent;\n    rejectionhandled: PromiseRejectionEvent;\n};\ndeclare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {\n    EventTarget: typeof EventTarget;\n}\n/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *\n * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)\n */\ninterface Console {\n    \"assert\"(condition?: boolean, ...data: any[]): void;\n    /**\n     * The **`console.clear()`** static method clears the console if possible.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)\n     */\n    clear(): void;\n    /**\n     * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)\n     */\n    count(label?: string): void;\n    /**\n     * The **`console.countReset()`** static method resets counter used with console/count_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)\n     */\n    countReset(label?: string): void;\n    /**\n     * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)\n     */\n    debug(...data: any[]): void;\n    /**\n     * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)\n     */\n    dir(item?: any, options?: any): void;\n    /**\n     * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)\n     */\n    dirxml(...data: any[]): void;\n    /**\n     * The **`console.error()`** static method outputs a message to the console at the 'error' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)\n     */\n    error(...data: any[]): void;\n    /**\n     * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)\n     */\n    group(...data: any[]): void;\n    /**\n     * The **`console.groupCollapsed()`** static method creates a new inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)\n     */\n    groupCollapsed(...data: any[]): void;\n    /**\n     * The **`console.groupEnd()`** static method exits the current inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)\n     */\n    groupEnd(): void;\n    /**\n     * The **`console.info()`** static method outputs a message to the console at the 'info' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)\n     */\n    info(...data: any[]): void;\n    /**\n     * The **`console.log()`** static method outputs a message to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)\n     */\n    log(...data: any[]): void;\n    /**\n     * The **`console.table()`** static method displays tabular data as a table.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)\n     */\n    table(tabularData?: any, properties?: string[]): void;\n    /**\n     * The **`console.time()`** static method starts a timer you can use to track how long an operation takes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)\n     */\n    time(label?: string): void;\n    /**\n     * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)\n     */\n    timeEnd(label?: string): void;\n    /**\n     * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)\n     */\n    timeLog(label?: string, ...data: any[]): void;\n    timeStamp(label?: string): void;\n    /**\n     * The **`console.trace()`** static method outputs a stack trace to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)\n     */\n    trace(...data: any[]): void;\n    /**\n     * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)\n     */\n    warn(...data: any[]): void;\n}\ndeclare const console: Console;\ntype BufferSource = ArrayBufferView | ArrayBuffer;\ntype TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;\ndeclare namespace WebAssembly {\n    class CompileError extends Error {\n        constructor(message?: string);\n    }\n    class RuntimeError extends Error {\n        constructor(message?: string);\n    }\n    type ValueType = \"anyfunc\" | \"externref\" | \"f32\" | \"f64\" | \"i32\" | \"i64\" | \"v128\";\n    interface GlobalDescriptor {\n        value: ValueType;\n        mutable?: boolean;\n    }\n    class Global {\n        constructor(descriptor: GlobalDescriptor, value?: any);\n        value: any;\n        valueOf(): any;\n    }\n    type ImportValue = ExportValue | number;\n    type ModuleImports = Record<string, ImportValue>;\n    type Imports = Record<string, ModuleImports>;\n    type ExportValue = Function | Global | Memory | Table;\n    type Exports = Record<string, ExportValue>;\n    class Instance {\n        constructor(module: Module, imports?: Imports);\n        readonly exports: Exports;\n    }\n    interface MemoryDescriptor {\n        initial: number;\n        maximum?: number;\n        shared?: boolean;\n    }\n    class Memory {\n        constructor(descriptor: MemoryDescriptor);\n        readonly buffer: ArrayBuffer;\n        grow(delta: number): number;\n    }\n    type ImportExportKind = \"function\" | \"global\" | \"memory\" | \"table\";\n    interface ModuleExportDescriptor {\n        kind: ImportExportKind;\n        name: string;\n    }\n    interface ModuleImportDescriptor {\n        kind: ImportExportKind;\n        module: string;\n        name: string;\n    }\n    abstract class Module {\n        static customSections(module: Module, sectionName: string): ArrayBuffer[];\n        static exports(module: Module): ModuleExportDescriptor[];\n        static imports(module: Module): ModuleImportDescriptor[];\n    }\n    type TableKind = \"anyfunc\" | \"externref\";\n    interface TableDescriptor {\n        element: TableKind;\n        initial: number;\n        maximum?: number;\n    }\n    class Table {\n        constructor(descriptor: TableDescriptor, value?: any);\n        readonly length: number;\n        get(index: number): any;\n        grow(delta: number, value?: any): number;\n        set(index: number, value?: any): void;\n    }\n    function instantiate(module: Module, imports?: Imports): Promise<Instance>;\n    function validate(bytes: BufferSource): boolean;\n}\n/**\n * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)\n */\ninterface ServiceWorkerGlobalScope extends WorkerGlobalScope {\n    DOMException: typeof DOMException;\n    WorkerGlobalScope: typeof WorkerGlobalScope;\n    btoa(data: string): string;\n    atob(data: string): string;\n    setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n    setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearTimeout(timeoutId: number | null): void;\n    setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n    setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearInterval(timeoutId: number | null): void;\n    queueMicrotask(task: Function): void;\n    structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n    reportError(error: any): void;\n    fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\n    self: ServiceWorkerGlobalScope;\n    crypto: Crypto;\n    caches: CacheStorage;\n    scheduler: Scheduler;\n    performance: Performance;\n    Cloudflare: Cloudflare;\n    readonly origin: string;\n    Event: typeof Event;\n    ExtendableEvent: typeof ExtendableEvent;\n    CustomEvent: typeof CustomEvent;\n    PromiseRejectionEvent: typeof PromiseRejectionEvent;\n    FetchEvent: typeof FetchEvent;\n    TailEvent: typeof TailEvent;\n    TraceEvent: typeof TailEvent;\n    ScheduledEvent: typeof ScheduledEvent;\n    MessageEvent: typeof MessageEvent;\n    CloseEvent: typeof CloseEvent;\n    ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;\n    ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;\n    ReadableStream: typeof ReadableStream;\n    WritableStream: typeof WritableStream;\n    WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;\n    TransformStream: typeof TransformStream;\n    ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;\n    CountQueuingStrategy: typeof CountQueuingStrategy;\n    ErrorEvent: typeof ErrorEvent;\n    MessageChannel: typeof MessageChannel;\n    MessagePort: typeof MessagePort;\n    EventSource: typeof EventSource;\n    ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;\n    ReadableStreamDefaultController: typeof ReadableStreamDefaultController;\n    ReadableByteStreamController: typeof ReadableByteStreamController;\n    WritableStreamDefaultController: typeof WritableStreamDefaultController;\n    TransformStreamDefaultController: typeof TransformStreamDefaultController;\n    CompressionStream: typeof CompressionStream;\n    DecompressionStream: typeof DecompressionStream;\n    TextEncoderStream: typeof TextEncoderStream;\n    TextDecoderStream: typeof TextDecoderStream;\n    Headers: typeof Headers;\n    Body: typeof Body;\n    Request: typeof Request;\n    Response: typeof Response;\n    WebSocket: typeof WebSocket;\n    WebSocketPair: typeof WebSocketPair;\n    WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;\n    AbortController: typeof AbortController;\n    AbortSignal: typeof AbortSignal;\n    TextDecoder: typeof TextDecoder;\n    TextEncoder: typeof TextEncoder;\n    navigator: Navigator;\n    Navigator: typeof Navigator;\n    URL: typeof URL;\n    URLSearchParams: typeof URLSearchParams;\n    URLPattern: typeof URLPattern;\n    Blob: typeof Blob;\n    File: typeof File;\n    FormData: typeof FormData;\n    Crypto: typeof Crypto;\n    SubtleCrypto: typeof SubtleCrypto;\n    CryptoKey: typeof CryptoKey;\n    CacheStorage: typeof CacheStorage;\n    Cache: typeof Cache;\n    FixedLengthStream: typeof FixedLengthStream;\n    IdentityTransformStream: typeof IdentityTransformStream;\n    HTMLRewriter: typeof HTMLRewriter;\n}\ndeclare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\ndeclare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n/**\n * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n */\ndeclare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */\ndeclare function btoa(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */\ndeclare function atob(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */\ndeclare function clearTimeout(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */\ndeclare function clearInterval(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */\ndeclare function queueMicrotask(task: Function): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */\ndeclare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */\ndeclare function reportError(error: any): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */\ndeclare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\ndeclare const self: ServiceWorkerGlobalScope;\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare const crypto: Crypto;\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare const caches: CacheStorage;\ndeclare const scheduler: Scheduler;\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare const performance: Performance;\ndeclare const Cloudflare: Cloudflare;\ndeclare const origin: string;\ndeclare const navigator: Navigator;\ninterface TestController {\n}\ninterface ExecutionContext<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    passThroughOnException(): void;\n    readonly props: Props;\n}\ntype ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;\ntype ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\ntype ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ninterface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {\n    fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;\n    tail?: ExportedHandlerTailHandler<Env, Props>;\n    trace?: ExportedHandlerTraceHandler<Env, Props>;\n    tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;\n    scheduled?: ExportedHandlerScheduledHandler<Env, Props>;\n    test?: ExportedHandlerTestHandler<Env, Props>;\n    email?: EmailExportedHandler<Env, Props>;\n    queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;\n}\ninterface StructuredSerializeOptions {\n    transfer?: any[];\n}\ndeclare abstract class Navigator {\n    sendBeacon(url: string, body?: BodyInit): boolean;\n    readonly userAgent: string;\n    readonly hardwareConcurrency: number;\n    readonly language: string;\n    readonly languages: string[];\n}\ninterface AlarmInvocationInfo {\n    readonly isRetry: boolean;\n    readonly retryCount: number;\n}\ninterface Cloudflare {\n    readonly compatibilityFlags: Record<string, boolean>;\n}\ninterface DurableObject {\n    fetch(request: Request): Response | Promise<Response>;\n    alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n    webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n    webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n    webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n}\ntype DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, \"alarm\" | \"webSocketMessage\" | \"webSocketClose\" | \"webSocketError\"> & {\n    readonly id: DurableObjectId;\n    readonly name?: string;\n};\ninterface DurableObjectId {\n    toString(): string;\n    equals(other: DurableObjectId): boolean;\n    readonly name?: string;\n}\ndeclare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {\n    newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;\n    idFromName(name: string): DurableObjectId;\n    idFromString(id: string): DurableObjectId;\n    get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;\n}\ntype DurableObjectJurisdiction = \"eu\" | \"fedramp\" | \"fedramp-high\";\ninterface DurableObjectNamespaceNewUniqueIdOptions {\n    jurisdiction?: DurableObjectJurisdiction;\n}\ntype DurableObjectLocationHint = \"wnam\" | \"enam\" | \"sam\" | \"weur\" | \"eeur\" | \"apac\" | \"oc\" | \"afr\" | \"me\";\ntype DurableObjectRoutingMode = \"primary-only\";\ninterface DurableObjectNamespaceGetDurableObjectOptions {\n    locationHint?: DurableObjectLocationHint;\n    routingMode?: DurableObjectRoutingMode;\n}\ninterface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {\n}\ninterface DurableObjectState<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    readonly props: Props;\n    readonly id: DurableObjectId;\n    readonly storage: DurableObjectStorage;\n    container?: Container;\n    blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;\n    acceptWebSocket(ws: WebSocket, tags?: string[]): void;\n    getWebSockets(tag?: string): WebSocket[];\n    setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;\n    getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;\n    getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;\n    setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;\n    getHibernatableWebSocketEventTimeout(): number | null;\n    getTags(ws: WebSocket): string[];\n    abort(reason?: string): void;\n}\ninterface DurableObjectTransaction {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    rollback(): void;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n}\ninterface DurableObjectStorage {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    deleteAll(options?: DurableObjectPutOptions): Promise<void>;\n    transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n    sync(): Promise<void>;\n    sql: SqlStorage;\n    kv: SyncKvStorage;\n    transactionSync<T>(closure: () => T): T;\n    getCurrentBookmark(): Promise<string>;\n    getBookmarkForTime(timestamp: number | Date): Promise<string>;\n    onNextSessionRestoreBookmark(bookmark: string): Promise<string>;\n}\ninterface DurableObjectListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetOptions {\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetAlarmOptions {\n    allowConcurrency?: boolean;\n}\ninterface DurableObjectPutOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectSetAlarmOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n}\ndeclare class WebSocketRequestResponsePair {\n    constructor(request: string, response: string);\n    get request(): string;\n    get response(): string;\n}\ninterface AnalyticsEngineDataset {\n    writeDataPoint(event?: AnalyticsEngineDataPoint): void;\n}\ninterface AnalyticsEngineDataPoint {\n    indexes?: ((ArrayBuffer | string) | null)[];\n    doubles?: number[];\n    blobs?: ((ArrayBuffer | string) | null)[];\n}\n/**\n * The **`Event`** interface represents an event which takes place on an `EventTarget`.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)\n */\ndeclare class Event {\n    constructor(type: string, init?: EventInit);\n    /**\n     * The **`type`** read-only property of the Event interface returns a string containing the event's type.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)\n     */\n    get type(): string;\n    /**\n     * The **`eventPhase`** read-only property of the being evaluated.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)\n     */\n    get eventPhase(): number;\n    /**\n     * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)\n     */\n    get composed(): boolean;\n    /**\n     * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)\n     */\n    get bubbles(): boolean;\n    /**\n     * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)\n     */\n    get cancelable(): boolean;\n    /**\n     * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)\n     */\n    get defaultPrevented(): boolean;\n    /**\n     * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)\n     */\n    get returnValue(): boolean;\n    /**\n     * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)\n     */\n    get currentTarget(): EventTarget | undefined;\n    /**\n     * The read-only **`target`** property of the dispatched.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)\n     */\n    get target(): EventTarget | undefined;\n    /**\n     * The deprecated **`Event.srcElement`** is an alias for the Event.target property.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)\n     */\n    get srcElement(): EventTarget | undefined;\n    /**\n     * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)\n     */\n    get timeStamp(): number;\n    /**\n     * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)\n     */\n    get isTrusted(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    get cancelBubble(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    set cancelBubble(value: boolean);\n    /**\n     * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)\n     */\n    stopImmediatePropagation(): void;\n    /**\n     * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)\n     */\n    preventDefault(): void;\n    /**\n     * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)\n     */\n    stopPropagation(): void;\n    /**\n     * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)\n     */\n    composedPath(): EventTarget[];\n    static readonly NONE: number;\n    static readonly CAPTURING_PHASE: number;\n    static readonly AT_TARGET: number;\n    static readonly BUBBLING_PHASE: number;\n}\ninterface EventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n}\ntype EventListener<EventType extends Event = Event> = (event: EventType) => void;\ninterface EventListenerObject<EventType extends Event = Event> {\n    handleEvent(event: EventType): void;\n}\ntype EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;\n/**\n * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)\n */\ndeclare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {\n    constructor();\n    /**\n     * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)\n     */\n    addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\n    /**\n     * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)\n     */\n    removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n    /**\n     * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n     */\n    dispatchEvent(event: EventMap[keyof EventMap]): boolean;\n}\ninterface EventTargetEventListenerOptions {\n    capture?: boolean;\n}\ninterface EventTargetAddEventListenerOptions {\n    capture?: boolean;\n    passive?: boolean;\n    once?: boolean;\n    signal?: AbortSignal;\n}\ninterface EventTargetHandlerObject {\n    handleEvent: (event: Event) => any | undefined;\n}\n/**\n * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)\n */\ndeclare class AbortController {\n    constructor();\n    /**\n     * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)\n     */\n    abort(reason?: any): void;\n}\n/**\n * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)\n */\ndeclare abstract class AbortSignal extends EventTarget {\n    /**\n     * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)\n     */\n    static abort(reason?: any): AbortSignal;\n    /**\n     * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)\n     */\n    static timeout(delay: number): AbortSignal;\n    /**\n     * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)\n     */\n    static any(signals: AbortSignal[]): AbortSignal;\n    /**\n     * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)\n     */\n    get aborted(): boolean;\n    /**\n     * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)\n     */\n    get reason(): any;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    get onabort(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    set onabort(value: any | null);\n    /**\n     * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)\n     */\n    throwIfAborted(): void;\n}\ninterface Scheduler {\n    wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;\n}\ninterface SchedulerWaitOptions {\n    signal?: AbortSignal;\n}\n/**\n * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)\n */\ndeclare abstract class ExtendableEvent extends Event {\n    /**\n     * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)\n     */\n    waitUntil(promise: Promise<any>): void;\n}\n/**\n * The **`CustomEvent`** interface represents events initialized by an application for any purpose.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)\n */\ndeclare class CustomEvent<T = any> extends Event {\n    constructor(type: string, init?: CustomEventCustomEventInit);\n    /**\n     * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)\n     */\n    get detail(): T;\n}\ninterface CustomEventCustomEventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n    detail?: any;\n}\n/**\n * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)\n */\ndeclare class Blob {\n    constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);\n    /**\n     * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)\n     */\n    get size(): number;\n    /**\n     * The **`type`** read-only property of the Blob interface returns the MIME type of the file.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)\n     */\n    get type(): string;\n    /**\n     * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)\n     */\n    slice(start?: number, end?: number, type?: string): Blob;\n    /**\n     * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)\n     */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /**\n     * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)\n     */\n    bytes(): Promise<Uint8Array>;\n    /**\n     * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)\n     */\n    text(): Promise<string>;\n    /**\n     * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)\n     */\n    stream(): ReadableStream;\n}\ninterface BlobOptions {\n    type?: string;\n}\n/**\n * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)\n */\ndeclare class File extends Blob {\n    constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);\n    /**\n     * The **`name`** read-only property of the File interface returns the name of the file represented by a File object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)\n     */\n    get name(): string;\n    /**\n     * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)\n     */\n    get lastModified(): number;\n}\ninterface FileOptions {\n    type?: string;\n    lastModified?: number;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class CacheStorage {\n    /**\n     * The **`open()`** method of the the Cache object matching the `cacheName`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)\n     */\n    open(cacheName: string): Promise<Cache>;\n    readonly default: Cache;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class Cache {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */\n    delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */\n    match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */\n    put(request: RequestInfo | URL, response: Response): Promise<void>;\n}\ninterface CacheQueryOptions {\n    ignoreMethod?: boolean;\n}\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare abstract class Crypto {\n    /**\n     * The **`Crypto.subtle`** read-only property returns a cryptographic operations.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)\n     */\n    get subtle(): SubtleCrypto;\n    /**\n     * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)\n     */\n    getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;\n    /**\n     * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)\n     */\n    randomUUID(): string;\n    DigestStream: typeof DigestStream;\n}\n/**\n * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)\n */\ndeclare abstract class SubtleCrypto {\n    /**\n     * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)\n     */\n    encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)\n     */\n    decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)\n     */\n    sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)\n     */\n    verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;\n    /**\n     * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)\n     */\n    digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)\n     */\n    generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;\n    /**\n     * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)\n     */\n    deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`deriveBits()`** method of the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)\n     */\n    deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;\n    /**\n     * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)\n     */\n    importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)\n     */\n    exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;\n    /**\n     * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)\n     */\n    wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;\n    /**\n     * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)\n     */\n    unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;\n}\n/**\n * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)\n */\ndeclare abstract class CryptoKey {\n    /**\n     * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)\n     */\n    readonly type: string;\n    /**\n     * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)\n     */\n    readonly extractable: boolean;\n    /**\n     * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)\n     */\n    readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;\n    /**\n     * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)\n     */\n    readonly usages: string[];\n}\ninterface CryptoKeyPair {\n    publicKey: CryptoKey;\n    privateKey: CryptoKey;\n}\ninterface JsonWebKey {\n    kty: string;\n    use?: string;\n    key_ops?: string[];\n    alg?: string;\n    ext?: boolean;\n    crv?: string;\n    x?: string;\n    y?: string;\n    d?: string;\n    n?: string;\n    e?: string;\n    p?: string;\n    q?: string;\n    dp?: string;\n    dq?: string;\n    qi?: string;\n    oth?: RsaOtherPrimesInfo[];\n    k?: string;\n}\ninterface RsaOtherPrimesInfo {\n    r?: string;\n    d?: string;\n    t?: string;\n}\ninterface SubtleCryptoDeriveKeyAlgorithm {\n    name: string;\n    salt?: (ArrayBuffer | ArrayBufferView);\n    iterations?: number;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    $public?: CryptoKey;\n    info?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoEncryptAlgorithm {\n    name: string;\n    iv?: (ArrayBuffer | ArrayBufferView);\n    additionalData?: (ArrayBuffer | ArrayBufferView);\n    tagLength?: number;\n    counter?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    label?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoGenerateKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    modulusLength?: number;\n    publicExponent?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    namedCurve?: string;\n}\ninterface SubtleCryptoHashAlgorithm {\n    name: string;\n}\ninterface SubtleCryptoImportKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    length?: number;\n    namedCurve?: string;\n    compressed?: boolean;\n}\ninterface SubtleCryptoSignAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    dataLength?: number;\n    saltLength?: number;\n}\ninterface CryptoKeyKeyAlgorithm {\n    name: string;\n}\ninterface CryptoKeyAesKeyAlgorithm {\n    name: string;\n    length: number;\n}\ninterface CryptoKeyHmacKeyAlgorithm {\n    name: string;\n    hash: CryptoKeyKeyAlgorithm;\n    length: number;\n}\ninterface CryptoKeyRsaKeyAlgorithm {\n    name: string;\n    modulusLength: number;\n    publicExponent: ArrayBuffer | ArrayBufferView;\n    hash?: CryptoKeyKeyAlgorithm;\n}\ninterface CryptoKeyEllipticKeyAlgorithm {\n    name: string;\n    namedCurve: string;\n}\ninterface CryptoKeyArbitraryKeyAlgorithm {\n    name: string;\n    hash?: CryptoKeyKeyAlgorithm;\n    namedCurve?: string;\n    length?: number;\n}\ndeclare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {\n    constructor(algorithm: string | SubtleCryptoHashAlgorithm);\n    readonly digest: Promise<ArrayBuffer>;\n    get bytesWritten(): number | bigint;\n}\n/**\n * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)\n */\ndeclare class TextDecoder {\n    constructor(label?: string, options?: TextDecoderConstructorOptions);\n    /**\n     * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)\n     */\n    decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\n/**\n * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)\n */\ndeclare class TextEncoder {\n    constructor();\n    /**\n     * The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)\n     */\n    encode(input?: string): Uint8Array;\n    /**\n     * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)\n     */\n    encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;\n    get encoding(): string;\n}\ninterface TextDecoderConstructorOptions {\n    fatal: boolean;\n    ignoreBOM: boolean;\n}\ninterface TextDecoderDecodeOptions {\n    stream: boolean;\n}\ninterface TextEncoderEncodeIntoResult {\n    read: number;\n    written: number;\n}\n/**\n * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)\n */\ndeclare class ErrorEvent extends Event {\n    constructor(type: string, init?: ErrorEventErrorEventInit);\n    /**\n     * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)\n     */\n    get filename(): string;\n    /**\n     * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)\n     */\n    get message(): string;\n    /**\n     * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)\n     */\n    get lineno(): number;\n    /**\n     * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)\n     */\n    get colno(): number;\n    /**\n     * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)\n     */\n    get error(): any;\n}\ninterface ErrorEventErrorEventInit {\n    message?: string;\n    filename?: string;\n    lineno?: number;\n    colno?: number;\n    error?: any;\n}\n/**\n * The **`MessageEvent`** interface represents a message received by a target object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)\n */\ndeclare class MessageEvent extends Event {\n    constructor(type: string, initializer: MessageEventInit);\n    /**\n     * The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)\n     */\n    readonly data: any;\n    /**\n     * The **`origin`** read-only property of the origin of the message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)\n     */\n    readonly origin: string | null;\n    /**\n     * The **`lastEventId`** read-only property of the unique ID for the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)\n     */\n    readonly lastEventId: string;\n    /**\n     * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)\n     */\n    readonly source: MessagePort | null;\n    /**\n     * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)\n     */\n    readonly ports: MessagePort[];\n}\ninterface MessageEventInit {\n    data: ArrayBuffer | string;\n}\n/**\n * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)\n */\ndeclare abstract class PromiseRejectionEvent extends Event {\n    /**\n     * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)\n     */\n    readonly promise: Promise<any>;\n    /**\n     * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)\n     */\n    readonly reason: any;\n}\n/**\n * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)\n */\ndeclare class FormData {\n    constructor();\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string | Blob): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: Blob, filename?: string): void;\n    /**\n     * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)\n     */\n    delete(name: string): void;\n    /**\n     * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)\n     */\n    get(name: string): (File | string) | null;\n    /**\n     * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)\n     */\n    getAll(name: string): (File | string)[];\n    /**\n     * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string | Blob): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: Blob, filename?: string): void;\n    /* Returns an array of key, value pairs for every entry in the list. */\n    entries(): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n    /* Returns a list of keys in the list. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the list. */\n    values(): IterableIterator<(File | string)>;\n    forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n}\ninterface ContentOptions {\n    html?: boolean;\n}\ndeclare class HTMLRewriter {\n    constructor();\n    on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;\n    onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;\n    transform(response: Response): Response;\n}\ninterface HTMLRewriterElementContentHandlers {\n    element?(element: Element): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(element: Text): void | Promise<void>;\n}\ninterface HTMLRewriterDocumentContentHandlers {\n    doctype?(doctype: Doctype): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(text: Text): void | Promise<void>;\n    end?(end: DocumentEnd): void | Promise<void>;\n}\ninterface Doctype {\n    readonly name: string | null;\n    readonly publicId: string | null;\n    readonly systemId: string | null;\n}\ninterface Element {\n    tagName: string;\n    readonly attributes: IterableIterator<string[]>;\n    readonly removed: boolean;\n    readonly namespaceURI: string;\n    getAttribute(name: string): string | null;\n    hasAttribute(name: string): boolean;\n    setAttribute(name: string, value: string): Element;\n    removeAttribute(name: string): Element;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    append(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    remove(): Element;\n    removeAndKeepContent(): Element;\n    setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;\n}\ninterface EndTag {\n    name: string;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    remove(): EndTag;\n}\ninterface Comment {\n    text: string;\n    readonly removed: boolean;\n    before(content: string, options?: ContentOptions): Comment;\n    after(content: string, options?: ContentOptions): Comment;\n    replace(content: string, options?: ContentOptions): Comment;\n    remove(): Comment;\n}\ninterface Text {\n    readonly text: string;\n    readonly lastInTextNode: boolean;\n    readonly removed: boolean;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    remove(): Text;\n}\ninterface DocumentEnd {\n    append(content: string, options?: ContentOptions): DocumentEnd;\n}\n/**\n * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)\n */\ndeclare abstract class FetchEvent extends ExtendableEvent {\n    /**\n     * The **`request`** read-only property of the the event handler.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)\n     */\n    readonly request: Request;\n    /**\n     * The **`respondWith()`** method of allows you to provide a promise for a Response yourself.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)\n     */\n    respondWith(promise: Response | Promise<Response>): void;\n    passThroughOnException(): void;\n}\ntype HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;\n/**\n * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)\n */\ndeclare class Headers {\n    constructor(init?: HeadersInit);\n    /**\n     * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)\n     */\n    get(name: string): string | null;\n    getAll(name: string): string[];\n    /**\n     * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)\n     */\n    getSetCookie(): string[];\n    /**\n     * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)\n     */\n    delete(name: string): void;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;\n    /* Returns an iterator allowing to go through all key/value pairs contained in this object. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */\n    keys(): IterableIterator<string>;\n    /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */\n    values(): IterableIterator<string>;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ntype BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;\ndeclare abstract class Body {\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */\n    get body(): ReadableStream | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */\n    get bodyUsed(): boolean;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */\n    bytes(): Promise<Uint8Array>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */\n    text(): Promise<string>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */\n    json<T>(): Promise<T>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */\n    formData(): Promise<FormData>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */\n    blob(): Promise<Blob>;\n}\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ndeclare var Response: {\n    prototype: Response;\n    new (body?: BodyInit | null, init?: ResponseInit): Response;\n    error(): Response;\n    redirect(url: string, status?: number): Response;\n    json(any: any, maybeInit?: (ResponseInit | Response)): Response;\n};\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ninterface Response extends Body {\n    /**\n     * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)\n     */\n    clone(): Response;\n    /**\n     * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)\n     */\n    status: number;\n    /**\n     * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)\n     */\n    statusText: string;\n    /**\n     * The **`headers`** read-only property of the with the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)\n     */\n    ok: boolean;\n    /**\n     * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)\n     */\n    redirected: boolean;\n    /**\n     * The **`url`** read-only property of the Response interface contains the URL of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)\n     */\n    url: string;\n    webSocket: WebSocket | null;\n    cf: any | undefined;\n    /**\n     * The **`type`** read-only property of the Response interface contains the type of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)\n     */\n    type: \"default\" | \"error\";\n}\ninterface ResponseInit {\n    status?: number;\n    statusText?: string;\n    headers?: HeadersInit;\n    cf?: any;\n    webSocket?: (WebSocket | null);\n    encodeBody?: \"automatic\" | \"manual\";\n}\ntype RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ndeclare var Request: {\n    prototype: Request;\n    new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;\n};\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ninterface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {\n    /**\n     * The **`clone()`** method of the Request interface creates a copy of the current `Request` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)\n     */\n    clone(): Request<CfHostMetadata, Cf>;\n    /**\n     * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)\n     */\n    method: string;\n    /**\n     * The **`url`** read-only property of the Request interface contains the URL of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)\n     */\n    url: string;\n    /**\n     * The **`headers`** read-only property of the with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)\n     */\n    redirect: string;\n    fetcher: Fetcher | null;\n    /**\n     * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)\n     */\n    signal: AbortSignal;\n    cf?: Cf;\n    /**\n     * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)\n     */\n    integrity: string;\n    /**\n     * The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)\n     */\n    keepalive: boolean;\n    /**\n     * The **`cache`** read-only property of the Request interface contains the cache mode of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)\n     */\n    cache?: \"no-store\" | \"no-cache\";\n}\ninterface RequestInit<Cf = CfProperties> {\n    /* A string to set request's method. */\n    method?: string;\n    /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */\n    headers?: HeadersInit;\n    /* A BodyInit object or null to set request's body. */\n    body?: BodyInit | null;\n    /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */\n    redirect?: string;\n    fetcher?: (Fetcher | null);\n    cf?: Cf;\n    /* A string indicating how the request will interact with the browser's cache to set request's cache. */\n    cache?: \"no-store\" | \"no-cache\";\n    /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */\n    integrity?: string;\n    /* An AbortSignal to set request's signal. */\n    signal?: (AbortSignal | null);\n    encodeResponseBody?: \"automatic\" | \"manual\";\n}\ntype Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;\ntype Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | \"fetch\" | \"connect\"> : unknown) & {\n    fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;\n    connect(address: SocketAddress | string, options?: SocketOptions): Socket;\n};\ninterface KVNamespaceListKey<Metadata, Key extends string = string> {\n    name: Key;\n    expiration?: number;\n    metadata?: Metadata;\n}\ntype KVNamespaceListResult<Metadata, Key extends string = string> = {\n    list_complete: false;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cursor: string;\n    cacheStatus: string | null;\n} | {\n    list_complete: true;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cacheStatus: string | null;\n};\ninterface KVNamespace<Key extends string = string> {\n    get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;\n    get(key: Key, type: \"text\"): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, type: \"json\"): Promise<ExpectedValue | null>;\n    get(key: Key, type: \"arrayBuffer\"): Promise<ArrayBuffer | null>;\n    get(key: Key, type: \"stream\"): Promise<ReadableStream | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"text\">): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<\"json\">): Promise<ExpectedValue | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<ArrayBuffer | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"stream\">): Promise<ReadableStream | null>;\n    get(key: Array<Key>, type: \"text\"): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, ExpectedValue | null>>;\n    get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;\n    get(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, ExpectedValue | null>>;\n    list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;\n    put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;\n    getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"text\"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: \"json\"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"arrayBuffer\"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"stream\"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"text\">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"json\">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"stream\">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, type: \"text\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    delete(key: Key): Promise<void>;\n}\ninterface KVNamespaceListOptions {\n    limit?: number;\n    prefix?: (string | null);\n    cursor?: (string | null);\n}\ninterface KVNamespaceGetOptions<Type> {\n    type: Type;\n    cacheTtl?: number;\n}\ninterface KVNamespacePutOptions {\n    expiration?: number;\n    expirationTtl?: number;\n    metadata?: (any | null);\n}\ninterface KVNamespaceGetWithMetadataResult<Value, Metadata> {\n    value: Value | null;\n    metadata: Metadata | null;\n    cacheStatus: string | null;\n}\ntype QueueContentType = \"text\" | \"bytes\" | \"json\" | \"v8\";\ninterface Queue<Body = unknown> {\n    send(message: Body, options?: QueueSendOptions): Promise<void>;\n    sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>;\n}\ninterface QueueSendOptions {\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueSendBatchOptions {\n    delaySeconds?: number;\n}\ninterface MessageSendRequest<Body = unknown> {\n    body: Body;\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueRetryOptions {\n    delaySeconds?: number;\n}\ninterface Message<Body = unknown> {\n    readonly id: string;\n    readonly timestamp: Date;\n    readonly body: Body;\n    readonly attempts: number;\n    retry(options?: QueueRetryOptions): void;\n    ack(): void;\n}\ninterface QueueEvent<Body = unknown> extends ExtendableEvent {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface MessageBatch<Body = unknown> {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface R2Error extends Error {\n    readonly name: string;\n    readonly code: number;\n    readonly message: string;\n    readonly action: string;\n    readonly stack: any;\n}\ninterface R2ListOptions {\n    limit?: number;\n    prefix?: string;\n    cursor?: string;\n    delimiter?: string;\n    startAfter?: string;\n    include?: (\"httpMetadata\" | \"customMetadata\")[];\n}\ndeclare abstract class R2Bucket {\n    head(key: string): Promise<R2Object | null>;\n    get(key: string, options: R2GetOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2ObjectBody | R2Object | null>;\n    get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2Object | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;\n    createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;\n    resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;\n    delete(keys: string | string[]): Promise<void>;\n    list(options?: R2ListOptions): Promise<R2Objects>;\n}\ninterface R2MultipartUpload {\n    readonly key: string;\n    readonly uploadId: string;\n    uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;\n    abort(): Promise<void>;\n    complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;\n}\ninterface R2UploadedPart {\n    partNumber: number;\n    etag: string;\n}\ndeclare abstract class R2Object {\n    readonly key: string;\n    readonly version: string;\n    readonly size: number;\n    readonly etag: string;\n    readonly httpEtag: string;\n    readonly checksums: R2Checksums;\n    readonly uploaded: Date;\n    readonly httpMetadata?: R2HTTPMetadata;\n    readonly customMetadata?: Record<string, string>;\n    readonly range?: R2Range;\n    readonly storageClass: string;\n    readonly ssecKeyMd5?: string;\n    writeHttpMetadata(headers: Headers): void;\n}\ninterface R2ObjectBody extends R2Object {\n    get body(): ReadableStream;\n    get bodyUsed(): boolean;\n    arrayBuffer(): Promise<ArrayBuffer>;\n    bytes(): Promise<Uint8Array>;\n    text(): Promise<string>;\n    json<T>(): Promise<T>;\n    blob(): Promise<Blob>;\n}\ntype R2Range = {\n    offset: number;\n    length?: number;\n} | {\n    offset?: number;\n    length: number;\n} | {\n    suffix: number;\n};\ninterface R2Conditional {\n    etagMatches?: string;\n    etagDoesNotMatch?: string;\n    uploadedBefore?: Date;\n    uploadedAfter?: Date;\n    secondsGranularity?: boolean;\n}\ninterface R2GetOptions {\n    onlyIf?: (R2Conditional | Headers);\n    range?: (R2Range | Headers);\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2PutOptions {\n    onlyIf?: (R2Conditional | Headers);\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    md5?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha1?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha256?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha384?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha512?: ((ArrayBuffer | ArrayBufferView) | string);\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2MultipartOptions {\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2Checksums {\n    readonly md5?: ArrayBuffer;\n    readonly sha1?: ArrayBuffer;\n    readonly sha256?: ArrayBuffer;\n    readonly sha384?: ArrayBuffer;\n    readonly sha512?: ArrayBuffer;\n    toJSON(): R2StringChecksums;\n}\ninterface R2StringChecksums {\n    md5?: string;\n    sha1?: string;\n    sha256?: string;\n    sha384?: string;\n    sha512?: string;\n}\ninterface R2HTTPMetadata {\n    contentType?: string;\n    contentLanguage?: string;\n    contentDisposition?: string;\n    contentEncoding?: string;\n    cacheControl?: string;\n    cacheExpiry?: Date;\n}\ntype R2Objects = {\n    objects: R2Object[];\n    delimitedPrefixes: string[];\n} & ({\n    truncated: true;\n    cursor: string;\n} | {\n    truncated: false;\n});\ninterface R2UploadPartOptions {\n    ssecKey?: (ArrayBuffer | string);\n}\ndeclare abstract class ScheduledEvent extends ExtendableEvent {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface ScheduledController {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface QueuingStrategy<T = any> {\n    highWaterMark?: (number | bigint);\n    size?: (chunk: T) => number | bigint;\n}\ninterface UnderlyingSink<W = any> {\n    type?: string;\n    start?: (controller: WritableStreamDefaultController) => void | Promise<void>;\n    write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;\n    abort?: (reason: any) => void | Promise<void>;\n    close?: () => void | Promise<void>;\n}\ninterface UnderlyingByteSource {\n    type: \"bytes\";\n    autoAllocateChunkSize?: number;\n    start?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    pull?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n}\ninterface UnderlyingSource<R = any> {\n    type?: \"\" | undefined;\n    start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: (number | bigint);\n}\ninterface Transformer<I = any, O = any> {\n    readableType?: string;\n    writableType?: string;\n    start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: number;\n}\ninterface StreamPipeOptions {\n    preventAbort?: boolean;\n    preventCancel?: boolean;\n    /**\n     * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     *\n     * Errors and closures of the source and destination streams propagate as follows:\n     *\n     * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.\n     *\n     * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.\n     *\n     * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.\n     *\n     * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.\n     *\n     * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.\n     */\n    preventClose?: boolean;\n    signal?: AbortSignal;\n}\ntype ReadableStreamReadResult<R = any> = {\n    done: false;\n    value: R;\n} | {\n    done: true;\n    value?: undefined;\n};\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ninterface ReadableStream<R = any> {\n    /**\n     * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)\n     */\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(): ReadableStreamDefaultReader<R>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;\n    /**\n     * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)\n     */\n    pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;\n    /**\n     * The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)\n     */\n    pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;\n    /**\n     * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)\n     */\n    tee(): [\n        ReadableStream<R>,\n        ReadableStream<R>\n    ];\n    values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n    [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n}\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ndeclare const ReadableStream: {\n    prototype: ReadableStream;\n    new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;\n    new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;\n};\n/**\n * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)\n */\ndeclare class ReadableStreamDefaultReader<R = any> {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)\n     */\n    read(): Promise<ReadableStreamReadResult<R>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)\n */\ndeclare class ReadableStreamBYOBReader {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)\n     */\n    read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)\n     */\n    releaseLock(): void;\n    readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;\n}\ninterface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {\n    min?: number;\n}\ninterface ReadableStreamGetReaderOptions {\n    /**\n     * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.\n     *\n     * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.\n     */\n    mode: \"byob\";\n}\n/**\n * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)\n */\ndeclare abstract class ReadableStreamBYOBRequest {\n    /**\n     * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)\n     */\n    get view(): Uint8Array | null;\n    /**\n     * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)\n     */\n    respond(bytesWritten: number): void;\n    /**\n     * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)\n     */\n    respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;\n    get atLeast(): number | null;\n}\n/**\n * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)\n */\ndeclare abstract class ReadableStreamDefaultController<R = any> {\n    /**\n     * The **`desiredSize`** read-only property of the required to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: R): void;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)\n */\ndeclare abstract class ReadableByteStreamController {\n    /**\n     * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)\n     */\n    get byobRequest(): ReadableStreamBYOBRequest | null;\n    /**\n     * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)\n     */\n    enqueue(chunk: ArrayBuffer | ArrayBufferView): void;\n    /**\n     * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)\n */\ndeclare abstract class WritableStreamDefaultController {\n    /**\n     * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)\n     */\n    error(reason?: any): void;\n}\n/**\n * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)\n */\ndeclare abstract class TransformStreamDefaultController<O = any> {\n    /**\n     * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: O): void;\n    /**\n     * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)\n     */\n    error(reason: any): void;\n    /**\n     * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)\n     */\n    terminate(): void;\n}\ninterface ReadableWritablePair<R = any, W = any> {\n    readable: ReadableStream<R>;\n    /**\n     * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     */\n    writable: WritableStream<W>;\n}\n/**\n * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)\n */\ndeclare class WritableStream<W = any> {\n    constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);\n    /**\n     * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the WritableStream interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)\n     */\n    getWriter(): WritableStreamDefaultWriter<W>;\n}\n/**\n * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)\n */\ndeclare class WritableStreamDefaultWriter<W = any> {\n    constructor(stream: WritableStream);\n    /**\n     * The **`closed`** read-only property of the the stream errors or the writer's lock is released.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)\n     */\n    get closed(): Promise<void>;\n    /**\n     * The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)\n     */\n    get ready(): Promise<void>;\n    /**\n     * The **`desiredSize`** read-only property of the to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`write()`** method of the operation.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)\n     */\n    write(chunk?: W): Promise<void>;\n    /**\n     * The **`releaseLock()`** method of the corresponding stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)\n */\ndeclare class TransformStream<I = any, O = any> {\n    constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);\n    /**\n     * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)\n     */\n    get readable(): ReadableStream<O>;\n    /**\n     * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)\n     */\n    get writable(): WritableStream<I>;\n}\ndeclare class FixedLengthStream extends IdentityTransformStream {\n    constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ndeclare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ninterface IdentityTransformStreamQueuingStrategy {\n    highWaterMark?: (number | bigint);\n}\ninterface ReadableStreamValuesOptions {\n    preventCancel?: boolean;\n}\n/**\n * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)\n */\ndeclare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)\n */\ndeclare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)\n */\ndeclare class TextEncoderStream extends TransformStream<string, Uint8Array> {\n    constructor();\n    get encoding(): string;\n}\n/**\n * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)\n */\ndeclare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {\n    constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\ninterface TextDecoderStreamTextDecoderStreamInit {\n    fatal?: boolean;\n    ignoreBOM?: boolean;\n}\n/**\n * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)\n */\ndeclare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\n/**\n * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)\n */\ndeclare class CountQueuingStrategy implements QueuingStrategy {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\ninterface QueuingStrategyInit {\n    /**\n     * Creates a new ByteLengthQueuingStrategy with the provided high water mark.\n     *\n     * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.\n     */\n    highWaterMark: number;\n}\ninterface ScriptVersion {\n    id?: string;\n    tag?: string;\n    message?: string;\n}\ndeclare abstract class TailEvent extends ExtendableEvent {\n    readonly events: TraceItem[];\n    readonly traces: TraceItem[];\n}\ninterface TraceItem {\n    readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;\n    readonly eventTimestamp: number | null;\n    readonly logs: TraceLog[];\n    readonly exceptions: TraceException[];\n    readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];\n    readonly scriptName: string | null;\n    readonly entrypoint?: string;\n    readonly scriptVersion?: ScriptVersion;\n    readonly dispatchNamespace?: string;\n    readonly scriptTags?: string[];\n    readonly durableObjectId?: string;\n    readonly outcome: string;\n    readonly executionModel: string;\n    readonly truncated: boolean;\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface TraceItemAlarmEventInfo {\n    readonly scheduledTime: Date;\n}\ninterface TraceItemCustomEventInfo {\n}\ninterface TraceItemScheduledEventInfo {\n    readonly scheduledTime: number;\n    readonly cron: string;\n}\ninterface TraceItemQueueEventInfo {\n    readonly queue: string;\n    readonly batchSize: number;\n}\ninterface TraceItemEmailEventInfo {\n    readonly mailFrom: string;\n    readonly rcptTo: string;\n    readonly rawSize: number;\n}\ninterface TraceItemTailEventInfo {\n    readonly consumedEvents: TraceItemTailEventInfoTailItem[];\n}\ninterface TraceItemTailEventInfoTailItem {\n    readonly scriptName: string | null;\n}\ninterface TraceItemFetchEventInfo {\n    readonly response?: TraceItemFetchEventInfoResponse;\n    readonly request: TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoRequest {\n    readonly cf?: any;\n    readonly headers: Record<string, string>;\n    readonly method: string;\n    readonly url: string;\n    getUnredacted(): TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoResponse {\n    readonly status: number;\n}\ninterface TraceItemJsRpcEventInfo {\n    readonly rpcMethod: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfo {\n    readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;\n}\ninterface TraceItemHibernatableWebSocketEventInfoMessage {\n    readonly webSocketEventType: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfoClose {\n    readonly webSocketEventType: string;\n    readonly code: number;\n    readonly wasClean: boolean;\n}\ninterface TraceItemHibernatableWebSocketEventInfoError {\n    readonly webSocketEventType: string;\n}\ninterface TraceLog {\n    readonly timestamp: number;\n    readonly level: string;\n    readonly message: any;\n}\ninterface TraceException {\n    readonly timestamp: number;\n    readonly message: string;\n    readonly name: string;\n    readonly stack?: string;\n}\ninterface TraceDiagnosticChannelEvent {\n    readonly timestamp: number;\n    readonly channel: string;\n    readonly message: any;\n}\ninterface TraceMetrics {\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface UnsafeTraceMetrics {\n    fromTrace(item: TraceItem): TraceMetrics;\n}\n/**\n * The **`URL`** interface is used to parse, construct, normalize, and encode URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)\n */\ndeclare class URL {\n    constructor(url: string | URL, base?: string | URL);\n    /**\n     * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)\n     */\n    get origin(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    get href(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    set href(value: string);\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    get protocol(): string;\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    set protocol(value: string);\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    get username(): string;\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    set username(value: string);\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    get password(): string;\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    set password(value: string);\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    get host(): string;\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    set host(value: string);\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    get hostname(): string;\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    set hostname(value: string);\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    get port(): string;\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    set port(value: string);\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    get pathname(): string;\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    set pathname(value: string);\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    get search(): string;\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    set search(value: string);\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    get hash(): string;\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    set hash(value: string);\n    /**\n     * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)\n     */\n    get searchParams(): URLSearchParams;\n    /**\n     * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)\n     */\n    toJSON(): string;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    /**\n     * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)\n     */\n    static canParse(url: string, base?: string): boolean;\n    /**\n     * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)\n     */\n    static parse(url: string, base?: string): URL | null;\n    /**\n     * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)\n     */\n    static createObjectURL(object: File | Blob): string;\n    /**\n     * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)\n     */\n    static revokeObjectURL(object_url: string): void;\n}\n/**\n * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)\n */\ndeclare class URLSearchParams {\n    constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));\n    /**\n     * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)\n     */\n    get size(): number;\n    /**\n     * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)\n     */\n    delete(name: string, value?: string): void;\n    /**\n     * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)\n     */\n    get(name: string): string | null;\n    /**\n     * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)\n     */\n    getAll(name: string): string[];\n    /**\n     * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)\n     */\n    has(name: string, value?: string): boolean;\n    /**\n     * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)\n     */\n    sort(): void;\n    /* Returns an array of key, value pairs for every entry in the search params. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns a list of keys in the search params. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the search params. */\n    values(): IterableIterator<string>;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ndeclare class URLPattern {\n    constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);\n    get protocol(): string;\n    get username(): string;\n    get password(): string;\n    get hostname(): string;\n    get port(): string;\n    get pathname(): string;\n    get search(): string;\n    get hash(): string;\n    get hasRegExpGroups(): boolean;\n    test(input?: (string | URLPatternInit), baseURL?: string): boolean;\n    exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;\n}\ninterface URLPatternInit {\n    protocol?: string;\n    username?: string;\n    password?: string;\n    hostname?: string;\n    port?: string;\n    pathname?: string;\n    search?: string;\n    hash?: string;\n    baseURL?: string;\n}\ninterface URLPatternComponentResult {\n    input: string;\n    groups: Record<string, string>;\n}\ninterface URLPatternResult {\n    inputs: (string | URLPatternInit)[];\n    protocol: URLPatternComponentResult;\n    username: URLPatternComponentResult;\n    password: URLPatternComponentResult;\n    hostname: URLPatternComponentResult;\n    port: URLPatternComponentResult;\n    pathname: URLPatternComponentResult;\n    search: URLPatternComponentResult;\n    hash: URLPatternComponentResult;\n}\ninterface URLPatternOptions {\n    ignoreCase?: boolean;\n}\n/**\n * A `CloseEvent` is sent to clients using WebSockets when the connection is closed.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)\n */\ndeclare class CloseEvent extends Event {\n    constructor(type: string, initializer?: CloseEventInit);\n    /**\n     * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)\n     */\n    readonly code: number;\n    /**\n     * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)\n     */\n    readonly reason: string;\n    /**\n     * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)\n     */\n    readonly wasClean: boolean;\n}\ninterface CloseEventInit {\n    code?: number;\n    reason?: string;\n    wasClean?: boolean;\n}\ntype WebSocketEventMap = {\n    close: CloseEvent;\n    message: MessageEvent;\n    open: Event;\n    error: ErrorEvent;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ndeclare var WebSocket: {\n    prototype: WebSocket;\n    new (url: string, protocols?: (string[] | string)): WebSocket;\n    readonly READY_STATE_CONNECTING: number;\n    readonly CONNECTING: number;\n    readonly READY_STATE_OPEN: number;\n    readonly OPEN: number;\n    readonly READY_STATE_CLOSING: number;\n    readonly CLOSING: number;\n    readonly READY_STATE_CLOSED: number;\n    readonly CLOSED: number;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ninterface WebSocket extends EventTarget<WebSocketEventMap> {\n    accept(options?: WebSocketAcceptOptions): void;\n    /**\n     * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)\n     */\n    send(message: (ArrayBuffer | ArrayBufferView) | string): void;\n    /**\n     * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)\n     */\n    close(code?: number, reason?: string): void;\n    serializeAttachment(attachment: any): void;\n    deserializeAttachment(): any | null;\n    /**\n     * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)\n     */\n    readyState: number;\n    /**\n     * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)\n     */\n    url: string | null;\n    /**\n     * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)\n     */\n    protocol: string | null;\n    /**\n     * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)\n     */\n    extensions: string | null;\n    /**\n     * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)\n     */\n    binaryType: \"blob\" | \"arraybuffer\";\n}\ninterface WebSocketAcceptOptions {\n    /**\n     * When set to `true`, receiving a server-initiated WebSocket Close frame will not\n     * automatically send a reciprocal Close frame, leaving the connection in a half-open\n     * state. This is useful for proxying scenarios where you need to coordinate closing\n     * both sides independently. Defaults to `false` when the\n     * `no_web_socket_half_open_by_default` compatibility flag is enabled.\n     */\n    allowHalfOpen?: boolean;\n}\ndeclare const WebSocketPair: {\n    new (): {\n        0: WebSocket;\n        1: WebSocket;\n    };\n};\ninterface SqlStorage {\n    exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;\n    get databaseSize(): number;\n    Cursor: typeof SqlStorageCursor;\n    Statement: typeof SqlStorageStatement;\n}\ndeclare abstract class SqlStorageStatement {\n}\ntype SqlStorageValue = ArrayBuffer | string | number | null;\ndeclare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {\n    next(): {\n        done?: false;\n        value: T;\n    } | {\n        done: true;\n        value?: never;\n    };\n    toArray(): T[];\n    one(): T;\n    raw<U extends SqlStorageValue[]>(): IterableIterator<U>;\n    columnNames: string[];\n    get rowsRead(): number;\n    get rowsWritten(): number;\n    [Symbol.iterator](): IterableIterator<T>;\n}\ninterface Socket {\n    get readable(): ReadableStream;\n    get writable(): WritableStream;\n    get closed(): Promise<void>;\n    get opened(): Promise<SocketInfo>;\n    get upgraded(): boolean;\n    get secureTransport(): \"on\" | \"off\" | \"starttls\";\n    close(): Promise<void>;\n    startTls(options?: TlsOptions): Socket;\n}\ninterface SocketOptions {\n    secureTransport?: string;\n    allowHalfOpen: boolean;\n    highWaterMark?: (number | bigint);\n}\ninterface SocketAddress {\n    hostname: string;\n    port: number;\n}\ninterface TlsOptions {\n    expectedServerHostname?: string;\n}\ninterface SocketInfo {\n    remoteAddress?: string;\n    localAddress?: string;\n}\n/**\n * The **`EventSource`** interface is web content's interface to server-sent events.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)\n */\ndeclare class EventSource extends EventTarget {\n    constructor(url: string, init?: EventSourceEventSourceInit);\n    /**\n     * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)\n     */\n    close(): void;\n    /**\n     * The **`url`** read-only property of the URL of the source.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)\n     */\n    get url(): string;\n    /**\n     * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)\n     */\n    get withCredentials(): boolean;\n    /**\n     * The **`readyState`** read-only property of the connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)\n     */\n    get readyState(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    get onopen(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    set onopen(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    get onmessage(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    set onmessage(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    get onerror(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    set onerror(value: any | null);\n    static readonly CONNECTING: number;\n    static readonly OPEN: number;\n    static readonly CLOSED: number;\n    static from(stream: ReadableStream): EventSource;\n}\ninterface EventSourceEventSourceInit {\n    withCredentials?: boolean;\n    fetcher?: Fetcher;\n}\ninterface Container {\n    get running(): boolean;\n    start(options?: ContainerStartupOptions): void;\n    monitor(): Promise<void>;\n    destroy(error?: any): Promise<void>;\n    signal(signo: number): void;\n    getTcpPort(port: number): Fetcher;\n    setInactivityTimeout(durationMs: number | bigint): Promise<void>;\n    interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;\n    interceptAllOutboundHttp(binding: Fetcher): Promise<void>;\n}\ninterface ContainerStartupOptions {\n    entrypoint?: string[];\n    enableInternet: boolean;\n    env?: Record<string, string>;\n    hardTimeout?: (number | bigint);\n}\n/**\n * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)\n */\ndeclare abstract class MessagePort extends EventTarget {\n    /**\n     * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)\n     */\n    postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;\n    /**\n     * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)\n     */\n    close(): void;\n    /**\n     * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)\n     */\n    start(): void;\n    get onmessage(): any | null;\n    set onmessage(value: any | null);\n}\n/**\n * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)\n */\ndeclare class MessageChannel {\n    constructor();\n    /**\n     * The **`port1`** read-only property of the the port attached to the context that originated the channel.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)\n     */\n    readonly port1: MessagePort;\n    /**\n     * The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)\n     */\n    readonly port2: MessagePort;\n}\ninterface MessagePortPostMessageOptions {\n    transfer?: any[];\n}\ntype LoopbackForExport<T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub<InstanceType<T>> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass<InstanceType<T>> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;\ntype LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {\n    props?: Props;\n}) => Fetcher<T> : (opts: {\n    props?: any;\n}) => Fetcher<T>);\ntype LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {\n    props?: Props;\n}) => DurableObjectClass<T> : (opts: {\n    props?: any;\n}) => DurableObjectClass<T>);\ninterface SyncKvStorage {\n    get<T = unknown>(key: string): T | undefined;\n    list<T = unknown>(options?: SyncKvListOptions): Iterable<[\n        string,\n        T\n    ]>;\n    put<T>(key: string, value: T): void;\n    delete(key: string): boolean;\n}\ninterface SyncKvListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n}\ninterface WorkerStub {\n    getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;\n}\ninterface WorkerStubEntrypointOptions {\n    props?: any;\n}\ninterface WorkerLoader {\n    get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;\n    load(code: WorkerLoaderWorkerCode): WorkerStub;\n}\ninterface WorkerLoaderModule {\n    js?: string;\n    cjs?: string;\n    text?: string;\n    data?: ArrayBuffer;\n    json?: any;\n    py?: string;\n    wasm?: ArrayBuffer;\n}\ninterface WorkerLoaderWorkerCode {\n    compatibilityDate: string;\n    compatibilityFlags?: string[];\n    allowExperimental?: boolean;\n    mainModule: string;\n    modules: Record<string, WorkerLoaderModule | string>;\n    env?: any;\n    globalOutbound?: (Fetcher | null);\n    tails?: Fetcher[];\n    streamingTails?: Fetcher[];\n}\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare abstract class Performance {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */\n    get timeOrigin(): number;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */\n    now(): number;\n    /**\n     * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)\n     */\n    toJSON(): object;\n}\n// AI Search V2 API Error Interfaces\ninterface AiSearchInternalError extends Error {\n}\ninterface AiSearchNotFoundError extends Error {\n}\ninterface AiSearchNameNotSetError extends Error {\n}\n// AI Search V2 Request Types\ntype AiSearchSearchRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            /** Maximum number of results (1-50, default 10) */\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            /** Context expansion (0-3, default 0) */\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            /** Enable reranking (default false) */\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n};\ntype AiSearchChatCompletionsRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    model?: string;\n    stream?: boolean;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            match_threshold?: number;\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n    [key: string]: unknown;\n};\n// AI Search V2 Response Types\ntype AiSearchSearchResponse = {\n    search_query: string;\n    chunks: Array<{\n        id: string;\n        type: string;\n        /** Match score (0-1) */\n        score: number;\n        text: string;\n        item: {\n            timestamp?: number;\n            key: string;\n            metadata?: Record<string, unknown>;\n        };\n        scoring_details?: {\n            /** Keyword match score (0-1) */\n            keyword_score?: number;\n            /** Vector similarity score (0-1) */\n            vector_score?: number;\n        };\n    }>;\n};\ntype AiSearchListResponse = Array<{\n    id: string;\n    internal_id?: string;\n    account_id?: string;\n    account_tag?: string;\n    /** Whether the instance is enabled (default true) */\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n}>;\ntype AiSearchConfig = {\n    /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */\n    id: string;\n    type: 'r2' | 'web-crawler';\n    source: string;\n    source_params?: object;\n    /** Token ID (UUID format) */\n    token_id?: string;\n    ai_gateway_id?: string;\n    /** Enable query rewriting (default false) */\n    rewrite_query?: boolean;\n    /** Enable reranking (default false) */\n    reranking?: boolean;\n    embedding_model?: string;\n    ai_search_model?: string;\n};\ntype AiSearchInstance = {\n    id: string;\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n};\n// AI Search Instance Service - Instance-level operations\ndeclare abstract class AiSearchInstanceService {\n    /**\n     * Search the AI Search instance for relevant chunks.\n     * @param params Search request with messages and AI search options\n     * @returns Search response with matching chunks\n     */\n    search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;\n    /**\n     * Generate chat completions with AI Search context.\n     * @param params Chat completions request with optional streaming\n     * @returns Response object (if streaming) or chat completion result\n     */\n    chatCompletions(params: AiSearchChatCompletionsRequest): Promise<Response | object>;\n    /**\n     * Delete this AI Search instance.\n     */\n    delete(): Promise<void>;\n}\n// AI Search Account Service - Account-level operations\ndeclare abstract class AiSearchAccountService {\n    /**\n     * List all AI Search instances in the account.\n     * @returns Array of AI Search instances\n     */\n    list(): Promise<AiSearchListResponse>;\n    /**\n     * Get an AI Search instance by ID.\n     * @param name Instance ID\n     * @returns Instance service for performing operations\n     */\n    get(name: string): AiSearchInstanceService;\n    /**\n     * Create a new AI Search instance.\n     * @param config Instance configuration\n     * @returns Instance service for performing operations\n     */\n    create(config: AiSearchConfig): Promise<AiSearchInstanceService>;\n}\ntype AiImageClassificationInput = {\n    image: number[];\n};\ntype AiImageClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiImageClassification {\n    inputs: AiImageClassificationInput;\n    postProcessedOutputs: AiImageClassificationOutput;\n}\ntype AiImageToTextInput = {\n    image: number[];\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageToText {\n    inputs: AiImageToTextInput;\n    postProcessedOutputs: AiImageToTextOutput;\n}\ntype AiImageTextToTextInput = {\n    image: string;\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    ignore_eos?: boolean;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageTextToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageTextToText {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiMultimodalEmbeddingsInput = {\n    image: string;\n    text: string[];\n};\ntype AiIMultimodalEmbeddingsOutput = {\n    data: number[][];\n    shape: number[];\n};\ndeclare abstract class BaseAiMultimodalEmbeddings {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiObjectDetectionInput = {\n    image: number[];\n};\ntype AiObjectDetectionOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiObjectDetection {\n    inputs: AiObjectDetectionInput;\n    postProcessedOutputs: AiObjectDetectionOutput;\n}\ntype AiSentenceSimilarityInput = {\n    source: string;\n    sentences: string[];\n};\ntype AiSentenceSimilarityOutput = number[];\ndeclare abstract class BaseAiSentenceSimilarity {\n    inputs: AiSentenceSimilarityInput;\n    postProcessedOutputs: AiSentenceSimilarityOutput;\n}\ntype AiAutomaticSpeechRecognitionInput = {\n    audio: number[];\n};\ntype AiAutomaticSpeechRecognitionOutput = {\n    text?: string;\n    words?: {\n        word: string;\n        start: number;\n        end: number;\n    }[];\n    vtt?: string;\n};\ndeclare abstract class BaseAiAutomaticSpeechRecognition {\n    inputs: AiAutomaticSpeechRecognitionInput;\n    postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;\n}\ntype AiSummarizationInput = {\n    input_text: string;\n    max_length?: number;\n};\ntype AiSummarizationOutput = {\n    summary: string;\n};\ndeclare abstract class BaseAiSummarization {\n    inputs: AiSummarizationInput;\n    postProcessedOutputs: AiSummarizationOutput;\n}\ntype AiTextClassificationInput = {\n    text: string;\n};\ntype AiTextClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiTextClassification {\n    inputs: AiTextClassificationInput;\n    postProcessedOutputs: AiTextClassificationOutput;\n}\ntype AiTextEmbeddingsInput = {\n    text: string | string[];\n};\ntype AiTextEmbeddingsOutput = {\n    shape: number[];\n    data: number[][];\n};\ndeclare abstract class BaseAiTextEmbeddings {\n    inputs: AiTextEmbeddingsInput;\n    postProcessedOutputs: AiTextEmbeddingsOutput;\n}\ntype RoleScopedChatInput = {\n    role: \"user\" | \"assistant\" | \"system\" | \"tool\" | (string & NonNullable<unknown>);\n    content: string;\n    name?: string;\n};\ntype AiTextGenerationToolLegacyInput = {\n    name: string;\n    description: string;\n    parameters?: {\n        type: \"object\" | (string & NonNullable<unknown>);\n        properties: {\n            [key: string]: {\n                type: string;\n                description?: string;\n            };\n        };\n        required: string[];\n    };\n};\ntype AiTextGenerationToolInput = {\n    type: \"function\" | (string & NonNullable<unknown>);\n    function: {\n        name: string;\n        description: string;\n        parameters?: {\n            type: \"object\" | (string & NonNullable<unknown>);\n            properties: {\n                [key: string]: {\n                    type: string;\n                    description?: string;\n                };\n            };\n            required: string[];\n        };\n    };\n};\ntype AiTextGenerationFunctionsInput = {\n    name: string;\n    code: string;\n};\ntype AiTextGenerationResponseFormat = {\n    type: string;\n    json_schema?: any;\n};\ntype AiTextGenerationInput = {\n    prompt?: string;\n    raw?: boolean;\n    stream?: boolean;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    messages?: RoleScopedChatInput[];\n    response_format?: AiTextGenerationResponseFormat;\n    tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);\n    functions?: AiTextGenerationFunctionsInput[];\n};\ntype AiTextGenerationToolLegacyOutput = {\n    name: string;\n    arguments: unknown;\n};\ntype AiTextGenerationToolOutput = {\n    id: string;\n    type: \"function\";\n    function: {\n        name: string;\n        arguments: string;\n    };\n};\ntype UsageTags = {\n    prompt_tokens: number;\n    completion_tokens: number;\n    total_tokens: number;\n};\ntype AiTextGenerationOutput = {\n    response?: string;\n    tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];\n    usage?: UsageTags;\n};\ndeclare abstract class BaseAiTextGeneration {\n    inputs: AiTextGenerationInput;\n    postProcessedOutputs: AiTextGenerationOutput;\n}\ntype AiTextToSpeechInput = {\n    prompt: string;\n    lang?: string;\n};\ntype AiTextToSpeechOutput = Uint8Array | {\n    audio: string;\n};\ndeclare abstract class BaseAiTextToSpeech {\n    inputs: AiTextToSpeechInput;\n    postProcessedOutputs: AiTextToSpeechOutput;\n}\ntype AiTextToImageInput = {\n    prompt: string;\n    negative_prompt?: string;\n    height?: number;\n    width?: number;\n    image?: number[];\n    image_b64?: string;\n    mask?: number[];\n    num_steps?: number;\n    strength?: number;\n    guidance?: number;\n    seed?: number;\n};\ntype AiTextToImageOutput = ReadableStream<Uint8Array>;\ndeclare abstract class BaseAiTextToImage {\n    inputs: AiTextToImageInput;\n    postProcessedOutputs: AiTextToImageOutput;\n}\ntype AiTranslationInput = {\n    text: string;\n    target_lang: string;\n    source_lang?: string;\n};\ntype AiTranslationOutput = {\n    translated_text?: string;\n};\ndeclare abstract class BaseAiTranslation {\n    inputs: AiTranslationInput;\n    postProcessedOutputs: AiTranslationOutput;\n}\n/**\n * Workers AI support for OpenAI's Responses API\n * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts\n *\n * It's a stripped down version from its source.\n * It currently supports basic function calling, json mode and accepts images as input.\n *\n * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.\n * We plan to add those incrementally as model + platform capabilities evolve.\n */\ntype ResponsesInput = {\n    background?: boolean | null;\n    conversation?: string | ResponseConversationParam | null;\n    include?: Array<ResponseIncludable> | null;\n    input?: string | ResponseInput;\n    instructions?: string | null;\n    max_output_tokens?: number | null;\n    parallel_tool_calls?: boolean | null;\n    previous_response_id?: string | null;\n    prompt_cache_key?: string;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    stream?: boolean | null;\n    stream_options?: StreamOptions | null;\n    temperature?: number | null;\n    text?: ResponseTextConfig;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    truncation?: \"auto\" | \"disabled\" | null;\n};\ntype ResponsesOutput = {\n    id?: string;\n    created_at?: number;\n    output_text?: string;\n    error?: ResponseError | null;\n    incomplete_details?: ResponseIncompleteDetails | null;\n    instructions?: string | Array<ResponseInputItem> | null;\n    object?: \"response\";\n    output?: Array<ResponseOutputItem>;\n    parallel_tool_calls?: boolean;\n    temperature?: number | null;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    max_output_tokens?: number | null;\n    previous_response_id?: string | null;\n    prompt?: ResponsePrompt | null;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    status?: ResponseStatus;\n    text?: ResponseTextConfig;\n    truncation?: \"auto\" | \"disabled\" | null;\n    usage?: ResponseUsage;\n};\ntype EasyInputMessage = {\n    content: string | ResponseInputMessageContentList;\n    role: \"user\" | \"assistant\" | \"system\" | \"developer\";\n    type?: \"message\";\n};\ntype ResponsesFunctionTool = {\n    name: string;\n    parameters: {\n        [key: string]: unknown;\n    } | null;\n    strict: boolean | null;\n    type: \"function\";\n    description?: string | null;\n};\ntype ResponseIncompleteDetails = {\n    reason?: \"max_output_tokens\" | \"content_filter\";\n};\ntype ResponsePrompt = {\n    id: string;\n    variables?: {\n        [key: string]: string | ResponseInputText | ResponseInputImage;\n    } | null;\n    version?: string | null;\n};\ntype Reasoning = {\n    effort?: ReasoningEffort | null;\n    generate_summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n    summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n};\ntype ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;\ntype ResponseContentReasoningText = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseConversationParam = {\n    id: string;\n};\ntype ResponseCreatedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.created\";\n};\ntype ResponseCustomToolCallOutput = {\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"custom_tool_call_output\";\n    id?: string;\n};\ntype ResponseError = {\n    code: \"server_error\" | \"rate_limit_exceeded\" | \"invalid_prompt\" | \"vector_store_timeout\" | \"invalid_image\" | \"invalid_image_format\" | \"invalid_base64_image\" | \"invalid_image_url\" | \"image_too_large\" | \"image_too_small\" | \"image_parse_error\" | \"image_content_policy_violation\" | \"invalid_image_mode\" | \"image_file_too_large\" | \"unsupported_image_media_type\" | \"empty_image_file\" | \"failed_to_download_image\" | \"image_file_not_found\";\n    message: string;\n};\ntype ResponseErrorEvent = {\n    code: string | null;\n    message: string;\n    param: string | null;\n    sequence_number: number;\n    type: \"error\";\n};\ntype ResponseFailedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.failed\";\n};\ntype ResponseFormatText = {\n    type: \"text\";\n};\ntype ResponseFormatJSONObject = {\n    type: \"json_object\";\n};\ntype ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;\ntype ResponseFormatTextJSONSchemaConfig = {\n    name: string;\n    schema: {\n        [key: string]: unknown;\n    };\n    type: \"json_schema\";\n    description?: string;\n    strict?: boolean | null;\n};\ntype ResponseFunctionCallArgumentsDeltaEvent = {\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.delta\";\n};\ntype ResponseFunctionCallArgumentsDoneEvent = {\n    arguments: string;\n    item_id: string;\n    name: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.done\";\n};\ntype ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;\ntype ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;\ntype ResponseFunctionToolCall = {\n    arguments: string;\n    call_id: string;\n    name: string;\n    type: \"function_call\";\n    id?: string;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ninterface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {\n    id: string;\n}\ntype ResponseFunctionToolCallOutputItem = {\n    id: string;\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"function_call_output\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseIncludable = \"message.input_image.image_url\" | \"message.output_text.logprobs\";\ntype ResponseIncompleteEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.incomplete\";\n};\ntype ResponseInput = Array<ResponseInputItem>;\ntype ResponseInputContent = ResponseInputText | ResponseInputImage;\ntype ResponseInputImage = {\n    detail: \"low\" | \"high\" | \"auto\";\n    type: \"input_image\";\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputImageContent = {\n    type: \"input_image\";\n    detail?: \"low\" | \"high\" | \"auto\" | null;\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;\ntype ResponseInputItemFunctionCallOutput = {\n    call_id: string;\n    output: string | ResponseFunctionCallOutputItemList;\n    type: \"function_call_output\";\n    id?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\" | null;\n};\ntype ResponseInputItemMessage = {\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputMessageContentList = Array<ResponseInputContent>;\ntype ResponseInputMessageItem = {\n    id: string;\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputText = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseInputTextContent = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;\ntype ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;\ntype ResponseOutputItemAddedEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.added\";\n};\ntype ResponseOutputItemDoneEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.done\";\n};\ntype ResponseOutputMessage = {\n    id: string;\n    content: Array<ResponseOutputText | ResponseOutputRefusal>;\n    role: \"assistant\";\n    status: \"in_progress\" | \"completed\" | \"incomplete\";\n    type: \"message\";\n};\ntype ResponseOutputRefusal = {\n    refusal: string;\n    type: \"refusal\";\n};\ntype ResponseOutputText = {\n    text: string;\n    type: \"output_text\";\n    logprobs?: Array<Logprob>;\n};\ntype ResponseReasoningItem = {\n    id: string;\n    summary: Array<ResponseReasoningSummaryItem>;\n    type: \"reasoning\";\n    content?: Array<ResponseReasoningContentItem>;\n    encrypted_content?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseReasoningSummaryItem = {\n    text: string;\n    type: \"summary_text\";\n};\ntype ResponseReasoningContentItem = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseReasoningTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.reasoning_text.delta\";\n};\ntype ResponseReasoningTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.reasoning_text.done\";\n};\ntype ResponseRefusalDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.refusal.delta\";\n};\ntype ResponseRefusalDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    refusal: string;\n    sequence_number: number;\n    type: \"response.refusal.done\";\n};\ntype ResponseStatus = \"completed\" | \"failed\" | \"in_progress\" | \"cancelled\" | \"queued\" | \"incomplete\";\ntype ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;\ntype ResponseCompletedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.completed\";\n};\ntype ResponseTextConfig = {\n    format?: ResponseFormatTextConfig;\n    verbosity?: \"low\" | \"medium\" | \"high\" | null;\n};\ntype ResponseTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_text.delta\";\n};\ntype ResponseTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.output_text.done\";\n};\ntype Logprob = {\n    token: string;\n    logprob: number;\n    top_logprobs?: Array<TopLogprob>;\n};\ntype TopLogprob = {\n    token?: string;\n    logprob?: number;\n};\ntype ResponseUsage = {\n    input_tokens: number;\n    output_tokens: number;\n    total_tokens: number;\n};\ntype Tool = ResponsesFunctionTool;\ntype ToolChoiceFunction = {\n    name: string;\n    type: \"function\";\n};\ntype ToolChoiceOptions = \"none\";\ntype ReasoningEffort = \"minimal\" | \"low\" | \"medium\" | \"high\" | null;\ntype StreamOptions = {\n    include_obfuscation?: boolean;\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;\n}\ntype Ai_Cf_Openai_Whisper_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper {\n    inputs: Ai_Cf_Openai_Whisper_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;\n}\ntype Ai_Cf_Meta_M2M100_1_2B_Input = {\n    /**\n     * The text to be translated\n     */\n    text: string;\n    /**\n     * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n     */\n    source_lang?: string;\n    /**\n     * The language code to translate the text into (e.g., 'es' for Spanish)\n     */\n    target_lang: string;\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        /**\n         * The text to be translated\n         */\n        text: string;\n        /**\n         * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n         */\n        source_lang?: string;\n        /**\n         * The language code to translate the text into (e.g., 'es' for Spanish)\n         */\n        target_lang: string;\n    }[];\n};\ntype Ai_Cf_Meta_M2M100_1_2B_Output = {\n    /**\n     * The translated text in the target language\n     */\n    translated_text?: string;\n} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;\ninterface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {\n    inputs: Ai_Cf_Meta_M2M100_1_2B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;\n}\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;\n}\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;\n}\ntype Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt?: string;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    image: number[] | (string & NonNullable<unknown>);\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n};\ninterface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {\n    description?: string;\n}\ndeclare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {\n    inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;\n    postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;\n}\ntype Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Tiny_En_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {\n    inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {\n    /**\n     * Base64 encoded value of the audio data.\n     */\n    audio: string;\n    /**\n     * Supported tasks are 'translate' or 'transcribe'.\n     */\n    task?: string;\n    /**\n     * The language of the audio being transcribed or translated.\n     */\n    language?: string;\n    /**\n     * Preprocess the audio with a voice activity detection model.\n     */\n    vad_filter?: boolean;\n    /**\n     * A text prompt to help provide context to the model on the contents of the audio.\n     */\n    initial_prompt?: string;\n    /**\n     * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.\n     */\n    prefix?: string;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {\n    transcription_info?: {\n        /**\n         * The language of the audio being transcribed or translated.\n         */\n        language?: string;\n        /**\n         * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.\n         */\n        language_probability?: number;\n        /**\n         * The total duration of the original audio file, in seconds.\n         */\n        duration?: number;\n        /**\n         * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.\n         */\n        duration_after_vad?: number;\n    };\n    /**\n     * The complete transcription of the audio.\n     */\n    text: string;\n    /**\n     * The total number of words in the transcription.\n     */\n    word_count?: number;\n    segments?: {\n        /**\n         * The starting time of the segment within the audio, in seconds.\n         */\n        start?: number;\n        /**\n         * The ending time of the segment within the audio, in seconds.\n         */\n        end?: number;\n        /**\n         * The transcription of the segment.\n         */\n        text?: string;\n        /**\n         * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.\n         */\n        temperature?: number;\n        /**\n         * The average log probability of the predictions for the words in this segment, indicating overall confidence.\n         */\n        avg_logprob?: number;\n        /**\n         * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.\n         */\n        compression_ratio?: number;\n        /**\n         * The probability that the segment contains no speech, represented as a decimal between 0 and 1.\n         */\n        no_speech_prob?: number;\n        words?: {\n            /**\n             * The individual word transcribed from the audio.\n             */\n            word?: string;\n            /**\n             * The starting time of the word within the audio, in seconds.\n             */\n            start?: number;\n            /**\n             * The ending time of the word within the audio, in seconds.\n             */\n            end?: number;\n        }[];\n    }[];\n    /**\n     * The transcription in WebVTT format, which includes timing and text information for use in subtitles.\n     */\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {\n    inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;\n}\ntype Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];\n};\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ntype Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Ouput_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Ouput_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Query {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {\n    response?: number[][];\n    shape?: number[];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_M3 {\n    inputs: Ai_Cf_Baai_Bge_M3_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer.\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {\n    inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;\n    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages;\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    image?: number[] | (string & NonNullable<unknown>);\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n}\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    image?: number[] | (string & NonNullable<unknown>);\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * If true, the response will be streamed back incrementally.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response?: string;\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {\n    inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {\n    requests?: {\n        /**\n         * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique.\n         */\n        external_reference?: string;\n        /**\n         * Prompt for the text generation model\n         */\n        prompt?: string;\n        /**\n         * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n         */\n        stream?: boolean;\n        /**\n         * The maximum number of tokens to generate in the response.\n         */\n        max_tokens?: number;\n        /**\n         * Controls the randomness of the output; higher values produce more random results.\n         */\n        temperature?: number;\n        /**\n         * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n         */\n        top_p?: number;\n        /**\n         * Random seed for reproducibility of the generation.\n         */\n        seed?: number;\n        /**\n         * Penalty for repeated tokens; higher values discourage repetition.\n         */\n        repetition_penalty?: number;\n        /**\n         * Decreases the likelihood of the model repeating the same lines verbatim.\n         */\n        frequency_penalty?: number;\n        /**\n         * Increases the likelihood of the model introducing new topics.\n         */\n        presence_penalty?: number;\n        response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;\n    }[];\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {\n    inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Input {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender must alternate between 'user' and 'assistant'.\n         */\n        role: \"user\" | \"assistant\";\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Dictate the output format of the generated response.\n     */\n    response_format?: {\n        /**\n         * Set to json_object to process and output generated text as JSON.\n         */\n        type?: string;\n    };\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Output {\n    response?: string | {\n        /**\n         * Whether the conversation is safe or not.\n         */\n        safe?: boolean;\n        /**\n         * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.\n         */\n        categories?: string[];\n    };\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {\n    inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Input {\n    /**\n     * A query you wish to perform against the provided contexts.\n     */\n    /**\n     * Number of returned results starting with the best score.\n     */\n    top_k?: number;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Output {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {\n    inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages;\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {\n    inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;\ninterface Ai_Cf_Qwen_Qwq_32B_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwq_32B_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwq_32B {\n    inputs: Ai_Cf_Qwen_Qwq_32B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages;\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {\n    inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;\ninterface Ai_Cf_Google_Gemma_3_12B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Google_Gemma_3_12B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[];\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {\n    inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;\n    postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch;\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {\n    requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The tool call id.\n         */\n        id?: string;\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type?: string;\n        /**\n         * Details of the function tool.\n         */\n        function?: {\n            /**\n             * The name of the tool to be called\n             */\n            name?: string;\n            /**\n             * The arguments passed to be passed to the tool call request\n             */\n            arguments?: object;\n        };\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {\n    inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {\n    requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {\n    inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Input {\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.\n     */\n    custom_topic_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom topics you want the model to detect within your input audio or text if present Submit up to 100\n     */\n    custom_topic?: string;\n    /**\n     * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param\n     */\n    custom_intent_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom intents you want the model to detect within your input audio if present\n     */\n    custom_intent?: string;\n    /**\n     * Identifies and extracts key entities from content in submitted audio\n     */\n    detect_entities?: boolean;\n    /**\n     * Identifies the dominant language spoken in submitted audio\n     */\n    detect_language?: boolean;\n    /**\n     * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0\n     */\n    diarize?: boolean;\n    /**\n     * Identify and extract key entities from content in submitted audio\n     */\n    dictation?: boolean;\n    /**\n     * Specify the expected encoding of your submitted audio\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"amr-nb\" | \"amr-wb\" | \"opus\" | \"speex\" | \"g729\";\n    /**\n     * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing\n     */\n    extra?: string;\n    /**\n     * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'\n     */\n    filler_words?: boolean;\n    /**\n     * Key term prompting can boost or suppress specialized terminology and brands.\n     */\n    keyterm?: string;\n    /**\n     * Keywords can boost or suppress specialized terminology and brands.\n     */\n    keywords?: string;\n    /**\n     * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.\n     */\n    language?: string;\n    /**\n     * Spoken measurements will be converted to their corresponding abbreviations.\n     */\n    measurements?: boolean;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.\n     */\n    mip_opt_out?: boolean;\n    /**\n     * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio\n     */\n    mode?: \"general\" | \"medical\" | \"finance\";\n    /**\n     * Transcribe each audio channel independently.\n     */\n    multichannel?: boolean;\n    /**\n     * Numerals converts numbers from written format to numerical format.\n     */\n    numerals?: boolean;\n    /**\n     * Splits audio into paragraphs to improve transcript readability.\n     */\n    paragraphs?: boolean;\n    /**\n     * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.\n     */\n    profanity_filter?: boolean;\n    /**\n     * Add punctuation and capitalization to the transcript.\n     */\n    punctuate?: boolean;\n    /**\n     * Redaction removes sensitive information from your transcripts.\n     */\n    redact?: string;\n    /**\n     * Search for terms or phrases in submitted audio and replaces them.\n     */\n    replace?: string;\n    /**\n     * Search for terms or phrases in submitted audio.\n     */\n    search?: string;\n    /**\n     * Recognizes the sentiment throughout a transcript or text.\n     */\n    sentiment?: boolean;\n    /**\n     * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.\n     */\n    smart_format?: boolean;\n    /**\n     * Detect topics throughout a transcript or text.\n     */\n    topics?: boolean;\n    /**\n     * Segments speech into meaningful semantic units.\n     */\n    utterances?: boolean;\n    /**\n     * Seconds to wait before detecting a pause between words in submitted audio.\n     */\n    utt_split?: number;\n    /**\n     * The number of channels in the submitted audio\n     */\n    channels?: number;\n    /**\n     * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.\n     */\n    interim_results?: boolean;\n    /**\n     * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing\n     */\n    endpointing?: string;\n    /**\n     * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.\n     */\n    vad_events?: boolean;\n    /**\n     * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.\n     */\n    utterance_end_ms?: boolean;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Output {\n    results?: {\n        channels?: {\n            alternatives?: {\n                confidence?: number;\n                transcript?: string;\n                words?: {\n                    confidence?: number;\n                    end?: number;\n                    start?: number;\n                    word?: string;\n                }[];\n            }[];\n        }[];\n        summary?: {\n            result?: string;\n            short?: string;\n        };\n        sentiments?: {\n            segments?: {\n                text?: string;\n                start_word?: number;\n                end_word?: number;\n                sentiment?: string;\n                sentiment_score?: number;\n            }[];\n            average?: {\n                sentiment?: string;\n                sentiment_score?: number;\n            };\n        };\n    };\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Nova_3 {\n    inputs: Ai_Cf_Deepgram_Nova_3_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {\n    queries?: string | string[];\n    /**\n     * Optional instruction for the task\n     */\n    instruction?: string;\n    documents?: string | string[];\n    text?: string | string[];\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {\n    data?: number[][];\n    shape?: number[];\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {\n    inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;\n}\ntype Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {\n    /**\n     * readable stream with audio data and content-type specified for that data\n     */\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n} | {\n    /**\n     * base64 encoded audio data\n     */\n    audio: string;\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n};\ninterface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {\n    /**\n     * if true, end-of-turn was detected\n     */\n    is_complete?: boolean;\n    /**\n     * probability of the end-of-turn detection\n     */\n    probability?: number;\n}\ndeclare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {\n    inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;\n    postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ninterface Ai_Cf_Leonardo_Phoenix_1_0_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * Specify what to exclude from the generated images\n     */\n    negative_prompt?: string;\n}\n/**\n * The generated image in JPEG format\n */\ntype Ai_Cf_Leonardo_Phoenix_1_0_Output = string;\ndeclare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {\n    inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {\n    inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_1_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"angus\" | \"asteria\" | \"arcas\" | \"orion\" | \"orpheus\" | \"athena\" | \"luna\" | \"zeus\" | \"perseus\" | \"helios\" | \"hera\" | \"stella\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_1_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_1 {\n    inputs: Ai_Cf_Deepgram_Aura_1_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {\n    /**\n     * Input text to translate. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n    /**\n     * Target language to translate to\n     */\n    target_language: \"asm_Beng\" | \"awa_Deva\" | \"ben_Beng\" | \"bho_Deva\" | \"brx_Deva\" | \"doi_Deva\" | \"eng_Latn\" | \"gom_Deva\" | \"gon_Deva\" | \"guj_Gujr\" | \"hin_Deva\" | \"hne_Deva\" | \"kan_Knda\" | \"kas_Arab\" | \"kas_Deva\" | \"kha_Latn\" | \"lus_Latn\" | \"mag_Deva\" | \"mai_Deva\" | \"mal_Mlym\" | \"mar_Deva\" | \"mni_Beng\" | \"mni_Mtei\" | \"npi_Deva\" | \"ory_Orya\" | \"pan_Guru\" | \"san_Deva\" | \"sat_Olck\" | \"snd_Arab\" | \"snd_Deva\" | \"tam_Taml\" | \"tel_Telu\" | \"urd_Arab\" | \"unr_Deva\";\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {\n    /**\n     * Translated texts\n     */\n    translations: string[];\n}\ndeclare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {\n    inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;\n    postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {\n    requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {\n    inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;\n    postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {\n    /**\n     * Input text to embed. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {\n    /**\n     * Embedding vectors, where each vector is a list of floats.\n     */\n    data: number[][];\n    /**\n     * Shape of the embedding data as [number_of_embeddings, embedding_dimension].\n     *\n     * @minItems 2\n     * @maxItems 2\n     */\n    shape: [\n        number,\n        number\n    ];\n}\ndeclare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {\n    inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;\n    postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;\n}\ninterface Ai_Cf_Deepgram_Flux_Input {\n    /**\n     * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.\n     */\n    encoding: \"linear16\";\n    /**\n     * Sample rate of the audio stream in Hz.\n     */\n    sample_rate: string;\n    /**\n     * End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.\n     */\n    eager_eot_threshold?: string;\n    /**\n     * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.\n     */\n    eot_threshold?: string;\n    /**\n     * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.\n     */\n    eot_timeout_ms?: string;\n    /**\n     * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.\n     */\n    keyterm?: string;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip\n     */\n    mip_opt_out?: \"true\" | \"false\";\n    /**\n     * Label your requests for the purpose of identification during usage reporting\n     */\n    tag?: string;\n}\n/**\n * Output will be returned as websocket messages.\n */\ninterface Ai_Cf_Deepgram_Flux_Output {\n    /**\n     * The unique identifier of the request (uuid)\n     */\n    request_id?: string;\n    /**\n     * Starts at 0 and increments for each message the server sends to the client.\n     */\n    sequence_id?: number;\n    /**\n     * The type of event being reported.\n     */\n    event?: \"Update\" | \"StartOfTurn\" | \"EagerEndOfTurn\" | \"TurnResumed\" | \"EndOfTurn\";\n    /**\n     * The index of the current turn\n     */\n    turn_index?: number;\n    /**\n     * Start time in seconds of the audio range that was transcribed\n     */\n    audio_window_start?: number;\n    /**\n     * End time in seconds of the audio range that was transcribed\n     */\n    audio_window_end?: number;\n    /**\n     * Text that was said over the course of the current turn\n     */\n    transcript?: string;\n    /**\n     * The words in the transcript\n     */\n    words?: {\n        /**\n         * The individual punctuated, properly-cased word from the transcript\n         */\n        word: string;\n        /**\n         * Confidence that this word was transcribed correctly\n         */\n        confidence: number;\n    }[];\n    /**\n     * Confidence that no more speech is coming in this turn\n     */\n    end_of_turn_confidence?: number;\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Flux {\n    inputs: Ai_Cf_Deepgram_Flux_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_En_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"amalthea\" | \"andromeda\" | \"apollo\" | \"arcas\" | \"aries\" | \"asteria\" | \"athena\" | \"atlas\" | \"aurora\" | \"callista\" | \"cora\" | \"cordelia\" | \"delia\" | \"draco\" | \"electra\" | \"harmonia\" | \"helena\" | \"hera\" | \"hermes\" | \"hyperion\" | \"iris\" | \"janus\" | \"juno\" | \"jupiter\" | \"luna\" | \"mars\" | \"minerva\" | \"neptune\" | \"odysseus\" | \"ophelia\" | \"orion\" | \"orpheus\" | \"pandora\" | \"phoebe\" | \"pluto\" | \"saturn\" | \"thalia\" | \"theia\" | \"vesta\" | \"zeus\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_En_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {\n    inputs: Ai_Cf_Deepgram_Aura_2_En_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_Es_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"sirio\" | \"nestor\" | \"carina\" | \"celeste\" | \"alvaro\" | \"diana\" | \"aquila\" | \"selena\" | \"estrella\" | \"javier\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_Es_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {\n    inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;\n}\ninterface AiModels {\n    \"@cf/huggingface/distilbert-sst-2-int8\": BaseAiTextClassification;\n    \"@cf/stabilityai/stable-diffusion-xl-base-1.0\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-inpainting\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-img2img\": BaseAiTextToImage;\n    \"@cf/lykon/dreamshaper-8-lcm\": BaseAiTextToImage;\n    \"@cf/bytedance/stable-diffusion-xl-lightning\": BaseAiTextToImage;\n    \"@cf/myshell-ai/melotts\": BaseAiTextToSpeech;\n    \"@cf/google/embeddinggemma-300m\": BaseAiTextEmbeddings;\n    \"@cf/microsoft/resnet-50\": BaseAiImageClassification;\n    \"@cf/meta/llama-2-7b-chat-int8\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.1\": BaseAiTextGeneration;\n    \"@cf/meta/llama-2-7b-chat-fp16\": BaseAiTextGeneration;\n    \"@hf/thebloke/llama-2-13b-chat-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/mistral-7b-instruct-v0.1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/zephyr-7b-beta-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/openhermes-2.5-mistral-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/neural-chat-7b-v3-1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/llamaguard-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-base-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-math-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/defog/sqlcoder-7b-2\": BaseAiTextGeneration;\n    \"@cf/openchat/openchat-3.5-0106\": BaseAiTextGeneration;\n    \"@cf/tiiuae/falcon-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/thebloke/discolm-german-7b-v1-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-0.5b-chat\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-7b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-14b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/tinyllama/tinyllama-1.1b-chat-v1.0\": BaseAiTextGeneration;\n    \"@cf/microsoft/phi-2\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-1.8b-chat\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.2-lora\": BaseAiTextGeneration;\n    \"@hf/nousresearch/hermes-2-pro-mistral-7b\": BaseAiTextGeneration;\n    \"@hf/nexusflow/starling-lm-7b-beta\": BaseAiTextGeneration;\n    \"@hf/google/gemma-7b-it\": BaseAiTextGeneration;\n    \"@cf/meta-llama/llama-2-7b-chat-hf-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-2b-it-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-7b-it-lora\": BaseAiTextGeneration;\n    \"@hf/mistral/mistral-7b-instruct-v0.2\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct\": BaseAiTextGeneration;\n    \"@cf/fblgit/una-cybertron-7b-v2-bf16\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-fp8\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-3b-instruct\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-1b-instruct\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b\": BaseAiTextGeneration;\n    \"@cf/ibm-granite/granite-4.0-h-micro\": BaseAiTextGeneration;\n    \"@cf/facebook/bart-large-cnn\": BaseAiSummarization;\n    \"@cf/llava-hf/llava-1.5-7b-hf\": BaseAiImageToText;\n    \"@cf/baai/bge-base-en-v1.5\": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;\n    \"@cf/openai/whisper\": Base_Ai_Cf_Openai_Whisper;\n    \"@cf/meta/m2m100-1.2b\": Base_Ai_Cf_Meta_M2M100_1_2B;\n    \"@cf/baai/bge-small-en-v1.5\": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;\n    \"@cf/baai/bge-large-en-v1.5\": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;\n    \"@cf/unum/uform-gen2-qwen-500m\": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;\n    \"@cf/openai/whisper-tiny-en\": Base_Ai_Cf_Openai_Whisper_Tiny_En;\n    \"@cf/openai/whisper-large-v3-turbo\": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;\n    \"@cf/baai/bge-m3\": Base_Ai_Cf_Baai_Bge_M3;\n    \"@cf/black-forest-labs/flux-1-schnell\": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;\n    \"@cf/meta/llama-3.2-11b-vision-instruct\": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;\n    \"@cf/meta/llama-3.3-70b-instruct-fp8-fast\": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;\n    \"@cf/meta/llama-guard-3-8b\": Base_Ai_Cf_Meta_Llama_Guard_3_8B;\n    \"@cf/baai/bge-reranker-base\": Base_Ai_Cf_Baai_Bge_Reranker_Base;\n    \"@cf/qwen/qwen2.5-coder-32b-instruct\": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;\n    \"@cf/qwen/qwq-32b\": Base_Ai_Cf_Qwen_Qwq_32B;\n    \"@cf/mistralai/mistral-small-3.1-24b-instruct\": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;\n    \"@cf/google/gemma-3-12b-it\": Base_Ai_Cf_Google_Gemma_3_12B_It;\n    \"@cf/meta/llama-4-scout-17b-16e-instruct\": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;\n    \"@cf/qwen/qwen3-30b-a3b-fp8\": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;\n    \"@cf/deepgram/nova-3\": Base_Ai_Cf_Deepgram_Nova_3;\n    \"@cf/qwen/qwen3-embedding-0.6b\": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;\n    \"@cf/pipecat-ai/smart-turn-v2\": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;\n    \"@cf/openai/gpt-oss-120b\": Base_Ai_Cf_Openai_Gpt_Oss_120B;\n    \"@cf/openai/gpt-oss-20b\": Base_Ai_Cf_Openai_Gpt_Oss_20B;\n    \"@cf/leonardo/phoenix-1.0\": Base_Ai_Cf_Leonardo_Phoenix_1_0;\n    \"@cf/leonardo/lucid-origin\": Base_Ai_Cf_Leonardo_Lucid_Origin;\n    \"@cf/deepgram/aura-1\": Base_Ai_Cf_Deepgram_Aura_1;\n    \"@cf/ai4bharat/indictrans2-en-indic-1B\": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;\n    \"@cf/aisingapore/gemma-sea-lion-v4-27b-it\": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;\n    \"@cf/pfnet/plamo-embedding-1b\": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;\n    \"@cf/deepgram/flux\": Base_Ai_Cf_Deepgram_Flux;\n    \"@cf/deepgram/aura-2-en\": Base_Ai_Cf_Deepgram_Aura_2_En;\n    \"@cf/deepgram/aura-2-es\": Base_Ai_Cf_Deepgram_Aura_2_Es;\n}\ntype AiOptions = {\n    /**\n     * Send requests as an asynchronous batch job, only works for supported models\n     * https://developers.cloudflare.com/workers-ai/features/batch-api\n     */\n    queueRequest?: boolean;\n    /**\n     * Establish websocket connections, only works for supported models\n     */\n    websocket?: boolean;\n    /**\n     * Tag your requests to group and view them in Cloudflare dashboard.\n     *\n     * Rules:\n     * Tags must only contain letters, numbers, and the symbols: : - . / @\n     * Each tag can have maximum 50 characters.\n     * Maximum 5 tags are allowed each request.\n     * Duplicate tags will removed.\n     */\n    tags?: string[];\n    gateway?: GatewayOptions;\n    returnRawResponse?: boolean;\n    prefix?: string;\n    extraHeaders?: object;\n};\ntype AiModelsSearchParams = {\n    author?: string;\n    hide_experimental?: boolean;\n    page?: number;\n    per_page?: number;\n    search?: string;\n    source?: number;\n    task?: string;\n};\ntype AiModelsSearchObject = {\n    id: string;\n    source: number;\n    name: string;\n    description: string;\n    task: {\n        id: string;\n        name: string;\n        description: string;\n    };\n    tags: string[];\n    properties: {\n        property_id: string;\n        value: string;\n    }[];\n};\ninterface InferenceUpstreamError extends Error {\n}\ninterface AiInternalError extends Error {\n}\ntype AiModelListType = Record<string, any>;\ndeclare abstract class Ai<AiModelList extends AiModelListType = AiModels> {\n    aiGatewayLogId: string | null;\n    gateway(gatewayId: string): AiGateway;\n    /**\n     * Access the AI Search API for managing AI-powered search instances.\n     *\n     * This is the new API that replaces AutoRAG with better namespace separation:\n     * - Account-level operations: `list()`, `create()`\n     * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`\n     *\n     * @example\n     * ```typescript\n     * // List all AI Search instances\n     * const instances = await env.AI.aiSearch.list();\n     *\n     * // Search an instance\n     * const results = await env.AI.aiSearch.get('my-search').search({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   ai_search_options: {\n     *     retrieval: { max_num_results: 10 }\n     *   }\n     * });\n     *\n     * // Generate chat completions with AI Search context\n     * const response = await env.AI.aiSearch.get('my-search').chatCompletions({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'\n     * });\n     * ```\n     */\n    aiSearch(): AiSearchAccountService;\n    /**\n     * @deprecated AutoRAG has been replaced by AI Search.\n     * Use `env.AI.aiSearch` instead for better API design and new features.\n     *\n     * Migration guide:\n     * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n     * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`\n     * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n     *\n     * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.\n     *\n     * @see AiSearchAccountService\n     * @param autoragId Optional instance ID (omit for account-level operations)\n     */\n    autorag(autoragId: string): AutoRAG;\n    run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name][\"inputs\"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends {\n        returnRawResponse: true;\n    } | {\n        websocket: true;\n    } ? Response : InputOptions extends {\n        stream: true;\n    } ? ReadableStream : AiModelList[Name][\"postProcessedOutputs\"]>;\n    models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;\n    toMarkdown(): ToMarkdownService;\n    toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n}\ntype GatewayRetries = {\n    maxAttempts?: 1 | 2 | 3 | 4 | 5;\n    retryDelayMs?: number;\n    backoff?: 'constant' | 'linear' | 'exponential';\n};\ntype GatewayOptions = {\n    id: string;\n    cacheKey?: string;\n    cacheTtl?: number;\n    skipCache?: boolean;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    collectLog?: boolean;\n    eventId?: string;\n    requestTimeoutMs?: number;\n    retries?: GatewayRetries;\n};\ntype UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {\n    /**\n     ** @deprecated\n     */\n    id?: string;\n};\ntype AiGatewayPatchLog = {\n    score?: number | null;\n    feedback?: -1 | 1 | null;\n    metadata?: Record<string, number | string | boolean | null | bigint> | null;\n};\ntype AiGatewayLog = {\n    id: string;\n    provider: string;\n    model: string;\n    model_type?: string;\n    path: string;\n    duration: number;\n    request_type?: string;\n    request_content_type?: string;\n    status_code: number;\n    response_content_type?: string;\n    success: boolean;\n    cached: boolean;\n    tokens_in?: number;\n    tokens_out?: number;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    step?: number;\n    cost?: number;\n    custom_cost?: boolean;\n    request_size: number;\n    request_head?: string;\n    request_head_complete: boolean;\n    response_size: number;\n    response_head?: string;\n    response_head_complete: boolean;\n    created_at: Date;\n};\ntype AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | 'azure-openai' | 'google-vertex-ai' | 'huggingface' | 'openai' | 'perplexity-ai' | 'replicate' | 'groq' | 'cohere' | 'google-ai-studio' | 'mistral' | 'grok' | 'openrouter' | 'deepseek' | 'cerebras' | 'cartesia' | 'elevenlabs' | 'adobe-firefly';\ntype AIGatewayHeaders = {\n    'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;\n    'cf-aig-custom-cost': {\n        per_token_in?: number;\n        per_token_out?: number;\n    } | {\n        total_cost?: number;\n    } | string;\n    'cf-aig-cache-ttl': number | string;\n    'cf-aig-skip-cache': boolean | string;\n    'cf-aig-cache-key': string;\n    'cf-aig-event-id': string;\n    'cf-aig-request-timeout': number | string;\n    'cf-aig-max-attempts': number | string;\n    'cf-aig-retry-delay': number | string;\n    'cf-aig-backoff': string;\n    'cf-aig-collect-log': boolean | string;\n    Authorization: string;\n    'Content-Type': string;\n    [key: string]: string | number | boolean | object;\n};\ntype AIGatewayUniversalRequest = {\n    provider: AIGatewayProviders | string; // eslint-disable-line\n    endpoint: string;\n    headers: Partial<AIGatewayHeaders>;\n    query: unknown;\n};\ninterface AiGatewayInternalError extends Error {\n}\ninterface AiGatewayLogNotFound extends Error {\n}\ndeclare abstract class AiGateway {\n    patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;\n    getLog(logId: string): Promise<AiGatewayLog>;\n    run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {\n        gateway?: UniversalGatewayOptions;\n        extraHeaders?: object;\n    }): Promise<Response>;\n    getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.\n * @see AiSearchInternalError\n */\ninterface AutoRAGInternalError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.\n * @see AiSearchNotFoundError\n */\ninterface AutoRAGNotFoundError extends Error {\n}\n/**\n * @deprecated This error type is no longer used in the AI Search API.\n */\ninterface AutoRAGUnauthorizedError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.\n * @see AiSearchNameNotSetError\n */\ninterface AutoRAGNameNotSetError extends Error {\n}\ntype ComparisonFilter = {\n    key: string;\n    type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';\n    value: string | number | boolean;\n};\ntype CompoundFilter = {\n    type: 'and' | 'or';\n    filters: ComparisonFilter[];\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchRequest with the new API instead.\n * @see AiSearchSearchRequest\n */\ntype AutoRagSearchRequest = {\n    query: string;\n    filters?: CompoundFilter | ComparisonFilter;\n    max_num_results?: number;\n    ranking_options?: {\n        ranker?: string;\n        score_threshold?: number;\n    };\n    reranking?: {\n        enabled?: boolean;\n        model?: string;\n    };\n    rewrite_query?: boolean;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with the new API instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequest = AutoRagSearchRequest & {\n    stream?: boolean;\n    system_prompt?: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with stream: true instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {\n    stream: true;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchResponse with the new API instead.\n * @see AiSearchSearchResponse\n */\ntype AutoRagSearchResponse = {\n    object: 'vector_store.search_results.page';\n    search_query: string;\n    data: {\n        file_id: string;\n        filename: string;\n        score: number;\n        attributes: Record<string, string | number | boolean | null>;\n        content: {\n            type: 'text';\n            text: string;\n        }[];\n    }[];\n    has_more: boolean;\n    next_page: string | null;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchListResponse with the new API instead.\n * @see AiSearchListResponse\n */\ntype AutoRagListResponse = {\n    id: string;\n    enable: boolean;\n    type: string;\n    source: string;\n    vectorize_name: string;\n    paused: boolean;\n    status: string;\n}[];\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * The new API returns different response formats for chat completions.\n */\ntype AutoRagAiSearchResponse = AutoRagSearchResponse & {\n    response: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use the new AI Search API instead: `env.AI.aiSearch`\n *\n * Migration guide:\n * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`\n * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n *\n * @see AiSearchAccountService\n * @see AiSearchInstanceService\n */\ndeclare abstract class AutoRAG {\n    /**\n     * @deprecated Use `env.AI.aiSearch.list()` instead.\n     * @see AiSearchAccountService.list\n     */\n    list(): Promise<AutoRagListResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.\n     * Note: The new API uses a messages array instead of a query string.\n     * @see AiSearchInstanceService.search\n     */\n    search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;\n}\ninterface BasicImageTransformations {\n    /**\n     * Maximum width in image pixels. The value must be an integer.\n     */\n    width?: number;\n    /**\n     * Maximum height in image pixels. The value must be an integer.\n     */\n    height?: number;\n    /**\n     * Resizing mode as a string. It affects interpretation of width and height\n     * options:\n     *  - scale-down: Similar to contain, but the image is never enlarged. If\n     *    the image is larger than given width or height, it will be resized.\n     *    Otherwise its original size will be kept.\n     *  - contain: Resizes to maximum size that fits within the given width and\n     *    height. If only a single dimension is given (e.g. only width), the\n     *    image will be shrunk or enlarged to exactly match that dimension.\n     *    Aspect ratio is always preserved.\n     *  - cover: Resizes (shrinks or enlarges) to fill the entire area of width\n     *    and height. If the image has an aspect ratio different from the ratio\n     *    of width and height, it will be cropped to fit.\n     *  - crop: The image will be shrunk and cropped to fit within the area\n     *    specified by width and height. The image will not be enlarged. For images\n     *    smaller than the given dimensions it's the same as scale-down. For\n     *    images larger than the given dimensions, it's the same as cover.\n     *    See also trim.\n     *  - pad: Resizes to the maximum size that fits within the given width and\n     *    height, and then fills the remaining area with a background color\n     *    (white by default). Use of this mode is not recommended, as the same\n     *    effect can be more efficiently achieved with the contain mode and the\n     *    CSS object-fit: contain property.\n     *  - squeeze: Stretches and deforms to the width and height given, even if it\n     *    breaks aspect ratio\n     */\n    fit?: \"scale-down\" | \"contain\" | \"cover\" | \"crop\" | \"pad\" | \"squeeze\";\n    /**\n     * Image segmentation using artificial intelligence models. Sets pixels not\n     * within selected segment area to transparent e.g \"foreground\" sets every\n     * background pixel as transparent.\n     */\n    segment?: \"foreground\";\n    /**\n     * When cropping with fit: \"cover\", this defines the side or point that should\n     * be left uncropped. The value is either a string\n     * \"left\", \"right\", \"top\", \"bottom\", \"auto\", or \"center\" (the default),\n     * or an object {x, y} containing focal point coordinates in the original\n     * image expressed as fractions ranging from 0.0 (top or left) to 1.0\n     * (bottom or right), 0.5 being the center. {fit: \"cover\", gravity: \"top\"} will\n     * crop bottom or left and right sides as necessary, but won’t crop anything\n     * from the top. {fit: \"cover\", gravity: {x:0.5, y:0.2}} will crop each side to\n     * preserve as much as possible around a point at 20% of the height of the\n     * source image.\n     */\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;\n    /**\n     * Background color to add underneath the image. Applies only to images with\n     * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),\n     * hsl(…), etc.)\n     */\n    background?: string;\n    /**\n     * Number of degrees (90, 180, 270) to rotate the image by. width and height\n     * options refer to axes after rotation.\n     */\n    rotate?: 0 | 90 | 180 | 270 | 360;\n}\ninterface BasicImageTransformationsGravityCoordinates {\n    x?: number;\n    y?: number;\n    mode?: 'remainder' | 'box-center';\n}\n/**\n * In addition to the properties you can set in the RequestInit dict\n * that you pass as an argument to the Request constructor, you can\n * set certain properties of a `cf` object to control how Cloudflare\n * features are applied to that new Request.\n *\n * Note: Currently, these properties cannot be tested in the\n * playground.\n */\ninterface RequestInitCfProperties extends Record<string, unknown> {\n    cacheEverything?: boolean;\n    /**\n     * A request's cache key is what determines if two requests are\n     * \"the same\" for caching purposes. If a request has the same cache key\n     * as some previous request, then we can serve the same cached response for\n     * both. (e.g. 'some-key')\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheKey?: string;\n    /**\n     * This allows you to append additional Cache-Tag response headers\n     * to the origin response without modifications to the origin server.\n     * This will allow for greater control over the Purge by Cache Tag feature\n     * utilizing changes only in the Workers process.\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheTags?: string[];\n    /**\n     * Force response to be cached for a given number of seconds. (e.g. 300)\n     */\n    cacheTtl?: number;\n    /**\n     * Force response to be cached for a given number of seconds based on the Origin status code.\n     * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })\n     */\n    cacheTtlByStatus?: Record<string, number>;\n    scrapeShield?: boolean;\n    apps?: boolean;\n    image?: RequestInitCfPropertiesImage;\n    minify?: RequestInitCfPropertiesImageMinify;\n    mirage?: boolean;\n    polish?: \"lossy\" | \"lossless\" | \"off\";\n    r2?: RequestInitCfPropertiesR2;\n    /**\n     * Redirects the request to an alternate origin server. You can use this,\n     * for example, to implement load balancing across several origins.\n     * (e.g.us-east.example.com)\n     *\n     * Note - For security reasons, the hostname set in resolveOverride must\n     * be proxied on the same Cloudflare zone of the incoming request.\n     * Otherwise, the setting is ignored. CNAME hosts are allowed, so to\n     * resolve to a host under a different domain or a DNS only domain first\n     * declare a CNAME record within your own zone’s DNS mapping to the\n     * external hostname, set proxy on Cloudflare, then set resolveOverride\n     * to point to that CNAME record.\n     */\n    resolveOverride?: string;\n}\ninterface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {\n    /**\n     * Absolute URL of the image file to use for the drawing. It can be any of\n     * the supported file formats. For drawing of watermarks or non-rectangular\n     * overlays we recommend using PNG or WebP images.\n     */\n    url: string;\n    /**\n     * Floating-point number between 0 (transparent) and 1 (opaque).\n     * For example, opacity: 0.5 makes overlay semitransparent.\n     */\n    opacity?: number;\n    /**\n     * - If set to true, the overlay image will be tiled to cover the entire\n     *   area. This is useful for stock-photo-like watermarks.\n     * - If set to \"x\", the overlay image will be tiled horizontally only\n     *   (form a line).\n     * - If set to \"y\", the overlay image will be tiled vertically only\n     *   (form a line).\n     */\n    repeat?: true | \"x\" | \"y\";\n    /**\n     * Position of the overlay image relative to a given edge. Each property is\n     * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10\n     * positions left side of the overlay 10 pixels from the left edge of the\n     * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom\n     * of the background image.\n     *\n     * Setting both left & right, or both top & bottom is an error.\n     *\n     * If no position is specified, the image will be centered.\n     */\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n}\ninterface RequestInitCfPropertiesImage extends BasicImageTransformations {\n    /**\n     * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it\n     * easier to specify higher-DPI sizes in <img srcset>.\n     */\n    dpr?: number;\n    /**\n     * Allows you to trim your image. Takes dpr into account and is performed before\n     * resizing or rotation.\n     *\n     * It can be used as:\n     * - left, top, right, bottom - it will specify the number of pixels to cut\n     *   off each side\n     * - width, height - the width/height you'd like to end up with - can be used\n     *   in combination with the properties above\n     * - border - this will automatically trim the surroundings of an image based on\n     *   it's color. It consists of three properties:\n     *    - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)\n     *    - tolerance: difference from color to treat as color\n     *    - keep: the number of pixels of border to keep\n     */\n    trim?: \"border\" | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n    /**\n     * Quality setting from 1-100 (useful values are in 60-90 range). Lower values\n     * make images look worse, but load faster. The default is 85. It applies only\n     * to JPEG and WebP images. It doesn’t have any effect on PNG.\n     */\n    quality?: number | \"low\" | \"medium-low\" | \"medium-high\" | \"high\";\n    /**\n     * Output format to generate. It can be:\n     *  - avif: generate images in AVIF format.\n     *  - webp: generate images in Google WebP format. Set quality to 100 to get\n     *    the WebP-lossless format.\n     *  - json: instead of generating an image, outputs information about the\n     *    image, in JSON format. The JSON object will contain image size\n     *    (before and after resizing), source image’s MIME type, file size, etc.\n     * - jpeg: generate images in JPEG format.\n     * - png: generate images in PNG format.\n     */\n    format?: \"avif\" | \"webp\" | \"json\" | \"jpeg\" | \"png\" | \"baseline-jpeg\" | \"png-force\" | \"svg\";\n    /**\n     * Whether to preserve animation frames from input files. Default is true.\n     * Setting it to false reduces animations to still images. This setting is\n     * recommended when enlarging images or processing arbitrary user content,\n     * because large GIF animations can weigh tens or even hundreds of megabytes.\n     * It is also useful to set anim:false when using format:\"json\" to get the\n     * response quicker without the number of frames.\n     */\n    anim?: boolean;\n    /**\n     * What EXIF data should be preserved in the output image. Note that EXIF\n     * rotation and embedded color profiles are always applied (\"baked in\" into\n     * the image), and aren't affected by this option. Note that if the Polish\n     * feature is enabled, all metadata may have been removed already and this\n     * option may have no effect.\n     *  - keep: Preserve most of EXIF metadata, including GPS location if there's\n     *    any.\n     *  - copyright: Only keep the copyright tag, and discard everything else.\n     *    This is the default behavior for JPEG files.\n     *  - none: Discard all invisible EXIF metadata. Currently WebP and PNG\n     *    output formats always discard metadata.\n     */\n    metadata?: \"keep\" | \"copyright\" | \"none\";\n    /**\n     * Strength of sharpening filter to apply to the image. Floating-point\n     * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a\n     * recommended value for downscaled images.\n     */\n    sharpen?: number;\n    /**\n     * Radius of a blur filter (approximate gaussian). Maximum supported radius\n     * is 250.\n     */\n    blur?: number;\n    /**\n     * Overlays are drawn in the order they appear in the array (last array\n     * entry is the topmost layer).\n     */\n    draw?: RequestInitCfPropertiesImageDraw[];\n    /**\n     * Fetching image from authenticated origin. Setting this property will\n     * pass authentication headers (Authorization, Cookie, etc.) through to\n     * the origin.\n     */\n    \"origin-auth\"?: \"share-publicly\";\n    /**\n     * Adds a border around the image. The border is added after resizing. Border\n     * width takes dpr into account, and can be specified either using a single\n     * width property, or individually for each side.\n     */\n    border?: {\n        color: string;\n        width: number;\n    } | {\n        color: string;\n        top: number;\n        right: number;\n        bottom: number;\n        left: number;\n    };\n    /**\n     * Increase brightness by a factor. A value of 1.0 equals no change, a value\n     * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.\n     * 0 is ignored.\n     */\n    brightness?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    contrast?: number;\n    /**\n     * Increase exposure by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.\n     */\n    gamma?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    saturation?: number;\n    /**\n     * Flips the images horizontally, vertically, or both. Flipping is applied before\n     * rotation, so if you apply flip=h,rotate=90 then the image will be flipped\n     * horizontally, then rotated by 90 degrees.\n     */\n    flip?: 'h' | 'v' | 'hv';\n    /**\n     * Slightly reduces latency on a cache miss by selecting a\n     * quickest-to-compress file format, at a cost of increased file size and\n     * lower image quality. It will usually override the format option and choose\n     * JPEG over WebP or AVIF. We do not recommend using this option, except in\n     * unusual circumstances like resizing uncacheable dynamically-generated\n     * images.\n     */\n    compression?: \"fast\";\n}\ninterface RequestInitCfPropertiesImageMinify {\n    javascript?: boolean;\n    css?: boolean;\n    html?: boolean;\n}\ninterface RequestInitCfPropertiesR2 {\n    /**\n     * Colo id of bucket that an object is stored in\n     */\n    bucketColoId?: number;\n}\n/**\n * Request metadata provided by Cloudflare's edge.\n */\ntype IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;\ninterface IncomingRequestCfPropertiesBase extends Record<string, unknown> {\n    /**\n     * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.\n     *\n     * @example 395747\n     */\n    asn?: number;\n    /**\n     * The organization which owns the ASN of the incoming request.\n     *\n     * @example \"Google Cloud\"\n     */\n    asOrganization?: string;\n    /**\n     * The original value of the `Accept-Encoding` header if Cloudflare modified it.\n     *\n     * @example \"gzip, deflate, br\"\n     */\n    clientAcceptEncoding?: string;\n    /**\n     * The number of milliseconds it took for the request to reach your worker.\n     *\n     * @example 22\n     */\n    clientTcpRtt?: number;\n    /**\n     * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)\n     * airport code of the data center that the request hit.\n     *\n     * @example \"DFW\"\n     */\n    colo: string;\n    /**\n     * Represents the upstream's response to a\n     * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)\n     * from cloudflare.\n     *\n     * For workers with no upstream, this will always be `1`.\n     *\n     * @example 3\n     */\n    edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;\n    /**\n     * The HTTP Protocol the request used.\n     *\n     * @example \"HTTP/2\"\n     */\n    httpProtocol: string;\n    /**\n     * The browser-requested prioritization information in the request object.\n     *\n     * If no information was set, defaults to the empty string `\"\"`\n     *\n     * @example \"weight=192;exclusive=0;group=3;group-weight=127\"\n     * @default \"\"\n     */\n    requestPriority: string;\n    /**\n     * The TLS version of the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"TLSv1.3\"\n     */\n    tlsVersion: string;\n    /**\n     * The cipher for the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"AEAD-AES128-GCM-SHA256\"\n     */\n    tlsCipher: string;\n    /**\n     * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.\n     *\n     * If the incoming request was served over plaintext (without TLS) this field is undefined.\n     */\n    tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;\n}\ninterface IncomingRequestCfPropertiesBotManagementBase {\n    /**\n     * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,\n     * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).\n     *\n     * @example 54\n     */\n    score: number;\n    /**\n     * A boolean value that is true if the request comes from a good bot, like Google or Bing.\n     * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).\n     */\n    verifiedBot: boolean;\n    /**\n     * A boolean value that is true if the request originates from a\n     * Cloudflare-verified proxy service.\n     */\n    corporateProxy: boolean;\n    /**\n     * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.\n     */\n    staticResource: boolean;\n    /**\n     * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).\n     */\n    detectionIds: number[];\n}\ninterface IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase;\n    /**\n     * Duplicate of `botManagement.score`.\n     *\n     * @deprecated\n     */\n    clientTrustScore: number;\n}\ninterface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase & {\n        /**\n         * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients\n         * across different destination IPs, Ports, and X509 certificates.\n         */\n        ja3Hash: string;\n    };\n}\ninterface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {\n    /**\n     * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).\n     *\n     * This field is only present if you have Cloudflare for SaaS enabled on your account\n     * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).\n     */\n    hostMetadata?: HostMetadata;\n}\ninterface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {\n    /**\n     * Information about the client certificate presented to Cloudflare.\n     *\n     * This is populated when the incoming request is served over TLS using\n     * either Cloudflare Access or API Shield (mTLS)\n     * and the presented SSL certificate has a valid\n     * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)\n     * (i.e., not `null` or `\"\"`).\n     *\n     * Otherwise, a set of placeholder values are used.\n     *\n     * The property `certPresented` will be set to `\"1\"` when\n     * the object is populated (i.e. the above conditions were met).\n     */\n    tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;\n}\n/**\n * Metadata about the request's TLS handshake\n */\ninterface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {\n    /**\n     * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    clientHandshake: string;\n    /**\n     * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    serverHandshake: string;\n    /**\n     * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    clientFinished: string;\n    /**\n     * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    serverFinished: string;\n}\n/**\n * Geographic data about the request's origin.\n */\ninterface IncomingRequestCfPropertiesGeographicInformation {\n    /**\n     * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.\n     *\n     * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `\"T1\"`, indicating a request that originated over TOR.\n     *\n     * If Cloudflare is unable to determine where the request originated this property is omitted.\n     *\n     * The country code `\"T1\"` is used for requests originating on TOR.\n     *\n     * @example \"GB\"\n     */\n    country?: Iso3166Alpha2Code | \"T1\";\n    /**\n     * If present, this property indicates that the request originated in the EU\n     *\n     * @example \"1\"\n     */\n    isEUCountry?: \"1\";\n    /**\n     * A two-letter code indicating the continent the request originated from.\n     *\n     * @example \"AN\"\n     */\n    continent?: ContinentCode;\n    /**\n     * The city the request originated from\n     *\n     * @example \"Austin\"\n     */\n    city?: string;\n    /**\n     * Postal code of the incoming request\n     *\n     * @example \"78701\"\n     */\n    postalCode?: string;\n    /**\n     * Latitude of the incoming request\n     *\n     * @example \"30.27130\"\n     */\n    latitude?: string;\n    /**\n     * Longitude of the incoming request\n     *\n     * @example \"-97.74260\"\n     */\n    longitude?: string;\n    /**\n     * Timezone of the incoming request\n     *\n     * @example \"America/Chicago\"\n     */\n    timezone?: string;\n    /**\n     * If known, the ISO 3166-2 name for the first level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"Texas\"\n     */\n    region?: string;\n    /**\n     * If known, the ISO 3166-2 code for the first-level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"TX\"\n     */\n    regionCode?: string;\n    /**\n     * Metro code (DMA) of the incoming request\n     *\n     * @example \"635\"\n     */\n    metroCode?: string;\n}\n/** Data about the incoming request's TLS certificate */\ninterface IncomingRequestCfPropertiesTLSClientAuth {\n    /** Always `\"1\"`, indicating that the certificate was presented */\n    certPresented: \"1\";\n    /**\n     * Result of certificate verification.\n     *\n     * @example \"FAILED:self signed certificate\"\n     */\n    certVerified: Exclude<CertVerificationStatus, \"NONE\">;\n    /** The presented certificate's revokation status.\n     *\n     * - A value of `\"1\"` indicates the certificate has been revoked\n     * - A value of `\"0\"` indicates the certificate has not been revoked\n     */\n    certRevoked: \"1\" | \"0\";\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDN: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDN: string;\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDNRFC2253: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDNRFC2253: string;\n    /** The certificate issuer's distinguished name (legacy policies) */\n    certIssuerDNLegacy: string;\n    /** The certificate subject's distinguished name (legacy policies) */\n    certSubjectDNLegacy: string;\n    /**\n     * The certificate's serial number\n     *\n     * @example \"00936EACBE07F201DF\"\n     */\n    certSerial: string;\n    /**\n     * The certificate issuer's serial number\n     *\n     * @example \"2489002934BDFEA34\"\n     */\n    certIssuerSerial: string;\n    /**\n     * The certificate's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certSKI: string;\n    /**\n     * The certificate issuer's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certIssuerSKI: string;\n    /**\n     * The certificate's SHA-1 fingerprint\n     *\n     * @example \"6b9109f323999e52259cda7373ff0b4d26bd232e\"\n     */\n    certFingerprintSHA1: string;\n    /**\n     * The certificate's SHA-256 fingerprint\n     *\n     * @example \"acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea\"\n     */\n    certFingerprintSHA256: string;\n    /**\n     * The effective starting date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotBefore: string;\n    /**\n     * The effective expiration date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotAfter: string;\n}\n/** Placeholder values for TLS Client Authorization */\ninterface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {\n    certPresented: \"0\";\n    certVerified: \"NONE\";\n    certRevoked: \"0\";\n    certIssuerDN: \"\";\n    certSubjectDN: \"\";\n    certIssuerDNRFC2253: \"\";\n    certSubjectDNRFC2253: \"\";\n    certIssuerDNLegacy: \"\";\n    certSubjectDNLegacy: \"\";\n    certSerial: \"\";\n    certIssuerSerial: \"\";\n    certSKI: \"\";\n    certIssuerSKI: \"\";\n    certFingerprintSHA1: \"\";\n    certFingerprintSHA256: \"\";\n    certNotBefore: \"\";\n    certNotAfter: \"\";\n}\n/** Possible outcomes of TLS verification */\ndeclare type CertVerificationStatus = \n/** Authentication succeeded */\n\"SUCCESS\"\n/** No certificate was presented */\n | \"NONE\"\n/** Failed because the certificate was self-signed */\n | \"FAILED:self signed certificate\"\n/** Failed because the certificate failed a trust chain check */\n | \"FAILED:unable to verify the first certificate\"\n/** Failed because the certificate not yet valid */\n | \"FAILED:certificate is not yet valid\"\n/** Failed because the certificate is expired */\n | \"FAILED:certificate has expired\"\n/** Failed for another unspecified reason */\n | \"FAILED\";\n/**\n * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.\n */\ndeclare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = 0 /** Unknown */ | 1 /** no keepalives (not found) */ | 2 /** no connection re-use, opening keepalive connection failed */ | 3 /** no connection re-use, keepalive accepted and saved */ | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ | 5; /** connection re-use, accepted by the origin server */\n/** ISO 3166-1 Alpha-2 codes */\ndeclare type Iso3166Alpha2Code = \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\";\n/** The 2-letter continent codes Cloudflare uses */\ndeclare type ContinentCode = \"AF\" | \"AN\" | \"AS\" | \"EU\" | \"NA\" | \"OC\" | \"SA\";\ntype CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;\ninterface D1Meta {\n    duration: number;\n    size_after: number;\n    rows_read: number;\n    rows_written: number;\n    last_row_id: number;\n    changed_db: boolean;\n    changes: number;\n    /**\n     * The region of the database instance that executed the query.\n     */\n    served_by_region?: string;\n    /**\n     * The three letters airport code of the colo that executed the query.\n     */\n    served_by_colo?: string;\n    /**\n     * True if-and-only-if the database instance that executed the query was the primary.\n     */\n    served_by_primary?: boolean;\n    timings?: {\n        /**\n         * The duration of the SQL query execution by the database instance. It doesn't include any network time.\n         */\n        sql_duration_ms: number;\n    };\n    /**\n     * Number of total attempts to execute the query, due to automatic retries.\n     * Note: All other fields in the response like `timings` only apply to the last attempt.\n     */\n    total_attempts?: number;\n}\ninterface D1Response {\n    success: true;\n    meta: D1Meta & Record<string, unknown>;\n    error?: never;\n}\ntype D1Result<T = unknown> = D1Response & {\n    results: T[];\n};\ninterface D1ExecResult {\n    count: number;\n    duration: number;\n}\ntype D1SessionConstraint = \n// Indicates that the first query should go to the primary, and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n'first-primary'\n// Indicates that the first query can go anywhere (primary or replica), and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n | 'first-unconstrained';\ntype D1SessionBookmark = string;\ndeclare abstract class D1Database {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    exec(query: string): Promise<D1ExecResult>;\n    /**\n     * Creates a new D1 Session anchored at the given constraint or the bookmark.\n     * All queries executed using the created session will have sequential consistency,\n     * meaning that all writes done through the session will be visible in subsequent reads.\n     *\n     * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.\n     */\n    withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;\n    /**\n     * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.\n     */\n    dump(): Promise<ArrayBuffer>;\n}\ndeclare abstract class D1DatabaseSession {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    /**\n     * @returns The latest session bookmark across all executed queries on the session.\n     *          If no query has been executed yet, `null` is returned.\n     */\n    getBookmark(): D1SessionBookmark | null;\n}\ndeclare abstract class D1PreparedStatement {\n    bind(...values: unknown[]): D1PreparedStatement;\n    first<T = unknown>(colName: string): Promise<T | null>;\n    first<T = Record<string, unknown>>(): Promise<T | null>;\n    run<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    all<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    raw<T = unknown[]>(options: {\n        columnNames: true;\n    }): Promise<[\n        string[],\n        ...T[]\n    ]>;\n    raw<T = unknown[]>(options?: {\n        columnNames?: false;\n    }): Promise<T[]>;\n}\n// `Disposable` was added to TypeScript's standard lib types in version 5.2.\n// To support older TypeScript versions, define an empty `Disposable` interface.\n// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,\n// but this will ensure type checking on older versions still passes.\n// TypeScript's interface merging will ensure our empty interface is effectively\n// ignored when `Disposable` is included in the standard lib.\ninterface Disposable {\n}\n/**\n * The returned data after sending an email\n */\ninterface EmailSendResult {\n    /**\n     * The Email Message ID\n     */\n    messageId: string;\n}\n/**\n * An email message that can be sent from a Worker.\n */\ninterface EmailMessage {\n    /**\n     * Envelope From attribute of the email message.\n     */\n    readonly from: string;\n    /**\n     * Envelope To attribute of the email message.\n     */\n    readonly to: string;\n}\n/**\n * An email message that is sent to a consumer Worker and can be rejected/forwarded.\n */\ninterface ForwardableEmailMessage extends EmailMessage {\n    /**\n     * Stream of the email message content.\n     */\n    readonly raw: ReadableStream<Uint8Array>;\n    /**\n     * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     */\n    readonly headers: Headers;\n    /**\n     * Size of the email message content.\n     */\n    readonly rawSize: number;\n    /**\n     * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.\n     * @param reason The reject reason.\n     * @returns void\n     */\n    setReject(reason: string): void;\n    /**\n     * Forward this email message to a verified destination address of the account.\n     * @param rcptTo Verified destination address.\n     * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     * @returns A promise that resolves when the email message is forwarded.\n     */\n    forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;\n    /**\n     * Reply to the sender of this email message with a new EmailMessage object.\n     * @param message The reply message.\n     * @returns A promise that resolves when the email message is replied.\n     */\n    reply(message: EmailMessage): Promise<EmailSendResult>;\n}\n/** A file attachment for an email message */\ntype EmailAttachment = {\n    disposition: 'inline';\n    contentId: string;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n} | {\n    disposition: 'attachment';\n    contentId?: undefined;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n};\n/** An Email Address */\ninterface EmailAddress {\n    name: string;\n    email: string;\n}\n/**\n * A binding that allows a Worker to send email messages.\n */\ninterface SendEmail {\n    send(message: EmailMessage): Promise<EmailSendResult>;\n    send(builder: {\n        from: string | EmailAddress;\n        to: string | string[];\n        subject: string;\n        replyTo?: string | EmailAddress;\n        cc?: string | string[];\n        bcc?: string | string[];\n        headers?: Record<string, string>;\n        text?: string;\n        html?: string;\n        attachments?: EmailAttachment[];\n    }): Promise<EmailSendResult>;\n}\ndeclare abstract class EmailEvent extends ExtendableEvent {\n    readonly message: ForwardableEmailMessage;\n}\ndeclare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ndeclare module \"cloudflare:email\" {\n    let _EmailMessage: {\n        prototype: EmailMessage;\n        new (from: string, to: string, raw: ReadableStream | string): EmailMessage;\n    };\n    export { _EmailMessage as EmailMessage };\n}\n/**\n * Hello World binding to serve as an explanatory example. DO NOT USE\n */\ninterface HelloWorldBinding {\n    /**\n     * Retrieve the current stored value\n     */\n    get(): Promise<{\n        value: string;\n        ms?: number;\n    }>;\n    /**\n     * Set a new stored value\n     */\n    set(value: string): Promise<void>;\n}\ninterface Hyperdrive {\n    /**\n     * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.\n     *\n     * Calling this method returns an identical socket to if you call\n     * `connect(\"host:port\")` using the `host` and `port` fields from this object.\n     * Pick whichever approach works better with your preferred DB client library.\n     *\n     * Note that this socket is not yet authenticated -- it's expected that your\n     * code (or preferably, the client library of your choice) will authenticate\n     * using the information in this class's readonly fields.\n     */\n    connect(): Socket;\n    /**\n     * A valid DB connection string that can be passed straight into the typical\n     * client library/driver/ORM. This will typically be the easiest way to use\n     * Hyperdrive.\n     */\n    readonly connectionString: string;\n    /*\n     * A randomly generated hostname that is only valid within the context of the\n     * currently running Worker which, when passed into `connect()` function from\n     * the \"cloudflare:sockets\" module, will connect to the Hyperdrive instance\n     * for your database.\n     */\n    readonly host: string;\n    /*\n     * The port that must be paired the the host field when connecting.\n     */\n    readonly port: number;\n    /*\n     * The username to use when authenticating to your database via Hyperdrive.\n     * Unlike the host and password, this will be the same every time\n     */\n    readonly user: string;\n    /*\n     * The randomly generated password to use when authenticating to your\n     * database via Hyperdrive. Like the host field, this password is only valid\n     * within the context of the currently running Worker instance from which\n     * it's read.\n     */\n    readonly password: string;\n    /*\n     * The name of the database to connect to.\n     */\n    readonly database: string;\n}\n// Copyright (c) 2024 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ntype ImageInfoResponse = {\n    format: 'image/svg+xml';\n} | {\n    format: string;\n    fileSize: number;\n    width: number;\n    height: number;\n};\ntype ImageTransform = {\n    width?: number;\n    height?: number;\n    background?: string;\n    blur?: number;\n    border?: {\n        color?: string;\n        width?: number;\n    } | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n    };\n    brightness?: number;\n    contrast?: number;\n    fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';\n    flip?: 'h' | 'v' | 'hv';\n    gamma?: number;\n    segment?: 'foreground';\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {\n        x?: number;\n        y?: number;\n        mode: 'remainder' | 'box-center';\n    };\n    rotate?: 0 | 90 | 180 | 270;\n    saturation?: number;\n    sharpen?: number;\n    trim?: 'border' | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n};\ntype ImageDrawOptions = {\n    opacity?: number;\n    repeat?: boolean | string;\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n};\ntype ImageInputOptions = {\n    encoding?: 'base64';\n};\ntype ImageOutputOptions = {\n    format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';\n    quality?: number;\n    background?: string;\n    anim?: boolean;\n};\ninterface ImageMetadata {\n    id: string;\n    filename?: string;\n    uploaded?: string;\n    requireSignedURLs: boolean;\n    meta?: Record<string, unknown>;\n    variants: string[];\n    draft?: boolean;\n    creator?: string;\n}\ninterface ImageUploadOptions {\n    id?: string;\n    filename?: string;\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n    encoding?: 'base64';\n}\ninterface ImageUpdateOptions {\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n}\ninterface ImageListOptions {\n    limit?: number;\n    cursor?: string;\n    sortOrder?: 'asc' | 'desc';\n    creator?: string;\n}\ninterface ImageList {\n    images: ImageMetadata[];\n    cursor?: string;\n    listComplete: boolean;\n}\ninterface HostedImagesBinding {\n    /**\n     * Get detailed metadata for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns Image metadata, or null if not found\n     */\n    details(imageId: string): Promise<ImageMetadata | null>;\n    /**\n     * Get the raw image data for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns ReadableStream of image bytes, or null if not found\n     */\n    image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;\n    /**\n     * Upload a new hosted image\n     * @param image The image file to upload\n     * @param options Upload configuration\n     * @returns Metadata for the uploaded image\n     * @throws {@link ImagesError} if upload fails\n     */\n    upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;\n    /**\n     * Update hosted image metadata\n     * @param imageId The ID of the image\n     * @param options Properties to update\n     * @returns Updated image metadata\n     * @throws {@link ImagesError} if update fails\n     */\n    update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;\n    /**\n     * Delete a hosted image\n     * @param imageId The ID of the image\n     * @returns True if deleted, false if not found\n     */\n    delete(imageId: string): Promise<boolean>;\n    /**\n     * List hosted images with pagination\n     * @param options List configuration\n     * @returns List of images with pagination info\n     * @throws {@link ImagesError} if list fails\n     */\n    list(options?: ImageListOptions): Promise<ImageList>;\n}\ninterface ImagesBinding {\n    /**\n     * Get image metadata (type, width and height)\n     * @throws {@link ImagesError} with code 9412 if input is not an image\n     * @param stream The image bytes\n     */\n    info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;\n    /**\n     * Begin applying a series of transformations to an image\n     * @param stream The image bytes\n     * @returns A transform handle\n     */\n    input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;\n    /**\n     * Access hosted images CRUD operations\n     */\n    readonly hosted: HostedImagesBinding;\n}\ninterface ImageTransformer {\n    /**\n     * Apply transform next, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param transform\n     */\n    transform(transform: ImageTransform): ImageTransformer;\n    /**\n     * Draw an image on this transformer, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param image The image (or transformer that will give the image) to draw\n     * @param options The options configuring how to draw the image\n     */\n    draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;\n    /**\n     * Retrieve the image that results from applying the transforms to the\n     * provided input\n     * @param options Options that apply to the output e.g. output format\n     */\n    output(options: ImageOutputOptions): Promise<ImageTransformationResult>;\n}\ntype ImageTransformationOutputOptions = {\n    encoding?: 'base64';\n};\ninterface ImageTransformationResult {\n    /**\n     * The image as a response, ready to store in cache or return to users\n     */\n    response(): Response;\n    /**\n     * The content type of the returned image\n     */\n    contentType(): string;\n    /**\n     * The bytes of the response\n     */\n    image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;\n}\ninterface ImagesError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\n/**\n * Media binding for transforming media streams.\n * Provides the entry point for media transformation operations.\n */\ninterface MediaBinding {\n    /**\n     * Creates a media transformer from an input stream.\n     * @param media - The input media bytes\n     * @returns A MediaTransformer instance for applying transformations\n     */\n    input(media: ReadableStream<Uint8Array>): MediaTransformer;\n}\n/**\n * Media transformer for applying transformation operations to media content.\n * Handles sizing, fitting, and other input transformation parameters.\n */\ninterface MediaTransformer {\n    /**\n     * Applies transformation options to the media content.\n     * @param transform - Configuration for how the media should be transformed\n     * @returns A generator for producing the transformed media output\n     */\n    transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Generator for producing media transformation results.\n * Configures the output format and parameters for the transformed media.\n */\ninterface MediaTransformationGenerator {\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Result of a media transformation operation.\n * Provides multiple ways to access the transformed media content.\n */\ninterface MediaTransformationResult {\n    /**\n     * Returns the transformed media as a readable stream of bytes.\n     * @returns A promise containing a readable stream with the transformed media\n     */\n    media(): Promise<ReadableStream<Uint8Array>>;\n    /**\n     * Returns the transformed media as an HTTP response object.\n     * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users\n     */\n    response(): Promise<Response>;\n    /**\n     * Returns the MIME type of the transformed media.\n     * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')\n     */\n    contentType(): Promise<string>;\n}\n/**\n * Configuration options for transforming media input.\n * Controls how the media should be resized and fitted.\n */\ntype MediaTransformationInputOptions = {\n    /** How the media should be resized to fit the specified dimensions */\n    fit?: 'contain' | 'cover' | 'scale-down';\n    /** Target width in pixels */\n    width?: number;\n    /** Target height in pixels */\n    height?: number;\n};\n/**\n * Configuration options for Media Transformations output.\n * Controls the format, timing, and type of the generated output.\n */\ntype MediaTransformationOutputOptions = {\n    /**\n     * Output mode determining the type of media to generate\n     */\n    mode?: 'video' | 'spritesheet' | 'frame' | 'audio';\n    /** Whether to include audio in the output */\n    audio?: boolean;\n    /**\n     * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').\n     */\n    time?: string;\n    /**\n     * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').\n     */\n    duration?: string;\n    /**\n     * Number of frames in the spritesheet.\n     */\n    imageCount?: number;\n    /**\n     * Output format for the generated media.\n     */\n    format?: 'jpg' | 'png' | 'm4a';\n};\n/**\n * Error object for media transformation operations.\n * Extends the standard Error interface with additional media-specific information.\n */\ninterface MediaError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ndeclare module 'cloudflare:node' {\n    interface NodeStyleServer {\n        listen(...args: unknown[]): this;\n        address(): {\n            port?: number | null | undefined;\n        };\n    }\n    export function httpServerHandler(port: number): ExportedHandler;\n    export function httpServerHandler(options: {\n        port: number;\n    }): ExportedHandler;\n    export function httpServerHandler(server: NodeStyleServer): ExportedHandler;\n}\ntype Params<P extends string = any> = Record<P, string | string[]>;\ntype EventContext<Env, P extends string, Data> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n};\ntype PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;\ntype EventPluginContext<Env, P extends string, Data, PluginArgs> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n    pluginArgs: PluginArgs;\n};\ntype PagesPluginFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>, PluginArgs = unknown> = (context: EventPluginContext<Env, Params, Data, PluginArgs>) => Response | Promise<Response>;\ndeclare module \"assets:*\" {\n    export const onRequest: PagesFunction;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ndeclare module \"cloudflare:pipelines\" {\n    export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {\n        protected env: Env;\n        protected ctx: ExecutionContext;\n        constructor(ctx: ExecutionContext, env: Env);\n        /**\n         * run receives an array of PipelineRecord which can be\n         * transformed and returned to the pipeline\n         * @param records Incoming records from the pipeline to be transformed\n         * @param metadata Information about the specific pipeline calling the transformation entrypoint\n         * @returns A promise containing the transformed PipelineRecord array\n         */\n        public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;\n    }\n    export type PipelineRecord = Record<string, unknown>;\n    export type PipelineBatchMetadata = {\n        pipelineId: string;\n        pipelineName: string;\n    };\n    export interface Pipeline<T extends PipelineRecord = PipelineRecord> {\n        /**\n         * The Pipeline interface represents the type of a binding to a Pipeline\n         *\n         * @param records The records to send to the pipeline\n         */\n        send(records: T[]): Promise<void>;\n    }\n}\n// PubSubMessage represents an incoming PubSub message.\n// The message includes metadata about the broker, the client, and the payload\n// itself.\n// https://developers.cloudflare.com/pub-sub/\ninterface PubSubMessage {\n    // Message ID\n    readonly mid: number;\n    // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT\n    readonly broker: string;\n    // The MQTT topic the message was sent on.\n    readonly topic: string;\n    // The client ID of the client that published this message.\n    readonly clientId: string;\n    // The unique identifier (JWT ID) used by the client to authenticate, if token\n    // auth was used.\n    readonly jti?: string;\n    // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker\n    // received the message from the client.\n    readonly receivedAt: number;\n    // An (optional) string with the MIME type of the payload, if set by the\n    // client.\n    readonly contentType: string;\n    // Set to 1 when the payload is a UTF-8 string\n    // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063\n    readonly payloadFormatIndicator: number;\n    // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.\n    // You can use payloadFormatIndicator to inspect this before decoding.\n    payload: string | Uint8Array;\n}\n// JsonWebKey extended by kid parameter\ninterface JsonWebKeyWithKid extends JsonWebKey {\n    // Key Identifier of the JWK\n    readonly kid: string;\n}\ninterface RateLimitOptions {\n    key: string;\n}\ninterface RateLimitOutcome {\n    success: boolean;\n}\ninterface RateLimit {\n    /**\n     * Rate limit a request based on the provided options.\n     * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/\n     * @returns A promise that resolves with the outcome of the rate limit.\n     */\n    limit(options: RateLimitOptions): Promise<RateLimitOutcome>;\n}\n// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need\n// to referenced by `Fetcher`. This is included in the \"importable\" version of the types which\n// strips all `module` blocks.\ndeclare namespace Rpc {\n    // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.\n    // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.\n    // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to\n    // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)\n    export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';\n    export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';\n    export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';\n    export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';\n    export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';\n    export interface RpcTargetBranded {\n        [__RPC_TARGET_BRAND]: never;\n    }\n    export interface WorkerEntrypointBranded {\n        [__WORKER_ENTRYPOINT_BRAND]: never;\n    }\n    export interface DurableObjectBranded {\n        [__DURABLE_OBJECT_BRAND]: never;\n    }\n    export interface WorkflowEntrypointBranded {\n        [__WORKFLOW_ENTRYPOINT_BRAND]: never;\n    }\n    export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;\n    // Types that can be used through `Stub`s\n    export type Stubable = RpcTargetBranded | ((...args: any[]) => any);\n    // Types that can be passed over RPC\n    // The reason for using a generic type here is to build a serializable subset of structured\n    //   cloneable composite types. This allows types defined with the \"interface\" keyword to pass the\n    //   serializable check as well. Otherwise, only types defined with the \"type\" keyword would pass.\n    type Serializable<T> = \n    // Structured cloneables\n    BaseType\n    // Structured cloneable composites\n     | Map<T extends Map<infer U, unknown> ? Serializable<U> : never, T extends Map<unknown, infer U> ? Serializable<U> : never> | Set<T extends Set<infer U> ? Serializable<U> : never> | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never> | {\n        [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;\n    }\n    // Special types\n     | Stub<Stubable>\n    // Serialized as stubs, see `Stubify`\n     | Stubable;\n    // Base type for all RPC stubs, including common memory management methods.\n    // `T` is used as a marker type for unwrapping `Stub`s later.\n    interface StubBase<T extends Stubable> extends Disposable {\n        [__RPC_STUB_BRAND]: T;\n        dup(): this;\n    }\n    export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;\n    // This represents all the types that can be sent as-is over an RPC boundary\n    type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;\n    // Recursively rewrite all `Stubable` types with `Stub`s\n    // prettier-ignore\n    type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, infer V> ? Map<Stubify<K>, Stubify<V>> : T extends Set<infer V> ? Set<Stubify<V>> : T extends Array<infer V> ? Array<Stubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Stubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: any;\n    } ? {\n        [K in keyof T]: Stubify<T[K]>;\n    } : T;\n    // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.\n    // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:\n    // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.\n    // prettier-ignore\n    type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infer K, infer V> ? Map<Unstubify<K>, Unstubify<V>> : T extends Set<infer V> ? Set<Unstubify<V>> : T extends Array<infer V> ? Array<Unstubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Unstubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: unknown;\n    } ? {\n        [K in keyof T]: Unstubify<T[K]>;\n    } : T;\n    type UnstubifyAll<A extends any[]> = {\n        [I in keyof A]: Unstubify<A[I]>;\n    };\n    // Utility type for adding `Provider`/`Disposable`s to `object` types only.\n    // Note `unknown & T` is equivalent to `T`.\n    type MaybeProvider<T> = T extends object ? Provider<T> : unknown;\n    type MaybeDisposable<T> = T extends object ? Disposable : unknown;\n    // Type for method return or property on an RPC interface.\n    // - Stubable types are replaced by stubs.\n    // - Serializable types are passed by value, with stubable types replaced by stubs\n    //   and a top-level `Disposer`.\n    // Everything else can't be passed over PRC.\n    // Technically, we use custom thenables here, but they quack like `Promise`s.\n    // Intersecting with `(Maybe)Provider` allows pipelining.\n    // prettier-ignore\n    type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;\n    // Type for method or property on an RPC interface.\n    // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.\n    // Unwrapping `Stub`s allows calling with `Stubable` arguments.\n    // For properties, rewrite types to be `Result`s.\n    // In each case, unwrap `Promise`s.\n    type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;\n    // Type for the callable part of an `Provider` if `T` is callable.\n    // This is intersected with methods/properties.\n    type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;\n    // Base type for all other types providing RPC-like interfaces.\n    // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.\n    // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.\n    export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{\n        [K in keyof T]: MethodOrProperty<T[K]>;\n    }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;\n}\ndeclare namespace Cloudflare {\n    // Type of `env`.\n    //\n    // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript\n    // will merge all declarations.\n    //\n    // You can use `wrangler types` to generate the `Env` type automatically.\n    interface Env {\n    }\n    // Project-specific parameters used to inform types.\n    //\n    // This interface is, again, intended to be declared in project-specific files, and then that\n    // declaration will be merged with this one.\n    //\n    // A project should have a declaration like this:\n    //\n    //     interface GlobalProps {\n    //       // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type\n    //       // of `ctx.exports`.\n    //       mainModule: typeof import(\"my-main-module\");\n    //\n    //       // Declares which of the main module's exports are configured with durable storage, and\n    //       // thus should behave as Durable Object namsepace bindings.\n    //       durableNamespaces: \"MyDurableObject\" | \"AnotherDurableObject\";\n    //     }\n    //\n    // You can use `wrangler types` to generate `GlobalProps` automatically.\n    interface GlobalProps {\n    }\n    // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not\n    // present.\n    type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;\n    // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the\n    // `mainModule` property.\n    type MainModule = GlobalProp<\"mainModule\", {}>;\n    // The type of ctx.exports, which contains loopback bindings for all top-level exports.\n    type Exports = {\n        [K in keyof MainModule]: LoopbackForExport<MainModule[K]>\n        // If the export is listed in `durableNamespaces`, then it is also a\n        // DurableObjectNamespace.\n         & (K extends GlobalProp<\"durableNamespaces\", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});\n    };\n}\ndeclare namespace CloudflareWorkersModule {\n    export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;\n    export const RpcStub: {\n        new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;\n    };\n    export abstract class RpcTarget implements Rpc.RpcTargetBranded {\n        [Rpc.__RPC_TARGET_BRAND]: never;\n    }\n    // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC\n    export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {\n        [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext<Props>;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        email?(message: ForwardableEmailMessage): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        queue?(batch: MessageBatch<unknown>): void | Promise<void>;\n        scheduled?(controller: ScheduledController): void | Promise<void>;\n        tail?(events: TraceItem[]): void | Promise<void>;\n        tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\n        test?(controller: TestController): void | Promise<void>;\n        trace?(traces: TraceItem[]): void | Promise<void>;\n    }\n    export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {\n        [Rpc.__DURABLE_OBJECT_BRAND]: never;\n        protected ctx: DurableObjectState<Props>;\n        protected env: Env;\n        constructor(ctx: DurableObjectState, env: Env);\n        alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n        webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n        webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n    }\n    export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n    export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\n    export type WorkflowDelayDuration = WorkflowSleepDuration;\n    export type WorkflowTimeoutDuration = WorkflowSleepDuration;\n    export type WorkflowRetentionDuration = WorkflowSleepDuration;\n    export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';\n    export type WorkflowStepConfig = {\n        retries?: {\n            limit: number;\n            delay: WorkflowDelayDuration | number;\n            backoff?: WorkflowBackoff;\n        };\n        timeout?: WorkflowTimeoutDuration | number;\n    };\n    export type WorkflowEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        instanceId: string;\n    };\n    export type WorkflowStepEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        type: string;\n    };\n    export type WorkflowStepContext = {\n        attempt: number;\n    };\n    export abstract class WorkflowStep {\n        do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;\n        sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;\n        waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {\n            type: string;\n            timeout?: WorkflowTimeoutDuration | number;\n        }): Promise<WorkflowStepEvent<T>>;\n    }\n    export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';\n    export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {\n        [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;\n    }\n    export function waitUntil(promise: Promise<unknown>): void;\n    export function withEnv(newEnv: unknown, fn: () => unknown): unknown;\n    export function withExports(newExports: unknown, fn: () => unknown): unknown;\n    export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;\n    export const env: Cloudflare.Env;\n    export const exports: Cloudflare.Exports;\n}\ndeclare module 'cloudflare:workers' {\n    export = CloudflareWorkersModule;\n}\ninterface SecretsStoreSecret {\n    /**\n     * Get a secret from the Secrets Store, returning a string of the secret value\n     * if it exists, or throws an error if it does not exist\n     */\n    get(): Promise<string>;\n}\ndeclare module \"cloudflare:sockets\" {\n    function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;\n    export { _connect as connect };\n}\n/**\n * Binding entrypoint for Cloudflare Stream.\n *\n * Usage:\n * - Binding-level operations:\n *   `await env.STREAM.videos.upload`\n *   `await env.STREAM.videos.createDirectUpload`\n *   `await env.STREAM.videos.*`\n *   `await env.STREAM.watermarks.*`\n * - Per-video operations:\n *   `await env.STREAM.video(id).downloads.*`\n *   `await env.STREAM.video(id).captions.*`\n *\n * Example usage:\n * ```ts\n * await env.STREAM.video(id).downloads.generate();\n *\n * const video = env.STREAM.video(id)\n * const captions = video.captions.list();\n * const videoDetails = video.details()\n * ```\n */\ninterface StreamBinding {\n    /**\n     * Returns a handle scoped to a single video for per-video operations.\n     * @param id The unique identifier for the video.\n     * @returns A handle for per-video operations.\n     */\n    video(id: string): StreamVideoHandle;\n    /**\n     * Uploads a new video from a File.\n     * @param file The video file to upload.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(file: File): Promise<StreamVideo>;\n    /**\n     * Uploads a new video from a provided URL.\n     * @param url The URL to upload from.\n     * @param params Optional upload parameters.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {AlreadyUploadedError} if a video was already uploaded to this URL\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;\n    /**\n     * Creates a direct upload that allows video uploads without an API key.\n     * @param params Parameters for the direct upload\n     * @returns The direct upload details.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;\n    videos: StreamVideos;\n    watermarks: StreamWatermarks;\n}\n/**\n * Handle for operations scoped to a single Stream video.\n */\ninterface StreamVideoHandle {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * Get a full videos details\n     * @returns The full video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    details(): Promise<StreamVideo>;\n    /**\n     * Update details for a single video.\n     * @param params The fields to update for the video.\n     * @returns The updated video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    update(params: StreamUpdateVideoParams): Promise<StreamVideo>;\n    /**\n     * Deletes a video and its copies from Cloudflare Stream.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(): Promise<void>;\n    /**\n     * Creates a signed URL token for a video.\n     * @returns The signed token that was created.\n     * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed\n     */\n    generateToken(): Promise<string>;\n    downloads: StreamScopedDownloads;\n    captions: StreamScopedCaptions;\n}\ninterface StreamVideo {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator: string | null;\n    /**\n     * The thumbnail URL for the video.\n     */\n    thumbnail: string;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct: number;\n    /**\n     * Indicates whether the video is ready to stream.\n     */\n    readyToStream: boolean;\n    /**\n     * The date and time the video became ready to stream.\n     */\n    readyToStreamAt: string | null;\n    /**\n     * Processing status information.\n     */\n    status: StreamVideoStatus;\n    /**\n     * A user modifiable key-value store.\n     */\n    meta: Record<string, string>;\n    /**\n     * The date and time the video was created.\n     */\n    created: string;\n    /**\n     * The date and time the video was last modified.\n     */\n    modified: string;\n    /**\n     * The date and time at which the video will be deleted.\n     */\n    scheduledDeletion: string | null;\n    /**\n     * The size of the video in bytes.\n     */\n    size: number;\n    /**\n     * The preview URL for the video.\n     */\n    preview?: string;\n    /**\n     * Origins allowed to display the video.\n     */\n    allowedOrigins: Array<string>;\n    /**\n     * Indicates whether signed URLs are required.\n     */\n    requireSignedURLs: boolean | null;\n    /**\n     * The date and time the video was uploaded.\n     */\n    uploaded: string | null;\n    /**\n     * The date and time when the upload URL expires.\n     */\n    uploadExpiry: string | null;\n    /**\n     * The maximum size in bytes for direct uploads.\n     */\n    maxSizeBytes: number | null;\n    /**\n     * The maximum duration in seconds for direct uploads.\n     */\n    maxDurationSeconds: number | null;\n    /**\n     * The video duration in seconds. -1 indicates unknown.\n     */\n    duration: number;\n    /**\n     * Input metadata for the original upload.\n     */\n    input: StreamVideoInput;\n    /**\n     * Playback URLs for the video.\n     */\n    hlsPlaybackUrl: string;\n    dashPlaybackUrl: string;\n    /**\n     * The watermark applied to the video, if any.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The live input id associated with the video, if any.\n     */\n    liveInputId?: string | null;\n    /**\n     * The source video id if this is a clip.\n     */\n    clippedFromId: string | null;\n    /**\n     * Public details associated with the video.\n     */\n    publicDetails: StreamPublicDetails | null;\n}\ntype StreamVideoStatus = {\n    /**\n     * The current processing state.\n     */\n    state: string;\n    /**\n     * The current processing step.\n     */\n    step?: string;\n    /**\n     * The percent complete as a string.\n     */\n    pctComplete?: string;\n    /**\n     * An error reason code, if applicable.\n     */\n    errorReasonCode: string;\n    /**\n     * An error reason text, if applicable.\n     */\n    errorReasonText: string;\n};\ntype StreamVideoInput = {\n    /**\n     * The input width in pixels.\n     */\n    width: number;\n    /**\n     * The input height in pixels.\n     */\n    height: number;\n};\ntype StreamPublicDetails = {\n    /**\n     * The public title for the video.\n     */\n    title: string | null;\n    /**\n     * The public share link.\n     */\n    share_link: string | null;\n    /**\n     * The public channel link.\n     */\n    channel_link: string | null;\n    /**\n     * The public logo URL.\n     */\n    logo: string | null;\n};\ntype StreamDirectUpload = {\n    /**\n     * The URL an unauthenticated upload can use for a single multipart request.\n     */\n    uploadURL: string;\n    /**\n     * A Cloudflare-generated unique identifier for a media item.\n     */\n    id: string;\n    /**\n     * The watermark profile applied to the upload.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The scheduled deletion time, if any.\n     */\n    scheduledDeletion: string | null;\n};\ntype StreamDirectUploadCreateParams = {\n    /**\n     * The maximum duration in seconds for a video upload.\n     */\n    maxDurationSeconds: number;\n    /**\n     * The date and time after upload when videos will not be accepted.\n     */\n    expiry?: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of record for\n     * managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Lists the origins allowed to display the video.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * Indicates whether the video can be accessed using the id. When set to `true`,\n     * a signed token must be generated with a signing key to view the video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The date and time at which the video will be deleted. Include `null` to remove\n     * a scheduled deletion.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The watermark profile to apply.\n     */\n    watermark?: StreamDirectUploadWatermark;\n};\ntype StreamDirectUploadWatermark = {\n    /**\n     * The unique identifier for the watermark profile.\n     */\n    id: string;\n};\ntype StreamUrlUploadParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The identifier for the watermark profile\n     */\n    watermarkId?: string;\n};\ninterface StreamScopedCaptions {\n    /**\n     * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.\n     * One caption or subtitle file per language is allowed.\n     * @param language The BCP 47 language tag for the caption or subtitle.\n     * @param file The caption or subtitle file to upload.\n     * @returns The created caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language or file is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(language: string, file: File): Promise<StreamCaption>;\n    /**\n     * Generate captions or subtitles for the provided language via AI.\n     * @param language The BCP 47 language tag to generate.\n     * @returns The generated caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language is invalid\n     * @throws {StreamError} if a generated caption already exists\n     * @throws {StreamError} if the video duration is too long\n     * @throws {StreamError} if the video is missing audio\n     * @throws {StreamError} if the requested language is not supported\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(language: string): Promise<StreamCaption>;\n    /**\n     * Lists the captions or subtitles.\n     * Use the language parameter to filter by a specific language.\n     * @param language The optional BCP 47 language tag to filter by.\n     * @returns The list of captions or subtitles.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(language?: string): Promise<StreamCaption[]>;\n    /**\n     * Removes the captions or subtitles from a video.\n     * @param language The BCP 47 language tag to remove.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(language: string): Promise<void>;\n}\ninterface StreamScopedDownloads {\n    /**\n     * Generates a download for a video when a video is ready to view. Available\n     * types are `default` and `audio`. Defaults to `default` when omitted.\n     * @param downloadType The download type to create.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the download type is invalid\n     * @throws {StreamError} if the video duration is too long to generate a download\n     * @throws {StreamError} if the video is not ready to stream\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;\n    /**\n     * Lists the downloads created for a video.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(): Promise<StreamDownloadGetResponse>;\n    /**\n     * Delete the downloads for a video. Available types are `default` and `audio`.\n     * Defaults to `default` when omitted.\n     * @param downloadType The download type to delete.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(downloadType?: StreamDownloadType): Promise<void>;\n}\ninterface StreamVideos {\n    /**\n     * Lists all videos in a users account.\n     * @returns The list of videos.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(params?: StreamVideosListParams): Promise<StreamVideo[]>;\n}\ninterface StreamWatermarks {\n    /**\n     * Generate a new watermark profile\n     * @param file The image file to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(file: File, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Generate a new watermark profile\n     * @param url The image url to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Lists all watermark profiles for an account.\n     * @returns The list of watermark profiles.\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(): Promise<StreamWatermark[]>;\n    /**\n     * Retrieves details for a single watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns The watermark profile details.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(watermarkId: string): Promise<StreamWatermark>;\n    /**\n     * Deletes a watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(watermarkId: string): Promise<void>;\n}\ntype StreamUpdateVideoParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * The maximum duration in seconds for a video upload. Can be set for a\n     * video that is not yet uploaded to limit its duration. Uploads that exceed the\n     * specified duration will fail during processing. A value of `-1` means the value\n     * is unknown.\n     */\n    maxDurationSeconds?: number;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n};\ntype StreamCaption = {\n    /**\n     * Whether the caption was generated via AI.\n     */\n    generated?: boolean;\n    /**\n     * The language label displayed in the native language to users.\n     */\n    label: string;\n    /**\n     * The language tag in BCP 47 format.\n     */\n    language: string;\n    /**\n     * The status of a generated caption.\n     */\n    status?: 'ready' | 'inprogress' | 'error';\n};\ntype StreamDownloadStatus = 'ready' | 'inprogress' | 'error';\ntype StreamDownloadType = 'default' | 'audio';\ntype StreamDownload = {\n    /**\n     * Indicates the progress as a percentage between 0 and 100.\n     */\n    percentComplete: number;\n    /**\n     * The status of a generated download.\n     */\n    status: StreamDownloadStatus;\n    /**\n     * The URL to access the generated download.\n     */\n    url?: string;\n};\n/**\n * An object with download type keys. Each key is optional and only present if that\n * download type has been created.\n */\ntype StreamDownloadGetResponse = {\n    /**\n     * The audio-only download. Only present if this download type has been created.\n     */\n    audio?: StreamDownload;\n    /**\n     * The default video download. Only present if this download type has been created.\n     */\n    default?: StreamDownload;\n};\ntype StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';\ntype StreamWatermark = {\n    /**\n     * The unique identifier for a watermark profile.\n     */\n    id: string;\n    /**\n     * The size of the image in bytes.\n     */\n    size: number;\n    /**\n     * The height of the image in pixels.\n     */\n    height: number;\n    /**\n     * The width of the image in pixels.\n     */\n    width: number;\n    /**\n     * The date and a time a watermark profile was created.\n     */\n    created: string;\n    /**\n     * The source URL for a downloaded image. If the watermark profile was created via\n     * direct upload, this field is null.\n     */\n    downloadedFrom: string | null;\n    /**\n     * A short description of the watermark profile.\n     */\n    name: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the image\n     * is already semi-transparent, setting this to `1.0` will not make the image\n     * completely opaque.\n     */\n    opacity: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the video\n     * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded\n     * video width or length, as determined by the algorithm.\n     */\n    padding: number;\n    /**\n     * The size of the image relative to the overall size of the video. This parameter\n     * will adapt to horizontal and vertical videos automatically. `0.0` indicates no\n     * scaling (use the size of the image as-is), and `1.0 `fills the entire video.\n     */\n    scale: number;\n    /**\n     * The location of the image. Valid positions are: `upperRight`, `upperLeft`,\n     * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the\n     * `padding` parameter.\n     */\n    position: StreamWatermarkPosition;\n};\ntype StreamWatermarkCreateParams = {\n    /**\n     * A short description of the watermark profile.\n     */\n    name?: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the\n     * image is already semi-transparent, setting this to `1.0` will not make the\n     * image completely opaque.\n     */\n    opacity?: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the\n     * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully\n     * padded video width or length, as determined by the algorithm.\n     */\n    padding?: number;\n    /**\n     * The size of the image relative to the overall size of the video. This\n     * parameter will adapt to horizontal and vertical videos automatically. `0.0`\n     * indicates no scaling (use the size of the image as-is), and `1.0 `fills the\n     * entire video.\n     */\n    scale?: number;\n    /**\n     * The location of the image.\n     */\n    position?: StreamWatermarkPosition;\n};\ntype StreamVideosListParams = {\n    /**\n     * The maximum number of videos to return.\n     */\n    limit?: number;\n    /**\n     * Return videos created before this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    before?: string;\n    /**\n     * Comparison operator for the `before` field.\n     * @default 'lt'\n     */\n    beforeComp?: StreamPaginationComparison;\n    /**\n     * Return videos created after this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    after?: string;\n    /**\n     * Comparison operator for the `after` field.\n     * @default 'gte'\n     */\n    afterComp?: StreamPaginationComparison;\n};\ntype StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';\n/**\n * Error object for Stream binding operations.\n */\ninterface StreamError extends Error {\n    readonly code: number;\n    readonly statusCode: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ninterface InternalError extends StreamError {\n    name: 'InternalError';\n}\ninterface BadRequestError extends StreamError {\n    name: 'BadRequestError';\n}\ninterface NotFoundError extends StreamError {\n    name: 'NotFoundError';\n}\ninterface ForbiddenError extends StreamError {\n    name: 'ForbiddenError';\n}\ninterface RateLimitedError extends StreamError {\n    name: 'RateLimitedError';\n}\ninterface QuotaReachedError extends StreamError {\n    name: 'QuotaReachedError';\n}\ninterface MaxFileSizeError extends StreamError {\n    name: 'MaxFileSizeError';\n}\ninterface InvalidURLError extends StreamError {\n    name: 'InvalidURLError';\n}\ninterface AlreadyUploadedError extends StreamError {\n    name: 'AlreadyUploadedError';\n}\ninterface TooManyWatermarksError extends StreamError {\n    name: 'TooManyWatermarksError';\n}\ntype MarkdownDocument = {\n    name: string;\n    blob: Blob;\n};\ntype ConversionResponse = {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'markdown';\n    tokens: number;\n    data: string;\n} | {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'error';\n    error: string;\n};\ntype ImageConversionOptions = {\n    descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';\n};\ntype EmbeddedImageConversionOptions = ImageConversionOptions & {\n    convert?: boolean;\n    maxConvertedImages?: number;\n};\ntype ConversionOptions = {\n    html?: {\n        images?: EmbeddedImageConversionOptions & {\n            convertOGImage?: boolean;\n        };\n        hostname?: string;\n        cssSelector?: string;\n    };\n    docx?: {\n        images?: EmbeddedImageConversionOptions;\n    };\n    image?: ImageConversionOptions;\n    pdf?: {\n        images?: EmbeddedImageConversionOptions;\n        metadata?: boolean;\n    };\n};\ntype ConversionRequestOptions = {\n    gateway?: GatewayOptions;\n    extraHeaders?: object;\n    conversionOptions?: ConversionOptions;\n};\ntype SupportedFileFormat = {\n    mimeType: string;\n    extension: string;\n};\ndeclare abstract class ToMarkdownService {\n    transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n    supported(): Promise<SupportedFileFormat[]>;\n}\ndeclare namespace TailStream {\n    interface Header {\n        readonly name: string;\n        readonly value: string;\n    }\n    interface FetchEventInfo {\n        readonly type: \"fetch\";\n        readonly method: string;\n        readonly url: string;\n        readonly cfJson?: object;\n        readonly headers: Header[];\n    }\n    interface JsRpcEventInfo {\n        readonly type: \"jsrpc\";\n    }\n    interface ScheduledEventInfo {\n        readonly type: \"scheduled\";\n        readonly scheduledTime: Date;\n        readonly cron: string;\n    }\n    interface AlarmEventInfo {\n        readonly type: \"alarm\";\n        readonly scheduledTime: Date;\n    }\n    interface QueueEventInfo {\n        readonly type: \"queue\";\n        readonly queueName: string;\n        readonly batchSize: number;\n    }\n    interface EmailEventInfo {\n        readonly type: \"email\";\n        readonly mailFrom: string;\n        readonly rcptTo: string;\n        readonly rawSize: number;\n    }\n    interface TraceEventInfo {\n        readonly type: \"trace\";\n        readonly traces: (string | null)[];\n    }\n    interface HibernatableWebSocketEventInfoMessage {\n        readonly type: \"message\";\n    }\n    interface HibernatableWebSocketEventInfoError {\n        readonly type: \"error\";\n    }\n    interface HibernatableWebSocketEventInfoClose {\n        readonly type: \"close\";\n        readonly code: number;\n        readonly wasClean: boolean;\n    }\n    interface HibernatableWebSocketEventInfo {\n        readonly type: \"hibernatableWebSocket\";\n        readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;\n    }\n    interface CustomEventInfo {\n        readonly type: \"custom\";\n    }\n    interface FetchResponseInfo {\n        readonly type: \"fetch\";\n        readonly statusCode: number;\n    }\n    type EventOutcome = \"ok\" | \"canceled\" | \"exception\" | \"unknown\" | \"killSwitch\" | \"daemonDown\" | \"exceededCpu\" | \"exceededMemory\" | \"loadShed\" | \"responseStreamDisconnected\" | \"scriptNotFound\";\n    interface ScriptVersion {\n        readonly id: string;\n        readonly tag?: string;\n        readonly message?: string;\n    }\n    interface Onset {\n        readonly type: \"onset\";\n        readonly attributes: Attribute[];\n        // id for the span being opened by this Onset event.\n        readonly spanId: string;\n        readonly dispatchNamespace?: string;\n        readonly entrypoint?: string;\n        readonly executionModel: string;\n        readonly scriptName?: string;\n        readonly scriptTags?: string[];\n        readonly scriptVersion?: ScriptVersion;\n        readonly info: FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;\n    }\n    interface Outcome {\n        readonly type: \"outcome\";\n        readonly outcome: EventOutcome;\n        readonly cpuTime: number;\n        readonly wallTime: number;\n    }\n    interface SpanOpen {\n        readonly type: \"spanOpen\";\n        readonly name: string;\n        // id for the span being opened by this SpanOpen event.\n        readonly spanId: string;\n        readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;\n    }\n    interface SpanClose {\n        readonly type: \"spanClose\";\n        readonly outcome: EventOutcome;\n    }\n    interface DiagnosticChannelEvent {\n        readonly type: \"diagnosticChannel\";\n        readonly channel: string;\n        readonly message: any;\n    }\n    interface Exception {\n        readonly type: \"exception\";\n        readonly name: string;\n        readonly message: string;\n        readonly stack?: string;\n    }\n    interface Log {\n        readonly type: \"log\";\n        readonly level: \"debug\" | \"error\" | \"info\" | \"log\" | \"warn\";\n        readonly message: object;\n    }\n    interface DroppedEventsDiagnostic {\n        readonly diagnosticsType: \"droppedEvents\";\n        readonly count: number;\n    }\n    interface StreamDiagnostic {\n        readonly type: 'streamDiagnostic';\n        // To add new diagnostic types, define a new interface and add it to this union type.\n        readonly diagnostic: DroppedEventsDiagnostic;\n    }\n    // This marks the worker handler return information.\n    // This is separate from Outcome because the worker invocation can live for a long time after\n    // returning. For example - Websockets that return an http upgrade response but then continue\n    // streaming information or SSE http connections.\n    interface Return {\n        readonly type: \"return\";\n        readonly info?: FetchResponseInfo;\n    }\n    interface Attribute {\n        readonly name: string;\n        readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];\n    }\n    interface Attributes {\n        readonly type: \"attributes\";\n        readonly info: Attribute[];\n    }\n    type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;\n    // Context in which this trace event lives.\n    interface SpanContext {\n        // Single id for the entire top-level invocation\n        // This should be a new traceId for the first worker stage invoked in the eyeball request and then\n        // same-account service-bindings should reuse the same traceId but cross-account service-bindings\n        // should use a new traceId.\n        readonly traceId: string;\n        // spanId in which this event is handled\n        // for Onset and SpanOpen events this would be the parent span id\n        // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events\n        // For Hibernate and Mark this would be the span under which they were emitted.\n        // spanId is not set ONLY if:\n        //  1. This is an Onset event\n        //  2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)\n        readonly spanId?: string;\n    }\n    interface TailEvent<Event extends EventType> {\n        // invocation id of the currently invoked worker stage.\n        // invocation id will always be unique to every Onset event and will be the same until the Outcome event.\n        readonly invocationId: string;\n        // Inherited spanContext for this event.\n        readonly spanContext: SpanContext;\n        readonly timestamp: Date;\n        readonly sequence: number;\n        readonly event: Event;\n    }\n    type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;\n    type TailEventHandlerObject = {\n        outcome?: TailEventHandler<Outcome>;\n        spanOpen?: TailEventHandler<SpanOpen>;\n        spanClose?: TailEventHandler<SpanClose>;\n        diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;\n        exception?: TailEventHandler<Exception>;\n        log?: TailEventHandler<Log>;\n        return?: TailEventHandler<Return>;\n        attributes?: TailEventHandler<Attributes>;\n    };\n    type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\n/**\n * Data types supported for holding vector metadata.\n */\ntype VectorizeVectorMetadataValue = string | number | boolean | string[];\n/**\n * Additional information to associate with a vector.\n */\ntype VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;\ntype VectorFloatArray = Float32Array | Float64Array;\ninterface VectorizeError {\n    code?: number;\n    error: string;\n}\n/**\n * Comparison logic/operation to use for metadata filtering.\n *\n * This list is expected to grow as support for more operations are released.\n */\ntype VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';\ntype VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';\n/**\n * Filter criteria for vector metadata used to limit the retrieved query result set.\n */\ntype VectorizeVectorMetadataFilter = {\n    [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {\n        [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;\n    } | {\n        [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];\n    };\n};\n/**\n * Supported distance metrics for an index.\n * Distance metrics determine how other \"similar\" vectors are determined.\n */\ntype VectorizeDistanceMetric = \"euclidean\" | \"cosine\" | \"dot-product\";\n/**\n * Metadata return levels for a Vectorize query.\n *\n * Default to \"none\".\n *\n * @property all      Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.\n * @property indexed  Return all metadata fields configured for indexing in the vector return set. This level of retrieval is \"free\" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).\n * @property none     No indexed metadata will be returned.\n */\ntype VectorizeMetadataRetrievalLevel = \"all\" | \"indexed\" | \"none\";\ninterface VectorizeQueryOptions {\n    topK?: number;\n    namespace?: string;\n    returnValues?: boolean;\n    returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;\n    filter?: VectorizeVectorMetadataFilter;\n}\n/**\n * Information about the configuration of an index.\n */\ntype VectorizeIndexConfig = {\n    dimensions: number;\n    metric: VectorizeDistanceMetric;\n} | {\n    preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity\n};\n/**\n * Metadata about an existing index.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeIndexInfo} for its post-beta equivalent.\n */\ninterface VectorizeIndexDetails {\n    /** The unique ID of the index */\n    readonly id: string;\n    /** The name of the index. */\n    name: string;\n    /** (optional) A human readable description for the index. */\n    description?: string;\n    /** The index configuration, including the dimension size and distance metric. */\n    config: VectorizeIndexConfig;\n    /** The number of records containing vectors within the index. */\n    vectorsCount: number;\n}\n/**\n * Metadata about an existing index.\n */\ninterface VectorizeIndexInfo {\n    /** The number of records containing vectors within the index. */\n    vectorCount: number;\n    /** Number of dimensions the index has been configured for. */\n    dimensions: number;\n    /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToDatetime: number;\n    /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToMutation: number;\n}\n/**\n * Represents a single vector value set along with its associated metadata.\n */\ninterface VectorizeVector {\n    /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */\n    id: string;\n    /** The vector values */\n    values: VectorFloatArray | number[];\n    /** The namespace this vector belongs to. */\n    namespace?: string;\n    /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */\n    metadata?: Record<string, VectorizeVectorMetadata>;\n}\n/**\n * Represents a matched vector for a query along with its score and (if specified) the matching vector information.\n */\ntype VectorizeMatch = Pick<Partial<VectorizeVector>, \"values\"> & Omit<VectorizeVector, \"values\"> & {\n    /** The score or rank for similarity, when returned as a result */\n    score: number;\n};\n/**\n * A set of matching {@link VectorizeMatch} for a particular query.\n */\ninterface VectorizeMatches {\n    matches: VectorizeMatch[];\n    count: number;\n}\n/**\n * Results of an operation that performed a mutation on a set of vectors.\n * Here, `ids` is a list of vectors that were successfully processed.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeAsyncMutation} for its post-beta equivalent.\n */\ninterface VectorizeVectorMutation {\n    /* List of ids of vectors that were successfully processed. */\n    ids: string[];\n    /* Total count of the number of processed vectors. */\n    count: number;\n}\n/**\n * Result type indicating a mutation on the Vectorize Index.\n * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.\n */\ninterface VectorizeAsyncMutation {\n    /** The unique identifier for the async mutation operation containing the changeset. */\n    mutationId: string;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link Vectorize} for its new implementation.\n */\ndeclare abstract class VectorizeIndex {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexDetails>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * Mutations in this version are async, returning a mutation id.\n */\ndeclare abstract class Vectorize {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexInfo>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Use the provided vector-id to perform a similarity search across the index.\n     * @param vectorId Id for a vector in the index against which the index should be queried.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * The interface for \"version_metadata\" binding\n * providing metadata about the Worker Version using this binding.\n */\ntype WorkerVersionMetadata = {\n    /** The ID of the Worker Version using this binding */\n    id: string;\n    /** The tag of the Worker Version using this binding */\n    tag: string;\n    /** The timestamp of when the Worker Version was uploaded */\n    timestamp: string;\n};\ninterface DynamicDispatchLimits {\n    /**\n     * Limit CPU time in milliseconds.\n     */\n    cpuMs?: number;\n    /**\n     * Limit number of subrequests.\n     */\n    subRequests?: number;\n}\ninterface DynamicDispatchOptions {\n    /**\n     * Limit resources of invoked Worker script.\n     */\n    limits?: DynamicDispatchLimits;\n    /**\n     * Arguments for outbound Worker script, if configured.\n     */\n    outbound?: {\n        [key: string]: any;\n    };\n}\ninterface DispatchNamespace {\n    /**\n    * @param name Name of the Worker script.\n    * @param args Arguments to Worker script.\n    * @param options Options for Dynamic Dispatch invocation.\n    * @returns A Fetcher object that allows you to send requests to the Worker script.\n    * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.\n    */\n    get(name: string, args?: {\n        [key: string]: any;\n    }, options?: DynamicDispatchOptions): Fetcher;\n}\ndeclare module 'cloudflare:workflows' {\n    /**\n     * NonRetryableError allows for a user to throw a fatal error\n     * that makes a Workflow instance fail immediately without triggering a retry\n     */\n    export class NonRetryableError extends Error {\n        public constructor(message: string, name?: string);\n    }\n}\ndeclare abstract class Workflow<PARAMS = unknown> {\n    /**\n     * Get a handle to an existing instance of the Workflow.\n     * @param id Id for the instance of this Workflow\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public get(id: string): Promise<WorkflowInstance>;\n    /**\n     * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.\n     * @param options Options when creating an instance including id and params\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;\n    /**\n     * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.\n     * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.\n     * @param batch List of Options when creating an instance including name and params\n     * @returns A promise that resolves with a list of handles for the created instances.\n     */\n    public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;\n}\ntype WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\ntype WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\ntype WorkflowRetentionDuration = WorkflowSleepDuration;\ninterface WorkflowInstanceCreateOptions<PARAMS = unknown> {\n    /**\n     * An id for your Workflow instance. Must be unique within the Workflow.\n     */\n    id?: string;\n    /**\n     * The event payload the Workflow instance is triggered with\n     */\n    params?: PARAMS;\n    /**\n     * The retention policy for Workflow instance.\n     * Defaults to the maximum retention period available for the owner's account.\n     */\n    retention?: {\n        successRetention?: WorkflowRetentionDuration;\n        errorRetention?: WorkflowRetentionDuration;\n    };\n}\ntype InstanceStatus = {\n    status: 'queued' // means that instance is waiting to be started (see concurrency limits)\n     | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running\n     | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish\n     | 'waitingForPause' // instance is finishing the current work to pause\n     | 'unknown';\n    error?: {\n        name: string;\n        message: string;\n    };\n    output?: unknown;\n};\ninterface WorkflowError {\n    code?: number;\n    message: string;\n}\ndeclare abstract class WorkflowInstance {\n    public id: string;\n    /**\n     * Pause the instance.\n     */\n    public pause(): Promise<void>;\n    /**\n     * Resume the instance. If it is already running, an error will be thrown.\n     */\n    public resume(): Promise<void>;\n    /**\n     * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.\n     */\n    public terminate(): Promise<void>;\n    /**\n     * Restart the instance.\n     */\n    public restart(): Promise<void>;\n    /**\n     * Returns the current status of the instance.\n     */\n    public status(): Promise<InstanceStatus>;\n    /**\n     * Send an event to this instance.\n     */\n    public sendEvent({ type, payload, }: {\n        type: string;\n        payload: unknown;\n    }): Promise<void>;\n}\n"
  },
  {
    "path": "examples/react/start-basic-cloudflare/wrangler.jsonc",
    "content": "{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"tanstack-start-app\",\n  \"compatibility_date\": \"2025-09-24\",\n  \"compatibility_flags\": [\"nodejs_compat\"],\n  \"main\": \"@tanstack/react-start/server-entry\",\n  \"vars\": {\n    \"MY_VAR\": \"Hello from Cloudflare\",\n  },\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/start-basic-react-query/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-basic-react-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/README.md",
    "content": "# TanStack Start - Basic React Query Example\n\nA TanStack Start example demonstrating integration with TanStack Query (React Query).\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [TanStack Query Docs](https://tanstack.com/query)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-basic-react-query start-basic-react-query\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## TanStack Query Integration\n\nThis example demonstrates how to use TanStack Query with TanStack Start for:\n\n- Server-side data fetching\n- Client-side caching and synchronization\n- Optimistic updates\n- Automatic refetching\n"
  },
  {
    "path": "examples/react/start-basic-react-query/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-basic-react-query\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-router-ssr-query\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as UsersRouteRouteImport } from './routes/users.route'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersIdRouteImport } from './routes/api/users.$id'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersRouteRoute = UsersRouteRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRouteRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersIdRoute = ApiUsersIdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/users': typeof UsersRouteRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/users': typeof UsersRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/users'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/users'\n    | '/_pathlessLayout'\n    | '/deferred'\n    | '/redirect'\n    | '/_pathlessLayout/_nested-layout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/api/users/$id'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  UsersRouteRoute: typeof UsersRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  RedirectRoute: typeof RedirectRoute\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRouteRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$id': {\n      id: '/api/users/$id'\n      path: '/$id'\n      fullPath: '/api/users/$id'\n      preLoaderRoute: typeof ApiUsersIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface UsersRouteRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteRouteChildren: UsersRouteRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteRouteWithChildren = UsersRouteRoute._addFileChildren(\n  UsersRouteRouteChildren,\n)\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersIdRoute: typeof ApiUsersIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersIdRoute: ApiUsersIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  UsersRouteRoute: UsersRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  RedirectRoute: RedirectRoute,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/react-query'\nimport { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <ReactQueryDevtools buttonPosition=\"bottom-left\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div className=\"flex gap-2\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div>I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/api/users.$id.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport type { User } from '../../utils/users'\n\nexport const Route = createFileRoute('/api/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        console.info(`Fetching users by id=${params.id}... @`, request.url)\n        try {\n          const res = await axios.get<User>(\n            'https://jsonplaceholder.typicode.com/users/' + params.id,\n          )\n          return Response.json({\n            id: res.data.id,\n            name: res.data.name,\n            email: res.data.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport type { User } from '../../utils/users'\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await axios.get<Array<User>>(\n          'https://jsonplaceholder.typicode.com/users',\n        )\n        const list = res.data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/deferred.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { queryOptions, useSuspenseQuery } from '@tanstack/react-query'\nimport {} from '@tanstack/react-router'\nimport { Suspense, useState } from 'react'\n\nconst deferredQueryOptions = () =>\n  queryOptions({\n    queryKey: ['deferred'],\n    queryFn: async () => {\n      await new Promise((r) => setTimeout(r, 3000))\n      return {\n        message: `Hello deferred from the server!`,\n        status: 'success',\n        time: new Date(),\n      }\n    },\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: ({ context }) => {\n    // Kick off loading as early as possible!\n    context.queryClient.prefetchQuery(deferredQueryOptions())\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = useState(0)\n\n  return (\n    <div className=\"p-2\">\n      <Suspense fallback=\"Loading Middleman...\">\n        <DeferredQuery />\n      </Suspense>\n      <div>Count: {count}</div>\n      <div>\n        <button onClick={() => setCount(count + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n\nfunction DeferredQuery() {\n  const deferredQuery = useSuspenseQuery(deferredQueryOptions())\n\n  return (\n    <div>\n      <h1>Deferred Query</h1>\n      <div>Status: {deferredQuery.data.status}</div>\n      <div>Message: {deferredQuery.data.message}</div>\n      <div>Time: {deferredQuery.data.time.toISOString()}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { postQueryOptions } from '../utils/posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId }, context }) => {\n    const data = await context.queryClient.ensureQueryData(\n      postQueryOptions(postId),\n    )\n\n    return {\n      title: data.title,\n    }\n  },\n  head: ({ loaderData }) => ({\n    meta: loaderData ? [{ title: loaderData.title }] : undefined,\n  }),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const { postId } = Route.useParams()\n  const postQuery = useSuspenseQuery(postQueryOptions(postId))\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{postQuery.data.title}</h4>\n      <div className=\"text-sm\">{postQuery.data.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: postQuery.data.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/posts.route.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { postsQueryOptions } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(postsQueryOptions())\n  },\n  head: () => ({\n    meta: [{ title: 'Posts' }],\n  }),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useSuspenseQuery(postsQueryOptions())\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...postsQuery.data,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li key={post.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { postQueryOptions } from '../utils/posts'\nimport { PostErrorComponent } from './posts.$postId'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId }, context }) => {\n    const data = await context.queryClient.ensureQueryData(\n      postQueryOptions(postId),\n    )\n\n    return {\n      title: data.title,\n    }\n  },\n  head: ({ loaderData }) => ({\n    meta: loaderData ? [{ title: loaderData.title }] : undefined,\n  }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const { postId } = Route.useParams()\n  const postQuery = useSuspenseQuery(postQueryOptions(postId))\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{postQuery.data.title}</h4>\n      <div className=\"text-sm\">{postQuery.data.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/redirect.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: async () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/users.$userId.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound'\nimport { userQueryOptions } from '~/utils/users'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ context, params: { userId } }) => {\n    await context.queryClient.ensureQueryData(userQueryOptions(userId))\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction UserComponent() {\n  const params = Route.useParams()\n  const userQuery = useSuspenseQuery(userQueryOptions(params.userId))\n  const user = userQuery.data\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{user.name}</h4>\n      <div className=\"text-sm\">{user.email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/routes/users.route.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { usersQueryOptions } from '../utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(usersQueryOptions())\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const usersQuery = useSuspenseQuery(usersQueryOptions())\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...usersQuery.data,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li key={user.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/utils/posts.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n\nexport const postsQueryOptions = () =>\n  queryOptions({\n    queryKey: ['posts'],\n    queryFn: () => fetchPosts(),\n  })\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['post', postId],\n    queryFn: () => fetchPost({ data: postId }),\n  })\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/src/utils/users.tsx",
    "content": "import { queryOptions } from '@tanstack/react-query'\nimport axios from 'redaxios'\n\nexport type User = {\n  id: number\n  name: string\n  email: string\n}\n\nexport const DEPLOY_URL = 'http://localhost:3000'\n\nexport const usersQueryOptions = () =>\n  queryOptions({\n    queryKey: ['users'],\n    queryFn: () =>\n      axios\n        .get<Array<User>>(DEPLOY_URL + '/api/users')\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch users')\n        }),\n  })\n\nexport const userQueryOptions = (id: string) =>\n  queryOptions({\n    queryKey: ['users', id],\n    queryFn: () =>\n      axios\n        .get<User>(DEPLOY_URL + '/api/users/' + id)\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch user')\n        }),\n  })\n"
  },
  {
    "path": "examples/react/start-basic-react-query/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-react-query/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-basic-rsc/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n"
  },
  {
    "path": "examples/react/start-basic-rsc/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-basic-rsc/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/README.md",
    "content": "# TanStack Start - RSC Example\n\nThis site is built with TanStack Router and React Server Components!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-basic-rsc start-basic-rsc\n```\n\n## Deployment\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- React Server Components (RSC) with TanStack Start\n- Server-side rendering\n"
  },
  {
    "path": "examples/react/start-basic-rsc/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-basic-rsc\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"exit 0; vite build\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@babel/plugin-syntax-typescript\": \"^7.25.9\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  },\n  \"overrides\": {\n    \"react\": \"0.0.0-experimental-035a41c4e-20230704\",\n    \"react-dom\": \"0.0.0-experimental-035a41c4e-20230704\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts/$postId'\n    | '/posts'\n    | '/route-a'\n    | '/route-b'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/posts'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {/* <React.Suspense fallback={null}>{children}</React.Suspense> */}\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { fetchPost } from '../utils/posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound'\n\nconst renderPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data }) => {\n    const post = await fetchPost(data)\n\n    return (\n      <div className=\"space-y-2\">\n        <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n        <div className=\"text-sm\">{post.body}</div>\n        <Link\n          to=\"/posts/$postId/deep\"\n          params={{\n            postId: post.id,\n          }}\n          activeProps={{ className: 'text-black font-bold' }}\n          className=\"block py-1 text-blue-800 hover:text-blue-600\"\n        >\n          Deep View\n        </Link>\n      </div>\n    )\n  })\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => renderPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  return Route.useLoaderData()\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn, renderRsc } from '@tanstack/react-start'\nimport { renderPosts } from '~/utils/renderPosts'\n\nexport const serverRenderPosts = createServerFn({ method: 'GET' }).handler(\n  renderPosts,\n)\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => serverRenderPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  return renderRsc(Route.useLoaderData())\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../utils/posts'\nimport { PostErrorComponent } from './posts.$postId'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/utils/posts.tsx",
    "content": "// import { notFound } from '@tanstack/react-router'\n// import { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  'use server'\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        // throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  'use server'\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/utils/renderPosts.tsx",
    "content": "'use server'\n\nimport React from 'react'\nimport { fetchPosts } from './posts'\n\nexport async function renderPosts() {\n  const posts = await fetchPosts()\n\n  posts.state = posts.state || {\n    status: 'pending',\n    promise: Promise.resolve(),\n  }\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }]?.map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                {post.title.substring(0, 20)}\n                {/* <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link> */}\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <React.Suspense fallback={<div>Loading...</div>}>\n        <DelayedDateViaSuspense state={posts.state} />\n      </React.Suspense>\n    </div>\n  )\n}\n\nfunction DelayedDateViaSuspense({ state }) {\n  // a component that will suspend for 1 second and then show the current date\n  if (state.status === 'pending') {\n    state.promise = new Promise<void>((resolve) => {\n      setTimeout(() => {\n        state.status = 'success'\n        resolve()\n      }, 5000)\n    })\n    throw state.promise\n  }\n\n  return <div>{new Date().toISOString().replace('T', ' ').split('.')[0]}</div>\n}\n\n// ...fetchPosts\n// posts\n// ...5000\n// timestamp\n"
  },
  {
    "path": "examples/react/start-basic-rsc/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-rsc/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-basic-static/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/start-basic-static/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-basic-static/README.md",
    "content": "# TanStack Start - Static Example\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-basic-static start-basic-static\n```\n\n## Deployment\n\nIt's deployed automagically with Vercel!\n\n- [Vercel](https://vercel.com/)\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Static Site Generation (SSG) with TanStack Start\n- Prerendering routes\n- Static export\n"
  },
  {
    "path": "examples/react/start-basic-static/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-basic-static\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"@tanstack/start-static-server-functions\": \"^1.166.17\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.6.2\",\n    \"vite\": \"^8.0.0\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/redirect'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  UsersRoute: UsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    basepath: '/test/',\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootLayout>\n        <DefaultCatchBoundary {...props} />\n      </RootLayout>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootLayout>\n      <Outlet />\n    </RootLayout>\n  )\n}\n\nfunction RootLayout({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div className=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div className=\"p-2\">\n      <div className=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Suspense, useState } from 'react'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .inputValidator((d: string) => d)\n  .handler(({ data: name }) => {\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: name }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: 'Tanner Linsley' }),\n      person: await personServerFn({ data: 'John Doe' }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = useState(0)\n  const { deferredStuff, deferredPerson, person } = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {person.name} - {person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count}</div>\n      <div>\n        <button onClick={() => setCount(count + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../utils/posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router'\nimport { fetchPost } from '../utils/posts'\nimport { PostErrorComponent } from './posts.$postId'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: ({ params: { postId } }) =>\n    fetchPost({\n      data: postId,\n    }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/posts\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        ← All Posts\n      </Link>\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/redirect.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: async () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/users.$userId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport { createServerFn } from '@tanstack/react-start'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport type { User } from '~/utils/users'\nimport { NotFound } from '~/components/NotFound'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nconst fetchUser = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: userId }) => {\n    return axios\n      .get<User>('https://jsonplaceholder.typicode.com/users/' + userId)\n      .then((d) => ({\n        id: d.data.id,\n        name: d.data.name,\n        email: d.data.email,\n      }))\n      .catch((e) => {\n        throw new Error('Failed to fetch user')\n      })\n  })\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: ({ params: { userId } }) => fetchUser({ data: userId }),\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  if ('error' in user) {\n    return <NotFound>User not found</NotFound>\n  }\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{user.name}</h4>\n      <div className=\"text-sm\">{user.email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport axios from 'redaxios'\nimport { createServerFn } from '@tanstack/react-start'\nimport type { User } from '../utils/users'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nconst fetchUsers = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .handler(async () => {\n    console.info('Fetching users...')\n    const res = await axios.get<Array<User>>(\n      'https://jsonplaceholder.typicode.com/users',\n    )\n\n    return res.data\n      .slice(0, 10)\n      .map((u) => ({ id: u.id, name: u.name, email: u.email }))\n  })\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => fetchUsers(),\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[\n          ...users,\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li key={user.id} className=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ className: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/utils/loggingMiddleware.tsx",
    "content": "import { createMiddleware } from '@tanstack/react-start'\n\nexport const logMiddleware = createMiddleware({ type: 'function' })\n  .middleware([\n    createMiddleware({ type: 'function' })\n      .client(async (ctx) => {\n        const clientTime = new Date()\n\n        return await ctx.next({\n          context: {\n            clientTime,\n          },\n          sendContext: {\n            clientTime,\n          },\n        })\n      })\n      .server(async (ctx) => {\n        const serverTime = new Date()\n\n        return await ctx.next({\n          sendContext: {\n            serverTime,\n            durationToServer:\n              serverTime.getTime() - ctx.context.clientTime.getTime(),\n          },\n        })\n      }),\n  ])\n  .client(async (options) => {\n    const result = await options.next()\n\n    const now = new Date()\n\n    console.log('Client Req/Res:', {\n      duration: result.context.clientTime.getTime() - now.getTime(),\n      durationToServer: result.context.durationToServer,\n      durationFromServer: now.getTime() - result.context.serverTime.getTime(),\n    })\n\n    return result\n  })\n"
  },
  {
    "path": "examples/react/start-basic-static/src/utils/posts.tsx",
    "content": "import { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\nimport { notFound } from '@tanstack/react-router'\nimport { logMiddleware } from './loggingMiddleware'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .middleware([logMiddleware, staticFunctionMiddleware])\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .catch((err) => {\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n      .then((r) => r.data)\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' })\n  .middleware([logMiddleware, staticFunctionMiddleware])\n  .handler(async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  })\n"
  },
  {
    "path": "examples/react/start-basic-static/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nexport const DEPLOY_URL = 'http://localhost:3000'\n"
  },
  {
    "path": "examples/react/start-basic-static/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-basic-static/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  base: '/test/',\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      spa: {\n        enabled: true,\n        prerender: {\n          crawlLinks: true,\n        },\n      },\n      sitemap: {\n        host: 'https://localhost:3000',\n      },\n      prerender: {\n        failOnError: false,\n      },\n    }),\n    viteReact(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/start-bun/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-bun/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\ncount.txt\n.env\n.nitro\n.tanstack\n.output\n.vinxi\ntodos.json\n"
  },
  {
    "path": "examples/react/start-bun/.prettierignore",
    "content": "package-lock.json\npnpm-lock.yaml\nyarn.lock"
  },
  {
    "path": "examples/react/start-bun/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-bun/README.md",
    "content": "# TanStack Start + Bun Production Server\n\nAn optimized production server for TanStack Start applications using Bun, implementing intelligent static asset loading with configurable memory management.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Bun Documentation](https://bun.sh/docs)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-bun start-bun\n```\n\n## 🚀 Features\n\n- **Hybrid Loading Strategy**: Small files are preloaded into memory, large files are served on-demand\n- **Configurable File Filtering**: Include/Exclude patterns for precise control\n- **Memory-efficient Response Generation**: Optimized for high performance\n- **Production-ready Caching Headers**: Automatic Cache-Control headers for optimal performance\n- **Detailed Logging**: Vite-like output for better overview\n\n## 📦 Installation\n\nThis project was created with TanStack Start:\n\n```bash\nbunx create-start-app@latest\n```\n\nInstall dependencies:\n\n```bash\nbun install\n```\n\n## 🏃‍♂️ Development\n\nFor development:\n\n```bash\nbun run dev\n```\n\n## 🔨 Production Build\n\nBuild the application for production:\n\n```bash\nbun run build\n```\n\n## 🚀 Production Server with server.ts\n\n### Quick Start - Use in Your Project\n\nYou can easily use this production server in your own TanStack Start project:\n\n1. **Copy the `server.ts` file** into your project root\n2. **Build your project** with `bun run build`\n3. **Start the server** directly with:\n   ```bash\n   bun run server.ts\n   ```\n\nOr add it to your `package.json` scripts:\n\n```json\n{\n  \"scripts\": {\n    \"start\": \"bun run server.ts\"\n  }\n}\n```\n\nThen run with:\n\n```bash\nbun run start\n```\n\n### Server Features\n\nThe `server.ts` implements a high-performance production server with the following features:\n\n#### 1. Intelligent Asset Loading\n\nThe server automatically decides which files to preload into memory and which to serve on-demand:\n\n- **In-Memory Loading**: Small files (default < 5MB) are loaded into memory at startup\n- **On-Demand Loading**: Large files are loaded from disk only when requested\n- **Optimized Performance**: Frequently used assets are served from memory\n\n#### 2. Configuration via Environment Variables\n\n```bash\n# Server Port (default: 3000)\nPORT=3000\n\n# Maximum file size for in-memory loading (in bytes, default: 5MB)\nSTATIC_PRELOAD_MAX_BYTES=5242880\n\n# Include patterns (comma-separated, only these files will be preloaded)\nSTATIC_PRELOAD_INCLUDE=\"*.js,*.css,*.woff2\"\n\n# Exclude patterns (comma-separated, these files will be excluded)\nSTATIC_PRELOAD_EXCLUDE=\"*.map,*.txt\"\n\n# Enable detailed logging\nSTATIC_PRELOAD_VERBOSE=true\n```\n\n### Example Configurations\n\n#### Minimal Memory Footprint\n\n```bash\n# Preload only critical assets\nSTATIC_PRELOAD_MAX_BYTES=1048576 \\\nSTATIC_PRELOAD_INCLUDE=\"*.js,*.css\" \\\nSTATIC_PRELOAD_EXCLUDE=\"*.map,vendor-*\" \\\nbun run start\n```\n\n#### Maximum Performance\n\n```bash\n# Preload all small assets\nSTATIC_PRELOAD_MAX_BYTES=10485760 \\\nbun run start\n```\n\n#### Debug Mode\n\n```bash\n# With detailed logging\nSTATIC_PRELOAD_VERBOSE=true \\\nbun run start\n```\n\n### Server Output\n\nThe server displays a clear overview of all loaded assets at startup:\n\n```txt\n📦 Loading static assets from ./dist/client...\n   Max preload size: 5.00 MB\n   Include patterns: *.js,*.css,*.woff2\n\n📁 Preloaded into memory:\n   /assets/index-a1b2c3d4.js           45.23 kB │ gzip:  15.83 kB\n   /assets/index-e5f6g7h8.css           12.45 kB │ gzip:   4.36 kB\n\n💾 Served on-demand:\n   /assets/vendor-i9j0k1l2.js          245.67 kB │ gzip:  86.98 kB\n\n✅ Preloaded 2 files (57.68 KB) into memory\nℹ️  1 files will be served on-demand (1 too large, 0 filtered)\n\n🚀 Server running at http://localhost:3000\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## Production\n\nStart the production server:\n\n```sh\npnpm start\n```\n\n## Testing\n\nThis project uses [Vitest](https://vitest.dev/) for testing. You can run the tests with:\n\n```bash\nbun run test\n```\n\n## Styling\n\nThis project uses [Tailwind CSS](https://tailwindcss.com/) for styling.\n\n## Linting & Formatting\n\nThis project uses [eslint](https://eslint.org/) and [prettier](https://prettier.io/) for linting and formatting. Eslint is configured using [tanstack/eslint-config](https://tanstack.com/config/latest/docs/eslint). The following scripts are available:\n\n```bash\nbun run lint\nbun run format\nbun run check\n```\n"
  },
  {
    "path": "examples/react/start-bun/eslint.config.js",
    "content": "//  @ts-check\n\nimport { tanstackConfig } from '@tanstack/eslint-config'\n\nexport default [...tanstackConfig]\n"
  },
  {
    "path": "examples/react/start-bun/package.json",
    "content": "{\n  \"name\": \"tanstack-start-bun-hosting\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"start\": \"bun run server.ts\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"test\": \"vitest run\",\n    \"lint\": \"eslint\",\n    \"format\": \"prettier\",\n    \"check\": \"prettier --write . && eslint --fix\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-devtools\": \"^0.7.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-router-ssr-query\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.1.1\",\n    \"react-dom\": \"^19.1.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/eslint-config\": \"^0.3.2\",\n    \"@testing-library/dom\": \"^10.4.1\",\n    \"@testing-library/react\": \"^16.3.0\",\n    \"@types/bun\": \"^1.2.22\",\n    \"@types/node\": \"22.10.2\",\n    \"@types/react\": \"^19.1.13\",\n    \"@types/react-dom\": \"^19.1.9\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"jsdom\": \"^27.0.0\",\n    \"prettier\": \"^3.6.2\",\n    \"typescript\": \"^5.9.2\",\n    \"vite\": \"^8.0.0\",\n    \"vitest\": \"^3.2.4\",\n    \"web-vitals\": \"^5.1.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-bun/prettier.config.js",
    "content": "//  @ts-check\n\n/** @type {import('prettier').Config} */\nconst config = {\n  semi: false,\n  singleQuote: true,\n  trailingComma: 'all',\n}\n\nexport default config\n"
  },
  {
    "path": "examples/react/start-bun/public/manifest.json",
    "content": "{\n  \"short_name\": \"TanStack App\",\n  \"name\": \"Create TanStack App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "examples/react/start-bun/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "examples/react/start-bun/server.ts",
    "content": "/**\n * TanStack Start Production Server with Bun\n *\n * A high-performance production server for TanStack Start applications that\n * implements intelligent static asset loading with configurable memory management.\n *\n * Features:\n * - Hybrid loading strategy (preload small files, serve large files on-demand)\n * - Configurable file filtering with include/exclude patterns\n * - Memory-efficient response generation\n * - Production-ready caching headers\n *\n * Environment Variables:\n *\n * PORT (number)\n *   - Server port number\n *   - Default: 3000\n *\n * ASSET_PRELOAD_MAX_SIZE (number)\n *   - Maximum file size in bytes to preload into memory\n *   - Files larger than this will be served on-demand from disk\n *   - Default: 5242880 (5MB)\n *   - Example: ASSET_PRELOAD_MAX_SIZE=5242880 (5MB)\n *\n * ASSET_PRELOAD_INCLUDE_PATTERNS (string)\n *   - Comma-separated list of glob patterns for files to include\n *   - If specified, only matching files are eligible for preloading\n *   - Patterns are matched against filenames only, not full paths\n *   - Example: ASSET_PRELOAD_INCLUDE_PATTERNS=\"*.js,*.css,*.woff2\"\n *\n * ASSET_PRELOAD_EXCLUDE_PATTERNS (string)\n *   - Comma-separated list of glob patterns for files to exclude\n *   - Applied after include patterns\n *   - Patterns are matched against filenames only, not full paths\n *   - Example: ASSET_PRELOAD_EXCLUDE_PATTERNS=\"*.map,*.txt\"\n *\n * ASSET_PRELOAD_VERBOSE_LOGGING (boolean)\n *   - Enable detailed logging of loaded and skipped files\n *   - Default: false\n *   - Set to \"true\" to enable verbose output\n *\n * ASSET_PRELOAD_ENABLE_ETAG (boolean)\n *   - Enable ETag generation for preloaded assets\n *   - Default: true\n *   - Set to \"false\" to disable ETag support\n *\n * ASSET_PRELOAD_ENABLE_GZIP (boolean)\n *   - Enable Gzip compression for eligible assets\n *   - Default: true\n *   - Set to \"false\" to disable Gzip compression\n *\n * ASSET_PRELOAD_GZIP_MIN_SIZE (number)\n *   - Minimum file size in bytes required for Gzip compression\n *   - Files smaller than this will not be compressed\n *   - Default: 1024 (1KB)\n *\n * ASSET_PRELOAD_GZIP_MIME_TYPES (string)\n *   - Comma-separated list of MIME types eligible for Gzip compression\n *   - Supports partial matching for types ending with \"/\"\n *   - Default: text/,application/javascript,application/json,application/xml,image/svg+xml\n *\n * Usage:\n *   bun run server.ts\n */\n\nimport path from 'node:path'\n\n// Configuration\nconst SERVER_PORT = Number(process.env.PORT ?? 3000)\nconst CLIENT_DIRECTORY = './dist/client'\nconst SERVER_ENTRY_POINT = './dist/server/server.js'\n\n// Logging utilities for professional output\nconst log = {\n  info: (message: string) => {\n    console.log(`[INFO] ${message}`)\n  },\n  success: (message: string) => {\n    console.log(`[SUCCESS] ${message}`)\n  },\n  warning: (message: string) => {\n    console.log(`[WARNING] ${message}`)\n  },\n  error: (message: string) => {\n    console.log(`[ERROR] ${message}`)\n  },\n  header: (message: string) => {\n    console.log(`\\n${message}\\n`)\n  },\n}\n\n// Preloading configuration from environment variables\nconst MAX_PRELOAD_BYTES = Number(\n  process.env.ASSET_PRELOAD_MAX_SIZE ?? 5 * 1024 * 1024, // 5MB default\n)\n\n// Parse comma-separated include patterns (no defaults)\nconst INCLUDE_PATTERNS = (process.env.ASSET_PRELOAD_INCLUDE_PATTERNS ?? '')\n  .split(',')\n  .map((s) => s.trim())\n  .filter(Boolean)\n  .map((pattern: string) => convertGlobToRegExp(pattern))\n\n// Parse comma-separated exclude patterns (no defaults)\nconst EXCLUDE_PATTERNS = (process.env.ASSET_PRELOAD_EXCLUDE_PATTERNS ?? '')\n  .split(',')\n  .map((s) => s.trim())\n  .filter(Boolean)\n  .map((pattern: string) => convertGlobToRegExp(pattern))\n\n// Verbose logging flag\nconst VERBOSE = process.env.ASSET_PRELOAD_VERBOSE_LOGGING === 'true'\n\n// Optional ETag feature\nconst ENABLE_ETAG = (process.env.ASSET_PRELOAD_ENABLE_ETAG ?? 'true') === 'true'\n\n// Optional Gzip feature\nconst ENABLE_GZIP = (process.env.ASSET_PRELOAD_ENABLE_GZIP ?? 'true') === 'true'\nconst GZIP_MIN_BYTES = Number(process.env.ASSET_PRELOAD_GZIP_MIN_SIZE ?? 1024) // 1KB\nconst GZIP_TYPES = (\n  process.env.ASSET_PRELOAD_GZIP_MIME_TYPES ??\n  'text/,application/javascript,application/json,application/xml,image/svg+xml'\n)\n  .split(',')\n  .map((v) => v.trim())\n  .filter(Boolean)\n\n/**\n * Convert a simple glob pattern to a regular expression\n * Supports * wildcard for matching any characters\n */\nfunction convertGlobToRegExp(globPattern: string): RegExp {\n  // Escape regex special chars except *, then replace * with .*\n  const escapedPattern = globPattern\n    .replace(/[-/\\\\^$+?.()|[\\]{}]/g, '\\\\$&')\n    .replace(/\\*/g, '.*')\n  return new RegExp(`^${escapedPattern}$`, 'i')\n}\n\n/**\n * Compute ETag for a given data buffer\n */\nfunction computeEtag(data: Uint8Array): string {\n  const hash = Bun.hash(data)\n  return `W/\"${hash.toString(16)}-${data.byteLength.toString()}\"`\n}\n\n/**\n * Metadata for preloaded static assets\n */\ninterface AssetMetadata {\n  route: string\n  size: number\n  type: string\n}\n\n/**\n * In-memory asset with ETag and Gzip support\n */\ninterface InMemoryAsset {\n  raw: Uint8Array\n  gz?: Uint8Array\n  etag?: string\n  type: string\n  immutable: boolean\n  size: number\n}\n\n/**\n * Result of static asset preloading process\n */\ninterface PreloadResult {\n  routes: Record<string, (req: Request) => Response | Promise<Response>>\n  loaded: AssetMetadata[]\n  skipped: AssetMetadata[]\n}\n\n/**\n * Check if a file is eligible for preloading based on configured patterns\n */\nfunction isFileEligibleForPreloading(relativePath: string): boolean {\n  const fileName = relativePath.split(/[/\\\\]/).pop() ?? relativePath\n\n  // If include patterns are specified, file must match at least one\n  if (INCLUDE_PATTERNS.length > 0) {\n    if (!INCLUDE_PATTERNS.some((pattern) => pattern.test(fileName))) {\n      return false\n    }\n  }\n\n  // If exclude patterns are specified, file must not match any\n  if (EXCLUDE_PATTERNS.some((pattern) => pattern.test(fileName))) {\n    return false\n  }\n\n  return true\n}\n\n/**\n * Check if a MIME type is compressible\n */\nfunction isMimeTypeCompressible(mimeType: string): boolean {\n  return GZIP_TYPES.some((type) =>\n    type.endsWith('/') ? mimeType.startsWith(type) : mimeType === type,\n  )\n}\n\n/**\n * Conditionally compress data based on size and MIME type\n */\nfunction compressDataIfAppropriate(\n  data: Uint8Array,\n  mimeType: string,\n): Uint8Array | undefined {\n  if (!ENABLE_GZIP) return undefined\n  if (data.byteLength < GZIP_MIN_BYTES) return undefined\n  if (!isMimeTypeCompressible(mimeType)) return undefined\n  try {\n    return Bun.gzipSync(data.buffer as ArrayBuffer)\n  } catch {\n    return undefined\n  }\n}\n\n/**\n * Create response handler function with ETag and Gzip support\n */\nfunction createResponseHandler(\n  asset: InMemoryAsset,\n): (req: Request) => Response {\n  return (req: Request) => {\n    const headers: Record<string, string> = {\n      'Content-Type': asset.type,\n      'Cache-Control': asset.immutable\n        ? 'public, max-age=31536000, immutable'\n        : 'public, max-age=3600',\n    }\n\n    if (ENABLE_ETAG && asset.etag) {\n      const ifNone = req.headers.get('if-none-match')\n      if (ifNone && ifNone === asset.etag) {\n        return new Response(null, {\n          status: 304,\n          headers: { ETag: asset.etag },\n        })\n      }\n      headers.ETag = asset.etag\n    }\n\n    if (\n      ENABLE_GZIP &&\n      asset.gz &&\n      req.headers.get('accept-encoding')?.includes('gzip')\n    ) {\n      headers['Content-Encoding'] = 'gzip'\n      headers['Content-Length'] = String(asset.gz.byteLength)\n      const gzCopy = new Uint8Array(asset.gz)\n      return new Response(gzCopy, { status: 200, headers })\n    }\n\n    headers['Content-Length'] = String(asset.raw.byteLength)\n    const rawCopy = new Uint8Array(asset.raw)\n    return new Response(rawCopy, { status: 200, headers })\n  }\n}\n\n/**\n * Create composite glob pattern from include patterns\n */\nfunction createCompositeGlobPattern(): Bun.Glob {\n  const raw = (process.env.ASSET_PRELOAD_INCLUDE_PATTERNS ?? '')\n    .split(',')\n    .map((s) => s.trim())\n    .filter(Boolean)\n  if (raw.length === 0) return new Bun.Glob('**/*')\n  if (raw.length === 1) return new Bun.Glob(raw[0])\n  return new Bun.Glob(`{${raw.join(',')}}`)\n}\n\n/**\n * Initialize static routes with intelligent preloading strategy\n * Small files are loaded into memory, large files are served on-demand\n */\nasync function initializeStaticRoutes(\n  clientDirectory: string,\n): Promise<PreloadResult> {\n  const routes: Record<string, (req: Request) => Response | Promise<Response>> =\n    {}\n  const loaded: AssetMetadata[] = []\n  const skipped: AssetMetadata[] = []\n\n  log.info(`Loading static assets from ${clientDirectory}...`)\n  if (VERBOSE) {\n    console.log(\n      `Max preload size: ${(MAX_PRELOAD_BYTES / 1024 / 1024).toFixed(2)} MB`,\n    )\n    if (INCLUDE_PATTERNS.length > 0) {\n      console.log(\n        `Include patterns: ${process.env.ASSET_PRELOAD_INCLUDE_PATTERNS ?? ''}`,\n      )\n    }\n    if (EXCLUDE_PATTERNS.length > 0) {\n      console.log(\n        `Exclude patterns: ${process.env.ASSET_PRELOAD_EXCLUDE_PATTERNS ?? ''}`,\n      )\n    }\n  }\n\n  let totalPreloadedBytes = 0\n\n  try {\n    const glob = createCompositeGlobPattern()\n    for await (const relativePath of glob.scan({ cwd: clientDirectory })) {\n      const filepath = path.join(clientDirectory, relativePath)\n      const route = `/${relativePath.split(path.sep).join(path.posix.sep)}`\n\n      try {\n        // Get file metadata\n        const file = Bun.file(filepath)\n\n        // Skip if file doesn't exist or is empty\n        if (!(await file.exists()) || file.size === 0) {\n          continue\n        }\n\n        const metadata: AssetMetadata = {\n          route,\n          size: file.size,\n          type: file.type || 'application/octet-stream',\n        }\n\n        // Determine if file should be preloaded\n        const matchesPattern = isFileEligibleForPreloading(relativePath)\n        const withinSizeLimit = file.size <= MAX_PRELOAD_BYTES\n\n        if (matchesPattern && withinSizeLimit) {\n          // Preload small files into memory with ETag and Gzip support\n          const bytes = new Uint8Array(await file.arrayBuffer())\n          const gz = compressDataIfAppropriate(bytes, metadata.type)\n          const etag = ENABLE_ETAG ? computeEtag(bytes) : undefined\n          const asset: InMemoryAsset = {\n            raw: bytes,\n            gz,\n            etag,\n            type: metadata.type,\n            immutable: true,\n            size: bytes.byteLength,\n          }\n          routes[route] = createResponseHandler(asset)\n\n          loaded.push({ ...metadata, size: bytes.byteLength })\n          totalPreloadedBytes += bytes.byteLength\n        } else {\n          // Serve large or filtered files on-demand\n          routes[route] = () => {\n            const fileOnDemand = Bun.file(filepath)\n            return new Response(fileOnDemand, {\n              headers: {\n                'Content-Type': metadata.type,\n                'Cache-Control': 'public, max-age=3600',\n              },\n            })\n          }\n\n          skipped.push(metadata)\n        }\n      } catch (error: unknown) {\n        if (error instanceof Error && error.name !== 'EISDIR') {\n          log.error(`Failed to load ${filepath}: ${error.message}`)\n        }\n      }\n    }\n\n    // Show detailed file overview only when verbose mode is enabled\n    if (VERBOSE && (loaded.length > 0 || skipped.length > 0)) {\n      const allFiles = [...loaded, ...skipped].sort((a, b) =>\n        a.route.localeCompare(b.route),\n      )\n\n      // Calculate max path length for alignment\n      const maxPathLength = Math.min(\n        Math.max(...allFiles.map((f) => f.route.length)),\n        60,\n      )\n\n      // Format file size with KB and actual gzip size\n      const formatFileSize = (bytes: number, gzBytes?: number) => {\n        const kb = bytes / 1024\n        const sizeStr = kb < 100 ? kb.toFixed(2) : kb.toFixed(1)\n\n        if (gzBytes !== undefined) {\n          const gzKb = gzBytes / 1024\n          const gzStr = gzKb < 100 ? gzKb.toFixed(2) : gzKb.toFixed(1)\n          return {\n            size: sizeStr,\n            gzip: gzStr,\n          }\n        }\n\n        // Rough gzip estimation (typically 30-70% compression) if no actual gzip data\n        const gzipKb = kb * 0.35\n        return {\n          size: sizeStr,\n          gzip: gzipKb < 100 ? gzipKb.toFixed(2) : gzipKb.toFixed(1),\n        }\n      }\n\n      if (loaded.length > 0) {\n        console.log('\\n📁 Preloaded into memory:')\n        console.log(\n          'Path                                          │    Size │ Gzip Size',\n        )\n        loaded\n          .sort((a, b) => a.route.localeCompare(b.route))\n          .forEach((file) => {\n            const { size, gzip } = formatFileSize(file.size)\n            const paddedPath = file.route.padEnd(maxPathLength)\n            const sizeStr = `${size.padStart(7)} kB`\n            const gzipStr = `${gzip.padStart(7)} kB`\n            console.log(`${paddedPath} │ ${sizeStr} │  ${gzipStr}`)\n          })\n      }\n\n      if (skipped.length > 0) {\n        console.log('\\n💾 Served on-demand:')\n        console.log(\n          'Path                                          │    Size │ Gzip Size',\n        )\n        skipped\n          .sort((a, b) => a.route.localeCompare(b.route))\n          .forEach((file) => {\n            const { size, gzip } = formatFileSize(file.size)\n            const paddedPath = file.route.padEnd(maxPathLength)\n            const sizeStr = `${size.padStart(7)} kB`\n            const gzipStr = `${gzip.padStart(7)} kB`\n            console.log(`${paddedPath} │ ${sizeStr} │  ${gzipStr}`)\n          })\n      }\n    }\n\n    // Show detailed verbose info if enabled\n    if (VERBOSE) {\n      if (loaded.length > 0 || skipped.length > 0) {\n        const allFiles = [...loaded, ...skipped].sort((a, b) =>\n          a.route.localeCompare(b.route),\n        )\n        console.log('\\n📊 Detailed file information:')\n        console.log(\n          'Status       │ Path                            │ MIME Type                    │ Reason',\n        )\n        allFiles.forEach((file) => {\n          const isPreloaded = loaded.includes(file)\n          const status = isPreloaded ? 'MEMORY' : 'ON-DEMAND'\n          const reason =\n            !isPreloaded && file.size > MAX_PRELOAD_BYTES\n              ? 'too large'\n              : !isPreloaded\n                ? 'filtered'\n                : 'preloaded'\n          const route =\n            file.route.length > 30\n              ? file.route.substring(0, 27) + '...'\n              : file.route\n          console.log(\n            `${status.padEnd(12)} │ ${route.padEnd(30)} │ ${file.type.padEnd(28)} │ ${reason.padEnd(10)}`,\n          )\n        })\n      } else {\n        console.log('\\n📊 No files found to display')\n      }\n    }\n\n    // Log summary after the file list\n    console.log() // Empty line for separation\n    if (loaded.length > 0) {\n      log.success(\n        `Preloaded ${String(loaded.length)} files (${(totalPreloadedBytes / 1024 / 1024).toFixed(2)} MB) into memory`,\n      )\n    } else {\n      log.info('No files preloaded into memory')\n    }\n\n    if (skipped.length > 0) {\n      const tooLarge = skipped.filter((f) => f.size > MAX_PRELOAD_BYTES).length\n      const filtered = skipped.length - tooLarge\n      log.info(\n        `${String(skipped.length)} files will be served on-demand (${String(tooLarge)} too large, ${String(filtered)} filtered)`,\n      )\n    }\n  } catch (error) {\n    log.error(\n      `Failed to load static files from ${clientDirectory}: ${String(error)}`,\n    )\n  }\n\n  return { routes, loaded, skipped }\n}\n\n/**\n * Initialize the server\n */\nasync function initializeServer() {\n  log.header('Starting Production Server')\n\n  // Load TanStack Start server handler\n  let handler: { fetch: (request: Request) => Response | Promise<Response> }\n  try {\n    const serverModule = (await import(SERVER_ENTRY_POINT)) as {\n      default: { fetch: (request: Request) => Response | Promise<Response> }\n    }\n    handler = serverModule.default\n    log.success('TanStack Start application handler initialized')\n  } catch (error) {\n    log.error(`Failed to load server handler: ${String(error)}`)\n    process.exit(1)\n  }\n\n  // Build static routes with intelligent preloading\n  const { routes } = await initializeStaticRoutes(CLIENT_DIRECTORY)\n\n  // Create Bun server\n  const server = Bun.serve({\n    port: SERVER_PORT,\n\n    routes: {\n      // Serve static assets (preloaded or on-demand)\n      ...routes,\n\n      // Fallback to TanStack Start handler for all other routes\n      '/*': (req: Request) => {\n        try {\n          return handler.fetch(req)\n        } catch (error) {\n          log.error(`Server handler error: ${String(error)}`)\n          return new Response('Internal Server Error', { status: 500 })\n        }\n      },\n    },\n\n    // Global error handler\n    error(error) {\n      log.error(\n        `Uncaught server error: ${error instanceof Error ? error.message : String(error)}`,\n      )\n      return new Response('Internal Server Error', { status: 500 })\n    },\n  })\n\n  log.success(`Server listening on http://localhost:${String(server.port)}`)\n}\n\n// Initialize the server\ninitializeServer().catch((error: unknown) => {\n  log.error(`Failed to start server: ${String(error)}`)\n  process.exit(1)\n})\n"
  },
  {
    "path": "examples/react/start-bun/src/components/Header.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport default function Header() {\n  return (\n    <header className=\"p-2 flex gap-2 bg-white text-black justify-between\">\n      <nav className=\"flex flex-row\">\n        <div className=\"px-2 font-bold\">\n          <Link to=\"/\">Home</Link>\n        </div>\n\n        <div className=\"px-2 font-bold\">\n          <Link to=\"/demo/start/server-funcs\">Start - Server Functions</Link>\n        </div>\n\n        <div className=\"px-2 font-bold\">\n          <Link to=\"/demo/start/api-request\">Start - API Request</Link>\n        </div>\n      </nav>\n    </header>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bun/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ApiDemoNamesRouteImport } from './routes/api.demo-names'\nimport { Route as DemoStartServerFuncsRouteImport } from './routes/demo.start.server-funcs'\nimport { Route as DemoStartApiRequestRouteImport } from './routes/demo.start.api-request'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiDemoNamesRoute = ApiDemoNamesRouteImport.update({\n  id: '/api/demo-names',\n  path: '/api/demo-names',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DemoStartServerFuncsRoute = DemoStartServerFuncsRouteImport.update({\n  id: '/demo/start/server-funcs',\n  path: '/demo/start/server-funcs',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DemoStartApiRequestRoute = DemoStartApiRequestRouteImport.update({\n  id: '/demo/start/api-request',\n  path: '/demo/start/api-request',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/api/demo-names': typeof ApiDemoNamesRoute\n  '/demo/start/api-request': typeof DemoStartApiRequestRoute\n  '/demo/start/server-funcs': typeof DemoStartServerFuncsRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/api/demo-names': typeof ApiDemoNamesRoute\n  '/demo/start/api-request': typeof DemoStartApiRequestRoute\n  '/demo/start/server-funcs': typeof DemoStartServerFuncsRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/api/demo-names': typeof ApiDemoNamesRoute\n  '/demo/start/api-request': typeof DemoStartApiRequestRoute\n  '/demo/start/server-funcs': typeof DemoStartServerFuncsRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/api/demo-names'\n    | '/demo/start/api-request'\n    | '/demo/start/server-funcs'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/api/demo-names'\n    | '/demo/start/api-request'\n    | '/demo/start/server-funcs'\n  id:\n    | '__root__'\n    | '/'\n    | '/api/demo-names'\n    | '/demo/start/api-request'\n    | '/demo/start/server-funcs'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ApiDemoNamesRoute: typeof ApiDemoNamesRoute\n  DemoStartApiRequestRoute: typeof DemoStartApiRequestRoute\n  DemoStartServerFuncsRoute: typeof DemoStartServerFuncsRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/demo-names': {\n      id: '/api/demo-names'\n      path: '/api/demo-names'\n      fullPath: '/api/demo-names'\n      preLoaderRoute: typeof ApiDemoNamesRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/demo/start/server-funcs': {\n      id: '/demo/start/server-funcs'\n      path: '/demo/start/server-funcs'\n      fullPath: '/demo/start/server-funcs'\n      preLoaderRoute: typeof DemoStartServerFuncsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/demo/start/api-request': {\n      id: '/demo/start/api-request'\n      path: '/demo/start/api-request'\n      fullPath: '/demo/start/api-request'\n      preLoaderRoute: typeof DemoStartApiRequestRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ApiDemoNamesRoute: ApiDemoNamesRoute,\n  DemoStartApiRequestRoute: DemoStartApiRequestRoute,\n  DemoStartServerFuncsRoute: DemoStartServerFuncsRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-bun/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a new router instance\nexport const getRouter = () => {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreloadStaleTime: 0,\n  })\n}\n"
  },
  {
    "path": "examples/react/start-bun/src/routes/__root.tsx",
    "content": "import { TanStackDevtools } from '@tanstack/react-devtools'\nimport { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\n\nimport Header from '../components/Header'\n\nimport appCss from '../styles.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n    links: [\n      {\n        rel: 'stylesheet',\n        href: appCss,\n      },\n    ],\n  }),\n\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html lang=\"en\">\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Header />\n        {children}\n        <TanStackDevtools\n          config={{\n            position: 'bottom-left',\n          }}\n          plugins={[\n            {\n              name: 'Tanstack Router',\n              render: <TanStackRouterDevtoolsPanel />,\n            },\n          ]}\n        />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bun/src/routes/api.demo-names.ts",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/demo-names')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response(JSON.stringify(['Alice', 'Bob', 'Charlie']), {\n          headers: {\n            'Content-Type': 'application/json',\n          },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/react/start-bun/src/routes/demo.start.api-request.tsx",
    "content": "import { useEffect, useState } from 'react'\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nfunction getNames() {\n  return fetch('/api/demo-names').then((res) => res.json())\n}\n\nexport const Route = createFileRoute('/demo/start/api-request')({\n  component: Home,\n})\n\nfunction Home() {\n  const [names, setNames] = useState<Array<string>>([])\n\n  useEffect(() => {\n    getNames().then(setNames)\n  }, [])\n\n  return (\n    <div\n      className=\"flex items-center justify-center min-h-screen p-4 text-white\"\n      style={{\n        backgroundColor: '#000',\n        backgroundImage:\n          'radial-gradient(ellipse 60% 60% at 0% 100%, #444 0%, #222 60%, #000 100%)',\n      }}\n    >\n      <div className=\"w-full max-w-2xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10\">\n        <h1 className=\"text-2xl mb-4\">Start API Request Demo - Names List</h1>\n        <ul className=\"mb-4 space-y-2\">\n          {names.map((name) => (\n            <li\n              key={name}\n              className=\"bg-white/10 border border-white/20 rounded-lg p-3 backdrop-blur-sm shadow-md\"\n            >\n              <span className=\"text-lg text-white\">{name}</span>\n            </li>\n          ))}\n        </ul>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bun/src/routes/demo.start.server-funcs.tsx",
    "content": "import fs from 'node:fs'\nimport { useCallback, useState } from 'react'\nimport { createFileRoute, useRouter } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst filePath = 'todos.json'\n\nasync function readTodos() {\n  return JSON.parse(\n    await fs.promises.readFile(filePath, 'utf-8').catch(() =>\n      JSON.stringify(\n        [\n          { id: 1, name: 'Get groceries' },\n          { id: 2, name: 'Buy a new phone' },\n        ],\n        null,\n        2,\n      ),\n    ),\n  )\n}\n\nconst getTodos = createServerFn({\n  method: 'GET',\n}).handler(async () => await readTodos())\n\nconst addTodo = createServerFn({ method: 'POST' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    const todos = await readTodos()\n    todos.push({ id: todos.length + 1, name: data })\n    await fs.promises.writeFile(filePath, JSON.stringify(todos, null, 2))\n    return todos\n  })\n\nexport const Route = createFileRoute('/demo/start/server-funcs')({\n  component: Home,\n  loader: async () => await getTodos(),\n})\n\nfunction Home() {\n  const router = useRouter()\n  let todos = Route.useLoaderData()\n\n  const [todo, setTodo] = useState('')\n\n  const submitTodo = useCallback(async () => {\n    todos = await addTodo({ data: todo })\n    setTodo('')\n    router.invalidate()\n  }, [addTodo, todo])\n\n  return (\n    <div\n      className=\"flex items-center justify-center min-h-screen bg-gradient-to-br from-zinc-800 to-black p-4 text-white\"\n      style={{\n        backgroundImage:\n          'radial-gradient(50% 50% at 20% 60%, #23272a 0%, #18181b 50%, #000000 100%)',\n      }}\n    >\n      <div className=\"w-full max-w-2xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10\">\n        <h1 className=\"text-2xl mb-4\">Start Server Functions - Todo Example</h1>\n        <ul className=\"mb-4 space-y-2\">\n          {todos?.map((t) => (\n            <li\n              key={t.id}\n              className=\"bg-white/10 border border-white/20 rounded-lg p-3 backdrop-blur-sm shadow-md\"\n            >\n              <span className=\"text-lg text-white\">{t.name}</span>\n            </li>\n          ))}\n        </ul>\n        <div className=\"flex flex-col gap-2\">\n          <input\n            type=\"text\"\n            value={todo}\n            onChange={(e) => setTodo(e.target.value)}\n            onKeyDown={(e) => {\n              if (e.key === 'Enter') {\n                submitTodo()\n              }\n            }}\n            placeholder=\"Enter a new todo...\"\n            className=\"w-full px-4 py-3 rounded-lg border border-white/20 bg-white/10 backdrop-blur-sm text-white placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent\"\n          />\n          <button\n            disabled={todo.trim().length === 0}\n            onClick={submitTodo}\n            className=\"bg-blue-500 hover:bg-blue-600 disabled:bg-blue-500/50 disabled:cursor-not-allowed text-white font-bold py-3 px-4 rounded-lg transition-colors\"\n          >\n            Add todo\n          </button>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bun/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport logo from '../logo.svg'\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n\nfunction App() {\n  return (\n    <div className=\"text-center\">\n      <header className=\"min-h-screen flex flex-col items-center justify-center bg-[#282c34] text-white text-[calc(10px+2vmin)]\">\n        <img\n          src={logo}\n          className=\"h-[40vmin] pointer-events-none animate-[spin_20s_linear_infinite]\"\n          alt=\"logo\"\n        />\n        <p>\n          Edit <code>src/routes/index.tsx</code> and save to reload.\n        </p>\n        <a\n          className=\"text-[#61dafb] hover:underline\"\n          href=\"https://reactjs.org\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n        >\n          Learn React\n        </a>\n        <a\n          className=\"text-[#61dafb] hover:underline\"\n          href=\"https://tanstack.com\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n        >\n          Learn TanStack\n        </a>\n      </header>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-bun/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\nbody {\n  @apply m-0;\n  font-family:\n    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',\n    'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n  font-family:\n    source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;\n}\n"
  },
  {
    "path": "examples/react/start-bun/tsconfig.json",
    "content": "{\n  \"include\": [\n    \"**/*.ts\",\n    \"**/*.tsx\",\n    \"eslint.config.js\",\n    \"prettier.config.js\",\n    \"vite.config.js\"\n  ],\n\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"types\": [\"vite/client\", \"bun\"],\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": false,\n    \"noEmit\": true,\n\n    /* Linting */\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedSideEffectImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  }\n}\n"
  },
  {
    "path": "examples/react/start-bun/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst config = defineConfig({\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n\nexport default config\n"
  },
  {
    "path": "examples/react/start-clerk-basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/.env",
    "content": "VITE_CLERK_PUBLISHABLE_KEY=[YOUR_CLERK_PUBLISHABLE_KEY]\nCLERK_SECRET_KEY=[YOUR_CLERK_SECRET_KEY]"
  },
  {
    "path": "examples/react/start-clerk-basic/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n!.env\n.DS_Store\n.cache\n.vercel\n.output\n.nitro\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n.tanstack\n"
  },
  {
    "path": "examples/react/start-clerk-basic/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-clerk-basic/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/README.md",
    "content": "# TanStack Start - Clerk Authentication Example\n\nThis site is built with TanStack Router and Clerk Authentication!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Clerk Documentation](https://clerk.com/docs)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-clerk-basic start-clerk-basic\n```\n\n## Deployment\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Clerk authentication integration\n- Protected routes\n- User management\n- Authentication UI components\n"
  },
  {
    "path": "examples/react/start-clerk-basic/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-clerk-basic\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@clerk/tanstack-react-start\": \"^0.27.14\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"srvx\": \"^0.11.9\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteImport } from './routes/_authed/posts'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedProfileSplatRouteImport } from './routes/_authed/profile.$'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRoute = AuthedPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\nconst AuthedProfileSplatRoute = AuthedProfileSplatRouteImport.update({\n  id: '/profile/$',\n  path: '/profile/$',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof AuthedPostsRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/profile/$': typeof AuthedProfileSplatRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/profile/$': typeof AuthedProfileSplatRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/_authed/posts': typeof AuthedPostsRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/profile/$': typeof AuthedProfileSplatRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$postId' | '/profile/$' | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/profile/$' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/profile/$'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n    '/_authed/profile/$': {\n      id: '/_authed/profile/$'\n      path: '/profile/$'\n      fullPath: '/profile/$'\n      preLoaderRoute: typeof AuthedProfileSplatRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteChildren: AuthedPostsRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(\n  AuthedPostsRouteChildren,\n)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRoute: typeof AuthedPostsRouteWithChildren\n  AuthedProfileSplatRoute: typeof AuthedProfileSplatRoute\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRoute: AuthedPostsRouteWithChildren,\n  AuthedProfileSplatRoute: AuthedProfileSplatRoute,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { startInstance } from './start.ts'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n    config: Awaited<ReturnType<typeof startInstance.getOptions>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  ClerkProvider,\n  SignInButton,\n  SignedIn,\n  SignedOut,\n  UserButton,\n} from '@clerk/tanstack-react-start'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { createServerFn } from '@tanstack/react-start'\nimport { auth } from '@clerk/tanstack-react-start/server'\nimport * as React from 'react'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'\nimport { NotFound } from '~/components/NotFound.js'\nimport appCss from '~/styles/app.css?url'\n\nconst fetchClerkAuth = createServerFn({ method: 'GET' }).handler(async () => {\n  const { userId } = await auth()\n\n  return {\n    userId,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const { userId } = await fetchClerkAuth()\n\n    return {\n      userId,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <ClerkProvider>\n      <RootDocument>\n        <Outlet />\n      </RootDocument>\n    </ClerkProvider>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div className=\"ml-auto\">\n            <SignedIn>\n              <UserButton />\n            </SignedIn>\n            <SignedOut>\n              <SignInButton mode=\"modal\" />\n            </SignedOut>\n          </div>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound.js'\nimport { fetchPost } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/routes/_authed/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/routes/_authed/profile.$.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/profile/$')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/routes/_authed.tsx",
    "content": "import { SignIn } from '@clerk/tanstack-react-start'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.userId) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return (\n        <div className=\"flex items-center justify-center p-12\">\n          <SignIn routing=\"hash\" forceRedirectUrl={window.location.href} />\n        </div>\n      )\n    }\n\n    throw error\n  },\n})\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h1>Hello Clerk!</h1>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/start.ts",
    "content": "import { clerkMiddleware } from '@clerk/tanstack-react-start/server'\nimport { createStart } from '@tanstack/react-start'\n\nexport const startInstance = createStart(() => {\n  return {\n    requestMiddleware: [clerkMiddleware()],\n  }\n})\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "examples/react/start-clerk-basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-clerk-basic/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n  // See https://github.com/TanStack/router/issues/5738\n  resolve: {\n    tsconfigPaths: true,\n    alias: [\n      { find: 'use-sync-external-store/shim/index.js', replacement: 'react' },\n    ],\n  },\n})\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n\n.env.local\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-convex-trellaux/.stackblitzrc",
    "content": "{\n  \"startCommand\": \"cp .env.local.example .env.local && npx vite dev\"\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/README.md",
    "content": "# Trello-like example using Convex DB\n\nThis is a TanStack Start demo using Convex as the database.\nIt is similar to the [start-trellaux](https://github.com/TanStack/router/tree/main/examples/react/start-trellaux) example but uses a cloud Convex deployment instead of an in-memory database.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Convex Documentation](https://docs.convex.dev)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-convex-trellaux start-convex-trellaux\n```\n\n## Convex\n\nConvex is an open-source, reactive backend made by [convex.dev](https://convex.dev/?utm_source=tanstack), a sponsor of TanStack Start.\n\nThis example uses Convex with TanStack Query and TanStack Start to provide:\n\n- Typesafe TanStack Query options factories like `convexQuery` for use with `useQuery`, `useSuspenseQuery` etc.\n- Live-updating queries: updates come in over a WebSocket instead of requiring polling\n- Automatic query invalidation: when a mutation succeeds all queries it affects update automatically\n- Selective optimistic update rollback: when a mutation succeeds only its update will be rolled back, with other optimistic updates reapplied\n- Consistent snapshot reads of database state: /messages will never return a foreign key for a /user that doesn't exist until the next fetch\n\n## Getting Started\n\nTo run this example:\n\n```sh\npnpm install\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Convex database integration\n- Real-time updates\n- Complex UI state management\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/README.md",
    "content": "# Welcome to your Convex functions directory!\n\nWrite your Convex functions here.\nSee https://docs.convex.dev/functions for more.\n\nA query function that takes two arguments looks like:\n\n```ts\n// functions.js\nimport { query } from './_generated/server'\nimport { v } from 'convex/values'\n\nexport const myQueryFunction = query({\n  // Validators for arguments.\n  args: {\n    first: v.number(),\n    second: v.string(),\n  },\n\n  // Function implementation.\n  handler: async (ctx, args) => {\n    // Read the database as many times as you need here.\n    // See https://docs.convex.dev/database/reading-data.\n    const documents = await ctx.db.query('tablename').collect()\n\n    // Arguments passed from the client are properties of the args object.\n    console.log(args.first, args.second)\n\n    // Write arbitrary JavaScript here: filter, aggregate, build derived data,\n    // remove non-public properties, or create new objects.\n    return documents\n  },\n})\n```\n\nUsing this query function in a React component looks like:\n\n```ts\nconst data = useQuery(api.functions.myQueryFunction, {\n  first: 10,\n  second: 'hello',\n})\n```\n\nA mutation function looks like:\n\n```ts\n// functions.js\nimport { mutation } from './_generated/server'\nimport { v } from 'convex/values'\n\nexport const myMutationFunction = mutation({\n  // Validators for arguments.\n  args: {\n    first: v.string(),\n    second: v.string(),\n  },\n\n  // Function implementation.\n  handler: async (ctx, args) => {\n    // Insert or modify documents in the database here.\n    // Mutations can also read from the database like queries.\n    // See https://docs.convex.dev/database/writing-data.\n    const message = { body: args.first, author: args.second }\n    const id = await ctx.db.insert('messages', message)\n\n    // Optionally, return a value from your mutation.\n    return await ctx.db.get(id)\n  },\n})\n```\n\nUsing this mutation function in a React component looks like:\n\n```ts\nconst mutation = useMutation(api.functions.myMutationFunction)\nfunction handleButtonPress() {\n  // fire and forget, the most common way to use mutations\n  mutation({ first: 'Hello!', second: 'me' })\n  // OR\n  // use the result once the mutation has completed\n  mutation({ first: 'Hello!', second: 'me' }).then((result) =>\n    console.log(result),\n  )\n}\n```\n\nUse the Convex CLI to push your functions to a deployment. See everything\nthe Convex CLI can do by running `npx convex -h` in your project root\ndirectory. To learn more, launch the docs with `npx convex docs`.\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/_generated/api.d.ts",
    "content": "/* eslint-disable */\n/**\n * Generated `api` utility.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport type {\n  ApiFromModules,\n  FilterApi,\n  FunctionReference,\n} from 'convex/server'\nimport type * as board from '../board.js'\nimport type * as crons from '../crons.js'\n\n/**\n * A utility for referencing Convex functions in your app's API.\n *\n * Usage:\n * ```js\n * const myFunctionReference = api.myModule.myFunction;\n * ```\n */\ndeclare const fullApi: ApiFromModules<{\n  board: typeof board\n  crons: typeof crons\n}>\nexport declare const api: FilterApi<\n  typeof fullApi,\n  FunctionReference<any, 'public'>\n>\nexport declare const internal: FilterApi<\n  typeof fullApi,\n  FunctionReference<any, 'internal'>\n>\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/_generated/api.js",
    "content": "/* eslint-disable */\n/**\n * Generated `api` utility.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport { anyApi } from 'convex/server'\n\n/**\n * A utility for referencing Convex functions in your app's API.\n *\n * Usage:\n * ```js\n * const myFunctionReference = api.myModule.myFunction;\n * ```\n */\nexport const api = anyApi\nexport const internal = anyApi\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/_generated/dataModel.d.ts",
    "content": "/* eslint-disable */\n/**\n * Generated data model types.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport type {\n  DataModelFromSchemaDefinition,\n  DocumentByName,\n  TableNamesInDataModel,\n  SystemTableNames,\n} from 'convex/server'\nimport type { GenericId } from 'convex/values'\nimport schema from '../schema.js'\n\n/**\n * The names of all of your Convex tables.\n */\nexport type TableNames = TableNamesInDataModel<DataModel>\n\n/**\n * The type of a document stored in Convex.\n *\n * @typeParam TableName - A string literal type of the table name (like \"users\").\n */\nexport type Doc<TableName extends TableNames> = DocumentByName<\n  DataModel,\n  TableName\n>\n\n/**\n * An identifier for a document in Convex.\n *\n * Convex documents are uniquely identified by their `Id`, which is accessible\n * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).\n *\n * Documents can be loaded using `db.get(id)` in query and mutation functions.\n *\n * IDs are just strings at runtime, but this type can be used to distinguish them from other\n * strings when type checking.\n *\n * @typeParam TableName - A string literal type of the table name (like \"users\").\n */\nexport type Id<TableName extends TableNames | SystemTableNames> =\n  GenericId<TableName>\n\n/**\n * A type describing your Convex data model.\n *\n * This type includes information about what tables you have, the type of\n * documents stored in those tables, and the indexes defined on them.\n *\n * This type is used to parameterize methods like `queryGeneric` and\n * `mutationGeneric` to make them type-safe.\n */\nexport type DataModel = DataModelFromSchemaDefinition<typeof schema>\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/_generated/server.d.ts",
    "content": "/* eslint-disable */\n/**\n * Generated utilities for implementing server-side Convex query and mutation functions.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport {\n  ActionBuilder,\n  HttpActionBuilder,\n  MutationBuilder,\n  QueryBuilder,\n  GenericActionCtx,\n  GenericMutationCtx,\n  GenericQueryCtx,\n  GenericDatabaseReader,\n  GenericDatabaseWriter,\n} from 'convex/server'\nimport type { DataModel } from './dataModel.js'\n\n/**\n * Define a query in this Convex app's public API.\n *\n * This function will be allowed to read your Convex database and will be accessible from the client.\n *\n * @param func - The query function. It receives a {@link QueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n */\nexport declare const query: QueryBuilder<DataModel, 'public'>\n\n/**\n * Define a query that is only accessible from other Convex functions (but not from the client).\n *\n * This function will be allowed to read from your Convex database. It will not be accessible from the client.\n *\n * @param func - The query function. It receives a {@link QueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n */\nexport declare const internalQuery: QueryBuilder<DataModel, 'internal'>\n\n/**\n * Define a mutation in this Convex app's public API.\n *\n * This function will be allowed to modify your Convex database and will be accessible from the client.\n *\n * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n */\nexport declare const mutation: MutationBuilder<DataModel, 'public'>\n\n/**\n * Define a mutation that is only accessible from other Convex functions (but not from the client).\n *\n * This function will be allowed to modify your Convex database. It will not be accessible from the client.\n *\n * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n */\nexport declare const internalMutation: MutationBuilder<DataModel, 'internal'>\n\n/**\n * Define an action in this Convex app's public API.\n *\n * An action is a function which can execute any JavaScript code, including non-deterministic\n * code and code with side-effects, like calling third-party services.\n * They can be run in Convex's JavaScript environment or in Node.js using the \"use node\" directive.\n * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.\n *\n * @param func - The action. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped action. Include this as an `export` to name it and make it accessible.\n */\nexport declare const action: ActionBuilder<DataModel, 'public'>\n\n/**\n * Define an action that is only accessible from other Convex functions (but not from the client).\n *\n * @param func - The function. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped function. Include this as an `export` to name it and make it accessible.\n */\nexport declare const internalAction: ActionBuilder<DataModel, 'internal'>\n\n/**\n * Define an HTTP action.\n *\n * This function will be used to respond to HTTP requests received by a Convex\n * deployment if the requests matches the path and method where this action\n * is routed. Be sure to route your action in `convex/http.js`.\n *\n * @param func - The function. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.\n */\nexport declare const httpAction: HttpActionBuilder\n\n/**\n * A set of services for use within Convex query functions.\n *\n * The query context is passed as the first argument to any Convex query\n * function run on the server.\n *\n * This differs from the {@link MutationCtx} because all of the services are\n * read-only.\n */\nexport type QueryCtx = GenericQueryCtx<DataModel>\n\n/**\n * A set of services for use within Convex mutation functions.\n *\n * The mutation context is passed as the first argument to any Convex mutation\n * function run on the server.\n */\nexport type MutationCtx = GenericMutationCtx<DataModel>\n\n/**\n * A set of services for use within Convex action functions.\n *\n * The action context is passed as the first argument to any Convex action\n * function run on the server.\n */\nexport type ActionCtx = GenericActionCtx<DataModel>\n\n/**\n * An interface to read from the database within Convex query functions.\n *\n * The two entry points are {@link DatabaseReader.get}, which fetches a single\n * document by its {@link Id}, or {@link DatabaseReader.query}, which starts\n * building a query.\n */\nexport type DatabaseReader = GenericDatabaseReader<DataModel>\n\n/**\n * An interface to read from and write to the database within Convex mutation\n * functions.\n *\n * Convex guarantees that all writes within a single mutation are\n * executed atomically, so you never have to worry about partial writes leaving\n * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)\n * for the guarantees Convex provides your functions.\n */\nexport type DatabaseWriter = GenericDatabaseWriter<DataModel>\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/_generated/server.js",
    "content": "/* eslint-disable */\n/**\n * Generated utilities for implementing server-side Convex query and mutation functions.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport {\n  actionGeneric,\n  httpActionGeneric,\n  queryGeneric,\n  mutationGeneric,\n  internalActionGeneric,\n  internalMutationGeneric,\n  internalQueryGeneric,\n} from 'convex/server'\n\n/**\n * Define a query in this Convex app's public API.\n *\n * This function will be allowed to read your Convex database and will be accessible from the client.\n *\n * @param func - The query function. It receives a {@link QueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n */\nexport const query = queryGeneric\n\n/**\n * Define a query that is only accessible from other Convex functions (but not from the client).\n *\n * This function will be allowed to read from your Convex database. It will not be accessible from the client.\n *\n * @param func - The query function. It receives a {@link QueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n */\nexport const internalQuery = internalQueryGeneric\n\n/**\n * Define a mutation in this Convex app's public API.\n *\n * This function will be allowed to modify your Convex database and will be accessible from the client.\n *\n * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n */\nexport const mutation = mutationGeneric\n\n/**\n * Define a mutation that is only accessible from other Convex functions (but not from the client).\n *\n * This function will be allowed to modify your Convex database. It will not be accessible from the client.\n *\n * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n */\nexport const internalMutation = internalMutationGeneric\n\n/**\n * Define an action in this Convex app's public API.\n *\n * An action is a function which can execute any JavaScript code, including non-deterministic\n * code and code with side-effects, like calling third-party services.\n * They can be run in Convex's JavaScript environment or in Node.js using the \"use node\" directive.\n * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.\n *\n * @param func - The action. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped action. Include this as an `export` to name it and make it accessible.\n */\nexport const action = actionGeneric\n\n/**\n * Define an action that is only accessible from other Convex functions (but not from the client).\n *\n * @param func - The function. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped function. Include this as an `export` to name it and make it accessible.\n */\nexport const internalAction = internalActionGeneric\n\n/**\n * Define a Convex HTTP action.\n *\n * @param func - The function. It receives an {@link ActionCtx} as its first argument, and a `Request` object\n * as its second.\n * @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.\n */\nexport const httpAction = httpActionGeneric\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/board.ts",
    "content": "import invariant from 'tiny-invariant'\nimport { v } from 'convex/values'\nimport {\n  type QueryCtx,\n  internalMutation,\n  mutation,\n  query,\n} from './_generated/server'\nimport schema, {\n  deleteColumnSchema,\n  deleteItemSchema,\n  newColumnsSchema,\n  updateBoardSchema,\n  updateColumnSchema,\n} from './schema'\nimport type { Doc, Id } from './_generated/dataModel'\n\nexport const seed = internalMutation(async (ctx) => {\n  const allBoards = await ctx.db.query('boards').collect()\n  if (allBoards.length > 0) {\n    return\n  }\n  await ctx.db.insert('boards', {\n    id: '1',\n    name: 'First board',\n    color: '#e0e0e0',\n  })\n})\n\n// Clear all boards (do this on a regular cadence for public examples)\nexport const clear = internalMutation(async (ctx) => {\n  const allBoards = await ctx.db.query('boards').collect()\n  for (const board of allBoards) {\n    await ctx.db.delete(board._id)\n  }\n  await ctx.db.insert('boards', {\n    id: '1',\n    name: 'First board',\n    color: '#e0e0e0',\n  })\n})\n\nfunction withoutSystemFields<T extends { _creationTime: number; _id: Id<any> }>(\n  doc: T,\n) {\n  const { _id, _creationTime, ...rest } = doc\n  return rest\n}\n\nasync function getFullBoard(ctx: QueryCtx, id: string) {\n  const board = withoutSystemFields(await ensureBoardExists(ctx, id))\n\n  const [columns, items] = await Promise.all([\n    ctx.db\n      .query('columns')\n      .withIndex('board', (q) => q.eq('boardId', board.id))\n      .collect(),\n    ctx.db\n      .query('items')\n      .withIndex('board', (q) => q.eq('boardId', board.id))\n      .collect(),\n  ])\n\n  return {\n    ...board,\n    columns: columns.map(withoutSystemFields),\n    items: items.map(withoutSystemFields),\n  }\n}\n\nexport const getBoards = query(async (ctx) => {\n  const boards = await ctx.db.query('boards').collect()\n  return await Promise.all(boards.map((b) => getFullBoard(ctx, b.id)))\n})\n\nexport const getBoard = query({\n  args: { id: v.string() },\n  handler: async (ctx, { id }) => {\n    return await getFullBoard(ctx, id)\n  },\n})\n\nasync function ensureBoardExists(\n  ctx: QueryCtx,\n  boardId: string,\n): Promise<Doc<'boards'>> {\n  const board = await ctx.db\n    .query('boards')\n    .withIndex('id', (q) => q.eq('id', boardId))\n    .unique()\n\n  invariant(board, `missing board ${boardId}`)\n  return board\n}\nasync function ensureColumnExists(\n  ctx: QueryCtx,\n  columnId: string,\n): Promise<Doc<'columns'>> {\n  const column = await ctx.db\n    .query('columns')\n    .withIndex('id', (q) => q.eq('id', columnId))\n    .unique()\n\n  invariant(column, `missing column: ${columnId}`)\n  return column\n}\nasync function ensureItemExists(\n  ctx: QueryCtx,\n  itemId: string,\n): Promise<Doc<'items'>> {\n  const item = await ctx.db\n    .query('items')\n    .withIndex('id', (q) => q.eq('id', itemId))\n    .unique()\n\n  invariant(item, `missing item: ${itemId}`)\n  return item\n}\n\nexport const createColumn = mutation({\n  args: newColumnsSchema,\n  handler: async (ctx, { boardId, name }) => {\n    ensureBoardExists(ctx, boardId)\n\n    const existingColumns = await ctx.db\n      .query('columns')\n      .withIndex('board', (q) => q.eq('boardId', boardId))\n      .collect()\n\n    ctx.db.insert('columns', {\n      boardId,\n      name,\n      order: existingColumns.length + 1,\n      id: crypto.randomUUID(),\n    })\n  },\n})\n\nexport const createItem = mutation({\n  args: schema.tables.items.validator,\n  handler: async (ctx, item) => {\n    await ensureBoardExists(ctx, item.boardId)\n    await ctx.db.insert('items', item)\n  },\n})\n\nexport const deleteItem = mutation({\n  args: deleteItemSchema,\n  handler: async (ctx, { id, boardId }) => {\n    await ensureBoardExists(ctx, boardId)\n    const item = await ensureItemExists(ctx, id)\n    await ctx.db.delete(item._id)\n  },\n})\n\nexport const updateItem = mutation({\n  args: schema.tables.items.validator,\n  handler: async (ctx, newItem) => {\n    const { id, boardId } = newItem\n    await ensureBoardExists(ctx, boardId)\n    const item = await ensureItemExists(ctx, id)\n    await ctx.db.patch(item._id, newItem)\n  },\n})\n\nexport const updateColumn = mutation({\n  args: updateColumnSchema,\n  handler: async (ctx, newColumn) => {\n    const { id, boardId } = newColumn\n    await ensureBoardExists(ctx, boardId)\n    const item = await ensureColumnExists(ctx, id)\n    await ctx.db.patch(item._id, newColumn)\n  },\n})\n\nexport const updateBoard = mutation({\n  args: updateBoardSchema,\n  handler: async (ctx, boardUpdate) => {\n    const board = await ensureBoardExists(ctx, boardUpdate.id)\n    await ctx.db.patch(board._id, boardUpdate)\n  },\n})\n\nexport const deleteColumn = mutation({\n  args: deleteColumnSchema,\n  handler: async (ctx, { boardId, id }) => {\n    await ensureBoardExists(ctx, boardId)\n    const column = await ensureColumnExists(ctx, id)\n    const items = await ctx.db\n      .query('items')\n      .withIndex('column', (q) => q.eq('columnId', id))\n      .collect()\n    await Promise.all(items.map((item) => ctx.db.delete(item._id)))\n    await ctx.db.delete(column._id)\n  },\n})\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/crons.ts",
    "content": "import { cronJobs } from 'convex/server'\nimport { internal } from './_generated/api'\n\nconst crons = cronJobs()\n\ncrons.cron('clear messages table', '0,20,40 * * * *', internal.board.clear)\n\nexport default crons\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/schema.ts",
    "content": "import { defineSchema, defineTable } from 'convex/server'\nimport { type Infer, v } from 'convex/values'\n\nconst schema = defineSchema({\n  boards: defineTable({\n    id: v.string(),\n    name: v.string(),\n    color: v.string(),\n  }).index('id', ['id']),\n\n  columns: defineTable({\n    id: v.string(),\n    boardId: v.string(),\n    name: v.string(),\n    order: v.number(),\n  })\n    .index('id', ['id'])\n    .index('board', ['boardId']),\n\n  items: defineTable({\n    id: v.string(),\n    title: v.string(),\n    content: v.optional(v.string()),\n    order: v.number(),\n    columnId: v.string(),\n    boardId: v.string(),\n  })\n    .index('id', ['id'])\n    .index('column', ['columnId'])\n    .index('board', ['boardId']),\n})\nexport default schema\n\nconst board = schema.tables.boards.validator\nconst column = schema.tables.columns.validator\nconst item = schema.tables.items.validator\n\nexport const updateBoardSchema = v.object({\n  id: board.fields.id,\n  name: v.optional(board.fields.name),\n  color: v.optional(v.string()),\n})\n\nexport const updateColumnSchema = v.object({\n  id: column.fields.id,\n  boardId: column.fields.boardId,\n  name: v.optional(column.fields.name),\n  order: v.optional(column.fields.order),\n})\n\nexport const deleteItemSchema = v.object({\n  id: item.fields.id,\n  boardId: item.fields.boardId,\n})\nconst { order, id, ...rest } = column.fields\nexport const newColumnsSchema = v.object(rest)\nexport const deleteColumnSchema = v.object({\n  boardId: column.fields.boardId,\n  id: column.fields.id,\n})\n\nexport type Board = Infer<typeof board>\nexport type Column = Infer<typeof column>\nexport type Item = Infer<typeof item>\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/convex/tsconfig.json",
    "content": "{\n  /* This TypeScript project config describes the environment that\n   * Convex functions run in and is used to typecheck them.\n   * You can modify it, but some settings required to use Convex.\n   */\n  \"compilerOptions\": {\n    /* These settings are not required by Convex and can be modified. */\n    \"allowJs\": true,\n    \"strict\": true,\n    \"moduleResolution\": \"Bundler\",\n    \"jsx\": \"react-jsx\",\n    \"skipLibCheck\": true,\n    \"allowSyntheticDefaultImports\": true,\n\n    /* These compiler options are required by Convex */\n    \"target\": \"ESNext\",\n    \"lib\": [\"ES2021\", \"dom\"],\n    \"forceConsistentCasingInFileNames\": true,\n    \"module\": \"ESNext\",\n    \"isolatedModules\": true,\n    \"noEmit\": true\n  },\n  \"include\": [\"./**/*\"],\n  \"exclude\": [\"./_generated\"]\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-convex-trellaux\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"npx convex dev --once && concurrently -r npm:dev:web npm:dev:db\",\n    \"dev:web\": \"vite dev\",\n    \"dev:db\": \"convex dev --run board:seed\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@convex-dev/react-query\": \"0.0.0-alpha.8\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-router-ssr-query\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"concurrently\": \"^8.2.2\",\n    \"convex\": \"^1.19.0\",\n    \"ky\": \"^1.7.4\",\n    \"msw\": \"^2.7.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"react-hot-toast\": \"^2.5.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"tiny-invariant\": \"^1.3.3\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/Board.tsx",
    "content": "import { useCallback, useMemo, useRef } from 'react'\nimport invariant from 'tiny-invariant'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { convexQuery } from '@convex-dev/react-query'\nimport { api } from '../../convex/_generated/api.js'\nimport { useUpdateBoardMutation } from '../queries.js'\nimport { NewColumn } from './NewColumn.js'\nimport { Column as ColumnComponent } from './Column.js'\nimport type { Column } from 'convex/schema.js'\nimport { EditableText } from '~/components/EditableText.js'\n\nexport function Board({ boardId }: { boardId: string }) {\n  const newColumnAddedRef = useRef(false)\n  const updateBoardMutation = useUpdateBoardMutation()\n  const { data: board } = useSuspenseQuery(\n    convexQuery(api.board.getBoard, { id: boardId }),\n  )\n\n  // scroll right when new columns are added\n  const scrollContainerRef = useRef<HTMLDivElement>(null)\n  const columnRef = useCallback((_node: HTMLElement | null) => {\n    if (scrollContainerRef.current && newColumnAddedRef.current) {\n      newColumnAddedRef.current = false\n      scrollContainerRef.current.scrollLeft =\n        scrollContainerRef.current.scrollWidth\n    }\n  }, [])\n\n  const itemsById = useMemo(\n    () => new Map(board.items.map((item) => [item.id, item])),\n    [board.items],\n  )\n\n  type ColumnWithItems = Column & { items: typeof board.items }\n\n  const columns = useMemo(() => {\n    const columnsMap = new Map<string, ColumnWithItems>()\n\n    for (const column of [...board.columns]) {\n      columnsMap.set(column.id, { ...column, items: [] })\n    }\n\n    // add items to their columns\n    for (const item of itemsById.values()) {\n      const columnId = item.columnId\n      const column = columnsMap.get(columnId)\n      invariant(\n        column,\n        `missing column: ${columnId} from ${[...columnsMap.keys()]}`,\n      )\n      column.items.push(item)\n    }\n\n    return [...columnsMap.values()].sort((a, b) => a.order - b.order)\n  }, [board.columns, itemsById])\n\n  return (\n    <div\n      className=\"grow min-h-0 flex flex-col overflow-x-scroll\"\n      ref={scrollContainerRef}\n      style={{ backgroundColor: board.color }}\n    >\n      <h1>\n        <EditableText\n          value={\n            // optimistic update\n            updateBoardMutation.isPending && updateBoardMutation.variables.name\n              ? updateBoardMutation.variables.name\n              : board.name\n          }\n          fieldName=\"name\"\n          inputClassName=\"mx-8 my-4 text-2xl font-medium border border-slate-400 rounded-lg py-1 px-2 text-black\"\n          buttonClassName=\"mx-8 my-4 text-2xl font-medium block rounded-lg text-left border border-transparent py-1 px-2 text-slate-800\"\n          buttonLabel={`Edit board \"${board.name}\" name`}\n          inputLabel=\"Edit board name\"\n          onChange={(value) => {\n            updateBoardMutation.mutate({\n              id: board.id,\n              name: value,\n            })\n          }}\n        />\n      </h1>\n\n      <div className=\"flex grow min-h-0 h-full items-start px-8 pb-4 w-fit\">\n        {columns.map((col, index) => {\n          return (\n            <ColumnComponent\n              ref={columnRef}\n              key={col.id}\n              name={col.name}\n              columnId={col.id}\n              boardId={board.id}\n              items={col.items}\n              order={col.order}\n              previousOrder={columns[index - 1] ? columns[index - 1].order : 0}\n              nextOrder={\n                columns[index + 1] ? columns[index + 1].order : col.order + 1\n              }\n            />\n          )\n        })}\n        <NewColumn\n          boardId={board.id}\n          editInitially={board.columns.length === 0}\n          onNewColumnAdded={() => {\n            newColumnAddedRef.current = true\n          }}\n        />\n      </div>\n\n      {/* trolling you to add some extra margin to the right of the container with a whole dang div */}\n      <div data-lol className=\"w-8 h-1 shrink-0\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/CancelButton.tsx",
    "content": "import { forwardRef } from 'react'\n\nexport const CancelButton = forwardRef<\n  HTMLButtonElement,\n  React.ButtonHTMLAttributes<HTMLButtonElement>\n>((props, ref) => {\n  return (\n    <button\n      ref={ref}\n      type=\"button\"\n      tabIndex={0}\n      {...props}\n      className=\"text-sm rounded-lg text-left p-2 font-medium hover:bg-slate-200 focus:bg-slate-200\"\n    />\n  )\n})\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/Card.tsx",
    "content": "import invariant from 'tiny-invariant'\nimport { forwardRef, useState } from 'react'\n\nimport { CONTENT_TYPES } from '../types'\nimport { Icon } from '../icons/icons'\nimport { useDeleteCardMutation, useUpdateCardMutation } from '../queries'\nimport { deleteItemSchema } from '../db/schema'\n\ninterface CardProps {\n  title: string\n  content: string | null\n  id: string\n  columnId: string\n  boardId: string\n  order: number\n  nextOrder: number\n  previousOrder: number\n}\n\nexport const Card = forwardRef<HTMLLIElement, CardProps>(\n  (\n    { title, content, id, columnId, boardId, order, nextOrder, previousOrder },\n    ref,\n  ) => {\n    const [acceptDrop, setAcceptDrop] = useState<'none' | 'top' | 'bottom'>(\n      'none',\n    )\n\n    const deleteCard = useDeleteCardMutation()\n    const moveCard = useUpdateCardMutation()\n\n    return (\n      <li\n        ref={ref}\n        onDragOver={(event) => {\n          if (event.dataTransfer.types.includes(CONTENT_TYPES.card)) {\n            event.preventDefault()\n            event.stopPropagation()\n            const rect = event.currentTarget.getBoundingClientRect()\n            const midpoint = (rect.top + rect.bottom) / 2\n            setAcceptDrop(event.clientY <= midpoint ? 'top' : 'bottom')\n          }\n        }}\n        onDragLeave={() => {\n          setAcceptDrop('none')\n        }}\n        onDrop={(event) => {\n          event.stopPropagation()\n\n          const transfer = JSON.parse(\n            event.dataTransfer.getData(CONTENT_TYPES.card) || 'null',\n          )\n\n          if (!transfer) {\n            return\n          }\n\n          invariant(transfer.id, 'missing cardId')\n          invariant(transfer.title, 'missing title')\n\n          const droppedOrder = acceptDrop === 'top' ? previousOrder : nextOrder\n          const moveOrder = (droppedOrder + order) / 2\n\n          moveCard.mutate({\n            order: moveOrder,\n            columnId,\n            boardId,\n            id: transfer.id,\n            title: transfer.title,\n          })\n\n          setAcceptDrop('none')\n        }}\n        className={\n          'border-t-2 border-b-2 -mb-[2px] last:mb-0 cursor-grab active:cursor-grabbing px-2 py-1 ' +\n          (acceptDrop === 'top'\n            ? 'border-t-red-500 border-b-transparent'\n            : acceptDrop === 'bottom'\n              ? 'border-b-red-500 border-t-transparent'\n              : 'border-t-transparent border-b-transparent')\n        }\n      >\n        <div\n          draggable\n          className=\"bg-white shadow-sm shadow-slate-300 border-slate-300 text-sm rounded-lg w-full py-1 px-2 relative\"\n          onDragStart={(event) => {\n            event.dataTransfer.effectAllowed = 'move'\n            event.dataTransfer.setData(\n              CONTENT_TYPES.card,\n              JSON.stringify({ id, title }),\n            )\n            event.stopPropagation()\n          }}\n        >\n          <h3>{title}</h3>\n          <div className=\"mt-2\">{content || <>&nbsp;</>}</div>\n          <form\n            onSubmit={(event) => {\n              event.preventDefault()\n\n              deleteCard.mutate(\n                deleteItemSchema.parse({\n                  id,\n                  boardId,\n                }),\n              )\n            }}\n          >\n            <button\n              aria-label=\"Delete card\"\n              className=\"absolute top-4 right-4 hover:text-red-500 flex gap-2 items-center\"\n              type=\"submit\"\n            >\n              <div className=\"opacity-50 text-xs\">{order}</div>\n              <Icon name=\"trash\" />\n            </button>\n          </form>\n        </div>\n      </li>\n    )\n  },\n)\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/Column.tsx",
    "content": "import { forwardRef, useCallback, useMemo, useRef, useState } from 'react'\nimport invariant from 'tiny-invariant'\nimport { twMerge } from 'tailwind-merge'\n\nimport { flushSync } from 'react-dom'\nimport { CONTENT_TYPES } from '../types'\nimport { Icon } from '../icons/icons'\nimport {\n  useDeleteColumnMutation,\n  useUpdateCardMutation,\n  useUpdateColumnMutation,\n} from '../queries'\nimport { EditableText } from './EditableText'\nimport { NewCard } from './NewCard'\nimport { Card } from './Card'\nimport type { RenderedItem } from '../types'\n\ninterface ColumnProps {\n  name: string\n  boardId: string\n  columnId: string\n  items: Array<RenderedItem>\n  nextOrder: number\n  previousOrder: number\n  order: number\n}\n\nexport const Column = forwardRef<HTMLDivElement, ColumnProps>(\n  (\n    { name, columnId, boardId, items, nextOrder, previousOrder, order },\n    ref,\n  ) => {\n    const [acceptCardDrop, setAcceptCardDrop] = useState(false)\n    const editState = useState(false)\n\n    const [acceptColumnDrop, setAcceptColumnDrop] = useState<\n      'none' | 'left' | 'right'\n    >('none')\n\n    const [edit, setEdit] = useState(false)\n\n    const itemRef = useCallback((node: HTMLElement | null) => {\n      node?.scrollIntoView({\n        block: 'nearest',\n      })\n    }, [])\n\n    const listRef = useRef<HTMLUListElement>(null!)\n\n    function scrollList() {\n      invariant(listRef.current)\n      listRef.current.scrollTop = listRef.current.scrollHeight\n    }\n\n    const updateColumnMutation = useUpdateColumnMutation()\n    const deleteColumnMutation = useDeleteColumnMutation()\n    const updateCardMutation = useUpdateCardMutation()\n\n    const sortedItems = useMemo(\n      () => [...items].sort((a, b) => a.order - b.order),\n      [items],\n    )\n\n    const cardDndProps = {\n      onDragOver: (event: React.DragEvent) => {\n        if (event.dataTransfer.types.includes(CONTENT_TYPES.card)) {\n          event.preventDefault()\n          setAcceptCardDrop(true)\n        }\n      },\n      onDragLeave: () => {\n        setAcceptCardDrop(false)\n      },\n      onDrop: (event: React.DragEvent) => {\n        const transfer = JSON.parse(\n          event.dataTransfer.getData(CONTENT_TYPES.card) || 'null',\n        )\n\n        if (!transfer) {\n          return\n        }\n\n        invariant(transfer.id, 'missing transfer.id')\n        invariant(transfer.title, 'missing transfer.title')\n\n        updateCardMutation.mutate({\n          order: (sortedItems[sortedItems.length - 1]?.order ?? 0) + 1,\n          columnId: columnId,\n          boardId,\n          id: transfer.id,\n          title: transfer.title,\n        })\n\n        setAcceptCardDrop(false)\n      },\n    }\n\n    return (\n      <div\n        ref={ref}\n        onDragOver={(event: React.DragEvent) => {\n          if (event.dataTransfer.types.includes(CONTENT_TYPES.column)) {\n            event.preventDefault()\n            event.stopPropagation()\n            const rect = event.currentTarget.getBoundingClientRect()\n            const midpoint = (rect.left + rect.right) / 2\n            setAcceptColumnDrop(event.clientX <= midpoint ? 'left' : 'right')\n          }\n        }}\n        onDragLeave={() => {\n          setAcceptColumnDrop('none')\n        }}\n        onDrop={(event: React.DragEvent) => {\n          const transfer = JSON.parse(\n            event.dataTransfer.getData(CONTENT_TYPES.column) || 'null',\n          )\n\n          if (!transfer) {\n            return\n          }\n\n          invariant(transfer.id, 'missing transfer.id')\n\n          const droppedOrder =\n            acceptColumnDrop === 'left' ? previousOrder : nextOrder\n          const moveOrder = (droppedOrder + order) / 2\n\n          updateColumnMutation.mutate({\n            boardId,\n            id: transfer.id,\n            order: moveOrder,\n          })\n\n          setAcceptColumnDrop('none')\n        }}\n        className={twMerge(\n          'border-l-transparent border-r-transparent border-l-2 border-r-2 -mr-[2px] last:mr-0 cursor-grab active:cursor-grabbing px-2 shrink-0 flex flex-col  max-h-full',\n          acceptColumnDrop === 'left'\n            ? 'border-l-red-500 border-r-transparent'\n            : acceptColumnDrop === 'right'\n              ? 'border-r-red-500 border-l-transparent'\n              : '',\n        )}\n      >\n        <div\n          draggable={!editState[0]}\n          onDragStart={(event: React.DragEvent) => {\n            event.dataTransfer.effectAllowed = 'move'\n            event.dataTransfer.setData(\n              CONTENT_TYPES.column,\n              JSON.stringify({ id: columnId, name }),\n            )\n          }}\n          {...(!items.length ? cardDndProps : {})}\n          className={twMerge(\n            'shrink-0 flex flex-col max-h-full w-80 border-slate-400 rounded-xl shadow-xs shadow-slate-400 bg-slate-100 relative',\n            acceptCardDrop && `outline-solid outline-2 outline-red-500`,\n          )}\n        >\n          <div className=\"p-2\" {...(items.length ? cardDndProps : {})}>\n            <EditableText\n              fieldName=\"name\"\n              editState={editState}\n              value={\n                // optimistic update\n                updateColumnMutation.isPending &&\n                updateColumnMutation.variables.name\n                  ? updateColumnMutation.variables.name\n                  : name\n              }\n              inputLabel=\"Edit column name\"\n              buttonLabel={`Edit column \"${name}\" name`}\n              inputClassName=\"border border-slate-400 w-full rounded-lg py-1 px-2 font-medium text-black\"\n              buttonClassName=\"block rounded-lg text-left w-full border border-transparent py-1 px-2 font-medium text-slate-600\"\n              onChange={(value) => {\n                updateColumnMutation.mutate({\n                  boardId,\n                  id: columnId,\n                  name: value,\n                })\n              }}\n            />\n          </div>\n\n          <ul ref={listRef} className=\"grow overflow-auto\">\n            {sortedItems.map((item, index, items) => (\n              <Card\n                ref={itemRef}\n                key={item.id}\n                title={item.title}\n                content={item.content ?? ''}\n                id={item.id}\n                boardId={boardId}\n                order={item.order}\n                columnId={columnId}\n                previousOrder={items[index - 1] ? items[index - 1].order : 0}\n                nextOrder={\n                  items[index + 1] ? items[index + 1].order : item.order + 1\n                }\n              />\n            ))}\n          </ul>\n          {edit ? (\n            <NewCard\n              columnId={columnId}\n              boardId={boardId}\n              nextOrder={\n                items.length === 0 ? 1 : items[items.length - 1].order + 1\n              }\n              onComplete={() => setEdit(false)}\n            />\n          ) : (\n            <div className=\"p-2\" {...(items.length ? cardDndProps : {})}>\n              <button\n                type=\"button\"\n                onClick={() => {\n                  flushSync(() => {\n                    setEdit(true)\n                  })\n                  scrollList()\n                }}\n                className=\"flex items-center gap-2 rounded-lg text-left w-full p-2 font-medium text-slate-500 hover:bg-slate-200 focus:bg-slate-200\"\n              >\n                <Icon name=\"plus\" /> Add a card\n              </button>\n            </div>\n          )}\n          <form\n            onSubmit={(event) => {\n              event.preventDefault()\n\n              deleteColumnMutation.mutate({\n                id: columnId,\n                boardId,\n              })\n            }}\n          >\n            <button\n              aria-label=\"Delete column\"\n              className=\"absolute top-4 right-4 hover:text-red-500 flex gap-2 items-center\"\n              type=\"submit\"\n            >\n              <Icon name=\"trash\" />\n            </button>\n          </form>\n        </div>\n      </div>\n    )\n  },\n)\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/EditableText.tsx",
    "content": "import { useRef, useState } from 'react'\nimport { flushSync } from 'react-dom'\n\nexport function EditableText({\n  fieldName,\n  value,\n  inputClassName,\n  inputLabel,\n  buttonClassName,\n  buttonLabel,\n  onChange,\n  editState,\n}: {\n  fieldName: string\n  value: string\n  inputClassName: string\n  inputLabel: string\n  buttonClassName: string\n  buttonLabel: string\n  onChange: (value: string) => void\n  editState?: [boolean, (value: boolean) => void]\n}) {\n  const localEditState = useState(false)\n  const [edit, setEdit] = editState || localEditState\n  const inputRef = useRef<HTMLInputElement>(null)\n  const buttonRef = useRef<HTMLButtonElement>(null)\n\n  return edit ? (\n    <form\n      onSubmit={(event) => {\n        event.preventDefault()\n\n        onChange(inputRef.current!.value)\n\n        flushSync(() => {\n          setEdit(false)\n        })\n\n        buttonRef.current?.focus()\n      }}\n    >\n      <input\n        required\n        ref={inputRef}\n        type=\"text\"\n        aria-label={inputLabel}\n        name={fieldName}\n        defaultValue={value}\n        className={inputClassName}\n        onKeyDown={(event) => {\n          if (event.key === 'Escape') {\n            flushSync(() => {\n              setEdit(false)\n            })\n            buttonRef.current?.focus()\n          }\n        }}\n        onBlur={(event) => {\n          if (\n            inputRef.current?.value !== value &&\n            inputRef.current?.value.trim() !== ''\n          ) {\n            onChange(inputRef.current!.value)\n          }\n          setEdit(false)\n        }}\n      />\n    </form>\n  ) : (\n    <button\n      aria-label={buttonLabel}\n      type=\"button\"\n      ref={buttonRef}\n      onClick={() => {\n        flushSync(() => {\n          setEdit(true)\n        })\n        inputRef.current?.select()\n      }}\n      className={buttonClassName}\n    >\n      {value || <span className=\"text-slate-400 italic\">Edit</span>}\n    </button>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/IconLink.tsx",
    "content": "export function IconLink({\n  icon,\n  href,\n  label,\n}: {\n  icon: string\n  href: string\n  label: string\n}) {\n  return (\n    <a\n      href={href}\n      className=\"text-slate-500 text-xs uppercase font-bold text-center\"\n    >\n      <img src={icon} aria-hidden className=\"inline-block h-8 rounded-full\" />\n      <span className=\"block mt-2\">{label}</span>\n    </a>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/Loader.tsx",
    "content": "export function Loader() {\n  return (\n    <div className=\"flex h-full\">\n      <div className=\"m-auto border-gray-300 h-20 max-h-full aspect-square animate-spin rounded-full border-8 border-t-slate-900\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/NewCard.tsx",
    "content": "import { useRef } from 'react'\nimport invariant from 'tiny-invariant'\n\nimport { ItemMutationFields } from '../types'\nimport { useCreateItemMutation } from '../queries'\nimport { itemSchema } from '../db/schema'\nimport { SaveButton } from '~/components/SaveButton'\nimport { CancelButton } from '~/components/CancelButton'\n\nexport function NewCard({\n  columnId,\n  boardId,\n  nextOrder,\n  onComplete,\n}: {\n  columnId: string\n  boardId: string\n  nextOrder: number\n  onComplete: () => void\n}) {\n  const textAreaRef = useRef<HTMLTextAreaElement>(null)\n  const buttonRef = useRef<HTMLButtonElement>(null)\n  const { mutate } = useCreateItemMutation()\n\n  return (\n    <form\n      method=\"post\"\n      className=\"px-2 py-1 border-t-2 border-b-2 border-transparent\"\n      onSubmit={(event) => {\n        event.preventDefault()\n\n        const formData = new FormData(event.currentTarget)\n        const id = crypto.randomUUID()\n        formData.set(ItemMutationFields.id.name, id)\n\n        invariant(textAreaRef.current)\n        textAreaRef.current.value = ''\n\n        mutate(itemSchema.parse(Object.fromEntries(formData.entries())))\n      }}\n      onBlur={(event) => {\n        if (!event.currentTarget.contains(event.relatedTarget)) {\n          onComplete()\n        }\n      }}\n    >\n      <input type=\"hidden\" name=\"boardId\" value={boardId} />\n      <input\n        type=\"hidden\"\n        name={ItemMutationFields.columnId.name}\n        value={columnId}\n      />\n      <input\n        type=\"hidden\"\n        name={ItemMutationFields.order.name}\n        value={nextOrder}\n      />\n\n      <textarea\n        autoFocus\n        required\n        ref={textAreaRef}\n        name={ItemMutationFields.title.name}\n        placeholder=\"Enter a title for this card\"\n        className=\"outline-hidden shadow-sm text-sm rounded-lg w-full py-1 px-2 resize-none placeholder:text-sm placeholder:text-slate-500 h-14\"\n        onKeyDown={(event) => {\n          if (event.key === 'Enter') {\n            event.preventDefault()\n            invariant(buttonRef.current, 'expected button ref')\n            buttonRef.current.click()\n          }\n          if (event.key === 'Escape') {\n            onComplete()\n          }\n        }}\n        onChange={(event) => {\n          const el = event.currentTarget\n          el.style.height = el.scrollHeight + 'px'\n        }}\n      />\n      <div className=\"flex justify-between\">\n        <SaveButton ref={buttonRef}>Save Card</SaveButton>\n        <CancelButton onClick={onComplete}>Cancel</CancelButton>\n      </div>\n    </form>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/NewColumn.tsx",
    "content": "import { useRef, useState } from 'react'\nimport invariant from 'tiny-invariant'\n\nimport { Icon } from '../icons/icons'\nimport { useCreateColumnMutation } from '../queries'\nimport { CancelButton } from '~/components/CancelButton'\nimport { SaveButton } from '~/components/SaveButton'\n\nexport function NewColumn({\n  boardId,\n  editInitially,\n  onNewColumnAdded,\n}: {\n  boardId: string\n  editInitially: boolean\n  onNewColumnAdded: () => void\n}) {\n  const [editing, setEditing] = useState(editInitially)\n  const inputRef = useRef<HTMLInputElement>(null)\n\n  const newColumnMutation = useCreateColumnMutation()\n\n  return editing ? (\n    <form\n      className=\"ml-2 p-2 shrink-0 flex flex-col gap-5 overflow-hidden max-h-full w-80 border rounded-xl shadow-sm bg-slate-100\"\n      onSubmit={(event) => {\n        event.preventDefault()\n        invariant(inputRef.current, 'missing input ref')\n\n        newColumnMutation.mutate({\n          boardId,\n          name: inputRef.current.value,\n        })\n\n        inputRef.current.value = ''\n\n        onNewColumnAdded()\n      }}\n      onBlur={(event) => {\n        if (!event.currentTarget.contains(event.relatedTarget)) {\n          setEditing(false)\n        }\n      }}\n    >\n      <input\n        autoFocus\n        required\n        ref={inputRef}\n        type=\"text\"\n        name=\"columnName\"\n        autoComplete=\"off\"\n        className=\"border border-slate-400 w-full rounded-lg py-1 px-2 font-medium text-black\"\n      />\n      <div className=\"flex justify-between\">\n        <SaveButton>Save Column</SaveButton>\n        <CancelButton onClick={() => setEditing(false)}>Cancel</CancelButton>\n      </div>\n    </form>\n  ) : (\n    <button\n      onClick={() => {\n        setEditing(true)\n      }}\n      aria-label=\"Add new column\"\n      className=\"ml-2 shrink-0 flex justify-center h-16 w-16 bg-black hover:bg-white bg-opacity-10 hover:bg-opacity-5 rounded-xl\"\n    >\n      <Icon name=\"plus\" size=\"xl\" />\n    </button>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/components/SaveButton.tsx",
    "content": "import { forwardRef } from 'react'\n\nexport const SaveButton = forwardRef<\n  HTMLButtonElement,\n  React.ButtonHTMLAttributes<HTMLButtonElement>\n>((props, ref) => {\n  return (\n    <button\n      ref={ref}\n      // this makes it so the button takes focus on clicks in safari I can't\n      // remember if this is the proper workaround or not, it's been a while!\n      // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus\n      // https://bugs.webkit.org/show_bug.cgi?id=22261\n      tabIndex={0}\n      {...props}\n      className=\"text-sm rounded-lg text-left p-2 font-medium text-white bg-blue-500\"\n    />\n  )\n})\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/db/schema.ts",
    "content": "import { z } from 'zod'\n\n// Zod is necessary for client side parsing.\n\nexport const itemSchema = z.object({\n  id: z.string(),\n  title: z.string(),\n  content: z.string().optional(),\n  order: z.coerce.number(),\n  columnId: z.string().uuid(),\n  boardId: z.coerce.string(),\n})\n\nexport const deleteItemSchema = itemSchema.pick({ id: true, boardId: true })\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/hooks/useOfflineIndicator.tsx",
    "content": "import { onlineManager } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport toast from 'react-hot-toast'\n\nexport function useOfflineIndicator() {\n  useEffect(() => {\n    return onlineManager.subscribe(() => {\n      if (onlineManager.isOnline()) {\n        toast.success('online', {\n          id: 'ReactQuery',\n          duration: 2000,\n        })\n      } else {\n        toast.error('offline', {\n          id: 'ReactQuery',\n          duration: Infinity,\n        })\n      }\n    })\n  }, [])\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/icons/icons.tsx",
    "content": "import iconsHref from './icons.svg?url'\n\nexport function Icon({\n  name,\n  size = 'md',\n  spin = false,\n}: {\n  name: string\n  size?: 'md' | 'xl'\n  spin?: boolean\n}) {\n  const classNames = {\n    md: 'w-4 h-4',\n    xl: 'w-8 h-8',\n  }\n  return (\n    <svg\n      className={`${classNames[size]} inline self-center ${\n        spin ? 'animate-spin' : ''\n      }`}\n    >\n      <use href={`${iconsHref}#${name}`} />\n    </svg>\n  )\n}\n\nexport function LoginIcon() {\n  return (\n    <svg className=\"inline self-center w-8 h-8 text-white transform scale-x-[-1]\">\n      <use href={`${iconsHref}#login`} />\n    </svg>\n  )\n}\n\nexport function LogoutIcon() {\n  return (\n    <svg className=\"inline self-center w-8 h-8 text-white\">\n      <use href={`${iconsHref}#logout`} />\n    </svg>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/queries.ts",
    "content": "import { useMutation } from '@tanstack/react-query'\nimport { convexQuery, useConvexMutation } from '@convex-dev/react-query'\nimport { api } from '../convex/_generated/api'\n\nexport const boardQueries = {\n  list: () => convexQuery(api.board.getBoards, {}),\n  detail: (id: string) => convexQuery(api.board.getBoard, { id }),\n}\n\nexport function useCreateColumnMutation() {\n  const mutationFn = useConvexMutation(\n    api.board.createColumn,\n  ).withOptimisticUpdate((localStore, args) => {\n    const board = localStore.getQuery(api.board.getBoard, { id: args.boardId })\n    if (!board) return\n\n    const randomId = Math.random() + ''\n\n    const newBoard = {\n      ...board,\n      columns: [\n        ...board.columns,\n        {\n          ...args,\n          order: board.columns.length + 1,\n          id: randomId,\n          items: [],\n        },\n      ],\n    }\n\n    localStore.setQuery(api.board.getBoard, { id: board.id }, newBoard)\n  })\n\n  return useMutation({ mutationFn })\n}\n\nexport function useCreateItemMutation() {\n  const mutationFn = useConvexMutation(\n    api.board.createItem,\n  ).withOptimisticUpdate((localStore, args) => {\n    const board = localStore.getQuery(api.board.getBoard, { id: args.boardId })\n    if (!board) return\n\n    const items = [...board.items, args]\n    localStore.setQuery(\n      api.board.getBoard,\n      { id: board.id },\n      { ...board, items },\n    )\n  })\n\n  return useMutation({ mutationFn })\n}\n\nexport function useUpdateCardMutation() {\n  const mutationFn = useConvexMutation(\n    api.board.updateItem,\n  ).withOptimisticUpdate((localStore, args) => {\n    const board = localStore.getQuery(api.board.getBoard, { id: args.boardId })\n    if (!board) return\n    const items = board.items.map((item) => (item.id === args.id ? args : item))\n    localStore.setQuery(\n      api.board.getBoard,\n      { id: board.id },\n      { ...board, items },\n    )\n  })\n\n  return useMutation({ mutationFn })\n}\n\nexport function useDeleteCardMutation() {\n  const mutationFn = useConvexMutation(\n    api.board.deleteItem,\n  ).withOptimisticUpdate((localStore, args) => {\n    const board = localStore.getQuery(api.board.getBoard, { id: args.boardId })\n    if (!board) return\n    const items = board.items.filter((item) => item.id !== args.id)\n    localStore.setQuery(\n      api.board.getBoard,\n      { id: board.id },\n      { ...board, items },\n    )\n  })\n\n  return useMutation({ mutationFn })\n}\n\nexport function useDeleteColumnMutation() {\n  const mutationFn = useConvexMutation(\n    api.board.deleteColumn,\n  ).withOptimisticUpdate((localStore, args) => {\n    const board = localStore.getQuery(api.board.getBoard, { id: args.boardId })\n    if (!board) return\n    const columns = board.columns.filter((col) => col.id !== args.id)\n    const items = board.items.filter((item) => item.columnId !== args.id)\n    localStore.setQuery(\n      api.board.getBoard,\n      { id: board.id },\n      { ...board, items, columns },\n    )\n  })\n\n  return useMutation({ mutationFn })\n}\n\nexport function useUpdateBoardMutation() {\n  const mutationFn = useConvexMutation(api.board.updateBoard)\n  return useMutation({ mutationFn })\n}\n\nexport function useUpdateColumnMutation() {\n  const mutationFn = useConvexMutation(\n    api.board.updateColumn,\n  ).withOptimisticUpdate((localStore, args) => {\n    const board = localStore.getQuery(api.board.getBoard, { id: args.boardId })\n    if (!board) return\n    const columns = board.columns.map((col) =>\n      col.id === args.id ? { ...col, ...args } : col,\n    )\n    localStore.setQuery(\n      api.board.getBoard,\n      { id: board.id },\n      { ...board, columns },\n    )\n  })\n\n  return useMutation({ mutationFn })\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as BoardsBoardIdRouteImport } from './routes/boards.$boardId'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BoardsBoardIdRoute = BoardsBoardIdRouteImport.update({\n  id: '/boards/$boardId',\n  path: '/boards/$boardId',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/boards/$boardId': typeof BoardsBoardIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/boards/$boardId': typeof BoardsBoardIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/boards/$boardId': typeof BoardsBoardIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/boards/$boardId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/boards/$boardId'\n  id: '__root__' | '/' | '/boards/$boardId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  BoardsBoardIdRoute: typeof BoardsBoardIdRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/boards/$boardId': {\n      id: '/boards/$boardId'\n      path: '/boards/$boardId'\n      fullPath: '/boards/$boardId'\n      preLoaderRoute: typeof BoardsBoardIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  BoardsBoardIdRoute: BoardsBoardIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport {\n  MutationCache,\n  QueryClient,\n  notifyManager,\n} from '@tanstack/react-query'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport toast from 'react-hot-toast'\nimport { ConvexQueryClient } from '@convex-dev/react-query'\nimport { ConvexProvider } from 'convex/react'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  if (typeof document !== 'undefined') {\n    notifyManager.setScheduler(window.requestAnimationFrame)\n  }\n\n  const CONVEX_URL = (import.meta as any).env.VITE_CONVEX_URL!\n  if (!CONVEX_URL) {\n    console.error('missing envar CONVEX_URL')\n  }\n  const convexQueryClient = new ConvexQueryClient(CONVEX_URL)\n\n  const queryClient: QueryClient = new QueryClient({\n    defaultOptions: {\n      queries: {\n        queryKeyHashFn: convexQueryClient.hashFn(),\n        queryFn: convexQueryClient.queryFn(),\n      },\n    },\n    mutationCache: new MutationCache({\n      onError: (error) => {\n        toast(error.message, { className: 'bg-red-500 text-white' })\n      },\n    }),\n  })\n  convexQueryClient.connect(queryClient)\n\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    context: { queryClient },\n    Wrap: ({ children }) => (\n      <ConvexProvider client={convexQueryClient.convexClient}>\n        {children}\n      </ConvexProvider>\n    ),\n    scrollRestoration: true,\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools/production'\nimport {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n  useRouterState,\n  HeadContent,\n  Scripts,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { Toaster } from 'react-hot-toast'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { IconLink } from '~/components/IconLink'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\nimport { Loader } from '~/components/Loader'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"h-screen flex flex-col min-h-0\">\n          <div className=\"bg-slate-900 border-b border-slate-800 flex items-center justify-between py-4 px-8 box-border\">\n            <div className=\"flex items-center gap-4\">\n              <div>\n                <Link to=\"/\" className=\"block leading-tight\">\n                  <div className=\"font-black text-2xl text-white\">Trellaux</div>\n                  <div className=\"text-slate-500\">a TanStack Demo</div>\n                </Link>\n              </div>\n              <LoadingIndicator />\n            </div>\n            <div className=\"flex items-center gap-6\">\n              {/* <label\n                htmlFor=\"countries\"\n                className=\"block text-sm font-medium text-gray-900 dark:text-white\"\n              >\n                Delay\n              </label>\n              <select\n                className=\"border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500\"\n                onChange={(event) => {\n                  // setExtraDelay(Number(event.currentTarget.value))\n                }}\n                defaultValue=\"0\"\n              >\n                <option value=\"0\">None</option>\n                <option value=\"100\">100</option>\n                <option value=\"500\">500</option>\n                <option value=\"2000\">2000</option>\n              </select> */}\n              <IconLink\n                href=\"https://github.com/TanStack/router/tree/main/examples/react/start-trellaux\"\n                label=\"Source\"\n                icon=\"/github-mark-white.png\"\n              />\n              <IconLink\n                href=\"https://tanstack.com\"\n                icon=\"/tanstack.png\"\n                label=\"TanStack\"\n              />\n            </div>\n          </div>\n\n          <div className=\"grow min-h-0 h-full flex flex-col\">\n            {children}\n            <Toaster />\n          </div>\n        </div>\n        <ReactQueryDevtools />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n\nfunction LoadingIndicator() {\n  const isLoading = useRouterState({ select: (s) => s.isLoading })\n  return (\n    <div\n      className={`h-12 transition-all duration-300 ${\n        isLoading ? `opacity-100 delay-300` : `opacity-0 delay-0`\n      }`}\n    >\n      <Loader />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/routes/boards.$boardId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Board } from '~/components/Board'\nimport { Loader } from '~/components/Loader'\nimport { boardQueries } from '~/queries'\n\nexport const Route = createFileRoute('/boards/$boardId')({\n  component: Home,\n  pendingComponent: () => <Loader />,\n  loader: async ({ params, context: { queryClient } }) => {\n    await queryClient.ensureQueryData(boardQueries.detail(params.boardId))\n  },\n})\n\nfunction Home() {\n  const { boardId } = Route.useParams()\n\n  return <Board boardId={boardId} />\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/routes/index.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { Link, createFileRoute } from '@tanstack/react-router'\nimport { convexQuery } from '@convex-dev/react-query'\nimport { api } from 'convex/_generated/api'\nimport { Loader } from '~/components/Loader'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  pendingComponent: () => <Loader />,\n})\n\nfunction Home() {\n  const boardsQuery = useSuspenseQuery(convexQuery(api.board.getBoards, {}))\n\n  return (\n    <div className=\"p-8 space-y-2\">\n      <h1 className=\"text-2xl font-black\">Boards</h1>\n      <ul className=\"flex flex-wrap list-disc\">\n        {boardsQuery.data.map((board) => (\n          <li key={board.id} className=\"ml-4\">\n            <Link\n              to=\"/boards/$boardId\"\n              params={{\n                boardId: board.id,\n              }}\n              className=\"font-bold text-blue-500\"\n            >\n              {board.name}\n            </Link>\n          </li>\n        ))}\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/types.ts",
    "content": "export interface RenderedItem {\n  id: string\n  title: string\n  order: number\n  content?: string\n  columnId: string\n}\n\nexport const CONTENT_TYPES = {\n  card: 'application/app-card',\n  column: 'application/app-column',\n}\n\nexport const INTENTS = {\n  updateColumnName: 'updateColumnName' as const,\n  updateBoardName: 'updateBoardName' as const,\n}\n\nexport const ItemMutationFields = {\n  id: { type: String, name: 'id' },\n  columnId: { type: String, name: 'columnId' },\n  order: { type: Number, name: 'order' },\n  title: { type: String, name: 'title' },\n} as const\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-convex-trellaux/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-counter/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-counter/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\ncount.txt\n"
  },
  {
    "path": "examples/react/start-counter/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-counter/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-counter/README.md",
    "content": "# TanStack Start - Counter Example\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-counter start-counter\n```\n\n## Deployment\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Basic state management\n- Interactive UI components\n"
  },
  {
    "path": "examples/react/start-counter/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-counter\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-counter/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-counter/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-counter/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-counter/src/routes/index.tsx",
    "content": "import * as fs from 'node:fs'\nimport { useRouter, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst filePath = 'count.txt'\n\nasync function readCount() {\n  return parseInt(\n    await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'),\n  )\n}\n\nconst getCount = createServerFn({ method: 'GET' }).handler(() => {\n  return readCount()\n})\n\nconst updateCount = createServerFn({ method: 'POST' })\n  .inputValidator((addBy: number) => addBy)\n  .handler(async ({ data }) => {\n    const count = await readCount()\n    await fs.promises.writeFile(filePath, `${count + data}`)\n  })\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => await getCount(),\n})\n\nfunction Home() {\n  const router = useRouter()\n  const state = Route.useLoaderData()\n\n  return (\n    <button\n      onClick={() => {\n        updateCount({ data: 1 }).then(() => {\n          router.invalidate()\n        })\n      }}\n    >\n      Add 1 to {state}?\n    </button>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-counter/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-counter/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  plugins: [tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\ncount.txt\n.env\n.nitro\n.tanstack\n.output\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-i18n-paraglide/.vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\"inlang.vs-code-extension\"]\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/README.md",
    "content": "# TanStack Start example with Paraglide\n\nThis example shows how to use Paraglide with TanStack Start.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Paraglide Documentation](https://inlang.com/m/gerre34r/library-inlang-paraglideJs)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-i18n-paraglide start-i18n-paraglide\n```\n\n## Getting started\n\n1. Init Paraglide JS\n\n```bash\nnpx @inlang/paraglide-js@latest init\n```\n\n2. Add the vite plugin to your `vite.config.ts`:\n\n```diff\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from \"@tanstack/react-start/plugin/vite\";\nimport react from '@vitejs/plugin-react'\n+import { paraglideVitePlugin } from \"@inlang/paraglide-js\";\n\nexport default defineConfig({\n       plugins: [\n    tanstackStart(),\n    react(),\n+              paraglideVitePlugin({\n+                      project: \"./project.inlang\",\n+                      outdir: \"./app/paraglide\",\n+     outputStructure: \"message-modules\",\n+     cookieName: \"PARAGLIDE_LOCALE\",\n+     strategy: [\"url\", \"cookie\", \"preferredLanguage\", \"baseLocale\"],\n+      urlPatterns: [\n+       {\n+         pattern: \"/:path(.*)?\",\n+         localized: [\n+           [\"en\", \"/en/:path(.*)?\"],\n+         ],\n+       },\n+     ],\n+              }),\n       ],\n});\n```\n\n3. Done :)\n\nRun the app and start translating. See the [basics documentation](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/basics) for information on how to use Paraglide's messages, parameters, and locale management.\n\n## Rewrite URL\n\nIf you want to handle how the URL looks when the user changes the locale, you can rewrite the URL in the router.\n\n```diff\nimport { createRouter } from \"@tanstack/react-router\";\nimport { routeTree } from \"./routeTree.gen\";\n+import { deLocalizeUrl, localizeUrl } from \"./paraglide/runtime.js\";\n\nconst router = createRouter({\n  routeTree,\n+ rewrite: {\n+   input: ({ url }) => deLocalizeUrl(url),\n+   output: ({ url }) => localizeUrl(url),\n  },\n});\n```\n\nIn `server.ts` intercept the request with the paraglideMiddleware.\n\n```ts\nimport { paraglideMiddleware } from './paraglide/server.js'\nimport handler from '@tanstack/react-start/server-entry'\nexport default {\n  fetch(req: Request): Promise<Response> {\n    return paraglideMiddleware(req, () => handler.fetch(req))\n  },\n}\n```\n\nIn `__root.tsx` change the html lang attribute to the current locale.\n\n```tsx\nimport { getLocale } from '../paraglide/runtime.js'\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html lang={getLocale()}>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n## Offline redirect\n\nIf you have an application that needs to work offline, you will need to handle the redirect in the client like this.\n\n```ts\nimport { shouldRedirect } from \"../paraglide/runtime\";\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const decision = await shouldRedirect({ url: window.location.href });\n\n    if (decision.redirectUrl) {\n      throw redirect({ href: decision.redirectUrl.href });\n    }\n  },\n  ...\n});\n```\n\n## Typesafe translated pathnames\n\nIf you don't want to miss any translated path, you can create a `createTranslatedPathnames` function and pass it to the vite plugin.\n\n```ts\n// i18n/lib.ts\nimport { Locale } from '@/paraglide/runtime'\nimport { FileRoutesByTo } from '../routeTree.gen'\n\ntype RoutePath = keyof FileRoutesByTo\n\nconst excludedPaths = ['admin', 'docs', 'api'] as const\n\ntype PublicRoutePath = Exclude<\n  RoutePath,\n  `${string}${(typeof excludedPaths)[number]}${string}`\n>\n\ntype TranslatedPathname = {\n  pattern: string\n  localized: Array<[Locale, string]>\n}\n\nfunction toUrlPattern(path: string) {\n  return (\n    path\n      // catch-all\n      .replace(/\\/\\$$/, '/:path(.*)?')\n      // optional parameters: {-$param}\n      .replace(/\\{-\\$([a-zA-Z0-9_]+)\\}/g, ':$1?')\n      // named parameters: $param\n      .replace(/\\$([a-zA-Z0-9_]+)/g, ':$1')\n      // remove trailing slash\n      .replace(/\\/+$/, '')\n  )\n}\n\nfunction createTranslatedPathnames(\n  input: Record<PublicRoutePath, Record<Locale, string>>,\n): TranslatedPathname[] {\n  return Object.entries(input).map(([pattern, locales]) => ({\n    pattern: toUrlPattern(pattern),\n    localized: Object.entries(locales).map(\n      ([locale, path]) =>\n        [locale as Locale, `/${locale}${toUrlPattern(path)}`] satisfies [\n          Locale,\n          string,\n        ],\n    ),\n  }))\n}\n\nexport const translatedPathnames = createTranslatedPathnames({\n  '/': {\n    en: '/',\n    de: '/',\n  },\n  '/about': {\n    en: '/about',\n    de: '/ueber',\n  },\n})\n```\n\nAnd import into the Paraglide Vite plugin.\n\n```ts\n// vite.config.ts\nimport { translatedPathnames } from './i18n/lib'\n\nexport default defineConfig({\n  plugins: [\n    paraglideVitePlugin({\n      // ... other options\n      urlPatterns: translatedPathnames,\n    }),\n  ],\n})\n```\n\n## Prerender routes\n\nYou can use the `localizeHref` function to map the routes to localized versions and import into the pages option in the TanStack Start plugin. For this to work you will need to compile paraglide before the build with the CLI.\n\n```ts\nimport { localizeHref } from './paraglide/runtime'\nexport const prerenderRoutes = ['/', '/about'].map((path) => ({\n  path: localizeHref(path),\n  prerender: {\n    enabled: true,\n  },\n}))\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Multi-language support with Paraglide in TanStack Start\n- Server-side translation\n- Type-safe translations\n- Locale-based routing\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/messages/de.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Guten Tag {username}\",\n  \"server_message\": \"Server Nachricht {emoji}\",\n  \"about_message\": \"Über uns\",\n  \"home_page\": \"Startseite\",\n  \"about_page\": \"Über uns\"\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/messages/en.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Hello world {username}\",\n  \"server_message\": \"Server message {emoji}\",\n  \"about_message\": \"About message\",\n  \"home_page\": \"Home page\",\n  \"about_page\": \"About page\"\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/package.json",
    "content": "{\n  \"name\": \"tanstack-start-i18n-paraglide\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"start\": \"node .output/server/index.mjs\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-devtools\": \"^0.7.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.1.1\",\n    \"react-dom\": \"^19.1.1\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.18.6\",\n    \"@types/react\": \"^19.1.13\",\n    \"@types/react-dom\": \"^19.1.9\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.9.2\",\n    \"vite\": \"^8.0.0\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"@inlang/paraglide-js\": \"^2.4.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/project.inlang/.gitignore",
    "content": "cache"
  },
  {
    "path": "examples/react/start-i18n-paraglide/project.inlang/project_id",
    "content": "UoZ15Q8qSGIbImRS3Y"
  },
  {
    "path": "examples/react/start-i18n-paraglide/project.inlang/settings.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/project-settings\",\n  \"baseLocale\": \"en\",\n  \"locales\": [\"en\", \"de\"],\n  \"modules\": [\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js\",\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js\"\n  ],\n  \"plugin.inlang.messageFormat\": {\n    \"pathPattern\": \"./messages/{locale}.json\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/public/manifest.json",
    "content": "{\n  \"short_name\": \"TanStack App\",\n  \"name\": \"Create TanStack App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport { deLocalizeUrl, localizeUrl } from './paraglide/runtime'\n\n// Create a new router instance\nexport const getRouter = () => {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreloadStaleTime: 0,\n    rewrite: {\n      input: ({ url }) => deLocalizeUrl(url),\n      output: ({ url }) => localizeUrl(url),\n    },\n  })\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\nimport { TanStackDevtools } from '@tanstack/react-devtools'\nimport styles from '../styles.css?url'\nimport { getLocale, locales, setLocale } from '@/paraglide/runtime'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: styles }],\n  }),\n\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html lang={getLocale()}>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg justify-between\">\n          <div className=\"flex gap-2 text-lg\">\n            <Link\n              to=\"/\"\n              activeProps={{\n                className: 'font-bold',\n              }}\n              activeOptions={{ exact: true }}\n            >\n              {m.home_page()}\n            </Link>\n\n            <Link\n              to=\"/about\"\n              activeProps={{\n                className: 'font-bold',\n              }}\n            >\n              {m.about_page()}\n            </Link>\n          </div>\n\n          <div className=\"flex gap-2 text-lg\">\n            {locales.map((locale) => (\n              <button\n                key={locale}\n                onClick={() => setLocale(locale)}\n                data-active-locale={locale === getLocale()}\n                className=\"rounded p-1 px-2 border border-gray-300 cursor-pointer [&[data-active-locale=true]]:bg-gray-500 [&[data-active-locale=true]]:text-white\"\n              >\n                {locale}\n              </button>\n            ))}\n          </div>\n        </div>\n\n        <hr />\n\n        <div className=\"p-2\">{children}</div>\n\n        <TanStackDevtools\n          config={{\n            position: 'bottom-left',\n          }}\n          plugins={[\n            {\n              name: 'Tanstack Router',\n              render: <TanStackRouterDevtoolsPanel />,\n            },\n          ]}\n        />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>{m.about_message()}</div>\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { m } from '@/paraglide/messages.js'\nimport { getLocale } from '@/paraglide/runtime.js'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst getServerMessage = createServerFn()\n  .inputValidator((emoji: string) => emoji)\n  .handler((ctx) => {\n    return m.server_message({ emoji: ctx.data })\n  })\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => {\n    return {\n      messageFromLoader: m.example_message({ username: 'John Doe' }),\n      serverFunctionMessage: await getServerMessage({ data: '📩' }),\n    }\n  },\n})\n\nfunction Home() {\n  const { serverFunctionMessage, messageFromLoader } = Route.useLoaderData()\n  return (\n    <div className=\"p-2\">\n      <h2>Message from loader: {messageFromLoader}</h2>\n      <h2>Server function message: {serverFunctionMessage}:</h2>\n      <h2>{m.example_message({ username: 'John Doe' })}</h2>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/server.ts",
    "content": "import { paraglideMiddleware } from './paraglide/server.js'\nimport handler from '@tanstack/react-start/server-entry'\n\nexport default {\n  fetch(req: Request): Promise<Response> {\n    return paraglideMiddleware(req, () => handler.fetch(req))\n  },\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/utils/prerender.ts",
    "content": "import { localizeHref } from '../paraglide/runtime'\n\nexport const prerenderRoutes = ['/', '/about'].map((path) => ({\n  path: localizeHref(path),\n  prerender: {\n    enabled: true,\n  },\n}))\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/src/utils/translated-pathnames.ts",
    "content": "import { Locale } from '@/paraglide/runtime'\nimport { FileRoutesByTo } from '../routeTree.gen'\n\ntype RoutePath = keyof FileRoutesByTo\n\nconst excludedPaths = ['admin', 'docs', 'api'] as const\n\ntype PublicRoutePath = Exclude<\n  RoutePath,\n  `${string}${(typeof excludedPaths)[number]}${string}`\n>\n\ntype TranslatedPathname = {\n  pattern: string\n  localized: Array<[Locale, string]>\n}\n\nfunction toUrlPattern(path: string) {\n  return (\n    path\n      // catch-all\n      .replace(/\\/\\$$/, '/:path(.*)?')\n      // optional parameters: {-$param}\n      .replace(/\\{-\\$([a-zA-Z0-9_]+)\\}/g, ':$1?')\n      // named parameters: $param\n      .replace(/\\$([a-zA-Z0-9_]+)/g, ':$1')\n      // remove trailing slash\n      .replace(/\\/+$/, '')\n  )\n}\n\nfunction createTranslatedPathnames(\n  input: Record<PublicRoutePath, Record<Locale, string>>,\n): TranslatedPathname[] {\n  return Object.entries(input).map(([pattern, locales]) => ({\n    pattern: toUrlPattern(pattern),\n    localized: Object.entries(locales).map(\n      ([locale, path]) =>\n        [locale as Locale, `/${locale}${toUrlPattern(path)}`] satisfies [\n          Locale,\n          string,\n        ],\n    ),\n  }))\n}\n\nexport const translatedPathnames = createTranslatedPathnames({\n  '/': {\n    en: '/',\n    de: '/',\n  },\n  '/about': {\n    en: '/about',\n    de: '/ueber',\n  },\n})\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"types\": [\"vite/client\"],\n    \"allowJs\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": false,\n    \"noEmit\": true,\n\n    /* Linting */\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedSideEffectImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  }\n}\n"
  },
  {
    "path": "examples/react/start-i18n-paraglide/vite.config.ts",
    "content": "import { paraglideVitePlugin } from '@inlang/paraglide-js'\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst config = defineConfig({\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    paraglideVitePlugin({\n      project: './project.inlang',\n      outdir: './src/paraglide',\n      outputStructure: 'message-modules',\n      cookieName: 'PARAGLIDE_LOCALE',\n      strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'],\n      urlPatterns: [\n        {\n          pattern: '/',\n          localized: [\n            ['en', '/en'],\n            ['de', '/de'],\n          ],\n        },\n        {\n          pattern: '/about',\n          localized: [\n            ['en', '/en/about'],\n            ['de', '/de/ueber'],\n          ],\n        },\n        {\n          pattern: '/:path(.*)?',\n          localized: [\n            ['en', '/en/:path(.*)?'],\n            ['de', '/de/:path(.*)?'],\n          ],\n        },\n      ],\n    }),\n    tanstackStart(),\n    viteReact(),\n    tailwindcss(),\n  ],\n})\n\nexport default config\n"
  },
  {
    "path": "examples/react/start-large/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-large/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n(gen)\nnode_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build"
  },
  {
    "path": "examples/react/start-large/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-large/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-large/README.md",
    "content": "# TanStack Start - Large Example\n\nA large-scale TanStack Start example demonstrating performance with many routes.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-large start-large\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example contains a large number of routes to demonstrate TanStack Router's performance and scalability with large applications.\n"
  },
  {
    "path": "examples/react/start-large/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-large\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"gen\": \"node ./src/createRoutes.mjs\",\n    \"test:types\": \"tsc --extendedDiagnostics\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"valibot\": \"^1.0.0-beta.15\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/react/start-large/src/createRoutes.mjs",
    "content": "import { readFile, writeFile, mkdir } from 'fs/promises'\nimport { existsSync } from 'fs'\n\nconst length = 100\n\nconst main = async () => {\n  const absolute = (await readFile('./src/routes/absolute.tsx')).toString()\n  const relative = (await readFile('./src/routes/relative.tsx')).toString()\n  const searchRoute = (\n    await readFile('./src/routes/search/route.tsx')\n  ).toString()\n  const search = (\n    await readFile('./src/routes/search/searchPlaceholder.tsx')\n  ).toString()\n  const paramsRoute = (\n    await readFile('./src/routes/params/route.tsx')\n  ).toString()\n  const params = await (\n    await readFile('./src/routes/params/$paramsPlaceholder.tsx')\n  ).toString()\n\n  if (!existsSync('./src/routes/(gen)')) {\n    await mkdir('./src/routes/(gen)')\n  }\n\n  if (!existsSync('./src/routes/(gen)/search')) {\n    await mkdir('./src/routes/(gen)/search')\n  }\n\n  if (!existsSync('./src/routes/(gen)/params')) {\n    await mkdir('./src/routes/(gen)/params')\n  }\n\n  await writeFile('./src/routes/(gen)/search/route.tsx', searchRoute)\n  await writeFile('./src/routes/(gen)/params/route.tsx', paramsRoute)\n\n  for (let y = 0; y < length; y = y + 1) {\n    const replacedAbsolute = absolute.replaceAll('/absolute', `/absolute${y}`)\n    const replacedRelative = relative.replaceAll('/relative', `/relative${y}`)\n    const replacedSearch = search.replaceAll('searchPlaceholder', `search${y}`)\n    const replacedParams = params.replaceAll('paramsPlaceholder', `param${y}`)\n    await writeFile(`./src/routes/(gen)/absolute${y}.tsx`, replacedAbsolute)\n    await writeFile(`./src/routes/(gen)/relative${y}.tsx`, replacedRelative)\n    await writeFile(`./src/routes/(gen)/search/search${y}.tsx`, replacedSearch)\n    await writeFile(`./src/routes/(gen)/params/$param${y}.tsx`, replacedParams)\n  }\n}\n\nmain()\n"
  },
  {
    "path": "examples/react/start-large/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as RelativeRouteImport } from './routes/relative'\nimport { Route as LinkPropsRouteImport } from './routes/linkProps'\nimport { Route as AbsoluteRouteImport } from './routes/absolute'\nimport { Route as SearchRouteRouteImport } from './routes/search/route'\nimport { Route as ParamsRouteRouteImport } from './routes/params/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SearchSearchPlaceholderRouteImport } from './routes/search/searchPlaceholder'\nimport { Route as ParamsParamsPlaceholderRouteImport } from './routes/params/$paramsPlaceholder'\n\nconst RelativeRoute = RelativeRouteImport.update({\n  id: '/relative',\n  path: '/relative',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LinkPropsRoute = LinkPropsRouteImport.update({\n  id: '/linkProps',\n  path: '/linkProps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbsoluteRoute = AbsoluteRouteImport.update({\n  id: '/absolute',\n  path: '/absolute',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchRouteRoute = SearchRouteRouteImport.update({\n  id: '/search',\n  path: '/search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsRouteRoute = ParamsRouteRouteImport.update({\n  id: '/params',\n  path: '/params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchSearchPlaceholderRoute = SearchSearchPlaceholderRouteImport.update({\n  id: '/searchPlaceholder',\n  path: '/searchPlaceholder',\n  getParentRoute: () => SearchRouteRoute,\n} as any)\nconst ParamsParamsPlaceholderRoute = ParamsParamsPlaceholderRouteImport.update({\n  id: '/$paramsPlaceholder',\n  path: '/$paramsPlaceholder',\n  getParentRoute: () => ParamsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  id:\n    | '__root__'\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ParamsRouteRoute: typeof ParamsRouteRouteWithChildren\n  SearchRouteRoute: typeof SearchRouteRouteWithChildren\n  AbsoluteRoute: typeof AbsoluteRoute\n  LinkPropsRoute: typeof LinkPropsRoute\n  RelativeRoute: typeof RelativeRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/relative': {\n      id: '/relative'\n      path: '/relative'\n      fullPath: '/relative'\n      preLoaderRoute: typeof RelativeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/linkProps': {\n      id: '/linkProps'\n      path: '/linkProps'\n      fullPath: '/linkProps'\n      preLoaderRoute: typeof LinkPropsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/absolute': {\n      id: '/absolute'\n      path: '/absolute'\n      fullPath: '/absolute'\n      preLoaderRoute: typeof AbsoluteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search': {\n      id: '/search'\n      path: '/search'\n      fullPath: '/search'\n      preLoaderRoute: typeof SearchRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params': {\n      id: '/params'\n      path: '/params'\n      fullPath: '/params'\n      preLoaderRoute: typeof ParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search/searchPlaceholder': {\n      id: '/search/searchPlaceholder'\n      path: '/searchPlaceholder'\n      fullPath: '/search/searchPlaceholder'\n      preLoaderRoute: typeof SearchSearchPlaceholderRouteImport\n      parentRoute: typeof SearchRouteRoute\n    }\n    '/params/$paramsPlaceholder': {\n      id: '/params/$paramsPlaceholder'\n      path: '/$paramsPlaceholder'\n      fullPath: '/params/$paramsPlaceholder'\n      preLoaderRoute: typeof ParamsParamsPlaceholderRouteImport\n      parentRoute: typeof ParamsRouteRoute\n    }\n  }\n}\n\ninterface ParamsRouteRouteChildren {\n  ParamsParamsPlaceholderRoute: typeof ParamsParamsPlaceholderRoute\n}\n\nconst ParamsRouteRouteChildren: ParamsRouteRouteChildren = {\n  ParamsParamsPlaceholderRoute: ParamsParamsPlaceholderRoute,\n}\n\nconst ParamsRouteRouteWithChildren = ParamsRouteRoute._addFileChildren(\n  ParamsRouteRouteChildren,\n)\n\ninterface SearchRouteRouteChildren {\n  SearchSearchPlaceholderRoute: typeof SearchSearchPlaceholderRoute\n}\n\nconst SearchRouteRouteChildren: SearchRouteRouteChildren = {\n  SearchSearchPlaceholderRoute: SearchSearchPlaceholderRoute,\n}\n\nconst SearchRouteRouteWithChildren = SearchRouteRoute._addFileChildren(\n  SearchRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ParamsRouteRoute: ParamsRouteRouteWithChildren,\n  SearchRouteRoute: SearchRouteRouteWithChildren,\n  AbsoluteRoute: AbsoluteRoute,\n  LinkPropsRoute: LinkPropsRoute,\n  RelativeRoute: RelativeRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-large/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { QueryClient } from '@tanstack/react-query'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: {\n      queryClient: queryClient,\n    },\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/react/start-large/src/routes/__root.tsx",
    "content": "// src/routes/__root.tsx\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport type { QueryClient } from '@tanstack/react-query'\nimport type { ReactNode } from 'react'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nexport interface Context {\n  queryClient: QueryClient\n}\n\nexport const Route = createRootRouteWithContext<Context>()({\n  head: () => ({\n    links: [{ rel: 'stylesheet' }],\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: Readonly<{ children: ReactNode }>) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-large/src/routes/absolute.tsx",
    "content": "import * as React from 'react'\nimport { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/absolute')({\n  component: AbsoluteComponent,\n})\n\nfunction AbsoluteComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/absolute\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Absolute\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-large/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-large/src/routes/linkProps.tsx",
    "content": "import * as React from 'react'\nimport { Link, linkOptions, createFileRoute } from '@tanstack/react-router'\nimport {\n  customRedirect,\n  ListItems,\n  MyLink,\n  useCustomNavigate,\n} from '~/typePrimitives'\n\nexport const Route = createFileRoute('/linkProps')({\n  component: LinkPropsPage,\n  loader: () => {\n    throw customRedirect({\n      to: '/search/searchPlaceholder',\n      search: {\n        searchPlaceholder: 'searchPlaceholder',\n        rootSearch: 0,\n        page: 0,\n        offset: 0,\n        search: 'hi',\n      },\n    })\n  },\n})\n\nfunction LinkPropsPage() {\n  useCustomNavigate({\n    to: '/search/searchPlaceholder',\n    search: {\n      searchPlaceholder: 'searchPlaceholder',\n      rootSearch: 0,\n      page: 0,\n      offset: 0,\n      search: 'hi',\n    },\n  })\n\n  const linkProps = linkOptions({\n    to: '/absolute',\n  })\n\n  return (\n    <>\n      <MyLink\n        from=\"/search/searchPlaceholder\"\n        to=\"../searchPlaceholder\"\n        search={{\n          searchPlaceholder: 'searchPlaceholder',\n          rootSearch: 0,\n          page: 0,\n          offset: 0,\n          search: 'hi',\n        }}\n      />\n      <ListItems\n        from=\"/search/searchPlaceholder\"\n        items={[\n          {\n            to: '../searchPlaceholder',\n            search: {\n              searchPlaceholder: 'searchPlaceholder',\n              rootSearch: 0,\n              page: 0,\n              offset: 0,\n              search: 'hi',\n            },\n          },\n        ]}\n      />\n      <Link {...linkProps} />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-large/src/routes/params/$paramsPlaceholder.tsx",
    "content": "import * as React from 'react'\nimport { Link, createFileRoute } from '@tanstack/react-router'\nimport * as v from 'valibot'\nimport { queryOptions } from '@tanstack/react-query'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\n\nconst params = v.object({\n  oneParamsPlaceholder: v.literal('oneParamsPlaceholder'),\n  twoParamsPlaceholder: v.literal('twoParamsPlaceholder'),\n  threeParamsPlaceholder: v.literal('threeParamsPlaceholder'),\n})\n\nconst loaderResult = v.object({\n  params,\n})\n\nconst middleware = createMiddleware({ type: 'function' })\n  .inputValidator(params)\n  .client(({ next }) => {\n    const context = { client: { paramsPlaceholder: 'paramsPlaceholder' } }\n    return next({\n      context,\n      sendContext: context,\n    })\n  })\n  .server(({ next }) => {\n    const context = { server: { paramsPlaceholder: 'paramsPlaceholder' } }\n    return next({\n      context,\n      sendContext: context,\n    })\n  })\n\nconst fn = createServerFn()\n  .middleware([middleware])\n  .handler(() => {\n    return v.parse(loaderResult, {})\n  })\n\nconst paramsQueryOptions = queryOptions({\n  queryKey: ['paramsPlaceholder'],\n  queryFn: () => {\n    return v.parse(loaderResult, {})\n  },\n})\n\nexport const Route = createFileRoute('/params/$paramsPlaceholder')({\n  component: ParamsComponent,\n  context: () => ({\n    paramsQueryOptions: queryOptions({\n      queryKey: ['paramsPlaceholder'],\n      queryFn: async () =>\n        await fn({\n          data: {\n            oneParamsPlaceholder: 'oneParamsPlaceholder',\n            twoParamsPlaceholder: 'twoParamsPlaceholder',\n            threeParamsPlaceholder: 'threeParamsPlaceholder',\n          },\n        }),\n    }),\n  }),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(paramsQueryOptions),\n})\n\nfunction ParamsComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/params/$paramsPlaceholder\"\n        params={{\n          paramsPlaceholder: 'params',\n        }}\n      />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-large/src/routes/params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/params')({\n  component: () => <div>Hello /params!</div>,\n})\n"
  },
  {
    "path": "examples/react/start-large/src/routes/relative.tsx",
    "content": "import * as React from 'react'\nimport { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/relative')({\n  component: RelativeComponent,\n})\n\nfunction RelativeComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        from={Route.fullPath}\n        to=\"../relative\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Relative\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-large/src/routes/search/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as v from 'valibot'\n\nconst search = v.object({\n  rootSearch: v.number(),\n})\n\nexport const Route = createFileRoute('/search')({\n  component: () => <div>Hello /search!</div>,\n  validateSearch: search,\n})\n"
  },
  {
    "path": "examples/react/start-large/src/routes/search/searchPlaceholder.tsx",
    "content": "import { createFileRoute, Link } from '@tanstack/react-router'\nimport * as v from 'valibot'\nimport { queryOptions } from '@tanstack/react-query'\nimport { createMiddleware, createServerFn } from '@tanstack/react-start'\n\nconst search = v.object({\n  searchPlaceholder: v.literal('searchPlaceholder'),\n  page: v.number(),\n  offset: v.number(),\n  search: v.string(),\n})\n\nconst loaderResult = v.object({\n  searchPlaceholder: v.number(),\n})\n\nconst middleware = createMiddleware({ type: 'function' })\n  .inputValidator(search)\n  .client(({ next }) => {\n    const context = { client: { searchPlaceholder: 'searchPlaceholder' } }\n    return next({\n      context,\n      sendContext: context,\n    })\n  })\n  .server(({ next }) => {\n    const context = { server: { searchPlaceholder: 'searchPlaceholder' } }\n    return next({\n      context,\n      sendContext: context,\n    })\n  })\n\nconst fn = createServerFn()\n  .middleware([middleware])\n  .handler(() => {\n    const result = v.parse(loaderResult, {\n      searchPlaceholder: 0,\n    })\n    return result\n  })\n\nexport const Route = createFileRoute('/search/searchPlaceholder')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response('searchPlaceholder')\n      },\n    },\n  },\n  component: SearchComponent,\n  validateSearch: search,\n  loaderDeps: ({ search }) => ({ search }),\n  context: (ctx) => ({\n    searchQueryOptions: queryOptions({\n      queryKey: ['searchPlaceholder'],\n      queryFn: () => fn({ data: ctx.deps.search }),\n    }),\n  }),\n  loader: async (opts) => {\n    const search = await opts.context.queryClient.ensureQueryData(\n      opts.context.searchQueryOptions,\n    )\n\n    return {\n      search,\n    }\n  },\n})\n\nfunction SearchComponent() {\n  return (\n    <div className=\"p-2 space-y-2\">\n      <Link\n        to=\"/search/searchPlaceholder\"\n        className=\"block py-1 text-blue-800 hover:text-blue-600\"\n        search={{\n          searchPlaceholder: 'searchPlaceholder',\n          page: 0,\n          offset: 10,\n          search: 'search',\n          rootSearch: 0,\n        }}\n      >\n        Search\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-large/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-large/src/typePrimitives.tsx",
    "content": "import * as React from 'react'\nimport { Link, redirect, useNavigate } from '@tanstack/react-router'\nimport type {\n  RegisteredRouter,\n  ValidateFromPath,\n  ValidateLinkOptions,\n  ValidateLinkOptionsArray,\n  ValidateNavigateOptions,\n  ValidateRedirectOptions,\n} from '@tanstack/react-router'\n\nexport function customRedirect<TRouter extends RegisteredRouter, TOptions>(\n  options: ValidateRedirectOptions<TRouter, TOptions>,\n): void\nexport function customRedirect(options: ValidateRedirectOptions): void {\n  throw redirect(options)\n}\n\nexport function useCustomNavigate<TRouter extends RegisteredRouter, TOptions>(\n  options: ValidateNavigateOptions<TRouter, TOptions>,\n): void\nexport function useCustomNavigate(options: ValidateNavigateOptions): void {\n  const navigate = useNavigate()\n\n  const useIsomorphicLayoutEffect =\n    typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\n  useIsomorphicLayoutEffect(() => {\n    navigate(options)\n  }, [navigate, options])\n}\n\nexport function MyLink<TRouter extends RegisteredRouter, TOptions>(\n  options: ValidateLinkOptions<TRouter, TOptions>,\n): React.ReactNode\nexport function MyLink(options: ValidateLinkOptions) {\n  return <Link {...options} />\n}\n\nexport interface ListItemsProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions extends ReadonlyArray<unknown> = ReadonlyArray<unknown>,\n  TFrom extends string = string,\n> {\n  from: ValidateFromPath<TRouter, TFrom>\n  items: ValidateLinkOptionsArray<TRouter, TOptions, TFrom>\n}\n\nexport function ListItems<\n  TRouter extends RegisteredRouter,\n  TOptions extends ReadonlyArray<unknown>,\n  TFrom extends string,\n>(options: ListItemsProps<TRouter, TOptions, TFrom>): React.ReactNode\nexport function ListItems(options: ListItemsProps) {\n  return options.items.map((item) => <Link {...item} from={options.from} />)\n}\n"
  },
  {
    "path": "examples/react/start-large/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-large/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-material-ui/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-material-ui/README.md",
    "content": "# TanStack Start - Material UI Example\n\nA TanStack Start example demonstrating integration with Material UI (MUI).\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Material UI Documentation](https://mui.com/)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-material-ui start-material-ui\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## Material UI Integration\n\nThis example demonstrates how to integrate Material UI components with TanStack Start, including:\n\n- Theme configuration\n- Server-side rendering with MUI\n- Using MUI components in your routes\n"
  },
  {
    "path": "examples/react/start-material-ui/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-material-ui\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@emotion/cache\": \"11.14.0\",\n    \"@emotion/react\": \"11.14.0\",\n    \"@emotion/styled\": \"11.14.0\",\n    \"@fontsource-variable/roboto\": \"5.2.5\",\n    \"@mui/material\": \"6.4.7\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/components/Counter.tsx",
    "content": "import { Stack } from '@mui/material'\nimport { useSearch } from '@tanstack/react-router'\nimport { CustomButtonLink } from '~/components/CustomButtonLink'\n\nexport function Counter() {\n  const { count = 0 } = useSearch({ from: '/' })\n\n  return (\n    <Stack>\n      <CustomButtonLink\n        variant=\"contained\"\n        size=\"large\"\n        to={'/'}\n        search={{ count: count + 1 }}\n      >\n        Clicks: {count}\n      </CustomButtonLink>\n    </Stack>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/components/CustomButtonLink.tsx",
    "content": "import React from 'react'\nimport { createLink } from '@tanstack/react-router'\nimport { Button } from '@mui/material'\nimport type { ButtonProps } from '@mui/material'\nimport type { LinkComponent } from '@tanstack/react-router'\n\ninterface MUIButtonLinkProps extends ButtonProps<'a'> {\n  // Add any additional props you want to pass to the Button\n}\n\nconst MUIButtonLinkComponent = React.forwardRef<\n  HTMLAnchorElement,\n  MUIButtonLinkProps\n>((props, ref) => <Button ref={ref} component=\"a\" {...props} />)\n\nconst CreatedButtonLinkComponent = createLink(MUIButtonLinkComponent)\n\nexport const CustomButtonLink: LinkComponent<typeof MUIButtonLinkComponent> = (\n  props,\n) => {\n  return <CreatedButtonLinkComponent preload={'intent'} {...props} />\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/components/CustomLink.tsx",
    "content": "import React from 'react'\nimport { createLink } from '@tanstack/react-router'\nimport { Link } from '@mui/material'\nimport type { LinkProps } from '@mui/material'\nimport type { LinkComponent } from '@tanstack/react-router'\n\ninterface MUILinkProps extends LinkProps {\n  // Add any additional props you want to pass to the Link\n}\n\nconst MUILinkComponent = React.forwardRef<HTMLAnchorElement, MUILinkProps>(\n  (props, ref) => <Link ref={ref} {...props} />,\n)\n\nconst CreatedLinkComponent = createLink(MUILinkComponent)\n\nexport const CustomLink: LinkComponent<typeof MUILinkComponent> = (props) => {\n  return <CreatedLinkComponent preload={'intent'} {...props} />\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/components/Header.tsx",
    "content": "import { AppBar, Box, Toolbar, css, styled } from '@mui/material'\nimport { CustomLink } from './CustomLink'\n\nconst StyledCustomLink = styled(CustomLink)(\n  ({ theme }) => css`\n    color: ${theme.palette.common.white};\n  `,\n)\n\nexport function Header() {\n  return (\n    <Box sx={{ flexGrow: 1 }}>\n      <AppBar position=\"static\">\n        <Toolbar sx={{ gap: 2 }}>\n          <StyledCustomLink to=\"/\">Index</StyledCustomLink>\n          <StyledCustomLink to=\"/about\">About</StyledCustomLink>\n        </Toolbar>\n      </AppBar>\n    </Box>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: (err) => <p>{err.error.stack}</p>,\n    defaultNotFoundComponent: () => <p>not found</p>,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { CacheProvider } from '@emotion/react'\nimport { Container, CssBaseline, ThemeProvider } from '@mui/material'\nimport createCache from '@emotion/cache'\nimport fontsourceVariableRobotoCss from '@fontsource-variable/roboto?url'\nimport React from 'react'\nimport { theme } from '~/setup/theme'\nimport { Header } from '~/components/Header'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [{ rel: 'stylesheet', href: fontsourceVariableRobotoCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction Providers({ children }: { children: React.ReactNode }) {\n  const emotionCache = createCache({ key: 'css' })\n\n  return (\n    <CacheProvider value={emotionCache}>\n      <ThemeProvider theme={theme}>\n        <CssBaseline />\n        {children}\n      </ThemeProvider>\n    </CacheProvider>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Providers>\n          <Header />\n\n          <Container component=\"main\" sx={{ paddingBlock: 4 }}>\n            {children}\n          </Container>\n        </Providers>\n\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Typography } from '@mui/material'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <Typography variant=\"h2\">About</Typography>\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Stack, Typography } from '@mui/material'\nimport z from 'zod'\nimport { Counter } from '~/components/Counter'\n\nexport const Route = createFileRoute('/')({\n  validateSearch: z.object({\n    count: z.number().optional(),\n  }),\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <Stack alignItems=\"center\">\n      <Typography variant=\"h1\" marginBlockEnd={4}>\n        Hello world!\n      </Typography>\n      <Counter />\n    </Stack>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/src/setup/theme.ts",
    "content": "import { createTheme } from '@mui/material/styles'\n\nexport const theme = createTheme({\n  typography: {\n    fontFamily: \"'Roboto Variable', sans-serif\",\n  },\n})\n"
  },
  {
    "path": "examples/react/start-material-ui/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-material-ui/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  ssr: {\n    noExternal: ['@mui/*'],\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/README.md",
    "content": "# TanStack Start - Streaming Data Example\n\nA TanStack Start example demonstrating streaming data from server functions.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-streaming-data-from-server-functions start-streaming-data-from-server-functions\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## Streaming Data\n\nThis example demonstrates how to stream data from server functions to the client, enabling:\n\n- Progressive data loading\n- Real-time updates\n- Improved perceived performance\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/package.json",
    "content": "{\n  \"name\": \"tanstack-start-streaming-data-from-server-functions\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: (err) => <p>{err.error.stack}</p>,\n    defaultNotFoundComponent: () => <p>not found</p>,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport * as React from 'react'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { useCallback, useState } from 'react'\nimport { z } from 'zod'\n\n/**\n  This schema will be used to define the type\n  of each chunk in the `ReadableStream`.\n  (It mimics OpenAI's streaming response format.)\n*/\nconst textPartSchema = z.object({\n  choices: z.array(\n    z.object({\n      delta: z.object({\n        content: z.string().optional(),\n      }),\n      index: z.number(),\n      finish_reason: z.string().nullable(),\n    }),\n  ),\n})\n\nexport type TextPart = z.infer<typeof textPartSchema>\n\n/**\n  This helper function generates the array of messages\n  that we'll stream to the client.\n*/\nfunction generateMessages() {\n  const messages = Array.from({ length: 10 }, () =>\n    Math.floor(Math.random() * 100),\n  ).map((n, i) =>\n    textPartSchema.parse({\n      choices: [\n        {\n          delta: { content: `Number #${i + 1}: ${n}\\n` },\n          index: i,\n          finish_reason: null,\n        },\n      ],\n    }),\n  )\n  return messages\n}\n\n/**\n  This helper function is used to simulate the\n  delay between each message being sent.\n*/\nfunction sleep(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n  This server function returns a `ReadableStream`\n  that streams `TextPart` chunks to the client.\n*/\nconst streamingResponseFn = createServerFn().handler(async () => {\n  const messages = generateMessages()\n  // This `ReadableStream` is typed, so each\n  // will be of type `TextPart`.\n  const stream = new ReadableStream<TextPart>({\n    async start(controller) {\n      for (const message of messages) {\n        // simulate network latency\n        await sleep(500)\n        controller.enqueue(message)\n      }\n      controller.close()\n    },\n  })\n\n  return stream\n})\n\n/**\n  You can also use an async generator function to stream\n  typed chunks to the client.\n*/\nconst streamingWithAnAsyncGeneratorFn = createServerFn().handler(\n  async function* () {\n    const messages = generateMessages()\n    for (const msg of messages) {\n      await sleep(500)\n      // The streamed chunks are still typed as `TextPart`\n      yield msg\n    }\n  },\n)\n\nexport const Route = createFileRoute('/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [readableStreamMessages, setReadableStreamMessages] = useState('')\n\n  const [asyncGeneratorFuncMessages, setAsyncGeneratorFuncMessages] =\n    useState('')\n\n  const getTypedReadableStreamResponse = useCallback(async () => {\n    const response = await streamingResponseFn()\n\n    if (!response) {\n      return\n    }\n\n    const reader = response.getReader()\n    let done = false\n    setReadableStreamMessages('')\n    while (!done) {\n      const { value, done: doneReading } = await reader.read()\n      done = doneReading\n      if (value) {\n        // Notice how we know the value of `chunk` (`TextPart | undefined`)\n        // here, because it's coming from the typed `ReadableStream`\n        const chunk = value?.choices[0].delta.content\n        if (chunk) {\n          setReadableStreamMessages((prev) => prev + chunk)\n        }\n      }\n    }\n  }, [])\n\n  const getResponseFromTheAsyncGenerator = useCallback(async () => {\n    setAsyncGeneratorFuncMessages('')\n    for await (const msg of await streamingWithAnAsyncGeneratorFn()) {\n      const chunk = msg?.choices[0].delta.content\n      if (chunk) {\n        setAsyncGeneratorFuncMessages((prev) => prev + chunk)\n      }\n    }\n  }, [])\n\n  return (\n    <main>\n      <h1>Typed Readable Stream</h1>\n      <div id=\"streamed-results\">\n        <button onClick={() => getTypedReadableStreamResponse()}>\n          Get 10 random numbers (ReadableStream)\n        </button>\n        <button onClick={() => getResponseFromTheAsyncGenerator()}>\n          Get 10 random numbers (Async Generator Function)\n        </button>\n        <pre>{readableStreamMessages}</pre>\n        <pre>{asyncGeneratorFuncMessages}</pre>\n      </div>\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/src/styles/app.css",
    "content": "body {\n  font-family:\n    Gordita, Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',\n    sans-serif;\n}\n\na {\n  margin-right: 1rem;\n}\n\nmain {\n  text-align: center;\n  padding: 1em;\n  margin: 0 auto;\n}\n\n#streamed-results {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n}\n\n#streamed-results > button {\n  margin: auto;\n}\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-streaming-data-from-server-functions/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-supabase-basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/.gitignore",
    "content": "node_modules\n# Keep environment variables out of version control\n!.env\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/start-supabase-basic/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-supabase-basic/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/README.md",
    "content": "# TanStack Start - Supabase Example\n\nA TanStack Start example demonstrating integration with Supabase for authentication and database.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Supabase Documentation](https://supabase.com/docs)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-supabase-basic start-supabase-basic\n```\n\n## Setup\n\nThis example requires Supabase configuration. The `.env` file contains the necessary environment variables:\n\n```env\nSUPABASE_URL=your-project-url\nSUPABASE_ANON_KEY=your-anon-key\n```\n\nYou'll need to:\n\n1. Create a Supabase project at [supabase.com](https://supabase.com)\n2. Get your project URL and anon key from the project settings\n3. Update the `.env` file with your credentials\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## Supabase Integration\n\nThis example demonstrates:\n\n- Authentication with Supabase Auth\n- Database queries with Supabase client\n- Real-time subscriptions\n- Server-side data fetching\n"
  },
  {
    "path": "examples/react/start-supabase-basic/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-supabase-basic\",\n  \"private\": true,\n  \"main\": \"index.js\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"@supabase/ssr\": \"^0.5.2\",\n    \"@supabase/supabase-js\": \"^2.48.1\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/components/Auth.tsx",
    "content": "export function Auth({\n  actionText,\n  onSubmit,\n  status,\n  afterSubmit,\n}: {\n  actionText: string\n  onSubmit: (e: React.FormEvent<HTMLFormElement>) => void\n  status: 'pending' | 'idle' | 'success' | 'error'\n  afterSubmit?: React.ReactNode\n}) {\n  return (\n    <div className=\"fixed inset-0 bg-white dark:bg-black flex items-start justify-center p-8\">\n      <div className=\"bg-white dark:bg-gray-900 p-8 rounded-lg shadow-lg\">\n        <h1 className=\"text-2xl font-bold mb-4\">{actionText}</h1>\n        <form\n          onSubmit={(e) => {\n            e.preventDefault()\n            onSubmit(e)\n          }}\n          className=\"space-y-4\"\n        >\n          <div>\n            <label htmlFor=\"email\" className=\"block text-xs\">\n              Username\n            </label>\n            <input\n              type=\"email\"\n              name=\"email\"\n              id=\"email\"\n              className=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <div>\n            <label htmlFor=\"password\" className=\"block text-xs\">\n              Password\n            </label>\n            <input\n              type=\"password\"\n              name=\"password\"\n              id=\"password\"\n              className=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <button\n            type=\"submit\"\n            className=\"w-full bg-cyan-600 text-white rounded-sm py-2 font-black uppercase\"\n            disabled={status === 'pending'}\n          >\n            {status === 'pending' ? '...' : actionText}\n          </button>\n          {afterSubmit ? afterSubmit : null}\n        </form>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import * as React from 'react'\nimport {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/components/Login.tsx",
    "content": "import { useRouter } from '@tanstack/react-router'\nimport { useServerFn } from '@tanstack/react-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { loginFn } from '../routes/_authed'\nimport { signupFn } from '../routes/signup'\nimport { Auth } from './Auth'\n\nexport function Login() {\n  const router = useRouter()\n\n  const loginMutation = useMutation({\n    fn: loginFn,\n    onSuccess: async (ctx) => {\n      if (!ctx.data?.error) {\n        await router.invalidate()\n        router.navigate({ to: '/' })\n        return\n      }\n    },\n  })\n\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Login\"\n      status={loginMutation.status}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as HTMLFormElement)\n\n        loginMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        loginMutation.data ? (\n          <>\n            <div className=\"text-red-400\">{loginMutation.data.message}</div>\n            {loginMutation.data.error &&\n            loginMutation.data.message === 'Invalid login credentials' ? (\n              <div>\n                <button\n                  className=\"text-blue-500\"\n                  onClick={(e) => {\n                    const formData = new FormData(\n                      (e.target as HTMLButtonElement).form!,\n                    )\n\n                    signupMutation.mutate({\n                      data: {\n                        email: formData.get('email') as string,\n                        password: formData.get('password') as string,\n                      },\n                    })\n                  }}\n                  type=\"button\"\n                >\n                  Sign up instead?\n                </button>\n              </div>\n            ) : null}\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: React.ReactNode }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/hooks/useMutation.ts",
    "content": "import * as React from 'react'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = React.useState<number | undefined>()\n  const [variables, setVariables] = React.useState<TVariables | undefined>()\n  const [error, setError] = React.useState<TError | undefined>()\n  const [data, setData] = React.useState<TData | undefined>()\n  const [status, setStatus] = React.useState<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = React.useCallback(\n    async (variables: TVariables): Promise<TData | undefined> => {\n      setStatus('pending')\n      setSubmittedAt(Date.now())\n      setVariables(variables)\n      //\n      try {\n        const data = await opts.fn(variables)\n        await opts.onSuccess?.({ data })\n        setStatus('success')\n        setError(undefined)\n        setData(data)\n        return data\n      } catch (err) {\n        setStatus('error')\n        setError(err as TError)\n      }\n    },\n    [opts.fn],\n  )\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SignupRouteImport } from './routes/signup'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteImport } from './routes/_authed/posts'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst SignupRoute = SignupRouteImport.update({\n  id: '/signup',\n  path: '/signup',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRoute = AuthedPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts': typeof AuthedPostsRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/_authed/posts': typeof AuthedPostsRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  LogoutRoute: typeof LogoutRoute\n  SignupRoute: typeof SignupRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/signup': {\n      id: '/signup'\n      path: '/signup'\n      fullPath: '/signup'\n      preLoaderRoute: typeof SignupRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteChildren: AuthedPostsRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(\n  AuthedPostsRouteChildren,\n)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRoute: typeof AuthedPostsRouteWithChildren\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRoute: AuthedPostsRouteWithChildren,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n  LoginRoute: LoginRoute,\n  LogoutRoute: LogoutRoute,\n  SignupRoute: SignupRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { createServerFn } from '@tanstack/react-start'\nimport * as React from 'react'\nimport { DefaultCatchBoundary } from '../components/DefaultCatchBoundary'\nimport { NotFound } from '../components/NotFound'\nimport appCss from '../styles/app.css?url'\nimport { seo } from '../utils/seo'\nimport { getSupabaseServerClient } from '../utils/supabase'\n\nconst fetchUser = createServerFn({ method: 'GET' }).handler(async () => {\n  const supabase = getSupabaseServerClient()\n  const { data, error: _error } = await supabase.auth.getUser()\n\n  if (!data.user?.email) {\n    return null\n  }\n\n  return {\n    email: data.user.email,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const user = await fetchUser()\n\n    return {\n      user,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  const { user } = Route.useRouteContext()\n\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div className=\"ml-auto\">\n            {user ? (\n              <>\n                <span className=\"mr-2\">{user.email}</span>\n                <Link to=\"/logout\">Logout</Link>\n              </>\n            ) : (\n              <Link to=\"/login\">Login</Link>\n            )}\n          </div>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\nimport { NotFound } from '~/components/NotFound'\nimport { fetchPost } from '~/utils/posts'\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/_authed/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../../utils/posts'\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/_authed.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { Login } from '../components/Login'\nimport { getSupabaseServerClient } from '../utils/supabase'\n\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator((d: { email: string; password: string }) => d)\n  .handler(async ({ data }) => {\n    const supabase = getSupabaseServerClient()\n    const { error } = await supabase.auth.signInWithPassword({\n      email: data.email,\n      password: data.password,\n    })\n\n    if (error) {\n      return {\n        error: true,\n        message: error.message,\n      }\n    }\n  })\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return <Login />\n    }\n\n    throw error\n  },\n})\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Login } from '../components/Login'\n\nexport const Route = createFileRoute('/login')({\n  component: LoginComp,\n})\n\nfunction LoginComp() {\n  return <Login />\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/logout.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport { getSupabaseServerClient } from '../utils/supabase'\n\nconst logoutFn = createServerFn().handler(async () => {\n  const supabase = getSupabaseServerClient()\n  const { error } = await supabase.auth.signOut()\n\n  if (error) {\n    return {\n      error: true,\n      message: error.message,\n    }\n  }\n\n  throw redirect({\n    href: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  preload: false,\n  loader: () => logoutFn(),\n})\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/routes/signup.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/react-router'\nimport { createServerFn, useServerFn } from '@tanstack/react-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { Auth } from '../components/Auth'\nimport { getSupabaseServerClient } from '../utils/supabase'\n\nexport const signupFn = createServerFn({ method: 'POST' })\n  .inputValidator(\n    (d: { email: string; password: string; redirectUrl?: string }) => d,\n  )\n  .handler(async ({ data }) => {\n    const supabase = getSupabaseServerClient()\n    const { error } = await supabase.auth.signUp({\n      email: data.email,\n      password: data.password,\n    })\n    if (error) {\n      return {\n        error: true,\n        message: error.message,\n      }\n    }\n\n    // Redirect to the prev page stored in the \"redirect\" search param\n    throw redirect({\n      href: data.redirectUrl || '/',\n    })\n  })\n\nexport const Route = createFileRoute('/signup')({\n  component: SignupComp,\n})\n\nfunction SignupComp() {\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Sign Up\"\n      status={signupMutation.status}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as HTMLFormElement)\n\n        signupMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        signupMutation.data?.error ? (\n          <>\n            <div className=\"text-red-400\">{signupMutation.data.message}</div>\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/src/utils/supabase.ts",
    "content": "import { getCookies, setCookie } from '@tanstack/react-start/server'\nimport { createServerClient } from '@supabase/ssr'\n\nexport function getSupabaseServerClient() {\n  return createServerClient(\n    process.env.SUPABASE_URL!,\n    process.env.SUPABASE_ANON_KEY!,\n    {\n      cookies: {\n        getAll() {\n          return Object.entries(getCookies()).map(([name, value]) => ({\n            name,\n            value,\n          }))\n        },\n        setAll(cookies) {\n          cookies.forEach((cookie) => {\n            setCookie(cookie.name, cookie.value)\n          })\n        },\n      },\n    },\n  )\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-supabase-basic/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n.nitro\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n.tanstack"
  },
  {
    "path": "examples/react/start-tailwind-v4/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-tailwind-v4/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/README.md",
    "content": "# TanStack Start - Tailwind CSS v4 Example\n\nThis site is built with TanStack Router and Tailwind CSS v4!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Tailwind CSS Docs](https://tailwindcss.com/docs)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-tailwind-v4 start-tailwind-v4\n```\n\n## Deployment\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Tailwind CSS v4 integration\n- Styling with TanStack Start\n- CSS configuration\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/package.json",
    "content": "{\n  \"name\": \"tanstack-start-tailwind-v4\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node .output/server/index.mjs\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-tailwind-v4/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport tailwindcss from '@tailwindcss/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tanstackStart(), viteReact(), tailwindcss()],\n})\n"
  },
  {
    "path": "examples/react/start-trellaux/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n"
  },
  {
    "path": "examples/react/start-trellaux/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/react/start-trellaux/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/README.md",
    "content": "# TanStack Start - Trellaux Example\n\nA TanStack Start example demonstrating a Trello-like kanban board application.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-trellaux start-trellaux\n```\n\n## Getting Started\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Build\n\nTo build the app for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nA full-featured Trello-like application demonstrating:\n\n- Drag-and-drop functionality\n- Complex state management\n- Real-time updates\n- Board, list, and card management\n"
  },
  {
    "path": "examples/react/start-trellaux/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-trellaux\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-router-ssr-query\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"ky\": \"^1.7.4\",\n    \"msw\": \"^2.7.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"react-hot-toast\": \"^2.5.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"tiny-invariant\": \"^1.3.3\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"22.10.2\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.6.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/Board.tsx",
    "content": "import { useCallback, useMemo, useRef } from 'react'\nimport invariant from 'tiny-invariant'\nimport { useSuspenseQuery } from '@tanstack/react-query'\nimport { boardQueries, useUpdateBoardMutation } from '../queries.js'\nimport { NewColumn } from './NewColumn.js'\nimport { Column as ColumnComponent } from './Column.js'\nimport type { Column } from '../db/schema.js'\nimport { EditableText } from '~/components/EditableText.js'\n\nexport function Board({ boardId }: { boardId: string }) {\n  const newColumnAddedRef = useRef(false)\n  const updateBoardMutation = useUpdateBoardMutation()\n  const { data: board } = useSuspenseQuery(boardQueries.detail(boardId))\n\n  // scroll right when new columns are added\n  const scrollContainerRef = useRef<HTMLDivElement>(null)\n  const columnRef = useCallback((_node: HTMLElement | null) => {\n    if (scrollContainerRef.current && newColumnAddedRef.current) {\n      newColumnAddedRef.current = false\n      scrollContainerRef.current.scrollLeft =\n        scrollContainerRef.current.scrollWidth\n    }\n  }, [])\n\n  const itemsById = useMemo(\n    () => new Map(board.items.map((item) => [item.id, item])),\n    [board.items],\n  )\n\n  type ColumnWithItems = Column & { items: typeof board.items }\n\n  const columns = useMemo(() => {\n    const columnsMap = new Map<string, ColumnWithItems>()\n\n    for (const column of [...board.columns]) {\n      columnsMap.set(column.id, { ...column, items: [] })\n    }\n\n    // add items to their columns\n    for (const item of itemsById.values()) {\n      const columnId = item.columnId\n      const column = columnsMap.get(columnId)\n      invariant(column, 'missing column')\n      column.items.push(item)\n    }\n\n    return [...columnsMap.values()].sort((a, b) => a.order - b.order)\n  }, [board.columns, itemsById])\n\n  return (\n    <div\n      className=\"grow min-h-0 flex flex-col overflow-x-scroll\"\n      ref={scrollContainerRef}\n      style={{ backgroundColor: board.color }}\n    >\n      <h1>\n        <EditableText\n          value={\n            // optimistic update\n            updateBoardMutation.isPending &&\n            updateBoardMutation.variables.data.name\n              ? updateBoardMutation.variables.data.name\n              : board.name\n          }\n          fieldName=\"name\"\n          inputClassName=\"mx-8 my-4 text-2xl font-medium border border-slate-400 rounded-lg py-1 px-2 text-black\"\n          buttonClassName=\"mx-8 my-4 text-2xl font-medium block rounded-lg text-left border border-transparent py-1 px-2 text-slate-800\"\n          buttonLabel={`Edit board \"${board.name}\" name`}\n          inputLabel=\"Edit board name\"\n          onChange={(value) => {\n            updateBoardMutation.mutate({\n              data: {\n                id: board.id,\n                name: value,\n              },\n            })\n          }}\n        />\n      </h1>\n\n      <div className=\"flex grow min-h-0 h-full items-start px-8 pb-4 w-fit\">\n        {columns.map((col, index) => {\n          return (\n            <ColumnComponent\n              ref={columnRef}\n              key={col.id}\n              name={col.name}\n              columnId={col.id}\n              boardId={board.id}\n              items={col.items}\n              order={col.order}\n              previousOrder={columns[index - 1] ? columns[index - 1].order : 0}\n              nextOrder={\n                columns[index + 1] ? columns[index + 1].order : col.order + 1\n              }\n            />\n          )\n        })}\n        <NewColumn\n          boardId={board.id}\n          editInitially={board.columns.length === 0}\n          onNewColumnAdded={() => {\n            newColumnAddedRef.current = true\n          }}\n        />\n      </div>\n\n      {/* trolling you to add some extra margin to the right of the container with a whole dang div */}\n      <div data-lol className=\"w-8 h-1 shrink-0\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/CancelButton.tsx",
    "content": "import { forwardRef } from 'react'\n\nexport const CancelButton = forwardRef<\n  HTMLButtonElement,\n  React.ButtonHTMLAttributes<HTMLButtonElement>\n>((props, ref) => {\n  return (\n    <button\n      ref={ref}\n      type=\"button\"\n      tabIndex={0}\n      {...props}\n      className=\"text-sm rounded-lg text-left p-2 font-medium hover:bg-slate-200 focus:bg-slate-200\"\n    />\n  )\n})\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/Card.tsx",
    "content": "import invariant from 'tiny-invariant'\nimport { forwardRef, useState } from 'react'\n\nimport { CONTENT_TYPES } from '../types'\nimport { Icon } from '../icons/icons'\nimport { useDeleteCardMutation, useUpdateCardMutation } from '../queries'\nimport { deleteItemSchema } from '../db/schema'\n\ninterface CardProps {\n  title: string\n  content: string | null\n  id: string\n  columnId: string\n  boardId: string\n  order: number\n  nextOrder: number\n  previousOrder: number\n}\n\nexport const Card = forwardRef<HTMLLIElement, CardProps>(\n  (\n    { title, content, id, columnId, boardId, order, nextOrder, previousOrder },\n    ref,\n  ) => {\n    const [acceptDrop, setAcceptDrop] = useState<'none' | 'top' | 'bottom'>(\n      'none',\n    )\n\n    const deleteCard = useDeleteCardMutation()\n    const moveCard = useUpdateCardMutation()\n\n    return (\n      <li\n        ref={ref}\n        onDragOver={(event) => {\n          if (event.dataTransfer.types.includes(CONTENT_TYPES.card)) {\n            event.preventDefault()\n            event.stopPropagation()\n            const rect = event.currentTarget.getBoundingClientRect()\n            const midpoint = (rect.top + rect.bottom) / 2\n            setAcceptDrop(event.clientY <= midpoint ? 'top' : 'bottom')\n          }\n        }}\n        onDragLeave={() => {\n          setAcceptDrop('none')\n        }}\n        onDrop={(event) => {\n          event.stopPropagation()\n\n          const transfer = JSON.parse(\n            event.dataTransfer.getData(CONTENT_TYPES.card) || 'null',\n          )\n\n          if (!transfer) {\n            return\n          }\n\n          invariant(transfer.id, 'missing cardId')\n          invariant(transfer.title, 'missing title')\n\n          const droppedOrder = acceptDrop === 'top' ? previousOrder : nextOrder\n          const moveOrder = (droppedOrder + order) / 2\n\n          moveCard.mutate({\n            data: {\n              order: moveOrder,\n              columnId,\n              boardId,\n              id: transfer.id,\n              title: transfer.title,\n            },\n          })\n\n          setAcceptDrop('none')\n        }}\n        className={\n          'border-t-2 border-b-2 -mb-[2px] last:mb-0 cursor-grab active:cursor-grabbing px-2 py-1 ' +\n          (acceptDrop === 'top'\n            ? 'border-t-red-500 border-b-transparent'\n            : acceptDrop === 'bottom'\n              ? 'border-b-red-500 border-t-transparent'\n              : 'border-t-transparent border-b-transparent')\n        }\n      >\n        <div\n          draggable\n          className=\"bg-white shadow-sm shadow-slate-300 border-slate-300 text-sm rounded-lg w-full py-1 px-2 relative\"\n          onDragStart={(event) => {\n            event.dataTransfer.effectAllowed = 'move'\n            event.dataTransfer.setData(\n              CONTENT_TYPES.card,\n              JSON.stringify({ id, title }),\n            )\n            event.stopPropagation()\n          }}\n        >\n          <h3>{title}</h3>\n          <div className=\"mt-2\">{content || <>&nbsp;</>}</div>\n          <form\n            onSubmit={(event) => {\n              event.preventDefault()\n\n              deleteCard.mutate({\n                data: deleteItemSchema.parse({\n                  id,\n                  boardId,\n                }),\n              })\n            }}\n          >\n            <button\n              aria-label=\"Delete card\"\n              className=\"absolute top-4 right-4 hover:text-red-500 flex gap-2 items-center\"\n              type=\"submit\"\n            >\n              <div className=\"opacity-50 text-xs\">{order}</div>\n              <Icon name=\"trash\" />\n            </button>\n          </form>\n        </div>\n      </li>\n    )\n  },\n)\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/Column.tsx",
    "content": "import { forwardRef, useCallback, useMemo, useRef, useState } from 'react'\nimport invariant from 'tiny-invariant'\nimport { twMerge } from 'tailwind-merge'\n\nimport { flushSync } from 'react-dom'\nimport { CONTENT_TYPES } from '../types'\nimport { Icon } from '../icons/icons'\nimport {\n  useDeleteColumnMutation,\n  useUpdateCardMutation,\n  useUpdateColumnMutation,\n} from '../queries'\nimport { EditableText } from './EditableText'\nimport { NewCard } from './NewCard'\nimport { Card } from './Card'\nimport type { RenderedItem } from '../types'\n\ninterface ColumnProps {\n  name: string\n  boardId: string\n  columnId: string\n  items: Array<RenderedItem>\n  nextOrder: number\n  previousOrder: number\n  order: number\n}\n\nexport const Column = forwardRef<HTMLDivElement, ColumnProps>(\n  (\n    { name, columnId, boardId, items, nextOrder, previousOrder, order },\n    ref,\n  ) => {\n    const [acceptCardDrop, setAcceptCardDrop] = useState(false)\n    const editState = useState(false)\n\n    const [acceptColumnDrop, setAcceptColumnDrop] = useState<\n      'none' | 'left' | 'right'\n    >('none')\n\n    const [edit, setEdit] = useState(false)\n\n    const itemRef = useCallback((node: HTMLElement | null) => {\n      node?.scrollIntoView({\n        block: 'nearest',\n      })\n    }, [])\n\n    const listRef = useRef<HTMLUListElement>(null!)\n\n    function scrollList() {\n      invariant(listRef.current)\n      listRef.current.scrollTop = listRef.current.scrollHeight\n    }\n\n    const updateColumnMutation = useUpdateColumnMutation()\n    const deleteColumnMutation = useDeleteColumnMutation()\n    const updateCardMutation = useUpdateCardMutation()\n\n    const sortedItems = useMemo(\n      () => [...items].sort((a, b) => a.order - b.order),\n      [items],\n    )\n\n    const cardDndProps = {\n      onDragOver: (event: React.DragEvent) => {\n        if (event.dataTransfer.types.includes(CONTENT_TYPES.card)) {\n          event.preventDefault()\n          setAcceptCardDrop(true)\n        }\n      },\n      onDragLeave: () => {\n        setAcceptCardDrop(false)\n      },\n      onDrop: (event: React.DragEvent) => {\n        const transfer = JSON.parse(\n          event.dataTransfer.getData(CONTENT_TYPES.card) || 'null',\n        )\n\n        if (!transfer) {\n          return\n        }\n\n        invariant(transfer.id, 'missing transfer.id')\n        invariant(transfer.title, 'missing transfer.title')\n\n        updateCardMutation.mutate({\n          data: {\n            order: (sortedItems[sortedItems.length - 1]?.order ?? 0) + 1,\n            columnId: columnId,\n            boardId,\n            id: transfer.id,\n            title: transfer.title,\n          },\n        })\n\n        setAcceptCardDrop(false)\n      },\n    }\n\n    return (\n      <div\n        ref={ref}\n        onDragOver={(event: React.DragEvent) => {\n          if (event.dataTransfer.types.includes(CONTENT_TYPES.column)) {\n            event.preventDefault()\n            event.stopPropagation()\n            const rect = event.currentTarget.getBoundingClientRect()\n            const midpoint = (rect.left + rect.right) / 2\n            setAcceptColumnDrop(event.clientX <= midpoint ? 'left' : 'right')\n          }\n        }}\n        onDragLeave={() => {\n          setAcceptColumnDrop('none')\n        }}\n        onDrop={(event: React.DragEvent) => {\n          const transfer = JSON.parse(\n            event.dataTransfer.getData(CONTENT_TYPES.column) || 'null',\n          )\n\n          if (!transfer) {\n            return\n          }\n\n          invariant(transfer.id, 'missing transfer.id')\n\n          const droppedOrder =\n            acceptColumnDrop === 'left' ? previousOrder : nextOrder\n          const moveOrder = (droppedOrder + order) / 2\n\n          updateColumnMutation.mutate({\n            data: {\n              boardId,\n              id: transfer.id,\n              order: moveOrder,\n            },\n          })\n\n          setAcceptColumnDrop('none')\n        }}\n        className={twMerge(\n          'border-l-transparent border-r-transparent border-l-2 border-r-2 -mr-[2px] last:mr-0 cursor-grab active:cursor-grabbing px-2 shrink-0 flex flex-col  max-h-full',\n          acceptColumnDrop === 'left'\n            ? 'border-l-red-500 border-r-transparent'\n            : acceptColumnDrop === 'right'\n              ? 'border-r-red-500 border-l-transparent'\n              : '',\n        )}\n      >\n        <div\n          draggable={!editState[0]}\n          onDragStart={(event: React.DragEvent) => {\n            event.dataTransfer.effectAllowed = 'move'\n            event.dataTransfer.setData(\n              CONTENT_TYPES.column,\n              JSON.stringify({ id: columnId, name }),\n            )\n          }}\n          {...(!items.length ? cardDndProps : {})}\n          className={twMerge(\n            'shrink-0 flex flex-col max-h-full w-80 border-slate-400 rounded-xl shadow-xs shadow-slate-400 bg-slate-100 relative',\n            acceptCardDrop && `outline-solid outline-2 outline-red-500`,\n          )}\n        >\n          <div className=\"p-2\" {...(items.length ? cardDndProps : {})}>\n            <EditableText\n              fieldName=\"name\"\n              editState={editState}\n              value={\n                // optimistic update\n                updateColumnMutation.isPending &&\n                updateColumnMutation.variables.data.name\n                  ? updateColumnMutation.variables.data.name\n                  : name\n              }\n              inputLabel=\"Edit column name\"\n              buttonLabel={`Edit column \"${name}\" name`}\n              inputClassName=\"border border-slate-400 w-full rounded-lg py-1 px-2 font-medium text-black\"\n              buttonClassName=\"block rounded-lg text-left w-full border border-transparent py-1 px-2 font-medium text-slate-600\"\n              onChange={(value) => {\n                updateColumnMutation.mutate({\n                  data: {\n                    boardId,\n                    id: columnId,\n                    name: value,\n                  },\n                })\n              }}\n            />\n          </div>\n\n          <ul ref={listRef} className=\"grow overflow-auto\">\n            {sortedItems.map((item, index, items) => (\n              <Card\n                ref={itemRef}\n                key={item.id}\n                title={item.title}\n                content={item.content ?? ''}\n                id={item.id}\n                boardId={boardId}\n                order={item.order}\n                columnId={columnId}\n                previousOrder={items[index - 1] ? items[index - 1].order : 0}\n                nextOrder={\n                  items[index + 1] ? items[index + 1].order : item.order + 1\n                }\n              />\n            ))}\n          </ul>\n          {edit ? (\n            <NewCard\n              columnId={columnId}\n              boardId={boardId}\n              nextOrder={\n                items.length === 0 ? 1 : items[items.length - 1].order + 1\n              }\n              onComplete={() => setEdit(false)}\n            />\n          ) : (\n            <div className=\"p-2\" {...(items.length ? cardDndProps : {})}>\n              <button\n                type=\"button\"\n                onClick={() => {\n                  flushSync(() => {\n                    setEdit(true)\n                  })\n                  scrollList()\n                }}\n                className=\"flex items-center gap-2 rounded-lg text-left w-full p-2 font-medium text-slate-500 hover:bg-slate-200 focus:bg-slate-200\"\n              >\n                <Icon name=\"plus\" /> Add a card\n              </button>\n            </div>\n          )}\n          <form\n            onSubmit={(event) => {\n              event.preventDefault()\n\n              deleteColumnMutation.mutate({\n                data: {\n                  id: columnId,\n                  boardId,\n                },\n              })\n            }}\n          >\n            <button\n              aria-label=\"Delete column\"\n              className=\"absolute top-4 right-4 hover:text-red-500 flex gap-2 items-center\"\n              type=\"submit\"\n            >\n              <Icon name=\"trash\" />\n            </button>\n          </form>\n        </div>\n      </div>\n    )\n  },\n)\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/react-router'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div className=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div className=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot ? (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/EditableText.tsx",
    "content": "import { useRef, useState } from 'react'\nimport { flushSync } from 'react-dom'\n\nexport function EditableText({\n  fieldName,\n  value,\n  inputClassName,\n  inputLabel,\n  buttonClassName,\n  buttonLabel,\n  onChange,\n  editState,\n}: {\n  fieldName: string\n  value: string\n  inputClassName: string\n  inputLabel: string\n  buttonClassName: string\n  buttonLabel: string\n  onChange: (value: string) => void\n  editState?: [boolean, (value: boolean) => void]\n}) {\n  const localEditState = useState(false)\n  const [edit, setEdit] = editState || localEditState\n  const inputRef = useRef<HTMLInputElement>(null)\n  const buttonRef = useRef<HTMLButtonElement>(null)\n\n  return edit ? (\n    <form\n      onSubmit={(event) => {\n        event.preventDefault()\n\n        onChange(inputRef.current!.value)\n\n        flushSync(() => {\n          setEdit(false)\n        })\n\n        buttonRef.current?.focus()\n      }}\n    >\n      <input\n        required\n        ref={inputRef}\n        type=\"text\"\n        aria-label={inputLabel}\n        name={fieldName}\n        defaultValue={value}\n        className={inputClassName}\n        onKeyDown={(event) => {\n          if (event.key === 'Escape') {\n            flushSync(() => {\n              setEdit(false)\n            })\n            buttonRef.current?.focus()\n          }\n        }}\n        onBlur={(event) => {\n          if (\n            inputRef.current?.value !== value &&\n            inputRef.current?.value.trim() !== ''\n          ) {\n            onChange(inputRef.current!.value)\n          }\n          setEdit(false)\n        }}\n      />\n    </form>\n  ) : (\n    <button\n      aria-label={buttonLabel}\n      type=\"button\"\n      ref={buttonRef}\n      onClick={() => {\n        flushSync(() => {\n          setEdit(true)\n        })\n        inputRef.current?.select()\n      }}\n      className={buttonClassName}\n    >\n      {value || <span className=\"text-slate-400 italic\">Edit</span>}\n    </button>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/IconLink.tsx",
    "content": "export function IconLink({\n  icon,\n  href,\n  label,\n}: {\n  icon: string\n  href: string\n  label: string\n}) {\n  return (\n    <a\n      href={href}\n      className=\"text-slate-500 text-xs uppercase font-bold text-center\"\n    >\n      <img src={icon} aria-hidden className=\"inline-block h-8 rounded-full\" />\n      <span className=\"block mt-2\">{label}</span>\n    </a>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/Loader.tsx",
    "content": "export function Loader() {\n  return (\n    <div className=\"flex h-full\">\n      <div className=\"m-auto border-gray-300 h-20 max-h-full aspect-square animate-spin rounded-full border-8 border-t-slate-900\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/NewCard.tsx",
    "content": "import { useRef } from 'react'\nimport invariant from 'tiny-invariant'\n\nimport { ItemMutationFields } from '../types'\nimport { useCreateItemMutation } from '../queries'\nimport { itemSchema } from '../db/schema'\nimport { SaveButton } from '~/components/SaveButton'\nimport { CancelButton } from '~/components/CancelButton'\n\nexport function NewCard({\n  columnId,\n  boardId,\n  nextOrder,\n  onComplete,\n}: {\n  columnId: string\n  boardId: string\n  nextOrder: number\n  onComplete: () => void\n}) {\n  const textAreaRef = useRef<HTMLTextAreaElement>(null)\n  const buttonRef = useRef<HTMLButtonElement>(null)\n  const { mutate } = useCreateItemMutation()\n\n  return (\n    <form\n      method=\"post\"\n      className=\"px-2 py-1 border-t-2 border-b-2 border-transparent\"\n      onSubmit={(event) => {\n        event.preventDefault()\n\n        const formData = new FormData(event.currentTarget)\n        const id = crypto.randomUUID()\n        formData.set(ItemMutationFields.id.name, id)\n\n        invariant(textAreaRef.current)\n        textAreaRef.current.value = ''\n\n        mutate({\n          data: itemSchema.parse(Object.fromEntries(formData.entries())),\n        })\n      }}\n      onBlur={(event) => {\n        if (!event.currentTarget.contains(event.relatedTarget)) {\n          onComplete()\n        }\n      }}\n    >\n      <input type=\"hidden\" name=\"boardId\" value={boardId} />\n      <input\n        type=\"hidden\"\n        name={ItemMutationFields.columnId.name}\n        value={columnId}\n      />\n      <input\n        type=\"hidden\"\n        name={ItemMutationFields.order.name}\n        value={nextOrder}\n      />\n\n      <textarea\n        autoFocus\n        required\n        ref={textAreaRef}\n        name={ItemMutationFields.title.name}\n        placeholder=\"Enter a title for this card\"\n        className=\"outline-hidden shadow-sm text-sm rounded-lg w-full py-1 px-2 resize-none placeholder:text-sm placeholder:text-slate-500 h-14\"\n        onKeyDown={(event) => {\n          if (event.key === 'Enter') {\n            event.preventDefault()\n            invariant(buttonRef.current, 'expected button ref')\n            buttonRef.current.click()\n          }\n          if (event.key === 'Escape') {\n            onComplete()\n          }\n        }}\n        onChange={(event) => {\n          const el = event.currentTarget\n          el.style.height = el.scrollHeight + 'px'\n        }}\n      />\n      <div className=\"flex justify-between\">\n        <SaveButton ref={buttonRef}>Save Card</SaveButton>\n        <CancelButton onClick={onComplete}>Cancel</CancelButton>\n      </div>\n    </form>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/NewColumn.tsx",
    "content": "import { useRef, useState } from 'react'\nimport invariant from 'tiny-invariant'\n\nimport { Icon } from '../icons/icons'\nimport { useCreateColumnMutation } from '../queries'\nimport { CancelButton } from '~/components/CancelButton'\nimport { SaveButton } from '~/components/SaveButton'\n\nexport function NewColumn({\n  boardId,\n  editInitially,\n  onNewColumnAdded,\n}: {\n  boardId: string\n  editInitially: boolean\n  onNewColumnAdded: () => void\n}) {\n  const [editing, setEditing] = useState(editInitially)\n  const inputRef = useRef<HTMLInputElement>(null)\n\n  const newColumnMutation = useCreateColumnMutation()\n\n  return editing ? (\n    <form\n      className=\"ml-2 p-2 shrink-0 flex flex-col gap-5 overflow-hidden max-h-full w-80 border rounded-xl shadow-sm bg-slate-100\"\n      onSubmit={(event) => {\n        event.preventDefault()\n        invariant(inputRef.current, 'missing input ref')\n\n        newColumnMutation.mutate({\n          data: {\n            boardId,\n            name: inputRef.current.value,\n          },\n        })\n\n        inputRef.current.value = ''\n\n        onNewColumnAdded()\n      }}\n      onBlur={(event) => {\n        if (!event.currentTarget.contains(event.relatedTarget)) {\n          setEditing(false)\n        }\n      }}\n    >\n      <input\n        autoFocus\n        required\n        ref={inputRef}\n        type=\"text\"\n        name=\"columnName\"\n        autoComplete=\"off\"\n        className=\"border border-slate-400 w-full rounded-lg py-1 px-2 font-medium text-black\"\n      />\n      <div className=\"flex justify-between\">\n        <SaveButton>Save Column</SaveButton>\n        <CancelButton onClick={() => setEditing(false)}>Cancel</CancelButton>\n      </div>\n    </form>\n  ) : (\n    <button\n      onClick={() => {\n        setEditing(true)\n      }}\n      aria-label=\"Add new column\"\n      className=\"ml-2 shrink-0 flex justify-center h-16 w-16 bg-black hover:bg-white bg-opacity-10 hover:bg-opacity-5 rounded-xl\"\n    >\n      <Icon name=\"plus\" size=\"xl\" />\n    </button>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/react-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div className=\"space-y-2 p-2\">\n      <div className=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p className=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          className=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          className=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/components/SaveButton.tsx",
    "content": "import { forwardRef } from 'react'\n\nexport const SaveButton = forwardRef<\n  HTMLButtonElement,\n  React.ButtonHTMLAttributes<HTMLButtonElement>\n>((props, ref) => {\n  return (\n    <button\n      ref={ref}\n      // this makes it so the button takes focus on clicks in safari I can't\n      // remember if this is the proper workaround or not, it's been a while!\n      // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus\n      // https://bugs.webkit.org/show_bug.cgi?id=22261\n      tabIndex={0}\n      {...props}\n      className=\"text-sm rounded-lg text-left p-2 font-medium text-white bg-blue-500\"\n    />\n  )\n})\n"
  },
  {
    "path": "examples/react/start-trellaux/src/db/board.ts",
    "content": "import crypto from 'node:crypto'\nimport { createServerFn } from '@tanstack/react-start'\nimport invariant from 'tiny-invariant'\nimport * as z from 'zod'\nimport {\n  deleteColumnSchema,\n  deleteItemSchema,\n  itemSchema,\n  newColumnSchema,\n  updateBoardSchema,\n  updateColumnSchema,\n} from './schema'\nimport type { Board } from './schema'\n\nconst DELAY = 1000\n\nconst boards: Array<Board> = [\n  {\n    id: '1',\n    name: 'First board',\n    color: '#e0e0e0',\n    columns: [],\n    items: [],\n  },\n]\n\nconst delay = (ms: number = 1000) =>\n  new Promise((resolve) => setTimeout(resolve, ms))\n\nexport const getBoards = createServerFn({ method: 'GET' }).handler(async () => {\n  await delay(DELAY)\n  return boards\n})\n\nexport const getBoard = createServerFn({ method: 'GET' })\n  .inputValidator(z.string())\n  .handler(async ({ data }) => {\n    await delay(DELAY)\n    const board = boards.find((b) => b.id === data)\n    invariant(board, 'missing board')\n    return board\n  })\n\nexport const createColumn = createServerFn()\n  .inputValidator(newColumnSchema)\n  .handler(async ({ data }) => {\n    await delay(DELAY)\n    const newColumn = newColumnSchema.parse(data)\n\n    const board = boards.find((b) => b.id === newColumn.boardId)\n\n    invariant(board, 'missing board')\n\n    board.columns = [\n      ...board.columns,\n      {\n        ...newColumn,\n        order: board.columns.length + 1,\n        id: crypto.randomUUID(),\n      },\n    ]\n  })\n\nexport const createItem = createServerFn()\n  .inputValidator(itemSchema)\n  .handler(async ({ data }) => {\n    await delay(DELAY)\n    const item = itemSchema.parse(data)\n\n    const board = boards.find((b) => b.id === item.boardId)\n\n    invariant(board, 'missing board')\n\n    board.items.push(item)\n  })\n\nexport const deleteItem = createServerFn({ method: 'GET' })\n  .inputValidator(deleteItemSchema)\n  .handler(async ({ data }) => {\n    await delay(DELAY)\n    const { id } = deleteItemSchema.parse(data)\n    const board = boards.find((b) => b.items.some((i) => i.id === id))\n    invariant(board, 'missing board')\n    board.items = board.items.filter((item) => item.id !== id)\n  })\n\nexport const updateItem = createServerFn()\n  .inputValidator(itemSchema)\n  .handler(async ({ data }) => {\n    await delay(DELAY)\n    const item = itemSchema.parse(data)\n    const board = boards.find((b) => b.id === item.boardId)\n    invariant(board, 'missing board')\n    const existingItem = board.items.find((i) => i.id === item.id)\n    invariant(existingItem, 'missing item')\n    Object.assign(existingItem, item)\n  })\n\nexport const updateColumn = createServerFn()\n  .inputValidator(updateColumnSchema)\n  .handler(async ({ data }) => {\n    await delay(DELAY)\n    const column = updateColumnSchema.parse(data)\n    const board = boards.find((b) => b.id === column.boardId)\n    invariant(board, 'missing board')\n    const existingColumn = board.columns.find((c) => c.id === column.id)\n    invariant(existingColumn, 'missing column')\n    Object.assign(existingColumn, column)\n  })\n\nexport const updateBoard = createServerFn()\n  .inputValidator(updateBoardSchema)\n  .handler(async ({ data }) => {\n    await delay(DELAY)\n    const update = updateBoardSchema.parse(data)\n    const board = boards.find((b) => b.id === update.id)\n    invariant(board, 'missing board')\n    Object.assign(board, update)\n  })\n\nexport const deleteColumn = createServerFn({ method: 'GET' })\n  .inputValidator(deleteColumnSchema)\n  .handler(async ({ data }) => {\n    await delay(DELAY)\n    const { id } = deleteColumnSchema.parse(data)\n    const board = boards.find((b) => b.columns.some((c) => c.id === id))\n    invariant(board, 'missing board')\n    board.columns = board.columns.filter((column) => column.id !== id)\n    board.items = board.items.filter((item) => item.columnId !== id)\n  })\n"
  },
  {
    "path": "examples/react/start-trellaux/src/db/schema.ts",
    "content": "import { z } from 'zod'\n\nexport const itemSchema = z.object({\n  id: z.string(),\n  title: z.string(),\n  content: z.string().optional(),\n  order: z.coerce.number(),\n  columnId: z.string().uuid(),\n  boardId: z.coerce.string(),\n})\n\nexport const columnSchema = z.object({\n  id: z.string().uuid(),\n  boardId: z.coerce.string(),\n  name: z.string(),\n  order: z.number(),\n})\n\nexport const boardSchema = z.object({\n  id: z.coerce.string(),\n  name: z.string(),\n  color: z.string(),\n  columns: z.array(columnSchema),\n  items: z.array(itemSchema),\n})\n\nexport const updateBoardSchema = boardSchema.partial().required({ id: true })\n\nexport const updateColumnSchema = columnSchema.partial().required({\n  id: true,\n  boardId: true,\n})\n\nexport const deleteItemSchema = itemSchema.pick({ id: true, boardId: true })\nexport const newColumnSchema = columnSchema.omit({ order: true, id: true })\nexport const deleteColumnSchema = columnSchema.pick({ boardId: true, id: true })\n\nexport type Board = z.infer<typeof boardSchema>\nexport type Column = z.infer<typeof columnSchema>\nexport type Item = z.infer<typeof itemSchema>\n"
  },
  {
    "path": "examples/react/start-trellaux/src/hooks/useOfflineIndicator.tsx",
    "content": "import { onlineManager } from '@tanstack/react-query'\nimport { useEffect } from 'react'\nimport toast from 'react-hot-toast'\n\nexport function useOfflineIndicator() {\n  useEffect(() => {\n    return onlineManager.subscribe(() => {\n      if (onlineManager.isOnline()) {\n        toast.success('online', {\n          id: 'ReactQuery',\n          duration: 2000,\n        })\n      } else {\n        toast.error('offline', {\n          id: 'ReactQuery',\n          duration: Infinity,\n        })\n      }\n    })\n  }, [])\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/icons/icons.tsx",
    "content": "import iconsHref from './icons.svg?url'\n\nexport function Icon({\n  name,\n  size = 'md',\n  spin = false,\n}: {\n  name: string\n  size?: 'md' | 'xl'\n  spin?: boolean\n}) {\n  const classNames = {\n    md: 'w-4 h-4',\n    xl: 'w-8 h-8',\n  }\n  return (\n    <svg\n      className={`${classNames[size]} inline self-center ${\n        spin ? 'animate-spin' : ''\n      }`}\n    >\n      <use href={`${iconsHref}#${name}`} />\n    </svg>\n  )\n}\n\nexport function LoginIcon() {\n  return (\n    <svg className=\"inline self-center w-8 h-8 text-white transform scale-x-[-1]\">\n      <use href={`${iconsHref}#login`} />\n    </svg>\n  )\n}\n\nexport function LogoutIcon() {\n  return (\n    <svg className=\"inline self-center w-8 h-8 text-white\">\n      <use href={`${iconsHref}#logout`} />\n    </svg>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/queries.ts",
    "content": "import {\n  queryOptions,\n  useMutation,\n  useQueryClient,\n} from '@tanstack/react-query'\nimport {\n  createColumn,\n  createItem,\n  deleteColumn,\n  deleteItem,\n  getBoard,\n  getBoards,\n  updateBoard,\n  updateColumn,\n  updateItem,\n} from './db/board.js'\n\nexport const boardQueries = {\n  list: () =>\n    queryOptions({ queryKey: ['boards', 'list'], queryFn: () => getBoards() }),\n  detail: (id: string) =>\n    queryOptions({\n      queryKey: ['boards', 'detail', id],\n      queryFn: () => getBoard({ data: id }),\n    }),\n}\n\nexport function useCreateColumnMutation() {\n  const queryClient = useQueryClient()\n  return useMutation({\n    mutationFn: createColumn,\n    onMutate: async (variables) => {\n      await queryClient.cancelQueries()\n      queryClient.setQueryData(\n        boardQueries.detail(variables.data.boardId).queryKey,\n        (board) =>\n          board\n            ? {\n                ...board,\n                columns: [\n                  ...board.columns,\n                  {\n                    ...variables.data,\n                    order: board.columns.length + 1,\n                    id: Math.random() + '',\n                  },\n                ],\n              }\n            : undefined,\n      )\n    },\n  })\n}\n\nexport function useCreateItemMutation() {\n  const queryClient = useQueryClient()\n\n  return useMutation({\n    mutationFn: createItem,\n    onMutate: async (variables) => {\n      await queryClient.cancelQueries()\n      queryClient.setQueryData(\n        boardQueries.detail(variables.data.boardId).queryKey,\n        (board) =>\n          board\n            ? {\n                ...board,\n                items: [...board.items, variables.data],\n              }\n            : undefined,\n      )\n    },\n  })\n}\n\nexport function useUpdateCardMutation() {\n  const queryClient = useQueryClient()\n\n  return useMutation({\n    mutationFn: updateItem,\n    onMutate: async (variables) => {\n      await queryClient.cancelQueries()\n      queryClient.setQueryData(\n        boardQueries.detail(variables.data.boardId).queryKey,\n        (board) =>\n          board\n            ? {\n                ...board,\n                items: board.items.map((i) =>\n                  i.id === variables.data.id ? variables.data : i,\n                ),\n              }\n            : undefined,\n      )\n    },\n  })\n}\n\nexport function useDeleteCardMutation() {\n  const queryClient = useQueryClient()\n\n  return useMutation({\n    mutationFn: deleteItem,\n    onMutate: async (variables) => {\n      await queryClient.cancelQueries()\n\n      queryClient.setQueryData(\n        boardQueries.detail(variables.data.boardId).queryKey,\n        (board) =>\n          board\n            ? {\n                ...board,\n                items: board.items.filter(\n                  (item) => item.id !== variables.data.id,\n                ),\n              }\n            : undefined,\n      )\n    },\n  })\n}\n\nexport function useDeleteColumnMutation() {\n  const queryClient = useQueryClient()\n\n  return useMutation({\n    mutationFn: deleteColumn,\n    onMutate: async (variables) => {\n      await queryClient.cancelQueries()\n\n      queryClient.setQueryData(\n        boardQueries.detail(variables.data.boardId).queryKey,\n        (board) =>\n          board\n            ? {\n                ...board,\n                columns: board.columns.filter(\n                  (column) => column.id !== variables.data.id,\n                ),\n                items: board.items.filter(\n                  (item) => item.columnId !== variables.data.id,\n                ),\n              }\n            : undefined,\n      )\n    },\n  })\n}\n\nexport function useUpdateBoardMutation() {\n  return useMutation({\n    mutationFn: updateBoard,\n  })\n}\n\nexport function useUpdateColumnMutation() {\n  const queryClient = useQueryClient()\n\n  return useMutation({\n    mutationFn: updateColumn,\n    onMutate: async (variables) => {\n      await queryClient.cancelQueries()\n\n      queryClient.setQueryData(\n        boardQueries.detail(variables.data.boardId).queryKey,\n        (board) =>\n          board\n            ? {\n                ...board,\n                columns: board.columns.map((c) =>\n                  c.id === variables.data.id\n                    ? {\n                        ...c,\n                        ...variables,\n                      }\n                    : c,\n                ),\n              }\n            : undefined,\n      )\n    },\n  })\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as BoardsBoardIdRouteImport } from './routes/boards.$boardId'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BoardsBoardIdRoute = BoardsBoardIdRouteImport.update({\n  id: '/boards/$boardId',\n  path: '/boards/$boardId',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/boards/$boardId': typeof BoardsBoardIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/boards/$boardId': typeof BoardsBoardIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/boards/$boardId': typeof BoardsBoardIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/boards/$boardId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/boards/$boardId'\n  id: '__root__' | '/' | '/boards/$boardId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  BoardsBoardIdRoute: typeof BoardsBoardIdRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/boards/$boardId': {\n      id: '/boards/$boardId'\n      path: '/boards/$boardId'\n      fullPath: '/boards/$boardId'\n      preLoaderRoute: typeof BoardsBoardIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  BoardsBoardIdRoute: BoardsBoardIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/react-start'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/router.tsx",
    "content": "import {\n  MutationCache,\n  QueryClient,\n  notifyManager,\n} from '@tanstack/react-query'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport toast from 'react-hot-toast'\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  if (typeof document !== 'undefined') {\n    notifyManager.setScheduler(window.requestAnimationFrame)\n  }\n\n  const queryClient: QueryClient = new QueryClient({\n    defaultOptions: {\n      queries: {\n        refetchOnReconnect: () => !queryClient.isMutating(),\n      },\n    },\n    mutationCache: new MutationCache({\n      onError: (error) => {\n        toast(error.message, { className: 'bg-red-500 text-white' })\n      },\n      onSettled: () => {\n        if (queryClient.isMutating() === 1) {\n          return queryClient.invalidateQueries()\n        }\n      },\n    }),\n  })\n\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n    context: {\n      queryClient,\n    },\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools/production'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport * as React from 'react'\nimport { Toaster } from 'react-hot-toast'\nimport type { QueryClient } from '@tanstack/react-query'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { IconLink } from '~/components/IconLink'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\nimport { Loader } from '~/components/Loader'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <div className=\"h-screen flex flex-col min-h-0\">\n          <div className=\"bg-slate-900 border-b border-slate-800 flex items-center justify-between py-4 px-8 box-border\">\n            <div className=\"flex items-center gap-4\">\n              <div>\n                <Link to=\"/\" className=\"block leading-tight\">\n                  <div className=\"font-black text-2xl text-white\">Trellaux</div>\n                  <div className=\"text-slate-500\">a TanStack Demo</div>\n                </Link>\n              </div>\n              <LoadingIndicator />\n            </div>\n            <div className=\"flex items-center gap-6\">\n              {/* <label\n                htmlFor=\"countries\"\n                className=\"block text-sm font-medium text-gray-900 dark:text-white\"\n              >\n                Delay\n              </label>\n              <select\n                className=\"border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500\"\n                onChange={(event) => {\n                  // setExtraDelay(Number(event.currentTarget.value))\n                }}\n                defaultValue=\"0\"\n              >\n                <option value=\"0\">None</option>\n                <option value=\"100\">100</option>\n                <option value=\"500\">500</option>\n                <option value=\"2000\">2000</option>\n              </select> */}\n              <IconLink\n                href=\"https://github.com/TanStack/router/tree/main/examples/react/start-trellaux\"\n                label=\"Source\"\n                icon=\"/github-mark-white.png\"\n              />\n              <IconLink\n                href=\"https://tanstack.com\"\n                icon=\"/tanstack.png\"\n                label=\"TanStack\"\n              />\n            </div>\n          </div>\n\n          <div className=\"grow min-h-0 h-full flex flex-col\">\n            {children}\n            <Toaster />\n          </div>\n        </div>\n        <ReactQueryDevtools />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n\nfunction LoadingIndicator() {\n  const isLoading = useRouterState({ select: (s) => s.isLoading })\n  return (\n    <div\n      className={`h-12 transition-all duration-300 ${\n        isLoading ? `opacity-100 delay-300` : `opacity-0 delay-0`\n      }`}\n    >\n      <Loader />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/routes/boards.$boardId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Board } from '~/components/Board'\nimport { Loader } from '~/components/Loader'\nimport { boardQueries } from '~/queries'\n\nexport const Route = createFileRoute('/boards/$boardId')({\n  component: Home,\n  pendingComponent: () => <Loader />,\n  loader: async ({ params, context: { queryClient } }) => {\n    await queryClient.ensureQueryData(boardQueries.detail(params.boardId))\n  },\n})\n\nfunction Home() {\n  const { boardId } = Route.useParams()\n\n  return <Board boardId={boardId} />\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/routes/index.tsx",
    "content": "import { useSuspenseQuery } from '@tanstack/react-query'\nimport { Link, createFileRoute } from '@tanstack/react-router'\nimport { Loader } from '~/components/Loader'\nimport { boardQueries } from '~/queries'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  pendingComponent: () => <Loader />,\n})\n\nfunction Home() {\n  const boardsQuery = useSuspenseQuery(boardQueries.list())\n\n  return (\n    <div className=\"p-8 space-y-2\">\n      <h1 className=\"text-2xl font-black\">Boards</h1>\n      <ul className=\"flex flex-wrap list-disc\">\n        {boardsQuery.data.map((board) => (\n          <li key={board.id} className=\"ml-4\">\n            <Link\n              to=\"/boards/$boardId\"\n              params={{\n                boardId: board.id,\n              }}\n              className=\"font-bold text-blue-500\"\n            >\n              {board.name}\n            </Link>\n          </li>\n        ))}\n      </ul>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n\n  #root {\n    @apply min-h-screen;\n  }\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/src/types.ts",
    "content": "export interface RenderedItem {\n  id: string\n  title: string\n  order: number\n  content?: string\n  columnId: string\n}\n\nexport const CONTENT_TYPES = {\n  card: 'application/app-card',\n  column: 'application/app-column',\n}\n\nexport const INTENTS = {\n  updateColumnName: 'updateColumnName' as const,\n  updateBoardName: 'updateBoardName' as const,\n}\n\nexport const ItemMutationFields = {\n  id: { type: String, name: 'id' },\n  columnId: { type: String, name: 'columnId' },\n  order: { type: Number, name: 'order' },\n  title: { type: String, name: 'title' },\n} as const\n"
  },
  {
    "path": "examples/react/start-trellaux/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "examples/react/start-trellaux/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-trellaux/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteReact from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteReact()],\n})\n"
  },
  {
    "path": "examples/react/start-workos/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/start-workos/.gitignore",
    "content": "node_modules/\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n\n/build/\n/api/\n/server/build\n/public/build\n"
  },
  {
    "path": "examples/react/start-workos/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nsrc/routeTree.gen.ts"
  },
  {
    "path": "examples/react/start-workos/README.md",
    "content": "# TanStack Start + WorkOS\n\nThis site is built with TanStack Router! An example application demonstrating how to authenticate users with AuthKit and the WorkOS Node SDK.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [WorkOS Documentation](https://workos.com/docs)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/start-workos start-workos\n```\n\n## Prerequisites\n\nYou will need a [WorkOS account](https://dashboard.workos.com/signup).\n\n## Running the example\n\n1. In the [WorkOS dashboard](https://dashboard.workos.com), click on the User Management tile and set up the [sign-in callback redirect](https://workos.com/docs/user-management/1-configure-your-project/configure-a-redirect-uri) as `http://localhost:3000/api/auth/callback`. Once completed, set the app homepage URL to `http://localhost:3000`.\n   > [!NOTE]\n   > If you already have set up an application in your WorkOS dashboard, then you can simply head to the _Redirects_ tab and add a new redirect URI.\n2. After creating the redirect URI, navigate to the API keys tab and copy the _Client ID_ and the _Secret Key_. Rename the `.env.example` file to `.env` and supply your Client ID and API key as environment variables.\n3. Additionally, create a cookie password as the private key used to encrypt the session cookie. Copy the output into the environment variable `WORKOS_COOKIE_PASSWORD`.\n   It has to be at least 32 characters long. You can use https://1password.com/password-generator/ to generate strong passwords.\n4. Verify your `.env.local` file has the following variables filled.\n   ```bash\n   WORKOS_CLIENT_ID=<YOUR_CLIENT_ID>\n   WORKOS_API_KEY=<YOUR_API_SECRET_KEY>\n   WORKOS_COOKIE_PASSWORD=<YOUR_COOKIE_PASSWORD>\n   WORKOS_REDIRECT_URI=http://localhost:3000/callback\n   ```\n   `WORKOS_COOKIE_PASSWORD` is the private key used to encrypt the session cookie. It has to be at least 32 characters long. You can use the [1Password generator](https://1password.com/password-generator/) or the `openssl` library to generate a strong password via the command line:\n   ```bash\n   openssl rand -base64 24\n   ```\n   To use the `signOut` method, you'll need to set a default Logout URI in your WorkOS dashboard settings under \"Redirects\".\n5. Run the following command and navigate to [http://localhost:3000](http://localhost:3000).\n   ```bash\n   pnpm dev\n   ```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- WorkOS authentication integration\n- AuthKit usage\n- Protected routes\n- User session management\n"
  },
  {
    "path": "examples/react/start-workos/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-workos\",\n  \"private\": true,\n  \"main\": \"index.js\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"@radix-ui/themes\": \"^3.3.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/react-start\": \"^1.167.1\",\n    \"@workos/authkit-tanstack-react-start\": \"^0.5.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/start-workos/prettier.config.js",
    "content": "/**\n * @see https://prettier.io/docs/configuration\n * @type {import('prettier').Config}\n */\nconst config = {\n  trailingComma: 'all',\n  tabWidth: 2,\n  semi: true,\n  singleQuote: true,\n  printWidth: 120,\n};\n\nexport default config;\n"
  },
  {
    "path": "examples/react/start-workos/src/app.css",
    "content": "@import '@radix-ui/themes/styles.css';\n"
  },
  {
    "path": "examples/react/start-workos/src/components/footer.tsx",
    "content": "import { Card, Grid, Heading, Text } from '@radix-ui/themes';\n\nexport default function Footer() {\n  return (\n    <Grid columns={{ initial: '1', sm: '3' }} gap={{ initial: '3', sm: '5' }}>\n      <Card size=\"4\" asChild variant=\"classic\">\n        <a href=\"https://workos.com/docs\" rel=\"noreferrer\" target=\"_blank\">\n          <Heading size=\"4\" mb=\"1\">\n            Documentation\n          </Heading>\n          <Text color=\"gray\">View integration guides and SDK documentation.</Text>\n        </a>\n      </Card>\n      <Card size=\"4\" asChild variant=\"classic\">\n        <a href=\"https://workos.com/docs/reference\" rel=\"noreferrer\" target=\"_blank\">\n          <Heading size=\"4\" mb=\"1\">\n            API Reference\n          </Heading>\n          <Text color=\"gray\">Every WorkOS API method and endpoint documented.</Text>\n        </a>\n      </Card>\n      <Card size=\"4\" asChild variant=\"classic\">\n        <a href=\"https://workos.com\" rel=\"noreferrer\" target=\"_blank\">\n          <Heading size=\"4\" mb=\"1\">\n            WorkOS\n          </Heading>\n          <Text color=\"gray\">Learn more about other WorkOS products.</Text>\n        </a>\n      </Card>\n    </Grid>\n  );\n}\n"
  },
  {
    "path": "examples/react/start-workos/src/components/sign-in-button.tsx",
    "content": "import { Button, Flex } from '@radix-ui/themes';\nimport { Link } from '@tanstack/react-router';\nimport type { User } from '@workos/authkit-tanstack-react-start';\n\nexport default function SignInButton({ large, user, url }: { large?: boolean; user: User | null; url: string }) {\n  if (user) {\n    return (\n      <Flex gap=\"3\">\n        <Button asChild size={large ? '3' : '2'}>\n          <Link to=\"/logout\" reloadDocument>\n            Sign Out\n          </Link>\n        </Button>\n      </Flex>\n    );\n  }\n\n  return (\n    <Button asChild size={large ? '3' : '2'}>\n      <a href={url}>Sign In{large && ' with AuthKit'}</a>\n    </Button>\n  );\n}\n"
  },
  {
    "path": "examples/react/start-workos/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as ClientRouteImport } from './routes/client'\nimport { Route as AuthenticatedRouteImport } from './routes/_authenticated'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthenticatedAccountRouteImport } from './routes/_authenticated/account'\nimport { Route as ApiAuthCallbackRouteImport } from './routes/api/auth/callback'\n\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClientRoute = ClientRouteImport.update({\n  id: '/client',\n  path: '/client',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthenticatedRoute = AuthenticatedRouteImport.update({\n  id: '/_authenticated',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthenticatedAccountRoute = AuthenticatedAccountRouteImport.update({\n  id: '/account',\n  path: '/account',\n  getParentRoute: () => AuthenticatedRoute,\n} as any)\nconst ApiAuthCallbackRoute = ApiAuthCallbackRouteImport.update({\n  id: '/api/auth/callback',\n  path: '/api/auth/callback',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/client': typeof ClientRoute\n  '/logout': typeof LogoutRoute\n  '/account': typeof AuthenticatedAccountRoute\n  '/api/auth/callback': typeof ApiAuthCallbackRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/client': typeof ClientRoute\n  '/logout': typeof LogoutRoute\n  '/account': typeof AuthenticatedAccountRoute\n  '/api/auth/callback': typeof ApiAuthCallbackRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authenticated': typeof AuthenticatedRouteWithChildren\n  '/client': typeof ClientRoute\n  '/logout': typeof LogoutRoute\n  '/_authenticated/account': typeof AuthenticatedAccountRoute\n  '/api/auth/callback': typeof ApiAuthCallbackRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/client' | '/logout' | '/account' | '/api/auth/callback'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/client' | '/logout' | '/account' | '/api/auth/callback'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authenticated'\n    | '/client'\n    | '/logout'\n    | '/_authenticated/account'\n    | '/api/auth/callback'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthenticatedRoute: typeof AuthenticatedRouteWithChildren\n  ClientRoute: typeof ClientRoute\n  LogoutRoute: typeof LogoutRoute\n  ApiAuthCallbackRoute: typeof ApiAuthCallbackRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/client': {\n      id: '/client'\n      path: '/client'\n      fullPath: '/client'\n      preLoaderRoute: typeof ClientRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authenticated': {\n      id: '/_authenticated'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthenticatedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authenticated/account': {\n      id: '/_authenticated/account'\n      path: '/account'\n      fullPath: '/account'\n      preLoaderRoute: typeof AuthenticatedAccountRouteImport\n      parentRoute: typeof AuthenticatedRoute\n    }\n    '/api/auth/callback': {\n      id: '/api/auth/callback'\n      path: '/api/auth/callback'\n      fullPath: '/api/auth/callback'\n      preLoaderRoute: typeof ApiAuthCallbackRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\ninterface AuthenticatedRouteChildren {\n  AuthenticatedAccountRoute: typeof AuthenticatedAccountRoute\n}\n\nconst AuthenticatedRouteChildren: AuthenticatedRouteChildren = {\n  AuthenticatedAccountRoute: AuthenticatedAccountRoute,\n}\n\nconst AuthenticatedRouteWithChildren = AuthenticatedRoute._addFileChildren(\n  AuthenticatedRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthenticatedRoute: AuthenticatedRouteWithChildren,\n  ClientRoute: ClientRoute,\n  LogoutRoute: LogoutRoute,\n  ApiAuthCallbackRoute: ApiAuthCallbackRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { startInstance } from './start.ts'\ndeclare module '@tanstack/react-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n    config: Awaited<ReturnType<typeof startInstance.getOptions>>\n  }\n}\n"
  },
  {
    "path": "examples/react/start-workos/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/react-router';\nimport { routeTree } from './routeTree.gen';\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  });\n\n  return router;\n}\n"
  },
  {
    "path": "examples/react/start-workos/src/routes/__root.tsx",
    "content": "import { Box, Button, Card, Container, Flex, Theme } from '@radix-ui/themes';\nimport { HeadContent, Link, Outlet, Scripts, createRootRoute } from '@tanstack/react-router';\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools';\nimport { Suspense } from 'react';\nimport { getSignInUrl } from '@workos/authkit-tanstack-react-start';\nimport { AuthKitProvider, getAuthAction } from '@workos/authkit-tanstack-react-start/client';\nimport Footer from '../components/footer';\nimport SignInButton from '../components/sign-in-button';\nimport appCssUrl from '../app.css?url';\nimport type { ReactNode } from 'react';\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'AuthKit Example in TanStack Start',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCssUrl }],\n  }),\n  loader: async () => {\n    // getAuthAction() returns auth state without accessToken, safe for client\n    // Pass to AuthKitProvider as initialAuth to avoid loading flicker\n    const auth = await getAuthAction();\n    const url = await getSignInUrl();\n    return {\n      auth,\n      url,\n    };\n  },\n  component: RootComponent,\n  notFoundComponent: () => <div>Not Found</div>,\n});\n\nfunction RootComponent() {\n  const { auth, url } = Route.useLoaderData();\n  return (\n    <RootDocument>\n      <AuthKitProvider initialAuth={auth}>\n        <Theme accentColor=\"iris\" panelBackground=\"solid\" style={{ backgroundColor: 'var(--gray-1)' }}>\n          <Container style={{ backgroundColor: 'var(--gray-1)' }}>\n            <Flex direction=\"column\" gap=\"5\" p=\"5\" height=\"100vh\">\n              <Box asChild flexGrow=\"1\">\n                <Card size=\"4\">\n                  <Flex direction=\"column\" height=\"100%\">\n                    <Flex asChild justify=\"between\">\n                      <header>\n                        <Flex gap=\"4\">\n                          <Button asChild variant=\"soft\">\n                            <Link to=\"/\">Home</Link>\n                          </Button>\n\n                          <Button asChild variant=\"soft\">\n                            <Link to=\"/account\">Account</Link>\n                          </Button>\n\n                          <Button asChild variant=\"soft\">\n                            <Link to=\"/client\">Client Demo</Link>\n                          </Button>\n                        </Flex>\n\n                        <Suspense fallback={<div>Loading...</div>}>\n                          <SignInButton user={auth.user} url={url} />\n                        </Suspense>\n                      </header>\n                    </Flex>\n\n                    <Flex flexGrow=\"1\" align=\"center\" justify=\"center\">\n                      <main>\n                        <Outlet />\n                      </main>\n                    </Flex>\n                  </Flex>\n                </Card>\n              </Box>\n              <Footer />\n            </Flex>\n          </Container>\n        </Theme>\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </AuthKitProvider>\n    </RootDocument>\n  );\n}\n\nfunction RootDocument({ children }: Readonly<{ children: ReactNode }>) {\n  return (\n    <html lang=\"en\">\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  );\n}\n"
  },
  {
    "path": "examples/react/start-workos/src/routes/_authenticated/account.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router';\nimport { Box, Flex, Heading, Text, TextField } from '@radix-ui/themes';\nimport { getAuth } from '@workos/authkit-tanstack-react-start';\n\nexport const Route = createFileRoute('/_authenticated/account')({\n  component: RouteComponent,\n  loader: async () => {\n    const auth = await getAuth();\n\n    const userFields: Array<[label: string, value: string | undefined]> = [\n      ['First name', auth.user?.firstName ?? ''],\n      ['Last name', auth.user?.lastName ?? ''],\n      ['Email', auth.user?.email],\n      ['Id', auth.user?.id],\n    ];\n\n    if (auth.user && 'role' in auth && auth.role) {\n      userFields.push(['Role', auth.role]);\n    }\n\n    if (auth.user && 'permissions' in auth && auth.permissions) {\n      userFields.push(['Permissions', auth.permissions.join(', ')]);\n    }\n\n    return userFields;\n  },\n});\n\nfunction RouteComponent() {\n  const userFields = Route.useLoaderData();\n  return (\n    <>\n      <Flex direction=\"column\" gap=\"2\" mb=\"7\">\n        <Heading size=\"8\" align=\"center\">\n          Account details\n        </Heading>\n        <Text size=\"5\" align=\"center\" color=\"gray\">\n          Below are your account details\n        </Text>\n      </Flex>\n\n      {userFields && (\n        <Flex direction=\"column\" justify=\"center\" gap=\"3\" width=\"400px\">\n          {userFields.map(([label, value]) => (\n            <Flex asChild align=\"center\" gap=\"6\" key={String(value)}>\n              <label>\n                <Text weight=\"bold\" size=\"3\" style={{ width: 100 }}>\n                  {label}\n                </Text>\n\n                <Box flexGrow=\"1\">\n                  <TextField.Root value={String(value) || ''} readOnly />\n                </Box>\n              </label>\n            </Flex>\n          ))}\n        </Flex>\n      )}\n    </>\n  );\n}\n"
  },
  {
    "path": "examples/react/start-workos/src/routes/_authenticated.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/react-router';\nimport { getAuth, getSignInUrl } from '@workos/authkit-tanstack-react-start';\n\nexport const Route = createFileRoute('/_authenticated')({\n  loader: async ({ location }) => {\n    // Loader runs on server (even during client-side navigation via RPC)\n    const { user } = await getAuth();\n    if (!user) {\n      const path = location.pathname;\n      const href = await getSignInUrl({ data: { returnPathname: path } });\n      throw redirect({ href });\n    }\n  },\n});\n"
  },
  {
    "path": "examples/react/start-workos/src/routes/api/auth/callback.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router';\nimport { handleCallbackRoute } from '@workos/authkit-tanstack-react-start';\n\nexport const Route = createFileRoute('/api/auth/callback')({\n  server: {\n    handlers: {\n      GET: handleCallbackRoute(),\n    },\n  },\n});\n"
  },
  {
    "path": "examples/react/start-workos/src/routes/client.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/react-router';\nimport { Badge, Box, Button, Callout, Code, Flex, Heading, Text, TextField } from '@radix-ui/themes';\nimport { useAccessToken, useAuth } from '@workos/authkit-tanstack-react-start/client';\nimport { useState } from 'react';\n\nexport const Route = createFileRoute('/client')({\n  component: RouteComponent,\n});\n\nfunction RouteComponent() {\n  const {\n    user,\n    loading,\n    sessionId,\n    organizationId,\n    role,\n    roles,\n    permissions,\n    entitlements,\n    featureFlags,\n    impersonator,\n    signOut,\n    switchToOrganization,\n  } = useAuth();\n  const { accessToken, loading: tokenLoading, error: tokenError, refresh, getAccessToken } = useAccessToken();\n\n  const handleRefreshToken = async () => {\n    try {\n      await refresh();\n    } catch (err) {\n      console.error('Token refresh failed:', err);\n    }\n  };\n\n  const handleGetFreshToken = async () => {\n    try {\n      const token = await getAccessToken();\n      console.log('Fresh token:', token);\n    } catch (err) {\n      console.error('Get fresh token failed:', err);\n    }\n  };\n\n  const handleClientSignOut = async () => {\n    console.log('🧪 Testing client-side signOut() from useAuth()...');\n    try {\n      await signOut({ returnTo: '/' });\n      console.log('✅ signOut() completed');\n    } catch (err) {\n      console.error('❌ signOut() failed:', err);\n    }\n  };\n\n  const [orgIdInput, setOrgIdInput] = useState('');\n  const [switchOrgResult, setSwitchOrgResult] = useState<string | null>(null);\n\n  const handleSwitchOrg = async () => {\n    if (!orgIdInput.trim()) {\n      setSwitchOrgResult('Please enter an organization ID');\n      return;\n    }\n\n    console.log(`🔄 Switching to organization: ${orgIdInput}...`);\n    setSwitchOrgResult(null);\n\n    try {\n      const result = await switchToOrganization(orgIdInput.trim());\n      if (result && 'error' in result) {\n        console.error('❌ Switch failed:', result.error);\n        setSwitchOrgResult(`Error: ${result.error}`);\n      } else {\n        console.log('✅ Successfully switched organizations');\n        setSwitchOrgResult('✅ Success! Check updated claims above.');\n      }\n    } catch (err) {\n      const message = err instanceof Error ? err.message : String(err);\n      console.error('❌ Switch error:', message);\n      setSwitchOrgResult(`Error: ${message}`);\n    }\n  };\n\n  if (loading) {\n    return (\n      <Flex direction=\"column\" gap=\"2\" align=\"center\">\n        <Heading size=\"8\">Loading...</Heading>\n      </Flex>\n    );\n  }\n\n  if (!user) {\n    return (\n      <Flex direction=\"column\" gap=\"4\" align=\"center\" maxWidth=\"600px\">\n        <Heading size=\"8\" align=\"center\">\n          Client-Side Hooks Demo\n        </Heading>\n        <Text size=\"5\" align=\"center\" color=\"gray\">\n          This page demonstrates the client-side hooks from <Code>@workos/authkit-tanstack-start/client</Code>\n        </Text>\n        <Callout.Root>\n          <Callout.Text>ℹ️ Please sign in to see the client-side hooks in action.</Callout.Text>\n        </Callout.Root>\n      </Flex>\n    );\n  }\n\n  return (\n    <Flex direction=\"column\" gap=\"5\" maxWidth=\"800px\">\n      <Flex direction=\"column\" gap=\"2\" mb=\"2\">\n        <Heading size=\"8\" align=\"center\">\n          Client-Side Hooks Demo\n        </Heading>\n        <Text size=\"5\" align=\"center\" color=\"gray\">\n          Using <Code>useAuth()</Code> and <Code>useAccessToken()</Code>\n        </Text>\n      </Flex>\n\n      <Callout.Root>\n        <Callout.Text>\n          ℹ️ This page uses client-side React hooks to access authentication data. Unlike server-side loaders, these\n          hooks work in client components and automatically update when auth state changes.\n        </Callout.Text>\n      </Callout.Root>\n\n      <Flex direction=\"column\" gap=\"3\">\n        <Heading size=\"5\">useAuth() Hook</Heading>\n        <Flex direction=\"column\" gap=\"2\">\n          <Flex align=\"center\" gap=\"2\">\n            <Text weight=\"bold\" style={{ width: 150 }}>\n              User ID:\n            </Text>\n            <TextField.Root value={user.id} readOnly style={{ flexGrow: 1 }} />\n          </Flex>\n          <Flex align=\"center\" gap=\"2\">\n            <Text weight=\"bold\" style={{ width: 150 }}>\n              Email:\n            </Text>\n            <TextField.Root value={user.email} readOnly style={{ flexGrow: 1 }} />\n          </Flex>\n          <Flex align=\"center\" gap=\"2\">\n            <Text weight=\"bold\" style={{ width: 150 }}>\n              First Name:\n            </Text>\n            <TextField.Root value={user.firstName || ''} readOnly style={{ flexGrow: 1 }} />\n          </Flex>\n          <Flex align=\"center\" gap=\"2\">\n            <Text weight=\"bold\" style={{ width: 150 }}>\n              Last Name:\n            </Text>\n            <TextField.Root value={user.lastName || ''} readOnly style={{ flexGrow: 1 }} />\n          </Flex>\n          <Flex align=\"center\" gap=\"2\">\n            <Text weight=\"bold\" style={{ width: 150 }}>\n              Session ID:\n            </Text>\n            <TextField.Root value={sessionId || ''} readOnly style={{ flexGrow: 1 }} />\n          </Flex>\n          {organizationId && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Organization ID:\n              </Text>\n              <TextField.Root value={organizationId} readOnly style={{ flexGrow: 1 }} />\n            </Flex>\n          )}\n          {role && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Role:\n              </Text>\n              <TextField.Root value={role} readOnly style={{ flexGrow: 1 }} />\n            </Flex>\n          )}\n          {roles && roles.length > 0 && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Roles:\n              </Text>\n              <Flex gap=\"2\" wrap=\"wrap\" style={{ flexGrow: 1 }}>\n                {roles.map((r) => (\n                  <Badge key={r}>{r}</Badge>\n                ))}\n              </Flex>\n            </Flex>\n          )}\n          {permissions && permissions.length > 0 && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Permissions:\n              </Text>\n              <Flex gap=\"2\" wrap=\"wrap\" style={{ flexGrow: 1 }}>\n                {permissions.map((p) => (\n                  <Badge key={p} color=\"blue\">\n                    {p}\n                  </Badge>\n                ))}\n              </Flex>\n            </Flex>\n          )}\n          {entitlements && entitlements.length > 0 && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Entitlements:\n              </Text>\n              <Flex gap=\"2\" wrap=\"wrap\" style={{ flexGrow: 1 }}>\n                {entitlements.map((e) => (\n                  <Badge key={e} color=\"green\">\n                    {e}\n                  </Badge>\n                ))}\n              </Flex>\n            </Flex>\n          )}\n          {featureFlags && featureFlags.length > 0 && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Feature Flags:\n              </Text>\n              <Flex gap=\"2\" wrap=\"wrap\" style={{ flexGrow: 1 }}>\n                {featureFlags.map((f) => (\n                  <Badge key={f} color=\"purple\">\n                    {f}\n                  </Badge>\n                ))}\n              </Flex>\n            </Flex>\n          )}\n          {impersonator && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Impersonator:\n              </Text>\n              <TextField.Root value={impersonator.email} readOnly style={{ flexGrow: 1 }} />\n            </Flex>\n          )}\n        </Flex>\n      </Flex>\n\n      <Flex direction=\"column\" gap=\"3\">\n        <Heading size=\"5\">useAccessToken() Hook</Heading>\n        <Flex direction=\"column\" gap=\"2\">\n          <Flex align=\"center\" gap=\"2\">\n            <Text weight=\"bold\" style={{ width: 150 }}>\n              Token Status:\n            </Text>\n            <Badge color={tokenLoading ? 'yellow' : accessToken ? 'green' : 'gray'}>\n              {tokenLoading ? 'Loading' : accessToken ? 'Available' : 'None'}\n            </Badge>\n          </Flex>\n          {tokenError && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Error:\n              </Text>\n              <Badge color=\"red\">{tokenError.message}</Badge>\n            </Flex>\n          )}\n          {accessToken && (\n            <Flex align=\"center\" gap=\"2\">\n              <Text weight=\"bold\" style={{ width: 150 }}>\n                Access Token:\n              </Text>\n              <Box style={{ flexGrow: 1, maxWidth: '100%', overflow: 'hidden' }}>\n                <Code size=\"2\" style={{ wordBreak: 'break-all', display: 'block' }}>\n                  ...{accessToken.slice(-20)}\n                </Code>\n              </Box>\n            </Flex>\n          )}\n          <Flex gap=\"2\" mt=\"2\">\n            <Button onClick={handleRefreshToken} disabled={tokenLoading}>\n              Refresh Token\n            </Button>\n            <Button onClick={handleGetFreshToken} disabled={tokenLoading} variant=\"soft\">\n              Get Fresh Token (Console)\n            </Button>\n          </Flex>\n        </Flex>\n      </Flex>\n\n      <Flex direction=\"column\" gap=\"3\">\n        <Heading size=\"5\">Organization Management</Heading>\n        <Text size=\"2\" color=\"gray\">\n          Switch to a different organization. Requires multi-organization setup in WorkOS.\n        </Text>\n        <Callout.Root>\n          <Callout.Text>\n            <strong>Setup required:</strong> This feature requires your WorkOS user to be a member of multiple\n            organizations. Create organizations in the WorkOS dashboard and add your user to them.\n          </Callout.Text>\n        </Callout.Root>\n        <Flex direction=\"column\" gap=\"2\">\n          <Flex align=\"center\" gap=\"2\">\n            <Text weight=\"bold\" style={{ width: 150 }}>\n              Current Org:\n            </Text>\n            <Badge color={organizationId ? 'green' : 'gray'} size=\"2\">\n              {organizationId || 'None'}\n            </Badge>\n          </Flex>\n          <Flex align=\"center\" gap=\"2\">\n            <Text weight=\"bold\" style={{ width: 150 }}>\n              Switch to Org:\n            </Text>\n            <TextField.Root\n              placeholder=\"org_...\"\n              value={orgIdInput}\n              onChange={(e) => setOrgIdInput(e.target.value)}\n              style={{ flexGrow: 1 }}\n            />\n            <Button onClick={handleSwitchOrg} disabled={!orgIdInput.trim()}>\n              Switch\n            </Button>\n          </Flex>\n          {switchOrgResult && (\n            <Callout.Root color={switchOrgResult.startsWith('✅') ? 'green' : 'red'}>\n              <Callout.Text>{switchOrgResult}</Callout.Text>\n            </Callout.Root>\n          )}\n        </Flex>\n      </Flex>\n\n      <Flex direction=\"column\" gap=\"3\">\n        <Heading size=\"5\">Sign Out Methods</Heading>\n        <Text size=\"2\" color=\"gray\">\n          Test different sign out approaches. Check the browser console for logs.\n        </Text>\n        <Flex gap=\"2\" wrap=\"wrap\">\n          <Button onClick={handleClientSignOut} color=\"red\">\n            Sign Out (Client-Side useAuth)\n          </Button>\n          <Button asChild color=\"red\" variant=\"soft\">\n            <Link to=\"/logout\" reloadDocument>\n              Sign Out (Route Loader)\n            </Link>\n          </Button>\n        </Flex>\n        <Callout.Root color=\"blue\">\n          <Callout.Text>\n            <strong>Client-Side useAuth:</strong> Calls <Code>signOut()</Code> from the provider context. This tests the\n            redirect handling logic we just fixed.\n            <br />\n            <strong>Route Loader:</strong> Uses the <Code>/logout</Code> route which calls the server function directly\n            in a loader.\n          </Callout.Text>\n        </Callout.Root>\n      </Flex>\n    </Flex>\n  );\n}\n"
  },
  {
    "path": "examples/react/start-workos/src/routes/index.tsx",
    "content": "import { Button, Flex, Heading, Text } from '@radix-ui/themes';\nimport { Link, createFileRoute } from '@tanstack/react-router';\nimport { getAuth, getSignInUrl } from '@workos/authkit-tanstack-react-start';\nimport SignInButton from '../components/sign-in-button';\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => {\n    const { user } = await getAuth();\n    const url = await getSignInUrl();\n    return { user, url };\n  },\n});\n\nfunction Home() {\n  const { user, url } = Route.useLoaderData();\n\n  return (\n    <Flex direction=\"column\" align=\"center\" gap=\"2\">\n      {user ? (\n        <>\n          <Heading size=\"8\">Welcome back{user?.firstName && `, ${user?.firstName}`}</Heading>\n          <Text size=\"5\" color=\"gray\">\n            You are now authenticated into the TanStack Start application\n          </Text>\n          <Flex align=\"center\" gap=\"3\" mt=\"4\">\n            <Button asChild size=\"3\" variant=\"soft\">\n              <Link to=\"/account\">View account</Link>\n            </Button>\n            <SignInButton url={url} user={user} large />\n          </Flex>\n        </>\n      ) : (\n        <>\n          <Heading size=\"8\">AuthKit authentication example</Heading>\n          <Heading size=\"7\">TanStack Start</Heading>\n          <Text size=\"5\" color=\"gray\" mb=\"4\">\n            Sign in to view your account details\n          </Text>\n          <SignInButton user={user} url={url} large />\n        </>\n      )}\n    </Flex>\n  );\n}\n"
  },
  {
    "path": "examples/react/start-workos/src/routes/logout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router';\nimport { signOut } from '@workos/authkit-tanstack-react-start';\n\nexport const Route = createFileRoute('/logout')({\n  preload: false,\n  loader: async () => {\n    await signOut();\n  },\n});\n"
  },
  {
    "path": "examples/react/start-workos/src/start.ts",
    "content": "import { createStart } from '@tanstack/react-start';\nimport { authkitMiddleware } from '@workos/authkit-tanstack-react-start';\n\n/**\n * Configure TanStack Start with AuthKit middleware.\n * The middleware runs on every server request and provides auth context.\n */\nexport const startInstance = createStart(() => {\n  return {\n    // Run AuthKit middleware on every request\n    requestMiddleware: [authkitMiddleware()],\n  };\n});\n"
  },
  {
    "path": "examples/react/start-workos/src/vite-env.d.ts",
    "content": "/// <reference types=\"vite/client\" />\n\ndeclare module '*.css?url' {\n  const url: string;\n  export default url;\n}\n"
  },
  {
    "path": "examples/react/start-workos/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"target\": \"ES2022\",\n    \"skipLibCheck\": true,\n    \"strictNullChecks\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/start-workos/vite.config.ts",
    "content": "import { defineConfig } from 'vite';\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite';\nimport viteReact from '@vitejs/plugin-react';\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tanstackStart(), viteReact()],\n  ssr: {\n    noExternal: ['@radix-ui/themes'],\n  },\n});\n"
  },
  {
    "path": "examples/react/view-transitions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/view-transitions/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/view-transitions/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/view-transitions/README.md",
    "content": "# TanStack Router - View Transitions Example\n\nAn example demonstrating view transitions for smooth page transitions.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/view-transitions view-transitions\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- View Transitions API integration\n- Smooth page transitions\n- Animated route changes\n- Enhanced user experience\n"
  },
  {
    "path": "examples/react/view-transitions/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/view-transitions/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-view-transitions\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  /* \n  Using defaultViewTransition would prevent the need to\n  manually add `viewTransition: true` to every navigation.\n\n  If defaultViewTransition.types is a function, it will be called with the\n  location change info and should return an array of view transition types.\n  This is useful if you want to have different view transitions depending on\n  the navigation's specifics.\n\n  An example use case is sliding in a direction based on the index of the\n  previous and next routes when navigating via browser history back and forth.\n  */\n  // defaultViewTransition: true\n  // OR\n  // defaultViewTransition: {\n  //   types: ({ fromLocation, toLocation }) => {\n  //     let direction = 'none'\n\n  //     if (fromLocation) {\n  //       const fromIndex = fromLocation.state.__TSR_index\n  //       const toIndex = toLocation.state.__TSR_index\n\n  //       direction = fromIndex > toIndex ? 'right' : 'left'\n  //     }\n\n  //     return [`slide-${direction}`]\n  //   },\n  // },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(<RouterProvider router={router} />)\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/react-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 0))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 0))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as HowItWorksRouteImport } from './routes/how-it-works'\nimport { Route as ExploreRouteImport } from './routes/explore'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst HowItWorksRoute = HowItWorksRouteImport.update({\n  id: '/how-it-works',\n  path: '/how-it-works',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ExploreRoute = ExploreRouteImport.update({\n  id: '/explore',\n  path: '/explore',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  ExploreRoute: typeof ExploreRoute\n  HowItWorksRoute: typeof HowItWorksRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/how-it-works': {\n      id: '/how-it-works'\n      path: '/how-it-works'\n      fullPath: '/how-it-works'\n      preLoaderRoute: typeof HowItWorksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/explore': {\n      id: '/explore'\n      path: '/explore'\n      fullPath: '/explore'\n      preLoaderRoute: typeof ExploreRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  ExploreRoute: ExploreRoute,\n  HowItWorksRoute: HowItWorksRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/view-transitions/src/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div className=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n          viewTransition\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            className: 'font-bold',\n          }}\n          viewTransition\n        >\n          Posts\n        </Link>{' '}\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/routes/explore.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/explore')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2 [view-transition-name:main-content]\">\n      <h3>\n        Explore the CSS to see how to use active-view-transition-type to create\n        new viewTransitions to use with Tanstack Router.\n      </h3>\n      <h4 className={'text-sm mt-2 italic'}>\n        Disclaimer: View Transition Types may not be supported in all browsers\n        and will fall back to the default browser transition if not available.\n      </h4>\n      <div className=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          className=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/routes/how-it-works.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/how-it-works')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div className=\"p-2 [view-transition-name:main-content]\">\n      <h3>This example demonstrates a variety of custom page transitions.</h3>\n      <div className=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          className=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n        <Link\n          to={'/explore'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          className=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2 [view-transition-name:main-content]\">\n      <h3>Welcome To The View Transitions Example!</h3>\n      <div className=\"flex justify-center mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          className=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { ErrorComponent } from '@tanstack/react-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/routes/posts.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\nimport { Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2  [view-transition-name:main-content]\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ className: 'font-bold underline' }}\n                  // see styles.css for 'warp' transition\n                  viewTransition={{ types: ['warp'] }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <div className=\"[view-transition-name:post]\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/view-transitions/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n\n/* Slide Left Transition */\nhtml:active-view-transition-type(slide-left) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-left;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-left;\n  }\n}\n\n@keyframes slide-out-left {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(-100%);\n  }\n}\n\n@keyframes slide-in-left {\n  from {\n    transform: translateX(100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Slide Right Transition */\nhtml:active-view-transition-type(slide-right) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-right;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-right;\n  }\n}\n\n@keyframes slide-out-right {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(100%);\n  }\n}\n\n@keyframes slide-in-right {\n  from {\n    transform: translateX(-100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Warp/Rotate Transition */\nhtml:active-view-transition-type(warp) {\n  &::view-transition-old(post) {\n    animation: 400ms ease-out both warp-out;\n  }\n\n  &::view-transition-new(post) {\n    animation: 400ms ease-out both warp-in;\n  }\n}\n\n@keyframes warp-out {\n  from {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n  to {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(1.1) rotate(90deg);\n  }\n}\n\n@keyframes warp-in {\n  from {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(0.9) rotate(-45deg);\n  }\n  to {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n}\n"
  },
  {
    "path": "examples/react/view-transitions/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/view-transitions/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n"
  },
  {
    "path": "examples/react/with-framer-motion/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/with-framer-motion/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/react/with-framer-motion/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/with-framer-motion/README.md",
    "content": "# TanStack Router - Framer Motion Integration Example\n\nAn example demonstrating integration with Framer Motion for animations.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [Framer Motion Documentation](https://www.framer.com/motion/)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/with-framer-motion with-framer-motion\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- Framer Motion integration\n- Animated route transitions\n- Page animations\n- Gesture-based navigation\n- Advanced animation patterns\n"
  },
  {
    "path": "examples/react/with-framer-motion/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/with-framer-motion/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-with-framer-motion\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"framer-motion\": \"^11.18.2\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/with-framer-motion/src/main.tsx",
    "content": "import * as React from 'react'\nimport * as ReactDOM from 'react-dom/client'\nimport { AnimatePresence, motion } from 'framer-motion'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useMatch,\n  useMatches,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport axios from 'redaxios'\nimport './styles.css'\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n\nexport const mainTransitionProps = {\n  initial: { y: -20, opacity: 0, position: 'absolute' },\n  animate: { y: 0, opacity: 1, damping: 5 },\n  exit: { y: 60, opacity: 0 },\n  transition: {\n    type: 'spring',\n    stiffness: 150,\n    damping: 10,\n  },\n} as const\n\nexport const postTransitionProps = {\n  initial: { y: -20, opacity: 0 },\n  animate: { y: 0, opacity: 1, damping: 5 },\n  exit: { y: 60, opacity: 0 },\n  transition: {\n    type: 'spring',\n    stiffness: 150,\n    damping: 10,\n  },\n} as const\n\nconst rootRoute = createRootRoute({\n  component: () => {\n    const matches = useMatches()\n    const match = useMatch({ strict: false })\n    const nextMatchIndex = matches.findIndex((d) => d.id === match.id) + 1\n    const nextMatch = matches[nextMatchIndex]\n\n    return (\n      <>\n        <div className=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              className: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n        </div>\n        <hr />\n        <AnimatePresence mode=\"wait\">\n          <Outlet key={nextMatch.id} />\n        </AnimatePresence>\n        {/* Start rendering router matches */}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </>\n    )\n  },\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: () => {\n    return (\n      <motion.div className=\"p-2\" {...mainTransitionProps}>\n        <h3>Welcome Home!</h3>\n      </motion.div>\n    )\n  },\n})\n\nconst postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n  component: () => {\n    const posts = postsLayoutRoute.useLoaderData()\n    return (\n      <motion.div className=\"p-2 flex gap-2\" {...mainTransitionProps}>\n        <ul className=\"list-disc pl-4\">\n          {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n            (post) => {\n              return (\n                <li key={post.id} className=\"whitespace-nowrap\">\n                  <Link\n                    to={postRoute.to}\n                    params={{\n                      postId: post.id,\n                    }}\n                    className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                    activeProps={{ className: 'text-black font-bold' }}\n                  >\n                    <div>{post.title.substring(0, 20)}</div>\n                  </Link>\n                </li>\n              )\n            },\n          )}\n        </ul>\n        <hr />\n        <AnimatePresence>\n          <Outlet />\n        </AnimatePresence>\n      </motion.div>\n    )\n  },\n})\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: () => <div>Select a post.</div>,\n})\n\nclass NotFoundError extends Error {}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  loader: ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: ErrorComponent,\n  component: () => {\n    const post = postRoute.useLoaderData()\n    return (\n      <motion.div className=\"space-y-2\" {...postTransitionProps}>\n        <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n        <div className=\"text-sm\">{post.body}</div>\n      </motion.div>\n    )\n  },\n})\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  context: {\n    // loaderClient,\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n\n  root.render(\n    <React.StrictMode>\n      <RouterProvider router={router} />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/with-framer-motion/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/with-framer-motion/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"]\n  }\n}\n"
  },
  {
    "path": "examples/react/with-framer-motion/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), react()],\n})\n"
  },
  {
    "path": "examples/react/with-trpc/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/with-trpc/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/with-trpc/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/with-trpc/README.md",
    "content": "# TanStack Router - tRPC Integration Example\n\nAn example demonstrating integration with tRPC for type-safe APIs.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [tRPC Documentation](https://trpc.io)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/with-trpc with-trpc\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- tRPC integration with TanStack Router\n- Type-safe API calls\n- End-to-end type safety\n- Server and client setup\n- Procedure definitions\n"
  },
  {
    "path": "examples/react/with-trpc/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/with-trpc/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-with-trpc\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"pnpm tsx ./src/server/server.ts --watch\",\n    \"build\": \"pnpm run build:server && pnpm run build:client\",\n    \"build:client\": \"vite build && tsc --noEmit\",\n    \"build:server\": \"vite build --mode server\",\n    \"start\": \"NODE_ENV=production node dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@trpc/client\": \"^11.4.3\",\n    \"@trpc/server\": \"^11.4.3\",\n    \"express\": \"^4.21.2\",\n    \"react\": \"^19.1.0\",\n    \"react-dom\": \"^19.1.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/express\": \"^4.17.23\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tsx\": \"^4.20.3\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { trpc } from './trpc'\n\nimport { Spinner } from './routes/-components/spinner'\nimport './styles.css'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a router instance\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  defaultPendingComponent: () => (\n    <div className={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  context: {\n    trpc,\n  },\n})\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('root')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <RouterProvider router={router} />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as DashboardRouteImport } from './routes/dashboard'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as DashboardIndexRouteImport } from './routes/dashboard.index'\nimport { Route as DashboardPostsRouteImport } from './routes/dashboard.posts'\nimport { Route as DashboardPostsIndexRouteImport } from './routes/dashboard.posts.index'\nimport { Route as DashboardPostsPostIdRouteImport } from './routes/dashboard.posts.$postId'\n\nconst DashboardRoute = DashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardIndexRoute = DashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardRoute,\n} as any)\nconst DashboardPostsRoute = DashboardPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => DashboardRoute,\n} as any)\nconst DashboardPostsIndexRoute = DashboardPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardPostsRoute,\n} as any)\nconst DashboardPostsPostIdRoute = DashboardPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => DashboardPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteWithChildren\n  '/dashboard/posts': typeof DashboardPostsRouteWithChildren\n  '/dashboard/': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts/': typeof DashboardPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts': typeof DashboardPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteWithChildren\n  '/dashboard/posts': typeof DashboardPostsRouteWithChildren\n  '/dashboard/': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts/': typeof DashboardPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/dashboard'\n    | '/dashboard/posts'\n    | '/dashboard/'\n    | '/dashboard/posts/$postId'\n    | '/dashboard/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/dashboard' | '/dashboard/posts/$postId' | '/dashboard/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/dashboard'\n    | '/dashboard/posts'\n    | '/dashboard/'\n    | '/dashboard/posts/$postId'\n    | '/dashboard/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DashboardRoute: typeof DashboardRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardIndexRouteImport\n      parentRoute: typeof DashboardRoute\n    }\n    '/dashboard/posts': {\n      id: '/dashboard/posts'\n      path: '/posts'\n      fullPath: '/dashboard/posts'\n      preLoaderRoute: typeof DashboardPostsRouteImport\n      parentRoute: typeof DashboardRoute\n    }\n    '/dashboard/posts/': {\n      id: '/dashboard/posts/'\n      path: '/'\n      fullPath: '/dashboard/posts/'\n      preLoaderRoute: typeof DashboardPostsIndexRouteImport\n      parentRoute: typeof DashboardPostsRoute\n    }\n    '/dashboard/posts/$postId': {\n      id: '/dashboard/posts/$postId'\n      path: '/$postId'\n      fullPath: '/dashboard/posts/$postId'\n      preLoaderRoute: typeof DashboardPostsPostIdRouteImport\n      parentRoute: typeof DashboardPostsRoute\n    }\n  }\n}\n\ninterface DashboardPostsRouteChildren {\n  DashboardPostsPostIdRoute: typeof DashboardPostsPostIdRoute\n  DashboardPostsIndexRoute: typeof DashboardPostsIndexRoute\n}\n\nconst DashboardPostsRouteChildren: DashboardPostsRouteChildren = {\n  DashboardPostsPostIdRoute: DashboardPostsPostIdRoute,\n  DashboardPostsIndexRoute: DashboardPostsIndexRoute,\n}\n\nconst DashboardPostsRouteWithChildren = DashboardPostsRoute._addFileChildren(\n  DashboardPostsRouteChildren,\n)\n\ninterface DashboardRouteChildren {\n  DashboardPostsRoute: typeof DashboardPostsRouteWithChildren\n  DashboardIndexRoute: typeof DashboardIndexRoute\n}\n\nconst DashboardRouteChildren: DashboardRouteChildren = {\n  DashboardPostsRoute: DashboardPostsRouteWithChildren,\n  DashboardIndexRoute: DashboardIndexRoute,\n}\n\nconst DashboardRouteWithChildren = DashboardRoute._addFileChildren(\n  DashboardRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DashboardRoute: DashboardRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/with-trpc/src/routes/-components/spinner.tsx",
    "content": "import * as React from 'react'\n\nexport function Spinner() {\n  return <div className=\"inline-block animate-spin px-3\">⍥</div>\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/routes/__root.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nimport { Spinner } from './-components/spinner'\nimport type { trpc } from '../trpc'\n\nexport interface RouterAppContext {\n  trpc: typeof trpc\n}\n\nexport const Route = createRootRouteWithContext<RouterAppContext>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const isFetching = useRouterState({ select: (s) => s.isLoading })\n\n  return (\n    <>\n      <div className={`min-h-screen flex flex-col`}>\n        <div className={`flex items-center border-b gap-2`}>\n          <h1 className={`text-3xl p-2`}>With tRPC</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div\n            className={`text-3xl duration-300 delay-0 opacity-0 ${\n              isFetching ? ` duration-1000 opacity-40` : ''\n            }`}\n          >\n            <Spinner />\n          </div>\n        </div>\n        <div className={`flex-1 flex`}>\n          <div className={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div key={to}>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    className={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ className: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div className={`flex-1 border-l border-gray-200`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/routes/dashboard.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/')({\n  loader: ({ context: { trpc } }) => trpc.posts.query(),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{posts.length} total posts</strong>.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/routes/dashboard.posts.$postId.tsx",
    "content": "import * as React from 'react'\nimport { Link, createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/dashboard/posts/$postId')({\n  validateSearch: z.object({\n    showNotes: z.boolean().optional(),\n    notes: z.string().optional(),\n  }),\n  loader: async ({ context: { trpc }, params: { postId } }) =>\n    trpc.post.query(postId),\n  component: DashboardPostsPostIdComponent,\n})\n\nfunction DashboardPostsPostIdComponent() {\n  const post = Route.useLoaderData()\n  const search = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  const [notes, setNotes] = React.useState(search.notes ?? ``)\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => ({ ...old, notes: notes ? notes : undefined }),\n      replace: true,\n      params: true,\n    })\n  }, [notes])\n\n  if (!post) {\n    return <div>Post not found</div>\n  }\n\n  return (\n    <div className=\"p-2 space-y-2\" key={post.id}>\n      <div className=\"space-y-2\">\n        <h2 className=\"font-bold text-lg\">\n          <input\n            defaultValue={post.id}\n            className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n            disabled\n          />\n        </h2>\n        <div>\n          <textarea\n            defaultValue={post.title}\n            rows={6}\n            className=\"border border-opacity-50 p-2 rounded-sm w-full\"\n            disabled\n          />\n        </div>\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          params={true}\n          className=\"text-blue-700\"\n        >\n          {search.showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search.showNotes ? (\n          <>\n            <div>\n              <div className=\"h-2\" />\n              <textarea\n                value={notes}\n                onChange={(e) => setNotes(e.target.value)}\n                rows={5}\n                className=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div className=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/routes/dashboard.posts.index.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/posts/')({\n  component: DashboardPostsIndexComponent,\n})\n\nfunction DashboardPostsIndexComponent() {\n  return <div className=\"p-2\">Select a post to view.</div>\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/routes/dashboard.posts.tsx",
    "content": "import * as React from 'react'\nimport {\n  Link,\n  MatchRoute,\n  Outlet,\n  createFileRoute,\n} from '@tanstack/react-router'\n\nimport { Spinner } from './-components/spinner'\n\nexport const Route = createFileRoute('/dashboard/posts')({\n  loader: ({ context: { trpc } }) => trpc.posts.query(),\n  component: DashboardPostsComponent,\n})\n\nfunction DashboardPostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y w-48\">\n        {posts.map((post) => {\n          return (\n            <div key={post.id}>\n              <Link\n                to=\"/dashboard/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                preload=\"intent\"\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  #{post.id} - {post.title.slice(0, 10)}{' '}\n                  <MatchRoute\n                    to=\"/dashboard/posts/$postId\"\n                    params={{\n                      postId: post.id,\n                    }}\n                    pending\n                  >\n                    <Spinner />\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex-1 border-l border-gray-200\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/routes/dashboard.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  return (\n    <>\n      <div className=\"flex items-center border-b\">\n        <h2 className=\"text-xl p-2\">Dashboard</h2>\n        <Link\n          to=\"/dashboard/posts/$postId\"\n          params={{\n            postId: '3',\n          }}\n          className=\"py-1 px-2 text-xs bg-blue-500 text-white rounded-full\"\n        >\n          1 New Invoice\n        </Link>\n      </div>\n      <div className=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['.', 'Summary'],\n            ['/dashboard/posts', 'Posts'],\n          ] as const\n        ).map(([to, label]) => {\n          return (\n            <Link\n              from={Route.fullPath}\n              key={to}\n              to={to}\n              activeOptions={{ exact: to === '.' }}\n              activeProps={{ className: `font-bold` }}\n              className=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/routes/index.tsx",
    "content": "import * as React from 'react'\nimport { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className={`p-2`}>\n      <div className={`text-lg`}>Welcome Home!</div>\n      <hr className={`my-2`} />\n      <Link\n        to=\"/dashboard/posts/$postId\"\n        params={{\n          postId: '3',\n        }}\n        className={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr className={`my-2`} />\n      <div className={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/server/server.ts",
    "content": "import path from 'node:path'\nimport url from 'node:url'\nimport * as fs from 'node:fs'\nimport express from 'express'\nimport { trpcMiddleWare } from './trpc'\n\nconst PORT =\n  typeof process.env.PORT !== 'undefined'\n    ? parseInt(process.env.PORT, 10)\n    : 3000\nconst HMR_PORT =\n  typeof process.env.HMR_PORT !== 'undefined'\n    ? parseInt(process.env.HMR_PORT, 10)\n    : 3001\n\nconst isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport const createServer = async (\n  root = process.cwd(),\n  isProd = process.env.NODE_ENV === 'production',\n) => {\n  const app = express()\n\n  app.use('/trpc', trpcMiddleWare as any)\n\n  if (!isProd) {\n    const vite = await import('vite')\n    const viteServer = await vite.createServer({\n      root,\n      logLevel: isTest ? 'error' : 'info',\n      server: {\n        middlewareMode: true,\n        watch: {\n          // During tests we edit the files too fast and sometimes chokidar\n          // misses change events, so enforce polling for consistency\n          usePolling: true,\n          interval: 100,\n        },\n        hmr: {\n          port: HMR_PORT,\n        },\n      },\n      appType: 'custom',\n    })\n\n    // Use vite's connect instance as middleware\n    app.use(viteServer.middlewares)\n\n    // Handle any requests that don't match an API route by serving the React app's index.html\n    app.get('*', async (req, res, next) => {\n      try {\n        let html = fs.readFileSync(path.resolve(root, 'index.html'), 'utf-8')\n\n        // Transform HTML using Vite plugins.\n        html = await viteServer.transformIndexHtml(req.url, html)\n\n        res.send(html)\n      } catch (e) {\n        return next(e)\n      }\n    })\n\n    return { app }\n  } else {\n    app.use(express.static(path.resolve(__dirname, '../client')))\n\n    // Handle any requests that don't match an API route by serving the React app's index.html\n    app.get('*', (req, res) => {\n      res.sendFile(path.resolve(__dirname, '../client', 'index.html'))\n    })\n  }\n\n  return { app }\n}\n\nif (!isTest) {\n  createServer().then(({ app }) =>\n    app.listen(PORT, () => {\n      console.info(`Server available at: http://localhost:${PORT}`)\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/server/trpc.ts",
    "content": "import { initTRPC } from '@trpc/server'\nimport { createExpressMiddleware } from '@trpc/server/adapters/express'\nimport type { CreateExpressContextOptions } from '@trpc/server/adapters/express'\n\nconst createTRPContext = ({ req, res }: CreateExpressContextOptions) => ({})\n\ntype TRPCContext = Awaited<ReturnType<typeof createTRPContext>>\n\nconst t = initTRPC.context<TRPCContext>().create()\n\nconst POSTS = [\n  { id: '1', title: 'First post' },\n  { id: '2', title: 'Second post' },\n  { id: '3', title: 'Third post' },\n  { id: '4', title: 'Fourth post' },\n  { id: '5', title: 'Fifth post' },\n  { id: '6', title: 'Sixth post' },\n  { id: '7', title: 'Seventh post' },\n  { id: '8', title: 'Eighth post' },\n  { id: '9', title: 'Ninth post' },\n  { id: '10', title: 'Tenth post' },\n]\n\nexport const appRouter = t.router({\n  hello: t.procedure.query(() => 'Hello world!'),\n  posts: t.procedure.query(async (_) => {\n    await new Promise((resolve) => setTimeout(resolve, 1000))\n    return POSTS\n  }),\n  post: t.procedure.input(String).query(async (req) => {\n    await new Promise((resolve) => setTimeout(resolve, 500))\n    return POSTS.find((p) => p.id === req.input)\n  }),\n})\n\nexport const trpcMiddleWare = createExpressMiddleware({\n  router: appRouter,\n  createContext: createTRPContext,\n})\n\nexport type AppRouter = typeof appRouter\n"
  },
  {
    "path": "examples/react/with-trpc/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/with-trpc/src/trpc.ts",
    "content": "import { createTRPCClient, httpBatchLink } from '@trpc/client'\nimport type { AppRouter } from './server/trpc'\n\nexport const trpc = createTRPCClient<AppRouter>({\n  links: [\n    httpBatchLink({\n      // since we are using Vite, the server is running on the same port,\n      // this means in dev the url is `http://localhost:3000/trpc`\n      // and since its from the same origin, we don't need to explicitly set the full URL\n      url: '/trpc',\n    }),\n  ],\n})\n"
  },
  {
    "path": "examples/react/with-trpc/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ES2022\",\n    \"module\": \"ES2022\",\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"types\": [\"node\", \"vite/client\"]\n  },\n  \"include\": [\"src\", \"vite.config.ts\", \"tsup.config.ts\"]\n}\n"
  },
  {
    "path": "examples/react/with-trpc/vite.config.ts",
    "content": "import url from 'node:url'\nimport path from 'node:path'\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport type { BuildEnvironmentOptions } from 'vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\n// Client Build Configuration\nconst clientBuildConfig: BuildEnvironmentOptions = {\n  outDir: 'dist/client',\n  emitAssets: true,\n  copyPublicDir: true,\n  emptyOutDir: true,\n}\n\n// Server Build Configuration\nconst serverBuildConfig: BuildEnvironmentOptions = {\n  ssr: true,\n  outDir: 'dist/server',\n  copyPublicDir: false,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/server/server.ts'),\n    output: {\n      entryFileNames: '[name].js',\n      chunkFileNames: 'assets/[name]-[hash].js',\n      assetFileNames: 'assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// https://vitejs.dev/config/\nexport default defineConfig((configEnv) => {\n  return {\n    plugins: [\n      tailwindcss(),\n      tanstackRouter({\n        target: 'react',\n        autoCodeSplitting: true,\n      }),\n      react(),\n    ],\n    build: configEnv.mode === 'server' ? serverBuildConfig : clientBuildConfig,\n  }\n})\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/README.md",
    "content": "# TanStack Router - tRPC with React Query Example\n\nAn example demonstrating integration of tRPC with TanStack Query.\n\n- [TanStack Router Docs](https://tanstack.com/router)\n- [tRPC Documentation](https://trpc.io)\n- [TanStack Query Docs](https://tanstack.com/query)\n\n## Start a new project based on this example\n\nTo start a new project based on this example, run:\n\n```sh\nnpx gitpick TanStack/router/tree/main/examples/react/with-trpc-react-query with-trpc-react-query\n```\n\n## Getting Started\n\nInstall dependencies:\n\n```sh\npnpm install\n```\n\nStart the development server:\n\n```sh\npnpm dev\n```\n\n## Build\n\nBuild for production:\n\n```sh\npnpm build\n```\n\n## About This Example\n\nThis example demonstrates:\n\n- tRPC integration with TanStack Router\n- TanStack Query for data fetching\n- Type-safe API calls with caching\n- End-to-end type safety\n- Optimistic updates\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/package.json",
    "content": "{\n  \"name\": \"tanstack-router-react-example-with-trpc-react-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"pnpm tsx ./src/server/server.ts --watch\",\n    \"build\": \"pnpm run build:server && pnpm run build:client\",\n    \"build:client\": \"vite build && tsc --noEmit\",\n    \"build:server\": \"vite build --mode server\",\n    \"start\": \"NODE_ENV=production node dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/react-query\": \"^5.90.0\",\n    \"@tanstack/react-query-devtools\": \"^5.90.0\",\n    \"@tanstack/react-router\": \"^1.168.1\",\n    \"@tanstack/react-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@trpc/client\": \"^11.4.3\",\n    \"@trpc/server\": \"^11.4.3\",\n    \"@trpc/tanstack-react-query\": \"^11.4.3\",\n    \"express\": \"^4.21.2\",\n    \"react\": \"^19.1.0\",\n    \"react-dom\": \"^19.1.0\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/express\": \"^4.17.23\",\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"tsx\": \"^4.20.3\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/main.tsx",
    "content": "import React from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider } from '@tanstack/react-router'\n\nimport './styles.css'\n\nimport { createRouter } from './router'\n\n// Set up a Router instance\nconst router = createRouter()\n\nconst rootElement = document.getElementById('root')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <React.StrictMode>\n      <RouterProvider router={router} />\n    </React.StrictMode>,\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as DashboardRouteImport } from './routes/dashboard'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as DashboardIndexRouteImport } from './routes/dashboard.index'\nimport { Route as DashboardPostsRouteImport } from './routes/dashboard.posts'\nimport { Route as DashboardPostsIndexRouteImport } from './routes/dashboard.posts.index'\nimport { Route as DashboardPostsPostIdRouteImport } from './routes/dashboard.posts.$postId'\n\nconst DashboardRoute = DashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardIndexRoute = DashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardRoute,\n} as any)\nconst DashboardPostsRoute = DashboardPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => DashboardRoute,\n} as any)\nconst DashboardPostsIndexRoute = DashboardPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardPostsRoute,\n} as any)\nconst DashboardPostsPostIdRoute = DashboardPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => DashboardPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteWithChildren\n  '/dashboard/posts': typeof DashboardPostsRouteWithChildren\n  '/dashboard/': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts/': typeof DashboardPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts': typeof DashboardPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteWithChildren\n  '/dashboard/posts': typeof DashboardPostsRouteWithChildren\n  '/dashboard/': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts/': typeof DashboardPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/dashboard'\n    | '/dashboard/posts'\n    | '/dashboard/'\n    | '/dashboard/posts/$postId'\n    | '/dashboard/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/dashboard' | '/dashboard/posts/$postId' | '/dashboard/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/dashboard'\n    | '/dashboard/posts'\n    | '/dashboard/'\n    | '/dashboard/posts/$postId'\n    | '/dashboard/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DashboardRoute: typeof DashboardRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardIndexRouteImport\n      parentRoute: typeof DashboardRoute\n    }\n    '/dashboard/posts': {\n      id: '/dashboard/posts'\n      path: '/posts'\n      fullPath: '/dashboard/posts'\n      preLoaderRoute: typeof DashboardPostsRouteImport\n      parentRoute: typeof DashboardRoute\n    }\n    '/dashboard/posts/': {\n      id: '/dashboard/posts/'\n      path: '/'\n      fullPath: '/dashboard/posts/'\n      preLoaderRoute: typeof DashboardPostsIndexRouteImport\n      parentRoute: typeof DashboardPostsRoute\n    }\n    '/dashboard/posts/$postId': {\n      id: '/dashboard/posts/$postId'\n      path: '/$postId'\n      fullPath: '/dashboard/posts/$postId'\n      preLoaderRoute: typeof DashboardPostsPostIdRouteImport\n      parentRoute: typeof DashboardPostsRoute\n    }\n  }\n}\n\ninterface DashboardPostsRouteChildren {\n  DashboardPostsPostIdRoute: typeof DashboardPostsPostIdRoute\n  DashboardPostsIndexRoute: typeof DashboardPostsIndexRoute\n}\n\nconst DashboardPostsRouteChildren: DashboardPostsRouteChildren = {\n  DashboardPostsPostIdRoute: DashboardPostsPostIdRoute,\n  DashboardPostsIndexRoute: DashboardPostsIndexRoute,\n}\n\nconst DashboardPostsRouteWithChildren = DashboardPostsRoute._addFileChildren(\n  DashboardPostsRouteChildren,\n)\n\ninterface DashboardRouteChildren {\n  DashboardPostsRoute: typeof DashboardPostsRouteWithChildren\n  DashboardIndexRoute: typeof DashboardIndexRoute\n}\n\nconst DashboardRouteChildren: DashboardRouteChildren = {\n  DashboardPostsRoute: DashboardPostsRouteWithChildren,\n  DashboardIndexRoute: DashboardIndexRoute,\n}\n\nconst DashboardRouteWithChildren = DashboardRoute._addFileChildren(\n  DashboardRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DashboardRoute: DashboardRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/router.tsx",
    "content": "import { createRouter as createTanStackRouter } from '@tanstack/react-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { createTRPCClient, httpBatchLink } from '@trpc/client'\nimport { createTRPCOptionsProxy } from '@trpc/tanstack-react-query'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\nimport { Spinner } from './routes/-components/spinner'\nimport type { AppRouter } from './server/trpc'\n\nexport const queryClient = new QueryClient()\n\nexport const trpc = createTRPCOptionsProxy<AppRouter>({\n  client: createTRPCClient({\n    links: [\n      httpBatchLink({\n        // since we are using Vite, the server is running on the same port,\n        // this means in dev the url is `http://localhost:3000/trpc`\n        // and since its from the same origin, we don't need to explicitly set the full URL\n        url: '/trpc',\n      }),\n    ],\n  }),\n  queryClient,\n})\n\nexport function createRouter() {\n  const router = createTanStackRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreload: 'intent',\n    context: {\n      trpc,\n      queryClient,\n    },\n    defaultPendingComponent: () => (\n      <div className={`p-2 text-2xl`}>\n        <Spinner />\n      </div>\n    ),\n    Wrap: function WrapComponent({ children }) {\n      return (\n        <QueryClientProvider client={queryClient}>\n          {children}\n        </QueryClientProvider>\n      )\n    },\n  })\n\n  return router\n}\n\n// Register the router instance for type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routes/-components/spinner.tsx",
    "content": "import * as React from 'react'\n\nexport function Spinner() {\n  return <div className=\"inline-block animate-spin px-3\">⍥</div>\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routes/__root.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n  useRouterState,\n} from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nimport { ReactQueryDevtools } from '@tanstack/react-query-devtools'\n\nimport { Spinner } from './-components/spinner'\nimport type { TRPCOptionsProxy } from '@trpc/tanstack-react-query'\nimport type { AppRouter } from '../server/trpc'\nimport type { QueryClient } from '@tanstack/react-query'\n\nexport interface RouterAppContext {\n  trpc: TRPCOptionsProxy<AppRouter>\n  queryClient: QueryClient\n}\n\nexport const Route = createRootRouteWithContext<RouterAppContext>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const isFetching = useRouterState({ select: (s) => s.isLoading })\n\n  return (\n    <>\n      <div className={`min-h-screen flex flex-col`}>\n        <div className={`flex items-center border-b gap-2`}>\n          <h1 className={`text-3xl p-2`}>With tRPC + TanStack Query</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div\n            className={`text-3xl duration-300 delay-0 opacity-0 ${\n              isFetching ? ` duration-1000 opacity-40` : ''\n            }`}\n          >\n            <Spinner />\n          </div>\n        </div>\n        <div className={`flex-1 flex`}>\n          <div className={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div key={to}>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    className={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ className: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div className={`flex-1 border-l border-gray-200`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <TanStackRouterDevtools position=\"bottom-left\" />\n      <ReactQueryDevtools position=\"bottom\" buttonPosition=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routes/dashboard.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { useQuery } from '@tanstack/react-query'\nimport { trpc } from '../router'\n\nexport const Route = createFileRoute('/dashboard/')({\n  loader: async ({ context: { trpc, queryClient } }) => {\n    await queryClient.ensureQueryData(trpc.posts.queryOptions())\n    return\n  },\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const postsQuery = useQuery(trpc.posts.queryOptions())\n\n  const posts = postsQuery.data || []\n\n  return (\n    <div className=\"p-2\">\n      <div className=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{posts.length} total posts</strong>.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routes/dashboard.posts.$postId.tsx",
    "content": "import * as React from 'react'\nimport { Link, createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\nimport { useQuery } from '@tanstack/react-query'\nimport { trpc } from '../router'\nimport { Spinner } from './-components/spinner'\n\nexport const Route = createFileRoute('/dashboard/posts/$postId')({\n  validateSearch: z.object({\n    showNotes: z.boolean().optional(),\n    notes: z.string().optional(),\n  }),\n  loader: async ({ context: { trpc, queryClient }, params: { postId } }) => {\n    await queryClient.ensureQueryData(trpc.post.queryOptions(postId))\n  },\n  pendingComponent: Spinner,\n  component: DashboardPostsPostIdComponent,\n})\n\nfunction DashboardPostsPostIdComponent() {\n  const postId = Route.useParams({ select: (d) => d.postId })\n\n  const postQuery = useQuery(trpc.post.queryOptions(postId))\n  const post = postQuery.data\n\n  const search = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  const [notes, setNotes] = React.useState(search.notes ?? ``)\n\n  React.useEffect(() => {\n    navigate({\n      search: (old) => ({ ...old, notes: notes ? notes : undefined }),\n      replace: true,\n      params: true,\n    })\n  }, [notes])\n\n  if (!post) {\n    return <div>Post not found</div>\n  }\n\n  return (\n    <div className=\"p-2 space-y-2\" key={post.id}>\n      <div className=\"space-y-2\">\n        <h2 className=\"font-bold text-lg\">\n          <input\n            defaultValue={post.id}\n            className=\"border border-opacity-50 rounded-sm p-2 w-full\"\n            disabled\n          />\n        </h2>\n        <div>\n          <textarea\n            defaultValue={post.title}\n            rows={6}\n            className=\"border border-opacity-50 p-2 rounded-sm w-full\"\n            disabled\n          />\n        </div>\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          params={true}\n          className=\"text-blue-700\"\n        >\n          {search.showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search.showNotes ? (\n          <>\n            <div>\n              <div className=\"h-2\" />\n              <textarea\n                value={notes}\n                onChange={(e) => setNotes(e.target.value)}\n                rows={5}\n                className=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div className=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routes/dashboard.posts.index.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/posts/')({\n  component: DashboardPostsIndexComponent,\n})\n\nfunction DashboardPostsIndexComponent() {\n  return <div className=\"p-2\">Select a post to view.</div>\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routes/dashboard.posts.tsx",
    "content": "import * as React from 'react'\nimport {\n  Link,\n  MatchRoute,\n  Outlet,\n  createFileRoute,\n} from '@tanstack/react-router'\nimport { useQuery } from '@tanstack/react-query'\nimport { trpc } from '../router'\nimport { Spinner } from './-components/spinner'\n\nexport const Route = createFileRoute('/dashboard/posts')({\n  errorComponent: () => 'Oh crap!',\n  loader: async ({ context: { trpc, queryClient } }) => {\n    await queryClient.ensureQueryData(trpc.posts.queryOptions())\n    return\n  },\n  pendingComponent: Spinner,\n  component: DashboardPostsComponent,\n})\n\nfunction DashboardPostsComponent() {\n  const postsQuery = useQuery(trpc.posts.queryOptions())\n\n  const posts = postsQuery.data || []\n\n  return (\n    <div className=\"flex-1 flex\">\n      <div className=\"divide-y w-48\">\n        {posts.map((post) => {\n          return (\n            <div key={post.id}>\n              <Link\n                to=\"/dashboard/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                preload=\"intent\"\n                className=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ className: `font-bold` }}\n              >\n                <pre className=\"text-sm\">\n                  #{post.id} - {post.title}{' '}\n                  <MatchRoute\n                    to=\"/dashboard/posts/$postId\"\n                    params={{\n                      postId: post.id,\n                    }}\n                    pending\n                  >\n                    <Spinner />\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex-1 border-l border-gray-200\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routes/dashboard.tsx",
    "content": "import * as React from 'react'\nimport { Link, Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  return (\n    <>\n      <div className=\"flex items-center border-b\">\n        <h2 className=\"text-xl p-2\">Dashboard</h2>\n        <Link\n          to=\"/dashboard/posts/$postId\"\n          params={{\n            postId: '3',\n          }}\n          className=\"py-1 px-2 text-xs bg-blue-500 text-white rounded-full\"\n        >\n          1 New Invoice\n        </Link>\n      </div>\n      <div className=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['.', 'Summary'],\n            ['/dashboard/posts', 'Posts'],\n          ] as const\n        ).map(([to, label]) => {\n          return (\n            <Link\n              from={Route.fullPath}\n              key={to}\n              to={to}\n              activeOptions={{ exact: to === '.' }}\n              activeProps={{ className: `font-bold` }}\n              className=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/routes/index.tsx",
    "content": "import * as React from 'react'\nimport { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div className={`p-2`}>\n      <div className={`text-lg`}>Welcome Home!</div>\n      <hr className={`my-2`} />\n      <Link\n        to=\"/dashboard/posts/$postId\"\n        params={{\n          postId: '3',\n        }}\n        className={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr className={`my-2`} />\n      <div className={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr className={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr className={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/server/server.ts",
    "content": "import path from 'node:path'\nimport url from 'node:url'\nimport * as fs from 'node:fs'\nimport express from 'express'\nimport { trpcMiddleWare } from './trpc'\n\nconst PORT =\n  typeof process.env.PORT !== 'undefined'\n    ? parseInt(process.env.PORT, 10)\n    : 3000\nconst HMR_PORT =\n  typeof process.env.HMR_PORT !== 'undefined'\n    ? parseInt(process.env.HMR_PORT, 10)\n    : 3001\n\nconst isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport const createServer = async (\n  root = process.cwd(),\n  isProd = process.env.NODE_ENV === 'production',\n) => {\n  const app = express()\n\n  app.use('/trpc', trpcMiddleWare as any)\n\n  if (!isProd) {\n    const vite = await import('vite')\n    const viteServer = await vite.createServer({\n      root,\n      logLevel: isTest ? 'error' : 'info',\n      server: {\n        middlewareMode: true,\n        watch: {\n          // During tests we edit the files too fast and sometimes chokidar\n          // misses change events, so enforce polling for consistency\n          usePolling: true,\n          interval: 100,\n        },\n        hmr: {\n          port: HMR_PORT,\n        },\n      },\n      appType: 'custom',\n    })\n\n    // Use vite's connect instance as middleware\n    app.use(viteServer.middlewares)\n\n    // Handle any requests that don't match an API route by serving the React app's index.html\n    app.get('*', async (req, res, next) => {\n      try {\n        let html = fs.readFileSync(path.resolve(root, 'index.html'), 'utf-8')\n\n        // Transform HTML using Vite plugins.\n        html = await viteServer.transformIndexHtml(req.url, html)\n\n        res.send(html)\n      } catch (e) {\n        return next(e)\n      }\n    })\n\n    return { app }\n  } else {\n    app.use(express.static(path.resolve(__dirname, '../client')))\n\n    // Handle any requests that don't match an API route by serving the React app's index.html\n    app.get('*', (req, res) => {\n      res.sendFile(path.resolve(__dirname, '../client', 'index.html'))\n    })\n  }\n\n  return { app }\n}\n\nif (!isTest) {\n  createServer().then(({ app }) =>\n    app.listen(PORT, () => {\n      console.info(`Server available at: http://localhost:${PORT}`)\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/server/trpc.ts",
    "content": "import { initTRPC } from '@trpc/server'\nimport { createExpressMiddleware } from '@trpc/server/adapters/express'\nimport type { CreateExpressContextOptions } from '@trpc/server/adapters/express'\n\nconst createTRPContext = ({ req, res }: CreateExpressContextOptions) => ({})\n\ntype TRPCContext = Awaited<ReturnType<typeof createTRPContext>>\n\nconst t = initTRPC.context<TRPCContext>().create()\n\nconst POSTS = [\n  { id: '1', title: 'First post' },\n  { id: '2', title: 'Second post' },\n  { id: '3', title: 'Third post' },\n  { id: '4', title: 'Fourth post' },\n  { id: '5', title: 'Fifth post' },\n  { id: '6', title: 'Sixth post' },\n  { id: '7', title: 'Seventh post' },\n  { id: '8', title: 'Eighth post' },\n  { id: '9', title: 'Ninth post' },\n  { id: '10', title: 'Tenth post' },\n]\n\nexport const appRouter = t.router({\n  hello: t.procedure.query(() => 'Hello world!'),\n  posts: t.procedure.query(async (_) => {\n    await new Promise((resolve) => setTimeout(resolve, 1000))\n    return POSTS\n  }),\n  post: t.procedure.input(String).query(async (req) => {\n    await new Promise((resolve) => setTimeout(resolve, 500))\n    return POSTS.find((p) => p.id === req.input)\n  }),\n})\n\nexport const trpcMiddleWare = createExpressMiddleware({\n  router: appRouter,\n  createContext: createTRPContext,\n})\n\nexport type AppRouter = typeof appRouter\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"react-jsx\",\n    \"target\": \"ES2022\",\n    \"module\": \"ES2022\",\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"types\": [\"node\", \"vite/client\"]\n  },\n  \"include\": [\"src\", \"vite.config.ts\", \"tsup.config.ts\"]\n}\n"
  },
  {
    "path": "examples/react/with-trpc-react-query/vite.config.ts",
    "content": "import url from 'node:url'\nimport path from 'node:path'\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport type { BuildEnvironmentOptions } from 'vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\n// Client Build Configuration\nconst clientBuildConfig: BuildEnvironmentOptions = {\n  outDir: 'dist/client',\n  emitAssets: true,\n  copyPublicDir: true,\n  emptyOutDir: true,\n}\n\n// Server Build Configuration\nconst serverBuildConfig: BuildEnvironmentOptions = {\n  ssr: true,\n  outDir: 'dist/server',\n  copyPublicDir: false,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/server/server.ts'),\n    output: {\n      entryFileNames: '[name].js',\n      chunkFileNames: 'assets/[name]-[hash].js',\n      assetFileNames: 'assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// https://vitejs.dev/config/\nexport default defineConfig((configEnv) => {\n  return {\n    plugins: [\n      tailwindcss(),\n      tanstackRouter({\n        target: 'react',\n        autoCodeSplitting: true,\n      }),\n      react(),\n    ],\n    build: configEnv.mode === 'server' ? serverBuildConfig : clientBuildConfig,\n  }\n})\n"
  },
  {
    "path": "examples/solid/authenticated-routes/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/authenticated-routes/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/authenticated-routes/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/authenticated-routes/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-authenticated-routes\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/auth.tsx",
    "content": "import * as Solid from 'solid-js'\n\nimport { sleep } from './utils'\n\nexport interface AuthContext {\n  isAuthenticated: () => boolean\n  login: (username: string) => Promise<void>\n  logout: () => Promise<void>\n  user: () => string | null\n}\n\nconst AuthContext = Solid.createContext<AuthContext | null>(null)\n\nconst key = 'tanstack.auth.user'\n\nfunction getStoredUser() {\n  return localStorage.getItem(key)\n}\n\nfunction setStoredUser(user: string | null) {\n  if (user) {\n    localStorage.setItem(key, user)\n  } else {\n    localStorage.removeItem(key)\n  }\n}\n\nexport function AuthProvider(props: { children: Solid.JSX.Element }) {\n  const [user, setUser] = Solid.createSignal<string | null>(getStoredUser())\n  const isAuthenticated = () => !!user()\n\n  const logout = async () => {\n    await sleep(250)\n\n    setStoredUser(null)\n    setUser(null)\n  }\n\n  const login = async (username: string) => {\n    await sleep(500)\n\n    setStoredUser(username)\n    setUser(username)\n  }\n\n  Solid.createEffect(() => {\n    setUser(getStoredUser())\n  })\n\n  return (\n    <AuthContext.Provider value={{ isAuthenticated, user, login, logout }}>\n      {props.children}\n    </AuthContext.Provider>\n  )\n}\n\nexport function useAuth() {\n  const context = Solid.useContext(AuthContext)\n  if (!context) {\n    throw new Error('useAuth must be used within an AuthProvider')\n  }\n  return context\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\nimport { AuthProvider, useAuth } from './auth'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  context: {\n    auth: undefined!, // This will be set after we wrap the app in an AuthProvider\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction InnerApp() {\n  const auth = useAuth()\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthProvider>\n      <InnerApp />\n    </AuthProvider>\n  )\n}\n\nconst rootElement = document.getElementById('app')!\n\nrender(() => <App />, rootElement)\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nasync function loaderDelayFn<T>(fn: (...args: Array<any>) => Promise<T> | T) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\ntype Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nlet invoices: Array<Invoice> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthRouteImport } from './routes/_auth'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthInvoicesRouteImport } from './routes/_auth.invoices'\nimport { Route as AuthDashboardRouteImport } from './routes/_auth.dashboard'\nimport { Route as AuthInvoicesIndexRouteImport } from './routes/_auth.invoices.index'\nimport { Route as AuthInvoicesInvoiceIdRouteImport } from './routes/_auth.invoices.$invoiceId'\n\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthRoute = AuthRouteImport.update({\n  id: '/_auth',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthInvoicesRoute = AuthInvoicesRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst AuthDashboardRoute = AuthDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst AuthInvoicesIndexRoute = AuthInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthInvoicesRoute,\n} as any)\nconst AuthInvoicesInvoiceIdRoute = AuthInvoicesInvoiceIdRouteImport.update({\n  id: '/$invoiceId',\n  path: '/$invoiceId',\n  getParentRoute: () => AuthInvoicesRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/dashboard': typeof AuthDashboardRoute\n  '/invoices': typeof AuthInvoicesRouteWithChildren\n  '/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/invoices/': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/dashboard': typeof AuthDashboardRoute\n  '/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/invoices': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_auth': typeof AuthRouteWithChildren\n  '/login': typeof LoginRoute\n  '/_auth/dashboard': typeof AuthDashboardRoute\n  '/_auth/invoices': typeof AuthInvoicesRouteWithChildren\n  '/_auth/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/_auth/invoices/': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/dashboard'\n    | '/invoices'\n    | '/invoices/$invoiceId'\n    | '/invoices/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/dashboard' | '/invoices/$invoiceId' | '/invoices'\n  id:\n    | '__root__'\n    | '/'\n    | '/_auth'\n    | '/login'\n    | '/_auth/dashboard'\n    | '/_auth/invoices'\n    | '/_auth/invoices/$invoiceId'\n    | '/_auth/invoices/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthRoute: typeof AuthRouteWithChildren\n  LoginRoute: typeof LoginRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth/invoices': {\n      id: '/_auth/invoices'\n      path: '/invoices'\n      fullPath: '/invoices'\n      preLoaderRoute: typeof AuthInvoicesRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/_auth/dashboard': {\n      id: '/_auth/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof AuthDashboardRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/_auth/invoices/': {\n      id: '/_auth/invoices/'\n      path: '/'\n      fullPath: '/invoices/'\n      preLoaderRoute: typeof AuthInvoicesIndexRouteImport\n      parentRoute: typeof AuthInvoicesRoute\n    }\n    '/_auth/invoices/$invoiceId': {\n      id: '/_auth/invoices/$invoiceId'\n      path: '/$invoiceId'\n      fullPath: '/invoices/$invoiceId'\n      preLoaderRoute: typeof AuthInvoicesInvoiceIdRouteImport\n      parentRoute: typeof AuthInvoicesRoute\n    }\n  }\n}\n\ninterface AuthInvoicesRouteChildren {\n  AuthInvoicesInvoiceIdRoute: typeof AuthInvoicesInvoiceIdRoute\n  AuthInvoicesIndexRoute: typeof AuthInvoicesIndexRoute\n}\n\nconst AuthInvoicesRouteChildren: AuthInvoicesRouteChildren = {\n  AuthInvoicesInvoiceIdRoute: AuthInvoicesInvoiceIdRoute,\n  AuthInvoicesIndexRoute: AuthInvoicesIndexRoute,\n}\n\nconst AuthInvoicesRouteWithChildren = AuthInvoicesRoute._addFileChildren(\n  AuthInvoicesRouteChildren,\n)\n\ninterface AuthRouteChildren {\n  AuthDashboardRoute: typeof AuthDashboardRoute\n  AuthInvoicesRoute: typeof AuthInvoicesRouteWithChildren\n}\n\nconst AuthRouteChildren: AuthRouteChildren = {\n  AuthDashboardRoute: AuthDashboardRoute,\n  AuthInvoicesRoute: AuthInvoicesRouteWithChildren,\n}\n\nconst AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthRoute: AuthRouteWithChildren,\n  LoginRoute: LoginRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routes/__root.tsx",
    "content": "import { Outlet, createRootRouteWithContext } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nimport type { AuthContext } from '../auth'\n\ninterface MyRouterContext {\n  auth: AuthContext\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => (\n    <>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" initialIsOpen={false} />\n    </>\n  ),\n})\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routes/_auth.dashboard.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nimport { useAuth } from '../auth'\n\nexport const Route = createFileRoute('/_auth/dashboard')({\n  component: DashboardPage,\n})\n\nfunction DashboardPage() {\n  const auth = useAuth()\n\n  return (\n    <section class=\"grid gap-2 p-2\">\n      <p>Hi {auth.user()}!</p>\n      <p>You are currently on the dashboard route.</p>\n    </section>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routes/_auth.invoices.$invoiceId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nimport { fetchInvoiceById } from '../posts'\n\nexport const Route = createFileRoute('/_auth/invoices/$invoiceId')({\n  loader: async ({ params: { invoiceId } }) => {\n    return {\n      invoice: await fetchInvoiceById(parseInt(invoiceId)),\n    }\n  },\n  component: InvoicePage,\n})\n\nfunction InvoicePage() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <section class=\"grid gap-2\">\n      <h2 class=\"text-lg\">\n        <strong>Invoice No.</strong> #\n        {loaderData().invoice.id.toString().padStart(2, '0')}\n      </h2>\n      <p>\n        <strong>Invoice title:</strong> {loaderData().invoice.title}\n      </p>\n      <p>\n        <strong>Invoice body:</strong> {loaderData().invoice.body}\n      </p>\n    </section>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routes/_auth.invoices.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_auth/invoices/')({\n  component: () => <div>Select an invoice to view it!</div>,\n})\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routes/_auth.invoices.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nimport { fetchInvoices } from '../posts'\n\nexport const Route = createFileRoute('/_auth/invoices')({\n  loader: async () => ({\n    invoices: await fetchInvoices(),\n  }),\n  component: InvoicesRoute,\n})\n\nfunction InvoicesRoute() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"grid grid-cols-3 md:grid-cols-5 min-h-[500px]\">\n      <div class=\"col-span-1 py-2 pl-2 pr-4 md:border-r\">\n        <p class=\"mb-2\">Choose an invoice from the list below.</p>\n        <ol class=\"grid gap-2\">\n          {loaderData().invoices.map((invoice) => (\n            <li>\n              <Link\n                to=\"/invoices/$invoiceId\"\n                params={{ invoiceId: invoice.id.toString() }}\n                class=\"text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <span class=\"tabular-nums\">\n                  #{invoice.id.toString().padStart(2, '0')}\n                </span>{' '}\n                - {invoice.title.slice(0, 16)}...\n              </Link>\n            </li>\n          ))}\n        </ol>\n      </div>\n      <div class=\"col-span-2 md:col-span-4 py-2 px-4\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routes/_auth.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  redirect,\n  useRouter,\n} from '@tanstack/solid-router'\n\nimport { useAuth } from '../auth'\n\nexport const Route = createFileRoute('/_auth')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated()) {\n      throw redirect({\n        to: '/login',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n  },\n  component: AuthLayout,\n})\n\nfunction AuthLayout() {\n  const router = useRouter()\n  const navigate = Route.useNavigate()\n  const auth = useAuth()\n\n  const handleLogout = () => {\n    if (window.confirm('Are you sure you want to logout?')) {\n      auth.logout().then(() => {\n        router.invalidate().finally(() => {\n          navigate({ to: '/' })\n        })\n      })\n    }\n  }\n\n  return (\n    <div class=\"p-2 h-full\">\n      <h1>Authenticated Route</h1>\n      <p>This route's content is only visible to authenticated users.</p>\n      <ul class=\"py-2 flex gap-2\">\n        <li>\n          <Link\n            to=\"/dashboard\"\n            class=\"hover:underline data-[status='active']:font-semibold\"\n          >\n            Dashboard\n          </Link>\n        </li>\n        <li>\n          <Link\n            to=\"/invoices\"\n            class=\"hover:underline data-[status='active']:font-semibold\"\n          >\n            Invoices\n          </Link>\n        </li>\n        <li>\n          <button type=\"button\" class=\"hover:underline\" onClick={handleLogout}>\n            Logout\n          </button>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2 grid gap-2\">\n      <h1 class=\"text-xl\">Welcome!</h1>\n      <p class=\"py-4 px-2 italic bg-slate-100 dark:bg-slate-800\">\n        <strong class=\"text-red-500\">IMPORTANT!!!</strong> This is just an\n        example of how to use authenticated routes with TanStack Router.\n        <br />\n        This is NOT an example how you'd write a production-level authentication\n        system.\n        <br />\n        You'll need to take the concepts and patterns used in this example and\n        adapt then to work with your authentication flow/system for your app.\n      </p>\n      <p>\n        You are currently on the index route of the{' '}\n        <strong>authenticated-routes</strong> example.\n      </p>\n      <p>You can try going through these options.</p>\n      <ol class=\"list-disc list-inside px-2\">\n        <li>\n          <Link to=\"/login\" class=\"text-blue-500 hover:opacity-75\">\n            Go to the public login page.\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/dashboard\" class=\"text-blue-500 hover:opacity-75\">\n            Go to the auth-only dashboard page.\n          </Link>\n        </li>\n        <li>\n          <Link to=\"/invoices\" class=\"text-blue-500 hover:opacity-75\">\n            Go to the auth-only invoices page.\n          </Link>\n        </li>\n      </ol>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/routes/login.tsx",
    "content": "import * as Solid from 'solid-js'\nimport {\n  createFileRoute,\n  redirect,\n  useRouter,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nimport { useAuth } from '../auth'\nimport { sleep } from '../utils'\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst fallback = '/dashboard' as const\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: z.object({\n    redirect: z.string().optional().catch(''),\n  }),\n  beforeLoad: ({ context, search }) => {\n    if (context.auth.isAuthenticated()) {\n      throw redirect({ to: search.redirect || fallback })\n    }\n  },\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const auth = useAuth()\n  const router = useRouter()\n  const isLoading = useRouterState({ select: (s) => s.isLoading })\n  const navigate = Route.useNavigate()\n  const [isSubmitting, setIsSubmitting] = Solid.createSignal(false)\n\n  const search = Route.useSearch()\n\n  const onFormSubmit = async (evt: any) => {\n    setIsSubmitting(true)\n    try {\n      evt.preventDefault()\n      const data = new FormData(evt.currentTarget)\n      const fieldValue = data.get('username')\n\n      if (!fieldValue) return\n      const username = fieldValue.toString()\n      await auth.login(username)\n\n      await router.invalidate()\n\n      // This is just a hack being used to wait for the auth state to update\n      // in a real app, you'd want to use a more robust solution\n      await sleep(1)\n\n      await navigate({ to: search().redirect || fallback })\n    } catch (error) {\n      console.error('Error logging in: ', error)\n    } finally {\n      setIsSubmitting(false)\n    }\n  }\n\n  const isLoggingIn = isLoading() || isSubmitting()\n\n  return (\n    <div class=\"p-2 grid gap-2 place-items-center\">\n      <h3 class=\"text-xl\">Login page</h3>\n      {search().redirect ? (\n        <p class=\"text-red-500\">You need to login to access this page.</p>\n      ) : (\n        <p>Login to see all the cool content in here.</p>\n      )}\n      <form class=\"mt-4 max-w-lg\" onSubmit={onFormSubmit}>\n        <fieldset disabled={isLoggingIn} class=\"w-full grid gap-2\">\n          <div class=\"grid gap-2 items-center min-w-[300px]\">\n            <label for=\"username-input\" class=\"text-sm font-medium\">\n              Username\n            </label>\n            <input\n              id=\"username-input\"\n              name=\"username\"\n              placeholder=\"Enter your name\"\n              type=\"text\"\n              class=\"border rounded-md p-2 w-full\"\n              required\n            />\n          </div>\n          <button\n            type=\"submit\"\n            class=\"bg-blue-500 text-white py-2 px-4 rounded-md w-full disabled:bg-gray-300 disabled:text-gray-500\"\n          >\n            {isLoggingIn ? 'Loading...' : 'Login'}\n          </button>\n        </fieldset>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/src/utils.ts",
    "content": "export async function sleep(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/.env.example",
    "content": "# Firebase Configuration: Copy this file to `.env.local` and add your Firebase credentials\n# Obtain these values from your Firebase Console (see README.md for detailed setup instructions)\nVITE_PUBLIC_FIREBASE_API_KEY=\nVITE_PUBLIC_FIREBASE_AUTH_DOMAIN=\nVITE_PUBLIC_FIREBASE_PROJECT_ID=\nVITE_PUBLIC_FIREBASE_STORAGE_BUCKET=\nVITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=\nVITE_PUBLIC_FIREBASE_APP_ID=\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n.env.*\n!.env.example\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/README.md",
    "content": "# Firebase Setup\n\n1. Create a [Firebase project](https://console.firebase.google.com/)\n   1. By default, firebase will configure an accepted domain for localhost...update if necessary!\n2. Enable Authentication in the Firebase console\n3. Add GitHub as an authentication provider:\n   - Go to **Authentication** > **Sign-in method** > **GitHub**\n   - Enable GitHub authentication\n   - You'll need to set up OAuth in your GitHub account:\n     - Go to [GitHub Developer Settings](https://github.com/settings/developers)\n     - Create a new OAuth app\n     - Set the homepage URL to your local or production URL\n     - Set the callback URL to: `https://your-firebase-project-id.firebaseapp.com/__/auth/handler`\n     - Copy the Client ID and Client Secret\n   - Return to Firebase console and paste the GitHub Client ID and Client Secret\n   - Save the changes\n\n4. Create a web app in your Firebase project:\n   - Go to **Project Overview** > **Add app** > **Web**\n   - Register the app with a nickname\n   - Copy the Firebase configuration object for later use\n\n## Setup .env.local\n\nCopy the .env.example provided and configure with your firebase credentials\n\n````VITE_FIREBASE_API_KEY=\nVITE_FIREBASE_AUTH_DOMAIN=\nVITE_FIREBASE_PROJECT_ID=\nVITE_FIREBASE_STORAGE_BUCKET=\nVITE_FIREBASE_MESSAGING_SENDER_ID=\nVITE_FIREBASE_APP_ID=```\n\n## Run the app\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n````\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-authenticated-routes-firebase\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"firebase\": \"^11.4.0\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"simple-icons\": \"^14.9.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/auth.tsx",
    "content": "import * as Solid from 'solid-js'\n\nimport { onAuthStateChanged, signInWithPopup, signOut } from 'firebase/auth'\nimport { flushSync } from 'react-dom'\nimport { auth } from './firebase/config'\nimport type { AuthProvider, User } from 'firebase/auth'\n\nexport type AuthContextType = {\n  isAuthenticated: () => boolean\n  isInitialLoading: () => boolean\n  login: (provider: AuthProvider) => Promise<void>\n  logout: () => Promise<void>\n  user: () => User | null\n}\n\nconst AuthContext = Solid.createContext<AuthContextType | null>(null)\n\nexport function AuthContextProvider(props: { children: Solid.JSX.Element }) {\n  const [user, setUser] = Solid.createSignal<User | null>(auth.currentUser)\n  const [isInitialLoading, setIsInitialLoading] = Solid.createSignal(true)\n  const isAuthenticated = () => !!user()\n\n  Solid.createEffect(() => {\n    const unsubscribe = onAuthStateChanged(auth, (user) => {\n      flushSync(() => {\n        setUser(user)\n        setIsInitialLoading(false)\n      })\n    })\n    return () => unsubscribe()\n  })\n\n  const logout = async () => {\n    console.log('Logging out...')\n    await signOut(auth)\n    setUser(null)\n    setIsInitialLoading(false)\n  }\n\n  const login = async (provider: AuthProvider) => {\n    const result = await signInWithPopup(auth, provider)\n    flushSync(() => {\n      setUser(result.user)\n      setIsInitialLoading(false)\n    })\n  }\n\n  return (\n    <AuthContext.Provider\n      value={{ isInitialLoading, isAuthenticated, user, login, logout }}\n    >\n      {props.children}\n    </AuthContext.Provider>\n  )\n}\n\nexport function useAuth() {\n  const context = Solid.useContext(AuthContext)\n  if (!context) {\n    throw new Error('useAuth must be used within an AuthProvider')\n  }\n  return context\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/firebase/config.ts",
    "content": "// Import the functions you need from the SDKs you need\nimport { initializeApp } from 'firebase/app'\nimport { getAuth } from 'firebase/auth'\n// TODO: Add SDKs for Firebase products that you want to use\n// https://firebase.google.com/docs/web/setup#available-libraries\n\n// Your web app's Firebase configuration\nconst firebaseConfig = {\n  apiKey: import.meta.env.VITE_PUBLIC_FIREBASE_API_KEY,\n  authDomain: import.meta.env.VITE_PUBLIC_FIREBASE_AUTH_DOMAIN,\n  projectId: import.meta.env.VITE_PUBLIC_FIREBASE_PROJECT_ID,\n  storageBucket: import.meta.env.VITE_PUBLIC_FIREBASE_STORAGE_BUCKET,\n  messagingSenderId: import.meta.env.VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,\n  appId: import.meta.env.VITE_PUBLIC_FIREBASE_APP_ID,\n}\n\n// Initialize Firebase\nconst app = initializeApp(firebaseConfig)\nexport const auth = getAuth(app)\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\nimport { AuthContextProvider, useAuth } from './auth'\n\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  context: {\n    auth: undefined!, // This will be set after we wrap the app in AuthContextProvider\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction InnerApp() {\n  const auth = useAuth()\n\n  // If the provider is initially loading, do not render the router\n  if (auth.isInitialLoading()) {\n    return (\n      <div class=\"flex h-screen w-full items-center justify-center p-4\">\n        <div class=\"size-10 rounded-full border-4 border-gray-200 border-t-foreground animate-spin\" />\n      </div>\n    )\n  }\n\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthContextProvider>\n      <InnerApp />\n    </AuthContextProvider>\n  )\n}\n\nconst rootElement = document.getElementById('app')!\n\nrender(() => <App />, rootElement)\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nasync function loaderDelayFn<T>(fn: (...args: Array<any>) => Promise<T> | T) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\ntype Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nlet invoices: Array<Invoice> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthRouteImport } from './routes/_auth'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthInvoicesRouteImport } from './routes/_auth.invoices'\nimport { Route as AuthDashboardRouteImport } from './routes/_auth.dashboard'\nimport { Route as AuthInvoicesIndexRouteImport } from './routes/_auth.invoices.index'\nimport { Route as AuthInvoicesInvoiceIdRouteImport } from './routes/_auth.invoices.$invoiceId'\n\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthRoute = AuthRouteImport.update({\n  id: '/_auth',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthInvoicesRoute = AuthInvoicesRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst AuthDashboardRoute = AuthDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst AuthInvoicesIndexRoute = AuthInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthInvoicesRoute,\n} as any)\nconst AuthInvoicesInvoiceIdRoute = AuthInvoicesInvoiceIdRouteImport.update({\n  id: '/$invoiceId',\n  path: '/$invoiceId',\n  getParentRoute: () => AuthInvoicesRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/dashboard': typeof AuthDashboardRoute\n  '/invoices': typeof AuthInvoicesRouteWithChildren\n  '/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/invoices/': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/dashboard': typeof AuthDashboardRoute\n  '/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/invoices': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_auth': typeof AuthRouteWithChildren\n  '/login': typeof LoginRoute\n  '/_auth/dashboard': typeof AuthDashboardRoute\n  '/_auth/invoices': typeof AuthInvoicesRouteWithChildren\n  '/_auth/invoices/$invoiceId': typeof AuthInvoicesInvoiceIdRoute\n  '/_auth/invoices/': typeof AuthInvoicesIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/dashboard'\n    | '/invoices'\n    | '/invoices/$invoiceId'\n    | '/invoices/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/dashboard' | '/invoices/$invoiceId' | '/invoices'\n  id:\n    | '__root__'\n    | '/'\n    | '/_auth'\n    | '/login'\n    | '/_auth/dashboard'\n    | '/_auth/invoices'\n    | '/_auth/invoices/$invoiceId'\n    | '/_auth/invoices/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthRoute: typeof AuthRouteWithChildren\n  LoginRoute: typeof LoginRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth/invoices': {\n      id: '/_auth/invoices'\n      path: '/invoices'\n      fullPath: '/invoices'\n      preLoaderRoute: typeof AuthInvoicesRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/_auth/dashboard': {\n      id: '/_auth/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof AuthDashboardRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/_auth/invoices/': {\n      id: '/_auth/invoices/'\n      path: '/'\n      fullPath: '/invoices/'\n      preLoaderRoute: typeof AuthInvoicesIndexRouteImport\n      parentRoute: typeof AuthInvoicesRoute\n    }\n    '/_auth/invoices/$invoiceId': {\n      id: '/_auth/invoices/$invoiceId'\n      path: '/$invoiceId'\n      fullPath: '/invoices/$invoiceId'\n      preLoaderRoute: typeof AuthInvoicesInvoiceIdRouteImport\n      parentRoute: typeof AuthInvoicesRoute\n    }\n  }\n}\n\ninterface AuthInvoicesRouteChildren {\n  AuthInvoicesInvoiceIdRoute: typeof AuthInvoicesInvoiceIdRoute\n  AuthInvoicesIndexRoute: typeof AuthInvoicesIndexRoute\n}\n\nconst AuthInvoicesRouteChildren: AuthInvoicesRouteChildren = {\n  AuthInvoicesInvoiceIdRoute: AuthInvoicesInvoiceIdRoute,\n  AuthInvoicesIndexRoute: AuthInvoicesIndexRoute,\n}\n\nconst AuthInvoicesRouteWithChildren = AuthInvoicesRoute._addFileChildren(\n  AuthInvoicesRouteChildren,\n)\n\ninterface AuthRouteChildren {\n  AuthDashboardRoute: typeof AuthDashboardRoute\n  AuthInvoicesRoute: typeof AuthInvoicesRouteWithChildren\n}\n\nconst AuthRouteChildren: AuthRouteChildren = {\n  AuthDashboardRoute: AuthDashboardRoute,\n  AuthInvoicesRoute: AuthInvoicesRouteWithChildren,\n}\n\nconst AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthRoute: AuthRouteWithChildren,\n  LoginRoute: LoginRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routes/__root.tsx",
    "content": "import { Outlet, createRootRouteWithContext } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type { AuthContextType } from '../auth'\n\nexport type MyRouterContext = {\n  auth: AuthContextType\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => (\n    <>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" initialIsOpen={false} />\n    </>\n  ),\n})\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routes/_auth.dashboard.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nimport { useAuth } from '../auth'\n\nexport const Route = createFileRoute('/_auth/dashboard')({\n  component: DashboardPage,\n})\n\nfunction DashboardPage() {\n  const { user } = useAuth()\n\n  return (\n    <section class=\"grid gap-2 p-2\">\n      <p>Hi {user()?.displayName || user()?.email || 'there'}!</p>\n      <p>You are currently on the dashboard route.</p>\n    </section>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.$invoiceId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { fetchInvoiceById } from '../posts'\n\nexport const Route = createFileRoute('/_auth/invoices/$invoiceId')({\n  loader: async ({ params: { invoiceId } }) => {\n    return {\n      invoice: await fetchInvoiceById(Number.parseInt(invoiceId)),\n    }\n  },\n  component: InvoicePage,\n})\n\nfunction InvoicePage() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <section class=\"grid gap-2\">\n      <h2 class=\"text-lg\">\n        <strong>Invoice No.</strong> #\n        {loaderData().invoice.id.toString().padStart(2, '0')}\n      </h2>\n      <p>\n        <strong>Invoice title:</strong> {loaderData().invoice.title}\n      </p>\n      <p>\n        <strong>Invoice body:</strong> {loaderData().invoice.body}\n      </p>\n    </section>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_auth/invoices/')({\n  component: () => <div>Select an invoice to view it!</div>,\n})\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routes/_auth.invoices.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nimport { fetchInvoices } from '../posts'\n\nexport const Route = createFileRoute('/_auth/invoices')({\n  loader: async () => ({\n    invoices: await fetchInvoices(),\n  }),\n  component: InvoicesRoute,\n})\n\nfunction InvoicesRoute() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"grid grid-cols-3 md:grid-cols-5 min-h-[500px]\">\n      <div class=\"col-span-1 py-2 pl-2 pr-4 md:border-r\">\n        <p class=\"mb-2\">Choose an invoice from the list below.</p>\n        <ol class=\"grid gap-2\">\n          {loaderData().invoices.map((invoice) => (\n            <li>\n              <Link\n                to=\"/invoices/$invoiceId\"\n                params={{ invoiceId: invoice.id.toString() }}\n                class=\"text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <span class=\"tabular-nums\">\n                  #{invoice.id.toString().padStart(2, '0')}\n                </span>{' '}\n                - {invoice.title.slice(0, 16)}...\n              </Link>\n            </li>\n          ))}\n        </ol>\n      </div>\n      <div class=\"col-span-2 md:col-span-4 py-2 px-4\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routes/_auth.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createFileRoute,\n  redirect,\n  useRouter,\n} from '@tanstack/solid-router'\nimport { useAuth } from '../auth'\n\nexport const Route = createFileRoute('/_auth')({\n  beforeLoad: ({ context, location }) => {\n    // Check if user is authenticated\n    if (!context.auth.isAuthenticated()) {\n      console.log('User not authenticated, redirecting to login...')\n      throw redirect({\n        to: '/login',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n    console.log('User authenticated, proceeding...')\n  },\n  component: AuthLayout,\n})\n\nfunction AuthLayout() {\n  const router = useRouter()\n  const navigate = Route.useNavigate()\n  const auth = useAuth()\n\n  const handleLogout = () => {\n    if (window.confirm('Are you sure you want to logout?')) {\n      auth.logout().then(() => {\n        router.invalidate().finally(() => {\n          navigate({ to: '/login' })\n        })\n      })\n    }\n  }\n\n  return (\n    <div class=\"p-2 h-full\">\n      <h1>Authenticated Route</h1>\n      <p>This route's content is only visible to authenticated users.</p>\n      <ul class=\"py-2 flex gap-2\">\n        <li>\n          <Link\n            to=\"/dashboard\"\n            class=\"hover:underline data-[status='active']:font-semibold\"\n          >\n            Dashboard\n          </Link>\n        </li>\n        <li>\n          <Link\n            to=\"/invoices\"\n            class=\"hover:underline data-[status='active']:font-semibold\"\n          >\n            Invoices\n          </Link>\n        </li>\n        <li>\n          <button type=\"button\" class=\"hover:underline\" onClick={handleLogout}>\n            Logout\n          </button>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routes/index.tsx",
    "content": "import { Link, createFileRoute, redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  beforeLoad: ({ context }) => {\n    // Log for debugging\n    console.log('Checking context on index.tsx:', context) // Check if user is authenticated\n    if (context.auth.isAuthenticated()) {\n      console.log('User authenticated, proceeding...')\n      throw redirect({\n        to: '/dashboard',\n      })\n    }\n  },\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-4 max-w-3xl mx-auto\">\n      <h1 class=\"text-2xl font-bold mb-4\">Welcome to TS Router + Firebase</h1>\n\n      <section class=\"mb-6 p-4 bg-slate-100 dark:bg-slate-800 rounded-lg\">\n        <h2 class=\"text-xl font-semibold mb-2\">About This Template</h2>\n        <p class=\"mb-2\">This template demonstrates a SPA architecture using:</p>\n        <ul class=\"list-disc list-inside mb-4\">\n          <li>TanStack Router for type-safe routing</li>\n          <li>Firebase Client SDK for authentication</li>\n        </ul>\n        <p>\n          <strong>Project Organization:</strong> Routes under <code>_auth</code>{' '}\n          are protected, while other routes are public. The{' '}\n          <code>(public)</code> folder is used purely for organization and\n          doesn't affect routing.\n        </p>\n      </section>\n\n      <section class=\"mb-6\">\n        <h2 class=\"text-xl font-semibold mb-2\">How It Works</h2>\n        <p class=\"mb-3\">\n          This page (<code>index.tsx</code>) serves as your public landing/sales\n          page. When an authenticated user visits this route, they're\n          automatically redirected to <code>/dashboard</code>.\n        </p>\n      </section>\n\n      <section class=\"mt-6\">\n        <h2 class=\"text-xl font-semibold mb-2\">Navigation</h2>\n        <div class=\"flex gap-4\">\n          <Link\n            to=\"/login\"\n            class=\"px-4 py-2 bg-blue-500 text-white rounded-sm hover:bg-blue-600\"\n          >\n            Login\n          </Link>\n          <Link\n            to=\"/dashboard\"\n            class=\"px-4 py-2 border border-gray-300 rounded-sm hover:bg-gray-100 dark:hover:bg-gray-800\"\n          >\n            Dashboard (Protected)\n          </Link>\n        </div>\n      </section>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/routes/login.tsx",
    "content": "import {\n  createFileRoute,\n  redirect,\n  useRouter,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nimport {\n  GoogleAuthProvider,\n  GithubAuthProvider,\n  OAuthProvider,\n} from 'firebase/auth'\nimport { useAuth } from '../auth'\nimport { sleep } from '../utils'\nimport { siApple, siGithub, siGoogle } from 'simple-icons'\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst fallback = '/dashboard' as const\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: z.object({\n    redirect: z.string().optional().catch(''),\n  }),\n  beforeLoad: ({ context, search }) => {\n    if (context.auth.isAuthenticated()) {\n      throw redirect({ to: search.redirect || fallback })\n    }\n  },\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const { login } = useAuth()\n\n  const handleSignIn = async (provider: 'github') => {\n    console.log(`Clicked ${provider} sign in!`)\n    try {\n      const providers = {\n        github: new GithubAuthProvider(),\n        // Other providers can be allocated here\n      }\n\n      const typedProvider =\n        providers[provider] ??\n        (() => {\n          throw new Error('Invalid provider')\n        })()\n\n      await login(typedProvider)\n      router.invalidate() // This should force the user to route to /dashboard\n    } catch (error) {\n      console.error('Sign in error:', error)\n    }\n  }\n\n  return (\n    <div class=\"flex justify-center items-center min-h-screen\">\n      <div class=\"w-full max-w-md px-4 animate-fade-up relative z-10\">\n        <div class=\"w-full backdrop-blur-xs bg-card/80 p-8 space-y-8 shadow-md border border-border\">\n          <div class=\"space-y-4\">\n            {/* biome-ignore lint/a11y/useButtonType: <explanation> */}\n            <button\n              class=\"w-full h-12 font-medium bg-background hover:bg-secondary border-2 transition-all hover:scale-[1.02]\"\n              onClick={() => handleSignIn('github')}\n            >\n              <div class=\"flex items-center justify-center w-full\">\n                <svg\n                  xmlns=\"http://www.w3.org/2000/svg\"\n                  viewBox=\"0 0 24 24\"\n                  class=\"mr-2 h-5 w-5\"\n                  fill=\"currentColor\"\n                  aria-labelledby=\"githubIconTitle\"\n                  role=\"img\"\n                  style={{ 'min-width': '20px' }}\n                >\n                  <title id=\"githubIconTitle\">GitHub Logo</title>\n                  <path d={siGithub.path} />\n                </svg>\n                <span>Continue with GitHub</span>\n              </div>\n            </button>\n          </div>\n\n          <div class=\"text-center text-sm text-muted-foreground\">\n            By continuing, you agree to our{' '}\n            <a\n              href=\"#\"\n              class=\"underline underline-offset-4 hover:text-primary transition-colors\"\n            >\n              Terms of Service\n            </a>{' '}\n            and{' '}\n            <a\n              href=\"#\"\n              class=\"underline underline-offset-4 hover:text-primary transition-colors\"\n            >\n              Privacy Policy\n            </a>\n          </div>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/utils.ts",
    "content": "export async function sleep(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/src/vite.d.ts",
    "content": "/// <reference types=\"vite/client\" />\n\ninterface ImportMetaEnv {\n  readonly VITE_PUBLIC_FIREBASE_API_KEY: string\n  readonly VITE_PUBLIC_FIREBASE_AUTH_DOMAIN: string\n  readonly VITE_PUBLIC_FIREBASE_PROJECT_ID: string\n  readonly VITE_PUBLIC_FIREBASE_STORAGE_BUCKET: string\n  readonly VITE_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: string\n  readonly VITE_PUBLIC_FIREBASE_APP_ID: string\n}\n\ninterface ImportMeta {\n  readonly env: ImportMetaEnv\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/authenticated-routes-firebase/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "examples/solid/basic/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { NotFoundError, fetchPost, fetchPosts } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nexport const postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ params }) => fetchPost(params.postId),\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold\">{post().title}</h4>\n      <hr class=\"opacity-20\" />\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst nestedPathlessLayout2Route = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  id: '_nestedPathlessLayout',\n  component: PathlessLayout2Component,\n})\n\nfunction PathlessLayout2Component() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to Route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to Route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return <div>I'm route A!</div>\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return <div>I'm route B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  pathlessLayoutRoute.addChildren([\n    nestedPathlessLayout2Route.addChildren([\n      pathlessLayoutARoute,\n      pathlessLayoutBRoute,\n    ]),\n  ]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/basic/src/posts.lazy.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@tanstack/solid-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "examples/solid/basic/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-default-search-params\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport axios from 'redaxios'\nimport { z } from 'zod'\nimport type {\n  ErrorComponentProps,\n  SearchSchemaInput,\n} from '@tanstack/solid-router'\nimport './styles.css'\n\ntype PostType = {\n  id: number\n  title: string\n  body: string\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 300))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: number) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 300))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n    .then((r) => r.data)\n\n  return post\n}\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return <p>This is the notFoundComponent configured on root route</p>\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <div class=\"bg-linear-to-r from-green-700 to-lime-600 text-white\">\n      <div class=\"p-2 flex gap-2 text-lg bg-black/40 shadow-xl\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </div>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = postsLayoutRoute.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <div class=\"list-disc bg-gray-800/70 rounded-lg divide-y divide-green-500/30\">\n        {posts().map((post, index) => {\n          return (\n            <div class=\"whitespace-nowrap\">\n              <Link\n                to={postRoute.to}\n                search={{\n                  postId: post.id,\n                  color: index % 2 ? 'red' : undefined,\n                }}\n                class=\"block py-1 px-2 text-green-300 hover:text-green-200\"\n                activeProps={{ class: 'text-white! font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <Outlet />\n    </div>\n  )\n}\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nclass NotFoundError extends Error {}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: 'post',\n  validateSearch: (\n    input: {\n      postId: number\n      color?: 'white' | 'red' | 'green'\n    } & SearchSchemaInput,\n  ) =>\n    z\n      .object({\n        postId: z.number().catch(1),\n        color: z.enum(['white', 'red', 'green']).catch('white'),\n      })\n      .parse(input),\n  loaderDeps: ({ search: { postId } }) => ({\n    postId,\n  }),\n  errorComponent: PostErrorComponent,\n  loader: ({ deps: { postId } }) => fetchPost(postId),\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n  const search = postRoute.useSearch()\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold\">{post().title}</h4>\n      <hr class=\"opacity-20\" />\n      <div class={`text-sm  text-${search().color}-300`}>{post().body}</div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-default-search-params/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "examples/solid/basic-devtools-panel/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-devtools-panel\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/src/App.tsx",
    "content": "import { createSignal } from 'solid-js'\n\nfunction App() {\n  const [count, setCount] = createSignal(0)\n\n  return (\n    <>\n      <div></div>\n      <div class=\"card\">\n        <button onClick={() => setCount((count) => count + 1)}>\n          count is {count()}\n        </button>\n        <p>\n          Edit <code>src/App.tsx</code> and save to test HMR\n        </p>\n      </div>\n      <p class=\"read-the-docs\">\n        Click on the Vite and React logos to learn more\n      </p>\n    </>\n  )\n}\n\nexport default App\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/src/main.tsx",
    "content": "import App from './App'\nimport {\n  Outlet,\n  RouterProvider,\n  Link,\n  createRouter,\n  createRoute,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'\nimport { render } from 'solid-js/web'\n\nconst rootRoute = createRootRoute({\n  component: () => (\n    <>\n      <div class=\"p-2 flex gap-2\">\n        <Link to=\"/\">Home</Link> <Link to=\"/about\">About</Link>\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  ),\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: function Index() {\n    return (\n      <div class=\"p-2\">\n        <h3>Welcome Home!</h3>\n        <App />\n      </div>\n    )\n  },\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  component: function About() {\n    return <div class=\"p-2\">Hello from About!</div>\n  },\n})\n\nconst routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\nconst router = createRouter({ routeTree })\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst element = document.getElementById('app')!\nconst shadowContainer = element.attachShadow({ mode: 'open' })\nconst shadowRootElement = document.createElement('div')\nshadowContainer.appendChild(shadowRootElement)\n\nrender(\n  () => (\n    <>\n      <RouterProvider router={router} />\n      <TanStackRouterDevtoolsPanel\n        shadowDOMTarget={shadowContainer}\n        router={router}\n      />\n    </>\n  ),\n  shadowRootElement,\n)\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-devtools-panel/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/basic-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/basic-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/posts'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/-components/PostErrorComponent.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport { PostErrorComponent } from './-components/PostErrorComponent'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-non-nested-devtools\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { NotFoundError, fetchPost, fetchPosts } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <Outlet />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nexport const postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ params }) => fetchPost(params.postId),\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold\">{post().title}</h4>\n      <hr class=\"opacity-20\" />\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst nestedPathlessLayout2Route = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  id: '_nestedPathlessLayout',\n  component: PathlessLayout2Component,\n})\n\nfunction PathlessLayout2Component() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to Route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to Route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return <div>I'm route A!</div>\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return <div>I'm route B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  pathlessLayoutRoute.addChildren([\n    nestedPathlessLayout2Route.addChildren([\n      pathlessLayoutARoute,\n      pathlessLayoutBRoute,\n    ]),\n  ]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(\n    () => (\n      <>\n        <RouterProvider router={router} />\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </>\n    ),\n    rootElement,\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/src/posts.lazy.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@tanstack/solid-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-non-nested-devtools/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/basic-solid-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/basic-solid-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-solid-query/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic-solid-query/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-solid-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query/src/main.tsx",
    "content": "import {\n  ErrorComponent,\n  HeadContent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  useRouter,\n} from '@tanstack/solid-router'\nimport {\n  QueryClient,\n  QueryClientProvider,\n  useQuery,\n} from '@tanstack/solid-query'\nimport './styles.css'\nimport { render } from 'solid-js/web'\nimport { SolidQueryDevtools } from '@tanstack/solid-query-devtools'\nimport { createEffect, createMemo } from 'solid-js'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { NotFoundError, postQueryOptions, postsQueryOptions } from './posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nconst rootRoute = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <SolidQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexRouteComponent,\n})\n\nfunction IndexRouteComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexRouteComponent,\n})\n\nfunction PostsIndexRouteComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ context: { queryClient }, params: { postId } }) =>\n    queryClient.ensureQueryData(postQueryOptions(postId)),\n  component: PostRouteComponent,\n})\n\nfunction PostErrorComponent({ error, reset }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  createEffect(() => {\n    reset()\n    queryClient.resetQueries()\n  })\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nfunction PostRouteComponent() {\n  const params = postRoute.useParams()\n  const postQuery = useQuery(() => postQueryOptions(params().postId))\n  const post = createMemo(() => postQuery.data)\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post()?.title}</h4>\n      <div class=\"text-sm\">{post()?.body}</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst nestedPathlessLayoutRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  id: '_nestedPathlessLayout',\n  component: NestedPathlessLayoutComponent,\n})\n\nfunction NestedPathlessLayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => nestedPathlessLayoutRoute,\n  path: '/route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return <div>I'm A!</div>\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => nestedPathlessLayoutRoute,\n  path: '/route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return <div>I'm B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  pathlessLayoutRoute.addChildren([\n    nestedPathlessLayoutRoute.addChildren([\n      pathlessLayoutARoute,\n      pathlessLayoutBRoute,\n    ]),\n  ]),\n  indexRoute,\n])\n\nconst queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n  context: {\n    queryClient,\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(\n    () => (\n      <QueryClientProvider client={queryClient}>\n        <RouterProvider router={router} />\n      </QueryClientProvider>\n    ),\n    rootElement,\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query/src/posts.lazy.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { createMemo } from 'solid-js'\nimport { postsQueryOptions } from './posts'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const postsQuery = useQuery(() => postsQueryOptions)\n\n  const posts = createMemo(() => {\n    if (postsQuery.data) {\n      return postsQuery.data\n    } else {\n      return []\n    }\n  })\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            console\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query/src/posts.ts",
    "content": "import axios from 'redaxios'\nimport { queryOptions } from '@tanstack/solid-query'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "examples/solid/basic-solid-query/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-solid-query-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"dev:e2e\": \"vite\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/solid-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nexport const queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(\n    () => (\n      <QueryClientProvider client={queryClient}>\n        <RouterProvider router={router} />\n      </QueryClientProvider>\n    ),\n    rootElement,\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/postQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport { fetchPost } from './posts'\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/postsQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport { fetchPosts } from './posts'\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/posts'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { SolidQueryDevtools } from '@tanstack/solid-query-devtools'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type { QueryClient } from '@tanstack/solid-query'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <SolidQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { ErrorComponent, useRouter } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { createEffect, createMemo } from 'solid-js'\nimport { PostNotFoundError } from '../posts'\nimport { postQueryOptions } from '../postQueryOptions'\nimport { queryClient } from '../main'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error, reset }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof PostNotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  createEffect(() => {\n    reset()\n    queryClient.resetQueries()\n  })\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ context: { queryClient }, params: { postId } }) => {\n    return queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const params = Route.useParams()\n  const post = createMemo(() =>\n    useQuery(() => postQueryOptions(params().postId)),\n  )\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().data?.title}</h4>\n      <div class=\"text-sm\">{post().data?.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Link, Outlet } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { postsQueryOptions } from '../postsQueryOptions'\nimport { createMemo } from 'solid-js'\n\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context: { queryClient } }) =>\n    queryClient.ensureQueryData(postsQueryOptions),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useQuery(() => postsQueryOptions)\n  const posts = createMemo(() => {\n    if (postsQuery.data) {\n      return postsQuery.data\n    } else {\n      return []\n    }\n  })\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"resolveJsonModule\": true,\n    \"allowJs\": true\n  },\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "examples/solid/basic-solid-query-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-ssr-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"node server\",\n    \"build\": \"npm run build:client && npm run build:server\",\n    \"build:client\": \"vite build\",\n    \"build:server\": \"vite build --ssr\",\n    \"serve\": \"NODE_ENV=production node server\",\n    \"debug\": \"node --inspect-brk server\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"compression\": \"^1.8.0\",\n    \"express\": \"^4.21.2\",\n    \"get-port\": \"^7.1.0\",\n    \"node-fetch\": \"^3.3.2\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@types/express\": \"^4.17.23\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.8.3\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/server.js",
    "content": "import path from 'node:path'\nimport express from 'express'\nimport getPort, { portNumbers } from 'get-port'\nimport * as zlib from 'node:zlib'\n\nconst isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD\n\nexport async function createServer(\n  root = process.cwd(),\n  isProd = process.env.NODE_ENV === 'production',\n  hmrPort,\n) {\n  const app = express()\n\n  /**\n   * @type {import('vite').ViteDevServer}\n   */\n  let vite\n  if (!isProd) {\n    vite = await (\n      await import('vite')\n    ).createServer({\n      root,\n      logLevel: isTest ? 'error' : 'info',\n      server: {\n        middlewareMode: true,\n        watch: {\n          // During tests we edit the files too fast and sometimes chokidar\n          // misses change events, so enforce polling for consistency\n          usePolling: true,\n          interval: 100,\n        },\n        hmr: {\n          port: hmrPort,\n        },\n      },\n      appType: 'custom',\n    })\n    // use vite's connect instance as middleware\n    app.use(vite.middlewares)\n  } else {\n    app.use(\n      (await import('compression')).default({\n        brotli: {\n          flush: zlib.constants.BROTLI_OPERATION_FLUSH,\n        },\n        flush: zlib.constants.Z_SYNC_FLUSH,\n      }),\n    )\n  }\n\n  if (isProd) app.use(express.static('./dist/client'))\n\n  app.use('*', async (req, res) => {\n    try {\n      const url = req.originalUrl\n\n      if (path.extname(url) !== '') {\n        console.warn(`${url} is not valid router path`)\n        res.status(404)\n        res.end(`${url} is not valid router path`)\n        return\n      }\n\n      // Best effort extraction of the head from vite's index transformation hook\n      let viteHead = !isProd\n        ? await vite.transformIndexHtml(\n            url,\n            `<html><head></head><body></body></html>`,\n          )\n        : ''\n\n      viteHead = viteHead.substring(\n        viteHead.indexOf('<head>') + 6,\n        viteHead.indexOf('</head>'),\n      )\n\n      const entry = await (async () => {\n        if (!isProd) {\n          return vite.ssrLoadModule('/src/entry-server.tsx')\n        } else {\n          return import('./dist/server/entry-server.js')\n        }\n      })()\n\n      console.info('Rendering: ', url, '...')\n      entry.render({ req, res, head: viteHead })\n    } catch (e) {\n      !isProd && vite.ssrFixStacktrace(e)\n      console.info(e.stack)\n      res.status(500).end(e.stack)\n    }\n  })\n\n  return { app, vite }\n}\n\nif (!isTest) {\n  createServer().then(async ({ app }) =>\n    app.listen(await getPort({ port: portNumbers(3000, 3100) }), () => {\n      console.info('Client Server: http://localhost:3000')\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/entry-client.tsx",
    "content": "import { RouterClient } from '@tanstack/solid-router/ssr/client'\nimport { hydrate } from 'solid-js/web'\nimport { createRouter } from './router'\n\nconst router = createRouter()\n\nhydrate(() => <RouterClient router={router} />, document.body)\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/entry-server.tsx",
    "content": "import { pipeline } from 'node:stream/promises'\nimport {\n  RouterServer,\n  createRequestHandler,\n  renderRouterToString,\n} from '@tanstack/solid-router/ssr/server'\nimport { createRouter } from './router'\nimport type express from 'express'\nimport './fetch-polyfill'\n\nexport async function render({\n  req,\n  res,\n  head,\n}: {\n  head: string\n  req: express.Request\n  res: express.Response\n}) {\n  // Convert the express request to a fetch request\n  const url = new URL(req.originalUrl || req.url, 'http://localhost:3000').href\n\n  const request = new Request(url, {\n    method: req.method,\n    headers: (() => {\n      const headers = new Headers()\n      for (const [key, value] of Object.entries(req.headers)) {\n        headers.set(key, value as any)\n      }\n      return headers\n    })(),\n  })\n\n  // Create a request handler\n  const handler = createRequestHandler({\n    request,\n    createRouter: () => {\n      const router = createRouter()\n\n      // Update each router instance with the head info from vite\n      router.update({\n        context: {\n          ...router.options.context,\n          head: head,\n        },\n      })\n      return router\n    },\n  })\n\n  // Let's use the default stream handler to create the response\n  const response = await handler(({ responseHeaders, router }) =>\n    renderRouterToString({\n      responseHeaders,\n      router,\n      children: () => <RouterServer router={router} />,\n    }),\n  )\n\n  // Convert the fetch response back to an express response\n  res.statusMessage = response.statusText\n  res.status(response.status)\n\n  response.headers.forEach((value, name) => {\n    res.setHeader(name, value)\n  })\n\n  // Stream the response body\n  return pipeline(response.body as any, res)\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/fetch-polyfill.js",
    "content": "// fetch-polyfill.js\nimport fetch, {\n  Blob,\n  blobFrom,\n  blobFromSync,\n  File,\n  fileFrom,\n  fileFromSync,\n  FormData,\n  Headers,\n  Request,\n  Response,\n} from 'node-fetch'\n\nif (!globalThis.fetch) {\n  globalThis.fetch = fetch\n  globalThis.Headers = Headers\n  globalThis.Request = Request\n  globalThis.Response = Response\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ErrorRouteImport } from './routes/error'\nimport { Route as PostsRouteRouteImport } from './routes/posts/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts/index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts/$postId'\n\nconst ErrorRoute = ErrorRouteImport.update({\n  id: '/error',\n  path: '/error',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/error': typeof ErrorRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/error' | '/posts/$postId' | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/error' | '/posts/$postId' | '/posts'\n  id: '__root__' | '/' | '/posts' | '/error' | '/posts/$postId' | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  ErrorRoute: typeof ErrorRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/error': {\n      id: '/error'\n      path: '/error'\n      fullPath: '/error'\n      preLoaderRoute: typeof ErrorRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  ErrorRoute: ErrorRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/router.tsx",
    "content": "import { createRouter as createReactRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function createRouter() {\n  return createReactRouter({\n    routeTree,\n    context: {\n      head: '',\n    },\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/routerContext.tsx",
    "content": "export type RouterContext = {\n  head: string\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/routes/__root.tsx",
    "content": "import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nimport {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport type { RouterContext } from '../routerContext'\n\nexport const Route = createRootRouteWithContext<RouterContext>()({\n  head: () => ({\n    links: [{ rel: 'icon', href: '/images/favicon.ico' }],\n    meta: [\n      {\n        title: 'TanStack Router SSR Basic File Based Streaming',\n      },\n      {\n        charSet: 'UTF-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1.0',\n      },\n    ],\n    scripts: [\n      {\n        src: 'https://unpkg.com/@tailwindcss/browser@4',\n      },\n      ...(!import.meta.env.PROD\n        ? [\n            {\n              type: 'module',\n              children: `import RefreshRuntime from \"/@react-refresh\"\n  RefreshRuntime.injectIntoGlobalHook(window)\n  window.$RefreshReg$ = () => {}\n  window.$RefreshSig$ = () => (type) => type\n  window.__vite_plugin_react_preamble_installed__ = true`,\n            },\n            {\n              type: 'module',\n              src: '/@vite/client',\n            },\n          ]\n        : []),\n      {\n        type: 'module',\n        src: import.meta.env.PROD\n          ? '/static/entry-client.js'\n          : '/src/entry-client.tsx',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/error\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Error\n        </Link>\n      </div>\n      <hr />\n      <Outlet /> {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/routes/error.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/error')({\n  component: ErrorComponent,\n  loader: () => {\n    if (Math.random() > 0.5) throw new Error('Random error!')\n  },\n  pendingComponent: () => <p>Loading..</p>,\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return (\n      <div class=\"p-2\">\n        <h3>Caught: {error.message}</h3>\n        <p>(This page has a 75% chance of throwing an error)</p>\n      </div>\n    )\n  },\n})\n\nfunction ErrorComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>\n        The loader of this page will have a 75% chance of throwing an error!\n      </h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  loader: () => ({\n    date: new Date(),\n  }),\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <p>Data: {data().date.getDate()}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/routes/posts/$postId.tsx",
    "content": "import { Await, createFileRoute, notFound } from '@tanstack/solid-router'\nimport type { PostType } from './route'\n\nasync function fetchPostById(postId: string) {\n  console.info(`Fetching post with id ${postId}...`)\n\n  await new Promise((r) => setTimeout(r, 100 + Math.round(Math.random() * 100)))\n\n  const res = await fetch(\n    `https://jsonplaceholder.typicode.com/posts/${postId}`,\n  )\n\n  if (res.status === 404) throw notFound()\n\n  return res.json() as Promise<PostType>\n}\n\nexport type CommentType = {\n  id: string\n  postId: string\n  name: string\n  email: string\n  body: string\n}\n\nasync function fetchComments(postId: string) {\n  await new Promise((r) => setTimeout(r, 2000))\n\n  return fetch(\n    `https://jsonplaceholder.typicode.com/comments?postId=${postId}`,\n  ).then((r) => r.json() as Promise<Array<CommentType>>)\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const commentsPromise = fetchComments(postId)\n    const post = await fetchPostById(postId)\n\n    return {\n      post,\n      commentsPromise: commentsPromise,\n    }\n  },\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return <div>Failed to load post: {(error as any).message}</div>\n  },\n  notFoundComponent: () => {\n    return <div>Post not found</div>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{loaderData().post.title}</h4>\n      <div class=\"text-sm\">{loaderData().post.body}</div>\n      <Await\n        promise={loaderData().commentsPromise}\n        fallback={<div>Loading comments...</div>}\n      >\n        {(comments) => {\n          return (\n            <div class=\"space-y-2\">\n              <h5 class=\"text-lg font-bold underline\">Comments</h5>\n              {comments.map((comment) => {\n                return (\n                  <div>\n                    <h6 class=\"text-md font-bold\">{comment.name}</h6>\n                    <div class=\"text-sm italic opacity-50\">{comment.email}</div>\n                    <div class=\"text-sm\">{comment.body}</div>\n                  </div>\n                )\n              })}\n            </div>\n          )\n        }}\n      </Await>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/routes/posts/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n  wrapInSuspense: true,\n  errorComponent: ({ error }) => {\n    return <div class=\"text-red-500\">Failed to load post: {error.message}</div>\n  },\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/src/routes/posts/route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) =>\n      setTimeout(r, 300 + Math.round(Math.random() * 300)),\n    )\n    return fetch('https://jsonplaceholder.typicode.com/posts')\n      .then((d) => d.json() as Promise<Array<PostType>>)\n      .then((d) => d.slice(0, 10))\n  },\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {posts().map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n        <li class=\"whitespace-nowrap\">\n          <Link\n            to=\"/posts/$postId\"\n            params={{\n              postId: 'does-not-exist',\n            }}\n            class=\"block py-1 text-blue-800 hover:text-blue-600\"\n            activeProps={{ class: 'text-black font-bold' }}\n          >\n            <div>This post does not exist</div>\n          </Link>\n        </li>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"esnext\",\n    \"types\": [\"vite/client\"],\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-file-based/vite.config.ts",
    "content": "import path from 'node:path'\nimport url from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport type { BuildEnvironmentOptions } from 'vite'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\n// SSR configuration\nconst ssrBuildConfig: BuildEnvironmentOptions = {\n  ssr: true,\n  outDir: 'dist/server',\n  ssrEmitAssets: true,\n  copyPublicDir: false,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-server.tsx'),\n    output: {\n      entryFileNames: '[name].js',\n      chunkFileNames: 'assets/[name]-[hash].js',\n      assetFileNames: 'assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// Client-specific configuration\nconst clientBuildConfig: BuildEnvironmentOptions = {\n  outDir: 'dist/client',\n  emitAssets: true,\n  copyPublicDir: true,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-client.tsx'),\n    output: {\n      entryFileNames: 'static/[name].js',\n      chunkFileNames: 'static/assets/[name]-[hash].js',\n      assetFileNames: 'static/assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// https://vitejs.dev/config/\nexport default defineConfig((configEnv) => {\n  return {\n    plugins: [\n      tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n      solid({ ssr: true }),\n    ],\n    build: configEnv.isSsrBuild ? ssrBuildConfig : clientBuildConfig,\n  }\n})\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-ssr-streaming-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"node server\",\n    \"build\": \"npm run build:client && npm run build:server\",\n    \"build:client\": \"vite build\",\n    \"build:server\": \"vite build --ssr\",\n    \"serve\": \"NODE_ENV=production node server\",\n    \"debug\": \"node --inspect-brk server\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"compression\": \"^1.8.0\",\n    \"express\": \"^4.21.2\",\n    \"get-port\": \"^7.1.0\",\n    \"node-fetch\": \"^3.3.2\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@types/express\": \"^4.17.23\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/server.js",
    "content": "import path from 'node:path'\nimport express from 'express'\nimport getPort, { portNumbers } from 'get-port'\nimport * as zlib from 'node:zlib'\n\nconst isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD\n\nexport async function createServer(\n  root = process.cwd(),\n  isProd = process.env.NODE_ENV === 'production',\n  hmrPort,\n) {\n  const app = express()\n\n  /**\n   * @type {import('vite').ViteDevServer}\n   */\n  let vite\n  if (!isProd) {\n    vite = await (\n      await import('vite')\n    ).createServer({\n      root,\n      logLevel: isTest ? 'error' : 'info',\n      server: {\n        middlewareMode: true,\n        watch: {\n          // During tests we edit the files too fast and sometimes chokidar\n          // misses change events, so enforce polling for consistency\n          usePolling: true,\n          interval: 100,\n        },\n        hmr: {\n          port: hmrPort,\n        },\n      },\n      appType: 'custom',\n    })\n    // use vite's connect instance as middleware\n    app.use(vite.middlewares)\n  } else {\n    app.use(\n      (await import('compression')).default({\n        brotli: {\n          flush: zlib.constants.BROTLI_OPERATION_FLUSH,\n        },\n        flush: zlib.constants.Z_SYNC_FLUSH,\n      }),\n    )\n  }\n\n  if (isProd) app.use(express.static('./dist/client'))\n\n  app.use('*', async (req, res) => {\n    try {\n      const url = req.originalUrl\n\n      if (path.extname(url) !== '') {\n        console.warn(`${url} is not valid router path`)\n        res.status(404)\n        res.end(`${url} is not valid router path`)\n        return\n      }\n\n      // Best effort extraction of the head from vite's index transformation hook\n      let viteHead = !isProd\n        ? await vite.transformIndexHtml(\n            url,\n            `<html><head></head><body></body></html>`,\n          )\n        : ''\n\n      viteHead = viteHead.substring(\n        viteHead.indexOf('<head>') + 6,\n        viteHead.indexOf('</head>'),\n      )\n\n      const entry = await (async () => {\n        if (!isProd) {\n          return vite.ssrLoadModule('/src/entry-server.tsx')\n        } else {\n          return import('./dist/server/static/entry-server.js')\n        }\n      })()\n\n      console.info('Rendering: ', url, '...')\n      entry.render({ req, res, head: viteHead })\n    } catch (e) {\n      !isProd && vite.ssrFixStacktrace(e)\n      console.info(e.stack)\n      res.status(500).end(e.stack)\n    }\n  })\n\n  return { app, vite }\n}\n\nif (!isTest) {\n  createServer().then(async ({ app }) =>\n    app.listen(await getPort({ port: portNumbers(3000, 3100) }), () => {\n      console.info('Client Server: http://localhost:3000')\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/entry-client.tsx",
    "content": "import { RouterClient } from '@tanstack/solid-router/ssr/client'\nimport { hydrate } from 'solid-js/web'\nimport { createRouter } from './router'\n\nconst router = createRouter()\n\nhydrate(() => <RouterClient router={router} />, document.body)\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/entry-server.tsx",
    "content": "import { pipeline } from 'node:stream/promises'\nimport {\n  RouterServer,\n  createRequestHandler,\n  renderRouterToStream,\n} from '@tanstack/solid-router/ssr/server'\nimport { createRouter } from './router'\nimport type express from 'express'\nimport './fetch-polyfill'\n\nexport async function render({\n  req,\n  res,\n  head,\n}: {\n  head: string\n  req: express.Request\n  res: express.Response\n}) {\n  // Convert the express request to a fetch request\n  const url = new URL(req.originalUrl || req.url, 'https://localhost:3000').href\n\n  const request = new Request(url, {\n    method: req.method,\n    headers: (() => {\n      const headers = new Headers()\n      for (const [key, value] of Object.entries(req.headers)) {\n        headers.set(key, value as any)\n      }\n      return headers\n    })(),\n  })\n\n  // Create a request handler\n  const handler = createRequestHandler({\n    request,\n    createRouter: () => {\n      const router = createRouter()\n\n      // Update each router instance with the head info from vite\n      router.update({\n        context: {\n          ...router.options.context,\n          head: head,\n        },\n      })\n      return router\n    },\n  })\n\n  // Let's use the default stream handler to create the response\n  const response = await handler(({ request, responseHeaders, router }) =>\n    renderRouterToStream({\n      request,\n      responseHeaders,\n      router,\n      children: () => <RouterServer router={router} />,\n    }),\n  )\n\n  // Convert the fetch response back to an express response\n  res.statusMessage = response.statusText\n  res.status(response.status)\n\n  response.headers.forEach((value, name) => {\n    res.setHeader(name, value)\n  })\n\n  // Stream the response body\n  return pipeline(response.body as any, res)\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/fetch-polyfill.js",
    "content": "// fetch-polyfill.js\nimport fetch, {\n  Blob,\n  blobFrom,\n  blobFromSync,\n  File,\n  fileFrom,\n  fileFromSync,\n  FormData,\n  Headers,\n  Request,\n  Response,\n} from 'node-fetch'\n\nif (!globalThis.fetch) {\n  globalThis.fetch = fetch\n  globalThis.Headers = Headers\n  globalThis.Request = Request\n  globalThis.Response = Response\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as CounterRouteImport } from './routes/counter'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CounterRoute = CounterRouteImport.update({\n  id: '/counter',\n  path: '/counter',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/counter': typeof CounterRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/counter': typeof CounterRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/counter': typeof CounterRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/counter'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/route-a'\n    | '/route-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/counter' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/counter'\n    | '/posts'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  CounterRoute: typeof CounterRoute\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/counter': {\n      id: '/counter'\n      path: '/counter'\n      fullPath: '/counter'\n      preLoaderRoute: typeof CounterRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  CounterRoute: CounterRoute,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/router.tsx",
    "content": "import { createRouter as createSolidRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\n\nexport function createRouter() {\n  return createSolidRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routerContext.tsx",
    "content": "export type RouterContext = {\n  head: string\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/-components/Counter.tsx",
    "content": "import { createSignal } from 'solid-js'\n\nexport default function Counter() {\n  const [count, setCount] = createSignal(0)\n  return (\n    <button\n      class=\"bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-sm\"\n      onClick={() => setCount(count() + 1)}\n      type=\"button\"\n    >\n      Clicks: {count()}\n    </button>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/-components/PostErrorComponent.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport stylesCss from '../styles.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [\n      { rel: 'icon', href: '/images/favicon.ico' },\n      { rel: 'stylesheet', href: stylesCss },\n    ],\n    meta: [\n      {\n        title: 'TanStack Router SSR Basic File Based Streaming',\n      },\n      {\n        charSet: 'UTF-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1.0',\n      },\n    ],\n    scripts: [\n      {\n        type: 'module',\n        src: import.meta.env.PROD\n          ? '/static/entry-client.js'\n          : '/src/entry-client.tsx',\n      },\n    ],\n  }),\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/counter\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Counter\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/counter.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport Counter from './-components/Counter'\n\nexport const Route = createFileRoute('/counter')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <Counter />\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/index.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { Suspense } from 'solid-js'\n\nexport const Route = createFileRoute('/')({\n  loader: () => ({\n    date: new Date(),\n    deferred: new Promise<{ date: Date }>((r) =>\n      setTimeout(() => r({ date: new Date() }), 1000),\n    ),\n  }),\n  component: Home,\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <p>Data: {data().date.getDate()}</p>\n      <Suspense fallback={<div>Loading...</div>}>\n        <Await promise={data().deferred}>\n          {(data) => <p>Deferred: {new Date(data.date).getDate()}</p>}\n        </Await>\n      </Suspense>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport { PostErrorComponent } from './-components/PostErrorComponent'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"types\": [\"vite/client\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "examples/solid/basic-ssr-streaming-file-based/vite.config.js",
    "content": "import url from 'node:url'\nimport path from 'node:path'\nimport { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\n// SSR configuration\nconst ssrBuildConfig = {\n  ssr: true,\n  outDir: 'dist/server',\n  ssrEmitAssets: true,\n  copyPublicDir: false,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-server.tsx'),\n    output: {\n      entryFileNames: 'static/[name].js',\n      chunkFileNames: 'static/assets/[name]-[hash].js',\n      assetFileNames: 'static/assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// Client-specific configuration\nconst clientBuildConfig = {\n  outDir: 'dist/client',\n  emitAssets: true,\n  copyPublicDir: true,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/entry-client.tsx'),\n    output: {\n      entryFileNames: 'static/[name].js',\n      chunkFileNames: 'static/assets/[name]-[hash].js',\n      assetFileNames: 'static/assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// https://vitejs.dev/config/\nexport default defineConfig((configEnv) => {\n  return {\n    plugins: [\n      tailwindcss(),\n      tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n      solid({ ssr: true }),\n    ],\n    build: configEnv.isSsrBuild ? ssrBuildConfig : clientBuildConfig,\n  }\n})\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-virtual-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/virtual-file-routes\": \"^1.161.7\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('home.tsx'),\n  route('/posts', 'posts/posts.tsx', [\n    index('posts/posts-home.tsx'),\n    route('$postId', 'posts/posts-detail.tsx'),\n  ]),\n  layout('first', 'layout/first-layout.tsx', [\n    layout('layout/second-layout.tsx', [\n      route('route-without-file', [\n        route('/layout-a', 'a.tsx'),\n        route('/layout-b', 'b.tsx'),\n      ]),\n    ]),\n  ]),\n  physical('/classic', 'file-based-subtree'),\n])\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/solid-router'\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as postsPostsRouteImport } from './routes/posts/posts'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home'\nimport { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route'\nimport { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index'\nimport { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world'\nimport { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst postsPostsRoute = postsPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsPostsDetailRoute = postsPostsDetailRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second-layout',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst postsPostsHomeRoute = postsPostsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => postsPostsRoute,\n} as any)\nconst ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({\n  id: '/classic/hello',\n  path: '/classic/hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({\n  id: '/world',\n  path: '/world',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({\n  id: '/universe',\n  path: '/universe',\n  getParentRoute: () => ClassicHelloRouteRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/route-without-file/layout-b',\n  path: '/route-without-file/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/route-without-file/layout-a',\n  path: '/route-without-file/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/posts': typeof postsPostsHomeRoute\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello': typeof ClassicHelloIndexRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/posts': typeof postsPostsRouteWithChildren\n  '/classic/hello': typeof ClassicHelloRouteRouteWithChildren\n  '/posts/': typeof postsPostsHomeRoute\n  '/_first/_second-layout': typeof layoutSecondLayoutRouteWithChildren\n  '/posts/$postId': typeof postsPostsDetailRoute\n  '/classic/hello/universe': typeof ClassicHelloUniverseRoute\n  '/classic/hello/world': typeof ClassicHelloWorldRoute\n  '/classic/hello/': typeof ClassicHelloIndexRoute\n  '/_first/_second-layout/route-without-file/layout-a': typeof aRoute\n  '/_first/_second-layout/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/posts'\n    | '/classic/hello'\n    | '/posts/'\n    | '/_first/_second-layout'\n    | '/posts/$postId'\n    | '/classic/hello/universe'\n    | '/classic/hello/world'\n    | '/classic/hello/'\n    | '/_first/_second-layout/route-without-file/layout-a'\n    | '/_first/_second-layout/route-without-file/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n  postsPostsRoute: typeof postsPostsRouteWithChildren\n  ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsPostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsPostsDetailRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/_first/_second-layout': {\n      id: '/_first/_second-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsPostsHomeRouteImport\n      parentRoute: typeof postsPostsRoute\n    }\n    '/classic/hello': {\n      id: '/classic/hello'\n      path: '/classic/hello'\n      fullPath: '/classic/hello'\n      preLoaderRoute: typeof ClassicHelloRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/classic/hello/': {\n      id: '/classic/hello/'\n      path: '/'\n      fullPath: '/classic/hello/'\n      preLoaderRoute: typeof ClassicHelloIndexRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/world': {\n      id: '/classic/hello/world'\n      path: '/world'\n      fullPath: '/classic/hello/world'\n      preLoaderRoute: typeof ClassicHelloWorldRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/classic/hello/universe': {\n      id: '/classic/hello/universe'\n      path: '/universe'\n      fullPath: '/classic/hello/universe'\n      preLoaderRoute: typeof ClassicHelloUniverseRouteImport\n      parentRoute: typeof ClassicHelloRouteRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-b': {\n      id: '/_first/_second-layout/route-without-file/layout-b'\n      path: '/route-without-file/layout-b'\n      fullPath: '/route-without-file/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-a': {\n      id: '/_first/_second-layout/route-without-file/layout-a'\n      path: '/route-without-file/layout-a'\n      fullPath: '/route-without-file/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ndeclare module './routes/home' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/layout/first-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first',\n    FileRoutesByPath['/_first']['parentRoute'],\n    FileRoutesByPath['/_first']['id'],\n    FileRoutesByPath['/_first']['path'],\n    FileRoutesByPath['/_first']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/route' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello',\n    FileRoutesByPath['/classic/hello']['parentRoute'],\n    FileRoutesByPath['/classic/hello']['id'],\n    FileRoutesByPath['/classic/hello']['path'],\n    FileRoutesByPath['/classic/hello']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/layout/second-layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second-layout',\n    FileRoutesByPath['/_first/_second-layout']['parentRoute'],\n    FileRoutesByPath['/_first/_second-layout']['id'],\n    FileRoutesByPath['/_first/_second-layout']['path'],\n    FileRoutesByPath['/_first/_second-layout']['fullPath']\n  >\n}\ndeclare module './routes/posts/posts-detail' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/universe' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/universe',\n    FileRoutesByPath['/classic/hello/universe']['parentRoute'],\n    FileRoutesByPath['/classic/hello/universe']['id'],\n    FileRoutesByPath['/classic/hello/universe']['path'],\n    FileRoutesByPath['/classic/hello/universe']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/world' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/world',\n    FileRoutesByPath['/classic/hello/world']['parentRoute'],\n    FileRoutesByPath['/classic/hello/world']['id'],\n    FileRoutesByPath['/classic/hello/world']['path'],\n    FileRoutesByPath['/classic/hello/world']['fullPath']\n  >\n}\ndeclare module './routes/file-based-subtree/hello/index' {\n  const createFileRoute: CreateFileRoute<\n    '/classic/hello/',\n    FileRoutesByPath['/classic/hello/']['parentRoute'],\n    FileRoutesByPath['/classic/hello/']['id'],\n    FileRoutesByPath['/classic/hello/']['path'],\n    FileRoutesByPath['/classic/hello/']['fullPath']\n  >\n}\ndeclare module './routes/a' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second-layout/route-without-file/layout-a',\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-a']['parentRoute'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-a']['id'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-a']['path'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/b' {\n  const createFileRoute: CreateFileRoute<\n    '/_first/_second-layout/route-without-file/layout-b',\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-b']['parentRoute'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-b']['id'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-b']['path'],\n    FileRoutesByPath['/_first/_second-layout/route-without-file/layout-b']['fullPath']\n  >\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\ninterface postsPostsRouteChildren {\n  postsPostsHomeRoute: typeof postsPostsHomeRoute\n  postsPostsDetailRoute: typeof postsPostsDetailRoute\n}\n\nconst postsPostsRouteChildren: postsPostsRouteChildren = {\n  postsPostsHomeRoute: postsPostsHomeRoute,\n  postsPostsDetailRoute: postsPostsDetailRoute,\n}\n\nconst postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(\n  postsPostsRouteChildren,\n)\n\ninterface ClassicHelloRouteRouteChildren {\n  ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute\n  ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute\n  ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute\n}\n\nconst ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {\n  ClassicHelloUniverseRoute: ClassicHelloUniverseRoute,\n  ClassicHelloWorldRoute: ClassicHelloWorldRoute,\n  ClassicHelloIndexRoute: ClassicHelloIndexRoute,\n}\n\nconst ClassicHelloRouteRouteWithChildren =\n  ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n  postsPostsRoute: postsPostsRouteWithChildren,\n  ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>This is the index</div>,\n})\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: () => (\n    <div>\n      Hello!\n      <br />{' '}\n      <Link\n        to=\"/classic/hello/universe\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the universe\n      </Link>{' '}\n      <Link\n        to=\"/classic/hello/world\"\n        activeProps={{\n          class: 'font-bold',\n        }}\n      >\n        say hello to the world\n      </Link>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/universe!</div>,\n})\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /classic/hello/world!</div>,\n})\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/home.tsx",
    "content": "export const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/layout/first-layout.tsx",
    "content": "import { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/layout/second-layout.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-without-file/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/route-without-file/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/posts/posts-detail.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/posts/posts-home.tsx",
    "content": "export const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/posts/posts.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/routes/root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-without-file/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          to=\"/classic/hello\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Subtree\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"Preserve\",\n    \"moduleResolution\": \"Bundler\",\n    \"target\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n      virtualRouteConfig: './routes.ts',\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-basic-virtual-inside-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/virtual-file-routes\": \"^1.161.7\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/solid-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as postsDetailsRouteImport } from './routes/posts/details'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as postsHomeRouteImport } from './routes/posts/home'\nimport { Route as postsLetsGoIndexRouteImport } from './routes/posts/lets-go/index'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as postsLetsGoDeeperHomeRouteImport } from './routes/posts/lets-go/deeper/home'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsDetailsRoute = postsDetailsRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst postsHomeRoute = postsHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst postsLetsGoIndexRoute = postsLetsGoIndexRouteImport.update({\n  id: '/inception/',\n  path: '/inception/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst postsLetsGoDeeperHomeRoute = postsLetsGoDeeperHomeRouteImport.update({\n  id: '/inception/deeper/',\n  path: '/inception/deeper/',\n  getParentRoute: () => PostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/': typeof postsHomeRoute\n  '/posts/$postId': typeof postsDetailsRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/inception/': typeof postsLetsGoIndexRoute\n  '/posts/inception/deeper/': typeof postsLetsGoDeeperHomeRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof postsHomeRoute\n  '/posts/$postId': typeof postsDetailsRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/inception': typeof postsLetsGoIndexRoute\n  '/posts/inception/deeper': typeof postsLetsGoDeeperHomeRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/posts': typeof PostsRouteWithChildren\n  '/posts/': typeof postsHomeRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof postsDetailsRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/inception/': typeof postsLetsGoIndexRoute\n  '/posts/inception/deeper/': typeof postsLetsGoDeeperHomeRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/posts/'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/inception/'\n    | '/posts/inception/deeper/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/posts'\n    | '/posts/$postId'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/inception'\n    | '/posts/inception/deeper'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/posts'\n    | '/posts/'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/posts/inception/'\n    | '/posts/inception/deeper/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  PostsRoute: typeof PostsRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof postsDetailsRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof postsHomeRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/inception/': {\n      id: '/posts/inception/'\n      path: '/inception'\n      fullPath: '/posts/inception/'\n      preLoaderRoute: typeof postsLetsGoIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/posts/inception/deeper/': {\n      id: '/posts/inception/deeper/'\n      path: '/inception/deeper'\n      fullPath: '/posts/inception/deeper/'\n      preLoaderRoute: typeof postsLetsGoDeeperHomeRouteImport\n      parentRoute: typeof PostsRoute\n    }\n  }\n}\n\ndeclare module './routes/index' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/_layout' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout',\n    FileRoutesByPath['/_layout']['parentRoute'],\n    FileRoutesByPath['/_layout']['id'],\n    FileRoutesByPath['/_layout']['path'],\n    FileRoutesByPath['/_layout']['fullPath']\n  >\n}\ndeclare module './routes/posts' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/posts/home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2',\n    FileRoutesByPath['/_layout/_layout-2']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2']['id'],\n    FileRoutesByPath['/_layout/_layout-2']['path'],\n    FileRoutesByPath['/_layout/_layout-2']['fullPath']\n  >\n}\ndeclare module './routes/posts/details' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId',\n    FileRoutesByPath['/posts/$postId']['parentRoute'],\n    FileRoutesByPath['/posts/$postId']['id'],\n    FileRoutesByPath['/posts/$postId']['path'],\n    FileRoutesByPath['/posts/$postId']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2/layout-a' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2/layout-a',\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['id'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['path'],\n    FileRoutesByPath['/_layout/_layout-2/layout-a']['fullPath']\n  >\n}\ndeclare module './routes/_layout/_layout-2/layout-b' {\n  const createFileRoute: CreateFileRoute<\n    '/_layout/_layout-2/layout-b',\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['parentRoute'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['id'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['path'],\n    FileRoutesByPath['/_layout/_layout-2/layout-b']['fullPath']\n  >\n}\ndeclare module './routes/posts/lets-go/index' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/inception/',\n    FileRoutesByPath['/posts/inception/']['parentRoute'],\n    FileRoutesByPath['/posts/inception/']['id'],\n    FileRoutesByPath['/posts/inception/']['path'],\n    FileRoutesByPath['/posts/inception/']['fullPath']\n  >\n}\ndeclare module './routes/posts/lets-go/deeper/home' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/inception/deeper/',\n    FileRoutesByPath['/posts/inception/deeper/']['parentRoute'],\n    FileRoutesByPath['/posts/inception/deeper/']['id'],\n    FileRoutesByPath['/posts/inception/deeper/']['path'],\n    FileRoutesByPath['/posts/inception/deeper/']['fullPath']\n  >\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  postsHomeRoute: typeof postsHomeRoute\n  postsDetailsRoute: typeof postsDetailsRoute\n  postsLetsGoIndexRoute: typeof postsLetsGoIndexRoute\n  postsLetsGoDeeperHomeRoute: typeof postsLetsGoDeeperHomeRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  postsHomeRoute: postsHomeRoute,\n  postsDetailsRoute: postsDetailsRoute,\n  postsLetsGoIndexRoute: postsLetsGoIndexRoute,\n  postsLetsGoDeeperHomeRoute: postsLetsGoDeeperHomeRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  PostsRoute: PostsRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "export const Route = createFileRoute({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/layout-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout A\n        </Link>\n        <Link\n          to=\"/layout-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/_layout.tsx",
    "content": "import { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/posts/__virtual.ts",
    "content": "import {\n  defineVirtualSubtreeConfig,\n  index,\n  physical,\n  route,\n} from '@tanstack/virtual-file-routes'\n\n// this just shows that you can use an async function to define your virtual routes\nexport default defineVirtualSubtreeConfig(async () => [\n  index('home.tsx'),\n  route('$postId', 'details.tsx'),\n  physical('/inception', 'lets-go'),\n])\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/posts/details.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport { fetchPost } from '../../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/posts/home.tsx",
    "content": "export const Route = createFileRoute({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/posts/lets-go/deeper/__virtual.ts",
    "content": "import {\n  defineVirtualSubtreeConfig,\n  index,\n} from '@tanstack/virtual-file-routes'\n\nexport default defineVirtualSubtreeConfig([index('home.tsx')])\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/posts/lets-go/deeper/home.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /posts/inception/deeper/!</div>,\n})\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/posts/lets-go/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /posts/inception/!</div>,\n})\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/routes/posts.tsx",
    "content": "import { Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"module\": \"Preserve\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/basic-virtual-inside-file-based/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/deferred-data/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/deferred-data/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/deferred-data/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/deferred-data/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/deferred-data/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/deferred-data/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-deferred-data\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/deferred-data/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { Suspense } from 'solid-js'\nimport {\n  Await,\n  ErrorComponent,\n  Link,\n  MatchRoute,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  defer,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport axios from 'redaxios'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport './styles.css'\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\ntype CommentType = {\n  id: string\n  postId: string\n  name: string\n  email: string\n  body: string\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 100))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n\n  const commentsPromise = new Promise((r) => setTimeout(r, 2000))\n    .then(() =>\n      axios.get<Array<CommentType>>(\n        `https://jsonplaceholder.typicode.com/comments?postId=${postId}`,\n      ),\n    )\n    .then((r) => r.data)\n\n  const post = await new Promise((r) => setTimeout(r, 1000))\n    .then(() =>\n      axios.get<PostType>(\n        `https://jsonplaceholder.typicode.com/posts/${postId}`,\n      ),\n    )\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n    .then((r) => r.data)\n\n  return {\n    post,\n    commentsPromise: defer(commentsPromise),\n  }\n}\n\nfunction Spinner({ show, wait }: { show?: boolean; wait?: `delay-${number}` }) {\n  return (\n    <div\n      class={`inline-block animate-spin px-3 transition ${\n        (show ?? true)\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n}).update({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = postsRoute.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to={postRoute.to}\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"flex py-1 text-blue-600 hover:opacity-75 gap-2 items-center\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                  <MatchRoute\n                    to={postRoute.to}\n                    params={{\n                      postId: post.id,\n                    }}\n                    pending\n                  >\n                    {(match) => {\n                      return <Spinner show={!!match} wait=\"delay-0\" />\n                    }}\n                  </MatchRoute>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nclass NotFoundError extends Error {}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const loaderData = postRoute.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{loaderData().post.title}</h4>\n      <div class=\"text-sm\">{loaderData().post.body}</div>\n      <Suspense\n        fallback={\n          <div class=\"flex items-center gap-2\">\n            <Spinner />\n            Loading comments...\n          </div>\n        }\n      >\n        <Await promise={loaderData().commentsPromise}>\n          {(comments) => {\n            return (\n              <div class=\"space-y-2\">\n                <h5 class=\"text-lg font-bold underline\">Comments</h5>\n                {comments.map((comment) => {\n                  return (\n                    <div>\n                      <h6 class=\"text-md font-bold\">{comment.name}</h6>\n                      <div class=\"text-sm italic opacity-50\">\n                        {comment.email}\n                      </div>\n                      <div class=\"text-sm\">{comment.body}</div>\n                    </div>\n                  )\n                })}\n              </div>\n            )\n          }}\n        </Await>\n      </Suspense>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/deferred-data/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/deferred-data/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/deferred-data/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\ncount.txt\n.env\n.nitro\n.tanstack\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/README.md",
    "content": "# TanStack Router example\n\nThis example shows how to use Paraglide with TanStack Router.\n\n## Getting started\n\n1. Init Paraglide JS\n\n```bash\nnpx @inlang/paraglide-js@latest init\n```\n\n2. Add the vite plugin to your `vite.config.ts`:\n\n```diff\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n+import { paraglideVitePlugin } from \"@inlang/paraglide-js\";\n\nexport default defineConfig({\n\tplugins: [\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n+\t\tparaglideVitePlugin({\n+\t\t\tproject: \"./project.inlang\",\n+\t\t\toutdir: \"./app/paraglide\",\n+\t\t}),\n\t],\n});\n```\n\n3. Done :)\n\nRun the app and start translating. See the [basics documentation](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/basics) for information on how to use Paraglide's messages, parameters, and locale management.\n\n## Rewrite URL\n\nIf you want to handle how the URL looks when the user changes the locale, you can rewrite the URL in the router.\n\n```diff\nimport { createRouter } from \"@tanstack/solid-router\";\nimport { routeTree } from \"./routeTree.gen\";\n+import { deLocalizeUrl, localizeUrl } from \"./paraglide/runtime.js\";\n\nconst router = createRouter({\n  routeTree,\n+ rewrite: {\n+   input: ({ url }) => deLocalizeUrl(url),\n+   output: ({ url }) => localizeUrl(url),\n  },\n});\n```\n\nIn `__root.tsx` add a `beforeLoad` hook to check if the user should be redirected and set the html `lang` attribute.\n\n```ts\nimport { shouldRedirect } from \"../paraglide/runtime\";\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    document.documentElement.setAttribute(\"lang\", getLocale());\n\n    const decision = await shouldRedirect({ url: window.location.href });\n\n    if (decision.redirectUrl) {\n      throw redirect({ href: decision.redirectUrl.href });\n    }\n  },\n  ...\n});\n```\n\n## Typesafe translated pathnames\n\nIf you don't want to miss any translated path, you can create a `createTranslatedPathnames` function and pass it to the vite plugin.\n\n```ts\nimport { Locale } from '@/paraglide/runtime'\nimport { FileRoutesByTo } from '../routeTree.gen'\n\ntype RoutePath = keyof FileRoutesByTo\n\nconst excludedPaths = ['admin', 'docs', 'api'] as const\n\ntype PublicRoutePath = Exclude<\n  RoutePath,\n  `${string}${(typeof excludedPaths)[number]}${string}`\n>\n\ntype TranslatedPathname = {\n  pattern: string\n  localized: Array<[Locale, string]>\n}\n\nfunction toUrlPattern(path: string) {\n  return (\n    path\n      // catch-all\n      .replace(/\\/\\$$/, '/:path(.*)?')\n      // optional parameters: {-$param}\n      .replace(/\\{-\\$([a-zA-Z0-9_]+)\\}/g, ':$1?')\n      // named parameters: $param\n      .replace(/\\$([a-zA-Z0-9_]+)/g, ':$1')\n      // remove trailing slash\n      .replace(/\\/+$/, '')\n  )\n}\n\nfunction createTranslatedPathnames(\n  input: Record<PublicRoutePath, Record<Locale, string>>,\n): TranslatedPathname[] {\n  return Object.entries(input).map(([pattern, locales]) => ({\n    pattern: toUrlPattern(pattern),\n    localized: Object.entries(locales).map(\n      ([locale, path]) =>\n        [locale as Locale, `/${locale}${toUrlPattern(path)}`] satisfies [\n          Locale,\n          string,\n        ],\n    ),\n  }))\n}\n\nexport const translatedPathnames = createTranslatedPathnames({\n  '/': {\n    en: '/',\n    de: '/',\n  },\n  '/about': {\n    en: '/about',\n    de: '/ueber',\n  },\n})\n```\n\nAnd import into the Paraglide Vite plguin.\n\n## Server side rendering\n\nFor server side rendering, check out the [TanStack Start guide](https://github.com/TanStack/router/tree/main/examples/react/start-i18n-paraglide).\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/index.html",
    "content": "<!doctype html>\n<html>\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <link rel=\"icon\" href=\"/favicon.ico\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <meta\n      name=\"description\"\n      content=\"Web site created using create-tsrouter-app\"\n    />\n    <link rel=\"apple-touch-icon\" href=\"/logo192.png\" />\n    <link rel=\"manifest\" href=\"/manifest.json\" />\n    <title>Create TanStack App - i18n-paraglide</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/messages/de.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Guten Tag {username}\",\n  \"hello_about\": \"Hallo /ueber!\",\n  \"home_page\": \"Startseite\",\n  \"about_page\": \"Über uns\"\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/messages/en.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Hello world {username}\",\n  \"hello_about\": \"Hello /about!\",\n  \"home_page\": \"Home page\",\n  \"about_page\": \"About page\"\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-i18n-paraglide\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"start\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc\",\n    \"preview\": \"vite preview\",\n    \"test\": \"vitest run\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.18.6\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.9.2\",\n    \"vite\": \"^8.0.0\",\n    \"@inlang/paraglide-js\": \"^2.4.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/project.inlang/.gitignore",
    "content": "cache"
  },
  {
    "path": "examples/solid/i18n-paraglide/project.inlang/project_id",
    "content": "72AJsIR0c0ewzkN33F"
  },
  {
    "path": "examples/solid/i18n-paraglide/project.inlang/settings.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/project-settings\",\n  \"baseLocale\": \"en\",\n  \"locales\": [\"en\", \"de\"],\n  \"modules\": [\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js\",\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js\"\n  ],\n  \"plugin.inlang.messageFormat\": {\n    \"pathPattern\": \"./messages/{locale}.json\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/public/manifest.json",
    "content": "{\n  \"short_name\": \"TanStack App\",\n  \"name\": \"Create TanStack App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport './styles.css'\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport { deLocalizeUrl, localizeUrl } from './paraglide/runtime.js'\n\n// Create a new router instance\nconst router = createRouter({\n  routeTree,\n  context: {},\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  defaultStructuralSharing: true,\n  defaultPreloadStaleTime: 0,\n\n  rewrite: {\n    input: ({ url }) => deLocalizeUrl(url),\n    output: ({ url }) => localizeUrl(url),\n  },\n})\n\n// Register the router instance for type safety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute, redirect } from '@tanstack/solid-router'\nimport {\n  getLocale,\n  locales,\n  setLocale,\n  shouldRedirect,\n} from '@/paraglide/runtime'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    document.documentElement.setAttribute('lang', getLocale())\n\n    const decision = await shouldRedirect({ url: window.location.href })\n\n    if (decision.redirectUrl) {\n      throw redirect({ href: decision.redirectUrl.href })\n    }\n  },\n  component: () => (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg justify-between\">\n        <div class=\"flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            {m.home_page()}\n          </Link>\n\n          <Link\n            to=\"/about\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            {m.about_page()}\n          </Link>\n        </div>\n\n        <div class=\"flex gap-2 text-lg\">\n          {locales.map((locale) => (\n            <button\n              onClick={() => setLocale(locale)}\n              data-active-locale={locale === getLocale()}\n              class=\"rounded p-1 px-2 border border-gray-300 cursor-pointer [&[data-active-locale=true]]:bg-gray-500 [&[data-active-locale=true]]:text-white\"\n            >\n              {locale}\n            </button>\n          ))}\n        </div>\n      </div>\n\n      <hr />\n\n      <div class=\"p-2\">\n        <Outlet />\n      </div>\n    </>\n  ),\n})\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>{m.hello_about()}</div>\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n\nfunction App() {\n  return (\n    <div>\n      <p>\n        {m.example_message({\n          username: 'TanStack Router!',\n        })}\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"types\": [\"vite/client\"],\n    \"allowJs\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": true,\n    \"noEmit\": true,\n\n    /* Linting */\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedSideEffectImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  }\n}\n"
  },
  {
    "path": "examples/solid/i18n-paraglide/vite.config.ts",
    "content": "import { resolve } from 'node:path'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport { paraglideVitePlugin } from '@inlang/paraglide-js'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    paraglideVitePlugin({\n      project: './project.inlang',\n      outdir: './src/paraglide',\n      outputStructure: 'message-modules',\n      cookieName: 'PARAGLIDE_LOCALE',\n      strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'],\n      urlPatterns: [\n        {\n          pattern: '/',\n          localized: [\n            ['en', '/'],\n            ['de', '/de'],\n          ],\n        },\n        {\n          pattern: '/about',\n          localized: [\n            ['en', '/about'],\n            ['de', '/de/ueber'],\n          ],\n        },\n        {\n          pattern: '/:path(.*)?',\n          localized: [\n            ['en', '/:path(.*)?'],\n            ['de', '/de/:path(.*)?'],\n          ],\n        },\n      ],\n    }),\n    tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n    viteSolid(),\n  ],\n  resolve: {\n    alias: {\n      '@': resolve(__dirname, './src'),\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/kitchen-sink/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/kitchen-sink/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/kitchen-sink/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-kitchen-sink\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"immer\": \"^10.1.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/src/Expensive.tsx",
    "content": "export default function Expensive() {\n  return (\n    <div class={`p-2`}>\n      I am an \"expensive\" component... which really just means that I was\n      code-split 😉\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/src/main.tsx",
    "content": "/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  Link,\n  MatchRoute,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  lazyRouteComponent,\n  redirect,\n  retainSearchParams,\n  useNavigate,\n  useRouter,\n  useRouterState,\n  useSearch,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport {\n  createEffect,\n  createMemo,\n  createRenderEffect,\n  createSignal,\n  on,\n} from 'solid-js'\nimport { z } from 'zod'\nimport {\n  fetchInvoiceById,\n  fetchInvoices,\n  fetchUserById,\n  fetchUsers,\n  patchInvoice,\n  postInvoice,\n} from './mockTodos'\nimport { useMutation } from './useMutation'\nimport type { Invoice } from './mockTodos'\nimport './styles.css'\n\n//\n\ntype UsersViewSortBy = 'name' | 'id' | 'email'\n\nconst rootRoute = createRootRouteWithContext<{\n  auth: Auth\n}>()({\n  component: RootComponent,\n})\n\nfunction RouterSpinner() {\n  const isLoading = useRouterState({ select: (s) => s.status === 'pending' })\n  return <Spinner show={isLoading()} />\n}\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class={`min-h-screen flex flex-col`}>\n        <div class={`flex items-center border-b gap-2`}>\n          <h1 class={`text-3xl p-2`}>Kitchen Sink</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div class={`text-3xl`}>\n            <RouterSpinner />\n          </div>\n        </div>\n        <div class={`flex-1 flex`}>\n          <div class={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n                ['/expensive', 'Expensive'],\n                ['/route-a', 'Pathless Layout A'],\n                ['/route-b', 'Pathless Layout B'],\n                ['/profile', 'Profile'],\n                ...(auth.status === 'loggedOut' ? [['/login', 'Login']] : []),\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    class={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ class: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div class={`flex-1 border-l`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class={`p-2`}>\n      <div class={`text-lg`}>Welcome Home!</div>\n      <hr class={`my-2`} />\n      <Link\n        to={invoiceRoute.to}\n        params={{\n          invoiceId: 3,\n        }}\n        class={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr class={`my-2`} />\n      <div class={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr class={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr class={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n\nconst dashboardLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'dashboard',\n  component: DashboardLayoutComponent,\n})\n\nfunction DashboardLayoutComponent() {\n  return (\n    <>\n      <div class=\"flex items-center border-b\">\n        <h2 class=\"text-xl p-2\">Dashboard</h2>\n      </div>\n      <div class=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['/dashboard', 'Summary', true],\n            ['/dashboard/invoices', 'Invoices'],\n            ['/dashboard/users', 'Users'],\n          ] as const\n        ).map(([to, label, exact]) => {\n          return (\n            <Link\n              to={to}\n              activeOptions={{ exact }}\n              activeProps={{ class: `font-bold` }}\n              class=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n\nconst dashboardIndexRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: '/',\n  loader: () => fetchInvoices(),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const invoices = dashboardIndexRoute.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{invoices.length} total invoices</strong>.\n      </div>\n    </div>\n  )\n}\n\nconst invoicesLayoutRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: 'invoices',\n  loader: () => fetchInvoices(),\n  component: InvoicesLayoutComponent,\n})\n\nfunction InvoicesLayoutComponent() {\n  const invoices = invoicesLayoutRoute.useLoaderData()\n\n  return (\n    <div class=\"flex-1 flex\">\n      <div class=\"divide-y w-48\">\n        {invoices().map((invoice) => {\n          return (\n            <div>\n              <Link\n                to=\"/dashboard/invoices/$invoiceId\"\n                params={{\n                  invoiceId: invoice.id,\n                }}\n                preload=\"intent\"\n                class=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ class: `font-bold ` }}\n              >\n                <pre class=\"text-sm\">\n                  #{invoice.id} - {invoice.title.slice(0, 10)}{' '}\n                  {/* {updateSubmission ? (\n                      <Spinner />\n                    ) : ( */}\n                  <MatchRoute\n                    to={invoiceRoute.to}\n                    params={{\n                      invoiceId: invoice.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                  {/* )} */}\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div class=\"flex-1 border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesLayoutRoute,\n  path: '/',\n  component: InvoicesIndexComponent,\n})\n\nfunction InvoicesIndexComponent() {\n  const createInvoiceMutation = useMutation({\n    fn: postInvoice,\n    onSuccess: () => router.invalidate(),\n  })\n\n  return (\n    <>\n      <div class=\"p-2\">\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n            createInvoiceMutation.mutate({\n              title: formData.get('title') as string,\n              body: formData.get('body') as string,\n            })\n          }}\n          class=\"space-y-2\"\n        >\n          <div>Create a new Invoice:</div>\n          <InvoiceFields invoice={{} as Invoice} />\n          <div>\n            <button\n              class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              disabled={createInvoiceMutation.status === 'pending'}\n            >\n              {createInvoiceMutation.status === 'pending' ? (\n                <>\n                  Creating <Spinner />\n                </>\n              ) : (\n                'Create'\n              )}\n            </button>\n          </div>\n          {createInvoiceMutation.status === 'success' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Created!\n            </div>\n          ) : createInvoiceMutation.status === 'error' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to create.\n            </div>\n          ) : null}\n        </form>\n      </div>\n    </>\n  )\n}\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesLayoutRoute,\n  path: '$invoiceId',\n  params: {\n    parse: (params) => ({\n      invoiceId: z.number().int().parse(Number(params.invoiceId)),\n    }),\n    stringify: ({ invoiceId }) => ({ invoiceId: `${invoiceId}` }),\n  },\n  validateSearch: (search) =>\n    z\n      .object({\n        showNotes: z.boolean().optional(),\n        notes: z.string().optional(),\n      })\n      .parse(search),\n  loader: ({ params: { invoiceId } }) => fetchInvoiceById(invoiceId),\n  component: InvoiceComponent,\n  pendingComponent: () => <Spinner />,\n})\n\nfunction InvoiceComponent() {\n  const search = invoiceRoute.useSearch()\n  const navigate = useNavigate({ from: invoiceRoute.fullPath })\n  const invoice = invoiceRoute.useLoaderData()\n  const updateInvoiceMutation = useMutation({\n    fn: patchInvoice,\n    onSuccess: () => router.invalidate(),\n  })\n  const [notes, setNotes] = createSignal(search().notes ?? '')\n  createEffect(\n    on(notes, () => {\n      navigate({\n        search: (old) => ({\n          ...old,\n          notes: notes() ? notes() : undefined,\n        }),\n        params: true,\n        replace: true,\n      })\n    }),\n  )\n\n  return (\n    <form\n      onSubmit={(event) => {\n        event.preventDefault()\n        event.stopPropagation()\n        const formData = new FormData(event.target as HTMLFormElement)\n        updateInvoiceMutation.mutate({\n          id: invoice().id,\n          title: formData.get('title') as string,\n          body: formData.get('body') as string,\n        })\n      }}\n      class=\"p-2 space-y-2\"\n    >\n      <InvoiceFields\n        invoice={invoice()}\n        disabled={updateInvoiceMutation.status === 'pending'}\n      />\n      <div>\n        <Link\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          class=\"text-blue-700\"\n          from={invoiceRoute.fullPath}\n          params={true}\n        >\n          {search().showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search().showNotes ? (\n          <>\n            <div>\n              <div class=\"h-2\" />\n              <textarea\n                value={notes()}\n                onChange={(e) => {\n                  setNotes(e.target.value)\n                }}\n                rows={5}\n                class=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div class=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n      <div>\n        <button\n          class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n          disabled={updateInvoiceMutation.status === 'pending'}\n        >\n          Save\n        </button>\n      </div>\n      {updateInvoiceMutation.variables?.id === invoice().id ? (\n        <div>\n          {updateInvoiceMutation.status === 'success' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Saved!\n            </div>\n          ) : updateInvoiceMutation.status === 'error' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to save.\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n    </form>\n  )\n}\n\nconst usersLayoutRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: 'users',\n  validateSearch: z.object({\n    usersView: z\n      .object({\n        sortBy: z.enum(['name', 'id', 'email']).optional(),\n        filterBy: z.string().optional(),\n      })\n      .optional(),\n  }).parse,\n  search: {\n    // Retain the usersView search param while navigating\n    // within or to this route (or it's children!)\n    middlewares: [retainSearchParams(['usersView'])],\n  },\n  loaderDeps: ({ search: { usersView } }) => ({\n    filterBy: usersView?.filterBy,\n    sortBy: usersView?.sortBy ?? 'name',\n  }),\n  loader: ({ deps }) => fetchUsers(deps),\n  component: UsersLayoutComponent,\n})\n\nfunction UsersLayoutComponent() {\n  const navigate = useNavigate({ from: usersLayoutRoute.fullPath })\n  const search = usersLayoutRoute.useSearch()\n  const users = usersLayoutRoute.useLoaderData()\n  const sortBy = search().usersView?.sortBy ?? 'name'\n  const filterBy = search().usersView?.filterBy\n\n  const [filterDraft, setFilterDraft] = createSignal(filterBy ?? '')\n\n  createEffect(\n    on(\n      () => filterBy,\n      () => {\n        setFilterDraft(filterBy ?? '')\n      },\n    ),\n  )\n\n  const sortedUsers = createMemo(() => {\n    if (!users) return []\n\n    return !sortBy\n      ? users()\n      : [...users()].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n  }, [users, sortBy])\n\n  const filteredUsers = createMemo(() => {\n    if (!filterBy) return sortedUsers()\n\n    return sortedUsers().filter((user) =>\n      user.name.toLowerCase().includes(filterBy.toLowerCase()),\n    )\n  }, [sortedUsers, filterBy])\n\n  const setSortBy = (sortBy: UsersViewSortBy) =>\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...(old.usersView ?? {}),\n            sortBy,\n          },\n        }\n      },\n      replace: true,\n    })\n\n  createEffect(\n    on(filterDraft, () => {\n      navigate({\n        search: (old) => {\n          return {\n            ...old,\n            usersView: {\n              ...old.usersView,\n              filterBy: filterDraft() || undefined,\n            },\n          }\n        },\n        replace: true,\n      })\n    }),\n  )\n\n  return (\n    <div class=\"flex-1 flex\">\n      <div class=\"divide-y\">\n        <div class=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Sort By:</div>\n          <select\n            value={sortBy}\n            onChange={(e) => setSortBy(e.target.value as UsersViewSortBy)}\n            class=\"flex-1 border p-1 px-2 rounded-sm\"\n          >\n            {['name', 'id', 'email'].map((d) => {\n              return <option value={d} children={d} />\n            })}\n          </select>\n        </div>\n        <div class=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Filter By:</div>\n          <input\n            value={filterDraft()}\n            onChange={(e) => setFilterDraft(e.target.value)}\n            placeholder=\"Search Names...\"\n            class=\"min-w-0 flex-1 border p-1 px-2 rounded-sm\"\n          />\n        </div>\n        {filteredUsers().map((user) => {\n          return (\n            <div>\n              <Link\n                to=\"/dashboard/users/user\"\n                search={{\n                  userId: user.id,\n                }}\n                class=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ class: `font-bold` }}\n              >\n                <pre class=\"text-sm\">\n                  {user.name}{' '}\n                  <MatchRoute\n                    to={userRoute.to}\n                    search={{\n                      userId: user.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div class=\"flex-initial border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst usersIndexRoute = createRoute({\n  getParentRoute: () => usersLayoutRoute,\n  path: '/',\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <p>\n        Normally, setting default search parameters would either need to be done\n        manually in every link to a page, or as a side-effect (not a great\n        experience).\n      </p>\n      <p>\n        Instead, we can use <strong>search filters</strong> to provide defaults\n        or even persist search params for links to routes (and child routes).\n      </p>\n      <p>\n        A good example of this is the sorting and filtering of the users list.\n        In a traditional router, both would be lost while navigating around\n        individual users or even changing each sort/filter option unless each\n        state was manually passed from the current route into each new link we\n        created (that's a lot of tedious and error-prone work). With TanStack\n        router and search filters, they are persisted with little effort.\n      </p>\n    </div>\n  )\n}\n\nconst userRoute = createRoute({\n  getParentRoute: () => usersLayoutRoute,\n  path: 'user',\n  validateSearch: z.object({\n    userId: z.number(),\n  }),\n  loaderDeps: ({ search: { userId } }) => ({\n    userId,\n  }),\n  loader: ({ deps: { userId } }) => fetchUserById(userId),\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const user = userRoute.useLoaderData()\n\n  return (\n    <>\n      <h4 class=\"p-2 font-bold\">{user()?.name}</h4>\n      <pre class=\"text-sm whitespace-pre-wrap\">\n        {JSON.stringify(user(), null, 2)}\n      </pre>\n    </>\n  )\n}\n\nconst expensiveRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  // Your elements can be asynchronous, which means you can code-split!\n  path: 'expensive',\n  component: lazyRouteComponent(() => import('./Expensive')),\n})\n\nconst authPathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'auth',\n  // Before loading, authenticate the user via our auth context\n  // This will also happen during prefetching (e.g. hovering over links, etc)\n  beforeLoad: ({ context, location }) => {\n    // If the user is logged out, redirect them to the login page\n    if (context.auth.status === 'loggedOut') {\n      console.log(location)\n      throw redirect({\n        to: loginRoute.to,\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n\n    // Otherwise, return the user in context\n    return {\n      username: auth.username,\n    }\n  },\n})\n\nconst profileRoute = createRoute({\n  getParentRoute: () => authPathlessLayoutRoute,\n  path: 'profile',\n  component: ProfileComponent,\n})\n\nfunction ProfileComponent() {\n  const routeContext = profileRoute.useRouteContext()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <div>\n        Username:<strong>{routeContext().username}</strong>\n      </div>\n      <button\n        class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n        onClick={() => {\n          auth.logout()\n          router.invalidate()\n        }}\n      >\n        Log out\n      </button>\n    </div>\n  )\n}\n\nconst loginRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'login',\n  validateSearch: z.object({\n    redirect: z.string().optional(),\n  }),\n}).update({\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const routeContext = loginRoute.useRouteContext({\n    select: ({ auth }) => ({ auth, status: auth.status }),\n  })\n  const search = useSearch({ from: loginRoute.fullPath })\n  const [username, setUsername] = createSignal('')\n\n  const onSubmit = (e: SubmitEvent) => {\n    e.preventDefault()\n    routeContext().auth.login(username())\n    router.invalidate()\n  }\n\n  // Ah, the subtle nuances of client side auth. 🙄\n  createRenderEffect(\n    on([() => routeContext().status, () => search().redirect], () => {\n      const redirect = search().redirect\n      if (routeContext().status === 'loggedIn' && redirect) {\n        router.history.push(redirect)\n      }\n    }),\n  )\n\n  return routeContext().status === 'loggedIn' ? (\n    <div>\n      Logged in as <strong>{auth.username}</strong>\n      <div class=\"h-2\" />\n      <button\n        onClick={() => {\n          auth.logout()\n          router.invalidate()\n        }}\n        class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n      >\n        Log out\n      </button>\n      <div class=\"h-2\" />\n    </div>\n  ) : (\n    <div class=\"p-2\">\n      <div>You must log in!</div>\n      <div class=\"h-2\" />\n      <form onSubmit={onSubmit} class=\"flex gap-2\">\n        <input\n          value={username()}\n          onInput={(e) => setUsername(e.currentTarget.value)}\n          placeholder=\"Username\"\n          class=\"border p-1 px-2 rounded-sm\"\n        />\n        <button class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\">\n          Login\n        </button>\n      </form>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'pathless-layout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>Pathless Layout</div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return (\n    <div>\n      <div>I'm A</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return (\n    <div>\n      <div>I'm B</div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  dashboardLayoutRoute.addChildren([\n    dashboardIndexRoute,\n    invoicesLayoutRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n    usersLayoutRoute.addChildren([usersIndexRoute, userRoute]),\n  ]),\n  expensiveRoute,\n  authPathlessLayoutRoute.addChildren([profileRoute]),\n  loginRoute,\n  pathlessLayoutRoute.addChildren([pathlessLayoutARoute, pathlessLayoutBRoute]),\n])\n\nconst router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div class={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,\n  context: {\n    auth: undefined!, // We'll inject this when we render\n  },\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst auth: Auth = {\n  status: 'loggedOut',\n  username: undefined,\n  login: (username: string) => {\n    auth.username = username\n    auth.status = 'loggedIn'\n  },\n  logout: () => {\n    auth.status = 'loggedOut'\n    auth.username = undefined\n  },\n}\n\nfunction App() {\n  // This stuff is just to tweak our sandbox setup in real-time\n  const [loaderDelay, setLoaderDelay] = useSessionStorage('loaderDelay', 500)\n  const [pendingMs, setPendingMs] = useSessionStorage('pendingMs', 1000)\n  const [pendingMinMs, setPendingMinMs] = useSessionStorage('pendingMinMs', 500)\n\n  return (\n    <>\n      <div class=\"text-xs fixed w-52 shadow-md shadow-black/20 rounded-sm bottom-2 left-2 bg-white dark:bg-gray-800 bg-opacity-75 border-b flex flex-col gap-1 flex-wrap items-left divide-y\">\n        <div class=\"p-2 space-y-2\">\n          <div class=\"flex gap-2\">\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(150)\n              }}\n            >\n              Fast\n            </button>\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(500)\n              }}\n            >\n              Fast 3G\n            </button>\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(2000)\n              }}\n            >\n              Slow 3G\n            </button>\n          </div>\n          <div>\n            <div>Loader Delay: {loaderDelay()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={loaderDelay()}\n              onInput={(e) => setLoaderDelay(e.currentTarget.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n        </div>\n        <div class=\"p-2 space-y-2\">\n          <div class=\"flex gap-2\">\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setPendingMs(1000)\n                setPendingMinMs(500)\n              }}\n            >\n              Reset to Default\n            </button>\n          </div>\n          <div>\n            <div>defaultPendingMs: {pendingMs()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMs()}\n              onInput={(e) => setPendingMs(e.currentTarget.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n          <div>\n            <div>defaultPendingMinMs: {pendingMinMs()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMinMs()}\n              onInput={(e) => setPendingMinMs(e.currentTarget.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n        </div>\n      </div>\n      <RouterProvider\n        router={router}\n        defaultPreload=\"intent\"\n        defaultPendingMs={pendingMs()}\n        defaultPendingMinMs={pendingMinMs()}\n        context={{\n          auth,\n        }}\n      />\n    </>\n  )\n}\n\nfunction InvoiceFields({\n  invoice,\n  disabled,\n}: {\n  invoice: Invoice\n  disabled?: boolean\n}) {\n  return (\n    <div class=\"space-y-2\">\n      <h2 class=\"font-bold text-lg\">\n        <input\n          name=\"title\"\n          value={invoice.title || ''}\n          placeholder=\"Invoice Title\"\n          class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n          disabled={disabled}\n        />\n      </h2>\n      <div>\n        <textarea\n          name=\"body\"\n          value={invoice.body || ''}\n          rows={6}\n          placeholder=\"Invoice Body...\"\n          class=\"border border-opacity-50 p-2 rounded-sm w-full\"\n          disabled={disabled}\n        />\n      </div>\n    </div>\n  )\n}\n\ntype Auth = {\n  login: (username: string) => void\n  logout: () => void\n  status: 'loggedOut' | 'loggedIn'\n  username?: string\n}\n\nfunction Spinner({ show, wait }: { show?: boolean; wait?: `delay-${number}` }) {\n  return (\n    <div\n      class={`inline-block animate-spin px-3 transition ${\n        (show ?? true)\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n\nfunction useSessionStorage<T>(key: string, initialValue: T) {\n  const [state, setState] = createSignal<T>(\n    (() => {\n      const stored = sessionStorage.getItem(key)\n      return stored ? JSON.parse(stored) : initialValue\n    })(),\n  )\n\n  createEffect(\n    on(state, () => {\n      sessionStorage.setItem(key, JSON.stringify(state()))\n    }),\n  )\n\n  return [state, setState] as const\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <App />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/src/mockTodos.ts",
    "content": "import axios from 'redaxios'\nimport { produce } from 'immer'\nimport { actionDelayFn, loaderDelayFn, shuffle } from './utils'\n\ntype PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> &\n  Required<Pick<TValue, TKey>>\n\nexport type Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nlet invoices: Array<Invoice> = null!\nlet users: Array<User> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\nlet usersPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nconst ensureUsers = async () => {\n  if (!usersPromise) {\n    usersPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/users',\n      )\n      users = data.slice(0, 10)\n    })\n  }\n\n  await usersPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n\nexport async function postInvoice(partialInvoice: Partial<Invoice>) {\n  return actionDelayFn(() => {\n    if (partialInvoice.title?.includes('error')) {\n      console.error('error')\n      throw new Error('Ouch!')\n    }\n    const invoice = {\n      id: invoices.length + 1,\n      title:\n        partialInvoice.title ?? `New Invoice ${String(Date.now()).slice(0, 5)}`,\n      body:\n        partialInvoice.body ??\n        shuffle(\n          `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n      Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. \n      Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna.  Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.\n      `.split(' '),\n        ).join(' '),\n    }\n    invoices = [...invoices, invoice]\n    return invoice\n  })\n}\n\nexport async function patchInvoice({\n  id,\n  ...updatedInvoice\n}: PickAsRequired<Partial<Invoice>, 'id'>) {\n  return actionDelayFn(() => {\n    invoices = produce(invoices, (draft) => {\n      const invoice = draft.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found.')\n      }\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (updatedInvoice.title?.toLocaleLowerCase()?.includes('error')) {\n        throw new Error('Ouch!')\n      }\n      Object.assign(invoice, updatedInvoice)\n    })\n\n    return invoices.find((d) => d.id === id)\n  })\n}\n\nexport type UsersSortBy = 'name' | 'id' | 'email'\n\nexport async function fetchUsers({\n  filterBy,\n  sortBy,\n}: { filterBy?: string; sortBy?: UsersSortBy } = {}) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => {\n      let usersDraft = users\n\n      if (filterBy) {\n        usersDraft = usersDraft.filter((d) =>\n          d.name.toLowerCase().includes(filterBy.toLowerCase()),\n        )\n      }\n\n      if (sortBy) {\n        usersDraft = [...usersDraft].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n      }\n\n      return usersDraft\n    }),\n  )\n}\n\nexport async function fetchUserById(id: number) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => users.find((d) => d.id === id)),\n  )\n}\n\nexport async function fetchRandomNumber() {\n  return loaderDelayFn(() => {\n    return Math.random()\n  })\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/src/useMutation.tsx",
    "content": "import { createSignal } from 'solid-js'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = createSignal<number | undefined>()\n  const [variables, setVariables] = createSignal<TVariables | undefined>()\n  const [error, setError] = createSignal<TError | undefined>()\n  const [data, setData] = createSignal<TData | undefined>()\n  const [status, setStatus] = createSignal<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = async (variables: TVariables): Promise<TData | undefined> => {\n    setStatus('pending')\n    setSubmittedAt(Date.now())\n    setVariables(() => variables)\n    //\n    try {\n      const data = await opts.fn(variables)\n      await opts.onSuccess?.({ data })\n      setStatus('success')\n      setError(undefined)\n      setData(() => data)\n      return data\n    } catch (err: any) {\n      setStatus('error')\n      setError(() => err)\n    }\n  }\n\n  return {\n    get status() {\n      return status()\n    },\n    get variables() {\n      return variables()\n    },\n    get submittedAt() {\n      return submittedAt()\n    },\n    mutate,\n    get error() {\n      return error()\n    },\n    get data() {\n      return data()\n    },\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/src/utils.tsx",
    "content": "export async function loaderDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\nexport async function actionDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('actionDelay') ?? 0)\n  await new Promise((r) => setTimeout(r, delay))\n  return fn()\n}\n\nexport function shuffle<T>(arr: Array<T>): Array<T> {\n  let i = arr.length\n  if (i == 0) return arr\n  const copy = [...arr]\n  while (--i) {\n    const j = Math.floor(Math.random() * (i + 1))\n    const a = copy[i]\n    const b = copy[j]\n    copy[i] = b!\n    copy[j] = a!\n  }\n  return copy\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-kitchen-sink-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"immer\": \"^10.1.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/components/Breadcrumbs.tsx",
    "content": "import { isMatch, Link, useMatches } from '@tanstack/solid-router'\n\nexport const Breadcrumbs = () => {\n  const matches = useMatches()\n\n  if (matches().some((match) => match.status === 'pending')) return null\n\n  const matchesWithCrumbs = matches().filter((match) =>\n    isMatch(match, 'loaderData.crumb'),\n  )\n\n  return (\n    <nav>\n      <ul class=\"flex gap-2 items-center\">\n        {matchesWithCrumbs.map((match, i) => (\n          <li class=\"flex gap-2\">\n            <Link class=\"text-blue-700\" from={match.fullPath}>\n              {match.loaderData?.crumb}\n            </Link>\n            {i + 1 < matchesWithCrumbs.length ? (\n              <span class=\"\">{'>'}</span>\n            ) : null}\n          </li>\n        ))}\n      </ul>\n    </nav>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/components/InvoiceFields.tsx",
    "content": "/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport type { Invoice } from '../utils/mockTodos'\n\nexport function InvoiceFields(props: { invoice: Invoice; disabled?: boolean }) {\n  return (\n    <div class=\"space-y-2\">\n      <h2 class=\"font-bold text-lg\">\n        <input\n          name=\"title\"\n          value={props.invoice?.title || ''}\n          placeholder=\"Invoice Title\"\n          class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n          disabled={props.disabled}\n        />\n      </h2>\n      <div>\n        <textarea\n          name=\"body\"\n          value={props.invoice?.body || ''}\n          rows={6}\n          placeholder=\"Invoice Body...\"\n          class=\"border border-opacity-50 p-2 rounded-sm w-full\"\n          disabled={props.disabled}\n        />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/components/Spinner.tsx",
    "content": "export function Spinner(props: { show?: boolean; wait?: `delay-${number}` }) {\n  return (\n    <div\n      class={`inline-block animate-spin px-3 transition ${\n        (props.show ?? true)\n          ? `opacity-100 duration-500 ${props.wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/hooks/useMutation.tsx",
    "content": "import * as Solid from 'solid-js'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = Solid.createSignal<number | undefined>()\n  const [variables, setVariables] = Solid.createSignal<TVariables | undefined>()\n  const [error, setError] = Solid.createSignal<TError | undefined>()\n  const [data, setData] = Solid.createSignal<TData | undefined>()\n  const [status, setStatus] = Solid.createSignal<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = async (variables: TVariables): Promise<TData | undefined> => {\n    setStatus(() => 'pending')\n    setSubmittedAt(() => Date.now())\n    setVariables(() => variables)\n    //\n    try {\n      const data = await opts.fn(variables)\n      await opts.onSuccess?.({ data })\n      setStatus(() => 'success')\n      setError(() => undefined)\n      setData((prev) => data)\n      return data\n    } catch (err: any) {\n      setStatus(() => 'error')\n      setError(() => err)\n    }\n  }\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/hooks/useSessionStorage.tsx",
    "content": "import * as Solid from 'solid-js'\n\nexport function useSessionStorage<T>(key: string, initialValue: any) {\n  const [state, setState] = Solid.createSignal<T>(\n    (() => {\n      const stored = sessionStorage.getItem(key)\n      console.log('stored', key, stored, initialValue, typeof stored)\n      const reutrnval =\n        stored && stored !== 'undefined' ? JSON.parse(stored) : initialValue\n      console.log('returning', reutrnval)\n      return reutrnval\n    })(),\n  )\n\n  Solid.createEffect(() => {\n    console.log('setting', JSON.stringify(state()))\n    sessionStorage.setItem(key, JSON.stringify(state()))\n  })\n\n  return [state, setState]\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/main.tsx",
    "content": "import * as Solid from 'solid-js'\nimport {\n  ErrorComponent,\n  RouterProvider,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { auth } from './utils/auth'\nimport { Spinner } from './components/Spinner'\nimport { routeTree } from './routeTree.gen'\nimport { useSessionStorage } from './hooks/useSessionStorage'\nimport './styles.css'\nimport { render } from 'solid-js/web'\n\n//\n\nconst router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div class={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,\n  context: {\n    auth: undefined!, // We'll inject this when we render\n  },\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction App() {\n  // This stuff is just to tweak our sandbox setup in real-time\n  const [loaderDelay, setLoaderDelay] = useSessionStorage<number>(\n    'loaderDelay',\n    500,\n  )\n  const [pendingMs, setPendingMs] = useSessionStorage<number>('pendingMs', 1000)\n  const [pendingMinMs, setPendingMinMs] = useSessionStorage<number>(\n    'pendingMinMs',\n    500,\n  )\n\n  return (\n    <>\n      <div class=\"text-xs fixed w-52 shadow-md shadow-black/20 rounded-sm bottom-2 left-2 bg-white dark:bg-gray-800 bg-opacity-75 border-b flex flex-col gap-1 flex-wrap items-left divide-y\">\n        <div class=\"p-2 space-y-2\">\n          <div class=\"flex gap-2\">\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(() => 150)\n              }}\n            >\n              Fast\n            </button>\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(() => 500)\n              }}\n            >\n              Fast 3G\n            </button>\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(() => 2000)\n              }}\n            >\n              Slow 3G\n            </button>\n          </div>\n          <div>\n            <div>Loader Delay: {loaderDelay()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={loaderDelay()}\n              onChange={(e) => setLoaderDelay(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n        </div>\n        <div class=\"p-2 space-y-2\">\n          <div class=\"flex gap-2\">\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setPendingMs(() => 1000)\n                setPendingMinMs(() => 500)\n              }}\n            >\n              Reset to Default\n            </button>\n          </div>\n          <div>\n            <div>defaultPendingMs: {pendingMs()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMs()}\n              onChange={(e) => setPendingMs(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n          <div>\n            <div>defaultPendingMinMs: {pendingMinMs()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMinMs()}\n              onChange={(e) => setPendingMinMs(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n        </div>\n      </div>\n      <RouterProvider\n        router={router}\n        defaultPreload=\"intent\"\n        defaultPendingMs={pendingMs()}\n        defaultPendingMinMs={pendingMinMs()}\n        context={{\n          auth,\n        }}\n      />\n    </>\n  )\n}\n\nconst rootElement = document.getElementById('app')!\nrender(() => <App />, rootElement!)\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\n// Import Routes\n\nimport { Route as rootRoute } from './routes/__root'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as AuthRouteImport } from './routes/_auth'\nimport { Route as DashboardRouteRouteImport } from './routes/dashboard.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ExpensiveIndexRouteImport } from './routes/expensive/index'\nimport { Route as DashboardIndexRouteImport } from './routes/dashboard.index'\nimport { Route as PathlessLayoutRouteBRouteImport } from './routes/_pathlessLayout.route-b'\nimport { Route as PathlessLayoutRouteARouteImport } from './routes/_pathlessLayout.route-a'\nimport { Route as AuthProfileRouteImport } from './routes/_auth.profile'\nimport { Route as thisFolderIsNotInTheUrlRouteGroupRouteImport } from './routes/(this-folder-is-not-in-the-url)/route-group'\nimport { Route as DashboardUsersRouteRouteImport } from './routes/dashboard.users.route'\nimport { Route as DashboardInvoicesRouteRouteImport } from './routes/dashboard.invoices.route'\nimport { Route as DashboardUsersIndexRouteImport } from './routes/dashboard.users.index'\nimport { Route as DashboardInvoicesIndexRouteImport } from './routes/dashboard.invoices.index'\nimport { Route as DashboardUsersUserRouteImport } from './routes/dashboard.users.user'\nimport { Route as DashboardInvoicesInvoiceIdRouteImport } from './routes/dashboard.invoices.$invoiceId'\n\n// Create/Update Routes\n\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst AuthRoute = AuthRouteImport.update({\n  id: '/_auth',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst DashboardRouteRoute = DashboardRouteRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst ExpensiveIndexRoute = ExpensiveIndexRouteImport.update({\n  id: '/expensive/',\n  path: '/expensive/',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst DashboardIndexRoute = DashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\n\nconst PathlessLayoutRouteBRoute = PathlessLayoutRouteBRouteImport.update({\n  id: '/route-b',\n  path: '/route-b',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\n\nconst PathlessLayoutRouteARoute = PathlessLayoutRouteARouteImport.update({\n  id: '/route-a',\n  path: '/route-a',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\n\nconst AuthProfileRoute = AuthProfileRouteImport.update({\n  id: '/profile',\n  path: '/profile',\n  getParentRoute: () => AuthRoute,\n} as any)\n\nconst thisFolderIsNotInTheUrlRouteGroupRoute =\n  thisFolderIsNotInTheUrlRouteGroupRouteImport.update({\n    id: '/(this-folder-is-not-in-the-url)/route-group',\n    path: '/route-group',\n    getParentRoute: () => rootRoute,\n  } as any)\n\nconst DashboardUsersRouteRoute = DashboardUsersRouteRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\n\nconst DashboardInvoicesRouteRoute = DashboardInvoicesRouteRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\n\nconst DashboardUsersIndexRoute = DashboardUsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardUsersRouteRoute,\n} as any)\n\nconst DashboardInvoicesIndexRoute = DashboardInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardInvoicesRouteRoute,\n} as any)\n\nconst DashboardUsersUserRoute = DashboardUsersUserRouteImport.update({\n  id: '/user',\n  path: '/user',\n  getParentRoute: () => DashboardUsersRouteRoute,\n} as any)\n\nconst DashboardInvoicesInvoiceIdRoute =\n  DashboardInvoicesInvoiceIdRouteImport.update({\n    id: '/$invoiceId',\n    path: '/$invoiceId',\n    getParentRoute: () => DashboardInvoicesRouteRoute,\n  } as any)\n\n// Populate the FileRoutesByPath interface\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardRouteRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof AuthRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/dashboard/invoices': {\n      id: '/dashboard/invoices'\n      path: '/invoices'\n      fullPath: '/dashboard/invoices'\n      preLoaderRoute: typeof DashboardInvoicesRouteRouteImport\n      parentRoute: typeof DashboardRouteRouteImport\n    }\n    '/dashboard/users': {\n      id: '/dashboard/users'\n      path: '/users'\n      fullPath: '/dashboard/users'\n      preLoaderRoute: typeof DashboardUsersRouteRouteImport\n      parentRoute: typeof DashboardRouteRouteImport\n    }\n    '/(this-folder-is-not-in-the-url)/route-group': {\n      id: '/(this-folder-is-not-in-the-url)/route-group'\n      path: '/route-group'\n      fullPath: '/route-group'\n      preLoaderRoute: typeof thisFolderIsNotInTheUrlRouteGroupRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/_auth/profile': {\n      id: '/_auth/profile'\n      path: '/profile'\n      fullPath: '/profile'\n      preLoaderRoute: typeof AuthProfileRouteImport\n      parentRoute: typeof AuthRouteImport\n    }\n    '/_pathlessLayout/route-a': {\n      id: '/_pathlessLayout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutRouteImport\n    }\n    '/_pathlessLayout/route-b': {\n      id: '/_pathlessLayout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardIndexRouteImport\n      parentRoute: typeof DashboardRouteRouteImport\n    }\n    '/expensive/': {\n      id: '/expensive/'\n      path: '/expensive'\n      fullPath: '/expensive'\n      preLoaderRoute: typeof ExpensiveIndexRouteImport\n      parentRoute: typeof rootRoute\n    }\n    '/dashboard/invoices/$invoiceId': {\n      id: '/dashboard/invoices/$invoiceId'\n      path: '/$invoiceId'\n      fullPath: '/dashboard/invoices/$invoiceId'\n      preLoaderRoute: typeof DashboardInvoicesInvoiceIdRouteImport\n      parentRoute: typeof DashboardInvoicesRouteRouteImport\n    }\n    '/dashboard/users/user': {\n      id: '/dashboard/users/user'\n      path: '/user'\n      fullPath: '/dashboard/users/user'\n      preLoaderRoute: typeof DashboardUsersUserRouteImport\n      parentRoute: typeof DashboardUsersRouteRouteImport\n    }\n    '/dashboard/invoices/': {\n      id: '/dashboard/invoices/'\n      path: '/'\n      fullPath: '/dashboard/invoices/'\n      preLoaderRoute: typeof DashboardInvoicesIndexRouteImport\n      parentRoute: typeof DashboardInvoicesRouteRouteImport\n    }\n    '/dashboard/users/': {\n      id: '/dashboard/users/'\n      path: '/'\n      fullPath: '/dashboard/users/'\n      preLoaderRoute: typeof DashboardUsersIndexRouteImport\n      parentRoute: typeof DashboardUsersRouteRouteImport\n    }\n  }\n}\n\n// Create and export the route tree\n\ninterface DashboardInvoicesRouteRouteChildren {\n  DashboardInvoicesInvoiceIdRoute: typeof DashboardInvoicesInvoiceIdRoute\n  DashboardInvoicesIndexRoute: typeof DashboardInvoicesIndexRoute\n}\n\nconst DashboardInvoicesRouteRouteChildren: DashboardInvoicesRouteRouteChildren =\n  {\n    DashboardInvoicesInvoiceIdRoute: DashboardInvoicesInvoiceIdRoute,\n    DashboardInvoicesIndexRoute: DashboardInvoicesIndexRoute,\n  }\n\nconst DashboardInvoicesRouteRouteWithChildren =\n  DashboardInvoicesRouteRoute._addFileChildren(\n    DashboardInvoicesRouteRouteChildren,\n  )\n\ninterface DashboardUsersRouteRouteChildren {\n  DashboardUsersUserRoute: typeof DashboardUsersUserRoute\n  DashboardUsersIndexRoute: typeof DashboardUsersIndexRoute\n}\n\nconst DashboardUsersRouteRouteChildren: DashboardUsersRouteRouteChildren = {\n  DashboardUsersUserRoute: DashboardUsersUserRoute,\n  DashboardUsersIndexRoute: DashboardUsersIndexRoute,\n}\n\nconst DashboardUsersRouteRouteWithChildren =\n  DashboardUsersRouteRoute._addFileChildren(DashboardUsersRouteRouteChildren)\n\ninterface DashboardRouteRouteChildren {\n  DashboardInvoicesRouteRoute: typeof DashboardInvoicesRouteRouteWithChildren\n  DashboardUsersRouteRoute: typeof DashboardUsersRouteRouteWithChildren\n  DashboardIndexRoute: typeof DashboardIndexRoute\n}\n\nconst DashboardRouteRouteChildren: DashboardRouteRouteChildren = {\n  DashboardInvoicesRouteRoute: DashboardInvoicesRouteRouteWithChildren,\n  DashboardUsersRouteRoute: DashboardUsersRouteRouteWithChildren,\n  DashboardIndexRoute: DashboardIndexRoute,\n}\n\nconst DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren(\n  DashboardRouteRouteChildren,\n)\n\ninterface AuthRouteChildren {\n  AuthProfileRoute: typeof AuthProfileRoute\n}\n\nconst AuthRouteChildren: AuthRouteChildren = {\n  AuthProfileRoute: AuthProfileRoute,\n}\n\nconst AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutRouteARoute: typeof PathlessLayoutRouteARoute\n  PathlessLayoutRouteBRoute: typeof PathlessLayoutRouteBRoute\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutRouteARoute: PathlessLayoutRouteARoute,\n  PathlessLayoutRouteBRoute: PathlessLayoutRouteBRoute,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteRouteWithChildren\n  '': typeof PathlessLayoutRouteWithChildren\n  '/login': typeof LoginRoute\n  '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren\n  '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren\n  '/route-group': typeof thisFolderIsNotInTheUrlRouteGroupRoute\n  '/profile': typeof AuthProfileRoute\n  '/route-a': typeof PathlessLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutRouteBRoute\n  '/dashboard/': typeof DashboardIndexRoute\n  '/expensive': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users/': typeof DashboardUsersIndexRoute\n}\n\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '': typeof PathlessLayoutRouteWithChildren\n  '/login': typeof LoginRoute\n  '/route-group': typeof thisFolderIsNotInTheUrlRouteGroupRoute\n  '/profile': typeof AuthProfileRoute\n  '/route-a': typeof PathlessLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutRouteBRoute\n  '/dashboard': typeof DashboardIndexRoute\n  '/expensive': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users': typeof DashboardUsersIndexRoute\n}\n\nexport interface FileRoutesById {\n  __root__: typeof rootRoute\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteRouteWithChildren\n  '/_auth': typeof AuthRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/login': typeof LoginRoute\n  '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren\n  '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren\n  '/(this-folder-is-not-in-the-url)/route-group': typeof thisFolderIsNotInTheUrlRouteGroupRoute\n  '/_auth/profile': typeof AuthProfileRoute\n  '/_pathlessLayout/route-a': typeof PathlessLayoutRouteARoute\n  '/_pathlessLayout/route-b': typeof PathlessLayoutRouteBRoute\n  '/dashboard/': typeof DashboardIndexRoute\n  '/expensive/': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users/': typeof DashboardUsersIndexRoute\n}\n\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/dashboard'\n    | ''\n    | '/login'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n    | '/route-group'\n    | '/profile'\n    | '/route-a'\n    | '/route-b'\n    | '/dashboard/'\n    | '/expensive'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices/'\n    | '/dashboard/users/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | ''\n    | '/login'\n    | '/route-group'\n    | '/profile'\n    | '/route-a'\n    | '/route-b'\n    | '/dashboard'\n    | '/expensive'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n  id:\n    | '__root__'\n    | '/'\n    | '/dashboard'\n    | '/_auth'\n    | '/_pathlessLayout'\n    | '/login'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n    | '/(this-folder-is-not-in-the-url)/route-group'\n    | '/_auth/profile'\n    | '/_pathlessLayout/route-a'\n    | '/_pathlessLayout/route-b'\n    | '/dashboard/'\n    | '/expensive/'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices/'\n    | '/dashboard/users/'\n  fileRoutesById: FileRoutesById\n}\n\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DashboardRouteRoute: typeof DashboardRouteRouteWithChildren\n  AuthRoute: typeof AuthRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  thisFolderIsNotInTheUrlRouteGroupRoute: typeof thisFolderIsNotInTheUrlRouteGroupRoute\n  ExpensiveIndexRoute: typeof ExpensiveIndexRoute\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DashboardRouteRoute: DashboardRouteRouteWithChildren,\n  AuthRoute: AuthRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  LoginRoute: LoginRoute,\n  thisFolderIsNotInTheUrlRouteGroupRoute:\n    thisFolderIsNotInTheUrlRouteGroupRoute,\n  ExpensiveIndexRoute: ExpensiveIndexRoute,\n}\n\nexport const routeTree = rootRoute\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\n/* ROUTE_MANIFEST_START\n{\n  \"routes\": {\n    \"__root__\": {\n      \"filePath\": \"__root.tsx\",\n      \"children\": [\n        \"/\",\n        \"/dashboard\",\n        \"/_auth\",\n        \"/_pathlessLayout\",\n        \"/login\",\n        \"/(this-folder-is-not-in-the-url)/route-group\",\n        \"/expensive/\"\n      ]\n    },\n    \"/\": {\n      \"filePath\": \"index.tsx\"\n    },\n    \"/dashboard\": {\n      \"filePath\": \"dashboard.route.tsx\",\n      \"children\": [\n        \"/dashboard/invoices\",\n        \"/dashboard/users\",\n        \"/dashboard/\"\n      ]\n    },\n    \"/_auth\": {\n      \"filePath\": \"_auth.tsx\",\n      \"children\": [\n        \"/_auth/profile\"\n      ]\n    },\n    \"/_pathlessLayout\": {\n      \"filePath\": \"_pathlessLayout.tsx\",\n      \"children\": [\n        \"/_pathlessLayout/route-a\",\n        \"/_pathlessLayout/route-b\"\n      ]\n    },\n    \"/login\": {\n      \"filePath\": \"login.tsx\"\n    },\n    \"/dashboard/invoices\": {\n      \"filePath\": \"dashboard.invoices.route.tsx\",\n      \"parent\": \"/dashboard\",\n      \"children\": [\n        \"/dashboard/invoices/$invoiceId\",\n        \"/dashboard/invoices/\"\n      ]\n    },\n    \"/dashboard/users\": {\n      \"filePath\": \"dashboard.users.route.tsx\",\n      \"parent\": \"/dashboard\",\n      \"children\": [\n        \"/dashboard/users/user\",\n        \"/dashboard/users/\"\n      ]\n    },\n    \"/(this-folder-is-not-in-the-url)/route-group\": {\n      \"filePath\": \"(this-folder-is-not-in-the-url)/route-group.tsx\"\n    },\n    \"/_auth/profile\": {\n      \"filePath\": \"_auth.profile.tsx\",\n      \"parent\": \"/_auth\"\n    },\n    \"/_pathlessLayout/route-a\": {\n      \"filePath\": \"_pathlessLayout.route-a.tsx\",\n      \"parent\": \"/_pathlessLayout\"\n    },\n    \"/_pathlessLayout/route-b\": {\n      \"filePath\": \"_pathlessLayout.route-b.tsx\",\n      \"parent\": \"/_pathlessLayout\"\n    },\n    \"/dashboard/\": {\n      \"filePath\": \"dashboard.index.tsx\",\n      \"parent\": \"/dashboard\"\n    },\n    \"/expensive/\": {\n      \"filePath\": \"expensive/index.tsx\"\n    },\n    \"/dashboard/invoices/$invoiceId\": {\n      \"filePath\": \"dashboard.invoices.$invoiceId.tsx\",\n      \"parent\": \"/dashboard/invoices\"\n    },\n    \"/dashboard/users/user\": {\n      \"filePath\": \"dashboard.users.user.tsx\",\n      \"parent\": \"/dashboard/users\"\n    },\n    \"/dashboard/invoices/\": {\n      \"filePath\": \"dashboard.invoices.index.tsx\",\n      \"parent\": \"/dashboard/invoices\"\n    },\n    \"/dashboard/users/\": {\n      \"filePath\": \"dashboard.users.index.tsx\",\n      \"parent\": \"/dashboard/users\"\n    }\n  }\n}\nROUTE_MANIFEST_END */\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/(this-folder-is-not-in-the-url)/route-group.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\n\nexport const Route = createFileRoute(\n  '/(this-folder-is-not-in-the-url)/route-group',\n)({\n  component: RouteGroupExample,\n})\n\nfunction RouteGroupExample() {\n  return (\n    <div class={`p-2`}>\n      <div class={`text-lg`}>Welcome to the Route Group Example!</div>\n      <hr class={`my-2`} />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { Spinner } from '../components/Spinner'\nimport { Breadcrumbs } from '../components/Breadcrumbs'\nimport type { Auth } from '../utils/auth'\n\nfunction RouterSpinner() {\n  const isLoading = useRouterState({ select: (s) => s.status === 'pending' })\n  return <Spinner show={isLoading()} />\n}\n\nexport const Route = createRootRouteWithContext<{\n  auth: Auth\n}>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class={`min-h-screen flex flex-col`}>\n        <div class={`flex items-center border-b gap-2`}>\n          <h1 class={`text-3xl p-2`}>Kitchen Sink</h1>\n          <Breadcrumbs />\n          {/* Show a global spinner when the router is transitioning */}\n          <div class={`text-3xl`}>\n            <RouterSpinner />\n          </div>\n        </div>\n        <div class={`flex-1 flex`}>\n          <div class={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n                ['/expensive', 'Expensive'],\n                ['/route-a', 'Pathless Layout A'],\n                ['/route-b', 'Pathless Layout B'],\n                ['/profile', 'Profile'],\n                ['/login', 'Login'],\n                ['/route-group', 'Route Group'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    class={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ class: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div class={`flex-1 border-l`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/_auth.profile.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\n\nexport const Route = createFileRoute('/_auth/profile')({\n  component: ProfileComponent,\n})\n\nfunction ProfileComponent() {\n  const context = Route.useRouteContext()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <div>\n        Username:<strong>{context().username}</strong>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/_auth.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { redirect } from '@tanstack/solid-router'\nimport { auth } from '../utils/auth'\n\nexport const Route = createFileRoute('/_auth')({\n  // Before loading, authenticate the user via our auth context\n  // This will also happen during prefetching (e.g. hovering over links, etc)\n  beforeLoad: ({ context, location }) => {\n    // If the user is logged out, redirect them to the login page\n    if (context.auth.status === 'loggedOut') {\n      throw redirect({\n        to: '/login',\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n\n    // Otherwise, return the user in context\n    return {\n      username: auth.username,\n    }\n  },\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/_pathlessLayout.route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/route-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/_pathlessLayout.route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/route-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Outlet } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>Pathless Layout</div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/dashboard.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\n\nimport { fetchInvoices } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/')({\n  loader: () => fetchInvoices(),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const invoices = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{invoices.length} total invoices</strong>.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/dashboard.invoices.$invoiceId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { Link, useNavigate, useRouter } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { InvoiceFields } from '../components/InvoiceFields'\nimport { useMutation } from '../hooks/useMutation'\nimport { fetchInvoiceById, patchInvoice } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/invoices/$invoiceId')({\n  params: {\n    parse: (params) => ({\n      invoiceId: z.number().int().parse(Number(params.invoiceId)),\n    }),\n    stringify: ({ invoiceId }) => ({ invoiceId: `${invoiceId}` }),\n  },\n  validateSearch: (search) =>\n    z\n      .object({\n        showNotes: z.boolean().optional(),\n        notes: z.string().optional(),\n      })\n      .parse(search),\n  loader: ({ params: { invoiceId } }) => fetchInvoiceById(invoiceId),\n  component: InvoiceComponent,\n})\n\nfunction InvoiceComponent() {\n  const search = Route.useSearch()\n  const navigate = useNavigate({ from: Route.fullPath })\n  const invoice = Route.useLoaderData()\n  const router = useRouter()\n  const updateInvoiceMutation = useMutation({\n    fn: patchInvoice,\n    onSuccess: () => router.invalidate(),\n  })\n  const [notes, setNotes] = Solid.createSignal(search().notes ?? '')\n\n  Solid.createEffect(() => {\n    navigate({\n      search: (old) => ({\n        ...old,\n        notes: notes() ? notes() : undefined,\n      }),\n      replace: true,\n      params: true,\n    })\n  })\n\n  return (\n    <form\n      onSubmit={(event) => {\n        event.preventDefault()\n        event.stopPropagation()\n        const formData = new FormData(event.target as HTMLFormElement)\n        updateInvoiceMutation.mutate({\n          id: invoice()?.id,\n          title: formData.get('title') as string,\n          body: formData.get('body') as string,\n        })\n      }}\n      class=\"p-2 space-y-2\"\n    >\n      <InvoiceFields\n        invoice={invoice()}\n        disabled={updateInvoiceMutation.status() === 'pending'}\n      />\n      <div>\n        <Link\n          from={Route.fullPath}\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          class=\"text-blue-700\"\n          params={true}\n        >\n          {search().showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search().showNotes ? (\n          <>\n            <div>\n              <div class=\"h-2\" />\n              <textarea\n                value={notes()}\n                onChange={(e) => {\n                  setNotes(() => e.target.value)\n                }}\n                rows={5}\n                class=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div class=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n      <div>\n        <button\n          class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n          disabled={updateInvoiceMutation.status() === 'pending'}\n        >\n          Save\n        </button>\n      </div>\n      {updateInvoiceMutation.variables()?.id === invoice()?.id ? (\n        <div>\n          {updateInvoiceMutation.status() === 'success' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Saved!\n            </div>\n          ) : updateInvoiceMutation.status() === 'error' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to save.\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n    </form>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/dashboard.invoices.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { useRouter } from '@tanstack/solid-router'\nimport { InvoiceFields } from '../components/InvoiceFields'\nimport { Spinner } from '../components/Spinner'\nimport { useMutation } from '../hooks/useMutation'\nimport { postInvoice } from '../utils/mockTodos'\nimport type { Invoice } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/invoices/')({\n  component: InvoicesIndexComponent,\n})\n\nfunction InvoicesIndexComponent() {\n  const router = useRouter()\n\n  const createInvoiceMutation = useMutation({\n    fn: postInvoice,\n    onSuccess: () => router.invalidate(),\n  })\n\n  return (\n    <>\n      <div class=\"p-2\">\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n            createInvoiceMutation.mutate({\n              title: formData.get('title') as string,\n              body: formData.get('body') as string,\n            })\n          }}\n          class=\"space-y-2\"\n        >\n          <div>Create a new Invoice:</div>\n          <InvoiceFields invoice={{} as Invoice} />\n          <div>\n            <button\n              class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              disabled={createInvoiceMutation.status() === 'pending'}\n            >\n              {createInvoiceMutation.status() === 'pending' ? (\n                <>\n                  Creating <Spinner />\n                </>\n              ) : (\n                'Create'\n              )}\n            </button>\n          </div>\n          {createInvoiceMutation.status() === 'success' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Created!\n            </div>\n          ) : createInvoiceMutation.status() === 'error' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to create.\n            </div>\n          ) : null}\n        </form>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/dashboard.invoices.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { Link, MatchRoute, Outlet } from '@tanstack/solid-router'\nimport { Spinner } from '../components/Spinner'\nimport { fetchInvoices } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/invoices')({\n  loader: () => fetchInvoices(),\n  component: InvoicesComponent,\n})\n\nfunction InvoicesComponent() {\n  const invoices = Route.useLoaderData()\n\n  return (\n    <div class=\"flex-1 flex\">\n      <div class=\"divide-y w-48\">\n        <Solid.For each={invoices()}>\n          {(invoice) => {\n            return (\n              <div>\n                <Link\n                  to=\"/dashboard/invoices/$invoiceId\"\n                  params={{\n                    invoiceId: invoice.id,\n                  }}\n                  preload=\"intent\"\n                  class=\"block py-2 px-3 text-blue-700\"\n                  activeProps={{ class: `font-bold` }}\n                >\n                  <pre class=\"text-sm\">\n                    #{invoice.id} - {invoice.title.slice(0, 10)}{' '}\n                    <MatchRoute\n                      to=\"/dashboard/invoices/$invoiceId\"\n                      params={{\n                        invoiceId: invoice.id,\n                      }}\n                      pending\n                    >\n                      {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                    </MatchRoute>\n                  </pre>\n                </Link>\n              </div>\n            )\n          }}\n        </Solid.For>\n      </div>\n      <div class=\"flex-1 border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/dashboard.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { Link, Outlet, linkOptions } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: DashboardComponent,\n  loader: () => ({\n    crumb: 'Dashboard',\n  }),\n})\n\nconst options = [\n  linkOptions({\n    to: '/dashboard',\n    label: 'Summary',\n    activeOptions: { exact: true },\n  }),\n  linkOptions({\n    to: '/dashboard/invoices',\n    label: 'Invoices',\n  }),\n  linkOptions({\n    to: '/dashboard/users',\n    label: 'Users',\n  }),\n]\n\nfunction DashboardComponent() {\n  return (\n    <>\n      <div class=\"flex items-center border-b\">\n        <h2 class=\"text-xl p-2\">Dashboard</h2>\n      </div>\n\n      <div class=\"flex flex-wrap divide-x\">\n        {options.map((option) => {\n          return (\n            <Link {...option} activeProps={{ class: `font-bold` }} class=\"p-2\">\n              {option.label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/dashboard.users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\n\nexport const Route = createFileRoute('/dashboard/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <p>\n        Normally, setting default search parameters would either need to be done\n        manually in every link to a page, or as a side-effect (not a great\n        experience).\n      </p>\n      <p>\n        Instead, we can use <strong>search filters</strong> to provide defaults\n        or even persist search params for links to routes (and child routes).\n      </p>\n      <p>\n        A good example of this is the sorting and filtering of the users list.\n        In a traditional router, both would be lost while navigating around\n        individual users or even changing each sort/filter option unless each\n        state was manually passed from the current route into each new link we\n        created (that's a lot of tedious and error-prone work). With TanStack\n        router and search filters, they are persisted with little effort.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/dashboard.users.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport {\n  Link,\n  MatchRoute,\n  Outlet,\n  retainSearchParams,\n  useNavigate,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { createMemo } from 'solid-js'\nimport { Spinner } from '../components/Spinner'\nimport { fetchUsers } from '../utils/mockTodos'\n\ntype UsersViewSortBy = 'name' | 'id' | 'email'\n\nexport const Route = createFileRoute('/dashboard/users')({\n  validateSearch: z.object({\n    usersView: z\n      .object({\n        sortBy: z.enum(['name', 'id', 'email']).optional(),\n        filterBy: z.string().optional(),\n      })\n      .optional(),\n  }).parse,\n  search: {\n    // Retain the usersView search param while navigating\n    // within or to this route (or it's children!)\n    middlewares: [retainSearchParams(['usersView'])],\n  },\n  loaderDeps: ({ search }) => ({\n    filterBy: search.usersView?.filterBy,\n    sortBy: search.usersView?.sortBy,\n  }),\n  loader: async ({ deps }) => {\n    const users = await fetchUsers(deps)\n    return { users, crumb: 'Users' }\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const navigate = useNavigate({ from: Route.fullPath })\n  const search = Route.useSearch()\n  const loaderData = Route.useLoaderData()\n\n  const users = createMemo(() => loaderData()?.users)\n  const sortBy = createMemo(() => search().usersView?.sortBy ?? 'name')\n  const filterBy = createMemo(() => search().usersView?.filterBy)\n\n  const [filterDraft, setFilterDraft] = Solid.createSignal(filterBy() ?? '')\n\n  Solid.createEffect(() => {\n    setFilterDraft(filterBy() ?? '')\n  })\n\n  const setSortBy = (sortBy: UsersViewSortBy) =>\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...(old.usersView ?? {}),\n            sortBy,\n          },\n        }\n      },\n      replace: true,\n    })\n\n  Solid.createEffect(() => {\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...old.usersView,\n            filterBy: filterDraft() || undefined,\n          },\n        }\n      },\n      replace: true,\n    })\n  })\n\n  return (\n    <div class=\"flex-1 flex\">\n      <div class=\"divide-y\">\n        <div class=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Sort By:</div>\n          <select\n            value={sortBy()}\n            onChange={(e) => setSortBy(e.target.value as UsersViewSortBy)}\n            class=\"flex-1 border p-1 px-2 rounded-sm\"\n          >\n            {['name', 'id', 'email'].map((d) => {\n              return <option value={d} children={d} />\n            })}\n          </select>\n        </div>\n        <div class=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Filter By:</div>\n          <input\n            value={filterDraft()}\n            onChange={(e) => setFilterDraft(e.target.value)}\n            placeholder=\"Search Names...\"\n            class=\"min-w-0 flex-1 border p-1 px-2 rounded-sm\"\n          />\n        </div>\n        <Solid.For each={users()}>\n          {(user) => {\n            return (\n              <div>\n                <Link\n                  to=\"/dashboard/users/user\"\n                  search={{\n                    userId: user.id,\n                  }}\n                  class=\"block py-2 px-3 text-blue-700\"\n                  activeProps={{ class: `font-bold` }}\n                >\n                  <pre class=\"text-sm\">\n                    {user.name}{' '}\n                    <MatchRoute\n                      to=\"/dashboard/users/user\"\n                      search={{\n                        userId: user.id,\n                      }}\n                      pending\n                    >\n                      {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                    </MatchRoute>\n                  </pre>\n                </Link>\n              </div>\n            )\n          }}\n        </Solid.For>\n      </div>\n      <div class=\"flex-initial border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/dashboard.users.user.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\n\nimport { z } from 'zod'\nimport { fetchUserById } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/users/user')({\n  validateSearch: z.object({\n    userId: z.number(),\n  }),\n  loaderDeps: ({ search: { userId } }) => ({ userId }),\n  loader: async ({ deps: { userId } }) => {\n    const user = await fetchUserById(userId)\n    return {\n      user,\n      crumb: user?.name,\n    }\n  },\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const data = Route.useLoaderData()\n\n  return (\n    <>\n      <h4 class=\"p-2 font-bold\">{data()?.user?.name}</h4>\n      <pre class=\"text-sm whitespace-pre-wrap\">\n        {JSON.stringify(data()?.user, null, 2)}\n      </pre>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/expensive/-components/Expensive.tsx",
    "content": "import * as Solid from 'solid-js'\n\nexport default function Expensive() {\n  return (\n    <div class={`p-2`}>\n      I am an \"expensive\" component... which really just means that I was\n      code-split 😉\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/expensive/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport Expensive from './-components/Expensive'\n\nexport const Route = createFileRoute('/expensive/')({\n  component: Expensive,\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { Link } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class={`p-2`}>\n      <div class={`text-lg`}>Welcome Home!</div>\n      <hr class={`my-2`} />\n      <Link\n        to=\"/dashboard/invoices/$invoiceId\"\n        params={{\n          invoiceId: 3,\n        }}\n        class={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr class={`my-2`} />\n      <div class={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr class={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr class={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as Solid from 'solid-js'\nimport { useRouter } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: z.object({\n    redirect: z.string().optional(),\n  }),\n}).update({\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n\n  const context = Route.useRouteContext({\n    select: ({ auth }) => ({ auth, status: auth.status }),\n  })\n\n  const search = Route.useSearch()\n  const [username, setUsername] = Solid.createSignal('')\n\n  const onSubmit = (e: any) => {\n    e.preventDefault()\n    context().auth.login(username())\n    router.invalidate()\n  }\n\n  // Ah, the subtle nuances of client side auth. 🙄\n  Solid.createEffect(() => {\n    if (context().status === 'loggedIn' && search().redirect) {\n      router.history.push(search().redirect!)\n    }\n  })\n\n  return (\n    <Solid.Show\n      when={context().auth.status === 'loggedIn'}\n      fallback={\n        <div class=\"p-2\">\n          <div>You must log in!</div>\n          <div class=\"h-2\" />\n          <form onSubmit={onSubmit} class=\"flex gap-2\">\n            <input\n              value={username()}\n              onChange={(e) => setUsername(e.target.value)}\n              placeholder=\"Username\"\n              class=\"border p-1 px-2 rounded-sm\"\n            />\n            <button\n              type=\"submit\"\n              class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n            >\n              Login\n            </button>\n          </form>\n        </div>\n      }\n    >\n      <div>\n        Logged in as <strong>{context().auth.username}</strong>\n        <div class=\"h-2\" />\n        <button\n          onClick={() => {\n            context().auth.logout()\n            router.invalidate()\n          }}\n          class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n        >\n          Log out\n        </button>\n        <div class=\"h-2\" />\n      </div>\n    </Solid.Show>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/utils/auth.tsx",
    "content": "import { createStore } from 'solid-js/store'\n\nexport const [auth, setAuth] = createStore<Auth>({\n  status: 'loggedOut',\n  username: undefined,\n  login: (username: string) => {\n    setAuth({\n      status: 'loggedIn',\n      username,\n    })\n  },\n  logout: () => {\n    setAuth({\n      status: 'loggedOut',\n      username: undefined,\n    })\n  },\n})\n\nexport type Auth = {\n  login: (username: string) => void\n  logout: () => void\n  status: 'loggedOut' | 'loggedIn'\n  username?: string\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/utils/mockTodos.ts",
    "content": "import axios from 'redaxios'\nimport { produce } from 'immer'\nimport { actionDelayFn, loaderDelayFn, shuffle } from './utils'\n\ntype PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> &\n  Required<Pick<TValue, TKey>>\n\nexport type Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nlet invoices: Array<Invoice> = null!\nlet users: Array<User> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\nlet usersPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nconst ensureUsers = async () => {\n  if (!usersPromise) {\n    usersPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/users',\n      )\n      users = data.slice(0, 10)\n    })\n  }\n\n  await usersPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n\nexport async function postInvoice(partialInvoice: Partial<Invoice>) {\n  return actionDelayFn(() => {\n    if (partialInvoice.title?.includes('error')) {\n      console.error('error')\n      throw new Error('Ouch!')\n    }\n    const invoice = {\n      id: invoices.length + 1,\n      title:\n        partialInvoice.title ?? `New Invoice ${String(Date.now()).slice(0, 5)}`,\n      body:\n        partialInvoice.body ??\n        shuffle(\n          `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n      Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. \n      Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna.  Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.\n      `.split(' '),\n        ).join(' '),\n    }\n    invoices = [...invoices, invoice]\n    return invoice\n  })\n}\n\nexport async function patchInvoice({\n  id,\n  ...updatedInvoice\n}: PickAsRequired<Partial<Invoice>, 'id'>) {\n  return actionDelayFn(() => {\n    invoices = produce(invoices, (draft) => {\n      const invoice = draft.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found.')\n      }\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (updatedInvoice.title?.toLocaleLowerCase()?.includes('error')) {\n        throw new Error('Ouch!')\n      }\n      Object.assign(invoice, updatedInvoice)\n    })\n\n    return invoices.find((d) => d.id === id)\n  })\n}\n\nexport type UsersSortBy = 'name' | 'id' | 'email'\n\nexport async function fetchUsers({\n  filterBy,\n  sortBy,\n}: { filterBy?: string; sortBy?: UsersSortBy } = {}) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => {\n      let usersDraft = users\n\n      if (filterBy) {\n        usersDraft = usersDraft.filter((d) =>\n          d.name.toLowerCase().includes(filterBy.toLowerCase()),\n        )\n      }\n\n      if (sortBy) {\n        usersDraft = [...usersDraft].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n      }\n\n      return usersDraft\n    }),\n  )\n}\n\nexport async function fetchUserById(id: number) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => users.find((d) => d.id === id)),\n  )\n}\n\nexport async function fetchRandomNumber() {\n  return loaderDelayFn(() => {\n    return Math.random()\n  })\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/src/utils/utils.tsx",
    "content": "export async function loaderDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\nexport async function actionDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('actionDelay') ?? 0)\n  await new Promise((r) => setTimeout(r, delay))\n  return fn()\n}\n\nexport function shuffle<T>(arr: Array<T>): Array<T> {\n  let i = arr.length\n  if (i == 0) return arr\n  const copy = [...arr]\n  while (--i) {\n    const j = Math.floor(Math.random() * (i + 1))\n    const a = copy[i]\n    const b = copy[j]\n    copy[i] = b!\n    copy[j] = a!\n  }\n  return copy\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport solidPlugin from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n    solidPlugin(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-kitchen-sink-solid-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"immer\": \"^10.1.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/src/Expensive.tsx",
    "content": "export default function Expensive() {\n  return (\n    <div class={`p-2`}>\n      I am an \"expensive\" component... which really just means that I was\n      code-split 😉\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/src/main.tsx",
    "content": "/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport * as Solid from 'solid-js'\nimport { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  Link,\n  MatchRoute,\n  Outlet,\n  RouterProvider,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  lazyRouteComponent,\n  redirect,\n  retainSearchParams,\n  useNavigate,\n  useRouter,\n  useRouterState,\n  useSearch,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport {\n  QueryClient,\n  QueryClientProvider,\n  queryOptions,\n  useMutation,\n  useQuery,\n} from '@tanstack/solid-query'\nimport { SolidQueryDevtools } from '@tanstack/solid-query-devtools'\nimport { z } from 'zod'\nimport {\n  fetchInvoiceById,\n  fetchInvoices,\n  fetchUserById,\n  fetchUsers,\n  patchInvoice,\n  postInvoice,\n} from './mockTodos'\nimport type { Invoice } from './mockTodos'\nimport './styles.css'\n\n//\n\ntype UsersViewSortBy = 'name' | 'id' | 'email'\n\nconst invoicesQueryOptions = () =>\n  queryOptions({\n    queryKey: ['invoices'],\n    queryFn: () => fetchInvoices(),\n  })\n\nconst invoiceQueryOptions = (invoiceId: number) =>\n  queryOptions({\n    queryKey: ['invoices', invoiceId],\n    queryFn: () => fetchInvoiceById(invoiceId),\n  })\n\nconst usersQueryOptions = ({\n  filterBy,\n  sortBy,\n}: {\n  filterBy?: string\n  sortBy?: UsersViewSortBy\n}) =>\n  queryOptions({\n    queryKey: ['users', { filterBy, sortBy }],\n    queryFn: () =>\n      fetchUsers({\n        filterBy,\n        sortBy,\n      }),\n  })\n\nconst userQueryOptions = (userId: number) =>\n  queryOptions({\n    queryKey: ['users', userId],\n    queryFn: async () => {\n      const user = await fetchUserById(userId)\n      if (!user) {\n        throw new Error('User not found.')\n      }\n      return user\n    },\n  })\n\nconst useCreateInvoiceMutation = () => {\n  return useMutation(() => ({\n    mutationKey: ['invoices', 'create'],\n    mutationFn: postInvoice,\n    onSuccess: () => queryClient.invalidateQueries(),\n  }))\n}\n\nconst useUpdateInvoiceMutation = (invoiceId: number) => {\n  return useMutation(() => ({\n    mutationKey: ['invoices', 'update', invoiceId],\n    mutationFn: patchInvoice,\n    onSuccess: () => queryClient.invalidateQueries(),\n    gcTime: 1000 * 10,\n  }))\n}\n\nfunction RouterSpinner() {\n  const isLoading = useRouterState({ select: (s) => s.status === 'pending' })\n  return <Spinner show={isLoading()} />\n}\n\n// Routes\n\n// Build our routes. We could do this in our component, too.\nconst rootRoute = createRootRouteWithContext<{\n  auth: Auth\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class={`min-h-screen flex flex-col`}>\n        <div class={`flex items-center border-b gap-2`}>\n          <h1 class={`text-3xl p-2`}>Kitchen Sink</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div class={`text-3xl`}>\n            <RouterSpinner />\n          </div>\n        </div>\n        <div class={`flex-1 flex`}>\n          <div class={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n                ['/expensive', 'Expensive'],\n                ['/route-a', 'Pathless Layout A'],\n                ['/route-b', 'Pathless Layout B'],\n                ['/profile', 'Profile'],\n                ['/login', 'Login'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    class={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ class: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div class={`flex-1 border-l`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <TanStackRouterDevtools position=\"bottom-right\" />\n      <SolidQueryDevtools buttonPosition=\"top-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class={`p-2`}>\n      <div class={`text-lg`}>Welcome Home!</div>\n      <hr class={`my-2`} />\n      <Link\n        to={invoiceRoute.to}\n        params={{\n          invoiceId: 3,\n        }}\n        class={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr class={`my-2`} />\n      <div class={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr class={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr class={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n\nconst dashboardLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'dashboard',\n  component: DashboardLayoutComponent,\n})\n\nfunction DashboardLayoutComponent() {\n  return (\n    <>\n      <div class=\"flex items-center border-b\">\n        <h2 class=\"text-xl p-2\">Dashboard</h2>\n      </div>\n      <div class=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['/dashboard', 'Summary', true],\n            ['/dashboard/invoices', 'Invoices'],\n            ['/dashboard/users', 'Users'],\n          ] as const\n        ).map(([to, label, exact]) => {\n          return (\n            <Link\n              to={to}\n              activeOptions={{ exact }}\n              activeProps={{ class: `font-bold` }}\n              class=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n\nconst dashboardIndexRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: '/',\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(invoicesQueryOptions()),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const invoicesQuery = useQuery(() => invoicesQueryOptions())\n  const invoices = invoicesQuery.data\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{invoices?.length} total invoices</strong>.\n      </div>\n    </div>\n  )\n}\n\nconst invoicesLayoutRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: 'invoices',\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(invoicesQueryOptions()),\n  component: InvoicesLayoutComponent,\n})\n\nfunction InvoicesLayoutComponent() {\n  const invoicesQuery = useQuery(() => invoicesQueryOptions())\n  const invoices = invoicesQuery.data\n  // const updateInvoiceMutation = useUpdateInvoiceMutation()\n  // const createInvoiceMutation = useCreateInvoiceMutation()\n\n  return (\n    <div class=\"flex-1 flex\">\n      {/* {routerTransitionIsPending ? 'pending' : 'null'} */}\n      <div class=\"divide-y w-48\">\n        {invoices?.map((invoice) => {\n          // const updateSubmission = updateInvoiceMutation.submissions.find(\n          //   (d) => d.variables?.id === invoice.id,\n          // )\n\n          // if (updateSubmission) {\n          //   invoice = {\n          //     ...invoice,\n          //     ...updateSubmission.variables,\n          //   }\n          // }\n\n          return (\n            <div>\n              <Link\n                to=\"/dashboard/invoices/$invoiceId\"\n                params={{\n                  invoiceId: invoice.id,\n                }}\n                preload=\"intent\"\n                class=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ class: `font-bold` }}\n              >\n                <pre class=\"text-sm\">\n                  #{invoice.id} - {invoice.title.slice(0, 10)}{' '}\n                  {/* {updateSubmission ? (\n                      <Spinner />\n                    ) : ( */}\n                  <MatchRoute\n                    to={invoiceRoute.to}\n                    params={{\n                      invoiceId: invoice.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                  {/* )} */}\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n        {/* {createSubmissions.map((action) => (\n            <div key={action.submittedAt}>\n              <a href=\"#\" class=\"block py-2 px-3 text-blue-700\">\n                <pre class=\"text-sm\">\n                  #<Spinner /> - {action.variables.title?.slice(0, 10)}\n                </pre>\n              </a>\n            </div>\n          ))} */}\n      </div>\n      <div class=\"flex-1 border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesLayoutRoute,\n  path: '/',\n  component: InvoicesIndexComponent,\n})\n\nfunction InvoicesIndexComponent() {\n  const createInvoiceMutation = useCreateInvoiceMutation()\n\n  return (\n    <>\n      <div class=\"p-2\">\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n            createInvoiceMutation.mutate({\n              title: formData.get('title') as string,\n              body: formData.get('body') as string,\n            })\n          }}\n          class=\"space-y-2\"\n        >\n          <div>Create a new Invoice:</div>\n          <InvoiceFields invoice={{} as Invoice} />\n          <div>\n            <button\n              class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              disabled={createInvoiceMutation.status === 'pending'}\n            >\n              {createInvoiceMutation.status === 'pending' ? (\n                <>\n                  Creating <Spinner />\n                </>\n              ) : (\n                'Create'\n              )}\n            </button>\n          </div>\n          {createInvoiceMutation.status === 'success' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Created!\n            </div>\n          ) : createInvoiceMutation.status === 'error' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to create.\n            </div>\n          ) : null}\n        </form>\n      </div>\n    </>\n  )\n}\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesLayoutRoute,\n  path: '$invoiceId',\n  params: {\n    parse: (params) => ({\n      invoiceId: z.number().int().parse(Number(params.invoiceId)),\n    }),\n    stringify: ({ invoiceId }) => ({ invoiceId: `${invoiceId}` }),\n  },\n  validateSearch: (search) =>\n    z\n      .object({\n        showNotes: z.boolean().optional(),\n        notes: z.string().optional(),\n      })\n      .parse(search),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(\n      invoiceQueryOptions(opts.params.invoiceId),\n    ),\n  component: InvoiceComponent,\n})\n\nfunction InvoiceComponent() {\n  const params = invoiceRoute.useParams()\n  const search = invoiceRoute.useSearch()\n  const navigate = useNavigate({ from: invoiceRoute.fullPath })\n  const invoiceQuery = useQuery(() => invoiceQueryOptions(params().invoiceId))\n  const invoice = invoiceQuery.data\n  const updateInvoiceMutation = useUpdateInvoiceMutation(params().invoiceId)\n  const [notes, setNotes] = Solid.createSignal(search().notes ?? '')\n\n  Solid.createEffect(() => {\n    navigate({\n      search: (old: any) => ({\n        ...old,\n        notes: notes() ? notes() : undefined,\n      }),\n      replace: true,\n      params: true,\n    })\n  })\n\n  return (\n    <form\n      onSubmit={(event) => {\n        event.preventDefault()\n        event.stopPropagation()\n        const formData = new FormData(event.target as HTMLFormElement)\n        updateInvoiceMutation.mutate({\n          id: invoice!.id,\n          title: formData.get('title') as string,\n          body: formData.get('body') as string,\n        })\n      }}\n      class=\"p-2 space-y-2\"\n    >\n      <InvoiceFields\n        invoice={invoice!}\n        disabled={updateInvoiceMutation.status === 'pending'}\n      />\n      <div>\n        <Link\n          search={(old: any) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          class=\"text-blue-700\"\n          from={invoiceRoute.fullPath}\n          params={true}\n        >\n          {search().showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search().showNotes ? (\n          <>\n            <div>\n              <div class=\"h-2\" />\n              <textarea\n                value={notes()}\n                onChange={(e) => {\n                  setNotes(e.target.value)\n                }}\n                rows={5}\n                class=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div class=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n      <div>\n        <button\n          class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n          disabled={updateInvoiceMutation.status === 'pending'}\n        >\n          Save\n        </button>\n      </div>\n      {updateInvoiceMutation.variables?.id === invoice?.id ? (\n        <div>\n          {updateInvoiceMutation.status === 'success' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Saved!\n            </div>\n          ) : updateInvoiceMutation.status === 'error' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to save.\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n    </form>\n  )\n}\n\nconst usersLayoutRoute = createRoute({\n  getParentRoute: () => dashboardLayoutRoute,\n  path: 'users',\n  validateSearch: z.object({\n    usersView: z\n      .object({\n        sortBy: z.enum(['name', 'id', 'email']).optional(),\n        filterBy: z.string().optional(),\n      })\n      .optional(),\n  }).parse,\n  search: {\n    // Retain the usersView search param while navigating\n    // within or to this route (or it's children!)\n    middlewares: [retainSearchParams(['usersView'])],\n  },\n  loaderDeps: ({ search }) => ({\n    filterBy: search.usersView?.filterBy,\n    sortBy: search.usersView?.sortBy,\n  }),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(usersQueryOptions(opts.deps)),\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const navigate = useNavigate({ from: usersLayoutRoute.fullPath })\n  const search = usersLayoutRoute.useSearch()\n  const usersQuery = useQuery(() =>\n    usersQueryOptions(usersLayoutRoute.useLoaderDeps()()),\n  )\n  const users = usersQuery.data\n  const sortBy = Solid.createMemo(() => search().usersView?.sortBy ?? 'name')\n  const filterBy = Solid.createMemo(() => search().usersView?.filterBy)\n\n  const [filterDraft, setFilterDraft] = Solid.createSignal(filterBy() ?? '')\n\n  Solid.createEffect(() => {\n    setFilterDraft(filterBy() ?? '')\n  })\n\n  const sortedUsers = Solid.createMemo(() => {\n    if (!users) return []\n\n    return !sortBy\n      ? users\n      : [...users].sort((a: any, b: any) => {\n          return a[sortBy()] > b[sortBy()] ? 1 : -1\n        })\n  })\n\n  const filteredUsers = Solid.createMemo(() => {\n    if (!filterBy()) return sortedUsers()\n\n    return sortedUsers().filter((user) =>\n      user.name.toLowerCase().includes(filterBy()?.toLowerCase() ?? ''),\n    )\n  })\n\n  const setSortBy = (sortBy: UsersViewSortBy) =>\n    navigate({\n      search: (old: any) => {\n        return {\n          ...old,\n          usersView: {\n            ...(old.usersView ?? {}),\n            sortBy,\n          },\n        }\n      },\n      replace: true,\n    })\n\n  Solid.createEffect(() => {\n    navigate({\n      search: (old: any) => {\n        return {\n          ...old,\n          usersView: {\n            ...old.usersView,\n            filterBy: filterDraft() || undefined,\n          },\n        }\n      },\n      replace: true,\n    })\n  }, [filterDraft])\n\n  return (\n    <div class=\"flex-1 flex\">\n      <div class=\"divide-y\">\n        <div class=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Sort By:</div>\n          <select\n            value={sortBy()}\n            onChange={(e) => setSortBy(e.target.value as UsersViewSortBy)}\n            class=\"flex-1 border p-1 px-2 rounded-sm\"\n          >\n            {['name', 'id', 'email'].map((d) => {\n              return <option value={d} children={d} />\n            })}\n          </select>\n        </div>\n        <div class=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Filter By:</div>\n          <input\n            value={filterDraft()}\n            onChange={(e) => setFilterDraft(e.target.value)}\n            placeholder=\"Search Names...\"\n            class=\"min-w-0 flex-1 border p-1 px-2 rounded-sm\"\n          />\n        </div>\n        {filteredUsers().map((user) => {\n          return (\n            <div>\n              <Link\n                to=\"/dashboard/users/user\"\n                search={{\n                  userId: user.id,\n                }}\n                class=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ class: `font-bold` }}\n              >\n                <pre class=\"text-sm\">\n                  {user.name}{' '}\n                  <MatchRoute\n                    to={userRoute.to}\n                    search={{\n                      userId: user.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div class=\"flex-initial border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst usersIndexRoute = createRoute({\n  getParentRoute: () => usersLayoutRoute,\n  path: '/',\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <p>\n        Normally, setting default search parameters would either need to be done\n        manually in every link to a page, or as a side-effect (not a great\n        experience).\n      </p>\n      <p>\n        Instead, we can use <strong>search filters</strong> to provide defaults\n        or even persist search params for links to routes (and child routes).\n      </p>\n      <p>\n        A good example of this is the sorting and filtering of the users list.\n        In a traditional router, both would be lost while navigating around\n        individual users or even changing each sort/filter option unless each\n        state was manually passed from the current route into each new link we\n        created (that's a lot of tedious and error-prone work). With TanStack\n        router and search filters, they are persisted with little effort.\n      </p>\n    </div>\n  )\n}\n\nconst userRoute = createRoute({\n  getParentRoute: () => usersLayoutRoute,\n  path: 'user',\n  validateSearch: z.object({\n    userId: z.number(),\n  }),\n  loaderDeps: ({ search }) => ({\n    userId: search.userId,\n  }),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(\n      userQueryOptions(opts.deps.userId),\n    ),\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const search = userRoute.useSearch()\n  const userQuery = useQuery(() => userQueryOptions(search().userId))\n  const user = userQuery.data\n\n  return (\n    <>\n      <h4 class=\"p-2 font-bold\">{user?.name}</h4>\n      <pre class=\"text-sm whitespace-pre-wrap\">\n        {JSON.stringify(user, null, 2)}\n      </pre>\n    </>\n  )\n}\n\nconst expensiveRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  // Your elements can be asynchronous, which means you can code-split!\n  path: 'expensive',\n  component: lazyRouteComponent(() => import('./Expensive')),\n})\n\nconst authPathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'auth',\n  // Before loading, authenticate the user via our auth context\n  // This will also happen during prefetching (e.g. hovering over links, etc)\n  beforeLoad: ({ context, location }) => {\n    // If the user is logged out, redirect them to the login page\n    if (context.auth.status === 'loggedOut') {\n      throw redirect({\n        to: loginRoute.to,\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n\n    // Otherwise, return the user in context\n    return {\n      username: auth.username,\n    }\n  },\n})\n\nconst profileRoute = createRoute({\n  getParentRoute: () => authPathlessLayoutRoute,\n  path: 'profile',\n  component: ProfileComponent,\n})\n\nfunction ProfileComponent() {\n  const routeContext = profileRoute.useRouteContext()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <div>\n        Username:<strong>{routeContext().username}</strong>\n      </div>\n    </div>\n  )\n}\n\nconst loginRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'login',\n  validateSearch: z.object({\n    redirect: z.string().optional(),\n  }),\n}).update({\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const routeContext = loginRoute.useRouteContext({\n    select: ({ auth }) => ({ auth, status: auth.status }),\n  })\n  const search = useSearch({ from: loginRoute.fullPath })\n  const [username, setUsername] = Solid.createSignal('')\n\n  const onSubmit = (e: any) => {\n    e.preventDefault()\n    routeContext()?.auth.login(username())\n    router.invalidate()\n  }\n\n  // Ah, the subtle nuances of client side auth. 🙄\n  Solid.createRenderEffect(() => {\n    if (routeContext().status === 'loggedIn' && search().redirect) {\n      router.history.push(search().redirect!)\n    }\n  }, [routeContext().status, search().redirect])\n\n  return status === 'loggedIn' ? (\n    <div>\n      Logged in as <strong>{routeContext().auth.username}</strong>\n      <div class=\"h-2\" />\n      <button\n        onClick={() => routeContext().auth.logout()}\n        class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n      >\n        Log out\n      </button>\n      <div class=\"h-2\" />\n    </div>\n  ) : (\n    <div class=\"p-2\">\n      <div>You must log in!</div>\n      <div class=\"h-2\" />\n      <form onSubmit={onSubmit} class=\"flex gap-2\">\n        <input\n          value={username()}\n          onChange={(e) => setUsername(e.target.value)}\n          placeholder=\"Username\"\n          class=\"border p-1 px-2 rounded-sm\"\n        />\n        <button\n          onClick={() => routeContext().auth.logout()}\n          class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n        >\n          Login\n        </button>\n      </form>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: 'pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>Pathless Layout</div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return (\n    <div>\n      <div>I'm A</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  path: 'route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return (\n    <div>\n      <div>i\"m B</div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  dashboardLayoutRoute.addChildren([\n    dashboardIndexRoute,\n    invoicesLayoutRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n    usersLayoutRoute.addChildren([usersIndexRoute, userRoute]),\n  ]),\n  expensiveRoute,\n  authPathlessLayoutRoute.addChildren([profileRoute]),\n  loginRoute,\n  pathlessLayoutRoute.addChildren([pathlessLayoutARoute, pathlessLayoutBRoute]),\n])\n\nconst queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div class={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,\n  context: {\n    auth: undefined!, // We'll inject this when we render\n    queryClient,\n  },\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst auth: Auth = {\n  status: 'loggedOut',\n  username: undefined,\n  login: (username: string) => {\n    auth.status = 'loggedIn'\n    auth.username = username\n  },\n  logout: () => {\n    auth.status = 'loggedOut'\n    auth.username = undefined\n  },\n}\n\nfunction App() {\n  // This stuff is just to tweak our sandbox setup in real-time\n  const [loaderDelay, setLoaderDelay] = useSessionStorage('loaderDelay', 500)\n  const [pendingMs, setPendingMs] = useSessionStorage('pendingMs', 1000)\n  const [pendingMinMs, setPendingMinMs] = useSessionStorage('pendingMinMs', 500)\n\n  return (\n    <>\n      <div class=\"text-xs fixed w-52 shadow-md shadow-black/20 rounded-sm bottom-2 left-2 bg-white dark:bg-gray-800 bg-opacity-75 border-b flex flex-col gap-1 flex-wrap items-left divide-y\">\n        <div class=\"p-2 space-y-2\">\n          <div class=\"flex gap-2\">\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(150)\n              }}\n            >\n              Fast\n            </button>\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(500)\n              }}\n            >\n              Fast 3G\n            </button>\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(2000)\n              }}\n            >\n              Slow 3G\n            </button>\n          </div>\n          <div>\n            <div>Loader Delay: {loaderDelay()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={loaderDelay()}\n              onChange={(e) => setLoaderDelay(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n        </div>\n        <div class=\"p-2 space-y-2\">\n          <div class=\"flex gap-2\">\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setPendingMs(1000)\n                setPendingMinMs(500)\n              }}\n            >\n              Reset to Default\n            </button>\n          </div>\n          <div>\n            <div>defaultPendingMs: {pendingMs()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMs()}\n              onChange={(e) => setPendingMs(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n          <div>\n            <div>defaultPendingMinMs: {pendingMinMs()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMinMs()}\n              onChange={(e) => setPendingMinMs(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n        </div>\n      </div>\n      <QueryClientProvider client={queryClient}>\n        <RouterProvider\n          router={router}\n          defaultPreload=\"intent\"\n          defaultPendingMs={pendingMs()}\n          defaultPendingMinMs={pendingMinMs()}\n          context={{\n            auth,\n          }}\n        />\n      </QueryClientProvider>\n    </>\n  )\n}\n\nfunction InvoiceFields({\n  invoice,\n  disabled,\n}: {\n  invoice: Invoice\n  disabled?: boolean\n}) {\n  return (\n    <div class=\"space-y-2\">\n      <h2 class=\"font-bold text-lg\">\n        <input\n          name=\"title\"\n          value={invoice.title}\n          placeholder=\"Invoice Title\"\n          class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n          disabled={disabled}\n        />\n      </h2>\n      <div>\n        <textarea\n          name=\"body\"\n          value={invoice.body}\n          rows={6}\n          placeholder=\"Invoice Body...\"\n          class=\"border border-opacity-50 p-2 rounded-sm w-full\"\n          disabled={disabled}\n        />\n      </div>\n    </div>\n  )\n}\n\ntype Auth = {\n  login: (username: string) => void\n  logout: () => void\n  status: 'loggedOut' | 'loggedIn'\n  username?: string\n}\n\nfunction Spinner({ show, wait }: { show?: boolean; wait?: `delay-${number}` }) {\n  return (\n    <div\n      class={`inline-block animate-spin px-3 transition ${\n        (show ?? true)\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n\nfunction useSessionStorage<T>(key: string, initialValue: T) {\n  const stored = sessionStorage.getItem(key)\n  const [state, setState] = Solid.createSignal<T>(\n    stored ? JSON.parse(stored) : initialValue,\n  )\n\n  Solid.createEffect(() => {\n    sessionStorage.setItem(key, JSON.stringify(state()))\n  })\n\n  return [state, setState]\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  render(() => <App />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/src/mockTodos.ts",
    "content": "import axios from 'redaxios'\nimport { produce } from 'immer'\nimport { actionDelayFn, loaderDelayFn, shuffle } from './utils'\n\ntype PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> &\n  Required<Pick<TValue, TKey>>\n\nexport type Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nlet invoices: Array<Invoice> = null!\nlet users: Array<User> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\nlet usersPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nconst ensureUsers = async () => {\n  if (!usersPromise) {\n    usersPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/users',\n      )\n      users = data.slice(0, 10)\n    })\n  }\n\n  await usersPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n\nexport async function postInvoice(partialInvoice: Partial<Invoice>) {\n  return actionDelayFn(() => {\n    if (partialInvoice.title?.includes('error')) {\n      console.error('error')\n      throw new Error('Ouch!')\n    }\n    const invoice = {\n      id: invoices.length + 1,\n      title:\n        partialInvoice.title ?? `New Invoice ${String(Date.now()).slice(0, 5)}`,\n      body:\n        partialInvoice.body ??\n        shuffle(\n          `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n      Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. \n      Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna.  Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.\n      `.split(' '),\n        ).join(' '),\n    }\n    invoices = [...invoices, invoice]\n    return invoice\n  })\n}\n\nexport async function patchInvoice({\n  id,\n  ...updatedInvoice\n}: PickAsRequired<Partial<Invoice>, 'id'>) {\n  return actionDelayFn(() => {\n    invoices = produce(invoices, (draft) => {\n      const invoice = draft.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found.')\n      }\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (updatedInvoice.title?.toLocaleLowerCase()?.includes('error')) {\n        throw new Error('Ouch!')\n      }\n      Object.assign(invoice, updatedInvoice)\n    })\n\n    return invoices.find((d) => d.id === id)\n  })\n}\n\nexport type UsersSortBy = 'name' | 'id' | 'email'\n\nexport async function fetchUsers({\n  filterBy,\n  sortBy,\n}: { filterBy?: string; sortBy?: UsersSortBy } = {}) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => {\n      let usersDraft = users\n\n      if (filterBy) {\n        usersDraft = usersDraft.filter((d) =>\n          d.name.toLowerCase().includes(filterBy.toLowerCase()),\n        )\n      }\n\n      if (sortBy) {\n        usersDraft = [...usersDraft].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n      }\n\n      return usersDraft\n    }),\n  )\n}\n\nexport async function fetchUserById(id: number) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => users.find((d) => d.id === id)),\n  )\n}\n\nexport async function fetchRandomNumber() {\n  return loaderDelayFn(() => {\n    return Math.random()\n  })\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/src/utils.tsx",
    "content": "export async function loaderDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\nexport async function actionDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('actionDelay') ?? 0)\n  await new Promise((r) => setTimeout(r, delay))\n  return fn()\n}\n\nexport function shuffle<T>(arr: Array<T>): Array<T> {\n  let i = arr.length\n  if (i == 0) return arr\n  const copy = [...arr]\n  while (--i) {\n    const j = Math.floor(Math.random() * (i + 1))\n    const a = copy[i]\n    const b = copy[j]\n    copy[i] = b!\n    copy[j] = a!\n  }\n  return copy\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/tsconfig.dev.json",
    "content": "{\n  \"composite\": true,\n  \"extends\": \"../../../tsconfig.base.json\",\n\n  \"files\": [\"src/main.tsx\"],\n  \"include\": [\n    \"src\"\n    // \"__tests__/**/*.test.*\"\n  ]\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-kitchen-sink-solid-query-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"immer\": \"^10.1.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/components/InvoiceFields.tsx",
    "content": "import type { Invoice } from '../utils/mockTodos'\n\nexport function InvoiceFields({\n  invoice,\n  disabled,\n}: {\n  invoice?: Invoice\n  disabled?: boolean\n}) {\n  return (\n    <div class=\"space-y-2\">\n      <h2 class=\"font-bold text-lg\">\n        <input\n          name=\"title\"\n          value={invoice?.title ?? ''}\n          placeholder=\"Invoice Title\"\n          class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n          disabled={disabled}\n        />\n      </h2>\n      <div>\n        <textarea\n          name=\"body\"\n          value={invoice?.body ?? ''}\n          rows={6}\n          placeholder=\"Invoice Body...\"\n          class=\"border border-opacity-50 p-2 rounded-sm w-full\"\n          disabled={disabled}\n        />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/components/Spinner.tsx",
    "content": "export function Spinner({\n  show,\n  wait,\n}: {\n  show?: () => boolean\n  wait?: `delay-${number}`\n}) {\n  return (\n    <div\n      class={`inline-block animate-spin px-3 transition ${\n        show && show() === true\n          ? `opacity-100 duration-500 ${wait ?? 'delay-300'}`\n          : 'duration-500 opacity-0 delay-0'\n      }`}\n    >\n      ⍥\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/hooks/useSessionStorage.tsx",
    "content": "import * as Solid from 'solid-js'\n\nexport function useSessionStorage<T>(key: string, initialValue: T) {\n  const stored = sessionStorage.getItem(key)\n  const [state, setState] = Solid.createSignal<T>(\n    stored ? JSON.parse(stored) : initialValue,\n  )\n\n  Solid.createEffect(() => {\n    sessionStorage.setItem(key, JSON.stringify(state()))\n  }, [state()])\n\n  return [state, setState]\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  RouterProvider,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/solid-query'\nimport { auth } from './utils/auth'\nimport { Spinner } from './components/Spinner'\nimport { routeTree } from './routeTree.gen'\nimport { useSessionStorage } from './hooks/useSessionStorage'\nimport './styles.css'\n\n//\n\nexport const queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div class={`p-2 text-2xl`}>\n      <Spinner show={() => true} />\n    </div>\n  ),\n  defaultErrorComponent: ({ error }) => <ErrorComponent error={error} />,\n  context: {\n    auth: undefined!, // We'll inject this when we render\n    queryClient: queryClient, // Type assertion to fix the type mismatch\n  },\n  defaultPreload: 'intent',\n  // Since we're using Solid Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction App() {\n  // This stuff is just to tweak our sandbox setup in real-time\n  const [loaderDelay, setLoaderDelay] = useSessionStorage('loaderDelay', 500)\n  const [pendingMs, setPendingMs] = useSessionStorage('pendingMs', 1000)\n  const [pendingMinMs, setPendingMinMs] = useSessionStorage('pendingMinMs', 500)\n\n  return (\n    <>\n      <div class=\"text-xs fixed w-52 shadow-md shadow-black/20 rounded-sm bottom-2 left-2 bg-white dark:bg-gray-800 bg-opacity-75 border-b flex flex-col gap-1 flex-wrap items-left divide-y\">\n        <div class=\"p-2 space-y-2\">\n          <div class=\"flex gap-2\">\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(150)\n              }}\n            >\n              Fast\n            </button>\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(500)\n              }}\n            >\n              Fast 3G\n            </button>\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setLoaderDelay(2000)\n              }}\n            >\n              Slow 3G\n            </button>\n          </div>\n          <div>\n            <div>Loader Delay: {loaderDelay()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={loaderDelay()}\n              onChange={(e) => setLoaderDelay(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n        </div>\n        <div class=\"p-2 space-y-2\">\n          <div class=\"flex gap-2\">\n            <button\n              class=\"bg-blue-500 text-white rounded-sm p-1 px-2\"\n              onClick={() => {\n                setPendingMs(1000)\n                setPendingMinMs(500)\n              }}\n            >\n              Reset to Default\n            </button>\n          </div>\n          <div>\n            <div>defaultPendingMs: {pendingMs()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMs()}\n              onChange={(e) => setPendingMs(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n          <div>\n            <div>defaultPendingMinMs: {pendingMinMs()}ms</div>\n            <input\n              type=\"range\"\n              min=\"0\"\n              max=\"5000\"\n              step=\"100\"\n              value={pendingMinMs()}\n              onChange={(e) => setPendingMinMs(e.target.valueAsNumber)}\n              class=\"w-full\"\n            />\n          </div>\n        </div>\n      </div>\n      <RouterProvider\n        router={router}\n        defaultPreload=\"intent\"\n        defaultPendingMs={pendingMs()}\n        defaultPendingMinMs={pendingMinMs()}\n        context={{\n          auth,\n        }}\n      />\n    </>\n  )\n}\n\nconst rootElement = document.getElementById('app')!\nif (!rootElement.innerHTML) {\n  render(\n    () => (\n      <QueryClientProvider client={queryClient}>\n        <App />\n      </QueryClientProvider>\n    ),\n    rootElement,\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as AuthRouteImport } from './routes/_auth'\nimport { Route as DashboardRouteRouteImport } from './routes/dashboard.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ExpensiveIndexRouteImport } from './routes/expensive/index'\nimport { Route as DashboardIndexRouteImport } from './routes/dashboard.index'\nimport { Route as FooBarRouteImport } from './routes/foo/bar'\nimport { Route as PathlessLayoutRouteBRouteImport } from './routes/_pathlessLayout.route-b'\nimport { Route as PathlessLayoutRouteARouteImport } from './routes/_pathlessLayout.route-a'\nimport { Route as AuthProfileRouteImport } from './routes/_auth.profile'\nimport { Route as DashboardUsersRouteRouteImport } from './routes/dashboard.users.route'\nimport { Route as DashboardInvoicesRouteRouteImport } from './routes/dashboard.invoices.route'\nimport { Route as DashboardUsersIndexRouteImport } from './routes/dashboard.users.index'\nimport { Route as DashboardInvoicesIndexRouteImport } from './routes/dashboard.invoices.index'\nimport { Route as DashboardUsersUserRouteImport } from './routes/dashboard.users.user'\nimport { Route as DashboardInvoicesInvoiceIdRouteImport } from './routes/dashboard.invoices.$invoiceId'\n\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthRoute = AuthRouteImport.update({\n  id: '/_auth',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardRouteRoute = DashboardRouteRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ExpensiveIndexRoute = ExpensiveIndexRouteImport.update({\n  id: '/expensive/',\n  path: '/expensive/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardIndexRoute = DashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\nconst FooBarRoute = FooBarRouteImport.update({\n  id: '/foo/bar',\n  path: '/foo/bar',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRouteBRoute = PathlessLayoutRouteBRouteImport.update({\n  id: '/route-b',\n  path: '/route-b',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst PathlessLayoutRouteARoute = PathlessLayoutRouteARouteImport.update({\n  id: '/route-a',\n  path: '/route-a',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst AuthProfileRoute = AuthProfileRouteImport.update({\n  id: '/profile',\n  path: '/profile',\n  getParentRoute: () => AuthRoute,\n} as any)\nconst DashboardUsersRouteRoute = DashboardUsersRouteRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\nconst DashboardInvoicesRouteRoute = DashboardInvoicesRouteRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => DashboardRouteRoute,\n} as any)\nconst DashboardUsersIndexRoute = DashboardUsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardUsersRouteRoute,\n} as any)\nconst DashboardInvoicesIndexRoute = DashboardInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardInvoicesRouteRoute,\n} as any)\nconst DashboardUsersUserRoute = DashboardUsersUserRouteImport.update({\n  id: '/user',\n  path: '/user',\n  getParentRoute: () => DashboardUsersRouteRoute,\n} as any)\nconst DashboardInvoicesInvoiceIdRoute =\n  DashboardInvoicesInvoiceIdRouteImport.update({\n    id: '/$invoiceId',\n    path: '/$invoiceId',\n    getParentRoute: () => DashboardInvoicesRouteRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteRouteWithChildren\n  '/login': typeof LoginRoute\n  '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren\n  '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren\n  '/profile': typeof AuthProfileRoute\n  '/route-a': typeof PathlessLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutRouteBRoute\n  '/foo/bar': typeof FooBarRoute\n  '/dashboard/': typeof DashboardIndexRoute\n  '/expensive/': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users/': typeof DashboardUsersIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/profile': typeof AuthProfileRoute\n  '/route-a': typeof PathlessLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutRouteBRoute\n  '/foo/bar': typeof FooBarRoute\n  '/dashboard': typeof DashboardIndexRoute\n  '/expensive': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users': typeof DashboardUsersIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteRouteWithChildren\n  '/_auth': typeof AuthRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/login': typeof LoginRoute\n  '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren\n  '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren\n  '/_auth/profile': typeof AuthProfileRoute\n  '/_pathlessLayout/route-a': typeof PathlessLayoutRouteARoute\n  '/_pathlessLayout/route-b': typeof PathlessLayoutRouteBRoute\n  '/foo/bar': typeof FooBarRoute\n  '/dashboard/': typeof DashboardIndexRoute\n  '/expensive/': typeof ExpensiveIndexRoute\n  '/dashboard/invoices/$invoiceId': typeof DashboardInvoicesInvoiceIdRoute\n  '/dashboard/users/user': typeof DashboardUsersUserRoute\n  '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute\n  '/dashboard/users/': typeof DashboardUsersIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/dashboard'\n    | '/login'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n    | '/profile'\n    | '/route-a'\n    | '/route-b'\n    | '/foo/bar'\n    | '/dashboard/'\n    | '/expensive/'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices/'\n    | '/dashboard/users/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/login'\n    | '/profile'\n    | '/route-a'\n    | '/route-b'\n    | '/foo/bar'\n    | '/dashboard'\n    | '/expensive'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n  id:\n    | '__root__'\n    | '/'\n    | '/dashboard'\n    | '/_auth'\n    | '/_pathlessLayout'\n    | '/login'\n    | '/dashboard/invoices'\n    | '/dashboard/users'\n    | '/_auth/profile'\n    | '/_pathlessLayout/route-a'\n    | '/_pathlessLayout/route-b'\n    | '/foo/bar'\n    | '/dashboard/'\n    | '/expensive/'\n    | '/dashboard/invoices/$invoiceId'\n    | '/dashboard/users/user'\n    | '/dashboard/invoices/'\n    | '/dashboard/users/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DashboardRouteRoute: typeof DashboardRouteRouteWithChildren\n  AuthRoute: typeof AuthRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  FooBarRoute: typeof FooBarRoute\n  ExpensiveIndexRoute: typeof ExpensiveIndexRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/expensive/': {\n      id: '/expensive/'\n      path: '/expensive'\n      fullPath: '/expensive/'\n      preLoaderRoute: typeof ExpensiveIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardIndexRouteImport\n      parentRoute: typeof DashboardRouteRoute\n    }\n    '/foo/bar': {\n      id: '/foo/bar'\n      path: '/foo/bar'\n      fullPath: '/foo/bar'\n      preLoaderRoute: typeof FooBarRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/route-b': {\n      id: '/_pathlessLayout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_pathlessLayout/route-a': {\n      id: '/_pathlessLayout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/_auth/profile': {\n      id: '/_auth/profile'\n      path: '/profile'\n      fullPath: '/profile'\n      preLoaderRoute: typeof AuthProfileRouteImport\n      parentRoute: typeof AuthRoute\n    }\n    '/dashboard/users': {\n      id: '/dashboard/users'\n      path: '/users'\n      fullPath: '/dashboard/users'\n      preLoaderRoute: typeof DashboardUsersRouteRouteImport\n      parentRoute: typeof DashboardRouteRoute\n    }\n    '/dashboard/invoices': {\n      id: '/dashboard/invoices'\n      path: '/invoices'\n      fullPath: '/dashboard/invoices'\n      preLoaderRoute: typeof DashboardInvoicesRouteRouteImport\n      parentRoute: typeof DashboardRouteRoute\n    }\n    '/dashboard/users/': {\n      id: '/dashboard/users/'\n      path: '/'\n      fullPath: '/dashboard/users/'\n      preLoaderRoute: typeof DashboardUsersIndexRouteImport\n      parentRoute: typeof DashboardUsersRouteRoute\n    }\n    '/dashboard/invoices/': {\n      id: '/dashboard/invoices/'\n      path: '/'\n      fullPath: '/dashboard/invoices/'\n      preLoaderRoute: typeof DashboardInvoicesIndexRouteImport\n      parentRoute: typeof DashboardInvoicesRouteRoute\n    }\n    '/dashboard/users/user': {\n      id: '/dashboard/users/user'\n      path: '/user'\n      fullPath: '/dashboard/users/user'\n      preLoaderRoute: typeof DashboardUsersUserRouteImport\n      parentRoute: typeof DashboardUsersRouteRoute\n    }\n    '/dashboard/invoices/$invoiceId': {\n      id: '/dashboard/invoices/$invoiceId'\n      path: '/$invoiceId'\n      fullPath: '/dashboard/invoices/$invoiceId'\n      preLoaderRoute: typeof DashboardInvoicesInvoiceIdRouteImport\n      parentRoute: typeof DashboardInvoicesRouteRoute\n    }\n  }\n}\n\ninterface DashboardInvoicesRouteRouteChildren {\n  DashboardInvoicesInvoiceIdRoute: typeof DashboardInvoicesInvoiceIdRoute\n  DashboardInvoicesIndexRoute: typeof DashboardInvoicesIndexRoute\n}\n\nconst DashboardInvoicesRouteRouteChildren: DashboardInvoicesRouteRouteChildren =\n  {\n    DashboardInvoicesInvoiceIdRoute: DashboardInvoicesInvoiceIdRoute,\n    DashboardInvoicesIndexRoute: DashboardInvoicesIndexRoute,\n  }\n\nconst DashboardInvoicesRouteRouteWithChildren =\n  DashboardInvoicesRouteRoute._addFileChildren(\n    DashboardInvoicesRouteRouteChildren,\n  )\n\ninterface DashboardUsersRouteRouteChildren {\n  DashboardUsersUserRoute: typeof DashboardUsersUserRoute\n  DashboardUsersIndexRoute: typeof DashboardUsersIndexRoute\n}\n\nconst DashboardUsersRouteRouteChildren: DashboardUsersRouteRouteChildren = {\n  DashboardUsersUserRoute: DashboardUsersUserRoute,\n  DashboardUsersIndexRoute: DashboardUsersIndexRoute,\n}\n\nconst DashboardUsersRouteRouteWithChildren =\n  DashboardUsersRouteRoute._addFileChildren(DashboardUsersRouteRouteChildren)\n\ninterface DashboardRouteRouteChildren {\n  DashboardInvoicesRouteRoute: typeof DashboardInvoicesRouteRouteWithChildren\n  DashboardUsersRouteRoute: typeof DashboardUsersRouteRouteWithChildren\n  DashboardIndexRoute: typeof DashboardIndexRoute\n}\n\nconst DashboardRouteRouteChildren: DashboardRouteRouteChildren = {\n  DashboardInvoicesRouteRoute: DashboardInvoicesRouteRouteWithChildren,\n  DashboardUsersRouteRoute: DashboardUsersRouteRouteWithChildren,\n  DashboardIndexRoute: DashboardIndexRoute,\n}\n\nconst DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren(\n  DashboardRouteRouteChildren,\n)\n\ninterface AuthRouteChildren {\n  AuthProfileRoute: typeof AuthProfileRoute\n}\n\nconst AuthRouteChildren: AuthRouteChildren = {\n  AuthProfileRoute: AuthProfileRoute,\n}\n\nconst AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutRouteARoute: typeof PathlessLayoutRouteARoute\n  PathlessLayoutRouteBRoute: typeof PathlessLayoutRouteBRoute\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutRouteARoute: PathlessLayoutRouteARoute,\n  PathlessLayoutRouteBRoute: PathlessLayoutRouteBRoute,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DashboardRouteRoute: DashboardRouteRouteWithChildren,\n  AuthRoute: AuthRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  LoginRoute: LoginRoute,\n  FooBarRoute: FooBarRoute,\n  ExpensiveIndexRoute: ExpensiveIndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/__root.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { SolidQueryDevtools } from '@tanstack/solid-query-devtools'\nimport { Spinner } from '../components/Spinner'\nimport type { QueryClient } from '@tanstack/solid-query'\nimport type { Auth } from '../utils/auth'\n\nfunction RouterSpinner() {\n  const isLoading = useRouterState({ select: (s) => s.status === 'pending' })\n  return <Spinner show={isLoading} />\n}\n\nexport const Route = createRootRouteWithContext<{\n  auth: Auth\n  queryClient: QueryClient\n}>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class={`min-h-screen flex flex-col`}>\n        <div class={`flex items-center border-b gap-2`}>\n          <h1 class={`text-3xl p-2`}>Kitchen Sink</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div class={`text-3xl`}>\n            <RouterSpinner />\n          </div>\n        </div>\n        <div class={`flex-1 flex`}>\n          <div class={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n                ['/expensive', 'Expensive'],\n                ['/route-a', 'Pathless Layout A'],\n                ['/route-b', 'Pathless Layout B'],\n                ['/profile', 'Profile'],\n                ['/login', 'Login'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    class={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ class: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div class={`flex-1 border-l`}>\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <SolidQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/_auth.profile.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_auth/profile')({\n  component: ProfileComponent,\n})\n\nfunction ProfileComponent() {\n  const routeContext = Route.useRouteContext()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <div>\n        Username:<strong>{routeContext().username}</strong>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/_auth.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { auth } from '../utils/auth'\n\nexport const Route = createFileRoute('/_auth')({\n  // Before loading, authenticate the user via our auth context\n  // This will also happen during prefetching (e.g. hovering over links, etc)\n  beforeLoad: ({ context, location }) => {\n    // If the user is logged out, redirect them to the login page\n    if (context.auth.status === 'loggedOut') {\n      throw redirect({\n        to: '/login',\n        search: {\n          // Use the current location to power a redirect after login\n          // (Do not use `router.state.resolvedLocation` as it can\n          // potentially lag behind the actual current location)\n          redirect: location.href,\n        },\n      })\n    }\n\n    // Otherwise, return the user in context\n    return {\n      username: auth.username,\n    }\n  },\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/_pathlessLayout.route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/route-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/_pathlessLayout.route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/route-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>Layout</div>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.index.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { invoicesQueryOptions } from '../utils/queryOptions'\n\nexport const Route = createFileRoute('/dashboard/')({\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(invoicesQueryOptions()),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const invoicesQuery = useQuery(() => invoicesQueryOptions())\n  const invoices = invoicesQuery.data\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{invoices?.length} total invoices</strong>.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.invoices.$invoiceId.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { Link, createFileRoute, useNavigate } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { z } from 'zod'\nimport { InvoiceFields } from '../components/InvoiceFields'\nimport {\n  invoiceQueryOptions,\n  useUpdateInvoiceMutation,\n} from '../utils/queryOptions'\n\nexport const Route = createFileRoute('/dashboard/invoices/$invoiceId')({\n  params: {\n    parse: (params) => ({\n      invoiceId: z.number().int().parse(Number(params.invoiceId)),\n    }),\n    stringify: ({ invoiceId }) => ({ invoiceId: `${invoiceId}` }),\n  },\n  validateSearch: (search) =>\n    z\n      .object({\n        showNotes: z.boolean().optional(),\n        notes: z.string().optional(),\n      })\n      .parse(search),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(\n      invoiceQueryOptions(opts.params.invoiceId),\n    ),\n  component: InvoiceComponent,\n})\n\nfunction InvoiceComponent() {\n  const search = Route.useSearch()\n  const params = Route.useParams()\n  const navigate = useNavigate({ from: Route.fullPath })\n  const invoiceQuery = useQuery(() => invoiceQueryOptions(params().invoiceId))\n  const invoice = invoiceQuery.data\n  const updateInvoiceMutation = useUpdateInvoiceMutation(params().invoiceId)\n  const [notes, setNotes] = Solid.createSignal(search().notes ?? '')\n\n  Solid.createEffect(() => {\n    navigate({\n      search: (old) => ({\n        ...old,\n        notes: notes() ? notes() : undefined,\n      }),\n      replace: true,\n      params: true,\n    })\n  }, [notes])\n\n  return (\n    <form\n      onSubmit={(event) => {\n        event.preventDefault()\n        event.stopPropagation()\n        const formData = new FormData(event.target as HTMLFormElement)\n        updateInvoiceMutation.mutate({\n          id: invoice!.id,\n          title: formData.get('title') as string,\n          body: formData.get('body') as string,\n        })\n      }}\n      class=\"p-2 space-y-2\"\n    >\n      <InvoiceFields\n        invoice={invoice}\n        disabled={updateInvoiceMutation.status === 'pending'}\n      />\n      <div>\n        <Link\n          from={Route.fullPath}\n          params={true}\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          class=\"text-blue-700\"\n        >\n          {search().showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search().showNotes ? (\n          <>\n            <div>\n              <div class=\"h-2\" />\n              <textarea\n                value={notes()}\n                onChange={(e) => {\n                  setNotes(e.target.value)\n                }}\n                rows={5}\n                class=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div class=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n      <div>\n        <button\n          class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n          disabled={updateInvoiceMutation.status === 'pending'}\n        >\n          Save\n        </button>\n      </div>\n      {updateInvoiceMutation.variables?.id === invoice!.id ? (\n        <div>\n          {updateInvoiceMutation.status === 'success' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Saved!\n            </div>\n          ) : updateInvoiceMutation.status === 'error' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to save.\n            </div>\n          ) : null}\n        </div>\n      ) : null}\n    </form>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.invoices.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { InvoiceFields } from '../components/InvoiceFields'\nimport { Spinner } from '../components/Spinner'\nimport { useCreateInvoiceMutation } from '../utils/queryOptions'\nimport type { Invoice } from '../utils/mockTodos'\n\nexport const Route = createFileRoute('/dashboard/invoices/')({\n  component: InvoicesIndexComponent,\n})\n\nfunction InvoicesIndexComponent() {\n  const createInvoiceMutation = useCreateInvoiceMutation()\n\n  return (\n    <>\n      <div class=\"p-2\">\n        <form\n          onSubmit={(event) => {\n            event.preventDefault()\n            event.stopPropagation()\n            const formData = new FormData(event.target as HTMLFormElement)\n            createInvoiceMutation.mutate({\n              title: formData.get('title') as string,\n              body: formData.get('body') as string,\n            })\n          }}\n          class=\"space-y-2\"\n        >\n          <div>Create a new Invoice:</div>\n          <InvoiceFields invoice={{} as Invoice} />\n          <div>\n            <button\n              class=\"bg-blue-500 rounded-sm p-2 uppercase text-white font-black disabled:opacity-50\"\n              disabled={createInvoiceMutation.status === 'pending'}\n            >\n              {createInvoiceMutation.status === 'pending' ? (\n                <>\n                  Creating <Spinner />\n                </>\n              ) : (\n                'Create'\n              )}\n            </button>\n          </div>\n          {createInvoiceMutation.status === 'success' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-green-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Created!\n            </div>\n          ) : createInvoiceMutation.status === 'error' ? (\n            <div class=\"inline-block px-2 py-1 rounded-sm bg-red-500 text-white animate-bounce [animation-iteration-count:2.5] [animation-duration:.3s]\">\n              Failed to create.\n            </div>\n          ) : null}\n        </form>\n      </div>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.invoices.route.tsx",
    "content": "import {\n  Link,\n  MatchRoute,\n  Outlet,\n  createFileRoute,\n} from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { Spinner } from '../components/Spinner'\nimport { invoicesQueryOptions } from '../utils/queryOptions'\n\nexport const Route = createFileRoute('/dashboard/invoices')({\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(invoicesQueryOptions()),\n  component: InvoicesComponent,\n})\n\nfunction InvoicesComponent() {\n  const invoicesQuery = useQuery(() => invoicesQueryOptions())\n  const invoices = invoicesQuery.data\n\n  return (\n    <div class=\"flex-1 flex\">\n      <div class=\"divide-y w-48\">\n        {invoices?.map((invoice) => {\n          return (\n            <div>\n              <Link\n                to=\"/dashboard/invoices/$invoiceId\"\n                params={{\n                  invoiceId: invoice.id,\n                }}\n                preload=\"intent\"\n                class=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ class: `font-bold` }}\n              >\n                <pre class=\"text-sm\">\n                  #{invoice.id} - {invoice.title.slice(0, 10)}{' '}\n                  <MatchRoute\n                    to=\"/dashboard/invoices/$invoiceId\"\n                    params={{\n                      invoiceId: invoice.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div class=\"flex-1 border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  return (\n    <>\n      <div class=\"flex items-center border-b\">\n        <h2 class=\"text-xl p-2\">Dashboard</h2>\n      </div>\n      <div class=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['/dashboard', 'Summary', true],\n            ['/dashboard/invoices', 'Invoices'],\n            ['/dashboard/users', 'Users'],\n          ] as const\n        ).map(([to, label, exact]) => {\n          return (\n            <Link\n              to={to}\n              activeOptions={{ exact }}\n              activeProps={{ class: `font-bold` }}\n              class=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dashboard/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <p>\n        Normally, setting default search parameters would either need to be done\n        manually in every link to a page, or as a side-effect (not a great\n        experience).\n      </p>\n      <p>\n        Instead, we can use <strong>search filters</strong> to provide defaults\n        or even persist search params for links to routes (and child routes).\n      </p>\n      <p>\n        A good example of this is the sorting and filtering of the users list.\n        In a traditional router, both would be lost while navigating around\n        individual users or even changing each sort/filter option unless each\n        state was manually passed from the current route into each new link we\n        created (that's a lot of tedious and error-prone work). With TanStack\n        router and search filters, they are persisted with little effort.\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.users.route.tsx",
    "content": "/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport * as Solid from 'solid-js'\nimport {\n  Link,\n  MatchRoute,\n  Outlet,\n  createFileRoute,\n  retainSearchParams,\n  useNavigate,\n} from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { z } from 'zod'\nimport { Spinner } from '../components/Spinner'\nimport { usersQueryOptions } from '../utils/queryOptions'\n\ntype UsersViewSortBy = 'name' | 'id' | 'email'\n\nexport const Route = createFileRoute('/dashboard/users')({\n  validateSearch: z.object({\n    usersView: z\n      .object({\n        sortBy: z.enum(['name', 'id', 'email']).optional(),\n        filterBy: z.string().optional(),\n      })\n      .optional(),\n  }).parse,\n  search: {\n    // Retain the usersView search param while navigating\n    // within or to this route (or it's children!)\n    middlewares: [retainSearchParams(['usersView'])],\n  },\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(usersQueryOptions(opts.deps)),\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const navigate = useNavigate({ from: Route.fullPath })\n  const search = Route.useSearch()\n  const usersQuery = useQuery(() => usersQueryOptions(Route.useLoaderDeps()()))\n  const users = usersQuery.data\n  const sortBy = search().usersView?.sortBy ?? 'name'\n  const filterBy = search().usersView?.filterBy\n\n  const [filterDraft, setFilterDraft] = Solid.createSignal(filterBy ?? '')\n\n  Solid.createEffect(() => {\n    setFilterDraft(filterBy ?? '')\n  }, [filterBy])\n\n  const sortedUsers = Solid.createMemo(() => {\n    if (!users) return []\n\n    return !sortBy\n      ? users\n      : [...users].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n  }, [users, sortBy])\n\n  const filteredUsers = Solid.createMemo(() => {\n    if (!filterBy) return sortedUsers()\n\n    return sortedUsers().filter((user) =>\n      user.name.toLowerCase().includes(filterBy.toLowerCase()),\n    )\n  }, [sortedUsers, filterBy])\n\n  const setSortBy = (sortBy: UsersViewSortBy) =>\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...(old?.usersView ?? {}),\n            sortBy,\n          },\n        }\n      },\n      replace: true,\n    })\n\n  Solid.createEffect(() => {\n    navigate({\n      search: (old) => {\n        return {\n          ...old,\n          usersView: {\n            ...old?.usersView,\n            filterBy: filterDraft() || undefined,\n          },\n        }\n      },\n      replace: true,\n    })\n  }, [filterDraft])\n\n  return (\n    <div class=\"flex-1 flex\">\n      <div class=\"divide-y\">\n        <div class=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Sort By:</div>\n          <select\n            value={sortBy}\n            onChange={(e) => setSortBy(e.target.value as UsersViewSortBy)}\n            class=\"flex-1 border p-1 px-2 rounded-sm\"\n          >\n            {['name', 'id', 'email'].map((d) => {\n              return <option value={d} children={d} />\n            })}\n          </select>\n        </div>\n        <div class=\"py-2 px-3 flex gap-2 items-center bg-gray-100 dark:bg-gray-800\">\n          <div>Filter By:</div>\n          <input\n            value={filterDraft()}\n            onChange={(e) => setFilterDraft(e.target.value)}\n            placeholder=\"Search Names...\"\n            class=\"min-w-0 flex-1 border p-1 px-2 rounded-sm\"\n          />\n        </div>\n        {filteredUsers()?.map((user) => {\n          return (\n            <div>\n              <Link\n                to=\"/dashboard/users/user\"\n                search={{\n                  userId: user.id,\n                }}\n                class=\"block py-2 px-3 text-blue-700\"\n                activeProps={{ class: `font-bold` }}\n              >\n                <pre class=\"text-sm\">\n                  {user.name}{' '}\n                  <MatchRoute\n                    to=\"/dashboard/users/user\"\n                    search={{\n                      userId: user.id,\n                    }}\n                    pending\n                  >\n                    {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                  </MatchRoute>\n                </pre>\n              </Link>\n            </div>\n          )\n        })}\n      </div>\n      <div class=\"flex-initial border-l\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/dashboard.users.user.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { z } from 'zod'\nimport { createFileRoute } from '@tanstack/solid-router'\nimport { userQueryOptions } from '../utils/queryOptions'\n\nexport const Route = createFileRoute('/dashboard/users/user')({\n  validateSearch: z.object({\n    userId: z.number(),\n  }),\n  loaderDeps: ({ search: { userId } }) => ({ userId }),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(\n      userQueryOptions(opts.deps.userId),\n    ),\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const search = Route.useSearch()\n  const userQuery = useQuery(() => userQueryOptions(search().userId))\n  const user = userQuery.data\n\n  return (\n    <>\n      <h4 class=\"p-2 font-bold\">{user?.name}</h4>\n      <pre class=\"text-sm whitespace-pre-wrap\">\n        {JSON.stringify(user, null, 2)}\n      </pre>\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/expensive/-components/Expensive.tsx",
    "content": "export default function Expensive() {\n  return (\n    <div class={`p-2`}>\n      I am an \"expensive\" component... which really just means that I was\n      code-split 😉\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/expensive/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport Expensive from './-components/Expensive'\n\nexport const Route = createFileRoute('/expensive/')({\n  component: Expensive,\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/foo/bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/foo/bar')({\n  component: () => <div>{JSON.stringify(Route.useSearch())}</div>,\n  validateSearch: z.object({ asdf: z.string() }),\n})\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class={`p-2`}>\n      <div class={`text-lg`}>Welcome Home!</div>\n      <hr class={`my-2`} />\n      <Link\n        to=\"/dashboard/invoices/$invoiceId\"\n        params={{\n          invoiceId: 3,\n        }}\n        class={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr class={`my-2`} />\n      <div class={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr class={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr class={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/routes/login.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { createFileRoute, useRouter } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: z.object({\n    redirect: z.string().optional(),\n  }),\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const router = useRouter()\n  const routeContext: Solid.Accessor<{ auth: any; status: any }> =\n    Route.useRouteContext({\n      select: ({ auth }: { auth: any }) => ({ auth, status: auth.status }),\n    })\n  const search = Route.useSearch()\n  const [username, setUsername] = Solid.createSignal('')\n\n  const onSubmit = (e: SubmitEvent) => {\n    e.preventDefault()\n    routeContext().auth.login(username())\n    router.invalidate()\n  }\n\n  // Ah, the subtle nuances of client side auth. 🙄\n  Solid.createRenderEffect(() => {\n    if (routeContext().status === 'loggedIn' && search().redirect) {\n      router.history.push(search().redirect || '')\n    }\n  }, [routeContext().status, search().redirect])\n\n  return routeContext().status === 'loggedIn' ? (\n    <div>\n      Logged in as <strong>{routeContext().auth.username}</strong>\n      <div class=\"h-2\" />\n      <button\n        onClick={() => {\n          routeContext().auth.logout()\n          router.invalidate()\n        }}\n        class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n      >\n        Log out\n      </button>\n      <div class=\"h-2\" />\n    </div>\n  ) : (\n    <div class=\"p-2\">\n      <div>You must log in!</div>\n      <div class=\"h-2\" />\n      <form onSubmit={onSubmit} class=\"flex gap-2\">\n        <input\n          value={username()}\n          onChange={(e) => setUsername(e.target.value)}\n          placeholder=\"Username\"\n          class=\"border p-1 px-2 rounded-sm\"\n        />\n        <button\n          type=\"submit\"\n          class=\"text-sm bg-blue-500 text-white border inline-block py-1 px-2 rounded-sm\"\n        >\n          Login\n        </button>\n      </form>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/utils/auth.tsx",
    "content": "export const auth: Auth = {\n  status: 'loggedOut',\n  username: undefined,\n  login: (username: string) => {\n    auth.status = 'loggedIn'\n    auth.username = username\n  },\n  logout: () => {\n    auth.status = 'loggedOut'\n    auth.username = undefined\n  },\n}\n\nexport type Auth = {\n  login: (username: string) => void\n  logout: () => void\n  status: 'loggedOut' | 'loggedIn'\n  username?: string\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/utils/mockTodos.ts",
    "content": "import axios from 'redaxios'\nimport { produce } from 'immer'\nimport { actionDelayFn, loaderDelayFn, shuffle } from './utils'\n\ntype PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> &\n  Required<Pick<TValue, TKey>>\n\nexport type Invoice = {\n  id: number\n  title: string\n  body: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nlet invoices: Array<Invoice> = null!\nlet users: Array<User> = null!\n\nlet invoicesPromise: Promise<void> | undefined = undefined\nlet usersPromise: Promise<void> | undefined = undefined\n\nconst ensureInvoices = async () => {\n  if (!invoicesPromise) {\n    invoicesPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/posts',\n      )\n      invoices = data.slice(0, 10)\n    })\n  }\n\n  await invoicesPromise\n}\n\nconst ensureUsers = async () => {\n  if (!usersPromise) {\n    usersPromise = Promise.resolve().then(async () => {\n      const { data } = await axios.get(\n        'https://jsonplaceholder.typicode.com/users',\n      )\n      users = data.slice(0, 10)\n    })\n  }\n\n  await usersPromise\n}\n\nexport async function fetchInvoices() {\n  return loaderDelayFn(() => ensureInvoices().then(() => invoices))\n}\n\nexport async function fetchInvoiceById(id: number) {\n  return loaderDelayFn(() =>\n    ensureInvoices().then(() => {\n      const invoice = invoices.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found')\n      }\n      return invoice\n    }),\n  )\n}\n\nexport async function postInvoice(partialInvoice: Partial<Invoice>) {\n  return actionDelayFn(() => {\n    if (partialInvoice.title?.includes('error')) {\n      console.error('error')\n      throw new Error('Ouch!')\n    }\n    const invoice = {\n      id: invoices.length + 1,\n      title:\n        partialInvoice.title ?? `New Invoice ${String(Date.now()).slice(0, 5)}`,\n      body:\n        partialInvoice.body ??\n        shuffle(\n          `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n      Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. \n      Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna.  Integer id quam. Morbi mi. Quisque nisl felis, venenatis tristique, dignissim in, ultrices sit amet, augue. Proin sodales libero eget ante.\n      `.split(' '),\n        ).join(' '),\n    }\n    invoices = [...invoices, invoice]\n    return invoice\n  })\n}\n\nexport async function patchInvoice({\n  id,\n  ...updatedInvoice\n}: PickAsRequired<Partial<Invoice>, 'id'>) {\n  return actionDelayFn(() => {\n    invoices = produce(invoices, (draft) => {\n      const invoice = draft.find((d) => d.id === id)\n      if (!invoice) {\n        throw new Error('Invoice not found.')\n      }\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (updatedInvoice.title?.toLocaleLowerCase()?.includes('error')) {\n        throw new Error('Ouch!')\n      }\n      Object.assign(invoice, updatedInvoice)\n    })\n\n    return invoices.find((d) => d.id === id)\n  })\n}\n\nexport type UsersSortBy = 'name' | 'id' | 'email'\n\nexport async function fetchUsers({\n  filterBy,\n  sortBy,\n}: { filterBy?: string; sortBy?: UsersSortBy } = {}) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => {\n      let usersDraft = users\n\n      if (filterBy) {\n        usersDraft = usersDraft.filter((d) =>\n          d.name.toLowerCase().includes(filterBy.toLowerCase()),\n        )\n      }\n\n      if (sortBy) {\n        usersDraft = [...usersDraft].sort((a, b) => {\n          return a[sortBy] > b[sortBy] ? 1 : -1\n        })\n      }\n\n      return usersDraft\n    }),\n  )\n}\n\nexport async function fetchUserById(id: number) {\n  return loaderDelayFn(() =>\n    ensureUsers().then(() => users.find((d) => d.id === id)),\n  )\n}\n\nexport async function fetchRandomNumber() {\n  return loaderDelayFn(() => {\n    return Math.random()\n  })\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/utils/queryOptions.ts",
    "content": "import { queryOptions, useMutation } from '@tanstack/solid-query'\nimport { queryClient } from '../main'\nimport {\n  fetchInvoiceById,\n  fetchInvoices,\n  fetchUserById,\n  fetchUsers,\n  patchInvoice,\n  postInvoice,\n} from './mockTodos'\n\nexport const invoicesQueryOptions = () =>\n  queryOptions({\n    queryKey: ['invoices'],\n    queryFn: () => fetchInvoices(),\n  })\n\nexport const invoiceQueryOptions = (invoiceId: number) =>\n  queryOptions({\n    queryKey: ['invoices', invoiceId],\n    queryFn: () => fetchInvoiceById(invoiceId),\n  })\n\nexport const usersQueryOptions = (opts: {\n  filterBy?: string\n  sortBy?: 'name' | 'id' | 'email'\n}) =>\n  queryOptions({\n    queryKey: ['users', opts],\n    queryFn: () => fetchUsers(opts),\n  })\n\nexport const userQueryOptions = (userId: number) =>\n  queryOptions({\n    queryKey: ['users', userId],\n    queryFn: () => fetchUserById(userId),\n  })\n\nexport const useCreateInvoiceMutation = () => {\n  return useMutation(() => ({\n    mutationFn: postInvoice,\n    onSuccess: () => queryClient.invalidateQueries(),\n  }))\n}\n\nexport const useUpdateInvoiceMutation = (invoiceId: number) => {\n  return useMutation(() => ({\n    mutationFn: patchInvoice,\n    onSuccess: () => queryClient.invalidateQueries(),\n    gcTime: 1000 * 10,\n  }))\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/src/utils/utils.tsx",
    "content": "export async function loaderDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('loaderDelay') ?? 0)\n  const delayPromise = new Promise((r) => setTimeout(r, delay))\n\n  await delayPromise\n  const res = await fn()\n\n  return res\n}\n\nexport async function actionDelayFn<T>(\n  fn: (...args: Array<any>) => Promise<T> | T,\n) {\n  const delay = Number(sessionStorage.getItem('actionDelay') ?? 0)\n  await new Promise((r) => setTimeout(r, delay))\n  return fn()\n}\n\nexport function shuffle<T>(arr: Array<T>): Array<T> {\n  let i = arr.length\n  if (i == 0) return arr\n  const copy = [...arr]\n  while (--i) {\n    const j = Math.floor(Math.random() * (i + 1))\n    const a = copy[i]\n    const b = copy[j]\n    copy[i] = b!\n    copy[j] = a!\n  }\n  return copy\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/tsconfig.dev.json",
    "content": "{\n  \"composite\": true,\n  \"extends\": \"../../../tsconfig.base.json\",\n\n  \"files\": [\"src/main.tsx\"],\n  \"include\": [\n    \"src\"\n    // \"__tests__/**/*.test.*\"\n  ]\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/kitchen-sink-solid-query-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { TanStackRouterVite } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    TanStackRouterVite({ target: 'solid', autoCodeSplitting: true }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/large-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n(gen)\n"
  },
  {
    "path": "examples/solid/large-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/README.md",
    "content": "# Example\n\nThis example generates a large amount file based routes to diagnose typescript performance issues\n\nTo run this example:\n\n- `pnpm install`\n- `pnpm gen` to generate routes\n- `pnpm build` to update route tree\n- `pnpm test:types` to type check and run diagnostics\n"
  },
  {
    "path": "examples/solid/large-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/large-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-large-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"gen\": \"node ./src/createRoutes.mjs\",\n    \"test:types\": \"tsc --extendedDiagnostics\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/createRoutes.mjs",
    "content": "import { readFile, writeFile, mkdir } from 'fs/promises'\nimport { existsSync } from 'fs'\n\nconst length = 100\n\nconst main = async () => {\n  const absolute = (await readFile('./src/routes/absolute.tsx')).toString()\n  const relative = (await readFile('./src/routes/relative.tsx')).toString()\n  const searchRoute = (\n    await readFile('./src/routes/search/route.tsx')\n  ).toString()\n  const search = (\n    await readFile('./src/routes/search/searchPlaceholder.tsx')\n  ).toString()\n  const paramsRoute = (\n    await readFile('./src/routes/params/route.tsx')\n  ).toString()\n  const params = await (\n    await readFile('./src/routes/params/$paramsPlaceholder.tsx')\n  ).toString()\n\n  if (!existsSync('./src/routes/(gen)')) {\n    await mkdir('./src/routes/(gen)')\n  }\n\n  if (!existsSync('./src/routes/(gen)/search')) {\n    await mkdir('./src/routes/(gen)/search')\n  }\n\n  if (!existsSync('./src/routes/(gen)/params')) {\n    await mkdir('./src/routes/(gen)/params')\n  }\n\n  await writeFile('./src/routes/(gen)/search/route.tsx', searchRoute)\n  await writeFile('./src/routes/(gen)/params/route.tsx', paramsRoute)\n\n  for (let y = 0; y < length; y = y + 1) {\n    const replacedAbsolute = absolute.replaceAll('/absolute', `/absolute${y}`)\n    const replacedRelative = relative.replaceAll('/relative', `/relative${y}`)\n    const replacedSearch = search.replaceAll('searchPlaceholder', `search${y}`)\n    const replacedParams = params.replaceAll('paramsPlaceholder', `param${y}`)\n    await writeFile(`./src/routes/(gen)/absolute${y}.tsx`, replacedAbsolute)\n    await writeFile(`./src/routes/(gen)/relative${y}.tsx`, replacedRelative)\n    await writeFile(`./src/routes/(gen)/search/search${y}.tsx`, replacedSearch)\n    await writeFile(`./src/routes/(gen)/params/$param${y}.tsx`, replacedParams)\n  }\n}\n\nmain()\n"
  },
  {
    "path": "examples/solid/large-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { QueryClient } from '@tanstack/solid-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nexport const queryClient = new QueryClient()\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as RelativeRouteImport } from './routes/relative'\nimport { Route as LinkPropsRouteImport } from './routes/linkProps'\nimport { Route as AbsoluteRouteImport } from './routes/absolute'\nimport { Route as SearchRouteRouteImport } from './routes/search/route'\nimport { Route as ParamsRouteRouteImport } from './routes/params/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SearchSearchPlaceholderRouteImport } from './routes/search/searchPlaceholder'\nimport { Route as ParamsParamsPlaceholderRouteImport } from './routes/params/$paramsPlaceholder'\n\nconst RelativeRoute = RelativeRouteImport.update({\n  id: '/relative',\n  path: '/relative',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LinkPropsRoute = LinkPropsRouteImport.update({\n  id: '/linkProps',\n  path: '/linkProps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbsoluteRoute = AbsoluteRouteImport.update({\n  id: '/absolute',\n  path: '/absolute',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchRouteRoute = SearchRouteRouteImport.update({\n  id: '/search',\n  path: '/search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsRouteRoute = ParamsRouteRouteImport.update({\n  id: '/params',\n  path: '/params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchSearchPlaceholderRoute = SearchSearchPlaceholderRouteImport.update({\n  id: '/searchPlaceholder',\n  path: '/searchPlaceholder',\n  getParentRoute: () => SearchRouteRoute,\n} as any)\nconst ParamsParamsPlaceholderRoute = ParamsParamsPlaceholderRouteImport.update({\n  id: '/$paramsPlaceholder',\n  path: '/$paramsPlaceholder',\n  getParentRoute: () => ParamsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  id:\n    | '__root__'\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ParamsRouteRoute: typeof ParamsRouteRouteWithChildren\n  SearchRouteRoute: typeof SearchRouteRouteWithChildren\n  AbsoluteRoute: typeof AbsoluteRoute\n  LinkPropsRoute: typeof LinkPropsRoute\n  RelativeRoute: typeof RelativeRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/relative': {\n      id: '/relative'\n      path: '/relative'\n      fullPath: '/relative'\n      preLoaderRoute: typeof RelativeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/linkProps': {\n      id: '/linkProps'\n      path: '/linkProps'\n      fullPath: '/linkProps'\n      preLoaderRoute: typeof LinkPropsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/absolute': {\n      id: '/absolute'\n      path: '/absolute'\n      fullPath: '/absolute'\n      preLoaderRoute: typeof AbsoluteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search': {\n      id: '/search'\n      path: '/search'\n      fullPath: '/search'\n      preLoaderRoute: typeof SearchRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params': {\n      id: '/params'\n      path: '/params'\n      fullPath: '/params'\n      preLoaderRoute: typeof ParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search/searchPlaceholder': {\n      id: '/search/searchPlaceholder'\n      path: '/searchPlaceholder'\n      fullPath: '/search/searchPlaceholder'\n      preLoaderRoute: typeof SearchSearchPlaceholderRouteImport\n      parentRoute: typeof SearchRouteRoute\n    }\n    '/params/$paramsPlaceholder': {\n      id: '/params/$paramsPlaceholder'\n      path: '/$paramsPlaceholder'\n      fullPath: '/params/$paramsPlaceholder'\n      preLoaderRoute: typeof ParamsParamsPlaceholderRouteImport\n      parentRoute: typeof ParamsRouteRoute\n    }\n  }\n}\n\ninterface ParamsRouteRouteChildren {\n  ParamsParamsPlaceholderRoute: typeof ParamsParamsPlaceholderRoute\n}\n\nconst ParamsRouteRouteChildren: ParamsRouteRouteChildren = {\n  ParamsParamsPlaceholderRoute: ParamsParamsPlaceholderRoute,\n}\n\nconst ParamsRouteRouteWithChildren = ParamsRouteRoute._addFileChildren(\n  ParamsRouteRouteChildren,\n)\n\ninterface SearchRouteRouteChildren {\n  SearchSearchPlaceholderRoute: typeof SearchSearchPlaceholderRoute\n}\n\nconst SearchRouteRouteChildren: SearchRouteRouteChildren = {\n  SearchSearchPlaceholderRoute: SearchSearchPlaceholderRoute,\n}\n\nconst SearchRouteRouteWithChildren = SearchRouteRoute._addFileChildren(\n  SearchRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ParamsRouteRoute: ParamsRouteRouteWithChildren,\n  SearchRouteRoute: SearchRouteRouteWithChildren,\n  AbsoluteRoute: AbsoluteRoute,\n  LinkPropsRoute: LinkPropsRoute,\n  RelativeRoute: RelativeRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/__root.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type { QueryClient } from '@tanstack/solid-query'\n\nexport interface Context {\n  queryClient: QueryClient\n}\n\nexport const Route = createRootRouteWithContext<Context>()({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return <p>Not Found (on root route)</p>\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/absolute.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/absolute')({\n  component: AbsoluteComponent,\n})\n\nfunction AbsoluteComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/absolute\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        Absolute\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/linkProps.tsx",
    "content": "import { Link, createFileRoute, linkOptions } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/linkProps')({\n  component: LinkPropsPage,\n})\n\nfunction LinkPropsPage() {\n  const linkProps = linkOptions({\n    to: '/absolute',\n  })\n\n  return <Link {...linkProps} />\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/params/$paramsPlaceholder.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\nimport { queryOptions } from '@tanstack/solid-query'\n\nconst params = z.object({\n  oneParamsPlaceholder: z.literal('oneParamsPlaceholder'),\n  twoParamsPlaceholder: z.literal('twoParamsPlaceholder'),\n  threeParamsPlaceholder: z.literal('threeParamsPlaceholder'),\n})\n\nconst loaderResult = z.object({\n  params,\n})\n\nconst paramsQueryOptions = queryOptions({\n  queryKey: ['paramsPlaceholder'],\n  queryFn: () => {\n    return loaderResult.parse({})\n  },\n})\n\nexport const Route = createFileRoute('/params/$paramsPlaceholder')({\n  component: ParamsComponent,\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(paramsQueryOptions),\n})\n\nfunction ParamsComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link\n        to=\"/params/$paramsPlaceholder\"\n        params={{\n          paramsPlaceholder: 'params',\n        }}\n      />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params')({\n  component: () => <div>Hello /params!</div>,\n})\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/relative.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative')({\n  component: RelativeComponent,\n})\n\nfunction RelativeComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link\n        from={Route.fullPath}\n        to=\"../relative\"\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Relative\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/search/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nimport { z } from 'zod'\n\nconst search = z.object({\n  rootSearch: z.number(),\n})\n\nexport const Route = createFileRoute('/search')({\n  component: () => <div>Hello /search!</div>,\n  validateSearch: search,\n})\n"
  },
  {
    "path": "examples/solid/large-file-based/src/routes/search/searchPlaceholder.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nimport { z } from 'zod'\nimport { queryOptions } from '@tanstack/solid-query'\n\nconst search = z.object({\n  searchPlaceholder: z.literal('searchPlaceholder'),\n  page: z.number(),\n  offset: z.number(),\n  search: z.string(),\n})\n\nconst loaderResult = z.object({\n  searchPlaceholder: z.number(),\n})\n\nconst searchQueryOptions = queryOptions({\n  queryKey: ['searchPlaceholder'],\n  queryFn: () => {\n    const result = loaderResult.parse({\n      searchPlaceholder: 0,\n    })\n\n    return result\n  },\n})\n\nexport const Route = createFileRoute('/search/searchPlaceholder')({\n  component: SearchComponent,\n  validateSearch: search,\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(searchQueryOptions),\n})\n\nfunction SearchComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link\n        to=\"/search/searchPlaceholder\"\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n        search={{\n          searchPlaceholder: 'searchPlaceholder',\n          page: 0,\n          offset: 10,\n          search: 'search',\n          rootSearch: 0,\n        }}\n      >\n        Search\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"noEmit\": true,\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"]\n  }\n}\n"
  },
  {
    "path": "examples/solid/large-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/location-masking/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/location-masking/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/location-masking/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/location-masking/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/location-masking/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/location-masking/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-location-masking\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/location-masking/src/main.tsx",
    "content": "import type { JSX } from 'solid-js'\nimport { render } from 'solid-js/web'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouteMask,\n  createRouter,\n  useNavigate,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport './styles.css'\n\ntype PhotoType = {\n  id: string\n  title: string\n  url: string\n  thumbnailUrl: string\n  albumId: string\n}\n\nclass NotFoundError extends Error {}\n\nconst fetchPhotos = async () => {\n  console.info('Fetching photos...')\n  await new Promise((r) => setTimeout(r, 500))\n  // Generate mock photos using picsum.photos since via.placeholder.com is down\n  return Array.from({ length: 10 }, (_, i) => ({\n    id: String(i + 1),\n    title: `Photo ${i + 1}`,\n    url: `https://picsum.photos/600/400?random=${i + 1}`,\n    thumbnailUrl: `https://picsum.photos/200/200?random=${i + 1}`,\n    albumId: '1',\n  }))\n}\n\nconst fetchPhoto = async (photoId: string) => {\n  console.info(`Fetching photo with id ${photoId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n\n  // Simulate photo not found for invalid IDs\n  const photoIdNum = parseInt(photoId, 10)\n  if (isNaN(photoIdNum) || photoIdNum < 1 || photoIdNum > 10) {\n    throw new NotFoundError(`Photo with id \"${photoId}\" not found!`)\n  }\n\n  // Generate mock photo using picsum.photos\n  return {\n    id: photoId,\n    title: `Photo ${photoId}`,\n    url: `https://picsum.photos/600/400?random=${photoId}`,\n    thumbnailUrl: `https://picsum.photos/200/200?random=${photoId}`,\n    albumId: '1',\n  }\n}\n\ntype PhotoModal = {\n  id: 'photo'\n  photoId: string\n}\n\ntype ModalObject = PhotoModal\n\nexport function Spinner() {\n  return (\n    <div class=\"animate-spin px-3 text-xl inline-flex items-center justify-center\">\n      ⍥\n    </div>\n  )\n}\n\nconst rootRoute = createRootRoute({\n  validateSearch: (search) =>\n    search as {\n      modal?: ModalObject\n    },\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const status = useRouterState({ select: (s) => s.status })\n\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/photos\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Photos\n        </Link>{' '}\n        {status() === 'pending' ? <Spinner /> : null}\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nfunction Modal(props: {\n  children: JSX.Element\n  onOpenChange?: (open: boolean) => void\n}) {\n  const handleOverlayClick = () => {\n    props.onOpenChange?.(false)\n  }\n\n  const handleContentClick = (e: MouseEvent) => {\n    e.stopPropagation()\n  }\n\n  return (\n    <div\n      class=\"fixed inset-0 bg-black/70 flex items-center justify-center\"\n      onClick={handleOverlayClick}\n    >\n      <div\n        class=\"fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\"\n        onClick={handleContentClick}\n      >\n        {props.children}\n      </div>\n    </div>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: () => {\n    return (\n      <div class=\"p-2\">\n        <h3>Welcome Home!</h3>\n      </div>\n    )\n  },\n})\nconst photosLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'photos',\n  loader: fetchPhotos,\n  component: PhotosRoute,\n})\n\nfunction PhotosRoute() {\n  const photos = photosLayoutRoute.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <ul class=\"grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-2\">\n        {[\n          ...photos(),\n          { id: 'i-do-not-exist', title: 'Missing Photo Test', url: '' },\n        ].map((photo) => {\n          return (\n            <li class=\"\">\n              <Link\n                to={photoModalRoute.to}\n                params={{\n                  photoId: photo.id,\n                }}\n                // If you want to use a mask, you can do so like this, but\n                // it's generally safer to set up a route mask instead.\n                // mask={{\n                //   to: photoRoute.to,\n                //   params: {\n                //     photoId: photo.id,\n                //   },\n                // }}\n                class=\"whitespace-nowrap border rounded-lg shadow-xs flex items-center hover:shadow-lg text-blue-600 hover:scale-[1.1] overflow-hidden transition-all\"\n              >\n                <img src={photo.url} alt={photo.title} class=\"max-w-full\" />\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n\nconst photoRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'photos/$photoId',\n  loader: async ({ params: { photoId } }) => fetchPhoto(photoId),\n  errorComponent: PhotoErrorComponent,\n  component: PhotoComponent,\n})\n\nfunction PhotoErrorComponent({ error }: ErrorComponentProps) {\n  return (\n    <div class=\"p-4\">\n      {(() => {\n        if (error instanceof NotFoundError) {\n          return <div>{error.message}</div>\n        }\n        return <ErrorComponent error={error} />\n      })()}\n    </div>\n  )\n}\n\nfunction PhotoComponent() {\n  const photo = photoRoute.useLoaderData()\n\n  return (\n    <div class=\"p-4\">\n      <Photo photo={photo()} />\n    </div>\n  )\n}\n\nconst photoModalRoute = createRoute({\n  getParentRoute: () => photosLayoutRoute,\n  path: '$photoId/modal',\n  loader: async ({ params: { photoId } }) => fetchPhoto(photoId),\n  errorComponent: PhotoModalErrorComponent,\n  // pendingComponent: PhotoModalPendingComponent,\n  component: PhotoModalComponent,\n})\n\nfunction PhotoModalErrorComponent({ error }: ErrorComponentProps) {\n  const navigate = useNavigate()\n\n  return (\n    <Modal\n      onOpenChange={(open) => {\n        if (!open) {\n          navigate({\n            to: photosLayoutRoute.to,\n          })\n        }\n      }}\n    >\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-lg\">\n        {(() => {\n          if (error instanceof NotFoundError) {\n            return <div>{error.message}</div>\n          }\n          return <ErrorComponent error={error} />\n        })()}\n      </div>\n    </Modal>\n  )\n}\n\nfunction _PhotoModalPendingComponent() {\n  const navigate = useNavigate()\n\n  return (\n    <Modal\n      onOpenChange={(open) => {\n        if (!open) {\n          navigate({\n            to: photosLayoutRoute.to,\n          })\n        }\n      }}\n    >\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-lg\">\n        <Spinner />\n      </div>\n    </Modal>\n  )\n}\n\nfunction PhotoModalComponent() {\n  const navigate = useNavigate()\n  const photo = photoModalRoute.useLoaderData()\n\n  return (\n    <Modal\n      onOpenChange={(open) => {\n        if (!open) {\n          navigate({\n            to: photosLayoutRoute.to,\n          })\n        }\n      }}\n    >\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-lg\">\n        <Link\n          to=\".\"\n          target=\"_blank\"\n          class=\"text-blue-600 hover:opacity-75 underline\"\n        >\n          Open in new tab (to test de-masking)\n        </Link>\n        <Photo photo={photo()} />\n      </div>\n    </Modal>\n  )\n}\n\nfunction Photo({ photo }: { photo: PhotoType }) {\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{photo.title}</h4>\n      <div class=\"\">\n        <img src={photo.url} alt={photo.title} class=\"max-w-full\" />\n      </div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  photoRoute,\n  photosLayoutRoute.addChildren([photoModalRoute]),\n  indexRoute,\n])\n\nconst photoModalToPhotoMask = createRouteMask({\n  routeTree,\n  from: '/photos/$photoId/modal',\n  to: '/photos/$photoId',\n  params: true,\n})\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  routeMasks: [photoModalToPhotoMask],\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/location-masking/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/location-masking/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/location-masking/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/navigation-blocking/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/navigation-blocking/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/navigation-blocking/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/navigation-blocking/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/navigation-blocking/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/navigation-blocking/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-navigation-blocking\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/navigation-blocking/src/main.tsx",
    "content": "import { createSignal } from 'solid-js'\nimport { render } from 'solid-js/web'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useBlocker,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  // block going from editor-1 to /foo/123?hello=world\n  const blocker = useBlocker({\n    shouldBlockFn: ({ current, next }) => {\n      if (\n        current.routeId === '/editor-1' &&\n        next.fullPath === '/foo/$id' &&\n        next.params.id === '123' &&\n        next.search.hello === 'world'\n      ) {\n        return true\n      }\n      return false\n    },\n    enableBeforeUnload: false,\n    withResolver: true,\n  })\n\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/editor-1\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Editor 1\n        </Link>{' '}\n        <Link\n          to={'/editor-1/editor-2'}\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Editor 2\n        </Link>{' '}\n        <Link\n          to=\"/foo/$id\"\n          params={{ id: '123' }}\n          search={{ hello: 'world' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true, includeSearch: true }}\n        >\n          foo 123\n        </Link>{' '}\n        <Link\n          to=\"/foo/$id\"\n          params={{ id: '456' }}\n          search={{ hello: 'universe' }}\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true, includeSearch: true }}\n        >\n          foo 456\n        </Link>{' '}\n      </div>\n      <hr />\n\n      {blocker().status === 'blocked' && (\n        <div class=\"mt-2\">\n          <div>\n            Are you sure you want to leave editor 1 for /foo/123?hello=world ?\n          </div>\n          <button\n            class=\"bg-lime-500 text-white rounded-sm p-1 px-2 mr-2\"\n            onClick={blocker().proceed}\n          >\n            YES\n          </button>\n          <button\n            class=\"bg-red-500 text-white rounded-sm p-1 px-2\"\n            onClick={blocker().reset}\n          >\n            NO\n          </button>\n        </div>\n      )}\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n\nconst fooRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'foo/$id',\n  validateSearch: (search) => ({ hello: search.hello }) as { hello: string },\n  component: () => <>foo {fooRoute.useParams()().id}</>,\n})\n\nconst editor1Route = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'editor-1',\n  component: Editor1Component,\n})\n\nfunction Editor1Component() {\n  const [value, setValue] = createSignal('')\n\n  // Block leaving editor-1 if there is text in the input\n  const blocker = useBlocker({\n    shouldBlockFn: () => value() !== '',\n    enableBeforeUnload: () => value() !== '',\n    withResolver: true,\n  })\n\n  return (\n    <div class=\"flex flex-col p-2\">\n      <h3>Editor 1</h3>\n      <div>\n        <input\n          value={value()}\n          onInput={(e) => setValue(e.currentTarget.value)}\n          class=\"border\"\n        />\n      </div>\n      <hr class=\"m-2\" />\n      <Link to=\"/editor-1/editor-2\">Go to Editor 2</Link>\n      <Outlet />\n\n      {blocker().status === 'blocked' && (\n        <div class=\"mt-2\">\n          <div>Are you sure you want to leave editor 1?</div>\n          <div>\n            You are going from {blocker().current?.pathname} to{' '}\n            {blocker().next?.pathname}\n          </div>\n          <button\n            class=\"bg-lime-500 text-white rounded-sm p-1 px-2 mr-2\"\n            onClick={blocker().proceed}\n          >\n            YES\n          </button>\n          <button\n            class=\"bg-red-500 text-white rounded-sm p-1 px-2\"\n            onClick={blocker().reset}\n          >\n            NO\n          </button>\n        </div>\n      )}\n    </div>\n  )\n}\n\nconst editor2Route = createRoute({\n  getParentRoute: () => editor1Route,\n  path: 'editor-2',\n  component: Editor2Component,\n})\n\nfunction Editor2Component() {\n  const [value, setValue] = createSignal('')\n\n  return (\n    <div class=\"p-2\">\n      <h3>Editor 2</h3>\n      <input\n        value={value()}\n        onInput={(e) => setValue(e.currentTarget.value)}\n        class=\"border\"\n      />\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  fooRoute,\n  editor1Route.addChildren([editor2Route]),\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/navigation-blocking/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/navigation-blocking/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/navigation-blocking/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/quickstart/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/quickstart/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/quickstart/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/quickstart/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/quickstart/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-quickstart\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: () => (\n    <>\n      <div class=\"p-2 flex gap-2\">\n        <Link to=\"/\" class=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" class=\"[&.active]:font-bold\">\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: function Index() {\n    return (\n      <div class=\"p-2\">\n        <h3>Welcome Home!</h3>\n      </div>\n    )\n  },\n})\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  component: function About() {\n    return <div class=\"p-2\">Hello from About!</div>\n  },\n})\n\nconst routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/quickstart/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/quickstart/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/build.js",
    "content": "#!/usr/bin/env node\nimport * as esbuild from 'esbuild'\nimport { solidPlugin } from 'esbuild-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/esbuild'\n\nconst isDev = process.argv.includes('--dev')\n\nconst ctx = await esbuild.context({\n  entryPoints: ['src/main.tsx'],\n  outfile: 'dist/main.js',\n  minify: !isDev,\n  bundle: true,\n  format: 'esm',\n  target: ['esnext'],\n  sourcemap: true,\n  conditions: ['style'],\n  plugins: [\n    solidPlugin(),\n    tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n  ],\n})\n\nif (isDev) {\n  await ctx.watch()\n  const { host, port } = await ctx.serve({ servedir: '.', port: 3005 })\n  console.log(`Server running at http://${host || 'localhost'}:${port}`)\n} else {\n  await ctx.rebuild()\n  await ctx.dispose()\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n    <script src=\"https://unpkg.com/@tailwindcss/browser@4\"></script>\n    <style type=\"text/tailwindcss\">\n      html {\n        color-scheme: light dark;\n      }\n      * {\n        @apply border-gray-200 dark:border-gray-800;\n      }\n      body {\n        @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n      }\n    </style>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/dist/main.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-quickstart-esbuild-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"node build.js --dev\",\n    \"build\": \"node build.js\",\n    \"serve\": \"node build.js --dev\",\n    \"start\": \"dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"esbuild\": \"^0.27.4\",\n    \"esbuild-plugin-solid\": \"^0.6.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/src/routeTree.gen.ts",
    "content": "/* prettier-ignore-start */\n\n/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file is auto-generated by TanStack Router\n\n// Import Routes\n\nimport { Route as rootRoute } from './routes/__root'\nimport { Route as AboutImport } from './routes/about'\nimport { Route as IndexImport } from './routes/index'\n\n// Create/Update Routes\n\nconst AboutRoute = AboutImport.update({\n  path: '/about',\n  getParentRoute: () => rootRoute,\n} as any)\n\nconst IndexRoute = IndexImport.update({\n  path: '/',\n  getParentRoute: () => rootRoute,\n} as any)\n\n// Populate the FileRoutesByPath interface\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexImport\n      parentRoute: typeof rootRoute\n    }\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutImport\n      parentRoute: typeof rootRoute\n    }\n  }\n}\n\n// Create and export the route tree\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\n\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\n\nexport interface FileRoutesById {\n  __root__: typeof rootRoute\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\n\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\n\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\n\nexport const routeTree = rootRoute\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\n/* prettier-ignore-end */\n\n/* ROUTE_MANIFEST_START\n{\n  \"routes\": {\n    \"__root__\": {\n      \"filePath\": \"__root.tsx\",\n      \"children\": [\n        \"/\",\n        \"/about\"\n      ]\n    },\n    \"/\": {\n      \"filePath\": \"index.tsx\"\n    },\n    \"/about\": {\n      \"filePath\": \"about.tsx\"\n    }\n  }\n}\nROUTE_MANIFEST_END */\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/about\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/quickstart-esbuild-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-quickstart-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/about\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-file-based/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\n\n# IDE\n.idea\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-quickstart-rspack-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"rsbuild dev --port 3000\",\n    \"build\": \"rsbuild build && tsc --noEmit\",\n    \"preview\": \"rsbuild preview\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/postcss\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"postcss\": \"^8.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@rsbuild/core\": \"^1.2.4\",\n    \"@rsbuild/plugin-babel\": \"^1.0.6\",\n    \"@rsbuild/plugin-solid\": \"^1.0.6\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"typescript\": \"^5.6.2\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/rsbuild.config.ts",
    "content": "import { defineConfig } from '@rsbuild/core'\nimport { pluginBabel } from '@rsbuild/plugin-babel'\nimport { pluginSolid } from '@rsbuild/plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/rspack'\n\nexport default defineConfig({\n  plugins: [\n    pluginBabel({\n      include: /\\.(?:jsx|tsx)$/,\n    }),\n    pluginSolid(),\n  ],\n  tools: {\n    rspack: {\n      plugins: [tanstackRouter({ target: 'solid', autoCodeSplitting: true })],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/src/app.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/src/env.d.ts",
    "content": "/// <reference types=\"@rsbuild/core/types\" />\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/src/index.tsx",
    "content": "import { render } from 'solid-js/web'\nimport App from './app'\n\nconst rootElement = document.getElementById('root')!\n\nif (!rootElement.innerHTML) {\n  render(() => <App />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/about\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/quickstart-rspack-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"moduleResolution\": \"bundler\",\n    \"useDefineForClassFields\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/.babelrc",
    "content": "{\n  \"presets\": [\"babel-preset-solid\", \"@babel/preset-typescript\"]\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/.gitignore",
    "content": "# Local\n.DS_Store\n*.local\n*.log*\n\n# Dist\nnode_modules\ndist/\n\n# IDE\n.idea\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-quickstart-webpack-file-based\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"webpack serve --port 3001 --no-open\",\n    \"build\": \"webpack build && tsc --noEmit\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.28.5\",\n    \"@babel/preset-typescript\": \"^7.27.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"babel-loader\": \"^10.0.0\",\n    \"babel-preset-solid\": \"^1.9.10\",\n    \"css-loader\": \"^7.1.2\",\n    \"html-webpack-plugin\": \"^5.6.3\",\n    \"postcss\": \"^8.5.6\",\n    \"postcss-loader\": \"^8.2.0\",\n    \"style-loader\": \"^4.0.0\",\n    \"typescript\": \"^5.7.2\",\n    \"webpack\": \"^5.97.1\",\n    \"webpack-cli\": \"^5.1.4\",\n    \"webpack-dev-server\": \"^5.2.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/postcss.config.mjs",
    "content": "export default {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/public/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>TanStack router</title>\n    <script src=\"https://unpkg.com/@tailwindcss/browser@4\"></script>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/src/app.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/solid-router'\n\nimport { routeTree } from './routeTree.gen'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\nconst App = () => {\n  return <RouterProvider router={router} />\n}\n\nexport default App\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/src/index.tsx",
    "content": "import { render } from 'solid-js/web'\nimport App from './app'\nimport './styles.css'\n\nconst rootElement = document.getElementById('root')!\n\nif (!rootElement.innerHTML) {\n  render(() => <App />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/src/routes/__root.tsx",
    "content": "import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/about\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          About\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"module\": \"ESNext\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"strict\": true,\n    \"skipLibCheck\": true,\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"moduleResolution\": \"bundler\",\n    \"useDefineForClassFields\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/solid/quickstart-webpack-file-based/webpack.config.js",
    "content": "import path from 'path'\nimport { fileURLToPath } from 'url'\nimport HtmlWebpackPlugin from 'html-webpack-plugin'\nimport { tanstackRouter } from '@tanstack/router-plugin/webpack'\n\nconst __dirname = fileURLToPath(new URL('.', import.meta.url))\n\n/** @type import('webpack').Configuration */\nexport default ({ WEBPACK_SERVE }) => ({\n  target: 'web',\n  mode: WEBPACK_SERVE ? 'development' : 'production',\n  entry: path.resolve(__dirname, './src/index.tsx'),\n  output: {\n    path: path.resolve(__dirname, './dist'),\n    filename: '[name].bundle.js',\n    publicPath: '/',\n  },\n  resolve: {\n    extensions: ['.ts', '.tsx', '.js', '.jsx'],\n  },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: path.resolve(__dirname, './public/index.html'),\n      filename: 'index.html',\n    }),\n    tanstackRouter({ target: 'solid', autoCodeSplitting: true }),\n  ],\n  module: {\n    rules: [\n      {\n        test: /\\.tsx?$/,\n        exclude: /(node_modules)/,\n        use: { loader: 'babel-loader' },\n      },\n      {\n        test: /\\.css$/,\n        use: ['style-loader', 'css-loader', 'postcss-loader'],\n      },\n    ],\n  },\n  devServer: {\n    open: true,\n    hot: true,\n    historyApiFallback: {\n      rewrites: [{ from: /./, to: '/index.html' }],\n    },\n    static: ['public'],\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n*.js\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\npnpm-workspace.yaml"
  },
  {
    "path": "examples/solid/router-monorepo-simple/.stackblitzrc",
    "content": "{\n  \"startCommand\": \"cp pnpm-workspace.yaml.example pnpm-workspace.yaml && pnpm install && pnpm dev\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/README.md",
    "content": "# Example of a monorepo with router and feature libraries\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm dev` or `yarn dev`\n\nA challenge with TanStack Router in a monorepo setup is that it requires TypeScript type augmentations. However, if you set this up directly in the final app, the links inside the libraries won’t be type-safe. To solve this in a monorepo, you need a separate library just for the router, without any components, and then integrate it with the app.\n\nThis example showcases this approach using the following packages:\n\n- `packages/router` is the router library\n- `packages/post-feature` is the posts UI library\n- `packages/app` is the app\n\nWith this approach, we can use loaders in the router and the feature library without creating circular dependencies.\n\nSince the router library re-exports the router components, importing them in the feature library ensures they remain type-safe, as they’re linked to the TypeScript augmentations.\n\nFinally, in the app, we can create a map of routes to components ([`packages/app/src/main.tsx`](./packages/app/src/main.tsx)), which ties the router to the components. **We could enforce lazy loading here, but it was left out for simplicity.** With this setup, we now have a fully type-safe router!\n\nHere is what it looks like in the monorepo:\n\n![graph](./assets/graph.png)\n\n## Stackblitz limitation\n\n### Typescript IDE feedback\n\nDue to a limitation on Stackblitz, the example's types are not properly inferred in the IDE, however as soon as you click on fork in the bottom right corner, the types should be correctly inferred.\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-solid-mono-simple\",\n  \"private\": true,\n  \"scripts\": {\n    \"post-feature\": \"pnpm --filter @router-solid-mono-simple/post-feature\",\n    \"router\": \"pnpm --filter @router-solid-mono-simple/router\",\n    \"app\": \"pnpm --filter @router-solid-mono-simple/app\",\n    \"dev\": \"pnpm router build && pnpm post-feature build && pnpm app dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.7.4\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/app/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/app/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-simple/app\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3001\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@router-solid-mono-simple/post-feature\": \"workspace:*\",\n    \"@router-solid-mono-simple/router\": \"workspace:*\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"vite\": \"^8.0.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vite-plugin-dts\": \"^4.5.4\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  },\n  \"nx\": {\n    \"targets\": {\n      \"dev\": {\n        \"dependsOn\": [\n          \"^build\"\n        ]\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/app/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider } from '@tanstack/solid-router'\nimport { Outlet, router } from '@router-solid-mono-simple/router'\nimport {\n  PostErrorComponent,\n  PostIdComponent,\n  PostsListComponent,\n} from '@router-solid-mono-simple/post-feature'\nimport { RootComponent } from './rootComponent'\nimport type { RouterIds } from '@router-solid-mono-simple/router'\nimport type { JSX } from 'solid-js'\nimport './style.css'\n// Not lazy loaded for simplicity, but you could expose from your library component\n// individually, and enforce here to use solid lazy components via typings\n// so that you have code splitting\nconst routerMap = {\n  '/': PostsListComponent,\n  '/$postId': PostIdComponent,\n  __root__: RootComponent,\n} as const satisfies Record<RouterIds, (() => JSX.Element) | null>\n\nfunction EmptyComponent() {\n  return <Outlet />\n}\n\nObject.entries(routerMap).forEach(([path, component]) => {\n  const foundRoute = router.routesById[path as RouterIds]\n  foundRoute.update({\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n    component: component ?? EmptyComponent,\n  })\n})\n\n// And you can do the same logic with custom error pages, and any other properties\nconst errorComponentMap = {\n  '/': null,\n  '/$postId': PostErrorComponent,\n  __root__: null,\n}\n\nObject.entries(errorComponentMap).forEach(([path, component]) => {\n  if (!component) {\n    return\n  }\n\n  const foundRoute = router.routesById[path as RouterIds]\n  foundRoute.update({\n    errorComponent: component,\n  })\n})\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/app/src/rootComponent.tsx",
    "content": "import { Link, Outlet } from '@router-solid-mono-simple/router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport function RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Posts list\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/app/src/style.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../../post-feature/src/**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/app/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/app/vite.config.ts",
    "content": "import { fileURLToPath } from 'node:url'\nimport * as path from 'node:path'\nimport { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n\n  server: {\n    port: 4200,\n    host: 'localhost',\n  },\n\n  preview: {\n    port: 4300,\n    host: 'localhost',\n  },\n  plugins: [\n    tailwindcss(),\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/post-feature/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-simple/post-feature\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@router-solid-mono-simple/router\": \"workspace:*\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/post-feature/src/PostError.tsx",
    "content": "import {\n  ErrorComponent,\n  PostNotFoundError,\n} from '@router-solid-mono-simple/router'\nimport type { ErrorComponentProps } from '@router-solid-mono-simple/router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof PostNotFoundError) {\n    return <div>Not found from api: {error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/post-feature/src/PostIdPage.tsx",
    "content": "import { getRouteApi } from '@router-solid-mono-simple/router'\n\nconst route = getRouteApi('/$postId')\n\nexport function PostIdComponent() {\n  const post = route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/post-feature/src/PostList.tsx",
    "content": "import { Link, Outlet, getRouteApi } from '@router-solid-mono-simple/router'\n\nconst route = getRouteApi('/')\n\nexport function PostsListComponent() {\n  const posts = route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/post-feature/src/index.ts",
    "content": "export * from './PostIdPage'\nexport * from './PostList'\nexport * from './PostError'\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/post-feature/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/post-feature/vite.config.ts",
    "content": "import * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport solid from 'vite-plugin-solid'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'solid-js',\n        'solid-js/web',\n        '@tanstack/solid-router',\n        '@router-solid-mono-simple/post-feature',\n        '@router-solid-mono-simple/router',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-simple/router\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/history\": \"^1.161.6\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/src/fetch/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/src/index.ts",
    "content": "import { router } from './router'\n\nexport type { RouterType, RouterIds } from './router'\n\n// Register the router instance for type safety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport { router }\n\nexport { PostNotFoundError } from './fetch/posts'\n\n// By re exporting the api from TanStack router, we can enforce that other packages\n// rely on this one instead, making the type register being applied\nexport {\n  Outlet,\n  Link,\n  useRouteContext,\n  useRouter,\n  RouterProvider,\n  getRouteApi,\n  ErrorComponent,\n} from '@tanstack/solid-router'\nexport type { ErrorComponentProps } from '@tanstack/solid-router'\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostIdRouteImport } from './routes/$postId'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst PostIdRoute = PostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/$postId'\n  id: '__root__' | '/' | '/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostIdRoute: typeof PostIdRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/$postId': {\n      id: '/$postId'\n      path: '/$postId'\n      fullPath: '/$postId'\n      preLoaderRoute: typeof PostIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostIdRoute: PostIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport type { RouteIds } from '@tanstack/solid-router'\n\n// Set up a Router instance\nexport const router = createRouter({\n  routeTree,\n  defaultPendingComponent: () => (\n    <div>Loading form global pending component...</div>\n  ),\n  scrollRestoration: true,\n})\n\nexport type RouterType = typeof router\nexport type RouterIds = RouteIds<RouterType['routeTree']>\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/src/routes/$postId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../fetch/posts'\n\nexport const Route = createFileRoute('/$postId')({\n  loader: ({ params }) => fetchPost(params.postId),\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/src/routes/__root.tsx",
    "content": "import { Link, createRootRoute } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/src/routes/index.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../fetch/posts'\n\nexport const Route = createFileRoute('/')({\n  loader: () => {\n    return fetchPosts()\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/packages/router/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport solid from 'vite-plugin-solid'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n    tanstackRouter({ target: 'solid' }),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: ['solid-js', 'solid-js/web', '@tanstack/solid-router'],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple/pnpm-workspace.yaml.example",
    "content": "packages:\n  - 'packages/*'"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n*.js\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n\npnpm-workspace.yaml"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/.stackblitzrc",
    "content": "{\n  \"startCommand\": \"cp pnpm-workspace.yaml.example pnpm-workspace.yaml && pnpm install && pnpm dev\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/README.md",
    "content": "# Example of a monorepo with router and feature libraries, using lazy loading\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm dev` or `yarn dev`\n\nA challenge with TanStack Router in a monorepo setup is that it requires TypeScript type augmentations. However, if you set this up directly in the final app, the links inside the libraries won’t be type-safe. To solve this in a monorepo, you need a separate library just for the router, without any components, and then integrate it with the app.\n\nThis example showcases this approach using the following packages:\n\n- `packages/router` is the router library\n- `packages/post-feature` is the posts UI library\n- `packages/app` is the app\n\nWith this approach, we can use loaders in the router and the feature library without creating circular dependencies.\n\nSince the router library re-exports the router components, importing them in the feature library ensures they remain type-safe, as they’re linked to the TypeScript augmentations.\n\nFinally, in the app, we can create a map of routes to components ([`packages/app/src/main.tsx`](./packages/app/src/main.tsx)), which ties the router to the components.\n\n## How lazy loading works\n\nEath feature exports a `createLazyRoute` function that returns a lazy route. This lazy route is then used in the router map to bind the lazy route to the actual route. This allows library to define their component, pending, error and nod found components directly.\n\nThe types on the ([`packages/app/src/main.tsx`](./packages/app/src/main.tsx)) are used to map the route to the lazy route, and enforce they match the route path.\n\n**Note: if you match a lazy route with a different id of the route, you will get a runtime error, hence the mapped types to ensure we are also warned by typescript.**\n\nHere is what it looks like in the monorepo:\n\n![graph](./assets/graph.png)\n\n## Stackblitz limitation\n\n### Typescript IDE feedback\n\nDue to a limitation on Stackblitz, the example's types are not properly inferred in the IDE, however as soon as you click on fork in the bottom right corner, the types should be correctly inferred.\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/package.json",
    "content": "{\n  \"name\": \"router-solid-mono-simple-lazy\",\n  \"private\": true,\n  \"scripts\": {\n    \"post-feature\": \"pnpm --filter @router-solid-mono-simple-lazy/post-feature\",\n    \"router\": \"pnpm --filter @router-solid-mono-simple-lazy/router\",\n    \"app\": \"pnpm --filter @router-solid-mono-simple-lazy/app\",\n    \"dev\": \"pnpm router build && pnpm post-feature build && pnpm app dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.7.4\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/app/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/app/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-simple-lazy/app\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3001\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@router-solid-mono-simple-lazy/post-feature\": \"workspace:*\",\n    \"@router-solid-mono-simple-lazy/router\": \"workspace:*\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.0.8\",\n    \"@types/react-dom\": \"^19.0.3\",\n    \"@vitejs/plugin-react\": \"^6.0.1\",\n    \"typescript\": \"^5.7.2\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  },\n  \"nx\": {\n    \"targets\": {\n      \"dev\": {\n        \"dependsOn\": [\n          \"^build\"\n        ]\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/app/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider } from '@tanstack/solid-router'\nimport { router } from '@router-solid-mono-simple-lazy/router'\nimport { RootComponent } from './rootComponent'\nimport type {\n  RouteById,\n  RouterIds,\n} from '@router-solid-mono-simple-lazy/router'\nimport type { LazyRoute } from '@tanstack/solid-router'\nimport './style.css'\n\n// Generic to enforce that the route returned matches the route path\ntype LazyRouteFn<TRoutePath extends RouterIds> = () => Promise<\n  LazyRoute<RouteById<(typeof router)['routeTree'], TRoutePath>>\n>\n\ntype RouterMap = {\n  // __root__ is a special route that isn't lazy loaded, so we need to manually bind it\n  // You could consider adding null to the returned type to have routes without rendering\n  [K in Exclude<RouterIds, '__root__'>]: LazyRouteFn<K>\n}\n\nconst routerMap: RouterMap = {\n  '/': () =>\n    import('@router-solid-mono-simple-lazy/post-feature/post-list').then(\n      (d) => d.PostRoute,\n    ),\n  '/$postId': () =>\n    import('@router-solid-mono-simple-lazy/post-feature/post-id-page').then(\n      (d) => d.PostIdRoute,\n    ),\n}\n\n// Given __root__ is a special route that isn't lazy loaded, we need to update it manually\nrouter.routesById['__root__'].update({\n  component: RootComponent,\n})\n\nObject.entries(routerMap).forEach(([path, component]) => {\n  const foundRoute = router.routesById[path as RouterIds]\n  // Bind the lazy route to the actual route\n  foundRoute.lazy(component)\n})\n\n// Render the app\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/app/src/rootComponent.tsx",
    "content": "import { Link, Outlet } from '@router-solid-mono-simple-lazy/router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport function RootComponent() {\n  console.log('RootComponent')\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Posts list\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/app/src/style.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../../post-feature/src/**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/app/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/app/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n\n  server: {\n    port: 4200,\n    host: 'localhost',\n  },\n\n  preview: {\n    port: 4300,\n    host: 'localhost',\n  },\n  plugins: [\n    tailwindcss(),\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/post-feature/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-simple-lazy/post-feature\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"exports\": {\n    \"./post-id-page\": {\n      \"types\": \"./dist/PostIdPage.d.ts\",\n      \"import\": \"./dist/PostIdPage.js\"\n    },\n    \"./post-list\": {\n      \"types\": \"./dist/PostList.d.ts\",\n      \"import\": \"./dist/PostList.js\"\n    }\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@router-solid-mono-simple-lazy/router\": \"workspace:*\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/post-feature/src/PostIdPage.tsx",
    "content": "import { createLazyRoute } from '@router-solid-mono-simple-lazy/router'\n\nexport const PostIdRoute = createLazyRoute('/$postId')({\n  component: PostIdComponent,\n})\n\nexport function PostIdComponent() {\n  const post = PostIdRoute.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/post-feature/src/PostList.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createLazyRoute,\n} from '@router-solid-mono-simple-lazy/router'\n\nexport const PostRoute = createLazyRoute('/')({\n  component: PostsListComponent,\n})\n\nexport function PostsListComponent() {\n  const posts = PostRoute.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/post-feature/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/post-feature/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport solid from 'vite-plugin-solid'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/post-feature',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: ['src/PostIdPage.tsx', 'src/PostList.tsx'],\n      name: 'post-feature',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'react',\n        'react-dom',\n        'react/jsx-runtime',\n        '@tanstack/solid-router',\n        '@router-solid-mono-simple-lazy/post-query',\n        '@router-solid-mono-simple-lazy/router',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-simple-lazy/router\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/history\": \"^1.161.6\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/src/fetch/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/src/index.ts",
    "content": "import { router } from './router'\n\nexport type { RouterType, RouterIds } from './router'\n\n// Register the router instance for type safety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport { router }\n\nexport { PostNotFoundError } from './fetch/posts'\n\n// By re exporting the api from TanStack router, we can enforce that other packages\n// rely on this one instead, making the type register being applied\nexport {\n  Outlet,\n  Link,\n  useRouteContext,\n  useRouter,\n  RouterProvider,\n  getRouteApi,\n  ErrorComponent,\n  createLazyRoute,\n} from '@tanstack/solid-router'\nexport type {\n  ErrorComponentProps,\n  RouteById,\n  RegisteredRouter,\n} from '@tanstack/solid-router'\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostIdRouteImport } from './routes/$postId'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst PostIdRoute = PostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/$postId'\n  id: '__root__' | '/' | '/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostIdRoute: typeof PostIdRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/$postId': {\n      id: '/$postId'\n      path: '/$postId'\n      fullPath: '/$postId'\n      preLoaderRoute: typeof PostIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostIdRoute: PostIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport type { RouteIds } from '@tanstack/solid-router'\n\n// Set up a Router instance\nexport const router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultPendingComponent: () => (\n    <div>Loading form global pending component...</div>\n  ),\n  scrollRestoration: true,\n})\n\nexport type RouterType = typeof router\nexport type RouterIds = RouteIds<RouterType['routeTree']>\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/src/routes/$postId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../fetch/posts'\n\nexport const Route = createFileRoute('/$postId')({\n  loader: ({ params }) => fetchPost(params.postId),\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/src/routes/__root.tsx",
    "content": "import { Link, createRootRoute } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/src/routes/index.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../fetch/posts'\n\nexport const Route = createFileRoute('/')({\n  loader: () => {\n    return fetchPosts()\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/packages/router/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport solid from 'vite-plugin-solid'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n    tanstackRouter({ target: 'solid' }),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: ['solid-js', 'solid-js/web', '@tanstack/solid-router'],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-simple-lazy/pnpm-workspace.yaml.example",
    "content": "packages:\n  - 'packages/*'"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n*.js\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\npnpm-workspace.yaml"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/.stackblitzrc",
    "content": "{\n  \"startCommand\": \"cp pnpm-workspace.yaml.example pnpm-workspace.yaml && pnpm install && pnpm dev\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/README.md",
    "content": "# Example of a monorepo with router and feature libraries\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm dev` or `yarn dev`\n\nA challenge with TanStack Router in a monorepo setup is that it requires TypeScript type augmentations. However, if you set this up directly in the final app, the links inside the libraries won’t be type-safe. To solve this in a monorepo, you need a separate library just for the router, without any components, and then integrate it with the app.\n\nThis example showcases this approach using the following packages:\n\n- `packages/router` is the router library\n- `packages/post-query` is the post query collection library\n- `packages/post-feature` is the posts ui library\n- `packages/app` is the app\n\nWith this approach, we can use the query options from the data library both in the router and the feature library without creating circular dependencies.\n\nSince the router library re-exports the router components, importing them in the feature library ensures they remain type-safe, as they’re linked to the TypeScript augmentations.\n\nFinally, in the app, we can create a map of routes to components ([`packages/app/src/main.tsx`](./packages/app/src/main.tsx)), which ties the router to the components. **We could enforce lazy loading here, but it was left out for simplicity.** With this setup, we now have a fully type-safe router!\n\nHere is what it looks like in the monorepo:\n\n![graph](./assets/graph.png)\n\n## Stackblitz limitation\n\n### TypeScript IDE feedback\n\nDue to a limitation on Stackblitz, the example's types are not properly inferred in the IDE, however as soon as you click on fork in the bottom right corner, the types should be correctly inferred.\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/package.json",
    "content": "{\n  \"name\": \"router-solid-monorepo-solid-query\",\n  \"private\": true,\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n    \"post-query\": \"pnpm --filter @router-solid-mono-solid-query/post-query\",\n    \"post-feature\": \"pnpm --filter @router-solid-mono-solid-query/post-feature\",\n    \"router\": \"pnpm --filter @router-solid-mono-solid-query/router\",\n    \"app\": \"pnpm --filter @router-solid-mono-solid-query/app\",\n    \"dev\": \"pnpm post-query build && pnpm router build && pnpm post-feature build && pnpm app dev\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.10.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/app/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/app/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-solid-query/app\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3001\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@router-solid-mono-solid-query/post-feature\": \"workspace:*\",\n    \"@router-solid-mono-solid-query/router\": \"workspace:*\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  },\n  \"nx\": {\n    \"targets\": {\n      \"dev\": {\n        \"dependsOn\": [\n          \"^build\"\n        ]\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/app/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider } from '@tanstack/solid-router'\nimport { QueryClientProvider } from '@tanstack/solid-query'\nimport { queryClient, router } from '@router-solid-mono-solid-query/router'\nimport {\n  PostErrorComponent,\n  PostIdComponent,\n  PostsListComponent,\n} from '@router-solid-mono-solid-query/post-feature'\nimport { RootComponent } from './rootComponent'\nimport type { RouterIds } from '@router-solid-mono-solid-query/router'\nimport './style.css'\nimport type { JSX } from 'solid-js'\n// Not lazy loaded for simplicity, but you could expose from your library component\n// individually, and enforce here to use react lazy components via typings\n// so that you have code splitting\nconst routerMap = {\n  '/': PostsListComponent,\n  '/$postId': PostIdComponent,\n  __root__: RootComponent,\n} as const satisfies Record<RouterIds, () => JSX.Element>\n\nObject.entries(routerMap).forEach(([path, component]) => {\n  const foundRoute = router.routesById[path as RouterIds]\n\n  foundRoute.update({\n    component: component,\n  })\n})\n\n// And you can do the same logic with custom error pages, and any other properties\nconst errorComponentMap = {\n  '/': null,\n  '/$postId': PostErrorComponent,\n  __root__: null,\n}\n\nObject.entries(errorComponentMap).forEach(([path, component]) => {\n  if (!component) {\n    return\n  }\n\n  const foundRoute = router.routesById[path as RouterIds]\n  foundRoute.update({\n    errorComponent: component,\n  })\n})\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(\n    () => (\n      <QueryClientProvider client={queryClient}>\n        <RouterProvider router={router} />\n      </QueryClientProvider>\n    ),\n    rootElement,\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/app/src/rootComponent.tsx",
    "content": "import { Link, Outlet } from '@router-solid-mono-solid-query/router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { SolidQueryDevtools } from '@tanstack/solid-query-devtools'\n\nexport function RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Posts list\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <SolidQueryDevtools buttonPosition=\"top-right\" />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/app/src/style.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../../post-feature/src/**/*.{js,jsx,ts,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/app/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/app/vite.config.ts",
    "content": "import { fileURLToPath } from 'node:url'\nimport * as path from 'node:path'\nimport { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n\n  server: {\n    port: 4200,\n    host: 'localhost',\n  },\n\n  preview: {\n    port: 4300,\n    host: 'localhost',\n  },\n  plugins: [\n    tailwindcss(),\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-feature/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-solid-query/post-feature\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@router-solid-mono-solid-query/post-query\": \"workspace:*\",\n    \"@router-solid-mono-solid-query/router\": \"workspace:*\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-feature/src/PostError.tsx",
    "content": "// import { createEffect } from 'solid-js'\nimport { PostNotFoundError } from '@router-solid-mono-solid-query/post-query'\n// import { useQueryErrorResetBoundary } from '@tanstack/solid-query'\nimport {\n  ErrorComponent,\n  useRouter,\n} from '@router-solid-mono-solid-query/router'\nimport type { ErrorComponentProps } from '@router-solid-mono-solid-query/router'\n\nexport function PostErrorComponent({ error, reset }: ErrorComponentProps) {\n  const router = useRouter()\n  if (error instanceof PostNotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return (\n    <div>\n      <button\n        onClick={() => {\n          router.invalidate()\n        }}\n      >\n        retry\n      </button>\n      <ErrorComponent error={error} />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-feature/src/PostIdPage.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { postQueryOptions } from '@router-solid-mono-solid-query/post-query'\n\nimport { getRouteApi } from '@router-solid-mono-solid-query/router'\n\nconst route = getRouteApi('/$postId')\n\nexport function PostIdComponent() {\n  const postId = route.useParams()().postId\n  const { data: post } = useQuery(() => postQueryOptions(postId))\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post?.title}</h4>\n      <div class=\"text-sm\">{post?.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-feature/src/PostList.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { postsQueryOptions } from '@router-solid-mono-solid-query/post-query'\nimport { Link, Outlet } from '@router-solid-mono-solid-query/router'\n\nexport function PostsListComponent() {\n  const postsQuery = useQuery(() => postsQueryOptions)\n  const posts = postsQuery.data\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...(posts || []),\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-feature/src/index.ts",
    "content": "export * from './PostIdPage'\nexport * from './PostList'\nexport * from './PostError'\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-feature/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-feature/vite.config.ts",
    "content": "import * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport solid from 'vite-plugin-solid'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'solid-js',\n        'solid-js/web',\n        '@tanstack/solid-query',\n        '@tanstack/solid-router',\n        '@router-solid-mono-solid-query/post-query',\n        '@router-solid-mono-solid-query/router',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-query/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-solid-query/post-query\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-query/src/index.ts",
    "content": "export * from './postQueryOptions'\nexport * from './postsQueryOptions'\nexport { PostNotFoundError } from './posts'\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-query/src/postQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport { fetchPost } from './posts'\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', { postId }],\n    queryFn: () => fetchPost(postId),\n  })\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-query/src/posts.tsx",
    "content": "import axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport class PostNotFoundError extends Error {}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw new PostNotFoundError(`Post with id \"${postId}\" not found!`)\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-query/src/postsQueryOptions.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport { fetchPosts } from './posts'\n\nexport const postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: () => fetchPosts(),\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-query/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/post-query/vite.config.ts",
    "content": "import { fileURLToPath } from 'node:url'\nimport * as path from 'node:path'\nimport { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'solid-js',\n        'solid-js/web',\n        '@tanstack/solid-query',\n        'redaxios',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/package.json",
    "content": "{\n  \"name\": \"@router-solid-mono-solid-query/router\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"dependencies\": {\n    \"@tanstack/history\": \"^1.161.6\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@router-solid-mono-solid-query/post-query\": \"workspace:*\",\n    \"redaxios\": \"^0.5.1\",\n    \"zod\": \"^3.24.2\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-dts\": \"^4.5.4\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/src/index.ts",
    "content": "import { queryClient, router } from './router'\n\nexport type { RouterType, RouterIds } from './router'\n\n// Register the router instance for type safety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport { router, queryClient }\n\n// By re exporting the api from TanStack router, we can enforce that other packages\n// rely on this one instead, making the type register being applied\nexport {\n  Outlet,\n  Link,\n  useRouteContext,\n  useRouter,\n  RouterProvider,\n  getRouteApi,\n  ErrorComponent,\n} from '@tanstack/solid-router'\nexport type { ErrorComponentProps } from '@tanstack/solid-router'\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostIdRouteImport } from './routes/$postId'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst PostIdRoute = PostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/$postId': typeof PostIdRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/$postId'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/$postId'\n  id: '__root__' | '/' | '/$postId'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostIdRoute: typeof PostIdRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/$postId': {\n      id: '/$postId'\n      path: '/$postId'\n      fullPath: '/$postId'\n      preLoaderRoute: typeof PostIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostIdRoute: PostIdRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/src/router.tsx",
    "content": "import React from 'react'\nimport { createRouter } from '@tanstack/solid-router'\n\n// Import the generated route tree\nimport { QueryClient } from '@tanstack/solid-query'\nimport { routeTree } from './routeTree.gen'\nimport type { RouteIds } from '@tanstack/solid-router'\n\nexport const queryClient = new QueryClient()\n\n// Set up a Router instance\nexport const router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  defaultPendingComponent: () => (\n    <div>Loading form global pending component...</div>\n  ),\n  // This make the loader only wait 200ms before showing the pending component, instead of the default 1000ms\n  defaultPendingMs: 200,\n  defaultPreload: 'intent',\n  // Since we're using React Query, we don't want loader calls to ever be stale\n  // This will ensure that the loader is always called when the route is preloaded or visited\n  defaultPreloadStaleTime: 0,\n  scrollRestoration: true,\n})\n\nexport type RouterType = typeof router\nexport type RouterIds = RouteIds<RouterType['routeTree']>\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/src/routes/$postId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { postQueryOptions } from '@router-solid-mono-solid-query/post-query'\n\nexport const Route = createFileRoute('/$postId')({\n  loader: ({ context: { queryClient }, params: { postId } }) => {\n    return queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/src/routes/__root.tsx",
    "content": "import { Link, createRootRouteWithContext } from '@tanstack/solid-router'\nimport type { QueryClient } from '@tanstack/solid-query'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/src/routes/index.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { postsQueryOptions } from '@router-solid-mono-solid-query/post-query'\n\nexport const Route = createFileRoute('/')({\n  loader: ({ context: { queryClient } }) => {\n    return queryClient.ensureQueryData(postsQueryOptions)\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/packages/router/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport dts from 'vite-plugin-dts'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport solid from 'vite-plugin-solid'\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport default defineConfig({\n  root: __dirname,\n  cacheDir: '../../node_modules/.vite/packages/router',\n  plugins: [\n    dts({\n      entryRoot: 'src',\n      tsconfigPath: path.join(__dirname, 'tsconfig.json'),\n    }),\n    solid(),\n    tanstackRouter({ target: 'solid' }),\n  ],\n  build: {\n    outDir: './dist',\n    emptyOutDir: true,\n    commonjsOptions: {\n      transformMixedEsModules: true,\n    },\n    lib: {\n      entry: 'src/index.ts',\n      name: 'router',\n      fileName: 'index',\n      formats: ['es'],\n    },\n    rolldownOptions: {\n      // External packages that should not be bundled into your library.\n      external: [\n        'solid-js',\n        'solid-js/web',\n        '@tanstack/solid-query',\n        '@tanstack/solid-router',\n        '@router-solid-mono-solid-query/post-query',\n      ],\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/router-monorepo-solid-query/pnpm-workspace.yaml.example",
    "content": "packages:\n  - 'packages/*'"
  },
  {
    "path": "examples/solid/scroll-restoration/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/scroll-restoration/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/scroll-restoration/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/scroll-restoration/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/scroll-restoration/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/scroll-restoration/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-scroll-restoration\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-virtual\": \"^3.13.0\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/scroll-restoration/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useElementScrollRestoration,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { createVirtualizer } from '@tanstack/solid-virtual'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 sticky top-0 border-b bg-gray-100 dark:bg-gray-900\">\n        <Link to=\"/\" class=\"[&.active]:font-bold\">\n          Home\n        </Link>{' '}\n        <Link to=\"/about\" class=\"[&.active]:font-bold\">\n          About\n        </Link>\n        <Link to=\"/about\" resetScroll={false}>\n          About (No Reset)\n        </Link>\n        <Link to=\"/by-element\" class=\"[&.active]:font-bold\">\n          By-Element\n        </Link>\n      </div>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  )\n}\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  loader: () => new Promise<void>((r) => setTimeout(r, 500)),\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <div class=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n            Home Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst aboutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/about',\n  loader: () => new Promise<void>((r) => setTimeout(r, 500)),\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div>Hello from About!</div>\n      <div class=\"space-y-2\">\n        {Array.from({ length: 50 }).map((_, i) => (\n          <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n            About Item {i + 1}\n          </div>\n        ))}\n      </div>\n    </div>\n  )\n}\n\nconst byElementRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/by-element',\n  loader: () => new Promise<void>((r) => setTimeout(r, 500)),\n  component: ByElementComponent,\n})\n\nfunction ByElementComponent() {\n  // We need a unique ID for manual scroll restoration on a specific element\n  // It should be as unique as possible for this element across your app\n  const scrollRestorationId = 'myVirtualizedContent'\n\n  // We use that ID to get the scroll entry for this element\n  const scrollEntry = useElementScrollRestoration({\n    id: scrollRestorationId,\n  })\n\n  // Let's use TanStack Virtual to virtualize some content!\n  let virtualizerParentRef: any\n  const virtualizer = createVirtualizer({\n    count: 10000,\n    getScrollElement: () => virtualizerParentRef,\n    estimateSize: () => 100,\n    // We pass the scrollY from the scroll restoration entry to the virtualizer\n    // as the initial offset\n    initialOffset: scrollEntry?.scrollY,\n  })\n\n  return (\n    <div class=\"p-2 h-[calc(100vh-41px)] flex flex-col\">\n      <div>Hello from By-Element!</div>\n      <div class=\"h-full min-h-0 flex gap-4\">\n        <div class=\"border rounded-lg p-2 overflow-auto flex-1 space-y-2\">\n          {Array.from({ length: 50 }).map((_, i) => (\n            <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n              About Item {i + 1}\n            </div>\n          ))}\n        </div>\n        <div class=\"flex-1 overflow-auto flex flex-col gap-4\">\n          {Array.from({ length: 2 }).map((_, i) => (\n            <div class=\"flex-1 border rounded-lg p-2 overflow-auto\">\n              <div class=\"space-y-2\">\n                {Array.from({ length: 50 }).map((_, i) => (\n                  <div class=\"h-[100px] p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border\">\n                    About Item {i + 1}\n                  </div>\n                ))}\n              </div>\n            </div>\n          ))}\n          <div class=\"flex-1 flex flex-col min-h-0\">\n            <div class=\"font-bold\">Virtualized</div>\n            <div\n              ref={virtualizerParentRef}\n              // We pass the scroll restoration ID to the element\n              // as a custom attribute that will get picked up by the\n              // scroll restoration watcher\n              data-scroll-restoration-id={scrollRestorationId}\n              class=\"flex-1 border rounded-lg overflow-auto relative\"\n            >\n              <div\n                style={{\n                  height: `${virtualizer.getTotalSize()}px`,\n                }}\n              >\n                {virtualizer.getVirtualItems().map((item) => (\n                  <div\n                    class=\"absolute p-2 pb-0 w-full\"\n                    style={{\n                      height: item.size + 'px',\n                      top: item.start + 'px',\n                    }}\n                  >\n                    <div class=\"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 border h-full\">\n                      Virtualized Item {item.index + 1}\n                    </div>\n                  </div>\n                ))}\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  )\n}\n\nconst routeTree = rootRoute.addChildren([\n  indexRoute,\n  aboutRoute,\n  byElementRoute,\n])\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/scroll-restoration/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/scroll-restoration/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/scroll-restoration/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-router-search-validator-adapters\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\",\n    \"test:unit\": \"vitest\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/arktype-adapter\": \"^1.166.9\",\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/valibot-adapter\": \"^1.166.9\",\n    \"@tanstack/zod-adapter\": \"^1.166.9\",\n    \"arktype\": \"^2.1.7\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"valibot\": \"1.0.0-beta.15\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@testing-library/jest-dom\": \"^6.6.3\",\n    \"@solidjs/testing-library\": \"^0.8.10\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/components/Content.tsx",
    "content": "import type { JSX } from 'solid-js'\n\nexport interface ContentProps {\n  readonly children: JSX.Element\n}\n\nexport const Content = ({ children }: ContentProps) => {\n  return <section class=\"my-2 flex flex-col gap-2\">{children}</section>\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/components/Header.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nconst HeaderLink: typeof Link = (props) => {\n  return <Link class=\"text-lg text-blue-700\" {...props} />\n}\n\nexport interface HeaderProps {\n  readonly title: string\n}\n\nexport const Header = ({ title }: HeaderProps) => {\n  return (\n    <header class=\"flex items-end gap-8 border-b-2 border-slate-150 py-4\">\n      <h1 class=\"text-4xl\">{title}</h1>\n      <nav class=\"flex gap-4\">\n        <HeaderLink to=\"/users/zod\">Zod</HeaderLink>\n        <HeaderLink to=\"/users/valibot\">Valibot</HeaderLink>\n        <HeaderLink to=\"/users/arktype\">Arktype</HeaderLink>\n      </nav>\n    </header>\n  )\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/components/Search.tsx",
    "content": "export interface SearchProps {\n  search: string\n  onChange: (search: string) => void\n}\n\nexport const Search = ({ search, onChange }: SearchProps) => {\n  return (\n    <div class=\"flex gap-2 align-center items-center\">\n      <label>Search</label>\n      <input\n        type=\"search\"\n        class=\"border p-1 px-2 rounded-sm\"\n        value={search}\n        onInput={(e) => onChange(e.currentTarget.value)}\n      ></input>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/components/Users.tsx",
    "content": "import { queryOptions, useQuery } from '@tanstack/solid-query'\n\nexport interface Geo {\n  lat: string\n  lng: string\n}\n\nexport interface Address {\n  street: string\n  suite: string\n  city: string\n  zipcode: string\n  geo: Geo\n}\n\nexport interface Company {\n  name: string\n  catchPhrase: string\n  bs: string\n}\n\nexport interface User {\n  id: number\n  name: string\n  username: string\n  email: string\n  address: Address\n  phone: string\n  website: string\n  company: Company\n}\n\nexport const getUsers = async (): Promise<Array<User>> => {\n  const response = await fetch('https://jsonplaceholder.typicode.com/users')\n  const users: Array<User> = await response.json()\n  return users\n}\n\nexport const searchUsers = async (search: string): Promise<Array<User>> => {\n  const users = await getUsers()\n  const normalizedSearch = search.toLowerCase()\n  return users.filter(\n    (user) =>\n      user.name.toLowerCase().includes(normalizedSearch) ||\n      user.username.toLowerCase().includes(normalizedSearch),\n  )\n}\n\nexport const usersQueryOptions = (search: string) =>\n  queryOptions({\n    queryKey: ['users', search],\n    queryFn: async () => {\n      return await searchUsers(search)\n    },\n  })\n\nexport interface UsersProps {\n  search: string\n}\n\nexport const Users = ({ search }: UsersProps) => {\n  const users = useQuery(() => usersQueryOptions(search))\n\n  return (\n    <table class=\"table-auto\">\n      <thead>\n        <tr class=\"border text-left\">\n          <th class=\"p-4\">Username</th>\n          <th class=\"p-4\">Name</th>\n          <th class=\"p-4\">Email</th>\n        </tr>\n      </thead>\n      <tbody>\n        {users.data?.map((user) => (\n          <tr class=\"border\">\n            <td class=\"p-4\">{user.username}</td>\n            <td class=\"p-4\">{user.name}</td>\n            <td class=\"p-4\">{user.email}</td>\n          </tr>\n        ))}\n      </tbody>\n    </table>\n  )\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { QueryClient, QueryClientProvider } from '@tanstack/solid-query'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\nexport const queryClient = new QueryClient()\n\nexport const router = createRouter({\n  routeTree,\n  context: {\n    queryClient,\n  },\n  scrollRestoration: true,\n})\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport function App() {\n  return <RouterProvider router={router} />\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(\n    () => (\n      <QueryClientProvider client={queryClient}>\n        <App />\n      </QueryClientProvider>\n    ),\n\n    rootElement,\n  )\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/solid-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersZodIndexRouteImport } from './routes/users/zod.index'\nimport { Route as UsersValibotIndexRouteImport } from './routes/users/valibot.index'\nimport { Route as UsersArktypeIndexRouteImport } from './routes/users/arktype.index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersZodIndexRoute = UsersZodIndexRouteImport.update({\n  id: '/users/zod/',\n  path: '/users/zod/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersValibotIndexRoute = UsersValibotIndexRouteImport.update({\n  id: '/users/valibot/',\n  path: '/users/valibot/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersArktypeIndexRoute = UsersArktypeIndexRouteImport.update({\n  id: '/users/arktype/',\n  path: '/users/arktype/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/users/arktype/': typeof UsersArktypeIndexRoute\n  '/users/valibot/': typeof UsersValibotIndexRoute\n  '/users/zod/': typeof UsersZodIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/users/arktype': typeof UsersArktypeIndexRoute\n  '/users/valibot': typeof UsersValibotIndexRoute\n  '/users/zod': typeof UsersZodIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/users/arktype/': typeof UsersArktypeIndexRoute\n  '/users/valibot/': typeof UsersValibotIndexRoute\n  '/users/zod/': typeof UsersZodIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/users/arktype/' | '/users/valibot/' | '/users/zod/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/users/arktype' | '/users/valibot' | '/users/zod'\n  id: '__root__' | '/' | '/users/arktype/' | '/users/valibot/' | '/users/zod/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  UsersArktypeIndexRoute: typeof UsersArktypeIndexRoute\n  UsersValibotIndexRoute: typeof UsersValibotIndexRoute\n  UsersZodIndexRoute: typeof UsersZodIndexRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/zod/': {\n      id: '/users/zod/'\n      path: '/users/zod'\n      fullPath: '/users/zod/'\n      preLoaderRoute: typeof UsersZodIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/valibot/': {\n      id: '/users/valibot/'\n      path: '/users/valibot'\n      fullPath: '/users/valibot/'\n      preLoaderRoute: typeof UsersValibotIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/arktype/': {\n      id: '/users/arktype/'\n      path: '/users/arktype'\n      fullPath: '/users/arktype/'\n      preLoaderRoute: typeof UsersArktypeIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\ndeclare module './routes/index' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/users/arktype.index' {\n  const createFileRoute: CreateFileRoute<\n    '/users/arktype/',\n    FileRoutesByPath['/users/arktype/']['parentRoute'],\n    FileRoutesByPath['/users/arktype/']['id'],\n    FileRoutesByPath['/users/arktype/']['path'],\n    FileRoutesByPath['/users/arktype/']['fullPath']\n  >\n}\ndeclare module './routes/users/valibot.index' {\n  const createFileRoute: CreateFileRoute<\n    '/users/valibot/',\n    FileRoutesByPath['/users/valibot/']['parentRoute'],\n    FileRoutesByPath['/users/valibot/']['id'],\n    FileRoutesByPath['/users/valibot/']['path'],\n    FileRoutesByPath['/users/valibot/']['fullPath']\n  >\n}\ndeclare module './routes/users/zod.index' {\n  const createFileRoute: CreateFileRoute<\n    '/users/zod/',\n    FileRoutesByPath['/users/zod/']['parentRoute'],\n    FileRoutesByPath['/users/zod/']['id'],\n    FileRoutesByPath['/users/zod/']['path'],\n    FileRoutesByPath['/users/zod/']['fullPath']\n  >\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  UsersArktypeIndexRoute: UsersArktypeIndexRoute,\n  UsersValibotIndexRoute: UsersValibotIndexRoute,\n  UsersZodIndexRoute: UsersZodIndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/routes/__root.tsx",
    "content": "import { Outlet, createRootRouteWithContext } from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type { QueryClient } from '@tanstack/solid-query'\n\nexport interface Context {\n  queryClient: QueryClient\n}\n\nexport const Route = createRootRouteWithContext<Context>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <div class=\"m-4\">\n      <Outlet />\n      <TanStackRouterDevtools />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/routes/index.tsx",
    "content": "import { Header } from '../components/Header'\nimport { Content } from '../components/Content'\n\nexport const Index = () => {\n  return (\n    <>\n      <Header title=\"Home\" />\n      <Content>Welcome home</Content>\n    </>\n  )\n}\n\nexport const Route = createFileRoute({\n  component: Index,\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/routes/users/arktype.index.tsx",
    "content": "import { useNavigate } from '@tanstack/solid-router'\nimport { type } from 'arktype'\nimport { Suspense } from 'solid-js'\nimport { Header } from '../../components/Header'\nimport { Users, usersQueryOptions } from '../../components/Users'\nimport { Content } from '../../components/Content'\nimport { Search } from '../../components/Search'\n\nconst ArkType = () => {\n  const search = Route.useSearch()\n  const navigate = useNavigate({ from: Route.fullPath })\n\n  return (\n    <>\n      <Header title=\"ArkType\" />\n      <Content>\n        <Search\n          search={search().search}\n          onChange={(search) => navigate({ search: { search }, replace: true })}\n        />\n        <Suspense>\n          <Users search={search().search} />\n        </Suspense>\n      </Content>\n    </>\n  )\n}\n\nconst search = type({\n  search: 'string = \"\"',\n})\n\nexport const Route = createFileRoute({\n  validateSearch: search,\n  loaderDeps: (opt) => ({ search: opt.search }),\n  loader: (opt) => {\n    opt.context.queryClient.ensureQueryData(\n      usersQueryOptions(opt.deps.search.search),\n    )\n  },\n  component: ArkType,\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/routes/users/valibot.index.tsx",
    "content": "import { useNavigate } from '@tanstack/solid-router'\nimport * as v from 'valibot'\nimport { Suspense } from 'solid-js'\nimport { Header } from '../../components/Header'\nimport { Users, usersQueryOptions } from '../../components/Users'\nimport { Content } from '../../components/Content'\nimport { Search } from '../../components/Search'\n\nconst Valibot = () => {\n  const search = Route.useSearch()\n  const navigate = useNavigate({ from: Route.fullPath })\n\n  return (\n    <>\n      <Header title=\"Valibot\" />\n      <Content>\n        <Search\n          search={search().search}\n          onChange={(search) => navigate({ search: { search }, replace: true })}\n        />\n        <Suspense>\n          <Users search={search().search} />\n        </Suspense>\n      </Content>\n    </>\n  )\n}\n\nexport const Route = createFileRoute({\n  validateSearch: v.object({\n    search: v.fallback(v.optional(v.string(), ''), ''),\n  }),\n  loaderDeps: (opt) => ({ search: opt.search }),\n  loader: (opt) => {\n    opt.context.queryClient.ensureQueryData(\n      usersQueryOptions(opt.deps.search.search),\n    )\n  },\n  component: Valibot,\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/routes/users/zod.index.tsx",
    "content": "import { useNavigate } from '@tanstack/solid-router'\nimport { fallback, zodValidator } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\nimport { Suspense } from 'solid-js'\nimport { Header } from '../../components/Header'\nimport { Users, usersQueryOptions } from '../../components/Users'\nimport { Content } from '../../components/Content'\nimport { Search } from '../../components/Search'\n\nconst Zod = () => {\n  const search = Route.useSearch({\n    select: (search) => search.search ?? '',\n  })\n  const navigate = useNavigate({ from: Route.fullPath })\n\n  return (\n    <>\n      <Header title=\"Zod\" />\n      <Content>\n        <Search\n          search={search()}\n          onChange={(search) => navigate({ search: { search }, replace: true })}\n        />\n        <Suspense>\n          <Users search={search()} />\n        </Suspense>\n      </Content>\n    </>\n  )\n}\n\nexport const Route = createFileRoute({\n  validateSearch: zodValidator(\n    z.object({\n      search: fallback(z.string().optional(), undefined),\n    }),\n  ),\n  loaderDeps: (opt) => ({ search: opt.search }),\n  loader: (opt) => {\n    opt.context.queryClient.ensureQueryData(\n      usersQueryOptions(opt.deps.search.search ?? ''),\n    )\n  },\n  component: Zod,\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/tests/arktype.test-d.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\nimport { expectTypeOf, test } from 'vitest'\nimport { Route as ArkTypeRoute } from '../src/routes/users/arktype.index'\nimport type { router } from '../src/main'\nimport type { Accessor } from 'solid-js'\n\ntest('infers correct input and output type for valibot', () => {\n  expectTypeOf(Link<typeof router, string, '/users/arktype'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<boolean | ((...args: ReadonlyArray<any>) => any)>()\n    .toEqualTypeOf<{ search?: string } | undefined>()\n\n  expectTypeOf(ArkTypeRoute.useSearch()).toEqualTypeOf<\n    Accessor<{\n      search: string\n    }>\n  >()\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/tests/arktype.test.tsx",
    "content": "import { fireEvent, render, screen } from '@solidjs/testing-library'\nimport { expect, test } from 'vitest'\nimport {\n  Link,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/solid-router'\n\nimport '@testing-library/jest-dom/vitest'\nimport { type } from 'arktype'\n\ntest('can navigate to the route', async () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <Link to=\"/users/arktype\">Arktype</Link>,\n  })\n\n  const ArkType = () => {\n    const search = arkTypeRoute.useSearch() as () => { search: string }\n\n    return (\n      <div>\n        <div>{search().search}</div>\n        <Link from=\"/users/arktype/\" search={{ search: 'updated' }}>\n          Update\n        </Link>\n      </div>\n    )\n  }\n\n  const search = type({\n    search: 'string = \"default\"',\n  })\n\n  const arkTypeRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/users/arkType',\n    validateSearch: search,\n    component: ArkType,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, arkTypeRoute])\n\n  const router = createRouter({ routeTree, scrollRestoration: true })\n\n  render(() => <RouterProvider router={router as any} />)\n\n  const link = await screen.findByText('Arktype')\n\n  fireEvent.click(link)\n\n  expect(await screen.findByText('default')).toBeInTheDocument()\n\n  const updateLink = await screen.findByText('Update')\n\n  fireEvent.click(updateLink)\n\n  expect(await screen.findByText('updated')).toBeInTheDocument()\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/tests/valibot.test-d.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\nimport { expectTypeOf, test } from 'vitest'\nimport { Route as ValibotRoute } from '../src/routes/users/valibot.index'\nimport type { router } from '../src/main'\nimport type { Accessor } from 'solid-js'\n\ntest('infers correct input and output type for valibot', () => {\n  expectTypeOf(Link<typeof router, string, '/users/valibot'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<boolean | ((...args: ReadonlyArray<any>) => any)>()\n    .toEqualTypeOf<{ search?: string } | undefined>()\n\n  expectTypeOf(ValibotRoute.useSearch()).toEqualTypeOf<\n    Accessor<{\n      search: string\n    }>\n  >()\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/tests/valibot.test.tsx",
    "content": "import { fireEvent, render, screen } from '@solidjs/testing-library'\nimport { expect, test } from 'vitest'\nimport {\n  Link,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/solid-router'\nimport * as v from 'valibot'\nimport '@testing-library/jest-dom/vitest'\n\ntest('can navigate to the route', async () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <Link to=\"/users/valibot\">Valibot</Link>,\n  })\n\n  const Valibot = () => {\n    const search = valibotRoute.useSearch() as () => { search: string }\n\n    return (\n      <div>\n        <div>{search().search}</div>\n        <Link from=\"/users/valibot/\" search={{ search: 'updated' }}>\n          Update\n        </Link>\n      </div>\n    )\n  }\n\n  const valibotRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/users/valibot',\n    validateSearch: v.object({\n      search: v.optional(v.string(), 'default'),\n    }),\n    component: Valibot,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, valibotRoute])\n\n  const router = createRouter({ routeTree, scrollRestoration: true })\n\n  render(() => <RouterProvider router={router as any} />)\n\n  const link = await screen.findByText('Valibot')\n\n  fireEvent.click(link)\n\n  expect(await screen.findByText('default')).toBeInTheDocument()\n\n  const updateLink = await screen.findByText('Update')\n\n  fireEvent.click(updateLink)\n\n  expect(await screen.findByText('updated')).toBeInTheDocument()\n})\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"]\n  }\n}\n"
  },
  {
    "path": "examples/solid/search-validator-adapters/vite.config.ts",
    "content": "import { defineConfig } from 'vitest/config'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport packageJson from './package.json'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n    server: {\n      deps: {\n        inline: [/@solidjs/, /@tanstack\\/solid-store/],\n      },\n    },\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n      verboseFileRoutes: false,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/start-basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/start-basic/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-basic/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic/README.md",
    "content": "# Welcome to TanStack.com!\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Development\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Editing and previewing the docs of TanStack projects locally\n\nThe documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app.\nIn 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.\n\nFollow 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 :\n\n1. Create a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter the directory and clone this repo and the repo of the project there.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/tanstack.com.git\ngit clone git@github.com:TanStack/form.git\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- form/\n>    |\n>    +-- tanstack.com/\n> ```\n\n> [!WARNING]\n> 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.\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`.\n\n> [!NOTE]\n> The updated pages need to be manually reloaded in the browser.\n\n> [!WARNING]\n> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page!\n"
  },
  {
    "path": "examples/solid/start-basic/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-basic\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node .output/server/index.mjs\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"nitro\": \"^3.0.260311-beta\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/components/PostError.tsx",
    "content": "import { ErrorComponent, ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/components/UserError.tsx",
    "content": "import { ErrorComponent, ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/_pathlessLayout/_nested-layout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/api/users/$userId'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(\n            'https://jsonplaceholder.typicode.com/users/' + params.userId,\n          )\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n          const user = (await res.json()) as User\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createMiddleware } from '@tanstack/solid-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: /users')\n    const result = await next()\n    result.response.headers.set('x-users', 'true')\n    console.info('Out: /users')\n    return result\n  },\n)\n\nconst testParentMiddleware = createMiddleware().server(\n  async ({ next, request }) => {\n    console.info('In: testParentMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test-parent', 'true')\n    console.info('Out: testParentMiddleware')\n    return result\n  },\n)\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next, request }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware, testParentMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await fetch('https://jsonplaceholder.typicode.com/users')\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n        const data = (await res.json()) as Array<User>\n        const list = data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { Suspense, createSignal } from 'solid-js'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(({ data: name }) => {\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: name }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: 'Tanner Linsley' }),\n      person: await personServerFn({ data: 'John Doe' }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {loaderData().person.name} - {loaderData().person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={loaderData().deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={loaderData().deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount(count() + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post().id,\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) =>\n    fetchPost({\n      data: postId,\n    }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/redirect.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: async () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { NotFound } from 'src/components/NotFound'\nimport { UserErrorComponent } from 'src/components/UserError'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    try {\n      const res = await fetch('/api/users/' + userId)\n      if (!res.ok) {\n        throw new Error('Unexpected status code')\n      }\n\n      const data = await res.json()\n\n      return data\n    } catch {\n      throw new Error('Failed to fetch user')\n    }\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user().name}</h4>\n      <div class=\"text-sm\">{user().email}</div>\n      <div>\n        <a\n          href={`/api/users/${user().id}`}\n          class=\"text-blue-800 hover:text-blue-600 underline\"\n        >\n          View as JSON\n        </a>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div>\n      Select a user or{' '}\n      <a href=\"/api/users\" class=\"text-blue-800 hover:text-blue-600 underline\">\n        view as JSON\n      </a>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const res = await fetch('/api/users')\n\n    if (!res.ok) {\n      throw new Error('Unexpected status code')\n    }\n\n    const data = (await res.json()) as Array<User>\n\n    return data\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users(),\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/utils/loggingMiddleware.tsx",
    "content": "import { createMiddleware } from '@tanstack/solid-start'\n\nconst preLogMiddleware = createMiddleware({ type: 'function' })\n  .client(async (ctx) => {\n    const clientTime = new Date()\n\n    return ctx.next({\n      context: {\n        clientTime,\n      },\n      sendContext: {\n        clientTime,\n      },\n    })\n  })\n  .server(async (ctx) => {\n    const serverTime = new Date()\n\n    return ctx.next({\n      sendContext: {\n        serverTime,\n        durationToServer:\n          serverTime.getTime() - ctx.context.clientTime.getTime(),\n      },\n    })\n  })\n\nexport const logMiddleware = createMiddleware({ type: 'function' })\n  .middleware([preLogMiddleware])\n  .client(async (ctx) => {\n    const res = await ctx.next()\n\n    const now = new Date()\n    console.log('Client Req/Res:', {\n      duration: now.getTime() - res.context.clientTime.getTime(),\n      durationToServer: res.context.durationToServer,\n      durationFromServer: now.getTime() - res.context.serverTime.getTime(),\n    })\n\n    return res\n  })\n"
  },
  {
    "path": "examples/solid/start-basic/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({\n  method: 'GET',\n}).handler(async () => {\n  console.info('Fetching posts...')\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n})\n"
  },
  {
    "path": "examples/solid/start-basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-basic/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n"
  },
  {
    "path": "examples/solid/start-basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\nimport { nitro } from 'nitro/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true }), nitro()],\n})\n"
  },
  {
    "path": "examples/solid/start-basic-auth/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/.env",
    "content": "# Environment variables declared in this file are automatically made available to Prisma.\n# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema\n\n# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.\n# See the documentation for all the connection string options: https://pris.ly/d/connection-strings\n\nDATABASE_URL=\"file:./dev.db\""
  },
  {
    "path": "examples/solid/start-basic-auth/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n!.env\n.DS_Store\n.cache\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/start-basic-auth/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-basic-auth/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/README.md",
    "content": "# Welcome to TanStack.com!\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Development\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Editing and previewing the docs of TanStack projects locally\n\nThe documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app.\nIn 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.\n\nFollow 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 :\n\n1. Create a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter the directory and clone this repo and the repo of the project there.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/tanstack.com.git\ngit clone git@github.com:TanStack/form.git\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- form/\n>    |\n>    +-- tanstack.com/\n> ```\n\n> [!WARNING]\n> 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.\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`.\n\n> [!NOTE]\n> The updated pages need to be manually reloaded in the browser.\n\n> [!WARNING]\n> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page!\n"
  },
  {
    "path": "examples/solid/start-basic-auth/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-basic-auth\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"prisma-generate\": \"prisma generate\"\n  },\n  \"dependencies\": {\n    \"@libsql/client\": \"^0.15.15\",\n    \"@prisma/adapter-libsql\": \"^7.0.0\",\n    \"@prisma/client\": \"^7.0.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"dotenv\": \"^17.2.3\",\n    \"prisma\": \"^7.0.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/prisma/migrations/20240811183753_init/migration.sql",
    "content": "-- CreateTable\nCREATE TABLE \"User\" (\n    \"email\" TEXT NOT NULL PRIMARY KEY,\n    \"password\" TEXT NOT NULL\n);\n\n-- CreateIndex\nCREATE UNIQUE INDEX \"User_email_key\" ON \"User\"(\"email\");\n"
  },
  {
    "path": "examples/solid/start-basic-auth/prisma/migrations/migration_lock.toml",
    "content": "# Please do not edit this file manually\n# It should be added in your version-control system (i.e. Git)\nprovider = \"sqlite\""
  },
  {
    "path": "examples/solid/start-basic-auth/prisma/schema.prisma",
    "content": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n  provider = \"prisma-client\"\n  output   = \"../src/prisma-generated\"\n}\n\ndatasource db {\n  provider = \"sqlite\"\n}\n\nmodel User {\n  email String @id @unique\n  password String\n}"
  },
  {
    "path": "examples/solid/start-basic-auth/prisma.config.ts",
    "content": "import 'dotenv/config'\nimport { defineConfig, env } from 'prisma/config'\n\nexport default defineConfig({\n  schema: './prisma/schema.prisma',\n  migrations: {\n    path: './prisma/migrations',\n  },\n  datasource: {\n    url: env('DATABASE_URL'),\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-auth/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/components/Auth.tsx",
    "content": "import type { JSX } from 'solid-js'\n\nexport function Auth({\n  actionText,\n  onSubmit,\n  status,\n  afterSubmit,\n}: {\n  actionText: string\n  onSubmit: (e: HTMLFormElement) => void\n  status: 'pending' | 'idle' | 'success' | 'error'\n  afterSubmit?: JSX.Element\n}) {\n  return (\n    <div class=\"fixed inset-0 bg-white dark:bg-black flex items-start justify-center p-8\">\n      <div class=\"bg-white dark:bg-gray-900 p-8 rounded-lg shadow-lg\">\n        <h1 class=\"text-2xl font-bold mb-4\">{actionText}</h1>\n        <form\n          onSubmit={(e: any) => {\n            e.preventDefault()\n            onSubmit(e)\n          }}\n          class=\"space-y-4\"\n        >\n          <div>\n            <label for=\"email\" class=\"block text-xs\">\n              Email\n            </label>\n            <input\n              type=\"email\"\n              name=\"email\"\n              id=\"email\"\n              class=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <div>\n            <label for=\"password\" class=\"block text-xs\">\n              Password\n            </label>\n            <input\n              type=\"password\"\n              name=\"password\"\n              id=\"password\"\n              class=\"px-2 py-1 w-full rounded-sm border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <button\n            type=\"submit\"\n            class=\"w-full bg-cyan-600 text-white rounded-sm py-2 font-black uppercase\"\n            disabled={status === 'pending'}\n          >\n            {status === 'pending' ? '...' : actionText}\n          </button>\n          {afterSubmit ? afterSubmit : null}\n        </form>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/components/Login.tsx",
    "content": "import { useRouter } from '@tanstack/solid-router'\nimport { useServerFn } from '@tanstack/solid-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { loginFn } from '../routes/_authed'\nimport { Auth } from './Auth'\nimport { signupFn } from '~/routes/signup'\n\nexport function Login() {\n  const router = useRouter()\n\n  const loginMutation = useMutation({\n    fn: loginFn,\n    onSuccess: async (ctx) => {\n      if (!ctx.data?.error) {\n        await router.invalidate()\n        router.navigate({ to: '/' })\n        return\n      }\n    },\n  })\n\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Login\"\n      status={loginMutation.status()}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as any as HTMLFormElement)\n\n        loginMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        loginMutation.data() ? (\n          <>\n            <div class=\"text-red-400\">{loginMutation.data()?.message}</div>\n            {loginMutation.data()?.userNotFound ? (\n              <div>\n                <button\n                  class=\"text-blue-500\"\n                  onClick={(e) => {\n                    const formData = new FormData(\n                      (e.target as HTMLButtonElement).form!,\n                    )\n\n                    signupMutation.mutate({\n                      data: {\n                        email: formData.get('email') as string,\n                        password: formData.get('password') as string,\n                      },\n                    })\n                  }}\n                  type=\"button\"\n                >\n                  Sign up instead?\n                </button>\n              </div>\n            ) : null}\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/hooks/useMutation.ts",
    "content": "import * as Solid from 'solid-js'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = Solid.createSignal<number | undefined>()\n  const [variables, setVariables] = Solid.createSignal<TVariables | undefined>()\n  const [error, setError] = Solid.createSignal<TError | undefined>()\n  const [data, setData] = Solid.createSignal<TData | undefined>()\n  const [status, setStatus] = Solid.createSignal<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = async (variables: TVariables): Promise<TData | undefined> => {\n    setStatus('pending')\n    setSubmittedAt(Date.now())\n    setVariables(variables as any)\n    //\n    try {\n      const data = await opts.fn(variables)\n      await opts.onSuccess?.({ data })\n      setStatus('success')\n      setError(undefined)\n      setData(data as any)\n      return data\n    } catch (err: any) {\n      setStatus('error')\n      setError(err)\n    }\n  }\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/browser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma-related types and utilities in a browser.\n * Use it to get access to models, enums, and input types.\n *\n * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.\n * See `client.ts` for the standard, server-side entry point.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as Prisma from './internal/prismaNamespaceBrowser'\nexport { Prisma }\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/client.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.\n * If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.\n *\n * 🟢 You can import this file directly.\n */\n\nimport * as process from 'node:process'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nglobalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport * as $Class from './internal/class'\nimport * as Prisma from './internal/prismaNamespace'\n\nexport * as $Enums from './enums'\nexport * from './enums'\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\nexport const PrismaClient = $Class.getPrismaClientClass()\nexport type PrismaClient<\n  LogOpts extends Prisma.LogLevel = never,\n  OmitOpts extends Prisma.PrismaClientOptions['omit'] =\n    Prisma.PrismaClientOptions['omit'],\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>\nexport { Prisma }\n\n/**\n * Model User\n *\n */\nexport type User = Prisma.UserModel\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/commonInputTypes.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports various common sort, input & filter types that are not directly linked to a particular model.\n *\n * 🟢 You can import this file directly.\n */\n\nimport type * as runtime from '@prisma/client/runtime/client'\nimport * as $Enums from './enums'\nimport type * as Prisma from './internal/prismaNamespace'\n\nexport type StringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type StringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedStringFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringFilter<$PrismaModel> | string\n}\n\nexport type NestedStringWithAggregatesFilter<$PrismaModel = never> = {\n  equals?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  in?: string[]\n  notIn?: string[]\n  lt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  lte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gt?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  gte?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  contains?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string\n  _count?: Prisma.NestedIntFilter<$PrismaModel>\n  _min?: Prisma.NestedStringFilter<$PrismaModel>\n  _max?: Prisma.NestedStringFilter<$PrismaModel>\n}\n\nexport type NestedIntFilter<$PrismaModel = never> = {\n  equals?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  in?: number[]\n  notIn?: number[]\n  lt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  lte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gt?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  gte?: number | Prisma.IntFieldRefInput<$PrismaModel>\n  not?: Prisma.NestedIntFilter<$PrismaModel> | number\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/enums.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports all enum related types from the schema.\n *\n * 🟢 You can import this file directly.\n */\n\n// This file is empty because there are no enums in the schema.\nexport {}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/internal/class.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * Please import the `PrismaClient` class from the `client.ts` file instead.\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from './prismaNamespace'\n\nconst config: runtime.GetPrismaClientConfig = {\n  previewFeatures: [],\n  clientVersion: '7.0.0',\n  engineVersion: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n  activeProvider: 'sqlite',\n  inlineSchema:\n    '// This is your Prisma schema file,\\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\\n\\ngenerator client {\\n  provider = \"prisma-client\"\\n  output   = \"../src/prisma-generated\"\\n}\\n\\ndatasource db {\\n  provider = \"sqlite\"\\n}\\n\\nmodel User {\\n  email    String @id @unique\\n  password String\\n}\\n',\n  runtimeDataModel: {\n    models: {},\n    enums: {},\n    types: {},\n  },\n}\n\nconfig.runtimeDataModel = JSON.parse(\n  '{\"models\":{\"User\":{\"fields\":[{\"name\":\"email\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"password\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}',\n)\n\nasync function decodeBase64AsWasm(\n  wasmBase64: string,\n): Promise<WebAssembly.Module> {\n  const { Buffer } = await import('node:buffer')\n  const wasmArray = Buffer.from(wasmBase64, 'base64')\n  return new WebAssembly.Module(wasmArray)\n}\n\nconfig.compilerWasm = {\n  getRuntime: async () =>\n    await import('@prisma/client/runtime/query_compiler_bg.sqlite.mjs'),\n\n  getQueryCompilerWasmModule: async () => {\n    const { wasm } =\n      await import('@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs')\n    return await decodeBase64AsWasm(wasm)\n  },\n}\n\nexport type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> =\n  'log' extends keyof ClientOptions\n    ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition>\n      ? Prisma.GetEvents<ClientOptions['log']>\n      : never\n    : never\n\nexport interface PrismaClientConstructor {\n  /**\n   * ## Prisma Client\n   *\n   * Type-safe database client for TypeScript\n   * @example\n   * ```\n   * const prisma = new PrismaClient()\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n   */\n\n  new <\n    Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,\n    LogOpts extends LogOptions<Options> = LogOptions<Options>,\n    OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {\n      omit: infer U\n    }\n      ? U\n      : Prisma.PrismaClientOptions['omit'],\n    ExtArgs extends runtime.Types.Extensions.InternalArgs =\n      runtime.Types.Extensions.DefaultArgs,\n  >(\n    options: Prisma.Subset<Options, Prisma.PrismaClientOptions>,\n  ): PrismaClient<LogOpts, OmitOpts, ExtArgs>\n}\n\n/**\n * ## Prisma Client\n *\n * Type-safe database client for TypeScript\n * @example\n * ```\n * const prisma = new PrismaClient()\n * // Fetch zero or more Users\n * const users = await prisma.user.findMany()\n * ```\n *\n * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).\n */\n\nexport interface PrismaClient<\n  in LogOpts extends Prisma.LogLevel = never,\n  in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,\n  in out ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> {\n  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }\n\n  $on<V extends LogOpts>(\n    eventType: V,\n    callback: (\n      event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent,\n    ) => void,\n  ): PrismaClient\n\n  /**\n   * Connect with the database\n   */\n  $connect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Disconnect from the database\n   */\n  $disconnect(): runtime.Types.Utils.JsPromise<void>\n\n  /**\n   * Executes a prepared raw query and returns the number of affected rows.\n   * @example\n   * ```\n   * const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Executes a raw query and returns the number of affected rows.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $executeRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<number>\n\n  /**\n   * Performs a prepared raw query and returns the `SELECT` data.\n   * @example\n   * ```\n   * const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRaw<T = unknown>(\n    query: TemplateStringsArray | Prisma.Sql,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Performs a raw query and returns the `SELECT` data.\n   * Susceptible to SQL injections, see documentation.\n   * @example\n   * ```\n   * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).\n   */\n  $queryRawUnsafe<T = unknown>(\n    query: string,\n    ...values: any[]\n  ): Prisma.PrismaPromise<T>\n\n  /**\n   * Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.\n   * @example\n   * ```\n   * const [george, bob, alice] = await prisma.$transaction([\n   *   prisma.user.create({ data: { name: 'George' } }),\n   *   prisma.user.create({ data: { name: 'Bob' } }),\n   *   prisma.user.create({ data: { name: 'Alice' } }),\n   * ])\n   * ```\n   *\n   * Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).\n   */\n  $transaction<P extends Prisma.PrismaPromise<any>[]>(\n    arg: [...P],\n    options?: { isolationLevel?: Prisma.TransactionIsolationLevel },\n  ): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>\n\n  $transaction<R>(\n    fn: (\n      prisma: Omit<PrismaClient, runtime.ITXClientDenyList>,\n    ) => runtime.Types.Utils.JsPromise<R>,\n    options?: {\n      maxWait?: number\n      timeout?: number\n      isolationLevel?: Prisma.TransactionIsolationLevel\n    },\n  ): runtime.Types.Utils.JsPromise<R>\n\n  $extends: runtime.Types.Extensions.ExtendsHook<\n    'extends',\n    Prisma.TypeMapCb<OmitOpts>,\n    ExtArgs,\n    runtime.Types.Utils.Call<\n      Prisma.TypeMapCb<OmitOpts>,\n      {\n        extArgs: ExtArgs\n      }\n    >\n  >\n\n  /**\n   * `prisma.user`: Exposes CRUD operations for the **User** model.\n   * Example usage:\n   * ```ts\n   * // Fetch zero or more Users\n   * const users = await prisma.user.findMany()\n   * ```\n   */\n  get user(): Prisma.UserDelegate<ExtArgs, { omit: OmitOpts }>\n}\n\nexport function getPrismaClientClass(): PrismaClientConstructor {\n  return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/internal/prismaNamespace.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the client.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/client'\nimport type * as Prisma from '../models'\nimport { type PrismaClient } from './class'\n\nexport type * from '../models'\n\nexport type DMMF = typeof runtime.DMMF\n\nexport type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>\n\n/**\n * Prisma Errors\n */\n\nexport const PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\nexport type PrismaClientKnownRequestError =\n  runtime.PrismaClientKnownRequestError\n\nexport const PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\nexport type PrismaClientUnknownRequestError =\n  runtime.PrismaClientUnknownRequestError\n\nexport const PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\nexport type PrismaClientRustPanicError = runtime.PrismaClientRustPanicError\n\nexport const PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\nexport type PrismaClientInitializationError =\n  runtime.PrismaClientInitializationError\n\nexport const PrismaClientValidationError = runtime.PrismaClientValidationError\nexport type PrismaClientValidationError = runtime.PrismaClientValidationError\n\n/**\n * Re-export of sql-template-tag\n */\nexport const sql = runtime.sqltag\nexport const empty = runtime.empty\nexport const join = runtime.join\nexport const raw = runtime.raw\nexport const Sql = runtime.Sql\nexport type Sql = runtime.Sql\n\n/**\n * Decimal.js\n */\nexport const Decimal = runtime.Decimal\nexport type Decimal = runtime.Decimal\n\nexport type DecimalJsLike = runtime.DecimalJsLike\n\n/**\n * Extensions\n */\nexport type Extension = runtime.Types.Extensions.UserArgs\nexport const getExtensionContext = runtime.Extensions.getExtensionContext\nexport type Args<T, F extends runtime.Operation> = runtime.Types.Public.Args<\n  T,\n  F\n>\nexport type Payload<\n  T,\n  F extends runtime.Operation = never,\n> = runtime.Types.Public.Payload<T, F>\nexport type Result<\n  T,\n  A,\n  F extends runtime.Operation,\n> = runtime.Types.Public.Result<T, A, F>\nexport type Exact<A, W> = runtime.Types.Public.Exact<A, W>\n\nexport type PrismaVersion = {\n  client: string\n  engine: string\n}\n\n/**\n * Prisma Client JS version: 7.0.0\n * Query Engine version: 0c19ccc313cf9911a90d99d2ac2eb0280c76c513\n */\nexport const prismaVersion: PrismaVersion = {\n  client: '7.0.0',\n  engine: '0c19ccc313cf9911a90d99d2ac2eb0280c76c513',\n}\n\n/**\n * Utility Types\n */\n\nexport type Bytes = runtime.Bytes\nexport type JsonObject = runtime.JsonObject\nexport type JsonArray = runtime.JsonArray\nexport type JsonValue = runtime.JsonValue\nexport type InputJsonObject = runtime.InputJsonObject\nexport type InputJsonArray = runtime.InputJsonArray\nexport type InputJsonValue = runtime.InputJsonValue\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\ntype SelectAndInclude = {\n  select: any\n  include: any\n}\n\ntype SelectAndOmit = {\n  select: any\n  omit: any\n}\n\n/**\n * From T, pick a set of properties whose keys are in the union K\n */\ntype Prisma__Pick<T, K extends keyof T> = {\n  [P in K]: T[P]\n}\n\nexport type Enumerable<T> = T | Array<T>\n\n/**\n * Subset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection\n */\nexport type Subset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n}\n\n/**\n * SelectSubset\n * @desc From `T` pick properties that exist in `U`. Simple version of Intersection.\n * Additionally, it validates, if both select and include are present. If the case, it errors.\n */\nexport type SelectSubset<T, U> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & (T extends SelectAndInclude\n  ? 'Please either choose `select` or `include`.'\n  : T extends SelectAndOmit\n    ? 'Please either choose `select` or `omit`.'\n    : {})\n\n/**\n * Subset + Intersection\n * @desc From `T` pick properties that exist in `U` and intersect `K`\n */\nexport type SubsetIntersection<T, U, K> = {\n  [key in keyof T]: key extends keyof U ? T[key] : never\n} & K\n\ntype Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }\n\n/**\n * XOR is needed to have a real mutually exclusive union type\n * https://stackoverflow.com/questions/42123407/does-typescript-support-mutually-exclusive-types\n */\nexport type XOR<T, U> = T extends object\n  ? U extends object\n    ? (Without<T, U> & U) | (Without<U, T> & T)\n    : U\n  : T\n\n/**\n * Is T a Record?\n */\ntype IsObject<T extends any> =\n  T extends Array<any>\n    ? False\n    : T extends Date\n      ? False\n      : T extends Uint8Array\n        ? False\n        : T extends BigInt\n          ? False\n          : T extends object\n            ? True\n            : False\n\n/**\n * If it's T[], return T\n */\nexport type UnEnumerate<T extends unknown> = T extends Array<infer U> ? U : T\n\n/**\n * From ts-toolbelt\n */\n\ntype __Either<O extends object, K extends Key> = Omit<O, K> &\n  {\n    // Merge all but K\n    [P in K]: Prisma__Pick<O, P & keyof O> // With K possibilities\n  }[K]\n\ntype EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>\n\ntype EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>\n\ntype _Either<O extends object, K extends Key, strict extends Boolean> = {\n  1: EitherStrict<O, K>\n  0: EitherLoose<O, K>\n}[strict]\n\nexport type Either<\n  O extends object,\n  K extends Key,\n  strict extends Boolean = 1,\n> = O extends unknown ? _Either<O, K, strict> : never\n\nexport type Union = any\n\nexport type PatchUndefined<O extends object, O1 extends object> = {\n  [K in keyof O]: O[K] extends undefined ? At<O1, K> : O[K]\n} & {}\n\n/** Helper Types for \"Merge\" **/\nexport type IntersectOf<U extends Union> = (\n  U extends unknown ? (k: U) => void : never\n) extends (k: infer I) => void\n  ? I\n  : never\n\nexport type Overwrite<O extends object, O1 extends object> = {\n  [K in keyof O]: K extends keyof O1 ? O1[K] : O[K]\n} & {}\n\ntype _Merge<U extends object> = IntersectOf<\n  Overwrite<\n    U,\n    {\n      [K in keyof U]-?: At<U, K>\n    }\n  >\n>\n\ntype Key = string | number | symbol\ntype AtStrict<O extends object, K extends Key> = O[K & keyof O]\ntype AtLoose<O extends object, K extends Key> = O extends unknown\n  ? AtStrict<O, K>\n  : never\nexport type At<O extends object, K extends Key, strict extends Boolean = 1> = {\n  1: AtStrict<O, K>\n  0: AtLoose<O, K>\n}[strict]\n\nexport type ComputeRaw<A extends any> = A extends Function\n  ? A\n  : {\n      [K in keyof A]: A[K]\n    } & {}\n\nexport type OptionalFlat<O> = {\n  [K in keyof O]?: O[K]\n} & {}\n\ntype _Record<K extends keyof any, T> = {\n  [P in K]: T\n}\n\n// cause typescript not to expand types and preserve names\ntype NoExpand<T> = T extends unknown ? T : never\n\n// this type assumes the passed object is entirely optional\nexport type AtLeast<O extends object, K extends string> = NoExpand<\n  O extends unknown\n    ?\n        | (K extends keyof O ? { [P in K]: O[P] } & O : O)\n        | ({ [P in keyof O as P extends K ? P : never]-?: O[P] } & O)\n    : never\n>\n\ntype _Strict<U, _U = U> = U extends unknown\n  ? U & OptionalFlat<_Record<Exclude<Keys<_U>, keyof U>, never>>\n  : never\n\nexport type Strict<U extends object> = ComputeRaw<_Strict<U>>\n/** End Helper Types for \"Merge\" **/\n\nexport type Merge<U extends object> = ComputeRaw<_Merge<Strict<U>>>\n\nexport type Boolean = True | False\n\nexport type True = 1\n\nexport type False = 0\n\nexport type Not<B extends Boolean> = {\n  0: 1\n  1: 0\n}[B]\n\nexport type Extends<A1 extends any, A2 extends any> = [A1] extends [never]\n  ? 0 // anything `never` is false\n  : A1 extends A2\n    ? 1\n    : 0\n\nexport type Has<U extends Union, U1 extends Union> = Not<\n  Extends<Exclude<U1, U>, U1>\n>\n\nexport type Or<B1 extends Boolean, B2 extends Boolean> = {\n  0: {\n    0: 0\n    1: 1\n  }\n  1: {\n    0: 1\n    1: 1\n  }\n}[B1][B2]\n\nexport type Keys<U extends Union> = U extends unknown ? keyof U : never\n\nexport type GetScalarType<T, O> = O extends object\n  ? {\n      [P in keyof T]: P extends keyof O ? O[P] : never\n    }\n  : never\n\ntype FieldPaths<T, U = Omit<T, '_avg' | '_sum' | '_count' | '_min' | '_max'>> =\n  IsObject<T> extends True ? U : T\n\nexport type GetHavingFields<T> = {\n  [K in keyof T]: Or<\n    Or<Extends<'OR', K>, Extends<'AND', K>>,\n    Extends<'NOT', K>\n  > extends True\n    ? // infer is only needed to not hit TS limit\n      // based on the brilliant idea of Pierre-Antoine Mills\n      // https://github.com/microsoft/TypeScript/issues/30188#issuecomment-478938437\n      T[K] extends infer TK\n      ? GetHavingFields<\n          UnEnumerate<TK> extends object ? Merge<UnEnumerate<TK>> : never\n        >\n      : never\n    : {} extends FieldPaths<T[K]>\n      ? never\n      : K\n}[keyof T]\n\n/**\n * Convert tuple to union\n */\ntype _TupleToUnion<T> = T extends (infer E)[] ? E : never\ntype TupleToUnion<K extends readonly any[]> = _TupleToUnion<K>\nexport type MaybeTupleToUnion<T> = T extends any[] ? TupleToUnion<T> : T\n\n/**\n * Like `Pick`, but additionally can also accept an array of keys\n */\nexport type PickEnumerable<\n  T,\n  K extends Enumerable<keyof T> | keyof T,\n> = Prisma__Pick<T, MaybeTupleToUnion<K>>\n\n/**\n * Exclude all keys with underscores\n */\nexport type ExcludeUnderscoreKeys<T extends string> = T extends `_${string}`\n  ? never\n  : T\n\nexport type FieldRef<Model, FieldType> = runtime.FieldRef<Model, FieldType>\n\ntype FieldRefInputType<Model, FieldType> = Model extends never\n  ? never\n  : FieldRef<Model, FieldType>\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\nexport interface TypeMapCb<GlobalOmitOptions = {}> extends runtime.Types.Utils\n  .Fn<\n  { extArgs: runtime.Types.Extensions.InternalArgs },\n  runtime.Types.Utils.Record<string, any>\n> {\n  returns: TypeMap<this['params']['extArgs'], GlobalOmitOptions>\n}\n\nexport type TypeMap<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> = {\n  globalOmitOptions: {\n    omit: GlobalOmitOptions\n  }\n  meta: {\n    modelProps: 'user'\n    txIsolationLevel: TransactionIsolationLevel\n  }\n  model: {\n    User: {\n      payload: Prisma.$UserPayload<ExtArgs>\n      fields: Prisma.UserFieldRefs\n      operations: {\n        findUnique: {\n          args: Prisma.UserFindUniqueArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findUniqueOrThrow: {\n          args: Prisma.UserFindUniqueOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findFirst: {\n          args: Prisma.UserFindFirstArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload> | null\n        }\n        findFirstOrThrow: {\n          args: Prisma.UserFindFirstOrThrowArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        findMany: {\n          args: Prisma.UserFindManyArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        create: {\n          args: Prisma.UserCreateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        createMany: {\n          args: Prisma.UserCreateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        createManyAndReturn: {\n          args: Prisma.UserCreateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        delete: {\n          args: Prisma.UserDeleteArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        update: {\n          args: Prisma.UserUpdateArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        deleteMany: {\n          args: Prisma.UserDeleteManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateMany: {\n          args: Prisma.UserUpdateManyArgs<ExtArgs>\n          result: BatchPayload\n        }\n        updateManyAndReturn: {\n          args: Prisma.UserUpdateManyAndReturnArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>[]\n        }\n        upsert: {\n          args: Prisma.UserUpsertArgs<ExtArgs>\n          result: runtime.Types.Utils.PayloadToResult<Prisma.$UserPayload>\n        }\n        aggregate: {\n          args: Prisma.UserAggregateArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.AggregateUser>\n        }\n        groupBy: {\n          args: Prisma.UserGroupByArgs<ExtArgs>\n          result: runtime.Types.Utils.Optional<Prisma.UserGroupByOutputType>[]\n        }\n        count: {\n          args: Prisma.UserCountArgs<ExtArgs>\n          result:\n            | runtime.Types.Utils.Optional<Prisma.UserCountAggregateOutputType>\n            | number\n        }\n      }\n    }\n  }\n} & {\n  other: {\n    payload: any\n    operations: {\n      $executeRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $executeRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n      $queryRaw: {\n        args: [query: TemplateStringsArray | Sql, ...values: any[]]\n        result: any\n      }\n      $queryRawUnsafe: {\n        args: [query: string, ...values: any[]]\n        result: any\n      }\n    }\n  }\n}\n\n/**\n * Enums\n */\n\nexport const TransactionIsolationLevel = runtime.makeStrictEnum({\n  Serializable: 'Serializable',\n} as const)\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n\n/**\n * Field references\n */\n\n/**\n * Reference to a field of type 'String'\n */\nexport type StringFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'String'\n>\n\n/**\n * Reference to a field of type 'Int'\n */\nexport type IntFieldRefInput<$PrismaModel> = FieldRefInputType<\n  $PrismaModel,\n  'Int'\n>\n\n/**\n * Batch Payload for updateMany & deleteMany & createMany\n */\nexport type BatchPayload = {\n  count: number\n}\n\nexport const defineExtension = runtime.Extensions\n  .defineExtension as unknown as runtime.Types.Extensions.ExtendsHook<\n  'define',\n  TypeMapCb,\n  runtime.Types.Extensions.DefaultArgs\n>\nexport type DefaultPrismaClient = PrismaClient\nexport type ErrorFormat = 'pretty' | 'colorless' | 'minimal'\nexport type PrismaClientOptions = (\n  | {\n      /**\n       * Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`.\n       */\n      adapter: runtime.SqlDriverAdapterFactory\n      accelerateUrl?: never\n    }\n  | {\n      /**\n       * Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database.\n       */\n      accelerateUrl: string\n      adapter?: never\n    }\n) & {\n  /**\n   * @default \"colorless\"\n   */\n  errorFormat?: ErrorFormat\n  /**\n   * @example\n   * ```\n   * // Shorthand for `emit: 'stdout'`\n   * log: ['query', 'info', 'warn', 'error']\n   *\n   * // Emit as events only\n   * log: [\n   *   { emit: 'event', level: 'query' },\n   *   { emit: 'event', level: 'info' },\n   *   { emit: 'event', level: 'warn' }\n   *   { emit: 'event', level: 'error' }\n   * ]\n   *\n   * / Emit as events and log to stdout\n   * og: [\n   *  { emit: 'stdout', level: 'query' },\n   *  { emit: 'stdout', level: 'info' },\n   *  { emit: 'stdout', level: 'warn' }\n   *  { emit: 'stdout', level: 'error' }\n   *\n   * ```\n   * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).\n   */\n  log?: (LogLevel | LogDefinition)[]\n  /**\n   * The default values for transactionOptions\n   * maxWait ?= 2000\n   * timeout ?= 5000\n   */\n  transactionOptions?: {\n    maxWait?: number\n    timeout?: number\n    isolationLevel?: TransactionIsolationLevel\n  }\n  /**\n   * Global configuration for omitting model fields by default.\n   *\n   * @example\n   * ```\n   * const prisma = new PrismaClient({\n   *   omit: {\n   *     user: {\n   *       password: true\n   *     }\n   *   }\n   * })\n   * ```\n   */\n  omit?: GlobalOmitConfig\n}\nexport type GlobalOmitConfig = {\n  user?: Prisma.UserOmit\n}\n\n/* Types for Logging */\nexport type LogLevel = 'info' | 'query' | 'warn' | 'error'\nexport type LogDefinition = {\n  level: LogLevel\n  emit: 'stdout' | 'event'\n}\n\nexport type CheckIsLogLevel<T> = T extends LogLevel ? T : never\n\nexport type GetLogType<T> = CheckIsLogLevel<\n  T extends LogDefinition ? T['level'] : T\n>\n\nexport type GetEvents<T extends any[]> =\n  T extends Array<LogLevel | LogDefinition> ? GetLogType<T[number]> : never\n\nexport type QueryEvent = {\n  timestamp: Date\n  query: string\n  params: string\n  duration: number\n  target: string\n}\n\nexport type LogEvent = {\n  timestamp: Date\n  message: string\n  target: string\n}\n/* End Types for Logging */\n\nexport type PrismaAction =\n  | 'findUnique'\n  | 'findUniqueOrThrow'\n  | 'findMany'\n  | 'findFirst'\n  | 'findFirstOrThrow'\n  | 'create'\n  | 'createMany'\n  | 'createManyAndReturn'\n  | 'update'\n  | 'updateMany'\n  | 'updateManyAndReturn'\n  | 'upsert'\n  | 'delete'\n  | 'deleteMany'\n  | 'executeRaw'\n  | 'queryRaw'\n  | 'aggregate'\n  | 'count'\n  | 'runCommandRaw'\n  | 'findRaw'\n  | 'groupBy'\n\n/**\n * `PrismaClient` proxy available in interactive transactions.\n */\nexport type TransactionClient = Omit<\n  DefaultPrismaClient,\n  runtime.ITXClientDenyList\n>\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/internal/prismaNamespaceBrowser.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * WARNING: This is an internal file that is subject to change!\n *\n * 🛑 Under no circumstances should you import this file directly! 🛑\n *\n * All exports from this file are wrapped under a `Prisma` namespace object in the browser.ts file.\n * While this enables partial backward compatibility, it is not part of the stable public API.\n *\n * If you are looking for your Models, Enums, and Input Types, please import them from the respective\n * model files in the `model` directory!\n */\n\nimport * as runtime from '@prisma/client/runtime/index-browser'\n\nexport type * from '../models'\nexport type * from './prismaNamespace'\n\nexport const Decimal = runtime.Decimal\n\nexport const NullTypes = {\n  DbNull: runtime.NullTypes.DbNull as new (\n    secret: never,\n  ) => typeof runtime.DbNull,\n  JsonNull: runtime.NullTypes.JsonNull as new (\n    secret: never,\n  ) => typeof runtime.JsonNull,\n  AnyNull: runtime.NullTypes.AnyNull as new (\n    secret: never,\n  ) => typeof runtime.AnyNull,\n}\n/**\n * Helper for filtering JSON entries that have `null` on the database (empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const DbNull = runtime.DbNull\n\n/**\n * Helper for filtering JSON entries that have JSON `null` values (not empty on the db)\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const JsonNull = runtime.JsonNull\n\n/**\n * Helper for filtering JSON entries that are `Prisma.DbNull` or `Prisma.JsonNull`\n *\n * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field\n */\nexport const AnyNull = runtime.AnyNull\n\nexport const ModelName = {\n  User: 'User',\n} as const\n\nexport type ModelName = (typeof ModelName)[keyof typeof ModelName]\n\n/*\n * Enums\n */\n\nexport const TransactionIsolationLevel = {\n  Serializable: 'Serializable',\n} as const\n\nexport type TransactionIsolationLevel =\n  (typeof TransactionIsolationLevel)[keyof typeof TransactionIsolationLevel]\n\nexport const UserScalarFieldEnum = {\n  email: 'email',\n  password: 'password',\n} as const\n\nexport type UserScalarFieldEnum =\n  (typeof UserScalarFieldEnum)[keyof typeof UserScalarFieldEnum]\n\nexport const SortOrder = {\n  asc: 'asc',\n  desc: 'desc',\n} as const\n\nexport type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/models/User.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This file exports the `User` model and its related types.\n *\n * 🟢 You can import this file directly.\n */\nimport type * as runtime from '@prisma/client/runtime/client'\nimport type * as $Enums from '../enums'\nimport type * as Prisma from '../internal/prismaNamespace'\n\n/**\n * Model User\n *\n */\nexport type UserModel =\n  runtime.Types.Result.DefaultSelection<Prisma.$UserPayload>\n\nexport type AggregateUser = {\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\nexport type UserMinAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserMaxAggregateOutputType = {\n  email: string | null\n  password: string | null\n}\n\nexport type UserCountAggregateOutputType = {\n  email: number\n  password: number\n  _all: number\n}\n\nexport type UserMinAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserMaxAggregateInputType = {\n  email?: true\n  password?: true\n}\n\nexport type UserCountAggregateInputType = {\n  email?: true\n  password?: true\n  _all?: true\n}\n\nexport type UserAggregateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which User to aggregate.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the start position\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Count returned Users\n   **/\n  _count?: true | UserCountAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the minimum value\n   **/\n  _min?: UserMinAggregateInputType\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}\n   *\n   * Select which fields to find the maximum value\n   **/\n  _max?: UserMaxAggregateInputType\n}\n\nexport type GetUserAggregateType<T extends UserAggregateArgs> = {\n  [P in keyof T & keyof AggregateUser]: P extends '_count' | 'count'\n    ? T[P] extends true\n      ? number\n      : Prisma.GetScalarType<T[P], AggregateUser[P]>\n    : Prisma.GetScalarType<T[P], AggregateUser[P]>\n}\n\nexport type UserGroupByArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  where?: Prisma.UserWhereInput\n  orderBy?:\n    | Prisma.UserOrderByWithAggregationInput\n    | Prisma.UserOrderByWithAggregationInput[]\n  by: Prisma.UserScalarFieldEnum[] | Prisma.UserScalarFieldEnum\n  having?: Prisma.UserScalarWhereWithAggregatesInput\n  take?: number\n  skip?: number\n  _count?: UserCountAggregateInputType | true\n  _min?: UserMinAggregateInputType\n  _max?: UserMaxAggregateInputType\n}\n\nexport type UserGroupByOutputType = {\n  email: string\n  password: string\n  _count: UserCountAggregateOutputType | null\n  _min: UserMinAggregateOutputType | null\n  _max: UserMaxAggregateOutputType | null\n}\n\ntype GetUserGroupByPayload<T extends UserGroupByArgs> = Prisma.PrismaPromise<\n  Array<\n    Prisma.PickEnumerable<UserGroupByOutputType, T['by']> & {\n      [P in keyof T & keyof UserGroupByOutputType]: P extends '_count'\n        ? T[P] extends boolean\n          ? number\n          : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n        : Prisma.GetScalarType<T[P], UserGroupByOutputType[P]>\n    }\n  >\n>\n\nexport type UserWhereInput = {\n  AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  OR?: Prisma.UserWhereInput[]\n  NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n  email?: Prisma.StringFilter<'User'> | string\n  password?: Prisma.StringFilter<'User'> | string\n}\n\nexport type UserOrderByWithRelationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserWhereUniqueInput = Prisma.AtLeast<\n  {\n    email?: string\n    AND?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    OR?: Prisma.UserWhereInput[]\n    NOT?: Prisma.UserWhereInput | Prisma.UserWhereInput[]\n    password?: Prisma.StringFilter<'User'> | string\n  },\n  'email' | 'email'\n>\n\nexport type UserOrderByWithAggregationInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n  _count?: Prisma.UserCountOrderByAggregateInput\n  _max?: Prisma.UserMaxOrderByAggregateInput\n  _min?: Prisma.UserMinOrderByAggregateInput\n}\n\nexport type UserScalarWhereWithAggregatesInput = {\n  AND?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  OR?: Prisma.UserScalarWhereWithAggregatesInput[]\n  NOT?:\n    | Prisma.UserScalarWhereWithAggregatesInput\n    | Prisma.UserScalarWhereWithAggregatesInput[]\n  email?: Prisma.StringWithAggregatesFilter<'User'> | string\n  password?: Prisma.StringWithAggregatesFilter<'User'> | string\n}\n\nexport type UserCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUncheckedCreateInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCreateManyInput = {\n  email: string\n  password: string\n}\n\nexport type UserUpdateManyMutationInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserUncheckedUpdateManyInput = {\n  email?: Prisma.StringFieldUpdateOperationsInput | string\n  password?: Prisma.StringFieldUpdateOperationsInput | string\n}\n\nexport type UserCountOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMaxOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type UserMinOrderByAggregateInput = {\n  email?: Prisma.SortOrder\n  password?: Prisma.SortOrder\n}\n\nexport type StringFieldUpdateOperationsInput = {\n  set?: string\n}\n\nexport type UserSelect<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectCreateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectUpdateManyAndReturn<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetSelect<\n  {\n    email?: boolean\n    password?: boolean\n  },\n  ExtArgs['result']['user']\n>\n\nexport type UserSelectScalar = {\n  email?: boolean\n  password?: boolean\n}\n\nexport type UserOmit<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = runtime.Types.Extensions.GetOmit<\n  'email' | 'password',\n  ExtArgs['result']['user']\n>\n\nexport type $UserPayload<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  name: 'User'\n  objects: {}\n  scalars: runtime.Types.Extensions.GetPayloadResult<\n    {\n      email: string\n      password: string\n    },\n    ExtArgs['result']['user']\n  >\n  composites: {}\n}\n\nexport type UserGetPayload<\n  S extends boolean | null | undefined | UserDefaultArgs,\n> = runtime.Types.Result.GetResult<Prisma.$UserPayload, S>\n\nexport type UserCountArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = Omit<UserFindManyArgs, 'select' | 'include' | 'distinct' | 'omit'> & {\n  select?: UserCountAggregateInputType | true\n}\n\nexport interface UserDelegate<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> {\n  [K: symbol]: {\n    types: Prisma.TypeMap<ExtArgs>['model']['User']\n    meta: { name: 'User' }\n  }\n  /**\n   * Find zero or one User that matches the filter.\n   * @param {UserFindUniqueArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUnique({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUnique<T extends UserFindUniqueArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUnique',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find one User that matches the filter or throw an error with `error.code='P2025'`\n   * if no matches were found.\n   * @param {UserFindUniqueOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findUniqueOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findUniqueOrThrow<T extends UserFindUniqueOrThrowArgs>(\n    args: Prisma.SelectSubset<T, UserFindUniqueOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findUniqueOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirst({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirst<T extends UserFindFirstArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirst',\n      GlobalOmitOptions\n    > | null,\n    null,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find the first User that matches the filter or\n   * throw `PrismaKnownClientError` with `P2025` code if no matches were found.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindFirstOrThrowArgs} args - Arguments to find a User\n   * @example\n   * // Get one User\n   * const user = await prisma.user.findFirstOrThrow({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   */\n  findFirstOrThrow<T extends UserFindFirstOrThrowArgs>(\n    args?: Prisma.SelectSubset<T, UserFindFirstOrThrowArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findFirstOrThrow',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Find zero or more Users that matches the filter.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserFindManyArgs} args - Arguments to filter and select certain fields only.\n   * @example\n   * // Get all Users\n   * const users = await prisma.user.findMany()\n   *\n   * // Get first 10 Users\n   * const users = await prisma.user.findMany({ take: 10 })\n   *\n   * // Only select the `email`\n   * const userWithEmailOnly = await prisma.user.findMany({ select: { email: true } })\n   *\n   */\n  findMany<T extends UserFindManyArgs>(\n    args?: Prisma.SelectSubset<T, UserFindManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'findMany',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create a User.\n   * @param {UserCreateArgs} args - Arguments to create a User.\n   * @example\n   * // Create one User\n   * const User = await prisma.user.create({\n   *   data: {\n   *     // ... data to create a User\n   *   }\n   * })\n   *\n   */\n  create<T extends UserCreateArgs>(\n    args: Prisma.SelectSubset<T, UserCreateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'create',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Create many Users.\n   * @param {UserCreateManyArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createMany({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   */\n  createMany<T extends UserCreateManyArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Create many Users and returns the data saved in the database.\n   * @param {UserCreateManyAndReturnArgs} args - Arguments to create many Users.\n   * @example\n   * // Create many Users\n   * const user = await prisma.user.createManyAndReturn({\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Create many Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.createManyAndReturn({\n   *   select: { email: true },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  createManyAndReturn<T extends UserCreateManyAndReturnArgs>(\n    args?: Prisma.SelectSubset<T, UserCreateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'createManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Delete a User.\n   * @param {UserDeleteArgs} args - Arguments to delete one User.\n   * @example\n   * // Delete one User\n   * const User = await prisma.user.delete({\n   *   where: {\n   *     // ... filter to delete one User\n   *   }\n   * })\n   *\n   */\n  delete<T extends UserDeleteArgs>(\n    args: Prisma.SelectSubset<T, UserDeleteArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'delete',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Update one User.\n   * @param {UserUpdateArgs} args - Arguments to update one User.\n   * @example\n   * // Update one User\n   * const user = await prisma.user.update({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  update<T extends UserUpdateArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'update',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Delete zero or more Users.\n   * @param {UserDeleteManyArgs} args - Arguments to filter Users to delete.\n   * @example\n   * // Delete a few Users\n   * const { count } = await prisma.user.deleteMany({\n   *   where: {\n   *     // ... provide filter here\n   *   }\n   * })\n   *\n   */\n  deleteMany<T extends UserDeleteManyArgs>(\n    args?: Prisma.SelectSubset<T, UserDeleteManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserUpdateManyArgs} args - Arguments to update one or more rows.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateMany({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: {\n   *     // ... provide data here\n   *   }\n   * })\n   *\n   */\n  updateMany<T extends UserUpdateManyArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<Prisma.BatchPayload>\n\n  /**\n   * Update zero or more Users and returns the data updated in the database.\n   * @param {UserUpdateManyAndReturnArgs} args - Arguments to update many Users.\n   * @example\n   * // Update many Users\n   * const user = await prisma.user.updateManyAndReturn({\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   *\n   * // Update zero or more Users and only return the `email`\n   * const userWithEmailOnly = await prisma.user.updateManyAndReturn({\n   *   select: { email: true },\n   *   where: {\n   *     // ... provide filter here\n   *   },\n   *   data: [\n   *     // ... provide data here\n   *   ]\n   * })\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   *\n   */\n  updateManyAndReturn<T extends UserUpdateManyAndReturnArgs>(\n    args: Prisma.SelectSubset<T, UserUpdateManyAndReturnArgs<ExtArgs>>,\n  ): Prisma.PrismaPromise<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'updateManyAndReturn',\n      GlobalOmitOptions\n    >\n  >\n\n  /**\n   * Create or update one User.\n   * @param {UserUpsertArgs} args - Arguments to update or create a User.\n   * @example\n   * // Update or create a User\n   * const user = await prisma.user.upsert({\n   *   create: {\n   *     // ... data to create a User\n   *   },\n   *   update: {\n   *     // ... in case it already exists, update\n   *   },\n   *   where: {\n   *     // ... the filter for the User we want to update\n   *   }\n   * })\n   */\n  upsert<T extends UserUpsertArgs>(\n    args: Prisma.SelectSubset<T, UserUpsertArgs<ExtArgs>>,\n  ): Prisma.Prisma__UserClient<\n    runtime.Types.Result.GetResult<\n      Prisma.$UserPayload<ExtArgs>,\n      T,\n      'upsert',\n      GlobalOmitOptions\n    >,\n    never,\n    ExtArgs,\n    GlobalOmitOptions\n  >\n\n  /**\n   * Count the number of Users.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserCountArgs} args - Arguments to filter Users to count.\n   * @example\n   * // Count the number of Users\n   * const count = await prisma.user.count({\n   *   where: {\n   *     // ... the filter for the Users we want to count\n   *   }\n   * })\n   **/\n  count<T extends UserCountArgs>(\n    args?: Prisma.Subset<T, UserCountArgs>,\n  ): Prisma.PrismaPromise<\n    T extends runtime.Types.Utils.Record<'select', any>\n      ? T['select'] extends true\n        ? number\n        : Prisma.GetScalarType<T['select'], UserCountAggregateOutputType>\n      : number\n  >\n\n  /**\n   * Allows you to perform aggregations operations on a User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserAggregateArgs} args - Select which aggregations you would like to apply and on what fields.\n   * @example\n   * // Ordered by age ascending\n   * // Where email contains prisma.io\n   * // Limited to the 10 users\n   * const aggregations = await prisma.user.aggregate({\n   *   _avg: {\n   *     age: true,\n   *   },\n   *   where: {\n   *     email: {\n   *       contains: \"prisma.io\",\n   *     },\n   *   },\n   *   orderBy: {\n   *     age: \"asc\",\n   *   },\n   *   take: 10,\n   * })\n   **/\n  aggregate<T extends UserAggregateArgs>(\n    args: Prisma.Subset<T, UserAggregateArgs>,\n  ): Prisma.PrismaPromise<GetUserAggregateType<T>>\n\n  /**\n   * Group by User.\n   * Note, that providing `undefined` is treated as the value not being there.\n   * Read more here: https://pris.ly/d/null-undefined\n   * @param {UserGroupByArgs} args - Group by arguments.\n   * @example\n   * // Group by city, order by createdAt, get count\n   * const result = await prisma.user.groupBy({\n   *   by: ['city', 'createdAt'],\n   *   orderBy: {\n   *     createdAt: true\n   *   },\n   *   _count: {\n   *     _all: true\n   *   },\n   * })\n   *\n   **/\n  groupBy<\n    T extends UserGroupByArgs,\n    HasSelectOrTake extends Prisma.Or<\n      Prisma.Extends<'skip', Prisma.Keys<T>>,\n      Prisma.Extends<'take', Prisma.Keys<T>>\n    >,\n    OrderByArg extends Prisma.True extends HasSelectOrTake\n      ? { orderBy: UserGroupByArgs['orderBy'] }\n      : { orderBy?: UserGroupByArgs['orderBy'] },\n    OrderFields extends Prisma.ExcludeUnderscoreKeys<\n      Prisma.Keys<Prisma.MaybeTupleToUnion<T['orderBy']>>\n    >,\n    ByFields extends Prisma.MaybeTupleToUnion<T['by']>,\n    ByValid extends Prisma.Has<ByFields, OrderFields>,\n    HavingFields extends Prisma.GetHavingFields<T['having']>,\n    HavingValid extends Prisma.Has<ByFields, HavingFields>,\n    ByEmpty extends T['by'] extends never[] ? Prisma.True : Prisma.False,\n    InputErrors extends ByEmpty extends Prisma.True\n      ? `Error: \"by\" must not be empty.`\n      : HavingValid extends Prisma.False\n        ? {\n            [P in HavingFields]: P extends ByFields\n              ? never\n              : P extends string\n                ? `Error: Field \"${P}\" used in \"having\" needs to be provided in \"by\".`\n                : [\n                    Error,\n                    'Field ',\n                    P,\n                    ` in \"having\" needs to be provided in \"by\"`,\n                  ]\n          }[HavingFields]\n        : 'take' extends Prisma.Keys<T>\n          ? 'orderBy' extends Prisma.Keys<T>\n            ? ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields]\n            : 'Error: If you provide \"take\", you also need to provide \"orderBy\"'\n          : 'skip' extends Prisma.Keys<T>\n            ? 'orderBy' extends Prisma.Keys<T>\n              ? ByValid extends Prisma.True\n                ? {}\n                : {\n                    [P in OrderFields]: P extends ByFields\n                      ? never\n                      : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                  }[OrderFields]\n              : 'Error: If you provide \"skip\", you also need to provide \"orderBy\"'\n            : ByValid extends Prisma.True\n              ? {}\n              : {\n                  [P in OrderFields]: P extends ByFields\n                    ? never\n                    : `Error: Field \"${P}\" in \"orderBy\" needs to be provided in \"by\"`\n                }[OrderFields],\n  >(\n    args: Prisma.SubsetIntersection<T, UserGroupByArgs, OrderByArg> &\n      InputErrors,\n  ): {} extends InputErrors\n    ? GetUserGroupByPayload<T>\n    : Prisma.PrismaPromise<InputErrors>\n  /**\n   * Fields of the User model\n   */\n  readonly fields: UserFieldRefs\n}\n\n/**\n * The delegate class that acts as a \"Promise-like\" for User.\n * Why is this prefixed with `Prisma__`?\n * Because we want to prevent naming conflicts as mentioned in\n * https://github.com/prisma/prisma-client-js/issues/707\n */\nexport interface Prisma__UserClient<\n  T,\n  Null = never,\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n  GlobalOmitOptions = {},\n> extends Prisma.PrismaPromise<T> {\n  readonly [Symbol.toStringTag]: 'PrismaPromise'\n  /**\n   * Attaches callbacks for the resolution and/or rejection of the Promise.\n   * @param onfulfilled The callback to execute when the Promise is resolved.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of which ever callback is executed.\n   */\n  then<TResult1 = T, TResult2 = never>(\n    onfulfilled?:\n      | ((value: T) => TResult1 | PromiseLike<TResult1>)\n      | undefined\n      | null,\n    onrejected?:\n      | ((reason: any) => TResult2 | PromiseLike<TResult2>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<TResult1 | TResult2>\n  /**\n   * Attaches a callback for only the rejection of the Promise.\n   * @param onrejected The callback to execute when the Promise is rejected.\n   * @returns A Promise for the completion of the callback.\n   */\n  catch<TResult = never>(\n    onrejected?:\n      | ((reason: any) => TResult | PromiseLike<TResult>)\n      | undefined\n      | null,\n  ): runtime.Types.Utils.JsPromise<T | TResult>\n  /**\n   * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The\n   * resolved value cannot be modified from the callback.\n   * @param onfinally The callback to execute when the Promise is settled (fulfilled or rejected).\n   * @returns A Promise for the completion of the callback.\n   */\n  finally(\n    onfinally?: (() => void) | undefined | null,\n  ): runtime.Types.Utils.JsPromise<T>\n}\n\n/**\n * Fields of the User model\n */\nexport interface UserFieldRefs {\n  readonly email: Prisma.FieldRef<'User', 'String'>\n  readonly password: Prisma.FieldRef<'User', 'String'>\n}\n\n// Custom InputTypes\n/**\n * User findUnique\n */\nexport type UserFindUniqueArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findUniqueOrThrow\n */\nexport type UserFindUniqueOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User findFirst\n */\nexport type UserFindFirstArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findFirstOrThrow\n */\nexport type UserFindFirstOrThrowArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which User to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for searching for Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/distinct Distinct Docs}\n   *\n   * Filter by unique combinations of Users.\n   */\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User findMany\n */\nexport type UserFindManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter, which Users to fetch.\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/sorting Sorting Docs}\n   *\n   * Determine the order of Users to fetch.\n   */\n  orderBy?:\n    | Prisma.UserOrderByWithRelationInput\n    | Prisma.UserOrderByWithRelationInput[]\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination#cursor-based-pagination Cursor Docs}\n   *\n   * Sets the position for listing Users.\n   */\n  cursor?: Prisma.UserWhereUniqueInput\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Take `±n` Users from the position of the cursor.\n   */\n  take?: number\n  /**\n   * {@link https://www.prisma.io/docs/concepts/components/prisma-client/pagination Pagination Docs}\n   *\n   * Skip the first `n` Users.\n   */\n  skip?: number\n  distinct?: Prisma.UserScalarFieldEnum | Prisma.UserScalarFieldEnum[]\n}\n\n/**\n * User create\n */\nexport type UserCreateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to create a User.\n   */\n  data: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n}\n\n/**\n * User createMany\n */\nexport type UserCreateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User createManyAndReturn\n */\nexport type UserCreateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectCreateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to create many Users.\n   */\n  data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]\n}\n\n/**\n * User update\n */\nexport type UserUpdateArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data needed to update a User.\n   */\n  data: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n  /**\n   * Choose, which User to update.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User updateMany\n */\nexport type UserUpdateManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User updateManyAndReturn\n */\nexport type UserUpdateManyAndReturnArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelectUpdateManyAndReturn<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The data used to update Users.\n   */\n  data: Prisma.XOR<\n    Prisma.UserUpdateManyMutationInput,\n    Prisma.UserUncheckedUpdateManyInput\n  >\n  /**\n   * Filter which Users to update\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to update.\n   */\n  limit?: number\n}\n\n/**\n * User upsert\n */\nexport type UserUpsertArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * The filter to search for the User to update in case it exists.\n   */\n  where: Prisma.UserWhereUniqueInput\n  /**\n   * In case the User found by the `where` argument doesn't exist, create a new User with this data.\n   */\n  create: Prisma.XOR<Prisma.UserCreateInput, Prisma.UserUncheckedCreateInput>\n  /**\n   * In case the User was found with the provided `where` argument, update it with this data.\n   */\n  update: Prisma.XOR<Prisma.UserUpdateInput, Prisma.UserUncheckedUpdateInput>\n}\n\n/**\n * User delete\n */\nexport type UserDeleteArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n  /**\n   * Filter which User to delete.\n   */\n  where: Prisma.UserWhereUniqueInput\n}\n\n/**\n * User deleteMany\n */\nexport type UserDeleteManyArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Filter which Users to delete\n   */\n  where?: Prisma.UserWhereInput\n  /**\n   * Limit how many Users to delete.\n   */\n  limit?: number\n}\n\n/**\n * User without action\n */\nexport type UserDefaultArgs<\n  ExtArgs extends runtime.Types.Extensions.InternalArgs =\n    runtime.Types.Extensions.DefaultArgs,\n> = {\n  /**\n   * Select specific fields to fetch from the User\n   */\n  select?: Prisma.UserSelect<ExtArgs> | null\n  /**\n   * Omit specific fields from the User\n   */\n  omit?: Prisma.UserOmit<ExtArgs> | null\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/prisma-generated/models.ts",
    "content": "/* !!! This is code generated by Prisma. Do not edit directly. !!! */\n/* eslint-disable */\n// biome-ignore-all lint: generated file\n// @ts-nocheck\n/*\n * This is a barrel export file for all models and their related types.\n *\n * 🟢 You can import this file directly.\n */\nexport type * from './models/User'\nexport type * from './commonInputTypes'\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SignupRouteImport } from './routes/signup'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteRouteImport } from './routes/_authed/posts.route'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst SignupRoute = SignupRouteImport.update({\n  id: '/signup',\n  path: '/signup',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRouteRoute = AuthedPostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRouteRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts': typeof AuthedPostsRouteRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/_authed/posts': typeof AuthedPostsRouteRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  LogoutRoute: typeof LogoutRoute\n  SignupRoute: typeof SignupRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/signup': {\n      id: '/signup'\n      path: '/signup'\n      fullPath: '/signup'\n      preLoaderRoute: typeof SignupRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRouteRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRouteRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteRouteChildren: AuthedPostsRouteRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteRouteWithChildren =\n  AuthedPostsRouteRoute._addFileChildren(AuthedPostsRouteRouteChildren)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRouteRoute: typeof AuthedPostsRouteRouteWithChildren\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRouteRoute: AuthedPostsRouteRouteWithChildren,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n  LoginRoute: LoginRoute,\n  LogoutRoute: LogoutRoute,\n  SignupRoute: SignupRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'\nimport { NotFound } from '~/components/NotFound.js'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo.js'\nimport { useAppSession } from '~/utils/session.js'\n\nconst fetchUser = createServerFn({ method: 'GET' }).handler(async () => {\n  // We need to auth on the server so we have access to secure cookies\n  const session = await useAppSession()\n\n  if (!session.data.userEmail) {\n    return null\n  }\n\n  return {\n    email: session.data.userEmail,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const user = await fetchUser()\n\n    return {\n      user,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  const routeContext = Route.useRouteContext()\n\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div class=\"ml-auto\">\n            {routeContext().user ? (\n              <>\n                <span class=\"mr-2\">{routeContext().user?.email}</span>\n                <Link to=\"/logout\">Logout</Link>\n              </>\n            ) : (\n              <Link to=\"/login\">Login</Link>\n            )}\n          </div>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport { NotFound } from '~/components/NotFound.js'\nimport { fetchPost } from '~/utils/posts.js'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/_authed/posts.route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '~/utils/posts.js'\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/_authed.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { Login } from '~/components/Login'\nimport { useAppSession } from '~/utils/session'\n\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator((d: { email: string; password: string }) => d)\n  .handler(async ({ data }) => {\n    // Find the user\n    const user = await prismaClient.user.findUnique({\n      where: {\n        email: data.email,\n      },\n    })\n\n    // Check if the user exists\n    if (!user) {\n      return {\n        error: true,\n        userNotFound: true,\n        message: 'User not found',\n      }\n    }\n\n    // Check if the password is correct\n    const hashedPassword = await hashPassword(data.password)\n\n    if (user.password !== hashedPassword) {\n      return {\n        error: true,\n        message: 'Incorrect password',\n      }\n    }\n\n    // Create a session\n    const session = await useAppSession()\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n  })\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return <Login />\n    }\n\n    throw error\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Login } from '~/components/Login'\n\nexport const Route = createFileRoute('/login')({\n  component: LoginComp,\n})\n\nfunction LoginComp() {\n  return <Login />\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/logout.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { useAppSession } from '~/utils/session'\n\nconst logoutFn = createServerFn().handler(async () => {\n  const session = await useAppSession()\n\n  session.clear()\n\n  throw redirect({\n    href: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  preload: false,\n  loader: () => logoutFn(),\n})\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/routes/signup.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn, useServerFn } from '@tanstack/solid-start'\nimport { hashPassword, prismaClient } from '~/utils/prisma'\nimport { useMutation } from '~/hooks/useMutation'\nimport { Auth } from '~/components/Auth'\nimport { useAppSession } from '~/utils/session'\n\nexport const signupFn = createServerFn({ method: 'POST' })\n  .inputValidator(\n    (d: { email: string; password: string; redirectUrl?: string }) => d,\n  )\n  .handler(async ({ data }) => {\n    // Check if the user already exists\n    const found = await prismaClient.user.findUnique({\n      where: {\n        email: data.email,\n      },\n    })\n\n    // Encrypt the password using Sha256 into plaintext\n    const password = await hashPassword(data.password)\n\n    // Create a session\n    const session = await useAppSession()\n\n    if (found) {\n      if (found.password !== password) {\n        return {\n          error: true,\n          userExists: true,\n          message: 'User already exists',\n        }\n      }\n\n      // Store the user's email in the session\n      await session.update({\n        userEmail: found.email,\n      })\n\n      // Redirect to the prev page stored in the \"redirect\" search param\n      throw redirect({\n        href: data.redirectUrl || '/',\n      })\n    }\n\n    // Create the user\n    const user = await prismaClient.user.create({\n      data: {\n        email: data.email,\n        password,\n      },\n    })\n\n    // Store the user's email in the session\n    await session.update({\n      userEmail: user.email,\n    })\n\n    // Redirect to the prev page stored in the \"redirect\" search param\n    throw redirect({\n      href: data.redirectUrl || '/',\n    })\n  })\n\nexport const Route = createFileRoute('/signup')({\n  component: SignupComp,\n})\n\nfunction SignupComp() {\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Sign Up\"\n      status={signupMutation.status()}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as any as HTMLFormElement)\n\n        signupMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        signupMutation.data()?.error ? (\n          <>\n            <div class=\"text-red-400\">{signupMutation.data()?.message}</div>\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((postId: string) => postId)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/utils/prisma.ts",
    "content": "import crypto from 'node:crypto'\nimport { PrismaLibSql } from '@prisma/adapter-libsql'\nimport { PrismaClient } from '../prisma-generated/client'\n\nconst adapter = new PrismaLibSql({\n  url: process.env.DATABASE_URL || 'file:./prisma/dev.db',\n})\nexport const prismaClient = new PrismaClient({ adapter })\n\nexport function hashPassword(password: string) {\n  return new Promise<string>((resolve, reject) => {\n    crypto.pbkdf2(password, 'salt', 100000, 64, 'sha256', (err, derivedKey) => {\n      if (err) {\n        reject(err)\n      } else {\n        resolve(derivedKey.toString('hex'))\n      }\n    })\n  })\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/src/utils/session.ts",
    "content": "// src/services/session.server.ts\nimport { useSession } from '@tanstack/solid-start/server'\nimport type { User } from '@prisma/client'\n\ntype SessionUser = {\n  userEmail: User['email']\n}\n\nexport function useAppSession() {\n  return useSession<SessionUser>({\n    password: 'ChangeThisBeforeShippingToProdOrYouWillBeFired',\n  })\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-auth/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/.gitignore",
    "content": "node_modules\ndist\n.env\n*.local\n.DS_Store\n.tanstack"
  },
  {
    "path": "examples/solid/start-basic-authjs/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-basic-authjs\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@auth/core\": \"^0.41.1\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"start-authjs\": \"^1.0.0\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ProtectedRouteImport } from './routes/protected'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'\n\nconst ProtectedRoute = ProtectedRouteImport.update({\n  id: '/protected',\n  path: '/protected',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({\n  id: '/api/auth/$',\n  path: '/api/auth/$',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/protected': typeof ProtectedRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/protected': typeof ProtectedRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/protected': typeof ProtectedRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/login' | '/protected' | '/api/auth/$'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/protected' | '/api/auth/$'\n  id: '__root__' | '/' | '/login' | '/protected' | '/api/auth/$'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LoginRoute: typeof LoginRoute\n  ProtectedRoute: typeof ProtectedRoute\n  ApiAuthSplatRoute: typeof ApiAuthSplatRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/protected': {\n      id: '/protected'\n      path: '/protected'\n      fullPath: '/protected'\n      preLoaderRoute: typeof ProtectedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/auth/$': {\n      id: '/api/auth/$'\n      path: '/api/auth/$'\n      fullPath: '/api/auth/$'\n      preLoaderRoute: typeof ApiAuthSplatRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LoginRoute: LoginRoute,\n  ProtectedRoute: ProtectedRoute,\n  ApiAuthSplatRoute: ApiAuthSplatRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport type { AuthSession } from 'start-authjs'\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { getRequest } from '@tanstack/solid-start/server'\nimport { HydrationScript } from 'solid-js/web'\nimport { Show } from 'solid-js'\nimport { getSession } from 'start-authjs'\nimport type { JSX } from 'solid-js'\nimport { authConfig } from '~/utils/auth'\nimport appCss from '~/styles/app.css?url'\n\ninterface RouterContext {\n  session: AuthSession | null\n}\n\nconst fetchSession = createServerFn({ method: 'GET' }).handler(async () => {\n  const request = getRequest()\n  const session = await getSession(request, authConfig)\n  return session\n})\n\nexport const Route = createRootRouteWithContext<RouterContext>()({\n  beforeLoad: async () => {\n    const session = await fetchSession()\n    return {\n      session,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Auth Example',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <NavBar />\n        <main class=\"p-4\">{children}</main>\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n\nfunction NavBar() {\n  const routeContext = Route.useRouteContext()\n\n  return (\n    <nav class=\"p-4 flex gap-4 items-center bg-gray-100\">\n      <Link\n        to=\"/\"\n        activeProps={{ class: 'font-bold' }}\n        activeOptions={{ exact: true }}\n      >\n        Home\n      </Link>\n      <Link to=\"/protected\" activeProps={{ class: 'font-bold' }}>\n        Protected\n      </Link>\n      <div class=\"ml-auto flex items-center gap-4\">\n        <Show\n          when={routeContext().session}\n          fallback={\n            <Link\n              to=\"/login\"\n              class=\"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600\"\n            >\n              Sign In\n            </Link>\n          }\n        >\n          <span class=\"text-gray-600\">\n            {routeContext().session?.user?.name ||\n              routeContext().session?.user?.email}\n          </span>\n          <a\n            href=\"/api/auth/signout\"\n            class=\"px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600\"\n          >\n            Sign Out\n          </a>\n        </Show>\n      </div>\n    </nav>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/routes/api/auth/$.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { StartAuthJS } from 'start-authjs'\nimport { authConfig } from '~/utils/auth'\n\n/**\n * Auth.js API route handler\n * Handles all auth routes: /api/auth/*\n */\nconst { GET, POST } = StartAuthJS(authConfig)\n\nexport const Route = createFileRoute('/api/auth/$')({\n  server: {\n    handlers: {\n      GET: ({ request }) => GET({ request, response: new Response() }),\n      POST: ({ request }) => POST({ request, response: new Response() }),\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Show } from 'solid-js'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  const routeContext = Route.useRouteContext()\n\n  return (\n    <div class=\"max-w-2xl mx-auto\">\n      <h1 class=\"text-3xl font-bold mb-4\">TanStack Start Auth.js Example</h1>\n      <p class=\"text-gray-600 mb-8\">\n        This example demonstrates auth.js integration with TanStack Start using\n        Auth0 OAuth.\n      </p>\n\n      <div class=\"bg-gray-50 rounded-lg p-6\">\n        <h2 class=\"text-xl font-semibold mb-4\">Auth Status</h2>\n\n        <Show\n          when={routeContext().session}\n          fallback={\n            <p class=\"text-gray-500\">\n              You are not signed in. Click \"Sign In\" in the navigation bar to\n              authenticate with Auth0.\n            </p>\n          }\n        >\n          {(session) => (\n            <div class=\"space-y-2\">\n              <p class=\"text-green-600 font-medium\">Authenticated</p>\n              <Show when={session().user?.image}>\n                {(image) => (\n                  <img\n                    src={image()}\n                    alt=\"Avatar\"\n                    class=\"w-16 h-16 rounded-full\"\n                  />\n                )}\n              </Show>\n              <p>\n                <strong>Name:</strong> {session().user?.name ?? 'N/A'}\n              </p>\n              <p>\n                <strong>Email:</strong> {session().user?.email ?? 'N/A'}\n              </p>\n            </div>\n          )}\n        </Show>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/routes/login.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createResource, Suspense } from 'solid-js'\n\nexport const Route = createFileRoute('/login')({\n  beforeLoad: ({ context }) => {\n    // Redirect if already authenticated\n    if (context.session) {\n      throw redirect({ to: '/' })\n    }\n  },\n  component: Login,\n})\n\nasync function getCsrfToken(): Promise<string> {\n  const res = await fetch('/api/auth/csrf')\n  const data = await res.json()\n  return data.csrfToken\n}\n\nfunction Login() {\n  const [csrfToken] = createResource(getCsrfToken)\n\n  return (\n    <div class=\"max-w-md mx-auto mt-10\">\n      <h1 class=\"text-2xl font-bold mb-6 text-center\">Sign In</h1>\n\n      <div class=\"space-y-4\">\n        <Suspense fallback={<div class=\"text-center\">Loading...</div>}>\n          <form action=\"/api/auth/signin/auth0\" method=\"POST\">\n            <input type=\"hidden\" name=\"csrfToken\" value={csrfToken() ?? ''} />\n            <input type=\"hidden\" name=\"callbackUrl\" value=\"/\" />\n            <button\n              type=\"submit\"\n              class=\"w-full flex items-center justify-center gap-3 px-4 py-3 bg-orange-500 text-white rounded-lg hover:bg-orange-600 transition-colors cursor-pointer\"\n            >\n              <svg class=\"w-5 h-5\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n                <path d=\"M21.98 7.448L19.62 0H4.347L2.02 7.448c-1.352 4.312.03 9.206 3.815 12.015L12.007 24l6.157-4.552c3.755-2.81 5.182-7.688 3.815-12.015l-6.16 4.58 2.343 7.45-6.157-4.597-6.158 4.58 2.358-7.433-6.188-4.55 7.63-.045L12.008 0l2.356 7.404 7.615.044z\" />\n              </svg>\n              Continue with Auth0\n            </button>\n          </form>\n        </Suspense>\n\n        <p class=\"text-center text-sm text-gray-500 mt-4\">\n          You'll be redirected to Auth0 to complete the sign-in process.\n        </p>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/routes/protected.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { Show } from 'solid-js'\n\nexport const Route = createFileRoute('/protected')({\n  beforeLoad: ({ context }) => {\n    if (!context.session) {\n      throw redirect({ to: '/login' })\n    }\n  },\n  component: Protected,\n})\n\nfunction Protected() {\n  const routeContext = Route.useRouteContext()\n\n  return (\n    <div class=\"max-w-2xl mx-auto\">\n      <h1 class=\"text-3xl font-bold mb-4\">Protected Page</h1>\n      <p class=\"text-gray-600 mb-8\">\n        This page is only accessible to authenticated users.\n      </p>\n\n      <div class=\"bg-green-50 border border-green-200 rounded-lg p-6\">\n        <h2 class=\"text-xl font-semibold mb-4 text-green-800\">\n          Welcome, {routeContext().session?.user?.name ?? 'User'}!\n        </h2>\n\n        <Show when={routeContext().session?.user}>\n          {(user) => (\n            <div class=\"space-y-2 text-green-700\">\n              <p>\n                <strong>Email:</strong> {user().email ?? 'N/A'}\n              </p>\n              <Show when={user().image}>\n                {(image) => (\n                  <div>\n                    <strong>Avatar:</strong>\n                    <img\n                      src={image()}\n                      alt=\"User avatar\"\n                      class=\"w-20 h-20 rounded-full mt-2\"\n                    />\n                  </div>\n                )}\n              </Show>\n            </div>\n          )}\n        </Show>\n      </div>\n\n      <div class=\"mt-8 p-4 bg-gray-100 rounded-lg\">\n        <h3 class=\"font-semibold mb-2\">Session Data (Debug)</h3>\n        <pre class=\"text-xs overflow-auto bg-gray-800 text-green-400 p-4 rounded\">\n          {JSON.stringify(routeContext().session, null, 2)}\n        </pre>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/src/utils/auth.ts",
    "content": "import Auth0 from '@auth/core/providers/auth0'\nimport { setCookie } from '@tanstack/solid-start/server'\nimport type { Profile } from '@auth/core/types'\nimport type { StartAuthJSConfig } from 'start-authjs'\n\ndeclare module '@auth/core/types' {\n  export interface Session {\n    user: {\n      name: string\n      email: string\n      sub: string\n      email_verified: boolean\n    } & Profile\n    account: {\n      access_token: string\n    }\n    expires: Date\n  }\n}\n\n/**\n * Auth.js configuration for TanStack Start with Auth0\n */\nexport const authConfig: StartAuthJSConfig = {\n  // basePath is derived from AUTH_URL env var\n  secret: process.env.AUTH_SECRET,\n  providers: [\n    Auth0({\n      // Auth.js auto-reads AUTH_AUTH0_ID, AUTH_AUTH0_SECRET, AUTH_AUTH0_ISSUER from env\n      authorization: {\n        params: {\n          scope: 'email email_verified openid profile',\n          prompt: 'login',\n        },\n      },\n      async profile(profile, tokens) {\n        await setCookie(\n          'auth0Token',\n          encodeURIComponent(tokens.access_token ?? ''),\n        )\n        await setCookie(\n          'auth0User',\n          encodeURIComponent(JSON.stringify(profile)),\n        )\n\n        return profile\n      },\n    }),\n  ],\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"noEmit\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    }\n  },\n  \"include\": [\"src\", \"env.d.ts\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "examples/solid/start-basic-authjs/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 10000,\n    strictPort: true,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/.gitignore",
    "content": "node_modules\n.DS_Store\n.cache\n.env\ndist\n.wrangler\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/.prettierignore",
    "content": "**/public\npnpm-lock.yaml\nrouteTree.gen.ts\nworker-configuration.d.ts\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/README.md",
    "content": "# Start Basic Cloudflare\n\n## Getting Started\n\n### Install the dependencies\n\n```bash\npnpm i\n```\n\n### Start the development server\n\n```bash\npnpm dev\n```\n\n### Build for Production\n\n```bash\npnpm build\n```\n\n### Preview the production build\n\n```bash\npnpm preview\n```\n\n### Deploy to Cloudflare\n\n```sh\npnpm run deploy\n```\n\n## Accessing bindings\n\nYou can access Cloudflare bindings in server functions by using importable `env`:\n\n```ts\nimport { env } from 'cloudflare:workers'\n```\n\nSee `src/routes/index.tsx` for an example.\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-basic-cloudflare\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"deploy\": \"npm run build && wrangler deploy\",\n    \"cf-typegen\": \"wrangler types\",\n    \"postinstall\": \"npm run cf-typegen\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@cloudflare/vite-plugin\": \"^1.29.0\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"wrangler\": \"^4.74.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/components/PostError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/components/UserError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as CustomScriptDotjsRouteImport } from './routes/customScript[.]js'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CustomScriptDotjsRoute = CustomScriptDotjsRouteImport.update({\n  id: '/customScript.js',\n  path: '/customScript.js',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/_pathlessLayout/_nested-layout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/api/users/$userId'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  CustomScriptDotjsRoute: typeof CustomScriptDotjsRoute\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/customScript.js': {\n      id: '/customScript.js'\n      path: '/customScript.js'\n      fullPath: '/customScript.js'\n      preLoaderRoute: typeof CustomScriptDotjsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  CustomScriptDotjsRoute: CustomScriptDotjsRoute,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n    scripts: [\n      {\n        src: '/customScript.js',\n        type: 'text/javascript',\n      },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(\n            'https://jsonplaceholder.typicode.com/users/' + params.userId,\n          )\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n\n          // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n          const user = (await res.json()) as User\n\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { getRequestHeaders } from '@tanstack/solid-start/server'\nimport { createMiddleware } from '@tanstack/solid-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: /users')\n  console.info('Request Headers:', getRequestHeaders())\n  const result = await next()\n  result.response.headers.set('x-users', 'true')\n  console.info('Out: /users')\n  return result\n})\n\nconst testParentMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: testParentMiddleware')\n  const result = await next()\n  result.response.headers.set('x-test-parent', 'true')\n  console.info('Out: testParentMiddleware')\n  return result\n})\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('GET /api/users @', request.url)\n        console.info('Fetching users... @', request.url)\n        const res = await fetch('https://jsonplaceholder.typicode.com/users')\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n\n        // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n        const data = (await res.json()) as Array<User>\n\n        const list = data.slice(0, 10)\n\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/customScript[.]js.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/customScript.js')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response('console.log(\"Hello from customScript.js!\")', {\n          headers: {\n            'Content-Type': 'application/javascript',\n          },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { Suspense, createSignal } from 'solid-js'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(({ data: name }) => {\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: name }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: 'Tanner Linsley' }),\n      person: await personServerFn({ data: 'John Doe' }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {loaderData().person.name} - {loaderData().person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={loaderData().deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={loaderData().deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount(count() + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { env } from 'cloudflare:workers'\n\nexport const Route = createFileRoute('/')({\n  loader: () => getData(),\n  component: Home,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    message: `Running in ${navigator.userAgent}`,\n    myVar: env.MY_VAR,\n  }\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <p>{data().message}</p>\n      <p>{data().myVar}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: String(post().id),\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: String(post.id),\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) =>\n    fetchPost({\n      data: postId,\n    }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/redirect.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { NotFound } from 'src/components/NotFound'\nimport { UserErrorComponent } from 'src/components/UserError'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    try {\n      const res = await fetch('/api/users/' + userId)\n      if (!res.ok) {\n        throw new Error('Unexpected status code')\n      }\n\n      const data = await res.json()\n\n      return data as User\n    } catch {\n      throw new Error('Failed to fetch user')\n    }\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user().name}</h4>\n      <div class=\"text-sm\">{user().email}</div>\n      <div>\n        <a\n          href={`/api/users/${user().id}`}\n          class=\"text-blue-800 hover:text-blue-600 underline\"\n        >\n          View as JSON\n        </a>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div>\n      Select a user or{' '}\n      <a href=\"/api/users\" class=\"text-blue-800 hover:text-blue-600 underline\">\n        view as JSON\n      </a>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const res = await fetch('/api/users')\n\n    if (!res.ok) {\n      throw new Error('Unexpected status code')\n    }\n\n    const data = await res.json()\n\n    return data as Array<User>\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users(),\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/utils/loggingMiddleware.tsx",
    "content": "import { createMiddleware } from '@tanstack/solid-start'\n\nconst preLogMiddleware = createMiddleware({ type: 'function' })\n  .client(async (ctx) => {\n    const clientTime = new Date()\n\n    return ctx.next({\n      context: {\n        clientTime,\n      },\n      sendContext: {\n        clientTime,\n      },\n    })\n  })\n  .server(async (ctx) => {\n    const serverTime = new Date()\n\n    return ctx.next({\n      sendContext: {\n        serverTime,\n        durationToServer:\n          serverTime.getTime() - ctx.context.clientTime.getTime(),\n      },\n    })\n  })\n\nexport const logMiddleware = createMiddleware({ type: 'function' })\n  .middleware([preLogMiddleware])\n  .client(async (ctx) => {\n    const res = await ctx.next()\n\n    const now = new Date()\n    console.log('Client Req/Res:', {\n      duration: now.getTime() - res.context.clientTime.getTime(),\n      durationToServer: res.context.durationToServer,\n      durationFromServer: now.getTime() - res.context.serverTime.getTime(),\n    })\n\n    return res\n  })\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport type PostType = {\n  id: number\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'POST' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const res = await fetch(\n      `https://jsonplaceholder.typicode.com/posts/${data}`,\n    )\n    if (!res.ok) {\n      if (res.status === 404) {\n        throw notFound()\n      }\n\n      throw new Error('Failed to fetch post')\n    }\n\n    const post = await res.json()\n\n    return post as PostType\n  })\n\nexport const fetchPosts = createServerFn().handler(async () => {\n  console.info('Fetching posts...')\n  const res = await fetch('https://jsonplaceholder.typicode.com/posts')\n  if (!res.ok) {\n    throw new Error('Failed to fetch posts')\n  }\n\n  const posts = await res.json()\n\n  return (posts as Array<PostType>).slice(0, 10)\n})\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { cloudflare } from '@cloudflare/vite-plugin'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tailwindcss(),\n    cloudflare({ viteEnvironment: { name: 'ssr' } }),\n    tanstackStart(),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/worker-configuration.d.ts",
    "content": "/* eslint-disable */\n// Generated by Wrangler by running `wrangler types` (hash: b11df627d8b3c51b1bf3230a546b0f20)\n// Runtime types generated with workerd@1.20260317.1 2025-09-24 nodejs_compat\ndeclare namespace Cloudflare {\n\tinterface Env {\n\t\tMY_VAR: \"Hello from Cloudflare\";\n\t}\n}\ninterface Env extends Cloudflare.Env {}\ntype StringifyValues<EnvType extends Record<string, unknown>> = {\n\t[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;\n};\ndeclare namespace NodeJS {\n\tinterface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, \"MY_VAR\">> {}\n}\n\n// Begin runtime types\n/*! *****************************************************************************\nCopyright (c) Cloudflare. All rights reserved.\nCopyright (c) Microsoft Corporation. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n/* eslint-disable */\n// noinspection JSUnusedGlobalSymbols\ndeclare var onmessage: never;\n/**\n * The **`DOMException`** interface represents an abnormal event (called an **exception**) that occurs as a result of calling a method or accessing a property of a web API.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException)\n */\ndeclare class DOMException extends Error {\n    constructor(message?: string, name?: string);\n    /**\n     * The **`message`** read-only property of the a message or description associated with the given error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message)\n     */\n    readonly message: string;\n    /**\n     * The **`name`** read-only property of the one of the strings associated with an error name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name)\n     */\n    readonly name: string;\n    /**\n     * The **`code`** read-only property of the DOMException interface returns one of the legacy error code constants, or `0` if none match.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code)\n     */\n    readonly code: number;\n    static readonly INDEX_SIZE_ERR: number;\n    static readonly DOMSTRING_SIZE_ERR: number;\n    static readonly HIERARCHY_REQUEST_ERR: number;\n    static readonly WRONG_DOCUMENT_ERR: number;\n    static readonly INVALID_CHARACTER_ERR: number;\n    static readonly NO_DATA_ALLOWED_ERR: number;\n    static readonly NO_MODIFICATION_ALLOWED_ERR: number;\n    static readonly NOT_FOUND_ERR: number;\n    static readonly NOT_SUPPORTED_ERR: number;\n    static readonly INUSE_ATTRIBUTE_ERR: number;\n    static readonly INVALID_STATE_ERR: number;\n    static readonly SYNTAX_ERR: number;\n    static readonly INVALID_MODIFICATION_ERR: number;\n    static readonly NAMESPACE_ERR: number;\n    static readonly INVALID_ACCESS_ERR: number;\n    static readonly VALIDATION_ERR: number;\n    static readonly TYPE_MISMATCH_ERR: number;\n    static readonly SECURITY_ERR: number;\n    static readonly NETWORK_ERR: number;\n    static readonly ABORT_ERR: number;\n    static readonly URL_MISMATCH_ERR: number;\n    static readonly QUOTA_EXCEEDED_ERR: number;\n    static readonly TIMEOUT_ERR: number;\n    static readonly INVALID_NODE_TYPE_ERR: number;\n    static readonly DATA_CLONE_ERR: number;\n    get stack(): any;\n    set stack(value: any);\n}\ntype WorkerGlobalScopeEventMap = {\n    fetch: FetchEvent;\n    scheduled: ScheduledEvent;\n    queue: QueueEvent;\n    unhandledrejection: PromiseRejectionEvent;\n    rejectionhandled: PromiseRejectionEvent;\n};\ndeclare abstract class WorkerGlobalScope extends EventTarget<WorkerGlobalScopeEventMap> {\n    EventTarget: typeof EventTarget;\n}\n/* The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). *\n * The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console)\n */\ninterface Console {\n    \"assert\"(condition?: boolean, ...data: any[]): void;\n    /**\n     * The **`console.clear()`** static method clears the console if possible.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear_static)\n     */\n    clear(): void;\n    /**\n     * The **`console.count()`** static method logs the number of times that this particular call to `count()` has been called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count_static)\n     */\n    count(label?: string): void;\n    /**\n     * The **`console.countReset()`** static method resets counter used with console/count_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset_static)\n     */\n    countReset(label?: string): void;\n    /**\n     * The **`console.debug()`** static method outputs a message to the console at the 'debug' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static)\n     */\n    debug(...data: any[]): void;\n    /**\n     * The **`console.dir()`** static method displays a list of the properties of the specified JavaScript object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir_static)\n     */\n    dir(item?: any, options?: any): void;\n    /**\n     * The **`console.dirxml()`** static method displays an interactive tree of the descendant elements of the specified XML/HTML element.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml_static)\n     */\n    dirxml(...data: any[]): void;\n    /**\n     * The **`console.error()`** static method outputs a message to the console at the 'error' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static)\n     */\n    error(...data: any[]): void;\n    /**\n     * The **`console.group()`** static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group_static)\n     */\n    group(...data: any[]): void;\n    /**\n     * The **`console.groupCollapsed()`** static method creates a new inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed_static)\n     */\n    groupCollapsed(...data: any[]): void;\n    /**\n     * The **`console.groupEnd()`** static method exits the current inline group in the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd_static)\n     */\n    groupEnd(): void;\n    /**\n     * The **`console.info()`** static method outputs a message to the console at the 'info' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static)\n     */\n    info(...data: any[]): void;\n    /**\n     * The **`console.log()`** static method outputs a message to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static)\n     */\n    log(...data: any[]): void;\n    /**\n     * The **`console.table()`** static method displays tabular data as a table.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table_static)\n     */\n    table(tabularData?: any, properties?: string[]): void;\n    /**\n     * The **`console.time()`** static method starts a timer you can use to track how long an operation takes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time_static)\n     */\n    time(label?: string): void;\n    /**\n     * The **`console.timeEnd()`** static method stops a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd_static)\n     */\n    timeEnd(label?: string): void;\n    /**\n     * The **`console.timeLog()`** static method logs the current value of a timer that was previously started by calling console/time_static.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog_static)\n     */\n    timeLog(label?: string, ...data: any[]): void;\n    timeStamp(label?: string): void;\n    /**\n     * The **`console.trace()`** static method outputs a stack trace to the console.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace_static)\n     */\n    trace(...data: any[]): void;\n    /**\n     * The **`console.warn()`** static method outputs a warning message to the console at the 'warning' log level.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static)\n     */\n    warn(...data: any[]): void;\n}\ndeclare const console: Console;\ntype BufferSource = ArrayBufferView | ArrayBuffer;\ntype TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;\ndeclare namespace WebAssembly {\n    class CompileError extends Error {\n        constructor(message?: string);\n    }\n    class RuntimeError extends Error {\n        constructor(message?: string);\n    }\n    type ValueType = \"anyfunc\" | \"externref\" | \"f32\" | \"f64\" | \"i32\" | \"i64\" | \"v128\";\n    interface GlobalDescriptor {\n        value: ValueType;\n        mutable?: boolean;\n    }\n    class Global {\n        constructor(descriptor: GlobalDescriptor, value?: any);\n        value: any;\n        valueOf(): any;\n    }\n    type ImportValue = ExportValue | number;\n    type ModuleImports = Record<string, ImportValue>;\n    type Imports = Record<string, ModuleImports>;\n    type ExportValue = Function | Global | Memory | Table;\n    type Exports = Record<string, ExportValue>;\n    class Instance {\n        constructor(module: Module, imports?: Imports);\n        readonly exports: Exports;\n    }\n    interface MemoryDescriptor {\n        initial: number;\n        maximum?: number;\n        shared?: boolean;\n    }\n    class Memory {\n        constructor(descriptor: MemoryDescriptor);\n        readonly buffer: ArrayBuffer;\n        grow(delta: number): number;\n    }\n    type ImportExportKind = \"function\" | \"global\" | \"memory\" | \"table\";\n    interface ModuleExportDescriptor {\n        kind: ImportExportKind;\n        name: string;\n    }\n    interface ModuleImportDescriptor {\n        kind: ImportExportKind;\n        module: string;\n        name: string;\n    }\n    abstract class Module {\n        static customSections(module: Module, sectionName: string): ArrayBuffer[];\n        static exports(module: Module): ModuleExportDescriptor[];\n        static imports(module: Module): ModuleImportDescriptor[];\n    }\n    type TableKind = \"anyfunc\" | \"externref\";\n    interface TableDescriptor {\n        element: TableKind;\n        initial: number;\n        maximum?: number;\n    }\n    class Table {\n        constructor(descriptor: TableDescriptor, value?: any);\n        readonly length: number;\n        get(index: number): any;\n        grow(delta: number, value?: any): number;\n        set(index: number, value?: any): void;\n    }\n    function instantiate(module: Module, imports?: Imports): Promise<Instance>;\n    function validate(bytes: BufferSource): boolean;\n}\n/**\n * The **`ServiceWorkerGlobalScope`** interface of the Service Worker API represents the global execution context of a service worker.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope)\n */\ninterface ServiceWorkerGlobalScope extends WorkerGlobalScope {\n    DOMException: typeof DOMException;\n    WorkerGlobalScope: typeof WorkerGlobalScope;\n    btoa(data: string): string;\n    atob(data: string): string;\n    setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n    setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearTimeout(timeoutId: number | null): void;\n    setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n    setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n    clearInterval(timeoutId: number | null): void;\n    queueMicrotask(task: Function): void;\n    structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n    reportError(error: any): void;\n    fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\n    self: ServiceWorkerGlobalScope;\n    crypto: Crypto;\n    caches: CacheStorage;\n    scheduler: Scheduler;\n    performance: Performance;\n    Cloudflare: Cloudflare;\n    readonly origin: string;\n    Event: typeof Event;\n    ExtendableEvent: typeof ExtendableEvent;\n    CustomEvent: typeof CustomEvent;\n    PromiseRejectionEvent: typeof PromiseRejectionEvent;\n    FetchEvent: typeof FetchEvent;\n    TailEvent: typeof TailEvent;\n    TraceEvent: typeof TailEvent;\n    ScheduledEvent: typeof ScheduledEvent;\n    MessageEvent: typeof MessageEvent;\n    CloseEvent: typeof CloseEvent;\n    ReadableStreamDefaultReader: typeof ReadableStreamDefaultReader;\n    ReadableStreamBYOBReader: typeof ReadableStreamBYOBReader;\n    ReadableStream: typeof ReadableStream;\n    WritableStream: typeof WritableStream;\n    WritableStreamDefaultWriter: typeof WritableStreamDefaultWriter;\n    TransformStream: typeof TransformStream;\n    ByteLengthQueuingStrategy: typeof ByteLengthQueuingStrategy;\n    CountQueuingStrategy: typeof CountQueuingStrategy;\n    ErrorEvent: typeof ErrorEvent;\n    MessageChannel: typeof MessageChannel;\n    MessagePort: typeof MessagePort;\n    EventSource: typeof EventSource;\n    ReadableStreamBYOBRequest: typeof ReadableStreamBYOBRequest;\n    ReadableStreamDefaultController: typeof ReadableStreamDefaultController;\n    ReadableByteStreamController: typeof ReadableByteStreamController;\n    WritableStreamDefaultController: typeof WritableStreamDefaultController;\n    TransformStreamDefaultController: typeof TransformStreamDefaultController;\n    CompressionStream: typeof CompressionStream;\n    DecompressionStream: typeof DecompressionStream;\n    TextEncoderStream: typeof TextEncoderStream;\n    TextDecoderStream: typeof TextDecoderStream;\n    Headers: typeof Headers;\n    Body: typeof Body;\n    Request: typeof Request;\n    Response: typeof Response;\n    WebSocket: typeof WebSocket;\n    WebSocketPair: typeof WebSocketPair;\n    WebSocketRequestResponsePair: typeof WebSocketRequestResponsePair;\n    AbortController: typeof AbortController;\n    AbortSignal: typeof AbortSignal;\n    TextDecoder: typeof TextDecoder;\n    TextEncoder: typeof TextEncoder;\n    navigator: Navigator;\n    Navigator: typeof Navigator;\n    URL: typeof URL;\n    URLSearchParams: typeof URLSearchParams;\n    URLPattern: typeof URLPattern;\n    Blob: typeof Blob;\n    File: typeof File;\n    FormData: typeof FormData;\n    Crypto: typeof Crypto;\n    SubtleCrypto: typeof SubtleCrypto;\n    CryptoKey: typeof CryptoKey;\n    CacheStorage: typeof CacheStorage;\n    Cache: typeof Cache;\n    FixedLengthStream: typeof FixedLengthStream;\n    IdentityTransformStream: typeof IdentityTransformStream;\n    HTMLRewriter: typeof HTMLRewriter;\n}\ndeclare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\ndeclare function removeEventListener<Type extends keyof WorkerGlobalScopeEventMap>(type: Type, handler: EventListenerOrEventListenerObject<WorkerGlobalScopeEventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n/**\n * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n */\ndeclare function dispatchEvent(event: WorkerGlobalScopeEventMap[keyof WorkerGlobalScopeEventMap]): boolean;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/btoa) */\ndeclare function btoa(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/atob) */\ndeclare function atob(data: string): string;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setTimeout) */\ndeclare function setTimeout<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearTimeout) */\ndeclare function clearTimeout(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval(callback: (...args: any[]) => void, msDelay?: number): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/setInterval) */\ndeclare function setInterval<Args extends any[]>(callback: (...args: Args) => void, msDelay?: number, ...args: Args): number;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/clearInterval) */\ndeclare function clearInterval(timeoutId: number | null): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/queueMicrotask) */\ndeclare function queueMicrotask(task: Function): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/structuredClone) */\ndeclare function structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/reportError) */\ndeclare function reportError(error: any): void;\n/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/fetch) */\ndeclare function fetch(input: RequestInfo | URL, init?: RequestInit<RequestInitCfProperties>): Promise<Response>;\ndeclare const self: ServiceWorkerGlobalScope;\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare const crypto: Crypto;\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare const caches: CacheStorage;\ndeclare const scheduler: Scheduler;\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare const performance: Performance;\ndeclare const Cloudflare: Cloudflare;\ndeclare const origin: string;\ndeclare const navigator: Navigator;\ninterface TestController {\n}\ninterface ExecutionContext<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    passThroughOnException(): void;\n    readonly props: Props;\n}\ntype ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;\ntype ExportedHandlerTailHandler<Env = unknown, Props = unknown> = (events: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTraceHandler<Env = unknown, Props = unknown> = (traces: TraceItem[], env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTailStreamHandler<Env = unknown, Props = unknown> = (event: TailStream.TailEvent<TailStream.Onset>, env: Env, ctx: ExecutionContext<Props>) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\ntype ExportedHandlerScheduledHandler<Env = unknown, Props = unknown> = (controller: ScheduledController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerQueueHandler<Env = unknown, Message = unknown, Props = unknown> = (batch: MessageBatch<Message>, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ntype ExportedHandlerTestHandler<Env = unknown, Props = unknown> = (controller: TestController, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ninterface ExportedHandler<Env = unknown, QueueHandlerMessage = unknown, CfHostMetadata = unknown, Props = unknown> {\n    fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata, Props>;\n    tail?: ExportedHandlerTailHandler<Env, Props>;\n    trace?: ExportedHandlerTraceHandler<Env, Props>;\n    tailStream?: ExportedHandlerTailStreamHandler<Env, Props>;\n    scheduled?: ExportedHandlerScheduledHandler<Env, Props>;\n    test?: ExportedHandlerTestHandler<Env, Props>;\n    email?: EmailExportedHandler<Env, Props>;\n    queue?: ExportedHandlerQueueHandler<Env, QueueHandlerMessage, Props>;\n}\ninterface StructuredSerializeOptions {\n    transfer?: any[];\n}\ndeclare abstract class Navigator {\n    sendBeacon(url: string, body?: BodyInit): boolean;\n    readonly userAgent: string;\n    readonly hardwareConcurrency: number;\n    readonly language: string;\n    readonly languages: string[];\n}\ninterface AlarmInvocationInfo {\n    readonly isRetry: boolean;\n    readonly retryCount: number;\n}\ninterface Cloudflare {\n    readonly compatibilityFlags: Record<string, boolean>;\n}\ninterface DurableObject {\n    fetch(request: Request): Response | Promise<Response>;\n    alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n    webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n    webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n    webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n}\ntype DurableObjectStub<T extends Rpc.DurableObjectBranded | undefined = undefined> = Fetcher<T, \"alarm\" | \"webSocketMessage\" | \"webSocketClose\" | \"webSocketError\"> & {\n    readonly id: DurableObjectId;\n    readonly name?: string;\n};\ninterface DurableObjectId {\n    toString(): string;\n    equals(other: DurableObjectId): boolean;\n    readonly name?: string;\n}\ndeclare abstract class DurableObjectNamespace<T extends Rpc.DurableObjectBranded | undefined = undefined> {\n    newUniqueId(options?: DurableObjectNamespaceNewUniqueIdOptions): DurableObjectId;\n    idFromName(name: string): DurableObjectId;\n    idFromString(id: string): DurableObjectId;\n    get(id: DurableObjectId, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    getByName(name: string, options?: DurableObjectNamespaceGetDurableObjectOptions): DurableObjectStub<T>;\n    jurisdiction(jurisdiction: DurableObjectJurisdiction): DurableObjectNamespace<T>;\n}\ntype DurableObjectJurisdiction = \"eu\" | \"fedramp\" | \"fedramp-high\";\ninterface DurableObjectNamespaceNewUniqueIdOptions {\n    jurisdiction?: DurableObjectJurisdiction;\n}\ntype DurableObjectLocationHint = \"wnam\" | \"enam\" | \"sam\" | \"weur\" | \"eeur\" | \"apac\" | \"oc\" | \"afr\" | \"me\";\ntype DurableObjectRoutingMode = \"primary-only\";\ninterface DurableObjectNamespaceGetDurableObjectOptions {\n    locationHint?: DurableObjectLocationHint;\n    routingMode?: DurableObjectRoutingMode;\n}\ninterface DurableObjectClass<_T extends Rpc.DurableObjectBranded | undefined = undefined> {\n}\ninterface DurableObjectState<Props = unknown> {\n    waitUntil(promise: Promise<any>): void;\n    readonly props: Props;\n    readonly id: DurableObjectId;\n    readonly storage: DurableObjectStorage;\n    container?: Container;\n    blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;\n    acceptWebSocket(ws: WebSocket, tags?: string[]): void;\n    getWebSockets(tag?: string): WebSocket[];\n    setWebSocketAutoResponse(maybeReqResp?: WebSocketRequestResponsePair): void;\n    getWebSocketAutoResponse(): WebSocketRequestResponsePair | null;\n    getWebSocketAutoResponseTimestamp(ws: WebSocket): Date | null;\n    setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;\n    getHibernatableWebSocketEventTimeout(): number | null;\n    getTags(ws: WebSocket): string[];\n    abort(reason?: string): void;\n}\ninterface DurableObjectTransaction {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    rollback(): void;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n}\ninterface DurableObjectStorage {\n    get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T | undefined>;\n    get<T = unknown>(keys: string[], options?: DurableObjectGetOptions): Promise<Map<string, T>>;\n    list<T = unknown>(options?: DurableObjectListOptions): Promise<Map<string, T>>;\n    put<T>(key: string, value: T, options?: DurableObjectPutOptions): Promise<void>;\n    put<T>(entries: Record<string, T>, options?: DurableObjectPutOptions): Promise<void>;\n    delete(key: string, options?: DurableObjectPutOptions): Promise<boolean>;\n    delete(keys: string[], options?: DurableObjectPutOptions): Promise<number>;\n    deleteAll(options?: DurableObjectPutOptions): Promise<void>;\n    transaction<T>(closure: (txn: DurableObjectTransaction) => Promise<T>): Promise<T>;\n    getAlarm(options?: DurableObjectGetAlarmOptions): Promise<number | null>;\n    setAlarm(scheduledTime: number | Date, options?: DurableObjectSetAlarmOptions): Promise<void>;\n    deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;\n    sync(): Promise<void>;\n    sql: SqlStorage;\n    kv: SyncKvStorage;\n    transactionSync<T>(closure: () => T): T;\n    getCurrentBookmark(): Promise<string>;\n    getBookmarkForTime(timestamp: number | Date): Promise<string>;\n    onNextSessionRestoreBookmark(bookmark: string): Promise<string>;\n}\ninterface DurableObjectListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetOptions {\n    allowConcurrency?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectGetAlarmOptions {\n    allowConcurrency?: boolean;\n}\ninterface DurableObjectPutOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n    noCache?: boolean;\n}\ninterface DurableObjectSetAlarmOptions {\n    allowConcurrency?: boolean;\n    allowUnconfirmed?: boolean;\n}\ndeclare class WebSocketRequestResponsePair {\n    constructor(request: string, response: string);\n    get request(): string;\n    get response(): string;\n}\ninterface AnalyticsEngineDataset {\n    writeDataPoint(event?: AnalyticsEngineDataPoint): void;\n}\ninterface AnalyticsEngineDataPoint {\n    indexes?: ((ArrayBuffer | string) | null)[];\n    doubles?: number[];\n    blobs?: ((ArrayBuffer | string) | null)[];\n}\n/**\n * The **`Event`** interface represents an event which takes place on an `EventTarget`.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event)\n */\ndeclare class Event {\n    constructor(type: string, init?: EventInit);\n    /**\n     * The **`type`** read-only property of the Event interface returns a string containing the event's type.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type)\n     */\n    get type(): string;\n    /**\n     * The **`eventPhase`** read-only property of the being evaluated.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase)\n     */\n    get eventPhase(): number;\n    /**\n     * The read-only **`composed`** property of the or not the event will propagate across the shadow DOM boundary into the standard DOM.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed)\n     */\n    get composed(): boolean;\n    /**\n     * The **`bubbles`** read-only property of the Event interface indicates whether the event bubbles up through the DOM tree or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles)\n     */\n    get bubbles(): boolean;\n    /**\n     * The **`cancelable`** read-only property of the Event interface indicates whether the event can be canceled, and therefore prevented as if the event never happened.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable)\n     */\n    get cancelable(): boolean;\n    /**\n     * The **`defaultPrevented`** read-only property of the Event interface returns a boolean value indicating whether or not the call to Event.preventDefault() canceled the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented)\n     */\n    get defaultPrevented(): boolean;\n    /**\n     * The Event property **`returnValue`** indicates whether the default action for this event has been prevented or not.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue)\n     */\n    get returnValue(): boolean;\n    /**\n     * The **`currentTarget`** read-only property of the Event interface identifies the element to which the event handler has been attached.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget)\n     */\n    get currentTarget(): EventTarget | undefined;\n    /**\n     * The read-only **`target`** property of the dispatched.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target)\n     */\n    get target(): EventTarget | undefined;\n    /**\n     * The deprecated **`Event.srcElement`** is an alias for the Event.target property.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement)\n     */\n    get srcElement(): EventTarget | undefined;\n    /**\n     * The **`timeStamp`** read-only property of the Event interface returns the time (in milliseconds) at which the event was created.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp)\n     */\n    get timeStamp(): number;\n    /**\n     * The **`isTrusted`** read-only property of the when the event was generated by the user agent (including via user actions and programmatic methods such as HTMLElement.focus()), and `false` when the event was dispatched via The only exception is the `click` event, which initializes the `isTrusted` property to `false` in user agents.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted)\n     */\n    get isTrusted(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    get cancelBubble(): boolean;\n    /**\n     * The **`cancelBubble`** property of the Event interface is deprecated.\n     * @deprecated\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble)\n     */\n    set cancelBubble(value: boolean);\n    /**\n     * The **`stopImmediatePropagation()`** method of the If several listeners are attached to the same element for the same event type, they are called in the order in which they were added.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)\n     */\n    stopImmediatePropagation(): void;\n    /**\n     * The **`preventDefault()`** method of the Event interface tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)\n     */\n    preventDefault(): void;\n    /**\n     * The **`stopPropagation()`** method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)\n     */\n    stopPropagation(): void;\n    /**\n     * The **`composedPath()`** method of the Event interface returns the event's path which is an array of the objects on which listeners will be invoked.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath)\n     */\n    composedPath(): EventTarget[];\n    static readonly NONE: number;\n    static readonly CAPTURING_PHASE: number;\n    static readonly AT_TARGET: number;\n    static readonly BUBBLING_PHASE: number;\n}\ninterface EventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n}\ntype EventListener<EventType extends Event = Event> = (event: EventType) => void;\ninterface EventListenerObject<EventType extends Event = Event> {\n    handleEvent(event: EventType): void;\n}\ntype EventListenerOrEventListenerObject<EventType extends Event = Event> = EventListener<EventType> | EventListenerObject<EventType>;\n/**\n * The **`EventTarget`** interface is implemented by objects that can receive events and may have listeners for them.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)\n */\ndeclare class EventTarget<EventMap extends Record<string, Event> = Record<string, Event>> {\n    constructor();\n    /**\n     * The **`addEventListener()`** method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)\n     */\n    addEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetAddEventListenerOptions | boolean): void;\n    /**\n     * The **`removeEventListener()`** method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)\n     */\n    removeEventListener<Type extends keyof EventMap>(type: Type, handler: EventListenerOrEventListenerObject<EventMap[Type]>, options?: EventTargetEventListenerOptions | boolean): void;\n    /**\n     * The **`dispatchEvent()`** method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)\n     */\n    dispatchEvent(event: EventMap[keyof EventMap]): boolean;\n}\ninterface EventTargetEventListenerOptions {\n    capture?: boolean;\n}\ninterface EventTargetAddEventListenerOptions {\n    capture?: boolean;\n    passive?: boolean;\n    once?: boolean;\n    signal?: AbortSignal;\n}\ninterface EventTargetHandlerObject {\n    handleEvent: (event: Event) => any | undefined;\n}\n/**\n * The **`AbortController`** interface represents a controller object that allows you to abort one or more Web requests as and when desired.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController)\n */\ndeclare class AbortController {\n    constructor();\n    /**\n     * The **`signal`** read-only property of the AbortController interface returns an AbortSignal object instance, which can be used to communicate with/abort an asynchronous operation as desired.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`abort()`** method of the AbortController interface aborts an asynchronous operation before it has completed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort)\n     */\n    abort(reason?: any): void;\n}\n/**\n * The **`AbortSignal`** interface represents a signal object that allows you to communicate with an asynchronous operation (such as a fetch request) and abort it if required via an AbortController object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal)\n */\ndeclare abstract class AbortSignal extends EventTarget {\n    /**\n     * The **`AbortSignal.abort()`** static method returns an AbortSignal that is already set as aborted (and which does not trigger an AbortSignal/abort_event event).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static)\n     */\n    static abort(reason?: any): AbortSignal;\n    /**\n     * The **`AbortSignal.timeout()`** static method returns an AbortSignal that will automatically abort after a specified time.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static)\n     */\n    static timeout(delay: number): AbortSignal;\n    /**\n     * The **`AbortSignal.any()`** static method takes an iterable of abort signals and returns an AbortSignal.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static)\n     */\n    static any(signals: AbortSignal[]): AbortSignal;\n    /**\n     * The **`aborted`** read-only property returns a value that indicates whether the asynchronous operations the signal is communicating with are aborted (`true`) or not (`false`).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted)\n     */\n    get aborted(): boolean;\n    /**\n     * The **`reason`** read-only property returns a JavaScript value that indicates the abort reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason)\n     */\n    get reason(): any;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    get onabort(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */\n    set onabort(value: any | null);\n    /**\n     * The **`throwIfAborted()`** method throws the signal's abort AbortSignal.reason if the signal has been aborted; otherwise it does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted)\n     */\n    throwIfAborted(): void;\n}\ninterface Scheduler {\n    wait(delay: number, maybeOptions?: SchedulerWaitOptions): Promise<void>;\n}\ninterface SchedulerWaitOptions {\n    signal?: AbortSignal;\n}\n/**\n * The **`ExtendableEvent`** interface extends the lifetime of the `install` and `activate` events dispatched on the global scope as part of the service worker lifecycle.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent)\n */\ndeclare abstract class ExtendableEvent extends Event {\n    /**\n     * The **`ExtendableEvent.waitUntil()`** method tells the event dispatcher that work is ongoing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ExtendableEvent/waitUntil)\n     */\n    waitUntil(promise: Promise<any>): void;\n}\n/**\n * The **`CustomEvent`** interface represents events initialized by an application for any purpose.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent)\n */\ndeclare class CustomEvent<T = any> extends Event {\n    constructor(type: string, init?: CustomEventCustomEventInit);\n    /**\n     * The read-only **`detail`** property of the CustomEvent interface returns any data passed when initializing the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail)\n     */\n    get detail(): T;\n}\ninterface CustomEventCustomEventInit {\n    bubbles?: boolean;\n    cancelable?: boolean;\n    composed?: boolean;\n    detail?: any;\n}\n/**\n * The **`Blob`** interface represents a blob, which is a file-like object of immutable, raw data; they can be read as text or binary data, or converted into a ReadableStream so its methods can be used for processing the data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob)\n */\ndeclare class Blob {\n    constructor(type?: ((ArrayBuffer | ArrayBufferView) | string | Blob)[], options?: BlobOptions);\n    /**\n     * The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)\n     */\n    get size(): number;\n    /**\n     * The **`type`** read-only property of the Blob interface returns the MIME type of the file.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)\n     */\n    get type(): string;\n    /**\n     * The **`slice()`** method of the Blob interface creates and returns a new `Blob` object which contains data from a subset of the blob on which it's called.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)\n     */\n    slice(start?: number, end?: number, type?: string): Blob;\n    /**\n     * The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)\n     */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /**\n     * The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)\n     */\n    bytes(): Promise<Uint8Array>;\n    /**\n     * The **`text()`** method of the string containing the contents of the blob, interpreted as UTF-8.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)\n     */\n    text(): Promise<string>;\n    /**\n     * The **`stream()`** method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the `Blob`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream)\n     */\n    stream(): ReadableStream;\n}\ninterface BlobOptions {\n    type?: string;\n}\n/**\n * The **`File`** interface provides information about files and allows JavaScript in a web page to access their content.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File)\n */\ndeclare class File extends Blob {\n    constructor(bits: ((ArrayBuffer | ArrayBufferView) | string | Blob)[] | undefined, name: string, options?: FileOptions);\n    /**\n     * The **`name`** read-only property of the File interface returns the name of the file represented by a File object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)\n     */\n    get name(): string;\n    /**\n     * The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)\n     */\n    get lastModified(): number;\n}\ninterface FileOptions {\n    type?: string;\n    lastModified?: number;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class CacheStorage {\n    /**\n     * The **`open()`** method of the the Cache object matching the `cacheName`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)\n     */\n    open(cacheName: string): Promise<Cache>;\n    readonly default: Cache;\n}\n/**\n* The Cache API allows fine grained control of reading and writing from the Cloudflare global network cache.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/)\n*/\ndeclare abstract class Cache {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */\n    delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<boolean>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */\n    match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise<Response | undefined>;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */\n    put(request: RequestInfo | URL, response: Response): Promise<void>;\n}\ninterface CacheQueryOptions {\n    ignoreMethod?: boolean;\n}\n/**\n* The Web Crypto API provides a set of low-level functions for common cryptographic tasks.\n* The Workers runtime implements the full surface of this API, but with some differences in\n* the [supported algorithms](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/#supported-algorithms)\n* compared to those implemented in most browsers.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/web-crypto/)\n*/\ndeclare abstract class Crypto {\n    /**\n     * The **`Crypto.subtle`** read-only property returns a cryptographic operations.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle)\n     */\n    get subtle(): SubtleCrypto;\n    /**\n     * The **`Crypto.getRandomValues()`** method lets you get cryptographically strong random values.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues)\n     */\n    getRandomValues<T extends Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | BigInt64Array | BigUint64Array>(buffer: T): T;\n    /**\n     * The **`randomUUID()`** method of the Crypto interface is used to generate a v4 UUID using a cryptographically secure random number generator.\n     * Available only in secure contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID)\n     */\n    randomUUID(): string;\n    DigestStream: typeof DigestStream;\n}\n/**\n * The **`SubtleCrypto`** interface of the Web Crypto API provides a number of low-level cryptographic functions.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto)\n */\ndeclare abstract class SubtleCrypto {\n    /**\n     * The **`encrypt()`** method of the SubtleCrypto interface encrypts data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/encrypt)\n     */\n    encrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, plainText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`decrypt()`** method of the SubtleCrypto interface decrypts some encrypted data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/decrypt)\n     */\n    decrypt(algorithm: string | SubtleCryptoEncryptAlgorithm, key: CryptoKey, cipherText: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`sign()`** method of the SubtleCrypto interface generates a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/sign)\n     */\n    sign(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`verify()`** method of the SubtleCrypto interface verifies a digital signature.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/verify)\n     */\n    verify(algorithm: string | SubtleCryptoSignAlgorithm, key: CryptoKey, signature: ArrayBuffer | ArrayBufferView, data: ArrayBuffer | ArrayBufferView): Promise<boolean>;\n    /**\n     * The **`digest()`** method of the SubtleCrypto interface generates a _digest_ of the given data, using the specified hash function.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/digest)\n     */\n    digest(algorithm: string | SubtleCryptoHashAlgorithm, data: ArrayBuffer | ArrayBufferView): Promise<ArrayBuffer>;\n    /**\n     * The **`generateKey()`** method of the SubtleCrypto interface is used to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey)\n     */\n    generateKey(algorithm: string | SubtleCryptoGenerateKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey | CryptoKeyPair>;\n    /**\n     * The **`deriveKey()`** method of the SubtleCrypto interface can be used to derive a secret key from a master key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveKey)\n     */\n    deriveKey(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, derivedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`deriveBits()`** method of the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/deriveBits)\n     */\n    deriveBits(algorithm: string | SubtleCryptoDeriveKeyAlgorithm, baseKey: CryptoKey, length?: number | null): Promise<ArrayBuffer>;\n    /**\n     * The **`importKey()`** method of the SubtleCrypto interface imports a key: that is, it takes as input a key in an external, portable format and gives you a CryptoKey object that you can use in the Web Crypto API.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/importKey)\n     */\n    importKey(format: string, keyData: (ArrayBuffer | ArrayBufferView) | JsonWebKey, algorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    /**\n     * The **`exportKey()`** method of the SubtleCrypto interface exports a key: that is, it takes as input a CryptoKey object and gives you the key in an external, portable format.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/exportKey)\n     */\n    exportKey(format: string, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;\n    /**\n     * The **`wrapKey()`** method of the SubtleCrypto interface 'wraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/wrapKey)\n     */\n    wrapKey(format: string, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: string | SubtleCryptoEncryptAlgorithm): Promise<ArrayBuffer>;\n    /**\n     * The **`unwrapKey()`** method of the SubtleCrypto interface 'unwraps' a key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SubtleCrypto/unwrapKey)\n     */\n    unwrapKey(format: string, wrappedKey: ArrayBuffer | ArrayBufferView, unwrappingKey: CryptoKey, unwrapAlgorithm: string | SubtleCryptoEncryptAlgorithm, unwrappedKeyAlgorithm: string | SubtleCryptoImportKeyAlgorithm, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;\n    timingSafeEqual(a: ArrayBuffer | ArrayBufferView, b: ArrayBuffer | ArrayBufferView): boolean;\n}\n/**\n * The **`CryptoKey`** interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods SubtleCrypto.generateKey, SubtleCrypto.deriveKey, SubtleCrypto.importKey, or SubtleCrypto.unwrapKey.\n * Available only in secure contexts.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey)\n */\ndeclare abstract class CryptoKey {\n    /**\n     * The read-only **`type`** property of the CryptoKey interface indicates which kind of key is represented by the object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type)\n     */\n    readonly type: string;\n    /**\n     * The read-only **`extractable`** property of the CryptoKey interface indicates whether or not the key may be extracted using `SubtleCrypto.exportKey()` or `SubtleCrypto.wrapKey()`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable)\n     */\n    readonly extractable: boolean;\n    /**\n     * The read-only **`algorithm`** property of the CryptoKey interface returns an object describing the algorithm for which this key can be used, and any associated extra parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm)\n     */\n    readonly algorithm: CryptoKeyKeyAlgorithm | CryptoKeyAesKeyAlgorithm | CryptoKeyHmacKeyAlgorithm | CryptoKeyRsaKeyAlgorithm | CryptoKeyEllipticKeyAlgorithm | CryptoKeyArbitraryKeyAlgorithm;\n    /**\n     * The read-only **`usages`** property of the CryptoKey interface indicates what can be done with the key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages)\n     */\n    readonly usages: string[];\n}\ninterface CryptoKeyPair {\n    publicKey: CryptoKey;\n    privateKey: CryptoKey;\n}\ninterface JsonWebKey {\n    kty: string;\n    use?: string;\n    key_ops?: string[];\n    alg?: string;\n    ext?: boolean;\n    crv?: string;\n    x?: string;\n    y?: string;\n    d?: string;\n    n?: string;\n    e?: string;\n    p?: string;\n    q?: string;\n    dp?: string;\n    dq?: string;\n    qi?: string;\n    oth?: RsaOtherPrimesInfo[];\n    k?: string;\n}\ninterface RsaOtherPrimesInfo {\n    r?: string;\n    d?: string;\n    t?: string;\n}\ninterface SubtleCryptoDeriveKeyAlgorithm {\n    name: string;\n    salt?: (ArrayBuffer | ArrayBufferView);\n    iterations?: number;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    $public?: CryptoKey;\n    info?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoEncryptAlgorithm {\n    name: string;\n    iv?: (ArrayBuffer | ArrayBufferView);\n    additionalData?: (ArrayBuffer | ArrayBufferView);\n    tagLength?: number;\n    counter?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    label?: (ArrayBuffer | ArrayBufferView);\n}\ninterface SubtleCryptoGenerateKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    modulusLength?: number;\n    publicExponent?: (ArrayBuffer | ArrayBufferView);\n    length?: number;\n    namedCurve?: string;\n}\ninterface SubtleCryptoHashAlgorithm {\n    name: string;\n}\ninterface SubtleCryptoImportKeyAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    length?: number;\n    namedCurve?: string;\n    compressed?: boolean;\n}\ninterface SubtleCryptoSignAlgorithm {\n    name: string;\n    hash?: (string | SubtleCryptoHashAlgorithm);\n    dataLength?: number;\n    saltLength?: number;\n}\ninterface CryptoKeyKeyAlgorithm {\n    name: string;\n}\ninterface CryptoKeyAesKeyAlgorithm {\n    name: string;\n    length: number;\n}\ninterface CryptoKeyHmacKeyAlgorithm {\n    name: string;\n    hash: CryptoKeyKeyAlgorithm;\n    length: number;\n}\ninterface CryptoKeyRsaKeyAlgorithm {\n    name: string;\n    modulusLength: number;\n    publicExponent: ArrayBuffer | ArrayBufferView;\n    hash?: CryptoKeyKeyAlgorithm;\n}\ninterface CryptoKeyEllipticKeyAlgorithm {\n    name: string;\n    namedCurve: string;\n}\ninterface CryptoKeyArbitraryKeyAlgorithm {\n    name: string;\n    hash?: CryptoKeyKeyAlgorithm;\n    namedCurve?: string;\n    length?: number;\n}\ndeclare class DigestStream extends WritableStream<ArrayBuffer | ArrayBufferView> {\n    constructor(algorithm: string | SubtleCryptoHashAlgorithm);\n    readonly digest: Promise<ArrayBuffer>;\n    get bytesWritten(): number | bigint;\n}\n/**\n * The **`TextDecoder`** interface represents a decoder for a specific text encoding, such as `UTF-8`, `ISO-8859-2`, `KOI8-R`, `GBK`, etc.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)\n */\ndeclare class TextDecoder {\n    constructor(label?: string, options?: TextDecoderConstructorOptions);\n    /**\n     * The **`TextDecoder.decode()`** method returns a string containing text decoded from the buffer passed as a parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode)\n     */\n    decode(input?: (ArrayBuffer | ArrayBufferView), options?: TextDecoderDecodeOptions): string;\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\n/**\n * The **`TextEncoder`** interface takes a stream of code points as input and emits a stream of UTF-8 bytes.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder)\n */\ndeclare class TextEncoder {\n    constructor();\n    /**\n     * The **`TextEncoder.encode()`** method takes a string as input, and returns a Global_Objects/Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode)\n     */\n    encode(input?: string): Uint8Array;\n    /**\n     * The **`TextEncoder.encodeInto()`** method takes a string to encode and a destination Uint8Array to put resulting UTF-8 encoded text into, and returns a dictionary object indicating the progress of the encoding.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto)\n     */\n    encodeInto(input: string, buffer: Uint8Array): TextEncoderEncodeIntoResult;\n    get encoding(): string;\n}\ninterface TextDecoderConstructorOptions {\n    fatal: boolean;\n    ignoreBOM: boolean;\n}\ninterface TextDecoderDecodeOptions {\n    stream: boolean;\n}\ninterface TextEncoderEncodeIntoResult {\n    read: number;\n    written: number;\n}\n/**\n * The **`ErrorEvent`** interface represents events providing information related to errors in scripts or in files.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent)\n */\ndeclare class ErrorEvent extends Event {\n    constructor(type: string, init?: ErrorEventErrorEventInit);\n    /**\n     * The **`filename`** read-only property of the ErrorEvent interface returns a string containing the name of the script file in which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename)\n     */\n    get filename(): string;\n    /**\n     * The **`message`** read-only property of the ErrorEvent interface returns a string containing a human-readable error message describing the problem.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message)\n     */\n    get message(): string;\n    /**\n     * The **`lineno`** read-only property of the ErrorEvent interface returns an integer containing the line number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno)\n     */\n    get lineno(): number;\n    /**\n     * The **`colno`** read-only property of the ErrorEvent interface returns an integer containing the column number of the script file on which the error occurred.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno)\n     */\n    get colno(): number;\n    /**\n     * The **`error`** read-only property of the ErrorEvent interface returns a JavaScript value, such as an Error or DOMException, representing the error associated with this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error)\n     */\n    get error(): any;\n}\ninterface ErrorEventErrorEventInit {\n    message?: string;\n    filename?: string;\n    lineno?: number;\n    colno?: number;\n    error?: any;\n}\n/**\n * The **`MessageEvent`** interface represents a message received by a target object.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent)\n */\ndeclare class MessageEvent extends Event {\n    constructor(type: string, initializer: MessageEventInit);\n    /**\n     * The **`data`** read-only property of the The data sent by the message emitter; this can be any data type, depending on what originated this event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/data)\n     */\n    readonly data: any;\n    /**\n     * The **`origin`** read-only property of the origin of the message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/origin)\n     */\n    readonly origin: string | null;\n    /**\n     * The **`lastEventId`** read-only property of the unique ID for the event.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/lastEventId)\n     */\n    readonly lastEventId: string;\n    /**\n     * The **`source`** read-only property of the a WindowProxy, MessagePort, or a `MessageEventSource` (which can be a WindowProxy, message emitter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/source)\n     */\n    readonly source: MessagePort | null;\n    /**\n     * The **`ports`** read-only property of the containing all MessagePort objects sent with the message, in order.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageEvent/ports)\n     */\n    readonly ports: MessagePort[];\n}\ninterface MessageEventInit {\n    data: ArrayBuffer | string;\n}\n/**\n * The **`PromiseRejectionEvent`** interface represents events which are sent to the global script context when JavaScript Promises are rejected.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent)\n */\ndeclare abstract class PromiseRejectionEvent extends Event {\n    /**\n     * The PromiseRejectionEvent interface's **`promise`** read-only property indicates the JavaScript rejected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/promise)\n     */\n    readonly promise: Promise<any>;\n    /**\n     * The PromiseRejectionEvent **`reason`** read-only property is any JavaScript value or Object which provides the reason passed into Promise.reject().\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/PromiseRejectionEvent/reason)\n     */\n    readonly reason: any;\n}\n/**\n * The **`FormData`** interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the Window/fetch, XMLHttpRequest.send() or navigator.sendBeacon() methods.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData)\n */\ndeclare class FormData {\n    constructor();\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string | Blob): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the FormData interface appends a new value onto an existing key inside a `FormData` object, or adds the key if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append)\n     */\n    append(name: string, value: Blob, filename?: string): void;\n    /**\n     * The **`delete()`** method of the FormData interface deletes a key and its value(s) from a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete)\n     */\n    delete(name: string): void;\n    /**\n     * The **`get()`** method of the FormData interface returns the first value associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get)\n     */\n    get(name: string): (File | string) | null;\n    /**\n     * The **`getAll()`** method of the FormData interface returns all the values associated with a given key from within a `FormData` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll)\n     */\n    getAll(name: string): (File | string)[];\n    /**\n     * The **`has()`** method of the FormData interface returns whether a `FormData` object contains a certain key.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string | Blob): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`set()`** method of the FormData interface sets a new value for an existing key inside a `FormData` object, or adds the key/value if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set)\n     */\n    set(name: string, value: Blob, filename?: string): void;\n    /* Returns an array of key, value pairs for every entry in the list. */\n    entries(): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n    /* Returns a list of keys in the list. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the list. */\n    values(): IterableIterator<(File | string)>;\n    forEach<This = unknown>(callback: (this: This, value: File | string, key: string, parent: FormData) => void, thisArg?: This): void;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: File | string\n    ]>;\n}\ninterface ContentOptions {\n    html?: boolean;\n}\ndeclare class HTMLRewriter {\n    constructor();\n    on(selector: string, handlers: HTMLRewriterElementContentHandlers): HTMLRewriter;\n    onDocument(handlers: HTMLRewriterDocumentContentHandlers): HTMLRewriter;\n    transform(response: Response): Response;\n}\ninterface HTMLRewriterElementContentHandlers {\n    element?(element: Element): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(element: Text): void | Promise<void>;\n}\ninterface HTMLRewriterDocumentContentHandlers {\n    doctype?(doctype: Doctype): void | Promise<void>;\n    comments?(comment: Comment): void | Promise<void>;\n    text?(text: Text): void | Promise<void>;\n    end?(end: DocumentEnd): void | Promise<void>;\n}\ninterface Doctype {\n    readonly name: string | null;\n    readonly publicId: string | null;\n    readonly systemId: string | null;\n}\ninterface Element {\n    tagName: string;\n    readonly attributes: IterableIterator<string[]>;\n    readonly removed: boolean;\n    readonly namespaceURI: string;\n    getAttribute(name: string): string | null;\n    hasAttribute(name: string): boolean;\n    setAttribute(name: string, value: string): Element;\n    removeAttribute(name: string): Element;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    prepend(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    append(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    remove(): Element;\n    removeAndKeepContent(): Element;\n    setInnerContent(content: string | ReadableStream | Response, options?: ContentOptions): Element;\n    onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;\n}\ninterface EndTag {\n    name: string;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): EndTag;\n    remove(): EndTag;\n}\ninterface Comment {\n    text: string;\n    readonly removed: boolean;\n    before(content: string, options?: ContentOptions): Comment;\n    after(content: string, options?: ContentOptions): Comment;\n    replace(content: string, options?: ContentOptions): Comment;\n    remove(): Comment;\n}\ninterface Text {\n    readonly text: string;\n    readonly lastInTextNode: boolean;\n    readonly removed: boolean;\n    before(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    after(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    replace(content: string | ReadableStream | Response, options?: ContentOptions): Text;\n    remove(): Text;\n}\ninterface DocumentEnd {\n    append(content: string, options?: ContentOptions): DocumentEnd;\n}\n/**\n * This is the event type for `fetch` events dispatched on the ServiceWorkerGlobalScope.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent)\n */\ndeclare abstract class FetchEvent extends ExtendableEvent {\n    /**\n     * The **`request`** read-only property of the the event handler.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/request)\n     */\n    readonly request: Request;\n    /**\n     * The **`respondWith()`** method of allows you to provide a promise for a Response yourself.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FetchEvent/respondWith)\n     */\n    respondWith(promise: Response | Promise<Response>): void;\n    passThroughOnException(): void;\n}\ntype HeadersInit = Headers | Iterable<Iterable<string>> | Record<string, string>;\n/**\n * The **`Headers`** interface of the Fetch API allows you to perform various actions on HTTP request and response headers.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers)\n */\ndeclare class Headers {\n    constructor(init?: HeadersInit);\n    /**\n     * The **`get()`** method of the Headers interface returns a byte string of all the values of a header within a `Headers` object with a given name.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/get)\n     */\n    get(name: string): string | null;\n    getAll(name: string): string[];\n    /**\n     * The **`getSetCookie()`** method of the Headers interface returns an array containing the values of all Set-Cookie headers associated with a response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/getSetCookie)\n     */\n    getSetCookie(): string[];\n    /**\n     * The **`has()`** method of the Headers interface returns a boolean stating whether a `Headers` object contains a certain header.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/has)\n     */\n    has(name: string): boolean;\n    /**\n     * The **`set()`** method of the Headers interface sets a new value for an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`append()`** method of the Headers interface appends a new value onto an existing header inside a `Headers` object, or adds the header if it does not already exist.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the Headers interface deletes a header from the current `Headers` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Headers/delete)\n     */\n    delete(name: string): void;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: Headers) => void, thisArg?: This): void;\n    /* Returns an iterator allowing to go through all key/value pairs contained in this object. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns an iterator allowing to go through all keys of the key/value pairs contained in this object. */\n    keys(): IterableIterator<string>;\n    /* Returns an iterator allowing to go through all values of the key/value pairs contained in this object. */\n    values(): IterableIterator<string>;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ntype BodyInit = ReadableStream<Uint8Array> | string | ArrayBuffer | ArrayBufferView | Blob | URLSearchParams | FormData;\ndeclare abstract class Body {\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */\n    get body(): ReadableStream | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */\n    get bodyUsed(): boolean;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */\n    arrayBuffer(): Promise<ArrayBuffer>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) */\n    bytes(): Promise<Uint8Array>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */\n    text(): Promise<string>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */\n    json<T>(): Promise<T>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */\n    formData(): Promise<FormData>;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */\n    blob(): Promise<Blob>;\n}\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ndeclare var Response: {\n    prototype: Response;\n    new (body?: BodyInit | null, init?: ResponseInit): Response;\n    error(): Response;\n    redirect(url: string, status?: number): Response;\n    json(any: any, maybeInit?: (ResponseInit | Response)): Response;\n};\n/**\n * The **`Response`** interface of the Fetch API represents the response to a request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)\n */\ninterface Response extends Body {\n    /**\n     * The **`clone()`** method of the Response interface creates a clone of a response object, identical in every way, but stored in a different variable.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone)\n     */\n    clone(): Response;\n    /**\n     * The **`status`** read-only property of the Response interface contains the HTTP status codes of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status)\n     */\n    status: number;\n    /**\n     * The **`statusText`** read-only property of the Response interface contains the status message corresponding to the HTTP status code in Response.status.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText)\n     */\n    statusText: string;\n    /**\n     * The **`headers`** read-only property of the with the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`ok`** read-only property of the Response interface contains a Boolean stating whether the response was successful (status in the range 200-299) or not.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok)\n     */\n    ok: boolean;\n    /**\n     * The **`redirected`** read-only property of the Response interface indicates whether or not the response is the result of a request you made which was redirected.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected)\n     */\n    redirected: boolean;\n    /**\n     * The **`url`** read-only property of the Response interface contains the URL of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url)\n     */\n    url: string;\n    webSocket: WebSocket | null;\n    cf: any | undefined;\n    /**\n     * The **`type`** read-only property of the Response interface contains the type of the response.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/type)\n     */\n    type: \"default\" | \"error\";\n}\ninterface ResponseInit {\n    status?: number;\n    statusText?: string;\n    headers?: HeadersInit;\n    cf?: any;\n    webSocket?: (WebSocket | null);\n    encodeBody?: \"automatic\" | \"manual\";\n}\ntype RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> = Request<CfHostMetadata, Cf> | string;\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ndeclare var Request: {\n    prototype: Request;\n    new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(input: RequestInfo<CfProperties> | URL, init?: RequestInit<Cf>): Request<CfHostMetadata, Cf>;\n};\n/**\n * The **`Request`** interface of the Fetch API represents a resource request.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)\n */\ninterface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> extends Body {\n    /**\n     * The **`clone()`** method of the Request interface creates a copy of the current `Request` object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone)\n     */\n    clone(): Request<CfHostMetadata, Cf>;\n    /**\n     * The **`method`** read-only property of the `POST`, etc.) A String indicating the method of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)\n     */\n    method: string;\n    /**\n     * The **`url`** read-only property of the Request interface contains the URL of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)\n     */\n    url: string;\n    /**\n     * The **`headers`** read-only property of the with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)\n     */\n    headers: Headers;\n    /**\n     * The **`redirect`** read-only property of the Request interface contains the mode for how redirects are handled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)\n     */\n    redirect: string;\n    fetcher: Fetcher | null;\n    /**\n     * The read-only **`signal`** property of the Request interface returns the AbortSignal associated with the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)\n     */\n    signal: AbortSignal;\n    cf?: Cf;\n    /**\n     * The **`integrity`** read-only property of the Request interface contains the subresource integrity value of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)\n     */\n    integrity: string;\n    /**\n     * The **`keepalive`** read-only property of the Request interface contains the request's `keepalive` setting (`true` or `false`), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)\n     */\n    keepalive: boolean;\n    /**\n     * The **`cache`** read-only property of the Request interface contains the cache mode of the request.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)\n     */\n    cache?: \"no-store\" | \"no-cache\";\n}\ninterface RequestInit<Cf = CfProperties> {\n    /* A string to set request's method. */\n    method?: string;\n    /* A Headers object, an object literal, or an array of two-item arrays to set request's headers. */\n    headers?: HeadersInit;\n    /* A BodyInit object or null to set request's body. */\n    body?: BodyInit | null;\n    /* A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */\n    redirect?: string;\n    fetcher?: (Fetcher | null);\n    cf?: Cf;\n    /* A string indicating how the request will interact with the browser's cache to set request's cache. */\n    cache?: \"no-store\" | \"no-cache\";\n    /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */\n    integrity?: string;\n    /* An AbortSignal to set request's signal. */\n    signal?: (AbortSignal | null);\n    encodeResponseBody?: \"automatic\" | \"manual\";\n}\ntype Service<T extends (new (...args: any[]) => Rpc.WorkerEntrypointBranded) | Rpc.WorkerEntrypointBranded | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? Fetcher<InstanceType<T>> : T extends Rpc.WorkerEntrypointBranded ? Fetcher<T> : T extends Exclude<Rpc.EntrypointBranded, Rpc.WorkerEntrypointBranded> ? never : Fetcher<undefined>;\ntype Fetcher<T extends Rpc.EntrypointBranded | undefined = undefined, Reserved extends string = never> = (T extends Rpc.EntrypointBranded ? Rpc.Provider<T, Reserved | \"fetch\" | \"connect\"> : unknown) & {\n    fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;\n    connect(address: SocketAddress | string, options?: SocketOptions): Socket;\n};\ninterface KVNamespaceListKey<Metadata, Key extends string = string> {\n    name: Key;\n    expiration?: number;\n    metadata?: Metadata;\n}\ntype KVNamespaceListResult<Metadata, Key extends string = string> = {\n    list_complete: false;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cursor: string;\n    cacheStatus: string | null;\n} | {\n    list_complete: true;\n    keys: KVNamespaceListKey<Metadata, Key>[];\n    cacheStatus: string | null;\n};\ninterface KVNamespace<Key extends string = string> {\n    get(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<string | null>;\n    get(key: Key, type: \"text\"): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, type: \"json\"): Promise<ExpectedValue | null>;\n    get(key: Key, type: \"arrayBuffer\"): Promise<ArrayBuffer | null>;\n    get(key: Key, type: \"stream\"): Promise<ReadableStream | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"text\">): Promise<string | null>;\n    get<ExpectedValue = unknown>(key: Key, options?: KVNamespaceGetOptions<\"json\">): Promise<ExpectedValue | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<ArrayBuffer | null>;\n    get(key: Key, options?: KVNamespaceGetOptions<\"stream\">): Promise<ReadableStream | null>;\n    get(key: Array<Key>, type: \"text\"): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, ExpectedValue | null>>;\n    get(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, string | null>>;\n    get(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, string | null>>;\n    get<ExpectedValue = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, ExpectedValue | null>>;\n    list<Metadata = unknown>(options?: KVNamespaceListOptions): Promise<KVNamespaceListResult<Metadata, Key>>;\n    put(key: Key, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: KVNamespacePutOptions): Promise<void>;\n    getWithMetadata<Metadata = unknown>(key: Key, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"text\"): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, type: \"json\"): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"arrayBuffer\"): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, type: \"stream\"): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"text\">): Promise<KVNamespaceGetWithMetadataResult<string, Metadata>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"json\">): Promise<KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"arrayBuffer\">): Promise<KVNamespaceGetWithMetadataResult<ArrayBuffer, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Key, options: KVNamespaceGetOptions<\"stream\">): Promise<KVNamespaceGetWithMetadataResult<ReadableStream, Metadata>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, type: \"text\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, type: \"json\"): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: Partial<KVNamespaceGetOptions<undefined>>): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"text\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<string, Metadata>>>;\n    getWithMetadata<ExpectedValue = unknown, Metadata = unknown>(key: Array<Key>, options?: KVNamespaceGetOptions<\"json\">): Promise<Map<string, KVNamespaceGetWithMetadataResult<ExpectedValue, Metadata>>>;\n    delete(key: Key): Promise<void>;\n}\ninterface KVNamespaceListOptions {\n    limit?: number;\n    prefix?: (string | null);\n    cursor?: (string | null);\n}\ninterface KVNamespaceGetOptions<Type> {\n    type: Type;\n    cacheTtl?: number;\n}\ninterface KVNamespacePutOptions {\n    expiration?: number;\n    expirationTtl?: number;\n    metadata?: (any | null);\n}\ninterface KVNamespaceGetWithMetadataResult<Value, Metadata> {\n    value: Value | null;\n    metadata: Metadata | null;\n    cacheStatus: string | null;\n}\ntype QueueContentType = \"text\" | \"bytes\" | \"json\" | \"v8\";\ninterface Queue<Body = unknown> {\n    send(message: Body, options?: QueueSendOptions): Promise<void>;\n    sendBatch(messages: Iterable<MessageSendRequest<Body>>, options?: QueueSendBatchOptions): Promise<void>;\n}\ninterface QueueSendOptions {\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueSendBatchOptions {\n    delaySeconds?: number;\n}\ninterface MessageSendRequest<Body = unknown> {\n    body: Body;\n    contentType?: QueueContentType;\n    delaySeconds?: number;\n}\ninterface QueueRetryOptions {\n    delaySeconds?: number;\n}\ninterface Message<Body = unknown> {\n    readonly id: string;\n    readonly timestamp: Date;\n    readonly body: Body;\n    readonly attempts: number;\n    retry(options?: QueueRetryOptions): void;\n    ack(): void;\n}\ninterface QueueEvent<Body = unknown> extends ExtendableEvent {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface MessageBatch<Body = unknown> {\n    readonly messages: readonly Message<Body>[];\n    readonly queue: string;\n    retryAll(options?: QueueRetryOptions): void;\n    ackAll(): void;\n}\ninterface R2Error extends Error {\n    readonly name: string;\n    readonly code: number;\n    readonly message: string;\n    readonly action: string;\n    readonly stack: any;\n}\ninterface R2ListOptions {\n    limit?: number;\n    prefix?: string;\n    cursor?: string;\n    delimiter?: string;\n    startAfter?: string;\n    include?: (\"httpMetadata\" | \"customMetadata\")[];\n}\ndeclare abstract class R2Bucket {\n    head(key: string): Promise<R2Object | null>;\n    get(key: string, options: R2GetOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2ObjectBody | R2Object | null>;\n    get(key: string, options?: R2GetOptions): Promise<R2ObjectBody | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions & {\n        onlyIf: R2Conditional | Headers;\n    }): Promise<R2Object | null>;\n    put(key: string, value: ReadableStream | ArrayBuffer | ArrayBufferView | string | null | Blob, options?: R2PutOptions): Promise<R2Object>;\n    createMultipartUpload(key: string, options?: R2MultipartOptions): Promise<R2MultipartUpload>;\n    resumeMultipartUpload(key: string, uploadId: string): R2MultipartUpload;\n    delete(keys: string | string[]): Promise<void>;\n    list(options?: R2ListOptions): Promise<R2Objects>;\n}\ninterface R2MultipartUpload {\n    readonly key: string;\n    readonly uploadId: string;\n    uploadPart(partNumber: number, value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob, options?: R2UploadPartOptions): Promise<R2UploadedPart>;\n    abort(): Promise<void>;\n    complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;\n}\ninterface R2UploadedPart {\n    partNumber: number;\n    etag: string;\n}\ndeclare abstract class R2Object {\n    readonly key: string;\n    readonly version: string;\n    readonly size: number;\n    readonly etag: string;\n    readonly httpEtag: string;\n    readonly checksums: R2Checksums;\n    readonly uploaded: Date;\n    readonly httpMetadata?: R2HTTPMetadata;\n    readonly customMetadata?: Record<string, string>;\n    readonly range?: R2Range;\n    readonly storageClass: string;\n    readonly ssecKeyMd5?: string;\n    writeHttpMetadata(headers: Headers): void;\n}\ninterface R2ObjectBody extends R2Object {\n    get body(): ReadableStream;\n    get bodyUsed(): boolean;\n    arrayBuffer(): Promise<ArrayBuffer>;\n    bytes(): Promise<Uint8Array>;\n    text(): Promise<string>;\n    json<T>(): Promise<T>;\n    blob(): Promise<Blob>;\n}\ntype R2Range = {\n    offset: number;\n    length?: number;\n} | {\n    offset?: number;\n    length: number;\n} | {\n    suffix: number;\n};\ninterface R2Conditional {\n    etagMatches?: string;\n    etagDoesNotMatch?: string;\n    uploadedBefore?: Date;\n    uploadedAfter?: Date;\n    secondsGranularity?: boolean;\n}\ninterface R2GetOptions {\n    onlyIf?: (R2Conditional | Headers);\n    range?: (R2Range | Headers);\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2PutOptions {\n    onlyIf?: (R2Conditional | Headers);\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    md5?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha1?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha256?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha384?: ((ArrayBuffer | ArrayBufferView) | string);\n    sha512?: ((ArrayBuffer | ArrayBufferView) | string);\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2MultipartOptions {\n    httpMetadata?: (R2HTTPMetadata | Headers);\n    customMetadata?: Record<string, string>;\n    storageClass?: string;\n    ssecKey?: (ArrayBuffer | string);\n}\ninterface R2Checksums {\n    readonly md5?: ArrayBuffer;\n    readonly sha1?: ArrayBuffer;\n    readonly sha256?: ArrayBuffer;\n    readonly sha384?: ArrayBuffer;\n    readonly sha512?: ArrayBuffer;\n    toJSON(): R2StringChecksums;\n}\ninterface R2StringChecksums {\n    md5?: string;\n    sha1?: string;\n    sha256?: string;\n    sha384?: string;\n    sha512?: string;\n}\ninterface R2HTTPMetadata {\n    contentType?: string;\n    contentLanguage?: string;\n    contentDisposition?: string;\n    contentEncoding?: string;\n    cacheControl?: string;\n    cacheExpiry?: Date;\n}\ntype R2Objects = {\n    objects: R2Object[];\n    delimitedPrefixes: string[];\n} & ({\n    truncated: true;\n    cursor: string;\n} | {\n    truncated: false;\n});\ninterface R2UploadPartOptions {\n    ssecKey?: (ArrayBuffer | string);\n}\ndeclare abstract class ScheduledEvent extends ExtendableEvent {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface ScheduledController {\n    readonly scheduledTime: number;\n    readonly cron: string;\n    noRetry(): void;\n}\ninterface QueuingStrategy<T = any> {\n    highWaterMark?: (number | bigint);\n    size?: (chunk: T) => number | bigint;\n}\ninterface UnderlyingSink<W = any> {\n    type?: string;\n    start?: (controller: WritableStreamDefaultController) => void | Promise<void>;\n    write?: (chunk: W, controller: WritableStreamDefaultController) => void | Promise<void>;\n    abort?: (reason: any) => void | Promise<void>;\n    close?: () => void | Promise<void>;\n}\ninterface UnderlyingByteSource {\n    type: \"bytes\";\n    autoAllocateChunkSize?: number;\n    start?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    pull?: (controller: ReadableByteStreamController) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n}\ninterface UnderlyingSource<R = any> {\n    type?: \"\" | undefined;\n    start?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    pull?: (controller: ReadableStreamDefaultController<R>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: (number | bigint);\n}\ninterface Transformer<I = any, O = any> {\n    readableType?: string;\n    writableType?: string;\n    start?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    transform?: (chunk: I, controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    flush?: (controller: TransformStreamDefaultController<O>) => void | Promise<void>;\n    cancel?: (reason: any) => void | Promise<void>;\n    expectedLength?: number;\n}\ninterface StreamPipeOptions {\n    preventAbort?: boolean;\n    preventCancel?: boolean;\n    /**\n     * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     *\n     * Errors and closures of the source and destination streams propagate as follows:\n     *\n     * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.\n     *\n     * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.\n     *\n     * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.\n     *\n     * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.\n     *\n     * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.\n     */\n    preventClose?: boolean;\n    signal?: AbortSignal;\n}\ntype ReadableStreamReadResult<R = any> = {\n    done: false;\n    value: R;\n} | {\n    done: true;\n    value?: undefined;\n};\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ninterface ReadableStream<R = any> {\n    /**\n     * The **`locked`** read-only property of the ReadableStream interface returns whether or not the readable stream is locked to a reader.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`cancel()`** method of the ReadableStream interface returns a Promise that resolves when the stream is canceled.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/cancel)\n     */\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(): ReadableStreamDefaultReader<R>;\n    /**\n     * The **`getReader()`** method of the ReadableStream interface creates a reader and locks the stream to it.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/getReader)\n     */\n    getReader(options: ReadableStreamGetReaderOptions): ReadableStreamBYOBReader;\n    /**\n     * The **`pipeThrough()`** method of the ReadableStream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeThrough)\n     */\n    pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;\n    /**\n     * The **`pipeTo()`** method of the ReadableStream interface pipes the current `ReadableStream` to a given WritableStream and returns a Promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/pipeTo)\n     */\n    pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;\n    /**\n     * The **`tee()`** method of the two-element array containing the two resulting branches as new ReadableStream instances.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream/tee)\n     */\n    tee(): [\n        ReadableStream<R>,\n        ReadableStream<R>\n    ];\n    values(options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n    [Symbol.asyncIterator](options?: ReadableStreamValuesOptions): AsyncIterableIterator<R>;\n}\n/**\n * The `ReadableStream` interface of the Streams API represents a readable stream of byte data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStream)\n */\ndeclare const ReadableStream: {\n    prototype: ReadableStream;\n    new (underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy<Uint8Array>): ReadableStream<Uint8Array>;\n    new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;\n};\n/**\n * The **`ReadableStreamDefaultReader`** interface of the Streams API represents a default reader that can be used to read stream data supplied from a network (such as a fetch request).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader)\n */\ndeclare class ReadableStreamDefaultReader<R = any> {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamDefaultReader interface returns a Promise providing access to the next chunk in the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/read)\n     */\n    read(): Promise<ReadableStreamReadResult<R>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultReader/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The `ReadableStreamBYOBReader` interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader)\n */\ndeclare class ReadableStreamBYOBReader {\n    constructor(stream: ReadableStream);\n    get closed(): Promise<void>;\n    cancel(reason?: any): Promise<void>;\n    /**\n     * The **`read()`** method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)\n     */\n    read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;\n    /**\n     * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/releaseLock)\n     */\n    releaseLock(): void;\n    readAtLeast<T extends ArrayBufferView>(minElements: number, view: T): Promise<ReadableStreamReadResult<T>>;\n}\ninterface ReadableStreamBYOBReaderReadableStreamBYOBReaderReadOptions {\n    min?: number;\n}\ninterface ReadableStreamGetReaderOptions {\n    /**\n     * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.\n     *\n     * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle \"bring your own buffer\" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation.\n     */\n    mode: \"byob\";\n}\n/**\n * The **`ReadableStreamBYOBRequest`** interface of the Streams API represents a 'pull request' for data from an underlying source that will made as a zero-copy transfer to a consumer (bypassing the stream's internal queues).\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest)\n */\ndeclare abstract class ReadableStreamBYOBRequest {\n    /**\n     * The **`view`** getter property of the ReadableStreamBYOBRequest interface returns the current view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/view)\n     */\n    get view(): Uint8Array | null;\n    /**\n     * The **`respond()`** method of the ReadableStreamBYOBRequest interface is used to signal to the associated readable byte stream that the specified number of bytes were written into the ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respond)\n     */\n    respond(bytesWritten: number): void;\n    /**\n     * The **`respondWithNewView()`** method of the ReadableStreamBYOBRequest interface specifies a new view that the consumer of the associated readable byte stream should write to instead of ReadableStreamBYOBRequest.view.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)\n     */\n    respondWithNewView(view: ArrayBuffer | ArrayBufferView): void;\n    get atLeast(): number | null;\n}\n/**\n * The **`ReadableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController)\n */\ndeclare abstract class ReadableStreamDefaultController<R = any> {\n    /**\n     * The **`desiredSize`** read-only property of the required to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableStreamDefaultController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ```js-nolint enqueue(chunk) ``` - `chunk` - : The chunk to enqueue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: R): void;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamDefaultController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`ReadableByteStreamController`** interface of the Streams API represents a controller for a readable byte stream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController)\n */\ndeclare abstract class ReadableByteStreamController {\n    /**\n     * The **`byobRequest`** read-only property of the ReadableByteStreamController interface returns the current BYOB request, or `null` if there are no pending requests.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/byobRequest)\n     */\n    get byobRequest(): ReadableStreamBYOBRequest | null;\n    /**\n     * The **`desiredSize`** read-only property of the ReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its 'desired size'.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`close()`** method of the ReadableByteStreamController interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/close)\n     */\n    close(): void;\n    /**\n     * The **`enqueue()`** method of the ReadableByteStreamController interface enqueues a given chunk on the associated readable byte stream (the chunk is copied into the stream's internal queues).\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/enqueue)\n     */\n    enqueue(chunk: ArrayBuffer | ArrayBufferView): void;\n    /**\n     * The **`error()`** method of the ReadableByteStreamController interface causes any future interactions with the associated stream to error with the specified reason.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableByteStreamController/error)\n     */\n    error(reason: any): void;\n}\n/**\n * The **`WritableStreamDefaultController`** interface of the Streams API represents a controller allowing control of a WritableStream's state.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController)\n */\ndeclare abstract class WritableStreamDefaultController {\n    /**\n     * The read-only **`signal`** property of the WritableStreamDefaultController interface returns the AbortSignal associated with the controller.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/signal)\n     */\n    get signal(): AbortSignal;\n    /**\n     * The **`error()`** method of the with the associated stream to error.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultController/error)\n     */\n    error(reason?: any): void;\n}\n/**\n * The **`TransformStreamDefaultController`** interface of the Streams API provides methods to manipulate the associated ReadableStream and WritableStream.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController)\n */\ndeclare abstract class TransformStreamDefaultController<O = any> {\n    /**\n     * The **`desiredSize`** read-only property of the TransformStreamDefaultController interface returns the desired size to fill the queue of the associated ReadableStream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`enqueue()`** method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/enqueue)\n     */\n    enqueue(chunk?: O): void;\n    /**\n     * The **`error()`** method of the TransformStreamDefaultController interface errors both sides of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/error)\n     */\n    error(reason: any): void;\n    /**\n     * The **`terminate()`** method of the TransformStreamDefaultController interface closes the readable side and errors the writable side of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStreamDefaultController/terminate)\n     */\n    terminate(): void;\n}\ninterface ReadableWritablePair<R = any, W = any> {\n    readable: ReadableStream<R>;\n    /**\n     * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.\n     *\n     * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.\n     */\n    writable: WritableStream<W>;\n}\n/**\n * The **`WritableStream`** interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream)\n */\ndeclare class WritableStream<W = any> {\n    constructor(underlyingSink?: UnderlyingSink, queuingStrategy?: QueuingStrategy);\n    /**\n     * The **`locked`** read-only property of the WritableStream interface returns a boolean indicating whether the `WritableStream` is locked to a writer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/locked)\n     */\n    get locked(): boolean;\n    /**\n     * The **`abort()`** method of the WritableStream interface aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the WritableStream interface closes the associated stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`getWriter()`** method of the WritableStream interface returns a new instance of WritableStreamDefaultWriter and locks the stream to that instance.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStream/getWriter)\n     */\n    getWriter(): WritableStreamDefaultWriter<W>;\n}\n/**\n * The **`WritableStreamDefaultWriter`** interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the writer to the `WritableStream` ensuring that no other streams can write to the underlying sink.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter)\n */\ndeclare class WritableStreamDefaultWriter<W = any> {\n    constructor(stream: WritableStream);\n    /**\n     * The **`closed`** read-only property of the the stream errors or the writer's lock is released.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/closed)\n     */\n    get closed(): Promise<void>;\n    /**\n     * The **`ready`** read-only property of the that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/ready)\n     */\n    get ready(): Promise<void>;\n    /**\n     * The **`desiredSize`** read-only property of the to fill the stream's internal queue.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/desiredSize)\n     */\n    get desiredSize(): number | null;\n    /**\n     * The **`abort()`** method of the the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/abort)\n     */\n    abort(reason?: any): Promise<void>;\n    /**\n     * The **`close()`** method of the stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/close)\n     */\n    close(): Promise<void>;\n    /**\n     * The **`write()`** method of the operation.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/write)\n     */\n    write(chunk?: W): Promise<void>;\n    /**\n     * The **`releaseLock()`** method of the corresponding stream.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WritableStreamDefaultWriter/releaseLock)\n     */\n    releaseLock(): void;\n}\n/**\n * The **`TransformStream`** interface of the Streams API represents a concrete implementation of the pipe chain _transform stream_ concept.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream)\n */\ndeclare class TransformStream<I = any, O = any> {\n    constructor(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>);\n    /**\n     * The **`readable`** read-only property of the TransformStream interface returns the ReadableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/readable)\n     */\n    get readable(): ReadableStream<O>;\n    /**\n     * The **`writable`** read-only property of the TransformStream interface returns the WritableStream instance controlled by this `TransformStream`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TransformStream/writable)\n     */\n    get writable(): WritableStream<I>;\n}\ndeclare class FixedLengthStream extends IdentityTransformStream {\n    constructor(expectedLength: number | bigint, queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ndeclare class IdentityTransformStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(queuingStrategy?: IdentityTransformStreamQueuingStrategy);\n}\ninterface IdentityTransformStreamQueuingStrategy {\n    highWaterMark?: (number | bigint);\n}\ninterface ReadableStreamValuesOptions {\n    preventCancel?: boolean;\n}\n/**\n * The **`CompressionStream`** interface of the Compression Streams API is an API for compressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream)\n */\ndeclare class CompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`DecompressionStream`** interface of the Compression Streams API is an API for decompressing a stream of data.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream)\n */\ndeclare class DecompressionStream extends TransformStream<ArrayBuffer | ArrayBufferView, Uint8Array> {\n    constructor(format: \"gzip\" | \"deflate\" | \"deflate-raw\");\n}\n/**\n * The **`TextEncoderStream`** interface of the Encoding API converts a stream of strings into bytes in the UTF-8 encoding.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoderStream)\n */\ndeclare class TextEncoderStream extends TransformStream<string, Uint8Array> {\n    constructor();\n    get encoding(): string;\n}\n/**\n * The **`TextDecoderStream`** interface of the Encoding API converts a stream of text in a binary encoding, such as UTF-8 etc., to a stream of strings.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoderStream)\n */\ndeclare class TextDecoderStream extends TransformStream<ArrayBuffer | ArrayBufferView, string> {\n    constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);\n    get encoding(): string;\n    get fatal(): boolean;\n    get ignoreBOM(): boolean;\n}\ninterface TextDecoderStreamTextDecoderStreamInit {\n    fatal?: boolean;\n    ignoreBOM?: boolean;\n}\n/**\n * The **`ByteLengthQueuingStrategy`** interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy)\n */\ndeclare class ByteLengthQueuingStrategy implements QueuingStrategy<ArrayBufferView> {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\n/**\n * The **`CountQueuingStrategy`** interface of the Streams API provides a built-in chunk counting queuing strategy that can be used when constructing streams.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy)\n */\ndeclare class CountQueuingStrategy implements QueuingStrategy {\n    constructor(init: QueuingStrategyInit);\n    /**\n     * The read-only **`CountQueuingStrategy.highWaterMark`** property returns the total number of chunks that can be contained in the internal queue before backpressure is applied.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark)\n     */\n    get highWaterMark(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */\n    get size(): (chunk?: any) => number;\n}\ninterface QueuingStrategyInit {\n    /**\n     * Creates a new ByteLengthQueuingStrategy with the provided high water mark.\n     *\n     * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.\n     */\n    highWaterMark: number;\n}\ninterface ScriptVersion {\n    id?: string;\n    tag?: string;\n    message?: string;\n}\ndeclare abstract class TailEvent extends ExtendableEvent {\n    readonly events: TraceItem[];\n    readonly traces: TraceItem[];\n}\ninterface TraceItem {\n    readonly event: (TraceItemFetchEventInfo | TraceItemJsRpcEventInfo | TraceItemScheduledEventInfo | TraceItemAlarmEventInfo | TraceItemQueueEventInfo | TraceItemEmailEventInfo | TraceItemTailEventInfo | TraceItemCustomEventInfo | TraceItemHibernatableWebSocketEventInfo) | null;\n    readonly eventTimestamp: number | null;\n    readonly logs: TraceLog[];\n    readonly exceptions: TraceException[];\n    readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];\n    readonly scriptName: string | null;\n    readonly entrypoint?: string;\n    readonly scriptVersion?: ScriptVersion;\n    readonly dispatchNamespace?: string;\n    readonly scriptTags?: string[];\n    readonly durableObjectId?: string;\n    readonly outcome: string;\n    readonly executionModel: string;\n    readonly truncated: boolean;\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface TraceItemAlarmEventInfo {\n    readonly scheduledTime: Date;\n}\ninterface TraceItemCustomEventInfo {\n}\ninterface TraceItemScheduledEventInfo {\n    readonly scheduledTime: number;\n    readonly cron: string;\n}\ninterface TraceItemQueueEventInfo {\n    readonly queue: string;\n    readonly batchSize: number;\n}\ninterface TraceItemEmailEventInfo {\n    readonly mailFrom: string;\n    readonly rcptTo: string;\n    readonly rawSize: number;\n}\ninterface TraceItemTailEventInfo {\n    readonly consumedEvents: TraceItemTailEventInfoTailItem[];\n}\ninterface TraceItemTailEventInfoTailItem {\n    readonly scriptName: string | null;\n}\ninterface TraceItemFetchEventInfo {\n    readonly response?: TraceItemFetchEventInfoResponse;\n    readonly request: TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoRequest {\n    readonly cf?: any;\n    readonly headers: Record<string, string>;\n    readonly method: string;\n    readonly url: string;\n    getUnredacted(): TraceItemFetchEventInfoRequest;\n}\ninterface TraceItemFetchEventInfoResponse {\n    readonly status: number;\n}\ninterface TraceItemJsRpcEventInfo {\n    readonly rpcMethod: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfo {\n    readonly getWebSocketEvent: TraceItemHibernatableWebSocketEventInfoMessage | TraceItemHibernatableWebSocketEventInfoClose | TraceItemHibernatableWebSocketEventInfoError;\n}\ninterface TraceItemHibernatableWebSocketEventInfoMessage {\n    readonly webSocketEventType: string;\n}\ninterface TraceItemHibernatableWebSocketEventInfoClose {\n    readonly webSocketEventType: string;\n    readonly code: number;\n    readonly wasClean: boolean;\n}\ninterface TraceItemHibernatableWebSocketEventInfoError {\n    readonly webSocketEventType: string;\n}\ninterface TraceLog {\n    readonly timestamp: number;\n    readonly level: string;\n    readonly message: any;\n}\ninterface TraceException {\n    readonly timestamp: number;\n    readonly message: string;\n    readonly name: string;\n    readonly stack?: string;\n}\ninterface TraceDiagnosticChannelEvent {\n    readonly timestamp: number;\n    readonly channel: string;\n    readonly message: any;\n}\ninterface TraceMetrics {\n    readonly cpuTime: number;\n    readonly wallTime: number;\n}\ninterface UnsafeTraceMetrics {\n    fromTrace(item: TraceItem): TraceMetrics;\n}\n/**\n * The **`URL`** interface is used to parse, construct, normalize, and encode URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL)\n */\ndeclare class URL {\n    constructor(url: string | URL, base?: string | URL);\n    /**\n     * The **`origin`** read-only property of the URL interface returns a string containing the Unicode serialization of the origin of the represented URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin)\n     */\n    get origin(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    get href(): string;\n    /**\n     * The **`href`** property of the URL interface is a string containing the whole URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href)\n     */\n    set href(value: string);\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    get protocol(): string;\n    /**\n     * The **`protocol`** property of the URL interface is a string containing the protocol or scheme of the URL, including the final `':'`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol)\n     */\n    set protocol(value: string);\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    get username(): string;\n    /**\n     * The **`username`** property of the URL interface is a string containing the username component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username)\n     */\n    set username(value: string);\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    get password(): string;\n    /**\n     * The **`password`** property of the URL interface is a string containing the password component of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password)\n     */\n    set password(value: string);\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    get host(): string;\n    /**\n     * The **`host`** property of the URL interface is a string containing the host, which is the URL.hostname, and then, if the port of the URL is nonempty, a `':'`, followed by the URL.port of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host)\n     */\n    set host(value: string);\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    get hostname(): string;\n    /**\n     * The **`hostname`** property of the URL interface is a string containing either the domain name or IP address of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname)\n     */\n    set hostname(value: string);\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    get port(): string;\n    /**\n     * The **`port`** property of the URL interface is a string containing the port number of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port)\n     */\n    set port(value: string);\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    get pathname(): string;\n    /**\n     * The **`pathname`** property of the URL interface represents a location in a hierarchical structure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n     */\n    set pathname(value: string);\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    get search(): string;\n    /**\n     * The **`search`** property of the URL interface is a search string, also called a _query string_, that is a string containing a `'?'` followed by the parameters of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search)\n     */\n    set search(value: string);\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    get hash(): string;\n    /**\n     * The **`hash`** property of the URL interface is a string containing a `'#'` followed by the fragment identifier of the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash)\n     */\n    set hash(value: string);\n    /**\n     * The **`searchParams`** read-only property of the access to the [MISSING: httpmethod('GET')] decoded query arguments contained in the URL.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams)\n     */\n    get searchParams(): URLSearchParams;\n    /**\n     * The **`toJSON()`** method of the URL interface returns a string containing a serialized version of the URL, although in practice it seems to have the same effect as ```js-nolint toJSON() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON)\n     */\n    toJSON(): string;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    /**\n     * The **`URL.canParse()`** static method of the URL interface returns a boolean indicating whether or not an absolute URL, or a relative URL combined with a base URL, are parsable and valid.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static)\n     */\n    static canParse(url: string, base?: string): boolean;\n    /**\n     * The **`URL.parse()`** static method of the URL interface returns a newly created URL object representing the URL defined by the parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/parse_static)\n     */\n    static parse(url: string, base?: string): URL | null;\n    /**\n     * The **`createObjectURL()`** static method of the URL interface creates a string containing a URL representing the object given in the parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static)\n     */\n    static createObjectURL(object: File | Blob): string;\n    /**\n     * The **`revokeObjectURL()`** static method of the URL interface releases an existing object URL which was previously created by calling Call this method when you've finished using an object URL to let the browser know not to keep the reference to the file any longer.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static)\n     */\n    static revokeObjectURL(object_url: string): void;\n}\n/**\n * The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)\n */\ndeclare class URLSearchParams {\n    constructor(init?: (Iterable<Iterable<string>> | Record<string, string> | string));\n    /**\n     * The **`size`** read-only property of the URLSearchParams interface indicates the total number of search parameter entries.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size)\n     */\n    get size(): number;\n    /**\n     * The **`append()`** method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)\n     */\n    append(name: string, value: string): void;\n    /**\n     * The **`delete()`** method of the URLSearchParams interface deletes specified parameters and their associated value(s) from the list of all search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)\n     */\n    delete(name: string, value?: string): void;\n    /**\n     * The **`get()`** method of the URLSearchParams interface returns the first value associated to the given search parameter.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)\n     */\n    get(name: string): string | null;\n    /**\n     * The **`getAll()`** method of the URLSearchParams interface returns all the values associated with a given search parameter as an array.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)\n     */\n    getAll(name: string): string[];\n    /**\n     * The **`has()`** method of the URLSearchParams interface returns a boolean value that indicates whether the specified parameter is in the search parameters.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)\n     */\n    has(name: string, value?: string): boolean;\n    /**\n     * The **`set()`** method of the URLSearchParams interface sets the value associated with a given search parameter to the given value.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)\n     */\n    set(name: string, value: string): void;\n    /**\n     * The **`URLSearchParams.sort()`** method sorts all key/value pairs contained in this object in place and returns `undefined`.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort)\n     */\n    sort(): void;\n    /* Returns an array of key, value pairs for every entry in the search params. */\n    entries(): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n    /* Returns a list of keys in the search params. */\n    keys(): IterableIterator<string>;\n    /* Returns a list of values in the search params. */\n    values(): IterableIterator<string>;\n    forEach<This = unknown>(callback: (this: This, value: string, key: string, parent: URLSearchParams) => void, thisArg?: This): void;\n    /*function toString() { [native code] }*/\n    toString(): string;\n    [Symbol.iterator](): IterableIterator<[\n        key: string,\n        value: string\n    ]>;\n}\ndeclare class URLPattern {\n    constructor(input?: (string | URLPatternInit), baseURL?: (string | URLPatternOptions), patternOptions?: URLPatternOptions);\n    get protocol(): string;\n    get username(): string;\n    get password(): string;\n    get hostname(): string;\n    get port(): string;\n    get pathname(): string;\n    get search(): string;\n    get hash(): string;\n    get hasRegExpGroups(): boolean;\n    test(input?: (string | URLPatternInit), baseURL?: string): boolean;\n    exec(input?: (string | URLPatternInit), baseURL?: string): URLPatternResult | null;\n}\ninterface URLPatternInit {\n    protocol?: string;\n    username?: string;\n    password?: string;\n    hostname?: string;\n    port?: string;\n    pathname?: string;\n    search?: string;\n    hash?: string;\n    baseURL?: string;\n}\ninterface URLPatternComponentResult {\n    input: string;\n    groups: Record<string, string>;\n}\ninterface URLPatternResult {\n    inputs: (string | URLPatternInit)[];\n    protocol: URLPatternComponentResult;\n    username: URLPatternComponentResult;\n    password: URLPatternComponentResult;\n    hostname: URLPatternComponentResult;\n    port: URLPatternComponentResult;\n    pathname: URLPatternComponentResult;\n    search: URLPatternComponentResult;\n    hash: URLPatternComponentResult;\n}\ninterface URLPatternOptions {\n    ignoreCase?: boolean;\n}\n/**\n * A `CloseEvent` is sent to clients using WebSockets when the connection is closed.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent)\n */\ndeclare class CloseEvent extends Event {\n    constructor(type: string, initializer?: CloseEventInit);\n    /**\n     * The **`code`** read-only property of the CloseEvent interface returns a WebSocket connection close code indicating the reason the connection was closed.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code)\n     */\n    readonly code: number;\n    /**\n     * The **`reason`** read-only property of the CloseEvent interface returns the WebSocket connection close reason the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason)\n     */\n    readonly reason: string;\n    /**\n     * The **`wasClean`** read-only property of the CloseEvent interface returns `true` if the connection closed cleanly.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean)\n     */\n    readonly wasClean: boolean;\n}\ninterface CloseEventInit {\n    code?: number;\n    reason?: string;\n    wasClean?: boolean;\n}\ntype WebSocketEventMap = {\n    close: CloseEvent;\n    message: MessageEvent;\n    open: Event;\n    error: ErrorEvent;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ndeclare var WebSocket: {\n    prototype: WebSocket;\n    new (url: string, protocols?: (string[] | string)): WebSocket;\n    readonly READY_STATE_CONNECTING: number;\n    readonly CONNECTING: number;\n    readonly READY_STATE_OPEN: number;\n    readonly OPEN: number;\n    readonly READY_STATE_CLOSING: number;\n    readonly CLOSING: number;\n    readonly READY_STATE_CLOSED: number;\n    readonly CLOSED: number;\n};\n/**\n * The `WebSocket` object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)\n */\ninterface WebSocket extends EventTarget<WebSocketEventMap> {\n    accept(options?: WebSocketAcceptOptions): void;\n    /**\n     * The **`WebSocket.send()`** method enqueues the specified data to be transmitted to the server over the WebSocket connection, increasing the value of `bufferedAmount` by the number of bytes needed to contain the data.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/send)\n     */\n    send(message: (ArrayBuffer | ArrayBufferView) | string): void;\n    /**\n     * The **`WebSocket.close()`** method closes the already `CLOSED`, this method does nothing.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/close)\n     */\n    close(code?: number, reason?: string): void;\n    serializeAttachment(attachment: any): void;\n    deserializeAttachment(): any | null;\n    /**\n     * The **`WebSocket.readyState`** read-only property returns the current state of the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)\n     */\n    readyState: number;\n    /**\n     * The **`WebSocket.url`** read-only property returns the absolute URL of the WebSocket as resolved by the constructor.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)\n     */\n    url: string | null;\n    /**\n     * The **`WebSocket.protocol`** read-only property returns the name of the sub-protocol the server selected; this will be one of the strings specified in the `protocols` parameter when creating the WebSocket object, or the empty string if no connection is established.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)\n     */\n    protocol: string | null;\n    /**\n     * The **`WebSocket.extensions`** read-only property returns the extensions selected by the server.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)\n     */\n    extensions: string | null;\n    /**\n     * The **`WebSocket.binaryType`** property controls the type of binary data being received over the WebSocket connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/binaryType)\n     */\n    binaryType: \"blob\" | \"arraybuffer\";\n}\ninterface WebSocketAcceptOptions {\n    /**\n     * When set to `true`, receiving a server-initiated WebSocket Close frame will not\n     * automatically send a reciprocal Close frame, leaving the connection in a half-open\n     * state. This is useful for proxying scenarios where you need to coordinate closing\n     * both sides independently. Defaults to `false` when the\n     * `no_web_socket_half_open_by_default` compatibility flag is enabled.\n     */\n    allowHalfOpen?: boolean;\n}\ndeclare const WebSocketPair: {\n    new (): {\n        0: WebSocket;\n        1: WebSocket;\n    };\n};\ninterface SqlStorage {\n    exec<T extends Record<string, SqlStorageValue>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;\n    get databaseSize(): number;\n    Cursor: typeof SqlStorageCursor;\n    Statement: typeof SqlStorageStatement;\n}\ndeclare abstract class SqlStorageStatement {\n}\ntype SqlStorageValue = ArrayBuffer | string | number | null;\ndeclare abstract class SqlStorageCursor<T extends Record<string, SqlStorageValue>> {\n    next(): {\n        done?: false;\n        value: T;\n    } | {\n        done: true;\n        value?: never;\n    };\n    toArray(): T[];\n    one(): T;\n    raw<U extends SqlStorageValue[]>(): IterableIterator<U>;\n    columnNames: string[];\n    get rowsRead(): number;\n    get rowsWritten(): number;\n    [Symbol.iterator](): IterableIterator<T>;\n}\ninterface Socket {\n    get readable(): ReadableStream;\n    get writable(): WritableStream;\n    get closed(): Promise<void>;\n    get opened(): Promise<SocketInfo>;\n    get upgraded(): boolean;\n    get secureTransport(): \"on\" | \"off\" | \"starttls\";\n    close(): Promise<void>;\n    startTls(options?: TlsOptions): Socket;\n}\ninterface SocketOptions {\n    secureTransport?: string;\n    allowHalfOpen: boolean;\n    highWaterMark?: (number | bigint);\n}\ninterface SocketAddress {\n    hostname: string;\n    port: number;\n}\ninterface TlsOptions {\n    expectedServerHostname?: string;\n}\ninterface SocketInfo {\n    remoteAddress?: string;\n    localAddress?: string;\n}\n/**\n * The **`EventSource`** interface is web content's interface to server-sent events.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource)\n */\ndeclare class EventSource extends EventTarget {\n    constructor(url: string, init?: EventSourceEventSourceInit);\n    /**\n     * The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)\n     */\n    close(): void;\n    /**\n     * The **`url`** read-only property of the URL of the source.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)\n     */\n    get url(): string;\n    /**\n     * The **`withCredentials`** read-only property of the the `EventSource` object was instantiated with CORS credentials set.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)\n     */\n    get withCredentials(): boolean;\n    /**\n     * The **`readyState`** read-only property of the connection.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)\n     */\n    get readyState(): number;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    get onopen(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */\n    set onopen(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    get onmessage(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */\n    set onmessage(value: any | null);\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    get onerror(): any | null;\n    /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */\n    set onerror(value: any | null);\n    static readonly CONNECTING: number;\n    static readonly OPEN: number;\n    static readonly CLOSED: number;\n    static from(stream: ReadableStream): EventSource;\n}\ninterface EventSourceEventSourceInit {\n    withCredentials?: boolean;\n    fetcher?: Fetcher;\n}\ninterface Container {\n    get running(): boolean;\n    start(options?: ContainerStartupOptions): void;\n    monitor(): Promise<void>;\n    destroy(error?: any): Promise<void>;\n    signal(signo: number): void;\n    getTcpPort(port: number): Fetcher;\n    setInactivityTimeout(durationMs: number | bigint): Promise<void>;\n    interceptOutboundHttp(addr: string, binding: Fetcher): Promise<void>;\n    interceptAllOutboundHttp(binding: Fetcher): Promise<void>;\n}\ninterface ContainerStartupOptions {\n    entrypoint?: string[];\n    enableInternet: boolean;\n    env?: Record<string, string>;\n    hardTimeout?: (number | bigint);\n}\n/**\n * The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort)\n */\ndeclare abstract class MessagePort extends EventTarget {\n    /**\n     * The **`postMessage()`** method of the transfers ownership of objects to other browsing contexts.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)\n     */\n    postMessage(data?: any, options?: (any[] | MessagePortPostMessageOptions)): void;\n    /**\n     * The **`close()`** method of the MessagePort interface disconnects the port, so it is no longer active.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/close)\n     */\n    close(): void;\n    /**\n     * The **`start()`** method of the MessagePort interface starts the sending of messages queued on the port.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessagePort/start)\n     */\n    start(): void;\n    get onmessage(): any | null;\n    set onmessage(value: any | null);\n}\n/**\n * The **`MessageChannel`** interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties.\n *\n * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel)\n */\ndeclare class MessageChannel {\n    constructor();\n    /**\n     * The **`port1`** read-only property of the the port attached to the context that originated the channel.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)\n     */\n    readonly port1: MessagePort;\n    /**\n     * The **`port2`** read-only property of the the port attached to the context at the other end of the channel, which the message is initially sent to.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)\n     */\n    readonly port2: MessagePort;\n}\ninterface MessagePortPostMessageOptions {\n    transfer?: any[];\n}\ntype LoopbackForExport<T extends (new (...args: any[]) => Rpc.EntrypointBranded) | ExportedHandler<any, any, any> | undefined = undefined> = T extends new (...args: any[]) => Rpc.WorkerEntrypointBranded ? LoopbackServiceStub<InstanceType<T>> : T extends new (...args: any[]) => Rpc.DurableObjectBranded ? LoopbackDurableObjectClass<InstanceType<T>> : T extends ExportedHandler<any, any, any> ? LoopbackServiceStub<undefined> : undefined;\ntype LoopbackServiceStub<T extends Rpc.WorkerEntrypointBranded | undefined = undefined> = Fetcher<T> & (T extends CloudflareWorkersModule.WorkerEntrypoint<any, infer Props> ? (opts: {\n    props?: Props;\n}) => Fetcher<T> : (opts: {\n    props?: any;\n}) => Fetcher<T>);\ntype LoopbackDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined = undefined> = DurableObjectClass<T> & (T extends CloudflareWorkersModule.DurableObject<any, infer Props> ? (opts: {\n    props?: Props;\n}) => DurableObjectClass<T> : (opts: {\n    props?: any;\n}) => DurableObjectClass<T>);\ninterface SyncKvStorage {\n    get<T = unknown>(key: string): T | undefined;\n    list<T = unknown>(options?: SyncKvListOptions): Iterable<[\n        string,\n        T\n    ]>;\n    put<T>(key: string, value: T): void;\n    delete(key: string): boolean;\n}\ninterface SyncKvListOptions {\n    start?: string;\n    startAfter?: string;\n    end?: string;\n    prefix?: string;\n    reverse?: boolean;\n    limit?: number;\n}\ninterface WorkerStub {\n    getEntrypoint<T extends Rpc.WorkerEntrypointBranded | undefined>(name?: string, options?: WorkerStubEntrypointOptions): Fetcher<T>;\n}\ninterface WorkerStubEntrypointOptions {\n    props?: any;\n}\ninterface WorkerLoader {\n    get(name: string | null, getCode: () => WorkerLoaderWorkerCode | Promise<WorkerLoaderWorkerCode>): WorkerStub;\n    load(code: WorkerLoaderWorkerCode): WorkerStub;\n}\ninterface WorkerLoaderModule {\n    js?: string;\n    cjs?: string;\n    text?: string;\n    data?: ArrayBuffer;\n    json?: any;\n    py?: string;\n    wasm?: ArrayBuffer;\n}\ninterface WorkerLoaderWorkerCode {\n    compatibilityDate: string;\n    compatibilityFlags?: string[];\n    allowExperimental?: boolean;\n    mainModule: string;\n    modules: Record<string, WorkerLoaderModule | string>;\n    env?: any;\n    globalOutbound?: (Fetcher | null);\n    tails?: Fetcher[];\n    streamingTails?: Fetcher[];\n}\n/**\n* The Workers runtime supports a subset of the Performance API, used to measure timing and performance,\n* as well as timing of subrequests and other operations.\n*\n* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)\n*/\ndeclare abstract class Performance {\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancetimeorigin) */\n    get timeOrigin(): number;\n    /* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/#performancenow) */\n    now(): number;\n    /**\n     * The **`toJSON()`** method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.\n     *\n     * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/toJSON)\n     */\n    toJSON(): object;\n}\n// AI Search V2 API Error Interfaces\ninterface AiSearchInternalError extends Error {\n}\ninterface AiSearchNotFoundError extends Error {\n}\ninterface AiSearchNameNotSetError extends Error {\n}\n// AI Search V2 Request Types\ntype AiSearchSearchRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            /** Maximum number of results (1-50, default 10) */\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            /** Context expansion (0-3, default 0) */\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            /** Enable reranking (default false) */\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            /** Match threshold (0-1, default 0.4) */\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n};\ntype AiSearchChatCompletionsRequest = {\n    messages: Array<{\n        role: 'system' | 'developer' | 'user' | 'assistant' | 'tool';\n        content: string | null;\n    }>;\n    model?: string;\n    stream?: boolean;\n    ai_search_options?: {\n        retrieval?: {\n            retrieval_type?: 'vector' | 'keyword' | 'hybrid';\n            match_threshold?: number;\n            max_num_results?: number;\n            filters?: VectorizeVectorMetadataFilter;\n            context_expansion?: number;\n            [key: string]: unknown;\n        };\n        query_rewrite?: {\n            enabled?: boolean;\n            model?: string;\n            rewrite_prompt?: string;\n            [key: string]: unknown;\n        };\n        reranking?: {\n            enabled?: boolean;\n            model?: '@cf/baai/bge-reranker-base' | '';\n            match_threshold?: number;\n            [key: string]: unknown;\n        };\n        [key: string]: unknown;\n    };\n    [key: string]: unknown;\n};\n// AI Search V2 Response Types\ntype AiSearchSearchResponse = {\n    search_query: string;\n    chunks: Array<{\n        id: string;\n        type: string;\n        /** Match score (0-1) */\n        score: number;\n        text: string;\n        item: {\n            timestamp?: number;\n            key: string;\n            metadata?: Record<string, unknown>;\n        };\n        scoring_details?: {\n            /** Keyword match score (0-1) */\n            keyword_score?: number;\n            /** Vector similarity score (0-1) */\n            vector_score?: number;\n        };\n    }>;\n};\ntype AiSearchListResponse = Array<{\n    id: string;\n    internal_id?: string;\n    account_id?: string;\n    account_tag?: string;\n    /** Whether the instance is enabled (default true) */\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n}>;\ntype AiSearchConfig = {\n    /** Instance ID (1-32 chars, pattern: ^[a-z0-9_]+(?:-[a-z0-9_]+)*$) */\n    id: string;\n    type: 'r2' | 'web-crawler';\n    source: string;\n    source_params?: object;\n    /** Token ID (UUID format) */\n    token_id?: string;\n    ai_gateway_id?: string;\n    /** Enable query rewriting (default false) */\n    rewrite_query?: boolean;\n    /** Enable reranking (default false) */\n    reranking?: boolean;\n    embedding_model?: string;\n    ai_search_model?: string;\n};\ntype AiSearchInstance = {\n    id: string;\n    enable?: boolean;\n    type?: 'r2' | 'web-crawler';\n    source?: string;\n    [key: string]: unknown;\n};\n// AI Search Instance Service - Instance-level operations\ndeclare abstract class AiSearchInstanceService {\n    /**\n     * Search the AI Search instance for relevant chunks.\n     * @param params Search request with messages and AI search options\n     * @returns Search response with matching chunks\n     */\n    search(params: AiSearchSearchRequest): Promise<AiSearchSearchResponse>;\n    /**\n     * Generate chat completions with AI Search context.\n     * @param params Chat completions request with optional streaming\n     * @returns Response object (if streaming) or chat completion result\n     */\n    chatCompletions(params: AiSearchChatCompletionsRequest): Promise<Response | object>;\n    /**\n     * Delete this AI Search instance.\n     */\n    delete(): Promise<void>;\n}\n// AI Search Account Service - Account-level operations\ndeclare abstract class AiSearchAccountService {\n    /**\n     * List all AI Search instances in the account.\n     * @returns Array of AI Search instances\n     */\n    list(): Promise<AiSearchListResponse>;\n    /**\n     * Get an AI Search instance by ID.\n     * @param name Instance ID\n     * @returns Instance service for performing operations\n     */\n    get(name: string): AiSearchInstanceService;\n    /**\n     * Create a new AI Search instance.\n     * @param config Instance configuration\n     * @returns Instance service for performing operations\n     */\n    create(config: AiSearchConfig): Promise<AiSearchInstanceService>;\n}\ntype AiImageClassificationInput = {\n    image: number[];\n};\ntype AiImageClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiImageClassification {\n    inputs: AiImageClassificationInput;\n    postProcessedOutputs: AiImageClassificationOutput;\n}\ntype AiImageToTextInput = {\n    image: number[];\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageToText {\n    inputs: AiImageToTextInput;\n    postProcessedOutputs: AiImageToTextOutput;\n}\ntype AiImageTextToTextInput = {\n    image: string;\n    prompt?: string;\n    max_tokens?: number;\n    temperature?: number;\n    ignore_eos?: boolean;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    raw?: boolean;\n    messages?: RoleScopedChatInput[];\n};\ntype AiImageTextToTextOutput = {\n    description: string;\n};\ndeclare abstract class BaseAiImageTextToText {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiMultimodalEmbeddingsInput = {\n    image: string;\n    text: string[];\n};\ntype AiIMultimodalEmbeddingsOutput = {\n    data: number[][];\n    shape: number[];\n};\ndeclare abstract class BaseAiMultimodalEmbeddings {\n    inputs: AiImageTextToTextInput;\n    postProcessedOutputs: AiImageTextToTextOutput;\n}\ntype AiObjectDetectionInput = {\n    image: number[];\n};\ntype AiObjectDetectionOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiObjectDetection {\n    inputs: AiObjectDetectionInput;\n    postProcessedOutputs: AiObjectDetectionOutput;\n}\ntype AiSentenceSimilarityInput = {\n    source: string;\n    sentences: string[];\n};\ntype AiSentenceSimilarityOutput = number[];\ndeclare abstract class BaseAiSentenceSimilarity {\n    inputs: AiSentenceSimilarityInput;\n    postProcessedOutputs: AiSentenceSimilarityOutput;\n}\ntype AiAutomaticSpeechRecognitionInput = {\n    audio: number[];\n};\ntype AiAutomaticSpeechRecognitionOutput = {\n    text?: string;\n    words?: {\n        word: string;\n        start: number;\n        end: number;\n    }[];\n    vtt?: string;\n};\ndeclare abstract class BaseAiAutomaticSpeechRecognition {\n    inputs: AiAutomaticSpeechRecognitionInput;\n    postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;\n}\ntype AiSummarizationInput = {\n    input_text: string;\n    max_length?: number;\n};\ntype AiSummarizationOutput = {\n    summary: string;\n};\ndeclare abstract class BaseAiSummarization {\n    inputs: AiSummarizationInput;\n    postProcessedOutputs: AiSummarizationOutput;\n}\ntype AiTextClassificationInput = {\n    text: string;\n};\ntype AiTextClassificationOutput = {\n    score?: number;\n    label?: string;\n}[];\ndeclare abstract class BaseAiTextClassification {\n    inputs: AiTextClassificationInput;\n    postProcessedOutputs: AiTextClassificationOutput;\n}\ntype AiTextEmbeddingsInput = {\n    text: string | string[];\n};\ntype AiTextEmbeddingsOutput = {\n    shape: number[];\n    data: number[][];\n};\ndeclare abstract class BaseAiTextEmbeddings {\n    inputs: AiTextEmbeddingsInput;\n    postProcessedOutputs: AiTextEmbeddingsOutput;\n}\ntype RoleScopedChatInput = {\n    role: \"user\" | \"assistant\" | \"system\" | \"tool\" | (string & NonNullable<unknown>);\n    content: string;\n    name?: string;\n};\ntype AiTextGenerationToolLegacyInput = {\n    name: string;\n    description: string;\n    parameters?: {\n        type: \"object\" | (string & NonNullable<unknown>);\n        properties: {\n            [key: string]: {\n                type: string;\n                description?: string;\n            };\n        };\n        required: string[];\n    };\n};\ntype AiTextGenerationToolInput = {\n    type: \"function\" | (string & NonNullable<unknown>);\n    function: {\n        name: string;\n        description: string;\n        parameters?: {\n            type: \"object\" | (string & NonNullable<unknown>);\n            properties: {\n                [key: string]: {\n                    type: string;\n                    description?: string;\n                };\n            };\n            required: string[];\n        };\n    };\n};\ntype AiTextGenerationFunctionsInput = {\n    name: string;\n    code: string;\n};\ntype AiTextGenerationResponseFormat = {\n    type: string;\n    json_schema?: any;\n};\ntype AiTextGenerationInput = {\n    prompt?: string;\n    raw?: boolean;\n    stream?: boolean;\n    max_tokens?: number;\n    temperature?: number;\n    top_p?: number;\n    top_k?: number;\n    seed?: number;\n    repetition_penalty?: number;\n    frequency_penalty?: number;\n    presence_penalty?: number;\n    messages?: RoleScopedChatInput[];\n    response_format?: AiTextGenerationResponseFormat;\n    tools?: AiTextGenerationToolInput[] | AiTextGenerationToolLegacyInput[] | (object & NonNullable<unknown>);\n    functions?: AiTextGenerationFunctionsInput[];\n};\ntype AiTextGenerationToolLegacyOutput = {\n    name: string;\n    arguments: unknown;\n};\ntype AiTextGenerationToolOutput = {\n    id: string;\n    type: \"function\";\n    function: {\n        name: string;\n        arguments: string;\n    };\n};\ntype UsageTags = {\n    prompt_tokens: number;\n    completion_tokens: number;\n    total_tokens: number;\n};\ntype AiTextGenerationOutput = {\n    response?: string;\n    tool_calls?: AiTextGenerationToolLegacyOutput[] & AiTextGenerationToolOutput[];\n    usage?: UsageTags;\n};\ndeclare abstract class BaseAiTextGeneration {\n    inputs: AiTextGenerationInput;\n    postProcessedOutputs: AiTextGenerationOutput;\n}\ntype AiTextToSpeechInput = {\n    prompt: string;\n    lang?: string;\n};\ntype AiTextToSpeechOutput = Uint8Array | {\n    audio: string;\n};\ndeclare abstract class BaseAiTextToSpeech {\n    inputs: AiTextToSpeechInput;\n    postProcessedOutputs: AiTextToSpeechOutput;\n}\ntype AiTextToImageInput = {\n    prompt: string;\n    negative_prompt?: string;\n    height?: number;\n    width?: number;\n    image?: number[];\n    image_b64?: string;\n    mask?: number[];\n    num_steps?: number;\n    strength?: number;\n    guidance?: number;\n    seed?: number;\n};\ntype AiTextToImageOutput = ReadableStream<Uint8Array>;\ndeclare abstract class BaseAiTextToImage {\n    inputs: AiTextToImageInput;\n    postProcessedOutputs: AiTextToImageOutput;\n}\ntype AiTranslationInput = {\n    text: string;\n    target_lang: string;\n    source_lang?: string;\n};\ntype AiTranslationOutput = {\n    translated_text?: string;\n};\ndeclare abstract class BaseAiTranslation {\n    inputs: AiTranslationInput;\n    postProcessedOutputs: AiTranslationOutput;\n}\n/**\n * Workers AI support for OpenAI's Responses API\n * Reference: https://github.com/openai/openai-node/blob/master/src/resources/responses/responses.ts\n *\n * It's a stripped down version from its source.\n * It currently supports basic function calling, json mode and accepts images as input.\n *\n * It does not include types for WebSearch, CodeInterpreter, FileInputs, MCP, CustomTools.\n * We plan to add those incrementally as model + platform capabilities evolve.\n */\ntype ResponsesInput = {\n    background?: boolean | null;\n    conversation?: string | ResponseConversationParam | null;\n    include?: Array<ResponseIncludable> | null;\n    input?: string | ResponseInput;\n    instructions?: string | null;\n    max_output_tokens?: number | null;\n    parallel_tool_calls?: boolean | null;\n    previous_response_id?: string | null;\n    prompt_cache_key?: string;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    stream?: boolean | null;\n    stream_options?: StreamOptions | null;\n    temperature?: number | null;\n    text?: ResponseTextConfig;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    truncation?: \"auto\" | \"disabled\" | null;\n};\ntype ResponsesOutput = {\n    id?: string;\n    created_at?: number;\n    output_text?: string;\n    error?: ResponseError | null;\n    incomplete_details?: ResponseIncompleteDetails | null;\n    instructions?: string | Array<ResponseInputItem> | null;\n    object?: \"response\";\n    output?: Array<ResponseOutputItem>;\n    parallel_tool_calls?: boolean;\n    temperature?: number | null;\n    tool_choice?: ToolChoiceOptions | ToolChoiceFunction;\n    tools?: Array<Tool>;\n    top_p?: number | null;\n    max_output_tokens?: number | null;\n    previous_response_id?: string | null;\n    prompt?: ResponsePrompt | null;\n    reasoning?: Reasoning | null;\n    safety_identifier?: string;\n    service_tier?: \"auto\" | \"default\" | \"flex\" | \"scale\" | \"priority\" | null;\n    status?: ResponseStatus;\n    text?: ResponseTextConfig;\n    truncation?: \"auto\" | \"disabled\" | null;\n    usage?: ResponseUsage;\n};\ntype EasyInputMessage = {\n    content: string | ResponseInputMessageContentList;\n    role: \"user\" | \"assistant\" | \"system\" | \"developer\";\n    type?: \"message\";\n};\ntype ResponsesFunctionTool = {\n    name: string;\n    parameters: {\n        [key: string]: unknown;\n    } | null;\n    strict: boolean | null;\n    type: \"function\";\n    description?: string | null;\n};\ntype ResponseIncompleteDetails = {\n    reason?: \"max_output_tokens\" | \"content_filter\";\n};\ntype ResponsePrompt = {\n    id: string;\n    variables?: {\n        [key: string]: string | ResponseInputText | ResponseInputImage;\n    } | null;\n    version?: string | null;\n};\ntype Reasoning = {\n    effort?: ReasoningEffort | null;\n    generate_summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n    summary?: \"auto\" | \"concise\" | \"detailed\" | null;\n};\ntype ResponseContent = ResponseInputText | ResponseInputImage | ResponseOutputText | ResponseOutputRefusal | ResponseContentReasoningText;\ntype ResponseContentReasoningText = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseConversationParam = {\n    id: string;\n};\ntype ResponseCreatedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.created\";\n};\ntype ResponseCustomToolCallOutput = {\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"custom_tool_call_output\";\n    id?: string;\n};\ntype ResponseError = {\n    code: \"server_error\" | \"rate_limit_exceeded\" | \"invalid_prompt\" | \"vector_store_timeout\" | \"invalid_image\" | \"invalid_image_format\" | \"invalid_base64_image\" | \"invalid_image_url\" | \"image_too_large\" | \"image_too_small\" | \"image_parse_error\" | \"image_content_policy_violation\" | \"invalid_image_mode\" | \"image_file_too_large\" | \"unsupported_image_media_type\" | \"empty_image_file\" | \"failed_to_download_image\" | \"image_file_not_found\";\n    message: string;\n};\ntype ResponseErrorEvent = {\n    code: string | null;\n    message: string;\n    param: string | null;\n    sequence_number: number;\n    type: \"error\";\n};\ntype ResponseFailedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.failed\";\n};\ntype ResponseFormatText = {\n    type: \"text\";\n};\ntype ResponseFormatJSONObject = {\n    type: \"json_object\";\n};\ntype ResponseFormatTextConfig = ResponseFormatText | ResponseFormatTextJSONSchemaConfig | ResponseFormatJSONObject;\ntype ResponseFormatTextJSONSchemaConfig = {\n    name: string;\n    schema: {\n        [key: string]: unknown;\n    };\n    type: \"json_schema\";\n    description?: string;\n    strict?: boolean | null;\n};\ntype ResponseFunctionCallArgumentsDeltaEvent = {\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.delta\";\n};\ntype ResponseFunctionCallArgumentsDoneEvent = {\n    arguments: string;\n    item_id: string;\n    name: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.function_call_arguments.done\";\n};\ntype ResponseFunctionCallOutputItem = ResponseInputTextContent | ResponseInputImageContent;\ntype ResponseFunctionCallOutputItemList = Array<ResponseFunctionCallOutputItem>;\ntype ResponseFunctionToolCall = {\n    arguments: string;\n    call_id: string;\n    name: string;\n    type: \"function_call\";\n    id?: string;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ninterface ResponseFunctionToolCallItem extends ResponseFunctionToolCall {\n    id: string;\n}\ntype ResponseFunctionToolCallOutputItem = {\n    id: string;\n    call_id: string;\n    output: string | Array<ResponseInputText | ResponseInputImage>;\n    type: \"function_call_output\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseIncludable = \"message.input_image.image_url\" | \"message.output_text.logprobs\";\ntype ResponseIncompleteEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.incomplete\";\n};\ntype ResponseInput = Array<ResponseInputItem>;\ntype ResponseInputContent = ResponseInputText | ResponseInputImage;\ntype ResponseInputImage = {\n    detail: \"low\" | \"high\" | \"auto\";\n    type: \"input_image\";\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputImageContent = {\n    type: \"input_image\";\n    detail?: \"low\" | \"high\" | \"auto\" | null;\n    /**\n     * Base64 encoded image\n     */\n    image_url?: string | null;\n};\ntype ResponseInputItem = EasyInputMessage | ResponseInputItemMessage | ResponseOutputMessage | ResponseFunctionToolCall | ResponseInputItemFunctionCallOutput | ResponseReasoningItem;\ntype ResponseInputItemFunctionCallOutput = {\n    call_id: string;\n    output: string | ResponseFunctionCallOutputItemList;\n    type: \"function_call_output\";\n    id?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\" | null;\n};\ntype ResponseInputItemMessage = {\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputMessageContentList = Array<ResponseInputContent>;\ntype ResponseInputMessageItem = {\n    id: string;\n    content: ResponseInputMessageContentList;\n    role: \"user\" | \"system\" | \"developer\";\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n    type?: \"message\";\n};\ntype ResponseInputText = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseInputTextContent = {\n    text: string;\n    type: \"input_text\";\n};\ntype ResponseItem = ResponseInputMessageItem | ResponseOutputMessage | ResponseFunctionToolCallItem | ResponseFunctionToolCallOutputItem;\ntype ResponseOutputItem = ResponseOutputMessage | ResponseFunctionToolCall | ResponseReasoningItem;\ntype ResponseOutputItemAddedEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.added\";\n};\ntype ResponseOutputItemDoneEvent = {\n    item: ResponseOutputItem;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_item.done\";\n};\ntype ResponseOutputMessage = {\n    id: string;\n    content: Array<ResponseOutputText | ResponseOutputRefusal>;\n    role: \"assistant\";\n    status: \"in_progress\" | \"completed\" | \"incomplete\";\n    type: \"message\";\n};\ntype ResponseOutputRefusal = {\n    refusal: string;\n    type: \"refusal\";\n};\ntype ResponseOutputText = {\n    text: string;\n    type: \"output_text\";\n    logprobs?: Array<Logprob>;\n};\ntype ResponseReasoningItem = {\n    id: string;\n    summary: Array<ResponseReasoningSummaryItem>;\n    type: \"reasoning\";\n    content?: Array<ResponseReasoningContentItem>;\n    encrypted_content?: string | null;\n    status?: \"in_progress\" | \"completed\" | \"incomplete\";\n};\ntype ResponseReasoningSummaryItem = {\n    text: string;\n    type: \"summary_text\";\n};\ntype ResponseReasoningContentItem = {\n    text: string;\n    type: \"reasoning_text\";\n};\ntype ResponseReasoningTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.reasoning_text.delta\";\n};\ntype ResponseReasoningTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.reasoning_text.done\";\n};\ntype ResponseRefusalDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.refusal.delta\";\n};\ntype ResponseRefusalDoneEvent = {\n    content_index: number;\n    item_id: string;\n    output_index: number;\n    refusal: string;\n    sequence_number: number;\n    type: \"response.refusal.done\";\n};\ntype ResponseStatus = \"completed\" | \"failed\" | \"in_progress\" | \"cancelled\" | \"queued\" | \"incomplete\";\ntype ResponseStreamEvent = ResponseCompletedEvent | ResponseCreatedEvent | ResponseErrorEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseFailedEvent | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseReasoningTextDeltaEvent | ResponseReasoningTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent;\ntype ResponseCompletedEvent = {\n    response: Response;\n    sequence_number: number;\n    type: \"response.completed\";\n};\ntype ResponseTextConfig = {\n    format?: ResponseFormatTextConfig;\n    verbosity?: \"low\" | \"medium\" | \"high\" | null;\n};\ntype ResponseTextDeltaEvent = {\n    content_index: number;\n    delta: string;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    type: \"response.output_text.delta\";\n};\ntype ResponseTextDoneEvent = {\n    content_index: number;\n    item_id: string;\n    logprobs: Array<Logprob>;\n    output_index: number;\n    sequence_number: number;\n    text: string;\n    type: \"response.output_text.done\";\n};\ntype Logprob = {\n    token: string;\n    logprob: number;\n    top_logprobs?: Array<TopLogprob>;\n};\ntype TopLogprob = {\n    token?: string;\n    logprob?: number;\n};\ntype ResponseUsage = {\n    input_tokens: number;\n    output_tokens: number;\n    total_tokens: number;\n};\ntype Tool = ResponsesFunctionTool;\ntype ToolChoiceFunction = {\n    name: string;\n    type: \"function\";\n};\ntype ToolChoiceOptions = \"none\";\ntype ReasoningEffort = \"minimal\" | \"low\" | \"medium\" | \"high\" | null;\ntype StreamOptions = {\n    include_obfuscation?: boolean;\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Base_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Base_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Base_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Base_En_V1_5_Output;\n}\ntype Ai_Cf_Openai_Whisper_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper {\n    inputs: Ai_Cf_Openai_Whisper_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;\n}\ntype Ai_Cf_Meta_M2M100_1_2B_Input = {\n    /**\n     * The text to be translated\n     */\n    text: string;\n    /**\n     * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n     */\n    source_lang?: string;\n    /**\n     * The language code to translate the text into (e.g., 'es' for Spanish)\n     */\n    target_lang: string;\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        /**\n         * The text to be translated\n         */\n        text: string;\n        /**\n         * The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified\n         */\n        source_lang?: string;\n        /**\n         * The language code to translate the text into (e.g., 'es' for Spanish)\n         */\n        target_lang: string;\n    }[];\n};\ntype Ai_Cf_Meta_M2M100_1_2B_Output = {\n    /**\n     * The translated text in the target language\n     */\n    translated_text?: string;\n} | Ai_Cf_Meta_M2M100_1_2B_AsyncResponse;\ninterface Ai_Cf_Meta_M2M100_1_2B_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_M2M100_1_2B {\n    inputs: Ai_Cf_Meta_M2M100_1_2B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_M2M100_1_2B_Output;\n}\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Small_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Small_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Small_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Small_En_V1_5_Output;\n}\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Input = {\n    text: string | string[];\n    /**\n     * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: {\n        text: string | string[];\n        /**\n         * The pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.\n         */\n        pooling?: \"mean\" | \"cls\";\n    }[];\n};\ntype Ai_Cf_Baai_Bge_Large_En_V1_5_Output = {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n} | Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_Large_En_V1_5_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Large_En_V1_5 {\n    inputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Large_En_V1_5_Output;\n}\ntype Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input = string | {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt?: string;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    image: number[] | (string & NonNullable<unknown>);\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n};\ninterface Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output {\n    description?: string;\n}\ndeclare abstract class Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M {\n    inputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Input;\n    postProcessedOutputs: Ai_Cf_Unum_Uform_Gen2_Qwen_500M_Output;\n}\ntype Ai_Cf_Openai_Whisper_Tiny_En_Input = string | {\n    /**\n     * An array of integers that represent the audio data constrained to 8-bit unsigned integer values\n     */\n    audio: number[];\n};\ninterface Ai_Cf_Openai_Whisper_Tiny_En_Output {\n    /**\n     * The transcription\n     */\n    text: string;\n    word_count?: number;\n    words?: {\n        word?: string;\n        /**\n         * The second this word begins in the recording\n         */\n        start?: number;\n        /**\n         * The ending second when the word completes\n         */\n        end?: number;\n    }[];\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {\n    inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {\n    /**\n     * Base64 encoded value of the audio data.\n     */\n    audio: string;\n    /**\n     * Supported tasks are 'translate' or 'transcribe'.\n     */\n    task?: string;\n    /**\n     * The language of the audio being transcribed or translated.\n     */\n    language?: string;\n    /**\n     * Preprocess the audio with a voice activity detection model.\n     */\n    vad_filter?: boolean;\n    /**\n     * A text prompt to help provide context to the model on the contents of the audio.\n     */\n    initial_prompt?: string;\n    /**\n     * The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.\n     */\n    prefix?: string;\n}\ninterface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {\n    transcription_info?: {\n        /**\n         * The language of the audio being transcribed or translated.\n         */\n        language?: string;\n        /**\n         * The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.\n         */\n        language_probability?: number;\n        /**\n         * The total duration of the original audio file, in seconds.\n         */\n        duration?: number;\n        /**\n         * The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.\n         */\n        duration_after_vad?: number;\n    };\n    /**\n     * The complete transcription of the audio.\n     */\n    text: string;\n    /**\n     * The total number of words in the transcription.\n     */\n    word_count?: number;\n    segments?: {\n        /**\n         * The starting time of the segment within the audio, in seconds.\n         */\n        start?: number;\n        /**\n         * The ending time of the segment within the audio, in seconds.\n         */\n        end?: number;\n        /**\n         * The transcription of the segment.\n         */\n        text?: string;\n        /**\n         * The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.\n         */\n        temperature?: number;\n        /**\n         * The average log probability of the predictions for the words in this segment, indicating overall confidence.\n         */\n        avg_logprob?: number;\n        /**\n         * The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.\n         */\n        compression_ratio?: number;\n        /**\n         * The probability that the segment contains no speech, represented as a decimal between 0 and 1.\n         */\n        no_speech_prob?: number;\n        words?: {\n            /**\n             * The individual word transcribed from the audio.\n             */\n            word?: string;\n            /**\n             * The starting time of the word within the audio, in seconds.\n             */\n            start?: number;\n            /**\n             * The ending time of the word within the audio, in seconds.\n             */\n            end?: number;\n        }[];\n    }[];\n    /**\n     * The transcription in WebVTT format, which includes timing and text information for use in subtitles.\n     */\n    vtt?: string;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {\n    inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;\n    postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;\n}\ntype Ai_Cf_Baai_Bge_M3_Input = Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts | Ai_Cf_Baai_Bge_M3_Input_Embedding | {\n    /**\n     * Batch of the embeddings requests to run using async-queue\n     */\n    requests: (Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 | Ai_Cf_Baai_Bge_M3_Input_Embedding_1)[];\n};\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_QueryAnd_Contexts_1 {\n    /**\n     * A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts\n     */\n    query?: string;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ninterface Ai_Cf_Baai_Bge_M3_Input_Embedding_1 {\n    text: string | string[];\n    /**\n     * When provided with too long context should the model error out or truncate the context to fit?\n     */\n    truncate_inputs?: boolean;\n}\ntype Ai_Cf_Baai_Bge_M3_Output = Ai_Cf_Baai_Bge_M3_Ouput_Query | Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts | Ai_Cf_Baai_Bge_M3_Ouput_Embedding | Ai_Cf_Baai_Bge_M3_AsyncResponse;\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Query {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_M3_Output_EmbeddingFor_Contexts {\n    response?: number[][];\n    shape?: number[];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_Ouput_Embedding {\n    shape?: number[];\n    /**\n     * Embeddings of the requested text values\n     */\n    data?: number[][];\n    /**\n     * The pooling method used in the embedding process.\n     */\n    pooling?: \"mean\" | \"cls\";\n}\ninterface Ai_Cf_Baai_Bge_M3_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_M3 {\n    inputs: Ai_Cf_Baai_Bge_M3_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_M3_Output;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer.\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {\n    inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;\n    postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt | Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages;\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    image?: number[] | (string & NonNullable<unknown>);\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n}\ninterface Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    image?: number[] | (string & NonNullable<unknown>);\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * If true, the response will be streamed back incrementally.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response?: string;\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {\n    inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input = Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Async_Batch {\n    requests?: {\n        /**\n         * User-supplied reference. This field will be present in the response as well it can be used to reference the request and response. It's NOT validated to be unique.\n         */\n        external_reference?: string;\n        /**\n         * Prompt for the text generation model\n         */\n        prompt?: string;\n        /**\n         * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n         */\n        stream?: boolean;\n        /**\n         * The maximum number of tokens to generate in the response.\n         */\n        max_tokens?: number;\n        /**\n         * Controls the randomness of the output; higher values produce more random results.\n         */\n        temperature?: number;\n        /**\n         * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n         */\n        top_p?: number;\n        /**\n         * Random seed for reproducibility of the generation.\n         */\n        seed?: number;\n        /**\n         * Penalty for repeated tokens; higher values discourage repetition.\n         */\n        repetition_penalty?: number;\n        /**\n         * Decreases the likelihood of the model repeating the same lines verbatim.\n         */\n        frequency_penalty?: number;\n        /**\n         * Increases the likelihood of the model introducing new topics.\n         */\n        presence_penalty?: number;\n        response_format?: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2;\n    }[];\n}\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n} | string | Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse;\ninterface Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast {\n    inputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast_Output;\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Input {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender must alternate between 'user' and 'assistant'.\n         */\n        role: \"user\" | \"assistant\";\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Dictate the output format of the generated response.\n     */\n    response_format?: {\n        /**\n         * Set to json_object to process and output generated text as JSON.\n         */\n        type?: string;\n    };\n}\ninterface Ai_Cf_Meta_Llama_Guard_3_8B_Output {\n    response?: string | {\n        /**\n         * Whether the conversation is safe or not.\n         */\n        safe?: boolean;\n        /**\n         * A list of what hazard categories predicted for the conversation, if the conversation is deemed unsafe.\n         */\n        categories?: string[];\n    };\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ndeclare abstract class Base_Ai_Cf_Meta_Llama_Guard_3_8B {\n    inputs: Ai_Cf_Meta_Llama_Guard_3_8B_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_Guard_3_8B_Output;\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Input {\n    /**\n     * A query you wish to perform against the provided contexts.\n     */\n    /**\n     * Number of returned results starting with the best score.\n     */\n    top_k?: number;\n    /**\n     * List of provided contexts. Note that the index in this array is important, as the response will refer to it.\n     */\n    contexts: {\n        /**\n         * One of the provided context content\n         */\n        text?: string;\n    }[];\n}\ninterface Ai_Cf_Baai_Bge_Reranker_Base_Output {\n    response?: {\n        /**\n         * Index of the context in the request\n         */\n        id?: number;\n        /**\n         * Score of the context under the index.\n         */\n        score?: number;\n    }[];\n}\ndeclare abstract class Base_Ai_Cf_Baai_Bge_Reranker_Base {\n    inputs: Ai_Cf_Baai_Bge_Reranker_Base_Input;\n    postProcessedOutputs: Ai_Cf_Baai_Bge_Reranker_Base_Output;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input = Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt | Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages;\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct {\n    inputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Input = Ai_Cf_Qwen_Qwq_32B_Prompt | Ai_Cf_Qwen_Qwq_32B_Messages;\ninterface Ai_Cf_Qwen_Qwq_32B_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwq_32B_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Qwen_Qwq_32B_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Qwen_Qwq_32B {\n    inputs: Ai_Cf_Qwen_Qwq_32B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwq_32B_Output;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input = Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt | Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages;\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. Must be supplied for tool calls for Mistral-3. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct {\n    inputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct_Output;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Input = Ai_Cf_Google_Gemma_3_12B_It_Prompt | Ai_Cf_Google_Gemma_3_12B_It_Messages;\ninterface Ai_Cf_Google_Gemma_3_12B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Google_Gemma_3_12B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[];\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Google_Gemma_3_12B_It_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The arguments passed to be passed to the tool call request\n         */\n        arguments?: object;\n        /**\n         * The name of the tool to be called\n         */\n        name?: string;\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Google_Gemma_3_12B_It {\n    inputs: Ai_Cf_Google_Gemma_3_12B_It_Input;\n    postProcessedOutputs: Ai_Cf_Google_Gemma_3_12B_It_Output;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input = Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch;\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Async_Batch {\n    requests: (Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner | Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner)[];\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Prompt_Inner {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Messages_Inner {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role?: string;\n        /**\n         * The tool call id. If you don't know what to put here you can fall back to 000000001\n         */\n        tool_call_id?: string;\n        content?: string | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        }[] | {\n            /**\n             * Type of the content provided\n             */\n            type?: string;\n            text?: string;\n            image_url?: {\n                /**\n                 * image uri with data (e.g. data:image/jpeg;base64,/9j/...). HTTP URL will not be accepted\n                 */\n                url?: string;\n            };\n        };\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_JSON_Mode;\n    /**\n     * JSON schema that should be fulfilled for the response.\n     */\n    guided_json?: object;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ntype Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output = {\n    /**\n     * The generated text response from the model\n     */\n    response: string;\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * An array of tool calls requests made during the response generation\n     */\n    tool_calls?: {\n        /**\n         * The tool call id.\n         */\n        id?: string;\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type?: string;\n        /**\n         * Details of the function tool.\n         */\n        function?: {\n            /**\n             * The name of the tool to be called\n             */\n            name?: string;\n            /**\n             * The arguments passed to be passed to the tool call request\n             */\n            arguments?: object;\n        };\n    }[];\n};\ndeclare abstract class Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct {\n    inputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Input;\n    postProcessedOutputs: Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct_Output;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Async_Batch {\n    requests: (Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1)[];\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output = Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response | string | Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse;\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8 {\n    inputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8_Output;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Input {\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param.\n     */\n    custom_topic_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom topics you want the model to detect within your input audio or text if present Submit up to 100\n     */\n    custom_topic?: string;\n    /**\n     * Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in addition those submitted using the custom_intents param\n     */\n    custom_intent_mode?: \"extended\" | \"strict\";\n    /**\n     * Custom intents you want the model to detect within your input audio if present\n     */\n    custom_intent?: string;\n    /**\n     * Identifies and extracts key entities from content in submitted audio\n     */\n    detect_entities?: boolean;\n    /**\n     * Identifies the dominant language spoken in submitted audio\n     */\n    detect_language?: boolean;\n    /**\n     * Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0\n     */\n    diarize?: boolean;\n    /**\n     * Identify and extract key entities from content in submitted audio\n     */\n    dictation?: boolean;\n    /**\n     * Specify the expected encoding of your submitted audio\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"amr-nb\" | \"amr-wb\" | \"opus\" | \"speex\" | \"g729\";\n    /**\n     * Arbitrary key-value pairs that are attached to the API response for usage in downstream processing\n     */\n    extra?: string;\n    /**\n     * Filler Words can help transcribe interruptions in your audio, like 'uh' and 'um'\n     */\n    filler_words?: boolean;\n    /**\n     * Key term prompting can boost or suppress specialized terminology and brands.\n     */\n    keyterm?: string;\n    /**\n     * Keywords can boost or suppress specialized terminology and brands.\n     */\n    keywords?: string;\n    /**\n     * The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available.\n     */\n    language?: string;\n    /**\n     * Spoken measurements will be converted to their corresponding abbreviations.\n     */\n    measurements?: boolean;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip.\n     */\n    mip_opt_out?: boolean;\n    /**\n     * Mode of operation for the model representing broad area of topic that will be talked about in the supplied audio\n     */\n    mode?: \"general\" | \"medical\" | \"finance\";\n    /**\n     * Transcribe each audio channel independently.\n     */\n    multichannel?: boolean;\n    /**\n     * Numerals converts numbers from written format to numerical format.\n     */\n    numerals?: boolean;\n    /**\n     * Splits audio into paragraphs to improve transcript readability.\n     */\n    paragraphs?: boolean;\n    /**\n     * Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely.\n     */\n    profanity_filter?: boolean;\n    /**\n     * Add punctuation and capitalization to the transcript.\n     */\n    punctuate?: boolean;\n    /**\n     * Redaction removes sensitive information from your transcripts.\n     */\n    redact?: string;\n    /**\n     * Search for terms or phrases in submitted audio and replaces them.\n     */\n    replace?: string;\n    /**\n     * Search for terms or phrases in submitted audio.\n     */\n    search?: string;\n    /**\n     * Recognizes the sentiment throughout a transcript or text.\n     */\n    sentiment?: boolean;\n    /**\n     * Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability.\n     */\n    smart_format?: boolean;\n    /**\n     * Detect topics throughout a transcript or text.\n     */\n    topics?: boolean;\n    /**\n     * Segments speech into meaningful semantic units.\n     */\n    utterances?: boolean;\n    /**\n     * Seconds to wait before detecting a pause between words in submitted audio.\n     */\n    utt_split?: number;\n    /**\n     * The number of channels in the submitted audio\n     */\n    channels?: number;\n    /**\n     * Specifies whether the streaming endpoint should provide ongoing transcription updates as more audio is received. When set to true, the endpoint sends continuous updates, meaning transcription results may evolve over time. Note: Supported only for webosockets.\n     */\n    interim_results?: boolean;\n    /**\n     * Indicates how long model will wait to detect whether a speaker has finished speaking or pauses for a significant period of time. When set to a value, the streaming endpoint immediately finalizes the transcription for the processed time range and returns the transcript with a speech_final parameter set to true. Can also be set to false to disable endpointing\n     */\n    endpointing?: string;\n    /**\n     * Indicates that speech has started. You'll begin receiving Speech Started messages upon speech starting. Note: Supported only for webosockets.\n     */\n    vad_events?: boolean;\n    /**\n     * Indicates how long model will wait to send an UtteranceEnd message after a word has been transcribed. Use with interim_results. Note: Supported only for webosockets.\n     */\n    utterance_end_ms?: boolean;\n}\ninterface Ai_Cf_Deepgram_Nova_3_Output {\n    results?: {\n        channels?: {\n            alternatives?: {\n                confidence?: number;\n                transcript?: string;\n                words?: {\n                    confidence?: number;\n                    end?: number;\n                    start?: number;\n                    word?: string;\n                }[];\n            }[];\n        }[];\n        summary?: {\n            result?: string;\n            short?: string;\n        };\n        sentiments?: {\n            segments?: {\n                text?: string;\n                start_word?: number;\n                end_word?: number;\n                sentiment?: string;\n                sentiment_score?: number;\n            }[];\n            average?: {\n                sentiment?: string;\n                sentiment_score?: number;\n            };\n        };\n    };\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Nova_3 {\n    inputs: Ai_Cf_Deepgram_Nova_3_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Nova_3_Output;\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input {\n    queries?: string | string[];\n    /**\n     * Optional instruction for the task\n     */\n    instruction?: string;\n    documents?: string | string[];\n    text?: string | string[];\n}\ninterface Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output {\n    data?: number[][];\n    shape?: number[];\n}\ndeclare abstract class Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B {\n    inputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Input;\n    postProcessedOutputs: Ai_Cf_Qwen_Qwen3_Embedding_0_6B_Output;\n}\ntype Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input = {\n    /**\n     * readable stream with audio data and content-type specified for that data\n     */\n    audio: {\n        body: object;\n        contentType: string;\n    };\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n} | {\n    /**\n     * base64 encoded audio data\n     */\n    audio: string;\n    /**\n     * type of data PCM data that's sent to the inference server as raw array\n     */\n    dtype?: \"uint8\" | \"float32\" | \"float64\";\n};\ninterface Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output {\n    /**\n     * if true, end-of-turn was detected\n     */\n    is_complete?: boolean;\n    /**\n     * probability of the end-of-turn detection\n     */\n    probability?: number;\n}\ndeclare abstract class Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2 {\n    inputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Input;\n    postProcessedOutputs: Ai_Cf_Pipecat_Ai_Smart_Turn_V2_Output;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_120B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ndeclare abstract class Base_Ai_Cf_Openai_Gpt_Oss_20B {\n    inputs: ResponsesInput;\n    postProcessedOutputs: ResponsesOutput;\n}\ninterface Ai_Cf_Leonardo_Phoenix_1_0_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * Specify what to exclude from the generated images\n     */\n    negative_prompt?: string;\n}\n/**\n * The generated image in JPEG format\n */\ntype Ai_Cf_Leonardo_Phoenix_1_0_Output = string;\ndeclare abstract class Base_Ai_Cf_Leonardo_Phoenix_1_0 {\n    inputs: Ai_Cf_Leonardo_Phoenix_1_0_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Phoenix_1_0_Output;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Input {\n    /**\n     * A text description of the image you want to generate.\n     */\n    prompt: string;\n    /**\n     * Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt\n     */\n    guidance?: number;\n    /**\n     * Random seed for reproducibility of the image generation\n     */\n    seed?: number;\n    /**\n     * The height of the generated image in pixels\n     */\n    height?: number;\n    /**\n     * The width of the generated image in pixels\n     */\n    width?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    num_steps?: number;\n    /**\n     * The number of diffusion steps; higher values can improve quality but take longer\n     */\n    steps?: number;\n}\ninterface Ai_Cf_Leonardo_Lucid_Origin_Output {\n    /**\n     * The generated image in Base64 format.\n     */\n    image?: string;\n}\ndeclare abstract class Base_Ai_Cf_Leonardo_Lucid_Origin {\n    inputs: Ai_Cf_Leonardo_Lucid_Origin_Input;\n    postProcessedOutputs: Ai_Cf_Leonardo_Lucid_Origin_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_1_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"angus\" | \"asteria\" | \"arcas\" | \"orion\" | \"orpheus\" | \"athena\" | \"luna\" | \"zeus\" | \"perseus\" | \"helios\" | \"hera\" | \"stella\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_1_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_1 {\n    inputs: Ai_Cf_Deepgram_Aura_1_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_1_Output;\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input {\n    /**\n     * Input text to translate. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n    /**\n     * Target language to translate to\n     */\n    target_language: \"asm_Beng\" | \"awa_Deva\" | \"ben_Beng\" | \"bho_Deva\" | \"brx_Deva\" | \"doi_Deva\" | \"eng_Latn\" | \"gom_Deva\" | \"gon_Deva\" | \"guj_Gujr\" | \"hin_Deva\" | \"hne_Deva\" | \"kan_Knda\" | \"kas_Arab\" | \"kas_Deva\" | \"kha_Latn\" | \"lus_Latn\" | \"mag_Deva\" | \"mai_Deva\" | \"mal_Mlym\" | \"mar_Deva\" | \"mni_Beng\" | \"mni_Mtei\" | \"npi_Deva\" | \"ory_Orya\" | \"pan_Guru\" | \"san_Deva\" | \"sat_Olck\" | \"snd_Arab\" | \"snd_Deva\" | \"tam_Taml\" | \"tel_Telu\" | \"urd_Arab\" | \"unr_Deva\";\n}\ninterface Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output {\n    /**\n     * Translated texts\n     */\n    translations: string[];\n}\ndeclare abstract class Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B {\n    inputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Input;\n    postProcessedOutputs: Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B_Output;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_1 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Async_Batch {\n    requests: (Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1)[];\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Prompt_1 {\n    /**\n     * The input text prompt for the model to generate a response.\n     */\n    prompt: string;\n    /**\n     * Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.\n     */\n    lora?: string;\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_2 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Messages_1 {\n    /**\n     * An array of message objects representing the conversation history.\n     */\n    messages: {\n        /**\n         * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').\n         */\n        role: string;\n        /**\n         * The content of the message as a string.\n         */\n        content: string;\n    }[];\n    functions?: {\n        name: string;\n        code: string;\n    }[];\n    /**\n     * A list of tools available for the assistant to use.\n     */\n    tools?: ({\n        /**\n         * The name of the tool. More descriptive the better.\n         */\n        name: string;\n        /**\n         * A brief description of what the tool does.\n         */\n        description: string;\n        /**\n         * Schema defining the parameters accepted by the tool.\n         */\n        parameters: {\n            /**\n             * The type of the parameters object (usually 'object').\n             */\n            type: string;\n            /**\n             * List of required parameter names.\n             */\n            required?: string[];\n            /**\n             * Definitions of each parameter.\n             */\n            properties: {\n                [k: string]: {\n                    /**\n                     * The data type of the parameter.\n                     */\n                    type: string;\n                    /**\n                     * A description of the expected parameter.\n                     */\n                    description: string;\n                };\n            };\n        };\n    } | {\n        /**\n         * Specifies the type of tool (e.g., 'function').\n         */\n        type: string;\n        /**\n         * Details of the function tool.\n         */\n        function: {\n            /**\n             * The name of the function.\n             */\n            name: string;\n            /**\n             * A brief description of what the function does.\n             */\n            description: string;\n            /**\n             * Schema defining the parameters accepted by the function.\n             */\n            parameters: {\n                /**\n                 * The type of the parameters object (usually 'object').\n                 */\n                type: string;\n                /**\n                 * List of required parameter names.\n                 */\n                required?: string[];\n                /**\n                 * Definitions of each parameter.\n                 */\n                properties: {\n                    [k: string]: {\n                        /**\n                         * The data type of the parameter.\n                         */\n                        type: string;\n                        /**\n                         * A description of the expected parameter.\n                         */\n                        description: string;\n                    };\n                };\n            };\n        };\n    })[];\n    response_format?: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3;\n    /**\n     * If true, a chat template is not applied and you must adhere to the specific model's expected formatting.\n     */\n    raw?: boolean;\n    /**\n     * If true, the response will be streamed back incrementally using SSE, Server Sent Events.\n     */\n    stream?: boolean;\n    /**\n     * The maximum number of tokens to generate in the response.\n     */\n    max_tokens?: number;\n    /**\n     * Controls the randomness of the output; higher values produce more random results.\n     */\n    temperature?: number;\n    /**\n     * Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.\n     */\n    top_p?: number;\n    /**\n     * Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.\n     */\n    top_k?: number;\n    /**\n     * Random seed for reproducibility of the generation.\n     */\n    seed?: number;\n    /**\n     * Penalty for repeated tokens; higher values discourage repetition.\n     */\n    repetition_penalty?: number;\n    /**\n     * Decreases the likelihood of the model repeating the same lines verbatim.\n     */\n    frequency_penalty?: number;\n    /**\n     * Increases the likelihood of the model introducing new topics.\n     */\n    presence_penalty?: number;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_JSON_Mode_3 {\n    type?: \"json_object\" | \"json_schema\";\n    json_schema?: unknown;\n}\ntype Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output = Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response | string | Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse;\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Chat_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"chat.completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index?: number;\n        /**\n         * The message generated by the model\n         */\n        message?: {\n            /**\n             * Role of the message author\n             */\n            role: string;\n            /**\n             * The content of the message\n             */\n            content: string;\n            /**\n             * Internal reasoning content (if available)\n             */\n            reasoning_content?: string;\n            /**\n             * Tool calls made by the assistant\n             */\n            tool_calls?: {\n                /**\n                 * Unique identifier for the tool call\n                 */\n                id: string;\n                /**\n                 * Type of tool call\n                 */\n                type: \"function\";\n                function: {\n                    /**\n                     * Name of the function to call\n                     */\n                    name: string;\n                    /**\n                     * JSON string of arguments for the function\n                     */\n                    arguments: string;\n                };\n            }[];\n        };\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason?: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n    /**\n     * Log probabilities for the prompt (if requested)\n     */\n    prompt_logprobs?: {} | null;\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Text_Completion_Response {\n    /**\n     * Unique identifier for the completion\n     */\n    id?: string;\n    /**\n     * Object type identifier\n     */\n    object?: \"text_completion\";\n    /**\n     * Unix timestamp of when the completion was created\n     */\n    created?: number;\n    /**\n     * Model used for the completion\n     */\n    model?: string;\n    /**\n     * List of completion choices\n     */\n    choices?: {\n        /**\n         * Index of the choice in the list\n         */\n        index: number;\n        /**\n         * The generated text completion\n         */\n        text: string;\n        /**\n         * Reason why the model stopped generating\n         */\n        finish_reason: string;\n        /**\n         * Stop reason (may be null)\n         */\n        stop_reason?: string | null;\n        /**\n         * Log probabilities (if requested)\n         */\n        logprobs?: {} | null;\n        /**\n         * Log probabilities for the prompt (if requested)\n         */\n        prompt_logprobs?: {} | null;\n    }[];\n    /**\n     * Usage statistics for the inference request\n     */\n    usage?: {\n        /**\n         * Total number of tokens in input\n         */\n        prompt_tokens?: number;\n        /**\n         * Total number of tokens in output\n         */\n        completion_tokens?: number;\n        /**\n         * Total number of input and output tokens\n         */\n        total_tokens?: number;\n    };\n}\ninterface Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_AsyncResponse {\n    /**\n     * The async request id that can be used to obtain the results.\n     */\n    request_id?: string;\n}\ndeclare abstract class Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It {\n    inputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Input;\n    postProcessedOutputs: Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It_Output;\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Input {\n    /**\n     * Input text to embed. Can be a single string or a list of strings.\n     */\n    text: string | string[];\n}\ninterface Ai_Cf_Pfnet_Plamo_Embedding_1B_Output {\n    /**\n     * Embedding vectors, where each vector is a list of floats.\n     */\n    data: number[][];\n    /**\n     * Shape of the embedding data as [number_of_embeddings, embedding_dimension].\n     *\n     * @minItems 2\n     * @maxItems 2\n     */\n    shape: [\n        number,\n        number\n    ];\n}\ndeclare abstract class Base_Ai_Cf_Pfnet_Plamo_Embedding_1B {\n    inputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Input;\n    postProcessedOutputs: Ai_Cf_Pfnet_Plamo_Embedding_1B_Output;\n}\ninterface Ai_Cf_Deepgram_Flux_Input {\n    /**\n     * Encoding of the audio stream. Currently only supports raw signed little-endian 16-bit PCM.\n     */\n    encoding: \"linear16\";\n    /**\n     * Sample rate of the audio stream in Hz.\n     */\n    sample_rate: string;\n    /**\n     * End-of-turn confidence required to fire an eager end-of-turn event. When set, enables EagerEndOfTurn and TurnResumed events. Valid Values 0.3 - 0.9.\n     */\n    eager_eot_threshold?: string;\n    /**\n     * End-of-turn confidence required to finish a turn. Valid Values 0.5 - 0.9.\n     */\n    eot_threshold?: string;\n    /**\n     * A turn will be finished when this much time has passed after speech, regardless of EOT confidence.\n     */\n    eot_timeout_ms?: string;\n    /**\n     * Keyterm prompting can improve recognition of specialized terminology. Pass multiple keyterm query parameters to boost multiple keyterms.\n     */\n    keyterm?: string;\n    /**\n     * Opts out requests from the Deepgram Model Improvement Program. Refer to Deepgram Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip\n     */\n    mip_opt_out?: \"true\" | \"false\";\n    /**\n     * Label your requests for the purpose of identification during usage reporting\n     */\n    tag?: string;\n}\n/**\n * Output will be returned as websocket messages.\n */\ninterface Ai_Cf_Deepgram_Flux_Output {\n    /**\n     * The unique identifier of the request (uuid)\n     */\n    request_id?: string;\n    /**\n     * Starts at 0 and increments for each message the server sends to the client.\n     */\n    sequence_id?: number;\n    /**\n     * The type of event being reported.\n     */\n    event?: \"Update\" | \"StartOfTurn\" | \"EagerEndOfTurn\" | \"TurnResumed\" | \"EndOfTurn\";\n    /**\n     * The index of the current turn\n     */\n    turn_index?: number;\n    /**\n     * Start time in seconds of the audio range that was transcribed\n     */\n    audio_window_start?: number;\n    /**\n     * End time in seconds of the audio range that was transcribed\n     */\n    audio_window_end?: number;\n    /**\n     * Text that was said over the course of the current turn\n     */\n    transcript?: string;\n    /**\n     * The words in the transcript\n     */\n    words?: {\n        /**\n         * The individual punctuated, properly-cased word from the transcript\n         */\n        word: string;\n        /**\n         * Confidence that this word was transcribed correctly\n         */\n        confidence: number;\n    }[];\n    /**\n     * Confidence that no more speech is coming in this turn\n     */\n    end_of_turn_confidence?: number;\n}\ndeclare abstract class Base_Ai_Cf_Deepgram_Flux {\n    inputs: Ai_Cf_Deepgram_Flux_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Flux_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_En_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"amalthea\" | \"andromeda\" | \"apollo\" | \"arcas\" | \"aries\" | \"asteria\" | \"athena\" | \"atlas\" | \"aurora\" | \"callista\" | \"cora\" | \"cordelia\" | \"delia\" | \"draco\" | \"electra\" | \"harmonia\" | \"helena\" | \"hera\" | \"hermes\" | \"hyperion\" | \"iris\" | \"janus\" | \"juno\" | \"jupiter\" | \"luna\" | \"mars\" | \"minerva\" | \"neptune\" | \"odysseus\" | \"ophelia\" | \"orion\" | \"orpheus\" | \"pandora\" | \"phoebe\" | \"pluto\" | \"saturn\" | \"thalia\" | \"theia\" | \"vesta\" | \"zeus\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_En_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_En {\n    inputs: Ai_Cf_Deepgram_Aura_2_En_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_En_Output;\n}\ninterface Ai_Cf_Deepgram_Aura_2_Es_Input {\n    /**\n     * Speaker used to produce the audio.\n     */\n    speaker?: \"sirio\" | \"nestor\" | \"carina\" | \"celeste\" | \"alvaro\" | \"diana\" | \"aquila\" | \"selena\" | \"estrella\" | \"javier\";\n    /**\n     * Encoding of the output audio.\n     */\n    encoding?: \"linear16\" | \"flac\" | \"mulaw\" | \"alaw\" | \"mp3\" | \"opus\" | \"aac\";\n    /**\n     * Container specifies the file format wrapper for the output audio. The available options depend on the encoding type..\n     */\n    container?: \"none\" | \"wav\" | \"ogg\";\n    /**\n     * The text content to be converted to speech\n     */\n    text: string;\n    /**\n     * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable\n     */\n    sample_rate?: number;\n    /**\n     * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.\n     */\n    bit_rate?: number;\n}\n/**\n * The generated audio in MP3 format\n */\ntype Ai_Cf_Deepgram_Aura_2_Es_Output = string;\ndeclare abstract class Base_Ai_Cf_Deepgram_Aura_2_Es {\n    inputs: Ai_Cf_Deepgram_Aura_2_Es_Input;\n    postProcessedOutputs: Ai_Cf_Deepgram_Aura_2_Es_Output;\n}\ninterface AiModels {\n    \"@cf/huggingface/distilbert-sst-2-int8\": BaseAiTextClassification;\n    \"@cf/stabilityai/stable-diffusion-xl-base-1.0\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-inpainting\": BaseAiTextToImage;\n    \"@cf/runwayml/stable-diffusion-v1-5-img2img\": BaseAiTextToImage;\n    \"@cf/lykon/dreamshaper-8-lcm\": BaseAiTextToImage;\n    \"@cf/bytedance/stable-diffusion-xl-lightning\": BaseAiTextToImage;\n    \"@cf/myshell-ai/melotts\": BaseAiTextToSpeech;\n    \"@cf/google/embeddinggemma-300m\": BaseAiTextEmbeddings;\n    \"@cf/microsoft/resnet-50\": BaseAiImageClassification;\n    \"@cf/meta/llama-2-7b-chat-int8\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.1\": BaseAiTextGeneration;\n    \"@cf/meta/llama-2-7b-chat-fp16\": BaseAiTextGeneration;\n    \"@hf/thebloke/llama-2-13b-chat-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/mistral-7b-instruct-v0.1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/zephyr-7b-beta-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/openhermes-2.5-mistral-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/neural-chat-7b-v3-1-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/llamaguard-7b-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-base-awq\": BaseAiTextGeneration;\n    \"@hf/thebloke/deepseek-coder-6.7b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-math-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/defog/sqlcoder-7b-2\": BaseAiTextGeneration;\n    \"@cf/openchat/openchat-3.5-0106\": BaseAiTextGeneration;\n    \"@cf/tiiuae/falcon-7b-instruct\": BaseAiTextGeneration;\n    \"@cf/thebloke/discolm-german-7b-v1-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-0.5b-chat\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-7b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-14b-chat-awq\": BaseAiTextGeneration;\n    \"@cf/tinyllama/tinyllama-1.1b-chat-v1.0\": BaseAiTextGeneration;\n    \"@cf/microsoft/phi-2\": BaseAiTextGeneration;\n    \"@cf/qwen/qwen1.5-1.8b-chat\": BaseAiTextGeneration;\n    \"@cf/mistral/mistral-7b-instruct-v0.2-lora\": BaseAiTextGeneration;\n    \"@hf/nousresearch/hermes-2-pro-mistral-7b\": BaseAiTextGeneration;\n    \"@hf/nexusflow/starling-lm-7b-beta\": BaseAiTextGeneration;\n    \"@hf/google/gemma-7b-it\": BaseAiTextGeneration;\n    \"@cf/meta-llama/llama-2-7b-chat-hf-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-2b-it-lora\": BaseAiTextGeneration;\n    \"@cf/google/gemma-7b-it-lora\": BaseAiTextGeneration;\n    \"@hf/mistral/mistral-7b-instruct-v0.2\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct\": BaseAiTextGeneration;\n    \"@cf/fblgit/una-cybertron-7b-v2-bf16\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-fp8\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.1-8b-instruct-awq\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-3b-instruct\": BaseAiTextGeneration;\n    \"@cf/meta/llama-3.2-1b-instruct\": BaseAiTextGeneration;\n    \"@cf/deepseek-ai/deepseek-r1-distill-qwen-32b\": BaseAiTextGeneration;\n    \"@cf/ibm-granite/granite-4.0-h-micro\": BaseAiTextGeneration;\n    \"@cf/facebook/bart-large-cnn\": BaseAiSummarization;\n    \"@cf/llava-hf/llava-1.5-7b-hf\": BaseAiImageToText;\n    \"@cf/baai/bge-base-en-v1.5\": Base_Ai_Cf_Baai_Bge_Base_En_V1_5;\n    \"@cf/openai/whisper\": Base_Ai_Cf_Openai_Whisper;\n    \"@cf/meta/m2m100-1.2b\": Base_Ai_Cf_Meta_M2M100_1_2B;\n    \"@cf/baai/bge-small-en-v1.5\": Base_Ai_Cf_Baai_Bge_Small_En_V1_5;\n    \"@cf/baai/bge-large-en-v1.5\": Base_Ai_Cf_Baai_Bge_Large_En_V1_5;\n    \"@cf/unum/uform-gen2-qwen-500m\": Base_Ai_Cf_Unum_Uform_Gen2_Qwen_500M;\n    \"@cf/openai/whisper-tiny-en\": Base_Ai_Cf_Openai_Whisper_Tiny_En;\n    \"@cf/openai/whisper-large-v3-turbo\": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;\n    \"@cf/baai/bge-m3\": Base_Ai_Cf_Baai_Bge_M3;\n    \"@cf/black-forest-labs/flux-1-schnell\": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;\n    \"@cf/meta/llama-3.2-11b-vision-instruct\": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;\n    \"@cf/meta/llama-3.3-70b-instruct-fp8-fast\": Base_Ai_Cf_Meta_Llama_3_3_70B_Instruct_Fp8_Fast;\n    \"@cf/meta/llama-guard-3-8b\": Base_Ai_Cf_Meta_Llama_Guard_3_8B;\n    \"@cf/baai/bge-reranker-base\": Base_Ai_Cf_Baai_Bge_Reranker_Base;\n    \"@cf/qwen/qwen2.5-coder-32b-instruct\": Base_Ai_Cf_Qwen_Qwen2_5_Coder_32B_Instruct;\n    \"@cf/qwen/qwq-32b\": Base_Ai_Cf_Qwen_Qwq_32B;\n    \"@cf/mistralai/mistral-small-3.1-24b-instruct\": Base_Ai_Cf_Mistralai_Mistral_Small_3_1_24B_Instruct;\n    \"@cf/google/gemma-3-12b-it\": Base_Ai_Cf_Google_Gemma_3_12B_It;\n    \"@cf/meta/llama-4-scout-17b-16e-instruct\": Base_Ai_Cf_Meta_Llama_4_Scout_17B_16E_Instruct;\n    \"@cf/qwen/qwen3-30b-a3b-fp8\": Base_Ai_Cf_Qwen_Qwen3_30B_A3B_Fp8;\n    \"@cf/deepgram/nova-3\": Base_Ai_Cf_Deepgram_Nova_3;\n    \"@cf/qwen/qwen3-embedding-0.6b\": Base_Ai_Cf_Qwen_Qwen3_Embedding_0_6B;\n    \"@cf/pipecat-ai/smart-turn-v2\": Base_Ai_Cf_Pipecat_Ai_Smart_Turn_V2;\n    \"@cf/openai/gpt-oss-120b\": Base_Ai_Cf_Openai_Gpt_Oss_120B;\n    \"@cf/openai/gpt-oss-20b\": Base_Ai_Cf_Openai_Gpt_Oss_20B;\n    \"@cf/leonardo/phoenix-1.0\": Base_Ai_Cf_Leonardo_Phoenix_1_0;\n    \"@cf/leonardo/lucid-origin\": Base_Ai_Cf_Leonardo_Lucid_Origin;\n    \"@cf/deepgram/aura-1\": Base_Ai_Cf_Deepgram_Aura_1;\n    \"@cf/ai4bharat/indictrans2-en-indic-1B\": Base_Ai_Cf_Ai4Bharat_Indictrans2_En_Indic_1B;\n    \"@cf/aisingapore/gemma-sea-lion-v4-27b-it\": Base_Ai_Cf_Aisingapore_Gemma_Sea_Lion_V4_27B_It;\n    \"@cf/pfnet/plamo-embedding-1b\": Base_Ai_Cf_Pfnet_Plamo_Embedding_1B;\n    \"@cf/deepgram/flux\": Base_Ai_Cf_Deepgram_Flux;\n    \"@cf/deepgram/aura-2-en\": Base_Ai_Cf_Deepgram_Aura_2_En;\n    \"@cf/deepgram/aura-2-es\": Base_Ai_Cf_Deepgram_Aura_2_Es;\n}\ntype AiOptions = {\n    /**\n     * Send requests as an asynchronous batch job, only works for supported models\n     * https://developers.cloudflare.com/workers-ai/features/batch-api\n     */\n    queueRequest?: boolean;\n    /**\n     * Establish websocket connections, only works for supported models\n     */\n    websocket?: boolean;\n    /**\n     * Tag your requests to group and view them in Cloudflare dashboard.\n     *\n     * Rules:\n     * Tags must only contain letters, numbers, and the symbols: : - . / @\n     * Each tag can have maximum 50 characters.\n     * Maximum 5 tags are allowed each request.\n     * Duplicate tags will removed.\n     */\n    tags?: string[];\n    gateway?: GatewayOptions;\n    returnRawResponse?: boolean;\n    prefix?: string;\n    extraHeaders?: object;\n};\ntype AiModelsSearchParams = {\n    author?: string;\n    hide_experimental?: boolean;\n    page?: number;\n    per_page?: number;\n    search?: string;\n    source?: number;\n    task?: string;\n};\ntype AiModelsSearchObject = {\n    id: string;\n    source: number;\n    name: string;\n    description: string;\n    task: {\n        id: string;\n        name: string;\n        description: string;\n    };\n    tags: string[];\n    properties: {\n        property_id: string;\n        value: string;\n    }[];\n};\ninterface InferenceUpstreamError extends Error {\n}\ninterface AiInternalError extends Error {\n}\ntype AiModelListType = Record<string, any>;\ndeclare abstract class Ai<AiModelList extends AiModelListType = AiModels> {\n    aiGatewayLogId: string | null;\n    gateway(gatewayId: string): AiGateway;\n    /**\n     * Access the AI Search API for managing AI-powered search instances.\n     *\n     * This is the new API that replaces AutoRAG with better namespace separation:\n     * - Account-level operations: `list()`, `create()`\n     * - Instance-level operations: `get(id).search()`, `get(id).chatCompletions()`, `get(id).delete()`\n     *\n     * @example\n     * ```typescript\n     * // List all AI Search instances\n     * const instances = await env.AI.aiSearch.list();\n     *\n     * // Search an instance\n     * const results = await env.AI.aiSearch.get('my-search').search({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   ai_search_options: {\n     *     retrieval: { max_num_results: 10 }\n     *   }\n     * });\n     *\n     * // Generate chat completions with AI Search context\n     * const response = await env.AI.aiSearch.get('my-search').chatCompletions({\n     *   messages: [{ role: 'user', content: 'What is the policy?' }],\n     *   model: '@cf/meta/llama-3.3-70b-instruct-fp8-fast'\n     * });\n     * ```\n     */\n    aiSearch(): AiSearchAccountService;\n    /**\n     * @deprecated AutoRAG has been replaced by AI Search.\n     * Use `env.AI.aiSearch` instead for better API design and new features.\n     *\n     * Migration guide:\n     * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n     * - `env.AI.autorag('id').search({ query: '...' })` → `env.AI.aiSearch.get('id').search({ messages: [{ role: 'user', content: '...' }] })`\n     * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n     *\n     * Note: The old API continues to work for backwards compatibility, but new projects should use AI Search.\n     *\n     * @see AiSearchAccountService\n     * @param autoragId Optional instance ID (omit for account-level operations)\n     */\n    autorag(autoragId: string): AutoRAG;\n    run<Name extends keyof AiModelList, Options extends AiOptions, InputOptions extends AiModelList[Name][\"inputs\"]>(model: Name, inputs: InputOptions, options?: Options): Promise<Options extends {\n        returnRawResponse: true;\n    } | {\n        websocket: true;\n    } ? Response : InputOptions extends {\n        stream: true;\n    } ? ReadableStream : AiModelList[Name][\"postProcessedOutputs\"]>;\n    models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;\n    toMarkdown(): ToMarkdownService;\n    toMarkdown(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    toMarkdown(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n}\ntype GatewayRetries = {\n    maxAttempts?: 1 | 2 | 3 | 4 | 5;\n    retryDelayMs?: number;\n    backoff?: 'constant' | 'linear' | 'exponential';\n};\ntype GatewayOptions = {\n    id: string;\n    cacheKey?: string;\n    cacheTtl?: number;\n    skipCache?: boolean;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    collectLog?: boolean;\n    eventId?: string;\n    requestTimeoutMs?: number;\n    retries?: GatewayRetries;\n};\ntype UniversalGatewayOptions = Exclude<GatewayOptions, 'id'> & {\n    /**\n     ** @deprecated\n     */\n    id?: string;\n};\ntype AiGatewayPatchLog = {\n    score?: number | null;\n    feedback?: -1 | 1 | null;\n    metadata?: Record<string, number | string | boolean | null | bigint> | null;\n};\ntype AiGatewayLog = {\n    id: string;\n    provider: string;\n    model: string;\n    model_type?: string;\n    path: string;\n    duration: number;\n    request_type?: string;\n    request_content_type?: string;\n    status_code: number;\n    response_content_type?: string;\n    success: boolean;\n    cached: boolean;\n    tokens_in?: number;\n    tokens_out?: number;\n    metadata?: Record<string, number | string | boolean | null | bigint>;\n    step?: number;\n    cost?: number;\n    custom_cost?: boolean;\n    request_size: number;\n    request_head?: string;\n    request_head_complete: boolean;\n    response_size: number;\n    response_head?: string;\n    response_head_complete: boolean;\n    created_at: Date;\n};\ntype AIGatewayProviders = 'workers-ai' | 'anthropic' | 'aws-bedrock' | 'azure-openai' | 'google-vertex-ai' | 'huggingface' | 'openai' | 'perplexity-ai' | 'replicate' | 'groq' | 'cohere' | 'google-ai-studio' | 'mistral' | 'grok' | 'openrouter' | 'deepseek' | 'cerebras' | 'cartesia' | 'elevenlabs' | 'adobe-firefly';\ntype AIGatewayHeaders = {\n    'cf-aig-metadata': Record<string, number | string | boolean | null | bigint> | string;\n    'cf-aig-custom-cost': {\n        per_token_in?: number;\n        per_token_out?: number;\n    } | {\n        total_cost?: number;\n    } | string;\n    'cf-aig-cache-ttl': number | string;\n    'cf-aig-skip-cache': boolean | string;\n    'cf-aig-cache-key': string;\n    'cf-aig-event-id': string;\n    'cf-aig-request-timeout': number | string;\n    'cf-aig-max-attempts': number | string;\n    'cf-aig-retry-delay': number | string;\n    'cf-aig-backoff': string;\n    'cf-aig-collect-log': boolean | string;\n    Authorization: string;\n    'Content-Type': string;\n    [key: string]: string | number | boolean | object;\n};\ntype AIGatewayUniversalRequest = {\n    provider: AIGatewayProviders | string; // eslint-disable-line\n    endpoint: string;\n    headers: Partial<AIGatewayHeaders>;\n    query: unknown;\n};\ninterface AiGatewayInternalError extends Error {\n}\ninterface AiGatewayLogNotFound extends Error {\n}\ndeclare abstract class AiGateway {\n    patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;\n    getLog(logId: string): Promise<AiGatewayLog>;\n    run(data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[], options?: {\n        gateway?: UniversalGatewayOptions;\n        extraHeaders?: object;\n    }): Promise<Response>;\n    getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchInternalError instead.\n * @see AiSearchInternalError\n */\ninterface AutoRAGInternalError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNotFoundError instead.\n * @see AiSearchNotFoundError\n */\ninterface AutoRAGNotFoundError extends Error {\n}\n/**\n * @deprecated This error type is no longer used in the AI Search API.\n */\ninterface AutoRAGUnauthorizedError extends Error {\n}\n/**\n * @deprecated AutoRAG has been replaced by AI Search. Use AiSearchNameNotSetError instead.\n * @see AiSearchNameNotSetError\n */\ninterface AutoRAGNameNotSetError extends Error {\n}\ntype ComparisonFilter = {\n    key: string;\n    type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';\n    value: string | number | boolean;\n};\ntype CompoundFilter = {\n    type: 'and' | 'or';\n    filters: ComparisonFilter[];\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchRequest with the new API instead.\n * @see AiSearchSearchRequest\n */\ntype AutoRagSearchRequest = {\n    query: string;\n    filters?: CompoundFilter | ComparisonFilter;\n    max_num_results?: number;\n    ranking_options?: {\n        ranker?: string;\n        score_threshold?: number;\n    };\n    reranking?: {\n        enabled?: boolean;\n        model?: string;\n    };\n    rewrite_query?: boolean;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with the new API instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequest = AutoRagSearchRequest & {\n    stream?: boolean;\n    system_prompt?: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchChatCompletionsRequest with stream: true instead.\n * @see AiSearchChatCompletionsRequest\n */\ntype AutoRagAiSearchRequestStreaming = Omit<AutoRagAiSearchRequest, 'stream'> & {\n    stream: true;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchSearchResponse with the new API instead.\n * @see AiSearchSearchResponse\n */\ntype AutoRagSearchResponse = {\n    object: 'vector_store.search_results.page';\n    search_query: string;\n    data: {\n        file_id: string;\n        filename: string;\n        score: number;\n        attributes: Record<string, string | number | boolean | null>;\n        content: {\n            type: 'text';\n            text: string;\n        }[];\n    }[];\n    has_more: boolean;\n    next_page: string | null;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use AiSearchListResponse with the new API instead.\n * @see AiSearchListResponse\n */\ntype AutoRagListResponse = {\n    id: string;\n    enable: boolean;\n    type: string;\n    source: string;\n    vectorize_name: string;\n    paused: boolean;\n    status: string;\n}[];\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * The new API returns different response formats for chat completions.\n */\ntype AutoRagAiSearchResponse = AutoRagSearchResponse & {\n    response: string;\n};\n/**\n * @deprecated AutoRAG has been replaced by AI Search.\n * Use the new AI Search API instead: `env.AI.aiSearch`\n *\n * Migration guide:\n * - `env.AI.autorag().list()` → `env.AI.aiSearch.list()`\n * - `env.AI.autorag('id').search(...)` → `env.AI.aiSearch.get('id').search(...)`\n * - `env.AI.autorag('id').aiSearch(...)` → `env.AI.aiSearch.get('id').chatCompletions(...)`\n *\n * @see AiSearchAccountService\n * @see AiSearchInstanceService\n */\ndeclare abstract class AutoRAG {\n    /**\n     * @deprecated Use `env.AI.aiSearch.list()` instead.\n     * @see AiSearchAccountService.list\n     */\n    list(): Promise<AutoRagListResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).search(...)` instead.\n     * Note: The new API uses a messages array instead of a query string.\n     * @see AiSearchInstanceService.search\n     */\n    search(params: AutoRagSearchRequest): Promise<AutoRagSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequestStreaming): Promise<Response>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse>;\n    /**\n     * @deprecated Use `env.AI.aiSearch.get(id).chatCompletions(...)` instead.\n     * @see AiSearchInstanceService.chatCompletions\n     */\n    aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;\n}\ninterface BasicImageTransformations {\n    /**\n     * Maximum width in image pixels. The value must be an integer.\n     */\n    width?: number;\n    /**\n     * Maximum height in image pixels. The value must be an integer.\n     */\n    height?: number;\n    /**\n     * Resizing mode as a string. It affects interpretation of width and height\n     * options:\n     *  - scale-down: Similar to contain, but the image is never enlarged. If\n     *    the image is larger than given width or height, it will be resized.\n     *    Otherwise its original size will be kept.\n     *  - contain: Resizes to maximum size that fits within the given width and\n     *    height. If only a single dimension is given (e.g. only width), the\n     *    image will be shrunk or enlarged to exactly match that dimension.\n     *    Aspect ratio is always preserved.\n     *  - cover: Resizes (shrinks or enlarges) to fill the entire area of width\n     *    and height. If the image has an aspect ratio different from the ratio\n     *    of width and height, it will be cropped to fit.\n     *  - crop: The image will be shrunk and cropped to fit within the area\n     *    specified by width and height. The image will not be enlarged. For images\n     *    smaller than the given dimensions it's the same as scale-down. For\n     *    images larger than the given dimensions, it's the same as cover.\n     *    See also trim.\n     *  - pad: Resizes to the maximum size that fits within the given width and\n     *    height, and then fills the remaining area with a background color\n     *    (white by default). Use of this mode is not recommended, as the same\n     *    effect can be more efficiently achieved with the contain mode and the\n     *    CSS object-fit: contain property.\n     *  - squeeze: Stretches and deforms to the width and height given, even if it\n     *    breaks aspect ratio\n     */\n    fit?: \"scale-down\" | \"contain\" | \"cover\" | \"crop\" | \"pad\" | \"squeeze\";\n    /**\n     * Image segmentation using artificial intelligence models. Sets pixels not\n     * within selected segment area to transparent e.g \"foreground\" sets every\n     * background pixel as transparent.\n     */\n    segment?: \"foreground\";\n    /**\n     * When cropping with fit: \"cover\", this defines the side or point that should\n     * be left uncropped. The value is either a string\n     * \"left\", \"right\", \"top\", \"bottom\", \"auto\", or \"center\" (the default),\n     * or an object {x, y} containing focal point coordinates in the original\n     * image expressed as fractions ranging from 0.0 (top or left) to 1.0\n     * (bottom or right), 0.5 being the center. {fit: \"cover\", gravity: \"top\"} will\n     * crop bottom or left and right sides as necessary, but won’t crop anything\n     * from the top. {fit: \"cover\", gravity: {x:0.5, y:0.2}} will crop each side to\n     * preserve as much as possible around a point at 20% of the height of the\n     * source image.\n     */\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;\n    /**\n     * Background color to add underneath the image. Applies only to images with\n     * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),\n     * hsl(…), etc.)\n     */\n    background?: string;\n    /**\n     * Number of degrees (90, 180, 270) to rotate the image by. width and height\n     * options refer to axes after rotation.\n     */\n    rotate?: 0 | 90 | 180 | 270 | 360;\n}\ninterface BasicImageTransformationsGravityCoordinates {\n    x?: number;\n    y?: number;\n    mode?: 'remainder' | 'box-center';\n}\n/**\n * In addition to the properties you can set in the RequestInit dict\n * that you pass as an argument to the Request constructor, you can\n * set certain properties of a `cf` object to control how Cloudflare\n * features are applied to that new Request.\n *\n * Note: Currently, these properties cannot be tested in the\n * playground.\n */\ninterface RequestInitCfProperties extends Record<string, unknown> {\n    cacheEverything?: boolean;\n    /**\n     * A request's cache key is what determines if two requests are\n     * \"the same\" for caching purposes. If a request has the same cache key\n     * as some previous request, then we can serve the same cached response for\n     * both. (e.g. 'some-key')\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheKey?: string;\n    /**\n     * This allows you to append additional Cache-Tag response headers\n     * to the origin response without modifications to the origin server.\n     * This will allow for greater control over the Purge by Cache Tag feature\n     * utilizing changes only in the Workers process.\n     *\n     * Only available for Enterprise customers.\n     */\n    cacheTags?: string[];\n    /**\n     * Force response to be cached for a given number of seconds. (e.g. 300)\n     */\n    cacheTtl?: number;\n    /**\n     * Force response to be cached for a given number of seconds based on the Origin status code.\n     * (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })\n     */\n    cacheTtlByStatus?: Record<string, number>;\n    scrapeShield?: boolean;\n    apps?: boolean;\n    image?: RequestInitCfPropertiesImage;\n    minify?: RequestInitCfPropertiesImageMinify;\n    mirage?: boolean;\n    polish?: \"lossy\" | \"lossless\" | \"off\";\n    r2?: RequestInitCfPropertiesR2;\n    /**\n     * Redirects the request to an alternate origin server. You can use this,\n     * for example, to implement load balancing across several origins.\n     * (e.g.us-east.example.com)\n     *\n     * Note - For security reasons, the hostname set in resolveOverride must\n     * be proxied on the same Cloudflare zone of the incoming request.\n     * Otherwise, the setting is ignored. CNAME hosts are allowed, so to\n     * resolve to a host under a different domain or a DNS only domain first\n     * declare a CNAME record within your own zone’s DNS mapping to the\n     * external hostname, set proxy on Cloudflare, then set resolveOverride\n     * to point to that CNAME record.\n     */\n    resolveOverride?: string;\n}\ninterface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {\n    /**\n     * Absolute URL of the image file to use for the drawing. It can be any of\n     * the supported file formats. For drawing of watermarks or non-rectangular\n     * overlays we recommend using PNG or WebP images.\n     */\n    url: string;\n    /**\n     * Floating-point number between 0 (transparent) and 1 (opaque).\n     * For example, opacity: 0.5 makes overlay semitransparent.\n     */\n    opacity?: number;\n    /**\n     * - If set to true, the overlay image will be tiled to cover the entire\n     *   area. This is useful for stock-photo-like watermarks.\n     * - If set to \"x\", the overlay image will be tiled horizontally only\n     *   (form a line).\n     * - If set to \"y\", the overlay image will be tiled vertically only\n     *   (form a line).\n     */\n    repeat?: true | \"x\" | \"y\";\n    /**\n     * Position of the overlay image relative to a given edge. Each property is\n     * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10\n     * positions left side of the overlay 10 pixels from the left edge of the\n     * image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom\n     * of the background image.\n     *\n     * Setting both left & right, or both top & bottom is an error.\n     *\n     * If no position is specified, the image will be centered.\n     */\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n}\ninterface RequestInitCfPropertiesImage extends BasicImageTransformations {\n    /**\n     * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it\n     * easier to specify higher-DPI sizes in <img srcset>.\n     */\n    dpr?: number;\n    /**\n     * Allows you to trim your image. Takes dpr into account and is performed before\n     * resizing or rotation.\n     *\n     * It can be used as:\n     * - left, top, right, bottom - it will specify the number of pixels to cut\n     *   off each side\n     * - width, height - the width/height you'd like to end up with - can be used\n     *   in combination with the properties above\n     * - border - this will automatically trim the surroundings of an image based on\n     *   it's color. It consists of three properties:\n     *    - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)\n     *    - tolerance: difference from color to treat as color\n     *    - keep: the number of pixels of border to keep\n     */\n    trim?: \"border\" | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n    /**\n     * Quality setting from 1-100 (useful values are in 60-90 range). Lower values\n     * make images look worse, but load faster. The default is 85. It applies only\n     * to JPEG and WebP images. It doesn’t have any effect on PNG.\n     */\n    quality?: number | \"low\" | \"medium-low\" | \"medium-high\" | \"high\";\n    /**\n     * Output format to generate. It can be:\n     *  - avif: generate images in AVIF format.\n     *  - webp: generate images in Google WebP format. Set quality to 100 to get\n     *    the WebP-lossless format.\n     *  - json: instead of generating an image, outputs information about the\n     *    image, in JSON format. The JSON object will contain image size\n     *    (before and after resizing), source image’s MIME type, file size, etc.\n     * - jpeg: generate images in JPEG format.\n     * - png: generate images in PNG format.\n     */\n    format?: \"avif\" | \"webp\" | \"json\" | \"jpeg\" | \"png\" | \"baseline-jpeg\" | \"png-force\" | \"svg\";\n    /**\n     * Whether to preserve animation frames from input files. Default is true.\n     * Setting it to false reduces animations to still images. This setting is\n     * recommended when enlarging images or processing arbitrary user content,\n     * because large GIF animations can weigh tens or even hundreds of megabytes.\n     * It is also useful to set anim:false when using format:\"json\" to get the\n     * response quicker without the number of frames.\n     */\n    anim?: boolean;\n    /**\n     * What EXIF data should be preserved in the output image. Note that EXIF\n     * rotation and embedded color profiles are always applied (\"baked in\" into\n     * the image), and aren't affected by this option. Note that if the Polish\n     * feature is enabled, all metadata may have been removed already and this\n     * option may have no effect.\n     *  - keep: Preserve most of EXIF metadata, including GPS location if there's\n     *    any.\n     *  - copyright: Only keep the copyright tag, and discard everything else.\n     *    This is the default behavior for JPEG files.\n     *  - none: Discard all invisible EXIF metadata. Currently WebP and PNG\n     *    output formats always discard metadata.\n     */\n    metadata?: \"keep\" | \"copyright\" | \"none\";\n    /**\n     * Strength of sharpening filter to apply to the image. Floating-point\n     * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a\n     * recommended value for downscaled images.\n     */\n    sharpen?: number;\n    /**\n     * Radius of a blur filter (approximate gaussian). Maximum supported radius\n     * is 250.\n     */\n    blur?: number;\n    /**\n     * Overlays are drawn in the order they appear in the array (last array\n     * entry is the topmost layer).\n     */\n    draw?: RequestInitCfPropertiesImageDraw[];\n    /**\n     * Fetching image from authenticated origin. Setting this property will\n     * pass authentication headers (Authorization, Cookie, etc.) through to\n     * the origin.\n     */\n    \"origin-auth\"?: \"share-publicly\";\n    /**\n     * Adds a border around the image. The border is added after resizing. Border\n     * width takes dpr into account, and can be specified either using a single\n     * width property, or individually for each side.\n     */\n    border?: {\n        color: string;\n        width: number;\n    } | {\n        color: string;\n        top: number;\n        right: number;\n        bottom: number;\n        left: number;\n    };\n    /**\n     * Increase brightness by a factor. A value of 1.0 equals no change, a value\n     * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.\n     * 0 is ignored.\n     */\n    brightness?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    contrast?: number;\n    /**\n     * Increase exposure by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.\n     */\n    gamma?: number;\n    /**\n     * Increase contrast by a factor. A value of 1.0 equals no change, a value of\n     * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is\n     * ignored.\n     */\n    saturation?: number;\n    /**\n     * Flips the images horizontally, vertically, or both. Flipping is applied before\n     * rotation, so if you apply flip=h,rotate=90 then the image will be flipped\n     * horizontally, then rotated by 90 degrees.\n     */\n    flip?: 'h' | 'v' | 'hv';\n    /**\n     * Slightly reduces latency on a cache miss by selecting a\n     * quickest-to-compress file format, at a cost of increased file size and\n     * lower image quality. It will usually override the format option and choose\n     * JPEG over WebP or AVIF. We do not recommend using this option, except in\n     * unusual circumstances like resizing uncacheable dynamically-generated\n     * images.\n     */\n    compression?: \"fast\";\n}\ninterface RequestInitCfPropertiesImageMinify {\n    javascript?: boolean;\n    css?: boolean;\n    html?: boolean;\n}\ninterface RequestInitCfPropertiesR2 {\n    /**\n     * Colo id of bucket that an object is stored in\n     */\n    bucketColoId?: number;\n}\n/**\n * Request metadata provided by Cloudflare's edge.\n */\ntype IncomingRequestCfProperties<HostMetadata = unknown> = IncomingRequestCfPropertiesBase & IncomingRequestCfPropertiesBotManagementEnterprise & IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> & IncomingRequestCfPropertiesGeographicInformation & IncomingRequestCfPropertiesCloudflareAccessOrApiShield;\ninterface IncomingRequestCfPropertiesBase extends Record<string, unknown> {\n    /**\n     * [ASN](https://www.iana.org/assignments/as-numbers/as-numbers.xhtml) of the incoming request.\n     *\n     * @example 395747\n     */\n    asn?: number;\n    /**\n     * The organization which owns the ASN of the incoming request.\n     *\n     * @example \"Google Cloud\"\n     */\n    asOrganization?: string;\n    /**\n     * The original value of the `Accept-Encoding` header if Cloudflare modified it.\n     *\n     * @example \"gzip, deflate, br\"\n     */\n    clientAcceptEncoding?: string;\n    /**\n     * The number of milliseconds it took for the request to reach your worker.\n     *\n     * @example 22\n     */\n    clientTcpRtt?: number;\n    /**\n     * The three-letter [IATA](https://en.wikipedia.org/wiki/IATA_airport_code)\n     * airport code of the data center that the request hit.\n     *\n     * @example \"DFW\"\n     */\n    colo: string;\n    /**\n     * Represents the upstream's response to a\n     * [TCP `keepalive` message](https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/overview.html)\n     * from cloudflare.\n     *\n     * For workers with no upstream, this will always be `1`.\n     *\n     * @example 3\n     */\n    edgeRequestKeepAliveStatus: IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus;\n    /**\n     * The HTTP Protocol the request used.\n     *\n     * @example \"HTTP/2\"\n     */\n    httpProtocol: string;\n    /**\n     * The browser-requested prioritization information in the request object.\n     *\n     * If no information was set, defaults to the empty string `\"\"`\n     *\n     * @example \"weight=192;exclusive=0;group=3;group-weight=127\"\n     * @default \"\"\n     */\n    requestPriority: string;\n    /**\n     * The TLS version of the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"TLSv1.3\"\n     */\n    tlsVersion: string;\n    /**\n     * The cipher for the connection to Cloudflare.\n     * In requests served over plaintext (without TLS), this property is the empty string `\"\"`.\n     *\n     * @example \"AEAD-AES128-GCM-SHA256\"\n     */\n    tlsCipher: string;\n    /**\n     * Metadata containing the [`HELLO`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2) and [`FINISHED`](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9) messages from this request's TLS handshake.\n     *\n     * If the incoming request was served over plaintext (without TLS) this field is undefined.\n     */\n    tlsExportedAuthenticator?: IncomingRequestCfPropertiesExportedAuthenticatorMetadata;\n}\ninterface IncomingRequestCfPropertiesBotManagementBase {\n    /**\n     * Cloudflare’s [level of certainty](https://developers.cloudflare.com/bots/concepts/bot-score/) that a request comes from a bot,\n     * represented as an integer percentage between `1` (almost certainly a bot) and `99` (almost certainly human).\n     *\n     * @example 54\n     */\n    score: number;\n    /**\n     * A boolean value that is true if the request comes from a good bot, like Google or Bing.\n     * Most customers choose to allow this traffic. For more details, see [Traffic from known bots](https://developers.cloudflare.com/firewall/known-issues-and-faq/#how-does-firewall-rules-handle-traffic-from-known-bots).\n     */\n    verifiedBot: boolean;\n    /**\n     * A boolean value that is true if the request originates from a\n     * Cloudflare-verified proxy service.\n     */\n    corporateProxy: boolean;\n    /**\n     * A boolean value that's true if the request matches [file extensions](https://developers.cloudflare.com/bots/reference/static-resources/) for many types of static resources.\n     */\n    staticResource: boolean;\n    /**\n     * List of IDs that correlate to the Bot Management heuristic detections made on a request (you can have multiple heuristic detections on the same request).\n     */\n    detectionIds: number[];\n}\ninterface IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase;\n    /**\n     * Duplicate of `botManagement.score`.\n     *\n     * @deprecated\n     */\n    clientTrustScore: number;\n}\ninterface IncomingRequestCfPropertiesBotManagementEnterprise extends IncomingRequestCfPropertiesBotManagement {\n    /**\n     * Results of Cloudflare's Bot Management analysis\n     */\n    botManagement: IncomingRequestCfPropertiesBotManagementBase & {\n        /**\n         * A [JA3 Fingerprint](https://developers.cloudflare.com/bots/concepts/ja3-fingerprint/) to help profile specific SSL/TLS clients\n         * across different destination IPs, Ports, and X509 certificates.\n         */\n        ja3Hash: string;\n    };\n}\ninterface IncomingRequestCfPropertiesCloudflareForSaaSEnterprise<HostMetadata> {\n    /**\n     * Custom metadata set per-host in [Cloudflare for SaaS](https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/).\n     *\n     * This field is only present if you have Cloudflare for SaaS enabled on your account\n     * and you have followed the [required steps to enable it]((https://developers.cloudflare.com/cloudflare-for-platforms/cloudflare-for-saas/domain-support/custom-metadata/)).\n     */\n    hostMetadata?: HostMetadata;\n}\ninterface IncomingRequestCfPropertiesCloudflareAccessOrApiShield {\n    /**\n     * Information about the client certificate presented to Cloudflare.\n     *\n     * This is populated when the incoming request is served over TLS using\n     * either Cloudflare Access or API Shield (mTLS)\n     * and the presented SSL certificate has a valid\n     * [Certificate Serial Number](https://ldapwiki.com/wiki/Certificate%20Serial%20Number)\n     * (i.e., not `null` or `\"\"`).\n     *\n     * Otherwise, a set of placeholder values are used.\n     *\n     * The property `certPresented` will be set to `\"1\"` when\n     * the object is populated (i.e. the above conditions were met).\n     */\n    tlsClientAuth: IncomingRequestCfPropertiesTLSClientAuth | IncomingRequestCfPropertiesTLSClientAuthPlaceholder;\n}\n/**\n * Metadata about the request's TLS handshake\n */\ninterface IncomingRequestCfPropertiesExportedAuthenticatorMetadata {\n    /**\n     * The client's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    clientHandshake: string;\n    /**\n     * The server's [`HELLO` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.2), encoded in hexadecimal\n     *\n     * @example \"44372ba35fa1270921d318f34c12f155dc87b682cf36a790cfaa3ba8737a1b5d\"\n     */\n    serverHandshake: string;\n    /**\n     * The client's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    clientFinished: string;\n    /**\n     * The server's [`FINISHED` message](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.9), encoded in hexadecimal\n     *\n     * @example \"084ee802fe1348f688220e2a6040a05b2199a761f33cf753abb1b006792d3f8b\"\n     */\n    serverFinished: string;\n}\n/**\n * Geographic data about the request's origin.\n */\ninterface IncomingRequestCfPropertiesGeographicInformation {\n    /**\n     * The [ISO 3166-1 Alpha 2](https://www.iso.org/iso-3166-country-codes.html) country code the request originated from.\n     *\n     * If your worker is [configured to accept TOR connections](https://support.cloudflare.com/hc/en-us/articles/203306930-Understanding-Cloudflare-Tor-support-and-Onion-Routing), this may also be `\"T1\"`, indicating a request that originated over TOR.\n     *\n     * If Cloudflare is unable to determine where the request originated this property is omitted.\n     *\n     * The country code `\"T1\"` is used for requests originating on TOR.\n     *\n     * @example \"GB\"\n     */\n    country?: Iso3166Alpha2Code | \"T1\";\n    /**\n     * If present, this property indicates that the request originated in the EU\n     *\n     * @example \"1\"\n     */\n    isEUCountry?: \"1\";\n    /**\n     * A two-letter code indicating the continent the request originated from.\n     *\n     * @example \"AN\"\n     */\n    continent?: ContinentCode;\n    /**\n     * The city the request originated from\n     *\n     * @example \"Austin\"\n     */\n    city?: string;\n    /**\n     * Postal code of the incoming request\n     *\n     * @example \"78701\"\n     */\n    postalCode?: string;\n    /**\n     * Latitude of the incoming request\n     *\n     * @example \"30.27130\"\n     */\n    latitude?: string;\n    /**\n     * Longitude of the incoming request\n     *\n     * @example \"-97.74260\"\n     */\n    longitude?: string;\n    /**\n     * Timezone of the incoming request\n     *\n     * @example \"America/Chicago\"\n     */\n    timezone?: string;\n    /**\n     * If known, the ISO 3166-2 name for the first level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"Texas\"\n     */\n    region?: string;\n    /**\n     * If known, the ISO 3166-2 code for the first-level region associated with\n     * the IP address of the incoming request\n     *\n     * @example \"TX\"\n     */\n    regionCode?: string;\n    /**\n     * Metro code (DMA) of the incoming request\n     *\n     * @example \"635\"\n     */\n    metroCode?: string;\n}\n/** Data about the incoming request's TLS certificate */\ninterface IncomingRequestCfPropertiesTLSClientAuth {\n    /** Always `\"1\"`, indicating that the certificate was presented */\n    certPresented: \"1\";\n    /**\n     * Result of certificate verification.\n     *\n     * @example \"FAILED:self signed certificate\"\n     */\n    certVerified: Exclude<CertVerificationStatus, \"NONE\">;\n    /** The presented certificate's revokation status.\n     *\n     * - A value of `\"1\"` indicates the certificate has been revoked\n     * - A value of `\"0\"` indicates the certificate has not been revoked\n     */\n    certRevoked: \"1\" | \"0\";\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDN: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDN: string;\n    /**\n     * The certificate issuer's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certIssuerDNRFC2253: string;\n    /**\n     * The certificate subject's [distinguished name](https://knowledge.digicert.com/generalinformation/INFO1745.html) ([RFC 2253](https://www.rfc-editor.org/rfc/rfc2253.html) formatted)\n     *\n     * @example \"CN=*.cloudflareaccess.com, C=US, ST=Texas, L=Austin, O=Cloudflare\"\n     */\n    certSubjectDNRFC2253: string;\n    /** The certificate issuer's distinguished name (legacy policies) */\n    certIssuerDNLegacy: string;\n    /** The certificate subject's distinguished name (legacy policies) */\n    certSubjectDNLegacy: string;\n    /**\n     * The certificate's serial number\n     *\n     * @example \"00936EACBE07F201DF\"\n     */\n    certSerial: string;\n    /**\n     * The certificate issuer's serial number\n     *\n     * @example \"2489002934BDFEA34\"\n     */\n    certIssuerSerial: string;\n    /**\n     * The certificate's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certSKI: string;\n    /**\n     * The certificate issuer's Subject Key Identifier\n     *\n     * @example \"BB:AF:7E:02:3D:FA:A6:F1:3C:84:8E:AD:EE:38:98:EC:D9:32:32:D4\"\n     */\n    certIssuerSKI: string;\n    /**\n     * The certificate's SHA-1 fingerprint\n     *\n     * @example \"6b9109f323999e52259cda7373ff0b4d26bd232e\"\n     */\n    certFingerprintSHA1: string;\n    /**\n     * The certificate's SHA-256 fingerprint\n     *\n     * @example \"acf77cf37b4156a2708e34c4eb755f9b5dbbe5ebb55adfec8f11493438d19e6ad3f157f81fa3b98278453d5652b0c1fd1d71e5695ae4d709803a4d3f39de9dea\"\n     */\n    certFingerprintSHA256: string;\n    /**\n     * The effective starting date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotBefore: string;\n    /**\n     * The effective expiration date of the certificate\n     *\n     * @example \"Dec 22 19:39:00 2018 GMT\"\n     */\n    certNotAfter: string;\n}\n/** Placeholder values for TLS Client Authorization */\ninterface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {\n    certPresented: \"0\";\n    certVerified: \"NONE\";\n    certRevoked: \"0\";\n    certIssuerDN: \"\";\n    certSubjectDN: \"\";\n    certIssuerDNRFC2253: \"\";\n    certSubjectDNRFC2253: \"\";\n    certIssuerDNLegacy: \"\";\n    certSubjectDNLegacy: \"\";\n    certSerial: \"\";\n    certIssuerSerial: \"\";\n    certSKI: \"\";\n    certIssuerSKI: \"\";\n    certFingerprintSHA1: \"\";\n    certFingerprintSHA256: \"\";\n    certNotBefore: \"\";\n    certNotAfter: \"\";\n}\n/** Possible outcomes of TLS verification */\ndeclare type CertVerificationStatus = \n/** Authentication succeeded */\n\"SUCCESS\"\n/** No certificate was presented */\n | \"NONE\"\n/** Failed because the certificate was self-signed */\n | \"FAILED:self signed certificate\"\n/** Failed because the certificate failed a trust chain check */\n | \"FAILED:unable to verify the first certificate\"\n/** Failed because the certificate not yet valid */\n | \"FAILED:certificate is not yet valid\"\n/** Failed because the certificate is expired */\n | \"FAILED:certificate has expired\"\n/** Failed for another unspecified reason */\n | \"FAILED\";\n/**\n * An upstream endpoint's response to a TCP `keepalive` message from Cloudflare.\n */\ndeclare type IncomingRequestCfPropertiesEdgeRequestKeepAliveStatus = 0 /** Unknown */ | 1 /** no keepalives (not found) */ | 2 /** no connection re-use, opening keepalive connection failed */ | 3 /** no connection re-use, keepalive accepted and saved */ | 4 /** connection re-use, refused by the origin server (`TCP FIN`) */ | 5; /** connection re-use, accepted by the origin server */\n/** ISO 3166-1 Alpha-2 codes */\ndeclare type Iso3166Alpha2Code = \"AD\" | \"AE\" | \"AF\" | \"AG\" | \"AI\" | \"AL\" | \"AM\" | \"AO\" | \"AQ\" | \"AR\" | \"AS\" | \"AT\" | \"AU\" | \"AW\" | \"AX\" | \"AZ\" | \"BA\" | \"BB\" | \"BD\" | \"BE\" | \"BF\" | \"BG\" | \"BH\" | \"BI\" | \"BJ\" | \"BL\" | \"BM\" | \"BN\" | \"BO\" | \"BQ\" | \"BR\" | \"BS\" | \"BT\" | \"BV\" | \"BW\" | \"BY\" | \"BZ\" | \"CA\" | \"CC\" | \"CD\" | \"CF\" | \"CG\" | \"CH\" | \"CI\" | \"CK\" | \"CL\" | \"CM\" | \"CN\" | \"CO\" | \"CR\" | \"CU\" | \"CV\" | \"CW\" | \"CX\" | \"CY\" | \"CZ\" | \"DE\" | \"DJ\" | \"DK\" | \"DM\" | \"DO\" | \"DZ\" | \"EC\" | \"EE\" | \"EG\" | \"EH\" | \"ER\" | \"ES\" | \"ET\" | \"FI\" | \"FJ\" | \"FK\" | \"FM\" | \"FO\" | \"FR\" | \"GA\" | \"GB\" | \"GD\" | \"GE\" | \"GF\" | \"GG\" | \"GH\" | \"GI\" | \"GL\" | \"GM\" | \"GN\" | \"GP\" | \"GQ\" | \"GR\" | \"GS\" | \"GT\" | \"GU\" | \"GW\" | \"GY\" | \"HK\" | \"HM\" | \"HN\" | \"HR\" | \"HT\" | \"HU\" | \"ID\" | \"IE\" | \"IL\" | \"IM\" | \"IN\" | \"IO\" | \"IQ\" | \"IR\" | \"IS\" | \"IT\" | \"JE\" | \"JM\" | \"JO\" | \"JP\" | \"KE\" | \"KG\" | \"KH\" | \"KI\" | \"KM\" | \"KN\" | \"KP\" | \"KR\" | \"KW\" | \"KY\" | \"KZ\" | \"LA\" | \"LB\" | \"LC\" | \"LI\" | \"LK\" | \"LR\" | \"LS\" | \"LT\" | \"LU\" | \"LV\" | \"LY\" | \"MA\" | \"MC\" | \"MD\" | \"ME\" | \"MF\" | \"MG\" | \"MH\" | \"MK\" | \"ML\" | \"MM\" | \"MN\" | \"MO\" | \"MP\" | \"MQ\" | \"MR\" | \"MS\" | \"MT\" | \"MU\" | \"MV\" | \"MW\" | \"MX\" | \"MY\" | \"MZ\" | \"NA\" | \"NC\" | \"NE\" | \"NF\" | \"NG\" | \"NI\" | \"NL\" | \"NO\" | \"NP\" | \"NR\" | \"NU\" | \"NZ\" | \"OM\" | \"PA\" | \"PE\" | \"PF\" | \"PG\" | \"PH\" | \"PK\" | \"PL\" | \"PM\" | \"PN\" | \"PR\" | \"PS\" | \"PT\" | \"PW\" | \"PY\" | \"QA\" | \"RE\" | \"RO\" | \"RS\" | \"RU\" | \"RW\" | \"SA\" | \"SB\" | \"SC\" | \"SD\" | \"SE\" | \"SG\" | \"SH\" | \"SI\" | \"SJ\" | \"SK\" | \"SL\" | \"SM\" | \"SN\" | \"SO\" | \"SR\" | \"SS\" | \"ST\" | \"SV\" | \"SX\" | \"SY\" | \"SZ\" | \"TC\" | \"TD\" | \"TF\" | \"TG\" | \"TH\" | \"TJ\" | \"TK\" | \"TL\" | \"TM\" | \"TN\" | \"TO\" | \"TR\" | \"TT\" | \"TV\" | \"TW\" | \"TZ\" | \"UA\" | \"UG\" | \"UM\" | \"US\" | \"UY\" | \"UZ\" | \"VA\" | \"VC\" | \"VE\" | \"VG\" | \"VI\" | \"VN\" | \"VU\" | \"WF\" | \"WS\" | \"YE\" | \"YT\" | \"ZA\" | \"ZM\" | \"ZW\";\n/** The 2-letter continent codes Cloudflare uses */\ndeclare type ContinentCode = \"AF\" | \"AN\" | \"AS\" | \"EU\" | \"NA\" | \"OC\" | \"SA\";\ntype CfProperties<HostMetadata = unknown> = IncomingRequestCfProperties<HostMetadata> | RequestInitCfProperties;\ninterface D1Meta {\n    duration: number;\n    size_after: number;\n    rows_read: number;\n    rows_written: number;\n    last_row_id: number;\n    changed_db: boolean;\n    changes: number;\n    /**\n     * The region of the database instance that executed the query.\n     */\n    served_by_region?: string;\n    /**\n     * The three letters airport code of the colo that executed the query.\n     */\n    served_by_colo?: string;\n    /**\n     * True if-and-only-if the database instance that executed the query was the primary.\n     */\n    served_by_primary?: boolean;\n    timings?: {\n        /**\n         * The duration of the SQL query execution by the database instance. It doesn't include any network time.\n         */\n        sql_duration_ms: number;\n    };\n    /**\n     * Number of total attempts to execute the query, due to automatic retries.\n     * Note: All other fields in the response like `timings` only apply to the last attempt.\n     */\n    total_attempts?: number;\n}\ninterface D1Response {\n    success: true;\n    meta: D1Meta & Record<string, unknown>;\n    error?: never;\n}\ntype D1Result<T = unknown> = D1Response & {\n    results: T[];\n};\ninterface D1ExecResult {\n    count: number;\n    duration: number;\n}\ntype D1SessionConstraint = \n// Indicates that the first query should go to the primary, and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n'first-primary'\n// Indicates that the first query can go anywhere (primary or replica), and the rest queries\n// using the same D1DatabaseSession will go to any replica that is consistent with\n// the bookmark maintained by the session (returned by the first query).\n | 'first-unconstrained';\ntype D1SessionBookmark = string;\ndeclare abstract class D1Database {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    exec(query: string): Promise<D1ExecResult>;\n    /**\n     * Creates a new D1 Session anchored at the given constraint or the bookmark.\n     * All queries executed using the created session will have sequential consistency,\n     * meaning that all writes done through the session will be visible in subsequent reads.\n     *\n     * @param constraintOrBookmark Either the session constraint or the explicit bookmark to anchor the created session.\n     */\n    withSession(constraintOrBookmark?: D1SessionBookmark | D1SessionConstraint): D1DatabaseSession;\n    /**\n     * @deprecated dump() will be removed soon, only applies to deprecated alpha v1 databases.\n     */\n    dump(): Promise<ArrayBuffer>;\n}\ndeclare abstract class D1DatabaseSession {\n    prepare(query: string): D1PreparedStatement;\n    batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;\n    /**\n     * @returns The latest session bookmark across all executed queries on the session.\n     *          If no query has been executed yet, `null` is returned.\n     */\n    getBookmark(): D1SessionBookmark | null;\n}\ndeclare abstract class D1PreparedStatement {\n    bind(...values: unknown[]): D1PreparedStatement;\n    first<T = unknown>(colName: string): Promise<T | null>;\n    first<T = Record<string, unknown>>(): Promise<T | null>;\n    run<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    all<T = Record<string, unknown>>(): Promise<D1Result<T>>;\n    raw<T = unknown[]>(options: {\n        columnNames: true;\n    }): Promise<[\n        string[],\n        ...T[]\n    ]>;\n    raw<T = unknown[]>(options?: {\n        columnNames?: false;\n    }): Promise<T[]>;\n}\n// `Disposable` was added to TypeScript's standard lib types in version 5.2.\n// To support older TypeScript versions, define an empty `Disposable` interface.\n// Users won't be able to use `using`/`Symbol.dispose` without upgrading to 5.2,\n// but this will ensure type checking on older versions still passes.\n// TypeScript's interface merging will ensure our empty interface is effectively\n// ignored when `Disposable` is included in the standard lib.\ninterface Disposable {\n}\n/**\n * The returned data after sending an email\n */\ninterface EmailSendResult {\n    /**\n     * The Email Message ID\n     */\n    messageId: string;\n}\n/**\n * An email message that can be sent from a Worker.\n */\ninterface EmailMessage {\n    /**\n     * Envelope From attribute of the email message.\n     */\n    readonly from: string;\n    /**\n     * Envelope To attribute of the email message.\n     */\n    readonly to: string;\n}\n/**\n * An email message that is sent to a consumer Worker and can be rejected/forwarded.\n */\ninterface ForwardableEmailMessage extends EmailMessage {\n    /**\n     * Stream of the email message content.\n     */\n    readonly raw: ReadableStream<Uint8Array>;\n    /**\n     * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     */\n    readonly headers: Headers;\n    /**\n     * Size of the email message content.\n     */\n    readonly rawSize: number;\n    /**\n     * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.\n     * @param reason The reject reason.\n     * @returns void\n     */\n    setReject(reason: string): void;\n    /**\n     * Forward this email message to a verified destination address of the account.\n     * @param rcptTo Verified destination address.\n     * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).\n     * @returns A promise that resolves when the email message is forwarded.\n     */\n    forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;\n    /**\n     * Reply to the sender of this email message with a new EmailMessage object.\n     * @param message The reply message.\n     * @returns A promise that resolves when the email message is replied.\n     */\n    reply(message: EmailMessage): Promise<EmailSendResult>;\n}\n/** A file attachment for an email message */\ntype EmailAttachment = {\n    disposition: 'inline';\n    contentId: string;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n} | {\n    disposition: 'attachment';\n    contentId?: undefined;\n    filename: string;\n    type: string;\n    content: string | ArrayBuffer | ArrayBufferView;\n};\n/** An Email Address */\ninterface EmailAddress {\n    name: string;\n    email: string;\n}\n/**\n * A binding that allows a Worker to send email messages.\n */\ninterface SendEmail {\n    send(message: EmailMessage): Promise<EmailSendResult>;\n    send(builder: {\n        from: string | EmailAddress;\n        to: string | string[];\n        subject: string;\n        replyTo?: string | EmailAddress;\n        cc?: string | string[];\n        bcc?: string | string[];\n        headers?: Record<string, string>;\n        text?: string;\n        html?: string;\n        attachments?: EmailAttachment[];\n    }): Promise<EmailSendResult>;\n}\ndeclare abstract class EmailEvent extends ExtendableEvent {\n    readonly message: ForwardableEmailMessage;\n}\ndeclare type EmailExportedHandler<Env = unknown, Props = unknown> = (message: ForwardableEmailMessage, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;\ndeclare module \"cloudflare:email\" {\n    let _EmailMessage: {\n        prototype: EmailMessage;\n        new (from: string, to: string, raw: ReadableStream | string): EmailMessage;\n    };\n    export { _EmailMessage as EmailMessage };\n}\n/**\n * Hello World binding to serve as an explanatory example. DO NOT USE\n */\ninterface HelloWorldBinding {\n    /**\n     * Retrieve the current stored value\n     */\n    get(): Promise<{\n        value: string;\n        ms?: number;\n    }>;\n    /**\n     * Set a new stored value\n     */\n    set(value: string): Promise<void>;\n}\ninterface Hyperdrive {\n    /**\n     * Connect directly to Hyperdrive as if it's your database, returning a TCP socket.\n     *\n     * Calling this method returns an identical socket to if you call\n     * `connect(\"host:port\")` using the `host` and `port` fields from this object.\n     * Pick whichever approach works better with your preferred DB client library.\n     *\n     * Note that this socket is not yet authenticated -- it's expected that your\n     * code (or preferably, the client library of your choice) will authenticate\n     * using the information in this class's readonly fields.\n     */\n    connect(): Socket;\n    /**\n     * A valid DB connection string that can be passed straight into the typical\n     * client library/driver/ORM. This will typically be the easiest way to use\n     * Hyperdrive.\n     */\n    readonly connectionString: string;\n    /*\n     * A randomly generated hostname that is only valid within the context of the\n     * currently running Worker which, when passed into `connect()` function from\n     * the \"cloudflare:sockets\" module, will connect to the Hyperdrive instance\n     * for your database.\n     */\n    readonly host: string;\n    /*\n     * The port that must be paired the the host field when connecting.\n     */\n    readonly port: number;\n    /*\n     * The username to use when authenticating to your database via Hyperdrive.\n     * Unlike the host and password, this will be the same every time\n     */\n    readonly user: string;\n    /*\n     * The randomly generated password to use when authenticating to your\n     * database via Hyperdrive. Like the host field, this password is only valid\n     * within the context of the currently running Worker instance from which\n     * it's read.\n     */\n    readonly password: string;\n    /*\n     * The name of the database to connect to.\n     */\n    readonly database: string;\n}\n// Copyright (c) 2024 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ntype ImageInfoResponse = {\n    format: 'image/svg+xml';\n} | {\n    format: string;\n    fileSize: number;\n    width: number;\n    height: number;\n};\ntype ImageTransform = {\n    width?: number;\n    height?: number;\n    background?: string;\n    blur?: number;\n    border?: {\n        color?: string;\n        width?: number;\n    } | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n    };\n    brightness?: number;\n    contrast?: number;\n    fit?: 'scale-down' | 'contain' | 'pad' | 'squeeze' | 'cover' | 'crop';\n    flip?: 'h' | 'v' | 'hv';\n    gamma?: number;\n    segment?: 'foreground';\n    gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | {\n        x?: number;\n        y?: number;\n        mode: 'remainder' | 'box-center';\n    };\n    rotate?: 0 | 90 | 180 | 270;\n    saturation?: number;\n    sharpen?: number;\n    trim?: 'border' | {\n        top?: number;\n        bottom?: number;\n        left?: number;\n        right?: number;\n        width?: number;\n        height?: number;\n        border?: boolean | {\n            color?: string;\n            tolerance?: number;\n            keep?: number;\n        };\n    };\n};\ntype ImageDrawOptions = {\n    opacity?: number;\n    repeat?: boolean | string;\n    top?: number;\n    left?: number;\n    bottom?: number;\n    right?: number;\n};\ntype ImageInputOptions = {\n    encoding?: 'base64';\n};\ntype ImageOutputOptions = {\n    format: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'image/avif' | 'rgb' | 'rgba';\n    quality?: number;\n    background?: string;\n    anim?: boolean;\n};\ninterface ImageMetadata {\n    id: string;\n    filename?: string;\n    uploaded?: string;\n    requireSignedURLs: boolean;\n    meta?: Record<string, unknown>;\n    variants: string[];\n    draft?: boolean;\n    creator?: string;\n}\ninterface ImageUploadOptions {\n    id?: string;\n    filename?: string;\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n    encoding?: 'base64';\n}\ninterface ImageUpdateOptions {\n    requireSignedURLs?: boolean;\n    metadata?: Record<string, unknown>;\n    creator?: string;\n}\ninterface ImageListOptions {\n    limit?: number;\n    cursor?: string;\n    sortOrder?: 'asc' | 'desc';\n    creator?: string;\n}\ninterface ImageList {\n    images: ImageMetadata[];\n    cursor?: string;\n    listComplete: boolean;\n}\ninterface HostedImagesBinding {\n    /**\n     * Get detailed metadata for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns Image metadata, or null if not found\n     */\n    details(imageId: string): Promise<ImageMetadata | null>;\n    /**\n     * Get the raw image data for a hosted image\n     * @param imageId The ID of the image (UUID or custom ID)\n     * @returns ReadableStream of image bytes, or null if not found\n     */\n    image(imageId: string): Promise<ReadableStream<Uint8Array> | null>;\n    /**\n     * Upload a new hosted image\n     * @param image The image file to upload\n     * @param options Upload configuration\n     * @returns Metadata for the uploaded image\n     * @throws {@link ImagesError} if upload fails\n     */\n    upload(image: ReadableStream<Uint8Array> | ArrayBuffer, options?: ImageUploadOptions): Promise<ImageMetadata>;\n    /**\n     * Update hosted image metadata\n     * @param imageId The ID of the image\n     * @param options Properties to update\n     * @returns Updated image metadata\n     * @throws {@link ImagesError} if update fails\n     */\n    update(imageId: string, options: ImageUpdateOptions): Promise<ImageMetadata>;\n    /**\n     * Delete a hosted image\n     * @param imageId The ID of the image\n     * @returns True if deleted, false if not found\n     */\n    delete(imageId: string): Promise<boolean>;\n    /**\n     * List hosted images with pagination\n     * @param options List configuration\n     * @returns List of images with pagination info\n     * @throws {@link ImagesError} if list fails\n     */\n    list(options?: ImageListOptions): Promise<ImageList>;\n}\ninterface ImagesBinding {\n    /**\n     * Get image metadata (type, width and height)\n     * @throws {@link ImagesError} with code 9412 if input is not an image\n     * @param stream The image bytes\n     */\n    info(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): Promise<ImageInfoResponse>;\n    /**\n     * Begin applying a series of transformations to an image\n     * @param stream The image bytes\n     * @returns A transform handle\n     */\n    input(stream: ReadableStream<Uint8Array>, options?: ImageInputOptions): ImageTransformer;\n    /**\n     * Access hosted images CRUD operations\n     */\n    readonly hosted: HostedImagesBinding;\n}\ninterface ImageTransformer {\n    /**\n     * Apply transform next, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param transform\n     */\n    transform(transform: ImageTransform): ImageTransformer;\n    /**\n     * Draw an image on this transformer, returning a transform handle.\n     * You can then apply more transformations, draw, or retrieve the output.\n     * @param image The image (or transformer that will give the image) to draw\n     * @param options The options configuring how to draw the image\n     */\n    draw(image: ReadableStream<Uint8Array> | ImageTransformer, options?: ImageDrawOptions): ImageTransformer;\n    /**\n     * Retrieve the image that results from applying the transforms to the\n     * provided input\n     * @param options Options that apply to the output e.g. output format\n     */\n    output(options: ImageOutputOptions): Promise<ImageTransformationResult>;\n}\ntype ImageTransformationOutputOptions = {\n    encoding?: 'base64';\n};\ninterface ImageTransformationResult {\n    /**\n     * The image as a response, ready to store in cache or return to users\n     */\n    response(): Response;\n    /**\n     * The content type of the returned image\n     */\n    contentType(): string;\n    /**\n     * The bytes of the response\n     */\n    image(options?: ImageTransformationOutputOptions): ReadableStream<Uint8Array>;\n}\ninterface ImagesError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\n/**\n * Media binding for transforming media streams.\n * Provides the entry point for media transformation operations.\n */\ninterface MediaBinding {\n    /**\n     * Creates a media transformer from an input stream.\n     * @param media - The input media bytes\n     * @returns A MediaTransformer instance for applying transformations\n     */\n    input(media: ReadableStream<Uint8Array>): MediaTransformer;\n}\n/**\n * Media transformer for applying transformation operations to media content.\n * Handles sizing, fitting, and other input transformation parameters.\n */\ninterface MediaTransformer {\n    /**\n     * Applies transformation options to the media content.\n     * @param transform - Configuration for how the media should be transformed\n     * @returns A generator for producing the transformed media output\n     */\n    transform(transform?: MediaTransformationInputOptions): MediaTransformationGenerator;\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Generator for producing media transformation results.\n * Configures the output format and parameters for the transformed media.\n */\ninterface MediaTransformationGenerator {\n    /**\n     * Generates the final media output with specified options.\n     * @param output - Configuration for the output format and parameters\n     * @returns The final transformation result containing the transformed media\n     */\n    output(output?: MediaTransformationOutputOptions): MediaTransformationResult;\n}\n/**\n * Result of a media transformation operation.\n * Provides multiple ways to access the transformed media content.\n */\ninterface MediaTransformationResult {\n    /**\n     * Returns the transformed media as a readable stream of bytes.\n     * @returns A promise containing a readable stream with the transformed media\n     */\n    media(): Promise<ReadableStream<Uint8Array>>;\n    /**\n     * Returns the transformed media as an HTTP response object.\n     * @returns The transformed media as a Promise<Response>, ready to store in cache or return to users\n     */\n    response(): Promise<Response>;\n    /**\n     * Returns the MIME type of the transformed media.\n     * @returns A promise containing the content type string (e.g., 'image/jpeg', 'video/mp4')\n     */\n    contentType(): Promise<string>;\n}\n/**\n * Configuration options for transforming media input.\n * Controls how the media should be resized and fitted.\n */\ntype MediaTransformationInputOptions = {\n    /** How the media should be resized to fit the specified dimensions */\n    fit?: 'contain' | 'cover' | 'scale-down';\n    /** Target width in pixels */\n    width?: number;\n    /** Target height in pixels */\n    height?: number;\n};\n/**\n * Configuration options for Media Transformations output.\n * Controls the format, timing, and type of the generated output.\n */\ntype MediaTransformationOutputOptions = {\n    /**\n     * Output mode determining the type of media to generate\n     */\n    mode?: 'video' | 'spritesheet' | 'frame' | 'audio';\n    /** Whether to include audio in the output */\n    audio?: boolean;\n    /**\n     * Starting timestamp for frame extraction or start time for clips. (e.g. '2s').\n     */\n    time?: string;\n    /**\n     * Duration for video clips, audio extraction, and spritesheet generation (e.g. '5s').\n     */\n    duration?: string;\n    /**\n     * Number of frames in the spritesheet.\n     */\n    imageCount?: number;\n    /**\n     * Output format for the generated media.\n     */\n    format?: 'jpg' | 'png' | 'm4a';\n};\n/**\n * Error object for media transformation operations.\n * Extends the standard Error interface with additional media-specific information.\n */\ninterface MediaError extends Error {\n    readonly code: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ndeclare module 'cloudflare:node' {\n    interface NodeStyleServer {\n        listen(...args: unknown[]): this;\n        address(): {\n            port?: number | null | undefined;\n        };\n    }\n    export function httpServerHandler(port: number): ExportedHandler;\n    export function httpServerHandler(options: {\n        port: number;\n    }): ExportedHandler;\n    export function httpServerHandler(server: NodeStyleServer): ExportedHandler;\n}\ntype Params<P extends string = any> = Record<P, string | string[]>;\ntype EventContext<Env, P extends string, Data> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n};\ntype PagesFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>> = (context: EventContext<Env, Params, Data>) => Response | Promise<Response>;\ntype EventPluginContext<Env, P extends string, Data, PluginArgs> = {\n    request: Request<unknown, IncomingRequestCfProperties<unknown>>;\n    functionPath: string;\n    waitUntil: (promise: Promise<any>) => void;\n    passThroughOnException: () => void;\n    next: (input?: Request | string, init?: RequestInit) => Promise<Response>;\n    env: Env & {\n        ASSETS: {\n            fetch: typeof fetch;\n        };\n    };\n    params: Params<P>;\n    data: Data;\n    pluginArgs: PluginArgs;\n};\ntype PagesPluginFunction<Env = unknown, Params extends string = any, Data extends Record<string, unknown> = Record<string, unknown>, PluginArgs = unknown> = (context: EventPluginContext<Env, Params, Data, PluginArgs>) => Response | Promise<Response>;\ndeclare module \"assets:*\" {\n    export const onRequest: PagesFunction;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\ndeclare module \"cloudflare:pipelines\" {\n    export abstract class PipelineTransformationEntrypoint<Env = unknown, I extends PipelineRecord = PipelineRecord, O extends PipelineRecord = PipelineRecord> {\n        protected env: Env;\n        protected ctx: ExecutionContext;\n        constructor(ctx: ExecutionContext, env: Env);\n        /**\n         * run receives an array of PipelineRecord which can be\n         * transformed and returned to the pipeline\n         * @param records Incoming records from the pipeline to be transformed\n         * @param metadata Information about the specific pipeline calling the transformation entrypoint\n         * @returns A promise containing the transformed PipelineRecord array\n         */\n        public run(records: I[], metadata: PipelineBatchMetadata): Promise<O[]>;\n    }\n    export type PipelineRecord = Record<string, unknown>;\n    export type PipelineBatchMetadata = {\n        pipelineId: string;\n        pipelineName: string;\n    };\n    export interface Pipeline<T extends PipelineRecord = PipelineRecord> {\n        /**\n         * The Pipeline interface represents the type of a binding to a Pipeline\n         *\n         * @param records The records to send to the pipeline\n         */\n        send(records: T[]): Promise<void>;\n    }\n}\n// PubSubMessage represents an incoming PubSub message.\n// The message includes metadata about the broker, the client, and the payload\n// itself.\n// https://developers.cloudflare.com/pub-sub/\ninterface PubSubMessage {\n    // Message ID\n    readonly mid: number;\n    // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT\n    readonly broker: string;\n    // The MQTT topic the message was sent on.\n    readonly topic: string;\n    // The client ID of the client that published this message.\n    readonly clientId: string;\n    // The unique identifier (JWT ID) used by the client to authenticate, if token\n    // auth was used.\n    readonly jti?: string;\n    // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker\n    // received the message from the client.\n    readonly receivedAt: number;\n    // An (optional) string with the MIME type of the payload, if set by the\n    // client.\n    readonly contentType: string;\n    // Set to 1 when the payload is a UTF-8 string\n    // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063\n    readonly payloadFormatIndicator: number;\n    // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays.\n    // You can use payloadFormatIndicator to inspect this before decoding.\n    payload: string | Uint8Array;\n}\n// JsonWebKey extended by kid parameter\ninterface JsonWebKeyWithKid extends JsonWebKey {\n    // Key Identifier of the JWK\n    readonly kid: string;\n}\ninterface RateLimitOptions {\n    key: string;\n}\ninterface RateLimitOutcome {\n    success: boolean;\n}\ninterface RateLimit {\n    /**\n     * Rate limit a request based on the provided options.\n     * @see https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/\n     * @returns A promise that resolves with the outcome of the rate limit.\n     */\n    limit(options: RateLimitOptions): Promise<RateLimitOutcome>;\n}\n// Namespace for RPC utility types. Unfortunately, we can't use a `module` here as these types need\n// to referenced by `Fetcher`. This is included in the \"importable\" version of the types which\n// strips all `module` blocks.\ndeclare namespace Rpc {\n    // Branded types for identifying `WorkerEntrypoint`/`DurableObject`/`Target`s.\n    // TypeScript uses *structural* typing meaning anything with the same shape as type `T` is a `T`.\n    // For the classes exported by `cloudflare:workers` we want *nominal* typing (i.e. we only want to\n    // accept `WorkerEntrypoint` from `cloudflare:workers`, not any other class with the same shape)\n    export const __RPC_STUB_BRAND: '__RPC_STUB_BRAND';\n    export const __RPC_TARGET_BRAND: '__RPC_TARGET_BRAND';\n    export const __WORKER_ENTRYPOINT_BRAND: '__WORKER_ENTRYPOINT_BRAND';\n    export const __DURABLE_OBJECT_BRAND: '__DURABLE_OBJECT_BRAND';\n    export const __WORKFLOW_ENTRYPOINT_BRAND: '__WORKFLOW_ENTRYPOINT_BRAND';\n    export interface RpcTargetBranded {\n        [__RPC_TARGET_BRAND]: never;\n    }\n    export interface WorkerEntrypointBranded {\n        [__WORKER_ENTRYPOINT_BRAND]: never;\n    }\n    export interface DurableObjectBranded {\n        [__DURABLE_OBJECT_BRAND]: never;\n    }\n    export interface WorkflowEntrypointBranded {\n        [__WORKFLOW_ENTRYPOINT_BRAND]: never;\n    }\n    export type EntrypointBranded = WorkerEntrypointBranded | DurableObjectBranded | WorkflowEntrypointBranded;\n    // Types that can be used through `Stub`s\n    export type Stubable = RpcTargetBranded | ((...args: any[]) => any);\n    // Types that can be passed over RPC\n    // The reason for using a generic type here is to build a serializable subset of structured\n    //   cloneable composite types. This allows types defined with the \"interface\" keyword to pass the\n    //   serializable check as well. Otherwise, only types defined with the \"type\" keyword would pass.\n    type Serializable<T> = \n    // Structured cloneables\n    BaseType\n    // Structured cloneable composites\n     | Map<T extends Map<infer U, unknown> ? Serializable<U> : never, T extends Map<unknown, infer U> ? Serializable<U> : never> | Set<T extends Set<infer U> ? Serializable<U> : never> | ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never> | {\n        [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;\n    }\n    // Special types\n     | Stub<Stubable>\n    // Serialized as stubs, see `Stubify`\n     | Stubable;\n    // Base type for all RPC stubs, including common memory management methods.\n    // `T` is used as a marker type for unwrapping `Stub`s later.\n    interface StubBase<T extends Stubable> extends Disposable {\n        [__RPC_STUB_BRAND]: T;\n        dup(): this;\n    }\n    export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;\n    // This represents all the types that can be sent as-is over an RPC boundary\n    type BaseType = void | undefined | null | boolean | number | bigint | string | TypedArray | ArrayBuffer | DataView | Date | Error | RegExp | ReadableStream<Uint8Array> | WritableStream<Uint8Array> | Request | Response | Headers;\n    // Recursively rewrite all `Stubable` types with `Stub`s\n    // prettier-ignore\n    type Stubify<T> = T extends Stubable ? Stub<T> : T extends Map<infer K, infer V> ? Map<Stubify<K>, Stubify<V>> : T extends Set<infer V> ? Set<Stubify<V>> : T extends Array<infer V> ? Array<Stubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Stubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: any;\n    } ? {\n        [K in keyof T]: Stubify<T[K]>;\n    } : T;\n    // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.\n    // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:\n    // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.\n    // prettier-ignore\n    type Unstubify<T> = T extends StubBase<infer V> ? V : T extends Map<infer K, infer V> ? Map<Unstubify<K>, Unstubify<V>> : T extends Set<infer V> ? Set<Unstubify<V>> : T extends Array<infer V> ? Array<Unstubify<V>> : T extends ReadonlyArray<infer V> ? ReadonlyArray<Unstubify<V>> : T extends BaseType ? T : T extends {\n        [key: string | number]: unknown;\n    } ? {\n        [K in keyof T]: Unstubify<T[K]>;\n    } : T;\n    type UnstubifyAll<A extends any[]> = {\n        [I in keyof A]: Unstubify<A[I]>;\n    };\n    // Utility type for adding `Provider`/`Disposable`s to `object` types only.\n    // Note `unknown & T` is equivalent to `T`.\n    type MaybeProvider<T> = T extends object ? Provider<T> : unknown;\n    type MaybeDisposable<T> = T extends object ? Disposable : unknown;\n    // Type for method return or property on an RPC interface.\n    // - Stubable types are replaced by stubs.\n    // - Serializable types are passed by value, with stubable types replaced by stubs\n    //   and a top-level `Disposer`.\n    // Everything else can't be passed over PRC.\n    // Technically, we use custom thenables here, but they quack like `Promise`s.\n    // Intersecting with `(Maybe)Provider` allows pipelining.\n    // prettier-ignore\n    type Result<R> = R extends Stubable ? Promise<Stub<R>> & Provider<R> : R extends Serializable<R> ? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R> : never;\n    // Type for method or property on an RPC interface.\n    // For methods, unwrap `Stub`s in parameters, and rewrite returns to be `Result`s.\n    // Unwrapping `Stub`s allows calling with `Stubable` arguments.\n    // For properties, rewrite types to be `Result`s.\n    // In each case, unwrap `Promise`s.\n    type MethodOrProperty<V> = V extends (...args: infer P) => infer R ? (...args: UnstubifyAll<P>) => Result<Awaited<R>> : Result<Awaited<V>>;\n    // Type for the callable part of an `Provider` if `T` is callable.\n    // This is intersected with methods/properties.\n    type MaybeCallableProvider<T> = T extends (...args: any[]) => any ? MethodOrProperty<T> : unknown;\n    // Base type for all other types providing RPC-like interfaces.\n    // Rewrites all methods/properties to be `MethodOrProperty`s, while preserving callable types.\n    // `Reserved` names (e.g. stub method names like `dup()`) and symbols can't be accessed over RPC.\n    export type Provider<T extends object, Reserved extends string = never> = MaybeCallableProvider<T> & Pick<{\n        [K in keyof T]: MethodOrProperty<T[K]>;\n    }, Exclude<keyof T, Reserved | symbol | keyof StubBase<never>>>;\n}\ndeclare namespace Cloudflare {\n    // Type of `env`.\n    //\n    // The specific project can extend `Env` by redeclaring it in project-specific files. Typescript\n    // will merge all declarations.\n    //\n    // You can use `wrangler types` to generate the `Env` type automatically.\n    interface Env {\n    }\n    // Project-specific parameters used to inform types.\n    //\n    // This interface is, again, intended to be declared in project-specific files, and then that\n    // declaration will be merged with this one.\n    //\n    // A project should have a declaration like this:\n    //\n    //     interface GlobalProps {\n    //       // Declares the main module's exports. Used to populate Cloudflare.Exports aka the type\n    //       // of `ctx.exports`.\n    //       mainModule: typeof import(\"my-main-module\");\n    //\n    //       // Declares which of the main module's exports are configured with durable storage, and\n    //       // thus should behave as Durable Object namsepace bindings.\n    //       durableNamespaces: \"MyDurableObject\" | \"AnotherDurableObject\";\n    //     }\n    //\n    // You can use `wrangler types` to generate `GlobalProps` automatically.\n    interface GlobalProps {\n    }\n    // Evaluates to the type of a property in GlobalProps, defaulting to `Default` if it is not\n    // present.\n    type GlobalProp<K extends string, Default> = K extends keyof GlobalProps ? GlobalProps[K] : Default;\n    // The type of the program's main module exports, if known. Requires `GlobalProps` to declare the\n    // `mainModule` property.\n    type MainModule = GlobalProp<\"mainModule\", {}>;\n    // The type of ctx.exports, which contains loopback bindings for all top-level exports.\n    type Exports = {\n        [K in keyof MainModule]: LoopbackForExport<MainModule[K]>\n        // If the export is listed in `durableNamespaces`, then it is also a\n        // DurableObjectNamespace.\n         & (K extends GlobalProp<\"durableNamespaces\", never> ? MainModule[K] extends new (...args: any[]) => infer DoInstance ? DoInstance extends Rpc.DurableObjectBranded ? DurableObjectNamespace<DoInstance> : DurableObjectNamespace<undefined> : DurableObjectNamespace<undefined> : {});\n    };\n}\ndeclare namespace CloudflareWorkersModule {\n    export type RpcStub<T extends Rpc.Stubable> = Rpc.Stub<T>;\n    export const RpcStub: {\n        new <T extends Rpc.Stubable>(value: T): Rpc.Stub<T>;\n    };\n    export abstract class RpcTarget implements Rpc.RpcTargetBranded {\n        [Rpc.__RPC_TARGET_BRAND]: never;\n    }\n    // `protected` fields don't appear in `keyof`s, so can't be accessed over RPC\n    export abstract class WorkerEntrypoint<Env = Cloudflare.Env, Props = {}> implements Rpc.WorkerEntrypointBranded {\n        [Rpc.__WORKER_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext<Props>;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        email?(message: ForwardableEmailMessage): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        queue?(batch: MessageBatch<unknown>): void | Promise<void>;\n        scheduled?(controller: ScheduledController): void | Promise<void>;\n        tail?(events: TraceItem[]): void | Promise<void>;\n        tailStream?(event: TailStream.TailEvent<TailStream.Onset>): TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;\n        test?(controller: TestController): void | Promise<void>;\n        trace?(traces: TraceItem[]): void | Promise<void>;\n    }\n    export abstract class DurableObject<Env = Cloudflare.Env, Props = {}> implements Rpc.DurableObjectBranded {\n        [Rpc.__DURABLE_OBJECT_BRAND]: never;\n        protected ctx: DurableObjectState<Props>;\n        protected env: Env;\n        constructor(ctx: DurableObjectState, env: Env);\n        alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;\n        fetch?(request: Request): Response | Promise<Response>;\n        webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;\n        webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;\n        webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;\n    }\n    export type WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\n    export type WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\n    export type WorkflowDelayDuration = WorkflowSleepDuration;\n    export type WorkflowTimeoutDuration = WorkflowSleepDuration;\n    export type WorkflowRetentionDuration = WorkflowSleepDuration;\n    export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';\n    export type WorkflowStepConfig = {\n        retries?: {\n            limit: number;\n            delay: WorkflowDelayDuration | number;\n            backoff?: WorkflowBackoff;\n        };\n        timeout?: WorkflowTimeoutDuration | number;\n    };\n    export type WorkflowEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        instanceId: string;\n    };\n    export type WorkflowStepEvent<T> = {\n        payload: Readonly<T>;\n        timestamp: Date;\n        type: string;\n    };\n    export type WorkflowStepContext = {\n        attempt: number;\n    };\n    export abstract class WorkflowStep {\n        do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        do<T extends Rpc.Serializable<T>>(name: string, config: WorkflowStepConfig, callback: (ctx: WorkflowStepContext) => Promise<T>): Promise<T>;\n        sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;\n        sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;\n        waitForEvent<T extends Rpc.Serializable<T>>(name: string, options: {\n            type: string;\n            timeout?: WorkflowTimeoutDuration | number;\n        }): Promise<WorkflowStepEvent<T>>;\n    }\n    export type WorkflowInstanceStatus = 'queued' | 'running' | 'paused' | 'errored' | 'terminated' | 'complete' | 'waiting' | 'waitingForPause' | 'unknown';\n    export abstract class WorkflowEntrypoint<Env = unknown, T extends Rpc.Serializable<T> | unknown = unknown> implements Rpc.WorkflowEntrypointBranded {\n        [Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;\n        protected ctx: ExecutionContext;\n        protected env: Env;\n        constructor(ctx: ExecutionContext, env: Env);\n        run(event: Readonly<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;\n    }\n    export function waitUntil(promise: Promise<unknown>): void;\n    export function withEnv(newEnv: unknown, fn: () => unknown): unknown;\n    export function withExports(newExports: unknown, fn: () => unknown): unknown;\n    export function withEnvAndExports(newEnv: unknown, newExports: unknown, fn: () => unknown): unknown;\n    export const env: Cloudflare.Env;\n    export const exports: Cloudflare.Exports;\n}\ndeclare module 'cloudflare:workers' {\n    export = CloudflareWorkersModule;\n}\ninterface SecretsStoreSecret {\n    /**\n     * Get a secret from the Secrets Store, returning a string of the secret value\n     * if it exists, or throws an error if it does not exist\n     */\n    get(): Promise<string>;\n}\ndeclare module \"cloudflare:sockets\" {\n    function _connect(address: string | SocketAddress, options?: SocketOptions): Socket;\n    export { _connect as connect };\n}\n/**\n * Binding entrypoint for Cloudflare Stream.\n *\n * Usage:\n * - Binding-level operations:\n *   `await env.STREAM.videos.upload`\n *   `await env.STREAM.videos.createDirectUpload`\n *   `await env.STREAM.videos.*`\n *   `await env.STREAM.watermarks.*`\n * - Per-video operations:\n *   `await env.STREAM.video(id).downloads.*`\n *   `await env.STREAM.video(id).captions.*`\n *\n * Example usage:\n * ```ts\n * await env.STREAM.video(id).downloads.generate();\n *\n * const video = env.STREAM.video(id)\n * const captions = video.captions.list();\n * const videoDetails = video.details()\n * ```\n */\ninterface StreamBinding {\n    /**\n     * Returns a handle scoped to a single video for per-video operations.\n     * @param id The unique identifier for the video.\n     * @returns A handle for per-video operations.\n     */\n    video(id: string): StreamVideoHandle;\n    /**\n     * Uploads a new video from a File.\n     * @param file The video file to upload.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(file: File): Promise<StreamVideo>;\n    /**\n     * Uploads a new video from a provided URL.\n     * @param url The URL to upload from.\n     * @param params Optional upload parameters.\n     * @returns The uploaded video details.\n     * @throws {BadRequestError} if the upload parameter is invalid or the URL is invalid\n     * @throws {QuotaReachedError} if the account storage capacity is exceeded\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {AlreadyUploadedError} if a video was already uploaded to this URL\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(url: string, params?: StreamUrlUploadParams): Promise<StreamVideo>;\n    /**\n     * Creates a direct upload that allows video uploads without an API key.\n     * @param params Parameters for the direct upload\n     * @returns The direct upload details.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {RateLimitedError} if the server received too many requests\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    createDirectUpload(params: StreamDirectUploadCreateParams): Promise<StreamDirectUpload>;\n    videos: StreamVideos;\n    watermarks: StreamWatermarks;\n}\n/**\n * Handle for operations scoped to a single Stream video.\n */\ninterface StreamVideoHandle {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * Get a full videos details\n     * @returns The full video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    details(): Promise<StreamVideo>;\n    /**\n     * Update details for a single video.\n     * @param params The fields to update for the video.\n     * @returns The updated video details.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    update(params: StreamUpdateVideoParams): Promise<StreamVideo>;\n    /**\n     * Deletes a video and its copies from Cloudflare Stream.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(): Promise<void>;\n    /**\n     * Creates a signed URL token for a video.\n     * @returns The signed token that was created.\n     * @throws {InternalError} if the signing key cannot be retrieved or the token cannot be signed\n     */\n    generateToken(): Promise<string>;\n    downloads: StreamScopedDownloads;\n    captions: StreamScopedCaptions;\n}\ninterface StreamVideo {\n    /**\n     * The unique identifier for the video.\n     */\n    id: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator: string | null;\n    /**\n     * The thumbnail URL for the video.\n     */\n    thumbnail: string;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct: number;\n    /**\n     * Indicates whether the video is ready to stream.\n     */\n    readyToStream: boolean;\n    /**\n     * The date and time the video became ready to stream.\n     */\n    readyToStreamAt: string | null;\n    /**\n     * Processing status information.\n     */\n    status: StreamVideoStatus;\n    /**\n     * A user modifiable key-value store.\n     */\n    meta: Record<string, string>;\n    /**\n     * The date and time the video was created.\n     */\n    created: string;\n    /**\n     * The date and time the video was last modified.\n     */\n    modified: string;\n    /**\n     * The date and time at which the video will be deleted.\n     */\n    scheduledDeletion: string | null;\n    /**\n     * The size of the video in bytes.\n     */\n    size: number;\n    /**\n     * The preview URL for the video.\n     */\n    preview?: string;\n    /**\n     * Origins allowed to display the video.\n     */\n    allowedOrigins: Array<string>;\n    /**\n     * Indicates whether signed URLs are required.\n     */\n    requireSignedURLs: boolean | null;\n    /**\n     * The date and time the video was uploaded.\n     */\n    uploaded: string | null;\n    /**\n     * The date and time when the upload URL expires.\n     */\n    uploadExpiry: string | null;\n    /**\n     * The maximum size in bytes for direct uploads.\n     */\n    maxSizeBytes: number | null;\n    /**\n     * The maximum duration in seconds for direct uploads.\n     */\n    maxDurationSeconds: number | null;\n    /**\n     * The video duration in seconds. -1 indicates unknown.\n     */\n    duration: number;\n    /**\n     * Input metadata for the original upload.\n     */\n    input: StreamVideoInput;\n    /**\n     * Playback URLs for the video.\n     */\n    hlsPlaybackUrl: string;\n    dashPlaybackUrl: string;\n    /**\n     * The watermark applied to the video, if any.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The live input id associated with the video, if any.\n     */\n    liveInputId?: string | null;\n    /**\n     * The source video id if this is a clip.\n     */\n    clippedFromId: string | null;\n    /**\n     * Public details associated with the video.\n     */\n    publicDetails: StreamPublicDetails | null;\n}\ntype StreamVideoStatus = {\n    /**\n     * The current processing state.\n     */\n    state: string;\n    /**\n     * The current processing step.\n     */\n    step?: string;\n    /**\n     * The percent complete as a string.\n     */\n    pctComplete?: string;\n    /**\n     * An error reason code, if applicable.\n     */\n    errorReasonCode: string;\n    /**\n     * An error reason text, if applicable.\n     */\n    errorReasonText: string;\n};\ntype StreamVideoInput = {\n    /**\n     * The input width in pixels.\n     */\n    width: number;\n    /**\n     * The input height in pixels.\n     */\n    height: number;\n};\ntype StreamPublicDetails = {\n    /**\n     * The public title for the video.\n     */\n    title: string | null;\n    /**\n     * The public share link.\n     */\n    share_link: string | null;\n    /**\n     * The public channel link.\n     */\n    channel_link: string | null;\n    /**\n     * The public logo URL.\n     */\n    logo: string | null;\n};\ntype StreamDirectUpload = {\n    /**\n     * The URL an unauthenticated upload can use for a single multipart request.\n     */\n    uploadURL: string;\n    /**\n     * A Cloudflare-generated unique identifier for a media item.\n     */\n    id: string;\n    /**\n     * The watermark profile applied to the upload.\n     */\n    watermark: StreamWatermark | null;\n    /**\n     * The scheduled deletion time, if any.\n     */\n    scheduledDeletion: string | null;\n};\ntype StreamDirectUploadCreateParams = {\n    /**\n     * The maximum duration in seconds for a video upload.\n     */\n    maxDurationSeconds: number;\n    /**\n     * The date and time after upload when videos will not be accepted.\n     */\n    expiry?: string;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of record for\n     * managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Lists the origins allowed to display the video.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * Indicates whether the video can be accessed using the id. When set to `true`,\n     * a signed token must be generated with a signing key to view the video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * The thumbnail timestamp percentage.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The date and time at which the video will be deleted. Include `null` to remove\n     * a scheduled deletion.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The watermark profile to apply.\n     */\n    watermark?: StreamDirectUploadWatermark;\n};\ntype StreamDirectUploadWatermark = {\n    /**\n     * The unique identifier for the watermark profile.\n     */\n    id: string;\n};\ntype StreamUrlUploadParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n    /**\n     * The identifier for the watermark profile\n     */\n    watermarkId?: string;\n};\ninterface StreamScopedCaptions {\n    /**\n     * Uploads the caption or subtitle file to the endpoint for a specific BCP47 language.\n     * One caption or subtitle file per language is allowed.\n     * @param language The BCP 47 language tag for the caption or subtitle.\n     * @param file The caption or subtitle file to upload.\n     * @returns The created caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language or file is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    upload(language: string, file: File): Promise<StreamCaption>;\n    /**\n     * Generate captions or subtitles for the provided language via AI.\n     * @param language The BCP 47 language tag to generate.\n     * @returns The generated caption entry.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the language is invalid\n     * @throws {StreamError} if a generated caption already exists\n     * @throws {StreamError} if the video duration is too long\n     * @throws {StreamError} if the video is missing audio\n     * @throws {StreamError} if the requested language is not supported\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(language: string): Promise<StreamCaption>;\n    /**\n     * Lists the captions or subtitles.\n     * Use the language parameter to filter by a specific language.\n     * @param language The optional BCP 47 language tag to filter by.\n     * @returns The list of captions or subtitles.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(language?: string): Promise<StreamCaption[]>;\n    /**\n     * Removes the captions or subtitles from a video.\n     * @param language The BCP 47 language tag to remove.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or caption is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(language: string): Promise<void>;\n}\ninterface StreamScopedDownloads {\n    /**\n     * Generates a download for a video when a video is ready to view. Available\n     * types are `default` and `audio`. Defaults to `default` when omitted.\n     * @param downloadType The download type to create.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video is not found\n     * @throws {BadRequestError} if the download type is invalid\n     * @throws {StreamError} if the video duration is too long to generate a download\n     * @throws {StreamError} if the video is not ready to stream\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(downloadType?: StreamDownloadType): Promise<StreamDownloadGetResponse>;\n    /**\n     * Lists the downloads created for a video.\n     * @returns The current downloads for the video.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(): Promise<StreamDownloadGetResponse>;\n    /**\n     * Delete the downloads for a video. Available types are `default` and `audio`.\n     * Defaults to `default` when omitted.\n     * @param downloadType The download type to delete.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the video or downloads are not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(downloadType?: StreamDownloadType): Promise<void>;\n}\ninterface StreamVideos {\n    /**\n     * Lists all videos in a users account.\n     * @returns The list of videos.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(params?: StreamVideosListParams): Promise<StreamVideo[]>;\n}\ninterface StreamWatermarks {\n    /**\n     * Generate a new watermark profile\n     * @param file The image file to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(file: File, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Generate a new watermark profile\n     * @param url The image url to upload\n     * @param params The watermark creation parameters.\n     * @returns The created watermark profile.\n     * @throws {BadRequestError} if the parameters are invalid\n     * @throws {InvalidURLError} if the URL is invalid\n     * @throws {MaxFileSizeError} if the file size is too large\n     * @throws {TooManyWatermarksError} if the number of allowed watermarks is reached\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    generate(url: string, params: StreamWatermarkCreateParams): Promise<StreamWatermark>;\n    /**\n     * Lists all watermark profiles for an account.\n     * @returns The list of watermark profiles.\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    list(): Promise<StreamWatermark[]>;\n    /**\n     * Retrieves details for a single watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns The watermark profile details.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    get(watermarkId: string): Promise<StreamWatermark>;\n    /**\n     * Deletes a watermark profile.\n     * @param watermarkId The watermark profile identifier.\n     * @returns A promise that resolves when deletion completes.\n     * @throws {NotFoundError} if the watermark is not found\n     * @throws {InternalError} if an unexpected error occurs\n     */\n    delete(watermarkId: string): Promise<void>;\n}\ntype StreamUpdateVideoParams = {\n    /**\n     * Lists the origins allowed to display the video. Enter allowed origin\n     * domains in an array and use `*` for wildcard subdomains. Empty arrays allow the\n     * video to be viewed on any origin.\n     */\n    allowedOrigins?: Array<string>;\n    /**\n     * A user-defined identifier for the media creator.\n     */\n    creator?: string;\n    /**\n     * The maximum duration in seconds for a video upload. Can be set for a\n     * video that is not yet uploaded to limit its duration. Uploads that exceed the\n     * specified duration will fail during processing. A value of `-1` means the value\n     * is unknown.\n     */\n    maxDurationSeconds?: number;\n    /**\n     * A user modifiable key-value store used to reference other systems of\n     * record for managing videos.\n     */\n    meta?: Record<string, string>;\n    /**\n     * Indicates whether the video can be a accessed using the id. When\n     * set to `true`, a signed token must be generated with a signing key to view the\n     * video.\n     */\n    requireSignedURLs?: boolean;\n    /**\n     * Indicates the date and time at which the video will be deleted. Omit\n     * the field to indicate no change, or include with a `null` value to remove an\n     * existing scheduled deletion. If specified, must be at least 30 days from upload\n     * time.\n     */\n    scheduledDeletion?: string | null;\n    /**\n     * The timestamp for a thumbnail image calculated as a percentage value\n     * of the video's duration. To convert from a second-wise timestamp to a\n     * percentage, divide the desired timestamp by the total duration of the video. If\n     * this value is not set, the default thumbnail image is taken from 0s of the\n     * video.\n     */\n    thumbnailTimestampPct?: number;\n};\ntype StreamCaption = {\n    /**\n     * Whether the caption was generated via AI.\n     */\n    generated?: boolean;\n    /**\n     * The language label displayed in the native language to users.\n     */\n    label: string;\n    /**\n     * The language tag in BCP 47 format.\n     */\n    language: string;\n    /**\n     * The status of a generated caption.\n     */\n    status?: 'ready' | 'inprogress' | 'error';\n};\ntype StreamDownloadStatus = 'ready' | 'inprogress' | 'error';\ntype StreamDownloadType = 'default' | 'audio';\ntype StreamDownload = {\n    /**\n     * Indicates the progress as a percentage between 0 and 100.\n     */\n    percentComplete: number;\n    /**\n     * The status of a generated download.\n     */\n    status: StreamDownloadStatus;\n    /**\n     * The URL to access the generated download.\n     */\n    url?: string;\n};\n/**\n * An object with download type keys. Each key is optional and only present if that\n * download type has been created.\n */\ntype StreamDownloadGetResponse = {\n    /**\n     * The audio-only download. Only present if this download type has been created.\n     */\n    audio?: StreamDownload;\n    /**\n     * The default video download. Only present if this download type has been created.\n     */\n    default?: StreamDownload;\n};\ntype StreamWatermarkPosition = 'upperRight' | 'upperLeft' | 'lowerLeft' | 'lowerRight' | 'center';\ntype StreamWatermark = {\n    /**\n     * The unique identifier for a watermark profile.\n     */\n    id: string;\n    /**\n     * The size of the image in bytes.\n     */\n    size: number;\n    /**\n     * The height of the image in pixels.\n     */\n    height: number;\n    /**\n     * The width of the image in pixels.\n     */\n    width: number;\n    /**\n     * The date and a time a watermark profile was created.\n     */\n    created: string;\n    /**\n     * The source URL for a downloaded image. If the watermark profile was created via\n     * direct upload, this field is null.\n     */\n    downloadedFrom: string | null;\n    /**\n     * A short description of the watermark profile.\n     */\n    name: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the image\n     * is already semi-transparent, setting this to `1.0` will not make the image\n     * completely opaque.\n     */\n    opacity: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the video\n     * and the image. `0.0` indicates no padding, and `1.0` indicates a fully padded\n     * video width or length, as determined by the algorithm.\n     */\n    padding: number;\n    /**\n     * The size of the image relative to the overall size of the video. This parameter\n     * will adapt to horizontal and vertical videos automatically. `0.0` indicates no\n     * scaling (use the size of the image as-is), and `1.0 `fills the entire video.\n     */\n    scale: number;\n    /**\n     * The location of the image. Valid positions are: `upperRight`, `upperLeft`,\n     * `lowerLeft`, `lowerRight`, and `center`. Note that `center` ignores the\n     * `padding` parameter.\n     */\n    position: StreamWatermarkPosition;\n};\ntype StreamWatermarkCreateParams = {\n    /**\n     * A short description of the watermark profile.\n     */\n    name?: string;\n    /**\n     * The translucency of the image. A value of `0.0` makes the image completely\n     * transparent, and `1.0` makes the image completely opaque. Note that if the\n     * image is already semi-transparent, setting this to `1.0` will not make the\n     * image completely opaque.\n     */\n    opacity?: number;\n    /**\n     * The whitespace between the adjacent edges (determined by position) of the\n     * video and the image. `0.0` indicates no padding, and `1.0` indicates a fully\n     * padded video width or length, as determined by the algorithm.\n     */\n    padding?: number;\n    /**\n     * The size of the image relative to the overall size of the video. This\n     * parameter will adapt to horizontal and vertical videos automatically. `0.0`\n     * indicates no scaling (use the size of the image as-is), and `1.0 `fills the\n     * entire video.\n     */\n    scale?: number;\n    /**\n     * The location of the image.\n     */\n    position?: StreamWatermarkPosition;\n};\ntype StreamVideosListParams = {\n    /**\n     * The maximum number of videos to return.\n     */\n    limit?: number;\n    /**\n     * Return videos created before this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    before?: string;\n    /**\n     * Comparison operator for the `before` field.\n     * @default 'lt'\n     */\n    beforeComp?: StreamPaginationComparison;\n    /**\n     * Return videos created after this timestamp.\n     * (RFC3339/RFC3339Nano)\n     */\n    after?: string;\n    /**\n     * Comparison operator for the `after` field.\n     * @default 'gte'\n     */\n    afterComp?: StreamPaginationComparison;\n};\ntype StreamPaginationComparison = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';\n/**\n * Error object for Stream binding operations.\n */\ninterface StreamError extends Error {\n    readonly code: number;\n    readonly statusCode: number;\n    readonly message: string;\n    readonly stack?: string;\n}\ninterface InternalError extends StreamError {\n    name: 'InternalError';\n}\ninterface BadRequestError extends StreamError {\n    name: 'BadRequestError';\n}\ninterface NotFoundError extends StreamError {\n    name: 'NotFoundError';\n}\ninterface ForbiddenError extends StreamError {\n    name: 'ForbiddenError';\n}\ninterface RateLimitedError extends StreamError {\n    name: 'RateLimitedError';\n}\ninterface QuotaReachedError extends StreamError {\n    name: 'QuotaReachedError';\n}\ninterface MaxFileSizeError extends StreamError {\n    name: 'MaxFileSizeError';\n}\ninterface InvalidURLError extends StreamError {\n    name: 'InvalidURLError';\n}\ninterface AlreadyUploadedError extends StreamError {\n    name: 'AlreadyUploadedError';\n}\ninterface TooManyWatermarksError extends StreamError {\n    name: 'TooManyWatermarksError';\n}\ntype MarkdownDocument = {\n    name: string;\n    blob: Blob;\n};\ntype ConversionResponse = {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'markdown';\n    tokens: number;\n    data: string;\n} | {\n    id: string;\n    name: string;\n    mimeType: string;\n    format: 'error';\n    error: string;\n};\ntype ImageConversionOptions = {\n    descriptionLanguage?: 'en' | 'es' | 'fr' | 'it' | 'pt' | 'de';\n};\ntype EmbeddedImageConversionOptions = ImageConversionOptions & {\n    convert?: boolean;\n    maxConvertedImages?: number;\n};\ntype ConversionOptions = {\n    html?: {\n        images?: EmbeddedImageConversionOptions & {\n            convertOGImage?: boolean;\n        };\n        hostname?: string;\n        cssSelector?: string;\n    };\n    docx?: {\n        images?: EmbeddedImageConversionOptions;\n    };\n    image?: ImageConversionOptions;\n    pdf?: {\n        images?: EmbeddedImageConversionOptions;\n        metadata?: boolean;\n    };\n};\ntype ConversionRequestOptions = {\n    gateway?: GatewayOptions;\n    extraHeaders?: object;\n    conversionOptions?: ConversionOptions;\n};\ntype SupportedFileFormat = {\n    mimeType: string;\n    extension: string;\n};\ndeclare abstract class ToMarkdownService {\n    transform(files: MarkdownDocument[], options?: ConversionRequestOptions): Promise<ConversionResponse[]>;\n    transform(files: MarkdownDocument, options?: ConversionRequestOptions): Promise<ConversionResponse>;\n    supported(): Promise<SupportedFileFormat[]>;\n}\ndeclare namespace TailStream {\n    interface Header {\n        readonly name: string;\n        readonly value: string;\n    }\n    interface FetchEventInfo {\n        readonly type: \"fetch\";\n        readonly method: string;\n        readonly url: string;\n        readonly cfJson?: object;\n        readonly headers: Header[];\n    }\n    interface JsRpcEventInfo {\n        readonly type: \"jsrpc\";\n    }\n    interface ScheduledEventInfo {\n        readonly type: \"scheduled\";\n        readonly scheduledTime: Date;\n        readonly cron: string;\n    }\n    interface AlarmEventInfo {\n        readonly type: \"alarm\";\n        readonly scheduledTime: Date;\n    }\n    interface QueueEventInfo {\n        readonly type: \"queue\";\n        readonly queueName: string;\n        readonly batchSize: number;\n    }\n    interface EmailEventInfo {\n        readonly type: \"email\";\n        readonly mailFrom: string;\n        readonly rcptTo: string;\n        readonly rawSize: number;\n    }\n    interface TraceEventInfo {\n        readonly type: \"trace\";\n        readonly traces: (string | null)[];\n    }\n    interface HibernatableWebSocketEventInfoMessage {\n        readonly type: \"message\";\n    }\n    interface HibernatableWebSocketEventInfoError {\n        readonly type: \"error\";\n    }\n    interface HibernatableWebSocketEventInfoClose {\n        readonly type: \"close\";\n        readonly code: number;\n        readonly wasClean: boolean;\n    }\n    interface HibernatableWebSocketEventInfo {\n        readonly type: \"hibernatableWebSocket\";\n        readonly info: HibernatableWebSocketEventInfoClose | HibernatableWebSocketEventInfoError | HibernatableWebSocketEventInfoMessage;\n    }\n    interface CustomEventInfo {\n        readonly type: \"custom\";\n    }\n    interface FetchResponseInfo {\n        readonly type: \"fetch\";\n        readonly statusCode: number;\n    }\n    type EventOutcome = \"ok\" | \"canceled\" | \"exception\" | \"unknown\" | \"killSwitch\" | \"daemonDown\" | \"exceededCpu\" | \"exceededMemory\" | \"loadShed\" | \"responseStreamDisconnected\" | \"scriptNotFound\";\n    interface ScriptVersion {\n        readonly id: string;\n        readonly tag?: string;\n        readonly message?: string;\n    }\n    interface Onset {\n        readonly type: \"onset\";\n        readonly attributes: Attribute[];\n        // id for the span being opened by this Onset event.\n        readonly spanId: string;\n        readonly dispatchNamespace?: string;\n        readonly entrypoint?: string;\n        readonly executionModel: string;\n        readonly scriptName?: string;\n        readonly scriptTags?: string[];\n        readonly scriptVersion?: ScriptVersion;\n        readonly info: FetchEventInfo | JsRpcEventInfo | ScheduledEventInfo | AlarmEventInfo | QueueEventInfo | EmailEventInfo | TraceEventInfo | HibernatableWebSocketEventInfo | CustomEventInfo;\n    }\n    interface Outcome {\n        readonly type: \"outcome\";\n        readonly outcome: EventOutcome;\n        readonly cpuTime: number;\n        readonly wallTime: number;\n    }\n    interface SpanOpen {\n        readonly type: \"spanOpen\";\n        readonly name: string;\n        // id for the span being opened by this SpanOpen event.\n        readonly spanId: string;\n        readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;\n    }\n    interface SpanClose {\n        readonly type: \"spanClose\";\n        readonly outcome: EventOutcome;\n    }\n    interface DiagnosticChannelEvent {\n        readonly type: \"diagnosticChannel\";\n        readonly channel: string;\n        readonly message: any;\n    }\n    interface Exception {\n        readonly type: \"exception\";\n        readonly name: string;\n        readonly message: string;\n        readonly stack?: string;\n    }\n    interface Log {\n        readonly type: \"log\";\n        readonly level: \"debug\" | \"error\" | \"info\" | \"log\" | \"warn\";\n        readonly message: object;\n    }\n    interface DroppedEventsDiagnostic {\n        readonly diagnosticsType: \"droppedEvents\";\n        readonly count: number;\n    }\n    interface StreamDiagnostic {\n        readonly type: 'streamDiagnostic';\n        // To add new diagnostic types, define a new interface and add it to this union type.\n        readonly diagnostic: DroppedEventsDiagnostic;\n    }\n    // This marks the worker handler return information.\n    // This is separate from Outcome because the worker invocation can live for a long time after\n    // returning. For example - Websockets that return an http upgrade response but then continue\n    // streaming information or SSE http connections.\n    interface Return {\n        readonly type: \"return\";\n        readonly info?: FetchResponseInfo;\n    }\n    interface Attribute {\n        readonly name: string;\n        readonly value: string | string[] | boolean | boolean[] | number | number[] | bigint | bigint[];\n    }\n    interface Attributes {\n        readonly type: \"attributes\";\n        readonly info: Attribute[];\n    }\n    type EventType = Onset | Outcome | SpanOpen | SpanClose | DiagnosticChannelEvent | Exception | Log | StreamDiagnostic | Return | Attributes;\n    // Context in which this trace event lives.\n    interface SpanContext {\n        // Single id for the entire top-level invocation\n        // This should be a new traceId for the first worker stage invoked in the eyeball request and then\n        // same-account service-bindings should reuse the same traceId but cross-account service-bindings\n        // should use a new traceId.\n        readonly traceId: string;\n        // spanId in which this event is handled\n        // for Onset and SpanOpen events this would be the parent span id\n        // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events\n        // For Hibernate and Mark this would be the span under which they were emitted.\n        // spanId is not set ONLY if:\n        //  1. This is an Onset event\n        //  2. We are not inheriting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)\n        readonly spanId?: string;\n    }\n    interface TailEvent<Event extends EventType> {\n        // invocation id of the currently invoked worker stage.\n        // invocation id will always be unique to every Onset event and will be the same until the Outcome event.\n        readonly invocationId: string;\n        // Inherited spanContext for this event.\n        readonly spanContext: SpanContext;\n        readonly timestamp: Date;\n        readonly sequence: number;\n        readonly event: Event;\n    }\n    type TailEventHandler<Event extends EventType = EventType> = (event: TailEvent<Event>) => void | Promise<void>;\n    type TailEventHandlerObject = {\n        outcome?: TailEventHandler<Outcome>;\n        spanOpen?: TailEventHandler<SpanOpen>;\n        spanClose?: TailEventHandler<SpanClose>;\n        diagnosticChannel?: TailEventHandler<DiagnosticChannelEvent>;\n        exception?: TailEventHandler<Exception>;\n        log?: TailEventHandler<Log>;\n        return?: TailEventHandler<Return>;\n        attributes?: TailEventHandler<Attributes>;\n    };\n    type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;\n}\n// Copyright (c) 2022-2023 Cloudflare, Inc.\n// Licensed under the Apache 2.0 license found in the LICENSE file or at:\n//     https://opensource.org/licenses/Apache-2.0\n/**\n * Data types supported for holding vector metadata.\n */\ntype VectorizeVectorMetadataValue = string | number | boolean | string[];\n/**\n * Additional information to associate with a vector.\n */\ntype VectorizeVectorMetadata = VectorizeVectorMetadataValue | Record<string, VectorizeVectorMetadataValue>;\ntype VectorFloatArray = Float32Array | Float64Array;\ninterface VectorizeError {\n    code?: number;\n    error: string;\n}\n/**\n * Comparison logic/operation to use for metadata filtering.\n *\n * This list is expected to grow as support for more operations are released.\n */\ntype VectorizeVectorMetadataFilterOp = '$eq' | '$ne' | '$lt' | '$lte' | '$gt' | '$gte';\ntype VectorizeVectorMetadataFilterCollectionOp = '$in' | '$nin';\n/**\n * Filter criteria for vector metadata used to limit the retrieved query result set.\n */\ntype VectorizeVectorMetadataFilter = {\n    [field: string]: Exclude<VectorizeVectorMetadataValue, string[]> | null | {\n        [Op in VectorizeVectorMetadataFilterOp]?: Exclude<VectorizeVectorMetadataValue, string[]> | null;\n    } | {\n        [Op in VectorizeVectorMetadataFilterCollectionOp]?: Exclude<VectorizeVectorMetadataValue, string[]>[];\n    };\n};\n/**\n * Supported distance metrics for an index.\n * Distance metrics determine how other \"similar\" vectors are determined.\n */\ntype VectorizeDistanceMetric = \"euclidean\" | \"cosine\" | \"dot-product\";\n/**\n * Metadata return levels for a Vectorize query.\n *\n * Default to \"none\".\n *\n * @property all      Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.\n * @property indexed  Return all metadata fields configured for indexing in the vector return set. This level of retrieval is \"free\" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).\n * @property none     No indexed metadata will be returned.\n */\ntype VectorizeMetadataRetrievalLevel = \"all\" | \"indexed\" | \"none\";\ninterface VectorizeQueryOptions {\n    topK?: number;\n    namespace?: string;\n    returnValues?: boolean;\n    returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;\n    filter?: VectorizeVectorMetadataFilter;\n}\n/**\n * Information about the configuration of an index.\n */\ntype VectorizeIndexConfig = {\n    dimensions: number;\n    metric: VectorizeDistanceMetric;\n} | {\n    preset: string; // keep this generic, as we'll be adding more presets in the future and this is only in a read capacity\n};\n/**\n * Metadata about an existing index.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeIndexInfo} for its post-beta equivalent.\n */\ninterface VectorizeIndexDetails {\n    /** The unique ID of the index */\n    readonly id: string;\n    /** The name of the index. */\n    name: string;\n    /** (optional) A human readable description for the index. */\n    description?: string;\n    /** The index configuration, including the dimension size and distance metric. */\n    config: VectorizeIndexConfig;\n    /** The number of records containing vectors within the index. */\n    vectorsCount: number;\n}\n/**\n * Metadata about an existing index.\n */\ninterface VectorizeIndexInfo {\n    /** The number of records containing vectors within the index. */\n    vectorCount: number;\n    /** Number of dimensions the index has been configured for. */\n    dimensions: number;\n    /** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToDatetime: number;\n    /** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */\n    processedUpToMutation: number;\n}\n/**\n * Represents a single vector value set along with its associated metadata.\n */\ninterface VectorizeVector {\n    /** The ID for the vector. This can be user-defined, and must be unique. It should uniquely identify the object, and is best set based on the ID of what the vector represents. */\n    id: string;\n    /** The vector values */\n    values: VectorFloatArray | number[];\n    /** The namespace this vector belongs to. */\n    namespace?: string;\n    /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */\n    metadata?: Record<string, VectorizeVectorMetadata>;\n}\n/**\n * Represents a matched vector for a query along with its score and (if specified) the matching vector information.\n */\ntype VectorizeMatch = Pick<Partial<VectorizeVector>, \"values\"> & Omit<VectorizeVector, \"values\"> & {\n    /** The score or rank for similarity, when returned as a result */\n    score: number;\n};\n/**\n * A set of matching {@link VectorizeMatch} for a particular query.\n */\ninterface VectorizeMatches {\n    matches: VectorizeMatch[];\n    count: number;\n}\n/**\n * Results of an operation that performed a mutation on a set of vectors.\n * Here, `ids` is a list of vectors that were successfully processed.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link VectorizeAsyncMutation} for its post-beta equivalent.\n */\ninterface VectorizeVectorMutation {\n    /* List of ids of vectors that were successfully processed. */\n    ids: string[];\n    /* Total count of the number of processed vectors. */\n    count: number;\n}\n/**\n * Result type indicating a mutation on the Vectorize Index.\n * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.\n */\ninterface VectorizeAsyncMutation {\n    /** The unique identifier for the async mutation operation containing the changeset. */\n    mutationId: string;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.\n * See {@link Vectorize} for its new implementation.\n */\ndeclare abstract class VectorizeIndex {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexDetails>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with the ids & count of records that were successfully processed (and thus deleted).\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeVectorMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * A Vectorize Vector Search Index for querying vectors/embeddings.\n *\n * Mutations in this version are async, returning a mutation id.\n */\ndeclare abstract class Vectorize {\n    /**\n     * Get information about the currently bound index.\n     * @returns A promise that resolves with information about the current index.\n     */\n    public describe(): Promise<VectorizeIndexInfo>;\n    /**\n     * Use the provided vector to perform a similarity search across the index.\n     * @param vector Input vector that will be used to drive the similarity search.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public query(vector: VectorFloatArray | number[], options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Use the provided vector-id to perform a similarity search across the index.\n     * @param vectorId Id for a vector in the index against which the index should be queried.\n     * @param options Configuration options to massage the returned data.\n     * @returns A promise that resolves with matched and scored vectors.\n     */\n    public queryById(vectorId: string, options?: VectorizeQueryOptions): Promise<VectorizeMatches>;\n    /**\n     * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.\n     * @param vectors List of vectors that will be inserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.\n     */\n    public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.\n     * @param vectors List of vectors that will be upserted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.\n     */\n    public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Delete a list of vectors with a matching id.\n     * @param ids List of vector ids that should be deleted.\n     * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.\n     */\n    public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;\n    /**\n     * Get a list of vectors with a matching id.\n     * @param ids List of vector ids that should be returned.\n     * @returns A promise that resolves with the raw unscored vectors matching the id set.\n     */\n    public getByIds(ids: string[]): Promise<VectorizeVector[]>;\n}\n/**\n * The interface for \"version_metadata\" binding\n * providing metadata about the Worker Version using this binding.\n */\ntype WorkerVersionMetadata = {\n    /** The ID of the Worker Version using this binding */\n    id: string;\n    /** The tag of the Worker Version using this binding */\n    tag: string;\n    /** The timestamp of when the Worker Version was uploaded */\n    timestamp: string;\n};\ninterface DynamicDispatchLimits {\n    /**\n     * Limit CPU time in milliseconds.\n     */\n    cpuMs?: number;\n    /**\n     * Limit number of subrequests.\n     */\n    subRequests?: number;\n}\ninterface DynamicDispatchOptions {\n    /**\n     * Limit resources of invoked Worker script.\n     */\n    limits?: DynamicDispatchLimits;\n    /**\n     * Arguments for outbound Worker script, if configured.\n     */\n    outbound?: {\n        [key: string]: any;\n    };\n}\ninterface DispatchNamespace {\n    /**\n    * @param name Name of the Worker script.\n    * @param args Arguments to Worker script.\n    * @param options Options for Dynamic Dispatch invocation.\n    * @returns A Fetcher object that allows you to send requests to the Worker script.\n    * @throws If the Worker script does not exist in this dispatch namespace, an error will be thrown.\n    */\n    get(name: string, args?: {\n        [key: string]: any;\n    }, options?: DynamicDispatchOptions): Fetcher;\n}\ndeclare module 'cloudflare:workflows' {\n    /**\n     * NonRetryableError allows for a user to throw a fatal error\n     * that makes a Workflow instance fail immediately without triggering a retry\n     */\n    export class NonRetryableError extends Error {\n        public constructor(message: string, name?: string);\n    }\n}\ndeclare abstract class Workflow<PARAMS = unknown> {\n    /**\n     * Get a handle to an existing instance of the Workflow.\n     * @param id Id for the instance of this Workflow\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public get(id: string): Promise<WorkflowInstance>;\n    /**\n     * Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.\n     * @param options Options when creating an instance including id and params\n     * @returns A promise that resolves with a handle for the Instance\n     */\n    public create(options?: WorkflowInstanceCreateOptions<PARAMS>): Promise<WorkflowInstance>;\n    /**\n     * Create a batch of instances and return handle for all of them. If a provided id exists, an error will be thrown.\n     * `createBatch` is limited at 100 instances at a time or when the RPC limit for the batch (1MiB) is reached.\n     * @param batch List of Options when creating an instance including name and params\n     * @returns A promise that resolves with a list of handles for the created instances.\n     */\n    public createBatch(batch: WorkflowInstanceCreateOptions<PARAMS>[]): Promise<WorkflowInstance[]>;\n}\ntype WorkflowDurationLabel = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';\ntype WorkflowSleepDuration = `${number} ${WorkflowDurationLabel}${'s' | ''}` | number;\ntype WorkflowRetentionDuration = WorkflowSleepDuration;\ninterface WorkflowInstanceCreateOptions<PARAMS = unknown> {\n    /**\n     * An id for your Workflow instance. Must be unique within the Workflow.\n     */\n    id?: string;\n    /**\n     * The event payload the Workflow instance is triggered with\n     */\n    params?: PARAMS;\n    /**\n     * The retention policy for Workflow instance.\n     * Defaults to the maximum retention period available for the owner's account.\n     */\n    retention?: {\n        successRetention?: WorkflowRetentionDuration;\n        errorRetention?: WorkflowRetentionDuration;\n    };\n}\ntype InstanceStatus = {\n    status: 'queued' // means that instance is waiting to be started (see concurrency limits)\n     | 'running' | 'paused' | 'errored' | 'terminated' // user terminated the instance while it was running\n     | 'complete' | 'waiting' // instance is hibernating and waiting for sleep or event to finish\n     | 'waitingForPause' // instance is finishing the current work to pause\n     | 'unknown';\n    error?: {\n        name: string;\n        message: string;\n    };\n    output?: unknown;\n};\ninterface WorkflowError {\n    code?: number;\n    message: string;\n}\ndeclare abstract class WorkflowInstance {\n    public id: string;\n    /**\n     * Pause the instance.\n     */\n    public pause(): Promise<void>;\n    /**\n     * Resume the instance. If it is already running, an error will be thrown.\n     */\n    public resume(): Promise<void>;\n    /**\n     * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.\n     */\n    public terminate(): Promise<void>;\n    /**\n     * Restart the instance.\n     */\n    public restart(): Promise<void>;\n    /**\n     * Returns the current status of the instance.\n     */\n    public status(): Promise<InstanceStatus>;\n    /**\n     * Send an event to this instance.\n     */\n    public sendEvent({ type, payload, }: {\n        type: string;\n        payload: unknown;\n    }): Promise<void>;\n}\n"
  },
  {
    "path": "examples/solid/start-basic-cloudflare/wrangler.jsonc",
    "content": "{\n  \"$schema\": \"node_modules/wrangler/config-schema.json\",\n  \"name\": \"tanstack-start-app\",\n  \"compatibility_date\": \"2025-09-24\",\n  \"compatibility_flags\": [\"nodejs_compat\"],\n  \"main\": \"@tanstack/solid-start/server-entry\",\n  \"vars\": {\n    \"MY_VAR\": \"Hello from Cloudflare\",\n  },\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/.gitignore",
    "content": "node_modules\n.DS_Store\n.cache\n.env\ndist\n.wrangler\n\n# Local Netlify folder\n.netlify\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/.prettierignore",
    "content": "**/public\npnpm-lock.yaml\nrouteTree.gen.ts\nworker-configuration.d.ts\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/README.md",
    "content": "# Start Basic Netlify\n\n## Getting Started\n\n### Install the dependencies\n\n```bash\npnpm i\n```\n\n### Start the development server\n\n```bash\npnpm dev\n```\n\n### Build for Production\n\n```bash\npnpm build\n```\n\n### Deploy to Netlify\n\n```sh\nnetlify deploy\n```\n\n## Accessing bindings\n\nYou can access Cloudflare bindings in server functions by using importable `env`:\n\n```ts\nimport { env } from 'cloudflare:workers'\n```\n\nSee `src/routes/index.tsx` for an example.\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/netlify.toml",
    "content": "[build]\n  command = \"vite build\"\n  publish = \"dist/client\"\n[dev]\n  command = \"vite dev\"\n  port = 3000"
  },
  {
    "path": "examples/solid/start-basic-netlify/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-basic-netlify\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@netlify/vite-plugin-tanstack-start\": \"^1.1.4\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/components/PostError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/components/UserError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as CustomScriptDotjsRouteImport } from './routes/customScript[.]js'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CustomScriptDotjsRoute = CustomScriptDotjsRouteImport.update({\n  id: '/customScript.js',\n  path: '/customScript.js',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/_pathlessLayout/_nested-layout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/api/users/$userId'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  CustomScriptDotjsRoute: typeof CustomScriptDotjsRoute\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/customScript.js': {\n      id: '/customScript.js'\n      path: '/customScript.js'\n      fullPath: '/customScript.js'\n      preLoaderRoute: typeof CustomScriptDotjsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  CustomScriptDotjsRoute: CustomScriptDotjsRoute,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n    scripts: [\n      {\n        src: '/customScript.js',\n        type: 'text/javascript',\n      },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(\n            'https://jsonplaceholder.typicode.com/users/' + params.userId,\n          )\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n\n          // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n          const user = (await res.json()) as User\n\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { getRequestHeaders } from '@tanstack/solid-start/server'\nimport { createMiddleware } from '@tanstack/solid-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: /users')\n  console.info('Request Headers:', getRequestHeaders())\n  const result = await next()\n  result.response.headers.set('x-users', 'true')\n  console.info('Out: /users')\n  return result\n})\n\nconst testParentMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: testParentMiddleware')\n  const result = await next()\n  result.response.headers.set('x-test-parent', 'true')\n  console.info('Out: testParentMiddleware')\n  return result\n})\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('GET /api/users @', request.url)\n        console.info('Fetching users... @', request.url)\n        const res = await fetch('https://jsonplaceholder.typicode.com/users')\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n\n        // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n        const data = (await res.json()) as Array<User>\n\n        const list = data.slice(0, 10)\n\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/customScript[.]js.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/customScript.js')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response('console.log(\"Hello from customScript.js!\")', {\n          headers: {\n            'Content-Type': 'application/javascript',\n          },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { Suspense, createSignal } from 'solid-js'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(({ data: name }) => {\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: name }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: 'Tanner Linsley' }),\n      person: await personServerFn({ data: 'John Doe' }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {loaderData().person.name} - {loaderData().person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={loaderData().deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={loaderData().deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount(count() + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport const Route = createFileRoute('/')({\n  loader: () => getData(),\n  component: Home,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    message: `Running in ${navigator.userAgent}`,\n  }\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <p>{data().message}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: String(post().id),\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: String(post.id),\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) =>\n    fetchPost({\n      data: postId,\n    }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/redirect.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { NotFound } from 'src/components/NotFound'\nimport { UserErrorComponent } from 'src/components/UserError'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    try {\n      const res = await fetch('/api/users/' + userId)\n      if (!res.ok) {\n        throw new Error('Unexpected status code')\n      }\n\n      const data = await res.json()\n\n      return data as User\n    } catch {\n      throw new Error('Failed to fetch user')\n    }\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user().name}</h4>\n      <div class=\"text-sm\">{user().email}</div>\n      <div>\n        <a\n          href={`/api/users/${user().id}`}\n          class=\"text-blue-800 hover:text-blue-600 underline\"\n        >\n          View as JSON\n        </a>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div>\n      Select a user or{' '}\n      <a href=\"/api/users\" class=\"text-blue-800 hover:text-blue-600 underline\">\n        view as JSON\n      </a>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const res = await fetch('/api/users')\n\n    if (!res.ok) {\n      throw new Error('Unexpected status code')\n    }\n\n    const data = await res.json()\n\n    return data as Array<User>\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users(),\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/utils/loggingMiddleware.tsx",
    "content": "import { createMiddleware } from '@tanstack/solid-start'\n\nconst preLogMiddleware = createMiddleware({ type: 'function' })\n  .client(async (ctx) => {\n    const clientTime = new Date()\n\n    return ctx.next({\n      context: {\n        clientTime,\n      },\n      sendContext: {\n        clientTime,\n      },\n    })\n  })\n  .server(async (ctx) => {\n    const serverTime = new Date()\n\n    return ctx.next({\n      sendContext: {\n        serverTime,\n        durationToServer:\n          serverTime.getTime() - ctx.context.clientTime.getTime(),\n      },\n    })\n  })\n\nexport const logMiddleware = createMiddleware({ type: 'function' })\n  .middleware([preLogMiddleware])\n  .client(async (ctx) => {\n    const res = await ctx.next()\n\n    const now = new Date()\n    console.log('Client Req/Res:', {\n      duration: now.getTime() - res.context.clientTime.getTime(),\n      durationToServer: res.context.durationToServer,\n      durationFromServer: now.getTime() - res.context.serverTime.getTime(),\n    })\n\n    return res\n  })\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport type PostType = {\n  id: number\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'POST' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const res = await fetch(\n      `https://jsonplaceholder.typicode.com/posts/${data}`,\n    )\n    if (!res.ok) {\n      if (res.status === 404) {\n        throw notFound()\n      }\n\n      throw new Error('Failed to fetch post')\n    }\n\n    const post = await res.json()\n\n    return post as PostType\n  })\n\nexport const fetchPosts = createServerFn().handler(async () => {\n  console.info('Fetching posts...')\n  const res = await fetch('https://jsonplaceholder.typicode.com/posts')\n  if (!res.ok) {\n    throw new Error('Failed to fetch posts')\n  }\n\n  const posts = await res.json()\n\n  return (posts as Array<PostType>).slice(0, 10)\n})\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-netlify/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport netlify from '@netlify/vite-plugin-tanstack-start'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tailwindcss(),\n    netlify(),\n    tanstackStart(),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/.gitignore",
    "content": "node_modules\n.DS_Store\n.cache\n.env\ndist\n.wrangler\n\n# Local Netlify folder\n.netlify\n.nitro"
  },
  {
    "path": "examples/solid/start-basic-nitro/.prettierignore",
    "content": "**/public\npnpm-lock.yaml\nrouteTree.gen.ts\nworker-configuration.d.ts\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/README.md",
    "content": "# Start Basic Netlify\n\n## Getting Started\n\n### Install the dependencies\n\n```bash\npnpm i\n```\n\n### Start the development server\n\n```bash\npnpm dev\n```\n\n### Build for Production\n\n```bash\npnpm build\n```\n\n### Deploy to Netlify\n\n```sh\nnetlify deploy\n```\n\n## Accessing bindings\n\nYou can access Cloudflare bindings in server functions by using importable `env`:\n\n```ts\nimport { env } from 'cloudflare:workers'\n```\n\nSee `src/routes/index.tsx` for an example.\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-basic-nitro\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"nitro\": \"^3.0.260311-beta\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/components/PostError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/components/UserError.tsx",
    "content": "import { ErrorComponent } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as CustomScriptDotjsRouteImport } from './routes/customScript[.]js'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst CustomScriptDotjsRoute = CustomScriptDotjsRouteImport.update({\n  id: '/customScript.js',\n  path: '/customScript.js',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/customScript.js': typeof CustomScriptDotjsRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$userId': typeof ApiUsersUserIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/customScript.js'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$userId'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/customScript.js'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/_pathlessLayout/_nested-layout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/api/users/$userId'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  CustomScriptDotjsRoute: typeof CustomScriptDotjsRoute\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/customScript.js': {\n      id: '/customScript.js'\n      path: '/customScript.js'\n      fullPath: '/customScript.js'\n      preLoaderRoute: typeof CustomScriptDotjsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$userId': {\n      id: '/api/users/$userId'\n      path: '/$userId'\n      fullPath: '/api/users/$userId'\n      preLoaderRoute: typeof ApiUsersUserIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersUserIdRoute: ApiUsersUserIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  CustomScriptDotjsRoute: CustomScriptDotjsRoute,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  UsersRoute: UsersRouteWithChildren,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n    scripts: [\n      {\n        src: '/customScript.js',\n        type: 'text/javascript',\n      },\n    ],\n  }),\n  errorComponent: DefaultCatchBoundary,\n  notFoundComponent: () => <NotFound />,\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/api/users.$userId.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '~/utils/users'\n\nexport const Route = createFileRoute('/api/users/$userId')({\n  server: {\n    handlers: {\n      GET: async ({ params, request }) => {\n        console.info(`Fetching users by id=${params.userId}... @`, request.url)\n        try {\n          const res = await fetch(\n            'https://jsonplaceholder.typicode.com/users/' + params.userId,\n          )\n          if (!res.ok) {\n            throw new Error('Failed to fetch user')\n          }\n\n          // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n          const user = (await res.json()) as User\n\n          return Response.json({\n            id: user.id,\n            name: user.name,\n            email: user.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { getRequestHeaders } from '@tanstack/solid-start/server'\nimport { createMiddleware } from '@tanstack/solid-start'\nimport type { User } from '~/utils/users'\n\nconst userLoggerMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: /users')\n  console.info('Request Headers:', getRequestHeaders())\n  const result = await next()\n  result.response.headers.set('x-users', 'true')\n  console.info('Out: /users')\n  return result\n})\n\nconst testParentMiddleware = createMiddleware().server(async ({ next }) => {\n  console.info('In: testParentMiddleware')\n  const result = await next()\n  result.response.headers.set('x-test-parent', 'true')\n  console.info('Out: testParentMiddleware')\n  return result\n})\n\nconst testMiddleware = createMiddleware()\n  .middleware([testParentMiddleware])\n  .server(async ({ next }) => {\n    console.info('In: testMiddleware')\n    const result = await next()\n    result.response.headers.set('x-test', 'true')\n\n    // if (Math.random() > 0.5) {\n    //   throw new Response(null, {\n    //     status: 302,\n    //     headers: { Location: 'https://www.google.com' },\n    //   })\n    // }\n\n    console.info('Out: testMiddleware')\n    return result\n  })\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    middleware: [testMiddleware, userLoggerMiddleware],\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('GET /api/users @', request.url)\n        console.info('Fetching users... @', request.url)\n        const res = await fetch('https://jsonplaceholder.typicode.com/users')\n        if (!res.ok) {\n          throw new Error('Failed to fetch users')\n        }\n\n        // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n        const data = (await res.json()) as Array<User>\n\n        const list = data.slice(0, 10)\n\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/customScript[.]js.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/customScript.js')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response('console.log(\"Hello from customScript.js!\")', {\n          headers: {\n            'Content-Type': 'application/javascript',\n          },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { Suspense, createSignal } from 'solid-js'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(({ data: name }) => {\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: name }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: 'Tanner Linsley' }),\n      person: await personServerFn({ data: 'John Doe' }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {loaderData().person.name} - {loaderData().person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={loaderData().deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={loaderData().deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount(count() + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport const Route = createFileRoute('/')({\n  loader: () => getData(),\n  component: Home,\n})\n\nconst getData = createServerFn().handler(() => {\n  return {\n    message: `Running in ${navigator.userAgent}`,\n  }\n})\n\nfunction Home() {\n  const data = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n      <p>{data().message}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/posts.$postId.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport { NotFound } from '~/components/NotFound'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: String(post().id),\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: String(post.id),\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport { PostErrorComponent } from '~/components/PostError'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId } }) =>\n    fetchPost({\n      data: postId,\n    }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/redirect.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/users.$userId.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { NotFound } from 'src/components/NotFound'\nimport { UserErrorComponent } from 'src/components/UserError'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ params: { userId } }) => {\n    try {\n      const res = await fetch('/api/users/' + userId)\n      if (!res.ok) {\n        throw new Error('Unexpected status code')\n      }\n\n      const data = await res.json()\n\n      return data as User\n    } catch {\n      throw new Error('Failed to fetch user')\n    }\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user().name}</h4>\n      <div class=\"text-sm\">{user().email}</div>\n      <div>\n        <a\n          href={`/api/users/${user().id}`}\n          class=\"text-blue-800 hover:text-blue-600 underline\"\n        >\n          View as JSON\n        </a>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return (\n    <div>\n      Select a user or{' '}\n      <a href=\"/api/users\" class=\"text-blue-800 hover:text-blue-600 underline\">\n        view as JSON\n      </a>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport type { User } from '../utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => {\n    const res = await fetch('/api/users')\n\n    if (!res.ok) {\n      throw new Error('Unexpected status code')\n    }\n\n    const data = await res.json()\n\n    return data as Array<User>\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users(),\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/utils/loggingMiddleware.tsx",
    "content": "import { createMiddleware } from '@tanstack/solid-start'\n\nconst preLogMiddleware = createMiddleware({ type: 'function' })\n  .client(async (ctx) => {\n    const clientTime = new Date()\n\n    return ctx.next({\n      context: {\n        clientTime,\n      },\n      sendContext: {\n        clientTime,\n      },\n    })\n  })\n  .server(async (ctx) => {\n    const serverTime = new Date()\n\n    return ctx.next({\n      sendContext: {\n        serverTime,\n        durationToServer:\n          serverTime.getTime() - ctx.context.clientTime.getTime(),\n      },\n    })\n  })\n\nexport const logMiddleware = createMiddleware({ type: 'function' })\n  .middleware([preLogMiddleware])\n  .client(async (ctx) => {\n    const res = await ctx.next()\n\n    const now = new Date()\n    console.log('Client Req/Res:', {\n      duration: now.getTime() - res.context.clientTime.getTime(),\n      durationToServer: res.context.durationToServer,\n      durationFromServer: now.getTime() - res.context.serverTime.getTime(),\n    })\n\n    return res\n  })\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/utils/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nexport type PostType = {\n  id: number\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'POST' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const res = await fetch(\n      `https://jsonplaceholder.typicode.com/posts/${data}`,\n    )\n    if (!res.ok) {\n      if (res.status === 404) {\n        throw notFound()\n      }\n\n      throw new Error('Failed to fetch post')\n    }\n\n    const post = await res.json()\n\n    return post as PostType\n  })\n\nexport const fetchPosts = createServerFn().handler(async () => {\n  console.info('Fetching posts...')\n  const res = await fetch('https://jsonplaceholder.typicode.com/posts')\n  if (!res.ok) {\n    throw new Error('Failed to fetch posts')\n  }\n\n  const posts = await res.json()\n\n  return (posts as Array<PostType>).slice(0, 10)\n})\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-nitro/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { nitro } from 'nitro/vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tailwindcss(),\n    nitro({ preset: 'node-server' }),\n    tanstackStart({\n      sitemap: { enabled: false },\n      prerender: {\n        enabled: true,\n        filter: ({ path }) =>\n          !path.startsWith('/users') &&\n          !path.startsWith('/this-route-does-not-exist') &&\n          !path.startsWith('/posts/i-do-not-exist') &&\n          !path.startsWith('/deferred'),\n      },\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-basic-solid-query/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/README.md",
    "content": "# Welcome to TanStack.com!\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Development\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Editing and previewing the docs of TanStack projects locally\n\nThe documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app.\nIn 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.\n\nFollow 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 :\n\n1. Create a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter the directory and clone this repo and the repo of the project there.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/tanstack.com.git\ngit clone git@github.com:TanStack/form.git\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- form/\n>    |\n>    +-- tanstack.com/\n> ```\n\n> [!WARNING]\n> 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.\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`.\n\n> [!NOTE]\n> The updated pages need to be manually reloaded in the browser.\n\n> [!WARNING]\n> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page!\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/package.json",
    "content": "{\n  \"name\": \"tanstack-start-example-basic-solid-query\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-query-devtools\": \"^5.90.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-router-ssr-query\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as UsersRouteRouteImport } from './routes/users.route'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as ApiUsersRouteImport } from './routes/api/users'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as ApiUsersIdRouteImport } from './routes/api/users.$id'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersRouteRoute = UsersRouteRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRouteRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst ApiUsersRoute = ApiUsersRouteImport.update({\n  id: '/api/users',\n  path: '/api/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiUsersIdRoute = ApiUsersIdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => ApiUsersRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/users': typeof UsersRouteRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/users': typeof UsersRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/api/users': typeof ApiUsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/api/users/$id': typeof ApiUsersIdRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/users'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/redirect'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/api/users/$id'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/users'\n    | '/_pathlessLayout'\n    | '/deferred'\n    | '/redirect'\n    | '/_pathlessLayout/_nested-layout'\n    | '/api/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/api/users/$id'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  UsersRouteRoute: typeof UsersRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  RedirectRoute: typeof RedirectRoute\n  ApiUsersRoute: typeof ApiUsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRouteRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/api/users': {\n      id: '/api/users'\n      path: '/api/users'\n      fullPath: '/api/users'\n      preLoaderRoute: typeof ApiUsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/users/$id': {\n      id: '/api/users/$id'\n      path: '/$id'\n      fullPath: '/api/users/$id'\n      preLoaderRoute: typeof ApiUsersIdRouteImport\n      parentRoute: typeof ApiUsersRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface UsersRouteRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteRouteChildren: UsersRouteRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteRouteWithChildren = UsersRouteRoute._addFileChildren(\n  UsersRouteRouteChildren,\n)\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface ApiUsersRouteChildren {\n  ApiUsersIdRoute: typeof ApiUsersIdRoute\n}\n\nconst ApiUsersRouteChildren: ApiUsersRouteChildren = {\n  ApiUsersIdRoute: ApiUsersIdRoute,\n}\n\nconst ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(\n  ApiUsersRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  UsersRouteRoute: UsersRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  RedirectRoute: RedirectRoute,\n  ApiUsersRoute: ApiUsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/router.tsx",
    "content": "import { QueryClient } from '@tanstack/solid-query'\nimport { createRouter } from '@tanstack/solid-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n\n  const router = createRouter({\n    routeTree,\n    context: { queryClient },\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n  })\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { SolidQueryDevtools } from '@tanstack/solid-query-devtools'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport type { QueryClient } from '@tanstack/solid-query'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <SolidQueryDevtools buttonPosition=\"bottom-left\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div>I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/api/users.$id.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\nimport type { User } from '../../utils/users'\n\nexport const Route = createFileRoute('/api/users/$id')({\n  server: {\n    handlers: {\n      GET: async ({ request, params }) => {\n        console.info(`Fetching users by id=${params.id}... @`, request.url)\n        try {\n          const res = await axios.get<User>(\n            'https://jsonplaceholder.typicode.com/users/' + params.id,\n          )\n          return Response.json({\n            id: res.data.id,\n            name: res.data.name,\n            email: res.data.email,\n          })\n        } catch (e) {\n          console.error(e)\n          return Response.json({ error: 'User not found' }, { status: 404 })\n        }\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/api/users.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\nimport type { User } from '../../utils/users'\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    handlers: {\n      GET: async ({ request }) => {\n        console.info('Fetching users... @', request.url)\n        const res = await axios.get<Array<User>>(\n          'https://jsonplaceholder.typicode.com/users',\n        )\n        const list = res.data.slice(0, 10)\n        return Response.json(\n          list.map((u) => ({ id: u.id, name: u.name, email: u.email })),\n        )\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/deferred.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { queryOptions, useQuery } from '@tanstack/solid-query'\nimport { Suspense, createSignal } from 'solid-js'\n\nconst deferredQueryOptions = () =>\n  queryOptions({\n    queryKey: ['deferred'],\n    queryFn: async () => {\n      await new Promise((r) => setTimeout(r, 3000))\n      return {\n        message: `Hello deferred from the server!`,\n        status: 'success',\n        time: new Date(),\n      }\n    },\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: ({ context }) => {\n    // Kick off loading as early as possible!\n    context.queryClient.prefetchQuery(deferredQueryOptions())\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n\n  return (\n    <div class=\"p-2\">\n      <Suspense fallback=\"Loading Middleman...\">\n        <DeferredQuery />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount(count() + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n\nfunction DeferredQuery() {\n  const deferredQuery = useQuery(() => deferredQueryOptions())\n\n  return (\n    <div>\n      <h1>Deferred Query</h1>\n      <div>Status: {deferredQuery.data?.status}</div>\n      <div>Message: {deferredQuery.data?.message}</div>\n      <div>Time: {deferredQuery.data?.time.toISOString()}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { postQueryOptions } from '../utils/posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport { NotFound } from '~/components/NotFound'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId }, context }) => {\n    const data = await context.queryClient.ensureQueryData(\n      postQueryOptions(postId),\n    )\n\n    return {\n      title: data.title,\n    }\n  },\n  head: ({ loaderData }) => ({\n    meta: loaderData ? [{ title: loaderData.title }] : undefined,\n  }),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const params = Route.useParams()\n  const postQuery = useQuery(() => postQueryOptions(params().postId))\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{postQuery.data?.title}</h4>\n      <div class=\"text-sm\">{postQuery.data?.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: postQuery.data!.id,\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/posts.route.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { postsQueryOptions } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(postsQueryOptions())\n  },\n  head: () => ({\n    meta: [{ title: 'Posts' }],\n  }),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const postsQuery = useQuery(() => postsQueryOptions())\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...(postsQuery.data || []),\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { useQuery } from '@tanstack/solid-query'\nimport { postQueryOptions } from '../utils/posts'\nimport { PostErrorComponent } from './posts.$postId'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: async ({ params: { postId }, context }) => {\n    const data = await context.queryClient.ensureQueryData(\n      postQueryOptions(postId),\n    )\n\n    return {\n      title: data.title,\n    }\n  },\n  head: ({ loaderData }) => ({\n    meta: loaderData ? [{ title: loaderData.title }] : undefined,\n  }),\n  errorComponent: PostErrorComponent,\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const params = Route.useParams()\n  const postQuery = useQuery(() => postQueryOptions(params().postId))\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{postQuery.data?.title}</h4>\n      <div class=\"text-sm\">{postQuery.data?.body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/redirect.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: async () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/users.$userId.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport { NotFound } from '~/components/NotFound'\nimport { userQueryOptions } from '~/utils/users'\n\nexport function UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: async ({ context, params: { userId } }) => {\n    await context.queryClient.ensureQueryData(userQueryOptions(userId))\n  },\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserComponent() {\n  const params = Route.useParams()\n  const userQuery = useQuery(() => userQueryOptions(params().userId))\n  const user = userQuery.data\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user?.name}</h4>\n      <div class=\"text-sm\">{user?.email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/routes/users.route.tsx",
    "content": "import { useQuery } from '@tanstack/solid-query'\nimport { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { usersQueryOptions } from '../utils/users'\n\nexport const Route = createFileRoute('/users')({\n  loader: async ({ context }) => {\n    await context.queryClient.ensureQueryData(usersQueryOptions())\n  },\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const usersQuery = useQuery(() => usersQueryOptions())\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...(usersQuery.data || []),\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/utils/posts.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n\nexport const postsQueryOptions = () =>\n  queryOptions({\n    queryKey: ['posts'],\n    queryFn: () => fetchPosts(),\n  })\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['post', postId],\n    queryFn: () => fetchPost({ data: postId }),\n  })\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/src/utils/users.tsx",
    "content": "import { queryOptions } from '@tanstack/solid-query'\nimport axios from 'redaxios'\n\nexport type User = {\n  id: number\n  name: string\n  email: string\n}\n\nexport const DEPLOY_URL = 'http://localhost:3000'\n\nexport const usersQueryOptions = () =>\n  queryOptions({\n    queryKey: ['users'],\n    queryFn: () =>\n      axios\n        .get<Array<User>>(DEPLOY_URL + '/api/users')\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch users')\n        }),\n  })\n\nexport const userQueryOptions = (id: string) =>\n  queryOptions({\n    queryKey: ['users', id],\n    queryFn: () =>\n      axios\n        .get<User>(DEPLOY_URL + '/api/users/' + id)\n        .then((r) => r.data)\n        .catch(() => {\n          throw new Error('Failed to fetch user')\n        }),\n  })\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-solid-query/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/start-basic-static/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/start-basic-static/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-basic-static/README.md",
    "content": "# Welcome to TanStack.com!\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Vercel!\n\n- [Vercel](https://vercel.com/)\n\n## Development\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Editing and previewing the docs of TanStack projects locally\n\nThe documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app.\nIn 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.\n\nFollow 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 :\n\n1. Create a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter the directory and clone this repo and the repo of the project there.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/tanstack.com.git\ngit clone git@github.com:TanStack/form.git\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- form/\n>    |\n>    +-- tanstack.com/\n> ```\n\n> [!WARNING]\n> 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.\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`.\n\n> [!NOTE]\n> The updated pages need to be manually reloaded in the browser.\n\n> [!WARNING]\n> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page!\n"
  },
  {
    "path": "examples/solid/start-basic-static/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-basic-static\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"@tanstack/start-static-server-functions\": \"^1.166.17\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.5.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.6.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error('DefaultCatchBoundary Error:', error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport function NotFound({ children }: { children?: any }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as UsersRouteImport } from './routes/users'\nimport { Route as RedirectRouteImport } from './routes/redirect'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as DeferredRouteImport } from './routes/deferred'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersIndexRouteImport } from './routes/users.index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'\nimport { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b'\nimport { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a'\n\nconst UsersRoute = UsersRouteImport.update({\n  id: '/users',\n  path: '/users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst RedirectRoute = RedirectRouteImport.update({\n  id: '/redirect',\n  path: '/redirect',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DeferredRoute = DeferredRouteImport.update({\n  id: '/deferred',\n  path: '/deferred',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UsersIndexRoute = UsersIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/$userId',\n  path: '/$userId',\n  getParentRoute: () => UsersRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PathlessLayoutNestedLayoutRoute =\n  PathlessLayoutNestedLayoutRouteImport.update({\n    id: '/_nested-layout',\n    getParentRoute: () => PathlessLayoutRoute,\n  } as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/posts_/$postId/deep',\n  path: '/posts/$postId/deep',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PathlessLayoutNestedLayoutRouteBRoute =\n  PathlessLayoutNestedLayoutRouteBRouteImport.update({\n    id: '/route-b',\n    path: '/route-b',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\nconst PathlessLayoutNestedLayoutRouteARoute =\n  PathlessLayoutNestedLayoutRouteARouteImport.update({\n    id: '/route-a',\n    path: '/route-a',\n    getParentRoute: () => PathlessLayoutNestedLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/deferred': typeof DeferredRoute\n  '/redirect': typeof RedirectRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/users': typeof UsersIndexRoute\n  '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/deferred': typeof DeferredRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/redirect': typeof RedirectRoute\n  '/users': typeof UsersRouteWithChildren\n  '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/users/$userId': typeof UsersUserIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/users/': typeof UsersIndexRoute\n  '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute\n  '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute\n  '/posts_/$postId/deep': typeof PostsPostIdDeepRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/route-a'\n    | '/route-b'\n    | '/posts/$postId/deep'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/deferred'\n    | '/redirect'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts'\n    | '/users'\n    | '/route-a'\n    | '/route-b'\n    | '/posts/$postId/deep'\n  id:\n    | '__root__'\n    | '/'\n    | '/_pathlessLayout'\n    | '/deferred'\n    | '/posts'\n    | '/redirect'\n    | '/users'\n    | '/_pathlessLayout/_nested-layout'\n    | '/posts/$postId'\n    | '/users/$userId'\n    | '/posts/'\n    | '/users/'\n    | '/_pathlessLayout/_nested-layout/route-a'\n    | '/_pathlessLayout/_nested-layout/route-b'\n    | '/posts_/$postId/deep'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  DeferredRoute: typeof DeferredRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RedirectRoute: typeof RedirectRoute\n  UsersRoute: typeof UsersRouteWithChildren\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/users': {\n      id: '/users'\n      path: '/users'\n      fullPath: '/users'\n      preLoaderRoute: typeof UsersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/redirect': {\n      id: '/redirect'\n      path: '/redirect'\n      fullPath: '/redirect'\n      preLoaderRoute: typeof RedirectRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/deferred': {\n      id: '/deferred'\n      path: '/deferred'\n      fullPath: '/deferred'\n      preLoaderRoute: typeof DeferredRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/users/': {\n      id: '/users/'\n      path: '/'\n      fullPath: '/users/'\n      preLoaderRoute: typeof UsersIndexRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/users/$userId': {\n      id: '/users/$userId'\n      path: '/$userId'\n      fullPath: '/users/$userId'\n      preLoaderRoute: typeof UsersUserIdRouteImport\n      parentRoute: typeof UsersRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_pathlessLayout/_nested-layout': {\n      id: '/_pathlessLayout/_nested-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/posts_/$postId/deep': {\n      id: '/posts_/$postId/deep'\n      path: '/posts/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_pathlessLayout/_nested-layout/route-b': {\n      id: '/_pathlessLayout/_nested-layout/route-b'\n      path: '/route-b'\n      fullPath: '/route-b'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n    '/_pathlessLayout/_nested-layout/route-a': {\n      id: '/_pathlessLayout/_nested-layout/route-a'\n      path: '/route-a'\n      fullPath: '/route-a'\n      preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport\n      parentRoute: typeof PathlessLayoutNestedLayoutRoute\n    }\n  }\n}\n\ninterface PathlessLayoutNestedLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute\n  PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute\n}\n\nconst PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =\n  {\n    PathlessLayoutNestedLayoutRouteARoute:\n      PathlessLayoutNestedLayoutRouteARoute,\n    PathlessLayoutNestedLayoutRouteBRoute:\n      PathlessLayoutNestedLayoutRouteBRoute,\n  }\n\nconst PathlessLayoutNestedLayoutRouteWithChildren =\n  PathlessLayoutNestedLayoutRoute._addFileChildren(\n    PathlessLayoutNestedLayoutRouteChildren,\n  )\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface UsersRouteChildren {\n  UsersUserIdRoute: typeof UsersUserIdRoute\n  UsersIndexRoute: typeof UsersIndexRoute\n}\n\nconst UsersRouteChildren: UsersRouteChildren = {\n  UsersUserIdRoute: UsersUserIdRoute,\n  UsersIndexRoute: UsersIndexRoute,\n}\n\nconst UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  DeferredRoute: DeferredRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RedirectRoute: RedirectRoute,\n  UsersRoute: UsersRouteWithChildren,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport { DefaultCatchBoundary } from './components/DefaultCatchBoundary'\nimport { NotFound } from './components/NotFound'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: DefaultCatchBoundary,\n    defaultNotFoundComponent: () => <NotFound />,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport type * as Solid from 'solid-js'\nimport { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'\nimport { NotFound } from '~/components/NotFound'\nimport appCss from '~/styles/app.css?url'\nimport { seo } from '~/utils/seo'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootLayout>\n        <DefaultCatchBoundary {...props} />\n      </RootLayout>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootLayout>\n      <Outlet />\n    </RootLayout>\n  )\n}\n\nfunction RootLayout({ children }: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>{' '}\n          <Link\n            to=\"/users\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Users\n          </Link>{' '}\n          <Link\n            to=\"/route-a\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Pathless Layout\n          </Link>{' '}\n          <Link\n            to=\"/deferred\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Deferred\n          </Link>{' '}\n          <Link\n            // @ts-expect-error\n            to=\"/this-route-does-not-exist\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            This Route Does Not Exist\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/_pathlessLayout/_nested-layout/route-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')(\n  {\n    component: LayoutAComponent,\n  },\n)\n\nfunction LayoutAComponent() {\n  return <div>I'm A!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/_pathlessLayout/_nested-layout/route-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')(\n  {\n    component: LayoutBComponent,\n  },\n)\n\nfunction LayoutBComponent() {\n  return <div>I'm B!</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/_pathlessLayout/_nested-layout.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout/_nested-layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/_pathlessLayout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/deferred.tsx",
    "content": "import { Await, createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { Suspense, createSignal } from 'solid-js'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nconst personServerFn = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .inputValidator((d: string) => d)\n  .handler(({ data: name }) => {\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nconst slowServerFn = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: name }) => {\n    await new Promise((r) => setTimeout(r, 1000))\n    return { name, randomNumber: Math.floor(Math.random() * 100) }\n  })\n\nexport const Route = createFileRoute('/deferred')({\n  loader: async () => {\n    return {\n      deferredStuff: new Promise<string>((r) =>\n        setTimeout(() => r('Hello deferred!'), 2000),\n      ),\n      deferredPerson: slowServerFn({ data: 'Tanner Linsley' }),\n      person: await personServerFn({ data: 'John Doe' }),\n    }\n  },\n  component: Deferred,\n})\n\nfunction Deferred() {\n  const [count, setCount] = createSignal(0)\n  const loaderData = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div data-testid=\"regular-person\">\n        {loaderData().person.name} - {loaderData().person.randomNumber}\n      </div>\n      <Suspense fallback={<div>Loading person...</div>}>\n        <Await\n          promise={loaderData().deferredPerson}\n          children={(data) => (\n            <div data-testid=\"deferred-person\">\n              {data.name} - {data.randomNumber}\n            </div>\n          )}\n        />\n      </Suspense>\n      <Suspense fallback={<div>Loading stuff...</div>}>\n        <Await\n          promise={loaderData().deferredStuff}\n          children={(data) => <h3 data-testid=\"deferred-stuff\">{data}</h3>}\n        />\n      </Suspense>\n      <div>Count: {count()}</div>\n      <div>\n        <button onClick={() => setCount(count() + 1)}>Increment</button>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport { NotFound } from '~/components/NotFound'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: PostErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post().id,\n        }}\n        activeProps={{ class: 'text-black font-bold' }}\n        class=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/posts_.$postId.deep.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../utils/posts'\n\nexport const Route = createFileRoute('/posts_/$postId/deep')({\n  loader: ({ params: { postId } }) =>\n    fetchPost({\n      data: postId,\n    }),\n  component: PostDeepComponent,\n})\n\nfunction PostDeepComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/posts\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        ← All Posts\n      </Link>\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/redirect.tsx",
    "content": "import { redirect, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/redirect')({\n  beforeLoad: async () => {\n    throw redirect({\n      to: '/posts',\n    })\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/users.$userId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\nimport { createServerFn } from '@tanstack/solid-start'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport type { User } from '~/utils/users'\nimport { NotFound } from '~/components/NotFound'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nconst fetchUser = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: userId }) => {\n    return axios\n      .get<User>('https://jsonplaceholder.typicode.com/users/' + userId)\n      .then((d) => ({\n        id: d.data.id,\n        name: d.data.name,\n        email: d.data.email,\n      }))\n      .catch((e) => {\n        throw new Error('Failed to fetch user')\n      })\n  })\n\nexport const Route = createFileRoute('/users/$userId')({\n  loader: ({ params: { userId } }) => fetchUser({ data: userId }),\n  errorComponent: UserErrorComponent,\n  component: UserComponent,\n  notFoundComponent: () => {\n    return <NotFound>User not found</NotFound>\n  },\n})\n\nfunction UserErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction UserComponent() {\n  const user = Route.useLoaderData()\n\n  if ('error' in user()) {\n    return <NotFound>User not found</NotFound>\n  }\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{user().name}</h4>\n      <div class=\"text-sm\">{user().email}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/users.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/users/')({\n  component: UsersIndexComponent,\n})\n\nfunction UsersIndexComponent() {\n  return <div>Select a user.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/routes/users.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport axios from 'redaxios'\nimport { createServerFn } from '@tanstack/solid-start'\nimport type { User } from '../utils/users'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nconst fetchUsers = createServerFn({ method: 'GET' })\n  .middleware([staticFunctionMiddleware])\n  .handler(async () => {\n    console.info('Fetching users...')\n    const res = await axios.get<Array<User>>(\n      'https://jsonplaceholder.typicode.com/users',\n    )\n\n    return res.data\n      .slice(0, 10)\n      .map((u) => ({ id: u.id, name: u.name, email: u.email }))\n  })\n\nexport const Route = createFileRoute('/users')({\n  loader: async () => fetchUsers(),\n  component: UsersComponent,\n})\n\nfunction UsersComponent() {\n  const users = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...users(),\n          { id: 'i-do-not-exist', name: 'Non-existent User', email: '' },\n        ].map((user) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/users/$userId\"\n                params={{\n                  userId: String(user.id),\n                }}\n                class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                activeProps={{ class: 'text-black font-bold' }}\n              >\n                <div>{user.name}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source '../**/*.{js,ts,jsx,tsx}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/utils/loggingMiddleware.tsx",
    "content": "import { createMiddleware } from '@tanstack/solid-start'\n\nexport const logMiddleware = createMiddleware({ type: 'function' })\n  .middleware([\n    createMiddleware({ type: 'function' })\n      .client(async (ctx) => {\n        const clientTime = new Date()\n\n        return await ctx.next({\n          context: {\n            clientTime,\n          },\n          sendContext: {\n            clientTime,\n          },\n        })\n      })\n      .server(async (ctx) => {\n        const serverTime = new Date()\n\n        return await ctx.next({\n          sendContext: {\n            serverTime,\n            durationToServer:\n              serverTime.getTime() - ctx.context.clientTime.getTime(),\n          },\n        })\n      }),\n  ])\n  .client(async (options) => {\n    const result = await options.next()\n\n    const now = new Date()\n\n    console.log('Client Req/Res:', {\n      duration: result.context.clientTime.getTime() - now.getTime(),\n      durationToServer: result.context.durationToServer,\n      durationFromServer: now.getTime() - result.context.serverTime.getTime(),\n    })\n\n    return result\n  })\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/utils/posts.tsx",
    "content": "import { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\nimport { notFound } from '@tanstack/solid-router'\nimport { logMiddleware } from './loggingMiddleware'\nimport { staticFunctionMiddleware } from '@tanstack/start-static-server-functions'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .middleware([logMiddleware, staticFunctionMiddleware])\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    console.info(`Fetching post with id ${data}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${data}`)\n      .catch((err) => {\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n      .then((r) => r.data)\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' })\n  .middleware([logMiddleware, staticFunctionMiddleware])\n  .handler(async () => {\n    console.info('Fetching posts...')\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  })\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/src/utils/users.tsx",
    "content": "export type User = {\n  id: number\n  name: string\n  email: string\n}\n\nexport const DEPLOY_URL = 'http://localhost:3000'\n"
  },
  {
    "path": "examples/solid/start-basic-static/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-basic-static/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    tailwindcss(),\n    tanstackStart({\n      spa: {\n        enabled: true,\n        prerender: {\n          crawlLinks: true,\n        },\n      },\n      sitemap: {\n        host: 'https://localhost:3000',\n      },\n      prerender: {\n        failOnError: true,\n        filter: (page) => {\n          return !page.path.includes('exist')\n        },\n      },\n    }),\n    viteSolid({ ssr: true }),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/start-bun/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-bun/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\ncount.txt\n.env\n.nitro\n.tanstack\n.output\n.vinxi\ntodos.json\n"
  },
  {
    "path": "examples/solid/start-bun/.prettierignore",
    "content": "package-lock.json\npnpm-lock.yaml\nyarn.lock"
  },
  {
    "path": "examples/solid/start-bun/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-bun/README.md",
    "content": "# TanStack Start + Bun Production Server\n\nAn optimized production server for TanStack Start applications using Bun, implementing intelligent static asset loading with configurable memory management.\n\n## 🚀 Features\n\n- **Hybrid Loading Strategy**: Small files are preloaded into memory, large files are served on-demand\n- **Configurable File Filtering**: Include/Exclude patterns for precise control\n- **Memory-efficient Response Generation**: Optimized for high performance\n- **Production-ready Caching Headers**: Automatic Cache-Control headers for optimal performance\n- **Detailed Logging**: Vite-like output for better overview\n\n## 📦 Installation\n\nThis project was created with TanStack Start:\n\n```bash\nbunx create-start-app@latest\n```\n\nInstall dependencies:\n\n```bash\nbun install\n```\n\n## 🏃‍♂️ Development\n\nFor development:\n\n```bash\nbun run dev\n```\n\n## 🔨 Production Build\n\nBuild the application for production:\n\n```bash\nbun run build\n```\n\n## 🚀 Production Server with server.ts\n\n### Quick Start - Use in Your Project\n\nYou can easily use this production server in your own TanStack Start project:\n\n1. **Copy the `server.ts` file** into your project root\n2. **Build your project** with `bun run build`\n3. **Start the server** directly with:\n   ```bash\n   bun run server.ts\n   ```\n\nOr add it to your `package.json` scripts:\n\n```json\n{\n  \"scripts\": {\n    \"start\": \"bun run server.ts\"\n  }\n}\n```\n\nThen run with:\n\n```bash\nbun run start\n```\n\n### Server Features\n\nThe `server.ts` implements a high-performance production server with the following features:\n\n#### 1. Intelligent Asset Loading\n\nThe server automatically decides which files to preload into memory and which to serve on-demand:\n\n- **In-Memory Loading**: Small files (default < 5MB) are loaded into memory at startup\n- **On-Demand Loading**: Large files are loaded from disk only when requested\n- **Optimized Performance**: Frequently used assets are served from memory\n\n#### 2. Configuration via Environment Variables\n\n```bash\n# Server Port (default: 3000)\nPORT=3000\n\n# Maximum file size for in-memory loading (in bytes, default: 5MB)\nSTATIC_PRELOAD_MAX_BYTES=5242880\n\n# Include patterns (comma-separated, only these files will be preloaded)\nSTATIC_PRELOAD_INCLUDE=\"*.js,*.css,*.woff2\"\n\n# Exclude patterns (comma-separated, these files will be excluded)\nSTATIC_PRELOAD_EXCLUDE=\"*.map,*.txt\"\n\n# Enable detailed logging\nSTATIC_PRELOAD_VERBOSE=true\n```\n\n### Example Configurations\n\n#### Minimal Memory Footprint\n\n```bash\n# Preload only critical assets\nSTATIC_PRELOAD_MAX_BYTES=1048576 \\\nSTATIC_PRELOAD_INCLUDE=\"*.js,*.css\" \\\nSTATIC_PRELOAD_EXCLUDE=\"*.map,vendor-*\" \\\nbun run start\n```\n\n#### Maximum Performance\n\n```bash\n# Preload all small assets\nSTATIC_PRELOAD_MAX_BYTES=10485760 \\\nbun run start\n```\n\n#### Debug Mode\n\n```bash\n# With detailed logging\nSTATIC_PRELOAD_VERBOSE=true \\\nbun run start\n```\n\n### Server Output\n\nThe server displays a clear overview of all loaded assets at startup:\n\n```txt\n📦 Loading static assets from ./dist/client...\n   Max preload size: 5.00 MB\n   Include patterns: *.js,*.css,*.woff2\n\n📁 Preloaded into memory:\n   /assets/index-a1b2c3d4.js           45.23 kB │ gzip:  15.83 kB\n   /assets/index-e5f6g7h8.css           12.45 kB │ gzip:   4.36 kB\n\n💾 Served on-demand:\n   /assets/vendor-i9j0k1l2.js          245.67 kB │ gzip:  86.98 kB\n\n✅ Preloaded 2 files (57.68 KB) into memory\nℹ️  1 files will be served on-demand (1 too large, 0 filtered)\n\n🚀 Server running at http://localhost:3000\n```\n\n## Testing\n\nThis project uses [Vitest](https://vitest.dev/) for testing. You can run the tests with:\n\n```bash\nbun run test\n```\n\n## Styling\n\nThis project uses [Tailwind CSS](https://tailwindcss.com/) for styling.\n\n## Linting & Formatting\n\nThis project uses [eslint](https://eslint.org/) and [prettier](https://prettier.io/) for linting and formatting. Eslint is configured using [tanstack/eslint-config](https://tanstack.com/config/latest/docs/eslint). The following scripts are available:\n\n```bash\nbun run lint\nbun run format\nbun run check\n```\n"
  },
  {
    "path": "examples/solid/start-bun/eslint.config.js",
    "content": "//  @ts-check\n\nimport { tanstackConfig } from '@tanstack/eslint-config'\n\nexport default [...tanstackConfig]\n"
  },
  {
    "path": "examples/solid/start-bun/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-bun-hosting\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"start\": \"bun run server.ts\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\",\n    \"test\": \"vitest run\",\n    \"lint\": \"eslint\",\n    \"format\": \"prettier\",\n    \"check\": \"prettier --write . && eslint --fix\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-devtools\": \"^0.7.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-router-ssr-query\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwindcss\": \"^4.2.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/eslint-config\": \"^0.3.2\",\n    \"@testing-library/dom\": \"^10.4.1\",\n    \"@solidjs/testing-library\": \"^0.8.10\",\n    \"@types/bun\": \"^1.2.22\",\n    \"@types/node\": \"22.10.2\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"jsdom\": \"^27.0.0\",\n    \"prettier\": \"^3.6.2\",\n    \"typescript\": \"^5.9.2\",\n    \"vite\": \"^8.0.0\",\n    \"vitest\": \"^3.2.4\",\n    \"web-vitals\": \"^5.1.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-bun/prettier.config.js",
    "content": "//  @ts-check\n\n/** @type {import('prettier').Config} */\nconst config = {\n  semi: false,\n  singleQuote: true,\n  trailingComma: 'all',\n}\n\nexport default config\n"
  },
  {
    "path": "examples/solid/start-bun/public/manifest.json",
    "content": "{\n  \"short_name\": \"TanStack App\",\n  \"name\": \"Create TanStack App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "examples/solid/start-bun/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "examples/solid/start-bun/server.ts",
    "content": "/**\n * TanStack Start Production Server with Bun\n *\n * A high-performance production server for TanStack Start applications that\n * implements intelligent static asset loading with configurable memory management.\n *\n * Features:\n * - Hybrid loading strategy (preload small files, serve large files on-demand)\n * - Configurable file filtering with include/exclude patterns\n * - Memory-efficient response generation\n * - Production-ready caching headers\n *\n * Environment Variables:\n *\n * PORT (number)\n *   - Server port number\n *   - Default: 3000\n *\n * ASSET_PRELOAD_MAX_SIZE (number)\n *   - Maximum file size in bytes to preload into memory\n *   - Files larger than this will be served on-demand from disk\n *   - Default: 5242880 (5MB)\n *   - Example: ASSET_PRELOAD_MAX_SIZE=5242880 (5MB)\n *\n * ASSET_PRELOAD_INCLUDE_PATTERNS (string)\n *   - Comma-separated list of glob patterns for files to include\n *   - If specified, only matching files are eligible for preloading\n *   - Patterns are matched against filenames only, not full paths\n *   - Example: ASSET_PRELOAD_INCLUDE_PATTERNS=\"*.js,*.css,*.woff2\"\n *\n * ASSET_PRELOAD_EXCLUDE_PATTERNS (string)\n *   - Comma-separated list of glob patterns for files to exclude\n *   - Applied after include patterns\n *   - Patterns are matched against filenames only, not full paths\n *   - Example: ASSET_PRELOAD_EXCLUDE_PATTERNS=\"*.map,*.txt\"\n *\n * ASSET_PRELOAD_VERBOSE_LOGGING (boolean)\n *   - Enable detailed logging of loaded and skipped files\n *   - Default: false\n *   - Set to \"true\" to enable verbose output\n *\n * ASSET_PRELOAD_ENABLE_ETAG (boolean)\n *   - Enable ETag generation for preloaded assets\n *   - Default: true\n *   - Set to \"false\" to disable ETag support\n *\n * ASSET_PRELOAD_ENABLE_GZIP (boolean)\n *   - Enable Gzip compression for eligible assets\n *   - Default: true\n *   - Set to \"false\" to disable Gzip compression\n *\n * ASSET_PRELOAD_GZIP_MIN_SIZE (number)\n *   - Minimum file size in bytes required for Gzip compression\n *   - Files smaller than this will not be compressed\n *   - Default: 1024 (1KB)\n *\n * ASSET_PRELOAD_GZIP_MIME_TYPES (string)\n *   - Comma-separated list of MIME types eligible for Gzip compression\n *   - Supports partial matching for types ending with \"/\"\n *   - Default: text/,application/javascript,application/json,application/xml,image/svg+xml\n *\n * Usage:\n *   bun run server.ts\n */\n\nimport path from 'node:path'\n\n// Configuration\nconst SERVER_PORT = Number(process.env.PORT ?? 3000)\nconst CLIENT_DIRECTORY = './dist/client'\nconst SERVER_ENTRY_POINT = './dist/server/server.js'\n\n// Logging utilities for professional output\nconst log = {\n  info: (message: string) => {\n    console.log(`[INFO] ${message}`)\n  },\n  success: (message: string) => {\n    console.log(`[SUCCESS] ${message}`)\n  },\n  warning: (message: string) => {\n    console.log(`[WARNING] ${message}`)\n  },\n  error: (message: string) => {\n    console.log(`[ERROR] ${message}`)\n  },\n  header: (message: string) => {\n    console.log(`\\n${message}\\n`)\n  },\n}\n\n// Preloading configuration from environment variables\nconst MAX_PRELOAD_BYTES = Number(\n  process.env.ASSET_PRELOAD_MAX_SIZE ?? 5 * 1024 * 1024, // 5MB default\n)\n\n// Parse comma-separated include patterns (no defaults)\nconst INCLUDE_PATTERNS = (process.env.ASSET_PRELOAD_INCLUDE_PATTERNS ?? '')\n  .split(',')\n  .map((s) => s.trim())\n  .filter(Boolean)\n  .map((pattern: string) => convertGlobToRegExp(pattern))\n\n// Parse comma-separated exclude patterns (no defaults)\nconst EXCLUDE_PATTERNS = (process.env.ASSET_PRELOAD_EXCLUDE_PATTERNS ?? '')\n  .split(',')\n  .map((s) => s.trim())\n  .filter(Boolean)\n  .map((pattern: string) => convertGlobToRegExp(pattern))\n\n// Verbose logging flag\nconst VERBOSE = process.env.ASSET_PRELOAD_VERBOSE_LOGGING === 'true'\n\n// Optional ETag feature\nconst ENABLE_ETAG = (process.env.ASSET_PRELOAD_ENABLE_ETAG ?? 'true') === 'true'\n\n// Optional Gzip feature\nconst ENABLE_GZIP = (process.env.ASSET_PRELOAD_ENABLE_GZIP ?? 'true') === 'true'\nconst GZIP_MIN_BYTES = Number(process.env.ASSET_PRELOAD_GZIP_MIN_SIZE ?? 1024) // 1KB\nconst GZIP_TYPES = (\n  process.env.ASSET_PRELOAD_GZIP_MIME_TYPES ??\n  'text/,application/javascript,application/json,application/xml,image/svg+xml'\n)\n  .split(',')\n  .map((v) => v.trim())\n  .filter(Boolean)\n\n/**\n * Convert a simple glob pattern to a regular expression\n * Supports * wildcard for matching any characters\n */\nfunction convertGlobToRegExp(globPattern: string): RegExp {\n  // Escape regex special chars except *, then replace * with .*\n  const escapedPattern = globPattern\n    .replace(/[-/\\\\^$+?.()|[\\]{}]/g, '\\\\$&')\n    .replace(/\\*/g, '.*')\n  return new RegExp(`^${escapedPattern}$`, 'i')\n}\n\n/**\n * Compute ETag for a given data buffer\n */\nfunction computeEtag(data: Uint8Array): string {\n  const hash = Bun.hash(data)\n  return `W/\"${hash.toString(16)}-${data.byteLength.toString()}\"`\n}\n\n/**\n * Metadata for preloaded static assets\n */\ninterface AssetMetadata {\n  route: string\n  size: number\n  type: string\n}\n\n/**\n * In-memory asset with ETag and Gzip support\n */\ninterface InMemoryAsset {\n  raw: Uint8Array\n  gz?: Uint8Array\n  etag?: string\n  type: string\n  immutable: boolean\n  size: number\n}\n\n/**\n * Result of static asset preloading process\n */\ninterface PreloadResult {\n  routes: Record<string, (req: Request) => Response | Promise<Response>>\n  loaded: AssetMetadata[]\n  skipped: AssetMetadata[]\n}\n\n/**\n * Check if a file is eligible for preloading based on configured patterns\n */\nfunction isFileEligibleForPreloading(relativePath: string): boolean {\n  const fileName = relativePath.split(/[/\\\\]/).pop() ?? relativePath\n\n  // If include patterns are specified, file must match at least one\n  if (INCLUDE_PATTERNS.length > 0) {\n    if (!INCLUDE_PATTERNS.some((pattern) => pattern.test(fileName))) {\n      return false\n    }\n  }\n\n  // If exclude patterns are specified, file must not match any\n  if (EXCLUDE_PATTERNS.some((pattern) => pattern.test(fileName))) {\n    return false\n  }\n\n  return true\n}\n\n/**\n * Check if a MIME type is compressible\n */\nfunction isMimeTypeCompressible(mimeType: string): boolean {\n  return GZIP_TYPES.some((type) =>\n    type.endsWith('/') ? mimeType.startsWith(type) : mimeType === type,\n  )\n}\n\n/**\n * Conditionally compress data based on size and MIME type\n */\nfunction compressDataIfAppropriate(\n  data: Uint8Array,\n  mimeType: string,\n): Uint8Array | undefined {\n  if (!ENABLE_GZIP) return undefined\n  if (data.byteLength < GZIP_MIN_BYTES) return undefined\n  if (!isMimeTypeCompressible(mimeType)) return undefined\n  try {\n    return Bun.gzipSync(data.buffer as ArrayBuffer)\n  } catch {\n    return undefined\n  }\n}\n\n/**\n * Create response handler function with ETag and Gzip support\n */\nfunction createResponseHandler(\n  asset: InMemoryAsset,\n): (req: Request) => Response {\n  return (req: Request) => {\n    const headers: Record<string, string> = {\n      'Content-Type': asset.type,\n      'Cache-Control': asset.immutable\n        ? 'public, max-age=31536000, immutable'\n        : 'public, max-age=3600',\n    }\n\n    if (ENABLE_ETAG && asset.etag) {\n      const ifNone = req.headers.get('if-none-match')\n      if (ifNone && ifNone === asset.etag) {\n        return new Response(null, {\n          status: 304,\n          headers: { ETag: asset.etag },\n        })\n      }\n      headers.ETag = asset.etag\n    }\n\n    if (\n      ENABLE_GZIP &&\n      asset.gz &&\n      req.headers.get('accept-encoding')?.includes('gzip')\n    ) {\n      headers['Content-Encoding'] = 'gzip'\n      headers['Content-Length'] = String(asset.gz.byteLength)\n      const gzCopy = new Uint8Array(asset.gz)\n      return new Response(gzCopy, { status: 200, headers })\n    }\n\n    headers['Content-Length'] = String(asset.raw.byteLength)\n    const rawCopy = new Uint8Array(asset.raw)\n    return new Response(rawCopy, { status: 200, headers })\n  }\n}\n\n/**\n * Create composite glob pattern from include patterns\n */\nfunction createCompositeGlobPattern(): Bun.Glob {\n  const raw = (process.env.ASSET_PRELOAD_INCLUDE_PATTERNS ?? '')\n    .split(',')\n    .map((s) => s.trim())\n    .filter(Boolean)\n  if (raw.length === 0) return new Bun.Glob('**/*')\n  if (raw.length === 1) return new Bun.Glob(raw[0])\n  return new Bun.Glob(`{${raw.join(',')}}`)\n}\n\n/**\n * Initialize static routes with intelligent preloading strategy\n * Small files are loaded into memory, large files are served on-demand\n */\nasync function initializeStaticRoutes(\n  clientDirectory: string,\n): Promise<PreloadResult> {\n  const routes: Record<string, (req: Request) => Response | Promise<Response>> =\n    {}\n  const loaded: AssetMetadata[] = []\n  const skipped: AssetMetadata[] = []\n\n  log.info(`Loading static assets from ${clientDirectory}...`)\n  if (VERBOSE) {\n    console.log(\n      `Max preload size: ${(MAX_PRELOAD_BYTES / 1024 / 1024).toFixed(2)} MB`,\n    )\n    if (INCLUDE_PATTERNS.length > 0) {\n      console.log(\n        `Include patterns: ${process.env.ASSET_PRELOAD_INCLUDE_PATTERNS ?? ''}`,\n      )\n    }\n    if (EXCLUDE_PATTERNS.length > 0) {\n      console.log(\n        `Exclude patterns: ${process.env.ASSET_PRELOAD_EXCLUDE_PATTERNS ?? ''}`,\n      )\n    }\n  }\n\n  let totalPreloadedBytes = 0\n\n  try {\n    const glob = createCompositeGlobPattern()\n    for await (const relativePath of glob.scan({ cwd: clientDirectory })) {\n      const filepath = path.join(clientDirectory, relativePath)\n      const route = `/${relativePath.split(path.sep).join(path.posix.sep)}`\n\n      try {\n        // Get file metadata\n        const file = Bun.file(filepath)\n\n        // Skip if file doesn't exist or is empty\n        if (!(await file.exists()) || file.size === 0) {\n          continue\n        }\n\n        const metadata: AssetMetadata = {\n          route,\n          size: file.size,\n          type: file.type || 'application/octet-stream',\n        }\n\n        // Determine if file should be preloaded\n        const matchesPattern = isFileEligibleForPreloading(relativePath)\n        const withinSizeLimit = file.size <= MAX_PRELOAD_BYTES\n\n        if (matchesPattern && withinSizeLimit) {\n          // Preload small files into memory with ETag and Gzip support\n          const bytes = new Uint8Array(await file.arrayBuffer())\n          const gz = compressDataIfAppropriate(bytes, metadata.type)\n          const etag = ENABLE_ETAG ? computeEtag(bytes) : undefined\n          const asset: InMemoryAsset = {\n            raw: bytes,\n            gz,\n            etag,\n            type: metadata.type,\n            immutable: true,\n            size: bytes.byteLength,\n          }\n          routes[route] = createResponseHandler(asset)\n\n          loaded.push({ ...metadata, size: bytes.byteLength })\n          totalPreloadedBytes += bytes.byteLength\n        } else {\n          // Serve large or filtered files on-demand\n          routes[route] = () => {\n            const fileOnDemand = Bun.file(filepath)\n            return new Response(fileOnDemand, {\n              headers: {\n                'Content-Type': metadata.type,\n                'Cache-Control': 'public, max-age=3600',\n              },\n            })\n          }\n\n          skipped.push(metadata)\n        }\n      } catch (error: unknown) {\n        if (error instanceof Error && error.name !== 'EISDIR') {\n          log.error(`Failed to load ${filepath}: ${error.message}`)\n        }\n      }\n    }\n\n    // Show detailed file overview only when verbose mode is enabled\n    if (VERBOSE && (loaded.length > 0 || skipped.length > 0)) {\n      const allFiles = [...loaded, ...skipped].sort((a, b) =>\n        a.route.localeCompare(b.route),\n      )\n\n      // Calculate max path length for alignment\n      const maxPathLength = Math.min(\n        Math.max(...allFiles.map((f) => f.route.length)),\n        60,\n      )\n\n      // Format file size with KB and actual gzip size\n      const formatFileSize = (bytes: number, gzBytes?: number) => {\n        const kb = bytes / 1024\n        const sizeStr = kb < 100 ? kb.toFixed(2) : kb.toFixed(1)\n\n        if (gzBytes !== undefined) {\n          const gzKb = gzBytes / 1024\n          const gzStr = gzKb < 100 ? gzKb.toFixed(2) : gzKb.toFixed(1)\n          return {\n            size: sizeStr,\n            gzip: gzStr,\n          }\n        }\n\n        // Rough gzip estimation (typically 30-70% compression) if no actual gzip data\n        const gzipKb = kb * 0.35\n        return {\n          size: sizeStr,\n          gzip: gzipKb < 100 ? gzipKb.toFixed(2) : gzipKb.toFixed(1),\n        }\n      }\n\n      if (loaded.length > 0) {\n        console.log('\\n📁 Preloaded into memory:')\n        console.log(\n          'Path                                          │    Size │ Gzip Size',\n        )\n        loaded\n          .sort((a, b) => a.route.localeCompare(b.route))\n          .forEach((file) => {\n            const { size, gzip } = formatFileSize(file.size)\n            const paddedPath = file.route.padEnd(maxPathLength)\n            const sizeStr = `${size.padStart(7)} kB`\n            const gzipStr = `${gzip.padStart(7)} kB`\n            console.log(`${paddedPath} │ ${sizeStr} │  ${gzipStr}`)\n          })\n      }\n\n      if (skipped.length > 0) {\n        console.log('\\n💾 Served on-demand:')\n        console.log(\n          'Path                                          │    Size │ Gzip Size',\n        )\n        skipped\n          .sort((a, b) => a.route.localeCompare(b.route))\n          .forEach((file) => {\n            const { size, gzip } = formatFileSize(file.size)\n            const paddedPath = file.route.padEnd(maxPathLength)\n            const sizeStr = `${size.padStart(7)} kB`\n            const gzipStr = `${gzip.padStart(7)} kB`\n            console.log(`${paddedPath} │ ${sizeStr} │  ${gzipStr}`)\n          })\n      }\n    }\n\n    // Show detailed verbose info if enabled\n    if (VERBOSE) {\n      if (loaded.length > 0 || skipped.length > 0) {\n        const allFiles = [...loaded, ...skipped].sort((a, b) =>\n          a.route.localeCompare(b.route),\n        )\n        console.log('\\n📊 Detailed file information:')\n        console.log(\n          'Status       │ Path                            │ MIME Type                    │ Reason',\n        )\n        allFiles.forEach((file) => {\n          const isPreloaded = loaded.includes(file)\n          const status = isPreloaded ? 'MEMORY' : 'ON-DEMAND'\n          const reason =\n            !isPreloaded && file.size > MAX_PRELOAD_BYTES\n              ? 'too large'\n              : !isPreloaded\n                ? 'filtered'\n                : 'preloaded'\n          const route =\n            file.route.length > 30\n              ? file.route.substring(0, 27) + '...'\n              : file.route\n          console.log(\n            `${status.padEnd(12)} │ ${route.padEnd(30)} │ ${file.type.padEnd(28)} │ ${reason.padEnd(10)}`,\n          )\n        })\n      } else {\n        console.log('\\n📊 No files found to display')\n      }\n    }\n\n    // Log summary after the file list\n    console.log() // Empty line for separation\n    if (loaded.length > 0) {\n      log.success(\n        `Preloaded ${String(loaded.length)} files (${(totalPreloadedBytes / 1024 / 1024).toFixed(2)} MB) into memory`,\n      )\n    } else {\n      log.info('No files preloaded into memory')\n    }\n\n    if (skipped.length > 0) {\n      const tooLarge = skipped.filter((f) => f.size > MAX_PRELOAD_BYTES).length\n      const filtered = skipped.length - tooLarge\n      log.info(\n        `${String(skipped.length)} files will be served on-demand (${String(tooLarge)} too large, ${String(filtered)} filtered)`,\n      )\n    }\n  } catch (error) {\n    log.error(\n      `Failed to load static files from ${clientDirectory}: ${String(error)}`,\n    )\n  }\n\n  return { routes, loaded, skipped }\n}\n\n/**\n * Initialize the server\n */\nasync function initializeServer() {\n  log.header('Starting Production Server')\n\n  // Load TanStack Start server handler\n  let handler: { fetch: (request: Request) => Response | Promise<Response> }\n  try {\n    const serverModule = (await import(SERVER_ENTRY_POINT)) as {\n      default: { fetch: (request: Request) => Response | Promise<Response> }\n    }\n    handler = serverModule.default\n    log.success('TanStack Start application handler initialized')\n  } catch (error) {\n    log.error(`Failed to load server handler: ${String(error)}`)\n    process.exit(1)\n  }\n\n  // Build static routes with intelligent preloading\n  const { routes } = await initializeStaticRoutes(CLIENT_DIRECTORY)\n\n  // Create Bun server\n  const server = Bun.serve({\n    port: SERVER_PORT,\n\n    routes: {\n      // Serve static assets (preloaded or on-demand)\n      ...routes,\n\n      // Fallback to TanStack Start handler for all other routes\n      '/*': (req: Request) => {\n        try {\n          return handler.fetch(req)\n        } catch (error) {\n          log.error(`Server handler error: ${String(error)}`)\n          return new Response('Internal Server Error', { status: 500 })\n        }\n      },\n    },\n\n    // Global error handler\n    error(error) {\n      log.error(\n        `Uncaught server error: ${error instanceof Error ? error.message : String(error)}`,\n      )\n      return new Response('Internal Server Error', { status: 500 })\n    },\n  })\n\n  log.success(`Server listening on http://localhost:${String(server.port)}`)\n}\n\n// Initialize the server\ninitializeServer().catch((error: unknown) => {\n  log.error(`Failed to start server: ${String(error)}`)\n  process.exit(1)\n})\n"
  },
  {
    "path": "examples/solid/start-bun/src/components/Header.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\n\nexport default function Header() {\n  return (\n    <header class=\"p-2 flex gap-2 bg-white text-black justify-between\">\n      <nav class=\"flex flex-row\">\n        <div class=\"px-2 font-bold\">\n          <Link to=\"/\">Home</Link>\n        </div>\n\n        <div class=\"px-2 font-bold\">\n          <Link to=\"/demo/start/server-funcs\">Start - Server Functions</Link>\n        </div>\n\n        <div class=\"px-2 font-bold\">\n          <Link to=\"/demo/start/api-request\">Start - API Request</Link>\n        </div>\n      </nav>\n    </header>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-bun/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ApiDemoNamesRouteImport } from './routes/api.demo-names'\nimport { Route as DemoStartServerFuncsRouteImport } from './routes/demo.start.server-funcs'\nimport { Route as DemoStartApiRequestRouteImport } from './routes/demo.start.api-request'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiDemoNamesRoute = ApiDemoNamesRouteImport.update({\n  id: '/api/demo-names',\n  path: '/api/demo-names',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DemoStartServerFuncsRoute = DemoStartServerFuncsRouteImport.update({\n  id: '/demo/start/server-funcs',\n  path: '/demo/start/server-funcs',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DemoStartApiRequestRoute = DemoStartApiRequestRouteImport.update({\n  id: '/demo/start/api-request',\n  path: '/demo/start/api-request',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/api/demo-names': typeof ApiDemoNamesRoute\n  '/demo/start/api-request': typeof DemoStartApiRequestRoute\n  '/demo/start/server-funcs': typeof DemoStartServerFuncsRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/api/demo-names': typeof ApiDemoNamesRoute\n  '/demo/start/api-request': typeof DemoStartApiRequestRoute\n  '/demo/start/server-funcs': typeof DemoStartServerFuncsRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/api/demo-names': typeof ApiDemoNamesRoute\n  '/demo/start/api-request': typeof DemoStartApiRequestRoute\n  '/demo/start/server-funcs': typeof DemoStartServerFuncsRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/api/demo-names'\n    | '/demo/start/api-request'\n    | '/demo/start/server-funcs'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/api/demo-names'\n    | '/demo/start/api-request'\n    | '/demo/start/server-funcs'\n  id:\n    | '__root__'\n    | '/'\n    | '/api/demo-names'\n    | '/demo/start/api-request'\n    | '/demo/start/server-funcs'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ApiDemoNamesRoute: typeof ApiDemoNamesRoute\n  DemoStartApiRequestRoute: typeof DemoStartApiRequestRoute\n  DemoStartServerFuncsRoute: typeof DemoStartServerFuncsRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/demo-names': {\n      id: '/api/demo-names'\n      path: '/api/demo-names'\n      fullPath: '/api/demo-names'\n      preLoaderRoute: typeof ApiDemoNamesRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/demo/start/server-funcs': {\n      id: '/demo/start/server-funcs'\n      path: '/demo/start/server-funcs'\n      fullPath: '/demo/start/server-funcs'\n      preLoaderRoute: typeof DemoStartServerFuncsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/demo/start/api-request': {\n      id: '/demo/start/api-request'\n      path: '/demo/start/api-request'\n      fullPath: '/demo/start/api-request'\n      preLoaderRoute: typeof DemoStartApiRequestRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ApiDemoNamesRoute: ApiDemoNamesRoute,\n  DemoStartApiRequestRoute: DemoStartApiRequestRoute,\n  DemoStartServerFuncsRoute: DemoStartServerFuncsRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-bun/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a new router instance\nexport const getRouter = () => {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreloadStaleTime: 0,\n  })\n}\n"
  },
  {
    "path": "examples/solid/start-bun/src/routes/__root.tsx",
    "content": "import { TanStackDevtools } from '@tanstack/solid-devtools'\nimport { HeadContent, Scripts, createRootRoute } from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'\n\nimport { HydrationScript } from 'solid-js/web'\nimport Header from '../components/Header'\n\nimport appCss from '../styles.css?url'\nimport type { JSX } from 'solid-js'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n    links: [\n      {\n        rel: 'stylesheet',\n        href: appCss,\n      },\n    ],\n  }),\n\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: JSX.Element }) {\n  return (\n    <html lang=\"en\">\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <Header />\n        {children}\n        <TanStackDevtools\n          config={{\n            position: 'bottom-left',\n          }}\n          plugins={[\n            {\n              name: 'Tanstack Router',\n              render: <TanStackRouterDevtoolsPanel />,\n            },\n          ]}\n        />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-bun/src/routes/api.demo-names.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/api/demo-names')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response(JSON.stringify(['Alice', 'Bob', 'Charlie']), {\n          headers: {\n            'Content-Type': 'application/json',\n          },\n        })\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-bun/src/routes/demo.start.api-request.tsx",
    "content": "import { createEffect, createSignal } from 'solid-js'\nimport { createFileRoute } from '@tanstack/solid-router'\n\nfunction getNames() {\n  return fetch('/api/demo-names').then((res) => res.json())\n}\n\nexport const Route = createFileRoute('/demo/start/api-request')({\n  component: Home,\n})\n\nfunction Home() {\n  const [names, setNames] = createSignal<Array<string>>([])\n\n  createEffect(() => {\n    getNames().then(setNames)\n  }, [])\n\n  return (\n    <div\n      class=\"flex items-center justify-center min-h-screen p-4 text-white\"\n      style={{\n        'background-color': '#000',\n        'background-image':\n          'radial-gradient(ellipse 60% 60% at 0% 100%, #444 0%, #222 60%, #000 100%)',\n      }}\n    >\n      <div class=\"w-full max-w-2xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10\">\n        <h1 class=\"text-2xl mb-4\">Start API Request Demo - Names List</h1>\n        <ul class=\"mb-4 space-y-2\">\n          {names().map((name) => (\n            <li class=\"bg-white/10 border border-white/20 rounded-lg p-3 backdrop-blur-sm shadow-md\">\n              <span class=\"text-lg text-white\">{name}</span>\n            </li>\n          ))}\n        </ul>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-bun/src/routes/demo.start.server-funcs.tsx",
    "content": "import fs from 'node:fs'\nimport { createSignal } from 'solid-js'\nimport { createFileRoute, useRouter } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\n\nconst filePath = 'todos.json'\n\nasync function readTodos() {\n  return JSON.parse(\n    await fs.promises.readFile(filePath, 'utf-8').catch(() =>\n      JSON.stringify(\n        [\n          { id: 1, name: 'Get groceries' },\n          { id: 2, name: 'Buy a new phone' },\n        ],\n        null,\n        2,\n      ),\n    ),\n  )\n}\n\nconst getTodos = createServerFn({\n  method: 'GET',\n}).handler(async () => await readTodos())\n\nconst addTodo = createServerFn({ method: 'POST' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data }) => {\n    const todos = await readTodos()\n    todos.push({ id: todos.length + 1, name: data })\n    await fs.promises.writeFile(filePath, JSON.stringify(todos, null, 2))\n    return todos\n  })\n\nexport const Route = createFileRoute('/demo/start/server-funcs')({\n  component: Home,\n  loader: async () => await getTodos(),\n})\n\nfunction Home() {\n  const router = useRouter()\n  const todos = Route.useLoaderData()\n\n  const [todo, setTodo] = createSignal('')\n\n  const submitTodo = async () => {\n    await addTodo({ data: todo() })\n    setTodo('')\n    await router.invalidate()\n  }\n\n  return (\n    <div\n      class=\"flex items-center justify-center min-h-screen bg-gradient-to-br from-zinc-800 to-black p-4 text-white\"\n      style={{\n        'background-image':\n          'radial-gradient(50% 50% at 20% 60%, #23272a 0%, #18181b 50%, #000000 100%)',\n      }}\n    >\n      <div class=\"w-full max-w-2xl p-8 rounded-xl backdrop-blur-md bg-black/50 shadow-xl border-8 border-black/10\">\n        <h1 class=\"text-2xl mb-4\">Start Server Functions - Todo Example</h1>\n        <ul class=\"mb-4 space-y-2\">\n          {todos().map((t: any) => (\n            <li class=\"bg-white/10 border border-white/20 rounded-lg p-3 backdrop-blur-sm shadow-md\">\n              <span class=\"text-lg text-white\">{t.name}</span>\n            </li>\n          ))}\n        </ul>\n        <div class=\"flex flex-col gap-2\">\n          <input\n            type=\"text\"\n            value={todo()}\n            onChange={(e) => setTodo(e.target.value)}\n            onKeyDown={(e) => {\n              if (e.key === 'Enter') {\n                submitTodo()\n              }\n            }}\n            placeholder=\"Enter a new todo...\"\n            class=\"w-full px-4 py-3 rounded-lg border border-white/20 bg-white/10 backdrop-blur-sm text-white placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:border-transparent\"\n          />\n          <button\n            disabled={todo().trim().length === 0}\n            onClick={submitTodo}\n            class=\"bg-blue-500 hover:bg-blue-600 disabled:bg-blue-500/50 disabled:cursor-not-allowed text-white font-bold py-3 px-4 rounded-lg transition-colors\"\n          >\n            Add todo\n          </button>\n        </div>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-bun/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport logo from '../logo.svg'\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n\nfunction App() {\n  return (\n    <div class=\"text-center\">\n      <header class=\"min-h-screen flex flex-col items-center justify-center bg-[#282c34] text-white text-[calc(10px+2vmin)]\">\n        <img\n          src={logo}\n          class=\"h-[40vmin] pointer-events-none animate-[spin_20s_linear_infinite]\"\n          alt=\"logo\"\n        />\n        <p>\n          Edit <code>src/routes/index.tsx</code> and save to reload.\n        </p>\n        <a\n          class=\"text-[#61dafb] hover:underline\"\n          href=\"https://solidjs.com\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n        >\n          Learn Solid\n        </a>\n        <a\n          class=\"text-[#61dafb] hover:underline\"\n          href=\"https://tanstack.com\"\n          target=\"_blank\"\n          rel=\"noopener noreferrer\"\n        >\n          Learn TanStack\n        </a>\n      </header>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-bun/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\nbody {\n  @apply m-0;\n  font-family:\n    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',\n    'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n  font-family:\n    source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;\n}\n"
  },
  {
    "path": "examples/solid/start-bun/tsconfig.json",
    "content": "{\n  \"include\": [\n    \"**/*.ts\",\n    \"**/*.tsx\",\n    \"eslint.config.js\",\n    \"prettier.config.js\",\n    \"vite.config.js\"\n  ],\n\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"types\": [\"vite/client\", \"bun\"],\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": false,\n    \"noEmit\": true,\n\n    /* Linting */\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedSideEffectImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-bun/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst config = defineConfig({\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n\nexport default config\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/.gitignore",
    "content": "\n.env.local"
  },
  {
    "path": "examples/solid/start-convex-better-auth/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-convex-better-auth/README.md",
    "content": "### Guide\n\nRename .env.example to .env.local\n\nRun\n\n- `pnpm i`\n- `pnpx convex dev`\n- `pnpx convex env set SITE_URL http://localhost:3000/`\n- `pnpx convex env set BETTER_AUTH_SECRET=$(openssl rand -base64 32)`\n- `pnpx convex dev` - takes up one terminal\n\nIn a separate terminal run\n\n- `pnpm run dev`\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/README.md",
    "content": "# Welcome to your Convex functions directory!\n\nWrite your Convex functions here.\nSee https://docs.convex.dev/functions for more.\n\nA query function that takes two arguments looks like:\n\n```ts\n// functions.js\nimport { query } from './_generated/server'\nimport { v } from 'convex/values'\n\nexport const myQueryFunction = query({\n  // Validators for arguments.\n  args: {\n    first: v.number(),\n    second: v.string(),\n  },\n\n  // Function implementation.\n  handler: async (ctx, args) => {\n    // Read the database as many times as you need here.\n    // See https://docs.convex.dev/database/reading-data.\n    const documents = await ctx.db.query('tablename').collect()\n\n    // Arguments passed from the client are properties of the args object.\n    console.log(args.first, args.second)\n\n    // Write arbitrary JavaScript here: filter, aggregate, build derived data,\n    // remove non-public properties, or create new objects.\n    return documents\n  },\n})\n```\n\nUsing this query function in a React component looks like:\n\n```ts\nconst data = useQuery(api.functions.myQueryFunction, {\n  first: 10,\n  second: 'hello',\n})\n```\n\nA mutation function looks like:\n\n```ts\n// functions.js\nimport { mutation } from './_generated/server'\nimport { v } from 'convex/values'\n\nexport const myMutationFunction = mutation({\n  // Validators for arguments.\n  args: {\n    first: v.string(),\n    second: v.string(),\n  },\n\n  // Function implementation.\n  handler: async (ctx, args) => {\n    // Insert or modify documents in the database here.\n    // Mutations can also read from the database like queries.\n    // See https://docs.convex.dev/database/writing-data.\n    const message = { body: args.first, author: args.second }\n    const id = await ctx.db.insert('messages', message)\n\n    // Optionally, return a value from your mutation.\n    return await ctx.db.get(id)\n  },\n})\n```\n\nUsing this mutation function in a React component looks like:\n\n```ts\nconst mutation = useMutation(api.functions.myMutationFunction)\nfunction handleButtonPress() {\n  // fire and forget, the most common way to use mutations\n  mutation({ first: 'Hello!', second: 'me' })\n  // OR\n  // use the result once the mutation has completed\n  mutation({ first: 'Hello!', second: 'me' }).then((result) =>\n    console.log(result),\n  )\n}\n```\n\nUse the Convex CLI to push your functions to a deployment. See everything\nthe Convex CLI can do by running `npx convex -h` in your project root\ndirectory. To learn more, launch the docs with `npx convex docs`.\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/_generated/api.d.ts",
    "content": "/* eslint-disable */\n/**\n * Generated `api` utility.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport type * as auth from '../auth.js'\nimport type * as http from '../http.js'\nimport type * as myFunctions from '../myFunctions.js'\n\nimport type {\n  ApiFromModules,\n  FilterApi,\n  FunctionReference,\n} from 'convex/server'\n\n/**\n * A utility for referencing Convex functions in your app's API.\n *\n * Usage:\n * ```js\n * const myFunctionReference = api.myModule.myFunction;\n * ```\n */\ndeclare const fullApi: ApiFromModules<{\n  auth: typeof auth\n  http: typeof http\n  myFunctions: typeof myFunctions\n}>\ndeclare const fullApiWithMounts: typeof fullApi\n\nexport declare const api: FilterApi<\n  typeof fullApiWithMounts,\n  FunctionReference<any, 'public'>\n>\nexport declare const internal: FilterApi<\n  typeof fullApiWithMounts,\n  FunctionReference<any, 'internal'>\n>\n\nexport declare const components: {\n  betterAuth: {\n    adapter: {\n      create: FunctionReference<\n        'mutation',\n        'internal',\n        {\n          input:\n            | {\n                data: {\n                  createdAt: number\n                  displayUsername?: null | string\n                  email: string\n                  emailVerified: boolean\n                  image?: null | string\n                  isAnonymous?: null | boolean\n                  name: string\n                  phoneNumber?: null | string\n                  phoneNumberVerified?: null | boolean\n                  twoFactorEnabled?: null | boolean\n                  updatedAt: number\n                  userId?: null | string\n                  username?: null | string\n                }\n                model: 'user'\n              }\n            | {\n                data: {\n                  createdAt: number\n                  expiresAt: number\n                  ipAddress?: null | string\n                  token: string\n                  updatedAt: number\n                  userAgent?: null | string\n                  userId: string\n                }\n                model: 'session'\n              }\n            | {\n                data: {\n                  accessToken?: null | string\n                  accessTokenExpiresAt?: null | number\n                  accountId: string\n                  createdAt: number\n                  idToken?: null | string\n                  password?: null | string\n                  providerId: string\n                  refreshToken?: null | string\n                  refreshTokenExpiresAt?: null | number\n                  scope?: null | string\n                  updatedAt: number\n                  userId: string\n                }\n                model: 'account'\n              }\n            | {\n                data: {\n                  createdAt: number\n                  expiresAt: number\n                  identifier: string\n                  updatedAt: number\n                  value: string\n                }\n                model: 'verification'\n              }\n            | {\n                data: { backupCodes: string; secret: string; userId: string }\n                model: 'twoFactor'\n              }\n            | {\n                data: {\n                  aaguid?: null | string\n                  backedUp: boolean\n                  counter: number\n                  createdAt?: null | number\n                  credentialID: string\n                  deviceType: string\n                  name?: null | string\n                  publicKey: string\n                  transports?: null | string\n                  userId: string\n                }\n                model: 'passkey'\n              }\n            | {\n                data: {\n                  clientId?: null | string\n                  clientSecret?: null | string\n                  createdAt?: null | number\n                  disabled?: null | boolean\n                  icon?: null | string\n                  metadata?: null | string\n                  name?: null | string\n                  redirectURLs?: null | string\n                  type?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                model: 'oauthApplication'\n              }\n            | {\n                data: {\n                  accessToken?: null | string\n                  accessTokenExpiresAt?: null | number\n                  clientId?: null | string\n                  createdAt?: null | number\n                  refreshToken?: null | string\n                  refreshTokenExpiresAt?: null | number\n                  scopes?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                model: 'oauthAccessToken'\n              }\n            | {\n                data: {\n                  clientId?: null | string\n                  consentGiven?: null | boolean\n                  createdAt?: null | number\n                  scopes?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                model: 'oauthConsent'\n              }\n            | {\n                data: {\n                  createdAt: number\n                  privateKey: string\n                  publicKey: string\n                }\n                model: 'jwks'\n              }\n            | {\n                data: {\n                  count?: null | number\n                  key?: null | string\n                  lastRequest?: null | number\n                }\n                model: 'rateLimit'\n              }\n            | {\n                data: { count: number; key: string; lastRequest: number }\n                model: 'ratelimit'\n              }\n          onCreateHandle?: string\n          select?: Array<string>\n        },\n        any\n      >\n      deleteMany: FunctionReference<\n        'mutation',\n        'internal',\n        {\n          input:\n            | {\n                model: 'user'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'email'\n                    | 'emailVerified'\n                    | 'image'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'twoFactorEnabled'\n                    | 'isAnonymous'\n                    | 'username'\n                    | 'displayUsername'\n                    | 'phoneNumber'\n                    | 'phoneNumberVerified'\n                    | 'userId'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'session'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'expiresAt'\n                    | 'token'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'ipAddress'\n                    | 'userAgent'\n                    | 'userId'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'account'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'accountId'\n                    | 'providerId'\n                    | 'userId'\n                    | 'accessToken'\n                    | 'refreshToken'\n                    | 'idToken'\n                    | 'accessTokenExpiresAt'\n                    | 'refreshTokenExpiresAt'\n                    | 'scope'\n                    | 'password'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'verification'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'identifier'\n                    | 'value'\n                    | 'expiresAt'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'twoFactor'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'secret' | 'backupCodes' | 'userId' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'passkey'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'publicKey'\n                    | 'userId'\n                    | 'credentialID'\n                    | 'counter'\n                    | 'deviceType'\n                    | 'backedUp'\n                    | 'transports'\n                    | 'createdAt'\n                    | 'aaguid'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthApplication'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'icon'\n                    | 'metadata'\n                    | 'clientId'\n                    | 'clientSecret'\n                    | 'redirectURLs'\n                    | 'type'\n                    | 'disabled'\n                    | 'userId'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthAccessToken'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'accessToken'\n                    | 'refreshToken'\n                    | 'accessTokenExpiresAt'\n                    | 'refreshTokenExpiresAt'\n                    | 'clientId'\n                    | 'userId'\n                    | 'scopes'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthConsent'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'clientId'\n                    | 'userId'\n                    | 'scopes'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'consentGiven'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'jwks'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'publicKey' | 'privateKey' | 'createdAt' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'rateLimit'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'key' | 'count' | 'lastRequest' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'ratelimit'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'key' | 'count' | 'lastRequest' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n          onDeleteHandle?: string\n          paginationOpts: {\n            cursor: string | null\n            endCursor?: string | null\n            id?: number\n            maximumBytesRead?: number\n            maximumRowsRead?: number\n            numItems: number\n          }\n        },\n        any\n      >\n      deleteOne: FunctionReference<\n        'mutation',\n        'internal',\n        {\n          input:\n            | {\n                model: 'user'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'email'\n                    | 'emailVerified'\n                    | 'image'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'twoFactorEnabled'\n                    | 'isAnonymous'\n                    | 'username'\n                    | 'displayUsername'\n                    | 'phoneNumber'\n                    | 'phoneNumberVerified'\n                    | 'userId'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'session'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'expiresAt'\n                    | 'token'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'ipAddress'\n                    | 'userAgent'\n                    | 'userId'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'account'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'accountId'\n                    | 'providerId'\n                    | 'userId'\n                    | 'accessToken'\n                    | 'refreshToken'\n                    | 'idToken'\n                    | 'accessTokenExpiresAt'\n                    | 'refreshTokenExpiresAt'\n                    | 'scope'\n                    | 'password'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'verification'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'identifier'\n                    | 'value'\n                    | 'expiresAt'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'twoFactor'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'secret' | 'backupCodes' | 'userId' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'passkey'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'publicKey'\n                    | 'userId'\n                    | 'credentialID'\n                    | 'counter'\n                    | 'deviceType'\n                    | 'backedUp'\n                    | 'transports'\n                    | 'createdAt'\n                    | 'aaguid'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthApplication'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'icon'\n                    | 'metadata'\n                    | 'clientId'\n                    | 'clientSecret'\n                    | 'redirectURLs'\n                    | 'type'\n                    | 'disabled'\n                    | 'userId'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthAccessToken'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'accessToken'\n                    | 'refreshToken'\n                    | 'accessTokenExpiresAt'\n                    | 'refreshTokenExpiresAt'\n                    | 'clientId'\n                    | 'userId'\n                    | 'scopes'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthConsent'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'clientId'\n                    | 'userId'\n                    | 'scopes'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'consentGiven'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'jwks'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'publicKey' | 'privateKey' | 'createdAt' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'rateLimit'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'key' | 'count' | 'lastRequest' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'ratelimit'\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'key' | 'count' | 'lastRequest' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n          onDeleteHandle?: string\n        },\n        any\n      >\n      findMany: FunctionReference<\n        'query',\n        'internal',\n        {\n          limit?: number\n          model:\n            | 'user'\n            | 'session'\n            | 'account'\n            | 'verification'\n            | 'twoFactor'\n            | 'passkey'\n            | 'oauthApplication'\n            | 'oauthAccessToken'\n            | 'oauthConsent'\n            | 'jwks'\n            | 'rateLimit'\n            | 'ratelimit'\n          offset?: number\n          paginationOpts: {\n            cursor: string | null\n            endCursor?: string | null\n            id?: number\n            maximumBytesRead?: number\n            maximumRowsRead?: number\n            numItems: number\n          }\n          sortBy?: { direction: 'asc' | 'desc'; field: string }\n          where?: Array<{\n            connector?: 'AND' | 'OR'\n            field: string\n            operator?:\n              | 'lt'\n              | 'lte'\n              | 'gt'\n              | 'gte'\n              | 'eq'\n              | 'in'\n              | 'not_in'\n              | 'ne'\n              | 'contains'\n              | 'starts_with'\n              | 'ends_with'\n            value:\n              | string\n              | number\n              | boolean\n              | Array<string>\n              | Array<number>\n              | null\n          }>\n        },\n        any\n      >\n      findOne: FunctionReference<\n        'query',\n        'internal',\n        {\n          model:\n            | 'user'\n            | 'session'\n            | 'account'\n            | 'verification'\n            | 'twoFactor'\n            | 'passkey'\n            | 'oauthApplication'\n            | 'oauthAccessToken'\n            | 'oauthConsent'\n            | 'jwks'\n            | 'rateLimit'\n            | 'ratelimit'\n          select?: Array<string>\n          where?: Array<{\n            connector?: 'AND' | 'OR'\n            field: string\n            operator?:\n              | 'lt'\n              | 'lte'\n              | 'gt'\n              | 'gte'\n              | 'eq'\n              | 'in'\n              | 'not_in'\n              | 'ne'\n              | 'contains'\n              | 'starts_with'\n              | 'ends_with'\n            value:\n              | string\n              | number\n              | boolean\n              | Array<string>\n              | Array<number>\n              | null\n          }>\n        },\n        any\n      >\n      migrationRemoveUserId: FunctionReference<\n        'mutation',\n        'internal',\n        { userId: string },\n        any\n      >\n      updateMany: FunctionReference<\n        'mutation',\n        'internal',\n        {\n          input:\n            | {\n                model: 'user'\n                update: {\n                  createdAt?: number\n                  displayUsername?: null | string\n                  email?: string\n                  emailVerified?: boolean\n                  image?: null | string\n                  isAnonymous?: null | boolean\n                  name?: string\n                  phoneNumber?: null | string\n                  phoneNumberVerified?: null | boolean\n                  twoFactorEnabled?: null | boolean\n                  updatedAt?: number\n                  userId?: null | string\n                  username?: null | string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'email'\n                    | 'emailVerified'\n                    | 'image'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'twoFactorEnabled'\n                    | 'isAnonymous'\n                    | 'username'\n                    | 'displayUsername'\n                    | 'phoneNumber'\n                    | 'phoneNumberVerified'\n                    | 'userId'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'session'\n                update: {\n                  createdAt?: number\n                  expiresAt?: number\n                  ipAddress?: null | string\n                  token?: string\n                  updatedAt?: number\n                  userAgent?: null | string\n                  userId?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'expiresAt'\n                    | 'token'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'ipAddress'\n                    | 'userAgent'\n                    | 'userId'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'account'\n                update: {\n                  accessToken?: null | string\n                  accessTokenExpiresAt?: null | number\n                  accountId?: string\n                  createdAt?: number\n                  idToken?: null | string\n                  password?: null | string\n                  providerId?: string\n                  refreshToken?: null | string\n                  refreshTokenExpiresAt?: null | number\n                  scope?: null | string\n                  updatedAt?: number\n                  userId?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'accountId'\n                    | 'providerId'\n                    | 'userId'\n                    | 'accessToken'\n                    | 'refreshToken'\n                    | 'idToken'\n                    | 'accessTokenExpiresAt'\n                    | 'refreshTokenExpiresAt'\n                    | 'scope'\n                    | 'password'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'verification'\n                update: {\n                  createdAt?: number\n                  expiresAt?: number\n                  identifier?: string\n                  updatedAt?: number\n                  value?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'identifier'\n                    | 'value'\n                    | 'expiresAt'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'twoFactor'\n                update: {\n                  backupCodes?: string\n                  secret?: string\n                  userId?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'secret' | 'backupCodes' | 'userId' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'passkey'\n                update: {\n                  aaguid?: null | string\n                  backedUp?: boolean\n                  counter?: number\n                  createdAt?: null | number\n                  credentialID?: string\n                  deviceType?: string\n                  name?: null | string\n                  publicKey?: string\n                  transports?: null | string\n                  userId?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'publicKey'\n                    | 'userId'\n                    | 'credentialID'\n                    | 'counter'\n                    | 'deviceType'\n                    | 'backedUp'\n                    | 'transports'\n                    | 'createdAt'\n                    | 'aaguid'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthApplication'\n                update: {\n                  clientId?: null | string\n                  clientSecret?: null | string\n                  createdAt?: null | number\n                  disabled?: null | boolean\n                  icon?: null | string\n                  metadata?: null | string\n                  name?: null | string\n                  redirectURLs?: null | string\n                  type?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'icon'\n                    | 'metadata'\n                    | 'clientId'\n                    | 'clientSecret'\n                    | 'redirectURLs'\n                    | 'type'\n                    | 'disabled'\n                    | 'userId'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthAccessToken'\n                update: {\n                  accessToken?: null | string\n                  accessTokenExpiresAt?: null | number\n                  clientId?: null | string\n                  createdAt?: null | number\n                  refreshToken?: null | string\n                  refreshTokenExpiresAt?: null | number\n                  scopes?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'accessToken'\n                    | 'refreshToken'\n                    | 'accessTokenExpiresAt'\n                    | 'refreshTokenExpiresAt'\n                    | 'clientId'\n                    | 'userId'\n                    | 'scopes'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthConsent'\n                update: {\n                  clientId?: null | string\n                  consentGiven?: null | boolean\n                  createdAt?: null | number\n                  scopes?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'clientId'\n                    | 'userId'\n                    | 'scopes'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'consentGiven'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'jwks'\n                update: {\n                  createdAt?: number\n                  privateKey?: string\n                  publicKey?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'publicKey' | 'privateKey' | 'createdAt' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'rateLimit'\n                update: {\n                  count?: null | number\n                  key?: null | string\n                  lastRequest?: null | number\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'key' | 'count' | 'lastRequest' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'ratelimit'\n                update: { count?: number; key?: string; lastRequest?: number }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'key' | 'count' | 'lastRequest' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n          onUpdateHandle?: string\n          paginationOpts: {\n            cursor: string | null\n            endCursor?: string | null\n            id?: number\n            maximumBytesRead?: number\n            maximumRowsRead?: number\n            numItems: number\n          }\n        },\n        any\n      >\n      updateOne: FunctionReference<\n        'mutation',\n        'internal',\n        {\n          input:\n            | {\n                model: 'user'\n                update: {\n                  createdAt?: number\n                  displayUsername?: null | string\n                  email?: string\n                  emailVerified?: boolean\n                  image?: null | string\n                  isAnonymous?: null | boolean\n                  name?: string\n                  phoneNumber?: null | string\n                  phoneNumberVerified?: null | boolean\n                  twoFactorEnabled?: null | boolean\n                  updatedAt?: number\n                  userId?: null | string\n                  username?: null | string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'email'\n                    | 'emailVerified'\n                    | 'image'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'twoFactorEnabled'\n                    | 'isAnonymous'\n                    | 'username'\n                    | 'displayUsername'\n                    | 'phoneNumber'\n                    | 'phoneNumberVerified'\n                    | 'userId'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'session'\n                update: {\n                  createdAt?: number\n                  expiresAt?: number\n                  ipAddress?: null | string\n                  token?: string\n                  updatedAt?: number\n                  userAgent?: null | string\n                  userId?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'expiresAt'\n                    | 'token'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'ipAddress'\n                    | 'userAgent'\n                    | 'userId'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'account'\n                update: {\n                  accessToken?: null | string\n                  accessTokenExpiresAt?: null | number\n                  accountId?: string\n                  createdAt?: number\n                  idToken?: null | string\n                  password?: null | string\n                  providerId?: string\n                  refreshToken?: null | string\n                  refreshTokenExpiresAt?: null | number\n                  scope?: null | string\n                  updatedAt?: number\n                  userId?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'accountId'\n                    | 'providerId'\n                    | 'userId'\n                    | 'accessToken'\n                    | 'refreshToken'\n                    | 'idToken'\n                    | 'accessTokenExpiresAt'\n                    | 'refreshTokenExpiresAt'\n                    | 'scope'\n                    | 'password'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'verification'\n                update: {\n                  createdAt?: number\n                  expiresAt?: number\n                  identifier?: string\n                  updatedAt?: number\n                  value?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'identifier'\n                    | 'value'\n                    | 'expiresAt'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'twoFactor'\n                update: {\n                  backupCodes?: string\n                  secret?: string\n                  userId?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'secret' | 'backupCodes' | 'userId' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'passkey'\n                update: {\n                  aaguid?: null | string\n                  backedUp?: boolean\n                  counter?: number\n                  createdAt?: null | number\n                  credentialID?: string\n                  deviceType?: string\n                  name?: null | string\n                  publicKey?: string\n                  transports?: null | string\n                  userId?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'publicKey'\n                    | 'userId'\n                    | 'credentialID'\n                    | 'counter'\n                    | 'deviceType'\n                    | 'backedUp'\n                    | 'transports'\n                    | 'createdAt'\n                    | 'aaguid'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthApplication'\n                update: {\n                  clientId?: null | string\n                  clientSecret?: null | string\n                  createdAt?: null | number\n                  disabled?: null | boolean\n                  icon?: null | string\n                  metadata?: null | string\n                  name?: null | string\n                  redirectURLs?: null | string\n                  type?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'name'\n                    | 'icon'\n                    | 'metadata'\n                    | 'clientId'\n                    | 'clientSecret'\n                    | 'redirectURLs'\n                    | 'type'\n                    | 'disabled'\n                    | 'userId'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthAccessToken'\n                update: {\n                  accessToken?: null | string\n                  accessTokenExpiresAt?: null | number\n                  clientId?: null | string\n                  createdAt?: null | number\n                  refreshToken?: null | string\n                  refreshTokenExpiresAt?: null | number\n                  scopes?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'accessToken'\n                    | 'refreshToken'\n                    | 'accessTokenExpiresAt'\n                    | 'refreshTokenExpiresAt'\n                    | 'clientId'\n                    | 'userId'\n                    | 'scopes'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'oauthConsent'\n                update: {\n                  clientId?: null | string\n                  consentGiven?: null | boolean\n                  createdAt?: null | number\n                  scopes?: null | string\n                  updatedAt?: null | number\n                  userId?: null | string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field:\n                    | 'clientId'\n                    | 'userId'\n                    | 'scopes'\n                    | 'createdAt'\n                    | 'updatedAt'\n                    | 'consentGiven'\n                    | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'jwks'\n                update: {\n                  createdAt?: number\n                  privateKey?: string\n                  publicKey?: string\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'publicKey' | 'privateKey' | 'createdAt' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'rateLimit'\n                update: {\n                  count?: null | number\n                  key?: null | string\n                  lastRequest?: null | number\n                }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'key' | 'count' | 'lastRequest' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n            | {\n                model: 'ratelimit'\n                update: { count?: number; key?: string; lastRequest?: number }\n                where?: Array<{\n                  connector?: 'AND' | 'OR'\n                  field: 'key' | 'count' | 'lastRequest' | '_id'\n                  operator?:\n                    | 'lt'\n                    | 'lte'\n                    | 'gt'\n                    | 'gte'\n                    | 'eq'\n                    | 'in'\n                    | 'not_in'\n                    | 'ne'\n                    | 'contains'\n                    | 'starts_with'\n                    | 'ends_with'\n                  value:\n                    | string\n                    | number\n                    | boolean\n                    | Array<string>\n                    | Array<number>\n                    | null\n                }>\n              }\n          onUpdateHandle?: string\n        },\n        any\n      >\n    }\n    adapterTest: {\n      count: FunctionReference<'query', 'internal', any, any>\n      create: FunctionReference<'mutation', 'internal', any, any>\n      delete: FunctionReference<'mutation', 'internal', any, any>\n      deleteMany: FunctionReference<'mutation', 'internal', any, any>\n      findMany: FunctionReference<'query', 'internal', any, any>\n      findOne: FunctionReference<'query', 'internal', any, any>\n      update: FunctionReference<'mutation', 'internal', any, any>\n      updateMany: FunctionReference<'mutation', 'internal', any, any>\n    }\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/_generated/api.js",
    "content": "/* eslint-disable */\n/**\n * Generated `api` utility.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport { anyApi, componentsGeneric } from 'convex/server'\n\n/**\n * A utility for referencing Convex functions in your app's API.\n *\n * Usage:\n * ```js\n * const myFunctionReference = api.myModule.myFunction;\n * ```\n */\nexport const api = anyApi\nexport const internal = anyApi\nexport const components = componentsGeneric()\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/_generated/dataModel.d.ts",
    "content": "/* eslint-disable */\n/**\n * Generated data model types.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport type {\n  DataModelFromSchemaDefinition,\n  DocumentByName,\n  TableNamesInDataModel,\n  SystemTableNames,\n} from 'convex/server'\nimport type { GenericId } from 'convex/values'\nimport schema from '../schema.js'\n\n/**\n * The names of all of your Convex tables.\n */\nexport type TableNames = TableNamesInDataModel<DataModel>\n\n/**\n * The type of a document stored in Convex.\n *\n * @typeParam TableName - A string literal type of the table name (like \"users\").\n */\nexport type Doc<TableName extends TableNames> = DocumentByName<\n  DataModel,\n  TableName\n>\n\n/**\n * An identifier for a document in Convex.\n *\n * Convex documents are uniquely identified by their `Id`, which is accessible\n * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).\n *\n * Documents can be loaded using `db.get(id)` in query and mutation functions.\n *\n * IDs are just strings at runtime, but this type can be used to distinguish them from other\n * strings when type checking.\n *\n * @typeParam TableName - A string literal type of the table name (like \"users\").\n */\nexport type Id<TableName extends TableNames | SystemTableNames> =\n  GenericId<TableName>\n\n/**\n * A type describing your Convex data model.\n *\n * This type includes information about what tables you have, the type of\n * documents stored in those tables, and the indexes defined on them.\n *\n * This type is used to parameterize methods like `queryGeneric` and\n * `mutationGeneric` to make them type-safe.\n */\nexport type DataModel = DataModelFromSchemaDefinition<typeof schema>\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/_generated/server.d.ts",
    "content": "/* eslint-disable */\n/**\n * Generated utilities for implementing server-side Convex query and mutation functions.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport {\n  ActionBuilder,\n  AnyComponents,\n  HttpActionBuilder,\n  MutationBuilder,\n  QueryBuilder,\n  GenericActionCtx,\n  GenericMutationCtx,\n  GenericQueryCtx,\n  GenericDatabaseReader,\n  GenericDatabaseWriter,\n  FunctionReference,\n} from 'convex/server'\nimport type { DataModel } from './dataModel.js'\n\ntype GenericCtx =\n  | GenericActionCtx<DataModel>\n  | GenericMutationCtx<DataModel>\n  | GenericQueryCtx<DataModel>\n\n/**\n * Define a query in this Convex app's public API.\n *\n * This function will be allowed to read your Convex database and will be accessible from the client.\n *\n * @param func - The query function. It receives a {@link QueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n */\nexport declare const query: QueryBuilder<DataModel, 'public'>\n\n/**\n * Define a query that is only accessible from other Convex functions (but not from the client).\n *\n * This function will be allowed to read from your Convex database. It will not be accessible from the client.\n *\n * @param func - The query function. It receives a {@link QueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n */\nexport declare const internalQuery: QueryBuilder<DataModel, 'internal'>\n\n/**\n * Define a mutation in this Convex app's public API.\n *\n * This function will be allowed to modify your Convex database and will be accessible from the client.\n *\n * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n */\nexport declare const mutation: MutationBuilder<DataModel, 'public'>\n\n/**\n * Define a mutation that is only accessible from other Convex functions (but not from the client).\n *\n * This function will be allowed to modify your Convex database. It will not be accessible from the client.\n *\n * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n */\nexport declare const internalMutation: MutationBuilder<DataModel, 'internal'>\n\n/**\n * Define an action in this Convex app's public API.\n *\n * An action is a function which can execute any JavaScript code, including non-deterministic\n * code and code with side-effects, like calling third-party services.\n * They can be run in Convex's JavaScript environment or in Node.js using the \"use node\" directive.\n * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.\n *\n * @param func - The action. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped action. Include this as an `export` to name it and make it accessible.\n */\nexport declare const action: ActionBuilder<DataModel, 'public'>\n\n/**\n * Define an action that is only accessible from other Convex functions (but not from the client).\n *\n * @param func - The function. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped function. Include this as an `export` to name it and make it accessible.\n */\nexport declare const internalAction: ActionBuilder<DataModel, 'internal'>\n\n/**\n * Define an HTTP action.\n *\n * This function will be used to respond to HTTP requests received by a Convex\n * deployment if the requests matches the path and method where this action\n * is routed. Be sure to route your action in `convex/http.js`.\n *\n * @param func - The function. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.\n */\nexport declare const httpAction: HttpActionBuilder\n\n/**\n * A set of services for use within Convex query functions.\n *\n * The query context is passed as the first argument to any Convex query\n * function run on the server.\n *\n * This differs from the {@link MutationCtx} because all of the services are\n * read-only.\n */\nexport type QueryCtx = GenericQueryCtx<DataModel>\n\n/**\n * A set of services for use within Convex mutation functions.\n *\n * The mutation context is passed as the first argument to any Convex mutation\n * function run on the server.\n */\nexport type MutationCtx = GenericMutationCtx<DataModel>\n\n/**\n * A set of services for use within Convex action functions.\n *\n * The action context is passed as the first argument to any Convex action\n * function run on the server.\n */\nexport type ActionCtx = GenericActionCtx<DataModel>\n\n/**\n * An interface to read from the database within Convex query functions.\n *\n * The two entry points are {@link DatabaseReader.get}, which fetches a single\n * document by its {@link Id}, or {@link DatabaseReader.query}, which starts\n * building a query.\n */\nexport type DatabaseReader = GenericDatabaseReader<DataModel>\n\n/**\n * An interface to read from and write to the database within Convex mutation\n * functions.\n *\n * Convex guarantees that all writes within a single mutation are\n * executed atomically, so you never have to worry about partial writes leaving\n * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)\n * for the guarantees Convex provides your functions.\n */\nexport type DatabaseWriter = GenericDatabaseWriter<DataModel>\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/_generated/server.js",
    "content": "/* eslint-disable */\n/**\n * Generated utilities for implementing server-side Convex query and mutation functions.\n *\n * THIS CODE IS AUTOMATICALLY GENERATED.\n *\n * To regenerate, run `npx convex dev`.\n * @module\n */\n\nimport {\n  actionGeneric,\n  httpActionGeneric,\n  queryGeneric,\n  mutationGeneric,\n  internalActionGeneric,\n  internalMutationGeneric,\n  internalQueryGeneric,\n  componentsGeneric,\n} from 'convex/server'\n\n/**\n * Define a query in this Convex app's public API.\n *\n * This function will be allowed to read your Convex database and will be accessible from the client.\n *\n * @param func - The query function. It receives a {@link QueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n */\nexport const query = queryGeneric\n\n/**\n * Define a query that is only accessible from other Convex functions (but not from the client).\n *\n * This function will be allowed to read from your Convex database. It will not be accessible from the client.\n *\n * @param func - The query function. It receives a {@link QueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n */\nexport const internalQuery = internalQueryGeneric\n\n/**\n * Define a mutation in this Convex app's public API.\n *\n * This function will be allowed to modify your Convex database and will be accessible from the client.\n *\n * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n */\nexport const mutation = mutationGeneric\n\n/**\n * Define a mutation that is only accessible from other Convex functions (but not from the client).\n *\n * This function will be allowed to modify your Convex database. It will not be accessible from the client.\n *\n * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n */\nexport const internalMutation = internalMutationGeneric\n\n/**\n * Define an action in this Convex app's public API.\n *\n * An action is a function which can execute any JavaScript code, including non-deterministic\n * code and code with side-effects, like calling third-party services.\n * They can be run in Convex's JavaScript environment or in Node.js using the \"use node\" directive.\n * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.\n *\n * @param func - The action. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped action. Include this as an `export` to name it and make it accessible.\n */\nexport const action = actionGeneric\n\n/**\n * Define an action that is only accessible from other Convex functions (but not from the client).\n *\n * @param func - The function. It receives an {@link ActionCtx} as its first argument.\n * @returns The wrapped function. Include this as an `export` to name it and make it accessible.\n */\nexport const internalAction = internalActionGeneric\n\n/**\n * Define a Convex HTTP action.\n *\n * @param func - The function. It receives an {@link ActionCtx} as its first argument, and a `Request` object\n * as its second.\n * @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.\n */\nexport const httpAction = httpActionGeneric\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/auth.config.ts",
    "content": "export default {\n  providers: [\n    {\n      domain: process.env.CONVEX_SITE_URL,\n      applicationID: 'convex',\n    },\n  ],\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/auth.ts",
    "content": "import { createClient } from '@convex-dev/better-auth'\nimport { convex } from '@convex-dev/better-auth/plugins'\nimport { betterAuth } from 'better-auth'\nimport { components } from './_generated/api'\nimport { query } from './_generated/server'\nimport type { GenericCtx } from '@convex-dev/better-auth'\nimport type { DataModel } from './_generated/dataModel'\n\nconst siteUrl = process.env.SITE_URL!\n\n// The component client has methods needed for integrating Convex with Better Auth,\n// as well as helper methods for general use.\nexport const authComponent = createClient<DataModel>(components.betterAuth)\n\nexport const createAuth = (\n  ctx: GenericCtx<DataModel>,\n  { optionsOnly } = { optionsOnly: false },\n) => {\n  return betterAuth({\n    // disable logging when createAuth is called just to generate options.\n    // this is not required, but there's a lot of noise in logs without it.\n    logger: {\n      disabled: optionsOnly,\n    },\n    baseURL: siteUrl,\n    database: authComponent.adapter(ctx),\n    // Configure simple, non-verified email/password to get started\n    emailAndPassword: {\n      enabled: true,\n      requireEmailVerification: false,\n    },\n    plugins: [\n      // The Convex plugin is required for Convex compatibility\n      convex({ jwtExpirationSeconds: 60 * 60 * 24 }),\n    ],\n  })\n}\n\n// Example function for getting the current user\n// Feel free to edit, omit, etc.\nexport const getCurrentUser = query({\n  args: {},\n  handler: async (ctx) => {\n    return authComponent.getAuthUser(ctx)\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/convex.config.ts",
    "content": "import { defineApp } from 'convex/server'\nimport betterAuth from '@convex-dev/better-auth/convex.config'\n\nconst app = defineApp()\napp.use(betterAuth)\nexport default app\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/http.ts",
    "content": "import { httpRouter } from 'convex/server'\nimport { authComponent, createAuth } from './auth'\n\nconst http = httpRouter()\nauthComponent.registerRoutes(http, createAuth)\nexport default http\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/myFunctions.ts",
    "content": "import { v } from 'convex/values'\nimport { action, mutation, query } from './_generated/server'\nimport { api } from './_generated/api'\nimport { authComponent } from './auth'\n\n// Write your Convex functions in any file inside this directory (`convex`).\n// See https://docs.convex.dev/functions for more.\n\n// You can read data from the database via a query:\nexport const listNumbers = query({\n  // Validators for arguments.\n  args: {\n    count: v.number(),\n  },\n\n  // Query implementation.\n  handler: async (ctx, args) => {\n    // Get the current authenticated user\n    const authUser = await authComponent.getAuthUser(ctx)\n    if (!authUser._id) {\n      throw new Error('User must be authenticated to list random numbers')\n    }\n\n    // Read the database as many times as you need here.\n    // See https://docs.convex.dev/database/reading-data.\n    const numbers = await ctx.db\n      .query('numbers')\n      .withIndex('userId', (q) => q.eq('userId', authUser._id))\n      // Ordered by _creationTime, return most recent\n      .order('desc')\n      .take(args.count)\n    return {\n      viewer: (await ctx.auth.getUserIdentity())?.name ?? null,\n      numbers: numbers.reverse().map((number) => number.value),\n    }\n  },\n})\n\n// You can write data to the database via a mutation:\nexport const addNumber = mutation({\n  // Validators for arguments.\n  args: {\n    value: v.number(),\n  },\n\n  // Mutation implementation.\n  handler: async (ctx, args) => {\n    // Get the current authenticated user\n    const authUser = await authComponent.getAuthUser(ctx)\n    if (!authUser._id) {\n      throw new Error('User must be authenticated to create a random number')\n    }\n\n    // Insert or modify documents in the database here.\n    // Mutations can also read from the database like queries.\n    // See https://docs.convex.dev/database/writing-data.\n\n    const id = await ctx.db.insert('numbers', {\n      value: args.value,\n      userId: authUser._id,\n    })\n\n    console.log('Added new document with id:', id)\n    // Optionally, return a value from your mutation.\n    // return id;\n  },\n})\n\n// You can fetch data from and send data to third-party APIs via an action:\nexport const myAction = action({\n  // Validators for arguments.\n  args: {\n    first: v.number(),\n  },\n\n  // Action implementation.\n  handler: async (ctx, args) => {\n    // // Use the browser-like `fetch` API to send HTTP requests.\n    // // See https://docs.convex.dev/functions/actions#calling-third-party-apis-and-using-npm-packages.\n    // const response = await ctx.fetch(\"https://api.thirdpartyservice.com\");\n    // const data = await response.json();\n\n    // // Query data by running Convex queries.\n    const data = await ctx.runQuery(api.myFunctions.listNumbers, {\n      count: 10,\n    })\n    console.log(data)\n\n    // // Write data by running Convex mutations.\n    await ctx.runMutation(api.myFunctions.addNumber, {\n      value: args.first,\n    })\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/schema.ts",
    "content": "import { defineSchema, defineTable } from 'convex/server'\nimport { v } from 'convex/values'\n\n// The schema is entirely optional.\n// You can delete this file (schema.ts) and the\n// app will continue to work.\n// The schema provides more precise TypeScript types.\nexport default defineSchema({\n  numbers: defineTable({\n    value: v.number(),\n    userId: v.string(),\n  }).index('userId', ['userId']),\n})\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/convex/tsconfig.json",
    "content": "{\n  /* This TypeScript project config describes the environment that\n   * Convex functions run in and is used to typecheck them.\n   * You can modify it, but some settings are required to use Convex.\n   */\n  \"compilerOptions\": {\n    /* These settings are not required by Convex and can be modified. */\n    \"allowJs\": true,\n    \"strict\": true,\n    \"moduleResolution\": \"Bundler\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"skipLibCheck\": true,\n    \"allowSyntheticDefaultImports\": true,\n    /* These compiler options are required by Convex */\n    \"target\": \"ESNext\",\n    \"lib\": [\"ES2021\", \"dom\"],\n    \"forceConsistentCasingInFileNames\": true,\n    \"module\": \"ESNext\",\n    \"isolatedModules\": true,\n    \"noEmit\": true\n  },\n  \"include\": [\"./**/*\"],\n  \"exclude\": [\"./_generated\"]\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-convex-better-auth\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"convex:dev\": \"convex dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@convex-dev/better-auth\": \"^0.9.7\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"better-auth\": \"^1.3.27\",\n    \"clsx\": \"^2.1.1\",\n    \"convex\": \"^1.28.2\",\n    \"convex-solidjs\": \"^0.0.3\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.10.2\",\n    \"combinate\": \"^1.1.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx",
    "content": "import { useNavigate } from '@tanstack/solid-router'\nimport { createSignal } from 'solid-js'\nimport { authClient } from '~/library/auth-client'\nimport { refreshAuth } from '~/library/convex-client'\n\nexport default function LoginSignupForm() {\n  const navigate = useNavigate()\n  const [isLogin, setIsLogin] = createSignal(true)\n  const [name, setName] = createSignal('')\n  const [email, setEmail] = createSignal('')\n  const [password, setPassword] = createSignal('')\n  const [error, setError] = createSignal('')\n  const [loading, setLoading] = createSignal(false)\n\n  const handleSubmit = async (e: Event) => {\n    e.preventDefault()\n    setError('')\n    setLoading(true)\n\n    try {\n      if (isLogin()) {\n        await authClient.signIn.email({\n          email: email(),\n          password: password(),\n        })\n      } else {\n        await authClient.signUp.email({\n          name: name(),\n          email: email(),\n          password: password(),\n        })\n      }\n\n      refreshAuth()\n\n      navigate({ to: '/dashboard' })\n    } catch (err: any) {\n      setError(err?.message || 'An error occurred')\n    } finally {\n      setLoading(false)\n    }\n  }\n\n  return (\n    <main class=\"min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 px-4\">\n      <div class=\"w-full max-w-md\">\n        <div class=\"bg-white rounded-2xl shadow-xl p-8 md:p-10\">\n          <div class=\"text-center mb-8\">\n            <h1 class=\"text-3xl font-bold text-gray-900 mb-2\">\n              {isLogin() ? 'Welcome Back' : 'Create Account'}\n            </h1>\n            <p class=\"text-gray-600 text-sm\">\n              {isLogin()\n                ? 'Sign in to continue to your account'\n                : 'Get started with your free account'}\n            </p>\n          </div>\n\n          <form onSubmit={handleSubmit} class=\"space-y-5\">\n            {!isLogin() && (\n              <div>\n                <label\n                  for=\"name\"\n                  class=\"block text-sm font-medium text-gray-700 mb-2\"\n                >\n                  Full Name\n                </label>\n                <input\n                  id=\"name\"\n                  type=\"text\"\n                  value={name()}\n                  onInput={(e) => setName(e.currentTarget.value)}\n                  required={!isLogin()}\n                  class=\"w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all duration-200 text-gray-900 placeholder-gray-400\"\n                  placeholder=\"John Doe\"\n                />\n              </div>\n            )}\n\n            <div>\n              <label\n                for=\"email\"\n                class=\"block text-sm font-medium text-gray-700 mb-2\"\n              >\n                Email Address\n              </label>\n              <input\n                id=\"email\"\n                type=\"email\"\n                value={email()}\n                onInput={(e) => setEmail(e.currentTarget.value)}\n                required\n                class=\"w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all duration-200 text-gray-900 placeholder-gray-400\"\n                placeholder=\"you@example.com\"\n              />\n            </div>\n\n            <div>\n              <label\n                for=\"password\"\n                class=\"block text-sm font-medium text-gray-700 mb-2\"\n              >\n                Password\n              </label>\n              <input\n                id=\"password\"\n                type=\"password\"\n                value={password()}\n                onInput={(e) => setPassword(e.currentTarget.value)}\n                required\n                class=\"w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all duration-200 text-gray-900 placeholder-gray-400\"\n                placeholder=\"••••••••\"\n              />\n            </div>\n\n            {error() && (\n              <div class=\"bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg text-sm flex items-center gap-2\">\n                <svg\n                  class=\"w-5 h-5 flex-shrink-0\"\n                  fill=\"currentColor\"\n                  viewBox=\"0 0 20 20\"\n                >\n                  <path\n                    fill-rule=\"evenodd\"\n                    d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\"\n                    clip-rule=\"evenodd\"\n                  />\n                </svg>\n                <span>{error()}</span>\n              </div>\n            )}\n\n            <button\n              type=\"submit\"\n              disabled={loading()}\n              class={`w-full px-4 py-3 rounded-lg font-semibold text-white transition-all duration-200 ${\n                loading()\n                  ? 'bg-gray-400 cursor-not-allowed'\n                  : 'bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5'\n              }`}\n            >\n              {loading() ? (\n                <span class=\"flex items-center justify-center gap-2\">\n                  <svg\n                    class=\"animate-spin h-5 w-5\"\n                    xmlns=\"http://www.w3.org/2000/svg\"\n                    fill=\"none\"\n                    viewBox=\"0 0 24 24\"\n                  >\n                    <circle\n                      class=\"opacity-25\"\n                      cx=\"12\"\n                      cy=\"12\"\n                      r=\"10\"\n                      stroke=\"currentColor\"\n                      stroke-width=\"4\"\n                    ></circle>\n                    <path\n                      class=\"opacity-75\"\n                      fill=\"currentColor\"\n                      d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n                    ></path>\n                  </svg>\n                  Processing...\n                </span>\n              ) : isLogin() ? (\n                'Sign In'\n              ) : (\n                'Create Account'\n              )}\n            </button>\n          </form>\n\n          <div class=\"mt-6 text-center\">\n            <button\n              onClick={() => {\n                setIsLogin(!isLogin())\n                setError('')\n              }}\n              class=\"text-sm text-gray-600 hover:text-blue-600 transition-colors duration-200 font-medium\"\n            >\n              {isLogin() ? (\n                <>\n                  Don't have an account?{' '}\n                  <span class=\"text-blue-600 hover:underline\">Sign up</span>\n                </>\n              ) : (\n                <>\n                  Already have an account?{' '}\n                  <span class=\"text-blue-600 hover:underline\">Sign in</span>\n                </>\n              )}\n            </button>\n          </div>\n        </div>\n      </div>\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/library/auth-client.ts",
    "content": "import { createAuthClient } from 'better-auth/solid'\nimport { convexClient } from '@convex-dev/better-auth/client/plugins'\n\nexport const authClient = createAuthClient({\n  plugins: [convexClient()],\n})\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/library/auth-server.ts",
    "content": "import { createAuth } from 'convex/auth'\nimport { setupFetchClient } from '@convex-dev/better-auth/react-start'\nimport { getCookie } from '@tanstack/solid-start/server'\n\nexport const { fetchQuery, fetchMutation, fetchAction } =\n  await setupFetchClient(createAuth, getCookie)\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/library/convex-client.ts",
    "content": "import { setupConvex } from 'convex-solidjs'\nimport { fetchAuth } from '~/library/server'\n\nconst CONVEX_URL = import.meta.env.VITE_CONVEX_URL\nif (!CONVEX_URL) {\n  console.error('missing envar CONVEX_URL')\n}\n\n// Set up Convex client with auth\nexport const convexClient = setupConvex(CONVEX_URL)\n\n// Configure auth token fetcher\nexport function refreshAuth() {\n  convexClient.setAuth(async () => {\n    const { token } = await fetchAuth()\n    return token\n  })\n}\n\nrefreshAuth()\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/library/server.ts",
    "content": "import {\n  fetchSession,\n  getCookieName,\n} from '@convex-dev/better-auth/react-start'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { redirect } from '@tanstack/solid-router'\nimport { getCookie, getRequest } from '@tanstack/solid-start/server'\nimport { api } from 'convex/_generated/api'\nimport { fetchMutation, fetchQuery } from './auth-server'\n\n// Get auth information for SSR using available cookies\nexport const fetchAuth = createServerFn({ method: 'GET' }).handler(async () => {\n  const { createAuth } = await import('../../convex/auth')\n  const request = getRequest()\n  const { session } = await fetchSession(request)\n  const sessionCookieName = getCookieName(createAuth)\n  const token = getCookie(sessionCookieName)\n\n  return {\n    session,\n    token,\n  }\n})\n\nexport const fetchUser = createServerFn({ method: 'GET' }).handler(async () => {\n  try {\n    const user = await fetchQuery(api.auth.getCurrentUser, {})\n    return user\n  } catch (error) {\n    throw redirect({ to: '/' })\n  }\n})\n\n// example of calling Convex functions using server functions\nexport const addNumber = createServerFn({ method: 'POST' }).handler(\n  async () => {\n    const number = await fetchMutation(api.myFunctions.addNumber, {\n      value: Math.floor(Math.random() * 100),\n    })\n    return number\n  },\n)\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/library/utils.ts",
    "content": "import { clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\nimport type { ClassValue } from 'clsx'\n\nexport function cn(...inputs: Array<ClassValue>) {\n  return twMerge(clsx(inputs))\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/providers/convex.tsx",
    "content": "import { ConvexProvider } from 'convex-solidjs'\nimport type { JSXElement } from 'solid-js'\nimport { convexClient } from '~/library/convex-client'\n\nexport default function AppConvexProvider(props: { children: JSXElement }) {\n  return <ConvexProvider client={convexClient}>{props.children}</ConvexProvider>\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedDashboardRouteImport } from './routes/_authed/dashboard'\nimport { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedDashboardRoute = AuthedDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({\n  id: '/api/auth/$',\n  path: '/api/auth/$',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n  '/dashboard': typeof AuthedDashboardRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n  '/dashboard': typeof AuthedDashboardRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/about': typeof AboutRoute\n  '/_authed/dashboard': typeof AuthedDashboardRoute\n  '/api/auth/$': typeof ApiAuthSplatRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about' | '/dashboard' | '/api/auth/$'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about' | '/dashboard' | '/api/auth/$'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/about'\n    | '/_authed/dashboard'\n    | '/api/auth/$'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n  AboutRoute: typeof AboutRoute\n  ApiAuthSplatRoute: typeof ApiAuthSplatRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/dashboard': {\n      id: '/_authed/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof AuthedDashboardRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/api/auth/$': {\n      id: '/api/auth/$'\n      path: '/api/auth/$'\n      fullPath: '/api/auth/$'\n      preLoaderRoute: typeof ApiAuthSplatRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\ninterface AuthedRouteChildren {\n  AuthedDashboardRoute: typeof AuthedDashboardRoute\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedDashboardRoute: AuthedDashboardRoute,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n  AboutRoute: AboutRoute,\n  ApiAuthSplatRoute: ApiAuthSplatRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: (err) => <p>{err.error.stack}</p>,\n    defaultNotFoundComponent: () => <p>not found</p>,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { HeadContent, Scripts, createRootRoute } from '@tanstack/solid-router'\nimport { HydrationScript, Suspense } from 'solid-js/web'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type * as Solid from 'solid-js'\nimport appCss from '~/styles/app.css?url'\nimport AppConvexProvider from '~/providers/convex'\nimport { fetchAuth } from '~/library/server'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  beforeLoad: async () => {\n    const { session, token } = await fetchAuth()\n    return { session, token }\n  },\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument(props: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <Suspense>\n          <AppConvexProvider>{props.children}</AppConvexProvider>\n        </Suspense>\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx",
    "content": "import {\n  createFileRoute,\n  useNavigate,\n  useRouteContext,\n} from '@tanstack/solid-router'\nimport { useQuery } from 'convex-solidjs'\nimport { api } from 'convex/_generated/api'\nimport { For, Show } from 'solid-js'\nimport { addNumber } from '~/library/server'\nimport { authClient } from '~/library/auth-client'\n\nexport const Route = createFileRoute('/_authed/dashboard')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const navigate = useNavigate()\n  const context = useRouteContext({ from: '/_authed' })\n  // example of a Convex query\n  const { data } = useQuery(api.myFunctions.listNumbers, { count: 10 })\n\n  const handleSignOut = async () => {\n    await authClient.signOut()\n    navigate({ to: '/' })\n  }\n\n  return (\n    <main class=\"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100\">\n      {/* Header */}\n      <header class=\"bg-white shadow-sm border-b border-gray-200\">\n        <div class=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4\">\n          <div class=\"flex items-center justify-between\">\n            <div>\n              <h1 class=\"text-2xl font-bold text-gray-900\">Dashboard</h1>\n              <Show when={context().user}>\n                {(u) => (\n                  <p class=\"text-sm text-gray-600 mt-1\">\n                    Welcome back, {u().name || u().email}!\n                  </p>\n                )}\n              </Show>\n            </div>\n            <button\n              onClick={handleSignOut}\n              class=\"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 hover:border-gray-400 transition-all duration-200 shadow-sm hover:shadow\"\n            >\n              Sign Out\n            </button>\n          </div>\n        </div>\n      </header>\n\n      {/* Main Content */}\n      <div class=\"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8\">\n        {/* Numbers Card */}\n        <div class=\"bg-white rounded-2xl shadow-xl p-6 md:p-8 mb-6\">\n          <div class=\"flex items-center justify-between mb-6\">\n            <h2 class=\"text-xl font-semibold text-gray-900\">Numbers</h2>\n            <button\n              onClick={() => addNumber()}\n              class=\"px-4 py-2 text-sm font-semibold text-white bg-gradient-to-r from-blue-600 to-indigo-600 rounded-lg hover:from-blue-700 hover:to-indigo-700 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5\"\n            >\n              Add Random Number To Convex\n            </button>\n          </div>\n\n          <Show\n            when={data()?.numbers && data()!.numbers.length > 0}\n            fallback={\n              <div class=\"text-center py-12\">\n                <svg\n                  class=\"mx-auto h-12 w-12 text-gray-400\"\n                  fill=\"none\"\n                  viewBox=\"0 0 24 24\"\n                  stroke=\"currentColor\"\n                >\n                  <path\n                    stroke-linecap=\"round\"\n                    stroke-linejoin=\"round\"\n                    stroke-width=\"2\"\n                    d=\"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z\"\n                  />\n                </svg>\n                <h3 class=\"mt-2 text-sm font-medium text-gray-900\">\n                  No numbers yet\n                </h3>\n                <p class=\"mt-1 text-sm text-gray-500\">\n                  Get started by adding your first number.\n                </p>\n              </div>\n            }\n          >\n            <div class=\"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4\">\n              <For each={data()?.numbers}>\n                {(number) => (\n                  <div class=\"bg-gradient-to-br from-blue-50 to-indigo-50 rounded-lg p-4 text-center border border-blue-100 hover:border-blue-300 transition-all duration-200 hover:shadow-md\">\n                    <div class=\"text-2xl font-bold text-blue-600\">{number}</div>\n                  </div>\n                )}\n              </For>\n            </div>\n          </Show>\n        </div>\n      </div>\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/routes/_authed.tsx",
    "content": "import { Outlet, createFileRoute, redirect } from '@tanstack/solid-router'\nimport { fetchUser } from '~/library/server'\n\nexport const Route = createFileRoute('/_authed')({\n  component: () => (\n    <>\n      <Outlet />\n    </>\n  ),\n  beforeLoad: async (ctx) => {\n    const user = await fetchUser()\n    if (!ctx.context.token) {\n      throw redirect({\n        to: '/',\n      })\n    }\n    return { user }\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <main>\n      <h1>About</h1>\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { reactStartHandler } from '@convex-dev/better-auth/react-start'\n\nexport const Route = createFileRoute('/api/auth/$')({\n  server: {\n    handlers: {\n      GET: ({ request }) => {\n        return reactStartHandler(request)\n      },\n      POST: ({ request }) => {\n        return reactStartHandler(request)\n      },\n    },\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/routes/index.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\n\nimport LoginSignupForm from '~/components/login-signup-form'\n\nexport const Route = createFileRoute('/')({\n  beforeLoad: (ctx) => {\n    if (ctx.context.token) {\n      throw redirect({ to: '/dashboard' })\n    }\n  },\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <main>\n      <LoginSignupForm />\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\nbody {\n  font-family:\n    Gordita, Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',\n    sans-serif;\n}\n\na {\n  margin-right: 1rem;\n}\n\nmain {\n  text-align: center;\n  padding: 1em;\n  margin: 0 auto;\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-convex-better-auth/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/start-counter/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-counter/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-counter/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-counter\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.10.2\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"combinate\": \"^1.1.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-counter/src/components/Counter.css",
    "content": ".increment {\n  font-family: inherit;\n  font-size: inherit;\n  padding: 1em 2em;\n  color: #335d92;\n  background-color: rgba(68, 107, 158, 0.1);\n  border-radius: 2em;\n  border: 2px solid rgba(68, 107, 158, 0);\n  outline: none;\n  width: 200px;\n  font-variant-numeric: tabular-nums;\n  cursor: pointer;\n}\n\n.increment:focus {\n  border: 2px solid #335d92;\n}\n\n.increment:active {\n  background-color: rgba(68, 107, 158, 0.2);\n}\n"
  },
  {
    "path": "examples/solid/start-counter/src/components/Counter.tsx",
    "content": "import { createSignal } from 'solid-js'\nimport './Counter.css'\n\nexport default function Counter() {\n  const [count, setCount] = createSignal(0)\n  return (\n    <button\n      class=\"increment\"\n      onClick={() => setCount(count() + 1)}\n      type=\"button\"\n    >\n      Clicks: {count()}\n    </button>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-counter/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-counter/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: (err) => <p>{err.error.stack}</p>,\n    defaultNotFoundComponent: () => <p>not found</p>,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-counter/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { HydrationScript } from 'solid-js/web'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type * as Solid from 'solid-js'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument(props: { children: Solid.JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div>\n          <Link to=\"/\">Index</Link>\n          <Link to=\"/about\">About</Link>\n        </div>\n        {props.children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-counter/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <main>\n      <h1>About</h1>\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-counter/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport Counter from '~/components/Counter'\nexport const Route = createFileRoute('/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <main>\n      <h1>Hello world!</h1>\n      <Counter />\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-counter/src/styles/app.css",
    "content": "body {\n  font-family:\n    Gordita, Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',\n    sans-serif;\n}\n\na {\n  margin-right: 1rem;\n}\n\nmain {\n  text-align: center;\n  padding: 1em;\n  margin: 0 auto;\n}\n"
  },
  {
    "path": "examples/solid/start-counter/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-counter/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\ncount.txt\n.env\n.nitro\n.tanstack\n.output\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/.vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\"inlang.vs-code-extension\"]\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/README.md",
    "content": "# TanStack Start example\n\nThis example shows how to use Paraglide with TanStack Start.\n\n## Getting started\n\n1. Init Paraglide JS\n\n```bash\nnpx @inlang/paraglide-js@latest init\n```\n\n2. Add the vite plugin to your `vite.config.ts`:\n\n```diff\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from \"@tanstack/solid-start/plugin/vite\";\nimport react from '@vitejs/plugin-react'\n+import { paraglideVitePlugin } from \"@inlang/paraglide-js\";\n\nexport default defineConfig({\n\tplugins: [\n    tanstackStart(),\n    react(),\n+\t\tparaglideVitePlugin({\n+\t\t\tproject: \"./project.inlang\",\n+\t\t\toutdir: \"./app/paraglide\",\n+     outputStructure: \"message-modules\",\n+     cookieName: \"PARAGLIDE_LOCALE\",\n+     strategy: [\"url\", \"cookie\", \"preferredLanguage\", \"baseLocale\"],\n+      urlPatterns: [\n+       {\n+         pattern: \"/:path(.*)?\",\n+         localized: [\n+           [\"en\", \"/en/:path(.*)?\"],\n+         ],\n+       },\n+     ],\n+\t\t}),\n\t],\n});\n```\n\n3. Done :)\n\nRun the app and start translating. See the [basics documentation](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/basics) for information on how to use Paraglide's messages, parameters, and locale management.\n\n## Rewrite URL\n\nIf you want to handle how the URL looks when the user changes the locale, you can rewrite the URL in the router.\n\n```diff\nimport { createRouter } from \"@tanstack/solid-router\";\nimport { routeTree } from \"./routeTree.gen\";\n+import { deLocalizeUrl, localizeUrl } from \"./paraglide/runtime.js\";\n\nconst router = createRouter({\n  routeTree,\n+ rewrite: {\n+   input: ({ url }) => deLocalizeUrl(url),\n+   output: ({ url }) => localizeUrl(url),\n  },\n});\n```\n\nIn `server.ts` intercept the request with the paraglideMiddleware.\n\n```ts\nimport { paraglideMiddleware } from './paraglide/server.js'\nimport handler from '@tanstack/solid-start/server-entry'\n\nexport default {\n  fetch(req: Request): Promise<Response> {\n    return paraglideMiddleware(req, () => handler.fetch(req))\n  },\n}\n```\n\nIn `__root.tsx` add change the html lang attribute to the current locale.\n\n```tsx\nimport { getLocale } from '../paraglide/runtime.js'\n\nfunction RootDocument({ children }: { children: React.ReactNode }) {\n  return (\n    <html lang={getLocale()}>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n## Offline redirect\n\nIf you have an application that needs to work offline, you will need to handle the redirect in the client like this.\n\n```ts\nimport { shouldRedirect } from \"../paraglide/runtime\";\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const decision = await shouldRedirect({ url: window.location.href });\n\n    if (decision.redirectUrl) {\n      throw redirect({ href: decision.redirectUrl.href });\n    }\n  },\n  ...\n});\n```\n\n## Typesafe translated pathnames\n\nIf you don't want to miss any translated path, you can create a `createTranslatedPathnames` function and pass it to the vite plugin.\n\n```ts\nimport { Locale } from '@/paraglide/runtime'\nimport { FileRoutesByTo } from '../routeTree.gen'\n\ntype RoutePath = keyof FileRoutesByTo\n\nconst excludedPaths = ['admin', 'docs', 'api'] as const\n\ntype PublicRoutePath = Exclude<\n  RoutePath,\n  `${string}${(typeof excludedPaths)[number]}${string}`\n>\n\ntype TranslatedPathname = {\n  pattern: string\n  localized: Array<[Locale, string]>\n}\n\nfunction toUrlPattern(path: string) {\n  return (\n    path\n      // catch-all\n      .replace(/\\/\\$$/, '/:path(.*)?')\n      // optional parameters: {-$param}\n      .replace(/\\{-\\$([a-zA-Z0-9_]+)\\}/g, ':$1?')\n      // named parameters: $param\n      .replace(/\\$([a-zA-Z0-9_]+)/g, ':$1')\n      // remove trailing slash\n      .replace(/\\/+$/, '')\n  )\n}\n\nfunction createTranslatedPathnames(\n  input: Record<PublicRoutePath, Record<Locale, string>>,\n): TranslatedPathname[] {\n  return Object.entries(input).map(([pattern, locales]) => ({\n    pattern: toUrlPattern(pattern),\n    localized: Object.entries(locales).map(\n      ([locale, path]) =>\n        [locale as Locale, `/${locale}${toUrlPattern(path)}`] satisfies [\n          Locale,\n          string,\n        ],\n    ),\n  }))\n}\n\nexport const translatedPathnames = createTranslatedPathnames({\n  '/': {\n    en: '/',\n    de: '/',\n  },\n  '/about': {\n    en: '/about',\n    de: '/ueber',\n  },\n})\n```\n\nAnd import into the Paraglide Vite plguin.\n\n# Prerender routes\n\nYou can use use the `localizeHref` function to map the routes to localized versions and import into the pages option in the TanStack Start plugin. For this to work you will need to compile paraglide before the build with the CLI.\n\n```ts\nimport { localizeHref } from './paraglide/runtime'\n\nexport const prerenderRoutes = ['/', '/about'].map((path) => ({\n  path: localizeHref(path),\n  prerender: {\n    enabled: true,\n  },\n}))\n```\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/messages/de.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Guten Tag {username}\",\n  \"server_message\": \"Server Nachricht {emoji}\",\n  \"about_message\": \"Über uns\",\n  \"home_page\": \"Startseite\",\n  \"about_page\": \"Über uns\"\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/messages/en.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/inlang-message-format\",\n  \"example_message\": \"Hello world {username}\",\n  \"server_message\": \"Server message {emoji}\",\n  \"about_message\": \"About message\",\n  \"home_page\": \"Home page\",\n  \"about_page\": \"About page\"\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-i18n-paraglide\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev --port 3000\",\n    \"start\": \"node .output/server/index.mjs\",\n    \"build\": \"vite build\",\n    \"preview\": \"vite preview\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-devtools\": \"^0.7.0\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.18.6\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.9.2\",\n    \"vite\": \"^8.0.0\",\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"@inlang/paraglide-js\": \"^2.4.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/project.inlang/.gitignore",
    "content": "cache"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/project.inlang/project_id",
    "content": "UoZ15Q8qSGIbImRS3Y"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/project.inlang/settings.json",
    "content": "{\n  \"$schema\": \"https://inlang.com/schema/project-settings\",\n  \"baseLocale\": \"en\",\n  \"locales\": [\"en\", \"de\"],\n  \"modules\": [\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js\",\n    \"https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js\"\n  ],\n  \"plugin.inlang.messageFormat\": {\n    \"pathPattern\": \"./messages/{locale}.json\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/public/manifest.json",
    "content": "{\n  \"short_name\": \"TanStack App\",\n  \"name\": \"Create TanStack App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof AboutRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about'\n  id: '__root__' | '/' | '/about'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AboutRoute: typeof AboutRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AboutRoute: AboutRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\nimport { deLocalizeUrl, localizeUrl } from './paraglide/runtime'\n\n// Create a new router instance\nexport const getRouter = () => {\n  return createRouter({\n    routeTree,\n    scrollRestoration: true,\n    defaultPreloadStaleTime: 0,\n    rewrite: {\n      input: ({ url }) => deLocalizeUrl(url),\n      output: ({ url }) => localizeUrl(url),\n    },\n  })\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'\nimport { TanStackDevtools } from '@tanstack/solid-devtools'\nimport { HydrationScript } from 'solid-js/web'\nimport styles from '../styles.css?url'\nimport type { JSX } from 'solid-js/jsx-runtime'\nimport { getLocale, locales, setLocale } from '@/paraglide/runtime'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n    links: [{ rel: 'stylesheet', href: styles }],\n  }),\n\n  shellComponent: RootDocument,\n})\n\nfunction RootDocument({ children }: { children: JSX.Element }) {\n  return (\n    <html lang={getLocale()}>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg justify-between\">\n          <div class=\"flex gap-2 text-lg\">\n            <Link\n              to=\"/\"\n              activeProps={{\n                class: 'font-bold',\n              }}\n              activeOptions={{ exact: true }}\n            >\n              {m.home_page()}\n            </Link>\n\n            <Link\n              to=\"/about\"\n              activeProps={{\n                class: 'font-bold',\n              }}\n            >\n              {m.about_page()}\n            </Link>\n          </div>\n\n          <div class=\"flex gap-2 text-lg\">\n            {locales.map((locale) => (\n              <button\n                onClick={() => setLocale(locale)}\n                data-active-locale={locale === getLocale()}\n                class=\"rounded p-1 px-2 border border-gray-300 cursor-pointer [&[data-active-locale=true]]:bg-gray-500 [&[data-active-locale=true]]:text-white\"\n              >\n                {locale}\n              </button>\n            ))}\n          </div>\n        </div>\n\n        <hr />\n\n        <div class=\"p-2\">{children}</div>\n\n        <TanStackDevtools\n          config={{\n            position: 'bottom-left',\n          }}\n          plugins={[\n            {\n              name: 'Tanstack Router',\n              render: <TanStackRouterDevtoolsPanel />,\n            },\n          ]}\n        />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { m } from '@/paraglide/messages'\n\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>{m.about_message()}</div>\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { m } from '@/paraglide/messages.js'\n// import { getLocale } from '@/paraglide/runtime.js'\n\nconst getServerMessage = createServerFn()\n  .inputValidator((emoji: string) => emoji)\n  .handler((ctx) => {\n    return m.server_message({ emoji: ctx.data })\n  })\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  loader: async () => {\n    return {\n      messageFromLoader: m.example_message({ username: 'John Doe' }),\n      serverFunctionMessage: await getServerMessage({ data: '📩' }),\n    }\n  },\n})\n\nfunction Home() {\n  const loaderData = Route.useLoaderData()\n  return (\n    <div class=\"p-2\">\n      <h2>Message from loader: {loaderData().messageFromLoader}</h2>\n      <h2>Server function message: {loaderData().serverFunctionMessage}:</h2>\n      <h2>{m.example_message({ username: 'John Doe' })}</h2>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/server.ts",
    "content": "import { paraglideMiddleware } from './paraglide/server.js'\nimport handler from '@tanstack/solid-start/server-entry'\n\nexport default {\n  fetch(req: Request): Promise<Response> {\n    return paraglideMiddleware(req, () => handler.fetch(req))\n  },\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/utils/prerender.ts",
    "content": "import { localizeHref } from '../paraglide/runtime'\n\nexport const prerenderRoutes = ['/', '/about'].map((path) => ({\n  path: localizeHref(path),\n  prerender: {\n    enabled: true,\n  },\n}))\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/src/utils/translated-pathnames.ts",
    "content": "import { Locale } from '@/paraglide/runtime'\nimport { FileRoutesByTo } from '../routeTree.gen'\n\ntype RoutePath = keyof FileRoutesByTo\n\nconst excludedPaths = ['admin', 'docs', 'api'] as const\n\ntype PublicRoutePath = Exclude<\n  RoutePath,\n  `${string}${(typeof excludedPaths)[number]}${string}`\n>\n\ntype TranslatedPathname = {\n  pattern: string\n  localized: Array<[Locale, string]>\n}\n\nfunction toUrlPattern(path: string) {\n  return (\n    path\n      // catch-all\n      .replace(/\\/\\$$/, '/:path(.*)?')\n      // optional parameters: {-$param}\n      .replace(/\\{-\\$([a-zA-Z0-9_]+)\\}/g, ':$1?')\n      // named parameters: $param\n      .replace(/\\$([a-zA-Z0-9_]+)/g, ':$1')\n      // remove trailing slash\n      .replace(/\\/+$/, '')\n  )\n}\n\nfunction createTranslatedPathnames(\n  input: Record<PublicRoutePath, Record<Locale, string>>,\n): TranslatedPathname[] {\n  return Object.entries(input).map(([pattern, locales]) => ({\n    pattern: toUrlPattern(pattern),\n    localized: Object.entries(locales).map(\n      ([locale, path]) =>\n        [locale as Locale, `/${locale}${toUrlPattern(path)}`] satisfies [\n          Locale,\n          string,\n        ],\n    ),\n  }))\n}\n\nexport const translatedPathnames = createTranslatedPathnames({\n  '/': {\n    en: '/',\n    de: '/',\n  },\n  '/about': {\n    en: '/about',\n    de: '/ueber',\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ES2022\", \"DOM\", \"DOM.Iterable\"],\n    \"types\": [\"vite/client\"],\n    \"allowJs\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": false,\n    \"noEmit\": true,\n\n    /* Linting */\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"noUncheckedSideEffectImports\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@/*\": [\"./src/*\"]\n    }\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-i18n-paraglide/vite.config.ts",
    "content": "import { paraglideVitePlugin } from '@inlang/paraglide-js'\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst config = defineConfig({\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [\n    paraglideVitePlugin({\n      project: './project.inlang',\n      outdir: './src/paraglide',\n      outputStructure: 'message-modules',\n      cookieName: 'PARAGLIDE_LOCALE',\n      strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'],\n      urlPatterns: [\n        {\n          pattern: '/',\n          localized: [\n            ['en', '/en'],\n            ['de', '/de'],\n          ],\n        },\n        {\n          pattern: '/about',\n          localized: [\n            ['en', '/en/about'],\n            ['de', '/de/ueber'],\n          ],\n        },\n        {\n          pattern: '/:path(.*)?',\n          localized: [\n            ['en', '/en/:path(.*)?'],\n            ['de', '/de/:path(.*)?'],\n          ],\n        },\n      ],\n    }),\n    tanstackStart(),\n    viteSolid({ ssr: true }),\n    tailwindcss(),\n  ],\n})\n\nexport default config\n"
  },
  {
    "path": "examples/solid/start-large/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-large/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n(gen)\nnode_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build"
  },
  {
    "path": "examples/solid/start-large/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-large/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-large/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-large\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\",\n    \"gen\": \"node ./src/createRoutes.mjs\",\n    \"test:types\": \"tsc --extendedDiagnostics\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-query\": \"^5.90.9\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"valibot\": \"^1.0.0-beta.15\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/createRoutes.mjs",
    "content": "import { readFile, writeFile, mkdir } from 'fs/promises'\nimport { existsSync } from 'fs'\n\nconst length = 100\n\nconst main = async () => {\n  const absolute = (await readFile('./src/routes/absolute.tsx')).toString()\n  const relative = (await readFile('./src/routes/relative.tsx')).toString()\n  const searchRoute = (\n    await readFile('./src/routes/search/route.tsx')\n  ).toString()\n  const search = (\n    await readFile('./src/routes/search/searchPlaceholder.tsx')\n  ).toString()\n  const paramsRoute = (\n    await readFile('./src/routes/params/route.tsx')\n  ).toString()\n  const params = await (\n    await readFile('./src/routes/params/$paramsPlaceholder.tsx')\n  ).toString()\n\n  if (!existsSync('./src/routes/(gen)')) {\n    await mkdir('./src/routes/(gen)')\n  }\n\n  if (!existsSync('./src/routes/(gen)/search')) {\n    await mkdir('./src/routes/(gen)/search')\n  }\n\n  if (!existsSync('./src/routes/(gen)/params')) {\n    await mkdir('./src/routes/(gen)/params')\n  }\n\n  await writeFile('./src/routes/(gen)/search/route.tsx', searchRoute)\n  await writeFile('./src/routes/(gen)/params/route.tsx', paramsRoute)\n\n  for (let y = 0; y < length; y = y + 1) {\n    const replacedAbsolute = absolute.replaceAll('/absolute', `/absolute${y}`)\n    const replacedRelative = relative.replaceAll('/relative', `/relative${y}`)\n    const replacedSearch = search.replaceAll('searchPlaceholder', `search${y}`)\n    const replacedParams = params.replaceAll('paramsPlaceholder', `param${y}`)\n    await writeFile(`./src/routes/(gen)/absolute${y}.tsx`, replacedAbsolute)\n    await writeFile(`./src/routes/(gen)/relative${y}.tsx`, replacedRelative)\n    await writeFile(`./src/routes/(gen)/search/search${y}.tsx`, replacedSearch)\n    await writeFile(`./src/routes/(gen)/params/$param${y}.tsx`, replacedParams)\n  }\n}\n\nmain()\n"
  },
  {
    "path": "examples/solid/start-large/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as RelativeRouteImport } from './routes/relative'\nimport { Route as LinkPropsRouteImport } from './routes/linkProps'\nimport { Route as AbsoluteRouteImport } from './routes/absolute'\nimport { Route as SearchRouteRouteImport } from './routes/search/route'\nimport { Route as ParamsRouteRouteImport } from './routes/params/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as SearchSearchPlaceholderRouteImport } from './routes/search/searchPlaceholder'\nimport { Route as ParamsParamsPlaceholderRouteImport } from './routes/params/$paramsPlaceholder'\n\nconst RelativeRoute = RelativeRouteImport.update({\n  id: '/relative',\n  path: '/relative',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LinkPropsRoute = LinkPropsRouteImport.update({\n  id: '/linkProps',\n  path: '/linkProps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AbsoluteRoute = AbsoluteRouteImport.update({\n  id: '/absolute',\n  path: '/absolute',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchRouteRoute = SearchRouteRouteImport.update({\n  id: '/search',\n  path: '/search',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ParamsRouteRoute = ParamsRouteRouteImport.update({\n  id: '/params',\n  path: '/params',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst SearchSearchPlaceholderRoute = SearchSearchPlaceholderRouteImport.update({\n  id: '/searchPlaceholder',\n  path: '/searchPlaceholder',\n  getParentRoute: () => SearchRouteRoute,\n} as any)\nconst ParamsParamsPlaceholderRoute = ParamsParamsPlaceholderRouteImport.update({\n  id: '/$paramsPlaceholder',\n  path: '/$paramsPlaceholder',\n  getParentRoute: () => ParamsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/params': typeof ParamsRouteRouteWithChildren\n  '/search': typeof SearchRouteRouteWithChildren\n  '/absolute': typeof AbsoluteRoute\n  '/linkProps': typeof LinkPropsRoute\n  '/relative': typeof RelativeRoute\n  '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute\n  '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  id:\n    | '__root__'\n    | '/'\n    | '/params'\n    | '/search'\n    | '/absolute'\n    | '/linkProps'\n    | '/relative'\n    | '/params/$paramsPlaceholder'\n    | '/search/searchPlaceholder'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  ParamsRouteRoute: typeof ParamsRouteRouteWithChildren\n  SearchRouteRoute: typeof SearchRouteRouteWithChildren\n  AbsoluteRoute: typeof AbsoluteRoute\n  LinkPropsRoute: typeof LinkPropsRoute\n  RelativeRoute: typeof RelativeRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/relative': {\n      id: '/relative'\n      path: '/relative'\n      fullPath: '/relative'\n      preLoaderRoute: typeof RelativeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/linkProps': {\n      id: '/linkProps'\n      path: '/linkProps'\n      fullPath: '/linkProps'\n      preLoaderRoute: typeof LinkPropsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/absolute': {\n      id: '/absolute'\n      path: '/absolute'\n      fullPath: '/absolute'\n      preLoaderRoute: typeof AbsoluteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search': {\n      id: '/search'\n      path: '/search'\n      fullPath: '/search'\n      preLoaderRoute: typeof SearchRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/params': {\n      id: '/params'\n      path: '/params'\n      fullPath: '/params'\n      preLoaderRoute: typeof ParamsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/search/searchPlaceholder': {\n      id: '/search/searchPlaceholder'\n      path: '/searchPlaceholder'\n      fullPath: '/search/searchPlaceholder'\n      preLoaderRoute: typeof SearchSearchPlaceholderRouteImport\n      parentRoute: typeof SearchRouteRoute\n    }\n    '/params/$paramsPlaceholder': {\n      id: '/params/$paramsPlaceholder'\n      path: '/$paramsPlaceholder'\n      fullPath: '/params/$paramsPlaceholder'\n      preLoaderRoute: typeof ParamsParamsPlaceholderRouteImport\n      parentRoute: typeof ParamsRouteRoute\n    }\n  }\n}\n\ninterface ParamsRouteRouteChildren {\n  ParamsParamsPlaceholderRoute: typeof ParamsParamsPlaceholderRoute\n}\n\nconst ParamsRouteRouteChildren: ParamsRouteRouteChildren = {\n  ParamsParamsPlaceholderRoute: ParamsParamsPlaceholderRoute,\n}\n\nconst ParamsRouteRouteWithChildren = ParamsRouteRoute._addFileChildren(\n  ParamsRouteRouteChildren,\n)\n\ninterface SearchRouteRouteChildren {\n  SearchSearchPlaceholderRoute: typeof SearchSearchPlaceholderRoute\n}\n\nconst SearchRouteRouteChildren: SearchRouteRouteChildren = {\n  SearchSearchPlaceholderRoute: SearchSearchPlaceholderRoute,\n}\n\nconst SearchRouteRouteWithChildren = SearchRouteRoute._addFileChildren(\n  SearchRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  ParamsRouteRoute: ParamsRouteRouteWithChildren,\n  SearchRouteRoute: SearchRouteRouteWithChildren,\n  AbsoluteRoute: AbsoluteRoute,\n  LinkPropsRoute: LinkPropsRoute,\n  RelativeRoute: RelativeRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { QueryClient } from '@tanstack/solid-query'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const queryClient = new QueryClient()\n  const router = createRouter({\n    routeTree,\n    context: {\n      queryClient: queryClient,\n    },\n  })\n\n  return router\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/__root.tsx",
    "content": "// src/routes/__root.tsx\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRouteWithContext,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport type { QueryClient } from '@tanstack/solid-query'\nimport type { JSX } from 'solid-js'\n\nexport interface Context {\n  queryClient: QueryClient\n}\n\nexport const Route = createRootRouteWithContext<Context>()({\n  head: () => ({\n    links: [{ rel: 'stylesheet' }],\n    meta: [\n      {\n        charSet: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      {\n        title: 'TanStack Start Starter',\n      },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: Readonly<{ children: JSX.Element }>) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/absolute.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/absolute')({\n  component: AbsoluteComponent,\n})\n\nfunction AbsoluteComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link to=\"/absolute\" class=\"block py-1 text-blue-800 hover:text-blue-600\">\n        Absolute\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/linkProps.tsx",
    "content": "import { Link, createFileRoute, linkOptions } from '@tanstack/solid-router'\nimport {\n  ListItems,\n  MyLink,\n  customRedirect,\n  useCustomNavigate,\n} from '~/typePrimitives'\n\nexport const Route = createFileRoute('/linkProps')({\n  component: LinkPropsPage,\n  loader: () => {\n    throw customRedirect({\n      to: '/search/searchPlaceholder',\n      search: {\n        searchPlaceholder: 'searchPlaceholder',\n        rootSearch: 0,\n        page: 0,\n        offset: 0,\n        search: 'hi',\n      },\n    })\n  },\n})\n\nfunction LinkPropsPage() {\n  useCustomNavigate({\n    to: '/search/searchPlaceholder',\n    search: {\n      searchPlaceholder: 'searchPlaceholder',\n      rootSearch: 0,\n      page: 0,\n      offset: 0,\n      search: 'hi',\n    },\n  })\n\n  const linkProps = linkOptions({\n    to: '/absolute',\n  })\n\n  return (\n    <>\n      <MyLink\n        from=\"/search/searchPlaceholder\"\n        to=\"../searchPlaceholder\"\n        search={{\n          searchPlaceholder: 'searchPlaceholder',\n          rootSearch: 0,\n          page: 0,\n          offset: 0,\n          search: 'hi',\n        }}\n      />\n      <ListItems\n        from=\"/search/searchPlaceholder\"\n        items={[\n          {\n            to: '../searchPlaceholder',\n            search: {\n              searchPlaceholder: 'searchPlaceholder',\n              rootSearch: 0,\n              page: 0,\n              offset: 0,\n              search: 'hi',\n            },\n          },\n        ]}\n      />\n      <Link {...linkProps} />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/params/$paramsPlaceholder.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport * as v from 'valibot'\nimport { queryOptions } from '@tanstack/solid-query'\nimport { createMiddleware, createServerFn } from '@tanstack/solid-start'\n\nconst params = v.object({\n  oneParamsPlaceholder: v.literal('oneParamsPlaceholder'),\n  twoParamsPlaceholder: v.literal('twoParamsPlaceholder'),\n  threeParamsPlaceholder: v.literal('threeParamsPlaceholder'),\n})\n\nconst loaderResult = v.object({\n  params,\n})\n\nconst middleware = createMiddleware({ type: 'function' })\n  .inputValidator(params)\n  .client(({ next }) => {\n    const context = { client: { paramsPlaceholder: 'paramsPlaceholder' } }\n    return next({\n      context,\n      sendContext: context,\n    })\n  })\n  .server(({ next }) => {\n    const context = { server: { paramsPlaceholder: 'paramsPlaceholder' } }\n    return next({\n      context,\n      sendContext: context,\n    })\n  })\n\nconst fn = createServerFn()\n  .middleware([middleware])\n  .handler(() => {\n    return v.parse(loaderResult, {})\n  })\n\nconst paramsQueryOptions = queryOptions({\n  queryKey: ['paramsPlaceholder'],\n  queryFn: () => {\n    return v.parse(loaderResult, {})\n  },\n})\n\nexport const Route = createFileRoute('/params/$paramsPlaceholder')({\n  component: ParamsComponent,\n  context: () => ({\n    paramsQueryOptions: queryOptions({\n      queryKey: ['paramsPlaceholder'],\n      queryFn: async () =>\n        await fn({\n          data: {\n            oneParamsPlaceholder: 'oneParamsPlaceholder',\n            twoParamsPlaceholder: 'twoParamsPlaceholder',\n            threeParamsPlaceholder: 'threeParamsPlaceholder',\n          },\n        }),\n    }),\n  }),\n  loader: (opts) =>\n    opts.context.queryClient.ensureQueryData(paramsQueryOptions),\n})\n\nfunction ParamsComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link\n        to=\"/params/$paramsPlaceholder\"\n        params={{\n          paramsPlaceholder: 'params',\n        }}\n      />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/params/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/params')({\n  component: () => <div>Hello /params!</div>,\n})\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/relative.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/relative')({\n  component: RelativeComponent,\n})\n\nfunction RelativeComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link\n        from={Route.fullPath}\n        to=\"../relative\"\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Relative\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/search/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport * as v from 'valibot'\n\nconst search = v.object({\n  rootSearch: v.number(),\n})\n\nexport const Route = createFileRoute('/search')({\n  component: () => <div>Hello /search!</div>,\n  validateSearch: search,\n})\n"
  },
  {
    "path": "examples/solid/start-large/src/routes/search/searchPlaceholder.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\nimport * as v from 'valibot'\nimport { queryOptions } from '@tanstack/solid-query'\nimport { createMiddleware, createServerFn } from '@tanstack/solid-start'\n\nconst search = v.object({\n  searchPlaceholder: v.literal('searchPlaceholder'),\n  page: v.number(),\n  offset: v.number(),\n  search: v.string(),\n})\n\nconst loaderResult = v.object({\n  searchPlaceholder: v.number(),\n})\n\nconst middleware = createMiddleware({ type: 'function' })\n  .inputValidator(search)\n  .client(({ next }) => {\n    const context = { client: { searchPlaceholder: 'searchPlaceholder' } }\n    return next({\n      context,\n      sendContext: context,\n    })\n  })\n  .server(({ next }) => {\n    const context = { server: { searchPlaceholder: 'searchPlaceholder' } }\n    return next({\n      context,\n      sendContext: context,\n    })\n  })\n\nconst fn = createServerFn()\n  .middleware([middleware])\n  .handler(() => {\n    const result = v.parse(loaderResult, {\n      searchPlaceholder: 0,\n    })\n    return result\n  })\n\nexport const Route = createFileRoute('/search/searchPlaceholder')({\n  server: {\n    handlers: {\n      GET: () => {\n        return new Response('searchPlaceholder')\n      },\n    },\n  },\n  component: SearchComponent,\n  validateSearch: search,\n  loaderDeps: ({ search }) => ({ search }),\n  context: (ctx) => ({\n    searchQueryOptions: queryOptions({\n      queryKey: ['searchPlaceholder'],\n      queryFn: () => fn({ data: ctx.deps.search }),\n    }),\n  }),\n  loader: async (opts) => {\n    const search = await opts.context.queryClient.ensureQueryData(\n      opts.context.searchQueryOptions,\n    )\n\n    return {\n      search,\n    }\n  },\n})\n\nfunction SearchComponent() {\n  return (\n    <div class=\"p-2 space-y-2\">\n      <Link\n        to=\"/search/searchPlaceholder\"\n        class=\"block py-1 text-blue-800 hover:text-blue-600\"\n        search={{\n          searchPlaceholder: 'searchPlaceholder',\n          page: 0,\n          offset: 10,\n          search: 'search',\n          rootSearch: 0,\n        }}\n      >\n        Search\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-large/src/typePrimitives.tsx",
    "content": "import { Link, redirect, useNavigate } from '@tanstack/solid-router'\nimport { onMount } from 'solid-js'\nimport type {\n  RegisteredRouter,\n  ValidateFromPath,\n  ValidateLinkOptions,\n  ValidateLinkOptionsArray,\n  ValidateNavigateOptions,\n  ValidateRedirectOptions,\n} from '@tanstack/solid-router'\nimport type { JSX } from 'solid-js'\n\nexport function customRedirect<TRouter extends RegisteredRouter, TOptions>(\n  options: ValidateRedirectOptions<TRouter, TOptions>,\n): void\nexport function customRedirect(options: ValidateRedirectOptions): void {\n  throw redirect(options)\n}\n\nexport function useCustomNavigate<TRouter extends RegisteredRouter, TOptions>(\n  options: ValidateNavigateOptions<TRouter, TOptions>,\n): void\nexport function useCustomNavigate(options: ValidateNavigateOptions): void {\n  const navigate = useNavigate()\n\n  onMount(() => {\n    navigate(options)\n  })\n}\n\nexport function MyLink<TRouter extends RegisteredRouter, TOptions>(\n  options: ValidateLinkOptions<TRouter, TOptions>,\n): JSX.Element\nexport function MyLink(options: ValidateLinkOptions) {\n  return <Link {...options} />\n}\n\nexport interface ListItemsProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions extends ReadonlyArray<unknown> = ReadonlyArray<unknown>,\n  TFrom extends string = string,\n> {\n  from: ValidateFromPath<TRouter, TFrom>\n  items: ValidateLinkOptionsArray<TRouter, TOptions, TFrom>\n}\n\nexport function ListItems<\n  TRouter extends RegisteredRouter,\n  TOptions extends ReadonlyArray<unknown>,\n  TFrom extends string,\n>(options: ListItemsProps<TRouter, TOptions, TFrom>): JSX.Element\nexport function ListItems(options: ListItemsProps) {\n  return options.items.map((item) => <Link {...item} from={options.from} />)\n}\n"
  },
  {
    "path": "examples/solid/start-large/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-large/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-streaming-data-from-server-functions\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/node\": \"^22.5.4\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    defaultErrorComponent: (err) => <p>{err.error.stack}</p>,\n    defaultNotFoundComponent: () => <p>not found</p>,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport {\n  HeadContent,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { HydrationScript } from 'solid-js/web'\nimport type { JSX } from 'solid-js'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { createSignal } from 'solid-js'\nimport { z } from 'zod'\n\n/**\n  This schema will be used to define the type\n  of each chunk in the `ReadableStream`.\n  (It mimics OpenAI's streaming response format.)\n*/\nconst textPartSchema = z.object({\n  choices: z.array(\n    z.object({\n      delta: z.object({\n        content: z.string().optional(),\n      }),\n      index: z.number(),\n      finish_reason: z.string().nullable(),\n    }),\n  ),\n})\n\nexport type TextPart = z.infer<typeof textPartSchema>\n\n/**\n  This helper function generates the array of messages\n  that we'll stream to the client.\n*/\nfunction generateMessages() {\n  const messages = Array.from({ length: 10 }, () =>\n    Math.floor(Math.random() * 100),\n  ).map((n, i) =>\n    textPartSchema.parse({\n      choices: [\n        {\n          delta: { content: `Number #${i + 1}: ${n}\\n` },\n          index: i,\n          finish_reason: null,\n        },\n      ],\n    }),\n  )\n  return messages\n}\n\n/**\n  This helper function is used to simulate the\n  delay between each message being sent.\n*/\nfunction sleep(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n  This server function returns a `ReadableStream`\n  that streams `TextPart` chunks to the client.\n*/\nconst streamingResponseFn = createServerFn().handler(async () => {\n  const messages = generateMessages()\n  // This `ReadableStream` is typed, so each\n  // will be of type `TextPart`.\n  const stream = new ReadableStream<TextPart>({\n    async start(controller) {\n      for (const message of messages) {\n        // simulate network latency\n        await sleep(500)\n        controller.enqueue(message)\n      }\n      controller.close()\n    },\n  })\n\n  return stream\n})\n\n/**\n  You can also use an async generator function to stream\n  typed chunks to the client.\n*/\nconst streamingWithAnAsyncGeneratorFn = createServerFn().handler(\n  async function* () {\n    const messages = generateMessages()\n    for (const msg of messages) {\n      await sleep(500)\n      // The streamed chunks are still typed as `TextPart`\n      yield msg\n    }\n  },\n)\n\nexport const Route = createFileRoute('/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  const [readableStreamMessages, setReadableStreamMessages] = createSignal('')\n\n  const [asyncGeneratorFuncMessages, setAsyncGeneratorFuncMessages] =\n    createSignal('')\n\n  const getTypedReadableStreamResponse = async () => {\n    const response = await streamingResponseFn()\n\n    if (!response) {\n      return\n    }\n\n    const reader = response.getReader()\n    let done = false\n    setReadableStreamMessages('')\n    while (!done) {\n      const { value, done: doneReading } = await reader.read()\n      done = doneReading\n      if (value) {\n        // Notice how we know the value of `chunk` (`TextPart | undefined`)\n        // here, because it's coming from the typed `ReadableStream`\n        const chunk = value?.choices[0].delta.content\n        if (chunk) {\n          setReadableStreamMessages((prev) => prev + chunk)\n        }\n      }\n    }\n  }\n\n  const getResponseFromTheAsyncGenerator = async () => {\n    setAsyncGeneratorFuncMessages('')\n    for await (const msg of await streamingWithAnAsyncGeneratorFn()) {\n      const chunk = msg?.choices[0].delta.content\n      if (chunk) {\n        setAsyncGeneratorFuncMessages((prev) => prev + chunk)\n      }\n    }\n  }\n\n  return (\n    <main>\n      <h1>Typed Readable Stream</h1>\n      <div id=\"streamed-results\">\n        <button onClick={() => getTypedReadableStreamResponse()}>\n          Get 10 random numbers (ReadableStream)\n        </button>\n        <button onClick={() => getResponseFromTheAsyncGenerator()}>\n          Get 10 random numbers (Async Generator Function)\n        </button>\n        <pre>{readableStreamMessages()}</pre>\n        <pre>{asyncGeneratorFuncMessages()}</pre>\n      </div>\n    </main>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/src/styles/app.css",
    "content": "body {\n  font-family:\n    Gordita, Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',\n    sans-serif;\n}\n\na {\n  margin-right: 1rem;\n}\n\nmain {\n  text-align: center;\n  padding: 1em;\n  margin: 0 auto;\n}\n\n#streamed-results {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n}\n\n#streamed-results > button {\n  margin: auto;\n}\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\", \"public/script*.js\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-streaming-data-from-server-functions/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-supabase-basic/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-example-supabase-basic\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"pnpx srvx --prod -s ../client dist/server/server.js\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"@supabase/ssr\": \"^0.5.2\",\n    \"@supabase/supabase-js\": \"^2.48.1\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.9\",\n    \"redaxios\": \"^0.5.1\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/public/site.webmanifest",
    "content": "{\n  \"name\": \"\",\n  \"short_name\": \"\",\n  \"icons\": [\n    {\n      \"src\": \"/android-chrome-192x192.png\",\n      \"sizes\": \"192x192\",\n      \"type\": \"image/png\"\n    },\n    {\n      \"src\": \"/android-chrome-512x512.png\",\n      \"sizes\": \"512x512\",\n      \"type\": \"image/png\"\n    }\n  ],\n  \"theme_color\": \"#ffffff\",\n  \"background_color\": \"#ffffff\",\n  \"display\": \"standalone\"\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/components/Auth.tsx",
    "content": "import type * as Solid from 'solid-js'\n\nexport function Auth(props: {\n  actionText: string\n  onSubmit: (e: Event) => void\n  status: 'pending' | 'idle' | 'success' | 'error'\n  afterSubmit?: Solid.JSX.Element\n}) {\n  return (\n    <div class=\"fixed inset-0 bg-white dark:bg-black flex items-start justify-center p-8\">\n      <div class=\"bg-white dark:bg-gray-900 p-8 rounded-lg shadow-lg\">\n        <h1 class=\"text-2xl font-bold mb-4\">{props.actionText}</h1>\n        <form\n          onSubmit={(e) => {\n            e.preventDefault()\n            props.onSubmit(e)\n          }}\n          class=\"space-y-4\"\n        >\n          <div>\n            <label for=\"email\" class=\"block text-xs\">\n              Username\n            </label>\n            <input\n              type=\"email\"\n              name=\"email\"\n              id=\"email\"\n              class=\"px-2 py-1 w-full rounded border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <div>\n            <label for=\"password\" class=\"block text-xs\">\n              Password\n            </label>\n            <input\n              type=\"password\"\n              name=\"password\"\n              id=\"password\"\n              class=\"px-2 py-1 w-full rounded border border-gray-500/20 bg-white dark:bg-gray-800\"\n            />\n          </div>\n          <button\n            type=\"submit\"\n            class=\"w-full bg-cyan-600 text-white rounded py-2 font-black uppercase\"\n            disabled={props.status === 'pending'}\n          >\n            {props.status === 'pending' ? '...' : props.actionText}\n          </button>\n          {props.afterSubmit}\n        </form>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/components/DefaultCatchBoundary.tsx",
    "content": "import {\n  ErrorComponent,\n  Link,\n  rootRouteId,\n  useMatch,\n  useRouter,\n} from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function DefaultCatchBoundary({ error }: ErrorComponentProps) {\n  const router = useRouter()\n  const isRoot = useMatch({\n    strict: false,\n    select: (state) => state.id === rootRouteId,\n  })\n\n  console.error(error)\n\n  return (\n    <div class=\"min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6\">\n      <ErrorComponent error={error} />\n      <div class=\"flex gap-2 items-center flex-wrap\">\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}\n        >\n          Try Again\n        </button>\n        {isRoot() ? (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}\n          >\n            Home\n          </Link>\n        ) : (\n          <Link\n            to=\"/\"\n            class={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded text-white uppercase font-extrabold`}\n            onClick={(e) => {\n              e.preventDefault()\n              window.history.back()\n            }}\n          >\n            Go Back\n          </Link>\n        )}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/components/Login.tsx",
    "content": "import { useRouter } from '@tanstack/solid-router'\nimport { useServerFn } from '@tanstack/solid-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { loginFn } from '../routes/_authed'\nimport { signupFn } from '../routes/signup'\nimport { Auth } from './Auth'\n\nexport function Login() {\n  const router = useRouter()\n\n  const loginMutation = useMutation({\n    fn: loginFn,\n    onSuccess: async (ctx) => {\n      if (!ctx.data?.error) {\n        await router.invalidate()\n        router.navigate({ to: '/' })\n        return\n      }\n    },\n  })\n\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Login\"\n      status={loginMutation.status()}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as HTMLFormElement)\n\n        loginMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        loginMutation.data() ? (\n          <>\n            <div class=\"text-red-400\">{loginMutation.data()?.message}</div>\n            {loginMutation.data()?.error &&\n            loginMutation.data()?.message === 'Invalid login credentials' ? (\n              <div>\n                <button\n                  class=\"text-blue-500\"\n                  onClick={(e) => {\n                    const formData = new FormData(\n                      (e.target as HTMLButtonElement).form!,\n                    )\n\n                    signupMutation.mutate({\n                      data: {\n                        email: formData.get('email') as string,\n                        password: formData.get('password') as string,\n                      },\n                    })\n                  }}\n                  type=\"button\"\n                >\n                  Sign up instead?\n                </button>\n              </div>\n            ) : null}\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/components/NotFound.tsx",
    "content": "import { Link } from '@tanstack/solid-router'\nimport type * as Solid from 'solid-js'\n\nexport function NotFound({ children }: { children?: Solid.JSX.Element }) {\n  return (\n    <div class=\"space-y-2 p-2\">\n      <div class=\"text-gray-600 dark:text-gray-400\">\n        {children || <p>The page you are looking for does not exist.</p>}\n      </div>\n      <p class=\"flex items-center gap-2 flex-wrap\">\n        <button\n          onClick={() => window.history.back()}\n          class=\"bg-emerald-500 text-white px-2 py-1 rounded uppercase font-black text-sm\"\n        >\n          Go back\n        </button>\n        <Link\n          to=\"/\"\n          class=\"bg-cyan-600 text-white px-2 py-1 rounded uppercase font-black text-sm\"\n        >\n          Start Over\n        </Link>\n      </p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/hooks/useMutation.ts",
    "content": "import { createSignal } from 'solid-js'\n\nexport function useMutation<TVariables, TData, TError = Error>(opts: {\n  fn: (variables: TVariables) => Promise<TData>\n  onSuccess?: (ctx: { data: TData }) => void | Promise<void>\n}) {\n  const [submittedAt, setSubmittedAt] = createSignal<number | undefined>()\n  const [variables, setVariables] = createSignal<TVariables | undefined>()\n  const [error, setError] = createSignal<TError | undefined>()\n  const [data, setData] = createSignal<TData | undefined>()\n  const [status, setStatus] = createSignal<\n    'idle' | 'pending' | 'success' | 'error'\n  >('idle')\n\n  const mutate = async (variables: TVariables): Promise<TData | undefined> => {\n    setStatus('pending')\n    setSubmittedAt(Date.now())\n    setVariables(() => variables)\n\n    try {\n      const result = await opts.fn(variables)\n      await opts.onSuccess?.({ data: result })\n      setStatus('success')\n      setError(undefined)\n      setData(() => result)\n      return result\n    } catch (err) {\n      setStatus('error')\n      setError(() => err as TError)\n      return undefined\n    }\n  }\n\n  return {\n    status,\n    variables,\n    submittedAt,\n    mutate,\n    error,\n    data,\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as SignupRouteImport } from './routes/signup'\nimport { Route as LogoutRouteImport } from './routes/logout'\nimport { Route as LoginRouteImport } from './routes/login'\nimport { Route as AuthedRouteImport } from './routes/_authed'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as AuthedPostsRouteImport } from './routes/_authed/posts'\nimport { Route as AuthedPostsIndexRouteImport } from './routes/_authed/posts.index'\nimport { Route as AuthedPostsPostIdRouteImport } from './routes/_authed/posts.$postId'\n\nconst SignupRoute = SignupRouteImport.update({\n  id: '/signup',\n  path: '/signup',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LogoutRoute = LogoutRouteImport.update({\n  id: '/logout',\n  path: '/logout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LoginRoute = LoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedRoute = AuthedRouteImport.update({\n  id: '/_authed',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthedPostsRoute = AuthedPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => AuthedRoute,\n} as any)\nconst AuthedPostsIndexRoute = AuthedPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\nconst AuthedPostsPostIdRoute = AuthedPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => AuthedPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts': typeof AuthedPostsRouteWithChildren\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/posts': typeof AuthedPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_authed': typeof AuthedRouteWithChildren\n  '/login': typeof LoginRoute\n  '/logout': typeof LogoutRoute\n  '/signup': typeof SignupRoute\n  '/_authed/posts': typeof AuthedPostsRouteWithChildren\n  '/_authed/posts/$postId': typeof AuthedPostsPostIdRoute\n  '/_authed/posts/': typeof AuthedPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/posts'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/_authed'\n    | '/login'\n    | '/logout'\n    | '/signup'\n    | '/_authed/posts'\n    | '/_authed/posts/$postId'\n    | '/_authed/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthedRoute: typeof AuthedRouteWithChildren\n  LoginRoute: typeof LoginRoute\n  LogoutRoute: typeof LogoutRoute\n  SignupRoute: typeof SignupRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/signup': {\n      id: '/signup'\n      path: '/signup'\n      fullPath: '/signup'\n      preLoaderRoute: typeof SignupRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/logout': {\n      id: '/logout'\n      path: '/logout'\n      fullPath: '/logout'\n      preLoaderRoute: typeof LogoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/login': {\n      id: '/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof LoginRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed': {\n      id: '/_authed'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof AuthedRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_authed/posts': {\n      id: '/_authed/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof AuthedPostsRouteImport\n      parentRoute: typeof AuthedRoute\n    }\n    '/_authed/posts/': {\n      id: '/_authed/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof AuthedPostsIndexRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n    '/_authed/posts/$postId': {\n      id: '/_authed/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof AuthedPostsPostIdRouteImport\n      parentRoute: typeof AuthedPostsRoute\n    }\n  }\n}\n\ninterface AuthedPostsRouteChildren {\n  AuthedPostsPostIdRoute: typeof AuthedPostsPostIdRoute\n  AuthedPostsIndexRoute: typeof AuthedPostsIndexRoute\n}\n\nconst AuthedPostsRouteChildren: AuthedPostsRouteChildren = {\n  AuthedPostsPostIdRoute: AuthedPostsPostIdRoute,\n  AuthedPostsIndexRoute: AuthedPostsIndexRoute,\n}\n\nconst AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(\n  AuthedPostsRouteChildren,\n)\n\ninterface AuthedRouteChildren {\n  AuthedPostsRoute: typeof AuthedPostsRouteWithChildren\n}\n\nconst AuthedRouteChildren: AuthedRouteChildren = {\n  AuthedPostsRoute: AuthedPostsRouteWithChildren,\n}\n\nconst AuthedRouteWithChildren =\n  AuthedRoute._addFileChildren(AuthedRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthedRoute: AuthedRouteWithChildren,\n  LoginRoute: LoginRoute,\n  LogoutRoute: LogoutRoute,\n  SignupRoute: SignupRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { HydrationScript } from 'solid-js/web'\nimport { DefaultCatchBoundary } from '../components/DefaultCatchBoundary'\nimport { NotFound } from '../components/NotFound'\nimport appCss from '../styles/app.css?url'\nimport { seo } from '../utils/seo'\nimport { getSupabaseServerClient } from '../utils/supabase'\nimport type * as Solid from 'solid-js'\n\nconst fetchUser = createServerFn({ method: 'GET' }).handler(async () => {\n  const supabase = getSupabaseServerClient()\n  const { data, error: _error } = await supabase.auth.getUser()\n\n  if (!data.user?.email) {\n    return null\n  }\n\n  return {\n    email: data.user.email,\n  }\n})\n\nexport const Route = createRootRoute({\n  beforeLoad: async () => {\n    const user = await fetchUser()\n\n    return {\n      user,\n    }\n  },\n  head: () => ({\n    meta: [\n      {\n        charset: 'utf-8',\n      },\n      {\n        name: 'viewport',\n        content: 'width=device-width, initial-scale=1',\n      },\n      ...seo({\n        title:\n          'TanStack Start | Type-Safe, Client-First, Full-Stack Solid Framework',\n        description: `TanStack Start is a type-safe, client-first, full-stack Solid framework. `,\n      }),\n    ],\n    links: [\n      { rel: 'stylesheet', href: appCss },\n      {\n        rel: 'apple-touch-icon',\n        sizes: '180x180',\n        href: '/apple-touch-icon.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '32x32',\n        href: '/favicon-32x32.png',\n      },\n      {\n        rel: 'icon',\n        type: 'image/png',\n        sizes: '16x16',\n        href: '/favicon-16x16.png',\n      },\n      { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },\n      { rel: 'icon', href: '/favicon.ico' },\n    ],\n  }),\n  errorComponent: (props) => {\n    return (\n      <RootDocument>\n        <DefaultCatchBoundary {...props} />\n      </RootDocument>\n    )\n  },\n  notFoundComponent: () => <NotFound />,\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: Solid.JSX.Element }) {\n  const { user } = Route.useRouteContext()()\n\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n          <div class=\"ml-auto\">\n            {user ? (\n              <>\n                <span class=\"mr-2\">{user.email}</span>\n                <Link to=\"/logout\">Logout</Link>\n              </>\n            ) : (\n              <Link to=\"/login\">Login</Link>\n            )}\n          </div>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/_authed/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\nimport { NotFound } from '~/components/NotFound'\nimport { fetchPost } from '~/utils/posts'\n\nexport const Route = createFileRoute('/_authed/posts/$postId')({\n  loader: ({ params: { postId } }) => fetchPost({ data: postId }),\n  errorComponent: ErrorComponent,\n  component: PostComponent,\n  notFoundComponent: () => {\n    return <NotFound>Post not found</NotFound>\n  },\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/_authed/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/_authed/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/_authed/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../../utils/posts'\n\nexport const Route = createFileRoute('/_authed/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/_authed.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { Login } from '../components/Login'\nimport { getSupabaseServerClient } from '../utils/supabase'\n\nexport const loginFn = createServerFn({ method: 'POST' })\n  .inputValidator((d: { email: string; password: string }) => d)\n  .handler(async ({ data }) => {\n    const supabase = getSupabaseServerClient()\n    const { error } = await supabase.auth.signInWithPassword({\n      email: data.email,\n      password: data.password,\n    })\n\n    if (error) {\n      return {\n        error: true,\n        message: error.message,\n      }\n    }\n  })\n\nexport const Route = createFileRoute('/_authed')({\n  beforeLoad: ({ context }) => {\n    if (!context.user) {\n      throw new Error('Not authenticated')\n    }\n  },\n  errorComponent: ({ error }) => {\n    if (error.message === 'Not authenticated') {\n      return <Login />\n    }\n    throw error\n  },\n})\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\nimport { Login } from '../components/Login'\n\nexport const Route = createFileRoute('/login')({\n  component: LoginComp,\n})\n\nfunction LoginComp() {\n  return <Login />\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/logout.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport { getSupabaseServerClient } from '../utils/supabase'\n\nconst logoutFn = createServerFn().handler(async () => {\n  const supabase = getSupabaseServerClient()\n  const { error } = await supabase.auth.signOut()\n\n  if (error) {\n    return {\n      error: true,\n      message: error.message,\n    }\n  }\n\n  throw redirect({\n    href: '/',\n  })\n})\n\nexport const Route = createFileRoute('/logout')({\n  preload: false,\n  loader: () => logoutFn(),\n})\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/routes/signup.tsx",
    "content": "import { createFileRoute, redirect } from '@tanstack/solid-router'\nimport { createServerFn, useServerFn } from '@tanstack/solid-start'\nimport { useMutation } from '../hooks/useMutation'\nimport { Auth } from '../components/Auth'\nimport { getSupabaseServerClient } from '../utils/supabase'\n\nexport const signupFn = createServerFn({ method: 'POST' })\n  .inputValidator(\n    (d: { email: string; password: string; redirectUrl?: string }) => d,\n  )\n  .handler(async ({ data }) => {\n    const supabase = getSupabaseServerClient()\n    const { error } = await supabase.auth.signUp({\n      email: data.email,\n      password: data.password,\n    })\n    if (error) {\n      return {\n        error: true,\n        message: error.message,\n      }\n    }\n\n    // Redirect to the prev page stored in the \"redirect\" search param\n    throw redirect({\n      href: data.redirectUrl || '/',\n    })\n  })\n\nexport const Route = createFileRoute('/signup')({\n  component: SignupComp,\n})\n\nfunction SignupComp() {\n  const signupMutation = useMutation({\n    fn: useServerFn(signupFn),\n  })\n\n  return (\n    <Auth\n      actionText=\"Sign Up\"\n      status={signupMutation.status()}\n      onSubmit={(e) => {\n        const formData = new FormData(e.target as HTMLFormElement)\n\n        signupMutation.mutate({\n          data: {\n            email: formData.get('email') as string,\n            password: formData.get('password') as string,\n          },\n        })\n      }}\n      afterSubmit={\n        signupMutation.data()?.error ? (\n          <>\n            <div class=\"text-red-400\">{signupMutation.data()?.message}</div>\n          </>\n        ) : null\n      }\n    />\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/utils/posts.ts",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport { createServerFn } from '@tanstack/solid-start'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = createServerFn({ method: 'GET' })\n  .inputValidator((d: string) => d)\n  .handler(async ({ data: postId }) => {\n    console.info(`Fetching post with id ${postId}...`)\n    const post = await axios\n      .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n      .then((r) => r.data)\n      .catch((err) => {\n        console.error(err)\n        if (err.status === 404) {\n          throw notFound()\n        }\n        throw err\n      })\n\n    return post\n  })\n\nexport const fetchPosts = createServerFn({ method: 'GET' }).handler(\n  async () => {\n    console.info('Fetching posts...')\n    await new Promise((r) => setTimeout(r, 1000))\n    return axios\n      .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n      .then((r) => r.data.slice(0, 10))\n  },\n)\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/utils/seo.ts",
    "content": "export const seo = ({\n  title,\n  description,\n  keywords,\n  image,\n}: {\n  title: string\n  description?: string\n  image?: string\n  keywords?: string\n}) => {\n  const tags = [\n    { title },\n    { name: 'description', content: description },\n    { name: 'keywords', content: keywords },\n    { name: 'twitter:title', content: title },\n    { name: 'twitter:description', content: description },\n    { name: 'twitter:creator', content: '@tannerlinsley' },\n    { name: 'twitter:site', content: '@tannerlinsley' },\n    { name: 'og:type', content: 'website' },\n    { name: 'og:title', content: title },\n    { name: 'og:description', content: description },\n    ...(image\n      ? [\n          { name: 'twitter:image', content: image },\n          { name: 'twitter:card', content: 'summary_large_image' },\n          { name: 'og:image', content: image },\n        ]\n      : []),\n  ]\n\n  return tags\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/src/utils/supabase.ts",
    "content": "import { getCookies, setCookie } from '@tanstack/solid-start/server'\nimport { createServerClient } from '@supabase/ssr'\n\nexport function getSupabaseServerClient() {\n  return createServerClient(\n    process.env.SUPABASE_URL!,\n    process.env.SUPABASE_ANON_KEY!,\n    {\n      cookies: {\n        getAll() {\n          return Object.entries(getCookies()).map(([name, value]) => ({\n            name,\n            value,\n          }))\n        },\n        setAll(cookies) {\n          cookies.forEach((cookie) => {\n            setCookie(cookie.name, cookie.value)\n          })\n        },\n      },\n    },\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-supabase-basic/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n.nitro\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n.tanstack"
  },
  {
    "path": "examples/solid/start-tailwind-v4/.prettierignore",
    "content": "**/build\n**/public\npnpm-lock.yaml\nrouteTree.gen.ts"
  },
  {
    "path": "examples/solid/start-tailwind-v4/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/README.md",
    "content": "# Welcome to TanStack.com!\n\nThis site is built with TanStack Router!\n\n- [TanStack Router Docs](https://tanstack.com/router)\n\nIt's deployed automagically with Netlify!\n\n- [Netlify](https://netlify.com/)\n\n## Development\n\nFrom your terminal:\n\n```sh\npnpm install\npnpm dev\n```\n\nThis starts your app in development mode, rebuilding assets on file changes.\n\n## Editing and previewing the docs of TanStack projects locally\n\nThe documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app.\nIn 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.\n\nFollow 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 :\n\n1. Create a new directory called `tanstack`.\n\n```sh\nmkdir tanstack\n```\n\n2. Enter the directory and clone this repo and the repo of the project there.\n\n```sh\ncd tanstack\ngit clone git@github.com:TanStack/tanstack.com.git\ngit clone git@github.com:TanStack/form.git\n```\n\n> [!NOTE]\n> Your `tanstack` directory should look like this:\n>\n> ```\n> tanstack/\n>    |\n>    +-- form/\n>    |\n>    +-- tanstack.com/\n> ```\n\n> [!WARNING]\n> 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.\n\n3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:\n\n```sh\ncd tanstack.com\npnpm i\n# The app will run on https://localhost:3000 by default\npnpm dev\n```\n\n4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`.\n\n> [!NOTE]\n> The updated pages need to be manually reloaded in the browser.\n\n> [!WARNING]\n> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page!\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/package.json",
    "content": "{\n  \"name\": \"tanstack-solid-start-tailwind-v4\",\n  \"private\": true,\n  \"sideEffects\": false,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"node .output/server/index.mjs\"\n  },\n  \"dependencies\": {\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/solid-start\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"tailwind-merge\": \"^2.6.0\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@types/node\": \"^22.5.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\nimport type { getRouter } from './router.tsx'\nimport type { createStart } from '@tanstack/solid-start'\ndeclare module '@tanstack/solid-start' {\n  interface Register {\n    ssr: true\n    router: Awaited<ReturnType<typeof getRouter>>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/src/router.tsx",
    "content": "import { createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    defaultPreload: 'intent',\n    scrollRestoration: true,\n  })\n\n  return router\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: ReturnType<typeof getRouter>\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/src/routes/__root.tsx",
    "content": "/// <reference types=\"vite/client\" />\nimport {\n  HeadContent,\n  Link,\n  Outlet,\n  Scripts,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport * as React from 'react'\nimport { HydrationScript } from 'solid-js/web'\nimport type { JSX } from 'solid-js'\nimport appCss from '~/styles/app.css?url'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    links: [{ rel: 'stylesheet', href: appCss }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: { children: JSX.Element }) {\n  return (\n    <html>\n      <head>\n        <HydrationScript />\n      </head>\n      <body>\n        <HeadContent />\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>\n        </div>\n        <hr />\n        {children}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2 text-blue-600\">\n      <h3>Welcome Home!!!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/src/styles/app.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  html {\n    color-scheme: light dark;\n  }\n\n  * {\n    @apply border-gray-200 dark:border-gray-800;\n  }\n\n  html,\n  body {\n    @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200;\n  }\n\n  .using-mouse * {\n    outline: none !important;\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/tsconfig.json",
    "content": "{\n  \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"module\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"isolatedModules\": true,\n    \"resolveJsonModule\": true,\n    \"skipLibCheck\": true,\n    \"target\": \"ES2022\",\n    \"allowJs\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"~/*\": [\"./src/*\"]\n    },\n    \"noEmit\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/start-tailwind-v4/vite.config.ts",
    "content": "import { tanstackStart } from '@tanstack/solid-start/plugin/vite'\nimport { defineConfig } from 'vite'\nimport viteSolid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\nexport default defineConfig({\n  server: {\n    port: 3000,\n  },\n  resolve: {\n    tsconfigPaths: true,\n  },\n  plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })],\n})\n"
  },
  {
    "path": "examples/solid/view-transitions/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/view-transitions/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/view-transitions/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/view-transitions/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-view-transitions\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n  /* \n  Using defaultViewTransition would prevent the need to\n  manually add `viewTransition: true` to every navigation.\n\n  If defaultViewTransition.types is a function, it will be called with the\n  location change info and should return an array of view transition types.\n  This is useful if you want to have different view transitions depending on\n  the navigation's specifics.\n\n  An example use case is sliding in a direction based on the index of the\n  previous and next routes when navigating via browser history back and forth.\n  */\n  // defaultViewTransition: true\n  // OR\n  // defaultViewTransition: {\n  //   types: ({ fromLocation, toLocation }) => {\n  //     let direction = 'none'\n\n  //     if (fromLocation) {\n  //       const fromIndex = fromLocation.state.__TSR_index\n  //       const toIndex = toLocation.state.__TSR_index\n\n  //       direction = fromIndex > toIndex ? 'right' : 'left'\n  //     }\n\n  //     return [`slide-${direction}`]\n  //   },\n  // },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/solid-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 0))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 0))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as HowItWorksRouteImport } from './routes/how-it-works'\nimport { Route as ExploreRouteImport } from './routes/explore'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst HowItWorksRoute = HowItWorksRouteImport.update({\n  id: '/how-it-works',\n  path: '/how-it-works',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ExploreRoute = ExploreRouteImport.update({\n  id: '/explore',\n  path: '/explore',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/explore': typeof ExploreRoute\n  '/how-it-works': typeof HowItWorksRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/posts'\n    | '/explore'\n    | '/how-it-works'\n    | '/posts/$postId'\n    | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  ExploreRoute: typeof ExploreRoute\n  HowItWorksRoute: typeof HowItWorksRoute\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/how-it-works': {\n      id: '/how-it-works'\n      path: '/how-it-works'\n      fullPath: '/how-it-works'\n      preLoaderRoute: typeof HowItWorksRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/explore': {\n      id: '/explore'\n      path: '/explore'\n      fullPath: '/explore'\n      preLoaderRoute: typeof ExploreRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  ExploreRoute: ExploreRoute,\n  HowItWorksRoute: HowItWorksRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/view-transitions/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <HeadContent />\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n          viewTransition\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          viewTransition\n        >\n          Posts\n        </Link>{' '}\n      </div>\n      <hr />\n      <Outlet />\n      {/* Start rendering router matches */}\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/routes/explore.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/explore')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>\n        Explore the CSS to see how to use active-view-transition-type to create\n        new viewTransitions to use with Tanstack Router.\n      </h3>\n      <h4 class={'text-sm mt-2 italic'}>\n        Disclaimer: View Transition Types may not be supported in all browsers\n        and will fall back to the default browser transition if not available.\n      </h4>\n      <div class=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          class=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/routes/how-it-works.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/how-it-works')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>This example demonstrates a variety of custom page transitions.</h3>\n      <div class=\"flex justify-center gap-10 mt-4\">\n        <Link\n          to={'/'}\n          // see styles.css for 'slide-right' transition\n          viewTransition={{ types: ['slide-right'] }}\n          class=\"font-bold\"\n        >\n          &lt;- Previous Page\n        </Link>\n        <Link\n          to={'/explore'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          class=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n})\n\nfunction Home() {\n  return (\n    <div class=\"p-2 [view-transition-name:main-content]\">\n      <h3>Welcome To The View Transitions Example!</h3>\n      <div class=\"flex justify-center mt-4\">\n        <Link\n          to={'/how-it-works'}\n          // see styles.css for 'slide-left' transition\n          viewTransition={{ types: ['slide-left'] }}\n          class=\"font-bold\"\n        >\n          Next Page -&gt;\n        </Link>\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/routes/posts.$postId.tsx",
    "content": "import { ErrorComponent, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPost } from '../posts'\nimport type { ErrorComponentProps } from '@tanstack/solid-router'\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n      <div class=\"text-sm\">{post().body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/routes/posts.route.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2  [view-transition-name:main-content]\">\n      <ul class=\"list-disc pl-4\">\n        {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(\n          (post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-600 hover:opacity-75\"\n                  activeProps={{ class: 'font-bold underline' }}\n                  // see styles.css for 'warp' transition\n                  viewTransition={{ types: ['warp'] }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <div class=\"[view-transition-name:post]\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n\n/* Slide Left Transition */\nhtml:active-view-transition-type(slide-left) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-left;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-left;\n  }\n}\n\n@keyframes slide-out-left {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(-100%);\n  }\n}\n\n@keyframes slide-in-left {\n  from {\n    transform: translateX(100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Slide Right Transition */\nhtml:active-view-transition-type(slide-right) {\n  &::view-transition-old(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-out-right;\n  }\n  &::view-transition-new(main-content) {\n    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-in-right;\n  }\n}\n\n@keyframes slide-out-right {\n  from {\n    transform: translateX(0);\n  }\n  to {\n    transform: translateX(100%);\n  }\n}\n\n@keyframes slide-in-right {\n  from {\n    transform: translateX(-100%);\n  }\n  to {\n    transform: translateX(0);\n  }\n}\n\n/* Warp/Rotate Transition */\nhtml:active-view-transition-type(warp) {\n  &::view-transition-old(post) {\n    animation: 400ms ease-out both warp-out;\n  }\n\n  &::view-transition-new(post) {\n    animation: 400ms ease-out both warp-in;\n  }\n}\n\n@keyframes warp-out {\n  from {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n  to {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(1.1) rotate(90deg);\n  }\n}\n\n@keyframes warp-in {\n  from {\n    opacity: 0;\n    filter: blur(15px) brightness(1.8);\n    transform: scale(0.9) rotate(-45deg);\n  }\n  to {\n    opacity: 1;\n    filter: blur(0) brightness(1);\n    transform: scale(1) rotate(0deg);\n  }\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/view-transitions/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solid(),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/with-framer-motion/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/with-framer-motion/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n"
  },
  {
    "path": "examples/solid/with-framer-motion/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/with-framer-motion/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/with-framer-motion/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/with-framer-motion/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-with-framer-motion\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"solid-js\": \"^1.9.10\",\n    \"solid-motionone\": \"^1.0.4\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vite-plugin-solid\": \"^2.11.11\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/with-framer-motion/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { Motion, Presence } from 'solid-motionone'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\nimport axios from 'redaxios'\nimport './styles.css'\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nconst fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nconst fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n\nexport const mainTransitionProps = {\n  initial: { y: -20, opacity: 0 },\n  animate: { y: 0, opacity: 1 },\n  exit: { y: 60, opacity: 0 },\n  transition: {\n    duration: 0.3,\n    easing: 'ease-out',\n  },\n} as const\n\nexport const postTransitionProps = {\n  initial: { y: -20, opacity: 0 },\n  animate: { y: 0, opacity: 1 },\n  exit: { y: 60, opacity: 0 },\n  transition: {\n    duration: 0.3,\n    easing: 'ease-out',\n  },\n} as const\n\nconst rootRoute = createRootRoute({\n  component: () => {\n    return (\n      <>\n        <div class=\"p-2 flex gap-2 text-lg\">\n          <Link\n            to=\"/\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n            activeOptions={{ exact: true }}\n          >\n            Home\n          </Link>{' '}\n          <Link\n            to=\"/posts\"\n            activeProps={{\n              class: 'font-bold',\n            }}\n          >\n            Posts\n          </Link>\n        </div>\n        <hr />\n        <Outlet />\n        {/* Start rendering router matches */}\n        <TanStackRouterDevtools position=\"bottom-right\" />\n      </>\n    )\n  },\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: () => {\n    return (\n      <Motion.div class=\"p-2\" {...mainTransitionProps}>\n        <h3>Welcome Home!</h3>\n      </Motion.div>\n    )\n  },\n})\n\nconst postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n  component: () => {\n    const posts = postsLayoutRoute.useLoaderData()\n    return (\n      <Motion.div class=\"p-2 flex gap-2\" {...mainTransitionProps}>\n        <ul class=\"list-disc pl-4\">\n          {[\n            ...posts(),\n            { id: 'i-do-not-exist', title: 'Non-existent Post' },\n          ].map((post) => {\n            return (\n              <li class=\"whitespace-nowrap\">\n                <Link\n                  to={postRoute.to}\n                  params={{\n                    postId: post.id,\n                  }}\n                  class=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ class: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          })}\n        </ul>\n        <hr />\n        <Presence>\n          <Outlet />\n        </Presence>\n      </Motion.div>\n    )\n  },\n})\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: () => <div>Select a post.</div>,\n})\n\nclass NotFoundError extends Error {}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  loader: ({ params: { postId } }) => fetchPost(postId),\n  errorComponent: ErrorComponent,\n  component: () => {\n    const post = postRoute.useLoaderData()\n    return (\n      <Motion.div class=\"space-y-2\" {...postTransitionProps}>\n        <h4 class=\"text-xl font-bold underline\">{post().title}</h4>\n        <div class=\"text-sm\">{post().body}</div>\n      </Motion.div>\n    )\n  },\n})\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  scrollRestoration: true,\n  context: {\n    // loaderClient,\n  },\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/with-framer-motion/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/with-framer-motion/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"]\n  }\n}\n"
  },
  {
    "path": "examples/solid/with-framer-motion/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), solid()],\n})\n"
  },
  {
    "path": "examples/solid/with-trpc/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/.gitignore",
    "content": "node_modules\npackage-lock.json\nyarn.lock\n\n.DS_Store\n.cache\n.env\n.vercel\n.output\n/build/\n/api/\n/server/build\n/public/build# Sentry Config File\n.env.sentry-build-plugin\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/\n"
  },
  {
    "path": "examples/solid/with-trpc/.vscode/settings.json",
    "content": "{\n  \"files.watcherExclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"search.exclude\": {\n    \"**/routeTree.gen.ts\": true\n  },\n  \"files.readonlyInclude\": {\n    \"**/routeTree.gen.ts\": true\n  }\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/solid/with-trpc/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/solid/with-trpc/package.json",
    "content": "{\n  \"name\": \"tanstack-router-solid-example-with-trpc\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"pnpm tsx ./src/server/server.ts --watch\",\n    \"build\": \"pnpm run build:server && pnpm run build:client\",\n    \"build:client\": \"vite build && tsc --noEmit\",\n    \"build:server\": \"vite build --mode server\",\n    \"start\": \"NODE_ENV=production node dist/server/server.js\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/solid-router\": \"^1.168.1\",\n    \"@tanstack/solid-router-devtools\": \"^1.166.10\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@trpc/client\": \"^11.4.3\",\n    \"@trpc/server\": \"^11.4.3\",\n    \"express\": \"^4.21.2\",\n    \"solid-js\": \"^1.9.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@types/express\": \"^4.17.23\",\n    \"vite-plugin-solid\": \"^2.11.11\",\n    \"tsx\": \"^4.20.3\",\n    \"vite\": \"^8.0.0\"\n  }\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/main.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { trpc } from './trpc'\n\nimport { Spinner } from './routes/-components/spinner'\nimport './styles.css'\n\n// Import the generated route tree\nimport { routeTree } from './routeTree.gen'\n\n// Create a router instance\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n  defaultPreload: 'intent',\n  defaultPendingComponent: () => (\n    <div class={`p-2 text-2xl`}>\n      <Spinner />\n    </div>\n  ),\n  context: {\n    trpc,\n  },\n})\n\n// Register the router instance for type safety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('root')!\n\nif (!rootElement.innerHTML) {\n  render(() => <RouterProvider router={router} />, rootElement)\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as DashboardRouteImport } from './routes/dashboard'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as DashboardIndexRouteImport } from './routes/dashboard.index'\nimport { Route as DashboardPostsRouteImport } from './routes/dashboard.posts'\nimport { Route as DashboardPostsIndexRouteImport } from './routes/dashboard.posts.index'\nimport { Route as DashboardPostsPostIdRouteImport } from './routes/dashboard.posts.$postId'\n\nconst DashboardRoute = DashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardIndexRoute = DashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardRoute,\n} as any)\nconst DashboardPostsRoute = DashboardPostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => DashboardRoute,\n} as any)\nconst DashboardPostsIndexRoute = DashboardPostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardPostsRoute,\n} as any)\nconst DashboardPostsPostIdRoute = DashboardPostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => DashboardPostsRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteWithChildren\n  '/dashboard/posts': typeof DashboardPostsRouteWithChildren\n  '/dashboard/': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts/': typeof DashboardPostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts': typeof DashboardPostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/dashboard': typeof DashboardRouteWithChildren\n  '/dashboard/posts': typeof DashboardPostsRouteWithChildren\n  '/dashboard/': typeof DashboardIndexRoute\n  '/dashboard/posts/$postId': typeof DashboardPostsPostIdRoute\n  '/dashboard/posts/': typeof DashboardPostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/dashboard'\n    | '/dashboard/posts'\n    | '/dashboard/'\n    | '/dashboard/posts/$postId'\n    | '/dashboard/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/dashboard' | '/dashboard/posts/$postId' | '/dashboard/posts'\n  id:\n    | '__root__'\n    | '/'\n    | '/dashboard'\n    | '/dashboard/posts'\n    | '/dashboard/'\n    | '/dashboard/posts/$postId'\n    | '/dashboard/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  DashboardRoute: typeof DashboardRouteWithChildren\n}\n\ndeclare module '@tanstack/solid-router' {\n  interface FileRoutesByPath {\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardIndexRouteImport\n      parentRoute: typeof DashboardRoute\n    }\n    '/dashboard/posts': {\n      id: '/dashboard/posts'\n      path: '/posts'\n      fullPath: '/dashboard/posts'\n      preLoaderRoute: typeof DashboardPostsRouteImport\n      parentRoute: typeof DashboardRoute\n    }\n    '/dashboard/posts/': {\n      id: '/dashboard/posts/'\n      path: '/'\n      fullPath: '/dashboard/posts/'\n      preLoaderRoute: typeof DashboardPostsIndexRouteImport\n      parentRoute: typeof DashboardPostsRoute\n    }\n    '/dashboard/posts/$postId': {\n      id: '/dashboard/posts/$postId'\n      path: '/$postId'\n      fullPath: '/dashboard/posts/$postId'\n      preLoaderRoute: typeof DashboardPostsPostIdRouteImport\n      parentRoute: typeof DashboardPostsRoute\n    }\n  }\n}\n\ninterface DashboardPostsRouteChildren {\n  DashboardPostsPostIdRoute: typeof DashboardPostsPostIdRoute\n  DashboardPostsIndexRoute: typeof DashboardPostsIndexRoute\n}\n\nconst DashboardPostsRouteChildren: DashboardPostsRouteChildren = {\n  DashboardPostsPostIdRoute: DashboardPostsPostIdRoute,\n  DashboardPostsIndexRoute: DashboardPostsIndexRoute,\n}\n\nconst DashboardPostsRouteWithChildren = DashboardPostsRoute._addFileChildren(\n  DashboardPostsRouteChildren,\n)\n\ninterface DashboardRouteChildren {\n  DashboardPostsRoute: typeof DashboardPostsRouteWithChildren\n  DashboardIndexRoute: typeof DashboardIndexRoute\n}\n\nconst DashboardRouteChildren: DashboardRouteChildren = {\n  DashboardPostsRoute: DashboardPostsRouteWithChildren,\n  DashboardIndexRoute: DashboardIndexRoute,\n}\n\nconst DashboardRouteWithChildren = DashboardRoute._addFileChildren(\n  DashboardRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  DashboardRoute: DashboardRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routes/-components/spinner.tsx",
    "content": "export function Spinner(props: { show?: boolean; wait?: `delay-${number}` }) {\n  return (\n    <div\n      class={\n        props.show !== undefined\n          ? `inline-block animate-spin px-3 transition ${\n              props.show\n                ? `opacity-100 duration-500 ${props.wait ?? 'delay-300'}`\n                : 'duration-500 opacity-0 delay-0'\n            }`\n          : 'inline-block animate-spin px-3'\n      }\n    >\n      ⍥\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routes/__root.tsx",
    "content": "import {\n  Link,\n  Outlet,\n  createRootRouteWithContext,\n  useRouterState,\n} from '@tanstack/solid-router'\nimport { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'\n\nimport { Spinner } from './-components/spinner'\nimport type { trpc } from '../trpc'\n\nexport interface RouterAppContext {\n  trpc: typeof trpc\n}\n\nexport const Route = createRootRouteWithContext<RouterAppContext>()({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  const isFetching = useRouterState({ select: (s) => s.isLoading })\n\n  return (\n    <>\n      <div class={`min-h-screen flex flex-col`}>\n        <div class={`flex items-center border-b gap-2`}>\n          <h1 class={`text-3xl p-2`}>With tRPC</h1>\n          {/* Show a global spinner when the router is transitioning */}\n          <div\n            class={`text-3xl duration-300 delay-0 opacity-0 ${\n              isFetching() ? ` duration-1000 opacity-40` : ''\n            }`}\n          >\n            <Spinner />\n          </div>\n        </div>\n        <div class={`flex-1 flex`}>\n          <div class={`divide-y w-56`}>\n            {(\n              [\n                ['/', 'Home'],\n                ['/dashboard', 'Dashboard'],\n              ] as const\n            ).map(([to, label]) => {\n              return (\n                <div>\n                  <Link\n                    to={to}\n                    activeOptions={\n                      {\n                        // If the route points to the root of it's parent,\n                        // make sure it's only active if it's exact\n                        // exact: to === '.',\n                      }\n                    }\n                    preload=\"intent\"\n                    class={`block py-2 px-3 text-blue-700`}\n                    // Make \"active\" links bold\n                    activeProps={{ class: `font-bold` }}\n                  >\n                    {label}\n                  </Link>\n                </div>\n              )\n            })}\n          </div>\n          <div class={`flex-1 border-l border-gray-200`}>\n            {/* Render our first route match */}\n            <Outlet />\n          </div>\n        </div>\n      </div>\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routes/dashboard.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dashboard/')({\n  loader: ({ context: { trpc } }) => trpc.posts.query(),\n  component: DashboardIndexComponent,\n})\n\nfunction DashboardIndexComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2\">\n      <div class=\"p-2\">\n        Welcome to the dashboard! You have{' '}\n        <strong>{posts().length} total posts</strong>.\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routes/dashboard.posts.$postId.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { Link, createFileRoute } from '@tanstack/solid-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/dashboard/posts/$postId')({\n  validateSearch: z.object({\n    showNotes: z.boolean().optional(),\n    notes: z.string().optional(),\n  }),\n  loader: async ({\n    context: { trpc },\n    params: { postId },\n  }): Promise<{ id: string; title: string } | undefined> =>\n    trpc.post.query(postId),\n  component: DashboardPostsPostIdComponent,\n})\n\nfunction DashboardPostsPostIdComponent() {\n  const post = Route.useLoaderData()\n  const search = Route.useSearch()\n  const navigate = Route.useNavigate()\n\n  const [notes, setNotes] = Solid.createSignal(search().notes ?? ``)\n\n  Solid.createEffect(\n    Solid.on(notes, () => {\n      navigate({\n        search: (old) => ({ ...old, notes: notes() ? notes() : undefined }),\n        replace: true,\n        params: true,\n      })\n    }),\n  )\n\n  if (!post()) {\n    return <div>Post not found</div>\n  }\n\n  return (\n    <div class=\"p-2 space-y-2\">\n      <div class=\"space-y-2\">\n        <h2 class=\"font-bold text-lg\">\n          <input\n            value={post()?.id}\n            class=\"border border-opacity-50 rounded-sm p-2 w-full\"\n            disabled\n          />\n        </h2>\n        <div>\n          <textarea\n            value={post()?.title}\n            rows={6}\n            class=\"border border-opacity-50 p-2 rounded-sm w-full\"\n            disabled\n          />\n        </div>\n      </div>\n      <div>\n        <Link\n          from={Route.fullPath}\n          search={(old) => ({\n            ...old,\n            showNotes: old.showNotes ? undefined : true,\n          })}\n          params={true}\n          class=\"text-blue-700\"\n        >\n          {search().showNotes ? 'Close Notes' : 'Show Notes'}{' '}\n        </Link>\n        {search().showNotes ? (\n          <>\n            <div>\n              <div class=\"h-2\" />\n              <textarea\n                value={notes()}\n                onChange={(e) => setNotes(e.target.value)}\n                rows={5}\n                class=\"shadow-sm w-full p-2 rounded-sm\"\n                placeholder=\"Write some notes here...\"\n              />\n              <div class=\"italic text-xs\">\n                Notes are stored in the URL. Try copying the URL into a new tab!\n              </div>\n            </div>\n          </>\n        ) : null}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routes/dashboard.posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dashboard/posts/')({\n  component: DashboardPostsIndexComponent,\n})\n\nfunction DashboardPostsIndexComponent() {\n  return <div class=\"p-2\">Select a post to view.</div>\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routes/dashboard.posts.tsx",
    "content": "import * as Solid from 'solid-js'\nimport {\n  Link,\n  MatchRoute,\n  Outlet,\n  createFileRoute,\n} from '@tanstack/solid-router'\n\nimport { Spinner } from './-components/spinner'\n\nexport const Route = createFileRoute('/dashboard/posts')({\n  loader: ({ context: { trpc } }) => trpc.posts.query(),\n  component: DashboardPostsComponent,\n})\n\nfunction DashboardPostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"flex-1 flex\">\n      <div class=\"divide-y w-48\">\n        <Solid.For each={posts()}>\n          {(post) => {\n            return (\n              <div>\n                <Link\n                  to=\"/dashboard/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  preload=\"intent\"\n                  class=\"block py-2 px-3 text-blue-700\"\n                  activeProps={{ class: `font-bold` }}\n                >\n                  <pre class=\"text-sm\">\n                    #{post.id} - {post.title.slice(0, 10)}{' '}\n                    <MatchRoute\n                      to=\"/dashboard/posts/$postId\"\n                      params={{\n                        postId: post.id,\n                      }}\n                      pending\n                    >\n                      {(match) => <Spinner show={!!match} wait=\"delay-50\" />}\n                    </MatchRoute>\n                  </pre>\n                </Link>\n              </div>\n            )\n          }}\n        </Solid.For>\n      </div>\n      <div class=\"flex-1 border-l border-gray-200\">\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routes/dashboard.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  return (\n    <>\n      <div class=\"flex items-center border-b\">\n        <h2 class=\"text-xl p-2\">Dashboard</h2>\n        <Link\n          to=\"/dashboard/posts/$postId\"\n          params={{\n            postId: '3',\n          }}\n          class=\"py-1 px-2 text-xs bg-blue-500 text-white rounded-full\"\n        >\n          1 New Invoice\n        </Link>\n      </div>\n      <div class=\"flex flex-wrap divide-x\">\n        {(\n          [\n            ['.', 'Summary'],\n            ['/dashboard/posts', 'Posts'],\n          ] as const\n        ).map(([to, label]) => {\n          return (\n            <Link\n              from={Route.fullPath}\n              to={to}\n              activeOptions={{ exact: to === '.' }}\n              activeProps={{ class: `font-bold` }}\n              class=\"p-2\"\n            >\n              {label}\n            </Link>\n          )\n        })}\n      </div>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/routes/index.tsx",
    "content": "import { Link, createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class={`p-2`}>\n      <div class={`text-lg`}>Welcome Home!</div>\n      <hr class={`my-2`} />\n      <Link\n        to=\"/dashboard/posts/$postId\"\n        params={{\n          postId: '3',\n        }}\n        class={`py-1 px-2 text-xs bg-blue-500 text-white rounded-full`}\n      >\n        1 New Invoice\n      </Link>\n      <hr class={`my-2`} />\n      <div class={`max-w-xl`}>\n        As you navigate around take note of the UX. It should feel\n        suspense-like, where routes are only rendered once all of their data and\n        elements are ready.\n        <hr class={`my-2`} />\n        To exaggerate async effects, play with the artificial request delay\n        slider in the bottom-left corner.\n        <hr class={`my-2`} />\n        The last 2 sliders determine if link-hover preloading is enabled (and\n        how long those preloads stick around) and also whether to cache rendered\n        route data (and for how long). Both of these default to 0 (or off).\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/server/server.ts",
    "content": "import path from 'node:path'\nimport url from 'node:url'\nimport * as fs from 'node:fs'\nimport express from 'express'\nimport { trpcMiddleWare } from './trpc'\n\nconst PORT =\n  typeof process.env.PORT !== 'undefined'\n    ? parseInt(process.env.PORT, 10)\n    : 3000\nconst HMR_PORT =\n  typeof process.env.HMR_PORT !== 'undefined'\n    ? parseInt(process.env.HMR_PORT, 10)\n    : 3001\n\nconst isTest = process.env.NODE_ENV === 'test' || !!process.env.VITE_TEST_BUILD\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\nexport const createServer = async (\n  root = process.cwd(),\n  isProd = process.env.NODE_ENV === 'production',\n) => {\n  const app = express()\n\n  app.use('/trpc', trpcMiddleWare as any)\n\n  if (!isProd) {\n    const vite = await import('vite')\n    const viteServer = await vite.createServer({\n      root,\n      logLevel: isTest ? 'error' : 'info',\n      server: {\n        middlewareMode: true,\n        watch: {\n          // During tests we edit the files too fast and sometimes chokidar\n          // misses change events, so enforce polling for consistency\n          usePolling: true,\n          interval: 100,\n        },\n        hmr: {\n          port: HMR_PORT,\n        },\n      },\n      appType: 'custom',\n    })\n\n    // Use vite's connect instance as middleware\n    app.use(viteServer.middlewares)\n\n    // Handle any requests that don't match an API route by serving the React app's index.html\n    app.get('*', async (req, res, next) => {\n      try {\n        let html = fs.readFileSync(path.resolve(root, 'index.html'), 'utf-8')\n\n        // Transform HTML using Vite plugins.\n        html = await viteServer.transformIndexHtml(req.url, html)\n\n        res.send(html)\n      } catch (e) {\n        return next(e)\n      }\n    })\n\n    return { app }\n  } else {\n    app.use(express.static(path.resolve(__dirname, '../client')))\n\n    // Handle any requests that don't match an API route by serving the React app's index.html\n    app.get('*', (req, res) => {\n      res.sendFile(path.resolve(__dirname, '../client', 'index.html'))\n    })\n  }\n\n  return { app }\n}\n\nif (!isTest) {\n  createServer().then(({ app }) =>\n    app.listen(PORT, () => {\n      console.info(`Server available at: http://localhost:${PORT}`)\n    }),\n  )\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/server/trpc.ts",
    "content": "import { initTRPC } from '@trpc/server'\nimport { createExpressMiddleware } from '@trpc/server/adapters/express'\nimport type { CreateExpressContextOptions } from '@trpc/server/adapters/express'\n\nconst createTRPContext = ({ req, res }: CreateExpressContextOptions) => ({})\n\ntype TRPCContext = Awaited<ReturnType<typeof createTRPContext>>\n\nconst t = initTRPC.context<TRPCContext>().create()\n\nconst POSTS = [\n  { id: '1', title: 'First post' },\n  { id: '2', title: 'Second post' },\n  { id: '3', title: 'Third post' },\n  { id: '4', title: 'Fourth post' },\n  { id: '5', title: 'Fifth post' },\n  { id: '6', title: 'Sixth post' },\n  { id: '7', title: 'Seventh post' },\n  { id: '8', title: 'Eighth post' },\n  { id: '9', title: 'Ninth post' },\n  { id: '10', title: 'Tenth post' },\n]\n\nexport const appRouter = t.router({\n  hello: t.procedure.query(() => 'Hello world!'),\n  posts: t.procedure.query(async (_) => {\n    await new Promise((resolve) => setTimeout(resolve, 1000))\n    return POSTS\n  }),\n  post: t.procedure.input(String).query(async (req) => {\n    await new Promise((resolve) => setTimeout(resolve, 500))\n    return POSTS.find((p) => p.id === req.input)\n  }),\n})\n\nexport const trpcMiddleWare = createExpressMiddleware({\n  router: appRouter,\n  createContext: createTRPContext,\n})\n\nexport type AppRouter = typeof appRouter\n"
  },
  {
    "path": "examples/solid/with-trpc/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/src/trpc.ts",
    "content": "import { createTRPCClient, httpBatchLink } from '@trpc/client'\nimport type { AppRouter } from './server/trpc'\n\nexport const trpc = createTRPCClient<AppRouter>({\n  links: [\n    httpBatchLink({\n      // since we are using Vite, the server is running on the same port,\n      // this means in dev the url is `http://localhost:3000/trpc`\n      // and since its from the same origin, we don't need to explicitly set the full URL\n      url: '/trpc',\n    }),\n  ],\n})\n"
  },
  {
    "path": "examples/solid/with-trpc/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\",\n    \"target\": \"ES2022\",\n    \"module\": \"ES2022\",\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"types\": [\"node\", \"vite/client\"]\n  },\n  \"include\": [\"src\", \"vite.config.ts\", \"tsup.config.ts\"]\n}\n"
  },
  {
    "path": "examples/solid/with-trpc/vite.config.ts",
    "content": "import url from 'node:url'\nimport path from 'node:path'\nimport { defineConfig } from 'vite'\nimport solid from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport type { BuildEnvironmentOptions } from 'vite'\nimport tailwindcss from '@tailwindcss/vite'\n\nconst __filename = url.fileURLToPath(import.meta.url)\nconst __dirname = path.dirname(__filename)\n\n// Client Build Configuration\nconst clientBuildConfig: BuildEnvironmentOptions = {\n  outDir: 'dist/client',\n  emitAssets: true,\n  copyPublicDir: true,\n  emptyOutDir: true,\n}\n\n// Server Build Configuration\nconst serverBuildConfig: BuildEnvironmentOptions = {\n  ssr: true,\n  outDir: 'dist/server',\n  copyPublicDir: false,\n  emptyOutDir: true,\n  rolldownOptions: {\n    input: path.resolve(__dirname, 'src/server/server.ts'),\n    output: {\n      entryFileNames: '[name].js',\n      chunkFileNames: 'assets/[name]-[hash].js',\n      assetFileNames: 'assets/[name]-[hash][extname]',\n    },\n  },\n}\n\n// https://vitejs.dev/config/\nexport default defineConfig((configEnv) => {\n  return {\n    plugins: [\n      tailwindcss(),\n      tanstackRouter({\n        target: 'solid',\n        autoCodeSplitting: true,\n      }),\n      solid(),\n    ],\n    build: configEnv.mode === 'server' ? serverBuildConfig : clientBuildConfig,\n  }\n})\n"
  },
  {
    "path": "examples/vue/basic/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/vue/basic/.gitignore",
    "content": "node_modules\n.DS_Store\ndist\ndist-ssr\n*.local\n\n/test-results/\n/playwright-report/\n/blob-report/\n/playwright/.cache/"
  },
  {
    "path": "examples/vue/basic/README.md",
    "content": "# Example\n\nTo run this example:\n\n- `npm install` or `yarn`\n- `npm start` or `yarn start`\n"
  },
  {
    "path": "examples/vue/basic/eslint.config.js",
    "content": "import js from '@eslint/js'\nimport typescript from '@typescript-eslint/eslint-plugin'\nimport typescriptParser from '@typescript-eslint/parser'\nimport vue from 'eslint-plugin-vue'\nimport vueParser from 'vue-eslint-parser'\n\nexport default [\n  js.configs.recommended,\n  ...vue.configs['flat/recommended'],\n  {\n    files: ['**/*.{js,jsx,ts,tsx,vue}'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n        ecmaVersion: 'latest',\n        sourceType: 'module',\n        ecmaFeatures: {\n          jsx: true,\n        },\n      },\n    },\n    plugins: {\n      '@typescript-eslint': typescript,\n      vue,\n    },\n    rules: {\n      // Vue specific rules\n      'vue/multi-word-component-names': 'off',\n      'vue/no-unused-vars': 'error',\n\n      // TypeScript rules\n      '@typescript-eslint/no-unused-vars': 'error',\n      '@typescript-eslint/no-explicit-any': 'warn',\n\n      // General rules\n      'no-unused-vars': 'off', // Let TypeScript handle this\n    },\n  },\n  {\n    files: ['**/*.vue'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n      },\n    },\n  },\n]\n"
  },
  {
    "path": "examples/vue/basic/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite App</title>\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/vue/basic/package.json",
    "content": "{\n  \"name\": \"tanstack-router-vue-example-basic-jsx\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port=3000\",\n    \"build\": \"vite build && vue-tsc --noEmit\",\n    \"serve\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tanstack/vue-router\": \"^1.168.1\",\n    \"@tanstack/vue-router-devtools\": \"^1.166.10\",\n    \"redaxios\": \"^0.5.1\",\n    \"vue\": \"^3.5.13\",\n    \"tailwindcss\": \"4.1.18\"\n  },\n  \"devDependencies\": {\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"@tailwindcss/vite\": \"^4.2.2\"\n  }\n}\n"
  },
  {
    "path": "examples/vue/basic/src/components/VueLogo.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, computed } from 'vue'\n\nconst props = withDefaults(\n  defineProps<{\n    /**\n     * Accepts any valid CSS color value as a string.\n     * Note: TypeScript cannot strictly check for all valid CSS colors at type level.\n     * For runtime validation, you could use a library or custom validator if desired.\n     */\n    textColor?: string\n  }>(),\n  {\n    textColor: 'gray',\n  },\n)\n\nconst count = ref(0)\n\nconst countLabel = computed(() => {\n  if (count.value === 0) return 'Click the logo!'\n  if (count.value === 1) return '1 click'\n  return `${count.value} clicks`\n})\n\nfunction increment() {\n  count.value++\n}\n\nfunction reset() {\n  count.value = 0\n}\n</script>\n\n<template>\n  <div class=\"vue-logo-container\">\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 261.76 226.69\"\n      class=\"vue-logo\"\n      @click=\"increment\"\n    >\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H-.005L130.872 226.69 261.749 0z\"\n        fill=\"#41b883\"\n      />\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H52.346l78.526 136.01L209.398.001z\"\n        fill=\"#34495e\"\n      />\n    </svg>\n    <p class=\"count-label\" :style=\"{ color: props.textColor }\">\n      {{ countLabel }}\n    </p>\n    <button v-if=\"count > 0\" class=\"reset-btn\" @click=\"reset\">Reset</button>\n  </div>\n</template>\n\n<style scoped>\n.vue-logo-container {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5rem;\n  margin: 1rem 0;\n}\n\n.vue-logo {\n  width: 64px;\n  height: 64px;\n  cursor: pointer;\n  transition: transform 0.2s ease;\n}\n\n.vue-logo:hover {\n  transform: scale(1.1);\n}\n\n.vue-logo:active {\n  transform: scale(0.95);\n}\n\n.count-label {\n  margin: 0;\n  font-size: 0.875rem;\n  color: #666;\n}\n\n.reset-btn {\n  padding: 0.25rem 0.5rem;\n  font-size: 0.75rem;\n  background: #41b883;\n  color: white;\n  border: none;\n  border-radius: 4px;\n  cursor: pointer;\n}\n\n.reset-btn:hover {\n  background: #34495e;\n}\n</style>\n"
  },
  {
    "path": "examples/vue/basic/src/main.tsx",
    "content": "import { createApp } from 'vue'\nimport {\n  ErrorComponent,\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport { NotFoundError, fetchPost, fetchPosts } from './posts'\nimport VueLogo from './components/VueLogo.vue'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\nimport './styles.css'\n\nconst rootRoute = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <p>This is the notFoundComponent configured on root route</p>\n        <Link to=\"/\">Start Over</Link>\n      </div>\n    )\n  },\n})\n\nfunction RootComponent() {\n  return (\n    <>\n      <div class=\"p-2 flex gap-2 text-lg border-b\">\n        <Link\n          to=\"/\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>{' '}\n        <Link\n          to=\"/posts\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Posts\n        </Link>{' '}\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Pathless Layout\n        </Link>{' '}\n        <Link\n          // @ts-expect-error\n          to=\"/this-route-does-not-exist\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <Outlet />\n\n      <TanStackRouterDevtools router={router} position=\"bottom-right\" />\n    </>\n  )\n}\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <VueLogo textColor=\"orange\" />\n    </div>\n  )\n}\n\nexport const postsLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n  loader: () => fetchPosts(),\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '/',\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div>Select a post.</div>\n}\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsLayoutRoute,\n  path: '$postId',\n  errorComponent: PostErrorComponent,\n  loader: ({ params }) => fetchPost(params.postId),\n  component: PostComponent,\n})\n\nfunction PostErrorComponent({ error }: ErrorComponentProps) {\n  if (error instanceof NotFoundError) {\n    return <div>{error.message}</div>\n  }\n\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = postRoute.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold\">{post.value.title}</h4>\n      <hr class=\"opacity-20\" />\n      <div class=\"text-sm\">{post.value.body}</div>\n    </div>\n  )\n}\n\nconst pathlessLayoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_pathlessLayout',\n  component: PathlessLayoutComponent,\n})\n\nfunction PathlessLayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a pathless layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst nestedPathlessLayout2Route = createRoute({\n  getParentRoute: () => pathlessLayoutRoute,\n  id: '_nestedPathlessLayout',\n  component: PathlessLayout2Component,\n})\n\nfunction PathlessLayout2Component() {\n  return (\n    <div>\n      <div>I'm a nested pathless layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link\n          to=\"/route-a\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to Route A\n        </Link>\n        <Link\n          to=\"/route-b\"\n          activeProps={{\n            class: 'font-bold',\n          }}\n        >\n          Go to Route B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n\nconst pathlessLayoutARoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-a',\n  component: PathlessLayoutAComponent,\n})\n\nfunction PathlessLayoutAComponent() {\n  return <div>I'm route A!</div>\n}\n\nconst pathlessLayoutBRoute = createRoute({\n  getParentRoute: () => nestedPathlessLayout2Route,\n  path: '/route-b',\n  component: PathlessLayoutBComponent,\n})\n\nfunction PathlessLayoutBComponent() {\n  return <div>I'm route B!</div>\n}\n\nconst routeTree = rootRoute.addChildren([\n  postsLayoutRoute.addChildren([postRoute, postsIndexRoute]),\n  pathlessLayoutRoute.addChildren([\n    nestedPathlessLayout2Route.addChildren([\n      pathlessLayoutARoute,\n      pathlessLayoutBRoute,\n    ]),\n  ]),\n  indexRoute,\n])\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "examples/vue/basic/src/posts.lazy.tsx",
    "content": "import { Link, Outlet, createLazyRoute } from '@tanstack/vue-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsLayoutComponent,\n})\n\nfunction PostsLayoutComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...posts.value,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => {\n          return (\n            <li class=\"whitespace-nowrap\">\n              <Link\n                to=\"/posts/$postId\"\n                params={{\n                  postId: post.id,\n                }}\n                class=\"block py-1 px-2 text-blue-600 hover:opacity-75\"\n                activeProps={{ class: 'font-bold underline' }}\n              >\n                <div>{post.title.substring(0, 20)}</div>\n              </Link>\n            </li>\n          )\n        })}\n      </ul>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic/src/posts.ts",
    "content": "import axios from 'redaxios'\n\nexport class NotFoundError extends Error {}\n\ntype PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>('https://jsonplaceholder.typicode.com/posts')\n    .then((r) => r.data.slice(0, 10))\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`https://jsonplaceholder.typicode.com/posts/${postId}`)\n    .then((r) => r.data)\n\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (!post) {\n    throw new NotFoundError(`Post with id \"${postId}\" not found!`)\n  }\n\n  return post\n}\n"
  },
  {
    "path": "examples/vue/basic/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{ts,tsx,vue}';\n\n/*\n  The default border color has changed to `currentcolor` in Tailwind CSS v4,\n  so we've added these compatibility styles to make sure everything still\n  looks the same as it did with Tailwind CSS v3.\n\n  If we ever want to remove these styles, we need to add an explicit border\n  color utility to any element that depends on these defaults.\n*/\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/vue/basic/tsconfig.dev.json",
    "content": "{\n  \"composite\": true,\n  \"extends\": \"../../../tsconfig.base.json\",\n\n  \"files\": [\"src/main.tsx\"],\n  \"include\": [\n    \"src\"\n    // \"__tests__/**/*.test.*\"\n  ]\n}\n"
  },
  {
    "path": "examples/vue/basic/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"target\": \"ESNext\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"DOM\", \"DOM.Iterable\", \"ES2022\"],\n    \"skipLibCheck\": true\n  }\n}\n"
  },
  {
    "path": "examples/vue/basic/vite.config.js",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [tailwindcss(), vue(), vueJsx()],\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/eslint.config.js",
    "content": "import js from '@eslint/js'\nimport typescript from '@typescript-eslint/eslint-plugin'\nimport typescriptParser from '@typescript-eslint/parser'\nimport vue from 'eslint-plugin-vue'\nimport vueParser from 'vue-eslint-parser'\n\nexport default [\n  js.configs.recommended,\n  ...vue.configs['flat/recommended'],\n  {\n    files: ['**/*.{js,jsx,ts,tsx,vue}'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n        ecmaVersion: 'latest',\n        sourceType: 'module',\n        ecmaFeatures: {\n          jsx: true,\n        },\n      },\n    },\n    plugins: {\n      '@typescript-eslint': typescript,\n      vue,\n    },\n    rules: {\n      // Vue specific rules\n      'vue/multi-word-component-names': 'off',\n      'vue/no-unused-vars': 'error',\n\n      // TypeScript rules\n      '@typescript-eslint/no-unused-vars': 'error',\n      '@typescript-eslint/no-explicit-any': 'warn',\n\n      // General rules\n      'no-unused-vars': 'off', // Let TypeScript handle this\n    },\n  },\n  {\n    files: ['**/*.vue'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n      },\n    },\n  },\n]\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/package.json",
    "content": "{\n  \"name\": \"tanstack-router-vue-example-basic-file-based-jsx\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && vue-tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/vue-router\": \"^1.168.1\",\n    \"@tanstack/vue-router-devtools\": \"^1.166.10\",\n    \"@tanstack/zod-adapter\": \"^1.166.9\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@eslint/js\": \"^9.36.0\",\n    \"@typescript-eslint/eslint-plugin\": \"^8.44.1\",\n    \"@typescript-eslint/parser\": \"^8.44.1\",\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"eslint-plugin-vue\": \"^9.33.0\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-eslint-parser\": \"^9.4.3\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/components/EditingAComponent.tsx",
    "content": "import { ref, defineComponent } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nexport const EditingAComponent = defineComponent({\n  setup() {\n    const navigate = useNavigate()\n    const input = ref('')\n\n    const blocker = useBlocker({\n      shouldBlockFn: ({ next }) => {\n        if (next.fullPath === '/editing-b' && input.value.length > 0) {\n          return true\n        }\n        return false\n      },\n      withResolver: true,\n    })\n\n    return () => (\n      <div>\n        <h1>Editing A</h1>\n        <label>\n          Enter your name:\n          <input\n            name=\"input\"\n            value={input.value}\n            onInput={(e) =>\n              (input.value = (e.target as HTMLInputElement).value)\n            }\n          />\n        </label>\n        <button onClick={() => navigate({ to: '/editing-b' })}>\n          Go to next step\n        </button>\n        {blocker.value.status === 'blocked' && (\n          <button onClick={() => blocker.value.proceed?.()}>Proceed</button>\n        )}\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/components/EditingBComponent.tsx",
    "content": "import { ref, toValue, defineComponent } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nexport const EditingBComponent = defineComponent({\n  setup() {\n    const navigate = useNavigate()\n    const input = ref('')\n\n    const blocker = useBlocker({\n      shouldBlockFn: () => !!toValue(input),\n      withResolver: true,\n    })\n\n    return () => (\n      <div>\n        <h1>Editing B</h1>\n        <label>\n          Enter your name:\n          <input\n            name=\"input\"\n            value={input.value}\n            onInput={(e) =>\n              (input.value = (e.target as HTMLInputElement).value)\n            }\n          />\n        </label>\n        <button onClick={() => navigate({ to: '/editing-a' })}>Go back</button>\n        {blocker.value.status === 'blocked' && (\n          <button onClick={() => blocker.value.proceed?.()}>Proceed</button>\n        )}\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/components/NotFoundComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <p>This is the notFoundComponent configured on root route</p>\n    <Link to=\"/\">Start Over</Link>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/components/NotRemountDepsComponent.tsx",
    "content": "import { ref, onMounted, defineComponent } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\nexport const NotRemountDepsComponent = defineComponent({\n  setup() {\n    // Component-scoped ref - will be recreated on component remount\n    const mounts = ref(0)\n    const search = useSearch({ from: '/notRemountDeps' })\n    const navigate = useNavigate()\n\n    onMounted(() => {\n      mounts.value++\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <button\n          onClick={() =>\n            navigate({\n              to: '/notRemountDeps',\n              search: {\n                searchParam: Math.random().toString(36).substring(2, 8),\n              },\n            })\n          }\n        >\n          Regenerate search param\n        </button>\n\n        <div>Search: {search.value.searchParam}</div>\n        <div data-testid=\"component-mounts\">\n          Page component mounts: {mounts.value}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/components/PostErrorComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { ErrorComponent } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\ndefineProps<ErrorComponentProps>()\n</script>\n\n<template>\n  <ErrorComponent :error=\"error\" />\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/components/RemountDepsComponent.tsx",
    "content": "import { ref, onMounted, defineComponent } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\n// Module-scoped ref to persist across component remounts\nconst mounts = ref(0)\n\nexport const RemountDepsComponent = defineComponent({\n  setup() {\n    const search = useSearch({ from: '/remountDeps' })\n    const navigate = useNavigate()\n\n    onMounted(() => {\n      mounts.value++\n    })\n\n    return () => (\n      <div class=\"p-2\">\n        <button\n          onClick={() =>\n            navigate({\n              to: '/remountDeps',\n              search: {\n                searchParam: Math.random().toString(36).substring(2, 8),\n              },\n            })\n          }\n        >\n          Regenerate search param\n        </button>\n\n        <div>Search: {search.value.searchParam}</div>\n        <div data-testid=\"component-mounts\">\n          Page component mounts: {mounts.value}\n        </div>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/components/VueLogo.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, computed } from 'vue'\n\nconst props = withDefaults(\n  defineProps<{\n    /**\n     * Accepts any valid CSS color value as a string.\n     * Note: TypeScript cannot strictly check for all valid CSS colors at type level.\n     * For runtime validation, you could use a library or custom validator if desired.\n     */\n    textColor?: string\n  }>(),\n  {\n    textColor: 'gray',\n  },\n)\n\nconst count = ref(0)\n\nconst countLabel = computed(() => {\n  if (count.value === 0) return 'Click the logo!'\n  if (count.value === 1) return '1 click'\n  return `${count.value} clicks`\n})\n\nfunction increment() {\n  count.value++\n}\n\nfunction reset() {\n  count.value = 0\n}\n</script>\n\n<template>\n  <div class=\"vue-logo-container\">\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 261.76 226.69\"\n      class=\"vue-logo\"\n      @click=\"increment\"\n    >\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H-.005L130.872 226.69 261.749 0z\"\n        fill=\"#41b883\"\n      />\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H52.346l78.526 136.01L209.398.001z\"\n        fill=\"#34495e\"\n      />\n    </svg>\n    <p class=\"count-label\" :style=\"{ color: props.textColor }\">\n      {{ countLabel }}\n    </p>\n    <button v-if=\"count > 0\" class=\"reset-btn\" @click=\"reset\">Reset</button>\n  </div>\n</template>\n\n<style scoped>\n.vue-logo-container {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5rem;\n  margin: 1rem 0;\n}\n\n.vue-logo {\n  width: 64px;\n  height: 64px;\n  cursor: pointer;\n  transition: transform 0.2s ease;\n}\n\n.vue-logo:hover {\n  transform: scale(1.1);\n}\n\n.vue-logo:active {\n  transform: scale(0.95);\n}\n\n.count-label {\n  margin: 0;\n  font-size: 0.875rem;\n  color: #666;\n}\n\n.reset-btn {\n  padding: 0.25rem 0.5rem;\n  font-size: 0.75rem;\n  background: #41b883;\n  color: white;\n  border: none;\n  border-radius: 4px;\n  cursor: pointer;\n}\n\n.reset-btn:hover {\n  background: #34495e;\n}\n</style>\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/main.tsx",
    "content": "import { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\nimport { createApp } from 'vue'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  createApp({\n    setup() {\n      return () => <RouterProvider router={router} />\n    },\n  }).mount('#app')\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/posts.tsx",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { lazyRouteComponent } from '@tanstack/vue-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as Char45824Char54620Char48124Char44397RouteImport } from './routes/대한민국'\nimport { Route as SfcComponentRouteImport } from './routes/sfcComponent'\nimport { Route as RemountDepsRouteImport } from './routes/remountDeps'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'\nimport { Route as EditingBRouteImport } from './routes/editing-b'\nimport { Route as EditingARouteImport } from './routes/editing-a'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'\nimport { Route as groupInsideRouteImport } from './routes/(group)/inside'\nimport { Route as groupLayoutRouteImport } from './routes/(group)/_layout'\nimport { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside'\nimport { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside'\nimport { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout'\n\nconst Char45824Char54620Char48124Char44397Route =\n  Char45824Char54620Char48124Char44397RouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst SfcComponentRoute = SfcComponentRouteImport.update({\n  id: '/sfcComponent',\n  path: '/sfcComponent',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/sfcComponent.component.vue'),\n    'default',\n  ),\n})\nconst RemountDepsRoute = RemountDepsRouteImport.update({\n  id: '/remountDeps',\n  path: '/remountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NotRemountDepsRoute = NotRemountDepsRouteImport.update({\n  id: '/notRemountDeps',\n  path: '/notRemountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingBRoute = EditingBRouteImport.update({\n  id: '/editing-b',\n  path: '/editing-b',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst EditingARoute = EditingARouteImport.update({\n  id: '/editing-a',\n  path: '/editing-a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any)\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any)\nconst groupLazyinsideRoute = groupLazyinsideRouteImport.update({\n  id: '/(group)/lazyinside',\n  path: '/lazyinside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupInsideRoute = groupInsideRouteImport.update({\n  id: '/(group)/inside',\n  path: '/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutRoute = groupLayoutRouteImport.update({\n  id: '/(group)/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst anotherGroupOnlyrouteinsideRoute =\n  anotherGroupOnlyrouteinsideRouteImport.update({\n    id: '/(another-group)/onlyrouteinside',\n    path: '/onlyrouteinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({\n  id: '/posts_/$postId/edit',\n  path: '/posts/$postId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any)\nconst groupSubfolderInsideRoute = groupSubfolderInsideRouteImport.update({\n  id: '/(group)/subfolder/inside',\n  path: '/subfolder/inside',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({\n  id: '/insidelayout',\n  path: '/insidelayout',\n  getParentRoute: () => groupLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/sfcComponent': typeof SfcComponentRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/inside': typeof groupInsideRoute\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts_/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/sfcComponent'\n    | '/대한민국'\n    | '/(another-group)/onlyrouteinside'\n    | '/(group)/_layout'\n    | '/(group)/inside'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/(group)/_layout/insidelayout'\n    | '/(group)/subfolder/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/posts_/$postId/edit'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  EditingARoute: typeof EditingARoute\n  EditingBRoute: typeof EditingBRoute\n  NotRemountDepsRoute: typeof NotRemountDepsRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RemountDepsRoute: typeof RemountDepsRoute\n  SfcComponentRoute: typeof SfcComponentRoute\n  Char45824Char54620Char48124Char44397Route: typeof Char45824Char54620Char48124Char44397Route\n  anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupInsideRoute: typeof groupInsideRoute\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n  groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute\n  PostsPostIdEditRoute: typeof PostsPostIdEditRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/대한민국': {\n      id: '/대한민국'\n      path: '/대한민국'\n      fullPath: '/대한민국'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/sfcComponent': {\n      id: '/sfcComponent'\n      path: '/sfcComponent'\n      fullPath: '/sfcComponent'\n      preLoaderRoute: typeof SfcComponentRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/remountDeps': {\n      id: '/remountDeps'\n      path: '/remountDeps'\n      fullPath: '/remountDeps'\n      preLoaderRoute: typeof RemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/notRemountDeps': {\n      id: '/notRemountDeps'\n      path: '/notRemountDeps'\n      fullPath: '/notRemountDeps'\n      preLoaderRoute: typeof NotRemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-b': {\n      id: '/editing-b'\n      path: '/editing-b'\n      fullPath: '/editing-b'\n      preLoaderRoute: typeof EditingBRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-a': {\n      id: '/editing-a'\n      path: '/editing-a'\n      fullPath: '/editing-a'\n      preLoaderRoute: typeof EditingARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/inside': {\n      id: '/(group)/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(another-group)/onlyrouteinside': {\n      id: '/(another-group)/onlyrouteinside'\n      path: '/onlyrouteinside'\n      fullPath: '/onlyrouteinside'\n      preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/edit': {\n      id: '/posts_/$postId/edit'\n      path: '/posts/$postId/edit'\n      fullPath: '/posts/$postId/edit'\n      preLoaderRoute: typeof PostsPostIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/(group)/subfolder/inside': {\n      id: '/(group)/subfolder/inside'\n      path: '/subfolder/inside'\n      fullPath: '/subfolder/inside'\n      preLoaderRoute: typeof groupSubfolderInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout/insidelayout': {\n      id: '/(group)/_layout/insidelayout'\n      path: '/insidelayout'\n      fullPath: '/insidelayout'\n      preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport\n      parentRoute: typeof groupLayoutRoute\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  EditingARoute: EditingARoute,\n  EditingBRoute: EditingBRoute,\n  NotRemountDepsRoute: NotRemountDepsRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RemountDepsRoute: RemountDepsRoute,\n  SfcComponentRoute: SfcComponentRoute,\n  Char45824Char54620Char48124Char44397Route:\n    Char45824Char54620Char48124Char44397Route,\n  anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupInsideRoute: groupInsideRoute,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n  groupSubfolderInsideRoute: groupSubfolderInsideRoute,\n  PostsPostIdEditRoute: PostsPostIdEditRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/(another-group)/onlyrouteinside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(another-group)/onlyrouteinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: OnlyRouteInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(another-group)/onlyrouteinside')\n\nfunction OnlyRouteInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(another-group)/onlyrouteinside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/(group)/_layout.insidelayout.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/_layout/insidelayout')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: InsideLayoutComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/_layout/insidelayout')\n\nfunction InsideLayoutComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/(group)/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({\n  component: GroupLayoutComponent,\n})\n\nfunction GroupLayoutComponent() {\n  return (\n    <div>\n      <div>Layout inside group</div>\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/(group)/inside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: InsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/inside')\n\nfunction InsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/inside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/(group)/lazyinside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: LazyInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nfunction LazyInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/lazyinside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/(group)/subfolder/inside.tsx",
    "content": "import { createFileRoute, getRouteApi, useSearch } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/subfolder/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n  component: SubfolderInsideComponent,\n})\n\nconst routeApi = getRouteApi('/(group)/subfolder/inside')\n\nfunction SubfolderInsideComponent() {\n  const searchViaHook = useSearch({ from: '/(group)/subfolder/inside' })\n  const searchViaRouteHook = routeApi.useSearch()\n  const searchViaRouteApi = routeApi.useSearch()\n\n  return (\n    <div>\n      <div data-testid=\"search-via-hook\">{searchViaHook.value.hello}</div>\n      <div data-testid=\"search-via-route-hook\">\n        {searchViaRouteHook.value.hello}\n      </div>\n      <div data-testid=\"search-via-route-api\">\n        {searchViaRouteApi.value.hello}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/__root.tsx",
    "content": "import {\n  HeadContent,\n  Link,\n  Outlet,\n  createRootRoute,\n  useCanGoBack,\n  useRouter,\n  useRouterState,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\nimport NotFoundComponent from '../components/NotFoundComponent.vue'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n  notFoundComponent: NotFoundComponent,\n})\n\nfunction RootComponent() {\n  const router = useRouter()\n  const canGoBack = useCanGoBack()\n  // test useRouterState doesn't crash client side navigation\n  const _state = useRouterState()\n\n  return (\n    <>\n      <HeadContent />\n      <div class=\"flex gap-2 p-2 text-lg border-b\">\n        <button\n          data-testid=\"back-button\"\n          disabled={!canGoBack.value}\n          onClick={() => router.history.back()}\n          class={!canGoBack.value ? 'line-through' : ''}\n        >\n          Back\n        </button>\n        <Link\n          to=\"/\"\n          activeProps={{ class: 'font-bold' }}\n          activeOptions={{ exact: true }}\n        >\n          Home\n        </Link>\n        <Link to=\"/posts\" activeProps={{ class: 'font-bold' }}>\n          Posts\n        </Link>\n        <Link to=\"/layout-a\" activeProps={{ class: 'font-bold' }}>\n          Layout\n        </Link>\n        <Link\n          to=\"/onlyrouteinside\"\n          data-testid=\"link-to-only-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Only Route Inside Group\n        </Link>\n        <Link\n          to=\"/inside\"\n          data-testid=\"link-to-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Group\n        </Link>\n        <Link\n          to=\"/subfolder/inside\"\n          data-testid=\"link-to-route-inside-group-inside-subfolder\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Subfolder Inside Group\n        </Link>\n        <Link\n          to=\"/insidelayout\"\n          data-testid=\"link-to-route-inside-group-inside-layout\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Inside Group Inside Layout\n        </Link>\n        <Link\n          to=\"/lazyinside\"\n          data-testid=\"link-to-lazy-route-inside-group\"\n          search={{ hello: 'world' }}\n          activeProps={{ class: 'font-bold' }}\n        >\n          Lazy Inside Group\n        </Link>\n        <Link to=\"/대한민국\" activeProps={{ class: 'font-bold' }}>\n          unicode path\n        </Link>\n        <Link\n          to={'/this-route-does-not-exist' as any}\n          activeProps={{ class: 'font-bold' }}\n        >\n          This Route Does Not Exist\n        </Link>\n      </div>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools position=\"bottom-right\" />\n    </>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/_layout/_layout-2/layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  component: LayoutAComponent,\n})\n\nfunction LayoutAComponent() {\n  return <div>I'm layout A!</div>\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/_layout/_layout-2/layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  component: LayoutBComponent,\n})\n\nfunction LayoutBComponent() {\n  return <div>I'm layout B!</div>\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/_layout/_layout-2.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  component: Layout2Component,\n})\n\nfunction Layout2Component() {\n  return (\n    <div>\n      <div>I'm a nested layout</div>\n      <div class=\"flex gap-2 border-b\">\n        <Link to=\"/layout-a\" activeProps={{ class: 'font-bold' }}>\n          Layout A\n        </Link>\n        <Link to=\"/layout-b\" activeProps={{ class: 'font-bold' }}>\n          Layout B\n        </Link>\n      </div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/_layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: LayoutComponent,\n})\n\nfunction LayoutComponent() {\n  return (\n    <div class=\"p-2\">\n      <div class=\"border-b\">I'm a layout</div>\n      <div>\n        <Outlet />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/editing-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { EditingAComponent } from '../components/EditingAComponent'\n\nexport const Route = createFileRoute('/editing-a')({\n  component: EditingAComponent,\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/editing-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { EditingBComponent } from '../components/EditingBComponent'\n\nexport const Route = createFileRoute('/editing-b')({\n  component: EditingBComponent,\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport VueLogo from '../components/VueLogo.vue'\n\nexport const Route = createFileRoute('/')({\n  component: IndexComponent,\n})\n\nfunction IndexComponent() {\n  return (\n    <div class=\"p-2\">\n      <h3>Welcome Home!</h3>\n      <VueLogo textColor=\"orange\" />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/notRemountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { NotRemountDepsComponent } from '../components/NotRemountDepsComponent'\n\nexport const Route = createFileRoute('/notRemountDeps')({\n  validateSearch: (search: Record<string, unknown>) => ({\n    searchParam: (search.searchParam as string) || '',\n  }),\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.params\n  },\n  component: NotRemountDepsComponent,\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport PostErrorComponent from '../components/PostErrorComponent.vue'\nimport { fetchPost } from '../posts'\nimport type { PostType } from '../posts'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  component: PostComponent,\n  errorComponent: PostErrorComponent,\n  notFoundComponent: () => <p>Post not found</p>,\n})\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div class=\"space-y-2\">\n      <h4 class=\"text-xl font-bold underline\" data-testid=\"post-title\">\n        {(post.value as PostType).title}\n      </h4>\n      <div class=\"text-sm\">{(post.value as PostType).body}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: PostsIndexComponent,\n})\n\nfunction PostsIndexComponent() {\n  return <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/posts.tsx",
    "content": "import { Link, Outlet, createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../posts'\nimport type { PostType } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div class=\"p-2 flex gap-2\" data-testid=\"posts-links\">\n      <ul class=\"list-disc pl-4\">\n        {[\n          ...(posts.value as Array<PostType>),\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ].map((post) => (\n          <li key={post.id} class=\"whitespace-nowrap\">\n            <Link\n              to=\"/posts/$postId\"\n              params={{ postId: post.id }}\n              class=\"block py-1 text-blue-600 hover:opacity-75\"\n              activeProps={{ class: 'font-bold underline' }}\n            >\n              <div>{post.title.substring(0, 20)}</div>\n            </Link>\n          </li>\n        ))}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/posts_.$postId.edit.tsx",
    "content": "import { createFileRoute, getRouteApi, useParams } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts_/$postId/edit')({\n  component: PostEditComponent,\n})\n\nconst api = getRouteApi('/posts_/$postId/edit')\n\nfunction PostEditComponent() {\n  const paramsViaApi = api.useParams()\n  const paramsViaHook = useParams({ from: '/posts_/$postId/edit' })\n  const paramsViaRouteHook = api.useParams()\n\n  return (\n    <div>\n      <div data-testid=\"params-via-hook\">{paramsViaHook.value.postId}</div>\n      <div data-testid=\"params-via-route-hook\">\n        {paramsViaRouteHook.value.postId}\n      </div>\n      <div data-testid=\"params-via-route-api\">{paramsViaApi.value.postId}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/remountDeps.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { RemountDepsComponent } from '../components/RemountDepsComponent'\n\nexport const Route = createFileRoute('/remountDeps')({\n  validateSearch: (search: Record<string, unknown>) => ({\n    searchParam: (search.searchParam as string) || '',\n  }),\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.search\n  },\n  component: RemountDepsComponent,\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/sfcComponent.component.vue",
    "content": "<script setup lang=\"ts\">\nimport VueLogo from '../components/VueLogo.vue'\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <h3>Vue SFC!</h3>\n    <VueLogo text-color=\"orange\" />\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/sfcComponent.tsx",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/sfcComponent')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Will be overwritten by the SFC component!</div>\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/routes/대한민국.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/대한민국')({\n  component: UnicodeComponent,\n})\n\nfunction UnicodeComponent() {\n  return (\n    <div>\n      <h3 class=\"pb-2\" data-testid=\"unicode-heading\">\n        Hello \"/대한민국\"!\n      </h3>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source './**/*.{ts,tsx,vue}';\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"strict\": true,\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"noEmit\": true,\n    \"resolveJsonModule\": true,\n    \"types\": [\"vite/client\"],\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\"\n  },\n  \"include\": [\"src/**/*\", \"src/**/*.vue\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-jsx/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/.devcontainer/devcontainer.json",
    "content": "{\n  \"image\": \"mcr.microsoft.com/devcontainers/typescript-node:24\"\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/eslint.config.js",
    "content": "import js from '@eslint/js'\nimport typescript from '@typescript-eslint/eslint-plugin'\nimport typescriptParser from '@typescript-eslint/parser'\nimport vue from 'eslint-plugin-vue'\nimport vueParser from 'vue-eslint-parser'\n\nexport default [\n  js.configs.recommended,\n  ...vue.configs['flat/recommended'],\n  {\n    files: ['**/*.{js,jsx,ts,tsx,vue}'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n        ecmaVersion: 'latest',\n        sourceType: 'module',\n        ecmaFeatures: {\n          jsx: true,\n        },\n      },\n    },\n    plugins: {\n      '@typescript-eslint': typescript,\n      vue,\n    },\n    rules: {\n      // Vue specific rules\n      'vue/multi-word-component-names': 'off',\n      'vue/no-unused-vars': 'error',\n\n      // TypeScript rules\n      '@typescript-eslint/no-unused-vars': 'error',\n      '@typescript-eslint/no-explicit-any': 'warn',\n\n      // General rules\n      'no-unused-vars': 'off', // Let TypeScript handle this\n    },\n  },\n  {\n    files: ['**/*.vue'],\n    languageOptions: {\n      parser: vueParser,\n      parserOptions: {\n        parser: typescriptParser,\n      },\n    },\n  },\n]\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  </head>\n  <body>\n    <div id=\"app\"></div>\n    <script type=\"module\" src=\"/src/main.ts\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/package.json",
    "content": "{\n  \"name\": \"tanstack-router-vue-example-basic-file-based-sfc\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite --port 3000\",\n    \"build\": \"vite build && vue-tsc --noEmit\",\n    \"preview\": \"vite preview\",\n    \"start\": \"vite\"\n  },\n  \"dependencies\": {\n    \"@tailwindcss/vite\": \"^4.2.2\",\n    \"@tanstack/router-plugin\": \"^1.167.1\",\n    \"@tanstack/vue-router\": \"^1.168.1\",\n    \"@tanstack/vue-router-devtools\": \"^1.166.10\",\n    \"@tanstack/zod-adapter\": \"^1.166.9\",\n    \"redaxios\": \"^0.5.1\",\n    \"tailwindcss\": \"^4.2.2\",\n    \"vue\": \"^3.5.16\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@vitejs/plugin-vue\": \"^6.0.5\",\n    \"@vitejs/plugin-vue-jsx\": \"^5.1.5\",\n    \"typescript\": \"~5.8.3\",\n    \"vite\": \"^8.0.0\",\n    \"vue-tsc\": \"^3.1.5\"\n  }\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/components/VueLogo.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, computed } from 'vue'\n\nconst props = withDefaults(\n  defineProps<{\n    /**\n     * Accepts any valid CSS color value as a string.\n     * Note: TypeScript cannot strictly check for all valid CSS colors at type level.\n     * For runtime validation, you could use a library or custom validator if desired.\n     */\n    textColor?: string\n  }>(),\n  {\n    textColor: 'gray',\n  },\n)\n\nconst count = ref(0)\n\nconst countLabel = computed(() => {\n  if (count.value === 0) return 'Click the logo!'\n  if (count.value === 1) return '1 click'\n  return `${count.value} clicks`\n})\n\nfunction increment() {\n  count.value++\n}\n\nfunction reset() {\n  count.value = 0\n}\n</script>\n\n<template>\n  <div class=\"vue-logo-container\">\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 261.76 226.69\"\n      class=\"vue-logo\"\n      @click=\"increment\"\n    >\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H-.005L130.872 226.69 261.749 0z\"\n        fill=\"#41b883\"\n      />\n      <path\n        d=\"M161.096.001l-30.224 52.35L100.647.002H52.346l78.526 136.01L209.398.001z\"\n        fill=\"#34495e\"\n      />\n    </svg>\n    <p class=\"count-label\" :style=\"{ color: props.textColor }\">\n      {{ countLabel }}\n    </p>\n    <button v-if=\"count > 0\" class=\"reset-btn\" @click=\"reset\">Reset</button>\n  </div>\n</template>\n\n<style scoped>\n.vue-logo-container {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  gap: 0.5rem;\n  margin: 1rem 0;\n}\n\n.vue-logo {\n  width: 64px;\n  height: 64px;\n  cursor: pointer;\n  transition: transform 0.2s ease;\n}\n\n.vue-logo:hover {\n  transform: scale(1.1);\n}\n\n.vue-logo:active {\n  transform: scale(0.95);\n}\n\n.count-label {\n  margin: 0;\n  font-size: 0.875rem;\n  color: #666;\n}\n\n.reset-btn {\n  padding: 0.25rem 0.5rem;\n  font-size: 0.75rem;\n  background: #41b883;\n  color: white;\n  border: none;\n  border-radius: 4px;\n  cursor: pointer;\n}\n\n.reset-btn:hover {\n  background: #34495e;\n}\n</style>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/main.ts",
    "content": "import { createApp, h } from 'vue'\nimport { RouterProvider, createRouter } from '@tanstack/vue-router'\nimport { routeTree } from './routeTree.gen'\nimport './styles.css'\n\n// Set up a Router instance\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultStaleTime: 5000,\n  scrollRestoration: true,\n})\n\n// Register things for typesafety\ndeclare module '@tanstack/vue-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('app')!\n\nif (!rootElement.innerHTML) {\n  const app = createApp({\n    setup() {\n      return () => h(RouterProvider, { router })\n    },\n  })\n  app.mount('#app')\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/posts.ts",
    "content": "import { notFound } from '@tanstack/vue-router'\nimport axios from 'redaxios'\n\nexport type PostType = {\n  id: string\n  title: string\n  body: string\n}\n\nlet queryURL = 'https://jsonplaceholder.typicode.com'\n\nif (import.meta.env.VITE_NODE_ENV === 'test') {\n  queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`\n}\n\nexport const fetchPost = async (postId: string) => {\n  console.info(`Fetching post with id ${postId}...`)\n  await new Promise((r) => setTimeout(r, 500))\n  const post = await axios\n    .get<PostType>(`${queryURL}/posts/${postId}`)\n    .then((r) => r.data)\n    .catch((err) => {\n      if (err.status === 404) {\n        throw notFound()\n      }\n      throw err\n    })\n\n  return post\n}\n\nexport const fetchPosts = async () => {\n  console.info('Fetching posts...')\n  await new Promise((r) => setTimeout(r, 500))\n  return axios\n    .get<Array<PostType>>(`${queryURL}/posts`)\n    .then((r) => r.data.slice(0, 10))\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routeTree.gen.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { lazyRouteComponent } from '@tanstack/vue-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as Char45824Char54620Char48124Char44397RouteImport } from './routes/대한민국'\nimport { Route as RemountDepsRouteImport } from './routes/remountDeps'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'\nimport { Route as EditingBRouteImport } from './routes/editing-b'\nimport { Route as EditingARouteImport } from './routes/editing-a'\nimport { Route as LayoutRouteImport } from './routes/_layout'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\nimport { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'\nimport { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'\nimport { Route as groupInsideRouteImport } from './routes/(group)/inside'\nimport { Route as groupLayoutRouteImport } from './routes/(group)/_layout'\nimport { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside'\nimport { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit'\nimport { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'\nimport { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'\nimport { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside'\nimport { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout'\n\nconst Char45824Char54620Char48124Char44397Route =\n  Char45824Char54620Char48124Char44397RouteImport.update({\n    id: '/대한민국',\n    path: '/대한민국',\n    getParentRoute: () => rootRouteImport,\n  } as any).update({\n    component: lazyRouteComponent(\n      () => import('./routes/대한민국.component.vue'),\n      'default',\n    ),\n  })\nconst RemountDepsRoute = RemountDepsRouteImport.update({\n  id: '/remountDeps',\n  path: '/remountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/remountDeps.component.vue'),\n    'default',\n  ),\n})\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/posts.component.vue'),\n    'default',\n  ),\n})\nconst NotRemountDepsRoute = NotRemountDepsRouteImport.update({\n  id: '/notRemountDeps',\n  path: '/notRemountDeps',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/notRemountDeps.component.vue'),\n    'default',\n  ),\n})\nconst EditingBRoute = EditingBRouteImport.update({\n  id: '/editing-b',\n  path: '/editing-b',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/editing-b.component.vue'),\n    'default',\n  ),\n})\nconst EditingARoute = EditingARouteImport.update({\n  id: '/editing-a',\n  path: '/editing-a',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/editing-a.component.vue'),\n    'default',\n  ),\n})\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/_layout.component.vue'),\n    'default',\n  ),\n})\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/index.component.vue'),\n    'default',\n  ),\n})\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRoute,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/posts.index.component.vue'),\n    'default',\n  ),\n})\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/posts.$postId.component.vue'),\n    'default',\n  ),\n  errorComponent: lazyRouteComponent(\n    () => import('./routes/posts.$postId.errorComponent.vue'),\n    'default',\n  ),\n})\nconst LayoutLayout2Route = LayoutLayout2RouteImport.update({\n  id: '/_layout-2',\n  getParentRoute: () => LayoutRoute,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/_layout/_layout-2.component.vue'),\n    'default',\n  ),\n})\nconst groupLazyinsideRoute = groupLazyinsideRouteImport\n  .update({\n    id: '/(group)/lazyinside',\n    path: '/lazyinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/lazyinside.component.vue'),\n      'default',\n    ),\n  })\nconst groupInsideRoute = groupInsideRouteImport\n  .update({\n    id: '/(group)/inside',\n    path: '/inside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/inside.component.vue'),\n      'default',\n    ),\n  })\nconst groupLayoutRoute = groupLayoutRouteImport\n  .update({\n    id: '/(group)/_layout',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/_layout.component.vue'),\n      'default',\n    ),\n  })\nconst anotherGroupOnlyrouteinsideRoute = anotherGroupOnlyrouteinsideRouteImport\n  .update({\n    id: '/(another-group)/onlyrouteinside',\n    path: '/onlyrouteinside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(another-group)/onlyrouteinside.component.vue'),\n      'default',\n    ),\n  })\nconst PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({\n  id: '/posts_/$postId/edit',\n  path: '/posts/$postId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/posts_.$postId.edit.component.vue'),\n    'default',\n  ),\n})\nconst LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({\n  id: '/layout-b',\n  path: '/layout-b',\n  getParentRoute: () => LayoutLayout2Route,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/_layout/_layout-2/layout-b.component.vue'),\n    'default',\n  ),\n})\nconst LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({\n  id: '/layout-a',\n  path: '/layout-a',\n  getParentRoute: () => LayoutLayout2Route,\n} as any).update({\n  component: lazyRouteComponent(\n    () => import('./routes/_layout/_layout-2/layout-a.component.vue'),\n    'default',\n  ),\n})\nconst groupSubfolderInsideRoute = groupSubfolderInsideRouteImport\n  .update({\n    id: '/(group)/subfolder/inside',\n    path: '/subfolder/inside',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/subfolder/inside.component.vue'),\n      'default',\n    ),\n  })\nconst groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport\n  .update({\n    id: '/insidelayout',\n    path: '/insidelayout',\n    getParentRoute: () => groupLayoutRoute,\n  } as any)\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/(group)/_layout.insidelayout.component.vue'),\n      'default',\n    ),\n  })\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/remountDeps': typeof RemountDepsRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/inside': typeof groupInsideRoute\n  '/lazyinside': typeof groupLazyinsideRoute\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n  '/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/layout-a': typeof LayoutLayout2LayoutARoute\n  '/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_layout': typeof LayoutRouteWithChildren\n  '/editing-a': typeof EditingARoute\n  '/editing-b': typeof EditingBRoute\n  '/notRemountDeps': typeof NotRemountDepsRoute\n  '/posts': typeof PostsRouteWithChildren\n  '/remountDeps': typeof RemountDepsRoute\n  '/대한민국': typeof Char45824Char54620Char48124Char44397Route\n  '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute\n  '/(group)/_layout': typeof groupLayoutRouteWithChildren\n  '/(group)/inside': typeof groupInsideRoute\n  '/(group)/lazyinside': typeof groupLazyinsideRoute\n  '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n  '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute\n  '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute\n  '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute\n  '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute\n  '/posts_/$postId/edit': typeof PostsPostIdEditRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/remountDeps'\n    | '/대한민국'\n    | '/onlyrouteinside'\n    | '/inside'\n    | '/lazyinside'\n    | '/posts/$postId'\n    | '/posts'\n    | '/insidelayout'\n    | '/subfolder/inside'\n    | '/layout-a'\n    | '/layout-b'\n    | '/posts/$postId/edit'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/editing-a'\n    | '/editing-b'\n    | '/notRemountDeps'\n    | '/posts'\n    | '/remountDeps'\n    | '/대한민국'\n    | '/(another-group)/onlyrouteinside'\n    | '/(group)/_layout'\n    | '/(group)/inside'\n    | '/(group)/lazyinside'\n    | '/_layout/_layout-2'\n    | '/posts/$postId'\n    | '/posts/'\n    | '/(group)/_layout/insidelayout'\n    | '/(group)/subfolder/inside'\n    | '/_layout/_layout-2/layout-a'\n    | '/_layout/_layout-2/layout-b'\n    | '/posts_/$postId/edit'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  LayoutRoute: typeof LayoutRouteWithChildren\n  EditingARoute: typeof EditingARoute\n  EditingBRoute: typeof EditingBRoute\n  NotRemountDepsRoute: typeof NotRemountDepsRoute\n  PostsRoute: typeof PostsRouteWithChildren\n  RemountDepsRoute: typeof RemountDepsRoute\n  Char45824Char54620Char48124Char44397Route: typeof Char45824Char54620Char48124Char44397Route\n  anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute\n  groupLayoutRoute: typeof groupLayoutRouteWithChildren\n  groupInsideRoute: typeof groupInsideRoute\n  groupLazyinsideRoute: typeof groupLazyinsideRoute\n  groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute\n  PostsPostIdEditRoute: typeof PostsPostIdEditRoute\n}\n\ndeclare module '@tanstack/vue-router' {\n  interface FileRoutesByPath {\n    '/대한민국': {\n      id: '/대한민국'\n      path: '/대한민국'\n      fullPath: '/대한민국'\n      preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/remountDeps': {\n      id: '/remountDeps'\n      path: '/remountDeps'\n      fullPath: '/remountDeps'\n      preLoaderRoute: typeof RemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/notRemountDeps': {\n      id: '/notRemountDeps'\n      path: '/notRemountDeps'\n      fullPath: '/notRemountDeps'\n      preLoaderRoute: typeof NotRemountDepsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-b': {\n      id: '/editing-b'\n      path: '/editing-b'\n      fullPath: '/editing-b'\n      preLoaderRoute: typeof EditingBRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/editing-a': {\n      id: '/editing-a'\n      path: '/editing-a'\n      fullPath: '/editing-a'\n      preLoaderRoute: typeof EditingARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRoute\n    }\n    '/_layout/_layout-2': {\n      id: '/_layout/_layout-2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutLayout2RouteImport\n      parentRoute: typeof LayoutRoute\n    }\n    '/(group)/lazyinside': {\n      id: '/(group)/lazyinside'\n      path: '/lazyinside'\n      fullPath: '/lazyinside'\n      preLoaderRoute: typeof groupLazyinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/inside': {\n      id: '/(group)/inside'\n      path: '/inside'\n      fullPath: '/inside'\n      preLoaderRoute: typeof groupInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout': {\n      id: '/(group)/_layout'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(another-group)/onlyrouteinside': {\n      id: '/(another-group)/onlyrouteinside'\n      path: '/onlyrouteinside'\n      fullPath: '/onlyrouteinside'\n      preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts_/$postId/edit': {\n      id: '/posts_/$postId/edit'\n      path: '/posts/$postId/edit'\n      fullPath: '/posts/$postId/edit'\n      preLoaderRoute: typeof PostsPostIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/_layout-2/layout-b': {\n      id: '/_layout/_layout-2/layout-b'\n      path: '/layout-b'\n      fullPath: '/layout-b'\n      preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/_layout/_layout-2/layout-a': {\n      id: '/_layout/_layout-2/layout-a'\n      path: '/layout-a'\n      fullPath: '/layout-a'\n      preLoaderRoute: typeof LayoutLayout2LayoutARouteImport\n      parentRoute: typeof LayoutLayout2Route\n    }\n    '/(group)/subfolder/inside': {\n      id: '/(group)/subfolder/inside'\n      path: '/subfolder/inside'\n      fullPath: '/subfolder/inside'\n      preLoaderRoute: typeof groupSubfolderInsideRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group)/_layout/insidelayout': {\n      id: '/(group)/_layout/insidelayout'\n      path: '/insidelayout'\n      fullPath: '/insidelayout'\n      preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport\n      parentRoute: typeof groupLayoutRoute\n    }\n  }\n}\n\ninterface LayoutLayout2RouteChildren {\n  LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute\n  LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute\n}\n\nconst LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {\n  LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,\n  LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,\n}\n\nconst LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(\n  LayoutLayout2RouteChildren,\n)\n\ninterface LayoutRouteChildren {\n  LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren\n}\n\nconst LayoutRouteChildren: LayoutRouteChildren = {\n  LayoutLayout2Route: LayoutLayout2RouteWithChildren,\n}\n\nconst LayoutRouteWithChildren =\n  LayoutRoute._addFileChildren(LayoutRouteChildren)\n\ninterface PostsRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteChildren: PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\ninterface groupLayoutRouteChildren {\n  groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute\n}\n\nconst groupLayoutRouteChildren: groupLayoutRouteChildren = {\n  groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,\n}\n\nconst groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(\n  groupLayoutRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  LayoutRoute: LayoutRouteWithChildren,\n  EditingARoute: EditingARoute,\n  EditingBRoute: EditingBRoute,\n  NotRemountDepsRoute: NotRemountDepsRoute,\n  PostsRoute: PostsRouteWithChildren,\n  RemountDepsRoute: RemountDepsRoute,\n  Char45824Char54620Char48124Char44397Route:\n    Char45824Char54620Char48124Char44397Route,\n  anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,\n  groupLayoutRoute: groupLayoutRouteWithChildren,\n  groupInsideRoute: groupInsideRoute,\n  groupLazyinsideRoute: groupLazyinsideRoute,\n  groupSubfolderInsideRoute: groupSubfolderInsideRoute,\n  PostsPostIdEditRoute: PostsPostIdEditRoute,\n}\nexport const routeTree = rootRouteImport\n  .update({\n    component: lazyRouteComponent(\n      () => import('./routes/__root.component.vue'),\n      'default',\n    ),\n    notFoundComponent: lazyRouteComponent(\n      () => import('./routes/__root.notFoundComponent.vue'),\n      'default',\n    ),\n  })\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(another-group)/onlyrouteinside.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useSearch, getRouteApi } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(another-group)/onlyrouteinside')\n\nconst searchViaHook = useSearch({ from: '/(another-group)/onlyrouteinside' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(another-group)/onlyrouteinside.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(another-group)/onlyrouteinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/_layout.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Outlet } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <div>Layout inside group</div>\n    <Outlet />\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/_layout.insidelayout.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { getRouteApi, useSearch } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(group)/_layout/insidelayout')\n\nconst searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/_layout.insidelayout.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/_layout/insidelayout')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/_layout.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/(group)/_layout')({})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/inside.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useSearch, getRouteApi } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(group)/inside')\n\nconst searchViaHook = useSearch({ from: '/(group)/inside' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/inside.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/lazyinside.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useSearch, getRouteApi } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(group)/lazyinside')\n\nconst searchViaHook = useSearch({ from: '/(group)/lazyinside' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/lazyinside.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/lazyinside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/subfolder/inside.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useSearch, getRouteApi } from '@tanstack/vue-router'\n\nconst routeApi = getRouteApi('/(group)/subfolder/inside')\n\nconst searchViaHook = useSearch({ from: '/(group)/subfolder/inside' })\nconst searchViaRouteHook = routeApi.useSearch()\nconst searchViaRouteApi = routeApi.useSearch()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"search-via-hook\">{{ searchViaHook.hello }}</div>\n    <div data-testid=\"search-via-route-hook\">\n      {{ searchViaRouteHook.hello }}\n    </div>\n    <div data-testid=\"search-via-route-api\">{{ searchViaRouteApi.hello }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/(group)/subfolder/inside.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { z } from 'zod'\nimport { zodValidator } from '@tanstack/zod-adapter'\n\nexport const Route = createFileRoute('/(group)/subfolder/inside')({\n  validateSearch: zodValidator(z.object({ hello: z.string().optional() })),\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/__root.component.vue",
    "content": "<script setup lang=\"ts\">\nimport {\n  Link,\n  Outlet,\n  HeadContent,\n  useRouter,\n  useCanGoBack,\n  useRouterState,\n} from '@tanstack/vue-router'\nimport { TanStackRouterDevtools } from '@tanstack/vue-router-devtools'\n\nconst router = useRouter()\nconst canGoBack = useCanGoBack()\n// test useRouterState doesn't crash client side navigation\nconst _state = useRouterState()\n</script>\n\n<template>\n  <HeadContent />\n  <div class=\"flex gap-2 p-2 text-lg border-b\">\n    <button\n      data-testid=\"back-button\"\n      :disabled=\"!canGoBack\"\n      @click=\"router.history.back()\"\n      :class=\"{ 'line-through': !canGoBack }\"\n    >\n      Back\n    </button>\n    <Link\n      to=\"/\"\n      :activeProps=\"{ class: 'font-bold' }\"\n      :activeOptions=\"{ exact: true }\"\n    >\n      Home\n    </Link>\n    <Link to=\"/posts\" :activeProps=\"{ class: 'font-bold' }\">Posts</Link>\n    <Link to=\"/layout-a\" :activeProps=\"{ class: 'font-bold' }\">Layout</Link>\n    <Link\n      to=\"/onlyrouteinside\"\n      data-testid=\"link-to-only-route-inside-group\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Only Route Inside Group\n    </Link>\n    <Link\n      to=\"/inside\"\n      data-testid=\"link-to-route-inside-group\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Inside Group\n    </Link>\n    <Link\n      to=\"/subfolder/inside\"\n      data-testid=\"link-to-route-inside-group-inside-subfolder\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Inside Subfolder Inside Group\n    </Link>\n    <Link\n      to=\"/insidelayout\"\n      data-testid=\"link-to-route-inside-group-inside-layout\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Inside Group Inside Layout\n    </Link>\n    <Link\n      to=\"/lazyinside\"\n      data-testid=\"link-to-lazy-route-inside-group\"\n      :search=\"{ hello: 'world' }\"\n      :activeProps=\"{ class: 'font-bold' }\"\n    >\n      Lazy Inside Group\n    </Link>\n    <Link to=\"/대한민국\" :activeProps=\"{ class: 'font-bold' }\"\n      >unicode path</Link\n    >\n    <Link\n      :activeProps=\"{ class: 'font-bold' }\"\n      :to=\"'/this-route-does-not-exist' as any\"\n    >\n      This Route Does Not Exist\n    </Link>\n  </div>\n  <hr />\n  <Outlet />\n  <TanStackRouterDevtools position=\"bottom-right\" />\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/__root.notFoundComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <p>This is the notFoundComponent configured on root route</p>\n    <Link to=\"/\">Start Over</Link>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/__root.ts",
    "content": "import { createRootRoute } from '@tanstack/vue-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/_layout/_layout-2/layout-a.component.vue",
    "content": "<template>\n  <div>I'm layout A!</div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/_layout/_layout-2/layout-a.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-a')({\n  // component is loaded from layout-a.component.vue\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/_layout/_layout-2/layout-b.component.vue",
    "content": "<template>\n  <div>I'm layout B!</div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/_layout/_layout-2/layout-b.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2/layout-b')({\n  // component is loaded from layout-b.component.vue\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/_layout/_layout-2.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link, Outlet } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <div>I'm a nested layout</div>\n    <div class=\"flex gap-2 border-b\">\n      <Link to=\"/layout-a\" :activeProps=\"{ class: 'font-bold' }\">\n        Layout A\n      </Link>\n      <Link to=\"/layout-b\" :activeProps=\"{ class: 'font-bold' }\">\n        Layout B\n      </Link>\n    </div>\n    <div>\n      <Outlet />\n    </div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/_layout/_layout-2.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout/_layout-2')({\n  // component is loaded from _layout-2.component.vue\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/_layout.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Outlet } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <div class=\"border-b\">I'm a layout</div>\n    <div>\n      <Outlet />\n    </div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/_layout.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/_layout')({\n  // component is loaded from _layout.component.vue\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/editing-a.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nconst navigate = useNavigate()\nconst input = ref('')\n\nconst blocker = useBlocker({\n  shouldBlockFn: ({ next }) => {\n    if (next.fullPath === '/editing-b' && input.value.length > 0) {\n      return true\n    }\n    return false\n  },\n  withResolver: true,\n})\n</script>\n\n<template>\n  <div>\n    <h1>Editing A</h1>\n    <label>\n      Enter your name:\n      <input name=\"input\" v-model=\"input\" />\n    </label>\n    <button @click=\"navigate({ to: '/editing-b' })\">Go to next step</button>\n    <button v-if=\"blocker.status === 'blocked'\" @click=\"blocker.proceed?.()\">\n      Proceed\n    </button>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/editing-a.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/editing-a')({})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/editing-b.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, toValue } from 'vue'\nimport { useBlocker, useNavigate } from '@tanstack/vue-router'\n\nconst navigate = useNavigate()\nconst input = ref('')\n\nconst blocker = useBlocker({\n  shouldBlockFn: () => !!toValue(input),\n  withResolver: true,\n})\n</script>\n\n<template>\n  <div>\n    <h1>Editing B</h1>\n    <label>\n      Enter your name:\n      <input name=\"input\" v-model=\"input\" />\n    </label>\n    <button @click=\"navigate({ to: '/editing-a' })\">Go back</button>\n    <button v-if=\"blocker.status === 'blocked'\" @click=\"blocker.proceed?.()\">\n      Proceed\n    </button>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/editing-b.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/editing-b')({})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/index.component.vue",
    "content": "<script setup lang=\"ts\">\nimport VueLogo from '../components/VueLogo.vue'\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <h3>Vue SFC!</h3>\n    <VueLogo text-color=\"orange\" />\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/index.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/')({\n  // component is loaded from index.component.vue\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/notRemountDeps.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { ref, onMounted } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\nconst mounts = ref(0)\nconst search = useSearch({ from: '/notRemountDeps' })\nconst navigate = useNavigate()\n\nonMounted(() => {\n  mounts.value++\n})\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <button\n      @click=\"\n        navigate({\n          to: '/notRemountDeps',\n          search: { searchParam: Math.random().toString(36).substring(2, 8) },\n        })\n      \"\n    >\n      Regenerate search param\n    </button>\n\n    <div>Search: {{ search.searchParam }}</div>\n    <div data-testid=\"component-mounts\">\n      Page component mounts: {{ mounts }}\n    </div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/notRemountDeps.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/notRemountDeps')({\n  validateSearch(search: { searchParam: string }) {\n    return { searchParam: search.searchParam }\n  },\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.params\n  },\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts.$postId.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useLoaderData } from '@tanstack/vue-router'\nimport type { PostType } from '../posts'\n\nconst post = useLoaderData({ from: '/posts/$postId' }) as unknown as PostType\n</script>\n\n<template>\n  <div class=\"space-y-2\">\n    <h4 class=\"text-xl font-bold underline\" data-testid=\"post-title\">\n      {{ post.title }}\n    </h4>\n    <div class=\"text-sm\">{{ post.body }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts.$postId.errorComponent.vue",
    "content": "<script setup lang=\"ts\">\nimport { ErrorComponent } from '@tanstack/vue-router'\nimport type { ErrorComponentProps } from '@tanstack/vue-router'\n\nconst props = defineProps<ErrorComponentProps>()\n</script>\n\n<template>\n  <ErrorComponent :error=\"props.error\" />\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts.$postId.ts",
    "content": "import { h } from 'vue'\nimport { createFileRoute } from '@tanstack/vue-router'\nimport { fetchPost } from '../posts'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => fetchPost(postId),\n  notFoundComponent: () => h('p', 'Post not found'),\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Link, Outlet, useLoaderData } from '@tanstack/vue-router'\nimport type { PostType } from '../posts'\n\nconst posts = useLoaderData({ from: '/posts' }) as unknown as Array<PostType>\n</script>\n\n<template>\n  <div class=\"p-2 flex gap-2\" data-testid=\"posts-links\">\n    <ul class=\"list-disc pl-4\">\n      <li\n        v-for=\"post in [\n          ...posts,\n          { id: 'i-do-not-exist', title: 'Non-existent Post' },\n        ]\"\n        :key=\"post.id\"\n        class=\"whitespace-nowrap\"\n      >\n        <Link\n          to=\"/posts/$postId\"\n          :params=\"{ postId: post.id }\"\n          class=\"block py-1 text-blue-600 hover:opacity-75\"\n          :activeProps=\"{ class: 'font-bold underline' }\"\n        >\n          <div>{{ post.title.substring(0, 20) }}</div>\n        </Link>\n      </li>\n    </ul>\n    <hr />\n    <Outlet />\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts.index.component.vue",
    "content": "<template>\n  <div data-testid=\"PostsIndexComponent\">Select a post.</div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts.index.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts/')({\n  // component is loaded from posts.index.component.vue\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  head: () => ({\n    meta: [\n      {\n        title: 'Posts page',\n      },\n    ],\n  }),\n  loader: fetchPosts,\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts_.$postId.edit.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { useParams, getRouteApi } from '@tanstack/vue-router'\n\nconst api = getRouteApi('/posts_/$postId/edit')\n\nconst paramsViaApi = api.useParams()\nconst paramsViaHook = useParams({ from: '/posts_/$postId/edit' })\nconst paramsViaRouteHook = api.useParams()\n</script>\n\n<template>\n  <div>\n    <div data-testid=\"params-via-hook\">{{ paramsViaHook.postId }}</div>\n    <div data-testid=\"params-via-route-hook\">\n      {{ paramsViaRouteHook.postId }}\n    </div>\n    <div data-testid=\"params-via-route-api\">{{ paramsViaApi.postId }}</div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/posts_.$postId.edit.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/posts_/$postId/edit')({})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/remountDeps.component.vue",
    "content": "<script lang=\"ts\">\nimport { ref } from 'vue'\n// Module-scoped ref to persist across component remounts\nconst mounts = ref(0)\nexport { mounts }\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted } from 'vue'\nimport { useSearch, useNavigate } from '@tanstack/vue-router'\n\nconst search = useSearch({ from: '/remountDeps' })\nconst navigate = useNavigate()\n\nonMounted(() => {\n  mounts.value++\n})\n</script>\n\n<template>\n  <div class=\"p-2\">\n    <button\n      @click=\"\n        navigate({\n          to: '/remountDeps',\n          search: { searchParam: Math.random().toString(36).substring(2, 8) },\n        })\n      \"\n    >\n      Regenerate search param\n    </button>\n\n    <div>Search: {{ search.searchParam }}</div>\n    <div data-testid=\"component-mounts\">\n      Page component mounts: {{ mounts }}\n    </div>\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/remountDeps.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/remountDeps')({\n  validateSearch(search: { searchParam: string }) {\n    return { searchParam: search.searchParam }\n  },\n  loaderDeps(opts) {\n    return opts.search\n  },\n  remountDeps(opts) {\n    return opts.search\n  },\n})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/대한민국.component.vue",
    "content": "<script setup lang=\"ts\">\nimport { Outlet } from '@tanstack/vue-router'\n</script>\n\n<template>\n  <div>\n    <h3 class=\"pb-2\" data-testid=\"unicode-heading\">Hello \"/대한민국\"!</h3>\n    <hr />\n    <Outlet />\n  </div>\n</template>\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/routes/대한민국.ts",
    "content": "import { createFileRoute } from '@tanstack/vue-router'\n\nexport const Route = createFileRoute('/대한민국')({})\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/styles.css",
    "content": "@import 'tailwindcss' source('../');\n\n@source \"./**/*.vue\";\n@source \"./**/*.ts\";\n\n@layer base {\n  *,\n  ::after,\n  ::before,\n  ::backdrop,\n  ::file-selector-button {\n    border-color: var(--color-gray-200, currentcolor);\n  }\n}\n\nhtml {\n  color-scheme: light dark;\n}\n* {\n  @apply border-gray-200 dark:border-gray-800;\n}\nbody {\n  @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/src/vue-shims.d.ts",
    "content": "declare module '*.vue' {\n  import type { DefineComponent } from 'vue'\n  const component: DefineComponent<{}, {}, any>\n  export default component\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ESNext\",\n    \"module\": \"ESNext\",\n    \"lib\": [\"ESNext\", \"DOM\"],\n    \"strict\": true,\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"vue\",\n    \"moduleResolution\": \"bundler\",\n    \"skipLibCheck\": true,\n    \"noEmit\": true,\n    \"resolveJsonModule\": true,\n    \"types\": [\"vite/client\"]\n  },\n  \"include\": [\"src/**/*\", \"src/**/*.vue\", \"tests\"],\n  \"exclude\": [\"node_modules\", \"dist\"]\n}\n"
  },
  {
    "path": "examples/vue/basic-file-based-sfc/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport vue from '@vitejs/plugin-vue'\nimport vueJsx from '@vitejs/plugin-vue-jsx'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\nimport tailwindcss from '@tailwindcss/vite'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    tailwindcss(),\n    tanstackRouter({\n      target: 'vue',\n      autoCodeSplitting: true,\n    }),\n    vue(),\n    vueJsx(),\n  ],\n})\n"
  },
  {
    "path": "gpt/generate.js",
    "content": "// @ts-check\n\nimport fs from 'node:fs'\nimport { glob } from 'tinyglobby'\n\nconst outputPath = './gpt/db.json'\nconst packages = []\nconst docs = []\nconst examples = []\n\nPromise.resolve()\n  .then(() => {\n    return glob('./packages/*').then((dirs) => {\n      return Promise.all(\n        dirs.map((dir) => {\n          const pkg = {\n            name: dir.replace('./packages/', ''),\n            files: [],\n          }\n\n          packages.push(pkg)\n\n          return glob(`./${dir}/src/**/*`, {\n            onlyFiles: true,\n          }).then((files) => {\n            files.forEach((file) => {\n              const content = fs.readFileSync(file, 'utf8')\n\n              pkg.files.push({ file, content })\n            })\n          })\n        }),\n      )\n    })\n  })\n  .then(() => {\n    return glob('./docs/**/*.md').then((files) => {\n      files.forEach((file) => {\n        const content = fs.readFileSync(file, 'utf8')\n        const title = file.replace('./', '').replace('.md', '')\n\n        docs.push({ page: title, content })\n      })\n    })\n  })\n  .then(() => {\n    return glob('./examples/react/*').then((dirs) => {\n      return Promise.all(\n        dirs.map((dir) => {\n          if (dir.includes('wip')) {\n            return\n          }\n          const example = {\n            name: dir.replace('./examples/react/', ''),\n            files: [],\n          }\n\n          examples.push(example)\n\n          return glob(`./${dir}/src/**/*`, {\n            onlyFiles: true,\n          }).then((files) => {\n            files.forEach((file) => {\n              const content = fs.readFileSync(file, 'utf8')\n\n              example.files.push({ file, content })\n            })\n          })\n        }),\n      )\n    })\n  })\n  .then(() => {\n    fs.writeFileSync(\n      outputPath,\n      JSON.stringify({ packages, docs, examples }, null, 2),\n    )\n  })\n  .catch((err) => {\n    console.error('Error reading files:', err)\n    return\n  })\n"
  },
  {
    "path": "how-to-guides-implementation-plan.md",
    "content": "# How-To Guides Implementation Plan\n\nThis document outlines the multi-PR process for implementing the remaining how-to guides for TanStack Router.\n\n## Progress Tracking\n\n- ✅ **Guide #1: Deploy to Production** - COMPLETED in docs/router/framework/react/how-to/deploy-to-production.md\n- ✅ **Guide #2: Setup SSR** - COMPLETED in docs/router/framework/react/how-to/setup-ssr.md\n- ✅ **Guide #3: Migrate from React Router v7** - COMPLETED in docs/router/framework/react/how-to/migrate-from-react-router.md\n- ⏳ **Guide #4: Fix Build Issues** - MOVED TO DEBUGGING DIRECTORY\n- ✅ **Guide #5: Integrate UI Libraries** - COMPLETED (split into individual guides)\n- ✅ **Guide #6: Setup Authentication** - COMPLETED (split into three focused guides)\n- ✅ **Guide #7: Debug Router Issues** - COMPLETED\n- ✅ **Guide #8: Setup Testing** - COMPLETED\n- ✅ **Environment Variables: TanStack Router** - COMPLETED in docs/router/framework/react/how-to/use-environment-variables.md\n- ✅ **Environment Variables: TanStack Start** - COMPLETED in docs/start/framework/react/how-to/use-environment-variables.md\n- 🔄 **Progressive Search Params Series** - IN PROGRESS\n\n### 🔄 Progressive Search Params How-To Series (Replaces Guide #10)\n\n**Status:** Ready for implementation with test verification\n\n**Foundation Level (Start Here):**\n\n- ✅ **Search #1: Setup Basic Search Parameters** (`setup-basic-search-params.md`) - COMPLETED with comprehensive validation library support\n- ✅ **Search #2: Navigate with Search Parameters** (`navigate-with-search-params.md`) - COMPLETED with comprehensive Link patterns and programmatic navigation\n\n**Intermediate Level (Common Patterns):**\n\n- ✅ **Search #3: Validate Search Parameters with Schemas** (`validate-search-params.md`) - COMPLETED with comprehensive validation library support\n- ✅ **Search #4: Work with Arrays, Objects, and Dates** (`arrays-objects-dates-search-params.md`) - COMPLETED with comprehensive coverage of arrays, objects, dates, and nested structures\n- ✅ **Search #5: Share Search Parameters Across Routes** (`share-search-params-across-routes.md`) - COMPLETED with comprehensive sharing patterns and middleware examples\n\n**Advanced Level (Power User Patterns):**\n\n- ⏳ **Search #6: Build Advanced Search Parameter Middleware** (`advanced-search-param-middleware.md`) - Test Coverage: Good (existing middleware tests)\n- ⏳ **Search #7: Optimize Search Parameter Performance** (`optimize-search-param-performance.md`) - Test Gap: Performance patterns, selectors\n- ⏳ **Search #8: Customize Search Parameter Serialization** (`customize-search-param-serialization.md`) - Test Gap: Custom serializers\n\n**Specialized Use Cases:**\n\n- ⏳ **Search #9: Build Search-Based Filtering Systems** (`build-search-filtering-systems.md`) - Test Gap: Complex filtering patterns\n- ⏳ **Search #10: Handle Search Parameters in Forms** (`search-params-in-forms.md`) - Test Gap: Form integration patterns\n- ⏳ **Search #11: Debug Search Parameter Issues** (`debug-search-param-issues.md`) - Test Coverage: Partial (debug tests exist)\n- ⏳ **Search #12: Use Search Parameters with Data Loading** (`search-params-with-data-loading.md`) - Test Gap: Loader integration patterns\n\n- ⏳ **Guide #9: Setup Dev Environment** - PENDING\n- ⏳ **Guide #11: Advanced Routing Patterns** - PENDING\n\n## Implementation Process\n\n### For Each New How-To Guide:\n\n1. **Create the guide** in `docs/router/framework/react/how-to/[guide-name].md`\n2. **Follow the established structure:**\n   - Quick Start section\n   - Step-by-step platform/scenario-specific instructions\n   - Production checklist (if applicable)\n   - Common Problems section\n   - Common Next Steps (commented out until guides exist)\n   - Related Resources (specific links only)\n3. **Update the directory README** to list the new guide\n4. **Update this tracking document** to mark as completed\n5. **Uncomment relevant \"Common Next Steps\"** in other guides that reference this one\n\n### Multi-PR Guidelines:\n\n- **One guide per PR** for focused reviews and easier iteration\n- **Start with highest priority** guides (#4, #5, #6...)\n- **Cross-reference between guides** as they become available\n- **Update tracking status** in each PR\n\n---\n\n## Next Agent Tasks\n\n### Priority 1: Guide #4 - How to Fix Common Build and Bundler Issues\n\n**File:** `docs/router/framework/react/how-to/fix-build-issues.md`\n\n**Context for Agent:**\n\n- Check existing installation guides in `docs/router/framework/react/routing/` for bundler setup\n- Focus on troubleshooting rather than initial setup\n- Address type generation failures and module resolution errors\n\n**Content Requirements:**\n\n- Plugin setup for different bundlers (Vite, Webpack, ESBuild, Rspack)\n- Fixing TypeScript route generation\n- Resolving import/export errors\n- Optimizing bundle size\n- Common Problems: Type generation failures, build optimization, module resolution\n\n---\n\n### Priority 2: Guide #5 - How to Integrate with Popular UI Libraries\n\n**File:** `docs/router/framework/react/how-to/integrate-ui-libraries.md`\n\n**Context for Agent:**\n\n- GitHub Issue #939 shows Shadcn/ui animation conflicts\n- Focus on most popular libraries with known integration challenges\n\n**Content Requirements:**\n\n- Shadcn/ui integration and animation fixes\n- Material-UI/MUI setup\n- Chakra UI integration\n- Framer Motion compatibility\n- Common Problems: Animation conflicts, CSS-in-JS compatibility, styling issues\n\n---\n\n### Priority 3: Guide #6 - How to Set Up Authentication and Protected Routes\n\n**File:** `docs/router/framework/react/how-to/setup-authentication.md`\n\n**Context for Agent:**\n\n- Reference existing guide: `docs/router/framework/react/guide/authenticated-routes.md`\n- Create practical, step-by-step version focused on implementation\n- Include popular auth provider integrations\n\n**Content Requirements:**\n\n- Setting up route context for auth\n- Creating auth-protected route patterns\n- Implementing login redirects\n- Handling auth state persistence\n- Integration with popular auth providers (Auth0, Clerk, Supabase)\n- Common Problems: Auth state management, redirect loops, persistence issues\n\n---\n\n### Remaining Guides (Priority 6-11):\n\n**Priority 6:** Debug Common Router Issues (`debug-router-issues.md`)\n**Priority 7:** Set Up Testing (`setup-testing.md`)  \n**Priority 8:** Set Up Development Environment (`setup-dev-environment.md`)\n**Priority 9:** Handle Search Parameters and URL State (`handle-search-parameters.md`)\n**Priority 10:** Implement Advanced Routing Patterns (`advanced-routing-patterns.md`)\n\n---\n\n## Agent Instructions Template\n\nWhen implementing each guide, use this template for your agent task:\n\n```\nCreate a comprehensive how-to guide for [GUIDE_TITLE] following the established pattern:\n\n1. **Read the priority document** at how-to-guides-implementation-plan.md for context\n2. **Check existing documentation** mentioned in the Context section\n3. **Follow the structure** from deploy-to-production.md:\n   - Quick Start\n   - Platform/scenario-specific instructions\n   - Production checklist (if applicable)\n   - Common Problems\n   - Common Next Steps (commented out)\n   - Related Resources (specific only)\n4. **Update the README** at docs/router/framework/react/how-to/README.md\n5. **Update tracking** in how-to-guides-implementation-plan.md\n6. **Cross-reference existing guides** by uncommenting relevant \"Common Next Steps\"\n\nFocus on practical, copy-paste ready solutions that solve real developer pain points.\n```\n\n---\n\n## Quality Checklist\n\nBefore marking any guide as complete:\n\n- [ ] Follows established structure pattern\n- [ ] Includes working code examples\n- [ ] Addresses real GitHub issues/pain points\n- [ ] Common Problems section covers frequent issues\n- [ ] No broken links (all \"Common Next Steps\" commented out until guides exist)\n- [ ] Related Resources are specific and valuable\n- [ ] README updated with new guide\n- [ ] Cross-references added to other guides where appropriate\n\n---\n\n## Completion Tracking\n\nUpdate this section as guides are completed:\n\n```\n✅ Guide #1: Deploy to Production - COMPLETED\n✅ Guide #2: Setup SSR - COMPLETED\n✅ Guide #3: Migrate from React Router - COMPLETED\n⏳ Guide #4: Fix Build Issues - MOVED TO DEBUGGING DIRECTORY\n✅ Guide #5: Integrate UI Libraries - COMPLETED (split into individual guides)\n  ✅ Shadcn/ui Integration - COMPLETED\n  ✅ Material-UI Integration - COMPLETED\n  ✅ Framer Motion Integration - COMPLETED\n  ✅ Chakra UI Integration - COMPLETED\n✅ Guide #6: Setup Authentication - COMPLETED (split into three focused guides)\n  ✅ Basic Authentication Setup - COMPLETED\n  ✅ Authentication Providers Integration - COMPLETED\n  ✅ Role-Based Access Control - COMPLETED\n✅ Guide #7: Debug Router Issues - COMPLETED\n✅ Guide #8: Setup Testing - COMPLETED\n⏳ Guide #9: Setup Dev Environment - PENDING\n⏳ Guide #10: Handle Search Parameters - PENDING\n⏳ Guide #11: Advanced Routing Patterns - PENDING\n```\n\nThis systematic approach ensures consistent quality and enables incremental progress across multiple agent sessions.\n"
  },
  {
    "path": "how-to-testing-plan.md",
    "content": "# TanStack Router How-To Guides Testing Plan\n\nThis plan outlines systematic testing for each how-to guide to verify:\n\n- ✅ **Type Accuracy**: No TypeScript errors\n- ✅ **Conceptual Accuracy**: Instructions work as described\n- ✅ **Runtime Accuracy**: Applications run without errors\n- ✅ **Completeness**: All necessary steps included\n\n## Testing Methodology\n\nEach test will use **agent-friendly static analysis** rather than running full projects:\n\n1. **API Validation**: Cross-reference code examples with actual TanStack Router source code\n2. **Import/Export Verification**: Check that all imports exist in the specified packages\n3. **TypeScript Syntax Check**: Validate code patterns against current TypeScript standards\n4. **Documentation Consistency**: Ensure examples match the current API documentation\n5. **Dependency Verification**: Check package.json compatibility and version requirements\n6. **Code Pattern Analysis**: Verify examples follow current best practices and conventions\n\n---\n\n## Guide Testing Checklist\n\n### 🚀 Installation & Setup\n\n- [✅] **install.md** - Basic installation steps\n  - **Test Approach**: Create new React app, follow installation steps\n  - **Verification**: Successful installation, basic router setup works\n  - **Error Checks**: Package resolution, peer dependencies, basic TypeScript compilation\n  - **FIXED ISSUES**:\n    - ✅ **Updated to Vite**: Replaced deprecated create-react-app with modern Vite\n    - ✅ **TypeScript Compatibility**: Uses TypeScript 5.3+ compatible setup\n    - ✅ **Complete Setup**: Added full working router configuration example\n    - ✅ **Modern Tooling**: Uses current best practices and recommendations\n  - **Status**: PASSED - Guide updated with modern, working instructions\n\n### 🔧 Configuration & Environment\n\n- [✅] **use-environment-variables.md** - Configure and use environment variables\n  - **Test Approach**: Test with Vite, Webpack, and other bundlers mentioned\n  - **Verification**: Environment variables accessible in different build contexts\n  - **Error Checks**: Build-time vs runtime variable access, TypeScript declarations\n  - **RESULTS**:\n    - ✅ **Vite Setup**: VITE\\_ prefixed variables work correctly in routes and components\n    - ✅ **Build Process**: Variables properly embedded in production build\n    - ✅ **Security**: Non-prefixed variables correctly excluded from client code\n    - ✅ **TypeScript**: No compilation errors, types work correctly\n    - ✅ **Route Loaders**: Environment variables accessible in async loaders\n  - **Status**: PASSED - Guide works correctly with Vite setup\n\n### 🌐 Deployment & Production\n\n- [✅] **deploy-to-production.md** - Deploy to hosting platforms\n  - **Test Approach**: Simulate deployment steps for each platform mentioned\n  - **Verification**: Build process works, static assets served correctly\n  - **Error Checks**: Build configuration, routing in production environments\n  - **RESULTS**:\n    - ✅ **Build Process**: `npm run build` creates correct `dist/` directory structure\n    - ✅ **Netlify Config**: `_redirects` file format and syntax correct\n    - ✅ **Netlify TOML**: `netlify.toml` configuration format accurate\n    - ✅ **Vercel Config**: `vercel.json` syntax valid and properly structured\n    - ✅ **File Deployment**: Static files properly copied to build output\n    - ✅ **SPA Routing**: Redirect configurations follow platform best practices\n  - **Status**: PASSED - All deployment configurations are accurate and functional\n\n- [✅] **setup-ssr.md** - Server-Side Rendering implementation\n  - **Test Approach**: Follow SSR setup steps in fresh project\n  - **Verification**: Server rendering works, hydration successful, no hydration mismatches\n  - **Error Checks**: Node.js compatibility, build process, server bundle issues\n  - **FIXED ISSUES**:\n    - ✅ **Correct Manual Setup**: Replaced non-existent CLI with proper manual instructions\n    - ✅ **Complete Configuration**: Added all required config files and dependencies\n    - ✅ **Working File Structure**: Proper TanStack Start project structure\n    - ✅ **Updated Commands**: All commands and scripts now accurate\n  - **Status**: PASSED - Guide updated with correct TanStack Start setup\n\n### 🔄 Migration\n\n- [✅] **migrate-from-react-router.md** - Migration from React Router v7\n  - **Test Approach**: Static analysis of API calls, imports, and code patterns\n  - **Verification**: All TanStack Router APIs exist and are used correctly\n  - **Error Checks**: API differences, TypeScript compatibility, import accuracy\n  - **RESULTS**:\n    - ✅ **API Compatibility**: All imports (`createFileRoute`, `createRootRoute`, `Link`, `Outlet`) exist\n    - ✅ **Plugin Integration**: `tanstackRouter` from `@tanstack/router-plugin/vite` correctly referenced\n    - ✅ **Hook Patterns**: `Route.useLoaderData()` and `Route.useParams()` confirmed in examples\n    - ✅ **TypeScript Usage**: Code examples use correct types and syntax patterns\n    - ✅ **Documentation Consistency**: Migration patterns match working examples in codebase\n  - **Status**: PASSED - Guide uses accurate APIs and follows correct patterns\n\n### 🔐 Authentication & Authorization\n\n- [✅] **setup-authentication.md** - Basic authentication with React Context\n  - **Test Approach**: Static analysis of API calls, imports, and code patterns\n  - **Verification**: All TanStack Router APIs exist and patterns match working examples\n  - **Error Checks**: Import accuracy, navigation patterns, context usage\n  - **RESULTS**:\n    - ✅ **API Compatibility**: All imports (`createFileRoute`, `createRootRouteWithContext`, `beforeLoad`) exist\n    - ✅ **Hook Patterns**: `Route.useRouteContext()`, `Route.useSearch()`, `Route.useNavigate()` confirmed\n    - ✅ **Context Setup**: Router context typing and patterns match working examples\n    - ✅ **Layout Routes**: `/_authenticated` pattern works correctly\n    - ✅ **Fixed Import**: Updated to correct `@tanstack/react-router-devtools` import\n    - ✅ **Fixed Navigation**: Updated to use `navigate({ to: redirect })` instead of `window.location.href`\n  - **Status**: PASSED - All patterns validated against working examples\n\n- [ ] **setup-auth-providers.md** - External auth providers (Auth0, Clerk, Supabase)\n  - **Test Approach**: Test setup steps for each provider (mock/sandbox environments)\n  - **Verification**: Provider integration works, callbacks handled correctly\n  - **Error Checks**: Configuration steps, TypeScript integration, error handling\n\n- [ ] **setup-rbac.md** - Role-Based Access Control\n  - **Test Approach**: Implement RBAC system following guide\n  - **Verification**: Role-based route access works, permission checks function\n  - **Error Checks**: Permission logic, TypeScript types, edge cases\n\n### 🧪 Testing & Debugging\n\n- [ ] **setup-testing.md** - Testing with code-based routing\n  - **Test Approach**: Set up testing environment following guide\n  - **Verification**: Tests run successfully, routing logic testable\n  - **Error Checks**: Test setup, mock configurations, TypeScript in tests\n\n- [ ] **test-file-based-routing.md** - Testing file-based routing\n  - **Test Approach**: Create file-based routing app, implement tests\n  - **Verification**: File-based routes testable, test patterns work\n  - **Error Checks**: File generation, test discovery, route testing patterns\n\n- [ ] **debug-router-issues.md** - Troubleshooting guide\n  - **Test Approach**: Create scenarios that trigger common issues\n  - **Verification**: Debugging techniques actually resolve issues\n  - **Error Checks**: Accuracy of troubleshooting steps, completeness of solutions\n\n### 🎨 UI Library Integration\n\n- [ ] **integrate-shadcn-ui.md** - Shadcn/ui integration\n  - **Test Approach**: Fresh project + shadcn/ui setup following guide\n  - **Verification**: Components work with router, styling applied correctly\n  - **Error Checks**: CSS setup, component compatibility, TypeScript integration\n\n- [ ] **integrate-material-ui.md** - Material-UI (MUI) integration\n  - **Test Approach**: Fresh project + MUI setup following guide\n  - **Verification**: MUI theming works with router, components render correctly\n  - **Error Checks**: Theme provider setup, SSR compatibility, TypeScript types\n\n- [ ] **integrate-framer-motion.md** - Framer Motion animations\n  - **Test Approach**: Fresh project + Framer Motion setup following guide\n  - **Verification**: Route transitions work, animations perform correctly\n  - **Error Checks**: Animation setup, performance, layout shift issues\n\n- [ ] **integrate-chakra-ui.md** - Chakra UI integration\n  - **Test Approach**: Fresh project + Chakra UI setup following guide\n  - **Verification**: Chakra theming works, responsive design functions\n  - **Error Checks**: Provider setup, theme integration, accessibility features\n\n---\n\n## Testing Environment Setup\n\n### Base Test Project Templates\n\n1. **Basic React + TypeScript + Vite** - For most guides\n2. **React Router v7 app** - For migration testing\n3. **Node.js/Express setup** - For SSR testing\n4. **Next.js alternative** - For comparison testing\n\n### Test Verification Criteria\n\n- ✅ **API Compatibility**: All imports and exports exist in current TanStack Router packages\n- ✅ **TypeScript Validity**: Code examples use correct types and syntax patterns\n- ✅ **Documentation Accuracy**: Examples match current official API documentation\n- ✅ **Version Compatibility**: Dependencies and features work with specified versions\n- ✅ **Code Quality**: Examples follow current best practices and conventions\n\n### Documentation Standards\n\nFor each guide tested, document:\n\n- ✅ **Working Steps**: Confirm steps that work correctly\n- ❌ **Issues Found**: Type errors, missing steps, unclear instructions\n- 🔧 **Suggested Fixes**: Specific improvements for found issues\n- 📝 **Additional Notes**: Context, environment specifics, alternative approaches\n\n---\n\n## Execution Plan\n\n1. **Phase 1**: Basic setup guides (install, environment, deployment)\n2. **Phase 2**: Core functionality (SSR, migration, authentication)\n3. **Phase 3**: Testing and debugging guides\n4. **Phase 4**: UI library integrations\n\nFor each guide:\n\n1. Create isolated test environment\n2. Follow guide step-by-step\n3. Document all findings\n4. Update checkbox when complete\n5. Move to next guide\n\nIf stuck on a guide after multiple attempts:\n\n- Document the blocking issues\n- Note what was attempted\n- Mark as \"needs investigation\"\n- Continue to next guide\n\n**Goal**: Complete validation of all how-to guides for accuracy and usability.\n\n---\n\n## Testing Results Summary\n\n### ✅ PASSED GUIDES (6/6 tested)\n\n- **install.md**: Updated to use Vite, complete setup with working router configuration\n- **use-environment-variables.md**: All Vite patterns work correctly, proper security, valid TypeScript\n- **deploy-to-production.md**: All deployment configurations accurate, build process works\n- **setup-ssr.md**: Fixed with correct TanStack Start manual setup instructions\n- **migrate-from-react-router.md**: All APIs accurate, patterns match working examples\n- **setup-authentication.md**: All patterns validated, fixed import and navigation issues\n\n### 🔍 KEY FINDINGS\n\n1. **Static Analysis Success**: Agent-friendly testing approach works effectively for validation\n2. **API Accuracy**: Most guides use correct imports and patterns from actual codebase\n3. **Fixed Critical Issues**: Updated deprecated tools (CRA→Vite) and CLI commands\n4. **Excellent Accuracy**: Most guides use correct APIs and patterns from actual codebase\n5. **Perfect Success Rate**: 100% pass rate (6/6) with static analysis approach\n\n### 📋 IMMEDIATE ACTION NEEDED\n\n1. ✅ **Fixed install.md**: Updated to use Vite with complete setup example\n2. ✅ **Fixed setup-ssr.md**: Corrected CLI commands and TanStack Start setup\n3. ✅ **Fixed setup-authentication.md**: Corrected import and navigation patterns\n4. **Continue Validation**: Apply static analysis approach to remaining 9 guides\n\n### 🎯 TESTING STATUS: 6/15 guides tested (40% complete)\n\n**Next Priority**: Continue validating remaining 9 guides with proven static analysis approach\n"
  },
  {
    "path": "knip.json",
    "content": "{\n  \"$schema\": \"https://unpkg.com/knip@5/schema.json\",\n  \"ignoreWorkspaces\": [\"examples/**\"]\n}\n"
  },
  {
    "path": "labeler-config.yml",
    "content": "'package: arktype-adapter':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/arktype-adapter/**/*'\n'package: eslint-plugin-router':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/eslint-plugin-router/**/*'\n'package: history':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/history/**/*'\n'package: nitro-v2-vite-plugin':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/nitro-v2-vite-plugin/**/*'\n'package: react-router':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/react-router/**/*'\n'package: react-router-devtools':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/react-router-devtools/**/*'\n'package: react-router-ssr-query':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/react-router-ssr-query/**/*'\n'package: react-start':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/react-start/**/*'\n'package: react-start-client':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/react-start-client/**/*'\n'package: react-start-server':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/react-start-server/**/*'\n'package: router-cli':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-cli/**/*'\n'package: router-core':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-core/**/*'\n'package: router-devtools':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-devtools/**/*'\n'package: router-devtools-core':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-devtools-core/**/*'\n'package: router-generator':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-generator/**/*'\n'package: router-plugin':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-plugin/**/*'\n'package: router-ssr-query-core':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-ssr-query-core/**/*'\n'package: router-utils':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-utils/**/*'\n'package: router-vite-plugin':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/router-vite-plugin/**/*'\n'package: solid-router':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/solid-router/**/*'\n'package: solid-router-devtools':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/solid-router-devtools/**/*'\n'package: solid-router-ssr-query':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/solid-router-ssr-query/**/*'\n'package: solid-start':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/solid-start/**/*'\n'package: solid-start-client':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/solid-start-client/**/*'\n'package: solid-start-server':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/solid-start-server/**/*'\n'package: start-client-core':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/start-client-core/**/*'\n'package: start-fn-stubs':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/start-fn-stubs/**/*'\n'package: start-plugin-core':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/start-plugin-core/**/*'\n'package: start-server-core':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/start-server-core/**/*'\n'package: start-static-server-functions':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/start-static-server-functions/**/*'\n'package: start-storage-context':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/start-storage-context/**/*'\n'package: valibot-adapter':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/valibot-adapter/**/*'\n'package: virtual-file-routes':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/virtual-file-routes/**/*'\n'package: vue-router':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/vue-router/**/*'\n'package: vue-router-devtools':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/vue-router-devtools/**/*'\n'package: vue-router-ssr-query':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/vue-router-ssr-query/**/*'\n'package: vue-start':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/vue-start/**/*'\n'package: vue-start-client':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/vue-start-client/**/*'\n'package: vue-start-server':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/vue-start-server/**/*'\n'package: zod-adapter':\n  - changed-files:\n      - any-glob-to-any-file: 'packages/zod-adapter/**/*'\n'documentation':\n  - changed-files:\n      - any-glob-to-any-file: 'docs/**/*'\n"
  },
  {
    "path": "nx.json",
    "content": "{\n  \"$schema\": \"./node_modules/nx/schemas/nx-schema.json\",\n  \"defaultBase\": \"main\",\n  \"nxCloudId\": \"6442f7de8226a6291646a813\",\n  \"useInferencePlugins\": false,\n  \"parallel\": 5,\n  \"tui\": {\n    \"enabled\": false\n  },\n  \"namedInputs\": {\n    \"sharedGlobals\": [\n      \"{workspaceRoot}/.nvmrc\",\n      \"{workspaceRoot}/package.json\",\n      \"{workspaceRoot}/tsconfig.json\"\n    ],\n    \"default\": [\n      \"sharedGlobals\",\n      \"{projectRoot}/**/*\",\n      \"!{projectRoot}/**/*.md\"\n    ],\n    \"production\": [\n      \"default\",\n      \"!{projectRoot}/tests/**/*\",\n      \"!{projectRoot}/eslint.config.js\"\n    ]\n  },\n  \"targetDefaults\": {\n    \"test:docs\": {\n      \"cache\": true,\n      \"inputs\": [\"{workspaceRoot}/docs/**/*\"]\n    },\n    \"test:eslint\": {\n      \"cache\": true,\n      \"dependsOn\": [\"^build\"],\n      \"inputs\": [\"default\", \"^production\", \"{workspaceRoot}/eslint.config.js\"]\n    },\n    \"test:unit\": {\n      \"cache\": true,\n      \"dependsOn\": [\"^build\"],\n      \"inputs\": [\"default\", \"^production\"],\n      \"outputs\": [\"{projectRoot}/coverage\"]\n    },\n    \"test:e2e\": {\n      \"cache\": true,\n      \"dependsOn\": [\"^build\"],\n      \"inputs\": [\"default\", \"^production\"]\n    },\n    \"test:e2e:nitro\": {\n      \"cache\": true,\n      \"dependsOn\": [\"^build\"],\n      \"inputs\": [\"default\", \"^production\"]\n    },\n    \"test:e2e:basepath\": {\n      \"cache\": true,\n      \"dependsOn\": [\"^build\"],\n      \"inputs\": [\"default\", \"^production\"]\n    },\n    \"test:types\": {\n      \"cache\": true,\n      \"dependsOn\": [\"^build\"],\n      \"inputs\": [\"default\", \"^production\"]\n    },\n    \"build\": {\n      \"cache\": true,\n      \"dependsOn\": [\"^build\"],\n      \"inputs\": [\"production\", \"^production\"],\n      \"outputs\": [\"{projectRoot}/build\", \"{projectRoot}/dist\"]\n    },\n    \"test:build\": {\n      \"cache\": true,\n      \"dependsOn\": [\"build\"],\n      \"inputs\": [\"production\"]\n    }\n  }\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"root\",\n  \"private\": true,\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\"\n  },\n  \"packageManager\": \"pnpm@10.28.0\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"cleanNodeModules\": \"pnpm -r exec rm -rf node_modules\",\n    \"clean\": \"pnpm --filter \\\"./packages/**\\\" run clean\",\n    \"test\": \"pnpm run test:ci\",\n    \"test:pr\": \"nx affected --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build\",\n    \"test:ci\": \"nx run-many --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build\",\n    \"test:eslint\": \"nx affected --target=test:eslint --exclude=examples/**,e2e/**\",\n    \"test:unit\": \"nx affected --target=test:unit --exclude=examples/**,e2e/**\",\n    \"test:unit:dev\": \"pnpm run test:unit && nx watch --all -- pnpm run test:unit\",\n    \"test:build\": \"nx affected --target=test:build --exclude=examples/**\",\n    \"test:types\": \"nx affected --target=test:types --exclude=examples/**\",\n    \"test:e2e\": \"nx run-many --target=test:e2e\",\n    \"benchmark:bundle-size\": \"pnpm nx run @benchmarks/bundle-size:build\",\n    \"benchmark:client-nav\": \"pnpm nx run @benchmarks/client-nav:test:perf\",\n    \"benchmark:ssr\": \"pnpm nx run @benchmarks/ssr:test:perf\",\n    \"build\": \"nx affected --target=build --exclude=e2e/** --exclude=examples/**\",\n    \"build:all\": \"nx run-many --target=build --exclude=examples/** --exclude=e2e/**\",\n    \"watch\": \"pnpm run build:all && nx watch --all -- pnpm run build:all\",\n    \"dev\": \"pnpm run watch\",\n    \"format\": \"prettier --experimental-cli --ignore-unknown '**/*' --write\",\n    \"changeset\": \"changeset\",\n    \"changeset:publish\": \"changeset publish\",\n    \"changeset:version\": \"changeset version && node scripts/update-example-deps.mjs && pnpm install --no-frozen-lockfile && pnpm format\",\n    \"gpt-generate\": \"node gpt/generate.js\",\n    \"set-ts-version\": \"node scripts/set-ts-version.js\",\n    \"labeler-generate\": \"node scripts/generate-labeler-config.ts\",\n    \"cleanup-empty-packages\": \"node scripts/cleanup-empty-packages.mjs\",\n    \"test:docs\": \"node scripts/verify-links.ts\",\n    \"vite-ecosystem-ci:build\": \"nx run-many --targets=build --projects=@tanstack/router-plugin,@tanstack/start-plugin-core,@tanstack/react-start,@tanstack/react-start-client,@tanstack/react-start-server --skipRemoteCache\",\n    \"vite-ecosystem-ci:before-test\": \"pnpm exec playwright install chromium\",\n    \"vite-ecosystem-ci:test\": \"nx run-many --targets=test:unit --projects=@tanstack/router-plugin,@tanstack/start-plugin-core,@tanstack/react-start-client --skipRemoteCache && nx run-many --target=test:e2e --projects=tanstack-router-e2e-react-basic-file-based,tanstack-router-e2e-react-basic-file-based-code-splitting,tanstack-react-start-e2e-basic --skipRemoteCache\"\n  },\n  \"nx\": {\n    \"includedScripts\": [\n      \"test:docs\"\n    ]\n  },\n  \"devDependencies\": {\n    \"@arethetypeswrong/cli\": \"^0.18.2\",\n    \"@changesets/cli\": \"^2.30.0\",\n    \"@eslint-react/eslint-plugin\": \"^1.26.2\",\n    \"@playwright/test\": \"^1.57.0\",\n    \"@svitejs/changesets-changelog-github-compact\": \"^1.2.0\",\n    \"@tanstack/eslint-config\": \"0.4.0\",\n    \"@tanstack/query-core\": \"^5.90.19\",\n    \"@tanstack/react-query\": \"^5.90.19\",\n    \"@tanstack/vite-config\": \"0.5.2\",\n    \"@types/node\": \"25.0.9\",\n    \"@types/react\": \"^19.2.8\",\n    \"@types/react-dom\": \"^19.2.3\",\n    \"@vitest/browser\": \"^4.0.17\",\n    \"@vitest/ui\": \"^4.0.17\",\n    \"eslint\": \"^9.22.0\",\n    \"eslint-plugin-react-hooks\": \"^5.1.0\",\n    \"eslint-plugin-unused-imports\": \"^4.1.4\",\n    \"jsdom\": \"^25.0.1\",\n    \"markdown-link-extractor\": \"^4.0.3\",\n    \"nx\": \"22.5.1\",\n    \"prettier\": \"^3.8.0\",\n    \"publint\": \"^0.3.16\",\n    \"react\": \"^19.2.3\",\n    \"react-dom\": \"^19.2.3\",\n    \"redaxios\": \"^0.5.1\",\n    \"rimraf\": \"^6.1.2\",\n    \"tinyglobby\": \"^0.2.15\",\n    \"typescript\": \"^5.9.3\",\n    \"typescript54\": \"npm:typescript@5.4\",\n    \"typescript55\": \"npm:typescript@5.5\",\n    \"typescript56\": \"npm:typescript@5.6\",\n    \"typescript57\": \"npm:typescript@5.7\",\n    \"typescript58\": \"npm:typescript@5.8\",\n    \"vite\": \"^8.0.0\",\n    \"vitest\": \"^4.0.17\"\n  },\n  \"pnpm\": {\n    \"overrides\": {\n      \"@types/babel__traverse\": \"^7.28.0\",\n      \"vite-plugin-dts\": \"4.2.3\",\n      \"solid-js\": \"1.9.10\",\n      \"react\": \"$react\",\n      \"react-dom\": \"$react-dom\",\n      \"@types/react\": \"$@types/react\",\n      \"@types/react-dom\": \"$@types/react-dom\",\n      \"eslint\": \"$eslint\",\n      \"vite\": \"$vite\",\n      \"@types/node\": \"$@types/node\",\n      \"@playwright/test\": \"$@playwright/test\",\n      \"@tanstack/react-query\": \"$@tanstack/react-query\",\n      \"@tanstack/query-core\": \"$@tanstack/query-core\",\n      \"@tanstack/history\": \"workspace:*\",\n      \"@tanstack/router-core\": \"workspace:*\",\n      \"@tanstack/react-router\": \"workspace:*\",\n      \"@tanstack/router-cli\": \"workspace:*\",\n      \"@tanstack/router-devtools\": \"workspace:*\",\n      \"@tanstack/router-devtools-core\": \"workspace:^\",\n      \"@tanstack/react-router-devtools\": \"workspace:^\",\n      \"@tanstack/solid-router-devtools\": \"workspace:^\",\n      \"@tanstack/router-generator\": \"workspace:*\",\n      \"@tanstack/virtual-file-routes\": \"workspace:*\",\n      \"@tanstack/router-plugin\": \"workspace:*\",\n      \"@tanstack/router-vite-plugin\": \"workspace:*\",\n      \"@tanstack/router-ssr-query-core\": \"workspace:*\",\n      \"@tanstack/react-router-ssr-query\": \"workspace:*\",\n      \"@tanstack/solid-router-ssr-query\": \"workspace:*\",\n      \"@tanstack/vue-router-ssr-query\": \"workspace:*\",\n      \"@tanstack/zod-adapter\": \"workspace:*\",\n      \"@tanstack/valibot-adapter\": \"workspace:*\",\n      \"@tanstack/arktype-adapter\": \"workspace:*\",\n      \"@tanstack/react-start\": \"workspace:*\",\n      \"@tanstack/react-start-client\": \"workspace:*\",\n      \"@tanstack/react-start-server\": \"workspace:*\",\n      \"@tanstack/solid-start\": \"workspace:*\",\n      \"@tanstack/solid-start-client\": \"workspace:*\",\n      \"@tanstack/solid-start-server\": \"workspace:*\",\n      \"@tanstack/vue-start\": \"workspace:*\",\n      \"@tanstack/vue-start-client\": \"workspace:*\",\n      \"@tanstack/vue-start-server\": \"workspace:*\",\n      \"@tanstack/start-plugin-core\": \"workspace:*\",\n      \"@tanstack/start-client-core\": \"workspace:*\",\n      \"@tanstack/start-server-core\": \"workspace:*\",\n      \"@tanstack/start-storage-context\": \"workspace:*\",\n      \"@tanstack/vue-router\": \"workspace:*\",\n      \"@tanstack/vue-router-devtools\": \"workspace:*\",\n      \"@tanstack/eslint-plugin-router\": \"workspace:*\",\n      \"@tanstack/router-utils\": \"workspace:*\",\n      \"@tanstack/start-static-server-functions\": \"workspace:*\",\n      \"@tanstack/nitro-v2-vite-plugin\": \"workspace:*\"\n    }\n  }\n}\n"
  },
  {
    "path": "packages/arktype-adapter/CHANGELOG.md",
    "content": "# @tanstack/arktype-adapter\n\n## 1.166.9\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n## 1.166.8\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n"
  },
  {
    "path": "packages/arktype-adapter/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/arktype-adapter/package.json",
    "content": "{\n  \"name\": \"@tanstack/arktype-adapter\",\n  \"version\": \"1.166.9\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/arktype-adapter\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:unit\": \"vitest\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch --typecheck\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"arktype\": \"^2.1.7\",\n    \"@testing-library/jest-dom\": \"^6.6.3\",\n    \"@testing-library/react\": \"^16.2.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"arktype\": \">=2.0.0-rc <3\",\n    \"@tanstack/react-router\": \">=1.43.2\"\n  }\n}\n"
  },
  {
    "path": "packages/arktype-adapter/src/index.ts",
    "content": "import type { ValidatorAdapter } from '@tanstack/react-router'\n\nexport interface ArkTypeLike {\n  infer: any\n  inferIn: any\n  assert: (input: any) => any\n}\n\nexport type ArkTypeValidatorAdapter<TOptions extends ArkTypeLike> =\n  ValidatorAdapter<TOptions['inferIn'], TOptions['infer']>\n\nexport const arkTypeValidator = <TOptions extends ArkTypeLike>(\n  options: TOptions,\n): ArkTypeValidatorAdapter<TOptions> => {\n  return {\n    types: {\n      input: options.inferIn,\n      output: options.infer,\n    },\n    parse: (input) => options.assert(input),\n  }\n}\n"
  },
  {
    "path": "packages/arktype-adapter/tests/index.test-d.ts",
    "content": "import {\n  Link,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport { expectTypeOf, test } from 'vitest'\nimport { type } from 'arktype'\nimport { arkTypeValidator } from '../src'\n\ntest('when creating a route with arktype validation', () => {\n  const rootRoute = createRootRoute({\n    validateSearch: arkTypeValidator(\n      type({\n        page: 'number = 0',\n      }),\n    ),\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    validateSearch: arkTypeValidator(\n      type({\n        indexPage: 'number = 0',\n      }),\n    ),\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(Link<typeof router, string, '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | true>()\n    .toEqualTypeOf<{ page?: number; indexPage?: number } | undefined>()\n\n  expectTypeOf(Link<typeof router, string, '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ page?: number; indexPage?: number }>()\n\n  expectTypeOf(Link<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ page: number } | { page: number; indexPage: number }>()\n\n  expectTypeOf(rootRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: number\n  }>()\n  expectTypeOf(rootRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: number\n  }>\n})\n\ntest('when using arktype schema with function', () => {\n  const rootRoute = createRootRoute({\n    validateSearch: (input) =>\n      type({\n        page: 'number = 0',\n      }).assert(input),\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    validateSearch: (input) =>\n      type({\n        indexPage: 'number = 0',\n      }).assert(input),\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(Link<typeof router, string, '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | true>()\n    .toEqualTypeOf<{ page: number; indexPage: number }>()\n\n  expectTypeOf(Link<typeof router, string, '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ page: number; indexPage: number }>()\n\n  expectTypeOf(Link<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ page: number } | { page: number; indexPage: number }>()\n\n  expectTypeOf(rootRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: number\n  }>()\n  expectTypeOf(rootRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: number\n  }>\n})\n"
  },
  {
    "path": "packages/arktype-adapter/tests/index.test.tsx",
    "content": "import {\n  Link,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '@tanstack/react-router'\nimport { cleanup, fireEvent, render, screen } from '@testing-library/react'\nimport { afterEach, expect, test, vi } from 'vitest'\nimport { type } from 'arktype'\nimport { arkTypeValidator } from '../src'\nimport '@testing-library/jest-dom/vitest'\n\nafterEach(() => {\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ntest('when navigating to a route with arkTypeValidator', async () => {\n  const rootRoute = createRootRoute()\n\n  const Index = () => {\n    return (\n      <>\n        <h1>Index</h1>\n        <Link<typeof router, string, '/invoices'>\n          to=\"/invoices\"\n          search={{\n            page: 0,\n          }}\n        >\n          To Invoices\n        </Link>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: Index,\n  })\n\n  const Invoices = () => {\n    const search = invoicesRoute.useSearch()\n\n    return (\n      <>\n        <h1>Invoices</h1>\n        <span>Page: {search.page}</span>\n      </>\n    )\n  }\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    validateSearch: arkTypeValidator(\n      type({\n        page: 'number',\n      }),\n    ),\n    component: Invoices,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, invoicesRoute])\n  const router = createRouter({ routeTree })\n\n  render(<RouterProvider router={router} />)\n\n  const invoicesLink = await screen.findByRole('link', {\n    name: 'To Invoices',\n  })\n\n  fireEvent.click(invoicesLink)\n\n  expect(await screen.findByText('Page: 0')).toBeInTheDocument()\n})\n"
  },
  {
    "path": "packages/arktype-adapter/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\"\n  },\n  \"include\": [\"src\", \"tests\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/arktype-adapter/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/eslint-plugin-router/.attw.json",
    "content": "{\n  \"ignoreRules\": [\"false-export-default\"]\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/CHANGELOG.md",
    "content": "# @tanstack/eslint-plugin-router\n\n## 1.161.6\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n## 1.161.5\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n"
  },
  {
    "path": "packages/eslint-plugin-router/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/eslint-plugin-router/package.json",
    "content": "{\n  \"name\": \"@tanstack/eslint-plugin-router\",\n  \"version\": \"1.161.6\",\n  \"description\": \"ESLint plugin for TanStack Router\",\n  \"author\": \"Manuel Schiller\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/eslint-plugin-router\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:unit\": \"vitest\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch --typecheck\",\n    \"test:build\": \"publint --strict && attw --pack .\",\n    \"build\": \"vite build && tsc --noEmit\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"dependencies\": {\n    \"@typescript-eslint/utils\": \"^8.23.0\"\n  },\n  \"devDependencies\": {\n    \"@typescript-eslint/rule-tester\": \"^8.23.0\",\n    \"combinate\": \"^1.1.11\",\n    \"eslint\": \"^9.22.0\",\n    \"vite\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"eslint\": \"^8.57.0 || ^9.0.0 || ^10.0.0\"\n  }\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/__tests__/create-route-property-order.rule.test.ts",
    "content": "import { RuleTester } from '@typescript-eslint/rule-tester'\nimport combinate from 'combinate'\n\nimport {\n  name,\n  rule,\n} from '../rules/create-route-property-order/create-route-property-order.rule'\nimport {\n  checkedProperties,\n  createRouteFunctionsDirect,\n  createRouteFunctionsIndirect,\n} from '../rules/create-route-property-order/constants'\nimport {\n  generateInterleavedCombinations,\n  generatePartialCombinations,\n  generatePermutations,\n  normalizeIndent,\n} from './test-utils'\n\nconst ruleTester = new RuleTester()\n\n// reduce the number of test cases by only testing a subset of the checked properties\nconst testedCheckedProperties = [\n  checkedProperties[0]!,\n  checkedProperties[1]!,\n  checkedProperties[2]!,\n  checkedProperties[3]!,\n]\ntype TestedCheckedProperties = (typeof testedCheckedProperties)[number]\nconst orderIndependentProps = ['gcTime', '...foo'] as const\ntype OrderIndependentProps = (typeof orderIndependentProps)[number]\n\n// reduce the number of test cases by only testing the first function of createRouteFunctionsDirect\nconst testedCreateRouteFunctions = [\n  ...createRouteFunctionsIndirect,\n  createRouteFunctionsDirect[0],\n]\ntype TestedCreateRouteFunction = (typeof testedCreateRouteFunctions)[number]\n\ninterface TestCase {\n  createRouteFunction: TestedCreateRouteFunction\n  properties: Array<TestedCheckedProperties | OrderIndependentProps>\n}\n\nconst validTestMatrix = combinate({\n  createRouteFunction: testedCreateRouteFunctions,\n  properties: generatePartialCombinations(testedCheckedProperties, 2),\n})\n\nexport function generateInvalidPermutations(\n  arr: ReadonlyArray<TestedCheckedProperties>,\n): Array<{\n  invalid: Array<TestedCheckedProperties>\n  valid: Array<TestedCheckedProperties>\n}> {\n  const combinations = generatePartialCombinations(arr, 2)\n  const allPermutations: Array<{\n    invalid: Array<TestedCheckedProperties>\n    valid: Array<TestedCheckedProperties>\n  }> = []\n\n  for (const combination of combinations) {\n    const permutations = generatePermutations(combination)\n    // skip the first permutation as it matches the original combination\n    const invalidPermutations = permutations.slice(1)\n\n    if (\n      combination.includes('params') &&\n      combination.includes('validateSearch')\n    ) {\n      if (\n        combination.indexOf('params') < combination.indexOf('validateSearch')\n      ) {\n        // since we ignore the relative order of 'params' and 'validateSearch', we skip this combination (but keep the other one where `validateSearch` is before `params`)\n        continue\n      }\n    }\n\n    allPermutations.push(\n      ...invalidPermutations.map((p) => {\n        // ignore the relative order of 'params' and 'validateSearch'\n        const correctedValid = [...combination].sort((a, b) => {\n          if (\n            (a === 'params' && b === 'validateSearch') ||\n            (a === 'validateSearch' && b === 'params')\n          ) {\n            return p.indexOf(a) - p.indexOf(b)\n          }\n          return checkedProperties.indexOf(a) - checkedProperties.indexOf(b)\n        })\n        return { invalid: p, valid: correctedValid }\n      }),\n    )\n  }\n\n  return allPermutations\n}\n\nconst invalidPermutations = generateInvalidPermutations(testedCheckedProperties)\n\ntype Interleaved = TestedCheckedProperties | OrderIndependentProps\nconst interleavedInvalidPermutations: Array<{\n  invalid: Array<Interleaved>\n  valid: Array<Interleaved>\n}> = []\nfor (const invalidPermutation of invalidPermutations) {\n  const invalid = generateInterleavedCombinations(\n    invalidPermutation.invalid,\n    orderIndependentProps,\n  )\n  const valid = generateInterleavedCombinations(\n    invalidPermutation.valid,\n    orderIndependentProps,\n  )\n\n  for (let i = 0; i < invalid.length; i++) {\n    interleavedInvalidPermutations.push({\n      invalid: invalid[i]!,\n      valid: valid[i]!,\n    })\n  }\n}\n\nconst invalidTestMatrix = combinate({\n  createRouteFunction: testedCreateRouteFunctions,\n  properties: interleavedInvalidPermutations,\n})\n\nfunction getCode({ createRouteFunction, properties }: TestCase) {\n  let invocation = ''\n  switch (createRouteFunction) {\n    case 'createFileRoute': {\n      invocation = `('/_layout/hello/foo/$id')`\n      break\n    }\n    case 'createRootRouteWithContext': {\n      invocation = normalizeIndent`\n      <{\n          queryClient: QueryClient\n       }>()`\n      break\n    }\n  }\n  function getPropertyCode(\n    property: TestedCheckedProperties | OrderIndependentProps,\n  ) {\n    if (property.startsWith('...')) {\n      return property\n    }\n    return `${property}: () => null`\n  }\n  return `\n    import { ${createRouteFunction} } from '@tanstack/react-router'\n\n    const Route = ${createRouteFunction}${invocation}({\n        ${properties.map(getPropertyCode).join(',\\n        ')}\n    })\n  `\n}\n\nconst validTestCases = validTestMatrix.map(\n  ({ createRouteFunction, properties }) => ({\n    name: `should pass when order is correct for ${createRouteFunction} with order: ${properties.join(', ')}`,\n    code: getCode({ createRouteFunction, properties }),\n  }),\n)\n\ninvalidTestMatrix.push({\n  createRouteFunction: 'createFileRoute',\n  properties: {\n    invalid: ['loader', 'loaderDeps'],\n    valid: ['loaderDeps', 'loader'],\n  },\n})\n\ninvalidTestMatrix.push({\n  createRouteFunction: 'createFileRoute',\n  properties: { invalid: ['head', 'loader'], valid: ['loader', 'head'] },\n})\n\nconst invalidTestCases = invalidTestMatrix.map(\n  ({ createRouteFunction, properties }) => ({\n    name: `incorrect property order is detected for ${createRouteFunction} with order: ${properties.invalid.join(', ')}`,\n    code: getCode({\n      createRouteFunction,\n      properties: properties.invalid,\n    }),\n    errors: [{ messageId: 'invalidOrder' }],\n    output: getCode({\n      createRouteFunction,\n      properties: properties.valid,\n    }),\n  }),\n)\n\nruleTester.run(name, rule, {\n  valid: validTestCases,\n  invalid: invalidTestCases,\n})\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/__tests__/create-route-property-order.utils.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport {\n  getCheckedProperties,\n  sortDataByOrder,\n} from '../rules/create-route-property-order/create-route-property-order.utils'\n\ndescribe('create-route-property-order utils', () => {\n  describe('sortDataByOrder', () => {\n    const testCases = [\n      {\n        data: [{ key: 'a' }, { key: 'c' }, { key: 'b' }],\n        orderArray: [\n          [['a'], ['b']],\n          [['b'], ['c']],\n        ],\n        key: 'key',\n        expected: [{ key: 'a' }, { key: 'b' }, { key: 'c' }],\n      },\n      {\n        data: [{ key: 'b' }, { key: 'a' }, { key: 'c' }],\n        orderArray: [\n          [['a'], ['b']],\n          [['b'], ['c']],\n        ],\n        key: 'key',\n        expected: [{ key: 'a' }, { key: 'b' }, { key: 'c' }],\n      },\n      {\n        data: [{ key: 'a' }, { key: 'b' }, { key: 'c' }],\n        orderArray: [\n          [['a'], ['b']],\n          [['b'], ['c']],\n        ],\n        key: 'key',\n        expected: null,\n      },\n      {\n        data: [{ key: 'a' }, { key: 'b' }, { key: 'c' }, { key: 'd' }],\n        orderArray: [\n          [['a'], ['b']],\n          [['b'], ['c']],\n        ],\n        key: 'key',\n        expected: null,\n      },\n      {\n        data: [{ key: 'a' }, { key: 'b' }, { key: 'd' }, { key: 'c' }],\n        orderArray: [\n          [['a'], ['b']],\n          [['b'], ['c']],\n        ],\n        key: 'key',\n        expected: null,\n      },\n      {\n        data: [{ key: 'd' }, { key: 'a' }, { key: 'b' }, { key: 'c' }],\n        orderArray: [\n          [['a'], ['b']],\n          [['b'], ['c']],\n        ],\n        key: 'key',\n        expected: null,\n      },\n      {\n        data: [{ key: 'd' }, { key: 'b' }, { key: 'a' }, { key: 'c' }],\n        orderArray: [\n          [['a'], ['b']],\n          [['b'], ['c']],\n        ],\n        key: 'key',\n        expected: [{ key: 'd' }, { key: 'a' }, { key: 'b' }, { key: 'c' }],\n      },\n      {\n        data: [{ key: 'd' }, { key: 'b' }, { key: 'a' }, { key: 'c' }],\n        orderArray: [\n          [['a', 'b'], ['d']],\n          [['d'], ['c']],\n        ],\n        key: 'key',\n        expected: [{ key: 'b' }, { key: 'a' }, { key: 'd' }, { key: 'c' }],\n      },\n      {\n        data: [\n          { key: 'd' },\n          { key: 'b' },\n          { key: 'a' },\n          { key: 'c' },\n          { key: 'f' },\n        ],\n        orderArray: [\n          [\n            ['a', 'b'],\n            ['d', 'f'],\n          ],\n          [['d'], ['c']],\n        ],\n        key: 'key',\n        expected: [\n          { key: 'b' },\n          { key: 'a' },\n          { key: 'd' },\n          { key: 'f' },\n          { key: 'c' },\n        ],\n      },\n      {\n        data: [\n          { key: 'd' },\n          { key: 'b' },\n          { key: 'a' },\n          { key: 'c' },\n          { key: 'f' },\n        ],\n        orderArray: [\n          [\n            ['a', 'b'],\n            ['d', 'f'],\n          ],\n          [['d', 'f'], ['c']],\n        ],\n        key: 'key',\n        expected: [\n          { key: 'b' },\n          { key: 'a' },\n          { key: 'd' },\n          { key: 'f' },\n          { key: 'c' },\n        ],\n      },\n    ] as const\n    test.each(testCases)(\n      '$data $orderArray $key $expected',\n      ({ data, orderArray, key, expected }) => {\n        const sortedData = sortDataByOrder(data, orderArray, key)\n        expect(sortedData).toEqual(expected)\n      },\n    )\n  })\n})\n\ndescribe('getCheckedProperties', () => {\n  const testCases = [\n    {\n      orderRules: [\n        [['a', 'b'], ['c']],\n        [['c'], ['d']],\n      ],\n      expected: ['a', 'b', 'c', 'd'],\n    },\n    {\n      orderRules: [\n        [['a', 'b'], ['c']],\n        [['d'], ['e']],\n      ],\n      expected: ['a', 'b', 'c', 'd', 'e'],\n    },\n    {\n      orderRules: [\n        [['a', 'b'], ['c']],\n        [['d'], ['e']],\n        [['c'], ['f']],\n      ],\n      expected: ['a', 'b', 'c', 'd', 'e', 'f'],\n    },\n    {\n      orderRules: [\n        [['a', 'b'], ['c']],\n        [['d'], ['e']],\n        [['c'], ['f']],\n        [['f'], ['g']],\n      ],\n      expected: ['a', 'b', 'c', 'd', 'e', 'f', 'g'],\n    },\n  ] as const\n  test.each(testCases)('$orderRules $expected', ({ orderRules, expected }) => {\n    const checkedProperties = getCheckedProperties(orderRules)\n    expect(checkedProperties).toEqual(expected)\n  })\n})\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/__tests__/route-param-names.rule.test.ts",
    "content": "import { RuleTester } from '@typescript-eslint/rule-tester'\n\nimport { name, rule } from '../rules/route-param-names/route-param-names.rule'\n\nconst ruleTester = new RuleTester()\n\nruleTester.run(name, rule, {\n  valid: [\n    // Valid param names - simple $param format\n    {\n      name: 'valid simple param: $userId',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/$userId')({})\n      `,\n    },\n    {\n      name: 'valid simple param: $id',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/posts/$id')({})\n      `,\n    },\n    {\n      name: 'valid simple param: $_id (underscore prefix)',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/items/$_id')({})\n      `,\n    },\n    {\n      name: 'valid simple param: $$var (dollar prefix)',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/data/$$var')({})\n      `,\n    },\n    {\n      name: 'valid param with numbers: $user123',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/$user123')({})\n      `,\n    },\n\n    // Valid param names - braces format {$param}\n    {\n      name: 'valid braces param: {$userName}',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/{$userName}')({})\n      `,\n    },\n    {\n      name: 'valid braces param with prefix/suffix: prefix{$id}suffix',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/items/item-{$id}-details')({})\n      `,\n    },\n\n    // Valid optional params - {-$param}\n    {\n      name: 'valid optional param: {-$optional}',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/search/{-$query}')({})\n      `,\n    },\n    {\n      name: 'valid optional param with prefix/suffix: prefix{-$opt}suffix',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/filter/by-{-$category}-items')({})\n      `,\n    },\n\n    // Wildcards - should be skipped (no validation)\n    {\n      name: 'wildcard: $ alone',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/files/$')({})\n      `,\n    },\n    {\n      name: 'wildcard: {$}',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/catch/{$}')({})\n      `,\n    },\n\n    // Multiple valid params\n    {\n      name: 'multiple valid params in path',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/$userId/posts/$postId')({})\n      `,\n    },\n\n    // createRoute with path property\n    {\n      name: 'createRoute with valid param in path property',\n      code: `\n        import { createRoute } from '@tanstack/react-router'\n        const Route = createRoute({ path: '/users/$userId' })\n      `,\n    },\n\n    // createLazyFileRoute\n    {\n      name: 'createLazyFileRoute with valid param',\n      code: `\n        import { createLazyFileRoute } from '@tanstack/react-router'\n        const Route = createLazyFileRoute('/users/$userId')({})\n      `,\n    },\n\n    // createLazyRoute\n    {\n      name: 'createLazyRoute with valid param',\n      code: `\n        import { createLazyRoute } from '@tanstack/react-router'\n        const Route = createLazyRoute('/users/$userId')({})\n      `,\n    },\n\n    // No params - should pass\n    {\n      name: 'no params in path',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/list')({})\n      `,\n    },\n\n    // Not from tanstack router - should be ignored\n    {\n      name: 'non-tanstack import should be ignored',\n      code: `\n        import { createFileRoute } from 'other-router'\n        const Route = createFileRoute('/users/$123invalid')({})\n      `,\n    },\n  ],\n\n  invalid: [\n    // Invalid param names - starts with number\n    {\n      name: 'invalid param starting with number: $123',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/$123')({})\n      `,\n      errors: [{ messageId: 'invalidParamName', data: { paramName: '123' } }],\n    },\n    {\n      name: 'invalid param starting with number: $1user',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/$1user')({})\n      `,\n      errors: [{ messageId: 'invalidParamName', data: { paramName: '1user' } }],\n    },\n\n    // Invalid param names - contains hyphen\n    {\n      name: 'invalid param with hyphen: $user-name',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/$user-name')({})\n      `,\n      errors: [\n        { messageId: 'invalidParamName', data: { paramName: 'user-name' } },\n      ],\n    },\n\n    // Invalid param names - contains dot\n    {\n      name: 'invalid param with dot: {$my.param}',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/{$my.param}')({})\n      `,\n      errors: [\n        { messageId: 'invalidParamName', data: { paramName: 'my.param' } },\n      ],\n    },\n\n    // Invalid param names - contains space\n    {\n      name: 'invalid param with space: {$param name}',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/{$param name}')({})\n      `,\n      errors: [\n        { messageId: 'invalidParamName', data: { paramName: 'param name' } },\n      ],\n    },\n\n    // Invalid optional param\n    {\n      name: 'invalid optional param: {-$123invalid}',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/search/{-$123invalid}')({})\n      `,\n      errors: [\n        { messageId: 'invalidParamName', data: { paramName: '123invalid' } },\n      ],\n    },\n\n    // Multiple invalid params\n    {\n      name: 'multiple invalid params in path',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/users/$1id/posts/$post-id')({})\n      `,\n      errors: [\n        { messageId: 'invalidParamName', data: { paramName: '1id' } },\n        { messageId: 'invalidParamName', data: { paramName: 'post-id' } },\n      ],\n    },\n\n    // createRoute with invalid path property\n    {\n      name: 'createRoute with invalid param in path property',\n      code: `\n        import { createRoute } from '@tanstack/react-router'\n        const Route = createRoute({ path: '/users/$123' })\n      `,\n      errors: [{ messageId: 'invalidParamName', data: { paramName: '123' } }],\n    },\n\n    // createLazyFileRoute with invalid param\n    {\n      name: 'createLazyFileRoute with invalid param',\n      code: `\n        import { createLazyFileRoute } from '@tanstack/react-router'\n        const Route = createLazyFileRoute('/users/$user-id')({})\n      `,\n      errors: [\n        { messageId: 'invalidParamName', data: { paramName: 'user-id' } },\n      ],\n    },\n\n    // createLazyRoute with invalid param\n    {\n      name: 'createLazyRoute with invalid param',\n      code: `\n        import { createLazyRoute } from '@tanstack/react-router'\n        const Route = createLazyRoute('/users/$1abc')({})\n      `,\n      errors: [{ messageId: 'invalidParamName', data: { paramName: '1abc' } }],\n    },\n\n    // Invalid braces param with prefix/suffix\n    {\n      name: 'invalid braces param with prefix/suffix',\n      code: `\n        import { createFileRoute } from '@tanstack/react-router'\n        const Route = createFileRoute('/items/item-{$123}-details')({})\n      `,\n      errors: [{ messageId: 'invalidParamName', data: { paramName: '123' } }],\n    },\n  ],\n})\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/__tests__/route-param-names.utils.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport {\n  extractParamsFromPath,\n  extractParamsFromSegment,\n  getInvalidParams,\n  isValidParamName,\n} from '../rules/route-param-names/route-param-names.utils'\n\ndescribe('isValidParamName', () => {\n  it('should return true for valid param names', () => {\n    expect(isValidParamName('userId')).toBe(true)\n    expect(isValidParamName('id')).toBe(true)\n    expect(isValidParamName('_id')).toBe(true)\n    expect(isValidParamName('$var')).toBe(true)\n    expect(isValidParamName('user123')).toBe(true)\n    expect(isValidParamName('_')).toBe(true)\n    expect(isValidParamName('$')).toBe(true)\n    expect(isValidParamName('ABC')).toBe(true)\n    expect(isValidParamName('camelCase')).toBe(true)\n    expect(isValidParamName('PascalCase')).toBe(true)\n    expect(isValidParamName('snake_case')).toBe(true)\n    expect(isValidParamName('$$double')).toBe(true)\n    expect(isValidParamName('__double')).toBe(true)\n  })\n\n  it('should return false for invalid param names', () => {\n    expect(isValidParamName('123')).toBe(false)\n    expect(isValidParamName('1user')).toBe(false)\n    expect(isValidParamName('user-name')).toBe(false)\n    expect(isValidParamName('user.name')).toBe(false)\n    expect(isValidParamName('user name')).toBe(false)\n    expect(isValidParamName('')).toBe(false)\n    expect(isValidParamName('user@name')).toBe(false)\n    expect(isValidParamName('user#name')).toBe(false)\n    expect(isValidParamName('-user')).toBe(false)\n  })\n})\n\ndescribe('extractParamsFromSegment', () => {\n  it('should return empty array for segments without $', () => {\n    expect(extractParamsFromSegment('')).toEqual([])\n    expect(extractParamsFromSegment('users')).toEqual([])\n    expect(extractParamsFromSegment('static-segment')).toEqual([])\n  })\n\n  it('should skip wildcard segments', () => {\n    expect(extractParamsFromSegment('$')).toEqual([])\n    expect(extractParamsFromSegment('{$}')).toEqual([])\n  })\n\n  it('should extract simple $param format', () => {\n    const result = extractParamsFromSegment('$userId')\n    expect(result).toHaveLength(1)\n    expect(result[0]).toEqual({\n      fullParam: '$userId',\n      paramName: 'userId',\n      isOptional: false,\n      isValid: true,\n    })\n  })\n\n  it('should extract braces {$param} format', () => {\n    const result = extractParamsFromSegment('{$userId}')\n    expect(result).toHaveLength(1)\n    expect(result[0]).toEqual({\n      fullParam: '$userId',\n      paramName: 'userId',\n      isOptional: false,\n      isValid: true,\n    })\n  })\n\n  it('should extract braces with prefix/suffix', () => {\n    const result = extractParamsFromSegment('prefix{$id}suffix')\n    expect(result).toHaveLength(1)\n    expect(result[0]).toEqual({\n      fullParam: '$id',\n      paramName: 'id',\n      isOptional: false,\n      isValid: true,\n    })\n  })\n\n  it('should extract optional {-$param} format', () => {\n    const result = extractParamsFromSegment('{-$optional}')\n    expect(result).toHaveLength(1)\n    expect(result[0]).toEqual({\n      fullParam: '-$optional',\n      paramName: 'optional',\n      isOptional: true,\n      isValid: true,\n    })\n  })\n\n  it('should extract optional with prefix/suffix', () => {\n    const result = extractParamsFromSegment('pre{-$opt}post')\n    expect(result).toHaveLength(1)\n    expect(result[0]).toEqual({\n      fullParam: '-$opt',\n      paramName: 'opt',\n      isOptional: true,\n      isValid: true,\n    })\n  })\n\n  it('should mark invalid param names', () => {\n    const result = extractParamsFromSegment('$123invalid')\n    expect(result).toHaveLength(1)\n    expect(result[0]?.isValid).toBe(false)\n    expect(result[0]?.paramName).toBe('123invalid')\n  })\n\n  it('should mark hyphenated param names as invalid', () => {\n    const result = extractParamsFromSegment('$user-name')\n    expect(result).toHaveLength(1)\n    expect(result[0]?.isValid).toBe(false)\n    expect(result[0]?.paramName).toBe('user-name')\n  })\n})\n\ndescribe('extractParamsFromPath', () => {\n  it('should return empty array for paths without params', () => {\n    expect(extractParamsFromPath('')).toEqual([])\n    expect(extractParamsFromPath('/')).toEqual([])\n    expect(extractParamsFromPath('/users/list')).toEqual([])\n  })\n\n  it('should extract single param from path', () => {\n    const result = extractParamsFromPath('/users/$userId')\n    expect(result).toHaveLength(1)\n    expect(result[0]?.paramName).toBe('userId')\n  })\n\n  it('should extract multiple params from path', () => {\n    const result = extractParamsFromPath('/users/$userId/posts/$postId')\n    expect(result).toHaveLength(2)\n    expect(result[0]?.paramName).toBe('userId')\n    expect(result[1]?.paramName).toBe('postId')\n  })\n\n  it('should extract params with various formats', () => {\n    const result = extractParamsFromPath(\n      '/a/$simple/b/{$braces}/c/{-$optional}',\n    )\n    expect(result).toHaveLength(3)\n    expect(result[0]?.paramName).toBe('simple')\n    expect(result[0]?.isOptional).toBe(false)\n    expect(result[1]?.paramName).toBe('braces')\n    expect(result[1]?.isOptional).toBe(false)\n    expect(result[2]?.paramName).toBe('optional')\n    expect(result[2]?.isOptional).toBe(true)\n  })\n})\n\ndescribe('getInvalidParams', () => {\n  it('should return empty array for valid params', () => {\n    expect(getInvalidParams('/users/$userId')).toEqual([])\n    expect(getInvalidParams('/users/$_id')).toEqual([])\n    expect(getInvalidParams('/users/$$var')).toEqual([])\n  })\n\n  it('should return invalid params only', () => {\n    const result = getInvalidParams('/users/$123/posts/$validId')\n    expect(result).toHaveLength(1)\n    expect(result[0]?.paramName).toBe('123')\n  })\n\n  it('should return all invalid params', () => {\n    const result = getInvalidParams('/users/$1id/posts/$post-id')\n    expect(result).toHaveLength(2)\n    expect(result[0]?.paramName).toBe('1id')\n    expect(result[1]?.paramName).toBe('post-id')\n  })\n})\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/__tests__/test-utils.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport {\n  expectArrayEqualIgnoreOrder,\n  generateInterleavedCombinations,\n  generatePartialCombinations,\n  generatePermutations,\n} from './test-utils'\n\ndescribe('test-utils', () => {\n  describe('generatePermutations', () => {\n    const testCases = [\n      {\n        input: ['a', 'b', 'c'],\n        expected: [\n          ['a', 'b', 'c'],\n          ['a', 'c', 'b'],\n          ['b', 'a', 'c'],\n          ['b', 'c', 'a'],\n          ['c', 'a', 'b'],\n          ['c', 'b', 'a'],\n        ],\n      },\n      {\n        input: ['a', 'b'],\n        expected: [\n          ['a', 'b'],\n          ['b', 'a'],\n        ],\n      },\n      {\n        input: ['a'],\n        expected: [['a']],\n      },\n    ]\n    test.each(testCases)('$input $expected', ({ input, expected }) => {\n      const permutations = generatePermutations(input)\n      expect(permutations).toEqual(expected)\n    })\n  })\n\n  describe('generatePartialCombinations', () => {\n    const testCases = [\n      {\n        input: ['a', 'b', 'c'],\n        minLength: 2,\n        expected: [\n          ['a', 'b'],\n          ['a', 'c'],\n          ['b', 'c'],\n          ['a', 'b', 'c'],\n        ],\n      },\n      {\n        input: ['a', 'b'],\n        expected: [['a', 'b']],\n        minLength: 2,\n      },\n      {\n        input: ['a'],\n        expected: [],\n        minLength: 2,\n      },\n      {\n        input: ['a'],\n        expected: [['a']],\n        minLength: 1,\n      },\n      {\n        input: ['a'],\n        expected: [[], ['a']],\n        minLength: 0,\n      },\n    ]\n    test.each(testCases)(\n      '$input $minLength $expected ',\n      ({ input, minLength, expected }) => {\n        const combinations = generatePartialCombinations(input, minLength)\n        expectArrayEqualIgnoreOrder(combinations, expected)\n      },\n    )\n  })\n\n  describe('generateInterleavedCombinations', () => {\n    const testCases = [\n      {\n        data: ['a', 'b'],\n        additional: ['x'],\n        expected: [\n          ['a', 'b'],\n          ['x', 'a', 'b'],\n          ['a', 'x', 'b'],\n          ['a', 'b', 'x'],\n        ],\n      },\n    ]\n    test.each(testCases)(\n      '$input $expected',\n      ({ data, additional, expected }) => {\n        const combinations = generateInterleavedCombinations(data, additional)\n        expectArrayEqualIgnoreOrder(combinations, expected)\n      },\n    )\n  })\n})\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/__tests__/test-utils.ts",
    "content": "import { expect } from 'vitest'\n\nexport function generatePermutations<T>(arr: Array<T>): Array<Array<T>> {\n  if (arr.length <= 1) {\n    return [arr]\n  }\n\n  const result: Array<Array<T>> = []\n  for (let i = 0; i < arr.length; i++) {\n    const rest = arr.slice(0, i).concat(arr.slice(i + 1))\n    const restPermutations = generatePermutations(rest)\n    for (const perm of restPermutations) {\n      result.push([arr[i]!, ...perm])\n    }\n  }\n\n  return result\n}\n\nexport function generatePartialCombinations<T>(\n  arr: ReadonlyArray<T>,\n  minLength: number,\n): Array<Array<T>> {\n  const result: Array<Array<T>> = []\n\n  function backtrack(start: number, current: Array<T>) {\n    if (current.length > minLength - 1) {\n      result.push([...current])\n    }\n    for (let i = start; i < arr.length; i++) {\n      current.push(arr[i]!)\n      backtrack(i + 1, current)\n      current.pop()\n    }\n  }\n  backtrack(0, [])\n  return result\n}\n\nexport function expectArrayEqualIgnoreOrder<T>(a: Array<T>, b: Array<T>) {\n  expect([...a].sort()).toEqual([...b].sort())\n}\n\nexport function normalizeIndent(template: TemplateStringsArray) {\n  const codeLines = template[0]?.split('\\n') ?? ['']\n  const leftPadding = codeLines[1]?.match(/\\s+/)?.[0] ?? ''\n  return codeLines.map((line) => line.slice(leftPadding.length)).join('\\n')\n}\n\nexport function generateInterleavedCombinations<\n  TData,\n  TAdditional,\n  TResult extends TData | TAdditional,\n>(\n  data: Array<TData> | ReadonlyArray<TData>,\n  additional: Array<TAdditional> | ReadonlyArray<TAdditional>,\n): Array<Array<TResult>> {\n  const result: Array<Array<TResult>> = []\n\n  function getSubsets(array: Array<TAdditional>): Array<Array<TAdditional>> {\n    return array.reduce(\n      (subsets, value) => {\n        return subsets.concat(subsets.map((set) => [...set, value]))\n      },\n      [[]] as Array<Array<TAdditional>>,\n    )\n  }\n\n  function insertAtPositions(\n    data: Array<TResult>,\n    subset: Array<TResult>,\n  ): Array<Array<TResult>> {\n    const combinations: Array<Array<TResult>> = []\n\n    const recurse = (\n      currentData: Array<TResult>,\n      currentSubset: Array<TResult>,\n      start: number,\n    ): void => {\n      if (currentSubset.length === 0) {\n        combinations.push([...currentData])\n        return\n      }\n\n      for (let i = start; i <= currentData.length; i++) {\n        const newData = [\n          ...currentData.slice(0, i),\n          currentSubset[0]!,\n          ...currentData.slice(i),\n        ]\n        recurse(newData, currentSubset.slice(1), i + 1)\n      }\n    }\n\n    recurse(data, subset, 0)\n    return combinations\n  }\n\n  const subsets = getSubsets(additional as Array<TAdditional>)\n\n  subsets.forEach((subset) => {\n    result.push(\n      ...insertAtPositions(data as Array<TResult>, subset as Array<TResult>),\n    )\n  })\n\n  return result\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/index.ts",
    "content": "import { rules } from './rules'\nimport type { ESLint, Linter } from 'eslint'\nimport type { RuleModule } from '@typescript-eslint/utils/ts-eslint'\n\ntype RuleKey = keyof typeof rules\n\ninterface Plugin extends Omit<ESLint.Plugin, 'rules'> {\n  rules: Record<RuleKey, RuleModule<any, any, any>>\n  configs: {\n    recommended: ESLint.ConfigData\n    'flat/recommended': Array<Linter.FlatConfig>\n  }\n}\n\nconst plugin: Plugin = {\n  meta: {\n    name: '@tanstack/eslint-plugin-router',\n  },\n  configs: {} as Plugin['configs'],\n  rules,\n}\n\n// Assign configs here so we can reference `plugin`\nObject.assign(plugin.configs, {\n  recommended: {\n    plugins: ['@tanstack/eslint-plugin-router'],\n    rules: {\n      '@tanstack/router/create-route-property-order': 'warn',\n      '@tanstack/router/route-param-names': 'error',\n    },\n  },\n  'flat/recommended': [\n    {\n      plugins: {\n        '@tanstack/router': plugin,\n      },\n      rules: {\n        '@tanstack/router/create-route-property-order': 'warn',\n        '@tanstack/router/route-param-names': 'error',\n      },\n    },\n  ],\n})\n\nexport default plugin\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/rules/create-route-property-order/constants.ts",
    "content": "import { getCheckedProperties } from './create-route-property-order.utils'\n\nexport const createRouteFunctionsIndirect = [\n  'createFileRoute',\n  'createRootRouteWithContext',\n] as const\nexport const createRouteFunctionsDirect = [\n  'createRootRoute',\n  'createRoute',\n] as const\n\nexport const createRouteFunctions = [\n  ...createRouteFunctionsDirect,\n  ...createRouteFunctionsIndirect,\n] as const\n\nexport type CreateRouteFunction = (typeof createRouteFunctions)[number]\n\nexport const sortRules = [\n  [['params', 'validateSearch'], ['search']],\n  [['search'], ['loaderDeps', 'ssr']],\n  [['loaderDeps'], ['context']],\n  [['context'], ['beforeLoad']],\n  [['beforeLoad'], ['loader']],\n  [\n    ['loader'],\n    [\n      'onEnter',\n      'onStay',\n      'onLeave',\n      'head',\n      'scripts',\n      'headers',\n      'remountDeps',\n    ],\n  ],\n] as const\n\nexport type CheckedProperties = (typeof sortRules)[number][number][number]\nexport const checkedProperties = getCheckedProperties(sortRules)\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/rules/create-route-property-order/create-route-property-order.rule.ts",
    "content": "import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\n\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport { detectTanstackRouterImports } from '../../utils/detect-router-imports'\nimport { sortDataByOrder } from './create-route-property-order.utils'\nimport {\n  createRouteFunctions,\n  createRouteFunctionsIndirect,\n  sortRules,\n} from './constants'\nimport type { CreateRouteFunction } from './constants'\nimport type { ExtraRuleDocs } from '../../types'\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nconst createRouteFunctionSet = new Set(createRouteFunctions)\nfunction isCreateRouteFunction(node: any): node is CreateRouteFunction {\n  return createRouteFunctionSet.has(node)\n}\n\nexport const name = 'create-route-property-order'\n\nexport const rule = createRule({\n  name,\n  meta: {\n    type: 'problem',\n    docs: {\n      description:\n        'Ensure correct order of inference sensitive properties for createRoute functions',\n      recommended: 'error',\n    },\n    messages: {\n      invalidOrder: 'Invalid order of properties for `{{function}}`.',\n    },\n    schema: [],\n    hasSuggestions: true,\n    fixable: 'code',\n  },\n  defaultOptions: [],\n\n  create: detectTanstackRouterImports((context) => {\n    return {\n      CallExpression(node) {\n        if (node.callee.type !== AST_NODE_TYPES.Identifier) {\n          return\n        }\n        const createRouteFunction = node.callee.name\n        if (!isCreateRouteFunction(createRouteFunction)) {\n          return\n        }\n        let args = node.arguments\n        if (createRouteFunctionsIndirect.includes(createRouteFunction as any)) {\n          if (node.parent.type === AST_NODE_TYPES.CallExpression) {\n            args = node.parent.arguments\n          } else {\n            return\n          }\n        }\n\n        const argument = args[0]\n        if (argument === undefined || argument.type !== 'ObjectExpression') {\n          return\n        }\n\n        const allProperties = argument.properties\n        // no need to sort if there is at max 1 property\n        if (allProperties.length < 2) {\n          return\n        }\n\n        const properties = allProperties.flatMap((p) => {\n          if (\n            p.type === AST_NODE_TYPES.Property &&\n            p.key.type === AST_NODE_TYPES.Identifier\n          ) {\n            return { name: p.key.name, property: p }\n          } else if (p.type === AST_NODE_TYPES.SpreadElement) {\n            if (p.argument.type === AST_NODE_TYPES.Identifier) {\n              return { name: p.argument.name, property: p }\n            } else {\n              throw new Error('Unsupported spread element')\n            }\n          }\n          return []\n        })\n\n        const sortedProperties = sortDataByOrder(properties, sortRules, 'name')\n        if (sortedProperties === null) {\n          return\n        }\n        context.report({\n          node: argument,\n          data: { function: node.callee.name },\n          messageId: 'invalidOrder',\n          fix(fixer) {\n            const sourceCode = context.sourceCode\n\n            const text = sortedProperties.reduce(\n              (sourceText, specifier, index) => {\n                let text = ''\n                if (index < allProperties.length - 1) {\n                  text = sourceCode\n                    .getText()\n                    .slice(\n                      allProperties[index]!.range[1],\n                      allProperties[index + 1]!.range[0],\n                    )\n                }\n                return (\n                  sourceText + sourceCode.getText(specifier.property) + text\n                )\n              },\n              '',\n            )\n            return fixer.replaceTextRange(\n              [allProperties[0]!.range[0], allProperties.at(-1)!.range[1]],\n              text,\n            )\n          },\n        })\n      },\n    }\n  }),\n})\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/rules/create-route-property-order/create-route-property-order.utils.ts",
    "content": "export function sortDataByOrder<T, TKey extends keyof T>(\n  data: Array<T> | ReadonlyArray<T>,\n  orderRules: ReadonlyArray<\n    Readonly<[ReadonlyArray<T[TKey]>, ReadonlyArray<T[TKey]>]>\n  >,\n  key: TKey,\n): Array<T> | null {\n  const getSubsetIndex = (\n    item: T[TKey],\n    subsets: ReadonlyArray<ReadonlyArray<T[TKey]> | Array<T[TKey]>>,\n  ): number | null => {\n    for (let i = 0; i < subsets.length; i++) {\n      if (subsets[i]?.includes(item)) {\n        return i\n      }\n    }\n    return null\n  }\n\n  const orderSets = orderRules.reduce(\n    (sets, [A, B]) => [...sets, A, B],\n    [] as Array<ReadonlyArray<T[TKey]> | Array<T[TKey]>>,\n  )\n\n  const inOrderArray = data.filter(\n    (item) => getSubsetIndex(item[key], orderSets) !== null,\n  )\n\n  let wasResorted = false as boolean\n\n  // Sort by the relative order defined by the rules\n  const sortedArray = inOrderArray.sort((a, b) => {\n    const aKey = a[key],\n      bKey = b[key]\n    const aSubsetIndex = getSubsetIndex(aKey, orderSets)\n    const bSubsetIndex = getSubsetIndex(bKey, orderSets)\n\n    // If both items belong to different subsets, sort by their subset order\n    if (\n      aSubsetIndex !== null &&\n      bSubsetIndex !== null &&\n      aSubsetIndex !== bSubsetIndex\n    ) {\n      return aSubsetIndex - bSubsetIndex\n    }\n\n    // If both items belong to the same subset or neither is in the subset, keep their relative order\n    return 0\n  })\n\n  const inOrderIterator = sortedArray.values()\n  const result = data.map((item) => {\n    if (getSubsetIndex(item[key], orderSets) !== null) {\n      const sortedItem = inOrderIterator.next().value!\n      if (sortedItem[key] !== item[key]) {\n        wasResorted = true\n      }\n      return sortedItem\n    }\n    return item\n  })\n\n  if (!wasResorted) {\n    return null\n  }\n  return result\n}\n\nexport function getCheckedProperties<T>(\n  orderRules: ReadonlyArray<ReadonlyArray<ReadonlyArray<T>>>,\n): ReadonlyArray<T> {\n  return [...new Set<T>(orderRules.flat(2))]\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/rules/route-param-names/constants.ts",
    "content": "/**\n * Functions where the path is passed as the first argument (string literal)\n * e.g., createFileRoute('/path/$param')(...)\n */\nexport const pathAsFirstArgFunctions = [\n  'createFileRoute',\n  'createLazyFileRoute',\n  'createLazyRoute',\n] as const\n\nexport type PathAsFirstArgFunction = (typeof pathAsFirstArgFunctions)[number]\n\n/**\n * Functions where the path is a property in the options object\n * e.g., createRoute({ path: '/path/$param' })\n */\nexport const pathAsPropertyFunctions = ['createRoute'] as const\n\nexport type PathAsPropertyFunction = (typeof pathAsPropertyFunctions)[number]\n\n/**\n * All route functions that need param name validation\n */\nexport const allRouteFunctions = [\n  ...pathAsFirstArgFunctions,\n  ...pathAsPropertyFunctions,\n] as const\n\nexport type RouteFunction = (typeof allRouteFunctions)[number]\n\n/**\n * Regex for valid JavaScript identifier (param name)\n * Must start with letter, underscore, or dollar sign\n * Can contain letters, numbers, underscores, or dollar signs\n */\nexport const VALID_PARAM_NAME_REGEX = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/rules/route-param-names/route-param-names.rule.ts",
    "content": "import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'\n\nimport { getDocsUrl } from '../../utils/get-docs-url'\nimport { detectTanstackRouterImports } from '../../utils/detect-router-imports'\nimport { getInvalidParams } from './route-param-names.utils'\nimport { pathAsFirstArgFunctions, pathAsPropertyFunctions } from './constants'\nimport type { TSESTree } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from '../../types'\n\nconst createRule = ESLintUtils.RuleCreator<ExtraRuleDocs>(getDocsUrl)\n\nconst pathAsFirstArgSet = new Set<string>(pathAsFirstArgFunctions)\nconst pathAsPropertySet = new Set<string>(pathAsPropertyFunctions)\n\nexport const name = 'route-param-names'\n\nexport const rule = createRule({\n  name,\n  meta: {\n    type: 'problem',\n    docs: {\n      description: 'Ensure route param names are valid JavaScript identifiers',\n      recommended: 'error',\n    },\n    messages: {\n      invalidParamName:\n        'Invalid param name \"{{paramName}}\" in route path. Param names must be valid JavaScript identifiers (match /[a-zA-Z_$][a-zA-Z0-9_$]*/).',\n    },\n    schema: [],\n  },\n  defaultOptions: [],\n\n  create: detectTanstackRouterImports((context, _, helpers) => {\n    function reportInvalidParams(node: TSESTree.Node, path: string) {\n      const invalidParams = getInvalidParams(path)\n\n      for (const param of invalidParams) {\n        context.report({\n          node,\n          messageId: 'invalidParamName',\n          data: { paramName: param.paramName },\n        })\n      }\n    }\n\n    function getStringLiteralValue(node: TSESTree.Node): string | null {\n      if (\n        node.type === AST_NODE_TYPES.Literal &&\n        typeof node.value === 'string'\n      ) {\n        return node.value\n      }\n      if (\n        node.type === AST_NODE_TYPES.TemplateLiteral &&\n        node.quasis.length === 1\n      ) {\n        const cooked = node.quasis[0]?.value.cooked\n        if (cooked != null) {\n          return cooked\n        }\n      }\n      return null\n    }\n\n    return {\n      CallExpression(node) {\n        // Handle direct function call: createRoute({ path: '...' })\n        if (node.callee.type === AST_NODE_TYPES.Identifier) {\n          const funcName = node.callee.name\n\n          // Skip if not imported from TanStack Router\n          if (!helpers.isTanstackRouterImport(node.callee)) {\n            return\n          }\n\n          // Case: createRoute({ path: '/path/$param' }) or createRoute({ 'path': '/path/$param' })\n          if (pathAsPropertySet.has(funcName)) {\n            const arg = node.arguments[0]\n            if (arg?.type === AST_NODE_TYPES.ObjectExpression) {\n              for (const prop of arg.properties) {\n                if (prop.type === AST_NODE_TYPES.Property) {\n                  const isPathKey =\n                    (prop.key.type === AST_NODE_TYPES.Identifier &&\n                      prop.key.name === 'path') ||\n                    (prop.key.type === AST_NODE_TYPES.Literal &&\n                      prop.key.value === 'path')\n                  if (isPathKey) {\n                    const pathValue = getStringLiteralValue(prop.value)\n                    if (pathValue) {\n                      reportInvalidParams(prop.value, pathValue)\n                    }\n                  }\n                }\n              }\n            }\n            return\n          }\n        }\n\n        // Handle curried function call: createFileRoute('/path')({ ... })\n        if (node.callee.type === AST_NODE_TYPES.CallExpression) {\n          const innerCall = node.callee\n\n          if (innerCall.callee.type === AST_NODE_TYPES.Identifier) {\n            const funcName = innerCall.callee.name\n\n            // Skip if not imported from TanStack Router\n            if (!helpers.isTanstackRouterImport(innerCall.callee)) {\n              return\n            }\n\n            // Case: createFileRoute('/path/$param')(...) or similar\n            if (pathAsFirstArgSet.has(funcName)) {\n              const pathArg = innerCall.arguments[0]\n              if (pathArg) {\n                const pathValue = getStringLiteralValue(pathArg)\n                if (pathValue) {\n                  reportInvalidParams(pathArg, pathValue)\n                }\n              }\n            }\n          }\n        }\n      },\n    }\n  }),\n})\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/rules/route-param-names/route-param-names.utils.ts",
    "content": "import { VALID_PARAM_NAME_REGEX } from './constants'\n\nexport interface ExtractedParam {\n  /** The full param string including $ prefix (e.g., \"$userId\", \"-$optional\") */\n  fullParam: string\n  /** The param name without $ prefix (e.g., \"userId\", \"optional\") */\n  paramName: string\n  /** Whether this is an optional param (prefixed with -$) */\n  isOptional: boolean\n  /** Whether this param name is valid */\n  isValid: boolean\n}\n\n/**\n * Extracts param names from a route path segment.\n *\n * Handles these patterns:\n * - $paramName                     -> extract \"paramName\"\n * - {$paramName}                   -> extract \"paramName\"\n * - prefix{$paramName}suffix       -> extract \"paramName\"\n * - {-$paramName}                  -> extract \"paramName\" (optional)\n * - prefix{-$paramName}suffix      -> extract \"paramName\" (optional)\n * - $ or {$}                       -> wildcard, skip validation\n */\nexport function extractParamsFromSegment(\n  segment: string,\n): Array<ExtractedParam> {\n  const params: Array<ExtractedParam> = []\n\n  // Skip empty segments\n  if (!segment || !segment.includes('$')) {\n    return params\n  }\n\n  // Check for wildcard ($ alone or {$})\n  if (segment === '$' || segment === '{$}') {\n    return params // Wildcard, no param name to validate\n  }\n\n  // Pattern 1: Simple $paramName (entire segment starts with $)\n  if (segment.startsWith('$') && !segment.includes('{')) {\n    const paramName = segment.slice(1)\n    if (paramName) {\n      params.push({\n        fullParam: segment,\n        paramName,\n        isOptional: false,\n        isValid: VALID_PARAM_NAME_REGEX.test(paramName),\n      })\n    }\n    return params\n  }\n\n  // Pattern 2: Braces pattern {$paramName} or {-$paramName} with optional prefix/suffix\n  // Match patterns like: prefix{$param}suffix, {$param}, {-$param}\n  const bracePattern = /\\{(-?\\$)([^}]*)\\}/g\n  let match\n\n  while ((match = bracePattern.exec(segment)) !== null) {\n    const prefix = match[1] // \"$\" or \"-$\"\n    const paramName = match[2] // The param name after $ or -$\n\n    if (!paramName) {\n      // This is a wildcard {$} or {-$}, skip\n      continue\n    }\n\n    const isOptional = prefix === '-$'\n\n    params.push({\n      fullParam: `${prefix}${paramName}`,\n      paramName,\n      isOptional,\n      isValid: VALID_PARAM_NAME_REGEX.test(paramName),\n    })\n  }\n\n  return params\n}\n\n/**\n * Extracts all params from a route path.\n *\n * @param path - The route path (e.g., \"/users/$userId/posts/$postId\")\n * @returns Array of extracted params with validation info\n */\nexport function extractParamsFromPath(path: string): Array<ExtractedParam> {\n  if (!path || !path.includes('$')) {\n    return []\n  }\n\n  const segments = path.split('/')\n  const allParams: Array<ExtractedParam> = []\n\n  for (const segment of segments) {\n    const params = extractParamsFromSegment(segment)\n    allParams.push(...params)\n  }\n\n  return allParams\n}\n\n/**\n * Validates a single param name.\n *\n * @param paramName - The param name to validate (without $ prefix)\n * @returns Whether the param name is valid\n */\nexport function isValidParamName(paramName: string): boolean {\n  return VALID_PARAM_NAME_REGEX.test(paramName)\n}\n\n/**\n * Gets all invalid params from a route path.\n *\n * @param path - The route path\n * @returns Array of invalid param info\n */\nexport function getInvalidParams(path: string): Array<ExtractedParam> {\n  const params = extractParamsFromPath(path)\n  return params.filter((p) => !p.isValid)\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/rules.ts",
    "content": "import * as createRoutePropertyOrder from './rules/create-route-property-order/create-route-property-order.rule'\nimport * as routeParamNames from './rules/route-param-names/route-param-names.rule'\nimport type { ESLintUtils } from '@typescript-eslint/utils'\nimport type { ExtraRuleDocs } from './types'\n\nexport const rules: Record<\n  string,\n  ESLintUtils.RuleModule<\n    string,\n    ReadonlyArray<unknown>,\n    ExtraRuleDocs,\n    ESLintUtils.RuleListener\n  >\n> = {\n  [createRoutePropertyOrder.name]: createRoutePropertyOrder.rule,\n  [routeParamNames.name]: routeParamNames.rule,\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/types.ts",
    "content": "export type ExtraRuleDocs = {\n  recommended: 'strict' | 'error' | 'warn'\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/utils/detect-router-imports.ts",
    "content": "import { TSESTree } from '@typescript-eslint/utils'\nimport type { ESLintUtils, TSESLint } from '@typescript-eslint/utils'\n\ntype Create = Parameters<\n  ReturnType<typeof ESLintUtils.RuleCreator>\n>[0]['create']\n\ntype Context = Parameters<Create>[0]\ntype Options = Parameters<Create>[1]\ntype Helpers = {\n  isSpecificTanstackRouterImport: (\n    node: TSESTree.Identifier,\n    source: string,\n  ) => boolean\n  isTanstackRouterImport: (node: TSESTree.Identifier) => boolean\n}\n\ntype EnhancedCreate = (\n  context: Context,\n  options: Options,\n  helpers: Helpers,\n) => ReturnType<Create>\n\nexport function detectTanstackRouterImports(create: EnhancedCreate): Create {\n  return (context, optionsWithDefault) => {\n    const tanstackRouterImportSpecifiers: Array<TSESTree.ImportClause> = []\n\n    const helpers: Helpers = {\n      isSpecificTanstackRouterImport(node, source) {\n        return !!tanstackRouterImportSpecifiers.find((specifier) => {\n          if (\n            specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier &&\n            specifier.parent.type ===\n              TSESTree.AST_NODE_TYPES.ImportDeclaration &&\n            specifier.parent.source.value === source\n          ) {\n            return node.name === specifier.local.name\n          }\n\n          return false\n        })\n      },\n      isTanstackRouterImport(node) {\n        return !!tanstackRouterImportSpecifiers.find((specifier) => {\n          if (specifier.type === TSESTree.AST_NODE_TYPES.ImportSpecifier) {\n            return node.name === specifier.local.name\n          }\n\n          return false\n        })\n      },\n    }\n\n    const detectionInstructions: TSESLint.RuleListener = {\n      ImportDeclaration(node) {\n        if (\n          node.specifiers.length > 0 &&\n          // `importKind` is parser-dependent and can be undefined (eg. Espree)\n          node.importKind !== 'type' &&\n          node.source.value.startsWith('@tanstack/') &&\n          node.source.value.endsWith('-router')\n        ) {\n          tanstackRouterImportSpecifiers.push(...node.specifiers)\n        }\n      },\n    }\n\n    // Call original rule definition\n    const ruleInstructions = create(context, optionsWithDefault, helpers)\n    const enhancedRuleInstructions: TSESLint.RuleListener = {}\n\n    const allKeys = new Set(\n      Object.keys(detectionInstructions).concat(Object.keys(ruleInstructions)),\n    )\n\n    // Iterate over ALL instructions keys so we can override original rule instructions\n    // to prevent their execution if conditions to report errors are not met.\n    allKeys.forEach((instruction) => {\n      enhancedRuleInstructions[instruction] = (node) => {\n        if (instruction in detectionInstructions) {\n          detectionInstructions[instruction]?.(node)\n        }\n\n        const ruleFunction = ruleInstructions[instruction]\n        if (ruleFunction !== undefined) {\n          return ruleFunction(node)\n        }\n\n        return undefined\n      }\n    })\n\n    return enhancedRuleInstructions\n  }\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/src/utils/get-docs-url.ts",
    "content": "export const getDocsUrl = (ruleName: string): string =>\n  `https://tanstack.com/router/latest/docs/eslint/${ruleName}`\n"
  },
  {
    "path": "packages/eslint-plugin-router/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"moduleResolution\": \"Bundler\"\n  },\n  \"include\": [\"src\", \"eslint.config.js\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/eslint-plugin-router/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './src',\n    watch: false,\n    globals: true,\n    typecheck: { enabled: true },\n    restoreMocks: true,\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n    exclude: ['./src/__tests__'],\n  }),\n)\n"
  },
  {
    "path": "packages/history/CHANGELOG.md",
    "content": "# @tanstack/history\n\n## 1.161.6\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n## 1.161.5\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n"
  },
  {
    "path": "packages/history/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/history/package.json",
    "content": "{\n  \"name\": \"@tanstack/history\",\n  \"version\": \"1.161.6\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/history\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"history\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"test:unit\": \"vitest\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"devDependencies\": {\n    \"vite\": \"*\"\n  }\n}\n"
  },
  {
    "path": "packages/history/src/index.ts",
    "content": "// While the public API was clearly inspired by the \"history\" npm package,\n// This implementation attempts to be more lightweight by\n// making assumptions about the way TanStack Router works\n\nexport interface NavigateOptions {\n  ignoreBlocker?: boolean\n}\n\ntype SubscriberHistoryAction =\n  | {\n      type: Exclude<HistoryAction, 'GO'>\n    }\n  | {\n      type: 'GO'\n      index: number\n    }\n\ntype SubscriberArgs = {\n  location: HistoryLocation\n  action: SubscriberHistoryAction\n}\n\nexport interface RouterHistory {\n  location: HistoryLocation\n  length: number\n  subscribers: Set<(opts: SubscriberArgs) => void>\n  subscribe: (cb: (opts: SubscriberArgs) => void) => () => void\n  push: (path: string, state?: any, navigateOpts?: NavigateOptions) => void\n  replace: (path: string, state?: any, navigateOpts?: NavigateOptions) => void\n  go: (index: number, navigateOpts?: NavigateOptions) => void\n  back: (navigateOpts?: NavigateOptions) => void\n  forward: (navigateOpts?: NavigateOptions) => void\n  canGoBack: () => boolean\n  createHref: (href: string) => string\n  block: (blocker: NavigationBlocker) => () => void\n  flush: () => void\n  destroy: () => void\n  notify: (action: SubscriberHistoryAction) => void\n  _ignoreSubscribers?: boolean\n}\n\nexport interface HistoryLocation extends ParsedPath {\n  state: ParsedHistoryState\n}\n\nexport interface ParsedPath {\n  href: string\n  pathname: string\n  search: string\n  hash: string\n}\n\nexport interface HistoryState {}\n\nexport type ParsedHistoryState = HistoryState & {\n  key?: string // TODO: Remove in v2 - use __TSR_key instead\n  __TSR_key?: string\n  __TSR_index: number\n}\n\ntype ShouldAllowNavigation = any\n\nexport type HistoryAction = 'PUSH' | 'REPLACE' | 'FORWARD' | 'BACK' | 'GO'\n\nexport type BlockerFnArgs = {\n  currentLocation: HistoryLocation\n  nextLocation: HistoryLocation\n  action: HistoryAction\n}\n\nexport type BlockerFn = (\n  args: BlockerFnArgs,\n) => Promise<ShouldAllowNavigation> | ShouldAllowNavigation\n\nexport type NavigationBlocker = {\n  blockerFn: BlockerFn\n  enableBeforeUnload?: (() => boolean) | boolean\n}\n\ntype TryNavigateArgs = {\n  task: () => void\n  type: 'PUSH' | 'REPLACE' | 'BACK' | 'FORWARD' | 'GO'\n  navigateOpts?: NavigateOptions\n} & (\n  | {\n      type: 'PUSH' | 'REPLACE'\n      path: string\n      state: any\n    }\n  | {\n      type: 'BACK' | 'FORWARD' | 'GO'\n    }\n)\n\nconst stateIndexKey = '__TSR_index'\nconst popStateEvent = 'popstate'\nconst beforeUnloadEvent = 'beforeunload'\n\nexport function createHistory(opts: {\n  getLocation: () => HistoryLocation\n  getLength: () => number\n  pushState: (path: string, state: any) => void\n  replaceState: (path: string, state: any) => void\n  go: (n: number) => void\n  back: (ignoreBlocker: boolean) => void\n  forward: (ignoreBlocker: boolean) => void\n  createHref: (path: string) => string\n  flush?: () => void\n  destroy?: () => void\n  onBlocked?: () => void\n  getBlockers?: () => Array<NavigationBlocker>\n  setBlockers?: (blockers: Array<NavigationBlocker>) => void\n  // Avoid notifying on forward/back/go, used for browser history as we already get notified by the popstate event\n  notifyOnIndexChange?: boolean\n}): RouterHistory {\n  let location = opts.getLocation()\n  const subscribers = new Set<(opts: SubscriberArgs) => void>()\n\n  const notify = (action: SubscriberHistoryAction) => {\n    location = opts.getLocation()\n    subscribers.forEach((subscriber) => subscriber({ location, action }))\n  }\n\n  const handleIndexChange = (action: SubscriberHistoryAction) => {\n    if (opts.notifyOnIndexChange ?? true) notify(action)\n    else location = opts.getLocation()\n  }\n\n  const tryNavigation = async ({\n    task,\n    navigateOpts,\n    ...actionInfo\n  }: TryNavigateArgs) => {\n    const ignoreBlocker = navigateOpts?.ignoreBlocker ?? false\n    if (ignoreBlocker) {\n      task()\n      return\n    }\n\n    const blockers = opts.getBlockers?.() ?? []\n    const isPushOrReplace =\n      actionInfo.type === 'PUSH' || actionInfo.type === 'REPLACE'\n    if (typeof document !== 'undefined' && blockers.length && isPushOrReplace) {\n      for (const blocker of blockers) {\n        const nextLocation = parseHref(actionInfo.path, actionInfo.state)\n        const isBlocked = await blocker.blockerFn({\n          currentLocation: location,\n          nextLocation,\n          action: actionInfo.type,\n        })\n        if (isBlocked) {\n          opts.onBlocked?.()\n          return\n        }\n      }\n    }\n\n    task()\n  }\n\n  return {\n    get location() {\n      return location\n    },\n    get length() {\n      return opts.getLength()\n    },\n    subscribers,\n    subscribe: (cb: (opts: SubscriberArgs) => void) => {\n      subscribers.add(cb)\n\n      return () => {\n        subscribers.delete(cb)\n      }\n    },\n    push: (path, state, navigateOpts) => {\n      const currentIndex = location.state[stateIndexKey]\n      state = assignKeyAndIndex(currentIndex + 1, state)\n      tryNavigation({\n        task: () => {\n          opts.pushState(path, state)\n          notify({ type: 'PUSH' })\n        },\n        navigateOpts,\n        type: 'PUSH',\n        path,\n        state,\n      })\n    },\n    replace: (path, state, navigateOpts) => {\n      const currentIndex = location.state[stateIndexKey]\n      state = assignKeyAndIndex(currentIndex, state)\n      tryNavigation({\n        task: () => {\n          opts.replaceState(path, state)\n          notify({ type: 'REPLACE' })\n        },\n        navigateOpts,\n        type: 'REPLACE',\n        path,\n        state,\n      })\n    },\n    go: (index, navigateOpts) => {\n      tryNavigation({\n        task: () => {\n          opts.go(index)\n          handleIndexChange({ type: 'GO', index })\n        },\n        navigateOpts,\n        type: 'GO',\n      })\n    },\n    back: (navigateOpts) => {\n      tryNavigation({\n        task: () => {\n          opts.back(navigateOpts?.ignoreBlocker ?? false)\n          handleIndexChange({ type: 'BACK' })\n        },\n        navigateOpts,\n        type: 'BACK',\n      })\n    },\n    forward: (navigateOpts) => {\n      tryNavigation({\n        task: () => {\n          opts.forward(navigateOpts?.ignoreBlocker ?? false)\n          handleIndexChange({ type: 'FORWARD' })\n        },\n        navigateOpts,\n        type: 'FORWARD',\n      })\n    },\n    canGoBack: () => location.state[stateIndexKey] !== 0,\n    createHref: (str) => opts.createHref(str),\n    block: (blocker) => {\n      if (!opts.setBlockers) return () => {}\n      const blockers = opts.getBlockers?.() ?? []\n      opts.setBlockers([...blockers, blocker])\n\n      return () => {\n        const blockers = opts.getBlockers?.() ?? []\n        opts.setBlockers?.(blockers.filter((b) => b !== blocker))\n      }\n    },\n    flush: () => opts.flush?.(),\n    destroy: () => opts.destroy?.(),\n    notify,\n  }\n}\n\nfunction assignKeyAndIndex(index: number, state: HistoryState | undefined) {\n  if (!state) {\n    state = {}\n  }\n  const key = createRandomKey()\n  return {\n    ...state,\n    key, // TODO: Remove in v2 - use __TSR_key instead\n    __TSR_key: key,\n    [stateIndexKey]: index,\n  } as ParsedHistoryState\n}\n\n/**\n * Creates a history object that can be used to interact with the browser's\n * navigation. This is a lightweight API wrapping the browser's native methods.\n * It is designed to work with TanStack Router, but could be used as a standalone API as well.\n * IMPORTANT: This API implements history throttling via a microtask to prevent\n * excessive calls to the history API. In some browsers, calling history.pushState or\n * history.replaceState in quick succession can cause the browser to ignore subsequent\n * calls. This API smooths out those differences and ensures that your application\n * state will *eventually* match the browser state. In most cases, this is not a problem,\n * but if you need to ensure that the browser state is up to date, you can use the\n * `history.flush` method to immediately flush all pending state changes to the browser URL.\n * @param opts\n * @param opts.getHref A function that returns the current href (path + search + hash)\n * @param opts.createHref A function that takes a path and returns a href (path + search + hash)\n * @returns A history instance\n */\nexport function createBrowserHistory(opts?: {\n  parseLocation?: () => HistoryLocation\n  createHref?: (path: string) => string\n  window?: any\n}): RouterHistory {\n  const win =\n    opts?.window ??\n    (typeof document !== 'undefined' ? window : (undefined as any))\n\n  const originalPushState = win.history.pushState\n  const originalReplaceState = win.history.replaceState\n\n  let blockers: Array<NavigationBlocker> = []\n  const _getBlockers = () => blockers\n  const _setBlockers = (newBlockers: Array<NavigationBlocker>) =>\n    (blockers = newBlockers)\n\n  const createHref = opts?.createHref ?? ((path) => path)\n  const parseLocation =\n    opts?.parseLocation ??\n    (() =>\n      parseHref(\n        `${win.location.pathname}${win.location.search}${win.location.hash}`,\n        win.history.state,\n      ))\n\n  // Ensure there is always a key to start\n  if (!win.history.state?.__TSR_key && !win.history.state?.key) {\n    const addedKey = createRandomKey()\n    win.history.replaceState(\n      {\n        [stateIndexKey]: 0,\n        key: addedKey, // TODO: Remove in v2 - use __TSR_key instead\n        __TSR_key: addedKey,\n      },\n      '',\n    )\n  }\n\n  let currentLocation = parseLocation()\n  let rollbackLocation: HistoryLocation | undefined\n\n  let nextPopIsGo = false\n  let ignoreNextPop = false\n  let skipBlockerNextPop = false\n  let ignoreNextBeforeUnload = false\n\n  const getLocation = () => currentLocation\n\n  let next:\n    | undefined\n    | {\n        // This is the latest location that we were attempting to push/replace\n        href: string\n        // This is the latest state that we were attempting to push/replace\n        state: any\n        // This is the latest type that we were attempting to push/replace\n        isPush: boolean\n      }\n\n  // We need to track the current scheduled update to prevent\n  // multiple updates from being scheduled at the same time.\n  let scheduled: Promise<void> | undefined\n\n  // This function flushes the next update to the browser history\n  const flush = () => {\n    if (!next) {\n      return\n    }\n\n    // We need to ignore any updates to the subscribers while we update the browser history\n    history._ignoreSubscribers = true\n\n    // Update the browser history\n    ;(next.isPush ? win.history.pushState : win.history.replaceState)(\n      next.state,\n      '',\n      next.href,\n    )\n\n    // Stop ignoring subscriber updates\n    history._ignoreSubscribers = false\n\n    // Reset the nextIsPush flag and clear the scheduled update\n    next = undefined\n    scheduled = undefined\n    rollbackLocation = undefined\n  }\n\n  // This function queues up a call to update the browser history\n  const queueHistoryAction = (\n    type: 'push' | 'replace',\n    destHref: string,\n    state: any,\n  ) => {\n    const href = createHref(destHref)\n\n    if (!scheduled) {\n      rollbackLocation = currentLocation\n    }\n\n    // Update the location in memory\n    currentLocation = parseHref(destHref, state)\n\n    // Keep track of the next location we need to flush to the URL\n    next = {\n      href,\n      state,\n      isPush: next?.isPush || type === 'push',\n    }\n\n    if (!scheduled) {\n      // Schedule an update to the browser history\n      scheduled = Promise.resolve().then(() => flush())\n    }\n  }\n\n  // NOTE: this function can probably be removed\n  const onPushPop = (type: 'PUSH' | 'REPLACE') => {\n    currentLocation = parseLocation()\n    history.notify({ type })\n  }\n\n  const onPushPopEvent = async () => {\n    if (ignoreNextPop) {\n      ignoreNextPop = false\n      return\n    }\n\n    const nextLocation = parseLocation()\n    const delta =\n      nextLocation.state[stateIndexKey] - currentLocation.state[stateIndexKey]\n    const isForward = delta === 1\n    const isBack = delta === -1\n    const isGo = (!isForward && !isBack) || nextPopIsGo\n    nextPopIsGo = false\n\n    const action = isGo ? 'GO' : isBack ? 'BACK' : 'FORWARD'\n    const notify: SubscriberHistoryAction = isGo\n      ? {\n          type: 'GO',\n          index: delta,\n        }\n      : {\n          type: isBack ? 'BACK' : 'FORWARD',\n        }\n\n    if (skipBlockerNextPop) {\n      skipBlockerNextPop = false\n    } else {\n      const blockers = _getBlockers()\n      if (typeof document !== 'undefined' && blockers.length) {\n        for (const blocker of blockers) {\n          const isBlocked = await blocker.blockerFn({\n            currentLocation,\n            nextLocation,\n            action,\n          })\n          if (isBlocked) {\n            ignoreNextPop = true\n            win.history.go(1)\n            history.notify(notify)\n            return\n          }\n        }\n      }\n    }\n\n    currentLocation = parseLocation()\n    history.notify(notify)\n  }\n\n  const onBeforeUnload = (e: BeforeUnloadEvent) => {\n    if (ignoreNextBeforeUnload) {\n      ignoreNextBeforeUnload = false\n      return\n    }\n\n    let shouldBlock = false\n\n    // If one blocker has a non-disabled beforeUnload, we should block\n    const blockers = _getBlockers()\n    if (typeof document !== 'undefined' && blockers.length) {\n      for (const blocker of blockers) {\n        const shouldHaveBeforeUnload = blocker.enableBeforeUnload ?? true\n        if (shouldHaveBeforeUnload === true) {\n          shouldBlock = true\n          break\n        }\n\n        if (\n          typeof shouldHaveBeforeUnload === 'function' &&\n          shouldHaveBeforeUnload() === true\n        ) {\n          shouldBlock = true\n          break\n        }\n      }\n    }\n\n    if (shouldBlock) {\n      e.preventDefault()\n      return (e.returnValue = '')\n    }\n    return\n  }\n\n  const history = createHistory({\n    getLocation,\n    getLength: () => win.history.length,\n    pushState: (href, state) => queueHistoryAction('push', href, state),\n    replaceState: (href, state) => queueHistoryAction('replace', href, state),\n    back: (ignoreBlocker) => {\n      if (ignoreBlocker) skipBlockerNextPop = true\n      ignoreNextBeforeUnload = true\n      return win.history.back()\n    },\n    forward: (ignoreBlocker) => {\n      if (ignoreBlocker) skipBlockerNextPop = true\n      ignoreNextBeforeUnload = true\n      win.history.forward()\n    },\n    go: (n) => {\n      nextPopIsGo = true\n      win.history.go(n)\n    },\n    createHref: (href) => createHref(href),\n    flush,\n    destroy: () => {\n      win.history.pushState = originalPushState\n      win.history.replaceState = originalReplaceState\n      win.removeEventListener(beforeUnloadEvent, onBeforeUnload, {\n        capture: true,\n      })\n      win.removeEventListener(popStateEvent, onPushPopEvent)\n    },\n    onBlocked: () => {\n      // If a navigation is blocked, we need to rollback the location\n      // that we optimistically updated in memory.\n      if (rollbackLocation && currentLocation !== rollbackLocation) {\n        currentLocation = rollbackLocation\n      }\n    },\n    getBlockers: _getBlockers,\n    setBlockers: _setBlockers,\n    notifyOnIndexChange: false,\n  })\n\n  win.addEventListener(beforeUnloadEvent, onBeforeUnload, { capture: true })\n  win.addEventListener(popStateEvent, onPushPopEvent)\n\n  win.history.pushState = function (...args: Array<any>) {\n    const res = originalPushState.apply(win.history, args as any)\n    if (!history._ignoreSubscribers) onPushPop('PUSH')\n    return res\n  }\n\n  win.history.replaceState = function (...args: Array<any>) {\n    const res = originalReplaceState.apply(win.history, args as any)\n    if (!history._ignoreSubscribers) onPushPop('REPLACE')\n    return res\n  }\n\n  return history\n}\n\n/**\n * Create a hash-based history implementation.\n * Useful for static hosts or environments without server URL rewriting.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/history-types\n */\nexport function createHashHistory(opts?: { window?: any }): RouterHistory {\n  const win =\n    opts?.window ??\n    (typeof document !== 'undefined' ? window : (undefined as any))\n  return createBrowserHistory({\n    window: win,\n    parseLocation: () => {\n      const hashSplit = win.location.hash.split('#').slice(1)\n      const pathPart = hashSplit[0] ?? '/'\n      const searchPart = win.location.search\n      const hashEntries = hashSplit.slice(1)\n      const hashPart =\n        hashEntries.length === 0 ? '' : `#${hashEntries.join('#')}`\n      const hashHref = `${pathPart}${searchPart}${hashPart}`\n      return parseHref(hashHref, win.history.state)\n    },\n    createHref: (href) =>\n      `${win.location.pathname}${win.location.search}#${href}`,\n  })\n}\n\n/**\n * Create an in-memory history implementation.\n * Ideal for server rendering, tests, and non-DOM environments.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/history-types\n */\nexport function createMemoryHistory(\n  opts: {\n    initialEntries: Array<string>\n    initialIndex?: number\n  } = {\n    initialEntries: ['/'],\n  },\n): RouterHistory {\n  const entries = opts.initialEntries\n  let index = opts.initialIndex\n    ? Math.min(Math.max(opts.initialIndex, 0), entries.length - 1)\n    : entries.length - 1\n  const states = entries.map((_entry, index) =>\n    assignKeyAndIndex(index, undefined),\n  )\n\n  const getLocation = () => parseHref(entries[index]!, states[index])\n\n  let blockers: Array<NavigationBlocker> = []\n  const _getBlockers = () => blockers\n  const _setBlockers = (newBlockers: Array<NavigationBlocker>) =>\n    (blockers = newBlockers)\n\n  return createHistory({\n    getLocation,\n    getLength: () => entries.length,\n    pushState: (path, state) => {\n      // Removes all subsequent entries after the current index to start a new branch\n      if (index < entries.length - 1) {\n        entries.splice(index + 1)\n        states.splice(index + 1)\n      }\n      states.push(state)\n      entries.push(path)\n      index = Math.max(entries.length - 1, 0)\n    },\n    replaceState: (path, state) => {\n      states[index] = state\n      entries[index] = path\n    },\n    back: () => {\n      index = Math.max(index - 1, 0)\n    },\n    forward: () => {\n      index = Math.min(index + 1, entries.length - 1)\n    },\n    go: (n) => {\n      index = Math.min(Math.max(index + n, 0), entries.length - 1)\n    },\n    createHref: (path) => path,\n    getBlockers: _getBlockers,\n    setBlockers: _setBlockers,\n  })\n}\n\n/**\n * Sanitize a path to prevent open redirect vulnerabilities.\n * Removes control characters and collapses leading double slashes.\n */\nfunction sanitizePath(path: string): string {\n  // Remove ASCII control characters (0x00-0x1F) and DEL (0x7F)\n  // These include CR (\\r = 0x0D), LF (\\n = 0x0A), and other potentially dangerous characters\n  // eslint-disable-next-line no-control-regex\n  let sanitized = path.replace(/[\\x00-\\x1f\\x7f]/g, '')\n\n  // Prevent open redirect via protocol-relative URLs (e.g. \"//evil.com\")\n  // Collapse leading double slashes to a single slash\n  if (sanitized.startsWith('//')) {\n    sanitized = '/' + sanitized.replace(/^\\/+/, '')\n  }\n\n  return sanitized\n}\n\nexport function parseHref(\n  href: string,\n  state: ParsedHistoryState | undefined,\n): HistoryLocation {\n  const sanitizedHref = sanitizePath(href)\n  const hashIndex = sanitizedHref.indexOf('#')\n  const searchIndex = sanitizedHref.indexOf('?')\n\n  const addedKey = createRandomKey()\n\n  return {\n    href: sanitizedHref,\n    pathname: sanitizedHref.substring(\n      0,\n      hashIndex > 0\n        ? searchIndex > 0\n          ? Math.min(hashIndex, searchIndex)\n          : hashIndex\n        : searchIndex > 0\n          ? searchIndex\n          : sanitizedHref.length,\n    ),\n    hash: hashIndex > -1 ? sanitizedHref.substring(hashIndex) : '',\n    search:\n      searchIndex > -1\n        ? sanitizedHref.slice(\n            searchIndex,\n            hashIndex === -1 ? undefined : hashIndex,\n          )\n        : '',\n    state: state || { [stateIndexKey]: 0, key: addedKey, __TSR_key: addedKey },\n  }\n}\n\n// Thanks co-pilot!\nfunction createRandomKey() {\n  return (Math.random() + 1).toString(36).substring(7)\n}\n"
  },
  {
    "path": "packages/history/tests/createHashHistory.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\n\nimport { createHashHistory } from '../src'\n\ndescribe('createHashHistory', () => {\n  describe('parseLocation', () => {\n    describe.each([\n      ['/', { pathname: '/', search: '' }, 'neither search params nor hash'],\n      [\n        '/#/hello',\n        { pathname: '/hello', search: '' },\n        'hash present, no search params',\n      ],\n      [\n        '/?search=params',\n        { pathname: '/', search: '?search=params' },\n        'search params present, no hash',\n      ],\n      [\n        '/#/hello?search=params',\n        { pathname: '/hello', search: '?search=params' },\n        'both hash and search params present, in that order',\n      ],\n      [\n        '/?search=params#/hello',\n        { pathname: '/hello', search: '?search=params' },\n        'both search params and hash present, in that order',\n      ],\n    ])('check for %s', (...[path, exp, desc]) => {\n      test(`onLoad with ${path} (${desc})`, () => {\n        window.history.replaceState({}, '', path)\n        const history = createHashHistory()\n        expect(history.location.pathname).toBe(exp.pathname)\n        expect(history.location.search).toBe(exp.search)\n      })\n      test(`onNavigate with ${path} (${desc})`, () => {\n        const history = createHashHistory()\n        window.history.pushState({}, '', path)\n        expect(history.location.pathname).toBe(exp.pathname)\n        expect(history.location.search).toBe(exp.search)\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/history/tests/createMemoryHistory.test.ts",
    "content": "import { describe, expect, test, vi } from 'vitest'\nimport { createMemoryHistory } from '../src'\n\ndescribe('createMemoryHistory', () => {\n  test('back', () => {\n    const initialEntry = '/initial'\n    const history = createMemoryHistory({ initialEntries: [initialEntry] })\n    history.push('/a')\n    history.push('/b')\n    history.push('/c')\n    history.back()\n    expect(history.location.pathname).toBe('/b')\n    history.back()\n    expect(history.location.pathname).toBe('/a')\n    history.back()\n    expect(history.location.pathname).toBe(initialEntry)\n    // check that back does nothing when there is no back history\n    history.back()\n    expect(history.location.pathname).toBe(initialEntry)\n  })\n\n  test('forward', () => {\n    const history = createMemoryHistory()\n    history.push('/a')\n    history.push('/b')\n    history.push('/c')\n    history.back()\n    history.back()\n    expect(history.location.pathname).toBe('/a')\n    history.forward()\n    expect(history.location.pathname).toBe('/b')\n    history.forward()\n    expect(history.location.pathname).toBe('/c')\n    // check that forward does nothing when there is no forward history\n    history.forward()\n    expect(history.location.pathname).toBe('/c')\n  })\n\n  test('push and back #1916', () => {\n    const history = createMemoryHistory()\n    history.push('/a')\n    expect(history.location.pathname).toBe('/a')\n    history.push('/b')\n    expect(history.location.pathname).toBe('/b')\n    history.push('/c')\n    expect(history.location.pathname).toBe('/c')\n    history.back()\n    expect(history.location.pathname).toBe('/b')\n    history.push('/d')\n    expect(history.location.pathname).toBe('/d')\n    history.back()\n    expect(history.location.pathname).toBe('/b')\n  })\n\n  test('length', () => {\n    const history = createMemoryHistory()\n    expect(history.length).toBe(1)\n    history.push('/a')\n    expect(history.length).toBe(2)\n    history.replace('/b')\n    expect(history.length).toBe(2)\n    history.back()\n    expect(history.length).toBe(2)\n    history.push('/c')\n    expect(history.length).toBe(2)\n  })\n\n  test('state', () => {\n    const history = createMemoryHistory()\n    history.push('/a', { i: 1 })\n    expect((history.location.state as any).i).toBe(1)\n    history.replace('/b', { i: 2 })\n    expect((history.location.state as any).i).toBe(2)\n    history.back()\n    expect((history.location.state as any).i).toBeUndefined()\n    history.push('/c', { i: 3 })\n    expect((history.location.state as any).i).toBe(3)\n  })\n\n  test('block prevents navigation', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n    const blockerFn = vi.fn(() => true) // Always block\n\n    const unblock = history.block({\n      blockerFn,\n      enableBeforeUnload: false,\n    })\n\n    await history.push('/a')\n\n    // Navigation should be blocked\n    expect(history.location.pathname).toBe('/')\n    expect(blockerFn).toHaveBeenCalled()\n\n    unblock()\n  })\n\n  test('block allows navigation when blockerFn returns false', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n    const blockerFn = vi.fn(() => false) // Never block\n\n    const unblock = history.block({\n      blockerFn,\n      enableBeforeUnload: false,\n    })\n\n    await history.push('/a')\n\n    // Navigation should proceed\n    expect(history.location.pathname).toBe('/a')\n    expect(blockerFn).toHaveBeenCalled()\n\n    unblock()\n  })\n\n  test('unblock removes blocker', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n    const blockerFn = vi.fn(() => true) // Always block\n\n    const unblock = history.block({\n      blockerFn,\n      enableBeforeUnload: false,\n    })\n\n    // Unblock immediately\n    unblock()\n\n    await history.push('/a')\n\n    // Navigation should proceed since blocker was removed\n    expect(history.location.pathname).toBe('/a')\n    expect(blockerFn).not.toHaveBeenCalled()\n  })\n})\n"
  },
  {
    "path": "packages/history/tests/parseHref.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { parseHref } from '../src'\n\ndescribe('parseHref', () => {\n  test('works', () => {\n    const parsed = parseHref('/foo?bar=baz#qux', {} as any)\n    expect(parsed.pathname).toEqual('/foo')\n    expect(parsed.search).toEqual('?bar=baz')\n    expect(parsed.hash).toEqual('#qux')\n  })\n\n  describe('open redirect prevention', () => {\n    test('strips CR characters to prevent open redirect', () => {\n      // If \\r (CR) is in the href, it should be stripped\n      const parsed = parseHref('/\\r/google.com/', undefined)\n      expect(parsed.href).toBe('/google.com/')\n      expect(parsed.pathname).toBe('/google.com/')\n      expect(parsed.href).not.toMatch(/^\\/\\//)\n    })\n\n    test('strips LF characters to prevent open redirect', () => {\n      const parsed = parseHref('/\\n/evil.com/', undefined)\n      expect(parsed.href).toBe('/evil.com/')\n      expect(parsed.pathname).toBe('/evil.com/')\n      expect(parsed.href).not.toMatch(/^\\/\\//)\n    })\n\n    test('strips CRLF characters to prevent open redirect', () => {\n      const parsed = parseHref('/\\r\\n/evil.com/', undefined)\n      expect(parsed.href).toBe('/evil.com/')\n      expect(parsed.pathname).toBe('/evil.com/')\n      expect(parsed.href).not.toMatch(/^\\/\\//)\n    })\n\n    test('collapses leading double slashes to prevent protocol-relative URLs', () => {\n      const parsed = parseHref('//evil.com/path', undefined)\n      expect(parsed.href).toBe('/evil.com/path')\n      expect(parsed.pathname).toBe('/evil.com/path')\n    })\n\n    test('sanitized href resolves safely to same origin', () => {\n      const parsed = parseHref('/\\r/evil.com/', undefined)\n      const url = new URL(parsed.href, 'http://localhost:3000')\n      expect(url.origin).toBe('http://localhost:3000')\n      expect(url.pathname).toBe('/evil.com/')\n    })\n\n    test('normal paths remain unchanged', () => {\n      const parsed = parseHref('/users/profile?id=1#section', undefined)\n      expect(parsed.href).toBe('/users/profile?id=1#section')\n      expect(parsed.pathname).toBe('/users/profile')\n      expect(parsed.search).toBe('?id=1')\n      expect(parsed.hash).toBe('#section')\n    })\n  })\n})\n"
  },
  {
    "path": "packages/history/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/history/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/nitro-v2-vite-plugin/CHANGELOG.md",
    "content": "# @tanstack/nitro-v2-vite-plugin\n\n## 1.154.9\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n## 1.154.8\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n"
  },
  {
    "path": "packages/nitro-v2-vite-plugin/README.md",
    "content": "# Experimental Nitro v2 Vite Plugin\n"
  },
  {
    "path": "packages/nitro-v2-vite-plugin/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/nitro-v2-vite-plugin/package.json",
    "content": "{\n  \"name\": \"@tanstack/nitro-v2-vite-plugin\",\n  \"version\": \"1.154.9\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/nitro-v2-vite-plugin\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test\": \"pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit\",\n    \"test:unit\": \"echo 'No unit tests are needed here since we do them in @tanstack/router-plugin!'\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=22.12\"\n  },\n  \"dependencies\": {\n    \"nitropack\": \"^2.13.1\",\n    \"pathe\": \"^2.0.3\"\n  },\n  \"peerDependencies\": {\n    \"vite\": \">=7.0.0\"\n  }\n}\n"
  },
  {
    "path": "packages/nitro-v2-vite-plugin/src/index.ts",
    "content": "import { build, copyPublicAssets, createNitro, prepare } from 'nitropack'\nimport { dirname, resolve } from 'pathe'\n\nimport type { PluginOption, ResolvedConfig, Rollup } from 'vite'\nimport type { NitroConfig } from 'nitropack'\n\nlet ssrBundle: Rollup.OutputBundle\nlet ssrEntryFile: string\n\nfunction isFullUrl(str: string): boolean {\n  try {\n    new URL(str)\n    return true\n  } catch {\n    return false\n  }\n}\n\nexport function nitroV2Plugin(nitroConfig?: NitroConfig): Array<PluginOption> {\n  let resolvedConfig: ResolvedConfig\n  return [\n    {\n      name: 'tanstack-nitro-v2-vite-plugin',\n\n      generateBundle: {\n        handler(_options, bundle) {\n          if (this.environment.name !== 'ssr') {\n            return\n          }\n\n          // find entry point of ssr bundle\n          let entryFile: string | undefined\n          for (const [_name, file] of Object.entries(bundle)) {\n            if (file.type === 'chunk') {\n              if (file.isEntry) {\n                if (entryFile !== undefined) {\n                  this.error(\n                    `Multiple entry points found for service \"${this.environment.name}\". Only one entry point is allowed.`,\n                  )\n                }\n                entryFile = file.fileName\n              }\n            }\n          }\n          if (entryFile === undefined) {\n            this.error(\n              `No entry point found for service \"${this.environment.name}\".`,\n            )\n          }\n          ssrEntryFile = entryFile!\n          ssrBundle = bundle\n        },\n      },\n\n      configResolved(config) {\n        resolvedConfig = config\n      },\n      config(_, env) {\n        if (env.command !== 'build') {\n          return\n        }\n\n        return {\n          environments: {\n            ssr: {\n              consumer: 'server',\n              build: {\n                ssr: true,\n                // we don't write to the file system as the below 'capture-output' plugin will\n                // capture the output and write it to the virtual file system\n                write: false,\n                copyPublicDir: false,\n                commonjsOptions: {\n                  include: [/node_modules/],\n                },\n              },\n            },\n          },\n          builder: {\n            sharedPlugins: true,\n            async buildApp(builder) {\n              const client = builder.environments.client\n              const server = builder.environments.ssr\n\n              if (!client) {\n                throw new Error('Client environment not found')\n              }\n\n              if (!server) {\n                throw new Error('SSR environment not found')\n              }\n\n              await builder.build(client)\n              await builder.build(server)\n\n              const virtualEntry = '#tanstack/start/entry'\n              const baseURL = !isFullUrl(resolvedConfig.base)\n                ? resolvedConfig.base\n                : undefined\n              const config: NitroConfig = {\n                baseURL,\n                publicAssets: [\n                  {\n                    dir: client.config.build.outDir,\n                    maxAge: 31536000, // 1 year\n                    baseURL: '/',\n                  },\n                ],\n                ...nitroConfig,\n                esbuild: {\n                  options: {\n                    target: server.config.build.target || undefined,\n                    ...nitroConfig?.esbuild?.options,\n                  },\n                },\n                renderer: virtualEntry,\n                rollupConfig: {\n                  ...nitroConfig?.rollupConfig,\n                  plugins: [virtualBundlePlugin(ssrBundle) as any],\n                },\n                virtual: {\n                  ...nitroConfig?.virtual,\n                  [virtualEntry]: `import { fromWebHandler } from 'h3'\n                                    import handler from '${ssrEntryFile}' \n                                    export default fromWebHandler(handler.fetch)`,\n                },\n              }\n\n              const nitro = await createNitro(config)\n\n              await prepare(nitro)\n              await copyPublicAssets(nitro)\n              await build(nitro)\n\n              await nitro.close()\n            },\n          },\n        }\n      },\n    },\n  ]\n}\n\nfunction virtualBundlePlugin(bundle: Rollup.OutputBundle): Rollup.Plugin {\n  type VirtualModule = { code: string; map: string | null }\n  let _modules: Map<string, VirtualModule> | null = null\n\n  // lazy initialize _modules since at the time of plugin creation, the bundles are not available yet\n  const getModules = () => {\n    if (_modules) {\n      return _modules\n    }\n    _modules = new Map()\n    // group chunks and source maps\n    for (const [fileName, content] of Object.entries(bundle)) {\n      if (content.type === 'chunk') {\n        const virtualModule: VirtualModule = {\n          code: content.code,\n          map: null,\n        }\n        const maybeMap = bundle[`${fileName}.map`]\n        if (maybeMap && maybeMap.type === 'asset') {\n          virtualModule.map = maybeMap.source as string\n        }\n        _modules.set(fileName, virtualModule)\n        _modules.set(resolve(fileName), virtualModule)\n      }\n    }\n    return _modules\n  }\n\n  return {\n    name: 'virtual-bundle',\n    resolveId(id, importer) {\n      const modules = getModules()\n      if (modules.has(id)) {\n        return resolve(id)\n      }\n\n      if (importer) {\n        const resolved = resolve(dirname(importer), id)\n        if (modules.has(resolved)) {\n          return resolved\n        }\n      }\n      return null\n    },\n    load(id) {\n      const modules = getModules()\n      const m = modules.get(id)\n      if (!m) {\n        return null\n      }\n      return m\n    },\n  }\n}\n"
  },
  {
    "path": "packages/nitro-v2-vite-plugin/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\", \"tests\"],\n  \"exclude\": [\"tests/test-files/**\", \"tests/snapshots/**\"],\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\"\n  }\n}\n"
  },
  {
    "path": "packages/nitro-v2-vite-plugin/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\n\nconst config = defineConfig({})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n    exclude: ['./src/tests/'],\n  }),\n)\n"
  },
  {
    "path": "packages/react-router/CHANGELOG.md",
    "content": "# @tanstack/react-router\n\n## 1.168.1\n\n### Patch Changes\n\n- Update store to 0.9.2 ([#6993](https://github.com/TanStack/router/pull/6993))\n\n- Updated dependencies [[`91cc628`](https://github.com/TanStack/router/commit/91cc62899b75ca920fe83c5ee7f3dbb5c71a523f)]:\n  - @tanstack/router-core@1.168.1\n\n## 1.168.0\n\n### Minor Changes\n\n- remove pendingMatches, cachedMatches ([#6704](https://github.com/TanStack/router/pull/6704))\n  move to signal-based reactivity\n  solid uses its own native signals\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/router-core@1.168.0\n\n## 1.167.5\n\n### Patch Changes\n\n- Updated dependencies [[`5ff4f0b`](https://github.com/TanStack/router/commit/5ff4f0b8dce1fac2bb0b0bfe2684fc677a8ee505)]:\n  - @tanstack/router-core@1.167.5\n\n## 1.167.4\n\n### Patch Changes\n\n- Add @tanstack/intent AI agent skills and CLI entry points for Router and Start packages ([#6866](https://github.com/TanStack/router/pull/6866))\n\n- Updated dependencies [[`940151c`](https://github.com/TanStack/router/commit/940151cbed0c76c92a5cf196c0905b17a956ca7e)]:\n  - @tanstack/router-core@1.167.4\n\n## 1.167.3\n\n### Patch Changes\n\n- Updated dependencies [[`32fcba7`](https://github.com/TanStack/router/commit/32fcba7b044b03f5901308b870f70b0b4910c220)]:\n  - @tanstack/router-core@1.167.3\n\n## 1.167.2\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/history@1.161.6\n  - @tanstack/router-core@1.167.2\n\n## 1.167.1\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/router-core@1.167.1\n  - @tanstack/history@1.161.5\n\n## 1.167.0\n\n### Minor Changes\n\n- feat: add staleReloadMode ([#6921](https://github.com/TanStack/router/pull/6921))\n\n### Patch Changes\n\n- Updated dependencies [[`6f297a2`](https://github.com/TanStack/router/commit/6f297a249424c0fd1c1a56aa4fc12c8217be7b6a)]:\n  - @tanstack/router-core@1.167.0\n\n## 1.166.8\n\n### Patch Changes\n\n- fix: hoist inline component definitions for proper React HMR#6919 ([#6919](https://github.com/TanStack/router/pull/6919))\n"
  },
  {
    "path": "packages/react-router/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack React Router\n\n![TanStack Router Header](https://raw.githubusercontent.com/TanStack/router/main/media/header_router.png)\n\n🤖 Type-safe router w/ built-in caching & URL state management for React!\n\n<a href=\"https://twitter.com/intent/tweet?button_hashtag=TanStack\" target=\"\\_parent\">\n  <img alt=\"#TanStack\" src=\"https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack\">\n</a><a href=\"https://discord.com/invite/WrRKjPJ\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/badge/Discord-TanStack-%235865F2\" />\n</a><a href=\"https://npmjs.com/package/@tanstack/react-router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/npm/dm/@tanstack/router.svg\" />\n</a><a href=\"https://bundlephobia.com/result?p=@tanstack/react-router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://badgen.net/bundlephobia/minzip/@tanstack/react-router\" />\n</a><a href=\"#badge\">\n    <img alt=\"semantic-release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\">\n  </a><a href=\"https://github.com/TanStack/router/discussions\">\n  <img alt=\"Join the discussion on Github\" src=\"https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue\" />\n</a><a href=\"https://bestofjs.org/projects/router\"><img alt=\"Best of JS\" src=\"https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=tanstack%2Frouter%26since=daily\" /></a><a href=\"https://github.com/TanStack/router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/github/stars/tanstack/router.svg?style=social&label=Star\" />\n</a><a href=\"https://twitter.com/tan_stack\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/twitter/follow/tan_stack.svg?style=social&label=Follow @TanStack\" />\n</a><a href=\"https://twitter.com/tannerlinsley\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow @TannerLinsley\" />\n</a>\n\nEnjoy this library? Try the entire [TanStack](https://tanstack.com)! [React Query](https://github.com/TanStack/query), [React Table](https://github.com/TanStack/table), [React Charts](https://github.com/TanStack/react-charts), [React Virtual](https://github.com/TanStack/virtual)\n\n## Visit [tanstack.com/router](https://tanstack.com/router) for docs, guides, API and more!\n"
  },
  {
    "path": "packages/react-router/bin/intent.js",
    "content": "#!/usr/bin/env node\n// Auto-generated by @tanstack/intent setup\n// Exposes the intent end-user CLI for consumers of this library.\n// Commit this file, then add to your package.json:\n//   \"bin\": { \"intent\": \"./bin/intent.js\" }\ntry {\n  await import('@tanstack/intent/intent-library')\n} catch (e) {\n  const isModuleNotFound =\n    e?.code === 'ERR_MODULE_NOT_FOUND' || e?.code === 'MODULE_NOT_FOUND'\n  const missingIntentLibrary =\n    typeof e?.message === 'string' && e.message.includes('@tanstack/intent')\n\n  if (isModuleNotFound && missingIntentLibrary) {\n    console.error('@tanstack/intent is not installed.')\n    console.error('')\n    console.error('Install it as a dev dependency:')\n    console.error('  npm add -D @tanstack/intent')\n    console.error('')\n    console.error('Or run directly:')\n    console.error('  npx @tanstack/intent@latest list')\n    process.exit(1)\n  }\n  throw e\n}\n"
  },
  {
    "path": "packages/react-router/eslint.config.ts",
    "content": "import pluginReact from '@eslint-react/eslint-plugin'\n// @ts-expect-error\nimport pluginReactHooks from 'eslint-plugin-react-hooks'\nimport rootConfig from '../../eslint.config.js'\nimport type { Linter } from 'eslint'\n\nexport default [\n  ...rootConfig,\n  {\n    ignores: ['bin/**'],\n  },\n  {\n    files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],\n  },\n  {\n    plugins: {\n      'react-hooks': pluginReactHooks,\n      '@eslint-react': pluginReact,\n    },\n    rules: {\n      '@eslint-react/no-unstable-context-value': 'off',\n      '@eslint-react/no-unstable-default-props': 'off',\n      '@eslint-react/dom/no-missing-button-type': 'off',\n      'react-hooks/exhaustive-deps': 'error',\n      'react-hooks/rules-of-hooks': 'error',\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n] as Array<Linter.Config>\n"
  },
  {
    "path": "packages/react-router/package.json",
    "content": "{\n  \"name\": \"@tanstack/react-router\",\n  \"version\": \"1.168.1\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/react-router\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts59\": \"tsc -p tsconfig.legacy.json\",\n    \"test:unit\": \"vitest\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch --hideSkippedTests\",\n    \"test:perf\": \"vitest bench\",\n    \"test:perf:dev\": \"pnpm run test:perf --watch --hideSkippedTests\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"pnpm run build:lib && pnpm run build:llm\",\n    \"build:lib\": \"vite build\",\n    \"build:llm\": \"node ../../scripts/llms-generate.mjs react-router && tsc -p ./llms/tsconfig.json\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"development\": \"./dist/esm/index.dev.js\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"development\": \"./dist/cjs/index.dev.cjs\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./ssr/server\": {\n      \"import\": {\n        \"types\": \"./dist/esm/ssr/server.d.ts\",\n        \"default\": \"./dist/esm/ssr/server.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/ssr/server.d.cts\",\n        \"default\": \"./dist/cjs/ssr/server.cjs\"\n      }\n    },\n    \"./ssr/client\": {\n      \"import\": {\n        \"types\": \"./dist/esm/ssr/client.d.ts\",\n        \"default\": \"./dist/esm/ssr/client.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/ssr/client.d.cts\",\n        \"default\": \"./dist/cjs/ssr/client.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\",\n    \"./llms\": {\n      \"import\": {\n        \"types\": \"./dist/llms/index.d.ts\",\n        \"default\": \"./dist/llms/index.js\"\n      }\n    }\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@tanstack/history\": \"workspace:*\",\n    \"@tanstack/react-store\": \"^0.9.2\",\n    \"@tanstack/router-core\": \"workspace:*\",\n    \"isbot\": \"^5.1.22\",\n    \"tiny-invariant\": \"^1.3.3\",\n    \"tiny-warning\": \"^1.0.3\"\n  },\n  \"devDependencies\": {\n    \"@testing-library/jest-dom\": \"^6.6.3\",\n    \"@testing-library/react\": \"^16.2.0\",\n    \"@vitejs/plugin-react\": \"^4.3.4\",\n    \"combinate\": \"^1.1.11\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vibe-rules\": \"^0.2.57\",\n    \"vite\": \"*\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"peerDependencies\": {\n    \"react\": \">=18.0.0 || >=19.0.0\",\n    \"react-dom\": \">=18.0.0 || >=19.0.0\"\n  }\n}\n"
  },
  {
    "path": "packages/react-router/skills/compositions/router-query/SKILL.md",
    "content": "---\nname: compositions/router-query\ndescription: >-\n  Integrating TanStack Router with TanStack Query: queryClient\n  in router context, ensureQueryData/prefetchQuery in loaders,\n  useSuspenseQuery in components, defaultPreloadStaleTime: 0,\n  setupRouterSsrQueryIntegration for SSR dehydration/hydration\n  and streaming, per-request QueryClient isolation.\ntype: composition\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\n  - router-core/data-loading\n  - react-router\nsources:\n  - TanStack/router:docs/router/guide/external-data-loading.md\n  - TanStack/router:docs/router/integrations/query.md\n---\n\n# TanStack Router + TanStack Query Integration\n\nThis skill requires familiarity with both TanStack Router and TanStack Query. Read [router-core](../../../../router-core/skills/router-core/SKILL.md) and [react-router](../../react-router/SKILL.md) first.\n\nThis skill covers coordinating TanStack Query as an external data cache with TanStack Router's loader system. The router acts as a **coordinator** — it triggers data fetching during navigation, while Query manages caching, background refetching, and data lifecycle.\n\n> **CRITICAL**: Set `defaultPreloadStaleTime: 0` when using TanStack Query. Without this, Router's built-in preload cache (30s default) prevents Query from controlling data freshness.\n\n> **CRITICAL**: For SSR, create `QueryClient` inside the `createRouter` factory function. A module-level singleton leaks data between server requests.\n\n## Setup: QueryClient in Router Context\n\n### Basic (Client-Only)\n\n```tsx\n// src/main.tsx\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport {\n  RouterProvider,\n  createRouter,\n  createRootRouteWithContext,\n} from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\n// Root route declares that router context includes queryClient\n// (root route file creates it with createRootRouteWithContext — see below)\n\nconst queryClient = new QueryClient()\n\nconst router = createRouter({\n  routeTree,\n  defaultPreloadStaleTime: 0, // Let Query manage caching\n  context: { queryClient },\n  Wrap: ({ children }) => (\n    <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n  ),\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nfunction App() {\n  return <RouterProvider router={router} />\n}\n```\n\n### Root Route with Context\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRouteWithContext, Outlet } from '@tanstack/react-router'\nimport type { QueryClient } from '@tanstack/react-query'\n\n// Double parentheses: factory pattern\nexport const Route = createRootRouteWithContext<{\n  queryClient: QueryClient\n}>()({\n  component: () => <Outlet />,\n})\n```\n\n### SSR-Safe Setup\n\n```tsx\n// src/router.tsx\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function createAppRouter() {\n  // Fresh QueryClient per request — prevents data leaking between SSR requests\n  const queryClient = new QueryClient()\n\n  return createRouter({\n    routeTree,\n    defaultPreloadStaleTime: 0,\n    context: { queryClient },\n    Wrap: ({ children }) => (\n      <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n    ),\n  })\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof createAppRouter>\n  }\n}\n```\n\n### SSR with `setupRouterSsrQueryIntegration`\n\nFor automatic SSR dehydration/hydration and streaming:\n\n```bash\nnpm install @tanstack/react-router-ssr-query\n```\n\n```tsx\n// src/router.tsx\nimport { QueryClient } from '@tanstack/react-query'\nimport { createRouter } from '@tanstack/react-router'\nimport { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'\nimport { routeTree } from './routeTree.gen'\n\nexport function createAppRouter() {\n  const queryClient = new QueryClient()\n\n  const router = createRouter({\n    routeTree,\n    defaultPreloadStaleTime: 0,\n    context: { queryClient },\n  })\n\n  setupRouterSsrQueryIntegration({\n    router,\n    queryClient,\n    // wrapQueryClient: true (default — wraps with QueryClientProvider)\n    // handleRedirects: true (default — handles redirect() from queries)\n  })\n\n  return router\n}\n```\n\nThe integration:\n\n- Dehydrates query state on the server and hydrates on the client automatically\n- Streams queries that resolve during server render to the client\n- Handles `redirect()` thrown from queries/mutations\n\n### Manual SSR Dehydration/Hydration (Without SSR Query Package)\n\n```tsx\n// src/router.tsx\nimport { QueryClient, dehydrate, hydrate } from '@tanstack/react-query'\nimport { QueryClientProvider } from '@tanstack/react-query'\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function createAppRouter() {\n  const queryClient = new QueryClient()\n\n  return createRouter({\n    routeTree,\n    defaultPreloadStaleTime: 0,\n    context: { queryClient },\n    dehydrate: () => ({\n      queryClientState: dehydrate(queryClient),\n    }),\n    hydrate: (dehydrated) => {\n      hydrate(queryClient, dehydrated.queryClientState)\n    },\n    Wrap: ({ children }) => (\n      <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n    ),\n  })\n}\n```\n\n## Core Pattern: `ensureQueryData` in Loader + `useSuspenseQuery` in Component\n\nThis is the recommended pattern. The loader ensures data is in the cache before render (no loading flash). The component subscribes to the cache for updates.\n\n```tsx\n// src/routes/posts.tsx\nimport { queryOptions, useSuspenseQuery } from '@tanstack/react-query'\nimport { createFileRoute } from '@tanstack/react-router'\n\ninterface Post {\n  id: string\n  title: string\n}\n\nconst postsQueryOptions = queryOptions({\n  queryKey: ['posts'],\n  queryFn: (): Promise<Array<Post>> =>\n    fetch('/api/posts').then((r) => r.json()),\n})\n\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context }) => {\n    // ensureQueryData returns cached data if available, fetches if not in cache\n    // To also refetch stale data, pass revalidateIfStale: true\n    return context.queryClient.ensureQueryData(postsQueryOptions)\n  },\n  component: PostsPage,\n})\n\nfunction PostsPage() {\n  // useSuspenseQuery subscribes to cache — gets background updates\n  const { data: posts } = useSuspenseQuery(postsQueryOptions)\n\n  return (\n    <ul>\n      {posts.map((post) => (\n        <li key={post.id}>{post.title}</li>\n      ))}\n    </ul>\n  )\n}\n```\n\n### With Dynamic Params\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { queryOptions, useSuspenseQuery } from '@tanstack/react-query'\nimport { createFileRoute } from '@tanstack/react-router'\n\ninterface Post {\n  id: string\n  title: string\n  content: string\n}\n\nconst postQueryOptions = (postId: string) =>\n  queryOptions({\n    queryKey: ['posts', postId],\n    queryFn: () => fetch(`/api/posts/${postId}`).then((r) => r.json()),\n  })\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ context, params }) => {\n    return context.queryClient.ensureQueryData(postQueryOptions(params.postId))\n  },\n  component: PostPage,\n})\n\nfunction PostPage() {\n  const { postId } = Route.useParams()\n  const { data: post } = useSuspenseQuery(postQueryOptions(postId))\n\n  return <article>{post.title}</article>\n}\n```\n\n## Streaming Pattern: `prefetchQuery` (Not Awaited)\n\nFor non-critical data, start the fetch without blocking navigation:\n\n```tsx\nimport { useQuery, useSuspenseQuery } from '@tanstack/react-query'\n\nexport const Route = createFileRoute('/dashboard')({\n  loader: ({ context }) => {\n    // Await critical data\n    const user = context.queryClient.ensureQueryData(userQueryOptions)\n\n    // Start non-critical fetch without awaiting — streams during SSR\n    context.queryClient.prefetchQuery(analyticsQueryOptions)\n\n    return user\n  },\n  component: Dashboard,\n})\n\nfunction Dashboard() {\n  // Critical: suspense (data ready immediately)\n  const { data: user } = useSuspenseQuery(userQueryOptions)\n\n  // Non-critical: regular query (shows loading state)\n  const { data: analytics, isLoading } = useQuery(analyticsQueryOptions)\n\n  return (\n    <div>\n      <h1>Welcome {user.name}</h1>\n      {isLoading ? <Skeleton /> : <AnalyticsChart data={analytics} />}\n    </div>\n  )\n}\n```\n\n## Error Handling with `useQueryErrorResetBoundary`\n\n```tsx\nimport { useEffect } from 'react'\nimport { useQueryErrorResetBoundary } from '@tanstack/react-query'\nimport { useRouter } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context }) =>\n    context.queryClient.ensureQueryData(postsQueryOptions),\n  errorComponent: PostsErrorComponent,\n  component: PostsPage,\n})\n\nfunction PostsErrorComponent({\n  error,\n  reset,\n}: {\n  error: Error\n  reset: () => void\n}) {\n  const router = useRouter()\n  const queryErrorResetBoundary = useQueryErrorResetBoundary()\n\n  useEffect(() => {\n    queryErrorResetBoundary.reset()\n  }, [queryErrorResetBoundary])\n\n  return (\n    <div>\n      <p>{error.message}</p>\n      <button onClick={() => router.invalidate()}>Retry</button>\n    </div>\n  )\n}\n```\n\n## Common Mistakes\n\n### 1. HIGH: Not setting `defaultPreloadStaleTime` to 0\n\nRouter has a built-in preload cache (default `staleTime` for preloads is 30s). This prevents Query from controlling data freshness during preloading.\n\n```tsx\n// WRONG — Router's preload cache serves stale data, Query never refetches\nconst router = createRouter({ routeTree })\n\n// CORRECT — disable Router's preload cache, let Query manage freshness\nconst router = createRouter({\n  routeTree,\n  defaultPreloadStaleTime: 0,\n})\n```\n\n### 2. HIGH: Creating QueryClient outside `createRouter` for SSR\n\nA module-level singleton `QueryClient` is shared across all server requests, leaking user data between requests.\n\n```tsx\n// WRONG — shared across SSR requests\nconst queryClient = new QueryClient()\nexport function createAppRouter() {\n  return createRouter({\n    routeTree,\n    context: { queryClient },\n  })\n}\n\n// CORRECT — new QueryClient per createAppRouter call\nexport function createAppRouter() {\n  const queryClient = new QueryClient()\n  return createRouter({\n    routeTree,\n    context: { queryClient },\n  })\n}\n```\n\n### 3. MEDIUM: Awaiting `prefetchQuery` in loader blocks rendering\n\n`prefetchQuery` is designed to fire-and-forget. Awaiting it blocks the navigation transition until the data resolves, defeating the purpose of streaming.\n\n```tsx\n// WRONG — blocks navigation, no streaming benefit\nloader: async ({ context }) => {\n  await context.queryClient.prefetchQuery(analyticsQueryOptions)\n}\n\n// CORRECT — fire and forget for streaming\nloader: ({ context }) => {\n  context.queryClient.prefetchQuery(analyticsQueryOptions)\n}\n\n// If you need to block (critical data), use ensureQueryData instead:\nloader: ({ context }) => {\n  return context.queryClient.ensureQueryData(criticalQueryOptions)\n}\n```\n\n### 4. HIGH: Missing double parentheses on `createRootRouteWithContext`\n\n`createRootRouteWithContext<Type>()` is a factory — it returns a function. The second call passes route options.\n\n```tsx\n// WRONG — passing options to the factory, not the returned function\nconst rootRoute = createRootRouteWithContext<{ queryClient: QueryClient }>({\n  component: RootComponent,\n})\n\n// CORRECT — double call: factory()({options})\nconst rootRoute = createRootRouteWithContext<{ queryClient: QueryClient }>()({\n  component: RootComponent,\n})\n```\n\n## Tension: Built-In SWR Cache vs External Cache\n\nTanStack Router has its own SWR cache (`staleTime`, `gcTime`, `defaultPreloadStaleTime`). When using Query as an external cache:\n\n- Set `defaultPreloadStaleTime: 0` to prevent Router's cache from short-circuiting Query's freshness logic\n- Router's `staleTime`/`gcTime` still apply to the loader return value. For pure Query patterns, return nothing from the loader (just `ensureQueryData` for the side effect) and read data exclusively from `useSuspenseQuery`\n- `router.invalidate()` re-runs loaders (which call `ensureQueryData`), but Query decides whether to actually refetch based on its own `staleTime`\n\n## Cross-References\n\n- [router-core/data-loading](../../../../router-core/skills/router-core/data-loading/SKILL.md) — built-in loader caching fundamentals\n- [router-core/ssr](../../../../router-core/skills/router-core/ssr/SKILL.md) — SSR setup for dehydration/hydration\n"
  },
  {
    "path": "packages/react-router/skills/lifecycle/migrate-from-react-router/SKILL.md",
    "content": "---\nname: lifecycle/migrate-from-react-router\ndescription: >-\n  Step-by-step migration from React Router v7 to TanStack Router:\n  route definition conversion, Link/useNavigate API differences,\n  useSearchParams to validateSearch + useSearch, useParams with from,\n  Outlet replacement, loader conversion, code splitting differences.\ntype: lifecycle\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\n  - react-router\nsources:\n  - TanStack/router:docs/router/how-to/migrate-from-react-router.md\n  - TanStack/router:docs/router/installation/migrate-from-react-router.md\n---\n\n# Migrate from React Router v7 to TanStack Router\n\nThis is a step-by-step migration checklist. Each check covers one conversion task. Complete them in order.\n\n> **CRITICAL**: If your UI is blank after migration, open the console. Errors like \"cannot use useNavigate outside of context\" mean React Router imports remain alongside TanStack Router imports. Uninstall `react-router` (and `react-router-dom` if present) to surface them as TypeScript errors.\n>\n> **CRITICAL**: TanStack Router uses `to` + `params` for navigation, NOT template literal paths. Never interpolate params into the `to` string.\n>\n> **NOTE**: React Router v7 recommends importing from `react-router` (not `react-router-dom`). The `react-router-dom` package still exists but just re-exports from `react-router`. Check for imports from both.\n\n## Pre-Migration\n\n- [ ] **Create a migration branch**\n\n```bash\ngit checkout -b migrate-to-tanstack-router\n```\n\n- [ ] **Install TanStack Router alongside React Router temporarily**\n\n```bash\nnpm install @tanstack/react-router @tanstack/react-router-devtools\nnpm install -D @tanstack/router-plugin\n```\n\n- [ ] **Configure bundler plugin (Vite example)**\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({ target: 'react', autoCodeSplitting: true }),\n    react(),\n  ],\n})\n```\n\n- [ ] **Create routes directory**\n\n```bash\nmkdir src/routes\n```\n\n## Route Definitions\n\n- [ ] **Create root route**\n\nReact Router: `<BrowserRouter>` or `createBrowserRouter([{ element: <Layout />, children: [...] }])`\n\nTanStack Router: `src/routes/__root.tsx`\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Link, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <>\n      <nav>\n        <Link to=\"/\">Home</Link>\n        <Link to=\"/about\">About</Link>\n      </nav>\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  ),\n})\n```\n\n- [ ] **Create router instance with type registration**\n\n```tsx\n// src/main.tsx\nimport { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('root')!\nif (!rootElement.innerHTML) {\n  ReactDOM.createRoot(rootElement).render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n```\n\n- [ ] **Convert each route file to `createFileRoute`**\n\nReact Router:\n\n```tsx\n// Defined in route config array\n{ path: '/posts', element: <Posts />, loader: postsLoader }\n```\n\nTanStack Router:\n\n```tsx\n// src/routes/posts.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    const posts = await fetchPosts()\n    return { posts }\n  },\n  component: PostsPage,\n})\n\nfunction PostsPage() {\n  const { posts } = Route.useLoaderData()\n  return (\n    <ul>\n      {posts.map((p) => (\n        <li key={p.id}>{p.title}</li>\n      ))}\n    </ul>\n  )\n}\n```\n\n- [ ] **Convert dynamic routes**\n\nReact Router: `/posts/:postId` (colon syntax)\n\nTanStack Router: `/posts/$postId` (dollar syntax)\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  component: PostPage,\n})\n\nfunction PostPage() {\n  const { post } = Route.useLoaderData()\n  return <article>{post.title}</article>\n}\n```\n\n## Navigation\n\n- [ ] **Convert all `<Link>` components**\n\nReact Router:\n\n```tsx\nimport { Link } from 'react-router'\n;<Link to={`/posts/${postId}`}>View Post</Link>\n```\n\nTanStack Router:\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n;<Link to=\"/posts/$postId\" params={{ postId }}>\n  View Post\n</Link>\n```\n\nKey differences:\n\n- `to` is a route path pattern, NOT an interpolated string\n- `params` is a separate prop with typed values\n- Active styling: use `activeProps={{ className: 'font-bold' }}` or `data-status=\"active\"` attribute for CSS\n\n- [ ] **Convert all `useNavigate` calls**\n\nReact Router:\n\n```tsx\nimport { useNavigate } from 'react-router'\nconst navigate = useNavigate()\nnavigate(`/posts/${postId}`)\n```\n\nTanStack Router:\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\nconst navigate = useNavigate()\nnavigate({ to: '/posts/$postId', params: { postId } })\n```\n\n## Search Params\n\n- [ ] **Replace `useSearchParams` with `validateSearch` + `useSearch`**\n\nReact Router:\n\n```tsx\nimport { useSearchParams } from 'react-router'\n\nfunction Posts() {\n  const [searchParams, setSearchParams] = useSearchParams()\n  const page = Number(searchParams.get('page')) || 1\n\n  const goToPage = (p: number) => setSearchParams({ page: String(p) })\n}\n```\n\nTanStack Router:\n\n```tsx\n// In the route definition:\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nexport const Route = createFileRoute('/posts')({\n  validateSearch: z.object({\n    page: z.number().default(1).catch(1),\n  }),\n  component: Posts,\n})\n\n// In the component:\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction Posts() {\n  const { page } = Route.useSearch()\n  const navigate = useNavigate({ from: '/posts' })\n\n  const goToPage = (p: number) => {\n    navigate({ search: (prev) => ({ ...prev, page: p }) })\n  }\n}\n```\n\nKey differences:\n\n- Search params are validated and typed at the route level\n- `useSearch()` returns typed objects, not `URLSearchParams`\n- Update with function form to preserve other params\n\n## Path Params\n\n- [ ] **Update `useParams` with `from` property**\n\nReact Router:\n\n```tsx\nimport { useParams } from 'react-router'\nconst { postId } = useParams()\n```\n\nTanStack Router:\n\n```tsx\nimport { useParams } from '@tanstack/react-router'\nconst { postId } = useParams({ from: '/posts/$postId' })\n```\n\nOr from within the route component:\n\n```tsx\nconst { postId } = Route.useParams()\n```\n\n## `useLocation` — Common Pitfall\n\n- [ ] **Replace `useLocation` with specific hooks**\n\nReact Router's `useLocation` is heavily used, and TanStack Router has a hook with the same name — but they are NOT equivalent. TanStack Router's `useLocation()` returns the router's current location, which during pending navigations may differ from what's currently rendered. Most React Router `useLocation` usage should be replaced with more specific hooks. See [#3110](https://github.com/TanStack/router/issues/3110).\n\nReplace based on what you actually need:\n\n```tsx\n// React Router\nimport { useLocation } from 'react-router'\nconst location = useLocation()\n\n// ❌ DON'T just swap to TanStack Router's useLocation — it's the \"live\" URL\nimport { useLocation } from '@tanstack/react-router'\n\n// ✅ DO use the specific hook for what you need:\nimport {\n  useMatch,\n  useMatches,\n  useParams,\n  useSearch,\n} from '@tanstack/react-router'\n\n// Current route match (replaces most useLocation().pathname usage)\nconst match = useMatch({ from: '/posts/$postId' })\n\n// All active matches (replaces useLocation for breadcrumbs/analytics)\nconst matches = useMatches()\n\n// Path params (replaces useLocation + manual parsing)\nconst { postId } = useParams({ from: '/posts/$postId' })\n\n// Search params (replaces useLocation().search parsing)\nconst { page } = useSearch({ from: '/posts' })\n```\n\n## Outlet\n\n- [ ] **Replace React Router `Outlet` with TanStack Router `Outlet`**\n\nThe API is identical — just change the import:\n\n```tsx\n// Before\nimport { Outlet } from 'react-router'\n\n// After\nimport { Outlet } from '@tanstack/react-router'\n```\n\n## Loaders\n\n- [ ] **Convert React Router loaders**\n\nReact Router (v7):\n\n```tsx\nexport async function loader({ params }) {\n  const post = await fetchPost(params.postId)\n  return { post }\n}\n\nexport default function Post() {\n  const { post } = useLoaderData()\n  return <div>{post.title}</div>\n}\n```\n\nTanStack Router:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  component: Post,\n})\n\nfunction Post() {\n  const { post } = Route.useLoaderData()\n  return <div>{post.title}</div>\n}\n```\n\nKey differences:\n\n- Loader is a route option, not a separate export\n- `useLoaderData()` is called via `Route.useLoaderData()` (or `useLoaderData({ from })`)\n- TanStack Router loaders run on the CLIENT by default (not server-only)\n- No `json()` wrapper needed — return plain objects\n\n## Code Splitting\n\n- [ ] **Convert lazy route imports** — with `autoCodeSplitting: true` in the plugin config, this is automatic. For manual splitting, use `.lazy.tsx` files:\n\n```tsx\n// src/routes/lazy-page.lazy.tsx\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/lazy-page')({\n  component: () => <div>Lazy loaded</div>,\n})\n```\n\n## Cleanup\n\n- [ ] **Remove React Router and verify**\n\n```bash\nnpm uninstall react-router react-router-dom\ngrep -r \"from 'react-router\" src/  # find stale imports\nnpx tsc --noEmit                    # verify clean build\n```\n\n- [ ] **Test all routes** — verify rendering, navigation (incl. back/forward), search params, dynamic params, and loaders\n\n## Common Mistakes\n\n### 1. HIGH: Leaving React Router imports alongside TanStack Router\n\nBoth libraries export `Link`, `useNavigate`, `Outlet`, etc. Leftover React Router imports cause \"cannot use useNavigate outside of context\" errors because the wrong context provider is used.\n\n```tsx\n// WRONG — mixed imports\nimport { Link } from '@tanstack/react-router'\nimport { useNavigate } from 'react-router' // <- still React Router!\n\n// CORRECT — all from TanStack Router\nimport { Link, useNavigate } from '@tanstack/react-router'\n```\n\n**Fix**: Uninstall `react-router`/`react-router-dom` completely. TypeScript will flag every stale import.\n\n### 2. HIGH: Using React Router `useSearchParams` pattern\n\n```tsx\n// WRONG — React Router pattern, returns URLSearchParams\nconst [searchParams, setSearchParams] = useSearchParams()\nconst page = Number(searchParams.get('page'))\n\n// CORRECT — TanStack Router pattern, returns typed object\n// Route definition:\nvalidateSearch:\n  z.object({\n    page: z.number().default(1).catch(1),\n  }),\n\n// Component:\nconst { page } = Route.useSearch()\n// page is already typed as number — no casting needed\n```\n\n### 3. HIGH: Interpolating params into `to` string\n\n```tsx\n// WRONG — React Router habit\n<Link to={`/posts/${postId}`}>Post</Link>\n\n// CORRECT — TanStack Router: path pattern + params prop\n<Link to=\"/posts/$postId\" params={{ postId }}>Post</Link>\n```\n\n### 4. MEDIUM: Using `:param` syntax instead of `$param`\n\n```text\nReact Router: /posts/:postId\nTanStack Router: /posts/$postId\n```\n\nFile naming also uses `$`: `src/routes/posts/$postId.tsx`\n\n## Quick Reference: API Mapping\n\n| React Router v7              | TanStack Router                                      |\n| ---------------------------- | ---------------------------------------------------- |\n| `<BrowserRouter>`            | `<RouterProvider router={router} />`                 |\n| `<Routes>` / `<Route>`       | File-based: `src/routes/*.tsx`                       |\n| `<Link to=\"/path\">`          | `<Link to=\"/path\">`                                  |\n| `<Link to={`/posts/${id}`}>` | `<Link to=\"/posts/$postId\" params={{ postId: id }}>` |\n| `useNavigate()('/path')`     | `navigate({ to: '/path' })`                          |\n| `useParams()`                | `useParams({ from: '/route/$param' })`               |\n| `useSearchParams()`          | `validateSearch` + `useSearch({ from })`             |\n| `useLoaderData()`            | `Route.useLoaderData()`                              |\n| `useLocation()`              | `useMatch`, `useMatches`, `useParams`, `useSearch`   |\n| `<Outlet />`                 | `<Outlet />`                                         |\n| `loader({ params })`         | `loader: ({ params }) => ...` (route option)         |\n| `action({ request })`        | Use mutations / form libraries                       |\n| `lazy(() => import(...))`    | `autoCodeSplitting` or `.lazy.tsx` files             |\n| `:paramName`                 | `$paramName`                                         |\n| `*` (splat)                  | `$` (splat, accessed via `_splat`)                   |\n"
  },
  {
    "path": "packages/react-router/skills/react-router/SKILL.md",
    "content": "---\nname: react-router\ndescription: >-\n  React bindings for TanStack Router: RouterProvider, useRouter,\n  useRouterState, useMatch, useMatches, useLocation, useSearch,\n  useParams, useNavigate, useLoaderData, useLoaderDeps,\n  useRouteContext, useBlocker, useCanGoBack, Link, Navigate,\n  Outlet, CatchBoundary, ErrorComponent. React-specific patterns\n  for hooks, providers, SSR hydration, and createLink with\n  forwardRef.\ntype: framework\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nframework: react\nrequires:\n  - router-core\nsources:\n  - TanStack/router:packages/react-router/src\n  - TanStack/router:docs/router/guide/creating-a-router.md\n  - TanStack/router:docs/router/installation/manual.md\n---\n\n# React Router (`@tanstack/react-router`)\n\nThis skill builds on router-core. Read [router-core](../../../router-core/skills/router-core/SKILL.md) first for foundational concepts.\n\nThis skill covers the React-specific bindings, components, hooks, and setup for TanStack Router.\n\n> **CRITICAL**: TanStack Router types are FULLY INFERRED. Never cast, never annotate inferred values.\n> **CRITICAL**: TanStack Router is CLIENT-FIRST. Loaders run on the client by default, not on the server.\n> **CRITICAL**: Do not confuse `@tanstack/react-router` with `react-router-dom`/`react-router`. They are completely different libraries with different APIs.\n\n## Full Setup: File-Based Routing with Vite\n\n### 1. Install Dependencies\n\n```bash\nnpm install @tanstack/react-router\nnpm install -D @tanstack/router-plugin @tanstack/react-router-devtools\n```\n\n### 2. Configure Vite Plugin\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    // MUST come before react()\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n```\n\n### 3. Create Root Route\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Link, Outlet } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nexport const Route = createRootRoute({\n  component: RootLayout,\n})\n\nfunction RootLayout() {\n  return (\n    <>\n      <nav>\n        <Link to=\"/\" className=\"[&.active]:font-bold\">\n          Home\n        </Link>\n        <Link to=\"/about\" className=\"[&.active]:font-bold\">\n          About\n        </Link>\n      </nav>\n      <hr />\n      <Outlet />\n      <TanStackRouterDevtools />\n    </>\n  )\n}\n```\n\n### 4. Create Route Files\n\n```tsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomePage,\n})\n\nfunction HomePage() {\n  return <h1>Welcome Home</h1>\n}\n```\n\n```tsx\n// src/routes/about.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: AboutPage,\n})\n\nfunction AboutPage() {\n  return <h1>About</h1>\n}\n```\n\n### 5. Create Router Instance and Register Types\n\n```tsx\n// src/main.tsx\nimport { StrictMode } from 'react'\nimport ReactDOM from 'react-dom/client'\nimport { RouterProvider, createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\n// REQUIRED — without this, Link/useNavigate/useSearch have no type safety\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nconst rootElement = document.getElementById('root')!\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement)\n  root.render(\n    <StrictMode>\n      <RouterProvider router={router} />\n    </StrictMode>,\n  )\n}\n```\n\n## Hooks Reference\n\nAll hooks are imported from `@tanstack/react-router`.\n\n### `useRouter()`\n\nAccess the router instance directly:\n\n```tsx\nimport { useRouter } from '@tanstack/react-router'\n\nfunction InvalidateButton() {\n  const router = useRouter()\n  return <button onClick={() => router.invalidate()}>Refresh data</button>\n}\n```\n\n### `useRouterState()`\n\nSubscribe to router state changes. Exposes the entire state and thus incurs\na performance cost. For matches or location favor `useMatches` and `useLocation`.\n\n```tsx\nimport { useRouterState } from '@tanstack/react-router'\n\nfunction LoadingIndicator() {\n  const isLoading = useRouterState({ select: (s) => s.isLoading })\n  return isLoading ? <div>Loading...</div> : null\n}\n```\n\n### `useNavigate()`\n\nProgrammatic navigation (prefer `<Link>` for user-clickable elements):\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction AfterSubmit() {\n  const navigate = useNavigate()\n\n  const handleSubmit = async () => {\n    await saveData()\n    navigate({ to: '/posts/$postId', params: { postId: '123' } })\n  }\n\n  return <button onClick={handleSubmit}>Save</button>\n}\n```\n\n### `useSearch({ from })`\n\nRead validated search params:\n\n```tsx\nimport { useSearch } from '@tanstack/react-router'\n\nfunction Pagination() {\n  const { page } = useSearch({ from: '/products' })\n  return <span>Page {page}</span>\n}\n```\n\n### `useParams({ from })`\n\nRead path params:\n\n```tsx\nimport { useParams } from '@tanstack/react-router'\n\nfunction PostHeader() {\n  const { postId } = useParams({ from: '/posts/$postId' })\n  return <h2>Post {postId}</h2>\n}\n```\n\n### `useLoaderData({ from })`\n\nRead data returned from the route loader:\n\n```tsx\nimport { useLoaderData } from '@tanstack/react-router'\n\nfunction PostContent() {\n  const { post } = useLoaderData({ from: '/posts/$postId' })\n  return <article>{post.content}</article>\n}\n```\n\n### `useMatch({ from })`\n\nAccess the full route match (params, search, loader data, context):\n\n```tsx\nimport { useMatch } from '@tanstack/react-router'\n\nfunction PostDetails() {\n  const match = useMatch({ from: '/posts/$postId' })\n  return <div>{match.loaderData.post.title}</div>\n}\n```\n\n### Other Hooks\n\nAll imported from `@tanstack/react-router`:\n\n- **`useMatches()`** — array of all active route matches (useful for breadcrumbs)\n- **`useRouteContext({ from })`** — read context from `beforeLoad` or parent routes\n- **`useBlocker({ shouldBlockFn })`** — block navigation for unsaved changes\n- **`useCanGoBack()`** — returns `boolean`, check if history has entries to go back to\n- **`useLocation()`** — current parsed location (`pathname`, `search`, `hash`)\n- **`useLinkProps({ to, params?, search? })`** — get `<a>` props for custom link elements\n- **`useMatchRoute()`** — returns a function: `matchRoute({ to }) => match | false`\n\n## Components Reference\n\n### `RouterProvider`\n\nMount the router at the top of your React tree:\n\n```tsx\n<RouterProvider router={router} />\n```\n\n### `Link`\n\nType-safe navigation link with `<a>` semantics:\n\n```tsx\n<Link to=\"/posts/$postId\" params={{ postId: '42' }}>\n  View Post\n</Link>\n```\n\n### `Outlet`\n\nRenders the matched child route component:\n\n```tsx\nfunction Layout() {\n  return (\n    <div>\n      <Sidebar />\n      <main>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n```\n\n### `Navigate`\n\nDeclarative redirect component:\n\n```tsx\nimport { Navigate } from '@tanstack/react-router'\n\nfunction OldPage() {\n  return <Navigate to=\"/new-page\" />\n}\n```\n\n### `Await`\n\nRenders deferred data from unawaited loader promises with Suspense:\n\n```tsx\nimport { Await } from '@tanstack/react-router'\nimport { Suspense } from 'react'\n\nfunction PostWithComments() {\n  const { deferredComments } = Route.useLoaderData()\n  return (\n    <div>\n      <h1>Post</h1>\n      <Suspense fallback={<div>Loading comments...</div>}>\n        <Await promise={deferredComments}>\n          {(comments) => (\n            <ul>\n              {comments.map((c) => (\n                <li key={c.id}>{c.text}</li>\n              ))}\n            </ul>\n          )}\n        </Await>\n      </Suspense>\n    </div>\n  )\n}\n```\n\n### `CatchBoundary`\n\nError boundary for component-level error handling (route-level errors use `errorComponent` route option):\n\n```tsx\nimport { CatchBoundary } from '@tanstack/react-router'\n;<CatchBoundary\n  getResetKey={() => 'widget'}\n  onCatch={(error) => console.error(error)}\n  errorComponent={({ error }) => <div>Error: {error.message}</div>}\n>\n  <RiskyWidget />\n</CatchBoundary>\n```\n\n## React-Specific Patterns\n\n### Custom Link Component with `createLink`\n\nWrap `Link` in a custom component while preserving type safety:\n\n```tsx\nimport { createLink } from '@tanstack/react-router'\nimport { forwardRef, type ComponentPropsWithoutRef } from 'react'\n\nconst StyledLinkComponent = forwardRef<\n  HTMLAnchorElement,\n  ComponentPropsWithoutRef<'a'>\n>((props, ref) => (\n  <a ref={ref} {...props} className={`styled-link ${props.className ?? ''}`} />\n))\n\nconst StyledLink = createLink(StyledLinkComponent)\n\n// Usage — same type-safe props as Link\nfunction Nav() {\n  return (\n    <StyledLink to=\"/posts/$postId\" params={{ postId: '42' }}>\n      Post\n    </StyledLink>\n  )\n}\n```\n\n### Reusable Components with Router Hooks\n\nTo create a component that uses router hooks across multiple routes, pass a union of route paths as the `from` prop:\n\n```tsx\nfunction PostIdDisplay({ from }: { from: '/posts/$id' | '/drafts/$id' }) {\n  const { id } = useParams({ from })\n  return <span>ID: {id}</span>\n}\n\n// Usage in different route components\n<PostIdDisplay from=\"/posts/$id\" />\n<PostIdDisplay from=\"/drafts/$id\" />\n```\n\nThis pattern avoids `strict: false` (which returns an imprecise union) while keeping the component reusable across specific known routes.\n\n### Auth Provider Must Wrap RouterProvider\n\nIf routes use auth context (via `createRootRouteWithContext`), the auth provider must be an ancestor of `RouterProvider`:\n\n```tsx\n// CORRECT — AuthProvider wraps RouterProvider\nfunction App() {\n  return (\n    <AuthProvider>\n      <RouterProvider router={router} />\n    </AuthProvider>\n  )\n}\n\n// WRONG — RouterProvider outside auth provider\nfunction App() {\n  return (\n    <RouterProvider router={router}>\n      <AuthProvider>{/* ... */}</AuthProvider>\n    </RouterProvider>\n  )\n}\n```\n\nOr use the `Wrap` router option to provide context without wrapping externally:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  Wrap: ({ children }) => (\n    <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n  ),\n})\n```\n\n## Common Mistakes\n\n### 1. HIGH: Using React hooks in `beforeLoad` or `loader`\n\n`beforeLoad` and `loader` are NOT React components — they are plain async functions. React hooks cannot be called in them. Pass auth state via router context instead.\n\n```tsx\n// WRONG — useAuth is a React hook, cannot be called here\nbeforeLoad: () => {\n  const auth = useAuth()\n  if (!auth.user) throw redirect({ to: '/login' })\n}\n\n// CORRECT — read auth from router context\nbeforeLoad: ({ context }) => {\n  if (!context.auth.isAuthenticated) {\n    throw redirect({ to: '/login' })\n  }\n}\n```\n\n### 2. HIGH: Wrapping RouterProvider inside an auth provider incorrectly\n\nCreate the router once with an `undefined!` placeholder, then inject live auth via `RouterProvider`'s `context` prop. Do NOT recreate the router on auth changes — this resets caches and rebuilds the tree.\n\n```tsx\n// CORRECT — create router once, inject live auth via context prop\nconst router = createRouter({\n  routeTree,\n  context: { auth: undefined! }, // placeholder, filled by RouterProvider\n})\n\nfunction InnerApp() {\n  const auth = useAuth()\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthProvider>\n      <InnerApp />\n    </AuthProvider>\n  )\n}\n```\n\n### 3. MEDIUM: Missing Suspense boundary for `Await`/deferred data\n\n`Await` requires a `<Suspense>` ancestor. Without it, the deferred promise has no fallback UI and throws.\n\n```tsx\n// WRONG — no Suspense boundary\n<Await promise={deferredData}>{(data) => <div>{data}</div>}</Await>\n\n// CORRECT — wrap in Suspense\n<Suspense fallback={<div>Loading...</div>}>\n  <Await promise={deferredData}>{(data) => <div>{data}</div>}</Await>\n</Suspense>\n```\n\n## Cross-References\n\n- [router-core/SKILL.md](../../../router-core/skills/router-core/SKILL.md) — all sub-skills for domain-specific patterns (search params, data loading, navigation, auth, SSR, etc.)\n"
  },
  {
    "path": "packages/react-router/src/Asset.tsx",
    "content": "import * as React from 'react'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport { useHydrated } from './ClientOnly'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\ninterface ScriptAttrs {\n  [key: string]: string | boolean | undefined\n  src?: string\n  suppressHydrationWarning?: boolean\n}\n\nexport function Asset({\n  tag,\n  attrs,\n  children,\n  nonce,\n}: RouterManagedTag & { nonce?: string }): React.ReactElement | null {\n  switch (tag) {\n    case 'title':\n      return (\n        <title {...attrs} suppressHydrationWarning>\n          {children}\n        </title>\n      )\n    case 'meta':\n      return <meta {...attrs} suppressHydrationWarning />\n    case 'link':\n      return <link {...attrs} nonce={nonce} suppressHydrationWarning />\n    case 'style':\n      return (\n        <style\n          {...attrs}\n          dangerouslySetInnerHTML={{ __html: children as string }}\n          nonce={nonce}\n        />\n      )\n    case 'script':\n      return <Script attrs={attrs}>{children}</Script>\n    default:\n      return null\n  }\n}\n\nfunction Script({\n  attrs,\n  children,\n}: {\n  attrs?: ScriptAttrs\n  children?: string\n}) {\n  const router = useRouter()\n  const hydrated = useHydrated()\n  const dataScript =\n    typeof attrs?.type === 'string' &&\n    attrs.type !== '' &&\n    attrs.type !== 'text/javascript' &&\n    attrs.type !== 'module'\n\n  if (\n    process.env.NODE_ENV !== 'production' &&\n    attrs?.src &&\n    typeof children === 'string' &&\n    children.trim().length\n  ) {\n    console.warn(\n      '[TanStack Router] <Script> received both `src` and `children`. The `children` content will be ignored. Remove `children` or remove `src`.',\n    )\n  }\n\n  React.useEffect(() => {\n    if (dataScript) return\n\n    if (attrs?.src) {\n      const normSrc = (() => {\n        try {\n          const base = document.baseURI || window.location.href\n          return new URL(attrs.src, base).href\n        } catch {\n          return attrs.src\n        }\n      })()\n      const existingScript = Array.from(\n        document.querySelectorAll('script[src]'),\n      ).find((el) => (el as HTMLScriptElement).src === normSrc)\n\n      if (existingScript) {\n        return\n      }\n\n      const script = document.createElement('script')\n\n      for (const [key, value] of Object.entries(attrs)) {\n        if (\n          key !== 'suppressHydrationWarning' &&\n          value !== undefined &&\n          value !== false\n        ) {\n          script.setAttribute(\n            key,\n            typeof value === 'boolean' ? '' : String(value),\n          )\n        }\n      }\n\n      document.head.appendChild(script)\n\n      return () => {\n        if (script.parentNode) {\n          script.parentNode.removeChild(script)\n        }\n      }\n    }\n\n    if (typeof children === 'string') {\n      const typeAttr =\n        typeof attrs?.type === 'string' ? attrs.type : 'text/javascript'\n      const nonceAttr =\n        typeof attrs?.nonce === 'string' ? attrs.nonce : undefined\n      const existingScript = Array.from(\n        document.querySelectorAll('script:not([src])'),\n      ).find((el) => {\n        if (!(el instanceof HTMLScriptElement)) return false\n        const sType = el.getAttribute('type') ?? 'text/javascript'\n        const sNonce = el.getAttribute('nonce') ?? undefined\n        return (\n          el.textContent === children &&\n          sType === typeAttr &&\n          sNonce === nonceAttr\n        )\n      })\n\n      if (existingScript) {\n        return\n      }\n\n      const script = document.createElement('script')\n      script.textContent = children\n\n      if (attrs) {\n        for (const [key, value] of Object.entries(attrs)) {\n          if (\n            key !== 'suppressHydrationWarning' &&\n            value !== undefined &&\n            value !== false\n          ) {\n            script.setAttribute(\n              key,\n              typeof value === 'boolean' ? '' : String(value),\n            )\n          }\n        }\n      }\n\n      document.head.appendChild(script)\n\n      return () => {\n        if (script.parentNode) {\n          script.parentNode.removeChild(script)\n        }\n      }\n    }\n\n    return undefined\n  }, [attrs, children, dataScript])\n\n  // --- Server rendering ---\n  if (isServer ?? router.isServer) {\n    if (attrs?.src) {\n      return <script {...attrs} suppressHydrationWarning />\n    }\n\n    if (typeof children === 'string') {\n      return (\n        <script\n          {...attrs}\n          dangerouslySetInnerHTML={{ __html: children }}\n          suppressHydrationWarning\n        />\n      )\n    }\n\n    return null\n  }\n\n  // --- Client rendering ---\n\n  // Data scripts (e.g. application/ld+json) are rendered in the tree;\n  // the useEffect intentionally skips them.\n  if (dataScript && typeof children === 'string') {\n    return (\n      <script\n        {...attrs}\n        suppressHydrationWarning\n        dangerouslySetInnerHTML={{ __html: children }}\n      />\n    )\n  }\n\n  // During hydration (before useEffect has fired), render the script element\n  // to match the server-rendered HTML and avoid structural hydration mismatches.\n  // After hydration, return null — the useEffect handles imperative injection.\n  if (!hydrated) {\n    if (attrs?.src) {\n      return <script {...attrs} suppressHydrationWarning />\n    }\n    if (typeof children === 'string') {\n      return (\n        <script\n          {...attrs}\n          dangerouslySetInnerHTML={{ __html: children }}\n          suppressHydrationWarning\n        />\n      )\n    }\n  }\n\n  return null\n}\n"
  },
  {
    "path": "packages/react-router/src/CatchBoundary.tsx",
    "content": "import * as React from 'react'\nimport type { ErrorRouteComponent } from './route'\nimport type { ErrorInfo } from 'react'\n\nexport function CatchBoundary(props: {\n  getResetKey: () => number | string\n  children: React.ReactNode\n  errorComponent?: ErrorRouteComponent\n  onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}) {\n  const errorComponent = props.errorComponent ?? ErrorComponent\n\n  return (\n    <CatchBoundaryImpl\n      getResetKey={props.getResetKey}\n      onCatch={props.onCatch}\n      children={({ error, reset }) => {\n        if (error) {\n          return React.createElement(errorComponent, {\n            error,\n            reset,\n          })\n        }\n\n        return props.children\n      }}\n    />\n  )\n}\n\nclass CatchBoundaryImpl extends React.Component<{\n  getResetKey: () => number | string\n  children: (props: {\n    error: Error | null\n    reset: () => void\n  }) => React.ReactNode\n  onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}> {\n  state = { error: null } as { error: Error | null; resetKey: string }\n  static getDerivedStateFromProps(props: any) {\n    return { resetKey: props.getResetKey() }\n  }\n  static getDerivedStateFromError(error: Error) {\n    return { error }\n  }\n  reset() {\n    this.setState({ error: null })\n  }\n  componentDidUpdate(\n    prevProps: Readonly<{\n      getResetKey: () => string\n      children: (props: { error: any; reset: () => void }) => any\n      onCatch?: ((error: any, info: any) => void) | undefined\n    }>,\n    prevState: any,\n  ): void {\n    if (prevState.error && prevState.resetKey !== this.state.resetKey) {\n      this.reset()\n    }\n  }\n  componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n    if (this.props.onCatch) {\n      this.props.onCatch(error, errorInfo)\n    }\n  }\n  render() {\n    // If the resetKey has changed, don't render the error\n    return this.props.children({\n      error:\n        this.state.resetKey !== this.props.getResetKey()\n          ? null\n          : this.state.error,\n      reset: () => {\n        this.reset()\n      },\n    })\n  }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n  const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n  return (\n    <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n      <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n        <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n        <button\n          style={{\n            appearance: 'none',\n            fontSize: '.6em',\n            border: '1px solid currentColor',\n            padding: '.1rem .2rem',\n            fontWeight: 'bold',\n            borderRadius: '.25rem',\n          }}\n          onClick={() => setShow((d) => !d)}\n        >\n          {show ? 'Hide Error' : 'Show Error'}\n        </button>\n      </div>\n      <div style={{ height: '.25rem' }} />\n      {show ? (\n        <div>\n          <pre\n            style={{\n              fontSize: '.7em',\n              border: '1px solid red',\n              borderRadius: '.25rem',\n              padding: '.3rem',\n              color: 'red',\n              overflow: 'auto',\n            }}\n          >\n            {error.message ? <code>{error.message}</code> : null}\n          </pre>\n        </div>\n      ) : null}\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/ClientOnly.tsx",
    "content": "import React from 'react'\n\nexport interface ClientOnlyProps {\n  /**\n   * The children to render when the JS is loaded.\n   */\n  children: React.ReactNode\n  /**\n   * The fallback component to render if the JS is not yet loaded.\n   */\n  fallback?: React.ReactNode\n}\n\n/**\n * Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.\n *\n * ```tsx\n * return (\n *   <ClientOnly fallback={<FakeChart />}>\n *     <Chart />\n *   </ClientOnly>\n * )\n * ```\n */\nexport function ClientOnly({ children, fallback = null }: ClientOnlyProps) {\n  return useHydrated() ? (\n    <React.Fragment>{children}</React.Fragment>\n  ) : (\n    <React.Fragment>{fallback}</React.Fragment>\n  )\n}\n\n/**\n * Return a boolean indicating if the JS has been hydrated already.\n * When doing Server-Side Rendering, the result will always be false.\n * When doing Client-Side Rendering, the result will always be false on the\n * first render and true from then on. Even if a new component renders it will\n * always start with true.\n *\n * @example\n * ```tsx\n * // Disable a button that needs JS to work.\n * let hydrated = useHydrated()\n * return (\n *   <button type=\"button\" disabled={!hydrated} onClick={doSomethingCustom}>\n *     Click me\n *   </button>\n * )\n * ```\n * @returns True if the JS has been hydrated already, false otherwise.\n */\nexport function useHydrated(): boolean {\n  return React.useSyncExternalStore(\n    subscribe,\n    () => true,\n    () => false,\n  )\n}\n\nfunction subscribe() {\n  return () => {}\n}\n"
  },
  {
    "path": "packages/react-router/src/HeadContent.dev.tsx",
    "content": "import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useHydrated } from './ClientOnly'\nimport { useTags } from './headContentUtils'\n\nconst DEV_STYLES_ATTR = 'data-tanstack-router-dev-styles'\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n *\n * Development version: filters out dev styles link after hydration and\n * includes a fallback cleanup effect for hydration mismatch cases.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent() {\n  const tags = useTags()\n  const router = useRouter()\n  const nonce = router.options.ssr?.nonce\n  const hydrated = useHydrated()\n\n  // Fallback cleanup for hydration mismatch cases\n  // Runs when hydration completes to remove any orphaned dev styles links from DOM\n  React.useEffect(() => {\n    if (hydrated) {\n      document\n        .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n        .forEach((el) => el.remove())\n    }\n  }, [hydrated])\n\n  // Filter out dev styles after hydration\n  const filteredTags = hydrated\n    ? tags.filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR])\n    : tags\n\n  return (\n    <>\n      {filteredTags.map((tag) => (\n        <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n      ))}\n    </>\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/HeadContent.tsx",
    "content": "import * as React from 'react'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\n\n/**\n * Render route-managed head tags (title, meta, links, styles, head scripts).\n * Place inside the document head of your app shell.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/document-head-management\n */\nexport function HeadContent() {\n  const tags = useTags()\n  const router = useRouter()\n  const nonce = router.options.ssr?.nonce\n  return (\n    <>\n      {tags.map((tag) => (\n        <Asset {...tag} key={`tsr-meta-${JSON.stringify(tag)}`} nonce={nonce} />\n      ))}\n    </>\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/Match.tsx",
    "content": "import * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport {\n  createControlledPromise,\n  getLocationChangeInfo,\n  isNotFound,\n  isRedirect,\n  rootRouteId,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport { ClientOnly } from './ClientOnly'\nimport type {\n  AnyRoute,\n  ParsedLocation,\n  RootRouteOptions,\n} from '@tanstack/router-core'\n\nexport const Match = React.memo(function MatchImpl({\n  matchId,\n}: {\n  matchId: string\n}) {\n  const router = useRouter()\n\n  if (isServer ?? router.isServer) {\n    const match = router.stores.activeMatchStoresById.get(matchId)?.state\n    invariant(\n      match,\n      `Could not find match for matchId \"${matchId}\". Please file an issue!`,\n    )\n\n    const routeId = match.routeId as string\n    const parentRouteId = (router.routesById[routeId] as AnyRoute).parentRoute\n      ?.id\n\n    return (\n      <MatchView\n        router={router}\n        matchId={matchId}\n        resetKey={router.stores.loadedAt.state}\n        matchState={{\n          routeId,\n          ssr: match.ssr,\n          _displayPending: match._displayPending,\n          parentRouteId,\n        }}\n      />\n    )\n  }\n\n  // Subscribe directly to the match store from the pool.\n  // The matchId prop is stable for this component's lifetime (set by Outlet),\n  // and reconcileMatchPool reuses stores for the same matchId.\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const matchStore = router.stores.activeMatchStoresById.get(matchId)\n  invariant(\n    matchStore,\n    `Could not find match for matchId \"${matchId}\". Please file an issue!`,\n  )\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const resetKey = useStore(router.stores.loadedAt, (loadedAt) => loadedAt)\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const match = useStore(matchStore, (value) => value)\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const matchState = React.useMemo(() => {\n    const routeId = match.routeId as string\n    const parentRouteId = (router.routesById[routeId] as AnyRoute).parentRoute\n      ?.id\n\n    return {\n      routeId,\n      ssr: match.ssr,\n      _displayPending: match._displayPending,\n      parentRouteId: parentRouteId as string | undefined,\n    } satisfies MatchViewState\n  }, [match._displayPending, match.routeId, match.ssr, router.routesById])\n\n  return (\n    <MatchView\n      router={router}\n      matchId={matchId}\n      resetKey={resetKey}\n      matchState={matchState}\n    />\n  )\n})\n\ntype MatchViewState = {\n  routeId: string\n  ssr: boolean | 'data-only' | undefined\n  _displayPending: boolean | undefined\n  parentRouteId: string | undefined\n}\n\nfunction MatchView({\n  router,\n  matchId,\n  resetKey,\n  matchState,\n}: {\n  router: ReturnType<typeof useRouter>\n  matchId: string\n  resetKey: number\n  matchState: MatchViewState\n}) {\n  const route: AnyRoute = router.routesById[matchState.routeId]\n\n  const PendingComponent =\n    route.options.pendingComponent ?? router.options.defaultPendingComponent\n\n  const pendingElement = PendingComponent ? <PendingComponent /> : null\n\n  const routeErrorComponent =\n    route.options.errorComponent ?? router.options.defaultErrorComponent\n\n  const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch\n\n  const routeNotFoundComponent = route.isRoot\n    ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n      (route.options.notFoundComponent ??\n      router.options.notFoundRoute?.options.component)\n    : route.options.notFoundComponent\n\n  const resolvedNoSsr =\n    matchState.ssr === false || matchState.ssr === 'data-only'\n  const ResolvedSuspenseBoundary =\n    // If we're on the root route, allow forcefully wrapping in suspense\n    (!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) &&\n    (route.options.wrapInSuspense ??\n      PendingComponent ??\n      ((route.options.errorComponent as any)?.preload || resolvedNoSsr))\n      ? React.Suspense\n      : SafeFragment\n\n  const ResolvedCatchBoundary = routeErrorComponent\n    ? CatchBoundary\n    : SafeFragment\n\n  const ResolvedNotFoundBoundary = routeNotFoundComponent\n    ? CatchNotFound\n    : SafeFragment\n\n  const ShellComponent = route.isRoot\n    ? ((route.options as RootRouteOptions).shellComponent ?? SafeFragment)\n    : SafeFragment\n  return (\n    <ShellComponent>\n      <matchContext.Provider value={matchId}>\n        <ResolvedSuspenseBoundary fallback={pendingElement}>\n          <ResolvedCatchBoundary\n            getResetKey={() => resetKey}\n            errorComponent={routeErrorComponent || ErrorComponent}\n            onCatch={(error, errorInfo) => {\n              // Forward not found errors (we don't want to show the error component for these)\n              if (isNotFound(error)) throw error\n              warning(false, `Error in route match: ${matchId}`)\n              routeOnCatch?.(error, errorInfo)\n            }}\n          >\n            <ResolvedNotFoundBoundary\n              fallback={(error) => {\n                // If the current not found handler doesn't exist or it has a\n                // route ID which doesn't match the current route, rethrow the error\n                if (\n                  !routeNotFoundComponent ||\n                  (error.routeId && error.routeId !== matchState.routeId) ||\n                  (!error.routeId && !route.isRoot)\n                )\n                  throw error\n\n                return React.createElement(routeNotFoundComponent, error as any)\n              }}\n            >\n              {resolvedNoSsr || matchState._displayPending ? (\n                <ClientOnly fallback={pendingElement}>\n                  <MatchInner matchId={matchId} />\n                </ClientOnly>\n              ) : (\n                <MatchInner matchId={matchId} />\n              )}\n            </ResolvedNotFoundBoundary>\n          </ResolvedCatchBoundary>\n        </ResolvedSuspenseBoundary>\n      </matchContext.Provider>\n      {matchState.parentRouteId === rootRouteId &&\n      router.options.scrollRestoration ? (\n        <>\n          <OnRendered />\n          <ScrollRestoration />\n        </>\n      ) : null}\n    </ShellComponent>\n  )\n}\n\n// On Rendered can't happen above the root layout because it actually\n// renders a dummy dom element to track the rendered state of the app.\n// We render a script tag with a key that changes based on the current\n// location state.__TSR_key. Also, because it's below the root layout, it\n// allows us to fire onRendered events even after a hydration mismatch\n// error that occurred above the root layout (like bad head/link tags,\n// which is common).\nfunction OnRendered() {\n  const router = useRouter()\n\n  const prevLocationRef = React.useRef<undefined | ParsedLocation<{}>>(\n    undefined,\n  )\n\n  return (\n    <script\n      key={router.latestLocation.state.__TSR_key}\n      suppressHydrationWarning\n      ref={(el) => {\n        if (\n          el &&\n          (prevLocationRef.current === undefined ||\n            prevLocationRef.current.href !== router.latestLocation.href)\n        ) {\n          router.emit({\n            type: 'onRendered',\n            ...getLocationChangeInfo(\n              router.stores.location.state,\n              router.stores.resolvedLocation.state,\n            ),\n          })\n          prevLocationRef.current = router.latestLocation\n        }\n      }}\n    />\n  )\n}\n\nexport const MatchInner = React.memo(function MatchInnerImpl({\n  matchId,\n}: {\n  matchId: string\n}): any {\n  const router = useRouter()\n\n  if (isServer ?? router.isServer) {\n    const match = router.stores.activeMatchStoresById.get(matchId)?.state\n    invariant(\n      match,\n      `Could not find match for matchId \"${matchId}\". Please file an issue!`,\n    )\n\n    const routeId = match.routeId as string\n    const route = router.routesById[routeId] as AnyRoute\n    const remountFn =\n      (router.routesById[routeId] as AnyRoute).options.remountDeps ??\n      router.options.defaultRemountDeps\n    const remountDeps = remountFn?.({\n      routeId,\n      loaderDeps: match.loaderDeps,\n      params: match._strictParams,\n      search: match._strictSearch,\n    })\n    const key = remountDeps ? JSON.stringify(remountDeps) : undefined\n    const Comp = route.options.component ?? router.options.defaultComponent\n    const out = Comp ? <Comp key={key} /> : <Outlet />\n\n    if (match._displayPending) {\n      throw router.getMatch(match.id)?._nonReactive.displayPendingPromise\n    }\n\n    if (match._forcePending) {\n      throw router.getMatch(match.id)?._nonReactive.minPendingPromise\n    }\n\n    if (match.status === 'pending') {\n      throw router.getMatch(match.id)?._nonReactive.loadPromise\n    }\n\n    if (match.status === 'notFound') {\n      invariant(isNotFound(match.error), 'Expected a notFound error')\n      return renderRouteNotFound(router, route, match.error)\n    }\n\n    if (match.status === 'redirected') {\n      invariant(isRedirect(match.error), 'Expected a redirect error')\n      throw router.getMatch(match.id)?._nonReactive.loadPromise\n    }\n\n    if (match.status === 'error') {\n      const RouteErrorComponent =\n        (route.options.errorComponent ??\n          router.options.defaultErrorComponent) ||\n        ErrorComponent\n      return (\n        <RouteErrorComponent\n          error={match.error as any}\n          reset={undefined as any}\n          info={{\n            componentStack: '',\n          }}\n        />\n      )\n    }\n\n    return out\n  }\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const matchStore = router.stores.activeMatchStoresById.get(matchId)\n  invariant(\n    matchStore,\n    `Could not find match for matchId \"${matchId}\". Please file an issue!`,\n  )\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const match = useStore(matchStore, (value) => value)\n  const routeId = match.routeId as string\n  const route = router.routesById[routeId] as AnyRoute\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const key = React.useMemo(() => {\n    const remountFn =\n      (router.routesById[routeId] as AnyRoute).options.remountDeps ??\n      router.options.defaultRemountDeps\n    const remountDeps = remountFn?.({\n      routeId,\n      loaderDeps: match.loaderDeps,\n      params: match._strictParams,\n      search: match._strictSearch,\n    })\n    return remountDeps ? JSON.stringify(remountDeps) : undefined\n  }, [\n    routeId,\n    match.loaderDeps,\n    match._strictParams,\n    match._strictSearch,\n    router.options.defaultRemountDeps,\n    router.routesById,\n  ])\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const out = React.useMemo(() => {\n    const Comp = route.options.component ?? router.options.defaultComponent\n    if (Comp) {\n      return <Comp key={key} />\n    }\n    return <Outlet />\n  }, [key, route.options.component, router.options.defaultComponent])\n\n  if (match._displayPending) {\n    throw router.getMatch(match.id)?._nonReactive.displayPendingPromise\n  }\n\n  if (match._forcePending) {\n    throw router.getMatch(match.id)?._nonReactive.minPendingPromise\n  }\n\n  // see also hydrate() in packages/router-core/src/ssr/ssr-client.ts\n  if (match.status === 'pending') {\n    // We're pending, and if we have a minPendingMs, we need to wait for it\n    const pendingMinMs =\n      route.options.pendingMinMs ?? router.options.defaultPendingMinMs\n    if (pendingMinMs) {\n      const routerMatch = router.getMatch(match.id)\n      if (routerMatch && !routerMatch._nonReactive.minPendingPromise) {\n        // Create a promise that will resolve after the minPendingMs\n        if (!(isServer ?? router.isServer)) {\n          const minPendingPromise = createControlledPromise<void>()\n\n          routerMatch._nonReactive.minPendingPromise = minPendingPromise\n\n          setTimeout(() => {\n            minPendingPromise.resolve()\n            // We've handled the minPendingPromise, so we can delete it\n            routerMatch._nonReactive.minPendingPromise = undefined\n          }, pendingMinMs)\n        }\n      }\n    }\n    throw router.getMatch(match.id)?._nonReactive.loadPromise\n  }\n\n  if (match.status === 'notFound') {\n    invariant(isNotFound(match.error), 'Expected a notFound error')\n    return renderRouteNotFound(router, route, match.error)\n  }\n\n  if (match.status === 'redirected') {\n    // Redirects should be handled by the router transition. If we happen to\n    // encounter a redirect here, it's a bug. Let's warn, but render nothing.\n    invariant(isRedirect(match.error), 'Expected a redirect error')\n\n    // warning(\n    //   false,\n    //   'Tried to render a redirected route match! This is a weird circumstance, please file an issue!',\n    // )\n    throw router.getMatch(match.id)?._nonReactive.loadPromise\n  }\n\n  if (match.status === 'error') {\n    // If we're on the server, we need to use React's new and super\n    // wonky api for throwing errors from a server side render inside\n    // of a suspense boundary. This is the only way to get\n    // renderToPipeableStream to not hang indefinitely.\n    // We'll serialize the error and rethrow it on the client.\n    if (isServer ?? router.isServer) {\n      const RouteErrorComponent =\n        (route.options.errorComponent ??\n          router.options.defaultErrorComponent) ||\n        ErrorComponent\n      return (\n        <RouteErrorComponent\n          error={match.error as any}\n          reset={undefined as any}\n          info={{\n            componentStack: '',\n          }}\n        />\n      )\n    }\n\n    throw match.error\n  }\n\n  return out\n})\n\n/**\n * Render the next child match in the route tree. Typically used inside\n * a route component to render nested routes.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent\n */\nexport const Outlet = React.memo(function OutletImpl() {\n  const router = useRouter()\n  const matchId = React.useContext(matchContext)\n\n  let routeId: string | undefined\n  let parentGlobalNotFound = false\n  let childMatchId: string | undefined\n\n  if (isServer ?? router.isServer) {\n    const matches = router.stores.activeMatchesSnapshot.state\n    const parentIndex = matchId\n      ? matches.findIndex((match) => match.id === matchId)\n      : -1\n    const parentMatch = parentIndex >= 0 ? matches[parentIndex] : undefined\n    routeId = parentMatch?.routeId as string | undefined\n    parentGlobalNotFound = parentMatch?.globalNotFound ?? false\n    childMatchId =\n      parentIndex >= 0 ? (matches[parentIndex + 1]?.id as string) : undefined\n  } else {\n    // Subscribe directly to the match store from the pool instead of\n    // the two-level byId → matchStore pattern.\n    const parentMatchStore = matchId\n      ? router.stores.activeMatchStoresById.get(matchId)\n      : undefined\n\n    // eslint-disable-next-line react-hooks/rules-of-hooks\n    ;[routeId, parentGlobalNotFound] = useStore(parentMatchStore, (match) => [\n      match?.routeId as string | undefined,\n      match?.globalNotFound ?? false,\n    ])\n\n    // eslint-disable-next-line react-hooks/rules-of-hooks\n    childMatchId = useStore(router.stores.matchesId, (ids) => {\n      const index = ids.findIndex((id) => id === matchId)\n      return ids[index + 1]\n    })\n  }\n\n  const route = routeId ? router.routesById[routeId] : undefined\n\n  const pendingElement = router.options.defaultPendingComponent ? (\n    <router.options.defaultPendingComponent />\n  ) : null\n\n  if (parentGlobalNotFound) {\n    invariant(route, 'Could not resolve route for Outlet render')\n    return renderRouteNotFound(router, route, undefined)\n  }\n\n  if (!childMatchId) {\n    return null\n  }\n\n  const nextMatch = <Match matchId={childMatchId} />\n\n  if (routeId === rootRouteId) {\n    return (\n      <React.Suspense fallback={pendingElement}>{nextMatch}</React.Suspense>\n    )\n  }\n\n  return nextMatch\n})\n"
  },
  {
    "path": "packages/react-router/src/Matches.tsx",
    "content": "import * as React from 'react'\nimport warning from 'tiny-warning'\nimport { useStore } from '@tanstack/react-store'\nimport { replaceEqualDeep, rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { matchContext } from './matchContext'\nimport { Match } from './Match'\nimport { SafeFragment } from './SafeFragment'\nimport type {\n  StructuralSharingOption,\n  ValidateSelected,\n} from './structuralSharing'\nimport type {\n  AnyRoute,\n  AnyRouter,\n  DeepPartial,\n  Expand,\n  MakeOptionalPathParams,\n  MakeOptionalSearchParams,\n  MakeRouteMatchUnion,\n  MaskOptions,\n  MatchRouteOptions,\n  NoInfer,\n  RegisteredRouter,\n  ResolveRelativePath,\n  ResolveRoute,\n  RouteByPath,\n  ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n  export interface RouteMatchExtensions {\n    meta?: Array<React.JSX.IntrinsicElements['meta'] | undefined>\n    links?: Array<React.JSX.IntrinsicElements['link'] | undefined>\n    scripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>\n    styles?: Array<React.JSX.IntrinsicElements['style'] | undefined>\n    headScripts?: Array<React.JSX.IntrinsicElements['script'] | undefined>\n  }\n}\n\n/**\n * Internal component that renders the router's active match tree with\n * suspense, error, and not-found boundaries. Rendered by `RouterProvider`.\n */\nexport function Matches() {\n  const router = useRouter()\n  const rootRoute: AnyRoute = router.routesById[rootRouteId]\n\n  const PendingComponent =\n    rootRoute.options.pendingComponent ?? router.options.defaultPendingComponent\n\n  const pendingElement = PendingComponent ? <PendingComponent /> : null\n\n  // Do not render a root Suspense during SSR or hydrating from SSR\n  const ResolvedSuspense =\n    (isServer ?? router.isServer) ||\n    (typeof document !== 'undefined' && router.ssr)\n      ? SafeFragment\n      : React.Suspense\n\n  const inner = (\n    <ResolvedSuspense fallback={pendingElement}>\n      {!(isServer ?? router.isServer) && <Transitioner />}\n      <MatchesInner />\n    </ResolvedSuspense>\n  )\n\n  return router.options.InnerWrap ? (\n    <router.options.InnerWrap>{inner}</router.options.InnerWrap>\n  ) : (\n    inner\n  )\n}\n\nfunction MatchesInner() {\n  const router = useRouter()\n  const _isServer = isServer ?? router.isServer\n  const matchId = _isServer\n    ? router.stores.firstMatchId.state\n    : // eslint-disable-next-line react-hooks/rules-of-hooks\n      useStore(router.stores.firstMatchId, (id) => id)\n  const resetKey = _isServer\n    ? router.stores.loadedAt.state\n    : // eslint-disable-next-line react-hooks/rules-of-hooks\n      useStore(router.stores.loadedAt, (loadedAt) => loadedAt)\n\n  const matchComponent = matchId ? <Match matchId={matchId} /> : null\n\n  return (\n    <matchContext.Provider value={matchId}>\n      {router.options.disableGlobalCatchBoundary ? (\n        matchComponent\n      ) : (\n        <CatchBoundary\n          getResetKey={() => resetKey}\n          errorComponent={ErrorComponent}\n          onCatch={\n            process.env.NODE_ENV !== 'production'\n              ? (error) => {\n                  warning(\n                    false,\n                    `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n                  )\n                  warning(false, error.message || error.toString())\n                }\n              : undefined\n          }\n        >\n          {matchComponent}\n        </CatchBoundary>\n      )}\n    </matchContext.Provider>\n  )\n}\n\nexport type UseMatchRouteOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = undefined,\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n  DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n  DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n  MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n  MatchRouteOptions\n\n/**\n * Create a matcher function for testing locations against route definitions.\n *\n * The returned function accepts standard navigation options (`to`, `params`,\n * `search`, etc.) and returns either `false` (no match) or the matched params\n * object when the route matches the current or pending location.\n *\n * Useful for conditional rendering and active UI states.\n *\n * @returns A `matchRoute(options)` function that returns `false` or params.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchRouteHook\n */\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n  const router = useRouter()\n\n  if (!(isServer ?? router.isServer)) {\n    // eslint-disable-next-line react-hooks/rules-of-hooks\n    useStore(router.stores.matchRouteReactivity, (d) => d)\n  }\n\n  return React.useCallback(\n    <\n      const TFrom extends string = string,\n      const TTo extends string | undefined = undefined,\n      const TMaskFrom extends string = TFrom,\n      const TMaskTo extends string = '',\n    >(\n      opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n    ):\n      | false\n      | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']> => {\n      const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n      return router.matchRoute(rest as any, {\n        pending,\n        caseSensitive,\n        fuzzy,\n        includeSearch,\n      })\n    },\n    [router],\n  )\n}\n\nexport type MakeMatchRouteOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = undefined,\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n  // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n  children?:\n    | ((\n        params?: RouteByPath<\n          TRouter['routeTree'],\n          ResolveRelativePath<TFrom, NoInfer<TTo>>\n        >['types']['allParams'],\n      ) => React.ReactNode)\n    | React.ReactNode\n}\n\n/**\n * Component that conditionally renders its children based on whether a route\n * matches the provided `from`/`to` options. If `children` is a function, it\n * receives the matched params object.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/matchRouteComponent\n */\nexport function MatchRoute<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = string,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute(props as any) as boolean\n\n  if (typeof props.children === 'function') {\n    return (props.children as any)(params)\n  }\n\n  return params ? props.children : null\n}\n\nexport interface UseMatchesBaseOptions<\n  TRouter extends AnyRouter,\n  TSelected,\n  TStructuralSharing,\n> {\n  select?: (\n    matches: Array<MakeRouteMatchUnion<TRouter>>,\n  ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseMatchesResult<\n  TRouter extends AnyRouter,\n  TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n  const router = useRouter<TRouter>()\n  const previousResult =\n    React.useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(\n      undefined,\n    )\n\n  if (isServer ?? router.isServer) {\n    const matches = router.stores.activeMatchesSnapshot.state as Array<\n      MakeRouteMatchUnion<TRouter>\n    >\n    return (opts?.select ? opts.select(matches) : matches) as UseMatchesResult<\n      TRouter,\n      TSelected\n    >\n  }\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  return useStore(router.stores.activeMatchesSnapshot, (matches) => {\n    const selected = opts?.select\n      ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)\n      : (matches as any)\n\n    if (opts?.structuralSharing ?? router.options.defaultStructuralSharing) {\n      const shared = replaceEqualDeep(previousResult.current, selected)\n      previousResult.current = shared\n      return shared\n    }\n\n    return selected\n  }) as UseMatchesResult<TRouter, TSelected>\n}\n\n/**\n * Read the full array of active route matches or select a derived subset.\n *\n * Useful for debugging, breadcrumbs, or aggregating metadata across matches.\n *\n * @returns The array of matches (or the selected value).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook\n */\n\n/**\n * Read the full array of active route matches or select a derived subset.\n *\n * Useful for debugging, breadcrumbs, or aggregating metadata across matches.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchesHook\n */\nexport function useParentMatches<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n  const contextMatchId = React.useContext(matchContext)\n\n  return useMatches({\n    select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n      matches = matches.slice(\n        0,\n        matches.findIndex((d) => d.id === contextMatchId),\n      )\n      return opts?.select ? opts.select(matches) : matches\n    },\n    structuralSharing: opts?.structuralSharing,\n  } as any)\n}\n\n/**\n * Read the array of active route matches that are children of the current\n * match (or selected parent) in the match tree.\n */\nexport function useChildMatches<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseMatchesBaseOptions<TRouter, TSelected, TStructuralSharing> &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseMatchesResult<TRouter, TSelected> {\n  const contextMatchId = React.useContext(matchContext)\n\n  return useMatches({\n    select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n      matches = matches.slice(\n        matches.findIndex((d) => d.id === contextMatchId) + 1,\n      )\n      return opts?.select ? opts.select(matches) : matches\n    },\n    structuralSharing: opts?.structuralSharing,\n  } as any)\n}\n"
  },
  {
    "path": "packages/react-router/src/RouterProvider.tsx",
    "content": "import * as React from 'react'\nimport { Matches } from './Matches'\nimport { routerContext } from './routerContext'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  RouterOptions,\n} from '@tanstack/router-core'\n\n/**\n * Low-level provider that places the router into React context and optionally\n * updates router options from props. Most apps should use `RouterProvider`.\n */\nexport function RouterContextProvider<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n  router,\n  children,\n  ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n  children: React.ReactNode\n}) {\n  if (Object.keys(rest).length > 0) {\n    // Allow the router to update options on the router instance\n    router.update({\n      ...router.options,\n      ...rest,\n      context: {\n        ...router.options.context,\n        ...rest.context,\n      },\n    })\n  }\n\n  const provider = (\n    <routerContext.Provider value={router as AnyRouter}>\n      {children}\n    </routerContext.Provider>\n  )\n\n  if (router.options.Wrap) {\n    return <router.options.Wrap>{provider}</router.options.Wrap>\n  }\n\n  return provider\n}\n\n/**\n * Top-level component that renders the active route matches and provides the\n * router to the React tree via context.\n *\n * Accepts the same options as `createRouter` via props to update the router\n * instance after creation.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction\n */\nexport function RouterProvider<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n  return (\n    <RouterContextProvider router={router} {...rest}>\n      <Matches />\n    </RouterContextProvider>\n  )\n}\n\nexport type RouterProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n  RouterOptions<\n    TRouter['routeTree'],\n    NonNullable<TRouter['options']['trailingSlash']>,\n    NonNullable<TRouter['options']['defaultStructuralSharing']>,\n    TRouter['history'],\n    TDehydrated\n  >,\n  'context'\n> & {\n  router: TRouter\n  context?: Partial<\n    RouterOptions<\n      TRouter['routeTree'],\n      NonNullable<TRouter['options']['trailingSlash']>,\n      NonNullable<TRouter['options']['defaultStructuralSharing']>,\n      TRouter['history'],\n      TDehydrated\n    >['context']\n  >\n}\n"
  },
  {
    "path": "packages/react-router/src/SafeFragment.tsx",
    "content": "import * as React from 'react'\n\nexport function SafeFragment(props: any) {\n  return <>{props.children}</>\n}\n"
  },
  {
    "path": "packages/react-router/src/ScriptOnce.tsx",
    "content": "import { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\n/**\n * Server-only helper to emit a script tag exactly once during SSR.\n */\nexport function ScriptOnce({ children }: { children: string }) {\n  const router = useRouter()\n  if (!(isServer ?? router.isServer)) {\n    return null\n  }\n\n  return (\n    <script\n      nonce={router.options.ssr?.nonce}\n      dangerouslySetInnerHTML={{\n        __html: children + ';document.currentScript.remove()',\n      }}\n    />\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/Scripts.tsx",
    "content": "import { useStore } from '@tanstack/react-store'\nimport { deepEqual } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\n/**\n * Render body script tags collected from route matches and SSR manifests.\n * Should be placed near the end of the document body.\n */\nexport const Scripts = () => {\n  const router = useRouter()\n  const nonce = router.options.ssr?.nonce\n\n  const getAssetScripts = (matches: Array<any>) => {\n    const assetScripts: Array<RouterManagedTag> = []\n    const manifest = router.ssr?.manifest\n\n    if (!manifest) {\n      return []\n    }\n\n    matches\n      .map((match) => router.looseRoutesById[match.routeId]!)\n      .forEach((route) =>\n        manifest.routes[route.id]?.assets\n          ?.filter((d) => d.tag === 'script')\n          .forEach((asset) => {\n            assetScripts.push({\n              tag: 'script',\n              attrs: { ...asset.attrs, nonce },\n              children: asset.children,\n            } as any)\n          }),\n      )\n\n    return assetScripts\n  }\n\n  const getScripts = (matches: Array<any>): Array<RouterManagedTag> =>\n    (\n      matches\n        .map((match) => match.scripts!)\n        .flat(1)\n        .filter(Boolean) as Array<RouterManagedTag>\n    ).map(\n      ({ children, ...script }) =>\n        ({\n          tag: 'script',\n          attrs: {\n            ...script,\n            suppressHydrationWarning: true,\n            nonce,\n          },\n          children,\n        }) satisfies RouterManagedTag,\n    )\n\n  if (isServer ?? router.isServer) {\n    const assetScripts = getAssetScripts(\n      router.stores.activeMatchesSnapshot.state,\n    )\n    const scripts = getScripts(router.stores.activeMatchesSnapshot.state)\n    return renderScripts(router, scripts, assetScripts)\n  }\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const assetScripts = useStore(\n    router.stores.activeMatchesSnapshot,\n    getAssetScripts,\n    deepEqual,\n  )\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const scripts = useStore(\n    router.stores.activeMatchesSnapshot,\n    getScripts,\n    deepEqual,\n  )\n\n  return renderScripts(router, scripts, assetScripts)\n}\n\nfunction renderScripts(\n  router: ReturnType<typeof useRouter>,\n  scripts: Array<RouterManagedTag>,\n  assetScripts: Array<RouterManagedTag>,\n) {\n  let serverBufferedScript: RouterManagedTag | undefined = undefined\n\n  if (router.serverSsr) {\n    serverBufferedScript = router.serverSsr.takeBufferedScripts()\n  }\n\n  const allScripts = [...scripts, ...assetScripts] as Array<RouterManagedTag>\n\n  if (serverBufferedScript) {\n    allScripts.unshift(serverBufferedScript)\n  }\n\n  return (\n    <>\n      {allScripts.map((asset, i) => (\n        <Asset {...asset} key={`tsr-scripts-${asset.tag}-${i}`} />\n      ))}\n    </>\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/ScrollRestoration.tsx",
    "content": "import {\n  defaultGetScrollRestorationKey,\n  getCssSelector,\n  scrollRestorationCache,\n  setupScrollRestoration,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n  ParsedLocation,\n  ScrollRestorationEntry,\n  ScrollRestorationOptions,\n} from '@tanstack/router-core'\n\nfunction useScrollRestoration() {\n  const router = useRouter()\n  setupScrollRestoration(router, true)\n}\n\n/**\n * @deprecated Use the `scrollRestoration` router option instead.\n */\nexport function ScrollRestoration(_props: ScrollRestorationOptions) {\n  useScrollRestoration()\n\n  if (process.env.NODE_ENV === 'development') {\n    console.warn(\n      \"The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead.\",\n    )\n  }\n\n  return null\n}\n\nexport function useElementScrollRestoration(\n  options: (\n    | {\n        id: string\n        getElement?: () => Window | Element | undefined | null\n      }\n    | {\n        id?: string\n        getElement: () => Window | Element | undefined | null\n      }\n  ) & {\n    getKey?: (location: ParsedLocation) => string\n  },\n): ScrollRestorationEntry | undefined {\n  useScrollRestoration()\n\n  const router = useRouter()\n  const getKey = options.getKey || defaultGetScrollRestorationKey\n\n  let elementSelector = ''\n\n  if (options.id) {\n    elementSelector = `[data-scroll-restoration-id=\"${options.id}\"]`\n  } else {\n    const element = options.getElement?.()\n    if (!element) {\n      return\n    }\n    elementSelector =\n      element instanceof Window ? 'window' : getCssSelector(element)\n  }\n\n  const restoreKey = getKey(router.latestLocation)\n  const byKey = scrollRestorationCache?.state[restoreKey]\n  return byKey?.[elementSelector]\n}\n"
  },
  {
    "path": "packages/react-router/src/Transitioner.tsx",
    "content": "import * as React from 'react'\nimport { batch, useStore } from '@tanstack/react-store'\nimport {\n  getLocationChangeInfo,\n  handleHashScroll,\n  trimPathRight,\n} from '@tanstack/router-core'\nimport { useLayoutEffect, usePrevious } from './utils'\nimport { useRouter } from './useRouter'\n\nexport function Transitioner() {\n  const router = useRouter()\n  const mountLoadForRouter = React.useRef({ router, mounted: false })\n\n  const [isTransitioning, setIsTransitioning] = React.useState(false)\n  // Track pending state changes\n  const isLoading = useStore(router.stores.isLoading, (value) => value)\n  const hasPendingMatches = useStore(\n    router.stores.hasPendingMatches,\n    (value) => value,\n  )\n\n  const previousIsLoading = usePrevious(isLoading)\n\n  const isAnyPending = isLoading || isTransitioning || hasPendingMatches\n  const previousIsAnyPending = usePrevious(isAnyPending)\n\n  const isPagePending = isLoading || hasPendingMatches\n  const previousIsPagePending = usePrevious(isPagePending)\n\n  router.startTransition = (fn: () => void) => {\n    setIsTransitioning(true)\n    React.startTransition(() => {\n      fn()\n      setIsTransitioning(false)\n    })\n  }\n\n  // Subscribe to location changes\n  // and try to load the new location\n  React.useEffect(() => {\n    const unsub = router.history.subscribe(router.load)\n\n    const nextLocation = router.buildLocation({\n      to: router.latestLocation.pathname,\n      search: true,\n      params: true,\n      hash: true,\n      state: true,\n      _includeValidateSearch: true,\n    })\n\n    // Check if the current URL matches the canonical form.\n    // Compare publicHref (browser-facing URL) for consistency with\n    // the server-side redirect check in router.beforeLoad.\n    if (\n      trimPathRight(router.latestLocation.publicHref) !==\n      trimPathRight(nextLocation.publicHref)\n    ) {\n      router.commitLocation({ ...nextLocation, replace: true })\n    }\n\n    return () => {\n      unsub()\n    }\n  }, [router, router.history])\n\n  // Try to load the initial location\n  useLayoutEffect(() => {\n    if (\n      // if we are hydrating from SSR, loading is triggered in ssr-client\n      (typeof window !== 'undefined' && router.ssr) ||\n      (mountLoadForRouter.current.router === router &&\n        mountLoadForRouter.current.mounted)\n    ) {\n      return\n    }\n    mountLoadForRouter.current = { router, mounted: true }\n\n    const tryLoad = async () => {\n      try {\n        await router.load()\n      } catch (err) {\n        console.error(err)\n      }\n    }\n\n    tryLoad()\n  }, [router])\n\n  useLayoutEffect(() => {\n    // The router was loading and now it's not\n    if (previousIsLoading && !isLoading) {\n      router.emit({\n        type: 'onLoad', // When the new URL has committed, when the new matches have been loaded into state.matches\n        ...getLocationChangeInfo(\n          router.stores.location.state,\n          router.stores.resolvedLocation.state,\n        ),\n      })\n    }\n  }, [previousIsLoading, router, isLoading])\n\n  useLayoutEffect(() => {\n    // emit onBeforeRouteMount\n    if (previousIsPagePending && !isPagePending) {\n      router.emit({\n        type: 'onBeforeRouteMount',\n        ...getLocationChangeInfo(\n          router.stores.location.state,\n          router.stores.resolvedLocation.state,\n        ),\n      })\n    }\n  }, [isPagePending, previousIsPagePending, router])\n\n  useLayoutEffect(() => {\n    if (previousIsAnyPending && !isAnyPending) {\n      const changeInfo = getLocationChangeInfo(\n        router.stores.location.state,\n        router.stores.resolvedLocation.state,\n      )\n      router.emit({\n        type: 'onResolved',\n        ...changeInfo,\n      })\n\n      batch(() => {\n        router.stores.status.setState(() => 'idle')\n        router.stores.resolvedLocation.setState(\n          () => router.stores.location.state,\n        )\n      })\n\n      if (changeInfo.hrefChanged) {\n        handleHashScroll(router)\n      }\n    }\n  }, [isAnyPending, previousIsAnyPending, router])\n\n  return null\n}\n"
  },
  {
    "path": "packages/react-router/src/awaited.tsx",
    "content": "import * as React from 'react'\n\nimport { TSR_DEFERRED_PROMISE, defer } from '@tanstack/router-core'\nimport { reactUse } from './utils'\n\nexport type AwaitOptions<T> = {\n  promise: Promise<T>\n}\n\n/** Suspend until a deferred promise resolves or rejects and return its data. */\nexport function useAwaited<T>({ promise: _promise }: AwaitOptions<T>): T {\n  if (reactUse) {\n    const data = reactUse(_promise)\n    return data\n  }\n  const promise = defer(_promise)\n\n  if (promise[TSR_DEFERRED_PROMISE].status === 'pending') {\n    throw promise\n  }\n\n  if (promise[TSR_DEFERRED_PROMISE].status === 'error') {\n    throw promise[TSR_DEFERRED_PROMISE].error\n  }\n\n  return promise[TSR_DEFERRED_PROMISE].data\n}\n\n/**\n * Component that suspends on a deferred promise and renders its child with\n * the resolved value. Optionally provides a Suspense fallback.\n */\nexport function Await<T>(\n  props: AwaitOptions<T> & {\n    fallback?: React.ReactNode\n    children: (result: T) => React.ReactNode\n  },\n) {\n  const inner = <AwaitInner {...props} />\n  if (props.fallback) {\n    return <React.Suspense fallback={props.fallback}>{inner}</React.Suspense>\n  }\n  return inner\n}\n\nfunction AwaitInner<T>(\n  props: AwaitOptions<T> & {\n    fallback?: React.ReactNode\n    children: (result: T) => React.ReactNode\n  },\n): React.JSX.Element {\n  const data = useAwaited(props)\n\n  return props.children(data) as React.JSX.Element\n}\n"
  },
  {
    "path": "packages/react-router/src/fileRoute.ts",
    "content": "import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport { useRouteContext } from './useRouteContext'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n  AnyContext,\n  AnyRoute,\n  AnyRouter,\n  Constrain,\n  ConstrainLiteral,\n  FileBaseRouteOptions,\n  FileRoutesByPath,\n  LazyRouteOptions,\n  Register,\n  RegisteredRouter,\n  ResolveParams,\n  Route,\n  RouteById,\n  RouteConstraints,\n  RouteIds,\n  RouteLoaderEntry,\n  UpdatableRouteOptions,\n  UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\n/**\n * Creates a file-based Route factory for a given path.\n *\n * Used by TanStack Router's file-based routing to associate a file with a\n * route. The returned function accepts standard route options. In normal usage\n * the `path` string is inserted and maintained by the `tsr` generator.\n *\n * @param path File path literal for the route (usually auto-generated).\n * @returns A function that accepts Route options and returns a Route instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createFileRouteFunction\n */\nexport function createFileRoute<\n  TFilePath extends keyof FileRoutesByPath,\n  TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n  TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n  TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n  TFullPath extends RouteConstraints['TFullPath'] =\n    FileRoutesByPath[TFilePath]['fullPath'],\n>(\n  path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n  if (typeof path === 'object') {\n    return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n      silent: true,\n    }).createRoute(path) as any\n  }\n  return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n    silent: true,\n  }).createRoute\n}\n\n/** \n  @deprecated It's no longer recommended to use the `FileRoute` class directly.\n  Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n  TFilePath extends keyof FileRoutesByPath,\n  TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n  TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n  TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n  TFullPath extends RouteConstraints['TFullPath'] =\n    FileRoutesByPath[TFilePath]['fullPath'],\n> {\n  silent?: boolean\n\n  constructor(\n    public path?: TFilePath,\n    _opts?: { silent: boolean },\n  ) {\n    this.silent = _opts?.silent\n  }\n\n  createRoute = <\n    TRegister = Register,\n    TSearchValidator = undefined,\n    TParams = ResolveParams<TPath>,\n    TRouteContextFn = AnyContext,\n    TBeforeLoadFn = AnyContext,\n    TLoaderDeps extends Record<string, any> = {},\n    TLoaderFn = undefined,\n    TChildren = unknown,\n    TSSR = unknown,\n    const TMiddlewares = unknown,\n    THandlers = undefined,\n  >(\n    options?: FileBaseRouteOptions<\n      TRegister,\n      TParentRoute,\n      TId,\n      TPath,\n      TSearchValidator,\n      TParams,\n      TLoaderDeps,\n      TLoaderFn,\n      AnyContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      AnyContext,\n      TSSR,\n      TMiddlewares,\n      THandlers\n    > &\n      UpdatableRouteOptions<\n        TParentRoute,\n        TId,\n        TFullPath,\n        TParams,\n        TSearchValidator,\n        TLoaderFn,\n        TLoaderDeps,\n        AnyContext,\n        TRouteContextFn,\n        TBeforeLoadFn\n      >,\n  ): Route<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TFilePath,\n    TId,\n    TSearchValidator,\n    TParams,\n    AnyContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    unknown,\n    TSSR,\n    TMiddlewares,\n    THandlers\n  > => {\n    if (process.env.NODE_ENV !== 'production') {\n      warning(\n        this.silent,\n        'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n      )\n    }\n    const route = createRoute(options as any)\n    ;(route as any).isRoot = false\n    return route as any\n  }\n}\n\n/**\n  @deprecated It's recommended not to split loaders into separate files.\n  Instead, place the loader function in the main route file via `createFileRoute`.\n*/\nexport function FileRouteLoader<\n  TFilePath extends keyof FileRoutesByPath,\n  TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n  _path: TFilePath,\n): <TLoaderFn>(\n  loaderFn: Constrain<\n    TLoaderFn,\n    RouteLoaderEntry<\n      Register,\n      TRoute['parentRoute'],\n      TRoute['types']['id'],\n      TRoute['types']['params'],\n      TRoute['types']['loaderDeps'],\n      TRoute['types']['routerContext'],\n      TRoute['types']['routeContextFn'],\n      TRoute['types']['beforeLoadFn']\n    >\n  >,\n) => TLoaderFn {\n  if (process.env.NODE_ENV !== 'production') {\n    warning(\n      false,\n      `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n    )\n  }\n  return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n  export interface LazyRoute<in out TRoute extends AnyRoute> {\n    useMatch: UseMatchRoute<TRoute['id']>\n    useRouteContext: UseRouteContextRoute<TRoute['id']>\n    useSearch: UseSearchRoute<TRoute['id']>\n    useParams: UseParamsRoute<TRoute['id']>\n    useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n    useLoaderData: UseLoaderDataRoute<TRoute['id']>\n    useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n  }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n  options: {\n    id: string\n  } & LazyRouteOptions\n\n  constructor(\n    opts: {\n      id: string\n    } & LazyRouteOptions,\n  ) {\n    this.options = opts\n    ;(this as any).$$typeof = Symbol.for('react.memo')\n  }\n\n  useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n    return useMatch({\n      select: opts?.select,\n      from: this.options.id,\n      structuralSharing: opts?.structuralSharing,\n    } as any) as any\n  }\n\n  useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n    return useRouteContext({ ...(opts as any), from: this.options.id })\n  }\n\n  useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n    return useSearch({\n      select: opts?.select,\n      structuralSharing: opts?.structuralSharing,\n      from: this.options.id,\n    } as any) as any\n  }\n\n  useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n    return useParams({\n      select: opts?.select,\n      structuralSharing: opts?.structuralSharing,\n      from: this.options.id,\n    } as any) as any\n  }\n\n  useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n    return useLoaderDeps({ ...opts, from: this.options.id } as any)\n  }\n\n  useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n    return useLoaderData({ ...opts, from: this.options.id } as any)\n  }\n\n  useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n    const router = useRouter()\n    return useNavigate({ from: router.routesById[this.options.id].fullPath })\n  }\n}\n\n/**\n * Creates a lazily-configurable code-based route stub by ID.\n *\n * Use this for code-splitting with code-based routes. The returned function\n * accepts only non-critical route options like `component`, `pendingComponent`,\n * `errorComponent`, and `notFoundComponent` which are applied when the route\n * is matched.\n *\n * @param id Route ID string literal to associate with the lazy route.\n * @returns A function that accepts lazy route options and returns a `LazyRoute`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyRouteFunction\n */\nexport function createLazyRoute<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TId extends string = string,\n  TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n  return (opts: LazyRouteOptions) => {\n    return new LazyRoute<TRoute>({\n      id: id,\n      ...opts,\n    })\n  }\n}\n\n/**\n * Creates a lazily-configurable file-based route stub by file path.\n *\n * Use this for code-splitting with file-based routes (eg. `.lazy.tsx` files).\n * The returned function accepts only non-critical route options like\n * `component`, `pendingComponent`, `errorComponent`, and `notFoundComponent`.\n *\n * @param id File path literal for the route file.\n * @returns A function that accepts lazy route options and returns a `LazyRoute`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createLazyFileRouteFunction\n */\nexport function createLazyFileRoute<\n  TFilePath extends keyof FileRoutesByPath,\n  TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n  if (typeof id === 'object') {\n    return new LazyRoute<TRoute>(id) as any\n  }\n\n  return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"
  },
  {
    "path": "packages/react-router/src/headContentUtils.tsx",
    "content": "import * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { deepEqual, escapeHtml } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\nfunction buildTagsFromMatches(\n  router: ReturnType<typeof useRouter>,\n  nonce: string | undefined,\n  matches: Array<any>,\n): Array<RouterManagedTag> {\n  const routeMeta = matches.map((match) => match.meta!).filter(Boolean)\n\n  const resultMeta: Array<RouterManagedTag> = []\n  const metaByAttribute: Record<string, true> = {}\n  let title: RouterManagedTag | undefined\n  for (let i = routeMeta.length - 1; i >= 0; i--) {\n    const metas = routeMeta[i]!\n    for (let j = metas.length - 1; j >= 0; j--) {\n      const m = metas[j]\n      if (!m) continue\n\n      if (m.title) {\n        if (!title) {\n          title = {\n            tag: 'title',\n            children: m.title,\n          }\n        }\n      } else if ('script:ld+json' in m) {\n        try {\n          const json = JSON.stringify(m['script:ld+json'])\n          resultMeta.push({\n            tag: 'script',\n            attrs: {\n              type: 'application/ld+json',\n            },\n            children: escapeHtml(json),\n          })\n        } catch {\n          // Skip invalid JSON-LD objects\n        }\n      } else {\n        const attribute = m.name ?? m.property\n        if (attribute) {\n          if (metaByAttribute[attribute]) {\n            continue\n          } else {\n            metaByAttribute[attribute] = true\n          }\n        }\n\n        resultMeta.push({\n          tag: 'meta',\n          attrs: {\n            ...m,\n            nonce,\n          },\n        })\n      }\n    }\n  }\n\n  if (title) {\n    resultMeta.push(title)\n  }\n\n  if (nonce) {\n    resultMeta.push({\n      tag: 'meta',\n      attrs: {\n        property: 'csp-nonce',\n        content: nonce,\n      },\n    })\n  }\n  resultMeta.reverse()\n\n  const constructedLinks = matches\n    .map((match) => match.links!)\n    .filter(Boolean)\n    .flat(1)\n    .map((link) => ({\n      tag: 'link',\n      attrs: {\n        ...link,\n        nonce,\n      },\n    })) satisfies Array<RouterManagedTag>\n\n  const manifest = router.ssr?.manifest\n  const assetLinks = matches\n    .map((match) => manifest?.routes[match.routeId]?.assets ?? [])\n    .filter(Boolean)\n    .flat(1)\n    .filter((asset) => asset.tag === 'link')\n    .map(\n      (asset) =>\n        ({\n          tag: 'link',\n          attrs: {\n            ...asset.attrs,\n            suppressHydrationWarning: true,\n            nonce,\n          },\n        }) satisfies RouterManagedTag,\n    )\n\n  const preloadLinks: Array<RouterManagedTag> = []\n  matches\n    .map((match) => router.looseRoutesById[match.routeId]!)\n    .forEach((route) =>\n      router.ssr?.manifest?.routes[route.id]?.preloads\n        ?.filter(Boolean)\n        .forEach((preload) => {\n          preloadLinks.push({\n            tag: 'link',\n            attrs: {\n              rel: 'modulepreload',\n              href: preload,\n              nonce,\n            },\n          })\n        }),\n    )\n\n  const styles = (\n    matches\n      .map((match) => match.styles!)\n      .flat(1)\n      .filter(Boolean) as Array<RouterManagedTag>\n  ).map(({ children, ...attrs }) => ({\n    tag: 'style',\n    attrs: {\n      ...attrs,\n      nonce,\n    },\n    children,\n  }))\n\n  const headScripts = (\n    matches\n      .map((match) => match.headScripts!)\n      .flat(1)\n      .filter(Boolean) as Array<RouterManagedTag>\n  ).map(({ children, ...script }) => ({\n    tag: 'script',\n    attrs: {\n      ...script,\n      nonce,\n    },\n    children,\n  }))\n\n  return uniqBy(\n    [\n      ...resultMeta,\n      ...preloadLinks,\n      ...constructedLinks,\n      ...assetLinks,\n      ...styles,\n      ...headScripts,\n    ] as Array<RouterManagedTag>,\n    (d) => JSON.stringify(d),\n  )\n}\n\n/**\n * Build the list of head/link/meta/script tags to render for active matches.\n * Used internally by `HeadContent`.\n */\nexport const useTags = () => {\n  const router = useRouter()\n  const nonce = router.options.ssr?.nonce\n\n  if (isServer ?? router.isServer) {\n    return buildTagsFromMatches(\n      router,\n      nonce,\n      router.stores.activeMatchesSnapshot.state,\n    )\n  }\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const routeMeta = useStore(\n    router.stores.activeMatchesSnapshot,\n    (matches) => {\n      return matches.map((match) => match.meta!).filter(Boolean)\n    },\n    deepEqual,\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const meta: Array<RouterManagedTag> = React.useMemo(() => {\n    const resultMeta: Array<RouterManagedTag> = []\n    const metaByAttribute: Record<string, true> = {}\n    let title: RouterManagedTag | undefined\n    for (let i = routeMeta.length - 1; i >= 0; i--) {\n      const metas = routeMeta[i]!\n      for (let j = metas.length - 1; j >= 0; j--) {\n        const m = metas[j]\n        if (!m) continue\n\n        if (m.title) {\n          if (!title) {\n            title = {\n              tag: 'title',\n              children: m.title,\n            }\n          }\n        } else if ('script:ld+json' in m) {\n          // Handle JSON-LD structured data\n          // Content is HTML-escaped to prevent XSS when injected via dangerouslySetInnerHTML\n          try {\n            const json = JSON.stringify(m['script:ld+json'])\n            resultMeta.push({\n              tag: 'script',\n              attrs: {\n                type: 'application/ld+json',\n              },\n              children: escapeHtml(json),\n            })\n          } catch {\n            // Skip invalid JSON-LD objects\n          }\n        } else {\n          const attribute = m.name ?? m.property\n          if (attribute) {\n            if (metaByAttribute[attribute]) {\n              continue\n            } else {\n              metaByAttribute[attribute] = true\n            }\n          }\n\n          resultMeta.push({\n            tag: 'meta',\n            attrs: {\n              ...m,\n              nonce,\n            },\n          })\n        }\n      }\n    }\n\n    if (title) {\n      resultMeta.push(title)\n    }\n\n    if (nonce) {\n      resultMeta.push({\n        tag: 'meta',\n        attrs: {\n          property: 'csp-nonce',\n          content: nonce,\n        },\n      })\n    }\n    resultMeta.reverse()\n\n    return resultMeta\n  }, [routeMeta, nonce])\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const links = useStore(\n    router.stores.activeMatchesSnapshot,\n    (matches) => {\n      const constructed = matches\n        .map((match) => match.links!)\n        .filter(Boolean)\n        .flat(1)\n        .map((link) => ({\n          tag: 'link',\n          attrs: {\n            ...link,\n            nonce,\n          },\n        })) satisfies Array<RouterManagedTag>\n\n      const manifest = router.ssr?.manifest\n\n      // These are the assets extracted from the ViteManifest\n      // using the `startManifestPlugin`\n      const assets = matches\n        .map((match) => manifest?.routes[match.routeId]?.assets ?? [])\n        .filter(Boolean)\n        .flat(1)\n        .filter((asset) => asset.tag === 'link')\n        .map(\n          (asset) =>\n            ({\n              tag: 'link',\n              attrs: {\n                ...asset.attrs,\n                suppressHydrationWarning: true,\n                nonce,\n              },\n            }) satisfies RouterManagedTag,\n        )\n\n      return [...constructed, ...assets]\n    },\n    deepEqual,\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const preloadLinks = useStore(\n    router.stores.activeMatchesSnapshot,\n    (matches) => {\n      const preloadLinks: Array<RouterManagedTag> = []\n\n      matches\n        .map((match) => router.looseRoutesById[match.routeId]!)\n        .forEach((route) =>\n          router.ssr?.manifest?.routes[route.id]?.preloads\n            ?.filter(Boolean)\n            .forEach((preload) => {\n              preloadLinks.push({\n                tag: 'link',\n                attrs: {\n                  rel: 'modulepreload',\n                  href: preload,\n                  nonce,\n                },\n              })\n            }),\n        )\n\n      return preloadLinks\n    },\n    deepEqual,\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const styles = useStore(\n    router.stores.activeMatchesSnapshot,\n    (matches) =>\n      (\n        matches\n          .map((match) => match.styles!)\n          .flat(1)\n          .filter(Boolean) as Array<RouterManagedTag>\n      ).map(({ children, ...attrs }) => ({\n        tag: 'style',\n        attrs: {\n          ...attrs,\n          nonce,\n        },\n        children,\n      })),\n    deepEqual,\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const headScripts: Array<RouterManagedTag> = useStore(\n    router.stores.activeMatchesSnapshot,\n    (matches) =>\n      (\n        matches\n          .map((match) => match.headScripts!)\n          .flat(1)\n          .filter(Boolean) as Array<RouterManagedTag>\n      ).map(({ children, ...script }) => ({\n        tag: 'script',\n        attrs: {\n          ...script,\n          nonce,\n        },\n        children,\n      })),\n    deepEqual,\n  )\n\n  return uniqBy(\n    [\n      ...meta,\n      ...preloadLinks,\n      ...links,\n      ...styles,\n      ...headScripts,\n    ] as Array<RouterManagedTag>,\n    (d) => {\n      return JSON.stringify(d)\n    },\n  )\n}\n\nexport function uniqBy<T>(arr: Array<T>, fn: (item: T) => string) {\n  const seen = new Set<string>()\n  return arr.filter((item) => {\n    const key = fn(item)\n    if (seen.has(key)) {\n      return false\n    }\n    seen.add(key)\n    return true\n  })\n}\n"
  },
  {
    "path": "packages/react-router/src/history.ts",
    "content": "import type { HistoryLocation } from '@tanstack/history'\n\ndeclare module '@tanstack/history' {\n  interface HistoryState {\n    __tempLocation?: HistoryLocation\n    __tempKey?: string\n    __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions\n  }\n}\n"
  },
  {
    "path": "packages/react-router/src/index.dev.tsx",
    "content": "// Development entry point - re-exports everything from index.tsx\n// but overrides HeadContent with the dev version that handles\n// dev styles cleanup after hydration\n\nexport * from './index'\nexport { HeadContent } from './HeadContent.dev'\n"
  },
  {
    "path": "packages/react-router/src/index.tsx",
    "content": "export {\n  defer,\n  isMatch,\n  joinPaths,\n  cleanPath,\n  trimPathLeft,\n  trimPathRight,\n  trimPath,\n  resolvePath,\n  interpolatePath,\n  rootRouteId,\n  defaultParseSearch,\n  defaultStringifySearch,\n  parseSearchWith,\n  stringifySearchWith,\n  functionalUpdate,\n  replaceEqualDeep,\n  isPlainObject,\n  isPlainArray,\n  deepEqual,\n  createControlledPromise,\n  retainSearchParams,\n  stripSearchParams,\n  createSerializationAdapter,\n} from '@tanstack/router-core'\n\nexport type {\n  AnyRoute,\n  DeferredPromiseState,\n  DeferredPromise,\n  ParsedLocation,\n  RemoveTrailingSlashes,\n  RemoveLeadingSlashes,\n  ActiveOptions,\n  ResolveRelativePath,\n  RootRouteId,\n  AnyPathParams,\n  ResolveParams,\n  ResolveOptionalParams,\n  ResolveRequiredParams,\n  SearchSchemaInput,\n  AnyContext,\n  RouteContext,\n  PreloadableObj,\n  RoutePathOptions,\n  StaticDataRouteOption,\n  RoutePathOptionsIntersection,\n  UpdatableStaticRouteOption,\n  MetaDescriptor,\n  RouteLinkEntry,\n  ParseParamsFn,\n  SearchFilter,\n  ResolveId,\n  InferFullSearchSchema,\n  InferFullSearchSchemaInput,\n  ErrorRouteProps,\n  ErrorComponentProps,\n  NotFoundRouteProps,\n  TrimPath,\n  TrimPathLeft,\n  TrimPathRight,\n  StringifyParamsFn,\n  ParamsOptions,\n  InferAllParams,\n  InferAllContext,\n  LooseReturnType,\n  LooseAsyncReturnType,\n  ContextReturnType,\n  ContextAsyncReturnType,\n  ResolveLoaderData,\n  ResolveRouteContext,\n  SearchSerializer,\n  SearchParser,\n  TrailingSlashOption,\n  Manifest,\n  RouterManagedTag,\n  ControlledPromise,\n  Constrain,\n  Expand,\n  MergeAll,\n  Assign,\n  IntersectAssign,\n  ResolveValidatorInput,\n  ResolveValidatorOutput,\n  Register,\n  AnyValidator,\n  DefaultValidator,\n  ValidatorFn,\n  AnySchema,\n  AnyValidatorAdapter,\n  AnyValidatorFn,\n  AnyValidatorObj,\n  ResolveValidatorInputFn,\n  ResolveValidatorOutputFn,\n  ResolveSearchValidatorInput,\n  ResolveSearchValidatorInputFn,\n  Validator,\n  ValidatorAdapter,\n  ValidatorObj,\n  FileRoutesByPath,\n  RouteById,\n  RootRouteOptions,\n  CreateFileRoute,\n  SerializationAdapter,\n  AnySerializationAdapter,\n  SerializableExtensions,\n} from '@tanstack/router-core'\n\nexport {\n  createHistory,\n  createBrowserHistory,\n  createHashHistory,\n  createMemoryHistory,\n} from '@tanstack/history'\n\nexport type {\n  BlockerFn,\n  HistoryLocation,\n  RouterHistory,\n  ParsedPath,\n  HistoryState,\n} from '@tanstack/history'\n\nexport { useAwaited, Await } from './awaited'\nexport type { AwaitOptions } from './awaited'\n\nexport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nexport { ClientOnly, useHydrated } from './ClientOnly'\n\nexport {\n  FileRoute,\n  createFileRoute,\n  FileRouteLoader,\n  LazyRoute,\n  createLazyRoute,\n  createLazyFileRoute,\n} from './fileRoute'\n\nexport * from './history'\n\nexport { lazyRouteComponent } from './lazyRouteComponent'\n\nexport { useLinkProps, createLink, Link, linkOptions } from './link'\nexport type {\n  InferDescendantToPaths,\n  RelativeToPath,\n  RelativeToParentPath,\n  RelativeToCurrentPath,\n  AbsoluteToPath,\n  RelativeToPathAutoComplete,\n  NavigateOptions,\n  ToOptions,\n  ToMaskOptions,\n  ToSubOptions,\n  ResolveRoute,\n  SearchParamOptions,\n  PathParamOptions,\n  ToPathOption,\n  LinkOptions,\n  MakeOptionalPathParams,\n  FileRouteTypes,\n  RouteContextParameter,\n  BeforeLoadContextParameter,\n  ResolveAllContext,\n  ResolveAllParamsFromParent,\n  ResolveFullSearchSchema,\n  ResolveFullSearchSchemaInput,\n  RouteIds,\n  NavigateFn,\n  BuildLocationFn,\n  FullSearchSchemaOption,\n  MakeRemountDepsOptionsUnion,\n  RemountDepsOptions,\n  ResolveFullPath,\n  AnyRouteWithContext,\n  AnyRouterWithContext,\n  CommitLocationOptions,\n  MatchLocation,\n  UseNavigateResult,\n  AnyRedirect,\n  Redirect,\n  RedirectOptions,\n  ResolvedRedirect,\n  MakeRouteMatch,\n  MakeRouteMatchUnion,\n  RouteMatch,\n  AnyRouteMatch,\n  RouteContextFn,\n  RouteContextOptions,\n  BeforeLoadContextOptions,\n  ContextOptions,\n  RouteOptions,\n  FileBaseRouteOptions,\n  BaseRouteOptions,\n  UpdatableRouteOptions,\n  RouteLoaderFn,\n  LoaderFnContext,\n  LazyRouteOptions,\n  AnyRouter,\n  RegisteredRouter,\n  RouterContextOptions,\n  ControllablePromise,\n  InjectedHtmlEntry,\n  RouterOptions,\n  RouterState,\n  ListenerFn,\n  BuildNextOptions,\n  RouterConstructorOptions,\n  RouterEvents,\n  RouterEvent,\n  RouterListener,\n  RouteConstraints,\n  RouteMask,\n  MatchRouteOptions,\n  CreateLazyFileRoute,\n} from '@tanstack/router-core'\nexport type {\n  UseLinkPropsOptions,\n  ActiveLinkOptions,\n  LinkProps,\n  LinkComponent,\n  LinkComponentProps,\n  CreateLinkProps,\n} from './link'\n\nexport {\n  Matches,\n  useMatchRoute,\n  MatchRoute,\n  useMatches,\n  useParentMatches,\n  useChildMatches,\n} from './Matches'\n\nexport type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches'\n\nexport { Match, Outlet } from './Match'\n\nexport { useMatch } from './useMatch'\nexport { useLoaderDeps } from './useLoaderDeps'\nexport { useLoaderData } from './useLoaderData'\n\nexport {\n  redirect,\n  isRedirect,\n  createRouterConfig,\n  DEFAULT_PROTOCOL_ALLOWLIST,\n} from '@tanstack/router-core'\n\nexport {\n  RouteApi,\n  getRouteApi,\n  Route,\n  createRoute,\n  RootRoute,\n  rootRouteWithContext,\n  createRootRoute,\n  createRootRouteWithContext,\n  createRouteMask,\n  NotFoundRoute,\n} from './route'\nexport type {\n  AnyRootRoute,\n  AsyncRouteComponent,\n  RouteComponent,\n  ErrorRouteComponent,\n  NotFoundRouteComponent,\n  DefaultRouteTypes,\n  RouteTypes,\n} from './route'\n\nexport { createRouter, Router } from './router'\n\nexport { lazyFn, SearchParamError } from '@tanstack/router-core'\n\nexport { RouterProvider, RouterContextProvider } from './RouterProvider'\nexport type { RouterProps } from './RouterProvider'\n\nexport {\n  useElementScrollRestoration,\n  ScrollRestoration,\n} from './ScrollRestoration'\n\nexport type { UseBlockerOpts, ShouldBlockFn } from './useBlocker'\nexport { useBlocker, Block } from './useBlocker'\n\nexport { useNavigate, Navigate } from './useNavigate'\n\nexport { useParams } from './useParams'\nexport { useSearch } from './useSearch'\n\nexport { useRouteContext } from './useRouteContext'\nexport { useRouter } from './useRouter'\nexport { useRouterState } from './useRouterState'\nexport { useLocation } from './useLocation'\nexport { useCanGoBack } from './useCanGoBack'\n\nexport { CatchNotFound, DefaultGlobalNotFound } from './not-found'\nexport { notFound, isNotFound } from '@tanstack/router-core'\nexport type { NotFoundError } from '@tanstack/router-core'\n\nexport type {\n  ValidateLinkOptions,\n  InferStructuralSharing,\n  ValidateUseSearchOptions,\n  ValidateUseParamsOptions,\n  ValidateLinkOptionsArray,\n} from './typePrimitives'\n\nexport type {\n  ValidateFromPath,\n  ValidateToPath,\n  ValidateSearch,\n  ValidateParams,\n  InferFrom,\n  InferTo,\n  InferMaskTo,\n  InferMaskFrom,\n  ValidateNavigateOptions,\n  ValidateNavigateOptionsArray,\n  ValidateRedirectOptions,\n  ValidateRedirectOptionsArray,\n  ValidateId,\n  InferStrict,\n  InferShouldThrow,\n  InferSelected,\n  ValidateUseSearchResult,\n  ValidateUseParamsResult,\n} from '@tanstack/router-core'\n\nexport { ScriptOnce } from './ScriptOnce'\nexport { Asset } from './Asset'\nexport { HeadContent } from './HeadContent'\nexport { useTags } from './headContentUtils'\nexport { Scripts } from './Scripts'\nexport type * from './ssr/serializer'\nexport { composeRewrites } from '@tanstack/router-core'\nexport type {\n  LocationRewrite,\n  LocationRewriteFunction,\n} from '@tanstack/router-core'\n"
  },
  {
    "path": "packages/react-router/src/lazyRouteComponent.tsx",
    "content": "import * as React from 'react'\nimport { isModuleNotFoundError } from '@tanstack/router-core'\nimport { reactUse } from './utils'\nimport type { AsyncRouteComponent } from './route'\n\n/**\n * Wrap a dynamic import to create a route component that supports\n * `.preload()` and friendly reload-on-module-missing behavior.\n *\n * @param importer Function returning a module promise\n * @param exportName Named export to use (default: `default`)\n * @returns A lazy route component compatible with TanStack Router\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/lazyRouteComponentFunction\n */\nexport function lazyRouteComponent<\n  T extends Record<string, any>,\n  TKey extends keyof T = 'default',\n>(\n  importer: () => Promise<T>,\n  exportName?: TKey,\n): T[TKey] extends (props: infer TProps) => any\n  ? AsyncRouteComponent<TProps>\n  : never {\n  let loadPromise: Promise<any> | undefined\n  let comp: T[TKey] | T['default']\n  let error: any\n  let reload: boolean\n\n  const load = () => {\n    if (!loadPromise) {\n      loadPromise = importer()\n        .then((res) => {\n          loadPromise = undefined\n          comp = res[exportName ?? 'default']\n        })\n        .catch((err) => {\n          // We don't want an error thrown from preload in this case, because\n          // there's nothing we want to do about module not found during preload.\n          // Record the error, the rest is handled during the render path.\n          error = err\n          // If the load fails due to module not found, it may mean a new version of\n          // the build was deployed and the user's browser is still using an old version.\n          // If this happens, the old version in the user's browser would have an outdated\n          // URL to the lazy module.\n          // In that case, we want to attempt one window refresh to get the latest.\n          if (isModuleNotFoundError(error)) {\n            if (\n              error instanceof Error &&\n              typeof window !== 'undefined' &&\n              typeof sessionStorage !== 'undefined'\n            ) {\n              // Again, we want to reload one time on module not found error and not enter\n              // a reload loop if there is some other issue besides an old deploy.\n              // That's why we store our reload attempt in sessionStorage.\n              // Use error.message as key because it contains the module path that failed.\n              const storageKey = `tanstack_router_reload:${error.message}`\n              if (!sessionStorage.getItem(storageKey)) {\n                sessionStorage.setItem(storageKey, '1')\n                reload = true\n              }\n            }\n          }\n        })\n    }\n\n    return loadPromise\n  }\n\n  const lazyComp = function Lazy(props: any) {\n    // Now that we're out of preload and into actual render path,\n    if (reload) {\n      // If it was a module loading error,\n      // throw eternal suspense while we wait for window to reload\n      window.location.reload()\n      throw new Promise(() => {})\n    }\n    if (error) {\n      // Otherwise, just throw the error\n      throw error\n    }\n\n    if (!comp) {\n      if (reactUse) {\n        reactUse(load())\n      } else {\n        throw load()\n      }\n    }\n\n    return React.createElement(comp, props)\n  }\n\n  ;(lazyComp as any).preload = load\n\n  return lazyComp as any\n}\n"
  },
  {
    "path": "packages/react-router/src/link.tsx",
    "content": "import * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { flushSync } from 'react-dom'\nimport {\n  deepEqual,\n  exactPathTest,\n  functionalUpdate,\n  isDangerousProtocol,\n  preloadWarning,\n  removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nimport { useForwardedRef, useIntersectionObserver } from './utils'\n\nimport { useHydrated } from './ClientOnly'\nimport type {\n  AnyRouter,\n  Constrain,\n  LinkOptions,\n  RegisteredRouter,\n  RoutePaths,\n} from '@tanstack/router-core'\nimport type { ReactNode } from 'react'\nimport type {\n  ValidateLinkOptions,\n  ValidateLinkOptionsArray,\n} from './typePrimitives'\n\n/**\n * Build anchor-like props for declarative navigation and preloading.\n *\n * Returns stable `href`, event handlers and accessibility props derived from\n * router options and active state. Used internally by `Link` and custom links.\n *\n * Options cover `to`, `params`, `search`, `hash`, `state`, `preload`,\n * `activeProps`, `inactiveProps`, and more.\n *\n * @returns React anchor props suitable for `<a>` or custom components.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLinkPropsHook\n */\nexport function useLinkProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = string,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(\n  options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n  forwardedRef?: React.ForwardedRef<Element>,\n): React.ComponentPropsWithRef<'a'> {\n  const router = useRouter()\n  const innerRef = useForwardedRef(forwardedRef)\n\n  // Determine if we're on the server - used for tree-shaking client-only code\n  const _isServer = isServer ?? router.isServer\n\n  const {\n    // custom props\n    activeProps,\n    inactiveProps,\n    activeOptions,\n    to,\n    preload: userPreload,\n    preloadDelay: userPreloadDelay,\n    hashScrollIntoView,\n    replace,\n    startTransition,\n    resetScroll,\n    viewTransition,\n    // element props\n    children,\n    target,\n    disabled,\n    style,\n    className,\n    onClick,\n    onBlur,\n    onFocus,\n    onMouseEnter,\n    onMouseLeave,\n    onTouchStart,\n    ignoreBlocker,\n    // prevent these from being returned\n    params: _params,\n    search: _search,\n    hash: _hash,\n    state: _state,\n    mask: _mask,\n    reloadDocument: _reloadDocument,\n    unsafeRelative: _unsafeRelative,\n    from: _from,\n    _fromLocation,\n    ...propsSafeToSpread\n  } = options\n\n  // ==========================================================================\n  // SERVER EARLY RETURN\n  // On the server, we return static props without any event handlers,\n  // effects, or client-side interactivity.\n  //\n  // For SSR parity (to avoid hydration errors), we still compute the link's\n  // active status on the server, but we avoid creating any router-state\n  // subscriptions by reading from the location store directly.\n  //\n  // Note: `location.hash` is not available on the server.\n  // ==========================================================================\n  if (_isServer) {\n    const safeInternal = isSafeInternal(to)\n\n    // If `to` is obviously an absolute URL, treat as external and avoid\n    // computing the internal location via `buildLocation`.\n    if (\n      typeof to === 'string' &&\n      !safeInternal &&\n      // Quick checks to avoid `new URL` in common internal-like cases\n      to.indexOf(':') > -1\n    ) {\n      try {\n        new URL(to)\n        if (isDangerousProtocol(to, router.protocolAllowlist)) {\n          if (process.env.NODE_ENV !== 'production') {\n            console.warn(`Blocked Link with dangerous protocol: ${to}`)\n          }\n          return {\n            ...propsSafeToSpread,\n            ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n            href: undefined,\n            ...(children && { children }),\n            ...(target && { target }),\n            ...(disabled && { disabled }),\n            ...(style && { style }),\n            ...(className && { className }),\n          }\n        }\n\n        return {\n          ...propsSafeToSpread,\n          ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n          href: to,\n          ...(children && { children }),\n          ...(target && { target }),\n          ...(disabled && { disabled }),\n          ...(style && { style }),\n          ...(className && { className }),\n        }\n      } catch {\n        // Not an absolute URL\n      }\n    }\n\n    const next = router.buildLocation({ ...options, from: options.from } as any)\n\n    // Use publicHref - it contains the correct href for display\n    // When a rewrite changes the origin, publicHref is the full URL\n    // Otherwise it's the origin-stripped path\n    // This avoids constructing URL objects in the hot path\n    const hrefOptionPublicHref = next.maskedLocation\n      ? next.maskedLocation.publicHref\n      : next.publicHref\n    const hrefOptionExternal = next.maskedLocation\n      ? next.maskedLocation.external\n      : next.external\n    const hrefOption = getHrefOption(\n      hrefOptionPublicHref,\n      hrefOptionExternal,\n      router.history,\n      disabled,\n    )\n\n    const externalLink = (() => {\n      if (hrefOption?.external) {\n        if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {\n          if (process.env.NODE_ENV !== 'production') {\n            console.warn(\n              `Blocked Link with dangerous protocol: ${hrefOption.href}`,\n            )\n          }\n          return undefined\n        }\n        return hrefOption.href\n      }\n\n      if (safeInternal) return undefined\n\n      // Only attempt URL parsing when it looks like an absolute URL.\n      if (typeof to === 'string' && to.indexOf(':') > -1) {\n        try {\n          new URL(to)\n          if (isDangerousProtocol(to, router.protocolAllowlist)) {\n            if (process.env.NODE_ENV !== 'production') {\n              console.warn(`Blocked Link with dangerous protocol: ${to}`)\n            }\n            return undefined\n          }\n          return to\n        } catch {}\n      }\n\n      return undefined\n    })()\n\n    const isActive = (() => {\n      if (externalLink) return false\n\n      const currentLocation = router.stores.location.state\n\n      const exact = activeOptions?.exact ?? false\n\n      if (exact) {\n        const testExact = exactPathTest(\n          currentLocation.pathname,\n          next.pathname,\n          router.basepath,\n        )\n        if (!testExact) {\n          return false\n        }\n      } else {\n        const currentPathSplit = removeTrailingSlash(\n          currentLocation.pathname,\n          router.basepath,\n        )\n        const nextPathSplit = removeTrailingSlash(\n          next.pathname,\n          router.basepath,\n        )\n\n        const pathIsFuzzyEqual =\n          currentPathSplit.startsWith(nextPathSplit) &&\n          (currentPathSplit.length === nextPathSplit.length ||\n            currentPathSplit[nextPathSplit.length] === '/')\n\n        if (!pathIsFuzzyEqual) {\n          return false\n        }\n      }\n\n      const includeSearch = activeOptions?.includeSearch ?? true\n      if (includeSearch) {\n        if (currentLocation.search !== next.search) {\n          const currentSearchEmpty =\n            !currentLocation.search ||\n            (typeof currentLocation.search === 'object' &&\n              Object.keys(currentLocation.search).length === 0)\n          const nextSearchEmpty =\n            !next.search ||\n            (typeof next.search === 'object' &&\n              Object.keys(next.search).length === 0)\n\n          if (!(currentSearchEmpty && nextSearchEmpty)) {\n            const searchTest = deepEqual(currentLocation.search, next.search, {\n              partial: !exact,\n              ignoreUndefined: !activeOptions?.explicitUndefined,\n            })\n            if (!searchTest) {\n              return false\n            }\n          }\n        }\n      }\n\n      // Hash is not available on the server\n      if (activeOptions?.includeHash) {\n        return false\n      }\n\n      return true\n    })()\n\n    if (externalLink) {\n      return {\n        ...propsSafeToSpread,\n        ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n        href: externalLink,\n        ...(children && { children }),\n        ...(target && { target }),\n        ...(disabled && { disabled }),\n        ...(style && { style }),\n        ...(className && { className }),\n      }\n    }\n\n    const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n      isActive\n        ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n        : STATIC_EMPTY_OBJECT\n\n    const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n      isActive\n        ? STATIC_EMPTY_OBJECT\n        : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n    const resolvedStyle = (() => {\n      const baseStyle = style\n      const activeStyle = resolvedActiveProps.style\n      const inactiveStyle = resolvedInactiveProps.style\n\n      if (!baseStyle && !activeStyle && !inactiveStyle) {\n        return undefined\n      }\n\n      if (baseStyle && !activeStyle && !inactiveStyle) {\n        return baseStyle\n      }\n\n      if (!baseStyle && activeStyle && !inactiveStyle) {\n        return activeStyle\n      }\n\n      if (!baseStyle && !activeStyle && inactiveStyle) {\n        return inactiveStyle\n      }\n\n      return {\n        ...baseStyle,\n        ...activeStyle,\n        ...inactiveStyle,\n      }\n    })()\n\n    const resolvedClassName = (() => {\n      const baseClassName = className\n      const activeClassName = resolvedActiveProps.className\n      const inactiveClassName = resolvedInactiveProps.className\n\n      if (!baseClassName && !activeClassName && !inactiveClassName) {\n        return ''\n      }\n\n      let out = ''\n\n      if (baseClassName) {\n        out = baseClassName\n      }\n\n      if (activeClassName) {\n        out = out ? `${out} ${activeClassName}` : activeClassName\n      }\n\n      if (inactiveClassName) {\n        out = out ? `${out} ${inactiveClassName}` : inactiveClassName\n      }\n\n      return out\n    })()\n\n    return {\n      ...propsSafeToSpread,\n      ...resolvedActiveProps,\n      ...resolvedInactiveProps,\n      href: hrefOption?.href,\n      ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n      disabled: !!disabled,\n      target,\n      ...(resolvedStyle && { style: resolvedStyle }),\n      ...(resolvedClassName && { className: resolvedClassName }),\n      ...(disabled && STATIC_DISABLED_PROPS),\n      ...(isActive && STATIC_ACTIVE_PROPS),\n    }\n  }\n\n  // ==========================================================================\n  // CLIENT-ONLY CODE\n  // Everything below this point only runs on the client. The `isServer` check\n  // above is a compile-time constant that bundlers use for dead code elimination,\n  // so this entire section is removed from server bundles.\n  //\n  // We disable the rules-of-hooks lint rule because these hooks appear after\n  // an early return. This is safe because:\n  // 1. `isServer` is a compile-time constant from conditional exports\n  // 2. In server bundles, this code is completely eliminated by the bundler\n  // 3. In client bundles, `isServer` is `false`, so the early return never executes\n  // ==========================================================================\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const isHydrated = useHydrated()\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const _options = React.useMemo(\n    () => options,\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [\n      router,\n      options.from,\n      options._fromLocation,\n      options.hash,\n      options.to,\n      options.search,\n      options.params,\n      options.state,\n      options.mask,\n      options.unsafeRelative,\n    ],\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const currentLocation = useStore(\n    router.stores.location,\n    (l) => l,\n    (prev, next) => prev.href === next.href,\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const next = React.useMemo(() => {\n    const opts = { _fromLocation: currentLocation, ..._options }\n    return router.buildLocation(opts as any)\n  }, [router, currentLocation, _options])\n\n  // Use publicHref - it contains the correct href for display\n  // When a rewrite changes the origin, publicHref is the full URL\n  // Otherwise it's the origin-stripped path\n  // This avoids constructing URL objects in the hot path\n  const hrefOptionPublicHref = next.maskedLocation\n    ? next.maskedLocation.publicHref\n    : next.publicHref\n  const hrefOptionExternal = next.maskedLocation\n    ? next.maskedLocation.external\n    : next.external\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const hrefOption = React.useMemo(\n    () =>\n      getHrefOption(\n        hrefOptionPublicHref,\n        hrefOptionExternal,\n        router.history,\n        disabled,\n      ),\n    [disabled, hrefOptionExternal, hrefOptionPublicHref, router.history],\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const externalLink = React.useMemo(() => {\n    if (hrefOption?.external) {\n      // Block dangerous protocols for external links\n      if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {\n        if (process.env.NODE_ENV !== 'production') {\n          console.warn(\n            `Blocked Link with dangerous protocol: ${hrefOption.href}`,\n          )\n        }\n        return undefined\n      }\n      return hrefOption.href\n    }\n    const safeInternal = isSafeInternal(to)\n    if (safeInternal) return undefined\n    if (typeof to !== 'string' || to.indexOf(':') === -1) return undefined\n    try {\n      new URL(to as any)\n      // Block dangerous protocols like javascript:, blob:, data:\n      if (isDangerousProtocol(to, router.protocolAllowlist)) {\n        if (process.env.NODE_ENV !== 'production') {\n          console.warn(`Blocked Link with dangerous protocol: ${to}`)\n        }\n        return undefined\n      }\n      return to\n    } catch {}\n    return undefined\n  }, [to, hrefOption, router.protocolAllowlist])\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const isActive = React.useMemo(() => {\n    if (externalLink) return false\n    if (activeOptions?.exact) {\n      const testExact = exactPathTest(\n        currentLocation.pathname,\n        next.pathname,\n        router.basepath,\n      )\n      if (!testExact) {\n        return false\n      }\n    } else {\n      const currentPathSplit = removeTrailingSlash(\n        currentLocation.pathname,\n        router.basepath,\n      )\n      const nextPathSplit = removeTrailingSlash(next.pathname, router.basepath)\n\n      const pathIsFuzzyEqual =\n        currentPathSplit.startsWith(nextPathSplit) &&\n        (currentPathSplit.length === nextPathSplit.length ||\n          currentPathSplit[nextPathSplit.length] === '/')\n\n      if (!pathIsFuzzyEqual) {\n        return false\n      }\n    }\n\n    if (activeOptions?.includeSearch ?? true) {\n      const searchTest = deepEqual(currentLocation.search, next.search, {\n        partial: !activeOptions?.exact,\n        ignoreUndefined: !activeOptions?.explicitUndefined,\n      })\n      if (!searchTest) {\n        return false\n      }\n    }\n\n    if (activeOptions?.includeHash) {\n      return isHydrated && currentLocation.hash === next.hash\n    }\n    return true\n  }, [\n    activeOptions?.exact,\n    activeOptions?.explicitUndefined,\n    activeOptions?.includeHash,\n    activeOptions?.includeSearch,\n    currentLocation,\n    externalLink,\n    isHydrated,\n    next.hash,\n    next.pathname,\n    next.search,\n    router.basepath,\n  ])\n\n  // Get the active props\n  const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n    ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n    : STATIC_EMPTY_OBJECT\n\n  // Get the inactive props\n  const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n    isActive\n      ? STATIC_EMPTY_OBJECT\n      : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n  const resolvedClassName = [\n    className,\n    resolvedActiveProps.className,\n    resolvedInactiveProps.className,\n  ]\n    .filter(Boolean)\n    .join(' ')\n\n  const resolvedStyle = (style ||\n    resolvedActiveProps.style ||\n    resolvedInactiveProps.style) && {\n    ...style,\n    ...resolvedActiveProps.style,\n    ...resolvedInactiveProps.style,\n  }\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const [isTransitioning, setIsTransitioning] = React.useState(false)\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const hasRenderFetched = React.useRef(false)\n\n  const preload =\n    options.reloadDocument || externalLink\n      ? false\n      : (userPreload ?? router.options.defaultPreload)\n  const preloadDelay =\n    userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const doPreload = React.useCallback(() => {\n    router\n      .preloadRoute({ ..._options, _builtLocation: next } as any)\n      .catch((err) => {\n        console.warn(err)\n        console.warn(preloadWarning)\n      })\n  }, [router, _options, next])\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const preloadViewportIoCallback = React.useCallback(\n    (entry: IntersectionObserverEntry | undefined) => {\n      if (entry?.isIntersecting) {\n        doPreload()\n      }\n    },\n    [doPreload],\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  useIntersectionObserver(\n    innerRef,\n    preloadViewportIoCallback,\n    intersectionObserverOptions,\n    { disabled: !!disabled || !(preload === 'viewport') },\n  )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  React.useEffect(() => {\n    if (hasRenderFetched.current) {\n      return\n    }\n    if (!disabled && preload === 'render') {\n      doPreload()\n      hasRenderFetched.current = true\n    }\n  }, [disabled, doPreload, preload])\n\n  // The click handler\n  const handleClick = (e: React.MouseEvent) => {\n    // Check actual element's target attribute as fallback\n    const elementTarget = (\n      e.currentTarget as HTMLAnchorElement | SVGAElement\n    ).getAttribute('target')\n    const effectiveTarget = target !== undefined ? target : elementTarget\n\n    if (\n      !disabled &&\n      !isCtrlEvent(e) &&\n      !e.defaultPrevented &&\n      (!effectiveTarget || effectiveTarget === '_self') &&\n      e.button === 0\n    ) {\n      e.preventDefault()\n\n      flushSync(() => {\n        setIsTransitioning(true)\n      })\n\n      const unsub = router.subscribe('onResolved', () => {\n        unsub()\n        setIsTransitioning(false)\n      })\n\n      // All is well? Navigate!\n      // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n      router.navigate({\n        ..._options,\n        replace,\n        resetScroll,\n        hashScrollIntoView,\n        startTransition,\n        viewTransition,\n        ignoreBlocker,\n      })\n    }\n  }\n\n  if (externalLink) {\n    return {\n      ...propsSafeToSpread,\n      ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n      href: externalLink,\n      ...(children && { children }),\n      ...(target && { target }),\n      ...(disabled && { disabled }),\n      ...(style && { style }),\n      ...(className && { className }),\n      ...(onClick && { onClick }),\n      ...(onBlur && { onBlur }),\n      ...(onFocus && { onFocus }),\n      ...(onMouseEnter && { onMouseEnter }),\n      ...(onMouseLeave && { onMouseLeave }),\n      ...(onTouchStart && { onTouchStart }),\n    }\n  }\n\n  const enqueueIntentPreload = (e: React.MouseEvent | React.FocusEvent) => {\n    if (disabled || preload !== 'intent') return\n\n    if (!preloadDelay) {\n      doPreload()\n      return\n    }\n\n    const eventTarget = e.currentTarget\n\n    if (timeoutMap.has(eventTarget)) {\n      return\n    }\n\n    const id = setTimeout(() => {\n      timeoutMap.delete(eventTarget)\n      doPreload()\n    }, preloadDelay)\n    timeoutMap.set(eventTarget, id)\n  }\n\n  const handleTouchStart = (_: React.TouchEvent) => {\n    if (disabled || preload !== 'intent') return\n    doPreload()\n  }\n\n  const handleLeave = (e: React.MouseEvent | React.FocusEvent) => {\n    if (disabled || !preload || !preloadDelay) return\n    const eventTarget = e.currentTarget\n    const id = timeoutMap.get(eventTarget)\n    if (id) {\n      clearTimeout(id)\n      timeoutMap.delete(eventTarget)\n    }\n  }\n\n  return {\n    ...propsSafeToSpread,\n    ...resolvedActiveProps,\n    ...resolvedInactiveProps,\n    href: hrefOption?.href,\n    ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n    onClick: composeHandlers([onClick, handleClick]),\n    onBlur: composeHandlers([onBlur, handleLeave]),\n    onFocus: composeHandlers([onFocus, enqueueIntentPreload]),\n    onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),\n    onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n    onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n    disabled: !!disabled,\n    target,\n    ...(resolvedStyle && { style: resolvedStyle }),\n    ...(resolvedClassName && { className: resolvedClassName }),\n    ...(disabled && STATIC_DISABLED_PROPS),\n    ...(isActive && STATIC_ACTIVE_PROPS),\n    ...(isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS),\n  }\n}\n\nconst STATIC_EMPTY_OBJECT = {}\nconst STATIC_ACTIVE_OBJECT = { className: 'active' }\nconst STATIC_DISABLED_PROPS = { role: 'link', 'aria-disabled': true }\nconst STATIC_ACTIVE_PROPS = { 'data-status': 'active', 'aria-current': 'page' }\nconst STATIC_TRANSITIONING_PROPS = { 'data-transitioning': 'transitioning' }\n\nconst timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()\n\nconst intersectionObserverOptions: IntersectionObserverInit = {\n  rootMargin: '100px',\n}\n\nconst composeHandlers =\n  (handlers: Array<undefined | React.EventHandler<any>>) =>\n  (e: React.SyntheticEvent) => {\n    for (const handler of handlers) {\n      if (!handler) continue\n      if (e.defaultPrevented) return\n      handler(e)\n    }\n  }\n\nfunction getHrefOption(\n  publicHref: string,\n  external: boolean,\n  history: AnyRouter['history'],\n  disabled: boolean | undefined,\n) {\n  if (disabled) return undefined\n  // Full URL means rewrite changed the origin - treat as external-like\n  if (external) {\n    return { href: publicHref, external: true }\n  }\n  return {\n    href: history.createHref(publicHref) || '/',\n    external: false,\n  }\n}\n\nfunction isSafeInternal(to: unknown) {\n  if (typeof to !== 'string') return false\n  const zero = to.charCodeAt(0)\n  if (zero === 47) return to.charCodeAt(1) !== 47 // '/' but not '//'\n  return zero === 46 // '.', '..', './', '../'\n}\n\ntype UseLinkReactProps<TComp> = TComp extends keyof React.JSX.IntrinsicElements\n  ? React.JSX.IntrinsicElements[TComp]\n  : TComp extends React.ComponentType<any>\n    ? React.ComponentPropsWithoutRef<TComp> &\n        React.RefAttributes<React.ComponentRef<TComp>>\n    : never\n\nexport type UseLinkPropsOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n  TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  UseLinkReactProps<'a'>\n\nexport type ActiveLinkOptions<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n  LinkComponentReactProps<TComp> & {\n    [key: `data-${string}`]: unknown\n  }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n  /**\n   * A function that returns additional props for the `active` state of this link.\n   * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n   */\n  activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n  /**\n   * A function that returns additional props for the `inactive` state of this link.\n   * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n   */\n  inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  LinkPropsChildren\n\nexport interface LinkPropsChildren {\n  // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n  children?:\n    | React.ReactNode\n    | ((state: {\n        isActive: boolean\n        isTransitioning: boolean\n      }) => React.ReactNode)\n}\n\ntype LinkComponentReactProps<TComp> = Omit<\n  UseLinkReactProps<TComp>,\n  keyof CreateLinkProps\n>\n\nexport type LinkComponentProps<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = LinkComponentReactProps<TComp> &\n  LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n  any,\n  any,\n  string,\n  string,\n  string,\n  string\n>\n\nexport type LinkComponent<\n  in out TComp,\n  in out TDefaultFrom extends string = string,\n> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = TDefaultFrom,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(\n  props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => React.ReactElement\n\nexport interface LinkComponentRoute<\n  in out TDefaultFrom extends string = string,\n> {\n  defaultFrom: TDefaultFrom;\n  <\n    TRouter extends AnyRouter = RegisteredRouter,\n    const TTo extends string | undefined = undefined,\n    const TMaskTo extends string = '',\n  >(\n    props: LinkComponentProps<\n      'a',\n      TRouter,\n      this['defaultFrom'],\n      TTo,\n      this['defaultFrom'],\n      TMaskTo\n    >,\n  ): React.ReactElement\n}\n\n/**\n * Creates a typed Link-like component that preserves TanStack Router's\n * navigation semantics and type-safety while delegating rendering to the\n * provided host component.\n *\n * Useful for integrating design system anchors/buttons while keeping\n * router-aware props (eg. `to`, `params`, `search`, `preload`).\n *\n * @param Comp The host component to render (eg. a design-system Link/Button)\n * @returns A router-aware component with the same API as `Link`.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-link\n */\nexport function createLink<const TComp>(\n  Comp: Constrain<TComp, any, (props: CreateLinkProps) => ReactNode>,\n): LinkComponent<TComp> {\n  return React.forwardRef(function CreatedLink(props, ref) {\n    return <Link {...(props as any)} _asChild={Comp} ref={ref} />\n  }) as any\n}\n\n/**\n * A strongly-typed anchor component for declarative navigation.\n * Handles path, search, hash and state updates with optional route preloading\n * and active-state styling.\n *\n * Props:\n * - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)\n * - `preloadDelay`: Delay in ms before preloading on hover\n * - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive\n * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation\n * - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation\n * - `ignoreBlocker`: Bypass registered blockers\n *\n * @returns An anchor-like element that navigates without full page reloads.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent\n */\nexport const Link: LinkComponent<'a'> = React.forwardRef<Element, any>(\n  (props, ref) => {\n    const { _asChild, ...rest } = props\n    const { type: _type, ...linkProps } = useLinkProps(rest as any, ref)\n\n    const children =\n      typeof rest.children === 'function'\n        ? rest.children({\n            isActive: (linkProps as any)['data-status'] === 'active',\n          })\n        : rest.children\n\n    if (!_asChild) {\n      // the ReturnType of useLinkProps returns the correct type for a <a> element, not a general component that has a disabled prop\n      // @ts-expect-error\n      const { disabled: _, ...rest } = linkProps\n      return React.createElement('a', rest, children)\n    }\n    return React.createElement(_asChild, linkProps, children)\n  },\n) as any\n\nfunction isCtrlEvent(e: React.MouseEvent) {\n  return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n  TOptions,\n  TComp,\n  TRouter extends AnyRouter = RegisteredRouter,\n> =\n  TOptions extends ReadonlyArray<any>\n    ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n    : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n  const TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n>(\n  options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\n/**\n * Validate and reuse navigation options for `Link`, `navigate` or `redirect`.\n * Accepts a literal options object and returns it typed for later spreading.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n  return options as any\n}\n\n/**\n * Type-check a literal object for use with `Link`, `navigate` or `redirect`.\n * Use to validate and reuse navigation options across your app.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\n"
  },
  {
    "path": "packages/react-router/src/matchContext.tsx",
    "content": "import * as React from 'react'\n\nexport const matchContext = React.createContext<string | undefined>(undefined)\n\n// N.B. this only exists so we can conditionally call useContext on it when we are not interested in the nearest match\nexport const dummyMatchContext = React.createContext<string | undefined>(\n  undefined,\n)\n"
  },
  {
    "path": "packages/react-router/src/not-found.tsx",
    "content": "import * as React from 'react'\nimport { isNotFound } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useStore } from '@tanstack/react-store'\nimport { CatchBoundary } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport type { ErrorInfo } from 'react'\nimport type { NotFoundError } from '@tanstack/router-core'\n\nexport function CatchNotFound(props: {\n  fallback?: (error: NotFoundError) => React.ReactElement\n  onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n  children: React.ReactNode\n}) {\n  const router = useRouter()\n\n  if (isServer ?? router.isServer) {\n    const pathname = router.stores.location.state.pathname\n    const status = router.stores.status.state\n    const resetKey = `not-found-${pathname}-${status}`\n\n    return (\n      <CatchBoundary\n        getResetKey={() => resetKey}\n        onCatch={(error, errorInfo) => {\n          if (isNotFound(error)) {\n            props.onCatch?.(error, errorInfo)\n          } else {\n            throw error\n          }\n        }}\n        errorComponent={({ error }) => {\n          if (isNotFound(error)) {\n            return props.fallback?.(error)\n          } else {\n            throw error\n          }\n        }}\n      >\n        {props.children}\n      </CatchBoundary>\n    )\n  }\n\n  // TODO: Some way for the user to programmatically reset the not-found boundary?\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const pathname = useStore(\n    router.stores.location,\n    (location) => location.pathname,\n  )\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  const status = useStore(router.stores.status, (status) => status)\n  const resetKey = `not-found-${pathname}-${status}`\n\n  return (\n    <CatchBoundary\n      getResetKey={() => resetKey}\n      onCatch={(error, errorInfo) => {\n        if (isNotFound(error)) {\n          props.onCatch?.(error, errorInfo)\n        } else {\n          throw error\n        }\n      }}\n      errorComponent={({ error }) => {\n        if (isNotFound(error)) {\n          return props.fallback?.(error)\n        } else {\n          throw error\n        }\n      }}\n    >\n      {props.children}\n    </CatchBoundary>\n  )\n}\n\nexport function DefaultGlobalNotFound() {\n  return <p>Not Found</p>\n}\n"
  },
  {
    "path": "packages/react-router/src/renderRouteNotFound.tsx",
    "content": "import * as React from 'react'\nimport warning from 'tiny-warning'\nimport { DefaultGlobalNotFound } from './not-found'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\n/**\n * Renders a not found component for a route when no matching route is found.\n *\n * @param router - The router instance containing the route configuration\n * @param route - The route that triggered the not found state\n * @param data - Additional data to pass to the not found component\n * @returns The rendered not found component or a default fallback component\n */\nexport function renderRouteNotFound(\n  router: AnyRouter,\n  route: AnyRoute,\n  data: any,\n) {\n  if (!route.options.notFoundComponent) {\n    if (router.options.defaultNotFoundComponent) {\n      return <router.options.defaultNotFoundComponent {...data} />\n    }\n\n    if (process.env.NODE_ENV === 'development') {\n      warning(\n        route.options.notFoundComponent,\n        `A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`,\n      )\n    }\n\n    return <DefaultGlobalNotFound />\n  }\n\n  return <route.options.notFoundComponent {...data} />\n}\n"
  },
  {
    "path": "packages/react-router/src/route.tsx",
    "content": "import {\n  BaseRootRoute,\n  BaseRoute,\n  BaseRouteApi,\n  notFound,\n} from '@tanstack/router-core'\nimport React from 'react'\nimport { useLoaderData } from './useLoaderData'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { useNavigate } from './useNavigate'\nimport { useMatch } from './useMatch'\nimport { useRouteContext } from './useRouteContext'\nimport { useRouter } from './useRouter'\nimport { Link } from './link'\nimport type {\n  AnyContext,\n  AnyRoute,\n  AnyRouter,\n  ConstrainLiteral,\n  ErrorComponentProps,\n  NotFoundError,\n  NotFoundRouteProps,\n  Register,\n  RegisteredRouter,\n  ResolveFullPath,\n  ResolveId,\n  ResolveParams,\n  RootRoute as RootRouteCore,\n  RootRouteId,\n  RootRouteOptions,\n  RouteConstraints,\n  Route as RouteCore,\n  RouteIds,\n  RouteMask,\n  RouteOptions,\n  RouteTypesById,\n  RouterCore,\n  ToMaskOptions,\n  UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseSearchRoute } from './useSearch'\nimport type { UseRouteContextRoute } from './useRouteContext'\nimport type { LinkComponentRoute } from './link'\n\ndeclare module '@tanstack/router-core' {\n  export interface UpdatableRouteOptionsExtensions {\n    component?: RouteComponent\n    errorComponent?: false | null | undefined | ErrorRouteComponent\n    notFoundComponent?: NotFoundRouteComponent\n    pendingComponent?: RouteComponent\n  }\n\n  export interface RootRouteOptionsExtensions {\n    shellComponent?: ({\n      children,\n    }: {\n      children: React.ReactNode\n    }) => React.ReactNode\n  }\n\n  export interface RouteExtensions<\n    in out TId extends string,\n    in out TFullPath extends string,\n  > {\n    useMatch: UseMatchRoute<TId>\n    useRouteContext: UseRouteContextRoute<TId>\n    useSearch: UseSearchRoute<TId>\n    useParams: UseParamsRoute<TId>\n    useLoaderDeps: UseLoaderDepsRoute<TId>\n    useLoaderData: UseLoaderDataRoute<TId>\n    useNavigate: () => UseNavigateResult<TFullPath>\n    Link: LinkComponentRoute<TFullPath>\n  }\n}\n\n/**\n * Returns a route-specific API that exposes type-safe hooks pre-bound\n * to a single route ID. Useful for consuming a route's APIs from files\n * where the route object isn't directly imported (e.g. code-split files).\n *\n * @param id Route ID string literal for the target route.\n * @returns A `RouteApi` instance bound to the given route ID.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/getRouteApiFunction\n */\nexport function getRouteApi<\n  const TId,\n  TRouter extends AnyRouter = RegisteredRouter,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n  return new RouteApi<TId, TRouter>({ id })\n}\n\nexport class RouteApi<\n  TId,\n  TRouter extends AnyRouter = RegisteredRouter,\n> extends BaseRouteApi<TId, TRouter> {\n  /**\n   * @deprecated Use the `getRouteApi` function instead.\n   */\n  constructor({ id }: { id: TId }) {\n    super({ id })\n  }\n\n  useMatch: UseMatchRoute<TId> = (opts) => {\n    return useMatch({\n      select: opts?.select,\n      from: this.id,\n      structuralSharing: opts?.structuralSharing,\n    } as any) as any\n  }\n\n  useRouteContext: UseRouteContextRoute<TId> = (opts) => {\n    return useRouteContext({ ...(opts as any), from: this.id as any })\n  }\n\n  useSearch: UseSearchRoute<TId> = (opts) => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n    return useSearch({\n      select: opts?.select,\n      structuralSharing: opts?.structuralSharing,\n      from: this.id,\n    } as any) as any\n  }\n\n  useParams: UseParamsRoute<TId> = (opts) => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n    return useParams({\n      select: opts?.select,\n      structuralSharing: opts?.structuralSharing,\n      from: this.id,\n    } as any) as any\n  }\n\n  useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n    return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n  }\n\n  useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n    return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n  }\n\n  useNavigate = (): UseNavigateResult<\n    RouteTypesById<TRouter, TId>['fullPath']\n  > => {\n    const router = useRouter()\n    return useNavigate({ from: router.routesById[this.id as string].fullPath })\n  }\n\n  notFound = (opts?: NotFoundError) => {\n    return notFound({ routeId: this.id as string, ...opts })\n  }\n\n  Link: LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']> =\n    React.forwardRef((props, ref: React.ForwardedRef<HTMLAnchorElement>) => {\n      const router = useRouter()\n      const fullPath = router.routesById[this.id as string].fullPath\n      return <Link ref={ref} from={fullPath as never} {...props} />\n    }) as unknown as LinkComponentRoute<\n      RouteTypesById<TRouter, TId>['fullPath']\n    >\n}\n\nexport class Route<\n  in out TRegister = unknown,\n  in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n  in out TPath extends RouteConstraints['TPath'] = '/',\n  in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n    TParentRoute,\n    TPath\n  >,\n  in out TCustomId extends RouteConstraints['TCustomId'] = string,\n  in out TId extends RouteConstraints['TId'] = ResolveId<\n    TParentRoute,\n    TCustomId,\n    TPath\n  >,\n  in out TSearchValidator = undefined,\n  in out TParams = ResolveParams<TPath>,\n  in out TRouterContext = AnyContext,\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TLoaderDeps extends Record<string, any> = {},\n  in out TLoaderFn = undefined,\n  in out TChildren = unknown,\n  in out TFileRouteTypes = unknown,\n  in out TSSR = unknown,\n  in out TServerMiddlewares = unknown,\n  in out THandlers = undefined,\n>\n  extends BaseRoute<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TFileRouteTypes,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n  implements\n    RouteCore<\n      TRegister,\n      TParentRoute,\n      TPath,\n      TFullPath,\n      TCustomId,\n      TId,\n      TSearchValidator,\n      TParams,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TChildren,\n      TFileRouteTypes,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >\n{\n  /**\n   * @deprecated Use the `createRoute` function instead.\n   */\n  constructor(\n    options?: RouteOptions<\n      TRegister,\n      TParentRoute,\n      TId,\n      TCustomId,\n      TFullPath,\n      TPath,\n      TSearchValidator,\n      TParams,\n      TLoaderDeps,\n      TLoaderFn,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >,\n  ) {\n    super(options)\n    ;(this as any).$$typeof = Symbol.for('react.memo')\n  }\n\n  useMatch: UseMatchRoute<TId> = (opts) => {\n    return useMatch({\n      select: opts?.select,\n      from: this.id,\n      structuralSharing: opts?.structuralSharing,\n    } as any) as any\n  }\n\n  useRouteContext: UseRouteContextRoute<TId> = (opts?) => {\n    return useRouteContext({ ...(opts as any), from: this.id })\n  }\n\n  useSearch: UseSearchRoute<TId> = (opts) => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n    return useSearch({\n      select: opts?.select,\n      structuralSharing: opts?.structuralSharing,\n      from: this.id,\n    } as any) as any\n  }\n\n  useParams: UseParamsRoute<TId> = (opts) => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n    return useParams({\n      select: opts?.select,\n      structuralSharing: opts?.structuralSharing,\n      from: this.id,\n    } as any) as any\n  }\n\n  useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n    return useLoaderDeps({ ...opts, from: this.id } as any)\n  }\n\n  useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n    return useLoaderData({ ...opts, from: this.id } as any)\n  }\n\n  useNavigate = (): UseNavigateResult<TFullPath> => {\n    return useNavigate({ from: this.fullPath })\n  }\n\n  Link: LinkComponentRoute<TFullPath> = React.forwardRef(\n    (props, ref: React.ForwardedRef<HTMLAnchorElement>) => {\n      return <Link ref={ref} from={this.fullPath as never} {...props} />\n    },\n  ) as unknown as LinkComponentRoute<TFullPath>\n}\n\n/**\n * Creates a non-root Route instance for code-based routing.\n *\n * Use this to define a route that will be composed into a route tree\n * (typically via a parent route's `addChildren`). If you're using file-based\n * routing, prefer `createFileRoute`.\n *\n * @param options Route options (path, component, loader, context, etc.).\n * @returns A Route instance to be attached to the route tree.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouteFunction\n */\nexport function createRoute<\n  TRegister = unknown,\n  TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n  TPath extends RouteConstraints['TPath'] = '/',\n  TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n    TParentRoute,\n    TPath\n  >,\n  TCustomId extends RouteConstraints['TCustomId'] = string,\n  TId extends RouteConstraints['TId'] = ResolveId<\n    TParentRoute,\n    TCustomId,\n    TPath\n  >,\n  TSearchValidator = undefined,\n  TParams = ResolveParams<TPath>,\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TChildren = unknown,\n  TSSR = unknown,\n  const TServerMiddlewares = unknown,\n>(\n  options: RouteOptions<\n    TRegister,\n    TParentRoute,\n    TId,\n    TCustomId,\n    TFullPath,\n    TPath,\n    TSearchValidator,\n    TParams,\n    TLoaderDeps,\n    TLoaderFn,\n    AnyContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TSSR,\n    TServerMiddlewares\n  >,\n): Route<\n  TRegister,\n  TParentRoute,\n  TPath,\n  TFullPath,\n  TCustomId,\n  TId,\n  TSearchValidator,\n  TParams,\n  AnyContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TChildren,\n  TSSR,\n  TServerMiddlewares\n> {\n  return new Route<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    AnyContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TSSR,\n    TServerMiddlewares\n  >(\n    // TODO: Help us TypeChris, you're our only hope!\n    options as any,\n  )\n}\n\nexport type AnyRootRoute = RootRoute<\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any\n>\n\n/**\n * Creates a root route factory that requires a router context type.\n *\n * Use when your root route expects `context` to be provided to `createRouter`.\n * The returned function behaves like `createRootRoute` but enforces a context type.\n *\n * @returns A factory function to configure and return a root route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction\n */\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n  return <\n    TRegister = Register,\n    TRouteContextFn = AnyContext,\n    TBeforeLoadFn = AnyContext,\n    TSearchValidator = undefined,\n    TLoaderDeps extends Record<string, any> = {},\n    TLoaderFn = undefined,\n    TSSR = unknown,\n    TServerMiddlewares = unknown,\n  >(\n    options?: RootRouteOptions<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TSSR,\n      TServerMiddlewares\n    >,\n  ) => {\n    return createRootRoute<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TSSR,\n      TServerMiddlewares\n    >(options)\n  }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport class RootRoute<\n  in out TRegister = unknown,\n  in out TSearchValidator = undefined,\n  in out TRouterContext = {},\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TLoaderDeps extends Record<string, any> = {},\n  in out TLoaderFn = undefined,\n  in out TChildren = unknown,\n  in out TFileRouteTypes = unknown,\n  in out TSSR = unknown,\n  in out TServerMiddlewares = unknown,\n  in out THandlers = undefined,\n>\n  extends BaseRootRoute<\n    TRegister,\n    TSearchValidator,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TFileRouteTypes,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n  implements\n    RootRouteCore<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TChildren,\n      TFileRouteTypes,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >\n{\n  /**\n   * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n   */\n  constructor(\n    options?: RootRouteOptions<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >,\n  ) {\n    super(options)\n    ;(this as any).$$typeof = Symbol.for('react.memo')\n  }\n\n  useMatch: UseMatchRoute<RootRouteId> = (opts) => {\n    return useMatch({\n      select: opts?.select,\n      from: this.id,\n      structuralSharing: opts?.structuralSharing,\n    } as any) as any\n  }\n\n  useRouteContext: UseRouteContextRoute<RootRouteId> = (opts) => {\n    return useRouteContext({ ...(opts as any), from: this.id })\n  }\n\n  useSearch: UseSearchRoute<RootRouteId> = (opts) => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n    return useSearch({\n      select: opts?.select,\n      structuralSharing: opts?.structuralSharing,\n      from: this.id,\n    } as any) as any\n  }\n\n  useParams: UseParamsRoute<RootRouteId> = (opts) => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n    return useParams({\n      select: opts?.select,\n      structuralSharing: opts?.structuralSharing,\n      from: this.id,\n    } as any) as any\n  }\n\n  useLoaderDeps: UseLoaderDepsRoute<RootRouteId> = (opts) => {\n    return useLoaderDeps({ ...opts, from: this.id } as any)\n  }\n\n  useLoaderData: UseLoaderDataRoute<RootRouteId> = (opts) => {\n    return useLoaderData({ ...opts, from: this.id } as any)\n  }\n\n  useNavigate = (): UseNavigateResult<'/'> => {\n    return useNavigate({ from: this.fullPath })\n  }\n\n  Link: LinkComponentRoute<'/'> = React.forwardRef(\n    (props, ref: React.ForwardedRef<HTMLAnchorElement>) => {\n      return <Link ref={ref} from={this.fullPath} {...props} />\n    },\n  ) as unknown as LinkComponentRoute<'/'>\n}\n\n/**\n * Creates a root Route instance used to build your route tree.\n *\n * Typically paired with `createRouter({ routeTree })`. If you need to require\n * a typed router context, use `createRootRouteWithContext` instead.\n *\n * @param options Root route options (component, error, pending, etc.).\n * @returns A root route instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteFunction\n */\nexport function createRootRoute<\n  TRegister = Register,\n  TSearchValidator = undefined,\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TSSR = unknown,\n  const TServerMiddlewares = unknown,\n  THandlers = undefined,\n>(\n  options?: RootRouteOptions<\n    TRegister,\n    TSearchValidator,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >,\n): RootRoute<\n  TRegister,\n  TSearchValidator,\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  unknown,\n  unknown,\n  TSSR,\n  TServerMiddlewares,\n  THandlers\n> {\n  return new RootRoute<\n    TRegister,\n    TSearchValidator,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    unknown,\n    unknown,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >(options)\n}\n\nexport function createRouteMask<\n  TRouteTree extends AnyRoute,\n  TFrom extends string,\n  TTo extends string,\n>(\n  opts: {\n    routeTree: TRouteTree\n  } & ToMaskOptions<RouterCore<TRouteTree, 'never', boolean>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n  return opts as any\n}\n\nexport interface DefaultRouteTypes<TProps> {\n  component:\n    | ((props: TProps) => any)\n    | React.LazyExoticComponent<(props: TProps) => any>\n}\nexport interface RouteTypes<TProps> extends DefaultRouteTypes<TProps> {}\n\nexport type AsyncRouteComponent<TProps> = RouteTypes<TProps>['component'] & {\n  preload?: () => Promise<void>\n}\n\nexport type RouteComponent = AsyncRouteComponent<{}>\n\nexport type ErrorRouteComponent = AsyncRouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = RouteTypes<NotFoundRouteProps>['component']\n\nexport class NotFoundRoute<\n  TRegister,\n  TParentRoute extends AnyRootRoute,\n  TRouterContext = AnyContext,\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TSearchValidator = undefined,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TChildren = unknown,\n  TSSR = unknown,\n  TServerMiddlewares = unknown,\n> extends Route<\n  TRegister,\n  TParentRoute,\n  '/404',\n  '/404',\n  '404',\n  '404',\n  TSearchValidator,\n  {},\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TChildren,\n  TSSR,\n  TServerMiddlewares\n> {\n  constructor(\n    options: Omit<\n      RouteOptions<\n        TRegister,\n        TParentRoute,\n        string,\n        string,\n        string,\n        string,\n        TSearchValidator,\n        {},\n        TLoaderDeps,\n        TLoaderFn,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn,\n        TSSR,\n        TServerMiddlewares\n      >,\n      | 'caseSensitive'\n      | 'parseParams'\n      | 'stringifyParams'\n      | 'path'\n      | 'id'\n      | 'params'\n    >,\n  ) {\n    super({\n      ...(options as any),\n      id: '404',\n    })\n  }\n}\n"
  },
  {
    "path": "packages/react-router/src/router.ts",
    "content": "import { RouterCore } from '@tanstack/router-core'\nimport { createFileRoute, createLazyFileRoute } from './fileRoute'\nimport { getStoreFactory } from './routerStores'\nimport type { RouterHistory } from '@tanstack/history'\nimport type {\n  AnyRoute,\n  CreateRouterFn,\n  RouterConstructorOptions,\n  TrailingSlashOption,\n} from '@tanstack/router-core'\n\nimport type {\n  ErrorRouteComponent,\n  NotFoundRouteComponent,\n  RouteComponent,\n} from './route'\n\ndeclare module '@tanstack/router-core' {\n  export interface RouterOptionsExtensions {\n    /**\n     * The default `component` a route should use if no component is provided.\n     *\n     * @default Outlet\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)\n     */\n    defaultComponent?: RouteComponent\n    /**\n     * The default `errorComponent` a route should use if no error component is provided.\n     *\n     * @default ErrorComponent\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)\n     * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)\n     */\n    defaultErrorComponent?: ErrorRouteComponent\n    /**\n     * The default `pendingComponent` a route should use if no pending component is provided.\n     *\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)\n     * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)\n     */\n    defaultPendingComponent?: RouteComponent\n    /**\n     * The default `notFoundComponent` a route should use if no notFound component is provided.\n     *\n     * @default NotFound\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)\n     * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)\n     */\n    defaultNotFoundComponent?: NotFoundRouteComponent\n    /**\n     * A component that will be used to wrap the entire router.\n     *\n     * This is useful for providing a context to the entire router.\n     *\n     * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.\n     *\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)\n     */\n    Wrap?: (props: { children: any }) => React.JSX.Element\n    /**\n     * A component that will be used to wrap the inner contents of the router.\n     *\n     * 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.\n     *\n     * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.\n     *\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)\n     */\n    InnerWrap?: (props: { children: any }) => React.JSX.Element\n\n    /**\n     * The default `onCatch` handler for errors caught by the Router ErrorBoundary\n     *\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)\n     * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)\n     */\n    defaultOnCatch?: (error: Error, errorInfo: React.ErrorInfo) => void\n  }\n}\n\n/**\n * Creates a new Router instance for React.\n *\n * Pass the returned router to `RouterProvider` to enable routing.\n * Notable options: `routeTree` (your route definitions) and `context`\n * (required if the root route was created with `createRootRouteWithContext`).\n *\n * @param options Router options used to configure the router.\n * @returns A Router instance to be provided to `RouterProvider`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouterFunction\n */\nexport const createRouter: CreateRouterFn = (options) => {\n  return new Router(options)\n}\n\nexport class Router<\n  in out TRouteTree extends AnyRoute,\n  in out TTrailingSlashOption extends TrailingSlashOption = 'never',\n  in out TDefaultStructuralSharingOption extends boolean = false,\n  in out TRouterHistory extends RouterHistory = RouterHistory,\n  in out TDehydrated extends Record<string, any> = Record<string, any>,\n> extends RouterCore<\n  TRouteTree,\n  TTrailingSlashOption,\n  TDefaultStructuralSharingOption,\n  TRouterHistory,\n  TDehydrated\n> {\n  constructor(\n    options: RouterConstructorOptions<\n      TRouteTree,\n      TTrailingSlashOption,\n      TDefaultStructuralSharingOption,\n      TRouterHistory,\n      TDehydrated\n    >,\n  ) {\n    super(options, getStoreFactory)\n  }\n}\n\nif (typeof globalThis !== 'undefined') {\n  ;(globalThis as any).createFileRoute = createFileRoute\n  ;(globalThis as any).createLazyFileRoute = createLazyFileRoute\n} else if (typeof window !== 'undefined') {\n  ;(window as any).createFileRoute = createFileRoute\n  ;(window as any).createLazyFileRoute = createLazyFileRoute\n}\n"
  },
  {
    "path": "packages/react-router/src/routerContext.tsx",
    "content": "import * as React from 'react'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport const routerContext = React.createContext<AnyRouter>(null!)\n"
  },
  {
    "path": "packages/react-router/src/routerStores.ts",
    "content": "import { batch, createStore } from '@tanstack/react-store'\nimport {\n  createNonReactiveMutableStore,\n  createNonReactiveReadonlyStore,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport type { Readable } from '@tanstack/react-store'\nimport type { GetStoreConfig } from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n  export interface RouterReadableStore<TValue> extends Readable<TValue> {}\n}\nexport const getStoreFactory: GetStoreConfig = (opts) => {\n  if (isServer ?? opts.isServer) {\n    return {\n      createMutableStore: createNonReactiveMutableStore,\n      createReadonlyStore: createNonReactiveReadonlyStore,\n      batch: (fn) => fn(),\n    }\n  }\n  return {\n    createMutableStore: createStore,\n    createReadonlyStore: createStore,\n    batch: batch,\n  }\n}\n"
  },
  {
    "path": "packages/react-router/src/scroll-restoration.tsx",
    "content": "import {\n  defaultGetScrollRestorationKey,\n  escapeHtml,\n  restoreScroll,\n  storageKey,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport { ScriptOnce } from './ScriptOnce'\n\nexport function ScrollRestoration() {\n  const router = useRouter()\n  if (!router.isScrollRestoring || !(isServer ?? router.isServer)) {\n    return null\n  }\n  if (typeof router.options.scrollRestoration === 'function') {\n    const shouldRestore = router.options.scrollRestoration({\n      location: router.latestLocation,\n    })\n    if (!shouldRestore) {\n      return null\n    }\n  }\n  const getKey =\n    router.options.getScrollRestorationKey || defaultGetScrollRestorationKey\n  const userKey = getKey(router.latestLocation)\n  const resolvedKey =\n    userKey !== defaultGetScrollRestorationKey(router.latestLocation)\n      ? userKey\n      : undefined\n\n  const restoreScrollOptions: Parameters<typeof restoreScroll>[0] = {\n    storageKey,\n    shouldScrollRestoration: true,\n  }\n  if (resolvedKey) {\n    restoreScrollOptions.key = resolvedKey\n  }\n\n  return (\n    <ScriptOnce\n      children={`(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})`}\n    />\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/ssr/RouterClient.tsx",
    "content": "import { hydrate } from '@tanstack/router-core/ssr/client'\nimport { Await } from '../awaited'\nimport { RouterProvider } from '../RouterProvider'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nlet hydrationPromise: Promise<void | Array<Array<void>>> | undefined\n\nexport function RouterClient(props: { router: AnyRouter }) {\n  if (!hydrationPromise) {\n    if (!props.router.stores.matchesId.state.length) {\n      hydrationPromise = hydrate(props.router)\n    } else {\n      hydrationPromise = Promise.resolve()\n    }\n  }\n  return (\n    <Await\n      promise={hydrationPromise}\n      children={() => <RouterProvider router={props.router} />}\n    />\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/ssr/RouterServer.tsx",
    "content": "import * as React from 'react'\nimport { RouterProvider } from '../RouterProvider'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport function RouterServer<TRouter extends AnyRouter>(props: {\n  router: TRouter\n}) {\n  return <RouterProvider router={props.router} />\n}\n"
  },
  {
    "path": "packages/react-router/src/ssr/client.ts",
    "content": "export { RouterClient } from './RouterClient'\nexport * from '@tanstack/router-core/ssr/client'\n"
  },
  {
    "path": "packages/react-router/src/ssr/defaultRenderHandler.tsx",
    "content": "import { defineHandlerCallback } from '@tanstack/router-core/ssr/server'\nimport { renderRouterToString } from './renderRouterToString'\nimport { RouterServer } from './RouterServer'\n\nexport const defaultRenderHandler = defineHandlerCallback(\n  ({ router, responseHeaders }) =>\n    renderRouterToString({\n      router,\n      responseHeaders,\n      children: <RouterServer router={router} />,\n    }),\n)\n"
  },
  {
    "path": "packages/react-router/src/ssr/defaultStreamHandler.tsx",
    "content": "import { defineHandlerCallback } from '@tanstack/router-core/ssr/server'\nimport { RouterServer } from './RouterServer'\nimport { renderRouterToStream } from './renderRouterToStream'\n\nexport const defaultStreamHandler = defineHandlerCallback(\n  ({ request, router, responseHeaders }) =>\n    renderRouterToStream({\n      request,\n      router,\n      responseHeaders,\n      children: <RouterServer router={router} />,\n    }),\n)\n"
  },
  {
    "path": "packages/react-router/src/ssr/renderRouterToStream.tsx",
    "content": "import { PassThrough } from 'node:stream'\nimport ReactDOMServer from 'react-dom/server'\nimport { isbot } from 'isbot'\nimport {\n  transformPipeableStreamWithRouter,\n  transformReadableStreamWithRouter,\n} from '@tanstack/router-core/ssr/server'\nimport type { AnyRouter } from '@tanstack/router-core'\nimport type { ReadableStream } from 'node:stream/web'\nimport type { ReactNode } from 'react'\n\nexport const renderRouterToStream = async ({\n  request,\n  router,\n  responseHeaders,\n  children,\n}: {\n  request: Request\n  router: AnyRouter\n  responseHeaders: Headers\n  children: ReactNode\n}) => {\n  if (typeof ReactDOMServer.renderToReadableStream === 'function') {\n    const stream = await ReactDOMServer.renderToReadableStream(children, {\n      signal: request.signal,\n      nonce: router.options.ssr?.nonce,\n      progressiveChunkSize: Number.POSITIVE_INFINITY,\n    })\n\n    if (isbot(request.headers.get('User-Agent'))) {\n      await stream.allReady\n    }\n\n    const responseStream = transformReadableStreamWithRouter(\n      router,\n      stream as unknown as ReadableStream,\n    )\n    return new Response(responseStream as any, {\n      status: router.stores.statusCode.state,\n      headers: responseHeaders,\n    })\n  }\n\n  if (typeof ReactDOMServer.renderToPipeableStream === 'function') {\n    const reactAppPassthrough = new PassThrough()\n\n    try {\n      const pipeable = ReactDOMServer.renderToPipeableStream(children, {\n        nonce: router.options.ssr?.nonce,\n        progressiveChunkSize: Number.POSITIVE_INFINITY,\n        ...(isbot(request.headers.get('User-Agent'))\n          ? {\n              onAllReady() {\n                pipeable.pipe(reactAppPassthrough)\n              },\n            }\n          : {\n              onShellReady() {\n                pipeable.pipe(reactAppPassthrough)\n              },\n            }),\n        onError: (error, info) => {\n          console.error('Error in renderToPipeableStream:', error, info)\n          // Destroy the passthrough stream on error\n          if (!reactAppPassthrough.destroyed) {\n            reactAppPassthrough.destroy(\n              error instanceof Error ? error : new Error(String(error)),\n            )\n          }\n        },\n      })\n    } catch (e) {\n      console.error('Error in renderToPipeableStream:', e)\n      reactAppPassthrough.destroy(e instanceof Error ? e : new Error(String(e)))\n    }\n\n    const responseStream = transformPipeableStreamWithRouter(\n      router,\n      reactAppPassthrough,\n    )\n    return new Response(responseStream as any, {\n      status: router.stores.statusCode.state,\n      headers: responseHeaders,\n    })\n  }\n\n  throw new Error(\n    'No renderToReadableStream or renderToPipeableStream found in react-dom/server. Ensure you are using a version of react-dom that supports streaming.',\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/ssr/renderRouterToString.tsx",
    "content": "import ReactDOMServer from 'react-dom/server'\nimport type { ReactNode } from 'react'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport const renderRouterToString = async ({\n  router,\n  responseHeaders,\n  children,\n}: {\n  router: AnyRouter\n  responseHeaders: Headers\n  children: ReactNode\n}) => {\n  try {\n    let html = ReactDOMServer.renderToString(children)\n    router.serverSsr!.setRenderFinished()\n\n    const injectedHtml = router.serverSsr!.takeBufferedHtml()\n    if (injectedHtml) {\n      html = html.replace(`</body>`, () => `${injectedHtml}</body>`)\n    }\n\n    return new Response(`<!DOCTYPE html>${html}`, {\n      status: router.stores.statusCode.state,\n      headers: responseHeaders,\n    })\n  } catch (error) {\n    console.error('Render to string error:', error)\n    return new Response('Internal Server Error', {\n      status: 500,\n      headers: responseHeaders,\n    })\n  } finally {\n    router.serverSsr?.cleanup()\n  }\n}\n"
  },
  {
    "path": "packages/react-router/src/ssr/serializer.ts",
    "content": "import type * as React from 'react'\n\ndeclare module '@tanstack/router-core' {\n  export interface SerializerExtensions {\n    ReadableStream: React.JSX.Element\n  }\n}\n"
  },
  {
    "path": "packages/react-router/src/ssr/server.ts",
    "content": "export { RouterServer } from './RouterServer'\nexport { defaultRenderHandler } from './defaultRenderHandler'\nexport { defaultStreamHandler } from './defaultStreamHandler'\nexport { renderRouterToStream } from './renderRouterToStream'\nexport { renderRouterToString } from './renderRouterToString'\nexport * from '@tanstack/router-core/ssr/server'\n"
  },
  {
    "path": "packages/react-router/src/structuralSharing.ts",
    "content": "import type {\n  AnyRouter,\n  Constrain,\n  OptionalStructuralSharing,\n  ValidateJSON,\n} from '@tanstack/router-core'\n\nexport type DefaultStructuralSharingEnabled<TRouter extends AnyRouter> =\n  boolean extends TRouter['options']['defaultStructuralSharing']\n    ? // for now, default to false.\n      // TODO in V2: default to true\n      false\n    : NonNullable<TRouter['options']['defaultStructuralSharing']>\n\nexport interface RequiredStructuralSharing<TStructuralSharing, TConstraint> {\n  readonly structuralSharing: Constrain<TStructuralSharing, TConstraint>\n}\n\nexport type StructuralSharingOption<\n  TRouter extends AnyRouter,\n  TSelected,\n  TStructuralSharing,\n> = unknown extends TSelected\n  ? OptionalStructuralSharing<TStructuralSharing, boolean>\n  : unknown extends TRouter['routeTree']\n    ? OptionalStructuralSharing<TStructuralSharing, boolean>\n    : TSelected extends ValidateJSON<TSelected>\n      ? OptionalStructuralSharing<TStructuralSharing, boolean>\n      : DefaultStructuralSharingEnabled<TRouter> extends true\n        ? RequiredStructuralSharing<TStructuralSharing, false>\n        : OptionalStructuralSharing<TStructuralSharing, false>\n\nexport type StructuralSharingEnabled<\n  TRouter extends AnyRouter,\n  TStructuralSharing,\n> = boolean extends TStructuralSharing\n  ? DefaultStructuralSharingEnabled<TRouter>\n  : TStructuralSharing\n\nexport type ValidateSelected<\n  TRouter extends AnyRouter,\n  TSelected,\n  TStructuralSharing,\n> =\n  StructuralSharingEnabled<TRouter, TStructuralSharing> extends true\n    ? ValidateJSON<TSelected>\n    : TSelected\n"
  },
  {
    "path": "packages/react-router/src/typePrimitives.ts",
    "content": "import type {\n  AnyRouter,\n  Constrain,\n  InferFrom,\n  InferMaskFrom,\n  InferMaskTo,\n  InferSelected,\n  InferShouldThrow,\n  InferStrict,\n  InferTo,\n  RegisteredRouter,\n} from '@tanstack/router-core'\nimport type { LinkComponentProps } from './link'\nimport type { UseParamsOptions } from './useParams'\nimport type { UseSearchOptions } from './useSearch'\n\nexport type ValidateLinkOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TOptions = unknown,\n  TDefaultFrom extends string = string,\n  TComp = 'a',\n> = Constrain<\n  TOptions,\n  LinkComponentProps<\n    TComp,\n    TRouter,\n    InferFrom<TOptions, TDefaultFrom>,\n    InferTo<TOptions>,\n    InferMaskFrom<TOptions>,\n    InferMaskTo<TOptions>\n  >\n>\n\n/**\n * @private\n */\nexport type InferStructuralSharing<TOptions> = TOptions extends {\n  structuralSharing: infer TStructuralSharing\n}\n  ? TStructuralSharing\n  : unknown\n\nexport type ValidateUseSearchOptions<\n  TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n> = Constrain<\n  TOptions,\n  UseSearchOptions<\n    TRouter,\n    InferFrom<TOptions>,\n    InferStrict<TOptions>,\n    InferShouldThrow<TOptions>,\n    InferSelected<TOptions>,\n    InferStructuralSharing<TOptions>\n  >\n>\n\nexport type ValidateUseParamsOptions<\n  TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n> = Constrain<\n  TOptions,\n  UseParamsOptions<\n    TRouter,\n    InferFrom<TOptions>,\n    InferStrict<TOptions>,\n    InferShouldThrow<TOptions>,\n    InferSelected<TOptions>,\n    InferSelected<TOptions>\n  >\n>\nexport type ValidateLinkOptionsArray<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,\n  TDefaultFrom extends string = string,\n  TComp = 'a',\n> = {\n  [K in keyof TOptions]: ValidateLinkOptions<\n    TRouter,\n    TOptions[K],\n    TDefaultFrom,\n    TComp\n  >\n}\n"
  },
  {
    "path": "packages/react-router/src/useBlocker.tsx",
    "content": "import * as React from 'react'\nimport { useRouter } from './useRouter'\nimport type {\n  BlockerFnArgs,\n  HistoryAction,\n  HistoryLocation,\n} from '@tanstack/history'\nimport type {\n  AnyRoute,\n  AnyRouter,\n  ParseRoute,\n  RegisteredRouter,\n} from '@tanstack/router-core'\n\ninterface ShouldBlockFnLocation<\n  out TRouteId,\n  out TFullPath,\n  out TAllParams,\n  out TFullSearchSchema,\n> {\n  routeId: TRouteId\n  fullPath: TFullPath\n  pathname: string\n  params: TAllParams\n  search: TFullSearchSchema\n}\n\ntype AnyShouldBlockFnLocation = ShouldBlockFnLocation<any, any, any, any>\ntype MakeShouldBlockFnLocationUnion<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n  ? ShouldBlockFnLocation<\n      TRoute['id'],\n      TRoute['fullPath'],\n      TRoute['types']['allParams'],\n      TRoute['types']['fullSearchSchema']\n    >\n  : never\n\ntype BlockerResolver<TRouter extends AnyRouter = RegisteredRouter> =\n  | {\n      status: 'blocked'\n      current: MakeShouldBlockFnLocationUnion<TRouter>\n      next: MakeShouldBlockFnLocationUnion<TRouter>\n      action: HistoryAction\n      proceed: () => void\n      reset: () => void\n    }\n  | {\n      status: 'idle'\n      current: undefined\n      next: undefined\n      action: undefined\n      proceed: undefined\n      reset: undefined\n    }\n\ntype ShouldBlockFnArgs<TRouter extends AnyRouter = RegisteredRouter> = {\n  current: MakeShouldBlockFnLocationUnion<TRouter>\n  next: MakeShouldBlockFnLocationUnion<TRouter>\n  action: HistoryAction\n}\n\nexport type ShouldBlockFn<TRouter extends AnyRouter = RegisteredRouter> = (\n  args: ShouldBlockFnArgs<TRouter>,\n) => boolean | Promise<boolean>\nexport type UseBlockerOpts<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TWithResolver extends boolean = boolean,\n> = {\n  shouldBlockFn: ShouldBlockFn<TRouter>\n  enableBeforeUnload?: boolean | (() => boolean)\n  disabled?: boolean\n  withResolver?: TWithResolver\n}\n\ntype LegacyBlockerFn = () => Promise<any> | any\ntype LegacyBlockerOpts = {\n  blockerFn?: LegacyBlockerFn\n  condition?: boolean | any\n}\n\nfunction _resolveBlockerOpts(\n  opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,\n  condition?: boolean | any,\n): UseBlockerOpts {\n  if (opts === undefined) {\n    return {\n      shouldBlockFn: () => true,\n      withResolver: false,\n    }\n  }\n\n  if ('shouldBlockFn' in opts) {\n    return opts\n  }\n\n  if (typeof opts === 'function') {\n    const shouldBlock = Boolean(condition ?? true)\n\n    const _customBlockerFn = async () => {\n      if (shouldBlock) return await opts()\n      return false\n    }\n\n    return {\n      shouldBlockFn: _customBlockerFn,\n      enableBeforeUnload: shouldBlock,\n      withResolver: false,\n    }\n  }\n\n  const shouldBlock = Boolean(opts.condition ?? true)\n  const fn = opts.blockerFn\n\n  const _customBlockerFn = async () => {\n    if (shouldBlock && fn !== undefined) {\n      return await fn()\n    }\n    return shouldBlock\n  }\n\n  return {\n    shouldBlockFn: _customBlockerFn,\n    enableBeforeUnload: shouldBlock,\n    withResolver: fn === undefined,\n  }\n}\n\nexport function useBlocker<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TWithResolver extends boolean = false,\n>(\n  opts: UseBlockerOpts<TRouter, TWithResolver>,\n): TWithResolver extends true ? BlockerResolver<TRouter> : void\n\n/**\n * @deprecated Use the shouldBlockFn property instead\n */\nexport function useBlocker(blockerFnOrOpts?: LegacyBlockerOpts): BlockerResolver\n\n/**\n * @deprecated Use the UseBlockerOpts object syntax instead\n */\nexport function useBlocker(\n  blockerFn?: LegacyBlockerFn,\n  condition?: boolean | any,\n): BlockerResolver\n\nexport function useBlocker(\n  opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,\n  condition?: boolean | any,\n): BlockerResolver | void {\n  const {\n    shouldBlockFn,\n    enableBeforeUnload = true,\n    disabled = false,\n    withResolver = false,\n  } = _resolveBlockerOpts(opts, condition)\n\n  const router = useRouter()\n  const { history } = router\n\n  const [resolver, setResolver] = React.useState<BlockerResolver>({\n    status: 'idle',\n    current: undefined,\n    next: undefined,\n    action: undefined,\n    proceed: undefined,\n    reset: undefined,\n  })\n\n  React.useEffect(() => {\n    const blockerFnComposed = async (blockerFnArgs: BlockerFnArgs) => {\n      function getLocation(\n        location: HistoryLocation,\n      ): AnyShouldBlockFnLocation {\n        const parsedLocation = router.parseLocation(location)\n        const matchedRoutes = router.getMatchedRoutes(parsedLocation.pathname)\n        if (matchedRoutes.foundRoute === undefined) {\n          return {\n            routeId: '__notFound__',\n            fullPath: parsedLocation.pathname,\n            pathname: parsedLocation.pathname,\n            params: matchedRoutes.routeParams,\n            search: router.options.parseSearch(location.search),\n          }\n        }\n\n        return {\n          routeId: matchedRoutes.foundRoute.id,\n          fullPath: matchedRoutes.foundRoute.fullPath,\n          pathname: parsedLocation.pathname,\n          params: matchedRoutes.routeParams,\n          search: router.options.parseSearch(location.search),\n        }\n      }\n\n      const current = getLocation(blockerFnArgs.currentLocation)\n      const next = getLocation(blockerFnArgs.nextLocation)\n\n      if (\n        current.routeId === '__notFound__' &&\n        next.routeId !== '__notFound__'\n      ) {\n        return false\n      }\n\n      const shouldBlock = await shouldBlockFn({\n        action: blockerFnArgs.action,\n        current,\n        next,\n      })\n      if (!withResolver) {\n        return shouldBlock\n      }\n\n      if (!shouldBlock) {\n        return false\n      }\n\n      const promise = new Promise<boolean>((resolve) => {\n        setResolver({\n          status: 'blocked',\n          current,\n          next,\n          action: blockerFnArgs.action,\n          proceed: () => resolve(false),\n          reset: () => resolve(true),\n        })\n      })\n\n      const canNavigateAsync = await promise\n      setResolver({\n        status: 'idle',\n        current: undefined,\n        next: undefined,\n        action: undefined,\n        proceed: undefined,\n        reset: undefined,\n      })\n\n      return canNavigateAsync\n    }\n\n    return disabled\n      ? undefined\n      : history.block({ blockerFn: blockerFnComposed, enableBeforeUnload })\n  }, [\n    shouldBlockFn,\n    enableBeforeUnload,\n    disabled,\n    withResolver,\n    history,\n    router,\n  ])\n\n  return resolver\n}\n\nconst _resolvePromptBlockerArgs = (\n  props: PromptProps | LegacyPromptProps,\n): UseBlockerOpts => {\n  if ('shouldBlockFn' in props) {\n    return { ...props }\n  }\n\n  const shouldBlock = Boolean(props.condition ?? true)\n  const fn = props.blockerFn\n\n  const _customBlockerFn = async () => {\n    if (shouldBlock && fn !== undefined) {\n      return await fn()\n    }\n    return shouldBlock\n  }\n\n  return {\n    shouldBlockFn: _customBlockerFn,\n    enableBeforeUnload: shouldBlock,\n    withResolver: fn === undefined,\n  }\n}\n\nexport function Block<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TWithResolver extends boolean = boolean,\n>(opts: PromptProps<TRouter, TWithResolver>): React.ReactNode\n\n/**\n *  @deprecated Use the UseBlockerOpts property instead\n */\nexport function Block(opts: LegacyPromptProps): React.ReactNode\n\nexport function Block(opts: PromptProps | LegacyPromptProps): React.ReactNode {\n  const { children, ...rest } = opts\n  const args = _resolvePromptBlockerArgs(rest)\n\n  const resolver = useBlocker(args)\n  return children\n    ? typeof children === 'function'\n      ? children(resolver as any)\n      : children\n    : null\n}\n\ntype LegacyPromptProps = {\n  blockerFn?: LegacyBlockerFn\n  condition?: boolean | any\n  children?: React.ReactNode | ((params: BlockerResolver) => React.ReactNode)\n}\n\ntype PromptProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TWithResolver extends boolean = boolean,\n  TParams = TWithResolver extends true ? BlockerResolver<TRouter> : void,\n> = UseBlockerOpts<TRouter, TWithResolver> & {\n  children?: React.ReactNode | ((params: TParams) => React.ReactNode)\n}\n"
  },
  {
    "path": "packages/react-router/src/useCanGoBack.ts",
    "content": "import { useStore } from '@tanstack/react-store'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nexport function useCanGoBack() {\n  const router = useRouter()\n\n  if (isServer ?? router.isServer) {\n    return router.stores.location.state.state.__TSR_index !== 0\n  }\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  return useStore(\n    router.stores.location,\n    (location) => location.state.__TSR_index !== 0,\n  )\n}\n"
  },
  {
    "path": "packages/react-router/src/useLoaderData.tsx",
    "content": "import { useMatch } from './useMatch'\nimport type {\n  StructuralSharingOption,\n  ValidateSelected,\n} from './structuralSharing'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  ResolveUseLoaderData,\n  StrictOrFrom,\n  UseLoaderDataResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDataBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n  TStructuralSharing,\n> {\n  select?: (\n    match: ResolveUseLoaderData<TRouter, TFrom, TStrict>,\n  ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLoaderDataOptions<\n  TRouter extends AnyRouter,\n  TFrom extends string | undefined,\n  TStrict extends boolean,\n  TSelected,\n  TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n  UseLoaderDataBaseOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    TSelected,\n    TStructuralSharing\n  > &\n  StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseLoaderDataRoute<out TId> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseLoaderDataBaseOptions<\n    TRouter,\n    TId,\n    true,\n    TSelected,\n    TStructuralSharing\n  > &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseLoaderDataResult<TRouter, TId, true, TSelected>\n\n/**\n * Read and select the current route's loader data with type‑safety.\n *\n * Options:\n * - `from`/`strict`: Choose which route's data to read and strictness\n * - `select`: Map the loader data to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The loader data (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook\n */\nexport function useLoaderData<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts: UseLoaderDataOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    TSelected,\n    TStructuralSharing\n  >,\n): UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected> {\n  return useMatch({\n    from: opts.from!,\n    strict: opts.strict,\n    structuralSharing: opts.structuralSharing,\n    select: (s: any) => {\n      return opts.select ? opts.select(s.loaderData) : s.loaderData\n    },\n  } as any) as UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>\n}\n"
  },
  {
    "path": "packages/react-router/src/useLoaderDeps.tsx",
    "content": "import { useMatch } from './useMatch'\nimport type {\n  StructuralSharingOption,\n  ValidateSelected,\n} from './structuralSharing'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  ResolveUseLoaderDeps,\n  StrictOrFrom,\n  UseLoaderDepsResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDepsBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TSelected,\n  TStructuralSharing,\n> {\n  select?: (\n    deps: ResolveUseLoaderDeps<TRouter, TFrom>,\n  ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLoaderDepsOptions<\n  TRouter extends AnyRouter,\n  TFrom extends string | undefined,\n  TSelected,\n  TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom> &\n  UseLoaderDepsBaseOptions<TRouter, TFrom, TSelected, TStructuralSharing> &\n  StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseLoaderDepsRoute<out TId> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseLoaderDepsBaseOptions<TRouter, TId, TSelected, TStructuralSharing> &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseLoaderDepsResult<TRouter, TId, TSelected>\n\n/**\n * Read and select the current route's loader dependencies object.\n *\n * Options:\n * - `from`: Choose which route's loader deps to read\n * - `select`: Map the deps to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The loader deps (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDepsHook\n */\nexport function useLoaderDeps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts: UseLoaderDepsOptions<TRouter, TFrom, TSelected, TStructuralSharing>,\n): UseLoaderDepsResult<TRouter, TFrom, TSelected> {\n  const { select, ...rest } = opts\n  return useMatch({\n    ...rest,\n    select: (s) => {\n      return select ? select(s.loaderDeps) : s.loaderDeps\n    },\n  }) as UseLoaderDepsResult<TRouter, TFrom, TSelected>\n}\n"
  },
  {
    "path": "packages/react-router/src/useLocation.tsx",
    "content": "import { useStore } from '@tanstack/react-store'\nimport { useRef } from 'react'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type {\n  StructuralSharingOption,\n  ValidateSelected,\n} from './structuralSharing'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  RouterState,\n} from '@tanstack/router-core'\n\nexport interface UseLocationBaseOptions<\n  TRouter extends AnyRouter,\n  TSelected,\n  TStructuralSharing extends boolean = boolean,\n> {\n  select?: (\n    state: RouterState<TRouter['routeTree']>['location'],\n  ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLocationResult<\n  TRouter extends AnyRouter,\n  TSelected,\n> = unknown extends TSelected\n  ? RouterState<TRouter['routeTree']>['location']\n  : TSelected\n\n/**\n * Read the current location from the router state with optional selection.\n * Useful for subscribing to just the pieces of location you care about.\n *\n * Options:\n * - `select`: Project the `location` object to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The current location (or selected value).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLocationHook\n */\nexport function useLocation<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseLocationBaseOptions<TRouter, TSelected, TStructuralSharing> &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n): UseLocationResult<TRouter, TSelected> {\n  const router = useRouter<TRouter>()\n\n  if (isServer ?? router.isServer) {\n    const location = router.stores.location.state\n    return (\n      opts?.select ? opts.select(location as any) : location\n    ) as UseLocationResult<TRouter, TSelected>\n  }\n\n  const previousResult =\n    // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n    useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(undefined)\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  return useStore(router.stores.location, (location) => {\n    const selected = (\n      opts?.select ? opts.select(location as any) : location\n    ) as ValidateSelected<TRouter, TSelected, TStructuralSharing>\n\n    if (opts?.structuralSharing ?? router.options.defaultStructuralSharing) {\n      const shared = replaceEqualDeep(previousResult.current, selected)\n      previousResult.current = shared\n      return shared\n    }\n\n    return selected\n  }) as UseLocationResult<TRouter, TSelected>\n}\n"
  },
  {
    "path": "packages/react-router/src/useMatch.tsx",
    "content": "import * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport invariant from 'tiny-invariant'\nimport { dummyMatchContext, matchContext } from './matchContext'\nimport { useRouter } from './useRouter'\nimport type {\n  StructuralSharingOption,\n  ValidateSelected,\n} from './structuralSharing'\nimport type {\n  AnyRouter,\n  MakeRouteMatch,\n  MakeRouteMatchUnion,\n  RegisteredRouter,\n  StrictOrFrom,\n  ThrowConstraint,\n  ThrowOrOptional,\n} from '@tanstack/router-core'\n\nconst dummyStore = {\n  state: undefined,\n  get: () => undefined,\n  subscribe: () => () => {},\n} as any\n\nexport interface UseMatchBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n  TStructuralSharing extends boolean,\n> {\n  select?: (\n    match: MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>,\n  ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n  shouldThrow?: TThrow\n}\n\nexport type UseMatchRoute<out TFrom> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseMatchBaseOptions<\n    TRouter,\n    TFrom,\n    true,\n    true,\n    TSelected,\n    TStructuralSharing\n  > &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseMatchResult<TRouter, TFrom, true, TSelected>\n\nexport type UseMatchOptions<\n  TRouter extends AnyRouter,\n  TFrom extends string | undefined,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n  TStructuralSharing extends boolean,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n  UseMatchBaseOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    TThrow,\n    TSelected,\n    TStructuralSharing\n  > &\n  StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseMatchResult<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n> = unknown extends TSelected\n  ? TStrict extends true\n    ? MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>\n    : MakeRouteMatchUnion<TRouter>\n  : TSelected\n\n/**\n * Read and select the nearest or targeted route match.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useMatchHook\n */\nexport function useMatch<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TThrow extends boolean = true,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts: UseMatchOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    ThrowConstraint<TStrict, TThrow>,\n    TSelected,\n    TStructuralSharing\n  >,\n): ThrowOrOptional<UseMatchResult<TRouter, TFrom, TStrict, TSelected>, TThrow> {\n  const router = useRouter<TRouter>()\n  const nearestMatchId = React.useContext(\n    opts.from ? dummyMatchContext : matchContext,\n  )\n\n  const key = opts.from ?? nearestMatchId\n  const matchStore = key\n    ? opts.from\n      ? router.stores.getMatchStoreByRouteId(key)\n      : router.stores.activeMatchStoresById.get(key)\n    : undefined\n\n  if (isServer ?? router.isServer) {\n    const match = matchStore?.state\n    invariant(\n      !((opts.shouldThrow ?? true) && !match),\n      `Could not find ${opts.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'}`,\n    )\n\n    if (match === undefined) {\n      return undefined as any\n    }\n\n    return (opts.select ? opts.select(match as any) : match) as any\n  }\n\n  const previousResult =\n    // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n    React.useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(\n      undefined,\n    )\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static\n  return useStore(matchStore ?? dummyStore, (match) => {\n    invariant(\n      !((opts.shouldThrow ?? true) && !match),\n      `Could not find ${opts.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'}`,\n    )\n\n    if (match === undefined) {\n      return undefined\n    }\n\n    const selected = (\n      opts.select ? opts.select(match as any) : match\n    ) as ValidateSelected<TRouter, TSelected, TStructuralSharing>\n\n    if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {\n      const shared = replaceEqualDeep(previousResult.current, selected)\n      previousResult.current = shared\n      return shared\n    }\n\n    return selected\n  }) as any\n}\n"
  },
  {
    "path": "packages/react-router/src/useNavigate.tsx",
    "content": "import * as React from 'react'\nimport { useLayoutEffect } from './utils'\nimport { useRouter } from './useRouter'\nimport type {\n  AnyRouter,\n  FromPathOption,\n  NavigateOptions,\n  RegisteredRouter,\n  UseNavigateResult,\n} from '@tanstack/router-core'\n\n/**\n * Imperative navigation hook.\n *\n * Returns a stable `navigate(options)` function to change the current location\n * programmatically. Prefer the `Link` component for user-initiated navigation,\n * and use this hook from effects, callbacks, or handlers where imperative\n * navigation is required.\n *\n * Options:\n * - `from`: Optional route base used to resolve relative `to` paths.\n *\n * @returns A function that accepts `NavigateOptions`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useNavigateHook\n */\nexport function useNavigate<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDefaultFrom extends string = string,\n>(_defaultOpts?: {\n  from?: FromPathOption<TRouter, TDefaultFrom>\n}): UseNavigateResult<TDefaultFrom> {\n  const router = useRouter()\n\n  return React.useCallback(\n    (options: NavigateOptions) => {\n      return router.navigate({\n        ...options,\n        from: options.from ?? _defaultOpts?.from,\n      })\n    },\n    [_defaultOpts?.from, router],\n  ) as UseNavigateResult<TDefaultFrom>\n}\n\n/**\n * Component that triggers a navigation when rendered. Navigation executes\n * in an effect after mount/update.\n *\n * Props are the same as `NavigateOptions` used by `navigate()`.\n *\n * @returns null\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/navigateComponent\n */\nexport function Navigate<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = string,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(props: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): null {\n  const router = useRouter()\n  const navigate = useNavigate()\n\n  const previousPropsRef = React.useRef<NavigateOptions<\n    TRouter,\n    TFrom,\n    TTo,\n    TMaskFrom,\n    TMaskTo\n  > | null>(null)\n  useLayoutEffect(() => {\n    if (previousPropsRef.current !== props) {\n      navigate(props)\n      previousPropsRef.current = props\n    }\n  }, [router, props, navigate])\n  return null\n}\n"
  },
  {
    "path": "packages/react-router/src/useParams.tsx",
    "content": "import { useMatch } from './useMatch'\nimport type {\n  StructuralSharingOption,\n  ValidateSelected,\n} from './structuralSharing'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  ResolveUseParams,\n  StrictOrFrom,\n  ThrowConstraint,\n  ThrowOrOptional,\n  UseParamsResult,\n} from '@tanstack/router-core'\n\nexport interface UseParamsBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n  TStructuralSharing,\n> {\n  select?: (\n    params: ResolveUseParams<TRouter, TFrom, TStrict>,\n  ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n  shouldThrow?: TThrow\n}\n\nexport type UseParamsOptions<\n  TRouter extends AnyRouter,\n  TFrom extends string | undefined,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n  TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n  UseParamsBaseOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    TThrow,\n    TSelected,\n    TStructuralSharing\n  > &\n  StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseParamsRoute<out TFrom> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseParamsBaseOptions<\n    TRouter,\n    TFrom,\n    /* TStrict */ true,\n    /* TThrow */ true,\n    TSelected,\n    TStructuralSharing\n  > &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseParamsResult<TRouter, TFrom, true, TSelected>\n\n/**\n * Access the current route's path parameters with type-safety.\n *\n * Options:\n * - `from`/`strict`: Specify the matched route and whether to enforce strict typing\n * - `select`: Project the params object to a derived value for memoized renders\n * - `structuralSharing`: Enable structural sharing for stable references\n * - `shouldThrow`: Throw if the route is not found in strict contexts\n *\n * @returns The params object (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useParamsHook\n */\nexport function useParams<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TThrow extends boolean = true,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts: UseParamsOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    ThrowConstraint<TStrict, TThrow>,\n    TSelected,\n    TStructuralSharing\n  >,\n): ThrowOrOptional<\n  UseParamsResult<TRouter, TFrom, TStrict, TSelected>,\n  TThrow\n> {\n  return useMatch({\n    from: opts.from!,\n    shouldThrow: opts.shouldThrow,\n    structuralSharing: opts.structuralSharing,\n    strict: opts.strict,\n    select: (match) => {\n      const params = opts.strict === false ? match.params : match._strictParams\n\n      return opts.select ? opts.select(params) : params\n    },\n  }) as any\n}\n"
  },
  {
    "path": "packages/react-router/src/useRouteContext.ts",
    "content": "import { useMatch } from './useMatch'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  UseRouteContextBaseOptions,\n  UseRouteContextOptions,\n  UseRouteContextResult,\n} from '@tanstack/router-core'\n\nexport type UseRouteContextRoute<out TFrom> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseRouteContextBaseOptions<TRouter, TFrom, true, TSelected>,\n) => UseRouteContextResult<TRouter, TFrom, true, TSelected>\n\nexport function useRouteContext<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TSelected = unknown,\n>(\n  opts: UseRouteContextOptions<TRouter, TFrom, TStrict, TSelected>,\n): UseRouteContextResult<TRouter, TFrom, TStrict, TSelected> {\n  return useMatch({\n    ...(opts as any),\n    select: (match) =>\n      opts.select ? opts.select(match.context) : match.context,\n  }) as UseRouteContextResult<TRouter, TFrom, TStrict, TSelected>\n}\n"
  },
  {
    "path": "packages/react-router/src/useRouter.tsx",
    "content": "import * as React from 'react'\nimport warning from 'tiny-warning'\nimport { routerContext } from './routerContext'\nimport type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'\n\n/**\n * Access the current TanStack Router instance from React context.\n * Must be used within a `RouterProvider`.\n *\n * Options:\n * - `warn`: Log a warning if no router context is found (default: true).\n *\n * @returns The registered router instance.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterHook\n */\nexport function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {\n  warn?: boolean\n}): TRouter {\n  const value = React.useContext(routerContext)\n  warning(\n    !((opts?.warn ?? true) && !value),\n    'useRouter must be used inside a <RouterProvider> component!',\n  )\n  return value as any\n}\n"
  },
  {
    "path": "packages/react-router/src/useRouterState.tsx",
    "content": "import { useStore } from '@tanstack/react-store'\nimport { useRef } from 'react'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  RouterState,\n} from '@tanstack/router-core'\nimport type {\n  StructuralSharingOption,\n  ValidateSelected,\n} from './structuralSharing'\n\nexport type UseRouterStateOptions<\n  TRouter extends AnyRouter,\n  TSelected,\n  TStructuralSharing,\n> = {\n  router?: TRouter\n  select?: (\n    state: RouterState<TRouter['routeTree']>,\n  ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n} & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseRouterStateResult<\n  TRouter extends AnyRouter,\n  TSelected,\n> = unknown extends TSelected ? RouterState<TRouter['routeTree']> : TSelected\n\n/**\n * Subscribe to the router's state store with optional selection and\n * structural sharing for render optimization.\n *\n * Options:\n * - `select`: Project the full router state to a derived slice\n * - `structuralSharing`: Replace-equal semantics for stable references\n * - `router`: Read state from a specific router instance instead of context\n *\n * @returns The selected router state (or the full state by default).\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useRouterStateHook\n */\nexport function useRouterState<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseRouterStateOptions<TRouter, TSelected, TStructuralSharing>,\n): UseRouterStateResult<TRouter, TSelected> {\n  const contextRouter = useRouter<TRouter>({\n    warn: opts?.router === undefined,\n  })\n  const router = opts?.router || contextRouter\n\n  // During SSR we render exactly once and do not need reactivity.\n  // Avoid subscribing to the store (and any structural sharing work) on the server.\n  const _isServer = isServer ?? router.isServer\n  if (_isServer) {\n    const state = router.stores.__store.state as RouterState<\n      TRouter['routeTree']\n    >\n    return (opts?.select ? opts.select(state) : state) as UseRouterStateResult<\n      TRouter,\n      TSelected\n    >\n  }\n\n  const previousResult =\n    // eslint-disable-next-line react-hooks/rules-of-hooks\n    useRef<ValidateSelected<TRouter, TSelected, TStructuralSharing>>(undefined)\n\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  return useStore(router.stores.__store, (state) => {\n    if (opts?.select) {\n      if (opts.structuralSharing ?? router.options.defaultStructuralSharing) {\n        const newSlice = replaceEqualDeep(\n          previousResult.current,\n          opts.select(state),\n        )\n        previousResult.current = newSlice\n        return newSlice\n      }\n      return opts.select(state)\n    }\n    return state\n  }) as UseRouterStateResult<TRouter, TSelected>\n}\n"
  },
  {
    "path": "packages/react-router/src/useSearch.tsx",
    "content": "import { useMatch } from './useMatch'\nimport type {\n  StructuralSharingOption,\n  ValidateSelected,\n} from './structuralSharing'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  ResolveUseSearch,\n  StrictOrFrom,\n  ThrowConstraint,\n  ThrowOrOptional,\n  UseSearchResult,\n} from '@tanstack/router-core'\n\nexport interface UseSearchBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n  TStructuralSharing,\n> {\n  select?: (\n    state: ResolveUseSearch<TRouter, TFrom, TStrict>,\n  ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n  shouldThrow?: TThrow\n}\n\nexport type UseSearchOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n  TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n  UseSearchBaseOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    TThrow,\n    TSelected,\n    TStructuralSharing\n  > &\n  StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseSearchRoute<out TFrom> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts?: UseSearchBaseOptions<\n    TRouter,\n    TFrom,\n    /* TStrict */ true,\n    /* TThrow */ true,\n    TSelected,\n    TStructuralSharing\n  > &\n    StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseSearchResult<TRouter, TFrom, true, TSelected>\n\n/**\n * Read and select the current route's search parameters with type-safety.\n *\n * Options:\n * - `from`/`strict`: Control which route's search is read and how strictly it's typed\n * - `select`: Map the search object to a derived value for render optimization\n * - `structuralSharing`: Enable structural sharing for stable references\n * - `shouldThrow`: Throw when the route is not found (strict contexts)\n *\n * @returns The search object (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useSearchHook\n */\nexport function useSearch<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TThrow extends boolean = true,\n  TSelected = unknown,\n  TStructuralSharing extends boolean = boolean,\n>(\n  opts: UseSearchOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    ThrowConstraint<TStrict, TThrow>,\n    TSelected,\n    TStructuralSharing\n  >,\n): ThrowOrOptional<\n  UseSearchResult<TRouter, TFrom, TStrict, TSelected>,\n  TThrow\n> {\n  return useMatch({\n    from: opts.from!,\n    strict: opts.strict,\n    shouldThrow: opts.shouldThrow,\n    structuralSharing: opts.structuralSharing,\n    select: (match: any) => {\n      return opts.select ? opts.select(match.search) : match.search\n    },\n  }) as any\n}\n"
  },
  {
    "path": "packages/react-router/src/utils.ts",
    "content": "import * as React from 'react'\n\n// Safe version of React.use() that will not cause compilation errors against\n// React 18 with Webpack, which statically analyzes imports and fails when it\n// sees React.use referenced (since 'use' is not exported from React 18).\n// This uses a dynamic string lookup to avoid the static analysis.\nconst REACT_USE = 'use'\n\n/**\n * React.use if available (React 19+), undefined otherwise.\n * Use dynamic lookup to avoid Webpack compilation errors with React 18.\n */\nexport const reactUse:\n  | (<T>(usable: Promise<T> | React.Context<T>) => T)\n  | undefined = (React as any)[REACT_USE]\n\nexport function useStableCallback<T extends (...args: Array<any>) => any>(\n  fn: T,\n): T {\n  const fnRef = React.useRef(fn)\n  fnRef.current = fn\n\n  const ref = React.useRef((...args: Array<any>) => fnRef.current(...args))\n  return ref.current as T\n}\n\nexport const useLayoutEffect =\n  typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\n/**\n * Taken from https://www.developerway.com/posts/implementing-advanced-use-previous-hook#part3\n */\nexport function usePrevious<T>(value: T): T | null {\n  // initialise the ref with previous and current values\n  const ref = React.useRef<{ value: T; prev: T | null }>({\n    value: value,\n    prev: null,\n  })\n\n  const current = ref.current.value\n\n  // if the value passed into hook doesn't match what we store as \"current\"\n  // move the \"current\" to the \"previous\"\n  // and store the passed value as \"current\"\n  if (value !== current) {\n    ref.current = {\n      value: value,\n      prev: current,\n    }\n  }\n\n  // return the previous value only\n  return ref.current.prev\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n *  ref,\n *  (entry) => { doSomething(entry) },\n *  { rootMargin: '10px' },\n *  { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n  ref: React.RefObject<T | null>,\n  callback: (entry: IntersectionObserverEntry | undefined) => void,\n  intersectionObserverOptions: IntersectionObserverInit = {},\n  options: { disabled?: boolean } = {},\n) {\n  React.useEffect(() => {\n    if (\n      !ref.current ||\n      options.disabled ||\n      typeof IntersectionObserver !== 'function'\n    ) {\n      return\n    }\n\n    const observer = new IntersectionObserver(([entry]) => {\n      callback(entry)\n    }, intersectionObserverOptions)\n\n    observer.observe(ref.current)\n\n    return () => {\n      observer.disconnect()\n    }\n  }, [callback, intersectionObserverOptions, options.disabled, ref])\n}\n\n/**\n * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.\n *\n * @param ref - The forwarded ref\n * @returns The inner ref returned by `useRef`\n * @example\n * ```tsx\n * const MyComponent = React.forwardRef((props, ref) => {\n *  const innerRef = useForwardedRef(ref)\n *  return <div ref={innerRef} />\n * })\n * ```\n */\nexport function useForwardedRef<T>(ref?: React.ForwardedRef<T>) {\n  const innerRef = React.useRef<T>(null)\n  React.useImperativeHandle(ref, () => innerRef.current!, [])\n  return innerRef\n}\n"
  },
  {
    "path": "packages/react-router/tests/ClientOnly.test.tsx",
    "content": "import { afterEach, describe, expect, it, vi } from 'vitest'\nimport React from 'react'\nimport ReactDOMServer from 'react-dom/server'\nimport { act, cleanup, render, screen } from '@testing-library/react'\nimport {\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport { ClientOnly } from '../src/ClientOnly'\n\nafterEach(() => {\n  vi.resetAllMocks()\n  cleanup()\n})\n\nfunction createTestRouter(opts: { isServer: boolean }) {\n  const history = createMemoryHistory({ initialEntries: ['/'] })\n\n  const rootRoute = createRootRoute({})\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => (\n      <div>\n        <p>Index Route</p>\n        <ClientOnly fallback={<div data-testid=\"loading\">Loading...</div>}>\n          <div data-testid=\"client-only-content\">Client Only Content</div>\n        </ClientOnly>\n      </div>\n    ),\n  })\n  const otherRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/other',\n    component: () => (\n      <div>\n        <p data-testid=\"other-route\">Other Route</p>\n      </div>\n    ),\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, otherRoute])\n  const router = createRouter({ routeTree, history, ...opts })\n\n  return {\n    router,\n    routes: { indexRoute },\n  }\n}\n\ndescribe('ClientOnly', () => {\n  it('should render fallback during SSR', async () => {\n    const { router } = createTestRouter({ isServer: true })\n    await router.load()\n\n    // Initial render (SSR)\n    const html = ReactDOMServer.renderToString(\n      <RouterProvider router={router} />,\n    )\n    expect(html).include('Loading...')\n    expect(html).not.include('Client Only Content')\n  })\n\n  it('should render client content after hydration', async () => {\n    const { router } = createTestRouter({ isServer: false })\n    await router.load()\n\n    // Mock useSyncExternalStore to simulate hydration\n    vi.spyOn(React, 'useSyncExternalStore').mockImplementation(() => true)\n\n    render(<RouterProvider router={router} />)\n\n    expect(await screen.findByTestId('client-only-content')).toBeInTheDocument()\n    expect(screen.queryByText('Loading...')).not.toBeInTheDocument()\n  })\n\n  it('should handle navigation with client-only content', async () => {\n    const { router } = createTestRouter({ isServer: false })\n    await router.load()\n\n    // Simulate hydration\n    vi.spyOn(React, 'useSyncExternalStore').mockImplementation(() => true)\n\n    // Re-render after hydration\n    render(<RouterProvider router={router} />)\n\n    expect(await screen.findByTestId('client-only-content')).toBeInTheDocument()\n\n    // Navigate to a different route and back\n    await act(() => router.navigate({ to: '/other' }))\n    expect(await screen.findByTestId('other-route')).toBeInTheDocument()\n\n    await act(() => router.navigate({ to: '/' }))\n\n    // Content should still be visible after navigation\n    expect(await screen.findByTestId('client-only-content')).toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/Matches.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  MatchRoute,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  isMatch,\n  useMatchRoute,\n  useMatches,\n} from '../src'\nimport type { AnyRouteMatch, RouteMatch } from '../src'\n\nconst rootRoute = createRootRoute()\n\ntype RootRoute = typeof rootRoute\n\ntype RootMatch = RouteMatch<\n  RootRoute['id'],\n  RootRoute['fullPath'],\n  RootRoute['types']['allParams'],\n  RootRoute['types']['fullSearchSchema'],\n  RootRoute['types']['loaderData'],\n  RootRoute['types']['allContext'],\n  RootRoute['types']['loaderDeps']\n>\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\ntype IndexRoute = typeof indexRoute\n\ntype IndexMatch = RouteMatch<\n  IndexRoute['id'],\n  IndexRoute['fullPath'],\n  IndexRoute['types']['allParams'],\n  IndexRoute['types']['fullSearchSchema'],\n  IndexRoute['types']['loaderData'],\n  IndexRoute['types']['allContext'],\n  IndexRoute['types']['loaderDeps']\n>\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n  loader: () => [{ id: '1' }, { id: '2' }],\n})\n\ntype InvoiceMatch = RouteMatch<\n  InvoiceRoute['id'],\n  InvoiceRoute['fullPath'],\n  InvoiceRoute['types']['allParams'],\n  InvoiceRoute['types']['fullSearchSchema'],\n  InvoiceRoute['types']['loaderData'],\n  InvoiceRoute['types']['allContext'],\n  InvoiceRoute['types']['loaderDeps']\n>\n\ntype InvoicesRoute = typeof invoicesRoute\n\ntype InvoicesMatch = RouteMatch<\n  InvoicesRoute['id'],\n  InvoicesRoute['fullPath'],\n  InvoicesRoute['types']['allParams'],\n  InvoicesRoute['types']['fullSearchSchema'],\n  InvoicesRoute['types']['loaderData'],\n  InvoicesRoute['types']['allContext'],\n  InvoicesRoute['types']['loaderDeps']\n>\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\ntype InvoicesIndexRoute = typeof invoicesIndexRoute\n\ntype InvoicesIndexMatch = RouteMatch<\n  InvoicesIndexRoute['id'],\n  InvoicesIndexRoute['fullPath'],\n  InvoicesIndexRoute['types']['allParams'],\n  InvoicesIndexRoute['types']['fullSearchSchema'],\n  InvoicesIndexRoute['types']['loaderData'],\n  InvoicesIndexRoute['types']['allContext'],\n  InvoicesIndexRoute['types']['loaderDeps']\n>\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n})\n\ntype InvoiceRoute = typeof invoiceRoute\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n})\n\ntype LayoutRoute = typeof layoutRoute\n\ntype LayoutMatch = RouteMatch<\n  LayoutRoute['id'],\n  LayoutRoute['fullPath'],\n  LayoutRoute['types']['allParams'],\n  LayoutRoute['types']['fullSearchSchema'],\n  LayoutRoute['types']['loaderData'],\n  LayoutRoute['types']['allContext'],\n  LayoutRoute['types']['loaderDeps']\n>\n\nconst commentsRoute = createRoute({\n  getParentRoute: () => layoutRoute,\n  path: 'comments/$id',\n  validateSearch: () => ({\n    page: 0,\n    search: '',\n  }),\n  loader: () =>\n    [{ comment: 'one comment' }, { comment: 'two comment' }] as const,\n})\n\ntype CommentsRoute = typeof commentsRoute\n\ntype CommentsMatch = RouteMatch<\n  CommentsRoute['id'],\n  CommentsRoute['fullPath'],\n  CommentsRoute['types']['allParams'],\n  CommentsRoute['types']['fullSearchSchema'],\n  CommentsRoute['types']['loaderData'],\n  CommentsRoute['types']['allContext'],\n  CommentsRoute['types']['loaderDeps']\n>\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n  layoutRoute.addChildren([commentsRoute]),\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\nconst useDefaultMatchRoute = useMatchRoute<DefaultRouter>\n\ntest('when matching a route with params', () => {\n  const matchRoute = useDefaultMatchRoute()\n\n  expectTypeOf(matchRoute<string, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      '/' | '.' | '..' | '/invoices' | '/invoices/$invoiceId' | '/comments/$id'\n    >()\n\n  expectTypeOf(MatchRoute<DefaultRouter, string, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      '/' | '.' | '..' | '/invoices' | '/invoices/$invoiceId' | '/comments/$id'\n    >()\n\n  expectTypeOf(\n    matchRoute({\n      to: '/invoices/$invoiceId',\n    }),\n  ).toEqualTypeOf<false | { invoiceId: string }>()\n})\n\ntest('when matching a route with params underneath a layout route', () => {\n  const matchRoute = useDefaultMatchRoute()\n\n  expectTypeOf(\n    matchRoute({\n      to: '/comments/$id',\n    }),\n  ).toEqualTypeOf<false | { id: string }>()\n})\n\ntest('useMatches returns a union of all matches', () => {\n  expectTypeOf(useMatches<DefaultRouter>()).toEqualTypeOf<\n    Array<\n      | RootMatch\n      | IndexMatch\n      | InvoicesMatch\n      | InvoicesIndexMatch\n      | InvoiceMatch\n      | LayoutMatch\n      | CommentsMatch\n    >\n  >\n})\n\ntest('when filtering useMatches by search', () => {\n  const matches = useMatches<DefaultRouter>()\n\n  expectTypeOf(isMatch<(typeof matches)[number], ''>)\n    .parameter(1)\n    .toEqualTypeOf<keyof AnyRouteMatch>()\n\n  expectTypeOf(isMatch<(typeof matches)[number], 'search.'>).parameter(1)\n    .toEqualTypeOf<'search.page' | 'search.search'>\n\n  expectTypeOf(\n    matches.filter((match) => isMatch(match, 'search.page')),\n  ).toEqualTypeOf<Array<InvoiceMatch | CommentsMatch>>()\n})\n\ntest('when filtering useMatches by loaderData with an array', () => {\n  const matches = useMatches<DefaultRouter>()\n\n  expectTypeOf(isMatch<(typeof matches)[number], ''>)\n    .parameter(1)\n    .toEqualTypeOf<keyof AnyRouteMatch>()\n\n  expectTypeOf(isMatch<(typeof matches)[number], 'loaderData.'>)\n    .parameter(1)\n    .toEqualTypeOf<'loaderData.0' | 'loaderData.1' | `loaderData.${number}`>()\n\n  expectTypeOf(isMatch<(typeof matches)[number], 'loaderData.0.'>).parameter(1)\n    .toEqualTypeOf<'loaderData.0.id' | 'loaderData.0.comment'>\n\n  expectTypeOf(\n    matches.filter((match) => isMatch(match, 'loaderData.5.id')),\n  ).toEqualTypeOf<Array<InvoicesMatch>>()\n\n  expectTypeOf(\n    matches.filter((match) => isMatch(match, 'loaderData.0.comment')),\n  ).toEqualTypeOf<Array<CommentsMatch>>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/Matches.test.tsx",
    "content": "import { afterEach, describe, expect, test } from 'vitest'\nimport { act, cleanup, fireEvent, render, screen } from '@testing-library/react'\nimport { createMemoryHistory } from '@tanstack/history'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  isMatch,\n  useMatchRoute,\n  useMatches,\n} from '../src'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  component: () => {\n    return <Link to=\"/invoices/\">To Invoices</Link>\n  },\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n  loader: () => [{ id: '1' }, { id: '2' }],\n  component: () => <Outlet />,\n})\n\nconst InvoicesIndex = () => {\n  const matches = useMatches<DefaultRouter>()\n\n  const loaderDataMatches = matches.filter((match) =>\n    isMatch(match, 'loaderData.0.id'),\n  )\n\n  const contextMatches = matches.filter((match) =>\n    isMatch(match, 'context.permissions'),\n  )\n\n  const incorrectMatches = matches.filter((match) =>\n    isMatch(match, 'loaderData.6.id'),\n  )\n\n  return (\n    <div>\n      <section>\n        Loader Matches -{' '}\n        {loaderDataMatches.map((match) => match.fullPath).join(',')}\n      </section>\n      <section>\n        Context Matches -{' '}\n        {contextMatches.map((match) => match.fullPath).join(',')}\n      </section>\n      <section>\n        Incorrect Matches -{' '}\n        {incorrectMatches.map((match) => match.fullPath).join(',')}\n      </section>\n    </div>\n  )\n}\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n  component: InvoicesIndex,\n  context: () => ({\n    permissions: 'permission',\n  }),\n})\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n})\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n})\n\nconst commentsRoute = createRoute({\n  getParentRoute: () => layoutRoute,\n  path: 'comments/$id',\n  validateSearch: () => ({\n    page: 0,\n    search: '',\n  }),\n  loader: () =>\n    [{ comment: 'one comment' }, { comment: 'two comment' }] as const,\n})\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n  layoutRoute.addChildren([commentsRoute]),\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\ntest('when filtering useMatches by loaderData', async () => {\n  render(<RouterProvider router={defaultRouter} />)\n\n  const searchLink = await screen.findByRole('link', { name: 'To Invoices' })\n\n  fireEvent.click(searchLink)\n\n  expect(\n    await screen.findByText('Loader Matches - /invoices'),\n  ).toBeInTheDocument()\n\n  expect(\n    await screen.findByText('Context Matches - /invoices/'),\n  ).toBeInTheDocument()\n\n  expect(await screen.findByText('Incorrect Matches -')).toBeInTheDocument()\n})\n\ntest('should show pendingComponent of root route', async () => {\n  const root = createRootRoute({\n    pendingComponent: () => <div data-testId=\"root-pending\" />,\n    loader: async () => {\n      await new Promise((r) => setTimeout(r, 50))\n    },\n    component: () => <div data-testId=\"root-content\" />,\n  })\n\n  const router = createRouter({\n    routeTree: root,\n    defaultPendingMs: 0,\n    defaultPendingComponent: () => <div>default pending...</div>,\n  })\n\n  const rendered = render(<RouterProvider router={router} />)\n\n  expect(await rendered.findByTestId('root-pending')).toBeInTheDocument()\n  expect(await rendered.findByTestId('root-content')).toBeInTheDocument()\n})\n\ndescribe('matching on different param types', () => {\n  const testCases = [\n    {\n      name: 'param with braces',\n      path: '/$id',\n      nav: '/1',\n      params: { id: '1' },\n      matchParams: { id: '1' },\n    },\n    {\n      name: 'param without braces',\n      path: '/{$id}',\n      nav: '/2',\n      params: { id: '2' },\n      matchParams: { id: '2' },\n    },\n    {\n      name: 'param with prefix',\n      path: '/prefix-{$id}',\n      nav: '/prefix-3',\n      params: { id: '3' },\n      matchParams: { id: '3' },\n    },\n    {\n      name: 'param with suffix',\n      path: '/{$id}-suffix',\n      nav: '/4-suffix',\n      params: { id: '4' },\n      matchParams: { id: '4' },\n    },\n    {\n      name: 'param with prefix and suffix',\n      path: '/prefix-{$id}-suffix',\n      nav: '/prefix-5-suffix',\n      params: { id: '5' },\n      matchParams: { id: '5' },\n    },\n    {\n      name: 'wildcard with no braces',\n      path: '/abc/$',\n      nav: '/abc/6',\n      params: { '*': '6', _splat: '6' },\n      matchParams: { '*': '6', _splat: '6' },\n    },\n    {\n      name: 'wildcard with braces',\n      path: '/abc/{$}',\n      nav: '/abc/7',\n      params: { '*': '7', _splat: '7' },\n      matchParams: { '*': '7', _splat: '7' },\n    },\n    {\n      name: 'wildcard with prefix',\n      path: '/abc/prefix{$}',\n      nav: '/abc/prefix/8',\n      params: { '*': '/8', _splat: '/8' },\n      matchParams: { '*': '/8', _splat: '/8' },\n    },\n    {\n      name: 'wildcard with suffix',\n      path: '/abc/{$}suffix',\n      nav: '/abc/9/suffix',\n      params: { _splat: '9/', '*': '9/' },\n      matchParams: { _splat: '9/', '*': '9/' },\n    },\n    {\n      name: 'optional param with no prefix/suffix and value',\n      path: '/abc/{-$id}/def',\n      nav: '/abc/10/def',\n      params: { id: '10' },\n      matchParams: { id: '10' },\n    },\n    {\n      name: 'optional param with no prefix/suffix and requiredParam and no value',\n      path: '/abc/{-$id}/$foo/def',\n      nav: '/abc/bar/def',\n      params: { foo: 'bar' },\n      matchParams: { foo: 'bar' },\n    },\n    {\n      name: 'optional param with no prefix/suffix and requiredParam and value',\n      path: '/abc/{-$id}/$foo/def',\n      nav: '/abc/10/bar/def',\n      params: { id: '10', foo: 'bar' },\n      matchParams: { id: '10', foo: 'bar' },\n    },\n    {\n      name: 'optional param with no prefix/suffix and no value',\n      path: '/abc/{-$id}/def',\n      nav: '/abc/def',\n      params: {},\n      matchParams: {},\n    },\n    {\n      name: 'multiple optional params with no prefix/suffix and no value',\n      path: '/{-$a}/{-$b}/{-$c}',\n      nav: '/',\n      params: {},\n      matchParams: {},\n    },\n    {\n      name: 'multiple optional params with no prefix/suffix and values',\n      path: '/{-$a}/{-$b}/{-$c}',\n      nav: '/foo/bar/qux',\n      params: { a: 'foo', b: 'bar', c: 'qux' },\n      matchParams: { a: 'foo', b: 'bar', c: 'qux' },\n    },\n    {\n      name: 'multiple optional params with no prefix/suffix and mixed values',\n      path: '/{-$a}/{-$b}/{-$c}',\n      nav: '/foo/qux',\n      params: { a: 'foo', b: 'qux' },\n      matchParams: { a: 'foo', b: 'qux' },\n    },\n    {\n      name: 'optional param with prefix and value',\n      path: '/optional-{-$id}',\n      nav: '/optional-12',\n      params: { id: '12' },\n      matchParams: { id: '12' },\n    },\n    {\n      name: 'optional param with prefix and no value',\n      path: '/optional-{-$id}',\n      nav: '/optional-',\n      params: {},\n      matchParams: {},\n    },\n    {\n      name: 'optional param with suffix and value',\n      path: '/{-$id}-optional',\n      nav: '/13-optional',\n      params: { id: '13' },\n      matchParams: { id: '13' },\n    },\n    {\n      name: 'optional param with suffix and no value',\n      path: '/{-$id}-optional',\n      nav: '/-optional',\n      params: {},\n      matchParams: {},\n    },\n    {\n      name: 'optional param with required param, prefix, suffix, wildcard and no value',\n      path: `/$foo/a{-$id}-optional/$`,\n      nav: '/bar/a-optional/qux',\n      params: { foo: 'bar', _splat: 'qux', '*': 'qux' },\n      matchParams: { foo: 'bar', _splat: 'qux', '*': 'qux' },\n    },\n    {\n      name: 'optional param with required param, prefix, suffix, wildcard and value',\n      path: `/$foo/a{-$id}-optional/$`,\n      nav: '/bar/a14-optional/qux',\n      params: { foo: 'bar', id: '14', _splat: 'qux', '*': 'qux' },\n      matchParams: { foo: 'bar', id: '14', _splat: 'qux', '*': 'qux' },\n    },\n  ]\n\n  afterEach(() => cleanup())\n  test.each(testCases)(\n    '$name',\n    async ({ name, path, params, matchParams, nav }) => {\n      const rootRoute = createRootRoute()\n\n      const Route = createRoute({\n        getParentRoute: () => rootRoute,\n        path,\n        component: RouteComponent,\n      })\n\n      function RouteComponent() {\n        const routeParams = Route.useParams()\n        const matchRoute = useMatchRoute()\n        const matchRouteMatch = matchRoute({\n          to: path,\n        })\n\n        return (\n          <div>\n            <h1 data-testid=\"heading\">{name}</h1>\n            <div>\n              Params{' '}\n              <span data-testid=\"params\">{JSON.stringify(routeParams)}</span>\n              Matches{' '}\n              <span data-testid=\"matches\">\n                {JSON.stringify(matchRouteMatch)}\n              </span>\n            </div>\n          </div>\n        )\n      }\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([Route]),\n        history: createMemoryHistory({ initialEntries: ['/'] }),\n      })\n\n      await act(() => render(<RouterProvider router={router} />))\n\n      act(() => router.history.push(nav))\n\n      const paramsToCheck = await screen.findByTestId('params')\n      const matchesToCheck = await screen.findByTestId('matches')\n\n      expect(JSON.parse(paramsToCheck.textContent)).toEqual(params)\n      expect(JSON.parse(matchesToCheck.textContent)).toEqual(matchParams)\n    },\n  )\n})\n"
  },
  {
    "path": "packages/react-router/tests/RouterProvider.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n})\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\ntest('can pass default router to the provider', () => {\n  expectTypeOf(RouterProvider<DefaultRouter>)\n    .parameter(0)\n    .toMatchTypeOf<{\n      router: DefaultRouter\n      routeTree?: DefaultRouter['routeTree']\n    }>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/Scripts.test.tsx",
    "content": "import { describe, expect, test } from 'vitest'\nimport { act, render, screen } from '@testing-library/react'\nimport ReactDOMServer from 'react-dom/server'\n\nimport {\n  HeadContent,\n  Outlet,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport { Scripts } from '../src/Scripts'\n\ndescribe('ssr scripts', () => {\n  test('it works', async () => {\n    const rootRoute = createRootRoute({\n      head: () => {\n        return {\n          scripts: [\n            {\n              src: 'script.js',\n            },\n            {\n              src: 'script2.js',\n            },\n          ],\n        }\n      },\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      head: () => {\n        return {\n          scripts: [\n            {\n              src: 'script3.js',\n            },\n          ],\n        }\n      },\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: true,\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.headScripts).flat(1)).toEqual([\n      { src: 'script.js' },\n      { src: 'script2.js' },\n      { src: 'script3.js' },\n    ])\n  })\n\n  test('excludes `undefined` script values', async () => {\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        { src: 'script.js' },\n        undefined, // 'script2.js' opted out by certain conditions, such as `NODE_ENV=production`.\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      scripts: () => [{ src: 'script3.js' }],\n      component: () => {\n        return <div data-testid=\"index\">index</div>\n      },\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: true,\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.scripts).flat(1)).toEqual([\n      { src: 'script.js' },\n      undefined,\n      { src: 'script3.js' },\n    ])\n\n    const { container } = await act(() =>\n      render(<RouterProvider router={router} />),\n    )\n    expect(await screen.findByTestId('root')).toBeInTheDocument()\n    expect(await screen.findByTestId('index')).toBeInTheDocument()\n\n    expect(container.innerHTML).toEqual(\n      `<div><div data-testid=\"root\">root</div><div data-testid=\"index\">index</div><script src=\"script.js\"></script><script src=\"script3.js\"></script></div>`,\n    )\n  })\n})\n\ndescribe('scripts with async/defer attributes', () => {\n  test('server renders scripts with async/defer attributes in output', async () => {\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          src: 'script.js',\n          async: true,\n        },\n        {\n          src: 'script2.js',\n          defer: true,\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"server-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      component: () => {\n        return <div data-testid=\"server-index\">index</div>\n      },\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: true,\n    })\n\n    await router.load()\n\n    // Use ReactDOMServer.renderToString to test actual server output\n    const html = ReactDOMServer.renderToString(\n      <RouterProvider router={router} />,\n    )\n\n    expect(html).toMatch(/<script[^>]*src=\"script\\.js\"[^>]*async=\"\"/)\n    expect(html).toMatch(/<script[^>]*src=\"script2\\.js\"[^>]*defer=\"\"/)\n  })\n\n  test('client renders scripts with attributes (including async/defer)', async () => {\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          src: 'script.js',\n          async: true,\n          crossOrigin: 'anonymous',\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"async-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      component: () => {\n        return <div data-testid=\"async-index\">index</div>\n      },\n    })\n\n    // Clear head and any leftover body scripts between tests.\n    document.head.innerHTML = ''\n    document.querySelectorAll('body script').forEach((s) => s.remove())\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: false, // Client-side rendering\n    })\n\n    await router.load()\n\n    await act(() => render(<RouterProvider router={router} />))\n\n    expect(await screen.findByTestId('async-root')).toBeInTheDocument()\n\n    const script = document.querySelector('script[src=\"script.js\"]')\n    expect(script).toBeTruthy()\n\n    // Attributes are preserved on the client.\n    expect(script?.getAttribute('src')).toBe('script.js')\n    expect(script?.hasAttribute('async')).toBe(true)\n    expect(script?.getAttribute('crossorigin')).toBe('anonymous')\n  })\n})\n\ndescribe('ssr HeadContent', () => {\n  test('derives title, dedupes meta, and allows non-loader HeadContent', async () => {\n    const rootRoute = createRootRoute({\n      loader: () =>\n        new Promise((r) => setTimeout(r, 1)).then(() => ({\n          description: 'Root',\n        })),\n      head: ({ loaderData }) => {\n        return {\n          meta: [\n            {\n              title: 'Root',\n            },\n            {\n              name: 'description',\n              content: loaderData?.description,\n            },\n            {\n              name: 'image',\n              content: 'image.jpg',\n            },\n            {\n              property: 'og:image',\n              content: 'root-image.jpg',\n            },\n            {\n              property: 'og:description',\n              content: 'Root description',\n            },\n          ],\n        }\n      },\n      component: () => {\n        return <HeadContent />\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      loader: () =>\n        new Promise((r) => setTimeout(r, 2)).then(() => ({\n          description: 'Index',\n        })),\n      head: ({ loaderData }) => {\n        return {\n          meta: [\n            {\n              title: 'Index',\n            },\n            {\n              name: 'description',\n              content: loaderData?.description,\n            },\n            {\n              name: 'last-modified',\n              content: '2021-10-10',\n            },\n            {\n              property: 'og:image',\n              content: 'index-image.jpg',\n            },\n          ],\n        }\n      },\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: true,\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.meta).flat(1)).toEqual([\n      { title: 'Root' },\n      { name: 'description', content: 'Root' },\n      { name: 'image', content: 'image.jpg' },\n      { property: 'og:image', content: 'root-image.jpg' },\n      { property: 'og:description', content: 'Root description' },\n      { title: 'Index' },\n      { name: 'description', content: 'Index' },\n      { name: 'last-modified', content: '2021-10-10' },\n      { property: 'og:image', content: 'index-image.jpg' },\n    ])\n\n    const html = ReactDOMServer.renderToString(\n      <RouterProvider router={router} />,\n    )\n    expect(html).toEqual(\n      `<title>Index</title><meta name=\"image\" content=\"image.jpg\"/><meta property=\"og:description\" content=\"Root description\"/><meta name=\"description\" content=\"Index\"/><meta name=\"last-modified\" content=\"2021-10-10\"/><meta property=\"og:image\" content=\"index-image.jpg\"/>`,\n    )\n  })\n})\n\ndescribe('data script rendering', () => {\n  test('data script renders content on server (SSR)', async () => {\n    const jsonLd = JSON.stringify({\n      '@context': 'https://schema.org',\n      '@type': 'Article',\n      headline: 'Test Article',\n    })\n\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          type: 'application/ld+json',\n          children: jsonLd,\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"ssr-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: true,\n    })\n\n    await router.load()\n\n    const html = ReactDOMServer.renderToString(\n      <RouterProvider router={router} />,\n    )\n\n    expect(html).toContain('application/ld+json')\n    expect(html).toContain(jsonLd)\n  })\n\n  test('data script preserves content on client', async () => {\n    const jsonLd = JSON.stringify({\n      '@context': 'https://schema.org',\n      '@type': 'WebSite',\n      name: 'Test',\n    })\n\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          type: 'application/ld+json',\n          children: jsonLd,\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"data-client-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    await router.load()\n\n    const { container } = await act(() =>\n      render(<RouterProvider router={router} />),\n    )\n\n    const rootEl = container.querySelector('[data-testid=\"data-client-root\"]')\n    expect(rootEl).not.toBeNull()\n\n    const scriptEl = container.querySelector(\n      'script[type=\"application/ld+json\"]',\n    )\n    expect(scriptEl).not.toBeNull()\n    expect(scriptEl!.innerHTML).toBe(jsonLd)\n  })\n\n  test('executable script is injected into document.head via useEffect on client', async () => {\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          children: 'console.log(\"hello\")',\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"exec-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    await router.load()\n\n    const { container } = await act(() =>\n      render(<RouterProvider router={router} />),\n    )\n\n    const rootEl = container.querySelector('[data-testid=\"exec-root\"]')\n    expect(rootEl).not.toBeNull()\n\n    // Executable inline scripts are injected into document.head via useEffect,\n    // not rendered in the React tree on the client.\n    const headScript = document.head.querySelector(\n      'script:not([type]):not([src])',\n    )\n    expect(headScript).not.toBeNull()\n    expect(headScript!.textContent).toBe('console.log(\"hello\")')\n  })\n\n  test('module script is injected into document.head via useEffect on client', async () => {\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          type: 'module',\n          children: 'import { foo } from \"./foo.js\"',\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"module-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    await router.load()\n\n    const { container } = await act(() =>\n      render(<RouterProvider router={router} />),\n    )\n\n    const rootEl = container.querySelector('[data-testid=\"module-root\"]')\n    expect(rootEl).not.toBeNull()\n\n    // Module scripts are injected into document.head via useEffect,\n    // not rendered in the React tree on the client.\n    const moduleScript = document.head.querySelector('script[type=\"module\"]')\n    expect(moduleScript).not.toBeNull()\n    expect(moduleScript!.textContent).toBe('import { foo } from \"./foo.js\"')\n  })\n\n  test('application/json data script preserves content', async () => {\n    const jsonData = JSON.stringify({ config: { theme: 'dark' } })\n\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          type: 'application/json',\n          children: jsonData,\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"json-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    await router.load()\n\n    const { container } = await act(() =>\n      render(<RouterProvider router={router} />),\n    )\n\n    const rootEl = container.querySelector('[data-testid=\"json-root\"]')\n    expect(rootEl).not.toBeNull()\n\n    const scriptEl = container.querySelector('script[type=\"application/json\"]')\n    expect(scriptEl).not.toBeNull()\n    expect(scriptEl!.innerHTML).toBe(jsonData)\n  })\n\n  test('data script does not duplicate into document.head', async () => {\n    const jsonLd = JSON.stringify({\n      '@context': 'https://schema.org',\n      '@type': 'Organization',\n      name: 'Test Org',\n    })\n\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          type: 'application/ld+json',\n          children: jsonLd,\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"dup-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    await router.load()\n\n    const { container } = await act(() =>\n      render(<RouterProvider router={router} />),\n    )\n\n    const rootEl = container.querySelector('[data-testid=\"dup-root\"]')\n    expect(rootEl).not.toBeNull()\n\n    // Data scripts should NOT be duplicated into document.head by useEffect\n    const headScripts = document.head.querySelectorAll(\n      'script[type=\"application/ld+json\"]',\n    )\n    expect(headScripts.length).toBe(0)\n\n    // Should only exist once in the container\n    const containerScripts = container.querySelectorAll(\n      'script[type=\"application/ld+json\"]',\n    )\n    expect(containerScripts.length).toBe(1)\n    expect(containerScripts[0]!.innerHTML).toBe(jsonLd)\n  })\n\n  test('empty string type is treated as executable, injected via useEffect on client', async () => {\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        {\n          type: '',\n          children: 'console.log(\"empty type\")',\n        },\n      ],\n      component: () => {\n        return (\n          <div>\n            <div data-testid=\"empty-type-root\">root</div>\n            <Outlet />\n            <Scripts />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    await router.load()\n\n    const { container } = await act(() =>\n      render(<RouterProvider router={router} />),\n    )\n\n    const rootEl = container.querySelector('[data-testid=\"empty-type-root\"]')\n    expect(rootEl).not.toBeNull()\n\n    // Empty type = text/javascript per HTML spec. Executable scripts are\n    // injected into document.head via useEffect on the client.\n    const scriptEl = document.head.querySelector('script[type=\"\"]')\n    expect(scriptEl).not.toBeNull()\n    expect(scriptEl!.textContent).toBe('console.log(\"empty type\")')\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/blocker.test.tsx",
    "content": "import React from 'react'\nimport '@testing-library/jest-dom/vitest'\nimport { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, fireEvent, render, screen } from '@testing-library/react'\nimport combinate from 'combinate'\nimport {\n  Link,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n  useBlocker,\n  useNavigate,\n} from '../src'\nimport type { RouterHistory, ShouldBlockFn } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.resetAllMocks()\n  cleanup()\n})\n\ninterface BlockerTestOpts {\n  blockerFn: ShouldBlockFn\n  disabled?: boolean\n  ignoreBlocker?: boolean\n}\n\nasync function setup({ blockerFn, disabled, ignoreBlocker }: BlockerTestOpts) {\n  const _mockBlockerFn = vi.fn(blockerFn)\n  const rootRoute = createRootRoute()\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: function Setup() {\n      const navigate = useNavigate()\n      useBlocker({ disabled, shouldBlockFn: _mockBlockerFn })\n      return (\n        <>\n          <h1>Index</h1>\n          <Link to=\"/posts\" ignoreBlocker={ignoreBlocker}>\n            link to posts\n          </Link>\n          <Link to=\"/foo\">link to foo</Link>\n          <button onClick={() => navigate({ to: '/posts', ignoreBlocker })}>\n            button\n          </button>\n        </>\n      )\n    },\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n    component: () => (\n      <>\n        <h1>Posts</h1>\n      </>\n    ),\n  })\n\n  const fooRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/foo',\n    beforeLoad: () => {\n      throw redirect({ to: '/bar' })\n    },\n    component: () => (\n      <>\n        <h1>Foo</h1>\n      </>\n    ),\n  })\n\n  const barRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/bar',\n    component: () => (\n      <>\n        <h1>Bar</h1>\n      </>\n    ),\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      fooRoute,\n      barRoute,\n    ]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n  expect(window.location.pathname).toBe('/')\n\n  const postsLink = await screen.findByRole('link', { name: 'link to posts' })\n  const fooLink = await screen.findByRole('link', { name: 'link to foo' })\n  const button = await screen.findByRole('button', { name: 'button' })\n\n  return {\n    router,\n    clickable: { postsLink, fooLink, button },\n    blockerFn: _mockBlockerFn,\n  }\n}\n\nconst clickTarget = ['postsLink' as const, 'button' as const]\n\ndescribe('Blocker', () => {\n  const doesNotBlockTextMatrix = combinate({\n    opts: [\n      {\n        blockerFn: () => false,\n        disabled: false,\n        ignoreBlocker: undefined,\n      },\n      {\n        blockerFn: async () =>\n          await new Promise<boolean>((resolve) => resolve(false)),\n        disabled: false,\n        ignoreBlocker: false,\n      },\n      {\n        blockerFn: () => true,\n        disabled: true,\n        ignoreBlocker: false,\n      },\n      {\n        blockerFn: () => true,\n        disabled: false,\n        ignoreBlocker: true,\n      },\n    ],\n    clickTarget,\n  })\n  test.each(doesNotBlockTextMatrix)(\n    'does not block navigation with blockerFn = $flags.blockerFn, ignoreBlocker = $flags.ignoreBlocker, clickTarget = $clickTarget',\n    async ({ opts, clickTarget }) => {\n      const { clickable, blockerFn } = await setup(opts)\n\n      fireEvent.click(clickable[clickTarget])\n      expect(\n        await screen.findByRole('heading', { name: 'Posts' }),\n      ).toBeInTheDocument()\n      expect(window.location.pathname).toBe('/posts')\n      if (opts.ignoreBlocker || opts.disabled)\n        expect(blockerFn).not.toHaveBeenCalled()\n    },\n  )\n\n  const blocksTextMatrix = combinate({\n    opts: [\n      {\n        blockerFn: () => true,\n        disabled: false,\n        ignoreBlocker: undefined,\n      },\n      {\n        blockerFn: async () =>\n          await new Promise<boolean>((resolve) => resolve(true)),\n        disabled: false,\n        ignoreBlocker: false,\n      },\n    ],\n    clickTarget,\n  })\n  test.each(blocksTextMatrix)(\n    'blocks navigation with condition = $flags.blockerFn, ignoreBlocker = $flags.ignoreBlocker, clickTarget = $clickTarget',\n    async ({ opts, clickTarget }) => {\n      const { clickable } = await setup(opts)\n\n      fireEvent.click(clickable[clickTarget])\n      await expect(\n        screen.findByRole('header', { name: 'Posts' }),\n      ).rejects.toThrow()\n      expect(window.location.pathname).toBe('/')\n    },\n  )\n\n  test('blocker function is only called once when navigating to a route that redirects', async () => {\n    const { clickable, blockerFn } = await setup({\n      blockerFn: () => false,\n      ignoreBlocker: false,\n    })\n    fireEvent.click(clickable.fooLink)\n    expect(\n      await screen.findByRole('heading', { name: 'Bar' }),\n    ).toBeInTheDocument()\n    expect(window.location.pathname).toBe('/bar')\n    expect(blockerFn).toHaveBeenCalledTimes(1)\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/createLazyRoute.test.tsx",
    "content": "import { afterEach, describe, expect, it, vi } from 'vitest'\nimport {\n  cleanup,\n  configure,\n  fireEvent,\n  render,\n  screen,\n} from '@testing-library/react'\nimport {\n  Link,\n  RouterProvider,\n  createBrowserHistory,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { RouterHistory } from '../src'\n\nafterEach(() => {\n  vi.resetAllMocks()\n  cleanup()\n})\n\nfunction createTestRouter(initialHistory?: RouterHistory) {\n  const history =\n    initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n  const rootRoute = createRootRoute({})\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => (\n      <div>\n        <p>Index Route</p>\n        <Link to=\"/heavy\">Link to heavy</Link>\n      </div>\n    ),\n  })\n\n  const heavyRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/heavy',\n  }).lazy(() => import('./lazy/heavy').then((d) => d.default('/heavy')))\n\n  const routeTree = rootRoute.addChildren([indexRoute, heavyRoute])\n\n  const router = createRouter({ routeTree, history })\n\n  return {\n    router,\n    routes: { indexRoute, heavyRoute },\n  }\n}\n\ndescribe('preload: matched routes', { timeout: 20000 }, () => {\n  configure({ reactStrictMode: true })\n\n  it('should wait for lazy options to be streamed in before ', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/'] }),\n    )\n\n    await router.load()\n\n    // Preload the route and navigate to it\n    router.preloadRoute({ to: '/heavy' })\n    await router.navigate({ to: '/heavy' })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/heavy')\n\n    const lazyRoute = router.routesByPath['/heavy']\n\n    expect(lazyRoute.options.component).toBeDefined()\n  })\n\n  it('should render the heavy/lazy component', async () => {\n    const { router } = createTestRouter(createBrowserHistory())\n\n    render(<RouterProvider router={router} />)\n\n    const linkToHeavy = await screen.findByText('Link to heavy')\n    expect(linkToHeavy).toBeInTheDocument()\n\n    expect(router.state.location.pathname).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    // click the link to navigate to the heavy route\n    fireEvent.click(linkToHeavy)\n\n    const heavyElement = await screen.findByText('I am sooo heavy')\n\n    expect(heavyElement).toBeInTheDocument()\n\n    expect(router.state.location.pathname).toBe('/heavy')\n    expect(window.location.pathname).toBe('/heavy')\n\n    const lazyRoute = router.routesByPath['/heavy']\n    expect(lazyRoute.options.component).toBeDefined()\n  })\n\n  it('should render a lazy route errorComponent when the loader throws on first load', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/lazy-error'] })\n\n    const rootRoute = createRootRoute()\n    const lazyErrorRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/lazy-error',\n      loader: () => {\n        throw new Error('lazy error')\n      },\n    }).lazy(() => import('./lazy/error').then((d) => d.Route('/lazy-error')))\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([lazyErrorRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    expect(\n      await screen.findByText('Lazy Error: lazy error'),\n    ).toBeInTheDocument()\n    expect(screen.queryByText('About route content')).not.toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/disableGlobalCatchBoundary.test.tsx",
    "content": "import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, render, screen } from '@testing-library/react'\nimport { Component } from 'react'\nimport {\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { ReactNode } from 'react'\n\nimport type { RouterHistory } from '../src'\n\nfunction ThrowingComponent() {\n  throw new Error('Test error')\n}\n\n// Custom error boundary to catch errors that bubble up\nclass TestErrorBoundary extends Component<\n  { children: ReactNode },\n  { hasError: boolean; error?: Error }\n> {\n  constructor(props: { children: ReactNode }) {\n    super(props)\n    this.state = { hasError: false }\n  }\n\n  static getDerivedStateFromError(error: Error) {\n    return { hasError: true, error }\n  }\n\n  render() {\n    if (this.state.hasError) {\n      return (\n        <div>External Error Boundary Caught: {this.state.error?.message}</div>\n      )\n    }\n\n    return this.props.children\n  }\n}\n\nlet history: RouterHistory\nlet originalOnError: typeof window.onerror\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  originalOnError = window.onerror\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.onerror = originalOnError\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\nfunction createTestRouter(disableGlobalCatchBoundary: boolean) {\n  const rootRoute = createRootRoute()\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: ThrowingComponent,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n  return createRouter({\n    routeTree,\n    history,\n    disableGlobalCatchBoundary,\n  })\n}\n\ndescribe('disableGlobalCatchBoundary option', () => {\n  test('catches errors in global boundary when disableGlobalCatchBoundary is false', async () => {\n    const router = createTestRouter(false)\n\n    render(<RouterProvider router={router} />)\n\n    // The global CatchBoundary shows \"Something went wrong!\" by default\n    const errorElement = await screen.findByText('Something went wrong!')\n    expect(errorElement).toBeInTheDocument()\n  })\n\n  test('errors bubble up to external error boundary when disableGlobalCatchBoundary is true', async () => {\n    const router = createTestRouter(true)\n\n    // Wrap RouterProvider in an external error boundary\n    render(\n      <TestErrorBoundary>\n        <RouterProvider router={router} />\n      </TestErrorBoundary>,\n    )\n\n    // Error should bubble up and be caught by the external error boundary\n    const externalErrorElement = await screen.findByText(\n      'External Error Boundary Caught: Test error',\n    )\n    expect(externalErrorElement).toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/errorComponent.test.tsx",
    "content": "import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, fireEvent, render, screen } from '@testing-library/react'\n\nimport {\n  Link,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { ErrorComponentProps, RouterHistory } from '../src'\n\nfunction MyErrorComponent(props: ErrorComponentProps) {\n  return <div>Error: {props.error.message}</div>\n}\n\nasync function asyncToThrowFn() {\n  await new Promise((resolve) => setTimeout(resolve, 500))\n  throw new Error('error thrown')\n}\n\nfunction throwFn() {\n  throw new Error('error thrown')\n}\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ndescribe.each([{ preload: false }, { preload: 'intent' }] as const)(\n  'errorComponent is rendered when the preload=$preload',\n  (options) => {\n    describe.each([true, false])('with async=%s', (isAsync) => {\n      const throwableFn = isAsync ? asyncToThrowFn : throwFn\n\n      const callers = [\n        { caller: 'beforeLoad', testFn: throwableFn },\n        { caller: 'loader', testFn: throwableFn },\n      ]\n\n      test.each(callers)(\n        'an Error is thrown on navigate in the route $caller function',\n        async ({ caller, testFn }) => {\n          const rootRoute = createRootRoute()\n          const indexRoute = createRoute({\n            getParentRoute: () => rootRoute,\n            path: '/',\n            component: function Home() {\n              return (\n                <div>\n                  <Link to=\"/about\">link to about</Link>\n                </div>\n              )\n            },\n          })\n          const aboutRoute = createRoute({\n            getParentRoute: () => rootRoute,\n            path: '/about',\n            beforeLoad: caller === 'beforeLoad' ? testFn : undefined,\n            loader: caller === 'loader' ? testFn : undefined,\n            component: function Home() {\n              return <div>About route content</div>\n            },\n            errorComponent: MyErrorComponent,\n          })\n\n          const routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\n          const router = createRouter({\n            routeTree,\n            defaultPreload: options.preload,\n            history,\n          })\n\n          render(<RouterProvider router={router} />)\n\n          const linkToAbout = await screen.findByRole('link', {\n            name: 'link to about',\n          })\n\n          expect(linkToAbout).toBeInTheDocument()\n          fireEvent.mouseOver(linkToAbout)\n          fireEvent.focus(linkToAbout)\n          fireEvent.click(linkToAbout)\n\n          const errorComponent = await screen.findByText(\n            `Error: error thrown`,\n            undefined,\n            { timeout: 1500 },\n          )\n          await expect(\n            screen.findByText('About route content'),\n          ).rejects.toThrow()\n          expect(errorComponent).toBeInTheDocument()\n        },\n      )\n\n      test.each(callers)(\n        'an Error is thrown on first load in the route $caller function',\n        async ({ caller, testFn }) => {\n          const rootRoute = createRootRoute()\n          const indexRoute = createRoute({\n            getParentRoute: () => rootRoute,\n            path: '/',\n            beforeLoad: caller === 'beforeLoad' ? testFn : undefined,\n            loader: caller === 'loader' ? testFn : undefined,\n            component: function Home() {\n              return <div>Index route content</div>\n            },\n            errorComponent: MyErrorComponent,\n          })\n\n          const routeTree = rootRoute.addChildren([indexRoute])\n\n          const router = createRouter({\n            routeTree,\n            defaultPreload: options.preload,\n            history,\n          })\n\n          render(<RouterProvider router={router} />)\n\n          const errorComponent = await screen.findByText(\n            `Error: error thrown`,\n            undefined,\n            { timeout: 750 },\n          )\n          await expect(\n            screen.findByText('Index route content'),\n          ).rejects.toThrow()\n          expect(errorComponent).toBeInTheDocument()\n        },\n      )\n    })\n  },\n)\n"
  },
  {
    "path": "packages/react-router/tests/fileRoute.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport { createFileRoute, createRootRoute } from '../src'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createFileRoute('/')()\n\nconst invoicesRoute = createFileRoute('/invoices')()\n\nconst invoiceRoute = createFileRoute('/invoices/$invoiceId')()\n\nconst postLayoutRoute = createFileRoute('/_postLayout')()\n\nconst postsRoute = createFileRoute('/_postLayout/posts')()\n\nconst postRoute = createFileRoute('/_postLayout/posts/$postId_')()\n\nconst protectedRoute = createFileRoute('/(auth)/protected')()\n\ndeclare module '@tanstack/router-core' {\n  interface FileRoutesByPath {\n    '/': {\n      preLoaderRoute: typeof indexRoute\n      parentRoute: typeof rootRoute\n      id: string\n      fullPath: string\n      path: string\n    }\n    '/(auth)/protected': {\n      preLoaderRoute: typeof protectedRoute\n      parentRoute: typeof rootRoute\n      id: '/protected'\n      fullPath: '/protected'\n      path: '(auth)/protected'\n    }\n    '/invoices': {\n      preLoaderRoute: typeof invoicesRoute\n      parentRoute: typeof indexRoute\n      id: '/invoices'\n      fullPath: '/invoices'\n      path: 'invoices'\n    }\n    '/invoices/$invoiceId': {\n      preLoaderRoute: typeof invoiceRoute\n      parentRoute: typeof invoicesRoute\n      id: '/invoices/$invoiceId'\n      fullPath: '/invoices/$invoiceId'\n      path: '/$invoiceId'\n    }\n    '/_postLayout': {\n      preLoaderRoute: typeof postLayoutRoute\n      parentRoute: typeof rootRoute\n      id: string\n      fullPath: string\n      path: string\n    }\n    '/_postLayout/posts': {\n      preLoaderRoute: typeof postsRoute\n      parentRoute: typeof postLayoutRoute\n      id: '/_postLayout/posts'\n      fullPath: '/posts'\n      path: '/posts'\n    }\n    '/_postLayout/posts/$postId_': {\n      preLoaderRoute: typeof postRoute\n      parentRoute: typeof postsRoute\n      id: '/_postLayout/posts/$postId_'\n      fullPath: '/posts/$postId'\n      path: '/$postId_'\n    }\n  }\n}\n\ntest('when creating a file route with a static route', () => {\n  expectTypeOf<'/invoices'>(invoicesRoute.fullPath)\n  expectTypeOf<'/invoices'>(invoicesRoute.id)\n  expectTypeOf<'invoices'>(invoicesRoute.path)\n})\n\ntest('when creating a file route with params', () => {\n  expectTypeOf<'/invoices/$invoiceId'>(invoiceRoute.fullPath)\n  expectTypeOf<'/invoices/$invoiceId'>(invoiceRoute.id)\n  expectTypeOf<'/$invoiceId'>(invoiceRoute.path)\n})\n\ntest('when creating a layout route', () => {\n  expectTypeOf<'/posts'>(postsRoute.fullPath)\n  expectTypeOf<'/_postLayout/posts'>(postsRoute.id)\n  expectTypeOf<'/posts'>(postsRoute.path)\n})\n\ntest('when creating a _ suffix route', () => {\n  expectTypeOf<'/posts/$postId'>(postRoute.fullPath)\n  expectTypeOf<'/$postId_'>(postRoute.path)\n  expectTypeOf<'/_postLayout/posts/$postId_'>(postRoute.id)\n})\n\ntest('when creating a folder group', () => {\n  expectTypeOf<'/protected'>(protectedRoute.fullPath)\n  expectTypeOf<'(auth)/protected'>(protectedRoute.path)\n  expectTypeOf<'/protected'>(protectedRoute.id)\n})\n"
  },
  {
    "path": "packages/react-router/tests/fileRoute.test.ts",
    "content": "/* eslint-disable */\nimport { describe, it, expect } from 'vitest'\nimport {\n  getRouteApi,\n  createFileRoute,\n  createLazyRoute,\n  createLazyFileRoute,\n  LazyRoute,\n  AnyRoute,\n} from '../src'\n\ndescribe('createFileRoute has the same hooks as getRouteApi', () => {\n  const routeApi = getRouteApi('foo')\n  const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))\n  // @ts-expect-error\n  const route = createFileRoute('')({})\n\n  it.each(hookNames.map((name) => [name]))(\n    'should have the \"%s\" hook defined',\n    (hookName) => {\n      expect(route[hookName as keyof typeof route]).toBeDefined()\n    },\n  )\n})\n\ndescribe('createLazyFileRoute has the same hooks as getRouteApi', () => {\n  const routeApi = getRouteApi('foo')\n  const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))\n  // @ts-expect-error\n  const route = createLazyFileRoute('')({})\n\n  it.each(hookNames.map((name) => [name]))(\n    'should have the \"%s\" hook defined',\n    (hookName) => {\n      expect(route[hookName as keyof LazyRoute<any>]).toBeDefined()\n    },\n  )\n})\n\ndescribe('createLazyRoute has the same hooks as getRouteApi', () => {\n  const routeApi = getRouteApi('foo')\n  const route = createLazyRoute({})({})\n  const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))\n\n  it.each(hookNames.map((name) => [name]))(\n    'should have the \"%s\" hook defined',\n    (hookName) => {\n      expect(route[hookName as keyof LazyRoute<any>]).toBeDefined()\n    },\n  )\n})\n"
  },
  {
    "path": "packages/react-router/tests/lazy/error.tsx",
    "content": "import { createLazyRoute } from '../../src'\n\nexport function Route(id: string) {\n  return createLazyRoute(id)({\n    component: () => <div>About route content</div>,\n    errorComponent: ({ error }) => <div>Lazy Error: {error.message}</div>,\n  })\n}\n"
  },
  {
    "path": "packages/react-router/tests/lazy/heavy.tsx",
    "content": "import { createLazyRoute } from '../../src'\nimport HeavyComponent from './mockHeavyDependenciesRoute'\n\nexport default function Route(id: string) {\n  return createLazyRoute(id)({\n    component: HeavyComponent,\n  })\n}\n"
  },
  {
    "path": "packages/react-router/tests/lazy/mockHeavyDependenciesRoute.tsx",
    "content": "// This mimicks the waiting of heavy dependencies, which need to be streamed in before the component is available.\nawait new Promise((resolve) => setTimeout(resolve, 2500))\n\nexport default function HeavyComponent() {\n  return <h1>I am sooo heavy</h1>\n}\n"
  },
  {
    "path": "packages/react-router/tests/lazy/normal.tsx",
    "content": "import { createLazyFileRoute, createLazyRoute } from '../../src'\n\nexport function Route(id: string) {\n  return createLazyRoute(id)({\n    component: () => <h1>I'm a normal route</h1>,\n  })\n}\n\nexport function FileRoute(id: string) {\n  return createLazyFileRoute(id as any)({\n    component: () => <h1>I'm a normal file route</h1>,\n  })\n}\n"
  },
  {
    "path": "packages/react-router/tests/link.bench.tsx",
    "content": "import { render } from '@testing-library/react'\nimport { bench, describe } from 'vitest'\nimport {\n  Link,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  interpolatePath,\n  useRouter,\n} from '../src'\nimport type { LinkProps } from '../src'\n\nconst createRouterRenderer =\n  (routesCount: number) => (children: React.ReactNode) => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => children,\n    })\n    const paramRoutes = Array.from({ length: routesCount }).map((_, i) =>\n      createRoute({\n        getParentRoute: () => rootRoute,\n        path: `/params/$param${i}`,\n      }),\n    )\n    const routeTree = rootRoute.addChildren([indexRoute, ...paramRoutes])\n    return createRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n  }\n\nconst InterpolatePathLink = ({\n  to,\n  params,\n  children,\n}: React.PropsWithChildren<LinkProps>) => {\n  const href = interpolatePath({ path: to, params }).interpolatedPath\n  return <a href={href}>{children}</a>\n}\n\nconst BuildLocationLink = ({\n  children,\n  ...props\n}: React.PropsWithChildren<LinkProps>) => {\n  const router = useRouter()\n  const { href } = router.buildLocation(props)\n  return <a href={href}>{children}</a>\n}\n\ndescribe.each([\n  {\n    name: 'small router',\n    numberOfRoutes: 1,\n    matchedParamId: 0, // range from 0 to numberOfRoutes-1\n    numberOfLinks: 5000,\n  },\n  {\n    name: 'medium router',\n    numberOfRoutes: 1000,\n    matchedParamId: 500, // range from 0 to numberOfRoutes-1\n    numberOfLinks: 5000,\n  },\n  // {\n  //   name: 'large router',\n  //   numberOfRoutes: 10000,\n  //   matchedParamId: 9999, // range from 0 to numberOfRoutes-1\n  //   numberOfLinks: 15000,\n  // },\n])('$name', ({ numberOfRoutes, numberOfLinks, matchedParamId }) => {\n  const renderRouter = createRouterRenderer(numberOfRoutes)\n\n  bench(\n    'hardcoded href',\n    () => {\n      const router = renderRouter(\n        Array.from({ length: numberOfLinks }).map((_, i) => (\n          <a key={i} href={`/params/${i}`}>\n            {i}\n          </a>\n        )),\n      )\n      render(<RouterProvider router={router} />)\n    },\n    { warmupIterations: 1 },\n  )\n\n  bench(\n    'interpolate path',\n    () => {\n      const router = renderRouter(\n        Array.from({ length: numberOfLinks }).map((_, i) => (\n          <InterpolatePathLink\n            key={i}\n            to={`/params/$param${Math.min(i, matchedParamId)}`}\n            params={{ [`param${Math.min(i, matchedParamId)}`]: i }}\n          >\n            {i}\n          </InterpolatePathLink>\n        )),\n      )\n      render(<RouterProvider router={router} />)\n    },\n    { warmupIterations: 1 },\n  )\n\n  bench(\n    'build location',\n    () => {\n      const router = renderRouter(\n        Array.from({ length: numberOfLinks }).map((_, i) => (\n          <BuildLocationLink\n            key={i}\n            to={`/params/$param${Math.min(i, matchedParamId)}`}\n            params={{ [`param${Math.min(i, matchedParamId)}`]: i }}\n          >\n            {i}\n          </BuildLocationLink>\n        )),\n      )\n      render(<RouterProvider router={router} />)\n    },\n    { warmupIterations: 1 },\n  )\n\n  bench(\n    'link to absolute path',\n    () => {\n      const router = renderRouter(\n        Array.from({ length: numberOfLinks }).map((_, i) => (\n          <Link\n            key={i}\n            to={`/params/$param${Math.min(i, matchedParamId)}`}\n            params={{ [`param${Math.min(i, matchedParamId)}`]: i }}\n          >\n            {i}\n          </Link>\n        )),\n      )\n      render(<RouterProvider router={router} />)\n    },\n    { warmupIterations: 1 },\n  )\n\n  bench(\n    'link to relative path',\n    () => {\n      const router = renderRouter(\n        Array.from({ length: numberOfLinks }).map((_, i) => {\n          const to = `./params/$param${Math.min(i, matchedParamId)}`\n\n          return (\n            <Link\n              key={i}\n              from=\"/\"\n              to={to}\n              params={{ [`param${Math.min(i, matchedParamId)}`]: i }}\n            >\n              {i}\n            </Link>\n          )\n        }),\n      )\n      render(<RouterProvider router={router} />)\n    },\n    { warmupIterations: 1 },\n  )\n\n  bench(\n    'link to current path',\n    () => {\n      const router = renderRouter(\n        Array.from({ length: numberOfLinks }).map((_, i) => (\n          <Link key={i} from=\"/\" search={{ param: i }}>\n            {i}\n          </Link>\n        )),\n      )\n      render(<RouterProvider router={router} />)\n    },\n    { warmupIterations: 1 },\n  )\n})\n"
  },
  {
    "path": "packages/react-router/tests/link.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport React from 'react'\nimport {\n  Link,\n  createLink,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  linkOptions,\n} from '../src'\nimport type {\n  CreateLinkProps,\n  LinkComponent,\n  ResolveRelativePath,\n  SearchSchemaInput,\n} from '../src'\n\nconst rootRoute = createRootRoute({\n  validateSearch: (): { rootPage?: number } => ({ rootPage: 0 }),\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n  validateSearch: () => ({ rootIndexPage: 0 }),\n})\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'posts',\n})\n\nconst postsIndexRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '/',\n})\n\nconst postRoute = createRoute({\n  getParentRoute: () => postsRoute,\n  path: '$postId',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: (): { page?: number } => ({ page: 0 }),\n})\n\nconst invoiceEditRoute = createRoute({\n  getParentRoute: () => invoiceRoute,\n  path: 'edit',\n  validateSearch: () => ({ editId: 0 }),\n})\n\nconst invoiceDetailsRoute = createRoute({\n  getParentRoute: () => invoiceRoute,\n  path: 'details',\n  validateSearch: (): { page?: number } => ({ page: 0 }),\n})\n\nconst detailRoute = createRoute({\n  getParentRoute: () => invoiceDetailsRoute,\n  path: '$detailId',\n})\n\nconst linesRoute = createRoute({\n  getParentRoute: () => detailRoute,\n  path: 'lines',\n  validateSearch: (input: { linesPage?: number } & SearchSchemaInput) => {\n    if (typeof input.linesPage !== 'number') throw new Error()\n\n    return {\n      linesPage: input.linesPage,\n    }\n  },\n})\n\nconst linesFormRoute = createRoute({\n  getParentRoute: () => linesRoute,\n  path: 'form',\n  validateSearch: (): { mode: 'new' | 'edit' | 'view' } => ({ mode: 'view' }),\n})\n\nconst linesFormEditRoute = createRoute({\n  getParentRoute: () => linesFormRoute,\n  path: 'edit',\n  validateSearch: (): { mode: 'view' | 'edit' | 'cancel' } => ({\n    mode: 'view',\n  }),\n})\n\nconst routeTreeTuples = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute, postsIndexRoute]),\n  invoicesRoute.addChildren([\n    invoicesIndexRoute,\n    invoiceRoute.addChildren([\n      invoiceEditRoute,\n      invoiceDetailsRoute.addChildren([\n        detailRoute.addChildren([\n          linesRoute.addChildren([\n            linesFormRoute.addChildren([linesFormEditRoute]),\n          ]),\n        ]),\n      ]),\n    ]),\n  ]),\n  indexRoute,\n])\n\nconst routeTreeObjects = rootRoute.addChildren({\n  postsRoute: postsRoute.addChildren({ postRoute, postsIndexRoute }),\n  invoicesRoute: invoicesRoute.addChildren({\n    invoicesIndexRoute,\n    invoiceRoute: invoiceRoute.addChildren({\n      invoiceEditRoute,\n      invoiceDetailsRoute: invoiceDetailsRoute.addChildren({\n        detailRoute: detailRoute.addChildren({\n          linesRoute: linesRoute.addChildren({\n            linesFormRoute: linesFormRoute.addChildren({ linesFormEditRoute }),\n          }),\n        }),\n      }),\n    }),\n  }),\n  indexRoute,\n})\n\nconst defaultRouter = createRouter({\n  routeTree: routeTreeTuples,\n})\n\nconst defaultRouterObjects = createRouter({\n  routeTree: routeTreeObjects,\n})\n\nconst routerAlwaysTrailingSlashes = createRouter({\n  routeTree: routeTreeTuples,\n  trailingSlash: 'always',\n})\n\nconst routerNeverTrailingSlashes = createRouter({\n  routeTree: routeTreeTuples,\n  trailingSlash: 'never',\n})\n\nconst routerPreserveTrailingSlashes = createRouter({\n  routeTree: routeTreeTuples,\n  trailingSlash: 'preserve',\n})\n\ntype DefaultRouter = typeof defaultRouter\n\ntype DefaultRouterObjects = typeof defaultRouterObjects\n\ntype RouterAlwaysTrailingSlashes = typeof routerAlwaysTrailingSlashes\n\ntype RouterNeverTrailingSlashes = typeof routerNeverTrailingSlashes\n\ntype RouterPreserveTrailingSlashes = typeof routerPreserveTrailingSlashes\n\ntest('when navigating to the root', () => {\n  const DefaultRouterLink = Link<DefaultRouter, string, '/'>\n  const DefaultRouterObjectsLink = Link<DefaultRouterObjects, string, '/'>\n  const RouterAlwaysTrailingSlashLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/'\n  >\n  const RouterNeverTrailingSlashLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/'\n  >\n  const RouterPreserveTrailingSlashLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    '/'\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../'\n      | './'\n      | '/'\n      | '/invoices/'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/edit/'\n      | '/posts/'\n      | '/posts/$postId/'\n    >()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | './'\n      | '../'\n      | '/'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/edit/'\n      | '/posts'\n      | '/posts/'\n      | '/posts/$postId'\n      | '/posts/$postId/'\n    >()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n})\n\ntest('when navigating from a route with no params and no search to the root', () => {\n  expectTypeOf(Link<DefaultRouter, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/posts'\n      | '/posts/$postId'\n      | '$postId'\n      | undefined\n    >()\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/posts'\n      | '/posts/$postId'\n      | '$postId'\n      | undefined\n    >()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../'\n      | './'\n      | '/'\n      | '/invoices/'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/edit/'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '/posts/'\n      | '/posts/$postId/'\n      | '$postId/'\n      | undefined\n    >()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/posts'\n      | '/posts/$postId'\n      | '$postId'\n      | undefined\n    >()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '.'\n      | '..'\n      | '../'\n      | './'\n      | '/'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/edit/'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '/posts'\n      | '/posts/'\n      | '/posts/$postId'\n      | '/posts/$postId/'\n      | '$postId'\n      | '$postId/'\n      | undefined\n    >()\n\n  expectTypeOf(Link<DefaultRouter, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>().toEqualTypeOf<{\n    rootPage?: number\n    rootIndexPage: number\n  }>\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>().toEqualTypeOf<{\n    rootPage?: number\n    rootIndexPage: number\n  }>\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>().toEqualTypeOf<{\n    rootPage?: number\n    rootIndexPage: number\n  }>\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>().toEqualTypeOf<{\n    rootPage?: number\n    rootIndexPage: number\n  }>\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts' | '/posts/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>().toEqualTypeOf<{\n    rootPage?: number\n    rootIndexPage: number\n  }>\n\n  expectTypeOf(Link<DefaultRouter, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      rootIndexPage: number\n    }>()\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      rootIndexPage: number\n    }>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      rootIndexPage: number\n    }>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      rootIndexPage: number\n    }>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts' | '/posts/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      rootIndexPage: number\n    }>()\n\n  expectTypeOf(Link<DefaultRouter, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts' | '/posts/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n})\n\ntest('when navigating from a route with no params and no search to the current route', () => {\n  expectTypeOf(Link<DefaultRouter, '/posts', '.'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'./$postId' | undefined | '.'>()\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts', '.'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'./$postId' | undefined | '.'>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'./$postId/' | undefined | './'>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts', '.'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'./$postId' | undefined | '.'>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'./$postId/' | './$postId' | undefined | './' | '.'>()\n\n  expectTypeOf(Link<DefaultRouter, '/posts/', '.'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined | true>()\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts/', '.'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined | true>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined | true>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts/', '.'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined | true>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined | true>()\n\n  expectTypeOf(Link<DefaultRouter, '/posts/', '.'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<DefaultRouter, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts/', './'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n})\n\ntest('when navigating from a route with no params and no search to the parent route', () => {\n  expectTypeOf(Link<DefaultRouter, '/posts', '..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../posts'\n      | '../posts/$postId'\n      | '../invoices/$invoiceId'\n      | '../invoices/$invoiceId/edit'\n      | '../invoices/$invoiceId/details'\n      | '../invoices/$invoiceId/details/$detailId'\n      | '../invoices/$invoiceId/details/$detailId/lines'\n      | '../invoices/$invoiceId/details/$detailId/lines/form'\n      | '../invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '../invoices'\n      | '..'\n      | undefined\n    >()\n\n  expectTypeOf(Link<DefaultRouterObjects, '/posts', '..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../posts'\n      | '../posts/$postId'\n      | '../invoices/$invoiceId'\n      | '../invoices/$invoiceId/edit'\n      | '../invoices/$invoiceId/details'\n      | '../invoices/$invoiceId/details/$detailId'\n      | '../invoices/$invoiceId/details/$detailId/lines'\n      | '../invoices/$invoiceId/details/$detailId/lines/form'\n      | '../invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '../invoices'\n      | '..'\n      | undefined\n    >()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts', '../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../posts/'\n      | '../posts/$postId/'\n      | '../invoices/$invoiceId/'\n      | '../invoices/$invoiceId/edit/'\n      | '../invoices/$invoiceId/details/'\n      | '../invoices/$invoiceId/details/$detailId/'\n      | '../invoices/$invoiceId/details/$detailId/lines/'\n      | '../invoices/$invoiceId/details/$detailId/lines/form/'\n      | '../invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '../invoices/'\n      | '../'\n      | undefined\n    >()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts', '..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../posts'\n      | '../posts/$postId'\n      | '../invoices/$invoiceId'\n      | '../invoices/$invoiceId/edit'\n      | '../invoices/$invoiceId/details'\n      | '../invoices/$invoiceId/details/$detailId'\n      | '../invoices/$invoiceId/details/$detailId/lines'\n      | '../invoices/$invoiceId/details/$detailId/lines/form'\n      | '../invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '../invoices'\n      | '..'\n      | undefined\n    >()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts', '..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../posts'\n      | '../posts/'\n      | '../posts/$postId'\n      | '../posts/$postId/'\n      | '../invoices/$invoiceId'\n      | '../invoices/$invoiceId/'\n      | '../invoices/$invoiceId/edit'\n      | '../invoices/$invoiceId/edit/'\n      | '../invoices/$invoiceId/details'\n      | '../invoices/$invoiceId/details/'\n      | '../invoices/$invoiceId/details/$detailId'\n      | '../invoices/$invoiceId/details/$detailId/'\n      | '../invoices/$invoiceId/details/$detailId/lines'\n      | '../invoices/$invoiceId/details/$detailId/lines/'\n      | '../invoices/$invoiceId/details/$detailId/lines/form'\n      | '../invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '../invoices/$invoiceId/details/$detailId/lines/form/'\n      | '../invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '../invoices'\n      | '../invoices/'\n      | '../'\n      | '..'\n      | undefined\n    >()\n})\n\ntest('cannot navigate to a branch with an index', () => {\n  expectTypeOf(Link<DefaultRouter, string, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts'\n      | '/posts/$postId'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '.'\n      | '..'\n    >()\n\n  expectTypeOf(Link<DefaultRouterObjects, string, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts'\n      | '/posts/$postId'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '.'\n      | '..'\n    >()\n\n  expectTypeOf(\n    Link<RouterAlwaysTrailingSlashes, string, '/invoices/$invoiceId'>,\n  )\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/'\n      | '/posts/$postId/'\n      | '/invoices/'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/edit/'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | './'\n      | '../'\n    >()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, string, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts'\n      | '/posts/$postId'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '.'\n      | '..'\n    >()\n\n  expectTypeOf(\n    Link<RouterPreserveTrailingSlashes, string, '/invoices/$invoiceId'>,\n  )\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts'\n      | '/posts/'\n      | '/posts/$postId'\n      | '/posts/$postId/'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/edit/'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '.'\n      | '..'\n      | './'\n      | '../'\n    >()\n})\n\ntest('from autocompletes to all absolute routes', () => {\n  const DefaultRouterLink = Link<DefaultRouter, '/', '/'>\n  const DefaultRouterObjectsLink = Link<DefaultRouterObjects, '/', '/'>\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId'\n      | '/posts/'\n      | '/posts'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | undefined\n    >()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId'\n      | '/posts/'\n      | '/posts'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | undefined\n    >()\n})\n\ntest('from does not allow invalid routes', () => {\n  const DefaultRouterLink = Link<DefaultRouter, '/invalid', '/'>\n  const DefaultRouterObjectsLink = Link<DefaultRouterObjects, '/invalid', '/'>\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId'\n      | '/posts/'\n      | '/posts'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | undefined\n    >()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId'\n      | '/posts/'\n      | '/posts'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | undefined\n    >()\n})\n\ntest('when navigating to the same route', () => {\n  const DefaultRouterLink = Link<DefaultRouter, string, string>\n  const DefaultRouterObjectsLink = Link<DefaultRouterObjects, string, string>\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    string\n  >\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    string\n  >\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    string\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n})\n\ntest('when navigating to the parent route', () => {\n  const DefaultRouterLink = Link<DefaultRouter, string, '..'>\n  const DefaultRouterObjectsLink = Link<DefaultRouterObjects, string, '..'>\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '../'\n  >\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '..'\n  >\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '..'\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n})\n\ntest('when navigating from a route with params to the same route', () => {\n  const DefaultRouterLink = Link<DefaultRouter, '/posts/$postId', string>\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    '/posts/$postId',\n    string\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    '/posts/$postId',\n    string\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/posts/$postId',\n    string\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    '/posts/$postId',\n    string\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('params')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n})\n\ntest('when navigating to a route with params', () => {\n  const DefaultRouterLink = Link<DefaultRouter, string, '/posts/$postId'>\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    string,\n    '/posts/$postId'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/posts/$postId/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/posts/$postId'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    '/posts/$postId/' | '/posts/$postId'\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  const defaultRouterLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const defaultRouterObjectsLinkParams = expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerAlwaysTrailingSlashesLinkParams = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerNeverTrailingSlashesLinkParams = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerPreserveTrailingSlashesLinkParams = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  defaultRouterLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  defaultRouterObjectsLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  routerNeverTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  routerPreserveTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  defaultRouterLinkParams.returns.toEqualTypeOf<{ postId: string }>()\n\n  defaultRouterObjectsLinkParams.returns.toEqualTypeOf<{ postId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    postId: string\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    postId: string\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    postId: string\n  }>()\n\n  defaultRouterLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  defaultRouterObjectsLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerAlwaysTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n})\n\ntest('when navigating from a route with no params to a route with params', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    '/invoices',\n    './$invoiceId/edit'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    '/invoices',\n    './$invoiceId/edit'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    '/invoices',\n    './$invoiceId/edit/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices',\n    './$invoiceId/edit'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices',\n    './$invoiceId/edit' | './invoicesId/edit/'\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  const defaultRouterLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const defaultRouterObjectsLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerAlwaysTrailingSlashesLinkParams = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerNeverTrailingSlashesLinkParams = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerPreserveTrailingSlashesLinkParams = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  defaultRouterLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  defaultRouterObjectsLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  routerNeverTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  routerPreserveTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  defaultRouterLinkParams.returns.toEqualTypeOf<{ invoiceId: string }>()\n\n  defaultRouterObjectsLinkParams.returns.toEqualTypeOf<{ invoiceId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId: string\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId: string\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId: string\n  }>()\n\n  defaultRouterLinkParams.parameter(0).toEqualTypeOf<{}>()\n\n  defaultRouterObjectsLinkParams.parameter(0).toEqualTypeOf<{}>()\n\n  routerAlwaysTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{}>()\n\n  routerNeverTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{}>()\n\n  routerPreserveTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{}>()\n})\n\ntest('when navigating from a route to a route with the same params', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    '/invoices/$invoiceId',\n    './edit'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    '/invoices/$invoiceId',\n    './edit'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    '/invoices/$invoiceId',\n    './edit/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices/$invoiceId',\n    './edit'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices/$invoiceId',\n    './edit' | './edit/'\n  >\n\n  const defaultRouterLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const defaultRouterObjectsLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerAlwaysTrailingSlashesLinkParams = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerNeverTrailingSlashesLinkParams = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerPreserveTrailingSlashesLinkParams = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  defaultRouterLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined } | undefined>()\n\n  defaultRouterObjectsLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined } | undefined>()\n\n  routerAlwaysTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined } | undefined>()\n\n  routerNeverTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined } | undefined>()\n\n  routerPreserveTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined } | undefined>()\n\n  defaultRouterLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string | undefined\n  }>()\n\n  defaultRouterObjectsLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string | undefined\n  }>()\n\n  routerAlwaysTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string | undefined\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string | undefined\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string | undefined\n  }>()\n\n  defaultRouterLinkParams.parameter(0).toEqualTypeOf<{ invoiceId: string }>()\n\n  defaultRouterObjectsLinkParams\n    .parameter(0)\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams\n    .parameter(0)\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  routerNeverTrailingSlashesLinkParams\n    .parameter(0)\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  routerPreserveTrailingSlashesLinkParams\n    .parameter(0)\n    .toEqualTypeOf<{ invoiceId: string }>()\n})\n\ntest('when navigating from a route with params to a route with different params', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    '/invoices/$invoiceId',\n    '../../posts/$postId'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    '/invoices/$invoiceId',\n    '../../posts/$postId'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    '/invoices/$invoiceId',\n    '../../posts/$postId/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices/$invoiceId',\n    '../../posts/$postId'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    '/invoices/$invoiceId',\n    '../../posts/$postId' | '../../posts/$postId/'\n  >\n\n  const defaultRouterLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const defaultRouterObjectsLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerAlwaysTrailingSlashesLinkParams = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerNeverTrailingSlashesLinkParams = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerPreserveTrailingSlashesLinkParams = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  defaultRouterLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  defaultRouterObjectsLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  routerNeverTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  routerPreserveTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  defaultRouterLinkParams.returns.toEqualTypeOf<{ postId: string }>()\n\n  defaultRouterObjectsLinkParams.returns.toEqualTypeOf<{ postId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    postId: string\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    postId: string\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    postId: string\n  }>()\n\n  defaultRouterLinkParams.parameter(0).toEqualTypeOf<{ invoiceId: string }>()\n\n  defaultRouterObjectsLinkParams\n    .parameter(0)\n    .toEqualTypeOf<{ invoiceId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId: string\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId: string\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams\n    .parameter(0)\n    .toEqualTypeOf<{ invoiceId: string }>()\n})\n\ntest('when navigating from a route with params to a route with an additional param', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    '/invoices/$invoiceId',\n    './details/$detailId'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    '/invoices/$invoiceId',\n    './details/$detailId'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    '/invoices/$invoiceId',\n    './details/$detailId/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices/$invoiceId',\n    './details/$detailId'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    '/invoices/$invoiceId',\n    './details/$detailId' | './details/$detailId'\n  >\n\n  const defaultRouterLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const defaultRouterObjectsLinkParams = expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerAlwaysTrailingSlashesLinkParams = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerNeverTrailingSlashesLinkParams = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerPreserveTrailingSlashesLinkParams = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  defaultRouterLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined; detailId: string }>()\n\n  defaultRouterObjectsLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined; detailId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined; detailId: string }>()\n\n  routerNeverTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined; detailId: string }>()\n\n  routerPreserveTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId?: string | undefined; detailId: string }>()\n\n  defaultRouterLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string\n    detailId: string\n  }>()\n\n  defaultRouterObjectsLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string\n    detailId: string\n  }>()\n\n  routerAlwaysTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string\n    detailId: string\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string\n    detailId: string\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams.returns.toEqualTypeOf<{\n    invoiceId?: string\n    detailId: string\n  }>()\n})\n\ntest('when navigating to a union of routes with params', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    string,\n    '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    string,\n    '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/edit/' | '/posts/$postId/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    | '/invoices/$invoiceId/edit'\n    | '/invoices/$invoiceId/edit/'\n    | '/posts/$postId'\n    | '/posts/$postId/'\n  >\n\n  const defaultRouterLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const defaultRouterObjectsLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerAlwaysTrailingSlashesLinkParams = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerNeverTrailingSlashesLinkParams = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerPreserveTrailingSlashesLinkParams = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ params: unknown }>()\n\n  defaultRouterLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string } | { postId: string }>()\n\n  defaultRouterObjectsLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string } | { postId: string }>()\n\n  routerAlwaysTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string } | { postId: string }>()\n\n  routerNeverTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string } | { postId: string }>()\n\n  routerPreserveTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ invoiceId: string } | { postId: string }>()\n\n  defaultRouterLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string }\n  >()\n\n  defaultRouterObjectsLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string }\n  >()\n\n  routerAlwaysTrailingSlashesLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string }\n  >()\n\n  routerNeverTrailingSlashesLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string }\n  >()\n\n  routerPreserveTrailingSlashesLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string }\n  >()\n\n  defaultRouterLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  defaultRouterObjectsLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerAlwaysTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n})\n\ntest('when navigating to a union of routes including the root', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    string,\n    '/' | '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    string,\n    '/' | '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/' | '/invoices/$invoiceId/edit/' | '/posts/$postId/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/' | '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    | '/'\n    | '/invoices/$invoiceId/edit'\n    | '/invoices/$invoiceId/edit/'\n    | '/posts/$postId'\n    | '/posts/$postId/'\n  >\n\n  const defaultRouterLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const defaultRouterObjectsLinkParams = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerAlwaysTrailingSlashesLinkParams = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerNeverTrailingSlashesLinkParams = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  const routerPreserveTrailingSlashesLinkParams = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ params: unknown }>()\n\n  defaultRouterLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      { invoiceId: string } | { postId: string } | {} | undefined\n    >()\n\n  defaultRouterObjectsLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      { invoiceId: string } | { postId: string } | {} | undefined\n    >()\n\n  routerAlwaysTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      { invoiceId: string } | { postId: string } | {} | undefined\n    >()\n\n  routerNeverTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      { invoiceId: string } | { postId: string } | {} | undefined\n    >()\n\n  routerPreserveTrailingSlashesLinkParams\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      { invoiceId: string } | { postId: string } | {} | undefined\n    >()\n\n  defaultRouterLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string } | {}\n  >()\n\n  defaultRouterObjectsLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string } | {}\n  >()\n\n  routerAlwaysTrailingSlashesLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string } | {}\n  >()\n\n  routerNeverTrailingSlashesLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string } | {}\n  >()\n\n  routerPreserveTrailingSlashesLinkParams.returns.toEqualTypeOf<\n    { invoiceId: string } | { postId: string } | {}\n  >()\n\n  defaultRouterLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  defaultRouterObjectsLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerAlwaysTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerNeverTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n\n  routerPreserveTrailingSlashesLinkParams.parameter(0).toEqualTypeOf<{\n    invoiceId?: string\n    postId?: string\n    detailId?: string\n  }>()\n})\n\ntest('when navigating from a route with search params to the same route', () => {\n  const DefaultRouterLink = Link<DefaultRouter, '/invoices/$invoiceId', string>\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    '/invoices/$invoiceId',\n    string\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    '/invoices/$invoiceId',\n    string\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices/$invoiceId',\n    string\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices/$invoiceId',\n    string\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .extract<boolean>()\n    .toEqualTypeOf<true>()\n})\n\ntest('when navigating to a route with search params', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    string,\n    '/invoices/$invoiceId/edit'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouter,\n    string,\n    '/invoices/$invoiceId/edit'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/edit/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/edit'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/edit' | '/invoices/$invoiceId/edit/'\n  >\n\n  const defaultRouterLinkSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const defaultRouterObjectsLinkSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerAlwaysTrailingSlashesLinkSearch = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerNeverTrailingSlashesLinkSearch = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerPreserveTrailingSlashesLinkSearch = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  defaultRouterLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; page?: number; editId: number }>()\n\n  defaultRouterObjectsLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; page?: number; editId: number }>()\n\n  routerAlwaysTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; page?: number; editId: number }>()\n\n  routerNeverTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; page?: number; editId: number }>()\n\n  routerPreserveTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; page?: number; editId: number }>()\n\n  defaultRouterLinkSearch.returns.toEqualTypeOf<{\n    page?: number\n    rootPage?: number\n    editId: number\n  }>()\n\n  defaultRouterObjectsLinkSearch.returns.toEqualTypeOf<{\n    page?: number\n    rootPage?: number\n    editId: number\n  }>()\n\n  routerAlwaysTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    page?: number\n    rootPage?: number\n    editId: number\n  }>()\n\n  routerNeverTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n    editId: number\n  }>()\n\n  routerPreserveTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    page?: number\n    rootPage?: number\n    editId: number\n  }>()\n\n  defaultRouterLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  defaultRouterObjectsLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerAlwaysTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerNeverTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerPreserveTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n})\n\ntest('when navigating to a route with optional search params', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    string,\n    '/invoices/$invoiceId/details/$detailId'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    string,\n    '/invoices/$invoiceId/details/$detailId'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/details/$detailId/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/details/$detailId'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    | '/invoices/$invoiceId/details/$detailId'\n    | '/invoices/$invoiceId/details/$detailId/'\n  >\n\n  const defaultRouterLinkSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const defaultRouterObjectsLinkSearch = expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerAlwaysTrailingSlashesLinkSearch = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerNeverTrailingSlashesLinkSearch = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerPreserveTrailingSlashesLinkSearch = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  defaultRouterLinkSearch.exclude<Function | boolean>().toEqualTypeOf<\n    | {\n        rootPage?: number\n        page?: number\n      }\n    | undefined\n  >()\n\n  defaultRouterObjectsLinkSearch.exclude<Function | boolean>().toEqualTypeOf<\n    | {\n        rootPage?: number\n        page?: number\n      }\n    | undefined\n  >()\n\n  routerAlwaysTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | {\n          rootPage?: number\n          page?: number\n        }\n      | undefined\n    >()\n\n  routerNeverTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | {\n          rootPage?: number\n          page?: number\n        }\n      | undefined\n    >()\n\n  routerPreserveTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | {\n          rootPage?: number\n          page?: number\n        }\n      | undefined\n    >()\n\n  defaultRouterLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n  }>()\n\n  defaultRouterObjectsLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n  }>()\n\n  routerAlwaysTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n  }>()\n\n  routerNeverTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n  }>()\n\n  routerPreserveTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n  }>()\n\n  defaultRouterLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  defaultRouterObjectsLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerAlwaysTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerNeverTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerPreserveTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n})\n\ntest('when navigating from a route with no search params to a route with search params', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    '/invoices/',\n    './$invoiceId/edit'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    '/invoices/',\n    './$invoiceId/edit'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    '/invoices/',\n    './$invoiceId/edit/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/invoices/',\n    './$invoiceId/edit'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    '/invoices/',\n    './$invoiceId/edit/' | './$invoiceId/edit'\n  >\n\n  const defaultRouterLinkSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const defaultRouterObjectsLinkSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerAlwaysTrailingSlashesLinkSearch = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerNeverTrailingSlashesLinkSearch = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerPreserveTrailingSlashesLinkSearch = expectTypeOf(\n    RouterPreserveTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  defaultRouterLinkSearch.exclude<Function | boolean>().toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n    editId: number\n  }>()\n\n  defaultRouterObjectsLinkSearch.exclude<Function | boolean>().toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n    editId: number\n  }>()\n\n  routerAlwaysTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{\n      rootPage?: number\n      page?: number\n      editId: number\n    }>()\n\n  routerNeverTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{\n      rootPage?: number\n      page?: number\n      editId: number\n    }>()\n\n  defaultRouterLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n    editId: number\n  }>()\n\n  defaultRouterObjectsLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n    editId: number\n  }>()\n\n  routerAlwaysTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n    editId: number\n  }>()\n\n  routerNeverTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n    editId: number\n  }>()\n\n  routerPreserveTrailingSlashesLinkSearch.returns.toEqualTypeOf<{\n    rootPage?: number\n    page?: number\n    editId: number\n  }>()\n\n  defaultRouterLinkSearch.parameter(0).toEqualTypeOf<{ rootPage?: number }>()\n\n  defaultRouterObjectsLinkSearch\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  routerAlwaysTrailingSlashesLinkSearch\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  routerNeverTrailingSlashesLinkSearch\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n\n  routerPreserveTrailingSlashesLinkSearch\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number }>()\n})\n\ntest('when navigating to a union of routes with search params', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    string,\n    '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    string,\n    '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/edit/' | '/posts/$postId/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    | '/invoices/$invoiceId/edit'\n    | '/posts/$postId'\n    | '/invoices/$invoiceId/edit/'\n    | '/posts/$postId/'\n  >\n\n  const defaultRouterLinkSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const defaultRouterObjectsLinkSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerAlwaysTrailingSlashesSearch = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerNeverTrailingSlashesSearch = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerPreserveTrailingSlashesSearch = expectTypeOf(\n    RouterNeverTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  defaultRouterLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number }\n      | undefined\n    >()\n\n  defaultRouterObjectsLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number }\n      | undefined\n    >()\n\n  routerAlwaysTrailingSlashesSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number }\n      | undefined\n    >()\n\n  routerNeverTrailingSlashesSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number }\n      | undefined\n    >()\n\n  routerPreserveTrailingSlashesSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number }\n      | undefined\n    >()\n\n  defaultRouterLinkSearch.returns.toEqualTypeOf<\n    { rootPage?: number; page?: number; editId: number } | { rootPage?: number }\n  >()\n\n  defaultRouterObjectsLinkSearch.returns.toEqualTypeOf<\n    { rootPage?: number; page?: number; editId: number } | { rootPage?: number }\n  >()\n\n  routerAlwaysTrailingSlashesSearch.returns.toEqualTypeOf<\n    { rootPage?: number; page?: number; editId: number } | { rootPage?: number }\n  >()\n\n  routerNeverTrailingSlashesSearch.returns.toEqualTypeOf<\n    { rootPage?: number; page?: number; editId: number } | { rootPage?: number }\n  >()\n\n  routerPreserveTrailingSlashesSearch.returns.toEqualTypeOf<\n    { rootPage?: number; page?: number; editId: number } | { rootPage?: number }\n  >()\n\n  defaultRouterLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  defaultRouterObjectsLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerAlwaysTrailingSlashesSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerNeverTrailingSlashesSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerPreserveTrailingSlashesSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n})\n\ntest('when navigating to a union of routes with search params including the root', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    string,\n    '/' | '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    string,\n    '/' | '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/' | '/invoices/$invoiceId/edit/' | '/posts/$postId/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/' | '/invoices/$invoiceId/edit' | '/posts/$postId'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    | '/'\n    | '/invoices/$invoiceId/edit'\n    | '/posts/$postId'\n    | '/invoices/$invoiceId/edit/'\n    | '/posts/$postId/'\n  >\n\n  const defaultRouterSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const defaultRouterObjectsSearch = expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerAlwaysTrailingSlashesLinkSearch = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerNeverTrailingSlashesLinkSearch = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  const routerPreserveTrailingSlashesLinkSearch = expectTypeOf(\n    RouterAlwaysTrailingSlashesLink,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .not.toMatchTypeOf<{ search: unknown }>()\n\n  defaultRouterSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number }\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number; rootIndexPage: number }\n      | undefined\n    >()\n\n  defaultRouterObjectsSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number }\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number; rootIndexPage: number }\n      | undefined\n    >()\n\n  routerAlwaysTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number }\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number; rootIndexPage: number }\n      | undefined\n    >()\n\n  routerNeverTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number }\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number; rootIndexPage: number }\n      | undefined\n    >()\n\n  routerPreserveTrailingSlashesLinkSearch\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<\n      | { rootPage?: number }\n      | { rootPage?: number; page?: number; editId: number }\n      | { rootPage?: number; rootIndexPage: number }\n      | undefined\n    >()\n\n  defaultRouterSearch.returns.toEqualTypeOf<\n    | { rootPage?: number; page?: number; editId: number }\n    | { rootPage?: number; rootIndexPage: number }\n    | { rootPage?: number }\n  >()\n\n  defaultRouterObjectsSearch.returns.toEqualTypeOf<\n    | { rootPage?: number; page?: number; editId: number }\n    | { rootPage?: number; rootIndexPage: number }\n    | { rootPage?: number }\n  >()\n\n  routerAlwaysTrailingSlashesLinkSearch.returns.toEqualTypeOf<\n    | { rootPage?: number; page?: number; editId: number }\n    | { rootPage?: number; rootIndexPage: number }\n    | { rootPage?: number }\n  >()\n\n  routerNeverTrailingSlashesLinkSearch.returns.toEqualTypeOf<\n    | { rootPage?: number; page?: number; editId: number }\n    | { rootPage?: number; rootIndexPage: number }\n    | { rootPage?: number }\n  >()\n\n  routerPreserveTrailingSlashesLinkSearch.returns.toEqualTypeOf<\n    | { rootPage?: number; page?: number; editId: number }\n    | { rootPage?: number; rootIndexPage: number }\n    | { rootPage?: number }\n  >()\n\n  defaultRouterSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  defaultRouterObjectsSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerAlwaysTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerNeverTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n\n  routerPreserveTrailingSlashesLinkSearch.parameter(0).toEqualTypeOf<{\n    page?: number\n    rootIndexPage?: number\n    rootPage?: number\n    linesPage?: number\n    editId?: number\n    mode?: 'new' | 'edit' | 'view'\n  }>()\n})\n\ntest('when navigating from the root to /posts', () => {\n  const DefaultRouterLink = Link<DefaultRouter, '/', '/posts'>\n\n  const DefaultRouterObjectsLink = Link<DefaultRouterObjects, '/', '/posts'>\n\n  const RouterAlwaysTrailingSlashesLink = Link<\n    RouterAlwaysTrailingSlashes,\n    '/',\n    '/posts/'\n  >\n\n  const RouterNeverTrailingSlashesLink = Link<\n    RouterNeverTrailingSlashes,\n    '/',\n    '/posts'\n  >\n\n  const RouterPreserveTrailingSlashesLink = Link<\n    RouterPreserveTrailingSlashes,\n    '/',\n    '/posts' | '/posts/'\n  >\n\n  expectTypeOf(DefaultRouterLink).not.toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink).not.toMatchTypeOf<{\n    search: unknown\n  }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink).not.toMatchTypeOf<{\n    search: unknown\n  }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink).not.toMatchTypeOf<{\n    search: unknown\n  }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink).not.toMatchTypeOf<{\n    search: unknown\n  }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number } | undefined>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<\n      { rootPage?: number } | { rootPage?: number; rootIndexPage: number }\n    >()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<\n      { rootPage?: number } | { rootPage?: number; rootIndexPage: number }\n    >()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<\n      { rootPage?: number } | { rootPage?: number; rootIndexPage: number }\n    >()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<\n      { rootPage?: number } | { rootPage?: number; rootIndexPage: number }\n    >()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<\n      { rootPage?: number } | { rootPage?: number; rootIndexPage: number }\n    >()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(RouterNeverTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashesLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number }>()\n})\n\ntest('when navigating to a route with SearchSchemaInput', () => {\n  expectTypeOf(\n    Link<\n      DefaultRouter,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | true>()\n    .toEqualTypeOf<\n      { rootPage?: number; page?: number; linesPage?: number } | undefined\n    >()\n\n  expectTypeOf(\n    Link<\n      DefaultRouterObjects,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | true>()\n    .toEqualTypeOf<\n      { rootPage?: number; page?: number; linesPage?: number } | undefined\n    >()\n\n  expectTypeOf(\n    Link<\n      RouterAlwaysTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines/'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | true>()\n    .toEqualTypeOf<\n      { rootPage?: number; page?: number; linesPage?: number } | undefined\n    >()\n\n  expectTypeOf(\n    Link<\n      RouterNeverTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | true>()\n    .toEqualTypeOf<\n      { rootPage?: number; page?: number; linesPage?: number } | undefined\n    >()\n\n  expectTypeOf(\n    Link<\n      RouterPreserveTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | true>()\n    .toEqualTypeOf<\n      { rootPage?: number; page?: number; linesPage?: number } | undefined\n    >()\n\n  expectTypeOf(\n    Link<DefaultRouter, string, '/invoices/$invoiceId/details/$detailId/lines'>,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      page?: number\n      linesPage?: number\n    }>()\n\n  expectTypeOf(\n    Link<\n      DefaultRouterObjects,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      page?: number\n      linesPage?: number\n    }>()\n\n  expectTypeOf(\n    Link<\n      RouterAlwaysTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines/'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      page?: number\n      linesPage?: number\n    }>()\n\n  expectTypeOf(\n    Link<\n      RouterNeverTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      page?: number\n      linesPage?: number\n    }>()\n\n  expectTypeOf(\n    Link<\n      RouterPreserveTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{\n      rootPage?: number\n      page?: number\n      linesPage?: number\n    }>()\n\n  expectTypeOf(\n    Link<\n      DefaultRouter,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number; page?: number; linesPage: number }>()\n\n  expectTypeOf(\n    Link<\n      DefaultRouterObjects,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number; page?: number; linesPage: number }>()\n\n  expectTypeOf(\n    Link<\n      RouterAlwaysTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines/'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number; page?: number; linesPage: number }>()\n\n  expectTypeOf(\n    Link<\n      RouterNeverTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      '/invoices/$invoiceId/details/$detailId/lines/'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number; page?: number; linesPage: number }>()\n\n  expectTypeOf(\n    Link<\n      RouterPreserveTrailingSlashes,\n      '/invoices/$invoiceId/details/$detailId/lines',\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ rootPage?: number; page?: number; linesPage: number }>()\n})\n\ntest('when passing a component with props to createLink and navigating to the root', () => {\n  const MyLink = createLink((props: { additionalProps: number }) => (\n    <Link {...(props as any)} />\n  ))\n\n  const DefaultRouterLink = MyLink<DefaultRouter, string, '/'>\n  const DefaultRouterObjectsLink = MyLink<DefaultRouterObjects, string, '/'>\n  const RouterAlwaysTrailingSlashLink = MyLink<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/'\n  >\n  const RouterNeverTrailingSlashLink = MyLink<\n    RouterNeverTrailingSlashes,\n    string,\n    '/'\n  >\n  const RouterPreserveTrailingSlashLink = MyLink<\n    RouterPreserveTrailingSlashes,\n    string,\n    '/'\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../'\n      | './'\n      | '/'\n      | '/invoices/'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/edit/'\n      | '/posts/'\n      | '/posts/$postId/'\n    >()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | './'\n      | '../'\n      | '/'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/edit/'\n      | '/posts'\n      | '/posts/'\n      | '/posts/$postId'\n      | '/posts/$postId/'\n    >()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'new' | 'edit' | 'view'\n    }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('additionalProps')\n    .toEqualTypeOf<number>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('activeProps')\n    .returns.toHaveProperty('additionalProps')\n    .toEqualTypeOf<number | undefined>()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('activeProps')\n    .exclude<(...args: Array<any>) => any>()\n    .toEqualTypeOf<\n      | {\n          [x: `data-${string}`]: unknown\n          ref?: React.LegacyRef<never> | undefined\n          additionalProps?: number | undefined\n          key?: React.Key | null | undefined\n        }\n      | undefined\n    >()\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('activeProps')\n    .extract<(...args: Array<any>) => any>()\n    .returns.toEqualTypeOf<{\n      [x: `data-${string}`]: unknown\n      ref?: React.LegacyRef<never> | undefined\n      additionalProps?: number | undefined\n      key?: React.Key | null | undefined\n    }>()\n\n  createLink((props) => expectTypeOf(props).toEqualTypeOf<CreateLinkProps>())\n})\n\ntest('that createLink refs forward correctly', () => {\n  // copied from: https://tanstack.com/router/latest/docs/framework/react/guide/custom-link#basic-example\n  interface BasicLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {}\n  const BasicLinkComponent = React.forwardRef<\n    HTMLAnchorElement,\n    BasicLinkProps\n  >((props, ref) => {\n    return (\n      <a ref={ref} {...props} className={'block px-3 py-2 text-blue-700'} />\n    )\n  })\n  const CreatedLinkComponent = createLink(BasicLinkComponent)\n  const CustomLink: LinkComponent<typeof BasicLinkComponent> = (props) => {\n    return <CreatedLinkComponent preload={'intent'} {...props} />\n  }\n\n  expectTypeOf(BasicLinkComponent)\n    .parameter(0)\n    .toHaveProperty('ref')\n    .toEqualTypeOf<React.Ref<HTMLAnchorElement> | undefined>()\n\n  expectTypeOf(CreatedLinkComponent)\n    .parameter(0)\n    .toHaveProperty('ref')\n    .toEqualTypeOf<Parameters<typeof BasicLinkComponent>[0]['ref']>()\n\n  expectTypeOf(CustomLink)\n    .parameter(0)\n    .toHaveProperty('ref')\n    .toEqualTypeOf<Parameters<typeof BasicLinkComponent>[0]['ref']>()\n})\n\ntest('createLink should preserve correct ref type with required interface properties', () => {\n  interface MyLinkProps extends React.ComponentPropsWithRef<'a'> {\n    extra: unknown\n  }\n\n  const MyLink = React.forwardRef<HTMLAnchorElement, MyLinkProps>(\n    (props, ref) => {\n      return <a ref={ref} {...props} />\n    },\n  )\n\n  const CreatedLink = createLink(MyLink)\n\n  expectTypeOf(CreatedLink)\n    .parameter(0)\n    .toHaveProperty('ref')\n    .toEqualTypeOf<React.Ref<HTMLAnchorElement> | undefined>()\n})\n\ntest('ResolveRelativePath', () => {\n  expectTypeOf<ResolveRelativePath<'/', '/posts'>>().toEqualTypeOf<'/posts'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', '..'>\n  >().toEqualTypeOf<'/posts/1'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments/', '..'>\n  >().toEqualTypeOf<'/posts/1/'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', '../..'>\n  >().toEqualTypeOf<'/posts'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments/', '../..'>\n  >().toEqualTypeOf<'/posts/'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', '../../..'>\n  >().toEqualTypeOf<'/'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', './1'>\n  >().toEqualTypeOf<'/posts/1/comments/1'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', './1/2'>\n  >().toEqualTypeOf<'/posts/1/comments/1/2'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', '../edit'>\n  >().toEqualTypeOf<'/posts/1/edit'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments/', '../edit'>\n  >().toEqualTypeOf<'/posts/1/edit'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', '1'>\n  >().toEqualTypeOf<'/posts/1/comments/1'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', './1'>\n  >().toEqualTypeOf<'/posts/1/comments/1'>()\n\n  expectTypeOf<\n    ResolveRelativePath<'/posts/1/comments', './1/2'>\n  >().toEqualTypeOf<'/posts/1/comments/1/2'>()\n})\n\ntest('navigation edge cases', () => {\n  expectTypeOf(Link<DefaultRouter, '/', '..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/', '../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/', '..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/', '..' | '../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<DefaultRouter, '', '..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '', '../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '', '..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '', '..' | '../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<DefaultRouter, '/posts', '...'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts', '.../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts', '...'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterPreserveTrailingSlashes, '/posts', '...' | '.../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<DefaultRouter, '/posts/$postId', '../../..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/$postId', '../../../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts/$postId', '../../..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(\n    Link<\n      RouterPreserveTrailingSlashes,\n      '/posts/$postId',\n      '../../..' | '../../../'\n    >,\n  )\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<undefined>()\n\n  expectTypeOf(Link<DefaultRouter, '/posts/$postId', '../..'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../..'\n      | '../../posts'\n      | '../../posts/$postId'\n      | '../../invoices'\n      | '../../invoices/$invoiceId'\n      | '../../invoices/$invoiceId/edit'\n      | '../../invoices/$invoiceId/details'\n      | '../../invoices/$invoiceId/details/$detailId'\n      | '../../invoices/$invoiceId/details/$detailId/lines'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | undefined\n    >()\n\n  expectTypeOf(Link<RouterAlwaysTrailingSlashes, '/posts/$postId', '../../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../../'\n      | '../../posts/'\n      | '../../posts/$postId/'\n      | '../../invoices/'\n      | '../../invoices/$invoiceId/'\n      | '../../invoices/$invoiceId/edit/'\n      | '../../invoices/$invoiceId/details/'\n      | '../../invoices/$invoiceId/details/$detailId/'\n      | '../../invoices/$invoiceId/details/$detailId/lines/'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form/'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | undefined\n    >()\n\n  expectTypeOf(Link<RouterNeverTrailingSlashes, '/posts/$postId', '../../'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../..'\n      | '../../posts'\n      | '../../posts/$postId'\n      | '../../invoices'\n      | '../../invoices/$invoiceId'\n      | '../../invoices/$invoiceId/edit'\n      | '../../invoices/$invoiceId/details'\n      | '../../invoices/$invoiceId/details/$detailId'\n      | '../../invoices/$invoiceId/details/$detailId/lines'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | undefined\n    >()\n\n  expectTypeOf(\n    Link<RouterPreserveTrailingSlashes, '/posts/$postId', '../../' | '../..'>,\n  )\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../..'\n      | '../../'\n      | '../../posts'\n      | '../../posts/$postId'\n      | '../../invoices'\n      | '../../invoices/$invoiceId'\n      | '../../invoices/$invoiceId/edit'\n      | '../../invoices/$invoiceId/details'\n      | '../../invoices/$invoiceId/details/$detailId'\n      | '../../invoices/$invoiceId/details/$detailId/lines'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '../../posts/'\n      | '../../posts/$postId/'\n      | '../../invoices/'\n      | '../../invoices/$invoiceId/'\n      | '../../invoices/$invoiceId/edit/'\n      | '../../invoices/$invoiceId/details/'\n      | '../../invoices/$invoiceId/details/$detailId/'\n      | '../../invoices/$invoiceId/details/$detailId/lines/'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form/'\n      | '../../invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | undefined\n    >()\n})\n\ntest('linkOptions', () => {\n  const defaultRouterLinkOptions = linkOptions<\n    { label: string; to: '/' },\n    DefaultRouter\n  >\n  const defaultRouterObjectsLinkOptions = linkOptions<\n    { label: string; to: '/' },\n    DefaultRouter\n  >\n\n  const routerAlwaysTrailingSlashLinkOptions = linkOptions<\n    { label: string; to: '/' },\n    RouterAlwaysTrailingSlashes\n  >\n\n  const routerNeverTrailingSlashLinkOptions = linkOptions<\n    { label: string; to: '/' },\n    RouterNeverTrailingSlashes\n  >\n  const routerPreserveTrailingSlashLinkOptions = linkOptions<\n    { label: string; to: '/' },\n    RouterPreserveTrailingSlashes\n  >\n\n  expectTypeOf(defaultRouterLinkOptions)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(defaultRouterObjectsLinkOptions)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(routerAlwaysTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '../'\n      | './'\n      | '/'\n      | '/invoices/'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/edit/'\n      | '/posts/'\n      | '/posts/$postId/'\n    >()\n\n  expectTypeOf(routerNeverTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | '/'\n      | '/invoices'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/edit'\n      | '/posts'\n      | '/posts/$postId'\n    >()\n\n  expectTypeOf(routerPreserveTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '.'\n      | './'\n      | '../'\n      | '/'\n      | '/invoices'\n      | '/invoices/'\n      | '/invoices/$invoiceId'\n      | '/invoices/$invoiceId/'\n      | '/invoices/$invoiceId/details/$detailId'\n      | '/invoices/$invoiceId/details/$detailId/'\n      | '/invoices/$invoiceId/details/$detailId/lines'\n      | '/invoices/$invoiceId/details/$detailId/lines/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n      | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n      | '/invoices/$invoiceId/details'\n      | '/invoices/$invoiceId/details/'\n      | '/invoices/$invoiceId/edit'\n      | '/invoices/$invoiceId/edit/'\n      | '/posts'\n      | '/posts/'\n      | '/posts/$postId'\n      | '/posts/$postId/'\n    >()\n\n  expectTypeOf(defaultRouterLinkOptions)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(defaultRouterObjectsLinkOptions)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(routerAlwaysTrailingSlashLinkOptions)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(routerNeverTrailingSlashLinkOptions)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(routerPreserveTrailingSlashLinkOptions)\n    .parameter(0)\n    .toMatchTypeOf<{ search: unknown }>()\n\n  expectTypeOf(defaultRouterLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(defaultRouterObjectsLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(routerAlwaysTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(routerNeverTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(routerPreserveTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(defaultRouterLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'view' | 'edit' | 'new'\n    }>()\n\n  expectTypeOf(defaultRouterObjectsLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'view' | 'edit' | 'new'\n    }>()\n\n  expectTypeOf(routerAlwaysTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'view' | 'edit' | 'new'\n    }>()\n\n  expectTypeOf(routerNeverTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'view' | 'edit' | 'new'\n    }>()\n\n  expectTypeOf(routerPreserveTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{\n      page?: number\n      rootIndexPage?: number\n      rootPage?: number\n      linesPage?: number\n      editId?: number\n      mode?: 'edit' | 'view' | 'new'\n    }>()\n\n  expectTypeOf(defaultRouterLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(defaultRouterObjectsLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(routerAlwaysTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(routerNeverTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(routerPreserveTrailingSlashLinkOptions)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ rootPage?: number; rootIndexPage: number }>()\n\n  expectTypeOf(defaultRouterLinkOptions).returns.toEqualTypeOf<{\n    label: string\n    to: '/'\n  }>()\n\n  expectTypeOf(defaultRouterObjectsLinkOptions).returns.toEqualTypeOf<{\n    label: string\n    to: '/'\n  }>()\n\n  expectTypeOf(routerAlwaysTrailingSlashLinkOptions).returns.toEqualTypeOf<{\n    label: string\n    to: '/'\n  }>()\n\n  expectTypeOf(routerNeverTrailingSlashLinkOptions).returns.toEqualTypeOf<{\n    label: string\n    to: '/'\n  }>()\n\n  expectTypeOf(routerPreserveTrailingSlashLinkOptions).returns.toEqualTypeOf<{\n    label: string\n    to: '/'\n  }>()\n})\n\ntest('when navigating to a route with conflicting validateSearch', () => {\n  const DefaultRouterLink = Link<\n    DefaultRouter,\n    string,\n    '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n  >\n\n  const DefaultRouterObjectsLink = Link<\n    DefaultRouterObjects,\n    string,\n    '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n  >\n\n  const RouterAlwaysTrailingSlashLink = Link<\n    RouterAlwaysTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n  >\n\n  const RouterNeverTrailingSlashLink = Link<\n    RouterNeverTrailingSlashes,\n    string,\n    '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n  >\n  const RouterPreserveTrailingSlashLink = Link<\n    RouterPreserveTrailingSlashes,\n    string,\n    | '/invoices/$invoiceId/details/$detailId/lines/form/edit/'\n    | '/invoices/$invoiceId/details/$detailId/lines/form/edit'\n  >\n\n  expectTypeOf(DefaultRouterLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{\n      mode: 'edit' | 'view'\n      linesPage?: number | undefined\n      page?: number | undefined\n      rootPage?: number | undefined\n    }>()\n\n  expectTypeOf(DefaultRouterObjectsLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{\n      mode: 'edit' | 'view'\n      linesPage?: number | undefined\n      page?: number | undefined\n      rootPage?: number | undefined\n    }>()\n\n  expectTypeOf(RouterAlwaysTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{\n      mode: 'edit' | 'view'\n      linesPage?: number | undefined\n      page?: number | undefined\n      rootPage?: number | undefined\n    }>()\n\n  expectTypeOf(RouterNeverTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{\n      mode: 'edit' | 'view'\n      linesPage?: number | undefined\n      page?: number | undefined\n      rootPage?: number | undefined\n    }>()\n\n  expectTypeOf(RouterPreserveTrailingSlashLink)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{\n      mode: 'edit' | 'view'\n      linesPage?: number | undefined\n      page?: number | undefined\n      rootPage?: number | undefined\n    }>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/link.test.tsx",
    "content": "import React from 'react'\nimport { afterEach, beforeEach, describe, expect, it, test, vi } from 'vitest'\nimport {\n  act,\n  cleanup,\n  configure,\n  fireEvent,\n  render,\n  renderHook,\n  screen,\n  waitFor,\n} from '@testing-library/react'\n\nimport { z } from 'zod'\nimport { trailingSlashOptions } from '@tanstack/router-core'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createBrowserHistory,\n  createHashHistory,\n  createLink,\n  createMemoryHistory,\n  createRootRoute,\n  createRootRouteWithContext,\n  createRoute,\n  createRouteMask,\n  createRouter,\n  getRouteApi,\n  redirect,\n  retainSearchParams,\n  stripSearchParams,\n  useLoaderData,\n  useMatchRoute,\n  useParams,\n  useRouteContext,\n  useRouterState,\n  useSearch,\n} from '../src'\nimport {\n  getIntersectionObserverMock,\n  getSearchParamsFromURI,\n  sleep,\n} from './utils'\nimport type { RouterHistory } from '../src'\n\nconst ioObserveMock = vi.fn()\nconst ioDisconnectMock = vi.fn()\nlet history: RouterHistory\n\nbeforeEach(() => {\n  const io = getIntersectionObserverMock({\n    observe: ioObserveMock,\n    disconnect: ioDisconnectMock,\n  })\n  vi.stubGlobal('IntersectionObserver', io)\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.resetAllMocks()\n  cleanup()\n})\n\nconst WAIT_TIME = 300\n\ndescribe('Link', () => {\n  test('when using renderHook it returns a hook with same content to prove rerender works', async () => {\n    /**\n     * This is the hook that will be tested.\n     *\n     * @returns custom state\n     */\n    const useLocationFromState = () => {\n      const { location } = useRouterState()\n\n      // could return anything just to prove it will work.\n      const memoLocation = React.useMemo(() => {\n        return {\n          href: location.href,\n          pathname: location.pathname,\n        }\n      }, [location.href, location.pathname])\n\n      return memoLocation\n    }\n\n    const IndexComponent = ({ children }: { children: React.ReactNode }) => {\n      return <h1 data-testid=\"testId\">{children}</h1>\n    }\n    const RouterContainer = ({ children }: { children: React.ReactNode }) => {\n      const childrenRef = React.useRef(children)\n      const memoedRouteTree = React.useMemo(() => {\n        const rootRoute = createRootRoute()\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => (\n            <IndexComponent>{childrenRef.current}</IndexComponent>\n          ),\n        })\n        return rootRoute.addChildren([indexRoute])\n      }, [])\n\n      const memoedRouter = React.useMemo(() => {\n        const router = createRouter({\n          routeTree: memoedRouteTree,\n          history,\n        })\n\n        return router\n      }, [memoedRouteTree])\n      return <RouterProvider router={memoedRouter} />\n    }\n\n    const { result, rerender } = renderHook(\n      () => {\n        return useLocationFromState()\n      },\n      { wrapper: RouterContainer },\n    )\n    await waitFor(() => expect(screen.getByTestId('testId')).toBeVisible())\n    expect(result.current).toBeTruthy()\n\n    const original = result.current\n\n    rerender()\n\n    await waitFor(() => expect(screen.getByTestId('testId')).toBeVisible())\n    const updated = result.current\n\n    expect(original).toBe(updated)\n  })\n\n  test('when a Link is disabled', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index</h1>\n          <Link to=\"/posts\" disabled>\n            Posts\n          </Link>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1>Posts</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(window.location.pathname).toBe('/')\n\n    expect(postsLink).not.toBeDisabled()\n    expect(postsLink).toHaveAttribute('aria-disabled', 'true')\n\n    fireEvent.click(postsLink)\n\n    await expect(\n      screen.findByRole('header', { name: 'Posts' }),\n    ).rejects.toThrow()\n  })\n\n  test('when the current route is the root', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/\" activeProps={{ className: 'active' }}>\n              Index\n            </Link>\n            <Link to=\"/posts\" inactiveProps={{ className: 'inactive' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return <h1>Posts</h1>\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const indexLink = await screen.findByRole('link', { name: 'Index' })\n\n    expect(window.location.pathname).toBe('/')\n\n    expect(indexLink).toHaveAttribute('aria-current', 'page')\n    expect(indexLink).toHaveClass('active')\n    expect(indexLink).toHaveAttribute('data-status', 'active')\n    expect(indexLink).toHaveAttribute('href', '/')\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveClass('inactive')\n    expect(postsLink).toHaveAttribute('href', '/posts')\n    expect(postsLink).not.toHaveAttribute('aria-current', 'page')\n    expect(postsLink).not.toHaveAttribute('data-status', 'active')\n  })\n\n  describe('when the current route has a search fields with undefined values', () => {\n    async function runTest(opts: { explicitUndefined: boolean | undefined }) {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index</h1>\n              <Link\n                to=\"/\"\n                activeOptions={{ exact: true }}\n                inactiveProps={{ className: 'inactive' }}\n              >\n                Index exact\n              </Link>\n              <Link\n                to=\"/\"\n                search={{ foo: undefined }}\n                inactiveProps={{ className: 'inactive' }}\n                activeOptions={{ explicitUndefined: opts.explicitUndefined }}\n              >\n                Index foo=undefined\n              </Link>\n              <Link\n                to=\"/\"\n                search={{ foo: undefined }}\n                activeOptions={{\n                  exact: true,\n                  explicitUndefined: opts.explicitUndefined,\n                }}\n                inactiveProps={{ className: 'inactive' }}\n              >\n                Index foo=undefined-exact\n              </Link>\n              <Link\n                to=\"/\"\n                search={{ foo: 'bar' }}\n                inactiveProps={{\n                  className: 'inactive',\n                }}\n              >\n                Index foo=bar\n              </Link>\n            </>\n          )\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute]),\n        history,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      // round 1\n      const indexExactLink = await screen.findByRole('link', {\n        name: 'Index exact',\n      })\n\n      const indexFooUndefinedLink = await screen.findByRole('link', {\n        name: 'Index foo=undefined',\n      })\n\n      const indexFooUndefinedExactLink = await screen.findByRole('link', {\n        name: 'Index foo=undefined-exact',\n      })\n\n      const indexFooBarLink = await screen.findByRole('link', {\n        name: 'Index foo=bar',\n      })\n\n      expect(window.location.pathname).toBe('/')\n\n      expect(indexExactLink).toHaveClass('active')\n      expect(indexExactLink).not.toHaveClass('inactive')\n      expect(indexExactLink).toHaveAttribute('href', '/')\n      expect(indexExactLink).toHaveAttribute('aria-current', 'page')\n      expect(indexExactLink).toHaveAttribute('data-status', 'active')\n\n      if (opts.explicitUndefined) {\n        expect(indexFooUndefinedLink).toHaveClass('active')\n        expect(indexFooUndefinedLink).not.toHaveClass('inactive')\n        expect(indexFooUndefinedLink).toHaveAttribute('aria-current', 'page')\n        expect(indexFooUndefinedLink).toHaveAttribute('data-status', 'active')\n      } else {\n        expect(indexFooUndefinedLink).toHaveClass('active')\n        expect(indexFooUndefinedLink).not.toHaveClass('inactive')\n        expect(indexFooUndefinedLink).toHaveAttribute('aria-current', 'page')\n        expect(indexFooUndefinedLink).toHaveAttribute('data-status', 'active')\n      }\n\n      expect(indexFooUndefinedLink).toHaveAttribute('href', '/')\n\n      if (opts.explicitUndefined) {\n        expect(indexFooUndefinedExactLink).not.toHaveClass('active')\n        expect(indexFooUndefinedExactLink).toHaveClass('inactive')\n        expect(indexFooUndefinedExactLink).not.toHaveAttribute(\n          'aria-current',\n          'page',\n        )\n        expect(indexFooUndefinedExactLink).not.toHaveAttribute(\n          'data-status',\n          'active',\n        )\n      } else {\n        expect(indexFooUndefinedExactLink).toHaveClass('active')\n        expect(indexFooUndefinedExactLink).not.toHaveClass('inactive')\n        expect(indexFooUndefinedExactLink).toHaveAttribute(\n          'aria-current',\n          'page',\n        )\n        expect(indexFooUndefinedExactLink).toHaveAttribute(\n          'data-status',\n          'active',\n        )\n      }\n\n      expect(indexFooUndefinedExactLink).toHaveAttribute('href', '/')\n\n      expect(indexFooBarLink).toHaveClass('inactive')\n      expect(indexFooBarLink).not.toHaveClass('active')\n      expect(indexFooBarLink).toHaveAttribute('href', '/?foo=bar')\n      expect(indexFooBarLink).not.toHaveAttribute('aria-current', 'page')\n      expect(indexFooBarLink).not.toHaveAttribute('data-status', 'active')\n\n      // navigate to /?foo=bar\n      await act(() => fireEvent.click(indexFooBarLink))\n\n      await waitFor(() => {\n        expect(indexFooBarLink).toHaveClass('active')\n      })\n\n      expect(indexExactLink).toHaveClass('inactive')\n      expect(indexExactLink).not.toHaveClass('active')\n      expect(indexExactLink).toHaveAttribute('href', '/')\n      expect(indexExactLink).not.toHaveAttribute('aria-current', 'page')\n      expect(indexExactLink).not.toHaveAttribute('data-status', 'active')\n\n      if (opts.explicitUndefined) {\n        expect(indexFooUndefinedLink).not.toHaveClass('active')\n        expect(indexFooUndefinedLink).toHaveClass('inactive')\n        expect(indexFooUndefinedLink).not.toHaveAttribute(\n          'aria-current',\n          'page',\n        )\n        expect(indexFooUndefinedLink).not.toHaveAttribute(\n          'data-status',\n          'active',\n        )\n      } else {\n        expect(indexFooUndefinedLink).toHaveClass('active')\n        expect(indexFooUndefinedLink).not.toHaveClass('inactive')\n        expect(indexFooUndefinedLink).toHaveAttribute('aria-current', 'page')\n        expect(indexFooUndefinedLink).toHaveAttribute('data-status', 'active')\n      }\n\n      expect(indexFooUndefinedLink).toHaveAttribute('href', '/')\n\n      expect(indexFooUndefinedExactLink).toHaveClass('inactive')\n      expect(indexFooUndefinedExactLink).not.toHaveClass('active')\n      expect(indexFooUndefinedExactLink).toHaveAttribute('href', '/')\n      expect(indexFooUndefinedExactLink).not.toHaveAttribute(\n        'aria-current',\n        'page',\n      )\n      expect(indexFooUndefinedExactLink).not.toHaveAttribute(\n        'data-status',\n        'active',\n      )\n\n      expect(indexFooBarLink).toHaveClass('active')\n      expect(indexFooBarLink).not.toHaveClass('inactive')\n      expect(indexFooBarLink).toHaveAttribute('href', '/?foo=bar')\n      expect(indexFooBarLink).toHaveAttribute('aria-current', 'page')\n      expect(indexFooBarLink).toHaveAttribute('data-status', 'active')\n    }\n\n    test.each([undefined, false])(\n      'activeOptions.explicitUndefined=%s',\n      async (explicitUndefined) => {\n        await runTest({ explicitUndefined })\n      },\n    )\n\n    test('activeOptions.explicitUndefined=true', async () => {\n      await runTest({ explicitUndefined: true })\n    })\n  })\n\n  describe('active and href updates', () => {\n    const createControlledPromise = () => {\n      let resolve!: () => void\n      const promise = new Promise<void>((r) => {\n        resolve = r\n      })\n\n      return { promise, resolve }\n    }\n\n    test('always reports external links as inactive', async () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <Link to=\"https://example.com\">\n            {({ isActive }) => (\n              <span data-testid=\"external-link-active\">{String(isActive)}</span>\n            )}\n          </Link>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute]),\n        history,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      expect(\n        await screen.findByTestId('external-link-active'),\n      ).toHaveTextContent('false')\n    })\n\n    test('updates exact and fuzzy active state before the next route renders', async () => {\n      const postLoader = createControlledPromise()\n\n      const rootRoute = createRootRoute({\n        component: () => (\n          <>\n            <Link\n              data-testid=\"posts-exact\"\n              to=\"/posts\"\n              activeOptions={{ exact: true }}\n              activeProps={{ className: 'active' }}\n              inactiveProps={{ className: 'inactive' }}\n            >\n              Posts exact\n            </Link>\n            <Link\n              data-testid=\"posts-fuzzy\"\n              to=\"/posts\"\n              activeProps={{ className: 'active' }}\n              inactiveProps={{ className: 'inactive' }}\n            >\n              Posts fuzzy\n            </Link>\n            <Link\n              data-testid=\"post-exact\"\n              to=\"/posts/$postId\"\n              params={{ postId: '1' }}\n              activeOptions={{ exact: true }}\n              activeProps={{ className: 'active' }}\n              inactiveProps={{ className: 'inactive' }}\n            >\n              Post exact\n            </Link>\n            <Outlet />\n          </>\n        ),\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'posts',\n        component: () => (\n          <>\n            <h1>Posts</h1>\n            <Link\n              data-testid=\"open-post\"\n              to=\"/posts/$postId\"\n              params={{ postId: '1' }}\n            >\n              Open post\n            </Link>\n            <Outlet />\n          </>\n        ),\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        loader: () => postLoader.promise,\n        component: () => <h1>Post detail</h1>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute.addChildren([postRoute])]),\n        history: createMemoryHistory({ initialEntries: ['/posts'] }),\n        defaultPendingMs: 0,\n        defaultPendingComponent: () => <p>Loading...</p>,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const postsExact = await screen.findByTestId('posts-exact')\n      const postsFuzzy = await screen.findByTestId('posts-fuzzy')\n      const postExact = await screen.findByTestId('post-exact')\n\n      expect(postsExact).toHaveClass('active')\n      expect(postsFuzzy).toHaveClass('active')\n      expect(postExact).toHaveClass('inactive')\n\n      await act(() => fireEvent.click(screen.getByTestId('open-post')))\n\n      expect(await screen.findByText('Loading...')).toBeInTheDocument()\n      expect(screen.queryByText('Post detail')).not.toBeInTheDocument()\n      expect(router.state.location.pathname).toBe('/posts/1')\n      expect(postsExact).toHaveClass('inactive')\n      expect(postsFuzzy).toHaveClass('active')\n      expect(postExact).toHaveClass('active')\n\n      postLoader.resolve()\n\n      expect(await screen.findByText('Post detail')).toBeInTheDocument()\n    })\n\n    test('updates exact active state and href when only params change with params=true', async () => {\n      const postLoader = createControlledPromise()\n      let postLoadCount = 0\n\n      const rootRoute = createRootRoute({\n        component: CurrentPostLinks,\n      })\n\n      function CurrentPostLinks() {\n        const { postId } = useParams({ strict: false })\n        const nextPostId = postId === '1' ? '2' : '1'\n\n        return (\n          <>\n            <Link\n              data-testid=\"current-post\"\n              from=\"/posts/$postId\"\n              to=\".\"\n              params={true}\n              activeOptions={{ exact: true }}\n              activeProps={{ className: 'active' }}\n              inactiveProps={{ className: 'inactive' }}\n            >\n              Current post\n            </Link>\n            <Link\n              data-testid=\"switch-post\"\n              from=\"/posts/$postId\"\n              to=\".\"\n              params={{ postId: nextPostId }}\n            >\n              Switch post\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const postRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/$postId',\n        loader: () => {\n          postLoadCount += 1\n          return postLoadCount === 1 ? Promise.resolve() : postLoader.promise\n        },\n        component: PostPage,\n      })\n\n      function PostPage() {\n        const { postId } = useParams({ strict: false })\n        return <h1>{`Post ${postId}`}</h1>\n      }\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postRoute]),\n        history: createMemoryHistory({ initialEntries: ['/posts/1'] }),\n        defaultPendingMs: 0,\n        defaultPendingComponent: () => <p>Loading...</p>,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const currentPost = await screen.findByTestId('current-post')\n      expect(await screen.findByText('Post 1')).toBeInTheDocument()\n      expect(currentPost).toHaveClass('active')\n      expect(currentPost).toHaveAttribute('href', '/posts/1')\n\n      await act(() => fireEvent.click(screen.getByTestId('switch-post')))\n\n      expect(await screen.findByText('Loading...')).toBeInTheDocument()\n      expect(screen.queryByText('Post 2')).not.toBeInTheDocument()\n      expect(router.state.location.pathname).toBe('/posts/2')\n      expect(currentPost).toHaveClass('active')\n\n      await waitFor(() => {\n        expect(currentPost).toHaveAttribute('href', '/posts/2')\n      })\n\n      postLoader.resolve()\n\n      expect(await screen.findByText('Post 2')).toBeInTheDocument()\n    })\n\n    test('updates search-sensitive active state immediately with and without search=true', async () => {\n      const postsLoader = createControlledPromise()\n      let postsLoadCount = 0\n\n      const rootRoute = createRootRoute({\n        component: CurrentSearchLinks,\n      })\n\n      function CurrentSearchLinks() {\n        const search = useSearch({ strict: false })\n        const nextPage = Number(search.page ?? 1) === 1 ? 2 : 1\n\n        return (\n          <>\n            <Link\n              data-testid=\"static-search\"\n              to=\"/posts\"\n              search={{ page: 1 }}\n              activeOptions={{ exact: true, includeSearch: true }}\n              activeProps={{ className: 'active' }}\n              inactiveProps={{ className: 'inactive' }}\n            >\n              Static search\n            </Link>\n            <Link\n              data-testid=\"current-search\"\n              to=\"/posts\"\n              search={true}\n              activeOptions={{ exact: true, includeSearch: true }}\n              activeProps={{ className: 'active' }}\n              inactiveProps={{ className: 'inactive' }}\n            >\n              Current search\n            </Link>\n            <Link\n              data-testid=\"switch-search\"\n              from=\"/posts\"\n              to=\".\"\n              search={{ page: nextPage }}\n            >\n              Switch search\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts',\n        validateSearch: (input: Record<string, unknown>) => ({\n          page: Number(input.page ?? 1),\n        }),\n        loaderDeps: ({ search }) => ({ page: search.page }),\n        loader: () => {\n          postsLoadCount += 1\n          return postsLoadCount === 1 ? Promise.resolve() : postsLoader.promise\n        },\n        component: PostsPage,\n      })\n\n      function PostsPage() {\n        const search = useSearch({ strict: false })\n        return <h1>{`Posts ${search.page}`}</h1>\n      }\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n        history: createMemoryHistory({ initialEntries: ['/posts?page=1'] }),\n        defaultPendingMs: 0,\n        defaultPendingComponent: () => <p>Loading...</p>,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const staticSearch = await screen.findByTestId('static-search')\n      const currentSearch = await screen.findByTestId('current-search')\n\n      expect(await screen.findByText('Posts 1')).toBeInTheDocument()\n      expect(staticSearch).toHaveClass('active')\n      expect(currentSearch).toHaveClass('active')\n      expect(currentSearch).toHaveAttribute('href', '/posts?page=1')\n\n      await act(() => fireEvent.click(screen.getByTestId('switch-search')))\n\n      expect(await screen.findByText('Loading...')).toBeInTheDocument()\n      expect(screen.queryByText('Posts 2')).not.toBeInTheDocument()\n      expect(router.state.location.search).toEqual({ page: 2 })\n      expect(staticSearch).toHaveClass('inactive')\n      expect(currentSearch).toHaveClass('active')\n\n      await waitFor(() => {\n        expect(currentSearch).toHaveAttribute('href', '/posts?page=2')\n      })\n\n      postsLoader.resolve()\n\n      expect(await screen.findByText('Posts 2')).toBeInTheDocument()\n    })\n\n    test('updates hash-sensitive active state immediately with and without hash=true', async () => {\n      const rootRoute = createRootRoute({\n        component: () => (\n          <>\n            <Link\n              data-testid=\"static-hash\"\n              to=\"/posts\"\n              hash=\"first\"\n              activeOptions={{ exact: true, includeHash: true }}\n              activeProps={{ className: 'active' }}\n              inactiveProps={{ className: 'inactive' }}\n            >\n              Static hash\n            </Link>\n            <Link\n              data-testid=\"current-hash\"\n              to=\"/posts\"\n              hash={true}\n              activeOptions={{ exact: true, includeHash: true }}\n              activeProps={{ className: 'active' }}\n              inactiveProps={{ className: 'inactive' }}\n            >\n              Current hash\n            </Link>\n            <Link data-testid=\"switch-hash\" from=\"/posts\" to=\".\" hash=\"second\">\n              Switch hash\n            </Link>\n            <Outlet />\n          </>\n        ),\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts',\n        component: () => <h1>Posts</h1>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n        history: createMemoryHistory({ initialEntries: ['/posts#first'] }),\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const staticHash = await screen.findByTestId('static-hash')\n      const currentHash = await screen.findByTestId('current-hash')\n\n      expect(staticHash).toHaveClass('active')\n      expect(currentHash).toHaveClass('active')\n      expect(currentHash).toHaveAttribute('href', '/posts#first')\n\n      await act(() => fireEvent.click(screen.getByTestId('switch-hash')))\n\n      expect(router.state.location.hash).toBe('second')\n      expect(staticHash).toHaveClass('inactive')\n      expect(currentHash).toHaveClass('active')\n\n      await waitFor(() => {\n        expect(currentHash).toHaveAttribute('href', '/posts#second')\n      })\n    })\n\n    test('eventually updates relative hrefs when the current route changes', async () => {\n      const rootRoute = createRootRoute({\n        component: () => (\n          <>\n            <Link data-testid=\"relative-foo\" to=\"./foo\">\n              Relative foo\n            </Link>\n            <Link data-testid=\"to-posts\" to=\"/posts\">\n              To posts\n            </Link>\n            <Link data-testid=\"to-invoices\" to=\"/invoices\">\n              To invoices\n            </Link>\n            <Outlet />\n          </>\n        ),\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts',\n        component: () => <h1>Posts</h1>,\n      })\n\n      const postsFooRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: 'foo',\n        component: () => <h1>Posts foo</h1>,\n      })\n\n      const invoicesRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/invoices',\n        component: () => <h1>Invoices</h1>,\n      })\n\n      const invoicesFooRoute = createRoute({\n        getParentRoute: () => invoicesRoute,\n        path: 'foo',\n        component: () => <h1>Invoices foo</h1>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          postsRoute.addChildren([postsFooRoute]),\n          invoicesRoute.addChildren([invoicesFooRoute]),\n        ]),\n        history: createMemoryHistory({ initialEntries: ['/posts'] }),\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const relativeFoo = await screen.findByTestId('relative-foo')\n      expect(await screen.findByText('Posts')).toBeInTheDocument()\n      expect(relativeFoo).toHaveAttribute('href', '/posts/foo')\n\n      await act(() => fireEvent.click(screen.getByTestId('to-invoices')))\n\n      expect(await screen.findByText('Invoices')).toBeInTheDocument()\n\n      await waitFor(() => {\n        expect(relativeFoo).toHaveAttribute('href', '/invoices/foo')\n      })\n    })\n  })\n\n  test('when the current route is the root with beforeLoad that throws', async () => {\n    const onError = vi.fn()\n    const rootRoute = createRootRoute({\n      onError,\n      beforeLoad: () => {\n        throw new Error('Something went wrong!')\n      },\n      errorComponent: () => <span>Oops! Something went wrong!</span>,\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/\" activeProps={{ className: 'active' }}>\n              Index\n            </Link>\n            <Link to=\"/posts\" inactiveProps={{ className: 'inactive' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return <h1>Posts</h1>\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const errorText = await screen.findByText('Oops! Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n    expect(onError).toHaveBeenCalledOnce()\n  })\n\n  test('when navigating to /posts', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/\">Index</Link>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n            <Link to=\"/\">Index</Link>\n            <Link to=\"/posts\" activeProps={{ className: 'active' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    await act(() => fireEvent.click(postsLink))\n\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    const indexLink = await screen.findByRole('link', { name: 'Index' })\n\n    expect(window.location.pathname).toBe('/posts')\n    expect(indexLink).not.toHaveAttribute('aria-current', 'page')\n    expect(indexLink).not.toHaveAttribute('data-status', 'active')\n    expect(indexLink).toHaveAttribute('href', '/')\n\n    expect(postsLink).toHaveAttribute('data-status', 'active')\n    expect(postsLink).toHaveAttribute('aria-current', 'page')\n    expect(postsLink).toHaveClass('active')\n    expect(postsLink).toHaveAttribute('href', '/posts')\n  })\n\n  test('when navigating to /posts with a base url', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/\">Index</Link>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n            <Link to=\"/\">Index</Link>\n            <Link to=\"/posts\" activeProps={{ className: 'active' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n      basepath: '/app',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    await act(() => fireEvent.click(postsLink))\n\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n\n    const indexLink = await screen.findByRole('link', { name: 'Index' })\n\n    expect(window.location.pathname).toBe('/app/posts')\n    expect(indexLink).not.toHaveAttribute('aria-current', 'page')\n    expect(indexLink).not.toHaveAttribute('data-status', 'active')\n    expect(indexLink).toHaveAttribute('href', '/app/')\n\n    expect(postsLink).toHaveAttribute('data-status', 'active')\n    expect(postsLink).toHaveAttribute('aria-current', 'page')\n    expect(postsLink).toHaveClass('active')\n    expect(postsLink).toHaveAttribute('href', '/app/posts')\n  })\n\n  test('when navigating to /posts with search', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 0 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const search = useSearch({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>Page: {search.page}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        return {\n          page: input.page,\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts?page=0')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n    expect(window.location.search).toBe('?page=0')\n\n    const pageZero = await screen.findByText('Page: 0')\n    expect(pageZero).toBeInTheDocument()\n  })\n\n  test('when navigation to . from /posts while updating search from /', async () => {\n    const RootComponent = () => {\n      return (\n        <>\n          <div data-testid=\"root-nav\">\n            <Link\n              to=\".\"\n              search={{ page: 2, filter: 'inactive' }}\n              data-testid=\"update-search\"\n            >\n              Update Search\n            </Link>\n          </div>\n          <Outlet />\n        </>\n      )\n    }\n\n    const rootRoute = createRootRoute({\n      component: RootComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link\n              to=\"/posts\"\n              search={{ page: 1, filter: 'active' }}\n              data-testid=\"to-posts\"\n            >\n              Go to Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const search = useSearch({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span data-testid=\"current-page\">Page: {search.page}</span>\n          <span data-testid=\"current-filter\">Filter: {search.filter}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        return {\n          page: input.page ? Number(input.page) : 1,\n          filter: (input.filter as string) || 'all',\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    // Start at index page\n    const toPostsLink = await screen.findByTestId('to-posts')\n    expect(toPostsLink).toHaveAttribute('href', '/posts?page=1&filter=active')\n\n    // Navigate to posts with initial search params\n    await act(() => fireEvent.click(toPostsLink))\n\n    // Verify we're on posts with initial search\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n    expect(window.location.pathname).toBe('/posts')\n    expect(window.location.search).toBe('?page=1&filter=active')\n\n    const currentPage = await screen.findByTestId('current-page')\n    const currentFilter = await screen.findByTestId('current-filter')\n    expect(currentPage).toHaveTextContent('Page: 1')\n    expect(currentFilter).toHaveTextContent('Filter: active')\n\n    // Navigate to current route (.) with updated search\n    const updateSearchLink = await screen.findByTestId('update-search')\n    expect(updateSearchLink).toHaveAttribute(\n      'href',\n      '/posts?page=2&filter=inactive',\n    )\n\n    await act(() => fireEvent.click(updateSearchLink))\n\n    // Wait for navigation to complete and search params to update\n    await waitFor(() => {\n      expect(window.location.search).toBe('?page=2&filter=inactive')\n    })\n\n    // Verify search was updated\n    expect(window.location.pathname).toBe('/posts')\n    expect(window.location.search).toBe('?page=2&filter=inactive')\n\n    const updatedPage = await screen.findByTestId('current-page')\n    const updatedFilter = await screen.findByTestId('current-filter')\n    expect(updatedPage).toHaveTextContent('Page: 2')\n    expect(updatedFilter).toHaveTextContent('Filter: inactive')\n  })\n\n  test('when navigation to . from /posts while updating search from / and using base path', async () => {\n    const RootComponent = () => {\n      return (\n        <>\n          <div data-testid=\"root-nav\">\n            <Link\n              to=\".\"\n              search={{ page: 2, filter: 'inactive' }}\n              data-testid=\"update-search\"\n            >\n              Update Search\n            </Link>\n          </div>\n          <Outlet />\n        </>\n      )\n    }\n\n    const rootRoute = createRootRoute({\n      component: RootComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link\n              to=\"/posts\"\n              search={{ page: 1, filter: 'active' }}\n              data-testid=\"to-posts\"\n            >\n              Go to Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const search = useSearch({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span data-testid=\"current-page\">Page: {search.page}</span>\n          <span data-testid=\"current-filter\">Filter: {search.filter}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        return {\n          page: input.page ? Number(input.page) : 1,\n          filter: (input.filter as string) || 'all',\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} basepath={'/Dashboard'} />)\n\n    // Start at index page\n    const toPostsLink = await screen.findByTestId('to-posts')\n    expect(toPostsLink).toHaveAttribute(\n      'href',\n      '/Dashboard/posts?page=1&filter=active',\n    )\n\n    // Navigate to posts with initial search params\n    await act(() => fireEvent.click(toPostsLink))\n\n    // Verify we're on posts with initial search\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n    expect(window.location.pathname).toBe('/Dashboard/posts')\n    expect(window.location.search).toBe('?page=1&filter=active')\n\n    const currentPage = await screen.findByTestId('current-page')\n    const currentFilter = await screen.findByTestId('current-filter')\n    expect(currentPage).toHaveTextContent('Page: 1')\n    expect(currentFilter).toHaveTextContent('Filter: active')\n\n    // Navigate to current route (.) with updated search\n    const updateSearchLink = await screen.findByTestId('update-search')\n\n    expect(updateSearchLink).toHaveAttribute(\n      'href',\n      '/Dashboard/posts?page=2&filter=inactive',\n    )\n\n    await act(() => fireEvent.click(updateSearchLink))\n\n    // Wait for navigation to complete and search params to update\n    await waitFor(() => {\n      expect(window.location.search).toBe('?page=2&filter=inactive')\n    })\n\n    // Verify search was updated\n    expect(window.location.pathname).toBe('/Dashboard/posts')\n    expect(window.location.search).toBe('?page=2&filter=inactive')\n\n    const updatedPage = await screen.findByTestId('current-page')\n    const updatedFilter = await screen.findByTestId('current-filter')\n    expect(updatedPage).toHaveTextContent('Page: 2')\n    expect(updatedFilter).toHaveTextContent('Filter: inactive')\n  })\n\n  test('when navigating to /posts with invalid search', async () => {\n    const rootRoute = createRootRoute()\n    const onError = vi.fn()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 'invalid' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const search = useSearch({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>Page: {search.page}</span>\n        </>\n      )\n    }\n\n    const ErrorComponent = () => {\n      return <h1>Oops, something went wrong</h1>\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      errorComponent: ErrorComponent,\n      onError,\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n\n        if (isNaN(page)) throw Error('Not a number!')\n\n        return {\n          page,\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts?page=invalid')\n\n    await act(() => fireEvent.click(postsLink))\n\n    await waitFor(() => expect(onError).toHaveBeenCalledOnce())\n\n    const errorHeading = await screen.findByRole('heading', {\n      name: 'Oops, something went wrong',\n    })\n    expect(errorHeading).toBeInTheDocument()\n  })\n\n  test('when navigating to /posts with a loader', async () => {\n    const loader = vi.fn((opts) => {\n      return Promise.resolve({ pageDoubled: opts.deps.page.page * 2 })\n    })\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 2 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const data = useLoaderData({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>Page: {data.pageDoubled}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n\n        if (isNaN(page)) throw Error('Not a number!')\n\n        return {\n          page,\n        }\n      },\n      loaderDeps: (opts) => ({ page: opts.search }),\n      loader: loader,\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts?page=2')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const pageFour = await screen.findByText('Page: 4')\n    expect(pageFour).toBeInTheDocument()\n\n    expect(loader).toHaveBeenCalledOnce()\n  })\n\n  test('when navigating to /posts with a loader that errors', async () => {\n    const onError = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 2 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const loader = useLoaderData({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>Page: {loader.pageDoubled}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n\n        if (isNaN(page)) throw Error('Not a number!')\n\n        return {\n          page,\n        }\n      },\n      loaderDeps: (opts) => ({ page: opts.search }),\n      onError,\n      errorComponent: () => <span>Something went wrong!</span>,\n      loader: () => {\n        throw new Error()\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts?page=2')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const errorText = await screen.findByText('Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n\n    expect(onError).toHaveBeenCalledOnce()\n  })\n\n  test('when navigating away from a route with a loader that errors', async () => {\n    const postsOnError = vi.fn()\n    const indexOnError = vi.fn()\n    const rootRoute = createRootRoute({\n      component: () => (\n        <>\n          <div>\n            <Link to=\"/\">Index</Link> <Link to=\"/posts\">Posts</Link>\n          </div>\n          <hr />\n          <Outlet />\n        </>\n      ),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n          </>\n        )\n      },\n      onError: indexOnError,\n      errorComponent: () => <span>IndexError</span>,\n    })\n\n    const error = new Error('Something went wrong!')\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      loaderDeps: (opts) => ({ page: opts.search }),\n      loader: () => {\n        throw error\n      },\n      onError: postsOnError,\n      errorComponent: () => <span>PostsError</span>,\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    await act(() => fireEvent.click(postsLink))\n\n    const postsErrorText = await screen.findByText('PostsError')\n    expect(postsErrorText).toBeInTheDocument()\n\n    expect(postsOnError).toHaveBeenCalledOnce()\n    expect(postsOnError).toHaveBeenCalledWith(error)\n\n    const indexLink = await screen.findByRole('link', { name: 'Index' })\n    await act(() => fireEvent.click(indexLink))\n\n    await expect(screen.findByText('IndexError')).rejects.toThrow()\n    expect(indexOnError).not.toHaveBeenCalledOnce()\n  })\n\n  test('when navigating to /posts with a beforeLoad that redirects', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 2 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return <h1>Posts</h1>\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      beforeLoad: () => {\n        throw redirect({\n          to: '/login',\n        })\n      },\n      component: PostsComponent,\n    })\n\n    const authRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: () => <h1>Auth!</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute, authRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    await act(() => fireEvent.click(postsLink))\n\n    const authText = await screen.findByText('Auth!')\n    expect(authText).toBeInTheDocument()\n  })\n\n  test('when navigating to /posts with a beforeLoad that returns context', async () => {\n    const rootRoute = createRootRouteWithContext<{\n      userId: string\n    }>()()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const context = useRouteContext({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>UserId: {context.userId}</span>\n          <span>Username: {context.username}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      beforeLoad: () => {\n        return Promise.resolve({\n          username: 'username',\n        })\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      context: { userId: 'userId' },\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    await act(() => fireEvent.click(postsLink))\n\n    const userId = await screen.findByText('UserId: userId')\n    expect(userId).toBeInTheDocument()\n  })\n\n  test('when navigating to /posts with a beforeLoad that throws an error', async () => {\n    const onError = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return <h1>Posts</h1>\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      beforeLoad: () => {\n        throw new Error('Oops. Something went wrong!')\n      },\n      onError,\n      errorComponent: () => <span>Oops! Something went wrong!</span>,\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      context: { userId: 'userId' },\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    await act(() => fireEvent.click(postsLink))\n\n    const errorText = await screen.findByText('Oops! Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n\n    expect(onError).toHaveBeenCalledOnce()\n  })\n\n  test('when navigating to /posts with a beforeLoad that throws an error bubbles to the root', async () => {\n    const rootRoute = createRootRoute({\n      errorComponent: () => <span>Oops! Something went wrong!</span>,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return <h1>Posts</h1>\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      beforeLoad: () => {\n        throw new Error('Oops. Something went wrong!')\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      context: { userId: 'userId' },\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    await act(() => fireEvent.click(postsLink))\n\n    const errorText = await screen.findByText('Oops! Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n  })\n\n  test('when navigating to /posts with a beforeLoad that throws an error bubbles to the nearest parent', async () => {\n    const rootRoute = createRootRoute({\n      errorComponent: () => <span>Root error</span>,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              Post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      errorComponent: () => <span>Oops! Something went wrong!</span>,\n      component: PostsComponent,\n    })\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      beforeLoad: () => {\n        throw new Error('Oops. Something went wrong!')\n      },\n    })\n\n    const router = createRouter({\n      context: { userId: 'userId' },\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postRoute]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', { name: 'Post' })\n\n    await act(() => fireEvent.click(postLink))\n\n    const errorText = await screen.findByText('Oops! Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n  })\n\n  test('when navigating to the root with an error in component', async () => {\n    const notFoundComponent = vi.fn()\n\n    const rootRoute = createRootRoute({\n      errorComponent: () => <span>Expected rendering error message</span>,\n      notFoundComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        throw new Error(\n          'Error from component should not render notFoundComponent',\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const errorText = await screen.findByText(\n      'Expected rendering error message',\n    )\n    expect(errorText).toBeInTheDocument()\n    expect(notFoundComponent).not.toBeCalled()\n  })\n\n  test('when navigating to /posts with params', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Link to=\"/\">Index</Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return <span>Params: {params.postId}</span>\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postRoute]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.click(postLink))\n\n    const paramText = await screen.findByText('Params: id1')\n    expect(paramText).toBeInTheDocument()\n  })\n\n  test('keeps a relative link active when changing inherited params (issue #5655)', async () => {\n    const rootRoute = createRootRoute()\n\n    const PostRouteComponent = () => {\n      const { postId } = useParams({ strict: false })\n\n      return (\n        <>\n          <Link\n            data-testid=\"step1-link\"\n            from=\"/post/$postId\"\n            to=\"step1\"\n            activeProps={{ className: 'active' }}\n          >\n            Step 1\n          </Link>\n          <Link\n            data-testid=\"step2-link\"\n            from=\"/post/$postId\"\n            to=\"step2\"\n            params={{ postId }}\n            activeProps={{ className: 'active' }}\n          >\n            Step 2\n          </Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/post/$postId',\n      component: PostRouteComponent,\n    })\n\n    const Step1RouteComponent = () => {\n      const { postId } = useParams({ strict: false })\n      const otherPostId = postId === '1' ? '2' : '1'\n\n      return (\n        <>\n          <span>{`Post ${postId} step1`}</span>\n          <Link\n            data-testid=\"switch-post-link\"\n            from=\"/post/$postId/step1\"\n            to=\".\"\n            params={{ postId: otherPostId }}\n          >{`Go to post ${otherPostId}`}</Link>\n        </>\n      )\n    }\n    const step1Route = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'step1',\n      component: Step1RouteComponent,\n    })\n\n    const Step2RouteComponent = () => {\n      const { postId } = useParams({ strict: false })\n      const otherPostId = postId === '1' ? '2' : '1'\n\n      return (\n        <>\n          <span>{`Post ${postId} step2`}</span>\n          <Link\n            data-testid=\"switch-post-link\"\n            from=\"/post/$postId/step2\"\n            to=\".\"\n            params={{ postId: otherPostId }}\n          >{`Go to post ${otherPostId}`}</Link>\n        </>\n      )\n    }\n    const step2Route = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'step2',\n      component: Step2RouteComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        postRoute.addChildren([step1Route, step2Route]),\n      ]),\n      history: createMemoryHistory({\n        initialEntries: ['/post/1/step1'],\n      }),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    expect(await screen.findByText('Post 1 step1')).toBeInTheDocument()\n    expect(screen.getByTestId('step1-link')).toHaveClass('active')\n\n    await act(() => fireEvent.click(screen.getByTestId('switch-post-link')))\n\n    expect(await screen.findByText('Post 2 step1')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/post/2/step1')\n    // This is the bug from #5655: step1 should stay active but is not.\n    expect(screen.getByTestId('step1-link')).toHaveClass('active')\n\n    await act(() => fireEvent.click(screen.getByTestId('step2-link')))\n\n    expect(await screen.findByText('Post 2 step2')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/post/2/step2')\n    expect(screen.getByTestId('step2-link')).toHaveClass('active')\n\n    await act(() => fireEvent.click(screen.getByTestId('switch-post-link')))\n\n    expect(await screen.findByText('Post 1 step2')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/post/1/step2')\n    expect(screen.getByTestId('step2-link')).toHaveClass('active')\n  })\n\n  test('when navigating from /posts to ./$postId', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostsIndexComponent = () => {\n      return (\n        <>\n          <h1>Posts Index</h1>\n          <Link from=\"/posts/\" to=\"./$postId\" params={{ postId: 'id1' }}>\n            To the first post\n          </Link>\n        </>\n      )\n    }\n\n    const postsIndexRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '/',\n      component: PostsIndexComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Link to=\"/\">Index</Link>\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postsIndexRoute, postRoute]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const postsText = await screen.findByText('Posts Index')\n    expect(postsText).toBeInTheDocument()\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To the first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.click(postLink))\n\n    const paramText = await screen.findByText('Params: id1')\n    expect(paramText).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts/id1')\n  })\n\n  test('when navigating from /posts/$postId to \"/\"', async () => {\n    const rootRoute = createRootRoute({\n      component: () => {\n        return (\n          <>\n            <Link to=\"/\" data-testid=\"home-link\">\n              Home\n            </Link>\n            <Link to=\"/posts\" data-testid=\"posts-link\">\n              Posts\n            </Link>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1 data-testid=\"home-heading\">Index</h1>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Link\n            to=\"/posts/$postId\"\n            params={{ postId: 'id1' }}\n            data-testid=\"post1-link\"\n          >\n            To first post\n          </Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostsIndexComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"posts-index-heading\">Posts Index</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsIndexRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '/',\n      component: PostsIndexComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span data-testid=\"post-param\">Params: {params.postId}</span>\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postsIndexRoute, postRoute]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByTestId('posts-link')\n\n    expect(postsLink).toHaveAttribute('href', '/posts')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const postsText = await screen.findByTestId('posts-index-heading')\n    expect(postsText).toBeInTheDocument()\n\n    const postLink = await screen.findByTestId('post1-link')\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.click(postLink))\n\n    const paramText = await screen.findByTestId('post-param')\n    expect(paramText).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts/id1')\n\n    const homeLink = await screen.findByTestId('home-link')\n\n    const consoleWarnSpy = vi.spyOn(console, 'warn')\n\n    await act(() => fireEvent.click(homeLink))\n\n    expect(window.location.pathname).toBe('/')\n    const homeHeading = await screen.findByTestId('home-heading')\n    expect(homeHeading).toBeInTheDocument()\n\n    expect(consoleWarnSpy).not.toHaveBeenCalled()\n\n    consoleWarnSpy.mockRestore()\n  })\n\n  test('when navigating from /posts to ../posts/$postId', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostsIndexComponent = () => {\n      return (\n        <>\n          <h1>Posts Index</h1>\n          <Link from=\"/posts/\" to=\"../posts/$postId\" params={{ postId: 'id1' }}>\n            To the first post\n          </Link>\n        </>\n      )\n    }\n\n    const postsIndexRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '/',\n      component: PostsIndexComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Link to=\"/\">Index</Link>\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postsIndexRoute, postRoute]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const postsIndexText = await screen.findByText('Posts Index')\n    expect(postsIndexText).toBeInTheDocument()\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To the first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.click(postLink))\n\n    const paramText = await screen.findByText('Params: id1')\n    expect(paramText).toBeInTheDocument()\n  })\n\n  test('when navigating from /posts/$postId to /posts/$postId/info and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"/posts/$postId/info\">\n            To Information\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To Information',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1/info')\n\n    await act(() => fireEvent.click(informationLink))\n\n    const informationText = await screen.findByText('Information')\n    expect(informationText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/info')\n\n    const paramsText2 = await screen.findByText('Params: id1')\n    expect(paramsText2).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId with a trailing slash to /posts/$postId/info and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const postIndexRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: '/',\n      component: () => <div>Post Index</div>,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"/posts/$postId/info\">\n            To Information\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([\n              postIndexRoute,\n              detailsRoute,\n              informationRoute,\n            ]),\n          ]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To Information',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1/info')\n\n    await act(() => fireEvent.click(informationLink))\n\n    const informationText = await screen.findByText('Information')\n    expect(informationText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/info')\n\n    const paramsText2 = await screen.findByText('Params: id1')\n    expect(paramsText2).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /dashboard/posts/$postId to /dashboard/users', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/dashboard\" data-testid=\"dashboard-link\">\n              dashboard\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const dashboardRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'dashboard',\n      component: () => {\n        return (\n          <>\n            <h1 data-testid=\"dashboard-heading\">dashboard</h1>\n            <Link to=\"/dashboard/posts\" data-testid=\"posts-link\">\n              posts\n            </Link>\n            <Link to=\"/dashboard/users\" data-testid=\"users-link\">\n              users\n            </Link>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"posts-heading\">Posts</h1>\n          <Link\n            to=\"/dashboard/posts/$postid\"\n            data-testid=\"post1-link\"\n            params={{ postid: 'id1' }}\n          >\n            Post1\n          </Link>\n          <Link\n            to=\"/dashboard/posts/$postid\"\n            data-testid=\"post2-link\"\n            params={{ postid: 'id2' }}\n          >\n            Post2\n          </Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const UsersComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"users-heading\">Users</h1>\n          <Link\n            to=\"/dashboard/users/$userid\"\n            data-testid=\"user1-link\"\n            params={{ userid: 'id1' }}\n          >\n            User1\n          </Link>\n          <Link\n            to=\"/dashboard/users/$userid\"\n            data-testid=\"user2-link\"\n            params={{ userid: 'id2' }}\n          >\n            User2\n          </Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => dashboardRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const usersRoute = createRoute({\n      getParentRoute: () => dashboardRoute,\n      path: 'users',\n      component: UsersComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span data-testid=\"post-component\">Params: {params.postId}</span>\n        </>\n      )\n    }\n\n    const UserComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span data-testid=\"user-component\">Params: {params.userId}</span>\n        </>\n      )\n    }\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postid',\n      component: PostComponent,\n    })\n\n    const userRoute = createRoute({\n      getParentRoute: () => usersRoute,\n      path: '$userid',\n      component: UserComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        dashboardRoute.addChildren([\n          postsRoute.addChildren([postRoute]),\n          usersRoute.addChildren([userRoute]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const dashboardLink = await screen.findByTestId('dashboard-link')\n\n    await act(() => fireEvent.click(dashboardLink))\n\n    const dashboardHeading = await screen.findByTestId('dashboard-heading')\n\n    expect(dashboardHeading).toBeInTheDocument()\n\n    const postsLink = await screen.findByTestId('posts-link')\n    await act(() => fireEvent.click(postsLink))\n\n    const postsHeading = await screen.findByTestId('posts-heading')\n\n    expect(window.location.pathname).toEqual('/dashboard/posts')\n    expect(postsHeading).toBeInTheDocument()\n\n    const post1Link = await screen.findByTestId('post1-link')\n    await act(() => fireEvent.click(post1Link))\n    const post1Heading = await screen.findByTestId('post-component')\n\n    expect(window.location.pathname).toEqual('/dashboard/posts/id1')\n    expect(post1Heading).toBeInTheDocument()\n\n    const consoleWarnSpy = vi.spyOn(console, 'warn')\n\n    const usersLink = await screen.findByTestId('users-link')\n    await act(() => fireEvent.click(usersLink))\n\n    const usersHeading = await screen.findByTestId('users-heading')\n\n    expect(window.location.pathname).toEqual('/dashboard/users')\n    expect(usersHeading).toBeInTheDocument()\n\n    const user1Link = await screen.findByTestId('user1-link')\n    await act(() => fireEvent.click(user1Link))\n    const user1Heading = await screen.findByTestId('user-component')\n\n    expect(window.location.pathname).toEqual('/dashboard/users/id1')\n    expect(user1Heading).toBeInTheDocument()\n\n    expect(consoleWarnSpy).not.toHaveBeenCalled()\n\n    consoleWarnSpy.mockRestore()\n  })\n\n  test('when navigating from /posts/$postId to ./info and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"./info\">\n            To Information\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To Information',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1/info')\n\n    await act(() => fireEvent.click(informationLink))\n\n    const informationText = await screen.findByText('Information')\n    expect(informationText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/info')\n\n    const paramsText2 = await screen.findByText('Params: id1')\n    expect(paramsText2).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId to / and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"/\">\n            To Root\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([postRoute.addChildren([detailsRoute])]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const rootLink = await screen.findByRole('link', {\n      name: 'To Root',\n    })\n\n    expect(rootLink).toHaveAttribute('href', '/')\n\n    await act(() => fireEvent.click(rootLink))\n\n    const indexText = await screen.findByText('Index')\n    expect(indexText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId with search and to ./info with search and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link\n              to=\"/posts/$postId/details\"\n              params={{ postId: 'id1' }}\n              search={{ page: 2 }}\n            >\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n      validateSearch: () => ({ page: 2 }),\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link\n            from=\"/posts/$postId\"\n            to=\"./info\"\n            search={(prev: any): any => ({ ...prev, more: true })}\n          >\n            To Information\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n      validateSearch: () => ({ more: false }),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details?page=2')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To Information',\n    })\n\n    expect(informationLink).toHaveAttribute(\n      'href',\n      '/posts/id1/info?page=2&more=true',\n    )\n\n    await act(() => fireEvent.click(informationLink))\n\n    const informationText = await screen.findByText('Information')\n    expect(informationText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/info')\n\n    const paramsText2 = await screen.findByText('Params: id1')\n    expect(paramsText2).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId to ../$postId and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"../$postId\">\n            To Post\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To Post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.click(postLink))\n\n    const postsText = await screen.findByText('Posts')\n    expect(postsText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId with an index to ../$postId and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const postIndexRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: '/',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"../$postId\">\n            To Post\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([\n              postIndexRoute,\n              detailsRoute,\n              informationRoute,\n            ]),\n          ]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To Post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.click(postLink))\n\n    const postsText = await screen.findByText('Posts')\n    expect(postsText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /invoices to ./invoiceId and the current route is /posts/$postId/details', async () => {\n    const consoleWarnSpy = vi.spyOn(console, 'warn')\n\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link\n            from=\"/invoices\"\n            to=\"./$invoiceId\"\n            params={{ invoiceId: 'id1' }}\n          >\n            To Invoices\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      component: () => (\n        <>\n          <h1>Invoices!</h1>\n          <Outlet />\n        </>\n      ),\n    })\n\n    const InvoiceComponent = () => {\n      const params = useParams({ strict: false })\n      return <span>invoiceId: {params.invoiceId}</span>\n    }\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n      component: InvoiceComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          invoicesRoute.addChildren([invoiceRoute]),\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    await act(() => fireEvent.click(postsLink))\n\n    const invoicesLink = await screen.findByRole('link', {\n      name: 'To Invoices',\n    })\n\n    fireEvent.click(invoicesLink)\n\n    expect(consoleWarnSpy).toHaveBeenCalledWith(\n      'Could not find match for from: /invoices',\n    )\n\n    consoleWarnSpy.mockRestore()\n  })\n\n  test('when navigating to /posts/$postId/info which is declaratively masked as /posts/$postId', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId/info\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute.addChildren([postRoute.addChildren([informationRoute])]),\n    ])\n\n    const routeMask = createRouteMask({\n      routeTree,\n      from: '/posts/$postId/info',\n      to: '/posts/$postId',\n    })\n\n    const router = createRouter({\n      routeTree,\n      routeMasks: [routeMask],\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating to /posts/$postId/info which is imperatively masked as /posts/$postId', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link\n              to=\"/posts/$postId/info\"\n              params={{ postId: 'id1' }}\n              mask={{ to: '/posts/$postId', params: { postId: 'id1' } }}\n            >\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute.addChildren([postRoute.addChildren([informationRoute])]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when preloading /post/$postId with a redirects to /login', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const loaderFn = vi.fn()\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      loader: () => {\n        loaderFn()\n        throw redirect({\n          to: '/login',\n          search,\n        })\n      },\n    })\n\n    const LoginComponent = () => {\n      const [status, setStatus] = React.useState<'idle' | 'success' | 'error'>(\n        'idle',\n      )\n\n      React.useEffect(() => {\n        const onLoad = async () => {\n          try {\n            await router.preloadRoute({\n              to: '/posts/$postId',\n              params: { postId: 'id1' },\n              search: { postPage: 0 },\n            })\n            setStatus('success')\n          } catch (e) {\n            setStatus('error')\n          }\n        }\n        onLoad()\n      }, [])\n\n      return <>{status === 'success' ? 'Login!' : 'Waiting...'}</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      defaultPreload: 'intent',\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.mouseOver(postLink))\n\n    await waitFor(() => expect(loaderFn).toHaveBeenCalled())\n\n    await waitFor(() => expect(search).toHaveBeenCalledWith({ postPage: 0 }))\n\n    await act(() => fireEvent.click(postLink))\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating to /post/$postId with a redirect from /post/$postId to ../../login in a loader', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      loader: () => {\n        throw redirect({\n          from: postRoute.fullPath,\n          to: '../../login',\n          search,\n        })\n      },\n    })\n\n    const LoginComponent = () => {\n      return <div data-testid=\"login\">Login!</div>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.click(postLink))\n\n    expect(await screen.findByTestId('login')).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating to /post/$postId with a redirect from /post/$postId to ../../login in beforeLoad', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      beforeLoad: () => {\n        throw redirect({\n          from: postRoute.fullPath,\n          to: '../../login',\n          search,\n        })\n      },\n    })\n\n    const LoginComponent = () => {\n      return <>Login!</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.click(postLink))\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when preloading /post/$postId with a beforeLoad that navigates to /login', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      beforeLoad: (context) => context.navigate({ to: '/login', search }),\n    })\n\n    const LoginComponent = () => {\n      return <>Login!</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      defaultPreload: 'intent',\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.mouseOver(postLink))\n\n    await waitFor(() => expect(search).toHaveBeenCalledWith({ postPage: 0 }))\n\n    await act(() => fireEvent.click(postLink))\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when preloading /post/$postId with a loader that navigates to /login', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link\n              to=\"/posts/$postId\"\n              params={{ postId: 'id1' }}\n              preloadDelay={0}\n            >\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      loader: (context) => {\n        context.navigate({ to: '/login', search })\n      },\n    })\n\n    const LoginComponent = () => {\n      return <>Login!</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      defaultPreload: 'intent',\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    await act(() => fireEvent.mouseOver(postLink))\n\n    await waitFor(() => expect(search).toHaveBeenCalledWith({ postPage: 0 }))\n\n    await act(() => fireEvent.click(postLink))\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts to /invoices with conditionally rendering Link on the root', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n    const RootComponent = () => {\n      const matchRoute = useMatchRoute()\n      const matchPosts = Boolean(matchRoute({ to: '/posts' }))\n      const matchInvoices = Boolean(matchRoute({ to: '/invoices' }))\n\n      return (\n        <>\n          {matchPosts && (\n            <Link from=\"/posts\" to=\"/posts\">\n              From posts\n            </Link>\n          )}\n          {matchInvoices && (\n            <Link from=\"/invoices\" to=\"/invoices\">\n              From invoices\n            </Link>\n          )}\n          <Outlet />\n        </>\n      )\n    }\n\n    const rootRoute = createRootRoute({\n      component: RootComponent,\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index Route</h1>\n          <Link to=\"/posts\">Go to posts</Link>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: () => (\n        <>\n          <h1>On Posts</h1>\n          <Link to=\"/invoices\">To invoices</Link>\n        </>\n      ),\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      component: () => (\n        <>\n          <h1>On Invoices</h1>\n          <Link to=\"/posts\">To posts</Link>\n        </>\n      ),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      invoicesRoute,\n    ])\n\n    const router = createRouter({\n      routeTree,\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Go to posts' })\n\n    await act(() => fireEvent.click(postsLink))\n\n    const fromPostsLink = await screen.findByRole('link', {\n      name: 'From posts',\n    })\n\n    expect(fromPostsLink).toBeInTheDocument()\n\n    const toInvoicesLink = await screen.findByRole('link', {\n      name: 'To invoices',\n    })\n\n    await act(() => fireEvent.click(toInvoicesLink))\n\n    const fromInvoicesLink = await screen.findByRole('link', {\n      name: 'From invoices',\n    })\n\n    expect(fromInvoicesLink).toBeInTheDocument()\n\n    expect(fromPostsLink).not.toBeInTheDocument()\n\n    const toPostsLink = await screen.findByRole('link', {\n      name: 'To posts',\n    })\n\n    await act(() => fireEvent.click(toPostsLink))\n\n    const onPostsText = await screen.findByText('On Posts')\n    expect(onPostsText).toBeInTheDocument()\n\n    expect(fromInvoicesLink).not.toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when linking to self with from prop set and param containing a slash', async () => {\n    const ErrorComponent = vi.fn(() => <h1>Something went wrong!</h1>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <Link to=\"/$postId\" params={{ postId: 'id/with-slash' }}>\n          Go to post\n        </Link>\n      ),\n    })\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/$postId',\n      component: () => (\n        <Link from=\"/$postId\" to=\"/$postId\">\n          Link to self with from prop set\n        </Link>\n      ),\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, postRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'Go to post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/id%2Fwith-slash')\n\n    fireEvent.click(postLink)\n\n    const selfLink = await screen.findByRole('link', {\n      name: 'Link to self with from prop set',\n    })\n\n    expect(selfLink).toBeInTheDocument()\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating to /$postId with parseParams and stringifyParams', async () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <Link to=\"/$postId\" params={{ postId: 2 }}>\n          Go to post\n        </Link>\n      ),\n    })\n\n    let parseParams: any\n    let stringifyParams: any\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return <div>Post: {params.postId}</div>\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '$postId',\n      parseParams: (params) => {\n        parseParams = structuredClone(params) // clone object, because source will get mutated\n        return {\n          status: 'parsed',\n          postId: params.postId,\n        }\n      },\n      stringifyParams: (params) => {\n        stringifyParams = structuredClone(params) // clone object, because source will get mutated\n        return {\n          status: 'stringified',\n          postId: params.postId,\n        }\n      },\n      component: PostComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, postRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'Go to post',\n    })\n\n    expect(stringifyParams).toEqual({ postId: 2 })\n\n    expect(postLink).toHaveAttribute('href', '/2')\n\n    fireEvent.click(postLink)\n\n    const posts2Text = await screen.findByText('Post: 2')\n    expect(posts2Text).toBeInTheDocument()\n\n    expect(parseParams).toEqual({ postId: '2' })\n  })\n\n  test('when navigating to /$postId with params.parse and params.stringify', async () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <Link to=\"/$postId\" params={{ postId: 2 }}>\n          Go to post\n        </Link>\n      ),\n    })\n\n    let parseParams: any\n    let stringifyParams: any\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return <div>Post: {params.postId}</div>\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '$postId',\n      params: {\n        parse: (params) => {\n          parseParams = structuredClone(params) // clone object, because source will get mutated\n          return {\n            status: 'parsed',\n            postId: params.postId,\n          }\n        },\n        stringify: (params) => {\n          stringifyParams = structuredClone(params) // clone object, because source will get mutated\n          return {\n            status: 'stringified',\n            postId: params.postId,\n          }\n        },\n      },\n      component: PostComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, postRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'Go to post',\n    })\n\n    expect(stringifyParams).toEqual({ postId: 2 })\n\n    expect(postLink).toHaveAttribute('href', '/2')\n\n    fireEvent.click(postLink)\n\n    const posts2Text = await screen.findByText('Post: 2')\n    expect(posts2Text).toBeInTheDocument()\n\n    expect(parseParams).toEqual({ postId: '2' })\n  })\n\n  test('when navigating to /$postId with params.parse and params.stringify handles falsey inputs', async () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <Link to=\"/$postId\" params={{ postId: 2 }}>\n            Go to post 2\n          </Link>\n          <Link to=\"/$postId\" params={{ postId: 0 }}>\n            Go to post 0\n          </Link>\n        </>\n      ),\n    })\n\n    const stringifyParamsMock = vi.fn()\n\n    const parseParams = ({ postId }: { postId: string }) => {\n      return {\n        postId: parseInt(postId),\n      }\n    }\n\n    const stringifyParams = ({ postId }: { postId: number }) => {\n      stringifyParamsMock({ postId })\n      return {\n        postId: postId.toString(),\n      }\n    }\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return <div>Post: {params.postId}</div>\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '$postId',\n      params: {\n        parse: parseParams,\n        stringify: stringifyParams,\n      },\n      component: PostComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, postRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const postLink2 = await screen.findByRole('link', {\n      name: 'Go to post 2',\n    })\n    const postLink0 = await screen.findByRole('link', {\n      name: 'Go to post 0',\n    })\n\n    expect(postLink2).toHaveAttribute('href', '/2')\n    expect(postLink0).toHaveAttribute('href', '/0')\n\n    expect(stringifyParamsMock).toHaveBeenCalledWith({ postId: 2 })\n    expect(stringifyParamsMock).toHaveBeenCalledWith({ postId: 0 })\n  })\n\n  test.each([false, 'intent', 'render'] as const)(\n    'Router.preload=\"%s\", should not trigger the IntersectionObserver\\'s observe and disconnect methods',\n    async (preload) => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <h1>Index Heading</h1>\n            <Link to=\"/\">Index Link</Link>\n          </>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute]),\n        defaultPreload: preload,\n        history,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const indexLink = await screen.findByRole('link', { name: 'Index Link' })\n      expect(indexLink).toBeInTheDocument()\n\n      expect(ioObserveMock).not.toBeCalled()\n      expect(ioDisconnectMock).not.toBeCalled()\n    },\n  )\n\n  test.each([false, 'intent', 'viewport', 'render'] as const)(\n    'Router.preload=\"%s\" with Link.preload=\"false\", should not trigger the IntersectionObserver\\'s observe method',\n    async (preload) => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <h1>Index Heading</h1>\n            <Link to=\"/\" preload={false}>\n              Index Link\n            </Link>\n          </>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute]),\n        defaultPreload: preload,\n        history,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const indexLink = await screen.findByRole('link', { name: 'Index Link' })\n      expect(indexLink).toBeInTheDocument()\n\n      expect(ioObserveMock).not.toBeCalled()\n    },\n  )\n\n  test('Router.preload=\"viewport\", should trigger the IntersectionObserver\\'s observe and disconnect methods', async () => {\n    const rootRoute = createRootRoute()\n    const RouteComponent = () => {\n      const [count, setCount] = React.useState(0)\n      return (\n        <>\n          <h1>Index Heading</h1>\n          <output>{count}</output>\n          <button onClick={() => setCount((c) => c + 1)}>Render</button>\n          <Link to=\"/\">Index Link</Link>\n        </>\n      )\n    }\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: RouteComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      defaultPreload: 'viewport',\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const indexLink = await screen.findByRole('link', { name: 'Index Link' })\n    expect(indexLink).toBeInTheDocument()\n\n    expect(ioObserveMock).toBeCalled()\n    expect(ioObserveMock).toBeCalledTimes(2) // since React.StrictMode is enabled it double renders\n\n    expect(ioDisconnectMock).toBeCalled()\n    expect(ioDisconnectMock).toBeCalledTimes(1) // since React.StrictMode is enabled it should have disconnected\n\n    const output = screen.getByRole('status')\n    expect(output).toHaveTextContent('0')\n\n    const button = screen.getByRole('button', { name: 'Render' })\n    fireEvent.click(button)\n    await waitFor(() => {\n      expect(output).toHaveTextContent('1')\n    })\n    expect(ioObserveMock).toBeCalledTimes(2) // it should not observe again\n    expect(ioDisconnectMock).toBeCalledTimes(1) // it should not disconnect again\n  })\n\n  test(\"Router.preload='render', should trigger the route loader on render\", async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: () => {\n        mock()\n      },\n      component: () => (\n        <>\n          <h1>Index Heading</h1>\n          <Link to=\"/about\">About Link</Link>\n        </>\n      ),\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => (\n        <>\n          <h1>About Heading</h1>\n        </>\n      ),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([aboutRoute, indexRoute]),\n      defaultPreload: 'render',\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const aboutLink = await screen.findByRole('link', { name: 'About Link' })\n    expect(aboutLink).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test.each([undefined, false, 'render', 'viewport'] as const)(\n    'Link.preload=\"%s\" should not preload on focus, hover, or touchstart',\n    async (preloadMode) => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <h1>Index Heading</h1>\n            <Link\n              to=\"/about\"\n              {...(preloadMode === undefined ? {} : { preload: preloadMode })}\n            >\n              About Link\n            </Link>\n          </>\n        ),\n      })\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        component: () => <h1>About Heading</h1>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([aboutRoute, indexRoute]),\n        defaultPreload: false,\n        defaultPreloadDelay: 0,\n        history,\n      })\n\n      const preloadRouteSpy = vi.spyOn(router, 'preloadRoute')\n\n      render(<RouterProvider router={router} />)\n\n      const aboutLink = await screen.findByRole('link', { name: 'About Link' })\n      expect(aboutLink).toBeInTheDocument()\n\n      if (preloadMode === 'render') {\n        await waitFor(() =>\n          expect(preloadRouteSpy.mock.calls.length).toBeGreaterThan(0),\n        )\n      }\n\n      const baselineCalls = preloadRouteSpy.mock.calls.length\n\n      fireEvent.focus(aboutLink)\n      fireEvent.mouseOver(aboutLink)\n      fireEvent.touchStart(aboutLink)\n\n      await sleep(100)\n      expect(preloadRouteSpy).toHaveBeenCalledTimes(baselineCalls)\n    },\n  )\n\n  test('Link.preload=\"intent\" should preload on focus, hover, and touchstart', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index Heading</h1>\n          <Link to=\"/about\" preload=\"intent\">\n            About Link\n          </Link>\n        </>\n      ),\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <h1>About Heading</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([aboutRoute, indexRoute]),\n      defaultPreload: false,\n      defaultPreloadDelay: 0,\n      history,\n    })\n\n    const preloadRouteSpy = vi.spyOn(router, 'preloadRoute')\n\n    render(<RouterProvider router={router} />)\n\n    const aboutLink = await screen.findByRole('link', { name: 'About Link' })\n    expect(aboutLink).toBeInTheDocument()\n\n    const baselineCalls = preloadRouteSpy.mock.calls.length\n\n    fireEvent.focus(aboutLink)\n    await waitFor(() =>\n      expect(preloadRouteSpy).toHaveBeenCalledTimes(baselineCalls + 1),\n    )\n\n    fireEvent.mouseOver(aboutLink)\n    await waitFor(() =>\n      expect(preloadRouteSpy).toHaveBeenCalledTimes(baselineCalls + 2),\n    )\n\n    fireEvent.touchStart(aboutLink)\n    await waitFor(() =>\n      expect(preloadRouteSpy).toHaveBeenCalledTimes(baselineCalls + 3),\n    )\n  })\n\n  test('Router.preload=\"intent\", pendingComponent renders during unresolved route loader', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/posts\" preload=\"intent\">\n              link to posts\n            </Link>\n          </div>\n        )\n      },\n    })\n\n    const postRoute = createRoute({\n      ssr: false,\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      loader: () => sleep(WAIT_TIME),\n      component: () => <div>Posts page</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([postRoute, indexRoute])\n    const router = createRouter({\n      routeTree,\n      defaultPreload: 'intent',\n      defaultPendingMs: 200,\n      defaultPendingComponent: () => <p>Loading...</p>,\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToPosts = await screen.findByRole('link', {\n      name: 'link to posts',\n    })\n    expect(linkToPosts).toBeInTheDocument()\n\n    fireEvent.focus(linkToPosts)\n    fireEvent.click(linkToPosts)\n\n    const loadingElement = await screen.findByText('Loading...')\n    expect(loadingElement).toBeInTheDocument()\n\n    const postsElement = await screen.findByText('Posts page')\n    expect(postsElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n  })\n\n  describe('when preloading a link, `preload` should be', () => {\n    async function runTest({\n      expectedPreload,\n      testIdToHover,\n    }: {\n      expectedPreload: boolean\n      testIdToHover: string\n    }) {\n      const rootRoute = createRootRoute({\n        component: () => {\n          return (\n            <>\n              <Link\n                data-testid=\"link-1\"\n                to=\"/posts/$postId\"\n                params={{ postId: 'id1' }}\n              >\n                To first post\n              </Link>\n              <Link\n                data-testid=\"link-2\"\n                to=\"/posts/$postId\"\n                params={{ postId: 'id2' }}\n              >\n                To second post\n              </Link>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index</h1>\n            </>\n          )\n        },\n      })\n\n      const PostsComponent = () => {\n        return (\n          <>\n            <h1>Posts</h1>\n            <Outlet />\n          </>\n        )\n      }\n\n      const postsBeforeLoadFn = vi.fn()\n      const postsLoaderFn = vi.fn()\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'posts',\n        component: PostsComponent,\n        beforeLoad: postsBeforeLoadFn,\n        loader: postsLoaderFn,\n      })\n\n      const PostComponent = () => {\n        const params = useParams({ strict: false })\n        return (\n          <>\n            <span>Params: {params.postId}</span>\n          </>\n        )\n      }\n\n      const postBeforeLoadFn = vi.fn()\n      const postLoaderFn = vi.fn()\n\n      const postRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        component: PostComponent,\n        beforeLoad: postBeforeLoadFn,\n        loader: postLoaderFn,\n      })\n\n      const routeTree = rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postRoute]),\n      ])\n\n      const router = createRouter({\n        routeTree,\n        defaultPreload: 'intent',\n        history,\n      })\n\n      render(<RouterProvider router={router} />)\n      const link = await screen.findByTestId(testIdToHover)\n      fireEvent.mouseOver(link)\n\n      const expected = expect.objectContaining({ preload: expectedPreload })\n      await waitFor(() =>\n        expect(postsBeforeLoadFn).toHaveBeenCalledWith(expected),\n      )\n      await waitFor(() => expect(postsLoaderFn).toHaveBeenCalledWith(expected))\n\n      await waitFor(() =>\n        expect(postBeforeLoadFn).toHaveBeenCalledWith(expected),\n      )\n      await waitFor(() => expect(postLoaderFn).toHaveBeenCalledWith(expected))\n    }\n    test('`true` when on / and hovering `/posts/id1` ', async () => {\n      await runTest({ expectedPreload: true, testIdToHover: 'link-1' })\n    })\n\n    test('`false` when on `/posts/id1` and hovering `/posts/id1`', async () => {\n      window.history.replaceState(null, 'root', '/posts/id1')\n      await runTest({ expectedPreload: false, testIdToHover: 'link-1' })\n    })\n\n    test('`true` when on `/posts/id1` and hovering `/posts/id2`', async () => {\n      window.history.replaceState(null, 'root', '/posts/id1')\n      await runTest({ expectedPreload: false, testIdToHover: 'link-2' })\n    })\n  })\n})\n\ndescribe('createLink', () => {\n  configure({ reactStrictMode: true })\n\n  it('should pass the \"disabled\" prop to the rendered target element', async () => {\n    const CustomLink = createLink('button')\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <CustomLink to=\"/\" disabled>\n          Index\n        </CustomLink>\n      ),\n    })\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const customElement = await screen.findByText('Index')\n\n    expect(customElement).toBeDisabled()\n    expect(customElement.getAttribute('disabled')).toBe('')\n  })\n\n  it('should pass the \"foo\" prop to the rendered target element', async () => {\n    const CustomLink = createLink('button')\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <CustomLink\n          to=\"/\"\n          // @ts-expect-error\n          foo=\"bar\"\n        >\n          Index\n        </CustomLink>\n      ),\n    })\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const customElement = await screen.findByText('Index')\n\n    expect(customElement.hasAttribute('foo')).toBe(true)\n    expect(customElement.getAttribute('foo')).toBe('bar')\n  })\n\n  it('should pass activeProps and inactiveProps to the custom link', async () => {\n    const Button: React.FC<\n      React.PropsWithChildren<{\n        active?: boolean\n        foo?: boolean\n        overrideMeIfYouWant: string\n      }>\n    > = ({ active, foo, children, ...props }) => (\n      <button {...props}>\n        active: {active ? 'yes' : 'no'} - foo: {foo ? 'yes' : 'no'} - {children}\n      </button>\n    )\n\n    const ButtonLink = createLink(Button)\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <ButtonLink\n            to=\"/\"\n            overrideMeIfYouWant=\"Button1\"\n            activeProps={{\n              active: true,\n              'data-hello': 'world',\n              overrideMeIfYouWant: 'overridden-by-activeProps',\n            }}\n            inactiveProps={{ foo: true }}\n          >\n            Button1\n          </ButtonLink>\n          <ButtonLink\n            to=\"/posts\"\n            overrideMeIfYouWant=\"Button2\"\n            activeProps={{\n              active: true,\n              'data-hello': 'world',\n            }}\n            inactiveProps={{\n              foo: true,\n              'data-hello': 'void',\n              overrideMeIfYouWant: 'overridden-by-inactiveProps',\n            }}\n          >\n            Button2\n          </ButtonLink>\n          <ButtonLink\n            to=\"/posts\"\n            overrideMeIfYouWant=\"Button3\"\n            activeProps={{\n              active: true,\n            }}\n            inactiveProps={{\n              active: false,\n            }}\n          >\n            Button3\n          </ButtonLink>\n        </>\n      ),\n    })\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const button1 = await screen.findByText('active: yes - foo: no - Button1')\n    expect(button1.getAttribute('data-hello')).toBe('world')\n    expect(button1.getAttribute('overrideMeIfYouWant')).toBe(\n      'overridden-by-activeProps',\n    )\n\n    const button2 = await screen.findByText('active: no - foo: yes - Button2')\n    expect(button2.getAttribute('data-hello')).toBe('void')\n    expect(button2.getAttribute('overrideMeIfYouWant')).toBe(\n      'overridden-by-inactiveProps',\n    )\n\n    const button3 = await screen.findByText('active: no - foo: no - Button3')\n    expect(button3.getAttribute('overrideMeIfYouWant')).toBe('Button3')\n  })\n\n  it('should respect target attribute set by custom component', async () => {\n    const CustomLinkWithTarget = React.forwardRef<\n      HTMLAnchorElement,\n      { href?: string; children?: React.ReactNode }\n    >((props, ref) => (\n      <a ref={ref} {...props} target=\"_blank\" rel=\"noopener noreferrer\" />\n    ))\n\n    const CreatedCustomLink = createLink(CustomLinkWithTarget)\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index</h1>\n          <CreatedCustomLink to=\"/posts\">\n            Posts (should open in new tab)\n          </CreatedCustomLink>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1 data-testid=\"posts-heading\">Posts</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const originalOpen = window.open\n    const openMock = vi.fn()\n    window.open = openMock\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', {\n      name: 'Posts (should open in new tab)',\n    })\n\n    expect(postsLink).toHaveAttribute('target', '_blank')\n    expect(postsLink).toHaveAttribute('rel', 'noopener noreferrer')\n\n    fireEvent.click(postsLink)\n\n    await waitFor(() => {\n      expect(router.state.location.pathname).toBe('/')\n    })\n\n    await expect(screen.findByTestId('posts-heading')).rejects.toThrow()\n\n    window.open = originalOpen\n  })\n\n  it('should allow override of target prop even when custom component sets it', async () => {\n    const CustomLinkWithDefaultTarget = React.forwardRef<\n      HTMLAnchorElement,\n      { href?: string; children?: React.ReactNode; target?: string }\n    >((props, ref) => <a ref={ref} target=\"_blank\" {...props} />)\n\n    const CreatedCustomLink = createLink(CustomLinkWithDefaultTarget)\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index</h1>\n          <CreatedCustomLink to=\"/posts\" target=\"_self\">\n            Posts (should navigate internally)\n          </CreatedCustomLink>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1 data-testid=\"posts-heading\">Posts</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', {\n      name: 'Posts (should navigate internally)',\n    })\n\n    expect(postsLink).toHaveAttribute('target', '_self')\n\n    fireEvent.click(postsLink)\n\n    await waitFor(() => {\n      expect(router.state.location.pathname).toBe('/posts')\n    })\n\n    const postsHeading = await screen.findByTestId('posts-heading')\n    expect(postsHeading).toBeInTheDocument()\n  })\n})\n\ndescribe('search middleware', () => {\n  test('legacy search filters still work', async () => {\n    const rootRoute = createRootRoute({\n      validateSearch: (input) => {\n        return {\n          root: input.root as string | undefined,\n          foo: input.foo as string | undefined,\n        }\n      },\n      preSearchFilters: [\n        (search) => {\n          return { ...search, foo: 'foo' }\n        },\n      ],\n      postSearchFilters: [\n        (search) => {\n          return { ...search, root: search.root ?? 'default' }\n        },\n      ],\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={(p: any) => ({ page: 123, foo: p.foo })}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n        return {\n          page,\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history: createMemoryHistory({ initialEntries: ['/?foo=bar'] }),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n    expect(postsLink).toHaveAttribute('href')\n    const href = postsLink.getAttribute('href')\n    const search = getSearchParamsFromURI(href!)\n    expect(search.size).toBe(3)\n    expect(search.get('page')).toBe('123')\n    expect(search.get('root')).toBe('default')\n    expect(search.get('foo')).toBe('foo')\n  })\n\n  test('search middlewares work', async () => {\n    const rootRoute = createRootRoute({\n      validateSearch: (input) => {\n        return {\n          root: input.root as string | undefined,\n          foo: input.foo as string | undefined,\n        }\n      },\n      search: {\n        middlewares: [\n          ({ search, next }) => {\n            return next({ ...search, foo: 'foo' })\n          },\n          ({ search, next }) => {\n            expect(search.foo).toBe('foo')\n            const { root, ...result } = next({ ...search, foo: 'hello' })\n            return { ...result, root: root ?? search.root }\n          },\n        ],\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const { root } = indexRoute.useSearch()\n        return (\n          <>\n            <h1>Index</h1>\n            <div data-testid=\"search\">{root ?? '$undefined'}</div>\n            <Link\n              data-testid=\"update-search\"\n              to=\"/\"\n              search={{ root: 'newValue' }}\n            >\n              update search\n            </Link>\n            <Link to=\"/posts\" search={{ page: 123 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n        return {\n          page,\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history: createMemoryHistory({ initialEntries: ['/?root=abc'] }),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    async function checkSearchValue(value: string) {\n      const searchValue = await screen.findByTestId('search')\n      expect(searchValue).toHaveTextContent(value)\n    }\n    async function checkPostsLink(root: string) {\n      const postsLink = await screen.findByRole('link', { name: 'Posts' })\n      expect(postsLink).toHaveAttribute('href')\n      const href = postsLink.getAttribute('href')\n      const search = getSearchParamsFromURI(href!)\n      expect(search.size).toBe(2)\n      expect(search.get('page')).toBe('123')\n      expect(search.get('root')).toBe(root)\n    }\n    await checkSearchValue('abc')\n    await checkPostsLink('abc')\n\n    const updateSearchLink = await screen.findByTestId('update-search')\n    act(() => fireEvent.click(updateSearchLink))\n    await checkSearchValue('newValue')\n    await checkPostsLink('newValue')\n    expect(router.state.location.search).toEqual({ root: 'newValue' })\n  })\n\n  test('search middlewares work with redirect', async () => {\n    const rootRoute = createRootRoute({\n      validateSearch: z.object({ root: z.string().optional() }),\n      component: () => {\n        return (\n          <>\n            <h1>Root</h1>\n            <Link\n              data-testid=\"root-link-posts\"\n              search={{ foo: 'default' }}\n              to=\"/posts\"\n            >\n              posts\n            </Link>{' '}\n            <Link data-testid=\"root-link-invoices\" to=\"/invoices\">\n              invoices\n            </Link>\n            <Outlet />\n          </>\n        )\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: () => {\n        throw redirect({ to: '/posts' })\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: z.object({\n        foo: z.string().default('default'),\n      }),\n      search: {\n        middlewares: [\n          // this means we cannot get the correct input type for this schema\n          stripSearchParams({ foo: 'default' }),\n          retainSearchParams(true),\n        ],\n      },\n\n      component: () => {\n        const { foo } = postsRoute.useSearch()\n        return (\n          <>\n            <h1>Posts</h1>\n            <div data-testid=\"posts-search\">{foo}</div>\n            <Link data-testid=\"posts-link-new\" to=\"/posts/new\">\n              new\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const postsNewRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: 'new',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postsNewRoute]),\n        invoicesRoute,\n      ]),\n      history,\n    })\n\n    window.history.replaceState(null, 'root', '/?root=abc')\n\n    render(<RouterProvider router={router} />)\n\n    const searchValue = await screen.findByTestId('posts-search')\n    expect(searchValue).toHaveTextContent('default')\n\n    expect(router.state.location.pathname).toBe('/posts')\n    expect(router.state.location.search).toEqual({ root: 'abc' })\n\n    // link to sibling does not retain search param\n    const invoicesLink = await screen.findByTestId('root-link-invoices')\n    expect(invoicesLink).toHaveAttribute('href')\n    const invoicesLinkHref = invoicesLink.getAttribute('href')\n    const invoicesLinkSearch = getSearchParamsFromURI(invoicesLinkHref!)\n    expect(invoicesLinkSearch.size).toBe(0)\n\n    // link to child retains search param\n    const postsNewLink = await screen.findByTestId('posts-link-new')\n    expect(postsNewLink).toHaveAttribute('href')\n    const postsNewLinkHref = postsNewLink.getAttribute('href')\n    const postsNewLinkSearch = getSearchParamsFromURI(postsNewLinkHref!)\n    expect(postsNewLinkSearch.size).toBe(1)\n    expect(postsNewLinkSearch.get('root')).toBe('abc')\n\n    const postsLink = await screen.findByTestId('root-link-posts')\n    expect(postsLink).toHaveAttribute('href')\n    const postsLinkHref = postsNewLink.getAttribute('href')\n    const postsLinkSearch = getSearchParamsFromURI(postsLinkHref!)\n    expect(postsLinkSearch.size).toBe(1)\n    expect(postsLinkSearch.get('root')).toBe('abc')\n    expect(postsLink).toHaveAttribute('data-status', 'active')\n  })\n\n  describe('reloadDocument', () => {\n    test('link to /posts with params', async () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index</h1>\n              <Link\n                to=\"/posts/$postId\"\n                params={{ postId: 'id1' }}\n                reloadDocument={true}\n                data-testid=\"link-to-post-1\"\n              >\n                To first post\n              </Link>\n            </>\n          )\n        },\n      })\n\n      const PostsComponent = () => {\n        return (\n          <>\n            <h1>Posts</h1>\n            <Link to=\"/\">Index</Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'posts',\n        component: PostsComponent,\n      })\n\n      const PostComponent = () => {\n        const params = useParams({ strict: false })\n        return <span>Params: {params.postId}</span>\n      }\n\n      const postRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        component: PostComponent,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          postsRoute.addChildren([postRoute]),\n        ]),\n        history,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const postLink = await screen.findByTestId('link-to-post-1')\n\n      expect(postLink).toHaveAttribute('href', '/posts/id1')\n    })\n  })\n})\n\ndescribe.each([{ basepath: '' }, { basepath: '/basepath' }])(\n  'relative links with %s',\n  ({ basepath }) => {\n    const setupRouter = () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return <h1>Index Route</h1>\n        },\n      })\n      const aRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'a',\n        component: () => {\n          return (\n            <>\n              <h1>A Route</h1>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const bRoute = createRoute({\n        getParentRoute: () => aRoute,\n        path: 'b',\n        component: () => {\n          return (\n            <>\n              <h1>B Route</h1>\n              <Link to=\"..\">Link to Parent</Link>\n            </>\n          )\n        },\n      })\n\n      const paramRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'param/$param',\n        component: () => {\n          return (\n            <>\n              <h1>Param Route</h1>\n              <Link from={paramRoute.fullPath} to=\"./a\">\n                Link to ./a\n              </Link>\n              <Link to=\"c\" unsafeRelative=\"path\">\n                Link to c\n              </Link>\n              <Link to=\"../c\" unsafeRelative=\"path\">\n                Link to ../c\n              </Link>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const paramARoute = createRoute({\n        getParentRoute: () => paramRoute,\n        path: 'a',\n        component: () => {\n          return (\n            <>\n              <h1>Param A Route</h1>\n              <Link from={paramARoute.fullPath} to=\"..\">\n                Link to .. from /param/foo/a\n              </Link>\n              <Link to=\"..\" data-testid={'link-to-previous'}>\n                Link to .. from current active route\n              </Link>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const paramBRoute = createRoute({\n        getParentRoute: () => paramARoute,\n        path: 'b',\n        component: () => {\n          return (\n            <>\n              <h1>Param B Route</h1>\n              <Link to=\"..\">Link to Parent</Link>\n              <Link to=\".\" params={{ param: 'bar' }}>\n                Link to . with param:bar\n              </Link>\n              <Link to=\"..\" params={{ param: 'bar' }}>\n                Link to Parent with param:bar\n              </Link>\n              <paramBRoute.Link\n                to=\"..\"\n                params={(prev) => ({ ...prev, param: 'bar' })}\n              >\n                Link to Parent with param:bar functional\n              </paramBRoute.Link>\n            </>\n          )\n        },\n      })\n\n      const paramCRoute = createRoute({\n        getParentRoute: () => paramARoute,\n        path: 'c',\n        component: () => {\n          return <h1>Param C Route</h1>\n        },\n      })\n\n      const splatRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'splat/$',\n        component: () => {\n          return (\n            <>\n              <h1>Splat Route</h1>\n              <Link to=\"..\" unsafeRelative=\"path\">\n                Unsafe link to ..\n              </Link>\n              <Link to=\".\" unsafeRelative=\"path\">\n                Unsafe link to .\n              </Link>\n              <Link to=\"./child\" unsafeRelative=\"path\">\n                Unsafe link to ./child\n              </Link>\n            </>\n          )\n        },\n      })\n\n      return createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          aRoute.addChildren([bRoute]),\n          paramRoute.addChildren([\n            paramARoute.addChildren([paramBRoute, paramCRoute]),\n          ]),\n          splatRoute,\n        ]),\n        history,\n        basepath: basepath === '' ? undefined : basepath,\n      })\n    }\n\n    test('should navigate to the parent route', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      // Navigate to /a/b\n      await act(async () => {\n        history.push(`${basepath}/a/b`)\n      })\n\n      // Inspect the link to go up a parent\n      const parentLink = await screen.findByText('Link to Parent')\n      expect(parentLink.getAttribute('href')).toBe(`${basepath}/a`)\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(parentLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/a`)\n    })\n\n    test('should navigate to the parent route and keep params', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      // Navigate to /param/oldParamValue/a/b\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the link to go up a parent and keep the params\n      const parentLink = await screen.findByText('Link to Parent')\n      expect(parentLink.getAttribute('href')).toBe(`${basepath}/param/foo/a`)\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(parentLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a`)\n    })\n\n    test('should navigate to the parent route and change params', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      // Navigate to /param/oldParamValue/a/b\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the link to go up a parent and keep the params\n      const parentLink = await screen.findByText(\n        'Link to Parent with param:bar',\n      )\n      expect(parentLink.getAttribute('href')).toBe(`${basepath}/param/bar/a`)\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(parentLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/param/bar/a`)\n    })\n\n    test('should navigate to a relative link based on render location', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText('Link to ./a')\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/param/foo/a`)\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(relativeLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a`)\n    })\n\n    test('should navigate to a parent link based on render location', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText(\n        'Link to .. from /param/foo/a',\n      )\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/param/foo`)\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(relativeLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo`)\n    })\n\n    test('should navigate to a parent link based on active location', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      const relativeLink = await screen.findByTestId('link-to-previous')\n\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/param/foo/a`)\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(relativeLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a`)\n    })\n\n    test('should navigate to a child link based on pathname', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText('Link to c')\n      expect(relativeLink.getAttribute('href')).toBe(\n        `${basepath}/param/foo/a/b/c`,\n      )\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(relativeLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a/b/c`)\n    })\n\n    test('should navigate to a relative link based on pathname', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText('Link to ../c')\n      expect(relativeLink.getAttribute('href')).toBe(\n        `${basepath}/param/foo/a/c`,\n      )\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(relativeLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a/c`)\n    })\n\n    test('should navigate to parent inside of splat route based on pathname', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/splat/a/b/c/d`)\n      })\n\n      const relativeLink = await screen.findByText('Unsafe link to ..')\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/splat/a/b/c`)\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(relativeLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/splat/a/b/c`)\n    })\n\n    test('should navigate to same route inside of splat route based on pathname', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/splat/a/b/c`)\n      })\n\n      const relativeLink = await screen.findByText('Unsafe link to .')\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/splat/a/b/c`)\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(relativeLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/splat/a/b/c`)\n    })\n\n    test('should navigate to child route inside of splat route based on pathname', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/splat/a/b/c`)\n      })\n\n      const relativeLink = await screen.findByText('Unsafe link to ./child')\n      expect(relativeLink.getAttribute('href')).toBe(\n        `${basepath}/splat/a/b/c/child`,\n      )\n\n      // Click the link and ensure the new location\n      await act(async () => {\n        fireEvent.click(relativeLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/splat/a/b/c/child`)\n    })\n\n    test('should navigate to same route with different params', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      const parentLink = await screen.findByText('Link to . with param:bar')\n\n      await act(async () => {\n        fireEvent.click(parentLink)\n      })\n\n      expect(window.location.pathname).toBe(`${basepath}/param/bar/a/b`)\n    })\n  },\n)\n\ndescribe('splat routes with empty splat', () => {\n  test.each(Object.values(trailingSlashOptions))(\n    'should handle empty _splat parameter with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash === 'always' ? '/' : ''\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index Route</h1>\n              <Link\n                data-testid=\"splat-link-with-empty-splat\"\n                to=\"/splat/$\"\n                params={{ _splat: '' }}\n                activeProps={{ className: 'active' }}\n              >\n                Link to splat with _splat value\n              </Link>\n              <Link\n                data-testid=\"splat-link-with-undefined-splat\"\n                to=\"/splat/$\"\n                params={{ _splat: undefined }}\n                activeProps={{ className: 'active' }}\n              >\n                Link to splat with undefined _splat\n              </Link>\n              <Link\n                data-testid=\"splat-link-with-no-splat\"\n                to=\"/splat/$\"\n                params={{}}\n                activeProps={{ className: 'active' }}\n              >\n                Link to splat with no _splat at all\n              </Link>\n            </>\n          )\n        },\n      })\n\n      const splatRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'splat/$',\n        component: () => {\n          return <h1>Splat Route</h1>\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, splatRoute]),\n        history,\n        trailingSlash,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const splatLinkWithEmptySplat = await screen.findByTestId(\n        'splat-link-with-empty-splat',\n      )\n      const splatLinkWithUndefinedSplat = await screen.findByTestId(\n        'splat-link-with-undefined-splat',\n      )\n      const splatLinkWithNoSplat = await screen.findByTestId(\n        'splat-link-with-no-splat',\n      )\n\n      // When _splat has a value, it should follow the trailingSlash setting\n      expect(splatLinkWithEmptySplat.getAttribute('href')).toBe(`/splat${tail}`)\n      expect(splatLinkWithUndefinedSplat.getAttribute('href')).toBe(\n        `/splat${tail}`,\n      )\n      expect(splatLinkWithNoSplat.getAttribute('href')).toBe(`/splat${tail}`)\n\n      // Click the link with empty _splat and ensure the route matches\n      await act(async () => {\n        fireEvent.click(splatLinkWithEmptySplat)\n      })\n\n      expect(splatLinkWithEmptySplat).toHaveClass('active')\n      expect(splatLinkWithUndefinedSplat).toHaveClass('active')\n      expect(splatLinkWithNoSplat).toHaveClass('active')\n      expect(window.location.pathname).toBe(`/splat${tail}`)\n      expect(await screen.findByText('Splat Route')).toBeInTheDocument()\n    },\n  )\n})\n\ndescribe('relative links to current route', () => {\n  test.each([true, false])(\n    'should navigate to current route when using \".\" in nested route structure from Index Route with trailingSlash: %s',\n    async (trailingSlash: boolean) => {\n      const tail = trailingSlash ? '/' : ''\n\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <Link data-testid=\"posts-link\" to=\"/post\">\n              Post\n            </Link>\n            <Link\n              data-testid=\"search-link\"\n              to=\".\"\n              search={{ param1: 'value1' }}\n            >\n              Search\n            </Link>\n            <Link\n              data-testid=\"search2-link\"\n              to=\".\"\n              search={{ param1: 'value2' }}\n            >\n              Search2\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n        validateSearch: z.object({\n          param1: z.string().optional(),\n        }),\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => indexRoute,\n        path: 'post',\n        component: () => (\n          <>\n            <div>Post</div>\n          </>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postRoute]),\n        history,\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const postButton = await screen.findByTestId('posts-link')\n      const searchButton = await screen.findByTestId('search-link')\n      const searchButton2 = await screen.findByTestId('search2-link')\n\n      await act(() => fireEvent.click(postButton))\n\n      expect(window.location.pathname).toBe(`/post${tail}`)\n\n      await act(() => fireEvent.click(searchButton))\n\n      expect(router.state.location.pathname).toBe(`/post${tail}`)\n      expect(router.state.location.search).toEqual({ param1: 'value1' })\n\n      await act(() => fireEvent.click(searchButton2))\n\n      expect(router.state.location.pathname).toBe(`/post${tail}`)\n      expect(router.state.location.search).toEqual({ param1: 'value2' })\n    },\n  )\n\n  test.each([true, false])(\n    'should navigate to current route with search params when using \".\" in nested route structure from Index Route with trailingSlash: %s',\n    async (trailingSlash: boolean) => {\n      const tail = trailingSlash ? '/' : ''\n\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <Link data-testid=\"posts-link\" to=\"/post\">\n              Post\n            </Link>\n            <Link\n              data-testid=\"search-link\"\n              to=\".\"\n              search={{ param1: 'value1' }}\n            >\n              Search\n            </Link>\n            <Link\n              data-testid=\"search2-link\"\n              to=\"/post\"\n              search={{ param1: 'value2' }}\n            >\n              Search2\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n        validateSearch: z.object({\n          param1: z.string().optional(),\n        }),\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => indexRoute,\n        path: 'post',\n        component: () => <div>Post</div>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postRoute]),\n        history,\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const postButton = await screen.findByTestId('posts-link')\n\n      await act(() => fireEvent.click(postButton))\n\n      expect(window.location.pathname).toBe(`/post${tail}`)\n\n      const searchButton = await screen.findByTestId('search-link')\n\n      await act(() => fireEvent.click(searchButton))\n\n      expect(router.state.location.pathname).toBe(`/post${tail}`)\n      expect(router.state.location.search).toEqual({ param1: 'value1' })\n\n      const searchButton2 = await screen.findByTestId('search2-link')\n\n      await act(() => fireEvent.click(searchButton2))\n\n      expect(router.state.location.pathname).toBe(`/post${tail}`)\n      expect(router.state.location.search).toEqual({ param1: 'value2' })\n    },\n  )\n\n  test.each([true, false])(\n    'should navigate to current route with changing path params when using \".\" in nested route structure with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash ? '/' : ''\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"index-heading\">Index</h1>\n            <Link data-testid=\"posts-link\" to=\"/posts\">\n              Posts\n            </Link>\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n      })\n\n      const layoutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        id: '_layout',\n        component: () => {\n          return (\n            <>\n              <h1>Layout</h1>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const PostsComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"posts-index-heading\">Posts</h1>\n            <Link\n              data-testid=\"first-post-link\"\n              to=\"$postId\"\n              params={{ postId: 'id1' }}\n            >\n              To first post\n            </Link>\n            <Link\n              data-testid=\"second-post-link\"\n              to=\".\"\n              params={{ postId: 'id2' }}\n            >\n              To second post\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const postsRoute = createRoute({\n        getParentRoute: () => layoutRoute,\n        path: 'posts',\n        component: PostsComponent,\n      })\n\n      const PostComponent = () => {\n        const params = useParams({ strict: false })\n        return (\n          <>\n            <span data-testid={`post-${params.postId}`}>\n              Params: {params.postId}\n            </span>\n          </>\n        )\n      }\n\n      const postRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        component: PostComponent,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          layoutRoute.addChildren([postsRoute.addChildren([postRoute])]),\n        ]),\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const postsButton = await screen.findByTestId('posts-link')\n\n      await act(() => fireEvent.click(postsButton))\n\n      expect(\n        await screen.findByTestId('posts-index-heading'),\n      ).toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts${tail}`)\n\n      const firstPostButton = await screen.findByTestId('first-post-link')\n\n      await act(() => fireEvent.click(firstPostButton))\n\n      expect(await screen.findByTestId('post-id1')).toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts/id1${tail}`)\n\n      const secondPostButton = await screen.findByTestId('second-post-link')\n\n      await act(() => fireEvent.click(secondPostButton))\n\n      expect(await screen.findByTestId('post-id2')).toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts/id2${tail}`)\n    },\n  )\n})\n\ndescribe('relative links to from route', () => {\n  test.each([true, false])(\n    'should navigate to from route when using \".\" in nested route structure from Index Route with trailingSlash: %s',\n    async (trailingSlash: boolean) => {\n      const tail = trailingSlash ? '/' : ''\n\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <Link data-testid=\"posts-link\" to=\"/post\">\n              Post\n            </Link>\n            <Link\n              data-testid=\"search-link\"\n              to=\".\"\n              search={{ param1: 'value1' }}\n            >\n              Search\n            </Link>\n            <Link data-testid=\"home-link\" from=\"/\" to=\".\">\n              Go To Home\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n        validateSearch: z.object({\n          param1: z.string().optional(),\n        }),\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => indexRoute,\n        path: 'post',\n        component: () => <div>Post</div>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postRoute]),\n        history,\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const postButton = await screen.findByTestId('posts-link')\n\n      await act(() => fireEvent.click(postButton))\n\n      expect(router.state.location.pathname).toBe(`/post${tail}`)\n\n      const searchButton = await screen.findByTestId('search-link')\n\n      await act(() => fireEvent.click(searchButton))\n\n      expect(router.state.location.pathname).toBe(`/post${tail}`)\n      expect(router.state.location.search).toEqual({ param1: 'value1' })\n\n      const homeBtn = await screen.findByTestId('home-link')\n\n      await act(() => fireEvent.click(homeBtn))\n\n      expect(router.state.location.pathname).toBe(`/`)\n      expect(router.state.location.search).toEqual({})\n    },\n  )\n\n  test.each([true, false])(\n    'should navigate to from route with path params when using \".\" in nested route structure with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash ? '/' : ''\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"index-heading\">Index</h1>\n            <Link data-testid=\"posts-link\" to=\"/posts\">\n              Posts\n            </Link>\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n      })\n\n      const layoutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        id: '_layout',\n        component: () => {\n          return (\n            <>\n              <h1>Layout</h1>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const PostsComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"posts-index-heading\">Posts</h1>\n            <Link\n              data-testid=\"first-post-link\"\n              to=\"$postId\"\n              params={{ postId: '1' }}\n            >\n              To first post\n            </Link>\n            <Link\n              data-testid=\"second-post-link\"\n              to=\"$postId\"\n              params={{ postId: '2' }}\n            >\n              To second post\n            </Link>\n            <Link data-testid=\"to-posts-index-link\" from=\"/posts\" to=\".\">\n              To posts list\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const PostDetailComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"post-detail-index-heading\">Post Detail</h1>\n            <Link data-testid=\"post-info-link\" to=\"info\">\n              To post info\n            </Link>\n            <Link data-testid=\"post-notes-link\" to=\"notes\">\n              To post notes\n            </Link>\n            <Link\n              data-testid=\"to-post-detail-index-link\"\n              from=\"/posts/$postId\"\n              to=\".\"\n            >\n              To index detail options\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const PostInfoComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"post-info-heading\">Post Info</h1>\n          </>\n        )\n      }\n\n      const PostNotesComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"post-notes-heading\">Post Notes</h1>\n          </>\n        )\n      }\n\n      const postsRoute = createRoute({\n        getParentRoute: () => layoutRoute,\n        path: 'posts',\n        component: PostsComponent,\n      })\n\n      const postDetailRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        component: PostDetailComponent,\n      })\n\n      const postInfoRoute = createRoute({\n        getParentRoute: () => postDetailRoute,\n        path: 'info',\n        component: PostInfoComponent,\n      })\n\n      const postNotesRoute = createRoute({\n        getParentRoute: () => postDetailRoute,\n        path: 'notes',\n        component: PostNotesComponent,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          layoutRoute.addChildren([\n            postsRoute.addChildren([\n              postDetailRoute.addChildren([postInfoRoute, postNotesRoute]),\n            ]),\n          ]),\n        ]),\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const postsButton = await screen.findByTestId('posts-link')\n\n      fireEvent.click(postsButton)\n\n      expect(\n        await screen.findByTestId('posts-index-heading'),\n      ).toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts${tail}`)\n\n      const firstPostButton = await screen.findByTestId('first-post-link')\n\n      fireEvent.click(firstPostButton)\n\n      expect(\n        await screen.findByTestId('post-detail-index-heading'),\n      ).toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts/1${tail}`)\n\n      const postInfoButton = await screen.findByTestId('post-info-link')\n\n      fireEvent.click(postInfoButton)\n\n      expect(await screen.findByTestId('post-info-heading')).toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts/1/info${tail}`)\n\n      const toPostDetailIndexButton = await screen.findByTestId(\n        'to-post-detail-index-link',\n      )\n\n      fireEvent.click(toPostDetailIndexButton)\n\n      expect(\n        await screen.findByTestId('post-detail-index-heading'),\n      ).toBeInTheDocument()\n      expect(screen.queryByTestId('post-info-heading')).not.toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts/1${tail}`)\n\n      const postNotesButton = await screen.findByTestId('post-notes-link')\n\n      fireEvent.click(postNotesButton)\n\n      expect(\n        await screen.findByTestId('post-notes-heading'),\n      ).toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts/1/notes${tail}`)\n\n      const toPostsIndexButton = await screen.findByTestId(\n        'to-posts-index-link',\n      )\n\n      fireEvent.click(toPostsIndexButton)\n\n      expect(\n        await screen.findByTestId('posts-index-heading'),\n      ).toBeInTheDocument()\n      expect(screen.queryByTestId('post-notes-heading')).not.toBeInTheDocument()\n      expect(\n        screen.queryByTestId('post-detail-index-heading'),\n      ).not.toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts${tail}`)\n\n      const secondPostButton = await screen.findByTestId('second-post-link')\n\n      fireEvent.click(secondPostButton)\n\n      expect(\n        await screen.findByTestId('post-detail-index-heading'),\n      ).toBeInTheDocument()\n      expect(window.location.pathname).toEqual(`/posts/2${tail}`)\n    },\n  )\n})\n\ndescribe('when on /posts/$postId and navigating to ../ with default `from` /posts', () => {\n  async function runTest(navigateVia: 'Route' | 'RouteApi') {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"index-heading\">Index</h1>\n          <Link data-testid=\"posts-link\" to=\"/posts\">\n            Posts\n          </Link>\n          <Link\n            data-testid=\"index-to-first-post-link\"\n            to=\"/posts/$postId/details\"\n            params={{ postId: 'id1' }}\n          >\n            To first post\n          </Link>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const LinkViaRoute = () => (\n        <Link from={postsRoute.fullPath} to=\"../\" data-testid=\"link-to-home\">\n          To Home\n        </Link>\n      )\n\n      const LinkViaRouteApi = () => {\n        const RouteApiLink = getRouteApi('/_layout/posts').Link\n        return (\n          <RouteApiLink to=\"../\" data-testid=\"link-to-home\">\n            To Home\n          </RouteApiLink>\n        )\n      }\n\n      return (\n        <>\n          <h1>Posts</h1>\n          {navigateVia === 'Route' ? <LinkViaRoute /> : <LinkViaRouteApi />}\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const PostIndexComponent = () => {\n      return (\n        <>\n          <h1>Post Index</h1>\n        </>\n      )\n    }\n\n    const postIndexRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: '/',\n      component: PostIndexComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"details-heading\">Details!</h1>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([postIndexRoute, detailsRoute]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByTestId('index-to-first-post-link')\n\n    fireEvent.click(postsButton)\n\n    expect(await screen.findByTestId('details-heading')).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const homeButton = await screen.findByTestId('link-to-home')\n\n    fireEvent.click(homeButton)\n\n    expect(await screen.findByTestId('index-heading')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual('/')\n  }\n\n  test('Route', () => runTest('Route'))\n  test('RouteApi', () => runTest('RouteApi'))\n})\n\ndescribe('rewrite', () => {\n  test('renders hard link when rewrite points to different origin', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link data-testid=\"link-to-index\" to=\"/\">\n              Index\n            </Link>\n            <Link data-testid=\"link-to-info\" to=\"/info\">\n              Info\n            </Link>\n            <Link data-testid=\"link-to-app\" to=\"/app\">\n              App\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const infoRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/info',\n      component: () => {\n        return (\n          <>\n            <h1>Info</h1>\n          </>\n        )\n      },\n    })\n\n    const appRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/app',\n      component: () => {\n        return (\n          <>\n            <h1>App</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, infoRoute, appRoute]),\n      history,\n      origin: 'http://example.com',\n      rewrite: {\n        input: ({ url }) => {\n          if (url.href.startsWith('http://app.example.com')) {\n            return url.href.replace('http://example.com/ap', '')\n          }\n          return undefined\n        },\n        output: ({ url }) => {\n          if (url.pathname.startsWith('/app')) {\n            ;((url.hostname = 'app.example.com'),\n              (url.pathname = url.pathname.replace(/^\\/app/, '')))\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const infoLink = await screen.findByTestId('link-to-info')\n    expect(infoLink).toHaveAttribute('href', '/info')\n\n    const appLink = await screen.findByTestId('link-to-app')\n    expect(appLink).toHaveAttribute('href', 'http://app.example.com/')\n  })\n})\n\ndescribe('hash history with target=\"_blank\" links', () => {\n  test('should generate correct href for target=\"_blank\" links in hash history mode', async () => {\n    const hashHistory = createHashHistory()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link data-testid=\"posts-link\" to=\"/posts\">\n              Posts (same tab)\n            </Link>\n            <Link data-testid=\"about-blank-link\" to=\"/about\" target=\"_blank\">\n              About (new tab)\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1>Posts</h1>,\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <h1>About</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute, aboutRoute]),\n      history: hashHistory,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsLink = await screen.findByTestId('posts-link')\n    expect(postsLink).toHaveAttribute('href', '/#/posts')\n    expect(postsLink).not.toHaveAttribute('target', '_blank')\n\n    const postsBlankLink = await screen.findByTestId('about-blank-link')\n    expect(postsBlankLink).toHaveAttribute('href', '/#/about')\n    expect(postsBlankLink).toHaveAttribute('target', '_blank')\n  })\n})\n\ndescribe('encoded and unicode paths', () => {\n  const testCases = [\n    {\n      name: 'with prefix',\n      path: '/foo/prefix@대{$}',\n      expectedPath:\n        '/foo/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]',\n      expectedLocation: '/foo/prefix@대test[s%5C/.%5C/parameter%25!🚀%40]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with suffix',\n      path: '/foo/{$}대suffix@',\n      expectedPath:\n        '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]%EB%8C%80suffix@',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀%40]대suffix@',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with wildcard',\n      path: '/foo/$',\n      expectedPath: '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n    // '/' is left as is with splat params but encoded with normal params\n    {\n      name: 'with path param',\n      path: `/foo/$id`,\n      expectedPath: '/foo/test[s%5C%2F.%5C%2Fparameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C%2F.%5C%2Fparameter%25!🚀]',\n      params: {\n        id: 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n  ]\n\n  test.each(testCases)(\n    'should handle encoded, decoded paths with unicode characters correctly - $name',\n    async ({ path, expectedPath, expectedLocation, params }) => {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index Route</h1>\n              <Link data-testid=\"link-to-path\" to={path} params={params}>\n                Link to path\n              </Link>\n            </>\n          )\n        },\n      })\n\n      const pathRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path,\n        component: PathRouteComponent,\n      })\n\n      function PathRouteComponent() {\n        const params = pathRoute.useParams()\n        return (\n          <div>\n            <h1>Path Route</h1>\n            <p>\n              params:{' '}\n              <span data-testid=\"params-to-validate\">\n                {JSON.stringify(params)}\n              </span>\n            </p>\n          </div>\n        )\n      }\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, pathRoute]),\n        history,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const link = await screen.findByTestId('link-to-path')\n\n      expect(link.getAttribute('href')).toBe(expectedPath)\n\n      await act(() => fireEvent.click(link))\n\n      const paramsToValidate = await screen.findByTestId('params-to-validate')\n\n      expect(window.location.pathname).toBe(expectedPath)\n      expect(router.latestLocation.pathname).toBe(expectedLocation)\n\n      expect(paramsToValidate.textContent).toEqual(JSON.stringify(params))\n    },\n  )\n})\n\ndescribe('protocolAllowlist', () => {\n  const rootRoute = createRootRoute()\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => (\n      <>\n        <Link to=\"x-safari-https://example.com\" />\n        <Link\n          to=\"intent://example.com#Intent;scheme=https;end\"\n          reloadDocument\n        />\n      </>\n    ),\n  })\n\n  let consoleWarn = vi.fn()\n  beforeEach(() => {\n    consoleWarn = vi.fn()\n    vi.spyOn(console, 'warn').mockImplementation(consoleWarn)\n  })\n  afterEach(() => {\n    vi.restoreAllMocks()\n  })\n\n  it('should work like normal links when protocolAllowlist is set', async () => {\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      history,\n      protocolAllowlist: ['x-safari-https:', 'intent:'],\n    })\n    render(<RouterProvider router={router} />)\n    const links = await screen.findAllByRole('link')\n    expect(links[0]).toHaveAttribute('href', 'x-safari-https://example.com')\n    expect(links[1]).toHaveAttribute(\n      'href',\n      'intent://example.com#Intent;scheme=https;end',\n    )\n    expect(consoleWarn).not.toHaveBeenCalled()\n  })\n\n  it('should fallback to relative links when protocol is not in allowlist', async () => {\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      history,\n      protocolAllowlist: [],\n    })\n    render(<RouterProvider router={router} />)\n    const links = await screen.findAllByRole('link')\n    expect(links[0]).toHaveAttribute('href', '/x-safari-https:/example.com')\n    expect(links[1]).toHaveAttribute(\n      'href',\n      '/intent:/example.com#Intent;scheme=https;end',\n    )\n    expect(consoleWarn).toHaveBeenCalledWith(\n      'Blocked Link with dangerous protocol: x-safari-https://example.com',\n    )\n    expect(consoleWarn).toHaveBeenCalledWith(\n      'Blocked Link with dangerous protocol: intent://example.com#Intent;scheme=https;end',\n    )\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/loaders.test.tsx",
    "content": "import {\n  act,\n  cleanup,\n  configure,\n  fireEvent,\n  render,\n  screen,\n} from '@testing-library/react'\n\nimport { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\n\nimport { z } from 'zod'\nimport { useEffect } from 'react'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useRouter,\n} from '../src'\n\nimport { sleep } from './utils'\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\nconst WAIT_TIME = 100\n\ndescribe('loaders are being called', () => {\n  configure({ reactStrictMode: true })\n\n  test('called on /', async () => {\n    const indexLoaderMock = vi.fn()\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        indexLoaderMock('foo')\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    expect(indexLoaderMock).toHaveBeenCalled()\n  })\n\n  test('both are called on /nested/foo', async () => {\n    const nestedLoaderMock = vi.fn()\n    const nestedFooLoaderMock = vi.fn()\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/nested/foo\">link to foo</Link>\n          </div>\n        )\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        nestedLoaderMock('nested')\n      },\n    })\n    const fooRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/foo',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        nestedFooLoaderMock('foo')\n      },\n      component: () => <div>Nested Foo page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([fooRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByText('link to foo')\n    fireEvent.click(linkToAbout)\n\n    const fooElement = await screen.findByText('Nested Foo page')\n    expect(fooElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/foo')\n    expect(window.location.pathname).toBe('/nested/foo')\n\n    expect(nestedLoaderMock).toHaveBeenCalled()\n    expect(nestedFooLoaderMock).toHaveBeenCalled()\n  })\n})\n\ndescribe('loaders parentMatchPromise', () => {\n  test('parentMatchPromise is defined in a child route', async () => {\n    const nestedLoaderMock = vi.fn()\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div>\n          Index page\n          <Link to=\"/nested/foo\">link to foo</Link>\n        </div>\n      ),\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        return 'nested'\n      },\n      component: () => <Outlet />,\n    })\n    const fooRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/foo',\n      loader: async ({ parentMatchPromise }) => {\n        nestedLoaderMock(parentMatchPromise)\n        const parentMatch = await parentMatchPromise\n        expect(parentMatch.loaderData).toBe('nested')\n      },\n      component: () => <div>Nested Foo page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([fooRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToFoo = await screen.findByRole('link', { name: 'link to foo' })\n\n    expect(linkToFoo).toBeInTheDocument()\n\n    fireEvent.click(linkToFoo)\n\n    const fooElement = await screen.findByText('Nested Foo page')\n    expect(fooElement).toBeInTheDocument()\n\n    expect(nestedLoaderMock).toHaveBeenCalled()\n    expect(nestedLoaderMock.mock.calls[0]?.[0]).toBeInstanceOf(Promise)\n  })\n})\n\ntest('reproducer for #2031', async () => {\n  const rootRoute = createRootRoute({\n    beforeLoad: () => {\n      console.log('beforeload called')\n    },\n  })\n\n  const searchSchema = z.object({\n    data: z.string().array().default([]),\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <div>Index page</div>,\n\n    validateSearch: searchSchema,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n  const router = createRouter({ routeTree, history })\n\n  render(<RouterProvider router={router} />)\n\n  const indexElement = await screen.findByText('Index page')\n  expect(indexElement).toBeInTheDocument()\n})\n\ntest('reproducer for #2053', async () => {\n  const rootRoute = createRootRoute({\n    beforeLoad: () => {\n      console.log('beforeload called')\n    },\n  })\n\n  const fooRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/foo/$fooId',\n    component: () => {\n      const { fooId } = fooRoute.useParams()\n      return <div>fooId: {fooId}</div>\n    },\n  })\n\n  window.history.replaceState(null, 'root', '/foo/3ΚΑΠΠΑ')\n\n  const routeTree = rootRoute.addChildren([fooRoute])\n\n  const router = createRouter({\n    routeTree,\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const fooElement = await screen.findByText('fooId: 3ΚΑΠΠΑ')\n  expect(fooElement).toBeInTheDocument()\n})\n\ntest('reproducer for #2198 - throw error from beforeLoad upon initial load', async () => {\n  const rootRoute = createRootRoute({})\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <div>Index page</div>,\n    beforeLoad: () => {\n      throw new Error('Test!')\n    },\n    errorComponent: () => <div>indexErrorComponent</div>,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n  const router = createRouter({\n    routeTree,\n    history,\n    defaultErrorComponent: () => {\n      return <div>defaultErrorComponent</div>\n    },\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const errorElement = await screen.findByText('indexErrorComponent')\n  expect(errorElement).toBeInTheDocument()\n})\n\ntest('throw error from loader upon initial load', async () => {\n  const rootRoute = createRootRoute({})\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <div>Index page</div>,\n    loader: () => {\n      throw new Error('Test!')\n    },\n    errorComponent: () => <div>indexErrorComponent</div>,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n  const router = createRouter({\n    routeTree,\n    history,\n    defaultErrorComponent: () => {\n      return <div>defaultErrorComponent</div>\n    },\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const errorElement = await screen.findByText('indexErrorComponent')\n  expect(errorElement).toBeInTheDocument()\n})\n\ntest('throw error from beforeLoad when navigating to route', async () => {\n  const rootRoute = createRootRoute({})\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => (\n      <div>\n        <h1>Index page</h1> <Link to=\"/foo\">link to foo</Link>\n      </div>\n    ),\n    errorComponent: () => <div>indexErrorComponent</div>,\n  })\n\n  const fooRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/foo',\n    component: () => <div>Foo page</div>,\n    beforeLoad: () => {\n      throw new Error('Test!')\n    },\n    errorComponent: () => <div>fooErrorComponent</div>,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, fooRoute])\n  const router = createRouter({\n    routeTree,\n    history,\n    defaultErrorComponent: () => {\n      return <div>defaultErrorComponent</div>\n    },\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const linkToFoo = await screen.findByRole('link', { name: 'link to foo' })\n\n  expect(linkToFoo).toBeInTheDocument()\n\n  fireEvent.click(linkToFoo)\n\n  const indexElement = await screen.findByText('fooErrorComponent')\n  expect(indexElement).toBeInTheDocument()\n})\n\ntest('reproducer #4245', async () => {\n  const LOADER_WAIT_TIME = 500\n  const rootRoute = createRootRoute({})\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    loader: async () => {\n      await sleep(LOADER_WAIT_TIME)\n      return 'index'\n    },\n\n    component: () => {\n      const data = indexRoute.useLoaderData()\n      return (\n        <div>\n          <Link to=\"/foo\" data-testid=\"link-to-foo\">\n            foo\n          </Link>\n          {data}\n        </div>\n      )\n    },\n  })\n\n  const fooRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/foo',\n    component: () => (\n      <Link to=\"/\" data-testid=\"link-to-index\">\n        index\n      </Link>\n    ),\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, fooRoute])\n  const router = createRouter({ routeTree })\n\n  render(<RouterProvider router={router} />)\n  // We wait for the initial loader to complete\n  await act(() => router.load())\n  const fooLink = await screen.findByTestId('link-to-foo')\n\n  expect(fooLink).toBeInTheDocument()\n\n  // We navigate to the foo route\n  fireEvent.click(fooLink)\n\n  // We immediately see the content of the foo route\n  const indexLink = await screen.findByTestId('link-to-index', undefined, {\n    timeout: WAIT_TIME,\n  })\n  expect(indexLink).toBeInTheDocument()\n\n  // We navigate to the index route\n  fireEvent.click(indexLink)\n\n  // We immediately see the content of the index route because the stale data is still available\n  const fooLink2 = await screen.findByTestId('link-to-foo', undefined, {\n    timeout: WAIT_TIME,\n  })\n  expect(fooLink2).toBeInTheDocument()\n\n  // We navigate to the foo route again\n  fireEvent.click(fooLink2)\n\n  // We immediately see the content of the foo route\n  const indexLink2 = await screen.findByTestId('link-to-index', undefined, {\n    timeout: WAIT_TIME,\n  })\n  expect(indexLink2).toBeInTheDocument()\n\n  // We navigate to the index route again\n  fireEvent.click(indexLink2)\n\n  // We now should see the content of the index route immediately because the stale data is still available\n  const fooLink3 = await screen.findByTestId('link-to-foo', undefined, {\n    timeout: WAIT_TIME,\n  })\n  expect(fooLink3).toBeInTheDocument()\n})\n\ntest('reproducer #4546', async () => {\n  const rootRoute = createRootRoute({\n    component: () => {\n      return (\n        <>\n          <div className=\"flex gap-2 p-2 text-lg\">\n            <Link\n              data-testid=\"link-to-index\"\n              to=\"/\"\n              activeProps={{\n                className: 'font-bold',\n              }}\n              activeOptions={{ exact: true }}\n            >\n              Home\n            </Link>{' '}\n            <Link\n              data-testid=\"link-to-id\"\n              to=\"$id\"\n              params={{\n                id: '1',\n              }}\n              activeProps={{\n                className: 'font-bold',\n              }}\n            >\n              /1\n            </Link>\n          </div>\n          <hr />\n          <Outlet />\n        </>\n      )\n    },\n  })\n\n  let counter = 0\n  const appRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '_app',\n    beforeLoad: () => {\n      counter += 1\n      return {\n        counter,\n      }\n    },\n    component: () => {\n      return (\n        <div>\n          <Header />\n          <Outlet />\n        </div>\n      )\n    },\n  })\n\n  function Header() {\n    const router = useRouter()\n    const { counter } = appRoute.useRouteContext()\n\n    return (\n      <div>\n        Header Counter: <p data-testid=\"header-counter\">{counter}</p>\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n          data-testid=\"invalidate-router\"\n          style={{\n            border: '1px solid blue',\n          }}\n        >\n          Invalidate router\n        </button>\n      </div>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => appRoute,\n    path: '/',\n    loader: ({ context }) => {\n      return {\n        counter: context.counter,\n      }\n    },\n\n    component: () => {\n      const data = indexRoute.useLoaderData()\n      const ctx = indexRoute.useRouteContext()\n\n      return (\n        <div\n          style={{\n            display: 'flex',\n            flexDirection: 'column',\n          }}\n        >\n          <div>Index route</div>\n          <div>\n            route context:{' '}\n            <p data-testid=\"index-route-context\">{ctx.counter}</p>\n          </div>\n          <div>\n            loader data: <p data-testid=\"index-loader-data\">{data.counter}</p>\n          </div>\n        </div>\n      )\n    },\n  })\n  const idRoute = createRoute({\n    getParentRoute: () => appRoute,\n    path: '$id',\n    loader: ({ context }) => {\n      return {\n        counter: context.counter,\n      }\n    },\n\n    component: () => {\n      const data = idRoute.useLoaderData()\n      const ctx = idRoute.useRouteContext()\n\n      return (\n        <div\n          style={{\n            display: 'flex',\n            flexDirection: 'column',\n          }}\n        >\n          <div>$id route</div>\n          <div>\n            route context: <p data-testid=\"id-route-context\">{ctx.counter}</p>\n          </div>\n          <div>\n            loader data: <p data-testid=\"id-loader-data\">{data.counter}</p>\n          </div>\n        </div>\n      )\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([\n    appRoute.addChildren([indexRoute, idRoute]),\n  ])\n  const router = createRouter({ routeTree })\n\n  render(<RouterProvider router={router} />)\n\n  const indexLink = await screen.findByTestId('link-to-index')\n  expect(indexLink).toBeInTheDocument()\n\n  const idLink = await screen.findByTestId('link-to-id')\n  expect(idLink).toBeInTheDocument()\n\n  const invalidateRouterButton = await screen.findByTestId('invalidate-router')\n  expect(invalidateRouterButton).toBeInTheDocument()\n\n  {\n    const headerCounter = await screen.findByTestId('header-counter')\n    expect(headerCounter).toHaveTextContent('1')\n\n    const routeContext = await screen.findByTestId('index-route-context')\n    expect(routeContext).toHaveTextContent('1')\n\n    const loaderData = await screen.findByTestId('index-loader-data')\n    expect(loaderData).toHaveTextContent('1')\n  }\n\n  fireEvent.click(idLink)\n\n  {\n    const headerCounter = await screen.findByTestId('header-counter')\n    expect(headerCounter).toHaveTextContent('2')\n\n    const routeContext = await screen.findByTestId('id-route-context')\n    expect(routeContext).toHaveTextContent('2')\n\n    const loaderData = await screen.findByTestId('id-loader-data')\n    expect(loaderData).toHaveTextContent('2')\n  }\n\n  fireEvent.click(indexLink)\n\n  {\n    const headerCounter = await screen.findByTestId('header-counter')\n    expect(headerCounter).toHaveTextContent('3')\n\n    const routeContext = await screen.findByTestId('index-route-context')\n    expect(routeContext).toHaveTextContent('3')\n\n    const loaderData = await screen.findByTestId('index-loader-data')\n    expect(loaderData).toHaveTextContent('3')\n  }\n\n  fireEvent.click(invalidateRouterButton)\n\n  {\n    const headerCounter = await screen.findByTestId('header-counter')\n    expect(headerCounter).toHaveTextContent('4')\n\n    const routeContext = await screen.findByTestId('index-route-context')\n    expect(routeContext).toHaveTextContent('4')\n\n    const loaderData = await screen.findByTestId('index-loader-data')\n    expect(loaderData).toHaveTextContent('4')\n  }\n\n  fireEvent.click(idLink)\n\n  {\n    const headerCounter = await screen.findByTestId('header-counter')\n    expect(headerCounter).toHaveTextContent('5')\n\n    const routeContext = await screen.findByTestId('id-route-context')\n    expect(routeContext).toHaveTextContent('5')\n\n    const loaderData = await screen.findByTestId('id-loader-data')\n    expect(loaderData).toHaveTextContent('5')\n  }\n})\n\ntest('clears pendingTimeout when match resolves', async () => {\n  const defaultPendingComponentOnMountMock = vi.fn()\n  const nestedPendingComponentOnMountMock = vi.fn()\n  const fooPendingComponentOnMountMock = vi.fn()\n\n  function getPendingComponent(onMount: () => void) {\n    const PendingComponent = () => {\n      useEffect(() => {\n        onMount()\n      }, [])\n\n      return <div>Pending...</div>\n    }\n    return PendingComponent\n  }\n\n  const rootRoute = createRootRoute({})\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => {\n      return (\n        <div>\n          <h1>Index page</h1>\n          <Link data-testid=\"link-to-foo\" to=\"/nested/foo\">\n            link to foo\n          </Link>\n        </div>\n      )\n    },\n  })\n  const nestedRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/nested',\n    // this route does not specify pendingMinMs, so it will use the defaultPendingMs from the router\n    // which is set to WAIT_TIME * 2\n    // since the loader immediately resolves, the pending component must NOT be shown\n    pendingComponent: getPendingComponent(nestedPendingComponentOnMountMock),\n    loader: () => {\n      return 'nested'\n    },\n  })\n  const fooRoute = createRoute({\n    getParentRoute: () => nestedRoute,\n    path: '/foo',\n    // this route's loader takes WAIT_TIME * 5, so it will take longer than the defaultPendingMs\n    // however, this route specifies pendingMs as WAIT_TIME * 10,\n    // so this route's pending component must also NOT be shown\n    pendingComponent: getPendingComponent(fooPendingComponentOnMountMock),\n    pendingMs: WAIT_TIME * 10,\n    loader: async () => {\n      await sleep(WAIT_TIME * 5)\n    },\n    component: () => <div>Nested Foo page</div>,\n  })\n  const routeTree = rootRoute.addChildren([\n    nestedRoute.addChildren([fooRoute]),\n    indexRoute,\n  ])\n  const router = createRouter({\n    routeTree,\n    history,\n    defaultPendingMs: WAIT_TIME * 2,\n    defaultPendingComponent: getPendingComponent(\n      defaultPendingComponentOnMountMock,\n    ),\n  })\n\n  render(<RouterProvider router={router} />)\n  await act(() => router.latestLoadPromise)\n  const linkToFoo = await screen.findByTestId('link-to-foo')\n  fireEvent.click(linkToFoo)\n  const fooElement = await screen.findByText('Nested Foo page')\n  expect(fooElement).toBeInTheDocument()\n\n  expect(router.state.location.href).toBe('/nested/foo')\n\n  // none of the pending components should have been called\n  expect(defaultPendingComponentOnMountMock).not.toHaveBeenCalled()\n  expect(nestedPendingComponentOnMountMock).not.toHaveBeenCalled()\n  expect(fooPendingComponentOnMountMock).not.toHaveBeenCalled()\n})\n\ntest('throw abortError from loader upon initial load with basepath', async () => {\n  window.history.replaceState(null, 'root', '/app')\n  const rootRoute = createRootRoute({})\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    loader: async () => {\n      return Promise.reject(new DOMException('Aborted', 'AbortError'))\n    },\n    component: () => <div>Index route content</div>,\n    errorComponent: () => (\n      <div data-testid=\"index-error\">indexErrorComponent</div>\n    ),\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n  const router = createRouter({ routeTree, history, basepath: '/app' })\n\n  render(<RouterProvider router={router} />)\n\n  const indexElement = await screen.findByText('Index route content')\n  expect(indexElement).toBeInTheDocument()\n  expect(screen.queryByTestId('index-error')).not.toBeInTheDocument()\n  expect(window.location.pathname.startsWith('/app')).toBe(true)\n})\n\ntest('cancelMatches after pending timeout', async () => {\n  function getPendingComponent(onMount: () => void) {\n    const PendingComponent = () => {\n      useEffect(() => {\n        onMount()\n      }, [])\n\n      return <div>Pending...</div>\n    }\n    return PendingComponent\n  }\n  const onAbortMock = vi.fn()\n  const fooPendingComponentOnMountMock = vi.fn()\n  const rootRoute = createRootRoute({\n    component: () => (\n      <div>\n        <h1>Index page</h1>\n        <Link data-testid=\"link-to-foo\" to=\"/foo\">\n          link to foo\n        </Link>\n        <Link data-testid=\"link-to-bar\" to=\"/bar\">\n          link to bar\n        </Link>\n        <Outlet />\n      </div>\n    ),\n  })\n  const fooRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/foo',\n    pendingMs: WAIT_TIME * 20,\n    loader: async ({ abortController }) => {\n      await new Promise<void>((resolve) => {\n        const timer = setTimeout(() => {\n          resolve()\n        }, WAIT_TIME * 40)\n        abortController.signal.addEventListener('abort', () => {\n          onAbortMock()\n          clearTimeout(timer)\n          resolve()\n        })\n      })\n    },\n    pendingComponent: getPendingComponent(fooPendingComponentOnMountMock),\n    component: () => <div>Foo page</div>,\n  })\n  const barRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/bar',\n    component: () => <div>Bar page</div>,\n  })\n  const routeTree = rootRoute.addChildren([fooRoute, barRoute])\n  const router = createRouter({ routeTree, history })\n  render(<RouterProvider router={router} />)\n  await act(() => router.latestLoadPromise)\n  const fooLink = await screen.findByTestId('link-to-foo')\n  fireEvent.click(fooLink)\n  await sleep(WAIT_TIME * 30)\n  const pendingElement = await screen.findByText('Pending...')\n  expect(pendingElement).toBeInTheDocument()\n  const barLink = await screen.findByTestId('link-to-bar')\n  fireEvent.click(barLink)\n  const barElement = await screen.findByText('Bar page')\n  expect(barElement).toBeInTheDocument()\n  expect(fooPendingComponentOnMountMock).toHaveBeenCalled()\n  expect(onAbortMock).toHaveBeenCalled()\n})\n\ntest('reproducer for #6388 - rapid navigation between parameterized routes should not trigger errorComponent', async () => {\n  const errorComponentRenderCount = vi.fn()\n  const onAbortMock = vi.fn()\n  const loaderCompleteMock = vi.fn()\n\n  const rootRoute = createRootRoute({\n    component: () => (\n      <div>\n        <Link data-testid=\"link-to-home\" to=\"/\">\n          Home\n        </Link>\n        <Link\n          data-testid=\"link-to-param-1\"\n          to=\"/something/$id\"\n          params={{ id: '1' }}\n          preload={false}\n        >\n          Param 1\n        </Link>\n        <Link\n          data-testid=\"link-to-param-2\"\n          to=\"/something/$id\"\n          params={{ id: '2' }}\n          preload={false}\n        >\n          Param 2\n        </Link>\n        <Outlet />\n      </div>\n    ),\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <div data-testid=\"home-page\">Home page</div>,\n  })\n\n  const paramRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/something/$id',\n    pendingMs: 0,\n    loader: async ({ params, abortController }) => {\n      const result = await new Promise<{ id: string; done: boolean }>(\n        (resolve, reject) => {\n          const timer = setTimeout(() => {\n            loaderCompleteMock(params.id)\n            resolve({ id: params.id, done: true })\n          }, WAIT_TIME * 5)\n\n          abortController.signal.addEventListener('abort', () => {\n            clearTimeout(timer)\n            onAbortMock(params.id)\n            reject(new DOMException('Aborted', 'AbortError'))\n          })\n        },\n      )\n\n      return result\n    },\n    component: () => {\n      const data = paramRoute.useLoaderData()\n      return (\n        <div data-testid=\"param-page\">\n          Param Component {data.id} {data.done ? 'Done' : 'Not done'}\n        </div>\n      )\n    },\n    errorComponent: ({ error }) => {\n      errorComponentRenderCount(error)\n      return (\n        <div data-testid=\"error-component\">\n          Error Component: {error.message} | Name: {error.name}\n        </div>\n      )\n    },\n    pendingComponent: () => <div data-testid=\"pending-component\">Pending</div>,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, paramRoute])\n  const router = createRouter({\n    routeTree,\n    history,\n    defaultPreload: false,\n  })\n\n  render(<RouterProvider router={router} />)\n  await act(() => router.latestLoadPromise)\n\n  const pendingComponent = screen.findByTestId('pending-component')\n  expect(await screen.findByTestId('home-page')).toBeInTheDocument()\n\n  const param1Link = await screen.findByTestId('link-to-param-1')\n  fireEvent.click(param1Link)\n  expect(await pendingComponent).toBeInTheDocument()\n\n  const param2Link = await screen.findByTestId('link-to-param-2')\n  fireEvent.click(param2Link)\n  expect(await pendingComponent).toBeInTheDocument()\n\n  fireEvent.click(param1Link)\n  expect(await pendingComponent).toBeInTheDocument()\n\n  await act(() => router.latestLoadPromise)\n\n  expect(onAbortMock).toHaveBeenCalled()\n  expect(errorComponentRenderCount).not.toHaveBeenCalled()\n  expect(screen.queryByTestId('error-component')).not.toBeInTheDocument()\n  expect(await pendingComponent).not.toBeInTheDocument()\n\n  const paramPage = await screen.findByTestId('param-page')\n  expect(paramPage).toBeInTheDocument()\n  expect(paramPage).toHaveTextContent('Param Component 1 Done')\n  expect(loaderCompleteMock).toHaveBeenCalled()\n})\n"
  },
  {
    "path": "packages/react-router/tests/navigate.test.tsx",
    "content": "import { afterEach, describe, expect, it, test, vi } from 'vitest'\n\nimport { trailingSlashOptions } from '@tanstack/router-core'\nimport {\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { RouterHistory } from '../src'\n\nafterEach(() => {\n  vi.clearAllMocks()\n})\n\nfunction createTestRouter(initialHistory?: RouterHistory) {\n  const history =\n    initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n  const rootRoute = createRootRoute({})\n  const indexRoute = createRoute({ getParentRoute: () => rootRoute, path: '/' })\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n  })\n  const postIdRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '/$slug',\n  })\n  const projectRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/p',\n  })\n  const projectIdRoute = createRoute({\n    getParentRoute: () => projectRoute,\n    path: '/$projectId',\n  })\n  const projectVersionRoute = createRoute({\n    getParentRoute: () => projectIdRoute,\n    path: '/$version',\n  })\n  const projectFrameRoute = createRoute({\n    getParentRoute: () => projectVersionRoute,\n    path: '/$framework',\n  })\n\n  const uRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/u',\n  })\n  const uLayoutRoute = createRoute({\n    id: '_layout',\n    getParentRoute: () => uRoute,\n  })\n  const uUsernameRoute = createRoute({\n    getParentRoute: () => uLayoutRoute,\n    path: '$username',\n  })\n\n  const gRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/g',\n  })\n  const gLayoutRoute = createRoute({\n    id: 'layout',\n    getParentRoute: () => gRoute,\n  })\n  const gUsernameRoute = createRoute({\n    getParentRoute: () => gLayoutRoute,\n    path: '$username',\n  })\n  const searchRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'search',\n    validateSearch: (search: Record<string, unknown>) => {\n      return {\n        ['foo=bar']: Number(search['foo=bar'] ?? 1),\n      }\n    },\n  })\n\n  const projectTree = projectRoute.addChildren([\n    projectIdRoute.addChildren([\n      projectVersionRoute.addChildren([projectFrameRoute]),\n    ]),\n  ])\n  const uTree = uRoute.addChildren([uLayoutRoute.addChildren([uUsernameRoute])])\n  const gTree = gRoute.addChildren([gLayoutRoute.addChildren([gUsernameRoute])])\n\n  const routeTree = rootRoute.addChildren([\n    indexRoute,\n    postsRoute.addChildren([postIdRoute]),\n    projectTree,\n    uTree,\n    gTree,\n  ])\n  const router = createRouter({ routeTree, history })\n\n  return {\n    router,\n    routes: {\n      indexRoute,\n      postsRoute,\n      postIdRoute,\n      projectRoute,\n      projectIdRoute,\n      projectVersionRoute,\n      projectFrameRoute,\n    },\n  }\n}\n\ndescribe('router.navigate navigation using a single path param - object syntax for updates', () => {\n  it('should change $slug in \"/posts/$slug\" from \"tanner\" to \"tkdodo\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      to: '/posts/$slug',\n      params: { slug: 'tkdodo' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should change $slug in \"/posts/$slug\" from \"tanner\" to \"tkdodo\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      params: { slug: 'tkdodo' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n})\n\ndescribe('router.navigate navigation using a single path param - function syntax for updates', () => {\n  it('should change $slug in \"/posts/$slug\" from \"tanner\" to \"tkdodo\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      to: '/posts/$slug',\n      params: (p: any) => ({ ...p, slug: 'tkdodo' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should change $slug in \"/posts/$slug\" from \"tanner\" to \"tkdodo\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, slug: 'tkdodo' }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n})\n\ndescribe('router.navigate navigation using multiple path params - object syntax for updates', () => {\n  it('should change $projectId in \"/p/$projectId/$version/$framework\" from \"router\" to \"query\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: { projectId: 'query' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/query/v1/react')\n  })\n\n  it('should change $projectId in \"/p/$projectId/$version/$framework\" from \"router\" to \"query\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: { projectId: 'query' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/query/v1/react')\n  })\n\n  it('should change $version in \"/p/$projectId/$version/$framework\" from \"v1\" to \"v3\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: { version: 'v3' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v3/react')\n  })\n\n  it('should change $version in \"/p/$projectId/$version/$framework\" from \"v1\" to \"v3\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: { version: 'v3' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v3/react')\n  })\n\n  it('should change $framework in \"/p/$projectId/$version/$framework\" from \"react\" to \"vue\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: { framework: 'vue' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/vue')\n  })\n\n  it('should change $framework in \"/p/$projectId/$version/$framework\" from \"react\" to \"vue\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: { framework: 'vue' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/vue')\n  })\n})\n\ndescribe('router.navigate navigation using multiple path params - function syntax for updates', () => {\n  it('should change $projectId in \"/p/$projectId/$version/$framework\" from \"router\" to \"query\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: (p: any) => ({ ...p, projectId: 'query' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/query/v1/react')\n  })\n\n  it('should change $projectId in \"/p/$projectId/$version/$framework\" from \"router\" to \"query\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, projectId: 'query' }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/query/v1/react')\n  })\n\n  it('should change $version in \"/p/$projectId/$version/$framework\" from \"v1\" to \"v3\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: (p: any) => ({ ...p, version: 'v3' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v3/react')\n  })\n\n  it('should change $version in \"/p/$projectId/$version/$framework\" from \"v1\" to \"v3\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, version: 'v3' }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v3/react')\n  })\n\n  it('should change $framework in \"/p/$projectId/$version/$framework\" from \"react\" to \"vue\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: (p: any) => ({ ...p, framework: 'vue' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/vue')\n  })\n\n  it('should change $framework in \"/p/$projectId/$version/$framework\" from \"react\" to \"vue\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, framework: 'vue' }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/vue')\n  })\n})\n\ndescribe('router.navigate navigation using layout routes resolves correctly', () => {\n  it('should resolve \"/u/tanner\" in \"/u/_layout/$username\" to \"/u/tkdodo\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/u/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/u/tanner')\n\n    await router.navigate({\n      to: '/u/$username',\n      params: { username: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/u/tkdodo')\n  })\n\n  it('should resolve \"/u/tanner\" in \"/u/_layout/$username\" to \"/u/tkdodo\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/u/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/u/tanner')\n\n    await router.navigate({\n      params: { username: 'tkdodo' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/u/tkdodo')\n  })\n\n  it('should resolve \"/g/tanner\" in \"/g/layout/$username\" to \"/g/tkdodo\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/g/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/g/tanner')\n\n    await router.navigate({\n      to: '/g/$username',\n      params: { username: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/g/tkdodo')\n  })\n\n  it('should resolve \"/g/tanner\" in \"/g/layout/$username\" to \"/g/tkdodo\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/g/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/g/tanner')\n\n    await router.navigate({\n      params: { username: 'tkdodo' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/g/tkdodo')\n  })\n\n  it('should handle search params with special characters', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/search?foo%3Dbar=2'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/search')\n    expect(router.state.location.search).toStrictEqual(\n      toNullObj({ 'foo=bar': 2 }),\n    )\n\n    await router.navigate({\n      search: { 'foo=bar': 3 },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.search).toStrictEqual(\n      toNullObj({ 'foo=bar': 3 }),\n    )\n  })\n})\n\nfunction toNullObj<T>(obj: T): T {\n  if (typeof obj === 'object') return Object.assign(Object.create(null), obj)\n  return obj\n}\n\ndescribe('relative navigation', () => {\n  it('should navigate to a child route', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts')\n\n    await router.navigate({\n      from: '/posts',\n      to: './$slug',\n      params: { slug: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should navigate to a parent route', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      to: '..',\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate to a sibling route', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      from: '/posts/$slug',\n      to: '.',\n      params: { slug: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should navigate to a sibling route without from', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      to: '.',\n      params: { slug: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should navigate to a parent route with .. from unsafe relative path', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner/child'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner/child')\n\n    await router.navigate({\n      to: '..',\n      unsafeRelative: 'path',\n    })\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n  })\n})\n\ndescribe('router.navigate navigation using optional path parameters - object syntax for updates', () => {\n  function createOptionalParamTestRouter(initialHistory?: RouterHistory) {\n    const history =\n      initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    // Single optional parameter\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}',\n    })\n\n    // Multiple optional parameters\n    const articlesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/articles/{-$category}/{-$slug}',\n    })\n\n    // Mixed required and optional parameters\n    const projectRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/p/$projectId/{-$version}/{-$framework}',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      articlesRoute,\n      projectRoute,\n    ])\n    const router = createRouter({ routeTree, history })\n\n    return {\n      router,\n      routes: {\n        indexRoute,\n        postsRoute,\n        articlesRoute,\n        projectRoute,\n      },\n    }\n  }\n\n  it('should navigate from \"/posts/tech\" to \"/posts\" by setting category to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: { category: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate from \"/posts/tech\" to \"/posts\" by setting category to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: { category: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate from \"/posts\" to \"/posts/tech\" by setting category', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: { category: 'tech' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tech')\n  })\n\n  it('should navigate from \"/posts/tech\" to \"/posts/news\" by changing category', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: { category: 'news' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/news')\n  })\n\n  it('should navigate without \"to\" path and set category to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      params: { category: undefined },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should handle multiple optional parameters - set one to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/articles/tech/hello-world'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/articles/tech/hello-world')\n\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: { category: 'tech', slug: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles/tech')\n  })\n\n  it('should handle multiple optional parameters - set both to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/articles/tech/hello-world'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/articles/tech/hello-world')\n\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: { category: undefined, slug: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles')\n  })\n\n  it('should handle mixed required and optional parameters', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/{-$version}/{-$framework}',\n      params: { projectId: 'router', version: undefined, framework: 'vue' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/vue')\n  })\n\n  it('should carry over optional parameters from current route when using empty params', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    // Navigate to a different route with optional params\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: { category: 'news' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles/news')\n\n    // Navigate back to posts - should carry over 'news' from current params\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: {},\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/news')\n  })\n})\n\ndescribe('router.navigate navigation using optional path parameters - function syntax for updates', () => {\n  function createOptionalParamTestRouter(initialHistory?: RouterHistory) {\n    const history =\n      initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}',\n    })\n\n    const articlesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/articles/{-$category}/{-$slug}',\n    })\n\n    const projectRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/p/$projectId/{-$version}/{-$framework}',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      articlesRoute,\n      projectRoute,\n    ])\n    const router = createRouter({ routeTree, history })\n\n    return { router }\n  }\n\n  it('should navigate from \"/posts/tech\" to \"/posts\" by setting category to undefined using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: (p: any) => ({ ...p, category: undefined }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate from \"/posts/tech\" to \"/posts\" by setting category to undefined in function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: (p: any) => ({ ...p, category: undefined }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate from \"/posts\" to \"/posts/tech\" by setting category using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: (p: any) => ({ ...p, category: 'tech' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tech')\n  })\n\n  it('should navigate from \"/posts/tech\" to \"/posts/news\" by changing category using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: (p: any) => ({ ...p, category: 'news' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/news')\n  })\n\n  it('should navigate without \"to\" path and set category to undefined using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, category: undefined }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should handle multiple optional parameters - remove one using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/articles/tech/hello-world'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/articles/tech/hello-world')\n\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: (p: any) => ({ ...p, slug: undefined }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles/tech')\n  })\n\n  it('should handle multiple optional parameters - clear all using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/articles/tech/hello-world'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/articles/tech/hello-world')\n\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: (p: any) => ({ ...p, category: undefined, slug: undefined }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles')\n  })\n\n  it('should handle mixed required and optional parameters using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/{-$version}/{-$framework}',\n      params: (p: any) => ({\n        ...p,\n        projectId: 'router',\n        version: undefined,\n        framework: 'vue',\n      }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/vue')\n  })\n})\n\ndescribe('router.navigate navigation using optional path parameters - parameter inheritance and isolation', () => {\n  function createInheritanceTestRouter(initialHistory?: RouterHistory) {\n    const history =\n      initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    // Route with same optional param names but different paths\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}',\n    })\n\n    const articlesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/articles/{-$category}',\n    })\n\n    // Route with nested optional params\n    const docsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/docs/{-$version}',\n    })\n\n    const docsTopicRoute = createRoute({\n      getParentRoute: () => docsRoute,\n      path: '/{-$topic}',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      articlesRoute,\n      docsRoute.addChildren([docsTopicRoute]),\n    ])\n    const router = createRouter({ routeTree, history })\n\n    return { router }\n  }\n\n  it('should carry over optional parameters between different routes with same param names', async () => {\n    const { router } = createInheritanceTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    // Navigate to articles without specifying category\n    await router.navigate({\n      to: '/articles/{-$category}',\n      params: {},\n    })\n    await router.invalidate()\n\n    // Should carry over 'tech' from current route params\n    expect(router.state.location.pathname).toBe('/articles/tech')\n  })\n\n  it('should properly handle navigation between routes with different optional param structures', async () => {\n    const { router } = createInheritanceTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    // Navigate to articles with explicit category\n    await router.navigate({\n      to: '/articles/{-$category}',\n      params: { category: 'news' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles/news')\n\n    // Navigate back to posts without explicit category removal\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: {},\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/news')\n  })\n\n  it('should handle nested optional parameters correctly', async () => {\n    const { router } = createInheritanceTestRouter(\n      createMemoryHistory({ initialEntries: ['/docs/v1/getting-started'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/docs/v1/getting-started')\n\n    // Remove topic but keep version\n    await router.navigate({\n      to: '/docs/{-$version}/{-$topic}',\n      params: { version: 'v1', topic: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/docs/v1')\n\n    // Remove version but add topic\n    await router.navigate({\n      to: '/docs/{-$version}/{-$topic}',\n      params: { version: undefined, topic: 'api' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/docs/api')\n\n    // Remove both\n    await router.navigate({\n      to: '/docs/{-$version}/{-$topic}',\n      params: { version: undefined, topic: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/docs')\n  })\n})\n\ndescribe('router.navigate navigation using optional path parameters - edge cases and validations', () => {\n  function createEdgeCaseTestRouter(initialHistory?: RouterHistory) {\n    const history =\n      initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    // Route with prefix/suffix\n    const filesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/files/prefix{-$name}.txt',\n    })\n\n    // Route with all optional params\n    const dateRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/date/{-$year}/{-$month}/{-$day}',\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, filesRoute, dateRoute])\n    const router = createRouter({ routeTree, history })\n\n    return { router }\n  }\n\n  it('should handle optional parameters with prefix/suffix correctly', async () => {\n    const { router } = createEdgeCaseTestRouter(\n      createMemoryHistory({ initialEntries: ['/files/prefixdocument.txt'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/files/prefixdocument.txt')\n\n    // Remove the name parameter\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files')\n\n    // Add the name parameter back\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: 'report' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files/prefixreport.txt')\n  })\n\n  it('should handle route with all optional parameters', async () => {\n    const { router } = createEdgeCaseTestRouter(\n      createMemoryHistory({ initialEntries: ['/date/2024/03/15'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/date/2024/03/15')\n\n    // Remove day only\n    await router.navigate({\n      to: '/date/{-$year}/{-$month}/{-$day}',\n      params: { year: '2024', month: '03', day: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/date/2024/03')\n\n    // Remove month and day\n    await router.navigate({\n      to: '/date/{-$year}/{-$month}/{-$day}',\n      params: { year: '2024', month: undefined, day: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/date/2024')\n\n    // Remove all parameters\n    await router.navigate({\n      to: '/date/{-$year}/{-$month}/{-$day}',\n      params: { year: undefined, month: undefined, day: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/date')\n\n    // Add all parameters back\n    await router.navigate({\n      to: '/date/{-$year}/{-$month}/{-$day}',\n      params: { year: '2025', month: '12', day: '31' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/date/2025/12/31')\n  })\n\n  it('should handle empty string vs undefined distinction', async () => {\n    const { router } = createEdgeCaseTestRouter(\n      createMemoryHistory({ initialEntries: ['/files/prefix.txt'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/files/prefix.txt')\n\n    // Set name to empty string (should still include the param)\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: '' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files/prefix.txt')\n\n    // Set name to a value\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: 'test' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files/prefixtest.txt')\n\n    // Set name to undefined (should remove the param)\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files')\n  })\n})\n\ndescribe('splat routes with empty splat', () => {\n  it.each(Object.values(trailingSlashOptions))(\n    'should handle empty _splat parameter with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash === 'always' ? '/' : ''\n\n      const history = createMemoryHistory({ initialEntries: ['/'] })\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n      })\n\n      const splatRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'splat/$',\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, splatRoute]),\n        history,\n        trailingSlash,\n      })\n\n      await router.load()\n\n      // All of these route params should navigate to the same location\n      const paramSets = [\n        {\n          _splat: '',\n        },\n        {\n          _splat: undefined,\n        },\n        {},\n      ]\n\n      for (const params of paramSets) {\n        await router.navigate({\n          to: '/splat/$',\n          params,\n        })\n        await router.invalidate()\n\n        expect(router.state.location.pathname).toBe(`/splat${tail}`)\n        // Navigate back to index\n        await router.navigate({ to: '/' })\n        await router.invalidate()\n      }\n    },\n  )\n})\n\ndescribe('encoded and unicode paths', () => {\n  const testCases = [\n    {\n      name: 'with prefix',\n      path: '/foo/prefix@대{$}',\n      expectedPath:\n        '/foo/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]',\n      expectedLocation: '/foo/prefix@대test[s%5C/.%5C/parameter%25!🚀%40]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with suffix',\n      path: '/foo/{$}대suffix@',\n      expectedPath:\n        '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]%EB%8C%80suffix@',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀%40]대suffix@',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with wildcard',\n      path: '/foo/$',\n      expectedPath: '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n    // '/' is left as is with splat params but encoded with normal params\n    {\n      name: 'with path param',\n      path: `/foo/$id`,\n      expectedPath: '/foo/test[s%5C%2F.%5C%2Fparameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C%2F.%5C%2Fparameter%25!🚀]',\n      params: {\n        id: 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n  ]\n\n  test.each(testCases)(\n    'should handle encoded, decoded paths with unicode characters correctly - $name',\n    async ({ path, expectedPath, expectedLocation, params }) => {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n      })\n\n      const pathRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, pathRoute]),\n        history: createMemoryHistory({ initialEntries: ['/'] }),\n      })\n\n      await router.load()\n      await router.navigate({ to: path, params })\n      await router.invalidate()\n\n      expect(router.state.location.href).toBe(expectedPath)\n      expect(router.state.location.pathname).toBe(expectedLocation)\n    },\n  )\n})\n"
  },
  {
    "path": "packages/react-router/tests/not-found.test.tsx",
    "content": "import { afterEach, beforeEach, expect, test } from 'vitest'\nimport { cleanup, render, screen } from '@testing-library/react'\n\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  notFound,\n  rootRouteId,\n} from '../src'\nimport type { NotFoundRouteProps, RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ntest.each([\n  {\n    notFoundMode: 'fuzzy' as const,\n    expectedNotFoundComponent: 'settings-not-found',\n  },\n  {\n    notFoundMode: 'root' as const,\n    expectedNotFoundComponent: 'root-not-found',\n  },\n])(\n  'correct notFoundComponent is rendered for mode=%s',\n  async ({ notFoundMode, expectedNotFoundComponent }) => {\n    const rootRoute = createRootRoute({\n      component: () => (\n        <div data-testid=\"root-component\">\n          <h1>Root Component</h1>\n          <div>\n            <Link data-testid=\"settings-link\" to=\"/settings/\">\n              link to settings\n            </Link>{' '}\n            <Link data-testid=\"non-existing-link\" to=\"/settings/does-not-exist\">\n              link to non-existing route\n            </Link>\n          </div>\n          <Outlet />\n        </div>\n      ),\n      notFoundComponent: () => (\n        <span data-testid=\"root-not-found\">Root Not Found Component</span>\n      ),\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div data-testid=\"index-component\">\n          <h2>Index Page</h2>\n        </div>\n      ),\n    })\n\n    const settingsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/settings',\n      notFoundComponent: () => (\n        <span data-testid=\"settings-not-found\">\n          Settings Not Found Component\n        </span>\n      ),\n      component: () => (\n        <div>\n          <p>Settings Page Layout</p>\n          <Outlet />\n        </div>\n      ),\n    })\n\n    const settingsIndexRoute = createRoute({\n      getParentRoute: () => settingsRoute,\n      path: '/',\n      component: () => (\n        <div data-testid=\"settings-index-component\">Settings Page</div>\n      ),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        settingsRoute.addChildren([settingsIndexRoute]),\n      ]),\n      history,\n      notFoundMode,\n    })\n\n    render(<RouterProvider router={router} />)\n    await router.load()\n    await screen.findByTestId('root-component')\n\n    const settingsLink = screen.getByTestId('settings-link')\n    settingsLink.click()\n\n    const settingsIndexComponent = await screen.findByTestId(\n      'settings-index-component',\n    )\n    expect(settingsIndexComponent).toBeInTheDocument()\n\n    const nonExistingLink = screen.getByTestId('non-existing-link')\n    nonExistingLink.click()\n\n    const notFoundComponent = await screen.findByTestId(\n      expectedNotFoundComponent,\n      {},\n      { timeout: 1000 },\n    )\n    expect(notFoundComponent).toBeInTheDocument()\n  },\n)\n\ntest('defaultNotFoundComponent and notFoundComponent receives data props via spread operator', async () => {\n  const isCustomData = (data: unknown): data is typeof customData => {\n    return 'message' in (data as typeof customData)\n  }\n\n  const customData = {\n    message: 'Custom not found message',\n  }\n\n  const DefaultNotFoundComponentWithProps = (props: NotFoundRouteProps) => (\n    <div data-testid=\"default-not-found-with-props\">\n      <span data-testid=\"message\">\n        {isCustomData(props.data) && <span>{props.data.message}</span>}\n      </span>\n    </div>\n  )\n\n  const rootRoute = createRootRoute({\n    component: () => (\n      <div data-testid=\"root-component\">\n        <h1>Root Component</h1>\n        <div>\n          <Link\n            data-testid=\"default-not-found-route-link\"\n            to=\"/default-not-found-route\"\n          >\n            link to default not found route\n          </Link>\n          <Link data-testid=\"not-found-route-link\" to=\"/not-found-route\">\n            link to not found route\n          </Link>\n        </div>\n        <Outlet />\n      </div>\n    ),\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => (\n      <div data-testid=\"index-component\">\n        <h2>Index Page</h2>\n      </div>\n    ),\n  })\n\n  const defaultNotFoundRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/default-not-found-route',\n    loader: () => {\n      throw notFound({ data: customData })\n    },\n    component: () => (\n      <div data-testid=\"default-not-found-route-component\">\n        Should not render\n      </div>\n    ),\n  })\n\n  const notFoundRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/not-found-route',\n    loader: () => {\n      throw notFound({ data: customData })\n    },\n    component: () => (\n      <div data-testid=\"not-found-route-component\">Should not render</div>\n    ),\n    notFoundComponent: (props) => (\n      <div data-testid=\"not-found-with-props\">\n        <span data-testid=\"message\">\n          {isCustomData(props.data) && <span>{props.data.message}</span>}\n        </span>\n      </div>\n    ),\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      defaultNotFoundRoute,\n      notFoundRoute,\n    ]),\n    history,\n    defaultNotFoundComponent: DefaultNotFoundComponentWithProps,\n  })\n\n  render(<RouterProvider router={router} />)\n  await router.load()\n  await screen.findByTestId('root-component')\n\n  const defaultNotFoundRouteLink = screen.getByTestId(\n    'default-not-found-route-link',\n  )\n  defaultNotFoundRouteLink.click()\n\n  const defaultNotFoundComponent = await screen.findByTestId(\n    'default-not-found-with-props',\n    {},\n    { timeout: 1000 },\n  )\n  expect(defaultNotFoundComponent).toBeInTheDocument()\n\n  const defaultNotFoundComponentMessage = await screen.findByTestId('message')\n  expect(defaultNotFoundComponentMessage).toHaveTextContent(customData.message)\n\n  const notFoundRouteLink = screen.getByTestId('not-found-route-link')\n  notFoundRouteLink.click()\n\n  const notFoundComponent = await screen.findByTestId(\n    'not-found-with-props',\n    {},\n    { timeout: 1000 },\n  )\n  expect(notFoundComponent).toBeInTheDocument()\n\n  const errorMessageComponent = await screen.findByTestId('message')\n  expect(errorMessageComponent).toHaveTextContent(customData.message)\n})\n\ntest('beforeLoad notFound with routeId targets root notFoundComponent', async () => {\n  const rootRoute = createRootRoute({\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"root-not-found\">Root not found</span>\n    ),\n  })\n\n  const parentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/parent',\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"parent-not-found\">Parent not found</span>\n    ),\n  })\n\n  const childRoute = createRoute({\n    getParentRoute: () => parentRoute,\n    path: '/child',\n    beforeLoad: () => {\n      throw notFound({ routeId: rootRouteId })\n    },\n    component: () => <span data-testid=\"child-component\">Child</span>,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([parentRoute.addChildren([childRoute])]),\n    history,\n    notFoundMode: 'fuzzy',\n  })\n\n  render(<RouterProvider router={router} />)\n  await router.navigate({ to: '/parent/child' })\n\n  expect(await screen.findByTestId('root-not-found')).toBeInTheDocument()\n  expect(screen.queryByTestId('child-component')).not.toBeInTheDocument()\n})\n\ntest('beforeLoad notFound with routeId targets parent boundary and preserves parent loader data', async () => {\n  const rootRoute = createRootRoute({\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"root-not-found\">Root not found</span>\n    ),\n  })\n\n  const parentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/parent',\n    loader: () => ({ message: 'ready' }),\n    component: () => <Outlet />,\n    notFoundComponent: () => {\n      const loaderData = parentRoute.useLoaderData()\n      return (\n        <span data-testid=\"parent-not-found-with-loader-data\">\n          {loaderData.message}\n        </span>\n      )\n    },\n  })\n\n  const childRoute = createRoute({\n    getParentRoute: () => parentRoute,\n    path: '/child',\n    beforeLoad: () => {\n      throw notFound({ routeId: parentRoute.id })\n    },\n    component: () => <span data-testid=\"child-component\">Child</span>,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([parentRoute.addChildren([childRoute])]),\n    history,\n    notFoundMode: 'fuzzy',\n  })\n\n  render(<RouterProvider router={router} />)\n  await router.navigate({ to: '/parent/child' })\n\n  expect(\n    await screen.findByTestId('parent-not-found-with-loader-data'),\n  ).toHaveTextContent('ready')\n  expect(screen.queryByTestId('child-component')).not.toBeInTheDocument()\n})\n\ntest('beforeLoad notFound with non-exact routeId falls back to root notFoundComponent', async () => {\n  const rootRoute = createRootRoute({\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"root-not-found\">Root not found</span>\n    ),\n  })\n\n  const parentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/parent',\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"parent-not-found\">Parent not found</span>\n    ),\n  })\n\n  const childRoute = createRoute({\n    getParentRoute: () => parentRoute,\n    path: '/child',\n    beforeLoad: () => {\n      throw notFound({ routeId: `${parentRoute.id}/` as never })\n    },\n    component: () => <span data-testid=\"child-component\">Child</span>,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([parentRoute.addChildren([childRoute])]),\n    history,\n    notFoundMode: 'fuzzy',\n  })\n\n  render(<RouterProvider router={router} />)\n  await router.navigate({ to: '/parent/child' })\n\n  expect(await screen.findByTestId('root-not-found')).toBeInTheDocument()\n  expect(screen.queryByTestId('parent-not-found')).not.toBeInTheDocument()\n  expect(screen.queryByTestId('child-component')).not.toBeInTheDocument()\n})\n"
  },
  {
    "path": "packages/react-router/tests/optional-path-params.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter } from '../src'\nimport type { ResolveOptionalParams } from '../src'\n\ntest('when creating a route with optional parameters', () => {\n  const rootRoute = createRootRoute()\n  const usersRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/users/{-$tab}',\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([usersRoute]),\n  })\n\n  expectTypeOf(usersRoute.useParams<typeof router>()).toEqualTypeOf<{\n    tab?: string\n  }>()\n})\n\ntest('when creating a route with mixed optional and required parameters', () => {\n  const rootRoute = createRootRoute()\n  const usersRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/users/$id/{-$tab}',\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([usersRoute]),\n  })\n\n  expectTypeOf(usersRoute.useParams<typeof router>()).toEqualTypeOf<{\n    id: string\n    tab?: string\n  }>()\n})\n\ntest('when creating a route with optional param with prefix and suffix', () => {\n  const rootRoute = createRootRoute()\n  const filesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/files/prefix{-$name}.txt',\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([filesRoute]),\n  })\n\n  expectTypeOf(filesRoute.useParams<typeof router>()).toEqualTypeOf<{\n    name?: string\n  }>()\n})\n\ntest('when creating Link with optional parameters', () => {\n  const rootRoute = createRootRoute()\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts/{-$category}/{-$slug}',\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([postsRoute]),\n  })\n\n  expectTypeOf(postsRoute.useParams<typeof router>()).toEqualTypeOf<{\n    category?: string\n    slug?: string\n  }>()\n})\n\ntest('when using optional parameters in loaders', () => {\n  const rootRoute = createRootRoute()\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts/{-$category}',\n    loader: ({ params }) => {\n      expectTypeOf(params).toEqualTypeOf<{ category?: string }>()\n      return params\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([postsRoute]),\n  })\n\n  expectTypeOf(postsRoute.useLoaderData<typeof router>()).toEqualTypeOf<{\n    category?: string\n  }>()\n})\n\ntest('when using optional parameters in beforeLoad', () => {\n  const rootRoute = createRootRoute()\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts/{-$category}',\n    beforeLoad: ({ params }) => {\n      expectTypeOf(params).toEqualTypeOf<{ category?: string }>()\n      return { user: 'test' }\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([postsRoute]),\n  })\n\n  expectTypeOf(postsRoute.useParams<typeof router>()).toEqualTypeOf<{\n    category?: string\n  }>()\n})\n\ntest('when using params.parse with optional parameters', () => {\n  const rootRoute = createRootRoute()\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts/{-$page}',\n    params: {\n      parse: (params) => {\n        // Basic functionality working, complex type inference still has issues\n        return {\n          page: params.page ? parseInt(params.page) : undefined,\n        }\n      },\n      stringify: (params) => {\n        return {\n          page: params.page?.toString(),\n        }\n      },\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([postsRoute]),\n  })\n\n  // Note: Type inference for params.parse is still complex - this represents current working behavior\n  expectTypeOf(postsRoute.useParams<typeof router>()).toMatchTypeOf<{\n    page?: number | undefined\n  }>()\n})\n\ntest('when nesting routes with optional parameters', () => {\n  const rootRoute = createRootRoute()\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts/{-$category}',\n  })\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '/$postId',\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([postsRoute.addChildren([postRoute])]),\n  })\n\n  expectTypeOf(postRoute.useParams<typeof router>()).toEqualTypeOf<{\n    category?: string\n    postId: string\n  }>()\n})\n\ntest('when combining optional parameters with wildcards', () => {\n  const rootRoute = createRootRoute()\n  const docsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/docs/{-$version}/$',\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([docsRoute]),\n  })\n\n  expectTypeOf(docsRoute.useParams<typeof router>()).toEqualTypeOf<{\n    version?: string\n    _splat?: string\n  }>()\n})\n\ntest('when using ResolveOptionalParams utility type', () => {\n  type OptionalParams = ResolveOptionalParams<\n    '/posts/{-$category}/{-$slug}',\n    string\n  >\n\n  expectTypeOf<OptionalParams>().toEqualTypeOf<{\n    category?: string\n    slug?: string\n  }>()\n})\n\ntest('complex scenario with optional parameters only', () => {\n  const rootRoute = createRootRoute()\n  const complexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/app/{-$env}/api/{-$version}/users/$id/{-$tab}/$',\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([complexRoute]),\n  })\n\n  expectTypeOf(complexRoute.useParams<typeof router>()).toEqualTypeOf<{\n    env?: string\n    version?: string\n    id: string\n    tab?: string\n    _splat?: string\n  }>()\n})\n\ntest('edge case - all optional parameters', () => {\n  const rootRoute = createRootRoute()\n  const allOptionalRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/{-$category}/{-$subcategory}/{-$item}',\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([allOptionalRoute]),\n  })\n\n  expectTypeOf(allOptionalRoute.useParams<typeof router>()).toEqualTypeOf<{\n    category?: string\n    subcategory?: string\n    item?: string\n  }>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/optional-path-params.test.tsx",
    "content": "import { afterEach, describe, expect, it, vi } from 'vitest'\nimport {\n  act,\n  cleanup,\n  fireEvent,\n  render,\n  screen,\n  waitFor,\n} from '@testing-library/react'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useNavigate,\n} from '../src'\n\ndescribe('React Router - Optional Path Parameters', () => {\n  afterEach(() => {\n    cleanup()\n    vi.clearAllMocks()\n    window.history.replaceState(null, 'root', '/')\n  })\n\n  describe('Route matching with optional parameters', () => {\n    it('should match route with no optional parameters', async () => {\n      const rootRoute = createRootRoute()\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}/{-$slug}',\n        component: () => {\n          const params = postsRoute.useParams()\n          return (\n            <div>\n              <h1>Posts</h1>\n              <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            </div>\n          )\n        },\n      })\n      window.history.replaceState({}, '', '/posts')\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      const paramsElement = await screen.findByTestId('params')\n      expect(JSON.parse(paramsElement.textContent)).toEqual({})\n    })\n\n    it('should match route with one optional parameter', async () => {\n      const rootRoute = createRootRoute()\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}/{-$slug}',\n        component: () => {\n          const params = postsRoute.useParams()\n          return (\n            <div>\n              <h1>Posts</h1>\n              <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            </div>\n          )\n        },\n      })\n      window.history.replaceState({}, '', '/posts/tech')\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      const paramsElement = await screen.findByTestId('params')\n      expect(JSON.parse(paramsElement.textContent)).toEqual({\n        category: 'tech',\n      })\n    })\n\n    it('should match route with all optional parameters', async () => {\n      const rootRoute = createRootRoute()\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}/{-$slug}',\n        component: () => {\n          const params = postsRoute.useParams()\n          return (\n            <div>\n              <h1>Posts</h1>\n              <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            </div>\n          )\n        },\n      })\n      window.history.replaceState({}, '', '/posts/tech/hello-world')\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      const paramsElement = await screen.findByTestId('params')\n      expect(JSON.parse(paramsElement.textContent)).toEqual({\n        category: 'tech',\n        slug: 'hello-world',\n      })\n    })\n\n    it.each([\n      { path: '/users/123', expectedParams: { id: '123' } },\n      {\n        path: '/users/123/settings',\n        expectedParams: { id: '123', tab: 'settings' },\n      },\n    ])(\n      'should handle mixed required and optional parameters: $path',\n      async ({ path, expectedParams }) => {\n        const rootRoute = createRootRoute()\n        const usersRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/users/$id/{-$tab}',\n          component: () => {\n            const params = usersRoute.useParams()\n            return (\n              <div>\n                <h1>User Profile</h1>\n                <div data-testid=\"params\">{JSON.stringify(params)}</div>\n              </div>\n            )\n          },\n        })\n        window.history.replaceState({}, '', path)\n\n        const router = createRouter({\n          routeTree: rootRoute.addChildren([usersRoute]),\n        })\n\n        render(<RouterProvider router={router} />)\n        await act(() => router.load())\n\n        const paramsElement = await screen.findByTestId('params')\n        expect(JSON.parse(paramsElement.textContent)).toEqual(expectedParams)\n      },\n    )\n\n    it.each([\n      {\n        path: '/',\n        expectedLocale: 'en' as const,\n      },\n      {\n        path: '/en',\n        expectedLocale: 'en' as const,\n      },\n      {\n        path: '/fr',\n        expectedLocale: 'fr' as const,\n      },\n    ])(\n      'should correctly render matches with and without optional parameter',\n      async ({ path, expectedLocale }) => {\n        const content = {\n          en: {\n            title: 'About Us',\n            description: 'Learn more about our company.',\n          },\n          fr: {\n            title: 'À Propos',\n            description: 'En savoir plus sur notre entreprise.',\n          },\n          es: {\n            title: 'Acerca de',\n            description: 'Conoce más sobre nuestra empresa.',\n          },\n        } as const\n\n        const rootRoute = createRootRoute()\n        const localeRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/{-$locale}',\n          beforeLoad: ({ params }) => {\n            const currentLocale = (params.locale ||\n              'en') as keyof typeof content\n\n            return {\n              content: content[currentLocale],\n            }\n          },\n        })\n\n        const indexRoute = createRoute({\n          getParentRoute: () => localeRoute,\n          path: '/',\n          component: () => {\n            const { content } = indexRoute.useRouteContext()\n            return (\n              <div data-testid=\"index-content\">\n                <h1 data-testid=\"index-title\">{content.title}</h1>\n                <p data-testid=\"index-description\">{content.description}</p>\n              </div>\n            )\n          },\n        })\n\n        window.history.replaceState({}, '', path)\n\n        const router = createRouter({\n          routeTree: rootRoute.addChildren([\n            localeRoute.addChildren([indexRoute]),\n          ]),\n        })\n\n        render(<RouterProvider router={router} />)\n        await act(() => router.load())\n\n        await screen.findByTestId('index-content')\n        const titleElement = screen.getByTestId('index-title')\n        const descriptionElement = screen.getByTestId('index-description')\n        expect(titleElement).toHaveTextContent(content[expectedLocale].title)\n        expect(descriptionElement).toHaveTextContent(\n          content[expectedLocale].description,\n        )\n      },\n    )\n  })\n\n  describe('required and optional parameters on the same level', () => {\n    async function setupTestRouter() {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <div data-testid=\"index-route-component\">\n              <h1>index</h1>\n              <Link\n                data-testid=\"reports-optional-param-link\"\n                params={{ adminLevelId: 'asdf' }}\n                to=\"/admin-levels/{-$adminLevelId}/reports\"\n              >\n                navigate to reports with optional param\n              </Link>\n            </div>\n          )\n        },\n      })\n\n      const adminLevelsRoutes = createRoute({\n        getParentRoute: () => rootRoute,\n\n        path: 'admin-levels',\n        component: () => (\n          <div data-testid=\"admin-levels-route-component\">\n            <h1>admin-levels</h1>\n            <Outlet />\n          </div>\n        ),\n      })\n\n      const requiredParamRoute = createRoute({\n        getParentRoute: () => adminLevelsRoutes,\n        path: '$adminLevelId',\n        component: () => (\n          <div data-testid=\"admin-levels-route-required-param-route-component\">\n            <h1>Required Param Route</h1>\n            <Outlet />\n          </div>\n        ),\n      })\n\n      const requiredParamIndexRoute = createRoute({\n        getParentRoute: () => requiredParamRoute,\n        path: '/',\n        component: () => (\n          <div data-testid=\"admin-levels-route-required-param-index-route-component\">\n            <h1>Required Param Route Index</h1>\n          </div>\n        ),\n      })\n\n      const optionalParamRoute = createRoute({\n        getParentRoute: () => adminLevelsRoutes,\n        path: '{-$adminLevelId}',\n        component: () => (\n          <div data-testid=\"admin-levels-route-optional-param-route-component\">\n            <h1>Optional Param Route</h1>\n            <Outlet />\n          </div>\n        ),\n      })\n\n      const reportsRoute = createRoute({\n        getParentRoute: () => optionalParamRoute,\n        path: 'reports',\n        component: () => (\n          <div data-testid=\"reports-route-component\">\n            <h1>Reports</h1>\n            <Link\n              data-testid=\"navigate-to-required-param-link\"\n              to=\"/admin-levels/$adminLevelId\"\n              params={{ adminLevelId: 'asdf' }}\n            >\n              navigate to required param route\n            </Link>\n            <Outlet />\n          </div>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          adminLevelsRoutes.addChildren([\n            requiredParamRoute.addChildren([requiredParamIndexRoute]),\n            optionalParamRoute.addChildren([reportsRoute]),\n          ]),\n        ]),\n      })\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n      return router\n    }\n\n    it('direct visit', async () => {\n      window.history.replaceState({}, '', 'admin-levels/asdf')\n      await setupTestRouter()\n\n      expect(\n        await screen.findByTestId(\n          'admin-levels-route-required-param-route-component',\n        ),\n      ).toBeInTheDocument()\n      expect(\n        await screen.findByTestId(\n          'admin-levels-route-required-param-index-route-component',\n        ),\n      ).toBeInTheDocument()\n    })\n\n    it('client-side navigation', async () => {\n      window.history.replaceState({}, '', '/')\n\n      await setupTestRouter()\n\n      expect(\n        await screen.findByTestId('index-route-component'),\n      ).toBeInTheDocument()\n      const reportsLink = await screen.findByTestId(\n        'reports-optional-param-link',\n      )\n      fireEvent.click(reportsLink)\n\n      expect(\n        await screen.findByTestId('reports-route-component'),\n      ).toBeInTheDocument()\n      const requiredParamLink = await screen.findByTestId(\n        'navigate-to-required-param-link',\n      )\n      fireEvent.click(requiredParamLink)\n\n      expect(\n        await screen.findByTestId(\n          'admin-levels-route-required-param-route-component',\n        ),\n      ).toBeInTheDocument()\n\n      expect(\n        await screen.findByTestId(\n          'admin-levels-route-required-param-index-route-component',\n        ),\n      ).toBeInTheDocument()\n    })\n  })\n\n  describe('Link component with optional parameters', () => {\n    it('should generate correct href for optional parameters', async () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <Link to=\"/posts/{-$category}/{-$slug}\" data-testid=\"posts-link\">\n              All Posts\n            </Link>\n            <Link\n              to=\"/posts/{-$category}/{-$slug}\"\n              params={{ category: 'tech' }}\n              data-testid=\"tech-link\"\n            >\n              Tech Posts\n            </Link>\n            <Link\n              to=\"/posts/{-$category}/{-$slug}\"\n              params={{ category: 'tech', slug: 'hello-world' }}\n              data-testid=\"specific-link\"\n            >\n              Specific Post\n            </Link>\n            <Link\n              to=\"/posts/{-$category}/{-$slug}\"\n              params={{}}\n              data-testid=\"empty-params-link\"\n            >\n              Empty Params\n            </Link>\n          </>\n        ),\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}/{-$slug}',\n        component: () => <div>Posts</div>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const postsLink = await screen.findByTestId('posts-link')\n      const techLink = await screen.findByTestId('tech-link')\n      const specificLink = await screen.findByTestId('specific-link')\n      const emptyParamsLink = await screen.findByTestId('empty-params-link')\n\n      expect(postsLink).toHaveAttribute('href', '/posts')\n      expect(techLink).toHaveAttribute('href', '/posts/tech')\n      expect(specificLink).toHaveAttribute('href', '/posts/tech/hello-world')\n      expect(emptyParamsLink).toHaveAttribute('href', '/posts')\n    })\n\n    it('should navigate correctly with optional parameters', async () => {\n      const rootRoute = createRootRoute({\n        component: () => {\n          return (\n            <div>\n              <h1>Root Layout</h1>\n              <Link to=\"/\" data-testid=\"home-link\">\n                Home\n              </Link>\n              <Outlet />\n            </div>\n          )\n        },\n      })\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <h1 data-testid=\"home-heading\">Home</h1>\n            <Link to=\"/posts/{-$category}/{-$slug}\" data-testid=\"posts-link\">\n              All Posts\n            </Link>\n            <Link\n              to=\"/posts/{-$category}/{-$slug}\"\n              params={{ category: 'tech' }}\n              data-testid=\"tech-link\"\n            >\n              Tech Posts\n            </Link>\n          </>\n        ),\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}/{-$slug}',\n        component: () => {\n          const params = postsRoute.useParams()\n          return (\n            <div>\n              <h1>Posts</h1>\n              <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            </div>\n          )\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      {\n        await expect(\n          screen.findByTestId('home-heading'),\n        ).resolves.toBeInTheDocument()\n        // Test navigation to /posts\n        const postsLink = await screen.findByTestId('posts-link')\n        fireEvent.click(postsLink)\n\n        await expect(screen.findByText('Posts')).resolves.toBeInTheDocument()\n        const paramsElement = await screen.findByTestId('params')\n        expect(JSON.parse(paramsElement.textContent)).toEqual({})\n        expect(router.state.location.pathname).toBe('/posts')\n      }\n\n      {\n        // Navigate back\n        const homeLink = await screen.findByTestId('home-link')\n        fireEvent.click(homeLink)\n        await expect(\n          screen.findByTestId('home-heading'),\n        ).resolves.toBeInTheDocument()\n      }\n\n      // test with parameters\n      {\n        const techLink = await screen.findByTestId('tech-link')\n        fireEvent.click(techLink)\n\n        await expect(screen.findByText('Posts')).resolves.toBeInTheDocument()\n        const updatedParamsElement = await screen.findByTestId('params')\n        expect(JSON.parse(updatedParamsElement.textContent)).toEqual({\n          category: 'tech',\n        })\n        expect(router.state.location.pathname).toBe('/posts/tech')\n      }\n    })\n\n    it('should handle optional parameters with prefix and suffix', async () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <Link to=\"/files/prefix{-$name}.txt\" data-testid=\"files-link\">\n              All Files\n            </Link>\n            <Link\n              to=\"/files/prefix{-$name}.txt\"\n              params={{ name: 'document' }}\n              data-testid=\"doc-link\"\n            >\n              Document\n            </Link>\n          </>\n        ),\n      })\n\n      const filesRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/files/prefix{-$name}.txt',\n        component: () => {\n          const params = filesRoute.useParams()\n          return (\n            <div>\n              <h1>Files</h1>\n              <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            </div>\n          )\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, filesRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const filesLink = await screen.findByTestId('files-link')\n      const docLink = await screen.findByTestId('doc-link')\n\n      expect(filesLink).toHaveAttribute('href', '/files')\n      expect(docLink).toHaveAttribute('href', '/files/prefixdocument.txt')\n    })\n  })\n\n  describe('useNavigate with optional parameters', () => {\n    it('should navigate with optional parameters programmatically', async () => {\n      const rootRoute = createRootRoute()\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}/{-$slug}',\n        component: Component,\n      })\n\n      function Component() {\n        const navigate = useNavigate()\n        const params = postsRoute.useParams()\n\n        return (\n          <div>\n            <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            <button\n              data-testid=\"navigate-all\"\n              onClick={() =>\n                navigate({\n                  to: '/posts/{-$category}/{-$slug}',\n                  params: false,\n                })\n              }\n            >\n              All Posts\n            </button>\n            <button\n              data-testid=\"navigate-tech\"\n              onClick={() =>\n                navigate({\n                  to: '/posts/{-$category}/{-$slug}',\n                  params: { category: 'tech', slug: undefined },\n                })\n              }\n            >\n              Tech Posts\n            </button>\n            <button\n              data-testid=\"navigate-specific\"\n              onClick={() =>\n                navigate({\n                  to: '/posts/{-$category}/{-$slug}',\n                  params: { category: 'tech', slug: 'hello-world' },\n                })\n              }\n            >\n              Specific Post\n            </button>\n          </div>\n        )\n      }\n      // Start at a specific post\n      window.history.replaceState({}, '', '/posts/tech/hello-world')\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n\n      // Test navigation scenarios\n      const navigateAll = await screen.findByTestId('navigate-all')\n      await fireEvent.click(navigateAll)\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe('/posts')\n      })\n\n      const navigateTech = await screen.findByTestId('navigate-tech')\n      await fireEvent.click(navigateTech)\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe('/posts/tech')\n      })\n\n      const navigateSpecific = await screen.findByTestId('navigate-specific')\n      await fireEvent.click(navigateSpecific)\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe('/posts/tech/hello-world')\n      })\n    })\n\n    it('should handle relative navigation with optional parameters', async () => {\n      const rootRoute = createRootRoute()\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}',\n        component: Component,\n      })\n\n      function Component() {\n        const navigate = useNavigate()\n        const params = postsRoute.useParams()\n\n        return (\n          <div>\n            <h1>Posts</h1>\n            <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            <button\n              data-testid=\"add-category\"\n              onClick={() =>\n                navigate({ to: '.', params: { category: 'tech' } })\n              }\n            >\n              Add Category\n            </button>\n            <button\n              data-testid=\"remove-category\"\n              onClick={() => navigate({ to: '.', params: false })}\n            >\n              Remove Category\n            </button>\n          </div>\n        )\n      }\n      window.history.replaceState({}, '', '/posts')\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      expect(await screen.findByTestId('params')).toHaveTextContent(\n        JSON.stringify({}),\n      )\n\n      const addCategoryBtn = await screen.findByTestId('add-category')\n      const removeCategoryBtn = await screen.findByTestId('remove-category')\n\n      // Add category\n      fireEvent.click(addCategoryBtn)\n      expect(await screen.findByTestId('params')).toHaveTextContent(\n        JSON.stringify({ category: 'tech' }),\n      )\n      expect(router.state.location.pathname).toBe('/posts/tech')\n\n      // Remove category\n      fireEvent.click(removeCategoryBtn)\n      expect(await screen.findByTestId('params')).toHaveTextContent(\n        JSON.stringify({}),\n      )\n      expect(router.state.location.pathname).toBe('/posts')\n    })\n  })\n\n  describe('complex routing scenarios', () => {\n    it.each([\n      {\n        path: '/posts',\n        expected: {\n          posts: {\n            rendered: true,\n            category: 'undefined',\n          },\n          post: {\n            rendered: false,\n          },\n        },\n      },\n      {\n        path: '/posts/tech',\n        expected: {\n          posts: {\n            rendered: true,\n            category: 'tech',\n          },\n          post: {\n            rendered: false,\n          },\n        },\n      },\n      {\n        path: '/posts/tech/hello-world',\n        expected: {\n          posts: {\n            rendered: true,\n            category: 'tech',\n          },\n          post: {\n            rendered: true,\n            slug: 'hello-world',\n          },\n        },\n      },\n    ])(\n      'should handle nested routes with optional parameters: $path',\n      async ({ path, expected }) => {\n        const rootRoute = createRootRoute()\n        const postsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/posts/{-$category}',\n          component: () => {\n            const { category } = postsRoute.useParams()\n            return (\n              <div>\n                <h1>Posts Layout</h1>\n                <div data-testid=\"category-param\">\n                  {category ?? 'undefined'}\n                </div>\n                <Outlet />\n              </div>\n            )\n          },\n        })\n\n        const postRoute = createRoute({\n          getParentRoute: () => postsRoute,\n          path: '/{-$slug}',\n          component: () => {\n            const { slug } = postRoute.useParams()\n            return (\n              <div>\n                <h2>Post Detail</h2>\n                <div data-testid=\"slug-param\">{slug ?? undefined}</div>\n              </div>\n            )\n          },\n        })\n\n        window.history.replaceState({}, '', path)\n\n        const router = createRouter({\n          routeTree: rootRoute.addChildren([\n            postsRoute.addChildren([postRoute]),\n          ]),\n        })\n\n        render(<RouterProvider router={router} />)\n        await act(() => router.load())\n        if (expected.posts.rendered) {\n          const categoryParam = await screen.findByTestId('category-param')\n          expect(categoryParam).toHaveTextContent(expected.posts.category)\n        }\n        if (expected.post.rendered) {\n          const slugParam = await screen.findByTestId('slug-param')\n          expect(slugParam).toHaveTextContent(expected.post.slug!)\n        }\n      },\n    )\n\n    it('should work with search parameters', async () => {\n      const rootRoute = createRootRoute()\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}',\n        validateSearch: (search) => ({\n          page: Number(search.page) || 1,\n          sort: (search.sort as string) || 'date',\n        }),\n        component: Component,\n      })\n\n      function Component() {\n        const params = postsRoute.useParams()\n        const search = postsRoute.useSearch()\n        return (\n          <div>\n            <h1>Posts</h1>\n            <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            <div data-testid=\"search\">{JSON.stringify(search)}</div>\n          </div>\n        )\n      }\n\n      window.history.replaceState({}, '', '/posts/tech?page=2&sort=title')\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      const paramsElement = await screen.findByTestId('params')\n      const searchElement = await screen.findByTestId('search')\n\n      expect(JSON.parse(paramsElement.textContent)).toEqual({\n        category: 'tech',\n      })\n      expect(JSON.parse(searchElement.textContent)).toEqual({\n        page: 2,\n        sort: 'title',\n      })\n    })\n\n    it.each([\n      { path: '/', expectedParams: {} },\n      { path: '/2023', expectedParams: { year: '2023' } },\n      { path: '/2023/12', expectedParams: { year: '2023', month: '12' } },\n      {\n        path: '/2023/12/25',\n        expectedParams: { year: '2023', month: '12', day: '25' },\n      },\n    ])(\n      'should handle multiple consecutive optional parameters: $path',\n      async ({ path, expectedParams }) => {\n        const rootRoute = createRootRoute()\n        const dateRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/{-$year}/{-$month}/{-$day}',\n          component: () => {\n            const params = dateRoute.useParams()\n            return (\n              <div>\n                <h1>Date Route</h1>\n                <div data-testid=\"params\">{JSON.stringify(params)}</div>\n              </div>\n            )\n          },\n        })\n\n        window.history.replaceState({}, '', path)\n\n        const router = createRouter({\n          routeTree: rootRoute.addChildren([dateRoute]),\n        })\n\n        render(<RouterProvider router={router} />)\n        await act(() => router.load())\n\n        const paramsElement = await screen.findByTestId('params')\n        expect(JSON.parse(paramsElement.textContent)).toEqual(expectedParams)\n      },\n    )\n\n    it.each([\n      {\n        path: '/chambres',\n        expected: {\n          rooms: 'chambres',\n          locale: 'undefined',\n        },\n      },\n      {\n        path: '/fr/chambres',\n        expected: {\n          rooms: 'chambres',\n          locale: 'fr',\n        },\n      },\n      {\n        path: '/rooms',\n        expected: {\n          rooms: 'rooms',\n          locale: 'undefined',\n        },\n      },\n      {\n        path: '/en/rooms',\n        expected: {\n          rooms: 'rooms',\n          locale: 'en',\n        },\n      },\n    ])(\n      'should handle routes with required param after optional param: $path',\n      async ({ path, expected }) => {\n        const rootRoute = createRootRoute()\n        const roomsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/{-$locale}/$rooms',\n          component: () => {\n            const { locale, rooms } = roomsRoute.useParams()\n            return (\n              <div>\n                <h1>Rooms</h1>\n                <div data-testid=\"locale-param\">{locale ?? 'undefined'}</div>\n                <div data-testid=\"rooms-param\">{rooms ?? 'undefined'}</div>\n                <Outlet />\n              </div>\n            )\n          },\n        })\n\n        window.history.replaceState({}, '', path)\n\n        const router = createRouter({\n          routeTree: rootRoute.addChildren([roomsRoute]),\n        })\n\n        render(<RouterProvider router={router} />)\n        await act(() => router.load())\n        const roomsParam = await screen.findByTestId('rooms-param')\n        expect(roomsParam).toHaveTextContent(expected.rooms)\n        const localeParam = await screen.findByTestId('locale-param')\n        expect(localeParam).toHaveTextContent(expected.locale)\n      },\n    )\n  })\n\n  describe('edge cases and error handling', () => {\n    it('should handle optional parameters with loaders', async () => {\n      const mockLoader = vi.fn((opts) => {\n        return Promise.resolve({\n          category: opts.params.category || 'all',\n          data: `Data for ${opts.params.category || 'all'}`,\n        })\n      })\n\n      const rootRoute = createRootRoute()\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}',\n        loader: mockLoader,\n        component: () => {\n          const data = postsRoute.useLoaderData()\n          const params = postsRoute.useParams()\n          return (\n            <div>\n              <h1>Posts</h1>\n              <div data-testid=\"params\">{JSON.stringify(params)}</div>\n              <div data-testid=\"loader-data\">{JSON.stringify(data)}</div>\n            </div>\n          )\n        },\n      })\n      window.history.replaceState({}, '', '/posts')\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n      })\n\n      // Test without category\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      await expect(screen.findByText('Posts')).resolves.toBeInTheDocument()\n      const paramsElement = await screen.findByTestId('params')\n      const loaderDataElement = await screen.findByTestId('loader-data')\n\n      expect(JSON.parse(paramsElement.textContent)).toEqual({})\n      expect(JSON.parse(loaderDataElement.textContent)).toEqual({\n        category: 'all',\n        data: 'Data for all',\n      })\n\n      expect(mockLoader).toHaveBeenCalledWith(\n        expect.objectContaining({\n          params: {},\n        }),\n      )\n    })\n\n    it('should handle beforeLoad with optional parameters', async () => {\n      const mockBeforeLoad = vi.fn((opts) => {\n        return {\n          category: opts.params.category || 'default',\n          timestamp: Date.now(),\n        }\n      })\n\n      const rootRoute = createRootRoute()\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/{-$category}',\n        beforeLoad: mockBeforeLoad,\n        component: () => {\n          const params = postsRoute.useParams()\n          return (\n            <div>\n              <h1>Posts</h1>\n              <div data-testid=\"params\">{JSON.stringify(params)}</div>\n            </div>\n          )\n        },\n      })\n      window.history.replaceState({}, '', '/posts/tech')\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n      })\n\n      render(<RouterProvider router={router} />)\n\n      await expect(screen.findByText('Posts')).resolves.toBeInTheDocument()\n\n      expect(mockBeforeLoad).toHaveBeenCalledWith(\n        expect.objectContaining({\n          params: { category: 'tech' },\n        }),\n      )\n    })\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/redirect.test.tsx",
    "content": "import {\n  cleanup,\n  configure,\n  fireEvent,\n  render,\n  screen,\n} from '@testing-library/react'\n\nimport { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\n\nimport invariant from 'tiny-invariant'\nimport {\n  Link,\n  RouterProvider,\n  createBrowserHistory,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n  useRouter,\n} from '../src'\n\nimport { sleep } from './utils'\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\nconst WAIT_TIME = 100\n\ndescribe('redirect', () => {\n  describe('SPA', () => {\n    configure({ reactStrictMode: true })\n    test('when `redirect` is thrown in `beforeLoad`', async () => {\n      const nestedLoaderMock = vi.fn()\n      const nestedFooLoaderMock = vi.fn()\n\n      const rootRoute = createRootRoute({})\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <div>\n              <h1>Index page</h1>\n              <Link to=\"/about\">link to about</Link>\n            </div>\n          )\n        },\n      })\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        beforeLoad: async () => {\n          await sleep(WAIT_TIME)\n          throw redirect({ to: '/nested/foo' })\n        },\n      })\n      const nestedRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/nested',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          nestedLoaderMock('nested')\n        },\n      })\n      const fooRoute = createRoute({\n        getParentRoute: () => nestedRoute,\n        path: '/foo',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          nestedFooLoaderMock('foo')\n        },\n        component: () => <div>Nested Foo page</div>,\n      })\n      const routeTree = rootRoute.addChildren([\n        nestedRoute.addChildren([fooRoute]),\n        aboutRoute,\n        indexRoute,\n      ])\n      const router = createRouter({ routeTree, history })\n\n      render(<RouterProvider router={router} />)\n\n      const linkToAbout = await screen.findByText('link to about')\n\n      expect(linkToAbout).toBeInTheDocument()\n\n      fireEvent.click(linkToAbout)\n\n      const fooElement = await screen.findByText('Nested Foo page')\n\n      expect(fooElement).toBeInTheDocument()\n\n      expect(router.state.location.href).toBe('/nested/foo')\n      expect(window.location.pathname).toBe('/nested/foo')\n\n      expect(nestedLoaderMock).toHaveBeenCalled()\n      expect(nestedFooLoaderMock).toHaveBeenCalled()\n    })\n\n    test('when `redirect` is thrown in `loader`', async () => {\n      const nestedLoaderMock = vi.fn()\n      const nestedFooLoaderMock = vi.fn()\n\n      const rootRoute = createRootRoute({})\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <div>\n              <h1>Index page</h1>\n              <Link to=\"/about\">link to about</Link>\n            </div>\n          )\n        },\n      })\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          throw redirect({\n            to: '/nested/foo',\n            hash: 'some-hash',\n            search: { someSearch: 'hello123' },\n          })\n        },\n      })\n      const nestedRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/nested',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          nestedLoaderMock('nested')\n        },\n      })\n      const fooRoute = createRoute({\n        validateSearch: (search) => {\n          return {\n            someSearch: search.someSearch as string,\n          }\n        },\n        getParentRoute: () => nestedRoute,\n        path: '/foo',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          nestedFooLoaderMock('foo')\n        },\n        component: () => <div>Nested Foo page</div>,\n      })\n      const routeTree = rootRoute.addChildren([\n        nestedRoute.addChildren([fooRoute]),\n        aboutRoute,\n        indexRoute,\n      ])\n      const router = createRouter({ routeTree, history })\n\n      render(<RouterProvider router={router} />)\n\n      const linkToAbout = await screen.findByText('link to about')\n\n      expect(linkToAbout).toBeInTheDocument()\n\n      fireEvent.click(linkToAbout)\n\n      const fooElement = await screen.findByText('Nested Foo page')\n\n      expect(fooElement).toBeInTheDocument()\n\n      expect(router.state.location.href).toBe(\n        '/nested/foo?someSearch=hello123#some-hash',\n      )\n      expect(window.location.pathname).toBe('/nested/foo')\n\n      expect(nestedLoaderMock).toHaveBeenCalled()\n      expect(nestedFooLoaderMock).toHaveBeenCalled()\n    })\n\n    test('when `redirect` is thrown in `loader` after `router.invalidate()`', async () => {\n      let shouldRedirect = false\n\n      const rootRoute = createRootRoute({})\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <div>\n              <h1>Index page</h1>\n              <Link data-testid=\"link-to-about\" to=\"/about\">\n                link to about\n              </Link>\n            </div>\n          )\n        },\n      })\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          if (shouldRedirect) {\n            throw redirect({\n              to: '/final',\n            })\n          }\n        },\n        component: function Component() {\n          const router = useRouter()\n          return (\n            <button\n              data-testid=\"button-invalidate\"\n              onClick={() => {\n                shouldRedirect = true\n                router.invalidate()\n              }}\n            >\n              invalidate\n            </button>\n          )\n        },\n      })\n      const finalRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/final',\n        component: () => <div>Final</div>,\n      })\n\n      const routeTree = rootRoute.addChildren([\n        aboutRoute,\n        indexRoute,\n        finalRoute,\n      ])\n      const router = createRouter({ routeTree, history })\n\n      render(<RouterProvider router={router} />)\n\n      const linkToAbout = await screen.findByTestId('link-to-about')\n      expect(linkToAbout).toBeInTheDocument()\n\n      fireEvent.click(linkToAbout)\n\n      const invalidateButton = await screen.findByTestId('button-invalidate')\n      expect(invalidateButton).toBeInTheDocument()\n\n      fireEvent.click(invalidateButton)\n\n      expect(await screen.findByText('Final')).toBeInTheDocument()\n      expect(window.location.pathname).toBe('/final')\n    })\n  })\n\n  describe('SSR', () => {\n    test('when `redirect` is thrown in `beforeLoad`', async () => {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        path: '/',\n        getParentRoute: () => rootRoute,\n        beforeLoad: () => {\n          throw redirect({\n            to: '/about',\n          })\n        },\n      })\n\n      const aboutRoute = createRoute({\n        path: '/about',\n        getParentRoute: () => rootRoute,\n        component: () => {\n          return 'About'\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, aboutRoute]),\n        // Mock server mode\n        isServer: true,\n        history: createMemoryHistory({\n          initialEntries: ['/'],\n        }),\n      })\n\n      await router.load()\n\n      expect(router.state.redirect).toBeDefined()\n      expect(router.state.redirect).toBeInstanceOf(Response)\n      invariant(router.state.redirect)\n\n      expect(router.state.redirect.options).toEqual({\n        _fromLocation: expect.objectContaining({\n          hash: '',\n          href: '/',\n          pathname: '/',\n          search: {},\n          searchStr: '',\n        }),\n        to: '/about',\n        href: '/about',\n        statusCode: 307,\n      })\n    })\n\n    test('when `redirect` is thrown in `loader`', async () => {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        path: '/',\n        getParentRoute: () => rootRoute,\n        loader: () => {\n          throw redirect({\n            to: '/about',\n          })\n        },\n      })\n\n      const aboutRoute = createRoute({\n        path: '/about',\n        getParentRoute: () => rootRoute,\n        component: () => {\n          return 'About'\n        },\n      })\n\n      const router = createRouter({\n        history: createMemoryHistory({\n          initialEntries: ['/'],\n        }),\n        routeTree: rootRoute.addChildren([indexRoute, aboutRoute]),\n        // Mock server mode\n        isServer: true,\n      })\n\n      await router.load()\n\n      const currentRedirect = router.state.redirect\n\n      expect(currentRedirect).toBeDefined()\n      expect(currentRedirect).toBeInstanceOf(Response)\n      invariant(currentRedirect)\n      expect(currentRedirect.status).toEqual(307)\n      expect(currentRedirect.headers.get('Location')).toEqual('/about')\n      expect(currentRedirect.options).toEqual({\n        _fromLocation: {\n          external: false,\n          hash: '',\n          href: '/',\n          publicHref: '/',\n          pathname: '/',\n          search: {},\n          searchStr: '',\n          state: {\n            __TSR_index: 0,\n            __TSR_key: currentRedirect.options._fromLocation!.state.__TSR_key,\n            key: currentRedirect.options._fromLocation!.state.key,\n          },\n        },\n        href: '/about',\n        to: '/about',\n        statusCode: 307,\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/redirects.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter, redirect } from '../src'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n})\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\ntest('can redirect to valid route', () => {\n  expectTypeOf(redirect<DefaultRouter, '/invoices', string>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'/' | '/invoices' | '/invoices/$invoiceId' | '.' | '..'>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/route.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  createRootRoute,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  redirect,\n} from '../src'\nimport type {\n  BuildLocationFn,\n  ControlledPromise,\n  NavigateFn,\n  NavigateOptions,\n  SearchSchemaInput,\n} from '../src'\nimport type {\n  AnyRoute,\n  AnyRouter,\n  Expand,\n  MakeRouteMatchFromRoute,\n  MakeRouteMatchUnion,\n  ParsedLocation,\n} from '@tanstack/router-core'\n\ntest('when creating the root', () => {\n  const rootRoute = createRootRoute()\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n})\n\ntest('when creating the root with routeContext', () => {\n  const rootRoute = createRootRoute({\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {}\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n})\n\ntest('when creating the root with beforeLoad', () => {\n  const rootRoute = createRootRoute({\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {}\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n})\n\ntest('when creating the root with a loader', () => {\n  const rootRoute = createRootRoute({\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: {}\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: never\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n})\n\ntest('when creating the root route with context and routeContext', () => {\n  const createRouteResult = createRootRouteWithContext<{ userId: string }>()\n  const rootRoute = createRouteResult({\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<{\n    userId: string\n  }>()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((context: { userId: string }) => unknown) | undefined>()\n})\n\ntest('when creating the root route with context and beforeLoad', () => {\n  const createRouteResult = createRootRouteWithContext<{ userId: string }>()\n\n  const rootRoute = createRouteResult({\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<{\n    userId: string\n  }>()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((context: { userId: string }) => unknown) | undefined>()\n})\n\ntest('when creating the root route with context and a loader', () => {\n  const createRouteResult = createRootRouteWithContext<{ userId: string }>()\n\n  const rootRoute = createRouteResult({\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: { userId: string }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: never\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<{\n    userId: string\n  }>()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((context: { userId: string }) => unknown) | undefined>()\n})\n\ntest('when creating the root route with context, routeContext, beforeLoad and a loader', () => {\n  const createRouteResult = createRootRouteWithContext<{ userId: string }>()\n\n  const rootRoute = createRouteResult({\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n\n      return {\n        env: 'env1' as const,\n      }\n    },\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; env: 'env1' }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n      return { permission: 'view' as const }\n    },\n    loader: (opts) => {\n      type hi = Expand<typeof opts>\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: { userId: string; permission: 'view'; env: 'env1' }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: never\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<{\n    userId: string\n    permission: 'view'\n    env: 'env1'\n  }>()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((context: {\n          userId: string\n          permission: 'view'\n          env: 'env1'\n        }) => string)\n      | undefined\n    >()\n})\n\ntest('when creating a child route from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n  })\n\n  expectTypeOf(invoicesRoute.fullPath).toEqualTypeOf<'/invoices'>()\n  expectTypeOf(invoicesRoute.path).toEqualTypeOf<'invoices'>()\n  expectTypeOf(invoicesRoute.id).toEqualTypeOf<'/invoices'>()\n})\n\ntest('when creating a child route from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<{\n    userId: string\n  }>()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((context: { userId: string }) => unknown) | undefined>()\n})\n\ntest('when creating a child route with routeContext from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n\n      return {\n        env: 'env1' as const,\n      }\n    },\n  })\n})\n\ntest('when creating a child route with beforeLoad from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n    },\n  })\n})\n\ntest('when creating a child route with a loader from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    loader: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: {}\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n      return [{ id: 'invoice1' }, { id: 'invoice2' }] as const\n    },\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((\n          search: readonly [\n            { readonly id: 'invoice1' },\n            { readonly id: 'invoice2' },\n          ],\n        ) => string)\n      | undefined\n    >()\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router>()).toEqualTypeOf<\n    readonly [{ readonly id: 'invoice1' }, { readonly id: 'invoice2' }]\n  >()\n})\n\ntest('when creating a child route with a loader from the root route with context', () => {\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: { userId: string }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n      return [{ id: 'invoice1' }, { id: 'invoice2' }] as const\n    },\n  })\n\n  const rootRoute = createRootRouteWithContext<{\n    userId: string\n  }>()()\n\n  const routeTree = rootRoute.addChildren([invoicesRoute])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((\n          search: readonly [\n            { readonly id: 'invoice1' },\n            { readonly id: 'invoice2' },\n          ],\n        ) => string)\n      | undefined\n    >()\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router>()).toEqualTypeOf<\n    readonly [{ readonly id: 'invoice1' }, { readonly id: 'invoice2' }]\n  >()\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router>()).toEqualTypeOf<\n    readonly [{ readonly id: 'invoice1' }, { readonly id: 'invoice2' }]\n  >()\n})\n\ntest('when creating a child route with search params from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: number\n  }>()\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((search: { page: number }) => number) | undefined>()\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n})\n\ntest('when creating a child route with optional search params from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: (): { page?: number } => ({ page: 0 }),\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page?: number\n  }>()\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      ((search: { page?: number | undefined }) => number) | undefined\n    >()\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n})\n\ntest('when creating a child route with params from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<{\n    invoiceId: string\n  }>()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((params: { invoiceId: string }) => number) | undefined>()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n})\n\ntest('when creating a child route with a splat param from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices/$',\n    getParentRoute: () => rootRoute,\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<{\n    _splat?: string\n  }>()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((params: { _splat?: string }) => number) | undefined>()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n})\n\ntest('when creating a child route with a param and splat param from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices/$invoiceId/$',\n    getParentRoute: () => rootRoute,\n  })\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  const params = invoicesRoute.useParams<typeof router>()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<{\n    invoiceId: string\n    _splat?: string\n  }>()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      ((params: { invoiceId: string; _splat?: string }) => number) | undefined\n    >()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n})\n\ntest('when creating a child route with params, search and loader from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        deps: {}\n        context: {}\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>\n    },\n  })\n})\n\ntest('when creating a child route with params, search, loader and loaderDeps from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    loaderDeps: (deps) => ({ page: deps.search.page }),\n    loader: (opts) =>\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        deps: { page: number }\n        context: {}\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>(),\n  })\n})\n\ntest('when creating a child route with params, search, loader and loaderDeps from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    loaderDeps: (deps) => ({ page: deps.search.page }),\n    loader: (opts) =>\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        deps: { page: number }\n        context: { userId: string }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>(),\n  })\n})\n\ntest('when creating a child route with params, search with routeContext from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId'\n      }>()\n    },\n  })\n})\n\ntest('when creating a child route with params, search with beforeLoad from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toMatchTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        search: { page: number }\n        matches: Array<MakeRouteMatchUnion>\n      }>()\n    },\n  })\n})\n\ntest('when creating a child route with params, search with routeContext, beforeLoad and a loader from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId'\n      }>()\n      return {\n        env: 'env1',\n      }\n    },\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; env: string }\n        search: { page: number }\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId'\n      }>()\n      return { permission: 'view' } as const\n    },\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        deps: {}\n        context: { userId: string; env: string; readonly permission: 'view' }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n    },\n  })\n})\n\ntest('when creating a child route with params from a parent with params', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: '$detailId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([detailsRoute]),\n    ]),\n  })\n\n  expectTypeOf(detailsRoute.useParams<typeof router>()).toEqualTypeOf<{\n    invoiceId: string\n    detailId: string\n  }>()\n\n  expectTypeOf(detailsRoute.useParams<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      ((params: { invoiceId: string; detailId: string }) => number) | undefined\n    >()\n\n  expectTypeOf(detailsRoute.useParams<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n})\n\ntest('when creating a child route with search from a parent with search', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ invoicePage: 0 }),\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoicesRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([detailsRoute]),\n    ]),\n  })\n\n  expectTypeOf(detailsRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    invoicePage: number\n    detailPage: number\n  }>()\n\n  expectTypeOf(detailsRoute.useSearch<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((params: { invoicePage: number; detailPage: number }) => number)\n      | undefined\n    >()\n\n  expectTypeOf(detailsRoute.useSearch<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<boolean | undefined>()\n})\n\ntest('when creating a child route with routeContext from a parent with routeContext', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n\n      return { invoiceId: 'invoiceId1' }\n    },\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoicesRoute,\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; invoiceId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/details'\n      }>()\n\n      return { detailId: 'detailId1' }\n    },\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([detailsRoute]),\n    ]),\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(detailsRoute.useRouteContext<typeof router>()).toEqualTypeOf<{\n    userId: string\n    invoiceId: string\n    detailId: string\n  }>()\n\n  expectTypeOf(detailsRoute.useRouteContext<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((params: {\n          userId: string\n          invoiceId: string\n          detailId: string\n        }) => number)\n      | undefined\n    >()\n})\n\ntest('when creating a child route with beforeLoad from a parent with beforeLoad', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    beforeLoad: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n      return { invoiceId: 'invoiceId1' }\n    },\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoicesRoute,\n    beforeLoad: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; invoiceId: string }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/details'\n      }>()\n      return { detailId: 'detailId1' }\n    },\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([detailsRoute]),\n    ]),\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(detailsRoute.useRouteContext<typeof router>()).toEqualTypeOf<{\n    userId: string\n    invoiceId: string\n    detailId: string\n  }>()\n\n  expectTypeOf(detailsRoute.useRouteContext<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((params: {\n          userId: string\n          invoiceId: string\n          detailId: string\n        }) => number)\n      | undefined\n    >()\n})\n\ntest('when creating a child route with routeContext, beforeLoad, search, params, loaderDeps and loader', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n      return { env: 'env1' }\n    },\n    beforeLoad: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; env: string }\n        search: { page: number }\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n      return { invoicePermissions: ['view'] as const }\n    },\n  })\n\n  const invoiceRoute = createRoute({\n    path: '$invoiceId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoiceRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {\n          userId: string\n          env: string\n          invoicePermissions: readonly ['view']\n        }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId/details'\n      }>()\n      return { detailEnv: 'detailEnv' }\n    },\n    beforeLoad: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {\n          detailEnv: string\n          userId: string\n          env: string\n          invoicePermissions: readonly ['view']\n        }\n        search: { page: number; detailPage: number }\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId/details'\n      }>()\n      return { detailsPermissions: ['view'] as const }\n    },\n  })\n\n  const detailRoute = createRoute({\n    path: '$detailId',\n    getParentRoute: () => detailsRoute,\n    loaderDeps: (deps) => ({\n      detailPage: deps.search.detailPage,\n      invoicePage: deps.search.page,\n    }),\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string; detailId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {\n          userId: string\n          env: string\n          invoicePermissions: readonly ['view']\n          detailEnv: string\n          detailsPermissions: readonly ['view']\n        }\n        deps: { detailPage: number; invoicePage: number }\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId/details/$detailId'\n      }>()\n      return { detailEnv: 'detailEnv' }\n    },\n    loader: (opts) =>\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string; detailId: string }\n        deps: { detailPage: number; invoicePage: number }\n        context: {\n          userId: string\n          env: string\n          invoicePermissions: readonly ['view']\n          detailEnv: string\n          detailsPermissions: readonly ['view']\n        }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<\n          MakeRouteMatchFromRoute<typeof detailsRoute>\n        >\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>(),\n  })\n})\n\ntest('when creating a child route with context, search, params and beforeLoad', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    beforeLoad: () => ({ invoicePermissions: ['view'] as const }),\n  })\n\n  const invoiceRoute = createRoute({\n    path: '$invoiceId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoiceRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n    beforeLoad: () => ({ detailsPermissions: ['view'] as const }),\n  })\n\n  const detailRoute = createRoute({\n    path: '$detailId',\n    getParentRoute: () => detailsRoute,\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toMatchTypeOf<{\n        params: { detailId: string; invoiceId: string }\n        search: { detailPage: number; page: number }\n        context: {\n          userId: string\n          detailsPermissions: readonly ['view']\n          invoicePermissions: readonly ['view']\n        }\n      }>()\n      expectTypeOf(opts.buildLocation<Router, '.', '/'>)\n        .parameter(0)\n        .toHaveProperty('to')\n        .toEqualTypeOf<\n          | '.'\n          | './invoices'\n          | './invoices/$invoiceId'\n          | './invoices/$invoiceId/details'\n          | './invoices/$invoiceId/details/$detailId'\n          | undefined\n        >()\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([\n      invoiceRoute.addChildren([detailsRoute.addChildren([detailRoute])]),\n    ]),\n  ])\n\n  const router = createRouter({\n    routeTree,\n    context: { userId: 'userId' },\n  })\n\n  type Router = typeof router\n})\n\ntest('when creating a child route with context, search, params, loader, loaderDeps and onEnter, onStay, onLeave', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    beforeLoad: () => ({ invoicePermissions: ['view'] as const }),\n  })\n\n  const invoiceRoute = createRoute({\n    path: '$invoiceId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoiceRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n    beforeLoad: () => ({ detailsPermissions: ['view'] as const }),\n  })\n\n  type TExpectedParams = { detailId: string; invoiceId: string }\n  type TExpectedSearch = { detailPage: number; page: number }\n  type TExpectedContext = {\n    userId: string\n    detailsPermissions: readonly ['view']\n    invoicePermissions: readonly ['view']\n    detailPermission: boolean\n  }\n  type TExpectedLoaderData = { detailLoader: 'detailResult' }\n  type TExpectedMatch = {\n    params: TExpectedParams\n    search: TExpectedSearch\n    context: TExpectedContext\n    loaderDeps: { detailPage: number; invoicePage: number }\n    beforeLoadPromise?: ControlledPromise<void>\n    loaderPromise?: ControlledPromise<void>\n    componentsPromise?: Promise<Array<void>>\n    loaderData?: TExpectedLoaderData\n  }\n\n  createRoute({\n    path: '$detailId',\n    getParentRoute: () => detailsRoute,\n    beforeLoad: () => ({ detailPermission: true }),\n    loaderDeps: (deps) => ({\n      detailPage: deps.search.detailPage,\n      invoicePage: deps.search.page,\n    }),\n    loader: () => ({ detailLoader: 'detailResult' }) as const,\n    onEnter: (match) => expectTypeOf(match).toMatchTypeOf<TExpectedMatch>(),\n    onStay: (match) => expectTypeOf(match).toMatchTypeOf<TExpectedMatch>(),\n    onLeave: (match) => expectTypeOf(match).toMatchTypeOf<TExpectedMatch>(),\n  })\n})\n\ntest('when creating a child route with parseParams and stringify params without params in path', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    parseParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{}>()\n      return params\n    },\n    stringifyParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{}>()\n      return params\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx).toHaveProperty('params').toEqualTypeOf<{}>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx).toHaveProperty('params').toEqualTypeOf<{}>()\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([invoicesRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<{}>()\n})\n\ntest('when creating a child route with params.parse and params.stringify without params in path', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    params: {\n      parse: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{}>()\n        return params\n      },\n      stringify: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{}>()\n        return params\n      },\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx).toHaveProperty('params').toEqualTypeOf<{}>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx).toHaveProperty('params').toEqualTypeOf<{}>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<{}>()\n})\n\ntest('when creating a child route with parseParams and stringifyParams with params in path', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    parseParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ invoiceId: string }>()\n      return { invoiceId: Number(params.invoiceId) }\n    },\n    stringifyParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ invoiceId: number }>()\n      return { invoiceId: params.invoiceId.toString() }\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoiceRoute]),\n  })\n\n  expectTypeOf(invoiceRoute.useParams<typeof router>()).toEqualTypeOf<{\n    invoiceId: number\n  }>()\n})\n\ntest('when creating a child route with params.parse and params.stringify with params in path', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    params: {\n      parse: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ invoiceId: string }>()\n        return { invoiceId: Number(params.invoiceId) }\n      },\n      stringify: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ invoiceId: number }>()\n        return { invoiceId: params.invoiceId.toString() }\n      },\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: invoicesRoute.addChildren([invoiceRoute]),\n  })\n\n  expectTypeOf(invoiceRoute.useParams<typeof router>()).toEqualTypeOf<{\n    invoiceId: number\n  }>()\n})\n\ntest('when creating a child route with parseParams and stringifyParams with merged params from parent', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    parseParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ invoiceId: string }>()\n      return { invoiceId: Number(params.invoiceId) }\n    },\n    stringifyParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ invoiceId: number }>()\n      return { invoiceId: params.invoiceId.toString() }\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n  })\n\n  const detailRoute = createRoute({\n    getParentRoute: () => invoiceRoute,\n    path: '$detailId',\n\n    parseParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{\n        detailId: string\n      }>()\n      return { detailId: Number(params.detailId) }\n    },\n    stringifyParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ detailId: number }>()\n      return { detailId: params.detailId.toString() }\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number; detailId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number; detailId: number }>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: invoicesRoute.addChildren([\n      invoiceRoute.addChildren([detailRoute]),\n    ]),\n  })\n\n  expectTypeOf(detailRoute.useParams<typeof router>()).toEqualTypeOf<{\n    detailId: number\n    invoiceId: number\n  }>()\n})\n\ntest('when creating a child route with params.parse and params.stringify with merged params from parent', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    params: {\n      parse: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ invoiceId: string }>()\n        return { invoiceId: Number(params.invoiceId) }\n      },\n      stringify: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ invoiceId: number }>()\n        return { invoiceId: params.invoiceId.toString() }\n      },\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n  })\n\n  const detailRoute = createRoute({\n    getParentRoute: () => invoiceRoute,\n    path: '$detailId',\n    params: {\n      parse: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{\n          detailId: string\n        }>()\n        return { detailId: Number(params.detailId) }\n      },\n      stringify: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ detailId: number }>()\n        return { detailId: params.detailId.toString() }\n      },\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number; detailId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number; detailId: number }>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([invoiceRoute.addChildren([detailRoute])]),\n    ]),\n  })\n\n  expectTypeOf(detailRoute.useParams<typeof router>()).toEqualTypeOf<{\n    detailId: number\n    invoiceId: number\n  }>()\n})\n\ntest('when routeContext throws', () => {\n  const rootRoute = createRootRoute()\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    context: () => {\n      throw redirect({ to: '/somewhere' })\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(\n    invoicesRoute.useRouteContext<typeof router>(),\n  ).toEqualTypeOf<{}>()\n})\n\ntest('when beforeLoad throws', () => {\n  const rootRoute = createRootRoute()\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    beforeLoad: () => {\n      throw redirect({ to: '/somewhere' })\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(\n    invoicesRoute.useRouteContext<typeof router>(),\n  ).toEqualTypeOf<{}>()\n})\n\ntest('when creating a child route with no explicit search input', () => {\n  const rootRoute = createRootRoute({\n    validateSearch: (input) => {\n      expectTypeOf(input).toEqualTypeOf<Record<string, unknown>>()\n      return {\n        page: 0,\n      }\n    },\n  })\n\n  const rootRouteWithContext = createRootRouteWithContext()({\n    validateSearch: (input) => {\n      expectTypeOf(input).toEqualTypeOf<Record<string, unknown>>()\n      return {\n        page: 0,\n      }\n    },\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    validateSearch: (input) => {\n      expectTypeOf(input).toEqualTypeOf<Record<string, unknown>>()\n      return {\n        page: 0,\n      }\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(rootRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: number\n  }>()\n\n  expectTypeOf(indexRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: number\n  }>()\n\n  expectTypeOf(rootRouteWithContext.useSearch<typeof router>()).toEqualTypeOf<{\n    page: number\n  }>()\n\n  const navigate = indexRoute.useNavigate()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ page: number }>()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ page: number }>()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ page: number }>()\n})\n\ntest('when creating a child route with an explicit search input', () => {\n  const rootRoute = createRootRoute({\n    validateSearch: (input: SearchSchemaInput & { input: string }) => {\n      return {\n        page: input.input,\n      }\n    },\n  })\n\n  const rootRouteWithContext = createRootRouteWithContext()({\n    validateSearch: (input: SearchSchemaInput & { input: string }) => {\n      return {\n        page: input.input,\n      }\n    },\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    validateSearch: (input: SearchSchemaInput & { input: string }) => {\n      return {\n        page: input.input,\n      }\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(rootRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: string\n  }>()\n\n  expectTypeOf(indexRoute.useSearch<typeof router>()).toEqualTypeOf<{\n    page: string\n  }>()\n\n  expectTypeOf(rootRouteWithContext.useSearch<typeof router>()).toEqualTypeOf<{\n    page: string\n  }>()\n\n  const navigate = indexRoute.useNavigate()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ input: string }>()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ input: string }>()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ page: string }>()\n})\n\ntest('when creating a route with a prefix and suffix', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'prefix{$postId}suffix',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<{\n    postId: string\n  }>()\n})\n\ntest('when creating a route with a optional prefix and suffix', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'prefix{-$postId}suffix',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<{\n    postId?: string\n  }>()\n})\n\ntest('when creating a route with a splat prefix and suffix', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'prefix{$}suffix',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<{\n    _splat?: string\n  }>()\n})\n\ntest('when creating a route with a splat, optional param and required param', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'docs/$docId/$/{-$detailId}/{$myFile}.pdf',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<{\n    docId: string\n    _splat?: string\n    myFile: string\n    detailId?: string\n  }>()\n})\n\ntest('when creating a route with a boundary splat, optional param and required param', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'docs/$docId/before{$}after/detail{-$detailId}/file-{$myFile}.pdf',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<{\n    docId: string\n    _splat?: string\n    myFile: string\n    detailId?: string\n  }>()\n})\n\ntest('when creating a route with a nested boundary splat, optional param and required param', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'docs/$docId/before{$}after/{-detail{$detailId}suffix}/file-{$myFile}.pdf',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<{\n    docId: string\n    _splat?: string\n    myFile: string\n    detailId?: string\n  }>()\n})\n\ntest('when creating a route with a nested boundary splat, optional param, required param and escaping', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'docs/$docId/before{$}after/{-detail{$detailId}suffix}[.$test]/file-{$myFile}[.]pdf/escape-param[$postId]',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<{\n    docId: string\n    _splat?: string\n    myFile: string\n    detailId?: string\n  }>()\n})\n\ntest('when creating a route with escaped path param', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '[$postId]',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<{}>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/route.test.tsx",
    "content": "import React from 'react'\nimport { afterEach, beforeEach, describe, expect, it, test, vi } from 'vitest'\nimport { cleanup, render, screen } from '@testing-library/react'\n\nimport {\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  getRouteApi,\n  notFound,\n} from '../src'\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ndescribe('getRouteApi', () => {\n  it('should have the useMatch hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useMatch).toBeDefined()\n  })\n\n  it('should have the useRouteContext hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useRouteContext).toBeDefined()\n  })\n\n  it('should have the useSearch hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useSearch).toBeDefined()\n  })\n\n  it('should have the useParams hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useParams).toBeDefined()\n  })\n\n  it('should have the useLoaderData hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useLoaderData).toBeDefined()\n  })\n\n  it('should have the useLoaderDeps hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useLoaderDeps).toBeDefined()\n  })\n\n  it('should have the useNavigate hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useNavigate).toBeDefined()\n  })\n})\n\ndescribe('createRoute has the same hooks as getRouteApi', () => {\n  const routeApi = getRouteApi('foo')\n  const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))\n  const route = createRoute({} as any)\n\n  it.each(hookNames.map((name) => [name]))(\n    'should have the \"%s\" hook defined',\n    (hookName) => {\n      expect(route[hookName as keyof typeof route]).toBeDefined()\n    },\n  )\n})\n\n/* disabled until HMR bug is fixed \ndescribe('throws invariant exception when trying to access properties before `createRouter` completed', () => {\n  function setup() {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <h1>Index</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n          <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n    const initRouter = () =>\n      createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      })\n    return { initRouter, rootRoute, indexRoute, postsRoute }\n  }\n\n  it('to', () => {\n    const { initRouter, indexRoute, postsRoute } = setup()\n\n    const expectedError = `Invariant failed: trying to access property 'to' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`\n    expect(() => indexRoute.to).toThrowError(expectedError)\n    expect(() => postsRoute.to).toThrowError(expectedError)\n\n    initRouter()\n\n    expect(indexRoute.to).toBe('/')\n    expect(postsRoute.to).toBe('/posts')\n  })\n\n  it('fullPath', () => {\n    const { initRouter, indexRoute, postsRoute } = setup()\n\n    const expectedError = `trying to access property 'fullPath' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`\n    expect(() => indexRoute.fullPath).toThrowError(expectedError)\n    expect(() => postsRoute.fullPath).toThrowError(expectedError)\n\n    initRouter()\n\n    expect(indexRoute.fullPath).toBe('/')\n    expect(postsRoute.fullPath).toBe('/posts')\n  })\n\n  it('id', () => {\n    const { initRouter, indexRoute, postsRoute } = setup()\n\n    const expectedError = `Invariant failed: trying to access property 'id' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`\n    expect(() => indexRoute.id).toThrowError(expectedError)\n    expect(() => postsRoute.id).toThrowError(expectedError)\n\n    initRouter()\n\n    expect(indexRoute.to).toBe('/')\n    expect(postsRoute.to).toBe('/posts')\n  })\n})\n*/\n\ndescribe('onEnter event', () => {\n  it('should have router context defined in router.load()', async () => {\n    const fn = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return <h1>Index</h1>\n      },\n      onEnter: ({ context }) => {\n        fn(context)\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, context: { foo: 'bar' }, history })\n\n    await router.load()\n\n    expect(fn).toHaveBeenCalledWith({ foo: 'bar' })\n  })\n\n  it('should have router context defined in <RouterProvider router={router} />', async () => {\n    const fn = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return <h1>Index</h1>\n      },\n      onEnter: ({ context }) => {\n        fn(context)\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, context: { foo: 'bar' }, history })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    expect(fn).toHaveBeenCalledWith({ foo: 'bar' })\n  })\n})\n\ndescribe('route.head', () => {\n  test('meta', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        meta: [\n          { title: 'Root' },\n          {\n            charSet: 'utf-8',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        meta: [{ title: 'Index' }],\n      }),\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(<RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const metaState = router.state.matches.map((m) => m.meta)\n    expect(metaState).toEqual([\n      [\n        { title: 'Root' },\n        {\n          charSet: 'utf-8',\n        },\n      ],\n      [{ title: 'Index' }],\n    ])\n  })\n\n  test('meta w/ loader', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        meta: [\n          { title: 'Root' },\n          {\n            charSet: 'utf-8',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        meta: [{ title: 'Index' }],\n      }),\n      loader: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 200))\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(<RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const metaState = router.state.matches.map((m) => m.meta)\n    expect(metaState).toEqual([\n      [\n        { title: 'Root' },\n        {\n          charSet: 'utf-8',\n        },\n      ],\n      [{ title: 'Index' }],\n    ])\n  })\n\n  test('meta is set when loader throws notFound', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        meta: [\n          { title: 'Root' },\n          {\n            charSet: 'utf-8',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        meta: [{ title: 'Index' }],\n      }),\n      loader: async () => {\n        throw notFound()\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree })\n    render(<RouterProvider router={router} />)\n    expect(await screen.findByText('Not Found')).toBeInTheDocument()\n\n    const metaState = router.state.matches.map((m) => m.meta)\n    expect(metaState).toEqual([\n      [\n        { title: 'Root' },\n        {\n          charSet: 'utf-8',\n        },\n      ],\n      [{ title: 'Index' }],\n    ])\n  })\n\n  test('meta is set when loader throws an error', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        meta: [\n          { title: 'Root' },\n          {\n            charSet: 'utf-8',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        meta: [{ title: 'Index' }],\n      }),\n      loader: async () => {\n        throw new Error('Fly, you fools!')\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree })\n    render(<RouterProvider router={router} />)\n\n    expect(await screen.findByText('Fly, you fools!')).toBeInTheDocument()\n\n    const metaState = router.state.matches.map((m) => m.meta)\n    expect(metaState).toEqual([\n      [\n        { title: 'Root' },\n        {\n          charSet: 'utf-8',\n        },\n      ],\n      [{ title: 'Index' }],\n    ])\n  })\n\n  test('scripts', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        scripts: [{ src: 'root.js' }, { src: 'root2.js' }],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        scripts: [{ src: 'index.js' }],\n      }),\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(<RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const scriptsState = router.state.matches.map((m) => m.headScripts)\n    expect(scriptsState).toEqual([\n      [{ src: 'root.js' }, { src: 'root2.js' }],\n      [{ src: 'index.js' }],\n    ])\n  })\n\n  test('scripts w/ loader', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        scripts: [{ src: 'root.js' }, { src: 'root2.js' }],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        scripts: [{ src: 'index.js' }],\n      }),\n      loader: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 200))\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(<RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const scriptsState = router.state.matches.map((m) => m.headScripts)\n    expect(scriptsState).toEqual([\n      [{ src: 'root.js' }, { src: 'root2.js' }],\n      [{ src: 'index.js' }],\n    ])\n  })\n\n  test('links', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        links: [{ href: 'root.css' }, { href: 'root2.css' }],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        links: [{ href: 'index.css' }],\n      }),\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(<RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const linksState = router.state.matches.map((m) => m.links)\n    expect(linksState).toEqual([\n      [{ href: 'root.css' }, { href: 'root2.css' }],\n      [{ href: 'index.css' }],\n    ])\n  })\n\n  test('links w/loader', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        links: [{ href: 'root.css' }, { href: 'root2.css' }],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        links: [{ href: 'index.css' }],\n      }),\n      loader: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 200))\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(<RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const linksState = router.state.matches.map((m) => m.links)\n    expect(linksState).toEqual([\n      [{ href: 'root.css' }, { href: 'root2.css' }],\n      [{ href: 'index.css' }],\n    ])\n  })\n\n  test('styles', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        styles: [\n          {\n            media: 'all and (min-width: 200px)',\n            children: '.inline-div { color: blue; }',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        styles: [\n          {\n            media: 'all and (min-width: 100px)',\n            children: '.inline-div { background-color: yellow; }',\n          },\n        ],\n      }),\n      component: () => <div className=\"inline-div\">Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(<RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const stylesState = router.state.matches.map((m) => m.styles)\n    expect(stylesState).toEqual([\n      [\n        {\n          media: 'all and (min-width: 200px)',\n          children: '.inline-div { color: blue; }',\n        },\n      ],\n      [\n        {\n          media: 'all and (min-width: 100px)',\n          children: '.inline-div { background-color: yellow; }',\n        },\n      ],\n    ])\n  })\n\n  test('styles w/loader', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        styles: [\n          {\n            media: 'all and (min-width: 200px)',\n            children: '.inline-div { color: blue; }',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        styles: [\n          {\n            media: 'all and (min-width: 100px)',\n            children: '.inline-div { background-color: yellow; }',\n          },\n        ],\n      }),\n      loader: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 200))\n      },\n      component: () => <div className=\"inline-div\">Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(<RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const stylesState = router.state.matches.map((m) => m.styles)\n    expect(stylesState).toEqual([\n      [\n        {\n          media: 'all and (min-width: 200px)',\n          children: '.inline-div { color: blue; }',\n        },\n      ],\n      [\n        {\n          media: 'all and (min-width: 100px)',\n          children: '.inline-div { background-color: yellow; }',\n        },\n      ],\n    ])\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/routeApi.test-d.tsx",
    "content": "import { describe, expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter, getRouteApi } from '../src'\nimport type { MakeRouteMatch, UseNavigateResult } from '../src'\nimport type { LinkComponentRoute } from '../src/link'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n  beforeLoad: () => ({ beforeLoadContext: 0 }),\n  loaderDeps: () => ({ dep: 0 }),\n  loader: () => ({ data: 0 }),\n})\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\ntype ExtractDefaultFrom<T> =\n  T extends UseNavigateResult<infer DefaultFrom> ? DefaultFrom : never\n\ndescribe('getRouteApi', () => {\n  const invoiceRouteApi = getRouteApi<'/invoices/$invoiceId', DefaultRouter>(\n    '/invoices/$invoiceId',\n  )\n  describe('useNavigate', () => {\n    test('has a static `from`', () => {\n      const navigate = invoiceRouteApi.useNavigate()\n      navigate\n      expectTypeOf<\n        ExtractDefaultFrom<typeof navigate>\n      >().toEqualTypeOf<'/invoices/$invoiceId'>()\n    })\n  })\n  test('useParams', () => {\n    expectTypeOf(invoiceRouteApi.useParams<DefaultRouter>()).toEqualTypeOf<{\n      invoiceId: string\n    }>()\n  })\n  test('useContext', () => {\n    expectTypeOf(\n      invoiceRouteApi.useRouteContext<DefaultRouter>(),\n    ).toEqualTypeOf<{\n      beforeLoadContext: number\n    }>()\n  })\n  test('useSearch', () => {\n    expectTypeOf(invoiceRouteApi.useSearch<DefaultRouter>()).toEqualTypeOf<{\n      page: number\n    }>()\n  })\n  test('useLoaderData', () => {\n    expectTypeOf(invoiceRouteApi.useLoaderData<DefaultRouter>()).toEqualTypeOf<{\n      data: number\n    }>()\n  })\n  test('useLoaderDeps', () => {\n    expectTypeOf(invoiceRouteApi.useLoaderDeps<DefaultRouter>()).toEqualTypeOf<{\n      dep: number\n    }>()\n  })\n  test('useMatch', () => {\n    expectTypeOf(invoiceRouteApi.useMatch<DefaultRouter>()).toEqualTypeOf<\n      MakeRouteMatch<typeof routeTree, '/invoices/$invoiceId'>\n    >()\n  })\n  test('Link', () => {\n    const Link = invoiceRouteApi.Link\n    expectTypeOf(Link).toEqualTypeOf<\n      LinkComponentRoute<'/invoices/$invoiceId'>\n    >()\n  })\n})\n\ndescribe('createRoute', () => {\n  describe('useNavigate', () => {\n    test('has a static `from`', () => {\n      const navigate = invoiceRoute.useNavigate()\n      expectTypeOf<\n        ExtractDefaultFrom<typeof navigate>\n      >().toEqualTypeOf<'/invoices/$invoiceId'>()\n    })\n  })\n})\n\ndescribe('fullPath type correctness', () => {\n  // Create a layout route (pathless route)\n  const layoutRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '_layout',\n  })\n\n  const layoutChildRoute = createRoute({\n    getParentRoute: () => layoutRoute,\n    path: 'dashboard',\n  })\n\n  const routeTreeWithLayout = rootRoute.addChildren([\n    layoutRoute.addChildren([layoutChildRoute]),\n    indexRoute,\n  ])\n\n  test('index route fullPath should have trailing slash to match runtime', () => {\n    // At runtime, Route.fullPath returns '/invoices/' for an index route\n    // The type should match this behavior\n    const fullPath = invoicesIndexRoute.fullPath\n    expectTypeOf(fullPath).toEqualTypeOf<'/invoices/'>()\n  })\n\n  test('layout route fullPath should be \"/\" not empty string', () => {\n    // At runtime, a pathless layout route has fullPath of '/'\n    // The type should be '/' not ''\n    const fullPath = layoutRoute.fullPath\n    expectTypeOf(fullPath).toEqualTypeOf<'/'>()\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/routeContext.test.tsx",
    "content": "import {\n  act,\n  cleanup,\n  configure,\n  fireEvent,\n  render,\n  screen,\n} from '@testing-library/react'\nimport { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\nimport { z } from 'zod'\n\nimport { useEffect } from 'react'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n} from '../src'\n\nimport { sleep } from './utils'\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  cleanup()\n})\n\nconst WAIT_TIME = 150\n\ndescribe('context function', () => {\n  configure({ reactStrictMode: true })\n\n  describe('context is executed', () => {\n    async function findByText(text: string) {\n      const element = await screen.findByText(text)\n      expect(element).toBeInTheDocument()\n    }\n\n    async function clickButton(name: string) {\n      const button = await screen.findByRole('button', {\n        name,\n      })\n      expect(button).toBeInTheDocument()\n      fireEvent.click(button)\n    }\n\n    test('when the path params change', async () => {\n      const mockContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          const navigate = indexRoute.useNavigate()\n          return (\n            <div>\n              <h1>Index page</h1>\n\n              <button\n                onClick={() =>\n                  navigate({ to: '/detail/$id', params: { id: 1 } })\n                }\n              >\n                detail-1\n              </button>\n            </div>\n          )\n        },\n      })\n      const detailRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/detail/$id',\n        params: {\n          parse: (p) => z.object({ id: z.coerce.number() }).parse(p),\n          stringify: (p) => ({ id: `${p.id}` }),\n        },\n        context: (args) => {\n          mockContextFn(args.params)\n        },\n        component: () => {\n          const id = detailRoute.useParams({ select: (params) => params.id })\n          const navigate = detailRoute.useNavigate()\n          return (\n            <div>\n              <h1>Detail page: {id}</h1>\n              <button\n                onClick={() =>\n                  navigate({\n                    to: '/detail/$id',\n                    params: (p: any) => ({ ...p, id: p.id + 1 }),\n                  })\n                }\n              >\n                next\n              </button>\n            </div>\n          )\n        },\n      })\n\n      const routeTree = rootRoute.addChildren([indexRoute, detailRoute])\n      const router = createRouter({ routeTree, history })\n\n      await act(() => render(<RouterProvider router={router} />))\n\n      await findByText('Index page')\n      expect(mockContextFn).not.toHaveBeenCalled()\n\n      await clickButton('detail-1')\n\n      await findByText('Detail page: 1')\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({ id: 1 })\n      mockContextFn.mockClear()\n      await clickButton('next')\n\n      await findByText('Detail page: 2')\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({ id: 2 })\n      mockContextFn.mockClear()\n      await clickButton('next')\n\n      await findByText('Detail page: 3')\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({ id: 3 })\n      mockContextFn.mockClear()\n    })\n\n    test('when loader deps change', async () => {\n      const mockContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        validateSearch: z.object({\n          foo: z.string().optional(),\n          bar: z.string().optional(),\n        }),\n        path: '/',\n        loaderDeps: ({ search }) => ({ foo: search.foo }),\n        context: ({ deps }) => {\n          mockContextFn(deps)\n        },\n        component: () => {\n          const navigate = indexRoute.useNavigate()\n          return (\n            <div>\n              <h1>Index page</h1>\n              <h2>search: {JSON.stringify(indexRoute.useSearch())}</h2>\n              <button\n                onClick={() => {\n                  navigate({ search: (p: any) => ({ ...p, foo: 'foo-1' }) })\n                }}\n              >\n                foo-1\n              </button>\n              <button\n                onClick={() => {\n                  navigate({ search: (p: any) => ({ ...p, foo: 'foo-2' }) })\n                }}\n              >\n                foo-2\n              </button>\n              <button\n                onClick={() => {\n                  navigate({ search: (p: any) => ({ ...p, bar: 'bar-1' }) })\n                }}\n              >\n                bar-1\n              </button>\n              <button\n                onClick={() => {\n                  navigate({ search: (p: any) => ({ ...p, bar: 'bar-2' }) })\n                }}\n              >\n                bar-2\n              </button>\n              <button\n                onClick={() => {\n                  navigate({ search: {} })\n                }}\n              >\n                clear\n              </button>\n            </div>\n          )\n        },\n      })\n\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history })\n\n      render(<RouterProvider router={router} />)\n\n      await findByText('Index page')\n      await findByText(`search: ${JSON.stringify({})}`)\n\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({})\n      mockContextFn.mockClear()\n\n      await clickButton('foo-1')\n      await findByText(`search: ${JSON.stringify({ foo: 'foo-1' })}`)\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({ foo: 'foo-1' })\n\n      mockContextFn.mockClear()\n      await clickButton('foo-1')\n      await findByText(`search: ${JSON.stringify({ foo: 'foo-1' })}`)\n      expect(mockContextFn).not.toHaveBeenCalled()\n\n      await clickButton('bar-1')\n      await findByText(\n        `search: ${JSON.stringify({ foo: 'foo-1', bar: 'bar-1' })}`,\n      )\n      expect(mockContextFn).not.toHaveBeenCalled()\n\n      await clickButton('foo-2')\n      await findByText(\n        `search: ${JSON.stringify({ foo: 'foo-2', bar: 'bar-1' })}`,\n      )\n      expect(mockContextFn).toHaveBeenCalledWith({ foo: 'foo-2' })\n      mockContextFn.mockClear()\n\n      await clickButton('bar-2')\n      await findByText(\n        `search: ${JSON.stringify({ foo: 'foo-2', bar: 'bar-2' })}`,\n      )\n      expect(mockContextFn).not.toHaveBeenCalled()\n\n      await clickButton('clear')\n      await findByText(`search: ${JSON.stringify({})}`)\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({})\n    })\n  })\n\n  describe('accessing values in the context function', () => {\n    test('receives an empty object', async () => {\n      const mockIndexContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => {\n          mockIndexContextFn(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexContextFn).toHaveBeenCalledWith({})\n    })\n\n    test('receives an empty object - with an empty object when creating the router', async () => {\n      const mockIndexContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => {\n          mockIndexContextFn(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history, context: {} })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexContextFn).toHaveBeenCalledWith({})\n    })\n\n    test('receives valid values - with values added when creating the router', async () => {\n      const mockIndexContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => {\n          mockIndexContextFn(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'Router' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexContextFn).toHaveBeenCalledWith({ project: 'Router' })\n    })\n\n    test('receives valid values when updating the values in the parent route to be read in the child route', async () => {\n      const mockIndexContextFn = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: () => ({\n          project: 'Router',\n        }),\n      })\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => {\n          mockIndexContextFn(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexContextFn).toHaveBeenCalledWith({ project: 'Router' })\n    })\n  })\n\n  describe('routeId in context function', () => {\n    test('receives correct routeId for index route', async () => {\n      const mockContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ routeId }) => {\n          mockContextFn(routeId)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockContextFn).toHaveBeenCalledWith('/')\n    })\n\n    test('receives correct routeId for nested route', async () => {\n      const mockParentContextFn = vi.fn()\n      const mockChildContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const parentRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/parent',\n        context: ({ routeId }) => {\n          mockParentContextFn(routeId)\n        },\n        component: () => (\n          <div>\n            Parent page <Outlet />\n          </div>\n        ),\n      })\n      const childRoute = createRoute({\n        getParentRoute: () => parentRoute,\n        path: '/child',\n        context: ({ routeId }) => {\n          mockChildContextFn(routeId)\n        },\n        component: () => <div>Child page</div>,\n      })\n      const routeTree = rootRoute.addChildren([\n        parentRoute.addChildren([childRoute]),\n      ])\n      const router = createRouter({ routeTree, history })\n\n      await act(() => router.navigate({ to: '/parent/child' }))\n\n      render(<RouterProvider router={router} />)\n\n      const childElement = await screen.findByText('Child page')\n      expect(childElement).toBeInTheDocument()\n\n      expect(mockParentContextFn).toHaveBeenCalledWith('/parent')\n      expect(mockChildContextFn).toHaveBeenCalledWith('/parent/child')\n    })\n\n    test('receives correct routeId for route with dynamic params', async () => {\n      const mockContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const postRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/$postId',\n        context: ({ routeId }) => {\n          mockContextFn(routeId)\n        },\n        component: () => <div>Post page</div>,\n      })\n      const routeTree = rootRoute.addChildren([postRoute])\n      const router = createRouter({ routeTree, history })\n\n      await act(() =>\n        router.navigate({ to: '/posts/$postId', params: { postId: '123' } }),\n      )\n\n      render(<RouterProvider router={router} />)\n\n      const postElement = await screen.findByText('Post page')\n      expect(postElement).toBeInTheDocument()\n\n      expect(mockContextFn).toHaveBeenCalledWith('/posts/$postId')\n    })\n  })\n\n  describe('return values being available in beforeLoad', () => {\n    test('when returning an empty object in a regular route', async () => {\n      const mockIndexBeforeLoad = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: () => ({}),\n        beforeLoad: ({ context }) => {\n          mockIndexBeforeLoad(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexBeforeLoad).toHaveBeenCalledWith({ project: 'foo' })\n      expect(mockIndexBeforeLoad).toHaveBeenCalledTimes(1)\n    })\n\n    test('when updating the initial router context value in a regular route', async () => {\n      const mockIndexBeforeLoad = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => ({ ...context, project: 'Query' }),\n        beforeLoad: ({ context }) => {\n          mockIndexBeforeLoad(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const indexElement = await screen.findByText('Index page')\n      expect(indexElement).toBeInTheDocument()\n\n      expect(mockIndexBeforeLoad).toHaveBeenCalledWith({ project: 'Query' })\n      expect(mockIndexBeforeLoad).toHaveBeenCalledTimes(1)\n    })\n\n    test('when returning an empty object in the root route', async () => {\n      const mock = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: () => ({}),\n        beforeLoad: ({ context }) => {\n          mock(context)\n        },\n        component: () => <div>Root page</div>,\n      })\n      const routeTree = rootRoute.addChildren([])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Root page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mock).toHaveBeenCalledWith({ project: 'foo' })\n      expect(mock).toHaveBeenCalledTimes(1)\n    })\n\n    test('when updating the initial router context value in the parent route and in the child route', async () => {\n      const mockRootBeforeLoad = vi.fn()\n      const mockIndexBeforeLoad = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: ({ context }) => ({ ...context, project: 'Router' }),\n        beforeLoad: ({ context }) => {\n          mockRootBeforeLoad(context)\n        },\n        component: () => (\n          <div>\n            Root page <Outlet />\n          </div>\n        ),\n      })\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => ({ ...context, project: 'Query' }),\n        beforeLoad: ({ context }) => {\n          mockIndexBeforeLoad(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'bar' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const indexElement = await screen.findByText('Index page')\n      expect(indexElement).toBeInTheDocument()\n\n      expect(mockRootBeforeLoad).toHaveBeenCalledWith({ project: 'Router' })\n      expect(mockRootBeforeLoad).toHaveBeenCalledTimes(1)\n\n      expect(mockIndexBeforeLoad).toHaveBeenCalledWith({ project: 'Query' })\n      expect(mockIndexBeforeLoad).toHaveBeenCalledTimes(1)\n    })\n  })\n\n  describe('return values being available in loader', () => {\n    test('when returning an empty object in a regular route', async () => {\n      const mockIndexLoader = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: () => ({}),\n        loader: ({ context }) => {\n          mockIndexLoader(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexLoader).toHaveBeenCalledWith({ project: 'foo' })\n      expect(mockIndexLoader).toHaveBeenCalledTimes(1)\n    })\n\n    test('when updating the initial router context value in a regular route', async () => {\n      const mockIndexLoader = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => ({ ...context, project: 'Query' }),\n        loader: ({ context }) => {\n          mockIndexLoader(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const indexElement = await screen.findByText('Index page')\n      expect(indexElement).toBeInTheDocument()\n\n      expect(mockIndexLoader).toHaveBeenCalledWith({ project: 'Query' })\n      expect(mockIndexLoader).toHaveBeenCalledTimes(1)\n    })\n\n    test('when returning an empty object in the root route', async () => {\n      const mockRootLoader = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: () => ({}),\n        loader: ({ context }) => {\n          mockRootLoader(context)\n        },\n        component: () => <div>Root page</div>,\n      })\n      const routeTree = rootRoute.addChildren([])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Root page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockRootLoader).toHaveBeenCalledWith({ project: 'foo' })\n      expect(mockRootLoader).toHaveBeenCalledTimes(1)\n    })\n\n    test('when updating the initial router context value in the root route and in the child route', async () => {\n      const mockRootLoader = vi.fn()\n      const mockIndexLoader = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: ({ context }) => ({ ...context, project: 'Router' }),\n        loader: ({ context }) => {\n          mockRootLoader(context)\n        },\n        component: () => (\n          <div>\n            Root page <Outlet />\n          </div>\n        ),\n      })\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => ({ ...context, project: 'Query' }),\n        loader: ({ context }) => {\n          mockIndexLoader(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'bar' },\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const indexElement = await screen.findByText('Index page')\n      expect(indexElement).toBeInTheDocument()\n\n      expect(mockRootLoader).toHaveBeenCalledWith({ project: 'Router' })\n      expect(mockRootLoader).toHaveBeenCalledTimes(1)\n\n      expect(mockIndexLoader).toHaveBeenCalledWith({ project: 'Query' })\n      expect(mockIndexLoader).toHaveBeenCalledTimes(1)\n    })\n  })\n})\n\ndescribe('routeId in beforeLoad', () => {\n  configure({ reactStrictMode: true })\n\n  test('receives correct routeId for root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: ({ routeId }) => {\n        mock(routeId)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith('__root__')\n  })\n\n  test('receives correct routeId for index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: ({ routeId }) => {\n        mock(routeId)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith('/')\n  })\n\n  test('receives correct routeId for nested routes', async () => {\n    const mockParent = vi.fn()\n    const mockChild = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const parentRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/parent',\n      beforeLoad: ({ routeId }) => {\n        mockParent(routeId)\n      },\n      component: () => (\n        <div>\n          Parent page <Outlet />\n        </div>\n      ),\n    })\n    const childRoute = createRoute({\n      getParentRoute: () => parentRoute,\n      path: '/child',\n      beforeLoad: ({ routeId }) => {\n        mockChild(routeId)\n      },\n      component: () => <div>Child page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      parentRoute.addChildren([childRoute]),\n    ])\n    const router = createRouter({ routeTree, history })\n\n    await act(() => router.navigate({ to: '/parent/child' }))\n\n    render(<RouterProvider router={router} />)\n\n    const childElement = await screen.findByText('Child page')\n    expect(childElement).toBeInTheDocument()\n\n    expect(mockParent).toHaveBeenCalledWith('/parent')\n    expect(mockChild).toHaveBeenCalledWith('/parent/child')\n  })\n\n  test('receives correct routeId for route with dynamic params', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/$postId',\n      beforeLoad: ({ routeId }) => {\n        mock(routeId)\n      },\n      component: () => <div>Post page</div>,\n    })\n    const routeTree = rootRoute.addChildren([postRoute])\n    const router = createRouter({ routeTree, history })\n\n    await act(() =>\n      router.navigate({ to: '/posts/$postId', params: { postId: '123' } }),\n    )\n\n    render(<RouterProvider router={router} />)\n\n    const postElement = await screen.findByText('Post page')\n    expect(postElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith('/posts/$postId')\n  })\n\n  test('receives correct routeId for layout route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: ({ routeId }) => {\n        mock(routeId)\n      },\n      component: () => (\n        <div>\n          Layout <Outlet />\n        </div>\n      ),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/',\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([indexRoute]),\n    ])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith('/_layout')\n  })\n})\n\ndescribe('beforeLoad in the route definition', () => {\n  configure({ reactStrictMode: true })\n\n  // Present at the root route\n  test('route context, present in the root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: ({ context }) => {\n        mock(context)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('route context (sleep), present in the root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Present at the index route\n  test('route context, present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: ({ context }) => {\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('route context (sleep), present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context that is updated at the root, is the same in the index route\n  test('modified route context, present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return {\n          ...context,\n          foo: 'sean',\n        }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'sean' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context the context is available after a redirect on first-load\n  test('on first-load, route context is present in the /about route after a redirect is thrown in the beforeLoad of the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n    expect(router.state.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('on first-load, route context is present in the /about route after a redirect is thrown in the loader of the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n    expect(router.state.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context the context is available after a redirect on navigate\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the beforeLoad of the /about route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/person')\n    expect(router.state.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the loader of the /about route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/person')\n    expect(router.state.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by /nested/about, is the same as its parent route /nested on navigate\n  test('nested destination on navigate, route context in the /nested/about route is correctly inherited from the /nested parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/nested/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/about',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/about')\n    expect(window.location.pathname).toBe('/nested/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by /nested/person route, is the same as its parent route /nested on navigate after a redirect /about\n  test('nested destination on navigate, when a redirect is thrown in beforeLoad in /about, the /nested/person route context is correctly inherited from its parent /nested', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('nested destination on navigate, when a redirect is thrown in loader in /about, the /nested/person route context is correctly inherited from parent /nested', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (index route) on first-load\n  test('_layout on first-load, route context in the index route is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([indexRoute]),\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on navigate\n  test('_layout on navigate, route context in the /about route is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/about',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on after a redirect on navigate\n  test('_layout on navigate, when a redirect is thrown in beforeLoad in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('_layout on navigate, when a redirect is thrown in loader in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('child route receives updated values after the values were previously returned by the child route and then updated by the parent route', async () => {\n    const mockIndexBeforeLoadFn = vi.fn()\n    let counter = 0\n\n    const rootRoute = createRootRoute({\n      beforeLoad: () => {\n        counter++\n        return {\n          counter,\n        }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: ({ context }) => {\n        mockIndexBeforeLoadFn(context)\n        return {\n          counter: context.counter,\n        }\n      },\n      component: () => {\n        const { counter } = indexRoute.useRouteContext()\n        return (\n          <div>\n            <span data-testid=\"index-page\">Index page</span>\n            <span data-testid=\"counter\">{counter}</span>\n          </div>\n        )\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    const rootElement = await screen.findByTestId('index-page')\n    expect(rootElement).toBeInTheDocument()\n\n    async function check(expectedCounter: number) {\n      const counterElement = await screen.findByTestId('counter')\n      expect(counterElement).toHaveTextContent(`${expectedCounter}`)\n\n      expect(mockIndexBeforeLoadFn).toHaveBeenCalledWith({\n        counter: expectedCounter,\n      })\n    }\n\n    await check(1)\n    await act(async () => await router.invalidate())\n    await check(2)\n  })\n})\n\ndescribe('loader in the route definition', () => {\n  configure({ reactStrictMode: true })\n\n  // Present at the root route\n  test('route context, present in the root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      loader: ({ context }) => {\n        mock(context)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('route context (sleep), present in the root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Present at the index route\n  test('route context, present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: ({ context }) => {\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('route context (sleep), present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context that is updated at the root, is the same in the index route\n  test('modified route context, present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return {\n          ...context,\n          foo: 'sean',\n        }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'sean' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // disabled test due to flakiness\n  test.skip(\"on navigate (with preload using router methods), loader isn't invoked with undefined context if beforeLoad is pending when navigation happens\", async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n    const aboutRoute = createRoute({\n      ssr: false,\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        return { mock }\n      },\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        expect(context.mock).toBe(mock)\n        context.mock()\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({\n      routeTree,\n      history,\n      context: { foo: 'bar' },\n    })\n\n    await router.load()\n\n    // Don't await, simulate user clicking before preload is done\n    router.preloadRoute(aboutRoute)\n\n    await router.navigate(aboutRoute)\n    await router.invalidate()\n\n    // Expect only a single call as the one from preload and the one from navigate are deduped\n    expect(mock).toHaveBeenCalledOnce()\n  })\n\n  test(\"on navigate (with preload), loader isn't invoked with undefined context if beforeLoad is pending when navigation happens\", async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\" preload=\"intent\">\n              link to about\n            </Link>\n          </div>\n        )\n      },\n    })\n\n    const aboutRoute = createRoute({\n      ssr: false,\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        return { mock }\n      },\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        expect(context.mock).toBe(mock)\n        context.mock()\n      },\n      component: () => <div>About page</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({\n      routeTree,\n      history,\n      defaultPreload: 'intent',\n      context: { foo: 'bar' },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n\n    // Don't await, simulate user clicking before preload is done\n    fireEvent.focus(linkToAbout)\n    fireEvent.click(linkToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n\n    // Expect only a single call as the one from preload and the one from navigate are deduped\n    expect(mock).toHaveBeenCalledOnce()\n  })\n\n  // Check if context the context is available after a redirect on first-load\n  test('on first-load, route context is present in the /about route after a redirect is thrown in beforeLoad of the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n    expect(router.state.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('on first-load, route context is present in the /about route after a redirect is thrown in loader of the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n    expect(router.state.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context the context is available after a redirect on navigate\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the beforeLoad of the /about route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/person')\n    expect(router.state.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the loader of the /about route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/person')\n    expect(router.state.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a /nested/about, is the same as its parent route /nested on navigate\n  test('nested destination on navigate, route context in the /nested/about route is correctly inherited from the /nested parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/nested/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/about',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/about')\n    expect(window.location.pathname).toBe('/nested/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a /nested/person route, is the same as its parent route /nested on navigate after a redirect /about\n  test('nested destination on navigate, when a redirect is thrown in beforeLoad in /about, the /nested/person route context is correctly inherited from its parent /nested', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('nested destination on navigate, when a redirect is thrown in loader in /about, the /nested/person route context is correctly inherited from parent /nested', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (index route) on first-load\n  test('_layout on first-load, route context in the index route is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([indexRoute]),\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on navigate\n  test('_layout on navigate, route context in the /about route is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/about',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on after a redirect on navigate\n  test('_layout on navigate, when a redirect is thrown in beforeLoad in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('_layout on navigate, when a redirect is thrown in loader in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n})\n\ndescribe('useRouteContext in the component', () => {\n  configure({ reactStrictMode: true })\n\n  // Present at the root route\n  test('route context, present in the root route', async () => {\n    const rootRoute = createRootRoute({\n      component: () => {\n        const context = rootRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('route context (sleep in beforeLoad), present in the root route', async () => {\n    const rootRoute = createRootRoute({\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n      },\n      component: () => {\n        const context = rootRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('route context (sleep in loader), present root route', async () => {\n    const rootRoute = createRootRoute({\n      loader: async () => {\n        await sleep(WAIT_TIME)\n      },\n      component: () => {\n        const context = rootRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Present at the index route\n  test('route context, present in the index route', async () => {\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const context = indexRoute.useRouteContext()\n\n        if (context === undefined) {\n          throw new Error('context is undefined')\n        }\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('route context (sleep in beforeLoad), present in the index route', async () => {\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n      },\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('route context, (sleep in beforeLoad), with immediate navigation', async () => {\n    const contextValues: Array<{ data: string }> = []\n\n    const rootRoute = createRootRoute({\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        return { data: 'context-from-beforeLoad' }\n      },\n      component: () => {\n        const context: { data: string } = rootRoute.useRouteContext()\n\n        // Track all context values we receive\n        contextValues.push(context)\n\n        return <Outlet />\n      },\n    })\n\n    function Component() {\n      const navigate = indexRoute.useNavigate()\n\n      // Navigate away immediately on mount\n      useEffect(() => {\n        navigate({ to: '/other' })\n      }, [navigate])\n\n      return <div>Index page</div>\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: Component,\n    })\n\n    const otherRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/other',\n      component: () => <div>Other page</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, otherRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    // Wait for navigation to complete\n    await screen.findByText('Other page')\n\n    const allContextsValid = contextValues.every(\n      (c) => c.data === 'context-from-beforeLoad',\n    )\n    expect(allContextsValid).toBe(true)\n  })\n\n  test('route context (sleep in loader), present in the index route', async () => {\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n      },\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context that is updated at the root, is the same in the root route\n  test('modified route context, present in the root route', async () => {\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return {\n          ...context,\n          foo: 'sean',\n        }\n      },\n      component: () => {\n        const context = rootRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'sean' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if the context that is updated at the root, is the same in the index route\n  test('modified route context, present in the index route', async () => {\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return {\n          ...context,\n          foo: 'sean',\n        }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'sean' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if the context that is available after a redirect on first-load\n  test('on first-load, route context is present in the /about route after a redirect is thrown in the beforeLoad of the index route', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => {\n        const context = aboutRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('on first-load, route context is present in the /about route after a redirect is thrown in the loader of the index route', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => {\n        const context = aboutRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if the context that is available after a redirect on navigate\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the beforeLoad of the /about route', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n    expect(content).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n  })\n\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the loader of the /about route', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n    expect(content).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n  })\n\n  // Check if context returned by /nested/about, is the same its parent /nested on navigate\n  test('nested destination on navigate, route context in the /nested/about route is correctly inherited from its parent /nested', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/nested/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n      component: () => <Outlet />,\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/about',\n      component: () => {\n        const context = aboutRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'nested' }),\n    )\n\n    expect(router.state.location.href).toBe('/nested/about')\n    expect(window.location.pathname).toBe('/nested/about')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on after a redirect on navigate\n  test('nested destination on navigate, when a redirect is thrown in beforeLoad in /about, the /nested/person route context is correctly inherited from its parent /nested', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n      component: () => <Outlet />,\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'nested' }),\n    )\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('nested destination on navigate, when a redirect is thrown in loader in /about, the /nested/person route context is correctly inherited from its parent /nested', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n      component: () => <Outlet />,\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'nested' }),\n    )\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context returned by a layout route, is the same its child route (index route) on first-load\n  test('_layout on first-load, route context in the index route is correctly inherited from the layout parent', async () => {\n    const rootRoute = createRootRoute()\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n      component: () => <Outlet />,\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/',\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([indexRoute]),\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'layout' }),\n    )\n\n    expect(router.state.location.href).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on navigate\n  test('_layout on navigate, route context in the /about route is correctly inherited from the layout parent', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n      component: () => <Outlet />,\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/about',\n      component: () => {\n        const context = aboutRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'layout' }),\n    )\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on after a redirect on navigate\n  test('_layout on navigate, when a redirect is thrown in beforeLoad in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n      component: () => <Outlet />,\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'layout' }),\n    )\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('_layout on navigate, when a redirect is thrown in loader in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n      component: () => <Outlet />,\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context)}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(<RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'layout' }),\n    )\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(content).toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/router.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  createMemoryHistory,\n  createRootRoute,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { RouterHistory } from '../src'\n\ntest('when creating a router without context', () => {\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const rootRoute = createRootRoute()\n\n  type RouteTree = typeof rootRoute\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .toHaveProperty('routeTree')\n    .toEqualTypeOf<RouteTree | undefined>()\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .toHaveProperty('context')\n    .toEqualTypeOf<{} | undefined>()\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .not.toMatchTypeOf<{\n      context: {}\n    }>()\n})\n\ntest('when navigating using router', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    validateSearch: () => ({\n      page: 0,\n    }),\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, postsRoute])\n\n  const router = createRouter({\n    routeTree,\n  })\n\n  expectTypeOf(router.navigate<typeof router, '/posts'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'/posts' | '/' | '.' | '..'>()\n\n  expectTypeOf(router.navigate<typeof router, '/posts'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: Array<any>) => any>()\n    .toEqualTypeOf<{ page: number }>()\n})\n\ntest('when building location using router', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    validateSearch: () => ({\n      page: 0,\n    }),\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, postsRoute])\n\n  const router = createRouter({\n    routeTree,\n  })\n\n  expectTypeOf(router.buildLocation<typeof router, '/posts'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'/posts' | '/' | '.' | '..'>()\n\n  expectTypeOf(router.buildLocation<typeof router, '/posts'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: Array<any>) => any>()\n    .toEqualTypeOf<{ page: number }>()\n})\n\ntest('when creating a router with context', () => {\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  type RouteTree = typeof rootRoute\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .toHaveProperty('routeTree')\n    .toEqualTypeOf<RouteTree | undefined>()\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .toHaveProperty('context')\n    .toEqualTypeOf<{ userId: string }>()\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .toMatchTypeOf<{\n      context: { userId: string }\n    }>()\n})\n\ntest('when creating a router with context and children', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const routeTree = rootRoute.addChildren([indexRoute])\n\n  type RouteTree = typeof routeTree\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .toHaveProperty('routeTree')\n    .toEqualTypeOf<RouteTree | undefined>()\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .toHaveProperty('context')\n    .toEqualTypeOf<{ userId: string }>()\n\n  expectTypeOf(createRouter<RouteTree, 'never', boolean>)\n    .parameter(0)\n    .toMatchTypeOf<{\n      context: { userId: string }\n    }>()\n})\n\ntest('invalidate and clearCache narrowing in filter', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    beforeLoad: () => ({ invoicePermissions: ['view'] as const }),\n  })\n\n  const invoiceRoute = createRoute({\n    path: '$invoiceId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoiceRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n    beforeLoad: () => ({ detailsPermissions: ['view'] as const }),\n  })\n\n  const detailRoute = createRoute({\n    path: '$detailId',\n    getParentRoute: () => detailsRoute,\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([\n      invoiceRoute.addChildren([detailsRoute.addChildren([detailRoute])]),\n    ]),\n  ])\n\n  const router = createRouter({\n    routeTree,\n    context: { userId: 'userId' },\n  })\n\n  type Router = typeof router\n\n  router.invalidate({\n    filter: (route) => {\n      expectTypeOf(route.routeId).toEqualTypeOf<\n        | '__root__'\n        | '/invoices'\n        | '/invoices/$invoiceId'\n        | '/invoices/$invoiceId/details'\n        | '/invoices/$invoiceId/details/$detailId'\n      >()\n\n      if (route.routeId === '/invoices/$invoiceId/details/$detailId') {\n        expectTypeOf(route.params).branded.toEqualTypeOf<{\n          invoiceId: string\n          detailId: string\n        }>()\n      }\n      return true\n    },\n  })\n\n  router.clearCache({\n    filter: (route) => {\n      expectTypeOf(route.routeId).toEqualTypeOf<\n        | '__root__'\n        | '/invoices'\n        | '/invoices/$invoiceId'\n        | '/invoices/$invoiceId/details'\n        | '/invoices/$invoiceId/details/$detailId'\n      >()\n\n      if (route.routeId === '/invoices/$invoiceId/details/$detailId') {\n        expectTypeOf(route.params).branded.toEqualTypeOf<{\n          invoiceId: string\n          detailId: string\n        }>()\n      }\n      return true\n    },\n  })\n})\n\ntest('when creating a router with default router history', () => {\n  const router = createRouter({ routeTree: createRootRoute() })\n\n  expectTypeOf(router.history).toEqualTypeOf<RouterHistory>()\n})\n\ntest('when creating a router with custom router history', () => {\n  const customRouterHistory = {\n    ...createMemoryHistory(),\n    _isCustomRouterHistory: true,\n  }\n\n  const router = createRouter({\n    routeTree: createRootRoute(),\n    history: customRouterHistory,\n  })\n\n  expectTypeOf(router.history).toMatchTypeOf<RouterHistory>()\n  expectTypeOf(router.history).toEqualTypeOf<typeof customRouterHistory>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/router.test.tsx",
    "content": "import { act, useEffect, useRef } from 'react'\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\nimport {\n  cleanup,\n  fireEvent,\n  render,\n  screen,\n  waitFor,\n} from '@testing-library/react'\nimport { z } from 'zod'\nimport { composeRewrites, notFound } from '@tanstack/router-core'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  SearchParamError,\n  createBrowserHistory,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useNavigate,\n} from '../src'\nimport type { StandardSchemaValidator } from '@tanstack/router-core'\nimport type {\n  AnyRoute,\n  AnyRouter,\n  MakeRemountDepsOptionsUnion,\n  RouterHistory,\n  RouterOptions,\n  ValidatorFn,\n  ValidatorObj,\n} from '../src'\n\nlet history: RouterHistory\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  cleanup()\n})\n\nconst mockFn1 = vi.fn()\n\nconst URISyntaxCharacters = [\n  [';', '%3B'],\n  [',', '%2C'],\n  ['/', '%2F'],\n  ['?', '%3F'],\n  [':', '%3A'],\n  ['@', '%40'],\n  ['&', '%26'],\n  ['=', '%3D'],\n  ['+', '%2B'],\n  ['$', '%24'],\n  ['#', '%23'],\n  ['\\\\', '%5C'],\n  ['%', '%25'],\n] as const\n\nexport function validateSearchParams<\n  TExpected extends Partial<Record<string, string>>,\n>(expected: TExpected, router: AnyRouter) {\n  const parsedSearch = new URLSearchParams(window.location.search)\n  expect(parsedSearch.size).toBe(Object.keys(expected).length)\n  for (const [key, value] of Object.entries(expected)) {\n    expect(parsedSearch.get(key)).toBe(value)\n  }\n  expect(router.state.location.search).toEqual(expected)\n}\n\nfunction createTestRouter(\n  options: RouterOptions<AnyRoute, 'never', any, any, any> &\n    Required<Pick<RouterOptions<AnyRoute, 'never'>, 'history'>>,\n) {\n  const rootRoute = createRootRoute({\n    validateSearch: z.object({ root: z.string().optional() }),\n    component: () => {\n      const search = rootRoute.useSearch()\n      return (\n        <>\n          <div data-testid=\"search-root\">{search.root ?? '$undefined'}</div>\n          <Outlet />\n        </>\n      )\n    },\n  })\n  const indexRoute = createRoute({ getParentRoute: () => rootRoute, path: '/' })\n  const usersRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/users',\n  })\n  const userRoute = createRoute({\n    getParentRoute: () => usersRoute,\n    path: '/$userId',\n  })\n  const userFilesRoute = createRoute({\n    getParentRoute: () => userRoute,\n    path: '/files/$fileId',\n  })\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n  })\n  const postIdRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '/$slug',\n  })\n  const topLevelSplatRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '$',\n  })\n  // This is simulates a user creating a `é.tsx` file using file-based routing\n  const pathSegmentEAccentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/path-segment/é',\n  })\n  // This is simulates a user creating a `🚀.tsx` file using file-based routing\n  const pathSegmentRocketEmojiRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/path-segment/🚀',\n  })\n  const pathSegmentSoloSplatRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/solo-splat/$',\n  })\n  const pathSegmentLayoutSplatRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/layout-splat',\n  })\n  const pathSegmentLayoutSplatIndexRoute = createRoute({\n    getParentRoute: () => pathSegmentLayoutSplatRoute,\n    path: '/',\n  })\n  const pathSegmentLayoutSplatSplatRoute = createRoute({\n    getParentRoute: () => pathSegmentLayoutSplatRoute,\n    path: '$',\n  })\n  const protectedRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '/_protected',\n  }).lazy(() => import('./lazy/normal').then((f) => f.Route('/_protected')))\n  const protectedLayoutRoute = createRoute({\n    getParentRoute: () => protectedRoute,\n    id: '/_layout',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) => f.Route('/_protected/_layout')),\n  )\n  const protectedFileBasedLayoutRoute = createRoute({\n    getParentRoute: () => protectedRoute,\n    id: '/_fileBasedLayout',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) =>\n      f.FileRoute('/_protected/_fileBasedLayout'),\n    ),\n  )\n  const protectedFileBasedLayoutParentRoute = createRoute({\n    getParentRoute: () => protectedFileBasedLayoutRoute,\n    path: '/fileBasedParent',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) =>\n      f.FileRoute('/_protected/_fileBasedLayout/fileBasedParent'),\n    ),\n  )\n  const protectedLayoutParentRoute = createRoute({\n    getParentRoute: () => protectedLayoutRoute,\n    path: '/parent',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) => f.Route('/_protected/_layout/parent')),\n  )\n  const protectedLayoutParentChildRoute = createRoute({\n    getParentRoute: () => protectedLayoutParentRoute,\n    path: '/child',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) =>\n      f.Route('/_protected/_layout/parent/child'),\n    ),\n  )\n  const protectedFileBasedLayoutParentChildRoute = createRoute({\n    getParentRoute: () => protectedFileBasedLayoutParentRoute,\n    path: '/child',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) =>\n      f.FileRoute('/_protected/_fileBasedLayout/fileBasedParent/child'),\n    ),\n  )\n  const searchRoute = createRoute({\n    validateSearch: z.object({ search: z.string().optional() }),\n    getParentRoute: () => rootRoute,\n    path: 'search',\n    component: () => {\n      const search = searchRoute.useSearch()\n      return (\n        <>\n          <div data-testid=\"search-search\">{search.search ?? '$undefined'}</div>\n        </>\n      )\n    },\n  })\n  const searchWithDefaultRoute = createRoute({\n    getParentRoute: () => rootRoute,\n\n    path: 'searchWithDefault',\n  })\n  const searchWithDefaultIndexRoute = createRoute({\n    getParentRoute: () => searchWithDefaultRoute,\n    path: '/',\n    component: () => {\n      return (\n        <>\n          <Link\n            data-testid=\"link-without-params\"\n            to=\"/searchWithDefault/check\"\n            search={{ default: 'd1' }}\n          >\n            without params\n          </Link>\n          <Link\n            data-testid=\"link-with-optional-param\"\n            to=\"/searchWithDefault/check\"\n            search={{ optional: 'o1' }}\n          >\n            with optional param\n          </Link>\n          <Link\n            data-testid=\"link-with-default-param\"\n            to=\"/searchWithDefault/check\"\n            search={{ default: 'd2' }}\n          >\n            with default param\n          </Link>\n          <Link\n            data-testid=\"link-with-both-params\"\n            to=\"/searchWithDefault/check\"\n            search={{ optional: 'o1', default: 'd2' }}\n          >\n            with both params\n          </Link>\n        </>\n      )\n    },\n  })\n\n  const searchWithDefaultCheckRoute = createRoute({\n    validateSearch: z.object({\n      default: z.string().default('d1'),\n      optional: z.string().optional(),\n    }),\n    getParentRoute: () => searchWithDefaultRoute,\n    path: 'check',\n    component: () => {\n      const search = searchWithDefaultCheckRoute.useSearch()\n      return (\n        <>\n          <div data-testid=\"search-default\">{search.default}</div>\n          <div data-testid=\"search-optional\">\n            {search.optional ?? '$undefined'}\n          </div>\n        </>\n      )\n    },\n  })\n\n  const nestedSearchRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    validateSearch: z.object({ foo: z.string() }),\n    path: 'nested-search',\n  })\n\n  const nestedSearchChildRoute = createRoute({\n    getParentRoute: () => nestedSearchRoute,\n    validateSearch: z.object({ bar: z.string() }),\n    path: 'child',\n  })\n\n  const linksToItselfRoute = createRoute({\n    validateSearch: z.object({ search: z.string().optional() }),\n    getParentRoute: () => rootRoute,\n    path: 'linksToItself',\n    component: () => {\n      return (\n        <>\n          <Link to=\"/linksToItself\" data-testid=\"link\">\n            Click me\n          </Link>\n        </>\n      )\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([\n    indexRoute,\n    usersRoute.addChildren([userRoute.addChildren([userFilesRoute])]),\n    postsRoute.addChildren([postIdRoute]),\n    pathSegmentEAccentRoute,\n    pathSegmentRocketEmojiRoute,\n    pathSegmentSoloSplatRoute,\n    topLevelSplatRoute,\n    pathSegmentLayoutSplatRoute.addChildren([\n      pathSegmentLayoutSplatIndexRoute,\n      pathSegmentLayoutSplatSplatRoute,\n    ]),\n    protectedRoute.addChildren([\n      protectedLayoutRoute.addChildren([\n        protectedLayoutParentRoute.addChildren([\n          protectedLayoutParentChildRoute,\n        ]),\n      ]),\n      protectedFileBasedLayoutRoute.addChildren([\n        protectedFileBasedLayoutParentRoute.addChildren([\n          protectedFileBasedLayoutParentChildRoute,\n        ]),\n      ]),\n    ]),\n    searchRoute,\n    searchWithDefaultRoute.addChildren([\n      searchWithDefaultIndexRoute,\n      searchWithDefaultCheckRoute,\n    ]),\n    nestedSearchRoute.addChildren([nestedSearchChildRoute]),\n    linksToItselfRoute,\n  ])\n\n  const router = createRouter({ routeTree, ...options })\n\n  return {\n    router,\n    routes: {\n      indexRoute,\n      postsRoute,\n      postIdRoute,\n      topLevelSplatRoute,\n      pathSegmentEAccentRoute,\n      pathSegmentRocketEmojiRoute,\n    },\n  }\n}\n\ndescribe('encoding: path params', () => {\n  it('no decoding/encoding of path, url and href required', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    })\n\n    await act(() => router.load())\n\n    expect(router.state.location.href.endsWith('/posts/tanner')).toBe(true)\n    expect(router.state.location.href).toBe('/posts/tanner')\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n  })\n\n  it('should encode the url and href with unicode param', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/🚀'] }),\n    })\n\n    await act(() => router.load())\n\n    expect(router.state.location.href.endsWith('/posts/%F0%9F%9A%80')).toBe(\n      true,\n    )\n    expect(router.state.location.href).toBe('/posts/%F0%9F%9A%80')\n    expect(router.state.location.pathname).toBe('/posts/🚀')\n  })\n\n  // the param that is passed in should be the param that is returned\n  it('should treat encoded params as decoded value when encoded params is specified', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    await act(() => router.load())\n    await act(() =>\n      router.navigate({\n        to: '/posts/$slug',\n        params: { slug: '100%25' },\n      }),\n    )\n\n    expect(router.state.location.href.endsWith('/posts/100%2525')).toBe(true)\n    expect(router.state.location.href).toBe('/posts/100%2525')\n    expect(router.state.location.pathname).toBe('/posts/100%2525')\n  })\n\n  describe('pathname and URI syntax characters', () => {\n    it.each(URISyntaxCharacters)(\n      'pathname should encode $0',\n      async (character, encodedValue) => {\n        const { router } = createTestRouter({\n          history: createMemoryHistory({\n            initialEntries: [`/`],\n          }),\n        })\n\n        await act(() => router.load())\n\n        await act(() =>\n          router.navigate({\n            to: '/posts/$slug',\n            params: { slug: `${character}jane%` },\n          }),\n        )\n\n        expect(\n          router.state.location.href.endsWith(`/posts/${encodedValue}jane%25`),\n        ).toBe(true)\n        expect(router.state.location.href).toBe(`/posts/${encodedValue}jane%25`)\n        expect(router.state.location.pathname).toBe(\n          `/posts/${encodedValue}jane%25`,\n        )\n      },\n    )\n\n    it.each(\n      URISyntaxCharacters.filter((c) => {\n        const character = c[0]\n\n        const strictlyNotAllowedCharacters = ['/', '?', '\\\\', '%', '#']\n\n        return !strictlyNotAllowedCharacters.includes(character)\n      }),\n    )('pathname should not encode $0 when allowed', async (character, _) => {\n      const { router } = createTestRouter({\n        history: createMemoryHistory({\n          initialEntries: [`/`],\n        }),\n        pathParamsAllowedCharacters: [character] as any,\n      })\n\n      await act(() => router.load())\n\n      await act(() =>\n        router.navigate({\n          to: '/posts/$slug',\n          params: { slug: `${character}jane%` },\n        }),\n      )\n\n      expect(\n        router.state.location.href.endsWith(`/posts/${character}jane%25`),\n      ).toBe(true)\n      expect(router.state.location.href).toBe(`/posts/${character}jane%25`)\n      expect(router.state.location.pathname).toBe(`/posts/${character}jane%25`)\n    })\n  })\n\n  it('pathname should decode encoded unicode param', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/%F0%9F%9A%80'] }),\n    })\n\n    await act(() => router.load())\n\n    expect(router.state.location.href.endsWith('/posts/%F0%9F%9A%80')).toBe(\n      true,\n    )\n    expect(router.state.location.href).toBe('/posts/%F0%9F%9A%80')\n    expect(router.state.location.pathname).toBe('/posts/🚀')\n  })\n\n  it('pathname params should decode combination of encoded characters', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: [\n          '/posts/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n        ],\n      }),\n    })\n\n    await act(() => router.load())\n\n    expect(\n      router.state.location.href.endsWith(\n        '/posts/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n      ),\n    ).toBe(true)\n    expect(router.state.location.href).toBe(\n      '/posts/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n    )\n    expect(router.state.location.pathname).toBe(\n      '/posts/framework%2Freact%2Fguide%2Ffile-based-routing tanstack',\n    )\n  })\n\n  it('path params no encoding/decoding required', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    })\n\n    await act(() => router.load())\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('tanner')\n  })\n\n  it('path params should keep unicode characters', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/🚀'] }),\n    })\n\n    await act(() => router.load())\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('🚀')\n  })\n\n  it('path params should decode encoded unicode characters', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/%F0%9F%9A%80'] }),\n    })\n\n    await act(() => router.load())\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('🚀')\n  })\n\n  // the param that is passed in should be the param that is returned\n  it('path params should not decode encoded characters when passed as param', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    await act(() => router.load())\n\n    await act(() =>\n      router.navigate({ to: '/posts/$slug', params: { slug: '100%25' } }),\n    )\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('100%25')\n  })\n\n  describe('path params should decode encoded URI syntax characters', () => {\n    it.each(URISyntaxCharacters)(\n      '$1 => $0 - should be decoded',\n      async (character, encodedValue) => {\n        const { router, routes } = createTestRouter({\n          history: createMemoryHistory({\n            initialEntries: [`/posts/100${encodedValue}100`],\n          }),\n        })\n\n        await act(() => router.load())\n\n        const match = router.state.matches.find(\n          (r) => r.routeId === routes.postIdRoute.id,\n        )\n\n        if (!match) {\n          throw new Error('No match found')\n        }\n\n        expect((match.params as unknown as any).slug).toBe(`100${character}100`)\n      },\n    )\n  })\n\n  it('path params should decode combination of encoded characters', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: [\n          '/posts/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n        ],\n      }),\n    })\n\n    await act(() => router.load())\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe(\n      'framework/react/guide/file-based-routing tanstack',\n    )\n  })\n})\n\ndescribe('encoding/decoding: wildcard routes/params', () => {\n  it('no decoding/encoding of path, url and href required', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/tanner'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href.endsWith('/tanner')).toBe(true)\n    expect(router.state.location.href).toBe('/tanner')\n    expect(router.state.location.pathname).toBe('/tanner')\n  })\n\n  it('should encode the url and href with unicode param', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/🚀'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href.endsWith('/%F0%9F%9A%80')).toBe(true)\n    expect(router.state.location.href).toBe('/%F0%9F%9A%80')\n    expect(router.state.location.pathname).toBe('/🚀')\n  })\n\n  describe('pathname and URI syntax characters', () => {\n    it.each(URISyntaxCharacters)(\n      '$1 should not be decoded for pathname',\n      async (character, encodedValue) => {\n        const { router } = createTestRouter({\n          history: createMemoryHistory({\n            initialEntries: [`/100${encodedValue}100`],\n          }),\n        })\n\n        await router.load()\n\n        expect(\n          router.state.location.href.endsWith(`/100${encodedValue}100`),\n        ).toBe(true)\n        expect(router.state.location.href).toBe(`/100${encodedValue}100`)\n        expect(router.state.location.pathname).toBe(`/100${encodedValue}100`)\n      },\n    )\n  })\n\n  it('pathname should decode encoded unicode path', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/%F0%9F%9A%80'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href.endsWith('/%F0%9F%9A%80')).toBe(true)\n    expect(router.state.location.href).toBe('/%F0%9F%9A%80')\n    expect(router.state.location.pathname).toBe('/🚀')\n  })\n\n  it('decode only non URI syntax characters in path', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: [\n          '/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n        ],\n      }),\n    })\n\n    await router.load()\n\n    expect(\n      router.state.location.href.endsWith(\n        '/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n      ),\n    ).toBe(true)\n    expect(router.state.location.href).toBe(\n      '/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n    )\n    expect(router.state.location.pathname).toBe(\n      '/framework%2Freact%2Fguide%2Ffile-based-routing tanstack',\n    )\n  })\n\n  it('\"/\" should not be encoded in splat param paths', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/framework/react/guide/file-based-routing tanstack'],\n      }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href).toBe(\n      '/framework/react/guide/file-based-routing%20tanstack',\n    )\n\n    expect(router.state.location.pathname).toBe(\n      '/framework/react/guide/file-based-routing tanstack',\n    )\n  })\n\n  it('no encoding/decoding of param required', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/tanner'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.topLevelSplatRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any)._splat).toBe('tanner')\n  })\n\n  it('param should keep decoded unicode param', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/🚀'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.topLevelSplatRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any)._splat).toBe('🚀')\n  })\n\n  it('param should be decoded for encoded unicode param', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/%F0%9F%9A%80'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.topLevelSplatRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any)._splat).toBe('🚀')\n  })\n\n  it('\"/\" should not be encoded in splat params', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/framework/react/guide/file-based-routing tanstack'],\n      }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.topLevelSplatRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any)._splat).toBe(\n      'framework/react/guide/file-based-routing tanstack',\n    )\n  })\n})\n\ndescribe('encoding/decoding: URL path segment', () => {\n  it.each([\n    {\n      test: 'should decode the pathname',\n      input: '/path-segment/%C3%A9',\n      path: '/path-segment/é',\n      url: '/path-segment/%C3%A9',\n    },\n    {\n      test: 'should not decode excluded characters',\n      input: '/path-segment/100%25', // `%25` = `%`\n      path: '/path-segment/100%25',\n      url: '/path-segment/100%25',\n    },\n    {\n      test: 'should not decode multiple excluded characters',\n      input: '/path-segment/100%25%25',\n      path: '/path-segment/100%25%25',\n      url: '/path-segment/100%25%25',\n    },\n    {\n      test: 'should not decode characters that are part of the URI syntax',\n      input: '/path-segment/100%26', // `%26` = `&`\n      path: '/path-segment/100%26',\n      url: '/path-segment/100%26',\n    },\n    {\n      test: 'should decode unicode characters',\n      input: '/path-segment/%F0%9F%9A%80',\n      path: '/path-segment/🚀',\n      url: '/path-segment/%F0%9F%9A%80',\n    },\n    {\n      test: 'should encode unicode characters in the url and href',\n      input: '/path-segment/🚀é',\n      path: '/path-segment/🚀é',\n      url: '/path-segment/%F0%9F%9A%80%C3%A9',\n    },\n    {\n      test: 'should encode unicode characters in the url and href and maintain already encoded characters',\n      input: '/path-segment/🚀to%2Fthe%2Fmoon',\n      path: '/path-segment/🚀to%2Fthe%2Fmoon',\n      url: '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon',\n    },\n    {\n      test: 'should decode/encode combination of excluded, URI syntax and unicode characters correctly in the path, url and href',\n      input:\n        '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon%25%F0%9F%9A%80to%2Fthe%2Fmoon%25',\n      path: '/path-segment/🚀to%2Fthe%2Fmoon%25🚀to%2Fthe%2Fmoon%25',\n      url: '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon%25%F0%9F%9A%80to%2Fthe%2Fmoon%25',\n    },\n  ])('$test', async ({ input, path, url }) => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: [input] }),\n    })\n\n    render(<RouterProvider router={router} />)\n    await act(() => router.load())\n\n    expect(router.state.location.pathname).toBe(path)\n    expect(router.state.location.href).toBe(url)\n  })\n})\n\ndescribe('router emits events during rendering', () => {\n  it('during initial load, should emit the \"onResolved\" event', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const unsub = router.subscribe('onResolved', mockFn1)\n    await router.load()\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => expect(mockFn1).toBeCalled())\n    unsub()\n  })\n\n  it('after a navigation, should have emitted the \"onResolved\" event twice', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const unsub = router.subscribe('onResolved', mockFn1)\n    await router.load()\n    await act(() => render(<RouterProvider router={router} />))\n\n    await act(() => router.navigate({ to: '/$', params: { _splat: 'tanner' } }))\n\n    await waitFor(() => expect(mockFn1).toBeCalledTimes(2))\n    unsub()\n  })\n\n  it('should emit the \"onRendered\" event when a route renders, after navigation, and after param/search updates', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n      scrollRestoration: true,\n    })\n\n    const mockOnRendered = vi.fn()\n    const unsub = router.subscribe('onRendered', mockOnRendered)\n    await act(() => router.load())\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(0))\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(1))\n    expect(mockOnRendered.mock.calls[0]?.[0]?.toLocation.pathname).toBe('/')\n\n    await act(() =>\n      router.navigate({ to: '/posts/$slug', params: { slug: 'first' } }),\n    )\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(2))\n    expect(mockOnRendered.mock.calls[1]?.[0]?.toLocation.pathname).toBe(\n      '/posts/first',\n    )\n\n    await act(() =>\n      router.navigate({ to: '/posts/$slug', params: { slug: 'second' } }),\n    )\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(3))\n    expect(mockOnRendered.mock.calls[2]?.[0]?.toLocation.pathname).toBe(\n      '/posts/second',\n    )\n\n    await act(() =>\n      router.navigate({\n        to: '/posts/$slug',\n        params: { slug: 'second' },\n        search: { root: 'search-change' },\n      }),\n    )\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(4))\n    expect(mockOnRendered.mock.calls[3]?.[0]?.toLocation.search.root).toBe(\n      'search-change',\n    )\n\n    unsub()\n  })\n\n  it('during initial load, should emit the \"onBeforeRouteMount\" and \"onResolved\" events in the correct order', async () => {\n    const mockOnBeforeRouteMount = vi.fn()\n    const mockOnResolved = vi.fn()\n\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    // Subscribe to the events\n    const unsubBeforeRouteMount = router.subscribe(\n      'onBeforeRouteMount',\n      mockOnBeforeRouteMount,\n    )\n    const unsubResolved = router.subscribe('onResolved', mockOnResolved)\n\n    await act(() => router.load())\n    render(<RouterProvider router={router} />)\n\n    // Ensure the \"onBeforeRouteMount\" event was called once\n    await waitFor(() => expect(mockOnBeforeRouteMount).toBeCalledTimes(1))\n\n    // Ensure the \"onResolved\" event was also called once\n    await waitFor(() => expect(mockOnResolved).toBeCalledTimes(1))\n\n    // Check if the invocation call orders are defined before comparing\n    const beforeRouteMountOrder =\n      mockOnBeforeRouteMount.mock.invocationCallOrder[0]\n    const onResolvedOrder = mockOnResolved.mock.invocationCallOrder[0]\n\n    if (beforeRouteMountOrder !== undefined && onResolvedOrder !== undefined) {\n      expect(beforeRouteMountOrder).toBeLessThan(onResolvedOrder)\n    } else {\n      throw new Error('onBeforeRouteMount should be emitted before onResolved.')\n    }\n\n    unsubBeforeRouteMount()\n    unsubResolved()\n  })\n})\n\ndescribe('router rendering stability', () => {\n  type RemountDepsFn = (opts: MakeRemountDepsOptionsUnion) => any\n  async function setup(opts?: {\n    remountDeps: {\n      default?: RemountDepsFn\n      fooId?: RemountDepsFn\n      foo2Id?: RemountDepsFn\n      barId?: RemountDepsFn\n      bar2Id?: RemountDepsFn\n    }\n  }) {\n    const mountMocks = {\n      fooId: vi.fn(),\n      foo2Id: vi.fn(),\n      barId: vi.fn(),\n      bar2Id: vi.fn(),\n    }\n\n    const rootRoute = createRootRoute({\n      component: () => {\n        return (\n          <div>\n            <p>Root</p>\n            <div>\n              <Link\n                data-testid=\"link-foo-1\"\n                to=\"/foo/$fooId\"\n                params={{ fooId: '1' }}\n              >\n                Foo1\n              </Link>\n              <Link\n                data-testid=\"link-foo-2\"\n                to=\"/foo/$fooId\"\n                params={{ fooId: '2' }}\n              >\n                Foo2\n              </Link>\n              <Link\n                data-testid=\"link-foo-3-bar-1\"\n                to=\"/foo/$fooId/bar/$barId\"\n                params={{ fooId: '3', barId: '1' }}\n              >\n                Foo3-Bar1\n              </Link>\n              <Link\n                data-testid=\"link-foo-3-bar-2\"\n                to=\"/foo/$fooId/bar/$barId\"\n                params={{ fooId: '3', barId: '2' }}\n              >\n                Foo3-Bar2\n              </Link>\n              <Link\n                data-testid=\"link-foo2-1-bar2-1\"\n                to=\"/foo2/$foo2Id/bar2/$bar2Id\"\n                params={{ foo2Id: '1', bar2Id: '1' }}\n              >\n                Foo2-1-Bar2_1\n              </Link>\n              <Link\n                data-testid=\"link-foo2-1-bar2-2\"\n                to=\"/foo2/$foo2Id/bar2/$bar2Id\"\n                params={{ foo2Id: '1', bar2Id: '2' }}\n              >\n                Foo2-1-Bar2_2\n              </Link>\n              <Link\n                data-testid=\"link-foo2-2-bar2-1\"\n                to=\"/foo2/$foo2Id/bar2/$bar2Id\"\n                params={{ foo2Id: '2', bar2Id: '1' }}\n              >\n                Foo2-2-Bar2_1\n              </Link>\n            </div>\n            <Outlet />\n          </div>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return ''\n      },\n    })\n\n    const fooIdRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo/$fooId',\n      component: FooIdRouteComponent,\n      remountDeps: opts?.remountDeps.fooId,\n    })\n\n    function FooIdRouteComponent() {\n      const fooId = fooIdRoute.useParams({ select: (s) => s.fooId })\n      useEffect(() => {\n        mountMocks.fooId()\n      }, [])\n\n      return (\n        <div data-testid=\"fooId-page\">\n          Foo page <span data-testid=\"fooId-value\">{fooId}</span> <Outlet />\n        </div>\n      )\n    }\n\n    const barIdRoute = createRoute({\n      getParentRoute: () => fooIdRoute,\n      path: '/bar/$barId',\n      component: BarIdRouteComponent,\n      remountDeps: opts?.remountDeps.barId,\n    })\n\n    function BarIdRouteComponent() {\n      const barId = barIdRoute.useParams({ select: (s) => s.barId })\n\n      useEffect(() => {\n        mountMocks.barId()\n      }, [])\n\n      return (\n        <div data-testid=\"barId-page\">\n          Bar page <span data-testid=\"barId-value\">{barId}</span> <Outlet />\n        </div>\n      )\n    }\n\n    const foo2IdRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo2/$foo2Id',\n      component: Foo2IdRouteComponent,\n      remountDeps: opts?.remountDeps.foo2Id,\n    })\n\n    function Foo2IdRouteComponent() {\n      const renderCounter = useRef(0)\n      renderCounter.current = renderCounter.current + 1\n\n      const { foo2Id } = foo2IdRoute.useParams()\n\n      useEffect(() => {\n        mountMocks.foo2Id()\n      }, [foo2Id])\n\n      return (\n        <div data-testid=\"foo2Id-page\">\n          RenderCount:{' '}\n          <span data-testid=\"foo2Id-Render-Count\">{renderCounter.current}</span>\n          Foo page <span data-testid=\"foo2Id-value\">{foo2Id}</span>\n          <Outlet />\n        </div>\n      )\n    }\n\n    const bar2IdRoute = createRoute({\n      getParentRoute: () => foo2IdRoute,\n      path: '/bar2/$bar2Id',\n      component: Bar2IdRouteComponent,\n      remountDeps: opts?.remountDeps.bar2Id,\n    })\n\n    function Bar2IdRouteComponent() {\n      const { bar2Id } = bar2IdRoute.useParams()\n\n      useEffect(() => {\n        mountMocks.bar2Id()\n      }, [bar2Id])\n\n      return (\n        <div data-testid=\"bar2Id-page\">\n          Bar2 page <span data-testid=\"bar2Id-value\">{bar2Id}</span> <Outlet />\n        </div>\n      )\n    }\n\n    const routeTree = rootRoute.addChildren([\n      fooIdRoute.addChildren([barIdRoute]),\n      foo2IdRoute.addChildren([bar2IdRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({\n      routeTree,\n      defaultRemountDeps: opts?.remountDeps.default,\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    await act(() => render(<RouterProvider router={router} />))\n\n    const foo1 = await screen.findByTestId('link-foo-1')\n    const foo2 = await screen.findByTestId('link-foo-2')\n\n    const foo3bar1 = await screen.findByTestId('link-foo-3-bar-1')\n    const foo3bar2 = await screen.findByTestId('link-foo-3-bar-2')\n    const foo_2_1_bar2_1 = await screen.findByTestId('link-foo2-1-bar2-1')\n    const foo_2_1_bar2_2 = await screen.findByTestId('link-foo2-1-bar2-2')\n    const foo_2_2_bar2_1 = await screen.findByTestId('link-foo2-2-bar2-1')\n\n    expect(foo1).toBeInTheDocument()\n    expect(foo2).toBeInTheDocument()\n    expect(foo3bar1).toBeInTheDocument()\n    expect(foo3bar2).toBeInTheDocument()\n    expect(foo_2_1_bar2_1).toBeInTheDocument()\n    expect(foo_2_1_bar2_2).toBeInTheDocument()\n    expect(foo_2_2_bar2_1).toBeInTheDocument()\n\n    return {\n      router,\n      mountMocks,\n      links: {\n        foo1,\n        foo2,\n        foo3bar1,\n        foo3bar2,\n        foo_2_1_bar2_1,\n        foo_2_1_bar2_2,\n        foo_2_2_bar2_1,\n      },\n    }\n  }\n\n  async function check(\n    page: 'fooId' | 'foo2Id' | 'barId' | 'bar2Id',\n    expected: { value: string; mountCount: number },\n    mountMocks: Record<'fooId' | 'foo2Id' | 'barId' | 'bar2Id', () => void>,\n  ) {\n    const p = await screen.findByTestId(`${page}-page`)\n    expect(p).toBeInTheDocument()\n    const value = await screen.findByTestId(`${page}-value`)\n    expect(value).toBeInTheDocument()\n    expect(value).toHaveTextContent(expected.value)\n\n    expect(mountMocks[page]).toBeCalledTimes(expected.mountCount)\n  }\n\n  it('should not remount the page component when navigating to the same route but different path param if no remount deps are configured', async () => {\n    const { mountMocks, links } = await setup()\n\n    await act(() => fireEvent.click(links.foo1))\n    await check('fooId', { value: '1', mountCount: 1 }, mountMocks)\n    expect(mountMocks.barId).not.toHaveBeenCalled()\n    await act(() => fireEvent.click(links.foo2))\n    await check('fooId', { value: '2', mountCount: 1 }, mountMocks)\n    expect(mountMocks.barId).not.toHaveBeenCalled()\n\n    await act(() => fireEvent.click(links.foo3bar1))\n    await check('fooId', { value: '3', mountCount: 1 }, mountMocks)\n    await check('barId', { value: '1', mountCount: 1 }, mountMocks)\n\n    await act(() => fireEvent.click(links.foo3bar2))\n    await check('fooId', { value: '3', mountCount: 1 }, mountMocks)\n    await check('barId', { value: '2', mountCount: 1 }, mountMocks)\n\n    mountMocks.foo2Id.mockClear()\n    mountMocks.bar2Id.mockClear()\n    await act(() => fireEvent.click(links.foo_2_1_bar2_1))\n    const renderCount = await screen.findByTestId('foo2Id-Render-Count')\n\n    await check('foo2Id', { value: '1', mountCount: 1 }, mountMocks)\n    await check('bar2Id', { value: '1', mountCount: 1 }, mountMocks)\n    expect(renderCount).toBeInTheDocument()\n    expect(renderCount).toHaveTextContent('1')\n\n    await act(() => fireEvent.click(links.foo_2_1_bar2_2))\n    await check('foo2Id', { value: '1', mountCount: 1 }, mountMocks)\n    await check('bar2Id', { value: '2', mountCount: 2 }, mountMocks)\n    expect(renderCount).toBeInTheDocument()\n    expect(renderCount).toHaveTextContent('1')\n\n    mountMocks.foo2Id.mockClear()\n    mountMocks.bar2Id.mockClear()\n\n    await act(() => fireEvent.click(links.foo_2_2_bar2_1))\n    await check('foo2Id', { value: '2', mountCount: 1 }, mountMocks)\n    await check('bar2Id', { value: '1', mountCount: 1 }, mountMocks)\n    expect(renderCount).toBeInTheDocument()\n    expect(renderCount).toHaveTextContent('2')\n  })\n\n  it('should remount the fooId and barId page component when navigating to the same route but different path param if defaultRemountDeps with params is used', async () => {\n    const defaultRemountDeps: RemountDepsFn = (opts) => {\n      return opts.params\n    }\n    const { mountMocks, links } = await setup({\n      remountDeps: { default: defaultRemountDeps },\n    })\n\n    await act(() => fireEvent.click(links.foo1))\n    await check('fooId', { value: '1', mountCount: 1 }, mountMocks)\n    expect(mountMocks.barId).not.toHaveBeenCalled()\n\n    await act(() => fireEvent.click(links.foo2))\n\n    await check('fooId', { value: '2', mountCount: 2 }, mountMocks)\n    expect(mountMocks.barId).not.toHaveBeenCalled()\n\n    await act(() => fireEvent.click(links.foo3bar1))\n    await check('fooId', { value: '3', mountCount: 3 }, mountMocks)\n    await check('barId', { value: '1', mountCount: 1 }, mountMocks)\n\n    await act(() => fireEvent.click(links.foo3bar2))\n    await check('fooId', { value: '3', mountCount: 3 }, mountMocks)\n    await check('barId', { value: '2', mountCount: 2 }, mountMocks)\n  })\n})\n\ndescribe('router matches URLs to route definitions', () => {\n  it('solo splat route matches index route', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/solo-splat'] }),\n    })\n\n    await act(() => router.load())\n\n    expect(router.state.matches.map((d) => d.routeId)).toEqual([\n      '__root__',\n      '/solo-splat/$',\n    ])\n  })\n\n  it('solo splat route matches with splat', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/solo-splat/test'] }),\n    })\n\n    await act(() => router.load())\n\n    expect(router.state.matches.map((d) => d.routeId)).toEqual([\n      '__root__',\n      '/solo-splat/$',\n    ])\n  })\n\n  it('layout splat route matches with splat', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/layout-splat/test'] }),\n    })\n\n    await act(() => router.load())\n\n    expect(router.state.matches.map((d) => d.routeId)).toEqual([\n      '__root__',\n      '/layout-splat',\n      '/layout-splat/$',\n    ])\n  })\n\n  it('nested path params', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/users/5678/files/123'],\n      }),\n    })\n\n    await act(() => router.load())\n\n    expect(router.state.matches.map((d) => d.routeId)).toEqual([\n      '__root__',\n      '/users',\n      '/users/$userId',\n      '/users/$userId/files/$fileId',\n    ])\n  })\n})\n\ndescribe('matches', () => {\n  describe('params', () => {\n    it('/users/$userId/files/$fileId', async () => {\n      const { router } = createTestRouter({\n        history: createMemoryHistory({\n          initialEntries: ['/users/5678/files/123'],\n        }),\n      })\n\n      await act(() => router.load())\n\n      const expectedStrictParams: Record<string, unknown> = {\n        __root__: {},\n        '/users': {},\n        '/users/$userId': { userId: '5678' },\n        '/users/$userId/files/$fileId': { userId: '5678', fileId: '123' },\n      }\n\n      expect(router.state.matches.length).toEqual(\n        Object.entries(expectedStrictParams).length,\n      )\n      router.state.matches.forEach((match) => {\n        expect(match.params).toEqual(\n          expectedStrictParams['/users/$userId/files/$fileId'],\n        )\n      })\n      router.state.matches.forEach((match) => {\n        expect(match._strictParams).toEqual(expectedStrictParams[match.routeId])\n      })\n    })\n  })\n\n  describe('search', () => {\n    it('/nested-search/child?foo=hello&bar=world', async () => {\n      const { router } = createTestRouter({\n        history: createMemoryHistory({\n          initialEntries: ['/nested-search/child?foo=hello&bar=world'],\n        }),\n      })\n\n      await act(() => router.load())\n\n      const expectedStrictSearch: Record<string, unknown> = {\n        __root__: {},\n        '/nested-search': { foo: 'hello' },\n        '/nested-search/child': { foo: 'hello', bar: 'world' },\n      }\n\n      expect(router.state.matches.length).toEqual(\n        Object.entries(expectedStrictSearch).length,\n      )\n      router.state.matches.forEach((match) => {\n        expect(match.search).toEqual(\n          expectedStrictSearch['/nested-search/child'],\n        )\n      })\n      router.state.matches.forEach((match) => {\n        expect(match._strictSearch).toEqual(expectedStrictSearch[match.routeId])\n      })\n    })\n  })\n})\n\ndescribe('invalidate', () => {\n  it('after router.invalid(), routes should be `valid` again after loading', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    await act(() => router.load())\n\n    router.state.matches.forEach((match) => {\n      expect(match.invalid).toBe(false)\n    })\n\n    await act(() => router.invalidate())\n\n    router.state.matches.forEach((match) => {\n      expect(match.invalid).toBe(false)\n    })\n  })\n\n  /**\n   * Regression test:\n   * - When a route loader throws `notFound()`, the match enters a `'notFound'` status.\n   * - After an HMR-style `router.invalidate({ filter })`, the router should reset that match\n   *   back to `'pending'`, re-run its loader, and still render the route's `notFoundComponent`.\n   */\n  it('re-runs loaders that throw notFound() when invalidated via HMR filter', async () => {\n    const history = createMemoryHistory({\n      initialEntries: ['/hmr-not-found'],\n    })\n    const loader = vi.fn(() => {\n      throw notFound()\n    })\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const hmrRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/hmr-not-found',\n      loader,\n      component: () => <div data-testid=\"hmr-route\">Route</div>,\n      notFoundComponent: () => (\n        <div data-testid=\"hmr-route-not-found\">Route Not Found</div>\n      ),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([hmrRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await act(() => router.load())\n\n    expect(await screen.findByTestId('hmr-route-not-found')).toBeInTheDocument()\n    const initialCalls = loader.mock.calls.length\n    expect(initialCalls).toBeGreaterThan(0)\n\n    await act(() =>\n      router.invalidate({\n        filter: (match) => match.routeId === hmrRoute.id,\n      }),\n    )\n\n    expect(loader).toHaveBeenCalledTimes(initialCalls + 1)\n    expect(await screen.findByTestId('hmr-route-not-found')).toBeInTheDocument()\n    expect(screen.queryByTestId('hmr-route')).not.toBeInTheDocument()\n  })\n\n  /**\n   * Regression test:\n   * - When a route loader returns `notFound()`, the route's `notFoundComponent` should render.\n   * - After a global `router.invalidate()`, the route should re-run its loader and continue\n   *   to render the same `notFoundComponent` instead of falling back to a generic error boundary.\n   */\n  it('keeps rendering a route notFoundComponent when loader returns notFound() after invalidate', async () => {\n    const history = createMemoryHistory({\n      initialEntries: ['/loader-not-found'],\n    })\n    const loader = vi.fn(() => notFound())\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const loaderRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/loader-not-found',\n      loader,\n      component: () => <div data-testid=\"loader-route\">Route</div>,\n      notFoundComponent: () => (\n        <div data-testid=\"loader-not-found-component\">Route Not Found</div>\n      ),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([loaderRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await act(() => router.load())\n\n    const notFoundElement = await screen.findByTestId(\n      'loader-not-found-component',\n    )\n    expect(notFoundElement).toBeInTheDocument()\n    const initialCalls = loader.mock.calls.length\n    expect(initialCalls).toBeGreaterThan(0)\n\n    await act(() => router.invalidate())\n\n    expect(loader).toHaveBeenCalledTimes(initialCalls + 1)\n    expect(\n      await screen.findByTestId('loader-not-found-component'),\n    ).toBeInTheDocument()\n    expect(screen.queryByTestId('loader-route')).not.toBeInTheDocument()\n  })\n})\n\ndescribe('search params in URL', () => {\n  let history: RouterHistory\n  beforeEach(() => {\n    history = createBrowserHistory()\n    expect(window.location.pathname).toBe('/')\n  })\n  afterEach(() => {\n    history.destroy()\n    window.history.replaceState(null, 'root', '/')\n  })\n  const testCases = [\n    { route: '/', search: { root: 'world' } },\n    { route: '/', search: { root: 'world', unknown: 'asdf' } },\n    { route: '/search', search: { search: 'foo' } },\n    { route: '/search', search: { root: 'world', search: 'foo' } },\n    {\n      route: '/search',\n      search: { root: 'world', search: 'foo', unknown: 'asdf' },\n    },\n  ]\n  describe.each([undefined, false])(\n    'does not modify the search params in the URL when search.strict=%s',\n    (strict) => {\n      it.each(testCases)(\n        'at $route with search params $search',\n        async ({ route, search }) => {\n          const { router } = createTestRouter({ search: { strict }, history })\n          window.history.replaceState(\n            null,\n            '',\n            `${route}?${new URLSearchParams(search as Record<string, string>).toString()}`,\n          )\n\n          render(<RouterProvider router={router} />)\n          await act(() => router.load())\n\n          expect(await screen.findByTestId('search-root')).toHaveTextContent(\n            search.root ?? '$undefined',\n          )\n          if (route === '/search') {\n            expect(\n              await screen.findByTestId('search-search'),\n            ).toHaveTextContent(search.search ?? '$undefined')\n          }\n          validateSearchParams(search, router)\n        },\n      )\n    },\n  )\n\n  describe('removes unknown search params in the URL when search.strict=true', () => {\n    it.each(testCases)('%j', async ({ route, search }) => {\n      const { router } = createTestRouter({ search: { strict: true }, history })\n      window.history.replaceState(\n        null,\n        '',\n        `${route}?${new URLSearchParams(search as Record<string, string>).toString()}`,\n      )\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n      await expect(await screen.findByTestId('search-root')).toHaveTextContent(\n        search.root ?? 'undefined',\n      )\n      if (route === '/search') {\n        expect(await screen.findByTestId('search-search')).toHaveTextContent(\n          search.search ?? 'undefined',\n        )\n      }\n\n      expect(window.location.pathname).toEqual(route)\n      const { unknown: _, ...expectedSearch } = { ...search }\n      validateSearchParams(expectedSearch, router)\n    })\n  })\n\n  describe.each([false, true, undefined])('default search params', (strict) => {\n    let router: AnyRouter\n    beforeEach(() => {\n      const result = createTestRouter({ search: { strict }, history })\n      router = result.router\n    })\n\n    async function checkSearch(expectedSearch: {\n      default: string\n      optional?: string\n    }) {\n      expect(await screen.findByTestId('search-default')).toHaveTextContent(\n        expectedSearch.default,\n      )\n      expect(await screen.findByTestId('search-optional')).toHaveTextContent(\n        expectedSearch.optional ?? '$undefined',\n      )\n\n      validateSearchParams(expectedSearch, router)\n    }\n\n    it('should add the default search param upon initial load when no search params are present', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault/check`)\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      await checkSearch({ default: 'd1' })\n    })\n\n    it('should have the correct `default` search param upon initial load when the `default` param is present', async () => {\n      window.history.replaceState(\n        null,\n        '',\n        `/searchWithDefault/check?default=d2`,\n      )\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      await checkSearch({ default: 'd2' })\n    })\n\n    it('should add the default search param upon initial load when only the optional search param is present', async () => {\n      window.history.replaceState(\n        null,\n        '',\n        `/searchWithDefault/check?optional=o1`,\n      )\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      await checkSearch({ default: 'd1', optional: 'o1' })\n    })\n\n    it('should keep the search param upon initial load when both search params are present', async () => {\n      window.history.replaceState(\n        null,\n        '',\n        `/searchWithDefault/check?default=d2&optional=o1`,\n      )\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n\n      await checkSearch({ default: 'd2', optional: 'o1' })\n    })\n\n    it('should have the default search param when navigating without search params', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault`)\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n      const link = await screen.findByTestId('link-without-params')\n\n      expect(link).toBeInTheDocument()\n      fireEvent.click(link)\n\n      await checkSearch({ default: 'd1' })\n    })\n\n    it('should have the default search param when navigating with the optional search param', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault`)\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n      const link = await screen.findByTestId('link-with-optional-param')\n\n      expect(link).toBeInTheDocument()\n      fireEvent.click(link)\n\n      await checkSearch({ default: 'd1', optional: 'o1' })\n    })\n\n    it('should have the correct `default` search param when navigating with the `default` search param', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault`)\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n      const link = await screen.findByTestId('link-with-default-param')\n\n      expect(link).toBeInTheDocument()\n      fireEvent.click(link)\n\n      await checkSearch({ default: 'd2' })\n    })\n\n    it('should have the correct search params when navigating with both search params', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault`)\n\n      render(<RouterProvider router={router} />)\n      await act(() => router.load())\n      const link = await screen.findByTestId('link-with-both-params')\n\n      expect(link).toBeInTheDocument()\n      fireEvent.click(link)\n\n      await checkSearch({ default: 'd2', optional: 'o1' })\n    })\n  })\n\n  describe('validates search params', () => {\n    class TestValidationError extends Error {\n      issues: Array<{ message: string }>\n      constructor(issues: Array<{ message: string }>) {\n        super('validation failed')\n        this.name = 'TestValidationError'\n        this.issues = issues\n      }\n    }\n    const testCases: [\n      StandardSchemaValidator<Record<string, unknown>, { search: string }>,\n      ValidatorFn<Record<string, unknown>, { search: string }>,\n      ValidatorObj<Record<string, unknown>, { search: string }>,\n    ] = [\n      {\n        ['~standard']: {\n          validate: (input) => {\n            const result = z.object({ search: z.string() }).safeParse(input)\n            if (result.success) {\n              return { value: result.data }\n            }\n            return new TestValidationError(result.error.issues)\n          },\n        },\n      },\n      ({ search }) => {\n        if (typeof search !== 'string') {\n          throw new TestValidationError([\n            { message: 'search must be a string' },\n          ])\n        }\n        return { search }\n      },\n      {\n        parse: ({ search }) => {\n          if (typeof search !== 'string') {\n            throw new TestValidationError([\n              { message: 'search must be a string' },\n            ])\n          }\n          return { search }\n        },\n      },\n    ]\n\n    describe.each(testCases)('search param validation', (validateSearch) => {\n      it('does not throw an error when the search param is valid', async () => {\n        let errorSpy: Error | undefined\n        const rootRoute = createRootRoute({\n          validateSearch,\n          errorComponent: ({ error }) => {\n            errorSpy = error\n            return null\n          },\n        })\n\n        const history = createMemoryHistory({\n          initialEntries: ['/search?search=foo'],\n        })\n        const router = createRouter({ routeTree: rootRoute, history })\n        render(<RouterProvider router={router} />)\n        await act(() => router.load())\n\n        expect(errorSpy).toBeUndefined()\n      })\n\n      it('throws an error when the search param is not valid', async () => {\n        let errorSpy: Error | undefined\n        const rootRoute = createRootRoute({\n          validateSearch,\n          errorComponent: ({ error }) => {\n            errorSpy = error\n            return null\n          },\n        })\n\n        const history = createMemoryHistory({ initialEntries: ['/search'] })\n        const router = createRouter({ routeTree: rootRoute, history })\n        render(<RouterProvider router={router} />)\n        await act(() => router.load())\n\n        expect(errorSpy).toBeInstanceOf(SearchParamError)\n        expect(errorSpy?.cause).toBeInstanceOf(TestValidationError)\n      })\n    })\n  })\n})\n\ndescribe('route ids should be consistent after rebuilding the route tree', () => {\n  it('should have the same route ids after rebuilding the route tree', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const originalRouteIds = Object.keys(router.routesById)\n\n    await act(() =>\n      router.navigate({\n        to: '/parent/child',\n      }),\n    )\n\n    await act(() =>\n      router.navigate({\n        to: '/filBasedParent/child',\n      }),\n    )\n\n    router.buildRouteTree()\n\n    const rebuiltRouteIds = Object.keys(router.routesById)\n\n    originalRouteIds.forEach((id) => {\n      expect(rebuiltRouteIds).toContain(id)\n    })\n\n    rebuiltRouteIds.forEach((id) => {\n      expect(originalRouteIds).toContain(id)\n    })\n  })\n})\n\ndescribe('route id uniqueness', () => {\n  it('routesById should not have routes duplicated route ids', () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const routeIdSet = new Set<string>()\n\n    Object.values(router.routesById).forEach((route) => {\n      expect(routeIdSet.has(route.id)).toBe(false)\n      routeIdSet.add(route.id)\n    })\n  })\n\n  it('routesByPath should not have routes duplicated route ids', () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const routeIdSet = new Set<string>()\n\n    Object.values(router.routesByPath).forEach((route) => {\n      expect(routeIdSet.has(route.id)).toBe(false)\n      routeIdSet.add(route.id)\n    })\n  })\n})\n\nconst createHistoryRouter = () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/' })}>Index</button>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button onClick={() => navigate({ to: '/posts', replace: true })}>\n          Replace\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n    component: function Component() {\n      const navigate = useNavigate()\n\n      return (\n        <>\n          <h1>Posts</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n        </>\n      )\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    history,\n  })\n\n  return { router }\n}\n\ndescribe('history: History gives correct notifcations and state', () => {\n  it('should work with push and back', async () => {\n    const { router: router } = createHistoryRouter()\n\n    type Router = typeof router\n\n    const results: Array<\n      Parameters<Parameters<Router['history']['subscribe']>[0]>[0]['action']\n    > = []\n\n    render(<RouterProvider router={router} />)\n\n    const unsub = router.history.subscribe(({ action }) => {\n      results.push(action)\n    })\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    act(() => router.history.back())\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    expect(results).toEqual([{ type: 'PUSH' }, { type: 'BACK' }])\n\n    unsub()\n  })\n\n  it('should work more complex scenario', async () => {\n    const { router: router } = createHistoryRouter()\n\n    type Router = typeof router\n\n    const results: Array<\n      Parameters<Parameters<Router['history']['subscribe']>[0]>[0]['action']\n    > = []\n\n    render(<RouterProvider router={router} />)\n\n    const unsub = router.history.subscribe(({ action }) => {\n      results.push(action)\n    })\n\n    const replaceButton = await screen.findByRole('button', { name: 'Replace' })\n\n    fireEvent.click(replaceButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    const indexButton = await screen.findByRole('button', { name: 'Index' })\n\n    fireEvent.click(indexButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    act(() => router.history.back())\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    act(() => router.history.go(1))\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    expect(results).toEqual([\n      { type: 'REPLACE' },\n      { type: 'PUSH' },\n      { type: 'PUSH' },\n      { type: 'BACK' },\n      { type: 'GO', index: 1 },\n    ])\n\n    unsub()\n  })\n})\n\nit('does not push to history if url and state are the same', async () => {\n  const history = createMemoryHistory({ initialEntries: ['/linksToItself'] })\n  const { router } = createTestRouter({\n    history,\n  })\n\n  await act(() => render(<RouterProvider router={router} />))\n\n  const link = await screen.findByTestId('link')\n  await act(() => fireEvent.click(link))\n\n  expect(history.length).toBe(1)\n})\n\ndescribe('does not strip search params if search validation fails', () => {\n  let history: RouterHistory\n\n  beforeEach(() => {\n    history = createBrowserHistory()\n  })\n  afterEach(() => {\n    history.destroy()\n    window.history.replaceState(null, 'root', '/')\n    cleanup()\n  })\n\n  function getRouter() {\n    const rootRoute = createRootRoute({\n      validateSearch: z.object({ root: z.string() }),\n      component: () => {\n        const search = rootRoute.useSearch()\n        return (\n          <>\n            <div data-testid=\"search-root\">{search.root ?? '$undefined'}</div>\n            <Outlet />\n          </>\n        )\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      validateSearch: z.object({ index: z.string() }),\n      component: () => {\n        const search = rootRoute.useSearch()\n        return (\n          <>\n            <div data-testid=\"search-index\">{search.index ?? '$undefined'}</div>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute])\n\n    const router = createRouter({ routeTree, history })\n\n    return router\n  }\n\n  it('smoke test - all required search params are present', async () => {\n    window.history.replaceState(null, 'root', '/?root=hello&index=world')\n    const router = getRouter()\n    await act(() => render(<RouterProvider router={router} />))\n\n    expect(await screen.findByTestId('search-root')).toHaveTextContent('hello')\n    expect(await screen.findByTestId('search-index')).toHaveTextContent('world')\n\n    expect(window.location.search).toBe('?root=hello&index=world')\n  })\n\n  it('root is missing', async () => {\n    window.history.replaceState(null, 'root', '/?index=world')\n    const router = getRouter()\n    await act(() => render(<RouterProvider router={router} />))\n\n    expect(window.location.search).toBe('?index=world')\n  })\n\n  it('index is missing', async () => {\n    window.history.replaceState(null, 'root', '/?root=hello')\n    const router = getRouter()\n\n    await act(() => render(<RouterProvider router={router} />))\n\n    expect(window.location.search).toBe('?root=hello')\n  })\n})\n\ndescribe('statusCode', () => {\n  it('should reset statusCode to 200 when navigating from 404 to valid route', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div>Home</div>,\n    })\n\n    const validRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/valid',\n      component: () => <div>Valid Route</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, validRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    expect(router.state.statusCode).toBe(200)\n\n    await act(() => router.navigate({ to: '/' }))\n    expect(router.state.statusCode).toBe(200)\n\n    await act(() => router.navigate({ to: '/non-existing' }))\n    expect(router.state.statusCode).toBe(404)\n\n    await act(() => router.navigate({ to: '/valid' }))\n    expect(router.state.statusCode).toBe(200)\n\n    await act(() => router.navigate({ to: '/another-non-existing' }))\n    expect(router.state.statusCode).toBe(404)\n  })\n\n  describe.each([true, false])(\n    'status code is set when loader/beforeLoad throws (isAsync=%s)',\n    async (isAsync) => {\n      const throwingFun = isAsync\n        ? (toThrow: () => void) => async () => {\n            await new Promise((resolve) => setTimeout(resolve, 10))\n            toThrow()\n          }\n        : (toThrow: () => void) => toThrow\n\n      const throwNotFound = throwingFun(() => {\n        throw notFound()\n      })\n      const throwError = throwingFun(() => {\n        throw new Error('test-error')\n      })\n      it('should set statusCode to 404 when a route loader throws a notFound()', async () => {\n        const history = createMemoryHistory({ initialEntries: ['/'] })\n\n        const rootRoute = createRootRoute()\n\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => <div>Home</div>,\n        })\n\n        const loaderThrowsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/loader-throws-not-found',\n          loader: throwNotFound,\n          component: () => (\n            <div data-testid=\"route-component\">loader will throw</div>\n          ),\n          notFoundComponent: () => (\n            <div data-testid=\"not-found-component\">Not Found</div>\n          ),\n        })\n\n        const routeTree = rootRoute.addChildren([indexRoute, loaderThrowsRoute])\n        const router = createRouter({ routeTree, history })\n\n        render(<RouterProvider router={router} />)\n\n        expect(router.state.statusCode).toBe(200)\n\n        await act(() => router.navigate({ to: '/loader-throws-not-found' }))\n        expect(router.state.statusCode).toBe(404)\n        expect(\n          await screen.findByTestId('not-found-component'),\n        ).toBeInTheDocument()\n        expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()\n      })\n\n      it('should set statusCode to 404 when a route beforeLoad throws a notFound()', async () => {\n        const history = createMemoryHistory({ initialEntries: ['/'] })\n\n        const rootRoute = createRootRoute({\n          notFoundComponent: () => (\n            <div data-testid=\"not-found-component\">Not Found</div>\n          ),\n        })\n\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => <div>Home</div>,\n        })\n\n        const beforeLoadThrowsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/beforeload-throws-not-found',\n          beforeLoad: throwNotFound,\n          component: () => (\n            <div data-testid=\"route-component\">beforeLoad will throw</div>\n          ),\n          notFoundComponent: () => (\n            <div data-testid=\"not-found-component\">Not Found</div>\n          ),\n        })\n\n        const routeTree = rootRoute.addChildren([\n          indexRoute,\n          beforeLoadThrowsRoute,\n        ])\n        const router = createRouter({ routeTree, history })\n\n        render(<RouterProvider router={router} />)\n\n        expect(router.state.statusCode).toBe(200)\n\n        await act(() => router.navigate({ to: '/beforeload-throws-not-found' }))\n        expect(router.state.statusCode).toBe(404)\n        expect(\n          await screen.findByTestId('not-found-component'),\n        ).toBeInTheDocument()\n        expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()\n      })\n\n      it('should set statusCode to 500 when a route loader throws an Error', async () => {\n        const history = createMemoryHistory({ initialEntries: ['/'] })\n\n        const rootRoute = createRootRoute()\n\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => <div>Home</div>,\n        })\n\n        const loaderThrowsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/loader-throws-error',\n          loader: throwError,\n          component: () => (\n            <div data-testid=\"route-component\">loader will throw</div>\n          ),\n          errorComponent: () => <div data-testid=\"error-component\">Error</div>,\n        })\n\n        const routeTree = rootRoute.addChildren([indexRoute, loaderThrowsRoute])\n        const router = createRouter({ routeTree, history })\n\n        render(<RouterProvider router={router} />)\n\n        expect(router.state.statusCode).toBe(200)\n\n        await act(() => router.navigate({ to: '/loader-throws-error' }))\n        expect(router.state.statusCode).toBe(500)\n        expect(await screen.findByTestId('error-component')).toBeInTheDocument()\n        expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()\n      })\n\n      it('should set statusCode to 500 when a route beforeLoad throws an Error', async () => {\n        const history = createMemoryHistory({ initialEntries: ['/'] })\n\n        const rootRoute = createRootRoute()\n\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => <div>Home</div>,\n        })\n\n        const beforeLoadThrowsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/beforeload-throws-error',\n          beforeLoad: throwError,\n          component: () => (\n            <div data-testid=\"route-component\">beforeLoad will throw</div>\n          ),\n          errorComponent: () => <div data-testid=\"error-component\">Error</div>,\n        })\n\n        const routeTree = rootRoute.addChildren([\n          indexRoute,\n          beforeLoadThrowsRoute,\n        ])\n        const router = createRouter({ routeTree, history })\n\n        render(<RouterProvider router={router} />)\n\n        expect(router.state.statusCode).toBe(200)\n\n        await act(() => router.navigate({ to: '/beforeload-throws-error' }))\n        expect(router.state.statusCode).toBe(500)\n        expect(await screen.findByTestId('error-component')).toBeInTheDocument()\n        expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()\n      })\n    },\n  )\n})\n\ndescribe('notFound in beforeLoad with pendingComponent', () => {\n  it('should transition router.state.status to idle when child beforeLoad throws notFound and parent has pendingComponent with pendingMs: 0', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n      notFoundComponent: () => (\n        <div data-testid=\"root-not-found\">Root Not Found</div>\n      ),\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div data-testid=\"home-page\">\n          <Link to=\"/parent/child\">Go to child</Link>\n        </div>\n      ),\n    })\n\n    const parentRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/parent',\n      pendingMs: 0,\n      pendingComponent: () => (\n        <div data-testid=\"pending-component\">Loading...</div>\n      ),\n      component: () => (\n        <div data-testid=\"parent-component\">\n          Parent\n          <Outlet />\n        </div>\n      ),\n      notFoundComponent: () => (\n        <div data-testid=\"parent-not-found\">Parent Not Found</div>\n      ),\n    })\n\n    const childRoute = createRoute({\n      getParentRoute: () => parentRoute,\n      path: '/child',\n      beforeLoad: () => {\n        throw notFound()\n      },\n      component: () => <div data-testid=\"child-component\">Child</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      parentRoute.addChildren([childRoute]),\n    ])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    // Wait for initial load\n    await act(() => router.latestLoadPromise)\n    expect(router.state.status).toBe('idle')\n    expect(screen.getByTestId('home-page')).toBeInTheDocument()\n\n    // Navigate to the child route that throws notFound in beforeLoad\n    await act(() => router.navigate({ to: '/parent/child' }))\n\n    // The router status should eventually become idle\n    await waitFor(() => {\n      expect(router.state.status).toBe('idle')\n    })\n\n    expect(router.state.statusCode).toBe(404)\n  })\n\n  it('should transition router.state.status to idle when child beforeLoad throws notFound and parent has NO pendingComponent', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({\n      notFoundComponent: () => (\n        <div data-testid=\"root-not-found\">Root Not Found</div>\n      ),\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div data-testid=\"home-page\">Home</div>,\n    })\n\n    // Direct child of root (no intermediate parent)\n    const childRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/child',\n      beforeLoad: () => {\n        throw notFound()\n      },\n      component: () => <div data-testid=\"child-component\">Child</div>,\n      notFoundComponent: () => (\n        <div data-testid=\"child-not-found\">Child Not Found</div>\n      ),\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, childRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    await act(() => router.latestLoadPromise)\n    expect(router.state.status).toBe('idle')\n\n    await act(() => router.navigate({ to: '/child' }))\n\n    await waitFor(() => {\n      expect(router.state.status).toBe('idle')\n    })\n\n    expect(router.state.statusCode).toBe(404)\n  })\n\n  it('should transition router.state.status to idle when nested child beforeLoad throws notFound WITHOUT pendingComponent', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n      notFoundComponent: () => (\n        <div data-testid=\"root-not-found\">Root Not Found</div>\n      ),\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div data-testid=\"home-page\">Home</div>,\n    })\n\n    const parentRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/parent',\n      component: () => (\n        <div data-testid=\"parent-component\">\n          Parent\n          <Outlet />\n        </div>\n      ),\n      notFoundComponent: () => (\n        <div data-testid=\"parent-not-found\">Parent Not Found</div>\n      ),\n    })\n\n    const childRoute = createRoute({\n      getParentRoute: () => parentRoute,\n      path: '/child',\n      beforeLoad: () => {\n        throw notFound()\n      },\n      component: () => <div data-testid=\"child-component\">Child</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      parentRoute.addChildren([childRoute]),\n    ])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    await act(() => router.latestLoadPromise)\n    expect(router.state.status).toBe('idle')\n\n    await act(() => router.navigate({ to: '/parent/child' }))\n\n    await waitFor(() => {\n      expect(router.state.status).toBe('idle')\n    })\n\n    expect(router.state.statusCode).toBe(404)\n  })\n\n  it('should transition router.state.status to idle when child async beforeLoad throws notFound and parent has pendingComponent with pendingMs: 0', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n      notFoundComponent: () => (\n        <div data-testid=\"root-not-found\">Root Not Found</div>\n      ),\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div data-testid=\"home-page\">\n          <Link to=\"/parent/child\">Go to child</Link>\n        </div>\n      ),\n    })\n\n    const parentRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/parent',\n      pendingMs: 0,\n      pendingComponent: () => (\n        <div data-testid=\"pending-component\">Loading...</div>\n      ),\n      component: () => (\n        <div data-testid=\"parent-component\">\n          Parent\n          <Outlet />\n        </div>\n      ),\n      notFoundComponent: () => (\n        <div data-testid=\"parent-not-found\">Parent Not Found</div>\n      ),\n    })\n\n    const childRoute = createRoute({\n      getParentRoute: () => parentRoute,\n      path: '/child',\n      beforeLoad: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 10))\n        throw notFound()\n      },\n      component: () => <div data-testid=\"child-component\">Child</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      parentRoute.addChildren([childRoute]),\n    ])\n    const router = createRouter({ routeTree, history })\n\n    render(<RouterProvider router={router} />)\n\n    // Wait for initial load\n    await act(() => router.latestLoadPromise)\n    expect(router.state.status).toBe('idle')\n    expect(screen.getByTestId('home-page')).toBeInTheDocument()\n\n    // Navigate to the child route that throws notFound in beforeLoad\n    await act(() => router.navigate({ to: '/parent/child' }))\n\n    // The router status should eventually become idle\n    await waitFor(() => {\n      expect(router.state.status).toBe('idle')\n    })\n\n    expect(router.state.statusCode).toBe(404)\n  })\n})\n\ndescribe('Router rewrite functionality', () => {\n  it('should rewrite URLs using input before router interprets them', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const newPathRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/new-path',\n      component: () => <div data-testid=\"new-path\">New Path Content</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([newPathRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/old-path'] }),\n      rewrite: {\n        input: ({ url }) => {\n          // Rewrite /old-path to /new-path\n\n          if (url.pathname === '/old-path') {\n            url.pathname = `/new-path`\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('new-path')).toBeInTheDocument()\n    })\n\n    // Router should have interpreted the rewritten URL\n    expect(router.state.location.pathname).toBe('/new-path')\n  })\n\n  it('should handle input rewrite with complex URL transformations', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const usersRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users',\n      component: () => <div data-testid=\"users\">Users Content</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([usersRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/legacy/users?page=1#top'],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          // Rewrite legacy URLs to new format\n          if (url.pathname === '/legacy/users') {\n            url.pathname = `/users`\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('users')).toBeInTheDocument()\n    })\n\n    // Router should have interpreted the rewritten URL\n    expect(router.state.location.pathname).toBe('/users')\n    expect(router.state.location.search).toEqual({ page: 1 })\n    expect(router.state.location.hash).toBe('top')\n  })\n\n  it('should handle multiple input rewrite conditions', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const homeRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div data-testid=\"home\">Home Content</div>,\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <div data-testid=\"about\">About Content</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([homeRoute, aboutRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/old-about'] }),\n      rewrite: {\n        input: ({ url }) => {\n          // Multiple rewrite rules\n          if (url.pathname === '/old-home' || url.pathname === '/home') {\n            url.pathname = '/'\n          }\n          if (url.pathname === '/old-about' || url.pathname === '/info') {\n            url.pathname = '/about'\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('about')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/about')\n  })\n\n  it('should handle input rewrite with search params and hash preservation', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const docsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/docs',\n      component: () => <div data-testid=\"docs\">Documentation</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([docsRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/old/documentation?version=v2&lang=en#installation'],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          // Rewrite old docs URL structure\n          if (url.pathname === '/old/documentation') {\n            url.pathname = `/docs`\n            return url\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('docs')).toBeInTheDocument()\n    })\n\n    // Verify the URL was rewritten correctly with search params and hash preserved\n    expect(router.state.location.pathname).toBe('/docs')\n    expect(router.state.location.search).toEqual({\n      version: 'v2',\n      lang: 'en',\n    })\n    expect(router.state.location.hash).toBe('installation')\n  })\n\n  it('should handle subdomain to path rewriting with input', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const apiRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/$stage/users',\n      component: () => (\n        <div data-testid=\"component\">{apiRoute.useParams().stage} Users</div>\n      ),\n    })\n\n    const routeTree = rootRoute.addChildren([apiRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['https://test.domain.com/users'],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          // Rewrite test.domain.com/path to /test/path (subdomain becomes path segment)\n          if (url.hostname.startsWith('test.domain.com')) {\n            url.pathname = `/test${url.pathname}`\n            return url\n          }\n          return undefined\n        },\n      },\n    })\n    render(<RouterProvider router={router} />)\n    await router.latestLoadPromise\n    await waitFor(() => {\n      expect(screen.getByTestId('component')).toHaveTextContent('test Users')\n    })\n\n    // Router should have interpreted the rewritten URL\n    expect(router.state.location.pathname).toBe('/test/users')\n  })\n\n  it('should handle hostname-based routing with input rewrite', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const appRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/app',\n      component: () => <div data-testid=\"app\">App Content</div>,\n    })\n\n    const adminRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/admin',\n      component: () => <div data-testid=\"admin\">Admin Content</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([appRoute, adminRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['https://admin.example.com/dashboard'],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          // Route based on subdomain\n          if (url.hostname === 'admin.example.com') {\n            url.pathname = '/admin'\n          }\n          if (url.hostname === 'app.example.com') {\n            url.pathname = '/app'\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('admin')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/admin')\n  })\n\n  it('should handle multiple URL transformation patterns', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const productsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/products',\n      component: () => <div data-testid=\"products\">Products</div>,\n    })\n\n    const blogRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/blog',\n      component: () => <div data-testid=\"blog\">Blog</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([productsRoute, blogRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/old/shop/items?category=electronics'],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          // Multiple transformation patterns\n          if (url.pathname === '/old/shop/items') {\n            url.pathname = `/products`\n          }\n          if (url.pathname.startsWith('/legacy/')) {\n            url.pathname = url.pathname.replace('/legacy/', '/blog/')\n          }\n          if (url.pathname.startsWith('/v1/')) {\n            url.pathname = url.pathname.replace('/v1/', '/')\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('products')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/products')\n    expect(router.state.location.search).toEqual({ category: 'electronics' })\n  })\n\n  it('should handle rewriting subdomain and path', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const apiRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/api/v2',\n      component: () => <div data-testid=\"api-v2\">API v2</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([apiRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['https://legacy.example.com/api/v1'],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          if (\n            url.hostname === 'legacy.example.com' &&\n            url.pathname === '/api/v1'\n          ) {\n            return 'https://api.example.com/api/v2'\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('api-v2')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/api/v2')\n  })\n\n  it('should handle rewriting subdomain, path and search', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const newApiRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/api/v3/users',\n      component: () => <div data-testid=\"api-v3\">API v3 Users</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([newApiRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: [\n          'https://old-api.company.com/users?limit=10&offset=20',\n        ],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          if (\n            url.hostname === 'old-api.company.com' &&\n            url.pathname === '/users'\n          ) {\n            url.hostname = 'api.company.com'\n            url.pathname = '/api/v3/users'\n            url.searchParams.set('version', '3')\n            return url\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('api-v3')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/api/v3/users')\n    expect(router.state.location.search).toEqual({\n      limit: 10,\n      offset: 20,\n      version: 3,\n    })\n  })\n\n  it('should handle complex URL mutations with hostname and search params', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const blogRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/content/blog',\n      component: () => <div data-testid=\"blog\">Blog Content</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([blogRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: [\n          'https://blog.oldsite.com/posts?category=tech&year=2024#top',\n        ],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          // Mutate URL: change subdomain to path, preserve params and hash\n          if (url.hostname === 'blog.oldsite.com') {\n            url.hostname = 'newsite.com'\n            url.pathname = '/content/blog'\n            url.searchParams.set('source', 'migration')\n            // Keep existing search params and hash\n            return url.href\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('blog')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/content/blog')\n    expect(router.state.location.search).toEqual({\n      category: 'tech',\n      year: 2024,\n      source: 'migration',\n    })\n    expect(router.state.location.hash).toBe('top')\n  })\n\n  it('should handle returning new URL instance vs mutating existing one', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const shopRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/shop/products',\n      component: () => <div data-testid=\"shop\">Shop Products</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([shopRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['https://store.example.com/items?id=123'],\n      }),\n      rewrite: {\n        input: ({ url }) => {\n          // Alternative pattern: create new URL instance and return it\n\n          if (\n            url.hostname === 'store.example.com' &&\n            url.pathname === '/items'\n          ) {\n            const newUrl = new URL('https://example.com/shop/products')\n            newUrl.searchParams.set(\n              'productId',\n              url.searchParams.get('id') || '',\n            )\n            newUrl.searchParams.set('migrated', 'true')\n            return newUrl\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('shop')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/shop/products')\n    expect(router.state.location.search).toEqual({\n      productId: 123,\n      migrated: true,\n    })\n  })\n\n  it('should handle output rewrite when navigating', async () => {\n    // This test demonstrates expected output behavior for programmatic navigation\n    const Navigate = () => {\n      const navigate = useNavigate()\n      return (\n        <button\n          data-testid=\"navigate-btn\"\n          onClick={() => navigate({ to: '/dashboard' })}\n        >\n          Navigate to Dashboard\n        </button>\n      )\n    }\n\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: Navigate,\n    })\n\n    const dashboardRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/dashboard',\n      component: () => <div data-testid=\"dashboard\">Dashboard</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, dashboardRoute])\n\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n    const router = createRouter({\n      routeTree,\n      history,\n      rewrite: {\n        output: ({ url }) => {\n          if (url.pathname === '/dashboard') {\n            url.pathname = '/admin/panel'\n            return url\n          }\n          return undefined\n        },\n        input: ({ url }) => {\n          if (url.pathname === '/admin/panel') {\n            url.pathname = '/dashboard'\n            return url\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const navigateBtn = await screen.findByTestId('navigate-btn')\n\n    fireEvent.click(navigateBtn)\n    await router.latestLoadPromise\n\n    await screen.findByTestId('dashboard')\n\n    // Router internal state should show the internal path\n    expect(router.state.location.pathname).toBe('/dashboard')\n\n    // History should be updated with the rewritten path due to output\n    expect(history.location.pathname).toBe('/admin/panel')\n  })\n\n  it('should handle output rewrite with Link navigation', async () => {\n    // This test demonstrates expected output behavior for Link-based navigation\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div>\n          <Link to=\"/profile\" data-testid=\"profile-link\">\n            Go to Profile\n          </Link>\n        </div>\n      ),\n    })\n\n    const profileRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/profile',\n      component: () => <div data-testid=\"profile\">User Profile</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, profileRoute])\n\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n    const router = createRouter({\n      routeTree,\n      history,\n      rewrite: {\n        output: ({ url }) => {\n          if (url.pathname === '/profile') {\n            url.pathname = '/user'\n            return url\n          }\n          return undefined\n        },\n        input: ({ url }) => {\n          if (url.pathname === '/user') {\n            url.pathname = '/profile'\n            return url\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const profileLink = await screen.findByTestId('profile-link')\n\n    fireEvent.click(profileLink)\n\n    expect(await screen.findByTestId('profile')).toBeInTheDocument()\n\n    expect(router.state.location.pathname).toBe('/profile')\n\n    expect(history.location.pathname).toBe('/user')\n  })\n\n  it('should handle i18n rewriting with navigation between localized routes', async () => {\n    // Tests navigation between routes with i18n locale prefix rewriting\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const homeRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div data-testid=\"home\">\n          Home\n          <Link to=\"/about\" data-testid=\"about-link\">\n            About\n          </Link>\n        </div>\n      ),\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <div data-testid=\"about\">About</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([homeRoute, aboutRoute])\n\n    // Start at the public-facing locale-prefixed URL\n    const history = createMemoryHistory({ initialEntries: ['/en'] })\n\n    const router = createRouter({\n      routeTree,\n      history,\n      rewrite: {\n        input: ({ url }) => {\n          // Strip locale prefix\n          if (url.pathname.startsWith('/en')) {\n            url.pathname = url.pathname.replace(/^\\/en/, '') || '/'\n            return url\n          }\n          return url\n        },\n        output: ({ url }) => {\n          // Add locale prefix\n          if (!url.pathname.startsWith('/en')) {\n            url.pathname = `/en${url.pathname === '/' ? '' : url.pathname}`\n            return url\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('home')).toBeInTheDocument()\n    })\n\n    // Click the about link\n    const aboutLink = screen.getByTestId('about-link')\n    fireEvent.click(aboutLink)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('about')).toBeInTheDocument()\n    })\n\n    // Internal pathname should be /about\n    expect(router.state.location.pathname).toBe('/about')\n\n    // Public href should be /en/about\n    expect(router.state.location.publicHref).toBe('/en/about')\n\n    // History should show the public-facing path\n    expect(history.location.pathname).toBe('/en/about')\n  })\n\n  it('should handle i18n rewriting with direct navigation to localized URL', async () => {\n    // Tests that navigating directly to a locale-prefixed URL works correctly\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <div data-testid=\"about\">About</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([aboutRoute])\n\n    // Start at German locale-prefixed URL\n    const history = createMemoryHistory({ initialEntries: ['/de/about'] })\n\n    const router = createRouter({\n      routeTree,\n      history,\n      rewrite: {\n        input: ({ url }) => {\n          // Strip any locale prefix\n          const match = url.pathname.match(/^\\/(en|de)(.*)$/)\n          if (match) {\n            url.pathname = match[2] || '/'\n            return url\n          }\n          return url\n        },\n        output: ({ url }) => {\n          // Default to German locale\n          if (!url.pathname.match(/^\\/(en|de)/)) {\n            url.pathname = `/de${url.pathname === '/' ? '' : url.pathname}`\n            return url\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('about')).toBeInTheDocument()\n    })\n\n    // Internal pathname should be /about (de-localized)\n    expect(router.state.location.pathname).toBe('/about')\n\n    // Public href should include locale\n    expect(router.state.location.publicHref).toBe('/de/about')\n  })\n\n  it('should maintain consistent publicHref between parseLocation and buildLocation', async () => {\n    // This test specifically verifies the fix for the redirect loop bug:\n    // parseLocation and buildLocation must compute the same publicHref\n    // for the same logical location.\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const homeRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div data-testid=\"home\">Home</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([homeRoute])\n\n    // Start at the locale-prefixed URL\n    const history = createMemoryHistory({ initialEntries: ['/fr'] })\n\n    const router = createRouter({\n      routeTree,\n      history,\n      rewrite: {\n        input: ({ url }) => {\n          // De-localize: /fr -> /\n          if (url.pathname.startsWith('/fr')) {\n            url.pathname = url.pathname.replace(/^\\/fr/, '') || '/'\n          }\n          return url\n        },\n        output: ({ url }) => {\n          // Re-localize: / -> /fr\n          if (!url.pathname.startsWith('/fr')) {\n            url.pathname = `/fr${url.pathname === '/' ? '' : url.pathname}`\n          }\n          return url\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('home')).toBeInTheDocument()\n    })\n\n    // Get the current location's publicHref (computed by parseLocation)\n    const parsedPublicHref = router.state.location.publicHref\n\n    // Build a location to the same path and check its publicHref\n    const builtLocation = router.buildLocation({ to: '/' })\n\n    // These must match - if they don't, the router will think it needs\n    // to redirect, causing an infinite loop\n    expect(parsedPublicHref).toBe(builtLocation.publicHref)\n    expect(parsedPublicHref).toBe('/fr')\n  })\n})\n\ndescribe('basepath', () => {\n  it('should handle basic basepath rewriting with input', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const homeRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div data-testid=\"home\">Home</div>,\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <div data-testid=\"about\">About</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([homeRoute, aboutRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/my-app/about'],\n      }),\n      basepath: 'my-app',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('about')).toBeInTheDocument()\n    })\n\n    // Router should interpret the URL without the basepath\n    expect(router.state.location.pathname).toBe('/about')\n  })\n\n  it.each([\n    {\n      description: 'basepath with leading and trailing slashes',\n      basepath: '/api/v1/',\n    },\n    {\n      description: 'basepath with leading slash but without trailing slash',\n      basepath: '/api/v1',\n    },\n    {\n      description: 'basepath without leading slash but with trailing slash',\n      basepath: 'api/v1/',\n    },\n    {\n      description: 'basepath without leading and trailing slashes',\n      basepath: 'api/v1',\n    },\n  ])('should handle $description', async ({ basepath }) => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const usersRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users',\n      component: () => <div data-testid=\"users\">Users</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([usersRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/api/v1/users'],\n      }),\n      basepath,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('users')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/users')\n  })\n\n  it.each([\n    { description: 'has trailing slash', basepath: '/my-app/' },\n    { description: 'has no trailing slash', basepath: '/my-app' },\n  ])(\n    'should not resolve to 404 when basepath $description and URL matches',\n    async ({ basepath }) => {\n      const rootRoute = createRootRoute({\n        component: () => <Outlet />,\n      })\n\n      const homeRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => <div data-testid=\"home\">Home</div>,\n      })\n\n      const usersRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/users',\n        component: () => <div data-testid=\"users\">Users</div>,\n      })\n\n      const routeTree = rootRoute.addChildren([homeRoute, usersRoute])\n\n      const router = createRouter({\n        routeTree,\n        history: createMemoryHistory({\n          initialEntries: ['/my-app/'],\n        }),\n        basepath,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      await waitFor(() => {\n        expect(screen.getByTestId('home')).toBeInTheDocument()\n      })\n\n      expect(router.state.location.pathname).toBe('/')\n      expect(router.state.statusCode).toBe(200)\n    },\n  )\n\n  it.each([\n    { description: 'with trailing slash', basepath: '/my-app/' },\n    { description: 'without trailing slash', basepath: '/my-app' },\n  ])(\n    'should handle basepath $description when navigating to root path',\n    async ({ basepath }) => {\n      const rootRoute = createRootRoute({\n        component: () => <Outlet />,\n      })\n\n      const homeRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <div>\n            <Link to=\"/about\" data-testid=\"about-link\">\n              About\n            </Link>\n          </div>\n        ),\n      })\n\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        component: () => <div data-testid=\"about\">About</div>,\n      })\n\n      const routeTree = rootRoute.addChildren([homeRoute, aboutRoute])\n\n      const history = createMemoryHistory({ initialEntries: ['/my-app/'] })\n\n      const router = createRouter({\n        routeTree,\n        history,\n        basepath,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const aboutLink = await screen.findByTestId('about-link')\n      fireEvent.click(aboutLink)\n\n      await waitFor(() => {\n        expect(screen.getByTestId('about')).toBeInTheDocument()\n      })\n\n      expect(router.state.location.pathname).toBe('/about')\n      expect(history.location.pathname).toBe('/my-app/about')\n    },\n  )\n\n  it('should handle empty basepath gracefully', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const testRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/test',\n      component: () => <div data-testid=\"test\">Test</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([testRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/test'],\n      }),\n      basepath: '',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    expect(await screen.findByTestId('test')).toBeInTheDocument()\n\n    expect(router.state.location.pathname).toBe('/test')\n  })\n\n  it('should combine basepath with additional input rewrite logic', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const newApiRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/api/v2',\n      component: () => <div data-testid=\"api-v2\">API v2</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([newApiRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/my-app/legacy/api/v1'],\n      }),\n      basepath: 'my-app',\n      rewrite: {\n        input: ({ url }) => {\n          if (url.pathname === '/legacy/api/v1') {\n            url.pathname = '/api/v2'\n            return url\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(<RouterProvider router={router} />)\n\n    expect(await screen.findByTestId('api-v2')).toBeInTheDocument()\n\n    // Should first remove basepath (/my-app/legacy/api/v1 -> /legacy/api/v1)\n    // Then apply additional rewrite (/legacy/api/v1 -> /api/v2)\n    expect(router.state.location.pathname).toBe('/api/v2')\n  })\n\n  it('should preserve search params and hash when rewriting basepath', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const searchRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/search',\n      component: () => <div data-testid=\"search\">Search</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([searchRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/app/search?q=test&filter=all#results'],\n      }),\n      basepath: 'app',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('search')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/search')\n    expect(router.state.location.search).toEqual({\n      q: 'test',\n      filter: 'all',\n    })\n    expect(router.state.location.hash).toBe('results')\n  })\n\n  it('should handle nested basepath with multiple rewrite layers', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const finalRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/final',\n      component: () => <div data-testid=\"final\">Final</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([finalRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/base/legacy/old/path'],\n      }),\n      basepath: 'base',\n      rewrite: composeRewrites([\n        {\n          input: ({ url }) => {\n            // First layer: convert legacy paths\n            if (url.pathname === '/legacy/old/path') {\n              url.pathname = '/new/path'\n              return url\n            }\n            return undefined\n          },\n          output: ({ url }) => {\n            // First layer: convert legacy paths\n            if (url.pathname === '/new/path') {\n              url.pathname = '/legacy/old/path'\n              return url\n            }\n            return undefined\n          },\n        },\n      ]),\n    })\n\n    // Add a second rewrite layer\n    const originalRewrite = router.options.rewrite\n    router.update({\n      rewrite: composeRewrites([\n        originalRewrite!,\n        {\n          input: ({ url }) => {\n            if (url.pathname === '/new/path') {\n              url.pathname = '/final'\n            }\n            return url\n          },\n          output: ({ url }) => {\n            if (url.pathname === '/final') {\n              url.pathname = '/new/path'\n            }\n            return url\n          },\n        },\n      ]),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    expect(router.state.location.pathname).toBe('/final')\n    expect(await screen.findByTestId('final')).toBeInTheDocument()\n\n    // Should apply: /base/legacy/old/path -> /legacy/old/path -> /new/path -> /final\n  })\n\n  it('should handle basepath with output rewriting', async () => {\n    // This test verifies that basepath is added back when navigating\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div>\n          <Link to=\"/about\" data-testid=\"about-link\">\n            About\n          </Link>\n        </div>\n      ),\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <div data-testid=\"about\">About</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\n    const history = createMemoryHistory({ initialEntries: ['/my-app/'] })\n\n    const router = createRouter({\n      routeTree,\n      history,\n      basepath: 'my-app',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const aboutLink = await screen.findByTestId('about-link')\n\n    fireEvent.click(aboutLink)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('about')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/about')\n    expect(history.location.pathname).toBe('/my-app/about')\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/searchMiddleware.test.tsx",
    "content": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\nimport { cleanup, fireEvent, render, screen } from '@testing-library/react'\n\nimport {\n  Link,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  retainSearchParams,\n  stripSearchParams,\n} from '../src'\nimport { getSearchParamsFromURI } from './utils'\nimport type { AnyRouter, RouterHistory } from '../src'\nimport type { SearchMiddleware } from '@tanstack/router-core'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  cleanup()\n})\n\nfunction setupTest(opts: {\n  initial: { route: string; search?: { value?: string } }\n  middlewares: Array<SearchMiddleware<any>>\n  linkSearch?: { value?: string }\n}) {\n  const rootRoute = createRootRoute({\n    validateSearch: (input) => {\n      if (input.value !== undefined) {\n        return { value: input.value as string }\n      }\n      return {}\n    },\n    search: {\n      middlewares: opts.middlewares,\n    },\n  })\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => {\n      return (\n        <>\n          <h1>Index</h1>\n          {/* N.B. this link does not have search params set, but the middleware will add `root` if it is currently present */}\n          <Link data-testid=\"posts-link\" to=\"/posts\" search={opts.linkSearch}>\n            Posts\n          </Link>\n        </>\n      )\n    },\n  })\n\n  const PostsComponent = () => {\n    const { value } = postsRoute.useSearch()\n    return (\n      <>\n        <h1 data-testid=\"posts-heading\">Posts</h1>\n        <div data-testid=\"search\">{value ?? '$undefined'}</div>\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    history,\n  })\n  window.history.replaceState(\n    null,\n    '',\n    `${opts.initial.route}?${new URLSearchParams(opts.initial.search).toString()}`,\n  )\n  return router\n}\n\nasync function runTest(\n  router: AnyRouter,\n  expectedSearch: { root: { value?: string }; posts: { value?: string } },\n) {\n  render(<RouterProvider router={router} />)\n\n  const postsLink = await screen.findByTestId('posts-link')\n  expect(postsLink).toHaveAttribute('href')\n  const href = postsLink.getAttribute('href')\n  const linkSearchOnRoot = getSearchParamsFromURI(href!)\n  checkLocationSearch(expectedSearch.root)\n  expect(router.state.location.search).toEqual(expectedSearch.root)\n\n  fireEvent.click(postsLink)\n\n  const postHeading = await screen.findByTestId('posts-heading')\n  expect(postHeading).toBeInTheDocument()\n  expect(window.location.pathname).toBe('/posts')\n\n  expect(await screen.findByTestId('search')).toHaveTextContent(\n    expectedSearch.posts.value ?? '$undefined',\n  )\n  checkLocationSearch(expectedSearch.posts)\n  expect(router.state.location.search).toEqual(expectedSearch.posts)\n  return linkSearchOnRoot\n}\n\nfunction checkLocationSearch(search: object) {\n  const parsedSearch = new URLSearchParams(window.location.search)\n  expect(parsedSearch.size).toBe(Object.keys(search).length)\n  for (const [key, value] of Object.entries(search)) {\n    expect(parsedSearch.get(key)).toBe(value)\n  }\n}\n\ndescribe('retainSearchParams', () => {\n  const middlewares = [retainSearchParams(['value'])]\n\n  it('should retain `value` search param', async () => {\n    const router = setupTest({\n      initial: { route: '/', search: { value: 'abc' } },\n      middlewares,\n    })\n    const linkSearch = await runTest(router, {\n      root: { value: 'abc' },\n      posts: { value: 'abc' },\n    })\n    expect(linkSearch.size).toBe(1)\n    expect(linkSearch.get('value')).toBe('abc')\n  })\n\n  it('should do nothing if `value` search param is not set', async () => {\n    const router = setupTest({ initial: { route: '/' }, middlewares })\n    const expectedLocationSearch = {}\n    const linkSearch = await runTest(router, { root: {}, posts: {} })\n    expect(linkSearch.size).toBe(0)\n    expect(router.state.location.search).toEqual(expectedLocationSearch)\n    checkLocationSearch(expectedLocationSearch)\n  })\n})\n\ndescribe('stripSearchParams', () => {\n  it('by key', async () => {\n    const middlewares = [stripSearchParams(['value'])]\n    const router = setupTest({\n      initial: { route: '/', search: { value: 'abc' } },\n      middlewares,\n      linkSearch: { value: 'xyz' },\n    })\n    const linkSearch = await runTest(router, { root: {}, posts: {} })\n    expect(linkSearch.size).toBe(0)\n  })\n\n  it('true', async () => {\n    const middlewares = [stripSearchParams(true)]\n    const router = setupTest({\n      initial: { route: '/', search: { value: 'abc' } },\n      middlewares,\n      linkSearch: { value: 'xyz' },\n    })\n    const linkSearch = await runTest(router, { root: {}, posts: {} })\n    expect(linkSearch.size).toBe(0)\n  })\n\n  it('by value', async () => {\n    const middlewares = [stripSearchParams({ value: 'abc' })]\n    const router = setupTest({\n      initial: { route: '/', search: { value: 'abc' } },\n      middlewares,\n      linkSearch: { value: 'xyz' },\n    })\n    const linkSearch = await runTest(router, {\n      root: {},\n      posts: { value: 'xyz' },\n    })\n    expect(linkSearch.size).toBe(1)\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/setupTests.tsx",
    "content": "import '@testing-library/jest-dom/vitest'\nimport { vi } from 'vitest'\n\n// @ts-expect-error\nglobal.IS_REACT_ACT_ENVIRONMENT = true\n\n// Mock window.scrollTo to silence errors in tests\nwindow.scrollTo = vi.fn()\n"
  },
  {
    "path": "packages/react-router/tests/store-updates-during-navigation.test.tsx",
    "content": "import { afterEach, describe, expect, test, vi } from 'vitest'\nimport {\n  cleanup,\n  fireEvent,\n  render,\n  screen,\n  waitFor,\n} from '@testing-library/react'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  notFound,\n  redirect,\n  useRouterState,\n} from '../src'\n\nafterEach(() => {\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\nfunction setup({\n  beforeLoad,\n  loader,\n  head,\n  headers,\n  scripts,\n  defaultPendingMs,\n  defaultPendingMinMs,\n  staleTime,\n}: {\n  beforeLoad?: () => any\n  loader?: () => any\n  head?: () => any\n  headers?: () => any\n  scripts?: () => any\n  defaultPendingMs?: number\n  defaultPendingMinMs?: number\n  staleTime?: number\n}) {\n  const select = vi.fn()\n\n  const rootRoute = createRootRoute({\n    component: function RootComponent() {\n      useRouterState({ select })\n      return (\n        <>\n          <Link to=\"/\">Back</Link>\n          <Link to=\"/posts\">Posts</Link>\n          <Outlet />\n        </>\n      )\n    },\n  })\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <h1>Index</h1>,\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n    beforeLoad,\n    loader,\n    head,\n    headers,\n    scripts,\n    component: () => <h1>Posts Title</h1>,\n  })\n\n  const otherRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/other',\n    component: () => <h1>Other Title</h1>,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([indexRoute, postsRoute, otherRoute]),\n    defaultPendingMs,\n    defaultPendingMinMs,\n    defaultPendingComponent: () => <p>Loading...</p>,\n    defaultNotFoundComponent: () => <h1>Not Found Title</h1>,\n    defaultPreload: 'intent',\n    defaultStaleTime: staleTime,\n    defaultGcTime: staleTime,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  return { select, router }\n}\n\nasync function back() {\n  const link = await waitFor(() => screen.getByRole('link', { name: 'Back' }))\n  fireEvent.click(link)\n  const title = await waitFor(() =>\n    screen.getByRole('heading', { name: /Index/ }),\n  )\n  expect(title).toBeInTheDocument()\n}\n\nasync function run({ select }: ReturnType<typeof setup>) {\n  // navigate to /posts\n  const link = await waitFor(() => screen.getByRole('link', { name: 'Posts' }))\n  const before = select.mock.calls.length\n  fireEvent.click(link)\n  const title = await waitFor(\n    () => screen.getByRole('heading', { name: /Title$/ }), // matches /posts and /other and not found\n  )\n  expect(title).toBeInTheDocument()\n  const after = select.mock.calls.length\n\n  return after - before\n}\n\nfunction resolveAfter(ms: number, value: any) {\n  return new Promise<void>((resolve) => setTimeout(() => resolve(value), ms))\n}\n\ndescribe(\"Store doesn't update *too many* times during navigation\", () => {\n  test('async loader, async beforeLoad, pendingMs', async () => {\n    const params = setup({\n      beforeLoad: () => resolveAfter(100, { foo: 'bar' }),\n      loader: () => resolveAfter(100, { hello: 'world' }),\n      defaultPendingMs: 100,\n      defaultPendingMinMs: 300,\n    })\n\n    const updates = await run(params)\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(8)\n  })\n\n  test('redirection in preload', async () => {\n    const { select, router } = setup({\n      loader: () => {\n        throw redirect({ to: '/other' })\n      },\n    })\n\n    const before = select.mock.calls.length\n    await router.preloadRoute({ to: '/posts' })\n    const after = select.mock.calls.length\n    const updates = after - before\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(1)\n  })\n\n  test('sync beforeLoad', async () => {\n    const params = setup({\n      beforeLoad: () => ({ foo: 'bar' }),\n      loader: () => resolveAfter(100, { hello: 'world' }),\n      defaultPendingMs: 100,\n      defaultPendingMinMs: 300,\n    })\n\n    const updates = await run(params)\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(5)\n  })\n\n  test('nothing', async () => {\n    const params = setup({})\n\n    const updates = await run(params)\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(3)\n  })\n\n  test('not found in beforeLoad', async () => {\n    const params = setup({\n      beforeLoad: () => {\n        throw notFound()\n      },\n    })\n\n    const updates = await run(params)\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(4)\n  })\n\n  test('hover preload, then navigate, w/ async loaders', async () => {\n    const { select } = setup({\n      beforeLoad: () => Promise.resolve({ foo: 'bar' }),\n      loader: () => resolveAfter(100, { hello: 'world' }),\n    })\n\n    const link = await waitFor(() =>\n      screen.getByRole('link', { name: 'Posts' }),\n    )\n    const before = select.mock.calls.length\n    fireEvent.focus(link)\n    await new Promise((resolve) => setTimeout(resolve, 100))\n    fireEvent.click(link)\n    const title = await waitFor(() =>\n      screen.getByRole('heading', { name: /Title$/ }),\n    )\n    expect(title).toBeInTheDocument()\n    const after = select.mock.calls.length\n    const updates = after - before\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(3)\n  })\n\n  test('navigate, w/ preloaded & async loaders', async () => {\n    const params = setup({\n      beforeLoad: () => Promise.resolve({ foo: 'bar' }),\n      loader: () => resolveAfter(100, { hello: 'world' }),\n      staleTime: 1000,\n    })\n\n    await params.router.preloadRoute({ to: '/posts' })\n    const updates = await run(params)\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(3)\n  })\n\n  test('navigate, w/ preloaded & sync loaders', async () => {\n    const params = setup({\n      beforeLoad: () => ({ foo: 'bar' }),\n      loader: () => ({ hello: 'world' }),\n      staleTime: 1000,\n    })\n\n    await params.router.preloadRoute({ to: '/posts' })\n    const updates = await run(params)\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(3)\n  })\n\n  test('navigate, w/ previous navigation & async loader', async () => {\n    const params = setup({\n      loader: () => resolveAfter(100, { hello: 'world' }),\n      staleTime: 1000,\n    })\n\n    await run(params)\n    await back()\n    const updates = await run(params)\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(3)\n  })\n\n  test('preload a preloaded route w/ async loader', async () => {\n    const params = setup({\n      loader: () => resolveAfter(100, { hello: 'world' }),\n    })\n\n    await params.router.preloadRoute({ to: '/posts' })\n    await new Promise((r) => setTimeout(r, 20))\n    const before = params.select.mock.calls.length\n    await params.router.preloadRoute({ to: '/posts' })\n    const after = params.select.mock.calls.length\n    const updates = after - before\n\n    // This number should be as small as possible to minimize the amount of work\n    // that needs to be done during a navigation.\n    // Any change that increases this number should be investigated.\n    expect(updates).toBe(0)\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/useBlocker.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter, useBlocker } from '../src'\n\ntest('blocker without resolver', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(useBlocker<DefaultRouter, false>).returns.toBeVoid()\n})\n\ntest('blocker with resolver', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(useBlocker<DefaultRouter, true>).returns.toBeObject()\n})\n\ntest('shouldBlockFn has corrent action', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(useBlocker<DefaultRouter>)\n    .parameter(0)\n    .toHaveProperty('shouldBlockFn')\n    .parameter(0)\n    .toHaveProperty('action')\n    .toEqualTypeOf<'PUSH' | 'REPLACE' | 'FORWARD' | 'BACK' | 'GO'>()\n\n  expectTypeOf(useBlocker<DefaultRouter>)\n    .parameter(0)\n    .toHaveProperty('shouldBlockFn')\n    .parameter(0)\n    .toHaveProperty('current')\n    .toHaveProperty('routeId')\n    .toEqualTypeOf<'__root__' | '/' | '/invoices' | '/invoices/'>()\n\n  expectTypeOf(useBlocker<DefaultRouter>)\n    .parameter(0)\n    .toHaveProperty('shouldBlockFn')\n    .parameter(0)\n    .toHaveProperty('next')\n    .toHaveProperty('routeId')\n    .toEqualTypeOf<'__root__' | '/' | '/invoices' | '/invoices/'>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/useBlocker.test.tsx",
    "content": "import React from 'react'\nimport '@testing-library/jest-dom/vitest'\nimport { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, fireEvent, render, screen } from '@testing-library/react'\n\nimport { z } from 'zod'\nimport {\n  RouterProvider,\n  createBrowserHistory,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useBlocker,\n  useNavigate,\n} from '../src'\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  cleanup()\n})\n\ndescribe('useBlocker', () => {\n  test('does not block navigation when not enabled', async () => {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n\n      useBlocker({ shouldBlockFn: () => false })\n\n      return (\n        <>\n          <h1>Index</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n          <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n  })\n\n  test('does not block navigation when disabled', async () => {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n\n      useBlocker({ shouldBlockFn: () => true, disabled: true })\n\n      return (\n        <>\n          <h1>Index</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n          <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n  })\n\n  test('blocks navigation when enabled', async () => {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n\n      useBlocker({ shouldBlockFn: () => true })\n\n      return (\n        <>\n          <h1>Index</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n          <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n  })\n\n  test('gives correct arguments to shouldBlockFn', async () => {\n    const rootRoute = createRootRoute()\n\n    const shouldBlockFn = vi.fn().mockReturnValue(true)\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n\n      useBlocker({ shouldBlockFn })\n\n      return (\n        <>\n          <h1>Index</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n          <button onClick={() => navigate({ to: '/posts', replace: true })}>\n            Posts\n          </button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    expect(shouldBlockFn).toHaveBeenCalledWith({\n      action: 'REPLACE',\n      current: {\n        routeId: indexRoute.id,\n        fullPath: indexRoute.fullPath,\n        pathname: '/',\n        params: {},\n        search: {},\n      },\n      next: {\n        routeId: postsRoute.id,\n        fullPath: postsRoute.fullPath,\n        pathname: '/posts',\n        params: {},\n        search: {},\n      },\n    })\n  })\n\n  test('gives correct arguments to shouldBlockFn with path and search params', async () => {\n    const rootRoute = createRootRoute()\n\n    const shouldBlockFn = vi.fn().mockReturnValue(true)\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n\n      useBlocker({ shouldBlockFn })\n\n      return (\n        <>\n          <h1>Index</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n          <button\n            onClick={() =>\n              navigate({\n                to: '/posts/$postId',\n                params: { postId: '10' },\n                search: { param1: 'foo', param2: 'bar' },\n              })\n            }\n          >\n            Posts\n          </button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      validateSearch: z.object({\n        param1: z.string().default('param1-default'),\n        param2: z.string().default('param2-default'),\n      }),\n      path: '/posts/$postId',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    expect(shouldBlockFn).toHaveBeenCalledWith({\n      action: 'PUSH',\n      current: {\n        routeId: indexRoute.id,\n        fullPath: indexRoute.fullPath,\n        pathname: '/',\n        params: {},\n        search: {},\n      },\n      next: {\n        routeId: postsRoute.id,\n        fullPath: postsRoute.fullPath,\n        pathname: '/posts/10',\n        params: { postId: '10' },\n        search: { param1: 'foo', param2: 'bar' },\n      },\n    })\n  })\n\n  test('conditionally blocking navigation works', async () => {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n\n      useBlocker<Router>({\n        shouldBlockFn: ({ next }) => {\n          if (next.fullPath === '/posts') {\n            return true\n          }\n          return false\n        },\n      })\n\n      return (\n        <>\n          <h1>Index</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n          <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n          <button onClick={() => navigate({ to: '/invoices' })}>\n            Invoices\n          </button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/invoices',\n      component: () => {\n        return (\n          <>\n            <h1>Invoices</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute, invoicesRoute]),\n      history,\n    })\n\n    type Router = typeof router\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    const invoicesButton = await screen.findByRole('button', {\n      name: 'Invoices',\n    })\n\n    fireEvent.click(invoicesButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Invoices' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/invoices')\n  })\n\n  test('should allow navigation from 404 page when blocker is active', async () => {\n    const rootRoute = createRootRoute({\n      notFoundComponent: function NotFoundComponent() {\n        const navigate = useNavigate()\n\n        useBlocker({ shouldBlockFn: () => true })\n\n        return (\n          <>\n            <h1>Not Found</h1>\n            <button onClick={() => navigate({ to: '/' })}>Go Home</button>\n            <button onClick={() => navigate({ to: '/posts' })}>\n              Go to Posts\n            </button>\n          </>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await router.navigate({ to: '/non-existent' as any })\n\n    expect(\n      await screen.findByRole('heading', { name: 'Not Found' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/non-existent')\n\n    const homeButton = await screen.findByRole('button', { name: 'Go Home' })\n    fireEvent.click(homeButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n  })\n\n  test('should handle blocker navigation from 404 to another 404', async () => {\n    const rootRoute = createRootRoute({\n      notFoundComponent: function NotFoundComponent() {\n        const navigate = useNavigate()\n\n        useBlocker({ shouldBlockFn: () => true })\n\n        return (\n          <>\n            <h1>Not Found</h1>\n            <button onClick={() => navigate({ to: '/another-404' as any })}>\n              Go to Another 404\n            </button>\n          </>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      history,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    await router.navigate({ to: '/non-existent' })\n\n    expect(\n      await screen.findByRole('heading', { name: 'Not Found' }),\n    ).toBeInTheDocument()\n\n    const anotherButton = await screen.findByRole('button', {\n      name: 'Go to Another 404',\n    })\n    fireEvent.click(anotherButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Not Found' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/non-existent')\n  })\n\n  test('navigate function should handle external URLs with ignoreBlocker', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div>Home</div>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n    })\n\n    await expect(\n      router.navigate({\n        to: 'https://example.com',\n        ignoreBlocker: true,\n      }),\n    ).resolves.toBeUndefined()\n\n    await expect(\n      router.navigate({\n        to: 'https://example.com',\n      }),\n    ).resolves.toBeUndefined()\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/useCanGoBack.test.tsx",
    "content": "import { beforeEach, describe, expect, test } from 'vitest'\nimport { cleanup, fireEvent, render, screen } from '@testing-library/react'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useCanGoBack,\n  useLocation,\n  useRouter,\n} from '../src'\n\nbeforeEach(() => {\n  cleanup()\n})\n\ndescribe('useCanGoBack', () => {\n  function setup({\n    initialEntries = ['/'],\n  }: {\n    initialEntries?: Array<string>\n  } = {}) {\n    function RootComponent() {\n      const router = useRouter()\n      const location = useLocation()\n      const canGoBack = useCanGoBack()\n\n      expect(canGoBack).toBe(location.pathname === '/' ? false : true)\n\n      return (\n        <>\n          <button onClick={() => router.history.back()}>Back</button>\n          <Link to=\"/\">Home</Link>\n          <Link to=\"/about\">About</Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const rootRoute = createRootRoute({\n      component: RootComponent,\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <h1>IndexTitle</h1>,\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <h1>AboutTitle</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, aboutRoute]),\n      history: createMemoryHistory({ initialEntries }),\n    })\n\n    return render(<RouterProvider router={router} />)\n  }\n\n  test('when no location behind', async () => {\n    setup()\n\n    const indexTitle = await screen.findByText('IndexTitle')\n    expect(indexTitle).toBeInTheDocument()\n\n    const aboutLink = await screen.findByText('About')\n    fireEvent.click(aboutLink)\n\n    const aboutTitle = await screen.findByText('AboutTitle')\n    expect(aboutTitle).toBeInTheDocument()\n  })\n\n  test('when location behind', async () => {\n    setup({\n      initialEntries: ['/', '/about'],\n    })\n\n    const aboutTitle = await screen.findByText('AboutTitle')\n    expect(aboutTitle).toBeInTheDocument()\n\n    const backButton = await screen.findByText('Back')\n    fireEvent.click(backButton)\n\n    const indexTitle = await screen.findByText('IndexTitle')\n    expect(indexTitle).toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/useLoaderData.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useLoaderData,\n} from '../src'\n\ntest('when there is no loaders', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(useLoaderData<DefaultRouter>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<'/invoices' | '__root__' | '/invoices/' | '/'>()\n\n  expectTypeOf(useLoaderData<DefaultRouter>)\n    .parameter(0)\n    .toHaveProperty('strict')\n    .toEqualTypeOf<true | undefined>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .parameter(0)\n    .toMatchTypeOf<undefined>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/'>,\n  ).returns.toEqualTypeOf<undefined>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/', false>({ strict: false }))\n    .toEqualTypeOf<undefined>\n})\n\ntest('when there is one loader', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    loader: () => ({ data: ['element1', 'element2'] }),\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n    context: { userId: 'userId' },\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices'>,\n  ).returns.toEqualTypeOf<{ data: Array<string> }>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices'>,\n  ).returns.toEqualTypeOf<{ data: Array<string> }>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', false>,\n  ).returns.toEqualTypeOf<{ data?: Array<string> } | undefined>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices', false>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', false, number>,\n  ).returns.toEqualTypeOf<number>()\n})\n\ntest('when there is one loader that is async', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    loader: () => Promise.resolve({ data: ['element1', 'element2'] }),\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n    context: { userId: 'userId' },\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices'>,\n  ).returns.toEqualTypeOf<{ data: Array<string> }>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices'>,\n  ).returns.toEqualTypeOf<{ data: Array<string> }>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', false>,\n  ).returns.toEqualTypeOf<{ data?: Array<string> } | undefined>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices', false>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', false, number>,\n  ).returns.toEqualTypeOf<number>()\n})\n\ntest('when there are multiple loaders', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    loader: () => ({ data: ['invoice1', 'invoice2'] }) as const,\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    loader: () => ({ data: ['post1', 'post2'] }) as const,\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute]),\n    postsRoute,\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/'>,\n  ).returns.toEqualTypeOf<undefined>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices'>,\n  ).returns.toEqualTypeOf<{\n    readonly data: readonly ['invoice1', 'invoice2']\n  }>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', false>,\n  ).returns.toEqualTypeOf<\n    | {\n        data?:\n          | readonly ['invoice1', 'invoice2']\n          | readonly ['post1', 'post2']\n          | undefined\n      }\n    | undefined\n  >()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices', false>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices', false>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .parameter(0)\n    .toEqualTypeOf<\n      | {\n          data?:\n            | readonly ['invoice1', 'invoice2']\n            | readonly ['post1', 'post2']\n            | undefined\n        }\n      | undefined\n    >()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', true, { func: () => void }>,\n  )\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .exclude<undefined>()\n    .returns.toEqualTypeOf<{ func: () => void }>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', true, { func: () => void }>,\n  )\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<false | undefined>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', true, { func: () => void }, true>,\n  )\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .exclude<undefined>()\n    .returns.toEqualTypeOf<{ func: 'Function is not serializable' }>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', true, { func: () => void }, true>,\n  )\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<false | undefined>()\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const routerWithStructuralSharing = createRouter({\n    routeTree,\n    defaultStructuralSharing: true,\n  })\n\n  expectTypeOf(\n    useLoaderData<\n      typeof routerWithStructuralSharing,\n      '/invoices',\n      true,\n      { func: () => void },\n      true\n    >,\n  )\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .exclude<undefined>()\n    .returns.toEqualTypeOf<{\n      func: 'Function is not serializable'\n    }>()\n\n  expectTypeOf(\n    useLoaderData<\n      typeof routerWithStructuralSharing,\n      '/invoices',\n      true,\n      { func: () => void },\n      true\n    >,\n  )\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<false>()\n})\n\ntest('when there are multiple loaders of objects and primtives', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    loader: () => ['invoice1', 'invoice2'] as const,\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n    loader: () => ({ invoice: { id: 1 } }) as const,\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    loader: () => ['post1', 'post2'] as const,\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute]),\n    indexRoute,\n    postsRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/'>,\n  ).returns.toEqualTypeOf<undefined>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices'>).returns.toEqualTypeOf<\n    readonly ['invoice1', 'invoice2']\n  >()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .parameter(0)\n    .toEqualTypeOf<readonly ['invoice1', 'invoice2']>()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/invoices', false>,\n  ).returns.toEqualTypeOf<\n    | readonly ['invoice1', 'invoice2']\n    | readonly ['post1', 'post2']\n    | {\n        invoice?:\n          | {\n              readonly id: 1\n            }\n          | undefined\n      }\n    | undefined\n  >()\n\n  expectTypeOf(useLoaderData<DefaultRouter, '/invoices', false>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .parameter(0)\n    .toEqualTypeOf<\n      | readonly ['invoice1', 'invoice2']\n      | readonly ['post1', 'post2']\n      | {\n          invoice?:\n            | {\n                readonly id: 1\n              }\n            | undefined\n        }\n      | undefined\n    >()\n})\n"
  },
  {
    "path": "packages/react-router/tests/useLocation.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter, useLocation } from '../src'\nimport type { ParsedLocation } from '../src'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst routeTree = rootRoute.addChildren([invoicesRoute, indexRoute])\n\nconst defaultRouter = createRouter({ routeTree })\n\ntype DefaultRouter = typeof defaultRouter\n\ntest('should have the types for a ParsedLocation in useLocation', () => {\n  const location = useLocation<DefaultRouter>()\n\n  expectTypeOf(location).toEqualTypeOf<ParsedLocation>()\n  expectTypeOf(location)\n    .toHaveProperty('pathname')\n    .toEqualTypeOf<ParsedLocation['pathname']>()\n})\n\ntest('should have the type of string for selecting the pathname in useLocation', () => {\n  const pathname = useLocation<DefaultRouter, string>({\n    select: (state) => state.pathname,\n  })\n\n  expectTypeOf(pathname).toMatchTypeOf<ParsedLocation['pathname']>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/useLocation.test.tsx",
    "content": "import { useEffect } from 'react'\nimport { afterEach, describe, expect, test, vi } from 'vitest'\nimport { act, cleanup, render, screen, waitFor } from '@testing-library/react'\nimport {\n  Outlet,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useLocation,\n} from '../src'\n\nafterEach(() => {\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ndescribe('useLocation', () => {\n  test('keeps a selected pathname reference stable across search and hash updates when structural sharing is enabled', async () => {\n    const effectSpy = vi.fn()\n    const pathnameSelections: Array<{ pathname: string }> = []\n\n    const rootRoute = createRootRoute({\n      component: function RootComponent() {\n        const pathnameSelection = useLocation({\n          select: (location) => ({ pathname: location.pathname }),\n        })\n\n        useEffect(() => {\n          effectSpy(pathnameSelection)\n          pathnameSelections.push(pathnameSelection)\n        }, [pathnameSelection])\n\n        return <Outlet />\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1>Posts</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([postsRoute]),\n      history: createMemoryHistory({\n        initialEntries: ['/posts?foo=one#first'],\n      }),\n      defaultStructuralSharing: true,\n    })\n\n    render(<RouterProvider router={router} />)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    await waitFor(() => expect(effectSpy).toHaveBeenCalledTimes(1))\n\n    const initialPathnameSelection = pathnameSelections[0]\n\n    await act(() =>\n      router.navigate({\n        to: '/posts',\n        search: { foo: 'two' },\n        hash: 'first',\n      }),\n    )\n\n    await waitFor(() => {\n      expect(router.state.location.search).toEqual({ foo: 'two' })\n      expect(effectSpy).toHaveBeenCalledTimes(1)\n    })\n\n    await act(() =>\n      router.navigate({\n        to: '/posts',\n        search: { foo: 'two' },\n        hash: 'second',\n      }),\n    )\n\n    await waitFor(() => {\n      expect(router.state.location.hash).toBe('second')\n      expect(effectSpy).toHaveBeenCalledTimes(1)\n    })\n\n    expect(pathnameSelections).toHaveLength(1)\n    expect(pathnameSelections[0]).toBe(initialPathnameSelection)\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/useMatch.test-d.tsx",
    "content": "import { describe, expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter, useMatch } from '../src'\nimport type { MakeRouteMatch, MakeRouteMatchUnion } from '@tanstack/router-core'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst routeTree = rootRoute.addChildren([invoicesRoute, indexRoute])\n\n// eslint-disable-next-line unused-imports/no-unused-vars\nconst defaultRouter = createRouter({ routeTree })\n\ntype DefaultRouter = typeof defaultRouter\n\ntype TRouteMatch = MakeRouteMatch<DefaultRouter['routeTree']>\n\ndescribe('useMatch', () => {\n  describe('shouldThrow', () => {\n    const from = '/invoices'\n    test('return type is `RouteMatch` when shouldThrow = true', () => {\n      const shouldThrow = true\n      const match = useMatch<\n        DefaultRouter,\n        typeof from,\n        true, // TStrict\n        typeof shouldThrow,\n        TRouteMatch\n      >({ from, shouldThrow })\n\n      expectTypeOf(match).toEqualTypeOf<TRouteMatch>()\n    })\n\n    test('return type is `RouteMatch | undefined` when shouldThrow = false', () => {\n      const shouldThrow = false\n      const match = useMatch<\n        DefaultRouter,\n        typeof from,\n        true, // TStrict\n        typeof shouldThrow,\n        TRouteMatch\n      >({ from, shouldThrow })\n\n      expectTypeOf(match).toEqualTypeOf<TRouteMatch | undefined>()\n    })\n  })\n\n  test('return type is union of matches when strict = false', () => {\n    const strict = false as const\n    const match = useMatch<DefaultRouter, typeof undefined, typeof strict>({\n      strict,\n    })\n\n    expectTypeOf(match).toEqualTypeOf<MakeRouteMatchUnion<DefaultRouter>>()\n  })\n\n  test('shouldThrow must be false when strict is false', () => {\n    const strict = false as const\n    const shouldThrow = true as const\n    useMatch<\n      DefaultRouter,\n      typeof undefined,\n      typeof strict,\n      typeof shouldThrow\n    >({\n      strict,\n      // @ts-expect-error shouldThrow must be false when strict is false\n      shouldThrow,\n    })\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/useMatch.test.tsx",
    "content": "import { afterEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, render, screen, waitFor } from '@testing-library/react'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useMatch,\n} from '../src'\nimport type { RouteComponent, RouterHistory } from '../src'\n\nafterEach(() => {\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ndescribe('useMatch', () => {\n  function setup({\n    RootComponent,\n    history,\n  }: {\n    RootComponent: RouteComponent\n    history?: RouterHistory\n  }) {\n    const rootRoute = createRootRoute({\n      component: RootComponent,\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>IndexTitle</h1>\n          <Link to=\"/posts\">Posts</Link>\n        </>\n      ),\n    })\n\n    history = history || createMemoryHistory({ initialEntries: ['/'] })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1>PostsTitle</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    return render(<RouterProvider router={router} />)\n  }\n\n  describe('when match is found', () => {\n    test.each([true, false, undefined])(\n      'returns the match if shouldThrow = %s',\n      async (shouldThrow) => {\n        function RootComponent() {\n          const match = useMatch({ from: '/posts', shouldThrow })\n          expect(match).toBeDefined()\n          expect(match!.routeId).toBe('/posts')\n          return <Outlet />\n        }\n\n        setup({\n          RootComponent,\n          history: createMemoryHistory({ initialEntries: ['/posts'] }),\n        })\n        const postsTitle = await screen.findByText('PostsTitle')\n        expect(postsTitle).toBeInTheDocument()\n      },\n    )\n  })\n\n  describe('when match is not found', () => {\n    test.each([undefined, true])(\n      'throws if shouldThrow = %s',\n      async (shouldThrow) => {\n        function RootComponent() {\n          useMatch({ from: '/posts', shouldThrow })\n          return <Outlet />\n        }\n        setup({ RootComponent })\n        const postsError = await screen.findByText(\n          'Invariant failed: Could not find an active match from \"/posts\"',\n        )\n        expect(postsError).toBeInTheDocument()\n      },\n    )\n\n    describe('returns undefined if shouldThrow = false', () => {\n      test('without select function', async () => {\n        function RootComponent() {\n          const match = useMatch({ from: 'posts', shouldThrow: false })\n          expect(match).toBeUndefined()\n          return <Outlet />\n        }\n        setup({ RootComponent })\n        expect(\n          await waitFor(() => screen.findByText('IndexTitle')),\n        ).toBeInTheDocument()\n      })\n      test('with select function', async () => {\n        const select = vi.fn()\n        function RootComponent() {\n          const match = useMatch({ from: 'posts', shouldThrow: false, select })\n          expect(match).toBeUndefined()\n          return <Outlet />\n        }\n        setup({ RootComponent })\n        const indexTitle = await screen.findByText('IndexTitle')\n        expect(indexTitle).toBeInTheDocument()\n        expect(select).not.toHaveBeenCalled()\n      })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/useNavigate.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter, useNavigate } from '../src'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n})\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\ntest('when navigating to a route', () => {\n  const navigate = useNavigate()\n\n  expectTypeOf(navigate<DefaultRouter, '/invoices'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<'/' | '/invoices' | '/invoices/$invoiceId' | '.' | '..'>()\n})\n\ntest('when setting a default from', () => {\n  expectTypeOf(useNavigate<DefaultRouter, '/'>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      '/invoices' | '/' | '/invoices/$invoiceId' | '/invoices/' | undefined\n    >()\n})\n\ntest('when setting an invalid default from', () => {\n  expectTypeOf(useNavigate<DefaultRouter, '/invalid'>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      '/invoices' | '/' | '/invoices/$invoiceId' | '/invoices/' | undefined\n    >()\n})\n"
  },
  {
    "path": "packages/react-router/tests/useNavigate.test.tsx",
    "content": "import React, { act } from 'react'\nimport '@testing-library/jest-dom/vitest'\nimport { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\nimport {\n  cleanup,\n  configure,\n  fireEvent,\n  render,\n  screen,\n} from '@testing-library/react'\n\nimport { z } from 'zod'\n\nimport { trailingSlashOptions } from '@tanstack/router-core'\nimport {\n  Navigate,\n  Outlet,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouteMask,\n  createRouter,\n  getRouteApi,\n  useNavigate,\n  useParams,\n} from '../src'\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  cleanup()\n})\n\ntest('when navigating to /posts', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/' })}>Index</button>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n    component: () => {\n      return (\n        <>\n          <h1>Posts</h1>\n        </>\n      )\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n  fireEvent.click(postsButton)\n\n  expect(\n    await screen.findByRole('heading', { name: 'Posts' }),\n  ).toBeInTheDocument()\n\n  expect(window.location.pathname).toBe('/posts')\n})\n\ntest('when navigating from /posts to ./$postId', async () => {\n  const rootRoute = createRootRoute()\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button\n          onClick={() =>\n            navigate({ to: '/posts/$postId', params: { postId: 'id1' } })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostsIndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Posts Index</h1>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/posts/',\n              to: './$postId',\n              params: { postId: 'id1' },\n            })\n          }\n        >\n          To the first post\n        </button>\n      </>\n    )\n  }\n\n  const postsIndexRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '/',\n    component: PostsIndexComponent,\n  })\n\n  const PostComponent = () => {\n    const params = useParams({ strict: false })\n    const navigate = useNavigate()\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <button onClick={() => navigate({ to: '/' })}>Index</button>\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      postsRoute.addChildren([postsIndexRoute, postRoute]),\n    ]),\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n  fireEvent.click(postsButton)\n\n  expect(await screen.findByText('Posts Index')).toBeInTheDocument()\n\n  const postButton = await screen.findByRole('button', {\n    name: 'To the first post',\n  })\n\n  fireEvent.click(postButton)\n\n  expect(await screen.findByText('Params: id1')).toBeInTheDocument()\n\n  expect(window.location.pathname).toBe('/posts/id1')\n})\n\ntest('when navigating from /posts to ../posts/$postId', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button\n          onClick={() =>\n            navigate({ to: '/posts/$postId', params: { postId: 'id1' } })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostsIndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Posts Index</h1>\n        <button\n          onClick={() =>\n            navigate({\n              from: '/posts/',\n              to: '../posts/$postId',\n              params: { postId: 'id1' },\n            })\n          }\n        >\n          To the first post\n        </button>\n      </>\n    )\n  }\n\n  const postsIndexRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '/',\n    component: PostsIndexComponent,\n  })\n\n  const PostComponent = () => {\n    const navigate = useNavigate()\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <button onClick={() => navigate({ to: '/' })}>Index</button>\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      postsRoute.addChildren([postsIndexRoute, postRoute]),\n    ]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n  fireEvent.click(postsButton)\n\n  expect(await screen.findByText('Posts Index')).toBeInTheDocument()\n\n  const postButton = await screen.findByRole('button', {\n    name: 'To the first post',\n  })\n\n  fireEvent.click(postButton)\n\n  expect(await screen.findByText('Params: id1')).toBeInTheDocument()\n})\n\ntest('when navigating from /posts/$postId to /posts/$postId/info and the current route is /posts/$postId/details', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '/posts/$postId/details',\n              params: { postId: 'id1' },\n            })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const layoutRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '_layout',\n    component: () => {\n      return (\n        <>\n          <h1>Layout</h1>\n          <Outlet />\n        </>\n      )\n    },\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => layoutRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostComponent = () => {\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const DetailsComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Details!</h1>\n        <button\n          onClick={() =>\n            navigate({ from: '/posts/$postId', to: '/posts/$postId/info' })\n          }\n        >\n          To Information\n        </button>\n      </>\n    )\n  }\n\n  const detailsRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'details',\n    component: DetailsComponent,\n  })\n\n  const InformationComponent = () => {\n    return (\n      <>\n        <h1>Information</h1>\n      </>\n    )\n  }\n\n  const informationRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'info',\n    component: InformationComponent,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      layoutRoute.addChildren([\n        postsRoute.addChildren([\n          postRoute.addChildren([detailsRoute, informationRoute]),\n        ]),\n      ]),\n    ]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postsButton = await screen.findByRole('button', {\n    name: 'To first post',\n  })\n\n  fireEvent.click(postsButton)\n\n  expect(await screen.findByText('Params: id1')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1/details')\n\n  const informationButton = await screen.findByRole('button', {\n    name: 'To Information',\n  })\n\n  fireEvent.click(informationButton)\n\n  expect(await screen.findByText('Information')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1/info')\n\n  expect(await screen.findByText('Params: id1'))\n})\n\ntest('when navigating from /posts/$postId to ./info and the current route is /posts/$postId/details', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '/posts/$postId/details',\n              params: { postId: 'id1' },\n            })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const layoutRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '_layout',\n    component: () => {\n      return (\n        <>\n          <h1>Layout</h1>\n          <Outlet />\n        </>\n      )\n    },\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => layoutRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostComponent = () => {\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const DetailsComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Details!</h1>\n        <button\n          onClick={() => navigate({ from: '/posts/$postId', to: './info' })}\n        >\n          To Information\n        </button>\n      </>\n    )\n  }\n\n  const detailsRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'details',\n    component: DetailsComponent,\n  })\n\n  const InformationComponent = () => {\n    return (\n      <>\n        <h1>Information</h1>\n      </>\n    )\n  }\n\n  const informationRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'info',\n    component: InformationComponent,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      layoutRoute.addChildren([\n        postsRoute.addChildren([\n          postRoute.addChildren([detailsRoute, informationRoute]),\n        ]),\n      ]),\n    ]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postsButton = await screen.findByRole('button', {\n    name: 'To first post',\n  })\n\n  fireEvent.click(postsButton)\n\n  expect(await screen.findByText('Params: id1')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1/details')\n\n  const informationButton = await screen.findByRole('button', {\n    name: 'To Information',\n  })\n\n  fireEvent.click(informationButton)\n\n  expect(await screen.findByText('Information')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1/info')\n\n  expect(await screen.findByText('Params: id1'))\n})\n\ntest('when navigating from /posts/$postId to ../$postId and the current route is /posts/$postId/details', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '/posts/$postId/details',\n              params: { postId: 'id1' },\n            })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const layoutRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '_layout',\n    component: () => {\n      return (\n        <>\n          <h1>Layout</h1>\n          <Outlet />\n        </>\n      )\n    },\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => layoutRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostComponent = () => {\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const DetailsComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Details!</h1>\n        <button\n          onClick={() => navigate({ from: '/posts/$postId', to: '../$postId' })}\n        >\n          To Post\n        </button>\n      </>\n    )\n  }\n\n  const detailsRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'details',\n    component: DetailsComponent,\n  })\n\n  const InformationComponent = () => {\n    return (\n      <>\n        <h1>Information</h1>\n      </>\n    )\n  }\n\n  const informationRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'info',\n    component: InformationComponent,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      layoutRoute.addChildren([\n        postsRoute.addChildren([\n          postRoute.addChildren([detailsRoute, informationRoute]),\n        ]),\n      ]),\n    ]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postsButton = await screen.findByRole('button', {\n    name: 'To first post',\n  })\n\n  fireEvent.click(postsButton)\n\n  expect(await screen.findByText('Params: id1')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1/details')\n\n  const postButton = await screen.findByRole('button', {\n    name: 'To Post',\n  })\n\n  fireEvent.click(postButton)\n\n  expect(await screen.findByText('Posts')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1')\n})\n\ntest('when navigating from /posts/$postId with an index to ../$postId and the current route is /posts/$postId/details', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '/posts/$postId/details',\n              params: { postId: 'id1' },\n            })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const layoutRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '_layout',\n    component: () => {\n      return (\n        <>\n          <h1>Layout</h1>\n          <Outlet />\n        </>\n      )\n    },\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => layoutRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostComponent = () => {\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const postIndexRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: '/',\n    component: () => <h1>Post Index</h1>,\n  })\n\n  const DetailsComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Details!</h1>\n        <button\n          onClick={() => navigate({ from: '/posts/$postId', to: '../$postId' })}\n        >\n          To Post\n        </button>\n      </>\n    )\n  }\n\n  const detailsRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'details',\n    component: DetailsComponent,\n  })\n\n  const InformationComponent = () => {\n    return (\n      <>\n        <h1>Information</h1>\n      </>\n    )\n  }\n\n  const informationRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'info',\n    component: InformationComponent,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      layoutRoute.addChildren([\n        postsRoute.addChildren([\n          postRoute.addChildren([\n            postIndexRoute,\n            detailsRoute,\n            informationRoute,\n          ]),\n        ]),\n      ]),\n    ]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postsButton = await screen.findByRole('button', {\n    name: 'To first post',\n  })\n\n  fireEvent.click(postsButton)\n\n  expect(await screen.findByText('Params: id1')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1/details')\n\n  const postButton = await screen.findByRole('button', {\n    name: 'To Post',\n  })\n\n  fireEvent.click(postButton)\n\n  expect(await screen.findByText('Posts')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1')\n})\n\ntest('when navigating from /invoices to ./invoiceId and the current route is /posts/$postId/details', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button\n          onClick={() =>\n            navigate({\n              to: '/posts/$postId/details',\n              params: { postId: 'id1' },\n            })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const layoutRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '_layout',\n    component: () => {\n      return (\n        <>\n          <h1>Layout</h1>\n          <Outlet />\n        </>\n      )\n    },\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => layoutRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostComponent = () => {\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const DetailsComponent = () => {\n    const navigate = useNavigate()\n    const [error, setError] = React.useState<unknown>()\n    return (\n      <>\n        <h1>Details!</h1>\n        <button\n          onClick={() => {\n            try {\n              navigate({\n                from: '/invoices',\n                to: './$invoiceId',\n                params: { invoiceId: 'id1' },\n              })\n            } catch (e) {\n              setError(e)\n            }\n          }}\n        >\n          To Invoices\n        </button>\n        <span>Something went wrong!</span>\n      </>\n    )\n  }\n\n  const detailsRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'details',\n    component: DetailsComponent,\n  })\n\n  const InformationComponent = () => {\n    return (\n      <>\n        <h1>Information</h1>\n      </>\n    )\n  }\n\n  const informationRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'info',\n    component: InformationComponent,\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    component: () => (\n      <>\n        <h1>Invoices!</h1>\n        <Outlet />\n      </>\n    ),\n  })\n\n  const InvoiceComponent = () => {\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>invoiceId: {params.invoiceId}</span>\n      </>\n    )\n  }\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    component: InvoiceComponent,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      layoutRoute.addChildren([\n        invoicesRoute.addChildren([invoiceRoute]),\n        postsRoute.addChildren([\n          postRoute.addChildren([detailsRoute, informationRoute]),\n        ]),\n      ]),\n    ]),\n    history,\n  })\n\n  const consoleWarn = vi.spyOn(console, 'warn').mockImplementation(() => {})\n\n  render(<RouterProvider router={router} />)\n\n  const postsButton = await screen.findByRole('button', {\n    name: 'To first post',\n  })\n\n  fireEvent.click(postsButton)\n\n  const invoicesButton = await screen.findByRole('button', {\n    name: 'To Invoices',\n  })\n\n  fireEvent.click(invoicesButton)\n\n  expect(consoleWarn).toHaveBeenCalledWith(\n    'Could not find match for from: /invoices',\n  )\n\n  consoleWarn.mockRestore()\n})\n\ntest('when navigating to /posts/$postId/info which is masked as /posts/$postId', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button\n          onClick={() =>\n            navigate({ to: '/posts/$postId/info', params: { postId: 'id1' } })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostComponent = () => {\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const InformationComponent = () => {\n    return (\n      <>\n        <h1>Information</h1>\n      </>\n    )\n  }\n\n  const informationRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'info',\n    component: InformationComponent,\n  })\n\n  const routeTree = rootRoute.addChildren([\n    indexRoute,\n    postsRoute.addChildren([postRoute.addChildren([informationRoute])]),\n  ])\n\n  const routeMask = createRouteMask({\n    routeTree,\n    from: '/posts/$postId/info',\n    to: '/posts',\n  })\n\n  const router = createRouter({\n    routeTree,\n    routeMasks: [routeMask],\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postButton = await screen.findByRole('button', {\n    name: 'To first post',\n  })\n\n  fireEvent.click(postButton)\n\n  expect(await screen.findByText('Params: id1'))\n})\n\ntest('when navigating to /posts/$postId/info which is imperatively masked as /posts/$postId', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button\n          onClick={() =>\n            navigate({\n              to: '/posts/$postId/info',\n              params: { postId: 'id1' },\n              mask: { to: '/posts/$postId', params: { postId: 'id1' } },\n            })\n          }\n        >\n          To first post\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const PostsComponent = () => {\n    return (\n      <>\n        <h1>Posts</h1>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const PostComponent = () => {\n    const params = useParams({ strict: false })\n    return (\n      <>\n        <span>Params: {params.postId}</span>\n        <Outlet />\n      </>\n    )\n  }\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    component: PostComponent,\n  })\n\n  const InformationComponent = () => {\n    return (\n      <>\n        <h1>Information</h1>\n      </>\n    )\n  }\n\n  const informationRoute = createRoute({\n    getParentRoute: () => postRoute,\n    path: 'info',\n    component: InformationComponent,\n  })\n\n  const routeTree = rootRoute.addChildren([\n    indexRoute,\n    postsRoute.addChildren([postRoute.addChildren([informationRoute])]),\n  ])\n\n  const router = createRouter({\n    routeTree,\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const postButton = await screen.findByRole('button', {\n    name: 'To first post',\n  })\n\n  fireEvent.click(postButton)\n\n  expect(await screen.findByText('Information')).toBeInTheDocument()\n\n  expect(window.location.pathname).toEqual('/posts/id1')\n})\n\ntest('when setting search params with 2 parallel navigate calls', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    const search = indexRoute.useSearch()\n    return (\n      <>\n        <h1>Index</h1>\n        <div data-testid=\"param1\">{search.param1}</div>\n        <div data-testid=\"param2\">{search.param2}</div>\n        <button\n          onClick={() => {\n            navigate({\n              to: '/',\n              search: (prev: any) => ({ ...prev, param1: 'foo' }),\n            })\n\n            navigate({\n              to: '/',\n              search: (prev: any) => ({ ...prev, param2: 'bar' }),\n            })\n          }}\n        >\n          search\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n    validateSearch: z.object({\n      param1: z.string().default('param1-default'),\n      param2: z.string().default('param2-default'),\n    }),\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([indexRoute]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n  expect(router.state.location.search).toEqual({\n    param1: 'param1-default',\n    param2: 'param2-default',\n  })\n\n  const postsButton = await screen.findByRole('button', { name: 'search' })\n\n  fireEvent.click(postsButton)\n\n  expect(await screen.findByTestId('param1')).toHaveTextContent('foo')\n  expect(await screen.findByTestId('param2')).toHaveTextContent('bar')\n  expect(router.state.location.search).toEqual({ param1: 'foo', param2: 'bar' })\n  const search = new URLSearchParams(window.location.search)\n  expect(search.get('param1')).toEqual('foo')\n  expect(search.get('param2')).toEqual('bar')\n})\n\ntest('<Navigate> navigates only once in <StrictMode>', async () => {\n  configure({ reactStrictMode: true })\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => <Navigate to=\"/posts\" />,\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n    component: () => {\n      return (\n        <>\n          <h1 data-testid=\"posts-title\">Posts</h1>\n        </>\n      )\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    history,\n  })\n\n  const navigateSpy = vi.spyOn(router, 'navigate')\n\n  render(<RouterProvider router={router} />)\n\n  expect(await screen.findByTestId('posts-title')).toBeInTheDocument()\n  expect(navigateSpy.mock.calls.length).toBe(1)\n})\n\ntest.each([true, false])(\n  'should navigate to current route with search params when using \".\" in nested route structure from Index Route',\n  async (trailingSlash: boolean) => {\n    const tail = trailingSlash ? '/' : ''\n\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <button\n            data-testid=\"posts-btn\"\n            onClick={() => {\n              navigate({\n                to: '/post',\n              })\n            }}\n          >\n            Post\n          </button>\n          <button\n            data-testid=\"search-btn\"\n            onClick={() =>\n              navigate({\n                to: '.',\n                search: {\n                  param1: 'value1',\n                },\n              })\n            }\n          >\n            Search\n          </button>\n          <button\n            data-testid=\"search2-btn\"\n            onClick={() =>\n              navigate({\n                to: '/post',\n                search: {\n                  param1: 'value2',\n                },\n              })\n            }\n          >\n            Search2\n          </button>\n          <Outlet />\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n      validateSearch: z.object({\n        param1: z.string().optional(),\n      }),\n    })\n\n    const postRoute = createRoute({\n      getParentRoute: () => indexRoute,\n      path: 'post',\n      component: () => <div>Post</div>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postRoute]),\n      history,\n      trailingSlash: trailingSlash ? 'always' : 'never',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postButton = await screen.findByTestId('posts-btn')\n\n    fireEvent.click(postButton)\n\n    expect(router.state.location.pathname).toBe(`/post${tail}`)\n\n    const searchButton = await screen.findByTestId('search-btn')\n\n    fireEvent.click(searchButton)\n\n    expect(router.state.location.pathname).toBe(`/post${tail}`)\n    expect(router.state.location.search).toEqual({ param1: 'value1' })\n\n    const searchButton2 = await screen.findByTestId('search2-btn')\n\n    fireEvent.click(searchButton2)\n\n    expect(router.state.location.pathname).toBe(`/post${tail}`)\n    expect(router.state.location.search).toEqual({ param1: 'value2' })\n  },\n)\n\ntest.each([true, false])(\n  'should navigate to current route with changing path params when using \".\" in nested route structure',\n  async (trailingSlash) => {\n    const tail = trailingSlash ? '/' : ''\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <h1 data-testid=\"index-heading\">Index</h1>\n          <button\n            data-testid=\"posts-btn\"\n            onClick={() => navigate({ to: '/posts' })}\n          >\n            Posts\n          </button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const navigate = useNavigate()\n\n      return (\n        <>\n          <h1 data-testid=\"posts-index-heading\">Posts</h1>\n          <button\n            data-testid=\"first-post-btn\"\n            onClick={() =>\n              navigate({\n                to: '$postId',\n                params: { postId: 'id1' },\n              })\n            }\n          >\n            To first post\n          </button>\n          <button\n            data-testid=\"second-post-btn\"\n            onClick={() =>\n              navigate({\n                to: '.',\n                params: { postId: 'id2' },\n              })\n            }\n          >\n            To second post\n          </button>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span data-testid={`post-${params.postId}`}>\n            Params: {params.postId}\n          </span>\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([postsRoute.addChildren([postRoute])]),\n      ]),\n      trailingSlash: trailingSlash ? 'always' : 'never',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByTestId('posts-btn')\n\n    fireEvent.click(postsButton)\n\n    expect(await screen.findByTestId('posts-index-heading')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts${tail}`)\n\n    const firstPostButton = await screen.findByTestId('first-post-btn')\n\n    fireEvent.click(firstPostButton)\n\n    expect(await screen.findByTestId('post-id1')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts/id1${tail}`)\n\n    const secondPostButton = await screen.findByTestId('second-post-btn')\n\n    fireEvent.click(secondPostButton)\n\n    expect(await screen.findByTestId('post-id2')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts/id2${tail}`)\n  },\n)\n\ntest.each([true, false])(\n  'should navigate to current route with search params when using \".\" in nested route structure from non-Index Route',\n  async (trailingSlash) => {\n    const tail = trailingSlash ? '/' : ''\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <h1 data-testid=\"index-heading\">Index</h1>\n          <button\n            data-testid=\"posts-btn\"\n            onClick={() => navigate({ to: '/posts', params: { lang: '1' } })}\n          >\n            Posts\n          </button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const PostsComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <h1 data-testid=\"posts-index-heading\">Posts</h1>\n          <button\n            data-testid=\"first-post-btn\"\n            onClick={() =>\n              navigate({\n                to: '$postId/detail',\n                params: { postId: 'id1' },\n              })\n            }\n          >\n            To first post\n          </button>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const useModal = (name: string) => {\n      const currentOpen = postRoute.useSearch({\n        select: (search) => search[`_${name}`],\n      })\n\n      const navigate = useNavigate()\n\n      const setModal = React.useCallback(\n        (open: boolean) => {\n          navigate({\n            to: '.',\n            search: (prev: {}) => ({\n              ...prev,\n              [`_${name}`]: open ? true : undefined,\n            }),\n            resetScroll: false,\n          })\n        },\n        [name, navigate],\n      )\n\n      return [currentOpen, setModal] as const\n    }\n\n    function DetailComponent(props: { id: string }) {\n      const params = useParams({ strict: false })\n      const [currentTest, setTest] = useModal('test')\n\n      return (\n        <>\n          <div data-testid={`detail-heading-${props.id}`}>\n            Post Path \"/{params.postId}/detail-{props.id}\"!\n          </div>\n          {currentTest ? (\n            <button\n              data-testid={`detail-btn-remove-${props.id}`}\n              onClick={() => setTest(false)}\n            >\n              Remove test\n            </button>\n          ) : (\n            <button\n              data-testid={`detail-btn-add-${props.id}`}\n              onClick={() => setTest(true)}\n            >\n              Add test\n            </button>\n          )}\n        </>\n      )\n    }\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n\n      return (\n        <div>\n          <div data-testid=\"post-heading\">Post \"{params.postId}\"!</div>\n          <DetailComponent id={'1'} />\n          <Outlet />\n        </div>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: z.object({\n        _test: z.boolean().optional(),\n      }),\n    })\n\n    const detailRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'detail',\n      component: () => <DetailComponent id={'2'} />,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postRoute.addChildren([detailRoute])]),\n      ]),\n      trailingSlash: trailingSlash ? 'always' : 'never',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByTestId('posts-btn')\n\n    fireEvent.click(postsButton)\n\n    expect(await screen.findByTestId('posts-index-heading')).toBeInTheDocument()\n\n    const post1Button = await screen.findByTestId('first-post-btn')\n\n    fireEvent.click(post1Button)\n    expect(await screen.findByTestId('post-heading')).toBeInTheDocument()\n    expect(await screen.findByTestId('detail-heading-1')).toBeInTheDocument()\n    expect(await screen.findByTestId('detail-heading-2')).toBeInTheDocument()\n    expect(await screen.findByTestId('detail-heading-1')).toHaveTextContent(\n      'Post Path \"/id1/detail-1',\n    )\n    expect(await screen.findByTestId('detail-heading-2')).toHaveTextContent(\n      'Post Path \"/id1/detail-2',\n    )\n\n    const detail1AddBtn = await screen.findByTestId('detail-btn-add-1')\n\n    fireEvent.click(detail1AddBtn)\n\n    expect(router.state.location.pathname).toBe(`/posts/id1/detail${tail}`)\n    expect(router.state.location.search).toEqual({ _test: true })\n\n    const detail1RemoveBtn = await screen.findByTestId('detail-btn-remove-1')\n\n    fireEvent.click(detail1RemoveBtn)\n\n    expect(router.state.location.pathname).toBe(`/posts/id1/detail${tail}`)\n    expect(router.state.location.search).toEqual({})\n\n    const detail2AddBtn = await screen.findByTestId('detail-btn-add-2')\n\n    fireEvent.click(detail2AddBtn)\n\n    expect(router.state.location.pathname).toBe(`/posts/id1/detail${tail}`)\n    expect(router.state.location.search).toEqual({ _test: true })\n  },\n)\n\ntest.each([true, false])(\n  'should navigate to from route when using \".\" in nested route structure from Index Route with trailingSlash: %s',\n  async (trailingSlash: boolean) => {\n    const tail = trailingSlash ? '/' : ''\n\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <button\n            data-testid=\"posts-btn\"\n            onClick={() => {\n              navigate({\n                to: '/post',\n              })\n            }}\n          >\n            Post\n          </button>\n          <button\n            data-testid=\"search-btn\"\n            onClick={() =>\n              navigate({\n                to: '.',\n                search: {\n                  param1: 'value1',\n                },\n              })\n            }\n          >\n            Search\n          </button>\n          <button\n            data-testid=\"home-btn\"\n            onClick={() =>\n              navigate({\n                from: '/',\n                to: '.',\n              })\n            }\n          >\n            Go To Home\n          </button>\n          <Outlet />\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n      validateSearch: z.object({\n        param1: z.string().optional(),\n      }),\n    })\n\n    const postRoute = createRoute({\n      getParentRoute: () => indexRoute,\n      path: 'post',\n      component: () => <div>Post</div>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postRoute]),\n      history,\n      trailingSlash: trailingSlash ? 'always' : 'never',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postButton = await screen.findByTestId('posts-btn')\n\n    await act(() => fireEvent.click(postButton))\n\n    expect(router.state.location.pathname).toBe(`/post${tail}`)\n\n    const searchButton = await screen.findByTestId('search-btn')\n\n    await act(() => fireEvent.click(searchButton))\n\n    expect(router.state.location.pathname).toBe(`/post${tail}`)\n    expect(router.state.location.search).toEqual({ param1: 'value1' })\n\n    const homeBtn = await screen.findByTestId('home-btn')\n\n    await act(() => fireEvent.click(homeBtn))\n\n    expect(router.state.location.pathname).toBe(`/`)\n    expect(router.state.location.search).toEqual({})\n  },\n)\n\ntest.each([true, false])(\n  'should navigate to from route with path params when using \".\" in nested route structure with trailingSlash: %s',\n  async (trailingSlash) => {\n    const tail = trailingSlash ? '/' : ''\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <h1 data-testid=\"index-heading\">Index</h1>\n          <button\n            data-testid=\"posts-btn\"\n            onClick={() => navigate({ to: '/posts' })}\n          >\n            Posts\n          </button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const navigate = postsRoute.useNavigate()\n      return (\n        <>\n          <h1 data-testid=\"posts-index-heading\">Posts</h1>\n          <button\n            data-testid=\"first-post-btn\"\n            onClick={() =>\n              navigate({\n                to: '$postId',\n                params: { postId: '1' },\n              })\n            }\n          >\n            To first post\n          </button>\n          <button\n            data-testid=\"second-post-btn\"\n            onClick={() =>\n              navigate({\n                to: '$postId',\n                params: { postId: '2' },\n              })\n            }\n          >\n            To second post\n          </button>\n          <button\n            data-testid=\"to-posts-index-btn\"\n            onClick={() =>\n              navigate({\n                from: '/posts',\n                to: '.',\n              })\n            }\n          >\n            To posts list\n          </button>\n          <Outlet />\n        </>\n      )\n    }\n\n    const PostDetailComponent = () => {\n      const navigate = postDetailRoute.useNavigate()\n      return (\n        <>\n          <h1 data-testid=\"post-detail-index-heading\">Post Detail</h1>\n          <button\n            data-testid=\"post-info-btn\"\n            onClick={() =>\n              navigate({\n                to: 'info',\n              })\n            }\n          >\n            To post info\n          </button>\n          <button\n            data-testid=\"post-notes-btn\"\n            onClick={() =>\n              navigate({\n                to: 'notes',\n              })\n            }\n          >\n            To post notes\n          </button>\n          <button\n            data-testid=\"to-post-detail-index-btn\"\n            onClick={() =>\n              navigate({\n                from: '/posts/$postId',\n                to: '.',\n              })\n            }\n          >\n            To index detail options\n          </button>\n          <Outlet />\n        </>\n      )\n    }\n\n    const PostInfoComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"post-info-heading\">Post Info</h1>\n        </>\n      )\n    }\n\n    const PostNotesComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"post-notes-heading\">Post Notes</h1>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const postDetailRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostDetailComponent,\n    })\n\n    const postInfoRoute = createRoute({\n      getParentRoute: () => postDetailRoute,\n      path: 'info',\n      component: PostInfoComponent,\n    })\n\n    const postNotesRoute = createRoute({\n      getParentRoute: () => postDetailRoute,\n      path: 'notes',\n      component: PostNotesComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postDetailRoute.addChildren([postInfoRoute, postNotesRoute]),\n          ]),\n        ]),\n      ]),\n      trailingSlash: trailingSlash ? 'always' : 'never',\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByTestId('posts-btn')\n\n    fireEvent.click(postsButton)\n\n    expect(await screen.findByTestId('posts-index-heading')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts${tail}`)\n\n    const firstPostButton = await screen.findByTestId('first-post-btn')\n\n    fireEvent.click(firstPostButton)\n\n    expect(\n      await screen.findByTestId('post-detail-index-heading'),\n    ).toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts/1${tail}`)\n\n    const postInfoButton = await screen.findByTestId('post-info-btn')\n\n    fireEvent.click(postInfoButton)\n\n    expect(await screen.findByTestId('post-info-heading')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts/1/info${tail}`)\n\n    const toPostDetailIndexButton = await screen.findByTestId(\n      'to-post-detail-index-btn',\n    )\n\n    fireEvent.click(toPostDetailIndexButton)\n\n    expect(\n      await screen.findByTestId('post-detail-index-heading'),\n    ).toBeInTheDocument()\n    expect(screen.queryByTestId('post-info-heading')).not.toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts/1${tail}`)\n\n    const postNotesButton = await screen.findByTestId('post-notes-btn')\n\n    fireEvent.click(postNotesButton)\n\n    expect(await screen.findByTestId('post-notes-heading')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts/1/notes${tail}`)\n\n    const toPostsIndexButton = await screen.findByTestId('to-posts-index-btn')\n\n    fireEvent.click(toPostsIndexButton)\n\n    expect(await screen.findByTestId('posts-index-heading')).toBeInTheDocument()\n    expect(screen.queryByTestId('post-notes-heading')).not.toBeInTheDocument()\n    expect(\n      screen.queryByTestId('post-detail-index-heading'),\n    ).not.toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts${tail}`)\n\n    const secondPostButton = await screen.findByTestId('second-post-btn')\n\n    fireEvent.click(secondPostButton)\n\n    expect(\n      await screen.findByTestId('post-detail-index-heading'),\n    ).toBeInTheDocument()\n    expect(window.location.pathname).toEqual(`/posts/2${tail}`)\n  },\n)\n\ndescribe('when on /posts/$postId and navigating to ../ with default `from` /posts', () => {\n  async function runTest(navigateVia: 'Route' | 'RouteApi') {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <h1 data-testid=\"index-heading\">Index</h1>\n          <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n          <button\n            data-testid=\"index-to-first-post-btn\"\n            onClick={() =>\n              navigate({\n                to: '/posts/$postId/details',\n                params: { postId: 'id1' },\n              })\n            }\n          >\n            To first post\n          </button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const routeNavigate = postsRoute.useNavigate()\n      const routeApiNavigate = getRouteApi('/_layout/posts').useNavigate()\n      return (\n        <>\n          <h1>Posts</h1>\n          <button\n            data-testid=\"btn-to-home\"\n            onClick={() => {\n              if (navigateVia === 'Route') {\n                routeNavigate({ to: '../' })\n              } else {\n                routeApiNavigate({ to: '../' })\n              }\n            }}\n          >\n            To Home\n          </button>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params.postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const PostIndexComponent = () => {\n      return (\n        <>\n          <h1>Post Index</h1>\n        </>\n      )\n    }\n\n    const postIndexRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: '/',\n      component: PostIndexComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"details-heading\">Details!</h1>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([postIndexRoute, detailsRoute]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(<RouterProvider router={router} />)\n\n    const postsButton = await screen.findByTestId('index-to-first-post-btn')\n\n    fireEvent.click(postsButton)\n\n    expect(await screen.findByTestId('details-heading')).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const homeButton = await screen.findByTestId('btn-to-home')\n\n    fireEvent.click(homeButton)\n\n    expect(await screen.findByTestId('index-heading')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual('/')\n  }\n\n  test('Route', () => runTest('Route'))\n  test('RouteApi', () => runTest('RouteApi'))\n})\n\ndescribe.each([{ basepath: '' }, { basepath: '/basepath' }])(\n  'relative useNavigate with %s',\n  ({ basepath }) => {\n    const setupRouter = () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return <h1>Index Route</h1>\n        },\n      })\n      const aRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'a',\n        component: () => {\n          return (\n            <>\n              <h1>A Route</h1>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const bRoute = createRoute({\n        getParentRoute: () => aRoute,\n        path: 'b',\n        component: function BRoute() {\n          const navigate = useNavigate()\n          return (\n            <>\n              <h1>B Route</h1>\n              <button onClick={() => navigate({ to: '..' })}>\n                Link to Parent\n              </button>\n            </>\n          )\n        },\n      })\n\n      const paramRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'param/$param',\n        component: function ParamRoute() {\n          const navigate = useNavigate()\n          return (\n            <>\n              <h1>Param Route</h1>\n              <button\n                onClick={() =>\n                  navigate({ from: paramRoute.fullPath, to: './a' })\n                }\n              >\n                Link to ./a\n              </button>\n              <button\n                data-testid=\"btn-param-bar\"\n                onClick={() =>\n                  navigate({ to: '.', params: { param: 'bar' } as any })\n                }\n              >\n                Navigate to to . with param:bar\n              </button>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const paramARoute = createRoute({\n        getParentRoute: () => paramRoute,\n        path: 'a',\n        component: function ParamARoute() {\n          const navigate = useNavigate()\n          return (\n            <>\n              <h1>Param A Route</h1>\n              <button\n                onClick={() =>\n                  navigate({ from: paramARoute.fullPath, to: '..' })\n                }\n              >\n                Link to .. from /param/foo/a\n              </button>\n              <button\n                onClick={() => navigate({ to: '..' })}\n                data-testid={'link-to-previous'}\n              >\n                Link to .. from current active route\n              </button>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const paramBRoute = createRoute({\n        getParentRoute: () => paramARoute,\n        path: 'b',\n        component: function ParamBRoute() {\n          const navigate = useNavigate()\n          return (\n            <>\n              <h1>Param B Route</h1>\n              <button onClick={() => navigate({ to: '..' })}>\n                Link to Parent\n              </button>\n              <button\n                onClick={() => navigate({ to: '..', params: { param: 'bar' } })}\n              >\n                Link to Parent with param:bar\n              </button>\n              <button\n                onClick={() => navigate({ to: '..', params: { param: 'bar' } })}\n              >\n                Link to Parent with param:bar functional\n              </button>\n            </>\n          )\n        },\n      })\n\n      return createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          aRoute.addChildren([bRoute]),\n          paramRoute.addChildren([paramARoute, paramBRoute]),\n        ]),\n        history,\n        basepath: basepath === '' ? undefined : basepath,\n      })\n    }\n\n    test('should navigate to the parent route', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      // Navigate to /a/b\n      await act(async () => {\n        history.push(`${basepath}/a/b`)\n      })\n\n      // Inspect the link to go up a parent\n      const parentLink = await screen.findByText('Link to Parent')\n\n      // Click the link and ensure the new location\n      fireEvent.click(parentLink)\n      await router.latestLoadPromise\n\n      expect(window.location.pathname).toBe(`${basepath}/a`)\n    })\n\n    test('should navigate to the parent route and keep params', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      // Navigate to /param/oldParamValue/a/b\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the link to go up a parent and keep the params\n      const parentLink = await screen.findByText('Link to Parent')\n\n      // Click the link and ensure the new location\n      fireEvent.click(parentLink)\n      await router.latestLoadPromise\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a`)\n    })\n\n    test('should navigate to the parent route and change params', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      // Navigate to /param/oldParamValue/a/b\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the link to go up a parent and keep the params\n      const parentLink = await screen.findByText(\n        'Link to Parent with param:bar',\n      )\n\n      // Click the link and ensure the new location\n      fireEvent.click(parentLink)\n      await router.latestLoadPromise\n\n      expect(window.location.pathname).toBe(`${basepath}/param/bar/a`)\n    })\n\n    test('should navigate to a relative link based on render location with basepath', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText('Link to ./a')\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n      await router.latestLoadPromise\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a`)\n    })\n\n    test('should navigate to a parent link based on render location', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText(\n        'Link to .. from /param/foo/a',\n      )\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n      await router.latestLoadPromise\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo`)\n    })\n\n    test('should navigate to a parent link based on active location', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n      })\n\n      const relativeLink = await screen.findByTestId('link-to-previous')\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n      await router.latestLoadPromise\n\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a`)\n    })\n\n    test('should navigate to same route with different params', async () => {\n      const router = setupRouter()\n\n      render(<RouterProvider router={router} />)\n\n      await act(async () => {\n        history.push(`${basepath}/param/foo/a/b`)\n        await router.latestLoadPromise\n      })\n      expect(window.location.pathname).toBe(`${basepath}/param/foo/a/b`)\n\n      const btn = screen.getByTestId('btn-param-bar')\n      fireEvent.click(btn)\n      await router.latestLoadPromise\n\n      expect(window.location.pathname).toBe(`${basepath}/param/bar/a/b`)\n    })\n  },\n)\n\ndescribe('splat routes with empty splat', () => {\n  test.each(Object.values(trailingSlashOptions))(\n    'should handle empty _splat parameter with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash === 'always' ? '/' : ''\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: function IndexComponent() {\n          const navigate = useNavigate()\n          return (\n            <>\n              <h1>Index Route</h1>\n              <button\n                data-testid=\"splat-btn-with-empty-splat\"\n                onClick={() =>\n                  navigate({\n                    to: '/splat/$',\n                    params: { _splat: '' },\n                  })\n                }\n                type=\"button\"\n              >\n                Navigate to splat with empty _splat\n              </button>\n              <button\n                data-testid=\"splat-btn-with-undefined-splat\"\n                onClick={() =>\n                  navigate({\n                    to: '/splat/$',\n                    params: { _splat: undefined },\n                  })\n                }\n                type=\"button\"\n              >\n                Navigate to splat with undefined _splat\n              </button>\n              <button\n                data-testid=\"splat-btn-with-no-splat\"\n                onClick={() =>\n                  navigate({\n                    to: '/splat/$',\n                    params: {},\n                  })\n                }\n                type=\"button\"\n              >\n                Navigate to splat with no _splat\n              </button>\n            </>\n          )\n        },\n      })\n\n      const splatRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'splat/$',\n        component: () => {\n          return <h1>Splat Route</h1>\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, splatRoute]),\n        history,\n        trailingSlash,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      // Navigate with empty _splat\n      const splatBtnWithEmptySplat = await screen.findByTestId(\n        'splat-btn-with-empty-splat',\n      )\n\n      await act(async () => {\n        fireEvent.click(splatBtnWithEmptySplat)\n      })\n\n      expect(window.location.pathname).toBe(`/splat${tail}`)\n      expect(await screen.findByText('Splat Route')).toBeInTheDocument()\n\n      // Navigate back to index\n      await act(async () => {\n        history.push('/')\n      })\n\n      // Navigate with undefined _splat\n      const splatBtnWithUndefinedSplat = await screen.findByTestId(\n        'splat-btn-with-undefined-splat',\n      )\n\n      await act(async () => {\n        fireEvent.click(splatBtnWithUndefinedSplat)\n      })\n\n      expect(window.location.pathname).toBe(`/splat${tail}`)\n      expect(await screen.findByText('Splat Route')).toBeInTheDocument()\n\n      // Navigate back to index\n      await act(async () => {\n        history.push('/')\n      })\n\n      // Navigate with no _splat\n      const splatBtnWithNoSplat = await screen.findByTestId(\n        'splat-btn-with-no-splat',\n      )\n\n      await act(async () => {\n        fireEvent.click(splatBtnWithNoSplat)\n      })\n\n      expect(window.location.pathname).toBe(`/splat${tail}`)\n      expect(await screen.findByText('Splat Route')).toBeInTheDocument()\n    },\n  )\n})\n\ndescribe('encoded and unicode paths', () => {\n  const testCases = [\n    {\n      name: 'with prefix',\n      path: '/foo/prefix@대{$}',\n      expectedPath:\n        '/foo/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]',\n      expectedLocation: '/foo/prefix@대test[s%5C/.%5C/parameter%25!🚀%40]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with suffix',\n      path: '/foo/{$}대suffix@',\n      expectedPath:\n        '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]%EB%8C%80suffix@',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀%40]대suffix@',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with wildcard',\n      path: '/foo/$',\n      expectedPath: '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n    // '/' is left as is with splat params but encoded with normal params\n    {\n      name: 'with path param',\n      path: `/foo/$id`,\n      expectedPath: '/foo/test[s%5C%2F.%5C%2Fparameter%25!%F0%9F%9A%80%40]',\n      expectedLocation: '/foo/test[s%5C%2F.%5C%2Fparameter%25!🚀%40]',\n      params: {\n        id: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n  ]\n\n  test.each(testCases)(\n    'should handle encoded, decoded paths with unicode characters correctly - $name',\n    async ({ path, expectedPath, expectedLocation, params }) => {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n      })\n\n      function IndexComponent() {\n        const navigate = useNavigate()\n\n        return (\n          <>\n            <h1>Index Route</h1>\n            <button\n              data-testid=\"btn-to-path\"\n              onClick={() => navigate({ to: path, params })}\n            >\n              Navigate to path\n            </button>\n          </>\n        )\n      }\n\n      const pathRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path,\n        component: PathRouteComponent,\n      })\n\n      function PathRouteComponent() {\n        const params = pathRoute.useParams()\n        return (\n          <div>\n            <h1>Path Route</h1>\n            <p>\n              params:{' '}\n              <span data-testid=\"params-to-validate\">\n                {JSON.stringify(params)}\n              </span>\n            </p>\n          </div>\n        )\n      }\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, pathRoute]),\n        history,\n      })\n\n      render(<RouterProvider router={router} />)\n\n      const link = await screen.findByTestId('btn-to-path')\n\n      await act(() => fireEvent.click(link))\n\n      const paramsToValidate = await screen.findByTestId('params-to-validate')\n\n      expect(window.location.pathname).toBe(expectedPath)\n      expect(router.latestLocation.pathname).toBe(expectedLocation)\n\n      expect(paramsToValidate.textContent).toEqual(JSON.stringify(params))\n    },\n  )\n})\n\ntest('when navigating to /auth/sign-in with literal path (no params)', async () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n    return (\n      <>\n        <h1>Index</h1>\n        <button\n          data-testid=\"navigate-btn\"\n          onClick={() => navigate({ to: '/auth/sign-in' })}\n        >\n          Navigate to Sign In\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const authRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/auth/$path',\n    component: () => {\n      const params = authRoute.useParams()\n      return (\n        <div>\n          <h1 data-testid=\"auth-heading\">Auth Route</h1>\n          <span data-testid=\"path-param\">{params.path}</span>\n        </div>\n      )\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([indexRoute, authRoute]),\n    history,\n  })\n\n  render(<RouterProvider router={router} />)\n\n  const btn = await screen.findByTestId('navigate-btn')\n\n  // First click should navigate successfully\n  await act(() => fireEvent.click(btn))\n\n  // Should be at /auth/sign-in with correct params\n  expect(window.location.pathname).toBe('/auth/sign-in')\n  expect(await screen.findByTestId('auth-heading')).toBeInTheDocument()\n  expect((await screen.findByTestId('path-param')).textContent).toBe('sign-in')\n})\n"
  },
  {
    "path": "packages/react-router/tests/useParams.test-d.tsx",
    "content": "import { describe, expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter, useParams } from '../src'\n\ndescribe('useParams', () => {\n  test('when there are no params', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useParams<DefaultRouter>)\n      .parameter(0)\n      .toHaveProperty('from')\n      .toEqualTypeOf<'/invoices' | '__root__' | '/invoices/' | '/'>()\n\n    expectTypeOf(useParams<DefaultRouter>)\n      .parameter(0)\n      .toHaveProperty('strict')\n      .toEqualTypeOf<true | undefined>()\n\n    expectTypeOf(useParams<DefaultRouter, '/'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .parameter(0)\n      .toEqualTypeOf<{}>()\n\n    expectTypeOf(useParams<DefaultRouter, '/'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .returns.toEqualTypeOf<unknown>()\n\n    expectTypeOf(useParams<DefaultRouter, '/'>).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(\n      useParams<DefaultRouter, '/', false>({\n        strict: false,\n      }),\n    ).toEqualTypeOf<{}>()\n  })\n\n  test('when there is one param', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useParams<DefaultRouter, '/'>).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(\n      useParams<DefaultRouter, '/invoices/$invoiceId'>,\n    ).returns.toEqualTypeOf<{ invoiceId: string }>()\n\n    expectTypeOf(useParams<DefaultRouter, '/invoices/$invoiceId'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { invoiceId: string }) => unknown) | undefined>()\n\n    expectTypeOf(\n      useParams<DefaultRouter, '/invoices', false>,\n    ).returns.toEqualTypeOf<{ invoiceId?: string }>()\n\n    expectTypeOf(useParams<DefaultRouter, '/invoices', false>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        ((search: { invoiceId?: string }) => unknown) | undefined\n      >()\n\n    expectTypeOf(\n      useParams<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        number\n      >,\n    ).returns.toEqualTypeOf<number>()\n  })\n\n  test('when there are multiple params', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n    })\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([\n        invoicesIndexRoute,\n        invoiceRoute,\n        postsRoute.addChildren([postRoute]),\n      ]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useParams<DefaultRouter, '/'>).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(\n      useParams<DefaultRouter, '/invoices/$invoiceId'>,\n    ).returns.toEqualTypeOf<{ invoiceId: string }>()\n\n    expectTypeOf(useParams<DefaultRouter, '/invoices/$invoiceId'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { invoiceId: string }) => unknown) | undefined>()\n\n    expectTypeOf(\n      useParams<DefaultRouter, '/invoices', false>,\n    ).returns.toEqualTypeOf<{ invoiceId?: string; postId?: string }>()\n\n    expectTypeOf(useParams<DefaultRouter, '/invoices', false>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: { invoiceId?: string; postId?: string }) => unknown)\n        | undefined\n      >()\n\n    expectTypeOf(\n      useParams<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ true,\n        /* shouldThrow */ true,\n        { func: () => void }\n      >,\n    )\n      .parameter(0)\n      .exclude<undefined>()\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: {}) => {\n            func: () => void\n          })\n        | undefined\n      >()\n\n    expectTypeOf(\n      useParams<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ true,\n        /* shouldThrow */ true,\n        { func: () => void }\n      >,\n    )\n      .parameter(0)\n      .exclude<undefined>()\n      .toHaveProperty('structuralSharing')\n      .toEqualTypeOf<false | undefined>()\n\n    expectTypeOf(\n      useParams<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ true,\n        /* shouldThrow */ true,\n        { func: () => void },\n        true\n      >,\n    )\n      .parameter(0)\n      .exclude<undefined>()\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: {}) => {\n            func: 'Function is not serializable'\n          })\n        | undefined\n      >()\n\n    expectTypeOf(\n      useParams<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ true,\n        /* shouldThrow */ true,\n        { func: () => void },\n        true\n      >,\n    )\n      .parameter(0)\n      .exclude<undefined>()\n      .toHaveProperty('structuralSharing')\n      .toEqualTypeOf<false | undefined>()\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const routerWithStructuralSharing = createRouter({\n      routeTree,\n      defaultStructuralSharing: true,\n    })\n\n    expectTypeOf(\n      useParams<\n        typeof routerWithStructuralSharing,\n        '/invoices',\n        /* strict */ true,\n        /* shouldThrow */ true,\n        { func: () => void },\n        true\n      >,\n    )\n      .parameter(0)\n      .exclude<undefined>()\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: {}) => {\n            func: 'Function is not serializable'\n          })\n        | undefined\n      >()\n\n    expectTypeOf(\n      useParams<\n        typeof routerWithStructuralSharing,\n        '/invoices',\n        /* strict */ true,\n        /* shouldThrow */ true,\n        { func: () => void },\n        true\n      >,\n    )\n      .parameter(0)\n      .exclude<undefined>()\n      .toHaveProperty('structuralSharing')\n      .toEqualTypeOf<false>()\n  })\n\n  describe('shouldThrow', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      validateSearch: () => ({ page: 0 }),\n    })\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$id',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const router = createRouter({ routeTree })\n\n    const from = '/invoices/$id'\n    test('return type is `{ id: string }` when shouldThrow = true', () => {\n      const shouldThrow = true\n      const params = useParams<\n        typeof router,\n        typeof from,\n        /* strict */ true,\n        typeof shouldThrow\n      >({ from, shouldThrow })\n\n      expectTypeOf(params).toEqualTypeOf<{ id: string }>()\n    })\n\n    test('return type is `{page: string} | undefined` when shouldThrow = false', () => {\n      const shouldThrow = false\n      const params = useParams<\n        typeof router,\n        typeof from,\n        /* strict */ true,\n        typeof shouldThrow\n      >({ from, shouldThrow })\n\n      expectTypeOf(params).toEqualTypeOf<{ id: string } | undefined>()\n    })\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/useParams.test.tsx",
    "content": "import { expect, test, vi } from 'vitest'\nimport { act, fireEvent, render, screen } from '@testing-library/react'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useParams,\n} from '../src'\n\ntest('useParams must return parsed result if applicable.', async () => {\n  const posts = [\n    {\n      id: 1,\n      title: 'First Post',\n      category: 'one',\n    },\n    {\n      id: 2,\n      title: 'Second Post',\n      category: 'two',\n    },\n  ]\n\n  const mockedfn = vi.fn()\n  const rootRoute = createRootRoute()\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n    component: PostsComponent,\n  })\n\n  const postCategoryRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: 'category_{$category}',\n    component: PostCategoryComponent,\n    params: {\n      parse: (params) => {\n        return {\n          ...params,\n          category:\n            params.category === 'first'\n              ? 'one'\n              : params.category === 'second'\n                ? 'two'\n                : params.category,\n        }\n      },\n      stringify: (params) => {\n        return {\n          category:\n            params.category === 'one'\n              ? 'first'\n              : params.category === 'two'\n                ? 'second'\n                : params.category,\n        }\n      },\n    },\n    loader: ({ params }) => ({\n      posts:\n        params.category === 'all'\n          ? posts\n          : posts.filter((post) => post.category === params.category),\n    }),\n  })\n\n  const postRoute = createRoute({\n    getParentRoute: () => postCategoryRoute,\n    path: '$postId',\n    loader: ({ params }) => {\n      return { post: posts.find((post) => post.id === parseInt(params.postId)) }\n    },\n    params: {\n      parse: (params) => {\n        mockedfn()\n        return {\n          ...params,\n          postId: params.postId === 'one' ? '1' : '2',\n        }\n      },\n    },\n    component: PostComponent,\n  })\n\n  function PostsComponent() {\n    return (\n      <div>\n        <h1 data-testid=\"posts-heading\">Posts</h1>\n        <Link\n          data-testid=\"all-category-link\"\n          to={postCategoryRoute.fullPath}\n          params={{ category: 'all' }}\n        >\n          All Categories\n        </Link>\n        <Link\n          data-testid=\"first-category-link\"\n          to={postCategoryRoute.fullPath}\n          params={{ category: 'first' }}\n        >\n          First Category\n        </Link>\n        <Outlet />\n      </div>\n    )\n  }\n\n  function PostCategoryComponent() {\n    const data = postCategoryRoute.useLoaderData()\n\n    return (\n      <div>\n        <h1 data-testid=\"post-category-heading\">Post Categories</h1>\n        {data.posts.map((post: (typeof posts)[number]) => {\n          const id = post.id === 1 ? 'one' : 'two'\n          return (\n            <Link\n              key={id}\n              from={postCategoryRoute.fullPath}\n              to=\"./$postId\"\n              params={{ postId: id }}\n              data-testid={`post-${id}-link`}\n            >\n              {post.title}\n            </Link>\n          )\n        })}\n        <Outlet />\n      </div>\n    )\n  }\n\n  function PostComponent() {\n    const params = useParams({ from: postRoute.fullPath })\n\n    const data = postRoute.useLoaderData()\n\n    return (\n      <div>\n        <h1 data-testid=\"post-heading\">Post Route</h1>\n        <div>\n          Category_Param:{' '}\n          <span data-testid=\"param_category_value\">{params.category}</span>\n        </div>\n        <div>\n          PostId_Param:{' '}\n          <span data-testid=\"param_postId_value\">{params.postId}</span>\n        </div>\n        <div>\n          PostId: <span data-testid=\"post_id_value\">{data.post.id}</span>\n        </div>\n        <div>\n          Title: <span data-testid=\"post_title_value\">{data.post.title}</span>\n        </div>\n        <div>\n          Category:{' '}\n          <span data-testid=\"post_category_value\">{data.post.category}</span>\n        </div>\n      </div>\n    )\n  }\n\n  window.history.replaceState({}, '', '/posts')\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      postsRoute.addChildren([postCategoryRoute.addChildren([postRoute])]),\n    ]),\n  })\n\n  render(<RouterProvider router={router} />)\n\n  await act(() => router.load())\n\n  expect(await screen.findByTestId('posts-heading')).toBeInTheDocument()\n\n  const firstCategoryLink = await screen.findByTestId('first-category-link')\n\n  expect(firstCategoryLink).toBeInTheDocument()\n\n  mockedfn.mockClear()\n  await act(() => fireEvent.click(firstCategoryLink))\n\n  const firstPostLink = await screen.findByTestId('post-one-link')\n\n  expect(window.location.pathname).toBe('/posts/category_first')\n  expect(await screen.findByTestId('post-category-heading')).toBeInTheDocument()\n  expect(mockedfn).not.toHaveBeenCalled()\n\n  mockedfn.mockClear()\n  await act(() => fireEvent.click(firstPostLink))\n\n  const allCategoryLink = await screen.findByTestId('all-category-link')\n  let paramCategoryValue = await screen.findByTestId('param_category_value')\n  let paramPostIdValue = await screen.findByTestId('param_postId_value')\n  let postCategory = await screen.findByTestId('post_category_value')\n  let postTitleValue = await screen.findByTestId('post_title_value')\n  let postIdValue = await screen.findByTestId('post_id_value')\n\n  let renderedPost = {\n    id: parseInt(postIdValue.textContent),\n    title: postTitleValue.textContent,\n    category: postCategory.textContent,\n  }\n\n  expect(window.location.pathname).toBe('/posts/category_first/one')\n  expect(await screen.findByTestId('post-heading')).toBeInTheDocument()\n  expect(renderedPost).toEqual(posts[0])\n  expect(renderedPost.category).toBe('one')\n  expect(paramCategoryValue.textContent).toBe('one')\n  expect(paramPostIdValue.textContent).toBe('1')\n  expect(mockedfn).toHaveBeenCalled()\n  // maybe we could theoretically reach 1 single call, but i'm not sure, building links depends on a bunch of things\n  // expect(mockedfn).toHaveBeenCalledTimes(1)\n  expect(allCategoryLink).toBeInTheDocument()\n\n  mockedfn.mockClear()\n  await act(() => fireEvent.click(allCategoryLink))\n\n  const secondPostLink = await screen.findByTestId('post-two-link')\n\n  expect(window.location.pathname).toBe('/posts/category_all')\n  expect(await screen.findByTestId('post-category-heading')).toBeInTheDocument()\n  expect(secondPostLink).toBeInTheDocument()\n  // expect(mockedfn).not.toHaveBeenCalled()\n\n  mockedfn.mockClear()\n  await act(() => fireEvent.click(secondPostLink))\n\n  paramCategoryValue = await screen.findByTestId('param_category_value')\n  paramPostIdValue = await screen.findByTestId('param_postId_value')\n  postCategory = await screen.findByTestId('post_category_value')\n  postTitleValue = await screen.findByTestId('post_title_value')\n  postIdValue = await screen.findByTestId('post_id_value')\n  renderedPost = {\n    id: parseInt(postIdValue.textContent),\n    title: postTitleValue.textContent,\n    category: postCategory.textContent,\n  }\n\n  expect(window.location.pathname).toBe('/posts/category_all/two')\n  expect(await screen.findByTestId('post-heading')).toBeInTheDocument()\n  expect(renderedPost).toEqual(posts[1])\n  expect(renderedPost.category).toBe('two')\n  expect(paramCategoryValue.textContent).toBe('all')\n  expect(paramPostIdValue.textContent).toBe('2')\n  expect(mockedfn).toHaveBeenCalled()\n})\n\ntest('useParams({ strict: false }) returns parsed params after child navigation', async () => {\n  const rootRoute = createRootRoute()\n\n  const parentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'parent',\n    component: ParentComponent,\n  })\n\n  const versionRoute = createRoute({\n    getParentRoute: () => parentRoute,\n    path: '$version',\n    params: {\n      parse: (params) => ({\n        ...params,\n        version: parseInt(params.version),\n      }),\n      stringify: (params) => ({\n        ...params,\n        version: `${params.version}`,\n      }),\n    },\n    component: VersionComponent,\n  })\n\n  function ParentComponent() {\n    const { version } = useParams({ strict: false })\n\n    return (\n      <div>\n        <div data-testid=\"version-type\">{typeof version}</div>\n        <div data-testid=\"version-value\">{String(version)}</div>\n        <Link\n          data-testid=\"version-2-link\"\n          to={versionRoute.fullPath}\n          params={{ version: 2 }}\n        >\n          Version 2\n        </Link>\n        <Outlet />\n      </div>\n    )\n  }\n\n  function VersionComponent() {\n    return <div data-testid=\"version-route\">Version Route</div>\n  }\n\n  window.history.replaceState({}, '', '/parent/1')\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([parentRoute.addChildren([versionRoute])]),\n  })\n\n  render(<RouterProvider router={router} />)\n\n  await act(() => router.load())\n\n  expect(await screen.findByTestId('version-type')).toHaveTextContent('number')\n  expect(await screen.findByTestId('version-value')).toHaveTextContent('1')\n\n  const version2Link = await screen.findByTestId('version-2-link')\n\n  await act(() => fireEvent.click(version2Link))\n\n  expect(await screen.findByTestId('version-route')).toBeInTheDocument()\n  expect(await screen.findByTestId('version-type')).toHaveTextContent('number')\n  expect(await screen.findByTestId('version-value')).toHaveTextContent('2')\n})\n"
  },
  {
    "path": "packages/react-router/tests/useRouteContext.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  createRootRoute,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  useRouteContext,\n} from '../src'\n\ntest('when there is no context', () => {\n  const rootRoute = createRootRoute()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(useRouteContext<DefaultRouter>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<'/invoices' | '__root__' | '/invoices/' | '/'>()\n\n  expectTypeOf(useRouteContext<DefaultRouter>)\n    .parameter(0)\n    .toHaveProperty('strict')\n    .toEqualTypeOf<true | undefined>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .parameter(0)\n    .toEqualTypeOf<{}>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .returns.toEqualTypeOf<unknown>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/'>).returns.toEqualTypeOf<{}>()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/', false>({\n      strict: false,\n    }),\n  ).toEqualTypeOf<{}>()\n})\n\ntest('when there is the root context', () => {\n  interface Context {\n    userId: string\n  }\n\n  const rootRoute = createRootRouteWithContext<Context>()()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n    context: { userId: 'userId' },\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/'>).returns.toEqualTypeOf<{\n    userId: string\n  }>()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/invoices/$invoiceId'>,\n  ).returns.toEqualTypeOf<{ userId: string }>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .toEqualTypeOf<((search: { userId: string }) => unknown) | undefined>()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/invoices', false>,\n  ).returns.toEqualTypeOf<{ userId?: string }>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/invoices', false>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .toEqualTypeOf<((search: { userId?: string }) => unknown) | undefined>()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/invoices', false, number>,\n  ).returns.toEqualTypeOf<number>()\n})\n\ntest('when there are multiple contexts', () => {\n  interface Context {\n    userId: string\n  }\n\n  const rootRoute = createRootRouteWithContext<Context>()()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n  })\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    beforeLoad: () => ({ username: 'username' }),\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([\n      invoicesIndexRoute,\n      invoiceRoute,\n      postsRoute.addChildren([postRoute]),\n    ]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n    context: { userId: 'userId' },\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/'>).returns.toEqualTypeOf<{\n    userId: string\n  }>()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/invoices/$invoiceId'>,\n  ).returns.toEqualTypeOf<{ userId: string }>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .toEqualTypeOf<((search: { userId: string }) => unknown) | undefined>()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/invoices', false>,\n  ).returns.toEqualTypeOf<{ userId?: string; username?: string }>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/invoices', false>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      ((search: { userId?: string; username?: string }) => unknown) | undefined\n    >()\n})\n\ntest('when there are overlapping contexts', () => {\n  interface Context {\n    userId: string\n  }\n\n  const rootRoute = createRootRouteWithContext<Context>()()\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    validateSearch: () => ({ page: 0 }),\n  })\n\n  const invoicesIndexRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '/',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    beforeLoad: () => ({ username: 'username2' }) as const,\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'posts',\n  })\n\n  const postRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '$postId',\n    beforeLoad: () => ({ username: 'username1' }) as const,\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([\n      invoicesIndexRoute,\n      invoiceRoute,\n      postsRoute.addChildren([postRoute]),\n    ]),\n    indexRoute,\n  ])\n\n  // eslint-disable-next-line unused-imports/no-unused-vars\n  const defaultRouter = createRouter({\n    routeTree,\n    context: { userId: 'userId' },\n  })\n\n  type DefaultRouter = typeof defaultRouter\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/'>).returns.toEqualTypeOf<{\n    userId: string\n  }>\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/invoices/$invoiceId'>,\n  ).returns.toEqualTypeOf<{\n    userId: string\n    readonly username: 'username2'\n  }>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((search: {\n          userId: string\n          readonly username: 'username2'\n        }) => unknown)\n      | undefined\n    >()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/invoices', false>,\n  ).returns.toEqualTypeOf<{\n    userId?: string\n    username?: 'username1' | 'username2'\n  }>()\n\n  expectTypeOf(useRouteContext<DefaultRouter, '/invoices', false>)\n    .parameter(0)\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((search: {\n          userId?: string\n          username?: 'username2' | 'username1'\n        }) => unknown)\n      | undefined\n    >()\n})\n"
  },
  {
    "path": "packages/react-router/tests/useRouterState.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useRouterState,\n} from '../src'\nimport type { RouterState } from '../src'\n\nconst rootRoute = createRootRoute({\n  validateSearch: () => ({\n    page: 0,\n  }),\n})\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n})\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\ntest('can select router state', () => {\n  expectTypeOf(useRouterState<DefaultRouter>)\n    .returns.toHaveProperty('location')\n    .toMatchTypeOf<{\n      search: { page?: number | undefined }\n    }>()\n\n  expectTypeOf(useRouterState<DefaultRouter, { func: () => void }>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((search: RouterState<DefaultRouter['routeTree']>) => {\n          func: () => void\n        })\n      | undefined\n    >()\n\n  expectTypeOf(useRouterState<DefaultRouter, { func: () => void }>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<false | undefined>()\n\n  expectTypeOf(useRouterState<DefaultRouter, { func: () => void }, true>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((search: RouterState<DefaultRouter['routeTree']>) => {\n          func: 'Function is not serializable'\n        })\n      | undefined\n    >()\n\n  expectTypeOf(useRouterState<DefaultRouter, { func: () => void }, true>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<false | undefined>()\n\n  const routerWithStructuralSharing = createRouter({\n    routeTree,\n    defaultStructuralSharing: true,\n  })\n\n  expectTypeOf(\n    useRouterState<typeof routerWithStructuralSharing, { func: () => void }>,\n  )\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((search: RouterState<DefaultRouter['routeTree']>) => {\n          func: 'Function is not serializable'\n        })\n      | undefined\n    >()\n\n  expectTypeOf(\n    useRouterState<typeof routerWithStructuralSharing, { func: () => void }>,\n  )\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('structuralSharing')\n    .toEqualTypeOf<false>()\n})\n"
  },
  {
    "path": "packages/react-router/tests/useSearch.test-d.tsx",
    "content": "import { describe, expectTypeOf, test } from 'vitest'\nimport { createRootRoute, createRoute, createRouter, useSearch } from '../src'\nimport type { SearchSchemaInput } from '../src'\n\ndescribe('useSearch', () => {\n  test('when there are no search params', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useSearch<DefaultRouter>)\n      .parameter(0)\n      .toHaveProperty('from')\n      .toEqualTypeOf<\n        '/invoices' | '__root__' | '/invoices/$invoiceId' | '/invoices/' | '/'\n      >()\n\n    expectTypeOf(useSearch<DefaultRouter>)\n      .parameter(0)\n      .toHaveProperty('strict')\n      .toEqualTypeOf<true | undefined>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .parameter(0)\n      .toEqualTypeOf<{}>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .returns.toEqualTypeOf<unknown>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '/', false>({\n        strict: false,\n      }),\n    ).toEqualTypeOf<{}>()\n  })\n\n  test('when there is one search params', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>).returns.toEqualTypeOf<{\n      page: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { page: number }) => unknown) | undefined>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '/invoices', false>,\n    ).returns.toEqualTypeOf<{ page?: number }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices', false>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { page?: number }) => unknown) | undefined>()\n\n    expectTypeOf(\n      useSearch<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        number\n      >,\n    ).returns.toEqualTypeOf<number>()\n\n    expectTypeOf(\n      useSearch<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { func: () => void }\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        ((search: { page?: number }) => { func: () => void }) | undefined\n      >()\n\n    expectTypeOf(\n      useSearch<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { func: () => void }\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('structuralSharing')\n      .toEqualTypeOf<false | undefined>()\n\n    expectTypeOf(\n      useSearch<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { func: () => void },\n        true\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: { page?: number }) => {\n            func: 'Function is not serializable'\n          })\n        | undefined\n      >()\n\n    expectTypeOf(\n      useSearch<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { func: () => void },\n        true\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('structuralSharing')\n      .toEqualTypeOf<false | undefined>()\n\n    expectTypeOf(\n      useSearch<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { hi: any },\n        true\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: { page?: number }) => {\n            hi: never\n          })\n        | undefined\n      >()\n\n    expectTypeOf(\n      useSearch<\n        DefaultRouter,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { hi: any },\n        true\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('structuralSharing')\n      .toEqualTypeOf<false | undefined>()\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const routerWithStructuralSharing = createRouter({\n      routeTree,\n      defaultStructuralSharing: true,\n    })\n\n    expectTypeOf(\n      useSearch<\n        typeof routerWithStructuralSharing,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { func: () => void }\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: { page?: number }) => {\n            func: 'Function is not serializable'\n          })\n        | undefined\n      >()\n\n    expectTypeOf(\n      useSearch<\n        typeof routerWithStructuralSharing,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { date: () => void },\n        true\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('structuralSharing')\n      .toEqualTypeOf<false>()\n\n    expectTypeOf(\n      useSearch<\n        typeof routerWithStructuralSharing,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { hi: any },\n        true\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: { page?: number }) => {\n            hi: never\n          })\n        | undefined\n      >()\n\n    expectTypeOf(\n      useSearch<\n        typeof routerWithStructuralSharing,\n        '/invoices',\n        /* strict */ false,\n        /* shouldThrow */ true,\n        { hi: any },\n        true\n      >,\n    )\n      .parameter(0)\n      .toHaveProperty('structuralSharing')\n      .toEqualTypeOf<false>()\n  })\n\n  test('when there are multiple search params', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n      validateSearch: () => ({ detail: 'detail' }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>).returns.toEqualTypeOf<{\n      page: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { page: number }) => unknown) | undefined>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '/invoices', false>,\n    ).returns.toEqualTypeOf<{ page?: number; detail?: string }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices', false>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        ((search: { page?: number; detail?: string }) => unknown) | undefined\n      >()\n  })\n\n  test('when there are overlapping search params', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n      validateSearch: () => ({ detail: 50 }) as const,\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n      validateSearch: () => ({ detail: 'detail' }) as const,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>).returns.toEqualTypeOf<{\n      page: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { page: number }) => unknown) | undefined>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '/invoices', false>,\n    ).returns.toEqualTypeOf<{ page?: number; detail?: 'detail' | 50 }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices', false>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: { page?: number; detail?: 'detail' | 50 }) => unknown)\n        | undefined\n      >()\n  })\n\n  test('when the root has no search params but the index route does', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      validateSearch: () => ({ indexPage: 0 }),\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>).returns.toEqualTypeOf<{\n      indexPage: number\n    }>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '__root__'>,\n    ).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '/invoices'>,\n    ).returns.toEqualTypeOf<{}>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: {}) => unknown) | undefined>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '/invoices', false>,\n    ).returns.toEqualTypeOf<{ indexPage?: number }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices', false>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        ((search: { indexPage?: number }) => unknown) | undefined\n      >()\n  })\n\n  test('when the root has search params but the index route does not', () => {\n    const rootRoute = createRootRoute({\n      validateSearch: () => ({ rootPage: 0 }),\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>).returns.toEqualTypeOf<{\n      rootPage: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '__root__'>).returns.toEqualTypeOf<{\n      rootPage: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>).returns.toEqualTypeOf<{\n      rootPage: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { rootPage: number }) => unknown) | undefined>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '/invoices', false>,\n    ).returns.toEqualTypeOf<{ rootPage?: number }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices', false>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { rootPage?: number }) => unknown) | undefined>()\n  })\n\n  test('when the root has search params but the index does', () => {\n    const rootRoute = createRootRoute({\n      validateSearch: () => ({ rootPage: 0 }),\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      validateSearch: () => ({ indexPage: 0 }),\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n\n    const invoicesIndexRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '/',\n    })\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n      indexRoute,\n    ])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const defaultRouter = createRouter({\n      routeTree,\n    })\n\n    type DefaultRouter = typeof defaultRouter\n\n    expectTypeOf(useSearch<DefaultRouter, '/'>).returns.toEqualTypeOf<{\n      rootPage: number\n      indexPage: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '__root__'>).returns.toEqualTypeOf<{\n      rootPage: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>).returns.toEqualTypeOf<{\n      rootPage: number\n    }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices'>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<((search: { rootPage: number }) => unknown) | undefined>()\n\n    expectTypeOf(\n      useSearch<DefaultRouter, '/invoices', false>,\n    ).returns.toEqualTypeOf<{ indexPage?: number; rootPage?: number }>()\n\n    expectTypeOf(useSearch<DefaultRouter, '/invoices', false>)\n      .parameter(0)\n      .toHaveProperty('select')\n      .toEqualTypeOf<\n        | ((search: { indexPage?: number; rootPage?: number }) => unknown)\n        | undefined\n      >()\n  })\n\n  test('when a route has search params using SearchSchemaInput', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      validateSearch: (input: { page?: number } & SearchSchemaInput) => {\n        return { page: input.page ?? 0 }\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute])\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const router = createRouter({ routeTree })\n    expectTypeOf(useSearch<typeof router, '/'>).returns.toEqualTypeOf<{\n      page: number\n    }>\n  })\n\n  test('when route has a union of search params', () => {\n    const rootRoute = createRootRoute()\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      validateSearch: (): { status: 'in' } | { status: 'out' } => {\n        return { status: 'in' }\n      },\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: '/',\n      validateSearch: (): { detail: string } => {\n        return { detail: 'detail' }\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute.addChildren([indexRoute]),\n    ])\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const router = createRouter({ routeTree })\n    expectTypeOf(useSearch<typeof router, '/'>).returns.toEqualTypeOf<\n      { status: 'in'; detail: string } | { status: 'out'; detail: string }\n    >\n  })\n\n  describe('shouldThrow', () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([invoicesRoute, indexRoute])\n\n    // eslint-disable-next-line unused-imports/no-unused-vars\n    const router = createRouter({ routeTree })\n\n    const from = '/invoices'\n    test('return type is `{ page: number }` when shouldThrow = true', () => {\n      const shouldThrow = true\n      const search = useSearch<\n        typeof router,\n        typeof from,\n        /* strict */ true,\n        typeof shouldThrow\n      >({ from, shouldThrow })\n\n      expectTypeOf(search).toEqualTypeOf<{ page: number }>()\n    })\n\n    test('return type is `{page: number} | undefined` when shouldThrow = false', () => {\n      const shouldThrow = false\n      const search = useSearch<\n        typeof router,\n        typeof from,\n        /* strict */ true,\n        typeof shouldThrow\n      >({ from, shouldThrow })\n\n      expectTypeOf(search).toEqualTypeOf<{ page: number } | undefined>()\n    })\n  })\n})\n"
  },
  {
    "path": "packages/react-router/tests/utils.ts",
    "content": "import type { Mock } from 'vitest'\n\nexport function sleep(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nexport function createTimer() {\n  let time = Date.now()\n\n  return {\n    start: () => {\n      time = Date.now()\n    },\n    getTime: () => {\n      return Date.now() - time\n    },\n  }\n}\n\nexport const getIntersectionObserverMock = ({\n  observe,\n  disconnect,\n}: {\n  observe: Mock\n  disconnect: Mock\n}) => {\n  return class IO implements IntersectionObserver {\n    root: Document | Element | null\n    rootMargin: string\n    thresholds: Array<number>\n    constructor(\n      _cb: IntersectionObserverCallback,\n      options?: IntersectionObserverInit,\n    ) {\n      this.root = options?.root ?? null\n      this.rootMargin = options?.rootMargin ?? '0px'\n      this.thresholds = options?.threshold ?? ([0] as any)\n    }\n\n    takeRecords(): Array<IntersectionObserverEntry> {\n      return []\n    }\n    unobserve(): void {}\n    observe(): void {\n      observe()\n    }\n    disconnect(): void {\n      disconnect()\n    }\n  }\n}\n\nexport function getSearchParamsFromURI(uri: string) {\n  const [, paramString] = uri.split('?')\n  return new URLSearchParams(paramString)\n}\n"
  },
  {
    "path": "packages/react-router/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"jsxImportSource\": \"react\"\n  },\n  \"include\": [\"src\", \"tests\", \"vite.config.ts\", \"eslint.config.ts\"]\n}\n"
  },
  {
    "path": "packages/react-router/tsconfig.legacy.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "packages/react-router/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport react from '@vitejs/plugin-react'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  plugins: [react()],\n  // Add 'development' condition for tests to resolve @tanstack/router-core/isServer\n  // to the development export (isServer = undefined) instead of node (isServer = true)\n  ...(process.env.VITEST && {\n    resolve: {\n      conditions: ['development'],\n    },\n  }),\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n    setupFiles: ['./tests/setupTests.tsx'],\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: [\n      './src/index.tsx',\n      './src/index.dev.tsx',\n      './src/ssr/client.ts',\n      './src/ssr/server.ts',\n    ],\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/react-router-devtools/CHANGELOG.md",
    "content": "# @tanstack/react-router-devtools\n\n## 1.166.10\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/router-devtools-core@1.167.0\n  - @tanstack/react-router@1.168.0\n  - @tanstack/router-core@1.168.0\n\n## 1.166.9\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/router-devtools-core@1.166.9\n  - @tanstack/react-router@1.167.2\n  - @tanstack/router-core@1.167.2\n\n## 1.166.8\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/router-devtools-core@1.166.8\n  - @tanstack/react-router@1.167.1\n  - @tanstack/router-core@1.167.1\n"
  },
  {
    "path": "packages/react-router-devtools/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack React Router Devtools\n\nSee https://tanstack.com/router/latest/docs/framework/react/devtools\n"
  },
  {
    "path": "packages/react-router-devtools/eslint.config.js",
    "content": "// @ts-check\n\nimport pluginReact from '@eslint-react/eslint-plugin'\nimport pluginReactHooks from 'eslint-plugin-react-hooks'\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    files: ['**/*.{ts,tsx}'],\n    ...pluginReact.configs.recommended,\n  },\n  {\n    plugins: {\n      'react-hooks': pluginReactHooks,\n    },\n    rules: {\n      '@eslint-react/no-unstable-context-value': 'off',\n      '@eslint-react/no-unstable-default-props': 'off',\n      '@eslint-react/dom/no-missing-button-type': 'off',\n      'react-hooks/exhaustive-deps': 'error',\n      'react-hooks/rules-of-hooks': 'error',\n    },\n  },\n  {\n    files: ['**/__tests__/**'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/react-router-devtools/package.json",
    "content": "{\n  \"name\": \"@tanstack/react-router-devtools\",\n  \"version\": \"1.166.10\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/react-router-devtools\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"./dist/esm/index.d.ts\",\n  \"main\": \"./dist/cjs/index.cjs\",\n  \"module\": \"./dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@tanstack/router-devtools-core\": \"workspace:*\"\n  },\n  \"devDependencies\": {\n    \"@vitejs/plugin-react\": \"^4.3.4\",\n    \"react\": \">=19\",\n    \"react-dom\": \">=19\",\n    \"vite\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"@tanstack/router-core\": \"workspace:^\",\n    \"react\": \">=18.0.0 || >=19.0.0\",\n    \"react-dom\": \">=18.0.0 || >=19.0.0\"\n  },\n  \"peerDependenciesMeta\": {\n    \"@tanstack/router-core\": {\n      \"optional\": true\n    }\n  }\n}\n"
  },
  {
    "path": "packages/react-router-devtools/src/TanStackRouterDevtools.tsx",
    "content": "import { TanStackRouterDevtoolsCore } from '@tanstack/router-devtools-core'\nimport { Fragment, useEffect, useRef, useState } from 'react'\nimport { useRouter, useRouterState } from '@tanstack/react-router'\nimport type { ButtonHTMLAttributes, HTMLAttributes } from 'react'\nimport type { AnyRouter } from '@tanstack/react-router'\nimport type React from 'react'\n\nexport interface TanStackRouterDevtoolsOptions {\n  /**\n   * Set this true if you want the dev tools to default to being open\n   */\n  initialIsOpen?: boolean\n  /**\n   * Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.\n   */\n  panelProps?: HTMLAttributes<HTMLDivElement>\n  /**\n   * 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.\n   */\n  closeButtonProps?: ButtonHTMLAttributes<HTMLButtonElement>\n  /**\n   * 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.\n   */\n  toggleButtonProps?: ButtonHTMLAttributes<HTMLButtonElement>\n  /**\n   * The position of the TanStack Router logo to open and close the devtools panel.\n   * Defaults to 'bottom-left'.\n   */\n  position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n  /**\n   * Use this to render the devtools inside a different type of container element for a11y purposes.\n   * Any string which corresponds to a valid intrinsic JSX element is allowed.\n   * Defaults to 'footer'.\n   */\n  containerElement?: string | any\n  /**\n   * The router instance to use for the devtools.\n   */\n  router?: AnyRouter\n  /**\n   * Use this to attach the devtool's styles to specific element in the DOM.\n   */\n  shadowDOMTarget?: ShadowRoot\n}\n\nexport function TanStackRouterDevtools(\n  props: TanStackRouterDevtoolsOptions,\n): React.ReactElement | null {\n  const {\n    initialIsOpen,\n    panelProps,\n    closeButtonProps,\n    toggleButtonProps,\n    position,\n    containerElement,\n    shadowDOMTarget,\n    router: propsRouter,\n  } = props\n\n  const hookRouter = useRouter({ warn: false })\n  const activeRouter = propsRouter ?? hookRouter\n\n  const activeRouterState = useRouterState({ router: activeRouter })\n\n  const devToolRef = useRef<HTMLDivElement>(null)\n  const [devtools] = useState(\n    () =>\n      new TanStackRouterDevtoolsCore({\n        initialIsOpen,\n        panelProps,\n        closeButtonProps,\n        toggleButtonProps,\n        position,\n        containerElement,\n        shadowDOMTarget,\n        router: activeRouter,\n        routerState: activeRouterState,\n      }),\n  )\n\n  // Update devtools when props change\n  useEffect(() => {\n    devtools.setRouter(activeRouter)\n  }, [devtools, activeRouter])\n\n  useEffect(() => {\n    devtools.setRouterState(activeRouterState)\n  }, [devtools, activeRouterState])\n\n  useEffect(() => {\n    devtools.setOptions({\n      initialIsOpen: initialIsOpen,\n      panelProps: panelProps,\n      closeButtonProps: closeButtonProps,\n      toggleButtonProps: toggleButtonProps,\n      position: position,\n      containerElement: containerElement,\n      shadowDOMTarget: shadowDOMTarget,\n    })\n  }, [\n    devtools,\n    initialIsOpen,\n    panelProps,\n    closeButtonProps,\n    toggleButtonProps,\n    position,\n    containerElement,\n    shadowDOMTarget,\n  ])\n\n  useEffect(() => {\n    if (devToolRef.current) {\n      devtools.mount(devToolRef.current)\n    }\n\n    return () => {\n      devtools.unmount()\n    }\n  }, [devtools])\n\n  return (\n    <Fragment>\n      <div ref={devToolRef} />\n    </Fragment>\n  )\n}\n"
  },
  {
    "path": "packages/react-router-devtools/src/TanStackRouterDevtoolsPanel.tsx",
    "content": "import { useRouter, useRouterState } from '@tanstack/react-router'\nimport { TanStackRouterDevtoolsPanelCore } from '@tanstack/router-devtools-core'\nimport React, { useEffect, useRef, useState } from 'react'\nimport type { AnyRouter } from '@tanstack/react-router'\n\nexport interface TanStackRouterDevtoolsPanelOptions {\n  /**\n   * The standard React style object used to style a component with inline styles\n   */\n  style?: any\n  /**\n   * The standard React class property used to style a component with classes\n   */\n  className?: string\n  /**\n   * A boolean variable indicating whether the panel is open or closed\n   */\n  isOpen?: boolean\n  /**\n   * A function that toggles the open and close state of the panel\n   */\n  setIsOpen?: (isOpen: boolean) => void\n  /**\n   * Handles the opening and closing the devtools panel\n   */\n  handleDragStart?: (e: any) => void\n  /**\n   * A boolean variable indicating if the \"lite\" version of the library is being used\n   */\n  router?: AnyRouter\n  /**\n   * Use this to attach the devtool's styles to specific element in the DOM.\n   */\n  shadowDOMTarget?: ShadowRoot\n}\n\nexport const TanStackRouterDevtoolsPanel: React.FC<\n  TanStackRouterDevtoolsPanelOptions\n> = (props): React.ReactElement | null => {\n  const { router: propsRouter, ...rest } = props\n  const hookRouter = useRouter({ warn: false })\n  const activeRouter = propsRouter ?? hookRouter\n  const activeRouterState = useRouterState({ router: activeRouter })\n\n  const devToolRef = useRef<HTMLDivElement>(null)\n  const [devtools] = useState(\n    () =>\n      new TanStackRouterDevtoolsPanelCore({\n        ...rest,\n        router: activeRouter,\n        routerState: activeRouterState,\n      }),\n  )\n\n  // Update devtools when props change\n  useEffect(() => {\n    devtools.setRouter(activeRouter)\n  }, [devtools, activeRouter])\n\n  useEffect(() => {\n    devtools.setRouterState(activeRouterState)\n  }, [devtools, activeRouterState])\n\n  useEffect(() => {\n    devtools.setOptions({\n      className: props.className,\n      style: props.style,\n      shadowDOMTarget: props.shadowDOMTarget,\n    })\n  }, [devtools, props.className, props.style, props.shadowDOMTarget])\n\n  useEffect(() => {\n    if (devToolRef.current) {\n      devtools.mount(devToolRef.current)\n    }\n\n    return () => {\n      devtools.unmount()\n    }\n  }, [devtools])\n\n  return (\n    <>\n      <div ref={devToolRef} />\n    </>\n  )\n}\n"
  },
  {
    "path": "packages/react-router-devtools/src/index.ts",
    "content": "import * as Devtools from './TanStackRouterDevtools'\nimport * as DevtoolsPanel from './TanStackRouterDevtoolsPanel'\n\nexport const TanStackRouterDevtools: (typeof Devtools)['TanStackRouterDevtools'] =\n  process.env.NODE_ENV !== 'development'\n    ? function () {\n        return null\n      }\n    : Devtools.TanStackRouterDevtools\n\nexport const TanStackRouterDevtoolsInProd: (typeof Devtools)['TanStackRouterDevtools'] =\n  Devtools.TanStackRouterDevtools\n\nexport const TanStackRouterDevtoolsPanel: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'] =\n  process.env.NODE_ENV !== 'development'\n    ? function () {\n        return null\n      }\n    : DevtoolsPanel.TanStackRouterDevtoolsPanel\n\nexport const TanStackRouterDevtoolsPanelInProd: (typeof DevtoolsPanel)['TanStackRouterDevtoolsPanel'] =\n  DevtoolsPanel.TanStackRouterDevtoolsPanel\n"
  },
  {
    "path": "packages/react-router-devtools/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"jsxImportSource\": \"react\"\n  },\n  \"include\": [\"src\", \"tests\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/react-router-devtools/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport react from '@vitejs/plugin-react'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  plugins: [react()],\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/react-router-ssr-query/CHANGELOG.md",
    "content": "# @tanstack/react-router-ssr-query\n\n## 1.166.10\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/router-ssr-query-core@1.167.0\n\n## 1.166.9\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/router-ssr-query-core@1.166.9\n\n## 1.166.8\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/router-ssr-query-core@1.166.8\n"
  },
  {
    "path": "packages/react-router-ssr-query/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack React Router\n\n![TanStack Router Header](https://raw.githubusercontent.com/TanStack/router/main/media/header_router.png)\n\n🤖 Type-safe router w/ built-in caching & URL state management for React!\n\n<a href=\"https://twitter.com/intent/tweet?button_hashtag=TanStack\" target=\"\\_parent\">\n  <img alt=\"#TanStack\" src=\"https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack\">\n</a><a href=\"https://discord.com/invite/WrRKjPJ\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/badge/Discord-TanStack-%235865F2\" />\n</a><a href=\"https://npmjs.com/package/@tanstack/react-router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/npm/dm/@tanstack/router.svg\" />\n</a><a href=\"https://bundlephobia.com/result?p=@tanstack/react-router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://badgen.net/bundlephobia/minzip/@tanstack/react-router\" />\n</a><a href=\"#badge\">\n    <img alt=\"semantic-release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\">\n  </a><a href=\"https://github.com/TanStack/router/discussions\">\n  <img alt=\"Join the discussion on Github\" src=\"https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue\" />\n</a><a href=\"https://bestofjs.org/projects/router\"><img alt=\"Best of JS\" src=\"https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=tanstack%2Frouter%26since=daily\" /></a><a href=\"https://github.com/TanStack/router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/github/stars/tanstack/router.svg?style=social&label=Star\" />\n</a><a href=\"https://twitter.com/tan_stack\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/twitter/follow/tan_stack.svg?style=social&label=Follow @TanStack\" />\n</a><a href=\"https://twitter.com/tannerlinsley\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow @TannerLinsley\" />\n</a>\n\nEnjoy this library? Try the entire [TanStack](https://tanstack.com)! [React Query](https://github.com/TanStack/query), [React Table](https://github.com/TanStack/table), [React Charts](https://github.com/TanStack/react-charts), [React Virtual](https://github.com/TanStack/virtual)\n\n## Visit [tanstack.com/router](https://tanstack.com/router) for docs, guides, API and more!\n"
  },
  {
    "path": "packages/react-router-ssr-query/eslint.config.js",
    "content": "// @ts-check\n\nimport pluginReact from '@eslint-react/eslint-plugin'\nimport pluginReactHooks from 'eslint-plugin-react-hooks'\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    files: ['**/*.{ts,tsx}'],\n    ...pluginReact.configs.recommended,\n  },\n  {\n    plugins: {\n      'react-hooks': pluginReactHooks,\n    },\n    rules: {\n      '@eslint-react/no-unstable-context-value': 'off',\n      '@eslint-react/no-unstable-default-props': 'off',\n      '@eslint-react/dom/no-missing-button-type': 'off',\n      'react-hooks/exhaustive-deps': 'error',\n      'react-hooks/rules-of-hooks': 'error',\n    },\n  },\n  {\n    files: ['**/__tests__/**'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/react-router-ssr-query/package.json",
    "content": "{\n  \"name\": \"@tanstack/react-router-ssr-query\",\n  \"version\": \"1.166.10\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/react-router-ssr-query\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:unit\": \"exit 0; vitest\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@tanstack/router-ssr-query-core\": \"workspace:*\"\n  },\n  \"devDependencies\": {\n    \"@vitejs/plugin-react\": \"^4.3.4\",\n    \"react\": \">=19\",\n    \"react-dom\": \">=19\",\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"@tanstack/react-query\": \">=5.90.0\",\n    \"vite\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"react\": \">=18.0.0 || >=19.0.0\",\n    \"react-dom\": \">=18.0.0 || >=19.0.0\",\n    \"@tanstack/query-core\": \">=5.90.0\",\n    \"@tanstack/react-router\": \">=1.127.0\",\n    \"@tanstack/react-query\": \">=5.90.0\"\n  }\n}\n"
  },
  {
    "path": "packages/react-router-ssr-query/src/index.tsx",
    "content": "import { Fragment } from 'react'\nimport { QueryClientProvider } from '@tanstack/react-query'\nimport { setupCoreRouterSsrQueryIntegration } from '@tanstack/router-ssr-query-core'\nimport type { RouterSsrQueryOptions } from '@tanstack/router-ssr-query-core'\nimport type { AnyRouter } from '@tanstack/react-router'\n\nexport type Options<TRouter extends AnyRouter> =\n  RouterSsrQueryOptions<TRouter> & {\n    wrapQueryClient?: boolean\n  }\n\nexport function setupRouterSsrQueryIntegration<TRouter extends AnyRouter>(\n  opts: Options<TRouter>,\n) {\n  setupCoreRouterSsrQueryIntegration(opts)\n\n  if (opts.wrapQueryClient === false) {\n    return\n  }\n  const OGWrap = opts.router.options.Wrap || Fragment\n\n  opts.router.options.Wrap = ({ children }) => {\n    return (\n      <QueryClientProvider client={opts.queryClient}>\n        <OGWrap>{children}</OGWrap>\n      </QueryClientProvider>\n    )\n  }\n}\n"
  },
  {
    "path": "packages/react-router-ssr-query/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"jsxImportSource\": \"react\"\n  },\n  \"include\": [\"src\", \"tests\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/react-router-ssr-query/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport react from '@vitejs/plugin-react'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  plugins: [react()],\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.tsx',\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/react-start/CHANGELOG.md",
    "content": "# @tanstack/react-start\n\n## 1.167.1\n\n### Patch Changes\n\n- Updated dependencies [[`91cc628`](https://github.com/TanStack/router/commit/91cc62899b75ca920fe83c5ee7f3dbb5c71a523f)]:\n  - @tanstack/react-router@1.168.1\n  - @tanstack/react-start-client@1.166.16\n  - @tanstack/react-start-server@1.166.16\n  - @tanstack/start-client-core@1.167.1\n  - @tanstack/start-plugin-core@1.167.4\n  - @tanstack/start-server-core@1.167.1\n\n## 1.167.0\n\n### Minor Changes\n\n- remove pendingMatches, cachedMatches ([#6704](https://github.com/TanStack/router/pull/6704))\n  move to signal-based reactivity\n  solid uses its own native signals\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/start-client-core@1.167.0\n  - @tanstack/start-server-core@1.167.0\n  - @tanstack/react-router@1.168.0\n  - @tanstack/react-start-client@1.166.15\n  - @tanstack/react-start-server@1.166.15\n  - @tanstack/start-plugin-core@1.167.3\n\n## 1.166.18\n\n### Patch Changes\n\n- Updated dependencies [[`0f585d5`](https://github.com/TanStack/router/commit/0f585d5289c8a3b11697caa9b2aa3015d37d776e)]:\n  - @tanstack/start-plugin-core@1.167.2\n\n## 1.166.17\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/react-router@1.167.5\n  - @tanstack/react-start-client@1.166.14\n  - @tanstack/react-start-server@1.166.14\n  - @tanstack/start-client-core@1.166.13\n  - @tanstack/start-plugin-core@1.167.1\n  - @tanstack/start-server-core@1.166.13\n\n## 1.166.16\n\n### Patch Changes\n\n- Updated dependencies [[`6651473`](https://github.com/TanStack/router/commit/6651473d028a55c70f3f54af37a12b4379b46813)]:\n  - @tanstack/start-plugin-core@1.167.0\n\n## 1.166.15\n\n### Patch Changes\n\n- Add @tanstack/intent AI agent skills and CLI entry points for Router and Start packages ([#6866](https://github.com/TanStack/router/pull/6866))\n\n- Updated dependencies [[`940151c`](https://github.com/TanStack/router/commit/940151cbed0c76c92a5cf196c0905b17a956ca7e), [`d637152`](https://github.com/TanStack/router/commit/d6371529b5ab09af7d81463a6c4082b092411967)]:\n  - @tanstack/react-router@1.167.4\n  - @tanstack/start-client-core@1.166.12\n  - @tanstack/start-server-core@1.166.12\n  - @tanstack/start-plugin-core@1.166.15\n  - @tanstack/react-start-client@1.166.13\n  - @tanstack/react-start-server@1.166.13\n\n## 1.166.14\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/react-router@1.167.3\n  - @tanstack/react-start-client@1.166.12\n  - @tanstack/react-start-server@1.166.12\n  - @tanstack/start-client-core@1.166.11\n  - @tanstack/start-plugin-core@1.166.14\n  - @tanstack/start-server-core@1.166.11\n\n## 1.166.13\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/react-router@1.167.2\n  - @tanstack/react-start-client@1.166.11\n  - @tanstack/react-start-server@1.166.11\n  - @tanstack/router-utils@1.161.6\n  - @tanstack/start-client-core@1.166.10\n  - @tanstack/start-plugin-core@1.166.13\n  - @tanstack/start-server-core@1.166.10\n\n## 1.166.12\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/react-start-client@1.166.10\n  - @tanstack/react-start-server@1.166.10\n  - @tanstack/start-client-core@1.166.9\n  - @tanstack/start-plugin-core@1.166.12\n  - @tanstack/start-server-core@1.166.9\n  - @tanstack/react-router@1.167.1\n  - @tanstack/router-utils@1.161.5\n\n## 1.166.11\n\n### Patch Changes\n\n- fix: add `xmlns:xhtml` to generated sitemap ([#6920](https://github.com/TanStack/router/pull/6920))\n\n- Updated dependencies [[`bfd6e62`](https://github.com/TanStack/router/commit/bfd6e62780f1cb96c210ae405723c5ebc22b10b0)]:\n  - @tanstack/start-plugin-core@1.166.11\n\n## 1.166.10\n\n### Patch Changes\n\n- Updated dependencies [[`6f297a2`](https://github.com/TanStack/router/commit/6f297a249424c0fd1c1a56aa4fc12c8217be7b6a)]:\n  - @tanstack/react-router@1.167.0\n  - @tanstack/react-start-client@1.166.9\n  - @tanstack/react-start-server@1.166.9\n  - @tanstack/start-client-core@1.166.8\n  - @tanstack/start-plugin-core@1.166.10\n  - @tanstack/start-server-core@1.166.8\n\n## 1.166.9\n\n### Patch Changes\n\n- Updated dependencies [[`6069eba`](https://github.com/TanStack/router/commit/6069eba64369dbddb0d8dccdb4407f0e1a82259e)]:\n  - @tanstack/react-router@1.166.8\n  - @tanstack/start-plugin-core@1.166.9\n  - @tanstack/react-start-client@1.166.8\n  - @tanstack/react-start-server@1.166.8\n\n## 1.166.8\n\n### Patch Changes\n\n- Updated dependencies [[`9a4d924`](https://github.com/TanStack/router/commit/9a4d924d2b60ffb0f7f3f8f11c95195222929870)]:\n  - @tanstack/start-plugin-core@1.166.8\n"
  },
  {
    "path": "packages/react-start/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack React Start\n\n![TanStack React Start Header](https://raw.githubusercontent.com/TanStack/router/main/media/header_start.png)\n\nSSR, Streaming, Server Functions, API Routes, bundling and more powered by [TanStack Router](https://tanstack.com/router) and Vite. Ready to deploy to your favorite hosting provider.\n\n<a href=\"https://twitter.com/intent/tweet?button_hashtag=TanStack\" target=\"\\_parent\">\n  <img alt=\"#TanStack\" src=\"https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack\">\n</a>\n<a href=\"https://discord.com/invite/WrRKjPJ\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/badge/Discord-TanStack-%235865F2\" />\n</a>\n<a href=\"https://npmjs.com/package/@tanstack/react-start\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/npm/dm/@tanstack/react-start.svg\" />\n</a>\n<a href=\"https://bundlephobia.com/result?p=@tanstack/react-start\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://badgen.net/bundlephobia/minzip/@tanstack/react-start\" />\n</a>\n<a href=\"#badge\">\n  <img alt=\"semantic-release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\">\n</a>\n<a href=\"https://github.com/TanStack/router/discussions\">\n  <img alt=\"Join the discussion on Github\" src=\"https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue\" />\n</a>\n<a href=\"https://bestofjs.org/projects/router\">\n  <img alt=\"Best of JS\" src=\"https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=tanstack%2Frouter%26since=daily\" />\n</a>\n<a href=\"https://github.com/TanStack/router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/github/stars/tanstack/router.svg?style=social&label=Star\" />\n</a>\n<a href=\"https://twitter.com/tan_stack\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/twitter/follow/tan_stack.svg?style=social&label=Follow @TanStack\" />\n</a>\n<a href=\"https://twitter.com/tannerlinsley\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow @TannerLinsley\" />\n</a>\n\nEnjoy this library? Try the entire [TanStack](https://tanstack.com)! [React Query](https://github.com/TanStack/query), [React Table](https://github.com/TanStack/table), [React Charts](https://github.com/TanStack/react-charts), [React Virtual](https://github.com/TanStack/virtual)\n\nVisit [tanstack.com/start](https://tanstack.com/start) for docs, guides, API and more!\n"
  },
  {
    "path": "packages/react-start/bin/intent.js",
    "content": "#!/usr/bin/env node\n// Auto-generated by @tanstack/intent setup\n// Exposes the intent end-user CLI for consumers of this library.\n// Commit this file, then add to your package.json:\n//   \"bin\": { \"intent\": \"./bin/intent.js\" }\ntry {\n  await import('@tanstack/intent/intent-library')\n} catch (e) {\n  const isModuleNotFound =\n    e?.code === 'ERR_MODULE_NOT_FOUND' || e?.code === 'MODULE_NOT_FOUND'\n  const missingIntentLibrary =\n    typeof e?.message === 'string' && e.message.includes('@tanstack/intent')\n\n  if (isModuleNotFound && missingIntentLibrary) {\n    console.error('@tanstack/intent is not installed.')\n    console.error('')\n    console.error('Install it as a dev dependency:')\n    console.error('  npm add -D @tanstack/intent')\n    console.error('')\n    console.error('Or run directly:')\n    console.error('  npx @tanstack/intent@latest list')\n    process.exit(1)\n  }\n  throw e\n}\n"
  },
  {
    "path": "packages/react-start/eslint.config.js",
    "content": "// @ts-check\n\nimport pluginReact from '@eslint-react/eslint-plugin'\nimport pluginReactHooks from 'eslint-plugin-react-hooks'\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    ...pluginReact.configs.recommended,\n    files: ['**/*.{ts,tsx}'],\n  },\n  {\n    plugins: {\n      'react-hooks': pluginReactHooks,\n    },\n    rules: {\n      '@eslint-react/no-unstable-context-value': 'off',\n      '@eslint-react/no-unstable-default-props': 'off',\n      '@eslint-react/dom/no-missing-button-type': 'off',\n      'react-hooks/exhaustive-deps': 'error',\n      'react-hooks/rules-of-hooks': 'error',\n    },\n  },\n  {\n    files: ['**/__tests__/**'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/react-start/package.json",
    "content": "{\n  \"name\": \"@tanstack/react-start\",\n  \"version\": \"1.167.1\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/react-start\"\n  },\n  \"homepage\": \"https://tanstack.com/start\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test\": \"pnpm test:build\",\n    \"test:build\": \"exit 0; vitest\",\n    \"build\": \"vite build && vite build -c vite.config.server-entry.ts\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      }\n    },\n    \"./client\": {\n      \"import\": {\n        \"types\": \"./dist/esm/client.d.ts\",\n        \"default\": \"./dist/esm/client.js\"\n      }\n    },\n    \"./client-rpc\": {\n      \"import\": {\n        \"types\": \"./dist/esm/client-rpc.d.ts\",\n        \"default\": \"./dist/esm/client-rpc.js\"\n      }\n    },\n    \"./server\": {\n      \"import\": {\n        \"types\": \"./dist/esm/server.d.ts\",\n        \"default\": \"./dist/esm/server.js\"\n      }\n    },\n    \"./server-rpc\": {\n      \"import\": {\n        \"types\": \"./dist/esm/server-rpc.d.ts\",\n        \"default\": \"./dist/esm/server-rpc.js\"\n      }\n    },\n    \"./ssr-rpc\": {\n      \"import\": {\n        \"types\": \"./dist/esm/ssr-rpc.d.ts\",\n        \"default\": \"./dist/esm/ssr-rpc.js\"\n      }\n    },\n    \"./plugin/vite\": {\n      \"import\": {\n        \"types\": \"./dist/esm/plugin/vite.d.ts\",\n        \"default\": \"./dist/esm/plugin/vite.js\"\n      }\n    },\n    \"./server-entry\": {\n      \"import\": {\n        \"types\": \"./dist/default-entry/esm/server.d.ts\",\n        \"default\": \"./dist/default-entry/esm/server.js\"\n      }\n    },\n    \"./server-only\": {\n      \"import\": {\n        \"types\": \"./dist/esm/server-only.d.ts\",\n        \"default\": \"./dist/esm/server-only.js\"\n      }\n    },\n    \"./client-only\": {\n      \"import\": {\n        \"types\": \"./dist/esm/client-only.d.ts\",\n        \"default\": \"./dist/esm/client-only.js\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\",\n    \"skills\",\n    \"bin\",\n    \"!skills/_artifacts\"\n  ],\n  \"engines\": {\n    \"node\": \">=22.12.0\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-start-client\": \"workspace:*\",\n    \"@tanstack/react-start-server\": \"workspace:*\",\n    \"@tanstack/router-utils\": \"workspace:^\",\n    \"@tanstack/start-plugin-core\": \"workspace:*\",\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"@tanstack/start-client-core\": \"workspace:*\",\n    \"@tanstack/start-server-core\": \"workspace:*\",\n    \"pathe\": \"^2.0.3\"\n  },\n  \"peerDependencies\": {\n    \"react\": \">=18.0.0 || >=19.0.0\",\n    \"react-dom\": \">=18.0.0 || >=19.0.0\",\n    \"vite\": \">=7.0.0\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/intent\": \"^0.0.14\"\n  },\n  \"bin\": {\n    \"intent\": \"./bin/intent.js\"\n  }\n}\n"
  },
  {
    "path": "packages/react-start/skills/_artifacts/domain_map.yaml",
    "content": "# domain_map.yaml\n# Generated by skill-domain-discovery\n# Library: TanStack Start\n# Version: 1.166.2\n# Date: 2026-03-07\n# Status: reviewed\n\nlibrary:\n  name: '@tanstack/react-start'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Full-stack React framework built on TanStack Router and Vite. Adds\n    SSR, streaming, server functions (type-safe RPCs), middleware,\n    server routes, and universal deployment. Isomorphic by default —\n    all code runs in both environments unless explicitly constrained.\n  primary_framework: 'React'\n\ndomains:\n  - name: 'Project Setup'\n    slug: 'project-setup'\n    description: >-\n      Scaffolding a Start project, configuring Vite plugin, router\n      setup with getRouter(), root route with document shell, client\n      and server entry points.\n\n  - name: 'Server Functions'\n    slug: 'server-functions'\n    description: >-\n      Creating type-safe RPCs with createServerFn, input validation,\n      calling from loaders/components/other server functions, error\n      handling, streaming responses.\n\n  - name: 'Middleware and Context'\n    slug: 'middleware-and-context'\n    description: >-\n      Request middleware, server function middleware, context passing\n      with sendContext, global middleware via createStart, middleware\n      factories, fetch override precedence.\n\n  - name: 'Execution Model'\n    slug: 'execution-model'\n    description: >-\n      Isomorphic code execution, environment functions\n      (createServerFn, createServerOnlyFn, createClientOnlyFn,\n      createIsomorphicFn), import protection, dead code elimination,\n      environment variable safety.\n\n  - name: 'Server Routes'\n    slug: 'server-routes'\n    description: >-\n      Server-side API endpoints defined in routes, HTTP method\n      handlers, handler middleware, request/response patterns.\n\n  - name: 'Deployment and Rendering'\n    slug: 'deployment-and-rendering'\n    description: >-\n      Hosting providers (Cloudflare, Netlify, Vercel, Node/Docker),\n      selective SSR, SPA mode, static prerendering, ISR with\n      Cache-Control headers, SEO and head management.\n\nskills:\n  # ── Project Setup ────────────────────────────────────────────────\n  - name: 'Start Setup'\n    slug: 'start-setup'\n    domain: 'project-setup'\n    description: >-\n      Scaffold a TanStack Start project, configure Vite plugin with\n      tanstackStart(), set up router with getRouter(), create root\n      route with document shell (HeadContent, Scripts, Outlet),\n      configure client and server entry points.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-plugin-core'\n    covers:\n      - tanstackStart Vite plugin\n      - getRouter() factory pattern\n      - Root route document shell\n      - HeadContent / Scripts / Outlet\n      - Client entry point (optional)\n      - Server entry point (optional)\n      - routeTree.gen.ts\n      - tsconfig configuration\n    tasks:\n      - 'Scaffold a new TanStack Start project'\n      - 'Configure the Vite plugin'\n      - 'Set up the router factory'\n      - 'Customize client/server entry points'\n    failure_modes:\n      - mistake: 'React plugin before Start plugin in Vite config'\n        mechanism: >-\n          Start's Vite plugin must come before React's plugin.\n          Wrong order causes route generation and server function\n          compilation to fail.\n        wrong_pattern: |\n          plugins: [react(), tanstackStart()]\n        correct_pattern: |\n          plugins: [tanstackStart(), react()]\n        source: 'docs/start/framework/react/build-from-scratch.md'\n        priority: CRITICAL\n        status: active\n\n      - mistake: 'Enabling verbatimModuleSyntax in tsconfig'\n        mechanism: >-\n          verbatimModuleSyntax causes server bundles to leak into\n          client bundles. Must be disabled.\n        source: 'docs/start/framework/react/build-from-scratch.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Missing Scripts component in root route'\n        mechanism: >-\n          The Scripts component must be rendered in the body of\n          the root route for proper hydration and functionality.\n          Without it, client-side JavaScript does not load.\n        source: 'docs/start/framework/react/guide/routing.md'\n        priority: HIGH\n        status: active\n\n  # ── Server Functions ─────────────────────────────────────────────\n  - name: 'Server Functions'\n    slug: 'server-functions'\n    domain: 'server-functions'\n    description: >-\n      Create type-safe RPCs with createServerFn, validate inputs\n      with Zod or plain functions, call from loaders/components/\n      event handlers, handle errors/redirects/notFound, stream\n      responses with ReadableStream or async generators.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-client-core'\n      - '@tanstack/start-server-core'\n    covers:\n      - createServerFn (GET/POST)\n      - inputValidator (Zod or function)\n      - useServerFn hook\n      - Server context utilities (getRequest, getRequestHeader, setResponseHeader, setResponseStatus)\n      - Error handling (throw errors, redirect, notFound)\n      - Streaming (ReadableStream, async generators)\n      - File organization (.functions.ts, .server.ts)\n      - FormData handling\n    tasks:\n      - 'Create a server function for data fetching'\n      - 'Validate server function inputs'\n      - 'Call server functions from components'\n      - 'Stream data from server functions'\n      - 'Handle errors in server functions'\n    failure_modes:\n      - mistake: 'Putting server-only code in loaders instead of server functions'\n        mechanism: >-\n          Loaders are ISOMORPHIC — they run on both client and server.\n          Database queries, file system access, and secret API keys\n          in loaders will either fail on the client or leak to the\n          client bundle. Use createServerFn for server-only logic.\n        wrong_pattern: |\n          export const Route = createFileRoute('/posts')({\n            loader: async () => {\n              const posts = await db.query('SELECT * FROM posts')\n              return { posts }\n            },\n          })\n        correct_pattern: |\n          const getPosts = createServerFn({ method: 'GET' })\n            .handler(async () => {\n              const posts = await db.query('SELECT * FROM posts')\n              return { posts }\n            })\n\n          export const Route = createFileRoute('/posts')({\n            loader: () => getPosts(),\n          })\n        source: 'maintainer interview'\n        priority: CRITICAL\n        status: active\n        skills: ['server-functions', 'execution-model']\n\n      - mistake: 'Using dynamic imports for server functions'\n        mechanism: >-\n          Dynamic imports of server functions can cause bundler\n          issues. Static imports are safe — the build process\n          replaces server implementations with RPC stubs.\n        wrong_pattern: |\n          const { getUser } = await import('~/utils/users.functions')\n        correct_pattern: |\n          import { getUser } from '~/utils/users.functions'\n        source: 'docs/start/framework/react/guide/server-functions.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Generating Next.js or Remix server patterns'\n        mechanism: >-\n          Agents generate getServerSideProps, \"use server\" directives,\n          or Remix-style loader exports. TanStack Start uses\n          createServerFn for server-only code.\n        wrong_pattern: |\n          'use server'\n          export async function getUser() { ... }\n        correct_pattern: |\n          const getUser = createServerFn({ method: 'GET' })\n            .handler(async () => { ... })\n        source: 'maintainer interview'\n        priority: CRITICAL\n        status: active\n\n  # ── Middleware and Context ───────────────────────────────────────\n  - name: 'Middleware'\n    slug: 'middleware'\n    domain: 'middleware-and-context'\n    description: >-\n      Request middleware and server function middleware with\n      createMiddleware, context passing via next(), sendContext\n      for client-server transfer, global middleware via createStart\n      in src/start.ts, middleware factories, fetch override\n      precedence, header merging.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-client-core'\n      - '@tanstack/start-server-core'\n    covers:\n      - createMiddleware\n      - Request middleware (.server only)\n      - Server function middleware (.client + .server)\n      - Context passing via next({ context })\n      - sendContext for client-server transfer\n      - Global middleware (createStart in src/start.ts)\n      - Middleware factories\n      - Fetch override precedence\n      - Header merging\n      - Method order enforcement (middleware → inputValidator → client → server)\n    tasks:\n      - 'Add authentication middleware'\n      - 'Pass context through middleware chain'\n      - 'Configure global request middleware'\n      - 'Create reusable middleware factories'\n    failure_modes:\n      - mistake: 'Trusting client context without server validation'\n        mechanism: >-\n          Client context via sendContext is NOT validated by default.\n          Dynamic user-generated data must be validated in server-side\n          middleware before use.\n        source: 'docs/start/framework/react/guide/middleware.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Wrong middleware method order'\n        mechanism: >-\n          TypeScript enforces method order: middleware → inputValidator\n          → client → server. Wrong order causes type errors and\n          runtime failures.\n        source: 'docs/start/framework/react/guide/middleware.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Confusing request vs server function middleware'\n        mechanism: >-\n          Request middleware runs on ALL server requests (SSR, server\n          routes, server functions). Server function middleware runs\n          only for server functions and has .client() method. Using\n          the wrong type causes unexpected scope.\n        source: 'docs/start/framework/react/guide/middleware.md'\n        priority: MEDIUM\n        status: active\n\n  # ── Execution Model ──────────────────────────────────────────────\n  - name: 'Execution Model'\n    slug: 'execution-model'\n    domain: 'execution-model'\n    description: >-\n      Isomorphic code execution model, environment boundary functions\n      (createServerFn, createServerOnlyFn, createClientOnlyFn,\n      createIsomorphicFn), import protection, dead code elimination,\n      environment variable safety (VITE_ prefix), useHydrated hook.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-client-core'\n      - '@tanstack/start-server-core'\n    covers:\n      - Isomorphic-by-default principle\n      - createServerFn (RPC boundary)\n      - createServerOnlyFn (throws on client)\n      - createClientOnlyFn (throws on server)\n      - createIsomorphicFn (different impl per env)\n      - ClientOnly component\n      - useHydrated hook\n      - Import protection (experimental)\n      - Environment variables (VITE_ prefix, process.env)\n      - Dead code elimination / tree shaking\n    tasks:\n      - 'Protect server-only code from client bundles'\n      - 'Use environment-specific implementations'\n      - 'Handle environment variables safely'\n      - 'Debug import protection violations'\n    failure_modes:\n      - mistake: 'Assuming loaders are server-only'\n        mechanism: >-\n          ALL code in TanStack Start is isomorphic by default.\n          Loaders run on BOTH server and client. Server-only\n          operations must use createServerFn, createServerOnlyFn,\n          or server routes.\n        wrong_pattern: |\n          export const Route = createFileRoute('/dashboard')({\n            loader: async () => {\n              const secret = process.env.API_SECRET\n              return fetch(`https://api.example.com/data`, {\n                headers: { Authorization: secret }\n              })\n            },\n          })\n        correct_pattern: |\n          const getData = createServerFn({ method: 'GET' })\n            .handler(async () => {\n              const secret = process.env.API_SECRET\n              return fetch(`https://api.example.com/data`, {\n                headers: { Authorization: secret }\n              })\n            })\n\n          export const Route = createFileRoute('/dashboard')({\n            loader: () => getData(),\n          })\n        source: 'docs/start/framework/react/guide/execution-model.md'\n        priority: CRITICAL\n        status: active\n        skills: ['execution-model', 'server-functions']\n\n      - mistake: 'Exposing secrets via module-level process.env'\n        mechanism: >-\n          Module-level process.env access runs in both environments.\n          The variable value leaks into the client bundle. Access\n          secrets only inside createServerFn or createServerOnlyFn.\n        wrong_pattern: |\n          const apiKey = process.env.SECRET_KEY\n          export function fetchData() { ... }\n        correct_pattern: |\n          const fetchData = createServerFn({ method: 'GET' })\n            .handler(async () => {\n              const apiKey = process.env.SECRET_KEY\n              return fetch(url, { headers: { Authorization: apiKey } })\n            })\n        source: 'docs/start/framework/react/guide/execution-model.md'\n        priority: CRITICAL\n        status: active\n\n      - mistake: 'Using VITE_ prefix for server secrets'\n        mechanism: >-\n          VITE_ prefixed variables are exposed to the client bundle.\n          Server secrets must NOT have the VITE_ prefix. Access\n          them via process.env inside server functions only.\n        source: 'docs/start/framework/react/guide/environment-variables.md'\n        priority: CRITICAL\n        status: active\n\n  # ── Server Routes ────────────────────────────────────────────────\n  - name: 'Server Routes'\n    slug: 'server-routes'\n    domain: 'server-routes'\n    description: >-\n      Define server-side API endpoints alongside app routes using\n      the server property with HTTP method handlers, per-handler\n      middleware via createHandlers, request/response patterns.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-server-core'\n    covers:\n      - server property on createFileRoute\n      - handlers object (GET, POST, PUT, DELETE)\n      - createHandlers for per-handler middleware\n      - Handler context (request, params, context)\n      - Request body parsing (json, text, formData)\n      - Response helpers (Response.json)\n      - File naming for API routes\n    tasks:\n      - 'Create a REST API endpoint'\n      - 'Add middleware to server route handlers'\n      - 'Handle different HTTP methods'\n    failure_modes:\n      - mistake: 'Duplicate path resolution for server routes'\n        mechanism: >-\n          Each route can only have a single handler file. Having\n          both users.ts and users/index.ts causes errors.\n        source: 'docs/start/framework/react/guide/server-routes.md'\n        priority: MEDIUM\n        status: active\n\n  # ── Deployment and Rendering ─────────────────────────────────────\n  - name: 'Deployment'\n    slug: 'deployment'\n    domain: 'deployment-and-rendering'\n    description: >-\n      Deploy TanStack Start to Cloudflare Workers, Netlify, Vercel,\n      Node.js/Docker, Bun, Railway. Configure selective SSR, SPA\n      mode, static prerendering, ISR with Cache-Control headers.\n    type: core\n    packages:\n      - '@tanstack/react-start'\n      - '@tanstack/start-plugin-core'\n    covers:\n      - Cloudflare Workers deployment\n      - Netlify deployment\n      - Vercel / Railway deployment\n      - Node.js / Docker deployment\n      - Bun deployment\n      - Selective SSR (ssr option per route)\n      - SPA mode configuration\n      - Static prerendering (prerender option)\n      - ISR with Cache-Control headers\n      - SEO (head property, structured data)\n    tasks:\n      - 'Deploy to Cloudflare Workers'\n      - 'Deploy to Netlify'\n      - 'Configure selective SSR per route'\n      - 'Enable SPA mode'\n      - 'Set up static prerendering'\n      - 'Configure ISR with cache headers'\n    failure_modes:\n      - mistake: 'Bun deployment with React 18'\n        mechanism: >-\n          Bun-specific deployment only works with React 19.\n          For React 18, use Node.js deployment guidelines.\n        source: 'docs/start/framework/react/guide/hosting.md'\n        priority: MEDIUM\n        status: active\n\n      - mistake: 'Missing nodejs_compat flag for Cloudflare Workers'\n        mechanism: >-\n          Cloudflare Workers requires compatibility_flags:\n          [\"nodejs_compat\"] in wrangler config. Without it,\n          Node.js APIs used by Start fail at runtime.\n        source: 'docs/start/framework/react/guide/hosting.md'\n        priority: HIGH\n        status: active\n\n      - mistake: 'Child route loosening parent SSR config'\n        mechanism: >-\n          SSR config inherits from parent and can only become MORE\n          restrictive (true → data-only → false). A child cannot\n          set ssr: true if parent has ssr: false.\n        source: 'docs/start/framework/react/guide/selective-ssr.md'\n        priority: MEDIUM\n        status: active\n\ntensions:\n  - name: 'Isomorphic defaults vs server-only expectations'\n    skills: ['execution-model', 'server-functions']\n    description: >-\n      All code runs everywhere by default. Agents trained on\n      Next.js/Remix assume loaders and route code are server-only.\n    implication: >-\n      Agents put secrets, DB queries, and file system access in\n      loaders instead of server functions, causing client-side\n      failures or security leaks.\n\n  - name: 'Simplicity of isomorphic code vs security boundaries'\n    skills: ['execution-model', 'middleware']\n    description: >-\n      The isomorphic model makes code easy to write but requires\n      explicit boundaries for security. Agents don't realize they\n      need to actively constrain execution environment.\n    implication: >-\n      Agents expose secrets via module-level process.env or\n      forget to validate sendContext data in middleware.\n\ncross_references:\n  - from: 'server-functions'\n    to: 'execution-model'\n    reason: 'Server functions ARE the isomorphic boundary — understanding the execution model is prerequisite'\n  - from: 'server-functions'\n    to: 'middleware'\n    reason: 'Server function middleware chains compose with server functions'\n  - from: 'middleware'\n    to: 'server-routes'\n    reason: 'Server routes use the same middleware system'\n  - from: 'deployment'\n    to: 'execution-model'\n    reason: 'Deployment target affects which environment code runs in'\n\ngaps: []\n"
  },
  {
    "path": "packages/react-start/skills/_artifacts/skill_spec.md",
    "content": "# TanStack Start — Skill Spec\n\nTanStack Start is a full-stack React framework built on TanStack Router and Vite. It adds SSR, streaming, server functions (type-safe RPCs), middleware, server routes, and universal deployment. All code is isomorphic by default — it runs in both server and client environments unless explicitly constrained.\n\n## Domains\n\n| Domain                   | Description                                                   | Skills           |\n| ------------------------ | ------------------------------------------------------------- | ---------------- |\n| Project Setup            | Scaffolding, Vite plugin, router factory, root route, entries | start-setup      |\n| Server Functions         | Type-safe RPCs with createServerFn, validation, streaming     | server-functions |\n| Middleware and Context   | Request/function middleware, context, global middleware       | middleware       |\n| Execution Model          | Isomorphic defaults, environment boundaries, env vars         | execution-model  |\n| Server Routes            | API endpoints, HTTP handlers, handler middleware              | server-routes    |\n| Deployment and Rendering | Hosting, selective SSR, prerendering, SEO                     | deployment       |\n\n## Skill Inventory\n\n| Skill               | Type      | Domain                   | What it covers                                          | Failure modes |\n| ------------------- | --------- | ------------------------ | ------------------------------------------------------- | ------------- |\n| start-setup         | core      | project-setup            | tanstackStart(), getRouter(), root route, entries       | 3             |\n| server-functions    | core      | server-functions         | createServerFn, validation, useServerFn, streaming      | 4             |\n| middleware          | core      | middleware-and-context   | createMiddleware, context, global middleware, factories | 3             |\n| execution-model     | core      | execution-model          | Isomorphic defaults, environment functions, env vars    | 4             |\n| server-routes       | core      | server-routes            | server property, HTTP handlers, createHandlers          | 2             |\n| deployment          | core      | deployment-and-rendering | Hosting, SSR modes, prerendering, SEO                   | 3             |\n| react-start         | framework | project-setup            | React bindings, useServerFn, full setup                 | 3             |\n| migrate-from-nextjs | lifecycle | project-setup            | Next.js App Router migration checklist                  | 3             |\n\n## Failure Mode Inventory\n\n### start-setup (3 failure modes)\n\n| #   | Mistake                                         | Priority | Source                  |\n| --- | ----------------------------------------------- | -------- | ----------------------- |\n| 1   | React plugin before Start plugin in Vite config | CRITICAL | docs/build-from-scratch |\n| 2   | Enabling verbatimModuleSyntax in tsconfig       | HIGH     | docs/build-from-scratch |\n| 3   | Missing Scripts component in root route         | HIGH     | docs/guide/routing      |\n\n### server-functions (4 failure modes)\n\n| #   | Mistake                                                                     | Priority | Source                      |\n| --- | --------------------------------------------------------------------------- | -------- | --------------------------- |\n| 1   | Putting server-only code in loaders instead of server functions             | CRITICAL | maintainer interview        |\n| 2   | Generating Next.js/Remix server patterns (\"use server\", getServerSideProps) | CRITICAL | maintainer interview        |\n| 3   | Using dynamic imports for server functions                                  | HIGH     | docs/guide/server-functions |\n| 4   | Not using useServerFn for component calls                                   | MEDIUM   | docs/guide/server-functions |\n\n### middleware (3 failure modes)\n\n| #   | Mistake                                               | Priority | Source                |\n| --- | ----------------------------------------------------- | -------- | --------------------- |\n| 1   | Trusting client sendContext without server validation | HIGH     | docs/guide/middleware |\n| 2   | Confusing request vs server function middleware       | MEDIUM   | docs/guide/middleware |\n| 3   | Wrong middleware method order                         | MEDIUM   | docs/guide/middleware |\n\n### execution-model (4 failure modes)\n\n| #   | Mistake                                           | Priority | Source                           |\n| --- | ------------------------------------------------- | -------- | -------------------------------- |\n| 1   | Assuming loaders are server-only                  | CRITICAL | docs/guide/execution-model       |\n| 2   | Exposing secrets via module-level process.env     | CRITICAL | docs/guide/execution-model       |\n| 3   | Using VITE\\_ prefix for server secrets            | CRITICAL | docs/guide/environment-variables |\n| 4   | Hydration mismatches from env-dependent rendering | HIGH     | docs/guide/execution-model       |\n\n### server-routes (2 failure modes)\n\n| #   | Mistake                                  | Priority | Source                   |\n| --- | ---------------------------------------- | -------- | ------------------------ |\n| 1   | Duplicate route path resolution          | MEDIUM   | docs/guide/server-routes |\n| 2   | Forgetting to await request body methods | MEDIUM   | docs/guide/server-routes |\n\n### deployment (3 failure modes)\n\n| #   | Mistake                                           | Priority | Source                   |\n| --- | ------------------------------------------------- | -------- | ------------------------ |\n| 1   | Missing nodejs_compat flag for Cloudflare Workers | HIGH     | docs/guide/hosting       |\n| 2   | Bun deployment with React 18                      | MEDIUM   | docs/guide/hosting       |\n| 3   | Child route loosening parent SSR config           | MEDIUM   | docs/guide/selective-ssr |\n\n## Tensions\n\n| Tension                                              | Skills                             | Agent implication                                                             |\n| ---------------------------------------------------- | ---------------------------------- | ----------------------------------------------------------------------------- |\n| Isomorphic defaults vs server-only expectations      | execution-model ↔ server-functions | Agents put secrets/DB queries in loaders instead of server functions          |\n| Simplicity of isomorphic code vs security boundaries | execution-model ↔ middleware       | Agents expose secrets via module-level process.env or skip context validation |\n\n## Cross-References\n\n| From             | To              | Reason                                          |\n| ---------------- | --------------- | ----------------------------------------------- |\n| server-functions | execution-model | Server functions ARE the isomorphic boundary    |\n| server-functions | middleware      | Middleware chains compose with server functions |\n| middleware       | server-routes   | Server routes use the same middleware system    |\n| deployment       | execution-model | Deployment target affects where code runs       |\n"
  },
  {
    "path": "packages/react-start/skills/_artifacts/skill_tree.yaml",
    "content": "# skills/_artifacts/start_skill_tree.yaml\nlibrary:\n  name: '@tanstack/react-start'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Full-stack React framework built on TanStack Router and Vite.\n    Adds SSR, streaming, server functions (type-safe RPCs), middleware,\n    server routes, and universal deployment. Isomorphic by default —\n    all code runs in both environments unless explicitly constrained.\ngenerated_from:\n  domain_map: '_artifacts/start_domain_map.yaml'\ngenerated_at: '2026-03-07'\n\nskills:\n  # ── Start Core Skills ───────────────────────────────────────────\n  - name: 'Start Core'\n    slug: 'start-core'\n    type: 'core'\n    domain: 'project-setup'\n    path: 'skills/start-core/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      Core overview for TanStack Start: tanstackStart() Vite plugin,\n      getRouter() factory, root route document shell (HeadContent,\n      Scripts, Outlet), client/server entry points, routeTree.gen.ts,\n      tsconfig configuration. Entry point for all Start skills.\n    sources:\n      - 'TanStack/router:docs/start/framework/react/build-from-scratch.md'\n      - 'TanStack/router:docs/start/framework/react/quick-start.md'\n      - 'TanStack/router:docs/start/framework/react/guide/routing.md'\n\n  - name: 'Server Functions'\n    slug: 'start-core/server-functions'\n    type: 'sub-skill'\n    domain: 'server-functions'\n    path: 'skills/start-core/server-functions/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      createServerFn (GET/POST), inputValidator (Zod or function),\n      useServerFn hook, server context utilities (getRequest,\n      getRequestHeader, setResponseHeader, setResponseStatus), error\n      handling (throw errors, redirect, notFound), streaming\n      (ReadableStream, async generators), FormData handling, file\n      organization (.functions.ts, .server.ts).\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/server-functions.md'\n\n  - name: 'Middleware'\n    slug: 'start-core/middleware'\n    type: 'sub-skill'\n    domain: 'middleware-and-context'\n    path: 'skills/start-core/middleware/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      createMiddleware, request middleware (.server only), server\n      function middleware (.client + .server), context passing via\n      next({ context }), sendContext for client-server transfer,\n      global middleware via createStart in src/start.ts, middleware\n      factories, method order enforcement.\n    requires:\n      - 'start-core'\n      - 'start-core/server-functions'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/middleware.md'\n\n  - name: 'Execution Model'\n    slug: 'start-core/execution-model'\n    type: 'sub-skill'\n    domain: 'execution-model'\n    path: 'skills/start-core/execution-model/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      Isomorphic-by-default principle, environment boundary functions\n      (createServerFn, createServerOnlyFn, createClientOnlyFn,\n      createIsomorphicFn), ClientOnly component, useHydrated hook,\n      import protection, dead code elimination, environment variable\n      safety (VITE_ prefix, process.env).\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/execution-model.md'\n      - 'TanStack/router:docs/start/framework/react/guide/environment-variables.md'\n\n  - name: 'Server Routes'\n    slug: 'start-core/server-routes'\n    type: 'sub-skill'\n    domain: 'server-routes'\n    path: 'skills/start-core/server-routes/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      Server-side API endpoints using the server property on\n      createFileRoute, HTTP method handlers (GET, POST, PUT, DELETE),\n      createHandlers for per-handler middleware, handler context\n      (request, params, context), request body parsing, response\n      helpers, file naming for API routes.\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/server-routes.md'\n\n  - name: 'Deployment'\n    slug: 'start-core/deployment'\n    type: 'sub-skill'\n    domain: 'deployment-and-rendering'\n    path: 'skills/start-core/deployment/SKILL.md'\n    package: 'packages/start-client-core'\n    description: >-\n      Deploy to Cloudflare Workers, Netlify, Vercel, Node.js/Docker,\n      Bun, Railway. Selective SSR (ssr option per route), SPA mode,\n      static prerendering, ISR with Cache-Control headers, SEO and\n      head management.\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/hosting.md'\n      - 'TanStack/router:docs/start/framework/react/guide/selective-ssr.md'\n      - 'TanStack/router:docs/start/framework/react/guide/static-prerendering.md'\n      - 'TanStack/router:docs/start/framework/react/guide/full-stack-seo.md'\n\n  # ── React Start Skills ──────────────────────────────────────────\n  - name: 'React Start'\n    slug: 'react-start'\n    type: 'framework'\n    domain: 'project-setup'\n    path: 'skills/react-start/SKILL.md'\n    package: 'packages/react-start'\n    description: >-\n      React bindings for TanStack Start: createStart, StartClient,\n      StartServer, React-specific imports, re-exports from\n      @tanstack/react-router, full project setup with React.\n    requires:\n      - 'start-core'\n    sources:\n      - 'TanStack/router:packages/react-start/src'\n      - 'TanStack/router:docs/start/framework/react/build-from-scratch.md'\n\n  # ── Lifecycle Skills ────────────────────────────────────────────\n  - name: 'Migrate from Next.js'\n    slug: 'lifecycle/migrate-from-nextjs'\n    type: 'lifecycle'\n    domain: 'project-setup'\n    path: 'skills/lifecycle/migrate-from-nextjs/SKILL.md'\n    package: 'packages/react-start'\n    description: >-\n      Step-by-step migration from Next.js App Router to TanStack\n      Start: route definition conversion, API mapping, server\n      function conversion from Server Actions, middleware conversion,\n      data fetching pattern changes.\n    requires:\n      - 'start-core'\n      - 'react-start'\n    sources:\n      - 'TanStack/router:docs/start/framework/react/guide/server-functions.md'\n      - 'TanStack/router:docs/start/framework/react/guide/middleware.md'\n      - 'TanStack/router:docs/start/framework/react/guide/execution-model.md'\n"
  },
  {
    "path": "packages/react-start/skills/lifecycle/migrate-from-nextjs/SKILL.md",
    "content": "---\nname: lifecycle/migrate-from-nextjs\ndescription: >-\n  Step-by-step migration from Next.js App Router to TanStack Start:\n  route definition conversion, API mapping, server function\n  conversion from Server Actions, middleware conversion, data\n  fetching pattern changes.\ntype: lifecycle\nlibrary: tanstack-start\nlibrary_version: '1.166.2'\nrequires:\n  - start-core\n  - react-start\nsources:\n  - TanStack/router:docs/start/framework/react/guide/server-functions.md\n  - TanStack/router:docs/start/framework/react/guide/middleware.md\n  - TanStack/router:docs/start/framework/react/guide/execution-model.md\n---\n\n# Migrate from Next.js App Router to TanStack Start\n\nThis is a step-by-step migration checklist. Complete tasks in order.\n\n> **CRITICAL**: TanStack Start is isomorphic by default. ALL code runs in both environments unless you use `createServerFn`. This is the opposite of Next.js Server Components, where code is server-only by default.\n\n> **CRITICAL**: TanStack Start uses `createServerFn`, NOT `\"use server\"` directives. Do not carry over any `\"use server\"` or `\"use client\"` directives.\n\n> **CRITICAL**: Types are FULLY INFERRED in TanStack Router/Start. Never cast, never annotate inferred values.\n\n## Pre-Migration\n\n- [ ] **Create a migration branch**\n\n```bash\ngit checkout -b migrate-to-tanstack-start\n```\n\n- [ ] **Install TanStack Start**\n\n```bash\nnpm i @tanstack/react-start @tanstack/react-router\nnpm i -D vite @vitejs/plugin-react\n```\n\n- [ ] **Remove Next.js**\n\n```bash\nnpm uninstall next @next/font @next/image\n```\n\n## Concept Mapping\n\n| Next.js App Router               | TanStack Start                                                            |\n| -------------------------------- | ------------------------------------------------------------------------- |\n| `app/page.tsx`                   | `src/routes/index.tsx`                                                    |\n| `app/layout.tsx`                 | `src/routes/__root.tsx`                                                   |\n| `app/posts/[id]/page.tsx`        | `src/routes/posts/$postId.tsx`                                            |\n| `app/api/users/route.ts`         | `src/routes/api/users.ts` (server property)                               |\n| `\"use server\"` + Server Actions  | `createServerFn()`                                                        |\n| `\"use client\"`                   | Not needed (everything is isomorphic)                                     |\n| Server Components (default)      | All components are isomorphic; use `createServerFn` for server-only logic |\n| `next/navigation` `useRouter`    | `useRouter()` from `@tanstack/react-router`                               |\n| `next/link` `Link`               | `<Link>` from `@tanstack/react-router`                                    |\n| `next/head` or `metadata` export | `head` property on route                                                  |\n| `middleware.ts` (edge)           | `createMiddleware()` in `src/start.ts`                                    |\n| `next.config.js`                 | `vite.config.ts` with `tanstackStart()`                                   |\n| `generateStaticParams`           | `prerender` config in `vite.config.ts`                                    |\n\n## Step 1: Vite Configuration\n\nReplace `next.config.js` with:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart(), // MUST come before react()\n    viteReact(),\n  ],\n})\n```\n\nUpdate `package.json`:\n\n```json\n{\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\",\n    \"start\": \"node .output/server/index.mjs\"\n  }\n}\n```\n\n## Step 2: Router Factory\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n  return router\n}\n```\n\n## Step 3: Convert Layout → Root Route\n\nNext.js:\n\n```tsx\n// app/layout.tsx\nexport const metadata = { title: 'My App' }\nexport default function RootLayout({ children }) {\n  return (\n    <html>\n      <body>{children}</body>\n    </html>\n  )\n}\n```\n\nTanStack Start:\n\n```tsx\n// src/routes/__root.tsx\nimport type { ReactNode } from 'react'\nimport {\n  Outlet,\n  createRootRoute,\n  HeadContent,\n  Scripts,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { title: 'My App' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n## Step 4: Convert Pages → File Routes\n\nNext.js:\n\n```tsx\n// app/posts/[id]/page.tsx\nexport default function PostPage({ params }: { params: { id: string } }) {\n  // ...\n}\n```\n\nTanStack Start:\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostPage,\n})\n\nfunction PostPage() {\n  const { postId } = Route.useParams()\n  // ...\n}\n```\n\nKey differences:\n\n- Dynamic segments use `$param` not `[param]`\n- Params accessed via `Route.useParams()` not component props\n- Route path in filename uses `.` or `/` separators\n\n## Step 5: Convert Server Actions → Server Functions\n\nNext.js:\n\n```tsx\n// app/actions.ts\n'use server'\nexport async function createPost(formData: FormData) {\n  const title = formData.get('title') as string\n  await db.posts.create({ title })\n}\n```\n\nTanStack Start:\n\n```tsx\n// src/utils/posts.functions.ts\nimport { createServerFn } from '@tanstack/react-start'\n\nexport const createPost = createServerFn({ method: 'POST' })\n  .inputValidator((data) => {\n    if (!(data instanceof FormData)) throw new Error('Expected FormData')\n    return { title: data.get('title')?.toString() || '' }\n  })\n  .handler(async ({ data }) => {\n    await db.posts.create({ title: data.title })\n    return { success: true }\n  })\n```\n\n## Step 6: Convert Data Fetching\n\nNext.js Server Component:\n\n```tsx\n// app/posts/page.tsx (Server Component — server-only by default)\nexport default async function PostsPage() {\n  const posts = await db.posts.findMany()\n  return <PostList posts={posts} />\n}\n```\n\nTanStack Start:\n\n```tsx\n// src/routes/posts.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst getPosts = createServerFn({ method: 'GET' }).handler(async () => {\n  return db.posts.findMany()\n})\n\nexport const Route = createFileRoute('/posts')({\n  loader: () => getPosts(), // loader is isomorphic, getPosts runs on server\n  component: PostsPage,\n})\n\nfunction PostsPage() {\n  const posts = Route.useLoaderData()\n  return <PostList posts={posts} />\n}\n```\n\n## Step 7: Convert API Routes → Server Routes\n\nNext.js:\n\n```ts\n// app/api/users/route.ts\nexport async function GET() {\n  const users = await db.users.findMany()\n  return Response.json(users)\n}\n```\n\nTanStack Start:\n\n```ts\n// src/routes/api/users.ts\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/users')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const users = await db.users.findMany()\n        return Response.json(users)\n      },\n    },\n  },\n})\n```\n\n## Step 8: Convert Navigation\n\nNext.js:\n\n```tsx\nimport Link from 'next/link'\n;<Link href={`/posts/${post.id}`}>View Post</Link>\n```\n\nTanStack Start:\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n;<Link to=\"/posts/$postId\" params={{ postId: post.id }}>\n  View Post\n</Link>\n```\n\nNever interpolate params into the `to` string. Use `params` prop.\n\n## Step 9: Convert Middleware\n\nNext.js:\n\n```ts\n// middleware.ts\nexport function middleware(request: NextRequest) {\n  const token = request.cookies.get('session')\n  if (!token) return NextResponse.redirect(new URL('/login', request.url))\n}\nexport const config = { matcher: ['/dashboard/:path*'] }\n```\n\nTanStack Start:\n\n```tsx\n// src/start.ts — must be manually created\nimport { createStart, createMiddleware } from '@tanstack/react-start'\nimport { redirect } from '@tanstack/react-router'\n\nconst authMiddleware = createMiddleware().server(async ({ next, request }) => {\n  const cookie = request.headers.get('cookie')\n  if (!cookie?.includes('session=')) {\n    throw redirect({ to: '/login' })\n  }\n  return next()\n})\n\nexport const startInstance = createStart(() => ({\n  requestMiddleware: [authMiddleware],\n}))\n```\n\n## Step 10: Convert Metadata/SEO\n\nNext.js:\n\n```tsx\nexport const metadata = {\n  title: 'Post Title',\n  description: 'Post description',\n}\n```\n\nTanStack Start:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => fetchPost(params.postId),\n  head: ({ loaderData }) => ({\n    meta: [\n      { title: loaderData.title },\n      { name: 'description', content: loaderData.excerpt },\n      { property: 'og:title', content: loaderData.title },\n    ],\n  }),\n})\n```\n\n## Post-Migration Checklist\n\n- [ ] Remove all `\"use server\"` and `\"use client\"` directives\n- [ ] Remove `next.config.js` / `next.config.ts`\n- [ ] Remove `app/` directory (replaced by `src/routes/`)\n- [ ] Remove `middleware.ts` (replaced by `src/start.ts`)\n- [ ] Verify no `next/*` imports remain\n- [ ] Run `npm run dev` and check all routes\n- [ ] Verify server-only code is inside `createServerFn` (not bare in components/loaders)\n- [ ] Check that `<Scripts />` is in the root route `<body>`\n\n## Common Mistakes\n\n### 1. CRITICAL: Keeping Server Component mental model\n\n```tsx\n// WRONG — treating component as server-only (Next.js habit)\nfunction PostsPage() {\n  const posts = await db.posts.findMany() // fails on client\n  return <div>{posts.map(...)}</div>\n}\n\n// CORRECT — use server function + loader\nconst getPosts = createServerFn({ method: 'GET' }).handler(async () => {\n  return db.posts.findMany()\n})\n\nexport const Route = createFileRoute('/posts')({\n  loader: () => getPosts(),\n  component: PostsPage,\n})\n```\n\n### 2. CRITICAL: Using \"use server\" directive\n\n```tsx\n// WRONG — \"use server\" is Next.js/React pattern\n'use server'\nexport async function myAction() { ... }\n\n// CORRECT — use createServerFn\nexport const myAction = createServerFn({ method: 'POST' })\n  .handler(async () => { ... })\n```\n\n### 3. HIGH: Interpolating params into Link href\n\n```tsx\n// WRONG — Next.js pattern\n<Link to={`/posts/${post.id}`}>View</Link>\n\n// CORRECT — TanStack Router pattern\n<Link to=\"/posts/$postId\" params={{ postId: post.id }}>View</Link>\n```\n\n## Cross-References\n\n- [react-start](../../react-start/SKILL.md) — full React Start setup\n- [start-core/server-functions](../../../../start-client-core/skills/start-core/server-functions/SKILL.md) — server function patterns\n- [start-core/execution-model](../../../../start-client-core/skills/start-core/execution-model/SKILL.md) — isomorphic execution\n"
  },
  {
    "path": "packages/react-start/skills/react-start/SKILL.md",
    "content": "---\nname: react-start\ndescription: >-\n  React bindings for TanStack Start: createStart, StartClient,\n  StartServer, React-specific imports, re-exports from\n  @tanstack/react-router, full project setup with React, useServerFn\n  hook.\ntype: framework\nlibrary: tanstack-start\nlibrary_version: '1.166.2'\nframework: react\nrequires:\n  - start-core\nsources:\n  - TanStack/router:packages/react-start/src\n  - TanStack/router:docs/start/framework/react/build-from-scratch.md\n---\n\n# React Start (`@tanstack/react-start`)\n\nThis skill builds on start-core. Read [start-core](../../../start-client-core/skills/start-core/SKILL.md) first for foundational concepts.\n\nThis skill covers the React-specific bindings, setup, and patterns for TanStack Start.\n\n> **CRITICAL**: All code is ISOMORPHIC by default. Loaders run on BOTH server and client. Use `createServerFn` for server-only logic.\n\n> **CRITICAL**: Do not confuse `@tanstack/react-start` with Next.js or Remix. They are completely different frameworks with different APIs.\n\n> **CRITICAL**: Types are FULLY INFERRED. Never cast, never annotate inferred values.\n\n## Package API Surface\n\n`@tanstack/react-start` re-exports everything from `@tanstack/start-client-core` plus:\n\n- `useServerFn` — React hook for calling server functions from components\n\nAll core APIs (`createServerFn`, `createMiddleware`, `createStart`, `createIsomorphicFn`, `createServerOnlyFn`, `createClientOnlyFn`) are available from `@tanstack/react-start`.\n\nServer utilities (`getRequest`, `getRequestHeader`, `setResponseHeader`, `setResponseHeaders`, `setResponseStatus`) are imported from `@tanstack/react-start/server`.\n\n## Full Project Setup\n\n### 1. Install Dependencies\n\n```bash\nnpm i @tanstack/react-start @tanstack/react-router react react-dom\nnpm i -D vite @vitejs/plugin-react typescript @types/react @types/react-dom\n```\n\n### 2. package.json\n\n```json\n{\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite dev\",\n    \"build\": \"vite build\",\n    \"start\": \"node .output/server/index.mjs\"\n  }\n}\n```\n\n### 3. tsconfig.json\n\n```json\n{\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"moduleResolution\": \"Bundler\",\n    \"module\": \"ESNext\",\n    \"target\": \"ES2022\",\n    \"skipLibCheck\": true,\n    \"strictNullChecks\": true\n  }\n}\n```\n\n### 4. vite.config.ts\n\n```ts\nimport { defineConfig } from 'vite'\nimport { tanstackStart } from '@tanstack/react-start/plugin/vite'\nimport viteReact from '@vitejs/plugin-react'\n\nexport default defineConfig({\n  plugins: [\n    tanstackStart(), // MUST come before react()\n    viteReact(),\n  ],\n})\n```\n\n### 5. Router Factory (src/router.tsx)\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function getRouter() {\n  const router = createRouter({\n    routeTree,\n    scrollRestoration: true,\n  })\n  return router\n}\n```\n\n### 6. Root Route (src/routes/\\_\\_root.tsx)\n\n```tsx\nimport type { ReactNode } from 'react'\nimport {\n  Outlet,\n  createRootRoute,\n  HeadContent,\n  Scripts,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'utf-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1' },\n      { title: 'My TanStack Start App' },\n    ],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <RootDocument>\n      <Outlet />\n    </RootDocument>\n  )\n}\n\nfunction RootDocument({ children }: Readonly<{ children: ReactNode }>) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n### 7. Index Route (src/routes/index.tsx)\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { createServerFn } from '@tanstack/react-start'\n\nconst getGreeting = createServerFn({ method: 'GET' }).handler(async () => {\n  return 'Hello from TanStack Start!'\n})\n\nexport const Route = createFileRoute('/')({\n  loader: () => getGreeting(),\n  component: HomePage,\n})\n\nfunction HomePage() {\n  const greeting = Route.useLoaderData()\n  return <h1>{greeting}</h1>\n}\n```\n\n## useServerFn Hook\n\nUse `useServerFn` to call server functions from React components with proper integration:\n\n```tsx\nimport { createServerFn, useServerFn } from '@tanstack/react-start'\n\nconst updatePost = createServerFn({ method: 'POST' })\n  .inputValidator((data: { id: string; title: string }) => data)\n  .handler(async ({ data }) => {\n    await db.posts.update(data.id, { title: data.title })\n    return { success: true }\n  })\n\nfunction EditPostForm({ postId }: { postId: string }) {\n  const updatePostFn = useServerFn(updatePost)\n  const [title, setTitle] = useState('')\n\n  return (\n    <form\n      onSubmit={async (e) => {\n        e.preventDefault()\n        await updatePostFn({ data: { id: postId, title } })\n      }}\n    >\n      <input value={title} onChange={(e) => setTitle(e.target.value)} />\n      <button type=\"submit\">Save</button>\n    </form>\n  )\n}\n```\n\n## Global Start Configuration (src/start.ts)\n\n```tsx\nimport { createStart, createMiddleware } from '@tanstack/react-start'\n\nconst requestLogger = createMiddleware().server(async ({ next, request }) => {\n  console.log(`${request.method} ${request.url}`)\n  return next()\n})\n\nexport const startInstance = createStart(() => ({\n  requestMiddleware: [requestLogger],\n}))\n```\n\n## React-Specific Components\n\nAll routing components from `@tanstack/react-router` work in Start:\n\n- `<RouterProvider>` — not needed in Start (handled automatically)\n- `<Outlet>` — renders matched child route\n- `<Link>` — type-safe navigation\n- `<Navigate>` — declarative redirect\n- `<HeadContent>` — renders head tags (must be in `<head>`)\n- `<Scripts>` — renders body scripts (must be in `<body>`)\n- `<Await>` — renders deferred data with Suspense\n- `<ClientOnly>` — renders children only after hydration\n- `<CatchBoundary>` — error boundary\n\n## Hooks Reference\n\nAll hooks from `@tanstack/react-router` work in Start:\n\n- `useRouter()` — router instance\n- `useRouterState()` — subscribe to router state\n- `useNavigate()` — programmatic navigation\n- `useSearch({ from })` — validated search params\n- `useParams({ from })` — path params\n- `useLoaderData({ from })` — loader data\n- `useMatch({ from })` — full route match\n- `useRouteContext({ from })` — route context\n- `Route.useLoaderData()` — typed loader data (preferred in route files)\n- `Route.useSearch()` — typed search params (preferred in route files)\n\n## Common Mistakes\n\n### 1. CRITICAL: Importing from wrong package\n\n```tsx\n// WRONG — this is the SPA router, NOT Start\nimport { createServerFn } from '@tanstack/react-router'\n\n// CORRECT — server functions come from react-start\nimport { createServerFn } from '@tanstack/react-start'\n\n// CORRECT — routing APIs come from react-router (re-exported by Start too)\nimport { createFileRoute, Link } from '@tanstack/react-router'\n```\n\n### 2. HIGH: Using React hooks in beforeLoad or loader\n\n```tsx\n// WRONG — beforeLoad/loader are NOT React components\nbeforeLoad: () => {\n  const auth = useAuth() // React hook, cannot be used here\n}\n\n// CORRECT — pass state via router context\nconst rootRoute = createRootRouteWithContext<{ auth: AuthState }>()({})\n```\n\n### 3. HIGH: Missing Scripts component\n\nWithout `<Scripts />` in the root route's `<body>`, client JavaScript doesn't load and the app won't hydrate.\n\n## Cross-References\n\n- [start-core](../../../start-client-core/skills/start-core/SKILL.md) — core Start concepts\n- [router-core](../../../router-core/skills/router-core/SKILL.md) — routing fundamentals\n- [react-router](../../../react-router/skills/react-router/SKILL.md) — React Router hooks and components\n"
  },
  {
    "path": "packages/react-start/src/client-only.ts",
    "content": "/**\n * Side-effect-only marker import.\n *\n * Usage:\n *   import '@tanstack/react-start/client-only'\n *\n * When this import appears in a module, the import-protection plugin marks\n * that module as client-only. Importing a client-only module from the server\n * environment will trigger a violation (error or mock depending on config).\n *\n * At build time, the plugin intercepts this specifier in `resolveId` and\n * replaces it with a virtual empty module — this source file exists only\n * so that TypeScript and IDE tooling can resolve the import.\n */\nexport {}\n"
  },
  {
    "path": "packages/react-start/src/client-rpc.ts",
    "content": "export * from '@tanstack/start-client-core/client-rpc'\n"
  },
  {
    "path": "packages/react-start/src/client.tsx",
    "content": "export * from '@tanstack/react-start-client'\n"
  },
  {
    "path": "packages/react-start/src/default-entry/client.tsx",
    "content": "import { StrictMode, startTransition } from 'react'\nimport { hydrateRoot } from 'react-dom/client'\nimport { StartClient } from '@tanstack/react-start/client'\n\nstartTransition(() => {\n  hydrateRoot(\n    document,\n    <StrictMode>\n      <StartClient />\n    </StrictMode>,\n  )\n})\n"
  },
  {
    "path": "packages/react-start/src/default-entry/server.ts",
    "content": "import {\n  createStartHandler,\n  defaultStreamHandler,\n} from '@tanstack/react-start/server'\nimport type { Register } from '@tanstack/react-router'\nimport type { RequestHandler } from '@tanstack/react-start/server'\n\nconst fetch = createStartHandler(defaultStreamHandler)\n\n// Providing `RequestHandler` from `@tanstack/react-start/server` is required so that the output types don't import it from `@tanstack/start-server-core`\nexport type ServerEntry = { fetch: RequestHandler<Register> }\n\nexport function createServerEntry(entry: ServerEntry): ServerEntry {\n  return {\n    async fetch(...args) {\n      return await entry.fetch(...args)\n    },\n  }\n}\n\nexport default createServerEntry({ fetch })\n"
  },
  {
    "path": "packages/react-start/src/default-entry/start.ts",
    "content": "export const startInstance = undefined\n"
  },
  {
    "path": "packages/react-start/src/index.ts",
    "content": "export { useServerFn } from './useServerFn'\nexport * from '@tanstack/start-client-core'\n"
  },
  {
    "path": "packages/react-start/src/plugin/vite.ts",
    "content": "import { fileURLToPath } from 'node:url'\nimport {\n  TanStackStartVitePluginCore,\n  VITE_ENVIRONMENT_NAMES,\n} from '@tanstack/start-plugin-core'\nimport path from 'pathe'\nimport type { TanStackStartInputConfig } from '@tanstack/start-plugin-core'\nimport type { PluginOption } from 'vite'\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url))\nconst defaultEntryDir = path.resolve(\n  currentDir,\n  '..',\n  '..',\n  'plugin',\n  'default-entry',\n)\nconst defaultEntryPaths = {\n  client: path.resolve(defaultEntryDir, 'client.tsx'),\n  server: path.resolve(defaultEntryDir, 'server.ts'),\n  start: path.resolve(defaultEntryDir, 'start.ts'),\n}\n\nconst isInsideRouterMonoRepo =\n  path.basename(path.resolve(currentDir, '../../../../')) === 'packages'\n\nexport function tanstackStart(\n  options?: TanStackStartInputConfig,\n): Array<PluginOption> {\n  return [\n    {\n      name: 'tanstack-react-start:config',\n      configEnvironment(environmentName, options) {\n        return {\n          resolve: {\n            dedupe: [\n              'react',\n              'react-dom',\n              '@tanstack/react-start',\n              '@tanstack/react-router',\n            ],\n            external:\n              options.resolve?.noExternal === true || !isInsideRouterMonoRepo\n                ? undefined\n                : ['@tanstack/react-router', '@tanstack/react-router-devtools'],\n          },\n          optimizeDeps:\n            environmentName === VITE_ENVIRONMENT_NAMES.client ||\n            (environmentName === VITE_ENVIRONMENT_NAMES.server &&\n              // This indicates that the server environment has opted in to dependency optimization\n              options.optimizeDeps?.noDiscovery === false)\n              ? {\n                  // As `@tanstack/react-start` depends on `@tanstack/react-router`, we should exclude both.\n                  exclude: [\n                    '@tanstack/react-start',\n                    '@tanstack/react-router',\n                    '@tanstack/react-router-devtools',\n                    '@tanstack/start-static-server-functions',\n                  ],\n                  include: [\n                    'react',\n                    'react/jsx-runtime',\n                    'react/jsx-dev-runtime',\n                    'react-dom',\n                    ...(environmentName === VITE_ENVIRONMENT_NAMES.client\n                      ? ['react-dom/client']\n                      : ['react-dom/server']),\n                    // `@tanstack/react-store` has a dependency on `use-sync-external-store`, which is CJS.\n                    // It therefore needs to be included so that it is converted to ESM.\n                    '@tanstack/react-router > @tanstack/react-store',\n                    ...(options.optimizeDeps?.exclude?.find(\n                      (x) => x === '@tanstack/react-form',\n                    )\n                      ? ['@tanstack/react-form > @tanstack/react-store']\n                      : []),\n                  ],\n                }\n              : undefined,\n        }\n      },\n    },\n    TanStackStartVitePluginCore(\n      {\n        framework: 'react',\n        defaultEntryPaths,\n      },\n      options,\n    ),\n  ]\n}\n"
  },
  {
    "path": "packages/react-start/src/server-only.ts",
    "content": "/**\n * Side-effect-only marker import.\n *\n * Usage:\n *   import '@tanstack/react-start/server-only'\n *\n * When this import appears in a module, the import-protection plugin marks\n * that module as server-only. Importing a server-only module from the client\n * environment will trigger a violation (error or mock depending on config).\n *\n * At build time, the plugin intercepts this specifier in `resolveId` and\n * replaces it with a virtual empty module — this source file exists only\n * so that TypeScript and IDE tooling can resolve the import.\n */\nexport {}\n"
  },
  {
    "path": "packages/react-start/src/server-rpc.ts",
    "content": "export { createServerRpc } from '@tanstack/start-server-core/createServerRpc'\n"
  },
  {
    "path": "packages/react-start/src/server.tsx",
    "content": "export * from '@tanstack/react-start-server'\n"
  },
  {
    "path": "packages/react-start/src/ssr-rpc.ts",
    "content": "export { createSsrRpc } from '@tanstack/start-server-core/createSsrRpc'\n"
  },
  {
    "path": "packages/react-start/src/useServerFn.ts",
    "content": "import * as React from 'react'\nimport { isRedirect, useRouter } from '@tanstack/react-router'\n\nexport function useServerFn<T extends (...deps: Array<any>) => Promise<any>>(\n  serverFn: T,\n): (...args: Parameters<T>) => ReturnType<T> {\n  const router = useRouter()\n\n  return React.useCallback(\n    async (...args: Array<any>) => {\n      try {\n        const res = await serverFn(...args)\n\n        if (isRedirect(res)) {\n          throw res\n        }\n\n        return res\n      } catch (err) {\n        if (isRedirect(err)) {\n          err.options._fromLocation = router.stores.location.state\n          return router.navigate(router.resolveRedirect(err).options)\n        }\n\n        throw err\n      }\n    },\n    [router, serverFn],\n  ) as any\n}\n"
  },
  {
    "path": "packages/react-start/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"module\": \"esnext\"\n  },\n  \"include\": [\"src\", \"vite.config.ts\", \"vite.config.server-entry.ts\"]\n}\n"
  },
  {
    "path": "packages/react-start/vite.config.server-entry.ts",
    "content": "import { tanstackViteConfig } from '@tanstack/vite-config'\n\nexport default tanstackViteConfig({\n  srcDir: './src/default-entry',\n  exclude: ['./src/default-entry/client.tsx'],\n  entry: ['./src/default-entry/server.ts'],\n  externalDeps: ['@tanstack/react-start/server'],\n  outDir: './dist/default-entry',\n  cjs: false,\n})\n"
  },
  {
    "path": "packages/react-start/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport { copyFilesPlugin } from '@tanstack/router-utils'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  test: {\n    name: packageJson.name,\n    watch: false,\n    environment: 'jsdom',\n  },\n  plugins: [\n    copyFilesPlugin({\n      pattern: ['*.ts', '*.tsx', '!*.d.ts'],\n      fromDir: 'src/default-entry',\n      toDir: 'dist/plugin/default-entry',\n    }),\n  ],\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    srcDir: './src',\n    exclude: ['./src/default-entry'],\n    entry: [\n      './src/index.ts',\n      './src/client.tsx',\n      './src/client-rpc.ts',\n      './src/server.tsx',\n      './src/server-rpc.ts',\n      './src/ssr-rpc.ts',\n      './src/plugin/vite.ts',\n      './src/server-only.ts',\n      './src/client-only.ts',\n    ],\n    externalDeps: [\n      '@tanstack/react-start-client',\n      '@tanstack/react-start-server',\n    ],\n    cjs: false,\n  }),\n)\n"
  },
  {
    "path": "packages/react-start-client/CHANGELOG.md",
    "content": "# @tanstack/react-start-client\n\n## 1.166.16\n\n### Patch Changes\n\n- Updated dependencies [[`91cc628`](https://github.com/TanStack/router/commit/91cc62899b75ca920fe83c5ee7f3dbb5c71a523f)]:\n  - @tanstack/react-router@1.168.1\n  - @tanstack/router-core@1.168.1\n  - @tanstack/start-client-core@1.167.1\n\n## 1.166.15\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/start-client-core@1.167.0\n  - @tanstack/react-router@1.168.0\n  - @tanstack/router-core@1.168.0\n\n## 1.166.14\n\n### Patch Changes\n\n- Updated dependencies [[`5ff4f0b`](https://github.com/TanStack/router/commit/5ff4f0b8dce1fac2bb0b0bfe2684fc677a8ee505)]:\n  - @tanstack/router-core@1.167.5\n  - @tanstack/react-router@1.167.5\n  - @tanstack/start-client-core@1.166.13\n\n## 1.166.13\n\n### Patch Changes\n\n- Updated dependencies [[`940151c`](https://github.com/TanStack/router/commit/940151cbed0c76c92a5cf196c0905b17a956ca7e)]:\n  - @tanstack/router-core@1.167.4\n  - @tanstack/react-router@1.167.4\n  - @tanstack/start-client-core@1.166.12\n\n## 1.166.12\n\n### Patch Changes\n\n- Updated dependencies [[`32fcba7`](https://github.com/TanStack/router/commit/32fcba7b044b03f5901308b870f70b0b4910c220)]:\n  - @tanstack/router-core@1.167.3\n  - @tanstack/react-router@1.167.3\n  - @tanstack/start-client-core@1.166.11\n\n## 1.166.11\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/react-router@1.167.2\n  - @tanstack/router-core@1.167.2\n  - @tanstack/start-client-core@1.166.10\n\n## 1.166.10\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/start-client-core@1.166.9\n  - @tanstack/react-router@1.167.1\n  - @tanstack/router-core@1.167.1\n\n## 1.166.9\n\n### Patch Changes\n\n- Updated dependencies [[`6f297a2`](https://github.com/TanStack/router/commit/6f297a249424c0fd1c1a56aa4fc12c8217be7b6a)]:\n  - @tanstack/router-core@1.167.0\n  - @tanstack/react-router@1.167.0\n  - @tanstack/start-client-core@1.166.8\n\n## 1.166.8\n\n### Patch Changes\n\n- Updated dependencies [[`6069eba`](https://github.com/TanStack/router/commit/6069eba64369dbddb0d8dccdb4407f0e1a82259e)]:\n  - @tanstack/react-router@1.166.8\n"
  },
  {
    "path": "packages/react-start-client/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack React Start - Client\n\nThis package is not meant to be used directly. It is a dependency of [`@tanstack/react-start`](https://www.npmjs.com/package/@tanstack/react-start).\n\nTanStack React Start is a fullstack-framework made for SSR, Streaming, Server Functions, API Routes, bundling and more powered by [TanStack Router](https://tanstack.com/router).\n\nHead over to [tanstack.com/start](https://tanstack.com/start) for more information about getting started.\n"
  },
  {
    "path": "packages/react-start-client/eslint.config.js",
    "content": "// @ts-check\n\nimport pluginReact from '@eslint-react/eslint-plugin'\nimport pluginReactHooks from 'eslint-plugin-react-hooks'\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    ...pluginReact.configs.recommended,\n    files: ['**/*.{ts,tsx}'],\n  },\n  {\n    plugins: {\n      'react-hooks': pluginReactHooks,\n    },\n    rules: {\n      '@eslint-react/no-unstable-context-value': 'off',\n      '@eslint-react/no-unstable-default-props': 'off',\n      '@eslint-react/dom/no-missing-button-type': 'off',\n      'react-hooks/exhaustive-deps': 'error',\n      'react-hooks/rules-of-hooks': 'error',\n    },\n  },\n  {\n    files: ['**/__tests__/**'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/react-start-client/package.json",
    "content": "{\n  \"name\": \"@tanstack/react-start-client\",\n  \"version\": \"1.166.16\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/react-start-client\"\n  },\n  \"homepage\": \"https://tanstack.com/start\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test\": \"pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit\",\n    \"test:unit\": \"vitest\",\n    \"test:unit:dev\": \"vitest --watch\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=22.12.0\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"@tanstack/router-core\": \"workspace:*\",\n    \"@tanstack/start-client-core\": \"workspace:*\",\n    \"tiny-invariant\": \"^1.3.3\",\n    \"tiny-warning\": \"^1.0.3\"\n  },\n  \"devDependencies\": {\n    \"@testing-library/react\": \"^16.2.0\",\n    \"@vitejs/plugin-react\": \"^4.3.4\",\n    \"vite\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"react\": \">=18.0.0 || >=19.0.0\",\n    \"react-dom\": \">=18.0.0 || >=19.0.0\"\n  }\n}\n"
  },
  {
    "path": "packages/react-start-client/src/StartClient.tsx",
    "content": "import { Await, RouterProvider } from '@tanstack/react-router'\n\nimport { hydrateStart } from './hydrateStart'\n\nimport type { AnyRouter } from '@tanstack/router-core'\n\nlet hydrationPromise: Promise<AnyRouter> | undefined\nexport function StartClient() {\n  if (!hydrationPromise) {\n    hydrationPromise = hydrateStart()\n  }\n\n  return (\n    <Await\n      promise={hydrationPromise}\n      children={(router) => <RouterProvider router={router} />}\n    />\n  )\n}\n"
  },
  {
    "path": "packages/react-start-client/src/hydrateStart.ts",
    "content": "import { hydrateStart as coreHydrateStart } from '@tanstack/start-client-core/client'\nimport type { AnyRouter } from '@tanstack/router-core'\n\n/**\n * React-specific wrapper for hydrateStart that signals hydration completion\n */\nexport async function hydrateStart(): Promise<AnyRouter> {\n  const router = await coreHydrateStart()\n  // Signal that router hydration is complete so cleanup can happen if stream has ended\n  window.$_TSR?.h()\n  return router\n}\n"
  },
  {
    "path": "packages/react-start-client/src/index.tsx",
    "content": "export { StartClient } from './StartClient'\nexport { renderRsc } from './renderRSC'\nexport { hydrateStart } from './hydrateStart'\n"
  },
  {
    "path": "packages/react-start-client/src/renderRSC.tsx",
    "content": "// TODO: RSCs\nimport { isValidElement } from 'react'\nimport invariant from 'tiny-invariant'\nimport type React from 'react'\n\nexport function renderRsc(input: any): React.JSX.Element {\n  if (isValidElement(input)) {\n    return input\n  }\n\n  if (typeof input === 'object' && !input.state) {\n    input.state = {\n      status: 'pending',\n      promise: Promise.resolve()\n        .then(() => {\n          let element\n\n          // We're in node\n          // TODO: RSCs\n          // if (reactDom.createFromNodeStream) {\n          //   const stream = await import('node:stream')\n\n          //   let body: any = input\n\n          //   // Unwrap the response\n          //   if (input instanceof Response) {\n          //     body = input.body\n          //   }\n\n          //   // Convert ReadableStream to NodeJS stream.Readable\n          //   if (body instanceof ReadableStream) {\n          //     body = stream.Readable.fromWeb(body as any)\n          //   }\n\n          //   if (stream.Readable.isReadable(body)) {\n          //     // body = copyStreamToRaw(body)\n          //   } else if (input.text) {\n          //     // create a readable stream by awaiting the text method\n          //     body = new stream.Readable({\n          //       async read() {\n          //         input.text().then((value: any) => {\n          //           this.push(value)\n          //           this.push(null)\n          //         })\n          //       },\n          //     })\n          //   } else {\n          //     console.error('input', input)\n          //     throw new Error('Unexpected rsc input type 👆')\n          //   }\n\n          //   element = await reactDom.createFromNodeStream(body)\n          // } else {\n          //   // We're in the browser\n          //   if (input.body instanceof ReadableStream) {\n          //     input = input.body\n          //   }\n\n          //   if (input instanceof ReadableStream) {\n          //     element = await reactDom.createFromReadableStream(input)\n          //   }\n\n          //   if (input instanceof Response) {\n          //     // copy to the response body to cache the raw data\n          //     element = await reactDom.createFromFetch(input)\n          //   }\n          // }\n\n          // return element\n\n          invariant(false, 'renderRSC() is coming soon!')\n        })\n        .then((element) => {\n          input.state.value = element\n          input.state.status = 'success'\n        })\n        .catch((err) => {\n          input.state.status = 'error'\n          input.state.error = err\n        }),\n    }\n  }\n\n  if (input.state.status === 'pending') {\n    throw input.state.promise\n  }\n\n  return input.state.value\n}\n"
  },
  {
    "path": "packages/react-start-client/src/tests/createServerFn.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport { createServerFn } from '@tanstack/start-client-core'\n\n/*\n// disabled until we really support RSC\ntest.skip('createServerFn returns RSC', () => {\n  const fn = createServerFn().handler(() => ({\n    rscs: [\n      <div key=\"0\">I'm an RSC</div>,\n      <div key=\"1\">I'm an RSC</div>,\n    ] as const,\n  }))\n\n  expectTypeOf(fn()).toEqualTypeOf<\n    Promise<{\n      rscs: readonly [ReadableStream, ReadableStream]\n    }>\n  >()\n})*/\n\ntest('createServerFn returns async array', () => {\n  const result: Array<{ a: number }> = [{ a: 1 }]\n  const serverFn = createServerFn({ method: 'GET' }).handler(async () => {\n    return result\n  })\n\n  expectTypeOf(serverFn()).toEqualTypeOf<Promise<Array<{ a: number }>>>()\n})\n\ntest('createServerFn returns sync array', () => {\n  const result: Array<{ a: number }> = [{ a: 1 }]\n  const serverFn = createServerFn({ method: 'GET' }).handler(() => {\n    return result\n  })\n\n  expectTypeOf(serverFn()).toEqualTypeOf<Promise<Array<{ a: number }>>>()\n})\n\ntest('createServerFn returns async union', () => {\n  const result = '1' as string | number\n  const serverFn = createServerFn({ method: 'GET' }).handler(async () => {\n    return result\n  })\n\n  expectTypeOf(serverFn()).toEqualTypeOf<Promise<string | number>>()\n})\n\ntest('createServerFn returns sync union', () => {\n  const result = '1' as string | number\n  const serverFn = createServerFn({ method: 'GET' }).handler(() => {\n    return result\n  })\n\n  expectTypeOf(serverFn()).toEqualTypeOf<Promise<string | number>>()\n})\n"
  },
  {
    "path": "packages/react-start-client/src/tests/setupTests.tsx",
    "content": "import '@testing-library/react'\n"
  },
  {
    "path": "packages/react-start-client/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"module\": \"esnext\"\n  },\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/react-start-client/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport react from '@vitejs/plugin-react'\nimport packageJson from './package.json'\nimport type { ViteUserConfig } from 'vitest/config'\n\nconst config = defineConfig({\n  plugins: [react()] as ViteUserConfig['plugins'],\n  test: {\n    include: ['**/*.{test-d,test,spec}.?(c|m)[jt]s?(x)'],\n    name: packageJson.name,\n    watch: false,\n    environment: 'jsdom',\n    setupFiles: ['./src/tests/setupTests.tsx'],\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    srcDir: './src',\n    entry: './src/index.tsx',\n    cjs: false,\n  }),\n)\n"
  },
  {
    "path": "packages/react-start-server/CHANGELOG.md",
    "content": "# @tanstack/react-start-server\n\n## 1.166.16\n\n### Patch Changes\n\n- Updated dependencies [[`91cc628`](https://github.com/TanStack/router/commit/91cc62899b75ca920fe83c5ee7f3dbb5c71a523f)]:\n  - @tanstack/react-router@1.168.1\n  - @tanstack/router-core@1.168.1\n  - @tanstack/start-client-core@1.167.1\n  - @tanstack/start-server-core@1.167.1\n\n## 1.166.15\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/start-client-core@1.167.0\n  - @tanstack/start-server-core@1.167.0\n  - @tanstack/react-router@1.168.0\n  - @tanstack/router-core@1.168.0\n\n## 1.166.14\n\n### Patch Changes\n\n- Updated dependencies [[`5ff4f0b`](https://github.com/TanStack/router/commit/5ff4f0b8dce1fac2bb0b0bfe2684fc677a8ee505)]:\n  - @tanstack/router-core@1.167.5\n  - @tanstack/react-router@1.167.5\n  - @tanstack/start-client-core@1.166.13\n  - @tanstack/start-server-core@1.166.13\n\n## 1.166.13\n\n### Patch Changes\n\n- Updated dependencies [[`940151c`](https://github.com/TanStack/router/commit/940151cbed0c76c92a5cf196c0905b17a956ca7e)]:\n  - @tanstack/router-core@1.167.4\n  - @tanstack/react-router@1.167.4\n  - @tanstack/start-client-core@1.166.12\n  - @tanstack/start-server-core@1.166.12\n\n## 1.166.12\n\n### Patch Changes\n\n- Updated dependencies [[`32fcba7`](https://github.com/TanStack/router/commit/32fcba7b044b03f5901308b870f70b0b4910c220)]:\n  - @tanstack/router-core@1.167.3\n  - @tanstack/react-router@1.167.3\n  - @tanstack/start-client-core@1.166.11\n  - @tanstack/start-server-core@1.166.11\n\n## 1.166.11\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/history@1.161.6\n  - @tanstack/react-router@1.167.2\n  - @tanstack/router-core@1.167.2\n  - @tanstack/start-client-core@1.166.10\n  - @tanstack/start-server-core@1.166.10\n\n## 1.166.10\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/start-client-core@1.166.9\n  - @tanstack/start-server-core@1.166.9\n  - @tanstack/react-router@1.167.1\n  - @tanstack/router-core@1.167.1\n  - @tanstack/history@1.161.5\n\n## 1.166.9\n\n### Patch Changes\n\n- Updated dependencies [[`6f297a2`](https://github.com/TanStack/router/commit/6f297a249424c0fd1c1a56aa4fc12c8217be7b6a)]:\n  - @tanstack/router-core@1.167.0\n  - @tanstack/react-router@1.167.0\n  - @tanstack/start-client-core@1.166.8\n  - @tanstack/start-server-core@1.166.8\n\n## 1.166.8\n\n### Patch Changes\n\n- Updated dependencies [[`6069eba`](https://github.com/TanStack/router/commit/6069eba64369dbddb0d8dccdb4407f0e1a82259e)]:\n  - @tanstack/react-router@1.166.8\n"
  },
  {
    "path": "packages/react-start-server/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack React Start - Server\n\nThis package is not meant to be used directly. It is a dependency of [`@tanstack/react-start`](https://www.npmjs.com/package/@tanstack/react-start).\n\nTanStack React Start is a fullstack-framework made for SSR, Streaming, Server Functions, API Routes, bundling and more powered by [TanStack Router](https://tanstack.com/router).\n\nHead over to [tanstack.com/start](https://tanstack.com/start) for more information about getting started.\n"
  },
  {
    "path": "packages/react-start-server/eslint.config.js",
    "content": "// @ts-check\n\nimport pluginReact from '@eslint-react/eslint-plugin'\nimport pluginReactHooks from 'eslint-plugin-react-hooks'\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    ...pluginReact.configs.recommended,\n    files: ['**/*.{ts,tsx}'],\n  },\n  {\n    plugins: {\n      'react-hooks': pluginReactHooks,\n    },\n    rules: {\n      '@eslint-react/no-unstable-context-value': 'off',\n      '@eslint-react/no-unstable-default-props': 'off',\n      '@eslint-react/dom/no-missing-button-type': 'off',\n      'react-hooks/exhaustive-deps': 'error',\n      'react-hooks/rules-of-hooks': 'error',\n    },\n  },\n  {\n    files: ['**/__tests__/**'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/react-start-server/package.json",
    "content": "{\n  \"name\": \"@tanstack/react-start-server\",\n  \"version\": \"1.166.16\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/react-start-server\"\n  },\n  \"homepage\": \"https://tanstack.com/start\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test\": \"pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit\",\n    \"test:unit\": \"exit 0; vitest\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=22.12.0\"\n  },\n  \"dependencies\": {\n    \"@tanstack/history\": \"workspace:*\",\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"@tanstack/router-core\": \"workspace:*\",\n    \"@tanstack/start-client-core\": \"workspace:*\",\n    \"@tanstack/start-server-core\": \"workspace:*\"\n  },\n  \"devDependencies\": {\n    \"@vitejs/plugin-react\": \"^4.3.4\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"typescript\": \"^5.7.2\",\n    \"vite\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"react\": \">=18.0.0 || >=19.0.0\",\n    \"react-dom\": \">=18.0.0 || >=19.0.0\"\n  }\n}\n"
  },
  {
    "path": "packages/react-start-server/src/StartServer.tsx",
    "content": "import * as React from 'react'\nimport { RouterProvider } from '@tanstack/react-router'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport function StartServer<TRouter extends AnyRouter>(props: {\n  router: TRouter\n}) {\n  return <RouterProvider router={props.router} />\n}\n"
  },
  {
    "path": "packages/react-start-server/src/defaultRenderHandler.tsx",
    "content": "import {\n  defineHandlerCallback,\n  renderRouterToString,\n} from '@tanstack/react-router/ssr/server'\nimport { StartServer } from './StartServer'\n\nexport const defaultRenderHandler = defineHandlerCallback(\n  ({ router, responseHeaders }) =>\n    renderRouterToString({\n      router,\n      responseHeaders,\n      children: <StartServer router={router} />,\n    }),\n)\n"
  },
  {
    "path": "packages/react-start-server/src/defaultStreamHandler.tsx",
    "content": "import {\n  defineHandlerCallback,\n  renderRouterToStream,\n} from '@tanstack/react-router/ssr/server'\nimport { StartServer } from './StartServer'\n\nexport const defaultStreamHandler = defineHandlerCallback(\n  ({ request, router, responseHeaders }) =>\n    renderRouterToStream({\n      request,\n      router,\n      responseHeaders,\n      children: <StartServer router={router} />,\n    }),\n)\n"
  },
  {
    "path": "packages/react-start-server/src/index.tsx",
    "content": "export { StartServer } from './StartServer'\nexport { defaultStreamHandler } from './defaultStreamHandler'\nexport { defaultRenderHandler } from './defaultRenderHandler'\nexport type {\n  RequestHandler,\n  RequestOptions,\n} from '@tanstack/start-server-core'\nexport * from '@tanstack/start-server-core'\n"
  },
  {
    "path": "packages/react-start-server/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\",\n    \"module\": \"esnext\"\n  },\n  \"include\": [\"src\", \"tests\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/react-start-server/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport react from '@vitejs/plugin-react'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  plugins: [react()],\n  test: {\n    name: packageJson.name,\n    watch: false,\n    environment: 'jsdom',\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    srcDir: './src',\n    entry: './src/index.tsx',\n    cjs: false,\n  }),\n)\n"
  },
  {
    "path": "packages/router-cli/CHANGELOG.md",
    "content": "# @tanstack/router-cli\n\n## 1.166.16\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-generator@1.166.15\n\n## 1.166.15\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-generator@1.166.14\n\n## 1.166.14\n\n### Patch Changes\n\n- fix(router-cli): pass process.argv to yargs to fix silent CLI failure ([#6981](https://github.com/TanStack/router/pull/6981))\n\n## 1.166.13\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-generator@1.166.13\n\n## 1.166.12\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-generator@1.166.12\n\n## 1.166.11\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-generator@1.166.11\n\n## 1.166.10\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/router-generator@1.166.10\n\n## 1.166.9\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/router-generator@1.166.9\n\n## 1.166.8\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-generator@1.166.8\n"
  },
  {
    "path": "packages/router-cli/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack Router CLI\n\nSee https://tanstack.com/router/latest/docs/framework/react/routing/installation/with-router-cli\n"
  },
  {
    "path": "packages/router-cli/bin/tsr.cjs",
    "content": "#!/usr/bin/env node\n\nrequire('../dist/cjs/index.cjs')\n"
  },
  {
    "path": "packages/router-cli/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/router-cli/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-cli\",\n  \"version\": \"1.166.16\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-cli\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"bin\": {\n    \"tsr\": \"bin/tsr.cjs\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src/**\",\n    \"bin/**\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@tanstack/router-generator\": \"workspace:*\",\n    \"chokidar\": \"^3.6.0\",\n    \"yargs\": \"^17.7.2\"\n  },\n  \"devDependencies\": {\n    \"@types/yargs\": \"^17.0.33\",\n    \"vite\": \"*\"\n  }\n}\n"
  },
  {
    "path": "packages/router-cli/src/generate.ts",
    "content": "import { Generator } from '@tanstack/router-generator'\nimport type { Config } from '@tanstack/router-generator'\n\nexport async function generate(config: Config, root: string) {\n  try {\n    const generator = new Generator({\n      config,\n      root,\n    })\n    await generator.run()\n    process.exit(0)\n  } catch (err) {\n    console.error(err)\n    process.exit(1)\n  }\n}\n"
  },
  {
    "path": "packages/router-cli/src/index.ts",
    "content": "import yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport { getConfig } from '@tanstack/router-generator'\nimport { generate } from './generate'\nimport { watch } from './watch'\n\nmain()\n\nexport function main() {\n  yargs(hideBin(process.argv))\n    .scriptName('tsr')\n    .usage('$0 <cmd> [args]')\n    .command('generate', 'Generate the routes for a project', async () => {\n      const config = getConfig()\n      await generate(config, process.cwd())\n    })\n    .command(\n      'watch',\n      'Continuously watch and generate the routes for a project',\n      () => {\n        watch(process.cwd())\n      },\n    )\n    .help().argv\n}\n"
  },
  {
    "path": "packages/router-cli/src/watch.ts",
    "content": "import chokidar from 'chokidar'\nimport {\n  Generator,\n  getConfig,\n  resolveConfigPath,\n} from '@tanstack/router-generator'\nimport type { FileEventType } from '@tanstack/router-generator'\n\nexport function watch(root: string) {\n  const configPath = resolveConfigPath({\n    configDirectory: root,\n  })\n  const configWatcher = chokidar.watch(configPath)\n\n  let watcher = new chokidar.FSWatcher({})\n\n  const generatorWatcher = () => {\n    const config = getConfig()\n    const generator = new Generator({ config, root })\n\n    watcher.close()\n\n    console.info(`TSR: Watching routes (${config.routesDirectory})...`)\n    watcher = chokidar.watch(config.routesDirectory)\n\n    watcher.on('ready', async () => {\n      const handle = async () => {\n        try {\n          await generator.run()\n        } catch (err) {\n          console.error(err)\n          console.info()\n        }\n      }\n\n      await handle()\n\n      watcher.on('all', (event, path) => {\n        let type: FileEventType | undefined\n        switch (event) {\n          case 'add':\n            type = 'create'\n            break\n          case 'change':\n            type = 'update'\n            break\n          case 'unlink':\n            type = 'delete'\n            break\n        }\n        if (type) {\n          return generator.run({ path, type })\n        }\n        return generator.run()\n      })\n    })\n  }\n\n  configWatcher.on('ready', generatorWatcher)\n  configWatcher.on('change', generatorWatcher)\n}\n"
  },
  {
    "path": "packages/router-cli/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/router-cli/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\n\nconst config = defineConfig({})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/router-core/CHANGELOG.md",
    "content": "# @tanstack/router-core\n\n## 1.168.1\n\n### Patch Changes\n\n- Update store to 0.9.2 ([#6993](https://github.com/TanStack/router/pull/6993))\n\n## 1.168.0\n\n### Minor Changes\n\n- remove pendingMatches, cachedMatches ([#6704](https://github.com/TanStack/router/pull/6704))\n  move to signal-based reactivity\n  solid uses its own native signals\n\n## 1.167.5\n\n### Patch Changes\n\n- chore: bump esbuild to 0.27.4 ([#6975](https://github.com/TanStack/router/pull/6975))\n\n## 1.167.4\n\n### Patch Changes\n\n- Add @tanstack/intent AI agent skills and CLI entry points for Router and Start packages ([#6866](https://github.com/TanStack/router/pull/6866))\n\n## 1.167.3\n\n### Patch Changes\n\n- Fix retained chained router promise refs during route loads and commits. ([#6929](https://github.com/TanStack/router/pull/6929))\n\n## 1.167.2\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/history@1.161.6\n\n## 1.167.1\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/history@1.161.5\n\n## 1.167.0\n\n### Minor Changes\n\n- feat: add staleReloadMode ([#6921](https://github.com/TanStack/router/pull/6921))\n"
  },
  {
    "path": "packages/router-core/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack Router Core\n\nSee [https://tanstack.com/router](https://tanstack.com/router) for documentation.\n"
  },
  {
    "path": "packages/router-core/bin/intent.js",
    "content": "#!/usr/bin/env node\n// Auto-generated by @tanstack/intent setup\n// Exposes the intent end-user CLI for consumers of this library.\n// Commit this file, then add to your package.json:\n//   \"bin\": { \"intent\": \"./bin/intent.js\" }\ntry {\n  await import('@tanstack/intent/intent-library')\n} catch (e) {\n  const isModuleNotFound =\n    e?.code === 'ERR_MODULE_NOT_FOUND' || e?.code === 'MODULE_NOT_FOUND'\n  const missingIntentLibrary =\n    typeof e?.message === 'string' && e.message.includes('@tanstack/intent')\n\n  if (isModuleNotFound && missingIntentLibrary) {\n    console.error('@tanstack/intent is not installed.')\n    console.error('')\n    console.error('Install it as a dev dependency:')\n    console.error('  npm add -D @tanstack/intent')\n    console.error('')\n    console.error('Or run directly:')\n    console.error('  npx @tanstack/intent@latest list')\n    process.exit(1)\n  }\n  throw e\n}\n"
  },
  {
    "path": "packages/router-core/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/router-core/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-core\",\n  \"version\": \"1.168.1\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-core\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"history\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"test:unit\": \"vitest\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./ssr/server\": {\n      \"import\": {\n        \"types\": \"./dist/esm/ssr/server.d.ts\",\n        \"default\": \"./dist/esm/ssr/server.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/ssr/server.d.cts\",\n        \"default\": \"./dist/cjs/ssr/server.cjs\"\n      }\n    },\n    \"./ssr/client\": {\n      \"import\": {\n        \"types\": \"./dist/esm/ssr/client.d.ts\",\n        \"default\": \"./dist/esm/ssr/client.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/ssr/client.d.cts\",\n        \"default\": \"./dist/cjs/ssr/client.cjs\"\n      }\n    },\n    \"./isServer\": {\n      \"development\": {\n        \"import\": {\n          \"types\": \"./dist/esm/isServer/development.d.ts\",\n          \"default\": \"./dist/esm/isServer/development.js\"\n        },\n        \"require\": {\n          \"types\": \"./dist/cjs/isServer/development.d.cts\",\n          \"default\": \"./dist/cjs/isServer/development.cjs\"\n        }\n      },\n      \"workerd\": {\n        \"import\": {\n          \"types\": \"./dist/esm/isServer/server.d.ts\",\n          \"default\": \"./dist/esm/isServer/server.js\"\n        },\n        \"require\": {\n          \"types\": \"./dist/cjs/isServer/server.d.cts\",\n          \"default\": \"./dist/cjs/isServer/server.cjs\"\n        }\n      },\n      \"worker\": {\n        \"import\": {\n          \"types\": \"./dist/esm/isServer/server.d.ts\",\n          \"default\": \"./dist/esm/isServer/server.js\"\n        },\n        \"require\": {\n          \"types\": \"./dist/cjs/isServer/server.d.cts\",\n          \"default\": \"./dist/cjs/isServer/server.cjs\"\n        }\n      },\n      \"browser\": {\n        \"import\": {\n          \"types\": \"./dist/esm/isServer/client.d.ts\",\n          \"default\": \"./dist/esm/isServer/client.js\"\n        },\n        \"require\": {\n          \"types\": \"./dist/cjs/isServer/client.d.cts\",\n          \"default\": \"./dist/cjs/isServer/client.cjs\"\n        }\n      },\n      \"deno\": {\n        \"import\": {\n          \"types\": \"./dist/esm/isServer/server.d.ts\",\n          \"default\": \"./dist/esm/isServer/server.js\"\n        },\n        \"require\": {\n          \"types\": \"./dist/cjs/isServer/server.d.cts\",\n          \"default\": \"./dist/cjs/isServer/server.cjs\"\n        }\n      },\n      \"node\": {\n        \"import\": {\n          \"types\": \"./dist/esm/isServer/server.d.ts\",\n          \"default\": \"./dist/esm/isServer/server.js\"\n        },\n        \"require\": {\n          \"types\": \"./dist/cjs/isServer/server.d.cts\",\n          \"default\": \"./dist/cjs/isServer/server.cjs\"\n        }\n      },\n      \"bun\": {\n        \"import\": {\n          \"types\": \"./dist/esm/isServer/server.d.ts\",\n          \"default\": \"./dist/esm/isServer/server.js\"\n        },\n        \"require\": {\n          \"types\": \"./dist/cjs/isServer/server.d.cts\",\n          \"default\": \"./dist/cjs/isServer/server.cjs\"\n        }\n      },\n      \"import\": {\n        \"types\": \"./dist/esm/isServer/client.d.ts\",\n        \"default\": \"./dist/esm/isServer/client.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/isServer/client.d.cts\",\n        \"default\": \"./dist/cjs/isServer/client.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\",\n    \"skills\",\n    \"bin\",\n    \"!skills/_artifacts\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@tanstack/history\": \"workspace:*\",\n    \"cookie-es\": \"^2.0.0\",\n    \"seroval\": \"^1.4.2\",\n    \"seroval-plugins\": \"^1.4.2\",\n    \"tiny-invariant\": \"^1.3.3\",\n    \"tiny-warning\": \"^1.0.3\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/store\": \"^0.9.2\",\n    \"@tanstack/intent\": \"^0.0.14\",\n    \"esbuild\": \"^0.27.4\",\n    \"vite\": \"*\"\n  },\n  \"bin\": {\n    \"intent\": \"./bin/intent.js\"\n  }\n}\n"
  },
  {
    "path": "packages/router-core/skills/router-core/SKILL.md",
    "content": "---\nname: router-core\ndescription: >-\n  Framework-agnostic core concepts for TanStack Router: route trees,\n  createRouter, createRoute, createRootRoute, createRootRouteWithContext,\n  addChildren, Register type declaration, route matching, route sorting,\n  file naming conventions. Entry point for all router skills.\ntype: core\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\n---\n\n# TanStack Router Core\n\nTanStack Router is a 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. The core is framework-agnostic; React and Solid bindings layer on top.\n\n> **CRITICAL**: TanStack Router types are FULLY INFERRED. Never cast, never annotate inferred values. This is the #1 AI agent mistake.\n\n> **CRITICAL**: TanStack Router is CLIENT-FIRST. Loaders run on the client by default, NOT server-only like Remix/Next.js. Do not confuse TanStack Router APIs with Next.js or React Router.\n\n## Sub-Skills\n\n| Task                                               | Sub-Skill                                                                    |\n| -------------------------------------------------- | ---------------------------------------------------------------------------- |\n| Validate, read, write, transform search params     | [router-core/search-params/SKILL.md](./search-params/SKILL.md)               |\n| Dynamic segments, splats, optional params          | [router-core/path-params/SKILL.md](./path-params/SKILL.md)                   |\n| Link, useNavigate, preloading, blocking            | [router-core/navigation/SKILL.md](./navigation/SKILL.md)                     |\n| Route loaders, SWR caching, context, deferred data | [router-core/data-loading/SKILL.md](./data-loading/SKILL.md)                 |\n| Auth guards, RBAC, beforeLoad redirects            | [router-core/auth-and-guards/SKILL.md](./auth-and-guards/SKILL.md)           |\n| Automatic and manual code splitting                | [router-core/code-splitting/SKILL.md](./code-splitting/SKILL.md)             |\n| 404 handling, error boundaries, notFound()         | [router-core/not-found-and-errors/SKILL.md](./not-found-and-errors/SKILL.md) |\n| Inference, Register, from narrowing, TS perf       | [router-core/type-safety/SKILL.md](./type-safety/SKILL.md)                   |\n| Streaming/non-streaming SSR, hydration, head mgmt  | [router-core/ssr/SKILL.md](./ssr/SKILL.md)                                   |\n\n## Quick Decision Tree\n\n```\nNeed to add/read/write URL query parameters?\n  → router-core/search-params\n\nNeed dynamic URL segments like /posts/$postId?\n  → router-core/path-params\n\nNeed to create links or navigate programmatically?\n  → router-core/navigation\n\nNeed to fetch data for a route?\n  Is it client-side only or client+server?\n    → router-core/data-loading\n  Using TanStack Query as external cache?\n    → compositions/router-query (separate skill)\n\nNeed to protect routes behind auth?\n  → router-core/auth-and-guards\n\nNeed to reduce bundle size per route?\n  → router-core/code-splitting\n\nNeed custom 404 or error handling?\n  → router-core/not-found-and-errors\n\nHaving TypeScript issues or performance problems?\n  → router-core/type-safety\n\nNeed server-side rendering?\n  → router-core/ssr\n```\n\n## Minimal Working Example\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n})\n```\n\n```tsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <h1>Home</h1>,\n})\n```\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\n// REQUIRED for type safety — without this, Link/useNavigate have no autocomplete\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport default router\n```\n\n```tsx\n// src/main.tsx\nimport { RouterProvider } from '@tanstack/react-router'\nimport router from './router'\n\nfunction App() {\n  return <RouterProvider router={router} />\n}\n```\n\n## Common Mistakes\n\n### HIGH: createFileRoute path string must match the file path\n\nThe Vite plugin manages the path string in `createFileRoute`. Do not change it manually — it must match the file's location under `src/routes/`:\n\n```tsx\n// File: src/routes/posts/$postId.tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  // ✅ matches file path\n  component: PostPage,\n})\n\nexport const Route = createFileRoute('/post/$postId')({\n  // ❌ silent mismatch\n  component: PostPage,\n})\n```\n\nThe plugin auto-generates this string. If you rename a route file, the plugin updates it. Never edit the path string by hand.\n\n## Version Note\n\nThis skill targets `@tanstack/router-core` v1.166.2 and `@tanstack/react-router` v1.166.2. APIs are stable. Splat routes use `$` (not `*`); the `*` compat alias will be removed in v2.\n"
  },
  {
    "path": "packages/router-core/skills/router-core/auth-and-guards/SKILL.md",
    "content": "---\nname: router-core/auth-and-guards\ndescription: >-\n  Route protection with beforeLoad, redirect()/throw redirect(),\n  isRedirect helper, authenticated layout routes (_authenticated),\n  non-redirect auth (inline login), RBAC with roles and permissions,\n  auth provider integration (Auth0, Clerk, Supabase), router context\n  for auth state.\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\n  - router-core/data-loading\nsources:\n  - TanStack/router:docs/router/guide/authenticated-routes.md\n  - TanStack/router:docs/router/how-to/setup-authentication.md\n  - TanStack/router:docs/router/how-to/setup-auth-providers.md\n  - TanStack/router:docs/router/how-to/setup-rbac.md\n---\n\n# Auth and Guards\n\n## Setup\n\nProtect routes with `beforeLoad` + `redirect()` in a pathless layout route (`_authenticated`):\n\n```tsx\n// src/routes/_authenticated.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({\n        to: '/login',\n        search: {\n          redirect: location.href,\n        },\n      })\n    }\n  },\n  // component defaults to Outlet — no need to declare it\n})\n```\n\nAny route file placed under `src/routes/_authenticated/` is automatically protected:\n\n```tsx\n// src/routes/_authenticated/dashboard.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/dashboard')({\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  const { auth } = Route.useRouteContext()\n  return <div>Welcome, {auth.user?.username}</div>\n}\n```\n\n## Core Patterns\n\n### Router Context for Auth State\n\nAuth state flows into the router via `createRootRouteWithContext` and `RouterProvider`'s `context` prop:\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRouteWithContext, Outlet } from '@tanstack/react-router'\n\ninterface AuthState {\n  isAuthenticated: boolean\n  user: { id: string; username: string; email: string } | null\n  login: (username: string, password: string) => Promise<void>\n  logout: () => void\n}\n\ninterface MyRouterContext {\n  auth: AuthState\n}\n\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => <Outlet />,\n})\n```\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport const router = createRouter({\n  routeTree,\n  context: {\n    auth: undefined!, // placeholder — filled by RouterProvider context prop\n  },\n})\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n```\n\n```tsx\n// src/App.tsx\nimport { RouterProvider } from '@tanstack/react-router'\nimport { AuthProvider, useAuth } from './auth'\nimport { router } from './router'\n\nfunction InnerApp() {\n  const auth = useAuth()\n  // context prop injects live auth state WITHOUT recreating the router\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthProvider>\n      <InnerApp />\n    </AuthProvider>\n  )\n}\n```\n\nThe router is created once with a placeholder. `RouterProvider`'s `context` prop injects the live auth state on each render — this avoids recreating the router on auth changes (which would reset caches and rebuild the route tree).\n\n### Redirect-Based Auth with Redirect-Back\n\nSave the current location in search params so you can redirect back after login:\n\n```tsx\n// src/routes/_authenticated.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({\n        to: '/login',\n        search: { redirect: location.href },\n      })\n    }\n  },\n})\n```\n\n```tsx\n// src/routes/login.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\nimport { useState, type FormEvent } from 'react'\n\n// Validate redirect target to prevent open redirect attacks\nfunction sanitizeRedirect(url: unknown): string {\n  if (typeof url !== 'string' || !url.startsWith('/') || url.startsWith('//')) {\n    return '/'\n  }\n  return url\n}\n\nexport const Route = createFileRoute('/login')({\n  validateSearch: (search) => ({\n    redirect: sanitizeRedirect(search.redirect),\n  }),\n  beforeLoad: ({ context, search }) => {\n    if (context.auth.isAuthenticated) {\n      throw redirect({ to: search.redirect })\n    }\n  },\n  component: LoginComponent,\n})\n\nfunction LoginComponent() {\n  const { auth } = Route.useRouteContext()\n  const search = Route.useSearch()\n  const navigate = Route.useNavigate()\n  const [username, setUsername] = useState('')\n  const [password, setPassword] = useState('')\n  const [error, setError] = useState('')\n\n  const handleSubmit = async (e: FormEvent) => {\n    e.preventDefault()\n    try {\n      await auth.login(username, password)\n      navigate({ to: search.redirect })\n    } catch {\n      setError('Invalid credentials')\n    }\n  }\n\n  return (\n    <form onSubmit={handleSubmit}>\n      {error && <div>{error}</div>}\n      <input value={username} onChange={(e) => setUsername(e.target.value)} />\n      <input\n        type=\"password\"\n        value={password}\n        onChange={(e) => setPassword(e.target.value)}\n      />\n      <button type=\"submit\">Sign In</button>\n    </form>\n  )\n}\n```\n\n### Non-Redirect Auth (Inline Login)\n\nInstead of redirecting, show a login form in place of the `Outlet`:\n\n```tsx\n// src/routes/_authenticated.tsx\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated')({\n  component: AuthenticatedLayout,\n})\n\nfunction AuthenticatedLayout() {\n  const { auth } = Route.useRouteContext()\n\n  if (!auth.isAuthenticated) {\n    return <LoginForm />\n  }\n\n  return <Outlet />\n}\n```\n\nThis keeps the URL unchanged — the user stays on the same page and sees a login form instead of protected content. After authentication, `<Outlet />` renders and child routes appear.\n\n### RBAC with Roles and Permissions\n\nExtend auth state with role/permission helpers, then check in `beforeLoad`:\n\n```tsx\n// src/auth.tsx\ninterface User {\n  id: string\n  username: string\n  email: string\n  roles: string[]\n  permissions: string[]\n}\n\ninterface AuthState {\n  isAuthenticated: boolean\n  user: User | null\n  hasRole: (role: string) => boolean\n  hasAnyRole: (roles: string[]) => boolean\n  hasPermission: (permission: string) => boolean\n  hasAnyPermission: (permissions: string[]) => boolean\n  login: (username: string, password: string) => Promise<void>\n  logout: () => void\n}\n```\n\nAdmin-only layout route:\n\n```tsx\n// src/routes/_authenticated/_admin.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_admin')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.hasRole('admin')) {\n      throw redirect({\n        to: '/unauthorized',\n        search: { redirect: location.href },\n      })\n    }\n  },\n})\n```\n\nMulti-role access:\n\n```tsx\n// src/routes/_authenticated/_moderator.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_moderator')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.hasAnyRole(['admin', 'moderator'])) {\n      throw redirect({\n        to: '/unauthorized',\n        search: { redirect: location.href },\n      })\n    }\n  },\n})\n```\n\nPermission-based:\n\n```tsx\n// src/routes/_authenticated/_users.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_users')({\n  beforeLoad: ({ context, location }) => {\n    if (!context.auth.hasAnyPermission(['users:read', 'users:write'])) {\n      throw redirect({\n        to: '/unauthorized',\n        search: { redirect: location.href },\n      })\n    }\n  },\n})\n```\n\nPage-level permission check (nested under an already-role-protected layout):\n\n```tsx\n// src/routes/_authenticated/_users/manage.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated/_users/manage')({\n  beforeLoad: ({ context }) => {\n    if (!context.auth.hasPermission('users:write')) {\n      throw new Error('Write permission required')\n    }\n  },\n  component: UserManagement,\n})\n\nfunction UserManagement() {\n  const { auth } = Route.useRouteContext()\n  const canDelete = auth.hasPermission('users:delete')\n\n  return (\n    <div>\n      <h1>User Management</h1>\n      {canDelete && <button>Delete User</button>}\n    </div>\n  )\n}\n```\n\n### Handling Auth Check Failures (isRedirect)\n\nWhen `beforeLoad` has a try/catch, redirects (which work by throwing) can get swallowed. Use `isRedirect` to re-throw:\n\n```tsx\nimport { createFileRoute, redirect, isRedirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: async ({ context, location }) => {\n    try {\n      const user = await verifySession(context.auth)\n      if (!user) {\n        throw redirect({\n          to: '/login',\n          search: { redirect: location.href },\n        })\n      }\n      return { user }\n    } catch (error) {\n      if (isRedirect(error)) throw error // re-throw redirect, don't swallow it\n      // Actual error — redirect to login\n      throw redirect({\n        to: '/login',\n        search: { redirect: location.href },\n      })\n    }\n  },\n})\n```\n\n## Common Mistakes\n\n### HIGH: Auth check in component instead of beforeLoad\n\nComponent-level auth checks cause a **flash of protected content** before the redirect:\n\n```tsx\n// WRONG — protected content renders briefly before redirect\nexport const Route = createFileRoute('/_authenticated/dashboard')({\n  component: () => {\n    const auth = useAuth()\n    if (!auth.isAuthenticated) return <Navigate to=\"/login\" />\n    return <Dashboard />\n  },\n})\n\n// CORRECT — beforeLoad runs before any rendering\nexport const Route = createFileRoute('/_authenticated/dashboard')({\n  beforeLoad: ({ context }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({ to: '/login' })\n    }\n  },\n  component: Dashboard,\n})\n```\n\n`beforeLoad` runs before any component rendering and before the loader. It completely prevents the flash.\n\n### HIGH: Not re-throwing redirects in try/catch\n\n`redirect()` works by throwing. If `beforeLoad` has a try/catch, the redirect gets swallowed:\n\n```tsx\n// WRONG — redirect is caught and swallowed\nbeforeLoad: async ({ context }) => {\n  try {\n    await validateSession(context.auth)\n  } catch (e) {\n    console.error(e) // swallows the redirect!\n  }\n}\n\n// CORRECT — use isRedirect to distinguish intentional redirects from errors\nimport { isRedirect } from '@tanstack/react-router'\n\nbeforeLoad: async ({ context }) => {\n  try {\n    await validateSession(context.auth)\n  } catch (e) {\n    if (isRedirect(e)) throw e\n    console.error(e)\n  }\n}\n```\n\n### MEDIUM: Conditionally rendering root route component\n\nThe root route always renders regardless of auth state. You cannot conditionally render its component:\n\n```tsx\n// WRONG — root route always renders, this doesn't protect anything\nexport const Route = createRootRoute({\n  component: () => {\n    if (!isAuthenticated()) return <Login />\n    return <Outlet />\n  },\n})\n\n// CORRECT — use a pathless layout route for auth boundaries\n// src/routes/_authenticated.tsx\nexport const Route = createFileRoute('/_authenticated')({\n  beforeLoad: ({ context }) => {\n    if (!context.auth.isAuthenticated) {\n      throw redirect({ to: '/login' })\n    }\n  },\n})\n```\n\nPlace protected routes as children of the `_authenticated` layout route. Public routes (login, home, etc.) live outside it.\n\n---\n\n## Cross-References\n\n- See also: **router-core/data-loading/SKILL.md** — `beforeLoad` runs before `loader`; auth context flows into loader via route context\n"
  },
  {
    "path": "packages/router-core/skills/router-core/code-splitting/SKILL.md",
    "content": "---\nname: router-core/code-splitting\ndescription: >-\n  Automatic code splitting (autoCodeSplitting), .lazy.tsx convention,\n  createLazyFileRoute, createLazyRoute, lazyRouteComponent, getRouteApi\n  for typed hooks in split files, codeSplitGroupings per-route override,\n  splitBehavior programmatic config, critical vs non-critical properties.\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\nsources:\n  - TanStack/router:docs/router/guide/code-splitting.md\n  - TanStack/router:docs/router/guide/automatic-code-splitting.md\n---\n\n# Code Splitting\n\nTanStack Router separates route code into **critical** (required to match and start loading) and **non-critical** (can be lazy-loaded). The bundler plugin can split automatically, or you can split manually with `.lazy.tsx` files.\n\n> **CRITICAL**: Never `export` component functions from route files — exported functions are included in the main bundle and bypass code splitting entirely.\n\n> **CRITICAL**: Use `getRouteApi('/path')` in code-split files, NOT `import { Route } from './route'`. Importing Route defeats code splitting.\n\n## What Stays in the Main Bundle (Critical)\n\n- Path parsing/serialization\n- `validateSearch`\n- `loader`, `beforeLoad`\n- Route context, static data\n- Links, scripts, styles\n\n## What Gets Split (Non-Critical)\n\n- `component`\n- `errorComponent`\n- `pendingComponent`\n- `notFoundComponent`\n\n> The `loader` is NOT split by default. It is already async, so splitting it adds a double async cost: fetch the chunk, then execute the loader. Only split the loader if you have a specific reason.\n\n## Setup: Automatic Code Splitting\n\nEnable `autoCodeSplitting: true` in the bundler plugin. This is the recommended approach.\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    // TanStack Router plugin MUST come before the framework plugin\n    tanstackRouter({\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n```\n\nWith this enabled, route files are automatically transformed. Components are split into separate chunks; loaders stay in the main bundle. No `.lazy.tsx` files needed.\n\n```tsx\n// src/routes/posts.tsx — everything in one file, splitting is automatic\nimport { createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../api'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\n// NOT exported — this is critical for automatic code splitting to work\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n  return (\n    <ul>\n      {posts.map((post) => (\n        <li key={post.id}>{post.title}</li>\n      ))}\n    </ul>\n  )\n}\n```\n\n## Manual Splitting with `.lazy.tsx`\n\nIf you cannot use automatic code splitting (e.g. CLI-only, no bundler plugin), split manually into two files:\n\n```tsx\n// src/routes/posts.tsx — critical route config only\nimport { createFileRoute } from '@tanstack/react-router'\nimport { fetchPosts } from '../api'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n})\n```\n\n```tsx\n// src/routes/posts.lazy.tsx — non-critical (lazy-loaded)\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  // Use getRouteApi to access typed hooks without importing Route\n  return <div>Posts</div>\n}\n```\n\n`createLazyFileRoute` supports only: `component`, `errorComponent`, `pendingComponent`, `notFoundComponent`.\n\n## Virtual Routes\n\nIf splitting leaves the critical route file empty, delete it entirely. A virtual route is auto-generated in `routeTree.gen.ts`:\n\n```tsx\n// src/routes/about.lazy.tsx — no about.tsx needed\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/about')({\n  component: () => <h1>About Us</h1>,\n})\n```\n\n## Code-Based Splitting\n\nFor code-based (non-file-based) routing, use `createLazyRoute` and the `.lazy()` method:\n\n```tsx\n// src/posts.lazy.tsx\nimport { createLazyRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  return <div>Posts</div>\n}\n```\n\n```tsx\n// src/app.tsx\nimport { createRoute } from '@tanstack/react-router'\n\nconst postsRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/posts',\n}).lazy(() => import('./posts.lazy').then((d) => d.Route))\n```\n\n## Accessing Typed Hooks in Split Files: `getRouteApi`\n\nWhen your component lives in a separate file, use `getRouteApi` to get typed access to route hooks without importing the Route object:\n\n```tsx\n// src/routes/posts.lazy.tsx\nimport { createLazyFileRoute, getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/posts')\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = routeApi.useLoaderData()\n  const { page } = routeApi.useSearch()\n  const params = routeApi.useParams()\n  const context = routeApi.useRouteContext()\n  return <div>Posts page {page}</div>\n}\n```\n\n`getRouteApi` provides: `useLoaderData`, `useLoaderDeps`, `useMatch`, `useParams`, `useRouteContext`, `useSearch`.\n\n## Per-Route Split Overrides: `codeSplitGroupings`\n\nOverride split behavior for a specific route by adding `codeSplitGroupings` directly in the route file:\n\n```tsx\n// src/routes/posts.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { loadPostsData } from './-heavy-posts-utils'\n\nexport const Route = createFileRoute('/posts')({\n  // Bundle loader and component together for this route\n  codeSplitGroupings: [['loader', 'component']],\n  loader: () => loadPostsData(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const data = Route.useLoaderData()\n  return <div>{data.title}</div>\n}\n```\n\n## Global Split Configuration\n\n### `defaultBehavior` — Change Default Groupings\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true,\n      codeSplittingOptions: {\n        defaultBehavior: [\n          // Bundle all UI components into one chunk\n          [\n            'component',\n            'pendingComponent',\n            'errorComponent',\n            'notFoundComponent',\n          ],\n        ],\n      },\n    }),\n  ],\n})\n```\n\n### `splitBehavior` — Programmatic Per-Route Logic\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    tanstackRouter({\n      autoCodeSplitting: true,\n      codeSplittingOptions: {\n        splitBehavior: ({ routeId }) => {\n          if (routeId.startsWith('/posts')) {\n            return [['loader', 'component']]\n          }\n          // All other routes use defaultBehavior\n        },\n      },\n    }),\n  ],\n})\n```\n\n### Precedence Order\n\n1. Per-route `codeSplitGroupings` (highest)\n2. `splitBehavior` function\n3. `defaultBehavior` option (lowest)\n\n## Common Mistakes\n\n### 1. HIGH: Exporting component functions prevents code splitting\n\n```tsx\n// WRONG — export puts PostsComponent in the main bundle\nexport function PostsComponent() {\n  return <div>Posts</div>\n}\n\n// CORRECT — no export, function stays in the split chunk\nfunction PostsComponent() {\n  return <div>Posts</div>\n}\n```\n\n### 2. MEDIUM: Trying to code-split the root route\n\n`__root.tsx` does not support code splitting. It is always rendered regardless of the current route. Do not create `__root.lazy.tsx`.\n\n### 3. MEDIUM: Splitting the loader adds double async cost\n\n```tsx\n// AVOID unless you have a specific reason\ncodeSplittingOptions: {\n  defaultBehavior: [\n    ['loader'], // Fetch chunk THEN execute loader = two network waterfalls\n    ['component'],\n  ],\n}\n\n// PREFERRED — loader stays in main bundle (default behavior)\ncodeSplittingOptions: {\n  defaultBehavior: [\n    ['component'],\n    ['errorComponent'],\n    ['notFoundComponent'],\n  ],\n}\n```\n\n### 4. HIGH: Importing Route in code-split files for typed hooks\n\n```tsx\n// WRONG — importing Route pulls route config into the lazy chunk\nimport { Route } from './posts.tsx'\nconst data = Route.useLoaderData()\n\n// CORRECT — getRouteApi gives typed hooks without pulling in the route\nimport { getRouteApi } from '@tanstack/react-router'\nconst routeApi = getRouteApi('/posts')\nconst data = routeApi.useLoaderData()\n```\n\n## Cross-References\n\n- **router-core/data-loading** — Loader splitting decisions affect data loading performance. Splitting the loader adds latency before data can be fetched.\n- **router-core/type-safety** — `getRouteApi` is the type-safe way to access hooks from split files.\n"
  },
  {
    "path": "packages/router-core/skills/router-core/data-loading/SKILL.md",
    "content": "---\nname: router-core/data-loading\ndescription: >-\n  Route loader option, loaderDeps for cache keys, staleTime/gcTime/\n  defaultPreloadStaleTime SWR caching, pendingComponent/pendingMs/\n  pendingMinMs, errorComponent/onError/onCatch, beforeLoad, router\n  context and createRootRouteWithContext DI pattern, router.invalidate,\n  Await component, deferred data loading with unawaited promises.\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\nsources:\n  - TanStack/router:docs/router/guide/data-loading.md\n  - TanStack/router:docs/router/guide/deferred-data-loading.md\n  - TanStack/router:docs/router/guide/router-context.md\n  - TanStack/router:docs/router/guide/data-mutations.md\n---\n\n# Data Loading\n\n## Setup\n\nBasic loader returning data, consumed via `useLoaderData`:\n\n```tsx\n// src/routes/posts.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n  return (\n    <ul>\n      {posts.map((post) => (\n        <li key={post.id}>{post.title}</li>\n      ))}\n    </ul>\n  )\n}\n```\n\nIn code-split components, use `getRouteApi` instead of importing Route:\n\n```tsx\nimport { getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/posts')\n\nfunction PostsComponent() {\n  const posts = routeApi.useLoaderData()\n  return <ul>{/* ... */}</ul>\n}\n```\n\n## Route Loading Lifecycle\n\nThe router executes this sequence on every URL/history update:\n\n1. **Route Matching** (top-down)\n   - `route.params.parse`\n   - `route.validateSearch`\n2. **Route Pre-Loading** (serial)\n   - `route.beforeLoad`\n   - `route.onError` → `route.errorComponent`\n3. **Route Loading** (parallel)\n   - `route.component.preload?`\n   - `route.loader`\n     - `route.pendingComponent` (optional)\n     - `route.component`\n   - `route.onError` → `route.errorComponent`\n\nKey: `beforeLoad` runs before `loader`. `beforeLoad` for a parent runs before its children's `beforeLoad`. Throwing in `beforeLoad` prevents all children from loading.\n\n## Core Patterns\n\n### loaderDeps for Search-Param-Driven Cache Keys\n\nLoaders don't receive search params directly. Use `loaderDeps` to declare which search params affect the cache key:\n\n```tsx\n// src/routes/posts.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  validateSearch: (search) => ({\n    offset: Number(search.offset) || 0,\n    limit: Number(search.limit) || 10,\n  }),\n  loaderDeps: ({ search: { offset, limit } }) => ({ offset, limit }),\n  loader: ({ deps: { offset, limit } }) => fetchPosts({ offset, limit }),\n})\n```\n\nWhen deps change, the route reloads regardless of `staleTime`.\n\n### SWR Caching Configuration\n\nTanStack Router has built-in Stale-While-Revalidate caching keyed on the route's parsed pathname + `loaderDeps`.\n\nDefaults:\n\n- **`staleTime`: 0** — data is always considered stale, reloads in background on re-match\n- **`preloadStaleTime`: 30 seconds** — preloaded data won't be refetched for 30s\n- **`gcTime`: 30 minutes** — unused cache entries garbage collected after 30min\n\n```tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  staleTime: 10_000, // 10s: data considered fresh for 10 seconds\n  gcTime: 5 * 60 * 1000, // 5min: garbage collect after 5 minutes\n})\n```\n\nDisable SWR caching entirely:\n\n```tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  staleTime: Infinity,\n})\n```\n\nGlobally:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  defaultStaleTime: Infinity,\n})\n```\n\n### Pending States (pendingComponent / pendingMs / pendingMinMs)\n\nBy default, a pending component shows after 1 second (`pendingMs: 1000`) and stays for at least 500ms (`pendingMinMs: 500`) to avoid flash.\n\n```tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  pendingMs: 500,\n  pendingMinMs: 300,\n  pendingComponent: () => <div>Loading posts...</div>,\n  component: PostsComponent,\n})\n```\n\n### Router Context with createRootRouteWithContext (Factory Pattern)\n\n`createRootRouteWithContext` is a factory that returns a function. You must call it twice — the first call passes the generic type, the second passes route options:\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRouteWithContext, Outlet } from '@tanstack/react-router'\n\ninterface MyRouterContext {\n  auth: { userId: string }\n  fetchPosts: () => Promise<Post[]>\n}\n\n// NOTE: double call — createRootRouteWithContext<Type>()({...})\nexport const Route = createRootRouteWithContext<MyRouterContext>()({\n  component: () => <Outlet />,\n})\n```\n\nSupply the context when creating the router:\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  context: {\n    auth: { userId: '123' },\n    fetchPosts,\n  },\n})\n```\n\nConsume in loaders and beforeLoad:\n\n```tsx\n// src/routes/posts.tsx\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context: { fetchPosts } }) => fetchPosts(),\n})\n```\n\nTo pass React hook values into the router context, call the hook above `RouterProvider` and inject via the `context` prop:\n\n```tsx\nimport { RouterProvider } from '@tanstack/react-router'\n\nfunction InnerApp() {\n  const auth = useAuth()\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\nfunction App() {\n  return (\n    <AuthProvider>\n      <InnerApp />\n    </AuthProvider>\n  )\n}\n```\n\nRoute-level context via `beforeLoad`:\n\n```tsx\nexport const Route = createFileRoute('/posts')({\n  beforeLoad: () => ({\n    fetchPosts: () => fetch('/api/posts').then((r) => r.json()),\n  }),\n  loader: ({ context: { fetchPosts } }) => fetchPosts(),\n})\n```\n\n### Deferred Data Loading\n\nReturn unawaited promises from the loader for non-critical data. Use the `Await` component to render them:\n\n```tsx\nimport { createFileRoute, Await } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    // Slow data — do NOT await\n    const slowDataPromise = fetchComments(postId)\n    // Fast data — await\n    const post = await fetchPost(postId)\n\n    return { post, deferredComments: slowDataPromise }\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const { post, deferredComments } = Route.useLoaderData()\n\n  return (\n    <div>\n      <h1>{post.title}</h1>\n      <Await\n        promise={deferredComments}\n        fallback={<div>Loading comments...</div>}\n      >\n        {(comments) => (\n          <ul>\n            {comments.map((c) => (\n              <li key={c.id}>{c.body}</li>\n            ))}\n          </ul>\n        )}\n      </Await>\n    </div>\n  )\n}\n```\n\n### Invalidation After Mutations\n\n`router.invalidate()` forces all active route loaders to re-run and marks all cached data as stale:\n\n```tsx\nimport { useRouter } from '@tanstack/react-router'\n\nfunction AddPostButton() {\n  const router = useRouter()\n\n  const handleAdd = async () => {\n    await fetch('/api/posts', { method: 'POST', body: '...' })\n    router.invalidate()\n  }\n\n  return <button onClick={handleAdd}>Add Post</button>\n}\n```\n\nFor synchronous invalidation (wait until loaders finish):\n\n```tsx\nawait router.invalidate({ sync: true })\n```\n\n### Error Handling\n\n```tsx\nimport {\n  createFileRoute,\n  ErrorComponent,\n  useRouter,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  errorComponent: ({ error, reset }) => {\n    const router = useRouter()\n\n    if (error instanceof CustomError) {\n      return <div>{error.message}</div>\n    }\n\n    return (\n      <div>\n        <ErrorComponent error={error} />\n        <button\n          onClick={() => {\n            // For loader errors, invalidate to re-run loader + reset boundary\n            router.invalidate()\n          }}\n        >\n          Retry\n        </button>\n      </div>\n    )\n  },\n})\n```\n\n### Loader Parameters\n\nThe `loader` function receives:\n\n- `params` — parsed path params\n- `deps` — object from `loaderDeps`\n- `context` — merged parent + beforeLoad context\n- `abortController` — cancelled when route unloads or becomes stale\n- `cause` — `'enter'`, `'stay'`, or `'preload'`\n- `preload` — `true` during preloading\n- `location` — current location object\n- `parentMatchPromise` — promise of parent route match\n- `route` — the route object itself\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ params: { postId }, abortController }) =>\n    fetchPost(postId, { signal: abortController.signal }),\n})\n```\n\n## Common Mistakes\n\n### CRITICAL: Assuming loaders only run on the server\n\nTanStack Router is **client-first**. Loaders run on the **client** by default. They also run on the server when using TanStack Start for SSR, but the default mental model is client-side execution.\n\n```tsx\n// WRONG — this will crash in the browser\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    const fs = await import('fs') // Node.js only!\n    return JSON.parse(fs.readFileSync('...')) // fails in browser\n  },\n})\n\n// CORRECT — loaders run in the browser, use fetch or API calls\nexport const Route = createFileRoute('/posts')({\n  loader: async () => {\n    const res = await fetch('/api/posts')\n    return res.json()\n  },\n})\n```\n\nDo NOT put database queries, filesystem access, or server-only code in loaders unless you are using TanStack Start server functions.\n\n### MEDIUM: Not understanding staleTime default is 0\n\nDefault `staleTime` is `0`. This means data reloads in the background on every route re-match. This is intentional — it ensures fresh data. But if your data is expensive or static, set `staleTime`:\n\n```tsx\nexport const Route = createFileRoute('/posts')({\n  loader: () => fetchPosts(),\n  staleTime: 60_000, // Consider fresh for 1 minute\n})\n```\n\n### HIGH: Using reset() instead of router.invalidate() in error components\n\n`reset()` only resets the error boundary UI. It does NOT re-run the loader. For loader errors, use `router.invalidate()` which re-runs loaders and resets the boundary:\n\n```tsx\n// WRONG — resets boundary but loader still has stale error\nfunction PostErrorComponent({ error, reset }) {\n  return <button onClick={reset}>Retry</button>\n}\n\n// CORRECT — re-runs loader and resets the error boundary\nfunction PostErrorComponent({ error }) {\n  const router = useRouter()\n  return <button onClick={() => router.invalidate()}>Retry</button>\n}\n```\n\n### HIGH: Missing double parentheses on createRootRouteWithContext\n\n`createRootRouteWithContext<Type>()` is a factory — it returns a function. Must call twice:\n\n```tsx\n// WRONG — missing second call, passes options to the factory\nconst rootRoute = createRootRouteWithContext<{ auth: AuthState }>({\n  component: RootComponent,\n})\n\n// CORRECT — factory()({options})\nconst rootRoute = createRootRouteWithContext<{ auth: AuthState }>()({\n  component: RootComponent,\n})\n```\n\n### HIGH: Using React hooks in beforeLoad or loader\n\n`beforeLoad` and `loader` are NOT React components. You cannot call hooks inside them. Use router context to inject values from hooks:\n\n```tsx\n// WRONG — hooks cannot be called outside React components\nexport const Route = createFileRoute('/posts')({\n  loader: () => {\n    const auth = useAuth() // This will crash!\n    return fetchPosts(auth.userId)\n  },\n})\n\n// CORRECT — inject hook values via router context\n// In your App component:\nfunction InnerApp() {\n  const auth = useAuth()\n  return <RouterProvider router={router} context={{ auth }} />\n}\n\n// In your route:\nexport const Route = createFileRoute('/posts')({\n  loader: ({ context: { auth } }) => fetchPosts(auth.userId),\n})\n```\n\n### HIGH: Property order affects TypeScript inference\n\nRouter infers types from earlier properties into later ones. Declaring `beforeLoad` after `loader` means context from `beforeLoad` is unknown in the loader:\n\n```tsx\n// WRONG — context.user is unknown because beforeLoad declared after loader\nexport const Route = createFileRoute('/admin')({\n  loader: ({ context }) => fetchData(context.user),\n  beforeLoad: () => ({ user: getUser() }),\n})\n\n// CORRECT — validateSearch → loaderDeps → beforeLoad → loader\nexport const Route = createFileRoute('/admin')({\n  beforeLoad: () => ({ user: getUser() }),\n  loader: ({ context }) => fetchData(context.user),\n})\n```\n\n### HIGH: Returning entire search object from loaderDeps\n\n```tsx\n// WRONG — loader re-runs on ANY search param change\nloaderDeps: ({ search }) => search\n\n// CORRECT — only re-run when page changes\nloaderDeps: ({ search }) => ({ page: search.page })\n```\n\nReturning the whole `search` object means unrelated param changes (e.g., `sortDirection`, `viewMode`) trigger unnecessary reloads because deep equality fails on the entire object.\n\n## Tensions\n\n- **Client-first loaders vs SSR expectations**: Loaders run on the client by default. When using SSR (TanStack Start), they run on both client and server. Browser-only APIs work by default but break under SSR. Server-only APIs (fs, db) break by default but work under Start server functions. See **router-core/ssr/SKILL.md**.\n- **Built-in SWR cache vs external cache coordination**: Router has built-in caching. When using TanStack Query, set `defaultPreloadStaleTime: 0` to avoid double-caching. See **compositions/router-query/SKILL.md**.\n\n---\n\n## Cross-References\n\n- See also: **router-core/search-params/SKILL.md** — `loaderDeps` consumes validated search params as cache keys\n- See also: **compositions/router-query/SKILL.md** — for external cache coordination with TanStack Query\n"
  },
  {
    "path": "packages/router-core/skills/router-core/navigation/SKILL.md",
    "content": "---\nname: router-core/navigation\ndescription: >-\n  Link component, useNavigate, Navigate component, router.navigate,\n  ToOptions/NavigateOptions/LinkOptions, from/to relative navigation,\n  activeOptions/activeProps, preloading (intent/viewport/render),\n  preloadDelay, navigation blocking (useBlocker, Block), createLink,\n  linkOptions helper, scroll restoration, MatchRoute.\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\nsources:\n  - TanStack/router:docs/router/guide/navigation.md\n  - TanStack/router:docs/router/guide/preloading.md\n  - TanStack/router:docs/router/guide/navigation-blocking.md\n  - TanStack/router:docs/router/guide/link-options.md\n  - TanStack/router:docs/router/guide/custom-link.md\n  - TanStack/router:docs/router/guide/scroll-restoration.md\n---\n\n# Navigation\n\n## Setup\n\nBasic type-safe `Link` with `to` and `params`:\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction PostLink({ postId }: { postId: string }) {\n  return (\n    <Link to=\"/posts/$postId\" params={{ postId }}>\n      View Post\n    </Link>\n  )\n}\n```\n\n## Core Patterns\n\n### Link with Active States\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction NavLink() {\n  return (\n    <Link\n      to=\"/posts\"\n      activeProps={{ className: 'font-bold' }}\n      inactiveProps={{ className: 'text-gray-500' }}\n      activeOptions={{ exact: true }}\n    >\n      Posts\n    </Link>\n  )\n}\n```\n\nThe `data-status` attribute is also set to `\"active\"` on active links for CSS-based styling.\n\n`activeOptions` controls matching behavior:\n\n- `exact` (default `false`) — when `true`, only matches the exact path (not children)\n- `includeHash` (default `false`) — include hash in active matching\n- `includeSearch` (default `true`) — include search params in active matching\n\nChildren can receive `isActive` as a render function:\n\n```tsx\n<Link to=\"/posts\">\n  {({ isActive }) => <span className={isActive ? 'font-bold' : ''}>Posts</span>}\n</Link>\n```\n\n### Relative Navigation with `from`\n\nWithout `from`, navigation resolves from root `/`. To use relative paths like `..`, provide `from`:\n\n```tsx\nimport { createFileRoute, Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  return (\n    <div>\n      {/* Relative to current route */}\n      <Link from={Route.fullPath} to=\"..\">\n        Back to Posts\n      </Link>\n\n      {/* \".\" reloads the current route */}\n      <Link from={Route.fullPath} to=\".\">\n        Reload\n      </Link>\n    </div>\n  )\n}\n```\n\n### useNavigate for Programmatic Navigation\n\nUse `useNavigate` only for side-effect-driven navigation (e.g., after a form submission). For anything the user clicks, prefer `Link`.\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction CreatePostForm() {\n  const navigate = useNavigate({ from: '/posts' })\n\n  const handleSubmit = async (e: React.FormEvent) => {\n    e.preventDefault()\n    const response = await fetch('/api/posts', { method: 'POST', body: '...' })\n    const { id: postId } = await response.json()\n\n    if (response.ok) {\n      navigate({ to: '/posts/$postId', params: { postId } })\n    }\n  }\n\n  return <form onSubmit={handleSubmit}>{/* ... */}</form>\n}\n```\n\nThe `Navigate` component performs an immediate client-side navigation on mount:\n\n```tsx\nimport { Navigate } from '@tanstack/react-router'\n\nfunction LegacyRedirect() {\n  return <Navigate to=\"/posts/$postId\" params={{ postId: 'my-first-post' }} />\n}\n```\n\n`router.navigate` is available anywhere you have the router instance, including outside of React.\n\n### Preloading\n\nStrategies: `intent` (hover/touchstart), `viewport` (intersection observer), `render` (on mount).\n\nSet globally:\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  routeTree,\n  defaultPreload: 'intent',\n  defaultPreloadDelay: 50, // ms, default is 50\n})\n```\n\nOr per-link:\n\n```tsx\n<Link\n  to=\"/posts/$postId\"\n  params={{ postId }}\n  preload=\"intent\"\n  preloadDelay={100}\n>\n  View Post\n</Link>\n```\n\nPreloaded data stays fresh for 30 seconds by default (`defaultPreloadStaleTime: 30_000`). During that window it won't be refetched. When using an external cache like TanStack Query, set `defaultPreloadStaleTime: 0` to let the external library control freshness.\n\nManual preloading via the router instance:\n\n```tsx\nimport { useRouter } from '@tanstack/react-router'\n\nfunction Component() {\n  const router = useRouter()\n\n  useEffect(() => {\n    router.preloadRoute({ to: '/posts/$postId', params: { postId: '1' } })\n  }, [router])\n\n  return <div />\n}\n```\n\n### Navigation Blocking\n\nUse `useBlocker` to prevent navigation when a form has unsaved changes:\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nfunction EditForm() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  useBlocker({\n    shouldBlockFn: () => {\n      if (!formIsDirty) return false\n      const shouldLeave = confirm('Are you sure you want to leave?')\n      return !shouldLeave\n    },\n  })\n\n  return <form>{/* ... */}</form>\n}\n```\n\nWith custom UI using `withResolver`:\n\n```tsx\nimport { useBlocker } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nfunction EditForm() {\n  const [formIsDirty, setFormIsDirty] = useState(false)\n\n  const { proceed, reset, status } = useBlocker({\n    shouldBlockFn: () => formIsDirty,\n    withResolver: true,\n  })\n\n  return (\n    <>\n      <form>{/* ... */}</form>\n      {status === 'blocked' && (\n        <div>\n          <p>Are you sure you want to leave?</p>\n          <button onClick={proceed}>Yes</button>\n          <button onClick={reset}>No</button>\n        </div>\n      )}\n    </>\n  )\n}\n```\n\nControl `beforeunload` separately:\n\n```tsx\nuseBlocker({\n  shouldBlockFn: () => formIsDirty,\n  enableBeforeUnload: formIsDirty,\n})\n```\n\n### linkOptions for Reusable Navigation Options\n\n`linkOptions` provides eager type-checking on navigation options objects, so errors surface at definition, not at spread-site:\n\n```tsx\nimport {\n  linkOptions,\n  Link,\n  useNavigate,\n  redirect,\n} from '@tanstack/react-router'\n\nconst dashboardLinkOptions = linkOptions({\n  to: '/dashboard',\n  search: { search: '' },\n})\n\n// Use anywhere: Link, navigate, redirect\nfunction Nav() {\n  const navigate = useNavigate()\n\n  return (\n    <div>\n      <Link {...dashboardLinkOptions}>Dashboard</Link>\n      <button onClick={() => navigate(dashboardLinkOptions)}>Go</button>\n    </div>\n  )\n}\n\n// Also works in an array for navigation bars\nconst navOptions = linkOptions([\n  { to: '/dashboard', label: 'Summary', activeOptions: { exact: true } },\n  { to: '/dashboard/invoices', label: 'Invoices' },\n  { to: '/dashboard/users', label: 'Users' },\n])\n\nfunction NavBar() {\n  return (\n    <nav>\n      {navOptions.map((option) => (\n        <Link\n          {...option}\n          key={option.to}\n          activeProps={{ className: 'font-bold' }}\n        >\n          {option.label}\n        </Link>\n      ))}\n    </nav>\n  )\n}\n```\n\n### createLink for Custom Components\n\nWraps any component with TanStack Router's type-safe navigation:\n\n```tsx\nimport * as React from 'react'\nimport { createLink, LinkComponent } from '@tanstack/react-router'\n\ninterface BasicLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {}\n\nconst BasicLinkComponent = React.forwardRef<HTMLAnchorElement, BasicLinkProps>(\n  (props, ref) => {\n    return <a ref={ref} {...props} className=\"block px-3 py-2 text-blue-700\" />\n  },\n)\n\nconst CreatedLinkComponent = createLink(BasicLinkComponent)\n\nexport const CustomLink: LinkComponent<typeof BasicLinkComponent> = (props) => {\n  return <CreatedLinkComponent preload=\"intent\" {...props} />\n}\n```\n\nUsage retains full type safety:\n\n```tsx\n<CustomLink to=\"/dashboard/invoices/$invoiceId\" params={{ invoiceId: 0 }} />\n```\n\n### Scroll Restoration\n\nEnable globally on the router:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n})\n```\n\nFor nested scrollable areas:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n  scrollToTopSelectors: ['#main-scrollable-area'],\n})\n```\n\nCustom cache keys:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  scrollRestoration: true,\n  getScrollRestorationKey: (location) => location.pathname,\n})\n```\n\nPrevent scroll reset for a specific navigation:\n\n```tsx\n<Link to=\"/posts\" resetScroll={false}>\n  Posts\n</Link>\n```\n\n### MatchRoute for Pending UI\n\n```tsx\nimport { Link, MatchRoute } from '@tanstack/react-router'\n\nfunction Nav() {\n  return (\n    <Link to=\"/users\">\n      Users\n      <MatchRoute to=\"/users\" pending>\n        <Spinner />\n      </MatchRoute>\n    </Link>\n  )\n}\n```\n\n## Common Mistakes\n\n### CRITICAL: Interpolating params into the `to` string\n\n```tsx\n// WRONG — breaks type safety and param encoding\n<Link to={`/posts/${postId}`}>Post</Link>\n\n// CORRECT — use the params option\n<Link to=\"/posts/$postId\" params={{ postId }}>Post</Link>\n```\n\nDynamic segments are declared with `$` in the route path. Always pass them via `params`. This applies to `Link`, `useNavigate`, `Navigate`, and `router.navigate`.\n\n### MEDIUM: Using useNavigate for clickable elements\n\n```tsx\n// WRONG — no href, no cmd+click, no preloading, no accessibility\nfunction BadNav() {\n  const navigate = useNavigate()\n  return <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n}\n\n// CORRECT — real <a> tag with href, accessible, preloadable\nfunction GoodNav() {\n  return <Link to=\"/posts\">Posts</Link>\n}\n```\n\nUse `useNavigate` only for programmatic side-effect navigation (after form submit, async action, etc).\n\n### HIGH: Not providing `from` for relative navigation\n\n```tsx\n// WRONG — without from, \"..\" resolves from root\n<Link to=\"..\">Back</Link>\n\n// CORRECT — provide from for relative resolution\n<Link from={Route.fullPath} to=\"..\">Back</Link>\n```\n\nWithout `from`, only absolute paths are autocompleted and type-safe. Relative paths like `..` resolve from root instead of the current route.\n\n### HIGH: Using search as object instead of function loses existing params\n\n```tsx\n// WRONG — replaces ALL search params with just { page: 2 }\n<Link to=\".\" search={{ page: 2 }}>Page 2</Link>\n\n// CORRECT — preserves existing search params, updates page\n<Link to=\".\" search={(prev) => ({ ...prev, page: 2 })}>Page 2</Link>\n```\n\nWhen you pass `search` as a plain object, it replaces all search params. Use the function form to spread previous params and selectively update.\n\n---\n\n## Cross-References\n\n- See also: **router-core/search-params/SKILL.md** — Link `search` prop interacts with search param validation\n- See also: **router-core/type-safety/SKILL.md** — `from` narrowing improves type inference on Link\n"
  },
  {
    "path": "packages/router-core/skills/router-core/not-found-and-errors/SKILL.md",
    "content": "---\nname: router-core/not-found-and-errors\ndescription: >-\n  notFound() function, notFoundComponent, defaultNotFoundComponent,\n  notFoundMode (fuzzy/root), errorComponent, CatchBoundary,\n  CatchNotFound, isNotFound, NotFoundRoute (deprecated), route\n  masking (mask option, createRouteMask, unmaskOnReload).\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\nsources:\n  - TanStack/router:docs/router/guide/not-found-errors.md\n  - TanStack/router:docs/router/guide/route-masking.md\n---\n\n# Not Found and Errors\n\nTanStack Router handles two categories of \"not found\": unmatched URL paths (automatic) and missing resources like a post that doesn't exist (manual via `notFound()`). Error boundaries are configured per-route via `errorComponent`.\n\n> **CRITICAL**: Do NOT use the deprecated `NotFoundRoute`. When present, `notFound()` and `notFoundComponent` will NOT work. Remove it and use `notFoundComponent` instead.\n> **CRITICAL**: `useLoaderData` may be undefined inside `notFoundComponent`. Use `useParams`, `useSearch`, or `useRouteContext` instead.\n\n## Not Found Handling\n\n### Global 404: `notFoundComponent` on Root Route\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Outlet, Link } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n  notFoundComponent: () => {\n    return (\n      <div>\n        <h1>404 — Page Not Found</h1>\n        <Link to=\"/\">Go Home</Link>\n      </div>\n    )\n  },\n})\n```\n\n### Router-Wide Default: `defaultNotFoundComponent`\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({\n  routeTree,\n  defaultNotFoundComponent: () => {\n    return (\n      <div>\n        <p>Not found!</p>\n        <Link to=\"/\">Go home</Link>\n      </div>\n    )\n  },\n})\n```\n\n### Per-Route 404: Missing Resources with `notFound()`\n\nThrow `notFound()` in `loader` or `beforeLoad` when a resource doesn't exist. It works like `redirect()` — throw it to trigger the not-found boundary.\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute, notFound } from '@tanstack/react-router'\nimport { getPost } from '../api'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const post = await getPost(postId)\n    if (!post) throw notFound()\n    return { post }\n  },\n  component: PostComponent,\n  notFoundComponent: ({ data }) => {\n    const { postId } = Route.useParams()\n    return <p>Post \"{postId}\" not found</p>\n  },\n})\n\nfunction PostComponent() {\n  const { post } = Route.useLoaderData()\n  return <h1>{post.title}</h1>\n}\n```\n\n### Targeting a Specific Route with `notFound({ routeId })`\n\nYou can force a specific parent route to handle the not-found error:\n\n```tsx\n// src/routes/_layout/posts.$postId.tsx\nimport { createFileRoute, notFound } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const post = await getPost(postId)\n    if (!post) throw notFound({ routeId: '/_layout' })\n    return { post }\n  },\n})\n```\n\n### Targeting Root Route with `rootRouteId`\n\n```tsx\nimport { createFileRoute, notFound, rootRouteId } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const post = await getPost(postId)\n    if (!post) throw notFound({ routeId: rootRouteId })\n    return { post }\n  },\n})\n```\n\n## `notFoundMode`: Fuzzy vs Root\n\n### `fuzzy` (default)\n\nThe router finds the nearest parent route with children and a `notFoundComponent`. Preserves as much parent layout as possible.\n\nGiven routes: `__root__` → `posts` → `$postId`, accessing `/posts/1/edit`:\n\n- `<Root>` renders\n- `<Posts>` renders\n- `<Posts.notFoundComponent>` renders (nearest parent with children + notFoundComponent)\n\n### `root`\n\nAll not-found errors go to the root route's `notFoundComponent`, regardless of matching:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  notFoundMode: 'root',\n})\n```\n\n## Error Handling\n\n### `errorComponent` Per Route\n\n`errorComponent` receives `error`, `info`, and `reset` props. For loader errors, use `router.invalidate()` to re-run the loader — it automatically resets the error boundary.\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute, useRouter } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params: { postId } }) => {\n    const res = await fetch(`/api/posts/${postId}`)\n    if (!res.ok) throw new Error('Failed to load post')\n    return res.json()\n  },\n  component: PostComponent,\n  errorComponent: PostErrorComponent,\n})\n\nfunction PostErrorComponent({\n  error,\n}: {\n  error: Error\n  info: { componentStack: string }\n  reset: () => void\n}) {\n  const router = useRouter()\n\n  return (\n    <div>\n      <p>Error: {error.message}</p>\n      <button\n        onClick={() => {\n          // Invalidate re-runs the loader and resets the error boundary\n          router.invalidate()\n        }}\n      >\n        Retry\n      </button>\n    </div>\n  )\n}\n\nfunction PostComponent() {\n  const data = Route.useLoaderData()\n  return <h1>{data.title}</h1>\n}\n```\n\n### Router-Wide Default Error Component\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  defaultErrorComponent: ({ error }) => {\n    const router = useRouter()\n    return (\n      <div>\n        <p>Something went wrong: {error.message}</p>\n        <button\n          onClick={() => {\n            router.invalidate()\n          }}\n        >\n          Retry\n        </button>\n      </div>\n    )\n  },\n})\n```\n\n## Data in `notFoundComponent`\n\n`notFoundComponent` cannot reliably use `useLoaderData` because the loader may not have completed. Safe hooks:\n\n```tsx\nnotFoundComponent: ({ data }) => {\n  // SAFE — always available:\n  const params = Route.useParams()\n  const search = Route.useSearch()\n  const context = Route.useRouteContext()\n\n  // UNSAFE — may be undefined:\n  // const loaderData = Route.useLoaderData()\n\n  return <p>Item {params.id} not found</p>\n}\n```\n\nTo forward partial data, use the `data` option on `notFound()`:\n\n```tsx\nloader: async ({ params }) => {\n  const partialData = await getPartialData(params.id)\n  if (!partialData.fullResource) {\n    throw notFound({ data: { name: partialData.name } })\n  }\n  return partialData\n},\nnotFoundComponent: ({ data }) => {\n  // data is typed as unknown — validate it\n  const info = data as { name: string } | undefined\n  return <p>{info?.name ?? 'Resource'} not found</p>\n},\n```\n\n## Route Masking\n\nRoute masking shows a different URL in the browser bar than the actual route being rendered. Masking data is stored in `location.state` and is lost when the URL is shared or opened in a new tab.\n\n### Imperative Masking on `<Link>`\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction PhotoGrid({ photoId }: { photoId: string }) {\n  return (\n    <Link\n      to=\"/photos/$photoId/modal\"\n      params={{ photoId }}\n      mask={{\n        to: '/photos/$photoId',\n        params: { photoId },\n      }}\n    >\n      Open Photo\n    </Link>\n  )\n}\n```\n\n### Imperative Masking with `useNavigate`\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction OpenPhotoButton({ photoId }: { photoId: string }) {\n  const navigate = useNavigate()\n\n  return (\n    <button\n      onClick={() =>\n        navigate({\n          to: '/photos/$photoId/modal',\n          params: { photoId },\n          mask: {\n            to: '/photos/$photoId',\n            params: { photoId },\n          },\n        })\n      }\n    >\n      Open Photo\n    </button>\n  )\n}\n```\n\n### Declarative Masking with `createRouteMask`\n\n```tsx\nimport { createRouter, createRouteMask } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst photoModalMask = createRouteMask({\n  routeTree,\n  from: '/photos/$photoId/modal',\n  to: '/photos/$photoId',\n  params: (prev) => ({ photoId: prev.photoId }),\n})\n\nconst router = createRouter({\n  routeTree,\n  routeMasks: [photoModalMask],\n})\n```\n\n### Unmasking on Reload\n\nBy default, masks survive local page reloads. To unmask on reload:\n\n```tsx\n// Per-mask\nconst mask = createRouteMask({\n  routeTree,\n  from: '/photos/$photoId/modal',\n  to: '/photos/$photoId',\n  params: (prev) => ({ photoId: prev.photoId }),\n  unmaskOnReload: true,\n})\n\n// Per-link\n<Link\n  to=\"/photos/$photoId/modal\"\n  params={{ photoId }}\n  mask={{ to: '/photos/$photoId', params: { photoId } }}\n  unmaskOnReload\n>\n  Open Photo\n</Link>\n\n// Router-wide default\nconst router = createRouter({\n  routeTree,\n  unmaskOnReload: true,\n})\n```\n\n## Common Mistakes\n\n### 1. HIGH: Using deprecated `NotFoundRoute`\n\n```tsx\n// WRONG — NotFoundRoute blocks notFound() and notFoundComponent from working\nimport { NotFoundRoute } from '@tanstack/react-router'\nconst notFoundRoute = new NotFoundRoute({ component: () => <p>404</p> })\nconst router = createRouter({ routeTree, notFoundRoute })\n\n// CORRECT — use notFoundComponent on root route\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n  notFoundComponent: () => <p>404</p>,\n})\n```\n\n### 2. MEDIUM: Expecting `useLoaderData` in `notFoundComponent`\n\n```tsx\n// WRONG — loader may not have completed\nnotFoundComponent: () => {\n  const data = Route.useLoaderData() // may be undefined!\n  return <p>{data.title} not found</p>\n}\n\n// CORRECT — use safe hooks\nnotFoundComponent: () => {\n  const { postId } = Route.useParams()\n  return <p>Post {postId} not found</p>\n}\n```\n\n### 3. MEDIUM: Leaf routes cannot handle not-found errors\n\nOnly routes with children (and therefore an `<Outlet>`) can render `notFoundComponent`. Leaf routes (routes without children) will never catch not-found errors — the error bubbles up to the nearest parent with children.\n\n```tsx\n// This route has NO children — notFoundComponent here will not catch\n// unmatched child paths (there are no child paths to unmatch)\nexport const Route = createFileRoute('/posts/$postId')({\n  // notFoundComponent here only works for notFound() thrown in THIS route's loader\n  // It does NOT catch path-based not-founds\n  notFoundComponent: () => <p>Not found</p>,\n})\n```\n\n### 4. MEDIUM: Expecting masked URLs to survive sharing\n\nMasking data lives in `location.state` (browser history). When a masked URL is copied, shared, or opened in a new tab, the masking data is lost. The browser navigates to the visible (masked) URL directly.\n\n### 5. HIGH (cross-skill): Using `reset()` alone instead of `router.invalidate()`\n\n```tsx\n// WRONG — reset() clears the error boundary but does NOT re-run the loader\nfunction ErrorFallback({ error, reset }: { error: Error; reset: () => void }) {\n  return <button onClick={reset}>Retry</button>\n}\n\n// CORRECT — invalidate re-runs loaders and resets the error boundary\nfunction ErrorFallback({ error }: { error: Error; reset: () => void }) {\n  const router = useRouter()\n  return (\n    <button\n      onClick={() => {\n        router.invalidate()\n      }}\n    >\n      Retry\n    </button>\n  )\n}\n```\n\n## Cross-References\n\n- **router-core/data-loading** — `notFound()` thrown in loaders interacts with error boundaries and loader data availability. `errorComponent` retry requires `router.invalidate()`.\n- **router-core/type-safety** — `notFoundComponent` data is typed as `unknown`; validate before use.\n"
  },
  {
    "path": "packages/router-core/skills/router-core/path-params/SKILL.md",
    "content": "---\nname: router-core/path-params\ndescription: >-\n  Dynamic path segments ($paramName), splat routes ($ / _splat),\n  optional params ({-$paramName}), prefix/suffix patterns ({$param}.ext),\n  useParams, params.parse/stringify, pathParamsAllowedCharacters,\n  i18n locale patterns.\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\nsources:\n  - TanStack/router:docs/router/guide/path-params.md\n  - TanStack/router:docs/router/routing/routing-concepts.md\n  - TanStack/router:docs/router/guide/internationalization-i18n.md\n---\n\n# Path Params\n\nPath params capture dynamic URL segments into named variables. They are defined with a `$` prefix in the route path.\n\n> **CRITICAL**: Never interpolate params into the `to` string. Always use the `params` prop. This is the most common agent mistake for path params.\n\n> **CRITICAL**: Types are fully inferred. Never annotate the return of `useParams()`.\n\n## Dynamic Segments\n\nA segment prefixed with `$` captures text until the next `/`.\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    // params.postId is string — fully inferred, do not annotate\n    return fetchPost(params.postId)\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const { postId } = Route.useParams()\n  const data = Route.useLoaderData()\n  return (\n    <h1>\n      Post {postId}: {data.title}\n    </h1>\n  )\n}\n```\n\nMultiple dynamic segments work across path levels:\n\n```tsx\n// src/routes/teams.$teamId.members.$memberId.tsx\nexport const Route = createFileRoute('/teams/$teamId/members/$memberId')({\n  component: MemberComponent,\n})\n\nfunction MemberComponent() {\n  const { teamId, memberId } = Route.useParams()\n  return (\n    <div>\n      Team {teamId}, Member {memberId}\n    </div>\n  )\n}\n```\n\n## Splat / Catch-All Routes\n\nA route with a path ending in `$` (bare dollar sign) captures everything after it. The value is available under the `_splat` key.\n\n```tsx\n// src/routes/files.$.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/files/$')({\n  component: FileViewer,\n})\n\nfunction FileViewer() {\n  const { _splat } = Route.useParams()\n  // URL: /files/documents/report.pdf → _splat = \"documents/report.pdf\"\n  return <div>File path: {_splat}</div>\n}\n```\n\n## Optional Params\n\nOptional params use `{-$paramName}` syntax. The segment may or may not be present. When absent, the value is `undefined`.\n\n```tsx\n// src/routes/posts.{-$category}.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/{-$category}')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const { category } = Route.useParams()\n  // URL: /posts → category is undefined\n  // URL: /posts/tech → category is \"tech\"\n  return <div>{category ? `Posts in ${category}` : 'All Posts'}</div>\n}\n```\n\nMultiple optional params:\n\n```tsx\n// Matches: /posts, /posts/tech, /posts/tech/hello-world\nexport const Route = createFileRoute('/posts/{-$category}/{-$slug}')({\n  component: PostComponent,\n})\n```\n\n### i18n with Optional Locale\n\n```tsx\n// src/routes/{-$locale}/about.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/{-$locale}/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  const { locale } = Route.useParams()\n  const currentLocale = locale || 'en'\n  return <h1>{currentLocale === 'fr' ? 'À Propos' : 'About Us'}</h1>\n}\n// Matches: /about, /en/about, /fr/about\n```\n\n## Prefix and Suffix Patterns\n\nCurly braces `{}` around `$paramName` allow text before or after the dynamic part within a single segment.\n\n### Prefix\n\n```tsx\n// src/routes/posts/post-{$postId}.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/post-{$postId}')({\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  const { postId } = Route.useParams()\n  // URL: /posts/post-123 → postId = \"123\"\n  return <div>Post ID: {postId}</div>\n}\n```\n\n### Suffix\n\n```tsx\n// src/routes/files/{$fileName}[.]txt.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/files/{$fileName}.txt')({\n  component: FileComponent,\n})\n\nfunction FileComponent() {\n  const { fileName } = Route.useParams()\n  // URL: /files/readme.txt → fileName = \"readme\"\n  return <div>File: {fileName}.txt</div>\n}\n```\n\n### Combined Prefix + Suffix\n\n```tsx\n// URL: /users/user-456.json → userId = \"456\"\nexport const Route = createFileRoute('/users/user-{$userId}.json')({\n  component: UserComponent,\n})\n\nfunction UserComponent() {\n  const { userId } = Route.useParams()\n  return <div>User: {userId}</div>\n}\n```\n\n## Navigating with Path Params\n\n### Object Form\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction PostLink({ postId }: { postId: string }) {\n  return (\n    <Link to=\"/posts/$postId\" params={{ postId }}>\n      View Post\n    </Link>\n  )\n}\n```\n\n### Function Form (Preserves Other Params)\n\n```tsx\nfunction PostLink({ postId }: { postId: string }) {\n  return (\n    <Link to=\"/posts/$postId\" params={(prev) => ({ ...prev, postId })}>\n      View Post\n    </Link>\n  )\n}\n```\n\n### Programmatic Navigation\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction GoToPost({ postId }: { postId: string }) {\n  const navigate = useNavigate()\n\n  return (\n    <button\n      onClick={() => {\n        navigate({ to: '/posts/$postId', params: { postId } })\n      }}\n    >\n      Go to Post\n    </button>\n  )\n}\n```\n\n### Navigating with Optional Params\n\n```tsx\n// Include the optional param\n<Link to=\"/posts/{-$category}\" params={{ category: 'tech' }}>\n  Tech Posts\n</Link>\n\n// Omit the optional param (renders /posts)\n<Link to=\"/posts/{-$category}\" params={{ category: undefined }}>\n  All Posts\n</Link>\n```\n\n## Reading Params Outside Route Components\n\n### `useParams` with `from`\n\n```tsx\nimport { useParams } from '@tanstack/react-router'\n\nfunction PostHeader() {\n  const { postId } = useParams({ from: '/posts/$postId' })\n  return <h2>Post {postId}</h2>\n}\n```\n\n### `useParams` with `strict: false`\n\n```tsx\nfunction GenericBreadcrumb() {\n  const params = useParams({ strict: false })\n  // params is a union of all possible route params\n  return <span>{params.postId ?? 'Home'}</span>\n}\n```\n\n## Params in Loaders and `beforeLoad`\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  beforeLoad: async ({ params }) => {\n    // params.postId available here\n    const canView = await checkPermission(params.postId)\n    if (!canView) throw redirect({ to: '/unauthorized' })\n  },\n  loader: async ({ params }) => {\n    return fetchPost(params.postId)\n  },\n})\n```\n\n## Allowed Characters\n\nBy default, params are encoded with `encodeURIComponent`. Allow extra characters via router config:\n\n```tsx\nimport { createRouter } from '@tanstack/react-router'\n\nconst router = createRouter({\n  routeTree,\n  pathParamsAllowedCharacters: ['@', '+'],\n})\n```\n\nAllowed characters: `;`, `:`, `@`, `&`, `=`, `+`, `$`, `,`.\n\n## Common Mistakes\n\n### 1. CRITICAL (cross-skill): Interpolating path params into `to` string\n\n```tsx\n// WRONG — breaks type safety and param encoding\n<Link to={`/posts/${postId}`}>Post</Link>\n\n// CORRECT — use params prop\n<Link to=\"/posts/$postId\" params={{ postId }}>Post</Link>\n```\n\n### 2. MEDIUM: Using `*` for splat routes instead of `$`\n\nTanStack Router uses `$` for splat routes. The captured value is under `_splat`, not `*`.\n\n```tsx\n// WRONG (React Router / other frameworks)\n// <Route path=\"/files/*\" />\n\n// CORRECT (TanStack Router)\n// File: src/routes/files.$.tsx\nexport const Route = createFileRoute('/files/$')({\n  component: () => {\n    const { _splat } = Route.useParams()\n    return <div>{_splat}</div>\n  },\n})\n```\n\n> Note: `*` works in v1 for backwards compatibility but will be removed in v2. Always use `_splat`.\n\n### 3. MEDIUM: Using curly braces for basic dynamic segments\n\nCurly braces are ONLY for prefix/suffix patterns and optional params. Basic dynamic segments use bare `$`.\n\n```tsx\n// WRONG — braces not needed for basic params\ncreateFileRoute('/posts/{$postId}')\n\n// CORRECT — bare $ for basic dynamic segments\ncreateFileRoute('/posts/$postId')\n\n// CORRECT — braces for prefix pattern\ncreateFileRoute('/posts/post-{$postId}')\n\n// CORRECT — braces for optional param\ncreateFileRoute('/posts/{-$category}')\n```\n\n### 4. Params are always strings\n\nPath params are always parsed as strings. If you need a number, parse in the loader or component:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const id = parseInt(params.postId, 10)\n    if (isNaN(id)) throw notFound()\n    return fetchPost(id)\n  },\n})\n```\n\nYou can also use `params.parse` and `params.stringify` on the route for bidirectional transformation:\n\n```tsx\nexport const Route = createFileRoute('/posts/$postId')({\n  params: {\n    parse: (raw) => ({ postId: parseInt(raw.postId, 10) }),\n    stringify: (parsed) => ({ postId: String(parsed.postId) }),\n  },\n  loader: async ({ params }) => {\n    // params.postId is now number\n    return fetchPost(params.postId)\n  },\n})\n```\n"
  },
  {
    "path": "packages/router-core/skills/router-core/search-params/SKILL.md",
    "content": "---\nname: router-core/search-params\ndescription: >-\n  validateSearch, search param validation with Zod/Valibot/ArkType adapters,\n  fallback(), search middlewares (retainSearchParams, stripSearchParams),\n  custom serialization (parseSearch, stringifySearch), search param\n  inheritance, loaderDeps for cache keys, reading and writing search params.\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\nsources:\n  - TanStack/router:docs/router/guide/search-params.md\n  - TanStack/router:docs/router/how-to/setup-basic-search-params.md\n  - TanStack/router:docs/router/how-to/validate-search-params.md\n  - TanStack/router:docs/router/how-to/navigate-with-search-params.md\n  - TanStack/router:docs/router/how-to/share-search-params-across-routes.md\n  - TanStack/router:docs/router/guide/custom-search-param-serialization.md\n---\n\n# Search Params\n\nTanStack Router treats search params as JSON-first application state. They are automatically parsed from the URL into structured objects (numbers, booleans, arrays, nested objects) and validated via `validateSearch` on each route.\n\n> **CRITICAL**: When using `zodValidator()` and Zod v3, use `fallback()` from `@tanstack/zod-adapter`, NOT zod's `.catch()`. Using `.catch()` with the zod adapter makes the output type `unknown`, destroying type safety. This does not apply to Valibot or ArkType (which use their own fallback mechanisms). It also does not apply to Zod v4, which should use `.catch()` and not use the `zodValidator()`.\n> **CRITICAL**: Types are fully inferred. Never annotate the return of `useSearch()`.\n\n## Setup: Zod Adapter (Recommended)\n\n```bash\nnpm install zod @tanstack/zod-adapter\n```\n\n```tsx\n// src/routes/products.tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst productSearchSchema = z.object({\n  page: z.number().default(1).catch(1),\n  filter: z.string().default(''),\n  sort: z.enum(['newest', 'oldest', 'price']).default('newest').catch('newest'),\n})\n\nexport const Route = createFileRoute('/products')({\n  validateSearch: productSearchSchema,\n  component: ProductsPage,\n})\n\nfunction ProductsPage() {\n  // page: number, filter: string, sort: 'newest' | 'oldest' | 'price'\n  // ALL INFERRED — do not annotate\n  const { page, filter, sort } = Route.useSearch()\n\n  return (\n    <div>\n      <p>\n        Page {page}, filter: {filter}, sort: {sort}\n      </p>\n    </div>\n  )\n}\n```\n\n## Reading Search Params\n\n### In Route Components: `Route.useSearch()`\n\n```tsx\nfunction ProductsPage() {\n  const { page, sort } = Route.useSearch()\n  return <div>Page {page}</div>\n}\n```\n\n### In Code-Split Components: `getRouteApi()`\n\n```tsx\nimport { getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/products')\n\nfunction ProductFilters() {\n  const { sort } = routeApi.useSearch()\n  return <select value={sort}>{/* options */}</select>\n}\n```\n\n### From Any Component: `useSearch({ from })`\n\n```tsx\nimport { useSearch } from '@tanstack/react-router'\n\nfunction SortIndicator() {\n  const { sort } = useSearch({ from: '/products' })\n  return <span>Sorted by: {sort}</span>\n}\n```\n\n### Loose Access: `useSearch({ strict: false })`\n\n```tsx\nfunction GenericPaginator() {\n  const search = useSearch({ strict: false })\n  // search.page is number | undefined (union of all routes)\n  return <span>Page: {search.page ?? 1}</span>\n}\n```\n\n## Writing Search Params\n\n### Link with Function Form (Preserves Existing Params)\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\nfunction Pagination() {\n  return (\n    <Link\n      from=\"/products\"\n      search={(prev) => ({ ...prev, page: prev.page + 1 })}\n    >\n      Next Page\n    </Link>\n  )\n}\n```\n\n### Link with Object Form (Replaces All Params)\n\n```tsx\n<Link to=\"/products\" search={{ page: 1, filter: '', sort: 'newest' }}>\n  Reset\n</Link>\n```\n\n### Programmatic: `useNavigate()`\n\n```tsx\nimport { useNavigate } from '@tanstack/react-router'\n\nfunction SortDropdown() {\n  const navigate = useNavigate({ from: '/products' })\n\n  return (\n    <select\n      onChange={(e) => {\n        navigate({\n          search: (prev) => ({ ...prev, sort: e.target.value, page: 1 }),\n        })\n      }}\n    >\n      <option value=\"newest\">Newest</option>\n      <option value=\"price\">Price</option>\n    </select>\n  )\n}\n```\n\n## Search Param Inheritance\n\nParent route search params are automatically merged into child routes:\n\n```tsx\n// src/routes/shop.tsx — parent defines shared params\nimport { createFileRoute } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst shopSearchSchema = z.object({\n  currency: z.enum(['USD', 'EUR']).default('USD').catch('USD'),\n})\n\nexport const Route = createFileRoute('/shop')({\n  validateSearch: shopSearchSchema,\n})\n```\n\n```tsx\n// src/routes/shop/products.tsx — child inherits currency\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/shop/products')({\n  component: ShopProducts,\n})\n\nfunction ShopProducts() {\n  // currency is available here from parent — fully typed\n  const { currency } = Route.useSearch()\n  return <div>Currency: {currency}</div>\n}\n```\n\n## Search Middlewares\n\n### `retainSearchParams` — Keep Params Across Navigation\n\n```tsx\nimport { createRootRoute, retainSearchParams } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst rootSearchSchema = z.object({\n  debug: z.boolean().optional(),\n})\n\nexport const Route = createRootRoute({\n  validateSearch: rootSearchSchema,\n  search: {\n    middlewares: [retainSearchParams(['debug'])],\n  },\n})\n```\n\n### `stripSearchParams` — Remove Default Values from URL\n\n```tsx\nimport { createFileRoute, stripSearchParams } from '@tanstack/react-router'\nimport { z } from 'zod'\n\nconst defaults = { sort: 'newest', page: 1 }\n\nconst searchSchema = z.object({\n  sort: z.string().default(defaults.sort),\n  page: z.number().default(defaults.page),\n})\n\nexport const Route = createFileRoute('/items')({\n  validateSearch: searchSchema,\n  search: {\n    middlewares: [stripSearchParams(defaults)],\n  },\n})\n```\n\n### Chaining Middlewares\n\n```tsx\nexport const Route = createFileRoute('/search')({\n  validateSearch: z.object({\n    retainMe: z.string().optional(),\n    arrayWithDefaults: z.string().array().default(['foo', 'bar']),\n    required: z.string(),\n  }),\n  search: {\n    middlewares: [\n      retainSearchParams(['retainMe']),\n      stripSearchParams({ arrayWithDefaults: ['foo', 'bar'] }),\n    ],\n  },\n})\n```\n\n## Custom Serialization\n\nOverride the default JSON serialization at the router level:\n\n```tsx\nimport {\n  createRouter,\n  parseSearchWith,\n  stringifySearchWith,\n} from '@tanstack/react-router'\n\nconst router = createRouter({\n  routeTree,\n  // Example: use JSURL2 for compact, human-readable URLs\n  parseSearch: parseSearchWith(parse),\n  stringifySearch: stringifySearchWith(stringify),\n})\n```\n\n## Using Search Params in Loaders via `loaderDeps`\n\n```tsx\nexport const Route = createFileRoute('/products')({\n  validateSearch: productSearchSchema,\n  // Pick ONLY the params the loader needs — not the entire search object\n  loaderDeps: ({ search }) => ({ page: search.page }),\n  loader: async ({ deps }) => {\n    return fetchProducts({ page: deps.page })\n  },\n})\n```\n\n## Common Mistakes\n\n### 1. HIGH: Using zod v3's `.catch()` with `zodValidator()` instead of adapter `fallback()`\n\n```tsx\n// WRONG — .catch() with zodValidator makes the type unknown\nconst schema = z.object({ page: z.number().catch(1) })\nvalidateSearch: zodValidator(schema) // page is typed as unknown!\n\n// CORRECT — fallback() preserves the inferred type\nimport { fallback } from '@tanstack/zod-adapter'\nconst schema = z.object({ page: fallback(z.number(), 1) })\n```\n\n**Important:** This only applies when using Zod v3, not when using Zod v4. For v4, using `.catch()` is correct.\n\n### 2. HIGH: Returning entire search object from `loaderDeps`\n\n```tsx\n// WRONG — loader re-runs on ANY search param change\nloaderDeps: ({ search }) => search\n\n// CORRECT — loader only re-runs when page changes\nloaderDeps: ({ search }) => ({ page: search.page })\n```\n\n### 3. HIGH: Passing Date objects in search params\n\n```tsx\n// WRONG — Date does not serialize correctly to JSON in URLs\n<Link search={{ startDate: new Date() }}>\n\n// CORRECT — convert to ISO string\n<Link search={{ startDate: new Date().toISOString() }}>\n```\n\n### 4. MEDIUM: Parent route missing `validateSearch` blocks inheritance\n\n```tsx\n// WRONG — child cannot access shared params\nexport const Route = createRootRoute({\n  component: RootComponent,\n  // no validateSearch!\n})\n\n// CORRECT — parent must define validateSearch for children to inherit\nexport const Route = createRootRoute({\n  validateSearch: globalSearchSchema,\n  component: RootComponent,\n})\n```\n\n### 5. HIGH (cross-skill): Using search as object instead of function loses params\n\n```tsx\n// WRONG — replaces ALL search params, losing any existing ones\n<Link to=\".\" search={{ page: 2 }}>Page 2</Link>\n\n// CORRECT — preserves existing params, updates only page\n<Link to=\".\" search={(prev) => ({ ...prev, page: 2 })}>Page 2</Link>\n```\n\n## References\n\n- [Validation Patterns Reference](./references/validation-patterns.md) — comprehensive patterns for all validation libraries\n"
  },
  {
    "path": "packages/router-core/skills/router-core/search-params/references/validation-patterns.md",
    "content": "# Search Param Validation Patterns Reference\n\nComprehensive validation patterns for TanStack Router search params across all supported validation approaches.\n\n## Zod with `@tanstack/zod-adapter`\n\nZod v3 does not implement Standard Schema, so the `@tanstack/zod-adapter` wrapper is required. Always use `fallback()` from the adapter instead of zod's `.catch()`. Always wrap with `zodValidator()`.\n\n### Basic Types\n\n```tsx\nimport { zodValidator, fallback } from '@tanstack/zod-adapter'\nimport { z } from 'zod'\n\nconst schema = z.object({\n  count: fallback(z.number(), 0),\n  name: fallback(z.string(), ''),\n  active: fallback(z.boolean(), true),\n})\n\nexport const Route = createFileRoute('/example')({\n  validateSearch: zodValidator(schema),\n})\n```\n\n### Optional Params\n\n```tsx\nconst schema = z.object({\n  // Truly optional — can be undefined in component\n  searchTerm: z.string().optional(),\n  // Optional in URL but always has a value in component\n  page: fallback(z.number(), 1).default(1),\n})\n```\n\n### Default Values\n\n```tsx\nconst schema = z.object({\n  // .default() means the param is optional during navigation\n  // but always present (with default) when reading\n  page: fallback(z.number(), 1).default(1),\n  sort: fallback(z.enum(['name', 'date', 'price']), 'name').default('name'),\n  ascending: fallback(z.boolean(), true).default(true),\n})\n```\n\n### Array Params\n\n```tsx\nconst schema = z.object({\n  tags: fallback(z.string().array(), []).default([]),\n  selectedIds: fallback(z.number().array(), []).default([]),\n})\n\n// URL: /items?tags=%5B%22react%22%2C%22typescript%22%5D&selectedIds=%5B1%2C2%2C3%5D\n// Parsed: { tags: ['react', 'typescript'], selectedIds: [1, 2, 3] }\n```\n\n### Nested Object Params\n\n```tsx\nconst schema = z.object({\n  filters: fallback(\n    z.object({\n      status: z.enum(['active', 'inactive']).optional(),\n      tags: z.string().array().optional(),\n      priceRange: z\n        .object({\n          min: z.number().min(0),\n          max: z.number().min(0),\n        })\n        .optional(),\n    }),\n    {},\n  ).default({}),\n})\n```\n\n### Enum with Constraints\n\n```tsx\nconst schema = z.object({\n  sort: fallback(z.enum(['newest', 'oldest', 'price']), 'newest').default(\n    'newest',\n  ),\n  page: fallback(z.number().int().min(1).max(1000), 1).default(1),\n  limit: fallback(z.number().int().min(10).max(100), 20).default(20),\n})\n```\n\n### Discriminated Union\n\n```tsx\nconst schema = z.object({\n  searchType: fallback(z.enum(['basic', 'advanced']), 'basic').default('basic'),\n  query: fallback(z.string(), '').default(''),\n  // Advanced-only fields are optional\n  category: z.string().optional(),\n  minPrice: z.number().optional(),\n  maxPrice: z.number().optional(),\n})\n```\n\nFor true discriminated union validation:\n\n```tsx\nconst basicSearch = z.object({\n  searchType: z.literal('basic'),\n  query: z.string(),\n})\n\nconst advancedSearch = z.object({\n  searchType: z.literal('advanced'),\n  query: z.string(),\n  category: z.string(),\n  minPrice: z.number(),\n  maxPrice: z.number(),\n})\n\nconst schema = z.discriminatedUnion('searchType', [basicSearch, advancedSearch])\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: zodValidator(schema),\n})\n```\n\n### Input Transforms (String to Number)\n\nWhen using the zod adapter with transforms, configure `input` and `output` types:\n\n```tsx\nconst schema = z.object({\n  page: fallback(z.number(), 1).default(1),\n  filter: fallback(z.string(), '').default(''),\n})\n\nexport const Route = createFileRoute('/items')({\n  // Default: input type used for navigation, output type used for reading\n  validateSearch: zodValidator(schema),\n\n  // Advanced: swap input/output inference\n  // validateSearch: zodValidator({ schema, input: 'output', output: 'input' }),\n})\n```\n\n### Schema Composition\n\n```tsx\nconst paginationSchema = z.object({\n  page: fallback(z.number().int().positive(), 1).default(1),\n  limit: fallback(z.number().int().min(1).max(100), 20).default(20),\n})\n\nconst sortSchema = z.object({\n  sortBy: z.enum(['name', 'date', 'relevance']).optional(),\n  sortOrder: z.enum(['asc', 'desc']).optional(),\n})\n\n// Compose for specific routes\nconst productSearchSchema = paginationSchema.extend({\n  category: z.string().optional(),\n  inStock: fallback(z.boolean(), true).default(true),\n})\n\nconst userSearchSchema = paginationSchema.merge(sortSchema).extend({\n  role: z.enum(['admin', 'user']).optional(),\n})\n```\n\n---\n\n## Valibot (Standard Schema)\n\nValibot 1.0+ implements Standard Schema. No adapter wrapper needed — pass the schema directly to `validateSearch`. The `@tanstack/valibot-adapter` is optional and only needed for explicit input/output type control.\n\n```bash\nnpm install valibot\n```\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport * as v from 'valibot'\n\nconst productSearchSchema = v.object({\n  page: v.optional(v.fallback(v.number(), 1), 1),\n  filter: v.optional(v.fallback(v.string(), ''), ''),\n  sort: v.optional(\n    v.fallback(v.picklist(['newest', 'oldest', 'price']), 'newest'),\n    'newest',\n  ),\n})\n\nexport const Route = createFileRoute('/products')({\n  // Pass schema directly — Standard Schema compliant\n  validateSearch: productSearchSchema,\n  component: ProductsPage,\n})\n\nfunction ProductsPage() {\n  const { page, filter, sort } = Route.useSearch()\n  return <div>Page {page}</div>\n}\n```\n\n### Valibot with Constraints\n\n```tsx\nimport * as v from 'valibot'\n\nconst schema = v.object({\n  page: v.optional(\n    v.fallback(v.pipe(v.number(), v.integer(), v.minValue(1)), 1),\n    1,\n  ),\n  query: v.optional(v.pipe(v.string(), v.minLength(1), v.maxLength(100))),\n  tags: v.optional(v.fallback(v.array(v.string()), []), []),\n})\n```\n\n### Valibot with Adapter (Alternative)\n\nIf you need explicit input/output type control:\n\n```tsx\nimport { valibotValidator } from '@tanstack/valibot-adapter'\nimport * as v from 'valibot'\n\nconst schema = v.object({\n  page: v.optional(v.fallback(v.number(), 1), 1),\n})\n\nexport const Route = createFileRoute('/items')({\n  validateSearch: valibotValidator(schema),\n})\n```\n\n---\n\n## ArkType (Standard Schema)\n\nArkType 2.0-rc+ implements Standard Schema. No adapter needed — pass the type directly to `validateSearch`. The `@tanstack/arktype-adapter` is optional and only needed for explicit input/output type control.\n\n```bash\nnpm install arktype\n```\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\nimport { type } from 'arktype'\n\nconst productSearchSchema = type({\n  page: 'number = 1',\n  filter: 'string = \"\"',\n  sort: '\"newest\" | \"oldest\" | \"price\" = \"newest\"',\n})\n\nexport const Route = createFileRoute('/products')({\n  // Pass directly — Standard Schema compliant\n  validateSearch: productSearchSchema,\n  component: ProductsPage,\n})\n\nfunction ProductsPage() {\n  const { page, filter, sort } = Route.useSearch()\n  return <div>Page {page}</div>\n}\n```\n\n### ArkType with Constraints\n\n```tsx\nimport { type } from 'arktype'\n\nconst searchSchema = type({\n  'query?': 'string>0&<=100',\n  page: 'number>0 = 1',\n  'sortBy?': \"'name'|'date'|'relevance'\",\n  'filters?': 'string[]',\n})\n```\n\n---\n\n## Manual Validation Function\n\nFor full control without any library. The function receives raw JSON-parsed (but unvalidated) search params.\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\ntype ProductSearch = {\n  page: number\n  filter: string\n  sort: 'newest' | 'oldest' | 'price'\n}\n\nexport const Route = createFileRoute('/products')({\n  validateSearch: (search: Record<string, unknown>): ProductSearch => ({\n    page: Number(search?.page ?? 1),\n    filter: (search.filter as string) || '',\n    sort:\n      search.sort === 'newest' ||\n      search.sort === 'oldest' ||\n      search.sort === 'price'\n        ? search.sort\n        : 'newest',\n  }),\n  component: ProductsPage,\n})\n\nfunction ProductsPage() {\n  const { page, filter, sort } = Route.useSearch()\n  return <div>Page {page}</div>\n}\n```\n\n### Manual Validation with Error Throwing\n\nIf `validateSearch` throws, the route's `errorComponent` renders instead:\n\n```tsx\nexport const Route = createFileRoute('/products')({\n  validateSearch: (search: Record<string, unknown>) => {\n    const page = Number(search.page)\n    if (isNaN(page) || page < 1) {\n      throw new Error('Invalid page number')\n    }\n    return { page }\n  },\n  errorComponent: ({ error }) => <div>Bad search params: {error.message}</div>,\n})\n```\n\n---\n\n## Pattern: Object with `parse` Method\n\nAny object with a `.parse()` method works as `validateSearch`:\n\n```tsx\nconst mySchema = {\n  parse: (input: Record<string, unknown>) => ({\n    page: Number(input.page ?? 1),\n    query: String(input.query ?? ''),\n  }),\n}\n\nexport const Route = createFileRoute('/search')({\n  validateSearch: mySchema,\n})\n```\n\n---\n\n## Dates in Search Params\n\nNever put `Date` objects in search params. Always use ISO strings:\n\n```tsx\nconst schema = z.object({\n  // Store as string, parse in component if needed\n  startDate: z.string().optional(),\n  endDate: z.string().optional(),\n})\n\n// In component:\nfunction DateFilter() {\n  const { startDate } = Route.useSearch()\n  const date = startDate ? new Date(startDate) : null\n  return <div>{date?.toLocaleDateString()}</div>\n}\n\n// When navigating:\n;<Link search={(prev) => ({ ...prev, startDate: new Date().toISOString() })}>\n  Set Start Date\n</Link>\n```\n"
  },
  {
    "path": "packages/router-core/skills/router-core/ssr/SKILL.md",
    "content": "---\nname: router-core/ssr\ndescription: >-\n  Non-streaming and streaming SSR, RouterClient/RouterServer,\n  renderRouterToString/renderRouterToStream, createRequestHandler,\n  defaultRenderHandler/defaultStreamHandler, HeadContent/Scripts\n  components, head route option (meta/links/styles/scripts),\n  ScriptOnce, automatic loader dehydration/hydration, memory\n  history on server, data serialization, document head management.\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\n  - router-core/data-loading\nsources:\n  - TanStack/router:docs/router/guide/ssr.md\n  - TanStack/router:docs/router/guide/document-head-management.md\n  - TanStack/router:docs/router/how-to/setup-ssr.md\n---\n\n# SSR (Server-Side Rendering)\n\n> **WARNING**: SSR APIs are experimental. They share internal implementations with TanStack Start and may change. **TanStack Start is the recommended way to do SSR in production** — use manual SSR setup only when integrating with an existing server.\n\n> **CRITICAL**: TanStack Router is CLIENT-FIRST. Loaders run on the client by default. With SSR enabled, loaders run on BOTH client AND server. They are NOT server-only like Remix/Next.js loaders. See [router-core/data-loading](../data-loading/SKILL.md).\n\n> **CRITICAL**: Do not generate Next.js patterns (`getServerSideProps`, App Router, server components) or Remix patterns (server-only loader exports). TanStack Router has its own SSR API.\n\n## Concepts\n\nThere are two SSR flavors:\n\n- **Non-streaming**: Full page rendered on server, sent as one HTML response, then hydrated on client.\n- **Streaming**: Critical first paint sent immediately; remaining content streamed incrementally as it resolves.\n\nKey behaviors:\n\n- Memory history is used automatically on the server (no `window`).\n- Loader data is automatically dehydrated on the server and hydrated on the client.\n- Data serialization supports `Date`, `Error`, `FormData`, and `undefined` out of the box.\n\n## Setup: Shared Router Factory\n\nThe router must be created identically on server and client. Export a factory function from a shared file:\n\n```tsx\n// src/router.tsx\nimport { createRouter as createTanstackRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nexport function createRouter() {\n  return createTanstackRouter({ routeTree })\n}\n\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: ReturnType<typeof createRouter>\n  }\n}\n```\n\n## Non-Streaming SSR\n\n### Server Entry (using `defaultRenderHandler`)\n\n```tsx\n// src/entry-server.tsx\nimport {\n  createRequestHandler,\n  defaultRenderHandler,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport async function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n  return await handler(defaultRenderHandler)\n}\n```\n\n### Server Entry (using `renderRouterToString` for custom wrappers)\n\n```tsx\n// src/entry-server.tsx\nimport {\n  createRequestHandler,\n  renderRouterToString,\n  RouterServer,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return handler(({ responseHeaders, router }) =>\n    renderRouterToString({\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n}\n```\n\n### Client Entry\n\n```tsx\n// src/entry-client.tsx\nimport { hydrateRoot } from 'react-dom/client'\nimport { RouterClient } from '@tanstack/react-router/ssr/client'\nimport { createRouter } from './router'\n\nconst router = createRouter()\n\nhydrateRoot(document, <RouterClient router={router} />)\n```\n\n## Streaming SSR\n\n### Server Entry (using `defaultStreamHandler`)\n\n```tsx\n// src/entry-server.tsx\nimport {\n  createRequestHandler,\n  defaultStreamHandler,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport async function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n  return await handler(defaultStreamHandler)\n}\n```\n\n### Server Entry (using `renderRouterToStream` for custom wrappers)\n\n```tsx\n// src/entry-server.tsx\nimport {\n  createRequestHandler,\n  renderRouterToStream,\n  RouterServer,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\n\nexport function render({ request }: { request: Request }) {\n  const handler = createRequestHandler({ request, createRouter })\n\n  return handler(({ request, responseHeaders, router }) =>\n    renderRouterToStream({\n      request,\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n}\n```\n\nStreaming is automatic — deferred data (unawaited promises from loaders) and streamed markup just work when using `defaultStreamHandler` or `renderRouterToStream`.\n\n## Document Head Management\n\nUse the `head` route option to manage `<title>`, `<meta>`, `<link>`, and `<style>` tags. Render `<HeadContent />` in `<head>` and `<Scripts />` in `<body>`.\n\n### Root Route with Head\n\n```tsx\n// src/routes/__root.tsx\nimport {\n  createRootRoute,\n  HeadContent,\n  Outlet,\n  Scripts,\n} from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  head: () => ({\n    meta: [\n      { charSet: 'UTF-8' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1.0' },\n      { title: 'My App' },\n    ],\n    links: [{ rel: 'icon', href: '/favicon.ico' }],\n  }),\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <html lang=\"en\">\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        <Outlet />\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n### Per-Route Head (Nested Deduplication)\n\nChild route `title` and `meta` tags override parent tags with the same `name`/`property`:\n\n```tsx\n// src/routes/posts/$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ params }) => {\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  head: ({ loaderData }) => ({\n    meta: [\n      { title: loaderData.post.title },\n      { name: 'description', content: loaderData.post.excerpt },\n    ],\n  }),\n  component: PostPage,\n})\n\nfunction PostPage() {\n  const { post } = Route.useLoaderData()\n  return <article>{post.content}</article>\n}\n```\n\n### SPA Head (No Full HTML Control)\n\nFor SPAs without server-rendered HTML, render `<HeadContent />` at the top of the component tree:\n\n```tsx\nimport { createRootRoute, HeadContent, Outlet } from '@tanstack/react-router'\n\nconst rootRoute = createRootRoute({\n  head: () => ({\n    meta: [{ title: 'My SPA' }],\n  }),\n  component: () => (\n    <>\n      <HeadContent />\n      <Outlet />\n    </>\n  ),\n})\n```\n\n## Body Scripts\n\nUse `scripts` (separate from `head.scripts`) to inject scripts into `<body>` before the app entry point:\n\n```tsx\nexport const Route = createRootRoute({\n  scripts: () => [{ children: 'console.log(\"runs before hydration\")' }],\n})\n```\n\nThe `<Scripts />` component renders these. Place it at the end of `<body>`.\n\n## ScriptOnce for Pre-Hydration Scripts\n\n`ScriptOnce` renders a `<script>` during SSR that executes immediately and self-removes. On client navigation, it does nothing (no duplicate execution).\n\n```tsx\nimport { ScriptOnce } from '@tanstack/react-router'\n\nconst themeScript = `(function() {\n  try {\n    const theme = localStorage.getItem('theme') || 'auto';\n    const resolved = theme === 'auto'\n      ? (matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')\n      : theme;\n    document.documentElement.classList.add(resolved);\n  } catch (e) {}\n})();`\n\nfunction ThemeProvider({ children }: { children: React.ReactNode }) {\n  return (\n    <>\n      <ScriptOnce children={themeScript} />\n      {children}\n    </>\n  )\n}\n```\n\nIf the script modifies the DOM (e.g., adds a class to `<html>`), use `suppressHydrationWarning` on the element:\n\n```tsx\n<html lang=\"en\" suppressHydrationWarning>\n```\n\n## Express Integration Example\n\n`createRequestHandler` expects a Web API `Request` and returns a Web API `Response`. For Express, convert between formats:\n\n```tsx\n// src/entry-server.tsx\nimport { pipeline } from 'node:stream/promises'\nimport {\n  RouterServer,\n  createRequestHandler,\n  renderRouterToString,\n} from '@tanstack/react-router/ssr/server'\nimport { createRouter } from './router'\nimport type express from 'express'\n\nexport async function render({\n  req,\n  res,\n}: {\n  req: express.Request\n  res: express.Response\n}) {\n  const protocol = req.get('x-forwarded-proto') ?? req.protocol\n  const host = req.get('x-forwarded-host') ?? req.get('host')\n  const url = new URL(req.originalUrl || req.url, `${protocol}://${host}`).href\n\n  const request = new Request(url, {\n    method: req.method,\n    headers: (() => {\n      const headers = new Headers()\n      for (const [key, value] of Object.entries(req.headers)) {\n        headers.set(key, value as any)\n      }\n      return headers\n    })(),\n  })\n\n  const handler = createRequestHandler({ request, createRouter })\n\n  const response = await handler(({ responseHeaders, router }) =>\n    renderRouterToString({\n      responseHeaders,\n      router,\n      children: <RouterServer router={router} />,\n    }),\n  )\n\n  res.status(response.status)\n  response.headers.forEach((value, name) => {\n    res.setHeader(name, value)\n  })\n\n  return pipeline(response.body as any, res)\n}\n```\n\n## Common Mistakes\n\n### 1. HIGH: Using browser APIs in loaders without environment check\n\nLoaders run on BOTH client and server with SSR. Browser-only APIs (`window`, `document`, `localStorage`) throw on the server.\n\n```tsx\n// WRONG — crashes on server\nloader: async () => {\n  const token = localStorage.getItem('token')\n  return fetchData(token)\n}\n\n// CORRECT — guard with environment check\nloader: async () => {\n  const token =\n    typeof window !== 'undefined' ? localStorage.getItem('token') : null\n  return fetchData(token)\n}\n```\n\n### 2. MEDIUM: Using hash fragments for server-rendered content\n\nHash fragments (`#section`) are never sent to the server. Conditional rendering based on hash causes hydration mismatches.\n\n```tsx\n// WRONG — server has no hash, client does → mismatch\ncomponent: () => {\n  const hash = window.location.hash\n  return hash === '#admin' ? <AdminPanel /> : <UserPanel />\n}\n\n// CORRECT — use search params for server-visible state\nvalidateSearch: z.object({ view: fallback(z.enum(['admin', 'user']), 'user') }),\ncomponent: () => {\n  const { view } = Route.useSearch()\n  return view === 'admin' ? <AdminPanel /> : <UserPanel />\n}\n```\n\n### 3. CRITICAL: Generating Next.js or Remix SSR patterns\n\nTanStack Router does NOT use `getServerSideProps`, `getStaticProps`, App Router `page.tsx`, or Remix-style server-only `loader` exports.\n\n```tsx\n// WRONG — Next.js patterns\nexport async function getServerSideProps() {\n  return { props: { data: await fetchData() } }\n}\n\n// WRONG — Remix patterns\nexport async function loader({ request }: LoaderFunctionArgs) {\n  return json({ data: await fetchData() })\n}\n\n// CORRECT — TanStack Router pattern\nexport const Route = createFileRoute('/data')({\n  loader: async () => {\n    const data = await fetchData()\n    return { data }\n  },\n  component: DataPage,\n})\n\nfunction DataPage() {\n  const { data } = Route.useLoaderData()\n  return <div>{data}</div>\n}\n```\n\n## Tension: Client-First Loaders vs SSR\n\nTanStack Router loaders are client-first by design. When SSR is enabled, they run in both environments. This means:\n\n- Browser APIs work by default (client-only) but break under SSR\n- Database access does NOT belong in loaders (unlike Remix/Next) — use API routes\n- For server-only data logic with SSR, use TanStack Start's server functions\n\nSee [router-core/data-loading](../data-loading/SKILL.md) for loader fundamentals.\n\n## Cross-References\n\n- [router-core/data-loading](../data-loading/SKILL.md) — SSR changes where loaders execute\n- [compositions/router-query](../../../../react-router/skills/compositions/router-query/SKILL.md) — SSR dehydration/hydration with TanStack Query\n"
  },
  {
    "path": "packages/router-core/skills/router-core/type-safety/SKILL.md",
    "content": "---\nname: router-core/type-safety\ndescription: >-\n  Full type inference philosophy (never cast, never annotate inferred\n  values), Register module declaration, from narrowing on hooks and\n  Link, strict:false for shared components, getRouteApi for code-split\n  typed access, addChildren with object syntax for TS perf, LinkProps\n  and ValidateLinkOptions type utilities, as const satisfies pattern.\ntype: sub-skill\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nrequires:\n  - router-core\nsources:\n  - TanStack/router:docs/router/guide/type-safety.md\n  - TanStack/router:docs/router/guide/type-utilities.md\n  - TanStack/router:docs/router/guide/render-optimizations.md\n---\n\n# Type Safety\n\nTanStack Router is FULLY type-inferred. Params, search params, context, and loader data all flow through the route tree automatically. The **#1 AI agent mistake** is adding type annotations, casts, or generic parameters to values that are already inferred.\n\n> **CRITICAL**: NEVER use `as Type`, explicit generic params, `satisfies` on hook returns, or type annotations on inferred values. Every cast masks real type errors and breaks the inference chain.\n> **CRITICAL**: Do NOT confuse TanStack Router with Next.js or React Router. There is no `getServerSideProps`, no `useSearchParams()`, no `useLoaderData()` from `react-router-dom`.\n\n## The ONE Required Type Annotation: Register\n\nWithout this, top-level exports like `Link`, `useNavigate`, `useSearch` have no type safety.\n\n```tsx\n// src/router.tsx\nimport { createRouter } from '@tanstack/react-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\n// THIS IS REQUIRED — the single type registration for the entire app\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nexport default router\n```\n\nAfter registration, every `Link`, `useNavigate`, `useSearch`, `useParams` across the app is fully typed.\n\n## Types Flow Automatically\n\n### Route Hooks — No Annotation Needed\n\n```tsx\n// src/routes/posts.$postId.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  validateSearch: (search: Record<string, unknown>) => ({\n    page: Number(search.page ?? 1),\n  }),\n  loader: async ({ params }) => {\n    // params.postId is already typed as string — do not annotate\n    const post = await fetchPost(params.postId)\n    return { post }\n  },\n  component: PostComponent,\n})\n\nfunction PostComponent() {\n  // ALL of these are fully inferred — do NOT add type annotations\n  const { postId } = Route.useParams()\n  //      ^? string\n\n  const { page } = Route.useSearch()\n  //      ^? number\n\n  const { post } = Route.useLoaderData()\n  //      ^? { id: string; title: string; body: string }\n\n  return (\n    <div>\n      <h1>{post.title}</h1>\n      <p>Page {page}</p>\n    </div>\n  )\n}\n```\n\n### Context Flows Through the Tree\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRouteWithContext, Outlet } from '@tanstack/react-router'\n\ninterface RouterContext {\n  auth: { userId: string; role: 'admin' | 'user' } | null\n}\n\n// Note: createRootRouteWithContext is a FACTORY — call it TWICE: ()()\nexport const Route = createRootRouteWithContext<RouterContext>()({\n  component: () => <Outlet />,\n})\n```\n\n```tsx\n// src/routes/dashboard.tsx\nimport { createFileRoute, redirect } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  beforeLoad: ({ context }) => {\n    // context.auth is already typed as { userId: string; role: 'admin' | 'user' } | null\n    // NO annotation needed\n    if (!context.auth) throw redirect({ to: '/login' })\n    return { user: context.auth }\n  },\n  loader: ({ context }) => {\n    // context.user is typed as { userId: string; role: 'admin' | 'user' }\n    // This was added by beforeLoad above — fully inferred\n    return fetchDashboard(context.user.userId)\n  },\n  component: DashboardComponent,\n})\n\nfunction DashboardComponent() {\n  const data = Route.useLoaderData()\n  const { user } = Route.useRouteContext()\n  return <h1>Welcome {user.userId}</h1>\n}\n```\n\n## Narrowing with `from`\n\nWithout `from`, hooks return a union of ALL routes' types — slow for TypeScript and imprecise.\n\n### On Hooks\n\n```tsx\nimport { useSearch, useParams, useNavigate } from '@tanstack/react-router'\n\nfunction PostSidebar() {\n  // WRONG — search is a union of ALL routes' search params\n  const search = useSearch()\n\n  // CORRECT — search is narrowed to /posts/$postId's search params\n  const search = useSearch({ from: '/posts/$postId' })\n  //    ^? { page: number }\n\n  // CORRECT — params narrowed to this route\n  const { postId } = useParams({ from: '/posts/$postId' })\n\n  // CORRECT — navigate narrowed for relative paths\n  const navigate = useNavigate({ from: '/posts/$postId' })\n}\n```\n\n### On `Link`\n\n```tsx\nimport { Link } from '@tanstack/react-router'\n\n// WRONG — search resolves to union of ALL routes' search params, slow TS check\n<Link to=\"..\" search={{ page: 0 }} />\n\n// CORRECT — narrowed, fast TS check\n<Link from=\"/posts/$postId\" to=\"..\" search={{ page: 0 }} />\n\n// Also correct — Route.fullPath in route components\n<Link from={Route.fullPath} to=\"..\" search={{ page: 0 }} />\n```\n\n## Shared Components: `strict: false`\n\nWhen a component is used across multiple routes, use `strict: false` instead of `from`:\n\n```tsx\nimport { useSearch } from '@tanstack/react-router'\n\nfunction GlobalSearch() {\n  // Returns union of all routes' search params — no runtime error if route doesn't match\n  const search = useSearch({ strict: false })\n  return <span>Query: {search.q ?? ''}</span>\n}\n```\n\n## Code-Split Files: `getRouteApi`\n\nUse `getRouteApi` instead of importing `Route` to avoid pulling route config into the lazy chunk:\n\n```tsx\n// src/routes/posts.lazy.tsx\nimport { createLazyFileRoute, getRouteApi } from '@tanstack/react-router'\n\nconst routeApi = getRouteApi('/posts')\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const data = routeApi.useLoaderData()\n  const { page } = routeApi.useSearch()\n  return <div>Page {page}</div>\n}\n```\n\n## TypeScript Performance\n\n### Use Object Syntax for `addChildren` in Large Route Trees\n\n```tsx\n// SLOWER — tuple syntax\nconst routeTree = rootRoute.addChildren([\n  postsRoute.addChildren([postRoute, postsIndexRoute]),\n  indexRoute,\n])\n\n// FASTER — object syntax (TS checks objects faster than large tuples)\nconst routeTree = rootRoute.addChildren({\n  postsRoute: postsRoute.addChildren({ postRoute, postsIndexRoute }),\n  indexRoute,\n})\n```\n\nWith file-based routing the route tree is generated, so this is handled for you.\n\n### Avoid Returning Unused Inferred Types from Loaders\n\nWhen using external caches like TanStack Query, don't let the router infer complex return types you never consume:\n\n```tsx\n// SLOWER — TS infers the full ensureQueryData return type into the route tree\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: ({ context: { queryClient }, params: { postId } }) =>\n    queryClient.ensureQueryData(postQueryOptions(postId)),\n  component: PostComponent,\n})\n\n// FASTER — void return, inference stays out of the route tree\nexport const Route = createFileRoute('/posts/$postId')({\n  loader: async ({ context: { queryClient }, params: { postId } }) => {\n    await queryClient.ensureQueryData(postQueryOptions(postId))\n  },\n  component: PostComponent,\n})\n```\n\n### `as const satisfies` for Link Option Objects\n\nNever use `LinkProps` as a variable type — it's an enormous union:\n\n```tsx\nimport type { LinkProps, RegisteredRouter } from '@tanstack/react-router'\n\n// WRONG — LinkProps is a massive union, extremely slow TS check\nconst wrongProps: LinkProps = { to: '/posts' }\n\n// CORRECT — infer a precise type, validate against LinkProps\nconst goodProps = { to: '/posts' } as const satisfies LinkProps\n\n// EVEN BETTER — narrow LinkProps with generic params\nconst narrowedProps = {\n  to: '/posts',\n} as const satisfies LinkProps<RegisteredRouter, string, '/posts'>\n```\n\n### Type-Safe Link Option Arrays\n\n```tsx\nimport type { LinkProps } from '@tanstack/react-router'\n\nexport const navLinks = [\n  { to: '/posts' },\n  { to: '/posts/$postId', params: { postId: '1' } },\n] as const satisfies ReadonlyArray<LinkProps>\n\n// Use the precise inferred type, not LinkProps directly\nexport type NavLink = (typeof navLinks)[number]\n```\n\n## Type Utilities for Generic Components\n\n### `ValidateLinkOptions` — Type-Safe Link Props in Custom Components\n\n```tsx\nimport {\n  Link,\n  type RegisteredRouter,\n  type ValidateLinkOptions,\n} from '@tanstack/react-router'\n\ninterface NavItemProps<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions = unknown,\n> {\n  label: string\n  linkOptions: ValidateLinkOptions<TRouter, TOptions>\n}\n\nexport function NavItem<TRouter extends RegisteredRouter, TOptions>(\n  props: NavItemProps<TRouter, TOptions>,\n): React.ReactNode\nexport function NavItem(props: NavItemProps): React.ReactNode {\n  return (\n    <li>\n      <Link {...props.linkOptions}>{props.label}</Link>\n    </li>\n  )\n}\n\n// Usage — fully type-safe\n<NavItem label=\"Posts\" linkOptions={{ to: '/posts' }} />\n<NavItem label=\"Post\" linkOptions={{ to: '/posts/$postId', params: { postId: '1' } }} />\n```\n\n### `ValidateNavigateOptions` — Type-Safe Navigate in Utilities\n\n```tsx\nimport {\n  useNavigate,\n  type RegisteredRouter,\n  type ValidateNavigateOptions,\n} from '@tanstack/react-router'\n\nexport function useDelayedNavigate<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions = unknown,\n>(\n  options: ValidateNavigateOptions<TRouter, TOptions>,\n  delayMs: number,\n): () => void\nexport function useDelayedNavigate(\n  options: ValidateNavigateOptions,\n  delayMs: number,\n): () => void {\n  const navigate = useNavigate()\n  return () => {\n    setTimeout(() => navigate(options), delayMs)\n  }\n}\n\n// Usage — type-safe\nconst go = useDelayedNavigate(\n  { to: '/posts/$postId', params: { postId: '1' } },\n  500,\n)\n```\n\n### `ValidateRedirectOptions` — Type-Safe Redirect in Utilities\n\n```tsx\nimport {\n  redirect,\n  type RegisteredRouter,\n  type ValidateRedirectOptions,\n} from '@tanstack/react-router'\n\nexport async function fetchOrRedirect<\n  TRouter extends RegisteredRouter = RegisteredRouter,\n  TOptions = unknown,\n>(\n  url: string,\n  redirectOptions: ValidateRedirectOptions<TRouter, TOptions>,\n): Promise<unknown>\nexport async function fetchOrRedirect(\n  url: string,\n  redirectOptions: ValidateRedirectOptions,\n): Promise<unknown> {\n  const response = await fetch(url)\n  if (!response.ok && response.status === 401) throw redirect(redirectOptions)\n  return response.json()\n}\n```\n\n### Render Props for Maximum Performance\n\nInstead of accepting `LinkProps`, invert control so `Link` is narrowed at the call site:\n\n```tsx\nfunction Card(props: { title: string; renderLink: () => React.ReactNode }) {\n  return (\n    <div>\n      <h2>{props.title}</h2>\n      {props.renderLink()}\n    </div>\n  )\n}\n\n// Link narrowed to exactly /posts — no union check\n;<Card title=\"All Posts\" renderLink={() => <Link to=\"/posts\">View</Link>} />\n```\n\n## Render Optimizations\n\n### Fine-Grained Selectors with `select`\n\n```tsx\nfunction PostTitle() {\n  // Only re-renders when page changes, not when other search params change\n  const page = Route.useSearch({ select: ({ page }) => page })\n  return <span>Page {page}</span>\n}\n```\n\n### Structural Sharing\n\nPreserve referential identity across re-renders for search params:\n\n```tsx\nconst router = createRouter({\n  routeTree,\n  defaultStructuralSharing: true, // Enable globally\n})\n\n// Or per-hook\nconst result = Route.useSearch({\n  select: (search) => ({ foo: search.foo, label: `Page ${search.foo}` }),\n  structuralSharing: true,\n})\n```\n\nStructural sharing only works with JSON-compatible data. TypeScript will error if you return class instances with `structuralSharing: true`.\n\n## Common Mistakes\n\n### 1. CRITICAL: Adding type annotations or casts to inferred values\n\n```tsx\n// WRONG — casting masks real type errors\nconst search = useSearch({ from: '/posts' }) as { page: number }\n\n// WRONG — unnecessary annotation\nconst params: { postId: string } = useParams({ from: '/posts/$postId' })\n\n// WRONG — generic param on hook\nconst data = useLoaderData<{ posts: Post[] }>({ from: '/posts' })\n\n// CORRECT — let inference work\nconst search = useSearch({ from: '/posts' })\nconst params = useParams({ from: '/posts/$postId' })\nconst data = useLoaderData({ from: '/posts' })\n```\n\n### 2. HIGH: Using un-narrowed `LinkProps` type\n\n```tsx\n// WRONG — LinkProps is a massive union, causes severe TS slowdown\nconst myProps: LinkProps = { to: '/posts' }\n\n// CORRECT — use as const satisfies for precise inference\nconst myProps = { to: '/posts' } as const satisfies LinkProps\n```\n\n### 3. HIGH: Not narrowing `Link`/`useNavigate` with `from`\n\n```tsx\n// WRONG — search is a union of ALL routes, TS check grows with route count\n<Link to=\"..\" search={{ page: 0 }} />\n\n// CORRECT — narrowed, fast check\n<Link from={Route.fullPath} to=\"..\" search={{ page: 0 }} />\n```\n\n### 4. CRITICAL (cross-skill): Missing router type registration\n\n```tsx\n// WRONG — Link/useNavigate have no autocomplete, all paths are untyped strings\nconst router = createRouter({ routeTree })\n// (no declare module)\n\n// CORRECT — always register\nconst router = createRouter({ routeTree })\ndeclare module '@tanstack/react-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n```\n\n### 5. CRITICAL (cross-skill): Generating Next.js or Remix patterns\n\n```tsx\n// WRONG — these are NOT TanStack Router APIs\nexport async function getServerSideProps() { ... }\nexport async function loader({ request }) { ... } // Remix-style\nconst [searchParams, setSearchParams] = useSearchParams() // React Router\n\n// CORRECT — TanStack Router APIs\nexport const Route = createFileRoute('/posts')({\n  loader: async () => { ... },           // TanStack loader\n  validateSearch: zodValidator(schema),   // TanStack search validation\n  component: PostsComponent,\n})\nconst search = Route.useSearch()          // TanStack hook\n```\n\nSee also: router-core (Register setup), router-core/navigation (from narrowing), router-core/code-splitting (getRouteApi).\n"
  },
  {
    "path": "packages/router-core/src/Matches.ts",
    "content": "import type { AnyRoute, StaticDataRouteOption } from './route'\nimport type {\n  AllContext,\n  AllLoaderData,\n  AllParams,\n  FullSearchSchema,\n  ParseRoute,\n  RouteById,\n  RouteIds,\n} from './routeInfo'\nimport type { AnyRouter, RegisteredRouter, SSROption } from './router'\nimport type { Constrain, ControlledPromise } from './utils'\n\nexport type AnyMatchAndValue = { match: any; value: any }\n\nexport type FindValueByIndex<\n  TKey,\n  TValue extends ReadonlyArray<any>,\n> = TKey extends `${infer TIndex extends number}` ? TValue[TIndex] : never\n\nexport type FindValueByKey<TKey, TValue> =\n  TValue extends ReadonlyArray<any>\n    ? FindValueByIndex<TKey, TValue>\n    : TValue[TKey & keyof TValue]\n\nexport type CreateMatchAndValue<TMatch, TValue> = TValue extends any\n  ? {\n      match: TMatch\n      value: TValue\n    }\n  : never\n\nexport type NextMatchAndValue<\n  TKey,\n  TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n  ? CreateMatchAndValue<\n      TMatchAndValue['match'],\n      FindValueByKey<TKey, TMatchAndValue['value']>\n    >\n  : never\n\nexport type IsMatchKeyOf<TValue> =\n  TValue extends ReadonlyArray<any>\n    ? number extends TValue['length']\n      ? `${number}`\n      : keyof TValue & `${number}`\n    : TValue extends object\n      ? keyof TValue & string\n      : never\n\nexport type IsMatchPath<\n  TParentPath extends string,\n  TMatchAndValue extends AnyMatchAndValue,\n> = `${TParentPath}${IsMatchKeyOf<TMatchAndValue['value']>}`\n\nexport type IsMatchResult<\n  TKey,\n  TMatchAndValue extends AnyMatchAndValue,\n> = TMatchAndValue extends any\n  ? TKey extends keyof TMatchAndValue['value']\n    ? TMatchAndValue['match']\n    : never\n  : never\n\nexport type IsMatchParse<\n  TPath,\n  TMatchAndValue extends AnyMatchAndValue,\n  TParentPath extends string = '',\n> = TPath extends `${string}.${string}`\n  ? TPath extends `${infer TFirst}.${infer TRest}`\n    ? IsMatchParse<\n        TRest,\n        NextMatchAndValue<TFirst, TMatchAndValue>,\n        `${TParentPath}${TFirst}.`\n      >\n    : never\n  : {\n      path: IsMatchPath<TParentPath, TMatchAndValue>\n      result: IsMatchResult<TPath, TMatchAndValue>\n    }\n\nexport type IsMatch<TMatch, TPath> = IsMatchParse<\n  TPath,\n  TMatch extends any ? { match: TMatch; value: TMatch } : never\n>\n\n/**\n * Narrows matches based on a path\n * @experimental\n */\nexport const isMatch = <TMatch, TPath extends string>(\n  match: TMatch,\n  path: Constrain<TPath, IsMatch<TMatch, TPath>['path']>,\n): match is IsMatch<TMatch, TPath>['result'] => {\n  const parts = (path as string).split('.')\n  let part\n  let i = 0\n  let value: any = match\n\n  while ((part = parts[i++]) != null && value != null) {\n    value = value[part]\n  }\n\n  return value != null\n}\n\nexport interface DefaultRouteMatchExtensions {\n  scripts?: unknown\n  links?: unknown\n  headScripts?: unknown\n  meta?: unknown\n  styles?: unknown\n}\n\nexport interface RouteMatchExtensions extends DefaultRouteMatchExtensions {}\n\nexport interface RouteMatch<\n  out TRouteId,\n  out TFullPath,\n  out TAllParams,\n  out TFullSearchSchema,\n  out TLoaderData,\n  out TAllContext,\n  out TLoaderDeps,\n> extends RouteMatchExtensions {\n  id: string\n  routeId: TRouteId\n  fullPath: TFullPath\n  index: number\n  pathname: string\n  params: TAllParams\n  _strictParams: TAllParams\n  status: 'pending' | 'success' | 'error' | 'redirected' | 'notFound'\n  isFetching: false | 'beforeLoad' | 'loader'\n  error: unknown\n  paramsError: unknown\n  searchError: unknown\n  updatedAt: number\n  _nonReactive: {\n    /** @internal */\n    beforeLoadPromise?: ControlledPromise<void>\n    /** @internal */\n    loaderPromise?: ControlledPromise<void>\n    /** @internal */\n    pendingTimeout?: ReturnType<typeof setTimeout>\n    loadPromise?: ControlledPromise<void>\n    displayPendingPromise?: Promise<void>\n    minPendingPromise?: ControlledPromise<void>\n    dehydrated?: boolean\n    /** @internal */\n    error?: unknown\n  }\n  loaderData?: TLoaderData\n  /** @internal */\n  __routeContext?: Record<string, unknown>\n  /** @internal */\n  __beforeLoadContext?: Record<string, unknown>\n  context: TAllContext\n  search: TFullSearchSchema\n  _strictSearch: TFullSearchSchema\n  fetchCount: number\n  abortController: AbortController\n  cause: 'preload' | 'enter' | 'stay'\n  loaderDeps: TLoaderDeps\n  preload: boolean\n  invalid: boolean\n  headers?: Record<string, string>\n  globalNotFound?: boolean\n  staticData: StaticDataRouteOption\n  /** This attribute is not reactive */\n  ssr?: SSROption\n  _forcePending?: boolean\n  _displayPending?: boolean\n}\n\nexport interface PreValidationErrorHandlingRouteMatch<\n  TRouteId,\n  TFullPath,\n  TAllParams,\n  TFullSearchSchema,\n> {\n  id: string\n  routeId: TRouteId\n  fullPath: TFullPath\n  index: number\n  pathname: string\n  search:\n    | { status: 'success'; value: TFullSearchSchema }\n    | { status: 'error'; error: unknown }\n  params:\n    | { status: 'success'; value: TAllParams }\n    | { status: 'error'; error: unknown }\n  staticData: StaticDataRouteOption\n  ssr?: boolean | 'data-only'\n}\n\nexport type MakePreValidationErrorHandlingRouteMatchUnion<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n  ? PreValidationErrorHandlingRouteMatch<\n      TRoute['id'],\n      TRoute['fullPath'],\n      TRoute['types']['allParams'],\n      TRoute['types']['fullSearchSchema']\n    >\n  : never\n\nexport type MakeRouteMatchFromRoute<TRoute extends AnyRoute> = RouteMatch<\n  TRoute['types']['id'],\n  TRoute['types']['fullPath'],\n  TRoute['types']['allParams'],\n  TRoute['types']['fullSearchSchema'],\n  TRoute['types']['loaderData'],\n  TRoute['types']['allContext'],\n  TRoute['types']['loaderDeps']\n>\n\nexport type MakeRouteMatch<\n  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n  TRouteId = RouteIds<TRouteTree>,\n  TStrict extends boolean = true,\n> = RouteMatch<\n  TRouteId,\n  RouteById<TRouteTree, TRouteId>['types']['fullPath'],\n  TStrict extends false\n    ? AllParams<TRouteTree>\n    : RouteById<TRouteTree, TRouteId>['types']['allParams'],\n  TStrict extends false\n    ? FullSearchSchema<TRouteTree>\n    : RouteById<TRouteTree, TRouteId>['types']['fullSearchSchema'],\n  TStrict extends false\n    ? AllLoaderData<TRouteTree>\n    : RouteById<TRouteTree, TRouteId>['types']['loaderData'],\n  TStrict extends false\n    ? AllContext<TRouteTree>\n    : RouteById<TRouteTree, TRouteId>['types']['allContext'],\n  RouteById<TRouteTree, TRouteId>['types']['loaderDeps']\n>\n\nexport type AnyRouteMatch = RouteMatch<any, any, any, any, any, any, any>\n\nexport type MakeRouteMatchUnion<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n  ? RouteMatch<\n      TRoute['id'],\n      TRoute['fullPath'],\n      TRoute['types']['allParams'],\n      TRoute['types']['fullSearchSchema'],\n      TRoute['types']['loaderData'],\n      TRoute['types']['allContext'],\n      TRoute['types']['loaderDeps']\n    >\n  : never\n\n/**\n * The `MatchRouteOptions` type is used to describe the options that can be used when matching a route.\n *\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#matchrouteoptions-type)\n */\nexport interface MatchRouteOptions {\n  /**\n   * If `true`, will match against pending location instead of the current location.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#pending-property)\n   */\n  pending?: boolean\n  /**\n   * If `true`, will match against the current location with case sensitivity.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#casesensitive-property)\n   *\n   * @deprecated Declare case sensitivity in the route definition instead, or globally for all routes using the `caseSensitive` option on the router.\n   */\n  caseSensitive?: boolean\n  /**\n   * If `true`, will match against the current location's search params using a deep inclusive check. e.g. `{ a: 1 }` will match for a current location of `{ a: 1, b: 2 }`.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#includesearch-property)\n   */\n  includeSearch?: boolean\n  /**\n   * If `true`, will match against the current location using a fuzzy match. e.g. `/posts` will match for a current location of `/posts/123`.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/MatchRouteOptionsType#fuzzy-property)\n   */\n  fuzzy?: boolean\n}\n"
  },
  {
    "path": "packages/router-core/src/RouterProvider.ts",
    "content": "import type { NavigateOptions, ToOptions } from './link'\nimport type { ParsedLocation } from './location'\nimport type { RoutePaths } from './routeInfo'\nimport type { RegisteredRouter, ViewTransitionOptions } from './router'\n\nexport interface MatchLocation {\n  to?: string | number | null\n  fuzzy?: boolean\n  caseSensitive?: boolean\n  from?: string\n}\n\nexport interface CommitLocationOptions {\n  replace?: boolean\n  resetScroll?: boolean\n  hashScrollIntoView?: boolean | ScrollIntoViewOptions\n  viewTransition?: boolean | ViewTransitionOptions\n  /**\n   * @deprecated All navigations use transitions under the hood now\n   **/\n  startTransition?: boolean\n  ignoreBlocker?: boolean\n}\n\nexport type NavigateFn = <\n  TRouter extends RegisteredRouter,\n  TTo extends string | undefined,\n  TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n  TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n  TMaskTo extends string = '',\n>(\n  opts: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Promise<void>\n\nexport type BuildLocationFn = <\n  TRouter extends RegisteredRouter,\n  TTo extends string | undefined,\n  TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n  TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n  TMaskTo extends string = '',\n>(\n  opts: ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n    leaveParams?: boolean\n    _includeValidateSearch?: boolean\n    _isNavigate?: boolean\n  },\n) => ParsedLocation\n"
  },
  {
    "path": "packages/router-core/src/config.ts",
    "content": "import type { SSROption } from './router'\nimport type { AnySerializationAdapter } from './ssr/serializer/transformer'\n\nexport interface RouterConfigOptions<\n  in out TSerializationAdapters,\n  in out TDefaultSsr,\n> {\n  serializationAdapters?: TSerializationAdapters\n  defaultSsr?: TDefaultSsr\n}\n\nexport interface RouterConfig<\n  in out TSerializationAdapters,\n  in out TDefaultSsr,\n> {\n  '~types': RouterConfigTypes<TSerializationAdapters, TDefaultSsr>\n  serializationAdapters: TSerializationAdapters\n  defaultSsr: TDefaultSsr | undefined\n}\n\nexport interface RouterConfigTypes<\n  in out TSerializationAdapters,\n  in out TDefaultSsr,\n> {\n  serializationAdapters: TSerializationAdapters\n  defaultSsr: TDefaultSsr\n}\n\nexport const createRouterConfig = <\n  const TSerializationAdapters extends ReadonlyArray<AnySerializationAdapter> =\n    [],\n  TDefaultSsr extends SSROption = SSROption,\n>(\n  options: RouterConfigOptions<TSerializationAdapters, TDefaultSsr>,\n): RouterConfig<TSerializationAdapters, TDefaultSsr> => {\n  return {\n    serializationAdapters: options.serializationAdapters,\n    defaultSsr: options.defaultSsr,\n  } as RouterConfig<TSerializationAdapters, TDefaultSsr>\n}\n\nexport type AnyRouterConfig = RouterConfig<any, any>\n"
  },
  {
    "path": "packages/router-core/src/defer.ts",
    "content": "import { defaultSerializeError } from './router'\n\n/**\n * Well-known symbol used by {@link defer} to tag a promise with\n * its deferred state. Consumers can read `promise[TSR_DEFERRED_PROMISE]`\n * to access `status`, `data`, or `error`.\n */\nexport const TSR_DEFERRED_PROMISE = Symbol.for('TSR_DEFERRED_PROMISE')\n\nexport type DeferredPromiseState<T> =\n  | {\n      status: 'pending'\n      data?: T\n      error?: unknown\n    }\n  | {\n      status: 'success'\n      data: T\n    }\n  | {\n      status: 'error'\n      data?: T\n      error: unknown\n    }\n\nexport type DeferredPromise<T> = Promise<T> & {\n  [TSR_DEFERRED_PROMISE]: DeferredPromiseState<T>\n}\n\n/**\n * Wrap a promise with a deferred state for use with `<Await>` and `useAwaited`.\n *\n * The returned promise is augmented with internal state (status/data/error)\n * so UI can read progress or suspend until it settles.\n *\n * @param _promise The promise to wrap.\n * @param options Optional config. Provide `serializeError` to customize how\n * errors are serialized for transfer.\n * @returns The same promise with attached deferred metadata.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/deferFunction\n */\nexport function defer<T>(\n  _promise: Promise<T>,\n  options?: {\n    serializeError?: typeof defaultSerializeError\n  },\n) {\n  const promise = _promise as DeferredPromise<T>\n  // this is already deferred promise\n  if ((promise as any)[TSR_DEFERRED_PROMISE]) {\n    return promise\n  }\n  promise[TSR_DEFERRED_PROMISE] = { status: 'pending' }\n\n  promise\n    .then((data) => {\n      promise[TSR_DEFERRED_PROMISE].status = 'success'\n      promise[TSR_DEFERRED_PROMISE].data = data\n    })\n    .catch((error) => {\n      promise[TSR_DEFERRED_PROMISE].status = 'error'\n      ;(promise[TSR_DEFERRED_PROMISE] as any).error = {\n        data: (options?.serializeError ?? defaultSerializeError)(error),\n        __isServerError: true,\n      }\n    })\n\n  return promise\n}\n"
  },
  {
    "path": "packages/router-core/src/fileRoute.ts",
    "content": "import type { Register } from './router'\nimport type {\n  AnyContext,\n  AnyPathParams,\n  AnyRoute,\n  FileBaseRouteOptions,\n  ResolveParams,\n  Route,\n  RouteConstraints,\n  UpdatableRouteOptions,\n} from './route'\nimport type { AnyValidator } from './validators'\n\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: any\n  fullPaths: any\n  to: any\n  fileRoutesByTo: any\n  id: any\n  fileRoutesById: any\n}\n\nexport type InferFileRouteTypes<TRouteTree extends AnyRoute> =\n  unknown extends TRouteTree['types']['fileRouteTypes']\n    ? never\n    : TRouteTree['types']['fileRouteTypes'] extends FileRouteTypes\n      ? TRouteTree['types']['fileRouteTypes']\n      : never\n\nexport interface FileRoutesByPath {\n  // '/': {\n  //   parentRoute: typeof rootRoute\n  // }\n}\n\nexport interface FileRouteOptions<\n  TRegister,\n  TFilePath extends string,\n  TParentRoute extends AnyRoute,\n  TId extends RouteConstraints['TId'],\n  TPath extends RouteConstraints['TPath'],\n  TFullPath extends RouteConstraints['TFullPath'],\n  TSearchValidator = undefined,\n  TParams = ResolveParams<TPath>,\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TSSR = unknown,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n>\n  extends\n    FileBaseRouteOptions<\n      TRegister,\n      TParentRoute,\n      TId,\n      TPath,\n      TSearchValidator,\n      TParams,\n      TLoaderDeps,\n      TLoaderFn,\n      AnyContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      AnyContext,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >,\n    UpdatableRouteOptions<\n      TParentRoute,\n      TId,\n      TFullPath,\n      TParams,\n      TSearchValidator,\n      TLoaderFn,\n      TLoaderDeps,\n      AnyContext,\n      TRouteContextFn,\n      TBeforeLoadFn\n    > {}\n\nexport type CreateFileRoute<\n  TFilePath extends string,\n  TParentRoute extends AnyRoute,\n  TId extends RouteConstraints['TId'],\n  TPath extends RouteConstraints['TPath'],\n  TFullPath extends RouteConstraints['TFullPath'],\n> = <\n  TRegister = Register,\n  TSearchValidator = undefined,\n  TParams = ResolveParams<TPath>,\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TSSR = unknown,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n>(\n  options?: FileRouteOptions<\n    TRegister,\n    TFilePath,\n    TParentRoute,\n    TId,\n    TPath,\n    TFullPath,\n    TSearchValidator,\n    TParams,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >,\n) => Route<\n  TRegister,\n  TParentRoute,\n  TPath,\n  TFullPath,\n  TFilePath,\n  TId,\n  TSearchValidator,\n  TParams,\n  AnyContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  unknown,\n  unknown,\n  TSSR,\n  TServerMiddlewares,\n  THandlers\n>\n\nexport type LazyRouteOptions = Pick<\n  UpdatableRouteOptions<\n    AnyRoute,\n    string,\n    string,\n    AnyPathParams,\n    AnyValidator,\n    {},\n    AnyContext,\n    AnyContext,\n    AnyContext,\n    AnyContext\n  >,\n  'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'\n>\n\nexport interface LazyRoute<in out TRoute extends AnyRoute> {\n  options: {\n    id: string\n  } & LazyRouteOptions\n}\n\nexport type CreateLazyFileRoute<TRoute extends AnyRoute> = (\n  opts: LazyRouteOptions,\n) => LazyRoute<TRoute>\n"
  },
  {
    "path": "packages/router-core/src/global.ts",
    "content": "import type { AnyRouter } from './router'\n\ndeclare global {\n  interface Window {\n    __TSR_ROUTER__?: AnyRouter\n  }\n}\n\nexport {}\n"
  },
  {
    "path": "packages/router-core/src/history.ts",
    "content": "import type { HistoryLocation } from '@tanstack/history'\n\ndeclare module '@tanstack/history' {\n  interface HistoryState {\n    __tempLocation?: HistoryLocation\n    __tempKey?: string\n    __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions\n  }\n}\n"
  },
  {
    "path": "packages/router-core/src/index.ts",
    "content": "export * from './global'\n\nexport { TSR_DEFERRED_PROMISE, defer } from './defer'\nexport type { DeferredPromiseState, DeferredPromise } from './defer'\nexport { preloadWarning } from './link'\nexport type {\n  IsRequiredParams,\n  AddTrailingSlash,\n  RemoveTrailingSlashes,\n  AddLeadingSlash,\n  RemoveLeadingSlashes,\n  ActiveOptions,\n  LinkOptionsProps,\n  ResolveCurrentPath,\n  ResolveParentPath,\n  ResolveRelativePath,\n  FindDescendantToPaths,\n  InferDescendantToPaths,\n  RelativeToPath,\n  RelativeToParentPath,\n  RelativeToCurrentPath,\n  AbsoluteToPath,\n  RelativeToPathAutoComplete,\n  NavigateOptions,\n  ToOptions,\n  ToMaskOptions,\n  ToSubOptions,\n  ResolveRoute,\n  SearchParamOptions,\n  PathParamOptions,\n  ToPathOption,\n  LinkOptions,\n  MakeOptionalPathParams,\n  FromPathOption,\n  MakeOptionalSearchParams,\n  MaskOptions,\n  ToSubOptionsProps,\n  RequiredToOptions,\n} from './link'\n\nexport type {\n  RouteToPath,\n  TrailingSlashOptionByRouter,\n  ParseRoute,\n  CodeRouteToPath,\n  RouteIds,\n  FullSearchSchema,\n  FullSearchSchemaInput,\n  AllParams,\n  RouteById,\n  AllContext,\n  RoutePaths,\n  RoutesById,\n  RoutesByPath,\n  AllLoaderData,\n  RouteByPath,\n} from './routeInfo'\n\nexport type {\n  InferFileRouteTypes,\n  FileRouteTypes,\n  FileRoutesByPath,\n  CreateFileRoute,\n  LazyRoute,\n  LazyRouteOptions,\n  CreateLazyFileRoute,\n} from './fileRoute'\n\nexport type { ParsedLocation } from './location'\nexport type { Manifest, RouterManagedTag } from './manifest'\nexport { isMatch } from './Matches'\nexport type {\n  AnyMatchAndValue,\n  FindValueByIndex,\n  FindValueByKey,\n  CreateMatchAndValue,\n  NextMatchAndValue,\n  IsMatchKeyOf,\n  IsMatchPath,\n  IsMatchResult,\n  IsMatchParse,\n  IsMatch,\n  RouteMatch,\n  RouteMatchExtensions,\n  MakeRouteMatchUnion,\n  MakeRouteMatch,\n  AnyRouteMatch,\n  MakeRouteMatchFromRoute,\n  MatchRouteOptions,\n} from './Matches'\nexport {\n  joinPaths,\n  cleanPath,\n  trimPathLeft,\n  trimPathRight,\n  trimPath,\n  removeTrailingSlash,\n  exactPathTest,\n  resolvePath,\n  interpolatePath,\n} from './path'\nexport { encode, decode } from './qss'\nexport { rootRouteId } from './root'\nexport type { RootRouteId } from './root'\n\nexport { BaseRoute, BaseRouteApi, BaseRootRoute } from './route'\nexport type {\n  AnyPathParams,\n  SearchSchemaInput,\n  AnyContext,\n  RouteContext,\n  PreloadableObj,\n  RoutePathOptions,\n  StaticDataRouteOption,\n  RoutePathOptionsIntersection,\n  SearchFilter,\n  SearchMiddlewareContext,\n  SearchMiddleware,\n  ResolveId,\n  InferFullSearchSchema,\n  InferFullSearchSchemaInput,\n  InferAllParams,\n  InferAllContext,\n  MetaDescriptor,\n  RouteLinkEntry,\n  SearchValidator,\n  AnySearchValidator,\n  DefaultSearchValidator,\n  ErrorRouteProps,\n  ErrorComponentProps,\n  NotFoundRouteProps,\n  ResolveParams,\n  ParseParamsFn,\n  StringifyParamsFn,\n  ParamsOptions,\n  UpdatableStaticRouteOption,\n  ContextReturnType,\n  ContextAsyncReturnType,\n  ResolveRouteContext,\n  ResolveLoaderData,\n  RoutePrefix,\n  TrimPath,\n  TrimPathLeft,\n  TrimPathRight,\n  ResolveSearchSchemaFnInput,\n  ResolveSearchSchemaInput,\n  ResolveSearchSchemaFn,\n  ResolveSearchSchema,\n  ResolveFullSearchSchema,\n  ResolveFullSearchSchemaInput,\n  ResolveAllContext,\n  BeforeLoadContextParameter,\n  RouteContextParameter,\n  ResolveAllParamsFromParent,\n  AnyRoute,\n  Route,\n  RouteTypes,\n  FullSearchSchemaOption,\n  RemountDepsOptions,\n  MakeRemountDepsOptionsUnion,\n  ResolveFullPath,\n  AnyRouteWithContext,\n  RouteOptions,\n  FileBaseRouteOptions,\n  BaseRouteOptions,\n  UpdatableRouteOptions,\n  LoaderStaleReloadMode,\n  RouteLoaderFn,\n  RouteLoaderEntry,\n  LoaderFnContext,\n  RouteContextFn,\n  ContextOptions,\n  RouteContextOptions,\n  BeforeLoadContextOptions,\n  RootRouteOptions,\n  RootRouteOptionsExtensions,\n  UpdatableRouteOptionsExtensions,\n  RouteConstraints,\n  RouteTypesById,\n  RouteMask,\n  RouteExtensions,\n  RouteLazyFn,\n  RouteAddChildrenFn,\n  RouteAddFileChildrenFn,\n  RouteAddFileTypesFn,\n  ResolveOptionalParams,\n  ResolveRequiredParams,\n  RootRoute,\n  FilebaseRouteOptionsInterface,\n} from './route'\nexport {\n  createNonReactiveMutableStore,\n  createNonReactiveReadonlyStore,\n} from './stores'\nexport type {\n  RouterBatchFn,\n  RouterReadableStore,\n  GetStoreConfig,\n  RouterStores,\n  RouterWritableStore,\n} from './stores'\nexport {\n  defaultSerializeError,\n  getLocationChangeInfo,\n  RouterCore,\n  lazyFn,\n  SearchParamError,\n  PathParamError,\n  getInitialRouterState,\n  getMatchedRoutes,\n  trailingSlashOptions,\n} from './router'\n\nexport type {\n  ViewTransitionOptions,\n  TrailingSlashOption,\n  Register,\n  AnyRouter,\n  AnyRouterWithContext,\n  RegisteredRouter,\n  RouterState,\n  BuildNextOptions,\n  RouterListener,\n  RouterEvent,\n  ListenerFn,\n  RouterEvents,\n  MatchRoutesOpts,\n  RouterOptionsExtensions,\n  DefaultRemountDepsFn,\n  PreloadRouteFn,\n  MatchRouteFn,\n  RouterContextOptions,\n  RouterOptions,\n  RouterConstructorOptions,\n  UpdateFn,\n  ParseLocationFn,\n  InvalidateFn,\n  ControllablePromise,\n  InjectedHtmlEntry,\n  EmitFn,\n  LoadFn,\n  GetMatchFn,\n  SubscribeFn,\n  UpdateMatchFn,\n  CommitLocationFn,\n  GetMatchRoutesFn,\n  MatchRoutesFn,\n  StartTransitionFn,\n  LoadRouteChunkFn,\n  ClearCacheFn,\n  CreateRouterFn,\n  SSROption,\n} from './router'\n\nexport * from './config'\n\nexport type {\n  MatchLocation,\n  CommitLocationOptions,\n  NavigateFn,\n  BuildLocationFn,\n} from './RouterProvider'\n\nexport { retainSearchParams, stripSearchParams } from './searchMiddleware'\n\nexport {\n  defaultParseSearch,\n  defaultStringifySearch,\n  parseSearchWith,\n  stringifySearchWith,\n} from './searchParams'\nexport type { SearchSerializer, SearchParser } from './searchParams'\n\nexport type { OptionalStructuralSharing } from './structuralSharing'\n\nexport {\n  functionalUpdate,\n  replaceEqualDeep,\n  isPlainObject,\n  isPlainArray,\n  deepEqual,\n  createControlledPromise,\n  isModuleNotFoundError,\n  DEFAULT_PROTOCOL_ALLOWLIST,\n  escapeHtml,\n  isDangerousProtocol,\n  buildDevStylesUrl,\n} from './utils'\nexport type {\n  NoInfer,\n  IsAny,\n  PickAsRequired,\n  PickRequired,\n  PickOptional,\n  WithoutEmpty,\n  Expand,\n  DeepPartial,\n  MakeDifferenceOptional,\n  IsUnion,\n  IsNonEmptyObject,\n  Assign,\n  IntersectAssign,\n  Timeout,\n  Updater,\n  NonNullableUpdater,\n  StringLiteral,\n  ThrowOrOptional,\n  ThrowConstraint,\n  ControlledPromise,\n  ExtractObjects,\n  PartialMergeAllObject,\n  MergeAllPrimitive,\n  ExtractPrimitives,\n  PartialMergeAll,\n  Constrain,\n  ConstrainLiteral,\n  UnionToIntersection,\n  MergeAllObjects,\n  MergeAll,\n  ValidateJSON,\n  StrictOrFrom,\n  LooseReturnType,\n  LooseAsyncReturnType,\n  Awaitable,\n} from './utils'\n\nexport type {\n  StandardSchemaValidatorProps,\n  StandardSchemaValidator,\n  AnyStandardSchemaValidator,\n  StandardSchemaValidatorTypes,\n  AnyStandardSchemaValidateSuccess,\n  AnyStandardSchemaValidateFailure,\n  AnyStandardSchemaValidateIssue,\n  AnyStandardSchemaValidateInput,\n  AnyStandardSchemaValidate,\n  ValidatorObj,\n  AnyValidatorObj,\n  ValidatorAdapter,\n  AnyValidatorAdapter,\n  AnyValidatorFn,\n  ValidatorFn,\n  Validator,\n  AnyValidator,\n  AnySchema,\n  DefaultValidator,\n  ResolveSearchValidatorInputFn,\n  ResolveSearchValidatorInput,\n  ResolveValidatorInputFn,\n  ResolveValidatorInput,\n  ResolveValidatorOutputFn,\n  ResolveValidatorOutput,\n} from './validators'\n\nexport type {\n  UseRouteContextBaseOptions,\n  UseRouteContextOptions,\n  UseRouteContextResult,\n} from './useRouteContext'\n\nexport type { UseSearchResult, ResolveUseSearch } from './useSearch'\n\nexport type { UseParamsResult, ResolveUseParams } from './useParams'\n\nexport type { UseNavigateResult } from './useNavigate'\n\nexport type { UseLoaderDepsResult, ResolveUseLoaderDeps } from './useLoaderDeps'\n\nexport type { UseLoaderDataResult, ResolveUseLoaderData } from './useLoaderData'\n\nexport type {\n  Redirect,\n  RedirectOptions,\n  RedirectOptionsRoute,\n  RedirectFnRoute,\n  ResolvedRedirect,\n  AnyRedirect,\n} from './redirect'\n\nexport {\n  redirect,\n  isRedirect,\n  isResolvedRedirect,\n  parseRedirect,\n} from './redirect'\n\nexport type { NotFoundError } from './not-found'\nexport { isNotFound, notFound } from './not-found'\n\nexport {\n  defaultGetScrollRestorationKey,\n  restoreScroll,\n  storageKey,\n  getCssSelector,\n  scrollRestorationCache,\n  setupScrollRestoration,\n  handleHashScroll,\n} from './scroll-restoration'\n\nexport type {\n  ScrollRestorationOptions,\n  ScrollRestorationEntry,\n} from './scroll-restoration'\n\nexport type {\n  ValidateFromPath,\n  ValidateToPath,\n  ValidateSearch,\n  ValidateParams,\n  InferFrom,\n  InferTo,\n  InferMaskTo,\n  InferMaskFrom,\n  ValidateNavigateOptions,\n  ValidateNavigateOptionsArray,\n  ValidateRedirectOptions,\n  ValidateRedirectOptionsArray,\n  ValidateId,\n  InferStrict,\n  InferShouldThrow,\n  InferSelected,\n  ValidateUseSearchResult,\n  ValidateUseParamsResult,\n} from './typePrimitives'\n\nexport type {\n  AnySerializationAdapter,\n  SerializationAdapter,\n  ValidateSerializableInput,\n  ValidateSerializableInputResult,\n  SerializerExtensions,\n  ValidateSerializable,\n  RegisteredSerializableInput,\n  SerializableExtensions,\n  DefaultSerializable,\n  Serializable,\n  TSR_SERIALIZABLE,\n  TsrSerializable,\n} from './ssr/serializer/transformer'\n\nexport {\n  createSerializationAdapter,\n  makeSerovalPlugin,\n  makeSsrSerovalPlugin,\n} from './ssr/serializer/transformer'\n\nexport { defaultSerovalPlugins } from './ssr/serializer/seroval-plugins'\n\nexport {\n  RawStream,\n  createRawStreamRPCPlugin,\n  createRawStreamDeserializePlugin,\n} from './ssr/serializer/RawStream'\nexport type {\n  OnRawStreamCallback,\n  RawStreamHint,\n  RawStreamOptions,\n} from './ssr/serializer/RawStream'\n\nexport { composeRewrites, executeRewriteInput } from './rewrite'\nexport type { LocationRewrite, LocationRewriteFunction } from './router'\n"
  },
  {
    "path": "packages/router-core/src/isServer/client.ts",
    "content": "export const isServer = false\n"
  },
  {
    "path": "packages/router-core/src/isServer/development.ts",
    "content": "// Development/test mode - returns undefined so fallback to router.isServer is used\nexport const isServer: boolean | undefined = undefined\n"
  },
  {
    "path": "packages/router-core/src/isServer/server.ts",
    "content": "export const isServer = process.env.NODE_ENV === 'test' ? undefined : true\n"
  },
  {
    "path": "packages/router-core/src/link.ts",
    "content": "import type { HistoryState, ParsedHistoryState } from '@tanstack/history'\nimport type {\n  AllParams,\n  CatchAllPaths,\n  CurrentPath,\n  FullSearchSchema,\n  FullSearchSchemaInput,\n  ParentPath,\n  RouteByPath,\n  RouteByToPath,\n  RoutePaths,\n  RouteToPath,\n  ToPath,\n} from './routeInfo'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  ViewTransitionOptions,\n} from './router'\nimport type {\n  ConstrainLiteral,\n  Expand,\n  MakeDifferenceOptional,\n  NoInfer,\n  NonNullableUpdater,\n  Updater,\n} from './utils'\nimport type { ParsedLocation } from './location'\n\nexport type IsRequiredParams<TParams> =\n  Record<never, never> extends TParams ? never : true\n\nexport interface ParsePathParamsResult<\n  in out TRequired,\n  in out TOptional,\n  in out TRest,\n> {\n  required: TRequired\n  optional: TOptional\n  rest: TRest\n}\n\nexport type AnyParsePathParamsResult = ParsePathParamsResult<\n  string,\n  string,\n  string\n>\n\nexport type ParsePathParamsBoundaryStart<T extends string> =\n  T extends `${infer TLeft}{-${infer TRight}`\n    ? ParsePathParamsResult<\n        ParsePathParams<TLeft>['required'],\n        | ParsePathParams<TLeft>['optional']\n        | ParsePathParams<TRight>['required']\n        | ParsePathParams<TRight>['optional'],\n        ParsePathParams<TRight>['rest']\n      >\n    : T extends `${infer TLeft}{${infer TRight}`\n      ? ParsePathParamsResult<\n          | ParsePathParams<TLeft>['required']\n          | ParsePathParams<TRight>['required'],\n          | ParsePathParams<TLeft>['optional']\n          | ParsePathParams<TRight>['optional'],\n          ParsePathParams<TRight>['rest']\n        >\n      : never\n\nexport type ParsePathParamsSymbol<T extends string> =\n  T extends `${string}$${infer TRight}`\n    ? TRight extends `${string}/${string}`\n      ? TRight extends `${infer TParam}/${infer TRest}`\n        ? TParam extends ''\n          ? ParsePathParamsResult<\n              ParsePathParams<TRest>['required'],\n              '_splat' | ParsePathParams<TRest>['optional'],\n              ParsePathParams<TRest>['rest']\n            >\n          : ParsePathParamsResult<\n              TParam | ParsePathParams<TRest>['required'],\n              ParsePathParams<TRest>['optional'],\n              ParsePathParams<TRest>['rest']\n            >\n        : never\n      : TRight extends ''\n        ? ParsePathParamsResult<never, '_splat', never>\n        : ParsePathParamsResult<TRight, never, never>\n    : never\n\nexport type ParsePathParamsBoundaryEnd<T extends string> =\n  T extends `${infer TLeft}}${infer TRight}`\n    ? ParsePathParamsResult<\n        | ParsePathParams<TLeft>['required']\n        | ParsePathParams<TRight>['required'],\n        | ParsePathParams<TLeft>['optional']\n        | ParsePathParams<TRight>['optional'],\n        ParsePathParams<TRight>['rest']\n      >\n    : never\n\nexport type ParsePathParamsEscapeStart<T extends string> =\n  T extends `${infer TLeft}[${infer TRight}`\n    ? ParsePathParamsResult<\n        | ParsePathParams<TLeft>['required']\n        | ParsePathParams<TRight>['required'],\n        | ParsePathParams<TLeft>['optional']\n        | ParsePathParams<TRight>['optional'],\n        ParsePathParams<TRight>['rest']\n      >\n    : never\n\nexport type ParsePathParamsEscapeEnd<T extends string> =\n  T extends `${string}]${infer TRight}` ? ParsePathParams<TRight> : never\n\nexport type ParsePathParams<T extends string> = T extends `${string}[${string}`\n  ? ParsePathParamsEscapeStart<T>\n  : T extends `${string}]${string}`\n    ? ParsePathParamsEscapeEnd<T>\n    : T extends `${string}}${string}`\n      ? ParsePathParamsBoundaryEnd<T>\n      : T extends `${string}{${string}`\n        ? ParsePathParamsBoundaryStart<T>\n        : T extends `${string}$${string}`\n          ? ParsePathParamsSymbol<T>\n          : never\n\nexport type AddTrailingSlash<T> = T extends `${string}/` ? T : `${T & string}/`\n\nexport type RemoveTrailingSlashes<T> = T & `${string}/` extends never\n  ? T\n  : T extends `${infer R}/`\n    ? R\n    : T\n\nexport type AddLeadingSlash<T> = T & `/${string}` extends never\n  ? `/${T & string}`\n  : T\n\nexport type RemoveLeadingSlashes<T> = T & `/${string}` extends never\n  ? T\n  : T extends `/${infer R}`\n    ? R\n    : T\n\ntype JoinPath<TLeft extends string, TRight extends string> = TRight extends ''\n  ? TLeft\n  : TLeft extends ''\n    ? TRight\n    : `${RemoveTrailingSlashes<TLeft>}/${RemoveLeadingSlashes<TRight>}`\n\ntype RemoveLastSegment<\n  T extends string,\n  TAcc extends string = '',\n> = T extends `${infer TSegment}/${infer TRest}`\n  ? TRest & `${string}/${string}` extends never\n    ? TRest extends ''\n      ? TAcc\n      : `${TAcc}${TSegment}`\n    : RemoveLastSegment<TRest, `${TAcc}${TSegment}/`>\n  : TAcc\n\nexport type ResolveCurrentPath<\n  TFrom extends string,\n  TTo extends string,\n> = TTo extends '.'\n  ? TFrom\n  : TTo extends './'\n    ? AddTrailingSlash<TFrom>\n    : TTo & `./${string}` extends never\n      ? never\n      : TTo extends `./${infer TRest}`\n        ? AddLeadingSlash<JoinPath<TFrom, TRest>>\n        : never\n\nexport type ResolveParentPath<\n  TFrom extends string,\n  TTo extends string,\n> = TTo extends '../' | '..'\n  ? TFrom extends '' | '/'\n    ? never\n    : AddLeadingSlash<RemoveLastSegment<TFrom>>\n  : TTo & `../${string}` extends never\n    ? AddLeadingSlash<JoinPath<TFrom, TTo>>\n    : TFrom extends '' | '/'\n      ? never\n      : TTo extends `../${infer ToRest}`\n        ? ResolveParentPath<RemoveLastSegment<TFrom>, ToRest>\n        : AddLeadingSlash<JoinPath<TFrom, TTo>>\n\nexport type ResolveRelativePath<TFrom, TTo = '.'> = string extends TFrom\n  ? TTo\n  : string extends TTo\n    ? TFrom\n    : undefined extends TTo\n      ? TFrom\n      : TTo extends string\n        ? TFrom extends string\n          ? TTo extends `/${string}`\n            ? TTo\n            : TTo extends `..${string}`\n              ? ResolveParentPath<TFrom, TTo>\n              : TTo extends `.${string}`\n                ? ResolveCurrentPath<TFrom, TTo>\n                : AddLeadingSlash<JoinPath<TFrom, TTo>>\n          : never\n        : never\n\nexport type FindDescendantToPaths<\n  TRouter extends AnyRouter,\n  TPrefix extends string,\n> = `${TPrefix}/${string}` & RouteToPath<TRouter>\n\nexport type InferDescendantToPaths<\n  TRouter extends AnyRouter,\n  TPrefix extends string,\n  TPaths = FindDescendantToPaths<TRouter, TPrefix>,\n> = TPaths extends `${TPrefix}/`\n  ? never\n  : TPaths extends `${TPrefix}/${infer TRest}`\n    ? TRest\n    : never\n\nexport type RelativeToPath<\n  TRouter extends AnyRouter,\n  TTo extends string,\n  TResolvedPath extends string,\n> =\n  | (TResolvedPath & RouteToPath<TRouter> extends never\n      ? never\n      : ToPath<TRouter, TTo>)\n  | `${RemoveTrailingSlashes<TTo>}/${InferDescendantToPaths<TRouter, RemoveTrailingSlashes<TResolvedPath>>}`\n\nexport type RelativeToParentPath<\n  TRouter extends AnyRouter,\n  TFrom extends string,\n  TTo extends string,\n  TResolvedPath extends string = ResolveRelativePath<TFrom, TTo>,\n> =\n  | RelativeToPath<TRouter, TTo, TResolvedPath>\n  | (TTo extends `${string}..` | `${string}../`\n      ? TResolvedPath extends '/' | ''\n        ? never\n        : FindDescendantToPaths<\n              TRouter,\n              RemoveTrailingSlashes<TResolvedPath>\n            > extends never\n          ? never\n          : `${RemoveTrailingSlashes<TTo>}/${ParentPath<TRouter>}`\n      : never)\n\nexport type RelativeToCurrentPath<\n  TRouter extends AnyRouter,\n  TFrom extends string,\n  TTo extends string,\n  TResolvedPath extends string = ResolveRelativePath<TFrom, TTo>,\n> = RelativeToPath<TRouter, TTo, TResolvedPath> | CurrentPath<TRouter>\n\nexport type AbsoluteToPath<TRouter extends AnyRouter, TFrom extends string> =\n  | (string extends TFrom\n      ? CurrentPath<TRouter>\n      : TFrom extends `/`\n        ? never\n        : CurrentPath<TRouter>)\n  | (string extends TFrom\n      ? ParentPath<TRouter>\n      : TFrom extends `/`\n        ? never\n        : ParentPath<TRouter>)\n  | RouteToPath<TRouter>\n  | (TFrom extends '/'\n      ? never\n      : string extends TFrom\n        ? never\n        : InferDescendantToPaths<TRouter, RemoveTrailingSlashes<TFrom>>)\n\nexport type RelativeToPathAutoComplete<\n  TRouter extends AnyRouter,\n  TFrom extends string,\n  TTo extends string,\n> = string extends TTo\n  ? string\n  : string extends TFrom\n    ? AbsoluteToPath<TRouter, TFrom>\n    : TTo & `..${string}` extends never\n      ? TTo & `.${string}` extends never\n        ? AbsoluteToPath<TRouter, TFrom>\n        : RelativeToCurrentPath<TRouter, TFrom, TTo>\n      : RelativeToParentPath<TRouter, TFrom, TTo>\n\nexport type NavigateOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = ToOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & NavigateOptionProps\n\n/**\n * The NavigateOptions type is used to describe the options that can be used when describing a navigation action in TanStack Router.\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType)\n */\nexport interface NavigateOptionProps {\n  /**\n   * If set to `true`, the router will scroll the element with an id matching the hash into view with default `ScrollIntoViewOptions`.\n   * If set to `false`, the router will not scroll the element with an id matching the hash into view.\n   * If set to `ScrollIntoViewOptions`, the router will scroll the element with an id matching the hash into view with the provided options.\n   * @default true\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#hashscrollintoview)\n   * @see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView)\n   */\n  hashScrollIntoView?: boolean | ScrollIntoViewOptions\n  /**\n   * `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.\n   * @default false\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#replace)\n   */\n  replace?: boolean\n  /**\n   * Defaults to `true` so that the scroll position will be reset to 0,0 after the location is committed to the browser history.\n   * If `false`, the scroll position will not be reset to 0,0 after the location is committed to history.\n   * @default true\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#resetscroll)\n   */\n  resetScroll?: boolean\n  /** @deprecated All navigations now use startTransition under the hood */\n  startTransition?: boolean\n  /**\n   * If set to `true`, the router will wrap the resulting navigation in a `document.startViewTransition()` call.\n   * If `ViewTransitionOptions`, route navigations will be called using `document.startViewTransition({update, types})`\n   * where `types` will be the strings array passed with `ViewTransitionOptions[\"types\"]`.\n   * If the browser does not support viewTransition types, the navigation will fall back to normal `document.startTransition()`, same as if `true` was passed.\n   *\n   * If the browser does not support this api, this option will be ignored.\n   * @default false\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#viewtransition)\n   * @see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition)\n   * @see [Google](https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types)\n   */\n  viewTransition?: boolean | ViewTransitionOptions\n  /**\n   * If `true`, navigation will ignore any blockers that might prevent it.\n   * @default false\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#ignoreblocker)\n   */\n  ignoreBlocker?: boolean\n  /**\n   * If `true`, navigation to a route inside of router will trigger a full page load instead of the traditional SPA navigation.\n   * @default false\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#reloaddocument)\n   */\n  reloadDocument?: boolean\n  /**\n   * This can be used instead of `to` to navigate to a fully built href, e.g. pointing to an external target.\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#href)\n   */\n  href?: string\n  /** @internal */\n  publicHref?: string\n}\n\nexport type ToOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = ToSubOptions<TRouter, TFrom, TTo> & MaskOptions<TRouter, TMaskFrom, TMaskTo>\n\nexport interface MaskOptions<\n  in out TRouter extends AnyRouter,\n  in out TMaskFrom extends string,\n  in out TMaskTo extends string,\n> {\n  _fromLocation?: ParsedLocation\n  mask?: ToMaskOptions<TRouter, TMaskFrom, TMaskTo>\n}\n\nexport type ToMaskOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TMaskFrom extends string = string,\n  TMaskTo extends string = '.',\n> = ToSubOptions<TRouter, TMaskFrom, TMaskTo> & {\n  unmaskOnReload?: boolean\n}\n\nexport type ToSubOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n  SearchParamOptions<TRouter, TFrom, TTo> &\n  PathParamOptions<TRouter, TFrom, TTo>\n\nexport interface RequiredToOptions<\n  in out TRouter extends AnyRouter,\n  in out TFrom extends string,\n  in out TTo extends string | undefined,\n> {\n  /**\n   * The internal route path to navigate to. This should be a relative or absolute path within your application.\n   * For external URLs, use the `href` property instead.\n   * @example \"/dashboard\" or \"../profile\"\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#href)\n   */\n  to: ToPathOption<TRouter, TFrom, TTo> & {}\n}\n\nexport interface OptionalToOptions<\n  in out TRouter extends AnyRouter,\n  in out TFrom extends string,\n  in out TTo extends string | undefined,\n> {\n  /**\n   * The internal route path to navigate to. This should be a relative or absolute path within your application.\n   * For external URLs, use the `href` property instead.\n   * @example \"/dashboard\" or \"../profile\"\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType#href)\n   */\n  to?: ToPathOption<TRouter, TFrom, TTo> & {}\n}\n\nexport type MakeToRequired<\n  TRouter extends AnyRouter,\n  TFrom extends string,\n  TTo extends string | undefined,\n> = string extends TFrom\n  ? string extends TTo\n    ? OptionalToOptions<TRouter, TFrom, TTo>\n    : TTo & CatchAllPaths<TRouter> extends never\n      ? RequiredToOptions<TRouter, TFrom, TTo>\n      : OptionalToOptions<TRouter, TFrom, TTo>\n  : OptionalToOptions<TRouter, TFrom, TTo>\n\nexport type ToSubOptionsProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n  TTo extends string | undefined = '.',\n> = MakeToRequired<TRouter, TFrom, TTo> & {\n  hash?: true | Updater<string>\n  state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>\n  from?: FromPathOption<TRouter, TFrom> & {}\n  unsafeRelative?: 'path'\n}\n\nexport type ParamsReducerFn<\n  in out TRouter extends AnyRouter,\n  in out TParamVariant extends ParamVariant,\n  in out TFrom,\n  in out TTo,\n> = (\n  current: Expand<ResolveFromParams<TRouter, TParamVariant, TFrom>>,\n) => Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>\n\ntype ParamsReducer<\n  TRouter extends AnyRouter,\n  TParamVariant extends ParamVariant,\n  TFrom,\n  TTo,\n> =\n  | Expand<ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>>\n  | (ParamsReducerFn<TRouter, TParamVariant, TFrom, TTo> & {})\n\ntype ParamVariant = 'PATH' | 'SEARCH'\n\nexport type ResolveRoute<\n  TRouter extends AnyRouter,\n  TFrom,\n  TTo,\n  TPath = ResolveRelativePath<TFrom, TTo>,\n> = TPath extends string\n  ? TFrom extends TPath\n    ? RouteByPath<TRouter['routeTree'], TPath>\n    : RouteByToPath<TRouter, TPath>\n  : never\n\ntype ResolveFromParamType<TParamVariant extends ParamVariant> =\n  TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchema'\n\ntype ResolveFromAllParams<\n  TRouter extends AnyRouter,\n  TParamVariant extends ParamVariant,\n> = TParamVariant extends 'PATH'\n  ? AllParams<TRouter['routeTree']>\n  : FullSearchSchema<TRouter['routeTree']>\n\ntype ResolveFromParams<\n  TRouter extends AnyRouter,\n  TParamVariant extends ParamVariant,\n  TFrom,\n> = string extends TFrom\n  ? ResolveFromAllParams<TRouter, TParamVariant>\n  : RouteByPath<\n      TRouter['routeTree'],\n      TFrom\n    >['types'][ResolveFromParamType<TParamVariant>]\n\ntype ResolveToParamType<TParamVariant extends ParamVariant> =\n  TParamVariant extends 'PATH' ? 'allParams' : 'fullSearchSchemaInput'\n\ntype ResolveAllToParams<\n  TRouter extends AnyRouter,\n  TParamVariant extends ParamVariant,\n> = TParamVariant extends 'PATH'\n  ? AllParams<TRouter['routeTree']>\n  : FullSearchSchemaInput<TRouter['routeTree']>\n\nexport type ResolveToParams<\n  TRouter extends AnyRouter,\n  TParamVariant extends ParamVariant,\n  TFrom,\n  TTo,\n> =\n  ResolveRelativePath<TFrom, TTo> extends infer TPath\n    ? undefined extends TPath\n      ? never\n      : string extends TPath\n        ? ResolveAllToParams<TRouter, TParamVariant>\n        : TPath extends CatchAllPaths<TRouter>\n          ? ResolveAllToParams<TRouter, TParamVariant>\n          : ResolveRoute<\n              TRouter,\n              TFrom,\n              TTo\n            >['types'][ResolveToParamType<TParamVariant>]\n    : never\n\ntype ResolveRelativeToParams<\n  TRouter extends AnyRouter,\n  TParamVariant extends ParamVariant,\n  TFrom,\n  TTo,\n  TToParams = ResolveToParams<TRouter, TParamVariant, TFrom, TTo>,\n> = TParamVariant extends 'SEARCH'\n  ? TToParams\n  : string extends TFrom\n    ? TToParams\n    : MakeDifferenceOptional<\n        ResolveFromParams<TRouter, TParamVariant, TFrom>,\n        TToParams\n      >\n\nexport interface MakeOptionalSearchParams<\n  in out TRouter extends AnyRouter,\n  in out TFrom,\n  in out TTo,\n> {\n  search?: true | (ParamsReducer<TRouter, 'SEARCH', TFrom, TTo> & {})\n}\n\nexport interface MakeOptionalPathParams<\n  in out TRouter extends AnyRouter,\n  in out TFrom,\n  in out TTo,\n> {\n  params?: true | (ParamsReducer<TRouter, 'PATH', TFrom, TTo> & {})\n}\n\ntype MakeRequiredParamsReducer<\n  TRouter extends AnyRouter,\n  TParamVariant extends ParamVariant,\n  TFrom,\n  TTo,\n> =\n  | (string extends TFrom\n      ? never\n      : ResolveFromParams<\n            TRouter,\n            TParamVariant,\n            TFrom\n          > extends ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>\n        ? true\n        : never)\n  | (ParamsReducer<TRouter, TParamVariant, TFrom, TTo> & {})\n\nexport interface MakeRequiredPathParams<\n  in out TRouter extends AnyRouter,\n  in out TFrom,\n  in out TTo,\n> {\n  params: MakeRequiredParamsReducer<TRouter, 'PATH', TFrom, TTo> & {}\n}\n\nexport interface MakeRequiredSearchParams<\n  in out TRouter extends AnyRouter,\n  in out TFrom,\n  in out TTo,\n> {\n  search: MakeRequiredParamsReducer<TRouter, 'SEARCH', TFrom, TTo> & {}\n}\n\nexport type IsRequired<\n  TRouter extends AnyRouter,\n  TParamVariant extends ParamVariant,\n  TFrom,\n  TTo,\n> =\n  ResolveRelativePath<TFrom, TTo> extends infer TPath\n    ? undefined extends TPath\n      ? never\n      : TPath extends CatchAllPaths<TRouter>\n        ? never\n        : IsRequiredParams<\n            ResolveRelativeToParams<TRouter, TParamVariant, TFrom, TTo>\n          >\n    : never\n\nexport type SearchParamOptions<TRouter extends AnyRouter, TFrom, TTo> =\n  IsRequired<TRouter, 'SEARCH', TFrom, TTo> extends never\n    ? MakeOptionalSearchParams<TRouter, TFrom, TTo>\n    : MakeRequiredSearchParams<TRouter, TFrom, TTo>\n\nexport type PathParamOptions<TRouter extends AnyRouter, TFrom, TTo> =\n  IsRequired<TRouter, 'PATH', TFrom, TTo> extends never\n    ? MakeOptionalPathParams<TRouter, TFrom, TTo>\n    : MakeRequiredPathParams<TRouter, TFrom, TTo>\n\nexport type ToPathOption<\n  TRouter extends AnyRouter = AnyRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = string,\n> = ConstrainLiteral<\n  TTo,\n  RelativeToPathAutoComplete<\n    TRouter,\n    NoInfer<TFrom> extends string ? NoInfer<TFrom> : '',\n    NoInfer<TTo> & string\n  >\n>\n\nexport type FromPathOption<TRouter extends AnyRouter, TFrom> = ConstrainLiteral<\n  TFrom,\n  RoutePaths<TRouter['routeTree']>\n>\n\n/**\n * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/navigation#active-options)\n */\nexport interface ActiveOptions {\n  /**\n   * If true, the link will be active if the current route matches the `to` route path exactly (no children routes)\n   * @default false\n   */\n  exact?: boolean\n  /**\n   * If true, the link will only be active if the current URL hash matches the `hash` prop\n   * @default false\n   */\n  includeHash?: boolean\n  /**\n   * If true, the link will only be active if the current URL search params inclusively match the `search` prop\n   * @default true\n   */\n  includeSearch?: boolean\n  /**\n   * This modifies the `includeSearch` behavior.\n   * If true,  properties in `search` that are explicitly `undefined` must NOT be present in the current URL search params for the link to be active.\n   * @default false\n   */\n  explicitUndefined?: boolean\n}\n\nexport interface LinkOptionsProps {\n  /**\n   * The standard anchor tag target attribute\n   */\n  target?: HTMLAnchorElement['target']\n  /**\n   * Configurable options to determine if the link should be considered active or not\n   * @default {exact:true,includeHash:true}\n   */\n  activeOptions?: ActiveOptions\n  /**\n   * The preloading strategy for this link\n   * - `false` - No preloading\n   * - `'intent'` - Preload the linked route on hover and cache it for this many milliseconds in hopes that the user will eventually navigate there.\n   * - `'viewport'` - Preload the linked route when it enters the viewport\n   */\n  preload?: false | 'intent' | 'viewport' | 'render'\n  /**\n   * When a preload strategy is set, this delays the preload by this many milliseconds.\n   * If the user exits the link before this delay, the preload will be cancelled.\n   */\n  preloadDelay?: number\n  /**\n   * Control whether the link should be disabled or not\n   * If set to `true`, the link will be rendered without an `href` attribute\n   * @default false\n   */\n  disabled?: boolean\n  /**\n   * When the preload strategy is set to `intent`, this controls the proximity of the link to the cursor before it is preloaded.\n   * If the user exits this proximity before this delay, the preload will be cancelled.\n   */\n  preloadIntentProximity?: number\n}\n\nexport type LinkOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & LinkOptionsProps\n\nexport const preloadWarning = 'Error preloading route! ☝️'\n"
  },
  {
    "path": "packages/router-core/src/load-matches.ts",
    "content": "import invariant from 'tiny-invariant'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { createControlledPromise, isPromise } from './utils'\nimport { isNotFound } from './not-found'\nimport { rootRouteId } from './root'\nimport { isRedirect } from './redirect'\nimport type { NotFoundError } from './not-found'\nimport type { ParsedLocation } from './location'\nimport type {\n  AnyRoute,\n  BeforeLoadContextOptions,\n  LoaderFnContext,\n  SsrContextOptions,\n} from './route'\nimport type { AnyRouteMatch, MakeRouteMatch } from './Matches'\nimport type { AnyRouter, SSROption, UpdateMatchFn } from './router'\n\n/**\n * An object of this shape is created when calling `loadMatches`.\n * It contains everything we need for all other functions in this file\n * to work. (It's basically the function's argument, plus a few mutable states)\n */\ntype InnerLoadContext = {\n  /** the calling router instance */\n  router: AnyRouter\n  location: ParsedLocation\n  /** mutable state, scoped to a `loadMatches` call */\n  firstBadMatchIndex?: number\n  /** mutable state, scoped to a `loadMatches` call */\n  rendered?: boolean\n  serialError?: unknown\n  updateMatch: UpdateMatchFn\n  matches: Array<AnyRouteMatch>\n  preload?: boolean\n  forceStaleReload?: boolean\n  onReady?: () => Promise<void>\n  sync?: boolean\n}\n\nconst triggerOnReady = (inner: InnerLoadContext): void | Promise<void> => {\n  if (!inner.rendered) {\n    inner.rendered = true\n    return inner.onReady?.()\n  }\n}\n\nconst hasForcePendingActiveMatch = (router: AnyRouter): boolean => {\n  return router.stores.matchesId.state.some((matchId) => {\n    return router.stores.activeMatchStoresById.get(matchId)?.state._forcePending\n  })\n}\n\nconst resolvePreload = (inner: InnerLoadContext, matchId: string): boolean => {\n  return !!(\n    inner.preload && !inner.router.stores.activeMatchStoresById.has(matchId)\n  )\n}\n\n/**\n * Builds the accumulated context from router options and all matches up to (and optionally including) the given index.\n * Merges __routeContext and __beforeLoadContext from each match.\n */\nconst buildMatchContext = (\n  inner: InnerLoadContext,\n  index: number,\n  includeCurrentMatch: boolean = true,\n): Record<string, unknown> => {\n  const context: Record<string, unknown> = {\n    ...(inner.router.options.context ?? {}),\n  }\n  const end = includeCurrentMatch ? index : index - 1\n  for (let i = 0; i <= end; i++) {\n    const innerMatch = inner.matches[i]\n    if (!innerMatch) continue\n    const m = inner.router.getMatch(innerMatch.id)\n    if (!m) continue\n    Object.assign(context, m.__routeContext, m.__beforeLoadContext)\n  }\n  return context\n}\n\nconst getNotFoundBoundaryIndex = (\n  inner: InnerLoadContext,\n  err: NotFoundError,\n): number | undefined => {\n  if (!inner.matches.length) {\n    return undefined\n  }\n\n  const requestedRouteId = err.routeId\n  const matchedRootIndex = inner.matches.findIndex(\n    (m) => m.routeId === inner.router.routeTree.id,\n  )\n  const rootIndex = matchedRootIndex >= 0 ? matchedRootIndex : 0\n\n  let startIndex = requestedRouteId\n    ? inner.matches.findIndex((match) => match.routeId === requestedRouteId)\n    : (inner.firstBadMatchIndex ?? inner.matches.length - 1)\n\n  if (startIndex < 0) {\n    startIndex = rootIndex\n  }\n\n  for (let i = startIndex; i >= 0; i--) {\n    const match = inner.matches[i]!\n    const route = inner.router.looseRoutesById[match.routeId]!\n    if (route.options.notFoundComponent) {\n      return i\n    }\n  }\n\n  // If no boundary component is found, preserve explicit routeId targeting behavior,\n  // otherwise default to root for untargeted notFounds.\n  return requestedRouteId ? startIndex : rootIndex\n}\n\nconst handleRedirectAndNotFound = (\n  inner: InnerLoadContext,\n  match: AnyRouteMatch | undefined,\n  err: unknown,\n): void => {\n  if (!isRedirect(err) && !isNotFound(err)) return\n\n  if (isRedirect(err) && err.redirectHandled && !err.options.reloadDocument) {\n    throw err\n  }\n\n  // in case of a redirecting match during preload, the match does not exist\n  if (match) {\n    match._nonReactive.beforeLoadPromise?.resolve()\n    match._nonReactive.loaderPromise?.resolve()\n    match._nonReactive.beforeLoadPromise = undefined\n    match._nonReactive.loaderPromise = undefined\n\n    match._nonReactive.error = err\n\n    inner.updateMatch(match.id, (prev) => ({\n      ...prev,\n      status: isRedirect(err)\n        ? 'redirected'\n        : prev.status === 'pending'\n          ? 'success'\n          : prev.status,\n      context: buildMatchContext(inner, match.index),\n      isFetching: false,\n      error: err,\n    }))\n\n    if (isNotFound(err) && !err.routeId) {\n      // Stamp the throwing match's routeId so that the finalization step in\n      // loadMatches knows where the notFound originated.  The actual boundary\n      // resolution (walking up to the nearest notFoundComponent) is deferred to\n      // the finalization step, where firstBadMatchIndex is stable and\n      // headMaxIndex can be capped correctly.\n      err.routeId = match.routeId\n    }\n\n    match._nonReactive.loadPromise?.resolve()\n  }\n\n  if (isRedirect(err)) {\n    inner.rendered = true\n    err.options._fromLocation = inner.location\n    err.redirectHandled = true\n    err = inner.router.resolveRedirect(err)\n  }\n\n  throw err\n}\n\nconst shouldSkipLoader = (\n  inner: InnerLoadContext,\n  matchId: string,\n): boolean => {\n  const match = inner.router.getMatch(matchId)\n  if (!match) {\n    return true\n  }\n  // upon hydration, we skip the loader if the match has been dehydrated on the server\n  if (!(isServer ?? inner.router.isServer) && match._nonReactive.dehydrated) {\n    return true\n  }\n\n  if ((isServer ?? inner.router.isServer) && match.ssr === false) {\n    return true\n  }\n\n  return false\n}\n\nconst syncMatchContext = (\n  inner: InnerLoadContext,\n  matchId: string,\n  index: number,\n): void => {\n  const nextContext = buildMatchContext(inner, index)\n\n  inner.updateMatch(matchId, (prev) => {\n    return {\n      ...prev,\n      context: nextContext,\n    }\n  })\n}\n\nconst handleSerialError = (\n  inner: InnerLoadContext,\n  index: number,\n  err: any,\n  routerCode: string,\n): void => {\n  const { id: matchId, routeId } = inner.matches[index]!\n  const route = inner.router.looseRoutesById[routeId]!\n\n  // Much like suspense, we use a promise here to know if\n  // we've been outdated by a new loadMatches call and\n  // should abort the current async operation\n  if (err instanceof Promise) {\n    throw err\n  }\n\n  err.routerCode = routerCode\n  inner.firstBadMatchIndex ??= index\n  handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err)\n\n  try {\n    route.options.onError?.(err)\n  } catch (errorHandlerErr) {\n    err = errorHandlerErr\n    handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), err)\n  }\n\n  inner.updateMatch(matchId, (prev) => {\n    prev._nonReactive.beforeLoadPromise?.resolve()\n    prev._nonReactive.beforeLoadPromise = undefined\n    prev._nonReactive.loadPromise?.resolve()\n\n    return {\n      ...prev,\n      error: err,\n      status: 'error',\n      isFetching: false,\n      updatedAt: Date.now(),\n      abortController: new AbortController(),\n    }\n  })\n\n  if (!inner.preload && !isRedirect(err) && !isNotFound(err)) {\n    inner.serialError ??= err\n  }\n}\n\nconst isBeforeLoadSsr = (\n  inner: InnerLoadContext,\n  matchId: string,\n  index: number,\n  route: AnyRoute,\n): void | Promise<void> => {\n  const existingMatch = inner.router.getMatch(matchId)!\n  const parentMatchId = inner.matches[index - 1]?.id\n  const parentMatch = parentMatchId\n    ? inner.router.getMatch(parentMatchId)!\n    : undefined\n\n  // in SPA mode, only SSR the root route\n  if (inner.router.isShell()) {\n    existingMatch.ssr = route.id === rootRouteId\n    return\n  }\n\n  if (parentMatch?.ssr === false) {\n    existingMatch.ssr = false\n    return\n  }\n\n  const parentOverride = (tempSsr: SSROption) => {\n    if (tempSsr === true && parentMatch?.ssr === 'data-only') {\n      return 'data-only'\n    }\n    return tempSsr\n  }\n\n  const defaultSsr = inner.router.options.defaultSsr ?? true\n\n  if (route.options.ssr === undefined) {\n    existingMatch.ssr = parentOverride(defaultSsr)\n    return\n  }\n\n  if (typeof route.options.ssr !== 'function') {\n    existingMatch.ssr = parentOverride(route.options.ssr)\n    return\n  }\n  const { search, params } = existingMatch\n\n  const ssrFnContext: SsrContextOptions<any, any, any> = {\n    search: makeMaybe(search, existingMatch.searchError),\n    params: makeMaybe(params, existingMatch.paramsError),\n    location: inner.location,\n    matches: inner.matches.map((match) => ({\n      index: match.index,\n      pathname: match.pathname,\n      fullPath: match.fullPath,\n      staticData: match.staticData,\n      id: match.id,\n      routeId: match.routeId,\n      search: makeMaybe(match.search, match.searchError),\n      params: makeMaybe(match.params, match.paramsError),\n      ssr: match.ssr,\n    })),\n  }\n\n  const tempSsr = route.options.ssr(ssrFnContext)\n  if (isPromise(tempSsr)) {\n    return tempSsr.then((ssr) => {\n      existingMatch.ssr = parentOverride(ssr ?? defaultSsr)\n    })\n  }\n\n  existingMatch.ssr = parentOverride(tempSsr ?? defaultSsr)\n  return\n}\n\nconst setupPendingTimeout = (\n  inner: InnerLoadContext,\n  matchId: string,\n  route: AnyRoute,\n  match: AnyRouteMatch,\n): void => {\n  if (match._nonReactive.pendingTimeout !== undefined) return\n\n  const pendingMs =\n    route.options.pendingMs ?? inner.router.options.defaultPendingMs\n  const shouldPending = !!(\n    inner.onReady &&\n    !(isServer ?? inner.router.isServer) &&\n    !resolvePreload(inner, matchId) &&\n    (route.options.loader ||\n      route.options.beforeLoad ||\n      routeNeedsPreload(route)) &&\n    typeof pendingMs === 'number' &&\n    pendingMs !== Infinity &&\n    (route.options.pendingComponent ??\n      (inner.router.options as any)?.defaultPendingComponent)\n  )\n\n  if (shouldPending) {\n    const pendingTimeout = setTimeout(() => {\n      // Update the match and prematurely resolve the loadMatches promise so that\n      // the pending component can start rendering\n      triggerOnReady(inner)\n    }, pendingMs)\n    match._nonReactive.pendingTimeout = pendingTimeout\n  }\n}\n\nconst preBeforeLoadSetup = (\n  inner: InnerLoadContext,\n  matchId: string,\n  route: AnyRoute,\n): void | Promise<void> => {\n  const existingMatch = inner.router.getMatch(matchId)!\n\n  // If we are in the middle of a load, either of these will be present\n  // (not to be confused with `loadPromise`, which is always defined)\n  if (\n    !existingMatch._nonReactive.beforeLoadPromise &&\n    !existingMatch._nonReactive.loaderPromise\n  )\n    return\n\n  setupPendingTimeout(inner, matchId, route, existingMatch)\n\n  const then = () => {\n    const match = inner.router.getMatch(matchId)!\n    if (\n      match.preload &&\n      (match.status === 'redirected' || match.status === 'notFound')\n    ) {\n      handleRedirectAndNotFound(inner, match, match.error)\n    }\n  }\n\n  // Wait for the previous beforeLoad to resolve before we continue\n  return existingMatch._nonReactive.beforeLoadPromise\n    ? existingMatch._nonReactive.beforeLoadPromise.then(then)\n    : then()\n}\n\nconst executeBeforeLoad = (\n  inner: InnerLoadContext,\n  matchId: string,\n  index: number,\n  route: AnyRoute,\n): void | Promise<void> => {\n  const match = inner.router.getMatch(matchId)!\n\n  // explicitly capture the previous loadPromise\n  let prevLoadPromise = match._nonReactive.loadPromise\n  match._nonReactive.loadPromise = createControlledPromise<void>(() => {\n    prevLoadPromise?.resolve()\n    prevLoadPromise = undefined\n  })\n\n  const { paramsError, searchError } = match\n\n  if (paramsError) {\n    handleSerialError(inner, index, paramsError, 'PARSE_PARAMS')\n  }\n\n  if (searchError) {\n    handleSerialError(inner, index, searchError, 'VALIDATE_SEARCH')\n  }\n\n  setupPendingTimeout(inner, matchId, route, match)\n\n  const abortController = new AbortController()\n\n  let isPending = false\n  const pending = () => {\n    if (isPending) return\n    isPending = true\n    inner.updateMatch(matchId, (prev) => ({\n      ...prev,\n      isFetching: 'beforeLoad',\n      fetchCount: prev.fetchCount + 1,\n      abortController,\n      // Note: We intentionally don't update context here.\n      // Context should only be updated after beforeLoad resolves to avoid\n      // components seeing incomplete context during async beforeLoad execution.\n    }))\n  }\n\n  const resolve = () => {\n    match._nonReactive.beforeLoadPromise?.resolve()\n    match._nonReactive.beforeLoadPromise = undefined\n    inner.updateMatch(matchId, (prev) => ({\n      ...prev,\n      isFetching: false,\n    }))\n  }\n\n  // if there is no `beforeLoad` option, just mark as pending and resolve\n  // Context will be updated later in loadRouteMatch after loader completes\n  if (!route.options.beforeLoad) {\n    inner.router.batch(() => {\n      pending()\n      resolve()\n    })\n    return\n  }\n\n  match._nonReactive.beforeLoadPromise = createControlledPromise<void>()\n\n  // Build context from all parent matches, excluding current match's __beforeLoadContext\n  // (since we're about to execute beforeLoad for this match)\n  const context = {\n    ...buildMatchContext(inner, index, false),\n    ...match.__routeContext,\n  }\n  const { search, params, cause } = match\n  const preload = resolvePreload(inner, matchId)\n  const beforeLoadFnContext: BeforeLoadContextOptions<\n    any,\n    any,\n    any,\n    any,\n    any,\n    any,\n    any,\n    any,\n    any\n  > = {\n    search,\n    abortController,\n    params,\n    preload,\n    context,\n    location: inner.location,\n    navigate: (opts: any) =>\n      inner.router.navigate({\n        ...opts,\n        _fromLocation: inner.location,\n      }),\n    buildLocation: inner.router.buildLocation,\n    cause: preload ? 'preload' : cause,\n    matches: inner.matches,\n    routeId: route.id,\n    ...inner.router.options.additionalContext,\n  }\n\n  const updateContext = (beforeLoadContext: any) => {\n    if (beforeLoadContext === undefined) {\n      inner.router.batch(() => {\n        pending()\n        resolve()\n      })\n      return\n    }\n    if (isRedirect(beforeLoadContext) || isNotFound(beforeLoadContext)) {\n      pending()\n      handleSerialError(inner, index, beforeLoadContext, 'BEFORE_LOAD')\n    }\n\n    inner.router.batch(() => {\n      pending()\n      inner.updateMatch(matchId, (prev) => ({\n        ...prev,\n        __beforeLoadContext: beforeLoadContext,\n      }))\n      resolve()\n    })\n  }\n\n  let beforeLoadContext\n  try {\n    beforeLoadContext = route.options.beforeLoad(beforeLoadFnContext)\n    if (isPromise(beforeLoadContext)) {\n      pending()\n      return beforeLoadContext\n        .catch((err) => {\n          handleSerialError(inner, index, err, 'BEFORE_LOAD')\n        })\n        .then(updateContext)\n    }\n  } catch (err) {\n    pending()\n    handleSerialError(inner, index, err, 'BEFORE_LOAD')\n  }\n\n  updateContext(beforeLoadContext)\n  return\n}\n\nconst handleBeforeLoad = (\n  inner: InnerLoadContext,\n  index: number,\n): void | Promise<void> => {\n  const { id: matchId, routeId } = inner.matches[index]!\n  const route = inner.router.looseRoutesById[routeId]!\n\n  const serverSsr = () => {\n    // on the server, determine whether SSR the current match or not\n    if (isServer ?? inner.router.isServer) {\n      const maybePromise = isBeforeLoadSsr(inner, matchId, index, route)\n      if (isPromise(maybePromise)) return maybePromise.then(queueExecution)\n    }\n    return queueExecution()\n  }\n\n  const execute = () => executeBeforeLoad(inner, matchId, index, route)\n\n  const queueExecution = () => {\n    if (shouldSkipLoader(inner, matchId)) return\n    const result = preBeforeLoadSetup(inner, matchId, route)\n    return isPromise(result) ? result.then(execute) : execute()\n  }\n\n  return serverSsr()\n}\n\nconst executeHead = (\n  inner: InnerLoadContext,\n  matchId: string,\n  route: AnyRoute,\n): void | Promise<\n  Pick<\n    AnyRouteMatch,\n    'meta' | 'links' | 'headScripts' | 'headers' | 'scripts' | 'styles'\n  >\n> => {\n  const match = inner.router.getMatch(matchId)\n  // in case of a redirecting match during preload, the match does not exist\n  if (!match) {\n    return\n  }\n  if (!route.options.head && !route.options.scripts && !route.options.headers) {\n    return\n  }\n  const assetContext = {\n    ssr: inner.router.options.ssr,\n    matches: inner.matches,\n    match,\n    params: match.params,\n    loaderData: match.loaderData,\n  }\n\n  return Promise.all([\n    route.options.head?.(assetContext),\n    route.options.scripts?.(assetContext),\n    route.options.headers?.(assetContext),\n  ]).then(([headFnContent, scripts, headers]) => {\n    const meta = headFnContent?.meta\n    const links = headFnContent?.links\n    const headScripts = headFnContent?.scripts\n    const styles = headFnContent?.styles\n\n    return {\n      meta,\n      links,\n      headScripts,\n      headers,\n      scripts,\n      styles,\n    }\n  })\n}\n\nconst getLoaderContext = (\n  inner: InnerLoadContext,\n  matchPromises: Array<Promise<AnyRouteMatch>>,\n  matchId: string,\n  index: number,\n  route: AnyRoute,\n): LoaderFnContext => {\n  const parentMatchPromise = matchPromises[index - 1] as any\n  const { params, loaderDeps, abortController, cause } =\n    inner.router.getMatch(matchId)!\n\n  const context = buildMatchContext(inner, index)\n\n  const preload = resolvePreload(inner, matchId)\n\n  return {\n    params,\n    deps: loaderDeps,\n    preload: !!preload,\n    parentMatchPromise,\n    abortController,\n    context,\n    location: inner.location,\n    navigate: (opts) =>\n      inner.router.navigate({\n        ...opts,\n        _fromLocation: inner.location,\n      }),\n    cause: preload ? 'preload' : cause,\n    route,\n    ...inner.router.options.additionalContext,\n  }\n}\n\nconst runLoader = async (\n  inner: InnerLoadContext,\n  matchPromises: Array<Promise<AnyRouteMatch>>,\n  matchId: string,\n  index: number,\n  route: AnyRoute,\n): Promise<void> => {\n  try {\n    // If the Matches component rendered\n    // the pending component and needs to show it for\n    // a minimum duration, we''ll wait for it to resolve\n    // before committing to the match and resolving\n    // the loadPromise\n\n    const match = inner.router.getMatch(matchId)!\n\n    // Actually run the loader and handle the result\n    try {\n      if (!(isServer ?? inner.router.isServer) || match.ssr === true) {\n        loadRouteChunk(route)\n      }\n\n      // Kick off the loader!\n      const routeLoader = route.options.loader\n      const loader =\n        typeof routeLoader === 'function' ? routeLoader : routeLoader?.handler\n      const loaderResult = loader?.(\n        getLoaderContext(inner, matchPromises, matchId, index, route),\n      )\n      const loaderResultIsPromise = !!loader && isPromise(loaderResult)\n\n      const willLoadSomething = !!(\n        loaderResultIsPromise ||\n        route._lazyPromise ||\n        route._componentsPromise ||\n        route.options.head ||\n        route.options.scripts ||\n        route.options.headers ||\n        match._nonReactive.minPendingPromise\n      )\n\n      if (willLoadSomething) {\n        inner.updateMatch(matchId, (prev) => ({\n          ...prev,\n          isFetching: 'loader',\n        }))\n      }\n\n      if (loader) {\n        const loaderData = loaderResultIsPromise\n          ? await loaderResult\n          : loaderResult\n\n        handleRedirectAndNotFound(\n          inner,\n          inner.router.getMatch(matchId),\n          loaderData,\n        )\n        if (loaderData !== undefined) {\n          inner.updateMatch(matchId, (prev) => ({\n            ...prev,\n            loaderData,\n          }))\n        }\n      }\n\n      // Lazy option can modify the route options,\n      // so we need to wait for it to resolve before\n      // we can use the options\n      if (route._lazyPromise) await route._lazyPromise\n      const pendingPromise = match._nonReactive.minPendingPromise\n      if (pendingPromise) await pendingPromise\n\n      // Last but not least, wait for the the components\n      // to be preloaded before we resolve the match\n      if (route._componentsPromise) await route._componentsPromise\n      inner.updateMatch(matchId, (prev) => ({\n        ...prev,\n        error: undefined,\n        context: buildMatchContext(inner, index),\n        status: 'success',\n        isFetching: false,\n        updatedAt: Date.now(),\n      }))\n    } catch (e) {\n      let error = e\n\n      if ((error as any)?.name === 'AbortError') {\n        if (match.abortController.signal.aborted) {\n          match._nonReactive.loaderPromise?.resolve()\n          match._nonReactive.loaderPromise = undefined\n          return\n        }\n        inner.updateMatch(matchId, (prev) => ({\n          ...prev,\n          status: prev.status === 'pending' ? 'success' : prev.status,\n          isFetching: false,\n          context: buildMatchContext(inner, index),\n        }))\n        return\n      }\n\n      const pendingPromise = match._nonReactive.minPendingPromise\n      if (pendingPromise) await pendingPromise\n\n      if (isNotFound(e)) {\n        await (route.options.notFoundComponent as any)?.preload?.()\n      }\n\n      handleRedirectAndNotFound(inner, inner.router.getMatch(matchId), e)\n\n      try {\n        route.options.onError?.(e)\n      } catch (onErrorError) {\n        error = onErrorError\n        handleRedirectAndNotFound(\n          inner,\n          inner.router.getMatch(matchId),\n          onErrorError,\n        )\n      }\n      if (!isRedirect(error) && !isNotFound(error)) {\n        await loadRouteChunk(route, ['errorComponent'])\n      }\n\n      inner.updateMatch(matchId, (prev) => ({\n        ...prev,\n        error,\n        context: buildMatchContext(inner, index),\n        status: 'error',\n        isFetching: false,\n      }))\n    }\n  } catch (err) {\n    const match = inner.router.getMatch(matchId)\n    // in case of a redirecting match during preload, the match does not exist\n    if (match) {\n      match._nonReactive.loaderPromise = undefined\n    }\n    handleRedirectAndNotFound(inner, match, err)\n  }\n}\n\nconst loadRouteMatch = async (\n  inner: InnerLoadContext,\n  matchPromises: Array<Promise<AnyRouteMatch>>,\n  index: number,\n): Promise<AnyRouteMatch> => {\n  async function handleLoader(\n    preload: boolean,\n    prevMatch: AnyRouteMatch,\n    previousRouteMatchId: string | undefined,\n    match: AnyRouteMatch,\n    route: AnyRoute,\n  ) {\n    const age = Date.now() - prevMatch.updatedAt\n\n    const staleAge = preload\n      ? (route.options.preloadStaleTime ??\n        inner.router.options.defaultPreloadStaleTime ??\n        30_000) // 30 seconds for preloads by default\n      : (route.options.staleTime ?? inner.router.options.defaultStaleTime ?? 0)\n\n    const shouldReloadOption = route.options.shouldReload\n\n    // Default to reloading the route all the time\n    // Allow shouldReload to get the last say,\n    // if provided.\n    const shouldReload =\n      typeof shouldReloadOption === 'function'\n        ? shouldReloadOption(\n            getLoaderContext(inner, matchPromises, matchId, index, route),\n          )\n        : shouldReloadOption\n\n    // If the route is successful and still fresh, just resolve\n    const { status, invalid } = match\n    const staleMatchShouldReload =\n      age >= staleAge &&\n      (!!inner.forceStaleReload ||\n        match.cause === 'enter' ||\n        (previousRouteMatchId !== undefined &&\n          previousRouteMatchId !== match.id))\n    loaderShouldRunAsync =\n      status === 'success' &&\n      (invalid || (shouldReload ?? staleMatchShouldReload))\n    if (preload && route.options.preload === false) {\n      // Do nothing\n    } else if (\n      loaderShouldRunAsync &&\n      !inner.sync &&\n      shouldReloadInBackground\n    ) {\n      loaderIsRunningAsync = true\n      ;(async () => {\n        try {\n          await runLoader(inner, matchPromises, matchId, index, route)\n          const match = inner.router.getMatch(matchId)!\n          match._nonReactive.loaderPromise?.resolve()\n          match._nonReactive.loadPromise?.resolve()\n          match._nonReactive.loaderPromise = undefined\n          match._nonReactive.loadPromise = undefined\n        } catch (err) {\n          if (isRedirect(err)) {\n            await inner.router.navigate(err.options)\n          }\n        }\n      })()\n    } else if (status !== 'success' || loaderShouldRunAsync) {\n      await runLoader(inner, matchPromises, matchId, index, route)\n    } else {\n      syncMatchContext(inner, matchId, index)\n    }\n  }\n\n  const { id: matchId, routeId } = inner.matches[index]!\n  let loaderShouldRunAsync = false\n  let loaderIsRunningAsync = false\n  const route = inner.router.looseRoutesById[routeId]!\n  const routeLoader = route.options.loader\n  const shouldReloadInBackground =\n    ((typeof routeLoader === 'function'\n      ? undefined\n      : routeLoader?.staleReloadMode) ??\n      inner.router.options.defaultStaleReloadMode) !== 'blocking'\n\n  if (shouldSkipLoader(inner, matchId)) {\n    const match = inner.router.getMatch(matchId)\n    if (!match) {\n      return inner.matches[index]!\n    }\n\n    syncMatchContext(inner, matchId, index)\n\n    if (isServer ?? inner.router.isServer) {\n      return inner.router.getMatch(matchId)!\n    }\n  } else {\n    const prevMatch = inner.router.getMatch(matchId)! // This is where all of the stale-while-revalidate magic happens\n    const activeIdAtIndex = inner.router.stores.matchesId.state[index]\n    const activeAtIndex =\n      (activeIdAtIndex &&\n        inner.router.stores.activeMatchStoresById.get(activeIdAtIndex)) ||\n      null\n    const previousRouteMatchId =\n      activeAtIndex?.routeId === routeId\n        ? activeIdAtIndex\n        : inner.router.stores.activeMatchesSnapshot.state.find(\n            (d) => d.routeId === routeId,\n          )?.id\n    const preload = resolvePreload(inner, matchId)\n\n    // there is a loaderPromise, so we are in the middle of a load\n    if (prevMatch._nonReactive.loaderPromise) {\n      // do not block if we already have stale data we can show\n      // but only if the ongoing load is not a preload since error handling is different for preloads\n      // and we don't want to swallow errors\n      if (\n        prevMatch.status === 'success' &&\n        !inner.sync &&\n        !prevMatch.preload &&\n        shouldReloadInBackground\n      ) {\n        return prevMatch\n      }\n      await prevMatch._nonReactive.loaderPromise\n      const match = inner.router.getMatch(matchId)!\n      const error = match._nonReactive.error || match.error\n      if (error) {\n        handleRedirectAndNotFound(inner, match, error)\n      }\n\n      if (match.status === 'pending') {\n        await handleLoader(\n          preload,\n          prevMatch,\n          previousRouteMatchId,\n          match,\n          route,\n        )\n      }\n    } else {\n      const nextPreload =\n        preload && !inner.router.stores.activeMatchStoresById.has(matchId)\n      const match = inner.router.getMatch(matchId)!\n      match._nonReactive.loaderPromise = createControlledPromise<void>()\n      if (nextPreload !== match.preload) {\n        inner.updateMatch(matchId, (prev) => ({\n          ...prev,\n          preload: nextPreload,\n        }))\n      }\n\n      await handleLoader(preload, prevMatch, previousRouteMatchId, match, route)\n    }\n  }\n  const match = inner.router.getMatch(matchId)!\n  if (!loaderIsRunningAsync) {\n    match._nonReactive.loaderPromise?.resolve()\n    match._nonReactive.loadPromise?.resolve()\n    match._nonReactive.loadPromise = undefined\n  }\n\n  clearTimeout(match._nonReactive.pendingTimeout)\n  match._nonReactive.pendingTimeout = undefined\n  if (!loaderIsRunningAsync) match._nonReactive.loaderPromise = undefined\n  match._nonReactive.dehydrated = undefined\n\n  const nextIsFetching = loaderIsRunningAsync ? match.isFetching : false\n  if (nextIsFetching !== match.isFetching || match.invalid !== false) {\n    inner.updateMatch(matchId, (prev) => ({\n      ...prev,\n      isFetching: nextIsFetching,\n      invalid: false,\n    }))\n    return inner.router.getMatch(matchId)!\n  } else {\n    return match\n  }\n}\n\nexport async function loadMatches(arg: {\n  router: AnyRouter\n  location: ParsedLocation\n  matches: Array<AnyRouteMatch>\n  preload?: boolean\n  forceStaleReload?: boolean\n  onReady?: () => Promise<void>\n  updateMatch: UpdateMatchFn\n  sync?: boolean\n}): Promise<Array<MakeRouteMatch>> {\n  const inner: InnerLoadContext = arg\n  const matchPromises: Array<Promise<AnyRouteMatch>> = []\n\n  // make sure the pending component is immediately rendered when hydrating a match that is not SSRed\n  // the pending component was already rendered on the server and we want to keep it shown on the client until minPendingMs is reached\n  if (\n    !(isServer ?? inner.router.isServer) &&\n    hasForcePendingActiveMatch(inner.router)\n  ) {\n    triggerOnReady(inner)\n  }\n\n  let beforeLoadNotFound: NotFoundError | undefined\n\n  // Execute all beforeLoads one by one\n  for (let i = 0; i < inner.matches.length; i++) {\n    try {\n      const beforeLoad = handleBeforeLoad(inner, i)\n      if (isPromise(beforeLoad)) await beforeLoad\n    } catch (err) {\n      if (isRedirect(err)) {\n        throw err\n      }\n      if (isNotFound(err)) {\n        beforeLoadNotFound = err\n      } else {\n        if (!inner.preload) throw err\n      }\n      break\n    }\n\n    if (inner.serialError) {\n      break\n    }\n  }\n\n  // Execute loaders once, with max index adapted for beforeLoad notFound handling.\n  const baseMaxIndexExclusive = inner.firstBadMatchIndex ?? inner.matches.length\n\n  const boundaryIndex =\n    beforeLoadNotFound && !inner.preload\n      ? getNotFoundBoundaryIndex(inner, beforeLoadNotFound)\n      : undefined\n\n  const maxIndexExclusive =\n    beforeLoadNotFound && inner.preload\n      ? 0\n      : boundaryIndex !== undefined\n        ? Math.min(boundaryIndex + 1, baseMaxIndexExclusive)\n        : baseMaxIndexExclusive\n\n  let firstNotFound: NotFoundError | undefined\n  let firstUnhandledRejection: unknown\n\n  for (let i = 0; i < maxIndexExclusive; i++) {\n    matchPromises.push(loadRouteMatch(inner, matchPromises, i))\n  }\n\n  try {\n    await Promise.all(matchPromises)\n  } catch {\n    const settled = await Promise.allSettled(matchPromises)\n\n    for (const result of settled) {\n      if (result.status !== 'rejected') continue\n\n      const reason = result.reason\n      if (isRedirect(reason)) {\n        throw reason\n      }\n      if (isNotFound(reason)) {\n        firstNotFound ??= reason\n      } else {\n        firstUnhandledRejection ??= reason\n      }\n    }\n\n    if (firstUnhandledRejection !== undefined) {\n      throw firstUnhandledRejection\n    }\n  }\n\n  const notFoundToThrow =\n    firstNotFound ??\n    (beforeLoadNotFound && !inner.preload ? beforeLoadNotFound : undefined)\n\n  let headMaxIndex = inner.serialError\n    ? (inner.firstBadMatchIndex ?? 0)\n    : inner.matches.length - 1\n\n  if (!notFoundToThrow && beforeLoadNotFound && inner.preload) {\n    return inner.matches\n  }\n\n  if (notFoundToThrow) {\n    // Determine once which matched route will actually render the\n    // notFoundComponent, then pass this precomputed index through the remaining\n    // finalization steps.\n    // This can differ from the throwing route when routeId targets an ancestor\n    // boundary (or when bubbling resolves to a parent/root boundary).\n    const renderedBoundaryIndex = getNotFoundBoundaryIndex(\n      inner,\n      notFoundToThrow,\n    )\n\n    invariant(\n      renderedBoundaryIndex !== undefined,\n      'Could not find match for notFound boundary',\n    )\n    const boundaryMatch = inner.matches[renderedBoundaryIndex]!\n\n    const boundaryRoute = inner.router.looseRoutesById[boundaryMatch.routeId]!\n    const defaultNotFoundComponent = (inner.router.options as any)\n      ?.defaultNotFoundComponent\n\n    // Ensure a notFoundComponent exists on the boundary route\n    if (!boundaryRoute.options.notFoundComponent && defaultNotFoundComponent) {\n      boundaryRoute.options.notFoundComponent = defaultNotFoundComponent\n    }\n\n    notFoundToThrow.routeId = boundaryMatch.routeId\n\n    const boundaryIsRoot = boundaryMatch.routeId === inner.router.routeTree.id\n\n    inner.updateMatch(boundaryMatch.id, (prev) => ({\n      ...prev,\n      ...(boundaryIsRoot\n        ? // For root boundary, use globalNotFound so the root component's\n          // shell still renders and <Outlet> handles the not-found display,\n          // instead of replacing the entire root shell via status='notFound'.\n          { status: 'success' as const, globalNotFound: true, error: undefined }\n        : // For non-root boundaries, set status:'notFound' so MatchInner\n          // renders the notFoundComponent directly.\n          { status: 'notFound' as const, error: notFoundToThrow }),\n      isFetching: false,\n    }))\n\n    headMaxIndex = renderedBoundaryIndex\n\n    // Ensure the rendering boundary route chunk (and its lazy components, including\n    // lazy notFoundComponent) is loaded before we continue to head execution/render.\n    await loadRouteChunk(boundaryRoute, ['notFoundComponent'])\n  } else if (!inner.preload) {\n    // Clear stale root global-not-found state on normal navigations that do not\n    // throw notFound. This must live here (instead of only in runLoader success)\n    // because the root loader may be skipped when data is still fresh.\n    const rootMatch = inner.matches[0]!\n    // `rootMatch` is the next match for this navigation. If it is not global\n    // not-found, then any currently stored root global-not-found is stale.\n    if (!rootMatch.globalNotFound) {\n      // `currentRootMatch` is the current store state (from the previous\n      // navigation/load). Update only when a stale flag is actually present.\n      const currentRootMatch = inner.router.getMatch(rootMatch.id)\n      if (currentRootMatch?.globalNotFound) {\n        inner.updateMatch(rootMatch.id, (prev) => ({\n          ...prev,\n          globalNotFound: false,\n          error: undefined,\n        }))\n      }\n    }\n  }\n\n  // When a serial error occurred (e.g. beforeLoad threw a regular Error),\n  // the erroring route's lazy chunk wasn't loaded because loaders were skipped.\n  // We need to load it so the code-split errorComponent is available for rendering.\n  if (inner.serialError && inner.firstBadMatchIndex !== undefined) {\n    const errorRoute =\n      inner.router.looseRoutesById[\n        inner.matches[inner.firstBadMatchIndex]!.routeId\n      ]!\n    await loadRouteChunk(errorRoute, ['errorComponent'])\n  }\n\n  // serially execute heads once after loaders/notFound handling, ensuring\n  // all head functions get a chance even if one throws.\n  for (let i = 0; i <= headMaxIndex; i++) {\n    const match = inner.matches[i]!\n    const { id: matchId, routeId } = match\n    const route = inner.router.looseRoutesById[routeId]!\n    try {\n      const headResult = executeHead(inner, matchId, route)\n      if (headResult) {\n        const head = await headResult\n        inner.updateMatch(matchId, (prev) => ({\n          ...prev,\n          ...head,\n        }))\n      }\n    } catch (err) {\n      console.error(`Error executing head for route ${routeId}:`, err)\n    }\n  }\n\n  const readyPromise = triggerOnReady(inner)\n  if (isPromise(readyPromise)) {\n    await readyPromise\n  }\n\n  if (notFoundToThrow) {\n    throw notFoundToThrow\n  }\n\n  if (inner.serialError && !inner.preload && !inner.onReady) {\n    throw inner.serialError\n  }\n\n  return inner.matches\n}\n\nexport type RouteComponentType =\n  | 'component'\n  | 'errorComponent'\n  | 'pendingComponent'\n  | 'notFoundComponent'\n\nfunction preloadRouteComponents(\n  route: AnyRoute,\n  componentTypesToLoad: Array<RouteComponentType>,\n): Promise<void> | undefined {\n  const preloads = componentTypesToLoad\n    .map((type) => (route.options[type] as any)?.preload?.())\n    .filter(Boolean)\n\n  if (preloads.length === 0) return undefined\n\n  return Promise.all(preloads) as any as Promise<void>\n}\n\nexport function loadRouteChunk(\n  route: AnyRoute,\n  componentTypesToLoad: Array<RouteComponentType> = componentTypes,\n) {\n  if (!route._lazyLoaded && route._lazyPromise === undefined) {\n    if (route.lazyFn) {\n      route._lazyPromise = route.lazyFn().then((lazyRoute) => {\n        // explicitly don't copy over the lazy route's id\n        const { id: _id, ...options } = lazyRoute.options\n        Object.assign(route.options, options)\n        route._lazyLoaded = true\n        route._lazyPromise = undefined // gc promise, we won't need it anymore\n      })\n    } else {\n      route._lazyLoaded = true\n    }\n  }\n\n  const runAfterLazy = () =>\n    route._componentsLoaded\n      ? undefined\n      : componentTypesToLoad === componentTypes\n        ? (() => {\n            if (route._componentsPromise === undefined) {\n              const componentsPromise = preloadRouteComponents(\n                route,\n                componentTypes,\n              )\n\n              if (componentsPromise) {\n                route._componentsPromise = componentsPromise.then(() => {\n                  route._componentsLoaded = true\n                  route._componentsPromise = undefined // gc promise, we won't need it anymore\n                })\n              } else {\n                route._componentsLoaded = true\n              }\n            }\n\n            return route._componentsPromise\n          })()\n        : preloadRouteComponents(route, componentTypesToLoad)\n\n  return route._lazyPromise\n    ? route._lazyPromise.then(runAfterLazy)\n    : runAfterLazy()\n}\n\nfunction makeMaybe<TValue, TError>(\n  value: TValue,\n  error: TError,\n): { status: 'success'; value: TValue } | { status: 'error'; error: TError } {\n  if (error) {\n    return { status: 'error' as const, error }\n  }\n  return { status: 'success' as const, value }\n}\n\nexport function routeNeedsPreload(route: AnyRoute) {\n  for (const componentType of componentTypes) {\n    if ((route.options[componentType] as any)?.preload) {\n      return true\n    }\n  }\n  return false\n}\n\nexport const componentTypes: Array<RouteComponentType> = [\n  'component',\n  'errorComponent',\n  'pendingComponent',\n  'notFoundComponent',\n] as const\n"
  },
  {
    "path": "packages/router-core/src/location.ts",
    "content": "import type { ParsedHistoryState } from '@tanstack/history'\nimport type { AnySchema } from './validators'\n\nexport interface ParsedLocation<TSearchObj extends AnySchema = {}> {\n  /**\n   * The full path of the location, including pathname, search, and hash.\n   * Does not include the origin. Is the equivalent of calling\n   * `url.replace(url.origin, '')`\n   */\n  href: string\n  /**\n   * @description The pathname of the location, including the leading slash.\n   */\n  pathname: string\n  /**\n   * The parsed search parameters of the location in object form.\n   */\n  search: TSearchObj\n  /**\n   * The search string of the location, including the leading question mark.\n   */\n  searchStr: string\n  /**\n   * The in-memory state of the location as it *may* exist in the browser's history.\n   */\n  state: ParsedHistoryState\n  /**\n   * The hash of the location, excluding the leading hash character.\n   * (e.g., '123' instead of '#123')\n   */\n  hash: string\n  /**\n   * The masked location of the location.\n   */\n  maskedLocation?: ParsedLocation<TSearchObj>\n  /**\n   * Whether to unmask the location on reload.\n   */\n  unmaskOnReload?: boolean\n  /**\n   * @private\n   * @description The public href of the location.\n   * If a rewrite is applied, the `href` property will be the rewritten URL.\n   */\n  publicHref: string\n  /**\n   * @private\n   * @description Whether the publicHref is external (different origin from rewrite).\n   */\n  external: boolean\n}\n"
  },
  {
    "path": "packages/router-core/src/lru-cache.ts",
    "content": "export type LRUCache<TKey, TValue> = {\n  get: (key: TKey) => TValue | undefined\n  set: (key: TKey, value: TValue) => void\n  clear: () => void\n}\n\nexport function createLRUCache<TKey, TValue>(\n  max: number,\n): LRUCache<TKey, TValue> {\n  type Node = { prev?: Node; next?: Node; key: TKey; value: TValue }\n  const cache = new Map<TKey, Node>()\n  let oldest: Node | undefined\n  let newest: Node | undefined\n\n  const touch = (entry: Node) => {\n    if (!entry.next) return\n    if (!entry.prev) {\n      entry.next.prev = undefined\n      oldest = entry.next\n      entry.next = undefined\n      if (newest) {\n        entry.prev = newest\n        newest.next = entry\n      }\n    } else {\n      entry.prev.next = entry.next\n      entry.next.prev = entry.prev\n      entry.next = undefined\n      if (newest) {\n        newest.next = entry\n        entry.prev = newest\n      }\n    }\n    newest = entry\n  }\n\n  return {\n    get(key) {\n      const entry = cache.get(key)\n      if (!entry) return undefined\n      touch(entry)\n      return entry.value\n    },\n    set(key, value) {\n      if (cache.size >= max && oldest) {\n        const toDelete = oldest\n        cache.delete(toDelete.key)\n        if (toDelete.next) {\n          oldest = toDelete.next\n          toDelete.next.prev = undefined\n        }\n        if (toDelete === newest) {\n          newest = undefined\n        }\n      }\n      const existing = cache.get(key)\n      if (existing) {\n        existing.value = value\n        touch(existing)\n      } else {\n        const entry: Node = { key, value, prev: newest }\n        if (newest) newest.next = entry\n        newest = entry\n        if (!oldest) oldest = entry\n        cache.set(key, entry)\n      }\n    },\n    clear() {\n      cache.clear()\n      oldest = undefined\n      newest = undefined\n    },\n  }\n}\n"
  },
  {
    "path": "packages/router-core/src/manifest.ts",
    "content": "export type Manifest = {\n  routes: Record<\n    string,\n    {\n      filePath?: string\n      preloads?: Array<string>\n      assets?: Array<RouterManagedTag>\n    }\n  >\n}\n\nexport type RouterManagedTag =\n  | {\n      tag: 'title'\n      attrs?: Record<string, any>\n      children: string\n    }\n  | {\n      tag: 'meta' | 'link'\n      attrs?: Record<string, any>\n      children?: never\n    }\n  | {\n      tag: 'script'\n      attrs?: Record<string, any>\n      children?: string\n    }\n  | {\n      tag: 'style'\n      attrs?: Record<string, any>\n      children?: string\n    }\n"
  },
  {
    "path": "packages/router-core/src/new-process-route-tree.ts",
    "content": "import invariant from 'tiny-invariant'\nimport { createLRUCache } from './lru-cache'\nimport { last } from './utils'\nimport type { LRUCache } from './lru-cache'\n\nexport const SEGMENT_TYPE_PATHNAME = 0\nexport const SEGMENT_TYPE_PARAM = 1\nexport const SEGMENT_TYPE_WILDCARD = 2\nexport const SEGMENT_TYPE_OPTIONAL_PARAM = 3\nconst SEGMENT_TYPE_INDEX = 4\nconst SEGMENT_TYPE_PATHLESS = 5 // only used in matching to represent pathless routes that need to carry more information\n\n/**\n * All the kinds of segments that can be present in a route path.\n */\nexport type SegmentKind =\n  | typeof SEGMENT_TYPE_PATHNAME\n  | typeof SEGMENT_TYPE_PARAM\n  | typeof SEGMENT_TYPE_WILDCARD\n  | typeof SEGMENT_TYPE_OPTIONAL_PARAM\n\n/**\n * All the kinds of segments that can be present in the segment tree.\n */\ntype ExtendedSegmentKind =\n  | SegmentKind\n  | typeof SEGMENT_TYPE_INDEX\n  | typeof SEGMENT_TYPE_PATHLESS\n\nfunction getOpenAndCloseBraces(\n  part: string,\n): [openBrace: number, closeBrace: number] | null {\n  const openBrace = part.indexOf('{')\n  if (openBrace === -1) return null\n  const closeBrace = part.indexOf('}', openBrace)\n  if (closeBrace === -1) return null\n  const afterOpen = openBrace + 1\n  if (afterOpen >= part.length) return null\n  return [openBrace, closeBrace]\n}\n\ntype ParsedSegment = Uint16Array & {\n  /** segment type (0 = pathname, 1 = param, 2 = wildcard, 3 = optional param) */\n  0: SegmentKind\n  /** index of the end of the prefix */\n  1: number\n  /** index of the start of the value */\n  2: number\n  /** index of the end of the value */\n  3: number\n  /** index of the start of the suffix */\n  4: number\n  /** index of the end of the segment */\n  5: number\n}\n\n/**\n * Populates the `output` array with the parsed representation of the given `segment` string.\n *\n * Usage:\n * ```ts\n * let output\n * let cursor = 0\n * while (cursor < path.length) {\n *   output = parseSegment(path, cursor, output)\n *   const end = output[5]\n *   cursor = end + 1\n * ```\n *\n * `output` is stored outside to avoid allocations during repeated calls. It doesn't need to be typed\n * or initialized, it will be done automatically.\n */\nexport function parseSegment(\n  /** The full path string containing the segment. */\n  path: string,\n  /** The starting index of the segment within the path. */\n  start: number,\n  /** A Uint16Array (length: 6) to populate with the parsed segment data. */\n  output: Uint16Array = new Uint16Array(6),\n): ParsedSegment {\n  const next = path.indexOf('/', start)\n  const end = next === -1 ? path.length : next\n  const part = path.substring(start, end)\n\n  if (!part || !part.includes('$')) {\n    // early escape for static pathname\n    output[0] = SEGMENT_TYPE_PATHNAME\n    output[1] = start\n    output[2] = start\n    output[3] = end\n    output[4] = end\n    output[5] = end\n    return output as ParsedSegment\n  }\n\n  // $ (wildcard)\n  if (part === '$') {\n    const total = path.length\n    output[0] = SEGMENT_TYPE_WILDCARD\n    output[1] = start\n    output[2] = start\n    output[3] = total\n    output[4] = total\n    output[5] = total\n    return output as ParsedSegment\n  }\n\n  // $paramName\n  if (part.charCodeAt(0) === 36) {\n    output[0] = SEGMENT_TYPE_PARAM\n    output[1] = start\n    output[2] = start + 1 // skip '$'\n    output[3] = end\n    output[4] = end\n    output[5] = end\n    return output as ParsedSegment\n  }\n\n  const braces = getOpenAndCloseBraces(part)\n  if (braces) {\n    const [openBrace, closeBrace] = braces\n    const firstChar = part.charCodeAt(openBrace + 1)\n\n    // Check for {-$...} (optional param)\n    // prefix{-$paramName}suffix\n    // /^([^{]*)\\{-\\$([a-zA-Z_$][a-zA-Z0-9_$]*)\\}([^}]*)$/\n    if (firstChar === 45) {\n      // '-'\n      if (\n        openBrace + 2 < part.length &&\n        part.charCodeAt(openBrace + 2) === 36 // '$'\n      ) {\n        const paramStart = openBrace + 3\n        const paramEnd = closeBrace\n        // Validate param name exists\n        if (paramStart < paramEnd) {\n          output[0] = SEGMENT_TYPE_OPTIONAL_PARAM\n          output[1] = start + openBrace\n          output[2] = start + paramStart\n          output[3] = start + paramEnd\n          output[4] = start + closeBrace + 1\n          output[5] = end\n          return output as ParsedSegment\n        }\n      }\n    } else if (firstChar === 36) {\n      // '$'\n      const dollarPos = openBrace + 1\n      const afterDollar = openBrace + 2\n      // Check for {$} (wildcard)\n      if (afterDollar === closeBrace) {\n        // For wildcard, value should be '$' (from dollarPos to afterDollar)\n        // prefix{$}suffix\n        // /^([^{]*)\\{\\$\\}([^}]*)$/\n        output[0] = SEGMENT_TYPE_WILDCARD\n        output[1] = start + openBrace\n        output[2] = start + dollarPos\n        output[3] = start + afterDollar\n        output[4] = start + closeBrace + 1\n        output[5] = path.length\n        return output as ParsedSegment\n      }\n      // Regular param {$paramName} - value is the param name (after $)\n      // prefix{$paramName}suffix\n      // /^([^{]*)\\{\\$([a-zA-Z_$][a-zA-Z0-9_$]*)\\}([^}]*)$/\n      output[0] = SEGMENT_TYPE_PARAM\n      output[1] = start + openBrace\n      output[2] = start + afterDollar\n      output[3] = start + closeBrace\n      output[4] = start + closeBrace + 1\n      output[5] = end\n      return output as ParsedSegment\n    }\n  }\n\n  // fallback to static pathname (should never happen)\n  output[0] = SEGMENT_TYPE_PATHNAME\n  output[1] = start\n  output[2] = start\n  output[3] = end\n  output[4] = end\n  output[5] = end\n  return output as ParsedSegment\n}\n\n/**\n * Recursively parses the segments of the given route tree and populates a segment trie.\n *\n * @param data A reusable Uint16Array for parsing segments. (non important, we're just avoiding allocations)\n * @param route The current route to parse.\n * @param start The starting index for parsing within the route's full path.\n * @param node The current segment node in the trie to populate.\n * @param onRoute Callback invoked for each route processed.\n */\nfunction parseSegments<TRouteLike extends RouteLike>(\n  defaultCaseSensitive: boolean,\n  data: Uint16Array,\n  route: TRouteLike,\n  start: number,\n  node: AnySegmentNode<TRouteLike>,\n  depth: number,\n  onRoute?: (route: TRouteLike) => void,\n) {\n  onRoute?.(route)\n  let cursor = start\n  {\n    const path = route.fullPath ?? route.from\n    const length = path.length\n    const caseSensitive = route.options?.caseSensitive ?? defaultCaseSensitive\n    const skipOnParamError = !!(\n      route.options?.params?.parse &&\n      route.options?.skipRouteOnParseError?.params\n    )\n    while (cursor < length) {\n      const segment = parseSegment(path, cursor, data)\n      let nextNode: AnySegmentNode<TRouteLike>\n      const start = cursor\n      const end = segment[5]\n      cursor = end + 1\n      depth++\n      const kind = segment[0]\n      switch (kind) {\n        case SEGMENT_TYPE_PATHNAME: {\n          const value = path.substring(segment[2], segment[3])\n          if (caseSensitive) {\n            const existingNode = node.static?.get(value)\n            if (existingNode) {\n              nextNode = existingNode\n            } else {\n              node.static ??= new Map()\n              const next = createStaticNode<TRouteLike>(\n                route.fullPath ?? route.from,\n              )\n              next.parent = node\n              next.depth = depth\n              nextNode = next\n              node.static.set(value, next)\n            }\n          } else {\n            const name = value.toLowerCase()\n            const existingNode = node.staticInsensitive?.get(name)\n            if (existingNode) {\n              nextNode = existingNode\n            } else {\n              node.staticInsensitive ??= new Map()\n              const next = createStaticNode<TRouteLike>(\n                route.fullPath ?? route.from,\n              )\n              next.parent = node\n              next.depth = depth\n              nextNode = next\n              node.staticInsensitive.set(name, next)\n            }\n          }\n          break\n        }\n        case SEGMENT_TYPE_PARAM: {\n          const prefix_raw = path.substring(start, segment[1])\n          const suffix_raw = path.substring(segment[4], end)\n          const actuallyCaseSensitive =\n            caseSensitive && !!(prefix_raw || suffix_raw)\n          const prefix = !prefix_raw\n            ? undefined\n            : actuallyCaseSensitive\n              ? prefix_raw\n              : prefix_raw.toLowerCase()\n          const suffix = !suffix_raw\n            ? undefined\n            : actuallyCaseSensitive\n              ? suffix_raw\n              : suffix_raw.toLowerCase()\n          const existingNode =\n            !skipOnParamError &&\n            node.dynamic?.find(\n              (s) =>\n                !s.skipOnParamError &&\n                s.caseSensitive === actuallyCaseSensitive &&\n                s.prefix === prefix &&\n                s.suffix === suffix,\n            )\n          if (existingNode) {\n            nextNode = existingNode\n          } else {\n            const next = createDynamicNode<TRouteLike>(\n              SEGMENT_TYPE_PARAM,\n              route.fullPath ?? route.from,\n              actuallyCaseSensitive,\n              prefix,\n              suffix,\n            )\n            nextNode = next\n            next.depth = depth\n            next.parent = node\n            node.dynamic ??= []\n            node.dynamic.push(next)\n          }\n          break\n        }\n        case SEGMENT_TYPE_OPTIONAL_PARAM: {\n          const prefix_raw = path.substring(start, segment[1])\n          const suffix_raw = path.substring(segment[4], end)\n          const actuallyCaseSensitive =\n            caseSensitive && !!(prefix_raw || suffix_raw)\n          const prefix = !prefix_raw\n            ? undefined\n            : actuallyCaseSensitive\n              ? prefix_raw\n              : prefix_raw.toLowerCase()\n          const suffix = !suffix_raw\n            ? undefined\n            : actuallyCaseSensitive\n              ? suffix_raw\n              : suffix_raw.toLowerCase()\n          const existingNode =\n            !skipOnParamError &&\n            node.optional?.find(\n              (s) =>\n                !s.skipOnParamError &&\n                s.caseSensitive === actuallyCaseSensitive &&\n                s.prefix === prefix &&\n                s.suffix === suffix,\n            )\n          if (existingNode) {\n            nextNode = existingNode\n          } else {\n            const next = createDynamicNode<TRouteLike>(\n              SEGMENT_TYPE_OPTIONAL_PARAM,\n              route.fullPath ?? route.from,\n              actuallyCaseSensitive,\n              prefix,\n              suffix,\n            )\n            nextNode = next\n            next.parent = node\n            next.depth = depth\n            node.optional ??= []\n            node.optional.push(next)\n          }\n          break\n        }\n        case SEGMENT_TYPE_WILDCARD: {\n          const prefix_raw = path.substring(start, segment[1])\n          const suffix_raw = path.substring(segment[4], end)\n          const actuallyCaseSensitive =\n            caseSensitive && !!(prefix_raw || suffix_raw)\n          const prefix = !prefix_raw\n            ? undefined\n            : actuallyCaseSensitive\n              ? prefix_raw\n              : prefix_raw.toLowerCase()\n          const suffix = !suffix_raw\n            ? undefined\n            : actuallyCaseSensitive\n              ? suffix_raw\n              : suffix_raw.toLowerCase()\n          const next = createDynamicNode<TRouteLike>(\n            SEGMENT_TYPE_WILDCARD,\n            route.fullPath ?? route.from,\n            actuallyCaseSensitive,\n            prefix,\n            suffix,\n          )\n          nextNode = next\n          next.parent = node\n          next.depth = depth\n          node.wildcard ??= []\n          node.wildcard.push(next)\n        }\n      }\n      node = nextNode\n    }\n\n    // create pathless node\n    if (\n      skipOnParamError &&\n      route.children &&\n      !route.isRoot &&\n      route.id &&\n      route.id.charCodeAt(route.id.lastIndexOf('/') + 1) === 95 /* '_' */\n    ) {\n      const pathlessNode = createStaticNode<TRouteLike>(\n        route.fullPath ?? route.from,\n      )\n      pathlessNode.kind = SEGMENT_TYPE_PATHLESS\n      pathlessNode.parent = node\n      depth++\n      pathlessNode.depth = depth\n      node.pathless ??= []\n      node.pathless.push(pathlessNode)\n      node = pathlessNode\n    }\n\n    const isLeaf = (route.path || !route.children) && !route.isRoot\n    // create index node\n    if (isLeaf && path.endsWith('/')) {\n      const indexNode = createStaticNode<TRouteLike>(\n        route.fullPath ?? route.from,\n      )\n      indexNode.kind = SEGMENT_TYPE_INDEX\n      indexNode.parent = node\n      depth++\n      indexNode.depth = depth\n      node.index = indexNode\n      node = indexNode\n    }\n\n    node.parse = route.options?.params?.parse ?? null\n    node.skipOnParamError = skipOnParamError\n    node.parsingPriority = route.options?.skipRouteOnParseError?.priority ?? 0\n\n    // make node \"matchable\"\n    if (isLeaf && !node.route) {\n      node.route = route\n      node.fullPath = route.fullPath ?? route.from\n    }\n  }\n  if (route.children)\n    for (const child of route.children) {\n      parseSegments(\n        defaultCaseSensitive,\n        data,\n        child as TRouteLike,\n        cursor,\n        node,\n        depth,\n        onRoute,\n      )\n    }\n}\n\nfunction sortDynamic(\n  a: {\n    prefix?: string\n    suffix?: string\n    caseSensitive: boolean\n    skipOnParamError: boolean\n    parsingPriority: number\n  },\n  b: {\n    prefix?: string\n    suffix?: string\n    caseSensitive: boolean\n    skipOnParamError: boolean\n    parsingPriority: number\n  },\n) {\n  if (a.skipOnParamError && !b.skipOnParamError) return -1\n  if (!a.skipOnParamError && b.skipOnParamError) return 1\n  if (\n    a.skipOnParamError &&\n    b.skipOnParamError &&\n    (a.parsingPriority || b.parsingPriority)\n  )\n    return b.parsingPriority - a.parsingPriority\n  if (a.prefix && b.prefix && a.prefix !== b.prefix) {\n    if (a.prefix.startsWith(b.prefix)) return -1\n    if (b.prefix.startsWith(a.prefix)) return 1\n  }\n  if (a.suffix && b.suffix && a.suffix !== b.suffix) {\n    if (a.suffix.endsWith(b.suffix)) return -1\n    if (b.suffix.endsWith(a.suffix)) return 1\n  }\n  if (a.prefix && !b.prefix) return -1\n  if (!a.prefix && b.prefix) return 1\n  if (a.suffix && !b.suffix) return -1\n  if (!a.suffix && b.suffix) return 1\n  if (a.caseSensitive && !b.caseSensitive) return -1\n  if (!a.caseSensitive && b.caseSensitive) return 1\n\n  // we don't need a tiebreaker here\n  // at this point the 2 nodes cannot conflict during matching\n  return 0\n}\n\nfunction sortTreeNodes(node: SegmentNode<RouteLike>) {\n  if (node.pathless) {\n    for (const child of node.pathless) {\n      sortTreeNodes(child)\n    }\n  }\n  if (node.static) {\n    for (const child of node.static.values()) {\n      sortTreeNodes(child)\n    }\n  }\n  if (node.staticInsensitive) {\n    for (const child of node.staticInsensitive.values()) {\n      sortTreeNodes(child)\n    }\n  }\n  if (node.dynamic?.length) {\n    node.dynamic.sort(sortDynamic)\n    for (const child of node.dynamic) {\n      sortTreeNodes(child)\n    }\n  }\n  if (node.optional?.length) {\n    node.optional.sort(sortDynamic)\n    for (const child of node.optional) {\n      sortTreeNodes(child)\n    }\n  }\n  if (node.wildcard?.length) {\n    node.wildcard.sort(sortDynamic)\n    for (const child of node.wildcard) {\n      sortTreeNodes(child)\n    }\n  }\n}\n\nfunction createStaticNode<T extends RouteLike>(\n  fullPath: string,\n): StaticSegmentNode<T> {\n  return {\n    kind: SEGMENT_TYPE_PATHNAME,\n    depth: 0,\n    pathless: null,\n    index: null,\n    static: null,\n    staticInsensitive: null,\n    dynamic: null,\n    optional: null,\n    wildcard: null,\n    route: null,\n    fullPath,\n    parent: null,\n    parse: null,\n    skipOnParamError: false,\n    parsingPriority: 0,\n  }\n}\n\n/**\n * Keys must be declared in the same order as in `SegmentNode` type,\n * to ensure they are represented as the same object class in the engine.\n */\nfunction createDynamicNode<T extends RouteLike>(\n  kind:\n    | typeof SEGMENT_TYPE_PARAM\n    | typeof SEGMENT_TYPE_WILDCARD\n    | typeof SEGMENT_TYPE_OPTIONAL_PARAM,\n  fullPath: string,\n  caseSensitive: boolean,\n  prefix?: string,\n  suffix?: string,\n): DynamicSegmentNode<T> {\n  return {\n    kind,\n    depth: 0,\n    pathless: null,\n    index: null,\n    static: null,\n    staticInsensitive: null,\n    dynamic: null,\n    optional: null,\n    wildcard: null,\n    route: null,\n    fullPath,\n    parent: null,\n    parse: null,\n    skipOnParamError: false,\n    parsingPriority: 0,\n    caseSensitive,\n    prefix,\n    suffix,\n  }\n}\n\ntype StaticSegmentNode<T extends RouteLike> = SegmentNode<T> & {\n  kind:\n    | typeof SEGMENT_TYPE_PATHNAME\n    | typeof SEGMENT_TYPE_PATHLESS\n    | typeof SEGMENT_TYPE_INDEX\n}\n\ntype DynamicSegmentNode<T extends RouteLike> = SegmentNode<T> & {\n  kind:\n    | typeof SEGMENT_TYPE_PARAM\n    | typeof SEGMENT_TYPE_WILDCARD\n    | typeof SEGMENT_TYPE_OPTIONAL_PARAM\n  prefix?: string\n  suffix?: string\n  caseSensitive: boolean\n}\n\ntype AnySegmentNode<T extends RouteLike> =\n  | StaticSegmentNode<T>\n  | DynamicSegmentNode<T>\n\ntype SegmentNode<T extends RouteLike> = {\n  kind: ExtendedSegmentKind\n\n  pathless: Array<StaticSegmentNode<T>> | null\n\n  /** Exact index segment (highest priority) */\n  index: StaticSegmentNode<T> | null\n\n  /** Static segments (2nd priority) */\n  static: Map<string, StaticSegmentNode<T>> | null\n\n  /** Case insensitive static segments (3rd highest priority) */\n  staticInsensitive: Map<string, StaticSegmentNode<T>> | null\n\n  /** Dynamic segments ($param) */\n  dynamic: Array<DynamicSegmentNode<T>> | null\n\n  /** Optional dynamic segments ({-$param}) */\n  optional: Array<DynamicSegmentNode<T>> | null\n\n  /** Wildcard segments ($ - lowest priority) */\n  wildcard: Array<DynamicSegmentNode<T>> | null\n\n  /** Terminal route (if this path can end here) */\n  route: T | null\n\n  /** The full path for this segment node (will only be valid on leaf nodes) */\n  fullPath: string\n\n  parent: AnySegmentNode<T> | null\n\n  depth: number\n\n  /** route.options.params.parse function, set on the last node of the route */\n  parse: null | ((params: Record<string, string>) => any)\n\n  /** options.skipRouteOnParseError.params ?? false */\n  skipOnParamError: boolean\n\n  /** options.skipRouteOnParseError.priority ?? 0 */\n  parsingPriority: number\n}\n\ntype RouteLike = {\n  id?: string\n  path?: string // relative path from the parent,\n  children?: Array<RouteLike> // child routes,\n  parentRoute?: RouteLike // parent route,\n  isRoot?: boolean\n  options?: {\n    skipRouteOnParseError?: {\n      params?: boolean\n      priority?: number\n    }\n    caseSensitive?: boolean\n    params?: {\n      parse?: (params: Record<string, string>) => any\n    }\n  }\n} &\n  // router tree\n  (| { fullPath: string; from?: never } // full path from the root\n    // flat route masks list\n    | { fullPath?: never; from: string } // full path from the root\n  )\n\nexport type ProcessedTree<\n  TTree extends Extract<RouteLike, { fullPath: string }>,\n  TFlat extends Extract<RouteLike, { from: string }>,\n  TSingle extends Extract<RouteLike, { from: string }>,\n> = {\n  /** a representation of the `routeTree` as a segment tree */\n  segmentTree: AnySegmentNode<TTree>\n  /** a mini route tree generated from the flat `routeMasks` list */\n  masksTree: AnySegmentNode<TFlat> | null\n  /** @deprecated keep until v2 so that `router.matchRoute` can keep not caring about the actual route tree */\n  singleCache: LRUCache<string, AnySegmentNode<TSingle>>\n  /** a cache of route matches from the `segmentTree` */\n  matchCache: LRUCache<string, RouteMatch<TTree> | null>\n  /** a cache of route matches from the `masksTree` */\n  flatCache: LRUCache<string, ReturnType<typeof findMatch<TFlat>>> | null\n}\n\nexport function processRouteMasks<\n  TRouteLike extends Extract<RouteLike, { from: string }>,\n>(\n  routeList: Array<TRouteLike>,\n  processedTree: ProcessedTree<any, TRouteLike, any>,\n) {\n  const segmentTree = createStaticNode<TRouteLike>('/')\n  const data = new Uint16Array(6)\n  for (const route of routeList) {\n    parseSegments(false, data, route, 1, segmentTree, 0)\n  }\n  sortTreeNodes(segmentTree)\n  processedTree.masksTree = segmentTree\n  processedTree.flatCache = createLRUCache<\n    string,\n    ReturnType<typeof findMatch<TRouteLike>>\n  >(1000)\n}\n\n/**\n * Take an arbitrary list of routes, create a tree from them (if it hasn't been created already), and match a path against it.\n */\nexport function findFlatMatch<T extends Extract<RouteLike, { from: string }>>(\n  /** The path to match. */\n  path: string,\n  /** The `processedTree` returned by the initial `processRouteTree` call. */\n  processedTree: ProcessedTree<any, T, any>,\n) {\n  path ||= '/'\n  const cached = processedTree.flatCache!.get(path)\n  if (cached) return cached\n  const result = findMatch(path, processedTree.masksTree!)\n  processedTree.flatCache!.set(path, result)\n  return result\n}\n\n/**\n * @deprecated keep until v2 so that `router.matchRoute` can keep not caring about the actual route tree\n */\nexport function findSingleMatch(\n  from: string,\n  caseSensitive: boolean,\n  fuzzy: boolean,\n  path: string,\n  processedTree: ProcessedTree<any, any, { from: string }>,\n) {\n  from ||= '/'\n  path ||= '/'\n  const key = caseSensitive ? `case\\0${from}` : from\n  let tree = processedTree.singleCache.get(key)\n  if (!tree) {\n    // single flat routes (router.matchRoute) are not eagerly processed,\n    // if we haven't seen this route before, process it now\n    tree = createStaticNode<{ from: string }>('/')\n    const data = new Uint16Array(6)\n    parseSegments(caseSensitive, data, { from }, 1, tree, 0)\n    processedTree.singleCache.set(key, tree)\n  }\n  return findMatch(path, tree, fuzzy)\n}\n\ntype RouteMatch<T extends Extract<RouteLike, { fullPath: string }>> = {\n  route: T\n  rawParams: Record<string, string>\n  parsedParams?: Record<string, unknown>\n  branch: ReadonlyArray<T>\n}\n\nexport function findRouteMatch<\n  T extends Extract<RouteLike, { fullPath: string }>,\n>(\n  /** The path to match against the route tree. */\n  path: string,\n  /** The `processedTree` returned by the initial `processRouteTree` call. */\n  processedTree: ProcessedTree<T, any, any>,\n  /** If `true`, allows fuzzy matching (partial matches), i.e. which node in the tree would have been an exact match if the `path` had been shorter? */\n  fuzzy = false,\n): RouteMatch<T> | null {\n  const key = fuzzy ? path : `nofuzz\\0${path}` // the main use for `findRouteMatch` is fuzzy:true, so we optimize for that case\n  const cached = processedTree.matchCache.get(key)\n  if (cached !== undefined) return cached\n  path ||= '/'\n  let result: RouteMatch<T> | null\n\n  try {\n    result = findMatch(\n      path,\n      processedTree.segmentTree,\n      fuzzy,\n    ) as RouteMatch<T> | null\n  } catch (err) {\n    if (err instanceof URIError) {\n      result = null\n    } else {\n      throw err\n    }\n  }\n\n  if (result) result.branch = buildRouteBranch(result.route)\n  processedTree.matchCache.set(key, result)\n  return result\n}\n\n/** Trim trailing slashes (except preserving root '/'). */\nexport function trimPathRight(path: string) {\n  return path === '/' ? path : path.replace(/\\/{1,}$/, '')\n}\n\nexport interface ProcessRouteTreeResult<\n  TRouteLike extends Extract<RouteLike, { fullPath: string }> & { id: string },\n> {\n  /** Should be considered a black box, needs to be provided to all matching functions in this module. */\n  processedTree: ProcessedTree<TRouteLike, any, any>\n  /** A lookup map of routes by their unique IDs. */\n  routesById: Record<string, TRouteLike>\n  /** A lookup map of routes by their trimmed full paths. */\n  routesByPath: Record<string, TRouteLike>\n}\n\n/**\n * Processes a route tree into a segment trie for efficient path matching.\n * Also builds lookup maps for routes by ID and by trimmed full path.\n */\nexport function processRouteTree<\n  TRouteLike extends Extract<RouteLike, { fullPath: string }> & { id: string },\n>(\n  /** The root of the route tree to process. */\n  routeTree: TRouteLike,\n  /** Whether matching should be case sensitive by default (overridden by individual route options). */\n  caseSensitive: boolean = false,\n  /** Optional callback invoked for each route during processing. */\n  initRoute?: (route: TRouteLike, index: number) => void,\n): ProcessRouteTreeResult<TRouteLike> {\n  const segmentTree = createStaticNode<TRouteLike>(routeTree.fullPath)\n  const data = new Uint16Array(6)\n  const routesById = {} as Record<string, TRouteLike>\n  const routesByPath = {} as Record<string, TRouteLike>\n  let index = 0\n  parseSegments(caseSensitive, data, routeTree, 1, segmentTree, 0, (route) => {\n    initRoute?.(route, index)\n\n    invariant(\n      !(route.id in routesById),\n      `Duplicate routes found with id: ${String(route.id)}`,\n    )\n\n    routesById[route.id] = route\n\n    if (index !== 0 && route.path) {\n      const trimmedFullPath = trimPathRight(route.fullPath)\n      if (!routesByPath[trimmedFullPath] || route.fullPath.endsWith('/')) {\n        routesByPath[trimmedFullPath] = route\n      }\n    }\n\n    index++\n  })\n  sortTreeNodes(segmentTree)\n  const processedTree: ProcessedTree<TRouteLike, any, any> = {\n    segmentTree,\n    singleCache: createLRUCache<string, AnySegmentNode<any>>(1000),\n    matchCache: createLRUCache<string, RouteMatch<TRouteLike> | null>(1000),\n    flatCache: null,\n    masksTree: null,\n  }\n  return {\n    processedTree,\n    routesById,\n    routesByPath,\n  }\n}\n\nfunction findMatch<T extends RouteLike>(\n  path: string,\n  segmentTree: AnySegmentNode<T>,\n  fuzzy = false,\n): {\n  route: T\n  /**\n   * The raw (unparsed) params extracted from the path.\n   * This will be the exhaustive list of all params defined in the route's path.\n   */\n  rawParams: Record<string, string>\n  /**\n   * The accumlulated parsed params of each route in the branch that had `skipRouteOnParseError` enabled.\n   * Will not contain all params defined in the route's path. Those w/ a `params.parse` but no `skipRouteOnParseError` will need to be parsed separately.\n   */\n  parsedParams?: Record<string, unknown>\n} | null {\n  const parts = path.split('/')\n  const leaf = getNodeMatch(path, parts, segmentTree, fuzzy)\n  if (!leaf) return null\n  const [rawParams] = extractParams(path, parts, leaf)\n  return {\n    route: leaf.node.route!,\n    rawParams,\n    parsedParams: leaf.parsedParams,\n  }\n}\n\ntype ParamExtractionState = {\n  part: number\n  node: number\n  path: number\n  segment: number\n}\n\n/**\n * This function is \"resumable\":\n * - the `leaf` input can contain `extract` and `rawParams` properties from a previous `extractParams` call\n * - the returned `state` can be passed back as `extract` in a future call to continue extracting params from where we left off\n *\n * Inputs are *not* mutated.\n */\nfunction extractParams<T extends RouteLike>(\n  path: string,\n  parts: Array<string>,\n  leaf: {\n    node: AnySegmentNode<T>\n    skipped: number\n    extract?: ParamExtractionState\n    rawParams?: Record<string, string>\n  },\n): [rawParams: Record<string, string>, state: ParamExtractionState] {\n  const list = buildBranch(leaf.node)\n  let nodeParts: Array<string> | null = null\n  const rawParams: Record<string, string> = Object.create(null)\n  /** which segment of the path we're currently processing */\n  let partIndex = leaf.extract?.part ?? 0\n  /** which node of the route tree branch we're currently processing */\n  let nodeIndex = leaf.extract?.node ?? 0\n  /** index of the 1st character of the segment we're processing in the path string */\n  let pathIndex = leaf.extract?.path ?? 0\n  /** which fullPath segment we're currently processing */\n  let segmentCount = leaf.extract?.segment ?? 0\n  for (\n    ;\n    nodeIndex < list.length;\n    partIndex++, nodeIndex++, pathIndex++, segmentCount++\n  ) {\n    const node = list[nodeIndex]!\n    // index nodes are terminating nodes, nothing to extract, just leave\n    if (node.kind === SEGMENT_TYPE_INDEX) break\n    // pathless nodes do not consume a path segment\n    if (node.kind === SEGMENT_TYPE_PATHLESS) {\n      segmentCount--\n      partIndex--\n      pathIndex--\n      continue\n    }\n    const part = parts[partIndex]\n    const currentPathIndex = pathIndex\n    if (part) pathIndex += part.length\n    if (node.kind === SEGMENT_TYPE_PARAM) {\n      nodeParts ??= leaf.node.fullPath.split('/')\n      const nodePart = nodeParts[segmentCount]!\n      const preLength = node.prefix?.length ?? 0\n      // we can't rely on the presence of prefix/suffix to know whether it's curly-braced or not, because `/{$param}/` is valid, but has no prefix/suffix\n      const isCurlyBraced = nodePart.charCodeAt(preLength) === 123 // '{'\n      // param name is extracted at match-time so that tree nodes that are identical except for param name can share the same node\n      if (isCurlyBraced) {\n        const sufLength = node.suffix?.length ?? 0\n        const name = nodePart.substring(\n          preLength + 2,\n          nodePart.length - sufLength - 1,\n        )\n        const value = part!.substring(preLength, part!.length - sufLength)\n        rawParams[name] = decodeURIComponent(value)\n      } else {\n        const name = nodePart.substring(1)\n        rawParams[name] = decodeURIComponent(part!)\n      }\n    } else if (node.kind === SEGMENT_TYPE_OPTIONAL_PARAM) {\n      if (leaf.skipped & (1 << nodeIndex)) {\n        partIndex-- // stay on the same part\n        pathIndex = currentPathIndex - 1 // undo pathIndex advancement; -1 to account for loop increment\n        continue\n      }\n      nodeParts ??= leaf.node.fullPath.split('/')\n      const nodePart = nodeParts[segmentCount]!\n      const preLength = node.prefix?.length ?? 0\n      const sufLength = node.suffix?.length ?? 0\n      const name = nodePart.substring(\n        preLength + 3,\n        nodePart.length - sufLength - 1,\n      )\n      const value =\n        node.suffix || node.prefix\n          ? part!.substring(preLength, part!.length - sufLength)\n          : part\n      if (value) rawParams[name] = decodeURIComponent(value)\n    } else if (node.kind === SEGMENT_TYPE_WILDCARD) {\n      const n = node\n      const value = path.substring(\n        currentPathIndex + (n.prefix?.length ?? 0),\n        path.length - (n.suffix?.length ?? 0),\n      )\n      const splat = decodeURIComponent(value)\n      // TODO: Deprecate *\n      rawParams['*'] = splat\n      rawParams._splat = splat\n      break\n    }\n  }\n  if (leaf.rawParams) Object.assign(rawParams, leaf.rawParams)\n  return [\n    rawParams,\n    {\n      part: partIndex,\n      node: nodeIndex,\n      path: pathIndex,\n      segment: segmentCount,\n    },\n  ]\n}\n\nfunction buildRouteBranch<T extends RouteLike>(route: T) {\n  const list = [route]\n  while (route.parentRoute) {\n    route = route.parentRoute as T\n    list.push(route)\n  }\n  list.reverse()\n  return list\n}\n\nfunction buildBranch<T extends RouteLike>(node: AnySegmentNode<T>) {\n  const list: Array<AnySegmentNode<T>> = Array(node.depth + 1)\n  do {\n    list[node.depth] = node\n    node = node.parent!\n  } while (node)\n  return list\n}\n\ntype MatchStackFrame<T extends RouteLike> = {\n  node: AnySegmentNode<T>\n  /** index of the segment of path */\n  index: number\n  /** how many nodes between `node` and the root of the segment tree */\n  depth: number\n  /**\n   * Bitmask of skipped optional segments.\n   *\n   * This is a very performant way of storing an \"array of booleans\", but it means beyond 32 segments we can't track skipped optionals.\n   * If we really really need to support more than 32 segments we can switch to using a `BigInt` here. It's about 2x slower in worst case scenarios.\n   */\n  skipped: number\n  statics: number\n  dynamics: number\n  optionals: number\n  /** intermediary state for param extraction */\n  extract?: ParamExtractionState\n  /** intermediary params from param extraction */\n  rawParams?: Record<string, string>\n  parsedParams?: Record<string, unknown>\n}\n\nfunction getNodeMatch<T extends RouteLike>(\n  path: string,\n  parts: Array<string>,\n  segmentTree: AnySegmentNode<T>,\n  fuzzy: boolean,\n) {\n  // quick check for root index\n  // this is an optimization, algorithm should work correctly without this block\n  if (path === '/' && segmentTree.index)\n    return { node: segmentTree.index, skipped: 0 } as Pick<\n      Frame,\n      'node' | 'skipped' | 'parsedParams'\n    >\n\n  const trailingSlash = !last(parts)\n  const pathIsIndex = trailingSlash && path !== '/'\n  const partsLength = parts.length - (trailingSlash ? 1 : 0)\n\n  type Frame = MatchStackFrame<T>\n\n  // use a stack to explore all possible paths (params cause branching)\n  // iterate \"backwards\" (low priority first) so that we can push() each candidate, and pop() the highest priority candidate first\n  // - pros: it is depth-first, so we find full matches faster\n  // - cons: we cannot short-circuit, because highest priority matches are at the end of the loop (for loop with i--) (but we have no good short-circuiting anyway)\n  // other possible approaches:\n  // - shift instead of pop (measure performance difference), this allows iterating \"forwards\" (effectively breadth-first)\n  // - never remove from the stack, keep a cursor instead. Then we can push \"forwards\" and avoid reversing the order of candidates (effectively breadth-first)\n  const stack: Array<Frame> = [\n    {\n      node: segmentTree,\n      index: 1,\n      skipped: 0,\n      depth: 1,\n      statics: 1,\n      dynamics: 0,\n      optionals: 0,\n    },\n  ]\n\n  let wildcardMatch: Frame | null = null\n  let bestFuzzy: Frame | null = null\n  let bestMatch: Frame | null = null\n\n  while (stack.length) {\n    const frame = stack.pop()!\n    const { node, index, skipped, depth, statics, dynamics, optionals } = frame\n    let { extract, rawParams, parsedParams } = frame\n\n    if (node.skipOnParamError) {\n      const result = validateMatchParams(path, parts, frame)\n      if (!result) continue\n      rawParams = frame.rawParams\n      extract = frame.extract\n      parsedParams = frame.parsedParams\n    }\n\n    // In fuzzy mode, track the best partial match we've found so far\n    if (\n      fuzzy &&\n      node.route &&\n      node.kind !== SEGMENT_TYPE_INDEX &&\n      isFrameMoreSpecific(bestFuzzy, frame)\n    ) {\n      bestFuzzy = frame\n    }\n\n    const isBeyondPath = index === partsLength\n    if (isBeyondPath) {\n      if (node.route && !pathIsIndex && isFrameMoreSpecific(bestMatch, frame)) {\n        bestMatch = frame\n      }\n      // beyond the length of the path parts, only some segment types can match\n      if (!node.optional && !node.wildcard && !node.index && !node.pathless)\n        continue\n    }\n\n    const part = isBeyondPath ? undefined : parts[index]!\n    let lowerPart: string\n\n    // 0. Try index match\n    if (isBeyondPath && node.index) {\n      const indexFrame = {\n        node: node.index,\n        index,\n        skipped,\n        depth: depth + 1,\n        statics,\n        dynamics,\n        optionals,\n        extract,\n        rawParams,\n        parsedParams,\n      }\n      let indexValid = true\n      if (node.index.skipOnParamError) {\n        const result = validateMatchParams(path, parts, indexFrame)\n        if (!result) indexValid = false\n      }\n      if (indexValid) {\n        // perfect match, no need to continue\n        // this is an optimization, algorithm should work correctly without this block\n        if (statics === partsLength && !dynamics && !optionals && !skipped) {\n          return indexFrame\n        }\n        if (isFrameMoreSpecific(bestMatch, indexFrame)) {\n          // index matches skip the stack because they cannot have children\n          bestMatch = indexFrame\n        }\n      }\n    }\n\n    // 5. Try wildcard match\n    if (node.wildcard && isFrameMoreSpecific(wildcardMatch, frame)) {\n      for (const segment of node.wildcard) {\n        const { prefix, suffix } = segment\n        if (prefix) {\n          if (isBeyondPath) continue\n          const casePart = segment.caseSensitive\n            ? part\n            : (lowerPart ??= part!.toLowerCase())\n          if (!casePart!.startsWith(prefix)) continue\n        }\n        if (suffix) {\n          if (isBeyondPath) continue\n          const end = parts.slice(index).join('/').slice(-suffix.length)\n          const casePart = segment.caseSensitive ? end : end.toLowerCase()\n          if (casePart !== suffix) continue\n        }\n        // the first wildcard match is the highest priority one\n        // wildcard matches skip the stack because they cannot have children\n        const frame = {\n          node: segment,\n          index: partsLength,\n          skipped,\n          depth,\n          statics,\n          dynamics,\n          optionals,\n          extract,\n          rawParams,\n          parsedParams,\n        }\n        if (segment.skipOnParamError) {\n          const result = validateMatchParams(path, parts, frame)\n          if (!result) continue\n        }\n        wildcardMatch = frame\n        break\n      }\n    }\n\n    // 4. Try optional match\n    if (node.optional) {\n      const nextSkipped = skipped | (1 << depth)\n      const nextDepth = depth + 1\n      for (let i = node.optional.length - 1; i >= 0; i--) {\n        const segment = node.optional[i]!\n        // when skipping, node and depth advance by 1, but index doesn't\n        stack.push({\n          node: segment,\n          index,\n          skipped: nextSkipped,\n          depth: nextDepth,\n          statics,\n          dynamics,\n          optionals,\n          extract,\n          rawParams,\n          parsedParams,\n        }) // enqueue skipping the optional\n      }\n      if (!isBeyondPath) {\n        for (let i = node.optional.length - 1; i >= 0; i--) {\n          const segment = node.optional[i]!\n          const { prefix, suffix } = segment\n          if (prefix || suffix) {\n            const casePart = segment.caseSensitive\n              ? part!\n              : (lowerPart ??= part!.toLowerCase())\n            if (prefix && !casePart.startsWith(prefix)) continue\n            if (suffix && !casePart.endsWith(suffix)) continue\n          }\n          stack.push({\n            node: segment,\n            index: index + 1,\n            skipped,\n            depth: nextDepth,\n            statics,\n            dynamics,\n            optionals: optionals + 1,\n            extract,\n            rawParams,\n            parsedParams,\n          })\n        }\n      }\n    }\n\n    // 3. Try dynamic match\n    if (!isBeyondPath && node.dynamic && part) {\n      for (let i = node.dynamic.length - 1; i >= 0; i--) {\n        const segment = node.dynamic[i]!\n        const { prefix, suffix } = segment\n        if (prefix || suffix) {\n          const casePart = segment.caseSensitive\n            ? part\n            : (lowerPart ??= part.toLowerCase())\n          if (prefix && !casePart.startsWith(prefix)) continue\n          if (suffix && !casePart.endsWith(suffix)) continue\n        }\n        stack.push({\n          node: segment,\n          index: index + 1,\n          skipped,\n          depth: depth + 1,\n          statics,\n          dynamics: dynamics + 1,\n          optionals,\n          extract,\n          rawParams,\n          parsedParams,\n        })\n      }\n    }\n\n    // 2. Try case insensitive static match\n    if (!isBeyondPath && node.staticInsensitive) {\n      const match = node.staticInsensitive.get(\n        (lowerPart ??= part!.toLowerCase()),\n      )\n      if (match) {\n        stack.push({\n          node: match,\n          index: index + 1,\n          skipped,\n          depth: depth + 1,\n          statics: statics + 1,\n          dynamics,\n          optionals,\n          extract,\n          rawParams,\n          parsedParams,\n        })\n      }\n    }\n\n    // 1. Try static match\n    if (!isBeyondPath && node.static) {\n      const match = node.static.get(part!)\n      if (match) {\n        stack.push({\n          node: match,\n          index: index + 1,\n          skipped,\n          depth: depth + 1,\n          statics: statics + 1,\n          dynamics,\n          optionals,\n          extract,\n          rawParams,\n          parsedParams,\n        })\n      }\n    }\n\n    // 0. Try pathless match\n    if (node.pathless) {\n      const nextDepth = depth + 1\n      for (let i = node.pathless.length - 1; i >= 0; i--) {\n        const segment = node.pathless[i]!\n        stack.push({\n          node: segment,\n          index,\n          skipped,\n          depth: nextDepth,\n          statics,\n          dynamics,\n          optionals,\n          extract,\n          rawParams,\n          parsedParams,\n        })\n      }\n    }\n  }\n\n  if (bestMatch && wildcardMatch) {\n    return isFrameMoreSpecific(wildcardMatch, bestMatch)\n      ? bestMatch\n      : wildcardMatch\n  }\n\n  if (bestMatch) return bestMatch\n\n  if (wildcardMatch) return wildcardMatch\n\n  if (fuzzy && bestFuzzy) {\n    let sliceIndex = bestFuzzy.index\n    for (let i = 0; i < bestFuzzy.index; i++) {\n      sliceIndex += parts[i]!.length\n    }\n    const splat = sliceIndex === path.length ? '/' : path.slice(sliceIndex)\n    bestFuzzy.rawParams ??= Object.create(null)\n    bestFuzzy.rawParams!['**'] = decodeURIComponent(splat)\n    return bestFuzzy\n  }\n\n  return null\n}\n\nfunction validateMatchParams<T extends RouteLike>(\n  path: string,\n  parts: Array<string>,\n  frame: MatchStackFrame<T>,\n) {\n  try {\n    const [rawParams, state] = extractParams(path, parts, frame)\n    frame.rawParams = rawParams\n    frame.extract = state\n    const parsed = frame.node.parse!(rawParams)\n    frame.parsedParams = Object.assign(\n      Object.create(null),\n      frame.parsedParams,\n      parsed,\n    )\n    return true\n  } catch {\n    return null\n  }\n}\n\nfunction isFrameMoreSpecific(\n  // the stack frame previously saved as \"best match\"\n  prev: MatchStackFrame<any> | null,\n  // the candidate stack frame\n  next: MatchStackFrame<any>,\n): boolean {\n  if (!prev) return true\n  return (\n    next.statics > prev.statics ||\n    (next.statics === prev.statics &&\n      (next.dynamics > prev.dynamics ||\n        (next.dynamics === prev.dynamics &&\n          (next.optionals > prev.optionals ||\n            (next.optionals === prev.optionals &&\n              ((next.node.kind === SEGMENT_TYPE_INDEX) >\n                (prev.node.kind === SEGMENT_TYPE_INDEX) ||\n                ((next.node.kind === SEGMENT_TYPE_INDEX) ===\n                  (prev.node.kind === SEGMENT_TYPE_INDEX) &&\n                  next.depth > prev.depth)))))))\n  )\n}\n"
  },
  {
    "path": "packages/router-core/src/not-found.ts",
    "content": "import type { RouteIds } from './routeInfo'\nimport type { RegisteredRouter } from './router'\n\nexport type NotFoundError = {\n  /**\n    @deprecated\n    Use `routeId: rootRouteId` instead\n  */\n  global?: boolean\n  /**\n    @private\n    Do not use this. It's used internally to indicate a path matching error\n  */\n  _global?: boolean\n  data?: any\n  throw?: boolean\n  routeId?: RouteIds<RegisteredRouter['routeTree']>\n  headers?: HeadersInit\n}\n\n/**\n * Create a not-found error object recognized by TanStack Router.\n *\n * Throw this from loaders/actions to trigger the nearest `notFoundComponent`.\n * Use `routeId` to target a specific route's not-found boundary. If `throw`\n * is true, the error is thrown instead of returned.\n *\n * @param options Optional settings including `routeId`, `headers`, and `throw`.\n * @returns A not-found error object that can be thrown or returned.\n * @link https://tanstack.com/router/latest/docs/router/framework/react/api/router/notFoundFunction\n */\nexport function notFound(options: NotFoundError = {}) {\n  ;(options as any).isNotFound = true\n  if (options.throw) throw options\n  return options\n}\n\n/** Determine if a value is a TanStack Router not-found error. */\nexport function isNotFound(obj: any): obj is NotFoundError {\n  return !!obj?.isNotFound\n}\n"
  },
  {
    "path": "packages/router-core/src/path.ts",
    "content": "import { isServer } from '@tanstack/router-core/isServer'\nimport { last } from './utils'\nimport {\n  SEGMENT_TYPE_OPTIONAL_PARAM,\n  SEGMENT_TYPE_PARAM,\n  SEGMENT_TYPE_PATHNAME,\n  SEGMENT_TYPE_WILDCARD,\n  parseSegment,\n} from './new-process-route-tree'\nimport type { LRUCache } from './lru-cache'\n\n/** Join path segments, cleaning duplicate slashes between parts. */\nexport function joinPaths(paths: Array<string | undefined>) {\n  return cleanPath(\n    paths\n      .filter((val) => {\n        return val !== undefined\n      })\n      .join('/'),\n  )\n}\n\n/** Remove repeated slashes from a path string. */\nexport function cleanPath(path: string) {\n  // remove double slashes\n  return path.replace(/\\/{2,}/g, '/')\n}\n\n/** Trim leading slashes (except preserving root '/'). */\nexport function trimPathLeft(path: string) {\n  return path === '/' ? path : path.replace(/^\\/{1,}/, '')\n}\n\n/** Trim trailing slashes (except preserving root '/'). */\nexport function trimPathRight(path: string) {\n  const len = path.length\n  return len > 1 && path[len - 1] === '/' ? path.replace(/\\/{1,}$/, '') : path\n}\n\n/** Trim both leading and trailing slashes. */\nexport function trimPath(path: string) {\n  return trimPathRight(trimPathLeft(path))\n}\n\n/** Remove a trailing slash from value when appropriate for comparisons. */\nexport function removeTrailingSlash(value: string, basepath: string): string {\n  if (value?.endsWith('/') && value !== '/' && value !== `${basepath}/`) {\n    return value.slice(0, -1)\n  }\n  return value\n}\n\n// intended to only compare path name\n// see the usage in the isActive under useLinkProps\n// /sample/path1 = /sample/path1/\n// /sample/path1/some <> /sample/path1\n/**\n * Compare two pathnames for exact equality after normalizing trailing slashes\n * relative to the provided `basepath`.\n */\nexport function exactPathTest(\n  pathName1: string,\n  pathName2: string,\n  basepath: string,\n): boolean {\n  return (\n    removeTrailingSlash(pathName1, basepath) ===\n    removeTrailingSlash(pathName2, basepath)\n  )\n}\n\n// When resolving relative paths, we treat all paths as if they are trailing slash\n// documents. All trailing slashes are removed after the path is resolved.\n// Here are a few examples:\n//\n// /a/b/c + ./d = /a/b/c/d\n// /a/b/c + ../d = /a/b/d\n// /a/b/c + ./d/ = /a/b/c/d\n// /a/b/c + ../d/ = /a/b/d\n// /a/b/c + ./ = /a/b/c\n//\n// Absolute paths that start with `/` short circuit the resolution process to the root\n// path.\n//\n// Here are some examples:\n//\n// /a/b/c + /d = /d\n// /a/b/c + /d/ = /d\n// /a/b/c + / = /\n//\n// Non-.-prefixed paths are still treated as relative paths, resolved like `./`\n//\n// Here are some examples:\n//\n// /a/b/c + d = /a/b/c/d\n// /a/b/c + d/ = /a/b/c/d\n// /a/b/c + d/e = /a/b/c/d/e\ninterface ResolvePathOptions {\n  base: string\n  to: string\n  trailingSlash?: 'always' | 'never' | 'preserve'\n  cache?: LRUCache<string, string>\n}\n\n/**\n * Resolve a destination path against a base, honoring trailing-slash policy\n * and supporting relative segments (`.`/`..`) and absolute `to` values.\n */\nexport function resolvePath({\n  base,\n  to,\n  trailingSlash = 'never',\n  cache,\n}: ResolvePathOptions) {\n  const isAbsolute = to.startsWith('/')\n  const isBase = !isAbsolute && to === '.'\n\n  let key\n  if (cache) {\n    // `trailingSlash` is static per router, so it doesn't need to be part of the cache key\n    key = isAbsolute ? to : isBase ? base : base + '\\0' + to\n    const cached = cache.get(key)\n    if (cached) return cached\n  }\n\n  let baseSegments: Array<string>\n  if (isBase) {\n    baseSegments = base.split('/')\n  } else if (isAbsolute) {\n    baseSegments = to.split('/')\n  } else {\n    baseSegments = base.split('/')\n    while (baseSegments.length > 1 && last(baseSegments) === '') {\n      baseSegments.pop()\n    }\n\n    const toSegments = to.split('/')\n    for (let index = 0, length = toSegments.length; index < length; index++) {\n      const value = toSegments[index]!\n      if (value === '') {\n        if (!index) {\n          // Leading slash\n          baseSegments = [value]\n        } else if (index === length - 1) {\n          // Trailing Slash\n          baseSegments.push(value)\n        } else {\n          // ignore inter-slashes\n        }\n      } else if (value === '..') {\n        baseSegments.pop()\n      } else if (value === '.') {\n        // ignore\n      } else {\n        baseSegments.push(value)\n      }\n    }\n  }\n\n  if (baseSegments.length > 1) {\n    if (last(baseSegments) === '') {\n      if (trailingSlash === 'never') {\n        baseSegments.pop()\n      }\n    } else if (trailingSlash === 'always') {\n      baseSegments.push('')\n    }\n  }\n\n  let segment\n  let joined = ''\n  for (let i = 0; i < baseSegments.length; i++) {\n    if (i > 0) joined += '/'\n    const part = baseSegments[i]!\n    if (!part) continue\n    segment = parseSegment(part, 0, segment)\n    const kind = segment[0]\n    if (kind === SEGMENT_TYPE_PATHNAME) {\n      joined += part\n      continue\n    }\n    const end = segment[5]\n    const prefix = part.substring(0, segment[1])\n    const suffix = part.substring(segment[4], end)\n    const value = part.substring(segment[2], segment[3])\n    if (kind === SEGMENT_TYPE_PARAM) {\n      joined += prefix || suffix ? `${prefix}{$${value}}${suffix}` : `$${value}`\n    } else if (kind === SEGMENT_TYPE_WILDCARD) {\n      joined += prefix || suffix ? `${prefix}{$}${suffix}` : '$'\n    } else {\n      // SEGMENT_TYPE_OPTIONAL_PARAM\n      joined += `${prefix}{-$${value}}${suffix}`\n    }\n  }\n  joined = cleanPath(joined)\n  const result = joined || '/'\n  if (key && cache) cache.set(key, result)\n  return result\n}\n\n/**\n * Create a pre-compiled decode config from allowed characters.\n * This should be called once at router initialization.\n */\nexport function compileDecodeCharMap(\n  pathParamsAllowedCharacters: ReadonlyArray<string>,\n) {\n  const charMap = new Map(\n    pathParamsAllowedCharacters.map((char) => [encodeURIComponent(char), char]),\n  )\n  // Escape special regex characters and join with |\n  const pattern = Array.from(charMap.keys())\n    .map((key) => key.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n    .join('|')\n  const regex = new RegExp(pattern, 'g')\n  return (encoded: string) =>\n    encoded.replace(regex, (match) => charMap.get(match) ?? match)\n}\n\ninterface InterpolatePathOptions {\n  path?: string\n  params: Record<string, unknown>\n  /**\n   * A function that decodes a path parameter value.\n   * Obtained from `compileDecodeCharMap(pathParamsAllowedCharacters)`.\n   */\n  decoder?: (encoded: string) => string\n  /**\n   * @internal\n   * For testing only, in development mode we use the router.isServer value\n   */\n  server?: boolean\n}\n\ntype InterPolatePathResult = {\n  interpolatedPath: string\n  usedParams: Record<string, unknown>\n  isMissingParams: boolean // true if any params were not available when being looked up in the params object\n}\n\nfunction encodeParam(\n  key: string,\n  params: InterpolatePathOptions['params'],\n  decoder: InterpolatePathOptions['decoder'],\n): any {\n  const value = params[key]\n  if (typeof value !== 'string') return value\n\n  if (key === '_splat') {\n    // Early return if value only contains URL-safe characters (performance optimization)\n    if (/^[a-zA-Z0-9\\-._~!/]*$/.test(value)) return value\n    // the splat/catch-all routes shouldn't have the '/' encoded out\n    // Use encodeURIComponent for each segment to properly encode spaces,\n    // plus signs, and other special characters that encodeURI leaves unencoded\n    return value\n      .split('/')\n      .map((segment) => encodePathParam(segment, decoder))\n      .join('/')\n  } else {\n    return encodePathParam(value, decoder)\n  }\n}\n\n/**\n * Interpolate params and wildcards into a route path template.\n *\n * - Encodes params safely (configurable allowed characters)\n * - Supports `{-$optional}` segments, `{prefix{$id}suffix}` and `{$}` wildcards\n */\nexport function interpolatePath({\n  path,\n  params,\n  decoder,\n  // `server` is marked @internal and stripped from .d.ts by `stripInternal`.\n  // We avoid destructuring it in the function signature so the emitted\n  // declaration doesn't reference a property that no longer exists.\n  ...rest\n}: InterpolatePathOptions): InterPolatePathResult {\n  // Tracking if any params are missing in the `params` object\n  // when interpolating the path\n  let isMissingParams = false\n  const usedParams: Record<string, unknown> = Object.create(null)\n\n  if (!path || path === '/')\n    return { interpolatedPath: '/', usedParams, isMissingParams }\n  if (!path.includes('$'))\n    return { interpolatedPath: path, usedParams, isMissingParams }\n\n  if (isServer ?? rest.server) {\n    // Fast path for common templates like `/posts/$id` or `/files/$`.\n    // Braced segments (`{...}`) are more complex (prefix/suffix/optional) and are\n    // handled by the general parser below.\n    if (path.indexOf('{') === -1) {\n      const length = path.length\n      let cursor = 0\n      let joined = ''\n\n      while (cursor < length) {\n        // Skip slashes between segments. '/' code is 47\n        while (cursor < length && path.charCodeAt(cursor) === 47) cursor++\n        if (cursor >= length) break\n\n        const start = cursor\n        let end = path.indexOf('/', cursor)\n        if (end === -1) end = length\n        cursor = end\n\n        const part = path.substring(start, end)\n        if (!part) continue\n\n        // `$id` or `$` (splat). '$' code is 36\n        if (part.charCodeAt(0) === 36) {\n          if (part.length === 1) {\n            const splat = params._splat\n            usedParams._splat = splat\n            // TODO: Deprecate *\n            usedParams['*'] = splat\n\n            if (!splat) {\n              isMissingParams = true\n              continue\n            }\n\n            const value = encodeParam('_splat', params, decoder)\n            joined += '/' + value\n          } else {\n            const key = part.substring(1)\n            if (!isMissingParams && !(key in params)) {\n              isMissingParams = true\n            }\n            usedParams[key] = params[key]\n\n            const value = encodeParam(key, params, decoder) ?? 'undefined'\n            joined += '/' + value\n          }\n        } else {\n          joined += '/' + part\n        }\n      }\n\n      if (path.endsWith('/')) joined += '/'\n\n      const interpolatedPath = joined || '/'\n      return { usedParams, interpolatedPath, isMissingParams }\n    }\n  }\n\n  const length = path.length\n  let cursor = 0\n  let segment\n  let joined = ''\n  while (cursor < length) {\n    const start = cursor\n    segment = parseSegment(path, start, segment)\n    const end = segment[5]\n    cursor = end + 1\n\n    if (start === end) continue\n\n    const kind = segment[0]\n\n    if (kind === SEGMENT_TYPE_PATHNAME) {\n      joined += '/' + path.substring(start, end)\n      continue\n    }\n\n    if (kind === SEGMENT_TYPE_WILDCARD) {\n      const splat = params._splat\n      usedParams._splat = splat\n      // TODO: Deprecate *\n      usedParams['*'] = splat\n\n      const prefix = path.substring(start, segment[1])\n      const suffix = path.substring(segment[4], end)\n\n      // Check if _splat parameter is missing. _splat could be missing if undefined or an empty string or some other falsy value.\n      if (!splat) {\n        isMissingParams = true\n        // For missing splat parameters, just return the prefix and suffix without the wildcard\n        // If there is a prefix or suffix, return them joined, otherwise omit the segment\n        if (prefix || suffix) {\n          joined += '/' + prefix + suffix\n        }\n        continue\n      }\n\n      const value = encodeParam('_splat', params, decoder)\n      joined += '/' + prefix + value + suffix\n      continue\n    }\n\n    if (kind === SEGMENT_TYPE_PARAM) {\n      const key = path.substring(segment[2], segment[3])\n      if (!isMissingParams && !(key in params)) {\n        isMissingParams = true\n      }\n      usedParams[key] = params[key]\n\n      const prefix = path.substring(start, segment[1])\n      const suffix = path.substring(segment[4], end)\n      const value = encodeParam(key, params, decoder) ?? 'undefined'\n      joined += '/' + prefix + value + suffix\n      continue\n    }\n\n    if (kind === SEGMENT_TYPE_OPTIONAL_PARAM) {\n      const key = path.substring(segment[2], segment[3])\n      const valueRaw = params[key]\n\n      // Check if optional parameter is missing or undefined\n      if (valueRaw == null) continue\n\n      usedParams[key] = valueRaw\n\n      const prefix = path.substring(start, segment[1])\n      const suffix = path.substring(segment[4], end)\n      const value = encodeParam(key, params, decoder) ?? ''\n      joined += '/' + prefix + value + suffix\n      continue\n    }\n  }\n\n  if (path.endsWith('/')) joined += '/'\n\n  const interpolatedPath = joined || '/'\n\n  return { usedParams, interpolatedPath, isMissingParams }\n}\n\nfunction encodePathParam(\n  value: string,\n  decoder?: InterpolatePathOptions['decoder'],\n) {\n  const encoded = encodeURIComponent(value)\n  return decoder?.(encoded) ?? encoded\n}\n"
  },
  {
    "path": "packages/router-core/src/qss.ts",
    "content": "/**\n * Program is a reimplementation of the `qss` package:\n * Copyright (c) Luke Edwards luke.edwards05@gmail.com, MIT License\n * https://github.com/lukeed/qss/blob/master/license.md\n *\n * This reimplementation uses modern browser APIs\n * (namely URLSearchParams) and TypeScript while still\n * maintaining the original functionality and interface.\n *\n * Update: this implementation has also been mangled to\n * fit exactly our use-case (single value per key in encoding).\n */\n\n/**\n * Encodes an object into a query string.\n * @param obj - The object to encode into a query string.\n * @param stringify - An optional custom stringify function.\n * @returns The encoded query string.\n * @example\n * ```\n * // Example input: encode({ token: 'foo', key: 'value' })\n * // Expected output: \"token=foo&key=value\"\n * ```\n */\nexport function encode(\n  obj: Record<string, any>,\n  stringify: (value: any) => string = String,\n): string {\n  const result = new URLSearchParams()\n\n  for (const key in obj) {\n    const val = obj[key]\n    if (val !== undefined) {\n      result.set(key, stringify(val))\n    }\n  }\n\n  return result.toString()\n}\n\n/**\n * Converts a string value to its appropriate type (string, number, boolean).\n * @param mix - The string value to convert.\n * @returns The converted value.\n * @example\n * // Example input: toValue(\"123\")\n * // Expected output: 123\n */\nfunction toValue(str: unknown) {\n  if (!str) return ''\n\n  if (str === 'false') return false\n  if (str === 'true') return true\n  return +str * 0 === 0 && +str + '' === str ? +str : str\n}\n/**\n * Decodes a query string into an object.\n * @param str - The query string to decode.\n * @returns The decoded key-value pairs in an object format.\n * @example\n * // Example input: decode(\"token=foo&key=value\")\n * // Expected output: { \"token\": \"foo\", \"key\": \"value\" }\n */\nexport function decode(str: any): any {\n  const searchParams = new URLSearchParams(str)\n\n  const result: Record<string, unknown> = Object.create(null)\n\n  for (const [key, value] of searchParams.entries()) {\n    const previousValue = result[key]\n    if (previousValue == null) {\n      result[key] = toValue(value)\n    } else if (Array.isArray(previousValue)) {\n      previousValue.push(toValue(value))\n    } else {\n      result[key] = [previousValue, toValue(value)]\n    }\n  }\n\n  return result\n}\n"
  },
  {
    "path": "packages/router-core/src/redirect.ts",
    "content": "import type { NavigateOptions } from './link'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type { ParsedLocation } from './location'\n\nexport type AnyRedirect = Redirect<any, any, any, any, any>\n\n/**\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)\n */\nexport type Redirect<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = undefined,\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = Response & {\n  options: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n    /**\n     * @internal\n     * A **trusted** built location that can be used to redirect to.\n     */\n    _builtLocation?: ParsedLocation\n  }\n  redirectHandled?: boolean\n}\n\nexport type RedirectOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = undefined,\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = {\n  href?: string\n  /**\n   * @deprecated Use `statusCode` instead\n   **/\n  code?: number\n  /**\n   * The HTTP status code to use when redirecting.\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#statuscode-property)\n   */\n  statusCode?: number\n  /**\n   * 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.\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#throw-property)\n   */\n  throw?: any\n  /**\n   * The HTTP headers to use when redirecting.\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType#headers-property)\n   */\n  headers?: HeadersInit\n  /**\n   * @internal\n   * A **trusted** built location that can be used to redirect to.\n   */\n  _builtLocation?: ParsedLocation\n} & NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type ResolvedRedirect<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string = '',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '',\n> = Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\n/**\n * Options for route-bound redirect, where 'from' is automatically set.\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)\n */\nexport type RedirectOptionsRoute<\n  TDefaultFrom extends string = string,\n  TRouter extends AnyRouter = RegisteredRouter,\n  TTo extends string | undefined = undefined,\n  TMaskTo extends string = '',\n> = Omit<\n  RedirectOptions<TRouter, TDefaultFrom, TTo, TDefaultFrom, TMaskTo>,\n  'from'\n>\n\n/**\n * A redirect function bound to a specific route, with 'from' pre-set to the route's fullPath.\n * This enables relative redirects like `Route.redirect({ to: './overview' })`.\n * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RedirectType)\n */\nexport interface RedirectFnRoute<in out TDefaultFrom extends string = string> {\n  <\n    TRouter extends AnyRouter = RegisteredRouter,\n    const TTo extends string | undefined = undefined,\n    const TMaskTo extends string = '',\n  >(\n    opts: RedirectOptionsRoute<TDefaultFrom, TRouter, TTo, TMaskTo>,\n  ): Redirect<TRouter, TDefaultFrom, TTo, TDefaultFrom, TMaskTo>\n}\n\n/**\n * Create a redirect Response understood by TanStack Router.\n *\n * Use from route `loader`/`beforeLoad` or server functions to trigger a\n * navigation. If `throw: true` is set, the redirect is thrown instead of\n * returned. When an absolute `href` is supplied and `reloadDocument` is not\n * set, a full-document navigation is inferred.\n *\n * @param opts Options for the redirect. Common fields:\n * - `href`: absolute URL for external redirects; infers `reloadDocument`.\n * - `statusCode`: HTTP status code to use (defaults to 307).\n * - `headers`: additional headers to include on the Response.\n * - Standard navigation options like `to`, `params`, `search`, `replace`,\n *   and `reloadDocument` for internal redirects.\n * @returns A Response augmented with router navigation options.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction\n */\nexport function redirect<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TTo extends string | undefined = '.',\n  const TFrom extends string = string,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(\n  opts: RedirectOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> {\n  opts.statusCode = opts.statusCode || opts.code || 307\n\n  if (\n    !opts._builtLocation &&\n    !opts.reloadDocument &&\n    typeof opts.href === 'string'\n  ) {\n    try {\n      new URL(opts.href)\n      opts.reloadDocument = true\n    } catch {}\n  }\n\n  const headers = new Headers(opts.headers)\n  if (opts.href && headers.get('Location') === null) {\n    headers.set('Location', opts.href)\n  }\n\n  const response = new Response(null, {\n    status: opts.statusCode,\n    headers,\n  })\n\n  ;(response as Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>).options =\n    opts\n\n  if (opts.throw) {\n    throw response\n  }\n\n  return response as Redirect<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n}\n\n/** Check whether a value is a TanStack Router redirect Response. */\n/** Check whether a value is a TanStack Router redirect Response. */\nexport function isRedirect(obj: any): obj is AnyRedirect {\n  return obj instanceof Response && !!(obj as any).options\n}\n\n/** True if value is a redirect with a resolved `href` location. */\n/** True if value is a redirect with a resolved `href` location. */\nexport function isResolvedRedirect(\n  obj: any,\n): obj is AnyRedirect & { options: { href: string } } {\n  return isRedirect(obj) && !!obj.options.href\n}\n\n/** Parse a serialized redirect object back into a redirect Response. */\n/** Parse a serialized redirect object back into a redirect Response. */\nexport function parseRedirect(obj: any) {\n  if (obj !== null && typeof obj === 'object' && obj.isSerializedRedirect) {\n    return redirect(obj)\n  }\n\n  return undefined\n}\n"
  },
  {
    "path": "packages/router-core/src/rewrite.ts",
    "content": "import { joinPaths, trimPath } from './path'\nimport type { LocationRewrite } from './router'\n\n/** Compose multiple rewrite pairs into a single in/out rewrite. */\n/** Compose multiple rewrite pairs into a single in/out rewrite. */\nexport function composeRewrites(rewrites: Array<LocationRewrite>) {\n  return {\n    input: ({ url }) => {\n      for (const rewrite of rewrites) {\n        url = executeRewriteInput(rewrite, url)\n      }\n      return url\n    },\n    output: ({ url }) => {\n      for (let i = rewrites.length - 1; i >= 0; i--) {\n        url = executeRewriteOutput(rewrites[i], url)\n      }\n      return url\n    },\n  } satisfies LocationRewrite\n}\n\n/** Create a rewrite pair that strips/adds a basepath on input/output. */\n/** Create a rewrite pair that strips/adds a basepath on input/output. */\nexport function rewriteBasepath(opts: {\n  basepath: string\n  caseSensitive?: boolean\n}) {\n  const trimmedBasepath = trimPath(opts.basepath)\n  const normalizedBasepath = `/${trimmedBasepath}`\n  const normalizedBasepathWithSlash = `${normalizedBasepath}/`\n  const checkBasepath = opts.caseSensitive\n    ? normalizedBasepath\n    : normalizedBasepath.toLowerCase()\n  const checkBasepathWithSlash = opts.caseSensitive\n    ? normalizedBasepathWithSlash\n    : normalizedBasepathWithSlash.toLowerCase()\n\n  return {\n    input: ({ url }) => {\n      const pathname = opts.caseSensitive\n        ? url.pathname\n        : url.pathname.toLowerCase()\n\n      // Handle exact basepath match (e.g., /my-app -> /)\n      if (pathname === checkBasepath) {\n        url.pathname = '/'\n      } else if (pathname.startsWith(checkBasepathWithSlash)) {\n        // Handle basepath with trailing content (e.g., /my-app/users -> /users)\n        url.pathname = url.pathname.slice(normalizedBasepath.length)\n      }\n      return url\n    },\n    output: ({ url }) => {\n      url.pathname = joinPaths(['/', trimmedBasepath, url.pathname])\n      return url\n    },\n  } satisfies LocationRewrite\n}\n\n/** Execute a location input rewrite if provided. */\n/** Execute a location input rewrite if provided. */\nexport function executeRewriteInput(\n  rewrite: LocationRewrite | undefined,\n  url: URL,\n): URL {\n  const res = rewrite?.input?.({ url })\n  if (res) {\n    if (typeof res === 'string') {\n      return new URL(res)\n    } else if (res instanceof URL) {\n      return res\n    }\n  }\n  return url\n}\n\n/** Execute a location output rewrite if provided. */\n/** Execute a location output rewrite if provided. */\nexport function executeRewriteOutput(\n  rewrite: LocationRewrite | undefined,\n  url: URL,\n): URL {\n  const res = rewrite?.output?.({ url })\n  if (res) {\n    if (typeof res === 'string') {\n      return new URL(res)\n    } else if (res instanceof URL) {\n      return res\n    }\n  }\n  return url\n}\n"
  },
  {
    "path": "packages/router-core/src/root.ts",
    "content": "/** Stable identifier used for the root route in a route tree. */\nexport const rootRouteId = '__root__'\nexport type RootRouteId = typeof rootRouteId\n"
  },
  {
    "path": "packages/router-core/src/route.ts",
    "content": "import invariant from 'tiny-invariant'\nimport { joinPaths, trimPathLeft, trimPathRight } from './path'\nimport { notFound } from './not-found'\nimport { redirect } from './redirect'\nimport { rootRouteId } from './root'\nimport type { LazyRoute } from './fileRoute'\nimport type { NotFoundError } from './not-found'\nimport type { RedirectFnRoute } from './redirect'\nimport type { NavigateOptions, ParsePathParams } from './link'\nimport type { ParsedLocation } from './location'\nimport type {\n  AnyRouteMatch,\n  MakePreValidationErrorHandlingRouteMatchUnion,\n  MakeRouteMatchFromRoute,\n  MakeRouteMatchUnion,\n  RouteMatch,\n} from './Matches'\nimport type { RootRouteId } from './root'\nimport type { ParseRoute, RouteById, RouteIds, RoutePaths } from './routeInfo'\nimport type { AnyRouter, Register, RegisteredRouter, SSROption } from './router'\nimport type { BuildLocationFn, NavigateFn } from './RouterProvider'\nimport type {\n  Assign,\n  Awaitable,\n  Constrain,\n  Expand,\n  IntersectAssign,\n  LooseAsyncReturnType,\n  LooseReturnType,\n  NoInfer,\n} from './utils'\nimport type {\n  AnySchema,\n  AnyStandardSchemaValidator,\n  AnyValidator,\n  AnyValidatorAdapter,\n  AnyValidatorObj,\n  DefaultValidator,\n  ResolveSearchValidatorInput,\n  ResolveValidatorOutput,\n  StandardSchemaValidator,\n  ValidatorAdapter,\n  ValidatorFn,\n  ValidatorObj,\n} from './validators'\nimport type { ValidateSerializableLifecycleResult } from './ssr/serializer/transformer'\n\nexport type AnyPathParams = {}\n\nexport type SearchSchemaInput = {\n  __TSearchSchemaInput__: 'TSearchSchemaInput'\n}\n\nexport type AnyContext = {}\n\nexport interface RouteContext {}\n\nexport type PreloadableObj = { preload?: () => Promise<void> }\n\nexport type RoutePathOptions<TCustomId, TPath> =\n  | {\n      path: TPath\n    }\n  | {\n      id: TCustomId\n    }\n\nexport interface StaticDataRouteOption {}\n\nexport type RoutePathOptionsIntersection<TCustomId, TPath> = {\n  path: TPath\n  id: TCustomId\n}\n\nexport type SearchFilter<TInput, TResult = TInput> = (prev: TInput) => TResult\n\nexport type SearchMiddlewareContext<TSearchSchema> = {\n  search: TSearchSchema\n  next: (newSearch: TSearchSchema) => TSearchSchema\n}\n\nexport type SearchMiddleware<TSearchSchema> = (\n  ctx: SearchMiddlewareContext<TSearchSchema>,\n) => TSearchSchema\n\nexport type ResolveId<\n  TParentRoute,\n  TCustomId extends string,\n  TPath extends string,\n> = TParentRoute extends { id: infer TParentId extends string }\n  ? RoutePrefix<TParentId, string extends TCustomId ? TPath : TCustomId>\n  : RootRouteId\n\nexport type InferFullSearchSchema<TRoute> = TRoute extends {\n  types: {\n    fullSearchSchema: infer TFullSearchSchema\n  }\n}\n  ? TFullSearchSchema\n  : {}\n\nexport type InferFullSearchSchemaInput<TRoute> = TRoute extends {\n  types: {\n    fullSearchSchemaInput: infer TFullSearchSchemaInput\n  }\n}\n  ? TFullSearchSchemaInput\n  : {}\n\nexport type InferAllParams<TRoute> = TRoute extends {\n  types: {\n    allParams: infer TAllParams\n  }\n}\n  ? TAllParams\n  : {}\n\nexport type InferAllContext<TRoute> = unknown extends TRoute\n  ? TRoute\n  : TRoute extends {\n        types: {\n          allContext: infer TAllContext\n        }\n      }\n    ? TAllContext\n    : {}\n\nexport type ResolveSearchSchemaFnInput<TSearchValidator> =\n  TSearchValidator extends (input: infer TSearchSchemaInput) => any\n    ? TSearchSchemaInput extends SearchSchemaInput\n      ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n      : ResolveSearchSchemaFn<TSearchValidator>\n    : AnySchema\n\nexport type ResolveSearchSchemaInput<TSearchValidator> =\n  TSearchValidator extends AnyStandardSchemaValidator\n    ? NonNullable<TSearchValidator['~standard']['types']>['input']\n    : TSearchValidator extends AnyValidatorAdapter\n      ? TSearchValidator['types']['input']\n      : TSearchValidator extends AnyValidatorObj\n        ? ResolveSearchSchemaFnInput<TSearchValidator['parse']>\n        : ResolveSearchSchemaFnInput<TSearchValidator>\n\nexport type ResolveSearchSchemaFn<TSearchValidator> = TSearchValidator extends (\n  ...args: any\n) => infer TSearchSchema\n  ? TSearchSchema\n  : AnySchema\n\nexport type ResolveSearchSchema<TSearchValidator> =\n  unknown extends TSearchValidator\n    ? TSearchValidator\n    : TSearchValidator extends AnyStandardSchemaValidator\n      ? NonNullable<TSearchValidator['~standard']['types']>['output']\n      : TSearchValidator extends AnyValidatorAdapter\n        ? TSearchValidator['types']['output']\n        : TSearchValidator extends AnyValidatorObj\n          ? ResolveSearchSchemaFn<TSearchValidator['parse']>\n          : ResolveSearchSchemaFn<TSearchValidator>\n\nexport type ResolveRequiredParams<TPath extends string, T> = {\n  [K in ParsePathParams<TPath>['required']]: T\n}\n\nexport type ResolveOptionalParams<TPath extends string, T> = {\n  [K in ParsePathParams<TPath>['optional']]?: T | undefined\n}\n\nexport type ResolveParams<\n  TPath extends string,\n  T = string,\n> = ResolveRequiredParams<TPath, T> & ResolveOptionalParams<TPath, T>\n\nexport type ParseParamsFn<in out TPath extends string, in out TParams> = (\n  rawParams: Expand<ResolveParams<TPath>>,\n) => TParams extends ResolveParams<TPath, any>\n  ? TParams\n  : ResolveParams<TPath, any>\n\nexport type StringifyParamsFn<in out TPath extends string, in out TParams> = (\n  params: TParams,\n) => ResolveParams<TPath>\n\nexport type ParamsOptions<in out TPath extends string, in out TParams> = {\n  params?: {\n    parse?: ParseParamsFn<TPath, TParams>\n    stringify?: StringifyParamsFn<TPath, TParams>\n  }\n\n  /** \n  @deprecated Use params.parse instead\n  */\n  parseParams?: ParseParamsFn<TPath, TParams>\n\n  /** \n  @deprecated Use params.stringify instead\n  */\n  stringifyParams?: StringifyParamsFn<TPath, TParams>\n}\n\ninterface RequiredStaticDataRouteOption {\n  staticData: StaticDataRouteOption\n}\n\ninterface OptionalStaticDataRouteOption {\n  staticData?: StaticDataRouteOption\n}\n\nexport type UpdatableStaticRouteOption = {} extends StaticDataRouteOption\n  ? OptionalStaticDataRouteOption\n  : RequiredStaticDataRouteOption\n\nexport type MetaDescriptor =\n  | { charSet: 'utf-8' }\n  | { title: string }\n  | { name: string; content: string }\n  | { property: string; content: string }\n  | { httpEquiv: string; content: string }\n  | { 'script:ld+json': LdJsonObject }\n  | { tagName: 'meta' | 'link'; [name: string]: string }\n  | Record<string, unknown>\n\ntype LdJsonObject = { [Key in string]: LdJsonValue } & {\n  [Key in string]?: LdJsonValue | undefined\n}\ntype LdJsonArray = Array<LdJsonValue> | ReadonlyArray<LdJsonValue>\ntype LdJsonPrimitive = string | number | boolean | null\ntype LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray\n\nexport type RouteLinkEntry = {}\n\nexport type SearchValidator<TInput, TOutput> =\n  | ValidatorObj<TInput, TOutput>\n  | ValidatorFn<TInput, TOutput>\n  | ValidatorAdapter<TInput, TOutput>\n  | StandardSchemaValidator<TInput, TOutput>\n  | undefined\n\nexport type AnySearchValidator = SearchValidator<any, any>\n\nexport type DefaultSearchValidator = SearchValidator<\n  Record<string, unknown>,\n  AnySchema\n>\n\nexport type RoutePrefix<\n  TPrefix extends string,\n  TPath extends string,\n> = string extends TPath\n  ? RootRouteId\n  : TPath extends string\n    ? TPrefix extends RootRouteId\n      ? TPath extends '/'\n        ? '/'\n        : `/${TrimPath<TPath>}`\n      : `${TPrefix}/${TPath}` extends '/'\n        ? '/'\n        : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}`\n    : never\n\nexport type TrimPath<T extends string> = '' extends T\n  ? ''\n  : TrimPathRight<TrimPathLeft<T>>\n\nexport type TrimPathLeft<T extends string> =\n  T extends `${RootRouteId}/${infer U}`\n    ? TrimPathLeft<U>\n    : T extends `/${infer U}`\n      ? TrimPathLeft<U>\n      : T\n\nexport type TrimPathRight<T extends string> = T extends '/'\n  ? '/'\n  : T extends `${infer U}/`\n    ? TrimPathRight<U>\n    : T\n\nexport type ContextReturnType<TContextFn> = unknown extends TContextFn\n  ? TContextFn\n  : LooseReturnType<TContextFn> extends never\n    ? AnyContext\n    : LooseReturnType<TContextFn>\n\nexport type ContextAsyncReturnType<TContextFn> = unknown extends TContextFn\n  ? TContextFn\n  : LooseAsyncReturnType<TContextFn> extends never\n    ? AnyContext\n    : LooseAsyncReturnType<TContextFn>\n\nexport type ResolveRouteContext<TRouteContextFn, TBeforeLoadFn> = Assign<\n  ContextReturnType<TRouteContextFn>,\n  ContextAsyncReturnType<TBeforeLoadFn>\n>\n\nexport type ResolveRouteLoaderFn<TLoaderFn> = TLoaderFn extends {\n  handler: infer THandler\n}\n  ? THandler\n  : TLoaderFn\n\nexport type RouteLoaderObject<\n  TRegister,\n  TParentRoute extends AnyRoute = AnyRoute,\n  TId extends string = string,\n  TParams = {},\n  TLoaderDeps = {},\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n> = {\n  handler: RouteLoaderFn<\n    TRegister,\n    TParentRoute,\n    TId,\n    TParams,\n    TLoaderDeps,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TServerMiddlewares,\n    THandlers\n  >\n  staleReloadMode?: LoaderStaleReloadMode\n}\n\nexport type ResolveLoaderData<TLoaderFn> = unknown extends TLoaderFn\n  ? TLoaderFn\n  : LooseAsyncReturnType<ResolveRouteLoaderFn<TLoaderFn>> extends never\n    ? undefined\n    : LooseAsyncReturnType<ResolveRouteLoaderFn<TLoaderFn>>\n\nexport type ResolveFullSearchSchema<\n  TParentRoute extends AnyRoute,\n  TSearchValidator,\n> = unknown extends TParentRoute\n  ? ResolveValidatorOutput<TSearchValidator>\n  : IntersectAssign<\n      InferFullSearchSchema<TParentRoute>,\n      ResolveValidatorOutput<TSearchValidator>\n    >\n\nexport type ResolveFullSearchSchemaInput<\n  TParentRoute extends AnyRoute,\n  TSearchValidator,\n> = IntersectAssign<\n  InferFullSearchSchemaInput<TParentRoute>,\n  ResolveSearchValidatorInput<TSearchValidator>\n>\n\nexport type ResolveAllParamsFromParent<\n  TParentRoute extends AnyRoute,\n  TParams,\n> = Assign<InferAllParams<TParentRoute>, TParams>\n\nexport type RouteContextParameter<\n  TParentRoute extends AnyRoute,\n  TRouterContext,\n> = unknown extends TParentRoute\n  ? TRouterContext\n  : Assign<TRouterContext, InferAllContext<TParentRoute>>\n\nexport type BeforeLoadContextParameter<\n  TParentRoute extends AnyRoute,\n  TRouterContext,\n  TRouteContextFn,\n> = Assign<\n  RouteContextParameter<TParentRoute, TRouterContext>,\n  ContextReturnType<TRouteContextFn>\n>\n\nexport type ResolveAllContext<\n  TParentRoute extends AnyRoute,\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n> = Assign<\n  BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>,\n  ContextAsyncReturnType<TBeforeLoadFn>\n>\nexport interface FullSearchSchemaOption<\n  in out TParentRoute extends AnyRoute,\n  in out TSearchValidator,\n> {\n  search: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>\n}\n\nexport interface RemountDepsOptions<\n  in out TRouteId,\n  in out TFullSearchSchema,\n  in out TAllParams,\n  in out TLoaderDeps,\n> {\n  routeId: TRouteId\n  search: TFullSearchSchema\n  params: TAllParams\n  loaderDeps: TLoaderDeps\n}\n\nexport type MakeRemountDepsOptionsUnion<\n  TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],\n> =\n  ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute\n    ? TRoute extends any\n      ? RemountDepsOptions<\n          TRoute['id'],\n          TRoute['types']['fullSearchSchema'],\n          TRoute['types']['allParams'],\n          TRoute['types']['loaderDeps']\n        >\n      : never\n    : never\n\nexport interface RouteTypes<\n  in out TRegister,\n  in out TParentRoute extends AnyRoute,\n  in out TPath extends string,\n  in out TFullPath extends string,\n  in out TCustomId extends string,\n  in out TId extends string,\n  in out TSearchValidator,\n  in out TParams,\n  in out TRouterContext,\n  in out TRouteContextFn,\n  in out TBeforeLoadFn,\n  in out TLoaderDeps,\n  in out TLoaderFn,\n  in out TChildren,\n  in out TFileRouteTypes,\n  in out TSSR,\n  in out TServerMiddlewares,\n  in out THandlers,\n> {\n  parentRoute: TParentRoute\n  path: TPath\n  to: TrimPathRight<TFullPath>\n  fullPath: TFullPath\n  customId: TCustomId\n  id: TId\n  searchSchema: ResolveValidatorOutput<TSearchValidator>\n  searchSchemaInput: ResolveSearchValidatorInput<TSearchValidator>\n  searchValidator: TSearchValidator\n  fullSearchSchema: ResolveFullSearchSchema<TParentRoute, TSearchValidator>\n  fullSearchSchemaInput: ResolveFullSearchSchemaInput<\n    TParentRoute,\n    TSearchValidator\n  >\n  params: TParams\n  allParams: ResolveAllParamsFromParent<TParentRoute, TParams>\n  routerContext: TRouterContext\n  routeContext: ResolveRouteContext<TRouteContextFn, TBeforeLoadFn>\n  routeContextFn: TRouteContextFn\n  beforeLoadFn: TBeforeLoadFn\n  allContext: ResolveAllContext<\n    TParentRoute,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn\n  >\n  children: TChildren\n  loaderData: ResolveLoaderData<TLoaderFn>\n  loaderDeps: TLoaderDeps\n  fileRouteTypes: TFileRouteTypes\n  ssr: ResolveSSR<TSSR>\n  allSsr: ResolveAllSSR<TParentRoute, TSSR>\n}\n\nexport type ResolveSSR<TSSR> = TSSR extends (...args: ReadonlyArray<any>) => any\n  ? LooseReturnType<TSSR>\n  : TSSR\n\nexport type ResolveAllSSR<\n  TParentRoute extends AnyRoute,\n  TSSR,\n> = unknown extends TParentRoute\n  ? ResolveSSR<TSSR>\n  : unknown extends TSSR\n    ? TParentRoute['types']['allSsr']\n    : ResolveSSR<TSSR>\n\nexport type ResolveFullPath<\n  TParentRoute extends AnyRoute,\n  TPath extends string,\n  TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>,\n> = TPrefixed extends RootRouteId ? '/' : TPrefixed\n\nexport interface RouteExtensions<in out TId, in out TFullPath> {\n  id: TId\n  fullPath: TFullPath\n}\n\nexport type RouteLazyFn<TRoute extends AnyRoute> = (\n  lazyFn: () => Promise<LazyRoute<TRoute>>,\n) => TRoute\n\nexport type RouteAddChildrenFn<\n  in out TRegister,\n  in out TParentRoute extends AnyRoute,\n  in out TPath extends string,\n  in out TFullPath extends string,\n  in out TCustomId extends string,\n  in out TId extends string,\n  in out TSearchValidator,\n  in out TParams,\n  in out TRouterContext,\n  in out TRouteContextFn,\n  in out TBeforeLoadFn,\n  in out TLoaderDeps extends Record<string, any>,\n  in out TLoaderFn,\n  in out TFileRouteTypes,\n  in out TSSR,\n  in out TServerMiddlewares,\n  in out THandlers,\n> = <const TNewChildren>(\n  children: Constrain<\n    TNewChildren,\n    ReadonlyArray<AnyRoute> | Record<string, AnyRoute>\n  >,\n) => Route<\n  TRegister,\n  TParentRoute,\n  TPath,\n  TFullPath,\n  TCustomId,\n  TId,\n  TSearchValidator,\n  TParams,\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TNewChildren,\n  TFileRouteTypes,\n  TSSR,\n  TServerMiddlewares,\n  THandlers\n>\n\nexport type RouteAddFileChildrenFn<\n  in out TRegister,\n  in out TParentRoute extends AnyRoute,\n  in out TPath extends string,\n  in out TFullPath extends string,\n  in out TCustomId extends string,\n  in out TId extends string,\n  in out TSearchValidator,\n  in out TParams,\n  in out TRouterContext,\n  in out TRouteContextFn,\n  in out TBeforeLoadFn,\n  in out TLoaderDeps extends Record<string, any>,\n  in out TLoaderFn,\n  in out TFileRouteTypes,\n  in out TSSR,\n  in out TServerMiddlewares,\n  in out THandlers,\n> = <const TNewChildren>(\n  children: TNewChildren,\n) => Route<\n  TRegister,\n  TParentRoute,\n  TPath,\n  TFullPath,\n  TCustomId,\n  TId,\n  TSearchValidator,\n  TParams,\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TNewChildren,\n  TFileRouteTypes,\n  TSSR,\n  TServerMiddlewares,\n  THandlers\n>\n\nexport type RouteAddFileTypesFn<\n  TRegister,\n  TParentRoute extends AnyRoute,\n  TPath extends string,\n  TFullPath extends string,\n  TCustomId extends string,\n  TId extends string,\n  TSearchValidator,\n  TParams,\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps extends Record<string, any>,\n  TLoaderFn,\n  TChildren,\n  TSSR,\n  TServerMiddlewares,\n  THandlers,\n> = <TNewFileRouteTypes>() => Route<\n  TRegister,\n  TParentRoute,\n  TPath,\n  TFullPath,\n  TCustomId,\n  TId,\n  TSearchValidator,\n  TParams,\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TChildren,\n  TNewFileRouteTypes,\n  TSSR,\n  TServerMiddlewares,\n  THandlers\n>\n\nexport interface Route<\n  in out TRegister,\n  in out TParentRoute extends AnyRoute,\n  in out TPath extends string,\n  in out TFullPath extends string,\n  in out TCustomId extends string,\n  in out TId extends string,\n  in out TSearchValidator,\n  in out TParams,\n  in out TRouterContext,\n  in out TRouteContextFn,\n  in out TBeforeLoadFn,\n  in out TLoaderDeps extends Record<string, any>,\n  in out TLoaderFn,\n  in out TChildren,\n  in out TFileRouteTypes,\n  in out TSSR,\n  in out TServerMiddlewares,\n  in out THandlers,\n> extends RouteExtensions<TId, TFullPath> {\n  path: TPath\n  parentRoute: TParentRoute\n  children?: TChildren\n  types: RouteTypes<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TFileRouteTypes,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n  options: RouteOptions<\n    TRegister,\n    TParentRoute,\n    TId,\n    TCustomId,\n    TFullPath,\n    TPath,\n    TSearchValidator,\n    TParams,\n    TLoaderDeps,\n    TLoaderFn,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n  isRoot: TParentRoute extends AnyRoute ? true : false\n  /** @internal */\n  _componentsPromise?: Promise<void>\n  /** @internal */\n  _componentsLoaded?: boolean\n  lazyFn?: () => Promise<\n    LazyRoute<\n      Route<\n        TRegister,\n        TParentRoute,\n        TPath,\n        TFullPath,\n        TCustomId,\n        TId,\n        TSearchValidator,\n        TParams,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn,\n        TLoaderDeps,\n        TLoaderFn,\n        TChildren,\n        TFileRouteTypes,\n        TSSR,\n        TServerMiddlewares,\n        THandlers\n      >\n    >\n  >\n  /** @internal */\n  _lazyPromise?: Promise<void>\n  /** @internal */\n  _lazyLoaded?: boolean\n  rank: number\n  to: TrimPathRight<TFullPath>\n  init: (opts: { originalIndex: number }) => void\n  update: (\n    options: UpdatableRouteOptions<\n      TParentRoute,\n      TCustomId,\n      TFullPath,\n      TParams,\n      TSearchValidator,\n      TLoaderFn,\n      TLoaderDeps,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn\n    >,\n  ) => this\n  lazy: RouteLazyFn<\n    Route<\n      TRegister,\n      TParentRoute,\n      TPath,\n      TFullPath,\n      TCustomId,\n      TId,\n      TSearchValidator,\n      TParams,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TChildren,\n      TFileRouteTypes,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >\n  >\n  addChildren: RouteAddChildrenFn<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TFileRouteTypes,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n  _addFileChildren: RouteAddFileChildrenFn<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TFileRouteTypes,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n  _addFileTypes: RouteAddFileTypesFn<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n  /**\n   * Create a redirect with `from` automatically set to this route's path.\n   * Enables relative redirects like `Route.redirect({ to: './overview' })`.\n   * @param opts Redirect options (same as `redirect()` but without `from`)\n   * @returns A redirect Response that can be thrown from loaders/beforeLoad\n   * @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction\n   */\n  redirect: RedirectFnRoute<TFullPath>\n}\n\nexport type AnyRoute = Route<\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any\n>\n\nexport type AnyRouteWithContext<TContext> = AnyRoute & {\n  types: { allContext: TContext }\n}\n\nexport type RouteOptions<\n  TRegister,\n  TParentRoute extends AnyRoute = AnyRoute,\n  TId extends string = string,\n  TCustomId extends string = string,\n  TFullPath extends string = string,\n  TPath extends string = string,\n  TSearchValidator = undefined,\n  TParams = AnyPathParams,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TSSR = unknown,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n> = BaseRouteOptions<\n  TRegister,\n  TParentRoute,\n  TId,\n  TCustomId,\n  TPath,\n  TSearchValidator,\n  TParams,\n  TLoaderDeps,\n  TLoaderFn,\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TSSR,\n  TServerMiddlewares,\n  THandlers\n> &\n  UpdatableRouteOptions<\n    NoInfer<TParentRoute>,\n    NoInfer<TCustomId>,\n    NoInfer<TFullPath>,\n    NoInfer<TParams>,\n    NoInfer<TSearchValidator>,\n    NoInfer<TLoaderFn>,\n    NoInfer<TLoaderDeps>,\n    NoInfer<TRouterContext>,\n    NoInfer<TRouteContextFn>,\n    NoInfer<TBeforeLoadFn>\n  >\n\nexport type RouteContextFn<\n  in out TParentRoute extends AnyRoute,\n  in out TSearchValidator,\n  in out TParams,\n  in out TRouterContext,\n  in out TRouteId,\n> = (\n  ctx: RouteContextOptions<\n    TParentRoute,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteId\n  >,\n) => any\n\nexport type FileBaseRouteOptions<\n  TRegister,\n  TParentRoute extends AnyRoute = AnyRoute,\n  TId extends string = string,\n  TPath extends string = string,\n  TSearchValidator = undefined,\n  TParams = {},\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TRemountDepsFn = AnyContext,\n  TSSR = unknown,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n> = ParamsOptions<TPath, TParams> &\n  FilebaseRouteOptionsInterface<\n    TRegister,\n    TParentRoute,\n    TId,\n    TPath,\n    TSearchValidator,\n    TParams,\n    TLoaderDeps,\n    TLoaderFn,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TRemountDepsFn,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n\nexport interface FilebaseRouteOptionsInterface<\n  TRegister,\n  TParentRoute extends AnyRoute = AnyRoute,\n  TId extends string = string,\n  TPath extends string = string,\n  TSearchValidator = undefined,\n  TParams = {},\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TRemountDepsFn = AnyContext,\n  TSSR = unknown,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n> {\n  validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>\n\n  shouldReload?:\n    | boolean\n    | ((\n        match: LoaderFnContext<\n          TRegister,\n          TParentRoute,\n          TId,\n          TParams,\n          TLoaderDeps,\n          TRouterContext,\n          TRouteContextFn,\n          TBeforeLoadFn,\n          TServerMiddlewares,\n          THandlers\n        >,\n      ) => any)\n\n  context?: Constrain<\n    TRouteContextFn,\n    (\n      ctx: RouteContextOptions<\n        TParentRoute,\n        TParams,\n        TRouterContext,\n        TLoaderDeps,\n        TId\n      >,\n    ) => any\n  >\n\n  ssr?: Constrain<\n    TSSR,\n    | undefined\n    | SSROption\n    | ((\n        ctx: SsrContextOptions<TParentRoute, TSearchValidator, TParams>,\n      ) => Awaitable<undefined | SSROption>)\n  >\n\n  // This async function is called before a route is loaded.\n  // If an error is thrown here, the route's loader will not be called.\n  // If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function.\n  // If thrown during a preload event, the error will be logged to the console.\n  beforeLoad?: Constrain<\n    TBeforeLoadFn,\n    (\n      ctx: BeforeLoadContextOptions<\n        TRegister,\n        TParentRoute,\n        TSearchValidator,\n        TParams,\n        TRouterContext,\n        TRouteContextFn,\n        TId,\n        TServerMiddlewares,\n        THandlers\n      >,\n    ) => ValidateSerializableLifecycleResult<\n      TRegister,\n      TParentRoute,\n      TSSR,\n      TBeforeLoadFn\n    >\n  >\n\n  loaderDeps?: (\n    opts: FullSearchSchemaOption<TParentRoute, TSearchValidator>,\n  ) => TLoaderDeps\n\n  remountDeps?: Constrain<\n    TRemountDepsFn,\n    (\n      opt: RemountDepsOptions<\n        TId,\n        ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n        Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>,\n        TLoaderDeps\n      >,\n    ) => any\n  >\n\n  loader?: Constrain<\n    TLoaderFn,\n    | RouteLoaderFn<\n        TRegister,\n        TParentRoute,\n        TId,\n        TParams,\n        TLoaderDeps,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn,\n        TServerMiddlewares,\n        THandlers\n      >\n    | RouteLoaderObject<\n        TRegister,\n        TParentRoute,\n        TId,\n        TParams,\n        TLoaderDeps,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn,\n        TServerMiddlewares,\n        THandlers\n      >\n  >\n}\n\nexport type BaseRouteOptions<\n  TRegister,\n  TParentRoute extends AnyRoute = AnyRoute,\n  TId extends string = string,\n  TCustomId extends string = string,\n  TPath extends string = string,\n  TSearchValidator = undefined,\n  TParams = {},\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TSSR = unknown,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n> = RoutePathOptions<TCustomId, TPath> &\n  FileBaseRouteOptions<\n    TRegister,\n    TParentRoute,\n    TId,\n    TPath,\n    TSearchValidator,\n    TParams,\n    TLoaderDeps,\n    TLoaderFn,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    AnyContext,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  > & {\n    getParentRoute: () => TParentRoute\n  }\n\nexport interface ContextOptions<\n  in out TParentRoute extends AnyRoute,\n  in out TParams,\n  in out TRouteId,\n> {\n  abortController: AbortController\n  preload: boolean\n  params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>\n  location: ParsedLocation\n  /**\n   * @deprecated Use `throw redirect({ to: '/somewhere' })` instead\n   **/\n  navigate: NavigateFn\n  buildLocation: BuildLocationFn\n  cause: 'preload' | 'enter' | 'stay'\n  matches: Array<MakeRouteMatchUnion>\n  routeId: TRouteId\n}\n\nexport interface RouteContextOptions<\n  in out TParentRoute extends AnyRoute,\n  in out TParams,\n  in out TRouterContext,\n  in out TLoaderDeps,\n  in out TRouteId,\n> extends ContextOptions<TParentRoute, TParams, TRouteId> {\n  deps: TLoaderDeps\n  context: Expand<RouteContextParameter<TParentRoute, TRouterContext>>\n}\n\nexport interface SsrContextOptions<\n  in out TParentRoute extends AnyRoute,\n  in out TSearchValidator,\n  in out TParams,\n> {\n  params:\n    | {\n        status: 'success'\n        value: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>\n      }\n    | { status: 'error'; error: unknown }\n  search:\n    | {\n        status: 'success'\n        value: Expand<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>\n      }\n    | { status: 'error'; error: unknown }\n  location: ParsedLocation\n  matches: Array<MakePreValidationErrorHandlingRouteMatchUnion>\n}\n\nexport interface BeforeLoadContextOptions<\n  in out TRegister,\n  in out TParentRoute extends AnyRoute,\n  in out TSearchValidator,\n  in out TParams,\n  in out TRouterContext,\n  in out TRouteContextFn,\n  in out TRouteId,\n  in out TServerMiddlewares,\n  in out THandlers,\n>\n  extends\n    ContextOptions<TParentRoute, TParams, TRouteId>,\n    FullSearchSchemaOption<TParentRoute, TSearchValidator> {\n  context: Expand<\n    BeforeLoadContextParameter<TParentRoute, TRouterContext, TRouteContextFn>\n  >\n}\n\ntype AssetFnContextOptions<\n  in out TRouteId,\n  in out TFullPath,\n  in out TParentRoute extends AnyRoute,\n  in out TParams,\n  in out TSearchValidator,\n  in out TLoaderFn,\n  in out TRouterContext,\n  in out TRouteContextFn,\n  in out TBeforeLoadFn,\n  in out TLoaderDeps,\n> = {\n  ssr?: {\n    nonce?: string\n  }\n  matches: Array<\n    RouteMatch<\n      TRouteId,\n      TFullPath,\n      ResolveAllParamsFromParent<TParentRoute, TParams>,\n      ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n      ResolveLoaderData<TLoaderFn>,\n      ResolveAllContext<\n        TParentRoute,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn\n      >,\n      TLoaderDeps\n    >\n  >\n  match: RouteMatch<\n    TRouteId,\n    TFullPath,\n    ResolveAllParamsFromParent<TParentRoute, TParams>,\n    ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n    ResolveLoaderData<TLoaderFn>,\n    ResolveAllContext<\n      TParentRoute,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn\n    >,\n    TLoaderDeps\n  >\n  params: ResolveAllParamsFromParent<TParentRoute, TParams>\n  loaderData?: ResolveLoaderData<TLoaderFn>\n}\n\nexport interface DefaultUpdatableRouteOptionsExtensions {\n  component?: unknown\n  errorComponent?: unknown\n  notFoundComponent?: unknown\n  pendingComponent?: unknown\n}\n\nexport interface UpdatableRouteOptionsExtensions extends DefaultUpdatableRouteOptionsExtensions {}\n\nexport interface UpdatableRouteOptions<\n  in out TParentRoute extends AnyRoute,\n  in out TRouteId,\n  in out TFullPath,\n  in out TParams,\n  in out TSearchValidator,\n  in out TLoaderFn,\n  in out TLoaderDeps,\n  in out TRouterContext,\n  in out TRouteContextFn,\n  in out TBeforeLoadFn,\n>\n  extends UpdatableStaticRouteOption, UpdatableRouteOptionsExtensions {\n  /**\n   * Options to control route matching behavior with runtime code.\n   *\n   * @experimental 🚧 this feature is subject to change\n   *\n   * @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouteOptionsType\n   */\n  skipRouteOnParseError?: {\n    /**\n     * If `true`, skip this route during matching if `params.parse` fails.\n     *\n     * Without this option, a `/$param` route could match *any* value for `param`,\n     * and only later during the route lifecycle would `params.parse` run and potentially\n     * show the `errorComponent` if validation failed.\n     *\n     * With this option enabled, the route will only match if `params.parse` succeeds.\n     * If it fails, the router will continue trying to match other routes, potentially\n     * finding a different route that works, or ultimately showing the `notFoundComponent`.\n     *\n     * @default false\n     */\n    params?: boolean\n    /**\n     * In cases where multiple routes would need to run `params.parse` during matching\n     * to determine which route to pick, this priority number can be used as a tie-breaker\n     * for which route to try first. Higher number = higher priority.\n     *\n     * @default 0\n     */\n    priority?: number\n  }\n  /**\n   * If true, this route will be matched as case-sensitive\n   *\n   * @default false\n   */\n  caseSensitive?: boolean\n  /**\n   * If true, this route will be forcefully wrapped in a suspense boundary\n   */\n  wrapInSuspense?: boolean\n  // The content to be rendered when the route is matched. If no component is provided, defaults to `<Outlet />`\n\n  pendingMs?: number\n  pendingMinMs?: number\n  staleTime?: number\n  gcTime?: number\n  preload?: boolean\n  preloadStaleTime?: number\n  preloadGcTime?: number\n  search?: {\n    middlewares?: Array<\n      SearchMiddleware<\n        ResolveFullSearchSchemaInput<TParentRoute, TSearchValidator>\n      >\n    >\n  }\n  /** \n  @deprecated Use search.middlewares instead\n  */\n  preSearchFilters?: Array<\n    SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>\n  >\n  /** \n  @deprecated Use search.middlewares instead\n  */\n  postSearchFilters?: Array<\n    SearchFilter<ResolveFullSearchSchema<TParentRoute, TSearchValidator>>\n  >\n  onCatch?: (error: Error) => void\n  onError?: (err: any) => void\n  // These functions are called as route matches are loaded, stick around and leave the active\n  // matches\n  onEnter?: (\n    match: RouteMatch<\n      TRouteId,\n      TFullPath,\n      ResolveAllParamsFromParent<TParentRoute, TParams>,\n      ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n      ResolveLoaderData<TLoaderFn>,\n      ResolveAllContext<\n        TParentRoute,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn\n      >,\n      TLoaderDeps\n    >,\n  ) => void\n  onStay?: (\n    match: RouteMatch<\n      TRouteId,\n      TFullPath,\n      ResolveAllParamsFromParent<TParentRoute, TParams>,\n      ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n      ResolveLoaderData<TLoaderFn>,\n      ResolveAllContext<\n        TParentRoute,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn\n      >,\n      TLoaderDeps\n    >,\n  ) => void\n  onLeave?: (\n    match: RouteMatch<\n      TRouteId,\n      TFullPath,\n      ResolveAllParamsFromParent<TParentRoute, TParams>,\n      ResolveFullSearchSchema<TParentRoute, TSearchValidator>,\n      ResolveLoaderData<TLoaderFn>,\n      ResolveAllContext<\n        TParentRoute,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn\n      >,\n      TLoaderDeps\n    >,\n  ) => void\n  headers?: (\n    ctx: AssetFnContextOptions<\n      TRouteId,\n      TFullPath,\n      TParentRoute,\n      TParams,\n      TSearchValidator,\n      TLoaderFn,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps\n    >,\n  ) => Awaitable<Record<string, string> | undefined>\n  head?: (\n    ctx: AssetFnContextOptions<\n      TRouteId,\n      TFullPath,\n      TParentRoute,\n      TParams,\n      TSearchValidator,\n      TLoaderFn,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps\n    >,\n  ) => Awaitable<{\n    links?: AnyRouteMatch['links']\n    scripts?: AnyRouteMatch['headScripts']\n    meta?: AnyRouteMatch['meta']\n    styles?: AnyRouteMatch['styles']\n  }>\n  scripts?: (\n    ctx: AssetFnContextOptions<\n      TRouteId,\n      TFullPath,\n      TParentRoute,\n      TParams,\n      TSearchValidator,\n      TLoaderFn,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps\n    >,\n  ) => Awaitable<AnyRouteMatch['scripts']>\n  codeSplitGroupings?: Array<\n    Array<\n      | 'loader'\n      | 'component'\n      | 'pendingComponent'\n      | 'notFoundComponent'\n      | 'errorComponent'\n    >\n  >\n}\n\nexport type RouteLoaderFn<\n  in out TRegister,\n  in out TParentRoute extends AnyRoute = AnyRoute,\n  in out TId extends string = string,\n  in out TParams = {},\n  in out TLoaderDeps = {},\n  in out TRouterContext = {},\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TServerMiddlewares = unknown,\n  in out THandlers = undefined,\n> = (\n  match: LoaderFnContext<\n    TRegister,\n    TParentRoute,\n    TId,\n    TParams,\n    TLoaderDeps,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TServerMiddlewares,\n    THandlers\n  >,\n) => any\n\nexport type LoaderStaleReloadMode = 'background' | 'blocking'\n\nexport type RouteLoaderEntry<\n  TRegister,\n  TParentRoute extends AnyRoute = AnyRoute,\n  TId extends string = string,\n  TParams = {},\n  TLoaderDeps = {},\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n> =\n  | RouteLoaderFn<\n      TRegister,\n      TParentRoute,\n      TId,\n      TParams,\n      TLoaderDeps,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TServerMiddlewares,\n      THandlers\n    >\n  | RouteLoaderObject<\n      TRegister,\n      TParentRoute,\n      TId,\n      TParams,\n      TLoaderDeps,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TServerMiddlewares,\n      THandlers\n    >\n\nexport interface LoaderFnContext<\n  in out TRegister = unknown,\n  in out TParentRoute extends AnyRoute = AnyRoute,\n  in out TId extends string = string,\n  in out TParams = {},\n  in out TLoaderDeps = {},\n  in out TRouterContext = {},\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TServerMiddlewares = unknown,\n  in out THandlers = undefined,\n> {\n  abortController: AbortController\n  preload: boolean\n  params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>\n  deps: TLoaderDeps\n  context: Expand<\n    ResolveAllContext<\n      TParentRoute,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn\n    >\n  >\n  location: ParsedLocation // Do not supply search schema here so as to demotivate people from trying to shortcut loaderDeps\n  /**\n   * @deprecated Use `throw redirect({ to: '/somewhere' })` instead\n   **/\n  navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n  // root route does not have a parent match\n  parentMatchPromise: TId extends RootRouteId\n    ? never\n    : Promise<MakeRouteMatchFromRoute<TParentRoute>>\n  cause: 'preload' | 'enter' | 'stay'\n  route: AnyRoute\n}\n\nexport interface DefaultRootRouteOptionsExtensions {\n  shellComponent?: unknown\n}\n\nexport interface RootRouteOptionsExtensions extends DefaultRootRouteOptionsExtensions {}\n\nexport interface RootRouteOptions<\n  TRegister = unknown,\n  TSearchValidator = undefined,\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TSSR = unknown,\n  TServerMiddlewares = unknown,\n  THandlers = undefined,\n>\n  extends\n    Omit<\n      RouteOptions<\n        TRegister,\n        any, // TParentRoute\n        RootRouteId, // TId\n        RootRouteId, // TCustomId\n        '', // TFullPath\n        '', // TPath\n        TSearchValidator,\n        {}, // TParams\n        TLoaderDeps,\n        TLoaderFn,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn,\n        TSSR,\n        TServerMiddlewares,\n        THandlers\n      >,\n      | 'path'\n      | 'id'\n      | 'getParentRoute'\n      | 'caseSensitive'\n      | 'parseParams'\n      | 'stringifyParams'\n      | 'params'\n    >,\n    RootRouteOptionsExtensions {}\n\nexport type RouteConstraints = {\n  TParentRoute: AnyRoute\n  TPath: string\n  TFullPath: string\n  TCustomId: string\n  TId: string\n  TSearchSchema: AnySchema\n  TFullSearchSchema: AnySchema\n  TParams: Record<string, any>\n  TAllParams: Record<string, any>\n  TParentContext: AnyContext\n  TRouteContext: RouteContext\n  TAllContext: AnyContext\n  TRouterContext: AnyContext\n  TChildren: unknown\n  TRouteTree: AnyRoute\n}\n\nexport type RouteTypesById<TRouter extends AnyRouter, TId> = RouteById<\n  TRouter['routeTree'],\n  TId\n>['types']\n\nexport type RouteMask<TRouteTree extends AnyRoute> = {\n  routeTree: TRouteTree\n  from: RoutePaths<TRouteTree>\n  to?: any\n  params?: any\n  search?: any\n  hash?: any\n  state?: any\n  unmaskOnReload?: boolean\n}\n\n/**\n * @deprecated Use `ErrorComponentProps` instead.\n */\nexport type ErrorRouteProps = {\n  error: unknown\n  info?: { componentStack: string }\n  reset: () => void\n}\n\nexport type ErrorComponentProps<TError = Error> = {\n  error: TError\n  info?: { componentStack: string }\n  reset: () => void\n}\n\nexport type NotFoundRouteProps = {\n  data?: unknown\n  isNotFound: boolean\n  routeId: RouteIds<RegisteredRouter['routeTree']>\n}\n\nexport class BaseRoute<\n  in out TRegister = Register,\n  in out TParentRoute extends AnyRoute = AnyRoute,\n  in out TPath extends string = '/',\n  in out TFullPath extends string = ResolveFullPath<TParentRoute, TPath>,\n  in out TCustomId extends string = string,\n  in out TId extends string = ResolveId<TParentRoute, TCustomId, TPath>,\n  in out TSearchValidator = undefined,\n  in out TParams = ResolveParams<TPath>,\n  in out TRouterContext = AnyContext,\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TLoaderDeps extends Record<string, any> = {},\n  in out TLoaderFn = undefined,\n  in out TChildren = unknown,\n  in out TFileRouteTypes = unknown,\n  in out TSSR = unknown,\n  in out TServerMiddlewares = unknown,\n  in out THandlers = undefined,\n> {\n  isRoot: TParentRoute extends AnyRoute ? true : false\n  options: RouteOptions<\n    TRegister,\n    TParentRoute,\n    TId,\n    TCustomId,\n    TFullPath,\n    TPath,\n    TSearchValidator,\n    TParams,\n    TLoaderDeps,\n    TLoaderFn,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n\n  // The following properties are set up in this.init()\n  parentRoute!: TParentRoute\n  private _id!: TId\n  private _path!: TPath\n  private _fullPath!: TFullPath\n  private _to!: TrimPathRight<TFullPath>\n\n  public get to() {\n    return this._to\n  }\n\n  public get id() {\n    return this._id\n  }\n\n  public get path() {\n    return this._path\n  }\n\n  public get fullPath() {\n    return this._fullPath\n  }\n\n  // Optional\n  children?: TChildren\n  originalIndex?: number\n  rank!: number\n  lazyFn?: () => Promise<\n    LazyRoute<\n      Route<\n        TRegister,\n        TParentRoute,\n        TPath,\n        TFullPath,\n        TCustomId,\n        TId,\n        TSearchValidator,\n        TParams,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn,\n        TLoaderDeps,\n        TLoaderFn,\n        TChildren,\n        TFileRouteTypes,\n        TSSR,\n        TServerMiddlewares,\n        THandlers\n      >\n    >\n  >\n  /** @internal */\n  _lazyPromise?: Promise<void>\n  /** @internal */\n  _componentsPromise?: Promise<void>\n\n  constructor(\n    options?: RouteOptions<\n      TRegister,\n      TParentRoute,\n      TId,\n      TCustomId,\n      TFullPath,\n      TPath,\n      TSearchValidator,\n      TParams,\n      TLoaderDeps,\n      TLoaderFn,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >,\n  ) {\n    this.options = (options as any) || {}\n    this.isRoot = !options?.getParentRoute as any\n\n    if ((options as any)?.id && (options as any)?.path) {\n      throw new Error(`Route cannot have both an 'id' and a 'path' option.`)\n    }\n  }\n\n  types!: RouteTypes<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TFileRouteTypes,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  >\n\n  init = (opts: { originalIndex: number }): void => {\n    this.originalIndex = opts.originalIndex\n\n    const options = this.options as\n      | (RouteOptions<\n          TRegister,\n          TParentRoute,\n          TId,\n          TCustomId,\n          TFullPath,\n          TPath,\n          TSearchValidator,\n          TParams,\n          TLoaderDeps,\n          TLoaderFn,\n          TRouterContext,\n          TRouteContextFn,\n          TBeforeLoadFn,\n          TSSR,\n          TServerMiddlewares\n        > &\n          RoutePathOptionsIntersection<TCustomId, TPath>)\n      | undefined\n\n    const isRoot = !options?.path && !options?.id\n\n    this.parentRoute = this.options.getParentRoute?.()\n\n    if (isRoot) {\n      this._path = rootRouteId as TPath\n    } else if (!this.parentRoute) {\n      invariant(\n        false,\n        `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`,\n      )\n    }\n\n    let path: undefined | string = isRoot ? rootRouteId : options?.path\n\n    // If the path is anything other than an index path, trim it up\n    if (path && path !== '/') {\n      path = trimPathLeft(path)\n    }\n\n    const customId = options?.id || path\n\n    // Strip the parentId prefix from the first level of children\n    let id = isRoot\n      ? rootRouteId\n      : joinPaths([\n          this.parentRoute.id === rootRouteId ? '' : this.parentRoute.id,\n          customId,\n        ])\n\n    if (path === rootRouteId) {\n      path = '/'\n    }\n\n    if (id !== rootRouteId) {\n      id = joinPaths(['/', id])\n    }\n\n    const fullPath =\n      id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])\n\n    this._path = path as TPath\n    this._id = id as TId\n    this._fullPath = fullPath as TFullPath\n    this._to = trimPathRight(fullPath) as TrimPathRight<TFullPath>\n  }\n\n  addChildren: RouteAddChildrenFn<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TFileRouteTypes,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  > = (children) => {\n    return this._addFileChildren(children) as any\n  }\n\n  _addFileChildren: RouteAddFileChildrenFn<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TFileRouteTypes,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  > = (children) => {\n    if (Array.isArray(children)) {\n      this.children = children as TChildren\n    }\n\n    if (typeof children === 'object' && children !== null) {\n      this.children = Object.values(children) as TChildren\n    }\n\n    return this as any\n  }\n\n  _addFileTypes: RouteAddFileTypesFn<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TSSR,\n    TServerMiddlewares,\n    THandlers\n  > = () => {\n    return this as any\n  }\n\n  updateLoader = <TNewLoaderFn>(options: {\n    loader: Constrain<\n      TNewLoaderFn,\n      RouteLoaderFn<\n        TRegister,\n        TParentRoute,\n        TCustomId,\n        TParams,\n        TLoaderDeps,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn\n      >\n    >\n  }) => {\n    Object.assign(this.options, options)\n    return this as unknown as BaseRoute<\n      TRegister,\n      TParentRoute,\n      TPath,\n      TFullPath,\n      TCustomId,\n      TId,\n      TSearchValidator,\n      TParams,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TNewLoaderFn,\n      TChildren,\n      TFileRouteTypes,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >\n  }\n\n  update = (\n    options: UpdatableRouteOptions<\n      TParentRoute,\n      TCustomId,\n      TFullPath,\n      TParams,\n      TSearchValidator,\n      TLoaderFn,\n      TLoaderDeps,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn\n    >,\n  ): this => {\n    Object.assign(this.options, options)\n    return this\n  }\n\n  lazy: RouteLazyFn<\n    Route<\n      TRegister,\n      TParentRoute,\n      TPath,\n      TFullPath,\n      TCustomId,\n      TId,\n      TSearchValidator,\n      TParams,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TChildren,\n      TFileRouteTypes,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >\n  > = (lazyFn) => {\n    this.lazyFn = lazyFn\n    return this\n  }\n\n  /**\n   * Create a redirect with `from` automatically set to this route's fullPath.\n   * Enables relative redirects like `Route.redirect({ to: './overview' })`.\n   * @param opts Redirect options (same as `redirect()` but without `from`)\n   * @returns A redirect Response that can be thrown from loaders/beforeLoad\n   * @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction\n   */\n  redirect: RedirectFnRoute<TFullPath> = (opts) =>\n    redirect({ from: this.fullPath, ...opts } as any)\n}\n\nexport class BaseRouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {\n  id: TId\n\n  constructor({ id }: { id: TId }) {\n    this.id = id\n  }\n\n  notFound = (opts?: NotFoundError) => {\n    return notFound({ routeId: this.id as string, ...opts })\n  }\n\n  /**\n   * Create a redirect with `from` automatically set to this route's path.\n   * Enables relative redirects like `routeApi.redirect({ to: './overview' })`.\n   * @param opts Redirect options (same as `redirect()` but without `from`)\n   * @returns A redirect Response that can be thrown from loaders/beforeLoad\n   * @link https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction\n   */\n  redirect: RedirectFnRoute<RouteTypesById<TRouter, TId>['fullPath']> = (\n    opts,\n  ) => redirect({ from: this.id as string, ...opts } as any)\n}\n\nexport interface RootRoute<\n  in out TRegister,\n  in out TSearchValidator = undefined,\n  in out TRouterContext = {},\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TLoaderDeps extends Record<string, any> = {},\n  in out TLoaderFn = undefined,\n  in out TChildren = unknown,\n  in out TFileRouteTypes = unknown,\n  in out TSSR = unknown,\n  in out TServerMiddlewares = unknown,\n  in out THandlers = undefined,\n> extends Route<\n  TRegister,\n  any, // TParentRoute\n  '/', // TPath\n  '/', // TFullPath\n  string, // TCustomId\n  RootRouteId, // TId\n  TSearchValidator, // TSearchValidator\n  {}, // TParams\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TChildren, // TChildren\n  TFileRouteTypes,\n  TSSR,\n  TServerMiddlewares,\n  THandlers\n> {}\n\nexport class BaseRootRoute<\n  in out TRegister = Register,\n  in out TSearchValidator = undefined,\n  in out TRouterContext = {},\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TLoaderDeps extends Record<string, any> = {},\n  in out TLoaderFn = undefined,\n  in out TChildren = unknown,\n  in out TFileRouteTypes = unknown,\n  in out TSSR = unknown,\n  in out TServerMiddlewares = unknown,\n  in out THandlers = undefined,\n> extends BaseRoute<\n  TRegister,\n  any, // TParentRoute\n  '/', // TPath\n  '/', // TFullPath\n  string, // TCustomId\n  RootRouteId, // TId\n  TSearchValidator, // TSearchValidator\n  {}, // TParams\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TChildren, // TChildren\n  TFileRouteTypes,\n  TSSR,\n  TServerMiddlewares,\n  THandlers\n> {\n  constructor(\n    options?: RootRouteOptions<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TSSR,\n      TServerMiddlewares,\n      THandlers\n    >,\n  ) {\n    super(options as any)\n  }\n}\n\n//\n\nexport interface RouteLike {\n  id: string\n  isRoot?: boolean\n  path?: string\n  fullPath: string\n  rank?: number\n  parentRoute?: RouteLike\n  children?: Array<RouteLike>\n  options?: {\n    caseSensitive?: boolean\n  }\n}\n"
  },
  {
    "path": "packages/router-core/src/routeInfo.ts",
    "content": "import type { InferFileRouteTypes } from './fileRoute'\nimport type { AddTrailingSlash, RemoveTrailingSlashes } from './link'\nimport type { AnyRoute } from './route'\nimport type { AnyRouter, TrailingSlashOption } from './router'\nimport type { PartialMergeAll } from './utils'\n\nexport type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {\n  types: { children: infer TChildren }\n}\n  ? unknown extends TChildren\n    ? TAcc\n    : TChildren extends ReadonlyArray<any>\n      ? ParseRoute<TChildren[number], TAcc | TChildren[number]>\n      : ParseRoute<\n          TChildren[keyof TChildren],\n          TAcc | TChildren[keyof TChildren]\n        >\n  : TAcc\n\nexport type ParseRouteWithoutBranches<TRouteTree> =\n  ParseRoute<TRouteTree> extends infer TRoute extends AnyRoute\n    ? TRoute extends any\n      ? unknown extends TRoute['types']['children']\n        ? TRoute\n        : TRoute['types']['children'] extends ReadonlyArray<any>\n          ? '/' extends TRoute['types']['children'][number]['path']\n            ? never\n            : TRoute\n          : '/' extends TRoute['types']['children'][keyof TRoute['types']['children']]['path']\n            ? never\n            : TRoute\n      : never\n    : never\n\nexport type CodeRoutesById<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? {\n        [K in TRoutes as K['id']]: K\n      }\n    : never\n\nexport type RoutesById<TRouteTree extends AnyRoute> =\n  InferFileRouteTypes<TRouteTree> extends never\n    ? CodeRoutesById<TRouteTree>\n    : InferFileRouteTypes<TRouteTree>['fileRoutesById']\n\nexport type RouteById<TRouteTree extends AnyRoute, TId> = Extract<\n  RoutesById<TRouteTree>[TId & keyof RoutesById<TRouteTree>],\n  AnyRoute\n>\n\nexport type CodeRouteIds<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? TRoutes['id']\n    : never\n\nexport type RouteIds<TRouteTree extends AnyRoute> =\n  InferFileRouteTypes<TRouteTree> extends never\n    ? CodeRouteIds<TRouteTree>\n    : InferFileRouteTypes<TRouteTree>['id']\n\nexport type ParentPath<TRouter extends AnyRouter> =\n  TrailingSlashOptionByRouter<TRouter> extends 'always'\n    ? '../'\n    : TrailingSlashOptionByRouter<TRouter> extends 'never'\n      ? '..'\n      : '../' | '..'\n\nexport type CurrentPath<TRouter extends AnyRouter> =\n  TrailingSlashOptionByRouter<TRouter> extends 'always'\n    ? './'\n    : TrailingSlashOptionByRouter<TRouter> extends 'never'\n      ? '.'\n      : './' | '.'\n\nexport type ToPath<TRouter extends AnyRouter, TTo extends string> =\n  TrailingSlashOptionByRouter<TRouter> extends 'always'\n    ? AddTrailingSlash<TTo>\n    : TrailingSlashOptionByRouter<TRouter> extends 'never'\n      ? RemoveTrailingSlashes<TTo>\n      : AddTrailingSlash<TTo> | RemoveTrailingSlashes<TTo>\n\nexport type CatchAllPaths<TRouter extends AnyRouter> =\n  | CurrentPath<TRouter>\n  | ParentPath<TRouter>\n\nexport type CodeRoutesByPath<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? {\n        [K in TRoutes as K['fullPath']]: K\n      }\n    : never\n\nexport type RoutesByPath<TRouteTree extends AnyRoute> =\n  InferFileRouteTypes<TRouteTree> extends never\n    ? CodeRoutesByPath<TRouteTree>\n    : InferFileRouteTypes<TRouteTree>['fileRoutesByFullPath']\n\nexport type RouteByPath<TRouteTree extends AnyRoute, TPath> = Extract<\n  RoutesByPath<TRouteTree>[TPath & keyof RoutesByPath<TRouteTree>],\n  AnyRoute\n>\n\nexport type CodeRoutePaths<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? TRoutes['fullPath']\n    : never\n\nexport type RoutePaths<TRouteTree extends AnyRoute> = unknown extends TRouteTree\n  ? string\n  :\n      | (InferFileRouteTypes<TRouteTree> extends never\n          ? CodeRoutePaths<TRouteTree>\n          : InferFileRouteTypes<TRouteTree>['fullPaths'])\n      | '/'\n\nexport type RouteToPathAlwaysTrailingSlash<TRoute extends AnyRoute> =\n  TRoute['path'] extends '/'\n    ? TRoute['fullPath']\n    : TRoute['fullPath'] extends '/'\n      ? TRoute['fullPath']\n      : `${TRoute['fullPath']}/`\n\nexport type RouteToPathNeverTrailingSlash<TRoute extends AnyRoute> =\n  TRoute['path'] extends '/'\n    ? TRoute['fullPath'] extends '/'\n      ? TRoute['fullPath']\n      : RemoveTrailingSlashes<TRoute['fullPath']>\n    : TRoute['fullPath']\n\nexport type RouteToPathPreserveTrailingSlash<TRoute extends AnyRoute> =\n  | RouteToPathNeverTrailingSlash<TRoute>\n  | RouteToPathAlwaysTrailingSlash<TRoute>\n\nexport type RouteToPathByTrailingSlashOption<TRoute extends AnyRoute> = {\n  always: RouteToPathAlwaysTrailingSlash<TRoute>\n  preserve: RouteToPathPreserveTrailingSlash<TRoute>\n  never: RouteToPathNeverTrailingSlash<TRoute>\n}\n\nexport type TrailingSlashOptionByRouter<TRouter extends AnyRouter> =\n  TrailingSlashOption extends TRouter['options']['trailingSlash']\n    ? 'never'\n    : NonNullable<TRouter['options']['trailingSlash']>\n\nexport type RouteToByRouter<\n  TRouter extends AnyRouter,\n  TRoute extends AnyRoute,\n> = RouteToPathByTrailingSlashOption<TRoute>[TrailingSlashOptionByRouter<TRouter>]\n\nexport type CodeRouteToPath<TRouter extends AnyRouter> =\n  ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoute extends\n    AnyRoute\n    ? TRoute extends any\n      ? RouteToByRouter<TRouter, TRoute>\n      : never\n    : never\n\nexport type FileRouteToPath<\n  TRouter extends AnyRouter,\n  TTo = InferFileRouteTypes<TRouter['routeTree']>['to'],\n  TTrailingSlashOption = TrailingSlashOptionByRouter<TRouter>,\n> = 'never' extends TTrailingSlashOption\n  ? TTo\n  : 'always' extends TTrailingSlashOption\n    ? AddTrailingSlash<TTo>\n    : TTo | AddTrailingSlash<TTo>\n\nexport type RouteToPath<TRouter extends AnyRouter> = unknown extends TRouter\n  ? string\n  : InferFileRouteTypes<TRouter['routeTree']> extends never\n    ? CodeRouteToPath<TRouter>\n    : FileRouteToPath<TRouter>\n\nexport type CodeRoutesByToPath<TRouter extends AnyRouter> =\n  ParseRouteWithoutBranches<TRouter['routeTree']> extends infer TRoutes extends\n    AnyRoute\n    ? {\n        [TRoute in TRoutes as RouteToByRouter<TRouter, TRoute>]: TRoute\n      }\n    : never\n\nexport type RoutesByToPath<TRouter extends AnyRouter> =\n  InferFileRouteTypes<TRouter['routeTree']> extends never\n    ? CodeRoutesByToPath<TRouter>\n    : InferFileRouteTypes<TRouter['routeTree']>['fileRoutesByTo']\n\nexport type CodeRouteByToPath<TRouter extends AnyRouter, TTo> = Extract<\n  RoutesByToPath<TRouter>[TTo & keyof RoutesByToPath<TRouter>],\n  AnyRoute\n>\n\nexport type FileRouteByToPath<TRouter extends AnyRouter, TTo> =\n  'never' extends TrailingSlashOptionByRouter<TRouter>\n    ? CodeRouteByToPath<TRouter, TTo>\n    : 'always' extends TrailingSlashOptionByRouter<TRouter>\n      ? TTo extends '/'\n        ? CodeRouteByToPath<TRouter, TTo>\n        : TTo extends `${infer TPath}/`\n          ? CodeRouteByToPath<TRouter, TPath>\n          : never\n      : CodeRouteByToPath<\n          TRouter,\n          TTo extends '/' ? TTo : RemoveTrailingSlashes<TTo>\n        >\n\nexport type RouteByToPath<TRouter extends AnyRouter, TTo> =\n  InferFileRouteTypes<TRouter['routeTree']> extends never\n    ? CodeRouteByToPath<TRouter, TTo>\n    : FileRouteByToPath<TRouter, TTo>\n\nexport type FullSearchSchema<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? PartialMergeAll<TRoutes['types']['fullSearchSchema']>\n    : never\n\nexport type FullSearchSchemaInput<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? PartialMergeAll<TRoutes['types']['fullSearchSchemaInput']>\n    : never\n\nexport type AllParams<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? PartialMergeAll<TRoutes['types']['allParams']>\n    : never\n\nexport type AllContext<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? PartialMergeAll<TRoutes['types']['allContext']>\n    : never\n\nexport type AllLoaderData<TRouteTree extends AnyRoute> =\n  ParseRoute<TRouteTree> extends infer TRoutes extends AnyRoute\n    ? PartialMergeAll<TRoutes['types']['loaderData']>\n    : never\n"
  },
  {
    "path": "packages/router-core/src/router.ts",
    "content": "import { createBrowserHistory, parseHref } from '@tanstack/history'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport {\n  DEFAULT_PROTOCOL_ALLOWLIST,\n  createControlledPromise,\n  decodePath,\n  deepEqual,\n  encodePathLikeUrl,\n  findLast,\n  functionalUpdate,\n  isDangerousProtocol,\n  last,\n  nullReplaceEqualDeep,\n  replaceEqualDeep,\n} from './utils'\nimport {\n  findFlatMatch,\n  findRouteMatch,\n  findSingleMatch,\n  processRouteMasks,\n  processRouteTree,\n} from './new-process-route-tree'\nimport {\n  cleanPath,\n  compileDecodeCharMap,\n  interpolatePath,\n  resolvePath,\n  trimPath,\n  trimPathRight,\n} from './path'\nimport { createLRUCache } from './lru-cache'\nimport { isNotFound } from './not-found'\nimport { setupScrollRestoration } from './scroll-restoration'\nimport { defaultParseSearch, defaultStringifySearch } from './searchParams'\nimport { rootRouteId } from './root'\nimport { isRedirect, redirect } from './redirect'\nimport { loadMatches, loadRouteChunk, routeNeedsPreload } from './load-matches'\nimport {\n  composeRewrites,\n  executeRewriteInput,\n  executeRewriteOutput,\n  rewriteBasepath,\n} from './rewrite'\nimport { createRouterStores } from './stores'\nimport type { LRUCache } from './lru-cache'\nimport type {\n  ProcessRouteTreeResult,\n  ProcessedTree,\n} from './new-process-route-tree'\nimport type { SearchParser, SearchSerializer } from './searchParams'\nimport type { AnyRedirect, ResolvedRedirect } from './redirect'\nimport type {\n  HistoryLocation,\n  HistoryState,\n  ParsedHistoryState,\n  RouterHistory,\n} from '@tanstack/history'\n\nimport type {\n  Awaitable,\n  Constrain,\n  ControlledPromise,\n  NoInfer,\n  NonNullableUpdater,\n  PickAsRequired,\n  Updater,\n} from './utils'\nimport type { ParsedLocation } from './location'\nimport type {\n  AnyContext,\n  AnyRoute,\n  AnyRouteWithContext,\n  LoaderStaleReloadMode,\n  MakeRemountDepsOptionsUnion,\n  RouteContextOptions,\n  RouteLike,\n  RouteMask,\n  SearchMiddleware,\n} from './route'\nimport type {\n  FullSearchSchema,\n  RouteById,\n  RoutePaths,\n  RoutesById,\n  RoutesByPath,\n} from './routeInfo'\nimport type {\n  AnyRouteMatch,\n  MakeRouteMatch,\n  MakeRouteMatchUnion,\n  MatchRouteOptions,\n} from './Matches'\nimport type {\n  BuildLocationFn,\n  CommitLocationOptions,\n  NavigateFn,\n} from './RouterProvider'\nimport type { Manifest, RouterManagedTag } from './manifest'\nimport type { AnySchema, AnyValidator } from './validators'\nimport type { NavigateOptions, ResolveRelativePath, ToOptions } from './link'\nimport type { NotFoundError } from './not-found'\nimport type {\n  AnySerializationAdapter,\n  ValidateSerializableInput,\n} from './ssr/serializer/transformer'\nimport type { GetStoreConfig, RouterStores } from './stores'\n\nexport type ControllablePromise<T = any> = Promise<T> & {\n  resolve: (value: T) => void\n  reject: (value?: any) => void\n}\n\nexport type InjectedHtmlEntry = Promise<string>\n\nexport interface Register {\n  // Lots of things on here like...\n  // router\n  // config\n  // ssr\n}\n\nexport type RegisteredSsr<TRegister = Register> = TRegister extends {\n  ssr: infer TSSR\n}\n  ? TSSR\n  : false\n\nexport type RegisteredRouter<TRegister = Register> = TRegister extends {\n  router: infer TRouter\n}\n  ? TRouter\n  : AnyRouter\n\nexport type RegisteredConfigType<TRegister, TKey> = TRegister extends {\n  config: infer TConfig\n}\n  ? TConfig extends {\n      '~types': infer TTypes\n    }\n    ? TKey extends keyof TTypes\n      ? TTypes[TKey]\n      : unknown\n    : unknown\n  : unknown\n\nexport type DefaultRemountDepsFn<TRouteTree extends AnyRoute> = (\n  opts: MakeRemountDepsOptionsUnion<TRouteTree>,\n) => any\n\nexport interface DefaultRouterOptionsExtensions {}\n\nexport interface RouterOptionsExtensions extends DefaultRouterOptionsExtensions {}\n\nexport type SSROption = boolean | 'data-only'\n\nexport interface RouterOptions<\n  TRouteTree extends AnyRoute,\n  TTrailingSlashOption extends TrailingSlashOption,\n  TDefaultStructuralSharingOption extends boolean = false,\n  TRouterHistory extends RouterHistory = RouterHistory,\n  TDehydrated = undefined,\n> extends RouterOptionsExtensions {\n  /**\n   * The history object that will be used to manage the browser history.\n   *\n   * If not provided, a new createBrowserHistory instance will be created and used.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)\n   */\n  history?: TRouterHistory\n  /**\n   * A function that will be used to stringify search params when generating links.\n   *\n   * @default defaultStringifySearch\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#stringifysearch-method)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)\n   */\n  stringifySearch?: SearchSerializer\n  /**\n   * A function that will be used to parse search params when parsing the current location.\n   *\n   * @default defaultParseSearch\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#parsesearch-method)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization)\n   */\n  parseSearch?: SearchParser\n  /**\n   * If `false`, routes will not be preloaded by default in any way.\n   *\n   * If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a `<Link>`.\n   *\n   * If `'viewport'`, routes will be preloaded by default when they are within the viewport.\n   *\n   * @default false\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreload-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n   */\n  defaultPreload?: false | 'intent' | 'viewport' | 'render'\n  /**\n   * The delay in milliseconds that a route must be hovered over or touched before it is preloaded.\n   *\n   * @default 50\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloaddelay-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-delay)\n   */\n  defaultPreloadDelay?: number\n  /**\n   * The default `preloadIntentProximity` a route should use if no preloadIntentProximity is provided.\n   *\n   * @default 0\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadintentproximity-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading#preload-intent-proximity)\n   */\n  defaultPreloadIntentProximity?: number\n  /**\n   * The default `pendingMs` a route should use if no pendingMs is provided.\n   *\n   * @default 1000\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingms-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)\n   */\n  defaultPendingMs?: number\n  /**\n   * The default `pendingMinMs` a route should use if no pendingMinMs is provided.\n   *\n   * @default 500\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingminms-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#avoiding-pending-component-flash)\n   */\n  defaultPendingMinMs?: number\n  /**\n   * The default `staleTime` a route should use if no staleTime is provided. This is the time in milliseconds that a route will be considered fresh.\n   *\n   * @default 0\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstaletime-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)\n   */\n  defaultStaleTime?: number\n  /**\n   * The default stale reload mode a route loader should use if no `loader.staleReloadMode` is provided.\n   *\n   * `'background'` preserves the current stale-while-revalidate behavior.\n   * `'blocking'` waits for stale loader reloads to complete before resolving navigation.\n   *\n   * @default 'background'\n   */\n  defaultStaleReloadMode?: LoaderStaleReloadMode\n  /**\n   * The default `preloadStaleTime` a route should use if no preloadStaleTime is provided.\n   *\n   * @default 30_000 `(30 seconds)`\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadstaletime-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n   */\n  defaultPreloadStaleTime?: number\n  /**\n   * The default `defaultPreloadGcTime` a route should use if no preloadGcTime is provided.\n   *\n   * @default 1_800_000 `(30 minutes)`\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpreloadgctime-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/preloading)\n   */\n  defaultPreloadGcTime?: number\n  /**\n   * If `true`, route navigations will called using `document.startViewTransition()`.\n   *\n   * If the browser does not support this api, this option will be ignored.\n   *\n   * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultviewtransition-property)\n   */\n  defaultViewTransition?: boolean | ViewTransitionOptions\n  /**\n   * The default `hashScrollIntoView` a route should use if no hashScrollIntoView is provided while navigating\n   *\n   * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulthashscrollintoview-property)\n   */\n  defaultHashScrollIntoView?: boolean | ScrollIntoViewOptions\n  /**\n   * @default 'fuzzy'\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundmode-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#the-notfoundmode-option)\n   */\n  notFoundMode?: 'root' | 'fuzzy'\n  /**\n   * The default `gcTime` a route should use if no gcTime is provided.\n   *\n   * @default 1_800_000 `(30 minutes)`\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultgctime-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#key-options)\n   */\n  defaultGcTime?: number\n  /**\n   * If `true`, all routes will be matched as case-sensitive.\n   *\n   * @default false\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#casesensitive-property)\n   */\n  caseSensitive?: boolean\n  /**\n   *\n   * The route tree that will be used to configure the router instance.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routetree-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/routing/route-trees)\n   */\n  routeTree?: TRouteTree\n  /**\n   * The basepath for then entire router. This is useful for mounting a router instance at a subpath.\n   * ```\n   * @default '/'\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#basepath-property)\n   */\n  basepath?: string\n  /**\n   * The root context that will be provided to all routes in the route tree.\n   *\n   * This can be used to provide a context to all routes in the tree without having to provide it to each route individually.\n   *\n   * Optional or required if the root route was created with [`createRootRouteWithContext()`](https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction).\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#context-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/router-context)\n   */\n  context?: InferRouterContext<TRouteTree>\n\n  additionalContext?: any\n\n  /**\n   * A function that will be called when the router is dehydrated.\n   *\n   * The return value of this function will be serialized and stored in the router's dehydrated state.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#dehydrate-method)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)\n   */\n  dehydrate?: () => Constrain<\n    TDehydrated,\n    ValidateSerializableInput<Register, TDehydrated>\n  >\n  /**\n   * A function that will be called when the router is hydrated.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#hydrate-method)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/external-data-loading#critical-dehydrationhydration)\n   */\n  hydrate?: (dehydrated: TDehydrated) => Awaitable<void>\n  /**\n   * An array of route masks that will be used to mask routes in the route tree.\n   *\n   * 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.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#routemasks-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking)\n   */\n  routeMasks?: Array<RouteMask<TRouteTree>>\n  /**\n   * If `true`, route masks will, by default, be removed when the page is reloaded.\n   *\n   * 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.\n   *\n   * @default false\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#unmaskonreload-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/route-masking#unmasking-on-page-reload)\n   */\n  unmaskOnReload?: boolean\n\n  /**\n   * Use `notFoundComponent` instead.\n   *\n   * @deprecated\n   * See https://tanstack.com/router/v1/docs/guide/not-found-errors#migrating-from-notfoundroute for more info.\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#notfoundroute-property)\n   */\n  notFoundRoute?: AnyRoute\n  /**\n   * Configures how trailing slashes are treated.\n   *\n   * - `'always'` will add a trailing slash if not present\n   * - `'never'` will remove the trailing slash if present\n   * - `'preserve'` will not modify the trailing slash.\n   *\n   * @default 'never'\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property)\n   */\n  trailingSlash?: TTrailingSlashOption\n  /**\n   * While usually automatic, sometimes it can be useful to force the router into a server-side state, e.g. when using the router in a non-browser environment that has access to a global.document object.\n   *\n   * @default typeof document !== 'undefined'\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#isserver-property)\n   */\n  isServer?: boolean\n\n  /**\n   * @default false\n   */\n  isShell?: boolean\n\n  /**\n   * @default false\n   */\n  isPrerendering?: boolean\n\n  /**\n   * The default `ssr` a route should use if no `ssr` is provided.\n   *\n   * @default true\n   */\n  defaultSsr?: SSROption\n\n  search?: {\n    /**\n     * Configures how unknown search params (= not returned by any `validateSearch`) are treated.\n     *\n     * @default false\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#search.strict-property)\n     */\n    strict?: boolean\n  }\n\n  /**\n   * Configures whether structural sharing is enabled by default for fine-grained selectors.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultstructuralsharing-property)\n   */\n  defaultStructuralSharing?: TDefaultStructuralSharingOption\n\n  /**\n   * Configures which URI characters are allowed in path params that would ordinarily be escaped by encodeURIComponent.\n   *\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#pathparamsallowedcharacters-property)\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters)\n   */\n  pathParamsAllowedCharacters?: Array<\n    ';' | ':' | '@' | '&' | '=' | '+' | '$' | ','\n  >\n\n  defaultRemountDeps?: DefaultRemountDepsFn<TRouteTree>\n\n  /**\n   * If `true`, scroll restoration will be enabled\n   *\n   * @default false\n   */\n  scrollRestoration?:\n    | boolean\n    | ((opts: { location: ParsedLocation }) => boolean)\n\n  /**\n   * A function that will be called to get the key for the scroll restoration cache.\n   *\n   * @default (location) => location.href\n   */\n  getScrollRestorationKey?: (location: ParsedLocation) => string\n  /**\n   * The default behavior for scroll restoration.\n   *\n   * @default 'auto'\n   */\n  scrollRestorationBehavior?: ScrollBehavior\n  /**\n   * An array of selectors that will be used to scroll to the top of the page in addition to `window`\n   *\n   * @default ['window']\n   */\n  scrollToTopSelectors?: Array<string | (() => Element | null | undefined)>\n\n  /**\n   * When `true`, disables the global catch boundary that normally wraps all route matches.\n   * This allows unhandled errors to bubble up to top-level error handlers in the browser.\n   *\n   * Useful for testing tools (like Storybook Test Runner), error reporting services,\n   * and debugging scenarios where you want errors to reach the browser's global error handlers.\n   *\n   * @default false\n   */\n  disableGlobalCatchBoundary?: boolean\n\n  /**\n   * An array of URL protocols to allow in links, redirects, and navigation.\n   * Absolute URLs with protocols not in this list will be rejected.\n   *\n   * @default DEFAULT_PROTOCOL_ALLOWLIST (http:, https:, mailto:, tel:)\n   * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#protocolallowlist-property)\n   */\n  protocolAllowlist?: Array<string>\n\n  serializationAdapters?: ReadonlyArray<AnySerializationAdapter>\n  /**\n   * Configures how the router will rewrite the location between the actual href and the internal href of the router.\n   *\n   * @default undefined\n   * @description You can provide a custom rewrite pair (in/out).\n   * This is useful for shifting data from the origin to the path (for things like subdomain routing), or other advanced use cases.\n   */\n  rewrite?: LocationRewrite\n  origin?: string\n  ssr?: {\n    nonce?: string\n  }\n}\n\nexport type LocationRewrite = {\n  /**\n   * A function that will be called to rewrite the URL before it is interpreted by the router from the history instance.\n   *\n   * @default undefined\n   */\n  input?: LocationRewriteFunction\n  /**\n   * A function that will be called to rewrite the URL before it is committed to the actual history instance from the router.\n   *\n   * @default undefined\n   */\n  output?: LocationRewriteFunction\n}\n\n/**\n * A function that will be called to rewrite the URL.\n *\n * @param url The URL to rewrite.\n * @returns The rewritten URL (as a URL instance or full href string) or undefined if no rewrite is needed.\n */\nexport type LocationRewriteFunction = ({\n  url,\n}: {\n  url: URL\n}) => undefined | string | URL\n\nexport interface RouterState<\n  in out TRouteTree extends AnyRoute = AnyRoute,\n  in out TRouteMatch = MakeRouteMatchUnion,\n> {\n  status: 'pending' | 'idle'\n  loadedAt: number\n  isLoading: boolean\n  isTransitioning: boolean\n  matches: Array<TRouteMatch>\n  location: ParsedLocation<FullSearchSchema<TRouteTree>>\n  resolvedLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>\n  statusCode: number\n  redirect?: AnyRedirect\n}\n\nexport interface BuildNextOptions {\n  to?: string | number | null\n  params?: true | Updater<unknown>\n  search?: true | Updater<unknown>\n  hash?: true | Updater<string>\n  state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>\n  mask?: {\n    to?: string | number | null\n    params?: true | Updater<unknown>\n    search?: true | Updater<unknown>\n    hash?: true | Updater<string>\n    state?: true | NonNullableUpdater<ParsedHistoryState, HistoryState>\n    unmaskOnReload?: boolean\n  }\n  from?: string\n  href?: string\n  _fromLocation?: ParsedLocation\n  unsafeRelative?: 'path'\n  _isNavigate?: boolean\n}\n\ntype NavigationEventInfo = {\n  fromLocation?: ParsedLocation\n  toLocation: ParsedLocation\n  pathChanged: boolean\n  hrefChanged: boolean\n  hashChanged: boolean\n}\n\nexport interface RouterEvents {\n  onBeforeNavigate: {\n    type: 'onBeforeNavigate'\n  } & NavigationEventInfo\n  onBeforeLoad: {\n    type: 'onBeforeLoad'\n  } & NavigationEventInfo\n  onLoad: {\n    type: 'onLoad'\n  } & NavigationEventInfo\n  onResolved: {\n    type: 'onResolved'\n  } & NavigationEventInfo\n  onBeforeRouteMount: {\n    type: 'onBeforeRouteMount'\n  } & NavigationEventInfo\n  onRendered: {\n    type: 'onRendered'\n  } & NavigationEventInfo\n}\n\nexport type RouterEvent = RouterEvents[keyof RouterEvents]\n\nexport type ListenerFn<TEvent extends RouterEvent> = (event: TEvent) => void\n\nexport type RouterListener<TRouterEvent extends RouterEvent> = {\n  eventType: TRouterEvent['type']\n  fn: ListenerFn<TRouterEvent>\n}\n\nexport type SubscribeFn = <TType extends keyof RouterEvents>(\n  eventType: TType,\n  fn: ListenerFn<RouterEvents[TType]>,\n) => () => void\n\nexport interface MatchRoutesOpts {\n  preload?: boolean\n  throwOnError?: boolean\n  dest?: BuildNextOptions\n}\n\nexport type InferRouterContext<TRouteTree extends AnyRoute> =\n  TRouteTree['types']['routerContext']\n\nexport type RouterContextOptions<TRouteTree extends AnyRoute> =\n  AnyContext extends InferRouterContext<TRouteTree>\n    ? {\n        context?: InferRouterContext<TRouteTree>\n      }\n    : {\n        context: InferRouterContext<TRouteTree>\n      }\n\nexport type RouterConstructorOptions<\n  TRouteTree extends AnyRoute,\n  TTrailingSlashOption extends TrailingSlashOption,\n  TDefaultStructuralSharingOption extends boolean,\n  TRouterHistory extends RouterHistory,\n  TDehydrated extends Record<string, any>,\n> = Omit<\n  RouterOptions<\n    TRouteTree,\n    TTrailingSlashOption,\n    TDefaultStructuralSharingOption,\n    TRouterHistory,\n    TDehydrated\n  >,\n  'context' | 'serializationAdapters' | 'defaultSsr'\n> &\n  RouterContextOptions<TRouteTree>\n\nexport type PreloadRouteFn<\n  TRouteTree extends AnyRoute,\n  TTrailingSlashOption extends TrailingSlashOption,\n  TDefaultStructuralSharingOption extends boolean,\n  TRouterHistory extends RouterHistory,\n> = <\n  TFrom extends RoutePaths<TRouteTree> | string = string,\n  TTo extends string | undefined = undefined,\n  TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,\n  TMaskTo extends string = '',\n>(\n  opts: NavigateOptions<\n    RouterCore<\n      TRouteTree,\n      TTrailingSlashOption,\n      TDefaultStructuralSharingOption,\n      TRouterHistory\n    >,\n    TFrom,\n    TTo,\n    TMaskFrom,\n    TMaskTo\n  > & {\n    /**\n     * @internal\n     * A **trusted** built location that can be used to redirect to.\n     */\n    _builtLocation?: ParsedLocation\n  },\n) => Promise<Array<AnyRouteMatch> | undefined>\n\nexport type MatchRouteFn<\n  TRouteTree extends AnyRoute,\n  TTrailingSlashOption extends TrailingSlashOption,\n  TDefaultStructuralSharingOption extends boolean,\n  TRouterHistory extends RouterHistory,\n> = <\n  TFrom extends RoutePaths<TRouteTree> = '/',\n  TTo extends string | undefined = undefined,\n  TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>,\n>(\n  location: ToOptions<\n    RouterCore<\n      TRouteTree,\n      TTrailingSlashOption,\n      TDefaultStructuralSharingOption,\n      TRouterHistory\n    >,\n    TFrom,\n    TTo\n  >,\n  opts?: MatchRouteOptions,\n) => false | RouteById<TRouteTree, TResolved>['types']['allParams']\n\nexport type UpdateFn<\n  TRouteTree extends AnyRoute,\n  TTrailingSlashOption extends TrailingSlashOption,\n  TDefaultStructuralSharingOption extends boolean,\n  TRouterHistory extends RouterHistory,\n  TDehydrated extends Record<string, any>,\n> = (\n  newOptions: RouterConstructorOptions<\n    TRouteTree,\n    TTrailingSlashOption,\n    TDefaultStructuralSharingOption,\n    TRouterHistory,\n    TDehydrated\n  >,\n) => void\n\nexport type InvalidateFn<TRouter extends AnyRouter> = (opts?: {\n  filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean\n  sync?: boolean\n  forcePending?: boolean\n}) => Promise<void>\n\nexport type ParseLocationFn<TRouteTree extends AnyRoute> = (\n  locationToParse: HistoryLocation,\n  previousLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>,\n) => ParsedLocation<FullSearchSchema<TRouteTree>>\n\nexport type GetMatchRoutesFn = (pathname: string) => {\n  matchedRoutes: ReadonlyArray<AnyRoute>\n  /** exhaustive params, still in their string form */\n  routeParams: Record<string, string>\n  /** partial params, parsed from routeParams during matching */\n  parsedParams: Record<string, unknown> | undefined\n  foundRoute: AnyRoute | undefined\n  parseError?: unknown\n}\n\nexport type EmitFn = (routerEvent: RouterEvent) => void\n\nexport type LoadFn = (opts?: { sync?: boolean }) => Promise<void>\n\nexport type CommitLocationFn = ({\n  viewTransition,\n  ignoreBlocker,\n  ...next\n}: ParsedLocation & CommitLocationOptions) => Promise<void>\n\nexport type StartTransitionFn = (fn: () => void) => void\n\nexport interface MatchRoutesFn {\n  (\n    pathname: string,\n    locationSearch?: AnySchema,\n    opts?: MatchRoutesOpts,\n  ): Array<MakeRouteMatchUnion>\n  /**\n   * @deprecated use the following signature instead\n   */\n  (next: ParsedLocation, opts?: MatchRoutesOpts): Array<AnyRouteMatch>\n  (\n    pathnameOrNext: string | ParsedLocation,\n    locationSearchOrOpts?: AnySchema | MatchRoutesOpts,\n    opts?: MatchRoutesOpts,\n  ): Array<AnyRouteMatch>\n}\n\nexport type GetMatchFn = (matchId: string) => AnyRouteMatch | undefined\n\nexport type UpdateMatchFn = (\n  id: string,\n  updater: (match: AnyRouteMatch) => AnyRouteMatch,\n) => void\n\nexport type LoadRouteChunkFn = (route: AnyRoute) => Promise<Array<void>>\n\nexport type ResolveRedirect = (err: AnyRedirect) => ResolvedRedirect\n\nexport type ClearCacheFn<TRouter extends AnyRouter> = (opts?: {\n  filter?: (d: MakeRouteMatchUnion<TRouter>) => boolean\n}) => void\n\nexport interface ServerSsr {\n  /**\n   * Injects HTML synchronously into the stream.\n   * Emits an onInjectedHtml event that listeners can handle.\n   * If no subscriber is listening, the HTML is buffered and can be retrieved via takeBufferedHtml().\n   */\n  injectHtml: (html: string) => void\n  /**\n   * Injects a script tag synchronously into the stream.\n   */\n  injectScript: (script: string) => void\n  isDehydrated: () => boolean\n  isSerializationFinished: () => boolean\n  onRenderFinished: (listener: () => void) => void\n  setRenderFinished: () => void\n  cleanup: () => void\n  onSerializationFinished: (listener: () => void) => void\n  dehydrate: () => Promise<void>\n  takeBufferedScripts: () => RouterManagedTag | undefined\n  /**\n   * Takes any buffered HTML that was injected.\n   * Returns the buffered HTML string (which may include multiple script tags) or undefined if empty.\n   */\n  takeBufferedHtml: () => string | undefined\n  liftScriptBarrier: () => void\n}\n\nexport type AnyRouterWithContext<TContext> = RouterCore<\n  AnyRouteWithContext<TContext>,\n  any,\n  any,\n  any,\n  any\n>\n\nexport type AnyRouter = RouterCore<any, any, any, any, any>\n\nexport interface ViewTransitionOptions {\n  types:\n    | Array<string>\n    | ((locationChangeInfo: {\n        fromLocation?: ParsedLocation\n        toLocation: ParsedLocation\n        pathChanged: boolean\n        hrefChanged: boolean\n        hashChanged: boolean\n      }) => Array<string> | false)\n}\n\n// TODO where is this used? can we remove this?\n/**\n * Convert an unknown error into a minimal, serializable object.\n * Includes name and message (and stack in development).\n */\nexport function defaultSerializeError(err: unknown) {\n  if (err instanceof Error) {\n    const obj = {\n      name: err.name,\n      message: err.message,\n    }\n\n    if (process.env.NODE_ENV === 'development') {\n      ;(obj as any).stack = err.stack\n    }\n\n    return obj\n  }\n\n  return {\n    data: err,\n  }\n}\n\n/** Options for configuring trailing-slash behavior. */\nexport const trailingSlashOptions = {\n  always: 'always',\n  never: 'never',\n  preserve: 'preserve',\n} as const\n\nexport type TrailingSlashOption =\n  (typeof trailingSlashOptions)[keyof typeof trailingSlashOptions]\n\n/**\n * Compute whether path, href or hash changed between previous and current\n * resolved locations.\n */\nexport function getLocationChangeInfo(\n  location: ParsedLocation,\n  resolvedLocation?: ParsedLocation,\n) {\n  const fromLocation = resolvedLocation\n  const toLocation = location\n  const pathChanged = fromLocation?.pathname !== toLocation.pathname\n  const hrefChanged = fromLocation?.href !== toLocation.href\n  const hashChanged = fromLocation?.hash !== toLocation.hash\n  return { fromLocation, toLocation, pathChanged, hrefChanged, hashChanged }\n}\n\nexport type CreateRouterFn = <\n  TRouteTree extends AnyRoute,\n  TTrailingSlashOption extends TrailingSlashOption = 'never',\n  TDefaultStructuralSharingOption extends boolean = false,\n  TRouterHistory extends RouterHistory = RouterHistory,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n>(\n  options: undefined extends number\n    ? 'strictNullChecks must be enabled in tsconfig.json'\n    : RouterConstructorOptions<\n        TRouteTree,\n        TTrailingSlashOption,\n        TDefaultStructuralSharingOption,\n        TRouterHistory,\n        TDehydrated\n      >,\n) => RouterCore<\n  TRouteTree,\n  TTrailingSlashOption,\n  TDefaultStructuralSharingOption,\n  TRouterHistory,\n  TDehydrated\n>\n\ndeclare global {\n  // eslint-disable-next-line no-var\n  var __TSR_CACHE__:\n    | {\n        routeTree: AnyRoute\n        processRouteTreeResult: ProcessRouteTreeResult<AnyRoute>\n        resolvePathCache: LRUCache<string, string>\n      }\n    | undefined\n}\n\n/**\n * Core, framework-agnostic router engine that powers TanStack Router.\n *\n * Provides navigation, matching, loading, preloading, caching and event APIs\n * used by framework adapters (React/Solid). Prefer framework helpers like\n * `createRouter` in app code.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType\n */\nexport class RouterCore<\n  in out TRouteTree extends AnyRoute,\n  in out TTrailingSlashOption extends TrailingSlashOption,\n  in out TDefaultStructuralSharingOption extends boolean,\n  in out TRouterHistory extends RouterHistory = RouterHistory,\n  in out TDehydrated extends Record<string, any> = Record<string, any>,\n> {\n  // Option-independent properties\n  tempLocationKey: string | undefined = `${Math.round(\n    Math.random() * 10000000,\n  )}`\n  resetNextScroll = true\n  shouldViewTransition?: boolean | ViewTransitionOptions = undefined\n  isViewTransitionTypesSupported?: boolean = undefined\n  subscribers = new Set<RouterListener<RouterEvent>>()\n  viewTransitionPromise?: ControlledPromise<true>\n  isScrollRestoring = false\n  isScrollRestorationSetup = false\n\n  // Must build in constructor\n  stores!: RouterStores<TRouteTree>\n  private getStoreConfig!: GetStoreConfig\n  batch!: (fn: () => void) => void\n\n  options!: PickAsRequired<\n    RouterOptions<\n      TRouteTree,\n      TTrailingSlashOption,\n      TDefaultStructuralSharingOption,\n      TRouterHistory,\n      TDehydrated\n    >,\n    'stringifySearch' | 'parseSearch' | 'context'\n  >\n  history!: TRouterHistory\n  rewrite?: LocationRewrite\n  origin?: string\n  latestLocation!: ParsedLocation<FullSearchSchema<TRouteTree>>\n  pendingBuiltLocation?: ParsedLocation<FullSearchSchema<TRouteTree>>\n  basepath!: string\n  routeTree!: TRouteTree\n  routesById!: RoutesById<TRouteTree>\n  routesByPath!: RoutesByPath<TRouteTree>\n  processedTree!: ProcessedTree<TRouteTree, any, any>\n  resolvePathCache!: LRUCache<string, string>\n  isServer!: boolean\n  pathParamsDecoder?: (encoded: string) => string\n  protocolAllowlist!: Set<string>\n\n  /**\n   * @deprecated Use the `createRouter` function instead\n   */\n  constructor(\n    options: RouterConstructorOptions<\n      TRouteTree,\n      TTrailingSlashOption,\n      TDefaultStructuralSharingOption,\n      TRouterHistory,\n      TDehydrated\n    >,\n    getStoreConfig: GetStoreConfig,\n  ) {\n    this.getStoreConfig = getStoreConfig\n\n    this.update({\n      defaultPreloadDelay: 50,\n      defaultPendingMs: 1000,\n      defaultPendingMinMs: 500,\n      context: undefined!,\n      ...options,\n      caseSensitive: options.caseSensitive ?? false,\n      notFoundMode: options.notFoundMode ?? 'fuzzy',\n      stringifySearch: options.stringifySearch ?? defaultStringifySearch,\n      parseSearch: options.parseSearch ?? defaultParseSearch,\n      protocolAllowlist:\n        options.protocolAllowlist ?? DEFAULT_PROTOCOL_ALLOWLIST,\n    })\n\n    if (typeof document !== 'undefined') {\n      self.__TSR_ROUTER__ = this\n    }\n  }\n\n  // This is a default implementation that can optionally be overridden\n  // by the router provider once rendered. We provide this so that the\n  // router can be used in a non-react environment if necessary\n  startTransition: StartTransitionFn = (fn) => fn()\n\n  isShell() {\n    return !!this.options.isShell\n  }\n\n  isPrerendering() {\n    return !!this.options.isPrerendering\n  }\n\n  update: UpdateFn<\n    TRouteTree,\n    TTrailingSlashOption,\n    TDefaultStructuralSharingOption,\n    TRouterHistory,\n    TDehydrated\n  > = (newOptions) => {\n    if (process.env.NODE_ENV !== 'production') {\n      if (newOptions.notFoundRoute) {\n        console.warn(\n          'The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.',\n        )\n      }\n    }\n\n    const prevOptions = this.options\n    const prevBasepath = this.basepath ?? prevOptions?.basepath ?? '/'\n    const basepathWasUnset = this.basepath === undefined\n    const prevRewriteOption = prevOptions?.rewrite\n\n    this.options = {\n      ...prevOptions,\n      ...newOptions,\n    }\n\n    this.isServer = this.options.isServer ?? typeof document === 'undefined'\n\n    this.protocolAllowlist = new Set(this.options.protocolAllowlist)\n\n    if (this.options.pathParamsAllowedCharacters)\n      this.pathParamsDecoder = compileDecodeCharMap(\n        this.options.pathParamsAllowedCharacters,\n      )\n\n    if (\n      !this.history ||\n      (this.options.history && this.options.history !== this.history)\n    ) {\n      if (!this.options.history) {\n        if (!(isServer ?? this.isServer)) {\n          this.history = createBrowserHistory() as TRouterHistory\n        }\n      } else {\n        this.history = this.options.history\n      }\n    }\n\n    this.origin = this.options.origin\n    if (!this.origin) {\n      if (\n        !(isServer ?? this.isServer) &&\n        window?.origin &&\n        window.origin !== 'null'\n      ) {\n        this.origin = window.origin\n      } else {\n        // fallback for the server, can be overridden by calling router.update({origin}) on the server\n        this.origin = 'http://localhost'\n      }\n    }\n\n    if (this.history) {\n      this.updateLatestLocation()\n    }\n\n    if (this.options.routeTree !== this.routeTree) {\n      this.routeTree = this.options.routeTree as TRouteTree\n      let processRouteTreeResult: ProcessRouteTreeResult<TRouteTree>\n      if (\n        (isServer ?? this.isServer) &&\n        process.env.NODE_ENV !== 'development' &&\n        globalThis.__TSR_CACHE__ &&\n        globalThis.__TSR_CACHE__.routeTree === this.routeTree\n      ) {\n        const cached = globalThis.__TSR_CACHE__\n        this.resolvePathCache = cached.resolvePathCache\n        processRouteTreeResult = cached.processRouteTreeResult as any\n      } else {\n        this.resolvePathCache = createLRUCache(1000)\n        processRouteTreeResult = this.buildRouteTree()\n        // only cache if nothing else is cached yet\n        if (\n          (isServer ?? this.isServer) &&\n          process.env.NODE_ENV !== 'development' &&\n          globalThis.__TSR_CACHE__ === undefined\n        ) {\n          globalThis.__TSR_CACHE__ = {\n            routeTree: this.routeTree,\n            processRouteTreeResult: processRouteTreeResult as any,\n            resolvePathCache: this.resolvePathCache,\n          }\n        }\n      }\n      this.setRoutes(processRouteTreeResult)\n    }\n\n    if (!this.stores && this.latestLocation) {\n      const config = this.getStoreConfig(this)\n      this.batch = config.batch\n      this.stores = createRouterStores(\n        getInitialRouterState(this.latestLocation),\n        config,\n      )\n\n      if (!(isServer ?? this.isServer)) {\n        setupScrollRestoration(this)\n      }\n    }\n\n    let needsLocationUpdate = false\n    const nextBasepath = this.options.basepath ?? '/'\n    const nextRewriteOption = this.options.rewrite\n    const basepathChanged = basepathWasUnset || prevBasepath !== nextBasepath\n    const rewriteChanged = prevRewriteOption !== nextRewriteOption\n\n    if (basepathChanged || rewriteChanged) {\n      this.basepath = nextBasepath\n\n      const rewrites: Array<LocationRewrite> = []\n      const trimmed = trimPath(nextBasepath)\n      if (trimmed && trimmed !== '/') {\n        rewrites.push(\n          rewriteBasepath({\n            basepath: nextBasepath,\n          }),\n        )\n      }\n      if (nextRewriteOption) {\n        rewrites.push(nextRewriteOption)\n      }\n\n      this.rewrite =\n        rewrites.length === 0\n          ? undefined\n          : rewrites.length === 1\n            ? rewrites[0]\n            : composeRewrites(rewrites)\n\n      if (this.history) {\n        this.updateLatestLocation()\n      }\n\n      needsLocationUpdate = true\n    }\n\n    if (needsLocationUpdate && this.stores) {\n      this.stores.location.setState(() => this.latestLocation)\n    }\n\n    if (\n      typeof window !== 'undefined' &&\n      'CSS' in window &&\n      typeof window.CSS?.supports === 'function'\n    ) {\n      this.isViewTransitionTypesSupported = window.CSS.supports(\n        'selector(:active-view-transition-type(a)',\n      )\n    }\n  }\n\n  get state(): RouterState<TRouteTree> {\n    return this.stores.__store.state\n  }\n\n  updateLatestLocation = () => {\n    this.latestLocation = this.parseLocation(\n      this.history.location,\n      this.latestLocation,\n    )\n  }\n\n  buildRouteTree = () => {\n    const result = processRouteTree(\n      this.routeTree,\n      this.options.caseSensitive,\n      (route, i) => {\n        route.init({\n          originalIndex: i,\n        })\n      },\n    )\n    if (this.options.routeMasks) {\n      processRouteMasks(this.options.routeMasks, result.processedTree)\n    }\n\n    return result\n  }\n\n  setRoutes({\n    routesById,\n    routesByPath,\n    processedTree,\n  }: ProcessRouteTreeResult<TRouteTree>) {\n    this.routesById = routesById as RoutesById<TRouteTree>\n    this.routesByPath = routesByPath as RoutesByPath<TRouteTree>\n    this.processedTree = processedTree\n\n    const notFoundRoute = this.options.notFoundRoute\n\n    if (notFoundRoute) {\n      notFoundRoute.init({\n        originalIndex: 99999999999,\n      })\n      this.routesById[notFoundRoute.id] = notFoundRoute\n    }\n  }\n\n  /**\n   * Subscribe to router lifecycle events like `onBeforeNavigate`, `onLoad`,\n   * `onResolved`, etc. Returns an unsubscribe function.\n   *\n   * @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterEventsType\n   */\n  subscribe: SubscribeFn = (eventType, fn) => {\n    const listener: RouterListener<any> = {\n      eventType,\n      fn,\n    }\n\n    this.subscribers.add(listener)\n\n    return () => {\n      this.subscribers.delete(listener)\n    }\n  }\n\n  emit: EmitFn = (routerEvent) => {\n    this.subscribers.forEach((listener) => {\n      if (listener.eventType === routerEvent.type) {\n        listener.fn(routerEvent)\n      }\n    })\n  }\n\n  /**\n   * Parse a HistoryLocation into a strongly-typed ParsedLocation using the\n   * current router options, rewrite rules and search parser/stringifier.\n   */\n  parseLocation: ParseLocationFn<TRouteTree> = (\n    locationToParse,\n    previousLocation,\n  ) => {\n    const parse = ({\n      pathname,\n      search,\n      hash,\n      href,\n      state,\n    }: HistoryLocation): ParsedLocation<FullSearchSchema<TRouteTree>> => {\n      // Fast path: no rewrite configured and pathname doesn't need encoding\n      // Characters that need encoding: space, high unicode, control chars\n      // eslint-disable-next-line no-control-regex\n      if (!this.rewrite && !/[ \\x00-\\x1f\\x7f\\u0080-\\uffff]/.test(pathname)) {\n        const parsedSearch = this.options.parseSearch(search)\n        const searchStr = this.options.stringifySearch(parsedSearch)\n\n        return {\n          href: pathname + searchStr + hash,\n          publicHref: href,\n          pathname: decodePath(pathname).path,\n          external: false,\n          searchStr,\n          search: nullReplaceEqualDeep(\n            previousLocation?.search,\n            parsedSearch,\n          ) as any,\n          hash: decodePath(hash.slice(1)).path,\n          state: replaceEqualDeep(previousLocation?.state, state),\n        }\n      }\n\n      // Before we do any processing, we need to allow rewrites to modify the URL\n      // build up the full URL by combining the href from history with the router's origin\n      const fullUrl = new URL(href, this.origin)\n\n      const url = executeRewriteInput(this.rewrite, fullUrl)\n\n      const parsedSearch = this.options.parseSearch(url.search)\n      const searchStr = this.options.stringifySearch(parsedSearch)\n      // Make sure our final url uses the re-stringified pathname, search, and has for consistency\n      // (We were already doing this, so just keeping it for now)\n      url.search = searchStr\n\n      const fullPath = url.href.replace(url.origin, '')\n\n      return {\n        href: fullPath,\n        publicHref: href,\n        pathname: decodePath(url.pathname).path,\n        external: !!this.rewrite && url.origin !== this.origin,\n        searchStr,\n        search: nullReplaceEqualDeep(\n          previousLocation?.search,\n          parsedSearch,\n        ) as any,\n        hash: decodePath(url.hash.slice(1)).path,\n        state: replaceEqualDeep(previousLocation?.state, state),\n      }\n    }\n\n    const location = parse(locationToParse)\n\n    const { __tempLocation, __tempKey } = location.state\n\n    if (__tempLocation && (!__tempKey || __tempKey === this.tempLocationKey)) {\n      // Sync up the location keys\n      const parsedTempLocation = parse(__tempLocation) as any\n      parsedTempLocation.state.key = location.state.key // TODO: Remove in v2 - use __TSR_key instead\n      parsedTempLocation.state.__TSR_key = location.state.__TSR_key\n\n      delete parsedTempLocation.state.__tempLocation\n\n      return {\n        ...parsedTempLocation,\n        maskedLocation: location,\n      }\n    }\n    return location\n  }\n\n  /** Resolve a path against the router basepath and trailing-slash policy. */\n  resolvePathWithBase = (from: string, path: string) => {\n    const resolvedPath = resolvePath({\n      base: from,\n      to: cleanPath(path),\n      trailingSlash: this.options.trailingSlash,\n      cache: this.resolvePathCache,\n    })\n    return resolvedPath\n  }\n\n  get looseRoutesById() {\n    return this.routesById as Record<string, AnyRoute>\n  }\n\n  matchRoutes: MatchRoutesFn = (\n    pathnameOrNext: string | ParsedLocation,\n    locationSearchOrOpts?: AnySchema | MatchRoutesOpts,\n    opts?: MatchRoutesOpts,\n  ) => {\n    if (typeof pathnameOrNext === 'string') {\n      return this.matchRoutesInternal(\n        {\n          pathname: pathnameOrNext,\n          search: locationSearchOrOpts,\n        } as ParsedLocation,\n        opts,\n      )\n    }\n\n    return this.matchRoutesInternal(pathnameOrNext, locationSearchOrOpts)\n  }\n\n  private getParentContext(parentMatch?: AnyRouteMatch) {\n    const parentMatchId = parentMatch?.id\n\n    const parentContext = !parentMatchId\n      ? ((this.options.context as any) ?? undefined)\n      : (parentMatch.context ?? this.options.context ?? undefined)\n\n    return parentContext\n  }\n\n  private matchRoutesInternal(\n    next: ParsedLocation,\n    opts?: MatchRoutesOpts,\n  ): Array<AnyRouteMatch> {\n    const matchedRoutesResult = this.getMatchedRoutes(next.pathname)\n    const { foundRoute, routeParams, parsedParams } = matchedRoutesResult\n    let { matchedRoutes } = matchedRoutesResult\n    let isGlobalNotFound = false\n\n    // Check to see if the route needs a 404 entry\n    if (\n      // If we found a route, and it's not an index route and we have left over path\n      foundRoute\n        ? foundRoute.path !== '/' && routeParams['**']\n        : // Or if we didn't find a route and we have left over path\n          trimPathRight(next.pathname)\n    ) {\n      // If the user has defined an (old) 404 route, use it\n      if (this.options.notFoundRoute) {\n        matchedRoutes = [...matchedRoutes, this.options.notFoundRoute]\n      } else {\n        // If there is no routes found during path matching\n        isGlobalNotFound = true\n      }\n    }\n\n    const globalNotFoundRouteId = isGlobalNotFound\n      ? findGlobalNotFoundRouteId(this.options.notFoundMode, matchedRoutes)\n      : undefined\n\n    const matches = new Array<AnyRouteMatch>(matchedRoutes.length)\n    // Snapshot of active match state keyed by routeId, used to stabilise\n    // params/search across navigations.\n    const previousActiveMatchesByRouteId = new Map<string, AnyRouteMatch>()\n    for (const store of this.stores.activeMatchStoresById.values()) {\n      if (store.routeId) {\n        previousActiveMatchesByRouteId.set(store.routeId, store.state)\n      }\n    }\n\n    for (let index = 0; index < matchedRoutes.length; index++) {\n      const route = matchedRoutes[index]!\n      // Take each matched route and resolve + validate its search params\n      // This has to happen serially because each route's search params\n      // can depend on the parent route's search params\n      // It must also happen before we create the match so that we can\n      // pass the search params to the route's potential key function\n      // which is used to uniquely identify the route match in state\n\n      const parentMatch = matches[index - 1]\n\n      let preMatchSearch: Record<string, any>\n      let strictMatchSearch: Record<string, any>\n      let searchError: any\n      {\n        // Validate the search params and stabilize them\n        const parentSearch = parentMatch?.search ?? next.search\n        const parentStrictSearch = parentMatch?._strictSearch ?? undefined\n\n        try {\n          const strictSearch =\n            validateSearch(route.options.validateSearch, { ...parentSearch }) ??\n            undefined\n\n          preMatchSearch = {\n            ...parentSearch,\n            ...strictSearch,\n          }\n          strictMatchSearch = { ...parentStrictSearch, ...strictSearch }\n          searchError = undefined\n        } catch (err: any) {\n          let searchParamError = err\n          if (!(err instanceof SearchParamError)) {\n            searchParamError = new SearchParamError(err.message, {\n              cause: err,\n            })\n          }\n\n          if (opts?.throwOnError) {\n            throw searchParamError\n          }\n\n          preMatchSearch = parentSearch\n          strictMatchSearch = {}\n          searchError = searchParamError\n        }\n      }\n\n      // This is where we need to call route.options.loaderDeps() to get any additional\n      // deps that the route's loader function might need to run. We need to do this\n      // before we create the match so that we can pass the deps to the route's\n      // potential key function which is used to uniquely identify the route match in state\n\n      const loaderDeps =\n        route.options.loaderDeps?.({\n          search: preMatchSearch,\n        }) ?? ''\n\n      const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : ''\n\n      const { interpolatedPath, usedParams } = interpolatePath({\n        path: route.fullPath,\n        params: routeParams,\n        decoder: this.pathParamsDecoder,\n        server: this.isServer,\n      })\n\n      // Waste not, want not. If we already have a match for this route,\n      // reuse it. This is important for layout routes, which might stick\n      // around between navigation actions that only change leaf routes.\n\n      // Existing matches are matches that are already loaded along with\n      // pending matches that are still loading\n      const matchId =\n        // route.id for disambiguation\n        route.id +\n        // interpolatedPath for param changes\n        interpolatedPath +\n        // explicit deps\n        loaderDepsHash\n\n      const existingMatch = this.getMatch(matchId)\n\n      const previousMatch = previousActiveMatchesByRouteId.get(route.id)\n\n      const strictParams = existingMatch?._strictParams ?? usedParams\n\n      let paramsError: unknown = undefined\n\n      if (!existingMatch) {\n        try {\n          extractStrictParams(route, usedParams, parsedParams!, strictParams)\n        } catch (err: any) {\n          if (isNotFound(err) || isRedirect(err)) {\n            paramsError = err\n          } else {\n            paramsError = new PathParamError(err.message, {\n              cause: err,\n            })\n          }\n\n          if (opts?.throwOnError) {\n            throw paramsError\n          }\n        }\n      }\n\n      Object.assign(routeParams, strictParams)\n\n      const cause = previousMatch ? 'stay' : 'enter'\n\n      let match: AnyRouteMatch\n\n      if (existingMatch) {\n        match = {\n          ...existingMatch,\n          cause,\n          params: previousMatch?.params ?? routeParams,\n          _strictParams: strictParams,\n          search: previousMatch\n            ? nullReplaceEqualDeep(previousMatch.search, preMatchSearch)\n            : nullReplaceEqualDeep(existingMatch.search, preMatchSearch),\n          _strictSearch: strictMatchSearch,\n        }\n      } else {\n        const status =\n          route.options.loader ||\n          route.options.beforeLoad ||\n          route.lazyFn ||\n          routeNeedsPreload(route)\n            ? 'pending'\n            : 'success'\n\n        match = {\n          id: matchId,\n          ssr: (isServer ?? this.isServer) ? undefined : route.options.ssr,\n          index,\n          routeId: route.id,\n          params: previousMatch?.params ?? routeParams,\n          _strictParams: strictParams,\n          pathname: interpolatedPath,\n          updatedAt: Date.now(),\n          search: previousMatch\n            ? nullReplaceEqualDeep(previousMatch.search, preMatchSearch)\n            : preMatchSearch,\n          _strictSearch: strictMatchSearch,\n          searchError: undefined,\n          status,\n          isFetching: false,\n          error: undefined,\n          paramsError,\n          __routeContext: undefined,\n          _nonReactive: {\n            loadPromise: createControlledPromise(),\n          },\n          __beforeLoadContext: undefined,\n          context: {},\n          abortController: new AbortController(),\n          fetchCount: 0,\n          cause,\n          loaderDeps: previousMatch\n            ? replaceEqualDeep(previousMatch.loaderDeps, loaderDeps)\n            : loaderDeps,\n          invalid: false,\n          preload: false,\n          links: undefined,\n          scripts: undefined,\n          headScripts: undefined,\n          meta: undefined,\n          staticData: route.options.staticData || {},\n          fullPath: route.fullPath,\n        }\n      }\n\n      if (!opts?.preload) {\n        // If we have a global not found, mark the right match as global not found\n        match.globalNotFound = globalNotFoundRouteId === route.id\n      }\n\n      // update the searchError if there is one\n      match.searchError = searchError\n\n      const parentContext = this.getParentContext(parentMatch)\n\n      match.context = {\n        ...parentContext,\n        ...match.__routeContext,\n        ...match.__beforeLoadContext,\n      }\n\n      matches[index] = match\n    }\n\n    for (let index = 0; index < matches.length; index++) {\n      const match = matches[index]!\n      const route = this.looseRoutesById[match.routeId]!\n      const existingMatch = this.getMatch(match.id)\n\n      // Update the match's params\n      const previousMatch = previousActiveMatchesByRouteId.get(match.routeId)\n      match.params = previousMatch\n        ? nullReplaceEqualDeep(previousMatch.params, routeParams)\n        : routeParams\n\n      if (!existingMatch) {\n        const parentMatch = matches[index - 1]\n        const parentContext = this.getParentContext(parentMatch)\n\n        // Update the match's context\n\n        if (route.options.context) {\n          const contextFnContext: RouteContextOptions<any, any, any, any, any> =\n            {\n              deps: match.loaderDeps,\n              params: match.params,\n              context: parentContext ?? {},\n              location: next,\n              navigate: (opts: any) =>\n                this.navigate({ ...opts, _fromLocation: next }),\n              buildLocation: this.buildLocation,\n              cause: match.cause,\n              abortController: match.abortController,\n              preload: !!match.preload,\n              matches,\n              routeId: route.id,\n            }\n          // Get the route context\n          match.__routeContext =\n            route.options.context(contextFnContext) ?? undefined\n        }\n\n        match.context = {\n          ...parentContext,\n          ...match.__routeContext,\n          ...match.__beforeLoadContext,\n        }\n      }\n    }\n\n    return matches\n  }\n\n  getMatchedRoutes: GetMatchRoutesFn = (pathname) => {\n    return getMatchedRoutes({\n      pathname,\n      routesById: this.routesById,\n      processedTree: this.processedTree,\n    })\n  }\n\n  /**\n   * Lightweight route matching for buildLocation.\n   * Only computes fullPath, accumulated search, and params - skipping expensive\n   * operations like AbortController, ControlledPromise, loaderDeps, and full match objects.\n   */\n  private matchRoutesLightweight(location: ParsedLocation): {\n    matchedRoutes: ReadonlyArray<AnyRoute>\n    fullPath: string\n    search: Record<string, unknown>\n    params: Record<string, unknown>\n  } {\n    const { matchedRoutes, routeParams, parsedParams } = this.getMatchedRoutes(\n      location.pathname,\n    )\n    const lastRoute = last(matchedRoutes)!\n\n    // I don't know if we should run the full search middleware chain, or just validateSearch\n    // // Accumulate search validation through the route chain\n    // const accumulatedSearch: Record<string, unknown> = applySearchMiddleware({\n    //   search: { ...location.search },\n    //   dest: location,\n    //   destRoutes: matchedRoutes,\n    //   _includeValidateSearch: true,\n    // })\n\n    // Accumulate search validation through route chain\n    const accumulatedSearch = { ...location.search }\n    for (const route of matchedRoutes) {\n      try {\n        Object.assign(\n          accumulatedSearch,\n          validateSearch(route.options.validateSearch, accumulatedSearch),\n        )\n      } catch {\n        // Ignore errors, we're not actually routing\n      }\n    }\n\n    // Determine params: reuse from state if possible, otherwise parse\n    const lastStateMatchId = last(this.stores.matchesId.state)\n    const lastStateMatch =\n      lastStateMatchId &&\n      this.stores.activeMatchStoresById.get(lastStateMatchId)?.state\n    const canReuseParams =\n      lastStateMatch &&\n      lastStateMatch.routeId === lastRoute.id &&\n      lastStateMatch.pathname === location.pathname\n\n    let params: Record<string, unknown>\n    if (canReuseParams) {\n      params = lastStateMatch.params\n    } else {\n      // Parse params through the route chain\n      const strictParams: Record<string, unknown> = Object.assign(\n        Object.create(null),\n        routeParams,\n      )\n      for (const route of matchedRoutes) {\n        try {\n          extractStrictParams(\n            route,\n            routeParams,\n            parsedParams ?? {},\n            strictParams,\n          )\n        } catch {\n          // Ignore errors, we're not actually routing\n        }\n      }\n      params = strictParams\n    }\n\n    return {\n      matchedRoutes,\n      fullPath: lastRoute.fullPath,\n      search: accumulatedSearch,\n      params,\n    }\n  }\n\n  cancelMatch = (id: string) => {\n    const match = this.getMatch(id)\n\n    if (!match) return\n\n    match.abortController.abort()\n    clearTimeout(match._nonReactive.pendingTimeout)\n    match._nonReactive.pendingTimeout = undefined\n  }\n\n  cancelMatches = () => {\n    this.stores.pendingMatchesId.state.forEach((matchId) => {\n      this.cancelMatch(matchId)\n    })\n\n    this.stores.matchesId.state.forEach((matchId) => {\n      if (this.stores.pendingMatchStoresById.has(matchId)) {\n        return\n      }\n\n      const match = this.stores.activeMatchStoresById.get(matchId)?.state\n      if (!match) {\n        return\n      }\n\n      if (match.status === 'pending' || match.isFetching === 'loader') {\n        this.cancelMatch(matchId)\n      }\n    })\n  }\n\n  /**\n   * Build the next ParsedLocation from navigation options without committing.\n   * Resolves `to`/`from`, params/search/hash/state, applies search validation\n   * and middlewares, and returns a stable, stringified location object.\n   *\n   * @link https://tanstack.com/router/latest/docs/framework/react/api/router/RouterType#buildlocation-method\n   */\n  buildLocation: BuildLocationFn = (opts) => {\n    const build = (\n      dest: BuildNextOptions & {\n        unmaskOnReload?: boolean\n      } = {},\n    ): ParsedLocation => {\n      // We allow the caller to override the current location\n      const currentLocation =\n        dest._fromLocation || this.pendingBuiltLocation || this.latestLocation\n\n      // Use lightweight matching - only computes what buildLocation needs\n      // (fullPath, search, params) without creating full match objects\n      const lightweightResult = this.matchRoutesLightweight(currentLocation)\n\n      // check that from path exists in the current route tree\n      // do this check only on navigations during test or development\n      if (\n        dest.from &&\n        process.env.NODE_ENV !== 'production' &&\n        dest._isNavigate\n      ) {\n        const allFromMatches = this.getMatchedRoutes(dest.from).matchedRoutes\n\n        const matchedFrom = findLast(lightweightResult.matchedRoutes, (d) => {\n          return comparePaths(d.fullPath, dest.from!)\n        })\n\n        const matchedCurrent = findLast(allFromMatches, (d) => {\n          return comparePaths(d.fullPath, lightweightResult.fullPath)\n        })\n\n        // for from to be invalid it shouldn't just be unmatched to currentLocation\n        // but the currentLocation should also be unmatched to from\n        if (!matchedFrom && !matchedCurrent) {\n          console.warn(`Could not find match for from: ${dest.from}`)\n        }\n      }\n\n      const defaultedFromPath =\n        dest.unsafeRelative === 'path'\n          ? currentLocation.pathname\n          : (dest.from ?? lightweightResult.fullPath)\n\n      // ensure this includes the basePath if set\n      const fromPath = this.resolvePathWithBase(defaultedFromPath, '.')\n\n      // From search should always use the current location\n      const fromSearch = lightweightResult.search\n      // Same with params. It can't hurt to provide as many as possible\n      const fromParams = Object.assign(\n        Object.create(null),\n        lightweightResult.params,\n      )\n\n      // Resolve the next to\n      // ensure this includes the basePath if set\n      const nextTo = dest.to\n        ? this.resolvePathWithBase(fromPath, `${dest.to}`)\n        : this.resolvePathWithBase(fromPath, '.')\n\n      // Resolve the next params\n      const nextParams =\n        dest.params === false || dest.params === null\n          ? Object.create(null)\n          : (dest.params ?? true) === true\n            ? fromParams\n            : Object.assign(\n                fromParams,\n                functionalUpdate(dest.params as any, fromParams),\n              )\n\n      // Use lightweight getMatchedRoutes instead of matchRoutesInternal\n      // This avoids creating full match objects (AbortController, ControlledPromise, etc.)\n      // which are expensive and not needed for buildLocation\n      const destMatchResult = this.getMatchedRoutes(nextTo)\n      let destRoutes = destMatchResult.matchedRoutes\n\n      // Compute globalNotFoundRouteId using the same logic as matchRoutesInternal\n      const isGlobalNotFound =\n        !destMatchResult.foundRoute ||\n        (destMatchResult.foundRoute.path !== '/' &&\n          destMatchResult.routeParams['**'])\n\n      if (isGlobalNotFound && this.options.notFoundRoute) {\n        destRoutes = [...destRoutes, this.options.notFoundRoute]\n      }\n\n      // If there are any params, we need to stringify them\n      if (Object.keys(nextParams).length > 0) {\n        for (const route of destRoutes) {\n          const fn =\n            route.options.params?.stringify ?? route.options.stringifyParams\n          if (fn) {\n            try {\n              Object.assign(nextParams, fn(nextParams))\n            } catch {\n              // Ignore errors here. When a paired parseParams is defined,\n              // extractStrictParams will re-throw during route matching,\n              // storing the error on the match and allowing the route's\n              // errorComponent to render. If no parseParams is defined,\n              // the stringify error is silently dropped.\n            }\n          }\n        }\n      }\n\n      const nextPathname = opts.leaveParams\n        ? // Use the original template path for interpolation\n          // This preserves the original parameter syntax including optional parameters\n          nextTo\n        : decodePath(\n            interpolatePath({\n              path: nextTo,\n              params: nextParams,\n              decoder: this.pathParamsDecoder,\n              server: this.isServer,\n            }).interpolatedPath,\n          ).path\n\n      // Resolve the next search\n      let nextSearch = fromSearch\n      if (opts._includeValidateSearch && this.options.search?.strict) {\n        const validatedSearch = {}\n        destRoutes.forEach((route) => {\n          if (route.options.validateSearch) {\n            try {\n              Object.assign(\n                validatedSearch,\n                validateSearch(route.options.validateSearch, {\n                  ...validatedSearch,\n                  ...nextSearch,\n                }),\n              )\n            } catch {\n              // ignore errors here because they are already handled in matchRoutes\n            }\n          }\n        })\n        nextSearch = validatedSearch\n      }\n\n      nextSearch = applySearchMiddleware({\n        search: nextSearch,\n        dest,\n        destRoutes,\n        _includeValidateSearch: opts._includeValidateSearch,\n      })\n\n      // Replace the equal deep\n      nextSearch = nullReplaceEqualDeep(fromSearch, nextSearch)\n\n      // Stringify the next search\n      const searchStr = this.options.stringifySearch(nextSearch)\n\n      // Resolve the next hash\n      const hash =\n        dest.hash === true\n          ? currentLocation.hash\n          : dest.hash\n            ? functionalUpdate(dest.hash, currentLocation.hash)\n            : undefined\n\n      // Resolve the next hash string\n      const hashStr = hash ? `#${hash}` : ''\n\n      // Resolve the next state\n      let nextState =\n        dest.state === true\n          ? currentLocation.state\n          : dest.state\n            ? functionalUpdate(dest.state, currentLocation.state)\n            : {}\n\n      // Replace the equal deep\n      nextState = replaceEqualDeep(currentLocation.state, nextState)\n\n      // Create the full path of the location\n      const fullPath = `${nextPathname}${searchStr}${hashStr}`\n\n      // Compute href and publicHref without URL construction when no rewrite\n      let href: string\n      let publicHref: string\n      let external = false\n\n      if (this.rewrite) {\n        // With rewrite, we need to construct URL to apply the rewrite\n        const url = new URL(fullPath, this.origin)\n        const rewrittenUrl = executeRewriteOutput(this.rewrite, url)\n        href = url.href.replace(url.origin, '')\n        // If rewrite changed the origin, publicHref needs full URL\n        // Otherwise just use the path components\n        if (rewrittenUrl.origin !== this.origin) {\n          publicHref = rewrittenUrl.href\n          external = true\n        } else {\n          publicHref =\n            rewrittenUrl.pathname + rewrittenUrl.search + rewrittenUrl.hash\n        }\n      } else {\n        // Fast path: no rewrite, skip URL construction entirely\n        // fullPath is already the correct href (origin-stripped)\n        // We need to encode non-ASCII (unicode) characters for the href\n        // since decodePath decoded them from the interpolated path\n        href = encodePathLikeUrl(fullPath)\n        publicHref = href\n      }\n\n      return {\n        publicHref,\n        href,\n        pathname: nextPathname,\n        search: nextSearch,\n        searchStr,\n        state: nextState as any,\n        hash: hash ?? '',\n        external,\n        unmaskOnReload: dest.unmaskOnReload,\n      }\n    }\n\n    const buildWithMatches = (\n      dest: BuildNextOptions = {},\n      maskedDest?: BuildNextOptions,\n    ) => {\n      const next = build(dest)\n\n      let maskedNext = maskedDest ? build(maskedDest) : undefined\n\n      if (!maskedNext) {\n        const params = Object.create(null)\n\n        if (this.options.routeMasks) {\n          const match = findFlatMatch<RouteMask<TRouteTree>>(\n            next.pathname,\n            this.processedTree,\n          )\n          if (match) {\n            Object.assign(params, match.rawParams) // Copy params, because they're cached\n            const {\n              from: _from,\n              params: maskParams,\n              ...maskProps\n            } = match.route\n\n            // If mask has a params function, call it with the matched params as context\n            // Otherwise, use the matched params or the provided params value\n            const nextParams =\n              maskParams === false || maskParams === null\n                ? Object.create(null)\n                : (maskParams ?? true) === true\n                  ? params\n                  : Object.assign(params, functionalUpdate(maskParams, params))\n\n            maskedDest = {\n              from: opts.from,\n              ...maskProps,\n              params: nextParams,\n            }\n            maskedNext = build(maskedDest)\n          }\n        }\n      }\n\n      if (maskedNext) {\n        next.maskedLocation = maskedNext\n      }\n\n      return next\n    }\n\n    if (opts.mask) {\n      return buildWithMatches(opts, {\n        from: opts.from,\n        ...opts.mask,\n      })\n    }\n\n    return buildWithMatches(opts)\n  }\n\n  commitLocationPromise: undefined | ControlledPromise<void>\n\n  /**\n   * Commit a previously built location to history (push/replace), optionally\n   * using view transitions and scroll restoration options.\n   */\n  commitLocation: CommitLocationFn = async ({\n    viewTransition,\n    ignoreBlocker,\n    ...next\n  }) => {\n    const isSameState = () => {\n      // the following props are ignored but may still be provided when navigating,\n      // temporarily add the previous values to the next state so they don't affect\n      // the comparison\n      const ignoredProps = [\n        'key', // TODO: Remove in v2 - use __TSR_key instead\n        '__TSR_key',\n        '__TSR_index',\n        '__hashScrollIntoViewOptions',\n      ] as const\n      ignoredProps.forEach((prop) => {\n        ;(next.state as any)[prop] = this.latestLocation.state[prop]\n      })\n      const isEqual = deepEqual(next.state, this.latestLocation.state)\n      ignoredProps.forEach((prop) => {\n        delete next.state[prop]\n      })\n      return isEqual\n    }\n\n    const isSameUrl =\n      trimPathRight(this.latestLocation.href) === trimPathRight(next.href)\n\n    let previousCommitPromise = this.commitLocationPromise\n    this.commitLocationPromise = createControlledPromise<void>(() => {\n      previousCommitPromise?.resolve()\n      previousCommitPromise = undefined\n    })\n\n    // Don't commit to history if nothing changed\n    if (isSameUrl && isSameState()) {\n      this.load()\n    } else {\n      let {\n        // eslint-disable-next-line prefer-const\n        maskedLocation,\n        // eslint-disable-next-line prefer-const\n        hashScrollIntoView,\n        ...nextHistory\n      } = next\n\n      if (maskedLocation) {\n        nextHistory = {\n          ...maskedLocation,\n          state: {\n            ...maskedLocation.state,\n            __tempKey: undefined,\n            __tempLocation: {\n              ...nextHistory,\n              search: nextHistory.searchStr,\n              state: {\n                ...nextHistory.state,\n                __tempKey: undefined!,\n                __tempLocation: undefined!,\n                __TSR_key: undefined!,\n                key: undefined!, // TODO: Remove in v2 - use __TSR_key instead\n              },\n            },\n          },\n        }\n\n        if (\n          nextHistory.unmaskOnReload ??\n          this.options.unmaskOnReload ??\n          false\n        ) {\n          nextHistory.state.__tempKey = this.tempLocationKey\n        }\n      }\n\n      nextHistory.state.__hashScrollIntoViewOptions =\n        hashScrollIntoView ?? this.options.defaultHashScrollIntoView ?? true\n\n      this.shouldViewTransition = viewTransition\n\n      this.history[next.replace ? 'replace' : 'push'](\n        nextHistory.publicHref,\n        nextHistory.state,\n        { ignoreBlocker },\n      )\n    }\n\n    this.resetNextScroll = next.resetScroll ?? true\n\n    if (!this.history.subscribers.size) {\n      this.load()\n    }\n\n    return this.commitLocationPromise\n  }\n\n  /** Convenience helper: build a location from options, then commit it. */\n  buildAndCommitLocation = ({\n    replace,\n    resetScroll,\n    hashScrollIntoView,\n    viewTransition,\n    ignoreBlocker,\n    href,\n    ...rest\n  }: BuildNextOptions & CommitLocationOptions = {}) => {\n    if (href) {\n      const currentIndex = this.history.location.state.__TSR_index\n\n      const parsed = parseHref(href, {\n        __TSR_index: replace ? currentIndex : currentIndex + 1,\n      })\n\n      // If the href contains the basepath, we need to strip it before setting `to`\n      // because `buildLocation` will add the basepath back when creating the final URL.\n      // Without this, hrefs like '/app/about' would become '/app/app/about'.\n      const hrefUrl = new URL(parsed.pathname, this.origin)\n      const rewrittenUrl = executeRewriteInput(this.rewrite, hrefUrl)\n\n      rest.to = rewrittenUrl.pathname\n      rest.search = this.options.parseSearch(parsed.search)\n      // remove the leading `#` from the hash\n      rest.hash = parsed.hash.slice(1)\n    }\n\n    const location = this.buildLocation({\n      ...(rest as any),\n      _includeValidateSearch: true,\n    })\n\n    this.pendingBuiltLocation = location as ParsedLocation<\n      FullSearchSchema<TRouteTree>\n    >\n\n    const commitPromise = this.commitLocation({\n      ...location,\n      viewTransition,\n      replace,\n      resetScroll,\n      hashScrollIntoView,\n      ignoreBlocker,\n    })\n\n    // Clear pending location after commit starts\n    // We do this on next microtask to allow synchronous navigate calls to chain\n    Promise.resolve().then(() => {\n      if (this.pendingBuiltLocation === location) {\n        this.pendingBuiltLocation = undefined\n      }\n    })\n\n    return commitPromise\n  }\n\n  /**\n   * Imperatively navigate using standard `NavigateOptions`. When `reloadDocument`\n   * or an absolute `href` is provided, performs a full document navigation.\n   * Otherwise, builds and commits a client-side location.\n   *\n   * @link https://tanstack.com/router/latest/docs/framework/react/api/router/NavigateOptionsType\n   */\n  navigate: NavigateFn = async ({\n    to,\n    reloadDocument,\n    href,\n    publicHref,\n    ...rest\n  }) => {\n    let hrefIsUrl = false\n\n    if (href) {\n      try {\n        new URL(`${href}`)\n        hrefIsUrl = true\n      } catch {}\n    }\n\n    if (hrefIsUrl && !reloadDocument) {\n      reloadDocument = true\n    }\n\n    if (reloadDocument) {\n      // When to is provided, always build a location to get the proper publicHref\n      // (this handles redirects where href might be an internal path from resolveRedirect)\n      // When only href is provided (no to), use it directly as it should already\n      // be a complete path (possibly with basepath)\n      if (to !== undefined || !href) {\n        const location = this.buildLocation({ to, ...rest } as any)\n        // Use publicHref which contains the path (origin-stripped is fine for reload)\n        href = href ?? location.publicHref\n        publicHref = publicHref ?? location.publicHref\n      }\n\n      // Use publicHref when available and href is not a full URL,\n      // otherwise use href directly (which may already include basepath)\n      const reloadHref = !hrefIsUrl && publicHref ? publicHref : href\n\n      // Block dangerous protocols like javascript:, blob:, data:\n      // These could execute arbitrary code if passed to window.location\n      if (isDangerousProtocol(reloadHref, this.protocolAllowlist)) {\n        if (process.env.NODE_ENV !== 'production') {\n          console.warn(\n            `Blocked navigation to dangerous protocol: ${reloadHref}`,\n          )\n        }\n        return Promise.resolve()\n      }\n\n      // Check blockers for external URLs unless ignoreBlocker is true\n      if (!rest.ignoreBlocker) {\n        // Cast to access internal getBlockers method\n        const historyWithBlockers = this.history as any\n        const blockers = historyWithBlockers.getBlockers?.() ?? []\n        for (const blocker of blockers) {\n          if (blocker?.blockerFn) {\n            const shouldBlock = await blocker.blockerFn({\n              currentLocation: this.latestLocation,\n              nextLocation: this.latestLocation, // External URLs don't have a next location in our router\n              action: 'PUSH',\n            })\n            if (shouldBlock) {\n              return Promise.resolve()\n            }\n          }\n        }\n      }\n\n      if (rest.replace) {\n        window.location.replace(reloadHref)\n      } else {\n        window.location.href = reloadHref\n      }\n      return Promise.resolve()\n    }\n\n    return this.buildAndCommitLocation({\n      ...rest,\n      href,\n      to: to as string,\n      _isNavigate: true,\n    })\n  }\n\n  latestLoadPromise: undefined | Promise<void>\n\n  beforeLoad = () => {\n    // Cancel any pending matches\n    this.cancelMatches()\n    this.updateLatestLocation()\n\n    if (isServer ?? this.isServer) {\n      // for SPAs on the initial load, this is handled by the Transitioner\n      const nextLocation = this.buildLocation({\n        to: this.latestLocation.pathname,\n        search: true,\n        params: true,\n        hash: true,\n        state: true,\n        _includeValidateSearch: true,\n      })\n\n      // Check if location changed - origin check is unnecessary since buildLocation\n      // always uses this.origin when constructing URLs\n      if (this.latestLocation.publicHref !== nextLocation.publicHref) {\n        const href = this.getParsedLocationHref(nextLocation)\n        if (nextLocation.external) {\n          throw redirect({ href })\n        } else {\n          throw redirect({ href, _builtLocation: nextLocation })\n        }\n      }\n    }\n\n    // Match the routes\n    const pendingMatches = this.matchRoutes(this.latestLocation)\n\n    const nextCachedMatches = this.stores.cachedMatchesSnapshot.state.filter(\n      (d) => !pendingMatches.some((e) => e.id === d.id),\n    )\n\n    // Ingest the new matches\n    this.batch(() => {\n      this.stores.status.setState(() => 'pending')\n      this.stores.statusCode.setState(() => 200)\n      this.stores.isLoading.setState(() => true)\n      this.stores.location.setState(() => this.latestLocation)\n      this.stores.setPendingMatches(pendingMatches)\n      // If a cached match moved to pending matches, remove it from cached matches\n      this.stores.setCachedMatches(nextCachedMatches)\n    })\n  }\n\n  load: LoadFn = async (opts?: { sync?: boolean }): Promise<void> => {\n    let redirect: AnyRedirect | undefined\n    let notFound: NotFoundError | undefined\n    let loadPromise: Promise<void>\n    const previousLocation =\n      this.stores.resolvedLocation.state ?? this.stores.location.state\n\n    // eslint-disable-next-line prefer-const\n    loadPromise = new Promise<void>((resolve) => {\n      this.startTransition(async () => {\n        try {\n          this.beforeLoad()\n          const next = this.latestLocation\n          const prevLocation = this.stores.resolvedLocation.state\n          const locationChangeInfo = getLocationChangeInfo(next, prevLocation)\n\n          if (!this.stores.redirect.state) {\n            this.emit({\n              type: 'onBeforeNavigate',\n              ...locationChangeInfo,\n            })\n          }\n\n          this.emit({\n            type: 'onBeforeLoad',\n            ...locationChangeInfo,\n          })\n\n          await loadMatches({\n            router: this,\n            sync: opts?.sync,\n            forceStaleReload: previousLocation.href === next.href,\n            matches: this.stores.pendingMatchesSnapshot.state,\n            location: next,\n            updateMatch: this.updateMatch,\n            // eslint-disable-next-line @typescript-eslint/require-await\n            onReady: async () => {\n              // Wrap batch in framework-specific transition wrapper (e.g., Solid's startTransition)\n              this.startTransition(() => {\n                this.startViewTransition(async () => {\n                  // this.viewTransitionPromise = createControlledPromise<true>()\n\n                  // Commit the pending matches. If a previous match was\n                  // removed, place it in the cachedMatches\n                  //\n                  // exitingMatches uses match.id (routeId + params + loaderDeps) so\n                  // navigating /foo?page=1 → /foo?page=2 correctly caches the page=1 entry.\n                  let exitingMatches: Array<AnyRouteMatch> | null = null\n\n                  // Lifecycle-hook identity uses routeId only so that navigating between\n                  // different params/deps of the same route fires onStay (not onLeave+onEnter).\n                  let hookExitingMatches: Array<AnyRouteMatch> | null = null\n                  let hookEnteringMatches: Array<AnyRouteMatch> | null = null\n                  let hookStayingMatches: Array<AnyRouteMatch> | null = null\n\n                  this.batch(() => {\n                    const pendingMatches =\n                      this.stores.pendingMatchesSnapshot.state\n                    const mountPending = pendingMatches.length\n                    const currentMatches =\n                      this.stores.activeMatchesSnapshot.state\n\n                    exitingMatches = mountPending\n                      ? currentMatches.filter(\n                          (match) =>\n                            !this.stores.pendingMatchStoresById.has(match.id),\n                        )\n                      : null\n\n                    // Lifecycle-hook identity: routeId only (route presence in tree)\n                    // Build routeId sets from pools to avoid derived stores.\n                    const pendingRouteIds = new Set<string>()\n                    for (const s of this.stores.pendingMatchStoresById.values()) {\n                      if (s.routeId) pendingRouteIds.add(s.routeId)\n                    }\n                    const activeRouteIds = new Set<string>()\n                    for (const s of this.stores.activeMatchStoresById.values()) {\n                      if (s.routeId) activeRouteIds.add(s.routeId)\n                    }\n\n                    hookExitingMatches = mountPending\n                      ? currentMatches.filter(\n                          (match) => !pendingRouteIds.has(match.routeId),\n                        )\n                      : null\n                    hookEnteringMatches = mountPending\n                      ? pendingMatches.filter(\n                          (match) => !activeRouteIds.has(match.routeId),\n                        )\n                      : null\n                    hookStayingMatches = mountPending\n                      ? pendingMatches.filter((match) =>\n                          activeRouteIds.has(match.routeId),\n                        )\n                      : currentMatches\n\n                    this.stores.isLoading.setState(() => false)\n                    this.stores.loadedAt.setState(() => Date.now())\n                    /**\n                     * When committing new matches, cache any exiting matches that are still usable.\n                     * Routes that resolved with `status: 'error'` or `status: 'notFound'` are\n                     * deliberately excluded from `cachedMatches` so that subsequent invalidations\n                     * or reloads re-run their loaders instead of reusing the failed/not-found data.\n                     */\n                    if (mountPending) {\n                      this.stores.setActiveMatches(pendingMatches)\n                      this.stores.setPendingMatches([])\n                      this.stores.setCachedMatches([\n                        ...this.stores.cachedMatchesSnapshot.state,\n                        ...exitingMatches!.filter(\n                          (d) =>\n                            d.status !== 'error' &&\n                            d.status !== 'notFound' &&\n                            d.status !== 'redirected',\n                        ),\n                      ])\n                      this.clearExpiredCache()\n                    }\n                  })\n\n                  //\n                  for (const [matches, hook] of [\n                    [hookExitingMatches, 'onLeave'],\n                    [hookEnteringMatches, 'onEnter'],\n                    [hookStayingMatches, 'onStay'],\n                  ] as const) {\n                    if (!matches) continue\n                    for (const match of matches as Array<AnyRouteMatch>) {\n                      this.looseRoutesById[match.routeId]!.options[hook]?.(\n                        match,\n                      )\n                    }\n                  }\n                })\n              })\n            },\n          })\n        } catch (err) {\n          if (isRedirect(err)) {\n            redirect = err\n            if (!(isServer ?? this.isServer)) {\n              this.navigate({\n                ...redirect.options,\n                replace: true,\n                ignoreBlocker: true,\n              })\n            }\n          } else if (isNotFound(err)) {\n            notFound = err\n          }\n\n          const nextStatusCode = redirect\n            ? redirect.status\n            : notFound\n              ? 404\n              : this.stores.activeMatchesSnapshot.state.some(\n                    (d) => d.status === 'error',\n                  )\n                ? 500\n                : 200\n\n          this.batch(() => {\n            this.stores.statusCode.setState(() => nextStatusCode)\n            this.stores.redirect.setState(() => redirect)\n          })\n        }\n\n        if (this.latestLoadPromise === loadPromise) {\n          this.commitLocationPromise?.resolve()\n          this.latestLoadPromise = undefined\n          this.commitLocationPromise = undefined\n        }\n\n        resolve()\n      })\n    })\n\n    this.latestLoadPromise = loadPromise\n\n    await loadPromise\n\n    while (\n      (this.latestLoadPromise as any) &&\n      loadPromise !== this.latestLoadPromise\n    ) {\n      await this.latestLoadPromise\n    }\n\n    let newStatusCode: number | undefined = undefined\n    if (this.hasNotFoundMatch()) {\n      newStatusCode = 404\n    } else if (\n      this.stores.activeMatchesSnapshot.state.some((d) => d.status === 'error')\n    ) {\n      newStatusCode = 500\n    }\n    if (newStatusCode !== undefined) {\n      this.stores.statusCode.setState(() => newStatusCode)\n    }\n  }\n\n  startViewTransition = (fn: () => Promise<void>) => {\n    // Determine if we should start a view transition from the navigation\n    // or from the router default\n    const shouldViewTransition =\n      this.shouldViewTransition ?? this.options.defaultViewTransition\n\n    // Reset the view transition flag\n    this.shouldViewTransition = undefined\n\n    // Attempt to start a view transition (or just apply the changes if we can't)\n    if (\n      shouldViewTransition &&\n      typeof document !== 'undefined' &&\n      'startViewTransition' in document &&\n      typeof document.startViewTransition === 'function'\n    ) {\n      // lib.dom.ts doesn't support viewTransition types variant yet.\n      // TODO: Fix this when dom types are updated\n      let startViewTransitionParams: any\n\n      if (\n        typeof shouldViewTransition === 'object' &&\n        this.isViewTransitionTypesSupported\n      ) {\n        const next = this.latestLocation\n        const prevLocation = this.stores.resolvedLocation.state\n\n        const resolvedViewTransitionTypes =\n          typeof shouldViewTransition.types === 'function'\n            ? shouldViewTransition.types(\n                getLocationChangeInfo(next, prevLocation),\n              )\n            : shouldViewTransition.types\n\n        if (resolvedViewTransitionTypes === false) {\n          fn()\n          return\n        }\n\n        startViewTransitionParams = {\n          update: fn,\n          types: resolvedViewTransitionTypes,\n        }\n      } else {\n        startViewTransitionParams = fn\n      }\n\n      document.startViewTransition(startViewTransitionParams)\n    } else {\n      fn()\n    }\n  }\n\n  updateMatch: UpdateMatchFn = (id, updater) => {\n    this.startTransition(() => {\n      const pendingMatch = this.stores.pendingMatchStoresById.get(id)\n      if (pendingMatch) {\n        pendingMatch.setState(updater)\n        return\n      }\n\n      const activeMatch = this.stores.activeMatchStoresById.get(id)\n      if (activeMatch) {\n        activeMatch.setState(updater)\n        return\n      }\n\n      const cachedMatch = this.stores.cachedMatchStoresById.get(id)\n      if (cachedMatch) {\n        const next = updater(cachedMatch.state)\n        if (next.status === 'redirected') {\n          const deleted = this.stores.cachedMatchStoresById.delete(id)\n          if (deleted) {\n            this.stores.cachedMatchesId.setState((prev) =>\n              prev.filter((matchId) => matchId !== id),\n            )\n          }\n        } else {\n          cachedMatch.setState(() => next)\n        }\n      }\n    })\n  }\n\n  getMatch: GetMatchFn = (matchId: string): AnyRouteMatch | undefined => {\n    return (\n      this.stores.cachedMatchStoresById.get(matchId)?.state ??\n      this.stores.pendingMatchStoresById.get(matchId)?.state ??\n      this.stores.activeMatchStoresById.get(matchId)?.state\n    )\n  }\n\n  /**\n   * Invalidate the current matches and optionally force them back into a pending state.\n   *\n   * - Marks all matches that pass the optional `filter` as `invalid: true`.\n   * - If `forcePending` is true, or a match is currently in `'error'` or `'notFound'` status,\n   *   its status is reset to `'pending'` and its `error` cleared so that the loader is re-run\n   *   on the next `load()` call (eg. after HMR or a manual invalidation).\n   */\n  invalidate: InvalidateFn<\n    RouterCore<\n      TRouteTree,\n      TTrailingSlashOption,\n      TDefaultStructuralSharingOption,\n      TRouterHistory,\n      TDehydrated\n    >\n  > = (opts) => {\n    const invalidate = (d: MakeRouteMatch<TRouteTree>) => {\n      if (opts?.filter?.(d as MakeRouteMatchUnion<this>) ?? true) {\n        return {\n          ...d,\n          invalid: true,\n          ...(opts?.forcePending ||\n          d.status === 'error' ||\n          d.status === 'notFound'\n            ? ({ status: 'pending', error: undefined } as const)\n            : undefined),\n        }\n      }\n      return d\n    }\n\n    this.batch(() => {\n      this.stores.setActiveMatches(\n        this.stores.activeMatchesSnapshot.state.map(invalidate),\n      )\n      this.stores.setCachedMatches(\n        this.stores.cachedMatchesSnapshot.state.map(invalidate),\n      )\n      this.stores.setPendingMatches(\n        this.stores.pendingMatchesSnapshot.state.map(invalidate),\n      )\n    })\n\n    this.shouldViewTransition = false\n    return this.load({ sync: opts?.sync })\n  }\n\n  getParsedLocationHref = (location: ParsedLocation) => {\n    // For redirects and external use, we need publicHref (with rewrite output applied)\n    // href is the internal path after rewrite input, publicHref is user-facing\n    return location.publicHref || '/'\n  }\n\n  resolveRedirect = (redirect: AnyRedirect): AnyRedirect => {\n    const locationHeader = redirect.headers.get('Location')\n\n    if (!redirect.options.href || redirect.options._builtLocation) {\n      const location =\n        redirect.options._builtLocation ?? this.buildLocation(redirect.options)\n      const href = this.getParsedLocationHref(location)\n      redirect.options.href = href\n      redirect.headers.set('Location', href)\n    } else if (locationHeader) {\n      try {\n        const url = new URL(locationHeader)\n        if (this.origin && url.origin === this.origin) {\n          const href = url.pathname + url.search + url.hash\n          redirect.options.href = href\n          redirect.headers.set('Location', href)\n        }\n      } catch {\n        // ignore invalid URLs\n      }\n    }\n\n    if (\n      redirect.options.href &&\n      !redirect.options._builtLocation &&\n      // Check for dangerous protocols before processing the redirect\n      isDangerousProtocol(redirect.options.href, this.protocolAllowlist)\n    ) {\n      throw new Error(\n        process.env.NODE_ENV !== 'production'\n          ? `Redirect blocked: unsafe protocol in href \"${redirect.options.href}\". Allowed protocols: ${Array.from(this.protocolAllowlist).join(', ')}.`\n          : 'Redirect blocked: unsafe protocol',\n      )\n    }\n\n    if (!redirect.headers.get('Location')) {\n      redirect.headers.set('Location', redirect.options.href)\n    }\n\n    return redirect\n  }\n\n  clearCache: ClearCacheFn<this> = (opts) => {\n    const filter = opts?.filter\n    if (filter !== undefined) {\n      this.stores.setCachedMatches(\n        this.stores.cachedMatchesSnapshot.state.filter(\n          (m) => !filter(m as MakeRouteMatchUnion<this>),\n        ),\n      )\n    } else {\n      this.stores.setCachedMatches([])\n    }\n  }\n\n  clearExpiredCache = () => {\n    const now = Date.now()\n    // This is where all of the garbage collection magic happens\n    const filter = (d: MakeRouteMatch<TRouteTree>) => {\n      const route = this.looseRoutesById[d.routeId]!\n\n      if (!route.options.loader) {\n        return true\n      }\n\n      // If the route was preloaded, use the preloadGcTime\n      // otherwise, use the gcTime\n      const gcTime =\n        (d.preload\n          ? (route.options.preloadGcTime ?? this.options.defaultPreloadGcTime)\n          : (route.options.gcTime ?? this.options.defaultGcTime)) ??\n        5 * 60 * 1000\n\n      const isError = d.status === 'error'\n      if (isError) return true\n\n      const gcEligible = now - d.updatedAt >= gcTime\n      return gcEligible\n    }\n    this.clearCache({ filter })\n  }\n\n  loadRouteChunk = loadRouteChunk\n\n  preloadRoute: PreloadRouteFn<\n    TRouteTree,\n    TTrailingSlashOption,\n    TDefaultStructuralSharingOption,\n    TRouterHistory\n  > = async (opts) => {\n    const next = opts._builtLocation ?? this.buildLocation(opts as any)\n\n    let matches = this.matchRoutes(next, {\n      throwOnError: true,\n      preload: true,\n      dest: opts,\n    })\n\n    const activeMatchIds = new Set([\n      ...this.stores.matchesId.state,\n      ...this.stores.pendingMatchesId.state,\n    ])\n\n    const loadedMatchIds = new Set([\n      ...activeMatchIds,\n      ...this.stores.cachedMatchesId.state,\n    ])\n\n    // If the matches are already loaded, we need to add them to the cached matches.\n    const matchesToCache = matches.filter(\n      (match) => !loadedMatchIds.has(match.id),\n    )\n    if (matchesToCache.length) {\n      const cachedMatches = this.stores.cachedMatchesSnapshot.state\n      this.stores.setCachedMatches([...cachedMatches, ...matchesToCache])\n    }\n\n    try {\n      matches = await loadMatches({\n        router: this,\n        matches,\n        location: next,\n        preload: true,\n        updateMatch: (id, updater) => {\n          // Don't update the match if it's currently loaded\n          if (activeMatchIds.has(id)) {\n            matches = matches.map((d) => (d.id === id ? updater(d) : d))\n          } else {\n            this.updateMatch(id, updater)\n          }\n        },\n      })\n\n      return matches\n    } catch (err) {\n      if (isRedirect(err)) {\n        if (err.options.reloadDocument) {\n          return undefined\n        }\n\n        return await this.preloadRoute({\n          ...err.options,\n          _fromLocation: next,\n        })\n      }\n      if (!isNotFound(err)) {\n        // Preload errors are not fatal, but we should still log them\n        console.error(err)\n      }\n      return undefined\n    }\n  }\n\n  matchRoute: MatchRouteFn<\n    TRouteTree,\n    TTrailingSlashOption,\n    TDefaultStructuralSharingOption,\n    TRouterHistory\n  > = (location, opts) => {\n    const matchLocation = {\n      ...location,\n      to: location.to\n        ? this.resolvePathWithBase(location.from || '', location.to as string)\n        : undefined,\n      params: location.params || {},\n      leaveParams: true,\n    }\n    const next = this.buildLocation(matchLocation as any)\n\n    if (opts?.pending && this.stores.status.state !== 'pending') {\n      return false\n    }\n\n    const pending =\n      opts?.pending === undefined ? !this.stores.isLoading.state : opts.pending\n\n    const baseLocation = pending\n      ? this.latestLocation\n      : this.stores.resolvedLocation.state || this.stores.location.state\n\n    const match = findSingleMatch(\n      next.pathname,\n      opts?.caseSensitive ?? false,\n      opts?.fuzzy ?? false,\n      baseLocation.pathname,\n      this.processedTree,\n    )\n\n    if (!match) {\n      return false\n    }\n\n    if (location.params) {\n      if (!deepEqual(match.rawParams, location.params, { partial: true })) {\n        return false\n      }\n    }\n\n    if (opts?.includeSearch ?? true) {\n      return deepEqual(baseLocation.search, next.search, { partial: true })\n        ? match.rawParams\n        : false\n    }\n\n    return match.rawParams\n  }\n\n  ssr?: {\n    manifest: Manifest | undefined\n  }\n\n  serverSsr?: ServerSsr\n\n  hasNotFoundMatch = () => {\n    return this.stores.activeMatchesSnapshot.state.some(\n      (d) => d.status === 'notFound' || d.globalNotFound,\n    )\n  }\n}\n\n/** Error thrown when search parameter validation fails. */\nexport class SearchParamError extends Error {}\n\n/** Error thrown when path parameter parsing/validation fails. */\nexport class PathParamError extends Error {}\n\nconst normalize = (str: string) =>\n  str.endsWith('/') && str.length > 1 ? str.slice(0, -1) : str\nfunction comparePaths(a: string, b: string) {\n  return normalize(a) === normalize(b)\n}\n\n/**\n * Lazily import a module function and forward arguments to it, retaining\n * parameter and return types for the selected export key.\n */\nexport function lazyFn<\n  T extends Record<string, (...args: Array<any>) => any>,\n  TKey extends keyof T = 'default',\n>(fn: () => Promise<T>, key?: TKey) {\n  return async (\n    ...args: Parameters<T[TKey]>\n  ): Promise<Awaited<ReturnType<T[TKey]>>> => {\n    const imported = await fn()\n    return imported[key || 'default'](...args)\n  }\n}\n\n/** Create an initial RouterState from a parsed location. */\nexport function getInitialRouterState(\n  location: ParsedLocation,\n): RouterState<any> {\n  return {\n    loadedAt: 0,\n    isLoading: false,\n    isTransitioning: false,\n    status: 'idle',\n    resolvedLocation: undefined,\n    location,\n    matches: [],\n    statusCode: 200,\n  }\n}\n\nfunction validateSearch(validateSearch: AnyValidator, input: unknown): unknown {\n  if (validateSearch == null) return {}\n\n  if ('~standard' in validateSearch) {\n    const result = validateSearch['~standard'].validate(input)\n\n    if (result instanceof Promise)\n      throw new SearchParamError('Async validation not supported')\n\n    if (result.issues)\n      throw new SearchParamError(JSON.stringify(result.issues, undefined, 2), {\n        cause: result,\n      })\n\n    return result.value\n  }\n\n  if ('parse' in validateSearch) {\n    return validateSearch.parse(input)\n  }\n\n  if (typeof validateSearch === 'function') {\n    return validateSearch(input)\n  }\n\n  return {}\n}\n\n/**\n * Build the matched route chain and extract params for a pathname.\n * Falls back to the root route if no specific route is found.\n */\nexport function getMatchedRoutes<TRouteLike extends RouteLike>({\n  pathname,\n  routesById,\n  processedTree,\n}: {\n  pathname: string\n  routesById: Record<string, TRouteLike>\n  processedTree: ProcessedTree<any, any, any>\n}) {\n  const routeParams: Record<string, string> = Object.create(null)\n  const trimmedPath = trimPathRight(pathname)\n\n  let foundRoute: TRouteLike | undefined = undefined\n  let parsedParams: Record<string, unknown> | undefined = undefined\n  const match = findRouteMatch<TRouteLike>(trimmedPath, processedTree, true)\n  if (match) {\n    foundRoute = match.route\n    Object.assign(routeParams, match.rawParams) // Copy params, because they're cached\n    parsedParams = Object.assign(Object.create(null), match.parsedParams)\n  }\n\n  const matchedRoutes = match?.branch || [routesById[rootRouteId]!]\n\n  return { matchedRoutes, routeParams, foundRoute, parsedParams }\n}\n\n/**\n * TODO: once caches are persisted across requests on the server,\n * we can cache the built middleware chain using `last(destRoutes)` as the key\n */\nfunction applySearchMiddleware({\n  search,\n  dest,\n  destRoutes,\n  _includeValidateSearch,\n}: {\n  search: any\n  dest: { search?: unknown }\n  destRoutes: ReadonlyArray<AnyRoute>\n  _includeValidateSearch: boolean | undefined\n}) {\n  const middleware = buildMiddlewareChain(destRoutes)\n  return middleware(search, dest, _includeValidateSearch ?? false)\n}\n\nfunction buildMiddlewareChain(destRoutes: ReadonlyArray<AnyRoute>) {\n  const context = {\n    dest: null as unknown as BuildNextOptions,\n    _includeValidateSearch: false,\n    middlewares: [] as Array<SearchMiddleware<any>>,\n  }\n\n  for (const route of destRoutes) {\n    if ('search' in route.options) {\n      if (route.options.search?.middlewares) {\n        context.middlewares.push(...route.options.search.middlewares)\n      }\n    }\n    // TODO remove preSearchFilters and postSearchFilters in v2\n    else if (\n      route.options.preSearchFilters ||\n      route.options.postSearchFilters\n    ) {\n      const legacyMiddleware: SearchMiddleware<any> = ({ search, next }) => {\n        let nextSearch = search\n\n        if (\n          'preSearchFilters' in route.options &&\n          route.options.preSearchFilters\n        ) {\n          nextSearch = route.options.preSearchFilters.reduce(\n            (prev, next) => next(prev),\n            search,\n          )\n        }\n\n        const result = next(nextSearch)\n\n        if (\n          'postSearchFilters' in route.options &&\n          route.options.postSearchFilters\n        ) {\n          return route.options.postSearchFilters.reduce(\n            (prev, next) => next(prev),\n            result,\n          )\n        }\n\n        return result\n      }\n      context.middlewares.push(legacyMiddleware)\n    }\n\n    if (route.options.validateSearch) {\n      const validate: SearchMiddleware<any> = ({ search, next }) => {\n        const result = next(search)\n        if (!context._includeValidateSearch) return result\n        try {\n          const validatedSearch = {\n            ...result,\n            ...(validateSearch(route.options.validateSearch, result) ??\n              undefined),\n          }\n          return validatedSearch\n        } catch {\n          // ignore errors here because they are already handled in matchRoutes\n          return result\n        }\n      }\n\n      context.middlewares.push(validate)\n    }\n  }\n\n  // the chain ends here since `next` is not called\n  const final: SearchMiddleware<any> = ({ search }) => {\n    const dest = context.dest\n    if (!dest.search) {\n      return {}\n    }\n    if (dest.search === true) {\n      return search\n    }\n    return functionalUpdate(dest.search, search)\n  }\n\n  context.middlewares.push(final)\n\n  const applyNext = (\n    index: number,\n    currentSearch: any,\n    middlewares: Array<SearchMiddleware<any>>,\n  ): any => {\n    // no more middlewares left, return the current search\n    if (index >= middlewares.length) {\n      return currentSearch\n    }\n\n    const middleware = middlewares[index]!\n\n    const next = (newSearch: any): any => {\n      return applyNext(index + 1, newSearch, middlewares)\n    }\n\n    return middleware({ search: currentSearch, next })\n  }\n\n  return function middleware(\n    search: any,\n    dest: BuildNextOptions,\n    _includeValidateSearch: boolean,\n  ) {\n    context.dest = dest\n    context._includeValidateSearch = _includeValidateSearch\n    return applyNext(0, search, context.middlewares)\n  }\n}\n\nfunction findGlobalNotFoundRouteId(\n  notFoundMode: 'root' | 'fuzzy' | undefined,\n  routes: ReadonlyArray<AnyRoute>,\n) {\n  if (notFoundMode !== 'root') {\n    for (let i = routes.length - 1; i >= 0; i--) {\n      const route = routes[i]!\n      if (route.children) {\n        return route.id\n      }\n    }\n  }\n  return rootRouteId\n}\n\nfunction extractStrictParams(\n  route: AnyRoute,\n  referenceParams: Record<string, unknown>,\n  parsedParams: Record<string, unknown>,\n  accumulatedParams: Record<string, unknown>,\n) {\n  const parseParams = route.options.params?.parse ?? route.options.parseParams\n  if (parseParams) {\n    if (route.options.skipRouteOnParseError) {\n      // Use pre-parsed params from route matching for skipRouteOnParseError routes\n      for (const key in referenceParams) {\n        if (key in parsedParams) {\n          accumulatedParams[key] = parsedParams[key]\n        }\n      }\n    } else {\n      const result = parseParams(accumulatedParams as Record<string, string>)\n      Object.assign(accumulatedParams, result)\n    }\n  }\n}\n"
  },
  {
    "path": "packages/router-core/src/scroll-restoration.ts",
    "content": "import { isServer } from '@tanstack/router-core/isServer'\nimport { functionalUpdate } from './utils'\nimport type { AnyRouter } from './router'\nimport type { ParsedLocation } from './location'\nimport type { NonNullableUpdater } from './utils'\nimport type { HistoryLocation } from '@tanstack/history'\n\nexport type ScrollRestorationEntry = { scrollX: number; scrollY: number }\n\nexport type ScrollRestorationByElement = Record<string, ScrollRestorationEntry>\n\nexport type ScrollRestorationByKey = Record<string, ScrollRestorationByElement>\n\nexport type ScrollRestorationCache = {\n  state: ScrollRestorationByKey\n  set: (updater: NonNullableUpdater<ScrollRestorationByKey>) => void\n}\nexport type ScrollRestorationOptions = {\n  getKey?: (location: ParsedLocation) => string\n  scrollBehavior?: ScrollToOptions['behavior']\n}\n\nfunction getSafeSessionStorage() {\n  try {\n    if (\n      typeof window !== 'undefined' &&\n      typeof window.sessionStorage === 'object'\n    ) {\n      return window.sessionStorage\n    }\n  } catch {\n    // silent\n  }\n  return undefined\n}\n\n/** SessionStorage key used to persist scroll restoration state. */\n/** SessionStorage key used to store scroll positions across navigations. */\n/** SessionStorage key used to store scroll positions across navigations. */\nexport const storageKey = 'tsr-scroll-restoration-v1_3'\n\nconst throttle = (fn: (...args: Array<any>) => void, wait: number) => {\n  let timeout: any\n  return (...args: Array<any>) => {\n    if (!timeout) {\n      timeout = setTimeout(() => {\n        fn(...args)\n        timeout = null\n      }, wait)\n    }\n  }\n}\n\nfunction createScrollRestorationCache(): ScrollRestorationCache | null {\n  const safeSessionStorage = getSafeSessionStorage()\n  if (!safeSessionStorage) {\n    return null\n  }\n\n  const persistedState = safeSessionStorage.getItem(storageKey)\n  let state: ScrollRestorationByKey = persistedState\n    ? JSON.parse(persistedState)\n    : {}\n\n  return {\n    state,\n    // This setter is simply to make sure that we set the sessionStorage right\n    // after the state is updated. It doesn't necessarily need to be a functional\n    // update.\n    set: (updater) => {\n      state = functionalUpdate(updater, state) || state\n      try {\n        safeSessionStorage.setItem(storageKey, JSON.stringify(state))\n      } catch {\n        console.warn(\n          '[ts-router] Could not persist scroll restoration state to sessionStorage.',\n        )\n      }\n    },\n  }\n}\n\n/** In-memory handle to the persisted scroll restoration cache. */\nexport const scrollRestorationCache = createScrollRestorationCache()\n\n/**\n * The default `getKey` function for `useScrollRestoration`.\n * It returns the `key` from the location state or the `href` of the location.\n *\n * The `location.href` is used as a fallback to support the use case where the location state is not available like the initial render.\n */\n\n/**\n * Default scroll restoration cache key: location state key or full href.\n */\nexport const defaultGetScrollRestorationKey = (location: ParsedLocation) => {\n  return location.state.__TSR_key! || location.href\n}\n\n/** Best-effort nth-child CSS selector for a given element. */\nexport function getCssSelector(el: any): string {\n  const path = []\n  let parent: HTMLElement\n  while ((parent = el.parentNode)) {\n    path.push(\n      `${el.tagName}:nth-child(${Array.prototype.indexOf.call(parent.children, el) + 1})`,\n    )\n    el = parent\n  }\n  return `${path.reverse().join(' > ')}`.toLowerCase()\n}\n\nlet ignoreScroll = false\n\n// NOTE: This function must remain pure and not use any outside variables\n// unless they are passed in as arguments. Why? Because we need to be able to\n// toString() it into a script tag to execute as early as possible in the browser\n// during SSR. Additionally, we also call it from within the router lifecycle\nexport function restoreScroll({\n  storageKey,\n  key,\n  behavior,\n  shouldScrollRestoration,\n  scrollToTopSelectors,\n  location,\n}: {\n  storageKey: string\n  key?: string\n  behavior?: ScrollToOptions['behavior']\n  shouldScrollRestoration?: boolean\n  scrollToTopSelectors?: Array<string | (() => Element | null | undefined)>\n  location?: HistoryLocation\n}) {\n  let byKey: ScrollRestorationByKey\n\n  try {\n    byKey = JSON.parse(sessionStorage.getItem(storageKey) || '{}')\n  } catch (error) {\n    console.error(error)\n    return\n  }\n\n  const resolvedKey = key || window.history.state?.__TSR_key\n  const elementEntries = byKey[resolvedKey]\n\n  //\n  ignoreScroll = true\n\n  //\n  scroll: {\n    // If we have a cached entry for this location state,\n    // we always need to prefer that over the hash scroll.\n    if (\n      shouldScrollRestoration &&\n      elementEntries &&\n      Object.keys(elementEntries).length > 0\n    ) {\n      for (const elementSelector in elementEntries) {\n        const entry = elementEntries[elementSelector]!\n        if (elementSelector === 'window') {\n          window.scrollTo({\n            top: entry.scrollY,\n            left: entry.scrollX,\n            behavior,\n          })\n        } else if (elementSelector) {\n          const element = document.querySelector(elementSelector)\n          if (element) {\n            element.scrollLeft = entry.scrollX\n            element.scrollTop = entry.scrollY\n          }\n        }\n      }\n\n      break scroll\n    }\n\n    // If we don't have a cached entry for the hash,\n    // Which means we've never seen this location before,\n    // we need to check if there is a hash in the URL.\n    // If there is, we need to scroll it's ID into view.\n    const hash = (location ?? window.location).hash.split('#', 2)[1]\n\n    if (hash) {\n      const hashScrollIntoViewOptions =\n        window.history.state?.__hashScrollIntoViewOptions ?? true\n\n      if (hashScrollIntoViewOptions) {\n        const el = document.getElementById(hash)\n        if (el) {\n          el.scrollIntoView(hashScrollIntoViewOptions)\n        }\n      }\n\n      break scroll\n    }\n\n    // If there is no cached entry for the hash and there is no hash in the URL,\n    // we need to scroll to the top of the page for every scrollToTop element\n    const scrollOptions = { top: 0, left: 0, behavior }\n    window.scrollTo(scrollOptions)\n    if (scrollToTopSelectors) {\n      for (const selector of scrollToTopSelectors) {\n        if (selector === 'window') continue\n        const element =\n          typeof selector === 'function'\n            ? selector()\n            : document.querySelector(selector)\n        if (element) element.scrollTo(scrollOptions)\n      }\n    }\n  }\n\n  //\n  ignoreScroll = false\n}\n\n/** Setup global listeners and hooks to support scroll restoration. */\n/** Setup global listeners and hooks to support scroll restoration. */\nexport function setupScrollRestoration(router: AnyRouter, force?: boolean) {\n  if (!scrollRestorationCache && !(isServer ?? router.isServer)) {\n    return\n  }\n  const shouldScrollRestoration =\n    force ?? router.options.scrollRestoration ?? false\n\n  if (shouldScrollRestoration) {\n    router.isScrollRestoring = true\n  }\n\n  if (\n    (isServer ?? router.isServer) ||\n    router.isScrollRestorationSetup ||\n    !scrollRestorationCache\n  ) {\n    return\n  }\n\n  router.isScrollRestorationSetup = true\n\n  //\n  ignoreScroll = false\n\n  const getKey =\n    router.options.getScrollRestorationKey || defaultGetScrollRestorationKey\n\n  window.history.scrollRestoration = 'manual'\n\n  // // Create a MutationObserver to monitor DOM changes\n  // const mutationObserver = new MutationObserver(() => {\n  //   ;ignoreScroll = true\n  //   requestAnimationFrame(() => {\n  //     ;ignoreScroll = false\n\n  //     // Attempt to restore scroll position on each dom\n  //     // mutation until the user scrolls. We do this\n  //     // because dynamic content may come in at different\n  //     // ticks after the initial render and we want to\n  //     // keep up with that content as much as possible.\n  //     // As soon as the user scrolls, we no longer need\n  //     // to attempt router.\n  //     // console.log('mutation observer restoreScroll')\n  //     restoreScroll(\n  //       storageKey,\n  //       getKey(router.stores.location.state),\n  //       router.options.scrollRestorationBehavior,\n  //     )\n  //   })\n  // })\n\n  // const observeDom = () => {\n  //   // Observe changes to the entire document\n  //   mutationObserver.observe(document, {\n  //     childList: true, // Detect added or removed child nodes\n  //     subtree: true, // Monitor all descendants\n  //     characterData: true, // Detect text content changes\n  //   })\n  // }\n\n  // const unobserveDom = () => {\n  //   mutationObserver.disconnect()\n  // }\n\n  // observeDom()\n\n  const onScroll = (event: Event) => {\n    // unobserveDom()\n\n    if (ignoreScroll || !router.isScrollRestoring) {\n      return\n    }\n\n    let elementSelector = ''\n\n    if (event.target === document || event.target === window) {\n      elementSelector = 'window'\n    } else {\n      const attrId = (event.target as Element).getAttribute(\n        'data-scroll-restoration-id',\n      )\n\n      if (attrId) {\n        elementSelector = `[data-scroll-restoration-id=\"${attrId}\"]`\n      } else {\n        elementSelector = getCssSelector(event.target)\n      }\n    }\n\n    const restoreKey = getKey(router.stores.location.state)\n\n    scrollRestorationCache.set((state) => {\n      const keyEntry = (state[restoreKey] ||= {} as ScrollRestorationByElement)\n\n      const elementEntry = (keyEntry[elementSelector] ||=\n        {} as ScrollRestorationEntry)\n\n      if (elementSelector === 'window') {\n        elementEntry.scrollX = window.scrollX || 0\n        elementEntry.scrollY = window.scrollY || 0\n      } else if (elementSelector) {\n        const element = document.querySelector(elementSelector)\n        if (element) {\n          elementEntry.scrollX = element.scrollLeft || 0\n          elementEntry.scrollY = element.scrollTop || 0\n        }\n      }\n\n      return state\n    })\n  }\n\n  // Throttle the scroll event to avoid excessive updates\n  if (typeof document !== 'undefined') {\n    document.addEventListener('scroll', throttle(onScroll, 100), true)\n  }\n\n  router.subscribe('onRendered', (event) => {\n    // unobserveDom()\n\n    const cacheKey = getKey(event.toLocation)\n\n    // If the user doesn't want to restore the scroll position,\n    // we don't need to do anything.\n    if (!router.resetNextScroll) {\n      router.resetNextScroll = true\n      return\n    }\n    if (typeof router.options.scrollRestoration === 'function') {\n      const shouldRestore = router.options.scrollRestoration({\n        location: router.latestLocation,\n      })\n      if (!shouldRestore) {\n        return\n      }\n    }\n\n    restoreScroll({\n      storageKey,\n      key: cacheKey,\n      behavior: router.options.scrollRestorationBehavior,\n      shouldScrollRestoration: router.isScrollRestoring,\n      scrollToTopSelectors: router.options.scrollToTopSelectors,\n      location: router.history.location,\n    })\n\n    if (router.isScrollRestoring) {\n      // Mark the location as having been seen\n      scrollRestorationCache.set((state) => {\n        state[cacheKey] ||= {} as ScrollRestorationByElement\n\n        return state\n      })\n    }\n  })\n}\n\n/**\n * @private\n * Handles hash-based scrolling after navigation completes.\n * To be used in framework-specific <Transitioner> components during the onResolved event.\n *\n * Provides hash scrolling for programmatic navigation when default browser handling is prevented.\n * @param router The router instance containing current location and state\n */\n/**\n * @private\n * Handles hash-based scrolling after navigation completes.\n * To be used in framework-specific Transitioners.\n */\nexport function handleHashScroll(router: AnyRouter) {\n  if (typeof document !== 'undefined' && (document as any).querySelector) {\n    const location = router.stores.location.state\n    const hashScrollIntoViewOptions =\n      location.state.__hashScrollIntoViewOptions ?? true\n\n    if (hashScrollIntoViewOptions && location.hash !== '') {\n      const el = document.getElementById(location.hash)\n      if (el) {\n        el.scrollIntoView(hashScrollIntoViewOptions)\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "packages/router-core/src/searchMiddleware.ts",
    "content": "import { deepEqual } from './utils'\nimport type { NoInfer, PickOptional } from './utils'\nimport type { SearchMiddleware } from './route'\nimport type { IsRequiredParams } from './link'\n\n/**\n * Retain specified search params across navigations.\n *\n * If `keys` is `true`, retain all current params. Otherwise, copy only the\n * listed keys from the current search into the next search.\n *\n * @param keys `true` to retain all, or a list of keys to retain.\n * @returns A search middleware suitable for route `search.middlewares`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/retainSearchParamsFunction\n */\nexport function retainSearchParams<TSearchSchema extends object>(\n  keys: Array<keyof TSearchSchema> | true,\n): SearchMiddleware<TSearchSchema> {\n  return ({ search, next }) => {\n    const result = next(search)\n    if (keys === true) {\n      return { ...search, ...result }\n    }\n    const copy = { ...result }\n    // add missing keys from search to copy\n    keys.forEach((key) => {\n      if (!(key in copy)) {\n        copy[key] = search[key]\n      }\n    })\n    return copy\n  }\n}\n\n/**\n * Remove optional or default-valued search params from navigations.\n *\n * - Pass `true` (only if there are no required search params) to strip all.\n * - Pass an array to always remove those optional keys.\n * - Pass an object of default values; keys equal (deeply) to the defaults are removed.\n *\n * @returns A search middleware suitable for route `search.middlewares`.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/stripSearchParamsFunction\n */\nexport function stripSearchParams<\n  TSearchSchema,\n  TOptionalProps = PickOptional<NoInfer<TSearchSchema>>,\n  const TValues =\n    | Partial<NoInfer<TOptionalProps>>\n    | Array<keyof TOptionalProps>,\n  const TInput = IsRequiredParams<TSearchSchema> extends never\n    ? TValues | true\n    : TValues,\n>(input: NoInfer<TInput>): SearchMiddleware<TSearchSchema> {\n  return ({ search, next }) => {\n    if (input === true) {\n      return {}\n    }\n    const result = { ...next(search) } as Record<string, unknown>\n    if (Array.isArray(input)) {\n      input.forEach((key) => {\n        delete result[key]\n      })\n    } else {\n      Object.entries(input as Record<string, unknown>).forEach(\n        ([key, value]) => {\n          if (deepEqual(result[key], value)) {\n            delete result[key]\n          }\n        },\n      )\n    }\n    return result as any\n  }\n}\n"
  },
  {
    "path": "packages/router-core/src/searchParams.ts",
    "content": "import { decode, encode } from './qss'\nimport type { AnySchema } from './validators'\n\n/** Default `parseSearch` that strips leading '?' and JSON-parses values. */\nexport const defaultParseSearch = parseSearchWith(JSON.parse)\n/** Default `stringifySearch` using JSON.stringify for complex values. */\nexport const defaultStringifySearch = stringifySearchWith(\n  JSON.stringify,\n  JSON.parse,\n)\n\n/**\n * Build a `parseSearch` function using a provided JSON-like parser.\n *\n * The returned function strips a leading `?`, decodes values, and attempts to\n * JSON-parse string values using the given `parser`.\n *\n * @param parser Function to parse a string value (e.g. `JSON.parse`).\n * @returns A `parseSearch` function compatible with `Router` options.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization\n */\nexport function parseSearchWith(parser: (str: string) => any) {\n  return (searchStr: string): AnySchema => {\n    if (searchStr[0] === '?') {\n      searchStr = searchStr.substring(1)\n    }\n\n    const query: Record<string, unknown> = decode(searchStr)\n\n    // Try to parse any query params that might be json\n    for (const key in query) {\n      const value = query[key]\n      if (typeof value === 'string') {\n        try {\n          query[key] = parser(value)\n        } catch (_err) {\n          // silent\n        }\n      }\n    }\n\n    return query\n  }\n}\n\n/**\n * Build a `stringifySearch` function using a provided serializer.\n *\n * Non-primitive values are serialized with `stringify`. If a `parser` is\n * supplied, string values that are parseable are re-serialized to ensure\n * symmetry with `parseSearch`.\n *\n * @param stringify Function to serialize a value (e.g. `JSON.stringify`).\n * @param parser Optional parser to detect parseable strings.\n * @returns A `stringifySearch` function compatible with `Router` options.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-search-param-serialization\n */\nexport function stringifySearchWith(\n  stringify: (search: any) => string,\n  parser?: (str: string) => any,\n) {\n  const hasParser = typeof parser === 'function'\n  function stringifyValue(val: any) {\n    if (typeof val === 'object' && val !== null) {\n      try {\n        return stringify(val)\n      } catch (_err) {\n        // silent\n      }\n    } else if (hasParser && typeof val === 'string') {\n      try {\n        // Check if it's a valid parseable string.\n        // If it is, then stringify it again.\n        parser(val)\n        return stringify(val)\n      } catch (_err) {\n        // silent\n      }\n    }\n    return val\n  }\n\n  return (search: Record<string, any>) => {\n    const searchStr = encode(search, stringifyValue)\n    return searchStr ? `?${searchStr}` : ''\n  }\n}\n\nexport type SearchSerializer = (searchObj: Record<string, any>) => string\nexport type SearchParser = (searchStr: string) => Record<string, any>\n"
  },
  {
    "path": "packages/router-core/src/ssr/client.ts",
    "content": "export { mergeHeaders } from './headers'\nexport { json } from './json'\nexport type { JsonResponse } from './json'\nexport { hydrate } from './ssr-client'\nexport * from './ssr-client'\nexport type { TsrSsrGlobal, DehydratedMatch, DehydratedRouter } from './types'\n"
  },
  {
    "path": "packages/router-core/src/ssr/constants.ts",
    "content": "export const GLOBAL_TSR = '$_TSR'\nexport declare const GLOBAL_SEROVAL: '$R'\nexport const TSR_SCRIPT_BARRIER_ID = '$tsr-stream-barrier'\n"
  },
  {
    "path": "packages/router-core/src/ssr/createRequestHandler.ts",
    "content": "import { createMemoryHistory } from '@tanstack/history'\nimport { mergeHeaders } from './headers'\nimport {\n  attachRouterServerSsrUtils,\n  getNormalizedURL,\n  getOrigin,\n} from './ssr-server'\nimport type { HandlerCallback } from './handlerCallback'\nimport type { AnyHeaders } from './headers'\nimport type { AnyRouter } from '../router'\nimport type { Manifest } from '../manifest'\n\nexport type RequestHandler<TRouter extends AnyRouter> = (\n  cb: HandlerCallback<TRouter>,\n) => Promise<Response>\n\nexport function createRequestHandler<TRouter extends AnyRouter>({\n  createRouter,\n  request,\n  getRouterManifest,\n}: {\n  createRouter: () => TRouter\n  request: Request\n  getRouterManifest?: () => Manifest | Promise<Manifest>\n}): RequestHandler<TRouter> {\n  return async (cb) => {\n    const router = createRouter()\n    // Track whether the callback will handle cleanup\n    let cbWillCleanup = false\n\n    try {\n      attachRouterServerSsrUtils({\n        router,\n        manifest: await getRouterManifest?.(),\n      })\n\n      // normalizing and sanitizing the pathname here for server, so we always deal with the same format during SSR.\n      const { url } = getNormalizedURL(request.url, 'http://localhost')\n      const origin = getOrigin(request)\n      const href = url.href.replace(url.origin, '')\n\n      // Create a history for the router\n      const history = createMemoryHistory({\n        initialEntries: [href],\n      })\n\n      // Update the router with the history and context\n      router.update({\n        history,\n        origin: router.options.origin ?? origin,\n      })\n\n      await router.load()\n\n      await router.serverSsr?.dehydrate()\n\n      const responseHeaders = getRequestHeaders({\n        router,\n      })\n\n      // Mark that the callback will handle cleanup\n      cbWillCleanup = true\n      return cb({\n        request,\n        router,\n        responseHeaders,\n      })\n    } finally {\n      if (!cbWillCleanup) {\n        // Clean up router SSR state if the callback won't handle it\n        // (e.g., if an error occurred before the callback was invoked).\n        // When the callback runs, it handles cleanup (either via transformStreamWithRouter\n        // for streaming, or directly in renderRouterToString for non-streaming).\n        router.serverSsr?.cleanup()\n      }\n    }\n  }\n}\n\nfunction getRequestHeaders(opts: { router: AnyRouter }): Headers {\n  const matchHeaders =\n    opts.router.stores.activeMatchesSnapshot.state.map<AnyHeaders>(\n      (match) => match.headers,\n    )\n\n  // Handle Redirects\n  const redirect = opts.router.stores.redirect.state\n  if (redirect) {\n    matchHeaders.push(redirect.headers)\n  }\n\n  return mergeHeaders(\n    {\n      'Content-Type': 'text/html; charset=UTF-8',\n    },\n    ...matchHeaders,\n  )\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/handlerCallback.ts",
    "content": "import type { AnyRouter } from '../router'\n\nexport interface HandlerCallback<TRouter extends AnyRouter> {\n  (ctx: {\n    request: Request\n    router: TRouter\n    responseHeaders: Headers\n  }): Response | Promise<Response>\n}\n\nexport function defineHandlerCallback<TRouter extends AnyRouter>(\n  handler: HandlerCallback<TRouter>,\n): HandlerCallback<TRouter> {\n  return handler\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/headers.ts",
    "content": "import { splitSetCookieString } from 'cookie-es'\nimport type { OutgoingHttpHeaders } from 'node:http2'\n\nexport type AnyHeaders =\n  | Headers\n  | HeadersInit\n  | Record<string, string>\n  | Array<[string, string]>\n  | OutgoingHttpHeaders\n  | undefined\n\n// Helper function to convert various HeaderInit types to a Headers instance\nfunction toHeadersInstance(init: AnyHeaders) {\n  if (init instanceof Headers) {\n    return init\n  } else if (Array.isArray(init)) {\n    return new Headers(init)\n  } else if (typeof init === 'object') {\n    return new Headers(init as HeadersInit)\n  } else {\n    return null\n  }\n}\n\n// Function to merge headers with proper overrides\nexport function mergeHeaders(...headers: Array<AnyHeaders>) {\n  return headers.reduce((acc: Headers, header) => {\n    const headersInstance = toHeadersInstance(header)\n    if (!headersInstance) return acc\n    for (const [key, value] of headersInstance.entries()) {\n      if (key === 'set-cookie') {\n        const splitCookies = splitSetCookieString(value)\n        splitCookies.forEach((cookie) => acc.append('set-cookie', cookie))\n      } else {\n        acc.set(key, value)\n      }\n    }\n    return acc\n  }, new Headers())\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/json.ts",
    "content": "/**\n * @deprecated Use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) from the standard Web API directly.\n */\nexport interface JsonResponse<TData> extends Response {\n  json: () => Promise<TData>\n}\n\n/**\n * @deprecated Use [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) from the standard Web API directly.\n */\nexport function json<TData>(\n  payload: TData,\n  init?: ResponseInit,\n): JsonResponse<TData> {\n  return Response.json(payload, init)\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/serializer/RawStream.ts",
    "content": "import { createPlugin, createStream } from 'seroval'\nimport type { Plugin } from 'seroval'\n\n/**\n * Hint for RawStream encoding strategy during SSR serialization.\n * - 'binary': Always use base64 encoding (best for binary data like files, images)\n * - 'text': Try UTF-8 first, fallback to base64 (best for text-heavy data like RSC payloads)\n */\nexport type RawStreamHint = 'binary' | 'text'\n\n/**\n * Options for RawStream configuration.\n */\nexport interface RawStreamOptions {\n  /**\n   * Encoding hint for SSR serialization.\n   * - 'binary' (default): Always use base64 encoding\n   * - 'text': Try UTF-8 first, fallback to base64 for invalid UTF-8 chunks\n   */\n  hint?: RawStreamHint\n}\n\n/**\n * Marker class for ReadableStream<Uint8Array> that should be serialized\n * with base64 encoding (SSR) or binary framing (server functions).\n *\n * Wrap your binary streams with this to get efficient serialization:\n * ```ts\n * // For binary data (files, images, etc.)\n * return { data: new RawStream(file.stream()) }\n *\n * // For text-heavy data (RSC payloads, etc.)\n * return { data: new RawStream(rscStream, { hint: 'text' }) }\n * ```\n */\nexport class RawStream {\n  public readonly hint: RawStreamHint\n\n  constructor(\n    public readonly stream: ReadableStream<Uint8Array>,\n    options?: RawStreamOptions,\n  ) {\n    this.hint = options?.hint ?? 'binary'\n  }\n}\n\n/**\n * Callback type for RPC plugin to register raw streams with multiplexer\n */\nexport type OnRawStreamCallback = (\n  streamId: number,\n  stream: ReadableStream<Uint8Array>,\n) => void\n\n// Base64 helpers used in both Node and browser.\n// In Node-like runtimes, prefer Buffer for speed and compatibility.\nconst BufferCtor: any = (globalThis as any).Buffer\nconst hasNodeBuffer = !!BufferCtor && typeof BufferCtor.from === 'function'\n\nfunction uint8ArrayToBase64(bytes: Uint8Array): string {\n  if (bytes.length === 0) return ''\n\n  if (hasNodeBuffer) {\n    return BufferCtor.from(bytes).toString('base64')\n  }\n\n  // Browser fallback: chunked String.fromCharCode + btoa\n  const CHUNK_SIZE = 0x8000 // 32KB chunks to avoid stack overflow\n  const chunks: Array<string> = []\n  for (let i = 0; i < bytes.length; i += CHUNK_SIZE) {\n    const chunk = bytes.subarray(i, i + CHUNK_SIZE)\n    chunks.push(String.fromCharCode.apply(null, chunk as any))\n  }\n  return btoa(chunks.join(''))\n}\n\nfunction base64ToUint8Array(base64: string): Uint8Array {\n  if (base64.length === 0) return new Uint8Array(0)\n\n  if (hasNodeBuffer) {\n    const buf = BufferCtor.from(base64, 'base64')\n    return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength)\n  }\n\n  const binary = atob(base64)\n  const bytes = new Uint8Array(binary.length)\n  for (let i = 0; i < binary.length; i++) {\n    bytes[i] = binary.charCodeAt(i)\n  }\n  return bytes\n}\n\n// Factory sentinels - use null-proto objects to avoid prototype surprises\nconst RAW_STREAM_FACTORY_BINARY: Record<string, never> = Object.create(null)\nconst RAW_STREAM_FACTORY_TEXT: Record<string, never> = Object.create(null)\n\n// Factory constructor for binary mode - converts seroval stream to ReadableStream<Uint8Array>\n// All chunks are base64 encoded strings\nconst RAW_STREAM_FACTORY_CONSTRUCTOR_BINARY = (\n  stream: ReturnType<typeof createStream>,\n) =>\n  new ReadableStream<Uint8Array>({\n    start(controller) {\n      stream.on({\n        next(base64: string) {\n          try {\n            controller.enqueue(base64ToUint8Array(base64))\n          } catch {\n            // Stream may be closed\n          }\n        },\n        throw(error: unknown) {\n          controller.error(error)\n        },\n        return() {\n          try {\n            controller.close()\n          } catch {\n            // Stream may already be closed\n          }\n        },\n      })\n    },\n  })\n\n// Factory constructor for text mode - converts seroval stream to ReadableStream<Uint8Array>\n// Chunks are either strings (UTF-8) or { $b64: string } (base64 fallback)\n// Use module-level TextEncoder to avoid per-factory allocation\nconst textEncoderForFactory = new TextEncoder()\nconst RAW_STREAM_FACTORY_CONSTRUCTOR_TEXT = (\n  stream: ReturnType<typeof createStream>,\n) => {\n  return new ReadableStream<Uint8Array>({\n    start(controller) {\n      stream.on({\n        next(value: string | { $b64: string }) {\n          try {\n            if (typeof value === 'string') {\n              controller.enqueue(textEncoderForFactory.encode(value))\n            } else {\n              controller.enqueue(base64ToUint8Array(value.$b64))\n            }\n          } catch {\n            // Stream may be closed\n          }\n        },\n        throw(error: unknown) {\n          controller.error(error)\n        },\n        return() {\n          try {\n            controller.close()\n          } catch {\n            // Stream may already be closed\n          }\n        },\n      })\n    },\n  })\n}\n\n// Minified factory function for binary mode - all chunks are base64 strings\n// This must be self-contained since it's injected into the HTML\nconst FACTORY_BINARY = `(s=>new ReadableStream({start(c){s.on({next(b){try{const d=atob(b),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}catch(_){}},throw(e){c.error(e)},return(){try{c.close()}catch(_){}}})}}))`\n\n// Minified factory function for text mode - chunks are string or {$b64: string}\n// Uses cached TextEncoder for performance\nconst FACTORY_TEXT = `(s=>{const e=new TextEncoder();return new ReadableStream({start(c){s.on({next(v){try{if(typeof v==='string'){c.enqueue(e.encode(v))}else{const d=atob(v.$b64),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}}catch(_){}},throw(x){c.error(x)},return(){try{c.close()}catch(_){}}})}})})`\n\n// Convert ReadableStream<Uint8Array> to seroval stream with base64-encoded chunks (binary mode)\nfunction toBinaryStream(readable: ReadableStream<Uint8Array>) {\n  const stream = createStream()\n  const reader = readable.getReader()\n\n  // Use iterative loop instead of recursive async to avoid stack accumulation\n  ;(async () => {\n    try {\n      while (true) {\n        const { done, value } = await reader.read()\n        if (done) {\n          stream.return(undefined)\n          break\n        }\n        stream.next(uint8ArrayToBase64(value))\n      }\n    } catch (error) {\n      stream.throw(error)\n    } finally {\n      reader.releaseLock()\n    }\n  })()\n\n  return stream\n}\n\n// Convert ReadableStream<Uint8Array> to seroval stream with UTF-8 first, base64 fallback (text mode)\nfunction toTextStream(readable: ReadableStream<Uint8Array>) {\n  const stream = createStream()\n  const reader = readable.getReader()\n  const decoder = new TextDecoder('utf-8', { fatal: true })\n\n  // Use iterative loop instead of recursive async to avoid stack accumulation\n  ;(async () => {\n    try {\n      while (true) {\n        const { done, value } = await reader.read()\n        if (done) {\n          // Flush any remaining bytes in the decoder\n          try {\n            const remaining = decoder.decode()\n            if (remaining.length > 0) {\n              stream.next(remaining)\n            }\n          } catch {\n            // Ignore decode errors on flush\n          }\n          stream.return(undefined)\n          break\n        }\n\n        try {\n          // Try UTF-8 decode first\n          const text = decoder.decode(value, { stream: true })\n          if (text.length > 0) {\n            stream.next(text)\n          }\n        } catch {\n          // UTF-8 decode failed, fallback to base64\n          stream.next({ $b64: uint8ArrayToBase64(value) })\n        }\n      }\n    } catch (error) {\n      stream.throw(error)\n    } finally {\n      reader.releaseLock()\n    }\n  })()\n\n  return stream\n}\n\n// Factory plugin for binary mode\nconst RawStreamFactoryBinaryPlugin = createPlugin<\n  Record<string, never>,\n  undefined\n>({\n  tag: 'tss/RawStreamFactory',\n  test(value) {\n    return value === RAW_STREAM_FACTORY_BINARY\n  },\n  parse: {\n    sync() {\n      return undefined\n    },\n    async() {\n      return Promise.resolve(undefined)\n    },\n    stream() {\n      return undefined\n    },\n  },\n  serialize() {\n    return FACTORY_BINARY\n  },\n  deserialize() {\n    return RAW_STREAM_FACTORY_BINARY\n  },\n})\n\n// Factory plugin for text mode\nconst RawStreamFactoryTextPlugin = createPlugin<\n  Record<string, never>,\n  undefined\n>({\n  tag: 'tss/RawStreamFactoryText',\n  test(value) {\n    return value === RAW_STREAM_FACTORY_TEXT\n  },\n  parse: {\n    sync() {\n      return undefined\n    },\n    async() {\n      return Promise.resolve(undefined)\n    },\n    stream() {\n      return undefined\n    },\n  },\n  serialize() {\n    return FACTORY_TEXT\n  },\n  deserialize() {\n    return RAW_STREAM_FACTORY_TEXT\n  },\n})\n\n/**\n * SSR Plugin - uses base64 or UTF-8+base64 encoding for chunks, delegates to seroval's stream mechanism.\n * Used during SSR when serializing to JavaScript code for HTML injection.\n *\n * Supports two modes based on RawStream hint:\n * - 'binary': Always base64 encode (default)\n * - 'text': Try UTF-8 first, fallback to base64 for invalid UTF-8\n */\nexport const RawStreamSSRPlugin: Plugin<any, any> = createPlugin({\n  tag: 'tss/RawStream',\n  extends: [RawStreamFactoryBinaryPlugin, RawStreamFactoryTextPlugin],\n\n  test(value: unknown) {\n    return value instanceof RawStream\n  },\n\n  parse: {\n    sync(value: RawStream, ctx) {\n      // Sync parse not really supported for streams, return empty stream\n      const factory =\n        value.hint === 'text'\n          ? RAW_STREAM_FACTORY_TEXT\n          : RAW_STREAM_FACTORY_BINARY\n      return {\n        hint: value.hint,\n        factory: ctx.parse(factory),\n        stream: ctx.parse(createStream()),\n      }\n    },\n    async async(value: RawStream, ctx) {\n      const factory =\n        value.hint === 'text'\n          ? RAW_STREAM_FACTORY_TEXT\n          : RAW_STREAM_FACTORY_BINARY\n      const encodedStream =\n        value.hint === 'text'\n          ? toTextStream(value.stream)\n          : toBinaryStream(value.stream)\n      return {\n        hint: value.hint,\n        factory: await ctx.parse(factory),\n        stream: await ctx.parse(encodedStream),\n      }\n    },\n    stream(value: RawStream, ctx) {\n      const factory =\n        value.hint === 'text'\n          ? RAW_STREAM_FACTORY_TEXT\n          : RAW_STREAM_FACTORY_BINARY\n      const encodedStream =\n        value.hint === 'text'\n          ? toTextStream(value.stream)\n          : toBinaryStream(value.stream)\n      return {\n        hint: value.hint,\n        factory: ctx.parse(factory),\n        stream: ctx.parse(encodedStream),\n      }\n    },\n  },\n\n  serialize(node: { hint: RawStreamHint; factory: any; stream: any }, ctx) {\n    return (\n      '(' +\n      ctx.serialize(node.factory) +\n      ')(' +\n      ctx.serialize(node.stream) +\n      ')'\n    )\n  },\n\n  deserialize(\n    node: { hint: RawStreamHint; factory: any; stream: any },\n    ctx,\n  ): any {\n    const stream: ReturnType<typeof createStream> = ctx.deserialize(node.stream)\n    return node.hint === 'text'\n      ? RAW_STREAM_FACTORY_CONSTRUCTOR_TEXT(stream)\n      : RAW_STREAM_FACTORY_CONSTRUCTOR_BINARY(stream)\n  },\n}) as Plugin<any, any>\n\n/**\n * Node type for RPC plugin serialization\n */\ninterface RawStreamRPCNode {\n  streamId: number\n}\n\n/**\n * Creates an RPC plugin instance that registers raw streams with a multiplexer.\n * Used for server function responses where we want binary framing.\n * Note: RPC always uses binary framing regardless of hint.\n *\n * @param onRawStream Callback invoked when a RawStream is encountered during serialization\n */\nexport function createRawStreamRPCPlugin(\n  onRawStream: OnRawStreamCallback,\n): Plugin<any, any> {\n  // Own stream counter - sequential IDs starting at 1, independent of seroval internals\n  let nextStreamId = 1\n\n  return createPlugin({\n    tag: 'tss/RawStream',\n\n    test(value: unknown) {\n      return value instanceof RawStream\n    },\n\n    parse: {\n      async(value: RawStream) {\n        const streamId = nextStreamId++\n        onRawStream(streamId, value.stream)\n        return Promise.resolve({ streamId })\n      },\n      stream(value: RawStream) {\n        const streamId = nextStreamId++\n        onRawStream(streamId, value.stream)\n        return { streamId }\n      },\n    },\n\n    serialize(): never {\n      // RPC uses toCrossJSONStream which produces JSON nodes, not JS code.\n      // This method is only called by crossSerialize* which we don't use.\n      throw new Error(\n        'RawStreamRPCPlugin.serialize should not be called. RPC uses JSON serialization, not JS code generation.',\n      )\n    },\n\n    deserialize(): never {\n      // Client uses createRawStreamDeserializePlugin instead\n      throw new Error(\n        'RawStreamRPCPlugin.deserialize should not be called. Use createRawStreamDeserializePlugin on client.',\n      )\n    },\n  }) as Plugin<any, any>\n}\n\n/**\n * Creates a deserialize-only plugin for client-side stream reconstruction.\n * Used in serverFnFetcher to wire up streams from frame decoder.\n *\n * @param getOrCreateStream Function to get/create a stream by ID from frame decoder\n */\nexport function createRawStreamDeserializePlugin(\n  getOrCreateStream: (id: number) => ReadableStream<Uint8Array>,\n): Plugin<any, any> {\n  return createPlugin({\n    tag: 'tss/RawStream',\n\n    test: () => false, // Client never serializes RawStream\n\n    parse: {}, // Client only deserializes, never parses\n\n    serialize(): never {\n      // Client never serializes RawStream back to server\n      throw new Error(\n        'RawStreamDeserializePlugin.serialize should not be called. Client only deserializes.',\n      )\n    },\n\n    deserialize(node: RawStreamRPCNode) {\n      return getOrCreateStream(node.streamId)\n    },\n  }) as Plugin<any, any>\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/serializer/ShallowErrorPlugin.ts",
    "content": "import { createPlugin } from 'seroval'\nimport type { SerovalNode } from 'seroval'\n\nexport interface ErrorNode {\n  message: SerovalNode\n}\n\n/**\n * this plugin serializes only the `message` part of an Error\n * this helps with serializing e.g. a ZodError which has functions attached that cannot be serialized\n */\nexport const ShallowErrorPlugin = /* @__PURE__ */ createPlugin<\n  Error,\n  ErrorNode\n>({\n  tag: '$TSR/Error',\n  test(value) {\n    return value instanceof Error\n  },\n  parse: {\n    sync(value, ctx) {\n      return {\n        message: ctx.parse(value.message),\n      }\n    },\n    async async(value, ctx) {\n      return {\n        message: await ctx.parse(value.message),\n      }\n    },\n    stream(value, ctx) {\n      return {\n        message: ctx.parse(value.message),\n      }\n    },\n  },\n  serialize(node, ctx) {\n    return 'new Error(' + ctx.serialize(node.message) + ')'\n  },\n  deserialize(node, ctx) {\n    return new Error(ctx.deserialize(node.message))\n  },\n})\n"
  },
  {
    "path": "packages/router-core/src/ssr/serializer/seroval-plugins.ts",
    "content": "import { ReadableStreamPlugin } from 'seroval-plugins/web'\nimport { ShallowErrorPlugin } from './ShallowErrorPlugin'\nimport { RawStreamSSRPlugin } from './RawStream'\nimport type { Plugin } from 'seroval'\n\nexport const defaultSerovalPlugins = [\n  ShallowErrorPlugin as Plugin<Error, any>,\n  // RawStreamSSRPlugin must come before ReadableStreamPlugin to match first\n  RawStreamSSRPlugin,\n  // ReadableStreamNode is not exported by seroval\n  ReadableStreamPlugin as Plugin<ReadableStream, any>,\n]\n"
  },
  {
    "path": "packages/router-core/src/ssr/serializer/transformer.ts",
    "content": "import { createPlugin } from 'seroval'\nimport { GLOBAL_TSR } from '../constants'\nimport type { Plugin, SerovalNode } from 'seroval'\nimport type {\n  RegisteredConfigType,\n  RegisteredSsr,\n  SSROption,\n} from '../../router'\nimport type { LooseReturnType } from '../../utils'\nimport type { AnyRoute, ResolveAllSSR } from '../../route'\nimport type { RawStream } from './RawStream'\n\ndeclare const TSR_SERIALIZABLE: unique symbol\nexport type TSR_SERIALIZABLE = typeof TSR_SERIALIZABLE\n\nexport type TsrSerializable = { [TSR_SERIALIZABLE]: true }\nexport interface DefaultSerializable {\n  number: number\n  string: string\n  boolean: boolean\n  null: null\n  undefined: undefined\n  bigint: bigint\n  Date: Date\n  Uint8Array: Uint8Array\n  RawStream: RawStream\n  TsrSerializable: TsrSerializable\n}\n\nexport interface SerializableExtensions extends DefaultSerializable {}\n\nexport type Serializable = SerializableExtensions[keyof SerializableExtensions]\n\nexport type UnionizeSerializationAdaptersInput<\n  TAdapters extends ReadonlyArray<AnySerializationAdapter>,\n> = TAdapters[number]['~types']['input']\n\n/**\n * Create a strongly-typed serialization adapter for SSR hydration.\n * Use to register custom types with the router serializer.\n */\nexport function createSerializationAdapter<\n  TInput = unknown,\n  TOutput = unknown,\n  const TExtendsAdapters extends\n    | ReadonlyArray<AnySerializationAdapter>\n    | never = never,\n>(\n  opts: CreateSerializationAdapterOptions<TInput, TOutput, TExtendsAdapters>,\n): SerializationAdapter<TInput, TOutput, TExtendsAdapters> {\n  return opts as unknown as SerializationAdapter<\n    TInput,\n    TOutput,\n    TExtendsAdapters\n  >\n}\n\nexport interface CreateSerializationAdapterOptions<\n  TInput,\n  TOutput,\n  TExtendsAdapters extends ReadonlyArray<AnySerializationAdapter> | never,\n> {\n  key: string\n  extends?: TExtendsAdapters\n  test: (value: unknown) => value is TInput\n  toSerializable: (\n    value: TInput,\n  ) => ValidateSerializable<\n    TOutput,\n    Serializable | UnionizeSerializationAdaptersInput<TExtendsAdapters>\n  >\n  fromSerializable: (value: TOutput) => TInput\n}\n\nexport type ValidateSerializable<T, TSerializable> =\n  T extends ReadonlyArray<unknown>\n    ? ResolveArrayShape<T, TSerializable, 'input'>\n    : T extends TSerializable\n      ? T\n      : T extends (...args: Array<any>) => any\n        ? 'Function is not serializable'\n        : T extends Promise<any>\n          ? ValidateSerializablePromise<T, TSerializable>\n          : T extends ReadableStream<any>\n            ? ValidateReadableStream<T, TSerializable>\n            : T extends Set<any>\n              ? ValidateSerializableSet<T, TSerializable>\n              : T extends Map<any, any>\n                ? ValidateSerializableMap<T, TSerializable>\n                : T extends AsyncGenerator<any, any>\n                  ? ValidateSerializableAsyncGenerator<T, TSerializable>\n                  : {\n                      [K in keyof T]: ValidateSerializable<T[K], TSerializable>\n                    }\n\nexport type ValidateSerializableAsyncGenerator<T, TSerializable> =\n  T extends AsyncGenerator<infer T, infer TReturn, infer TNext>\n    ? AsyncGenerator<\n        ValidateSerializable<T, TSerializable>,\n        ValidateSerializable<TReturn, TSerializable>,\n        TNext\n      >\n    : never\n\nexport type ValidateSerializablePromise<T, TSerializable> =\n  T extends Promise<infer TAwaited>\n    ? Promise<ValidateSerializable<TAwaited, TSerializable>>\n    : never\n\nexport type ValidateReadableStream<T, TSerializable> =\n  T extends ReadableStream<infer TStreamed>\n    ? ReadableStream<ValidateSerializable<TStreamed, TSerializable>>\n    : never\n\nexport type ValidateSerializableSet<T, TSerializable> =\n  T extends Set<infer TItem>\n    ? Set<ValidateSerializable<TItem, TSerializable>>\n    : never\n\nexport type ValidateSerializableMap<T, TSerializable> =\n  T extends Map<infer TKey, infer TValue>\n    ? Map<\n        ValidateSerializable<TKey, TSerializable>,\n        ValidateSerializable<TValue, TSerializable>\n      >\n    : never\n\nexport type RegisteredReadableStream =\n  unknown extends SerializerExtensions['ReadableStream']\n    ? never\n    : SerializerExtensions['ReadableStream']\n\nexport interface DefaultSerializerExtensions {\n  ReadableStream: unknown\n}\n\nexport interface SerializerExtensions extends DefaultSerializerExtensions {}\n\nexport interface SerializationAdapter<\n  TInput,\n  TOutput,\n  TExtendsAdapters extends ReadonlyArray<AnySerializationAdapter>,\n> {\n  '~types': SerializationAdapterTypes<TInput, TOutput, TExtendsAdapters>\n  key: string\n  extends?: TExtendsAdapters\n  test: (value: unknown) => value is TInput\n  toSerializable: (value: TInput) => TOutput\n  fromSerializable: (value: TOutput) => TInput\n}\n\nexport interface SerializationAdapterTypes<\n  TInput,\n  TOutput,\n  TExtendsAdapters extends ReadonlyArray<AnySerializationAdapter>,\n> {\n  input: TInput | UnionizeSerializationAdaptersInput<TExtendsAdapters>\n  output: TOutput\n  extends: TExtendsAdapters\n}\n\nexport type AnySerializationAdapter = SerializationAdapter<any, any, any>\n\n/** Create a Seroval plugin for server-side serialization only. */\nexport function makeSsrSerovalPlugin(\n  serializationAdapter: AnySerializationAdapter,\n  options: { didRun: boolean },\n): Plugin<any, SerovalNode> {\n  return createPlugin<any, SerovalNode>({\n    tag: '$TSR/t/' + serializationAdapter.key,\n    test: serializationAdapter.test,\n    parse: {\n      stream(value, ctx) {\n        return ctx.parse(serializationAdapter.toSerializable(value))\n      },\n    },\n    serialize(node, ctx) {\n      options.didRun = true\n      return (\n        GLOBAL_TSR +\n        '.t.get(\"' +\n        serializationAdapter.key +\n        '\")(' +\n        ctx.serialize(node) +\n        ')'\n      )\n    },\n    // we never deserialize on the server during SSR\n    deserialize: undefined as never,\n  })\n}\n\n/** Create a Seroval plugin for client/server symmetric (de)serialization. */\nexport function makeSerovalPlugin(\n  serializationAdapter: AnySerializationAdapter,\n): Plugin<any, SerovalNode> {\n  return createPlugin<any, SerovalNode>({\n    tag: '$TSR/t/' + serializationAdapter.key,\n    test: serializationAdapter.test,\n    parse: {\n      sync(value, ctx) {\n        return ctx.parse(serializationAdapter.toSerializable(value))\n      },\n      async async(value, ctx) {\n        return await ctx.parse(serializationAdapter.toSerializable(value))\n      },\n      stream(value, ctx) {\n        return ctx.parse(serializationAdapter.toSerializable(value))\n      },\n    },\n    // we don't generate JS code outside of SSR (for now)\n    serialize: undefined as never,\n    deserialize(node, ctx) {\n      return serializationAdapter.fromSerializable(ctx.deserialize(node))\n    },\n  })\n}\n\nexport type ValidateSerializableInput<TRegister, T> = ValidateSerializable<\n  T,\n  RegisteredSerializableInput<TRegister>\n>\n\nexport type RegisteredSerializableInput<TRegister> =\n  | (unknown extends RegisteredSerializationAdapters<TRegister>\n      ? never\n      : RegisteredSerializationAdapters<TRegister> extends ReadonlyArray<AnySerializationAdapter>\n        ? RegisteredSerializationAdapters<TRegister>[number]['~types']['input']\n        : never)\n  | Serializable\n\nexport type RegisteredSerializationAdapters<TRegister> = RegisteredConfigType<\n  TRegister,\n  'serializationAdapters'\n>\n\nexport type ValidateSerializableInputResult<TRegister, T> =\n  ValidateSerializableResult<T, RegisteredSerializableInput<TRegister>>\n\nexport type ValidateSerializableResult<T, TSerializable> =\n  T extends ReadonlyArray<unknown>\n    ? ResolveArrayShape<T, TSerializable, 'result'>\n    : T extends TSerializable\n      ? T\n      : unknown extends SerializerExtensions['ReadableStream']\n        ? { [K in keyof T]: ValidateSerializableResult<T[K], TSerializable> }\n        : T extends SerializerExtensions['ReadableStream']\n          ? ReadableStream\n          : { [K in keyof T]: ValidateSerializableResult<T[K], TSerializable> }\n\nexport type RegisteredSSROption<TRegister> =\n  unknown extends RegisteredConfigType<TRegister, 'defaultSsr'>\n    ? SSROption\n    : RegisteredConfigType<TRegister, 'defaultSsr'>\n\nexport type ValidateSerializableLifecycleResult<\n  TRegister,\n  TParentRoute extends AnyRoute,\n  TSSR,\n  TFn,\n> =\n  false extends RegisteredSsr<TRegister>\n    ? any\n    : ValidateSerializableLifecycleResultSSR<\n          TRegister,\n          TParentRoute,\n          TSSR,\n          TFn\n        > extends infer TInput\n      ? TInput\n      : never\n\nexport type ValidateSerializableLifecycleResultSSR<\n  TRegister,\n  TParentRoute extends AnyRoute,\n  TSSR,\n  TFn,\n> =\n  ResolveAllSSR<TParentRoute, TSSR> extends false\n    ? any\n    : RegisteredSSROption<TRegister> extends false\n      ? any\n      : ValidateSerializableInput<TRegister, LooseReturnType<TFn>>\n\ntype ResolveArrayShape<\n  T extends ReadonlyArray<unknown>,\n  TSerializable,\n  TMode extends 'input' | 'result',\n> = number extends T['length']\n  ? T extends Array<infer U>\n    ? Array<ArrayModeResult<TMode, U, TSerializable>>\n    : ReadonlyArray<ArrayModeResult<TMode, T[number], TSerializable>>\n  : ResolveTupleShape<T, TSerializable, TMode>\n\ntype ResolveTupleShape<\n  T extends ReadonlyArray<unknown>,\n  TSerializable,\n  TMode extends 'input' | 'result',\n> = T extends readonly [infer THead, ...infer TTail]\n  ? readonly [\n      ArrayModeResult<TMode, THead, TSerializable>,\n      ...ResolveTupleShape<Readonly<TTail>, TSerializable, TMode>,\n    ]\n  : T\n\ntype ArrayModeResult<\n  TMode extends 'input' | 'result',\n  TValue,\n  TSerializable,\n> = TMode extends 'input'\n  ? ValidateSerializable<TValue, TSerializable>\n  : ValidateSerializableResult<TValue, TSerializable>\n"
  },
  {
    "path": "packages/router-core/src/ssr/server.ts",
    "content": "export { createRequestHandler } from './createRequestHandler'\nexport type { RequestHandler } from './createRequestHandler'\nexport { defineHandlerCallback } from './handlerCallback'\nexport type { HandlerCallback } from './handlerCallback'\nexport {\n  transformPipeableStreamWithRouter,\n  transformStreamWithRouter,\n  transformReadableStreamWithRouter,\n} from './transformStreamWithRouter'\nexport {\n  attachRouterServerSsrUtils,\n  getNormalizedURL,\n  getOrigin,\n} from './ssr-server'\n"
  },
  {
    "path": "packages/router-core/src/ssr/ssr-client.ts",
    "content": "import invariant from 'tiny-invariant'\nimport { isNotFound } from '../not-found'\nimport { createControlledPromise } from '../utils'\nimport { hydrateSsrMatchId } from './ssr-match-id'\nimport type { GLOBAL_SEROVAL, GLOBAL_TSR } from './constants'\nimport type { DehydratedMatch, TsrSsrGlobal } from './types'\nimport type { AnyRouteMatch } from '../Matches'\nimport type { AnyRouter } from '../router'\nimport type { RouteContextOptions } from '../route'\nimport type { AnySerializationAdapter } from './serializer/transformer'\n\ndeclare global {\n  interface Window {\n    [GLOBAL_TSR]?: TsrSsrGlobal\n    [GLOBAL_SEROVAL]?: any\n  }\n}\n\nfunction hydrateMatch(\n  match: AnyRouteMatch,\n  deyhydratedMatch: DehydratedMatch,\n): void {\n  match.id = deyhydratedMatch.i\n  match.__beforeLoadContext = deyhydratedMatch.b\n  match.loaderData = deyhydratedMatch.l\n  match.status = deyhydratedMatch.s\n  match.ssr = deyhydratedMatch.ssr\n  match.updatedAt = deyhydratedMatch.u\n  match.error = deyhydratedMatch.e\n  // Only hydrate global-not-found when a defined value is present in the\n  // dehydrated payload. If omitted, preserve the value computed from the\n  // current client location (important for SPA fallback HTML served at unknown\n  // URLs, where dehydrated matches may come from `/` but client matching marks\n  // root as globalNotFound).\n  if (deyhydratedMatch.g !== undefined) {\n    match.globalNotFound = deyhydratedMatch.g\n  }\n}\n\nexport async function hydrate(router: AnyRouter): Promise<any> {\n  invariant(\n    window.$_TSR,\n    'Expected to find bootstrap data on window.$_TSR, but we did not. Please file an issue!',\n  )\n\n  const serializationAdapters = router.options.serializationAdapters as\n    | Array<AnySerializationAdapter>\n    | undefined\n\n  if (serializationAdapters?.length) {\n    const fromSerializableMap = new Map()\n    serializationAdapters.forEach((adapter) => {\n      fromSerializableMap.set(adapter.key, adapter.fromSerializable)\n    })\n    window.$_TSR.t = fromSerializableMap\n    window.$_TSR.buffer.forEach((script) => script())\n  }\n  window.$_TSR.initialized = true\n\n  invariant(\n    window.$_TSR.router,\n    'Expected to find a dehydrated data on window.$_TSR.router, but we did not. Please file an issue!',\n  )\n\n  const dehydratedRouter = window.$_TSR.router\n  dehydratedRouter.matches.forEach((dehydratedMatch) => {\n    dehydratedMatch.i = hydrateSsrMatchId(dehydratedMatch.i)\n  })\n  if (dehydratedRouter.lastMatchId) {\n    dehydratedRouter.lastMatchId = hydrateSsrMatchId(\n      dehydratedRouter.lastMatchId,\n    )\n  }\n  const { manifest, dehydratedData, lastMatchId } = dehydratedRouter\n\n  router.ssr = {\n    manifest,\n  }\n  const meta = document.querySelector('meta[property=\"csp-nonce\"]') as\n    | HTMLMetaElement\n    | undefined\n  const nonce = meta?.content\n  router.options.ssr = {\n    nonce,\n  }\n\n  // Hydrate the router state\n  const matches = router.matchRoutes(router.stores.location.state)\n\n  // kick off loading the route chunks\n  const routeChunkPromise = Promise.all(\n    matches.map((match) =>\n      router.loadRouteChunk(router.looseRoutesById[match.routeId]!),\n    ),\n  )\n\n  function setMatchForcePending(match: AnyRouteMatch) {\n    // usually the minPendingPromise is created in the Match component if a pending match is rendered\n    // however, this might be too late if the match synchronously resolves\n    const route = router.looseRoutesById[match.routeId]!\n    const pendingMinMs =\n      route.options.pendingMinMs ?? router.options.defaultPendingMinMs\n    if (pendingMinMs) {\n      const minPendingPromise = createControlledPromise<void>()\n      match._nonReactive.minPendingPromise = minPendingPromise\n      match._forcePending = true\n\n      setTimeout(() => {\n        minPendingPromise.resolve()\n        // We've handled the minPendingPromise, so we can delete it\n        router.updateMatch(match.id, (prev) => {\n          prev._nonReactive.minPendingPromise = undefined\n          return {\n            ...prev,\n            _forcePending: undefined,\n          }\n        })\n      }, pendingMinMs)\n    }\n  }\n\n  function setRouteSsr(match: AnyRouteMatch) {\n    const route = router.looseRoutesById[match.routeId]\n    if (route) {\n      route.options.ssr = match.ssr\n    }\n  }\n  // Right after hydration and before the first render, we need to rehydrate each match\n  // First step is to reyhdrate loaderData and __beforeLoadContext\n  let firstNonSsrMatchIndex: number | undefined = undefined\n  matches.forEach((match) => {\n    const dehydratedMatch = dehydratedRouter.matches.find(\n      (d) => d.i === match.id,\n    )\n    if (!dehydratedMatch) {\n      match._nonReactive.dehydrated = false\n      match.ssr = false\n      setRouteSsr(match)\n      return\n    }\n\n    hydrateMatch(match, dehydratedMatch)\n    setRouteSsr(match)\n\n    match._nonReactive.dehydrated = match.ssr !== false\n\n    if (match.ssr === 'data-only' || match.ssr === false) {\n      if (firstNonSsrMatchIndex === undefined) {\n        firstNonSsrMatchIndex = match.index\n        setMatchForcePending(match)\n      }\n    }\n  })\n\n  router.stores.setActiveMatches(matches)\n\n  // Allow the user to handle custom hydration data\n  await router.options.hydrate?.(dehydratedData)\n\n  // now that all necessary data is hydrated:\n  // 1) fully reconstruct the route context\n  // 2) execute `head()` and `scripts()` for each match\n  const activeMatches = router.stores.activeMatchesSnapshot.state\n  const location = router.stores.location.state\n  await Promise.all(\n    activeMatches.map(async (match) => {\n      try {\n        const route = router.looseRoutesById[match.routeId]!\n\n        const parentMatch = activeMatches[match.index - 1]\n        const parentContext = parentMatch?.context ?? router.options.context\n\n        // `context()` was already executed by `matchRoutes`, however route context was not yet fully reconstructed\n        // so run it again and merge route context\n        if (route.options.context) {\n          const contextFnContext: RouteContextOptions<any, any, any, any, any> =\n            {\n              deps: match.loaderDeps,\n              params: match.params,\n              context: parentContext ?? {},\n              location,\n              navigate: (opts: any) =>\n                router.navigate({\n                  ...opts,\n                  _fromLocation: location,\n                }),\n              buildLocation: router.buildLocation,\n              cause: match.cause,\n              abortController: match.abortController,\n              preload: false,\n              matches,\n              routeId: route.id,\n            }\n          match.__routeContext =\n            route.options.context(contextFnContext) ?? undefined\n        }\n\n        match.context = {\n          ...parentContext,\n          ...match.__routeContext,\n          ...match.__beforeLoadContext,\n        }\n\n        const assetContext = {\n          ssr: router.options.ssr,\n          matches: activeMatches,\n          match,\n          params: match.params,\n          loaderData: match.loaderData,\n        }\n        const headFnContent = await route.options.head?.(assetContext)\n\n        const scripts = await route.options.scripts?.(assetContext)\n\n        match.meta = headFnContent?.meta\n        match.links = headFnContent?.links\n        match.headScripts = headFnContent?.scripts\n        match.styles = headFnContent?.styles\n        match.scripts = scripts\n      } catch (err) {\n        if (isNotFound(err)) {\n          match.error = { isNotFound: true }\n          console.error(\n            `NotFound error during hydration for routeId: ${match.routeId}`,\n            err,\n          )\n        } else {\n          match.error = err as any\n          console.error(\n            `Error during hydration for route ${match.routeId}:`,\n            err,\n          )\n          throw err\n        }\n      }\n    }),\n  )\n\n  const isSpaMode = matches[matches.length - 1]!.id !== lastMatchId\n  const hasSsrFalseMatches = matches.some((m) => m.ssr === false)\n  // all matches have data from the server and we are not in SPA mode so we don't need to kick of router.load()\n  if (!hasSsrFalseMatches && !isSpaMode) {\n    matches.forEach((match) => {\n      // remove the dehydrated flag since we won't run router.load() which would remove it\n      match._nonReactive.dehydrated = undefined\n    })\n    return routeChunkPromise\n  }\n\n  // schedule router.load() to run after the next tick so we can store the promise in the match before loading starts\n  const loadPromise = Promise.resolve()\n    .then(() => router.load())\n    .catch((err) => {\n      console.error('Error during router hydration:', err)\n    })\n\n  // in SPA mode we need to keep the first match below the root route pending until router.load() is finished\n  // this will prevent that other pending components are rendered but hydration is not blocked\n  if (isSpaMode) {\n    const match = matches[1]\n    invariant(\n      match,\n      'Expected to find a match below the root match in SPA mode.',\n    )\n    setMatchForcePending(match)\n\n    match._displayPending = true\n    match._nonReactive.displayPendingPromise = loadPromise\n\n    loadPromise.then(() => {\n      router.batch(() => {\n        // ensure router is not in status 'pending' anymore\n        // this usually happens in Transitioner but if loading synchronously resolves,\n        // Transitioner won't be rendered while loading so it cannot track the change from loading:true to loading:false\n        if (router.stores.status.state === 'pending') {\n          router.batch(() => {\n            router.stores.status.setState(() => 'idle')\n            router.stores.resolvedLocation.setState(\n              () => router.stores.location.state,\n            )\n          })\n        }\n        // hide the pending component once the load is finished\n        router.updateMatch(match.id, (prev) => ({\n          ...prev,\n          _displayPending: undefined,\n          displayPendingPromise: undefined,\n        }))\n      })\n    })\n  }\n  return routeChunkPromise\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/ssr-match-id.ts",
    "content": "export function dehydrateSsrMatchId(id: string): string {\n  return id.replaceAll('/', '\\0')\n}\n\nexport function hydrateSsrMatchId(id: string): string {\n  return id.replaceAll('\\0', '/').replaceAll('\\uFFFD', '/')\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/ssr-server.ts",
    "content": "import { crossSerializeStream, getCrossReferenceHeader } from 'seroval'\nimport invariant from 'tiny-invariant'\nimport { decodePath } from '../utils'\nimport { createLRUCache } from '../lru-cache'\nimport minifiedTsrBootStrapScript from './tsrScript?script-string'\nimport { GLOBAL_TSR, TSR_SCRIPT_BARRIER_ID } from './constants'\nimport { dehydrateSsrMatchId } from './ssr-match-id'\nimport { defaultSerovalPlugins } from './serializer/seroval-plugins'\nimport { makeSsrSerovalPlugin } from './serializer/transformer'\nimport type { LRUCache } from '../lru-cache'\nimport type { DehydratedMatch, DehydratedRouter } from './types'\nimport type { AnySerializationAdapter } from './serializer/transformer'\nimport type { AnyRouter } from '../router'\nimport type { AnyRouteMatch } from '../Matches'\nimport type { Manifest, RouterManagedTag } from '../manifest'\n\ndeclare module '../router' {\n  interface ServerSsr {\n    setRenderFinished: () => void\n    cleanup: () => void\n  }\n  interface RouterEvents {\n    onInjectedHtml: {\n      type: 'onInjectedHtml'\n    }\n    onSerializationFinished: {\n      type: 'onSerializationFinished'\n    }\n  }\n}\n\nconst SCOPE_ID = 'tsr'\n\nconst TSR_PREFIX = GLOBAL_TSR + '.router='\nconst P_PREFIX = GLOBAL_TSR + '.p(()=>'\nconst P_SUFFIX = ')'\n\nexport function dehydrateMatch(match: AnyRouteMatch): DehydratedMatch {\n  const dehydratedMatch: DehydratedMatch = {\n    i: dehydrateSsrMatchId(match.id),\n    u: match.updatedAt,\n    s: match.status,\n  }\n\n  const properties = [\n    ['__beforeLoadContext', 'b'],\n    ['loaderData', 'l'],\n    ['error', 'e'],\n    ['ssr', 'ssr'],\n  ] as const\n\n  for (const [key, shorthand] of properties) {\n    if (match[key] !== undefined) {\n      dehydratedMatch[shorthand] = match[key]\n    }\n  }\n  if (match.globalNotFound) {\n    dehydratedMatch.g = true\n  }\n  return dehydratedMatch\n}\n\nconst INITIAL_SCRIPTS = [\n  getCrossReferenceHeader(SCOPE_ID),\n  minifiedTsrBootStrapScript,\n]\n\nclass ScriptBuffer {\n  private router: AnyRouter | undefined\n  private _queue: Array<string>\n  private _scriptBarrierLifted = false\n  private _cleanedUp = false\n  private _pendingMicrotask = false\n\n  constructor(router: AnyRouter) {\n    this.router = router\n    // Copy INITIAL_SCRIPTS to avoid mutating the shared array\n    this._queue = INITIAL_SCRIPTS.slice()\n  }\n\n  enqueue(script: string) {\n    if (this._cleanedUp) return\n    this._queue.push(script)\n    // If barrier is lifted, schedule injection (if not already scheduled)\n    if (this._scriptBarrierLifted && !this._pendingMicrotask) {\n      this._pendingMicrotask = true\n      queueMicrotask(() => {\n        this._pendingMicrotask = false\n        this.injectBufferedScripts()\n      })\n    }\n  }\n\n  liftBarrier() {\n    if (this._scriptBarrierLifted || this._cleanedUp) return\n    this._scriptBarrierLifted = true\n    if (this._queue.length > 0 && !this._pendingMicrotask) {\n      this._pendingMicrotask = true\n      queueMicrotask(() => {\n        this._pendingMicrotask = false\n        this.injectBufferedScripts()\n      })\n    }\n  }\n\n  /**\n   * Flushes any pending scripts synchronously.\n   * Call this before emitting onSerializationFinished to ensure all scripts are injected.\n   *\n   * IMPORTANT: Only injects if the barrier has been lifted. Before the barrier is lifted,\n   * scripts should remain in the queue so takeBufferedScripts() can retrieve them\n   */\n  flush() {\n    if (!this._scriptBarrierLifted) return\n    if (this._cleanedUp) return\n    this._pendingMicrotask = false\n    const scriptsToInject = this.takeAll()\n    if (scriptsToInject && this.router?.serverSsr) {\n      this.router.serverSsr.injectScript(scriptsToInject)\n    }\n  }\n\n  takeAll() {\n    const bufferedScripts = this._queue\n    this._queue = []\n    if (bufferedScripts.length === 0) {\n      return undefined\n    }\n    // Optimization: if only one script, avoid join\n    if (bufferedScripts.length === 1) {\n      return bufferedScripts[0] + ';document.currentScript.remove()'\n    }\n    // Append cleanup script and join - avoid push() to not mutate then iterate\n    return bufferedScripts.join(';') + ';document.currentScript.remove()'\n  }\n\n  injectBufferedScripts() {\n    if (this._cleanedUp) return\n    // Early return if queue is empty (avoids unnecessary takeAll() call)\n    if (this._queue.length === 0) return\n    const scriptsToInject = this.takeAll()\n    if (scriptsToInject && this.router?.serverSsr) {\n      this.router.serverSsr.injectScript(scriptsToInject)\n    }\n  }\n\n  cleanup() {\n    this._cleanedUp = true\n    this._queue = []\n    this.router = undefined\n  }\n}\n\nconst isProd = process.env.NODE_ENV === 'production'\n\ntype FilteredRoutes = Manifest['routes']\n\ntype ManifestLRU = LRUCache<string, FilteredRoutes>\n\nconst MANIFEST_CACHE_SIZE = 100\nconst manifestCaches = new WeakMap<Manifest, ManifestLRU>()\n\nfunction getManifestCache(manifest: Manifest): ManifestLRU {\n  const cache = manifestCaches.get(manifest)\n  if (cache) return cache\n  const newCache = createLRUCache<string, FilteredRoutes>(MANIFEST_CACHE_SIZE)\n  manifestCaches.set(manifest, newCache)\n  return newCache\n}\n\nexport function attachRouterServerSsrUtils({\n  router,\n  manifest,\n}: {\n  router: AnyRouter\n  manifest: Manifest | undefined\n}) {\n  router.ssr = {\n    manifest,\n  }\n  let _dehydrated = false\n  let _serializationFinished = false\n  const renderFinishedListeners: Array<() => void> = []\n  const serializationFinishedListeners: Array<() => void> = []\n  const scriptBuffer = new ScriptBuffer(router)\n  let injectedHtmlBuffer = ''\n\n  router.serverSsr = {\n    injectHtml: (html: string) => {\n      if (!html) return\n      // Buffer the HTML so it can be retrieved via takeBufferedHtml()\n      injectedHtmlBuffer += html\n      // Emit event to notify subscribers that new HTML is available\n      router.emit({\n        type: 'onInjectedHtml',\n      })\n    },\n    injectScript: (script: string) => {\n      if (!script) return\n      const html = `<script${router.options.ssr?.nonce ? ` nonce='${router.options.ssr.nonce}'` : ''}>${script}</script>`\n      router.serverSsr!.injectHtml(html)\n    },\n    dehydrate: async () => {\n      invariant(!_dehydrated, 'router is already dehydrated!')\n      let matchesToDehydrate = router.stores.activeMatchesSnapshot.state\n      if (router.isShell()) {\n        // In SPA mode we only want to dehydrate the root match\n        matchesToDehydrate = matchesToDehydrate.slice(0, 1)\n      }\n      const matches = matchesToDehydrate.map(dehydrateMatch)\n\n      let manifestToDehydrate: Manifest | undefined = undefined\n      // For currently matched routes, send full manifest (preloads + assets)\n      // For all other routes, only send assets (no preloads as they are handled via dynamic imports)\n      if (manifest) {\n        // Prod-only caching; in dev manifests may be replaced/updated (HMR)\n        const currentRouteIdsList = matchesToDehydrate.map((m) => m.routeId)\n        const manifestCacheKey = currentRouteIdsList.join('\\0')\n\n        let filteredRoutes: FilteredRoutes | undefined\n\n        if (isProd) {\n          filteredRoutes = getManifestCache(manifest).get(manifestCacheKey)\n        }\n\n        if (!filteredRoutes) {\n          const currentRouteIds = new Set(currentRouteIdsList)\n          const nextFilteredRoutes: FilteredRoutes = {}\n\n          for (const routeId in manifest.routes) {\n            const routeManifest = manifest.routes[routeId]!\n            if (currentRouteIds.has(routeId)) {\n              nextFilteredRoutes[routeId] = routeManifest\n            } else if (\n              routeManifest.assets &&\n              routeManifest.assets.length > 0\n            ) {\n              nextFilteredRoutes[routeId] = {\n                assets: routeManifest.assets,\n              }\n            }\n          }\n\n          if (isProd) {\n            getManifestCache(manifest).set(manifestCacheKey, nextFilteredRoutes)\n          }\n\n          filteredRoutes = nextFilteredRoutes\n        }\n\n        manifestToDehydrate = {\n          routes: filteredRoutes,\n        }\n      }\n      const dehydratedRouter: DehydratedRouter = {\n        manifest: manifestToDehydrate,\n        matches,\n      }\n      const lastMatchId = matchesToDehydrate[matchesToDehydrate.length - 1]?.id\n      if (lastMatchId) {\n        dehydratedRouter.lastMatchId = dehydrateSsrMatchId(lastMatchId)\n      }\n      const dehydratedData = await router.options.dehydrate?.()\n      if (dehydratedData) {\n        dehydratedRouter.dehydratedData = dehydratedData\n      }\n      _dehydrated = true\n\n      const trackPlugins = { didRun: false }\n      const serializationAdapters = router.options.serializationAdapters as\n        | Array<AnySerializationAdapter>\n        | undefined\n      const plugins = serializationAdapters\n        ? serializationAdapters\n            .map((t) => makeSsrSerovalPlugin(t, trackPlugins))\n            .concat(defaultSerovalPlugins)\n        : defaultSerovalPlugins\n\n      const signalSerializationComplete = () => {\n        _serializationFinished = true\n        try {\n          serializationFinishedListeners.forEach((l) => l())\n          router.emit({ type: 'onSerializationFinished' })\n        } catch (err) {\n          console.error('Serialization listener error:', err)\n        } finally {\n          serializationFinishedListeners.length = 0\n          renderFinishedListeners.length = 0\n        }\n      }\n\n      crossSerializeStream(dehydratedRouter, {\n        refs: new Map(),\n        plugins,\n        onSerialize: (data, initial) => {\n          let serialized = initial ? TSR_PREFIX + data : data\n          if (trackPlugins.didRun) {\n            serialized = P_PREFIX + serialized + P_SUFFIX\n          }\n          scriptBuffer.enqueue(serialized)\n        },\n        scopeId: SCOPE_ID,\n        onDone: () => {\n          scriptBuffer.enqueue(GLOBAL_TSR + '.e()')\n          // Flush all pending scripts synchronously before signaling completion\n          // This ensures all scripts are injected before onSerializationFinished is emitted\n          scriptBuffer.flush()\n          signalSerializationComplete()\n        },\n        onError: (err) => {\n          console.error('Serialization error:', err)\n          signalSerializationComplete()\n        },\n      })\n    },\n    isDehydrated() {\n      return _dehydrated\n    },\n    isSerializationFinished() {\n      return _serializationFinished\n    },\n    onRenderFinished: (listener) => renderFinishedListeners.push(listener),\n    onSerializationFinished: (listener) =>\n      serializationFinishedListeners.push(listener),\n    setRenderFinished: () => {\n      // Wrap in try-catch to ensure scriptBuffer.liftBarrier() is always called\n      try {\n        renderFinishedListeners.forEach((l) => l())\n      } catch (err) {\n        console.error('Error in render finished listener:', err)\n      } finally {\n        // Clear listeners after calling them to prevent memory leaks\n        renderFinishedListeners.length = 0\n      }\n      scriptBuffer.liftBarrier()\n    },\n    takeBufferedScripts() {\n      const scripts = scriptBuffer.takeAll()\n      const serverBufferedScript: RouterManagedTag = {\n        tag: 'script',\n        attrs: {\n          nonce: router.options.ssr?.nonce,\n          className: '$tsr',\n          id: TSR_SCRIPT_BARRIER_ID,\n        },\n        children: scripts,\n      }\n      return serverBufferedScript\n    },\n    liftScriptBarrier() {\n      scriptBuffer.liftBarrier()\n    },\n    takeBufferedHtml() {\n      if (!injectedHtmlBuffer) {\n        return undefined\n      }\n      const buffered = injectedHtmlBuffer\n      injectedHtmlBuffer = ''\n      return buffered\n    },\n    cleanup() {\n      // Guard against multiple cleanup calls\n      if (!router.serverSsr) return\n      renderFinishedListeners.length = 0\n      serializationFinishedListeners.length = 0\n      injectedHtmlBuffer = ''\n      scriptBuffer.cleanup()\n      router.serverSsr = undefined\n    },\n  }\n}\n\n/**\n * Get the origin for the request.\n *\n * SECURITY: We intentionally do NOT trust the Origin header for determining\n * the router's origin. The Origin header can be spoofed by attackers, which\n * could lead to SSRF-like vulnerabilities where redirects are constructed\n * using a malicious origin (CVE-2024-34351).\n *\n * Instead, we derive the origin from request.url, which is typically set by\n * the server infrastructure (not client-controlled headers).\n *\n * For applications behind proxies that need to trust forwarded headers,\n * use the router's `origin` option to explicitly configure a trusted origin.\n */\nexport function getOrigin(request: Request) {\n  try {\n    return new URL(request.url).origin\n  } catch {}\n  return 'http://localhost'\n}\n\n// server and browser can decode/encode characters differently in paths and search params.\n// Server generally strictly follows the WHATWG URL Standard, while browsers may differ for legacy reasons.\n// for example, in paths \"|\" is not encoded on the server but is encoded on chromium (and not on firefox) while \"대\" is encoded on both sides.\n// Another anomaly is that in Node new URLSearchParams and new URL also decode/encode characters differently.\n// new URLSearchParams() encodes \"|\" while new URL() does not, and in this instance\n// chromium treats search params differently than paths, i.e. \"|\" is not encoded in search params.\nexport function getNormalizedURL(url: string | URL, base?: string | URL) {\n  // ensure backslashes are encoded correctly in the URL\n  if (typeof url === 'string') url = url.replace('\\\\', '%5C')\n\n  const rawUrl = new URL(url, base)\n  const { path: decodedPathname, handledProtocolRelativeURL } = decodePath(\n    rawUrl.pathname,\n  )\n  const searchParams = new URLSearchParams(rawUrl.search)\n  const normalizedHref =\n    decodedPathname +\n    (searchParams.size > 0 ? '?' : '') +\n    searchParams.toString() +\n    rawUrl.hash\n\n  return {\n    url: new URL(normalizedHref, rawUrl.origin),\n    handledProtocolRelativeURL,\n  }\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/transformStreamWithRouter.ts",
    "content": "import { ReadableStream } from 'node:stream/web'\nimport { Readable } from 'node:stream'\nimport { TSR_SCRIPT_BARRIER_ID } from './constants'\nimport type { AnyRouter } from '../router'\n\nexport function transformReadableStreamWithRouter(\n  router: AnyRouter,\n  routerStream: ReadableStream,\n) {\n  return transformStreamWithRouter(router, routerStream)\n}\n\nexport function transformPipeableStreamWithRouter(\n  router: AnyRouter,\n  routerStream: Readable,\n) {\n  return Readable.fromWeb(\n    transformStreamWithRouter(router, Readable.toWeb(routerStream)),\n  )\n}\n\n// Use string constants for simple indexOf matching\nconst BODY_END_TAG = '</body>'\nconst HTML_END_TAG = '</html>'\n\n// Minimum length of a valid closing tag: </a> = 4 characters\nconst MIN_CLOSING_TAG_LENGTH = 4\n\n// Default timeout values (in milliseconds)\nconst DEFAULT_SERIALIZATION_TIMEOUT_MS = 60000\nconst DEFAULT_LIFETIME_TIMEOUT_MS = 60000\n\n// Module-level encoder (stateless, safe to reuse)\nconst textEncoder = new TextEncoder()\n\n/**\n * Finds the position just after the last valid HTML closing tag in the string.\n *\n * Valid closing tags match the pattern: </[a-zA-Z][\\w:.-]*>\n * Examples: </div>, </my-component>, </slot:name.nested>\n *\n * @returns Position after the last closing tag, or -1 if none found\n */\nfunction findLastClosingTagEnd(str: string): number {\n  const len = str.length\n  if (len < MIN_CLOSING_TAG_LENGTH) return -1\n\n  let i = len - 1\n\n  while (i >= MIN_CLOSING_TAG_LENGTH - 1) {\n    // Look for > (charCode 62)\n    if (str.charCodeAt(i) === 62) {\n      // Look backwards for valid tag name characters\n      let j = i - 1\n\n      // Skip through valid tag name characters\n      while (j >= 1) {\n        const code = str.charCodeAt(j)\n        // Check if it's a valid tag name char: [a-zA-Z0-9_:.-]\n        if (\n          (code >= 97 && code <= 122) || // a-z\n          (code >= 65 && code <= 90) || // A-Z\n          (code >= 48 && code <= 57) || // 0-9\n          code === 95 || // _\n          code === 58 || // :\n          code === 46 || // .\n          code === 45 // -\n        ) {\n          j--\n        } else {\n          break\n        }\n      }\n\n      // Check if the first char after </ is a valid start char (letter only)\n      const tagNameStart = j + 1\n      if (tagNameStart < i) {\n        const startCode = str.charCodeAt(tagNameStart)\n        // Tag name must start with a letter (a-z or A-Z)\n        if (\n          (startCode >= 97 && startCode <= 122) ||\n          (startCode >= 65 && startCode <= 90)\n        ) {\n          // Check for </ (charCodes: < = 60, / = 47)\n          if (\n            j >= 1 &&\n            str.charCodeAt(j) === 47 &&\n            str.charCodeAt(j - 1) === 60\n          ) {\n            return i + 1 // Return position after the closing >\n          }\n        }\n      }\n    }\n    i--\n  }\n  return -1\n}\n\nexport function transformStreamWithRouter(\n  router: AnyRouter,\n  appStream: ReadableStream,\n  opts?: {\n    /** Timeout for serialization to complete after app render finishes (default: 60000ms) */\n    timeoutMs?: number\n    /** Maximum lifetime of the stream transform (default: 60000ms). Safety net for cleanup. */\n    lifetimeMs?: number\n  },\n) {\n  // Check upfront if serialization already finished synchronously\n  // This is the fast path for routes with no deferred data\n  const serializationAlreadyFinished =\n    router.serverSsr?.isSerializationFinished() ?? false\n\n  // Take any HTML that was buffered before we started listening\n  const initialBufferedHtml = router.serverSsr?.takeBufferedHtml()\n\n  // True passthrough: if serialization already finished and nothing buffered,\n  // we can avoid any decoding/scanning while still honoring cleanup + setRenderFinished.\n  if (serializationAlreadyFinished && !initialBufferedHtml) {\n    let cleanedUp = false\n    let controller: ReadableStreamDefaultController<Uint8Array> | undefined\n    let isStreamClosed = false\n    let lifetimeTimeoutHandle: ReturnType<typeof setTimeout> | undefined\n\n    const cleanup = () => {\n      if (cleanedUp) return\n      cleanedUp = true\n\n      if (lifetimeTimeoutHandle !== undefined) {\n        clearTimeout(lifetimeTimeoutHandle)\n        lifetimeTimeoutHandle = undefined\n      }\n\n      router.serverSsr?.cleanup()\n    }\n\n    const safeClose = () => {\n      if (isStreamClosed) return\n      isStreamClosed = true\n      try {\n        controller?.close()\n      } catch {\n        // ignore\n      }\n    }\n\n    const safeError = (error: unknown) => {\n      if (isStreamClosed) return\n      isStreamClosed = true\n      try {\n        controller?.error(error)\n      } catch {\n        // ignore\n      }\n    }\n\n    const lifetimeMs = opts?.lifetimeMs ?? DEFAULT_LIFETIME_TIMEOUT_MS\n    lifetimeTimeoutHandle = setTimeout(() => {\n      if (!cleanedUp && !isStreamClosed) {\n        console.warn(\n          `SSR stream transform exceeded maximum lifetime (${lifetimeMs}ms), forcing cleanup`,\n        )\n        safeError(new Error('Stream lifetime exceeded'))\n        cleanup()\n      }\n    }, lifetimeMs)\n\n    const stream = new ReadableStream<Uint8Array>({\n      start(c) {\n        controller = c\n      },\n      cancel() {\n        isStreamClosed = true\n        cleanup()\n      },\n    })\n\n    ;(async () => {\n      const reader = appStream.getReader()\n      try {\n        while (true) {\n          const { done, value } = await reader.read()\n          if (done) break\n          if (cleanedUp || isStreamClosed) return\n          controller?.enqueue(value as unknown as Uint8Array)\n        }\n\n        if (cleanedUp || isStreamClosed) return\n\n        router.serverSsr?.setRenderFinished()\n        safeClose()\n        cleanup()\n      } catch (error) {\n        if (cleanedUp) return\n        console.error('Error reading appStream:', error)\n        router.serverSsr?.setRenderFinished()\n        safeError(error)\n        cleanup()\n      } finally {\n        reader.releaseLock()\n      }\n    })().catch((error) => {\n      if (cleanedUp) return\n      console.error('Error in stream transform:', error)\n      safeError(error)\n      cleanup()\n    })\n\n    return stream\n  }\n\n  let stopListeningToInjectedHtml: (() => void) | undefined\n  let stopListeningToSerializationFinished: (() => void) | undefined\n  let serializationTimeoutHandle: ReturnType<typeof setTimeout> | undefined\n  let lifetimeTimeoutHandle: ReturnType<typeof setTimeout> | undefined\n  let cleanedUp = false\n\n  let controller: ReadableStreamDefaultController<any>\n  let isStreamClosed = false\n\n  const textDecoder = new TextDecoder()\n\n  // concat'd router HTML; avoids array joins on each flush\n  let pendingRouterHtml = initialBufferedHtml ?? ''\n\n  // between-chunk text buffer; keep bounded to avoid unbounded memory\n  let leftover = ''\n\n  // captured closing tags from </body> onward\n  let pendingClosingTags = ''\n\n  // conservative cap: enough to hold any partial closing tag + a bit\n  const MAX_LEFTOVER_CHARS = 2048\n\n  let isAppRendering = true\n  let streamBarrierLifted = false\n  let serializationFinished = serializationAlreadyFinished\n\n  function safeEnqueue(chunk: string | Uint8Array) {\n    if (isStreamClosed) return\n    if (typeof chunk === 'string') {\n      controller.enqueue(textEncoder.encode(chunk))\n    } else {\n      controller.enqueue(chunk)\n    }\n  }\n\n  function safeClose() {\n    if (isStreamClosed) return\n    isStreamClosed = true\n    try {\n      controller.close()\n    } catch {\n      // ignore\n    }\n  }\n\n  function safeError(error: unknown) {\n    if (isStreamClosed) return\n    isStreamClosed = true\n    try {\n      controller.error(error)\n    } catch {\n      // ignore\n    }\n  }\n\n  /**\n   * Cleanup with guards; must be idempotent.\n   */\n  function cleanup() {\n    if (cleanedUp) return\n    cleanedUp = true\n\n    try {\n      stopListeningToInjectedHtml?.()\n      stopListeningToSerializationFinished?.()\n    } catch {\n      // ignore\n    }\n    stopListeningToInjectedHtml = undefined\n    stopListeningToSerializationFinished = undefined\n\n    if (serializationTimeoutHandle !== undefined) {\n      clearTimeout(serializationTimeoutHandle)\n      serializationTimeoutHandle = undefined\n    }\n    if (lifetimeTimeoutHandle !== undefined) {\n      clearTimeout(lifetimeTimeoutHandle)\n      lifetimeTimeoutHandle = undefined\n    }\n\n    pendingRouterHtml = ''\n    leftover = ''\n    pendingClosingTags = ''\n\n    router.serverSsr?.cleanup()\n  }\n\n  const stream = new ReadableStream({\n    start(c) {\n      controller = c\n    },\n    cancel() {\n      isStreamClosed = true\n      cleanup()\n    },\n  })\n\n  function flushPendingRouterHtml() {\n    if (!pendingRouterHtml) return\n    safeEnqueue(pendingRouterHtml)\n    pendingRouterHtml = ''\n  }\n\n  function appendRouterHtml(html: string) {\n    if (!html) return\n    pendingRouterHtml += html\n  }\n\n  /**\n   * Finish only when app done and serialization complete.\n   */\n  function tryFinish() {\n    if (isAppRendering || !serializationFinished) return\n    if (cleanedUp || isStreamClosed) return\n\n    if (serializationTimeoutHandle !== undefined) {\n      clearTimeout(serializationTimeoutHandle)\n      serializationTimeoutHandle = undefined\n    }\n\n    // Flush any remaining bytes in the TextDecoder\n    const decoderRemainder = textDecoder.decode()\n\n    if (leftover) safeEnqueue(leftover)\n    if (decoderRemainder) safeEnqueue(decoderRemainder)\n    flushPendingRouterHtml()\n    if (pendingClosingTags) safeEnqueue(pendingClosingTags)\n\n    safeClose()\n    cleanup()\n  }\n\n  // Safety net: cleanup even if consumer never reads\n  const lifetimeMs = opts?.lifetimeMs ?? DEFAULT_LIFETIME_TIMEOUT_MS\n  lifetimeTimeoutHandle = setTimeout(() => {\n    if (!cleanedUp && !isStreamClosed) {\n      console.warn(\n        `SSR stream transform exceeded maximum lifetime (${lifetimeMs}ms), forcing cleanup`,\n      )\n      safeError(new Error('Stream lifetime exceeded'))\n      cleanup()\n    }\n  }, lifetimeMs)\n\n  if (!serializationAlreadyFinished) {\n    stopListeningToInjectedHtml = router.subscribe('onInjectedHtml', () => {\n      if (cleanedUp || isStreamClosed) return\n      const html = router.serverSsr?.takeBufferedHtml()\n      if (!html) return\n\n      // If we've already captured </body> (pendingClosingTags), we must keep appending\n      // so injection stays before the stored closing tags.\n      if (isAppRendering || leftover || pendingClosingTags) {\n        appendRouterHtml(html)\n      } else {\n        safeEnqueue(html)\n      }\n    })\n\n    stopListeningToSerializationFinished = router.subscribe(\n      'onSerializationFinished',\n      () => {\n        serializationFinished = true\n        tryFinish()\n      },\n    )\n  }\n\n  // Transform the appStream\n  ;(async () => {\n    const reader = appStream.getReader()\n    try {\n      while (true) {\n        const { done, value } = await reader.read()\n        if (done) break\n\n        if (cleanedUp || isStreamClosed) return\n\n        const text =\n          value instanceof Uint8Array\n            ? textDecoder.decode(value, { stream: true })\n            : String(value)\n\n        // Fast path: most chunks have no pending left-over.\n        const chunkString = leftover ? leftover + text : text\n\n        if (!streamBarrierLifted) {\n          if (chunkString.includes(TSR_SCRIPT_BARRIER_ID)) {\n            streamBarrierLifted = true\n            router.serverSsr?.liftScriptBarrier()\n          }\n        }\n\n        // If we already saw </body>, everything else is part of tail; buffer it.\n        if (pendingClosingTags) {\n          pendingClosingTags += chunkString\n          leftover = ''\n          continue\n        }\n\n        const bodyEndIndex = chunkString.indexOf(BODY_END_TAG)\n        const htmlEndIndex = chunkString.indexOf(HTML_END_TAG)\n\n        if (\n          bodyEndIndex !== -1 &&\n          htmlEndIndex !== -1 &&\n          bodyEndIndex < htmlEndIndex\n        ) {\n          pendingClosingTags = chunkString.slice(bodyEndIndex)\n          safeEnqueue(chunkString.slice(0, bodyEndIndex))\n          flushPendingRouterHtml()\n          leftover = ''\n          continue\n        }\n\n        const lastClosingTagEnd = findLastClosingTagEnd(chunkString)\n\n        if (lastClosingTagEnd > 0) {\n          safeEnqueue(chunkString.slice(0, lastClosingTagEnd))\n          flushPendingRouterHtml()\n\n          leftover = chunkString.slice(lastClosingTagEnd)\n          if (leftover.length > MAX_LEFTOVER_CHARS) {\n            // Ensure bounded memory even if a consumer streams long text sequences\n            // without any closing tags. This may reduce injection granularity but is correct.\n            safeEnqueue(leftover.slice(0, leftover.length - MAX_LEFTOVER_CHARS))\n            leftover = leftover.slice(-MAX_LEFTOVER_CHARS)\n          }\n        } else {\n          // No closing tag found; keep small tail to handle split closing tags,\n          // but stream older bytes to prevent unbounded buffering.\n          const combined = chunkString\n          if (combined.length > MAX_LEFTOVER_CHARS) {\n            const flushUpto = combined.length - MAX_LEFTOVER_CHARS\n            safeEnqueue(combined.slice(0, flushUpto))\n            leftover = combined.slice(flushUpto)\n          } else {\n            leftover = combined\n          }\n        }\n      }\n\n      if (cleanedUp || isStreamClosed) return\n\n      isAppRendering = false\n      router.serverSsr?.setRenderFinished()\n\n      if (serializationFinished) {\n        tryFinish()\n      } else {\n        const timeoutMs = opts?.timeoutMs ?? DEFAULT_SERIALIZATION_TIMEOUT_MS\n        serializationTimeoutHandle = setTimeout(() => {\n          if (!cleanedUp && !isStreamClosed) {\n            console.error('Serialization timeout after app render finished')\n            safeError(\n              new Error('Serialization timeout after app render finished'),\n            )\n            cleanup()\n          }\n        }, timeoutMs)\n      }\n    } catch (error) {\n      if (cleanedUp) return\n      console.error('Error reading appStream:', error)\n      isAppRendering = false\n      router.serverSsr?.setRenderFinished()\n      safeError(error)\n      cleanup()\n    } finally {\n      reader.releaseLock()\n    }\n  })().catch((error) => {\n    if (cleanedUp) return\n    console.error('Error in stream transform:', error)\n    safeError(error)\n    cleanup()\n  })\n\n  return stream\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/tsrScript.ts",
    "content": "self.$_TSR = {\n  h() {\n    this.hydrated = true\n    this.c()\n  },\n  e() {\n    this.streamEnded = true\n    this.c()\n  },\n  c() {\n    if (this.hydrated && this.streamEnded) {\n      delete self.$_TSR\n      delete self.$R['tsr']\n    }\n  },\n  p(script) {\n    !this.initialized ? this.buffer.push(script) : script()\n  },\n  buffer: [],\n}\n"
  },
  {
    "path": "packages/router-core/src/ssr/types.ts",
    "content": "import type { Manifest } from '../manifest'\nimport type { MakeRouteMatch } from '../Matches'\n\nexport interface DehydratedMatch {\n  i: MakeRouteMatch['id']\n  b?: MakeRouteMatch['__beforeLoadContext']\n  l?: MakeRouteMatch['loaderData']\n  e?: MakeRouteMatch['error']\n  u: MakeRouteMatch['updatedAt']\n  s: MakeRouteMatch['status']\n  ssr?: MakeRouteMatch['ssr']\n  g?: true\n}\n\nexport interface DehydratedRouter {\n  manifest: Manifest | undefined\n  dehydratedData?: any\n  lastMatchId?: string\n  matches: Array<DehydratedMatch>\n}\n\nexport interface TsrSsrGlobal {\n  router?: DehydratedRouter\n  // Signal that router hydration is complete\n  h: () => void\n  // Signal that stream has ended\n  e: () => void\n  // Cleanup all hydration resources and scripts\n  c: () => void\n  // p: Push script into buffer or execute immediately\n  p: (script: () => void) => void\n  buffer: Array<() => void>\n  // custom transformers, shortened since this is sent for each streamed value that needs a custom transformer\n  t?: Map<string, (value: any) => any>\n  // this flag indicates whether the transformers were initialized\n  initialized?: boolean\n  // router is hydrated and doesnt need the streamed values anymore\n  hydrated?: boolean\n  // stream has ended\n  streamEnded?: boolean\n}\n"
  },
  {
    "path": "packages/router-core/src/stores.ts",
    "content": "import { createLRUCache } from './lru-cache'\nimport { arraysEqual } from './utils'\n\nimport type { AnyRoute } from './route'\nimport type { RouterState } from './router'\nimport type { FullSearchSchema } from './routeInfo'\nimport type { ParsedLocation } from './location'\nimport type { AnyRedirect } from './redirect'\nimport type { AnyRouteMatch } from './Matches'\n\nexport interface RouterReadableStore<TValue> {\n  readonly state: TValue\n}\n\nexport interface RouterWritableStore<\n  TValue,\n> extends RouterReadableStore<TValue> {\n  setState: (updater: (prev: TValue) => TValue) => void\n}\n\nexport type RouterBatchFn = (fn: () => void) => void\n\nexport type MutableStoreFactory = <TValue>(\n  initialValue: TValue,\n) => RouterWritableStore<TValue>\n\nexport type ReadonlyStoreFactory = <TValue>(\n  read: () => TValue,\n) => RouterReadableStore<TValue>\n\nexport type GetStoreConfig = (opts: { isServer?: boolean }) => StoreConfig\n\nexport type StoreConfig = {\n  createMutableStore: MutableStoreFactory\n  createReadonlyStore: ReadonlyStoreFactory\n  batch: RouterBatchFn\n  init?: (stores: RouterStores<AnyRoute>) => void\n}\n\ntype MatchStore = RouterWritableStore<AnyRouteMatch> & {\n  routeId?: string\n}\ntype ReadableStore<TValue> = RouterReadableStore<TValue>\n\n/** SSR non-reactive createMutableStore */\nexport function createNonReactiveMutableStore<TValue>(\n  initialValue: TValue,\n): RouterWritableStore<TValue> {\n  let value = initialValue\n\n  return {\n    get state() {\n      return value\n    },\n    setState(updater: (prev: TValue) => TValue) {\n      value = updater(value)\n    },\n  }\n}\n\n/** SSR non-reactive createReadonlyStore */\nexport function createNonReactiveReadonlyStore<TValue>(\n  read: () => TValue,\n): RouterReadableStore<TValue> {\n  return {\n    get state() {\n      return read()\n    },\n  }\n}\n\nexport interface RouterStores<in out TRouteTree extends AnyRoute> {\n  status: RouterWritableStore<RouterState<TRouteTree>['status']>\n  loadedAt: RouterWritableStore<number>\n  isLoading: RouterWritableStore<boolean>\n  isTransitioning: RouterWritableStore<boolean>\n  location: RouterWritableStore<ParsedLocation<FullSearchSchema<TRouteTree>>>\n  resolvedLocation: RouterWritableStore<\n    ParsedLocation<FullSearchSchema<TRouteTree>> | undefined\n  >\n  statusCode: RouterWritableStore<number>\n  redirect: RouterWritableStore<AnyRedirect | undefined>\n  matchesId: RouterWritableStore<Array<string>>\n  pendingMatchesId: RouterWritableStore<Array<string>>\n  /** @internal */\n  cachedMatchesId: RouterWritableStore<Array<string>>\n  activeMatchesSnapshot: ReadableStore<Array<AnyRouteMatch>>\n  pendingMatchesSnapshot: ReadableStore<Array<AnyRouteMatch>>\n  cachedMatchesSnapshot: ReadableStore<Array<AnyRouteMatch>>\n  firstMatchId: ReadableStore<string | undefined>\n  hasPendingMatches: ReadableStore<boolean>\n  matchRouteReactivity: ReadableStore<{\n    locationHref: string\n    resolvedLocationHref: string | undefined\n    status: RouterState<TRouteTree>['status']\n  }>\n  __store: RouterReadableStore<RouterState<TRouteTree>>\n\n  activeMatchStoresById: Map<string, MatchStore>\n  pendingMatchStoresById: Map<string, MatchStore>\n  cachedMatchStoresById: Map<string, MatchStore>\n\n  /**\n   * Get a computed store that resolves a routeId to its current match state.\n   * Returns the same cached store instance for repeated calls with the same key.\n   * The computed depends on matchesId + the individual match store, so\n   * subscribers are only notified when the resolved match state changes.\n   */\n  getMatchStoreByRouteId: (\n    routeId: string,\n  ) => RouterReadableStore<AnyRouteMatch | undefined>\n\n  setActiveMatches: (nextMatches: Array<AnyRouteMatch>) => void\n  setPendingMatches: (nextMatches: Array<AnyRouteMatch>) => void\n  setCachedMatches: (nextMatches: Array<AnyRouteMatch>) => void\n}\n\nexport function createRouterStores<TRouteTree extends AnyRoute>(\n  initialState: RouterState<TRouteTree>,\n  config: StoreConfig,\n): RouterStores<TRouteTree> {\n  const { createMutableStore, createReadonlyStore, batch, init } = config\n\n  // non reactive utilities\n  const activeMatchStoresById = new Map<string, MatchStore>()\n  const pendingMatchStoresById = new Map<string, MatchStore>()\n  const cachedMatchStoresById = new Map<string, MatchStore>()\n\n  // atoms\n  const status = createMutableStore(initialState.status)\n  const loadedAt = createMutableStore(initialState.loadedAt)\n  const isLoading = createMutableStore(initialState.isLoading)\n  const isTransitioning = createMutableStore(initialState.isTransitioning)\n  const location = createMutableStore(initialState.location)\n  const resolvedLocation = createMutableStore(initialState.resolvedLocation)\n  const statusCode = createMutableStore(initialState.statusCode)\n  const redirect = createMutableStore(initialState.redirect)\n  const matchesId = createMutableStore<Array<string>>([])\n  const pendingMatchesId = createMutableStore<Array<string>>([])\n  const cachedMatchesId = createMutableStore<Array<string>>([])\n\n  // 1st order derived stores\n  const activeMatchesSnapshot = createReadonlyStore(() =>\n    readPoolMatches(activeMatchStoresById, matchesId.state),\n  )\n  const pendingMatchesSnapshot = createReadonlyStore(() =>\n    readPoolMatches(pendingMatchStoresById, pendingMatchesId.state),\n  )\n  const cachedMatchesSnapshot = createReadonlyStore(() =>\n    readPoolMatches(cachedMatchStoresById, cachedMatchesId.state),\n  )\n  const firstMatchId = createReadonlyStore(() => matchesId.state[0])\n  const hasPendingMatches = createReadonlyStore(() =>\n    matchesId.state.some((matchId) => {\n      const store = activeMatchStoresById.get(matchId)\n      return store?.state.status === 'pending'\n    }),\n  )\n  const matchRouteReactivity = createReadonlyStore(() => ({\n    locationHref: location.state.href,\n    resolvedLocationHref: resolvedLocation.state?.href,\n    status: status.state,\n  }))\n\n  // compatibility \"big\" state store\n  const __store = createReadonlyStore(() => ({\n    status: status.state,\n    loadedAt: loadedAt.state,\n    isLoading: isLoading.state,\n    isTransitioning: isTransitioning.state,\n    matches: activeMatchesSnapshot.state,\n    location: location.state,\n    resolvedLocation: resolvedLocation.state,\n    statusCode: statusCode.state,\n    redirect: redirect.state,\n  }))\n\n  // Per-routeId computed store cache.\n  // Each entry resolves routeId → match state through the signal graph,\n  // giving consumers a single store to subscribe to instead of the\n  // two-level byRouteId → matchStore pattern.\n  //\n  // 64 max size is arbitrary, this is only for active matches anyway so\n  // it should be plenty. And we already have a 32 limit due to route\n  // matching bitmask anyway.\n  const matchStoreByRouteIdCache = createLRUCache<\n    string,\n    RouterReadableStore<AnyRouteMatch | undefined>\n  >(64)\n\n  function getMatchStoreByRouteId(\n    routeId: string,\n  ): RouterReadableStore<AnyRouteMatch | undefined> {\n    let cached = matchStoreByRouteIdCache.get(routeId)\n    if (!cached) {\n      cached = createReadonlyStore(() => {\n        // Reading matchesId.state tracks it as a dependency.\n        // When matchesId changes (navigation), this computed re-evaluates.\n        const ids = matchesId.state\n        for (const id of ids) {\n          const matchStore = activeMatchStoresById.get(id)\n          if (matchStore && matchStore.routeId === routeId) {\n            // Reading matchStore.state tracks it as a dependency.\n            // When the match store's state changes, this re-evaluates.\n            return matchStore.state\n          }\n        }\n        return undefined\n      })\n      matchStoreByRouteIdCache.set(routeId, cached)\n    }\n    return cached\n  }\n\n  const store = {\n    // atoms\n    status,\n    loadedAt,\n    isLoading,\n    isTransitioning,\n    location,\n    resolvedLocation,\n    statusCode,\n    redirect,\n    matchesId,\n    pendingMatchesId,\n    cachedMatchesId,\n\n    // derived\n    activeMatchesSnapshot,\n    pendingMatchesSnapshot,\n    cachedMatchesSnapshot,\n    firstMatchId,\n    hasPendingMatches,\n    matchRouteReactivity,\n\n    // non-reactive state\n    activeMatchStoresById,\n    pendingMatchStoresById,\n    cachedMatchStoresById,\n\n    // compatibility \"big\" state\n    __store,\n\n    // per-key computed stores\n    getMatchStoreByRouteId,\n\n    // methods\n    setActiveMatches,\n    setPendingMatches,\n    setCachedMatches,\n  }\n\n  // initialize the active matches\n  setActiveMatches(initialState.matches as Array<AnyRouteMatch>)\n  init?.(store)\n\n  // setters to update non-reactive utilities in sync with the reactive stores\n  function setActiveMatches(nextMatches: Array<AnyRouteMatch>) {\n    reconcileMatchPool(\n      nextMatches,\n      activeMatchStoresById,\n      matchesId,\n      createMutableStore,\n      batch,\n    )\n  }\n\n  function setPendingMatches(nextMatches: Array<AnyRouteMatch>) {\n    reconcileMatchPool(\n      nextMatches,\n      pendingMatchStoresById,\n      pendingMatchesId,\n      createMutableStore,\n      batch,\n    )\n  }\n\n  function setCachedMatches(nextMatches: Array<AnyRouteMatch>) {\n    reconcileMatchPool(\n      nextMatches,\n      cachedMatchStoresById,\n      cachedMatchesId,\n      createMutableStore,\n      batch,\n    )\n  }\n\n  return store\n}\n\nfunction readPoolMatches(\n  pool: Map<string, MatchStore>,\n  ids: Array<string>,\n): Array<AnyRouteMatch> {\n  const matches: Array<AnyRouteMatch> = []\n  for (const id of ids) {\n    const matchStore = pool.get(id)\n    if (matchStore) {\n      matches.push(matchStore.state)\n    }\n  }\n  return matches\n}\n\nfunction reconcileMatchPool(\n  nextMatches: Array<AnyRouteMatch>,\n  pool: Map<string, MatchStore>,\n  idStore: RouterWritableStore<Array<string>>,\n  createMutableStore: MutableStoreFactory,\n  batch: RouterBatchFn,\n): void {\n  const nextIds = nextMatches.map((d) => d.id)\n  const nextIdSet = new Set(nextIds)\n\n  batch(() => {\n    for (const id of pool.keys()) {\n      if (!nextIdSet.has(id)) {\n        pool.delete(id)\n      }\n    }\n\n    for (const nextMatch of nextMatches) {\n      const existing = pool.get(nextMatch.id)\n      if (!existing) {\n        const matchStore = createMutableStore(nextMatch) as MatchStore\n        matchStore.routeId = nextMatch.routeId\n        pool.set(nextMatch.id, matchStore)\n        continue\n      }\n\n      existing.routeId = nextMatch.routeId\n      if (existing.state !== nextMatch) {\n        existing.setState(() => nextMatch)\n      }\n    }\n\n    if (!arraysEqual(idStore.state, nextIds)) {\n      idStore.setState(() => nextIds)\n    }\n  })\n}\n"
  },
  {
    "path": "packages/router-core/src/structuralSharing.ts",
    "content": "import type { Constrain } from './utils'\n\nexport interface OptionalStructuralSharing<TStructuralSharing, TConstraint> {\n  readonly structuralSharing?:\n    | Constrain<TStructuralSharing, TConstraint>\n    | undefined\n}\n"
  },
  {
    "path": "packages/router-core/src/typePrimitives.ts",
    "content": "import type {\n  FromPathOption,\n  NavigateOptions,\n  PathParamOptions,\n  SearchParamOptions,\n  ToPathOption,\n} from './link'\nimport type { RedirectOptions } from './redirect'\nimport type { RouteIds } from './routeInfo'\nimport type { AnyRouter, RegisteredRouter } from './router'\nimport type { UseParamsResult } from './useParams'\nimport type { UseSearchResult } from './useSearch'\nimport type { Constrain, ConstrainLiteral } from './utils'\n\nexport type ValidateFromPath<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom = string,\n> = FromPathOption<TRouter, TFrom>\n\nexport type ValidateToPath<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TTo extends string | undefined = undefined,\n  TFrom extends string = string,\n> = ToPathOption<TRouter, TFrom, TTo>\n\nexport type ValidateSearch<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TTo extends string | undefined = undefined,\n  TFrom extends string = string,\n> = SearchParamOptions<TRouter, TFrom, TTo>\n\nexport type ValidateParams<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TTo extends string | undefined = undefined,\n  TFrom extends string = string,\n> = PathParamOptions<TRouter, TFrom, TTo>\n\n/**\n * @private\n */\nexport type InferFrom<\n  TOptions,\n  TDefaultFrom extends string = string,\n> = TOptions extends {\n  from: infer TFrom extends string\n}\n  ? TFrom\n  : TDefaultFrom\n\n/**\n * @private\n */\nexport type InferTo<TOptions> = TOptions extends {\n  to: infer TTo extends string\n}\n  ? TTo\n  : undefined\n\n/**\n * @private\n */\nexport type InferMaskTo<TOptions> = TOptions extends {\n  mask: { to: infer TTo extends string }\n}\n  ? TTo\n  : ''\n\nexport type InferMaskFrom<TOptions> = TOptions extends {\n  mask: { from: infer TFrom extends string }\n}\n  ? TFrom\n  : string\n\nexport type ValidateNavigateOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TOptions = unknown,\n  TDefaultFrom extends string = string,\n> = Constrain<\n  TOptions,\n  NavigateOptions<\n    TRouter,\n    InferFrom<TOptions, TDefaultFrom>,\n    InferTo<TOptions>,\n    InferMaskFrom<TOptions>,\n    InferMaskTo<TOptions>\n  >\n>\n\nexport type ValidateNavigateOptionsArray<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,\n  TDefaultFrom extends string = string,\n> = {\n  [K in keyof TOptions]: ValidateNavigateOptions<\n    TRouter,\n    TOptions[K],\n    TDefaultFrom\n  >\n}\n\nexport type ValidateRedirectOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TOptions = unknown,\n  TDefaultFrom extends string = string,\n> = Constrain<\n  TOptions,\n  RedirectOptions<\n    TRouter,\n    InferFrom<TOptions, TDefaultFrom>,\n    InferTo<TOptions>,\n    InferMaskFrom<TOptions>,\n    InferMaskTo<TOptions>\n  >\n>\n\nexport type ValidateRedirectOptionsArray<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,\n  TDefaultFrom extends string = string,\n> = {\n  [K in keyof TOptions]: ValidateRedirectOptions<\n    TRouter,\n    TOptions[K],\n    TDefaultFrom\n  >\n}\n\nexport type ValidateId<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TId extends string = string,\n> = ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>\n\n/**\n * @private\n */\nexport type InferStrict<TOptions> = TOptions extends {\n  strict: infer TStrict extends boolean\n}\n  ? TStrict\n  : true\n\n/**\n * @private\n */\nexport type InferShouldThrow<TOptions> = TOptions extends {\n  shouldThrow: infer TShouldThrow extends boolean\n}\n  ? TShouldThrow\n  : true\n\n/**\n * @private\n */\nexport type InferSelected<TOptions> = TOptions extends {\n  select: (...args: Array<any>) => infer TSelected\n}\n  ? TSelected\n  : unknown\n\nexport type ValidateUseSearchResult<\n  TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n> = UseSearchResult<\n  TRouter,\n  InferFrom<TOptions>,\n  InferStrict<TOptions>,\n  InferSelected<TOptions>\n>\n\nexport type ValidateUseParamsResult<\n  TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n> = Constrain<\n  TOptions,\n  UseParamsResult<\n    TRouter,\n    InferFrom<TOptions>,\n    InferStrict<TOptions>,\n    InferSelected<TOptions>\n  >\n>\n"
  },
  {
    "path": "packages/router-core/src/useLoaderData.ts",
    "content": "import type { AllLoaderData, RouteById } from './routeInfo'\nimport type { AnyRouter } from './router'\nimport type { Expand } from './utils'\n\nexport type ResolveUseLoaderData<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n> = TStrict extends false\n  ? AllLoaderData<TRouter['routeTree']>\n  : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['loaderData']>\n\nexport type UseLoaderDataResult<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n> = unknown extends TSelected\n  ? ResolveUseLoaderData<TRouter, TFrom, TStrict>\n  : TSelected\n"
  },
  {
    "path": "packages/router-core/src/useLoaderDeps.ts",
    "content": "import type { RouteById } from './routeInfo'\nimport type { AnyRouter } from './router'\nimport type { Expand } from './utils'\n\nexport type ResolveUseLoaderDeps<TRouter extends AnyRouter, TFrom> = Expand<\n  RouteById<TRouter['routeTree'], TFrom>['types']['loaderDeps']\n>\n\nexport type UseLoaderDepsResult<\n  TRouter extends AnyRouter,\n  TFrom,\n  TSelected,\n> = unknown extends TSelected ? ResolveUseLoaderDeps<TRouter, TFrom> : TSelected\n"
  },
  {
    "path": "packages/router-core/src/useNavigate.ts",
    "content": "import type { NavigateOptions } from './link'\nimport type { RegisteredRouter } from './router'\n\nexport type UseNavigateResult<TDefaultFrom extends string> = <\n  TRouter extends RegisteredRouter,\n  TTo extends string | undefined,\n  TFrom extends string = TDefaultFrom,\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '',\n>({\n  from,\n  ...rest\n}: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>\n"
  },
  {
    "path": "packages/router-core/src/useParams.ts",
    "content": "import type { AllParams, RouteById } from './routeInfo'\nimport type { AnyRouter } from './router'\nimport type { Expand } from './utils'\n\nexport type ResolveUseParams<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n> = TStrict extends false\n  ? AllParams<TRouter['routeTree']>\n  : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['allParams']>\n\nexport type UseParamsResult<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n> = unknown extends TSelected\n  ? ResolveUseParams<TRouter, TFrom, TStrict>\n  : TSelected\n"
  },
  {
    "path": "packages/router-core/src/useRouteContext.ts",
    "content": "import type { AllContext, RouteById } from './routeInfo'\nimport type { AnyRouter } from './router'\nimport type { Expand, StrictOrFrom } from './utils'\n\nexport interface UseRouteContextBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n> {\n  select?: (\n    search: ResolveUseRouteContext<TRouter, TFrom, TStrict>,\n  ) => TSelected\n}\n\nexport type UseRouteContextOptions<\n  TRouter extends AnyRouter,\n  TFrom extends string | undefined,\n  TStrict extends boolean,\n  TSelected,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n  UseRouteContextBaseOptions<TRouter, TFrom, TStrict, TSelected>\n\nexport type ResolveUseRouteContext<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n> = TStrict extends false\n  ? AllContext<TRouter['routeTree']>\n  : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['allContext']>\n\nexport type UseRouteContextResult<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n> = unknown extends TSelected\n  ? ResolveUseRouteContext<TRouter, TFrom, TStrict>\n  : TSelected\n"
  },
  {
    "path": "packages/router-core/src/useSearch.ts",
    "content": "import type { FullSearchSchema, RouteById } from './routeInfo'\nimport type { AnyRouter } from './router'\nimport type { Expand } from './utils'\n\nexport type UseSearchResult<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n> = unknown extends TSelected\n  ? ResolveUseSearch<TRouter, TFrom, TStrict>\n  : TSelected\n\nexport type ResolveUseSearch<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n> = TStrict extends false\n  ? FullSearchSchema<TRouter['routeTree']>\n  : Expand<RouteById<TRouter['routeTree'], TFrom>['types']['fullSearchSchema']>\n"
  },
  {
    "path": "packages/router-core/src/utils.ts",
    "content": "import { isServer } from '@tanstack/router-core/isServer'\nimport type { RouteIds } from './routeInfo'\nimport type { AnyRouter } from './router'\n\nexport type Awaitable<T> = T | Promise<T>\nexport type NoInfer<T> = [T][T extends any ? 0 : never]\nexport type IsAny<TValue, TYesResult, TNoResult = TValue> = 1 extends 0 & TValue\n  ? TYesResult\n  : TNoResult\n\nexport type PickAsRequired<TValue, TKey extends keyof TValue> = Omit<\n  TValue,\n  TKey\n> &\n  Required<Pick<TValue, TKey>>\n\nexport type PickRequired<T> = {\n  [K in keyof T as undefined extends T[K] ? never : K]: T[K]\n}\n\nexport type PickOptional<T> = {\n  [K in keyof T as undefined extends T[K] ? K : never]: T[K]\n}\n\n// from https://stackoverflow.com/a/76458160\nexport type WithoutEmpty<T> = T extends any ? ({} extends T ? never : T) : never\n\nexport type Expand<T> = T extends object\n  ? T extends infer O\n    ? O extends Function\n      ? O\n      : { [K in keyof O]: O[K] }\n    : never\n  : T\n\nexport type DeepPartial<T> = T extends object\n  ? {\n      [P in keyof T]?: DeepPartial<T[P]>\n    }\n  : T\n\nexport type MakeDifferenceOptional<TLeft, TRight> = keyof TLeft &\n  keyof TRight extends never\n  ? TRight\n  : Omit<TRight, keyof TLeft & keyof TRight> & {\n      [K in keyof TLeft & keyof TRight]?: TRight[K]\n    }\n\n// from https://stackoverflow.com/a/53955431\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type IsUnion<T, U extends T = T> = (\n  T extends any ? (U extends T ? false : true) : never\n) extends false\n  ? false\n  : true\n\nexport type IsNonEmptyObject<T> = T extends object\n  ? keyof T extends never\n    ? false\n    : true\n  : false\n\nexport type Assign<TLeft, TRight> = TLeft extends any\n  ? TRight extends any\n    ? IsNonEmptyObject<TLeft> extends false\n      ? TRight\n      : IsNonEmptyObject<TRight> extends false\n        ? TLeft\n        : keyof TLeft & keyof TRight extends never\n          ? TLeft & TRight\n          : Omit<TLeft, keyof TRight> & TRight\n    : never\n  : never\n\nexport type IntersectAssign<TLeft, TRight> = TLeft extends any\n  ? TRight extends any\n    ? IsNonEmptyObject<TLeft> extends false\n      ? TRight\n      : IsNonEmptyObject<TRight> extends false\n        ? TLeft\n        : TRight & TLeft\n    : never\n  : never\n\nexport type Timeout = ReturnType<typeof setTimeout>\n\nexport type Updater<TPrevious, TResult = TPrevious> =\n  | TResult\n  | ((prev?: TPrevious) => TResult)\n\nexport type NonNullableUpdater<TPrevious, TResult = TPrevious> =\n  | TResult\n  | ((prev: TPrevious) => TResult)\n\nexport type ExtractObjects<TUnion> = TUnion extends MergeAllPrimitive\n  ? never\n  : TUnion\n\nexport type PartialMergeAllObject<TUnion> =\n  ExtractObjects<TUnion> extends infer TObj\n    ? [TObj] extends [never]\n      ? never\n      : {\n          [TKey in TObj extends any ? keyof TObj : never]?: TObj extends any\n            ? TKey extends keyof TObj\n              ? TObj[TKey]\n              : never\n            : never\n        }\n    : never\n\nexport type MergeAllPrimitive =\n  | ReadonlyArray<any>\n  | number\n  | string\n  | bigint\n  | boolean\n  | symbol\n  | undefined\n  | null\n\nexport type ExtractPrimitives<TUnion> = TUnion extends MergeAllPrimitive\n  ? TUnion\n  : TUnion extends object\n    ? never\n    : TUnion\n\nexport type PartialMergeAll<TUnion> =\n  | ExtractPrimitives<TUnion>\n  | PartialMergeAllObject<TUnion>\n\nexport type Constrain<T, TConstraint, TDefault = TConstraint> =\n  | (T extends TConstraint ? T : never)\n  | TDefault\n\nexport type ConstrainLiteral<T, TConstraint, TDefault = TConstraint> =\n  | (T & TConstraint)\n  | TDefault\n\n/**\n * To be added to router types\n */\nexport type UnionToIntersection<T> = (\n  T extends any ? (arg: T) => any : never\n) extends (arg: infer T) => any\n  ? T\n  : never\n\n/**\n * Merges everything in a union into one object.\n * This mapped type is homomorphic which means it preserves stuff! :)\n */\nexport type MergeAllObjects<\n  TUnion,\n  TIntersected = UnionToIntersection<ExtractObjects<TUnion>>,\n> = [keyof TIntersected] extends [never]\n  ? never\n  : {\n      [TKey in keyof TIntersected]: TUnion extends any\n        ? TUnion[TKey & keyof TUnion]\n        : never\n    }\n\nexport type MergeAll<TUnion> =\n  | MergeAllObjects<TUnion>\n  | ExtractPrimitives<TUnion>\n\nexport type ValidateJSON<T> = ((...args: Array<any>) => any) extends T\n  ? unknown extends T\n    ? never\n    : 'Function is not serializable'\n  : { [K in keyof T]: ValidateJSON<T[K]> }\n\nexport type LooseReturnType<T> = T extends (\n  ...args: Array<any>\n) => infer TReturn\n  ? TReturn\n  : never\n\nexport type LooseAsyncReturnType<T> = T extends (\n  ...args: Array<any>\n) => infer TReturn\n  ? TReturn extends Promise<infer TReturn>\n    ? TReturn\n    : TReturn\n  : never\n\n/**\n * Return the last element of an array.\n * Intended for non-empty arrays used within router internals.\n */\nexport function last<T>(arr: ReadonlyArray<T>) {\n  return arr[arr.length - 1]\n}\n\nfunction isFunction(d: any): d is Function {\n  return typeof d === 'function'\n}\n\n/**\n * Apply a value-or-updater to a previous value.\n * Accepts either a literal value or a function of the previous value.\n */\nexport function functionalUpdate<TPrevious, TResult = TPrevious>(\n  updater: Updater<TPrevious, TResult> | NonNullableUpdater<TPrevious, TResult>,\n  previous: TPrevious,\n): TResult {\n  if (isFunction(updater)) {\n    return updater(previous)\n  }\n\n  return updater\n}\n\nconst hasOwn = Object.prototype.hasOwnProperty\nconst isEnumerable = Object.prototype.propertyIsEnumerable\n\nconst createNull = () => Object.create(null)\nexport const nullReplaceEqualDeep: typeof replaceEqualDeep = (prev, next) =>\n  replaceEqualDeep(prev, next, createNull)\n\n/**\n * This function returns `prev` if `_next` is deeply equal.\n * If not, it will replace any deeply equal children of `b` with those of `a`.\n * This can be used for structural sharing between immutable JSON values for example.\n * Do not use this with signals\n */\nexport function replaceEqualDeep<T>(\n  prev: any,\n  _next: T,\n  _makeObj = () => ({}),\n  _depth = 0,\n): T {\n  if (isServer) {\n    return _next\n  }\n  if (prev === _next) {\n    return prev\n  }\n\n  if (_depth > 500) return _next\n\n  const next = _next as any\n\n  const array = isPlainArray(prev) && isPlainArray(next)\n\n  if (!array && !(isPlainObject(prev) && isPlainObject(next))) return next\n\n  const prevItems = array ? prev : getEnumerableOwnKeys(prev)\n  if (!prevItems) return next\n  const nextItems = array ? next : getEnumerableOwnKeys(next)\n  if (!nextItems) return next\n  const prevSize = prevItems.length\n  const nextSize = nextItems.length\n  const copy: any = array ? new Array(nextSize) : _makeObj()\n\n  let equalItems = 0\n\n  for (let i = 0; i < nextSize; i++) {\n    const key = array ? i : (nextItems[i] as any)\n    const p = prev[key]\n    const n = next[key]\n\n    if (p === n) {\n      copy[key] = p\n      if (array ? i < prevSize : hasOwn.call(prev, key)) equalItems++\n      continue\n    }\n\n    if (\n      p === null ||\n      n === null ||\n      typeof p !== 'object' ||\n      typeof n !== 'object'\n    ) {\n      copy[key] = n\n      continue\n    }\n\n    const v = replaceEqualDeep(p, n, _makeObj, _depth + 1)\n    copy[key] = v\n    if (v === p) equalItems++\n  }\n\n  return prevSize === nextSize && equalItems === prevSize ? prev : copy\n}\n\n/**\n * Equivalent to `Reflect.ownKeys`, but ensures that objects are \"clone-friendly\":\n * will return false if object has any non-enumerable properties.\n *\n * Optimized for the common case where objects have no symbol properties.\n */\nfunction getEnumerableOwnKeys(o: object) {\n  const names = Object.getOwnPropertyNames(o)\n\n  // Fast path: check all string property names are enumerable\n  for (const name of names) {\n    if (!isEnumerable.call(o, name)) return false\n  }\n\n  // Only check symbols if the object has any (most plain objects don't)\n  const symbols = Object.getOwnPropertySymbols(o)\n\n  // Fast path: no symbols, return names directly (avoids array allocation/concat)\n  if (symbols.length === 0) return names\n\n  // Slow path: has symbols, need to check and merge\n  const keys: Array<string | symbol> = names\n  for (const symbol of symbols) {\n    if (!isEnumerable.call(o, symbol)) return false\n    keys.push(symbol)\n  }\n  return keys\n}\n\n// Copied from: https://github.com/jonschlinkert/is-plain-object\nexport function isPlainObject(o: any) {\n  if (!hasObjectPrototype(o)) {\n    return false\n  }\n\n  // If has modified constructor\n  const ctor = o.constructor\n  if (typeof ctor === 'undefined') {\n    return true\n  }\n\n  // If has modified prototype\n  const prot = ctor.prototype\n  if (!hasObjectPrototype(prot)) {\n    return false\n  }\n\n  // If constructor does not have an Object-specific method\n  if (!prot.hasOwnProperty('isPrototypeOf')) {\n    return false\n  }\n\n  // Most likely a plain Object\n  return true\n}\n\nfunction hasObjectPrototype(o: any) {\n  return Object.prototype.toString.call(o) === '[object Object]'\n}\n\n/**\n * Check if a value is a \"plain\" array (no extra enumerable keys).\n */\nexport function isPlainArray(value: unknown): value is Array<unknown> {\n  return Array.isArray(value) && value.length === Object.keys(value).length\n}\n\n/**\n * Perform a deep equality check with options for partial comparison and\n * ignoring `undefined` values. Optimized for router state comparisons.\n */\nexport function deepEqual(\n  a: any,\n  b: any,\n  opts?: { partial?: boolean; ignoreUndefined?: boolean },\n): boolean {\n  if (a === b) {\n    return true\n  }\n\n  if (typeof a !== typeof b) {\n    return false\n  }\n\n  if (Array.isArray(a) && Array.isArray(b)) {\n    if (a.length !== b.length) return false\n    for (let i = 0, l = a.length; i < l; i++) {\n      if (!deepEqual(a[i], b[i], opts)) return false\n    }\n    return true\n  }\n\n  if (isPlainObject(a) && isPlainObject(b)) {\n    const ignoreUndefined = opts?.ignoreUndefined ?? true\n\n    if (opts?.partial) {\n      for (const k in b) {\n        if (!ignoreUndefined || b[k] !== undefined) {\n          if (!deepEqual(a[k], b[k], opts)) return false\n        }\n      }\n      return true\n    }\n\n    let aCount = 0\n    if (!ignoreUndefined) {\n      aCount = Object.keys(a).length\n    } else {\n      for (const k in a) {\n        if (a[k] !== undefined) aCount++\n      }\n    }\n\n    let bCount = 0\n    for (const k in b) {\n      if (!ignoreUndefined || b[k] !== undefined) {\n        bCount++\n        if (bCount > aCount || !deepEqual(a[k], b[k], opts)) return false\n      }\n    }\n\n    return aCount === bCount\n  }\n\n  return false\n}\n\nexport type StringLiteral<T> = T extends string\n  ? string extends T\n    ? string\n    : T\n  : never\n\nexport type ThrowOrOptional<T, TThrow extends boolean> = TThrow extends true\n  ? T\n  : T | undefined\n\nexport type StrictOrFrom<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean = true,\n> = TStrict extends false\n  ? {\n      from?: never\n      strict: TStrict\n    }\n  : {\n      from: ConstrainLiteral<TFrom, RouteIds<TRouter['routeTree']>>\n      strict?: TStrict\n    }\n\nexport type ThrowConstraint<\n  TStrict extends boolean,\n  TThrow extends boolean,\n> = TStrict extends false ? (TThrow extends true ? never : TThrow) : TThrow\n\nexport type ControlledPromise<T> = Promise<T> & {\n  resolve: (value: T) => void\n  reject: (value: any) => void\n  status: 'pending' | 'resolved' | 'rejected'\n  value?: T\n}\n\n/**\n * Create a promise with exposed resolve/reject and status fields.\n * Useful for coordinating async router lifecycle operations.\n */\nexport function createControlledPromise<T>(onResolve?: (value: T) => void) {\n  let resolveLoadPromise!: (value: T) => void\n  let rejectLoadPromise!: (value: any) => void\n\n  const controlledPromise = new Promise<T>((resolve, reject) => {\n    resolveLoadPromise = resolve\n    rejectLoadPromise = reject\n  }) as ControlledPromise<T>\n\n  controlledPromise.status = 'pending'\n\n  controlledPromise.resolve = (value: T) => {\n    controlledPromise.status = 'resolved'\n    controlledPromise.value = value\n    resolveLoadPromise(value)\n    onResolve?.(value)\n  }\n\n  controlledPromise.reject = (e) => {\n    controlledPromise.status = 'rejected'\n    rejectLoadPromise(e)\n  }\n\n  return controlledPromise\n}\n\n/**\n * Heuristically detect dynamic import \"module not found\" errors\n * across major browsers for lazy route component handling.\n */\nexport function isModuleNotFoundError(error: any): boolean {\n  // chrome: \"Failed to fetch dynamically imported module: http://localhost:5173/src/routes/posts.index.tsx?tsr-split\"\n  // firefox: \"error loading dynamically imported module: http://localhost:5173/src/routes/posts.index.tsx?tsr-split\"\n  // safari: \"Importing a module script failed.\"\n  if (typeof error?.message !== 'string') return false\n  return (\n    error.message.startsWith('Failed to fetch dynamically imported module') ||\n    error.message.startsWith('error loading dynamically imported module') ||\n    error.message.startsWith('Importing a module script failed')\n  )\n}\n\nexport function isPromise<T>(\n  value: Promise<Awaited<T>> | T,\n): value is Promise<Awaited<T>> {\n  return Boolean(\n    value &&\n    typeof value === 'object' &&\n    typeof (value as Promise<T>).then === 'function',\n  )\n}\n\nexport function findLast<T>(\n  array: ReadonlyArray<T>,\n  predicate: (item: T) => boolean,\n): T | undefined {\n  for (let i = array.length - 1; i >= 0; i--) {\n    const item = array[i]!\n    if (predicate(item)) return item\n  }\n  return undefined\n}\n\n/**\n * Remove control characters that can cause open redirect vulnerabilities.\n * Characters like \\r (CR) and \\n (LF) can trick URL parsers into interpreting\n * paths like \"/\\r/evil.com\" as \"http://evil.com\".\n */\nfunction sanitizePathSegment(segment: string): string {\n  // Remove ASCII control characters (0x00-0x1F) and DEL (0x7F)\n  // These include CR (\\r = 0x0D), LF (\\n = 0x0A), and other potentially dangerous characters\n  // eslint-disable-next-line no-control-regex\n  return segment.replace(/[\\x00-\\x1f\\x7f]/g, '')\n}\n\nfunction decodeSegment(segment: string): string {\n  let decoded: string\n  try {\n    decoded = decodeURI(segment)\n  } catch {\n    // if the decoding fails, try to decode the various parts leaving the malformed tags in place\n    decoded = segment.replaceAll(/%[0-9A-F]{2}/gi, (match) => {\n      try {\n        return decodeURI(match)\n      } catch {\n        return match\n      }\n    })\n  }\n  return sanitizePathSegment(decoded)\n}\n\n/**\n * Default list of URL protocols to allow in links, redirects, and navigation.\n * Any absolute URL protocol not in this list is treated as dangerous by default.\n */\nexport const DEFAULT_PROTOCOL_ALLOWLIST = [\n  // Standard web navigation\n  'http:',\n  'https:',\n\n  // Common browser-safe actions\n  'mailto:',\n  'tel:',\n]\n\n/**\n * Check if a URL string uses a protocol that is not in the allowlist.\n * Returns true for blocked protocols like javascript:, blob:, data:, etc.\n *\n * The URL constructor correctly normalizes:\n * - Mixed case (JavaScript: → javascript:)\n * - Whitespace/control characters (java\\nscript: → javascript:)\n * - Leading whitespace\n *\n * For relative URLs (no protocol), returns false (safe).\n *\n * @param url - The URL string to check\n * @param allowlist - Set of protocols to allow\n * @returns true if the URL uses a protocol that is not allowed\n */\nexport function isDangerousProtocol(\n  url: string,\n  allowlist: Set<string>,\n): boolean {\n  if (!url) return false\n\n  try {\n    // Use the URL constructor - it correctly normalizes protocols\n    // per WHATWG URL spec, handling all bypass attempts automatically\n    const parsed = new URL(url)\n    return !allowlist.has(parsed.protocol)\n  } catch {\n    // URL constructor throws for relative URLs (no protocol)\n    // These are safe - they can't execute scripts\n    return false\n  }\n}\n\n// This utility is based on https://github.com/zertosh/htmlescape\n// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\nconst HTML_ESCAPE_LOOKUP: { [match: string]: string } = {\n  '&': '\\\\u0026',\n  '>': '\\\\u003e',\n  '<': '\\\\u003c',\n  '\\u2028': '\\\\u2028',\n  '\\u2029': '\\\\u2029',\n}\n\nconst HTML_ESCAPE_REGEX = /[&><\\u2028\\u2029]/g\n\n/**\n * Escape HTML special characters in a string to prevent XSS attacks\n * when embedding strings in script tags during SSR.\n *\n * This is essential for preventing XSS vulnerabilities when user-controlled\n * content is embedded in inline scripts.\n */\nexport function escapeHtml(str: string): string {\n  return str.replace(HTML_ESCAPE_REGEX, (match) => HTML_ESCAPE_LOOKUP[match]!)\n}\n\nexport function decodePath(path: string) {\n  if (!path) return { path, handledProtocolRelativeURL: false }\n\n  // Fast path: most paths are already decoded and safe.\n  // Only fall back to the slower scan/regex path when we see a '%' (encoded),\n  // a backslash (explicitly handled), a control character, or a protocol-relative\n  // prefix which needs collapsing.\n  // eslint-disable-next-line no-control-regex\n  if (!/[%\\\\\\x00-\\x1f\\x7f]/.test(path) && !path.startsWith('//')) {\n    return { path, handledProtocolRelativeURL: false }\n  }\n\n  const re = /%25|%5C/gi\n  let cursor = 0\n  let result = ''\n  let match\n  while (null !== (match = re.exec(path))) {\n    result += decodeSegment(path.slice(cursor, match.index)) + match[0]\n    cursor = re.lastIndex\n  }\n  result = result + decodeSegment(cursor ? path.slice(cursor) : path)\n\n  // Prevent open redirect via protocol-relative URLs (e.g. \"//evil.com\")\n  // After sanitizing control characters, paths like \"/\\r/evil.com\" become \"//evil.com\"\n  // Collapse leading double slashes to a single slash\n  let handledProtocolRelativeURL = false\n  if (result.startsWith('//')) {\n    handledProtocolRelativeURL = true\n    result = '/' + result.replace(/^\\/+/, '')\n  }\n\n  return { path: result, handledProtocolRelativeURL }\n}\n\n/**\n * Encodes a path the same way `new URL()` would, but without the overhead of full URL parsing.\n *\n * This function encodes:\n * - Whitespace characters (spaces → %20, tabs → %09, etc.)\n * - Non-ASCII/Unicode characters (emojis, accented characters, etc.)\n *\n * It preserves:\n * - Already percent-encoded sequences (won't double-encode %2F, %25, etc.)\n * - ASCII special characters valid in URL paths (@, $, &, +, etc.)\n * - Forward slashes as path separators\n *\n * Used to generate proper href values for SSR without constructing URL objects.\n *\n * @example\n * encodePathLikeUrl('/path/file name.pdf') // '/path/file%20name.pdf'\n * encodePathLikeUrl('/path/日本語') // '/path/%E6%97%A5%E6%9C%AC%E8%AA%9E'\n * encodePathLikeUrl('/path/already%20encoded') // '/path/already%20encoded' (preserved)\n */\nexport function encodePathLikeUrl(path: string): string {\n  // Encode whitespace and non-ASCII characters that browsers encode in URLs\n\n  // biome-ignore lint/suspicious/noControlCharactersInRegex: intentional ASCII range check\n  // eslint-disable-next-line no-control-regex\n  if (!/\\s|[^\\u0000-\\u007F]/.test(path)) return path\n  // biome-ignore lint/suspicious/noControlCharactersInRegex: intentional ASCII range check\n  // eslint-disable-next-line no-control-regex\n  return path.replace(/\\s|[^\\u0000-\\u007F]/gu, encodeURIComponent)\n}\n\n/**\n * Builds the dev-mode CSS styles URL for route-scoped CSS collection.\n * Used by HeadContent components in all framework implementations to construct\n * the URL for the `/@tanstack-start/styles.css` endpoint.\n *\n * @param basepath - The router's basepath (may or may not have leading slash)\n * @param routeIds - Array of matched route IDs to include in the CSS collection\n * @returns The full URL path for the dev styles CSS endpoint\n */\nexport function buildDevStylesUrl(\n  basepath: string,\n  routeIds: Array<string>,\n): string {\n  // Trim all leading and trailing slashes from basepath\n  const trimmedBasepath = basepath.replace(/^\\/+|\\/+$/g, '')\n  // Build normalized basepath: empty string for root, or '/path' for non-root\n  const normalizedBasepath = trimmedBasepath === '' ? '' : `/${trimmedBasepath}`\n  return `${normalizedBasepath}/@tanstack-start/styles.css?routes=${encodeURIComponent(routeIds.join(','))}`\n}\n\nexport function arraysEqual<T>(a: Array<T>, b: Array<T>) {\n  if (a === b) return true\n  if (a.length !== b.length) return false\n  for (let i = 0; i < a.length; i++) {\n    if (a[i] !== b[i]) return false\n  }\n  return true\n}\n"
  },
  {
    "path": "packages/router-core/src/validators.ts",
    "content": "import type { SearchSchemaInput } from './route'\n\nexport interface StandardSchemaValidatorProps<TInput, TOutput> {\n  readonly types?: StandardSchemaValidatorTypes<TInput, TOutput> | undefined\n  readonly validate: AnyStandardSchemaValidate\n}\n\nexport interface StandardSchemaValidator<TInput, TOutput> {\n  readonly '~standard': StandardSchemaValidatorProps<TInput, TOutput>\n}\n\nexport type AnyStandardSchemaValidator = StandardSchemaValidator<any, any>\n\nexport interface StandardSchemaValidatorTypes<TInput, TOutput> {\n  readonly input: TInput\n  readonly output: TOutput\n}\n\nexport interface AnyStandardSchemaValidateSuccess {\n  readonly value: any\n  readonly issues?: undefined\n}\n\nexport interface AnyStandardSchemaValidateFailure {\n  readonly issues: ReadonlyArray<AnyStandardSchemaValidateIssue>\n}\n\nexport interface AnyStandardSchemaValidateIssue {\n  readonly message: string\n}\n\nexport interface AnyStandardSchemaValidateInput {\n  readonly value: any\n}\n\nexport type AnyStandardSchemaValidate = (\n  value: unknown,\n) =>\n  | (AnyStandardSchemaValidateSuccess | AnyStandardSchemaValidateFailure)\n  | Promise<AnyStandardSchemaValidateSuccess | AnyStandardSchemaValidateFailure>\n\nexport interface ValidatorObj<TInput, TOutput> {\n  parse: ValidatorFn<TInput, TOutput>\n}\n\nexport type AnyValidatorObj = ValidatorObj<any, any>\n\nexport interface ValidatorAdapter<TInput, TOutput> {\n  types: {\n    input: TInput\n    output: TOutput\n  }\n  parse: (input: unknown) => TOutput\n}\n\nexport type AnyValidatorAdapter = ValidatorAdapter<any, any>\n\nexport type AnyValidatorFn = ValidatorFn<any, any>\n\nexport type ValidatorFn<TInput, TOutput> = (input: TInput) => TOutput\n\nexport type Validator<TInput, TOutput> =\n  | ValidatorObj<TInput, TOutput>\n  | ValidatorFn<TInput, TOutput>\n  | ValidatorAdapter<TInput, TOutput>\n  | StandardSchemaValidator<TInput, TOutput>\n  | undefined\n\nexport type AnyValidator = Validator<any, any>\n\nexport type AnySchema = {}\n\nexport type DefaultValidator = Validator<Record<string, unknown>, AnySchema>\n\nexport type ResolveSearchValidatorInputFn<TValidator> = TValidator extends (\n  input: infer TSchemaInput,\n) => any\n  ? TSchemaInput extends SearchSchemaInput\n    ? Omit<TSchemaInput, keyof SearchSchemaInput>\n    : ResolveValidatorOutputFn<TValidator>\n  : AnySchema\n\nexport type ResolveSearchValidatorInput<TValidator> =\n  TValidator extends AnyStandardSchemaValidator\n    ? NonNullable<TValidator['~standard']['types']>['input']\n    : TValidator extends AnyValidatorAdapter\n      ? TValidator['types']['input']\n      : TValidator extends AnyValidatorObj\n        ? ResolveSearchValidatorInputFn<TValidator['parse']>\n        : ResolveSearchValidatorInputFn<TValidator>\n\nexport type ResolveValidatorInputFn<TValidator> = TValidator extends (\n  input: infer TInput,\n) => any\n  ? TInput\n  : undefined\n\nexport type ResolveValidatorInput<TValidator> =\n  TValidator extends AnyStandardSchemaValidator\n    ? NonNullable<TValidator['~standard']['types']>['input']\n    : TValidator extends AnyValidatorAdapter\n      ? TValidator['types']['input']\n      : TValidator extends AnyValidatorObj\n        ? ResolveValidatorInputFn<TValidator['parse']>\n        : ResolveValidatorInputFn<TValidator>\n\nexport type ResolveValidatorOutputFn<TValidator> = TValidator extends (\n  ...args: any\n) => infer TSchema\n  ? TSchema\n  : AnySchema\n\nexport type ResolveValidatorOutput<TValidator> = unknown extends TValidator\n  ? TValidator\n  : TValidator extends AnyStandardSchemaValidator\n    ? NonNullable<TValidator['~standard']['types']>['output']\n    : TValidator extends AnyValidatorAdapter\n      ? TValidator['types']['output']\n      : TValidator extends AnyValidatorObj\n        ? ResolveValidatorOutputFn<TValidator['parse']>\n        : ResolveValidatorOutputFn<TValidator>\n"
  },
  {
    "path": "packages/router-core/src/vite-env.d.ts",
    "content": "declare module '*?script-string' {\n  const content: string\n  export default content\n}\n"
  },
  {
    "path": "packages/router-core/tests/RawStream.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport { toCrossJSONAsync, fromCrossJSON } from 'seroval'\nimport {\n  RawStream,\n  createRawStreamRPCPlugin,\n  createRawStreamDeserializePlugin,\n} from '../src/ssr/serializer/RawStream'\n\ndescribe('RawStream', () => {\n  describe('RawStream class', () => {\n    it('should wrap a ReadableStream<Uint8Array>', () => {\n      const stream = new ReadableStream<Uint8Array>({\n        start(controller) {\n          controller.enqueue(new Uint8Array([1, 2, 3]))\n          controller.close()\n        },\n      })\n      const rawStream = new RawStream(stream)\n      expect(rawStream.stream).toBe(stream)\n    })\n\n    it('should be an instance of RawStream', () => {\n      const stream = new ReadableStream<Uint8Array>()\n      const rawStream = new RawStream(stream)\n      expect(rawStream instanceof RawStream).toBe(true)\n    })\n\n    it('should default to binary hint', () => {\n      const stream = new ReadableStream<Uint8Array>()\n      const rawStream = new RawStream(stream)\n      expect(rawStream.hint).toBe('binary')\n    })\n\n    it('should accept binary hint option', () => {\n      const stream = new ReadableStream<Uint8Array>()\n      const rawStream = new RawStream(stream, { hint: 'binary' })\n      expect(rawStream.hint).toBe('binary')\n    })\n\n    it('should accept text hint option', () => {\n      const stream = new ReadableStream<Uint8Array>()\n      const rawStream = new RawStream(stream, { hint: 'text' })\n      expect(rawStream.hint).toBe('text')\n    })\n  })\n\n  describe('createRawStreamRPCPlugin', () => {\n    it('should call onRawStream callback with stream id and stream', async () => {\n      const collectedStreams = new Map<number, ReadableStream<Uint8Array>>()\n\n      const plugin = createRawStreamRPCPlugin((id, stream) => {\n        collectedStreams.set(id, stream)\n      })\n\n      const testStream = new ReadableStream<Uint8Array>({\n        start(controller) {\n          controller.enqueue(new Uint8Array([1, 2, 3]))\n          controller.close()\n        },\n      })\n\n      const rawStream = new RawStream(testStream)\n\n      await toCrossJSONAsync(rawStream, {\n        refs: new Map(),\n        plugins: [plugin],\n      })\n\n      expect(collectedStreams.size).toBe(1)\n      // Stream ID is assigned by our internal counter (sequential starting at 1)\n      const streamEntry = Array.from(collectedStreams.entries())[0]\n      expect(streamEntry).toBeDefined()\n      expect(streamEntry![1]).toBe(testStream)\n    })\n\n    it('should serialize with tss/RawStream tag', async () => {\n      const plugin = createRawStreamRPCPlugin(() => {})\n\n      const testStream = new ReadableStream<Uint8Array>()\n      const rawStream = new RawStream(testStream)\n\n      const serialized = await toCrossJSONAsync(rawStream, {\n        refs: new Map(),\n        plugins: [plugin],\n      })\n\n      // The serialized output should have the plugin tag and contain streamId\n      const jsonStr = JSON.stringify(serialized)\n      expect(jsonStr).toContain('tss/RawStream')\n      expect(jsonStr).toContain('streamId')\n    })\n\n    it('should collect multiple streams with unique ids', async () => {\n      const collectedStreams = new Map<number, ReadableStream<Uint8Array>>()\n\n      const plugin = createRawStreamRPCPlugin((id, stream) => {\n        collectedStreams.set(id, stream)\n      })\n\n      const stream1 = new ReadableStream<Uint8Array>()\n      const stream2 = new ReadableStream<Uint8Array>()\n\n      const data = {\n        first: new RawStream(stream1),\n        second: new RawStream(stream2),\n      }\n\n      await toCrossJSONAsync(data, {\n        refs: new Map(),\n        plugins: [plugin],\n      })\n\n      expect(collectedStreams.size).toBe(2)\n      const ids = Array.from(collectedStreams.keys())\n      expect(ids[0]).not.toBe(ids[1])\n    })\n  })\n\n  describe('createRawStreamDeserializePlugin', () => {\n    it('should reconstruct stream from getOrCreateStream function', () => {\n      const mockStream = new ReadableStream<Uint8Array>({\n        start(controller) {\n          controller.enqueue(new Uint8Array([42]))\n          controller.close()\n        },\n      })\n\n      const streams = new Map<number, ReadableStream<Uint8Array>>()\n      streams.set(5, mockStream)\n\n      // getOrCreateStream function that returns from map\n      const getOrCreateStream = (id: number) => {\n        let stream = streams.get(id)\n        if (!stream) {\n          stream = new ReadableStream<Uint8Array>()\n          streams.set(id, stream)\n        }\n        return stream\n      }\n\n      const plugin = createRawStreamDeserializePlugin(getOrCreateStream)\n\n      // Simulate seroval calling deserialize with a node\n      const node = { streamId: 5 }\n\n      // Access the deserialize function directly\n      const deserializedStream = (plugin as any).deserialize(node, {})\n\n      expect(deserializedStream).toBe(mockStream)\n    })\n\n    it('should create stream if not found', () => {\n      const streams = new Map<number, ReadableStream<Uint8Array>>()\n\n      const getOrCreateStream = (id: number) => {\n        let stream = streams.get(id)\n        if (!stream) {\n          stream = new ReadableStream<Uint8Array>()\n          streams.set(id, stream)\n        }\n        return stream\n      }\n\n      const plugin = createRawStreamDeserializePlugin(getOrCreateStream)\n\n      const node = { streamId: 999 }\n\n      const result = (plugin as any).deserialize(node, {})\n      expect(result).toBeInstanceOf(ReadableStream)\n      expect(streams.get(999)).toBe(result)\n    })\n  })\n\n  describe('round-trip serialization', () => {\n    it('should serialize and deserialize RawStream correctly', async () => {\n      // Collect streams during serialization\n      const collectedStreams = new Map<number, ReadableStream<Uint8Array>>()\n      const rpcPlugin = createRawStreamRPCPlugin((id, stream) => {\n        collectedStreams.set(id, stream)\n      })\n\n      const testStream = new ReadableStream<Uint8Array>({\n        start(controller) {\n          controller.enqueue(new Uint8Array([1, 2, 3]))\n          controller.close()\n        },\n      })\n\n      const data = {\n        message: 'test',\n        rawData: new RawStream(testStream),\n      }\n\n      // Serialize using RPC plugin\n      const refs = new Map()\n      const serialized = await toCrossJSONAsync(data, {\n        refs,\n        plugins: [rpcPlugin],\n      })\n\n      // Verify we collected the stream\n      expect(collectedStreams.size).toBe(1)\n      const streamId = Array.from(collectedStreams.keys())[0]!\n\n      // Create getOrCreateStream function\n      const getOrCreateStream = (id: number) => {\n        const stream = collectedStreams.get(id)\n        if (!stream) {\n          throw new Error(`Stream ${id} not found in collected streams`)\n        }\n        return stream\n      }\n\n      // Create deserialize plugin with function\n      const deserializePlugin =\n        createRawStreamDeserializePlugin(getOrCreateStream)\n\n      // Deserialize\n      const deserialized = fromCrossJSON(serialized, {\n        refs: new Map(),\n        plugins: [deserializePlugin],\n      }) as any\n\n      expect(deserialized.message).toBe('test')\n      expect(deserialized.rawData).toBe(testStream)\n    })\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/build-location.test.ts",
    "content": "import { describe, expect, test, vi } from 'vitest'\nimport { createMemoryHistory } from '@tanstack/history'\nimport { BaseRootRoute, BaseRoute } from '../src'\nimport { createTestRouter } from './routerTestUtils'\n\ndescribe('buildLocation - params function receives parsed params', () => {\n  test('prev params should contain parsed params from route params.parse', async () => {\n    const rootRoute = new BaseRootRoute({})\n\n    // Create a route with params.parse that transforms string to number\n    const userRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n      params: {\n        parse: ({ userId }: { userId: string }) => ({\n          userId: parseInt(userId, 10),\n        }),\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([userRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/123'] }),\n    })\n\n    // Load to establish current location with parsed params\n    await router.load()\n\n    // Track what params the function receives (clone to avoid mutation)\n    const updater = vi.fn()\n\n    router.buildLocation({\n      from: '/users/$userId',\n      to: '/users/$userId',\n      params: updater,\n    })\n\n    // The prev params should be parsed (number), not raw string\n    expect(updater).toHaveBeenCalledOnce()\n    expect(updater).toHaveBeenCalledWith({ userId: 123 })\n  })\n\n  test('prev params should accumulate parsed params from all routes in the branch', async () => {\n    const rootRoute = new BaseRootRoute({})\n\n    // Parent route with params.parse\n    const orgRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/orgs/$orgId',\n      params: {\n        parse: ({ orgId }: { orgId: string }) => ({\n          orgId: parseInt(orgId, 10),\n        }),\n      },\n    })\n\n    // Child route with its own params.parse\n    const userRoute = new BaseRoute({\n      getParentRoute: () => orgRoute,\n      path: '/users/$userId',\n      params: {\n        parse: ({ userId }: { userId: string }) => ({\n          userId: parseInt(userId, 10),\n        }),\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([orgRoute.addChildren([userRoute])])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/orgs/42/users/123'] }),\n    })\n\n    await router.load()\n\n    const updater = vi.fn()\n\n    router.buildLocation({\n      from: '/orgs/$orgId/users/$userId',\n      to: '/orgs/$orgId/users/$userId',\n      params: updater,\n    })\n\n    // Both params should be parsed (numbers)\n    expect(updater).toHaveBeenCalledOnce()\n    expect(updater).toHaveBeenCalledWith({ orgId: 42, userId: 123 })\n  })\n\n  test('prev params should contain parsed params when navigating to different route', async () => {\n    const rootRoute = new BaseRootRoute({})\n\n    const userRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n      params: {\n        parse: ({ userId }: { userId: string }) => ({\n          userId: parseInt(userId, 10),\n        }),\n      },\n    })\n\n    const postRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/$postId',\n      params: {\n        parse: ({ postId }: { postId: string }) => ({\n          postId: parseInt(postId, 10),\n        }),\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([userRoute, postRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/123'] }),\n    })\n\n    await router.load()\n\n    const updater = vi.fn()\n\n    // Navigate from /users/$userId to /posts/$postId\n    // The prev should contain parsed params from the current (from) route\n    router.buildLocation({\n      from: '/users/$userId',\n      to: '/posts/$postId',\n      params: updater,\n    })\n\n    // The prev params should be from the current route (parsed userId)\n    // Note: prev may also contain the new postId param merged in\n    expect(updater).toHaveBeenCalledOnce()\n    expect(updater).toHaveBeenCalledWith({ userId: 123 })\n  })\n\n  test('params without parse function remain as strings in prev', async () => {\n    const rootRoute = new BaseRootRoute({})\n\n    // Route without params.parse\n    const userRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n    })\n\n    const routeTree = rootRoute.addChildren([userRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/123'] }),\n    })\n\n    await router.load()\n\n    const updater = vi.fn()\n\n    router.buildLocation({\n      from: '/users/$userId',\n      to: '/users/$userId',\n      params: updater,\n    })\n\n    // Without params.parse, the param should remain a string\n    expect(updater).toHaveBeenCalledOnce()\n    expect(updater).toHaveBeenCalledWith({ userId: '123' })\n  })\n\n  test('mixed routes with and without params.parse', async () => {\n    const rootRoute = new BaseRootRoute({})\n\n    // Parent route WITH params.parse\n    const orgRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/orgs/$orgId',\n      params: {\n        parse: ({ orgId }: { orgId: string }) => ({\n          orgId: parseInt(orgId, 10),\n        }),\n      },\n    })\n\n    // Child route WITHOUT params.parse\n    const teamRoute = new BaseRoute({\n      getParentRoute: () => orgRoute,\n      path: '/teams/$teamSlug',\n    })\n\n    const routeTree = rootRoute.addChildren([orgRoute.addChildren([teamRoute])])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/orgs/42/teams/engineering'],\n      }),\n    })\n\n    await router.load()\n\n    const updater = vi.fn()\n\n    router.buildLocation({\n      from: '/orgs/$orgId/teams/$teamSlug',\n      to: '/orgs/$orgId/teams/$teamSlug',\n      params: updater,\n    })\n\n    expect(updater).toHaveBeenCalledOnce()\n    expect(updater).toHaveBeenCalledWith({ orgId: 42, teamSlug: 'engineering' })\n  })\n})\n\ndescribe('buildLocation - search params', () => {\n  test('search as object should set search params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: { page: 1, filter: 'active' },\n    })\n\n    expect(location.search).toEqual({ page: 1, filter: 'active' })\n    expect(location.searchStr).toContain('page=1')\n    expect(location.searchStr).toContain('filter=active')\n  })\n\n  test('search as function should receive current search and return new search', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts?page=1'] }),\n    })\n\n    await router.load()\n\n    const searchUpdater = vi.fn((prev: { page?: number }) => ({\n      ...prev,\n      page: (prev.page || 0) + 1,\n    }))\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: searchUpdater,\n    })\n\n    expect(searchUpdater).toHaveBeenCalledOnce()\n    expect(searchUpdater).toHaveBeenCalledWith({ page: 1 })\n    expect(location.search).toEqual({ page: 2 })\n  })\n\n  test('search: true should preserve current search params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/posts?page=5&filter=active'],\n      }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: true,\n    })\n\n    expect(location.search).toEqual({ page: 5, filter: 'active' })\n  })\n\n  test('search object should merge with current search when using function', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/posts?existing=value'],\n      }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: (prev: Record<string, unknown>) => ({\n        ...prev,\n        newKey: 'newValue',\n      }),\n    })\n\n    expect(location.search).toEqual({ existing: 'value', newKey: 'newValue' })\n  })\n\n  test('search with validateSearch on route should validate search params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      validateSearch: (search: Record<string, unknown>) => ({\n        page: Number(search.page) + 1,\n      }),\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts?page=5'] }),\n      search: { strict: true },\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: { page: 10 },\n      _includeValidateSearch: true,\n    } as any)\n\n    expect(location.search).toEqual({ page: 11 })\n  })\n\n  test('empty search object should clear search params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/posts?page=1&filter=active'],\n      }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: {},\n    })\n\n    expect(location.search).toEqual({})\n    expect(location.searchStr).toBe('')\n  })\n\n  test('search function returning empty object should clear search params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/posts?page=1'],\n      }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: () => ({}),\n    })\n\n    expect(location.search).toEqual({})\n  })\n})\n\ndescribe('buildLocation - hash', () => {\n  test('hash as string should set the hash', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      hash: 'section1',\n    })\n\n    expect(location.hash).toBe('section1')\n    expect(location.href).toContain('#section1')\n  })\n\n  test('hash as function should receive current hash and return new hash', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts#current'] }),\n    })\n\n    await router.load()\n\n    const hashUpdater = vi.fn((prev?: string) => `${prev}-updated`)\n\n    const location = router.buildLocation({\n      to: '/posts',\n      hash: hashUpdater,\n    })\n\n    expect(hashUpdater).toHaveBeenCalledOnce()\n    expect(hashUpdater).toHaveBeenCalledWith('current')\n    expect(location.hash).toBe('current-updated')\n  })\n\n  test('hash: true should preserve current hash', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts#existing'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      hash: true,\n    })\n\n    expect(location.hash).toBe('existing')\n    expect(location.href).toContain('#existing')\n  })\n\n  test('no hash option should result in empty hash', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts#existing'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n    })\n\n    expect(location.hash).toBe('')\n    expect(location.href).not.toContain('#')\n  })\n\n  test('empty string hash should clear the hash', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts#existing'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      hash: '',\n    })\n\n    expect(location.hash).toBe('')\n    expect(location.href).not.toContain('#')\n  })\n})\n\ndescribe('buildLocation - state', () => {\n  test('state as object should set state', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      state: { modal: true, count: 5 } as any,\n    })\n\n    expect(location.state).toEqual({ modal: true, count: 5 })\n  })\n\n  test('state as function should receive current state and return new state', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const history = createMemoryHistory({ initialEntries: ['/posts'] })\n    // Set initial state on history\n    history.replace('/posts', { existing: 'value' })\n\n    const router = createTestRouter({\n      routeTree,\n      history,\n    })\n\n    await router.load()\n\n    const stateUpdater = vi.fn((prev: Record<string, unknown>) => ({\n      ...prev,\n      newKey: 'newValue',\n    }))\n\n    const location = router.buildLocation({\n      to: '/posts',\n      state: stateUpdater as any,\n    })\n\n    expect(stateUpdater).toHaveBeenCalledOnce()\n    // State includes internal router keys, so use toMatchObject\n    expect(location.state).toMatchObject({\n      existing: 'value',\n      newKey: 'newValue',\n    })\n  })\n\n  test('state: true should preserve current state', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const history = createMemoryHistory({ initialEntries: ['/posts'] })\n    history.replace('/posts', { preserved: true })\n\n    const router = createTestRouter({\n      routeTree,\n      history,\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      state: true,\n    })\n\n    // State includes internal router keys, so use toMatchObject\n    expect(location.state).toMatchObject({ preserved: true })\n  })\n\n  test('no state option should result in empty state', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const history = createMemoryHistory({ initialEntries: ['/posts'] })\n    history.replace('/posts', { existing: 'value' })\n\n    const router = createTestRouter({\n      routeTree,\n      history,\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n    })\n\n    expect(location.state).toEqual({})\n  })\n\n  test('state can contain complex nested objects', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const complexState = {\n      user: { id: 1, name: 'Test' },\n      items: [1, 2, 3],\n      nested: { deep: { value: true } },\n    }\n\n    const location = router.buildLocation({\n      to: '/posts',\n      state: complexState as any,\n    })\n\n    expect(location.state).toEqual(complexState)\n  })\n})\n\ndescribe('buildLocation - relative paths', () => {\n  test('absolute path should navigate to exact route', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n    const aboutRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute, aboutRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      from: '/posts',\n      to: '/about',\n    })\n\n    expect(location.pathname).toBe('/about')\n  })\n\n  test('./ prefix should resolve relative to current route', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n    const postDetailRoute = new BaseRoute({\n      getParentRoute: () => postsRoute,\n      path: '/detail',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      postsRoute.addChildren([postDetailRoute]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: './detail',\n    })\n\n    expect(location.pathname).toBe('/posts/detail')\n  })\n\n  test('../ prefix should resolve up one path segment', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n    const postDetailRoute = new BaseRoute({\n      getParentRoute: () => postsRoute,\n      path: '/detail',\n    })\n    const postAboutRoute = new BaseRoute({\n      getParentRoute: () => postsRoute,\n      path: '/about',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      postsRoute.addChildren([postDetailRoute, postAboutRoute]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts/detail'] }),\n    })\n\n    await router.load()\n\n    // ../ goes up one segment from 'detail' to 'posts', then adds 'about'\n    const location = router.buildLocation({\n      to: '../about',\n    })\n\n    expect(location.pathname).toBe('/posts/about')\n  })\n\n  test('multiple ../ should navigate up multiple path segments', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const aRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/a',\n    })\n    const bRoute = new BaseRoute({\n      getParentRoute: () => aRoute,\n      path: '/b',\n    })\n    const cRoute = new BaseRoute({\n      getParentRoute: () => bRoute,\n      path: '/c',\n    })\n    const dRoute = new BaseRoute({\n      getParentRoute: () => aRoute,\n      path: '/d',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      aRoute.addChildren([bRoute.addChildren([cRoute]), dRoute]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/a/b/c'] }),\n    })\n\n    await router.load()\n\n    // ../../d from /a/b/c goes up from 'c' to 'b', then from 'b' to 'a', then adds 'd'\n    const location = router.buildLocation({\n      to: '../../d',\n    })\n\n    expect(location.pathname).toBe('/a/d')\n  })\n\n  test('. should stay on current route', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '.',\n    })\n\n    expect(location.pathname).toBe('/posts')\n  })\n\n  test('relative path with child segment', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const usersRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users',\n    })\n    const userRoute = new BaseRoute({\n      getParentRoute: () => usersRoute,\n      path: '/$userId',\n    })\n    const settingsRoute = new BaseRoute({\n      getParentRoute: () => userRoute,\n      path: '/settings',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      usersRoute.addChildren([userRoute.addChildren([settingsRoute])]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      from: '/users/$userId',\n      to: './settings',\n      params: { userId: '123' },\n    })\n\n    expect(location.pathname).toBe('/users/123/settings')\n  })\n})\n\ndescribe('buildLocation - basepath', () => {\n  test('basepath should be included in href but not pathname', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      basepath: '/app',\n      history: createMemoryHistory({ initialEntries: ['/app/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n    })\n\n    // pathname is the route path without basepath\n    expect(location.pathname).toBe('/posts')\n    // href includes the basepath\n    expect(location.href).toBe('/app/posts')\n  })\n\n  test('basepath should work with nested routes', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n    const postRoute = new BaseRoute({\n      getParentRoute: () => postsRoute,\n      path: '/$postId',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      basepath: '/app',\n      history: createMemoryHistory({ initialEntries: ['/app/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts/$postId',\n      params: { postId: '123' },\n    })\n\n    expect(location.pathname).toBe('/posts/123')\n    expect(location.href).toBe('/app/posts/123')\n  })\n\n  test('basepath with trailing slash should work correctly', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      basepath: '/app/',\n      history: createMemoryHistory({ initialEntries: ['/app/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n    })\n\n    // Should normalize the basepath correctly\n    expect(location.pathname).toBe('/posts')\n    expect(location.href).toBe('/app/posts')\n  })\n\n  test('navigating to root with basepath', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      basepath: '/app',\n      history: createMemoryHistory({ initialEntries: ['/app/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/',\n    })\n\n    expect(location.pathname).toBe('/')\n    // Root with basepath includes trailing slash\n    expect(location.href).toBe('/app/')\n  })\n})\n\ndescribe('buildLocation - params edge cases', () => {\n  test('params: true should preserve current params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const userRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n    })\n\n    const routeTree = rootRoute.addChildren([userRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/123'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/users/$userId',\n      params: true,\n    })\n\n    expect(location.pathname).toBe('/users/123')\n  })\n\n  test('params as object should set specific params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const userRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n    })\n\n    const routeTree = rootRoute.addChildren([userRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/123'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/users/$userId',\n      params: { userId: '456' },\n    })\n\n    expect(location.pathname).toBe('/users/456')\n  })\n\n  test('params as object should merge with current params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const orgRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/orgs/$orgId',\n    })\n    const userRoute = new BaseRoute({\n      getParentRoute: () => orgRoute,\n      path: '/users/$userId',\n    })\n\n    const routeTree = rootRoute.addChildren([orgRoute.addChildren([userRoute])])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/orgs/abc/users/123'] }),\n    })\n\n    await router.load()\n\n    // Only update userId, orgId should be preserved\n    const location = router.buildLocation({\n      to: '/orgs/$orgId/users/$userId',\n      params: (prev: { orgId: string; userId: string }) => ({\n        ...prev,\n        userId: '456',\n      }),\n    })\n\n    expect(location.pathname).toBe('/orgs/abc/users/456')\n  })\n\n  test('params.stringify should transform params with custom formatting', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const userRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n      params: {\n        parse: ({ userId }: { userId: string }) => ({\n          userId: parseInt(userId, 10),\n        }),\n        // Stringify pads the userId to 6 digits\n        stringify: ({ userId }: { userId: number }) => ({\n          userId: String(userId).padStart(6, '0'),\n        }),\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([userRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/000123'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/users/$userId',\n      params: { userId: 42 },\n    })\n\n    // Without stringify, this would be '/users/42'\n    // With stringify, it should be padded to 6 digits\n    expect(location.pathname).toBe('/users/000042')\n  })\n\n  test('params.stringify in nested routes should all be applied', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const orgRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/orgs/$orgId',\n      params: {\n        parse: ({ orgId }: { orgId: string }) => ({\n          orgId: parseInt(orgId, 10),\n        }),\n        // Prefix org IDs with 'org-'\n        stringify: ({ orgId }: { orgId: number }) => ({\n          orgId: `org-${orgId}`,\n        }),\n      },\n    })\n    const userRoute = new BaseRoute({\n      getParentRoute: () => orgRoute,\n      path: '/users/$userId',\n      params: {\n        parse: ({ userId }: { userId: string }) => ({\n          userId: parseInt(userId, 10),\n        }),\n        // Prefix user IDs with 'user-'\n        stringify: ({ userId }: { userId: number }) => ({\n          userId: `user-${userId}`,\n        }),\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([orgRoute.addChildren([userRoute])])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/orgs/org-1/users/user-1'],\n      }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/orgs/$orgId/users/$userId',\n      params: { orgId: 42, userId: 123 },\n    })\n\n    // Both stringify functions should be applied\n    expect(location.pathname).toBe('/orgs/org-42/users/user-123')\n  })\n\n  test('params function can transform params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const userRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n    })\n\n    const routeTree = rootRoute.addChildren([userRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/123'] }),\n    })\n\n    await router.load()\n\n    // Transform the userId by appending a suffix\n    const location = router.buildLocation({\n      to: '/users/$userId',\n      params: (prev: { userId: string }) => ({\n        userId: `${prev.userId}-updated`,\n      }),\n    })\n\n    expect(location.pathname).toBe('/users/123-updated')\n  })\n})\n\ndescribe('buildLocation - location output structure', () => {\n  test('location should contain all expected properties', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: { page: 1 },\n      hash: 'section',\n      state: { modal: true } as any,\n    })\n\n    // Verify all expected properties exist\n    expect(location).toEqual({\n      external: false,\n      hash: 'section',\n      href: '/posts?page=1#section',\n      pathname: '/posts',\n      publicHref: '/posts?page=1#section',\n      search: {\n        page: 1,\n      },\n      searchStr: '?page=1',\n      state: {\n        modal: true,\n      },\n      unmaskOnReload: undefined,\n    })\n  })\n\n  test('empty search should result in empty searchStr', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      search: {},\n    })\n\n    expect(location.searchStr).toBe('')\n    expect(location.href).toBe('/posts')\n  })\n})\n\ndescribe('buildLocation - optional params', () => {\n  test('optional param provided should be included in pathname', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts/{-$category}',\n      params: { category: 'tech' },\n    })\n\n    expect(location.pathname).toBe('/posts/tech')\n  })\n\n  test('optional param omitted should not appear in pathname', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts/{-$category}',\n      params: {},\n    })\n\n    expect(location.pathname).toBe('/posts')\n  })\n\n  test('multiple optional params - all provided', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}/{-$slug}',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts/{-$category}/{-$slug}',\n      params: { category: 'tech', slug: 'hello-world' },\n    })\n\n    expect(location.pathname).toBe('/posts/tech/hello-world')\n  })\n\n  test('multiple optional params - partially provided', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}/{-$slug}',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts/{-$category}/{-$slug}',\n      params: { category: 'tech' },\n    })\n\n    expect(location.pathname).toBe('/posts/tech')\n  })\n\n  test('mixed required and optional params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const usersRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId/{-$tab}',\n    })\n\n    const routeTree = rootRoute.addChildren([usersRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/123'] }),\n    })\n\n    await router.load()\n\n    // With optional param\n    const locationWithTab = router.buildLocation({\n      to: '/users/$userId/{-$tab}',\n      params: { userId: '123', tab: 'settings' },\n    })\n    expect(locationWithTab.pathname).toBe('/users/123/settings')\n\n    // Without optional param\n    const locationWithoutTab = router.buildLocation({\n      to: '/users/$userId/{-$tab}',\n      params: { userId: '123' },\n    })\n    expect(locationWithoutTab.pathname).toBe('/users/123')\n  })\n})\n\ndescribe('buildLocation - splat params', () => {\n  test('splat param should capture path segments', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const docsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/docs/$',\n    })\n\n    const routeTree = rootRoute.addChildren([docsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/docs'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/docs/$',\n      params: { _splat: 'getting-started/installation' },\n    })\n\n    expect(location.pathname).toBe('/docs/getting-started/installation')\n  })\n\n  test('splat param with single segment', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const docsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/docs/$',\n    })\n\n    const routeTree = rootRoute.addChildren([docsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/docs'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/docs/$',\n      params: { _splat: 'overview' },\n    })\n\n    expect(location.pathname).toBe('/docs/overview')\n  })\n\n  test('splat param empty should result in base path', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const docsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/docs/$',\n    })\n\n    const routeTree = rootRoute.addChildren([docsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/docs'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/docs/$',\n      params: { _splat: '' },\n    })\n\n    expect(location.pathname).toBe('/docs')\n  })\n\n  test('splat param with prefix', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const filesRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/files/prefix{$}',\n    })\n\n    const routeTree = rootRoute.addChildren([filesRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/files'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/files/prefix{$}',\n      params: { _splat: 'path/to/file' },\n    })\n\n    expect(location.pathname).toBe('/files/prefixpath/to/file')\n  })\n})\n\ndescribe('buildLocation - _fromLocation override', () => {\n  test('_fromLocation should override current location for search resolution', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts?page=1'] }),\n    })\n\n    await router.load()\n\n    // Override the current location with a different search\n    const location = router.buildLocation({\n      to: '/posts',\n      search: true, // Preserve search from _fromLocation\n      _fromLocation: {\n        pathname: '/posts',\n        search: { page: 5 },\n        searchStr: '?page=5',\n        hash: '',\n        href: '/posts?page=5',\n        state: {},\n      },\n    } as any)\n\n    // Should use search from _fromLocation, not current location\n    expect(location.search).toEqual({ page: 5 })\n  })\n\n  test('_fromLocation should override current location for hash resolution', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/posts#original'] }),\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      hash: true, // Preserve hash from _fromLocation\n      _fromLocation: {\n        pathname: '/posts',\n        search: {},\n        searchStr: '',\n        hash: 'overridden',\n        href: '/posts#overridden',\n        state: {},\n      },\n    } as any)\n\n    expect(location.hash).toBe('overridden')\n  })\n\n  test('_fromLocation should override current location for state resolution', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const routeTree = rootRoute.addChildren([postsRoute])\n\n    const history = createMemoryHistory({ initialEntries: ['/posts'] })\n    history.replace('/posts', { original: true })\n\n    const router = createTestRouter({\n      routeTree,\n      history,\n    })\n\n    await router.load()\n\n    const location = router.buildLocation({\n      to: '/posts',\n      state: true, // Preserve state from _fromLocation\n      _fromLocation: {\n        pathname: '/posts',\n        search: {},\n        searchStr: '',\n        hash: '',\n        href: '/posts',\n        state: { overridden: true },\n      },\n    } as any)\n\n    expect(location.state).toMatchObject({ overridden: true })\n  })\n\n  test('_fromLocation should be used for relative path resolution', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const usersRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users',\n    })\n    const userRoute = new BaseRoute({\n      getParentRoute: () => usersRoute,\n      path: '/$userId',\n    })\n    const settingsRoute = new BaseRoute({\n      getParentRoute: () => userRoute,\n      path: '/settings',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      usersRoute.addChildren([userRoute.addChildren([settingsRoute])]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/users/123'] }),\n    })\n\n    await router.load()\n\n    // When _fromLocation is provided, it affects the context for resolution\n    const location = router.buildLocation({\n      to: './settings',\n      params: { userId: '456' },\n      _fromLocation: {\n        pathname: '/users/456',\n        search: {},\n        searchStr: '',\n        hash: '',\n        href: '/users/456',\n        state: {},\n      },\n    } as any)\n\n    expect(location.pathname).toBe('/users/456/settings')\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/callbacks.test.ts",
    "content": "import { describe, expect, it, test, vi } from 'vitest'\nimport { createMemoryHistory } from '@tanstack/history'\nimport { BaseRootRoute, BaseRoute } from '../src'\nimport { createTestRouter } from './routerTestUtils'\n\ndescribe('callbacks', () => {\n  const setup = ({\n    onEnter,\n    onLeave,\n    onStay,\n  }: {\n    onEnter?: () => void\n    onLeave?: () => void\n    onStay?: () => void\n  }) => {\n    const rootRoute = new BaseRootRoute({})\n\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      onLeave,\n      onEnter,\n      onStay,\n    })\n\n    const barRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/bar',\n      onLeave,\n      onEnter,\n      onStay,\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute, barRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    return router\n  }\n\n  const createFooRouter = (\n    opts: {\n      onEnter?: () => void\n      onLeave?: () => void\n      onStay?: () => void\n      loader?: () => unknown\n      staleTime?: number\n    } = {},\n  ) => {\n    const rootRoute = new BaseRootRoute({})\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n        page: search['page'],\n      }),\n      onEnter: opts.onEnter,\n      onLeave: opts.onLeave,\n      onStay: opts.onStay,\n      loader: opts.loader,\n      staleTime: opts.staleTime,\n      gcTime: opts.staleTime,\n    })\n    return createTestRouter({\n      routeTree: rootRoute.addChildren([fooRoute]),\n      history: createMemoryHistory(),\n    })\n  }\n  describe('onEnter', () => {\n    it('runs on navigate to a new route', async () => {\n      const onEnter = vi.fn()\n      const router = setup({ onEnter })\n\n      // Entering foo\n      await router.navigate({ to: '/foo' })\n      expect(onEnter).toHaveBeenNthCalledWith(\n        1,\n        expect.objectContaining({ id: '/foo/foo' }),\n      )\n\n      // Entering bar\n      await router.navigate({ to: '/bar' })\n      expect(onEnter).toHaveBeenNthCalledWith(\n        2,\n        expect.objectContaining({ id: '/bar/bar' }),\n      )\n    })\n  })\n\n  describe('onLeave', () => {\n    it('runs on navigate from a previous route', async () => {\n      const onLeave = vi.fn()\n      const router = setup({ onLeave })\n      await router.navigate({ to: '/foo' })\n\n      // Leaving foo to bar\n      await router.navigate({ to: '/bar' })\n      expect(onLeave).toHaveBeenNthCalledWith(\n        1,\n        expect.objectContaining({ id: '/foo/foo' }),\n      )\n\n      // Leaving bar to foo\n      await router.navigate({ to: '/foo' })\n      expect(onLeave).toHaveBeenNthCalledWith(\n        2,\n        expect.objectContaining({ id: '/bar/bar' }),\n      )\n    })\n  })\n\n  describe('onStay', () => {\n    it('runs on navigate to the same route', async () => {\n      const onStay = vi.fn()\n      const router = setup({ onStay })\n      await router.navigate({ to: '/foo' })\n\n      // Staying on foo\n      await router.navigate({ to: '/foo', search: { foo: 'baz' } })\n      expect(onStay).toHaveBeenNthCalledWith(\n        1,\n        expect.objectContaining({ id: '/foo/foo', search: { foo: 'baz' } }),\n      )\n\n      // Staying on foo\n      await router.navigate({ to: '/foo', search: { foo: 'quux' } })\n      expect(onStay).toHaveBeenNthCalledWith(\n        2,\n        expect.objectContaining({ id: '/foo/foo', search: { foo: 'quux' } }),\n      )\n    })\n\n    it('runs instead of onLeave/onEnter when loaderDeps change from search param updates', async () => {\n      const onEnter = vi.fn()\n      const onLeave = vi.fn()\n      const onStay = vi.fn()\n      const router = createFooRouter({ onEnter, onLeave, onStay })\n\n      // Navigate to foo — onEnter should fire\n      await router.navigate({ to: '/foo', search: { page: '1' } })\n      expect(onEnter).toHaveBeenCalledTimes(1)\n      expect(onLeave).toHaveBeenCalledTimes(0)\n      expect(onStay).toHaveBeenCalledTimes(0)\n\n      // Update search param that's in loaderDeps — onStay should fire, not onLeave+onEnter\n      await router.navigate({ to: '/foo', search: { page: '2' } })\n      expect(onEnter).toHaveBeenCalledTimes(1) // no new onEnter\n      expect(onLeave).toHaveBeenCalledTimes(0) // no onLeave\n      expect(onStay).toHaveBeenCalledTimes(1) // onStay fires\n\n      // Update again — onStay fires again\n      await router.navigate({ to: '/foo', search: { page: '3' } })\n      expect(onEnter).toHaveBeenCalledTimes(1)\n      expect(onLeave).toHaveBeenCalledTimes(0)\n      expect(onStay).toHaveBeenCalledTimes(2)\n    })\n  })\n\n  // Regression tests: switching lifecycle hooks to use routeId must NOT break\n  // match-level caching, which still relies on match.id (routeId + params + loaderDeps).\n  describe('same-route match caching', () => {\n    const setupWithPathParams = ({\n      loader,\n      staleTime,\n    }: {\n      loader?: () => unknown\n      staleTime?: number\n    }) => {\n      const rootRoute = new BaseRootRoute({})\n      const postRoute = new BaseRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/$postId',\n        loader,\n        staleTime,\n        gcTime: staleTime,\n      })\n      const routeTree = rootRoute.addChildren([postRoute])\n      return createTestRouter({\n        routeTree,\n        history: createMemoryHistory(),\n      })\n    }\n\n    test('keeps previous loaderDeps variant cached and reuses it within staleTime', async () => {\n      const loader = vi.fn()\n      const router = createFooRouter({ loader, staleTime: 60_000 })\n\n      await router.navigate({ to: '/foo', search: { page: '1' } })\n      const page1MatchId = router.state.matches.find(\n        (d) => d.routeId === '/foo',\n      )?.id\n      expect(page1MatchId).toBeDefined()\n\n      await router.navigate({ to: '/foo', search: { page: '2' } })\n      const page2MatchId = router.state.matches.find(\n        (d) => d.routeId === '/foo',\n      )?.id\n      expect(page2MatchId).toBeDefined()\n      expect(page2MatchId).not.toBe(page1MatchId)\n      expect(\n        router.stores.cachedMatchesId.state.some((id) => id === page1MatchId),\n      ).toBe(true)\n\n      await router.navigate({ to: '/foo', search: { page: '1' } })\n      expect(loader).toHaveBeenCalledTimes(2)\n      expect(router.state.matches.some((d) => d.id === page1MatchId)).toBe(true)\n    })\n\n    test('keeps previous params variant cached and reuses it within staleTime', async () => {\n      const loader = vi.fn()\n      const router = setupWithPathParams({ loader, staleTime: 60_000 })\n\n      await router.navigate({ to: '/posts/$postId', params: { postId: '1' } })\n      const post1MatchId = router.state.matches.find(\n        (d) => d.routeId === '/posts/$postId',\n      )?.id\n      expect(post1MatchId).toBeDefined()\n\n      await router.navigate({ to: '/posts/$postId', params: { postId: '2' } })\n      const post2MatchId = router.state.matches.find(\n        (d) => d.routeId === '/posts/$postId',\n      )?.id\n      expect(post2MatchId).toBeDefined()\n      expect(post2MatchId).not.toBe(post1MatchId)\n      expect(\n        router.stores.cachedMatchesId.state.some((id) => id === post1MatchId),\n      ).toBe(true)\n\n      await router.navigate({ to: '/posts/$postId', params: { postId: '1' } })\n      expect(loader).toHaveBeenCalledTimes(2)\n      expect(router.state.matches.some((d) => d.id === post1MatchId)).toBe(true)\n    })\n  })\n\n  // Verify that router-level subscription events still fire correctly.\n  // These are used by integrations like Sentry's TanStack Router instrumentation\n  // (https://github.com/getsentry/sentry-javascript/blob/develop/packages/react/src/tanstackrouter.ts)\n  // to track page transitions.\n  describe('onBeforeNavigate event', () => {\n    it('fires when navigating to a new route', async () => {\n      const router = setup({})\n      const onBeforeNavigate = vi.fn()\n      router.subscribe('onBeforeNavigate', onBeforeNavigate)\n\n      await router.navigate({ to: '/foo' })\n      expect(onBeforeNavigate).toHaveBeenCalledTimes(1)\n      expect(onBeforeNavigate).toHaveBeenCalledWith(\n        expect.objectContaining({\n          type: 'onBeforeNavigate',\n          pathChanged: true,\n        }),\n      )\n    })\n\n    it('fires on every navigation including same-route loaderDeps changes', async () => {\n      const router = createFooRouter({})\n      const onBeforeNavigate = vi.fn()\n      router.subscribe('onBeforeNavigate', onBeforeNavigate)\n\n      await router.navigate({ to: '/foo', search: { page: '1' } })\n      expect(onBeforeNavigate).toHaveBeenCalledTimes(1)\n\n      // loaderDeps change — same route, different params\n      await router.navigate({ to: '/foo', search: { page: '2' } })\n      expect(onBeforeNavigate).toHaveBeenCalledTimes(2)\n    })\n\n    it('includes toLocation and pathChanged in the event', async () => {\n      const router = setup({})\n      const events: Array<{ to: string; pathChanged: boolean }> = []\n      router.subscribe('onBeforeNavigate', (e) => {\n        events.push({\n          to: e.toLocation.pathname,\n          pathChanged: e.pathChanged,\n        })\n      })\n\n      await router.navigate({ to: '/foo' })\n      await router.navigate({ to: '/bar' })\n\n      expect(events).toHaveLength(2)\n      expect(events[0]).toMatchObject({ to: '/foo', pathChanged: true })\n      expect(events[1]).toMatchObject({ to: '/bar', pathChanged: true })\n    })\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/closing-tag-detection.bench.ts",
    "content": "import { bench, describe } from 'vitest'\n\n/**\n * Benchmark comparing different approaches for finding the last closing tag in HTML chunks.\n *\n * The goal is to find the position just after the last closing tag (e.g., </div>, </my-component>)\n * so we can insert router HTML at that point.\n *\n * Requirements (from the regex pattern /(<\\/[a-zA-Z][\\w:.-]*?>)/g):\n * - Closing tag starts with </\n * - First character after </ must be a letter (a-zA-Z)\n * - Followed by any combination of word chars (\\w = [a-zA-Z0-9_]), colons, dots, or hyphens\n * - Ends with >\n */\n\n// ============================================================================\n// Implementation 1: Regex-based (current implementation)\n// ============================================================================\nfunction findLastClosingTagRegex(str: string): number {\n  const patternClosingTag = /(<\\/[a-zA-Z][\\w:.-]*?>)/g\n  let lastIndex = 0\n  let result: RegExpExecArray | null\n  while ((result = patternClosingTag.exec(str)) !== null) {\n    lastIndex = result.index + result[0].length\n  }\n  return lastIndex > 0 ? lastIndex : -1\n}\n\n// ============================================================================\n// Implementation 2: Manual backwards scan\n// ============================================================================\nfunction isTagNameStartChar(char: string): boolean {\n  const code = char.charCodeAt(0)\n  // a-z: 97-122, A-Z: 65-90\n  return (code >= 97 && code <= 122) || (code >= 65 && code <= 90)\n}\n\nfunction isTagNameChar(char: string): boolean {\n  const code = char.charCodeAt(0)\n  // a-z: 97-122, A-Z: 65-90, 0-9: 48-57, _: 95, :: 58, .: 46, -: 45\n  return (\n    (code >= 97 && code <= 122) || // a-z\n    (code >= 65 && code <= 90) || // A-Z\n    (code >= 48 && code <= 57) || // 0-9\n    code === 95 || // _\n    code === 58 || // :\n    code === 46 || // .\n    code === 45 // -\n  )\n}\n\nfunction findLastClosingTagManual(str: string): number {\n  // Search backwards for </...> pattern\n  let i = str.length - 1\n\n  while (i >= 1) {\n    // Look for >\n    if (str[i] === '>') {\n      // Look backwards for </\n      let j = i - 1\n      let foundValidTag = false\n\n      // Skip through valid tag name characters\n      while (j >= 1 && isTagNameChar(str[j]!)) {\n        j--\n      }\n\n      // Check if the first char after </ is a valid start char (letter only)\n      const tagNameStart = j + 1\n      if (tagNameStart < i && isTagNameStartChar(str[tagNameStart]!)) {\n        // Check for </\n        if (j >= 1 && str[j] === '/' && str[j - 1] === '<') {\n          foundValidTag = true\n        }\n      }\n\n      if (foundValidTag) {\n        return i + 1 // Return position after the closing >\n      }\n    }\n    i--\n  }\n  return -1\n}\n\n// ============================================================================\n// Implementation 3: Optimized manual with charCodeAt (avoid string indexing)\n// ============================================================================\nfunction findLastClosingTagOptimized(str: string): number {\n  const len = str.length\n  if (len < 4) return -1 // Minimum: </a>\n\n  let i = len - 1\n\n  while (i >= 3) {\n    // Need at least 4 chars: </a>\n    // Look for > (charCode 62)\n    if (str.charCodeAt(i) === 62) {\n      // Look backwards for </\n      let j = i - 1\n\n      // Skip through valid tag name characters\n      while (j >= 1) {\n        const code = str.charCodeAt(j)\n        // Check if it's a valid tag name char\n        if (\n          (code >= 97 && code <= 122) || // a-z\n          (code >= 65 && code <= 90) || // A-Z\n          (code >= 48 && code <= 57) || // 0-9\n          code === 95 || // _\n          code === 58 || // :\n          code === 46 || // .\n          code === 45 // -\n        ) {\n          j--\n        } else {\n          break\n        }\n      }\n\n      // Check if the first char after </ is a valid start char (letter only)\n      const tagNameStart = j + 1\n      if (tagNameStart < i) {\n        const startCode = str.charCodeAt(tagNameStart)\n        // Must start with a letter\n        if (\n          (startCode >= 97 && startCode <= 122) ||\n          (startCode >= 65 && startCode <= 90)\n        ) {\n          // Check for </ (charCodes: < = 60, / = 47)\n          if (\n            j >= 1 &&\n            str.charCodeAt(j) === 47 &&\n            str.charCodeAt(j - 1) === 60\n          ) {\n            return i + 1 // Return position after the closing >\n          }\n        }\n      }\n    }\n    i--\n  }\n  return -1\n}\n\n// ============================================================================\n// Implementation 4: Hybrid - use lastIndexOf to find candidates, then validate\n// ============================================================================\nfunction findLastClosingTagHybrid(str: string): number {\n  let searchFrom = str.length - 1\n\n  while (searchFrom >= 3) {\n    // Find the last > starting from searchFrom\n    const closeIndex = str.lastIndexOf('>', searchFrom)\n    if (closeIndex < 3) return -1 // Not enough room for </a>\n\n    // Look backwards for </\n    let j = closeIndex - 1\n\n    // Skip through valid tag name characters using charCodeAt\n    while (j >= 1) {\n      const code = str.charCodeAt(j)\n      if (\n        (code >= 97 && code <= 122) || // a-z\n        (code >= 65 && code <= 90) || // A-Z\n        (code >= 48 && code <= 57) || // 0-9\n        code === 95 || // _\n        code === 58 || // :\n        code === 46 || // .\n        code === 45 // -\n      ) {\n        j--\n      } else {\n        break\n      }\n    }\n\n    // Check if the first char after </ is a valid start char (letter only)\n    const tagNameStart = j + 1\n    if (tagNameStart < closeIndex) {\n      const startCode = str.charCodeAt(tagNameStart)\n      if (\n        (startCode >= 97 && startCode <= 122) ||\n        (startCode >= 65 && startCode <= 90)\n      ) {\n        if (\n          j >= 1 &&\n          str.charCodeAt(j) === 47 &&\n          str.charCodeAt(j - 1) === 60\n        ) {\n          return closeIndex + 1\n        }\n      }\n    }\n\n    // Not a valid tag, continue searching before this >\n    searchFrom = closeIndex - 1\n  }\n\n  return -1\n}\n\n// ============================================================================\n// Test Data Generation\n// ============================================================================\n\n// Small chunk - typical streaming chunk\nfunction generateSmallChunk(): string {\n  return `<div class=\"container\"><p>Hello World</p><span>Some text</span></div>`\n}\n\n// Medium chunk - several elements\nfunction generateMediumChunk(): string {\n  let html = '<div class=\"app\">'\n  for (let i = 0; i < 10; i++) {\n    html += `<section id=\"section-${i}\"><h2>Title ${i}</h2><p>Paragraph with some content ${i}</p><my-component data-id=\"${i}\">Custom element content</my-component></section>`\n  }\n  html += '</div>'\n  return html\n}\n\n// Large chunk - many elements\nfunction generateLargeChunk(): string {\n  let html = '<html><head><title>Test</title></head><body>'\n  for (let i = 0; i < 100; i++) {\n    html += `<div class=\"item item-${i}\"><span class=\"label\">Label ${i}</span><input type=\"text\" value=\"${i}\"/><button>Click</button></div>`\n  }\n  html += '</body></html>'\n  return html\n}\n\n// Chunk with custom elements (web components)\nfunction generateWebComponentChunk(): string {\n  let html = '<div class=\"app\">'\n  for (let i = 0; i < 20; i++) {\n    html += `<my-custom-element-${i % 5}><slot-content:nested.child></slot-content:nested.child></my-custom-element-${i % 5}>`\n  }\n  html += '</div>'\n  return html\n}\n\n// Chunk with no closing tags (edge case)\nfunction generateNoClosingTagChunk(): string {\n  return 'This is just plain text with no HTML tags at all'\n}\n\n// Chunk ending mid-tag (streaming edge case)\nfunction generatePartialChunk(): string {\n  return '<div><p>Content</p><span>More'\n}\n\n// Chunk with nested structure (realistic React output)\nfunction generateNestedChunk(): string {\n  return `<div class=\"root\"><div class=\"layout\"><header class=\"header\"><nav><ul><li><a href=\"/\">Home</a></li><li><a href=\"/about\">About</a></li></ul></nav></header><main class=\"main\"><article><h1>Article Title</h1><p>First paragraph with <strong>bold</strong> and <em>italic</em> text.</p><p>Second paragraph with a <a href=\"#\">link</a>.</p></article></main><footer><p>Footer content</p></footer></div></div>`\n}\n\n// Verify all implementations return the same result\nfunction verifyImplementations() {\n  const testCases = [\n    generateSmallChunk(),\n    generateMediumChunk(),\n    generateLargeChunk(),\n    generateWebComponentChunk(),\n    generateNoClosingTagChunk(),\n    generatePartialChunk(),\n    generateNestedChunk(),\n    '</div>',\n    '<div></div>',\n    '</my-component:nested.element>',\n    'no tags here',\n    '',\n  ]\n\n  for (const testCase of testCases) {\n    const regexResult = findLastClosingTagRegex(testCase)\n    const manualResult = findLastClosingTagManual(testCase)\n    const optimizedResult = findLastClosingTagOptimized(testCase)\n    const hybridResult = findLastClosingTagHybrid(testCase)\n\n    if (\n      regexResult !== manualResult ||\n      regexResult !== optimizedResult ||\n      regexResult !== hybridResult\n    ) {\n      console.error('Mismatch for:', testCase.slice(0, 50))\n      console.error('  Regex:', regexResult)\n      console.error('  Manual:', manualResult)\n      console.error('  Optimized:', optimizedResult)\n      console.error('  Hybrid:', hybridResult)\n      throw new Error('Implementation mismatch!')\n    }\n  }\n  console.log('All implementations verified to produce identical results')\n}\n\n// Run verification before benchmarks\nverifyImplementations()\n\n// ============================================================================\n// Benchmarks\n// ============================================================================\n\ndescribe('Closing Tag Detection - Small Chunk (~70 chars)', () => {\n  const chunk = generateSmallChunk()\n\n  bench('regex', () => {\n    findLastClosingTagRegex(chunk)\n  })\n\n  bench('manual backwards scan', () => {\n    findLastClosingTagManual(chunk)\n  })\n\n  bench('optimized (charCodeAt)', () => {\n    findLastClosingTagOptimized(chunk)\n  })\n\n  bench('hybrid (lastIndexOf + validation)', () => {\n    findLastClosingTagHybrid(chunk)\n  })\n})\n\ndescribe('Closing Tag Detection - Medium Chunk (~1.5KB)', () => {\n  const chunk = generateMediumChunk()\n\n  bench('regex', () => {\n    findLastClosingTagRegex(chunk)\n  })\n\n  bench('manual backwards scan', () => {\n    findLastClosingTagManual(chunk)\n  })\n\n  bench('optimized (charCodeAt)', () => {\n    findLastClosingTagOptimized(chunk)\n  })\n\n  bench('hybrid (lastIndexOf + validation)', () => {\n    findLastClosingTagHybrid(chunk)\n  })\n})\n\ndescribe('Closing Tag Detection - Large Chunk (~13KB)', () => {\n  const chunk = generateLargeChunk()\n\n  bench('regex', () => {\n    findLastClosingTagRegex(chunk)\n  })\n\n  bench('manual backwards scan', () => {\n    findLastClosingTagManual(chunk)\n  })\n\n  bench('optimized (charCodeAt)', () => {\n    findLastClosingTagOptimized(chunk)\n  })\n\n  bench('hybrid (lastIndexOf + validation)', () => {\n    findLastClosingTagHybrid(chunk)\n  })\n})\n\ndescribe('Closing Tag Detection - Web Components', () => {\n  const chunk = generateWebComponentChunk()\n\n  bench('regex', () => {\n    findLastClosingTagRegex(chunk)\n  })\n\n  bench('manual backwards scan', () => {\n    findLastClosingTagManual(chunk)\n  })\n\n  bench('optimized (charCodeAt)', () => {\n    findLastClosingTagOptimized(chunk)\n  })\n\n  bench('hybrid (lastIndexOf + validation)', () => {\n    findLastClosingTagHybrid(chunk)\n  })\n})\n\ndescribe('Closing Tag Detection - No Closing Tags (worst case for regex)', () => {\n  const chunk = generateNoClosingTagChunk()\n\n  bench('regex', () => {\n    findLastClosingTagRegex(chunk)\n  })\n\n  bench('manual backwards scan', () => {\n    findLastClosingTagManual(chunk)\n  })\n\n  bench('optimized (charCodeAt)', () => {\n    findLastClosingTagOptimized(chunk)\n  })\n\n  bench('hybrid (lastIndexOf + validation)', () => {\n    findLastClosingTagHybrid(chunk)\n  })\n})\n\ndescribe('Closing Tag Detection - Nested React-like Structure', () => {\n  const chunk = generateNestedChunk()\n\n  bench('regex', () => {\n    findLastClosingTagRegex(chunk)\n  })\n\n  bench('manual backwards scan', () => {\n    findLastClosingTagManual(chunk)\n  })\n\n  bench('optimized (charCodeAt)', () => {\n    findLastClosingTagOptimized(chunk)\n  })\n\n  bench('hybrid (lastIndexOf + validation)', () => {\n    findLastClosingTagHybrid(chunk)\n  })\n})\n\ndescribe('Closing Tag Detection - Partial Chunk (streaming edge case)', () => {\n  const chunk = generatePartialChunk()\n\n  bench('regex', () => {\n    findLastClosingTagRegex(chunk)\n  })\n\n  bench('manual backwards scan', () => {\n    findLastClosingTagManual(chunk)\n  })\n\n  bench('optimized (charCodeAt)', () => {\n    findLastClosingTagOptimized(chunk)\n  })\n\n  bench('hybrid (lastIndexOf + validation)', () => {\n    findLastClosingTagHybrid(chunk)\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/curly-params-smoke.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { findRouteMatch, processRouteTree } from '../src/new-process-route-tree'\n\nconst testCases = [\n  {\n    name: 'param with braces',\n    path: '/$id',\n    nav: '/1',\n    params: { id: '1' },\n  },\n  {\n    name: 'param without braces',\n    path: '/{$id}',\n    nav: '/2',\n    params: { id: '2' },\n  },\n  {\n    name: 'param with prefix',\n    path: '/prefix-{$id}',\n    nav: '/prefix-3',\n    params: { id: '3' },\n  },\n  {\n    name: 'param with suffix',\n    path: '/{$id}-suffix',\n    nav: '/4-suffix',\n    params: { id: '4' },\n  },\n  {\n    name: 'param with prefix and suffix',\n    path: '/prefix-{$id}-suffix',\n    nav: '/prefix-5-suffix',\n    params: { id: '5' },\n  },\n  {\n    name: 'wildcard with no braces',\n    path: '/abc/$',\n    nav: '/abc/6',\n    params: { '*': '6', _splat: '6' },\n  },\n  {\n    name: 'wildcard with braces',\n    path: '/abc/{$}',\n    nav: '/abc/7',\n    params: { '*': '7', _splat: '7' },\n  },\n  {\n    name: 'wildcard with prefix',\n    path: '/abc/prefix{$}',\n    nav: '/abc/prefix/8',\n    params: { '*': '/8', _splat: '/8' },\n  },\n  {\n    name: 'wildcard with suffix',\n    path: '/abc/{$}suffix',\n    nav: '/abc/9/suffix',\n    params: { _splat: '9/', '*': '9/' },\n  },\n  {\n    name: 'optional param with no prefix/suffix and value',\n    path: '/abc/{-$id}/def',\n    nav: '/abc/10/def',\n    params: { id: '10' },\n  },\n  {\n    name: 'optional param with no prefix/suffix and requiredParam and no value',\n    path: '/abc/{-$id}/$foo/def',\n    nav: '/abc/bar/def',\n    params: { foo: 'bar' },\n  },\n  {\n    name: 'optional param with no prefix/suffix and requiredParam and value',\n    path: '/abc/{-$id}/$foo/def',\n    nav: '/abc/10/bar/def',\n    params: { id: '10', foo: 'bar' },\n  },\n  {\n    name: 'optional param with no prefix/suffix and no value',\n    path: '/abc/{-$id}/def',\n    nav: '/abc/def',\n    params: {},\n  },\n  {\n    name: 'optional param with prefix and value',\n    path: '/optional-{-$id}',\n    nav: '/optional-12',\n    params: { id: '12' },\n  },\n  {\n    name: 'optional param with prefix and no value',\n    path: '/optional-{-$id}',\n    nav: '/optional-',\n    params: {},\n  },\n  {\n    name: 'optional param with suffix and value',\n    path: '/{-$id}-optional',\n    nav: '/13-optional',\n    params: { id: '13' },\n  },\n  {\n    name: 'optional param with suffix and no value',\n    path: '/{-$id}-optional',\n    nav: '/-optional',\n    params: {},\n  },\n  {\n    name: 'optional param with required param, prefix, suffix, wildcard and no value',\n    path: `/$foo/a{-$id}-optional/$`,\n    nav: '/bar/a-optional/qux',\n    params: { foo: 'bar', _splat: 'qux', '*': 'qux' },\n  },\n  {\n    name: 'optional param with required param, prefix, suffix, wildcard and value',\n    path: `/$foo/a{-$id}-optional/$`,\n    nav: '/bar/a14-optional/qux',\n    params: { foo: 'bar', id: '14', _splat: 'qux', '*': 'qux' },\n  },\n]\n\n// porting tests from https://github.com/TanStack/router/pull/5851\ndescribe('curly params smoke tests', () => {\n  test.each(testCases)('$name', ({ path, nav, params }) => {\n    const tree = {\n      id: '__root__',\n      isRoot: true,\n      fullPath: '/',\n      path: '/',\n      children: [\n        {\n          id: path,\n          fullPath: path,\n          path: path,\n        },\n      ],\n    }\n    const processed = processRouteTree(tree)\n    const res = findRouteMatch(nav, processed.processedTree)\n    expect(res?.rawParams).toEqual(params)\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/dangerous-protocols.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport { DEFAULT_PROTOCOL_ALLOWLIST, isDangerousProtocol } from '../src/utils'\nimport { redirect } from '../src/redirect'\nimport { BaseRootRoute } from '../src'\nimport { createTestRouter } from './routerTestUtils'\n\nconst defaultAllowlistSet = new Set(DEFAULT_PROTOCOL_ALLOWLIST)\n\ndescribe('isDangerousProtocol', () => {\n  describe('blocked protocols (not in default allowlist)', () => {\n    it('should detect javascript: protocol', () => {\n      expect(\n        isDangerousProtocol('javascript:alert(1)', defaultAllowlistSet),\n      ).toBe(true)\n    })\n\n    it('should detect javascript: with mixed case and whitespace', () => {\n      expect(\n        isDangerousProtocol('JavaScript:alert(1)', defaultAllowlistSet),\n      ).toBe(true)\n      expect(\n        isDangerousProtocol('  \\t\\n  javascript:alert(1)', defaultAllowlistSet),\n      ).toBe(true)\n      expect(\n        isDangerousProtocol('java\\nscript:alert(1)', defaultAllowlistSet),\n      ).toBe(true)\n    })\n\n    it('should detect known unsafe schemes', () => {\n      expect(\n        isDangerousProtocol(\n          'data:text/html,<script>alert(1)</script>',\n          defaultAllowlistSet,\n        ),\n      ).toBe(true)\n      expect(\n        isDangerousProtocol(\n          'blob:https://example.com/some-uuid',\n          defaultAllowlistSet,\n        ),\n      ).toBe(true)\n      expect(\n        isDangerousProtocol('vbscript:msgbox(1)', defaultAllowlistSet),\n      ).toBe(true)\n      expect(\n        isDangerousProtocol('file:///etc/passwd', defaultAllowlistSet),\n      ).toBe(true)\n      expect(isDangerousProtocol('about:blank', defaultAllowlistSet)).toBe(true)\n    })\n\n    it('should block custom protocols by default', () => {\n      expect(isDangerousProtocol('custom:something', defaultAllowlistSet)).toBe(\n        true,\n      )\n      expect(isDangerousProtocol('foo:bar', defaultAllowlistSet)).toBe(true)\n    })\n  })\n\n  describe('allowed protocols (in default allowlist)', () => {\n    it('should allow http and https', () => {\n      expect(\n        isDangerousProtocol('http://example.com', defaultAllowlistSet),\n      ).toBe(false)\n      expect(\n        isDangerousProtocol('https://example.com', defaultAllowlistSet),\n      ).toBe(false)\n    })\n\n    it('should allow mailto and tel', () => {\n      expect(\n        isDangerousProtocol('mailto:user@example.com', defaultAllowlistSet),\n      ).toBe(false)\n      expect(isDangerousProtocol('tel:+1234567890', defaultAllowlistSet)).toBe(\n        false,\n      )\n    })\n  })\n\n  describe('relative URLs (no protocol)', () => {\n    it('should allow relative paths, query strings and hash fragments', () => {\n      expect(isDangerousProtocol('/path/to/page', defaultAllowlistSet)).toBe(\n        false,\n      )\n      expect(isDangerousProtocol('./relative', defaultAllowlistSet)).toBe(false)\n      expect(isDangerousProtocol('../parent', defaultAllowlistSet)).toBe(false)\n      expect(isDangerousProtocol('?foo=bar', defaultAllowlistSet)).toBe(false)\n      expect(isDangerousProtocol('#section', defaultAllowlistSet)).toBe(false)\n    })\n  })\n\n  describe('edge cases', () => {\n    it('should handle empty and null-ish inputs', () => {\n      expect(isDangerousProtocol('', defaultAllowlistSet)).toBe(false)\n      expect(\n        isDangerousProtocol(null as unknown as string, defaultAllowlistSet),\n      ).toBe(false)\n      expect(\n        isDangerousProtocol(\n          undefined as unknown as string,\n          defaultAllowlistSet,\n        ),\n      ).toBe(false)\n    })\n\n    it('should not be fooled by javascript in pathname or query', () => {\n      expect(\n        isDangerousProtocol(\n          'https://example.com/javascript:foo',\n          defaultAllowlistSet,\n        ),\n      ).toBe(false)\n      expect(isDangerousProtocol('/javascript:foo', defaultAllowlistSet)).toBe(\n        false,\n      )\n      expect(isDangerousProtocol('/path?time=12:00', defaultAllowlistSet)).toBe(\n        false,\n      )\n    })\n\n    it('should return false for malformed/encoded scheme strings that URL rejects', () => {\n      expect(\n        isDangerousProtocol(\n          '%6a%61%76%61%73%63%72%69%70%74:alert(1)',\n          defaultAllowlistSet,\n        ),\n      ).toBe(false)\n      expect(isDangerousProtocol(':::', defaultAllowlistSet)).toBe(false)\n      expect(isDangerousProtocol('123:456', defaultAllowlistSet)).toBe(false)\n      expect(isDangerousProtocol('//example.com', defaultAllowlistSet)).toBe(\n        false,\n      )\n    })\n\n    it('should detect dangerous protocol with leading control characters', () => {\n      expect(\n        isDangerousProtocol('\\x00javascript:alert(1)', defaultAllowlistSet),\n      ).toBe(true)\n      expect(\n        isDangerousProtocol(\n          '\\x01\\x02\\x03javascript:alert(1)',\n          defaultAllowlistSet,\n        ),\n      ).toBe(true)\n    })\n  })\n\n  describe('custom allowlist', () => {\n    it('should use custom allowlist when provided', () => {\n      const customAllowlist = new Set(['ftp:', 'ssh:'])\n\n      expect(isDangerousProtocol('ftp://example.com', customAllowlist)).toBe(\n        false,\n      )\n      expect(isDangerousProtocol('ssh://example.com', customAllowlist)).toBe(\n        false,\n      )\n      expect(isDangerousProtocol('javascript:alert(1)', customAllowlist)).toBe(\n        true,\n      )\n      expect(isDangerousProtocol('https://example.com', customAllowlist)).toBe(\n        true,\n      )\n    })\n\n    it('should block absolute URLs with an empty allowlist', () => {\n      const emptyAllowlist = new Set<string>()\n      expect(isDangerousProtocol('javascript:alert(1)', emptyAllowlist)).toBe(\n        true,\n      )\n      expect(isDangerousProtocol('data:text/html,test', emptyAllowlist)).toBe(\n        true,\n      )\n      expect(isDangerousProtocol('https://example.com', emptyAllowlist)).toBe(\n        true,\n      )\n    })\n\n    it('should allow extending the default allowlist', () => {\n      const extendedAllowlist = new Set([\n        ...DEFAULT_PROTOCOL_ALLOWLIST,\n        'ftp:',\n        'gopher:',\n      ])\n\n      expect(\n        isDangerousProtocol('javascript:alert(1)', extendedAllowlist),\n      ).toBe(true)\n      expect(isDangerousProtocol('ftp://example.com', extendedAllowlist)).toBe(\n        false,\n      )\n      expect(\n        isDangerousProtocol('gopher://example.com', extendedAllowlist),\n      ).toBe(false)\n      expect(\n        isDangerousProtocol('https://example.com', extendedAllowlist),\n      ).toBe(false)\n    })\n  })\n\n  describe('DEFAULT_PROTOCOL_ALLOWLIST', () => {\n    it('should contain the expected default protocols', () => {\n      expect(DEFAULT_PROTOCOL_ALLOWLIST).toEqual([\n        'http:',\n        'https:',\n        'mailto:',\n        'tel:',\n      ])\n    })\n  })\n})\n\ndescribe('redirect creation (no protocol validation)', () => {\n  it('should allow creating redirect with javascript: protocol', () => {\n    expect(() => redirect({ href: 'javascript:alert(1)' })).not.toThrow()\n  })\n\n  it('should allow creating redirect with data: protocol', () => {\n    expect(() =>\n      redirect({ href: 'data:text/html,<script>alert(1)</script>' }),\n    ).not.toThrow()\n  })\n\n  it('should allow creating redirect with any protocol', () => {\n    expect(() => redirect({ href: 'custom:something' })).not.toThrow()\n    expect(() =>\n      redirect({ href: 'blob:https://example.com/uuid' }),\n    ).not.toThrow()\n  })\n\n  it('should allow safe protocols', () => {\n    expect(() => redirect({ href: 'https://example.com' })).not.toThrow()\n    expect(() => redirect({ href: 'http://example.com' })).not.toThrow()\n    expect(() => redirect({ href: 'mailto:user@example.com' })).not.toThrow()\n  })\n\n  it('should allow redirects without href', () => {\n    expect(() => redirect({ to: '/home' })).not.toThrow()\n  })\n})\n\ndescribe('integration test on Router', () => {\n  const inputs = [\n    'x-safari-https://example.com',\n    'googlechromes://example.com',\n    'intent://example.com#Intent;scheme=https;end',\n    'foo:bar',\n  ]\n  it('should accept weird protocols from the allowlist', () => {\n    const router = createTestRouter({\n      routeTree: new BaseRootRoute(),\n      protocolAllowlist: [\n        'x-safari-https:',\n        'googlechromes:',\n        'intent:',\n        'foo:',\n      ],\n    })\n    // Each protocol in the inputs should be accepted by resolveRedirect\n    for (const href of inputs) {\n      const redir = redirect({ href })\n      expect(() => router.resolveRedirect(redir)).not.toThrow()\n    }\n  })\n  it('should block weird protocols not in the allowlist', () => {\n    const router = createTestRouter({\n      routeTree: new BaseRootRoute(),\n      protocolAllowlist: [],\n    })\n    // Each protocol in the inputs should be blocked by resolveRedirect\n    for (const href of inputs) {\n      const redir = redirect({ href })\n      expect(() => router.resolveRedirect(redir)).toThrow(\n        /Redirect blocked: unsafe protocol/,\n      )\n    }\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/getNormalizedURL.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { getNormalizedURL } from '../src/ssr/ssr-server'\n\ndescribe('getNormalizedURL', () => {\n  test('should return URL that is in standardized format', () => {\n    const url1 = 'https://example.com/%EB%8C%80%7C/path?query=%EB%8C%80|#hash'\n    const url2 = 'https://example.com/%EB%8C%80|/path?query=%EB%8C%80%7C#hash'\n\n    const normalizedUrl1 = getNormalizedURL(url1)\n    const normalizedUrl2 = getNormalizedURL(url2)\n\n    expect(normalizedUrl1.url.pathname).toBe('/%EB%8C%80|/path')\n    expect(normalizedUrl1.url.pathname).toBe(normalizedUrl2.url.pathname)\n    expect(new URL(url1).pathname).not.toBe(new URL(url2).pathname)\n\n    expect(normalizedUrl1.url.search).toBe(`?query=%EB%8C%80%7C`)\n    expect(normalizedUrl1.url.search).toBe(normalizedUrl2.url.search)\n    expect(new URL(url1).search).not.toBe(new URL(url2).search)\n  })\n\n  const testCases = [\n    {\n      url: 'https://example.com/%3Fstart?query=value',\n      expectedPathName: '/%3Fstart',\n      expectedSearchParams: '?query=value',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/end%3F?query=value',\n      expectedPathName: '/end%3F',\n      expectedSearchParams: '?query=value',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/%23?query=value',\n      expectedPathName: '/%23',\n      expectedSearchParams: '?query=value',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/a%3Fb%3Fc%23d?query=value',\n      expectedPathName: '/a%3Fb%3Fc%23d',\n      expectedSearchParams: '?query=value',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path?query=value#section%3Fpart',\n      expectedPathName: '/path',\n      expectedSearchParams: '?query=value',\n      expectedHash: '#section%3Fpart',\n    },\n    {\n      url: 'https://example.com/start%3Fmiddle%23end?key=value%23part&other=%3Fdata#section%3Fpart',\n      expectedPathName: '/start%3Fmiddle%23end',\n      expectedSearchParams: '?key=value%23part&other=%3Fdata',\n      expectedHash: '#section%3Fpart',\n    },\n    {\n      url: 'https://example.com/%E0%A4',\n      expectedPathName: '/%E0%A4',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/%ZZ',\n      expectedPathName: '/%ZZ',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path?a=1&a=2',\n      expectedPathName: '/path',\n      expectedSearchParams: '?a=1&a=2',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path+a',\n      expectedPathName: '/path+a',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path a',\n      expectedPathName: '/path%20a',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path%20a',\n      expectedPathName: '/path%20a',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path%25a',\n      expectedPathName: '/path%25a',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path%25a',\n      expectedPathName: '/path%25a',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path\\\\a',\n      expectedPathName: '/path%5Ca',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n    {\n      url: 'https://example.com/path%5Ca',\n      expectedPathName: '/path%5Ca',\n      expectedSearchParams: '',\n      expectedHash: '',\n    },\n  ]\n  test.each(testCases)(\n    'should treat encoded URL specific characters correctly',\n    ({ url, expectedPathName, expectedHash, expectedSearchParams }) => {\n      const normalizedUrl = getNormalizedURL(url)\n      expect(normalizedUrl.url.pathname).toBe(expectedPathName)\n      expect(normalizedUrl.url.search).toBe(expectedSearchParams)\n      expect(normalizedUrl.url.hash).toBe(expectedHash)\n    },\n  )\n})\n"
  },
  {
    "path": "packages/router-core/tests/getOrigin.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { getOrigin } from '../src/ssr/ssr-server'\n\ndescribe('getOrigin security', () => {\n  test('should not trust spoofed Origin header', () => {\n    // An attacker could send a malicious Origin header to try to manipulate\n    // the router's origin, which could affect redirect handling (CVE-2024-34351)\n    const maliciousRequest = new Request('https://legitimate.com/api/action', {\n      headers: {\n        Origin: 'https://evil.com',\n      },\n    })\n\n    const origin = getOrigin(maliciousRequest)\n\n    // The origin should come from request.url, not the spoofed Origin header\n    // This prevents SSRF-like attacks where an attacker tries to manipulate\n    // how redirects are processed by providing a malicious Origin header\n    expect(origin).toBe('https://legitimate.com')\n    expect(origin).not.toBe('https://evil.com')\n  })\n\n  test('should derive origin from request URL', () => {\n    const request = new Request('https://myapp.com/page')\n    const origin = getOrigin(request)\n    expect(origin).toBe('https://myapp.com')\n  })\n\n  test('should handle localhost requests', () => {\n    const request = new Request('http://localhost:3000/api')\n    const origin = getOrigin(request)\n    expect(origin).toBe('http://localhost:3000')\n  })\n\n  test('should return fallback for invalid request URL', () => {\n    // This should be rare, but handle gracefully\n    const request = {\n      url: 'not-a-valid-url',\n      headers: new Headers(),\n    } as unknown as Request\n\n    const origin = getOrigin(request)\n    expect(origin).toBe('http://localhost')\n  })\n\n  test('should ignore Origin header even if request URL parse fails', () => {\n    // Even if the request URL is somehow invalid, we should not fall back\n    // to trusting the Origin header\n    const request = {\n      url: 'invalid-url',\n      headers: new Headers({\n        Origin: 'https://evil.com',\n      }),\n    } as unknown as Request\n\n    const origin = getOrigin(request)\n\n    // Should fall back to localhost, not use the potentially malicious Origin\n    expect(origin).toBe('http://localhost')\n    expect(origin).not.toBe('https://evil.com')\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/granular-stores.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { createMemoryHistory } from '@tanstack/history'\nimport { BaseRootRoute, BaseRoute } from '../src'\nimport { createTestRouter } from './routerTestUtils'\n\nfunction createRouter() {\n  const rootRoute = new BaseRootRoute({})\n\n  const indexRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const aboutRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    path: '/about',\n  })\n\n  const postRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts/$postId',\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, aboutRoute, postRoute])\n\n  return createTestRouter({\n    routeTree,\n    history: createMemoryHistory({\n      initialEntries: ['/'],\n    }),\n  })\n}\n\nfunction createLoaderRouter({\n  initialEntries = ['/posts/123'],\n  staleTime = 0,\n}: {\n  initialEntries?: Array<string>\n  staleTime?: number\n} = {}) {\n  let resolveLoader: (() => void) | undefined\n  let callCount = 0\n\n  const rootRoute = new BaseRootRoute({})\n\n  const indexRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n  })\n\n  const aboutRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    path: '/about',\n  })\n\n  const postRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts/$postId',\n    staleTime,\n    loader: () => {\n      callCount += 1\n\n      if (callCount === 1) {\n        return { version: 'initial' }\n      }\n\n      return new Promise<{ version: string }>((resolve) => {\n        resolveLoader = () => resolve({ version: 'reloaded' })\n      })\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute, aboutRoute, postRoute])\n\n  return {\n    router: createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries,\n      }),\n    }),\n    resolveLoader: () => resolveLoader?.(),\n  }\n}\n\ndescribe('granular stores', () => {\n  test('keeps pool stores correct across active/pending/cached transitions', async () => {\n    const router = createRouter()\n    await router.navigate({ to: '/posts/123' })\n\n    const activeMatches = router.state.matches\n\n    // Active pool contains all active matches with correct routeIds\n    expect(router.stores.matchesId.state).toEqual(\n      activeMatches.map((match) => match.id),\n    )\n    activeMatches.forEach((match) => {\n      const store = router.stores.activeMatchStoresById.get(match.id)\n      expect(store).toBeDefined()\n      expect(store!.routeId).toBe(match.routeId)\n      // getMatchStoreByRouteId resolves to the same state\n      expect(router.stores.getMatchStoreByRouteId(match.routeId).state).toBe(\n        store!.state,\n      )\n    })\n\n    const pendingMatches = [...activeMatches].reverse().map((match, index) => ({\n      ...match,\n      id: `${match.id}__pending_${index}`,\n    }))\n    const cachedMatches = [...activeMatches].map((match, index) => ({\n      ...match,\n      id: `${match.id}__cached_${index}`,\n    }))\n\n    router.stores.setPendingMatches(pendingMatches)\n    router.stores.setCachedMatches(cachedMatches)\n\n    expect(router.stores.matchesId.state).toEqual(\n      activeMatches.map((match) => match.id),\n    )\n    expect(router.stores.pendingMatchesId.state).toEqual(\n      pendingMatches.map((match) => match.id),\n    )\n    expect(router.stores.cachedMatchesId.state).toEqual(\n      cachedMatches.map((match) => match.id),\n    )\n\n    // Pending pool has correct routeIds\n    pendingMatches.forEach((match) => {\n      const pendingStore = router.stores.pendingMatchStoresById.get(match.id)\n      expect(pendingStore).toBeDefined()\n      expect(pendingStore!.routeId).toBe(match.routeId)\n      // Pending match is NOT in the active pool\n      expect(router.stores.activeMatchStoresById.get(match.id)).toBeUndefined()\n      // Active pool still has a match for this routeId\n      expect(\n        router.stores.getMatchStoreByRouteId(match.routeId).state,\n      ).toBeDefined()\n    })\n\n    const nextActiveMatches = activeMatches.map((match, index) => ({\n      ...match,\n      id: `${match.id}__active_next_${index}`,\n    }))\n    router.stores.setActiveMatches(nextActiveMatches)\n\n    expect(router.stores.matchesId.state).toEqual(\n      nextActiveMatches.map((match) => match.id),\n    )\n    nextActiveMatches.forEach((match) => {\n      const store = router.stores.activeMatchStoresById.get(match.id)\n      expect(store).toBeDefined()\n      expect(store!.routeId).toBe(match.routeId)\n      expect(router.stores.getMatchStoreByRouteId(match.routeId).state).toBe(\n        store!.state,\n      )\n    })\n  })\n\n  test('match store updates are isolated to the touched active match', async () => {\n    const router = createRouter()\n    await router.navigate({ to: '/posts/123' })\n\n    const rootMatch = router.state.matches[0]\n    const leafMatch = router.state.matches[1]\n\n    expect(rootMatch).toBeDefined()\n    expect(leafMatch).toBeDefined()\n\n    if (!rootMatch || !leafMatch) {\n      throw new Error('Expected root and leaf matches to exist')\n    }\n\n    const rootStore = router.stores.activeMatchStoresById.get(rootMatch.id)\n    const leafStore = router.stores.activeMatchStoresById.get(leafMatch.id)\n\n    expect(rootStore).toBeDefined()\n    expect(leafStore).toBeDefined()\n\n    if (!rootStore || !leafStore) {\n      throw new Error('Expected root and leaf match stores to exist')\n    }\n\n    const rootBefore = rootStore.state\n    const leafBefore = leafStore.state\n\n    router.updateMatch(leafMatch.id, (prev) => ({\n      ...prev,\n      status: 'pending',\n    }))\n\n    expect(rootStore.state).toBe(rootBefore)\n    expect(leafStore.state).not.toBe(leafBefore)\n    expect(leafStore.state.status).toBe('pending')\n  })\n\n  test('getMatchStoreByRouteId caches store instances and clears when route is inactive', async () => {\n    const router = createRouter()\n    await router.navigate({ to: '/posts/123' })\n\n    const postsStore = router.stores.getMatchStoreByRouteId('/posts/$postId')\n\n    expect(router.stores.getMatchStoreByRouteId('/posts/$postId')).toBe(\n      postsStore,\n    )\n    expect(postsStore.state?.routeId).toBe('/posts/$postId')\n\n    await router.navigate({ to: '/about' })\n\n    expect(router.stores.getMatchStoreByRouteId('/posts/$postId')).toBe(\n      postsStore,\n    )\n    expect(postsStore.state).toBeUndefined()\n  })\n\n  test('no-op match pool reconciliation preserves ids and match state references', async () => {\n    const router = createRouter()\n    await router.navigate({ to: '/posts/123' })\n\n    const activeMatches = router.state.matches\n    const activeIdsBefore = router.stores.matchesId.state\n    const activeStoresBefore = activeMatches.map((match) =>\n      router.stores.activeMatchStoresById.get(match.id),\n    )\n    const activeStatesBefore = activeStoresBefore.map((store) => store?.state)\n\n    router.stores.setActiveMatches(activeMatches)\n\n    expect(router.stores.matchesId.state).toBe(activeIdsBefore)\n    expect(router.stores.activeMatchesSnapshot.state).toBe(activeMatches)\n    for (let i = 0; i < activeMatches.length; i++) {\n      const match = activeMatches[i]!\n      const store = router.stores.activeMatchStoresById.get(match.id)\n      expect(store).toBe(activeStoresBefore[i])\n      expect(store?.state).toBe(activeStatesBefore[i])\n    }\n\n    const pendingMatches = activeMatches.map((match) => ({\n      ...match,\n      id: `${match.id}__pending`,\n      status: 'pending' as const,\n    }))\n\n    router.stores.setPendingMatches(pendingMatches)\n\n    const pendingIdsBefore = router.stores.pendingMatchesId.state\n    const pendingStoresBefore = pendingMatches.map((match) =>\n      router.stores.pendingMatchStoresById.get(match.id),\n    )\n    const pendingStatesBefore = pendingStoresBefore.map((store) => store?.state)\n\n    router.stores.setPendingMatches(pendingMatches)\n\n    expect(router.stores.pendingMatchesId.state).toBe(pendingIdsBefore)\n    for (let i = 0; i < pendingMatches.length; i++) {\n      const match = pendingMatches[i]!\n      const store = router.stores.pendingMatchStoresById.get(match.id)\n      expect(store).toBe(pendingStoresBefore[i])\n      expect(store?.state).toBe(pendingStatesBefore[i])\n    }\n  })\n\n  test('updateMatch prefers the pending pool when active and pending share an id', async () => {\n    const { router, resolveLoader } = createLoaderRouter()\n\n    await router.load()\n\n    const activeLeaf = router.state.matches[1]\n\n    expect(activeLeaf).toBeDefined()\n\n    if (!activeLeaf) {\n      throw new Error('Expected active leaf match to exist')\n    }\n\n    const activeStore = router.stores.activeMatchStoresById.get(activeLeaf.id)\n\n    expect(activeStore).toBeDefined()\n\n    if (!activeStore) {\n      throw new Error('Expected active leaf store to exist')\n    }\n\n    const activeBefore = activeStore.state\n\n    const reloadPromise = router.load()\n    await Promise.resolve()\n\n    const pendingStore = router.stores.pendingMatchStoresById.get(activeLeaf.id)\n\n    expect(pendingStore).toBeDefined()\n    expect(router.stores.activeMatchStoresById.get(activeLeaf.id)).toBe(\n      activeStore,\n    )\n\n    if (!pendingStore) {\n      throw new Error('Expected pending leaf store to exist')\n    }\n\n    router.updateMatch(activeLeaf.id, (prev) => ({\n      ...prev,\n      status: 'error',\n      error: new Error('pending-only-update'),\n    }))\n\n    expect(activeStore.state).toBe(activeBefore)\n    expect(activeStore.state.status).toBe('success')\n    expect(pendingStore.state.status).toBe('error')\n    expect(pendingStore.state.error).toEqual(new Error('pending-only-update'))\n\n    resolveLoader()\n    await reloadPromise\n  })\n\n  test('supports duplicate ids across pools without cross-pool contamination', async () => {\n    const router = createRouter()\n    await router.navigate({ to: '/posts/123' })\n\n    const activeLeaf = router.state.matches[1]!\n    const duplicatedId = activeLeaf.id\n    const pendingDuplicate = {\n      ...activeLeaf,\n      status: 'pending' as const,\n    }\n    const cachedDuplicate = {\n      ...activeLeaf,\n      status: 'success' as const,\n    }\n\n    router.stores.setPendingMatches([pendingDuplicate])\n    router.stores.setCachedMatches([cachedDuplicate])\n\n    router.stores.setActiveMatches(\n      router.state.matches.map((match) =>\n        match.id === duplicatedId\n          ? {\n              ...match,\n              status: 'error' as const,\n              error: new Error('active-only-update'),\n            }\n          : match,\n      ),\n    )\n\n    expect(\n      router.stores.activeMatchStoresById.get(duplicatedId)?.state.status,\n    ).toBe('error')\n    expect(\n      router.stores.getMatchStoreByRouteId(activeLeaf.routeId).state?.status,\n    ).toBe('error')\n    // Pending pool has its own store for this id\n    expect(\n      router.stores.pendingMatchStoresById.get(duplicatedId)?.state.status,\n    ).toBe('pending')\n    expect(router.stores.pendingMatchesSnapshot.state[0]?.status).toBe(\n      'pending',\n    )\n    expect(router.stores.cachedMatchesSnapshot.state[0]?.status).toBe('success')\n    expect(router.getMatch(duplicatedId)?.status).toBe('success')\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/hydrate.test.ts",
    "content": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\nimport { createMemoryHistory } from '@tanstack/history'\nimport { BaseRootRoute, BaseRoute, notFound } from '../src'\nimport { hydrate } from '../src/ssr/client'\nimport { createTestRouter } from './routerTestUtils'\nimport { dehydrateSsrMatchId } from '../src/ssr/ssr-match-id'\nimport type { TsrSsrGlobal } from '../src/ssr/types'\nimport type { AnyRouteMatch } from '../src'\n\ndescribe('hydrate', () => {\n  let mockWindow: { $_TSR?: TsrSsrGlobal }\n  let mockRouter: any\n  let mockHead: any\n\n  beforeEach(() => {\n    // Reset global window mock\n    mockWindow = {}\n    ;(global as any).window = mockWindow\n\n    // Reset mock head function\n    mockHead = vi.fn()\n\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = new BaseRootRoute({})\n\n    const indexRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => 'Index',\n      notFoundComponent: () => 'Not Found',\n      head: mockHead,\n    })\n\n    const otherRoute = new BaseRoute({\n      getParentRoute: () => indexRoute,\n      path: '/other',\n      component: () => 'Other',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute.addChildren([otherRoute]),\n    ])\n\n    mockRouter = createTestRouter({ routeTree, history, isServer: true })\n  })\n\n  afterEach(() => {\n    vi.resetAllMocks()\n    delete (global as any).window\n  })\n\n  it('should throw error if window.$_TSR is not available', async () => {\n    await expect(hydrate(mockRouter)).rejects.toThrow(\n      'Expected to find bootstrap data on window.$_TSR, but we did not. Please file an issue!',\n    )\n  })\n\n  it('should throw error if window.$_TSR.router is not available', async () => {\n    mockWindow.$_TSR = {\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n      // router is missing\n    } as any\n\n    await expect(hydrate(mockRouter)).rejects.toThrow(\n      'Expected to find a dehydrated data on window.$_TSR.router, but we did not. Please file an issue!',\n    )\n  })\n\n  it('should initialize serialization adapters when provided', async () => {\n    const mockSerializer = {\n      key: 'testAdapter',\n      fromSerializable: vi.fn(),\n      toSerializable: vi.fn(),\n      test: vi.fn().mockReturnValue(true),\n      '~types': {\n        input: {},\n        output: {},\n        extends: {},\n      },\n    }\n\n    mockRouter.options.serializationAdapters = [mockSerializer]\n\n    const mockMatches = [{ id: '/', routeId: '/', index: 0, _nonReactive: {} }]\n    mockRouter.matchRoutes = vi.fn().mockReturnValue(mockMatches)\n    mockRouter.state.matches = mockMatches\n\n    const mockBuffer = [vi.fn(), vi.fn()]\n    mockWindow.$_TSR = {\n      router: {\n        manifest: { routes: {} },\n        dehydratedData: {},\n        lastMatchId: '/',\n        matches: [],\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: mockBuffer,\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    expect(mockWindow.$_TSR.t).toBeInstanceOf(Map)\n    expect(mockWindow.$_TSR.t?.get('testAdapter')).toBe(\n      mockSerializer.fromSerializable,\n    )\n    expect(mockBuffer[0]).toHaveBeenCalled()\n    expect(mockBuffer[1]).toHaveBeenCalled()\n    expect(mockWindow.$_TSR.initialized).toBe(true)\n  })\n\n  it('should handle empty serialization adapters', async () => {\n    mockRouter.options.serializationAdapters = []\n\n    mockWindow.$_TSR = {\n      router: {\n        manifest: { routes: {} },\n        dehydratedData: {},\n        lastMatchId: '/',\n        matches: [],\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    expect(mockWindow.$_TSR.t).toBeUndefined()\n    expect(mockWindow.$_TSR.initialized).toBe(true)\n  })\n\n  it('should set manifest in router.ssr', async () => {\n    const testManifest = { routes: {} }\n    mockWindow.$_TSR = {\n      router: {\n        manifest: testManifest,\n        dehydratedData: {},\n        lastMatchId: '/',\n        matches: [],\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    expect(mockRouter.ssr).toEqual({\n      manifest: testManifest,\n    })\n  })\n\n  it('should hydrate matches', async () => {\n    const mockMatches = [\n      {\n        id: '/',\n        routeId: '/',\n        index: 0,\n        ssr: undefined,\n        _nonReactive: {},\n      },\n      {\n        id: '/other',\n        routeId: '/other',\n        index: 1,\n        ssr: undefined,\n        _nonReactive: {},\n      },\n    ]\n\n    const dehydratedMatches = [\n      {\n        i: '/',\n        l: { indexData: 'server-data' },\n        s: 'success' as const,\n        ssr: true,\n        u: Date.now(),\n      },\n    ]\n\n    mockRouter.matchRoutes = vi.fn().mockReturnValue(mockMatches)\n    mockRouter.state.matches = mockMatches\n\n    mockWindow.$_TSR = {\n      router: {\n        manifest: { routes: {} },\n        dehydratedData: {},\n        lastMatchId: '/',\n        matches: dehydratedMatches,\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    const { id, loaderData, ssr, status } = mockMatches[0] as AnyRouteMatch\n    expect(id).toBe('/')\n    expect(loaderData).toEqual({ indexData: 'server-data' })\n    expect(status).toBe('success')\n    expect(ssr).toBe(true)\n  })\n\n  it('should hydrate globalNotFound when dehydrated flag is present', async () => {\n    const mockMatches = [\n      {\n        id: '/',\n        routeId: '/',\n        index: 0,\n        ssr: undefined,\n        _nonReactive: {},\n      },\n    ]\n\n    const dehydratedMatches = [\n      {\n        i: '/',\n        s: 'success' as const,\n        ssr: true,\n        u: Date.now(),\n        g: true as const,\n      },\n    ]\n\n    mockRouter.matchRoutes = vi.fn().mockReturnValue(mockMatches)\n    mockRouter.state.matches = mockMatches\n\n    mockWindow.$_TSR = {\n      router: {\n        manifest: { routes: {} },\n        dehydratedData: {},\n        lastMatchId: '/',\n        matches: dehydratedMatches,\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    expect((mockMatches[0] as AnyRouteMatch).globalNotFound).toBe(true)\n  })\n\n  it('should leave globalNotFound undefined when dehydrated flag is omitted', async () => {\n    const mockMatches = [\n      {\n        id: '/',\n        routeId: '/',\n        index: 0,\n        ssr: undefined,\n        _nonReactive: {},\n      },\n    ]\n\n    const dehydratedMatches = [\n      {\n        i: '/',\n        s: 'success' as const,\n        ssr: true,\n        u: Date.now(),\n      },\n    ]\n\n    mockRouter.matchRoutes = vi.fn().mockReturnValue(mockMatches)\n    mockRouter.state.matches = mockMatches\n\n    mockWindow.$_TSR = {\n      router: {\n        manifest: { routes: {} },\n        dehydratedData: {},\n        lastMatchId: '/',\n        matches: dehydratedMatches,\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    expect((mockMatches[0] as AnyRouteMatch).globalNotFound).toBeUndefined()\n  })\n\n  it('should preserve existing globalNotFound when dehydrated flag is omitted', async () => {\n    const mockMatches = [\n      {\n        id: '/',\n        routeId: '/',\n        index: 0,\n        ssr: undefined,\n        _nonReactive: {},\n        globalNotFound: true,\n      },\n    ]\n\n    const dehydratedMatches = [\n      {\n        i: '/',\n        s: 'success' as const,\n        ssr: true,\n        u: Date.now(),\n      },\n    ]\n\n    mockRouter.matchRoutes = vi.fn().mockReturnValue(mockMatches)\n    mockRouter.state.matches = mockMatches\n\n    mockWindow.$_TSR = {\n      router: {\n        manifest: { routes: {} },\n        dehydratedData: {},\n        lastMatchId: '/',\n        matches: dehydratedMatches,\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    expect((mockMatches[0] as AnyRouteMatch).globalNotFound).toBe(true)\n  })\n\n  it('should decode dehydrated match ids before hydration lookup and SPA-mode checks', async () => {\n    const loadSpy = vi.spyOn(mockRouter, 'load')\n\n    const mockMatches = [\n      {\n        id: '/',\n        routeId: '/',\n        index: 0,\n        ssr: undefined,\n        _nonReactive: {},\n      },\n    ]\n\n    mockRouter.matchRoutes = vi.fn().mockReturnValue(mockMatches)\n    mockRouter.state.matches = mockMatches\n\n    mockWindow.$_TSR = {\n      router: {\n        manifest: { routes: {} },\n        dehydratedData: {},\n        lastMatchId: dehydrateSsrMatchId('/'),\n        matches: [\n          {\n            i: dehydrateSsrMatchId('/'),\n            l: { indexData: 'server-data' },\n            s: 'success',\n            ssr: true,\n            u: Date.now(),\n          },\n        ],\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    expect(loadSpy).not.toHaveBeenCalled()\n    expect((mockRouter.state.matches[0] as AnyRouteMatch).id).toBe('/')\n  })\n\n  it('should handle errors during route context hydration', async () => {\n    const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {})\n    mockHead.mockImplementation(() => {\n      throw notFound()\n    })\n\n    const mockMatches = [\n      { id: '/', routeId: '/', index: 0, ssr: true, _nonReactive: {} },\n    ]\n\n    mockRouter.matchRoutes = vi.fn().mockReturnValue(mockMatches)\n    mockRouter.state.matches = mockMatches\n\n    mockWindow.$_TSR = {\n      router: {\n        manifest: { routes: {} },\n        dehydratedData: {},\n        lastMatchId: '/',\n        matches: [\n          {\n            i: '/',\n            l: { data: 'test' },\n            s: 'success',\n            ssr: true,\n            u: Date.now(),\n          },\n        ],\n      },\n      h: vi.fn(),\n      e: vi.fn(),\n      c: vi.fn(),\n      p: vi.fn(),\n      buffer: [],\n      initialized: false,\n    }\n\n    await hydrate(mockRouter)\n\n    const match = mockRouter.state.matches[0] as AnyRouteMatch\n    expect(match.error).toEqual({ isNotFound: true })\n\n    expect(consoleSpy).toHaveBeenCalledWith(\n      'NotFound error during hydration for routeId: /',\n      expect.objectContaining({\n        isNotFound: true,\n      }),\n    )\n\n    consoleSpy.mockRestore()\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/load.test-d.ts",
    "content": "import { describe, expectTypeOf, test } from 'vitest'\nimport type { NotFoundRouteProps, RegisteredRouter, RouteIds } from '../src'\n\ndescribe('NotFoundRouteProps', () => {\n  test('should have correct basic property types', () => {\n    expectTypeOf<NotFoundRouteProps['data']>().toEqualTypeOf<\n      unknown | undefined\n    >()\n    expectTypeOf<NotFoundRouteProps['isNotFound']>().toEqualTypeOf<boolean>()\n    expectTypeOf<NotFoundRouteProps['routeId']>().toEqualTypeOf<\n      RouteIds<RegisteredRouter['routeTree']>\n    >()\n  })\n\n  test('should have data as optional property', () => {\n    expectTypeOf<NotFoundRouteProps>().toMatchTypeOf<{\n      data?: unknown\n      isNotFound: boolean\n      routeId: RouteIds<RegisteredRouter['routeTree']>\n    }>()\n  })\n\n  test('should have isNotFound as required property', () => {\n    expectTypeOf<Pick<NotFoundRouteProps, 'isNotFound'>>().toEqualTypeOf<{\n      isNotFound: boolean\n    }>()\n  })\n\n  test('should have routeId as required property', () => {\n    expectTypeOf<Pick<NotFoundRouteProps, 'routeId'>>().toEqualTypeOf<{\n      routeId: RouteIds<RegisteredRouter['routeTree']>\n    }>()\n  })\n\n  test('should be assignable with minimal required properties', () => {\n    const props: NotFoundRouteProps = {\n      isNotFound: true,\n      routeId: '/' as RouteIds<RegisteredRouter['routeTree']>,\n    }\n    expectTypeOf(props).toMatchTypeOf<NotFoundRouteProps>()\n  })\n\n  test('should be assignable with all properties', () => {\n    const props: NotFoundRouteProps = {\n      data: { message: 'Not found' },\n      isNotFound: true,\n      routeId: '/' as RouteIds<RegisteredRouter['routeTree']>,\n    }\n    expectTypeOf(props).toMatchTypeOf<NotFoundRouteProps>()\n  })\n\n  test('should accept any data type', () => {\n    const propsWithString: NotFoundRouteProps = {\n      data: 'string data',\n      isNotFound: true,\n      routeId: '/' as RouteIds<RegisteredRouter['routeTree']>,\n    }\n    expectTypeOf(propsWithString).toMatchTypeOf<NotFoundRouteProps>()\n\n    const propsWithObject: NotFoundRouteProps = {\n      data: { userId: 123, message: 'User not found' },\n      isNotFound: true,\n      routeId: '/users' as RouteIds<RegisteredRouter['routeTree']>,\n    }\n    expectTypeOf(propsWithObject).toMatchTypeOf<NotFoundRouteProps>()\n\n    const propsWithArray: NotFoundRouteProps = {\n      data: [1, 2, 3],\n      isNotFound: true,\n      routeId: '/' as RouteIds<RegisteredRouter['routeTree']>,\n    }\n    expectTypeOf(propsWithArray).toMatchTypeOf<NotFoundRouteProps>()\n  })\n\n  test('should accept undefined data', () => {\n    const props: NotFoundRouteProps = {\n      data: undefined,\n      isNotFound: true,\n      routeId: '/' as RouteIds<RegisteredRouter['routeTree']>,\n    }\n    expectTypeOf(props).toMatchTypeOf<NotFoundRouteProps>()\n  })\n\n  test('notFoundComponent should accept NotFoundRouteProps', () => {\n    type NotFoundComponent = (props: NotFoundRouteProps) => any\n\n    const component: NotFoundComponent = (props) => {\n      expectTypeOf(props.data).toEqualTypeOf<unknown | undefined>()\n      expectTypeOf(props.isNotFound).toEqualTypeOf<boolean>()\n      expectTypeOf(props.routeId).toEqualTypeOf<\n        RouteIds<RegisteredRouter['routeTree']>\n      >()\n      return null\n    }\n\n    expectTypeOf(component).toMatchTypeOf<NotFoundComponent>()\n  })\n\n  test('defaultNotFoundComponent should accept NotFoundRouteProps', () => {\n    type DefaultNotFoundComponent = (props: NotFoundRouteProps) => any\n\n    const component: DefaultNotFoundComponent = (props) => {\n      expectTypeOf(props).toMatchTypeOf<NotFoundRouteProps>()\n      return null\n    }\n\n    expectTypeOf(component).toMatchTypeOf<DefaultNotFoundComponent>()\n  })\n\n  test('should be spreadable as component props', () => {\n    const notFoundData = {\n      data: { message: 'Custom error' },\n      isNotFound: true as const,\n      routeId: '/' as RouteIds<RegisteredRouter['routeTree']>,\n    }\n\n    type SpreadProps = typeof notFoundData\n    expectTypeOf<SpreadProps>().toMatchTypeOf<NotFoundRouteProps>()\n\n    const component = (props: NotFoundRouteProps) => {\n      expectTypeOf(props).toMatchTypeOf<NotFoundRouteProps>()\n      return null\n    }\n\n    expectTypeOf(component).parameter(0).toMatchTypeOf<NotFoundRouteProps>()\n  })\n\n  test('should maintain type safety with spread', () => {\n    const data: NotFoundRouteProps = {\n      data: { userId: 123 },\n      isNotFound: true,\n      routeId: '/users' as RouteIds<RegisteredRouter['routeTree']>,\n    }\n\n    const spreadData = { ...data }\n    expectTypeOf(spreadData).toMatchTypeOf<NotFoundRouteProps>()\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/load.test.ts",
    "content": "import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\nimport { createMemoryHistory } from '@tanstack/history'\nimport {\n  BaseRootRoute,\n  BaseRoute,\n  notFound,\n  redirect,\n  rootRouteId,\n} from '../src'\nimport { createTestRouter } from './routerTestUtils'\nimport { loadMatches } from '../src/load-matches'\nimport type {\n  AnyRouter,\n  LoaderStaleReloadMode,\n  RootRouteOptions,\n  RouterCore,\n} from '../src'\n\ntype AnyRouteOptions = RootRouteOptions<any>\ntype BeforeLoad = NonNullable<AnyRouteOptions['beforeLoad']>\ntype Loader = NonNullable<AnyRouteOptions['loader']>\ntype LoaderEntry = Exclude<Loader, Function>\n\ndescribe('redirect resolution', () => {\n  test('resolveRedirect normalizes same-origin Location to path-only', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['https://example.com/foo'],\n      }),\n      origin: 'https://example.com',\n    })\n\n    // This redirect already includes an absolute Location header (external-ish),\n    // but still represents an internal navigation.\n    const unresolved = redirect({\n      to: '/foo',\n      headers: { Location: 'https://example.com/foo' },\n    })\n\n    const resolved = router.resolveRedirect(unresolved)\n\n    // Expect Location and stored href to be path-only (no origin).\n    expect(resolved.headers.get('Location')).toBe('/foo')\n    expect(resolved.options.href).toBe('/foo')\n  })\n\n  test.each(['/$a', '/$toString', '/$__proto__'])(\n    'server startup redirects initial path %s to /undefined',\n    async (initialPath) => {\n      const rootRoute = new BaseRootRoute({})\n      const slugRoute = new BaseRoute({\n        getParentRoute: () => rootRoute,\n        path: '/$slug',\n      })\n\n      const routeTree = rootRoute.addChildren([slugRoute])\n\n      const router = createTestRouter({\n        routeTree,\n        history: createMemoryHistory({ initialEntries: [initialPath] }),\n        isServer: true,\n      })\n\n      await router.load()\n\n      expect(router.state.redirect).toEqual(\n        expect.objectContaining({\n          options: expect.objectContaining({ href: '/undefined' }),\n        }),\n      )\n      expect(router.state.redirect?.headers.get('Location')).toBe('/undefined')\n    },\n  )\n})\n\ndescribe('beforeLoad skip or exec', () => {\n  const setup = ({ beforeLoad }: { beforeLoad?: BeforeLoad }) => {\n    const rootRoute = new BaseRootRoute({})\n\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      beforeLoad,\n    })\n\n    const barRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/bar',\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute, barRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    return router\n  }\n\n  test('baseline', async () => {\n    const beforeLoad = vi.fn()\n    const router = setup({ beforeLoad })\n    await router.load()\n    expect(beforeLoad).toHaveBeenCalledTimes(0)\n  })\n\n  test('exec on regular nav', async () => {\n    const beforeLoad = vi.fn(() => Promise.resolve({ hello: 'world' }))\n    const router = setup({ beforeLoad })\n    const navigation = router.navigate({ to: '/foo' })\n    expect(beforeLoad).toHaveBeenCalledTimes(1)\n    expect(router.stores.pendingMatchesSnapshot.state).toEqual(\n      expect.arrayContaining([expect.objectContaining({ id: '/foo/foo' })]),\n    )\n    await navigation\n    expect(router.state.location.pathname).toBe('/foo')\n    expect(router.state.matches).toEqual(\n      expect.arrayContaining([\n        expect.objectContaining({\n          id: '/foo/foo',\n          context: {\n            hello: 'world',\n          },\n        }),\n      ]),\n    )\n    expect(beforeLoad).toHaveBeenCalledTimes(1)\n  })\n\n  test('exec if resolved preload (success)', async () => {\n    const beforeLoad = vi.fn()\n    const router = setup({ beforeLoad })\n    await router.preloadRoute({ to: '/foo' })\n    expect(router.stores.cachedMatchesSnapshot.state).toEqual(\n      expect.arrayContaining([expect.objectContaining({ id: '/foo/foo' })]),\n    )\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(beforeLoad).toHaveBeenCalledTimes(2)\n  })\n\n  test('exec if pending preload (success)', async () => {\n    const beforeLoad = vi.fn(() => sleep(100))\n    const router = setup({ beforeLoad })\n    router.preloadRoute({ to: '/foo' })\n    await Promise.resolve()\n    expect(router.stores.cachedMatchesSnapshot.state).toEqual(\n      expect.arrayContaining([expect.objectContaining({ id: '/foo/foo' })]),\n    )\n    await router.navigate({ to: '/foo' })\n\n    expect(beforeLoad).toHaveBeenCalledTimes(2)\n  })\n\n  test('exec if rejected preload (notFound)', async () => {\n    const beforeLoad = vi.fn<BeforeLoad>(async ({ preload }) => {\n      if (preload) throw notFound()\n      await Promise.resolve()\n    })\n    const router = setup({\n      beforeLoad,\n    })\n    await router.preloadRoute({ to: '/foo' })\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(beforeLoad).toHaveBeenCalledTimes(2)\n  })\n\n  test('exec if pending preload (notFound)', async () => {\n    const beforeLoad = vi.fn<BeforeLoad>(async ({ preload }) => {\n      await sleep(100)\n      if (preload) throw notFound()\n    })\n    const router = setup({\n      beforeLoad,\n    })\n    router.preloadRoute({ to: '/foo' })\n    await Promise.resolve()\n    await router.navigate({ to: '/foo' })\n\n    expect(beforeLoad).toHaveBeenCalledTimes(2)\n  })\n\n  test('exec if rejected preload (redirect)', async () => {\n    const beforeLoad = vi.fn<BeforeLoad>(async ({ preload }) => {\n      if (preload) throw redirect({ to: '/bar' })\n      await Promise.resolve()\n    })\n    const router = setup({\n      beforeLoad,\n    })\n    await router.preloadRoute({ to: '/foo' })\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(router.state.location.pathname).toBe('/foo')\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n    expect(beforeLoad).toHaveBeenCalledTimes(2)\n  })\n\n  test('exec if pending preload (redirect)', async () => {\n    const beforeLoad = vi.fn<BeforeLoad>(async ({ preload }) => {\n      await sleep(100)\n      if (preload) throw redirect({ to: '/bar' })\n    })\n    const router = setup({\n      beforeLoad,\n    })\n    router.preloadRoute({ to: '/foo' })\n    await Promise.resolve()\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n    await router.navigate({ to: '/foo' })\n\n    expect(router.state.location.pathname).toBe('/foo')\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n    expect(beforeLoad).toHaveBeenCalledTimes(2)\n  })\n\n  test('exec if rejected preload (error)', async () => {\n    const beforeLoad = vi.fn<BeforeLoad>(async ({ preload }) => {\n      if (preload) throw new Error('error')\n      await Promise.resolve()\n    })\n    const router = setup({\n      beforeLoad,\n    })\n    await router.preloadRoute({ to: '/foo' })\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(beforeLoad).toHaveBeenCalledTimes(2)\n  })\n\n  test('exec if pending preload (error)', async () => {\n    const beforeLoad = vi.fn<BeforeLoad>(async ({ preload }) => {\n      await sleep(100)\n      if (preload) throw new Error('error')\n    })\n    const router = setup({\n      beforeLoad,\n    })\n    router.preloadRoute({ to: '/foo' })\n    await Promise.resolve()\n    await router.navigate({ to: '/foo' })\n\n    expect(beforeLoad).toHaveBeenCalledTimes(2)\n  })\n})\n\ndescribe('loader skip or exec', () => {\n  const setup = ({\n    loader,\n    staleTime,\n    defaultStaleReloadMode,\n  }: {\n    loader?: Loader\n    staleTime?: number\n    defaultStaleReloadMode?: LoaderStaleReloadMode\n  }) => {\n    const rootRoute = new BaseRootRoute({})\n\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      loader,\n      staleTime,\n      gcTime: staleTime,\n    })\n\n    const barRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/bar',\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute, barRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      defaultStaleReloadMode,\n      history: createMemoryHistory(),\n    })\n\n    return router\n  }\n\n  test('baseline', async () => {\n    const loader = vi.fn()\n    const router = setup({ loader })\n    await router.load()\n    expect(loader).toHaveBeenCalledTimes(0)\n  })\n\n  test('exec on regular nav', async () => {\n    const loader = vi.fn(() => Promise.resolve({ hello: 'world' }))\n    const router = setup({ loader })\n    const navigation = router.navigate({ to: '/foo' })\n    expect(loader).toHaveBeenCalledTimes(1)\n    expect(router.stores.pendingMatchesSnapshot.state).toEqual(\n      expect.arrayContaining([expect.objectContaining({ id: '/foo/foo' })]),\n    )\n    await navigation\n    expect(router.state.location.pathname).toBe('/foo')\n    expect(router.state.matches).toEqual(\n      expect.arrayContaining([\n        expect.objectContaining({\n          id: '/foo/foo',\n          loaderData: {\n            hello: 'world',\n          },\n        }),\n      ]),\n    )\n    expect(loader).toHaveBeenCalledTimes(1)\n  })\n\n  test('exec if resolved preload (success)', async () => {\n    const loader = vi.fn()\n    const router = setup({ loader })\n    await router.preloadRoute({ to: '/foo' })\n    expect(router.stores.cachedMatchesSnapshot.state).toEqual(\n      expect.arrayContaining([expect.objectContaining({ id: '/foo/foo' })]),\n    )\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(loader).toHaveBeenCalledTimes(2)\n  })\n\n  test('skip if resolved preload (success) within staleTime duration', async () => {\n    const loader = vi.fn()\n    const router = setup({ loader, staleTime: 1000 })\n    await router.preloadRoute({ to: '/foo' })\n    expect(router.stores.cachedMatchesSnapshot.state).toEqual(\n      expect.arrayContaining([expect.objectContaining({ id: '/foo/foo' })]),\n    )\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(loader).toHaveBeenCalledTimes(1)\n  })\n\n  test('skip if pending preload (success)', async () => {\n    const loader = vi.fn(() => sleep(100))\n    const router = setup({ loader })\n    router.preloadRoute({ to: '/foo' })\n    await Promise.resolve()\n    expect(router.stores.cachedMatchesSnapshot.state).toEqual(\n      expect.arrayContaining([expect.objectContaining({ id: '/foo/foo' })]),\n    )\n    await router.navigate({ to: '/foo' })\n\n    expect(loader).toHaveBeenCalledTimes(1)\n  })\n\n  test('exec if rejected preload (notFound)', async () => {\n    const loader: Loader = vi.fn(async ({ preload }) => {\n      if (preload) throw notFound()\n      await Promise.resolve()\n    })\n    const router = setup({\n      loader,\n    })\n    await router.preloadRoute({ to: '/foo' })\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(loader).toHaveBeenCalledTimes(2)\n  })\n\n  test('skip if pending preload (notFound)', async () => {\n    const loader: Loader = vi.fn(async ({ preload }) => {\n      await sleep(100)\n      if (preload) throw notFound()\n    })\n    const router = setup({\n      loader,\n    })\n    router.preloadRoute({ to: '/foo' })\n    await Promise.resolve()\n    await router.navigate({ to: '/foo' })\n\n    expect(loader).toHaveBeenCalledTimes(1)\n  })\n\n  test('exec if rejected preload (redirect)', async () => {\n    const loader: Loader = vi.fn(async ({ preload }) => {\n      if (preload) throw redirect({ to: '/bar' })\n      await Promise.resolve()\n    })\n    const router = setup({\n      loader,\n    })\n    await router.preloadRoute({ to: '/foo' })\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(router.state.location.pathname).toBe('/foo')\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n    expect(loader).toHaveBeenCalledTimes(2)\n  })\n\n  test('skip if pending preload (redirect)', async () => {\n    const loader: Loader = vi.fn(async ({ preload }) => {\n      await sleep(100)\n      if (preload) throw redirect({ to: '/bar' })\n    })\n    const router = setup({\n      loader,\n    })\n    router.preloadRoute({ to: '/foo' })\n    await Promise.resolve()\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n    await router.navigate({ to: '/foo' })\n\n    expect(router.state.location.pathname).toBe('/bar')\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n    expect(loader).toHaveBeenCalledTimes(1)\n  })\n\n  test('updateMatch removes redirected matches from cachedMatches', async () => {\n    const loader = vi.fn()\n    const router = setup({ loader })\n\n    await router.preloadRoute({ to: '/foo' })\n    expect(router.stores.cachedMatchesSnapshot.state).toEqual(\n      expect.arrayContaining([expect.objectContaining({ id: '/foo/foo' })]),\n    )\n\n    router.updateMatch('/foo/foo', (prev) => ({\n      ...prev,\n      status: 'redirected',\n    }))\n\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.id === '/foo/foo',\n      ),\n    ).toBe(false)\n    expect(\n      router.stores.cachedMatchesSnapshot.state.some(\n        (d) => d.status === 'redirected',\n      ),\n    ).toBe(false)\n  })\n\n  test('exec if rejected preload (error)', async () => {\n    const loader: Loader = vi.fn(async ({ preload }) => {\n      if (preload) throw new Error('error')\n      await Promise.resolve()\n    })\n    const router = setup({\n      loader,\n    })\n    await router.preloadRoute({ to: '/foo' })\n    await sleep(10)\n    await router.navigate({ to: '/foo' })\n\n    expect(loader).toHaveBeenCalledTimes(2)\n  })\n\n  test('skip if pending preload (error)', async () => {\n    const loader: Loader = vi.fn(async ({ preload }) => {\n      await sleep(100)\n      if (preload) throw new Error('error')\n    })\n    const router = setup({\n      loader,\n    })\n    router.preloadRoute({ to: '/foo' })\n    await Promise.resolve()\n    await router.navigate({ to: '/foo' })\n\n    expect(loader).toHaveBeenCalledTimes(1)\n  })\n})\n\ntest('exec on stay (beforeLoad & loader)', async () => {\n  let rootBeforeLoadResolved = false\n  const rootBeforeLoad = vi.fn(async () => {\n    await sleep(10)\n    rootBeforeLoadResolved = true\n  })\n  const rootLoader = vi.fn(() => sleep(10))\n  const rootRoute = new BaseRootRoute({\n    beforeLoad: rootBeforeLoad,\n    loader: rootLoader,\n  })\n\n  let layoutBeforeLoadResolved = false\n  const layoutBeforeLoad = vi.fn(async () => {\n    await sleep(10)\n    layoutBeforeLoadResolved = true\n  })\n  const layoutLoader = vi.fn(() => sleep(10))\n  const layoutRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    beforeLoad: layoutBeforeLoad,\n    loader: layoutLoader,\n    id: '/_layout',\n  })\n\n  const fooRoute = new BaseRoute({\n    getParentRoute: () => layoutRoute,\n    path: '/foo',\n  })\n  const barRoute = new BaseRoute({\n    getParentRoute: () => layoutRoute,\n    path: '/bar',\n  })\n\n  const routeTree = rootRoute.addChildren([\n    layoutRoute.addChildren([fooRoute, barRoute]),\n  ])\n\n  const router = createTestRouter({\n    routeTree,\n    history: createMemoryHistory(),\n    defaultStaleTime: 1000,\n    defaultGcTime: 1000,\n  })\n\n  await router.navigate({ to: '/foo' })\n  expect(router.state.location.pathname).toBe('/foo')\n\n  rootBeforeLoadResolved = false\n  layoutBeforeLoadResolved = false\n  vi.clearAllMocks()\n\n  /*\n   * When navigating between sibling routes,\n   * do the parent routes get re-executed?\n   */\n\n  await router.navigate({ to: '/bar' })\n  expect(router.state.location.pathname).toBe('/bar')\n\n  // beforeLoads always re-execute\n  expect(rootBeforeLoad).toHaveBeenCalledTimes(1)\n  expect(layoutBeforeLoad).toHaveBeenCalledTimes(1)\n\n  // beforeLoads are called in order\n  expect(rootBeforeLoad.mock.invocationCallOrder[0]).toBeLessThan(\n    layoutBeforeLoad.mock.invocationCallOrder[0]!,\n  )\n\n  // loaders are skipped because of staleTime\n  expect(rootLoader).toHaveBeenCalledTimes(0)\n  expect(layoutLoader).toHaveBeenCalledTimes(0)\n\n  // beforeLoad calls were correctly awaited\n  expect(rootBeforeLoadResolved).toBe(true)\n  expect(layoutBeforeLoadResolved).toBe(true)\n})\n\ndescribe('stale loader reload triggers', () => {\n  beforeEach(() => {\n    vi.useFakeTimers()\n    vi.setSystemTime(0)\n  })\n\n  afterEach(() => {\n    vi.useRealTimers()\n  })\n\n  const getMatchById = (\n    router: RouterCore<any, any, any, any, any>,\n    id: string,\n  ) =>\n    router.state.matches.find((match) => match.id === id) ??\n    router.stores.pendingMatchesSnapshot.state.find(\n      (match) => match.id === id,\n    ) ??\n    router.stores.cachedMatchesSnapshot.state.find((match) => match.id === id)\n\n  const hasActiveMatch = (\n    router: RouterCore<any, any, any, any, any>,\n    id: string,\n  ) => router.state.matches.some((match) => match.id === id)\n\n  const hasPendingMatch = (\n    router: RouterCore<any, any, any, any, any>,\n    id: string,\n  ) =>\n    router.stores.pendingMatchesSnapshot.state.some(\n      (match) => match.id === id,\n    ) ?? false\n\n  const setup = ({\n    loader,\n    staleTime,\n    defaultStaleReloadMode,\n  }: {\n    loader?: Loader\n    staleTime?: number\n    defaultStaleReloadMode?: LoaderStaleReloadMode\n  }) => {\n    const rootRoute = new BaseRootRoute({})\n\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      loader,\n      staleTime,\n      gcTime: 60_000,\n    })\n\n    const barRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/bar',\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute, barRoute])\n\n    return createTestRouter({\n      routeTree,\n      defaultStaleReloadMode,\n      history: createMemoryHistory(),\n    })\n  }\n\n  const createControlledStaleReload = () => {\n    let resolveStaleReload: (() => void) | undefined\n    let callCount = 0\n\n    const loader = vi.fn(() => {\n      callCount += 1\n      if (callCount === 1) {\n        return { value: 'first' }\n      }\n\n      return new Promise<{ value: string }>((resolve) => {\n        resolveStaleReload = () => resolve({ value: 'second' })\n      })\n    })\n\n    return {\n      loader,\n      resolveStaleReload: () => resolveStaleReload?.(),\n    }\n  }\n\n  const expectBlockingStaleReloadBehavior = async (\n    router: RouterCore<any, any, any, any, any>,\n    loader: ReturnType<typeof vi.fn>,\n    resolveStaleReload: () => void,\n  ) => {\n    await router.navigate({ to: '/foo' })\n    expect(loader).toHaveBeenCalledTimes(1)\n    expect(getMatchById(router, '/foo/foo')?.loaderData).toEqual({\n      value: 'first',\n    })\n\n    await vi.advanceTimersByTimeAsync(1)\n    await router.navigate({ to: '/bar' })\n    await vi.advanceTimersByTimeAsync(1)\n\n    const revisit = router.navigate({ to: '/foo' })\n    await Promise.resolve()\n\n    expect(loader).toHaveBeenCalledTimes(2)\n    expect(hasActiveMatch(router, '/bar/bar')).toBe(true)\n    expect(hasActiveMatch(router, '/foo/foo')).toBe(false)\n    expect(hasPendingMatch(router, '/foo/foo')).toBe(true)\n    expect(getMatchById(router, '/foo/foo')?.loaderData).toEqual({\n      value: 'first',\n    })\n\n    resolveStaleReload()\n    await revisit\n\n    expect(loader).toHaveBeenCalledTimes(2)\n    expect(hasActiveMatch(router, '/foo/foo')).toBe(true)\n    expect(hasPendingMatch(router, '/foo/foo')).toBe(false)\n    expect(router.state.location.pathname).toBe('/foo')\n    expect(getMatchById(router, '/foo/foo')?.loaderData).toEqual({\n      value: 'second',\n    })\n  }\n\n  const expectBackgroundStaleReloadBehavior = async (\n    router: RouterCore<any, any, any, any, any>,\n    loader: ReturnType<typeof vi.fn>,\n    resolveStaleReload: () => void,\n  ) => {\n    await router.navigate({ to: '/foo' })\n    expect(loader).toHaveBeenCalledTimes(1)\n\n    await vi.advanceTimersByTimeAsync(1)\n    await router.navigate({ to: '/bar' })\n    await vi.advanceTimersByTimeAsync(1)\n\n    const revisit = router.navigate({ to: '/foo' })\n\n    expect(loader).toHaveBeenCalledTimes(2)\n\n    await revisit\n    const backgroundReloadPromise = getMatchById(router, '/foo/foo')\n      ?._nonReactive.loaderPromise\n\n    expect(backgroundReloadPromise).toBeDefined()\n    expect(hasActiveMatch(router, '/foo/foo')).toBe(true)\n    expect(hasPendingMatch(router, '/foo/foo')).toBe(false)\n    expect(router.state.location.pathname).toBe('/foo')\n    expect(getMatchById(router, '/foo/foo')?.loaderData).toEqual({\n      value: 'first',\n    })\n\n    resolveStaleReload()\n    await backgroundReloadPromise\n\n    expect(getMatchById(router, '/foo/foo')?.loaderData).toEqual({\n      value: 'second',\n    })\n  }\n\n  test('skips stale loader when only unrelated search params change', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const loader = vi.fn(() => ({ ok: true }))\n\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      loader,\n      staleTime: 0,\n      gcTime: 0,\n      loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n        page: search['page'],\n      }),\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({ to: '/foo', search: { page: '1', filter: 'a' } })\n    expect(loader).toHaveBeenCalledTimes(1)\n\n    await router.navigate({ to: '/foo', search: { page: '1', filter: 'b' } })\n\n    expect(loader).toHaveBeenCalledTimes(1)\n  })\n\n  test('reloads stale loader when loader deps change', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const loader = vi.fn(() => ({ ok: true }))\n\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      loader,\n      staleTime: 0,\n      gcTime: 0,\n      loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n        page: search['page'],\n      }),\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({ to: '/foo', search: { page: '1' } })\n    expect(loader).toHaveBeenCalledTimes(1)\n\n    await router.navigate({ to: '/foo', search: { page: '2' } })\n\n    expect(loader).toHaveBeenCalledTimes(2)\n  })\n\n  test('reloads a stale preloaded loader when switching to a different match id of the same route', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const rootLoader = vi.fn(() => ({ ok: true }))\n    const childLoader = vi.fn(() => ({ ok: true }))\n\n    const rootChildRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      loader: rootLoader,\n      staleTime: 0,\n      gcTime: 0,\n      loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n        page: search['page'],\n      }),\n    })\n\n    const leafRoute = new BaseRoute({\n      getParentRoute: () => rootChildRoute,\n      path: '/$postId',\n      loader: childLoader,\n      staleTime: 0,\n      gcTime: 0,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      rootChildRoute.addChildren([leafRoute]),\n    ])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({\n      to: '/posts/$postId',\n      params: { postId: '1' },\n      search: { page: '1' },\n    })\n\n    expect(rootLoader).toHaveBeenCalledTimes(1)\n    expect(childLoader).toHaveBeenCalledTimes(1)\n\n    await router.preloadRoute({\n      to: '/posts/$postId',\n      params: { postId: '2' },\n      search: { page: '2' },\n    })\n\n    expect(rootLoader).toHaveBeenCalledTimes(2)\n    expect(childLoader).toHaveBeenCalledTimes(2)\n\n    await vi.advanceTimersByTimeAsync(1)\n\n    await router.navigate({\n      to: '/posts/$postId',\n      params: { postId: '2' },\n      search: { page: '2' },\n    })\n\n    expect(rootLoader).toHaveBeenCalledTimes(3)\n    expect(childLoader).toHaveBeenCalledTimes(3)\n  })\n\n  test('skips stale ancestor loader when only a child path param changes', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const parentLoader = vi.fn(() => ({ ok: true }))\n    const childLoader = vi.fn(() => ({ ok: true }))\n\n    const orgRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/orgs/$orgId',\n      loader: parentLoader,\n      staleTime: 0,\n      gcTime: 0,\n    })\n\n    const userRoute = new BaseRoute({\n      getParentRoute: () => orgRoute,\n      path: '/users/$userId',\n      loader: childLoader,\n      staleTime: 0,\n      gcTime: 0,\n    })\n\n    const routeTree = rootRoute.addChildren([orgRoute.addChildren([userRoute])])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({\n      to: '/orgs/$orgId/users/$userId',\n      params: { orgId: 'acme', userId: 'u1' },\n    })\n    expect(parentLoader).toHaveBeenCalledTimes(1)\n    expect(childLoader).toHaveBeenCalledTimes(1)\n\n    await router.navigate({\n      to: '/orgs/$orgId/users/$userId',\n      params: { orgId: 'acme', userId: 'u2' },\n    })\n\n    expect(parentLoader).toHaveBeenCalledTimes(1)\n    expect(childLoader).toHaveBeenCalledTimes(2)\n  })\n\n  test('reloads stale ancestor loader when its own path param changes', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const parentLoader = vi.fn(() => ({ ok: true }))\n    const childLoader = vi.fn(() => ({ ok: true }))\n\n    const orgRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/orgs/$orgId',\n      loader: parentLoader,\n      staleTime: 0,\n      gcTime: 0,\n    })\n\n    const userRoute = new BaseRoute({\n      getParentRoute: () => orgRoute,\n      path: '/users/$userId',\n      loader: childLoader,\n      staleTime: 0,\n      gcTime: 0,\n    })\n\n    const routeTree = rootRoute.addChildren([orgRoute.addChildren([userRoute])])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({\n      to: '/orgs/$orgId/users/$userId',\n      params: { orgId: 'acme', userId: 'u1' },\n    })\n    expect(parentLoader).toHaveBeenCalledTimes(1)\n    expect(childLoader).toHaveBeenCalledTimes(1)\n\n    await router.navigate({\n      to: '/orgs/$orgId/users/$userId',\n      params: { orgId: 'beta', userId: 'u2' },\n    })\n\n    expect(parentLoader).toHaveBeenCalledTimes(2)\n    expect(childLoader).toHaveBeenCalledTimes(2)\n  })\n\n  test('revalidates stale loaders on explicit same-location router.load()', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const loader = vi.fn(() => ({ ok: true }))\n\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      loader,\n      staleTime: 0,\n      gcTime: 0,\n      loaderDeps: ({ search }: { search: Record<string, unknown> }) => ({\n        page: search['page'],\n      }),\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({ to: '/foo', search: { page: '1', filter: 'a' } })\n    expect(loader).toHaveBeenCalledTimes(1)\n\n    await vi.advanceTimersByTimeAsync(1)\n    await router.load()\n    await Promise.resolve()\n\n    expect(loader).toHaveBeenCalledTimes(2)\n  })\n\n  test('supports object-form loader handler', async () => {\n    const handler = vi.fn(() => ({ ok: true }))\n    const router = setup({\n      loader: {\n        handler,\n      } satisfies LoaderEntry,\n    })\n\n    await router.navigate({ to: '/foo' })\n\n    expect(handler).toHaveBeenCalledTimes(1)\n    expect(router.state.matches).toEqual(\n      expect.arrayContaining([\n        expect.objectContaining({\n          id: '/foo/foo',\n          loaderData: { ok: true },\n        }),\n      ]),\n    )\n  })\n\n  test('reloads stale loaders in the background by default', async () => {\n    const { loader, resolveStaleReload } = createControlledStaleReload()\n    const router = setup({ loader, staleTime: 0 })\n\n    await expectBackgroundStaleReloadBehavior(\n      router,\n      loader,\n      resolveStaleReload,\n    )\n  })\n\n  test('blocks stale reloads when loader staleReloadMode is blocking', async () => {\n    const { loader, resolveStaleReload } = createControlledStaleReload()\n    const router = setup({\n      staleTime: 0,\n      loader: {\n        handler: loader,\n        staleReloadMode: 'blocking',\n      } satisfies LoaderEntry,\n    })\n\n    await expectBlockingStaleReloadBehavior(router, loader, resolveStaleReload)\n  })\n\n  test('blocks stale reloads when defaultStaleReloadMode is blocking', async () => {\n    const { loader, resolveStaleReload } = createControlledStaleReload()\n    const router = setup({\n      loader,\n      staleTime: 0,\n      defaultStaleReloadMode: 'blocking',\n    })\n\n    await expectBlockingStaleReloadBehavior(router, loader, resolveStaleReload)\n  })\n\n  test('loader staleReloadMode overrides defaultStaleReloadMode', async () => {\n    const { loader, resolveStaleReload } = createControlledStaleReload()\n    const router = setup({\n      staleTime: 0,\n      defaultStaleReloadMode: 'blocking',\n      loader: {\n        handler: loader,\n        staleReloadMode: 'background',\n      } satisfies LoaderEntry,\n    })\n\n    await expectBackgroundStaleReloadBehavior(\n      router,\n      loader,\n      resolveStaleReload,\n    )\n  })\n})\n\ntest('cancelMatches after pending timeout', async () => {\n  const WAIT_TIME = 5\n  const onAbortMock = vi.fn()\n  const rootRoute = new BaseRootRoute({})\n  const fooRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    path: '/foo',\n    pendingMs: WAIT_TIME * 20,\n    loader: async ({ abortController }) => {\n      await new Promise<void>((resolve) => {\n        const timer = setTimeout(() => {\n          resolve()\n        }, WAIT_TIME * 40)\n        abortController.signal.addEventListener('abort', () => {\n          onAbortMock()\n          clearTimeout(timer)\n          resolve()\n        })\n      })\n    },\n    pendingComponent: {},\n  })\n  const barRoute = new BaseRoute({\n    getParentRoute: () => rootRoute,\n    path: '/bar',\n  })\n  const routeTree = rootRoute.addChildren([fooRoute, barRoute])\n  const router = createTestRouter({ routeTree, history: createMemoryHistory() })\n\n  await router.load()\n  router.navigate({ to: '/foo' })\n  await sleep(WAIT_TIME * 30)\n\n  // At this point, pending timeout should have triggered\n  const fooMatch = router.getMatch('/foo/foo')\n  expect(fooMatch).toBeDefined()\n\n  // Navigate away, which should cancel the pending match\n  await router.navigate({ to: '/bar' })\n  await router.latestLoadPromise\n\n  expect(router.state.location.pathname).toBe('/bar')\n\n  // Verify that abort was called and pending timeout was cleared\n  expect(onAbortMock).toHaveBeenCalled()\n  const cancelledFooMatch = router.getMatch('/foo/foo')\n  expect(cancelledFooMatch?._nonReactive.pendingTimeout).toBeUndefined()\n})\n\ndescribe('head execution', () => {\n  const setupBeforeLoadNotFoundHierarchy = (throwAtIndex: 1 | 2 | 3) => {\n    const loaderResolvers: Array<(() => void) | undefined> = []\n\n    const makeLoader = (index: number) =>\n      vi.fn(async () => {\n        await new Promise<void>((resolve) => {\n          loaderResolvers[index] = resolve\n        })\n        return { level: index }\n      })\n\n    const makeHead = (label: string) =>\n      vi.fn(() => ({ meta: [{ title: label }] }))\n\n    const rootRoute = new BaseRootRoute({\n      loader: makeLoader(0),\n      head: makeHead('Root'),\n    })\n\n    const level1Route = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/level-1',\n      loader: makeLoader(1),\n      head: makeHead('Level 1'),\n      beforeLoad:\n        throwAtIndex === 1\n          ? () => {\n              throw notFound()\n            }\n          : undefined,\n    })\n\n    const level2Route = new BaseRoute({\n      getParentRoute: () => level1Route,\n      path: '/level-2',\n      loader: makeLoader(2),\n      head: makeHead('Level 2'),\n      beforeLoad:\n        throwAtIndex === 2\n          ? () => {\n              throw notFound()\n            }\n          : undefined,\n    })\n\n    const level3Route = new BaseRoute({\n      getParentRoute: () => level2Route,\n      path: '/level-3',\n      loader: makeLoader(3),\n      head: makeHead('Level 3'),\n      beforeLoad:\n        throwAtIndex === 3\n          ? () => {\n              throw notFound()\n            }\n          : undefined,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      level1Route.addChildren([level2Route.addChildren([level3Route])]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/level-1/level-2/level-3'],\n      }),\n    })\n\n    const routes = [rootRoute, level1Route, level2Route, level3Route] as const\n    const loaders = routes.map(\n      (route) => route.options.loader as ReturnType<typeof makeLoader>,\n    )\n    const heads = routes.map(\n      (route) => route.options.head as ReturnType<typeof makeHead>,\n    )\n\n    return {\n      router,\n      routes,\n      loaders,\n      heads,\n      loaderResolvers,\n      throwAtIndex,\n    }\n  }\n\n  const assertBeforeLoadNotFoundHierarchy = async (throwAtIndex: 1 | 2 | 3) => {\n    const { router, routes, loaders, heads, loaderResolvers } =\n      setupBeforeLoadNotFoundHierarchy(throwAtIndex)\n\n    let loadResolved = false\n    const loadPromise = router.load().then(() => {\n      loadResolved = true\n    })\n\n    await Promise.resolve()\n    await Promise.resolve()\n\n    for (let i = 0; i < routes.length; i++) {\n      const loader = loaders[i]!\n      const expectedCalls = i < throwAtIndex ? 1 : 0\n      expect(loader).toHaveBeenCalledTimes(expectedCalls)\n    }\n\n    expect(loadResolved).toBe(false)\n\n    for (let i = 0; i < throwAtIndex; i++) {\n      expect(loaderResolvers[i]).toBeDefined()\n      loaderResolvers[i]!()\n    }\n\n    await loadPromise\n\n    for (let i = 0; i < heads.length; i++) {\n      const head = heads[i]!\n      const expectedCalls = i <= throwAtIndex ? 1 : 0\n      expect(head).toHaveBeenCalledTimes(expectedCalls)\n    }\n\n    for (let i = 0; i < throwAtIndex; i++) {\n      const route = routes[i]!\n      const match = router.state.matches.find((m) => m.routeId === route.id)\n      expect(match?.loaderData).toEqual({ level: i })\n    }\n\n    const thrownRoute = routes[throwAtIndex]!\n    const thrownMatch = router.state.matches.find(\n      (m) => m.routeId === thrownRoute.id,\n    )\n    expect(thrownMatch?.status).toBe('notFound')\n  }\n\n  ;([1, 2, 3] as const).forEach((throwAtIndex) => {\n    test(`beforeLoad notFound at hierarchy level ${throwAtIndex} waits for parent loader data and executes heads`, async () => {\n      await assertBeforeLoadNotFoundHierarchy(throwAtIndex)\n    })\n  })\n\n  test('executes head once when loader throws notFound', async () => {\n    const head = vi.fn(() => ({ meta: [{ title: 'Test' }] }))\n    const rootRoute = new BaseRootRoute({})\n    const testRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/test',\n      loader: () => {\n        throw notFound()\n      },\n      head,\n    })\n    const routeTree = rootRoute.addChildren([testRoute])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/test'] }),\n    })\n\n    await router.load()\n\n    expect(head).toHaveBeenCalledTimes(1)\n    const match = router.state.matches.find((m) => m.routeId === testRoute.id)\n    expect(match?.status).toBe('notFound')\n  })\n\n  test('propagates sync beforeLoad non-notFound error running ancestor loaders and heads', async () => {\n    const beforeLoadError = new Error('beforeLoad-sync-error')\n    const rootLoader = vi.fn(() => ({ level: 0 }))\n    const rootHead = vi.fn(() => ({ meta: [{ title: 'Root' }] }))\n\n    const rootRoute = new BaseRootRoute({\n      loader: rootLoader,\n      head: rootHead,\n    })\n\n    const childLoader = vi.fn(() => ({ level: 1 }))\n    const childHead = vi.fn(() => ({ meta: [{ title: 'Child' }] }))\n\n    const childRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/test',\n      beforeLoad: () => {\n        throw beforeLoadError\n      },\n      loader: childLoader,\n      head: childHead,\n    })\n\n    const routeTree = rootRoute.addChildren([childRoute])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/test'] }),\n    })\n\n    const location = router.latestLocation\n    const matches = router.matchRoutes(location)\n    router.stores.setPendingMatches(matches)\n\n    await expect(\n      loadMatches({\n        router,\n        location,\n        matches,\n        updateMatch: router.updateMatch,\n      }),\n    ).rejects.toBe(beforeLoadError)\n\n    expect(rootLoader).toHaveBeenCalledTimes(1)\n    expect(childLoader).toHaveBeenCalledTimes(0)\n    // Head functions still run for ancestors up to the erroring match so that\n    // SSR produces valid <head> content (e.g. charset, viewport, stylesheets).\n    expect(rootHead).toHaveBeenCalledTimes(1)\n    expect(childHead).toHaveBeenCalledTimes(1)\n  })\n\n  test('propagates async beforeLoad non-notFound error running ancestor loaders and heads', async () => {\n    const beforeLoadError = new Error('beforeLoad-async-error')\n    const rootLoader = vi.fn(() => ({ level: 0 }))\n    const rootHead = vi.fn(() => ({ meta: [{ title: 'Root' }] }))\n\n    const rootRoute = new BaseRootRoute({\n      loader: rootLoader,\n      head: rootHead,\n    })\n\n    const childLoader = vi.fn(() => ({ level: 1 }))\n    const childHead = vi.fn(() => ({ meta: [{ title: 'Child' }] }))\n\n    const childRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/test',\n      beforeLoad: async () => {\n        await Promise.resolve()\n        throw beforeLoadError\n      },\n      loader: childLoader,\n      head: childHead,\n    })\n\n    const routeTree = rootRoute.addChildren([childRoute])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/test'] }),\n    })\n\n    const location = router.latestLocation\n    const matches = router.matchRoutes(location)\n    router.stores.setPendingMatches(matches)\n\n    await expect(\n      loadMatches({\n        router,\n        location,\n        matches,\n        updateMatch: router.updateMatch,\n      }),\n    ).rejects.toBe(beforeLoadError)\n\n    expect(rootLoader).toHaveBeenCalledTimes(1)\n    expect(childLoader).toHaveBeenCalledTimes(0)\n    // Head functions still run for ancestors up to the erroring match so that\n    // SSR produces valid <head> content (e.g. charset, viewport, stylesheets).\n    expect(rootHead).toHaveBeenCalledTimes(1)\n    expect(childHead).toHaveBeenCalledTimes(1)\n  })\n\n  describe('beforeLoad notFound parent loader outcomes', () => {\n    type ThrowAtIndex = 1 | 2 | 3\n    type ParentFailure = 'notFound' | 'redirect' | 'error'\n    type ParentFailureMap = Partial<Record<0 | 1 | 2, ParentFailure>>\n    type Scenario = {\n      name: string\n      throwAtIndex: ThrowAtIndex\n      parentFailures: ParentFailureMap\n      expectedErrorKind: 'notFound' | 'redirect' | 'error'\n      expectedErrorSource?: string\n      expectedErrorRouteIndex?: 0 | 1 | 2 | 3\n      expectedLoaderMaxIndex: number\n      expectedRenderedHeadMaxIndex: number\n      withDefaultNotFoundComponent?: boolean\n      beforeLoadNotFoundFactory?: (\n        routes: readonly [any, any, any, any],\n      ) => ReturnType<typeof notFound>\n      expectRootNotFoundComponentAssigned?: boolean\n    }\n\n    const setupScenario = ({\n      throwAtIndex,\n      parentFailures,\n      beforeLoadNotFoundFactory,\n      withDefaultNotFoundComponent,\n    }: {\n      throwAtIndex: ThrowAtIndex\n      parentFailures: ParentFailureMap\n      beforeLoadNotFoundFactory?: Scenario['beforeLoadNotFoundFactory']\n      withDefaultNotFoundComponent?: boolean\n    }) => {\n      const makeHead = (label: string) =>\n        vi.fn(() => ({ meta: [{ title: label }] }))\n\n      const makeLoader = (index: number) =>\n        vi.fn(() => {\n          const failure = parentFailures[index as 0 | 1 | 2]\n          if (failure === 'notFound') {\n            throw notFound({ data: { source: `loader-${index}` } })\n          }\n          if (failure === 'redirect') {\n            throw redirect({ to: '/redirect-target' })\n          }\n          return { level: index }\n        })\n\n      const rootRoute = new BaseRootRoute({\n        loader: makeLoader(0),\n        head: makeHead('Root'),\n      })\n\n      const level1Route = new BaseRoute({\n        getParentRoute: () => rootRoute,\n        path: '/level-1',\n        loader: makeLoader(1),\n        head: makeHead('Level 1'),\n      })\n\n      const level2Route = new BaseRoute({\n        getParentRoute: () => level1Route,\n        path: '/level-2',\n        loader: makeLoader(2),\n        head: makeHead('Level 2'),\n      })\n\n      const level3Route = new BaseRoute({\n        getParentRoute: () => level2Route,\n        path: '/level-3',\n        loader: makeLoader(3),\n        head: makeHead('Level 3'),\n      })\n\n      const redirectTargetRoute = new BaseRoute({\n        getParentRoute: () => rootRoute,\n        path: '/redirect-target',\n      })\n\n      const routeTree = rootRoute.addChildren([\n        level1Route.addChildren([level2Route.addChildren([level3Route])]),\n        redirectTargetRoute,\n      ])\n\n      const routes = [rootRoute, level1Route, level2Route, level3Route] as const\n\n      ;([0, 1, 2] as const).forEach((index) => {\n        if (parentFailures[index] === 'error') {\n          ;(routes[index].options as any).shouldReload = () => {\n            throw new Error(`loader-${index}-error`)\n          }\n        }\n      })\n\n      const throwRoute = routes[throwAtIndex]!\n      throwRoute.options.beforeLoad = () => {\n        const beforeLoadNotFound = beforeLoadNotFoundFactory\n          ? beforeLoadNotFoundFactory(routes)\n          : notFound({ data: { source: `beforeLoad-${throwAtIndex}` } })\n        throw beforeLoadNotFound\n      }\n\n      const router = createTestRouter({\n        routeTree,\n        history: createMemoryHistory({\n          initialEntries: ['/level-1/level-2/level-3'],\n        }),\n        ...(withDefaultNotFoundComponent\n          ? { defaultNotFoundComponent: () => null }\n          : {}),\n      })\n\n      const loaders = routes.map(\n        (route) => route.options.loader as ReturnType<typeof makeLoader>,\n      )\n      const heads = routes.map(\n        (route) => route.options.head as ReturnType<typeof makeHead>,\n      )\n\n      return {\n        router,\n        routes,\n        loaders,\n        heads,\n      }\n    }\n\n    const runLoadMatchesAndCapture = async (router: AnyRouter) => {\n      const location = router.latestLocation\n      const matches = router.matchRoutes(location)\n      router.stores.setPendingMatches(matches)\n\n      try {\n        await loadMatches({\n          router,\n          location,\n          matches,\n          updateMatch: router.updateMatch,\n        })\n        return { error: undefined, matches }\n      } catch (error) {\n        return { error, matches }\n      }\n    }\n\n    const scenarios = [\n      {\n        name: 'throws beforeLoad notFound when parent loaders succeed',\n        throwAtIndex: 3 as const,\n        parentFailures: {} as ParentFailureMap,\n        expectedErrorKind: 'notFound' as const,\n        expectedErrorSource: 'beforeLoad-3',\n        expectedLoaderMaxIndex: 2,\n        expectedRenderedHeadMaxIndex: 3,\n      },\n      {\n        name: 'uses parent loader notFound when parent loader throws notFound',\n        throwAtIndex: 3 as const,\n        parentFailures: { 1: 'notFound' } as ParentFailureMap,\n        expectedErrorKind: 'notFound' as const,\n        expectedErrorSource: 'loader-1',\n        expectedLoaderMaxIndex: 2,\n        expectedRenderedHeadMaxIndex: 1,\n      },\n      {\n        name: 'uses first parent loader notFound when multiple parent loaders throw notFound',\n        throwAtIndex: 3 as const,\n        parentFailures: { 1: 'notFound', 2: 'notFound' } as ParentFailureMap,\n        expectedErrorKind: 'notFound' as const,\n        expectedErrorSource: 'loader-1',\n        expectedLoaderMaxIndex: 2,\n        expectedRenderedHeadMaxIndex: 1,\n      },\n      {\n        name: 'uses parent loader notFound when root loader throws notFound',\n        throwAtIndex: 2 as const,\n        parentFailures: { 0: 'notFound' } as ParentFailureMap,\n        expectedErrorKind: 'notFound' as const,\n        expectedErrorSource: 'loader-0',\n        expectedLoaderMaxIndex: 1,\n        expectedRenderedHeadMaxIndex: 0,\n      },\n      {\n        name: 'uses explicit routeId from beforeLoad notFound to target ancestor boundary',\n        throwAtIndex: 3 as const,\n        parentFailures: {} as ParentFailureMap,\n        expectedErrorKind: 'notFound' as const,\n        expectedErrorSource: 'beforeLoad-explicit-level1',\n        expectedErrorRouteIndex: 1,\n        expectedLoaderMaxIndex: 1,\n        expectedRenderedHeadMaxIndex: 1,\n        beforeLoadNotFoundFactory: (routes) =>\n          notFound({\n            routeId: routes[1].id as never,\n            data: { source: 'beforeLoad-explicit-level1' },\n          }),\n      },\n      {\n        name: 'falls back to root boundary when beforeLoad notFound uses unknown routeId',\n        throwAtIndex: 3 as const,\n        parentFailures: {} as ParentFailureMap,\n        expectedErrorKind: 'notFound' as const,\n        expectedErrorSource: 'beforeLoad-invalid-route',\n        expectedLoaderMaxIndex: 0,\n        expectedRenderedHeadMaxIndex: 0,\n        beforeLoadNotFoundFactory: () =>\n          notFound({\n            routeId: '/does-not-exist' as never,\n            data: { source: 'beforeLoad-invalid-route' },\n          }),\n      },\n      {\n        name: 'falls back to root boundary when beforeLoad notFound uses non-exact routeId',\n        throwAtIndex: 3 as const,\n        parentFailures: {} as ParentFailureMap,\n        expectedErrorKind: 'notFound' as const,\n        expectedErrorSource: 'beforeLoad-non-exact-route',\n        expectedLoaderMaxIndex: 0,\n        expectedRenderedHeadMaxIndex: 0,\n        beforeLoadNotFoundFactory: (routes) =>\n          notFound({\n            routeId: `${routes[1].id}/` as never,\n            data: { source: 'beforeLoad-non-exact-route' },\n          }),\n      },\n      {\n        name: 'assigns defaultNotFoundComponent on root when unknown routeId falls back to root',\n        throwAtIndex: 3 as const,\n        parentFailures: {} as ParentFailureMap,\n        expectedErrorKind: 'notFound' as const,\n        expectedErrorSource: 'beforeLoad-invalid-route-default',\n        expectedLoaderMaxIndex: 0,\n        expectedRenderedHeadMaxIndex: 0,\n        withDefaultNotFoundComponent: true,\n        expectRootNotFoundComponentAssigned: true,\n        beforeLoadNotFoundFactory: () =>\n          notFound({\n            routeId: '/does-not-exist' as never,\n            data: { source: 'beforeLoad-invalid-route-default' },\n          }),\n      },\n      {\n        name: 'prioritizes redirect when parent loader throws redirect',\n        throwAtIndex: 3 as const,\n        parentFailures: { 0: 'redirect' } as ParentFailureMap,\n        expectedErrorKind: 'redirect' as const,\n        expectedErrorSource: undefined,\n        expectedLoaderMaxIndex: 2,\n        expectedRenderedHeadMaxIndex: -1,\n      },\n      {\n        name: 'prioritizes redirect over root-loader notFound when both appear in settled loaders',\n        throwAtIndex: 3 as const,\n        parentFailures: { 0: 'notFound', 1: 'redirect' } as ParentFailureMap,\n        expectedErrorKind: 'redirect' as const,\n        expectedErrorSource: undefined,\n        expectedLoaderMaxIndex: 2,\n        expectedRenderedHeadMaxIndex: -1,\n      },\n      {\n        name: 'propagates regular loader error when mixed with loader notFound in settled loaders',\n        throwAtIndex: 3 as const,\n        parentFailures: { 1: 'notFound', 2: 'error' } as ParentFailureMap,\n        expectedErrorKind: 'error' as const,\n        expectedErrorSource: 'loader-2-error',\n        expectedLoaderMaxIndex: 1,\n        expectedRenderedHeadMaxIndex: -1,\n      },\n    ] satisfies Array<Scenario>\n\n    test.each(scenarios)('$name', async (scenario) => {\n      const { router, routes, loaders, heads } = setupScenario({\n        throwAtIndex: scenario.throwAtIndex,\n        parentFailures: scenario.parentFailures,\n        beforeLoadNotFoundFactory: scenario.beforeLoadNotFoundFactory,\n        withDefaultNotFoundComponent: scenario.withDefaultNotFoundComponent,\n      })\n\n      const { error, matches } = await runLoadMatchesAndCapture(router)\n\n      for (let i = 0; i < routes.length; i++) {\n        const loader = loaders[i]!\n        const expectedCalls = i <= scenario.expectedLoaderMaxIndex ? 1 : 0\n        expect(loader).toHaveBeenCalledTimes(expectedCalls)\n      }\n\n      for (let i = 0; i < heads.length; i++) {\n        const head = heads[i]!\n        const expectedCalls = i <= scenario.expectedRenderedHeadMaxIndex ? 1 : 0\n        expect(head).toHaveBeenCalledTimes(expectedCalls)\n      }\n\n      if (scenario.expectedErrorKind === 'redirect') {\n        expect(error).toEqual(\n          expect.objectContaining({\n            redirectHandled: true,\n            options: expect.objectContaining({\n              to: '/redirect-target',\n            }),\n          }),\n        )\n        return\n      }\n\n      if (scenario.expectedErrorKind === 'error') {\n        expect(error).toBeInstanceOf(Error)\n        expect((error as Error).message).toBe(scenario.expectedErrorSource)\n        return\n      }\n\n      expect(error).toEqual(\n        expect.objectContaining({\n          isNotFound: true,\n          data: { source: scenario.expectedErrorSource },\n        }),\n      )\n\n      if (scenario.expectedErrorRouteIndex !== undefined) {\n        expect((error as { routeId?: string }).routeId).toBe(\n          routes[scenario.expectedErrorRouteIndex]!.id,\n        )\n      }\n\n      if (scenario.expectRootNotFoundComponentAssigned) {\n        expect(routes[0].options.notFoundComponent).toBeTypeOf('function')\n      }\n    })\n\n    test('sets globalNotFound on root match when beforeLoad notFound targets root boundary', async () => {\n      const { router, routes } = setupScenario({\n        throwAtIndex: 3,\n        parentFailures: {},\n        beforeLoadNotFoundFactory: (innerRoutes) =>\n          notFound({\n            routeId: innerRoutes[0].id as never,\n            data: { source: 'beforeLoad-root-explicit' },\n          }),\n      })\n\n      const { error, matches } = await runLoadMatchesAndCapture(router)\n\n      expect(error).toEqual(\n        expect.objectContaining({\n          isNotFound: true,\n          data: { source: 'beforeLoad-root-explicit' },\n        }),\n      )\n\n      const rootMatch = router.stores.pendingMatchesSnapshot.state.find(\n        (m) => m.routeId === routes[0].id,\n      )\n\n      expect(rootMatch?.globalNotFound).toBe(true)\n      expect(rootMatch?.status).toBe('success')\n      expect(rootMatch?.error).toBeUndefined()\n    })\n\n    test('clears stale root globalNotFound on subsequent successful load', async () => {\n      const { router, routes } = setupScenario({\n        throwAtIndex: 3,\n        parentFailures: {},\n        beforeLoadNotFoundFactory: (innerRoutes) =>\n          notFound({\n            routeId: innerRoutes[0].id as never,\n            data: { source: 'beforeLoad-root-explicit' },\n          }),\n      })\n\n      const first = await runLoadMatchesAndCapture(router)\n      expect(first.error).toEqual(expect.objectContaining({ isNotFound: true }))\n\n      const throwingRoute = routes[3]\n      throwingRoute.options.beforeLoad = undefined\n\n      const second = await runLoadMatchesAndCapture(router)\n      expect(second.error).toBeUndefined()\n\n      const rootMatch = router.stores.pendingMatchesSnapshot.state.find(\n        (m) => m.routeId === routes[0].id,\n      )\n\n      expect(rootMatch?.globalNotFound).toBe(false)\n    })\n\n    test('clears stale root globalNotFound when root loader is skipped', async () => {\n      const rootLoader = vi.fn(() => ({ level: 0 }))\n      const rootRoute = new BaseRootRoute({\n        loader: rootLoader,\n        staleTime: Infinity,\n        shouldReload: () => false,\n      })\n\n      const childLoader = vi.fn(() => ({ level: 1 }))\n      const childRoute = new BaseRoute({\n        getParentRoute: () => rootRoute,\n        path: '/test',\n        loader: childLoader,\n        staleTime: Infinity,\n        shouldReload: () => false,\n      })\n\n      const routeTree = rootRoute.addChildren([childRoute])\n\n      const router = createTestRouter({\n        routeTree,\n        history: createMemoryHistory({ initialEntries: ['/test'] }),\n      })\n\n      const first = await runLoadMatchesAndCapture(router)\n      expect(first.error).toBeUndefined()\n      expect(rootLoader).toHaveBeenCalledTimes(1)\n\n      const staleRootNotFound = notFound({ data: { source: 'stale-root' } })\n      const currentRootMatchId =\n        router.stores.pendingMatchesSnapshot.state.find(\n          (m) => m.routeId === rootRoute.id,\n        )!.id\n\n      router.updateMatch(currentRootMatchId, (prev) => ({\n        ...prev,\n        status: 'success',\n        globalNotFound: true,\n        error: staleRootNotFound,\n      }))\n\n      const location = router.latestLocation\n      const matches = router.matchRoutes(location)\n      const pendingRootMatch = matches.find((m) => m.routeId === rootRoute.id)!\n      pendingRootMatch.status = 'success'\n      pendingRootMatch.globalNotFound = false\n      pendingRootMatch.error = undefined\n      router.stores.setPendingMatches(matches)\n\n      await expect(\n        loadMatches({\n          router,\n          location,\n          matches,\n          updateMatch: router.updateMatch,\n        }),\n      ).resolves.toBe(matches)\n\n      expect(rootLoader).toHaveBeenCalledTimes(1)\n\n      const rootMatch = router.stores.pendingMatchesSnapshot.state.find(\n        (m) => m.routeId === rootRoute.id,\n      )\n\n      expect(rootMatch?.globalNotFound).toBe(false)\n      expect(rootMatch?.error).toBeUndefined()\n    })\n  })\n})\n\ndescribe('params.parse notFound', () => {\n  test('throws notFound on invalid params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const testRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/test/$id',\n      params: {\n        parse: ({ id }: { id: string }) => {\n          const parsed = parseInt(id, 10)\n          if (Number.isNaN(parsed)) {\n            throw notFound()\n          }\n          return { id: parsed }\n        },\n      },\n    })\n    const routeTree = rootRoute.addChildren([testRoute])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/test/invalid'] }),\n    })\n\n    await router.load()\n\n    const match = router.stores.activeMatchesSnapshot.state.find(\n      (m) => m.routeId === testRoute.id,\n    )\n\n    expect(match?.status).toBe('notFound')\n  })\n\n  test('succeeds on valid params', async () => {\n    const rootRoute = new BaseRootRoute({})\n    const testRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/test/$id',\n      params: {\n        parse: ({ id }: { id: string }) => {\n          const parsed = parseInt(id, 10)\n          if (Number.isNaN(parsed)) {\n            throw notFound()\n          }\n          return { id: parsed }\n        },\n      },\n    })\n    const routeTree = rootRoute.addChildren([testRoute])\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory({ initialEntries: ['/test/123'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find((m) => m.routeId === testRoute.id)\n    expect(match?.status).toBe('success')\n    expect(router.state.statusCode).toBe(200)\n  })\n})\n\ndescribe('routeId in context options', () => {\n  test('beforeLoad and context receive correct routeId for root route', async () => {\n    const beforeLoad = vi.fn()\n    const context = vi.fn()\n    const rootRoute = new BaseRootRoute({\n      beforeLoad,\n      context,\n    })\n\n    const routeTree = rootRoute.addChildren([])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.load()\n\n    expect(beforeLoad).toHaveBeenCalledTimes(1)\n    expect(beforeLoad).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: rootRouteId,\n      }),\n    )\n\n    expect(context).toHaveBeenCalledTimes(1)\n    expect(context).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: rootRouteId,\n      }),\n    )\n  })\n\n  test('beforeLoad and context receive correct routeId for child route', async () => {\n    const beforeLoad = vi.fn()\n    const context = vi.fn()\n    const rootRoute = new BaseRootRoute({})\n\n    const fooRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/foo',\n      beforeLoad,\n      context,\n    })\n\n    const routeTree = rootRoute.addChildren([fooRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({ to: '/foo' })\n\n    expect(beforeLoad).toHaveBeenCalledTimes(1)\n    expect(beforeLoad).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/foo',\n      }),\n    )\n\n    expect(context).toHaveBeenCalledTimes(1)\n    expect(context).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/foo',\n      }),\n    )\n  })\n\n  test('beforeLoad and context receive correct routeId for nested route', async () => {\n    const parentBeforeLoad = vi.fn()\n    const parentContext = vi.fn()\n    const childBeforeLoad = vi.fn()\n    const childContext = vi.fn()\n    const rootRoute = new BaseRootRoute({})\n\n    const parentRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/parent',\n      beforeLoad: parentBeforeLoad,\n      context: parentContext,\n    })\n\n    const childRoute = new BaseRoute({\n      getParentRoute: () => parentRoute,\n      path: '/child',\n      beforeLoad: childBeforeLoad,\n      context: childContext,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      parentRoute.addChildren([childRoute]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({ to: '/parent/child' })\n\n    expect(parentBeforeLoad).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/parent',\n      }),\n    )\n    expect(parentContext).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/parent',\n      }),\n    )\n    expect(childBeforeLoad).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/parent/child',\n      }),\n    )\n    expect(childContext).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/parent/child',\n      }),\n    )\n  })\n\n  test('beforeLoad and context receive correct routeId for route with dynamic params', async () => {\n    const beforeLoad = vi.fn()\n    const context = vi.fn()\n    const rootRoute = new BaseRootRoute({})\n\n    const postRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/$postId',\n      beforeLoad,\n      context,\n    })\n\n    const routeTree = rootRoute.addChildren([postRoute])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.navigate({ to: '/posts/$postId', params: { postId: '123' } })\n\n    expect(beforeLoad).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/posts/$postId',\n      }),\n    )\n    expect(context).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/posts/$postId',\n      }),\n    )\n  })\n\n  test('beforeLoad and context receive correct routeId for layout route', async () => {\n    const beforeLoad = vi.fn()\n    const context = vi.fn()\n    const rootRoute = new BaseRootRoute({})\n\n    const layoutRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      id: '/_layout',\n      beforeLoad,\n      context,\n    })\n\n    const indexRoute = new BaseRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([indexRoute]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n    })\n\n    await router.load()\n\n    expect(beforeLoad).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/_layout',\n      }),\n    )\n    expect(context).toHaveBeenCalledWith(\n      expect.objectContaining({\n        routeId: '/_layout',\n      }),\n    )\n  })\n})\n\nfunction sleep(ms: number) {\n  return new Promise<void>((resolve) => setTimeout(resolve, ms))\n}\n"
  },
  {
    "path": "packages/router-core/tests/lru.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport { createLRUCache } from '../src/lru-cache'\n\ndescribe('LRU Cache', () => {\n  it('evicts oldest set', () => {\n    const cache = createLRUCache<string, number>(3)\n    cache.set('a', 1)\n    cache.set('b', 2)\n    cache.set('c', 3)\n    cache.set('d', 4) // 'a' should be evicted\n    expect(cache.get('a')).toBeUndefined()\n    expect(cache.get('b')).toBe(2)\n  })\n  it('evicts oldest used', () => {\n    const cache = createLRUCache<string, number>(3)\n    cache.set('a', 1)\n    cache.set('b', 2)\n    cache.set('c', 3)\n    cache.get('a') // 'a' is now the most recently used\n    cache.set('d', 4) // 'b' should be evicted\n    expect(cache.get('b')).toBeUndefined()\n    expect(cache.get('a')).toBe(1)\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/mask.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { createMemoryHistory } from '@tanstack/history'\nimport { BaseRootRoute, BaseRoute } from '../src'\nimport { createTestRouter } from './routerTestUtils'\nimport type { RouteMask } from '../src'\n\ndescribe('buildLocation - route masks', () => {\n  const setup = (routeMasks?: Array<RouteMask<any>>) => {\n    const rootRoute = new BaseRootRoute({})\n    const photoRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/photos/$photoId',\n    })\n\n    const modalRoute = new BaseRoute({\n      getParentRoute: () => photoRoute,\n      path: '/modal',\n    })\n\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n\n    const postRoute = new BaseRoute({\n      getParentRoute: () => postsRoute,\n      path: '/$postId',\n    })\n\n    const infoRoute = new BaseRoute({\n      getParentRoute: () => postRoute,\n      path: '/info',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      photoRoute.addChildren([modalRoute]),\n      postsRoute.addChildren([postRoute.addChildren([infoRoute])]),\n    ])\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n      routeMasks,\n    })\n\n    return router\n  }\n\n  test('should not create maskedLocation when no mask matches', () => {\n    const router = setup()\n\n    const location = router.buildLocation({\n      to: '/photos/$photoId/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeUndefined()\n    expect(location.pathname).toBe('/photos/123/modal')\n  })\n\n  test('should not create maskedLocation when routeMasks is empty', () => {\n    const router = setup([])\n\n    const location = router.buildLocation({\n      to: '/photos/$photoId/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeUndefined()\n    expect(location.pathname).toBe('/photos/123/modal')\n  })\n\n  test('should find and apply mask when pathname matches', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/photos/$photoId',\n        params: true,\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/photos/123')\n    expect(location.pathname).toBe('/photos/123/modal')\n  })\n\n  test('should set params to {} when maskParams is false', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/posts',\n        params: false,\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/posts')\n    // The masked location should have no params since maskParams is false\n    expect(location.maskedLocation!.href).toBe('/posts')\n  })\n\n  test('should set params to {} when maskParams is null', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/posts',\n        params: null,\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/posts')\n    expect(location.maskedLocation!.href).toBe('/posts')\n  })\n\n  test('should use matched params when maskParams is true', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/photos/$photoId',\n        params: true,\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/photos/123')\n    // The photoId param should be preserved from the matched params\n    expect(location.maskedLocation!.href).toBe('/photos/123')\n  })\n\n  test('should use matched params when maskParams is undefined', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/photos/$photoId',\n        // params is undefined, which should default to true behavior\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/photos/123')\n    expect(location.maskedLocation!.href).toBe('/photos/123')\n  })\n\n  test('should call function when maskParams is a function', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/posts/$postId',\n        params: (prev: any) => ({\n          postId: prev.photoId,\n        }),\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/posts/123')\n    // The function should have transformed photoId to postId\n    expect(location.maskedLocation!.href).toBe('/posts/123')\n  })\n\n  test('should merge object params when maskParams is an object', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/photos/$photoId',\n        params: {\n          photoId: '456', // Override the matched param\n        },\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    // The object params should override the matched params\n    expect(location.maskedLocation!.pathname).toBe('/photos/456')\n    expect(location.maskedLocation!.href).toBe('/photos/456')\n  })\n\n  test('should merge object params with matched params', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/posts/$postId/info',\n        to: '/posts/$postId',\n        params: true, // Use matched params directly\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/posts/123/info',\n      params: { postId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/posts/123')\n    expect(location.maskedLocation!.href).toBe('/posts/123')\n  })\n\n  test('should use first matching mask when multiple masks exist', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/photos/$photoId',\n        params: true,\n      },\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/posts',\n        params: false,\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    // Should use the first matching mask\n    expect(location.maskedLocation!.pathname).toBe('/photos/123')\n  })\n\n  test('should pass through other mask properties (search, hash, state)', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/photos/$photoId',\n        params: true,\n        search: { filter: 'recent' },\n        hash: 'section1',\n        state: { modal: true },\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/photos/123')\n    expect(location.maskedLocation!.search).toEqual({ filter: 'recent' })\n    // Hash property stores the value without #, but href includes it\n    expect(location.maskedLocation!.hash).toBe('section1')\n    expect(location.maskedLocation!.href).toContain('#section1')\n    expect(location.maskedLocation!.state).toEqual({ modal: true })\n  })\n\n  test('should handle mask with function params that receives matched params', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/posts/$postId/info',\n        to: '/posts/$postId',\n        params: (prev: any) => {\n          // Function receives the matched params from the pathname\n          expect(prev.postId).toBe('123')\n          return {\n            postId: prev.postId,\n          }\n        },\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/posts/123/info',\n      params: { postId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/posts/123')\n  })\n\n  test('should not match mask when pathname does not match mask from pattern', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/photos/$photoId',\n        params: true,\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/posts/123/info',\n      params: { postId: '123' },\n    })\n\n    // Should not match the mask since pathname doesn't match\n    expect(location.maskedLocation).toBeUndefined()\n    expect(location.pathname).toBe('/posts/123/info')\n  })\n\n  test('should handle mask with complex param transformation', () => {\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$photoId/modal',\n        to: '/posts/$postId',\n        params: (prev: any) => ({\n          postId: `photo-${prev.photoId}`,\n        }),\n      },\n    ]\n\n    const router = setup(routeMasks)\n\n    const location = router.buildLocation({\n      to: '/photos/123/modal',\n      params: { photoId: '123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/posts/photo-123')\n  })\n\n  test('should transform params when original and masked routes have different param names', () => {\n    const rootRoute = new BaseRootRoute({})\n    const photoPrivateRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/photos/$privateId',\n    })\n    const detailsRoute = new BaseRoute({\n      getParentRoute: () => photoPrivateRoute,\n      path: '/details',\n    })\n    const photoPublicRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/photos/$publicId',\n    })\n    const routeTree = rootRoute.addChildren([\n      photoPrivateRoute.addChildren([detailsRoute]),\n      photoPublicRoute,\n    ])\n\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$privateId/details',\n        to: '/photos/$publicId',\n        params: (prev: any) => ({\n          publicId: prev.privateId, // Transform privateId to publicId\n        }),\n      },\n    ]\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n      routeMasks,\n    })\n\n    const location = router.buildLocation({\n      to: '/photos/abc123/details',\n      params: { privateId: 'abc123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/photos/abc123')\n    expect(location.pathname).toBe('/photos/abc123/details')\n  })\n\n  test('should handle param name transformation with object params', () => {\n    const rootRoute = new BaseRootRoute({})\n    const photoPrivateRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/photos/$privateId',\n    })\n    const detailsRoute = new BaseRoute({\n      getParentRoute: () => photoPrivateRoute,\n      path: '/details',\n    })\n    const photoPublicRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/photos/$publicId',\n    })\n    const routeTree = rootRoute.addChildren([\n      photoPrivateRoute.addChildren([detailsRoute]),\n      photoPublicRoute,\n    ])\n\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/photos/$privateId/details',\n        to: '/photos/$publicId',\n        // Use a function to transform params (objects with function values aren't supported)\n        params: (prev: any) => ({\n          publicId: prev.privateId, // Transform privateId to publicId\n        }),\n      },\n    ]\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n      routeMasks,\n    })\n\n    const location = router.buildLocation({\n      to: '/photos/secret123/details',\n      params: { privateId: 'secret123' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/photos/secret123')\n  })\n\n  test('should handle multiple params with different names in masked route', () => {\n    const rootRoute = new BaseRootRoute({})\n    const userRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n    })\n    const postRoute = new BaseRoute({\n      getParentRoute: () => userRoute,\n      path: '/posts/$postSlug',\n    })\n    const profileRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/profiles/$profileId',\n    })\n    const articleRoute = new BaseRoute({\n      getParentRoute: () => profileRoute,\n      path: '/articles/$articleId',\n    })\n    const routeTree = rootRoute.addChildren([\n      userRoute.addChildren([postRoute]),\n      profileRoute.addChildren([articleRoute]),\n    ])\n\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/users/$userId/posts/$postSlug',\n        to: '/profiles/$profileId/articles/$articleId',\n        params: (prev: any) => ({\n          profileId: prev.userId,\n          articleId: prev.postSlug,\n        }),\n      },\n    ]\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n      routeMasks,\n    })\n\n    const location = router.buildLocation({\n      to: '/users/john/posts/my-first-post',\n      params: { userId: 'john', postSlug: 'my-first-post' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe(\n      '/profiles/john/articles/my-first-post',\n    )\n    expect(location.pathname).toBe('/users/john/posts/my-first-post')\n  })\n\n  test('should handle param transformation when masked route requires different param', () => {\n    const rootRoute = new BaseRootRoute({})\n    const adminUsersRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/admin/users/$userId',\n    })\n    const publicUsersRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$username',\n    })\n    const routeTree = rootRoute.addChildren([adminUsersRoute, publicUsersRoute])\n\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/admin/users/$userId',\n        to: '/users/$username',\n        params: (prev: any) => {\n          // Simulate looking up username from userId\n          return {\n            username: `user-${prev.userId}`, // Transform userId to username format\n          }\n        },\n      },\n    ]\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n      routeMasks,\n    })\n\n    const location = router.buildLocation({\n      to: '/admin/users/42',\n      params: { userId: '42' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe('/users/user-42')\n    expect(location.pathname).toBe('/admin/users/42')\n  })\n\n  test('should handle partial param transformation when some params are kept', () => {\n    const rootRoute = new BaseRootRoute({})\n    const postRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/$postId',\n    })\n    const commentRoute = new BaseRoute({\n      getParentRoute: () => postRoute,\n      path: '/comments/$commentId',\n    })\n    const articleRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/articles/$articleId',\n    })\n    const replyRoute = new BaseRoute({\n      getParentRoute: () => articleRoute,\n      path: '/replies/$replyId',\n    })\n    const routeTree = rootRoute.addChildren([\n      postRoute.addChildren([commentRoute]),\n      articleRoute.addChildren([replyRoute]),\n    ])\n\n    const routeMasks: Array<RouteMask<any>> = [\n      {\n        routeTree: null as any,\n        from: '/posts/$postId/comments/$commentId',\n        to: '/articles/$articleId/replies/$replyId',\n        params: (prev: any) => ({\n          articleId: `article-${prev.postId}`,\n          replyId: prev.commentId, // Keep commentId as replyId\n        }),\n      },\n    ]\n\n    const router = createTestRouter({\n      routeTree,\n      history: createMemoryHistory(),\n      routeMasks,\n    })\n\n    const location = router.buildLocation({\n      to: '/posts/5/comments/10',\n      params: { postId: '5', commentId: '10' },\n    })\n\n    expect(location.maskedLocation).toBeDefined()\n    expect(location.maskedLocation!.pathname).toBe(\n      '/articles/article-5/replies/10',\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/match-by-path.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport {\n  findSingleMatch,\n  processRouteTree,\n} from '../src/new-process-route-tree'\n\nconst { processedTree } = processRouteTree({\n  id: '__root__',\n  isRoot: true,\n  fullPath: '/',\n  path: '/',\n})\n\ndescribe('default path matching', () => {\n  it.each([\n    ['', '', {}],\n    ['/', '', {}],\n    ['', '/', {}],\n    ['/', '/', {}],\n    ['/', '/', {}],\n    ['/a', '/a', {}],\n    ['/a/b', '/a/b', {}],\n    ['/a', '/a/', {}],\n    ['/a/', '/a/', {}],\n    ['/a/', '/a', undefined],\n    ['/b', '/a', undefined],\n  ])('static %s %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, true, false, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it.each([\n    ['/a/1', '/a/$id', { id: '1' }],\n    ['/a/1/b', '/a/$id/b', { id: '1' }],\n    ['/a/1/b/2', '/a/$id/b/$other', { id: '1', other: '2' }],\n    ['/a/1_/b/2', '/a/$id/b/$other', { id: '1_', other: '2' }],\n    ['/a/1/b/2', '/a/$id/b/$id', { id: '2' }],\n  ])('params %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, true, false, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it('params support more than alphanumeric characters', () => {\n    // in the value: basically everything except / and %\n    const anyValueResult = findSingleMatch(\n      '/a/$id',\n      false,\n      false,\n      '/a/@&é\"\\'(§è!çà)-_°^¨$*€£`ù=+:;.,?~<>|î©#0123456789\\\\😀}{',\n      processedTree,\n    )\n    expect(anyValueResult?.rawParams).toEqual({\n      id: '@&é\"\\'(§è!çà)-_°^¨$*€£`ù=+:;.,?~<>|î©#0123456789\\\\😀}{',\n    })\n    // in the key: basically everything except / and % and $\n    const anyKeyResult = findSingleMatch(\n      '/a/$@&é\"\\'(§è!çà)-_°^¨*€£`ù=+:;.,?~<>|î©#0123456789\\\\😀}{',\n      false,\n      false,\n      '/a/1',\n      processedTree,\n    )\n    expect(anyKeyResult?.rawParams).toEqual({\n      '@&é\"\\'(§è!çà)-_°^¨*€£`ù=+:;.,?~<>|î©#0123456789\\\\😀}{': '1',\n    })\n  })\n\n  it.each([\n    ['/a/1', '/a/{-$id}', { id: '1' }],\n    ['/a', '/a/{-$id}', {}],\n    ['/a/1/b', '/a/{-$id}/b', { id: '1' }],\n    ['/a/b', '/a/{-$id}/b', {}],\n    ['/a/1/b/2', '/a/{-$id}/b/{-$other}', { id: '1', other: '2' }],\n    ['/a/b/2', '/a/{-$id}/b/{-$other}', { other: '2' }],\n    ['/a/1/b', '/a/{-$id}/b/{-$other}', { id: '1' }],\n    ['/a/b', '/a/{-$id}/b/{-$other}', {}],\n    ['/a/1/b/2', '/a/{-$id}/b/{-$id}', { id: '2' }],\n  ])('optional %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, true, false, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it.each([\n    ['/a/b/c', '/a/$', { _splat: 'b/c', '*': 'b/c' }],\n    ['/a/', '/a/$', { _splat: '', '*': '' }],\n    ['/a', '/a/$', { _splat: '', '*': '' }],\n    ['/a/b/c', '/a/$/foo', { _splat: 'b/c', '*': 'b/c' }],\n  ])('wildcard %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, true, false, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n})\n\ndescribe('case insensitive path matching', () => {\n  it.each([\n    ['', '', '', {}],\n    ['', '/', '', {}],\n    ['', '', '/', {}],\n    ['', '/', '/', {}],\n    ['/', '/', '/', {}],\n    ['/', '/a', '/A', {}],\n    ['/', '/a/b', '/A/B', {}],\n    ['/', '/a', '/A/', {}],\n    ['/', '/a/', '/A/', {}],\n    ['/', '/a/', '/A', undefined],\n    ['/', '/b', '/A', undefined],\n  ])('static %s %s => %s', (base, path, pattern, result) => {\n    const res = findSingleMatch(pattern, false, false, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it.each([\n    ['/a/1', '/A/$id', { id: '1' }],\n    ['/a/1/b', '/A/$id/B', { id: '1' }],\n    ['/a/1/b/2', '/A/$id/B/$other', { id: '1', other: '2' }],\n    ['/a/1/b/2', '/A/$id/B/$id', { id: '2' }],\n  ])('params %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, false, false, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it.each([\n    ['/a/1', '/A/{-$id}', { id: '1' }],\n    ['/a', '/A/{-$id}', {}],\n    ['/a/1/b', '/A/{-$id}/B', { id: '1' }],\n    ['/a/1_/b', '/A/{-$id}/B', { id: '1_' }],\n    // ['/a/b', '/A/{-$id}/B', {}],\n    ['/a/1/b/2', '/A/{-$id}/B/{-$other}', { id: '1', other: '2' }],\n    // ['/a/b/2', '/A/{-$id}/B/{-$other}', { other: '2' }],\n    ['/a/1/b', '/A/{-$id}/B/{-$other}', { id: '1' }],\n    // ['/a/b', '/A/{-$id}/B/{-$other}', {}],\n    ['/a/1/b/2', '/A/{-$id}/B/{-$id}', { id: '2' }],\n    ['/a/1/b/2_', '/A/{-$id}/B/{-$id}', { id: '2_' }],\n  ])('optional %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, false, false, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it.each([\n    ['/a/b/c', '/A/$', { _splat: 'b/c', '*': 'b/c' }],\n    ['/a/', '/A/$', { _splat: '', '*': '' }],\n    ['/a', '/A/$', { _splat: '', '*': '' }],\n    ['/a/b/c', '/A/$/foo', { _splat: 'b/c', '*': 'b/c' }],\n  ])('wildcard %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, false, false, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n})\n\ndescribe('fuzzy path matching', () => {\n  it.each([\n    ['', '', '', {}],\n    ['', '/', '', {}],\n    ['', '', '/', {}],\n    ['', '/', '/', {}],\n    ['/', '/', '/', {}],\n    ['/', '/a', '/a', {}],\n    ['/', '/a', '/a/', {}],\n    ['/', '/a/', '/a/', {}],\n    ['/', '/a/', '/a', { '**': '/' }],\n    ['/', '/a/b', '/a/b', {}],\n    ['/', '/a/b', '/a', { '**': 'b' }],\n    ['/', '/a/b/', '/a', { '**': 'b/' }],\n    ['/', '/a/b/c', '/a', { '**': 'b/c' }],\n    ['/', '/a', '/a/b', undefined],\n    ['/', '/b', '/a', undefined],\n    ['/', '/a', '/b', undefined],\n  ])('static %s %s => %s', (base, path, pattern, result) => {\n    const res = findSingleMatch(pattern, true, true, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it.each([\n    ['/a/1', '/a/$id', { id: '1' }],\n    ['/a/1/b', '/a/$id', { id: '1', '**': 'b' }],\n    ['/a/1/', '/a/$id/', { id: '1' }],\n    ['/a/1/b/2', '/a/$id/b/$other', { id: '1', other: '2' }],\n    ['/a/1/b/2/c', '/a/$id/b/$other', { id: '1', other: '2', '**': 'c' }],\n  ])('params %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, true, true, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it.each([\n    ['/a/1', '/a/{-$id}', { id: '1' }],\n    ['/a', '/a/{-$id}', {}],\n    ['/a/1/b', '/a/{-$id}', { '**': 'b', id: '1' }],\n    ['/a/1/b', '/a/{-$id}/b', { id: '1' }],\n    ['/a/b', '/a/{-$id}/b', {}],\n    ['/a/b/c', '/a/{-$id}/b', { '**': 'c' }],\n    ['/a/b', '/a/{-$id}/b/{-$other}', {}],\n    ['/a/b/2/d', '/a/{-$id}/b/{-$other}', { other: '2', '**': 'd' }],\n    ['/a/1/b/2/c', '/a/{-$id}/b/{-$other}', { id: '1', other: '2', '**': 'c' }],\n  ])('optional %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, true, true, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n\n  it.each([\n    ['/a/b/c', '/a/$', { _splat: 'b/c', '*': 'b/c' }],\n    ['/a/', '/a/$', { _splat: '', '*': '' }],\n    ['/a', '/a/$', { _splat: '', '*': '' }],\n    ['/a/b/c/d', '/a/$/foo', { _splat: 'b/c/d', '*': 'b/c/d' }],\n  ])('wildcard %s => %s', (path, pattern, result) => {\n    const res = findSingleMatch(pattern, true, true, path, processedTree)\n    expect(res?.rawParams).toEqual(result)\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/new-process-route-tree.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport {\n  findFlatMatch,\n  findRouteMatch,\n  processRouteMasks,\n  processRouteTree,\n} from '../src/new-process-route-tree'\nimport type { AnyRoute, RouteMask } from '../src'\n\nfunction makeTree(routes: Array<string>) {\n  return processRouteTree({\n    id: '__root__',\n    isRoot: true,\n    fullPath: '/',\n    path: '/',\n    children: routes.map((route) => ({\n      id: route,\n      fullPath: route,\n      path: route,\n    })),\n  }).processedTree\n}\n\ndescribe('findRouteMatch', () => {\n  describe('priority', () => {\n    describe('basic permutations priorities', () => {\n      it('/static/static vs /static/dynamic', () => {\n        const tree = makeTree(['/a/b', '/a/$b'])\n        expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/b')\n      })\n      it('/static/static vs /static/optional', () => {\n        const tree = makeTree(['/a/b', '/a/{-$b}'])\n        expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/b')\n      })\n      it('/static/static vs /static/wildcard', () => {\n        const tree = makeTree(['/a/b', '/a/$'])\n        expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/b')\n      })\n      it('/static/dynamic vs /static/optional', () => {\n        const tree = makeTree(['/a/$b', '/a/{-$b}'])\n        expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/$b')\n      })\n      it('/static/dynamic vs /static/wildcard', () => {\n        const tree = makeTree(['/a/$b', '/a/$'])\n        expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/$b')\n      })\n      it('/static/optional vs /static/wildcard', () => {\n        const tree = makeTree(['/a/{-$b}', '/a/$'])\n        expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/{-$b}')\n      })\n    })\n\n    describe('prefix / suffix priorities', () => {\n      it('prefix+suffix dynamic wins over plain dynamic', () => {\n        const tree = makeTree(['/a/b{$b}b', '/a/$b'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/b{$b}b')\n      })\n      it('prefix dynamic wins over plain dynamic', () => {\n        const tree = makeTree(['/a/b{$b}', '/a/$b'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/b{$b}')\n      })\n      it('suffix dynamic wins over plain dynamic', () => {\n        const tree = makeTree(['/a/{$b}b', '/a/$b'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/{$b}b')\n      })\n\n      it('prefix+suffix optional wins over plain optional', () => {\n        const tree = makeTree(['/a/b{-$b}b', '/a/{-$b}'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/b{-$b}b')\n      })\n      it('prefix optional wins over plain optional', () => {\n        const tree = makeTree(['/a/b{-$b}', '/a/{-$b}'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/b{-$b}')\n      })\n      it('suffix optional wins over plain optional', () => {\n        const tree = makeTree(['/a/{-$b}b', '/a/{-$b}'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/{-$b}b')\n      })\n\n      it('prefix+suffix wildcard wins over plain wildcard', () => {\n        const tree = makeTree(['/a/b{$}b', '/a/$'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/b{$}b')\n      })\n      it('prefix wildcard wins over plain wildcard', () => {\n        const tree = makeTree(['/a/b{$}', '/a/$'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/b{$}')\n      })\n      it('suffix wildcard wins over plain wildcard', () => {\n        const tree = makeTree(['/a/{$}b', '/a/$'])\n        expect(findRouteMatch('/a/bbb', tree)?.route.id).toBe('/a/{$}b')\n      })\n    })\n\n    describe('prefix / suffix lengths', () => {\n      it('longer overlapping prefix wins over shorter prefix', () => {\n        const tree = makeTree(['/a/b{$b}', '/a/bbbb{$b}'])\n        expect(findRouteMatch('/a/bbbbb', tree)?.route.id).toBe('/a/bbbb{$b}')\n      })\n      it('longer overlapping suffix wins over shorter suffix', () => {\n        const tree = makeTree(['/a/{$b}b', '/a/{$b}bbbb'])\n        expect(findRouteMatch('/a/bbbbb', tree)?.route.id).toBe('/a/{$b}bbbb')\n      })\n      it('longer prefix and shorter suffix wins over shorter prefix and longer suffix', () => {\n        const tree = makeTree(['/a/b{$b}bbb', '/a/bbb{$b}b'])\n        expect(findRouteMatch('/a/bbbbb', tree)?.route.id).toBe('/a/bbb{$b}b')\n      })\n    })\n\n    describe('root matches', () => {\n      it('optional at the root matches /', () => {\n        const tree = makeTree(['/{-$id}'])\n        const res = findRouteMatch('/', tree)\n        expect(res?.route.id).toBe('/{-$id}')\n        expect(res?.rawParams).toEqual({})\n      })\n      it('wildcard at the root matches /', () => {\n        const tree = makeTree(['/$'])\n        const res = findRouteMatch('/', tree)\n        expect(res?.route.id).toBe('/$')\n        expect(res?.rawParams).toEqual({ '*': '', _splat: '' })\n      })\n      it('dynamic at the root DOES NOT match /', () => {\n        const tree = makeTree(['/$id'])\n        const res = findRouteMatch('/', tree)\n        expect(res).toBeNull()\n      })\n    })\n\n    describe('root matches with root index', () => {\n      it('root index wins over root optional', () => {\n        const tree = makeTree(['/', '/{-$id}'])\n        const res = findRouteMatch('/', tree)\n        expect(res?.route.id).toBe('/')\n      })\n      it('root index wins over root wildcard', () => {\n        const tree = makeTree(['/', '/$'])\n        const res = findRouteMatch('/', tree)\n        expect(res?.route.id).toBe('/')\n      })\n      it('root index wins over root dynamic', () => {\n        const tree = makeTree(['/', '/$id'])\n        const res = findRouteMatch('/', tree)\n        expect(res?.route.id).toBe('/')\n      })\n    })\n\n    describe('edge-case variations', () => {\n      it('/static/optional/static vs /static/dynamic/static', () => {\n        const tree = makeTree(['/a/{-$b}/c', '/a/$b/c'])\n        expect(findRouteMatch('/a/b/c', tree)?.route.id).toBe('/a/$b/c')\n      })\n      it('/static/optional/dynamic vs /static/dynamic/static', () => {\n        const tree = makeTree(['/a/{-$b}/$c', '/a/$b/c'])\n        expect(findRouteMatch('/a/b/c', tree)?.route.id).toBe('/a/$b/c')\n      })\n      it('/static/optional/static vs /static/dynamic', () => {\n        const tree = makeTree(['/users/{-$org}/settings', '/users/$id'])\n        expect(findRouteMatch('/users/settings', tree)?.route.id).toBe(\n          '/users/{-$org}/settings',\n        )\n      })\n      it('/optional/static/static vs /static/dynamic', () => {\n        const tree = makeTree(['/{-$other}/posts/new', '/posts/$id'])\n        expect(findRouteMatch('/posts/new', tree)?.route.id).toBe(\n          '/{-$other}/posts/new',\n        )\n      })\n      it('/optional/static/static vs /static/static', () => {\n        const tree = makeTree(['/{-$other}/posts/new', '/posts/new'])\n        expect(findRouteMatch('/posts/new', tree)?.route.id).toBe(\n          '/{-$other}/posts/new',\n        )\n      })\n      it('/optional/static/static/dynamic vs /static/dynamic/static/dynamic', () => {\n        const tree = makeTree(['/{-$other}/posts/a/b/$c', '/posts/$a/b/$c'])\n        expect(findRouteMatch('/posts/a/b/c', tree)?.route.id).toBe(\n          '/{-$other}/posts/a/b/$c',\n        )\n      })\n      it('chain of optional and static segments: favor earlier static segments', () => {\n        const tree = makeTree([\n          '/{-$a}/{-$b}/{-$c}/d/e',\n          '/{-$a}/{-$b}/c/d/{-$e}',\n        ])\n        expect(findRouteMatch('/a/b/c/d/e', tree)?.route.id).toBe(\n          '/{-$a}/{-$b}/c/d/{-$e}',\n        )\n      })\n      it('chain of dynamic and static segments: favor earlier static segments', () => {\n        const tree = makeTree(['/$a/$b/$c/d/e', '/$a/$b/c/d/$e'])\n        expect(findRouteMatch('/a/b/c/d/e', tree)?.route.id).toBe(\n          '/$a/$b/c/d/$e',\n        )\n      })\n\n      it('a short wildcard match does not prevent a longer match', () => {\n        const tree = makeTree(['/a/$', '/a/b/c/$'])\n        expect(findRouteMatch('/a/b/c/d/e', tree)?.route.id).toBe('/a/b/c/$')\n        expect(findRouteMatch('/a/d/e', tree)?.route.id).toBe('/a/$')\n      })\n\n      it('matching a single dynamic param is favored over matching any number of optional params', () => {\n        const tree = makeTree(['/$a/z', '/{-$a}/{-$b}/{-$c}/{-$d}/{-$e}/z'])\n        expect(findRouteMatch('/a/z', tree)?.route.id).toBe('/$a/z')\n        expect(findRouteMatch('/a/b/z', tree)?.route.id).toBe(\n          '/{-$a}/{-$b}/{-$c}/{-$d}/{-$e}/z',\n        )\n      })\n      it('matching a single dynamic param is favored over matching any number of optional params (2)', () => {\n        const tree = makeTree(['/{-$a}/$b', '/{-$a}'])\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/{-$a}/$b')\n        expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/{-$a}/$b')\n      })\n      describe('optional param can be a route on its own, but matching a static or dynamic is preferred', () => {\n        it('on its own', () => {\n          const tree = makeTree(['/a/{-$b}/'])\n          expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/{-$b}/')\n        })\n        it('vs dynamic sibling', () => {\n          const tree = makeTree(['/a/{-$b}/', '/a/$b'])\n          expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/$b')\n        })\n        it('vs dynamic child', () => {\n          const tree = makeTree(['/a/{-$b}/', '/a/{-$b}/$c'])\n          expect(findRouteMatch('/a/b', tree)?.route.id).toBe('/a/{-$b}/$c')\n        })\n      })\n      it('optional child vs. shorter route', () => {\n        const tree = makeTree(['/a', '/a/{-$b}'])\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/a/{-$b}')\n\n        // but index can still win over optional child\n        const treeWithIndex = makeTree(['/a/', '/a/{-$b}'])\n        expect(findRouteMatch('/a', treeWithIndex)?.route.id).toBe('/a/')\n      })\n    })\n  })\n\n  describe('trailing slashes (index routes)', () => {\n    describe('static routes', () => {\n      it('an index route can be matched by a path with a trailing slash', () => {\n        const tree = makeTree(['/a/'])\n        expect(findRouteMatch('/a/', tree)?.route.id).toBe('/a/')\n      })\n      it('an index route can be matched by a path without a trailing slash', () => {\n        const tree = makeTree(['/a/'])\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/a/')\n      })\n      it('a non-index route CANNOT be matched by a path with a trailing slash', () => {\n        const tree = makeTree(['/a'])\n        expect(findRouteMatch('/a/', tree)).toBeNull()\n      })\n      it('a non-index route can be matched by a path without a trailing slash', () => {\n        const tree = makeTree(['/a'])\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/a')\n      })\n    })\n    describe('dynamic routes', () => {\n      it('an index route can be matched by a path with a trailing slash', () => {\n        const tree = makeTree(['/$a/'])\n        expect(findRouteMatch('/a/', tree)?.route.id).toBe('/$a/')\n      })\n      it('an index route can be matched by a path without a trailing slash', () => {\n        const tree = makeTree(['/$a/'])\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/$a/')\n      })\n      it('a non-index route CANNOT be matched by a path with a trailing slash', () => {\n        const tree = makeTree(['/$a'])\n        expect(findRouteMatch('/a/', tree)).toBeNull()\n      })\n      it('a non-index route can be matched by a path without a trailing slash', () => {\n        const tree = makeTree(['/$a'])\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/$a')\n      })\n    })\n    describe('optional routes', () => {\n      it('an index route can be matched by a path with a trailing slash', () => {\n        const tree = makeTree(['/{-$a}/'])\n        expect(findRouteMatch('/a/', tree)?.route.id).toBe('/{-$a}/')\n      })\n      it('an index route can be matched by a path without a trailing slash', () => {\n        const tree = makeTree(['/{-$a}/'])\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/{-$a}/')\n      })\n      it('a non-index route CANNOT be matched by a path with a trailing slash', () => {\n        const tree = makeTree(['/{-$a}'])\n        expect(findRouteMatch('/a/', tree)).toBeNull()\n      })\n      it('a non-index route can be matched by a path without a trailing slash', () => {\n        const tree = makeTree(['/{-$a}'])\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/{-$a}')\n      })\n    })\n  })\n\n  describe('case sensitivity competition', () => {\n    it('a case sensitive segment early on should not prevent a case insensitive match', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/Foo',\n            fullPath: '/Foo',\n            path: 'Foo',\n            options: { caseSensitive: false },\n            children: [\n              {\n                id: '/Foo/a',\n                fullPath: '/Foo/a',\n                path: '/a',\n              },\n            ],\n          },\n          {\n            id: '/foo',\n            fullPath: '/foo',\n            path: 'foo',\n            options: { caseSensitive: true },\n            children: [\n              {\n                id: '/foo/b',\n                fullPath: '/foo/b',\n                path: 'b',\n              },\n            ],\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      expect(findRouteMatch('/foo/a', processedTree)?.route.id).toBe('/Foo/a')\n      expect(findRouteMatch('/foo/b', processedTree)?.route.id).toBe('/foo/b')\n    })\n    it('a case sensitive segment should have priority over a case insensitive one', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/FOO',\n            fullPath: '/FOO',\n            path: 'FOO',\n            options: { caseSensitive: true },\n          },\n          {\n            id: '/foo',\n            fullPath: '/foo',\n            path: 'foo',\n            options: { caseSensitive: false },\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      expect(findRouteMatch('/FOO', processedTree)?.route.id).toBe('/FOO')\n      expect(findRouteMatch('/Foo', processedTree)?.route.id).toBe('/foo')\n      expect(findRouteMatch('/foo', processedTree)?.route.id).toBe('/foo')\n    })\n    it('a case sensitive prefix/suffix should have priority over a case insensitive one', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/aa{$id}bb',\n            fullPath: '/aa{$id}bb',\n            path: 'aa{$id}bb',\n            options: { caseSensitive: false },\n          },\n          {\n            id: '/A{$id}B',\n            fullPath: '/A{$id}B',\n            path: 'A{$id}B',\n            options: { caseSensitive: true },\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      expect(findRouteMatch('/AfooB', processedTree)?.route.id).toBe('/A{$id}B')\n      expect(findRouteMatch('/AAABBB', processedTree)?.route.id).toBe(\n        '/A{$id}B',\n      )\n    })\n  })\n\n  describe('basic matching', () => {\n    it('root itself cannot match', () => {\n      const tree = makeTree([])\n      expect(findRouteMatch('/', tree)).toBeNull()\n    })\n    it('single static', () => {\n      const tree = makeTree(['/a'])\n      expect(findRouteMatch('/a', tree)?.route.id).toBe('/a')\n    })\n    it('single dynamic', () => {\n      const tree = makeTree(['/$id'])\n      expect(findRouteMatch('/123', tree)?.route.id).toBe('/$id')\n    })\n    it('single optional', () => {\n      const tree = makeTree(['/{-$id}'])\n      expect(findRouteMatch('/123', tree)?.route.id).toBe('/{-$id}')\n      expect(findRouteMatch('/', tree)?.route.id).toBe('/{-$id}')\n    })\n    it('single wildcard', () => {\n      const tree = makeTree(['/$'])\n      expect(findRouteMatch('/a/b/c', tree)?.route.id).toBe('/$')\n    })\n\n    describe('prefix / suffix variations', () => {\n      it('dynamic w/ prefix', () => {\n        const tree = makeTree(['/{$id}.txt'])\n        expect(findRouteMatch('/123.txt', tree)?.route.id).toBe('/{$id}.txt')\n      })\n      it('dynamic w/ suffix', () => {\n        const tree = makeTree(['/file{$id}'])\n        expect(findRouteMatch('/file123', tree)?.route.id).toBe('/file{$id}')\n      })\n      it('dynamic w/ prefix and suffix', () => {\n        const tree = makeTree(['/file{$id}.txt'])\n        expect(findRouteMatch('/file123.txt', tree)?.route.id).toBe(\n          '/file{$id}.txt',\n        )\n      })\n      it('optional w/ prefix', () => {\n        const tree = makeTree(['/{-$id}.txt'])\n        expect(findRouteMatch('/123.txt', tree)?.route.id).toBe('/{-$id}.txt')\n        expect(findRouteMatch('/.txt', tree)?.route.id).toBe('/{-$id}.txt')\n      })\n      it('optional w/ suffix', () => {\n        const tree = makeTree(['/file{-$id}'])\n        expect(findRouteMatch('/file123', tree)?.route.id).toBe('/file{-$id}')\n        expect(findRouteMatch('/file', tree)?.route.id).toBe('/file{-$id}')\n      })\n      it('optional w/ prefix and suffix', () => {\n        const tree = makeTree(['/file{-$id}.txt'])\n        expect(findRouteMatch('/file123.txt', tree)?.route.id).toBe(\n          '/file{-$id}.txt',\n        )\n        expect(findRouteMatch('/file.txt', tree)?.route.id).toBe(\n          '/file{-$id}.txt',\n        )\n      })\n    })\n\n    it('optional at the end can still be omitted', () => {\n      const tree = makeTree(['/a/{-$id}'])\n      expect(findRouteMatch('/a', tree)?.route.id).toBe('/a/{-$id}')\n    })\n    it('multiple optionals at the end can still be omitted', () => {\n      const tree = makeTree(['/a/{-$b}/{-$c}/{-$d}'])\n      expect(findRouteMatch('/a', tree)?.route.id).toBe('/a/{-$b}/{-$c}/{-$d}')\n    })\n    it('multiple optionals at the end -> favor earlier segments', () => {\n      const tree = makeTree(['/a/{-$b}/{-$c}/{-$d}/{-$e}'])\n      expect(findRouteMatch('/a/b/c', tree)?.rawParams).toEqual({\n        b: 'b',\n        c: 'c',\n      })\n    })\n    it('optional and wildcard at the end can still be omitted', () => {\n      const tree = makeTree(['/a/{-$id}/$'])\n      const result = findRouteMatch('/a', tree)\n      expect(result?.route.id).toBe('/a/{-$id}/$')\n      expect(result?.rawParams).toEqual({ '*': '', _splat: '' })\n    })\n    it('multi-segment wildcard w/ prefix', () => {\n      const tree = makeTree(['/file{$}'])\n      expect(findRouteMatch('/file/a/b/c', tree)?.route.id).toBe('/file{$}')\n    })\n    it('multi-segment wildcard w/ suffix', () => {\n      const tree = makeTree(['/{$}/c/file'])\n      expect(findRouteMatch('/a/b/c/file', tree)?.route.id).toBe('/{$}/c/file')\n    })\n    it('multi-segment wildcard w/ prefix and suffix', () => {\n      const tree = makeTree(['/file{$}end'])\n      expect(findRouteMatch('/file/a/b/c/end', tree)?.route.id).toBe(\n        '/file{$}end',\n      )\n    })\n\n    it('edge-case: a single required param early on doesnt prevent another match further down', () => {\n      const tree = makeTree(['/$one/a/b', '/$two/a/c'])\n      expect(findRouteMatch('/1/a/b', tree)?.route.id).toBe('/$one/a/b')\n      expect(findRouteMatch('/2/a/c', tree)?.route.id).toBe('/$two/a/c')\n    })\n    it('edge-case: a single static param early on doesnt prevent another match further down', () => {\n      const tree = makeTree(['/x/y/z', '/$id/y/w'])\n      expect(findRouteMatch('/x/y/z', tree)?.route.id).toBe('/x/y/z')\n      expect(findRouteMatch('/x/y/w', tree)?.route.id).toBe('/$id/y/w')\n    })\n    it('edge-case: presence of a valid wildcard doesnt prevent other matches', () => {\n      const tree = makeTree(['/yo/foo{-$id}bar/ma', '/yo/$'])\n      const absent = findRouteMatch('/yo/foobar/ma', tree)\n      expect(absent?.route.id).toBe('/yo/foo{-$id}bar/ma')\n      const present = findRouteMatch('/yo/foo123bar/ma', tree)\n      expect(present?.route.id).toBe('/yo/foo{-$id}bar/ma')\n    })\n    it('edge-case: deeper optional chain vs. shallower optional chain', () => {\n      // This test comes from the previous processRouteTree tests.\n      // > This demonstrates that `/foo/{-$p}/{-$x}.tsx` will be matched, not `/foo/{-$p}.tsx`\n      // > This route has 2 optional parameter, making it more specific than the route with 1\n      const tree = makeTree(['/foo/{-$p}.tsx', '/foo/{-$p}/{-$x}.tsx'])\n      expect(findRouteMatch('/foo', tree)?.route.id).toBe(\n        '/foo/{-$p}/{-$x}.tsx',\n      )\n      expect(findRouteMatch('/foo/bar.tsx', tree)?.route.id).toBe(\n        '/foo/{-$p}/{-$x}.tsx',\n      )\n\n      // but index can still win over deeper optional chain\n      const treeWithIndex = makeTree([\n        '/foo/{-$p}.tsx/',\n        '/foo/{-$p}/{-$x}.tsx',\n      ])\n      expect(findRouteMatch('/foo/', treeWithIndex)?.route.id).toBe(\n        '/foo/{-$p}.tsx/',\n      )\n    })\n\n    it('edge-case: two competing nodes at the same depth still produce a valid segment tree', () => {\n      // this case is not easy to explain, but at some point in the implementation\n      // the presence of `/a/c/{$foo}suffix` made `processRouteTree` assign an incorrect `depth`\n      // value to the `/a/b/$` node, causing the params extraction to return incorrect results.\n      const tree = {\n        id: '__root__',\n        fullPath: '/',\n        path: '/',\n        isRoot: true,\n        children: [\n          {\n            id: '/a/c/{$foo}suffix',\n            fullPath: '/a/c/{$foo}suffix',\n            path: 'a/c/{$foo}suffix',\n          },\n          {\n            id: '/a/b/$',\n            fullPath: '/a/b/$',\n            path: 'a/b/$',\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      const res = findRouteMatch('/a/b/foo', processedTree, true)\n      expect(res?.route.id).toBe('/a/b/$')\n      expect(res?.rawParams).toEqual({ _splat: 'foo', '*': 'foo' })\n    })\n    describe('edge-case #5969: trailing empty wildcard should match', () => {\n      it('basic', () => {\n        const tree = makeTree(['/a/$'])\n        expect(findRouteMatch('/a/', tree)?.route.id).toBe('/a/$')\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/a/$')\n      })\n      it('with layout route', () => {\n        const tree = makeTree(['/a', '/a/$'])\n        expect(findRouteMatch('/a/', tree)?.route.id).toBe('/a/$')\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/a/$')\n      })\n      it('with index route (should not match)', () => {\n        const tree = makeTree(['/a/', '/a/$'])\n        expect(findRouteMatch('/a/', tree)?.route.id).toBe('/a/')\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/a/')\n      })\n      it('edge-case: deeper index route through skipped optional segments (should not match)', () => {\n        const tree = makeTree(['/{-$foo}/{-$bar}/a/', '/a/$'])\n        expect(findRouteMatch('/a/', tree)?.route.id).toBe(\n          '/{-$foo}/{-$bar}/a/',\n        )\n        expect(findRouteMatch('/a', tree)?.route.id).toBe('/{-$foo}/{-$bar}/a/')\n      })\n    })\n  })\n\n  describe('nested routes', () => {\n    const routeTree = {\n      id: '__root__',\n      isRoot: true,\n      fullPath: '/',\n      path: '/',\n      children: [\n        {\n          id: '/a',\n          fullPath: '/a',\n          path: 'a',\n          children: [\n            {\n              id: '/a/b',\n              fullPath: '/a/b',\n              path: '/b',\n              children: [\n                {\n                  id: '/a/b/c/d',\n                  fullPath: '/a/b/c/d',\n                  path: '/c/d',\n                },\n              ],\n            },\n          ],\n        },\n      ],\n    }\n    const { processedTree } = processRouteTree(routeTree)\n    it('matches the deepest route', () => {\n      expect(findRouteMatch('/a/b/c/d', processedTree)?.route.id).toBe(\n        '/a/b/c/d',\n      )\n    })\n    it('matches an intermediate route', () => {\n      expect(findRouteMatch('/a/b', processedTree)?.route.id).toBe('/a/b')\n    })\n    it('matches the root child route', () => {\n      expect(findRouteMatch('/a', processedTree)?.route.id).toBe('/a')\n    })\n    it('nothing can match the root route', () => {\n      expect(findRouteMatch('/', processedTree)).toBeNull()\n    })\n    it('does not match a route that doesnt exist', () => {\n      expect(findRouteMatch('/a/b/c', processedTree)).toBeNull()\n    })\n  })\n\n  describe('not found / fuzzy matching', () => {\n    it('returns null when no match is found', () => {\n      const tree = makeTree(['/', '/a/b/c', '/d/e/f'])\n      expect(findRouteMatch('/x/y/z', tree)).toBeNull()\n    })\n\n    it('cannot consider the root route as a fuzzy match', () => {\n      const tree = makeTree(['/', '/a/b/c', '/d/e/f'])\n      const match = findRouteMatch('/x/y/z', tree, true)\n      expect(match).toBeNull()\n    })\n\n    it('finds the greatest partial match', () => {\n      const tree = makeTree(['/a/b/c', '/a/b', '/a'])\n      const match = findRouteMatch('/a/b/x/y', tree, true)\n      expect(match?.route?.id).toBe('/a/b')\n      expect(match?.rawParams).toMatchInlineSnapshot(`\n        {\n          \"**\": \"x/y\",\n        }\n      `)\n    })\n\n    it('when both a layout route and an index route exist on the node that is fuzzy-matched, it uses the layout route', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/',\n            fullPath: '/',\n            path: '/',\n          },\n          {\n            id: '/dashboard',\n            fullPath: '/dashboard',\n            path: 'dashboard',\n            children: [\n              {\n                id: '/dashboard/',\n                fullPath: '/dashboard/',\n                path: '/',\n              },\n              {\n                id: '/dashboard/invoices',\n                fullPath: '/dashboard/invoices',\n                path: 'invoices',\n              },\n              {\n                id: '/dashboard/users',\n                fullPath: '/dashboard/users',\n                path: 'users',\n              },\n            ],\n          },\n          {\n            id: '/_auth',\n            fullPath: '/',\n            children: [\n              {\n                id: '/_auth/profile',\n                fullPath: '/profile',\n                path: 'profile',\n              },\n            ],\n          },\n        ],\n      }\n      const processed = processRouteTree(tree)\n      const match = findRouteMatch(\n        '/dashboard/foo',\n        processed.processedTree,\n        true,\n      )\n      expect(match?.route.id).toBe('/dashboard')\n      expect(match?.rawParams).toEqual({ '**': 'foo' })\n    })\n\n    it('cannot use an index route as a fuzzy match', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/',\n            fullPath: '/',\n            path: '/',\n          },\n          {\n            id: '/dashboard/',\n            fullPath: '/dashboard/',\n            path: 'dashboard/',\n          },\n          {\n            id: '/dashboard/invoices',\n            fullPath: '/dashboard/invoices',\n            path: 'invoices',\n          },\n          {\n            id: '/dashboard/users',\n            fullPath: '/dashboard/users',\n            path: 'users',\n          },\n        ],\n      }\n      const processed = processRouteTree(tree)\n      const match = findRouteMatch(\n        '/dashboard/foo',\n        processed.processedTree,\n        true,\n      )\n      expect(match).toBeNull()\n    })\n\n    it('edge-case: index route is not a child of layout route', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/',\n            fullPath: '/',\n            path: '/',\n          },\n          {\n            id: '/dashboard/',\n            fullPath: '/dashboard/',\n            path: 'dashboard/',\n          },\n          {\n            id: '/dashboard',\n            fullPath: '/dashboard',\n            path: 'dashboard',\n          },\n        ],\n      }\n      const processed = processRouteTree(tree)\n      const match = findRouteMatch(\n        '/dashboard/foo',\n        processed.processedTree,\n        true,\n      )\n      expect(match?.route.id).toBe('/dashboard')\n      expect(match?.rawParams).toEqual({ '**': 'foo' })\n      const actualMatch = findRouteMatch('/dashboard', processed.processedTree)\n      expect(actualMatch?.route.id).toBe('/dashboard/')\n    })\n  })\n\n  describe('param extraction', () => {\n    describe('URI decoding', () => {\n      const URISyntaxCharacters = [\n        [';', '%3B'],\n        [',', '%2C'],\n        ['/', '%2F'],\n        ['?', '%3F'],\n        [':', '%3A'],\n        ['@', '%40'],\n        ['&', '%26'],\n        ['=', '%3D'],\n        ['+', '%2B'],\n        ['$', '%24'],\n        ['#', '%23'],\n        ['\\\\', '%5C'],\n        ['%', '%25'],\n      ] as const\n      it.each(URISyntaxCharacters)(\n        'decodes %s in dynamic params',\n        (char, encoded) => {\n          const tree = makeTree([`/a/$id`])\n          const result = findRouteMatch(`/a/${encoded}`, tree)\n          expect(result?.rawParams).toEqual({ id: char })\n        },\n      )\n      it.each(URISyntaxCharacters)(\n        'decodes %s in optional params',\n        (char, encoded) => {\n          const tree = makeTree([`/a/{-$id}`])\n          const result = findRouteMatch(`/a/${encoded}`, tree)\n          expect(result?.rawParams).toEqual({ id: char })\n        },\n      )\n      it.each(URISyntaxCharacters)(\n        'decodes %s in wildcard params',\n        (char, encoded) => {\n          const tree = makeTree([`/a/$`])\n          const result = findRouteMatch(`/a/${encoded}`, tree)\n          expect(result?.rawParams).toEqual({ '*': char, _splat: char })\n        },\n      )\n      it('wildcard splat supports multiple URI encoded characters in multiple URL segments', () => {\n        const tree = makeTree([`/a/$`])\n        const path = URISyntaxCharacters.map(([, encoded]) => encoded).join('/')\n        const decoded = URISyntaxCharacters.map(([char]) => char).join('/')\n        const result = findRouteMatch(`/a/${path}`, tree)\n        expect(result?.rawParams).toEqual({ '*': decoded, _splat: decoded })\n      })\n      it('fuzzy splat supports multiple URI encoded characters in multiple URL segments', () => {\n        const tree = makeTree(['/a'])\n        const path = URISyntaxCharacters.map(([, encoded]) => encoded).join('/')\n        const decoded = URISyntaxCharacters.map(([char]) => char).join('/')\n        const result = findRouteMatch(`/a/${path}`, tree, true)\n        expect(result?.rawParams).toEqual({ '**': decoded })\n      })\n    })\n    describe('edge-cases', () => {\n      it('#6012: optional index at root with param extraction', () => {\n        const tree = {\n          id: '__root__',\n          fullPath: '/',\n          path: '/',\n          isRoot: true,\n          options: {},\n          children: [\n            {\n              id: '/{-$year}/{-$month}/{-$day}',\n              fullPath: '/{-$year}/{-$month}/{-$day}',\n              path: '{-$year}/{-$month}/{-$day}',\n              isRoot: false,\n              options: {},\n            },\n            {\n              id: '/_pathless/{-$language}/',\n              fullPath: '/{-$language}/',\n              path: '{-$language}/',\n              isRoot: false,\n              options: {},\n            },\n          ],\n        }\n        const { processedTree } = processRouteTree(tree)\n        const result = findRouteMatch(`/sv`, processedTree)\n        expect(result?.route.id).toBe('/_pathless/{-$language}/')\n        expect(result?.rawParams).toEqual({ language: 'sv' })\n      })\n      it('skipped optional, ends with wildcard', () => {\n        const tree = {\n          id: '__root__',\n          fullPath: '/',\n          path: '/',\n          isRoot: true,\n          options: {},\n          children: [\n            {\n              id: '/{-$foo}/bar/$',\n              fullPath: '/{-$foo}/bar/$',\n              path: '{-$foo}/bar/$',\n              isRoot: false,\n              options: {},\n            },\n          ],\n        }\n        const { processedTree } = processRouteTree(tree)\n        const result = findRouteMatch(`/bar/rest`, processedTree)\n        expect(result?.route.id).toBe('/{-$foo}/bar/$')\n        expect(result?.rawParams).toEqual({ '*': 'rest', _splat: 'rest' })\n      })\n    })\n  })\n  describe('pathless routes', () => {\n    it('builds segment tree correctly', () => {\n      const tree = {\n        path: '/',\n        isRoot: true,\n        id: '__root__',\n        fullPath: '/',\n        children: [\n          {\n            path: '/',\n            id: '/',\n            fullPath: '/',\n            options: {},\n          },\n          {\n            id: '/$foo/_layout',\n            path: '$foo',\n            fullPath: '/$foo',\n            options: {\n              params: { parse: () => {} },\n              skipRouteOnParseError: {\n                params: true,\n              },\n            },\n            children: [\n              {\n                id: '/$foo/_layout/bar',\n                path: 'bar',\n                fullPath: '/$foo/bar',\n                options: {},\n              },\n              {\n                id: '/$foo/_layout/',\n                path: '/',\n                fullPath: '/$foo/',\n                options: {},\n              },\n            ],\n          },\n          {\n            id: '/$foo/hello',\n            path: '$foo/hello',\n            fullPath: '/$foo/hello',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      expect(processedTree.segmentTree).toMatchInlineSnapshot(`\n        {\n          \"depth\": 0,\n          \"dynamic\": [\n            {\n              \"caseSensitive\": false,\n              \"depth\": 1,\n              \"dynamic\": null,\n              \"fullPath\": \"/$foo\",\n              \"index\": null,\n              \"kind\": 1,\n              \"optional\": null,\n              \"parent\": [Circular],\n              \"parse\": null,\n              \"parsingPriority\": 0,\n              \"pathless\": [\n                {\n                  \"depth\": 2,\n                  \"dynamic\": null,\n                  \"fullPath\": \"/$foo\",\n                  \"index\": {\n                    \"depth\": 3,\n                    \"dynamic\": null,\n                    \"fullPath\": \"/$foo/\",\n                    \"index\": null,\n                    \"kind\": 4,\n                    \"optional\": null,\n                    \"parent\": [Circular],\n                    \"parse\": null,\n                    \"parsingPriority\": 0,\n                    \"pathless\": null,\n                    \"route\": {\n                      \"fullPath\": \"/$foo/\",\n                      \"id\": \"/$foo/_layout/\",\n                      \"options\": {},\n                      \"path\": \"/\",\n                    },\n                    \"skipOnParamError\": false,\n                    \"static\": null,\n                    \"staticInsensitive\": null,\n                    \"wildcard\": null,\n                  },\n                  \"kind\": 5,\n                  \"optional\": null,\n                  \"parent\": [Circular],\n                  \"parse\": [Function],\n                  \"parsingPriority\": 0,\n                  \"pathless\": null,\n                  \"route\": {\n                    \"children\": [\n                      {\n                        \"fullPath\": \"/$foo/bar\",\n                        \"id\": \"/$foo/_layout/bar\",\n                        \"options\": {},\n                        \"path\": \"bar\",\n                      },\n                      {\n                        \"fullPath\": \"/$foo/\",\n                        \"id\": \"/$foo/_layout/\",\n                        \"options\": {},\n                        \"path\": \"/\",\n                      },\n                    ],\n                    \"fullPath\": \"/$foo\",\n                    \"id\": \"/$foo/_layout\",\n                    \"options\": {\n                      \"params\": {\n                        \"parse\": [Function],\n                      },\n                      \"skipRouteOnParseError\": {\n                        \"params\": true,\n                      },\n                    },\n                    \"path\": \"$foo\",\n                  },\n                  \"skipOnParamError\": true,\n                  \"static\": null,\n                  \"staticInsensitive\": Map {\n                    \"bar\" => {\n                      \"depth\": 3,\n                      \"dynamic\": null,\n                      \"fullPath\": \"/$foo/bar\",\n                      \"index\": null,\n                      \"kind\": 0,\n                      \"optional\": null,\n                      \"parent\": [Circular],\n                      \"parse\": null,\n                      \"parsingPriority\": 0,\n                      \"pathless\": null,\n                      \"route\": {\n                        \"fullPath\": \"/$foo/bar\",\n                        \"id\": \"/$foo/_layout/bar\",\n                        \"options\": {},\n                        \"path\": \"bar\",\n                      },\n                      \"skipOnParamError\": false,\n                      \"static\": null,\n                      \"staticInsensitive\": null,\n                      \"wildcard\": null,\n                    },\n                  },\n                  \"wildcard\": null,\n                },\n              ],\n              \"prefix\": undefined,\n              \"route\": null,\n              \"skipOnParamError\": false,\n              \"static\": null,\n              \"staticInsensitive\": Map {\n                \"hello\" => {\n                  \"depth\": 2,\n                  \"dynamic\": null,\n                  \"fullPath\": \"/$foo/hello\",\n                  \"index\": null,\n                  \"kind\": 0,\n                  \"optional\": null,\n                  \"parent\": [Circular],\n                  \"parse\": null,\n                  \"parsingPriority\": 0,\n                  \"pathless\": null,\n                  \"route\": {\n                    \"fullPath\": \"/$foo/hello\",\n                    \"id\": \"/$foo/hello\",\n                    \"options\": {},\n                    \"path\": \"$foo/hello\",\n                  },\n                  \"skipOnParamError\": false,\n                  \"static\": null,\n                  \"staticInsensitive\": null,\n                  \"wildcard\": null,\n                },\n              },\n              \"suffix\": undefined,\n              \"wildcard\": null,\n            },\n          ],\n          \"fullPath\": \"/\",\n          \"index\": {\n            \"depth\": 1,\n            \"dynamic\": null,\n            \"fullPath\": \"/\",\n            \"index\": null,\n            \"kind\": 4,\n            \"optional\": null,\n            \"parent\": [Circular],\n            \"parse\": null,\n            \"parsingPriority\": 0,\n            \"pathless\": null,\n            \"route\": {\n              \"fullPath\": \"/\",\n              \"id\": \"/\",\n              \"options\": {},\n              \"path\": \"/\",\n            },\n            \"skipOnParamError\": false,\n            \"static\": null,\n            \"staticInsensitive\": null,\n            \"wildcard\": null,\n          },\n          \"kind\": 0,\n          \"optional\": null,\n          \"parent\": null,\n          \"parse\": null,\n          \"parsingPriority\": 0,\n          \"pathless\": null,\n          \"route\": null,\n          \"skipOnParamError\": false,\n          \"static\": null,\n          \"staticInsensitive\": null,\n          \"wildcard\": null,\n        }\n      `)\n    })\n    it('does not consume a path segment during param extraction', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$foo/_layout',\n            fullPath: '/$foo',\n            path: '$foo',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => params,\n              },\n              // force the creation of a pathless node\n              skipRouteOnParseError: { params: true },\n            },\n            children: [\n              {\n                id: '/$foo/_layout/$bar',\n                fullPath: '/$foo/$bar',\n                path: '$bar',\n                options: {},\n              },\n            ],\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      const result = findRouteMatch('/abc/def', processedTree)\n      expect(result?.route.id).toBe('/$foo/_layout/$bar')\n      expect(result?.rawParams).toEqual({ foo: 'abc', bar: 'def' })\n    })\n    it('skipped optional uses the correct node index with pathless nodes', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/one_{-$foo}/_layout',\n            fullPath: '/one_{-$foo}',\n            path: 'one_{-$foo}',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => params,\n              },\n              // force the creation of a pathless node\n              skipRouteOnParseError: { params: true },\n            },\n            children: [\n              {\n                id: '/one_{-$foo}/_layout/two_{-$bar}/baz',\n                fullPath: '/one_{-$foo}/two_{-$bar}/baz',\n                path: 'two_{-$bar}/baz',\n                options: {},\n              },\n            ],\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      // match first, skip second\n      {\n        const result = findRouteMatch('/one_value/baz', processedTree)\n        expect(result?.route.id).toBe('/one_{-$foo}/_layout/two_{-$bar}/baz')\n        expect(result?.rawParams).toEqual({ foo: 'value' })\n      }\n      // skip first, match second\n      {\n        const result = findRouteMatch('/two_value/baz', processedTree)\n        expect(result?.route.id).toBe('/one_{-$foo}/_layout/two_{-$bar}/baz')\n        expect(result?.rawParams).toEqual({ bar: 'value' })\n      }\n    })\n  })\n})\n\ndescribe('processRouteMasks', { sequential: true }, () => {\n  const routeTree = {\n    id: '__root__',\n    isRoot: true,\n    fullPath: '/',\n  } as AnyRoute\n  const { processedTree } = processRouteTree(routeTree)\n  it('processes a route masks list into a segment tree', () => {\n    const routeMasks: Array<RouteMask<AnyRoute>> = [\n      { from: '/a/b/c', routeTree },\n      { from: '/a/b/d', routeTree },\n      { from: '/a/$param/d', routeTree },\n      { from: '/a/{-$optional}/d', routeTree },\n      { from: '/a/b/{$}.txt', routeTree },\n    ]\n    processRouteMasks(routeMasks, processedTree)\n    const aBranch = processedTree.masksTree?.staticInsensitive?.get('a')\n    expect(aBranch).toBeDefined()\n    expect(aBranch?.staticInsensitive?.get('b')).toBeDefined()\n    expect(aBranch?.dynamic).toHaveLength(1)\n    expect(aBranch?.optional).toHaveLength(1)\n  })\n  it('can match static routes masks w/ `findFlatMatch`', () => {\n    const res = findFlatMatch('/a/b/c', processedTree)\n    expect(res?.route.from).toBe('/a/b/c')\n  })\n  it('can match dynamic route masks w/ `findFlatMatch`', () => {\n    const res = findFlatMatch('/a/123/d', processedTree)\n    expect(res?.route.from).toBe('/a/$param/d')\n    expect(res?.rawParams).toEqual({ param: '123' })\n  })\n  it('can match optional route masks w/ `findFlatMatch`', () => {\n    const res = findFlatMatch('/a/d', processedTree)\n    expect(res?.route.from).toBe('/a/{-$optional}/d')\n    expect(res?.rawParams).toEqual({})\n  })\n  it('can match prefix/suffix wildcard route masks w/ `findFlatMatch`', () => {\n    const res = findFlatMatch('/a/b/file/path.txt', processedTree)\n    expect(res?.route.from).toBe('/a/b/{$}.txt')\n    expect(res?.rawParams).toEqual({ '*': 'file/path', _splat: 'file/path' })\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/optional-path-params-clean.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport { interpolatePath } from '../src/path'\nimport {\n  SEGMENT_TYPE_OPTIONAL_PARAM,\n  SEGMENT_TYPE_PATHNAME,\n  findSingleMatch,\n  parseSegment,\n  processRouteTree,\n} from '../src/new-process-route-tree'\nimport type { SegmentKind } from '../src/new-process-route-tree'\n\ndescribe('Optional Path Parameters - Clean Comprehensive Tests', () => {\n  describe('Optional Dynamic Parameters {-$param}', () => {\n    describe('parsePathname', () => {\n      type PathSegment = {\n        type: SegmentKind\n        value: string\n        prefixSegment?: string\n        suffixSegment?: string\n        // Indicates if there is a static segment after this required/optional param\n        hasStaticAfter?: boolean\n      }\n\n      const parsePathname = (to: string | undefined) => {\n        let cursor = 0\n        let data\n        const path = to ?? ''\n        const segments: Array<PathSegment> = []\n        while (cursor < path.length) {\n          const start = cursor\n          data = parseSegment(path, start, data)\n          const end = data[5]\n          cursor = end + 1\n          const type = data[0]\n          const value = path.substring(data[2], data[3])\n          const prefix = path.substring(start, data[1])\n          const suffix = path.substring(data[4], end)\n          const segment: PathSegment = {\n            type,\n            value,\n          }\n          if (prefix) {\n            segment.prefixSegment = prefix\n          }\n          if (suffix) {\n            segment.suffixSegment = suffix\n          }\n          segments.push(segment)\n        }\n        return segments\n      }\n\n      it('should parse single optional dynamic param', () => {\n        const result = parsePathname('/posts/{-$category}')\n        expect(result).toEqual([\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'posts' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'category' },\n        ])\n      })\n\n      it('should parse multiple optional dynamic params', () => {\n        const result = parsePathname('/posts/{-$category}/{-$slug}')\n        expect(result).toEqual([\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'posts' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'category' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'slug' },\n        ])\n      })\n\n      it('should handle prefix/suffix with optional dynamic params', () => {\n        const result = parsePathname('/api/v{-$version}/data')\n        expect(result).toEqual([\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'api' },\n          {\n            type: SEGMENT_TYPE_OPTIONAL_PARAM,\n            value: 'version',\n            prefixSegment: 'v',\n            suffixSegment: undefined,\n          },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'data' },\n        ])\n      })\n    })\n\n    describe('interpolatePath', () => {\n      it('should interpolate optional dynamic params when present', () => {\n        const result = interpolatePath({\n          path: '/posts/{-$category}',\n          params: { category: 'tech' },\n        })\n        expect(result.interpolatedPath).toBe('/posts/tech')\n      })\n\n      it('should omit optional dynamic params when missing', () => {\n        const result = interpolatePath({\n          path: '/posts/{-$category}',\n          params: {},\n        })\n        expect(result.interpolatedPath).toBe('/posts')\n      })\n\n      it('should handle multiple optional dynamic params', () => {\n        const result1 = interpolatePath({\n          path: '/posts/{-$category}/{-$slug}',\n          params: { category: 'tech', slug: 'hello' },\n        })\n        expect(result1.interpolatedPath).toBe('/posts/tech/hello')\n\n        const result2 = interpolatePath({\n          path: '/posts/{-$category}/{-$slug}',\n          params: { category: 'tech' },\n        })\n        expect(result2.interpolatedPath).toBe('/posts/tech')\n\n        const result3 = interpolatePath({\n          path: '/posts/{-$category}/{-$slug}',\n          params: {},\n        })\n        expect(result3.interpolatedPath).toBe('/posts')\n      })\n\n      it('should handle mixed required and optional dynamic params', () => {\n        const result = interpolatePath({\n          path: '/posts/{-$category}/user/$id',\n          params: { category: 'tech', id: '123' },\n        })\n        expect(result.interpolatedPath).toBe('/posts/tech/user/123')\n\n        const result2 = interpolatePath({\n          path: '/posts/{-$category}/user/$id',\n          params: { id: '123' },\n        })\n        expect(result2.interpolatedPath).toBe('/posts/user/123')\n      })\n    })\n\n    describe('matchPathname', () => {\n      const { processedTree } = processRouteTree({\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n      })\n      const matchPathname = (\n        from: string,\n        options: { to: string; caseSensitive?: boolean; fuzzy?: boolean },\n      ) => {\n        const match = findSingleMatch(\n          options.to,\n          options.caseSensitive ?? false,\n          options.fuzzy ?? false,\n          from,\n          processedTree,\n        )\n        const result = match ? match.rawParams : undefined\n        if (options.to && !result) return\n        return result ?? {}\n      }\n      it('should match optional dynamic params when present', () => {\n        const result = matchPathname('/posts/tech', {\n          to: '/posts/{-$category}',\n        })\n        expect(result).toEqual({ category: 'tech' })\n      })\n\n      it('should match optional dynamic params when absent', () => {\n        const result = matchPathname('/posts', {\n          to: '/posts/{-$category}',\n        })\n        expect(result).toEqual({})\n      })\n\n      it('should handle multiple optional dynamic params', () => {\n        const result1 = matchPathname('/posts/tech/hello', {\n          to: '/posts/{-$category}/{-$slug}',\n        })\n        expect(result1).toEqual({ category: 'tech', slug: 'hello' })\n\n        const result2 = matchPathname('/posts/tech', {\n          to: '/posts/{-$category}/{-$slug}',\n        })\n        expect(result2).toEqual({ category: 'tech' })\n\n        const result3 = matchPathname('/posts', {\n          to: '/posts/{-$category}/{-$slug}',\n        })\n        expect(result3).toEqual({})\n      })\n\n      it('should handle mixed required and optional dynamic params', () => {\n        const result1 = matchPathname('/posts/tech/user/123', {\n          to: '/posts/{-$category}/user/$id',\n        })\n        expect(result1).toEqual({ category: 'tech', id: '123' })\n\n        const result2 = matchPathname('/posts/user/123', {\n          to: '/posts/{-$category}/user/$id',\n        })\n        expect(result2).toEqual({ id: '123' })\n      })\n    })\n  })\n\n  describe('Edge Cases', () => {\n    it('should handle optional params with wildcards', () => {\n      const result = interpolatePath({\n        path: '/docs/{-$version}/$',\n        params: { version: 'v1', _splat: 'guide/intro' },\n      })\n      expect(result.interpolatedPath).toBe('/docs/v1/guide/intro')\n\n      const result2 = interpolatePath({\n        path: '/docs/{-$version}/$',\n        params: { _splat: 'guide/intro' },\n      })\n      expect(result2.interpolatedPath).toBe('/docs/guide/intro')\n    })\n\n    it('should work with complex patterns', () => {\n      const pattern = '/app/{-$env}/api/{-$version}/users/$id/{-$tab}'\n\n      // All params provided\n      const result1 = interpolatePath({\n        path: pattern,\n        params: { env: 'prod', version: 'v2', id: '123', tab: 'settings' },\n      })\n      expect(result1.interpolatedPath).toBe(\n        '/app/prod/api/v2/users/123/settings',\n      )\n\n      // Only required param\n      const result2 = interpolatePath({\n        path: pattern,\n        params: { id: '123' },\n      })\n      expect(result2.interpolatedPath).toBe('/app/api/users/123')\n\n      // Mix of optional and required\n      const result3 = interpolatePath({\n        path: pattern,\n        params: { env: 'dev', id: '456', tab: 'profile' },\n      })\n      expect(result3.interpolatedPath).toBe('/app/dev/api/users/456/profile')\n    })\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/optional-path-params.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport { interpolatePath } from '../src/path'\nimport {\n  SEGMENT_TYPE_OPTIONAL_PARAM,\n  SEGMENT_TYPE_PARAM,\n  SEGMENT_TYPE_PATHNAME,\n  SEGMENT_TYPE_WILDCARD,\n  findSingleMatch,\n  parseSegment,\n  processRouteTree,\n} from '../src/new-process-route-tree'\nimport type { SegmentKind } from '../src/new-process-route-tree'\n\ndescribe('Optional Path Parameters', () => {\n  type PathSegment = {\n    type: SegmentKind\n    value: string\n    prefixSegment?: string\n    suffixSegment?: string\n  }\n  type ParsePathnameTestScheme = Array<{\n    name: string\n    to: string | undefined\n    expected: Array<PathSegment>\n  }>\n\n  describe('parsePathname with optional params', () => {\n    const parsePathname = (to: string | undefined) => {\n      let cursor = 0\n      let data\n      const path = to ?? ''\n      const segments: Array<PathSegment> = []\n      while (cursor < path.length) {\n        const start = cursor\n        data = parseSegment(path, start, data)\n        const end = data[5]\n        cursor = end + 1\n        const type = data[0]\n        const value = path.substring(data[2], data[3])\n        const prefix = path.substring(start, data[1])\n        const suffix = path.substring(data[4], end)\n        const segment: PathSegment = {\n          type,\n          value,\n        }\n        if (prefix) {\n          segment.prefixSegment = prefix\n        }\n        if (suffix) {\n          segment.suffixSegment = suffix\n        }\n        segments.push(segment)\n      }\n      return segments\n    }\n    it.each([\n      {\n        name: 'regular optional param',\n        to: '/{-$slug}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'slug' },\n        ],\n      },\n      {\n        name: 'optional param with prefix',\n        to: '/prefix{-$slug}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_OPTIONAL_PARAM,\n            value: 'slug',\n            prefixSegment: 'prefix',\n          },\n        ],\n      },\n      {\n        name: 'optional param with suffix',\n        to: '/{-$slug}suffix',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_OPTIONAL_PARAM,\n            value: 'slug',\n            suffixSegment: 'suffix',\n          },\n        ],\n      },\n      {\n        name: 'optional param with prefix and suffix',\n        to: '/prefix{-$slug}suffix',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_OPTIONAL_PARAM,\n            value: 'slug',\n            prefixSegment: 'prefix',\n            suffixSegment: 'suffix',\n          },\n        ],\n      },\n      {\n        name: 'multiple optional params',\n        to: '/posts/{-$category}/{-$slug}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'posts' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'category' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'slug' },\n        ],\n      },\n      {\n        name: 'mixed required and optional params',\n        to: '/users/$id/{-$tab}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'users' },\n          { type: SEGMENT_TYPE_PARAM, value: 'id' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'tab' },\n        ],\n      },\n      {\n        name: 'optional param followed by required param',\n        to: '/{-$category}/$slug',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'category' },\n          { type: SEGMENT_TYPE_PARAM, value: 'slug' },\n        ],\n      },\n      {\n        name: 'optional param with wildcard',\n        to: '/docs/{-$version}/$',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'docs' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'version' },\n          { type: SEGMENT_TYPE_WILDCARD, value: '$' },\n        ],\n      },\n      {\n        name: 'complex path with all param types',\n        to: '/api/{-$version}/users/$id/{-$tab}/$',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'api' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'version' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'users' },\n          { type: SEGMENT_TYPE_PARAM, value: 'id' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'tab' },\n          { type: SEGMENT_TYPE_WILDCARD, value: '$' },\n        ],\n      },\n      {\n        name: 'optional param at root',\n        to: '/{-$slug}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'slug' },\n        ],\n      },\n      {\n        name: 'multiple consecutive optional params',\n        to: '/{-$year}/{-$month}/{-$day}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'year' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'month' },\n          { type: SEGMENT_TYPE_OPTIONAL_PARAM, value: 'day' },\n        ],\n      },\n    ] satisfies ParsePathnameTestScheme)('$name', ({ to, expected }) => {\n      const result = parsePathname(to)\n      expect(result).toEqual(expected)\n    })\n  })\n\n  describe('interpolatePath with optional params', () => {\n    it.each([\n      {\n        name: 'optional param provided',\n        path: '/posts/{-$category}',\n        params: { category: 'tech' },\n        result: '/posts/tech',\n      },\n      {\n        name: 'optional param omitted',\n        path: '/posts/{-$category}',\n        params: {},\n        result: '/posts',\n      },\n      {\n        name: 'optional param with undefined value',\n        path: '/posts/{-$category}',\n        params: { category: undefined },\n        result: '/posts',\n      },\n      {\n        name: 'optional param with prefix - provided',\n        path: '/posts/prefix{-$category}',\n        params: { category: 'tech' },\n        result: '/posts/prefixtech',\n      },\n      {\n        name: 'optional param with prefix - omitted',\n        path: '/posts/prefix{-$category}',\n        params: {},\n        result: '/posts',\n      },\n      {\n        name: 'optional param with prefix - empty string',\n        path: '/posts/prefix{-$category}',\n        params: { category: '' },\n        result: '/posts/prefix',\n      },\n      {\n        name: 'optional param with suffix - provided',\n        path: '/posts/{-$category}.html',\n        params: { category: 'tech' },\n        result: '/posts/tech.html',\n      },\n      {\n        name: 'optional param with suffix - omitted',\n        path: '/posts/{-$category}.html',\n        params: {},\n        result: '/posts',\n      },\n      {\n        name: 'optional param with suffix - empty string',\n        path: '/posts/{-$category}.html',\n        params: { category: '' },\n        result: '/posts/.html',\n      },\n      {\n        name: 'optional param with prefix and suffix - provided',\n        path: '/posts/prefix{-$category}suffix',\n        params: { category: 'tech' },\n        result: '/posts/prefixtechsuffix',\n      },\n      {\n        name: 'optional param with prefix and suffix - omitted',\n        path: '/posts/prefix{-$category}suffix',\n        params: {},\n        result: '/posts',\n      },\n      {\n        name: 'optional param with prefix and suffix - empty string',\n        path: '/posts/prefix{-$category}suffix',\n        params: { category: '' },\n        result: '/posts/prefixsuffix',\n      },\n      {\n        name: 'multiple optional params - all provided',\n        path: '/posts/{-$category}/{-$slug}',\n        params: { category: 'tech', slug: 'hello-world' },\n        result: '/posts/tech/hello-world',\n      },\n      {\n        name: 'multiple optional params - partially provided',\n        path: '/posts/{-$category}/{-$slug}',\n        params: { category: 'tech' },\n        result: '/posts/tech',\n      },\n      {\n        name: 'multiple optional params - none provided',\n        path: '/posts/{-$category}/{-$slug}',\n        params: {},\n        result: '/posts',\n      },\n      {\n        name: 'mixed required and optional params - all provided',\n        path: '/users/$id/{-$tab}',\n        params: { id: '123', tab: 'settings' },\n        result: '/users/123/settings',\n      },\n      {\n        name: 'mixed required and optional params - optional omitted',\n        path: '/users/$id/{-$tab}',\n        params: { id: '123' },\n        result: '/users/123',\n      },\n      {\n        name: 'optional param between required params',\n        path: '/users/$id/{-$section}/edit',\n        params: { id: '123', section: 'profile' },\n        result: '/users/123/profile/edit',\n      },\n      {\n        name: 'optional param between required params - omitted',\n        path: '/users/$id/{-$section}/edit',\n        params: { id: '123' },\n        result: '/users/123/edit',\n      },\n      {\n        name: 'complex path with all param types - all provided',\n        path: '/api/{-$version}/users/$id/{-$tab}/$',\n        params: {\n          version: 'v2',\n          id: '123',\n          tab: 'settings',\n          _splat: 'extra/path',\n        },\n        result: '/api/v2/users/123/settings/extra/path',\n      },\n      {\n        name: 'complex path with all param types - optionals omitted',\n        path: '/api/{-$version}/users/$id/{-$tab}/$',\n        params: { id: '123', _splat: 'extra/path' },\n        result: '/api/users/123/extra/path',\n      },\n      {\n        name: 'multiple consecutive optional params - all provided',\n        path: '/{-$year}/{-$month}/{-$day}',\n        params: { year: '2023', month: '12', day: '25' },\n        result: '/2023/12/25',\n      },\n      {\n        name: 'multiple consecutive optional params - partially provided',\n        path: '/{-$year}/{-$month}/{-$day}',\n        params: { year: '2023', month: '12' },\n        result: '/2023/12',\n      },\n      {\n        name: 'multiple consecutive optional params - first only',\n        path: '/{-$year}/{-$month}/{-$day}',\n        params: { year: '2023' },\n        result: '/2023',\n      },\n      {\n        name: 'multiple consecutive optional params - none provided',\n        path: '/{-$year}/{-$month}/{-$day}',\n        params: {},\n        result: '/',\n      },\n      {\n        name: 'optional param with special characters',\n        path: '/posts/{-$category}',\n        params: { category: 'tech & science' },\n        result: '/posts/tech%20%26%20science',\n      },\n      {\n        name: 'optional param with number',\n        path: '/posts/{-$page}',\n        params: { page: 42 },\n        result: '/posts/42',\n      },\n    ])('$name', ({ path, params, result }) => {\n      expect(interpolatePath({ path, params }).interpolatedPath).toBe(result)\n    })\n  })\n\n  const { processedTree } = processRouteTree({\n    id: '__root__',\n    isRoot: true,\n    fullPath: '/',\n    path: '/',\n  })\n  const matchPathname = (\n    from: string,\n    options: { to: string; caseSensitive?: boolean; fuzzy?: boolean },\n  ) => {\n    const match = findSingleMatch(\n      options.to,\n      options.caseSensitive ?? false,\n      options.fuzzy ?? false,\n      from,\n      processedTree,\n    )\n    const result = match ? match.rawParams : undefined\n    if (options.to && !result) return\n    return result ?? {}\n  }\n\n  describe('matchPathname with optional params', () => {\n    it.each([\n      {\n        name: 'optional param present in URL',\n        input: '/posts/tech',\n        matchingOptions: { to: '/posts/{-$category}' },\n        expectedMatchedParams: { category: 'tech' },\n      },\n      {\n        name: 'optional param absent in URL',\n        input: '/posts',\n        matchingOptions: { to: '/posts/{-$category}' },\n        expectedMatchedParams: {},\n      },\n      {\n        name: 'multiple optional params - all present',\n        input: '/posts/tech/hello-world',\n        matchingOptions: { to: '/posts/{-$category}/{-$slug}' },\n        expectedMatchedParams: { category: 'tech', slug: 'hello-world' },\n      },\n      {\n        name: 'multiple optional params - partially present',\n        input: '/posts/tech',\n        matchingOptions: { to: '/posts/{-$category}/{-$slug}' },\n        expectedMatchedParams: { category: 'tech' },\n      },\n      {\n        name: 'multiple optional params - none present',\n        input: '/posts',\n        matchingOptions: { to: '/posts/{-$category}/{-$slug}' },\n        expectedMatchedParams: {},\n      },\n      {\n        name: 'mixed required and optional params - all present',\n        input: '/users/123/settings',\n        matchingOptions: { to: '/users/$id/{-$tab}' },\n        expectedMatchedParams: { id: '123', tab: 'settings' },\n      },\n      {\n        name: 'mixed required and optional params - optional absent',\n        input: '/users/123',\n        matchingOptions: { to: '/users/$id/{-$tab}' },\n        expectedMatchedParams: { id: '123' },\n      },\n      {\n        name: 'optional param with prefix and suffix - present',\n        input: '/posts/prefixtech.html',\n        matchingOptions: { to: '/posts/prefix{-$category}.html' },\n        expectedMatchedParams: { category: 'tech' },\n      },\n      {\n        name: 'optional param with prefix and suffix - absent',\n        input: '/posts',\n        matchingOptions: { to: '/posts/prefix{-$category}.html' },\n        expectedMatchedParams: {},\n      },\n      {\n        name: 'optional param between required segments',\n        input: '/users/123/settings/edit',\n        matchingOptions: { to: '/users/$id/{-$section}/edit' },\n        expectedMatchedParams: { id: '123', section: 'settings' },\n      },\n      {\n        name: 'optional param between required segments - omitted',\n        input: '/users/123/edit',\n        matchingOptions: { to: '/users/$id/{-$section}/edit' },\n        expectedMatchedParams: { id: '123' },\n      },\n      {\n        name: 'consecutive optional params - all present',\n        input: '/2023/12/25',\n        matchingOptions: { to: '/{-$year}/{-$month}/{-$day}' },\n        expectedMatchedParams: { year: '2023', month: '12', day: '25' },\n      },\n      {\n        name: 'consecutive optional params - partially present',\n        input: '/2023/12',\n        matchingOptions: { to: '/{-$year}/{-$month}/{-$day}' },\n        expectedMatchedParams: { year: '2023', month: '12' },\n      },\n      {\n        name: 'consecutive optional params - first only',\n        input: '/2023',\n        matchingOptions: { to: '/{-$year}/{-$month}/{-$day}' },\n        expectedMatchedParams: { year: '2023' },\n      },\n      {\n        name: 'consecutive optional params - none present',\n        input: '/',\n        matchingOptions: { to: '/{-$year}/{-$month}/{-$day}' },\n        expectedMatchedParams: {},\n      },\n    ])('$name', ({ input, matchingOptions, expectedMatchedParams }) => {\n      expect(matchPathname(input, matchingOptions)).toStrictEqual(\n        toNullObj(expectedMatchedParams),\n      )\n    })\n  })\n\n  describe('edge cases', () => {\n    it('should handle optional parameters with validation', () => {\n      // This test will be expanded when we implement params.parse for optional params\n      const path = '/posts/{-$category}'\n      const params = { category: 'tech' }\n      expect(interpolatePath({ path, params }).interpolatedPath).toBe(\n        '/posts/tech',\n      )\n    })\n\n    it('should handle multiple consecutive optional parameters correctly', () => {\n      const tests = [\n        { input: '/', pattern: '/{-$a}/{-$b}/{-$c}', expected: {} },\n        { input: '/1', pattern: '/{-$a}/{-$b}/{-$c}', expected: { a: '1' } },\n        {\n          input: '/1/2',\n          pattern: '/{-$a}/{-$b}/{-$c}',\n          expected: { a: '1', b: '2' },\n        },\n        {\n          input: '/1/2/3',\n          pattern: '/{-$a}/{-$b}/{-$c}',\n          expected: { a: '1', b: '2', c: '3' },\n        },\n      ]\n\n      tests.forEach(({ input, pattern, expected }) => {\n        expect(matchPathname(input, { to: pattern })).toEqual(expected)\n      })\n    })\n\n    it('should prioritize more specific routes over optional param routes', () => {\n      // Test that /posts/featured matches a static route, not optional param route\n      const staticMatch = matchPathname('/posts/featured', {\n        to: '/posts/featured',\n      })\n      const optionalMatch = matchPathname('/posts/featured', {\n        to: '/posts/{-$category}',\n      })\n\n      expect(staticMatch).toEqual({})\n      expect(optionalMatch).toEqual({ category: 'featured' })\n    })\n\n    it('should handle optional parameters with wildcards', () => {\n      const input = '/docs/v2/extra/path'\n      const pattern = '/docs/{-$version}/$'\n      const expected = {\n        version: 'v2',\n        '*': 'extra/path',\n        _splat: 'extra/path',\n      }\n\n      expect(matchPathname(input, { to: pattern })).toEqual(expected)\n    })\n  })\n})\n\nfunction toNullObj<T>(obj: T): T {\n  if (typeof obj === 'object') return Object.assign(Object.create(null), obj)\n  return obj\n}\n"
  },
  {
    "path": "packages/router-core/tests/path.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport {\n  compileDecodeCharMap,\n  exactPathTest,\n  interpolatePath,\n  removeTrailingSlash,\n  resolvePath,\n  trimPathLeft,\n} from '../src/path'\nimport {\n  SEGMENT_TYPE_PARAM,\n  SEGMENT_TYPE_PATHNAME,\n  SEGMENT_TYPE_WILDCARD,\n  findSingleMatch,\n  parseSegment,\n  processRouteTree,\n} from '../src/new-process-route-tree'\nimport type { SegmentKind } from '../src/new-process-route-tree'\n\ndescribe.each([{ basepath: '/' }, { basepath: '/app' }, { basepath: '/app/' }])(\n  'removeTrailingSlash with basepath $basepath',\n  ({ basepath }) => {\n    it('should remove trailing slash if present', () => {\n      const input = 'https://example.com/'\n      const expectedOutput = 'https://example.com'\n      const result = removeTrailingSlash(input, basepath)\n      expect(result).toBe(expectedOutput)\n    })\n    it('should not modify the string if no trailing slash present', () => {\n      const input = 'https://example.com'\n      const result = removeTrailingSlash(input, basepath)\n      expect(result).toBe(input)\n    })\n    it('should handle empty string', () => {\n      const input = ''\n      const result = removeTrailingSlash(input, basepath)\n      expect(result).toBe(input)\n    })\n    it('should handle strings with only a slash', () => {\n      const input = '/'\n      const result = removeTrailingSlash(input, basepath)\n      expect(result).toBe(input)\n    })\n    it('should handle strings with multiple slashes', () => {\n      const input = 'https://example.com/path/to/resource/'\n      const expectedOutput = 'https://example.com/path/to/resource'\n      const result = removeTrailingSlash(input, basepath)\n      expect(result).toBe(expectedOutput)\n    })\n  },\n)\n\ndescribe.each([{ basepath: '/' }, { basepath: '/app' }, { basepath: '/app/' }])(\n  'exactPathTest with basepath $basepath',\n  ({ basepath }) => {\n    it('should return true when two paths are exactly the same', () => {\n      const path1 = 'some-path/additional-path'\n      const path2 = 'some-path/additional-path'\n      const result = exactPathTest(path1, path2, basepath)\n      expect(result).toBe(true)\n    })\n    it('should return true when two paths are the same with or without trailing slash', () => {\n      const path1 = 'some-path/additional-path'\n      const path2 = 'some-path/additional-path/'\n      const result = exactPathTest(path1, path2, basepath)\n      expect(result).toBe(true)\n    })\n    it('should return true when two paths are the same with or without trailing slash 2', () => {\n      const path1 = 'some-path/additional-path'\n      const path2 = 'some-path/additional-path/'\n      const result = exactPathTest(path1, path2, basepath)\n      expect(result).toBe(true)\n    })\n    it('should return false when two paths are different', () => {\n      const path1 = 'some-path/additional-path/'\n      const path2 = 'some-path2/additional-path/'\n      const result = exactPathTest(path1, path2, basepath)\n      expect(result).toBe(false)\n    })\n    it('should return true when both paths are just a slash', () => {\n      const path1 = '/'\n      const path2 = '/'\n      const result = exactPathTest(path1, path2, basepath)\n      expect(result).toBe(true)\n    })\n  },\n)\n\ndescribe('resolvePath', () => {\n  describe.each([\n    ['/', '/', '/'],\n    ['/', '/a', '/a'],\n    ['/', 'a/', '/a'],\n    ['/', '/a/b', '/a/b'],\n    ['/a', 'b', '/a/b'],\n    ['/', 'a/b', '/a/b'],\n    ['/', './a/b', '/a/b'],\n    ['/a/b/c', 'd', '/a/b/c/d'],\n    ['/a/b/c', './d', '/a/b/c/d'],\n    ['/a/b/c', './../d', '/a/b/d'],\n    ['/a/b/c/d', './../d', '/a/b/c/d'],\n    ['/a/b/c', '../../d', '/a/d'],\n    ['/a/b/c', '../d', '/a/b/d'],\n    ['/a/b/c', '..', '/a/b'],\n    ['/a/b/c', '../..', '/a'],\n    ['/a/b/c', '../../..', '/'],\n    ['/a/b/c/', '../../..', '/'],\n  ])('resolves correctly', (a, b, eq) => {\n    it(`${a} to ${b} === ${eq}`, () => {\n      expect(resolvePath({ base: a, to: b })).toEqual(eq)\n    })\n    it(`${a}/ to ${b} === ${eq} (trailing slash)`, () => {\n      expect(resolvePath({ base: a + '/', to: b })).toEqual(eq)\n    })\n    it(`${a}/ to ${b}/ === ${eq} (trailing slash + trailing slash)`, () => {\n      expect(resolvePath({ base: a + '/', to: b + '/' })).toEqual(eq)\n    })\n  })\n\n  describe('trailingSlash', () => {\n    describe(`'always'`, () => {\n      it('keeps trailing slash', () => {\n        expect(\n          resolvePath({\n            base: '/a/b/c',\n            to: 'd/',\n            trailingSlash: 'always',\n          }),\n        ).toBe('/a/b/c/d/')\n      })\n      it('adds trailing slash', () => {\n        expect(\n          resolvePath({\n            base: '/a/b/c',\n            to: 'd',\n            trailingSlash: 'always',\n          }),\n        ).toBe('/a/b/c/d/')\n      })\n    })\n    describe(`'never'`, () => {\n      it('removes trailing slash', () => {\n        expect(\n          resolvePath({\n            base: '/a/b/c',\n            to: 'd/',\n            trailingSlash: 'never',\n          }),\n        ).toBe('/a/b/c/d')\n      })\n      it('does not add trailing slash', () => {\n        expect(\n          resolvePath({\n            base: '/a/b/c',\n            to: 'd',\n            trailingSlash: 'never',\n          }),\n        ).toBe('/a/b/c/d')\n      })\n    })\n    describe(`'preserve'`, () => {\n      it('keeps trailing slash', () => {\n        expect(\n          resolvePath({\n            base: '/a/b/c',\n            to: 'd/',\n            trailingSlash: 'preserve',\n          }),\n        ).toBe('/a/b/c/d/')\n      })\n      it('does not add trailing slash', () => {\n        expect(\n          resolvePath({\n            base: '/a/b/c',\n            to: 'd',\n            trailingSlash: 'preserve',\n          }),\n        ).toBe('/a/b/c/d')\n      })\n    })\n  })\n\n  describe.each([{ base: '/' }, { base: '/nested' }])(\n    'param routes w/ base=$base',\n    ({ base }) => {\n      describe('wildcard (prefix + suffix)', () => {\n        it.each([\n          { name: 'regular top-level', to: '/$' },\n          { name: 'regular nested', to: '/params/wildcard/$' },\n          { name: 'with top-level prefix', to: '/prefix{$}' },\n          { name: 'with nested prefix', to: '/params/wildcard/prefix{$}' },\n          { name: 'with top-level suffix', to: '/{$}suffix' },\n          { name: 'with nested suffix', to: '/params/wildcard/{$}suffix' },\n          {\n            name: 'with top-level prefix + suffix',\n            to: '/prefix{$}suffix',\n          },\n          {\n            name: 'with nested prefix + suffix',\n            to: '/params/wildcard/prefix{$}suffix',\n          },\n        ])('$name', ({ to }) => {\n          const candidate = base + trimPathLeft(to)\n          expect(\n            resolvePath({\n              base,\n              to: candidate,\n              trailingSlash: 'never',\n            }),\n          ).toEqual(candidate)\n        })\n      })\n\n      describe('named (prefix + suffix)', () => {\n        it.each([\n          { name: 'regular top-level', to: '/$foo' },\n          { name: 'regular nested', to: '/params/named/$foo' },\n          { name: 'with top-level prefix', to: '/prefix{$foo}' },\n          { name: 'with nested prefix', to: '/params/named/prefix{$foo}' },\n          { name: 'with top-level suffix', to: '/{$foo}suffix' },\n          { name: 'with nested suffix', to: '/params/named/{$foo}suffix' },\n          {\n            name: 'with top-level prefix + suffix',\n            to: '/prefix{$foo}suffix',\n          },\n          {\n            name: 'with nested prefix + suffix',\n            to: '/params/named/prefix{$foo}suffix',\n          },\n        ])('$name', ({ to }) => {\n          const candidate = base + trimPathLeft(to)\n          expect(\n            resolvePath({\n              base,\n              to: candidate,\n              trailingSlash: 'never',\n            }),\n          ).toEqual(candidate)\n        })\n      })\n    },\n  )\n})\n\ndescribe.each([{ server: true }, { server: false }])(\n  'interpolatePath (server: $server)',\n  ({ server }) => {\n    describe('regular usage', () => {\n      it.each([\n        {\n          name: 'should interpolate the path',\n          path: '/users/$id',\n          params: { id: '123' },\n          result: '/users/123',\n        },\n        {\n          name: 'should interpolate the path',\n          path: '/users/$id',\n          params: { id: '123_' },\n          result: '/users/123_',\n        },\n        {\n          name: 'should interpolate the path with multiple params',\n          path: '/users/$id/$name',\n          params: { id: '123', name: 'tanner' },\n          result: '/users/123/tanner',\n        },\n        {\n          name: 'should interpolate the path with multiple params',\n          path: '/users/$id/$name',\n          params: { id: '123_', name: 'tanner' },\n          result: '/users/123_/tanner',\n        },\n        {\n          name: 'should interpolate the path with extra params',\n          path: '/users/$id',\n          params: { id: '123', name: 'tanner' },\n          result: '/users/123',\n        },\n        {\n          name: 'should interpolate the path with missing params',\n          path: '/users/$id/$name',\n          params: { id: '123' },\n          result: '/users/123/undefined',\n        },\n        {\n          name: 'should interpolate the path with missing params and extra params',\n          path: '/users/$id',\n          params: { name: 'john' },\n          result: '/users/undefined',\n        },\n        {\n          name: 'should interpolate the path with the param being a number',\n          path: '/users/$id',\n          params: { id: 123 },\n          result: '/users/123',\n        },\n        {\n          name: 'should interpolate the path with the param being a falsey number',\n          path: '/users/$id',\n          params: { id: 0 },\n          result: '/users/0',\n        },\n        {\n          name: 'should interpolate the path with URI component encoding',\n          path: '/users/$id',\n          params: { id: '?#@john+smith' },\n          result: '/users/%3F%23%40john%2Bsmith',\n        },\n        {\n          name: 'should interpolate the path without URI encoding characters in decodeCharMap',\n          path: '/users/$id',\n          params: { id: '?#@john+smith' },\n          result: '/users/%3F%23@john+smith',\n          decoder: compileDecodeCharMap(['@', '+']),\n        },\n        {\n          name: 'should interpolate the path with the splat param at the end',\n          path: '/users/$',\n          params: { _splat: '123' },\n          result: '/users/123',\n        },\n        {\n          name: 'should interpolate the path with a single named path param and the splat param at the end',\n          path: '/users/$username/$',\n          params: { username: 'seancassiere', _splat: '123' },\n          result: '/users/seancassiere/123',\n        },\n        {\n          name: 'should interpolate the path with 2 named path params with the splat param at the end',\n          path: '/users/$username/$id/$',\n          params: { username: 'seancassiere', id: '123', _splat: '456' },\n          result: '/users/seancassiere/123/456',\n        },\n        {\n          name: 'should interpolate the path with multiple named path params with the splat param at the end',\n          path: '/$username/settings/$repo/$id/$',\n          params: {\n            username: 'sean-cassiere',\n            repo: 'my-repo',\n            id: '123',\n            _splat: '456',\n          },\n          result: '/sean-cassiere/settings/my-repo/123/456',\n        },\n        {\n          name: 'should interpolate the path with the splat param containing slashes',\n          path: '/users/$',\n          params: { _splat: 'sean/cassiere' },\n          result: '/users/sean/cassiere',\n        },\n      ])('$name', ({ path, params, decoder, result }) => {\n        expect(\n          interpolatePath({\n            path,\n            params,\n            decoder,\n            server,\n          }).interpolatedPath,\n        ).toBe(result)\n      })\n    })\n\n    describe('preserve trailing slash', () => {\n      it.each([\n        {\n          path: '/',\n          params: {},\n          result: '/',\n        },\n        {\n          path: '/a/b/',\n          params: {},\n          result: '/a/b/',\n        },\n        {\n          path: '/a/$id/',\n          params: { id: '123' },\n          result: '/a/123/',\n        },\n        {\n          path: '/a/{-$id}/',\n          params: { id: '123' },\n          result: '/a/123/',\n        },\n      ])(\n        'should preserve trailing slash for $path',\n        ({ path, params, result }) => {\n          expect(\n            interpolatePath({\n              path,\n              params,\n              server,\n            }).interpolatedPath,\n          ).toBe(result)\n        },\n      )\n    })\n\n    describe('wildcard (prefix + suffix)', () => {\n      it.each([\n        {\n          name: 'regular',\n          to: '/$',\n          params: { _splat: 'bar/foo/me' },\n          result: '/bar/foo/me',\n        },\n        {\n          name: 'regular curly braces',\n          to: '/{$}',\n          params: { _splat: 'bar/foo/me' },\n          result: '/bar/foo/me',\n        },\n        {\n          name: 'with prefix',\n          to: '/prefix{$}',\n          params: { _splat: 'bar' },\n          result: '/prefixbar',\n        },\n        {\n          name: 'with suffix',\n          to: '/{$}-suffix',\n          params: { _splat: 'bar' },\n          result: '/bar-suffix',\n        },\n        {\n          name: 'with prefix + suffix',\n          to: '/prefix{$}-suffix',\n          params: { _splat: 'bar' },\n          result: '/prefixbar-suffix',\n        },\n      ])('$name', ({ to, params, result }) => {\n        expect(\n          interpolatePath({\n            path: to,\n            params,\n            server,\n          }).interpolatedPath,\n        ).toBe(result)\n      })\n    })\n\n    describe('splat params with special characters', () => {\n      it.each([\n        {\n          name: 'should encode spaces in splat param',\n          path: '/$',\n          params: { _splat: 'file name.pdf' },\n          result: '/file%20name.pdf',\n        },\n        {\n          name: 'should preserve parentheses in splat param (RFC 3986 unreserved)',\n          path: '/$',\n          params: { _splat: 'file(1).pdf' },\n          result: '/file(1).pdf',\n        },\n        {\n          name: 'should encode brackets in splat param',\n          path: '/$',\n          params: { _splat: 'file[1].pdf' },\n          result: '/file%5B1%5D.pdf',\n        },\n        {\n          name: 'should encode spaces in nested splat param paths',\n          path: '/$',\n          params: { _splat: 'folder/sub folder/file name.pdf' },\n          result: '/folder/sub%20folder/file%20name.pdf',\n        },\n        {\n          name: 'should encode spaces and brackets but preserve parentheses',\n          path: '/$',\n          params: { _splat: 'docs/file (copy) [2].pdf' },\n          result: '/docs/file%20(copy)%20%5B2%5D.pdf',\n        },\n        {\n          name: 'should encode hash in splat param',\n          path: '/$',\n          params: { _splat: 'page#section' },\n          result: '/page%23section',\n        },\n        {\n          name: 'should handle splat param with prefix and special characters',\n          path: '/files/prefix{$}',\n          params: { _splat: 'my file.pdf' },\n          result: '/files/prefixmy%20file.pdf',\n        },\n        {\n          name: 'should encode plus signs in splat param',\n          path: '/$',\n          params: { _splat: 'file+name.pdf' },\n          result: '/file%2Bname.pdf',\n        },\n        {\n          name: 'should encode equals signs in splat param',\n          path: '/$',\n          params: { _splat: 'query=value' },\n          result: '/query%3Dvalue',\n        },\n      ])('$name', ({ path, params, result }) => {\n        expect(\n          interpolatePath({\n            path,\n            params,\n            server,\n          }).interpolatedPath,\n        ).toBe(result)\n      })\n    })\n\n    describe('named params (prefix + suffix)', () => {\n      it.each([\n        {\n          name: 'regular',\n          to: '/$foo',\n          params: { foo: 'bar' },\n          result: '/bar',\n        },\n        {\n          name: 'regular curly braces',\n          to: '/{$foo}',\n          params: { foo: 'bar' },\n          result: '/bar',\n        },\n        {\n          name: 'with prefix',\n          to: '/prefix{$bar}',\n          params: { bar: 'baz' },\n          result: '/prefixbaz',\n        },\n        {\n          name: 'with suffix',\n          to: '/{$foo}.suffix',\n          params: { foo: 'bar' },\n          result: '/bar.suffix',\n        },\n        {\n          name: 'with suffix',\n          to: '/{$foo}.suffix',\n          params: { foo: 'bar_' },\n          result: '/bar_.suffix',\n        },\n        {\n          name: 'with prefix and suffix',\n          to: '/prefix{$param}.suffix',\n          params: { param: 'foobar' },\n          result: '/prefixfoobar.suffix',\n        },\n      ])('$name', ({ to, params, result }) => {\n        expect(\n          interpolatePath({\n            path: to,\n            params,\n            server,\n          }).interpolatedPath,\n        ).toBe(result)\n      })\n    })\n\n    describe('should handle missing _splat parameter for', () => {\n      it.each([\n        {\n          name: 'basic splat route',\n          path: '/hello/$',\n          params: {},\n          expectedResult: '/hello',\n        },\n        {\n          name: 'splat route with prefix',\n          path: '/hello/prefix{$}',\n          params: {},\n          expectedResult: '/hello/prefix',\n        },\n        {\n          name: 'splat route with suffix',\n          path: '/hello/{$}suffix',\n          params: {},\n          expectedResult: '/hello/suffix',\n        },\n        {\n          name: 'splat route with prefix and suffix',\n          path: '/hello/prefix{$}suffix',\n          params: {},\n          expectedResult: '/hello/prefixsuffix',\n        },\n        {\n          name: 'splat route with empty splat',\n          path: '/hello/$',\n          params: {\n            _splat: '',\n          },\n          expectedResult: '/hello',\n        },\n        {\n          name: 'splat route with undefined splat',\n          path: '/hello/$',\n          params: {\n            _splat: undefined,\n          },\n          expectedResult: '/hello',\n        },\n      ])('$name', ({ path, params, expectedResult }) => {\n        const result = interpolatePath({\n          path,\n          params,\n          server,\n        })\n        expect(result.interpolatedPath).toBe(expectedResult)\n        expect(result.isMissingParams).toBe(true)\n      })\n    })\n\n    describe('resolvePath + interpolatePath', () => {\n      it.each(['never', 'preserve', 'always'] as const)(\n        'trailing slash: %s',\n        (trailingSlash) => {\n          const tail = trailingSlash === 'always' ? '/' : ''\n          const defaultedFromPath = '/'\n          const fromPath = resolvePath({\n            base: defaultedFromPath,\n            to: '.',\n            trailingSlash,\n          })\n          const nextTo = resolvePath({\n            base: fromPath,\n            to: '/splat/$',\n            trailingSlash,\n          })\n          const nextParams = { _splat: '' }\n          const interpolatedNextTo = interpolatePath({\n            path: nextTo,\n            params: nextParams,\n            server,\n          }).interpolatedPath\n          expect(interpolatedNextTo).toBe(`/splat${tail}`)\n        },\n      )\n    })\n  },\n)\n\ndescribe('matchPathname', () => {\n  const { processedTree } = processRouteTree({\n    id: '__root__',\n    isRoot: true,\n    fullPath: '/',\n    path: '/',\n  })\n  const matchPathname = (\n    from: string,\n    options: { to: string; caseSensitive?: boolean; fuzzy?: boolean },\n  ) => {\n    const match = findSingleMatch(\n      options.to,\n      options.caseSensitive ?? false,\n      options.fuzzy ?? false,\n      from,\n      processedTree,\n    )\n    const result = match ? match.rawParams : undefined\n    if (options.to && !result) return\n    return result ?? {}\n  }\n  describe('path param(s) matching', () => {\n    it.each([\n      {\n        name: 'should not match since `to` does not match the input',\n        input: '/',\n        matchingOptions: {\n          to: '/users',\n        },\n        expectedMatchedParams: undefined,\n      },\n      {\n        name: 'should match since `to` matches the input',\n        input: '/users',\n        matchingOptions: {\n          to: '/users',\n        },\n        expectedMatchedParams: {},\n      },\n      {\n        name: 'should match and return the named path params',\n        input: '/users/123',\n        matchingOptions: {\n          to: '/users/$id',\n        },\n        expectedMatchedParams: { id: '123' },\n      },\n      {\n        name: 'should match and return the the splat param',\n        input: '/users/123',\n        matchingOptions: {\n          to: '/users/$',\n        },\n        expectedMatchedParams: {\n          '*': '123',\n          _splat: '123',\n        },\n      },\n      {\n        name: 'should match and return the named path and splat params',\n        input: '/users/123/456',\n        matchingOptions: {\n          to: '/users/$id/$',\n        },\n        expectedMatchedParams: {\n          id: '123',\n          '*': '456',\n          _splat: '456',\n        },\n      },\n      {\n        name: 'should match and return the multiple named path params and splat param',\n        input: '/sean-cassiere/settings/my-repo/123/456',\n        matchingOptions: {\n          to: '/$username/settings/$repo/$id/$',\n        },\n        expectedMatchedParams: {\n          username: 'sean-cassiere',\n          repo: 'my-repo',\n          id: '123',\n          '*': '456',\n          _splat: '456',\n        },\n      },\n      {\n        name: 'should match and return the splat params when multiple subsequent segments are present',\n        input: '/docs/tanner/sean/manuel',\n        matchingOptions: {\n          to: '/docs/$',\n        },\n        expectedMatchedParams: {\n          '*': 'tanner/sean/manuel',\n          _splat: 'tanner/sean/manuel',\n        },\n      },\n    ])('$name', ({ input, matchingOptions, expectedMatchedParams }) => {\n      expect(matchPathname(input, matchingOptions)).toStrictEqual(\n        toNullObj(expectedMatchedParams),\n      )\n    })\n  })\n\n  describe('wildcard (prefix + suffix)', () => {\n    it.each([\n      {\n        name: 'regular',\n        input: '/docs/foo/bar',\n        matchingOptions: {\n          to: '/docs/$',\n        },\n        expectedMatchedParams: {\n          '*': 'foo/bar',\n          _splat: 'foo/bar',\n        },\n      },\n      {\n        name: 'regular curly braces',\n        input: '/docs/foo/bar',\n        matchingOptions: {\n          to: '/docs/{$}',\n        },\n        expectedMatchedParams: {\n          '*': 'foo/bar',\n          _splat: 'foo/bar',\n        },\n      },\n      {\n        name: 'with prefix',\n        input: '/docs/prefixbar/baz',\n        matchingOptions: {\n          to: '/docs/prefix{$}',\n        },\n        expectedMatchedParams: {\n          '*': 'bar/baz',\n          _splat: 'bar/baz',\n        },\n      },\n      {\n        name: 'with suffix',\n        input: '/docs/bar/baz.suffix',\n        matchingOptions: {\n          to: '/docs/{$}.suffix',\n        },\n        expectedMatchedParams: {\n          '*': 'bar/baz',\n          _splat: 'bar/baz',\n        },\n      },\n      {\n        name: 'with prefix + suffix',\n        input: '/docs/prefixbar/baz-suffix',\n        matchingOptions: {\n          to: '/docs/prefix{$}-suffix',\n        },\n        expectedMatchedParams: {\n          '*': 'bar/baz',\n          _splat: 'bar/baz',\n        },\n      },\n    ])('$name', ({ input, matchingOptions, expectedMatchedParams }) => {\n      expect(matchPathname(input, matchingOptions)).toStrictEqual(\n        toNullObj(expectedMatchedParams),\n      )\n    })\n  })\n\n  describe('named params (prefix + suffix)', () => {\n    it.each([\n      {\n        name: 'regular',\n        input: '/docs/foo',\n        matchingOptions: {\n          to: '/docs/$bar',\n        },\n        expectedMatchedParams: {\n          bar: 'foo',\n        },\n      },\n      {\n        name: 'regular',\n        input: '/docs/foo_',\n        matchingOptions: {\n          to: '/docs/$bar',\n        },\n        expectedMatchedParams: {\n          bar: 'foo_',\n        },\n      },\n      {\n        name: 'regular curly braces',\n        input: '/docs/foo',\n        matchingOptions: {\n          to: '/docs/{$bar}',\n        },\n        expectedMatchedParams: {\n          bar: 'foo',\n        },\n      },\n      {\n        name: 'with prefix',\n        input: '/docs/prefixfoo_',\n        matchingOptions: {\n          to: '/docs/prefix{$bar}',\n        },\n        expectedMatchedParams: {\n          bar: 'foo_',\n        },\n      },\n      {\n        name: 'with prefix',\n        input: '/docs/prefixfoo',\n        matchingOptions: {\n          to: '/docs/prefix{$bar}',\n        },\n        expectedMatchedParams: {\n          bar: 'foo',\n        },\n      },\n      {\n        name: 'with suffix',\n        input: '/docs/foo.suffix',\n        matchingOptions: {\n          to: '/docs/{$bar}.suffix',\n        },\n        expectedMatchedParams: {\n          bar: 'foo',\n        },\n      },\n      {\n        name: 'with prefix + suffix',\n        input: '/docs/prefixfoobar-suffix',\n        matchingOptions: {\n          to: '/docs/prefix{$param}-suffix',\n        },\n        expectedMatchedParams: {\n          param: 'foobar',\n        },\n      },\n    ])('$name', ({ input, matchingOptions, expectedMatchedParams }) => {\n      expect(matchPathname(input, matchingOptions)).toStrictEqual(\n        toNullObj(expectedMatchedParams),\n      )\n    })\n  })\n})\n\ndescribe('parsePathname', () => {\n  type ParsePathnameTestScheme = Array<{\n    name: string\n    to: string | undefined\n    expected: Array<PathSegment>\n  }>\n\n  type PathSegment = {\n    type: SegmentKind\n    value: string\n    prefixSegment?: string\n    suffixSegment?: string\n  }\n\n  const parsePathname = (to: string | undefined) => {\n    let cursor = 0\n    let data\n    const path = to ?? ''\n    const segments: Array<PathSegment> = []\n    while (cursor < path.length) {\n      const start = cursor\n      data = parseSegment(path, start, data)\n      const end = data[5]\n      cursor = end + 1\n      const type = data[0]\n      const value = path.substring(data[2], data[3])\n      const prefix = path.substring(start, data[1])\n      const suffix = path.substring(data[4], end)\n      const segment: PathSegment = {\n        type,\n        value,\n      }\n      if (prefix) {\n        segment.prefixSegment = prefix\n      }\n      if (suffix) {\n        segment.suffixSegment = suffix\n      }\n      segments.push(segment)\n    }\n    return segments\n  }\n\n  describe('regular usage', () => {\n    it.each([\n      {\n        name: 'should handle pathname being undefined',\n        to: undefined,\n        expected: [],\n      },\n      {\n        name: 'should handle pathname being empty',\n        to: '',\n        expected: [],\n      },\n      {\n        name: 'should handle pathname at root',\n        to: '/',\n        expected: [{ type: SEGMENT_TYPE_PATHNAME, value: '' }],\n      },\n      {\n        name: 'should handle pathname with a single segment',\n        to: '/foo',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'foo' },\n        ],\n      },\n      {\n        name: 'should handle pathname with multiple segments',\n        to: '/foo/bar/baz',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'foo' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'bar' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'baz' },\n        ],\n      },\n      {\n        name: 'should handle pathname with a trailing slash',\n        to: '/foo/',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'foo' },\n        ],\n      },\n      {\n        name: 'should handle named params',\n        to: '/foo/$bar',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'foo' },\n          { type: SEGMENT_TYPE_PARAM, value: 'bar' },\n        ],\n      },\n      {\n        name: 'should handle named params at the root',\n        to: '/$bar',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PARAM, value: 'bar' },\n        ],\n      },\n      {\n        name: 'should handle named params followed by a segment',\n        to: '/foo/$bar/baz',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'foo' },\n          { type: SEGMENT_TYPE_PARAM, value: 'bar' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'baz' },\n        ],\n      },\n      {\n        name: 'should handle multiple named params',\n        to: '/foo/$bar/$baz/qux/$quux',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'foo' },\n          { type: SEGMENT_TYPE_PARAM, value: 'bar' },\n          { type: SEGMENT_TYPE_PARAM, value: 'baz' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'qux' },\n          { type: SEGMENT_TYPE_PARAM, value: 'quux' },\n        ],\n      },\n      {\n        name: 'should handle splat params',\n        to: '/foo/$',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'foo' },\n          { type: SEGMENT_TYPE_WILDCARD, value: '$' },\n        ],\n      },\n      {\n        name: 'should handle splat params at the root',\n        to: '/$',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_WILDCARD, value: '$' },\n        ],\n      },\n    ] satisfies ParsePathnameTestScheme)('$name', ({ to, expected }) => {\n      const result = parsePathname(to)\n      expect(result).toEqual(expected)\n    })\n  })\n\n  describe('wildcard (prefix + suffix)', () => {\n    it.each([\n      {\n        name: 'regular',\n        to: '/$',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_WILDCARD, value: '$' },\n        ],\n      },\n      {\n        name: 'regular curly braces',\n        to: '/{$}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_WILDCARD, value: '$' },\n        ],\n      },\n      {\n        name: 'with prefix (regular text)',\n        to: '/foo{$}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_WILDCARD,\n            value: '$',\n            prefixSegment: 'foo',\n          },\n        ],\n      },\n      {\n        name: 'with prefix + followed by special character',\n        to: '/foo.{$}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_WILDCARD,\n            value: '$',\n            prefixSegment: 'foo.',\n          },\n        ],\n      },\n      {\n        name: 'with suffix',\n        to: '/{$}-foo',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_WILDCARD,\n            value: '$',\n            suffixSegment: '-foo',\n          },\n        ],\n      },\n      {\n        name: 'with prefix + suffix',\n        to: '/foo{$}-bar',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_WILDCARD,\n            value: '$',\n            prefixSegment: 'foo',\n            suffixSegment: '-bar',\n          },\n        ],\n      },\n      {\n        name: 'with prefix + followed by special character and a segment',\n        to: '/foo.{$}/bar',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_WILDCARD,\n            value: '$',\n            prefixSegment: 'foo.',\n            suffixSegment: '/bar',\n          },\n        ],\n      },\n    ] satisfies ParsePathnameTestScheme)('$name', ({ to, expected }) => {\n      const result = parsePathname(to)\n      expect(result).toEqual(expected)\n    })\n  })\n\n  describe('named params (prefix + suffix)', () => {\n    it.each([\n      {\n        name: 'regular',\n        to: '/$bar',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PARAM, value: 'bar' },\n        ],\n      },\n      {\n        name: 'regular curly braces',\n        to: '/{$bar}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          { type: SEGMENT_TYPE_PARAM, value: 'bar' },\n        ],\n      },\n      {\n        name: 'with prefix (regular text)',\n        to: '/foo{$bar}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_PARAM,\n            value: 'bar',\n            prefixSegment: 'foo',\n          },\n        ],\n      },\n      {\n        name: 'with prefix + followed by special character',\n        to: '/foo.{$bar}',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_PARAM,\n            value: 'bar',\n            prefixSegment: 'foo.',\n          },\n        ],\n      },\n      {\n        name: 'with suffix',\n        to: '/{$bar}.foo',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_PARAM,\n            value: 'bar',\n            suffixSegment: '.foo',\n          },\n        ],\n      },\n      {\n        name: 'with suffix + started by special character',\n        to: '/{$bar}.foo',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_PARAM,\n            value: 'bar',\n            suffixSegment: '.foo',\n          },\n        ],\n      },\n      {\n        name: 'with suffix + started by special character and followed by segment',\n        to: '/{$bar}.foo/baz',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_PARAM,\n            value: 'bar',\n            suffixSegment: '.foo',\n          },\n          { type: SEGMENT_TYPE_PATHNAME, value: 'baz' },\n        ],\n      },\n      {\n        name: 'with suffix + prefix',\n        to: '/foo{$bar}.baz',\n        expected: [\n          { type: SEGMENT_TYPE_PATHNAME, value: '' },\n          {\n            type: SEGMENT_TYPE_PARAM,\n            value: 'bar',\n            prefixSegment: 'foo',\n            suffixSegment: '.baz',\n          },\n        ],\n      },\n    ] satisfies ParsePathnameTestScheme)('$name', ({ to, expected }) => {\n      const result = parsePathname(to)\n      expect(result).toEqual(expected)\n    })\n  })\n})\n\nfunction toNullObj<T>(obj: T): T {\n  if (typeof obj === 'object') return Object.assign(Object.create(null), obj)\n  return obj\n}\n"
  },
  {
    "path": "packages/router-core/tests/qss.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport { decode, encode } from '../src/qss'\n\ndescribe('encode function', () => {\n  it('should encode an object into a query string without a prefix', () => {\n    const obj = { token: 'foo', key: 'value' }\n    const queryString = encode(obj)\n    expect(queryString).toEqual('token=foo&key=value')\n  })\n\n  it('should handle encoding an object with empty values and trailing equal signs', () => {\n    const obj = { token: '', key: 'value=' }\n    const queryString = encode(obj)\n    expect(queryString).toEqual('token=&key=value%3D') // token=&key=value=\n  })\n\n  it('should handle encoding an object with array values', () => {\n    const obj = { token: ['foo', 'bar'], key: 'value' }\n    const queryString = encode(obj)\n    expect(queryString).toEqual('token=foo%2Cbar&key=value')\n  })\n\n  it('should handle encoding an object with special characters', () => {\n    const obj = { token: 'foo?', key: 'value=' }\n    const queryString = encode(obj)\n    expect(queryString).toEqual('token=foo%3F&key=value%3D')\n  })\n\n  it('should handle encoding a top-level key with a special character', () => {\n    const obj = { 'foo=bar': 1 }\n    const queryString = encode(obj)\n    expect(queryString).toEqual('foo%3Dbar=1')\n  })\n})\n\ndescribe('decode function', () => {\n  it('should decode a query string without a prefix', () => {\n    const queryString = 'token=foo&key=value'\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ token: 'foo', key: 'value' })\n  })\n\n  it('should handle missing values and trailing equal signs', () => {\n    const queryString = 'token=&key=value='\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ token: '', key: 'value=' })\n  })\n\n  it('should handle decoding a query string with array values', () => {\n    const queryString = 'token=foo&token=bar&key=value'\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ token: ['foo', 'bar'], key: 'value' })\n  })\n\n  it('should handle decoding a query string with special characters', () => {\n    const queryString = 'token=foo%3F&key=value%3D'\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ token: 'foo?', key: 'value=' })\n  })\n\n  it('should handle decoding a top-level key with a special character', () => {\n    const queryString = 'foo%3Dbar=1'\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ 'foo=bar': 1 })\n  })\n\n  it('should handle decoding a top-level key with a special character and without a value', () => {\n    const queryString = 'foo%3Dbar='\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ 'foo=bar': '' })\n  })\n\n  it('should handle decoding a value-less top-level key with a special character', () => {\n    const queryString = 'foo%3Dbar'\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ 'foo=bar': '' })\n  })\n\n  it('should handle decoding a query with \"100%\" as a value', () => {\n    const queryString = 'percentage=100%&name=Sean&foo%3Dbar&key=value%3D'\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({\n      percentage: '100%',\n      name: 'Sean',\n      'foo=bar': '',\n      key: 'value=',\n    })\n  })\n\n  it('should handle decoding a query with plus', () => {\n    const queryString = 'q=red%2Byellow+orange'\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ q: 'red+yellow orange' })\n  })\n\n  it('should decode once percent characters (%) encoded twice', () => {\n    const queryString = 'q=%2540'\n    const decodedObj = decode(queryString)\n    expect(decodedObj).toEqual({ q: '%40' })\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/redirect.test-d.ts",
    "content": "import { describe, expectTypeOf, test } from 'vitest'\nimport {\n  BaseRootRoute,\n  BaseRoute,\n  BaseRouteApi,\n  redirect,\n  type Redirect,\n  type RedirectFnRoute,\n  type RedirectOptionsRoute,\n} from '../src'\n\ndescribe('RedirectFnRoute', () => {\n  test('should be callable with redirect options', () => {\n    type TestRedirectFn = RedirectFnRoute<'/users/$userId'>\n\n    expectTypeOf<TestRedirectFn>().toBeCallableWith({\n      to: '/' as const,\n    })\n  })\n\n  test('should not require from option', () => {\n    type TestRedirectFn = RedirectFnRoute<'/users/$userId'>\n\n    // from should not be in the options type\n    expectTypeOf<Parameters<TestRedirectFn>[0]>().not.toHaveProperty('from')\n  })\n\n  test('should return Redirect type', () => {\n    type TestRedirectFn = RedirectFnRoute<'/users/$userId'>\n\n    expectTypeOf<ReturnType<TestRedirectFn>>().toMatchTypeOf<Response>()\n  })\n})\n\ndescribe('RedirectOptionsRoute', () => {\n  test('should not have from property', () => {\n    type TestOptions = RedirectOptionsRoute<'/users/$userId'>\n\n    // from should be omitted\n    expectTypeOf<TestOptions>().not.toHaveProperty('from')\n  })\n\n  test('should have to property', () => {\n    type TestOptions = RedirectOptionsRoute<'/users/$userId'>\n\n    // Should be able to specify to\n    const optionsWithTo: TestOptions = { to: '/' }\n    expectTypeOf(optionsWithTo).toMatchTypeOf<TestOptions>()\n  })\n\n  test('should allow statusCode option', () => {\n    type TestOptions = RedirectOptionsRoute<'/users/$userId'>\n\n    const options: TestOptions = { to: '/', statusCode: 301 }\n    expectTypeOf(options).toMatchTypeOf<TestOptions>()\n  })\n\n  test('should allow href option for external redirects', () => {\n    type TestOptions = RedirectOptionsRoute<'/users/$userId'>\n\n    // href can be used with to\n    const options: TestOptions = { to: '/', href: 'http://example.com' }\n    expectTypeOf(options).toMatchTypeOf<TestOptions>()\n  })\n})\n\ndescribe('BaseRoute.redirect', () => {\n  test('should have redirect property on BaseRoute', () => {\n    const rootRoute = new BaseRootRoute({})\n    const usersRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n    })\n\n    expectTypeOf(usersRoute.redirect).toBeFunction()\n  })\n\n  test('should create redirect with to option', () => {\n    const rootRoute = new BaseRootRoute({})\n    const usersRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users/$userId',\n    })\n\n    // Should be callable with to option\n    const result = usersRoute.redirect({ to: '/' })\n    expectTypeOf(result).toMatchTypeOf<Response>()\n  })\n})\n\ndescribe('BaseRouteApi.redirect', () => {\n  test('should have redirect property on BaseRouteApi', () => {\n    const routeApi = new BaseRouteApi({ id: '/users/$userId' })\n\n    expectTypeOf(routeApi.redirect).toBeFunction()\n  })\n\n  test('should create redirect with to option', () => {\n    const routeApi = new BaseRouteApi({ id: '/users/$userId' })\n\n    // Should be callable with to option\n    const result = routeApi.redirect({ to: '/' })\n    expectTypeOf(result).toMatchTypeOf<Response>()\n  })\n})\n\ndescribe('redirect vs Route.redirect comparison', () => {\n  test('regular redirect can use from for type inference', () => {\n    // Regular redirect - from is optional but helps with type inference\n    const regularRedirect = redirect({\n      to: '/users' as const,\n      from: '/posts/$postId' as const,\n    })\n    expectTypeOf(regularRedirect).toMatchTypeOf<Response>()\n  })\n\n  test('Route.redirect automatically sets from', () => {\n    const rootRoute = new BaseRootRoute({})\n    const postsRoute = new BaseRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/$postId',\n    })\n\n    // Route.redirect - from is automatically set from fullPath\n    const routeRedirect = postsRoute.redirect({\n      to: '/',\n    })\n    expectTypeOf(routeRedirect).toMatchTypeOf<Response>()\n  })\n\n  test('RouteApi.redirect automatically sets from', () => {\n    const routeApi = new BaseRouteApi({ id: '/posts/$postId' })\n\n    // RouteApi.redirect - from is automatically set from route id\n    const routeApiRedirect = routeApi.redirect({\n      to: '/',\n    })\n    expectTypeOf(routeApiRedirect).toMatchTypeOf<Response>()\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/remountDeps.test-d.ts",
    "content": "import { describe, expectTypeOf, test } from 'vitest'\nimport type { RemountDepsOptions } from '../src'\n\ntype SearchSchema = {\n  testParam: string\n}\n\ntype TestRemountDepsOptions = RemountDepsOptions<'/test', SearchSchema, {}, {}>\n\ndescribe('RemountDepsOptions type test', () => {\n  test('search field should be directly accessible', () => {\n    expectTypeOf<\n      TestRemountDepsOptions['search']\n    >().toEqualTypeOf<SearchSchema>()\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/remountDeps.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport type { RemountDepsOptions } from '../src'\n\ndescribe('RemountDepsOptions unit tests', () => {\n  test('search field should be directly accessible', () => {\n    type SearchSchema = {\n      testParam: string\n    }\n\n    const mockOptions: RemountDepsOptions<'/test', SearchSchema, {}, {}> = {\n      routeId: '/test',\n      search: {\n        testParam: 'test-value',\n      },\n      params: {},\n      loaderDeps: {},\n    }\n\n    expect(mockOptions.search.testParam).toBe('test-value')\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/routerTestUtils.ts",
    "content": "import { batch, createStore } from '@tanstack/store'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport {\n  RouterCore,\n  createNonReactiveMutableStore,\n  createNonReactiveReadonlyStore,\n} from '../src'\nimport type { RouterHistory } from '@tanstack/history'\nimport type {\n  AnyRoute,\n  GetStoreConfig,\n  RouterConstructorOptions,\n  TrailingSlashOption,\n} from '../src'\n\nconst getStoreConfig: GetStoreConfig = (opts) => {\n  if (isServer ?? opts.isServer) {\n    return {\n      createMutableStore: createNonReactiveMutableStore,\n      createReadonlyStore: createNonReactiveReadonlyStore,\n      batch: (fn) => fn(),\n    }\n  }\n\n  return {\n    createMutableStore: createStore,\n    createReadonlyStore: createStore,\n    batch,\n  }\n}\n\nexport function createTestRouter<\n  TRouteTree extends AnyRoute,\n  TTrailingSlashOption extends TrailingSlashOption = 'never',\n  TDefaultStructuralSharingOption extends boolean = false,\n  TRouterHistory extends RouterHistory = RouterHistory,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n>(\n  options: RouterConstructorOptions<\n    TRouteTree,\n    TTrailingSlashOption,\n    TDefaultStructuralSharingOption,\n    TRouterHistory,\n    TDehydrated\n  >,\n) {\n  return new RouterCore(options, getStoreConfig)\n}\n"
  },
  {
    "path": "packages/router-core/tests/searchMiddleware.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { retainSearchParams, stripSearchParams } from '../src/searchMiddleware'\n\ndescribe('searchMiddleware - mutation prevention', () => {\n  describe('retainSearchParams', () => {\n    test('should not mutate original search object', () => {\n      const originalSearch = { id: '1', filter: 'active', page: '2' }\n      const originalCopy = { ...originalSearch }\n\n      const middleware = retainSearchParams(['id', 'filter'])\n\n      // next() returns object without 'id' and 'filter' keys\n      // so retainSearchParams should add them from search\n      const result = middleware({\n        search: originalSearch,\n        next: () => ({ page: 'new' }) as any,\n      })\n\n      expect(originalSearch).toEqual(originalCopy)\n      expect(originalSearch).toEqual({ id: '1', filter: 'active', page: '2' })\n      expect(result).toEqual({ id: '1', filter: 'active', page: 'new' })\n      expect(result).not.toBe(originalSearch)\n    })\n\n    test('should work correctly when same reference is reused', () => {\n      const sharedSearch = { id: '1', filter: 'active', page: '1' }\n      const middleware = retainSearchParams(['id', 'filter'])\n\n      // next() returns object without 'id' and 'filter' keys\n      const result1 = middleware({\n        search: sharedSearch,\n        next: () => ({ page: '2' }) as any,\n      })\n\n      expect(sharedSearch).toEqual({ id: '1', filter: 'active', page: '1' })\n      expect(result1).toEqual({ id: '1', filter: 'active', page: '2' })\n\n      const result2 = middleware({\n        search: sharedSearch,\n        next: () => ({ page: '3' }) as any,\n      })\n\n      expect(sharedSearch).toEqual({ id: '1', filter: 'active', page: '1' })\n      expect(result2).toEqual({ id: '1', filter: 'active', page: '3' })\n    })\n\n    test('should handle retainSearchParams(true) correctly', () => {\n      const originalSearch = { id: '1', filter: 'active' }\n      const originalCopy = { ...originalSearch }\n\n      const middleware = retainSearchParams(true)\n\n      const result = middleware({\n        search: originalSearch,\n        next: () => ({ id: '2' }) as any,\n      })\n\n      expect(originalSearch).toEqual(originalCopy)\n      expect(result).toEqual({ id: '2', filter: 'active' })\n    })\n  })\n\n  describe('stripSearchParams', () => {\n    test('should not mutate original search object (array input)', () => {\n      const originalSearch = { id: '1', filter: 'active', page: '1' }\n      const originalCopy = { ...originalSearch }\n\n      const middleware = stripSearchParams(['filter', 'page'])\n\n      const result = middleware({\n        search: originalSearch,\n        next: (search) => search,\n      })\n\n      expect(originalSearch).toEqual(originalCopy)\n      expect(originalSearch).toEqual({ id: '1', filter: 'active', page: '1' })\n      expect(result).toEqual({ id: '1' })\n      expect(result).not.toBe(originalSearch)\n    })\n\n    test('should not mutate original search object (object input)', () => {\n      const originalSearch = { id: '1', filter: 'active', status: 'done' }\n      const originalCopy = { ...originalSearch }\n\n      const middleware = stripSearchParams({ filter: 'active', status: 'done' })\n\n      const result = middleware({\n        search: originalSearch,\n        next: (search) => search,\n      })\n\n      expect(originalSearch).toEqual(originalCopy)\n      expect(originalSearch).toEqual({\n        id: '1',\n        filter: 'active',\n        status: 'done',\n      })\n      expect(result).toEqual({ id: '1' })\n      expect(result).not.toBe(originalSearch)\n    })\n\n    test('should work correctly when same reference is reused', () => {\n      const sharedSearch = { id: '1', filter: 'active', page: '1' }\n      const middleware = stripSearchParams(['filter', 'page'])\n\n      const result1 = middleware({\n        search: sharedSearch,\n        next: (search) => search,\n      })\n\n      expect(sharedSearch).toEqual({ id: '1', filter: 'active', page: '1' })\n      expect(result1).toEqual({ id: '1' })\n\n      const result2 = middleware({\n        search: sharedSearch,\n        next: (search) => search,\n      })\n\n      expect(sharedSearch).toEqual({ id: '1', filter: 'active', page: '1' })\n      expect(result2).toEqual({ id: '1' })\n    })\n\n    test('should handle stripSearchParams(true) correctly', () => {\n      const originalSearch = { id: '1', filter: 'active' }\n      const originalCopy = { ...originalSearch }\n\n      const middleware = stripSearchParams(true)\n\n      const result = middleware({\n        search: originalSearch,\n        next: (search) => search,\n      })\n\n      expect(originalSearch).toEqual(originalCopy)\n      expect(result).toEqual({})\n    })\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/searchParams.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { defaultParseSearch, defaultStringifySearch } from '../src'\n\ndescribe('Search Params serialization and deserialization', () => {\n  /*\n   * JSON-compatible objects can be serialized into a string,\n   * and then deserialized back into the original object.\n   */\n  test.each([\n    [{}, ''],\n    [{ foo: '' }, '?foo='],\n    [{ foo: 'bar' }, '?foo=bar'],\n    [{ foo: 'bar baz' }, '?foo=bar+baz'],\n    [{ foo: 123 }, '?foo=123'],\n    [{ foo: '123' }, '?foo=%22123%22'],\n    [{ foo: true }, '?foo=true'],\n    [{ foo: 'true' }, '?foo=%22true%22'],\n    [{ foo: null }, '?foo=null'],\n    [{ foo: 'null' }, '?foo=%22null%22'],\n    [{ foo: 'undefined' }, '?foo=undefined'],\n    [{ foo: {} }, '?foo=%7B%7D'],\n    [{ foo: '{}' }, '?foo=%22%7B%7D%22'],\n    [{ foo: [] }, '?foo=%5B%5D'],\n    [{ foo: '[]' }, '?foo=%22%5B%5D%22'],\n    [{ foo: [1, 2, 3] }, '?foo=%5B1%2C2%2C3%5D'],\n    [{ foo: '1,2,3' }, '?foo=1%2C2%2C3'],\n    [{ foo: { bar: 'baz' } }, '?foo=%7B%22bar%22%3A%22baz%22%7D'],\n    [{ 0: 1 }, '?0=1'],\n    [{ 'foo=bar': 1 }, '?foo%3Dbar=1'],\n    [{ '{}': 1 }, '?%7B%7D=1'],\n    [{ '': 1 }, '?=1'],\n    [{ '=': '=' }, '?%3D=%3D'],\n    [{ '=': '', '': '=' }, '?%3D=&=%3D'],\n    [{ 'foo=2&bar': 3 }, '?foo%3D2%26bar=3'],\n    [{ 'foo?': 1 }, '?foo%3F=1'],\n    [{ foo: 'bar=' }, '?foo=bar%3D'],\n    [{ foo: '2&bar=3' }, '?foo=2%26bar%3D3'],\n  ])('isomorphism %j', (input, expected) => {\n    const str = defaultStringifySearch(input)\n    expect(str).toEqual(expected)\n    expect(defaultParseSearch(str)).toEqual(input)\n  })\n\n  test('undefined values are removed during stringification', () => {\n    const str = defaultStringifySearch({ foo: 'bar', bar: undefined })\n    expect(str).toEqual('?foo=bar')\n    expect(defaultParseSearch(str)).toEqual({ foo: 'bar' })\n  })\n\n  test('[edge case] self-reference serializes to \"object Object\"', () => {\n    const obj = {} as any\n    obj.self = obj\n    const str = defaultStringifySearch(obj)\n    expect(str).toEqual('?self=%5Bobject+Object%5D')\n    expect(defaultParseSearch(str)).toEqual({ self: '[object Object]' })\n  })\n\n  /*\n   * It is able to parse strings that could not have come\n   * from the serializer.\n   *\n   * This can be useful because search params can be manipulated\n   * by human users.\n   */\n  test.each([\n    ['?foo={}', { foo: {} }],\n    ['?foo=[]', { foo: [] }],\n    ['?foo=1,2,3', { foo: '1,2,3' }],\n    ['?foo={\"bar\":\"baz\"}', { foo: { bar: 'baz' } }],\n    ['?foo=1&foo=2', { foo: [1, 2] }],\n    ['?foo=\"\"', { foo: '' }],\n    ['?foo=\"\"\"\"', { foo: '\"\"\"\"' }],\n    ['?foo=()', { foo: '()' }],\n    ['?foo=[{}]', { foo: [{}] }],\n  ])('alien deserialization %s', (input, expected) => {\n    const obj = defaultParseSearch(input)\n    expect(obj).toEqual(expected)\n    expect(defaultStringifySearch(obj)).not.toBe(input)\n  })\n\n  /*\n   * It can serialize stuff that really shouldn't be passed as input.\n   * But just in case, this test serves as documentation of \"what would happen\"\n   * if you did.\n   */\n  test('[edge case] inputs that are not primitive objects', () => {\n    expect(defaultStringifySearch(new Number(99))).toEqual('')\n    expect(defaultStringifySearch({ foo: new Number(99) })).toEqual('?foo=99')\n    expect(defaultStringifySearch(new String('foo'))).toEqual('?0=f&1=o&2=o')\n    expect(defaultStringifySearch(new Promise(() => {}))).toEqual('')\n    expect(defaultStringifySearch({ foo: new Promise(() => {}) })).toEqual(\n      '?foo=%7B%7D',\n    )\n    expect(defaultStringifySearch([1])).toEqual('?0=1')\n    const date = new Date('2024-11-18')\n    expect(defaultStringifySearch(date)).toEqual('')\n    expect(defaultStringifySearch({ foo: date })).toEqual(\n      '?foo=%222024-11-18T00%3A00%3A00.000Z%22',\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/serializer-recursion.test-d.ts",
    "content": "import { describe, expectTypeOf, it } from 'vitest'\n\nimport type {\n  Serializable,\n  ValidateSerializable,\n  ValidateSerializableResult,\n} from '../src/ssr/serializer/transformer'\n\ndescribe('ValidateSerializable array handling', () => {\n  it('preserves nested array payloads for input validation', () => {\n    type Input = Array<{ value: string; nested: Array<{ id: number }> }>\n    expectTypeOf<\n      ValidateSerializable<Input, Serializable>\n    >().branded.toEqualTypeOf<Input>()\n  })\n\n  it('preserves tuple structure for input validation', () => {\n    type InputTuple = readonly [{ name: string }, { count: number }]\n    expectTypeOf<\n      ValidateSerializable<InputTuple, Serializable>\n    >().branded.toEqualTypeOf<InputTuple>()\n  })\n\n  it('preserves readonly array structure for input validation', () => {\n    type InputReadonlyArray = ReadonlyArray<{ value: string }>\n    expectTypeOf<\n      ValidateSerializable<InputReadonlyArray, Serializable>\n    >().branded.toEqualTypeOf<InputReadonlyArray>()\n  })\n\n  it('preserves recursive payloads wrapped in Promise for input validation', () => {\n    type Recursive = { value: number; next?: Recursive }\n    type InputPromise = Promise<Recursive>\n    expectTypeOf<\n      ValidateSerializable<InputPromise, Serializable>\n    >().branded.toEqualTypeOf<InputPromise>()\n  })\n\n  it('preserves recursive payloads wrapped in Promise<Array> for input validation', () => {\n    type Recursive = { value: number; children?: Array<Recursive> }\n    type InputPromiseArray = Promise<Array<Recursive>>\n    expectTypeOf<\n      ValidateSerializable<InputPromiseArray, Serializable>\n    >().branded.toEqualTypeOf<InputPromiseArray>()\n  })\n\n  it('preserves recursive payloads wrapped in ReadableStream for input validation', () => {\n    type Recursive = { value: number; next?: Recursive }\n    type InputStream = ReadableStream<Recursive>\n    expectTypeOf<\n      ValidateSerializable<InputStream, Serializable>\n    >().branded.toEqualTypeOf<InputStream>()\n  })\n\n  it('should preserve recursive payload without infinite expansion', () => {\n    type Result = Array<Result> | { [key: string]: Result }\n    expectTypeOf<\n      ValidateSerializableResult<Result, Serializable>\n    >().branded.toEqualTypeOf<Result>()\n  })\n\n  it('should preserve recursive tuples without infinite expansion', () => {\n    type ResultTuple = readonly [\n      ReadonlyArray<ResultTuple>,\n      { [key: string]: ResultTuple },\n    ]\n    expectTypeOf<\n      ValidateSerializableResult<ResultTuple, Serializable>\n    >().branded.toEqualTypeOf<ResultTuple>()\n  })\n\n  it('should preserve readonly recursive arrays without infinite expansion', () => {\n    type ResultReadonlyArray = ReadonlyArray<\n      ResultReadonlyArray | { [key: string]: ResultReadonlyArray }\n    >\n    expectTypeOf<\n      ValidateSerializableResult<ResultReadonlyArray, Serializable>\n    >().branded.toEqualTypeOf<ResultReadonlyArray>()\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/serializer.test-d.ts",
    "content": "import { describe, expectTypeOf, it } from 'vitest'\n\nimport {\n  Serializable,\n  TsrSerializable,\n  ValidateSerializable,\n  ValidateSerializableResult,\n} from '../src/ssr/serializer/transformer'\n\ndescribe('Serializer', () => {\n  describe('Default types are serializable: $name', () => {\n    it('string', () => {\n      const value: string = 'hello'\n      expectTypeOf<\n        ValidateSerializableResult<typeof value, Serializable>\n      >().toBeString()\n    })\n    it('number', () => {\n      const value: number = 123\n\n      expectTypeOf<\n        ValidateSerializableResult<typeof value, Serializable>\n      >().toBeNumber()\n    })\n    it('boolean', () => {\n      const value: boolean = true\n\n      expectTypeOf<\n        ValidateSerializableResult<typeof value, Serializable>\n      >().toBeBoolean()\n    })\n    it('null', () => {\n      const value = null\n\n      expectTypeOf<\n        ValidateSerializableResult<typeof value, Serializable>\n      >().toBeNull()\n    })\n    it('undefined', () => {\n      const value = undefined\n\n      expectTypeOf<\n        ValidateSerializableResult<typeof value, Serializable>\n      >().toBeUndefined()\n    })\n    it('bigint', () => {\n      const value = BigInt(123)\n\n      expectTypeOf<\n        ValidateSerializableResult<typeof value, Serializable>\n      >().toBeBigInt()\n    })\n    it('Date', () => {\n      const value = new Date()\n\n      expectTypeOf<\n        ValidateSerializableResult<typeof value, Serializable>\n      >().toEqualTypeOf<Date>()\n    })\n  })\n  it('fails for non-serializable types', () => {\n    const value = () => {}\n    expectTypeOf<\n      ValidateSerializable<typeof value, Serializable>\n    >().toEqualTypeOf<'Function is not serializable'>()\n  })\n\n  it('works for types extending TsrSerializable', () => {\n    type MyCustomType = { f: () => {} } & TsrSerializable\n    expectTypeOf<\n      ValidateSerializable<MyCustomType, Serializable>\n    >().toEqualTypeOf<MyCustomType>()\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/skip-route-on-parse-error.test.ts",
    "content": "import { describe, expect, it, vi } from 'vitest'\nimport { findRouteMatch, processRouteTree } from '../src/new-process-route-tree'\n\ndescribe('skipRouteOnParseError', () => {\n  describe('basic matching with parse validation', () => {\n    it('matches route when parse succeeds', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$id',\n            fullPath: '/$id',\n            path: '$id',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => ({\n                  id: parseInt(params.id!, 10),\n                }),\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      const result = findRouteMatch('/123', processedTree)\n      expect(result?.route.id).toBe('/$id')\n      // params contains raw string values for interpolatePath\n      expect(result?.rawParams).toEqual({ id: '123' })\n      // parsedParams contains the transformed values from parse\n      expect(result?.parsedParams).toEqual({ id: 123 })\n    })\n\n    it('skips route when parse throws and finds no alternative', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$id',\n            fullPath: '/$id',\n            path: '$id',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const num = parseInt(params.id!, 10)\n                  if (isNaN(num)) throw new Error('Not a number')\n                  return { id: num }\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      const result = findRouteMatch('/abc', processedTree)\n      expect(result).toBeNull()\n    })\n\n    it('skips route when parse throws and finds alternative match', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$id',\n            fullPath: '/$id',\n            path: '$id',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const num = parseInt(params.id!, 10)\n                  if (isNaN(num)) throw new Error('Not a number')\n                  return { id: num }\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/$slug',\n            fullPath: '/$slug',\n            path: '$slug',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      // numeric should match the validated route\n      const numericResult = findRouteMatch('/123', processedTree)\n      expect(numericResult?.route.id).toBe('/$id')\n      // params contains raw string values for interpolatePath\n      expect(numericResult?.rawParams).toEqual({ id: '123' })\n      // parsedParams contains the transformed values from parse\n      expect(numericResult?.parsedParams).toEqual({ id: 123 })\n\n      // non-numeric should fall through to the non-validated route\n      const slugResult = findRouteMatch('/hello-world', processedTree)\n      expect(slugResult?.route.id).toBe('/$slug')\n      expect(slugResult?.rawParams).toEqual({ slug: 'hello-world' })\n    })\n  })\n\n  describe('priority: validated routes take precedence', () => {\n    it('validated dynamic route has priority over non-validated dynamic route', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$slug',\n            fullPath: '/$slug',\n            path: '$slug',\n            options: {},\n          },\n          {\n            id: '/$id',\n            fullPath: '/$id',\n            path: '$id',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const num = parseInt(params.id!, 10)\n                  if (isNaN(num)) throw new Error('Not a number')\n                  return { id: num }\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      // validated route should be tried first\n      const numericResult = findRouteMatch('/123', processedTree)\n      expect(numericResult?.route.id).toBe('/$id')\n    })\n\n    it('static route still has priority over validated dynamic route', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/settings',\n            fullPath: '/settings',\n            path: 'settings',\n            options: {},\n          },\n          {\n            id: '/$id',\n            fullPath: '/$id',\n            path: '$id',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const num = parseInt(params.id!, 10)\n                  if (isNaN(num)) throw new Error('Not a number')\n                  return { id: num }\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      const result = findRouteMatch('/settings', processedTree)\n      expect(result?.route.id).toBe('/settings')\n    })\n\n    it('deep validated route can still fallback to sibling', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        children: [\n          {\n            id: '/$a/$b/$c',\n            fullPath: '/$a/$b/$c',\n            path: '$a/$b/$c',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  // if (params.a !== 'one') throw new Error('Invalid a')\n                  // if (params.b !== 'two') throw new Error('Invalid b')\n                  if (params.c !== 'three') throw new Error('Invalid c')\n                  return params\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/$x/$y/$z',\n            fullPath: '/$x/$y/$z',\n            path: '$x/$y/$z',\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      {\n        const result = findRouteMatch('/one/two/three', processedTree)\n        expect(result?.route.id).toBe('/$a/$b/$c')\n      }\n      {\n        const result = findRouteMatch('/one/two/wrong', processedTree)\n        expect(result?.route.id).toBe('/$x/$y/$z')\n      }\n    })\n  })\n\n  describe('regex-like validation patterns', () => {\n    it('uuid validation pattern', () => {\n      const uuidRegex =\n        /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$uuid',\n            fullPath: '/$uuid',\n            path: '$uuid',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  if (!uuidRegex.test(params.uuid!))\n                    throw new Error('Not a UUID')\n                  return params\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/$slug',\n            fullPath: '/$slug',\n            path: '$slug',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      const uuidResult = findRouteMatch(\n        '/550e8400-e29b-41d4-a716-446655440000',\n        processedTree,\n      )\n      expect(uuidResult?.route.id).toBe('/$uuid')\n\n      const slugResult = findRouteMatch('/my-blog-post', processedTree)\n      expect(slugResult?.route.id).toBe('/$slug')\n    })\n\n    it('date validation pattern (YYYY-MM-DD)', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/posts/$date',\n            fullPath: '/posts/$date',\n            path: 'posts/$date',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const date = new Date(params.date!)\n                  if (date.toString() === 'Invalid Date')\n                    throw new Error('Not a date')\n                  return { date }\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/posts/$slug',\n            fullPath: '/posts/$slug',\n            path: 'posts/$slug',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      const dateResult = findRouteMatch('/posts/2024-01-15', processedTree)\n      expect(dateResult?.route.id).toBe('/posts/$date')\n      // params contains raw string values for interpolatePath\n      expect(dateResult?.rawParams.date).toBe('2024-01-15')\n      // parsedParams contains the transformed values from parse\n      expect(dateResult?.parsedParams?.date).toBeInstanceOf(Date)\n\n      const slugResult = findRouteMatch('/posts/my-first-post', processedTree)\n      expect(slugResult?.route.id).toBe('/posts/$slug')\n    })\n  })\n\n  describe('nested routes with skipRouteOnParseError', () => {\n    it('parent validation failure prevents child matching', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$orgId',\n            fullPath: '/$orgId',\n            path: '$orgId',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const num = parseInt(params.orgId!, 10)\n                  if (isNaN(num)) throw new Error('Not a number')\n                  return { orgId: num }\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n            children: [\n              {\n                id: '/$orgId/settings',\n                fullPath: '/$orgId/settings',\n                path: 'settings',\n                options: {},\n              },\n            ],\n          },\n          {\n            id: '/$slug/about',\n            fullPath: '/$slug/about',\n            path: '$slug/about',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      // numeric org should match the validated route\n      const numericResult = findRouteMatch('/123/settings', processedTree)\n      expect(numericResult?.route.id).toBe('/$orgId/settings')\n\n      // non-numeric should not match /$orgId/settings, should match /$slug/about\n      const slugResult = findRouteMatch('/my-org/about', processedTree)\n      expect(slugResult?.route.id).toBe('/$slug/about')\n    })\n\n    it('child validation failure falls back to sibling', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/users',\n            fullPath: '/users',\n            path: 'users',\n            options: {},\n            children: [\n              {\n                id: '/users/$userId',\n                fullPath: '/users/$userId',\n                path: '$userId',\n                options: {\n                  params: {\n                    parse: (params: Record<string, string>) => {\n                      const num = parseInt(params.userId!, 10)\n                      if (isNaN(num)) throw new Error('Not a number')\n                      return { userId: num }\n                    },\n                  },\n                  skipRouteOnParseError: { params: true },\n                },\n              },\n              {\n                id: '/users/$username',\n                fullPath: '/users/$username',\n                path: '$username',\n                options: {},\n              },\n            ],\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      const numericResult = findRouteMatch('/users/42', processedTree)\n      expect(numericResult?.route.id).toBe('/users/$userId')\n      // params contains raw string values for interpolatePath\n      expect(numericResult?.rawParams).toEqual({ userId: '42' })\n      // parsedParams contains the transformed values from parse\n      expect(numericResult?.parsedParams).toEqual({ userId: 42 })\n\n      const usernameResult = findRouteMatch('/users/johndoe', processedTree)\n      expect(usernameResult?.route.id).toBe('/users/$username')\n      // Non-validated route: params are raw strings, parsedParams is undefined\n      expect(usernameResult?.rawParams).toEqual({ username: 'johndoe' })\n      expect(usernameResult?.parsedParams).toBeUndefined()\n    })\n  })\n\n  describe('pathless routes with skipRouteOnParseError', () => {\n    // Pathless layouts with skipRouteOnParseError should gate their children\n    it('pathless layout with validation gates children', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/',\n            fullPath: '/',\n            path: '/',\n            options: {},\n          },\n          {\n            id: '/$foo/_layout',\n            fullPath: '/$foo',\n            path: '$foo',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const num = parseInt(params.foo!, 10)\n                  if (isNaN(num)) throw new Error('Not a number')\n                  return { foo: num }\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n            children: [\n              {\n                id: '/$foo/_layout/bar',\n                fullPath: '/$foo/bar',\n                path: 'bar',\n                options: {},\n              },\n              {\n                id: '/$foo/_layout/',\n                fullPath: '/$foo/',\n                path: '/',\n                options: {},\n              },\n            ],\n          },\n          {\n            id: '/$foo/hello',\n            fullPath: '/$foo/hello',\n            path: '$foo/hello',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      // numeric foo should match through the validated layout\n      const numericBarResult = findRouteMatch('/123/bar', processedTree)\n      expect(numericBarResult?.route.id).toBe('/$foo/_layout/bar')\n\n      const numericIndexResult = findRouteMatch('/123', processedTree)\n      expect(numericIndexResult?.route.id).toBe('/$foo/_layout/')\n      expect(numericIndexResult?.rawParams).toEqual({ foo: '123' })\n      expect(numericIndexResult?.parsedParams).toEqual({ foo: 123 })\n\n      // non-numeric foo should fall through to the non-validated route\n      const helloResult = findRouteMatch('/abc/hello', processedTree)\n      expect(helloResult?.route.id).toBe('/$foo/hello')\n      expect(helloResult?.rawParams).toEqual({ foo: 'abc' })\n\n      // non-numeric foo should NOT match the children of the validated layout\n      const barResult = findRouteMatch('/abc/bar', processedTree)\n      expect(barResult).toBeNull()\n    })\n  })\n\n  describe('optional params with skipRouteOnParseError', () => {\n    it('optional param with static fallback', () => {\n      // Optional param with validation, with a static fallback\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/{-$lang}/home',\n            fullPath: '/{-$lang}/home',\n            path: '{-$lang}/home',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const validLangs = ['en', 'es', 'fr', 'de']\n                  if (params.lang && !validLangs.includes(params.lang)) {\n                    throw new Error('Invalid language')\n                  }\n                  return params\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/home',\n            fullPath: '/home',\n            path: 'home',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      // valid language should match the validated route\n      const enResult = findRouteMatch('/en/home', processedTree)\n      expect(enResult?.route.id).toBe('/{-$lang}/home')\n      expect(enResult?.parsedParams).toEqual({ lang: 'en' })\n\n      // root path + home - both routes can match\n      // The optional route (with skipped param) has greater depth, so it wins\n      // This is the expected behavior per the priority system\n      const rootResult = findRouteMatch('/home', processedTree)\n      expect(rootResult?.route.id).toBe('/{-$lang}/home')\n\n      // invalid language should NOT match the validated optional route\n      // and since there's no dynamic fallback, it should return null\n      const invalidResult = findRouteMatch('/it/home', processedTree)\n      expect(invalidResult).toBeNull()\n    })\n\n    it('optional param at root with validation', () => {\n      // Optional param that validates and allows skipping\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/{-$lang}',\n            fullPath: '/{-$lang}',\n            path: '{-$lang}',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const validLangs = ['en', 'es', 'fr', 'de']\n                  if (params.lang && !validLangs.includes(params.lang)) {\n                    throw new Error('Invalid language')\n                  }\n                  return params\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      // valid language should match\n      const enResult = findRouteMatch('/en', processedTree)\n      expect(enResult?.route.id).toBe('/{-$lang}')\n      expect(enResult?.parsedParams).toEqual({ lang: 'en' })\n\n      // root path should match (optional skipped)\n      const rootResult = findRouteMatch('/', processedTree)\n      expect(rootResult?.route.id).toBe('/{-$lang}')\n      expect(rootResult?.parsedParams).toEqual({})\n\n      // invalid language should NOT match (no fallback route)\n      const invalidResult = findRouteMatch('/about', processedTree)\n      expect(invalidResult).toBeNull()\n    })\n  })\n\n  describe('wildcard routes with skipRouteOnParseError', () => {\n    it('wildcard with validation', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/files/$',\n            fullPath: '/files/$',\n            path: 'files/$',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  if (params._splat!.includes('..')) {\n                    throw new Error('Upward navigation not allowed')\n                  }\n                  return params\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/files',\n            fullPath: '/files',\n            path: 'files',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      // path should match the validated wildcard route\n      const txtResult = findRouteMatch('/files/docs/readme.txt', processedTree)\n      expect(txtResult?.route.id).toBe('/files/$')\n\n      // path with upward navigation should fall through to the static /files route\n      const otherResult = findRouteMatch(\n        '/files/../../secret/photo.jpg',\n        processedTree,\n        true,\n      )\n      expect(otherResult?.route.id).toBe('/files')\n      expect(otherResult?.rawParams['**']).toBe('../../secret/photo.jpg')\n    })\n    it('index parse failure does not block wildcard sibling', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/a/',\n            fullPath: '/a/',\n            path: 'a/',\n            options: {\n              params: {\n                parse: () => {\n                  throw new Error('Invalid index')\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/a/$',\n            fullPath: '/a/$',\n            path: 'a/$',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      const result = findRouteMatch('/a', processedTree)\n      expect(result?.route.id).toBe('/a/$')\n      expect(result?.rawParams).toEqual({ '*': '', _splat: '' })\n    })\n  })\n\n  describe('multiple validated routes competing', () => {\n    it('first matching validated route wins', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$uuid',\n            fullPath: '/$uuid',\n            path: '$uuid',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const uuidRegex =\n                    /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\n                  if (!uuidRegex.test(params.uuid!))\n                    throw new Error('Not a UUID')\n                  return params\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/$number',\n            fullPath: '/$number',\n            path: '$number',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => {\n                  const num = parseInt(params.number!, 10)\n                  if (isNaN(num)) throw new Error('Not a number')\n                  return { number: num }\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/$slug',\n            fullPath: '/$slug',\n            path: '$slug',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n\n      const uuidResult = findRouteMatch(\n        '/550e8400-e29b-41d4-a716-446655440000',\n        processedTree,\n      )\n      expect(uuidResult?.route.id).toBe('/$uuid')\n\n      const numberResult = findRouteMatch('/42', processedTree)\n      expect(numberResult?.route.id).toBe('/$number')\n      // params contains raw string values for interpolatePath\n      expect(numberResult?.rawParams).toEqual({ number: '42' })\n      // parsedParams contains the transformed values from parse\n      expect(numberResult?.parsedParams).toEqual({ number: 42 })\n\n      const slugResult = findRouteMatch('/hello-world', processedTree)\n      expect(slugResult?.route.id).toBe('/$slug')\n    })\n    it('priority option can be used to influence order', () => {\n      const alphabetical = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$a',\n            fullPath: '/$a',\n            path: '$a',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => params,\n              },\n              skipRouteOnParseError: {\n                params: true,\n                priority: 1, // higher priority than /$z\n              },\n            },\n          },\n          {\n            id: '/$z',\n            fullPath: '/$z',\n            path: '$z',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => params,\n              },\n              skipRouteOnParseError: {\n                params: true,\n                priority: -1, // lower priority than /$a\n              },\n            },\n          },\n        ],\n      }\n      {\n        const { processedTree } = processRouteTree(alphabetical)\n        const result = findRouteMatch('/123', processedTree)\n        expect(result?.route.id).toBe('/$a')\n      }\n      const reverse = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$a',\n            fullPath: '/$a',\n            path: '$a',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => params,\n              },\n              skipRouteOnParseError: {\n                params: true,\n                priority: -1, // lower priority than /$z\n              },\n            },\n          },\n          {\n            id: '/$z',\n            fullPath: '/$z',\n            path: '$z',\n            options: {\n              params: {\n                parse: (params: Record<string, string>) => params,\n              },\n              skipRouteOnParseError: {\n                params: true,\n                priority: 1, // higher priority than /$a\n              },\n            },\n          },\n        ],\n      }\n      {\n        const { processedTree } = processRouteTree(reverse)\n        const result = findRouteMatch('/123', processedTree)\n        expect(result?.route.id).toBe('/$z')\n      }\n    })\n  })\n\n  describe('params.parse without skipRouteOnParseError', () => {\n    it('params.parse is NOT called during matching when skipRouteOnParseError is false', () => {\n      const parse = vi.fn()\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$id',\n            fullPath: '/$id',\n            path: '$id',\n            options: {\n              params: { parse },\n              // skipRouteOnParseError is NOT set\n            },\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      const result = findRouteMatch('/123', processedTree)\n      expect(result?.route.id).toBe('/$id')\n      // parse should NOT be called during matching\n      expect(parse).not.toHaveBeenCalled()\n      // params should be raw strings\n      expect(result?.rawParams).toEqual({ id: '123' })\n    })\n  })\n\n  describe('edge cases', () => {\n    it('validation error type does not matter', () => {\n      const tree = {\n        id: '__root__',\n        isRoot: true,\n        fullPath: '/',\n        path: '/',\n        children: [\n          {\n            id: '/$id',\n            fullPath: '/$id',\n            path: '$id',\n            options: {\n              params: {\n                parse: () => {\n                  throw 'string error' // not an Error object\n                },\n              },\n              skipRouteOnParseError: { params: true },\n            },\n          },\n          {\n            id: '/$fallback',\n            fullPath: '/$fallback',\n            path: '$fallback',\n            options: {},\n          },\n        ],\n      }\n      const { processedTree } = processRouteTree(tree)\n      const result = findRouteMatch('/test', processedTree)\n      expect(result?.route.id).toBe('/$fallback')\n    })\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/ssr-match-id.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport { dehydrateSsrMatchId, hydrateSsrMatchId } from '../src/ssr/ssr-match-id'\n\ndescribe('ssr match id codec', () => {\n  it('removes forward slashes in dehydrated ids', () => {\n    const dehydratedId = dehydrateSsrMatchId(\n      '/$orgId/projects/$projectId//acme/projects/dashboard/{}',\n    )\n\n    expect(dehydratedId).not.toContain('/')\n    expect(hydrateSsrMatchId(dehydratedId)).toBe(\n      '/$orgId/projects/$projectId//acme/projects/dashboard/{}',\n    )\n  })\n\n  it('leaves ids without slashes unchanged', () => {\n    const id = 'plain-id'\n\n    expect(dehydrateSsrMatchId(id)).toBe(id)\n    expect(hydrateSsrMatchId(id)).toBe(id)\n  })\n\n  it('decodes browser-normalized replacement chars back to slashes', () => {\n    expect(hydrateSsrMatchId('\\uFFFDposts\\uFFFD1')).toBe('/posts/1')\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/utils.test-d.ts",
    "content": "import { describe, expectTypeOf, test } from 'vitest'\n\nimport type { PartialMergeAll } from '../src/utils'\n\ndescribe('PartialMergeAll', () => {\n  test('should be `undefined` if `TUnion` is `undefined`', () => {\n    expectTypeOf<\n      PartialMergeAll<undefined>\n    >().branded.toEqualTypeOf<undefined>()\n  })\n  test('should be `null` if `TUnion` is `null`', () => {\n    expectTypeOf<PartialMergeAll<null>>().branded.toEqualTypeOf<null>()\n  })\n\n  test('should be `undefined` if `TUnion` is `undefined | undefined`', () => {\n    expectTypeOf<\n      PartialMergeAll<undefined>\n    >().branded.toEqualTypeOf<undefined>()\n  })\n\n  test('should be `null | undefined` if `TUnion` is `null | undefined`', () => {\n    expectTypeOf<PartialMergeAll<null | undefined>>().branded.toEqualTypeOf<\n      null | undefined\n    >()\n  })\n\n  test('should be `undefined` if `TUnion` is `undefined | undefined`', () => {\n    expectTypeOf<PartialMergeAll<undefined>>().toEqualTypeOf<undefined>()\n  })\n\n  test('should merge two objects', () => {\n    expectTypeOf<\n      PartialMergeAll<{ foo: string } | { bar: number }>\n    >().branded.toEqualTypeOf<{ foo?: string } | { bar?: number }>()\n  })\n\n  test('should merge undefined and an object', () => {\n    expectTypeOf<PartialMergeAll<undefined | { bar: number }>>().toEqualTypeOf<\n      undefined | { bar?: number }\n    >()\n  })\n\n  test('should merge undefined and two objects', () => {\n    expectTypeOf<\n      PartialMergeAll<undefined | { bar: number } | { foo: string }>\n    >().toEqualTypeOf<undefined | { bar?: number; foo?: string }>()\n  })\n\n  test('should merge undefined and two objects with same prop', () => {\n    expectTypeOf<\n      PartialMergeAll<undefined | { bar: number } | { bar: string }>\n    >().toEqualTypeOf<undefined | { bar?: number | string }>()\n  })\n\n  test('should merge object and empty object', () => {\n    expectTypeOf<PartialMergeAll<{ foo: string } | {}>>().toEqualTypeOf<{\n      foo?: string\n    }>()\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tests/utils.test.ts",
    "content": "import { afterEach, describe, expect, it } from 'vitest'\nimport {\n  decodePath,\n  deepEqual,\n  encodePathLikeUrl,\n  escapeHtml,\n  isPlainArray,\n  replaceEqualDeep,\n} from '../src/utils'\n\ndescribe('replaceEqualDeep', () => {\n  it('should return the same object if the input objects are equal', () => {\n    const obj = { a: 1, b: 2 }\n    const result = replaceEqualDeep(obj, obj)\n    expect(result).toBe(obj)\n  })\n\n  it('should return a new object with replaced values if the input objects are not equal', () => {\n    const obj1 = { a: 1, b: 2 }\n    const obj2 = { a: 1, b: 3 }\n    const result = replaceEqualDeep(obj1, obj2)\n    expect(result).toStrictEqual(obj2)\n  })\n\n  it('should handle arrays correctly', () => {\n    const arr1 = [1, 2, 3]\n    const arr2 = [1, 2, 4]\n    const result = replaceEqualDeep(arr1, arr2)\n    expect(result).toStrictEqual(arr2)\n  })\n\n  it('should handle nested objects correctly', () => {\n    const obj1 = { a: 1, b: { c: 2 } }\n    const obj2 = { a: 1, b: { c: 3 } }\n    const result = replaceEqualDeep(obj1, obj2)\n    expect(result).toStrictEqual(obj2)\n  })\n\n  describe('symbol properties', () => {\n    it('should look at symbol properties in the object comparison', () => {\n      const propertyKey = Symbol('property')\n      const obj1 = { a: 1, [propertyKey]: 2 }\n      const obj2 = { a: 1, [propertyKey]: 3 }\n      const result = replaceEqualDeep(obj1, obj2)\n      expect(result).toStrictEqual(obj2)\n    })\n\n    it('should copy over symbol properties when creating a new object', () => {\n      const propertyKey = Symbol('property')\n      const obj1 = { a: 1, [propertyKey]: 2 }\n      const obj2 = { a: 3, [propertyKey]: 2 }\n      const result = replaceEqualDeep(obj1, obj2)\n      expect(result).toStrictEqual(obj2)\n    })\n  })\n\n  describe('non-enumerable properties', () => {\n    it('should treat objects with non-enumerable properties as non-plain (no need for property comparisons)', () => {\n      const obj1: { a: number; b?: number } = { a: 1 }\n      Object.defineProperty(obj1, 'b', { enumerable: false, value: 2 })\n      const obj2: { a: number; b?: number } = { a: 1 }\n      Object.defineProperty(obj2, 'b', { enumerable: false, value: 3 })\n      const result = replaceEqualDeep(obj1, obj2)\n      expect(result).toBe(obj2)\n    })\n\n    it(\"should treat objects with non-enumerable properties as non-plain (copying doesn't happen)\", () => {\n      const obj1: { a: number; b?: number } = { a: 1 }\n      Object.defineProperty(obj1, 'b', { enumerable: false, value: 2 })\n      const obj2: { a: number; b?: number } = { a: 3 }\n      Object.defineProperty(obj2, 'b', { enumerable: false, value: 2 })\n      const result = replaceEqualDeep(obj1, obj2)\n      expect(result).toBe(obj2)\n    })\n  })\n\n  it('should properly handle non-existent keys', () => {\n    const obj1 = { a: 2, c: 123 }\n    const obj2 = { a: 2, c: 123, b: undefined }\n    const result = replaceEqualDeep(obj1, obj2)\n    expect(result).toStrictEqual(obj2)\n  })\n\n  it('should correctly handle non-existent keys with the same number of fields', () => {\n    const obj1 = { a: 2, c: 123 }\n    const obj2 = { a: 2, b: undefined }\n    const result = replaceEqualDeep(obj1, obj2)\n    expect(result).toStrictEqual(obj2)\n  })\n\n  it('should return the previous value when the next value is an equal primitive', () => {\n    expect(replaceEqualDeep(1, 1)).toBe(1)\n    expect(replaceEqualDeep('1', '1')).toBe('1')\n    expect(replaceEqualDeep(true, true)).toBe(true)\n    expect(replaceEqualDeep(false, false)).toBe(false)\n    expect(replaceEqualDeep(null, null)).toBe(null)\n    expect(replaceEqualDeep(undefined, undefined)).toBe(undefined)\n  })\n  it('should return the next value when the previous value is a different value', () => {\n    const date1 = new Date()\n    const date2 = new Date()\n    expect(replaceEqualDeep(1, 0)).toBe(0)\n    expect(replaceEqualDeep(1, 2)).toBe(2)\n    expect(replaceEqualDeep('1', '2')).toBe('2')\n    expect(replaceEqualDeep(true, false)).toBe(false)\n    expect(replaceEqualDeep(false, true)).toBe(true)\n    expect(replaceEqualDeep(date1, date2)).toBe(date2)\n  })\n\n  it('should return the next value when the previous value is a different type', () => {\n    const array = [1]\n    const object = { a: 'a' }\n    expect(replaceEqualDeep(0, undefined)).toBe(undefined)\n    expect(replaceEqualDeep(undefined, 0)).toBe(0)\n    expect(replaceEqualDeep(2, undefined)).toBe(undefined)\n    expect(replaceEqualDeep(undefined, 2)).toBe(2)\n    expect(replaceEqualDeep(undefined, null)).toBe(null)\n    expect(replaceEqualDeep(null, undefined)).toBe(undefined)\n    expect(replaceEqualDeep({}, undefined)).toBe(undefined)\n    expect(replaceEqualDeep([], undefined)).toBe(undefined)\n    expect(replaceEqualDeep(array, object)).toBe(object)\n    expect(replaceEqualDeep(object, array)).toBe(array)\n  })\n\n  it('should return the previous value when the next value is an equal array', () => {\n    const prev = [1, 2]\n    const next = [1, 2]\n    expect(replaceEqualDeep(prev, next)).toBe(prev)\n  })\n\n  it('should return a copy when the previous value is a different array subset', () => {\n    const prev = [1, 2]\n    const next = [1, 2, 3]\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toEqual(next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n  })\n\n  it('should return a copy when the previous value is a different array superset', () => {\n    const prev = [1, 2, 3]\n    const next = [1, 2]\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toEqual(next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n  })\n\n  it('should return the previous value when the next value is an equal empty array', () => {\n    const prev: Array<any> = []\n    const next: Array<any> = []\n    expect(replaceEqualDeep(prev, next)).toBe(prev)\n  })\n\n  it('should return the previous value when the next value is an equal empty object', () => {\n    const prev = {}\n    const next = {}\n    expect(replaceEqualDeep(prev, next)).toBe(prev)\n  })\n\n  it('should return the previous value when the next value is an equal object', () => {\n    const prev = { a: 'a' }\n    const next = { a: 'a' }\n    expect(replaceEqualDeep(prev, next)).toBe(prev)\n  })\n\n  it('should replace different values in objects', () => {\n    const prev = { a: { b: 'b' }, c: 'c' }\n    const next = { a: { b: 'b' }, c: 'd' }\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toEqual(next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n    expect(result.a).toBe(prev.a)\n    expect(result.c).toBe(next.c)\n  })\n\n  it('should replace different values in arrays', () => {\n    const prev = [1, { a: 'a' }, { b: { b: 'b' } }, [1]] as const\n    const next = [1, { a: 'a' }, { b: { b: 'c' } }, [1]] as const\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toEqual(next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n    expect(result[0]).toBe(prev[0])\n    expect(result[1]).toBe(prev[1])\n    expect(result[2]).not.toBe(next[2])\n    expect(result[2].b.b).toBe(next[2].b.b)\n    expect(result[3]).toBe(prev[3])\n  })\n\n  it('should replace different values in arrays when the next value is a subset', () => {\n    const prev = [{ a: 'a' }, { b: 'b' }, { c: 'c' }]\n    const next = [{ a: 'a' }, { b: 'b' }]\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toEqual(next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n    expect(result[0]).toBe(prev[0])\n    expect(result[1]).toBe(prev[1])\n    expect(result[2]).toBeUndefined()\n  })\n\n  it('should replace different values in arrays when the next value is a superset', () => {\n    const prev = [{ a: 'a' }, { b: 'b' }]\n    const next = [{ a: 'a' }, { b: 'b' }, { c: 'c' }]\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toEqual(next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n    expect(result[0]).toBe(prev[0])\n    expect(result[1]).toBe(prev[1])\n    expect(result[2]).toBe(next[2])\n  })\n\n  it('should copy objects which are not arrays or objects', () => {\n    const prev = [{ a: 'a' }, { b: 'b' }, { c: 'c' }, 1]\n    const next = [{ a: 'a' }, new Map(), { c: 'c' }, 2]\n    const result = replaceEqualDeep(prev, next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n    expect(result[0]).toBe(prev[0])\n    expect(result[1]).toBe(next[1])\n    expect(result[2]).toBe(prev[2])\n    expect(result[3]).toBe(next[3])\n  })\n\n  it('should support equal objects which are not arrays or objects', () => {\n    const map = new Map()\n    const prev = [map, [1]]\n    const next = [map, [1]]\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toBe(prev)\n  })\n\n  it('should support non equal objects which are not arrays or objects', () => {\n    const map1 = new Map()\n    const map2 = new Map()\n    const prev = [map1, [1]]\n    const next = [map2, [1]]\n    const result = replaceEqualDeep(prev, next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n    expect(result[0]).toBe(next[0])\n    expect(result[1]).toBe(prev[1])\n  })\n\n  it('should support objects which are not plain arrays', () => {\n    const prev = Object.assign([1, 2], { a: { b: 'b' }, c: 'c' })\n    const next = Object.assign([1, 2], { a: { b: 'b' }, c: 'c' })\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toBe(next)\n  })\n\n  it('should replace all parent objects if some nested value changes', () => {\n    const prev = {\n      todo: { id: '1', meta: { createdAt: 0 }, state: { done: false } },\n      otherTodo: { id: '2', meta: { createdAt: 0 }, state: { done: true } },\n    }\n    const next = {\n      todo: { id: '1', meta: { createdAt: 0 }, state: { done: true } },\n      otherTodo: { id: '2', meta: { createdAt: 0 }, state: { done: true } },\n    }\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toEqual(next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n    expect(result.todo).not.toBe(prev.todo)\n    expect(result.todo).not.toBe(next.todo)\n    expect(result.todo.id).toBe(next.todo.id)\n    expect(result.todo.meta).toBe(prev.todo.meta)\n    expect(result.todo.state).not.toBe(next.todo.state)\n    expect(result.todo.state.done).toBe(next.todo.state.done)\n    expect(result.otherTodo).toBe(prev.otherTodo)\n  })\n\n  it('should replace all parent arrays if some nested value changes', () => {\n    const prev = {\n      todos: [\n        { id: '1', meta: { createdAt: 0 }, state: { done: false } },\n        { id: '2', meta: { createdAt: 0 }, state: { done: true } },\n      ],\n    }\n    const next = {\n      todos: [\n        { id: '1', meta: { createdAt: 0 }, state: { done: true } },\n        { id: '2', meta: { createdAt: 0 }, state: { done: true } },\n      ],\n    }\n    const result = replaceEqualDeep(prev, next)\n    expect(result).toEqual(next)\n    expect(result).not.toBe(prev)\n    expect(result).not.toBe(next)\n    expect(result.todos).not.toBe(prev.todos)\n    expect(result.todos).not.toBe(next.todos)\n    expect(result.todos[0]).not.toBe(prev.todos[0])\n    expect(result.todos[0]).not.toBe(next.todos[0])\n    expect(result.todos[0]?.id).toBe(next.todos[0]?.id)\n    expect(result.todos[0]?.meta).toBe(prev.todos[0]?.meta)\n    expect(result.todos[0]?.state).not.toBe(next.todos[0]?.state)\n    expect(result.todos[0]?.state.done).toBe(next.todos[0]?.state.done)\n    expect(result.todos[1]).toBe(prev.todos[1])\n  })\n\n  it('should be able to share values that contain undefined', () => {\n    const current = [\n      {\n        data: undefined,\n        foo: true,\n      },\n    ]\n\n    const next = replaceEqualDeep(current, [\n      {\n        data: undefined,\n        foo: true,\n      },\n    ])\n\n    expect(current).toBe(next)\n  })\n\n  it('should return the previous value when both values are an array of undefined', () => {\n    const current = [undefined]\n    const next = replaceEqualDeep(current, [undefined])\n\n    expect(next).toBe(current)\n  })\n\n  it('should return the previous value when both values are an array that contains undefined', () => {\n    const current = [{ foo: 1 }, undefined]\n    const next = replaceEqualDeep(current, [{ foo: 1 }, undefined])\n\n    expect(next).toBe(current)\n  })\n\n  it('works w/ null prototype objects', () => {\n    const current = Object.create(null)\n    const next = Object.create(null)\n\n    current.foo = 'bar'\n    next.foo = 'bar'\n    expect(replaceEqualDeep(current, next)).toBe(current)\n\n    next.foo = 'baz'\n    expect(replaceEqualDeep(current, next)).toEqual(next)\n  })\n})\n\ndescribe('isPlainArray', () => {\n  it('should return `true` for plain arrays', () => {\n    expect(isPlainArray([1, 2])).toEqual(true)\n  })\n\n  it('should return `false` for non plain arrays', () => {\n    expect(isPlainArray(Object.assign([1, 2], { a: 'b' }))).toEqual(false)\n  })\n})\n\ndescribe('deepEqual', () => {\n  describe.each([false, true])('partial = %s', (partial) => {\n    it('should return `true` for equal objects', () => {\n      const a = { a: { b: 'b' }, c: 'c', d: [{ d: 'd ' }] }\n      const b = { a: { b: 'b' }, c: 'c', d: [{ d: 'd ' }] }\n      expect(deepEqual(a, b, { partial })).toEqual(true)\n      expect(deepEqual(b, a, { partial })).toEqual(true)\n    })\n\n    it('should return `false` for non equal objects', () => {\n      const a = { a: { b: 'b' }, c: 'c' }\n      const b = { a: { b: 'c' }, c: 'c' }\n      expect(deepEqual(a, b, { partial })).toEqual(false)\n      expect(deepEqual(b, a, { partial })).toEqual(false)\n    })\n\n    it('should return `true` for equal objects and ignore `undefined` properties', () => {\n      const a = { a: 'a', b: undefined, c: 'c' }\n      const b = { a: 'a', c: 'c' }\n      expect(deepEqual(a, b, { partial })).toEqual(true)\n      expect(deepEqual(b, a, { partial })).toEqual(true)\n    })\n\n    it('should return `true` for equal objects and ignore `undefined` nested properties', () => {\n      const a = { a: { b: 'b', x: undefined }, c: 'c' }\n      const b = { a: { b: 'b' }, c: 'c', d: undefined }\n      expect(deepEqual(a, b, { partial })).toEqual(true)\n      expect(deepEqual(b, a, { partial })).toEqual(true)\n    })\n\n    it('should return `true` for equal arrays and ignore `undefined` object properties', () => {\n      const a = { a: { b: 'b' }, c: undefined }\n      const b = { a: { b: 'b' } }\n      expect(deepEqual([a], [b], { partial })).toEqual(true)\n      expect(deepEqual([b], [a], { partial })).toEqual(true)\n    })\n\n    it('should return `true` for equal arrays and ignore nested `undefined` object properties', () => {\n      const a = { a: { b: 'b', x: undefined }, c: 'c' }\n      const b = { a: { b: 'b' }, c: 'c' }\n      expect(deepEqual([a], [b], { partial })).toEqual(true)\n      expect(deepEqual([b], [a], { partial })).toEqual(true)\n    })\n  })\n\n  describe('ignoreUndefined = false', () => {\n    const ignoreUndefined = false\n    describe('partial = false', () => {\n      const partial = false\n      it('should return `false` for objects', () => {\n        const a = { a: { b: 'b', x: undefined }, c: 'c' }\n        const b = { a: { b: 'b' }, c: 'c', d: undefined }\n        expect(deepEqual(a, b, { partial, ignoreUndefined })).toEqual(false)\n        expect(deepEqual(b, a, { partial, ignoreUndefined })).toEqual(false)\n      })\n\n      it('should return `false` for arrays', () => {\n        const a = { a: { b: 'b', x: undefined }, c: 'c' }\n        const b = { a: { b: 'b' }, c: 'c' }\n        expect(deepEqual([a], [b], { partial, ignoreUndefined })).toEqual(false)\n        expect(deepEqual([b], [a], { partial, ignoreUndefined })).toEqual(false)\n      })\n    })\n    describe('partial = true', () => {\n      const partial = true\n      it('should return `true` for objects', () => {\n        const a = { a: { b: 'b' }, c: 'c' }\n        const b = { a: { b: 'b' }, c: 'c', d: undefined }\n        expect(deepEqual(a, b, { partial, ignoreUndefined })).toEqual(true)\n        expect(deepEqual(b, a, { partial, ignoreUndefined })).toEqual(true)\n      })\n\n      it('should return `true` for arrays', () => {\n        const a = { a: { b: 'b', x: undefined }, c: 'c' }\n        const b = { a: { b: 'b' }, c: 'c' }\n        expect(deepEqual([a], [b], { partial, ignoreUndefined })).toEqual(true)\n        expect(deepEqual([b], [a], { partial, ignoreUndefined })).toEqual(true)\n      })\n    })\n  })\n\n  describe('partial comparison', () => {\n    it('correctly compares partially equal objects', () => {\n      const a = { a: { b: 'b' }, c: 'c', d: [{ d: 'd ' }] }\n      const b = { a: { b: 'b' }, c: 'c' }\n      expect(deepEqual(a, b, { partial: true })).toEqual(true)\n      expect(deepEqual(b, a, { partial: true })).toEqual(false)\n    })\n\n    it('correctly compares partially equal objects and ignores `undefined` object properties', () => {\n      const a = { a: { b: 'b' }, c: 'c', d: [{ d: 'd ' }], e: undefined }\n      const b = { a: { b: 'b' }, c: 'c', d: undefined }\n      expect(deepEqual(a, b, { partial: true })).toEqual(true)\n      expect(deepEqual(b, a, { partial: true })).toEqual(false)\n    })\n  })\n\n  // This might not be what we want, but this test documents how things are now\n  describe('symbol and non-enumerable properties are not handled', () => {\n    it.fails(\n      'should return `false` for unequal objects with symbol properties',\n      () => {\n        const key = Symbol('foo')\n        const a = { [key]: 1 }\n        const b = { [key]: 2 }\n        expect(deepEqual(a, b)).toEqual(false)\n      },\n    )\n\n    it.fails(\n      'should return `false` for unequal objects with non-enumerable properties',\n      () => {\n        const a = {}\n        Object.defineProperty(a, 'prop', { value: 1, enumerable: false })\n        const b = {}\n        Object.defineProperty(b, 'prop', { value: 2, enumerable: false })\n        expect(deepEqual(a, b)).toEqual(false)\n      },\n    )\n  })\n\n  // We voluntarily fail in this case, because users should not do it, and ignoring it enables some performance improvements\n  describe('augmented object prototype fail case (no one should do this anyway)', () => {\n    it.fails(\n      'should not compare objects with augmented prototype properties',\n      () => {\n        // @ts-expect-error -- typescript is right to complain here, don't do this!\n        Object.prototype.x = 'x'\n        const a = { a: 1 }\n        const b = { a: 1 }\n        expect(deepEqual(a, b, { ignoreUndefined: false })).toEqual(true)\n      },\n    )\n\n    afterEach(() => {\n      // it's probably not necessary to clean this up because vitest isolates tests\n      // but just in case isolation ever gets disabled, we clean the prototype to avoid disturbing other tests\n      // @ts-expect-error\n      delete Object.prototype.x\n    })\n  })\n})\n\ndescribe('decodePath', () => {\n  it('should decode a path segment, ignoring `%` and `\\\\` by default, with multiple ignored items existing', () => {\n    const stringToCheck =\n      'https://mozilla.org/?x=%25%D1%88%D0%B5%5C%D0%BB%D0%BB%D1%8B%2F'\n    const expectedResult = 'https://mozilla.org/?x=%25ше%5Cллы%2F'\n\n    const result = decodePath(stringToCheck).path\n\n    expect(result).toBe(expectedResult)\n  })\n\n  it('should handle malformed percent-encodings gracefully', () => {\n    const stringToCheck = 'path%ZZ%D1%88test%5C%C3%A9'\n    // Malformed sequences should remain as-is, valid ones decoded\n    const result = decodePath(stringToCheck).path\n    expect(result).toBe(`path%ZZ%D1%88test%5Cé`)\n  })\n\n  it('should return empty string unchanged', () => {\n    expect(decodePath('').path).toBe('')\n  })\n\n  it('should return strings without encoding unchanged', () => {\n    const stringToCheck = 'plain-text-path'\n    expect(decodePath(stringToCheck).path).toBe(stringToCheck)\n  })\n\n  it('should handle consecutive ignored characters', () => {\n    const stringToCheck = 'test%25%25end'\n    const expectedResult = 'test%25%25end'\n    expect(decodePath(stringToCheck).path).toBe(expectedResult)\n  })\n\n  it('should handle multiple ignored items of the same type with varying case', () => {\n    const stringToCheck = '/params-ps/named/foo%2Fabc/c%2Fh'\n    const expectedResult = '/params-ps/named/foo%2Fabc/c%2Fh'\n    expect(decodePath(stringToCheck).path).toBe(expectedResult)\n\n    const stringToCheckWithLowerCase = '/params-ps/named/foo%2Fabc/c%5C%2f%5cAh'\n    const expectedResultWithLowerCase =\n      '/params-ps/named/foo%2Fabc/c%5C%2f%5cAh'\n    expect(decodePath(stringToCheckWithLowerCase).path).toBe(\n      expectedResultWithLowerCase,\n    )\n  })\n\n  describe('open redirect prevention', () => {\n    it('should strip CR (%0d) to prevent open redirect', () => {\n      // /%0d/google.com/ decodes to /\\r/google.com/ which becomes //google.com/\n      // This must be sanitized to prevent protocol-relative URL interpretation\n      const result = decodePath('/%0d/google.com/')\n      expect(result.path).toBe('/google.com/')\n      expect(result.path).not.toMatch(/^\\/\\//)\n      expect(result.handledProtocolRelativeURL).toBe(true)\n    })\n\n    it('should strip LF (%0a) to prevent open redirect', () => {\n      const result = decodePath('/%0a/evil.com/')\n      expect(result.path).toBe('/evil.com/')\n      expect(result.path).not.toMatch(/^\\/\\//)\n      expect(result.handledProtocolRelativeURL).toBe(true)\n    })\n\n    it('should strip CRLF (%0d%0a) to prevent open redirect', () => {\n      const result = decodePath('/%0d%0a/evil.com/')\n      expect(result.path).toBe('/evil.com/')\n      expect(result.path).not.toMatch(/^\\/\\//)\n      expect(result.handledProtocolRelativeURL).toBe(true)\n    })\n\n    it('should strip multiple control characters to prevent open redirect', () => {\n      const result = decodePath('/%0d%0d%0d/evil.com/')\n      expect(result.path).toBe('/evil.com/')\n      expect(result.path).not.toMatch(/^\\/\\//)\n      expect(result.handledProtocolRelativeURL).toBe(true)\n    })\n\n    it('should strip null bytes and other control characters', () => {\n      const result = decodePath('/%00/test/')\n      expect(result.path).toBe('/test/')\n      expect(result.handledProtocolRelativeURL).toBe(true)\n    })\n\n    it('should collapse leading double slashes to prevent protocol-relative URLs', () => {\n      // After stripping control chars, ensure we don't end up with //evil.com\n      const result = decodePath('/%0d%0a/evil.com/path')\n      // Should resolve to localhost, not evil.com\n      const url = new URL(result.path, 'http://localhost:3000')\n      expect(url.origin).toBe('http://localhost:3000')\n      expect(result.handledProtocolRelativeURL).toBe(true)\n    })\n\n    it('should handle normal paths unchanged', () => {\n      expect(decodePath('/users/profile/').path).toBe('/users/profile/')\n      expect(decodePath('/users/profile/').handledProtocolRelativeURL).toBe(\n        false,\n      )\n      expect(decodePath('/api/v1/data').path).toBe('/api/v1/data')\n      expect(decodePath('/api/v1/data').handledProtocolRelativeURL).toBe(false)\n    })\n\n    it('should handle double slash only input', () => {\n      // Direct // input should also be collapsed\n      const result = decodePath('//')\n      expect(result.path).toBe('/')\n      expect(result.handledProtocolRelativeURL).toBe(true)\n    })\n  })\n})\n\n/**\n * Tests for getEnumerableOwnKeys behavior (internal function).\n * Tested indirectly through replaceEqualDeep since getEnumerableOwnKeys is not exported.\n *\n * getEnumerableOwnKeys should:\n * 1. Return array of all enumerable own keys (strings + symbols)\n * 2. Return false if any property is non-enumerable\n * 3. Handle objects with no symbols efficiently (optimization target)\n */\ndescribe('getEnumerableOwnKeys behavior (via replaceEqualDeep)', () => {\n  describe('plain objects with string keys only', () => {\n    it('should handle empty objects', () => {\n      const prev = {}\n      const next = {}\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should handle objects with single key', () => {\n      const prev = { a: 1 }\n      const next = { a: 1 }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should handle objects with many keys', () => {\n      const prev = {\n        a: 1,\n        b: 2,\n        c: 3,\n        d: 4,\n        e: 5,\n        f: 6,\n        g: 7,\n        h: 8,\n        i: 9,\n        j: 10,\n      }\n      const next = {\n        a: 1,\n        b: 2,\n        c: 3,\n        d: 4,\n        e: 5,\n        f: 6,\n        g: 7,\n        h: 8,\n        i: 9,\n        j: 10,\n      }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should handle objects with numeric string keys', () => {\n      const prev = { '0': 'a', '1': 'b', '2': 'c' }\n      const next = { '0': 'a', '1': 'b', '2': 'c' }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should handle objects with special string keys', () => {\n      const prev = {\n        'key-with-dash': 1,\n        'key.with.dot': 2,\n        'key with space': 3,\n      }\n      const next = {\n        'key-with-dash': 1,\n        'key.with.dot': 2,\n        'key with space': 3,\n      }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should detect differences in objects with string keys', () => {\n      const prev = { a: 1, b: 2, c: 3 }\n      const next = { a: 1, b: 99, c: 3 }\n      const result = replaceEqualDeep(prev, next)\n      expect(result).not.toBe(prev)\n      expect(result).toEqual(next)\n    })\n  })\n\n  describe('objects with symbol keys', () => {\n    it('should handle objects with single symbol key', () => {\n      const sym = Symbol('test')\n      const prev = { [sym]: 1 }\n      const next = { [sym]: 1 }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should handle objects with multiple symbol keys', () => {\n      const sym1 = Symbol('a')\n      const sym2 = Symbol('b')\n      const sym3 = Symbol('c')\n      const prev = { [sym1]: 1, [sym2]: 2, [sym3]: 3 }\n      const next = { [sym1]: 1, [sym2]: 2, [sym3]: 3 }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should detect differences in symbol values', () => {\n      const sym = Symbol('test')\n      const prev = { [sym]: 1 }\n      const next = { [sym]: 2 }\n      const result = replaceEqualDeep(prev, next)\n      expect(result).not.toBe(prev)\n      expect(result[sym]).toBe(2)\n    })\n\n    it('should handle global symbols', () => {\n      const sym = Symbol.for('global.test.key')\n      const prev = { [sym]: 'value' }\n      const next = { [sym]: 'value' }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n  })\n\n  describe('objects with mixed string and symbol keys', () => {\n    it('should handle objects with both string and symbol keys', () => {\n      const sym = Symbol('test')\n      const prev = { a: 1, b: 2, [sym]: 3 }\n      const next = { a: 1, b: 2, [sym]: 3 }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should detect differences in string keys when symbols present', () => {\n      const sym = Symbol('test')\n      const prev = { a: 1, b: 2, [sym]: 3 }\n      const next = { a: 1, b: 99, [sym]: 3 }\n      const result = replaceEqualDeep(prev, next)\n      expect(result).not.toBe(prev)\n      expect(result.b).toBe(99)\n      expect(result[sym]).toBe(3)\n    })\n\n    it('should detect differences in symbol keys when strings present', () => {\n      const sym = Symbol('test')\n      const prev = { a: 1, b: 2, [sym]: 3 }\n      const next = { a: 1, b: 2, [sym]: 99 }\n      const result = replaceEqualDeep(prev, next)\n      expect(result).not.toBe(prev)\n      expect(result.a).toBe(1)\n      expect(result[sym]).toBe(99)\n    })\n\n    it('should handle complex nested objects with symbols', () => {\n      const sym = Symbol('nested')\n      const prev = { outer: { inner: 1, [sym]: { deep: 'value' } } }\n      const next = { outer: { inner: 1, [sym]: { deep: 'value' } } }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n  })\n\n  describe('non-enumerable properties', () => {\n    it('should treat objects with non-enumerable string property as non-plain', () => {\n      const prev: Record<string, number> = { a: 1 }\n      Object.defineProperty(prev, 'hidden', { value: 2, enumerable: false })\n      const next: Record<string, number> = { a: 1 }\n      Object.defineProperty(next, 'hidden', { value: 2, enumerable: false })\n\n      // Non-plain objects should return next, not prev (no structural sharing)\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(next)\n    })\n\n    it('should treat objects with non-enumerable symbol property as non-plain', () => {\n      const sym = Symbol('hidden')\n      const prev: Record<string | symbol, number> = { a: 1 }\n      Object.defineProperty(prev, sym, { value: 2, enumerable: false })\n      const next: Record<string | symbol, number> = { a: 1 }\n      Object.defineProperty(next, sym, { value: 2, enumerable: false })\n\n      // Non-plain objects should return next, not prev\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(next)\n    })\n\n    it('should handle mix of enumerable and non-enumerable properties', () => {\n      const prev: Record<string, number> = { visible: 1 }\n      Object.defineProperty(prev, 'hidden', { value: 2, enumerable: false })\n      const next = { visible: 1 }\n\n      // prev is non-plain (has non-enumerable), next is plain\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(next)\n    })\n\n    it('should handle non-enumerable property that shadows a string key', () => {\n      const prev = Object.create(null)\n      prev.a = 1\n      Object.defineProperty(prev, 'b', { value: 2, enumerable: false })\n\n      const next = Object.create(null)\n      next.a = 1\n      next.b = 2 // enumerable version\n\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(next)\n    })\n  })\n\n  describe('edge cases for key enumeration', () => {\n    it('should handle frozen objects as non-plain (configurable is false)', () => {\n      const prev = Object.freeze({ a: 1, b: 2 })\n      const next = Object.freeze({ a: 1, b: 2 })\n\n      // Frozen objects have all properties as non-configurable but still enumerable\n      // They should still work with replaceEqualDeep\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(prev)\n    })\n\n    it('should handle sealed objects', () => {\n      const prev = Object.seal({ a: 1, b: 2 })\n      const next = Object.seal({ a: 1, b: 2 })\n\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(prev)\n    })\n\n    it('should handle objects created with Object.create(null)', () => {\n      const prev = Object.create(null)\n      prev.a = 1\n      prev.b = 2\n\n      const next = Object.create(null)\n      next.a = 1\n      next.b = 2\n\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(prev)\n    })\n\n    it('should handle objects with inherited properties (only own props checked)', () => {\n      const proto = { inherited: 'value' }\n      const prev = Object.create(proto)\n      prev.own = 1\n\n      const next = Object.create(proto)\n      next.own = 1\n\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(prev)\n    })\n\n    it('should not be confused by Object.prototype properties', () => {\n      // Ensure hasOwnProperty, toString, etc. don't interfere\n      const prev = { hasOwnProperty: 1, toString: 2, valueOf: 3 }\n      const next = { hasOwnProperty: 1, toString: 2, valueOf: 3 }\n      const result = replaceEqualDeep(prev, next)\n      expect(result).toBe(prev)\n    })\n  })\n\n  describe('performance-critical scenarios (typical router state)', () => {\n    it('should efficiently handle typical router location object', () => {\n      const prev = {\n        pathname: '/users/123',\n        search: '?tab=settings',\n        hash: '#section',\n        state: { key: 'abc123' },\n      }\n      const next = {\n        pathname: '/users/123',\n        search: '?tab=settings',\n        hash: '#section',\n        state: { key: 'abc123' },\n      }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should efficiently handle typical router match object', () => {\n      const prev = {\n        id: 'route-1',\n        routeId: '/users/$userId',\n        pathname: '/users/123',\n        params: { userId: '123' },\n        search: {},\n        fullPath: '/users/$userId',\n        loaderData: { user: { name: 'John' } },\n      }\n      const next = {\n        id: 'route-1',\n        routeId: '/users/$userId',\n        pathname: '/users/123',\n        params: { userId: '123' },\n        search: {},\n        fullPath: '/users/$userId',\n        loaderData: { user: { name: 'John' } },\n      }\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n\n    it('should efficiently handle array of matches', () => {\n      const prev = [\n        { id: '1', routeId: '__root__', pathname: '/', params: {} },\n        { id: '2', routeId: '/users', pathname: '/users', params: {} },\n        {\n          id: '3',\n          routeId: '/users/$userId',\n          pathname: '/users/123',\n          params: { userId: '123' },\n        },\n      ]\n      const next = [\n        { id: '1', routeId: '__root__', pathname: '/', params: {} },\n        { id: '2', routeId: '/users', pathname: '/users', params: {} },\n        {\n          id: '3',\n          routeId: '/users/$userId',\n          pathname: '/users/123',\n          params: { userId: '123' },\n        },\n      ]\n      expect(replaceEqualDeep(prev, next)).toBe(prev)\n    })\n  })\n})\n\ndescribe('escapeHtml', () => {\n  it('should escape less-than sign', () => {\n    expect(escapeHtml('<')).toBe('\\\\u003c')\n  })\n\n  it('should escape greater-than sign', () => {\n    expect(escapeHtml('>')).toBe('\\\\u003e')\n  })\n\n  it('should escape ampersand', () => {\n    expect(escapeHtml('&')).toBe('\\\\u0026')\n  })\n\n  it('should escape line separator (U+2028)', () => {\n    expect(escapeHtml('\\u2028')).toBe('\\\\u2028')\n  })\n\n  it('should escape paragraph separator (U+2029)', () => {\n    expect(escapeHtml('\\u2029')).toBe('\\\\u2029')\n  })\n\n  it('should escape multiple characters', () => {\n    expect(escapeHtml('<script>alert(\"XSS\")</script>')).toBe(\n      '\\\\u003cscript\\\\u003ealert(\"XSS\")\\\\u003c/script\\\\u003e',\n    )\n  })\n\n  it('should handle script tag injection attempt in JSON', () => {\n    const maliciousKey = '</script><script>alert(\"XSS\")</script>'\n    const json = JSON.stringify({ key: maliciousKey })\n    const escaped = escapeHtml(json)\n\n    // The escaped version should not contain literal < or > characters\n    expect(escaped).not.toContain('<')\n    expect(escaped).not.toContain('>')\n\n    // The escaped version should still be valid JSON when evaluated\n    // (the escape sequences are valid in JavaScript strings)\n    expect(escaped).toContain('\\\\u003c')\n    expect(escaped).toContain('\\\\u003e')\n  })\n\n  it('should return strings without special characters unchanged', () => {\n    const safe = 'hello world 123'\n    expect(escapeHtml(safe)).toBe(safe)\n  })\n\n  it('should handle empty string', () => {\n    expect(escapeHtml('')).toBe('')\n  })\n\n  it('should handle mixed content', () => {\n    expect(escapeHtml('a<b>c&d\\u2028e\\u2029f')).toBe(\n      'a\\\\u003cb\\\\u003ec\\\\u0026d\\\\u2028e\\\\u2029f',\n    )\n  })\n})\n\ndescribe('encodePathLikeUrl', () => {\n  it('should return path unchanged if no non-ASCII characters', () => {\n    expect(encodePathLikeUrl('/foo/bar/baz')).toBe('/foo/bar/baz')\n  })\n\n  it('should encode non-ASCII characters', () => {\n    expect(encodePathLikeUrl('/path/caf\\u00e9')).toBe('/path/caf%C3%A9')\n  })\n\n  it('should encode unicode characters in path segments', () => {\n    expect(encodePathLikeUrl('/users/\\u4e2d\\u6587/profile')).toBe(\n      '/users/%E4%B8%AD%E6%96%87/profile',\n    )\n  })\n\n  it('should encode spaces but preserve other ASCII special characters', () => {\n    // encodePathLikeUrl encodes whitespace and non-ASCII, but not other ASCII special chars\n    expect(encodePathLikeUrl('/path/file name.pdf')).toBe(\n      '/path/file%20name.pdf',\n    )\n    expect(encodePathLikeUrl('/path/file[1].pdf')).toBe('/path/file[1].pdf')\n    expect(encodePathLikeUrl('/path#section')).toBe('/path#section')\n  })\n\n  it('should handle mixed ASCII and non-ASCII characters', () => {\n    expect(encodePathLikeUrl('/path/caf\\u00e9 (copy).pdf')).toBe(\n      '/path/caf%C3%A9%20(copy).pdf',\n    )\n  })\n\n  it('should handle emoji characters', () => {\n    expect(encodePathLikeUrl('/path/\\u{1F600}/file')).toBe(\n      '/path/%F0%9F%98%80/file',\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-core/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"paths\": {\n      \"@tanstack/router-core/isServer\": [\"./src/isServer/development.ts\"]\n    }\n  },\n  \"include\": [\"src\", \"vite.config.ts\", \"tests\", \"vite-minify-plugin.ts\"]\n}\n"
  },
  {
    "path": "packages/router-core/vite-minify-plugin.ts",
    "content": "import { transform as esbuildTransform } from 'esbuild'\nimport type { Plugin } from 'vite'\n\nexport default function minifyScriptPlugin(): Plugin {\n  return {\n    name: 'vite-plugin-minify-script',\n    enforce: 'pre',\n    transform: {\n      filter: { id: /\\?script-string$/ },\n      async handler(code) {\n        const result = await esbuildTransform(code, {\n          loader: 'ts',\n          minify: true,\n          target: 'esnext',\n        })\n\n        return {\n          code: `export default ${JSON.stringify(result.code)};`,\n          map: null,\n        }\n      },\n    },\n  }\n}\n"
  },
  {
    "path": "packages/router-core/vite.config.ts",
    "content": "import path from 'node:path'\nimport { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport minifyScriptPlugin from './vite-minify-plugin'\nimport packageJson from './package.json'\nimport type { ViteUserConfig } from 'vitest/config'\n\nconst config = defineConfig({\n  plugins: [minifyScriptPlugin()] as ViteUserConfig['plugins'],\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n    alias: {\n      // For tests only, resolve to development.ts which returns undefined\n      // so that router.isServer fallback is used\n      '@tanstack/router-core/isServer': path.resolve(\n        __dirname,\n        'src/isServer/development.ts',\n      ),\n    },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: [\n      './src/index.ts',\n      './src/ssr/client.ts',\n      './src/ssr/server.ts',\n      './src/isServer/server.ts',\n      './src/isServer/client.ts',\n      './src/isServer/development.ts',\n    ],\n    srcDir: './src',\n    externalDeps: ['@tanstack/router-core/isServer'],\n  }),\n)\n"
  },
  {
    "path": "packages/router-devtools/CHANGELOG.md",
    "content": "# @tanstack/router-devtools\n\n## 1.166.10\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/react-router@1.168.0\n  - @tanstack/react-router-devtools@1.166.10\n\n## 1.166.9\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/react-router@1.167.2\n  - @tanstack/react-router-devtools@1.166.9\n\n## 1.166.8\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/react-router-devtools@1.166.8\n  - @tanstack/react-router@1.167.1\n"
  },
  {
    "path": "packages/router-devtools/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack React Router Devtools\n\nSee https://tanstack.com/router/latest/docs/framework/react/devtools\n"
  },
  {
    "path": "packages/router-devtools/eslint.config.js",
    "content": "// @ts-check\n\nimport pluginReact from '@eslint-react/eslint-plugin'\n// @ts-expect-error\nimport pluginReactHooks from 'eslint-plugin-react-hooks'\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    files: ['**/*.{ts,tsx}'],\n    ...pluginReact.configs.recommended,\n  },\n  {\n    plugins: {\n      'react-hooks': pluginReactHooks,\n    },\n    rules: {\n      '@eslint-react/no-unstable-context-value': 'off',\n      '@eslint-react/no-unstable-default-props': 'off',\n      '@eslint-react/dom/no-missing-button-type': 'off',\n      'react-hooks/exhaustive-deps': 'error',\n      'react-hooks/rules-of-hooks': 'error',\n    },\n  },\n  {\n    files: ['**/__tests__/**'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/router-devtools/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-devtools\",\n  \"version\": \"1.166.10\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-devtools\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"./dist/esm/index.d.ts\",\n  \"main\": \"./dist/cjs/index.cjs\",\n  \"module\": \"./dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@tanstack/react-router-devtools\": \"workspace:*\",\n    \"clsx\": \"^2.1.1\",\n    \"goober\": \"^2.1.16\"\n  },\n  \"devDependencies\": {\n    \"@vitejs/plugin-react\": \"^4.3.4\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\",\n    \"vite\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"csstype\": \"^3.0.10\",\n    \"react\": \">=18.0.0 || >=19.0.0\",\n    \"react-dom\": \">=18.0.0 || >=19.0.0\"\n  },\n  \"peerDependenciesMeta\": {\n    \"csstype\": {\n      \"optional\": true\n    }\n  }\n}\n"
  },
  {
    "path": "packages/router-devtools/src/index.tsx",
    "content": "console.warn(\n  '[@tanstack/router-devtools] This package has moved to @tanstack/react-router-devtools. Please switch to the new package at your earliest convenience, as this package will be dropped in the next major version release.',\n)\n\nexport { TanStackRouterDevtoolsInProd as TanStackRouterDevtools } from '@tanstack/react-router-devtools'\nexport { TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'\n"
  },
  {
    "path": "packages/router-devtools/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\"\n  },\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/router-devtools/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport react from '@vitejs/plugin-react'\n\nconst config = defineConfig({\n  plugins: [react()],\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.tsx',\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/router-devtools-core/CHANGELOG.md",
    "content": "# @tanstack/router-devtools-core\n\n## 1.167.0\n\n### Minor Changes\n\n- remove pendingMatches, cachedMatches ([#6704](https://github.com/TanStack/router/pull/6704))\n  move to signal-based reactivity\n  solid uses its own native signals\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/router-core@1.168.0\n\n## 1.166.9\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/router-core@1.167.2\n\n## 1.166.8\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/router-core@1.167.1\n"
  },
  {
    "path": "packages/router-devtools-core/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack React Router Devtools\n\nSee https://tanstack.com/router/latest/docs/framework/react/devtools\n"
  },
  {
    "path": "packages/router-devtools-core/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    files: ['**/*.{ts,tsx}'],\n  },\n  {\n    plugins: {},\n    rules: {},\n  },\n  {\n    files: ['**/__tests__/**'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/router-devtools-core/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-devtools-core\",\n  \"version\": \"1.167.0\",\n  \"description\": \"Modern and scalable routing for Web applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-devtools-core\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"./dist/esm/index.d.ts\",\n  \"main\": \"./dist/cjs/index.cjs\",\n  \"module\": \"./dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"clsx\": \"^2.1.1\",\n    \"goober\": \"^2.1.16\",\n    \"tiny-invariant\": \"^1.3.3\"\n  },\n  \"devDependencies\": {\n    \"solid-js\": \"^1.9.10\",\n    \"vite\": \"*\",\n    \"vite-plugin-solid\": \"^2.11.10\"\n  },\n  \"peerDependencies\": {\n    \"@tanstack/router-core\": \"workspace:^\",\n    \"csstype\": \"^3.0.10\"\n  },\n  \"peerDependenciesMeta\": {\n    \"csstype\": {\n      \"optional\": true\n    }\n  }\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/AgeTicker.tsx",
    "content": "import { clsx as cx } from 'clsx'\nimport { useStyles } from './useStyles'\nimport type { AnyRouteMatch, AnyRouter } from '@tanstack/router-core'\nimport type { Accessor } from 'solid-js'\n\nfunction formatTime(ms: number) {\n  const units = ['s', 'min', 'h', 'd']\n  const values = [ms / 1000, ms / 60000, ms / 3600000, ms / 86400000]\n\n  let chosenUnitIndex = 0\n  for (let i = 1; i < values.length; i++) {\n    if (values[i]! < 1) break\n    chosenUnitIndex = i\n  }\n\n  const formatter = new Intl.NumberFormat(navigator.language, {\n    compactDisplay: 'short',\n    notation: 'compact',\n    maximumFractionDigits: 0,\n  })\n\n  return formatter.format(values[chosenUnitIndex]!) + units[chosenUnitIndex]\n}\n\nexport function AgeTicker({\n  match,\n  router,\n}: {\n  match?: AnyRouteMatch\n  router: Accessor<AnyRouter>\n}) {\n  const styles = useStyles()\n\n  if (!match) {\n    return null\n  }\n\n  const route = router().looseRoutesById[match.routeId]!\n\n  if (!route.options.loader) {\n    return null\n  }\n\n  const age = Date.now() - match.updatedAt\n  const staleTime =\n    route.options.staleTime ?? router().options.defaultStaleTime ?? 0\n  const gcTime =\n    route.options.gcTime ?? router().options.defaultGcTime ?? 30 * 60 * 1000\n\n  return (\n    <div class={cx(styles().ageTicker(age > staleTime))}>\n      <div>{formatTime(age)}</div>\n      <div>/</div>\n      <div>{formatTime(staleTime)}</div>\n      <div>/</div>\n      <div>{formatTime(gcTime)}</div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/BaseTanStackRouterDevtoolsPanel.tsx",
    "content": "import { clsx as cx } from 'clsx'\nimport { default as invariant } from 'tiny-invariant'\nimport { interpolatePath, rootRouteId, trimPath } from '@tanstack/router-core'\nimport {\n  For,\n  Match,\n  Show,\n  Switch,\n  createEffect,\n  createMemo,\n  createSignal,\n  onCleanup,\n  untrack,\n} from 'solid-js'\nimport { useDevtoolsOnClose } from './context'\nimport { useStyles } from './useStyles'\nimport useLocalStorage from './useLocalStorage'\nimport { Explorer } from './Explorer'\nimport { getRouteStatusColor, getStatusColor, multiSortBy } from './utils'\nimport { AgeTicker } from './AgeTicker'\n// import type { DevtoolsPanelOptions } from './TanStackRouterDevtoolsPanel'\n\nimport { NavigateButton } from './NavigateButton'\nimport type {\n  AnyContext,\n  AnyRoute,\n  AnyRouteMatch,\n  AnyRouter,\n  FileRouteTypes,\n  MakeRouteMatchUnion,\n  Route,\n  RouterState,\n} from '@tanstack/router-core'\nimport type { Accessor, JSX } from 'solid-js'\n\nexport interface BaseDevtoolsPanelOptions {\n  /**\n   * The standard React style object used to style a component with inline styles\n   */\n  style?: Accessor<JSX.CSSProperties>\n  /**\n   * The standard React class property used to style a component with classes\n   */\n  className?: Accessor<string>\n  /**\n   * A boolean variable indicating whether the panel is open or closed\n   */\n  isOpen?: boolean\n  /**\n   * A function that toggles the open and close state of the panel\n   */\n  setIsOpen?: (isOpen: boolean) => void\n  /**\n   * Handles the opening and closing the devtools panel\n   */\n  handleDragStart?: (e: any) => void\n  /**\n   * A boolean variable indicating if the \"lite\" version of the library is being used\n   */\n  router: Accessor<AnyRouter>\n  routerState: Accessor<any>\n  /**\n   * Use this to attach the devtool's styles to specific element in the DOM.\n   */\n  shadowDOMTarget?: ShadowRoot\n}\n\nconst HISTORY_LIMIT = 15\n\nfunction Logo(props: any) {\n  const { className, ...rest } = props\n  const styles = useStyles()\n  return (\n    <button {...rest} class={cx(styles().logo, className ? className() : '')}>\n      <div class={styles().tanstackLogo}>TANSTACK</div>\n      <div class={styles().routerLogo}>TanStack Router v1</div>\n    </button>\n  )\n}\n\nfunction NavigateLink(props: {\n  class?: string\n  left?: JSX.Element\n  children?: JSX.Element\n  right?: JSX.Element\n}) {\n  return (\n    <div\n      class={props.class}\n      style={{\n        display: 'flex',\n        'align-items': 'center',\n        width: '100%',\n      }}\n    >\n      {props.left}\n      <div style={{ 'flex-grow': 1, 'min-width': 0 }}>{props.children}</div>\n      {props.right}\n    </div>\n  )\n}\n\nfunction RouteComp({\n  routerState,\n  pendingMatches,\n  router,\n  route,\n  isRoot,\n  activeId,\n  setActiveId,\n}: {\n  routerState: Accessor<\n    RouterState<\n      Route<\n        any,\n        any,\n        any,\n        '/',\n        '/',\n        string,\n        '__root__',\n        undefined,\n        {},\n        {},\n        AnyContext,\n        AnyContext,\n        {},\n        undefined,\n        any,\n        FileRouteTypes,\n        unknown,\n        undefined\n      >,\n      MakeRouteMatchUnion\n    >\n  >\n  pendingMatches: Accessor<Array<AnyRouteMatch>>\n  router: Accessor<AnyRouter>\n  route: AnyRoute\n  isRoot?: boolean\n  activeId: Accessor<string | undefined>\n  setActiveId: (id: string) => void\n}) {\n  const styles = useStyles()\n  const matches = createMemo(() =>\n    pendingMatches().length ? pendingMatches() : routerState().matches,\n  )\n  const match = createMemo(() =>\n    routerState().matches.find((d) => d.routeId === route.id),\n  )\n\n  const param = createMemo(() => {\n    try {\n      if (match()?.params) {\n        const p = match()?.params\n        const r: string = route.path || trimPath(route.id)\n        if (r.startsWith('$')) {\n          const trimmed = r.slice(1)\n\n          if (p[trimmed]) {\n            return `(${p[trimmed]})`\n          }\n        }\n      }\n      return ''\n    } catch (error) {\n      return ''\n    }\n  })\n\n  const navigationTarget = createMemo<string | undefined>(() => {\n    if (isRoot) return undefined // rootRouteId has no path\n    if (!route.path) return undefined // no path to navigate to\n\n    // flatten all params in the router state, into a single object\n    const allParams = Object.assign({}, ...matches().map((m) => m.params))\n\n    // interpolatePath is used by router-core to generate the `to`\n    // path for the navigate function in the router\n    const interpolated = interpolatePath({\n      path: route.fullPath,\n      params: allParams,\n      decoder: router().pathParamsDecoder,\n    })\n\n    // only if `interpolated` is not missing params, return the path since this\n    // means that all the params are present for a successful navigation\n    return !interpolated.isMissingParams\n      ? interpolated.interpolatedPath\n      : undefined\n  })\n\n  return (\n    <div>\n      <div\n        role=\"button\"\n        aria-label={`Open match details for ${route.id}`}\n        onClick={() => {\n          if (match()) {\n            setActiveId(activeId() === route.id ? '' : route.id)\n          }\n        }}\n        class={cx(\n          styles().routesRowContainer(route.id === activeId(), !!match()),\n        )}\n      >\n        <div\n          class={cx(\n            styles().matchIndicator(getRouteStatusColor(matches(), route)),\n          )}\n        />\n        <NavigateLink\n          class={cx(styles().routesRow(!!match()))}\n          left={\n            <Show when={navigationTarget()}>\n              {(navigate) => <NavigateButton to={navigate()} router={router} />}\n            </Show>\n          }\n          right={<AgeTicker match={match()} router={router} />}\n        >\n          <code class={styles().code}>\n            {isRoot ? rootRouteId : route.path || trimPath(route.id)}{' '}\n          </code>\n          <code class={styles().routeParamInfo}>{param()}</code>\n        </NavigateLink>\n      </div>\n      {route.children?.length ? (\n        <div class={styles().nestedRouteRow(!!isRoot)}>\n          {[...(route.children as Array<AnyRoute>)]\n            .sort((a, b) => {\n              return a.rank - b.rank\n            })\n            .map((r) => (\n              <RouteComp\n                routerState={routerState}\n                pendingMatches={pendingMatches}\n                router={router}\n                route={r}\n                activeId={activeId}\n                setActiveId={setActiveId}\n              />\n            ))}\n        </div>\n      ) : null}\n    </div>\n  )\n}\n\nexport const BaseTanStackRouterDevtoolsPanel =\n  function BaseTanStackRouterDevtoolsPanel({\n    ...props\n  }: BaseDevtoolsPanelOptions): JSX.Element {\n    const {\n      isOpen = true,\n      setIsOpen,\n      handleDragStart,\n      router,\n      routerState,\n      shadowDOMTarget,\n      ...panelProps\n    } = props\n\n    const { onCloseClick } = useDevtoolsOnClose()\n    const styles = useStyles()\n    const { className, style, ...otherPanelProps } = panelProps\n\n    invariant(\n      router,\n      'No router was found for the TanStack Router Devtools. Please place the devtools in the <RouterProvider> component tree or pass the router instance to the devtools manually.',\n    )\n\n    // useStore(router.stores.__store)\n\n    const [currentTab, setCurrentTab] = useLocalStorage<\n      'routes' | 'matches' | 'history'\n    >('tanstackRouterDevtoolsActiveTab', 'routes')\n\n    const [activeId, setActiveId] = useLocalStorage(\n      'tanstackRouterDevtoolsActiveRouteId',\n      '',\n    )\n\n    const [history, setHistory] = createSignal<Array<AnyRouteMatch>>([])\n    const [hasHistoryOverflowed, setHasHistoryOverflowed] = createSignal(false)\n\n    let pendingMatches: Accessor<Array<AnyRouteMatch>>\n    let cachedMatches: Accessor<Array<AnyRouteMatch>>\n    // subscribable implementation\n    if ('subscribe' in router().stores.pendingMatchesSnapshot) {\n      const [_pendingMatches, setPendingMatches] = createSignal<\n        Array<AnyRouteMatch>\n      >([])\n      pendingMatches = _pendingMatches\n\n      const [_cachedMatches, setCachedMatches] = createSignal<\n        Array<AnyRouteMatch>\n      >([])\n      cachedMatches = _cachedMatches\n\n      type Subscribe = (fn: () => void) => { unsubscribe: () => void }\n      createEffect(() => {\n        const pendingMatchesStore = router().stores.pendingMatchesSnapshot\n        setPendingMatches(pendingMatchesStore.state)\n        const subscription = (\n          (pendingMatchesStore as any).subscribe as Subscribe\n        )(() => {\n          setPendingMatches(pendingMatchesStore.state)\n        })\n        onCleanup(() => subscription.unsubscribe())\n      })\n\n      createEffect(() => {\n        const cachedMatchesStore = router().stores.cachedMatchesSnapshot\n        setCachedMatches(cachedMatchesStore.state)\n        const subscription = (\n          (cachedMatchesStore as any).subscribe as Subscribe\n        )(() => {\n          setCachedMatches(cachedMatchesStore.state)\n        })\n        onCleanup(() => subscription.unsubscribe())\n      })\n    }\n    // signal implementation\n    else {\n      pendingMatches = () => router().stores.pendingMatchesSnapshot.state\n      cachedMatches = () => router().stores.cachedMatchesSnapshot.state\n    }\n\n    createEffect(() => {\n      const matches = routerState().matches\n      const currentMatch = matches[matches.length - 1]\n      if (!currentMatch) {\n        return\n      }\n      // Read history WITHOUT tracking it to avoid infinite loops\n      const historyUntracked = untrack(() => history())\n      const lastMatch = historyUntracked[0]\n      const sameLocation =\n        lastMatch &&\n        lastMatch.pathname === currentMatch.pathname &&\n        JSON.stringify(lastMatch.search ?? {}) ===\n          JSON.stringify(currentMatch.search ?? {})\n      if (!lastMatch || !sameLocation) {\n        if (historyUntracked.length >= HISTORY_LIMIT) {\n          setHasHistoryOverflowed(true)\n        }\n        setHistory((prev) => {\n          const newHistory = [currentMatch, ...prev]\n          // truncate to ensure we don't overflow too much the ui\n          newHistory.splice(HISTORY_LIMIT)\n          return newHistory\n        })\n      }\n    })\n\n    const activeMatch = createMemo(() => {\n      const matches = [\n        ...pendingMatches(),\n        ...routerState().matches,\n        ...cachedMatches(),\n      ]\n      return matches.find(\n        (d) => d.routeId === activeId() || d.id === activeId(),\n      )\n    })\n\n    const hasSearch = createMemo(\n      () => Object.keys(routerState().location.search).length,\n    )\n\n    const explorerState = createMemo(() => {\n      return {\n        ...router(),\n        state: routerState(),\n      }\n    })\n\n    const routerExplorerValue = createMemo(() =>\n      Object.fromEntries(\n        multiSortBy(\n          Object.keys(explorerState()),\n          (\n            [\n              'state',\n              'routesById',\n              'routesByPath',\n              'options',\n              'manifest',\n            ] as const\n          ).map((d) => (dd) => dd !== d),\n        )\n          .map((key) => [key, (explorerState() as any)[key]])\n          .filter(\n            (d) =>\n              typeof d[1] !== 'function' &&\n              ![\n                'stores',\n                'basepath',\n                'injectedHtml',\n                'subscribers',\n                'latestLoadPromise',\n                'navigateTimeout',\n                'resetNextScroll',\n                'tempLocationKey',\n                'latestLocation',\n                'routeTree',\n                'history',\n              ].includes(d[0]),\n          ),\n      ),\n    )\n    const activeMatchLoaderData = createMemo(() => activeMatch()?.loaderData)\n    const activeMatchValue = createMemo(() => activeMatch())\n    const locationSearchValue = createMemo(() => routerState().location.search)\n\n    return (\n      <div\n        class={cx(\n          styles().devtoolsPanel,\n          'TanStackRouterDevtoolsPanel',\n          className ? className() : '',\n        )}\n        style={style ? style() : ''}\n        {...otherPanelProps}\n      >\n        {handleDragStart ? (\n          <div class={styles().dragHandle} onMouseDown={handleDragStart}></div>\n        ) : null}\n        <button\n          class={styles().panelCloseBtn}\n          onClick={(e: any) => {\n            if (setIsOpen) {\n              setIsOpen(false)\n            }\n            onCloseClick(e)\n          }}\n        >\n          <svg\n            xmlns=\"http://www.w3.org/2000/svg\"\n            width=\"10\"\n            height=\"6\"\n            fill=\"none\"\n            viewBox=\"0 0 10 6\"\n            class={styles().panelCloseBtnIcon}\n          >\n            <path\n              stroke=\"currentColor\"\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"round\"\n              stroke-width=\"1.667\"\n              d=\"M1 1l4 4 4-4\"\n            ></path>\n          </svg>\n        </button>\n        <div class={styles().firstContainer}>\n          <div class={styles().row}>\n            <Logo\n              aria-hidden\n              onClick={(e: any) => {\n                if (setIsOpen) {\n                  setIsOpen(false)\n                }\n                onCloseClick(e)\n              }}\n            />\n          </div>\n          <div class={styles().routerExplorerContainer}>\n            <div class={styles().routerExplorer}>\n              <Explorer\n                label=\"Router\"\n                value={routerExplorerValue}\n                defaultExpanded={{\n                  state: {} as any,\n                  context: {} as any,\n                  options: {} as any,\n                }}\n                filterSubEntries={(subEntries) => {\n                  return subEntries.filter(\n                    (d: any) => typeof d.value() !== 'function',\n                  )\n                }}\n              />\n            </div>\n          </div>\n        </div>\n        <div class={styles().secondContainer}>\n          <div class={styles().matchesContainer}>\n            <div class={styles().detailsHeader}>\n              <span>Pathname</span>\n              {routerState().location.maskedLocation ? (\n                <div class={styles().maskedBadgeContainer}>\n                  <span class={styles().maskedBadge}>masked</span>\n                </div>\n              ) : null}\n            </div>\n            <div class={styles().detailsContent}>\n              <code>{routerState().location.pathname}</code>\n              {routerState().location.maskedLocation ? (\n                <code class={styles().maskedLocation}>\n                  {routerState().location.maskedLocation?.pathname}\n                </code>\n              ) : null}\n            </div>\n            <div class={styles().detailsHeader}>\n              <div class={styles().routeMatchesToggle}>\n                <button\n                  type=\"button\"\n                  onClick={() => {\n                    setCurrentTab('routes')\n                  }}\n                  disabled={currentTab() === 'routes'}\n                  class={cx(\n                    styles().routeMatchesToggleBtn(\n                      currentTab() === 'routes',\n                      true,\n                    ),\n                  )}\n                >\n                  Routes\n                </button>\n                <button\n                  type=\"button\"\n                  onClick={() => {\n                    setCurrentTab('matches')\n                  }}\n                  disabled={currentTab() === 'matches'}\n                  class={cx(\n                    styles().routeMatchesToggleBtn(\n                      currentTab() === 'matches',\n                      true,\n                    ),\n                  )}\n                >\n                  Matches\n                </button>\n                <button\n                  type=\"button\"\n                  onClick={() => {\n                    setCurrentTab('history')\n                  }}\n                  disabled={currentTab() === 'history'}\n                  class={cx(\n                    styles().routeMatchesToggleBtn(\n                      currentTab() === 'history',\n                      false,\n                    ),\n                  )}\n                >\n                  History\n                </button>\n              </div>\n              <div class={styles().detailsHeaderInfo}>\n                <div>age / staleTime / gcTime</div>\n              </div>\n            </div>\n            <div class={cx(styles().routesContainer)}>\n              <Switch>\n                <Match when={currentTab() === 'routes'}>\n                  <RouteComp\n                    routerState={routerState}\n                    pendingMatches={pendingMatches}\n                    router={router}\n                    route={router().routeTree}\n                    isRoot\n                    activeId={activeId}\n                    setActiveId={setActiveId}\n                  />\n                </Match>\n                <Match when={currentTab() === 'matches'}>\n                  <div>\n                    {(pendingMatches().length\n                      ? pendingMatches()\n                      : routerState().matches\n                    ).map((match: any, _i: any) => {\n                      return (\n                        <div\n                          role=\"button\"\n                          aria-label={`Open match details for ${match.id}`}\n                          onClick={() =>\n                            setActiveId(activeId() === match.id ? '' : match.id)\n                          }\n                          class={cx(styles().matchRow(match === activeMatch()))}\n                        >\n                          <div\n                            class={cx(\n                              styles().matchIndicator(getStatusColor(match)),\n                            )}\n                          />\n                          <NavigateLink\n                            left={\n                              <NavigateButton\n                                to={match.pathname}\n                                params={match.params}\n                                search={match.search}\n                                router={router}\n                              />\n                            }\n                            right={<AgeTicker match={match} router={router} />}\n                          >\n                            <code class={styles().matchID}>\n                              {`${match.routeId === rootRouteId ? rootRouteId : match.pathname}`}\n                            </code>\n                          </NavigateLink>\n                        </div>\n                      )\n                    })}\n                  </div>\n                </Match>\n                <Match when={currentTab() === 'history'}>\n                  <div>\n                    <ul>\n                      <For each={history()}>\n                        {(match, index) => (\n                          <li\n                            class={cx(\n                              styles().matchRow(match === activeMatch()),\n                            )}\n                          >\n                            <div\n                              class={cx(\n                                styles().matchIndicator(\n                                  index() === 0 ? 'green' : 'gray',\n                                ),\n                              )}\n                            />\n                            <NavigateLink\n                              left={\n                                <NavigateButton\n                                  to={match.pathname}\n                                  params={match.params}\n                                  search={match.search}\n                                  router={router}\n                                />\n                              }\n                              right={\n                                <AgeTicker match={match} router={router} />\n                              }\n                            >\n                              <code class={styles().matchID}>\n                                {`${match.routeId === rootRouteId ? rootRouteId : match.pathname}`}\n                              </code>\n                            </NavigateLink>\n                          </li>\n                        )}\n                      </For>\n                      {hasHistoryOverflowed() ? (\n                        <li class={styles().historyOverflowContainer}>\n                          This panel displays the most recent {HISTORY_LIMIT}{' '}\n                          navigations.\n                        </li>\n                      ) : null}\n                    </ul>\n                  </div>\n                </Match>\n              </Switch>\n            </div>\n          </div>\n          {cachedMatches().length ? (\n            <div class={styles().cachedMatchesContainer}>\n              <div class={styles().detailsHeader}>\n                <div>Cached Matches</div>\n                <div class={styles().detailsHeaderInfo}>\n                  age / staleTime / gcTime\n                </div>\n              </div>\n              <div>\n                {cachedMatches().map((match: any) => {\n                  return (\n                    <div\n                      role=\"button\"\n                      aria-label={`Open match details for ${match.id}`}\n                      onClick={() =>\n                        setActiveId(activeId() === match.id ? '' : match.id)\n                      }\n                      class={cx(styles().matchRow(match === activeMatch()))}\n                    >\n                      <div\n                        class={cx(\n                          styles().matchIndicator(getStatusColor(match)),\n                        )}\n                      />\n                      <NavigateLink\n                        left={\n                          <NavigateButton\n                            to={match.pathname}\n                            params={match.params}\n                            search={match.search}\n                            router={router}\n                          />\n                        }\n                        right={<AgeTicker match={match} router={router} />}\n                      >\n                        <code class={styles().matchID}>{`${match.id}`}</code>\n                      </NavigateLink>\n                    </div>\n                  )\n                })}\n              </div>\n            </div>\n          ) : null}\n        </div>\n        {activeMatch() && activeMatch()?.status ? (\n          <div class={styles().thirdContainer}>\n            <div class={styles().detailsHeader}>Match Details</div>\n            <div>\n              <div class={styles().matchDetails}>\n                <div\n                  class={styles().matchStatus(\n                    activeMatch()?.status,\n                    activeMatch()?.isFetching,\n                  )}\n                >\n                  <div>\n                    {activeMatch()?.status === 'success' &&\n                    activeMatch()?.isFetching\n                      ? 'fetching'\n                      : activeMatch()?.status}\n                  </div>\n                </div>\n                <div class={styles().matchDetailsInfoLabel}>\n                  <div>ID:</div>\n                  <div class={styles().matchDetailsInfo}>\n                    <code>{activeMatch()?.id}</code>\n                  </div>\n                </div>\n                <div class={styles().matchDetailsInfoLabel}>\n                  <div>State:</div>\n                  <div class={styles().matchDetailsInfo}>\n                    {pendingMatches().find((d) => d.id === activeMatch()?.id)\n                      ? 'Pending'\n                      : routerState().matches.find(\n                            (d: any) => d.id === activeMatch()?.id,\n                          )\n                        ? 'Active'\n                        : 'Cached'}\n                  </div>\n                </div>\n                <div class={styles().matchDetailsInfoLabel}>\n                  <div>Last Updated:</div>\n                  <div class={styles().matchDetailsInfo}>\n                    {activeMatch()?.updatedAt\n                      ? new Date(activeMatch()?.updatedAt).toLocaleTimeString()\n                      : 'N/A'}\n                  </div>\n                </div>\n              </div>\n            </div>\n            {activeMatchLoaderData() ? (\n              <>\n                <div class={styles().detailsHeader}>Loader Data</div>\n                <div class={styles().detailsContent}>\n                  <Explorer\n                    label=\"loaderData\"\n                    value={activeMatchLoaderData}\n                    defaultExpanded={{}}\n                  />\n                </div>\n              </>\n            ) : null}\n            <div class={styles().detailsHeader}>Explorer</div>\n            <div class={styles().detailsContent}>\n              <Explorer\n                label=\"Match\"\n                value={activeMatchValue}\n                defaultExpanded={{}}\n              />\n            </div>\n          </div>\n        ) : null}\n        {hasSearch() ? (\n          <div class={styles().fourthContainer}>\n            <div class={styles().detailsHeader}>\n              <span>Search Params</span>\n              {typeof navigator !== 'undefined' ? (\n                <span style=\"margin-left: 0.5rem;\">\n                  <CopyButton\n                    getValue={() => {\n                      const search = routerState().location.search\n                      return JSON.stringify(search)\n                    }}\n                  />\n                </span>\n              ) : null}\n            </div>\n            <div class={styles().detailsContent}>\n              <Explorer\n                value={locationSearchValue}\n                defaultExpanded={Object.keys(\n                  routerState().location.search,\n                ).reduce((obj: any, next) => {\n                  obj[next] = {}\n                  return obj\n                }, {})}\n              />\n            </div>\n          </div>\n        ) : null}\n      </div>\n    )\n  }\n\nfunction CopyButton({ getValue }: { getValue: () => string }) {\n  const [copied, setCopied] = createSignal(false)\n\n  let timeoutId: ReturnType<typeof setTimeout> | null = null\n\n  const handleCopy = async () => {\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n    if (typeof navigator === 'undefined' || !navigator.clipboard?.writeText) {\n      console.warn('TanStack Router Devtools: Clipboard API unavailable')\n      return\n    }\n    try {\n      const value = getValue()\n      await navigator.clipboard.writeText(value)\n      setCopied(true)\n      if (timeoutId) clearTimeout(timeoutId)\n      timeoutId = setTimeout(() => setCopied(false), 2500)\n    } catch (e) {\n      console.error('TanStack Router Devtools: Failed to copy', e)\n    }\n  }\n\n  onCleanup(() => {\n    if (timeoutId) clearTimeout(timeoutId)\n  })\n\n  return (\n    <button\n      type=\"button\"\n      style=\"cursor: pointer;\"\n      onClick={handleCopy}\n      aria-label=\"Copy value to clipboard\"\n      title={copied() ? 'Copied!' : 'Copy'}\n    >\n      {copied() ? '✅' : '📋'}\n    </button>\n  )\n}\n\nexport default BaseTanStackRouterDevtoolsPanel\n"
  },
  {
    "path": "packages/router-devtools-core/src/Explorer.tsx",
    "content": "/* eslint-disable @typescript-eslint/no-unnecessary-condition */\nimport { clsx as cx } from 'clsx'\nimport * as goober from 'goober'\nimport { createMemo, createSignal, useContext } from 'solid-js'\nimport { tokens } from './tokens'\nimport { displayValue } from './utils'\nimport { ShadowDomTargetContext } from './context'\nimport type { Accessor, JSX } from 'solid-js'\n\ntype ExpanderProps = {\n  expanded: boolean\n  style?: JSX.CSSProperties\n}\n\nexport const Expander = ({ expanded, style = {} }: ExpanderProps) => {\n  const styles = useStyles()\n  return (\n    <span class={styles().expander}>\n      <svg\n        xmlns=\"http://www.w3.org/2000/svg\"\n        width=\"12\"\n        height=\"12\"\n        fill=\"none\"\n        viewBox=\"0 0 24 24\"\n        class={cx(styles().expanderIcon(expanded))}\n      >\n        <path\n          stroke=\"currentColor\"\n          stroke-linecap=\"round\"\n          stroke-linejoin=\"round\"\n          stroke-width=\"2\"\n          d=\"M9 18l6-6-6-6\"\n        ></path>\n      </svg>\n    </span>\n  )\n}\n\ntype Entry = {\n  label: string\n}\n\ntype RendererProps = {\n  handleEntry: HandleEntryFn\n  label?: JSX.Element\n  value: Accessor<unknown>\n  subEntries: Array<Entry>\n  subEntryPages: Array<Array<Entry>>\n  type: string\n  expanded: Accessor<boolean>\n  toggleExpanded: () => void\n  pageSize: number\n  filterSubEntries?: (subEntries: Array<Property>) => Array<Property>\n}\n\n/**\n * Chunk elements in the array by size\n *\n * when the array cannot be chunked evenly by size, the last chunk will be\n * filled with the remaining elements\n *\n * @example\n * chunkArray(['a','b', 'c', 'd', 'e'], 2) // returns [['a','b'], ['c', 'd'], ['e']]\n */\nexport function chunkArray<T>(array: Array<T>, size: number): Array<Array<T>> {\n  if (size < 1) return []\n  let i = 0\n  const result: Array<Array<T>> = []\n  while (i < array.length) {\n    result.push(array.slice(i, i + size))\n    i = i + size\n  }\n  return result\n}\n\ntype HandleEntryFn = (entry: Entry) => JSX.Element\n\ntype ExplorerProps = Partial<RendererProps> & {\n  defaultExpanded?: true | Record<string, boolean>\n  value: Accessor<unknown>\n}\n\ntype Property = {\n  defaultExpanded?: boolean | Record<string, boolean>\n  label: string\n  value: unknown\n}\n\nfunction isIterable(x: any): x is Iterable<unknown> {\n  return Symbol.iterator in x\n}\n\nexport function Explorer({\n  value,\n  defaultExpanded,\n  pageSize = 100,\n  filterSubEntries,\n  ...rest\n}: ExplorerProps) {\n  const [expanded, setExpanded] = createSignal(Boolean(defaultExpanded))\n  const toggleExpanded = () => setExpanded((old) => !old)\n\n  const type = createMemo(() => typeof value())\n  const subEntries = createMemo(() => {\n    let entries: Array<Property> = []\n\n    const makeProperty = (sub: { label: string; value: unknown }): Property => {\n      const subDefaultExpanded =\n        defaultExpanded === true\n          ? { [sub.label]: true }\n          : defaultExpanded?.[sub.label]\n      return {\n        ...sub,\n        value: () => sub.value,\n        defaultExpanded: subDefaultExpanded,\n      }\n    }\n\n    if (Array.isArray(value())) {\n      // any[]\n      entries = (value() as Array<any>).map((d, i) =>\n        makeProperty({\n          label: i.toString(),\n          value: d,\n        }),\n      )\n    } else if (\n      value() !== null &&\n      typeof value() === 'object' &&\n      isIterable(value()) &&\n      typeof (value() as Iterable<unknown>)[Symbol.iterator] === 'function'\n    ) {\n      // Iterable<unknown>\n      entries = Array.from(value() as Iterable<unknown>, (val, i) =>\n        makeProperty({\n          label: i.toString(),\n          value: val,\n        }),\n      )\n    } else if (typeof value() === 'object' && value() !== null) {\n      // object\n      entries = Object.entries(value() as object).map(([key, val]) =>\n        makeProperty({\n          label: key,\n          value: val,\n        }),\n      )\n    }\n\n    return filterSubEntries ? filterSubEntries(entries) : entries\n  })\n\n  const subEntryPages = createMemo(() => chunkArray(subEntries(), pageSize))\n\n  const [expandedPages, setExpandedPages] = createSignal<Array<number>>([])\n  const [valueSnapshot, setValueSnapshot] = createSignal(undefined)\n  const styles = useStyles()\n\n  const refreshValueSnapshot = () => {\n    setValueSnapshot((value() as () => any)())\n  }\n\n  const handleEntry = (entry: Entry) => (\n    <Explorer\n      value={value}\n      filterSubEntries={filterSubEntries}\n      {...rest}\n      {...entry}\n    />\n  )\n\n  return (\n    <div class={styles().entry}>\n      {subEntryPages().length ? (\n        <>\n          <button\n            class={styles().expandButton}\n            onClick={() => toggleExpanded()}\n          >\n            <Expander expanded={expanded() ?? false} />\n            {rest.label}\n            <span class={styles().info}>\n              {String(type).toLowerCase() === 'iterable' ? '(Iterable) ' : ''}\n              {subEntries().length} {subEntries().length > 1 ? `items` : `item`}\n            </span>\n          </button>\n          {(expanded() ?? false) ? (\n            subEntryPages().length === 1 ? (\n              <div class={styles().subEntries}>\n                {subEntries().map((entry, index) => handleEntry(entry))}\n              </div>\n            ) : (\n              <div class={styles().subEntries}>\n                {subEntryPages().map((entries, index) => {\n                  return (\n                    <div>\n                      <div class={styles().entry}>\n                        <button\n                          class={cx(styles().labelButton, 'labelButton')}\n                          onClick={() =>\n                            setExpandedPages((old) =>\n                              old.includes(index)\n                                ? old.filter((d) => d !== index)\n                                : [...old, index],\n                            )\n                          }\n                        >\n                          <Expander\n                            expanded={expandedPages().includes(index)}\n                          />{' '}\n                          [{index * pageSize} ...{' '}\n                          {index * pageSize + pageSize - 1}]\n                        </button>\n                        {expandedPages().includes(index) ? (\n                          <div class={styles().subEntries}>\n                            {entries.map((entry) => handleEntry(entry))}\n                          </div>\n                        ) : null}\n                      </div>\n                    </div>\n                  )\n                })}\n              </div>\n            )\n          ) : null}\n        </>\n      ) : type() === 'function' ? (\n        <>\n          <Explorer\n            label={\n              <button\n                onClick={refreshValueSnapshot}\n                class={styles().refreshValueBtn}\n              >\n                <span>{rest.label}</span> 🔄{' '}\n              </button>\n            }\n            value={valueSnapshot}\n            defaultExpanded={{}}\n          />\n        </>\n      ) : (\n        <>\n          <span>{rest.label}:</span>{' '}\n          <span class={styles().value}>{displayValue(value())}</span>\n        </>\n      )}\n    </div>\n  )\n}\n\nconst stylesFactory = (shadowDOMTarget?: ShadowRoot) => {\n  const { colors, font, size, alpha, shadow, border } = tokens\n  const { fontFamily, lineHeight, size: fontSize } = font\n  const css = shadowDOMTarget\n    ? goober.css.bind({ target: shadowDOMTarget })\n    : goober.css\n\n  return {\n    entry: css`\n      font-family: ${fontFamily.mono};\n      font-size: ${fontSize.xs};\n      line-height: ${lineHeight.sm};\n      outline: none;\n      word-break: break-word;\n    `,\n    labelButton: css`\n      cursor: pointer;\n      color: inherit;\n      font: inherit;\n      outline: inherit;\n      background: transparent;\n      border: none;\n      padding: 0;\n    `,\n    expander: css`\n      display: inline-flex;\n      align-items: center;\n      justify-content: center;\n      width: ${size[3]};\n      height: ${size[3]};\n      padding-left: 3px;\n      box-sizing: content-box;\n    `,\n    expanderIcon: (expanded: boolean) => {\n      if (expanded) {\n        return css`\n          transform: rotate(90deg);\n          transition: transform 0.1s ease;\n        `\n      }\n      return css`\n        transform: rotate(0deg);\n        transition: transform 0.1s ease;\n      `\n    },\n    expandButton: css`\n      display: flex;\n      gap: ${size[1]};\n      align-items: center;\n      cursor: pointer;\n      color: inherit;\n      font: inherit;\n      outline: inherit;\n      background: transparent;\n      border: none;\n      padding: 0;\n    `,\n    value: css`\n      color: ${colors.purple[400]};\n    `,\n    subEntries: css`\n      margin-left: ${size[2]};\n      padding-left: ${size[2]};\n      border-left: 2px solid ${colors.darkGray[400]};\n    `,\n    info: css`\n      color: ${colors.gray[500]};\n      font-size: ${fontSize['2xs']};\n      padding-left: ${size[1]};\n    `,\n    refreshValueBtn: css`\n      appearance: none;\n      border: 0;\n      cursor: pointer;\n      background: transparent;\n      color: inherit;\n      padding: 0;\n      font-family: ${fontFamily.mono};\n      font-size: ${fontSize.xs};\n    `,\n  }\n}\n\nfunction useStyles() {\n  const shadowDomTarget = useContext(ShadowDomTargetContext)\n  const [_styles] = createSignal(stylesFactory(shadowDomTarget))\n  return _styles\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/FloatingTanStackRouterDevtools.tsx",
    "content": "import { clsx as cx } from 'clsx'\n\nimport { createEffect, createMemo, createSignal } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\n\nimport { DevtoolsOnCloseContext } from './context'\nimport { useIsMounted } from './utils'\nimport { BaseTanStackRouterDevtoolsPanel } from './BaseTanStackRouterDevtoolsPanel'\nimport useLocalStorage from './useLocalStorage'\nimport { TanStackLogo } from './logo'\nimport { useStyles } from './useStyles'\nimport type { Accessor, JSX } from 'solid-js'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport interface FloatingDevtoolsOptions {\n  /**\n   * Set this true if you want the dev tools to default to being open\n   */\n  initialIsOpen?: boolean\n  /**\n   * Use this to add props to the panel. For example, you can add class, style (merge and override default style), etc.\n   */\n  panelProps?: any & {\n    ref?: any\n  }\n  /**\n   * Use this to add props to the close button. For example, you can add class, style (merge and override default style), onClick (extend default handler), etc.\n   */\n  closeButtonProps?: any & {\n    ref?: any\n  }\n  /**\n   * Use this to add props to the toggle button. For example, you can add class, style (merge and override default style), onClick (extend default handler), etc.\n   */\n  toggleButtonProps?: any & {\n    ref?: any\n  }\n  /**\n   * The position of the TanStack Router logo to open and close the devtools panel.\n   * Defaults to 'bottom-left'.\n   */\n  position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n  /**\n   * Use this to render the devtools inside a different type of container element for a11y purposes.\n   * Any string which corresponds to a valid intrinsic JSX element is allowed.\n   * Defaults to 'footer'.\n   */\n  containerElement?: string | any\n  /**\n   * A boolean variable indicating if the \"lite\" version of the library is being used\n   */\n  router: Accessor<AnyRouter>\n  routerState: Accessor<any>\n  /**\n   * Use this to attach the devtool's styles to specific element in the DOM.\n   */\n  shadowDOMTarget?: ShadowRoot\n}\n\nexport function FloatingTanStackRouterDevtools({\n  initialIsOpen,\n  panelProps = {},\n  closeButtonProps = {},\n  toggleButtonProps = {},\n  position = 'bottom-left',\n  containerElement: Container = 'footer',\n  router,\n  routerState,\n  shadowDOMTarget,\n}: FloatingDevtoolsOptions): JSX.Element | null {\n  const [rootEl, setRootEl] = createSignal<HTMLDivElement>()\n\n  // eslint-disable-next-line prefer-const\n  let panelRef: HTMLDivElement | undefined = undefined\n\n  const [isOpen, setIsOpen] = useLocalStorage(\n    'tanstackRouterDevtoolsOpen',\n    initialIsOpen,\n  )\n\n  const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage<number | null>(\n    'tanstackRouterDevtoolsHeight',\n    null,\n  )\n\n  const [isResolvedOpen, setIsResolvedOpen] = createSignal(false)\n  const [isResizing, setIsResizing] = createSignal(false)\n  const isMounted = useIsMounted()\n  const styles = useStyles()\n\n  const handleDragStart = (\n    panelElement: HTMLDivElement | undefined,\n    startEvent: any,\n  ) => {\n    if (startEvent.button !== 0) return // Only allow left click for drag\n\n    setIsResizing(true)\n\n    const dragInfo = {\n      originalHeight: panelElement?.getBoundingClientRect().height ?? 0,\n      pageY: startEvent.pageY,\n    }\n\n    const run = (moveEvent: MouseEvent) => {\n      const delta = dragInfo.pageY - moveEvent.pageY\n      const newHeight = dragInfo.originalHeight + delta\n\n      setDevtoolsHeight(newHeight)\n\n      if (newHeight < 70) {\n        setIsOpen(false)\n      } else {\n        setIsOpen(true)\n      }\n    }\n\n    const unsub = () => {\n      setIsResizing(false)\n      document.removeEventListener('mousemove', run)\n      document.removeEventListener('mouseUp', unsub)\n    }\n\n    document.addEventListener('mousemove', run)\n    document.addEventListener('mouseup', unsub)\n  }\n\n  const isButtonClosed = isOpen() ?? false\n\n  createEffect(() => {\n    setIsResolvedOpen(isOpen() ?? false)\n  })\n\n  createEffect(() => {\n    if (isResolvedOpen()) {\n      const previousValue = rootEl()?.parentElement?.style.paddingBottom\n\n      const run = () => {\n        const containerHeight = panelRef!.getBoundingClientRect().height\n        if (rootEl()?.parentElement) {\n          setRootEl((prev) => {\n            if (prev?.parentElement) {\n              prev.parentElement.style.paddingBottom = `${containerHeight}px`\n            }\n            return prev\n          })\n        }\n      }\n\n      run()\n\n      if (typeof window !== 'undefined') {\n        window.addEventListener('resize', run)\n\n        return () => {\n          window.removeEventListener('resize', run)\n          if (rootEl()?.parentElement && typeof previousValue === 'string') {\n            setRootEl((prev) => {\n              prev!.parentElement!.style.paddingBottom = previousValue\n              return prev\n            })\n          }\n        }\n      }\n    } else {\n      // Reset padding when devtools are closed\n      if (rootEl()?.parentElement) {\n        setRootEl((prev) => {\n          if (prev?.parentElement) {\n            prev.parentElement.removeAttribute('style')\n          }\n          return prev\n        })\n      }\n    }\n    return\n  })\n\n  createEffect(() => {\n    if (rootEl()) {\n      const el = rootEl()\n      const fontSize = getComputedStyle(el!).fontSize\n      el?.style.setProperty('--tsrd-font-size', fontSize)\n    }\n  })\n\n  const { style: panelStyle = {}, ...otherPanelProps } = panelProps as {\n    style?: Record<string, any>\n  }\n\n  const {\n    style: closeButtonStyle = {},\n    onClick: onCloseClick,\n    ...otherCloseButtonProps\n  } = closeButtonProps\n\n  const {\n    onClick: onToggleClick,\n    class: toggleButtonClassName,\n    ...otherToggleButtonProps\n  } = toggleButtonProps\n\n  // Do not render on the server\n  if (!isMounted()) return null\n\n  const resolvedHeight = createMemo(() => devtoolsHeight() ?? 500)\n\n  const basePanelClass = createMemo(() => {\n    return cx(\n      styles().devtoolsPanelContainer,\n      styles().devtoolsPanelContainerVisibility(!!isOpen()),\n      styles().devtoolsPanelContainerResizing(isResizing),\n      styles().devtoolsPanelContainerAnimation(\n        isResolvedOpen(),\n        resolvedHeight() + 16,\n      ),\n    )\n  })\n\n  const basePanelStyle = createMemo(() => {\n    return {\n      height: `${resolvedHeight()}px`,\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      ...(panelStyle || {}),\n    }\n  })\n\n  const buttonStyle = createMemo(() => {\n    return cx(\n      styles().mainCloseBtn,\n      styles().mainCloseBtnPosition(position),\n      styles().mainCloseBtnAnimation(!!isOpen()),\n      toggleButtonClassName,\n    )\n  })\n\n  return (\n    <Dynamic\n      component={Container}\n      ref={setRootEl}\n      class=\"TanStackRouterDevtools\"\n    >\n      <DevtoolsOnCloseContext.Provider\n        value={{\n          onCloseClick: onCloseClick ?? (() => {}),\n        }}\n      >\n        {/* {router() ? ( */}\n        <BaseTanStackRouterDevtoolsPanel\n          ref={panelRef}\n          {...otherPanelProps}\n          router={router}\n          routerState={routerState}\n          className={basePanelClass}\n          style={basePanelStyle}\n          isOpen={isResolvedOpen()}\n          setIsOpen={setIsOpen}\n          handleDragStart={(e) => handleDragStart(panelRef, e)}\n          shadowDOMTarget={shadowDOMTarget}\n        />\n        {/* ) : (\n          <p>No router</p>\n        )} */}\n      </DevtoolsOnCloseContext.Provider>\n\n      <button\n        type=\"button\"\n        {...otherToggleButtonProps}\n        aria-label=\"Open TanStack Router Devtools\"\n        onClick={(e) => {\n          setIsOpen(true)\n          onToggleClick && onToggleClick(e)\n        }}\n        class={buttonStyle()}\n      >\n        <div class={styles().mainCloseBtnIconContainer}>\n          <div class={styles().mainCloseBtnIconOuter}>\n            <TanStackLogo />\n          </div>\n          <div class={styles().mainCloseBtnIconInner}>\n            <TanStackLogo />\n          </div>\n        </div>\n        <div class={styles().mainCloseBtnDivider}>-</div>\n        <div class={styles().routerLogoCloseButton}>TanStack Router</div>\n      </button>\n    </Dynamic>\n  )\n}\n\nexport default FloatingTanStackRouterDevtools\n"
  },
  {
    "path": "packages/router-devtools-core/src/NavigateButton.tsx",
    "content": "import { useStyles } from './useStyles'\nimport type { AnyRouter, NavigateOptions } from '@tanstack/router-core'\nimport type { Accessor } from 'solid-js'\n\ninterface Props extends NavigateOptions {\n  router: Accessor<AnyRouter>\n}\n\nexport function NavigateButton({ to, params, search, router }: Props) {\n  const styles = useStyles()\n\n  return (\n    <button\n      type=\"button\"\n      title={`Navigate to ${to}`}\n      class={styles().navigateButton}\n      onClick={(e) => {\n        e.stopPropagation()\n        router().navigate({ to, params, search })\n      }}\n    >\n      ➔\n    </button>\n  )\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/TanStackRouterDevtoolsCore.tsx",
    "content": "import { createSignal, lazy } from 'solid-js'\nimport { render } from 'solid-js/web'\nimport { ShadowDomTargetContext } from './context'\nimport type { AnyRouter } from '@tanstack/router-core'\nimport type { Signal } from 'solid-js'\n\nexport interface TanStackRouterDevtoolsCoreOptions {\n  /**\n   * Set this true if you want the dev tools to default to being open\n   */\n  initialIsOpen?: boolean\n  /**\n   * Use this to add props to the panel. For example, you can add class, style (merge and override default style), etc.\n   */\n  panelProps?: any & {\n    ref?: any\n  }\n  /**\n   * Use this to add props to the close button. For example, you can add class, style (merge and override default style), onClick (extend default handler), etc.\n   */\n  closeButtonProps?: any & {\n    ref?: any\n  }\n  /**\n   * Use this to add props to the toggle button. For example, you can add class, style (merge and override default style), onClick (extend default handler), etc.\n   */\n  toggleButtonProps?: any & {\n    ref?: any\n  }\n  /**\n   * The position of the TanStack Router logo to open and close the devtools panel.\n   * Defaults to 'bottom-left'.\n   */\n  position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n  /**\n   * Use this to render the devtools inside a different type of container element for a11y purposes.\n   * Any string which corresponds to a valid intrinsic JSX element is allowed.\n   * Defaults to 'footer'.\n   */\n  containerElement?: string | any\n  /**\n   * A boolean variable indicating if the \"lite\" version of the library is being used\n   */\n  router: AnyRouter\n  routerState: any\n  /**\n   * Use this to attach the devtool's styles to specific element in the DOM.\n   */\n  shadowDOMTarget?: ShadowRoot\n}\n\nexport class TanStackRouterDevtoolsCore {\n  #router: Signal<AnyRouter>\n  #routerState: Signal<any>\n  #position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n  #initialIsOpen: boolean\n  #shadowDOMTarget?: ShadowRoot\n\n  #panelProps: any\n  #closeButtonProps: any\n  #toggleButtonProps: any\n  #containerElement?: string | any\n\n  #isMounted = false\n  #Component: any\n  #dispose?: () => void\n\n  constructor(config: TanStackRouterDevtoolsCoreOptions) {\n    this.#router = createSignal(config.router)\n    this.#routerState = createSignal(config.routerState)\n    this.#position = config.position ?? 'bottom-left'\n    this.#initialIsOpen = config.initialIsOpen ?? false\n    this.#shadowDOMTarget = config.shadowDOMTarget\n\n    this.#panelProps = config.panelProps\n    this.#closeButtonProps = config.closeButtonProps\n    this.#toggleButtonProps = config.toggleButtonProps\n    this.#containerElement = config.containerElement\n  }\n\n  mount<T extends HTMLElement>(el: T) {\n    if (this.#isMounted) {\n      throw new Error('Devtools is already mounted')\n    }\n\n    const dispose = render(() => {\n      const [router] = this.#router\n      const [routerState] = this.#routerState\n      const position = this.#position\n      const initialIsOpen = this.#initialIsOpen\n      const shadowDOMTarget = this.#shadowDOMTarget\n\n      const panelProps = this.#panelProps\n      const closeButtonProps = this.#closeButtonProps\n      const toggleButtonProps = this.#toggleButtonProps\n      const containerElement = this.#containerElement\n\n      let Devtools\n\n      if (this.#Component) {\n        Devtools = this.#Component\n      } else {\n        Devtools = lazy(() => import('./FloatingTanStackRouterDevtools'))\n        this.#Component = Devtools\n      }\n\n      return (\n        <ShadowDomTargetContext.Provider value={shadowDOMTarget}>\n          <Devtools\n            position={position}\n            initialIsOpen={initialIsOpen}\n            router={router}\n            routerState={routerState}\n            shadowDOMTarget={shadowDOMTarget}\n            panelProps={panelProps}\n            closeButtonProps={closeButtonProps}\n            toggleButtonProps={toggleButtonProps}\n            containerElement={containerElement}\n          />\n        </ShadowDomTargetContext.Provider>\n      )\n    }, el)\n\n    this.#isMounted = true\n    this.#dispose = dispose\n  }\n\n  unmount() {\n    if (!this.#isMounted) {\n      throw new Error('Devtools is not mounted')\n    }\n    this.#dispose?.()\n    this.#isMounted = false\n  }\n\n  setRouter(router: AnyRouter) {\n    this.#router[1](router)\n  }\n\n  setRouterState(routerState: any) {\n    this.#routerState[1](routerState)\n  }\n\n  setOptions(options: Partial<TanStackRouterDevtoolsCoreOptions>) {\n    if (options.position !== undefined) {\n      this.#position = options.position\n    }\n\n    if (options.initialIsOpen !== undefined) {\n      this.#initialIsOpen = options.initialIsOpen\n    }\n\n    if (options.shadowDOMTarget !== undefined) {\n      this.#shadowDOMTarget = options.shadowDOMTarget\n    }\n\n    if (options.containerElement !== undefined) {\n      this.#containerElement = options.containerElement\n    }\n  }\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/TanStackRouterDevtoolsPanelCore.tsx",
    "content": "import { render } from 'solid-js/web'\nimport { createSignal, lazy } from 'solid-js'\nimport { DevtoolsOnCloseContext, ShadowDomTargetContext } from './context'\nimport type { JSX } from 'solid-js'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport interface TanStackRouterDevtoolsPanelCoreOptions {\n  /**\n   * The standard React style object used to style a component with inline styles\n   */\n  style?: JSX.CSSProperties\n  /**\n   * The standard React class property used to style a component with classes\n   */\n  className?: string\n  /**\n   * A boolean variable indicating whether the panel is open or closed\n   */\n  isOpen?: boolean\n  /**\n   * A function that toggles the open and close state of the panel\n   */\n  setIsOpen?: (isOpen: boolean) => void\n  /**\n   * Handles the opening and closing the devtools panel\n   */\n  handleDragStart?: (e: any) => void\n  /**\n   * A boolean variable indicating if the \"lite\" version of the library is being used\n   */\n  router: AnyRouter\n\n  routerState: any\n  /**\n   * Use this to attach the devtool's styles to specific element in the DOM.\n   */\n  shadowDOMTarget?: ShadowRoot\n}\n\nexport class TanStackRouterDevtoolsPanelCore {\n  #router: any\n  #routerState: any\n  #style: any\n  #className: any\n  #shadowDOMTarget?: ShadowRoot\n  #isMounted = false\n  #setIsOpen?: (isOpen: boolean) => void\n  #dispose?: () => void\n  #Component: any\n\n  constructor(config: TanStackRouterDevtoolsPanelCoreOptions) {\n    const {\n      router,\n      routerState,\n      shadowDOMTarget,\n      setIsOpen,\n      style,\n      className,\n    } = config\n\n    this.#router = createSignal(router)\n    this.#routerState = createSignal(routerState)\n    this.#style = createSignal(style)\n    this.#className = createSignal(className)\n    this.#shadowDOMTarget = shadowDOMTarget\n    this.#setIsOpen = setIsOpen\n  }\n\n  mount<T extends HTMLElement>(el: T) {\n    if (this.#isMounted) {\n      throw new Error('Devtools is already mounted')\n    }\n\n    const dispose = render(() => {\n      const [router] = this.#router\n      const [routerState] = this.#routerState\n      const [style] = this.#style\n      const [className] = this.#className\n      const shadowDOMTarget = this.#shadowDOMTarget\n      const setIsOpen = this.#setIsOpen\n\n      let BaseTanStackRouterDevtoolsPanel\n\n      if (this.#Component) {\n        BaseTanStackRouterDevtoolsPanel = this.#Component\n      } else {\n        BaseTanStackRouterDevtoolsPanel = lazy(\n          () => import('./BaseTanStackRouterDevtoolsPanel'),\n        )\n        this.#Component = BaseTanStackRouterDevtoolsPanel\n      }\n\n      return (\n        <ShadowDomTargetContext.Provider value={shadowDOMTarget}>\n          <DevtoolsOnCloseContext.Provider\n            value={{\n              onCloseClick: () => {},\n            }}\n          >\n            <BaseTanStackRouterDevtoolsPanel\n              router={router}\n              routerState={routerState}\n              shadowDOMTarget={shadowDOMTarget}\n              setIsOpen={setIsOpen}\n              style={style}\n              className={className}\n            />\n          </DevtoolsOnCloseContext.Provider>\n        </ShadowDomTargetContext.Provider>\n      )\n    }, el)\n\n    this.#isMounted = true\n    this.#dispose = dispose\n  }\n\n  unmount() {\n    if (!this.#isMounted) {\n      throw new Error('Devtools is not mounted')\n    }\n    this.#dispose?.()\n    this.#isMounted = false\n  }\n\n  setRouter(router: AnyRouter) {\n    this.#router[1](router)\n  }\n\n  setRouterState(routerState: any) {\n    this.#routerState[1](routerState)\n  }\n\n  setStyle(style: any) {\n    this.#style[1](style)\n  }\n\n  setClassName(className: any) {\n    this.#className[1](className)\n  }\n\n  setOptions(options: Partial<TanStackRouterDevtoolsPanelCoreOptions>) {\n    if (options.shadowDOMTarget !== undefined) {\n      this.#shadowDOMTarget = options.shadowDOMTarget\n    }\n    if (options.router !== undefined) {\n      this.setRouter(options.router)\n    }\n    if (options.routerState !== undefined) {\n      this.setRouterState(options.routerState)\n    }\n\n    if (options.style !== undefined) {\n      this.setStyle(options.style)\n    }\n\n    if (options.className !== undefined) {\n      this.setClassName(options.className)\n    }\n  }\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/context.ts",
    "content": "import { createContext, useContext } from 'solid-js'\n\nexport const ShadowDomTargetContext = createContext<ShadowRoot | undefined>(\n  undefined,\n)\n\nexport const DevtoolsOnCloseContext = createContext<\n  | {\n      onCloseClick: (\n        e: MouseEvent & { currentTarget: HTMLButtonElement; target: Element },\n      ) => void\n    }\n  | undefined\n>(undefined)\n\nexport const useDevtoolsOnClose = () => {\n  const context = useContext(DevtoolsOnCloseContext)\n  if (!context) {\n    throw new Error(\n      'useDevtoolsOnClose must be used within a TanStackRouterDevtools component',\n    )\n  }\n  return context\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/index.tsx",
    "content": "export { TanStackRouterDevtoolsCore } from './TanStackRouterDevtoolsCore'\nexport { TanStackRouterDevtoolsPanelCore } from './TanStackRouterDevtoolsPanelCore'\n"
  },
  {
    "path": "packages/router-devtools-core/src/logo.tsx",
    "content": "import { createUniqueId } from 'solid-js'\n\nexport function TanStackLogo() {\n  const id = createUniqueId()\n  return (\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      enable-background=\"new 0 0 634 633\"\n      viewBox=\"0 0 634 633\"\n    >\n      <g transform=\"translate(1)\">\n        <linearGradient\n          id={`a-${id}`}\n          x1=\"-641.486\"\n          x2=\"-641.486\"\n          y1=\"856.648\"\n          y2=\"855.931\"\n          gradientTransform=\"matrix(633 0 0 -633 406377 542258)\"\n          gradientUnits=\"userSpaceOnUse\"\n        >\n          <stop offset=\"0\" stop-color=\"#6bdaff\"></stop>\n          <stop offset=\"0.319\" stop-color=\"#f9ffb5\"></stop>\n          <stop offset=\"0.706\" stop-color=\"#ffa770\"></stop>\n          <stop offset=\"1\" stop-color=\"#ff7373\"></stop>\n        </linearGradient>\n        <circle\n          cx=\"316.5\"\n          cy=\"316.5\"\n          r=\"316.5\"\n          fill={`url(#a-${id})`}\n          fill-rule=\"evenodd\"\n          clip-rule=\"evenodd\"\n        ></circle>\n        <defs>\n          <filter\n            id={`b-${id}`}\n            width=\"454\"\n            height=\"396.9\"\n            x=\"-137.5\"\n            y=\"412\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`c-${id}`}\n          width=\"454\"\n          height=\"396.9\"\n          x=\"-137.5\"\n          y=\"412\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#b-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <ellipse\n          cx=\"89.5\"\n          cy=\"610.5\"\n          fill=\"#015064\"\n          fill-rule=\"evenodd\"\n          stroke=\"#00CFE2\"\n          stroke-width=\"25\"\n          clip-rule=\"evenodd\"\n          mask={`url(#c-${id})`}\n          rx=\"214.5\"\n          ry=\"186\"\n        ></ellipse>\n        <defs>\n          <filter\n            id={`d-${id}`}\n            width=\"454\"\n            height=\"396.9\"\n            x=\"316.5\"\n            y=\"412\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`e-${id}`}\n          width=\"454\"\n          height=\"396.9\"\n          x=\"316.5\"\n          y=\"412\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#d-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <ellipse\n          cx=\"543.5\"\n          cy=\"610.5\"\n          fill=\"#015064\"\n          fill-rule=\"evenodd\"\n          stroke=\"#00CFE2\"\n          stroke-width=\"25\"\n          clip-rule=\"evenodd\"\n          mask={`url(#e-${id})`}\n          rx=\"214.5\"\n          ry=\"186\"\n        ></ellipse>\n        <defs>\n          <filter\n            id={`f-${id}`}\n            width=\"454\"\n            height=\"396.9\"\n            x=\"-137.5\"\n            y=\"450\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`g-${id}`}\n          width=\"454\"\n          height=\"396.9\"\n          x=\"-137.5\"\n          y=\"450\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#f-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <ellipse\n          cx=\"89.5\"\n          cy=\"648.5\"\n          fill=\"#015064\"\n          fill-rule=\"evenodd\"\n          stroke=\"#00A8B8\"\n          stroke-width=\"25\"\n          clip-rule=\"evenodd\"\n          mask={`url(#g-${id})`}\n          rx=\"214.5\"\n          ry=\"186\"\n        ></ellipse>\n        <defs>\n          <filter\n            id={`h-${id}`}\n            width=\"454\"\n            height=\"396.9\"\n            x=\"316.5\"\n            y=\"450\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`i-${id}`}\n          width=\"454\"\n          height=\"396.9\"\n          x=\"316.5\"\n          y=\"450\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#h-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <ellipse\n          cx=\"543.5\"\n          cy=\"648.5\"\n          fill=\"#015064\"\n          fill-rule=\"evenodd\"\n          stroke=\"#00A8B8\"\n          stroke-width=\"25\"\n          clip-rule=\"evenodd\"\n          mask={`url(#i-${id})`}\n          rx=\"214.5\"\n          ry=\"186\"\n        ></ellipse>\n        <defs>\n          <filter\n            id={`j-${id}`}\n            width=\"454\"\n            height=\"396.9\"\n            x=\"-137.5\"\n            y=\"486\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`k-${id}`}\n          width=\"454\"\n          height=\"396.9\"\n          x=\"-137.5\"\n          y=\"486\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#j-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <ellipse\n          cx=\"89.5\"\n          cy=\"684.5\"\n          fill=\"#015064\"\n          fill-rule=\"evenodd\"\n          stroke=\"#007782\"\n          stroke-width=\"25\"\n          clip-rule=\"evenodd\"\n          mask={`url(#k-${id})`}\n          rx=\"214.5\"\n          ry=\"186\"\n        ></ellipse>\n        <defs>\n          <filter\n            id={`l-${id}`}\n            width=\"454\"\n            height=\"396.9\"\n            x=\"316.5\"\n            y=\"486\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`m-${id}`}\n          width=\"454\"\n          height=\"396.9\"\n          x=\"316.5\"\n          y=\"486\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#l-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <ellipse\n          cx=\"543.5\"\n          cy=\"684.5\"\n          fill=\"#015064\"\n          fill-rule=\"evenodd\"\n          stroke=\"#007782\"\n          stroke-width=\"25\"\n          clip-rule=\"evenodd\"\n          mask={`url(#m-${id})`}\n          rx=\"214.5\"\n          ry=\"186\"\n        ></ellipse>\n        <defs>\n          <filter\n            id={`n-${id}`}\n            width=\"176.9\"\n            height=\"129.3\"\n            x=\"272.2\"\n            y=\"308\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`o-${id}`}\n          width=\"176.9\"\n          height=\"129.3\"\n          x=\"272.2\"\n          y=\"308\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#n-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <g mask={`url(#o-${id})`}>\n          <path\n            fill=\"none\"\n            stroke=\"#000\"\n            stroke-linecap=\"round\"\n            stroke-linejoin=\"bevel\"\n            stroke-width=\"11\"\n            d=\"M436 403.2l-5 28.6m-140-90.3l-10.9 62m52.8-19.4l-4.3 27.1\"\n          ></path>\n          <linearGradient\n            id={`p-${id}`}\n            x1=\"-645.656\"\n            x2=\"-646.499\"\n            y1=\"854.878\"\n            y2=\"854.788\"\n            gradientTransform=\"matrix(-184.159 -32.4722 11.4608 -64.9973 -128419.844 34938.836)\"\n            gradientUnits=\"userSpaceOnUse\"\n          >\n            <stop offset=\"0\" stop-color=\"#ee2700\"></stop>\n            <stop offset=\"1\" stop-color=\"#ff008e\"></stop>\n          </linearGradient>\n          <path\n            fill={`url(#p-${id})`}\n            fill-rule=\"evenodd\"\n            d=\"M344.1 363l97.7 17.2c5.8 2.1 8.2 6.2 7.1 12.1-1 5.9-4.7 9.2-11 9.9l-106-18.7-57.5-59.2c-3.2-4.8-2.9-9.1.8-12.8 3.7-3.7 8.3-4.4 13.7-2.1l55.2 53.6z\"\n            clip-rule=\"evenodd\"\n          ></path>\n          <path\n            fill=\"#D8D8D8\"\n            fill-rule=\"evenodd\"\n            stroke=\"#FFF\"\n            stroke-linecap=\"round\"\n            stroke-linejoin=\"bevel\"\n            stroke-width=\"7\"\n            d=\"M428.3 384.5l.9-6.5m-33.9 1.5l.9-6.5m-34 .5l.9-6.1m-38.9-16.1l4.2-3.9m-25.2-16.1l4.2-3.9\"\n            clip-rule=\"evenodd\"\n          ></path>\n        </g>\n        <defs>\n          <filter\n            id={`q-${id}`}\n            width=\"280.6\"\n            height=\"317.4\"\n            x=\"73.2\"\n            y=\"113.9\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`r-${id}`}\n          width=\"280.6\"\n          height=\"317.4\"\n          x=\"73.2\"\n          y=\"113.9\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#q-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <g mask={`url(#r-${id})`}>\n          <linearGradient\n            id={`s-${id}`}\n            x1=\"-646.8\"\n            x2=\"-646.8\"\n            y1=\"854.844\"\n            y2=\"853.844\"\n            gradientTransform=\"matrix(-100.1751 48.8587 -97.9753 -200.879 19124.773 203538.61)\"\n            gradientUnits=\"userSpaceOnUse\"\n          >\n            <stop offset=\"0\" stop-color=\"#a17500\"></stop>\n            <stop offset=\"1\" stop-color=\"#5d2100\"></stop>\n          </linearGradient>\n          <path\n            fill={`url(#s-${id})`}\n            fill-rule=\"evenodd\"\n            d=\"M192.3 203c8.1 37.3 14 73.6 17.8 109.1 3.8 35.4 2.8 75.2-2.9 119.2l61.2-16.7c-15.6-59-25.2-97.9-28.6-116.6-3.4-18.7-10.8-51.8-22.2-99.6l-25.3 4.6\"\n            clip-rule=\"evenodd\"\n          ></path>\n          <linearGradient\n            id={`t-${id}`}\n            x1=\"-635.467\"\n            x2=\"-635.467\"\n            y1=\"852.115\"\n            y2=\"851.115\"\n            gradientTransform=\"matrix(92.6873 4.8575 2.0257 -38.6535 57323.695 36176.047)\"\n            gradientUnits=\"userSpaceOnUse\"\n          >\n            <stop offset=\"0\" stop-color=\"#2f8a00\"></stop>\n            <stop offset=\"1\" stop-color=\"#90ff57\"></stop>\n          </linearGradient>\n          <path\n            fill={`url(#t-${id})`}\n            fill-rule=\"evenodd\"\n            stroke=\"#2F8A00\"\n            stroke-width=\"13\"\n            d=\"M195 183.9s-12.6-22.1-36.5-29.9c-15.9-5.2-34.4-1.5-55.5 11.1 15.9 14.3 29.5 22.6 40.7 24.9 16.8 3.6 51.3-6.1 51.3-6.1z\"\n            clip-rule=\"evenodd\"\n          ></path>\n          <linearGradient\n            id={`u-${id}`}\n            x1=\"-636.573\"\n            x2=\"-636.573\"\n            y1=\"855.444\"\n            y2=\"854.444\"\n            gradientTransform=\"matrix(109.9945 5.7646 6.3597 -121.3507 64719.133 107659.336)\"\n            gradientUnits=\"userSpaceOnUse\"\n          >\n            <stop offset=\"0\" stop-color=\"#2f8a00\"></stop>\n            <stop offset=\"1\" stop-color=\"#90ff57\"></stop>\n          </linearGradient>\n          <path\n            fill={`url(#u-${id})`}\n            fill-rule=\"evenodd\"\n            stroke=\"#2F8A00\"\n            stroke-width=\"13\"\n            d=\"M194.9 184.5s-47.5-8.5-83.2 15.7c-23.8 16.2-34.3 49.3-31.6 99.3 30.3-27.8 52.1-48.5 65.2-61.9 19.8-20 49.6-53.1 49.6-53.1z\"\n            clip-rule=\"evenodd\"\n          ></path>\n          <linearGradient\n            id={`v-${id}`}\n            x1=\"-632.145\"\n            x2=\"-632.145\"\n            y1=\"854.174\"\n            y2=\"853.174\"\n            gradientTransform=\"matrix(62.9558 3.2994 3.5021 -66.8246 37035.367 59284.227)\"\n            gradientUnits=\"userSpaceOnUse\"\n          >\n            <stop offset=\"0\" stop-color=\"#2f8a00\"></stop>\n            <stop offset=\"1\" stop-color=\"#90ff57\"></stop>\n          </linearGradient>\n          <path\n            fill={`url(#v-${id})`}\n            fill-rule=\"evenodd\"\n            stroke=\"#2F8A00\"\n            stroke-width=\"13\"\n            d=\"M195 183.9c-.8-21.9 6-38 20.6-48.2 14.6-10.2 29.8-15.3 45.5-15.3-6.1 21.4-14.5 35.8-25.2 43.4-10.7 7.5-24.4 14.2-40.9 20.1z\"\n            clip-rule=\"evenodd\"\n          ></path>\n          <linearGradient\n            id={`w-${id}`}\n            x1=\"-638.224\"\n            x2=\"-638.224\"\n            y1=\"853.801\"\n            y2=\"852.801\"\n            gradientTransform=\"matrix(152.4666 7.9904 3.0934 -59.0251 94939.86 55646.855)\"\n            gradientUnits=\"userSpaceOnUse\"\n          >\n            <stop offset=\"0\" stop-color=\"#2f8a00\"></stop>\n            <stop offset=\"1\" stop-color=\"#90ff57\"></stop>\n          </linearGradient>\n          <path\n            fill={`url(#w-${id})`}\n            fill-rule=\"evenodd\"\n            stroke=\"#2F8A00\"\n            stroke-width=\"13\"\n            d=\"M194.9 184.5c31.9-30 64.1-39.7 96.7-29 32.6 10.7 50.8 30.4 54.6 59.1-35.2-5.5-60.4-9.6-75.8-12.1-15.3-2.6-40.5-8.6-75.5-18z\"\n            clip-rule=\"evenodd\"\n          ></path>\n          <linearGradient\n            id={`x-${id}`}\n            x1=\"-637.723\"\n            x2=\"-637.723\"\n            y1=\"855.103\"\n            y2=\"854.103\"\n            gradientTransform=\"matrix(136.467 7.1519 5.2165 -99.5377 82830.875 89859.578)\"\n            gradientUnits=\"userSpaceOnUse\"\n          >\n            <stop offset=\"0\" stop-color=\"#2f8a00\"></stop>\n            <stop offset=\"1\" stop-color=\"#90ff57\"></stop>\n          </linearGradient>\n          <path\n            fill={`url(#x-${id})`}\n            fill-rule=\"evenodd\"\n            stroke=\"#2F8A00\"\n            stroke-width=\"13\"\n            d=\"M194.9 184.5c35.8-7.6 65.6-.2 89.2 22 23.6 22.2 37.7 49 42.3 80.3-39.8-9.7-68.3-23.8-85.5-42.4-17.2-18.5-32.5-38.5-46-59.9z\"\n            clip-rule=\"evenodd\"\n          ></path>\n          <linearGradient\n            id={`y-${id}`}\n            x1=\"-631.79\"\n            x2=\"-631.79\"\n            y1=\"855.872\"\n            y2=\"854.872\"\n            gradientTransform=\"matrix(60.8683 3.19 8.7771 -167.4773 31110.818 145537.61)\"\n            gradientUnits=\"userSpaceOnUse\"\n          >\n            <stop offset=\"0\" stop-color=\"#2f8a00\"></stop>\n            <stop offset=\"1\" stop-color=\"#90ff57\"></stop>\n          </linearGradient>\n          <path\n            fill={`url(#y-${id})`}\n            fill-rule=\"evenodd\"\n            stroke=\"#2F8A00\"\n            stroke-width=\"13\"\n            d=\"M194.9 184.5c-33.6 13.8-53.6 35.7-60.1 65.6-6.5 29.9-3.6 63.1 8.7 99.6 27.4-40.3 43.2-69.6 47.4-88 4.2-18.3 5.5-44.1 4-77.2z\"\n            clip-rule=\"evenodd\"\n          ></path>\n          <path\n            fill=\"none\"\n            stroke=\"#2F8A00\"\n            stroke-linecap=\"round\"\n            stroke-width=\"8\"\n            d=\"M196.5 182.3c-14.8 21.6-25.1 41.4-30.8 59.4-5.7 18-9.4 33-11.1 45.1\"\n          ></path>\n          <path\n            fill=\"none\"\n            stroke=\"#2F8A00\"\n            stroke-linecap=\"round\"\n            stroke-width=\"8\"\n            d=\"M194.8 185.7c-24.4 1.7-43.8 9-58.1 21.8-14.3 12.8-24.7 25.4-31.3 37.8m99.1-68.9c29.7-6.7 52-8.4 67-5 15 3.4 26.9 8.7 35.8 15.9m-110.8-5.9c20.3 9.9 38.2 20.5 53.9 31.9 15.7 11.4 27.4 22.1 35.1 32\"\n          ></path>\n        </g>\n        <defs>\n          <filter\n            id={`z-${id}`}\n            width=\"532\"\n            height=\"633\"\n            x=\"50.5\"\n            y=\"399\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`A-${id}`}\n          width=\"532\"\n          height=\"633\"\n          x=\"50.5\"\n          y=\"399\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#z-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <linearGradient\n          id={`B-${id}`}\n          x1=\"-641.104\"\n          x2=\"-641.278\"\n          y1=\"856.577\"\n          y2=\"856.183\"\n          gradientTransform=\"matrix(532 0 0 -633 341484.5 542657)\"\n          gradientUnits=\"userSpaceOnUse\"\n        >\n          <stop offset=\"0\" stop-color=\"#fff400\"></stop>\n          <stop offset=\"1\" stop-color=\"#3c8700\"></stop>\n        </linearGradient>\n        <ellipse\n          cx=\"316.5\"\n          cy=\"715.5\"\n          fill={`url(#B-${id})`}\n          fill-rule=\"evenodd\"\n          clip-rule=\"evenodd\"\n          mask={`url(#A-${id})`}\n          rx=\"266\"\n          ry=\"316.5\"\n        ></ellipse>\n        <defs>\n          <filter\n            id={`C-${id}`}\n            width=\"288\"\n            height=\"283\"\n            x=\"391\"\n            y=\"-24\"\n            filterUnits=\"userSpaceOnUse\"\n          >\n            <feColorMatrix values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0\"></feColorMatrix>\n          </filter>\n        </defs>\n        <mask\n          id={`D-${id}`}\n          width=\"288\"\n          height=\"283\"\n          x=\"391\"\n          y=\"-24\"\n          maskUnits=\"userSpaceOnUse\"\n        >\n          <g filter={`url(#C-${id})`}>\n            <circle\n              cx=\"316.5\"\n              cy=\"316.5\"\n              r=\"316.5\"\n              fill=\"#FFF\"\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n          </g>\n        </mask>\n        <g mask={`url(#D-${id})`}>\n          <g transform=\"translate(397 -24)\">\n            <linearGradient\n              id={`E-${id}`}\n              x1=\"-1036.672\"\n              x2=\"-1036.672\"\n              y1=\"880.018\"\n              y2=\"879.018\"\n              gradientTransform=\"matrix(227 0 0 -227 235493 199764)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffdf00\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff9d00\"></stop>\n            </linearGradient>\n            <circle\n              cx=\"168.5\"\n              cy=\"113.5\"\n              r=\"113.5\"\n              fill={`url(#E-${id})`}\n              fill-rule=\"evenodd\"\n              clip-rule=\"evenodd\"\n            ></circle>\n            <linearGradient\n              id={`F-${id}`}\n              x1=\"-1017.329\"\n              x2=\"-1018.602\"\n              y1=\"658.003\"\n              y2=\"657.998\"\n              gradientTransform=\"matrix(30 0 0 -1 30558 771)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffa400\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff5e00\"></stop>\n            </linearGradient>\n            <path\n              fill=\"none\"\n              stroke={`url(#F-${id})`}\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"bevel\"\n              stroke-width=\"12\"\n              d=\"M30 113H0\"\n            ></path>\n            <linearGradient\n              id={`G-${id}`}\n              x1=\"-1014.501\"\n              x2=\"-1015.774\"\n              y1=\"839.985\"\n              y2=\"839.935\"\n              gradientTransform=\"matrix(26.5 0 0 -5.5 26925 4696.5)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffa400\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff5e00\"></stop>\n            </linearGradient>\n            <path\n              fill=\"none\"\n              stroke={`url(#G-${id})`}\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"bevel\"\n              stroke-width=\"12\"\n              d=\"M33.5 79.5L7 74\"\n            ></path>\n            <linearGradient\n              id={`H-${id}`}\n              x1=\"-1016.59\"\n              x2=\"-1017.862\"\n              y1=\"852.671\"\n              y2=\"852.595\"\n              gradientTransform=\"matrix(29 0 0 -8 29523 6971)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffa400\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff5e00\"></stop>\n            </linearGradient>\n            <path\n              fill=\"none\"\n              stroke={`url(#H-${id})`}\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"bevel\"\n              stroke-width=\"12\"\n              d=\"M34 146l-29 8\"\n            ></path>\n            <linearGradient\n              id={`I-${id}`}\n              x1=\"-1011.984\"\n              x2=\"-1013.257\"\n              y1=\"863.523\"\n              y2=\"863.229\"\n              gradientTransform=\"matrix(24 0 0 -13 24339 11407)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffa400\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff5e00\"></stop>\n            </linearGradient>\n            <path\n              fill=\"none\"\n              stroke={`url(#I-${id})`}\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"bevel\"\n              stroke-width=\"12\"\n              d=\"M45 177l-24 13\"\n            ></path>\n            <linearGradient\n              id={`J-${id}`}\n              x1=\"-1006.673\"\n              x2=\"-1007.946\"\n              y1=\"869.279\"\n              y2=\"868.376\"\n              gradientTransform=\"matrix(20 0 0 -19 20205 16720)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffa400\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff5e00\"></stop>\n            </linearGradient>\n            <path\n              fill=\"none\"\n              stroke={`url(#J-${id})`}\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"bevel\"\n              stroke-width=\"12\"\n              d=\"M67 204l-20 19\"\n            ></path>\n            <linearGradient\n              id={`K-${id}`}\n              x1=\"-992.85\"\n              x2=\"-993.317\"\n              y1=\"871.258\"\n              y2=\"870.258\"\n              gradientTransform=\"matrix(13.8339 0 0 -22.8467 13825.796 20131.938)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffa400\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff5e00\"></stop>\n            </linearGradient>\n            <path\n              fill=\"none\"\n              stroke={`url(#K-${id})`}\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"bevel\"\n              stroke-width=\"12\"\n              d=\"M94.4 227l-13.8 22.8\"\n            ></path>\n            <linearGradient\n              id={`L-${id}`}\n              x1=\"-953.835\"\n              x2=\"-953.965\"\n              y1=\"871.9\"\n              y2=\"870.9\"\n              gradientTransform=\"matrix(7.5 0 0 -24.5 7278 21605)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffa400\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff5e00\"></stop>\n            </linearGradient>\n            <path\n              fill=\"none\"\n              stroke={`url(#L-${id})`}\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"bevel\"\n              stroke-width=\"12\"\n              d=\"M127.5 243.5L120 268\"\n            ></path>\n            <linearGradient\n              id={`M-${id}`}\n              x1=\"244.504\"\n              x2=\"244.496\"\n              y1=\"871.898\"\n              y2=\"870.898\"\n              gradientTransform=\"matrix(.5 0 0 -24.5 45.5 21614)\"\n              gradientUnits=\"userSpaceOnUse\"\n            >\n              <stop offset=\"0\" stop-color=\"#ffa400\"></stop>\n              <stop offset=\"1\" stop-color=\"#ff5e00\"></stop>\n            </linearGradient>\n            <path\n              fill=\"none\"\n              stroke={`url(#M-${id})`}\n              stroke-linecap=\"round\"\n              stroke-linejoin=\"bevel\"\n              stroke-width=\"12\"\n              d=\"M167.5 252.5l.5 24.5\"\n            ></path>\n          </g>\n        </g>\n      </g>\n    </svg>\n  )\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/theme.tsx",
    "content": "import { createContext, useContext } from 'solid-js'\nimport type { JSX } from 'solid-js'\n\nexport const defaultTheme = {\n  background: '#222222',\n  backgroundAlt: '#292929',\n  foreground: 'white',\n  gray: '#444',\n  grayAlt: '#444',\n  inputBackgroundColor: '#fff',\n  inputTextColor: '#000',\n  success: '#80cb00',\n  danger: '#ff0085',\n  active: '#0099ff',\n  warning: '#ffb200',\n} as const\n\nexport type Theme = typeof defaultTheme\ninterface ProviderProps {\n  theme: Theme\n  children?: JSX.Element\n}\n\nconst ThemeContext = createContext(defaultTheme)\n\nexport function ThemeProvider({ children, theme, ...rest }: ProviderProps) {\n  return (\n    <ThemeContext.Provider value={theme} {...rest}>\n      {children}\n    </ThemeContext.Provider>\n  )\n}\n\nexport function useTheme() {\n  return useContext(ThemeContext)\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/tokens.ts",
    "content": "export const tokens = {\n  colors: {\n    inherit: 'inherit',\n    current: 'currentColor',\n    transparent: 'transparent',\n    black: '#000000',\n    white: '#ffffff',\n    neutral: {\n      50: '#f9fafb',\n      100: '#f2f4f7',\n      200: '#eaecf0',\n      300: '#d0d5dd',\n      400: '#98a2b3',\n      500: '#667085',\n      600: '#475467',\n      700: '#344054',\n      800: '#1d2939',\n      900: '#101828',\n    },\n    darkGray: {\n      50: '#525c7a',\n      100: '#49536e',\n      200: '#414962',\n      300: '#394056',\n      400: '#313749',\n      500: '#292e3d',\n      600: '#212530',\n      700: '#191c24',\n      800: '#111318',\n      900: '#0b0d10',\n    },\n    gray: {\n      50: '#f9fafb',\n      100: '#f2f4f7',\n      200: '#eaecf0',\n      300: '#d0d5dd',\n      400: '#98a2b3',\n      500: '#667085',\n      600: '#475467',\n      700: '#344054',\n      800: '#1d2939',\n      900: '#101828',\n    },\n    blue: {\n      25: '#F5FAFF',\n      50: '#EFF8FF',\n      100: '#D1E9FF',\n      200: '#B2DDFF',\n      300: '#84CAFF',\n      400: '#53B1FD',\n      500: '#2E90FA',\n      600: '#1570EF',\n      700: '#175CD3',\n      800: '#1849A9',\n      900: '#194185',\n    },\n    green: {\n      25: '#F6FEF9',\n      50: '#ECFDF3',\n      100: '#D1FADF',\n      200: '#A6F4C5',\n      300: '#6CE9A6',\n      400: '#32D583',\n      500: '#12B76A',\n      600: '#039855',\n      700: '#027A48',\n      800: '#05603A',\n      900: '#054F31',\n    },\n    red: {\n      50: '#fef2f2',\n      100: '#fee2e2',\n      200: '#fecaca',\n      300: '#fca5a5',\n      400: '#f87171',\n      500: '#ef4444',\n      600: '#dc2626',\n      700: '#b91c1c',\n      800: '#991b1b',\n      900: '#7f1d1d',\n      950: '#450a0a',\n    },\n    yellow: {\n      25: '#FFFCF5',\n      50: '#FFFAEB',\n      100: '#FEF0C7',\n      200: '#FEDF89',\n      300: '#FEC84B',\n      400: '#FDB022',\n      500: '#F79009',\n      600: '#DC6803',\n      700: '#B54708',\n      800: '#93370D',\n      900: '#7A2E0E',\n    },\n    purple: {\n      25: '#FAFAFF',\n      50: '#F4F3FF',\n      100: '#EBE9FE',\n      200: '#D9D6FE',\n      300: '#BDB4FE',\n      400: '#9B8AFB',\n      500: '#7A5AF8',\n      600: '#6938EF',\n      700: '#5925DC',\n      800: '#4A1FB8',\n      900: '#3E1C96',\n    },\n    teal: {\n      25: '#F6FEFC',\n      50: '#F0FDF9',\n      100: '#CCFBEF',\n      200: '#99F6E0',\n      300: '#5FE9D0',\n      400: '#2ED3B7',\n      500: '#15B79E',\n      600: '#0E9384',\n      700: '#107569',\n      800: '#125D56',\n      900: '#134E48',\n    },\n    pink: {\n      25: '#fdf2f8',\n      50: '#fce7f3',\n      100: '#fbcfe8',\n      200: '#f9a8d4',\n      300: '#f472b6',\n      400: '#ec4899',\n      500: '#db2777',\n      600: '#be185d',\n      700: '#9d174d',\n      800: '#831843',\n      900: '#500724',\n    },\n    cyan: {\n      25: '#ecfeff',\n      50: '#cffafe',\n      100: '#a5f3fc',\n      200: '#67e8f9',\n      300: '#22d3ee',\n      400: '#06b6d4',\n      500: '#0891b2',\n      600: '#0e7490',\n      700: '#155e75',\n      800: '#164e63',\n      900: '#083344',\n    },\n  },\n  alpha: {\n    100: 'ff',\n    90: 'e5',\n    80: 'cc',\n    70: 'b3',\n    60: '99',\n    50: '80',\n    40: '66',\n    30: '4d',\n    20: '33',\n    10: '1a',\n    0: '00',\n  },\n  font: {\n    size: {\n      '2xs': 'calc(var(--tsrd-font-size) * 0.625)',\n      xs: 'calc(var(--tsrd-font-size) * 0.75)',\n      sm: 'calc(var(--tsrd-font-size) * 0.875)',\n      md: 'var(--tsrd-font-size)',\n      lg: 'calc(var(--tsrd-font-size) * 1.125)',\n      xl: 'calc(var(--tsrd-font-size) * 1.25)',\n      '2xl': 'calc(var(--tsrd-font-size) * 1.5)',\n      '3xl': 'calc(var(--tsrd-font-size) * 1.875)',\n      '4xl': 'calc(var(--tsrd-font-size) * 2.25)',\n      '5xl': 'calc(var(--tsrd-font-size) * 3)',\n      '6xl': 'calc(var(--tsrd-font-size) * 3.75)',\n      '7xl': 'calc(var(--tsrd-font-size) * 4.5)',\n      '8xl': 'calc(var(--tsrd-font-size) * 6)',\n      '9xl': 'calc(var(--tsrd-font-size) * 8)',\n    },\n    lineHeight: {\n      '3xs': 'calc(var(--tsrd-font-size) * 0.75)',\n      '2xs': 'calc(var(--tsrd-font-size) * 0.875)',\n      xs: 'calc(var(--tsrd-font-size) * 1)',\n      sm: 'calc(var(--tsrd-font-size) * 1.25)',\n      md: 'calc(var(--tsrd-font-size) * 1.5)',\n      lg: 'calc(var(--tsrd-font-size) * 1.75)',\n      xl: 'calc(var(--tsrd-font-size) * 2)',\n      '2xl': 'calc(var(--tsrd-font-size) * 2.25)',\n      '3xl': 'calc(var(--tsrd-font-size) * 2.5)',\n      '4xl': 'calc(var(--tsrd-font-size) * 2.75)',\n      '5xl': 'calc(var(--tsrd-font-size) * 3)',\n      '6xl': 'calc(var(--tsrd-font-size) * 3.25)',\n      '7xl': 'calc(var(--tsrd-font-size) * 3.5)',\n      '8xl': 'calc(var(--tsrd-font-size) * 3.75)',\n      '9xl': 'calc(var(--tsrd-font-size) * 4)',\n    },\n    weight: {\n      thin: '100',\n      extralight: '200',\n      light: '300',\n      normal: '400',\n      medium: '500',\n      semibold: '600',\n      bold: '700',\n      extrabold: '800',\n      black: '900',\n    },\n    fontFamily: {\n      sans: 'ui-sans-serif, Inter, system-ui, sans-serif, sans-serif',\n      mono: `ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace`,\n    },\n  },\n  breakpoints: {\n    xs: '320px',\n    sm: '640px',\n    md: '768px',\n    lg: '1024px',\n    xl: '1280px',\n    '2xl': '1536px',\n  },\n  border: {\n    radius: {\n      none: '0px',\n      xs: 'calc(var(--tsrd-font-size) * 0.125)',\n      sm: 'calc(var(--tsrd-font-size) * 0.25)',\n      md: 'calc(var(--tsrd-font-size) * 0.375)',\n      lg: 'calc(var(--tsrd-font-size) * 0.5)',\n      xl: 'calc(var(--tsrd-font-size) * 0.75)',\n      '2xl': 'calc(var(--tsrd-font-size) * 1)',\n      '3xl': 'calc(var(--tsrd-font-size) * 1.5)',\n      full: '9999px',\n    },\n  },\n  size: {\n    0: '0px',\n    0.25: 'calc(var(--tsrd-font-size) * 0.0625)',\n    0.5: 'calc(var(--tsrd-font-size) * 0.125)',\n    1: 'calc(var(--tsrd-font-size) * 0.25)',\n    1.5: 'calc(var(--tsrd-font-size) * 0.375)',\n    2: 'calc(var(--tsrd-font-size) * 0.5)',\n    2.5: 'calc(var(--tsrd-font-size) * 0.625)',\n    3: 'calc(var(--tsrd-font-size) * 0.75)',\n    3.5: 'calc(var(--tsrd-font-size) * 0.875)',\n    4: 'calc(var(--tsrd-font-size) * 1)',\n    4.5: 'calc(var(--tsrd-font-size) * 1.125)',\n    5: 'calc(var(--tsrd-font-size) * 1.25)',\n    5.5: 'calc(var(--tsrd-font-size) * 1.375)',\n    6: 'calc(var(--tsrd-font-size) * 1.5)',\n    6.5: 'calc(var(--tsrd-font-size) * 1.625)',\n    7: 'calc(var(--tsrd-font-size) * 1.75)',\n    8: 'calc(var(--tsrd-font-size) * 2)',\n    9: 'calc(var(--tsrd-font-size) * 2.25)',\n    10: 'calc(var(--tsrd-font-size) * 2.5)',\n    11: 'calc(var(--tsrd-font-size) * 2.75)',\n    12: 'calc(var(--tsrd-font-size) * 3)',\n    14: 'calc(var(--tsrd-font-size) * 3.5)',\n    16: 'calc(var(--tsrd-font-size) * 4)',\n    20: 'calc(var(--tsrd-font-size) * 5)',\n    24: 'calc(var(--tsrd-font-size) * 6)',\n    28: 'calc(var(--tsrd-font-size) * 7)',\n    32: 'calc(var(--tsrd-font-size) * 8)',\n    36: 'calc(var(--tsrd-font-size) * 9)',\n    40: 'calc(var(--tsrd-font-size) * 10)',\n    44: 'calc(var(--tsrd-font-size) * 11)',\n    48: 'calc(var(--tsrd-font-size) * 12)',\n    52: 'calc(var(--tsrd-font-size) * 13)',\n    56: 'calc(var(--tsrd-font-size) * 14)',\n    60: 'calc(var(--tsrd-font-size) * 15)',\n    64: 'calc(var(--tsrd-font-size) * 16)',\n    72: 'calc(var(--tsrd-font-size) * 18)',\n    80: 'calc(var(--tsrd-font-size) * 20)',\n    96: 'calc(var(--tsrd-font-size) * 24)',\n  },\n  shadow: {\n    xs: (_: string = 'rgb(0 0 0 / 0.1)') =>\n      `0 1px 2px 0 rgb(0 0 0 / 0.05)` as const,\n    sm: (color: string = 'rgb(0 0 0 / 0.1)') =>\n      `0 1px 3px 0 ${color}, 0 1px 2px -1px ${color}` as const,\n    md: (color: string = 'rgb(0 0 0 / 0.1)') =>\n      `0 4px 6px -1px ${color}, 0 2px 4px -2px ${color}` as const,\n    lg: (color: string = 'rgb(0 0 0 / 0.1)') =>\n      `0 10px 15px -3px ${color}, 0 4px 6px -4px ${color}` as const,\n    xl: (color: string = 'rgb(0 0 0 / 0.1)') =>\n      `0 20px 25px -5px ${color}, 0 8px 10px -6px ${color}` as const,\n    '2xl': (color: string = 'rgb(0 0 0 / 0.25)') =>\n      `0 25px 50px -12px ${color}` as const,\n    inner: (color: string = 'rgb(0 0 0 / 0.05)') =>\n      `inset 0 2px 4px 0 ${color}` as const,\n    none: () => `none` as const,\n  },\n  zIndices: {\n    hide: -1,\n    auto: 'auto',\n    base: 0,\n    docked: 10,\n    dropdown: 1000,\n    sticky: 1100,\n    banner: 1200,\n    overlay: 1300,\n    modal: 1400,\n    popover: 1500,\n    skipLink: 1600,\n    toast: 1700,\n    tooltip: 1800,\n  },\n} as const\n"
  },
  {
    "path": "packages/router-devtools-core/src/useLocalStorage.ts",
    "content": "import { createEffect, createSignal } from 'solid-js'\nimport type { Accessor } from 'solid-js'\n\nconst getItem = (key: string): unknown => {\n  try {\n    const itemValue = localStorage.getItem(key)\n    if (typeof itemValue === 'string') {\n      return JSON.parse(itemValue)\n    }\n    return undefined\n  } catch {\n    return undefined\n  }\n}\n\nexport default function useLocalStorage<T>(\n  key: string,\n  defaultValue: T | undefined,\n): [Accessor<T | undefined>, (newVal: T | ((prevVal: T) => T)) => void] {\n  const [value, setValue] = createSignal<T>()\n\n  createEffect(() => {\n    const initialValue = getItem(key) as T | undefined\n\n    if (typeof initialValue === 'undefined' || initialValue === null) {\n      setValue(\n        typeof defaultValue === 'function' ? defaultValue() : defaultValue,\n      )\n    } else {\n      // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n      // @ts-ignore\n      setValue(initialValue)\n    }\n  })\n\n  const setter = (updater: any) => {\n    setValue((old) => {\n      let newVal = updater\n\n      if (typeof updater == 'function') {\n        newVal = updater(old)\n      }\n      try {\n        localStorage.setItem(key, JSON.stringify(newVal))\n      } catch {}\n\n      return newVal\n    })\n  }\n\n  return [value, setter]\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/useMediaQuery.ts",
    "content": "import { createEffect, createSignal } from 'solid-js'\nimport type { Accessor } from 'solid-js'\n\nexport default function useMediaQuery(\n  query: string,\n): Accessor<boolean | undefined> {\n  // Keep track of the preference in state, start with the current match\n  const [isMatch, setIsMatch] = createSignal(() => {\n    if (typeof window !== 'undefined') {\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      return window.matchMedia && window.matchMedia(query).matches\n    }\n    return\n  })\n\n  // Watch for changes\n  createEffect(() => {\n    if (typeof window !== 'undefined') {\n      // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n      if (!window.matchMedia) {\n        return\n      }\n\n      // Create a matcher\n      const matcher = window.matchMedia(query)\n\n      // Create our handler\n      const onChange = ({ matches }: { matches: boolean }) =>\n        setIsMatch(() => () => matches)\n\n      // Listen for changes\n      matcher.addListener(onChange)\n\n      return () => {\n        // Stop listening for changes\n        matcher.removeListener(onChange)\n      }\n    }\n\n    return\n  })\n\n  return isMatch()\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/useStyles.tsx",
    "content": "import * as goober from 'goober'\nimport { createSignal, useContext } from 'solid-js'\nimport { tokens } from './tokens'\nimport { ShadowDomTargetContext } from './context'\nimport type { Accessor } from 'solid-js'\n\nconst stylesFactory = (shadowDOMTarget?: ShadowRoot) => {\n  const { colors, font, size, alpha, shadow, border } = tokens\n  const { fontFamily, lineHeight, size: fontSize } = font\n  const css = shadowDOMTarget\n    ? goober.css.bind({ target: shadowDOMTarget })\n    : goober.css\n\n  return {\n    devtoolsPanelContainer: css`\n      direction: ltr;\n      position: fixed;\n      bottom: 0;\n      right: 0;\n      z-index: 99999;\n      width: 100%;\n      max-height: 90%;\n      border-top: 1px solid ${colors.gray[700]};\n      transform-origin: top;\n    `,\n    devtoolsPanelContainerVisibility: (isOpen: boolean) => {\n      return css`\n        visibility: ${isOpen ? 'visible' : 'hidden'};\n      `\n    },\n    devtoolsPanelContainerResizing: (isResizing: Accessor<boolean>) => {\n      if (isResizing()) {\n        return css`\n          transition: none;\n        `\n      }\n\n      return css`\n        transition: all 0.4s ease;\n      `\n    },\n    devtoolsPanelContainerAnimation: (isOpen: boolean, height: number) => {\n      if (isOpen) {\n        return css`\n          pointer-events: auto;\n          transform: translateY(0);\n        `\n      }\n      return css`\n        pointer-events: none;\n        transform: translateY(${height}px);\n      `\n    },\n    logo: css`\n      cursor: pointer;\n      display: flex;\n      flex-direction: column;\n      background-color: transparent;\n      border: none;\n      font-family: ${fontFamily.sans};\n      gap: ${tokens.size[0.5]};\n      padding: 0px;\n      &:hover {\n        opacity: 0.7;\n      }\n      &:focus-visible {\n        outline-offset: 4px;\n        border-radius: ${border.radius.xs};\n        outline: 2px solid ${colors.blue[800]};\n      }\n    `,\n    tanstackLogo: css`\n      font-size: ${font.size.md};\n      font-weight: ${font.weight.bold};\n      line-height: ${font.lineHeight.xs};\n      white-space: nowrap;\n      color: ${colors.gray[300]};\n    `,\n    routerLogo: css`\n      font-weight: ${font.weight.semibold};\n      font-size: ${font.size.xs};\n      background: linear-gradient(to right, #84cc16, #10b981);\n      background-clip: text;\n      -webkit-background-clip: text;\n      line-height: 1;\n      -webkit-text-fill-color: transparent;\n      white-space: nowrap;\n    `,\n    devtoolsPanel: css`\n      display: flex;\n      font-size: ${fontSize.sm};\n      font-family: ${fontFamily.sans};\n      background-color: ${colors.darkGray[700]};\n      color: ${colors.gray[300]};\n\n      @media (max-width: 700px) {\n        flex-direction: column;\n      }\n      @media (max-width: 600px) {\n        font-size: ${fontSize.xs};\n      }\n    `,\n    dragHandle: css`\n      position: absolute;\n      left: 0;\n      top: 0;\n      width: 100%;\n      height: 4px;\n      cursor: row-resize;\n      z-index: 100000;\n      &:hover {\n        background-color: ${colors.purple[400]}${alpha[90]};\n      }\n    `,\n    firstContainer: css`\n      flex: 1 1 500px;\n      min-height: 40%;\n      max-height: 100%;\n      overflow: auto;\n      border-right: 1px solid ${colors.gray[700]};\n      display: flex;\n      flex-direction: column;\n    `,\n    routerExplorerContainer: css`\n      overflow-y: auto;\n      flex: 1;\n    `,\n    routerExplorer: css`\n      padding: ${tokens.size[2]};\n    `,\n    row: css`\n      display: flex;\n      align-items: center;\n      padding: ${tokens.size[2]} ${tokens.size[2.5]};\n      gap: ${tokens.size[2.5]};\n      border-bottom: ${colors.darkGray[500]} 1px solid;\n      align-items: center;\n    `,\n    detailsHeader: css`\n      font-family: ui-sans-serif, Inter, system-ui, sans-serif, sans-serif;\n      position: sticky;\n      top: 0;\n      z-index: 2;\n      background-color: ${colors.darkGray[600]};\n      padding: 0px ${tokens.size[2]};\n      font-weight: ${font.weight.medium};\n      font-size: ${font.size.xs};\n      min-height: ${tokens.size[8]};\n      line-height: ${font.lineHeight.xs};\n      text-align: left;\n      display: flex;\n      align-items: center;\n    `,\n    maskedBadge: css`\n      background: ${colors.yellow[900]}${alpha[70]};\n      color: ${colors.yellow[300]};\n      display: inline-block;\n      padding: ${tokens.size[0]} ${tokens.size[2.5]};\n      border-radius: ${border.radius.full};\n      font-size: ${font.size.xs};\n      font-weight: ${font.weight.normal};\n      border: 1px solid ${colors.yellow[300]};\n    `,\n    maskedLocation: css`\n      color: ${colors.yellow[300]};\n    `,\n    detailsContent: css`\n      padding: ${tokens.size[1.5]} ${tokens.size[2]};\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n      font-size: ${font.size.xs};\n    `,\n    routeMatchesToggle: css`\n      display: flex;\n      align-items: center;\n      border: 1px solid ${colors.gray[500]};\n      border-radius: ${border.radius.sm};\n      overflow: hidden;\n    `,\n    routeMatchesToggleBtn: (active: boolean, showBorder: boolean) => {\n      const base = css`\n        appearance: none;\n        border: none;\n        font-size: 12px;\n        padding: 4px 8px;\n        background: transparent;\n        cursor: pointer;\n        font-family: ${fontFamily.sans};\n        font-weight: ${font.weight.medium};\n      `\n      const classes = [base]\n\n      if (active) {\n        const activeStyles = css`\n          background: ${colors.darkGray[400]};\n          color: ${colors.gray[300]};\n        `\n        classes.push(activeStyles)\n      } else {\n        const inactiveStyles = css`\n          color: ${colors.gray[500]};\n          background: ${colors.darkGray[800]}${alpha[20]};\n        `\n        classes.push(inactiveStyles)\n      }\n\n      if (showBorder) {\n        classes.push(css`\n          border-right: 1px solid ${tokens.colors.gray[500]};\n        `)\n      }\n\n      return classes\n    },\n    detailsHeaderInfo: css`\n      flex: 1;\n      justify-content: flex-end;\n      display: flex;\n      align-items: center;\n      font-weight: ${font.weight.normal};\n      color: ${colors.gray[400]};\n    `,\n    matchRow: (active: boolean) => {\n      const base = css`\n        display: flex;\n        border-bottom: 1px solid ${colors.darkGray[400]};\n        cursor: pointer;\n        align-items: center;\n        padding: ${size[1]} ${size[2]};\n        gap: ${size[2]};\n        font-size: ${fontSize.xs};\n        color: ${colors.gray[300]};\n      `\n      const classes = [base]\n\n      if (active) {\n        const activeStyles = css`\n          background: ${colors.darkGray[500]};\n        `\n        classes.push(activeStyles)\n      }\n\n      return classes\n    },\n    matchIndicator: (\n      color: 'green' | 'red' | 'yellow' | 'gray' | 'blue' | 'purple',\n    ) => {\n      const base = css`\n        flex: 0 0 auto;\n        width: ${size[3]};\n        height: ${size[3]};\n        background: ${colors[color][900]};\n        border: 1px solid ${colors[color][500]};\n        border-radius: ${border.radius.full};\n        transition: all 0.25s ease-out;\n        box-sizing: border-box;\n      `\n      const classes = [base]\n\n      if (color === 'gray') {\n        const grayStyles = css`\n          background: ${colors.gray[700]};\n          border-color: ${colors.gray[400]};\n        `\n        classes.push(grayStyles)\n      }\n\n      return classes\n    },\n    matchID: css`\n      flex: 1;\n      line-height: ${lineHeight['xs']};\n    `,\n    ageTicker: (showWarning: boolean) => {\n      const base = css`\n        display: flex;\n        gap: ${size[1]};\n        font-size: ${fontSize.xs};\n        color: ${colors.gray[400]};\n        font-variant-numeric: tabular-nums;\n        line-height: ${lineHeight['xs']};\n      `\n\n      const classes = [base]\n\n      if (showWarning) {\n        const warningStyles = css`\n          color: ${colors.yellow[400]};\n        `\n        classes.push(warningStyles)\n      }\n\n      return classes\n    },\n    secondContainer: css`\n      flex: 1 1 500px;\n      min-height: 40%;\n      max-height: 100%;\n      overflow: auto;\n      border-right: 1px solid ${colors.gray[700]};\n      display: flex;\n      flex-direction: column;\n    `,\n    thirdContainer: css`\n      flex: 1 1 500px;\n      overflow: auto;\n      display: flex;\n      flex-direction: column;\n      height: 100%;\n      border-right: 1px solid ${colors.gray[700]};\n\n      @media (max-width: 700px) {\n        border-top: 2px solid ${colors.gray[700]};\n      }\n    `,\n    fourthContainer: css`\n      flex: 1 1 500px;\n      min-height: 40%;\n      max-height: 100%;\n      overflow: auto;\n      display: flex;\n      flex-direction: column;\n    `,\n    routesContainer: css`\n      overflow-x: auto;\n      overflow-y: visible;\n    `,\n    routesRowContainer: (active: boolean, isMatch: boolean) => {\n      const base = css`\n        display: flex;\n        border-bottom: 1px solid ${colors.darkGray[400]};\n        align-items: center;\n        padding: ${size[1]} ${size[2]};\n        gap: ${size[2]};\n        font-size: ${fontSize.xs};\n        color: ${colors.gray[300]};\n        cursor: ${isMatch ? 'pointer' : 'default'};\n        line-height: ${lineHeight['xs']};\n      `\n      const classes = [base]\n\n      if (active) {\n        const activeStyles = css`\n          background: ${colors.darkGray[500]};\n        `\n        classes.push(activeStyles)\n      }\n\n      return classes\n    },\n    routesRow: (isMatch: boolean) => {\n      const base = css`\n        flex: 1 0 auto;\n        display: flex;\n        justify-content: space-between;\n        align-items: center;\n        font-size: ${fontSize.xs};\n        line-height: ${lineHeight['xs']};\n      `\n\n      const classes = [base]\n\n      if (!isMatch) {\n        const matchStyles = css`\n          color: ${colors.gray[400]};\n        `\n        classes.push(matchStyles)\n      }\n\n      return classes\n    },\n    routesRowInner: css`\n      display: 'flex';\n      align-items: 'center';\n      flex-grow: 1;\n      min-width: 0;\n    `,\n    routeParamInfo: css`\n      color: ${colors.gray[400]};\n      font-size: ${fontSize.xs};\n      line-height: ${lineHeight['xs']};\n    `,\n    nestedRouteRow: (isRoot: boolean) => {\n      const base = css`\n        margin-left: ${isRoot ? 0 : size[3.5]};\n        border-left: ${isRoot ? '' : `solid 1px ${colors.gray[700]}`};\n      `\n      return base\n    },\n    code: css`\n      font-size: ${fontSize.xs};\n      line-height: ${lineHeight['xs']};\n      white-space: nowrap;\n      overflow: hidden;\n      text-overflow: ellipsis;\n    `,\n    matchesContainer: css`\n      flex: 1 1 auto;\n      overflow-y: auto;\n    `,\n    cachedMatchesContainer: css`\n      flex: 1 1 auto;\n      overflow-y: auto;\n      max-height: 50%;\n    `,\n    historyContainer: css`\n      display: flex;\n      flex: 1 1 auto;\n      overflow-y: auto;\n      max-height: 50%;\n    `,\n    historyOverflowContainer: css`\n      padding: ${size[1]} ${size[2]};\n      font-size: ${tokens.font.size.xs};\n    `,\n    maskedBadgeContainer: css`\n      flex: 1;\n      justify-content: flex-end;\n      display: flex;\n    `,\n    matchDetails: css`\n      display: flex;\n      flex-direction: column;\n      padding: ${tokens.size[2]};\n      font-size: ${tokens.font.size.xs};\n      color: ${tokens.colors.gray[300]};\n      line-height: ${tokens.font.lineHeight.sm};\n    `,\n    matchStatus: (\n      status: 'pending' | 'success' | 'error' | 'notFound' | 'redirected',\n      isFetching: false | 'beforeLoad' | 'loader',\n    ) => {\n      const colorMap = {\n        pending: 'yellow',\n        success: 'green',\n        error: 'red',\n        notFound: 'purple',\n        redirected: 'gray',\n      } as const\n\n      const color =\n        isFetching && status === 'success'\n          ? isFetching === 'beforeLoad'\n            ? 'purple'\n            : 'blue'\n          : colorMap[status]\n\n      return css`\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        height: 40px;\n        border-radius: ${tokens.border.radius.sm};\n        font-weight: ${tokens.font.weight.normal};\n        background-color: ${tokens.colors[color][900]}${tokens.alpha[90]};\n        color: ${tokens.colors[color][300]};\n        border: 1px solid ${tokens.colors[color][600]};\n        margin-bottom: ${tokens.size[2]};\n        transition: all 0.25s ease-out;\n      `\n    },\n    matchDetailsInfo: css`\n      display: flex;\n      justify-content: flex-end;\n      flex: 1;\n    `,\n    matchDetailsInfoLabel: css`\n      display: flex;\n    `,\n    mainCloseBtn: css`\n      background: ${colors.darkGray[700]};\n      padding: ${size[1]} ${size[2]} ${size[1]} ${size[1.5]};\n      border-radius: ${border.radius.md};\n      position: fixed;\n      z-index: 99999;\n      display: inline-flex;\n      width: fit-content;\n      cursor: pointer;\n      appearance: none;\n      border: 0;\n      gap: 8px;\n      align-items: center;\n      border: 1px solid ${colors.gray[500]};\n      font-size: ${font.size.xs};\n      cursor: pointer;\n      transition: all 0.25s ease-out;\n\n      &:hover {\n        background: ${colors.darkGray[500]};\n      }\n    `,\n    mainCloseBtnPosition: (\n      position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right',\n    ) => {\n      const base = css`\n        ${position === 'top-left' ? `top: ${size[2]}; left: ${size[2]};` : ''}\n        ${position === 'top-right' ? `top: ${size[2]}; right: ${size[2]};` : ''}\n        ${position === 'bottom-left'\n          ? `bottom: ${size[2]}; left: ${size[2]};`\n          : ''}\n        ${position === 'bottom-right'\n          ? `bottom: ${size[2]}; right: ${size[2]};`\n          : ''}\n      `\n      return base\n    },\n    mainCloseBtnAnimation: (isOpen: boolean) => {\n      if (!isOpen) {\n        return css`\n          opacity: 1;\n          pointer-events: auto;\n          visibility: visible;\n        `\n      }\n      return css`\n        opacity: 0;\n        pointer-events: none;\n        visibility: hidden;\n      `\n    },\n    routerLogoCloseButton: css`\n      font-weight: ${font.weight.semibold};\n      font-size: ${font.size.xs};\n      background: linear-gradient(to right, #98f30c, #00f4a3);\n      background-clip: text;\n      -webkit-background-clip: text;\n      line-height: 1;\n      -webkit-text-fill-color: transparent;\n      white-space: nowrap;\n    `,\n    mainCloseBtnDivider: css`\n      width: 1px;\n      background: ${tokens.colors.gray[600]};\n      height: 100%;\n      border-radius: 999999px;\n      color: transparent;\n    `,\n    mainCloseBtnIconContainer: css`\n      position: relative;\n      width: ${size[5]};\n      height: ${size[5]};\n      background: pink;\n      border-radius: 999999px;\n      overflow: hidden;\n    `,\n    mainCloseBtnIconOuter: css`\n      width: ${size[5]};\n      height: ${size[5]};\n      position: absolute;\n      top: 50%;\n      left: 50%;\n      transform: translate(-50%, -50%);\n      filter: blur(3px) saturate(1.8) contrast(2);\n    `,\n    mainCloseBtnIconInner: css`\n      width: ${size[4]};\n      height: ${size[4]};\n      position: absolute;\n      top: 50%;\n      left: 50%;\n      transform: translate(-50%, -50%);\n    `,\n    panelCloseBtn: css`\n      position: absolute;\n      cursor: pointer;\n      z-index: 100001;\n      display: flex;\n      align-items: center;\n      justify-content: center;\n      outline: none;\n      background-color: ${colors.darkGray[700]};\n      &:hover {\n        background-color: ${colors.darkGray[500]};\n      }\n\n      top: 0;\n      right: ${size[2]};\n      transform: translate(0, -100%);\n      border-right: ${colors.darkGray[300]} 1px solid;\n      border-left: ${colors.darkGray[300]} 1px solid;\n      border-top: ${colors.darkGray[300]} 1px solid;\n      border-bottom: none;\n      border-radius: ${border.radius.sm} ${border.radius.sm} 0px 0px;\n      padding: ${size[1]} ${size[1.5]} ${size[0.5]} ${size[1.5]};\n\n      &::after {\n        content: ' ';\n        position: absolute;\n        top: 100%;\n        left: -${size[2.5]};\n        height: ${size[1.5]};\n        width: calc(100% + ${size[5]});\n      }\n    `,\n    panelCloseBtnIcon: css`\n      color: ${colors.gray[400]};\n      width: ${size[2]};\n      height: ${size[2]};\n    `,\n    navigateButton: css`\n      background: none;\n      border: none;\n      padding: 0 0 0 4px;\n      margin: 0;\n      color: ${colors.gray[400]};\n      font-size: ${fontSize.md};\n      cursor: pointer;\n      line-height: 1;\n      vertical-align: middle;\n      margin-right: 0.5ch;\n      flex-shrink: 0;\n      &:hover {\n        color: ${colors.blue[300]};\n      }\n    `,\n  }\n}\n\nexport function useStyles() {\n  const shadowDomTarget = useContext(ShadowDomTargetContext)\n  const [_styles] = createSignal(stylesFactory(shadowDomTarget))\n  return _styles\n}\n"
  },
  {
    "path": "packages/router-devtools-core/src/utils.tsx",
    "content": "import { Dynamic } from 'solid-js/web'\nimport { createEffect, createRenderEffect, createSignal } from 'solid-js'\nimport { useTheme } from './theme'\nimport useMediaQuery from './useMediaQuery'\nimport type { AnyRoute, AnyRouteMatch } from '@tanstack/router-core'\n\nimport type { Theme } from './theme'\nimport type { JSX } from 'solid-js'\n\nexport const isServer = typeof window === 'undefined'\n\ntype StyledComponent<T> = T extends 'button'\n  ? JSX.ButtonHTMLAttributes<HTMLButtonElement>\n  : T extends 'input'\n    ? JSX.InputHTMLAttributes<HTMLInputElement>\n    : T extends 'select'\n      ? JSX.SelectHTMLAttributes<HTMLSelectElement>\n      : T extends keyof HTMLElementTagNameMap\n        ? JSX.HTMLAttributes<HTMLElementTagNameMap[T]>\n        : never\n\nexport function getStatusColor(match: AnyRouteMatch) {\n  const colorMap = {\n    pending: 'yellow',\n    success: 'green',\n    error: 'red',\n    notFound: 'purple',\n    redirected: 'gray',\n  } as const\n\n  return match.isFetching && match.status === 'success'\n    ? match.isFetching === 'beforeLoad'\n      ? 'purple'\n      : 'blue'\n    : colorMap[match.status]\n}\n\nexport function getRouteStatusColor(\n  matches: Array<AnyRouteMatch>,\n  route: AnyRoute,\n) {\n  const found = matches.find((d) => d.routeId === route.id)\n  if (!found) return 'gray'\n  return getStatusColor(found)\n}\n\ntype Styles =\n  | JSX.CSSProperties\n  | ((props: Record<string, any>, theme: Theme) => JSX.CSSProperties)\n\nexport function styled<T extends keyof HTMLElementTagNameMap>(\n  type: T,\n  newStyles: Styles,\n  queries: Record<string, Styles> = {},\n) {\n  return ({\n    ref,\n    style,\n    ...rest\n  }: StyledComponent<T> & {\n    ref?: HTMLElementTagNameMap[T] | undefined\n  }) => {\n    const theme = useTheme()\n\n    const mediaStyles = Object.entries(queries).reduce(\n      (current, [key, value]) => {\n        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n        return useMediaQuery(key)\n          ? {\n              ...current,\n              ...(typeof value === 'function' ? value(rest, theme) : value),\n            }\n          : current\n      },\n      {},\n    )\n\n    const baseStyles =\n      typeof newStyles === 'function' ? newStyles(rest, theme) : newStyles\n\n    // Handle style being either a string or an object\n    const combinedStyles =\n      typeof style === 'string'\n        ? { ...baseStyles, ...mediaStyles, cssText: style }\n        : { ...baseStyles, ...style, ...mediaStyles }\n\n    return (\n      // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n      // @ts-ignore\n      <Dynamic component={type} {...rest} style={combinedStyles} ref={ref} />\n    )\n  }\n}\n\nexport function useIsMounted() {\n  const [isMounted, setIsMounted] = createSignal(false)\n\n  const effect = isServer ? createEffect : createRenderEffect\n\n  effect(() => {\n    setIsMounted(true)\n  })\n\n  return isMounted\n}\n\n/**\n * Displays a string regardless the type of the data\n * @param {unknown} value Value to be stringified\n */\nexport const displayValue = (value: unknown) => {\n  const name = Object.getOwnPropertyNames(Object(value))\n  const newValue = typeof value === 'bigint' ? `${value.toString()}n` : value\n  try {\n    return JSON.stringify(newValue, name)\n  } catch (e) {\n    return `unable to stringify`\n  }\n}\n\n/**\n * This hook is a safe useState version which schedules state updates in microtasks\n * to prevent updating a component state while React is rendering different components\n * or when the component is not mounted anymore.\n */\nexport function useSafeState<T>(initialState: T): [T, (value: T) => void] {\n  const isMounted = useIsMounted()\n  const [state, setState] = createSignal(initialState)\n\n  const safeSetState = (value: T) => {\n    scheduleMicrotask(() => {\n      if (isMounted()) {\n        // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n        // @ts-ignore\n        setState(value)\n      }\n    })\n  }\n\n  return [state(), safeSetState]\n}\n\n/**\n * Schedules a microtask.\n * This can be useful to schedule state updates after rendering.\n */\nfunction scheduleMicrotask(callback: () => void) {\n  Promise.resolve()\n    .then(callback)\n    .catch((error) =>\n      setTimeout(() => {\n        throw error\n      }),\n    )\n}\n\nexport function multiSortBy<T>(\n  arr: Array<T>,\n  accessors: Array<(item: T) => any> = [(d) => d],\n): Array<T> {\n  return arr\n    .map((d, i) => [d, i] as const)\n    .sort(([a, ai], [b, bi]) => {\n      for (const accessor of accessors) {\n        const ao = accessor(a)\n        const bo = accessor(b)\n\n        if (typeof ao === 'undefined') {\n          if (typeof bo === 'undefined') {\n            continue\n          }\n          return 1\n        }\n\n        if (ao === bo) {\n          continue\n        }\n\n        return ao > bo ? 1 : -1\n      }\n\n      return ai - bi\n    })\n    .map(([d]) => d)\n}\n"
  },
  {
    "path": "packages/router-devtools-core/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"preserve\",\n    \"jsxImportSource\": \"solid-js\"\n  },\n  \"include\": [\"src\", \"vite.config.ts\"]\n}\n"
  },
  {
    "path": "packages/router-devtools-core/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport solid from 'vite-plugin-solid'\n\nconst config = defineConfig({\n  plugins: [solid()],\n})\n\nconst merged = mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.tsx',\n    srcDir: './src',\n    bundledDeps: ['solid-js', 'solid-js/web'],\n  }),\n)\n\nmerged.build.rolldownOptions.output.manualChunks = undefined\nmerged.build.rolldownOptions.output.preserveModules = false\n\nexport default merged\n"
  },
  {
    "path": "packages/router-generator/.prettierignore",
    "content": "**/routeTree.*.snapshot.ts\n"
  },
  {
    "path": "packages/router-generator/CHANGELOG.md",
    "content": "# @tanstack/router-generator\n\n## 1.166.15\n\n### Patch Changes\n\n- Updated dependencies [[`91cc628`](https://github.com/TanStack/router/commit/91cc62899b75ca920fe83c5ee7f3dbb5c71a523f)]:\n  - @tanstack/router-core@1.168.1\n\n## 1.166.14\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/router-core@1.168.0\n\n## 1.166.13\n\n### Patch Changes\n\n- Updated dependencies [[`5ff4f0b`](https://github.com/TanStack/router/commit/5ff4f0b8dce1fac2bb0b0bfe2684fc677a8ee505)]:\n  - @tanstack/router-core@1.167.5\n\n## 1.166.12\n\n### Patch Changes\n\n- Updated dependencies [[`940151c`](https://github.com/TanStack/router/commit/940151cbed0c76c92a5cf196c0905b17a956ca7e)]:\n  - @tanstack/router-core@1.167.4\n  - @tanstack/virtual-file-routes@1.161.7\n\n## 1.166.11\n\n### Patch Changes\n\n- Updated dependencies [[`32fcba7`](https://github.com/TanStack/router/commit/32fcba7b044b03f5901308b870f70b0b4910c220)]:\n  - @tanstack/router-core@1.167.3\n\n## 1.166.10\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/router-core@1.167.2\n  - @tanstack/router-utils@1.161.6\n  - @tanstack/virtual-file-routes@1.161.6\n\n## 1.166.9\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/virtual-file-routes@1.161.5\n  - @tanstack/router-utils@1.161.5\n  - @tanstack/router-core@1.167.1\n\n## 1.166.8\n\n### Patch Changes\n\n- Updated dependencies [[`6f297a2`](https://github.com/TanStack/router/commit/6f297a249424c0fd1c1a56aa4fc12c8217be7b6a)]:\n  - @tanstack/router-core@1.167.0\n"
  },
  {
    "path": "packages/router-generator/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/router-generator/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-generator\",\n  \"version\": \"1.166.15\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-generator\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"clean:snapshots\": \"rimraf **/*snapshot* --glob\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"exit 0; node ../../node_modules/typescript54/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts59\": \"tsc -p tsconfig.legacy.json\",\n    \"test:unit\": \"vitest --typecheck false && vitest run --typecheck.only\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch --hideSkippedTests\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@tanstack/router-core\": \"workspace:*\",\n    \"@tanstack/router-utils\": \"workspace:*\",\n    \"@tanstack/virtual-file-routes\": \"workspace:*\",\n    \"prettier\": \"^3.5.0\",\n    \"recast\": \"^0.23.11\",\n    \"source-map\": \"^0.7.4\",\n    \"tsx\": \"^4.19.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/react-router\": \"workspace:*\",\n    \"vite\": \"*\"\n  }\n}\n"
  },
  {
    "path": "packages/router-generator/src/config.ts",
    "content": "import path from 'node:path'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { z } from 'zod'\nimport { virtualRootRouteSchema } from './filesystem/virtual/config'\nimport type { GeneratorPlugin } from './plugin/types'\n\nconst tokenJsonRegexSchema = z.object({\n  regex: z.string(),\n  flags: z.string().optional(),\n})\n\nconst tokenMatcherSchema = z.union([\n  z.string(),\n  z.instanceof(RegExp),\n  tokenJsonRegexSchema,\n])\n\nexport type TokenMatcherJson = string | z.infer<typeof tokenJsonRegexSchema>\n\nexport type TokenMatcher = z.infer<typeof tokenMatcherSchema>\n\nexport const baseConfigSchema = z.object({\n  target: z.enum(['react', 'solid', 'vue']).optional().default('react'),\n  virtualRouteConfig: virtualRootRouteSchema.or(z.string()).optional(),\n  routeFilePrefix: z.string().optional(),\n  routeFileIgnorePrefix: z.string().optional().default('-'),\n  routeFileIgnorePattern: z.string().optional(),\n  routesDirectory: z.string().optional().default('./src/routes'),\n  quoteStyle: z.enum(['single', 'double']).optional().default('single'),\n  semicolons: z.boolean().optional().default(false),\n  disableLogging: z.boolean().optional().default(false),\n  routeTreeFileHeader: z\n    .array(z.string())\n    .optional()\n    .default([\n      '/* eslint-disable */',\n      '// @ts-nocheck',\n      '// noinspection JSUnusedGlobalSymbols',\n    ]),\n  indexToken: tokenMatcherSchema.optional().default('index'),\n  routeToken: tokenMatcherSchema.optional().default('route'),\n  pathParamsAllowedCharacters: z\n    .array(z.enum([';', ':', '@', '&', '=', '+', '$', ',']))\n    .optional(),\n})\n\nexport type BaseConfig = z.infer<typeof baseConfigSchema>\n\nexport const configSchema = baseConfigSchema.extend({\n  generatedRouteTree: z.string().optional().default('./src/routeTree.gen.ts'),\n  disableTypes: z.boolean().optional().default(false),\n  verboseFileRoutes: z.boolean().optional(),\n  addExtensions: z\n    .union([z.boolean(), z.string()])\n    .optional()\n    .default(false)\n    .transform((v) =>\n      typeof v === 'string' ? (v.startsWith('.') ? v : `.${v}`) : v,\n    ),\n  enableRouteTreeFormatting: z.boolean().optional().default(true),\n  routeTreeFileFooter: z\n    .union([\n      z.array(z.string()).optional().default([]),\n      z.function().returns(z.array(z.string())),\n    ])\n    .optional(),\n  autoCodeSplitting: z.boolean().optional(),\n  customScaffolding: z\n    .object({\n      routeTemplate: z.string().optional(),\n      lazyRouteTemplate: z.string().optional(),\n    })\n    .optional(),\n  experimental: z\n    .object({\n      // TODO: This has been made stable and is now \"autoCodeSplitting\". Remove in next major version.\n      enableCodeSplitting: z.boolean().optional(),\n    })\n    .optional(),\n  plugins: z.array(z.custom<GeneratorPlugin>()).optional(),\n  tmpDir: z.string().optional().default(''),\n  importRoutesUsingAbsolutePaths: z.boolean().optional().default(false),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\ntype ResolveParams = {\n  configDirectory: string\n}\n\nexport function resolveConfigPath({ configDirectory }: ResolveParams) {\n  return path.resolve(configDirectory, 'tsr.config.json')\n}\n\nexport function getConfig(\n  inlineConfig: Partial<Config> = {},\n  configDirectory?: string,\n): Config {\n  if (configDirectory === undefined) {\n    configDirectory = process.cwd()\n  }\n  const configFilePathJson = resolveConfigPath({ configDirectory })\n  const exists = existsSync(configFilePathJson)\n\n  let config: Config\n\n  if (exists) {\n    // Parse file config (allows JSON regex-object form)\n    const fileConfigRaw = JSON.parse(readFileSync(configFilePathJson, 'utf-8'))\n\n    // Merge raw configs (inline overrides file), then parse once to apply defaults\n    // This ensures file config values aren't overwritten by inline defaults\n    const merged = {\n      ...fileConfigRaw,\n      ...inlineConfig,\n    }\n    config = configSchema.parse(merged)\n  } else {\n    config = configSchema.parse(inlineConfig)\n  }\n\n  // If typescript is disabled, make sure the generated route tree is a .js file\n  if (config.disableTypes) {\n    config.generatedRouteTree = config.generatedRouteTree.replace(\n      /\\.(ts|tsx)$/,\n      '.js',\n    )\n  }\n\n  // if a configDirectory is used, paths should be relative to that directory\n  if (configDirectory) {\n    // if absolute configDirectory is provided, use it as the root\n    if (path.isAbsolute(configDirectory)) {\n      config.routesDirectory = path.resolve(\n        configDirectory,\n        config.routesDirectory,\n      )\n      config.generatedRouteTree = path.resolve(\n        configDirectory,\n        config.generatedRouteTree,\n      )\n    } else {\n      config.routesDirectory = path.resolve(\n        process.cwd(),\n        configDirectory,\n        config.routesDirectory,\n      )\n      config.generatedRouteTree = path.resolve(\n        process.cwd(),\n        configDirectory,\n        config.generatedRouteTree,\n      )\n    }\n  }\n\n  const resolveTmpDir = (dir: string | Array<string>) => {\n    if (Array.isArray(dir)) {\n      dir = path.join(...dir)\n    }\n    if (!path.isAbsolute(dir)) {\n      dir = path.resolve(process.cwd(), dir)\n    }\n    return dir\n  }\n\n  if (config.tmpDir) {\n    config.tmpDir = resolveTmpDir(config.tmpDir)\n  } else if (process.env.TSR_TMP_DIR) {\n    config.tmpDir = resolveTmpDir(process.env.TSR_TMP_DIR)\n  } else {\n    config.tmpDir = resolveTmpDir(['.tanstack', 'tmp'])\n  }\n\n  validateConfig(config)\n  return config\n}\n\nfunction validateConfig(config: Config) {\n  if (typeof config.experimental?.enableCodeSplitting !== 'undefined') {\n    const message = `\n------\n⚠️ ⚠️ ⚠️\nERROR: The \"experimental.enableCodeSplitting\" flag has been made stable and is now \"autoCodeSplitting\". Please update your configuration file to use \"autoCodeSplitting\" instead of \"experimental.enableCodeSplitting\".\n------\n`\n    console.error(message)\n    throw new Error(message)\n  }\n\n  // Check that indexToken and routeToken are not identical\n  // Works for strings, RegExp, and JSON regex objects\n  if (areTokensEqual(config.indexToken, config.routeToken)) {\n    throw new Error(\n      `The \"indexToken\" and \"routeToken\" options must be different.`,\n    )\n  }\n\n  if (\n    config.routeFileIgnorePrefix &&\n    config.routeFileIgnorePrefix.trim() === '_'\n  ) {\n    throw new Error(\n      `The \"routeFileIgnorePrefix\" cannot be an underscore (\"_\"). This is a reserved character used to denote a pathless route. Please use a different prefix.`,\n    )\n  }\n\n  return config\n}\n\n/**\n * Compares two token matchers for equality.\n * Handles strings, RegExp instances, and JSON regex objects.\n */\nfunction areTokensEqual(a: TokenMatcher, b: TokenMatcher): boolean {\n  // Both strings\n  if (typeof a === 'string' && typeof b === 'string') {\n    return a === b\n  }\n\n  // Both RegExp instances\n  if (a instanceof RegExp && b instanceof RegExp) {\n    return a.source === b.source && a.flags === b.flags\n  }\n\n  // Both JSON regex objects\n  if (\n    typeof a === 'object' &&\n    'regex' in a &&\n    typeof b === 'object' &&\n    'regex' in b\n  ) {\n    return a.regex === b.regex && (a.flags ?? '') === (b.flags ?? '')\n  }\n\n  // Mixed types - not equal\n  return false\n}\n"
  },
  {
    "path": "packages/router-generator/src/filesystem/physical/getRouteNodes.ts",
    "content": "import path from 'node:path'\nimport * as fsp from 'node:fs/promises'\nimport {\n  determineInitialRoutePath,\n  hasEscapedLeadingUnderscore,\n  removeExt,\n  replaceBackslash,\n  routePathToVariable,\n  unwrapBracketWrappedSegment,\n} from '../../utils'\nimport { getRouteNodes as getRouteNodesVirtual } from '../virtual/getRouteNodes'\nimport { loadConfigFile } from '../virtual/loadConfigFile'\nimport { logging } from '../../logger'\nimport { rootPathId } from './rootPathId'\nimport type {\n  VirtualRootRoute,\n  VirtualRouteSubtreeConfig,\n} from '@tanstack/virtual-file-routes'\nimport type { FsRouteType, GetRouteNodesResult, RouteNode } from '../../types'\nimport type { Config } from '../../config'\n\n/**\n * Pre-compiled segment regexes for matching token patterns against route segments.\n * These are created once (in Generator constructor) and passed through to avoid\n * repeated regex compilation during route crawling.\n */\nexport interface TokenRegexBundle {\n  indexTokenSegmentRegex: RegExp\n  routeTokenSegmentRegex: RegExp\n}\n\nconst disallowedRouteGroupConfiguration = /\\(([^)]+)\\).(ts|js|tsx|jsx|vue)/\n\nconst virtualConfigFileRegExp = /__virtual\\.[mc]?[jt]s$/\nexport function isVirtualConfigFile(fileName: string): boolean {\n  return virtualConfigFileRegExp.test(fileName)\n}\n\nexport async function getRouteNodes(\n  config: Pick<\n    Config,\n    | 'routesDirectory'\n    | 'routeFilePrefix'\n    | 'routeFileIgnorePrefix'\n    | 'routeFileIgnorePattern'\n    | 'disableLogging'\n    | 'routeToken'\n    | 'indexToken'\n  >,\n  root: string,\n  tokenRegexes: TokenRegexBundle,\n): Promise<GetRouteNodesResult> {\n  const { routeFilePrefix, routeFileIgnorePrefix, routeFileIgnorePattern } =\n    config\n\n  const logger = logging({ disabled: config.disableLogging })\n  const routeFileIgnoreRegExp = new RegExp(routeFileIgnorePattern ?? '', 'g')\n\n  const routeNodes: Array<RouteNode> = []\n  const allPhysicalDirectories: Array<string> = []\n\n  async function recurse(dir: string) {\n    const fullDir = path.resolve(config.routesDirectory, dir)\n    let dirList = await fsp.readdir(fullDir, { withFileTypes: true })\n\n    dirList = dirList.filter((d) => {\n      if (\n        d.name.startsWith('.') ||\n        (routeFileIgnorePrefix && d.name.startsWith(routeFileIgnorePrefix))\n      ) {\n        return false\n      }\n\n      if (routeFilePrefix) {\n        if (routeFileIgnorePattern) {\n          return (\n            d.name.startsWith(routeFilePrefix) &&\n            !d.name.match(routeFileIgnoreRegExp)\n          )\n        }\n\n        return d.name.startsWith(routeFilePrefix)\n      }\n\n      if (routeFileIgnorePattern) {\n        return !d.name.match(routeFileIgnoreRegExp)\n      }\n\n      return true\n    })\n\n    const virtualConfigFile = dirList.find((dirent) => {\n      return dirent.isFile() && isVirtualConfigFile(dirent.name)\n    })\n\n    if (virtualConfigFile !== undefined) {\n      const virtualRouteConfigExport = await loadConfigFile(\n        path.resolve(fullDir, virtualConfigFile.name),\n      )\n      let virtualRouteSubtreeConfig: VirtualRouteSubtreeConfig\n      if (typeof virtualRouteConfigExport.default === 'function') {\n        virtualRouteSubtreeConfig = await virtualRouteConfigExport.default()\n      } else {\n        virtualRouteSubtreeConfig = virtualRouteConfigExport.default\n      }\n      const dummyRoot: VirtualRootRoute = {\n        type: 'root',\n        file: '',\n        children: virtualRouteSubtreeConfig,\n      }\n      const { routeNodes: virtualRouteNodes, physicalDirectories } =\n        await getRouteNodesVirtual(\n          {\n            ...config,\n            routesDirectory: fullDir,\n            virtualRouteConfig: dummyRoot,\n          },\n          root,\n          tokenRegexes,\n        )\n      allPhysicalDirectories.push(...physicalDirectories)\n      virtualRouteNodes.forEach((node) => {\n        const filePath = replaceBackslash(path.join(dir, node.filePath))\n        const routePath = `/${dir}${node.routePath}`\n\n        node.variableName = routePathToVariable(\n          `${dir}/${removeExt(node.filePath)}`,\n        )\n        node.routePath = routePath\n        // Keep originalRoutePath aligned with routePath for escape detection\n        if (node.originalRoutePath) {\n          node.originalRoutePath = `/${dir}${node.originalRoutePath}`\n        }\n        node.filePath = filePath\n        // Virtual subtree nodes (from __virtual.ts) are embedded in a\n        // physical directory tree. They should use path-based parent\n        // inference, not the explicit virtual parent tracking. Clear any\n        // _virtualParentRoutePath that was set at construction time.\n        delete node._virtualParentRoutePath\n      })\n\n      routeNodes.push(...virtualRouteNodes)\n\n      return\n    }\n\n    await Promise.all(\n      dirList.map(async (dirent) => {\n        const fullPath = replaceBackslash(path.join(fullDir, dirent.name))\n        const relativePath = path.posix.join(dir, dirent.name)\n\n        if (dirent.isDirectory()) {\n          await recurse(relativePath)\n        } else if (fullPath.match(/\\.(tsx|ts|jsx|js|vue)$/)) {\n          const filePath = replaceBackslash(path.join(dir, dirent.name))\n          const filePathNoExt = removeExt(filePath)\n          const {\n            routePath: initialRoutePath,\n            originalRoutePath: initialOriginalRoutePath,\n          } = determineInitialRoutePath(filePathNoExt)\n\n          let routePath = initialRoutePath\n          let originalRoutePath = initialOriginalRoutePath\n\n          if (routeFilePrefix) {\n            routePath = routePath.replaceAll(routeFilePrefix, '')\n            originalRoutePath = originalRoutePath.replaceAll(\n              routeFilePrefix,\n              '',\n            )\n          }\n\n          if (disallowedRouteGroupConfiguration.test(dirent.name)) {\n            const errorMessage = `A route configuration for a route group was found at \\`${filePath}\\`. This is not supported. Did you mean to use a layout/pathless route instead?`\n            logger.error(`ERROR: ${errorMessage}`)\n            throw new Error(errorMessage)\n          }\n\n          const meta = getRouteMeta(routePath, originalRoutePath, tokenRegexes)\n          const variableName = meta.variableName\n          let routeType: FsRouteType = meta.fsRouteType\n\n          if (routeType === 'lazy') {\n            routePath = routePath.replace(/\\/lazy$/, '')\n            originalRoutePath = originalRoutePath.replace(/\\/lazy$/, '')\n          }\n\n          // this check needs to happen after the lazy route has been cleaned up\n          // since the routePath is used to determine if a route is pathless\n          if (\n            isValidPathlessLayoutRoute(\n              routePath,\n              originalRoutePath,\n              routeType,\n              tokenRegexes,\n            )\n          ) {\n            routeType = 'pathless_layout'\n          }\n\n          // Only show deprecation warning for .tsx/.ts files, not .vue files\n          // Vue files using .component.vue is the Vue-native way\n          const isVueFile = filePath.endsWith('.vue')\n          if (!isVueFile) {\n            ;(\n              [\n                ['component', 'component'],\n                ['errorComponent', 'errorComponent'],\n                ['notFoundComponent', 'notFoundComponent'],\n                ['pendingComponent', 'pendingComponent'],\n                ['loader', 'loader'],\n              ] satisfies Array<[FsRouteType, string]>\n            ).forEach(([matcher, type]) => {\n              if (routeType === matcher) {\n                logger.warn(\n                  `WARNING: The \\`.${type}.tsx\\` suffix used for the ${filePath} file is deprecated. Use the new \\`.lazy.tsx\\` suffix instead.`,\n                )\n              }\n            })\n          }\n\n          // Get the last segment of originalRoutePath to check for escaping\n          const originalSegments = originalRoutePath.split('/').filter(Boolean)\n          const lastOriginalSegmentForSuffix =\n            originalSegments[originalSegments.length - 1] || ''\n\n          const { routeTokenSegmentRegex, indexTokenSegmentRegex } =\n            tokenRegexes\n\n          // List of special suffixes that can be escaped\n          const specialSuffixes = [\n            'component',\n            'errorComponent',\n            'notFoundComponent',\n            'pendingComponent',\n            'loader',\n            'lazy',\n          ]\n\n          const routePathSegments = routePath.split('/').filter(Boolean)\n          const lastRouteSegment =\n            routePathSegments[routePathSegments.length - 1] || ''\n\n          const suffixToStrip = specialSuffixes.find((suffix) => {\n            const endsWithSuffix = routePath.endsWith(`/${suffix}`)\n            // A suffix is escaped if wrapped in brackets in the original: [lazy] means literal \"lazy\"\n            const isEscaped =\n              lastOriginalSegmentForSuffix.startsWith('[') &&\n              lastOriginalSegmentForSuffix.endsWith(']') &&\n              unwrapBracketWrappedSegment(lastOriginalSegmentForSuffix) ===\n                suffix\n            return endsWithSuffix && !isEscaped\n          })\n\n          const routeTokenCandidate = unwrapBracketWrappedSegment(\n            lastOriginalSegmentForSuffix,\n          )\n          const isRouteTokenEscaped =\n            lastOriginalSegmentForSuffix !== routeTokenCandidate &&\n            routeTokenSegmentRegex.test(routeTokenCandidate)\n\n          const shouldStripRouteToken =\n            routeTokenSegmentRegex.test(lastRouteSegment) &&\n            !isRouteTokenEscaped\n\n          if (suffixToStrip || shouldStripRouteToken) {\n            const stripSegment = suffixToStrip ?? lastRouteSegment\n            routePath = routePath.replace(new RegExp(`/${stripSegment}$`), '')\n            originalRoutePath = originalRoutePath.replace(\n              new RegExp(`/${stripSegment}$`),\n              '',\n            )\n          }\n\n          // Check if the index token should be treated specially or as a literal path\n          // Escaping stays literal-only: if the last original segment is bracket-wrapped,\n          // treat it as literal even if it matches the token regex.\n          const lastOriginalSegment =\n            originalRoutePath.split('/').filter(Boolean).pop() || ''\n\n          const indexTokenCandidate =\n            unwrapBracketWrappedSegment(lastOriginalSegment)\n          const isIndexEscaped =\n            lastOriginalSegment !== indexTokenCandidate &&\n            indexTokenSegmentRegex.test(indexTokenCandidate)\n\n          if (!isIndexEscaped) {\n            const updatedRouteSegments = routePath.split('/').filter(Boolean)\n            const updatedLastRouteSegment =\n              updatedRouteSegments[updatedRouteSegments.length - 1] || ''\n\n            if (indexTokenSegmentRegex.test(updatedLastRouteSegment)) {\n              if (routePathSegments.length === 1) {\n                routePath = '/'\n              }\n\n              if (lastOriginalSegment === updatedLastRouteSegment) {\n                originalRoutePath = '/'\n              }\n\n              // For layout routes, don't use '/' fallback - an empty path means\n              // \"layout for the parent path\" which is important for physical() mounts\n              // where route.tsx at root should have empty path, not '/'\n              const isLayoutRoute = routeType === 'layout'\n\n              routePath =\n                routePath.replace(\n                  new RegExp(`/${updatedLastRouteSegment}$`),\n                  '/',\n                ) || (isLayoutRoute ? '' : '/')\n\n              originalRoutePath =\n                originalRoutePath.replace(\n                  new RegExp(`/${indexTokenCandidate}$`),\n                  '/',\n                ) || (isLayoutRoute ? '' : '/')\n            }\n          }\n\n          routeNodes.push({\n            filePath,\n            fullPath,\n            routePath,\n            variableName,\n            _fsRouteType: routeType,\n            originalRoutePath,\n          })\n        }\n      }),\n    )\n\n    return routeNodes\n  }\n\n  await recurse('./')\n\n  // Find the root route node - prefer the actual route file over component/loader files\n  const rootRouteNode =\n    routeNodes.find(\n      (d) =>\n        d.routePath === `/${rootPathId}` &&\n        ![\n          'component',\n          'errorComponent',\n          'notFoundComponent',\n          'pendingComponent',\n          'loader',\n          'lazy',\n        ].includes(d._fsRouteType),\n    ) ?? routeNodes.find((d) => d.routePath === `/${rootPathId}`)\n  if (rootRouteNode) {\n    rootRouteNode._fsRouteType = '__root'\n    rootRouteNode.variableName = 'root'\n  }\n\n  return {\n    rootRouteNode,\n    routeNodes,\n    physicalDirectories: allPhysicalDirectories,\n  }\n}\n\n/**\n * Determines the metadata for a given route path based on the provided configuration.\n *\n * @param routePath - The determined initial routePath (with brackets removed).\n * @param originalRoutePath - The original route path (may contain brackets for escaped content).\n * @param tokenRegexes - Pre-compiled token regexes for matching.\n * @returns An object containing the type of the route and the variable name derived from the route path.\n */\nexport function getRouteMeta(\n  routePath: string,\n  originalRoutePath: string,\n  tokenRegexes: TokenRegexBundle,\n): {\n  // `__root` is can be more easily determined by filtering down to routePath === /${rootPathId}\n  // `pathless` is needs to determined after `lazy` has been cleaned up from the routePath\n  fsRouteType: Extract<\n    FsRouteType,\n    | 'static'\n    | 'layout'\n    | 'api'\n    | 'lazy'\n    | 'loader'\n    | 'component'\n    | 'pendingComponent'\n    | 'errorComponent'\n    | 'notFoundComponent'\n  >\n  variableName: string\n} {\n  let fsRouteType: FsRouteType = 'static'\n\n  // Get the last segment from the original path to check for escaping\n  const originalSegments = originalRoutePath.split('/').filter(Boolean)\n  const lastOriginalSegment =\n    originalSegments[originalSegments.length - 1] || ''\n\n  const { routeTokenSegmentRegex } = tokenRegexes\n\n  // Helper to check if a specific suffix is escaped (literal-only)\n  // A suffix is escaped if the original segment is wrapped in brackets: [lazy] means literal \"lazy\"\n  const isSuffixEscaped = (suffix: string): boolean => {\n    return (\n      lastOriginalSegment.startsWith('[') &&\n      lastOriginalSegment.endsWith(']') &&\n      unwrapBracketWrappedSegment(lastOriginalSegment) === suffix\n    )\n  }\n\n  const routeSegments = routePath.split('/').filter(Boolean)\n  const lastRouteSegment = routeSegments[routeSegments.length - 1] || ''\n\n  const routeTokenCandidate = unwrapBracketWrappedSegment(lastOriginalSegment)\n  const isRouteTokenEscaped =\n    lastOriginalSegment !== routeTokenCandidate &&\n    routeTokenSegmentRegex.test(routeTokenCandidate)\n\n  if (routeTokenSegmentRegex.test(lastRouteSegment) && !isRouteTokenEscaped) {\n    // layout routes, i.e `/foo/route.tsx` or `/foo/_layout/route.tsx`\n    fsRouteType = 'layout'\n  } else if (routePath.endsWith('/lazy') && !isSuffixEscaped('lazy')) {\n    // lazy routes, i.e. `/foo.lazy.tsx`\n    fsRouteType = 'lazy'\n  } else if (routePath.endsWith('/loader') && !isSuffixEscaped('loader')) {\n    // loader routes, i.e. `/foo.loader.tsx`\n    fsRouteType = 'loader'\n  } else if (\n    routePath.endsWith('/component') &&\n    !isSuffixEscaped('component')\n  ) {\n    // component routes, i.e. `/foo.component.tsx`\n    fsRouteType = 'component'\n  } else if (\n    routePath.endsWith('/pendingComponent') &&\n    !isSuffixEscaped('pendingComponent')\n  ) {\n    // pending component routes, i.e. `/foo.pendingComponent.tsx`\n    fsRouteType = 'pendingComponent'\n  } else if (\n    routePath.endsWith('/errorComponent') &&\n    !isSuffixEscaped('errorComponent')\n  ) {\n    // error component routes, i.e. `/foo.errorComponent.tsx`\n    fsRouteType = 'errorComponent'\n  } else if (\n    routePath.endsWith('/notFoundComponent') &&\n    !isSuffixEscaped('notFoundComponent')\n  ) {\n    // not found component routes, i.e. `/foo.notFoundComponent.tsx`\n    fsRouteType = 'notFoundComponent'\n  }\n\n  // Use originalRoutePath for variable name when any segment is fully\n  // bracket-wrapped (e.g. [index], [route], [_]auth) to avoid collisions\n  // with their non-escaped counterparts that get special token treatment\n  const hasFullyEscapedSegment = originalSegments.some(\n    (seg) =>\n      seg.startsWith('[') &&\n      seg.endsWith(']') &&\n      !seg.slice(1, -1).includes('[') &&\n      !seg.slice(1, -1).includes(']'),\n  )\n  const variableName = routePathToVariable(\n    hasFullyEscapedSegment ? originalRoutePath : routePath,\n  )\n\n  return { fsRouteType, variableName }\n}\n\n/**\n * Used to validate if a route is a pathless layout route\n * @param normalizedRoutePath Normalized route path, i.e `/foo/_layout/route.tsx` and `/foo._layout.route.tsx` to `/foo/_layout/route`\n * @param originalRoutePath Original route path with brackets for escaped content\n * @param routeType The route type determined from file extension\n * @param tokenRegexes Pre-compiled token regexes for matching\n * @returns Boolean indicating if the route is a pathless layout route\n */\nfunction isValidPathlessLayoutRoute(\n  normalizedRoutePath: string,\n  originalRoutePath: string,\n  routeType: FsRouteType,\n  tokenRegexes: TokenRegexBundle,\n): boolean {\n  if (routeType === 'lazy') {\n    return false\n  }\n\n  const segments = normalizedRoutePath.split('/').filter(Boolean)\n  const originalSegments = originalRoutePath.split('/').filter(Boolean)\n\n  if (segments.length === 0) {\n    return false\n  }\n\n  const lastRouteSegment = segments[segments.length - 1]!\n  const lastOriginalSegment =\n    originalSegments[originalSegments.length - 1] || ''\n  const secondToLastRouteSegment = segments[segments.length - 2]\n  const secondToLastOriginalSegment =\n    originalSegments[originalSegments.length - 2]\n\n  // If segment === __root, then exit as false\n  if (lastRouteSegment === rootPathId) {\n    return false\n  }\n\n  const { routeTokenSegmentRegex, indexTokenSegmentRegex } = tokenRegexes\n\n  // If segment matches routeToken and secondToLastSegment is a string that starts with _, then exit as true\n  // Since the route is actually a configuration route for a layout/pathless route\n  // i.e. /foo/_layout/route.tsx === /foo/_layout.tsx\n  // But if the underscore is escaped, it's not a pathless layout\n  if (\n    routeTokenSegmentRegex.test(lastRouteSegment) &&\n    typeof secondToLastRouteSegment === 'string' &&\n    typeof secondToLastOriginalSegment === 'string'\n  ) {\n    // Check if the underscore is escaped\n    if (hasEscapedLeadingUnderscore(secondToLastOriginalSegment)) {\n      return false\n    }\n    return secondToLastRouteSegment.startsWith('_')\n  }\n\n  // Segment starts with _ but check if it's escaped\n  // If the original segment has [_] at the start, the underscore is escaped and it's not a pathless layout\n  if (hasEscapedLeadingUnderscore(lastOriginalSegment)) {\n    return false\n  }\n\n  return (\n    !indexTokenSegmentRegex.test(lastRouteSegment) &&\n    !routeTokenSegmentRegex.test(lastRouteSegment) &&\n    lastRouteSegment.startsWith('_')\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/src/filesystem/physical/rootPathId.ts",
    "content": "export const rootPathId = '__root'\n"
  },
  {
    "path": "packages/router-generator/src/filesystem/virtual/config.ts",
    "content": "import { z } from 'zod'\nimport type {\n  LayoutRoute,\n  PhysicalSubtree,\n  Route,\n  VirtualRootRoute,\n} from '@tanstack/virtual-file-routes'\n\nconst indexRouteSchema = z.object({\n  type: z.literal('index'),\n  file: z.string(),\n})\n\nconst layoutRouteSchema: z.ZodType<LayoutRoute> = z.object({\n  type: z.literal('layout'),\n  id: z.string().optional(),\n  file: z.string(),\n  children: z.array(z.lazy(() => virtualRouteNodeSchema)).optional(),\n})\n\nconst routeSchema: z.ZodType<Route> = z.object({\n  type: z.literal('route'),\n  file: z.string().optional(),\n  path: z.string(),\n  children: z.array(z.lazy(() => virtualRouteNodeSchema)).optional(),\n})\n\nconst physicalSubTreeSchema: z.ZodType<PhysicalSubtree> = z.object({\n  type: z.literal('physical'),\n  directory: z.string(),\n  pathPrefix: z.string(),\n})\n\nconst virtualRouteNodeSchema = z.union([\n  indexRouteSchema,\n  layoutRouteSchema,\n  routeSchema,\n  physicalSubTreeSchema,\n])\n\nexport const virtualRootRouteSchema: z.ZodType<VirtualRootRoute> = z.object({\n  type: z.literal('root'),\n  file: z.string(),\n  children: z.array(virtualRouteNodeSchema).optional(),\n})\n"
  },
  {
    "path": "packages/router-generator/src/filesystem/virtual/getRouteNodes.ts",
    "content": "import path, { join, resolve } from 'node:path'\nimport {\n  determineInitialRoutePath,\n  removeExt,\n  removeLeadingSlash,\n  removeTrailingSlash,\n  replaceBackslash,\n  routePathToVariable,\n} from '../../utils'\nimport { getRouteNodes as getRouteNodesPhysical } from '../physical/getRouteNodes'\nimport { rootPathId } from '../physical/rootPathId'\nimport { virtualRootRouteSchema } from './config'\nimport { loadConfigFile } from './loadConfigFile'\nimport type {\n  VirtualRootRoute,\n  VirtualRouteNode,\n} from '@tanstack/virtual-file-routes'\nimport type { GetRouteNodesResult, RouteNode } from '../../types'\nimport type { Config } from '../../config'\nimport type { TokenRegexBundle } from '../physical/getRouteNodes'\n\nfunction ensureLeadingUnderScore(id: string) {\n  if (id.startsWith('_')) {\n    return id\n  }\n  return `_${id}`\n}\n\nfunction flattenTree(node: RouteNode): Array<RouteNode> {\n  const result = [node]\n\n  if (node.children) {\n    for (const child of node.children) {\n      result.push(...flattenTree(child))\n    }\n  }\n  delete node.children\n\n  return result\n}\n\nexport async function getRouteNodes(\n  tsrConfig: Pick<\n    Config,\n    | 'routesDirectory'\n    | 'virtualRouteConfig'\n    | 'routeFileIgnorePrefix'\n    | 'disableLogging'\n    | 'indexToken'\n    | 'routeToken'\n  >,\n  root: string,\n  tokenRegexes: TokenRegexBundle,\n): Promise<GetRouteNodesResult> {\n  const fullDir = resolve(tsrConfig.routesDirectory)\n  if (tsrConfig.virtualRouteConfig === undefined) {\n    throw new Error(`virtualRouteConfig is undefined`)\n  }\n  let virtualRouteConfig: VirtualRootRoute\n  if (typeof tsrConfig.virtualRouteConfig === 'string') {\n    virtualRouteConfig = await getVirtualRouteConfigFromFileExport(\n      tsrConfig,\n      root,\n    )\n  } else {\n    virtualRouteConfig = tsrConfig.virtualRouteConfig\n  }\n  const { children, physicalDirectories } = await getRouteNodesRecursive(\n    tsrConfig,\n    root,\n    fullDir,\n    virtualRouteConfig.children,\n    tokenRegexes,\n  )\n  const allNodes = flattenTree({\n    children,\n    filePath: virtualRouteConfig.file,\n    fullPath: replaceBackslash(join(fullDir, virtualRouteConfig.file)),\n    variableName: 'root',\n    routePath: `/${rootPathId}`,\n    _fsRouteType: '__root',\n  })\n\n  const rootRouteNode = allNodes[0]\n  const routeNodes = allNodes.slice(1)\n\n  return { rootRouteNode, routeNodes, physicalDirectories }\n}\n\n/**\n * Get the virtual route config from a file export\n *\n * @example\n * ```ts\n * // routes.ts\n * import { rootRoute } from '@tanstack/virtual-file-routes'\n *\n * export const routes = rootRoute({ ... })\n * // or\n * export default rootRoute({ ... })\n * ```\n *\n */\nasync function getVirtualRouteConfigFromFileExport(\n  tsrConfig: Pick<Config, 'virtualRouteConfig'>,\n  root: string,\n): Promise<VirtualRootRoute> {\n  if (\n    tsrConfig.virtualRouteConfig === undefined ||\n    typeof tsrConfig.virtualRouteConfig !== 'string' ||\n    tsrConfig.virtualRouteConfig === ''\n  ) {\n    throw new Error(`virtualRouteConfig is undefined or empty`)\n  }\n  const exports = await loadConfigFile(join(root, tsrConfig.virtualRouteConfig))\n\n  if (!('routes' in exports) && !('default' in exports)) {\n    throw new Error(\n      `routes not found in ${tsrConfig.virtualRouteConfig}. The routes export must be named like 'export const routes = ...' or done using 'export default ...'`,\n    )\n  }\n\n  const virtualRouteConfig =\n    'routes' in exports ? exports.routes : exports.default\n\n  return virtualRootRouteSchema.parse(virtualRouteConfig)\n}\n\nexport async function getRouteNodesRecursive(\n  tsrConfig: Pick<\n    Config,\n    | 'routesDirectory'\n    | 'routeFileIgnorePrefix'\n    | 'disableLogging'\n    | 'indexToken'\n    | 'routeToken'\n  >,\n  root: string,\n  fullDir: string,\n  nodes: Array<VirtualRouteNode> | undefined,\n  tokenRegexes: TokenRegexBundle,\n  parent?: RouteNode,\n): Promise<{ children: Array<RouteNode>; physicalDirectories: Array<string> }> {\n  if (nodes === undefined) {\n    return { children: [], physicalDirectories: [] }\n  }\n  const allPhysicalDirectories: Array<string> = []\n  const children = await Promise.all(\n    nodes.map(async (node) => {\n      if (node.type === 'physical') {\n        const { routeNodes, physicalDirectories } = await getRouteNodesPhysical(\n          {\n            ...tsrConfig,\n            routesDirectory: resolve(fullDir, node.directory),\n          },\n          root,\n          tokenRegexes,\n        )\n        allPhysicalDirectories.push(\n          resolve(fullDir, node.directory),\n          ...physicalDirectories,\n        )\n        routeNodes.forEach((subtreeNode) => {\n          subtreeNode.variableName = routePathToVariable(\n            `${node.pathPrefix}/${removeExt(subtreeNode.filePath)}`,\n          )\n          subtreeNode.routePath = `${parent?.routePath ?? ''}${node.pathPrefix}${subtreeNode.routePath}`\n          // Keep originalRoutePath aligned with routePath for escape detection\n          if (subtreeNode.originalRoutePath) {\n            subtreeNode.originalRoutePath = `${parent?.routePath ?? ''}${node.pathPrefix}${subtreeNode.originalRoutePath}`\n          }\n          subtreeNode.filePath = `${node.directory}/${subtreeNode.filePath}`\n        })\n        return routeNodes\n      }\n\n      function getFile(file: string) {\n        const filePath = file\n        const variableName = routePathToVariable(removeExt(filePath))\n        const fullPath = replaceBackslash(join(fullDir, filePath))\n        return { filePath, variableName, fullPath }\n      }\n      const parentRoutePath = removeTrailingSlash(parent?.routePath ?? '/')\n      const virtualParentRoutePath = parent?.routePath ?? `/${rootPathId}`\n\n      switch (node.type) {\n        case 'index': {\n          const { filePath, variableName, fullPath } = getFile(node.file)\n          const routePath = `${parentRoutePath}/`\n          return {\n            filePath,\n            fullPath,\n            variableName,\n            routePath,\n            _fsRouteType: 'static',\n            _virtualParentRoutePath: virtualParentRoutePath,\n          } satisfies RouteNode\n        }\n\n        case 'route': {\n          const lastSegment = node.path\n          let routeNode: RouteNode\n\n          // Process the segment to handle escape sequences like [_]\n          const {\n            routePath: escapedSegment,\n            originalRoutePath: originalSegment,\n          } = determineInitialRoutePath(removeLeadingSlash(lastSegment))\n          const routePath = `${parentRoutePath}${escapedSegment}`\n          // Store the original path with brackets for escape detection\n          const originalRoutePath = `${parentRoutePath}${originalSegment}`\n\n          if (node.file) {\n            const { filePath, variableName, fullPath } = getFile(node.file)\n            routeNode = {\n              filePath,\n              fullPath,\n              variableName,\n              routePath,\n              originalRoutePath,\n              _fsRouteType: 'static',\n              _virtualParentRoutePath: virtualParentRoutePath,\n            }\n          } else {\n            routeNode = {\n              filePath: '',\n              fullPath: '',\n              variableName: routePathToVariable(routePath),\n              routePath,\n              originalRoutePath,\n              isVirtual: true,\n              _fsRouteType: 'static',\n              _virtualParentRoutePath: virtualParentRoutePath,\n            }\n          }\n\n          if (node.children !== undefined) {\n            const { children, physicalDirectories } =\n              await getRouteNodesRecursive(\n                tsrConfig,\n                root,\n                fullDir,\n                node.children,\n                tokenRegexes,\n                routeNode,\n              )\n            routeNode.children = children\n            allPhysicalDirectories.push(...physicalDirectories)\n\n            // If the route has children, it should be a layout\n            routeNode._fsRouteType = 'layout'\n          }\n          return routeNode\n        }\n        case 'layout': {\n          const { filePath, variableName, fullPath } = getFile(node.file)\n\n          if (node.id !== undefined) {\n            node.id = ensureLeadingUnderScore(node.id)\n          } else {\n            const baseName = path.basename(filePath)\n            const fileNameWithoutExt = path.parse(baseName).name\n            node.id = ensureLeadingUnderScore(fileNameWithoutExt)\n          }\n          const lastSegment = node.id\n          // Process the segment to handle escape sequences like [_]\n          const {\n            routePath: escapedSegment,\n            originalRoutePath: originalSegment,\n          } = determineInitialRoutePath(removeLeadingSlash(lastSegment))\n          const routePath = `${parentRoutePath}${escapedSegment}`\n          // Store the original path with brackets for escape detection\n          const originalRoutePath = `${parentRoutePath}${originalSegment}`\n\n          const routeNode: RouteNode = {\n            fullPath,\n            filePath,\n            variableName,\n            routePath,\n            originalRoutePath,\n            _fsRouteType: 'pathless_layout',\n            _virtualParentRoutePath: virtualParentRoutePath,\n          }\n\n          if (node.children !== undefined) {\n            const { children, physicalDirectories } =\n              await getRouteNodesRecursive(\n                tsrConfig,\n                root,\n                fullDir,\n                node.children,\n                tokenRegexes,\n                routeNode,\n              )\n            routeNode.children = children\n            allPhysicalDirectories.push(...physicalDirectories)\n          }\n          return routeNode\n        }\n      }\n    }),\n  )\n  return {\n    children: children.flat(),\n    physicalDirectories: allPhysicalDirectories,\n  }\n}\n"
  },
  {
    "path": "packages/router-generator/src/filesystem/virtual/loadConfigFile.ts",
    "content": "import { pathToFileURL } from 'node:url'\nimport { tsImport } from 'tsx/esm/api'\n\nexport async function loadConfigFile(filePath: string) {\n  const fileURL = pathToFileURL(filePath).href\n  const loaded = await tsImport(fileURL, './')\n  return loaded\n}\n"
  },
  {
    "path": "packages/router-generator/src/generator.ts",
    "content": "import path from 'node:path'\nimport * as fsp from 'node:fs/promises'\nimport { existsSync, mkdirSync } from 'node:fs'\nimport crypto from 'node:crypto'\nimport { rootRouteId } from '@tanstack/router-core'\nimport { logging } from './logger'\nimport {\n  isVirtualConfigFile,\n  getRouteNodes as physicalGetRouteNodes,\n} from './filesystem/physical/getRouteNodes'\nimport { getRouteNodes as virtualGetRouteNodes } from './filesystem/virtual/getRouteNodes'\nimport { rootPathId } from './filesystem/physical/rootPathId'\nimport {\n  RoutePrefixMap,\n  buildFileRoutesByPathInterface,\n  buildImportString,\n  buildRouteTreeConfig,\n  checkFileExists,\n  checkRouteFullPathUniqueness,\n  createRouteNodesByFullPath,\n  createRouteNodesById,\n  createRouteNodesByTo,\n  createTokenRegex,\n  determineNodePath,\n  findParent,\n  format,\n  getImportForRouteNode,\n  getImportPath,\n  getResolvedRouteNodeVariableName,\n  hasParentRoute,\n  isRouteNodeValidForAugmentation,\n  isSegmentPathless,\n  mergeImportDeclarations,\n  multiSortBy,\n  removeExt,\n  removeGroups,\n  removeLastSegmentFromPath,\n  removeLayoutSegmentsWithEscape,\n  removeTrailingSlash,\n  removeUnderscoresWithEscape,\n  replaceBackslash,\n  trimPathLeft,\n} from './utils'\nimport { fillTemplate, getTargetTemplate } from './template'\nimport { transform } from './transform/transform'\nimport { validateRouteParams } from './validate-route-params'\nimport type { GeneratorPlugin } from './plugin/types'\nimport type { TargetTemplate } from './template'\nimport type {\n  FsRouteType,\n  GetRouteNodesResult,\n  GetRoutesByFileMapResult,\n  HandleNodeAccumulator,\n  ImportDeclaration,\n  RouteNode,\n} from './types'\nimport type { Config } from './config'\nimport type { Logger } from './logger'\n\ninterface fs {\n  stat: (\n    filePath: string,\n  ) => Promise<{ mtimeMs: bigint; mode: number; uid: number; gid: number }>\n  rename: (oldPath: string, newPath: string) => Promise<void>\n  writeFile: (filePath: string, content: string) => Promise<void>\n  readFile: (\n    filePath: string,\n  ) => Promise<\n    { stat: { mtimeMs: bigint }; fileContent: string } | 'file-not-existing'\n  >\n  chmod: (filePath: string, mode: number) => Promise<void>\n  chown: (filePath: string, uid: number, gid: number) => Promise<void>\n}\n\nconst DefaultFileSystem: fs = {\n  stat: async (filePath) => {\n    const res = await fsp.stat(filePath, { bigint: true })\n    return {\n      mtimeMs: res.mtimeMs,\n      mode: Number(res.mode),\n      uid: Number(res.uid),\n      gid: Number(res.gid),\n    }\n  },\n  rename: (oldPath, newPath) => fsp.rename(oldPath, newPath),\n  writeFile: (filePath, content) => fsp.writeFile(filePath, content),\n  readFile: async (filePath: string) => {\n    try {\n      const fileHandle = await fsp.open(filePath, 'r')\n      const stat = await fileHandle.stat({ bigint: true })\n      const fileContent = (await fileHandle.readFile()).toString()\n      await fileHandle.close()\n      return { stat, fileContent }\n    } catch (e: any) {\n      if ('code' in e) {\n        if (e.code === 'ENOENT') {\n          return 'file-not-existing'\n        }\n      }\n      throw e\n    }\n  },\n  chmod: (filePath, mode) => fsp.chmod(filePath, mode),\n  chown: (filePath, uid, gid) => fsp.chown(filePath, uid, gid),\n}\n\ninterface Rerun {\n  rerun: true\n  msg?: string\n  event: GeneratorEvent\n}\nfunction rerun(opts: { msg?: string; event?: GeneratorEvent }): Rerun {\n  const { event, ...rest } = opts\n  return { rerun: true, event: event ?? { type: 'rerun' }, ...rest }\n}\n\nfunction isRerun(result: unknown): result is Rerun {\n  return (\n    typeof result === 'object' &&\n    result !== null &&\n    'rerun' in result &&\n    result.rerun === true\n  )\n}\n\nexport type FileEventType = 'create' | 'update' | 'delete'\nexport type FileEvent = {\n  type: FileEventType\n  path: string\n}\nexport type GeneratorEvent = FileEvent | { type: 'rerun' }\n\ntype FileCacheChange<TCacheEntry extends GeneratorCacheEntry> =\n  | {\n      result: false\n      cacheEntry: TCacheEntry\n    }\n  | { result: true; mtimeMs: bigint; cacheEntry: TCacheEntry }\n  | {\n      result: 'file-not-in-cache'\n    }\n  | {\n      result: 'cannot-stat-file'\n    }\n\ninterface GeneratorCacheEntry {\n  mtimeMs: bigint\n  fileContent: string\n}\n\ninterface RouteNodeCacheEntry extends GeneratorCacheEntry {\n  routeId: string\n  node: RouteNode\n}\n\ntype GeneratorRouteNodeCache = Map</** filePath **/ string, RouteNodeCacheEntry>\n\ninterface CrawlingResult {\n  rootRouteNode: RouteNode\n  routeFileResult: Array<RouteNode>\n  acc: HandleNodeAccumulator\n}\n\nexport class Generator {\n  /**\n   * why do we have two caches for the route files?\n   * During processing, we READ from the cache and WRITE to the shadow cache.\n   *\n   * After a route file is processed, we write to the shadow cache.\n   * If during processing we bail out and re-run, we don't lose this modification\n   * but still can track whether the file contributed changes and thus the route tree file needs to be regenerated.\n   * After all files are processed, we swap the shadow cache with the main cache and initialize a new shadow cache.\n   * That way we also ensure deleted/renamed files don't stay in the cache forever.\n   */\n  private routeNodeCache: GeneratorRouteNodeCache = new Map()\n  private routeNodeShadowCache: GeneratorRouteNodeCache = new Map()\n\n  private routeTreeFileCache: GeneratorCacheEntry | undefined\n\n  private crawlingResult: CrawlingResult | undefined\n  public config: Config\n  public targetTemplate: TargetTemplate\n\n  private root: string\n  private routesDirectoryPath: string\n  private sessionId?: string\n  private fs: fs\n  private logger: Logger\n  private generatedRouteTreePath: string\n  private runPromise: Promise<void> | undefined\n  private fileEventQueue: Array<GeneratorEvent> = []\n  private plugins: Array<GeneratorPlugin> = []\n  private static routeGroupPatternRegex = /\\(.+\\)/\n  private physicalDirectories: Array<string> = []\n\n  /**\n   * Token regexes are pre-compiled once here and reused throughout route processing.\n   * We need TWO types of regex for each token because they match against different inputs:\n   *\n   * 1. FILENAME regexes: Match token patterns within full file path strings.\n   *    Example: For file \"routes/dashboard.index.tsx\", we want to detect \".index.\"\n   *    Pattern: `[./](?:token)[.]` - matches token bounded by path separators/dots\n   *    Used in: sorting route nodes by file path\n   *\n   * 2. SEGMENT regexes: Match token against a single logical route segment.\n   *    Example: For segment \"index\" (extracted from path), match the whole segment\n   *    Pattern: `^(?:token)$` - matches entire segment exactly\n   *    Used in: route parsing, determining route types, escape detection\n   *\n   * We cannot reuse one for the other without false positives or missing matches.\n   */\n  private indexTokenFilenameRegex: RegExp\n  private routeTokenFilenameRegex: RegExp\n  private indexTokenSegmentRegex: RegExp\n  private routeTokenSegmentRegex: RegExp\n  private static componentPieceRegex =\n    /[./](component|errorComponent|notFoundComponent|pendingComponent|loader|lazy)[.]/\n\n  constructor(opts: { config: Config; root: string; fs?: fs }) {\n    this.config = opts.config\n    this.logger = logging({ disabled: this.config.disableLogging })\n    this.root = opts.root\n    this.fs = opts.fs || DefaultFileSystem\n    this.generatedRouteTreePath = this.getGeneratedRouteTreePath()\n    this.targetTemplate = getTargetTemplate(this.config)\n\n    this.routesDirectoryPath = this.getRoutesDirectoryPath()\n    this.plugins.push(...(opts.config.plugins || []))\n\n    // Create all token regexes once in constructor\n    this.indexTokenFilenameRegex = createTokenRegex(this.config.indexToken, {\n      type: 'filename',\n    })\n    this.routeTokenFilenameRegex = createTokenRegex(this.config.routeToken, {\n      type: 'filename',\n    })\n    this.indexTokenSegmentRegex = createTokenRegex(this.config.indexToken, {\n      type: 'segment',\n    })\n    this.routeTokenSegmentRegex = createTokenRegex(this.config.routeToken, {\n      type: 'segment',\n    })\n\n    for (const plugin of this.plugins) {\n      plugin.init?.({ generator: this })\n    }\n  }\n\n  private getGeneratedRouteTreePath() {\n    const generatedRouteTreePath = path.isAbsolute(\n      this.config.generatedRouteTree,\n    )\n      ? this.config.generatedRouteTree\n      : path.resolve(this.root, this.config.generatedRouteTree)\n\n    const generatedRouteTreeDir = path.dirname(generatedRouteTreePath)\n\n    if (!existsSync(generatedRouteTreeDir)) {\n      mkdirSync(generatedRouteTreeDir, { recursive: true })\n    }\n\n    return generatedRouteTreePath\n  }\n\n  private getRoutesDirectoryPath() {\n    return path.isAbsolute(this.config.routesDirectory)\n      ? this.config.routesDirectory\n      : path.resolve(this.root, this.config.routesDirectory)\n  }\n\n  public getRoutesByFileMap(): GetRoutesByFileMapResult {\n    return new Map(\n      [...this.routeNodeCache.entries()].map(([filePath, cacheEntry]) => [\n        filePath,\n        { routePath: cacheEntry.routeId },\n      ]),\n    )\n  }\n\n  public async run(event?: GeneratorEvent): Promise<void> {\n    if (\n      event &&\n      event.type !== 'rerun' &&\n      !this.isFileRelevantForRouteTreeGeneration(event.path)\n    ) {\n      return\n    }\n    this.fileEventQueue.push(event ?? { type: 'rerun' })\n    // only allow a single run at a time\n    if (this.runPromise) {\n      return this.runPromise\n    }\n\n    this.runPromise = (async () => {\n      do {\n        // synchronously copy and clear the queue since we are going to iterate asynchronously over it\n        // and while we do so, a new event could be put into the queue\n        const tempQueue = this.fileEventQueue\n        this.fileEventQueue = []\n        // if we only have 'update' events in the queue\n        // and we already have the affected files' latest state in our cache, we can exit early\n        const remainingEvents = (\n          await Promise.all(\n            tempQueue.map(async (e) => {\n              if (e.type === 'update') {\n                let cacheEntry: GeneratorCacheEntry | undefined\n                if (e.path === this.generatedRouteTreePath) {\n                  cacheEntry = this.routeTreeFileCache\n                } else {\n                  // we only check the routeNodeCache here\n                  // if the file's state is only up-to-date in the shadow cache we need to re-run\n                  cacheEntry = this.routeNodeCache.get(e.path)\n                }\n                const change = await this.didFileChangeComparedToCache(\n                  { path: e.path },\n                  cacheEntry,\n                )\n                if (change.result === false) {\n                  return null\n                }\n              }\n              return e\n            }),\n          )\n        ).filter((e) => e !== null)\n\n        if (remainingEvents.length === 0) {\n          break\n        }\n\n        try {\n          await this.generatorInternal()\n        } catch (err) {\n          const errArray = !Array.isArray(err) ? [err] : err\n\n          const recoverableErrors = errArray.filter((e) => isRerun(e))\n          if (recoverableErrors.length === errArray.length) {\n            this.fileEventQueue.push(...recoverableErrors.map((e) => e.event))\n            recoverableErrors.forEach((e) => {\n              if (e.msg) {\n                this.logger.info(e.msg)\n              }\n            })\n          } else {\n            const unrecoverableErrors = errArray.filter((e) => !isRerun(e))\n            this.runPromise = undefined\n            throw new Error(\n              unrecoverableErrors.map((e) => (e as Error).message).join(),\n            )\n          }\n        }\n      } while (this.fileEventQueue.length)\n      this.runPromise = undefined\n    })()\n    return this.runPromise\n  }\n\n  private async generatorInternal() {\n    let writeRouteTreeFile: boolean | 'force' = false\n\n    let getRouteNodesResult: GetRouteNodesResult\n\n    if (this.config.virtualRouteConfig) {\n      getRouteNodesResult = await virtualGetRouteNodes(this.config, this.root, {\n        indexTokenSegmentRegex: this.indexTokenSegmentRegex,\n        routeTokenSegmentRegex: this.routeTokenSegmentRegex,\n      })\n    } else {\n      getRouteNodesResult = await physicalGetRouteNodes(\n        this.config,\n        this.root,\n        {\n          indexTokenSegmentRegex: this.indexTokenSegmentRegex,\n          routeTokenSegmentRegex: this.routeTokenSegmentRegex,\n        },\n      )\n    }\n\n    const {\n      rootRouteNode,\n      routeNodes: beforeRouteNodes,\n      physicalDirectories,\n    } = getRouteNodesResult\n    if (rootRouteNode === undefined) {\n      let errorMessage = `rootRouteNode must not be undefined. Make sure you've added your root route into the route-tree.`\n      if (!this.config.virtualRouteConfig) {\n        errorMessage += `\\nMake sure that you add a \"${rootPathId}.${this.config.disableTypes ? 'js' : 'tsx'}\" file to your routes directory.\\nAdd the file in: \"${this.config.routesDirectory}/${rootPathId}.${this.config.disableTypes ? 'js' : 'tsx'}\"`\n      }\n      throw new Error(errorMessage)\n    }\n    this.physicalDirectories = physicalDirectories\n\n    await this.handleRootNode(rootRouteNode)\n\n    const preRouteNodes = multiSortBy(beforeRouteNodes, [\n      (d) => (d.routePath === '/' ? -1 : 1),\n      (d) => d.routePath?.split('/').length,\n      (d) => (d.filePath.match(this.indexTokenFilenameRegex) ? 1 : -1),\n      (d) => (d.filePath.match(Generator.componentPieceRegex) ? 1 : -1),\n      (d) => (d.filePath.match(this.routeTokenFilenameRegex) ? -1 : 1),\n      (d) => (d.routePath?.endsWith('/') ? -1 : 1),\n      (d) => d.routePath,\n    ]).filter((d) => {\n      // Exclude the root route itself, but keep component/loader pieces for the root\n      if (d.routePath === `/${rootPathId}`) {\n        return [\n          'component',\n          'errorComponent',\n          'notFoundComponent',\n          'pendingComponent',\n          'loader',\n          'lazy',\n        ].includes(d._fsRouteType)\n      }\n      return true\n    })\n\n    const routeFileAllResult = await Promise.allSettled(\n      preRouteNodes\n        // only process routes that are backed by an actual file\n        .filter((n) => !n.isVirtualParentRoute && !n.isVirtual)\n        .map((n) => this.processRouteNodeFile(n)),\n    )\n\n    const rejections = routeFileAllResult.filter(\n      (result) => result.status === 'rejected',\n    )\n    if (rejections.length > 0) {\n      throw rejections.map((e) => e.reason)\n    }\n\n    const routeFileResult = routeFileAllResult.flatMap((result) => {\n      if (result.status === 'fulfilled' && result.value !== null) {\n        if (result.value.shouldWriteTree) {\n          writeRouteTreeFile = true\n        }\n        return result.value.node\n      }\n      return []\n    })\n\n    // reset children in case we re-use a node from the cache\n    routeFileResult.forEach((r) => (r.children = undefined))\n\n    const acc: HandleNodeAccumulator = {\n      routeTree: [],\n      routeNodes: [],\n      routePiecesByPath: {},\n      routeNodesByPath: new Map(),\n    }\n\n    const prefixMap = new RoutePrefixMap(routeFileResult)\n\n    for (const node of routeFileResult) {\n      Generator.handleNode(node, acc, prefixMap, this.config)\n    }\n\n    this.crawlingResult = { rootRouteNode, routeFileResult, acc }\n\n    // this is the first time the generator runs, so read in the route tree file if it exists yet\n    if (!this.routeTreeFileCache) {\n      const routeTreeFile = await this.fs.readFile(this.generatedRouteTreePath)\n      if (routeTreeFile !== 'file-not-existing') {\n        this.routeTreeFileCache = {\n          fileContent: routeTreeFile.fileContent,\n          mtimeMs: routeTreeFile.stat.mtimeMs,\n        }\n      }\n      writeRouteTreeFile = true\n    } else {\n      const routeTreeFileChange = await this.didFileChangeComparedToCache(\n        { path: this.generatedRouteTreePath },\n        this.routeTreeFileCache,\n      )\n      if (routeTreeFileChange.result !== false) {\n        writeRouteTreeFile = 'force'\n        if (routeTreeFileChange.result === true) {\n          const routeTreeFile = await this.fs.readFile(\n            this.generatedRouteTreePath,\n          )\n          if (routeTreeFile !== 'file-not-existing') {\n            this.routeTreeFileCache = {\n              fileContent: routeTreeFile.fileContent,\n              mtimeMs: routeTreeFile.stat.mtimeMs,\n            }\n          }\n        }\n      }\n    }\n\n    if (!writeRouteTreeFile) {\n      // only needs to be done if no other changes have been detected yet\n      // compare shadowCache and cache to identify deleted routes\n      if (this.routeNodeCache.size !== this.routeNodeShadowCache.size) {\n        writeRouteTreeFile = true\n      } else {\n        for (const fullPath of this.routeNodeCache.keys()) {\n          if (!this.routeNodeShadowCache.has(fullPath)) {\n            writeRouteTreeFile = true\n            break\n          }\n        }\n      }\n    }\n\n    if (!writeRouteTreeFile) {\n      this.swapCaches()\n      return\n    }\n\n    const buildResult = this.buildRouteTree({\n      rootRouteNode,\n      acc,\n      routeFileResult,\n    })\n    let routeTreeContent = buildResult.routeTreeContent\n\n    routeTreeContent = this.config.enableRouteTreeFormatting\n      ? await format(routeTreeContent, this.config)\n      : routeTreeContent\n\n    let newMtimeMs: bigint | undefined\n    if (this.routeTreeFileCache) {\n      if (\n        writeRouteTreeFile !== 'force' &&\n        this.routeTreeFileCache.fileContent === routeTreeContent\n      ) {\n        // existing route tree file is already up-to-date, don't write it\n        // we should only get here in the initial run when the route cache is not filled yet\n      } else {\n        const newRouteTreeFileStat = await this.safeFileWrite({\n          filePath: this.generatedRouteTreePath,\n          newContent: routeTreeContent,\n          strategy: {\n            type: 'mtime',\n            expectedMtimeMs: this.routeTreeFileCache.mtimeMs,\n          },\n        })\n        newMtimeMs = newRouteTreeFileStat.mtimeMs\n      }\n    } else {\n      const newRouteTreeFileStat = await this.safeFileWrite({\n        filePath: this.generatedRouteTreePath,\n        newContent: routeTreeContent,\n        strategy: {\n          type: 'new-file',\n        },\n      })\n      newMtimeMs = newRouteTreeFileStat.mtimeMs\n    }\n\n    if (newMtimeMs !== undefined) {\n      this.routeTreeFileCache = {\n        fileContent: routeTreeContent,\n        mtimeMs: newMtimeMs,\n      }\n    }\n\n    this.plugins.map((plugin) => {\n      return plugin.onRouteTreeChanged?.({\n        routeTree: buildResult.routeTree,\n        routeNodes: buildResult.routeNodes,\n        acc,\n        rootRouteNode,\n      })\n    })\n    this.swapCaches()\n  }\n\n  private swapCaches() {\n    this.routeNodeCache = this.routeNodeShadowCache\n    this.routeNodeShadowCache = new Map()\n  }\n\n  public buildRouteTree(opts: {\n    rootRouteNode: RouteNode\n    acc: HandleNodeAccumulator\n    routeFileResult: Array<RouteNode>\n    config?: Partial<Config>\n  }) {\n    const config = { ...this.config, ...(opts.config || {}) }\n\n    const { rootRouteNode, acc } = opts\n\n    // Use pre-compiled regex if config hasn't been overridden, otherwise create new one\n    const indexTokenSegmentRegex =\n      config.indexToken === this.config.indexToken\n        ? this.indexTokenSegmentRegex\n        : createTokenRegex(config.indexToken, { type: 'segment' })\n\n    const sortedRouteNodes = multiSortBy(acc.routeNodes, [\n      (d) => (d.routePath?.includes(`/${rootPathId}`) ? -1 : 1),\n      (d) => d.routePath?.split('/').length,\n      (d) => {\n        const segments = d.routePath?.split('/').filter(Boolean) ?? []\n        const last = segments[segments.length - 1] ?? ''\n        return indexTokenSegmentRegex.test(last) ? -1 : 1\n      },\n      (d) => d,\n    ])\n\n    const routeImports: Array<ImportDeclaration> = []\n    const virtualRouteNodes: Array<string> = []\n\n    for (const node of sortedRouteNodes) {\n      if (node.isVirtual) {\n        virtualRouteNodes.push(\n          `const ${node.variableName}RouteImport = createFileRoute('${node.routePath}')()`,\n        )\n      } else {\n        routeImports.push(\n          getImportForRouteNode(\n            node,\n            config,\n            this.generatedRouteTreePath,\n            this.root,\n          ),\n        )\n      }\n    }\n\n    const imports: Array<ImportDeclaration> = []\n    if (virtualRouteNodes.length > 0) {\n      imports.push({\n        specifiers: [{ imported: 'createFileRoute' }],\n        source: this.targetTemplate.fullPkg,\n      })\n    }\n    // Add lazyRouteComponent import if there are component pieces\n    let hasComponentPieces = false\n    let hasLoaderPieces = false\n    for (const node of sortedRouteNodes) {\n      const pieces = acc.routePiecesByPath[node.routePath!]\n      if (pieces) {\n        if (\n          pieces.component ||\n          pieces.errorComponent ||\n          pieces.notFoundComponent ||\n          pieces.pendingComponent\n        ) {\n          hasComponentPieces = true\n        }\n        if (pieces.loader) {\n          hasLoaderPieces = true\n        }\n        if (hasComponentPieces && hasLoaderPieces) break\n      }\n    }\n    if (hasComponentPieces || hasLoaderPieces) {\n      const runtimeImport: ImportDeclaration = {\n        specifiers: [],\n        source: this.targetTemplate.fullPkg,\n      }\n      if (hasComponentPieces) {\n        runtimeImport.specifiers.push({ imported: 'lazyRouteComponent' })\n      }\n      if (hasLoaderPieces) {\n        runtimeImport.specifiers.push({ imported: 'lazyFn' })\n      }\n      imports.push(runtimeImport)\n    }\n    if (config.verboseFileRoutes === false) {\n      const typeImport: ImportDeclaration = {\n        specifiers: [],\n        source: this.targetTemplate.fullPkg,\n        importKind: 'type',\n      }\n      let needsCreateFileRoute = false\n      let needsCreateLazyFileRoute = false\n      for (const node of sortedRouteNodes) {\n        if (isRouteNodeValidForAugmentation(node)) {\n          if (node._fsRouteType !== 'lazy') {\n            needsCreateFileRoute = true\n          }\n          if (acc.routePiecesByPath[node.routePath!]?.lazy) {\n            needsCreateLazyFileRoute = true\n          }\n        }\n        if (needsCreateFileRoute && needsCreateLazyFileRoute) break\n      }\n      if (needsCreateFileRoute) {\n        typeImport.specifiers.push({ imported: 'CreateFileRoute' })\n      }\n      if (needsCreateLazyFileRoute) {\n        typeImport.specifiers.push({ imported: 'CreateLazyFileRoute' })\n      }\n\n      if (typeImport.specifiers.length > 0) {\n        typeImport.specifiers.push({ imported: 'FileRoutesByPath' })\n        imports.push(typeImport)\n      }\n    }\n\n    const routeTreeConfig = buildRouteTreeConfig(\n      acc.routeTree,\n      config.disableTypes,\n    )\n\n    const createUpdateRoutes = sortedRouteNodes.map((node) => {\n      const pieces = acc.routePiecesByPath[node.routePath!]\n      const loaderNode = pieces?.loader\n      const componentNode = pieces?.component\n      const errorComponentNode = pieces?.errorComponent\n      const notFoundComponentNode = pieces?.notFoundComponent\n      const pendingComponentNode = pieces?.pendingComponent\n      const lazyComponentNode = pieces?.lazy\n\n      return [\n        [\n          `const ${node.variableName}Route = ${node.variableName}RouteImport.update({\n            ${[\n              `id: '${node.path}'`,\n              !node.isNonPath ||\n              (node._fsRouteType === 'pathless_layout' && node.cleanedPath)\n                ? `path: '${node.cleanedPath}'`\n                : undefined,\n              `getParentRoute: () => ${findParent(node)}`,\n            ]\n              .filter(Boolean)\n              .join(',')}\n          }${config.disableTypes ? '' : 'as any'})`,\n          loaderNode\n            ? `.updateLoader({ loader: lazyFn(() => import('./${replaceBackslash(\n                removeExt(\n                  path.relative(\n                    path.dirname(config.generatedRouteTree),\n                    path.resolve(config.routesDirectory, loaderNode.filePath),\n                  ),\n                  config.addExtensions,\n                ),\n              )}'), 'loader') })`\n            : '',\n          componentNode ||\n          errorComponentNode ||\n          notFoundComponentNode ||\n          pendingComponentNode\n            ? `.update({\n                ${(\n                  [\n                    ['component', componentNode],\n                    ['errorComponent', errorComponentNode],\n                    ['notFoundComponent', notFoundComponentNode],\n                    ['pendingComponent', pendingComponentNode],\n                  ] as const\n                )\n                  .filter((d) => d[1])\n                  .map((d) => {\n                    // For .vue files, use 'default' as the export name since Vue SFCs export default\n                    const isVueFile = d[1]!.filePath.endsWith('.vue')\n                    const exportName = isVueFile ? 'default' : d[0]\n                    // Keep .vue extension for Vue files since Vite requires it\n                    const importPath = replaceBackslash(\n                      isVueFile\n                        ? path.relative(\n                            path.dirname(config.generatedRouteTree),\n                            path.resolve(\n                              config.routesDirectory,\n                              d[1]!.filePath,\n                            ),\n                          )\n                        : removeExt(\n                            path.relative(\n                              path.dirname(config.generatedRouteTree),\n                              path.resolve(\n                                config.routesDirectory,\n                                d[1]!.filePath,\n                              ),\n                            ),\n                            config.addExtensions,\n                          ),\n                    )\n                    return `${\n                      d[0]\n                    }: lazyRouteComponent(() => import('./${importPath}'), '${exportName}')`\n                  })\n                  .join('\\n,')}\n              })`\n            : '',\n          lazyComponentNode\n            ? (() => {\n                // For .vue files, use 'default' export since Vue SFCs export default\n                const isVueFile = lazyComponentNode.filePath.endsWith('.vue')\n                const exportAccessor = isVueFile ? 'd.default' : 'd.Route'\n                // Keep .vue extension for Vue files since Vite requires it\n                const importPath = replaceBackslash(\n                  isVueFile\n                    ? path.relative(\n                        path.dirname(config.generatedRouteTree),\n                        path.resolve(\n                          config.routesDirectory,\n                          lazyComponentNode.filePath,\n                        ),\n                      )\n                    : removeExt(\n                        path.relative(\n                          path.dirname(config.generatedRouteTree),\n                          path.resolve(\n                            config.routesDirectory,\n                            lazyComponentNode.filePath,\n                          ),\n                        ),\n                        config.addExtensions,\n                      ),\n                )\n                return `.lazy(() => import('./${importPath}').then((d) => ${exportAccessor}))`\n              })()\n            : '',\n        ].join(''),\n      ].join('\\n\\n')\n    })\n\n    // Generate update for root route if it has component pieces\n    const rootRoutePath = `/${rootPathId}`\n    const rootPieces = acc.routePiecesByPath[rootRoutePath]\n    const rootComponentNode = rootPieces?.component\n    const rootErrorComponentNode = rootPieces?.errorComponent\n    const rootNotFoundComponentNode = rootPieces?.notFoundComponent\n    const rootPendingComponentNode = rootPieces?.pendingComponent\n\n    let rootRouteUpdate = ''\n    if (\n      rootComponentNode ||\n      rootErrorComponentNode ||\n      rootNotFoundComponentNode ||\n      rootPendingComponentNode\n    ) {\n      rootRouteUpdate = `const rootRouteWithChildren = rootRouteImport${\n        rootComponentNode ||\n        rootErrorComponentNode ||\n        rootNotFoundComponentNode ||\n        rootPendingComponentNode\n          ? `.update({\n              ${(\n                [\n                  ['component', rootComponentNode],\n                  ['errorComponent', rootErrorComponentNode],\n                  ['notFoundComponent', rootNotFoundComponentNode],\n                  ['pendingComponent', rootPendingComponentNode],\n                ] as const\n              )\n                .filter((d) => d[1])\n                .map((d) => {\n                  // For .vue files, use 'default' as the export name since Vue SFCs export default\n                  const isVueFile = d[1]!.filePath.endsWith('.vue')\n                  const exportName = isVueFile ? 'default' : d[0]\n                  // Keep .vue extension for Vue files since Vite requires it\n                  const importPath = replaceBackslash(\n                    isVueFile\n                      ? path.relative(\n                          path.dirname(config.generatedRouteTree),\n                          path.resolve(config.routesDirectory, d[1]!.filePath),\n                        )\n                      : removeExt(\n                          path.relative(\n                            path.dirname(config.generatedRouteTree),\n                            path.resolve(\n                              config.routesDirectory,\n                              d[1]!.filePath,\n                            ),\n                          ),\n                          config.addExtensions,\n                        ),\n                  )\n                  return `${d[0]}: lazyRouteComponent(() => import('./${importPath}'), '${exportName}')`\n                })\n                .join('\\n,')}\n            })`\n          : ''\n      }._addFileChildren(rootRouteChildren)${config.disableTypes ? '' : `._addFileTypes<FileRouteTypes>()`}`\n    }\n\n    let fileRoutesByPathInterface = ''\n    let fileRoutesByFullPath = ''\n\n    if (!config.disableTypes) {\n      const routeNodesByFullPath = createRouteNodesByFullPath(acc.routeNodes)\n      const routeNodesByTo = createRouteNodesByTo(acc.routeNodes)\n      const routeNodesById = createRouteNodesById(acc.routeNodes)\n\n      fileRoutesByFullPath = [\n        `export interface FileRoutesByFullPath {\n${[...routeNodesByFullPath.entries()]\n  .filter(([fullPath]) => fullPath)\n  .map(([fullPath, routeNode]) => {\n    return `'${fullPath}': typeof ${getResolvedRouteNodeVariableName(routeNode)}`\n  })}\n}`,\n        `export interface FileRoutesByTo {\n${[...routeNodesByTo.entries()]\n  .filter(([to]) => to)\n  .map(([to, routeNode]) => {\n    return `'${to}': typeof ${getResolvedRouteNodeVariableName(routeNode)}`\n  })}\n}`,\n        `export interface FileRoutesById {\n'${rootRouteId}': typeof rootRouteImport,\n${[...routeNodesById.entries()].map(([id, routeNode]) => {\n  return `'${id}': typeof ${getResolvedRouteNodeVariableName(routeNode)}`\n})}\n}`,\n        `export interface FileRouteTypes {\nfileRoutesByFullPath: FileRoutesByFullPath\nfullPaths: ${\n          acc.routeNodes.length > 0\n            ? [...routeNodesByFullPath.keys()]\n                .filter((fullPath) => fullPath)\n                .map((fullPath) => `'${fullPath}'`)\n                .join('|')\n            : 'never'\n        }\nfileRoutesByTo: FileRoutesByTo\nto: ${\n          acc.routeNodes.length > 0\n            ? [...routeNodesByTo.keys()]\n                .filter((to) => to)\n                .map((to) => `'${to}'`)\n                .join('|')\n            : 'never'\n        }\nid: ${[`'${rootRouteId}'`, ...[...routeNodesById.keys()].map((id) => `'${id}'`)].join('|')}\nfileRoutesById: FileRoutesById\n}`,\n        `export interface RootRouteChildren {\n${acc.routeTree.map((child) => `${child.variableName}Route: typeof ${getResolvedRouteNodeVariableName(child)}`).join(',')}\n}`,\n      ].join('\\n')\n\n      fileRoutesByPathInterface = buildFileRoutesByPathInterface({\n        module: this.targetTemplate.fullPkg,\n        interfaceName: 'FileRoutesByPath',\n        routeNodes: sortedRouteNodes,\n        config,\n      })\n    }\n\n    const routeTree = [\n      `const rootRouteChildren${config.disableTypes ? '' : `: RootRouteChildren`} = {\n  ${acc.routeTree\n    .map(\n      (child) =>\n        `${child.variableName}Route: ${getResolvedRouteNodeVariableName(child)}`,\n    )\n    .join(',')}\n}`,\n      rootRouteUpdate\n        ? rootRouteUpdate.replace(\n            'const rootRouteWithChildren = ',\n            'export const routeTree = ',\n          )\n        : `export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)${config.disableTypes ? '' : `._addFileTypes<FileRouteTypes>()`}`,\n    ].join('\\n')\n\n    checkRouteFullPathUniqueness(\n      sortedRouteNodes.filter(\n        (d) => d.children === undefined && 'lazy' !== d._fsRouteType,\n      ),\n      config,\n    )\n\n    let mergedImports = mergeImportDeclarations(imports)\n    if (config.disableTypes) {\n      mergedImports = mergedImports.filter((d) => d.importKind !== 'type')\n    }\n\n    const importStatements = mergedImports.map(buildImportString)\n\n    let moduleAugmentation = ''\n    if (config.verboseFileRoutes === false && !config.disableTypes) {\n      moduleAugmentation = opts.routeFileResult\n        .map((node) => {\n          const getModuleDeclaration = (routeNode?: RouteNode) => {\n            if (!isRouteNodeValidForAugmentation(routeNode)) {\n              return ''\n            }\n            let moduleAugmentation = ''\n            if (routeNode._fsRouteType === 'lazy') {\n              moduleAugmentation = `const createLazyFileRoute: CreateLazyFileRoute<FileRoutesByPath['${routeNode.routePath}']['preLoaderRoute']>`\n            } else {\n              moduleAugmentation = `const createFileRoute: CreateFileRoute<'${routeNode.routePath}',\n                  FileRoutesByPath['${routeNode.routePath}']['parentRoute'],\n                  FileRoutesByPath['${routeNode.routePath}']['id'],\n                  FileRoutesByPath['${routeNode.routePath}']['path'],\n                  FileRoutesByPath['${routeNode.routePath}']['fullPath']\n                >\n              `\n            }\n\n            return `declare module './${getImportPath(routeNode, config, this.generatedRouteTreePath)}' {\n                      ${moduleAugmentation}\n                    }`\n          }\n          return getModuleDeclaration(node)\n        })\n        .join('\\n')\n    }\n\n    const rootRouteImport = getImportForRouteNode(\n      rootRouteNode,\n      config,\n      this.generatedRouteTreePath,\n      this.root,\n    )\n    routeImports.unshift(rootRouteImport)\n\n    let footer: Array<string> = []\n    if (config.routeTreeFileFooter) {\n      if (Array.isArray(config.routeTreeFileFooter)) {\n        footer = config.routeTreeFileFooter\n      } else {\n        footer = config.routeTreeFileFooter()\n      }\n    }\n    const routeTreeContent = [\n      ...config.routeTreeFileHeader,\n      `// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.`,\n      [...importStatements].join('\\n'),\n      mergeImportDeclarations(routeImports).map(buildImportString).join('\\n'),\n      virtualRouteNodes.join('\\n'),\n      createUpdateRoutes.join('\\n'),\n      fileRoutesByFullPath,\n      fileRoutesByPathInterface,\n      moduleAugmentation,\n      routeTreeConfig.join('\\n'),\n      routeTree,\n      ...footer,\n    ]\n      .filter(Boolean)\n      .join('\\n\\n')\n    return {\n      routeTreeContent,\n      routeTree: acc.routeTree,\n      routeNodes: acc.routeNodes,\n    }\n  }\n\n  private async processRouteNodeFile(node: RouteNode): Promise<{\n    shouldWriteTree: boolean\n    cacheEntry: RouteNodeCacheEntry\n    node: RouteNode\n  } | null> {\n    const result = await this.isRouteFileCacheFresh(node)\n\n    if (result.status === 'fresh') {\n      return {\n        node: result.cacheEntry.node,\n        shouldWriteTree: false,\n        cacheEntry: result.cacheEntry,\n      }\n    }\n\n    const previousCacheEntry = result.cacheEntry\n\n    const existingRouteFile = await this.fs.readFile(node.fullPath)\n    if (existingRouteFile === 'file-not-existing') {\n      throw new Error(`⚠️ File ${node.fullPath} does not exist`)\n    }\n\n    if (node.routePath) {\n      validateRouteParams(node.routePath, node.filePath, this.logger)\n    }\n\n    const updatedCacheEntry: RouteNodeCacheEntry = {\n      fileContent: existingRouteFile.fileContent,\n      mtimeMs: existingRouteFile.stat.mtimeMs,\n      routeId: node.routePath ?? '$$TSR_NO_ROUTE_PATH_ASSIGNED$$',\n      node,\n    }\n\n    const escapedRoutePath = node.routePath?.replaceAll('$', '$$') ?? ''\n\n    let shouldWriteRouteFile = false\n    let shouldWriteTree = false\n    // now we need to either scaffold the file or transform it\n    if (!existingRouteFile.fileContent) {\n      shouldWriteRouteFile = true\n      shouldWriteTree = true\n      // Creating a new lazy route file\n      if (node._fsRouteType === 'lazy') {\n        const tLazyRouteTemplate = this.targetTemplate.lazyRoute\n        // Check by default check if the user has a specific lazy route template\n        // If not, check if the user has a route template and use that instead\n        updatedCacheEntry.fileContent = await fillTemplate(\n          this.config,\n          (this.config.customScaffolding?.lazyRouteTemplate ||\n            this.config.customScaffolding?.routeTemplate) ??\n            tLazyRouteTemplate.template(),\n          {\n            tsrImports: tLazyRouteTemplate.imports.tsrImports(),\n            tsrPath: escapedRoutePath.replaceAll(/\\{(.+?)\\}/gm, '$1'),\n            tsrExportStart:\n              tLazyRouteTemplate.imports.tsrExportStart(escapedRoutePath),\n            tsrExportEnd: tLazyRouteTemplate.imports.tsrExportEnd(),\n          },\n        )\n      } else if (\n        // Creating a new normal route file\n        (['layout', 'static'] satisfies Array<FsRouteType>).some(\n          (d) => d === node._fsRouteType,\n        ) ||\n        (\n          [\n            'component',\n            'pendingComponent',\n            'errorComponent',\n            'notFoundComponent',\n            'loader',\n          ] satisfies Array<FsRouteType>\n        ).every((d) => d !== node._fsRouteType)\n      ) {\n        const tRouteTemplate = this.targetTemplate.route\n        updatedCacheEntry.fileContent = await fillTemplate(\n          this.config,\n          this.config.customScaffolding?.routeTemplate ??\n            tRouteTemplate.template(),\n          {\n            tsrImports: tRouteTemplate.imports.tsrImports(),\n            tsrPath: escapedRoutePath.replaceAll(/\\{(.+?)\\}/gm, '$1'),\n            tsrExportStart:\n              tRouteTemplate.imports.tsrExportStart(escapedRoutePath),\n            tsrExportEnd: tRouteTemplate.imports.tsrExportEnd(),\n          },\n        )\n      } else {\n        return null\n      }\n    }\n\n    // Check if this is a Vue component file\n    // Vue SFC files (.vue) don't need transformation as they can't have a Route export\n    const isVueFile = node.filePath.endsWith('.vue')\n\n    if (!isVueFile) {\n      // transform the file\n      const transformResult = await transform({\n        source: updatedCacheEntry.fileContent,\n        ctx: {\n          target: this.config.target,\n          routeId: escapedRoutePath,\n          lazy: node._fsRouteType === 'lazy',\n          verboseFileRoutes: !(this.config.verboseFileRoutes === false),\n        },\n        node,\n      })\n\n      if (transformResult.result === 'no-route-export') {\n        const fileName = path.basename(node.fullPath)\n        const dirName = path.dirname(node.fullPath)\n        const ignorePrefix = this.config.routeFileIgnorePrefix\n        const ignorePattern = this.config.routeFileIgnorePattern\n        const suggestedFileName = `${ignorePrefix}${fileName}`\n        const suggestedFullPath = path.join(dirName, suggestedFileName)\n\n        let message = `Warning: Route file \"${node.fullPath}\" does not export a Route. This file will not be included in the route tree.`\n        message += `\\n\\nIf this file is not intended to be a route, you can exclude it using one of these options:`\n        message += `\\n  1. Rename the file to \"${suggestedFullPath}\" (prefix with \"${ignorePrefix}\")`\n        message += `\\n  2. Use 'routeFileIgnorePattern' in your config to match this file`\n        message += `\\n\\nCurrent configuration:`\n        message += `\\n  routeFileIgnorePrefix: \"${ignorePrefix}\"`\n        message += `\\n  routeFileIgnorePattern: ${ignorePattern ? `\"${ignorePattern}\"` : 'undefined'}`\n\n        this.logger.warn(message)\n        return null\n      }\n      if (transformResult.result === 'error') {\n        throw new Error(\n          `Error transforming route file ${node.fullPath}: ${transformResult.error}`,\n        )\n      }\n      if (transformResult.result === 'modified') {\n        updatedCacheEntry.fileContent = transformResult.output\n        shouldWriteRouteFile = true\n      }\n    }\n\n    for (const plugin of this.plugins) {\n      plugin.afterTransform?.({ node, prevNode: previousCacheEntry?.node })\n    }\n\n    // file was changed\n    if (shouldWriteRouteFile) {\n      const stats = await this.safeFileWrite({\n        filePath: node.fullPath,\n        newContent: updatedCacheEntry.fileContent,\n        strategy: {\n          type: 'mtime',\n          expectedMtimeMs: updatedCacheEntry.mtimeMs,\n        },\n      })\n      updatedCacheEntry.mtimeMs = stats.mtimeMs\n    }\n\n    this.routeNodeShadowCache.set(node.fullPath, updatedCacheEntry)\n    return {\n      node,\n      shouldWriteTree,\n      cacheEntry: updatedCacheEntry,\n    }\n  }\n\n  private async didRouteFileChangeComparedToCache(\n    file: {\n      path: string\n      mtimeMs?: bigint\n    },\n    cache: 'routeNodeCache' | 'routeNodeShadowCache',\n  ): Promise<FileCacheChange<RouteNodeCacheEntry>> {\n    const cacheEntry = this[cache].get(file.path)\n    return this.didFileChangeComparedToCache(file, cacheEntry)\n  }\n\n  private async didFileChangeComparedToCache<\n    TCacheEntry extends GeneratorCacheEntry,\n  >(\n    file: {\n      path: string\n      mtimeMs?: bigint\n    },\n    cacheEntry: TCacheEntry | undefined,\n  ): Promise<FileCacheChange<TCacheEntry>> {\n    // for now we rely on the modification time of the file\n    // to determine if the file has changed\n    // we could also compare the file content but this would be slower as we would have to read the file\n\n    if (!cacheEntry) {\n      return { result: 'file-not-in-cache' }\n    }\n    let mtimeMs = file.mtimeMs\n\n    if (mtimeMs === undefined) {\n      try {\n        const currentStat = await this.fs.stat(file.path)\n        mtimeMs = currentStat.mtimeMs\n      } catch {\n        return { result: 'cannot-stat-file' }\n      }\n    }\n    return { result: mtimeMs !== cacheEntry.mtimeMs, mtimeMs, cacheEntry }\n  }\n\n  private async safeFileWrite(opts: {\n    filePath: string\n    newContent: string\n    strategy:\n      | {\n          type: 'mtime'\n          expectedMtimeMs: bigint\n        }\n      | {\n          type: 'new-file'\n        }\n  }) {\n    const tmpPath = this.getTempFileName(opts.filePath)\n    await this.fs.writeFile(tmpPath, opts.newContent)\n\n    if (opts.strategy.type === 'mtime') {\n      const beforeStat = await this.fs.stat(opts.filePath)\n      if (beforeStat.mtimeMs !== opts.strategy.expectedMtimeMs) {\n        throw rerun({\n          msg: `File ${opts.filePath} was modified by another process during processing.`,\n          event: { type: 'update', path: opts.filePath },\n        })\n      }\n      const newFileState = await this.fs.stat(tmpPath)\n      if (newFileState.mode !== beforeStat.mode) {\n        await this.fs.chmod(tmpPath, beforeStat.mode)\n      }\n      if (\n        newFileState.uid !== beforeStat.uid ||\n        newFileState.gid !== beforeStat.gid\n      ) {\n        try {\n          await this.fs.chown(tmpPath, beforeStat.uid, beforeStat.gid)\n        } catch (err) {\n          if (\n            typeof err === 'object' &&\n            err !== null &&\n            'code' in err &&\n            (err as any).code === 'EPERM'\n          ) {\n            console.warn(\n              `[safeFileWrite] chown failed: ${(err as any).message}`,\n            )\n          } else {\n            throw err\n          }\n        }\n      }\n    } else {\n      if (await checkFileExists(opts.filePath)) {\n        throw rerun({\n          msg: `File ${opts.filePath} already exists. Cannot overwrite.`,\n          event: { type: 'update', path: opts.filePath },\n        })\n      }\n    }\n\n    const stat = await this.fs.stat(tmpPath)\n\n    await this.fs.rename(tmpPath, opts.filePath)\n\n    return stat\n  }\n\n  private getTempFileName(filePath: string) {\n    const absPath = path.resolve(filePath)\n    const hash = crypto.createHash('md5').update(absPath).digest('hex')\n    // lazy initialize sessionId to only create tmpDir when it is first needed\n    if (!this.sessionId) {\n      // ensure the directory exists\n      mkdirSync(this.config.tmpDir, { recursive: true })\n      this.sessionId = crypto.randomBytes(4).toString('hex')\n    }\n    return path.join(this.config.tmpDir, `${this.sessionId}-${hash}`)\n  }\n\n  private async isRouteFileCacheFresh(node: RouteNode): Promise<\n    | {\n        status: 'fresh'\n        cacheEntry: RouteNodeCacheEntry\n      }\n    | { status: 'stale'; cacheEntry?: RouteNodeCacheEntry }\n  > {\n    const fileChangedCache = await this.didRouteFileChangeComparedToCache(\n      { path: node.fullPath },\n      'routeNodeCache',\n    )\n    if (fileChangedCache.result === false) {\n      this.routeNodeShadowCache.set(node.fullPath, fileChangedCache.cacheEntry)\n      return {\n        status: 'fresh',\n        cacheEntry: fileChangedCache.cacheEntry,\n      }\n    }\n    if (fileChangedCache.result === 'cannot-stat-file') {\n      throw new Error(`⚠️ expected route file to exist at ${node.fullPath}`)\n    }\n    const mtimeMs =\n      fileChangedCache.result === true ? fileChangedCache.mtimeMs : undefined\n\n    const shadowCacheFileChange = await this.didRouteFileChangeComparedToCache(\n      { path: node.fullPath, mtimeMs },\n      'routeNodeShadowCache',\n    )\n\n    if (shadowCacheFileChange.result === 'cannot-stat-file') {\n      throw new Error(`⚠️ expected route file to exist at ${node.fullPath}`)\n    }\n\n    if (shadowCacheFileChange.result === false) {\n      // shadow cache has latest file state already\n      if (fileChangedCache.result === true) {\n        return {\n          status: 'fresh',\n          cacheEntry: shadowCacheFileChange.cacheEntry,\n        }\n      }\n    }\n\n    if (fileChangedCache.result === 'file-not-in-cache') {\n      return {\n        status: 'stale',\n      }\n    }\n    return { status: 'stale', cacheEntry: fileChangedCache.cacheEntry }\n  }\n\n  private async handleRootNode(node: RouteNode) {\n    const result = await this.isRouteFileCacheFresh(node)\n\n    if (result.status === 'fresh') {\n      this.routeNodeShadowCache.set(node.fullPath, result.cacheEntry)\n    }\n    const rootNodeFile = await this.fs.readFile(node.fullPath)\n    if (rootNodeFile === 'file-not-existing') {\n      throw new Error(`⚠️ expected root route to exist at ${node.fullPath}`)\n    }\n\n    const updatedCacheEntry: RouteNodeCacheEntry = {\n      fileContent: rootNodeFile.fileContent,\n      mtimeMs: rootNodeFile.stat.mtimeMs,\n      routeId: node.routePath ?? '$$TSR_NO_ROOT_ROUTE_PATH_ASSIGNED$$',\n      node,\n    }\n\n    // scaffold the root route\n    if (!rootNodeFile.fileContent) {\n      const rootTemplate = this.targetTemplate.rootRoute\n      const rootRouteContent = await fillTemplate(\n        this.config,\n        rootTemplate.template(),\n        {\n          tsrImports: rootTemplate.imports.tsrImports(),\n          tsrPath: rootPathId,\n          tsrExportStart: rootTemplate.imports.tsrExportStart(),\n          tsrExportEnd: rootTemplate.imports.tsrExportEnd(),\n        },\n      )\n\n      this.logger.log(`🟡 Creating ${node.fullPath}`)\n      const stats = await this.safeFileWrite({\n        filePath: node.fullPath,\n        newContent: rootRouteContent,\n        strategy: {\n          type: 'mtime',\n          expectedMtimeMs: rootNodeFile.stat.mtimeMs,\n        },\n      })\n      updatedCacheEntry.fileContent = rootRouteContent\n      updatedCacheEntry.mtimeMs = stats.mtimeMs\n    }\n\n    this.routeNodeShadowCache.set(node.fullPath, updatedCacheEntry)\n  }\n\n  public async getCrawlingResult(): Promise<CrawlingResult | undefined> {\n    await this.runPromise\n    return this.crawlingResult\n  }\n\n  private static handleNode(\n    node: RouteNode,\n    acc: HandleNodeAccumulator,\n    prefixMap: RoutePrefixMap,\n    config?: Config,\n  ) {\n    let parentRoute = hasParentRoute(prefixMap, node, node.routePath)\n\n    // Check routeNodesByPath for a closer parent that may not be in prefixMap.\n    //\n    // Why: The prefixMap excludes lazy routes by design. When lazy-only routes are\n    // nested inside a pathless layout, the virtual route created from the lazy file\n    // won't be in the prefixMap, but it will be in routeNodesByPath.\n    //\n    // Example: Given files _layout/path.lazy.tsx and _layout/path.index.lazy.tsx:\n    //   - prefixMap contains: /_layout (from route.tsx)\n    //   - routeNodesByPath contains: /_layout AND /_layout/path (virtual from lazy)\n    //   - For /_layout/path/, hasParentRoute returns /_layout (wrong)\n    //   - But the correct parent is /_layout/path (the virtual route from path.lazy.tsx)\n    //\n    // We walk up the path segments to find the closest registered parent. This handles\n    // cases where multiple path segments (e.g., $a/$b) don't have intermediate routes.\n    if (node.routePath) {\n      let searchPath = node.routePath\n      while (searchPath.length > 0) {\n        const lastSlash = searchPath.lastIndexOf('/')\n        if (lastSlash <= 0) break\n\n        searchPath = searchPath.substring(0, lastSlash)\n        const candidate = acc.routeNodesByPath.get(searchPath)\n        if (candidate && candidate.routePath !== node.routePath) {\n          // Found a parent in routeNodesByPath\n          // If it's different from what prefixMap found AND is a closer match, use it\n          if (candidate !== parentRoute) {\n            // Check if this candidate is a closer parent than what prefixMap found\n            // (longer path prefix means closer parent)\n            if (\n              !parentRoute ||\n              (candidate.routePath?.length ?? 0) >\n                (parentRoute.routePath?.length ?? 0)\n            ) {\n              parentRoute = candidate\n            }\n          }\n          break\n        }\n      }\n    }\n\n    // Virtual routes may have an explicit parent from virtual config.\n    // If we can find that exact parent, use it to prevent auto-nesting siblings\n    // based on path prefix matching (#5822, #5431).\n    if (node._virtualParentRoutePath !== undefined) {\n      const explicitParent = acc.routeNodesByPath.get(\n        node._virtualParentRoutePath,\n      )\n      if (explicitParent) {\n        parentRoute = explicitParent\n      } else if (node._virtualParentRoutePath === `/${rootPathId}`) {\n        // The explicit parent is the root route (handled separately).\n        // Override path-based inference so this node stays at root level.\n        parentRoute = null\n      }\n      // Otherwise the explicit parent was a virtual file-less route that got\n      // filtered out. Fall back to the path-based parentRoute already computed.\n    }\n\n    if (parentRoute) node.parent = parentRoute\n\n    node.path = determineNodePath(node)\n\n    const trimmedPath = trimPathLeft(node.path ?? '')\n    const trimmedOriginalPath = trimPathLeft(\n      node.originalRoutePath?.replace(\n        node.parent?.originalRoutePath ?? '',\n        '',\n      ) ?? '',\n    )\n\n    const split = trimmedPath.split('/')\n    const originalSplit = trimmedOriginalPath.split('/')\n    const lastRouteSegment = split[split.length - 1] ?? trimmedPath\n    const lastOriginalSegment =\n      originalSplit[originalSplit.length - 1] ?? trimmedOriginalPath\n\n    // A segment is non-path if it starts with underscore AND the underscore is not escaped\n    node.isNonPath =\n      isSegmentPathless(lastRouteSegment, lastOriginalSegment) ||\n      split.every((part) => this.routeGroupPatternRegex.test(part))\n\n    // Use escape-aware functions to compute cleanedPath\n    node.cleanedPath = removeGroups(\n      removeUnderscoresWithEscape(\n        removeLayoutSegmentsWithEscape(node.path, node.originalRoutePath),\n        node.originalRoutePath,\n      ),\n    )\n\n    if (\n      node._fsRouteType === 'layout' ||\n      node._fsRouteType === 'pathless_layout'\n    ) {\n      node.cleanedPath = removeTrailingSlash(node.cleanedPath)\n    }\n\n    if (\n      !node.isVirtual &&\n      (\n        [\n          'lazy',\n          'loader',\n          'component',\n          'pendingComponent',\n          'errorComponent',\n          'notFoundComponent',\n        ] satisfies Array<FsRouteType>\n      ).some((d) => d === node._fsRouteType)\n    ) {\n      acc.routePiecesByPath[node.routePath!] =\n        acc.routePiecesByPath[node.routePath!] || {}\n\n      const pieceKey =\n        node._fsRouteType === 'lazy'\n          ? 'lazy'\n          : (node._fsRouteType as keyof (typeof acc.routePiecesByPath)[string])\n      acc.routePiecesByPath[node.routePath!]![pieceKey] = node\n\n      const anchorRoute = acc.routeNodesByPath.get(node.routePath!)\n\n      // Don't create virtual routes for root route component pieces - the root route is handled separately\n      if (!anchorRoute && node.routePath !== `/${rootPathId}`) {\n        this.handleNode(\n          {\n            ...node,\n            isVirtual: true,\n            _fsRouteType: 'static',\n          },\n          acc,\n          prefixMap,\n          config,\n        )\n      }\n      return\n    }\n\n    const isPathlessLayoutWithPath =\n      node._fsRouteType === 'pathless_layout' &&\n      node.cleanedPath &&\n      node.cleanedPath.length > 0\n\n    // Special handling: pathless layouts with path need to find real ancestor\n    if (!node.isVirtual && isPathlessLayoutWithPath) {\n      const immediateParentPath =\n        removeLastSegmentFromPath(node.routePath) || '/'\n      const immediateParentOriginalPath =\n        removeLastSegmentFromPath(node.originalRoutePath) || '/'\n      let searchPath = immediateParentPath\n\n      // Find nearest real (non-virtual, non-index) parent\n      while (searchPath) {\n        const candidate = acc.routeNodesByPath.get(searchPath)\n        if (candidate && !candidate.isVirtual && candidate.path !== '/') {\n          node.parent = candidate\n          node.path =\n            node.routePath?.replace(candidate.routePath ?? '', '') || '/'\n          const pathRelativeToParent =\n            immediateParentPath.replace(candidate.routePath ?? '', '') || '/'\n          const originalPathRelativeToParent =\n            immediateParentOriginalPath.replace(\n              candidate.originalRoutePath ?? '',\n              '',\n            ) || '/'\n          node.cleanedPath = removeGroups(\n            removeUnderscoresWithEscape(\n              removeLayoutSegmentsWithEscape(\n                pathRelativeToParent,\n                originalPathRelativeToParent,\n              ),\n              originalPathRelativeToParent,\n            ),\n          )\n          break\n        }\n        if (searchPath === '/') break\n        searchPath = removeLastSegmentFromPath(searchPath) || '/'\n      }\n    }\n\n    // Add to parent's children or to root\n    if (node.parent) {\n      node.parent.children = node.parent.children ?? []\n      node.parent.children.push(node)\n    } else {\n      acc.routeTree.push(node)\n    }\n\n    acc.routeNodes.push(node)\n    if (node.routePath) {\n      // Always register routes by path so child routes can find parents.\n      // Virtual routes (created from lazy-only files) also need to be registered\n      // so that index routes like path.index.lazy.tsx can find their parent path.lazy.tsx.\n      // If a non-virtual route is later processed for the same path, it will overwrite.\n      acc.routeNodesByPath.set(node.routePath, node)\n    }\n  }\n\n  // only process files that are relevant for the route tree generation\n  private isFileRelevantForRouteTreeGeneration(filePath: string): boolean {\n    // the generated route tree file\n    if (filePath === this.generatedRouteTreePath) {\n      return true\n    }\n\n    // files inside the routes folder\n    if (filePath.startsWith(this.routesDirectoryPath)) {\n      return true\n    }\n\n    // the virtual route config file passed into `virtualRouteConfig`\n    if (\n      typeof this.config.virtualRouteConfig === 'string' &&\n      filePath === this.config.virtualRouteConfig\n    ) {\n      return true\n    }\n\n    // this covers all files that are mounted via `virtualRouteConfig` or any `__virtual.ts` files\n    if (this.routeNodeCache.has(filePath)) {\n      return true\n    }\n\n    // virtual config files such as`__virtual.ts`\n    if (isVirtualConfigFile(path.basename(filePath))) {\n      return true\n    }\n\n    // route files inside directories mounted via `physical()` inside a virtual route config\n    if (this.physicalDirectories.some((dir) => filePath.startsWith(dir))) {\n      return true\n    }\n\n    return false\n  }\n}\n"
  },
  {
    "path": "packages/router-generator/src/index.ts",
    "content": "export {\n  configSchema,\n  getConfig,\n  resolveConfigPath,\n  baseConfigSchema,\n} from './config'\nexport type { Config, BaseConfig } from './config'\n\nexport { Generator } from './generator'\nexport type { FileEventType, FileEvent, GeneratorEvent } from './generator'\n\nexport type { GeneratorPlugin } from './plugin/types'\n\nexport {\n  capitalize,\n  cleanPath,\n  trimPathLeft,\n  removeLeadingSlash,\n  removeTrailingSlash,\n  determineInitialRoutePath,\n  replaceBackslash,\n  routePathToVariable,\n  removeUnderscores,\n  resetRegex,\n  multiSortBy,\n  writeIfDifferent,\n  format,\n  removeExt,\n  checkRouteFullPathUniqueness,\n  inferFullPath,\n} from './utils'\n\nexport type {\n  RouteNode,\n  GetRouteNodesResult,\n  GetRoutesByFileMapResult,\n  GetRoutesByFileMapResultValue,\n  ImportDeclaration,\n  ImportSpecifier,\n  HandleNodeAccumulator,\n} from './types'\n\nexport { getRouteNodes as physicalGetRouteNodes } from './filesystem/physical/getRouteNodes'\nexport { getRouteNodes as virtualGetRouteNodes } from './filesystem/virtual/getRouteNodes'\n\nexport { rootPathId } from './filesystem/physical/rootPathId'\n\nexport { ensureStringArgument } from './transform/utils'\n\nexport type {\n  TransformImportsConfig,\n  TransformContext,\n  TransformOptions,\n} from './transform/types'\n"
  },
  {
    "path": "packages/router-generator/src/logger.ts",
    "content": "export interface Logger {\n  log: (...args: Array<any>) => void\n  debug: (...args: Array<any>) => void\n  info: (...args: Array<any>) => void\n  warn: (...args: Array<any>) => void\n  error: (...args: Array<any>) => void\n}\n\nexport function logging(config: { disabled: boolean }): Logger {\n  function stripEmojis(str: string) {\n    return str.replace(\n      /[\\p{Emoji_Presentation}\\p{Extended_Pictographic}]/gu,\n      '',\n    )\n  }\n\n  function formatLogArgs(args: Array<any>): Array<any> {\n    if (process.env.CI) {\n      return args.map((arg) =>\n        typeof arg === 'string' ? stripEmojis(arg) : arg,\n      )\n    }\n    return args\n  }\n\n  return {\n    log: (...args: Array<any>) => {\n      if (!config.disabled) console.log(...formatLogArgs(args))\n    },\n    debug: (...args: Array<any>) => {\n      if (!config.disabled) console.debug(...formatLogArgs(args))\n    },\n    info: (...args: Array<any>) => {\n      if (!config.disabled) console.info(...formatLogArgs(args))\n    },\n    warn: (...args: Array<any>) => {\n      if (!config.disabled) console.warn(...formatLogArgs(args))\n    },\n    error: (...args: Array<any>) => {\n      if (!config.disabled) console.error(...formatLogArgs(args))\n    },\n  }\n}\n"
  },
  {
    "path": "packages/router-generator/src/plugin/types.ts",
    "content": "import type { HandleNodeAccumulator, RouteNode } from '../types'\nimport type { Generator } from '../generator'\n\nexport interface GeneratorPlugin {\n  name: string\n  init?: (opts: { generator: Generator }) => void\n  onRouteTreeChanged?: (opts: {\n    routeTree: Array<RouteNode>\n    routeNodes: Array<RouteNode>\n    rootRouteNode: RouteNode\n    acc: HandleNodeAccumulator\n  }) => void\n\n  afterTransform?: (opts: {\n    node: RouteNode\n    prevNode: RouteNode | undefined\n  }) => void\n}\n"
  },
  {
    "path": "packages/router-generator/src/template.ts",
    "content": "import { format } from './utils'\nimport type { Config } from './config'\n\ntype TemplateTag = 'tsrImports' | 'tsrPath' | 'tsrExportStart' | 'tsrExportEnd'\n\nexport function fillTemplate(\n  config: Config,\n  template: string,\n  values: Record<TemplateTag, string>,\n) {\n  const replaced = template.replace(\n    /%%(\\w+)%%/g,\n    (_, key) => values[key as TemplateTag] || '',\n  )\n  return format(replaced, config)\n}\n\nexport type TargetTemplate = {\n  fullPkg: string\n  subPkg: string\n  rootRoute: {\n    template: () => string\n    imports: {\n      tsrImports: () => string\n      tsrExportStart: () => string\n      tsrExportEnd: () => string\n    }\n  }\n  route: {\n    template: () => string\n    imports: {\n      tsrImports: () => string\n      tsrExportStart: (routePath: string) => string\n      tsrExportEnd: () => string\n    }\n  }\n  lazyRoute: {\n    template: () => string\n    imports: {\n      tsrImports: () => string\n      tsrExportStart: (routePath: string) => string\n      tsrExportEnd: () => string\n    }\n  }\n}\n\nexport function getTargetTemplate(config: Config): TargetTemplate {\n  const target = config.target\n  switch (target) {\n    case 'react':\n      return {\n        fullPkg: '@tanstack/react-router',\n        subPkg: 'react-router',\n        rootRoute: {\n          template: () =>\n            [\n              'import * as React from \"react\"\\n',\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RootComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RootComponent() { return (<React.Fragment><div>Hello \"%%tsrPath%%\"!</div><Outlet /></React.Fragment>) };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              \"import { Outlet, createRootRoute } from '@tanstack/react-router';\",\n            tsrExportStart: () => 'export const Route = createRootRoute(',\n            tsrExportEnd: () => ');',\n          },\n        },\n        route: {\n          template: () =>\n            [\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RouteComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RouteComponent() { return <div>Hello \"%%tsrPath%%\"!</div> };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              config.verboseFileRoutes === false\n                ? ''\n                : \"import { createFileRoute } from '@tanstack/react-router';\",\n            tsrExportStart: (routePath) =>\n              config.verboseFileRoutes === false\n                ? 'export const Route = createFileRoute('\n                : `export const Route = createFileRoute('${routePath}')(`,\n            tsrExportEnd: () => ');',\n          },\n        },\n        lazyRoute: {\n          template: () =>\n            [\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RouteComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RouteComponent() { return <div>Hello \"%%tsrPath%%\"!</div> };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              config.verboseFileRoutes === false\n                ? ''\n                : \"import { createLazyFileRoute } from '@tanstack/react-router';\",\n            tsrExportStart: (routePath) =>\n              config.verboseFileRoutes === false\n                ? 'export const Route = createLazyFileRoute('\n                : `export const Route = createLazyFileRoute('${routePath}')(`,\n            tsrExportEnd: () => ');',\n          },\n        },\n      }\n    case 'solid':\n      return {\n        fullPkg: '@tanstack/solid-router',\n        subPkg: 'solid-router',\n        rootRoute: {\n          template: () =>\n            [\n              'import * as Solid from \"solid-js\"\\n',\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RootComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RootComponent() { return (<><div>Hello \"%%tsrPath%%\"!</div><Outlet /></>) };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              \"import { Outlet, createRootRoute } from '@tanstack/solid-router';\",\n            tsrExportStart: () => 'export const Route = createRootRoute(',\n            tsrExportEnd: () => ');',\n          },\n        },\n        route: {\n          template: () =>\n            [\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RouteComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RouteComponent() { return <div>Hello \"%%tsrPath%%\"!</div> };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              config.verboseFileRoutes === false\n                ? ''\n                : \"import { createFileRoute } from '@tanstack/solid-router';\",\n            tsrExportStart: (routePath) =>\n              config.verboseFileRoutes === false\n                ? 'export const Route = createFileRoute('\n                : `export const Route = createFileRoute('${routePath}')(`,\n            tsrExportEnd: () => ');',\n          },\n        },\n        lazyRoute: {\n          template: () =>\n            [\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RouteComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RouteComponent() { return <div>Hello \"%%tsrPath%%\"!</div> };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              config.verboseFileRoutes === false\n                ? ''\n                : \"import { createLazyFileRoute } from '@tanstack/solid-router';\",\n\n            tsrExportStart: (routePath) =>\n              config.verboseFileRoutes === false\n                ? 'export const Route = createLazyFileRoute('\n                : `export const Route = createLazyFileRoute('${routePath}')(`,\n\n            tsrExportEnd: () => ');',\n          },\n        },\n      }\n    case 'vue':\n      return {\n        fullPkg: '@tanstack/vue-router',\n        subPkg: 'vue-router',\n        rootRoute: {\n          template: () =>\n            [\n              'import { h } from \"vue\"\\n',\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RootComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RootComponent() { return h(\"div\", {}, [\"Hello \\\\\"%%tsrPath%%\\\\\"!\", h(Outlet)]) };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              \"import { Outlet, createRootRoute } from '@tanstack/vue-router';\",\n            tsrExportStart: () => 'export const Route = createRootRoute(',\n            tsrExportEnd: () => ');',\n          },\n        },\n        route: {\n          template: () =>\n            [\n              'import { h } from \"vue\"\\n',\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RouteComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RouteComponent() { return h(\"div\", {}, \"Hello \\\\\"%%tsrPath%%\\\\\"!\") };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              config.verboseFileRoutes === false\n                ? ''\n                : \"import { createFileRoute } from '@tanstack/vue-router';\",\n            tsrExportStart: (routePath) =>\n              config.verboseFileRoutes === false\n                ? 'export const Route = createFileRoute('\n                : `export const Route = createFileRoute('${routePath}')(`,\n            tsrExportEnd: () => ');',\n          },\n        },\n        lazyRoute: {\n          template: () =>\n            [\n              'import { h } from \"vue\"\\n',\n              '%%tsrImports%%',\n              '\\n\\n',\n              '%%tsrExportStart%%{\\n component: RouteComponent\\n }%%tsrExportEnd%%\\n\\n',\n              'function RouteComponent() { return h(\"div\", {}, \"Hello \\\\\"%%tsrPath%%\\\\\"!\") };\\n',\n            ].join(''),\n          imports: {\n            tsrImports: () =>\n              config.verboseFileRoutes === false\n                ? ''\n                : \"import { createLazyFileRoute } from '@tanstack/vue-router';\",\n\n            tsrExportStart: (routePath) =>\n              config.verboseFileRoutes === false\n                ? 'export const Route = createLazyFileRoute('\n                : `export const Route = createLazyFileRoute('${routePath}')(`,\n\n            tsrExportEnd: () => ');',\n          },\n        },\n      }\n    default:\n      throw new Error(`router-generator: Unknown target type: ${target}`)\n  }\n}\n"
  },
  {
    "path": "packages/router-generator/src/transform/transform.ts",
    "content": "import { parseAst } from '@tanstack/router-utils'\nimport { parse, print, types, visit } from 'recast'\nimport { SourceMapConsumer } from 'source-map'\nimport { mergeImportDeclarations } from '../utils'\nimport { ensureStringArgument } from './utils'\nimport type { ImportDeclaration } from '../types'\nimport type { RawSourceMap } from 'source-map'\nimport type { TransformOptions, TransformResult } from './types'\n\nconst b = types.builders\n\nexport async function transform({\n  ctx,\n  source,\n  node,\n}: TransformOptions): Promise<TransformResult> {\n  let appliedChanges = false as boolean\n  let ast: types.namedTypes.File\n  try {\n    ast = parse(source, {\n      sourceFileName: 'output.ts',\n      parser: {\n        parse(code: string) {\n          return parseAst({\n            code,\n            // we need to instruct babel to produce tokens,\n            // otherwise recast will try to generate the tokens via its own parser and will fail\n            tokens: true,\n          })\n        },\n      },\n    })\n  } catch (e) {\n    console.error('Error parsing code', ctx.routeId, source, e)\n    return {\n      result: 'error',\n      error: e,\n    }\n  }\n\n  const preferredQuote = detectPreferredQuoteStyle(ast)\n\n  let routeExportHandled = false as boolean\n  function onExportFound(decl: types.namedTypes.VariableDeclarator) {\n    if (decl.init?.type === 'CallExpression') {\n      const callExpression = decl.init\n      const firstArgument = callExpression.arguments[0]\n      if (firstArgument) {\n        if (firstArgument.type === 'ObjectExpression') {\n          const staticProperties = firstArgument.properties.flatMap((p) => {\n            if (p.type === 'ObjectProperty' && p.key.type === 'Identifier') {\n              return p.key.name\n            }\n            return []\n          })\n          node.createFileRouteProps = new Set(staticProperties)\n        }\n      }\n      let identifier: types.namedTypes.Identifier | undefined\n      // `const Route = createFileRoute({ ... })`\n      if (callExpression.callee.type === 'Identifier') {\n        identifier = callExpression.callee\n        if (ctx.verboseFileRoutes) {\n          // we need to add the string literal via another CallExpression\n          callExpression.callee = b.callExpression(identifier, [\n            b.stringLiteral(ctx.routeId),\n          ])\n          appliedChanges = true\n        }\n      }\n      // `const Route = createFileRoute('/path')({ ... })`\n      else if (\n        callExpression.callee.type === 'CallExpression' &&\n        callExpression.callee.callee.type === 'Identifier'\n      ) {\n        identifier = callExpression.callee.callee\n        if (!ctx.verboseFileRoutes) {\n          // we need to remove the route id\n          callExpression.callee = identifier\n          appliedChanges = true\n        } else {\n          // check if the route id is correct\n          appliedChanges = ensureStringArgument(\n            callExpression.callee,\n            ctx.routeId,\n            ctx.preferredQuote,\n          )\n        }\n      }\n      if (identifier === undefined) {\n        throw new Error(\n          `expected identifier to be present in ${ctx.routeId} for export \"Route\"`,\n        )\n      }\n      if (identifier.name === 'createFileRoute' && ctx.lazy) {\n        identifier.name = 'createLazyFileRoute'\n        appliedChanges = true\n      } else if (identifier.name === 'createLazyFileRoute' && !ctx.lazy) {\n        identifier.name = 'createFileRoute'\n        appliedChanges = true\n      }\n    } else {\n      throw new Error(\n        `expected \"Route\" export to be initialized by a CallExpression`,\n      )\n    }\n    routeExportHandled = true\n  }\n\n  const program: types.namedTypes.Program = ast.program\n  // first pass: find Route export\n  for (const n of program.body) {\n    if (n.type === 'ExportNamedDeclaration') {\n      // direct export of a variable declaration, e.g. `export const Route = createFileRoute('/path')`\n      if (n.declaration?.type === 'VariableDeclaration') {\n        const decl = n.declaration.declarations[0]\n        if (\n          decl &&\n          decl.type === 'VariableDeclarator' &&\n          decl.id.type === 'Identifier'\n        ) {\n          if (decl.id.name === 'Route') {\n            onExportFound(decl)\n          }\n        }\n      }\n      // this is an export without a declaration, e.g. `export { Route }`\n      else if (n.declaration === null && n.specifiers) {\n        for (const spec of n.specifiers) {\n          if (typeof spec.exported.name === 'string') {\n            if (spec.exported.name === 'Route') {\n              const variableName = spec.local?.name || spec.exported.name\n              // find the matching variable declaration by iterating over the top-level declarations\n              for (const decl of program.body) {\n                if (\n                  decl.type === 'VariableDeclaration' &&\n                  decl.declarations[0]\n                ) {\n                  const variable = decl.declarations[0]\n                  if (\n                    variable.type === 'VariableDeclarator' &&\n                    variable.id.type === 'Identifier' &&\n                    variable.id.name === variableName\n                  ) {\n                    onExportFound(variable)\n                    break\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n    if (routeExportHandled) {\n      break\n    }\n  }\n\n  if (!routeExportHandled) {\n    return {\n      result: 'no-route-export',\n    }\n  }\n\n  const imports: {\n    required: Array<ImportDeclaration>\n    banned: Array<ImportDeclaration>\n  } = {\n    required: [],\n    banned: [],\n  }\n\n  const targetModule = `@tanstack/${ctx.target}-router`\n  if (ctx.verboseFileRoutes === false) {\n    imports.banned = [\n      {\n        source: targetModule,\n        specifiers: [\n          { imported: 'createLazyFileRoute' },\n          { imported: 'createFileRoute' },\n        ],\n      },\n    ]\n  } else {\n    if (ctx.lazy) {\n      imports.required = [\n        {\n          source: targetModule,\n          specifiers: [{ imported: 'createLazyFileRoute' }],\n        },\n      ]\n      imports.banned = [\n        {\n          source: targetModule,\n          specifiers: [{ imported: 'createFileRoute' }],\n        },\n      ]\n    } else {\n      imports.required = [\n        {\n          source: targetModule,\n          specifiers: [{ imported: 'createFileRoute' }],\n        },\n      ]\n      imports.banned = [\n        {\n          source: targetModule,\n          specifiers: [{ imported: 'createLazyFileRoute' }],\n        },\n      ]\n    }\n  }\n\n  imports.required = mergeImportDeclarations(imports.required)\n  imports.banned = mergeImportDeclarations(imports.banned)\n\n  const importStatementCandidates: Array<types.namedTypes.ImportDeclaration> =\n    []\n  const importDeclarationsToRemove: Array<types.namedTypes.ImportDeclaration> =\n    []\n\n  // second pass: apply import rules, but only if a matching export for the plugin was found\n  for (const n of program.body) {\n    const findImport =\n      (opts: { source: string; importKind?: 'type' | 'value' | 'typeof' }) =>\n      (i: ImportDeclaration) => {\n        if (i.source === opts.source) {\n          const importKind = i.importKind || 'value'\n          const expectedImportKind = opts.importKind || 'value'\n          return expectedImportKind === importKind\n        }\n        return false\n      }\n    if (n.type === 'ImportDeclaration' && typeof n.source.value === 'string') {\n      const filterImport = findImport({\n        source: n.source.value,\n        importKind: n.importKind,\n      })\n      let requiredImports = imports.required.filter(filterImport)[0]\n\n      const bannedImports = imports.banned.filter(filterImport)[0]\n      if (!requiredImports && !bannedImports) {\n        continue\n      }\n      const importSpecifiersToRemove: types.namedTypes.ImportDeclaration['specifiers'] =\n        []\n      if (n.specifiers) {\n        for (const spec of n.specifiers) {\n          if (!requiredImports && !bannedImports) {\n            break\n          }\n          if (\n            spec.type === 'ImportSpecifier' &&\n            typeof spec.imported.name === 'string'\n          ) {\n            if (requiredImports) {\n              const requiredImportIndex = requiredImports.specifiers.findIndex(\n                (imp) => imp.imported === spec.imported.name,\n              )\n              if (requiredImportIndex !== -1) {\n                // import is already present, remove it from requiredImports\n                requiredImports.specifiers.splice(requiredImportIndex, 1)\n                if (requiredImports.specifiers.length === 0) {\n                  imports.required = imports.required.splice(\n                    imports.required.indexOf(requiredImports),\n                    1,\n                  )\n                  requiredImports = undefined\n                }\n              } else {\n                // add the import statement to the candidates\n                importStatementCandidates.push(n)\n              }\n            }\n            if (bannedImports) {\n              const bannedImportIndex = bannedImports.specifiers.findIndex(\n                (imp) => imp.imported === spec.imported.name,\n              )\n              if (bannedImportIndex !== -1) {\n                importSpecifiersToRemove.push(spec)\n              }\n            }\n          }\n        }\n        if (importSpecifiersToRemove.length > 0) {\n          appliedChanges = true\n          n.specifiers = n.specifiers.filter(\n            (spec) => !importSpecifiersToRemove.includes(spec),\n          )\n\n          // mark the import statement as to be deleted if it is now empty\n          if (n.specifiers.length === 0) {\n            importDeclarationsToRemove.push(n)\n          }\n        }\n      }\n    }\n  }\n  imports.required.forEach((requiredImport) => {\n    if (requiredImport.specifiers.length > 0) {\n      appliedChanges = true\n      if (importStatementCandidates.length > 0) {\n        // find the first import statement that matches both the module and the import kind\n        const importStatement = importStatementCandidates.find(\n          (importStatement) => {\n            if (importStatement.source.value === requiredImport.source) {\n              const importKind = importStatement.importKind || 'value'\n              const requiredImportKind = requiredImport.importKind || 'value'\n              return importKind === requiredImportKind\n            }\n            return false\n          },\n        )\n        if (importStatement) {\n          if (importStatement.specifiers === undefined) {\n            importStatement.specifiers = []\n          }\n          const importSpecifiersToAdd = requiredImport.specifiers.map((spec) =>\n            b.importSpecifier(\n              b.identifier(spec.imported),\n              b.identifier(spec.imported),\n            ),\n          )\n          importStatement.specifiers = [\n            ...importStatement.specifiers,\n            ...importSpecifiersToAdd,\n          ]\n          return\n        }\n      }\n      const importStatement = b.importDeclaration(\n        requiredImport.specifiers.map((spec) =>\n          b.importSpecifier(\n            b.identifier(spec.imported),\n            spec.local ? b.identifier(spec.local) : null,\n          ),\n        ),\n        b.stringLiteral(requiredImport.source),\n      )\n      program.body.unshift(importStatement)\n    }\n  })\n  if (importDeclarationsToRemove.length > 0) {\n    appliedChanges = true\n    for (const importDeclaration of importDeclarationsToRemove) {\n      // check if the import declaration is still empty\n      if (importDeclaration.specifiers?.length === 0) {\n        const index = program.body.indexOf(importDeclaration)\n        if (index !== -1) {\n          program.body.splice(index, 1)\n        }\n      }\n    }\n  }\n\n  if (!appliedChanges) {\n    return {\n      result: 'not-modified',\n    }\n  }\n\n  const printResult = print(ast, {\n    reuseWhitespace: true,\n    sourceMapName: 'output.map',\n  })\n  let transformedCode = printResult.code\n  if (printResult.map) {\n    const fixedOutput = await fixTransformedOutputText({\n      originalCode: source,\n      transformedCode,\n      sourceMap: printResult.map as RawSourceMap,\n      preferredQuote,\n    })\n    transformedCode = fixedOutput\n  }\n  return {\n    result: 'modified',\n    output: transformedCode,\n  }\n}\n\nasync function fixTransformedOutputText({\n  originalCode,\n  transformedCode,\n  sourceMap,\n  preferredQuote,\n}: {\n  originalCode: string\n  transformedCode: string\n  sourceMap: RawSourceMap\n  preferredQuote: '\"' | \"'\"\n}) {\n  const originalLines = originalCode.split('\\n')\n  const transformedLines = transformedCode.split('\\n')\n\n  const defaultUsesSemicolons = detectSemicolonUsage(originalCode)\n\n  const consumer = await new SourceMapConsumer(sourceMap)\n\n  const fixedLines = transformedLines.map((line, i) => {\n    const transformedLineNum = i + 1\n\n    let origLineText: string | undefined = undefined\n\n    for (let col = 0; col < line.length; col++) {\n      const mapped = consumer.originalPositionFor({\n        line: transformedLineNum,\n        column: col,\n      })\n      if (mapped.line != null && mapped.line > 0) {\n        origLineText = originalLines[mapped.line - 1]\n        break\n      }\n    }\n\n    if (origLineText !== undefined) {\n      if (origLineText === line) {\n        return origLineText\n      }\n      return fixLine(line, {\n        originalLine: origLineText,\n        useOriginalSemicolon: true,\n        useOriginalQuotes: true,\n        fallbackQuote: preferredQuote,\n      })\n    } else {\n      return fixLine(line, {\n        originalLine: null,\n        useOriginalSemicolon: false,\n        useOriginalQuotes: false,\n        fallbackQuote: preferredQuote,\n        fallbackSemicolon: defaultUsesSemicolons,\n      })\n    }\n  })\n\n  return fixedLines.join('\\n')\n}\n\nfunction fixLine(\n  line: string,\n  {\n    originalLine,\n    useOriginalSemicolon,\n    useOriginalQuotes,\n    fallbackQuote,\n    fallbackSemicolon = true,\n  }: {\n    originalLine: string | null\n    useOriginalSemicolon: boolean\n    useOriginalQuotes: boolean\n    fallbackQuote: string\n    fallbackSemicolon?: boolean\n  },\n) {\n  let result = line\n\n  if (useOriginalQuotes && originalLine) {\n    result = fixQuotes(result, originalLine, fallbackQuote)\n  } else if (!useOriginalQuotes && fallbackQuote) {\n    result = fixQuotesToPreferred(result, fallbackQuote)\n  }\n\n  if (useOriginalSemicolon && originalLine) {\n    const hadSemicolon = originalLine.trimEnd().endsWith(';')\n    const hasSemicolon = result.trimEnd().endsWith(';')\n    if (hadSemicolon && !hasSemicolon) result += ';'\n    if (!hadSemicolon && hasSemicolon) result = result.replace(/;\\s*$/, '')\n  } else if (!useOriginalSemicolon) {\n    const hasSemicolon = result.trimEnd().endsWith(';')\n    if (!fallbackSemicolon && hasSemicolon) result = result.replace(/;\\s*$/, '')\n    if (fallbackSemicolon && !hasSemicolon && result.trim()) result += ';'\n  }\n\n  return result\n}\n\nfunction fixQuotes(line: string, originalLine: string, fallbackQuote: string) {\n  let originalQuote = detectQuoteFromLine(originalLine)\n  if (!originalQuote) {\n    originalQuote = fallbackQuote\n  }\n  return fixQuotesToPreferred(line, originalQuote)\n}\n\nfunction fixQuotesToPreferred(line: string, quote: string) {\n  // Replace existing quotes with preferred quote\n  return line.replace(\n    /(['\"`])([^'\"`\\\\]*(?:\\\\.[^'\"`\\\\]*)*)\\1/g,\n    (_, q, content) => {\n      const escaped = content.replaceAll(quote, `\\\\${quote}`)\n      return `${quote}${escaped}${quote}`\n    },\n  )\n}\n\nfunction detectQuoteFromLine(line: string) {\n  const match = line.match(/(['\"`])(?:\\\\.|[^\\\\])*?\\1/)\n  return match ? match[1] : null\n}\n\nfunction detectSemicolonUsage(code: string) {\n  const lines = code.split('\\n').map((l) => l.trim())\n  const total = lines.length\n  const withSemis = lines.filter((l) => l.endsWith(';')).length\n  return withSemis > total / 2\n}\n\nexport function detectPreferredQuoteStyle(ast: types.ASTNode): \"'\" | '\"' {\n  let single = 0\n  let double = 0\n\n  visit(ast, {\n    visitStringLiteral(path) {\n      if (path.parent.node.type !== 'JSXAttribute') {\n        const raw = path.node.extra?.raw\n        if (raw?.startsWith(\"'\")) single++\n        else if (raw?.startsWith('\"')) double++\n      }\n      return false\n    },\n  })\n\n  if (single >= double) {\n    return \"'\"\n  }\n  return '\"'\n}\n"
  },
  {
    "path": "packages/router-generator/src/transform/types.ts",
    "content": "import type { ImportDeclaration, RouteNode } from '../types'\nimport type { Config } from '../config'\n\nexport interface TransformOptions {\n  source: string\n  ctx: TransformContext\n  node: RouteNode\n}\n\nexport type TransformResult =\n  | {\n      result: 'no-route-export'\n    }\n  | {\n      result: 'not-modified'\n    }\n  | {\n      result: 'modified'\n      output: string\n    }\n  | {\n      result: 'error'\n      error?: any\n    }\n\nexport interface TransformImportsConfig {\n  banned?: Array<ImportDeclaration>\n  required?: Array<ImportDeclaration>\n}\n\nexport interface TransformContext {\n  target: Config['target']\n  routeId: string\n  lazy: boolean\n  verboseFileRoutes: boolean\n  preferredQuote?: '\"' | \"'\"\n}\n"
  },
  {
    "path": "packages/router-generator/src/transform/utils.ts",
    "content": "import { types } from 'recast'\n\nconst b = types.builders\n\nexport function ensureStringArgument(\n  callExpression: types.namedTypes.CallExpression,\n  value: string,\n  preferredQuote?: \"'\" | '\"',\n) {\n  const argument = callExpression.arguments[0]\n  if (!argument) {\n    let stringLiteral: types.namedTypes.StringLiteral\n    if (!preferredQuote) {\n      stringLiteral = b.stringLiteral.from({ value })\n    } else {\n      stringLiteral = b.stringLiteral.from({\n        value,\n        extra: {\n          rawValue: value,\n          raw: `${preferredQuote}${value}${preferredQuote}`,\n        },\n      })\n    }\n    callExpression.arguments.push(stringLiteral)\n    return true\n  } else if (argument.type === 'StringLiteral') {\n    if (argument.value !== value) {\n      argument.value = value\n      return true\n    }\n  } else if (argument.type === 'TemplateLiteral') {\n    if (\n      argument.quasis.length === 1 &&\n      argument.quasis[0] &&\n      argument.quasis[0].value.raw !== value\n    ) {\n      argument.quasis[0].value.raw = value\n      return true\n    }\n  }\n  return false\n}\n"
  },
  {
    "path": "packages/router-generator/src/types.ts",
    "content": "export type RouteNode = {\n  filePath: string\n  fullPath: string\n  variableName: string\n  _fsRouteType: FsRouteType\n  routePath?: string\n  originalRoutePath?: string\n  cleanedPath?: string\n  path?: string\n  isNonPath?: boolean\n  isVirtualParentRoute?: boolean\n  isVirtual?: boolean\n  children?: Array<RouteNode>\n  parent?: RouteNode\n  createFileRouteProps?: Set<string>\n  /**\n   * For virtual routes: the routePath of the explicit parent from virtual config.\n   * Used to prevent auto-nesting siblings based on path prefix matching (#5822, #5431).\n   * Falls back to path-based inference if the explicit parent is not found\n   * (e.g., when the parent is a virtual file-less route that gets filtered out).\n   */\n  _virtualParentRoutePath?: string\n}\n\nexport interface GetRouteNodesResult {\n  rootRouteNode?: RouteNode\n  routeNodes: Array<RouteNode>\n  physicalDirectories: Array<string>\n}\n\nexport type FsRouteType =\n  | '__root'\n  | 'static'\n  | 'layout'\n  | 'pathless_layout'\n  | 'lazy'\n  | 'loader' // @deprecated\n  | 'component' // @deprecated\n  | 'pendingComponent' // @deprecated\n  | 'errorComponent' // @deprecated\n  | 'notFoundComponent' // @deprecated\n\nexport type RouteSubNode = {\n  component?: RouteNode\n  errorComponent?: RouteNode\n  notFoundComponent?: RouteNode\n  pendingComponent?: RouteNode\n  loader?: RouteNode\n  lazy?: RouteNode\n}\n\nexport type ImportSpecifier = {\n  imported: string\n  local?: string\n}\nexport type ImportDeclaration = {\n  source: string\n  specifiers: Array<ImportSpecifier>\n  importKind?: 'type' | 'value'\n}\n\nexport type HandleNodeAccumulator = {\n  routeTree: Array<RouteNode>\n  routePiecesByPath: Record<string, RouteSubNode>\n  routeNodes: Array<RouteNode>\n  /** O(1) lookup by routePath - avoids O(n) .find() on every node */\n  routeNodesByPath: Map<string, RouteNode>\n}\n\nexport type GetRoutesByFileMapResultValue = { routePath: string }\nexport type GetRoutesByFileMapResult = Map<\n  string,\n  GetRoutesByFileMapResultValue\n>\n"
  },
  {
    "path": "packages/router-generator/src/utils.ts",
    "content": "/* eslint-disable @typescript-eslint/prefer-for-of */\nimport * as fsp from 'node:fs/promises'\nimport path from 'node:path'\nimport * as prettier from 'prettier'\nimport { rootPathId } from './filesystem/physical/rootPathId'\nimport type { Config, TokenMatcher } from './config'\nimport type { ImportDeclaration, RouteNode } from './types'\n\n/**\n * Prefix map for O(1) parent route lookups.\n * Maps each route path prefix to the route node that owns that prefix.\n * Enables finding longest matching parent without linear search.\n */\nexport class RoutePrefixMap {\n  private prefixToRoute: Map<string, RouteNode> = new Map()\n  private layoutRoutes: Array<RouteNode> = []\n\n  constructor(routes: Array<RouteNode>) {\n    for (const route of routes) {\n      if (!route.routePath || route.routePath === `/${rootPathId}`) continue\n\n      // Skip route pieces (lazy, loader, component, etc.) - they are merged with main routes\n      // and should not be valid parent candidates\n      if (\n        route._fsRouteType === 'lazy' ||\n        route._fsRouteType === 'loader' ||\n        route._fsRouteType === 'component' ||\n        route._fsRouteType === 'pendingComponent' ||\n        route._fsRouteType === 'errorComponent' ||\n        route._fsRouteType === 'notFoundComponent'\n      ) {\n        continue\n      }\n\n      // Index by exact path for direct lookups\n      this.prefixToRoute.set(route.routePath, route)\n\n      if (\n        route._fsRouteType === 'pathless_layout' ||\n        route._fsRouteType === 'layout' ||\n        route._fsRouteType === '__root'\n      ) {\n        this.layoutRoutes.push(route)\n      }\n    }\n\n    // Sort by path length descending for longest-match-first\n    this.layoutRoutes.sort(\n      (a, b) => (b.routePath?.length ?? 0) - (a.routePath?.length ?? 0),\n    )\n  }\n\n  /**\n   * Find the longest matching parent route for a given path.\n   * O(k) where k is the number of path segments, not O(n) routes.\n   */\n  findParent(routePath: string): RouteNode | null {\n    if (!routePath || routePath === '/') return null\n\n    // Walk up the path segments\n    let searchPath = routePath\n    while (searchPath.length > 0) {\n      const lastSlash = searchPath.lastIndexOf('/')\n      if (lastSlash <= 0) break\n\n      searchPath = searchPath.substring(0, lastSlash)\n      const parent = this.prefixToRoute.get(searchPath)\n      if (parent && parent.routePath !== routePath) {\n        return parent\n      }\n    }\n    return null\n  }\n\n  /**\n   * Check if a route exists at the given path.\n   */\n  has(routePath: string): boolean {\n    return this.prefixToRoute.has(routePath)\n  }\n\n  /**\n   * Get a route by exact path.\n   */\n  get(routePath: string): RouteNode | undefined {\n    return this.prefixToRoute.get(routePath)\n  }\n}\n\nexport function multiSortBy<T>(\n  arr: Array<T>,\n  accessors: Array<(item: T) => any> = [(d) => d],\n): Array<T> {\n  const len = arr.length\n  // Pre-compute all accessor values to avoid repeated function calls during sort\n  const indexed: Array<{ item: T; index: number; keys: Array<any> }> =\n    new Array(len)\n  for (let i = 0; i < len; i++) {\n    const item = arr[i]!\n    const keys = new Array(accessors.length)\n    for (let j = 0; j < accessors.length; j++) {\n      keys[j] = accessors[j]!(item)\n    }\n    indexed[i] = { item, index: i, keys }\n  }\n\n  indexed.sort((a, b) => {\n    for (let j = 0; j < accessors.length; j++) {\n      const ao = a.keys[j]\n      const bo = b.keys[j]\n\n      if (typeof ao === 'undefined') {\n        if (typeof bo === 'undefined') {\n          continue\n        }\n        return 1\n      }\n\n      if (ao === bo) {\n        continue\n      }\n\n      return ao > bo ? 1 : -1\n    }\n\n    return a.index - b.index\n  })\n\n  const result: Array<T> = new Array(len)\n  for (let i = 0; i < len; i++) {\n    result[i] = indexed[i]!.item\n  }\n  return result\n}\n\nexport function cleanPath(path: string) {\n  // remove double slashes\n  return path.replace(/\\/{2,}/g, '/')\n}\n\nexport function trimPathLeft(path: string) {\n  return path === '/' ? path : path.replace(/^\\/{1,}/, '')\n}\n\nexport function removeLeadingSlash(path: string): string {\n  return path.replace(/^\\//, '')\n}\n\nexport function removeTrailingSlash(s: string) {\n  return s.replace(/\\/$/, '')\n}\n\nconst BRACKET_CONTENT_RE = /\\[(.*?)\\]/g\nconst SPLIT_REGEX = /(?<!\\[)\\.(?!\\])/g\n\n/**\n * Characters that cannot be escaped in square brackets.\n * These are characters that would cause issues in URLs or file systems.\n */\nconst DISALLOWED_ESCAPE_CHARS = new Set([\n  '/',\n  '\\\\',\n  '?',\n  '#',\n  ':',\n  '*',\n  '<',\n  '>',\n  '|',\n  '!',\n  '$',\n  '%',\n])\n\nexport function determineInitialRoutePath(routePath: string) {\n  const originalRoutePath =\n    cleanPath(\n      `/${(cleanPath(routePath) || '').split(SPLIT_REGEX).join('/')}`,\n    ) || ''\n\n  const parts = routePath.split(SPLIT_REGEX)\n\n  // Escape any characters that in square brackets\n  // we keep the original path untouched\n  const escapedParts = parts.map((part) => {\n    // Check if any disallowed characters are used in brackets\n\n    let match\n    while ((match = BRACKET_CONTENT_RE.exec(part)) !== null) {\n      const character = match[1]\n      if (character === undefined) continue\n      if (DISALLOWED_ESCAPE_CHARS.has(character)) {\n        console.error(\n          `Error: Disallowed character \"${character}\" found in square brackets in route path \"${routePath}\".\\nYou cannot use any of the following characters in square brackets: ${Array.from(\n            DISALLOWED_ESCAPE_CHARS,\n          ).join(', ')}\\nPlease remove and/or replace them.`,\n        )\n        process.exit(1)\n      }\n    }\n\n    // Since this split segment is safe at this point, we can\n    // remove the brackets and replace them with the content inside\n    return part.replace(BRACKET_CONTENT_RE, '$1')\n  })\n\n  // If the syntax for prefix/suffix is different, from the path\n  // matching internals of router-core, we'd perform those changes here\n  // on the `escapedParts` array before it is joined back together in\n  // `final`\n\n  const final = cleanPath(`/${escapedParts.join('/')}`) || ''\n\n  return {\n    routePath: final,\n    originalRoutePath,\n  }\n}\n\n/**\n * Checks if a segment is fully escaped (entirely wrapped in brackets with no nested brackets).\n * E.g., \"[index]\" -> true, \"[_layout]\" -> true, \"foo[.]bar\" -> false, \"index\" -> false\n */\nfunction isFullyEscapedSegment(originalSegment: string): boolean {\n  return (\n    originalSegment.startsWith('[') &&\n    originalSegment.endsWith(']') &&\n    !originalSegment.slice(1, -1).includes('[') &&\n    !originalSegment.slice(1, -1).includes(']')\n  )\n}\n\n/**\n * Checks if the leading underscore in a segment is escaped.\n * Returns true if:\n * - Segment starts with [_] pattern: \"[_]layout\" -> \"_layout\"\n * - Segment is fully escaped and content starts with _: \"[_1nd3x]\" -> \"_1nd3x\"\n */\nexport function hasEscapedLeadingUnderscore(originalSegment: string): boolean {\n  // Pattern: [_]something or [_something]\n  return (\n    originalSegment.startsWith('[_]') ||\n    (originalSegment.startsWith('[_') && isFullyEscapedSegment(originalSegment))\n  )\n}\n\n/**\n * Checks if the trailing underscore in a segment is escaped.\n * Returns true if:\n * - Segment ends with [_] pattern: \"blog[_]\" -> \"blog_\"\n * - Segment is fully escaped and content ends with _: \"[_r0ut3_]\" -> \"_r0ut3_\"\n */\nexport function hasEscapedTrailingUnderscore(originalSegment: string): boolean {\n  // Pattern: something[_] or [something_]\n  return (\n    originalSegment.endsWith('[_]') ||\n    (originalSegment.endsWith('_]') && isFullyEscapedSegment(originalSegment))\n  )\n}\n\nconst backslashRegex = /\\\\/g\n\nexport function replaceBackslash(s: string) {\n  return s.replace(backslashRegex, '/')\n}\n\nconst alphanumericRegex = /[a-zA-Z0-9_]/\nconst splatSlashRegex = /\\/\\$\\//g\nconst trailingSplatRegex = /\\$$/g\nconst bracketSplatRegex = /\\$\\{\\$\\}/g\nconst dollarSignRegex = /\\$/g\nconst splitPathRegex = /[/-]/g\nconst leadingDigitRegex = /^(\\d)/g\n\nconst toVariableSafeChar = (char: string): string => {\n  if (alphanumericRegex.test(char)) {\n    return char // Keep alphanumeric characters and underscores as is\n  }\n\n  // Replace special characters with meaningful text equivalents\n  switch (char) {\n    case '.':\n      return 'Dot'\n    case '-':\n      return 'Dash'\n    case '@':\n      return 'At'\n    case '(':\n      return '' // Removed since route groups use parentheses\n    case ')':\n      return '' // Removed since route groups use parentheses\n    case ' ':\n      return '' // Remove spaces\n    default:\n      return `Char${char.charCodeAt(0)}` // For any other characters\n  }\n}\n\nexport function routePathToVariable(routePath: string): string {\n  const cleaned = removeUnderscores(routePath)\n  if (!cleaned) return ''\n\n  const parts = cleaned\n    .replace(splatSlashRegex, '/splat/')\n    .replace(trailingSplatRegex, 'splat')\n    .replace(bracketSplatRegex, 'splat')\n    .replace(dollarSignRegex, '')\n    .split(splitPathRegex)\n\n  let result = ''\n  for (let i = 0; i < parts.length; i++) {\n    const part = parts[i]!\n    const segment = i > 0 ? capitalize(part) : part\n    for (let j = 0; j < segment.length; j++) {\n      result += toVariableSafeChar(segment[j]!)\n    }\n  }\n\n  return result.replace(leadingDigitRegex, 'R$1')\n}\n\nconst underscoreStartEndRegex = /(^_|_$)/gi\nconst underscoreSlashRegex = /(\\/_|_\\/)/gi\n\nexport function removeUnderscores(s?: string) {\n  return s\n    ?.replace(underscoreStartEndRegex, '')\n    .replace(underscoreSlashRegex, '/')\n}\n\n/**\n * Removes underscores from a path, but preserves underscores that were escaped\n * in the original path (indicated by [_] syntax).\n *\n * @param routePath - The path with brackets removed\n * @param originalPath - The original path that may contain [_] escape sequences\n * @returns The path with non-escaped underscores removed\n */\nexport function removeUnderscoresWithEscape(\n  routePath?: string,\n  originalPath?: string,\n): string {\n  if (!routePath) return ''\n  if (!originalPath) return removeUnderscores(routePath) ?? ''\n\n  const routeSegments = routePath.split('/')\n  const originalSegments = originalPath.split('/')\n\n  const newSegments = routeSegments.map((segment, i) => {\n    const originalSegment = originalSegments[i] || ''\n\n    // Check if leading underscore is escaped\n    const leadingEscaped = hasEscapedLeadingUnderscore(originalSegment)\n    // Check if trailing underscore is escaped\n    const trailingEscaped = hasEscapedTrailingUnderscore(originalSegment)\n\n    let result = segment\n\n    // Remove leading underscore only if not escaped\n    if (result.startsWith('_') && !leadingEscaped) {\n      result = result.slice(1)\n    }\n\n    // Remove trailing underscore only if not escaped\n    if (result.endsWith('_') && !trailingEscaped) {\n      result = result.slice(0, -1)\n    }\n\n    return result\n  })\n\n  return newSegments.join('/')\n}\n\n/**\n * Removes layout segments (segments starting with underscore) from a path,\n * but preserves segments where the underscore was escaped.\n *\n * @param routePath - The path with brackets removed\n * @param originalPath - The original path that may contain [_] escape sequences\n * @returns The path with non-escaped layout segments removed\n */\nexport function removeLayoutSegmentsWithEscape(\n  routePath: string = '/',\n  originalPath?: string,\n): string {\n  if (!originalPath) return removeLayoutSegments(routePath)\n\n  const routeSegments = routePath.split('/')\n  const originalSegments = originalPath.split('/')\n\n  // Keep segments that are NOT pathless (i.e., don't start with unescaped underscore)\n  const newSegments = routeSegments.filter((segment, i) => {\n    const originalSegment = originalSegments[i] || ''\n    return !isSegmentPathless(segment, originalSegment)\n  })\n\n  return newSegments.join('/')\n}\n\n/**\n * Checks if a segment should be treated as a pathless/layout segment.\n * A segment is pathless if it starts with underscore and the underscore is not escaped.\n *\n * @param segment - The segment from routePath (brackets removed)\n * @param originalSegment - The segment from originalRoutePath (may contain brackets)\n * @returns true if the segment is pathless (has non-escaped leading underscore)\n */\nexport function isSegmentPathless(\n  segment: string,\n  originalSegment: string,\n): boolean {\n  if (!segment.startsWith('_')) return false\n  return !hasEscapedLeadingUnderscore(originalSegment)\n}\n\nfunction escapeRegExp(s: string): string {\n  return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nfunction sanitizeTokenFlags(flags?: string): string | undefined {\n  if (!flags) return flags\n\n  // Prevent stateful behavior with RegExp.prototype.test/exec\n  // g = global, y = sticky\n  return flags.replace(/[gy]/g, '')\n}\n\nexport function createTokenRegex(\n  token: TokenMatcher,\n  opts: {\n    type: 'segment' | 'filename'\n  },\n): RegExp {\n  // Defensive check: if token is undefined/null, throw a clear error\n  // (runtime safety for config loading edge cases)\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n  if (token === undefined || token === null) {\n    throw new Error(\n      `createTokenRegex: token is ${token}. This usually means the config was not properly parsed with defaults.`,\n    )\n  }\n\n  try {\n    if (typeof token === 'string') {\n      return opts.type === 'segment'\n        ? new RegExp(`^${escapeRegExp(token)}$`)\n        : new RegExp(`[./]${escapeRegExp(token)}[.]`)\n    }\n\n    if (token instanceof RegExp) {\n      const flags = sanitizeTokenFlags(token.flags)\n      return opts.type === 'segment'\n        ? new RegExp(`^(?:${token.source})$`, flags)\n        : new RegExp(`[./](?:${token.source})[.]`, flags)\n    }\n\n    // Handle JSON regex object form: { regex: string, flags?: string }\n    if (typeof token === 'object' && 'regex' in token) {\n      const flags = sanitizeTokenFlags(token.flags)\n      return opts.type === 'segment'\n        ? new RegExp(`^(?:${token.regex})$`, flags)\n        : new RegExp(`[./](?:${token.regex})[.]`, flags)\n    }\n\n    throw new Error(\n      `createTokenRegex: invalid token type. Expected string, RegExp, or { regex, flags } object, got: ${typeof token}`,\n    )\n  } catch (e) {\n    if (e instanceof SyntaxError) {\n      const pattern =\n        typeof token === 'string'\n          ? token\n          : token instanceof RegExp\n            ? token.source\n            : token.regex\n      throw new Error(\n        `Invalid regex pattern in token config: \"${pattern}\". ${e.message}`,\n      )\n    }\n    throw e\n  }\n}\n\nexport function isBracketWrappedSegment(segment: string): boolean {\n  return segment.startsWith('[') && segment.endsWith(']')\n}\n\nexport function unwrapBracketWrappedSegment(segment: string): string {\n  return isBracketWrappedSegment(segment) ? segment.slice(1, -1) : segment\n}\n\nexport function removeLeadingUnderscores(s: string, routeToken: string) {\n  if (!s) return s\n\n  const hasLeadingUnderscore = routeToken[0] === '_'\n\n  const routeTokenToExclude = hasLeadingUnderscore\n    ? routeToken.slice(1)\n    : routeToken\n\n  const escapedRouteToken = escapeRegExp(routeTokenToExclude)\n\n  const leadingUnderscoreRegex = hasLeadingUnderscore\n    ? new RegExp(`(?<=^|\\\\/)_(?!${escapedRouteToken})`, 'g')\n    : new RegExp(`(?<=^|\\\\/)_`, 'g')\n\n  return s.replaceAll(leadingUnderscoreRegex, '')\n}\n\nexport function removeTrailingUnderscores(s: string, routeToken: string) {\n  if (!s) return s\n\n  const hasTrailingUnderscore = routeToken.slice(-1) === '_'\n\n  const routeTokenToExclude = hasTrailingUnderscore\n    ? routeToken.slice(0, -1)\n    : routeToken\n\n  const escapedRouteToken = escapeRegExp(routeTokenToExclude)\n\n  const trailingUnderscoreRegex = hasTrailingUnderscore\n    ? new RegExp(`(?<!${escapedRouteToken})_(?=\\\\/|$)`, 'g')\n    : new RegExp(`_(?=\\\\/)|_$`, 'g')\n\n  return s.replaceAll(trailingUnderscoreRegex, '')\n}\n\nexport function capitalize(s: string) {\n  if (typeof s !== 'string') return ''\n  return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\nexport function removeExt(d: string, addExtensions: boolean | string = false) {\n  if (typeof addExtensions === 'string') {\n    const dotIndex = d.lastIndexOf('.')\n    if (dotIndex === -1) return d\n    return d.substring(0, dotIndex) + addExtensions\n  }\n  return addExtensions ? d : d.substring(0, d.lastIndexOf('.')) || d\n}\n\n/**\n * This function writes to a file if the content is different.\n *\n * @param filepath The path to the file\n * @param content Original content\n * @param incomingContent New content\n * @param callbacks Callbacks to run before and after writing\n * @returns Whether the file was written\n */\nexport async function writeIfDifferent(\n  filepath: string,\n  content: string,\n  incomingContent: string,\n  callbacks?: { beforeWrite?: () => void; afterWrite?: () => void },\n): Promise<boolean> {\n  if (content !== incomingContent) {\n    callbacks?.beforeWrite?.()\n    await fsp.writeFile(filepath, incomingContent)\n    callbacks?.afterWrite?.()\n    return true\n  }\n  return false\n}\n\n/**\n * This function formats the source code using the default formatter (Prettier).\n *\n * @param source The content to format\n * @param config The configuration object\n * @returns The formatted content\n */\nexport async function format(\n  source: string,\n  config: {\n    quoteStyle: 'single' | 'double'\n    semicolons: boolean\n  },\n): Promise<string> {\n  const prettierOptions: prettier.Config = {\n    semi: config.semicolons,\n    singleQuote: config.quoteStyle === 'single',\n    parser: 'typescript',\n  }\n  return prettier.format(source, prettierOptions)\n}\n\n/**\n * This function resets the regex index to 0 so that it can be reused\n * without having to create a new regex object or worry about the last\n * state when using the global flag.\n *\n * @param regex The regex object to reset\n * @returns\n */\nexport function resetRegex(regex: RegExp) {\n  regex.lastIndex = 0\n  return\n}\n\n/**\n * This function checks if a file exists.\n *\n * @param file The path to the file\n * @returns Whether the file exists\n */\nexport async function checkFileExists(file: string) {\n  try {\n    await fsp.access(file, fsp.constants.F_OK)\n    return true\n  } catch {\n    return false\n  }\n}\n\nconst possiblyNestedRouteGroupPatternRegex = /\\([^/]+\\)\\/?/g\nexport function removeGroups(s: string) {\n  return s.replace(possiblyNestedRouteGroupPatternRegex, '')\n}\n\n/**\n * Removes all segments from a given path that start with an underscore ('_').\n *\n * @param {string} routePath - The path from which to remove segments. Defaults to '/'.\n * @returns {string} The path with all underscore-prefixed segments removed.\n * @example\n * removeLayoutSegments('/workspace/_auth/foo') // '/workspace/foo'\n */\nexport function removeLayoutSegments(routePath: string = '/'): string {\n  const segments = routePath.split('/')\n  const newSegments = segments.filter((segment) => !segment.startsWith('_'))\n  return newSegments.join('/')\n}\n\n/**\n * The `node.path` is used as the `id` in the route definition.\n * This function checks if the given node has a parent and if so, it determines the correct path for the given node.\n * @param node - The node to determine the path for.\n * @returns The correct path for the given node.\n */\nexport function determineNodePath(node: RouteNode) {\n  return (node.path = node.parent\n    ? node.routePath?.replace(node.parent.routePath ?? '', '') || '/'\n    : node.routePath)\n}\n\n/**\n * Removes the last segment from a given path. Segments are considered to be separated by a '/'.\n *\n * @param {string} routePath - The path from which to remove the last segment. Defaults to '/'.\n * @returns {string} The path with the last segment removed.\n * @example\n * removeLastSegmentFromPath('/workspace/_auth/foo') // '/workspace/_auth'\n */\nexport function removeLastSegmentFromPath(routePath: string = '/'): string {\n  const segments = routePath.split('/')\n  segments.pop() // Remove the last segment\n  return segments.join('/')\n}\n\n/**\n * Find parent route using RoutePrefixMap for O(k) lookups instead of O(n).\n */\nexport function hasParentRoute(\n  prefixMap: RoutePrefixMap,\n  node: RouteNode,\n  routePathToCheck: string | undefined,\n): RouteNode | null {\n  if (!routePathToCheck || routePathToCheck === '/') {\n    return null\n  }\n\n  return prefixMap.findParent(routePathToCheck)\n}\n\n/**\n * Gets the final variable name for a route\n */\nexport const getResolvedRouteNodeVariableName = (\n  routeNode: RouteNode,\n): string => {\n  return routeNode.children?.length\n    ? `${routeNode.variableName}RouteWithChildren`\n    : `${routeNode.variableName}Route`\n}\n\n/**\n * Checks if a given RouteNode is valid for augmenting it with typing based on conditions.\n * Also asserts that the RouteNode is defined.\n *\n * @param routeNode - The RouteNode to check.\n * @returns A boolean indicating whether the RouteNode is defined.\n */\nexport function isRouteNodeValidForAugmentation(\n  routeNode?: RouteNode,\n): routeNode is RouteNode {\n  if (!routeNode || routeNode.isVirtual) {\n    return false\n  }\n  return true\n}\n\n/**\n * Infers the path for use by TS\n */\nexport const inferPath = (routeNode: RouteNode): string => {\n  if (routeNode.cleanedPath === '/') {\n    return routeNode.cleanedPath ?? ''\n  }\n  return routeNode.cleanedPath?.replace(/\\/$/, '') ?? ''\n}\n\n/**\n * Infers the full path for use by TS\n */\nexport const inferFullPath = (routeNode: RouteNode): string => {\n  const fullPath = removeGroups(\n    removeUnderscoresWithEscape(\n      removeLayoutSegmentsWithEscape(\n        routeNode.routePath,\n        routeNode.originalRoutePath,\n      ),\n      routeNode.originalRoutePath,\n    ),\n  )\n\n  if (fullPath === '') {\n    return '/'\n  }\n\n  // Preserve trailing slash for index routes (routePath ends with '/')\n  // This ensures types match runtime behavior\n  const isIndexRoute = routeNode.routePath?.endsWith('/')\n  if (isIndexRoute) {\n    return fullPath\n  }\n\n  return fullPath.replace(/\\/$/, '')\n}\n\nconst shouldPreferIndexRoute = (\n  current: RouteNode,\n  existing: RouteNode,\n): boolean => {\n  return existing.cleanedPath === '/' && current.cleanedPath !== '/'\n}\n\n/**\n * Creates a map from fullPath to routeNode\n */\nexport const createRouteNodesByFullPath = (\n  routeNodes: Array<RouteNode>,\n): Map<string, RouteNode> => {\n  const map = new Map<string, RouteNode>()\n\n  for (const routeNode of routeNodes) {\n    const fullPath = inferFullPath(routeNode)\n\n    if (fullPath === '/' && map.has('/')) {\n      const existing = map.get('/')!\n      if (shouldPreferIndexRoute(routeNode, existing)) {\n        continue\n      }\n    }\n\n    map.set(fullPath, routeNode)\n  }\n\n  return map\n}\n\n/**\n * Create a map from 'to' to a routeNode\n */\nexport const createRouteNodesByTo = (\n  routeNodes: Array<RouteNode>,\n): Map<string, RouteNode> => {\n  const map = new Map<string, RouteNode>()\n\n  for (const routeNode of dedupeBranchesAndIndexRoutes(routeNodes)) {\n    const to = inferTo(routeNode)\n\n    if (to === '/' && map.has('/')) {\n      const existing = map.get('/')!\n      if (shouldPreferIndexRoute(routeNode, existing)) {\n        continue\n      }\n    }\n\n    map.set(to, routeNode)\n  }\n\n  return map\n}\n\n/**\n * Create a map from 'id' to a routeNode\n */\nexport const createRouteNodesById = (\n  routeNodes: Array<RouteNode>,\n): Map<string, RouteNode> => {\n  return new Map(\n    routeNodes.map((routeNode) => {\n      const id = routeNode.routePath ?? ''\n      return [id, routeNode]\n    }),\n  )\n}\n\n/**\n * Infers to path\n */\nexport const inferTo = (routeNode: RouteNode): string => {\n  const fullPath = inferFullPath(routeNode)\n\n  if (fullPath === '/') return fullPath\n\n  return fullPath.replace(/\\/$/, '')\n}\n\n/**\n * Dedupes branches and index routes\n */\nexport const dedupeBranchesAndIndexRoutes = (\n  routes: Array<RouteNode>,\n): Array<RouteNode> => {\n  return routes.filter((route) => {\n    if (route.children?.find((child) => child.cleanedPath === '/')) return false\n    return true\n  })\n}\n\nfunction checkUnique<TElement>(routes: Array<TElement>, key: keyof TElement) {\n  // Check no two routes have the same `key`\n  // if they do, throw an error with the conflicting filePaths\n  const keys = routes.map((d) => d[key])\n  const uniqueKeys = new Set(keys)\n  if (keys.length !== uniqueKeys.size) {\n    const duplicateKeys = keys.filter((d, i) => keys.indexOf(d) !== i)\n    const conflictingFiles = routes.filter((d) =>\n      duplicateKeys.includes(d[key]),\n    )\n    return conflictingFiles\n  }\n  return undefined\n}\n\nexport function checkRouteFullPathUniqueness(\n  _routes: Array<RouteNode>,\n  config: Config,\n) {\n  const emptyPathRoutes = _routes.filter((d) => d.routePath === '')\n  if (emptyPathRoutes.length) {\n    const errorMessage = `Invalid route path \"\" was found. Root routes must be defined via __root.tsx (createRootRoute), not createFileRoute('') or a route file that resolves to an empty path.\nConflicting files: \\n ${emptyPathRoutes\n      .map((d) => path.resolve(config.routesDirectory, d.filePath))\n      .join('\\n ')}\\n`\n    throw new Error(errorMessage)\n  }\n\n  const routes = _routes.map((d) => {\n    const inferredFullPath = inferFullPath(d)\n    return { ...d, inferredFullPath }\n  })\n\n  const conflictingFiles = checkUnique(routes, 'inferredFullPath')\n\n  if (conflictingFiles !== undefined) {\n    const errorMessage = `Conflicting configuration paths were found for the following route${conflictingFiles.length > 1 ? 's' : ''}: ${conflictingFiles\n      .map((p) => `\"${p.inferredFullPath}\"`)\n      .join(', ')}.\nPlease ensure each Route has a unique full path.\nConflicting files: \\n ${conflictingFiles.map((d) => path.resolve(config.routesDirectory, d.filePath)).join('\\n ')}\\n`\n    throw new Error(errorMessage)\n  }\n}\n\nexport function buildRouteTreeConfig(\n  nodes: Array<RouteNode>,\n  disableTypes: boolean,\n  depth = 1,\n): Array<string> {\n  const children = nodes.map((node) => {\n    if (node._fsRouteType === '__root') {\n      return\n    }\n\n    if (node._fsRouteType === 'pathless_layout' && !node.children?.length) {\n      return\n    }\n\n    const route = `${node.variableName}`\n\n    if (node.children?.length) {\n      const childConfigs = buildRouteTreeConfig(\n        node.children,\n        disableTypes,\n        depth + 1,\n      )\n\n      const childrenDeclaration = disableTypes\n        ? ''\n        : `interface ${route}RouteChildren {\n  ${node.children\n    .map(\n      (child) =>\n        `${child.variableName}Route: typeof ${getResolvedRouteNodeVariableName(child)}`,\n    )\n    .join(',')}\n}`\n\n      const children = `const ${route}RouteChildren${disableTypes ? '' : `: ${route}RouteChildren`} = {\n  ${node.children\n    .map(\n      (child) =>\n        `${child.variableName}Route: ${getResolvedRouteNodeVariableName(child)}`,\n    )\n    .join(',')}\n}`\n\n      const routeWithChildren = `const ${route}RouteWithChildren = ${route}Route._addFileChildren(${route}RouteChildren)`\n\n      return [\n        childConfigs.join('\\n'),\n        childrenDeclaration,\n        children,\n        routeWithChildren,\n      ].join('\\n\\n')\n    }\n\n    return undefined\n  })\n\n  return children.filter((x) => x !== undefined)\n}\n\nexport function buildImportString(\n  importDeclaration: ImportDeclaration,\n): string {\n  const { source, specifiers, importKind } = importDeclaration\n  return specifiers.length\n    ? `import ${importKind === 'type' ? 'type ' : ''}{ ${specifiers.map((s) => (s.local ? `${s.imported} as ${s.local}` : s.imported)).join(', ')} } from '${source}'`\n    : ''\n}\n\nexport function lowerCaseFirstChar(value: string) {\n  if (!value[0]) {\n    return value\n  }\n\n  return value[0].toLowerCase() + value.slice(1)\n}\n\nexport function mergeImportDeclarations(\n  imports: Array<ImportDeclaration>,\n): Array<ImportDeclaration> {\n  const merged = new Map<string, ImportDeclaration>()\n\n  for (const imp of imports) {\n    const key = `${imp.source}-${imp.importKind ?? ''}`\n    let existing = merged.get(key)\n    if (!existing) {\n      existing = { ...imp, specifiers: [] }\n      merged.set(key, existing)\n    }\n\n    const existingSpecs = existing.specifiers\n    for (const specifier of imp.specifiers) {\n      let found = false\n      for (let i = 0; i < existingSpecs.length; i++) {\n        const e = existingSpecs[i]!\n        if (e.imported === specifier.imported && e.local === specifier.local) {\n          found = true\n          break\n        }\n      }\n      if (!found) {\n        existingSpecs.push(specifier)\n      }\n    }\n  }\n\n  return [...merged.values()]\n}\n\nexport const findParent = (node: RouteNode | undefined): string => {\n  if (!node) {\n    return `rootRouteImport`\n  }\n  if (node.parent) {\n    return `${node.parent.variableName}Route`\n  }\n  return findParent(node.parent)\n}\n\nexport function buildFileRoutesByPathInterface(opts: {\n  routeNodes: Array<RouteNode>\n  module: string\n  interfaceName: string\n  config?: Pick<Config, 'routeToken'>\n}): string {\n  return `declare module '${opts.module}' {\n  interface ${opts.interfaceName} {\n    ${opts.routeNodes\n      .map((routeNode) => {\n        const filePathId = routeNode.routePath\n        const preloaderRoute = `typeof ${routeNode.variableName}RouteImport`\n\n        const parent = findParent(routeNode)\n\n        return `'${filePathId}': {\n          id: '${filePathId}'\n          path: '${inferPath(routeNode)}'\n          fullPath: '${inferFullPath(routeNode)}'\n          preLoaderRoute: ${preloaderRoute}\n          parentRoute: typeof ${parent}\n        }`\n      })\n      .join('\\n')}\n  }\n}`\n}\n\nexport function getImportPath(\n  node: RouteNode,\n  config: Config,\n  generatedRouteTreePath: string,\n): string {\n  return replaceBackslash(\n    removeExt(\n      path.relative(\n        path.dirname(generatedRouteTreePath),\n        path.resolve(config.routesDirectory, node.filePath),\n      ),\n      config.addExtensions,\n    ),\n  )\n}\n\nexport function getImportForRouteNode(\n  node: RouteNode,\n  config: Config,\n  generatedRouteTreePath: string,\n  root: string,\n): ImportDeclaration {\n  let source = ''\n  if (config.importRoutesUsingAbsolutePaths) {\n    source = replaceBackslash(\n      removeExt(\n        path.resolve(root, config.routesDirectory, node.filePath),\n        config.addExtensions,\n      ),\n    )\n  } else {\n    source = `./${getImportPath(node, config, generatedRouteTreePath)}`\n  }\n  return {\n    source,\n    specifiers: [\n      {\n        imported: 'Route',\n        local: `${node.variableName}RouteImport`,\n      },\n    ],\n  } satisfies ImportDeclaration\n}\n"
  },
  {
    "path": "packages/router-generator/src/validate-route-params.ts",
    "content": "import type { Logger } from './logger'\n\n/**\n * Regex for valid JavaScript identifier (param name)\n * Must start with letter, underscore, or dollar sign\n * Can contain letters, numbers, underscores, or dollar signs\n */\nconst VALID_PARAM_NAME_REGEX = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/\n\ninterface ExtractedParam {\n  /** The param name without $ prefix (e.g., \"userId\", \"optional\") */\n  paramName: string\n  /** Whether this param name is valid */\n  isValid: boolean\n}\n\n/**\n * Extracts param names from a route path segment.\n *\n * Handles these patterns:\n * - $paramName                     -> extract \"paramName\"\n * - {$paramName}                   -> extract \"paramName\"\n * - prefix{$paramName}suffix       -> extract \"paramName\"\n * - {-$paramName}                  -> extract \"paramName\" (optional)\n * - prefix{-$paramName}suffix      -> extract \"paramName\" (optional)\n * - $ or {$}                       -> wildcard, skip validation\n */\nfunction extractParamsFromSegment(segment: string): Array<ExtractedParam> {\n  const params: Array<ExtractedParam> = []\n\n  // Skip empty segments\n  if (!segment || !segment.includes('$')) {\n    return params\n  }\n\n  // Check for wildcard ($ alone or {$})\n  if (segment === '$' || segment === '{$}') {\n    return params // Wildcard, no param name to validate\n  }\n\n  // Pattern 1: Simple $paramName (entire segment starts with $)\n  if (segment.startsWith('$') && !segment.includes('{')) {\n    const paramName = segment.slice(1)\n    if (paramName) {\n      params.push({\n        paramName,\n        isValid: VALID_PARAM_NAME_REGEX.test(paramName),\n      })\n    }\n    return params\n  }\n\n  // Pattern 2: Braces pattern {$paramName} or {-$paramName} with optional prefix/suffix\n  // Match patterns like: prefix{$param}suffix, {$param}, {-$param}\n  const bracePattern = /\\{(-?\\$)([^}]*)\\}/g\n  let match\n\n  while ((match = bracePattern.exec(segment)) !== null) {\n    const paramName = match[2] // The param name after $ or -$\n\n    if (!paramName) {\n      // This is a wildcard {$} or {-$}, skip\n      continue\n    }\n\n    params.push({\n      paramName,\n      isValid: VALID_PARAM_NAME_REGEX.test(paramName),\n    })\n  }\n\n  return params\n}\n\n/**\n * Extracts all params from a route path.\n *\n * @param path - The route path (e.g., \"/users/$userId/posts/$postId\")\n * @returns Array of extracted params with validation info\n */\nfunction extractParamsFromPath(path: string): Array<ExtractedParam> {\n  if (!path || !path.includes('$')) {\n    return []\n  }\n\n  const segments = path.split('/')\n  const allParams: Array<ExtractedParam> = []\n\n  for (const segment of segments) {\n    const params = extractParamsFromSegment(segment)\n    allParams.push(...params)\n  }\n\n  return allParams\n}\n\n/**\n * Validates route params and logs warnings for invalid param names.\n *\n * @param routePath - The route path to validate\n * @param filePath - The file path for error messages\n * @param logger - Logger instance for warnings\n */\nexport function validateRouteParams(\n  routePath: string,\n  filePath: string,\n  logger: Logger,\n): void {\n  const params = extractParamsFromPath(routePath)\n  const invalidParams = params.filter((p) => !p.isValid)\n\n  for (const param of invalidParams) {\n    logger.warn(\n      `WARNING: Invalid param name \"${param.paramName}\" in route \"${routePath}\" (file: ${filePath}). ` +\n        `Param names must be valid JavaScript identifiers (match /[a-zA-Z_$][a-zA-Z0-9_$]*/).`,\n    )\n  }\n}\n"
  },
  {
    "path": "packages/router-generator/tests/config/json-config/tsr.config.json",
    "content": "{\n  \"disableLogging\": true,\n  \"routesDirectory\": \"./configured-routes-path\",\n  \"generatedRouteTree\": \"./routeTree.gen.ts\"\n}\n"
  },
  {
    "path": "packages/router-generator/tests/config.test.ts",
    "content": "import { join } from 'node:path'\nimport { describe, expect, it } from 'vitest'\n\nimport { getConfig } from '../src'\n\nfunction makeFolderDir(folder: string) {\n  return join(process.cwd(), 'tests', 'config', folder)\n}\n\ntype TestCases = Array<{\n  folder: string\n}>\n\ndescribe('load config tests', () => {\n  it.each([\n    {\n      folder: 'json-config',\n    },\n  ] satisfies TestCases)(\n    'should load config correctly: $folder',\n    async ({ folder }) => {\n      const absPath = makeFolderDir(folder)\n      const resolvedConfig = getConfig({}, absPath)\n      expect(resolvedConfig).toEqual(\n        expect.objectContaining({\n          disableLogging: true,\n          routesDirectory: join(absPath, './configured-routes-path'),\n          generatedRouteTree: join(absPath, './routeTree.gen.ts'),\n        }),\n      )\n    },\n  )\n})\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/flat-flat/(group).index.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/flat-flat/(group).tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/flat-flat/__root.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/flat-flat/about.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/flat-nested/__root.tsx",
    "content": ""
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/flat-nested/about.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/flat-nested/nested/(group).index.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/flat-nested/nested/(group).tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/nested-flat/(group)/index.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/nested-flat/(group).tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/nested-flat/__root.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/nested-flat/about.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/nested-nested/__root.tsx",
    "content": ""
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/nested-nested/about.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/nested-nested/nested/(group)/index.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config/nested-nested/nested/(group).tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/deny-route-group-config.test.ts",
    "content": "import { join } from 'node:path'\nimport { describe, expect, it } from 'vitest'\n\nimport { Generator, getConfig } from '../src'\nimport type { Config } from '../src'\n\nfunction makeFolderDir(folder: string) {\n  return join(process.cwd(), 'tests', 'deny-route-group-config', folder)\n}\n\nfunction setupConfig(\n  folder: string,\n  inlineConfig: Partial<Omit<Config, 'routesDirectory'>> = {},\n) {\n  const { generatedRouteTree = `/routeTree.gen.ts`, ...rest } = inlineConfig\n  const dir = makeFolderDir(folder)\n\n  const config = getConfig({\n    disableLogging: true,\n    routesDirectory: dir,\n    generatedRouteTree: dir + generatedRouteTree,\n    ...rest,\n  })\n  return config\n}\n\ntype TestCases = Array<{\n  folder: string\n  expectedError: string\n}>\n\ndescribe('deny-route-group-config throws', () => {\n  const testCases = [\n    {\n      folder: 'flat-flat',\n      expectedError:\n        'A route configuration for a route group was found at `(group).tsx`. This is not supported. Did you mean to use a layout/pathless route instead?',\n    },\n    {\n      folder: 'nested-flat',\n      expectedError:\n        'A route configuration for a route group was found at `(group).tsx`. This is not supported. Did you mean to use a layout/pathless route instead?',\n    },\n    {\n      folder: 'flat-nested',\n      expectedError:\n        'A route configuration for a route group was found at `nested/(group).tsx`. This is not supported. Did you mean to use a layout/pathless route instead?',\n    },\n    {\n      folder: 'nested-nested',\n      expectedError:\n        'A route configuration for a route group was found at `nested/(group).tsx`. This is not supported. Did you mean to use a layout/pathless route instead?',\n    },\n  ]\n\n  it.each(testCases)(\n    'should throw an error for the folder: $folder',\n    async ({ folder, expectedError }) => {\n      const config = setupConfig(folder)\n      const folderRoot = makeFolderDir(folder)\n\n      const generator = new Generator({ config, root: folderRoot })\n      try {\n        await generator.run()\n      } catch (error) {\n        expect(error).toBeInstanceOf(Error)\n        expect((error as Error).message.startsWith(expectedError)).toBeTruthy()\n      }\n    },\n  )\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/add-extensions-custom/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root.js'\nimport { Route as PostsRouteImport } from './routes/posts.js'\nimport { Route as IndexRouteImport } from './routes/index.js'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts'\n  id: '__root__' | '/' | '/posts'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/add-extensions-custom/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/add-extensions-custom/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/add-extensions-custom/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/posts')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/append-and-prepend/routeTree.snapshot.ts",
    "content": "// prepend1\n\n// prepend2\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/'\n  id: '__root__' | '/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n\n// append1\n\n// append2\n"
  },
  {
    "path": "packages/router-generator/tests/generator/append-and-prepend/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/append-and-prepend/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: Home,\n  validateSearch: () => ({\n    indexSearch: 'indexSearch',\n  }),\n})\n\nfunction Home() {\n  return (\n    <div className=\"p-2\">\n      <h3>Welcome Home!</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as ApiBarRouteImport } from './routes/api/bar'\n\nconst FooLazyRouteImport = createFileRoute('/foo')()\n\nconst FooLazyRoute = FooLazyRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => rootRouteImport,\n} as any).lazy(() => import('./routes/foo.lazy').then((d) => d.Route))\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiBarRoute = ApiBarRouteImport.update({\n  id: '/api/bar',\n  path: '/api/bar',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/foo': typeof FooLazyRoute\n  '/api/bar': typeof ApiBarRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/foo': typeof FooLazyRoute\n  '/api/bar': typeof ApiBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/foo': typeof FooLazyRoute\n  '/api/bar': typeof ApiBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/foo' | '/api/bar'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/foo' | '/api/bar'\n  id: '__root__' | '/' | '/foo' | '/api/bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  FooLazyRoute: typeof FooLazyRoute\n  ApiBarRoute: typeof ApiBarRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/foo': {\n      id: '/foo'\n      path: '/foo'\n      fullPath: '/foo'\n      preLoaderRoute: typeof FooLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/bar': {\n      id: '/api/bar'\n      path: '/api/bar'\n      fullPath: '/api/bar'\n      preLoaderRoute: typeof ApiBarRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  FooLazyRoute: FooLazyRoute,\n  ApiBarRoute: ApiBarRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/routes/api/bar.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return 'Hello /api/bar!'\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/routes/foo.lazy.tsx",
    "content": "import React, { useState } from 'react'\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return 'Hello /foo!'\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/routes/index.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return 'Hello /!'\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/snapshots/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/snapshots/api/bar.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return 'Hello /api/bar!'\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/snapshots/foo.lazy.tsx",
    "content": "import React, { useState } from 'react'\nimport { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/foo')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return 'Hello /foo!'\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-scaffolding/snapshots/index.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return 'Hello /!'\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsR0ut3RouteImport } from './routes/posts/_r0ut3_'\nimport { Route as BlogR0ut3RouteImport } from './routes/blog/_r0ut3_'\nimport { Route as R1nd3xRouteImport } from './routes/_1nd3x'\nimport { Route as Posts1nd3xRouteImport } from './routes/posts/_1nd3x'\nimport { Route as Blog1nd3xRouteImport } from './routes/blog/_1nd3x'\nimport { Route as BlogSlugRouteImport } from './routes/blog/$slug'\nimport { Route as PostsPostId1nd3xRouteImport } from './routes/posts/$postId/_1nd3x'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts/$postId/deep'\n\nconst PostsR0ut3Route = PostsR0ut3RouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogR0ut3Route = BlogR0ut3RouteImport.update({\n  id: '/blog',\n  path: '/blog',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst R1nd3xRoute = R1nd3xRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Posts1nd3xRoute = Posts1nd3xRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsR0ut3Route,\n} as any)\nconst Blog1nd3xRoute = Blog1nd3xRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => BlogR0ut3Route,\n} as any)\nconst BlogSlugRoute = BlogSlugRouteImport.update({\n  id: '/$slug',\n  path: '/$slug',\n  getParentRoute: () => BlogR0ut3Route,\n} as any)\nconst PostsPostId1nd3xRoute = PostsPostId1nd3xRouteImport.update({\n  id: '/$postId/',\n  path: '/$postId/',\n  getParentRoute: () => PostsR0ut3Route,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/$postId/deep',\n  path: '/$postId/deep',\n  getParentRoute: () => PostsR0ut3Route,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof R1nd3xRoute\n  '/blog': typeof BlogR0ut3RouteWithChildren\n  '/posts': typeof PostsR0ut3RouteWithChildren\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog/': typeof Blog1nd3xRoute\n  '/posts/': typeof Posts1nd3xRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId/': typeof PostsPostId1nd3xRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof R1nd3xRoute\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog': typeof Blog1nd3xRoute\n  '/posts': typeof Posts1nd3xRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId': typeof PostsPostId1nd3xRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof R1nd3xRoute\n  '/blog': typeof BlogR0ut3RouteWithChildren\n  '/posts': typeof PostsR0ut3RouteWithChildren\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog/': typeof Blog1nd3xRoute\n  '/posts/': typeof Posts1nd3xRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId/': typeof PostsPostId1nd3xRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/blog'\n    | '/posts'\n    | '/blog/$slug'\n    | '/blog/'\n    | '/posts/'\n    | '/posts/$postId/deep'\n    | '/posts/$postId/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/blog/$slug'\n    | '/blog'\n    | '/posts'\n    | '/posts/$postId/deep'\n    | '/posts/$postId'\n  id:\n    | '__root__'\n    | '/'\n    | '/blog'\n    | '/posts'\n    | '/blog/$slug'\n    | '/blog/'\n    | '/posts/'\n    | '/posts/$postId/deep'\n    | '/posts/$postId/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  R1nd3xRoute: typeof R1nd3xRoute\n  BlogR0ut3Route: typeof BlogR0ut3RouteWithChildren\n  PostsR0ut3Route: typeof PostsR0ut3RouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsR0ut3RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog': {\n      id: '/blog'\n      path: '/blog'\n      fullPath: '/blog'\n      preLoaderRoute: typeof BlogR0ut3RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof R1nd3xRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof Posts1nd3xRouteImport\n      parentRoute: typeof PostsR0ut3Route\n    }\n    '/blog/': {\n      id: '/blog/'\n      path: '/'\n      fullPath: '/blog/'\n      preLoaderRoute: typeof Blog1nd3xRouteImport\n      parentRoute: typeof BlogR0ut3Route\n    }\n    '/blog/$slug': {\n      id: '/blog/$slug'\n      path: '/$slug'\n      fullPath: '/blog/$slug'\n      preLoaderRoute: typeof BlogSlugRouteImport\n      parentRoute: typeof BlogR0ut3Route\n    }\n    '/posts/$postId/': {\n      id: '/posts/$postId/'\n      path: '/$postId'\n      fullPath: '/posts/$postId/'\n      preLoaderRoute: typeof PostsPostId1nd3xRouteImport\n      parentRoute: typeof PostsR0ut3Route\n    }\n    '/posts/$postId/deep': {\n      id: '/posts/$postId/deep'\n      path: '/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof PostsR0ut3Route\n    }\n  }\n}\n\ninterface BlogR0ut3RouteChildren {\n  BlogSlugRoute: typeof BlogSlugRoute\n  Blog1nd3xRoute: typeof Blog1nd3xRoute\n}\n\nconst BlogR0ut3RouteChildren: BlogR0ut3RouteChildren = {\n  BlogSlugRoute: BlogSlugRoute,\n  Blog1nd3xRoute: Blog1nd3xRoute,\n}\n\nconst BlogR0ut3RouteWithChildren = BlogR0ut3Route._addFileChildren(\n  BlogR0ut3RouteChildren,\n)\n\ninterface PostsR0ut3RouteChildren {\n  Posts1nd3xRoute: typeof Posts1nd3xRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  PostsPostId1nd3xRoute: typeof PostsPostId1nd3xRoute\n}\n\nconst PostsR0ut3RouteChildren: PostsR0ut3RouteChildren = {\n  Posts1nd3xRoute: Posts1nd3xRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  PostsPostId1nd3xRoute: PostsPostId1nd3xRoute,\n}\n\nconst PostsR0ut3RouteWithChildren = PostsR0ut3Route._addFileChildren(\n  PostsR0ut3RouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  R1nd3xRoute: R1nd3xRoute,\n  BlogR0ut3Route: BlogR0ut3RouteWithChildren,\n  PostsR0ut3Route: PostsR0ut3RouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/_1nd3x.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/blog/$slug.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/blog/$slug')({\n  component: () => <div>Hello /blog/$slug!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/blog/_1nd3x.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/blog/')({\n  component: () => <div>Hello /blog/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/blog/_r0ut3_.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/blog')({\n  component: () => <div>Hello /blog!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/posts/$postId/_1nd3x.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/$postId/')({\n  component: () => <div>Hello /posts/$postId/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/posts/$postId/deep.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/$postId/deep')({\n  component: () => <div>Hello /posts/$postId/deep!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/posts/_1nd3x.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/')({\n  component: () => <div>Hello /posts/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/custom-tokens/routes/posts/_r0ut3_.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts')({\n  component: () => <div>Hello /posts!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/dot-escaped/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ScriptDotjsRouteImport } from './routes/script[.]js'\nimport { Route as NestedDotjsRouteImport } from './routes/nested[.]js'\nimport { Route as NestedDotjsScriptDotjsRouteImport } from './routes/nested[.]js.script[.]js'\nimport { Route as NestedDotjsDoubleDotextDotjsRouteImport } from './routes/nested[.]js.double[.]ext[.]js'\n\nconst ScriptDotjsRoute = ScriptDotjsRouteImport.update({\n  id: '/script.js',\n  path: '/script.js',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedDotjsRoute = NestedDotjsRouteImport.update({\n  id: '/nested.js',\n  path: '/nested.js',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedDotjsScriptDotjsRoute = NestedDotjsScriptDotjsRouteImport.update({\n  id: '/script.js',\n  path: '/script.js',\n  getParentRoute: () => NestedDotjsRoute,\n} as any)\nconst NestedDotjsDoubleDotextDotjsRoute =\n  NestedDotjsDoubleDotextDotjsRouteImport.update({\n    id: '/double.ext.js',\n    path: '/double.ext.js',\n    getParentRoute: () => NestedDotjsRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/nested.js': typeof NestedDotjsRouteWithChildren\n  '/script.js': typeof ScriptDotjsRoute\n  '/nested.js/double.ext.js': typeof NestedDotjsDoubleDotextDotjsRoute\n  '/nested.js/script.js': typeof NestedDotjsScriptDotjsRoute\n}\nexport interface FileRoutesByTo {\n  '/nested.js': typeof NestedDotjsRouteWithChildren\n  '/script.js': typeof ScriptDotjsRoute\n  '/nested.js/double.ext.js': typeof NestedDotjsDoubleDotextDotjsRoute\n  '/nested.js/script.js': typeof NestedDotjsScriptDotjsRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/nested.js': typeof NestedDotjsRouteWithChildren\n  '/script.js': typeof ScriptDotjsRoute\n  '/nested.js/double.ext.js': typeof NestedDotjsDoubleDotextDotjsRoute\n  '/nested.js/script.js': typeof NestedDotjsScriptDotjsRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/nested.js'\n    | '/script.js'\n    | '/nested.js/double.ext.js'\n    | '/nested.js/script.js'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/nested.js'\n    | '/script.js'\n    | '/nested.js/double.ext.js'\n    | '/nested.js/script.js'\n  id:\n    | '__root__'\n    | '/nested.js'\n    | '/script.js'\n    | '/nested.js/double.ext.js'\n    | '/nested.js/script.js'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  NestedDotjsRoute: typeof NestedDotjsRouteWithChildren\n  ScriptDotjsRoute: typeof ScriptDotjsRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/script.js': {\n      id: '/script.js'\n      path: '/script.js'\n      fullPath: '/script.js'\n      preLoaderRoute: typeof ScriptDotjsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested.js': {\n      id: '/nested.js'\n      path: '/nested.js'\n      fullPath: '/nested.js'\n      preLoaderRoute: typeof NestedDotjsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested.js/script.js': {\n      id: '/nested.js/script.js'\n      path: '/script.js'\n      fullPath: '/nested.js/script.js'\n      preLoaderRoute: typeof NestedDotjsScriptDotjsRouteImport\n      parentRoute: typeof NestedDotjsRoute\n    }\n    '/nested.js/double.ext.js': {\n      id: '/nested.js/double.ext.js'\n      path: '/double.ext.js'\n      fullPath: '/nested.js/double.ext.js'\n      preLoaderRoute: typeof NestedDotjsDoubleDotextDotjsRouteImport\n      parentRoute: typeof NestedDotjsRoute\n    }\n  }\n}\n\ninterface NestedDotjsRouteChildren {\n  NestedDotjsDoubleDotextDotjsRoute: typeof NestedDotjsDoubleDotextDotjsRoute\n  NestedDotjsScriptDotjsRoute: typeof NestedDotjsScriptDotjsRoute\n}\n\nconst NestedDotjsRouteChildren: NestedDotjsRouteChildren = {\n  NestedDotjsDoubleDotextDotjsRoute: NestedDotjsDoubleDotextDotjsRoute,\n  NestedDotjsScriptDotjsRoute: NestedDotjsScriptDotjsRoute,\n}\n\nconst NestedDotjsRouteWithChildren = NestedDotjsRoute._addFileChildren(\n  NestedDotjsRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  NestedDotjsRoute: NestedDotjsRouteWithChildren,\n  ScriptDotjsRoute: ScriptDotjsRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/dot-escaped/routes/__root.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/generator/dot-escaped/routes/nested[.]js.double[.]ext[.]js.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested.js/double.ext.js')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/dot-escaped/routes/nested[.]js.script[.]js.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested.js/script.js')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/dot-escaped/routes/nested[.]js.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested.js')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/dot-escaped/routes/script[.]js.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/script.js')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/duplicate-fullPath/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/duplicate-fullPath/routes/_auth/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_auth/')({\n  component: () => <div>Hello /_auth/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/duplicate-fullPath/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-custom-tokens/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as Char91_1nd3xChar93RouteImport } from './routes/[_1nd3x]'\nimport { Route as BlogR0ut3RouteImport } from './routes/blog._r0ut3_'\nimport { Route as R1nd3xRouteImport } from './routes/_1nd3x'\nimport { Route as NestedChar91_1nd3xChar93RouteImport } from './routes/nested.[_1nd3x]'\nimport { Route as PostsChar91_r0ut3_Char93RouteImport } from './routes/posts.[_r0ut3_]'\n\nconst Char91_1nd3xChar93Route = Char91_1nd3xChar93RouteImport.update({\n  id: '/_1nd3x',\n  path: '/_1nd3x',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogR0ut3Route = BlogR0ut3RouteImport.update({\n  id: '/blog',\n  path: '/blog',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst R1nd3xRoute = R1nd3xRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedChar91_1nd3xChar93Route =\n  NestedChar91_1nd3xChar93RouteImport.update({\n    id: '/nested/_1nd3x',\n    path: '/nested/_1nd3x',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst PostsChar91_r0ut3_Char93Route =\n  PostsChar91_r0ut3_Char93RouteImport.update({\n    id: '/posts/_r0ut3_',\n    path: '/posts/_r0ut3_',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof R1nd3xRoute\n  '/blog': typeof BlogR0ut3Route\n  '/_1nd3x': typeof Char91_1nd3xChar93Route\n  '/nested/_1nd3x': typeof NestedChar91_1nd3xChar93Route\n  '/posts/_r0ut3_': typeof PostsChar91_r0ut3_Char93Route\n}\nexport interface FileRoutesByTo {\n  '/': typeof R1nd3xRoute\n  '/blog': typeof BlogR0ut3Route\n  '/_1nd3x': typeof Char91_1nd3xChar93Route\n  '/nested/_1nd3x': typeof NestedChar91_1nd3xChar93Route\n  '/posts/_r0ut3_': typeof PostsChar91_r0ut3_Char93Route\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof R1nd3xRoute\n  '/blog': typeof BlogR0ut3Route\n  '/_1nd3x': typeof Char91_1nd3xChar93Route\n  '/nested/_1nd3x': typeof NestedChar91_1nd3xChar93Route\n  '/posts/_r0ut3_': typeof PostsChar91_r0ut3_Char93Route\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/blog' | '/_1nd3x' | '/nested/_1nd3x' | '/posts/_r0ut3_'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/blog' | '/_1nd3x' | '/nested/_1nd3x' | '/posts/_r0ut3_'\n  id:\n    | '__root__'\n    | '/'\n    | '/blog'\n    | '/_1nd3x'\n    | '/nested/_1nd3x'\n    | '/posts/_r0ut3_'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  R1nd3xRoute: typeof R1nd3xRoute\n  BlogR0ut3Route: typeof BlogR0ut3Route\n  Char91_1nd3xChar93Route: typeof Char91_1nd3xChar93Route\n  NestedChar91_1nd3xChar93Route: typeof NestedChar91_1nd3xChar93Route\n  PostsChar91_r0ut3_Char93Route: typeof PostsChar91_r0ut3_Char93Route\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_1nd3x': {\n      id: '/_1nd3x'\n      path: '/_1nd3x'\n      fullPath: '/_1nd3x'\n      preLoaderRoute: typeof Char91_1nd3xChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog': {\n      id: '/blog'\n      path: '/blog'\n      fullPath: '/blog'\n      preLoaderRoute: typeof BlogR0ut3RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof R1nd3xRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/_1nd3x': {\n      id: '/nested/_1nd3x'\n      path: '/nested/_1nd3x'\n      fullPath: '/nested/_1nd3x'\n      preLoaderRoute: typeof NestedChar91_1nd3xChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/_r0ut3_': {\n      id: '/posts/_r0ut3_'\n      path: '/posts/_r0ut3_'\n      fullPath: '/posts/_r0ut3_'\n      preLoaderRoute: typeof PostsChar91_r0ut3_Char93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  R1nd3xRoute: R1nd3xRoute,\n  BlogR0ut3Route: BlogR0ut3Route,\n  Char91_1nd3xChar93Route: Char91_1nd3xChar93Route,\n  NestedChar91_1nd3xChar93Route: NestedChar91_1nd3xChar93Route,\n  PostsChar91_r0ut3_Char93Route: PostsChar91_r0ut3_Char93Route,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-custom-tokens/routes/[_1nd3x].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// Escaped custom indexToken - should be literal /_1nd3x path, NOT treated as index route\nexport const Route = createFileRoute('/_1nd3x')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-custom-tokens/routes/_1nd3x.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// Normal index route using custom indexToken\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-custom-tokens/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-custom-tokens/routes/blog._r0ut3_.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// Normal layout config using custom routeToken\nexport const Route = createFileRoute('/blog')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-custom-tokens/routes/nested.[_1nd3x].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// Escaped custom indexToken in nested path - should be literal /nested/_1nd3x, NOT index of /nested\nexport const Route = createFileRoute('/nested/_1nd3x')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-custom-tokens/routes/posts.[_r0ut3_].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// Escaped custom routeToken - should be literal /posts/_r0ut3_ path, NOT treated as layout config\nexport const Route = createFileRoute('/posts/_r0ut3_')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as Char91indexChar93RouteImport } from './routes/[index]'\nimport { Route as Char91routeChar93RouteImport } from './routes/[route]'\nimport { Route as Char91lazyChar93RouteImport } from './routes/[lazy]'\nimport { Route as Foo_barRouteImport } from './routes/foo[_]bar'\nimport { Route as BlogRouteImport } from './routes/blog[_]'\nimport { Route as Api_v2_usersRouteImport } from './routes/api[_]v2[_]users'\nimport { Route as Prefix_middle_suffixRouteImport } from './routes/[_]prefix[_]middle[_]suffix'\nimport { Route as LayoutRouteImport } from './routes/[_]layout'\nimport { Route as AuthRouteRouteImport } from './routes/[_]auth.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as NestedChar91indexChar93RouteImport } from './routes/nested.[index]'\n\nconst Char91indexChar93Route = Char91indexChar93RouteImport.update({\n  id: '/index',\n  path: '/index',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Char91routeChar93Route = Char91routeChar93RouteImport.update({\n  id: '/route',\n  path: '/route',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Char91lazyChar93Route = Char91lazyChar93RouteImport.update({\n  id: '/lazy',\n  path: '/lazy',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Foo_barRoute = Foo_barRouteImport.update({\n  id: '/foo_bar',\n  path: '/foo_bar',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogRoute = BlogRouteImport.update({\n  id: '/blog_',\n  path: '/blog_',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Api_v2_usersRoute = Api_v2_usersRouteImport.update({\n  id: '/api_v2_users',\n  path: '/api_v2_users',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst Prefix_middle_suffixRoute = Prefix_middle_suffixRouteImport.update({\n  id: '/_prefix_middle_suffix',\n  path: '/_prefix_middle_suffix',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutRoute = LayoutRouteImport.update({\n  id: '/_layout',\n  path: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AuthRouteRoute = AuthRouteRouteImport.update({\n  id: '/_auth',\n  path: '/_auth',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedChar91indexChar93Route = NestedChar91indexChar93RouteImport.update({\n  id: '/nested/index',\n  path: '/nested/index',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/_auth': typeof AuthRouteRoute\n  '/_layout': typeof LayoutRoute\n  '/_prefix_middle_suffix': typeof Prefix_middle_suffixRoute\n  '/api_v2_users': typeof Api_v2_usersRoute\n  '/blog_': typeof BlogRoute\n  '/foo_bar': typeof Foo_barRoute\n  '/index': typeof Char91indexChar93Route\n  '/lazy': typeof Char91lazyChar93Route\n  '/route': typeof Char91routeChar93Route\n  '/nested/index': typeof NestedChar91indexChar93Route\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/_auth': typeof AuthRouteRoute\n  '/_layout': typeof LayoutRoute\n  '/_prefix_middle_suffix': typeof Prefix_middle_suffixRoute\n  '/api_v2_users': typeof Api_v2_usersRoute\n  '/blog_': typeof BlogRoute\n  '/foo_bar': typeof Foo_barRoute\n  '/index': typeof Char91indexChar93Route\n  '/lazy': typeof Char91lazyChar93Route\n  '/route': typeof Char91routeChar93Route\n  '/nested/index': typeof NestedChar91indexChar93Route\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/_auth': typeof AuthRouteRoute\n  '/_layout': typeof LayoutRoute\n  '/_prefix_middle_suffix': typeof Prefix_middle_suffixRoute\n  '/api_v2_users': typeof Api_v2_usersRoute\n  '/blog_': typeof BlogRoute\n  '/foo_bar': typeof Foo_barRoute\n  '/index': typeof Char91indexChar93Route\n  '/lazy': typeof Char91lazyChar93Route\n  '/route': typeof Char91routeChar93Route\n  '/nested/index': typeof NestedChar91indexChar93Route\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/_auth'\n    | '/_layout'\n    | '/_prefix_middle_suffix'\n    | '/api_v2_users'\n    | '/blog_'\n    | '/foo_bar'\n    | '/index'\n    | '/lazy'\n    | '/route'\n    | '/nested/index'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/_auth'\n    | '/_layout'\n    | '/_prefix_middle_suffix'\n    | '/api_v2_users'\n    | '/blog_'\n    | '/foo_bar'\n    | '/index'\n    | '/lazy'\n    | '/route'\n    | '/nested/index'\n  id:\n    | '__root__'\n    | '/'\n    | '/_auth'\n    | '/_layout'\n    | '/_prefix_middle_suffix'\n    | '/api_v2_users'\n    | '/blog_'\n    | '/foo_bar'\n    | '/index'\n    | '/lazy'\n    | '/route'\n    | '/nested/index'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  AuthRouteRoute: typeof AuthRouteRoute\n  LayoutRoute: typeof LayoutRoute\n  Prefix_middle_suffixRoute: typeof Prefix_middle_suffixRoute\n  Api_v2_usersRoute: typeof Api_v2_usersRoute\n  BlogRoute: typeof BlogRoute\n  Foo_barRoute: typeof Foo_barRoute\n  Char91indexChar93Route: typeof Char91indexChar93Route\n  Char91lazyChar93Route: typeof Char91lazyChar93Route\n  Char91routeChar93Route: typeof Char91routeChar93Route\n  NestedChar91indexChar93Route: typeof NestedChar91indexChar93Route\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/index': {\n      id: '/index'\n      path: '/index'\n      fullPath: '/index'\n      preLoaderRoute: typeof Char91indexChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/route': {\n      id: '/route'\n      path: '/route'\n      fullPath: '/route'\n      preLoaderRoute: typeof Char91routeChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/lazy': {\n      id: '/lazy'\n      path: '/lazy'\n      fullPath: '/lazy'\n      preLoaderRoute: typeof Char91lazyChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/foo_bar': {\n      id: '/foo_bar'\n      path: '/foo_bar'\n      fullPath: '/foo_bar'\n      preLoaderRoute: typeof Foo_barRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog_': {\n      id: '/blog_'\n      path: '/blog_'\n      fullPath: '/blog_'\n      preLoaderRoute: typeof BlogRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api_v2_users': {\n      id: '/api_v2_users'\n      path: '/api_v2_users'\n      fullPath: '/api_v2_users'\n      preLoaderRoute: typeof Api_v2_usersRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_prefix_middle_suffix': {\n      id: '/_prefix_middle_suffix'\n      path: '/_prefix_middle_suffix'\n      fullPath: '/_prefix_middle_suffix'\n      preLoaderRoute: typeof Prefix_middle_suffixRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout': {\n      id: '/_layout'\n      path: '/_layout'\n      fullPath: '/_layout'\n      preLoaderRoute: typeof LayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_auth': {\n      id: '/_auth'\n      path: '/_auth'\n      fullPath: '/_auth'\n      preLoaderRoute: typeof AuthRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/index': {\n      id: '/nested/index'\n      path: '/nested/index'\n      fullPath: '/nested/index'\n      preLoaderRoute: typeof NestedChar91indexChar93RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  AuthRouteRoute: AuthRouteRoute,\n  LayoutRoute: LayoutRoute,\n  Prefix_middle_suffixRoute: Prefix_middle_suffixRoute,\n  Api_v2_usersRoute: Api_v2_usersRoute,\n  BlogRoute: BlogRoute,\n  Foo_barRoute: Foo_barRoute,\n  Char91indexChar93Route: Char91indexChar93Route,\n  Char91lazyChar93Route: Char91lazyChar93Route,\n  Char91routeChar93Route: Char91routeChar93Route,\n  NestedChar91indexChar93Route: NestedChar91indexChar93Route,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/[_]auth.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a layout config for /_auth path (underscore is escaped, but .route suffix is honored)\nexport const Route = createFileRoute('/_auth')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/[_]layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a literal /_layout path, NOT treated as a pathless layout\nexport const Route = createFileRoute('/_layout')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/[_]prefix[_]middle[_]suffix.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a literal /_prefix_middle_suffix path with underscores everywhere\nexport const Route = createFileRoute('/_prefix_middle_suffix')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/[index].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a literal /index path, NOT treated as the index route\nexport const Route = createFileRoute('/index')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/[lazy].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a literal /lazy path, NOT treated as a lazy-loaded route\nexport const Route = createFileRoute('/lazy')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/[route].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a literal /route path, NOT treated as a layout config file\nexport const Route = createFileRoute('/route')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/api[_]v2[_]users.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a literal /api_v2_users path with multiple underscores in middle\nexport const Route = createFileRoute('/api_v2_users')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/blog[_].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a literal /blog_ path, NOT escaping from parent layout\nexport const Route = createFileRoute('/blog_')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/foo[_]bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be a literal /foo_bar path with underscore in middle\nexport const Route = createFileRoute('/foo_bar')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/escaped-special-strings/routes/nested.[index].tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// This should be /nested/index (literal), NOT treated as the index of /nested\nexport const Route = createFileRoute('/nested/index')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/export-variations/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ExportWithAsRouteImport } from './routes/export-with-as'\nimport { Route as ExportSeparateFromDeclarationRouteImport } from './routes/export-separate-from-declaration'\n\nconst ExportWithAsRoute = ExportWithAsRouteImport.update({\n  id: '/export-with-as',\n  path: '/export-with-as',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ExportSeparateFromDeclarationRoute =\n  ExportSeparateFromDeclarationRouteImport.update({\n    id: '/export-separate-from-declaration',\n    path: '/export-separate-from-declaration',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/export-separate-from-declaration': typeof ExportSeparateFromDeclarationRoute\n  '/export-with-as': typeof ExportWithAsRoute\n}\nexport interface FileRoutesByTo {\n  '/export-separate-from-declaration': typeof ExportSeparateFromDeclarationRoute\n  '/export-with-as': typeof ExportWithAsRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/export-separate-from-declaration': typeof ExportSeparateFromDeclarationRoute\n  '/export-with-as': typeof ExportWithAsRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/export-separate-from-declaration' | '/export-with-as'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/export-separate-from-declaration' | '/export-with-as'\n  id: '__root__' | '/export-separate-from-declaration' | '/export-with-as'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  ExportSeparateFromDeclarationRoute: typeof ExportSeparateFromDeclarationRoute\n  ExportWithAsRoute: typeof ExportWithAsRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/export-with-as': {\n      id: '/export-with-as'\n      path: '/export-with-as'\n      fullPath: '/export-with-as'\n      preLoaderRoute: typeof ExportWithAsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/export-separate-from-declaration': {\n      id: '/export-separate-from-declaration'\n      path: '/export-separate-from-declaration'\n      fullPath: '/export-separate-from-declaration'\n      preLoaderRoute: typeof ExportSeparateFromDeclarationRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  ExportSeparateFromDeclarationRoute: ExportSeparateFromDeclarationRoute,\n  ExportWithAsRoute: ExportWithAsRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/export-variations/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/export-variations/routes/export-separate-from-declaration.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nconst Route = createFileRoute('/export-separate-from-declaration')({})\n\nexport { Route }\n"
  },
  {
    "path": "packages/router-generator/tests/generator/export-variations/routes/export-with-as.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nconst MyRoute = createFileRoute('/export-with-as')({})\n\nexport { MyRoute as Route }\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/react-router'\nimport type {\n  CreateFileRoute,\n  CreateLazyFileRoute,\n  FileRoutesByPath,\n} from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as testInitiallyLazyRouteImport } from './routes/(test)/initiallyLazy'\nimport { Route as testInitiallyEmptyRouteImport } from './routes/(test)/initiallyEmpty'\nimport { Route as testFooRouteImport } from './routes/(test)/foo'\nimport { Route as testFooBarRouteImport } from './routes/(test)/foo.bar'\n\nconst testBarLazyRouteImport = createFileRoute('/(test)/bar')()\n\nconst testBarLazyRoute = testBarLazyRouteImport\n  .update({\n    id: '/(test)/bar',\n    path: '/bar',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(test)/bar.lazy').then((d) => d.Route))\nconst testInitiallyLazyRoute = testInitiallyLazyRouteImport.update({\n  id: '/(test)/initiallyLazy',\n  path: '/initiallyLazy',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testInitiallyEmptyRoute = testInitiallyEmptyRouteImport\n  .update({\n    id: '/(test)/initiallyEmpty',\n    path: '/initiallyEmpty',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() =>\n    import('./routes/(test)/initiallyEmpty.lazy').then((d) => d.Route),\n  )\nconst testFooRoute = testFooRouteImport.update({\n  id: '/(test)/foo',\n  path: '/foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testFooBarRoute = testFooBarRouteImport.update({\n  id: '/bar',\n  path: '/bar',\n  getParentRoute: () => testFooRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/foo': typeof testFooRouteWithChildren\n  '/initiallyEmpty': typeof testInitiallyEmptyRoute\n  '/initiallyLazy': typeof testInitiallyLazyRoute\n  '/bar': typeof testBarLazyRoute\n  '/foo/bar': typeof testFooBarRoute\n}\nexport interface FileRoutesByTo {\n  '/foo': typeof testFooRouteWithChildren\n  '/initiallyEmpty': typeof testInitiallyEmptyRoute\n  '/initiallyLazy': typeof testInitiallyLazyRoute\n  '/bar': typeof testBarLazyRoute\n  '/foo/bar': typeof testFooBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/(test)/foo': typeof testFooRouteWithChildren\n  '/(test)/initiallyEmpty': typeof testInitiallyEmptyRoute\n  '/(test)/initiallyLazy': typeof testInitiallyLazyRoute\n  '/(test)/bar': typeof testBarLazyRoute\n  '/(test)/foo/bar': typeof testFooBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar' | '/foo/bar'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar' | '/foo/bar'\n  id:\n    | '__root__'\n    | '/(test)/foo'\n    | '/(test)/initiallyEmpty'\n    | '/(test)/initiallyLazy'\n    | '/(test)/bar'\n    | '/(test)/foo/bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  testFooRoute: typeof testFooRouteWithChildren\n  testInitiallyEmptyRoute: typeof testInitiallyEmptyRoute\n  testInitiallyLazyRoute: typeof testInitiallyLazyRoute\n  testBarLazyRoute: typeof testBarLazyRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/(test)/bar': {\n      id: '/(test)/bar'\n      path: '/bar'\n      fullPath: '/bar'\n      preLoaderRoute: typeof testBarLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(test)/initiallyLazy': {\n      id: '/(test)/initiallyLazy'\n      path: '/initiallyLazy'\n      fullPath: '/initiallyLazy'\n      preLoaderRoute: typeof testInitiallyLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(test)/initiallyEmpty': {\n      id: '/(test)/initiallyEmpty'\n      path: '/initiallyEmpty'\n      fullPath: '/initiallyEmpty'\n      preLoaderRoute: typeof testInitiallyEmptyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(test)/foo': {\n      id: '/(test)/foo'\n      path: '/foo'\n      fullPath: '/foo'\n      preLoaderRoute: typeof testFooRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(test)/foo/bar': {\n      id: '/(test)/foo/bar'\n      path: '/bar'\n      fullPath: '/foo/bar'\n      preLoaderRoute: typeof testFooBarRouteImport\n      parentRoute: typeof testFooRoute\n    }\n  }\n}\n\ndeclare module './routes/(test)/foo' {\n  const createFileRoute: CreateFileRoute<\n    '/(test)/foo',\n    FileRoutesByPath['/(test)/foo']['parentRoute'],\n    FileRoutesByPath['/(test)/foo']['id'],\n    FileRoutesByPath['/(test)/foo']['path'],\n    FileRoutesByPath['/(test)/foo']['fullPath']\n  >\n}\ndeclare module './routes/(test)/initiallyEmpty' {\n  const createFileRoute: CreateFileRoute<\n    '/(test)/initiallyEmpty',\n    FileRoutesByPath['/(test)/initiallyEmpty']['parentRoute'],\n    FileRoutesByPath['/(test)/initiallyEmpty']['id'],\n    FileRoutesByPath['/(test)/initiallyEmpty']['path'],\n    FileRoutesByPath['/(test)/initiallyEmpty']['fullPath']\n  >\n}\ndeclare module './routes/(test)/initiallyLazy' {\n  const createFileRoute: CreateFileRoute<\n    '/(test)/initiallyLazy',\n    FileRoutesByPath['/(test)/initiallyLazy']['parentRoute'],\n    FileRoutesByPath['/(test)/initiallyLazy']['id'],\n    FileRoutesByPath['/(test)/initiallyLazy']['path'],\n    FileRoutesByPath['/(test)/initiallyLazy']['fullPath']\n  >\n}\ndeclare module './routes/(test)/bar.lazy' {\n  const createLazyFileRoute: CreateLazyFileRoute<\n    FileRoutesByPath['/(test)/bar']['preLoaderRoute']\n  >\n}\ndeclare module './routes/(test)/initiallyEmpty.lazy' {\n  const createLazyFileRoute: CreateLazyFileRoute<\n    FileRoutesByPath['/(test)/initiallyEmpty']['preLoaderRoute']\n  >\n}\ndeclare module './routes/(test)/foo.bar' {\n  const createFileRoute: CreateFileRoute<\n    '/(test)/foo/bar',\n    FileRoutesByPath['/(test)/foo/bar']['parentRoute'],\n    FileRoutesByPath['/(test)/foo/bar']['id'],\n    FileRoutesByPath['/(test)/foo/bar']['path'],\n    FileRoutesByPath['/(test)/foo/bar']['fullPath']\n  >\n}\n\ninterface testFooRouteChildren {\n  testFooBarRoute: typeof testFooBarRoute\n}\n\nconst testFooRouteChildren: testFooRouteChildren = {\n  testFooBarRoute: testFooBarRoute,\n}\n\nconst testFooRouteWithChildren =\n  testFooRoute._addFileChildren(testFooRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  testFooRoute: testFooRouteWithChildren,\n  testInitiallyEmptyRoute: testInitiallyEmptyRoute,\n  testInitiallyLazyRoute: testInitiallyLazyRoute,\n  testBarLazyRoute: testBarLazyRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routes/(test)/-keep-directory",
    "content": ""
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routes/.gitignore",
    "content": "(test)/*.tsx"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/snapshots/bar.lazy.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport {\n  ErrorComponent,\n  ErrorComponentProps,\n  Link,\n} from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/snapshots/foo.bar.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport {\n  ErrorComponent,\n  ErrorComponentProps,\n  Link,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/snapshots/foo.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport {\n  ErrorComponent,\n  ErrorComponentProps,\n  Link,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/snapshots/initiallyEmpty.lazy.tsx",
    "content": "export const Route = createLazyFileRoute({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(test)/initiallyEmpty\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/snapshots/initiallyEmpty.tsx",
    "content": "export const Route = createFileRoute({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(test)/initiallyEmpty\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/snapshots/initiallyLazy.tsx",
    "content": "// @ts-nocheck\n\nimport { Link } from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  component: () => {\n    const post = Route.useLoaderData()\n\n    return (\n      <div className=\"space-y-2\">\n        <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n        <div className=\"text-sm\">{post.body}</div>\n        <Link\n          to=\"/posts/$postId/deep\"\n          params={{\n            postId: post.id,\n          }}\n          activeProps={{ className: 'text-black font-bold' }}\n          className=\"block py-1 text-blue-800 hover:text-blue-600\"\n        >\n          Deep View\n        </Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/template-verbose.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport {\n  ErrorComponent,\n  ErrorComponentProps,\n  Link,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/foo/bar')({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/template.lazy.tsx",
    "content": "// @ts-nocheck\n\nimport { createLazyFileRoute, Link } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute({\n  component: () => {\n    const post = Route.useLoaderData()\n\n    return (\n      <div className=\"space-y-2\">\n        <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n        <div className=\"text-sm\">{post.body}</div>\n        <Link\n          to=\"/posts/$postId/deep\"\n          params={{\n            postId: post.id,\n          }}\n          activeProps={{ className: 'text-black font-bold' }}\n          className=\"block py-1 text-blue-800 hover:text-blue-600\"\n        >\n          Deep View\n        </Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/template.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport {\n  ErrorComponent,\n  ErrorComponentProps,\n  Link,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as testInitiallyLazyRouteImport } from './routes/(test)/initiallyLazy'\nimport { Route as testInitiallyEmptyRouteImport } from './routes/(test)/initiallyEmpty'\nimport { Route as testFooRouteImport } from './routes/(test)/foo'\nimport { Route as testFooBarRouteImport } from './routes/(test)/foo.bar'\n\nconst testBarLazyRouteImport = createFileRoute('/(test)/bar')()\n\nconst testBarLazyRoute = testBarLazyRouteImport\n  .update({\n    id: '/(test)/bar',\n    path: '/bar',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() => import('./routes/(test)/bar.lazy').then((d) => d.Route))\nconst testInitiallyLazyRoute = testInitiallyLazyRouteImport.update({\n  id: '/(test)/initiallyLazy',\n  path: '/initiallyLazy',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testInitiallyEmptyRoute = testInitiallyEmptyRouteImport\n  .update({\n    id: '/(test)/initiallyEmpty',\n    path: '/initiallyEmpty',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() =>\n    import('./routes/(test)/initiallyEmpty.lazy').then((d) => d.Route),\n  )\nconst testFooRoute = testFooRouteImport.update({\n  id: '/(test)/foo',\n  path: '/foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst testFooBarRoute = testFooBarRouteImport.update({\n  id: '/bar',\n  path: '/bar',\n  getParentRoute: () => testFooRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/foo': typeof testFooRouteWithChildren\n  '/initiallyEmpty': typeof testInitiallyEmptyRoute\n  '/initiallyLazy': typeof testInitiallyLazyRoute\n  '/bar': typeof testBarLazyRoute\n  '/foo/bar': typeof testFooBarRoute\n}\nexport interface FileRoutesByTo {\n  '/foo': typeof testFooRouteWithChildren\n  '/initiallyEmpty': typeof testInitiallyEmptyRoute\n  '/initiallyLazy': typeof testInitiallyLazyRoute\n  '/bar': typeof testBarLazyRoute\n  '/foo/bar': typeof testFooBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/(test)/foo': typeof testFooRouteWithChildren\n  '/(test)/initiallyEmpty': typeof testInitiallyEmptyRoute\n  '/(test)/initiallyLazy': typeof testInitiallyLazyRoute\n  '/(test)/bar': typeof testBarLazyRoute\n  '/(test)/foo/bar': typeof testFooBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar' | '/foo/bar'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar' | '/foo/bar'\n  id:\n    | '__root__'\n    | '/(test)/foo'\n    | '/(test)/initiallyEmpty'\n    | '/(test)/initiallyLazy'\n    | '/(test)/bar'\n    | '/(test)/foo/bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  testFooRoute: typeof testFooRouteWithChildren\n  testInitiallyEmptyRoute: typeof testInitiallyEmptyRoute\n  testInitiallyLazyRoute: typeof testInitiallyLazyRoute\n  testBarLazyRoute: typeof testBarLazyRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/(test)/bar': {\n      id: '/(test)/bar'\n      path: '/bar'\n      fullPath: '/bar'\n      preLoaderRoute: typeof testBarLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(test)/initiallyLazy': {\n      id: '/(test)/initiallyLazy'\n      path: '/initiallyLazy'\n      fullPath: '/initiallyLazy'\n      preLoaderRoute: typeof testInitiallyLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(test)/initiallyEmpty': {\n      id: '/(test)/initiallyEmpty'\n      path: '/initiallyEmpty'\n      fullPath: '/initiallyEmpty'\n      preLoaderRoute: typeof testInitiallyEmptyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(test)/foo': {\n      id: '/(test)/foo'\n      path: '/foo'\n      fullPath: '/foo'\n      preLoaderRoute: typeof testFooRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(test)/foo/bar': {\n      id: '/(test)/foo/bar'\n      path: '/bar'\n      fullPath: '/foo/bar'\n      preLoaderRoute: typeof testFooBarRouteImport\n      parentRoute: typeof testFooRoute\n    }\n  }\n}\n\ninterface testFooRouteChildren {\n  testFooBarRoute: typeof testFooBarRoute\n}\n\nconst testFooRouteChildren: testFooRouteChildren = {\n  testFooBarRoute: testFooBarRoute,\n}\n\nconst testFooRouteWithChildren =\n  testFooRoute._addFileChildren(testFooRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  testFooRoute: testFooRouteWithChildren,\n  testInitiallyEmptyRoute: testInitiallyEmptyRoute,\n  testInitiallyLazyRoute: testInitiallyLazyRoute,\n  testBarLazyRoute: testBarLazyRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routes/(test)/-keep-directory",
    "content": ""
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routes/.gitignore",
    "content": "(test)/*.tsx"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/snapshots/bar.lazy.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport { ErrorComponent, ErrorComponentProps, Link, createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/(test)/bar')({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/snapshots/foo.bar.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport { ErrorComponent, ErrorComponentProps, Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(test)/foo/bar')({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/snapshots/foo.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport { ErrorComponent, ErrorComponentProps, Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(test)/foo')({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/snapshots/initiallyEmpty.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/(test)/initiallyEmpty')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(test)/initiallyEmpty\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/snapshots/initiallyEmpty.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(test)/initiallyEmpty')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(test)/initiallyEmpty\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/snapshots/initiallyLazy.tsx",
    "content": "// @ts-nocheck\n\nimport { Link, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(test)/initiallyLazy')({\n  component: () => {\n    const post = Route.useLoaderData()\n\n    return (\n      <div className=\"space-y-2\">\n        <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n        <div className=\"text-sm\">{post.body}</div>\n        <Link\n          to=\"/posts/$postId/deep\"\n          params={{\n            postId: post.id,\n          }}\n          activeProps={{ className: 'text-black font-bold' }}\n          className=\"block py-1 text-blue-800 hover:text-blue-600\"\n        >\n          Deep View\n        </Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/template-verbose.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport {\n  ErrorComponent,\n  ErrorComponentProps,\n  Link,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/foo/bar')({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/template.lazy.tsx",
    "content": "// @ts-nocheck\n\nimport { createLazyFileRoute, Link } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute({\n  component: () => {\n    const post = Route.useLoaderData()\n\n    return (\n      <div className=\"space-y-2\">\n        <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n        <div className=\"text-sm\">{post.body}</div>\n        <Link\n          to=\"/posts/$postId/deep\"\n          params={{\n            postId: post.id,\n          }}\n          activeProps={{ className: 'text-black font-bold' }}\n          className=\"block py-1 text-blue-800 hover:text-blue-600\"\n        >\n          Deep View\n        </Link>\n      </div>\n    )\n  },\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/template.tsx",
    "content": "// @ts-nocheck\n\nimport * as React from 'react'\nimport {\n  ErrorComponent,\n  ErrorComponentProps,\n  Link,\n} from '@tanstack/react-router'\n\nexport const Route = createFileRoute({\n  loader: async ({ params: { postId } }) => ({\n    postId,\n    title: 'title',\n    body: 'body',\n    id: 'id',\n  }),\n  errorComponent: PostErrorComponent as any,\n  notFoundComponent: () => {\n    return <p>Post not found</p>\n  },\n  component: PostComponent,\n})\n\nexport function PostErrorComponent({ error }: ErrorComponentProps) {\n  return <ErrorComponent error={error} />\n}\n\nfunction PostComponent() {\n  const post = Route.useLoaderData()\n\n  return (\n    <div className=\"space-y-2\">\n      <h4 className=\"text-xl font-bold underline\">{post.title}</h4>\n      <div className=\"text-sm\">{post.body}</div>\n      <Link\n        to=\"/posts/$postId/deep\"\n        params={{\n          postId: post.id,\n        }}\n        activeProps={{ className: 'text-black font-bold' }}\n        className=\"inline-block py-1 text-blue-800 hover:text-blue-600\"\n      >\n        Deep View\n      </Link>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as BlogRouteRouteImport } from './routes/blog.route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as BlogIndexRouteImport } from './routes/blog.index'\nimport { Route as BlogStatsRouteImport } from './routes/blog_.stats'\nimport { Route as BlogBlogIdRouteRouteImport } from './routes/blog_.$blogId.route'\nimport { Route as PostsPostIdIndexRouteImport } from './routes/posts.$postId.index'\nimport { Route as BlogSlugIndexRouteImport } from './routes/blog.$slug.index'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts.$postId.deep'\nimport { Route as BlogBlogIdEditRouteImport } from './routes/blog_.$blogId_.edit'\nimport { Route as BlogBlogIdSlugRouteRouteImport } from './routes/blog_.$blogId.$slug.route'\nimport { Route as BlogBlogIdSlugBarRouteImport } from './routes/blog_.$blogId.$slug_.bar'\n\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogRouteRoute = BlogRouteRouteImport.update({\n  id: '/blog',\n  path: '/blog',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst BlogIndexRoute = BlogIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => BlogRouteRoute,\n} as any)\nconst BlogStatsRoute = BlogStatsRouteImport.update({\n  id: '/blog_/stats',\n  path: '/blog/stats',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogBlogIdRouteRoute = BlogBlogIdRouteRouteImport.update({\n  id: '/blog_/$blogId',\n  path: '/blog/$blogId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdIndexRoute = PostsPostIdIndexRouteImport.update({\n  id: '/$postId/',\n  path: '/$postId/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst BlogSlugIndexRoute = BlogSlugIndexRouteImport.update({\n  id: '/$slug/',\n  path: '/$slug/',\n  getParentRoute: () => BlogRouteRoute,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/$postId/deep',\n  path: '/$postId/deep',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst BlogBlogIdEditRoute = BlogBlogIdEditRouteImport.update({\n  id: '/blog_/$blogId_/edit',\n  path: '/blog/$blogId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogBlogIdSlugRouteRoute = BlogBlogIdSlugRouteRouteImport.update({\n  id: '/$slug',\n  path: '/$slug',\n  getParentRoute: () => BlogBlogIdRouteRoute,\n} as any)\nconst BlogBlogIdSlugBarRoute = BlogBlogIdSlugBarRouteImport.update({\n  id: '/$slug_/bar',\n  path: '/$slug/bar',\n  getParentRoute: () => BlogBlogIdRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRouteWithChildren\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/blog/stats': typeof BlogStatsRoute\n  '/blog/': typeof BlogIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog/$blogId/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/blog/$slug/': typeof BlogSlugIndexRoute\n  '/posts/$postId/': typeof PostsPostIdIndexRoute\n  '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/blog/stats': typeof BlogStatsRoute\n  '/blog': typeof BlogIndexRoute\n  '/posts': typeof PostsIndexRoute\n  '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog/$blogId/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/blog/$slug': typeof BlogSlugIndexRoute\n  '/posts/$postId': typeof PostsPostIdIndexRoute\n  '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRouteWithChildren\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/blog_/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/blog_/stats': typeof BlogStatsRoute\n  '/blog/': typeof BlogIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/blog_/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog_/$blogId_/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/blog/$slug/': typeof BlogSlugIndexRoute\n  '/posts/$postId/': typeof PostsPostIdIndexRoute\n  '/blog_/$blogId/$slug_/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/blog'\n    | '/posts'\n    | '/blog/$blogId'\n    | '/blog/stats'\n    | '/blog/'\n    | '/posts/'\n    | '/blog/$blogId/$slug'\n    | '/blog/$blogId/edit'\n    | '/posts/$postId/deep'\n    | '/blog/$slug/'\n    | '/posts/$postId/'\n    | '/blog/$blogId/$slug/bar'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/blog/$blogId'\n    | '/blog/stats'\n    | '/blog'\n    | '/posts'\n    | '/blog/$blogId/$slug'\n    | '/blog/$blogId/edit'\n    | '/posts/$postId/deep'\n    | '/blog/$slug'\n    | '/posts/$postId'\n    | '/blog/$blogId/$slug/bar'\n  id:\n    | '__root__'\n    | '/'\n    | '/blog'\n    | '/posts'\n    | '/blog_/$blogId'\n    | '/blog_/stats'\n    | '/blog/'\n    | '/posts/'\n    | '/blog_/$blogId/$slug'\n    | '/blog_/$blogId_/edit'\n    | '/posts/$postId/deep'\n    | '/blog/$slug/'\n    | '/posts/$postId/'\n    | '/blog_/$blogId/$slug_/bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  BlogRouteRoute: typeof BlogRouteRouteWithChildren\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  BlogBlogIdRouteRoute: typeof BlogBlogIdRouteRouteWithChildren\n  BlogStatsRoute: typeof BlogStatsRoute\n  BlogBlogIdEditRoute: typeof BlogBlogIdEditRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog': {\n      id: '/blog'\n      path: '/blog'\n      fullPath: '/blog'\n      preLoaderRoute: typeof BlogRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/blog/': {\n      id: '/blog/'\n      path: '/'\n      fullPath: '/blog/'\n      preLoaderRoute: typeof BlogIndexRouteImport\n      parentRoute: typeof BlogRouteRoute\n    }\n    '/blog_/stats': {\n      id: '/blog_/stats'\n      path: '/blog/stats'\n      fullPath: '/blog/stats'\n      preLoaderRoute: typeof BlogStatsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog_/$blogId': {\n      id: '/blog_/$blogId'\n      path: '/blog/$blogId'\n      fullPath: '/blog/$blogId'\n      preLoaderRoute: typeof BlogBlogIdRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId/': {\n      id: '/posts/$postId/'\n      path: '/$postId'\n      fullPath: '/posts/$postId/'\n      preLoaderRoute: typeof PostsPostIdIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/blog/$slug/': {\n      id: '/blog/$slug/'\n      path: '/$slug'\n      fullPath: '/blog/$slug/'\n      preLoaderRoute: typeof BlogSlugIndexRouteImport\n      parentRoute: typeof BlogRouteRoute\n    }\n    '/posts/$postId/deep': {\n      id: '/posts/$postId/deep'\n      path: '/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/blog_/$blogId_/edit': {\n      id: '/blog_/$blogId_/edit'\n      path: '/blog/$blogId/edit'\n      fullPath: '/blog/$blogId/edit'\n      preLoaderRoute: typeof BlogBlogIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog_/$blogId/$slug': {\n      id: '/blog_/$blogId/$slug'\n      path: '/$slug'\n      fullPath: '/blog/$blogId/$slug'\n      preLoaderRoute: typeof BlogBlogIdSlugRouteRouteImport\n      parentRoute: typeof BlogBlogIdRouteRoute\n    }\n    '/blog_/$blogId/$slug_/bar': {\n      id: '/blog_/$blogId/$slug_/bar'\n      path: '/$slug/bar'\n      fullPath: '/blog/$blogId/$slug/bar'\n      preLoaderRoute: typeof BlogBlogIdSlugBarRouteImport\n      parentRoute: typeof BlogBlogIdRouteRoute\n    }\n  }\n}\n\ninterface BlogRouteRouteChildren {\n  BlogIndexRoute: typeof BlogIndexRoute\n  BlogSlugIndexRoute: typeof BlogSlugIndexRoute\n}\n\nconst BlogRouteRouteChildren: BlogRouteRouteChildren = {\n  BlogIndexRoute: BlogIndexRoute,\n  BlogSlugIndexRoute: BlogSlugIndexRoute,\n}\n\nconst BlogRouteRouteWithChildren = BlogRouteRoute._addFileChildren(\n  BlogRouteRouteChildren,\n)\n\ninterface PostsRouteRouteChildren {\n  PostsIndexRoute: typeof PostsIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  PostsPostIdIndexRoute: typeof PostsPostIdIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsIndexRoute: PostsIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  PostsPostIdIndexRoute: PostsPostIdIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface BlogBlogIdRouteRouteChildren {\n  BlogBlogIdSlugRouteRoute: typeof BlogBlogIdSlugRouteRoute\n  BlogBlogIdSlugBarRoute: typeof BlogBlogIdSlugBarRoute\n}\n\nconst BlogBlogIdRouteRouteChildren: BlogBlogIdRouteRouteChildren = {\n  BlogBlogIdSlugRouteRoute: BlogBlogIdSlugRouteRoute,\n  BlogBlogIdSlugBarRoute: BlogBlogIdSlugBarRoute,\n}\n\nconst BlogBlogIdRouteRouteWithChildren = BlogBlogIdRouteRoute._addFileChildren(\n  BlogBlogIdRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  BlogRouteRoute: BlogRouteRouteWithChildren,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  BlogBlogIdRouteRoute: BlogBlogIdRouteRouteWithChildren,\n  BlogStatsRoute: BlogStatsRoute,\n  BlogBlogIdEditRoute: BlogBlogIdEditRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/blog.$slug.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog/$slug/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/blog.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/blog.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/blog_.$blogId.$slug.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog_/$blogId/$slug')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/blog_.$blogId.$slug_.bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog_/$blogId/$slug_/bar')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/blog_.$blogId.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog_/$blogId')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/blog_.$blogId_.edit.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog_/$blogId_/edit')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/blog_.stats.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog_/stats')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/posts.$postId.deep.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/posts/$postId/deep')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/posts.$postId.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/posts/$postId/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/posts/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat/routes/posts.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/posts')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat-route-group/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AppRouteImport } from './routes/app'\nimport { Route as AppcomprasComprasOrdenesRouteImport } from './routes/app.(compras)/compras_.ordenes'\nimport { Route as AppcomprasCompras_masRouteImport } from './routes/app.(compras)/compras_._mas'\nimport { Route as AppcomprasCompras_masDivisionesRouteImport } from './routes/app.(compras)/compras_._mas.divisiones'\n\nconst AppRoute = AppRouteImport.update({\n  id: '/app',\n  path: '/app',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst AppcomprasComprasOrdenesRoute =\n  AppcomprasComprasOrdenesRouteImport.update({\n    id: '/(compras)/compras_/ordenes',\n    path: '/compras/ordenes',\n    getParentRoute: () => AppRoute,\n  } as any)\nconst AppcomprasCompras_masRoute = AppcomprasCompras_masRouteImport.update({\n  id: '/(compras)/compras_/_mas',\n  path: '/compras',\n  getParentRoute: () => AppRoute,\n} as any)\nconst AppcomprasCompras_masDivisionesRoute =\n  AppcomprasCompras_masDivisionesRouteImport.update({\n    id: '/divisiones',\n    path: '/divisiones',\n    getParentRoute: () => AppcomprasCompras_masRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/app': typeof AppRouteWithChildren\n  '/app/compras': typeof AppcomprasCompras_masRouteWithChildren\n  '/app/compras/ordenes': typeof AppcomprasComprasOrdenesRoute\n  '/app/compras/divisiones': typeof AppcomprasCompras_masDivisionesRoute\n}\nexport interface FileRoutesByTo {\n  '/app': typeof AppRouteWithChildren\n  '/app/compras': typeof AppcomprasCompras_masRouteWithChildren\n  '/app/compras/ordenes': typeof AppcomprasComprasOrdenesRoute\n  '/app/compras/divisiones': typeof AppcomprasCompras_masDivisionesRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/app': typeof AppRouteWithChildren\n  '/app/(compras)/compras_/_mas': typeof AppcomprasCompras_masRouteWithChildren\n  '/app/(compras)/compras_/ordenes': typeof AppcomprasComprasOrdenesRoute\n  '/app/(compras)/compras_/_mas/divisiones': typeof AppcomprasCompras_masDivisionesRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/app'\n    | '/app/compras'\n    | '/app/compras/ordenes'\n    | '/app/compras/divisiones'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/app'\n    | '/app/compras'\n    | '/app/compras/ordenes'\n    | '/app/compras/divisiones'\n  id:\n    | '__root__'\n    | '/app'\n    | '/app/(compras)/compras_/_mas'\n    | '/app/(compras)/compras_/ordenes'\n    | '/app/(compras)/compras_/_mas/divisiones'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  AppRoute: typeof AppRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/app': {\n      id: '/app'\n      path: '/app'\n      fullPath: '/app'\n      preLoaderRoute: typeof AppRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/app/(compras)/compras_/ordenes': {\n      id: '/app/(compras)/compras_/ordenes'\n      path: '/compras/ordenes'\n      fullPath: '/app/compras/ordenes'\n      preLoaderRoute: typeof AppcomprasComprasOrdenesRouteImport\n      parentRoute: typeof AppRoute\n    }\n    '/app/(compras)/compras_/_mas': {\n      id: '/app/(compras)/compras_/_mas'\n      path: '/compras'\n      fullPath: '/app/compras'\n      preLoaderRoute: typeof AppcomprasCompras_masRouteImport\n      parentRoute: typeof AppRoute\n    }\n    '/app/(compras)/compras_/_mas/divisiones': {\n      id: '/app/(compras)/compras_/_mas/divisiones'\n      path: '/divisiones'\n      fullPath: '/app/compras/divisiones'\n      preLoaderRoute: typeof AppcomprasCompras_masDivisionesRouteImport\n      parentRoute: typeof AppcomprasCompras_masRoute\n    }\n  }\n}\n\ninterface AppcomprasCompras_masRouteChildren {\n  AppcomprasCompras_masDivisionesRoute: typeof AppcomprasCompras_masDivisionesRoute\n}\n\nconst AppcomprasCompras_masRouteChildren: AppcomprasCompras_masRouteChildren = {\n  AppcomprasCompras_masDivisionesRoute: AppcomprasCompras_masDivisionesRoute,\n}\n\nconst AppcomprasCompras_masRouteWithChildren =\n  AppcomprasCompras_masRoute._addFileChildren(\n    AppcomprasCompras_masRouteChildren,\n  )\n\ninterface AppRouteChildren {\n  AppcomprasCompras_masRoute: typeof AppcomprasCompras_masRouteWithChildren\n  AppcomprasComprasOrdenesRoute: typeof AppcomprasComprasOrdenesRoute\n}\n\nconst AppRouteChildren: AppRouteChildren = {\n  AppcomprasCompras_masRoute: AppcomprasCompras_masRouteWithChildren,\n  AppcomprasComprasOrdenesRoute: AppcomprasComprasOrdenesRoute,\n}\n\nconst AppRouteWithChildren = AppRoute._addFileChildren(AppRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  AppRoute: AppRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat-route-group/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat-route-group/routes/app.(compras)/compras_._mas.divisiones.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/app/(compras)/compras_/_mas/divisiones')(\n  {\n    component: RouteComponent,\n  },\n)\n\nfunction RouteComponent() {\n  return <div>Hello \"/app/(compras)/compras/_mas/divisiones\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat-route-group/routes/app.(compras)/compras_._mas.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/app/(compras)/compras_/_mas')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/app/(compras)/compras/mas\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat-route-group/routes/app.(compras)/compras_.ordenes.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/app/(compras)/compras_/ordenes')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/app/(compras)/compras/mas/divisiones\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/flat-route-group/routes/app.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/app')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/app\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/invalid-param-names/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ValidParamRouteImport } from './routes/$validParam'\nimport { Route as UserNameRouteImport } from './routes/$user-name'\nimport { Route as R123RouteImport } from './routes/$123'\n\nconst ValidParamRoute = ValidParamRouteImport.update({\n  id: '/$validParam',\n  path: '/$validParam',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst UserNameRoute = UserNameRouteImport.update({\n  id: '/$user-name',\n  path: '/$user-name',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst R123Route = R123RouteImport.update({\n  id: '/$123',\n  path: '/$123',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/$123': typeof R123Route\n  '/$user-name': typeof UserNameRoute\n  '/$validParam': typeof ValidParamRoute\n}\nexport interface FileRoutesByTo {\n  '/$123': typeof R123Route\n  '/$user-name': typeof UserNameRoute\n  '/$validParam': typeof ValidParamRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/$123': typeof R123Route\n  '/$user-name': typeof UserNameRoute\n  '/$validParam': typeof ValidParamRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/$123' | '/$user-name' | '/$validParam'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/$123' | '/$user-name' | '/$validParam'\n  id: '__root__' | '/$123' | '/$user-name' | '/$validParam'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  R123Route: typeof R123Route\n  UserNameRoute: typeof UserNameRoute\n  ValidParamRoute: typeof ValidParamRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/$validParam': {\n      id: '/$validParam'\n      path: '/$validParam'\n      fullPath: '/$validParam'\n      preLoaderRoute: typeof ValidParamRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$user-name': {\n      id: '/$user-name'\n      path: '/$user-name'\n      fullPath: '/$user-name'\n      preLoaderRoute: typeof UserNameRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/$123': {\n      id: '/$123'\n      path: '/$123'\n      fullPath: '/$123'\n      preLoaderRoute: typeof R123RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  R123Route: R123Route,\n  UserNameRoute: UserNameRoute,\n  ValidParamRoute: ValidParamRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/invalid-param-names/routes/$123.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/$123')({\n  component: () => <div>Invalid param starting with number</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/invalid-param-names/routes/$user-name.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/$user-name')({\n  component: () => <div>Invalid param with hyphen</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/invalid-param-names/routes/$validParam.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/$validParam')({\n  component: () => <div>Valid param</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/invalid-param-names/routes/__root.tsx",
    "content": "import { createRootRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteRouteImport } from './routes/posts.route'\nimport { Route as PostsIndexRouteImport } from './routes/posts.index'\nimport { Route as PostsPostIdRouteImport } from './routes/posts.$postId'\n\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any).lazy(() => import('./routes/posts.route.lazy').then((d) => d.Route))\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts': typeof PostsIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/posts/$postId': typeof PostsPostIdRoute\n  '/posts/': typeof PostsIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/posts' | '/posts/$postId' | '/posts/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/posts/$postId' | '/posts'\n  id: '__root__' | '/posts' | '/posts/$postId' | '/posts/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId': {\n      id: '/posts/$postId'\n      path: '/$postId'\n      fullPath: '/posts/$postId'\n      preLoaderRoute: typeof PostsPostIdRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n  }\n}\n\ninterface PostsRouteRouteChildren {\n  PostsPostIdRoute: typeof PostsPostIdRoute\n  PostsIndexRoute: typeof PostsIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n  PostsIndexRoute: PostsIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy/routes/posts.$postId.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/posts/$postId\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy/routes/posts.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/posts/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy/routes/posts.route.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/posts')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/posts\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy/routes/posts.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/posts')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/posts\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-multi-slug-params/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\n\nconst SubRouteLazyRouteImport = createFileRoute('/sub')()\nconst SubTestLazyRouteImport = createFileRoute('/sub/test')()\nconst SubABLazyRouteImport = createFileRoute('/sub/$a/$b')()\n\nconst SubRouteLazyRoute = SubRouteLazyRouteImport.update({\n  id: '/sub',\n  path: '/sub',\n  getParentRoute: () => rootRouteImport,\n} as any).lazy(() => import('./routes/sub/route.lazy').then((d) => d.Route))\nconst SubTestLazyRoute = SubTestLazyRouteImport.update({\n  id: '/test',\n  path: '/test',\n  getParentRoute: () => SubRouteLazyRoute,\n} as any).lazy(() => import('./routes/sub/test.lazy').then((d) => d.Route))\nconst SubABLazyRoute = SubABLazyRouteImport.update({\n  id: '/$a/$b',\n  path: '/$a/$b',\n  getParentRoute: () => SubRouteLazyRoute,\n} as any).lazy(() => import('./routes/sub/$a.$b.lazy').then((d) => d.Route))\n\nexport interface FileRoutesByFullPath {\n  '/sub': typeof SubRouteLazyRouteWithChildren\n  '/sub/test': typeof SubTestLazyRoute\n  '/sub/$a/$b': typeof SubABLazyRoute\n}\nexport interface FileRoutesByTo {\n  '/sub': typeof SubRouteLazyRouteWithChildren\n  '/sub/test': typeof SubTestLazyRoute\n  '/sub/$a/$b': typeof SubABLazyRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/sub': typeof SubRouteLazyRouteWithChildren\n  '/sub/test': typeof SubTestLazyRoute\n  '/sub/$a/$b': typeof SubABLazyRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/sub' | '/sub/test' | '/sub/$a/$b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/sub' | '/sub/test' | '/sub/$a/$b'\n  id: '__root__' | '/sub' | '/sub/test' | '/sub/$a/$b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  SubRouteLazyRoute: typeof SubRouteLazyRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/sub': {\n      id: '/sub'\n      path: '/sub'\n      fullPath: '/sub'\n      preLoaderRoute: typeof SubRouteLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/sub/test': {\n      id: '/sub/test'\n      path: '/test'\n      fullPath: '/sub/test'\n      preLoaderRoute: typeof SubTestLazyRouteImport\n      parentRoute: typeof SubRouteLazyRoute\n    }\n    '/sub/$a/$b': {\n      id: '/sub/$a/$b'\n      path: '/$a/$b'\n      fullPath: '/sub/$a/$b'\n      preLoaderRoute: typeof SubABLazyRouteImport\n      parentRoute: typeof SubRouteLazyRoute\n    }\n  }\n}\n\ninterface SubRouteLazyRouteChildren {\n  SubTestLazyRoute: typeof SubTestLazyRoute\n  SubABLazyRoute: typeof SubABLazyRoute\n}\n\nconst SubRouteLazyRouteChildren: SubRouteLazyRouteChildren = {\n  SubTestLazyRoute: SubTestLazyRoute,\n  SubABLazyRoute: SubABLazyRoute,\n}\n\nconst SubRouteLazyRouteWithChildren = SubRouteLazyRoute._addFileChildren(\n  SubRouteLazyRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  SubRouteLazyRoute: SubRouteLazyRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-multi-slug-params/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-multi-slug-params/routes/sub/$a.$b.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nexport const Route = createLazyFileRoute('/sub/$a/$b')({\n  component: () => 'Multi Slug Route',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-multi-slug-params/routes/sub/route.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nexport const Route = createLazyFileRoute('/sub')({\n  component: () => 'Sub Layout',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-multi-slug-params/routes/sub/test.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nexport const Route = createLazyFileRoute('/sub/test')({\n  component: () => 'Test Route',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\n\nconst PathLazyRouteImport = createFileRoute('/path')()\nconst PathIndexLazyRouteImport = createFileRoute('/path/')()\n\nconst PathLazyRoute = PathLazyRouteImport.update({\n  id: '/path',\n  path: '/path',\n  getParentRoute: () => rootRouteImport,\n} as any).lazy(() => import('./routes/path.lazy').then((d) => d.Route))\nconst PathIndexLazyRoute = PathIndexLazyRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PathLazyRoute,\n} as any).lazy(() => import('./routes/path.index.lazy').then((d) => d.Route))\n\nexport interface FileRoutesByFullPath {\n  '/path': typeof PathLazyRouteWithChildren\n  '/path/': typeof PathIndexLazyRoute\n}\nexport interface FileRoutesByTo {\n  '/path': typeof PathIndexLazyRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/path': typeof PathLazyRouteWithChildren\n  '/path/': typeof PathIndexLazyRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/path' | '/path/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/path'\n  id: '__root__' | '/path' | '/path/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  PathLazyRoute: typeof PathLazyRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/path': {\n      id: '/path'\n      path: '/path'\n      fullPath: '/path'\n      preLoaderRoute: typeof PathLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/path/': {\n      id: '/path/'\n      path: '/'\n      fullPath: '/path/'\n      preLoaderRoute: typeof PathIndexLazyRouteImport\n      parentRoute: typeof PathLazyRoute\n    }\n  }\n}\n\ninterface PathLazyRouteChildren {\n  PathIndexLazyRoute: typeof PathIndexLazyRoute\n}\n\nconst PathLazyRouteChildren: PathLazyRouteChildren = {\n  PathIndexLazyRoute: PathIndexLazyRoute,\n}\n\nconst PathLazyRouteWithChildren = PathLazyRoute._addFileChildren(\n  PathLazyRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  PathLazyRoute: PathLazyRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index/routes/path.index.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nexport const Route = createLazyFileRoute('/path/')({\n  component: () => 'Path Index',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index/routes/path.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\nexport const Route = createLazyFileRoute('/path')({\n  component: () => 'Path Layout',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index-in-pathless/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LayoutRouteRouteImport } from './routes/_layout/route'\n\nconst LayoutPathLazyRouteImport = createFileRoute('/_layout/path')()\nconst LayoutPathIndexLazyRouteImport = createFileRoute('/_layout/path/')()\n\nconst LayoutRouteRoute = LayoutRouteRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutPathLazyRoute = LayoutPathLazyRouteImport.update({\n  id: '/path',\n  path: '/path',\n  getParentRoute: () => LayoutRouteRoute,\n} as any).lazy(() => import('./routes/_layout/path.lazy').then((d) => d.Route))\nconst LayoutPathIndexLazyRoute = LayoutPathIndexLazyRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => LayoutPathLazyRoute,\n} as any).lazy(() =>\n  import('./routes/_layout/path.index.lazy').then((d) => d.Route),\n)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof LayoutRouteRouteWithChildren\n  '/path': typeof LayoutPathLazyRouteWithChildren\n  '/path/': typeof LayoutPathIndexLazyRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof LayoutRouteRouteWithChildren\n  '/path': typeof LayoutPathIndexLazyRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/_layout': typeof LayoutRouteRouteWithChildren\n  '/_layout/path': typeof LayoutPathLazyRouteWithChildren\n  '/_layout/path/': typeof LayoutPathIndexLazyRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/path' | '/path/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/path'\n  id: '__root__' | '/_layout' | '/_layout/path' | '/_layout/path/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  LayoutRouteRoute: typeof LayoutRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/path': {\n      id: '/_layout/path'\n      path: '/path'\n      fullPath: '/path'\n      preLoaderRoute: typeof LayoutPathLazyRouteImport\n      parentRoute: typeof LayoutRouteRoute\n    }\n    '/_layout/path/': {\n      id: '/_layout/path/'\n      path: '/'\n      fullPath: '/path/'\n      preLoaderRoute: typeof LayoutPathIndexLazyRouteImport\n      parentRoute: typeof LayoutPathLazyRoute\n    }\n  }\n}\n\ninterface LayoutPathLazyRouteChildren {\n  LayoutPathIndexLazyRoute: typeof LayoutPathIndexLazyRoute\n}\n\nconst LayoutPathLazyRouteChildren: LayoutPathLazyRouteChildren = {\n  LayoutPathIndexLazyRoute: LayoutPathIndexLazyRoute,\n}\n\nconst LayoutPathLazyRouteWithChildren = LayoutPathLazyRoute._addFileChildren(\n  LayoutPathLazyRouteChildren,\n)\n\ninterface LayoutRouteRouteChildren {\n  LayoutPathLazyRoute: typeof LayoutPathLazyRouteWithChildren\n}\n\nconst LayoutRouteRouteChildren: LayoutRouteRouteChildren = {\n  LayoutPathLazyRoute: LayoutPathLazyRouteWithChildren,\n}\n\nconst LayoutRouteRouteWithChildren = LayoutRouteRoute._addFileChildren(\n  LayoutRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  LayoutRouteRoute: LayoutRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index-in-pathless/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index-in-pathless/routes/_layout/path.index.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/_layout/path/')({\n  component: () => 'Path Index',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index-in-pathless/routes/_layout/path.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\n\nexport const Route = createLazyFileRoute('/_layout/path')({\n  component: () => 'Path Layout',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/lazy-only-layout-and-index-in-pathless/routes/_layout/route.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_layout')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <Outlet />\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as LayoutA2RouteImport } from './routes/_layout-a2'\nimport { Route as LayoutA1RouteImport } from './routes/_layout-a1'\nimport { Route as JestedRouteRouteImport } from './routes/jested/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as NestedLayoutB2RouteImport } from './routes/nested/_layout-b2'\nimport { Route as NestedLayoutB1RouteImport } from './routes/nested/_layout-b1'\nimport { Route as JestedLayoutB4RouteImport } from './routes/jested/_layout-b4'\nimport { Route as JestedLayoutB3RouteImport } from './routes/jested/_layout-b3'\nimport { Route as FooBarRouteImport } from './routes/foo/bar'\nimport { Route as LayoutA2BarRouteImport } from './routes/_layout-a2/bar'\nimport { Route as LayoutA1FooRouteImport } from './routes/_layout-a1/foo'\nimport { Route as folderInFolderRouteImport } from './routes/(folder)/in-folder'\nimport { Route as FooLayoutB5RouteRouteImport } from './routes/foo/_layout-b5/route'\nimport { Route as NestedLayoutB1IndexRouteImport } from './routes/nested/_layout-b1/index'\nimport { Route as JestedLayoutB3IndexRouteImport } from './routes/jested/_layout-b3/index'\nimport { Route as FooLayoutB5IndexRouteImport } from './routes/foo/_layout-b5/index'\nimport { Route as NestedLayoutB2FooRouteImport } from './routes/nested/_layout-b2/foo'\nimport { Route as NestedLayoutB1LayoutC1RouteImport } from './routes/nested/_layout-b1/_layout-c1'\nimport { Route as JestedLayoutB4FooRouteImport } from './routes/jested/_layout-b4/foo'\nimport { Route as JestedLayoutB3LayoutC2RouteImport } from './routes/jested/_layout-b3/_layout-c2'\nimport { Route as FooLayoutB5IdRouteImport } from './routes/foo/_layout-b5/$id'\nimport { Route as NestedLayoutB1LayoutC1BarRouteImport } from './routes/nested/_layout-b1/_layout-c1/bar'\nimport { Route as JestedLayoutB3LayoutC2BarRouteImport } from './routes/jested/_layout-b3/_layout-c2/bar'\n\nconst LayoutA2Route = LayoutA2RouteImport.update({\n  id: '/_layout-a2',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutA1Route = LayoutA1RouteImport.update({\n  id: '/_layout-a1',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst JestedRouteRoute = JestedRouteRouteImport.update({\n  id: '/jested',\n  path: '/jested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedLayoutB2Route = NestedLayoutB2RouteImport.update({\n  id: '/nested/_layout-b2',\n  path: '/nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedLayoutB1Route = NestedLayoutB1RouteImport.update({\n  id: '/nested/_layout-b1',\n  path: '/nested',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst JestedLayoutB4Route = JestedLayoutB4RouteImport.update({\n  id: '/_layout-b4',\n  getParentRoute: () => JestedRouteRoute,\n} as any)\nconst JestedLayoutB3Route = JestedLayoutB3RouteImport.update({\n  id: '/_layout-b3',\n  getParentRoute: () => JestedRouteRoute,\n} as any)\nconst FooBarRoute = FooBarRouteImport.update({\n  id: '/foo/bar',\n  path: '/foo/bar',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst LayoutA2BarRoute = LayoutA2BarRouteImport.update({\n  id: '/bar',\n  path: '/bar',\n  getParentRoute: () => LayoutA2Route,\n} as any)\nconst LayoutA1FooRoute = LayoutA1FooRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => LayoutA1Route,\n} as any)\nconst folderInFolderRoute = folderInFolderRouteImport.update({\n  id: '/(folder)/in-folder',\n  path: '/in-folder',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FooLayoutB5RouteRoute = FooLayoutB5RouteRouteImport.update({\n  id: '/foo/_layout-b5',\n  path: '/foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst NestedLayoutB1IndexRoute = NestedLayoutB1IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => NestedLayoutB1Route,\n} as any)\nconst JestedLayoutB3IndexRoute = JestedLayoutB3IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => JestedLayoutB3Route,\n} as any)\nconst FooLayoutB5IndexRoute = FooLayoutB5IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => FooLayoutB5RouteRoute,\n} as any)\nconst NestedLayoutB2FooRoute = NestedLayoutB2FooRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => NestedLayoutB2Route,\n} as any)\nconst NestedLayoutB1LayoutC1Route = NestedLayoutB1LayoutC1RouteImport.update({\n  id: '/_layout-c1',\n  getParentRoute: () => NestedLayoutB1Route,\n} as any)\nconst JestedLayoutB4FooRoute = JestedLayoutB4FooRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => JestedLayoutB4Route,\n} as any)\nconst JestedLayoutB3LayoutC2Route = JestedLayoutB3LayoutC2RouteImport.update({\n  id: '/_layout-c2',\n  getParentRoute: () => JestedLayoutB3Route,\n} as any)\nconst FooLayoutB5IdRoute = FooLayoutB5IdRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => FooLayoutB5RouteRoute,\n} as any)\nconst NestedLayoutB1LayoutC1BarRoute =\n  NestedLayoutB1LayoutC1BarRouteImport.update({\n    id: '/bar',\n    path: '/bar',\n    getParentRoute: () => NestedLayoutB1LayoutC1Route,\n  } as any)\nconst JestedLayoutB3LayoutC2BarRoute =\n  JestedLayoutB3LayoutC2BarRouteImport.update({\n    id: '/bar',\n    path: '/bar',\n    getParentRoute: () => JestedLayoutB3LayoutC2Route,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/jested': typeof JestedLayoutB3LayoutC2RouteWithChildren\n  '/foo': typeof LayoutA1FooRoute\n  '/in-folder': typeof folderInFolderRoute\n  '/bar': typeof LayoutA2BarRoute\n  '/foo/bar': typeof FooBarRoute\n  '/nested': typeof NestedLayoutB1LayoutC1RouteWithChildren\n  '/foo/$id': typeof FooLayoutB5IdRoute\n  '/jested/foo': typeof JestedLayoutB4FooRoute\n  '/nested/foo': typeof NestedLayoutB2FooRoute\n  '/foo/': typeof FooLayoutB5IndexRoute\n  '/jested/': typeof JestedLayoutB3IndexRoute\n  '/nested/': typeof NestedLayoutB1IndexRoute\n  '/jested/bar': typeof JestedLayoutB3LayoutC2BarRoute\n  '/nested/bar': typeof NestedLayoutB1LayoutC1BarRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/jested': typeof JestedLayoutB3IndexRoute\n  '/in-folder': typeof folderInFolderRoute\n  '/foo': typeof FooLayoutB5IndexRoute\n  '/bar': typeof LayoutA2BarRoute\n  '/foo/bar': typeof FooBarRoute\n  '/nested': typeof NestedLayoutB1IndexRoute\n  '/foo/$id': typeof FooLayoutB5IdRoute\n  '/jested/foo': typeof JestedLayoutB4FooRoute\n  '/nested/foo': typeof NestedLayoutB2FooRoute\n  '/jested/bar': typeof JestedLayoutB3LayoutC2BarRoute\n  '/nested/bar': typeof NestedLayoutB1LayoutC1BarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/jested': typeof JestedRouteRouteWithChildren\n  '/_layout-a1': typeof LayoutA1RouteWithChildren\n  '/_layout-a2': typeof LayoutA2RouteWithChildren\n  '/foo/_layout-b5': typeof FooLayoutB5RouteRouteWithChildren\n  '/(folder)/in-folder': typeof folderInFolderRoute\n  '/_layout-a1/foo': typeof LayoutA1FooRoute\n  '/_layout-a2/bar': typeof LayoutA2BarRoute\n  '/foo/bar': typeof FooBarRoute\n  '/jested/_layout-b3': typeof JestedLayoutB3RouteWithChildren\n  '/jested/_layout-b4': typeof JestedLayoutB4RouteWithChildren\n  '/nested/_layout-b1': typeof NestedLayoutB1RouteWithChildren\n  '/nested/_layout-b2': typeof NestedLayoutB2RouteWithChildren\n  '/foo/_layout-b5/$id': typeof FooLayoutB5IdRoute\n  '/jested/_layout-b3/_layout-c2': typeof JestedLayoutB3LayoutC2RouteWithChildren\n  '/jested/_layout-b4/foo': typeof JestedLayoutB4FooRoute\n  '/nested/_layout-b1/_layout-c1': typeof NestedLayoutB1LayoutC1RouteWithChildren\n  '/nested/_layout-b2/foo': typeof NestedLayoutB2FooRoute\n  '/foo/_layout-b5/': typeof FooLayoutB5IndexRoute\n  '/jested/_layout-b3/': typeof JestedLayoutB3IndexRoute\n  '/nested/_layout-b1/': typeof NestedLayoutB1IndexRoute\n  '/jested/_layout-b3/_layout-c2/bar': typeof JestedLayoutB3LayoutC2BarRoute\n  '/nested/_layout-b1/_layout-c1/bar': typeof NestedLayoutB1LayoutC1BarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/jested'\n    | '/foo'\n    | '/in-folder'\n    | '/bar'\n    | '/foo/bar'\n    | '/nested'\n    | '/foo/$id'\n    | '/jested/foo'\n    | '/nested/foo'\n    | '/foo/'\n    | '/jested/'\n    | '/nested/'\n    | '/jested/bar'\n    | '/nested/bar'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/jested'\n    | '/in-folder'\n    | '/foo'\n    | '/bar'\n    | '/foo/bar'\n    | '/nested'\n    | '/foo/$id'\n    | '/jested/foo'\n    | '/nested/foo'\n    | '/jested/bar'\n    | '/nested/bar'\n  id:\n    | '__root__'\n    | '/'\n    | '/jested'\n    | '/_layout-a1'\n    | '/_layout-a2'\n    | '/foo/_layout-b5'\n    | '/(folder)/in-folder'\n    | '/_layout-a1/foo'\n    | '/_layout-a2/bar'\n    | '/foo/bar'\n    | '/jested/_layout-b3'\n    | '/jested/_layout-b4'\n    | '/nested/_layout-b1'\n    | '/nested/_layout-b2'\n    | '/foo/_layout-b5/$id'\n    | '/jested/_layout-b3/_layout-c2'\n    | '/jested/_layout-b4/foo'\n    | '/nested/_layout-b1/_layout-c1'\n    | '/nested/_layout-b2/foo'\n    | '/foo/_layout-b5/'\n    | '/jested/_layout-b3/'\n    | '/nested/_layout-b1/'\n    | '/jested/_layout-b3/_layout-c2/bar'\n    | '/nested/_layout-b1/_layout-c1/bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  JestedRouteRoute: typeof JestedRouteRouteWithChildren\n  LayoutA1Route: typeof LayoutA1RouteWithChildren\n  LayoutA2Route: typeof LayoutA2RouteWithChildren\n  FooLayoutB5RouteRoute: typeof FooLayoutB5RouteRouteWithChildren\n  folderInFolderRoute: typeof folderInFolderRoute\n  FooBarRoute: typeof FooBarRoute\n  NestedLayoutB1Route: typeof NestedLayoutB1RouteWithChildren\n  NestedLayoutB2Route: typeof NestedLayoutB2RouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_layout-a2': {\n      id: '/_layout-a2'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutA2RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout-a1': {\n      id: '/_layout-a1'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof LayoutA1RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/jested': {\n      id: '/jested'\n      path: '/jested'\n      fullPath: '/jested'\n      preLoaderRoute: typeof JestedRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/_layout-b2': {\n      id: '/nested/_layout-b2'\n      path: '/nested'\n      fullPath: '/nested'\n      preLoaderRoute: typeof NestedLayoutB2RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/_layout-b1': {\n      id: '/nested/_layout-b1'\n      path: '/nested'\n      fullPath: '/nested'\n      preLoaderRoute: typeof NestedLayoutB1RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/jested/_layout-b4': {\n      id: '/jested/_layout-b4'\n      path: ''\n      fullPath: '/jested'\n      preLoaderRoute: typeof JestedLayoutB4RouteImport\n      parentRoute: typeof JestedRouteRoute\n    }\n    '/jested/_layout-b3': {\n      id: '/jested/_layout-b3'\n      path: ''\n      fullPath: '/jested'\n      preLoaderRoute: typeof JestedLayoutB3RouteImport\n      parentRoute: typeof JestedRouteRoute\n    }\n    '/foo/bar': {\n      id: '/foo/bar'\n      path: '/foo/bar'\n      fullPath: '/foo/bar'\n      preLoaderRoute: typeof FooBarRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout-a2/bar': {\n      id: '/_layout-a2/bar'\n      path: '/bar'\n      fullPath: '/bar'\n      preLoaderRoute: typeof LayoutA2BarRouteImport\n      parentRoute: typeof LayoutA2Route\n    }\n    '/_layout-a1/foo': {\n      id: '/_layout-a1/foo'\n      path: '/foo'\n      fullPath: '/foo'\n      preLoaderRoute: typeof LayoutA1FooRouteImport\n      parentRoute: typeof LayoutA1Route\n    }\n    '/(folder)/in-folder': {\n      id: '/(folder)/in-folder'\n      path: '/in-folder'\n      fullPath: '/in-folder'\n      preLoaderRoute: typeof folderInFolderRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/foo/_layout-b5': {\n      id: '/foo/_layout-b5'\n      path: '/foo'\n      fullPath: '/foo'\n      preLoaderRoute: typeof FooLayoutB5RouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/_layout-b1/': {\n      id: '/nested/_layout-b1/'\n      path: '/'\n      fullPath: '/nested/'\n      preLoaderRoute: typeof NestedLayoutB1IndexRouteImport\n      parentRoute: typeof NestedLayoutB1Route\n    }\n    '/jested/_layout-b3/': {\n      id: '/jested/_layout-b3/'\n      path: '/'\n      fullPath: '/jested/'\n      preLoaderRoute: typeof JestedLayoutB3IndexRouteImport\n      parentRoute: typeof JestedLayoutB3Route\n    }\n    '/foo/_layout-b5/': {\n      id: '/foo/_layout-b5/'\n      path: '/'\n      fullPath: '/foo/'\n      preLoaderRoute: typeof FooLayoutB5IndexRouteImport\n      parentRoute: typeof FooLayoutB5RouteRoute\n    }\n    '/nested/_layout-b2/foo': {\n      id: '/nested/_layout-b2/foo'\n      path: '/foo'\n      fullPath: '/nested/foo'\n      preLoaderRoute: typeof NestedLayoutB2FooRouteImport\n      parentRoute: typeof NestedLayoutB2Route\n    }\n    '/nested/_layout-b1/_layout-c1': {\n      id: '/nested/_layout-b1/_layout-c1'\n      path: ''\n      fullPath: '/nested'\n      preLoaderRoute: typeof NestedLayoutB1LayoutC1RouteImport\n      parentRoute: typeof NestedLayoutB1Route\n    }\n    '/jested/_layout-b4/foo': {\n      id: '/jested/_layout-b4/foo'\n      path: '/foo'\n      fullPath: '/jested/foo'\n      preLoaderRoute: typeof JestedLayoutB4FooRouteImport\n      parentRoute: typeof JestedLayoutB4Route\n    }\n    '/jested/_layout-b3/_layout-c2': {\n      id: '/jested/_layout-b3/_layout-c2'\n      path: ''\n      fullPath: '/jested'\n      preLoaderRoute: typeof JestedLayoutB3LayoutC2RouteImport\n      parentRoute: typeof JestedLayoutB3Route\n    }\n    '/foo/_layout-b5/$id': {\n      id: '/foo/_layout-b5/$id'\n      path: '/$id'\n      fullPath: '/foo/$id'\n      preLoaderRoute: typeof FooLayoutB5IdRouteImport\n      parentRoute: typeof FooLayoutB5RouteRoute\n    }\n    '/nested/_layout-b1/_layout-c1/bar': {\n      id: '/nested/_layout-b1/_layout-c1/bar'\n      path: '/bar'\n      fullPath: '/nested/bar'\n      preLoaderRoute: typeof NestedLayoutB1LayoutC1BarRouteImport\n      parentRoute: typeof NestedLayoutB1LayoutC1Route\n    }\n    '/jested/_layout-b3/_layout-c2/bar': {\n      id: '/jested/_layout-b3/_layout-c2/bar'\n      path: '/bar'\n      fullPath: '/jested/bar'\n      preLoaderRoute: typeof JestedLayoutB3LayoutC2BarRouteImport\n      parentRoute: typeof JestedLayoutB3LayoutC2Route\n    }\n  }\n}\n\ninterface JestedLayoutB3LayoutC2RouteChildren {\n  JestedLayoutB3LayoutC2BarRoute: typeof JestedLayoutB3LayoutC2BarRoute\n}\n\nconst JestedLayoutB3LayoutC2RouteChildren: JestedLayoutB3LayoutC2RouteChildren =\n  {\n    JestedLayoutB3LayoutC2BarRoute: JestedLayoutB3LayoutC2BarRoute,\n  }\n\nconst JestedLayoutB3LayoutC2RouteWithChildren =\n  JestedLayoutB3LayoutC2Route._addFileChildren(\n    JestedLayoutB3LayoutC2RouteChildren,\n  )\n\ninterface JestedLayoutB3RouteChildren {\n  JestedLayoutB3LayoutC2Route: typeof JestedLayoutB3LayoutC2RouteWithChildren\n  JestedLayoutB3IndexRoute: typeof JestedLayoutB3IndexRoute\n}\n\nconst JestedLayoutB3RouteChildren: JestedLayoutB3RouteChildren = {\n  JestedLayoutB3LayoutC2Route: JestedLayoutB3LayoutC2RouteWithChildren,\n  JestedLayoutB3IndexRoute: JestedLayoutB3IndexRoute,\n}\n\nconst JestedLayoutB3RouteWithChildren = JestedLayoutB3Route._addFileChildren(\n  JestedLayoutB3RouteChildren,\n)\n\ninterface JestedLayoutB4RouteChildren {\n  JestedLayoutB4FooRoute: typeof JestedLayoutB4FooRoute\n}\n\nconst JestedLayoutB4RouteChildren: JestedLayoutB4RouteChildren = {\n  JestedLayoutB4FooRoute: JestedLayoutB4FooRoute,\n}\n\nconst JestedLayoutB4RouteWithChildren = JestedLayoutB4Route._addFileChildren(\n  JestedLayoutB4RouteChildren,\n)\n\ninterface JestedRouteRouteChildren {\n  JestedLayoutB3Route: typeof JestedLayoutB3RouteWithChildren\n  JestedLayoutB4Route: typeof JestedLayoutB4RouteWithChildren\n}\n\nconst JestedRouteRouteChildren: JestedRouteRouteChildren = {\n  JestedLayoutB3Route: JestedLayoutB3RouteWithChildren,\n  JestedLayoutB4Route: JestedLayoutB4RouteWithChildren,\n}\n\nconst JestedRouteRouteWithChildren = JestedRouteRoute._addFileChildren(\n  JestedRouteRouteChildren,\n)\n\ninterface LayoutA1RouteChildren {\n  LayoutA1FooRoute: typeof LayoutA1FooRoute\n}\n\nconst LayoutA1RouteChildren: LayoutA1RouteChildren = {\n  LayoutA1FooRoute: LayoutA1FooRoute,\n}\n\nconst LayoutA1RouteWithChildren = LayoutA1Route._addFileChildren(\n  LayoutA1RouteChildren,\n)\n\ninterface LayoutA2RouteChildren {\n  LayoutA2BarRoute: typeof LayoutA2BarRoute\n}\n\nconst LayoutA2RouteChildren: LayoutA2RouteChildren = {\n  LayoutA2BarRoute: LayoutA2BarRoute,\n}\n\nconst LayoutA2RouteWithChildren = LayoutA2Route._addFileChildren(\n  LayoutA2RouteChildren,\n)\n\ninterface FooLayoutB5RouteRouteChildren {\n  FooLayoutB5IdRoute: typeof FooLayoutB5IdRoute\n  FooLayoutB5IndexRoute: typeof FooLayoutB5IndexRoute\n}\n\nconst FooLayoutB5RouteRouteChildren: FooLayoutB5RouteRouteChildren = {\n  FooLayoutB5IdRoute: FooLayoutB5IdRoute,\n  FooLayoutB5IndexRoute: FooLayoutB5IndexRoute,\n}\n\nconst FooLayoutB5RouteRouteWithChildren =\n  FooLayoutB5RouteRoute._addFileChildren(FooLayoutB5RouteRouteChildren)\n\ninterface NestedLayoutB1LayoutC1RouteChildren {\n  NestedLayoutB1LayoutC1BarRoute: typeof NestedLayoutB1LayoutC1BarRoute\n}\n\nconst NestedLayoutB1LayoutC1RouteChildren: NestedLayoutB1LayoutC1RouteChildren =\n  {\n    NestedLayoutB1LayoutC1BarRoute: NestedLayoutB1LayoutC1BarRoute,\n  }\n\nconst NestedLayoutB1LayoutC1RouteWithChildren =\n  NestedLayoutB1LayoutC1Route._addFileChildren(\n    NestedLayoutB1LayoutC1RouteChildren,\n  )\n\ninterface NestedLayoutB1RouteChildren {\n  NestedLayoutB1LayoutC1Route: typeof NestedLayoutB1LayoutC1RouteWithChildren\n  NestedLayoutB1IndexRoute: typeof NestedLayoutB1IndexRoute\n}\n\nconst NestedLayoutB1RouteChildren: NestedLayoutB1RouteChildren = {\n  NestedLayoutB1LayoutC1Route: NestedLayoutB1LayoutC1RouteWithChildren,\n  NestedLayoutB1IndexRoute: NestedLayoutB1IndexRoute,\n}\n\nconst NestedLayoutB1RouteWithChildren = NestedLayoutB1Route._addFileChildren(\n  NestedLayoutB1RouteChildren,\n)\n\ninterface NestedLayoutB2RouteChildren {\n  NestedLayoutB2FooRoute: typeof NestedLayoutB2FooRoute\n}\n\nconst NestedLayoutB2RouteChildren: NestedLayoutB2RouteChildren = {\n  NestedLayoutB2FooRoute: NestedLayoutB2FooRoute,\n}\n\nconst NestedLayoutB2RouteWithChildren = NestedLayoutB2Route._addFileChildren(\n  NestedLayoutB2RouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  JestedRouteRoute: JestedRouteRouteWithChildren,\n  LayoutA1Route: LayoutA1RouteWithChildren,\n  LayoutA2Route: LayoutA2RouteWithChildren,\n  FooLayoutB5RouteRoute: FooLayoutB5RouteRouteWithChildren,\n  folderInFolderRoute: folderInFolderRoute,\n  FooBarRoute: FooBarRoute,\n  NestedLayoutB1Route: NestedLayoutB1RouteWithChildren,\n  NestedLayoutB2Route: NestedLayoutB2RouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/(folder)/in-folder.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/(folder)/in-folder')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/_layout-a1/foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/_layout-a1/foo')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/_layout-a1.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/_layout-a1')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/_layout-a2/bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/_layout-a2/bar')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/_layout-a2.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/_layout-a2')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/foo/_layout-b5/$id.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/foo/_layout-b5/$id')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/foo/_layout-b5/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/foo/_layout-b5/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/foo/_layout-b5/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/foo/_layout-b5')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/foo/bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/foo/bar')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/jested/_layout-b3/_layout-c2/bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/jested/_layout-b3/_layout-c2/bar')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/jested/_layout-b3/_layout-c2.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/jested/_layout-b3/_layout-c2')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/jested/_layout-b3/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/jested/_layout-b3/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/jested/_layout-b3.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/jested/_layout-b3')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/jested/_layout-b4/foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/jested/_layout-b4/foo')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/jested/_layout-b4.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/jested/_layout-b4')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/jested/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/jested')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/nested/_layout-b1/_layout-c1/bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested/_layout-b1/_layout-c1/bar')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/nested/_layout-b1/_layout-c1.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested/_layout-b1/_layout-c1')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/nested/_layout-b1/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested/_layout-b1/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/nested/_layout-b1.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested/_layout-b1')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/nested/_layout-b2/foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested/_layout-b2/foo')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-layouts/routes/nested/_layout-b2.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested/_layout-b2')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as groupCLayoutCRouteImport } from './routes/(group-c)/_layout-c'\nimport { Route as groupBLayoutBRouteImport } from './routes/(group-b)/_layout-b'\nimport { Route as groupALayoutARouteImport } from './routes/(group-a)/_layout-a'\nimport { Route as groupCLayoutCIndexRouteImport } from './routes/(group-c)/_layout-c/index'\nimport { Route as groupBLayoutBDashboardRouteImport } from './routes/(group-b)/_layout-b/dashboard'\nimport { Route as groupALayoutASignupRouteImport } from './routes/(group-a)/_layout-a/signup'\nimport { Route as groupALayoutALoginRouteImport } from './routes/(group-a)/_layout-a/login'\n\nconst groupCLayoutCRoute = groupCLayoutCRouteImport.update({\n  id: '/(group-c)/_layout-c',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupBLayoutBRoute = groupBLayoutBRouteImport.update({\n  id: '/(group-b)/_layout-b',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupALayoutARoute = groupALayoutARouteImport.update({\n  id: '/(group-a)/_layout-a',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst groupCLayoutCIndexRoute = groupCLayoutCIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => groupCLayoutCRoute,\n} as any)\nconst groupBLayoutBDashboardRoute = groupBLayoutBDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => groupBLayoutBRoute,\n} as any)\nconst groupALayoutASignupRoute = groupALayoutASignupRouteImport.update({\n  id: '/signup',\n  path: '/signup',\n  getParentRoute: () => groupALayoutARoute,\n} as any)\nconst groupALayoutALoginRoute = groupALayoutALoginRouteImport.update({\n  id: '/login',\n  path: '/login',\n  getParentRoute: () => groupALayoutARoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/login': typeof groupALayoutALoginRoute\n  '/signup': typeof groupALayoutASignupRoute\n  '/dashboard': typeof groupBLayoutBDashboardRoute\n  '/': typeof groupCLayoutCIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/login': typeof groupALayoutALoginRoute\n  '/signup': typeof groupALayoutASignupRoute\n  '/dashboard': typeof groupBLayoutBDashboardRoute\n  '/': typeof groupCLayoutCIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/(group-a)/_layout-a': typeof groupALayoutARouteWithChildren\n  '/(group-b)/_layout-b': typeof groupBLayoutBRouteWithChildren\n  '/(group-c)/_layout-c': typeof groupCLayoutCRouteWithChildren\n  '/(group-a)/_layout-a/login': typeof groupALayoutALoginRoute\n  '/(group-a)/_layout-a/signup': typeof groupALayoutASignupRoute\n  '/(group-b)/_layout-b/dashboard': typeof groupBLayoutBDashboardRoute\n  '/(group-c)/_layout-c/': typeof groupCLayoutCIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/login' | '/signup' | '/dashboard' | '/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/login' | '/signup' | '/dashboard' | '/'\n  id:\n    | '__root__'\n    | '/(group-a)/_layout-a'\n    | '/(group-b)/_layout-b'\n    | '/(group-c)/_layout-c'\n    | '/(group-a)/_layout-a/login'\n    | '/(group-a)/_layout-a/signup'\n    | '/(group-b)/_layout-b/dashboard'\n    | '/(group-c)/_layout-c/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  groupALayoutARoute: typeof groupALayoutARouteWithChildren\n  groupBLayoutBRoute: typeof groupBLayoutBRouteWithChildren\n  groupCLayoutCRoute: typeof groupCLayoutCRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/(group-c)/_layout-c': {\n      id: '/(group-c)/_layout-c'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupCLayoutCRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group-b)/_layout-b': {\n      id: '/(group-b)/_layout-b'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupBLayoutBRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group-a)/_layout-a': {\n      id: '/(group-a)/_layout-a'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof groupALayoutARouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(group-c)/_layout-c/': {\n      id: '/(group-c)/_layout-c/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof groupCLayoutCIndexRouteImport\n      parentRoute: typeof groupCLayoutCRoute\n    }\n    '/(group-b)/_layout-b/dashboard': {\n      id: '/(group-b)/_layout-b/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof groupBLayoutBDashboardRouteImport\n      parentRoute: typeof groupBLayoutBRoute\n    }\n    '/(group-a)/_layout-a/signup': {\n      id: '/(group-a)/_layout-a/signup'\n      path: '/signup'\n      fullPath: '/signup'\n      preLoaderRoute: typeof groupALayoutASignupRouteImport\n      parentRoute: typeof groupALayoutARoute\n    }\n    '/(group-a)/_layout-a/login': {\n      id: '/(group-a)/_layout-a/login'\n      path: '/login'\n      fullPath: '/login'\n      preLoaderRoute: typeof groupALayoutALoginRouteImport\n      parentRoute: typeof groupALayoutARoute\n    }\n  }\n}\n\ninterface groupALayoutARouteChildren {\n  groupALayoutALoginRoute: typeof groupALayoutALoginRoute\n  groupALayoutASignupRoute: typeof groupALayoutASignupRoute\n}\n\nconst groupALayoutARouteChildren: groupALayoutARouteChildren = {\n  groupALayoutALoginRoute: groupALayoutALoginRoute,\n  groupALayoutASignupRoute: groupALayoutASignupRoute,\n}\n\nconst groupALayoutARouteWithChildren = groupALayoutARoute._addFileChildren(\n  groupALayoutARouteChildren,\n)\n\ninterface groupBLayoutBRouteChildren {\n  groupBLayoutBDashboardRoute: typeof groupBLayoutBDashboardRoute\n}\n\nconst groupBLayoutBRouteChildren: groupBLayoutBRouteChildren = {\n  groupBLayoutBDashboardRoute: groupBLayoutBDashboardRoute,\n}\n\nconst groupBLayoutBRouteWithChildren = groupBLayoutBRoute._addFileChildren(\n  groupBLayoutBRouteChildren,\n)\n\ninterface groupCLayoutCRouteChildren {\n  groupCLayoutCIndexRoute: typeof groupCLayoutCIndexRoute\n}\n\nconst groupCLayoutCRouteChildren: groupCLayoutCRouteChildren = {\n  groupCLayoutCIndexRoute: groupCLayoutCIndexRoute,\n}\n\nconst groupCLayoutCRouteWithChildren = groupCLayoutCRoute._addFileChildren(\n  groupCLayoutCRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  groupALayoutARoute: groupALayoutARouteWithChildren,\n  groupBLayoutBRoute: groupBLayoutBRouteWithChildren,\n  groupCLayoutCRoute: groupCLayoutCRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/login.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(group-a)/_layout-a/login')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(group-a)/_layout-a/login\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a/signup.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(group-a)/_layout-a/signup')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(group-a)/_layout-a/signup\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-a)/_layout-a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(group-a)/_layout-a')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(group-a)/_layout-a\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b/dashboard.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(group-b)/_layout-b/dashboard')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(group-b)/_layout/dashboard\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-b)/_layout-b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(group-b)/_layout-b')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(group-b)/_layout-b\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(group-c)/_layout-c/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(group-c)/_layout-c/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/(group-c)/_layout-c.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(group-c)/_layout-c')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(group-c)/_layout-c\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport type { CreateFileRoute, FileRoutesByPath } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts/route'\nimport { Route as BlogRouteRouteImport } from './routes/blog/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts/index'\nimport { Route as BlogIndexRouteImport } from './routes/blog/index'\nimport { Route as BlogStatsRouteImport } from './routes/blog_/stats'\nimport { Route as BlogSlugRouteImport } from './routes/blog/$slug'\nimport { Route as PathlessLayoutSettingsRouteImport } from './routes/_pathlessLayout/settings'\nimport { Route as BlogBlogIdRouteRouteImport } from './routes/blog_/$blogId/route'\nimport { Route as PostsPostIdIndexRouteImport } from './routes/posts/$postId/index'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts/$postId/deep'\nimport { Route as BlogBlogIdEditRouteImport } from './routes/blog_/$blogId_/edit'\nimport { Route as BlogBlogIdSlugRouteRouteImport } from './routes/blog_/$blogId/$slug/route'\nimport { Route as BlogBlogIdSlugBarRouteImport } from './routes/blog_/$blogId/$slug_/bar'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogRouteRoute = BlogRouteRouteImport.update({\n  id: '/blog',\n  path: '/blog',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst BlogIndexRoute = BlogIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => BlogRouteRoute,\n} as any)\nconst BlogStatsRoute = BlogStatsRouteImport.update({\n  id: '/blog_/stats',\n  path: '/blog/stats',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogSlugRoute = BlogSlugRouteImport.update({\n  id: '/$slug',\n  path: '/$slug',\n  getParentRoute: () => BlogRouteRoute,\n} as any)\nconst PathlessLayoutSettingsRoute = PathlessLayoutSettingsRouteImport.update({\n  id: '/settings',\n  path: '/settings',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst BlogBlogIdRouteRoute = BlogBlogIdRouteRouteImport.update({\n  id: '/blog_/$blogId',\n  path: '/blog/$blogId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdIndexRoute = PostsPostIdIndexRouteImport.update({\n  id: '/$postId/',\n  path: '/$postId/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/$postId/deep',\n  path: '/$postId/deep',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst BlogBlogIdEditRoute = BlogBlogIdEditRouteImport.update({\n  id: '/blog_/$blogId_/edit',\n  path: '/blog/$blogId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogBlogIdSlugRouteRoute = BlogBlogIdSlugRouteRouteImport.update({\n  id: '/$slug',\n  path: '/$slug',\n  getParentRoute: () => BlogBlogIdRouteRoute,\n} as any)\nconst BlogBlogIdSlugBarRoute = BlogBlogIdSlugBarRouteImport.update({\n  id: '/$slug_/bar',\n  path: '/$slug/bar',\n  getParentRoute: () => BlogBlogIdRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRouteWithChildren\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/settings': typeof PathlessLayoutSettingsRoute\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog/stats': typeof BlogStatsRoute\n  '/blog/': typeof BlogIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog/$blogId/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId/': typeof PostsPostIdIndexRoute\n  '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/settings': typeof PathlessLayoutSettingsRoute\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog/stats': typeof BlogStatsRoute\n  '/blog': typeof BlogIndexRoute\n  '/posts': typeof PostsIndexRoute\n  '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog/$blogId/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId': typeof PostsPostIdIndexRoute\n  '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRouteWithChildren\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/blog_/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/_pathlessLayout/settings': typeof PathlessLayoutSettingsRoute\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog_/stats': typeof BlogStatsRoute\n  '/blog/': typeof BlogIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/blog_/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog_/$blogId_/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId/': typeof PostsPostIdIndexRoute\n  '/blog_/$blogId/$slug_/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/blog'\n    | '/posts'\n    | '/blog/$blogId'\n    | '/settings'\n    | '/blog/$slug'\n    | '/blog/stats'\n    | '/blog/'\n    | '/posts/'\n    | '/blog/$blogId/$slug'\n    | '/blog/$blogId/edit'\n    | '/posts/$postId/deep'\n    | '/posts/$postId/'\n    | '/blog/$blogId/$slug/bar'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/blog/$blogId'\n    | '/settings'\n    | '/blog/$slug'\n    | '/blog/stats'\n    | '/blog'\n    | '/posts'\n    | '/blog/$blogId/$slug'\n    | '/blog/$blogId/edit'\n    | '/posts/$postId/deep'\n    | '/posts/$postId'\n    | '/blog/$blogId/$slug/bar'\n  id:\n    | '__root__'\n    | '/'\n    | '/blog'\n    | '/posts'\n    | '/_pathlessLayout'\n    | '/blog_/$blogId'\n    | '/_pathlessLayout/settings'\n    | '/blog/$slug'\n    | '/blog_/stats'\n    | '/blog/'\n    | '/posts/'\n    | '/blog_/$blogId/$slug'\n    | '/blog_/$blogId_/edit'\n    | '/posts/$postId/deep'\n    | '/posts/$postId/'\n    | '/blog_/$blogId/$slug_/bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  BlogRouteRoute: typeof BlogRouteRouteWithChildren\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  BlogBlogIdRouteRoute: typeof BlogBlogIdRouteRouteWithChildren\n  BlogStatsRoute: typeof BlogStatsRoute\n  BlogBlogIdEditRoute: typeof BlogBlogIdEditRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog': {\n      id: '/blog'\n      path: '/blog'\n      fullPath: '/blog'\n      preLoaderRoute: typeof BlogRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/blog/': {\n      id: '/blog/'\n      path: '/'\n      fullPath: '/blog/'\n      preLoaderRoute: typeof BlogIndexRouteImport\n      parentRoute: typeof BlogRouteRoute\n    }\n    '/blog_/stats': {\n      id: '/blog_/stats'\n      path: '/blog/stats'\n      fullPath: '/blog/stats'\n      preLoaderRoute: typeof BlogStatsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog/$slug': {\n      id: '/blog/$slug'\n      path: '/$slug'\n      fullPath: '/blog/$slug'\n      preLoaderRoute: typeof BlogSlugRouteImport\n      parentRoute: typeof BlogRouteRoute\n    }\n    '/_pathlessLayout/settings': {\n      id: '/_pathlessLayout/settings'\n      path: '/settings'\n      fullPath: '/settings'\n      preLoaderRoute: typeof PathlessLayoutSettingsRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/blog_/$blogId': {\n      id: '/blog_/$blogId'\n      path: '/blog/$blogId'\n      fullPath: '/blog/$blogId'\n      preLoaderRoute: typeof BlogBlogIdRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId/': {\n      id: '/posts/$postId/'\n      path: '/$postId'\n      fullPath: '/posts/$postId/'\n      preLoaderRoute: typeof PostsPostIdIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId/deep': {\n      id: '/posts/$postId/deep'\n      path: '/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/blog_/$blogId_/edit': {\n      id: '/blog_/$blogId_/edit'\n      path: '/blog/$blogId/edit'\n      fullPath: '/blog/$blogId/edit'\n      preLoaderRoute: typeof BlogBlogIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog_/$blogId/$slug': {\n      id: '/blog_/$blogId/$slug'\n      path: '/$slug'\n      fullPath: '/blog/$blogId/$slug'\n      preLoaderRoute: typeof BlogBlogIdSlugRouteRouteImport\n      parentRoute: typeof BlogBlogIdRouteRoute\n    }\n    '/blog_/$blogId/$slug_/bar': {\n      id: '/blog_/$blogId/$slug_/bar'\n      path: '/$slug/bar'\n      fullPath: '/blog/$blogId/$slug/bar'\n      preLoaderRoute: typeof BlogBlogIdSlugBarRouteImport\n      parentRoute: typeof BlogBlogIdRouteRoute\n    }\n  }\n}\n\ndeclare module './routes/index' {\n  const createFileRoute: CreateFileRoute<\n    '/',\n    FileRoutesByPath['/']['parentRoute'],\n    FileRoutesByPath['/']['id'],\n    FileRoutesByPath['/']['path'],\n    FileRoutesByPath['/']['fullPath']\n  >\n}\ndeclare module './routes/blog/route' {\n  const createFileRoute: CreateFileRoute<\n    '/blog',\n    FileRoutesByPath['/blog']['parentRoute'],\n    FileRoutesByPath['/blog']['id'],\n    FileRoutesByPath['/blog']['path'],\n    FileRoutesByPath['/blog']['fullPath']\n  >\n}\ndeclare module './routes/posts/route' {\n  const createFileRoute: CreateFileRoute<\n    '/posts',\n    FileRoutesByPath['/posts']['parentRoute'],\n    FileRoutesByPath['/posts']['id'],\n    FileRoutesByPath['/posts']['path'],\n    FileRoutesByPath['/posts']['fullPath']\n  >\n}\ndeclare module './routes/_pathlessLayout' {\n  const createFileRoute: CreateFileRoute<\n    '/_pathlessLayout',\n    FileRoutesByPath['/_pathlessLayout']['parentRoute'],\n    FileRoutesByPath['/_pathlessLayout']['id'],\n    FileRoutesByPath['/_pathlessLayout']['path'],\n    FileRoutesByPath['/_pathlessLayout']['fullPath']\n  >\n}\ndeclare module './routes/blog_/$blogId/route' {\n  const createFileRoute: CreateFileRoute<\n    '/blog_/$blogId',\n    FileRoutesByPath['/blog_/$blogId']['parentRoute'],\n    FileRoutesByPath['/blog_/$blogId']['id'],\n    FileRoutesByPath['/blog_/$blogId']['path'],\n    FileRoutesByPath['/blog_/$blogId']['fullPath']\n  >\n}\ndeclare module './routes/_pathlessLayout/settings' {\n  const createFileRoute: CreateFileRoute<\n    '/_pathlessLayout/settings',\n    FileRoutesByPath['/_pathlessLayout/settings']['parentRoute'],\n    FileRoutesByPath['/_pathlessLayout/settings']['id'],\n    FileRoutesByPath['/_pathlessLayout/settings']['path'],\n    FileRoutesByPath['/_pathlessLayout/settings']['fullPath']\n  >\n}\ndeclare module './routes/blog/$slug' {\n  const createFileRoute: CreateFileRoute<\n    '/blog/$slug',\n    FileRoutesByPath['/blog/$slug']['parentRoute'],\n    FileRoutesByPath['/blog/$slug']['id'],\n    FileRoutesByPath['/blog/$slug']['path'],\n    FileRoutesByPath['/blog/$slug']['fullPath']\n  >\n}\ndeclare module './routes/blog_/stats' {\n  const createFileRoute: CreateFileRoute<\n    '/blog_/stats',\n    FileRoutesByPath['/blog_/stats']['parentRoute'],\n    FileRoutesByPath['/blog_/stats']['id'],\n    FileRoutesByPath['/blog_/stats']['path'],\n    FileRoutesByPath['/blog_/stats']['fullPath']\n  >\n}\ndeclare module './routes/blog/index' {\n  const createFileRoute: CreateFileRoute<\n    '/blog/',\n    FileRoutesByPath['/blog/']['parentRoute'],\n    FileRoutesByPath['/blog/']['id'],\n    FileRoutesByPath['/blog/']['path'],\n    FileRoutesByPath['/blog/']['fullPath']\n  >\n}\ndeclare module './routes/posts/index' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/',\n    FileRoutesByPath['/posts/']['parentRoute'],\n    FileRoutesByPath['/posts/']['id'],\n    FileRoutesByPath['/posts/']['path'],\n    FileRoutesByPath['/posts/']['fullPath']\n  >\n}\ndeclare module './routes/blog_/$blogId/$slug/route' {\n  const createFileRoute: CreateFileRoute<\n    '/blog_/$blogId/$slug',\n    FileRoutesByPath['/blog_/$blogId/$slug']['parentRoute'],\n    FileRoutesByPath['/blog_/$blogId/$slug']['id'],\n    FileRoutesByPath['/blog_/$blogId/$slug']['path'],\n    FileRoutesByPath['/blog_/$blogId/$slug']['fullPath']\n  >\n}\ndeclare module './routes/blog_/$blogId_/edit' {\n  const createFileRoute: CreateFileRoute<\n    '/blog_/$blogId_/edit',\n    FileRoutesByPath['/blog_/$blogId_/edit']['parentRoute'],\n    FileRoutesByPath['/blog_/$blogId_/edit']['id'],\n    FileRoutesByPath['/blog_/$blogId_/edit']['path'],\n    FileRoutesByPath['/blog_/$blogId_/edit']['fullPath']\n  >\n}\ndeclare module './routes/posts/$postId/deep' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId/deep',\n    FileRoutesByPath['/posts/$postId/deep']['parentRoute'],\n    FileRoutesByPath['/posts/$postId/deep']['id'],\n    FileRoutesByPath['/posts/$postId/deep']['path'],\n    FileRoutesByPath['/posts/$postId/deep']['fullPath']\n  >\n}\ndeclare module './routes/posts/$postId/index' {\n  const createFileRoute: CreateFileRoute<\n    '/posts/$postId/',\n    FileRoutesByPath['/posts/$postId/']['parentRoute'],\n    FileRoutesByPath['/posts/$postId/']['id'],\n    FileRoutesByPath['/posts/$postId/']['path'],\n    FileRoutesByPath['/posts/$postId/']['fullPath']\n  >\n}\ndeclare module './routes/blog_/$blogId/$slug_/bar' {\n  const createFileRoute: CreateFileRoute<\n    '/blog_/$blogId/$slug_/bar',\n    FileRoutesByPath['/blog_/$blogId/$slug_/bar']['parentRoute'],\n    FileRoutesByPath['/blog_/$blogId/$slug_/bar']['id'],\n    FileRoutesByPath['/blog_/$blogId/$slug_/bar']['path'],\n    FileRoutesByPath['/blog_/$blogId/$slug_/bar']['fullPath']\n  >\n}\n\ninterface BlogRouteRouteChildren {\n  BlogSlugRoute: typeof BlogSlugRoute\n  BlogIndexRoute: typeof BlogIndexRoute\n}\n\nconst BlogRouteRouteChildren: BlogRouteRouteChildren = {\n  BlogSlugRoute: BlogSlugRoute,\n  BlogIndexRoute: BlogIndexRoute,\n}\n\nconst BlogRouteRouteWithChildren = BlogRouteRoute._addFileChildren(\n  BlogRouteRouteChildren,\n)\n\ninterface PostsRouteRouteChildren {\n  PostsIndexRoute: typeof PostsIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  PostsPostIdIndexRoute: typeof PostsPostIdIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsIndexRoute: PostsIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  PostsPostIdIndexRoute: PostsPostIdIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutSettingsRoute: typeof PathlessLayoutSettingsRoute\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutSettingsRoute: PathlessLayoutSettingsRoute,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface BlogBlogIdRouteRouteChildren {\n  BlogBlogIdSlugRouteRoute: typeof BlogBlogIdSlugRouteRoute\n  BlogBlogIdSlugBarRoute: typeof BlogBlogIdSlugBarRoute\n}\n\nconst BlogBlogIdRouteRouteChildren: BlogBlogIdRouteRouteChildren = {\n  BlogBlogIdSlugRouteRoute: BlogBlogIdSlugRouteRoute,\n  BlogBlogIdSlugBarRoute: BlogBlogIdSlugBarRoute,\n}\n\nconst BlogBlogIdRouteRouteWithChildren = BlogBlogIdRouteRoute._addFileChildren(\n  BlogBlogIdRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  BlogRouteRoute: BlogRouteRouteWithChildren,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  BlogBlogIdRouteRoute: BlogBlogIdRouteRouteWithChildren,\n  BlogStatsRoute: BlogStatsRoute,\n  BlogBlogIdEditRoute: BlogBlogIdEditRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/_pathlessLayout/settings.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Settings</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/_pathlessLayout.tsx",
    "content": "import { Outlet } from '@tanstack/react-router'\nexport const Route = createFileRoute({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/blog/$slug.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /blog/$slug!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/blog/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /blog/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/blog/route.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /blog!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/blog_/$blogId/$slug/route.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /blog_/$blogId/$slug/route!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/blog_/$blogId/$slug_/bar.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /blog_/$blogId/$slug_/bar!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/blog_/$blogId/route.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /blog_/$blogId/route!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/blog_/$blogId_/edit.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /blog_/$blogId_/edit!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/blog_/stats.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /blog/stats!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/posts/$postId/deep.tsx",
    "content": "export const Route = createFileRoute({\n  context: () => ({ someContext: 'context' }),\n  loaderDeps: () => ({ dep: 1 }),\n  loader: () => ({ data: 'data' }),\n  component: () => <div>Hello /posts/$postId/deep!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/posts/$postId/index.tsx",
    "content": "export const Route = createFileRoute({\n  validateSearch: () => ({\n    indexSearch: 'search',\n  }),\n  component: () => <div>Hello /posts/$postId/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/posts/index.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /posts/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routes/posts/route.tsx",
    "content": "export const Route = createFileRoute({\n  component: () => <div>Hello /posts!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-false/tests.test-d.ts",
    "content": "import {\n  Link,\n  createRouter,\n  redirect,\n  useLoaderData,\n  useLoaderDeps,\n  useMatch,\n  useNavigate,\n  useParams,\n  useRouteContext,\n  useSearch,\n} from '@tanstack/react-router'\nimport type { FileRoutesByPath, MakeRouteMatch } from '@tanstack/react-router'\nimport { expectTypeOf, test } from 'vitest'\nimport { routeTree } from './routeTree.gen'\nimport type { FileRouteTypes } from './routeTree.gen'\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\nconst alwaysTrailingSlashRouter = createRouter({\n  routeTree,\n  trailingSlash: 'always',\n})\n\nconst neverTrailingSlashRouter = createRouter({\n  routeTree,\n  trailingSlash: 'never',\n})\n\nconst preserveTrailingSlashRouter = createRouter({\n  routeTree,\n  trailingSlash: 'preserve',\n})\n\ntest('when navigating to the root', () => {\n  // Issue #4892: Pathless layout routes should have fullPath: '/' not ''\n  expectTypeOf<FileRoutesByPath['/']['fullPath']>().toEqualTypeOf<'/'>()\n  expectTypeOf<\n    FileRoutesByPath['/posts/']['fullPath']\n  >().toEqualTypeOf<'/posts/'>()\n  // Issue #6403: Index routes should have trailing slash in fullPath to match runtime\n  expectTypeOf<\n    FileRoutesByPath['/posts/$postId/']['fullPath']\n  >().toEqualTypeOf<'/posts/$postId/'>()\n  expectTypeOf<\n    FileRoutesByPath['/blog/']['fullPath']\n  >().toEqualTypeOf<'/blog/'>()\n  // Verify empty string is not in fullPaths union\n  expectTypeOf<''>().not.toMatchTypeOf<FileRouteTypes['fullPaths']>()\n  // Verify pathless layout's fullPath is '/' (not '')\n  expectTypeOf<\n    FileRoutesByPath['/_pathlessLayout']['fullPath']\n  >().toEqualTypeOf<'/'>()\n  // Child of pathless layout should have correct fullPath\n  expectTypeOf<\n    FileRoutesByPath['/_pathlessLayout/settings']['fullPath']\n  >().toEqualTypeOf<'/settings'>()\n\n  expectTypeOf(Link<typeof defaultRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof alwaysTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog/'\n      | '/posts/'\n      | '/blog/$blogId/'\n      | '/blog/$blogId/edit/'\n      | '/blog/$blogId/$slug/'\n      | '/blog/$blogId/$slug/bar/'\n      | '/blog/$slug/'\n      | '/blog/stats/'\n      | '/posts/$postId/deep/'\n      | '/posts/$postId/'\n      | '/settings/'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/blog/'\n      | '/posts/'\n      | '/blog/$blogId/'\n      | '/blog/$blogId/edit/'\n      | '/blog/$blogId/$slug/'\n      | '/blog/$blogId/$slug/bar/'\n      | '/blog/$slug/'\n      | '/blog/stats/'\n      | '/posts/$postId/deep/'\n      | '/posts/$postId/'\n      | '/settings/'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<true | {} | undefined>()\n\n  expectTypeOf(Link<typeof alwaysTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<true | {} | undefined>()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<true | {} | undefined>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<true | {} | undefined>()\n})\n\ntest('when navigating a index route with search and params', () => {\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '.'\n      | '..'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n    >()\n\n  expectTypeOf(\n    Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId/'>,\n  )\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | './'\n      | '../'\n      | '/'\n      | '/blog/'\n      | '/posts/'\n      | '/blog/$blogId/'\n      | '/blog/$blogId/edit/'\n      | '/blog/$blogId/$slug/'\n      | '/blog/$blogId/$slug/bar/'\n      | '/blog/$slug/'\n      | '/blog/stats/'\n      | '/posts/$postId/deep/'\n      | '/posts/$postId/'\n      | '/settings/'\n    >()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n      | '.'\n      | '..'\n    >()\n\n  expectTypeOf(\n    Link<typeof preserveTrailingSlashRouter, string, '/posts/$postId'>,\n  )\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '../'\n      | '.'\n      | './'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/blog/'\n      | '/posts/'\n      | '/blog/$blogId/'\n      | '/blog/$blogId/edit/'\n      | '/blog/$blogId/$slug/'\n      | '/blog/$blogId/$slug/bar/'\n      | '/blog/$slug/'\n      | '/blog/stats/'\n      | '/posts/$postId/deep/'\n      | '/posts/$postId/'\n      | '/settings'\n      | '/settings/'\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, '/', '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<never>()\n\n  expectTypeOf(\n    Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId/'>,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<never>()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/posts/$postId/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId/'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<never>()\n\n  expectTypeOf(\n    Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId/'>,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  expectTypeOf(Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<never>()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/posts/$postId/'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n})\n\ntest('when navigating from a index route with search and params', () => {\n  expectTypeOf(Link<typeof defaultRouter, '/posts/$postId/', undefined>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, '/posts/$postId/', undefined>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ indexSearch: string }>()\n})\n\ntest('when using useNavigate', () => {\n  const navigate = useNavigate()\n\n  expectTypeOf(navigate<DefaultRouter, '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '.'\n      | '..'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n    >()\n})\n\ntest('when using redirect', () => {\n  expectTypeOf(redirect<DefaultRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/settings'\n      | undefined\n    >()\n})\n\ntest('when using useSearch from a route with no search', () => {\n  expectTypeOf(useSearch<DefaultRouter, '/blog'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(useSearch<DefaultRouter, '/blog'>).returns.toEqualTypeOf<{}>()\n})\n\ntest('when using useSearch from a route with search', () => {\n  expectTypeOf(useSearch<DefaultRouter, '/blog'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useSearch<DefaultRouter, '/posts/$postId/'>,\n  ).returns.toEqualTypeOf<{ indexSearch: string }>()\n})\n\ntest('when using useLoaderData from a route with loaderData', () => {\n  expectTypeOf(useLoaderData<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<{ data: string }>()\n})\n\ntest('when using useLoaderDeps from a route with loaderDeps', () => {\n  expectTypeOf(useLoaderDeps<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useLoaderDeps<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<{ dep: number }>()\n})\n\ntest('when using useMatch from a route', () => {\n  expectTypeOf(useMatch<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useMatch<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<\n    MakeRouteMatch<DefaultRouter['routeTree'], '/posts/$postId/deep', true>\n  >()\n})\n\ntest('when using useParams from a route', () => {\n  expectTypeOf(useParams<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useParams<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<{ postId: string }>()\n})\n\ntest('when using useRouteContext from a route', () => {\n  expectTypeOf(useRouteContext<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<{ someContext: string }>()\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout'\nimport { Route as PostsRouteRouteImport } from './routes/posts/route'\nimport { Route as BlogRouteRouteImport } from './routes/blog/route'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as PostsIndexRouteImport } from './routes/posts/index'\nimport { Route as BlogIndexRouteImport } from './routes/blog/index'\nimport { Route as BlogStatsRouteImport } from './routes/blog_/stats'\nimport { Route as BlogSlugRouteImport } from './routes/blog/$slug'\nimport { Route as PathlessLayoutSettingsRouteImport } from './routes/_pathlessLayout/settings'\nimport { Route as BlogBlogIdRouteRouteImport } from './routes/blog_/$blogId/route'\nimport { Route as PostsPostIdIndexRouteImport } from './routes/posts/$postId/index'\nimport { Route as PostsPostIdDeepRouteImport } from './routes/posts/$postId/deep'\nimport { Route as BlogBlogIdEditRouteImport } from './routes/blog_/$blogId_/edit'\nimport { Route as BlogBlogIdSlugRouteRouteImport } from './routes/blog_/$blogId/$slug/route'\nimport { Route as BlogBlogIdSlugBarRouteImport } from './routes/blog_/$blogId/$slug_/bar'\n\nconst PathlessLayoutRoute = PathlessLayoutRouteImport.update({\n  id: '/_pathlessLayout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsRouteRoute = PostsRouteRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogRouteRoute = BlogRouteRouteImport.update({\n  id: '/blog',\n  path: '/blog',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsIndexRoute = PostsIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst BlogIndexRoute = BlogIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => BlogRouteRoute,\n} as any)\nconst BlogStatsRoute = BlogStatsRouteImport.update({\n  id: '/blog_/stats',\n  path: '/blog/stats',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogSlugRoute = BlogSlugRouteImport.update({\n  id: '/$slug',\n  path: '/$slug',\n  getParentRoute: () => BlogRouteRoute,\n} as any)\nconst PathlessLayoutSettingsRoute = PathlessLayoutSettingsRouteImport.update({\n  id: '/settings',\n  path: '/settings',\n  getParentRoute: () => PathlessLayoutRoute,\n} as any)\nconst BlogBlogIdRouteRoute = BlogBlogIdRouteRouteImport.update({\n  id: '/blog_/$blogId',\n  path: '/blog/$blogId',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst PostsPostIdIndexRoute = PostsPostIdIndexRouteImport.update({\n  id: '/$postId/',\n  path: '/$postId/',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({\n  id: '/$postId/deep',\n  path: '/$postId/deep',\n  getParentRoute: () => PostsRouteRoute,\n} as any)\nconst BlogBlogIdEditRoute = BlogBlogIdEditRouteImport.update({\n  id: '/blog_/$blogId_/edit',\n  path: '/blog/$blogId/edit',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst BlogBlogIdSlugRouteRoute = BlogBlogIdSlugRouteRouteImport.update({\n  id: '/$slug',\n  path: '/$slug',\n  getParentRoute: () => BlogBlogIdRouteRoute,\n} as any)\nconst BlogBlogIdSlugBarRoute = BlogBlogIdSlugBarRouteImport.update({\n  id: '/$slug_/bar',\n  path: '/$slug/bar',\n  getParentRoute: () => BlogBlogIdRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRouteWithChildren\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/settings': typeof PathlessLayoutSettingsRoute\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog/stats': typeof BlogStatsRoute\n  '/blog/': typeof BlogIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog/$blogId/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId/': typeof PostsPostIdIndexRoute\n  '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/settings': typeof PathlessLayoutSettingsRoute\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog/stats': typeof BlogStatsRoute\n  '/blog': typeof BlogIndexRoute\n  '/posts': typeof PostsIndexRoute\n  '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog/$blogId/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId': typeof PostsPostIdIndexRoute\n  '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRouteWithChildren\n  '/posts': typeof PostsRouteRouteWithChildren\n  '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren\n  '/blog_/$blogId': typeof BlogBlogIdRouteRouteWithChildren\n  '/_pathlessLayout/settings': typeof PathlessLayoutSettingsRoute\n  '/blog/$slug': typeof BlogSlugRoute\n  '/blog_/stats': typeof BlogStatsRoute\n  '/blog/': typeof BlogIndexRoute\n  '/posts/': typeof PostsIndexRoute\n  '/blog_/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute\n  '/blog_/$blogId_/edit': typeof BlogBlogIdEditRoute\n  '/posts/$postId/deep': typeof PostsPostIdDeepRoute\n  '/posts/$postId/': typeof PostsPostIdIndexRoute\n  '/blog_/$blogId/$slug_/bar': typeof BlogBlogIdSlugBarRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/blog'\n    | '/posts'\n    | '/blog/$blogId'\n    | '/settings'\n    | '/blog/$slug'\n    | '/blog/stats'\n    | '/blog/'\n    | '/posts/'\n    | '/blog/$blogId/$slug'\n    | '/blog/$blogId/edit'\n    | '/posts/$postId/deep'\n    | '/posts/$postId/'\n    | '/blog/$blogId/$slug/bar'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/blog/$blogId'\n    | '/settings'\n    | '/blog/$slug'\n    | '/blog/stats'\n    | '/blog'\n    | '/posts'\n    | '/blog/$blogId/$slug'\n    | '/blog/$blogId/edit'\n    | '/posts/$postId/deep'\n    | '/posts/$postId'\n    | '/blog/$blogId/$slug/bar'\n  id:\n    | '__root__'\n    | '/'\n    | '/blog'\n    | '/posts'\n    | '/_pathlessLayout'\n    | '/blog_/$blogId'\n    | '/_pathlessLayout/settings'\n    | '/blog/$slug'\n    | '/blog_/stats'\n    | '/blog/'\n    | '/posts/'\n    | '/blog_/$blogId/$slug'\n    | '/blog_/$blogId_/edit'\n    | '/posts/$postId/deep'\n    | '/posts/$postId/'\n    | '/blog_/$blogId/$slug_/bar'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  BlogRouteRoute: typeof BlogRouteRouteWithChildren\n  PostsRouteRoute: typeof PostsRouteRouteWithChildren\n  PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren\n  BlogBlogIdRouteRoute: typeof BlogBlogIdRouteRouteWithChildren\n  BlogStatsRoute: typeof BlogStatsRoute\n  BlogBlogIdEditRoute: typeof BlogBlogIdEditRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_pathlessLayout': {\n      id: '/_pathlessLayout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof PathlessLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog': {\n      id: '/blog'\n      path: '/blog'\n      fullPath: '/blog'\n      preLoaderRoute: typeof BlogRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/': {\n      id: '/posts/'\n      path: '/'\n      fullPath: '/posts/'\n      preLoaderRoute: typeof PostsIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/blog/': {\n      id: '/blog/'\n      path: '/'\n      fullPath: '/blog/'\n      preLoaderRoute: typeof BlogIndexRouteImport\n      parentRoute: typeof BlogRouteRoute\n    }\n    '/blog_/stats': {\n      id: '/blog_/stats'\n      path: '/blog/stats'\n      fullPath: '/blog/stats'\n      preLoaderRoute: typeof BlogStatsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog/$slug': {\n      id: '/blog/$slug'\n      path: '/$slug'\n      fullPath: '/blog/$slug'\n      preLoaderRoute: typeof BlogSlugRouteImport\n      parentRoute: typeof BlogRouteRoute\n    }\n    '/_pathlessLayout/settings': {\n      id: '/_pathlessLayout/settings'\n      path: '/settings'\n      fullPath: '/settings'\n      preLoaderRoute: typeof PathlessLayoutSettingsRouteImport\n      parentRoute: typeof PathlessLayoutRoute\n    }\n    '/blog_/$blogId': {\n      id: '/blog_/$blogId'\n      path: '/blog/$blogId'\n      fullPath: '/blog/$blogId'\n      preLoaderRoute: typeof BlogBlogIdRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/posts/$postId/': {\n      id: '/posts/$postId/'\n      path: '/$postId'\n      fullPath: '/posts/$postId/'\n      preLoaderRoute: typeof PostsPostIdIndexRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/posts/$postId/deep': {\n      id: '/posts/$postId/deep'\n      path: '/$postId/deep'\n      fullPath: '/posts/$postId/deep'\n      preLoaderRoute: typeof PostsPostIdDeepRouteImport\n      parentRoute: typeof PostsRouteRoute\n    }\n    '/blog_/$blogId_/edit': {\n      id: '/blog_/$blogId_/edit'\n      path: '/blog/$blogId/edit'\n      fullPath: '/blog/$blogId/edit'\n      preLoaderRoute: typeof BlogBlogIdEditRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/blog_/$blogId/$slug': {\n      id: '/blog_/$blogId/$slug'\n      path: '/$slug'\n      fullPath: '/blog/$blogId/$slug'\n      preLoaderRoute: typeof BlogBlogIdSlugRouteRouteImport\n      parentRoute: typeof BlogBlogIdRouteRoute\n    }\n    '/blog_/$blogId/$slug_/bar': {\n      id: '/blog_/$blogId/$slug_/bar'\n      path: '/$slug/bar'\n      fullPath: '/blog/$blogId/$slug/bar'\n      preLoaderRoute: typeof BlogBlogIdSlugBarRouteImport\n      parentRoute: typeof BlogBlogIdRouteRoute\n    }\n  }\n}\n\ninterface BlogRouteRouteChildren {\n  BlogSlugRoute: typeof BlogSlugRoute\n  BlogIndexRoute: typeof BlogIndexRoute\n}\n\nconst BlogRouteRouteChildren: BlogRouteRouteChildren = {\n  BlogSlugRoute: BlogSlugRoute,\n  BlogIndexRoute: BlogIndexRoute,\n}\n\nconst BlogRouteRouteWithChildren = BlogRouteRoute._addFileChildren(\n  BlogRouteRouteChildren,\n)\n\ninterface PostsRouteRouteChildren {\n  PostsIndexRoute: typeof PostsIndexRoute\n  PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute\n  PostsPostIdIndexRoute: typeof PostsPostIdIndexRoute\n}\n\nconst PostsRouteRouteChildren: PostsRouteRouteChildren = {\n  PostsIndexRoute: PostsIndexRoute,\n  PostsPostIdDeepRoute: PostsPostIdDeepRoute,\n  PostsPostIdIndexRoute: PostsPostIdIndexRoute,\n}\n\nconst PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(\n  PostsRouteRouteChildren,\n)\n\ninterface PathlessLayoutRouteChildren {\n  PathlessLayoutSettingsRoute: typeof PathlessLayoutSettingsRoute\n}\n\nconst PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {\n  PathlessLayoutSettingsRoute: PathlessLayoutSettingsRoute,\n}\n\nconst PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(\n  PathlessLayoutRouteChildren,\n)\n\ninterface BlogBlogIdRouteRouteChildren {\n  BlogBlogIdSlugRouteRoute: typeof BlogBlogIdSlugRouteRoute\n  BlogBlogIdSlugBarRoute: typeof BlogBlogIdSlugBarRoute\n}\n\nconst BlogBlogIdRouteRouteChildren: BlogBlogIdRouteRouteChildren = {\n  BlogBlogIdSlugRouteRoute: BlogBlogIdSlugRouteRoute,\n  BlogBlogIdSlugBarRoute: BlogBlogIdSlugBarRoute,\n}\n\nconst BlogBlogIdRouteRouteWithChildren = BlogBlogIdRouteRoute._addFileChildren(\n  BlogBlogIdRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  BlogRouteRoute: BlogRouteRouteWithChildren,\n  PostsRouteRoute: PostsRouteRouteWithChildren,\n  PathlessLayoutRoute: PathlessLayoutRouteWithChildren,\n  BlogBlogIdRouteRoute: BlogBlogIdRouteRouteWithChildren,\n  BlogStatsRoute: BlogStatsRoute,\n  BlogBlogIdEditRoute: BlogBlogIdEditRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/_pathlessLayout/settings.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout/settings')({\n  component: () => <div>Settings</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/_pathlessLayout.tsx",
    "content": "import { createFileRoute, Outlet } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_pathlessLayout')({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/blog/$slug.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/blog/$slug')({\n  component: () => <div>Hello /blog/$slug!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/blog/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/blog/')({\n  component: () => <div>Hello /blog/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/blog/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/blog')({\n  component: () => <div>Hello /blog!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/blog_/$blogId/$slug/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/blog_/$blogId/$slug')({\n  component: () => <div>Hello /blog_/$blogId/$slug/route!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/blog_/$blogId/$slug_/bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/blog_/$blogId/$slug_/bar')({\n  component: () => <div>Hello /blog_/$blogId/$slug_/bar!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/blog_/$blogId/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/blog_/$blogId')({\n  component: () => <div>Hello /blog_/$blogId/route!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/blog_/$blogId_/edit.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/blog_/$blogId_/edit')({\n  component: () => <div>Hello /blog_/$blogId_/edit!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/blog_/stats.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/blog_/stats')({\n  component: () => <div>Hello /blog/stats!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/posts/$postId/deep.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/$postId/deep')({\n  context: () => ({ someContext: 'context' }),\n  loaderDeps: () => ({ dep: 1 }),\n  loader: () => ({ data: 'data' }),\n  component: () => <div>Hello /posts/$postId/deep!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/posts/$postId/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/$postId/')({\n  validateSearch: () => ({\n    indexSearch: 'search',\n  }),\n  component: () => <div>Hello /posts/$postId/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/posts/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts/')({\n  component: () => <div>Hello /posts/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routes/posts/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts')({\n  component: () => <div>Hello /posts!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/nested-verboseFileRoutes-true/tests.test-d.ts",
    "content": "import {\n  Link,\n  createRouter,\n  redirect,\n  useLoaderData,\n  useLoaderDeps,\n  useMatch,\n  useNavigate,\n  useParams,\n  useRouteContext,\n  useSearch,\n} from '@tanstack/react-router'\nimport type { FileRoutesByPath, MakeRouteMatch } from '@tanstack/react-router'\nimport { expectTypeOf, test } from 'vitest'\nimport { routeTree } from './routeTree.gen'\nimport type { FileRouteTypes } from './routeTree.gen'\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\nconst alwaysTrailingSlashRouter = createRouter({\n  routeTree,\n  trailingSlash: 'always',\n})\n\nconst neverTrailingSlashRouter = createRouter({\n  routeTree,\n  trailingSlash: 'never',\n})\n\nconst preserveTrailingSlashRouter = createRouter({\n  routeTree,\n  trailingSlash: 'preserve',\n})\n\ntest('when navigating to the root', () => {\n  // Issue #4892: Pathless layout routes should have fullPath: '/' not ''\n  expectTypeOf<FileRoutesByPath['/']['fullPath']>().toEqualTypeOf<'/'>()\n  expectTypeOf<\n    FileRoutesByPath['/posts/']['fullPath']\n  >().toEqualTypeOf<'/posts/'>()\n  // Issue #6403: Index routes should have trailing slash in fullPath to match runtime\n  expectTypeOf<\n    FileRoutesByPath['/posts/$postId/']['fullPath']\n  >().toEqualTypeOf<'/posts/$postId/'>()\n  expectTypeOf<\n    FileRoutesByPath['/blog/']['fullPath']\n  >().toEqualTypeOf<'/blog/'>()\n  // Verify empty string is not in fullPaths union\n  expectTypeOf<''>().not.toMatchTypeOf<FileRouteTypes['fullPaths']>()\n  // Verify pathless layout's fullPath is '/' (not '')\n  expectTypeOf<\n    FileRoutesByPath['/_pathlessLayout']['fullPath']\n  >().toEqualTypeOf<'/'>()\n  // Child of pathless layout should have correct fullPath\n  expectTypeOf<\n    FileRoutesByPath['/_pathlessLayout/settings']['fullPath']\n  >().toEqualTypeOf<'/settings'>()\n\n  expectTypeOf(Link<typeof defaultRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof alwaysTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog/'\n      | '/posts/'\n      | '/blog/$blogId/'\n      | '/blog/$blogId/edit/'\n      | '/blog/$blogId/$slug/'\n      | '/blog/$blogId/$slug/bar/'\n      | '/blog/$slug/'\n      | '/blog/stats/'\n      | '/posts/$postId/deep/'\n      | '/posts/$postId/'\n      | '/settings/'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/blog/'\n      | '/posts/'\n      | '/blog/$blogId/'\n      | '/blog/$blogId/edit/'\n      | '/blog/$blogId/$slug/'\n      | '/blog/$blogId/$slug/bar/'\n      | '/blog/$slug/'\n      | '/blog/stats/'\n      | '/posts/$postId/deep/'\n      | '/posts/$postId/'\n      | '/settings/'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<true | {} | undefined>()\n\n  expectTypeOf(Link<typeof alwaysTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<true | {} | undefined>()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<true | {} | undefined>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<true | {} | undefined>()\n})\n\ntest('when navigating a index route with search and params', () => {\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '.'\n      | '..'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n    >()\n\n  expectTypeOf(\n    Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId/'>,\n  )\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | './'\n      | '../'\n      | '/'\n      | '/blog/'\n      | '/posts/'\n      | '/blog/$blogId/'\n      | '/blog/$blogId/edit/'\n      | '/blog/$blogId/$slug/'\n      | '/blog/$blogId/$slug/bar/'\n      | '/blog/$slug/'\n      | '/blog/stats/'\n      | '/posts/$postId/deep/'\n      | '/posts/$postId/'\n      | '/settings/'\n    >()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n      | '.'\n      | '..'\n    >()\n\n  expectTypeOf(\n    Link<typeof preserveTrailingSlashRouter, string, '/posts/$postId'>,\n  )\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '..'\n      | '../'\n      | '.'\n      | './'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/blog/'\n      | '/posts/'\n      | '/blog/$blogId/'\n      | '/blog/$blogId/edit/'\n      | '/blog/$blogId/$slug/'\n      | '/blog/$blogId/$slug/bar/'\n      | '/blog/$slug/'\n      | '/blog/stats/'\n      | '/posts/$postId/deep/'\n      | '/posts/$postId/'\n      | '/settings'\n      | '/settings/'\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, '/', '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<never>()\n\n  expectTypeOf(\n    Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId/'>,\n  )\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<never>()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/posts/$postId/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ indexSearch: string }>()\n\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  expectTypeOf(Link<typeof defaultRouter, string, '/posts/$postId/'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<never>()\n\n  expectTypeOf(\n    Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId/'>,\n  )\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  expectTypeOf(Link<typeof alwaysTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<never>()\n\n  expectTypeOf(Link<typeof neverTrailingSlashRouter, string, '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/posts/$postId'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n\n  expectTypeOf(Link<typeof preserveTrailingSlashRouter, '/', '/posts/$postId/'>)\n    .parameter(0)\n    .toHaveProperty('params')\n    .exclude<(...args: any) => any>()\n    .toEqualTypeOf<{ postId: string }>()\n})\n\ntest('when navigating from a index route with search and params', () => {\n  expectTypeOf(Link<typeof defaultRouter, '/posts/$postId/', undefined>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/settings'\n      | undefined\n    >()\n\n  expectTypeOf(Link<typeof defaultRouter, '/posts/$postId/', undefined>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ indexSearch: string }>()\n})\n\ntest('when using useNavigate', () => {\n  const navigate = useNavigate()\n\n  expectTypeOf(navigate<DefaultRouter, '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '.'\n      | '..'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/posts/$postId'\n      | '/settings'\n    >()\n})\n\ntest('when using redirect', () => {\n  expectTypeOf(redirect<DefaultRouter, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      | '/'\n      | '/posts/$postId'\n      | '/blog'\n      | '/posts'\n      | '/blog/$blogId'\n      | '/blog/$blogId/edit'\n      | '/blog/$blogId/$slug'\n      | '/blog/$blogId/$slug/bar'\n      | '/blog/$slug'\n      | '/blog/stats'\n      | '/posts/$postId/deep'\n      | '/settings'\n      | undefined\n    >()\n})\n\ntest('when using useSearch from a route with no search', () => {\n  expectTypeOf(useSearch<DefaultRouter, '/blog'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(useSearch<DefaultRouter, '/blog'>).returns.toEqualTypeOf<{}>()\n})\n\ntest('when using useSearch from a route with search', () => {\n  expectTypeOf(useSearch<DefaultRouter, '/blog'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useSearch<DefaultRouter, '/posts/$postId/'>,\n  ).returns.toEqualTypeOf<{ indexSearch: string }>()\n})\n\ntest('when using useLoaderData from a route with loaderData', () => {\n  expectTypeOf(useLoaderData<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useLoaderData<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<{ data: string }>()\n})\n\ntest('when using useLoaderDeps from a route with loaderDeps', () => {\n  expectTypeOf(useLoaderDeps<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useLoaderDeps<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<{ dep: number }>()\n})\n\ntest('when using useMatch from a route', () => {\n  expectTypeOf(useMatch<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useMatch<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<\n    MakeRouteMatch<DefaultRouter['routeTree'], '/posts/$postId/deep', true>\n  >()\n})\n\ntest('when using useParams from a route', () => {\n  expectTypeOf(useParams<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useParams<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<{ postId: string }>()\n})\n\ntest('when using useRouteContext from a route', () => {\n  expectTypeOf(useRouteContext<DefaultRouter, '/posts/$postId/deep'>)\n    .parameter(0)\n    .toHaveProperty('from')\n    .toEqualTypeOf<\n      | '__root__'\n      | '/'\n      | '/blog'\n      | '/posts'\n      | '/blog/$slug'\n      | '/blog_/$blogId'\n      | '/blog_/$blogId_/edit'\n      | '/blog_/$blogId/$slug'\n      | '/blog_/$blogId/$slug_/bar'\n      | '/blog_/stats'\n      | '/blog/'\n      | '/posts/'\n      | '/posts/$postId/deep'\n      | '/posts/$postId/'\n      | '/_pathlessLayout'\n      | '/_pathlessLayout/settings'\n    >()\n\n  expectTypeOf(\n    useRouteContext<DefaultRouter, '/posts/$postId/deep'>,\n  ).returns.toEqualTypeOf<{ someContext: string }>()\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/no-duplicate-route-segment/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as FooLayoutRouteRouteImport } from './routes/foo/_layout/route'\nimport { Route as FooLayoutIndexRouteImport } from './routes/foo/_layout/index'\n\nconst FooLayoutRouteRoute = FooLayoutRouteRouteImport.update({\n  id: '/foo/_layout',\n  path: '/foo',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FooLayoutIndexRoute = FooLayoutIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => FooLayoutRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/foo': typeof FooLayoutRouteRouteWithChildren\n  '/foo/': typeof FooLayoutIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/foo': typeof FooLayoutIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/foo/_layout': typeof FooLayoutRouteRouteWithChildren\n  '/foo/_layout/': typeof FooLayoutIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/foo' | '/foo/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/foo'\n  id: '__root__' | '/foo/_layout' | '/foo/_layout/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  FooLayoutRouteRoute: typeof FooLayoutRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/foo/_layout': {\n      id: '/foo/_layout'\n      path: '/foo'\n      fullPath: '/foo'\n      preLoaderRoute: typeof FooLayoutRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/foo/_layout/': {\n      id: '/foo/_layout/'\n      path: '/'\n      fullPath: '/foo/'\n      preLoaderRoute: typeof FooLayoutIndexRouteImport\n      parentRoute: typeof FooLayoutRouteRoute\n    }\n  }\n}\n\ninterface FooLayoutRouteRouteChildren {\n  FooLayoutIndexRoute: typeof FooLayoutIndexRoute\n}\n\nconst FooLayoutRouteRouteChildren: FooLayoutRouteRouteChildren = {\n  FooLayoutIndexRoute: FooLayoutIndexRoute,\n}\n\nconst FooLayoutRouteRouteWithChildren = FooLayoutRouteRoute._addFileChildren(\n  FooLayoutRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  FooLayoutRouteRoute: FooLayoutRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/no-duplicate-route-segment/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/no-duplicate-route-segment/routes/foo/_layout/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/foo/_layout/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/no-duplicate-route-segment/routes/foo/_layout/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/foo/_layout')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as NestedIndexRouteImport } from './routes/nested/index'\nimport { Route as NestedChildRouteImport } from './routes/nested/child'\n\nconst IndexRoute = IndexRouteImport.update({\n            id: '/',path: '/',getParentRoute: () => rootRouteImport\n          }as any)\nconst NestedIndexRoute = NestedIndexRouteImport.update({\n            id: '/nested/',path: '/nested/',getParentRoute: () => rootRouteImport\n          }as any)\nconst NestedChildRoute = NestedChildRouteImport.update({\n            id: '/nested/child',path: '/nested/child',getParentRoute: () => rootRouteImport\n          }as any)\n\nexport interface FileRoutesByFullPath {\n'/': typeof IndexRoute,'/nested/child': typeof NestedChildRoute,'/nested/': typeof NestedIndexRoute\n}\nexport interface FileRoutesByTo {\n'/': typeof IndexRoute,'/nested/child': typeof NestedChildRoute,'/nested': typeof NestedIndexRoute\n}\nexport interface FileRoutesById {\n'__root__': typeof rootRouteImport,\n'/': typeof IndexRoute,'/nested/child': typeof NestedChildRoute,'/nested/': typeof NestedIndexRoute\n}\nexport interface FileRouteTypes {\nfileRoutesByFullPath: FileRoutesByFullPath\nfullPaths: '/'|'/nested/child'|'/nested/'\nfileRoutesByTo: FileRoutesByTo\nto: '/'|'/nested/child'|'/nested'\nid: '__root__'|'/'|'/nested/child'|'/nested/'\nfileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\nIndexRoute: typeof IndexRoute,NestedChildRoute: typeof NestedChildRoute,NestedIndexRoute: typeof NestedIndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n          id: '/'\n          path: '/'\n          fullPath: '/'\n          preLoaderRoute: typeof IndexRouteImport\n          parentRoute: typeof rootRouteImport\n        }\n'/nested/': {\n          id: '/nested/'\n          path: '/nested'\n          fullPath: '/nested/'\n          preLoaderRoute: typeof NestedIndexRouteImport\n          parentRoute: typeof rootRouteImport\n        }\n'/nested/child': {\n          id: '/nested/child'\n          path: '/nested/child'\n          fullPath: '/nested/child'\n          preLoaderRoute: typeof NestedChildRouteImport\n          parentRoute: typeof rootRouteImport\n        }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,NestedChildRoute: NestedChildRoute,NestedIndexRoute: NestedIndexRoute\n}\nexport const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)._addFileTypes<FileRouteTypes>()"
  },
  {
    "path": "packages/router-generator/tests/generator/no-formatted-route-tree/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/no-formatted-route-tree/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/no-formatted-route-tree/routes/nested/child.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested/child')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/no-formatted-route-tree/routes/nested/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/nested/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/numbers-in-path/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as AboutRouteImport } from './routes/about'\nimport { Route as R03RouteImport } from './routes/03'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as R02IndexRouteImport } from './routes/02.index'\nimport { Route as R01ExampleIndexRouteImport } from './routes/01-example/index'\n\nconst AboutRoute = AboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst R03Route = R03RouteImport.update({\n  id: '/03',\n  path: '/03',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst R02IndexRoute = R02IndexRouteImport.update({\n  id: '/02/',\n  path: '/02/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst R01ExampleIndexRoute = R01ExampleIndexRouteImport.update({\n  id: '/01-example/',\n  path: '/01-example/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/03': typeof R03Route\n  '/about': typeof AboutRoute\n  '/01-example/': typeof R01ExampleIndexRoute\n  '/02/': typeof R02IndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/03': typeof R03Route\n  '/about': typeof AboutRoute\n  '/01-example': typeof R01ExampleIndexRoute\n  '/02': typeof R02IndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/03': typeof R03Route\n  '/about': typeof AboutRoute\n  '/01-example/': typeof R01ExampleIndexRoute\n  '/02/': typeof R02IndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/03' | '/about' | '/01-example/' | '/02/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/03' | '/about' | '/01-example' | '/02'\n  id: '__root__' | '/' | '/03' | '/about' | '/01-example/' | '/02/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  R03Route: typeof R03Route\n  AboutRoute: typeof AboutRoute\n  R01ExampleIndexRoute: typeof R01ExampleIndexRoute\n  R02IndexRoute: typeof R02IndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof AboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/03': {\n      id: '/03'\n      path: '/03'\n      fullPath: '/03'\n      preLoaderRoute: typeof R03RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/02/': {\n      id: '/02/'\n      path: '/02'\n      fullPath: '/02/'\n      preLoaderRoute: typeof R02IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/01-example/': {\n      id: '/01-example/'\n      path: '/01-example'\n      fullPath: '/01-example/'\n      preLoaderRoute: typeof R01ExampleIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  R03Route: R03Route,\n  AboutRoute: AboutRoute,\n  R01ExampleIndexRoute: R01ExampleIndexRoute,\n  R02IndexRoute: R02IndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/numbers-in-path/routes/01-example/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/01-example/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/01-example/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/numbers-in-path/routes/02.index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/02/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/02/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/numbers-in-path/routes/03.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/03')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/03\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/numbers-in-path/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/numbers-in-path/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/about')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/about\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/numbers-in-path/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/only-root/routeTree.generated.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './../routes/__root'\n\nexport interface FileRoutesByFullPath {}\nexport interface FileRoutesByTo {}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: never\n  fileRoutesByTo: FileRoutesByTo\n  to: never\n  id: '__root__'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {}\n}\n\nconst rootRouteChildren: RootRouteChildren = {}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/only-root/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\n\nexport interface FileRoutesByFullPath {}\nexport interface FileRoutesByTo {}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: never\n  fileRoutesByTo: FileRoutesByTo\n  to: never\n  id: '__root__'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {}\n}\n\nconst rootRouteChildren: RootRouteChildren = {}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/only-root/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/path-above-route-in-group/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ABcRouteRouteImport } from './routes/a/$b/(c)/route'\nimport { Route as ABcIndexRouteImport } from './routes/a/$b/(c)/index'\nimport { Route as ABcDEIndexRouteImport } from './routes/a/$b/(c)/d/e/index'\n\nconst ABcRouteRoute = ABcRouteRouteImport.update({\n  id: '/a/$b/(c)',\n  path: '/a/$b',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ABcIndexRoute = ABcIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => ABcRouteRoute,\n} as any)\nconst ABcDEIndexRoute = ABcDEIndexRouteImport.update({\n  id: '/d/e/',\n  path: '/d/e/',\n  getParentRoute: () => ABcRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/a/$b': typeof ABcRouteRouteWithChildren\n  '/a/$b/': typeof ABcIndexRoute\n  '/a/$b/d/e/': typeof ABcDEIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/a/$b': typeof ABcIndexRoute\n  '/a/$b/d/e': typeof ABcDEIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/a/$b/(c)': typeof ABcRouteRouteWithChildren\n  '/a/$b/(c)/': typeof ABcIndexRoute\n  '/a/$b/(c)/d/e/': typeof ABcDEIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/a/$b' | '/a/$b/' | '/a/$b/d/e/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/a/$b' | '/a/$b/d/e'\n  id: '__root__' | '/a/$b/(c)' | '/a/$b/(c)/' | '/a/$b/(c)/d/e/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  ABcRouteRoute: typeof ABcRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/a/$b/(c)': {\n      id: '/a/$b/(c)'\n      path: '/a/$b'\n      fullPath: '/a/$b'\n      preLoaderRoute: typeof ABcRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/a/$b/(c)/': {\n      id: '/a/$b/(c)/'\n      path: '/'\n      fullPath: '/a/$b/'\n      preLoaderRoute: typeof ABcIndexRouteImport\n      parentRoute: typeof ABcRouteRoute\n    }\n    '/a/$b/(c)/d/e/': {\n      id: '/a/$b/(c)/d/e/'\n      path: '/d/e'\n      fullPath: '/a/$b/d/e/'\n      preLoaderRoute: typeof ABcDEIndexRouteImport\n      parentRoute: typeof ABcRouteRoute\n    }\n  }\n}\n\ninterface ABcRouteRouteChildren {\n  ABcIndexRoute: typeof ABcIndexRoute\n  ABcDEIndexRoute: typeof ABcDEIndexRoute\n}\n\nconst ABcRouteRouteChildren: ABcRouteRouteChildren = {\n  ABcIndexRoute: ABcIndexRoute,\n  ABcDEIndexRoute: ABcDEIndexRoute,\n}\n\nconst ABcRouteRouteWithChildren = ABcRouteRoute._addFileChildren(\n  ABcRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  ABcRouteRoute: ABcRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/path-above-route-in-group/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/path-above-route-in-group/routes/a/$b/(c)/d/e/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/a/$b/(c)/d/e/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/a/$b/(c)/d/e/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/path-above-route-in-group/routes/a/$b/(c)/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/a/$b/(c)/')({\n  component: () => <div>Hello /a/$b/(c) index</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/path-above-route-in-group/routes/a/$b/(c)/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/a/$b/(c)')({\n  component: () => <div>Hello /a/$b/(c)!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/prefix-suffix/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as WildcardChar123Char125suffixRouteImport } from './routes/wildcard/{$}suffix'\nimport { Route as WildcardChar123Char125DotsuffixRouteImport } from './routes/wildcard/{$}[.]suffix'\nimport { Route as WildcardPrefixChar123Char125RouteImport } from './routes/wildcard/prefix{$}'\nimport { Route as WildcardSplatRouteImport } from './routes/wildcard/$'\n\nconst WildcardChar123Char125suffixRoute =\n  WildcardChar123Char125suffixRouteImport.update({\n    id: '/wildcard/{$}suffix',\n    path: '/wildcard/{$}suffix',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst WildcardChar123Char125DotsuffixRoute =\n  WildcardChar123Char125DotsuffixRouteImport.update({\n    id: '/wildcard/{$}.suffix',\n    path: '/wildcard/{$}.suffix',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst WildcardPrefixChar123Char125Route =\n  WildcardPrefixChar123Char125RouteImport.update({\n    id: '/wildcard/prefix{$}',\n    path: '/wildcard/prefix{$}',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst WildcardSplatRoute = WildcardSplatRouteImport.update({\n  id: '/wildcard/$',\n  path: '/wildcard/$',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/wildcard/$': typeof WildcardSplatRoute\n  '/wildcard/prefix{$}': typeof WildcardPrefixChar123Char125Route\n  '/wildcard/{$}.suffix': typeof WildcardChar123Char125DotsuffixRoute\n  '/wildcard/{$}suffix': typeof WildcardChar123Char125suffixRoute\n}\nexport interface FileRoutesByTo {\n  '/wildcard/$': typeof WildcardSplatRoute\n  '/wildcard/prefix{$}': typeof WildcardPrefixChar123Char125Route\n  '/wildcard/{$}.suffix': typeof WildcardChar123Char125DotsuffixRoute\n  '/wildcard/{$}suffix': typeof WildcardChar123Char125suffixRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/wildcard/$': typeof WildcardSplatRoute\n  '/wildcard/prefix{$}': typeof WildcardPrefixChar123Char125Route\n  '/wildcard/{$}.suffix': typeof WildcardChar123Char125DotsuffixRoute\n  '/wildcard/{$}suffix': typeof WildcardChar123Char125suffixRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/wildcard/$'\n    | '/wildcard/prefix{$}'\n    | '/wildcard/{$}.suffix'\n    | '/wildcard/{$}suffix'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/wildcard/$'\n    | '/wildcard/prefix{$}'\n    | '/wildcard/{$}.suffix'\n    | '/wildcard/{$}suffix'\n  id:\n    | '__root__'\n    | '/wildcard/$'\n    | '/wildcard/prefix{$}'\n    | '/wildcard/{$}.suffix'\n    | '/wildcard/{$}suffix'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  WildcardSplatRoute: typeof WildcardSplatRoute\n  WildcardPrefixChar123Char125Route: typeof WildcardPrefixChar123Char125Route\n  WildcardChar123Char125DotsuffixRoute: typeof WildcardChar123Char125DotsuffixRoute\n  WildcardChar123Char125suffixRoute: typeof WildcardChar123Char125suffixRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/wildcard/{$}suffix': {\n      id: '/wildcard/{$}suffix'\n      path: '/wildcard/{$}suffix'\n      fullPath: '/wildcard/{$}suffix'\n      preLoaderRoute: typeof WildcardChar123Char125suffixRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/wildcard/{$}.suffix': {\n      id: '/wildcard/{$}.suffix'\n      path: '/wildcard/{$}.suffix'\n      fullPath: '/wildcard/{$}.suffix'\n      preLoaderRoute: typeof WildcardChar123Char125DotsuffixRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/wildcard/prefix{$}': {\n      id: '/wildcard/prefix{$}'\n      path: '/wildcard/prefix{$}'\n      fullPath: '/wildcard/prefix{$}'\n      preLoaderRoute: typeof WildcardPrefixChar123Char125RouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/wildcard/$': {\n      id: '/wildcard/$'\n      path: '/wildcard/$'\n      fullPath: '/wildcard/$'\n      preLoaderRoute: typeof WildcardSplatRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  WildcardSplatRoute: WildcardSplatRoute,\n  WildcardPrefixChar123Char125Route: WildcardPrefixChar123Char125Route,\n  WildcardChar123Char125DotsuffixRoute: WildcardChar123Char125DotsuffixRoute,\n  WildcardChar123Char125suffixRoute: WildcardChar123Char125suffixRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/prefix-suffix/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: RootComponent,\n})\n\nfunction RootComponent() {\n  return (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  )\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/prefix-suffix/routes/index.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/generator/prefix-suffix/routes/wildcard/$.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/wildcard/$')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/wildcard/$\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/prefix-suffix/routes/wildcard/prefix{$}.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/wildcard/prefix{$}')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/wildcard/prefix\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/prefix-suffix/routes/wildcard/{$}[.]suffix.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/wildcard/{$}.suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/wildcard/.suffix\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/prefix-suffix/routes/wildcard/{$}suffix.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/wildcard/{$}suffix')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/wildcard/suffix\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-inline/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as DashboardMainLayoutRouteImport } from './routes/dashboard.main-layout'\nimport { Route as IndexPageRouteImport } from './routes/index-page'\nimport { Route as DashboardHomePageRouteImport } from './routes/dashboard.home-page'\nimport { Route as DashboardSettingsRouteImport } from './routes/dashboard.settings'\n\nconst DashboardMainLayoutRoute = DashboardMainLayoutRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexPageRoute = IndexPageRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardHomePageRoute = DashboardHomePageRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardMainLayoutRoute,\n} as any)\nconst DashboardSettingsRoute = DashboardSettingsRouteImport.update({\n  id: '/settings',\n  path: '/settings',\n  getParentRoute: () => DashboardMainLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexPageRoute\n  '/dashboard': typeof DashboardMainLayoutRouteWithChildren\n  '/dashboard/settings': typeof DashboardSettingsRoute\n  '/dashboard/': typeof DashboardHomePageRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexPageRoute\n  '/dashboard/settings': typeof DashboardSettingsRoute\n  '/dashboard': typeof DashboardHomePageRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexPageRoute\n  '/dashboard': typeof DashboardMainLayoutRouteWithChildren\n  '/dashboard/settings': typeof DashboardSettingsRoute\n  '/dashboard/': typeof DashboardHomePageRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/dashboard' | '/dashboard/settings' | '/dashboard/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/dashboard/settings' | '/dashboard'\n  id: '__root__' | '/' | '/dashboard' | '/dashboard/settings' | '/dashboard/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexPageRoute: typeof IndexPageRoute\n  DashboardMainLayoutRoute: typeof DashboardMainLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardMainLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardHomePageRouteImport\n      parentRoute: typeof DashboardMainLayoutRoute\n    }\n    '/dashboard/settings': {\n      id: '/dashboard/settings'\n      path: '/settings'\n      fullPath: '/dashboard/settings'\n      preLoaderRoute: typeof DashboardSettingsRouteImport\n      parentRoute: typeof DashboardMainLayoutRoute\n    }\n  }\n}\n\ninterface DashboardMainLayoutRouteChildren {\n  DashboardSettingsRoute: typeof DashboardSettingsRoute\n  DashboardHomePageRoute: typeof DashboardHomePageRoute\n}\n\nconst DashboardMainLayoutRouteChildren: DashboardMainLayoutRouteChildren = {\n  DashboardSettingsRoute: DashboardSettingsRoute,\n  DashboardHomePageRoute: DashboardHomePageRoute,\n}\n\nconst DashboardMainLayoutRouteWithChildren =\n  DashboardMainLayoutRoute._addFileChildren(DashboardMainLayoutRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexPageRoute: IndexPageRoute,\n  DashboardMainLayoutRoute: DashboardMainLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-inline/routes/__root.tsx",
    "content": "import { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-inline/routes/dashboard.home-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/')({\n  component: () => <div>Dashboard Home</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-inline/routes/dashboard.main-layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: () => (\n    <div>\n      <h1>Dashboard Layout</h1>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-inline/routes/dashboard.settings.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/settings')({\n  component: () => <div>Dashboard Settings</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-inline/routes/index-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Home Page</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-json/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as DashboardMainLayoutRouteImport } from './routes/dashboard.main-layout'\nimport { Route as IndexPageRouteImport } from './routes/index-page'\nimport { Route as DashboardHomePageRouteImport } from './routes/dashboard.home-page'\nimport { Route as DashboardSettingsRouteImport } from './routes/dashboard.settings'\n\nconst DashboardMainLayoutRoute = DashboardMainLayoutRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexPageRoute = IndexPageRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst DashboardHomePageRoute = DashboardHomePageRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => DashboardMainLayoutRoute,\n} as any)\nconst DashboardSettingsRoute = DashboardSettingsRouteImport.update({\n  id: '/settings',\n  path: '/settings',\n  getParentRoute: () => DashboardMainLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexPageRoute\n  '/dashboard': typeof DashboardMainLayoutRouteWithChildren\n  '/dashboard/settings': typeof DashboardSettingsRoute\n  '/dashboard/': typeof DashboardHomePageRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexPageRoute\n  '/dashboard/settings': typeof DashboardSettingsRoute\n  '/dashboard': typeof DashboardHomePageRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexPageRoute\n  '/dashboard': typeof DashboardMainLayoutRouteWithChildren\n  '/dashboard/settings': typeof DashboardSettingsRoute\n  '/dashboard/': typeof DashboardHomePageRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/dashboard' | '/dashboard/settings' | '/dashboard/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/dashboard/settings' | '/dashboard'\n  id: '__root__' | '/' | '/dashboard' | '/dashboard/settings' | '/dashboard/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexPageRoute: typeof IndexPageRoute\n  DashboardMainLayoutRoute: typeof DashboardMainLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/dashboard': {\n      id: '/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof DashboardMainLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexPageRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/dashboard/': {\n      id: '/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof DashboardHomePageRouteImport\n      parentRoute: typeof DashboardMainLayoutRoute\n    }\n    '/dashboard/settings': {\n      id: '/dashboard/settings'\n      path: '/settings'\n      fullPath: '/dashboard/settings'\n      preLoaderRoute: typeof DashboardSettingsRouteImport\n      parentRoute: typeof DashboardMainLayoutRoute\n    }\n  }\n}\n\ninterface DashboardMainLayoutRouteChildren {\n  DashboardSettingsRoute: typeof DashboardSettingsRoute\n  DashboardHomePageRoute: typeof DashboardHomePageRoute\n}\n\nconst DashboardMainLayoutRouteChildren: DashboardMainLayoutRouteChildren = {\n  DashboardSettingsRoute: DashboardSettingsRoute,\n  DashboardHomePageRoute: DashboardHomePageRoute,\n}\n\nconst DashboardMainLayoutRouteWithChildren =\n  DashboardMainLayoutRoute._addFileChildren(DashboardMainLayoutRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexPageRoute: IndexPageRoute,\n  DashboardMainLayoutRoute: DashboardMainLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-json/routes/__root.tsx",
    "content": "import { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-json/routes/dashboard.home-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/')({\n  component: () => <div>Dashboard Home</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-json/routes/dashboard.main-layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard')({\n  component: () => (\n    <div>\n      <h1>Dashboard Layout</h1>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-json/routes/dashboard.settings.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/dashboard/settings')({\n  component: () => <div>Dashboard Settings</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-json/routes/index-page.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Home Page</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/regex-tokens-json/tsr.config.json",
    "content": "{\n  \"indexToken\": { \"regex\": \"[a-z]+-page\" },\n  \"routeToken\": { \"regex\": \"[a-z]+-layout\" }\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(foo)/asdf/(bar)/_layout')({\n  component: () => <div>Hello /(foo)/asdf/(bar)/_layout!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as barBarRouteImport } from './routes/(bar)/_bar'\nimport { Route as fooAsdfLayoutRouteImport } from './routes/(foo)/asdf/_layout'\nimport { Route as barBarHelloRouteImport } from './routes/(bar)/_bar.hello'\nimport { Route as fooAsdfLayoutFooRouteImport } from './routes/(foo)/asdf/_layout.foo'\nimport { Route as fooAsdfbarIdRouteImport } from './routes/(foo)/asdf/(bar)/$id'\nimport { Route as fooAsdfanotherGroupLayoutRouteImport } from './routes/(foo)/asdf/(another-group)/_layout'\nimport { Route as fooAsdfbarLayoutAboutRouteImport } from './routes/(foo)/asdf/(bar)/_layout.about'\nimport { Route as fooAsdfanotherGroupLayoutBazRouteImport } from './routes/(foo)/asdf/(another-group)/_layout.baz'\n\nconst fooAsdfbarLayoutXyzLazyRouteImport = createFileRoute(\n  '/(foo)/asdf/(bar)/_layout/xyz',\n)()\n\nconst barBarRoute = barBarRouteImport.update({\n  id: '/(bar)/_bar',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst fooAsdfLayoutRoute = fooAsdfLayoutRouteImport.update({\n  id: '/(foo)/asdf/_layout',\n  path: '/asdf',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst barBarHelloRoute = barBarHelloRouteImport.update({\n  id: '/hello',\n  path: '/hello',\n  getParentRoute: () => barBarRoute,\n} as any)\nconst fooAsdfLayoutFooRoute = fooAsdfLayoutFooRouteImport.update({\n  id: '/foo',\n  path: '/foo',\n  getParentRoute: () => fooAsdfLayoutRoute,\n} as any)\nconst fooAsdfbarIdRoute = fooAsdfbarIdRouteImport.update({\n  id: '/(foo)/asdf/(bar)/$id',\n  path: '/asdf/$id',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst fooAsdfanotherGroupLayoutRoute =\n  fooAsdfanotherGroupLayoutRouteImport.update({\n    id: '/(foo)/asdf/(another-group)/_layout',\n    path: '/asdf',\n    getParentRoute: () => rootRouteImport,\n  } as any)\nconst fooAsdfbarLayoutXyzLazyRoute = fooAsdfbarLayoutXyzLazyRouteImport\n  .update({\n    id: '/(foo)/asdf/(bar)/_layout/xyz',\n    path: '/asdf/xyz',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n  .lazy(() =>\n    import('./routes/(foo)/asdf/(bar)/_layout.xyz.lazy').then((d) => d.Route),\n  )\nconst fooAsdfbarLayoutAboutRoute = fooAsdfbarLayoutAboutRouteImport.update({\n  id: '/(foo)/asdf/(bar)/_layout/about',\n  path: '/asdf/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst fooAsdfanotherGroupLayoutBazRoute =\n  fooAsdfanotherGroupLayoutBazRouteImport.update({\n    id: '/baz',\n    path: '/baz',\n    getParentRoute: () => fooAsdfanotherGroupLayoutRoute,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/hello': typeof barBarHelloRoute\n  '/asdf': typeof fooAsdfanotherGroupLayoutRouteWithChildren\n  '/asdf/$id': typeof fooAsdfbarIdRoute\n  '/asdf/foo': typeof fooAsdfLayoutFooRoute\n  '/asdf/baz': typeof fooAsdfanotherGroupLayoutBazRoute\n  '/asdf/about': typeof fooAsdfbarLayoutAboutRoute\n  '/asdf/xyz': typeof fooAsdfbarLayoutXyzLazyRoute\n}\nexport interface FileRoutesByTo {\n  '/hello': typeof barBarHelloRoute\n  '/asdf': typeof fooAsdfanotherGroupLayoutRouteWithChildren\n  '/asdf/$id': typeof fooAsdfbarIdRoute\n  '/asdf/foo': typeof fooAsdfLayoutFooRoute\n  '/asdf/baz': typeof fooAsdfanotherGroupLayoutBazRoute\n  '/asdf/about': typeof fooAsdfbarLayoutAboutRoute\n  '/asdf/xyz': typeof fooAsdfbarLayoutXyzLazyRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/(bar)/_bar': typeof barBarRouteWithChildren\n  '/(bar)/_bar/hello': typeof barBarHelloRoute\n  '/(foo)/asdf/_layout': typeof fooAsdfLayoutRouteWithChildren\n  '/(foo)/asdf/(another-group)/_layout': typeof fooAsdfanotherGroupLayoutRouteWithChildren\n  '/(foo)/asdf/(bar)/$id': typeof fooAsdfbarIdRoute\n  '/(foo)/asdf/_layout/foo': typeof fooAsdfLayoutFooRoute\n  '/(foo)/asdf/(another-group)/_layout/baz': typeof fooAsdfanotherGroupLayoutBazRoute\n  '/(foo)/asdf/(bar)/_layout/about': typeof fooAsdfbarLayoutAboutRoute\n  '/(foo)/asdf/(bar)/_layout/xyz': typeof fooAsdfbarLayoutXyzLazyRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/hello'\n    | '/asdf'\n    | '/asdf/$id'\n    | '/asdf/foo'\n    | '/asdf/baz'\n    | '/asdf/about'\n    | '/asdf/xyz'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/hello'\n    | '/asdf'\n    | '/asdf/$id'\n    | '/asdf/foo'\n    | '/asdf/baz'\n    | '/asdf/about'\n    | '/asdf/xyz'\n  id:\n    | '__root__'\n    | '/(bar)/_bar'\n    | '/(bar)/_bar/hello'\n    | '/(foo)/asdf/_layout'\n    | '/(foo)/asdf/(another-group)/_layout'\n    | '/(foo)/asdf/(bar)/$id'\n    | '/(foo)/asdf/_layout/foo'\n    | '/(foo)/asdf/(another-group)/_layout/baz'\n    | '/(foo)/asdf/(bar)/_layout/about'\n    | '/(foo)/asdf/(bar)/_layout/xyz'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  barBarRoute: typeof barBarRouteWithChildren\n  fooAsdfLayoutRoute: typeof fooAsdfLayoutRouteWithChildren\n  fooAsdfanotherGroupLayoutRoute: typeof fooAsdfanotherGroupLayoutRouteWithChildren\n  fooAsdfbarIdRoute: typeof fooAsdfbarIdRoute\n  fooAsdfbarLayoutAboutRoute: typeof fooAsdfbarLayoutAboutRoute\n  fooAsdfbarLayoutXyzLazyRoute: typeof fooAsdfbarLayoutXyzLazyRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/(bar)/_bar': {\n      id: '/(bar)/_bar'\n      path: ''\n      fullPath: ''\n      preLoaderRoute: typeof barBarRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(foo)/asdf/_layout': {\n      id: '/(foo)/asdf/_layout'\n      path: '/asdf'\n      fullPath: '/asdf'\n      preLoaderRoute: typeof fooAsdfLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(bar)/_bar/hello': {\n      id: '/(bar)/_bar/hello'\n      path: '/hello'\n      fullPath: '/hello'\n      preLoaderRoute: typeof barBarHelloRouteImport\n      parentRoute: typeof barBarRoute\n    }\n    '/(foo)/asdf/_layout/foo': {\n      id: '/(foo)/asdf/_layout/foo'\n      path: '/foo'\n      fullPath: '/asdf/foo'\n      preLoaderRoute: typeof fooAsdfLayoutFooRouteImport\n      parentRoute: typeof fooAsdfLayoutRoute\n    }\n    '/(foo)/asdf/(bar)/$id': {\n      id: '/(foo)/asdf/(bar)/$id'\n      path: '/asdf/$id'\n      fullPath: '/asdf/$id'\n      preLoaderRoute: typeof fooAsdfbarIdRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(foo)/asdf/(another-group)/_layout': {\n      id: '/(foo)/asdf/(another-group)/_layout'\n      path: '/asdf'\n      fullPath: '/asdf'\n      preLoaderRoute: typeof fooAsdfanotherGroupLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(foo)/asdf/(bar)/_layout/xyz': {\n      id: '/(foo)/asdf/(bar)/_layout/xyz'\n      path: '/asdf/xyz'\n      fullPath: '/asdf/xyz'\n      preLoaderRoute: typeof fooAsdfbarLayoutXyzLazyRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(foo)/asdf/(bar)/_layout/about': {\n      id: '/(foo)/asdf/(bar)/_layout/about'\n      path: '/asdf/about'\n      fullPath: '/asdf/about'\n      preLoaderRoute: typeof fooAsdfbarLayoutAboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/(foo)/asdf/(another-group)/_layout/baz': {\n      id: '/(foo)/asdf/(another-group)/_layout/baz'\n      path: '/baz'\n      fullPath: '/asdf/baz'\n      preLoaderRoute: typeof fooAsdfanotherGroupLayoutBazRouteImport\n      parentRoute: typeof fooAsdfanotherGroupLayoutRoute\n    }\n  }\n}\n\ninterface barBarRouteChildren {\n  barBarHelloRoute: typeof barBarHelloRoute\n}\n\nconst barBarRouteChildren: barBarRouteChildren = {\n  barBarHelloRoute: barBarHelloRoute,\n}\n\nconst barBarRouteWithChildren =\n  barBarRoute._addFileChildren(barBarRouteChildren)\n\ninterface fooAsdfLayoutRouteChildren {\n  fooAsdfLayoutFooRoute: typeof fooAsdfLayoutFooRoute\n}\n\nconst fooAsdfLayoutRouteChildren: fooAsdfLayoutRouteChildren = {\n  fooAsdfLayoutFooRoute: fooAsdfLayoutFooRoute,\n}\n\nconst fooAsdfLayoutRouteWithChildren = fooAsdfLayoutRoute._addFileChildren(\n  fooAsdfLayoutRouteChildren,\n)\n\ninterface fooAsdfanotherGroupLayoutRouteChildren {\n  fooAsdfanotherGroupLayoutBazRoute: typeof fooAsdfanotherGroupLayoutBazRoute\n}\n\nconst fooAsdfanotherGroupLayoutRouteChildren: fooAsdfanotherGroupLayoutRouteChildren =\n  {\n    fooAsdfanotherGroupLayoutBazRoute: fooAsdfanotherGroupLayoutBazRoute,\n  }\n\nconst fooAsdfanotherGroupLayoutRouteWithChildren =\n  fooAsdfanotherGroupLayoutRoute._addFileChildren(\n    fooAsdfanotherGroupLayoutRouteChildren,\n  )\n\nconst rootRouteChildren: RootRouteChildren = {\n  barBarRoute: barBarRouteWithChildren,\n  fooAsdfLayoutRoute: fooAsdfLayoutRouteWithChildren,\n  fooAsdfanotherGroupLayoutRoute: fooAsdfanotherGroupLayoutRouteWithChildren,\n  fooAsdfbarIdRoute: fooAsdfbarIdRoute,\n  fooAsdfbarLayoutAboutRoute: fooAsdfbarLayoutAboutRoute,\n  fooAsdfbarLayoutXyzLazyRoute: fooAsdfbarLayoutXyzLazyRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(bar)/_bar.hello.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(bar)/_bar/hello')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(foo)/_bar/hello\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(bar)/_bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/(bar)/_bar')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/(foo)/_bar/hello\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(another-group)/_layout.baz.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(foo)/asdf/(another-group)/_layout/baz')(\n  {\n    component: () => <div>Hello /(foo)/asdf/(another-group)/_layout/baz!</div>,\n  },\n)\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(another-group)/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(foo)/asdf/(another-group)/_layout')({\n  component: () => <div>Hello /(foo)/asdf/(another-group)/_layout!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/$id.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(foo)/asdf/(bar)/$id')({\n  component: () => <div>Hello /(foo)/asdf/(bar)/$id!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/_layout.about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(foo)/asdf/(bar)/_layout/about')({\n  component: () => <div>Hello /(foo)/asdf/(bar)/_layout/about!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/(bar)/_layout.xyz.lazy.tsx",
    "content": "import { createLazyFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n\nexport const Route = createLazyFileRoute('/(foo)/asdf/(bar)/_layout/xyz')({\n  component: () => <div>Hello /(foo)/asdf/(bar)/_layout/xyz!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/_layout.foo.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(foo)/asdf/_layout/foo')({\n  component: () => <div>Hello /(foo)/asdf/_layout/foo!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/(foo)/asdf/_layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/(foo)/asdf/_layout')({\n  component: () => <div>Hello /(foo)/asdf/_layout!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/route-groups/routes/__root.tsx",
    "content": "/** */\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFileIgnore/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as BlogRouteRouteImport } from './routes/blog.route'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst BlogRouteRoute = BlogRouteRouteImport.update({\n  id: '/blog',\n  path: '/blog',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/blog'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/blog'\n  id: '__root__' | '/' | '/blog'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  BlogRouteRoute: typeof BlogRouteRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/blog': {\n      id: '/blog'\n      path: '/blog'\n      fullPath: '/blog'\n      preLoaderRoute: typeof BlogRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  BlogRouteRoute: BlogRouteRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFileIgnore/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFileIgnore/routes/blog.ignoredPattern.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// @ts-expect-error - we deliberately testing route that should not be created\nexport const Route = createFileRoute('/blog/ignoredPattern')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFileIgnore/routes/blog.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFileIgnore/routes/imIgnored.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// @ts-expect-error - we deliberately testing route that should not be created\nexport const Route = createFileRoute('/imIgnored')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFileIgnore/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFilePrefix/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/r&__root'\nimport { Route as BlogRouteRouteImport } from './routes/r&blog.route'\nimport { Route as IndexRouteImport } from './routes/r&index'\n\nconst BlogRouteRoute = BlogRouteRouteImport.update({\n  id: '/blog',\n  path: '/blog',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/blog': typeof BlogRouteRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/blog'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/blog'\n  id: '__root__' | '/' | '/blog'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  BlogRouteRoute: typeof BlogRouteRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/blog': {\n      id: '/blog'\n      path: '/blog'\n      fullPath: '/blog'\n      preLoaderRoute: typeof BlogRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  BlogRouteRoute: BlogRouteRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFilePrefix/routes/imNotIncluded.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\n// @ts-expect-error - we deliberately testing route that should not be created\nexport const Route = createFileRoute('/imNotIncluded')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFilePrefix/routes/r&__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFilePrefix/routes/r&blog.ignoredPattern.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// @ts-nocheck\n// @ts-expect-error - we deliberately testing route that should not be created\nexport const Route = createFileRoute('/blog/ignoredPattern')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFilePrefix/routes/r&blog.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/blog')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/routeFilePrefix/routes/r&index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/single-level/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/posts': typeof PostsRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts'\n  id: '__root__' | '/' | '/posts'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  PostsRoute: typeof PostsRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/posts': {\n      id: '/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof PostsRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/single-level/routes/__root.tsx",
    "content": "// @ts-nocheck\nexport const Route = createFileRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/single-level/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/single-level/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n// @ts-nocheck\nexport const Route = createFileRoute('/posts')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/types-disabled/routeTree.snapshot.js",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as PostsRouteImport } from './routes/posts'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as UsersUserIdRouteImport } from './routes/users.$userId'\nimport { Route as PostsPostIdRouteImport } from './routes/posts/$postId'\n\nconst PostsRoute = PostsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => rootRouteImport,\n})\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n})\nconst UsersUserIdRoute = UsersUserIdRouteImport.update({\n  id: '/users/$userId',\n  path: '/users/$userId',\n  getParentRoute: () => rootRouteImport,\n})\nconst PostsPostIdRoute = PostsPostIdRouteImport.update({\n  id: '/$postId',\n  path: '/$postId',\n  getParentRoute: () => PostsRoute,\n})\n\nconst PostsRouteChildren = {\n  PostsPostIdRoute: PostsPostIdRoute,\n}\n\nconst PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren)\n\nconst rootRouteChildren = {\n  IndexRoute: IndexRoute,\n  PostsRoute: PostsRouteWithChildren,\n  UsersUserIdRoute: UsersUserIdRoute,\n}\nexport const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)\n"
  },
  {
    "path": "packages/router-generator/tests/generator/types-disabled/routes/__root.tsx",
    "content": "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/types-disabled/routes/index.tsx",
    "content": "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/types-disabled/routes/posts/$postId.tsx",
    "content": "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts/$postId')({\n  component: () => <div>Hello /posts/$postId!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/types-disabled/routes/posts.tsx",
    "content": "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/posts')({\n  component: () => <div>Hello /posts!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/types-disabled/routes/users.$userId.tsx",
    "content": "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/users/$userId')({\n  component: () => <div>Hello /users/$userId!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as layoutRouteImport } from './routes/layout'\nimport { Route as indexRouteImport } from './routes/index'\nimport { Route as dbDashboardRouteImport } from './routes/db/dashboard'\nimport { Route as pagesRouteImport } from './routes/pages'\nimport { Route as HelloIndexRouteImport } from './routes/subtree/index'\nimport { Route as dbDashboardInvoicesRouteImport } from './routes/db/dashboard-invoices'\nimport { Route as dbDashboardIndexRouteImport } from './routes/db/dashboard-index'\nimport { Route as HelloFooIndexRouteImport } from './routes/subtree/foo/index'\nimport { Route as HelloFooIdRouteImport } from './routes/subtree/foo/$id'\nimport { Route as dbInvoiceDetailRouteImport } from './routes/db/invoice-detail'\nimport { Route as dbInvoicesIndexRouteImport } from './routes/db/invoices-index'\n\nconst layoutRoute = layoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst indexRoute = indexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst dbDashboardRoute = dbDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst pagesRoute = pagesRouteImport.update({\n  id: '/$lang/',\n  path: '/$lang/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst HelloIndexRoute = HelloIndexRouteImport.update({\n  id: '/hello/',\n  path: '/hello/',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst dbDashboardInvoicesRoute = dbDashboardInvoicesRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => dbDashboardRoute,\n} as any)\nconst dbDashboardIndexRoute = dbDashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => dbDashboardRoute,\n} as any)\nconst HelloFooIndexRoute = HelloFooIndexRouteImport.update({\n  id: '/hello/foo/',\n  path: '/hello/foo/',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst HelloFooIdRoute = HelloFooIdRouteImport.update({\n  id: '/hello/foo/$id',\n  path: '/hello/foo/$id',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst dbInvoiceDetailRoute = dbInvoiceDetailRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => dbDashboardInvoicesRoute,\n} as any)\nconst dbInvoicesIndexRoute = dbInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => dbDashboardInvoicesRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof indexRoute\n  '/$lang/': typeof pagesRoute\n  '/dashboard': typeof dbDashboardRouteWithChildren\n  '/dashboard/': typeof dbDashboardIndexRoute\n  '/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren\n  '/hello/': typeof HelloIndexRoute\n  '/dashboard/invoices/': typeof dbInvoicesIndexRoute\n  '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/hello/foo/$id': typeof HelloFooIdRoute\n  '/hello/foo/': typeof HelloFooIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof indexRoute\n  '/$lang': typeof pagesRoute\n  '/dashboard': typeof dbDashboardIndexRoute\n  '/hello': typeof HelloIndexRoute\n  '/dashboard/invoices': typeof dbInvoicesIndexRoute\n  '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/hello/foo/$id': typeof HelloFooIdRoute\n  '/hello/foo': typeof HelloFooIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof indexRoute\n  '/_layout': typeof layoutRouteWithChildren\n  '/$lang/': typeof pagesRoute\n  '/_layout/dashboard': typeof dbDashboardRouteWithChildren\n  '/_layout/dashboard/': typeof dbDashboardIndexRoute\n  '/_layout/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren\n  '/_layout/hello/': typeof HelloIndexRoute\n  '/_layout/dashboard/invoices/': typeof dbInvoicesIndexRoute\n  '/_layout/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/_layout/hello/foo/$id': typeof HelloFooIdRoute\n  '/_layout/hello/foo/': typeof HelloFooIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/$lang/'\n    | '/dashboard'\n    | '/dashboard/'\n    | '/dashboard/invoices'\n    | '/hello/'\n    | '/dashboard/invoices/'\n    | '/dashboard/invoices/$id'\n    | '/hello/foo/$id'\n    | '/hello/foo/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/$lang'\n    | '/dashboard'\n    | '/hello'\n    | '/dashboard/invoices'\n    | '/dashboard/invoices/$id'\n    | '/hello/foo/$id'\n    | '/hello/foo'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/$lang/'\n    | '/_layout/dashboard'\n    | '/_layout/dashboard/'\n    | '/_layout/dashboard/invoices'\n    | '/_layout/hello/'\n    | '/_layout/dashboard/invoices/'\n    | '/_layout/dashboard/invoices/$id'\n    | '/_layout/hello/foo/$id'\n    | '/_layout/hello/foo/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  indexRoute: typeof indexRoute\n  layoutRoute: typeof layoutRouteWithChildren\n  pagesRoute: typeof pagesRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof indexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/dashboard': {\n      id: '/_layout/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof dbDashboardRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/$lang/': {\n      id: '/$lang/'\n      path: '/$lang'\n      fullPath: '/$lang/'\n      preLoaderRoute: typeof pagesRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/hello/': {\n      id: '/_layout/hello/'\n      path: '/hello'\n      fullPath: '/hello/'\n      preLoaderRoute: typeof HelloIndexRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/dashboard/invoices': {\n      id: '/_layout/dashboard/invoices'\n      path: '/invoices'\n      fullPath: '/dashboard/invoices'\n      preLoaderRoute: typeof dbDashboardInvoicesRouteImport\n      parentRoute: typeof dbDashboardRoute\n    }\n    '/_layout/dashboard/': {\n      id: '/_layout/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof dbDashboardIndexRouteImport\n      parentRoute: typeof dbDashboardRoute\n    }\n    '/_layout/hello/foo/': {\n      id: '/_layout/hello/foo/'\n      path: '/hello/foo'\n      fullPath: '/hello/foo/'\n      preLoaderRoute: typeof HelloFooIndexRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/hello/foo/$id': {\n      id: '/_layout/hello/foo/$id'\n      path: '/hello/foo/$id'\n      fullPath: '/hello/foo/$id'\n      preLoaderRoute: typeof HelloFooIdRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/dashboard/invoices/$id': {\n      id: '/_layout/dashboard/invoices/$id'\n      path: '/$id'\n      fullPath: '/dashboard/invoices/$id'\n      preLoaderRoute: typeof dbInvoiceDetailRouteImport\n      parentRoute: typeof dbDashboardInvoicesRoute\n    }\n    '/_layout/dashboard/invoices/': {\n      id: '/_layout/dashboard/invoices/'\n      path: '/'\n      fullPath: '/dashboard/invoices/'\n      preLoaderRoute: typeof dbInvoicesIndexRouteImport\n      parentRoute: typeof dbDashboardInvoicesRoute\n    }\n  }\n}\n\ninterface dbDashboardInvoicesRouteChildren {\n  dbInvoicesIndexRoute: typeof dbInvoicesIndexRoute\n  dbInvoiceDetailRoute: typeof dbInvoiceDetailRoute\n}\n\nconst dbDashboardInvoicesRouteChildren: dbDashboardInvoicesRouteChildren = {\n  dbInvoicesIndexRoute: dbInvoicesIndexRoute,\n  dbInvoiceDetailRoute: dbInvoiceDetailRoute,\n}\n\nconst dbDashboardInvoicesRouteWithChildren =\n  dbDashboardInvoicesRoute._addFileChildren(dbDashboardInvoicesRouteChildren)\n\ninterface dbDashboardRouteChildren {\n  dbDashboardIndexRoute: typeof dbDashboardIndexRoute\n  dbDashboardInvoicesRoute: typeof dbDashboardInvoicesRouteWithChildren\n}\n\nconst dbDashboardRouteChildren: dbDashboardRouteChildren = {\n  dbDashboardIndexRoute: dbDashboardIndexRoute,\n  dbDashboardInvoicesRoute: dbDashboardInvoicesRouteWithChildren,\n}\n\nconst dbDashboardRouteWithChildren = dbDashboardRoute._addFileChildren(\n  dbDashboardRouteChildren,\n)\n\ninterface layoutRouteChildren {\n  dbDashboardRoute: typeof dbDashboardRouteWithChildren\n  HelloIndexRoute: typeof HelloIndexRoute\n  HelloFooIdRoute: typeof HelloFooIdRoute\n  HelloFooIndexRoute: typeof HelloFooIndexRoute\n}\n\nconst layoutRouteChildren: layoutRouteChildren = {\n  dbDashboardRoute: dbDashboardRouteWithChildren,\n  HelloIndexRoute: HelloIndexRoute,\n  HelloFooIdRoute: HelloFooIdRoute,\n  HelloFooIndexRoute: HelloFooIndexRoute,\n}\n\nconst layoutRouteWithChildren =\n  layoutRoute._addFileChildren(layoutRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  indexRoute: indexRoute,\n  layoutRoute: layoutRouteWithChildren,\n  pagesRoute: pagesRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/db/dashboard-index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/db/dashboard-invoices.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/db/dashboard.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/db/invoice-detail.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices/$id')({\n  component: () => <div>Hello /_layout/dashboard/invoices/$id!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/db/invoices-index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices/')({\n  component: () => <div>Hello /_layout/dashboard/invoices/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/pages.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/$lang/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/$lang/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/root.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/subtree/foo/$id.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/foo/$id')({\n  component: () => <div>Hello /foo/$id!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/subtree/foo/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/foo/')({\n  component: () => <div>Hello /foo/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual/routes/subtree/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/')({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as layoutRouteImport } from './routes/layout'\nimport { Route as indexRouteImport } from './routes/index'\nimport { Route as dbDashboardRouteImport } from './routes/db/dashboard'\nimport { Route as pagesRouteImport } from './routes/pages'\nimport { Route as HelloIndexRouteImport } from './routes/subtree/index'\nimport { Route as dbDashboardInvoicesRouteImport } from './routes/db/dashboard-invoices'\nimport { Route as dbDashboardIndexRouteImport } from './routes/db/dashboard-index'\nimport { Route as HelloFooIndexRouteImport } from './routes/subtree/foo/index'\nimport { Route as HelloFooIdRouteImport } from './routes/subtree/foo/$id'\nimport { Route as dbInvoiceDetailRouteImport } from './routes/db/invoice-detail'\nimport { Route as dbInvoicesIndexRouteImport } from './routes/db/invoices-index'\n\nconst layoutRoute = layoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst indexRoute = indexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst dbDashboardRoute = dbDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst pagesRoute = pagesRouteImport.update({\n  id: '/$lang/',\n  path: '/$lang/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst HelloIndexRoute = HelloIndexRouteImport.update({\n  id: '/hello/',\n  path: '/hello/',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst dbDashboardInvoicesRoute = dbDashboardInvoicesRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => dbDashboardRoute,\n} as any)\nconst dbDashboardIndexRoute = dbDashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => dbDashboardRoute,\n} as any)\nconst HelloFooIndexRoute = HelloFooIndexRouteImport.update({\n  id: '/hello/foo/',\n  path: '/hello/foo/',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst HelloFooIdRoute = HelloFooIdRouteImport.update({\n  id: '/hello/foo/$id',\n  path: '/hello/foo/$id',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst dbInvoiceDetailRoute = dbInvoiceDetailRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => dbDashboardInvoicesRoute,\n} as any)\nconst dbInvoicesIndexRoute = dbInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => dbDashboardInvoicesRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof indexRoute\n  '/$lang/': typeof pagesRoute\n  '/dashboard': typeof dbDashboardRouteWithChildren\n  '/dashboard/': typeof dbDashboardIndexRoute\n  '/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren\n  '/hello/': typeof HelloIndexRoute\n  '/dashboard/invoices/': typeof dbInvoicesIndexRoute\n  '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/hello/foo/$id': typeof HelloFooIdRoute\n  '/hello/foo/': typeof HelloFooIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof indexRoute\n  '/$lang': typeof pagesRoute\n  '/dashboard': typeof dbDashboardIndexRoute\n  '/hello': typeof HelloIndexRoute\n  '/dashboard/invoices': typeof dbInvoicesIndexRoute\n  '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/hello/foo/$id': typeof HelloFooIdRoute\n  '/hello/foo': typeof HelloFooIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof indexRoute\n  '/_layout': typeof layoutRouteWithChildren\n  '/$lang/': typeof pagesRoute\n  '/_layout/dashboard': typeof dbDashboardRouteWithChildren\n  '/_layout/dashboard/': typeof dbDashboardIndexRoute\n  '/_layout/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren\n  '/_layout/hello/': typeof HelloIndexRoute\n  '/_layout/dashboard/invoices/': typeof dbInvoicesIndexRoute\n  '/_layout/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/_layout/hello/foo/$id': typeof HelloFooIdRoute\n  '/_layout/hello/foo/': typeof HelloFooIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/$lang/'\n    | '/dashboard'\n    | '/dashboard/'\n    | '/dashboard/invoices'\n    | '/hello/'\n    | '/dashboard/invoices/'\n    | '/dashboard/invoices/$id'\n    | '/hello/foo/$id'\n    | '/hello/foo/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/$lang'\n    | '/dashboard'\n    | '/hello'\n    | '/dashboard/invoices'\n    | '/dashboard/invoices/$id'\n    | '/hello/foo/$id'\n    | '/hello/foo'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/$lang/'\n    | '/_layout/dashboard'\n    | '/_layout/dashboard/'\n    | '/_layout/dashboard/invoices'\n    | '/_layout/hello/'\n    | '/_layout/dashboard/invoices/'\n    | '/_layout/dashboard/invoices/$id'\n    | '/_layout/hello/foo/$id'\n    | '/_layout/hello/foo/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  indexRoute: typeof indexRoute\n  layoutRoute: typeof layoutRouteWithChildren\n  pagesRoute: typeof pagesRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof indexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/dashboard': {\n      id: '/_layout/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof dbDashboardRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/$lang/': {\n      id: '/$lang/'\n      path: '/$lang'\n      fullPath: '/$lang/'\n      preLoaderRoute: typeof pagesRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/hello/': {\n      id: '/_layout/hello/'\n      path: '/hello'\n      fullPath: '/hello/'\n      preLoaderRoute: typeof HelloIndexRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/dashboard/invoices': {\n      id: '/_layout/dashboard/invoices'\n      path: '/invoices'\n      fullPath: '/dashboard/invoices'\n      preLoaderRoute: typeof dbDashboardInvoicesRouteImport\n      parentRoute: typeof dbDashboardRoute\n    }\n    '/_layout/dashboard/': {\n      id: '/_layout/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof dbDashboardIndexRouteImport\n      parentRoute: typeof dbDashboardRoute\n    }\n    '/_layout/hello/foo/': {\n      id: '/_layout/hello/foo/'\n      path: '/hello/foo'\n      fullPath: '/hello/foo/'\n      preLoaderRoute: typeof HelloFooIndexRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/hello/foo/$id': {\n      id: '/_layout/hello/foo/$id'\n      path: '/hello/foo/$id'\n      fullPath: '/hello/foo/$id'\n      preLoaderRoute: typeof HelloFooIdRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/dashboard/invoices/$id': {\n      id: '/_layout/dashboard/invoices/$id'\n      path: '/$id'\n      fullPath: '/dashboard/invoices/$id'\n      preLoaderRoute: typeof dbInvoiceDetailRouteImport\n      parentRoute: typeof dbDashboardInvoicesRoute\n    }\n    '/_layout/dashboard/invoices/': {\n      id: '/_layout/dashboard/invoices/'\n      path: '/'\n      fullPath: '/dashboard/invoices/'\n      preLoaderRoute: typeof dbInvoicesIndexRouteImport\n      parentRoute: typeof dbDashboardInvoicesRoute\n    }\n  }\n}\n\ninterface dbDashboardInvoicesRouteChildren {\n  dbInvoicesIndexRoute: typeof dbInvoicesIndexRoute\n  dbInvoiceDetailRoute: typeof dbInvoiceDetailRoute\n}\n\nconst dbDashboardInvoicesRouteChildren: dbDashboardInvoicesRouteChildren = {\n  dbInvoicesIndexRoute: dbInvoicesIndexRoute,\n  dbInvoiceDetailRoute: dbInvoiceDetailRoute,\n}\n\nconst dbDashboardInvoicesRouteWithChildren =\n  dbDashboardInvoicesRoute._addFileChildren(dbDashboardInvoicesRouteChildren)\n\ninterface dbDashboardRouteChildren {\n  dbDashboardIndexRoute: typeof dbDashboardIndexRoute\n  dbDashboardInvoicesRoute: typeof dbDashboardInvoicesRouteWithChildren\n}\n\nconst dbDashboardRouteChildren: dbDashboardRouteChildren = {\n  dbDashboardIndexRoute: dbDashboardIndexRoute,\n  dbDashboardInvoicesRoute: dbDashboardInvoicesRouteWithChildren,\n}\n\nconst dbDashboardRouteWithChildren = dbDashboardRoute._addFileChildren(\n  dbDashboardRouteChildren,\n)\n\ninterface layoutRouteChildren {\n  dbDashboardRoute: typeof dbDashboardRouteWithChildren\n  HelloIndexRoute: typeof HelloIndexRoute\n  HelloFooIdRoute: typeof HelloFooIdRoute\n  HelloFooIndexRoute: typeof HelloFooIndexRoute\n}\n\nconst layoutRouteChildren: layoutRouteChildren = {\n  dbDashboardRoute: dbDashboardRouteWithChildren,\n  HelloIndexRoute: HelloIndexRoute,\n  HelloFooIdRoute: HelloFooIdRoute,\n  HelloFooIndexRoute: HelloFooIndexRoute,\n}\n\nconst layoutRouteWithChildren =\n  layoutRoute._addFileChildren(layoutRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  indexRoute: indexRoute,\n  layoutRoute: layoutRouteWithChildren,\n  pagesRoute: pagesRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/db/dashboard-index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/db/dashboard-invoices.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/db/dashboard.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/db/invoice-detail.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices/$id')({\n  component: () => <div>Hello /_layout/dashboard/invoices/$id!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/db/invoices-index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices/')({\n  component: () => <div>Hello /_layout/dashboard/invoices/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/pages.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/$lang/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/$lang/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/root.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/subtree/foo/$id.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/foo/$id')({\n  component: () => <div>Hello /foo/$id!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/subtree/foo/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/foo/')({\n  component: () => <div>Hello /foo/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes/subtree/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/')({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport default rootRoute('root.tsx', [\n  index('index.tsx'),\n  route('$lang', [index('pages.tsx')]),\n  layout('layout.tsx', [\n    route('/dashboard', 'db/dashboard.tsx', [\n      index('db/dashboard-index.tsx'),\n      route('/invoices', 'db/dashboard-invoices.tsx', [\n        index('db/invoices-index.tsx'),\n        route('$id', 'db/invoice-detail.tsx'),\n      ]),\n    ]),\n    physical('/hello', 'subtree'),\n  ]),\n])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-default-export/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./routes\",\n  \"generatedRouteTree\": \"./routeTree.gen.ts\",\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/root'\nimport { Route as layoutRouteImport } from './routes/layout'\nimport { Route as indexRouteImport } from './routes/index'\nimport { Route as dbDashboardRouteImport } from './routes/db/dashboard'\nimport { Route as pagesRouteImport } from './routes/pages'\nimport { Route as HelloIndexRouteImport } from './routes/subtree/index'\nimport { Route as dbDashboardInvoicesRouteImport } from './routes/db/dashboard-invoices'\nimport { Route as dbDashboardIndexRouteImport } from './routes/db/dashboard-index'\nimport { Route as HelloFooIndexRouteImport } from './routes/subtree/foo/index'\nimport { Route as HelloFooIdRouteImport } from './routes/subtree/foo/$id'\nimport { Route as dbInvoiceDetailRouteImport } from './routes/db/invoice-detail'\nimport { Route as dbInvoicesIndexRouteImport } from './routes/db/invoices-index'\n\nconst layoutRoute = layoutRouteImport.update({\n  id: '/_layout',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst indexRoute = indexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst dbDashboardRoute = dbDashboardRouteImport.update({\n  id: '/dashboard',\n  path: '/dashboard',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst pagesRoute = pagesRouteImport.update({\n  id: '/$lang/',\n  path: '/$lang/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst HelloIndexRoute = HelloIndexRouteImport.update({\n  id: '/hello/',\n  path: '/hello/',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst dbDashboardInvoicesRoute = dbDashboardInvoicesRouteImport.update({\n  id: '/invoices',\n  path: '/invoices',\n  getParentRoute: () => dbDashboardRoute,\n} as any)\nconst dbDashboardIndexRoute = dbDashboardIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => dbDashboardRoute,\n} as any)\nconst HelloFooIndexRoute = HelloFooIndexRouteImport.update({\n  id: '/hello/foo/',\n  path: '/hello/foo/',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst HelloFooIdRoute = HelloFooIdRouteImport.update({\n  id: '/hello/foo/$id',\n  path: '/hello/foo/$id',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst dbInvoiceDetailRoute = dbInvoiceDetailRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => dbDashboardInvoicesRoute,\n} as any)\nconst dbInvoicesIndexRoute = dbInvoicesIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => dbDashboardInvoicesRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof indexRoute\n  '/$lang/': typeof pagesRoute\n  '/dashboard': typeof dbDashboardRouteWithChildren\n  '/dashboard/': typeof dbDashboardIndexRoute\n  '/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren\n  '/hello/': typeof HelloIndexRoute\n  '/dashboard/invoices/': typeof dbInvoicesIndexRoute\n  '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/hello/foo/$id': typeof HelloFooIdRoute\n  '/hello/foo/': typeof HelloFooIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof indexRoute\n  '/$lang': typeof pagesRoute\n  '/dashboard': typeof dbDashboardIndexRoute\n  '/hello': typeof HelloIndexRoute\n  '/dashboard/invoices': typeof dbInvoicesIndexRoute\n  '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/hello/foo/$id': typeof HelloFooIdRoute\n  '/hello/foo': typeof HelloFooIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof indexRoute\n  '/_layout': typeof layoutRouteWithChildren\n  '/$lang/': typeof pagesRoute\n  '/_layout/dashboard': typeof dbDashboardRouteWithChildren\n  '/_layout/dashboard/': typeof dbDashboardIndexRoute\n  '/_layout/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren\n  '/_layout/hello/': typeof HelloIndexRoute\n  '/_layout/dashboard/invoices/': typeof dbInvoicesIndexRoute\n  '/_layout/dashboard/invoices/$id': typeof dbInvoiceDetailRoute\n  '/_layout/hello/foo/$id': typeof HelloFooIdRoute\n  '/_layout/hello/foo/': typeof HelloFooIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/$lang/'\n    | '/dashboard'\n    | '/dashboard/'\n    | '/dashboard/invoices'\n    | '/hello/'\n    | '/dashboard/invoices/'\n    | '/dashboard/invoices/$id'\n    | '/hello/foo/$id'\n    | '/hello/foo/'\n  fileRoutesByTo: FileRoutesByTo\n  to:\n    | '/'\n    | '/$lang'\n    | '/dashboard'\n    | '/hello'\n    | '/dashboard/invoices'\n    | '/dashboard/invoices/$id'\n    | '/hello/foo/$id'\n    | '/hello/foo'\n  id:\n    | '__root__'\n    | '/'\n    | '/_layout'\n    | '/$lang/'\n    | '/_layout/dashboard'\n    | '/_layout/dashboard/'\n    | '/_layout/dashboard/invoices'\n    | '/_layout/hello/'\n    | '/_layout/dashboard/invoices/'\n    | '/_layout/dashboard/invoices/$id'\n    | '/_layout/hello/foo/$id'\n    | '/_layout/hello/foo/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  indexRoute: typeof indexRoute\n  layoutRoute: typeof layoutRouteWithChildren\n  pagesRoute: typeof pagesRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_layout': {\n      id: '/_layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof indexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/dashboard': {\n      id: '/_layout/dashboard'\n      path: '/dashboard'\n      fullPath: '/dashboard'\n      preLoaderRoute: typeof dbDashboardRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/$lang/': {\n      id: '/$lang/'\n      path: '/$lang'\n      fullPath: '/$lang/'\n      preLoaderRoute: typeof pagesRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_layout/hello/': {\n      id: '/_layout/hello/'\n      path: '/hello'\n      fullPath: '/hello/'\n      preLoaderRoute: typeof HelloIndexRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/dashboard/invoices': {\n      id: '/_layout/dashboard/invoices'\n      path: '/invoices'\n      fullPath: '/dashboard/invoices'\n      preLoaderRoute: typeof dbDashboardInvoicesRouteImport\n      parentRoute: typeof dbDashboardRoute\n    }\n    '/_layout/dashboard/': {\n      id: '/_layout/dashboard/'\n      path: '/'\n      fullPath: '/dashboard/'\n      preLoaderRoute: typeof dbDashboardIndexRouteImport\n      parentRoute: typeof dbDashboardRoute\n    }\n    '/_layout/hello/foo/': {\n      id: '/_layout/hello/foo/'\n      path: '/hello/foo'\n      fullPath: '/hello/foo/'\n      preLoaderRoute: typeof HelloFooIndexRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/hello/foo/$id': {\n      id: '/_layout/hello/foo/$id'\n      path: '/hello/foo/$id'\n      fullPath: '/hello/foo/$id'\n      preLoaderRoute: typeof HelloFooIdRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_layout/dashboard/invoices/$id': {\n      id: '/_layout/dashboard/invoices/$id'\n      path: '/$id'\n      fullPath: '/dashboard/invoices/$id'\n      preLoaderRoute: typeof dbInvoiceDetailRouteImport\n      parentRoute: typeof dbDashboardInvoicesRoute\n    }\n    '/_layout/dashboard/invoices/': {\n      id: '/_layout/dashboard/invoices/'\n      path: '/'\n      fullPath: '/dashboard/invoices/'\n      preLoaderRoute: typeof dbInvoicesIndexRouteImport\n      parentRoute: typeof dbDashboardInvoicesRoute\n    }\n  }\n}\n\ninterface dbDashboardInvoicesRouteChildren {\n  dbInvoicesIndexRoute: typeof dbInvoicesIndexRoute\n  dbInvoiceDetailRoute: typeof dbInvoiceDetailRoute\n}\n\nconst dbDashboardInvoicesRouteChildren: dbDashboardInvoicesRouteChildren = {\n  dbInvoicesIndexRoute: dbInvoicesIndexRoute,\n  dbInvoiceDetailRoute: dbInvoiceDetailRoute,\n}\n\nconst dbDashboardInvoicesRouteWithChildren =\n  dbDashboardInvoicesRoute._addFileChildren(dbDashboardInvoicesRouteChildren)\n\ninterface dbDashboardRouteChildren {\n  dbDashboardIndexRoute: typeof dbDashboardIndexRoute\n  dbDashboardInvoicesRoute: typeof dbDashboardInvoicesRouteWithChildren\n}\n\nconst dbDashboardRouteChildren: dbDashboardRouteChildren = {\n  dbDashboardIndexRoute: dbDashboardIndexRoute,\n  dbDashboardInvoicesRoute: dbDashboardInvoicesRouteWithChildren,\n}\n\nconst dbDashboardRouteWithChildren = dbDashboardRoute._addFileChildren(\n  dbDashboardRouteChildren,\n)\n\ninterface layoutRouteChildren {\n  dbDashboardRoute: typeof dbDashboardRouteWithChildren\n  HelloIndexRoute: typeof HelloIndexRoute\n  HelloFooIdRoute: typeof HelloFooIdRoute\n  HelloFooIndexRoute: typeof HelloFooIndexRoute\n}\n\nconst layoutRouteChildren: layoutRouteChildren = {\n  dbDashboardRoute: dbDashboardRouteWithChildren,\n  HelloIndexRoute: HelloIndexRoute,\n  HelloFooIdRoute: HelloFooIdRoute,\n  HelloFooIndexRoute: HelloFooIndexRoute,\n}\n\nconst layoutRouteWithChildren =\n  layoutRoute._addFileChildren(layoutRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  indexRoute: indexRoute,\n  layoutRoute: layoutRouteWithChildren,\n  pagesRoute: pagesRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/db/dashboard-index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/db/dashboard-invoices.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/db/dashboard.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/db/invoice-detail.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices/$id')({\n  component: () => <div>Hello /_layout/dashboard/invoices/$id!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/db/invoices-index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/dashboard/invoices/')({\n  component: () => <div>Hello /_layout/dashboard/invoices/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/pages.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport * as React from 'react'\n\nexport const Route = createFileRoute('/$lang/')({\n  component: RouteComponent,\n})\n\nfunction RouteComponent() {\n  return <div>Hello \"/$lang/\"!</div>\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/root.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello !</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/subtree/foo/$id.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/foo/$id')({\n  component: () => <div>Hello /foo/$id!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/subtree/foo/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/foo/')({\n  component: () => <div>Hello /foo/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes/subtree/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/_layout/hello/')({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/routes.ts",
    "content": "import {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('root.tsx', [\n  index('index.tsx'),\n  route('$lang', [index('pages.tsx')]),\n  layout('layout.tsx', [\n    route('/dashboard', 'db/dashboard.tsx', [\n      index('db/dashboard-index.tsx'),\n      route('/invoices', 'db/dashboard-invoices.tsx', [\n        index('db/invoices-index.tsx'),\n        route('$id', 'db/invoice-detail.tsx'),\n      ]),\n    ]),\n    physical('/hello', 'subtree'),\n  ]),\n])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-config-file-named-export/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./routes\",\n  \"generatedRouteTree\": \"./routeTree.gen.ts\",\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-nested/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as FooBarRouteImport } from './routes/foo/bar'\nimport { Route as fooBarDetailsRouteImport } from './routes/foo/bar/details'\nimport { Route as fooBarHomeRouteImport } from './routes/foo/bar/home'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FooBarRoute = FooBarRouteImport.update({\n  id: '/foo/bar',\n  path: '/foo/bar',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst fooBarDetailsRoute = fooBarDetailsRouteImport.update({\n  id: '/$id',\n  path: '/$id',\n  getParentRoute: () => FooBarRoute,\n} as any)\nconst fooBarHomeRoute = fooBarHomeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => FooBarRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/foo/bar': typeof FooBarRouteWithChildren\n  '/foo/bar/': typeof fooBarHomeRoute\n  '/foo/bar/$id': typeof fooBarDetailsRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/foo/bar': typeof fooBarHomeRoute\n  '/foo/bar/$id': typeof fooBarDetailsRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/foo/bar': typeof FooBarRouteWithChildren\n  '/foo/bar/': typeof fooBarHomeRoute\n  '/foo/bar/$id': typeof fooBarDetailsRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/foo/bar' | '/foo/bar/' | '/foo/bar/$id'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/foo/bar' | '/foo/bar/$id'\n  id: '__root__' | '/' | '/foo/bar' | '/foo/bar/' | '/foo/bar/$id'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  FooBarRoute: typeof FooBarRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/foo/bar': {\n      id: '/foo/bar'\n      path: '/foo/bar'\n      fullPath: '/foo/bar'\n      preLoaderRoute: typeof FooBarRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/foo/bar/$id': {\n      id: '/foo/bar/$id'\n      path: '/$id'\n      fullPath: '/foo/bar/$id'\n      preLoaderRoute: typeof fooBarDetailsRouteImport\n      parentRoute: typeof FooBarRoute\n    }\n    '/foo/bar/': {\n      id: '/foo/bar/'\n      path: '/'\n      fullPath: '/foo/bar/'\n      preLoaderRoute: typeof fooBarHomeRouteImport\n      parentRoute: typeof FooBarRoute\n    }\n  }\n}\n\ninterface FooBarRouteChildren {\n  fooBarHomeRoute: typeof fooBarHomeRoute\n  fooBarDetailsRoute: typeof fooBarDetailsRoute\n}\n\nconst FooBarRouteChildren: FooBarRouteChildren = {\n  fooBarHomeRoute: fooBarHomeRoute,\n  fooBarDetailsRoute: fooBarDetailsRoute,\n}\n\nconst FooBarRouteWithChildren =\n  FooBarRoute._addFileChildren(FooBarRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  FooBarRoute: FooBarRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-nested/routes/__root.tsx",
    "content": "import * as React from 'react'\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => (\n    <React.Fragment>\n      <div>Hello \"__root\"!</div>\n      <Outlet />\n    </React.Fragment>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-nested/routes/foo/bar/__virtual.ts",
    "content": "import {\n  defineVirtualSubtreeConfig,\n  index,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport default defineVirtualSubtreeConfig([\n  index('home.tsx'),\n  route('$id', 'details.tsx'),\n])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-nested/routes/foo/bar/details.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/foo/bar/$id')({\n  component: () => <div>Hello /foo/bar/$id!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-nested/routes/foo/bar/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/foo/bar/')({\n  component: () => <div>Hello /foo/bar/!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-nested/routes/foo/bar/route.ts",
    "content": ""
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-nested/routes/foo/bar.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/foo/bar')({\n  component: () => <div>Hello /foo/bar!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-nested/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div>Hello /!</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as IndexRouteImport } from './routes/index'\nimport { Route as nestedCallbackRouteImport } from './routes/nested/callback'\nimport { Route as nestedAuthRouteImport } from './routes/nested/auth'\nimport { Route as nestedHomeRouteImport } from './routes/nested/home'\n\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst nestedCallbackRoute = nestedCallbackRouteImport.update({\n  id: '/nested/_callback',\n  path: '/nested/_callback',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst nestedAuthRoute = nestedAuthRouteImport.update({\n  id: '/nested/_auth',\n  path: '/nested/_auth',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst nestedHomeRoute = nestedHomeRouteImport.update({\n  id: '/nested/',\n  path: '/nested/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/nested/': typeof nestedHomeRoute\n  '/nested/_auth': typeof nestedAuthRoute\n  '/nested/_callback': typeof nestedCallbackRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/nested': typeof nestedHomeRoute\n  '/nested/_auth': typeof nestedAuthRoute\n  '/nested/_callback': typeof nestedCallbackRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/nested/': typeof nestedHomeRoute\n  '/nested/_auth': typeof nestedAuthRoute\n  '/nested/_callback': typeof nestedCallbackRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/nested/' | '/nested/_auth' | '/nested/_callback'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/nested' | '/nested/_auth' | '/nested/_callback'\n  id: '__root__' | '/' | '/nested/' | '/nested/_auth' | '/nested/_callback'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  nestedHomeRoute: typeof nestedHomeRoute\n  nestedAuthRoute: typeof nestedAuthRoute\n  nestedCallbackRoute: typeof nestedCallbackRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/_callback': {\n      id: '/nested/_callback'\n      path: '/nested/_callback'\n      fullPath: '/nested/_callback'\n      preLoaderRoute: typeof nestedCallbackRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/_auth': {\n      id: '/nested/_auth'\n      path: '/nested/_auth'\n      fullPath: '/nested/_auth'\n      preLoaderRoute: typeof nestedAuthRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/nested/': {\n      id: '/nested/'\n      path: '/nested'\n      fullPath: '/nested/'\n      preLoaderRoute: typeof nestedHomeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  nestedHomeRoute: nestedHomeRoute,\n  nestedAuthRoute: nestedAuthRoute,\n  nestedCallbackRoute: nestedCallbackRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/nested/__virtual.ts",
    "content": "import {\n  defineVirtualSubtreeConfig,\n  index,\n  route,\n} from '@tanstack/virtual-file-routes'\n\nexport default defineVirtualSubtreeConfig([\n  index('home.tsx'),\n  route('[_]auth', 'auth.tsx'),\n  route('[_]callback', 'callback.tsx'),\n])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/nested/auth.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/nested/_auth')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/nested/callback.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/nested/_callback')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/nested/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/nested/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout'\nimport { Route as homeRouteImport } from './routes/home'\nimport { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout'\nimport { Route as bRouteImport } from './routes/b'\nimport { Route as aRouteImport } from './routes/a'\n\nconst layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({\n  id: '/_first',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst homeRoute = homeRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({\n  id: '/_second-layout',\n  getParentRoute: () => layoutFirstLayoutRoute,\n} as any)\nconst bRoute = bRouteImport.update({\n  id: '/route-without-file/layout-b',\n  path: '/route-without-file/layout-b',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\nconst aRoute = aRouteImport.update({\n  id: '/route-without-file/layout-a',\n  path: '/route-without-file/layout-a',\n  getParentRoute: () => layoutSecondLayoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof homeRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof homeRoute\n  '/route-without-file/layout-a': typeof aRoute\n  '/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof homeRoute\n  '/_first': typeof layoutFirstLayoutRouteWithChildren\n  '/_first/_second-layout': typeof layoutSecondLayoutRouteWithChildren\n  '/_first/_second-layout/route-without-file/layout-a': typeof aRoute\n  '/_first/_second-layout/route-without-file/layout-b': typeof bRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths:\n    | '/'\n    | '/route-without-file/layout-a'\n    | '/route-without-file/layout-b'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/route-without-file/layout-a' | '/route-without-file/layout-b'\n  id:\n    | '__root__'\n    | '/'\n    | '/_first'\n    | '/_first/_second-layout'\n    | '/_first/_second-layout/route-without-file/layout-a'\n    | '/_first/_second-layout/route-without-file/layout-b'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  homeRoute: typeof homeRoute\n  layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_first': {\n      id: '/_first'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutFirstLayoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof homeRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_first/_second-layout': {\n      id: '/_first/_second-layout'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutSecondLayoutRouteImport\n      parentRoute: typeof layoutFirstLayoutRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-b': {\n      id: '/_first/_second-layout/route-without-file/layout-b'\n      path: '/route-without-file/layout-b'\n      fullPath: '/route-without-file/layout-b'\n      preLoaderRoute: typeof bRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n    '/_first/_second-layout/route-without-file/layout-a': {\n      id: '/_first/_second-layout/route-without-file/layout-a'\n      path: '/route-without-file/layout-a'\n      fullPath: '/route-without-file/layout-a'\n      preLoaderRoute: typeof aRouteImport\n      parentRoute: typeof layoutSecondLayoutRoute\n    }\n  }\n}\n\ninterface layoutSecondLayoutRouteChildren {\n  aRoute: typeof aRoute\n  bRoute: typeof bRoute\n}\n\nconst layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {\n  aRoute: aRoute,\n  bRoute: bRoute,\n}\n\nconst layoutSecondLayoutRouteWithChildren =\n  layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)\n\ninterface layoutFirstLayoutRouteChildren {\n  layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren\n}\n\nconst layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {\n  layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,\n}\n\nconst layoutFirstLayoutRouteWithChildren =\n  layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  homeRoute: homeRoute,\n  layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routes/a.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/_first/_second-layout/route-without-file/layout-a',\n)({\n  component: () => 'Layout A',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routes/b.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute(\n  '/_first/_second-layout/route-without-file/layout-b',\n)({\n  component: () => 'Layout B',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routes/home.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => 'Home',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routes/layout/first-layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_first')({\n  component: () => (\n    <div>\n      <div>First Layout</div>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routes/layout/second-layout.tsx",
    "content": "import { Outlet, createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_first/_second-layout')({\n  component: () => (\n    <div>\n      <div>Second Layout (nested)</div>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-root/routes/__root.tsx",
    "content": "import { createRootRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-root/routes/merged/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Index</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-root/routes/merged/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// This route.tsx in a physical directory mounted at root level\n// conflicts with the virtual root __root.tsx - can't have two root routes\nexport const Route = createFileRoute('')({})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-root/routes.ts",
    "content": "import { physical, rootRoute } from '@tanstack/virtual-file-routes'\n\n// This test verifies that a __root.tsx in a physical directory mounted at root\n// produces a proper conflict error with the virtual root\nexport const routes = rootRoute('__root.tsx', [physical('', 'merged')])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-root/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./routes\",\n  \"generatedRouteTree\": \"./routeTree.gen.ts\",\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-virtual/routes/__root.tsx",
    "content": "import { createRootRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-virtual/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// Virtual about route - conflicts with merged/about.tsx\nexport const Route = createFileRoute('/about')({\n  component: () => <div>About (virtual)</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-virtual/routes/merged/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\n// Physical about route - conflicts with virtual about.tsx -> /about\nexport const Route = createFileRoute('/about')({\n  component: () => <div>About (physical)</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-virtual/routes/merged/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Index</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-virtual/routes.ts",
    "content": "import { physical, rootRoute, route } from '@tanstack/virtual-file-routes'\n\n// This test verifies that a virtual route path conflicts with\n// a physical route path when using empty path prefix\nexport const routes = rootRoute('__root.tsx', [\n  route('/about', 'about.tsx'), // virtual /about\n  physical('', 'merged'), // physical also has about.tsx -> /about\n])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-conflict-virtual/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./routes\",\n  \"generatedRouteTree\": \"./routeTree.gen.ts\",\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-merge/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ContactRouteImport } from './routes/merged/contact'\nimport { Route as aboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/merged/index'\n\nconst ContactRoute = ContactRouteImport.update({\n  id: '/contact',\n  path: '/contact',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst aboutRoute = aboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof aboutRoute\n  '/contact': typeof ContactRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof aboutRoute\n  '/contact': typeof ContactRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof aboutRoute\n  '/contact': typeof ContactRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about' | '/contact'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about' | '/contact'\n  id: '__root__' | '/' | '/about' | '/contact'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  aboutRoute: typeof aboutRoute\n  ContactRoute: typeof ContactRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/contact': {\n      id: '/contact'\n      path: '/contact'\n      fullPath: '/contact'\n      preLoaderRoute: typeof ContactRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof aboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  aboutRoute: aboutRoute,\n  ContactRoute: ContactRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-merge/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-merge/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/about')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-merge/routes/merged/contact.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/contact')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-merge/routes/merged/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-merge/routes.ts",
    "content": "import { physical, rootRoute, route } from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('__root.tsx', [\n  // Virtual route defined here\n  route('/about', 'about.tsx'),\n  // Physical mount with empty path - should merge into root level\n  physical('', 'merged'),\n])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-empty-path-merge/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./routes\",\n  \"generatedRouteTree\": \"./routeTree.gen.ts\",\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-layout-and-index/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as FeatureRouteRouteImport } from './routes/feature/route'\nimport { Route as indexRouteImport } from './routes/index'\nimport { Route as FeatureIndexRouteImport } from './routes/feature/index'\n\nconst FeatureRouteRoute = FeatureRouteRouteImport.update({\n  id: '/feature',\n  path: '/feature',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst indexRoute = indexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst FeatureIndexRoute = FeatureIndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => FeatureRouteRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof indexRoute\n  '/feature': typeof FeatureRouteRouteWithChildren\n  '/feature/': typeof FeatureIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof indexRoute\n  '/feature': typeof FeatureIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof indexRoute\n  '/feature': typeof FeatureRouteRouteWithChildren\n  '/feature/': typeof FeatureIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/feature' | '/feature/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/feature'\n  id: '__root__' | '/' | '/feature' | '/feature/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  indexRoute: typeof indexRoute\n  FeatureRouteRoute: typeof FeatureRouteRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/feature': {\n      id: '/feature'\n      path: '/feature'\n      fullPath: '/feature'\n      preLoaderRoute: typeof FeatureRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof indexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/feature/': {\n      id: '/feature/'\n      path: '/'\n      fullPath: '/feature/'\n      preLoaderRoute: typeof FeatureIndexRouteImport\n      parentRoute: typeof FeatureRouteRoute\n    }\n  }\n}\n\ninterface FeatureRouteRouteChildren {\n  FeatureIndexRoute: typeof FeatureIndexRoute\n}\n\nconst FeatureRouteRouteChildren: FeatureRouteRouteChildren = {\n  FeatureIndexRoute: FeatureIndexRoute,\n}\n\nconst FeatureRouteRouteWithChildren = FeatureRouteRoute._addFileChildren(\n  FeatureRouteRouteChildren,\n)\n\nconst rootRouteChildren: RootRouteChildren = {\n  indexRoute: indexRoute,\n  FeatureRouteRoute: FeatureRouteRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-layout-and-index/routes/__root.tsx",
    "content": "import { createRootRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-layout-and-index/routes/feature/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/feature/')({\n  component: () => <div>Feature Index</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-layout-and-index/routes/feature/route.tsx",
    "content": "import { createFileRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/feature')({\n  component: () => (\n    <div>\n      <h1>Feature Layout</h1>\n      <Outlet />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-layout-and-index/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Home</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-layout-and-index/routes.ts",
    "content": "import { index, physical, rootRoute } from '@tanstack/virtual-file-routes'\n\nexport const routes = rootRoute('__root.tsx', [\n  index('index.tsx'),\n  physical('/feature', 'feature'),\n])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-layout-and-index/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./routes\",\n  \"generatedRouteTree\": \"./routeTree.gen.ts\",\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-no-prefix/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as ContactRouteImport } from './routes/merged/contact'\nimport { Route as aboutRouteImport } from './routes/about'\nimport { Route as IndexRouteImport } from './routes/merged/index'\n\nconst ContactRoute = ContactRouteImport.update({\n  id: '/contact',\n  path: '/contact',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst aboutRoute = aboutRouteImport.update({\n  id: '/about',\n  path: '/about',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst IndexRoute = IndexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof IndexRoute\n  '/about': typeof aboutRoute\n  '/contact': typeof ContactRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof IndexRoute\n  '/about': typeof aboutRoute\n  '/contact': typeof ContactRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof IndexRoute\n  '/about': typeof aboutRoute\n  '/contact': typeof ContactRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/about' | '/contact'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/about' | '/contact'\n  id: '__root__' | '/' | '/about' | '/contact'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  IndexRoute: typeof IndexRoute\n  aboutRoute: typeof aboutRoute\n  ContactRoute: typeof ContactRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/contact': {\n      id: '/contact'\n      path: '/contact'\n      fullPath: '/contact'\n      preLoaderRoute: typeof ContactRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/about': {\n      id: '/about'\n      path: '/about'\n      fullPath: '/about'\n      preLoaderRoute: typeof aboutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof IndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  IndexRoute: IndexRoute,\n  aboutRoute: aboutRoute,\n  ContactRoute: ContactRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-no-prefix/routes/__root.tsx",
    "content": "import { createRootRoute, Outlet } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <Outlet />,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-no-prefix/routes/about.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  component: () => <div>About</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-no-prefix/routes/merged/contact.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/contact')({\n  component: () => <div>Contact</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-no-prefix/routes/merged/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => <div>Index</div>,\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-no-prefix/routes.ts",
    "content": "import { physical, rootRoute, route } from '@tanstack/virtual-file-routes'\n\n// This test verifies the single-argument physical() overload\n// which uses an empty path prefix (merges at current level)\nexport const routes = rootRoute('__root.tsx', [\n  route('/about', 'about.tsx'),\n  physical('merged'), // Single argument - merges at root\n])\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-physical-no-prefix/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./routes\",\n  \"generatedRouteTree\": \"./routeTree.gen.ts\",\n  \"virtualRouteConfig\": \"./routes.ts\"\n}\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-root-sibling-routes/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as deviceRouteRouteImport } from './routes/device/route'\nimport { Route as historyRouteRouteImport } from './routes/history/route'\n\nconst deviceRouteRoute = deviceRouteRouteImport.update({\n  id: '/device/$id',\n  path: '/device/$id',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst historyRouteRoute = historyRouteRouteImport.update({\n  id: '/device/$id/history/$filename',\n  path: '/device/$id/history/$filename',\n  getParentRoute: () => rootRouteImport,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/device/$id': typeof deviceRouteRoute\n  '/device/$id/history/$filename': typeof historyRouteRoute\n}\nexport interface FileRoutesByTo {\n  '/device/$id': typeof deviceRouteRoute\n  '/device/$id/history/$filename': typeof historyRouteRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/device/$id': typeof deviceRouteRoute\n  '/device/$id/history/$filename': typeof historyRouteRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/device/$id' | '/device/$id/history/$filename'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/device/$id' | '/device/$id/history/$filename'\n  id: '__root__' | '/device/$id' | '/device/$id/history/$filename'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  deviceRouteRoute: typeof deviceRouteRoute\n  historyRouteRoute: typeof historyRouteRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/device/$id': {\n      id: '/device/$id'\n      path: '/device/$id'\n      fullPath: '/device/$id'\n      preLoaderRoute: typeof deviceRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/device/$id/history/$filename': {\n      id: '/device/$id/history/$filename'\n      path: '/device/$id/history/$filename'\n      fullPath: '/device/$id/history/$filename'\n      preLoaderRoute: typeof historyRouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  deviceRouteRoute: deviceRouteRoute,\n  historyRouteRoute: historyRouteRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-root-sibling-routes/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-root-sibling-routes/routes/device/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/device/$id')({\n  component: () => 'Device Detail',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-root-sibling-routes/routes/history/route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/device/$id/history/$filename')({\n  component: () => 'Device History',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-sibling-routes/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as layoutRouteImport } from './routes/layout'\nimport { Route as postsRouteImport } from './routes/posts'\nimport { Route as postDetailRouteImport } from './routes/post-detail'\n\nconst layoutRoute = layoutRouteImport.update({\n  id: '/_main',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst postsRoute = postsRouteImport.update({\n  id: '/posts',\n  path: '/posts',\n  getParentRoute: () => layoutRoute,\n} as any)\nconst postDetailRoute = postDetailRouteImport.update({\n  id: '/posts/$id',\n  path: '/posts/$id',\n  getParentRoute: () => layoutRoute,\n} as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof layoutRouteWithChildren\n  '/posts': typeof postsRoute\n  '/posts/$id': typeof postDetailRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof layoutRouteWithChildren\n  '/posts': typeof postsRoute\n  '/posts/$id': typeof postDetailRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/_main': typeof layoutRouteWithChildren\n  '/_main/posts': typeof postsRoute\n  '/_main/posts/$id': typeof postDetailRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/posts' | '/posts/$id'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/posts' | '/posts/$id'\n  id: '__root__' | '/_main' | '/_main/posts' | '/_main/posts/$id'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  layoutRoute: typeof layoutRouteWithChildren\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/_main': {\n      id: '/_main'\n      path: ''\n      fullPath: '/'\n      preLoaderRoute: typeof layoutRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/_main/posts': {\n      id: '/_main/posts'\n      path: '/posts'\n      fullPath: '/posts'\n      preLoaderRoute: typeof postsRouteImport\n      parentRoute: typeof layoutRoute\n    }\n    '/_main/posts/$id': {\n      id: '/_main/posts/$id'\n      path: '/posts/$id'\n      fullPath: '/posts/$id'\n      preLoaderRoute: typeof postDetailRouteImport\n      parentRoute: typeof layoutRoute\n    }\n  }\n}\n\ninterface layoutRouteChildren {\n  postsRoute: typeof postsRoute\n  postDetailRoute: typeof postDetailRoute\n}\n\nconst layoutRouteChildren: layoutRouteChildren = {\n  postsRoute: postsRoute,\n  postDetailRoute: postDetailRoute,\n}\n\nconst layoutRouteWithChildren =\n  layoutRoute._addFileChildren(layoutRouteChildren)\n\nconst rootRouteChildren: RootRouteChildren = {\n  layoutRoute: layoutRouteWithChildren,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-sibling-routes/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-sibling-routes/routes/layout.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_main')({\n  component: () => 'Layout',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-sibling-routes/routes/post-detail.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_main/posts/$id')({\n  component: () => 'Post Detail',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-sibling-routes/routes/posts.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/_main/posts')({\n  component: () => 'Posts List',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-with-escaped-underscore/routeTree.snapshot.ts",
    "content": "/* eslint-disable */\n\n// @ts-nocheck\n\n// noinspection JSUnusedGlobalSymbols\n\n// This file was automatically generated by TanStack Router.\n// You should NOT make any changes in this file as it will be overwritten.\n// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.\n\nimport { Route as rootRouteImport } from './routes/__root'\nimport { Route as indexRouteImport } from './routes/index'\nimport { Route as ApiIndexRouteImport } from './routes/physical-routes/index'\nimport { Route as ApiChar91_Char93helloRouteImport } from './routes/physical-routes/[_]hello'\nimport { Route as ApiChar91_Char93authDotrouteRouteImport } from './routes/physical-routes/[_]auth.route'\n\nconst indexRoute = indexRouteImport.update({\n  id: '/',\n  path: '/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiIndexRoute = ApiIndexRouteImport.update({\n  id: '/api/',\n  path: '/api/',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiChar91_Char93helloRoute = ApiChar91_Char93helloRouteImport.update({\n  id: '/api/_hello',\n  path: '/api/_hello',\n  getParentRoute: () => rootRouteImport,\n} as any)\nconst ApiChar91_Char93authDotrouteRoute =\n  ApiChar91_Char93authDotrouteRouteImport.update({\n    id: '/api/_auth',\n    path: '/api/_auth',\n    getParentRoute: () => rootRouteImport,\n  } as any)\n\nexport interface FileRoutesByFullPath {\n  '/': typeof indexRoute\n  '/api/_auth': typeof ApiChar91_Char93authDotrouteRoute\n  '/api/_hello': typeof ApiChar91_Char93helloRoute\n  '/api/': typeof ApiIndexRoute\n}\nexport interface FileRoutesByTo {\n  '/': typeof indexRoute\n  '/api/_auth': typeof ApiChar91_Char93authDotrouteRoute\n  '/api/_hello': typeof ApiChar91_Char93helloRoute\n  '/api': typeof ApiIndexRoute\n}\nexport interface FileRoutesById {\n  __root__: typeof rootRouteImport\n  '/': typeof indexRoute\n  '/api/_auth': typeof ApiChar91_Char93authDotrouteRoute\n  '/api/_hello': typeof ApiChar91_Char93helloRoute\n  '/api/': typeof ApiIndexRoute\n}\nexport interface FileRouteTypes {\n  fileRoutesByFullPath: FileRoutesByFullPath\n  fullPaths: '/' | '/api/_auth' | '/api/_hello' | '/api/'\n  fileRoutesByTo: FileRoutesByTo\n  to: '/' | '/api/_auth' | '/api/_hello' | '/api'\n  id: '__root__' | '/' | '/api/_auth' | '/api/_hello' | '/api/'\n  fileRoutesById: FileRoutesById\n}\nexport interface RootRouteChildren {\n  indexRoute: typeof indexRoute\n  ApiChar91_Char93authDotrouteRoute: typeof ApiChar91_Char93authDotrouteRoute\n  ApiChar91_Char93helloRoute: typeof ApiChar91_Char93helloRoute\n  ApiIndexRoute: typeof ApiIndexRoute\n}\n\ndeclare module '@tanstack/react-router' {\n  interface FileRoutesByPath {\n    '/': {\n      id: '/'\n      path: '/'\n      fullPath: '/'\n      preLoaderRoute: typeof indexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/': {\n      id: '/api/'\n      path: '/api'\n      fullPath: '/api/'\n      preLoaderRoute: typeof ApiIndexRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/_hello': {\n      id: '/api/_hello'\n      path: '/api/_hello'\n      fullPath: '/api/_hello'\n      preLoaderRoute: typeof ApiChar91_Char93helloRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n    '/api/_auth': {\n      id: '/api/_auth'\n      path: '/api/_auth'\n      fullPath: '/api/_auth'\n      preLoaderRoute: typeof ApiChar91_Char93authDotrouteRouteImport\n      parentRoute: typeof rootRouteImport\n    }\n  }\n}\n\nconst rootRouteChildren: RootRouteChildren = {\n  indexRoute: indexRoute,\n  ApiChar91_Char93authDotrouteRoute: ApiChar91_Char93authDotrouteRoute,\n  ApiChar91_Char93helloRoute: ApiChar91_Char93helloRoute,\n  ApiIndexRoute: ApiIndexRoute,\n}\nexport const routeTree = rootRouteImport\n  ._addFileChildren(rootRouteChildren)\n  ._addFileTypes<FileRouteTypes>()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-with-escaped-underscore/routes/__root.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute()\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-with-escaped-underscore/routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: () => 'Hello',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-with-escaped-underscore/routes/physical-routes/[_]auth.route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/_auth')({\n  component: () => 'Auth Route',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-with-escaped-underscore/routes/physical-routes/[_]hello.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/_hello')({\n  component: () => 'Hello API',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator/virtual-with-escaped-underscore/routes/physical-routes/index.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/api/')({\n  component: () => 'API Index',\n})\n"
  },
  {
    "path": "packages/router-generator/tests/generator.test.ts",
    "content": "import { existsSync } from 'node:fs'\nimport fs from 'node:fs/promises'\nimport path, { dirname, join, relative } from 'node:path'\nimport { describe, expect, it } from 'vitest'\n\nimport {\n  index,\n  layout,\n  physical,\n  rootRoute,\n  route,\n} from '@tanstack/virtual-file-routes'\nimport { Generator, getConfig, virtualGetRouteNodes } from '../src'\nimport type { Config } from '../src'\n\nfunction makeFolderDir(folder: string) {\n  return join(process.cwd(), 'tests', 'generator', folder)\n}\n\nasync function readDir(...paths: Array<string>) {\n  const folders = await fs.readdir(\n    join(process.cwd(), 'tests', 'generator', ...paths),\n  )\n  return folders\n}\n\nasync function traverseDirectory(\n  dir: string,\n  handleFile: (filePath: string) => void | Promise<void>,\n) {\n  const files = await fs.readdir(dir, { withFileTypes: true })\n\n  for (const file of files) {\n    const filePath = join(dir, file.name)\n\n    if (file.isDirectory()) {\n      await traverseDirectory(filePath, handleFile)\n    } else {\n      await handleFile(filePath)\n    }\n  }\n}\n\nfunction setupConfig(\n  folder: string,\n  inlineConfig: Partial<Omit<Config, 'routesDirectory'>> = {},\n) {\n  const { generatedRouteTree = `/routeTree.gen.ts`, ...rest } = inlineConfig\n  const dir = makeFolderDir(folder)\n\n  const configFilePath = join(dir, 'tsr.config.json')\n  const configDirectory = existsSync(configFilePath) ? dir : undefined\n\n  const config = getConfig(\n    {\n      disableLogging: true,\n      routesDirectory: dir + '/routes',\n      generatedRouteTree: dir + generatedRouteTree,\n      ...rest,\n    },\n    configDirectory,\n  )\n  return config\n}\n\nasync function getRouteTreeFileText(config: Config) {\n  const location = config.generatedRouteTree\n  const text = await fs.readFile(location, 'utf-8')\n  return text\n}\n\nfunction rewriteConfigByFolderName(folderName: string, config: Config) {\n  switch (folderName) {\n    case 'append-and-prepend':\n      config.routeTreeFileHeader = ['// prepend1', '// prepend2']\n      config.routeTreeFileFooter = ['// append1', '// append2']\n      break\n    case 'no-formatted-route-tree':\n      config.enableRouteTreeFormatting = false\n      break\n    case 'custom-tokens':\n      config.indexToken = '_1nd3x'\n      config.routeToken = '_r0ut3_'\n      break\n    case 'escaped-custom-tokens':\n      config.indexToken = '_1nd3x'\n      config.routeToken = '_r0ut3_'\n      break\n    case 'virtual':\n      {\n        const virtualRouteConfig = rootRoute('root.tsx', [\n          index('index.tsx'),\n          route('$lang', [index('pages.tsx')]),\n          layout('layout.tsx', [\n            route('/dashboard', 'db/dashboard.tsx', [\n              index('db/dashboard-index.tsx'),\n              route('/invoices', 'db/dashboard-invoices.tsx', [\n                index('db/invoices-index.tsx'),\n                route('$id', 'db/invoice-detail.tsx'),\n              ]),\n            ]),\n            physical('/hello', 'subtree'),\n          ]),\n        ])\n        config.virtualRouteConfig = virtualRouteConfig\n      }\n      break\n    case 'virtual-with-escaped-underscore':\n      {\n        // Test case for escaped underscores in physical routes mounted via virtual config\n        // This ensures originalRoutePath is correctly prefixed when paths are updated\n        const virtualRouteConfig = rootRoute('__root.tsx', [\n          index('index.tsx'),\n          physical('/api', 'physical-routes'),\n        ])\n        config.virtualRouteConfig = virtualRouteConfig\n      }\n      break\n    case 'types-disabled':\n      config.disableTypes = true\n      config.generatedRouteTree =\n        makeFolderDir(folderName) + `/routeTree.gen.js`\n      break\n    case 'custom-scaffolding':\n      config.customScaffolding = {\n        routeTemplate: [\n          'import * as React from \"react\";\\n',\n          '%%tsrImports%%\\n\\n',\n          '%%tsrExportStart%%{\\n component: RouteComponent\\n }%%tsrExportEnd%%\\n\\n',\n          'function RouteComponent() { return \"Hello %%tsrPath%%!\" };\\n',\n        ].join(''),\n        lazyRouteTemplate: [\n          'import React, { useState } from \"react\";\\n',\n          '%%tsrImports%%\\n\\n',\n          '%%tsrExportStart%%{\\n component: RouteComponent\\n }%%tsrExportEnd%%\\n\\n',\n          'function RouteComponent() { return \"Hello %%tsrPath%%!\" };\\n',\n        ].join(''),\n      }\n      break\n    case 'file-modification-verboseFileRoutes-true':\n      config.verboseFileRoutes = true\n      break\n    case 'file-modification-verboseFileRoutes-false':\n      config.verboseFileRoutes = false\n      break\n    // these two folders contain type tests which are executed separately\n    case 'nested-verboseFileRoutes-true':\n      config.verboseFileRoutes = true\n      break\n    case 'nested-verboseFileRoutes-false':\n      config.verboseFileRoutes = false\n      break\n    case 'routeFileIgnore':\n      config.routeFileIgnorePattern = 'ignoredPattern'\n      config.routeFileIgnorePrefix = 'imIgnored'\n      break\n    case 'routeFilePrefix':\n      config.routeFileIgnorePattern = 'ignoredPattern'\n      config.routeFilePrefix = 'r&'\n      break\n    case 'regex-tokens-inline':\n      // Test inline config with RegExp tokens\n      // indexToken matches patterns like \"index-page\", \"home-page\"\n      // routeToken matches patterns like \"main-layout\", \"protected-layout\"\n      config.indexToken = /[a-z]+-page/\n      config.routeToken = /[a-z]+-layout/\n      break\n    case 'virtual-sibling-routes':\n      {\n        // Test case for issue #5822: Virtual routes should respect explicit sibling relationships\n        // Routes /posts and /posts/$id should remain siblings under the layout,\n        // NOT auto-nested based on path matching\n        const virtualRouteConfig = rootRoute('__root.tsx', [\n          layout('_main', 'layout.tsx', [\n            route('/posts', 'posts.tsx'),\n            route('/posts/$id', 'post-detail.tsx'),\n          ]),\n        ])\n        config.virtualRouteConfig = virtualRouteConfig\n      }\n      break\n    case 'virtual-root-sibling-routes':\n      {\n        // Test case for issue #5431: Virtual routes that are siblings at the root level\n        // should NOT be auto-nested based on shared path prefix.\n        // /device/$id and /device/$id/history/$filename are both children of root,\n        // NOT parent-child of each other.\n        const virtualRouteConfig = rootRoute('__root.tsx', [\n          route('/device/$id', 'device/route.tsx'),\n          route('/device/$id/history/$filename', 'history/route.tsx'),\n        ])\n        config.virtualRouteConfig = virtualRouteConfig\n      }\n      break\n    case 'add-extensions-custom':\n      config.addExtensions = '.js'\n      break\n    case 'virtual-nested-layouts-with-virtual-route':\n      {\n        // Test case for nested layouts with a virtual file-less route in between.\n        const virtualRouteConfig = rootRoute('__root.tsx', [\n          index('home.tsx'),\n          layout('first', 'layout/first-layout.tsx', [\n            layout('layout/second-layout.tsx', [\n              route('route-without-file', [\n                route('/layout-a', 'a.tsx'),\n                route('/layout-b', 'b.tsx'),\n              ]),\n            ]),\n          ]),\n        ])\n        config.virtualRouteConfig = virtualRouteConfig\n      }\n      break\n    default:\n      break\n  }\n}\n\nasync function preprocess(folderName: string) {\n  if (folderName.startsWith('file-modification')) {\n    const templateVerbosePath = join(\n      makeFolderDir(folderName),\n      'template-verbose.tsx',\n    )\n    const templatePath = join(makeFolderDir(folderName), 'template.tsx')\n    const lazyTemplatePath = join(\n      makeFolderDir(folderName),\n      'template.lazy.tsx',\n    )\n\n    const makeRoutePath = (file: string) =>\n      join(makeFolderDir(folderName), 'routes', '(test)', file)\n    const makeEmptyFile = async (file: string) => {\n      const fh = await fs.open(makeRoutePath(file), 'w')\n      await fh.close()\n    }\n\n    await fs.copyFile(templateVerbosePath, makeRoutePath('foo.bar.tsx'))\n    await fs.copyFile(templatePath, makeRoutePath('foo.tsx'))\n    await fs.copyFile(lazyTemplatePath, makeRoutePath('initiallyLazy.tsx'))\n    await fs.copyFile(templatePath, makeRoutePath('bar.lazy.tsx'))\n    await makeEmptyFile('initiallyEmpty.tsx')\n    await makeEmptyFile('initiallyEmpty.lazy.tsx')\n  } else if (folderName === 'custom-scaffolding') {\n    const makeEmptyFile = async (...file: Array<string>) => {\n      const filePath = join(makeFolderDir(folderName), 'routes', ...file)\n      const dir = dirname(filePath)\n      await fs.mkdir(dir, { recursive: true })\n      const fh = await fs.open(filePath, 'w')\n      await fh.close()\n    }\n\n    await makeEmptyFile('__root.tsx')\n    await makeEmptyFile('index.tsx')\n    await makeEmptyFile('foo.lazy.tsx')\n    await makeEmptyFile('api', 'bar.tsx')\n  }\n}\n\nasync function postprocess(folderName: string) {\n  switch (folderName) {\n    case 'file-modification-verboseFileRoutes-false':\n    case 'file-modification-verboseFileRoutes-true': {\n      const routeFiles = await readDir(folderName, 'routes', '(test)')\n      await Promise.all(\n        routeFiles\n          .filter((r) => r.endsWith('.tsx'))\n          .map(async (routeFile) => {\n            const text = await fs.readFile(\n              join(makeFolderDir(folderName), 'routes', '(test)', routeFile),\n              'utf-8',\n            )\n            await expect(text).toMatchFileSnapshot(\n              join('generator', folderName, 'snapshots', routeFile),\n            )\n          }),\n      )\n      break\n    }\n    case 'custom-scaffolding': {\n      const startDir = join(makeFolderDir(folderName), 'routes')\n      await traverseDirectory(startDir, async (filePath) => {\n        const relativePath = relative(startDir, filePath)\n        if (filePath.endsWith('.tsx')) {\n          await expect(\n            await fs.readFile(filePath, 'utf-8'),\n          ).toMatchFileSnapshot(\n            join('generator', folderName, 'snapshots', relativePath),\n          )\n        }\n      })\n    }\n  }\n}\n\nfunction shouldThrow(folderName: string) {\n  if (folderName === 'duplicate-fullPath') {\n    return `Conflicting configuration paths were found for the following routes: \"/\", \"/\".`\n  }\n  if (folderName === 'virtual-physical-empty-path-conflict-root') {\n    return 'Invalid route path \"\" was found.'\n  }\n  if (folderName === 'virtual-physical-empty-path-conflict-virtual') {\n    return `Conflicting configuration paths were found for the following routes: \"/about\", \"/about\".`\n  }\n  return undefined\n}\n\ndescribe('generator works', async () => {\n  const folderNames = await readDir()\n\n  it.each(folderNames)(\n    'should wire-up the routes for a \"%s\" tree',\n    async (folderName) => {\n      const folderRoot = makeFolderDir(folderName)\n\n      const config = await setupConfig(folderName)\n\n      rewriteConfigByFolderName(folderName, config)\n\n      await preprocess(folderName)\n      const generator = new Generator({ config, root: folderRoot })\n      const error = shouldThrow(folderName)\n      if (error) {\n        try {\n          await generator.run()\n        } catch (e) {\n          expect(e).toBeInstanceOf(Error)\n          expect((e as Error).message.startsWith(error)).toBeTruthy()\n        }\n      } else {\n        await generator.run()\n\n        const generatedRouteTree = await getRouteTreeFileText(config)\n\n        const snapshotPath = `routeTree.snapshot.${config.disableTypes ? 'js' : 'ts'}`\n\n        await expect(generatedRouteTree).toMatchFileSnapshot(\n          join('generator', folderName, snapshotPath),\n        )\n      }\n\n      await postprocess(folderName)\n    },\n  )\n\n  it('physical() mount returns absolute physicalDirectories', async () => {\n    const folderName = 'virtual-physical-no-prefix'\n    const dir = makeFolderDir(folderName)\n    const config = await setupConfig(folderName)\n\n    const { physicalDirectories } = await virtualGetRouteNodes(config, dir, {\n      indexTokenSegmentRegex: /^(?:index)$/,\n      routeTokenSegmentRegex: /^(?:route)$/,\n    })\n\n    expect(physicalDirectories.length).toBeGreaterThan(0)\n    physicalDirectories.forEach((physicalDir) => {\n      expect(path.isAbsolute(physicalDir)).toBe(true)\n    })\n  })\n\n  it.each(folderNames)(\n    'should create directory for routeTree if it does not exist',\n    async () => {\n      const folderName = 'only-root'\n      const folderRoot = makeFolderDir(folderName)\n      let pathCreated = false\n\n      const config = await setupConfig(folderName)\n\n      rewriteConfigByFolderName(folderName, config)\n\n      await preprocess(folderName)\n      config.generatedRouteTree = join(\n        folderRoot,\n        'generated',\n        `/routeTree.gen.ts`,\n      )\n      const generator = new Generator({ config, root: folderRoot })\n\n      const error = shouldThrow(folderName)\n      if (error) {\n        try {\n          await generator.run()\n        } catch (e) {\n          expect(e).toBeInstanceOf(Error)\n          expect((e as Error).message.startsWith(error)).toBeTruthy()\n        }\n      } else {\n        await generator.run()\n\n        const generatedRouteTree = await getRouteTreeFileText(config)\n\n        await expect(generatedRouteTree).toMatchFileSnapshot(\n          join(\n            'generator',\n            folderName,\n            `routeTree.generated.snapshot.${config.disableTypes ? 'js' : 'ts'}`,\n          ),\n        )\n\n        pathCreated = await fs.access(dirname(config.generatedRouteTree)).then(\n          () => true,\n          () => false,\n        )\n\n        await expect(pathCreated).toBe(true)\n      }\n\n      await postprocess(folderName)\n\n      if (pathCreated) {\n        await fs.rm(dirname(config.generatedRouteTree), { recursive: true })\n      }\n    },\n  )\n})\n"
  },
  {
    "path": "packages/router-generator/tests/utils.test.ts",
    "content": "import { describe, expect, it, vi } from 'vitest'\nimport {\n  RoutePrefixMap,\n  cleanPath,\n  determineInitialRoutePath,\n  hasEscapedLeadingUnderscore,\n  hasEscapedTrailingUnderscore,\n  inferFullPath,\n  isSegmentPathless,\n  mergeImportDeclarations,\n  multiSortBy,\n  removeExt,\n  removeLayoutSegmentsWithEscape,\n  removeLeadingUnderscores,\n  removeTrailingUnderscores,\n  removeUnderscores,\n  removeUnderscoresWithEscape,\n  routePathToVariable,\n} from '../src/utils'\nimport type { ImportDeclaration, RouteNode } from '../src/types'\n\ndescribe('cleanPath', () => {\n  it('keeps path with leading slash and trailing slash', () => {\n    expect(cleanPath('/test/')).toBe('/test/')\n  })\n})\n\ndescribe('inferFullPath', () => {\n  it('returns \"/\" for pathless layouts under root', () => {\n    const node = {\n      routePath: '/_layout-a1',\n      originalRoutePath: '/_layout-a1',\n      cleanedPath: '',\n      _fsRouteType: 'pathless_layout',\n    } as unknown as RouteNode\n\n    // This avoids inferred fullPath \"\" which breaks match.fullPath unions\n    expect(inferFullPath(node)).toBe('/')\n  })\n})\n\ndescribe('determineInitialRoutePath', () => {\n  it('removes dots and adds slashes', () => {\n    expect(determineInitialRoutePath('test.test')).toStrictEqual({\n      routePath: '/test/test',\n      originalRoutePath: '/test/test',\n    })\n  })\n\n  it('keeps leading slash', () => {\n    expect(determineInitialRoutePath('/test.test')).toStrictEqual({\n      routePath: '/test/test',\n      originalRoutePath: '/test/test',\n    })\n  })\n\n  it('keeps trailing slash', () => {\n    expect(determineInitialRoutePath('test.test/')).toStrictEqual({\n      routePath: '/test/test/',\n      originalRoutePath: '/test/test/',\n    })\n  })\n\n  it('removes dots and adds slashes with leading and trailing slashes', () => {\n    expect(determineInitialRoutePath('/test.test/')).toStrictEqual({\n      routePath: '/test/test/',\n      originalRoutePath: '/test/test/',\n    })\n  })\n\n  it(\"returns '/' if path is empty\", () => {\n    expect(determineInitialRoutePath('')).toStrictEqual({\n      routePath: '/',\n      originalRoutePath: '/',\n    })\n  })\n\n  it(\"returns '/' if path is '.'\", () => {\n    expect(determineInitialRoutePath('.')).toStrictEqual({\n      routePath: '/',\n      originalRoutePath: '/',\n    })\n  })\n\n  it(\"returns '/' if path is './'\", () => {\n    expect(determineInitialRoutePath('./')).toStrictEqual({\n      routePath: '/',\n      originalRoutePath: '/',\n    })\n  })\n\n  it('errors on disallowed escaped character', () => {\n    const consoleSpy = vi.spyOn(console, 'error')\n\n    expect(() => determineInitialRoutePath('/a[/]')).toThrowError()\n\n    expect(consoleSpy).toBeCalledWith(\n      'Error: Disallowed character \"/\" found in square brackets in route path \"/a[/]\".\\n' +\n        'You cannot use any of the following characters in square brackets: /, \\\\, ?, #, :, *, <, >, |, !, $, %\\n' +\n        'Please remove and/or replace them.',\n    )\n\n    consoleSpy.mockRestore()\n  })\n\n  it('escapes characters correctly', () => {\n    expect(determineInitialRoutePath('/a[.]')).toStrictEqual({\n      routePath: '/a.',\n      originalRoutePath: '/a[.]',\n    })\n  })\n\n  it('should handle trailing underscores correctly', () => {\n    expect(determineInitialRoutePath('a_')).toStrictEqual({\n      routePath: `/a_`,\n      originalRoutePath: '/a_',\n    })\n\n    expect(determineInitialRoutePath('a_.route')).toStrictEqual({\n      routePath: `/a_/route`,\n      originalRoutePath: '/a_/route',\n    })\n\n    expect(determineInitialRoutePath('a_.b.c')).toStrictEqual({\n      routePath: `/a_/b/c`,\n      originalRoutePath: '/a_/b/c',\n    })\n\n    expect(determineInitialRoutePath('a.b_.c.d')).toStrictEqual({\n      routePath: `/a/b_/c/d`,\n      originalRoutePath: '/a/b_/c/d',\n    })\n\n    expect(determineInitialRoutePath('a_.route.b')).toStrictEqual({\n      routePath: `/a_/route/b`,\n      originalRoutePath: '/a_/route/b',\n    })\n  })\n})\n\ndescribe('multiSortBy', () => {\n  it('sorts by single accessor', () => {\n    const arr = [{ v: 3 }, { v: 1 }, { v: 2 }]\n    const result = multiSortBy(arr, [(d) => d.v])\n    expect(result.map((d) => d.v)).toEqual([1, 2, 3])\n  })\n\n  it('sorts by multiple accessors', () => {\n    const arr = [\n      { a: 2, b: 1 },\n      { a: 1, b: 2 },\n      { a: 1, b: 1 },\n    ]\n    const result = multiSortBy(arr, [(d) => d.a, (d) => d.b])\n    expect(result).toEqual([\n      { a: 1, b: 1 },\n      { a: 1, b: 2 },\n      { a: 2, b: 1 },\n    ])\n  })\n\n  it('preserves original order for equal elements', () => {\n    const arr = [\n      { a: 1, id: 'first' },\n      { a: 1, id: 'second' },\n      { a: 1, id: 'third' },\n    ]\n    const result = multiSortBy(arr, [(d) => d.a])\n    expect(result.map((d) => d.id)).toEqual(['first', 'second', 'third'])\n  })\n\n  it('handles undefined values', () => {\n    const arr = [{ v: 1 }, { v: undefined }, { v: 2 }]\n    const result = multiSortBy(arr, [(d) => d.v])\n    // undefined sorts to end\n    expect(result.map((d) => d.v)).toEqual([1, 2, undefined])\n  })\n\n  it('handles empty array', () => {\n    const result = multiSortBy([], [(d) => d])\n    expect(result).toEqual([])\n  })\n\n  it('handles single element array', () => {\n    const result = multiSortBy([{ v: 1 }], [(d) => d.v])\n    expect(result).toEqual([{ v: 1 }])\n  })\n\n  it('uses default accessor when none provided', () => {\n    const arr = [3, 1, 2]\n    const result = multiSortBy(arr)\n    expect(result).toEqual([1, 2, 3])\n  })\n\n  it('sorts strings correctly', () => {\n    const arr = [{ s: 'c' }, { s: 'a' }, { s: 'b' }]\n    const result = multiSortBy(arr, [(d) => d.s])\n    expect(result.map((d) => d.s)).toEqual(['a', 'b', 'c'])\n  })\n\n  it('handles negative numbers in accessors for reverse sort', () => {\n    const arr = [{ v: 1 }, { v: 3 }, { v: 2 }]\n    const result = multiSortBy(arr, [(d) => -d.v])\n    expect(result.map((d) => d.v)).toEqual([3, 2, 1])\n  })\n})\n\ndescribe('multiSortBy', () => {\n  it('sorts by multiple criteria', () => {\n    const data = [\n      { routePath: '/test/1/2/index', f: 'b' },\n      { routePath: '/test/1', f: 'b' },\n      { routePath: '/test/1/2/3/4/index', f: 'b' },\n      { routePath: '/test/1/2/3', f: 'b' },\n      { routePath: '/test/1/2/3/index', f: 'b' },\n      { routePath: '/test/1/2', f: 'b' },\n      { routePath: '/test/1/2/3/4', f: 'b' },\n    ]\n\n    const sorted = multiSortBy(data, [\n      (d) => (d.routePath.includes('1') ? -1 : 1),\n      (d) => d.routePath.split('/').length,\n      (d) => (d.routePath.endsWith('index') ? -1 : 1),\n      (d) => d,\n    ])\n\n    expect(sorted).toEqual([\n      { routePath: '/test/1', f: 'b' },\n      { routePath: '/test/1/2', f: 'b' },\n      { routePath: '/test/1/2/index', f: 'b' },\n      { routePath: '/test/1/2/3', f: 'b' },\n      { routePath: '/test/1/2/3/index', f: 'b' },\n      { routePath: '/test/1/2/3/4', f: 'b' },\n      { routePath: '/test/1/2/3/4/index', f: 'b' },\n    ])\n  })\n})\n\ndescribe('removeExt', () => {\n  it('removes extension', () => {\n    expect(removeExt('test.ts')).toBe('test')\n  })\n\n  it('does not remove extension if no extension', () => {\n    expect(removeExt('test')).toBe('test')\n  })\n\n  it('removes extension with multiple dots', () => {\n    expect(removeExt('test.test.ts')).toBe('test.test')\n  })\n\n  it('removes extension with leading dot', () => {\n    expect(removeExt('.test.ts')).toBe('.test')\n  })\n\n  it('removes extension when in a route path', () => {\n    expect(removeExt('/test/test.ts')).toBe('/test/test')\n  })\n\n  it('keeps extension when addExtensions is true', () => {\n    expect(removeExt('test.tsx', true)).toBe('test.tsx')\n  })\n\n  it('keeps extension with route path when addExtensions is true', () => {\n    expect(removeExt('/routes/__root.tsx', true)).toBe('/routes/__root.tsx')\n  })\n\n  it('replaces extension when addExtensions is a dot-prefixed string', () => {\n    expect(removeExt('test.tsx', '.js')).toBe('test.js')\n  })\n\n  it('replaces extension with route path when addExtensions is a string', () => {\n    expect(removeExt('/routes/__root.tsx', '.js')).toBe('/routes/__root.js')\n  })\n\n  it('replaces extension with multiple dots when addExtensions is a string', () => {\n    expect(removeExt('test.lazy.tsx', '.js')).toBe('test.lazy.js')\n  })\n\n  it('returns unchanged when no extension and addExtensions is a string', () => {\n    expect(removeExt('test', '.js')).toBe('test')\n  })\n})\n\ndescribe('removeUnderscores', () => {\n  it('removes leading underscore', () => {\n    expect(removeUnderscores('_test')).toBe('test')\n  })\n\n  it('removes trailing underscore', () => {\n    expect(removeUnderscores('test_')).toBe('test')\n  })\n\n  it('removes leading and trailing underscores', () => {\n    expect(removeUnderscores('_test_')).toBe('test')\n  })\n})\n\ndescribe('removeLeadingUnderscores', () => {\n  it('removes leading underscore when not routeToken', () => {\n    expect(removeLeadingUnderscores('_test', 'route')).toBe('test')\n\n    expect(removeLeadingUnderscores('/_test/abc/route/_d', 'route')).toBe(\n      '/test/abc/route/d',\n    )\n\n    expect(removeLeadingUnderscores('/_test_/abc/_route_/d_/_e', 'route')).toBe(\n      '/test_/abc/route_/d_/e',\n    )\n\n    expect(\n      removeLeadingUnderscores('/_test_/abc/_route_/d_/_e', '_route_'),\n    ).toBe('/test_/abc/_route_/d_/e')\n\n    expect(\n      removeLeadingUnderscores('/_test_/abc/_route_/d_/_e', 'route_'),\n    ).toBe('/test_/abc/route_/d_/e')\n  })\n})\n\ndescribe('removeTrailingUnderscores', () => {\n  it('removes trailing underscore when not routeToken', () => {\n    expect(removeTrailingUnderscores('test_', 'route')).toBe('test')\n\n    expect(removeTrailingUnderscores('/_test_/abc_/route/_d', 'route')).toBe(\n      '/_test/abc/route/_d',\n    )\n\n    expect(\n      removeTrailingUnderscores('/_test_/abc/_route_/d_/_e', 'route'),\n    ).toBe('/_test/abc/_route/d/_e')\n\n    expect(\n      removeTrailingUnderscores('/_test_/abc/_route_/d_/_e', '_route_'),\n    ).toBe('/_test/abc/_route_/d/_e')\n\n    expect(\n      removeTrailingUnderscores('/_test_/abc/_route_/d_/_e', '_route'),\n    ).toBe('/_test/abc/_route/d/_e')\n  })\n})\n\ndescribe('hasEscapedLeadingUnderscore', () => {\n  it('returns true for [_] prefix pattern', () => {\n    expect(hasEscapedLeadingUnderscore('[_]layout')).toBe(true)\n    expect(hasEscapedLeadingUnderscore('[_]foo')).toBe(true)\n    expect(hasEscapedLeadingUnderscore('[_]')).toBe(true)\n  })\n\n  it('returns true for fully escaped segment starting with underscore', () => {\n    expect(hasEscapedLeadingUnderscore('[_layout]')).toBe(true)\n    expect(hasEscapedLeadingUnderscore('[_foo]')).toBe(true)\n    expect(hasEscapedLeadingUnderscore('[_1nd3x]')).toBe(true)\n    expect(hasEscapedLeadingUnderscore('[_]')).toBe(true)\n  })\n\n  it('returns false for non-escaped leading underscore', () => {\n    expect(hasEscapedLeadingUnderscore('_layout')).toBe(false)\n    expect(hasEscapedLeadingUnderscore('_foo')).toBe(false)\n  })\n\n  it('returns false for segments without leading underscore', () => {\n    expect(hasEscapedLeadingUnderscore('layout')).toBe(false)\n    expect(hasEscapedLeadingUnderscore('[layout]')).toBe(false)\n    expect(hasEscapedLeadingUnderscore('foo[_]')).toBe(false)\n  })\n\n  it('returns false for partial escapes with nested brackets', () => {\n    expect(hasEscapedLeadingUnderscore('[_foo[bar]')).toBe(false)\n    expect(hasEscapedLeadingUnderscore('[_foo]bar]')).toBe(false)\n  })\n})\n\ndescribe('hasEscapedTrailingUnderscore', () => {\n  it('returns true for [_] suffix pattern', () => {\n    expect(hasEscapedTrailingUnderscore('blog[_]')).toBe(true)\n    expect(hasEscapedTrailingUnderscore('foo[_]')).toBe(true)\n    expect(hasEscapedTrailingUnderscore('[_]')).toBe(true)\n  })\n\n  it('returns true for fully escaped segment ending with underscore', () => {\n    expect(hasEscapedTrailingUnderscore('[blog_]')).toBe(true)\n    expect(hasEscapedTrailingUnderscore('[foo_]')).toBe(true)\n    expect(hasEscapedTrailingUnderscore('[_r0ut3_]')).toBe(true)\n    expect(hasEscapedTrailingUnderscore('[_]')).toBe(true)\n  })\n\n  it('returns false for non-escaped trailing underscore', () => {\n    expect(hasEscapedTrailingUnderscore('blog_')).toBe(false)\n    expect(hasEscapedTrailingUnderscore('foo_')).toBe(false)\n  })\n\n  it('returns false for segments without trailing underscore', () => {\n    expect(hasEscapedTrailingUnderscore('blog')).toBe(false)\n    expect(hasEscapedTrailingUnderscore('[blog]')).toBe(false)\n    expect(hasEscapedTrailingUnderscore('[_]foo')).toBe(false)\n  })\n\n  it('returns false for partial escapes with nested brackets', () => {\n    expect(hasEscapedTrailingUnderscore('[foo[bar]_]')).toBe(false)\n    expect(hasEscapedTrailingUnderscore('[foo]bar_]')).toBe(false)\n  })\n})\n\ndescribe('isSegmentPathless', () => {\n  it('returns true for non-escaped leading underscore', () => {\n    expect(isSegmentPathless('_layout', '_layout')).toBe(true)\n    expect(isSegmentPathless('_foo', '_foo')).toBe(true)\n  })\n\n  it('returns false for escaped leading underscore with [_] prefix', () => {\n    expect(isSegmentPathless('_layout', '[_]layout')).toBe(false)\n    expect(isSegmentPathless('_foo', '[_]foo')).toBe(false)\n  })\n\n  it('returns false for fully escaped segment', () => {\n    expect(isSegmentPathless('_layout', '[_layout]')).toBe(false)\n    expect(isSegmentPathless('_1nd3x', '[_1nd3x]')).toBe(false)\n  })\n\n  it('returns false for segments not starting with underscore', () => {\n    expect(isSegmentPathless('layout', 'layout')).toBe(false)\n    expect(isSegmentPathless('foo', '[foo]')).toBe(false)\n  })\n})\n\ndescribe('removeUnderscoresWithEscape', () => {\n  it('removes non-escaped leading underscores', () => {\n    expect(removeUnderscoresWithEscape('/_layout', '/_layout')).toBe('/layout')\n    expect(removeUnderscoresWithEscape('/_foo/_bar', '/_foo/_bar')).toBe(\n      '/foo/bar',\n    )\n  })\n\n  it('removes non-escaped trailing underscores', () => {\n    expect(removeUnderscoresWithEscape('/blog_', '/blog_')).toBe('/blog')\n    expect(removeUnderscoresWithEscape('/foo_/bar_', '/foo_/bar_')).toBe(\n      '/foo/bar',\n    )\n  })\n\n  it('preserves escaped leading underscores with [_] prefix', () => {\n    expect(removeUnderscoresWithEscape('/_layout', '/[_]layout')).toBe(\n      '/_layout',\n    )\n    expect(removeUnderscoresWithEscape('/_foo', '/[_]foo')).toBe('/_foo')\n  })\n\n  it('preserves escaped trailing underscores with [_] suffix', () => {\n    expect(removeUnderscoresWithEscape('/blog_', '/blog[_]')).toBe('/blog_')\n    expect(removeUnderscoresWithEscape('/foo_', '/foo[_]')).toBe('/foo_')\n  })\n\n  it('preserves fully escaped segments with underscores', () => {\n    expect(removeUnderscoresWithEscape('/_layout', '/[_layout]')).toBe(\n      '/_layout',\n    )\n    expect(removeUnderscoresWithEscape('/_r0ut3_', '/[_r0ut3_]')).toBe(\n      '/_r0ut3_',\n    )\n  })\n\n  it('handles mixed escaped and non-escaped underscores', () => {\n    expect(\n      removeUnderscoresWithEscape('/_foo/_bar_/baz_', '/_foo/[_]bar_/baz[_]'),\n    ).toBe('/foo/_bar/baz_')\n  })\n\n  it('falls back to removeUnderscores when no originalPath', () => {\n    expect(removeUnderscoresWithEscape('/_foo_')).toBe('/foo')\n    expect(removeUnderscoresWithEscape('/_foo_', undefined)).toBe('/foo')\n  })\n\n  it('returns empty string for empty/undefined routePath', () => {\n    expect(removeUnderscoresWithEscape(undefined)).toBe('')\n    expect(removeUnderscoresWithEscape('')).toBe('')\n  })\n})\n\ndescribe('removeLayoutSegmentsWithEscape', () => {\n  it('removes non-escaped layout segments', () => {\n    expect(removeLayoutSegmentsWithEscape('/_layout/foo', '/_layout/foo')).toBe(\n      '/foo',\n    )\n    expect(\n      removeLayoutSegmentsWithEscape(\n        '/_auth/_admin/dashboard',\n        '/_auth/_admin/dashboard',\n      ),\n    ).toBe('/dashboard')\n  })\n\n  it('preserves escaped layout segments with [_] prefix', () => {\n    expect(\n      removeLayoutSegmentsWithEscape('/_layout/foo', '/[_]layout/foo'),\n    ).toBe('/_layout/foo')\n    expect(\n      removeLayoutSegmentsWithEscape('/_auth/dashboard', '/[_]auth/dashboard'),\n    ).toBe('/_auth/dashboard')\n  })\n\n  it('preserves fully escaped segments starting with underscore', () => {\n    expect(\n      removeLayoutSegmentsWithEscape('/_layout/foo', '/[_layout]/foo'),\n    ).toBe('/_layout/foo')\n    expect(removeLayoutSegmentsWithEscape('/_1nd3x/bar', '/[_1nd3x]/bar')).toBe(\n      '/_1nd3x/bar',\n    )\n  })\n\n  it('handles mixed escaped and non-escaped layout segments', () => {\n    expect(\n      removeLayoutSegmentsWithEscape(\n        '/_auth/_admin/dashboard',\n        '/[_]auth/_admin/dashboard',\n      ),\n    ).toBe('/_auth/dashboard')\n    expect(\n      removeLayoutSegmentsWithEscape('/_foo/_bar/_baz', '/_foo/[_bar]/_baz'),\n    ).toBe('/_bar')\n  })\n\n  it('falls back to removeLayoutSegments when no originalPath', () => {\n    expect(removeLayoutSegmentsWithEscape('/_foo/bar/_baz')).toBe('/bar')\n    expect(removeLayoutSegmentsWithEscape('/_foo/bar/_baz', undefined)).toBe(\n      '/bar',\n    )\n  })\n\n  it('handles root path', () => {\n    expect(removeLayoutSegmentsWithEscape('/')).toBe('/')\n    expect(removeLayoutSegmentsWithEscape()).toBe('/')\n  })\n})\n\ndescribe('routePathToVariable', () => {\n  it.each([\n    ['/test/$/index', 'TestSplatIndex'],\n    ['/test/$', 'TestSplat'],\n    ['/test/$/', 'TestSplat'],\n    ['/test/index', 'TestIndex'],\n    ['/test', 'Test'],\n    ['/test/', 'Test'],\n    ['/r0ut3', 'R0ut3'],\n  ])(`converts \"%s\" to \"%s\"`, (routePath, expected) => {\n    expect(routePathToVariable(routePath)).toBe(expected)\n  })\n})\n\ndescribe('mergeImportDeclarations', () => {\n  it('merges imports with the same source but different specifiers', () => {\n    const imports: Array<ImportDeclaration> = [\n      { source: 'moduleA', specifiers: [{ imported: 'A' }] },\n      { source: 'moduleA', specifiers: [{ imported: 'B' }] },\n    ]\n\n    const result = mergeImportDeclarations(imports)\n\n    expect(result).toEqual([\n      {\n        source: 'moduleA',\n        specifiers: [{ imported: 'A' }, { imported: 'B' }],\n      },\n    ])\n  })\n\n  it('merges imports with overlapping specifiers', () => {\n    const imports: Array<ImportDeclaration> = [\n      { source: 'moduleA', specifiers: [{ imported: 'A' }] },\n      { source: 'moduleA', specifiers: [{ imported: 'A' }, { imported: 'B' }] },\n    ]\n\n    const result = mergeImportDeclarations(imports)\n\n    expect(result).toEqual([\n      {\n        source: 'moduleA',\n        specifiers: [{ imported: 'A' }, { imported: 'B' }],\n      },\n    ])\n  })\n\n  it('does not merge imports with mixed import kinds for the same source', () => {\n    const imports: Array<ImportDeclaration> = [\n      {\n        source: 'moduleA',\n        importKind: 'type',\n        specifiers: [{ imported: 'A' }],\n      },\n      { source: 'moduleA', specifiers: [{ imported: 'B' }] },\n    ]\n\n    const result = mergeImportDeclarations(imports)\n\n    expect(result).toEqual([\n      {\n        source: 'moduleA',\n        importKind: 'type',\n        specifiers: [{ imported: 'A' }],\n      },\n      { source: 'moduleA', specifiers: [{ imported: 'B' }] },\n    ])\n  })\n\n  it('removes duplicate specifiers', () => {\n    const imports: Array<ImportDeclaration> = [\n      { source: 'moduleA', specifiers: [{ imported: 'A' }] },\n      { source: 'moduleA', specifiers: [{ imported: 'A' }] },\n    ]\n\n    const result = mergeImportDeclarations(imports)\n\n    expect(result).toEqual([\n      {\n        source: 'moduleA',\n        specifiers: [{ imported: 'A' }],\n      },\n    ])\n  })\n})\n\ndescribe('RoutePrefixMap', () => {\n  const createRoute = (\n    overrides: Partial<RouteNode> & { routePath: string },\n  ): RouteNode => ({\n    filePath: 'test.tsx',\n    fullPath: overrides.routePath,\n    variableName: 'Test',\n    _fsRouteType: 'static',\n    ...overrides,\n  })\n\n  describe('constructor', () => {\n    it('indexes routes by path', () => {\n      const routes = [\n        createRoute({ routePath: '/users' }),\n        createRoute({ routePath: '/users/profile' }),\n      ]\n      const map = new RoutePrefixMap(routes)\n\n      expect(map.has('/users')).toBe(true)\n      expect(map.has('/users/profile')).toBe(true)\n      expect(map.has('/posts')).toBe(false)\n    })\n\n    it('skips root path /__root', () => {\n      const routes = [createRoute({ routePath: '/__root' })]\n      const map = new RoutePrefixMap(routes)\n\n      expect(map.has('/__root')).toBe(false)\n    })\n\n    it('skips empty/undefined routePaths', () => {\n      const routes = [createRoute({ routePath: '' })]\n      const map = new RoutePrefixMap(routes)\n\n      expect(map.has('')).toBe(false)\n    })\n\n    it('tracks layout routes separately', () => {\n      const routes = [\n        createRoute({ routePath: '/app', _fsRouteType: 'layout' }),\n        createRoute({ routePath: '/admin', _fsRouteType: 'pathless_layout' }),\n        createRoute({ routePath: '/users', _fsRouteType: 'static' }),\n      ]\n      const map = new RoutePrefixMap(routes)\n\n      // all indexed\n      expect(map.has('/app')).toBe(true)\n      expect(map.has('/admin')).toBe(true)\n      expect(map.has('/users')).toBe(true)\n    })\n  })\n\n  describe('get', () => {\n    it('returns route by exact path', () => {\n      const route = createRoute({ routePath: '/users' })\n      const map = new RoutePrefixMap([route])\n\n      expect(map.get('/users')).toBe(route)\n      expect(map.get('/other')).toBeUndefined()\n    })\n  })\n\n  describe('findParent', () => {\n    it('returns null for root path', () => {\n      const map = new RoutePrefixMap([])\n\n      expect(map.findParent('/')).toBeNull()\n    })\n\n    it('returns null for empty path', () => {\n      const map = new RoutePrefixMap([])\n\n      expect(map.findParent('')).toBeNull()\n    })\n\n    it('finds immediate parent', () => {\n      const parent = createRoute({ routePath: '/users' })\n      const map = new RoutePrefixMap([parent])\n\n      expect(map.findParent('/users/profile')).toBe(parent)\n    })\n\n    it('finds ancestor when immediate parent missing', () => {\n      const grandparent = createRoute({ routePath: '/users' })\n      const map = new RoutePrefixMap([grandparent])\n\n      expect(map.findParent('/users/settings/profile')).toBe(grandparent)\n    })\n\n    it('finds closest ancestor with multiple levels', () => {\n      const grandparent = createRoute({ routePath: '/users' })\n      const parent = createRoute({ routePath: '/users/settings' })\n      const map = new RoutePrefixMap([grandparent, parent])\n\n      expect(map.findParent('/users/settings/profile')).toBe(parent)\n    })\n\n    it('returns null when no parent exists', () => {\n      const map = new RoutePrefixMap([createRoute({ routePath: '/posts' })])\n\n      expect(map.findParent('/users/profile')).toBeNull()\n    })\n\n    it('does not return self as parent', () => {\n      const route = createRoute({ routePath: '/users' })\n      const map = new RoutePrefixMap([route])\n\n      expect(map.findParent('/users')).toBeNull()\n    })\n  })\n})\n"
  },
  {
    "path": "packages/router-generator/tests/validate-route-params.test.ts",
    "content": "import { join } from 'node:path'\nimport { afterAll, describe, expect, it, vi } from 'vitest'\nimport { Generator, getConfig } from '../src'\n\ndescribe('validateRouteParams via generator', () => {\n  const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})\n  afterAll(() => {\n    warnSpy.mockRestore()\n  })\n\n  it('should warn for invalid param names when running the generator', async () => {\n    const folderName = 'invalid-param-names'\n    const dir = join(process.cwd(), 'tests', 'generator', folderName)\n\n    const config = getConfig({\n      disableLogging: false, // Enable logging to capture warnings\n      routesDirectory: dir + '/routes',\n      generatedRouteTree: dir + '/routeTree.gen.ts',\n    })\n\n    const generator = new Generator({ config, root: dir })\n    await generator.run()\n\n    // Should have warned about invalid params: $123 and $user-name\n    expect(warnSpy).toHaveBeenCalledWith(\n      expect.stringContaining('Invalid param name'),\n    )\n    expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('123'))\n    expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('user-name'))\n\n    // Should NOT have warned about $validParam\n    expect(warnSpy).not.toHaveBeenCalledWith(\n      expect.stringContaining('validParam'),\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-generator/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\"\n  },\n  \"include\": [\n    \"src\",\n    \"vite.config.ts\",\n    \"tests\",\n    \"tests/generator/**/*.test-d.ts\"\n  ],\n  \"exclude\": [\n    \"tests/generator/**/*.tsx\",\n    \"tests/generator/**/routeTree.gen.js\",\n    \"tests/generator/**/routeTree.gen.ts\",\n    \"tests/generator/**/routeTree.snapshot.js\",\n    \"tests/generator/**/routeTree.snapshot.ts\"\n  ]\n}\n"
  },
  {
    "path": "packages/router-generator/tsconfig.legacy.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\", \"tests\"],\n  \"exclude\": [\"tests/generator/**/**\"]\n}\n"
  },
  {
    "path": "packages/router-generator/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    typecheck: { enabled: true },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/router-plugin/ARCHITECTURE-CODE-SPLITTING.md",
    "content": "# Automatic Code-Splitting Architecture\n\n> Internal documentation for the TanStack Router code-splitting system.\n> This covers the Babel-based transform pipeline that splits route files into\n> lazily-loaded modules (typically separate chunks) at build time.\n\n---\n\n## Table of Contents\n\n1. [Overview](#overview)\n2. [Architecture Diagram](#architecture-diagram)\n3. [Plugin Pipeline](#plugin-pipeline)\n4. [Virtual File Mechanism](#virtual-file-mechanism)\n5. [Shared Bindings System](#shared-bindings-system)\n6. [Code Split Groupings](#code-split-groupings)\n7. [Compiler Functions Reference](#compiler-functions-reference)\n8. [Dead Code Elimination](#dead-code-elimination)\n9. [Framework Support](#framework-support)\n10. [Edge Cases and Gotchas](#edge-cases-and-gotchas)\n11. [Module Graph Diagrams](#module-graph-diagrams)\n\n---\n\n## Overview\n\nTanStack Router's automatic code-splitting transforms a single route file into\nmultiple modules at build time so that heavy route properties (components,\nloaders) are loaded on demand rather than eagerly.\n\nGiven a route file like:\n\n```tsx\n// src/routes/about.tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/about')({\n  loader: () => fetchAboutData(),\n  component: () => <div>About page</div>,\n})\n```\n\nThe plugin produces up to three modules from the **same physical file**:\n\n| Module                                    | What it contains                                                                                                                                                                                       |\n| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `about.tsx` (reference)                   | Route config with `component` replaced by `lazyRouteComponent($$splitComponentImporter, 'component')` and an injected `const $$splitComponentImporter = () => import('about.tsx?tsr-split=component')` |\n| `about.tsx?tsr-split=component` (virtual) | Only the component function, exported as `component`                                                                                                                                                   |\n| `about.tsx?tsr-shared=1` (shared)         | Optional; created only when bindings are shared between split and non-split properties                                                                                                                 |\n\nThe bundler (Vite, Webpack, Rspack) treats query-parameterized imports as\ndistinct modules, so `about.tsx` and `about.tsx?tsr-split=component` are\nseparate entries in the module graph — each transformed differently by the\ncorresponding plugin.\n\n### Why This Exists\n\nWithout code-splitting, every route's component tree ships in the initial\nbundle. For large applications with dozens of routes, this means megabytes\nof JavaScript the user downloads but never executes until they navigate to\nthat specific route. Automatic code-splitting solves this by:\n\n1. Replacing component/loader values with lazy wrappers (dynamic `import()`)\n2. Stripping the original implementations via dead-code elimination\n3. Producing separate modules (typically separate chunks) the bundler can load on demand\n\n---\n\n## Architecture Diagram\n\n```mermaid\nflowchart TB\n    subgraph \"Physical File System\"\n        RF[\"src/routes/about.tsx<br/>(original source)\"]\n    end\n\n    subgraph \"Plugin 1: compile-reference-file\"\n        P1[\"Transform about.tsx<br/>• computeSharedBindings()<br/>• compileCodeSplitReferenceRoute()\"]\n    end\n\n    subgraph \"Plugin 2: compile-virtual-file\"\n        P2[\"Transform about.tsx?tsr-split=component<br/>• compileCodeSplitVirtualRoute()\"]\n    end\n\n    subgraph \"Plugin 3: compile-shared-file\"\n        P3[\"Transform about.tsx?tsr-shared=1<br/>• compileCodeSplitSharedRoute()\"]\n    end\n\n    SBM[(\"sharedBindingsMap<br/>(closure-shared Map)\")]\n\n    RF --> P1\n    P1 -->|\"writes shared bindings\"| SBM\n    P1 -->|\"emits import('...?tsr-split=...')\"| P2\n    P1 -->|\"emits import('...?tsr-shared=1')\\n(only when needed)\"| P3\n    SBM -->|\"reads shared bindings\"| P2\n    SBM -->|\"reads shared bindings\"| P3\n\n    subgraph \"Bundler Output\"\n        REF[\"Reference module<br/>(Route config + lazy wrappers)\"]\n        SPLIT[\"Split module(s)<br/>(component, errorComponent, etc.)\"]\n        SHARED[\"Shared module<br/>(shared bindings, if any)\"]\n    end\n\n    P1 --> REF\n    P2 --> SPLIT\n    P3 --> SHARED\n```\n\n---\n\n## Plugin Pipeline\n\n`unpluginRouterCodeSplitterFactory` (in `router-code-splitter-plugin.ts`)\nreturns an **array of 3 plugins** that share a closure containing:\n\n- `sharedBindingsMap: Map<string, Set<string>>` — maps normalized file paths\n  to their computed shared binding names\n- `userConfig` — resolved plugin configuration\n- Helper functions for grouping resolution\n\n### Plugin 1: `tanstack-router:code-splitter:compile-reference-file`\n\n**Filter:** File IDs matching `/\\.(m|c)?(j|t)sx?$/` whose code contains one of\n`createFileRoute(`, `createRootRoute(`, or `createRootRouteWithContext(`.\nExcludes file IDs that include `tsr-split` or `tsr-shared`.\n\n**What it does:**\n\n1. Detects per-route `codeSplitGroupings` if specified inline\n2. Calls `computeSharedBindings()` and caches the result in `sharedBindingsMap`\n3. Calls `compileCodeSplitReferenceRoute()` which:\n   - Replaces split properties with `lazyRouteComponent()` / `lazyFn()` wrappers\n   - Injects `import()` expressions pointing to `?tsr-split=<encoded>` URLs\n   - Removes shared binding declarations, replacing them with\n     `import { ... } from '...?tsr-shared=1'`\n   - Re-exports any user-exported shared bindings via\n     `export { ... } from '...?tsr-shared=1'`\n   - Runs dead-code elimination\n   - Optionally appends HMR handling code (dev mode)\n\n**Vite hooks:**\n\n- `configResolved`: Validates plugin ordering (router must come before JSX\n  transformation plugins like `@vitejs/plugin-react`)\n- `applyToEnvironment`: Scopes the plugin to a specific Vite environment when\n  `plugin.vite.environmentName` is configured (needed for TanStack Start which\n  creates separate client/SSR plugin instances)\n\n### Plugin 2: `tanstack-router:code-splitter:compile-virtual-file`\n\n**Filter:** File IDs containing `tsr-split`.\n\n**What it does:**\n\n1. Extracts the grouping from the `?tsr-split=<encoded>` query parameter\n2. Decodes it via `decodeIdentifier()` to get the list of properties this\n   virtual file should export (e.g., `['component']`)\n3. Reads shared bindings from `sharedBindingsMap` for the base file\n4. Calls `compileCodeSplitVirtualRoute()` which:\n   - Removes shared binding declarations before traversal (prevents scope\n     collision crashes)\n   - Keeps only the intended split properties as named exports\n   - Converts user-exported declarations to imports from the base file\n   - Adds `import { ... } from '...?tsr-shared=1'` if shared bindings exist\n   - Runs dead-code elimination\n   - Strips orphaned expression statements\n\n**Vite hooks:**\n\n- `applyToEnvironment`: Same environment scoping behavior as the reference\n  plugin.\n\n### Plugin 3: `tanstack-router:code-splitter:compile-shared-file`\n\n**Filter:** File IDs containing `tsr-shared`.\n\n**What it does:**\n\n1. Extracts the base file path from the ID\n2. Looks up shared bindings from `sharedBindingsMap`\n3. Calls `compileCodeSplitSharedRoute()` which:\n   - Keeps only declarations of shared bindings and their transitive\n     dependencies\n   - Strips `export` wrappers from kept declarations\n   - Adds a single `export { ... }` statement for all shared bindings\n   - Runs dead-code elimination to remove unused imports\n\n**Vite hooks:**\n\n- `applyToEnvironment`: Same environment scoping behavior as the reference\n  plugin.\n\n---\n\n## Virtual File Mechanism\n\nThe system does **not** create actual virtual files. Instead, it leverages\nthe fact that bundlers (Vite, Webpack, Rspack) treat the same physical file\nwith different query parameters as distinct module IDs:\n\n```\nsrc/routes/about.tsx                        → Module A (reference)\nsrc/routes/about.tsx?tsr-split=component    → Module B (virtual/split)\nsrc/routes/about.tsx?tsr-shared=1           → Module C (shared)\n```\n\nAll three modules start from the **same source code** — the bundler reads the\nphysical file each time. Each plugin's `transform` filter matches on different\nquery parameters, so each module gets a different transformation applied.\n\n### Path ID Encoding\n\nThe `?tsr-split` query parameter value is an encoded representation of the\nsplit grouping. The encoding (in `path-ids.ts`) works as follows:\n\n1. Sort the property names alphabetically (grouping order is not preserved)\n2. Join with `---` delimiter\n3. Replace unsafe URL characters with safe tokens:\n   - `/` → `--slash--`\n   - `?` → `--question--`\n   - `#` → `--hash--`\n   - etc.\n\nFor example, a grouping of `['component']` becomes `?tsr-split=component`.\nA combined grouping of `['component', 'errorComponent']` becomes\n`?tsr-split=component---errorComponent`.\n\nThe decoding is the inverse: `decodeIdentifier()` reverses the token\nreplacements and splits on `---`.\n\nNote: this encoding is not a general-purpose reversible scheme (it maps spaces\nto `_` and decodes `_` back to spaces). It's safe here because split grouping\nstrings are known route option keys like `component` and `loader`.\n\n### Resolution Flow\n\nWhen the reference compiler emits:\n\n```js\nconst $$splitComponentImporter = () => import('about.tsx?tsr-split=component')\n```\n\nThe bundler:\n\n1. Resolves `about.tsx?tsr-split=component` to the physical file `about.tsx`\n   with the query parameter preserved\n2. Reads the source of `about.tsx`\n3. Runs the transform pipeline — Plugin 2 matches (`tsr-split` in ID) and\n   transforms it into a module that exports only `component`\n4. The result is a separate module in the output graph (often a separate chunk, depending on bundler chunking)\n\n---\n\n## Shared Bindings System\n\n### The Problem\n\nConsider a route file with a module-level variable used by both the `loader`\n(non-split by default) and the `component` (split by default):\n\n```tsx\nconst cache = new Map()\nfunction getCached(key: string) {\n  return cache.get(key)\n}\nfunction setCached(key: string, val: unknown) {\n  cache.set(key, val)\n}\n\nexport const Route = createFileRoute('/cached')({\n  loader: async () => {\n    setCached('data', await fetch('/api').then((r) => r.json()))\n    return getCached('data')\n  },\n  component: () => <div>{JSON.stringify(getCached('data'))}</div>,\n})\n```\n\nWithout the shared bindings system, `cache` and `getCached` would be\n**duplicated** — one copy in the reference module (used by `loader`) and another\nin the split component module. Each would have its own `Map` instance, so\n`setCached` in the loader would write to a different map than `getCached` in\nthe component reads from. This is a **correctness bug**, not just a bundle\nsize issue.\n\n### The Solution\n\n`computeSharedBindings()` identifies bindings that are referenced by properties\nin 2+ distinct \"groups\" (where each split grouping index is one group, and all\nnon-split properties form group `-1`). These bindings are extracted into a\nthird virtual module (`?tsr-shared=1`) that both the reference module and the\nsplit modules import from, ensuring a single shared instance.\n\n### How `computeSharedBindings()` Works\n\n**Location:** `src/core/code-splitter/compilers.ts` (`computeSharedBindings`)\n\n**Algorithm:**\n\n1. **Collect local bindings** — Cheap loop over `program.body` to find all\n   module-level `const`/`let`/`var`/`function`/`class` declarations. Deletes\n   `Route` from the set (must never be extracted). If no local bindings\n   remain, returns empty set immediately (fast path).\n\n2. **Find route options** — Uses `babel.traverse` to locate the\n   `createFileRoute('/')({ ... })` call and extract the options object.\n\n3. **Fast path: group count check** — Iterates over route option properties,\n   tracking whether any non-split properties exist, and counting distinct\n   split group indices.\n   - If there are no non-split properties and fewer than 2 split groups are\n     present, nothing can be shared and it returns an empty set.\n\n4. **Build dependency graph** — `buildDependencyGraph()` creates a map from\n   each local binding to the set of other local bindings it references. Uses\n   `collectIdentifiersFromNode()` (a fast recursive walker, much cheaper than\n   `babel.traverse`) for each declaration.\n\n5. **Attribute bindings to groups** — For each route option property:\n   - Collects direct module-level references from the property value\n   - Expands transitively via the dependency graph (BFS)\n   - Records which group index each binding belongs to\n\n6. **Identify shared bindings** — Any binding appearing in 2+ distinct groups\n   is shared.\n\n7. **Handle destructured declarators** — If bindings from the same\n   `const { a, b } = fn()` appear in different groups, the entire declarator\n   must be shared (can't split the initialization).\n\n8. **Expand destructured declarations** — If any binding in a destructured\n   pattern is shared, all bindings in that pattern must be shared.\n\n9. **Remove Route-dependent bindings** — `removeBindingsDependingOnRoute()`\n   builds a reverse dependency graph, walks backwards from `Route` via BFS,\n   and removes any shared binding that transitively depends on `Route`. This\n   prevents Route duplication in the shared module.\n\n### Concrete Example\n\n**Input** (`shared-function.tsx`):\n\n```tsx\nimport { createFileRoute } from '@tanstack/react-router'\n\nconst cache = new Map()\nfunction getCached(key: string) {\n  return cache.get(key)\n}\nfunction setCached(key: string, val: unknown) {\n  cache.set(key, val)\n}\n\nexport const Route = createFileRoute('/cached')({\n  loader: async () => {\n    setCached('data', await fetch('/api').then((r) => r.json()))\n    return getCached('data')\n  },\n  component: () => <div>{JSON.stringify(getCached('data'))}</div>,\n})\n```\n\n**Analysis:**\n\n- `loader` is non-split (group `-1`), references: `setCached`, `getCached`\n- `component` is split (group `0`), references: `getCached`\n- `getCached` appears in groups `-1` and `0` → **shared**\n- `getCached` depends on `cache` → `cache` is transitively shared\n- `setCached` appears only in group `-1` → **not shared**\n\n**Output — Reference file** (`shared-function.tsx`):\n\n```tsx\nimport { getCached, cache } from 'shared-function.tsx?tsr-shared=1'\nconst $$splitComponentImporter = () =>\n  import('shared-function.tsx?tsr-split=component')\nimport { lazyRouteComponent } from '@tanstack/react-router'\nimport { createFileRoute } from '@tanstack/react-router'\nfunction setCached(key: string, val: unknown) {\n  cache.set(key, val)\n}\nexport const Route = createFileRoute('/cached')({\n  loader: async () => {\n    setCached('data', await fetch('/api').then((r) => r.json()))\n    return getCached('data')\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n})\n```\n\n**Output — Split module** (`shared-function.tsx?tsr-split=component`):\n\n```tsx\nimport { getCached } from 'shared-function.tsx?tsr-shared=1'\nconst SplitComponent = () => <div>{JSON.stringify(getCached('data'))}</div>\nexport { SplitComponent as component }\n```\n\n**Output — Shared module** (`shared-function.tsx?tsr-shared=1`):\n\n```tsx\nconst cache = new Map()\nfunction getCached(key: string) {\n  return cache.get(key)\n}\nexport { cache, getCached }\n```\n\nNote how `setCached` is **not** in the shared module — it's only used by\n`loader` (non-split), so it stays in the reference file. The reference file\nimports `cache` (needed by `setCached`) from the shared module.\n\n### Cross-Plugin Communication\n\nThe three plugins share a closure containing `sharedBindingsMap`:\n\n```\nPlugin 1 (reference): computeSharedBindings() → sharedBindingsMap.set(id, bindings)\nPlugin 2 (virtual):   sharedBindingsMap.get(baseId) → pass to compileCodeSplitVirtualRoute()\nPlugin 3 (shared):    sharedBindingsMap.get(baseId) → pass to compileCodeSplitSharedRoute()\n```\n\nThis works because all three plugins run in the same JavaScript process and\nthe map is captured by closure. In typical builds, the reference module is\ntransformed first and then the bundler resolves the emitted dynamic imports,\nwhich triggers transformations for the virtual/shared module IDs.\n\n---\n\n## Code Split Groupings\n\n### Default Groupings\n\nDefined in `constants.ts`:\n\n```ts\nexport const defaultCodeSplitGroupings: CodeSplitGroupings = [\n  ['component'], // group 0 → separate module ID (often a separate chunk)\n  ['errorComponent'], // group 1 → separate module ID (often a separate chunk)\n  ['notFoundComponent'], // group 2 → separate module ID (often a separate chunk)\n]\n```\n\n**Important:** `loader` is **not** split by default. It stays in the reference\nfile alongside non-split properties like `beforeLoad`, `validateSearch`,\n`context`, etc.\n\n### Splittable Properties\n\nOnly these 5 properties can be split (defined in `splitRouteIdentNodes`):\n\n- `loader`\n- `component`\n- `pendingComponent`\n- `errorComponent`\n- `notFoundComponent`\n\nAny property not in `splitRouteIdentNodes` is never split, regardless of\nconfiguration.\n\n### How Groupings Work\n\nEach array within the groupings array represents one split module ID.\nProperties in the same inner array end up in the same split module:\n\n```ts\n// Default: 3 separate split module IDs (often 3 separate chunks)\n;[['component'], ['errorComponent'], ['notFoundComponent']][\n  // Combined: component + loader in one module, error in another\n  (['component', 'loader'], ['errorComponent'])\n][\n  // All in one module\n  ['component', 'loader', 'errorComponent', 'notFoundComponent']\n]\n```\n\n### Configuring Groupings\n\nThere are three levels of configuration, applied with this priority:\n\n1. **Per-route inline** (highest priority):\n\n   ```tsx\n   export const Route = createFileRoute('/about')({\n     codeSplitGroupings: [['component', 'loader']],\n     component: ...,\n     loader: ...,\n   })\n   ```\n\n2. **Per-route via plugin** (`splitBehavior` callback):\n\n   ```ts\n   tanstackRouter({\n     codeSplittingOptions: {\n       splitBehavior: ({ routeId }) => {\n         if (routeId === '/dashboard') return [['component', 'loader']]\n         return undefined // use default\n       },\n     },\n   })\n   ```\n\n3. **Global default** (`defaultBehavior`):\n   ```ts\n   tanstackRouter({\n     codeSplittingOptions: {\n       defaultBehavior: [['component', 'loader'], ['errorComponent']],\n     },\n   })\n   ```\n\n### `findIndexForSplitNode()`\n\nThis function determines which group a property belongs to:\n\n```ts\nfunction findIndexForSplitNode(str: string) {\n  return opts.codeSplitGroupings.findIndex((group) =>\n    group.includes(str as any),\n  )\n}\n```\n\nReturns the group index (`0`, `1`, `2`, ...) for split properties, or `-1`\nfor properties not in any group (non-split properties like `beforeLoad`,\n`validateSearch`, `context`, etc.).\n\nThe group index `-1` is treated as its own group in the shared bindings\ncomputation — it represents \"stays in the reference file.\"\n\n---\n\n## Compiler Functions Reference\n\nAll compiler functions live in `compilers.ts`.\n\n### `compileCodeSplitReferenceRoute()`\n\n**Purpose:** Transform the original route file into the \"reference\" module.\n\n**Input:** Original source code, split groupings, framework target, options.\n\n**Output:** Modified source where split properties are replaced with lazy\nwrappers, shared bindings are replaced with imports, and dead code is\neliminated.\n\n**Key steps:**\n\n1. Parse AST, collect `findReferencedIdentifiers()` for DCE\n2. For each split-able property in route options:\n   - Check if the value is exported (if so, skip splitting — warn user)\n   - Generate a dynamic import URL: `addSplitSearchParamToFilename()`\n   - Create importer: `const $$splitComponentImporter = () => import('...')`\n   - Replace property value with `lazyRouteComponent(importer, 'component')`\n     or `lazyFn(importer, 'loader')`\n3. Remove unused import paths\n4. If shared bindings exist:\n   - Remove shared declarations from AST\n   - Add `import { ... } from '...?tsr-shared=1'`\n   - Re-export user-exported shared bindings\n5. Run `deadCodeElimination()`\n6. Generate output code with source maps\n\n### `compileCodeSplitVirtualRoute()`\n\n**Purpose:** Transform a copy of the route file into a split module that\nexports only specific properties.\n\n**Input:** Original source code, split targets (e.g., `['component']`),\nshared bindings set.\n\n**Output:** A module that exports only the intended properties.\n\n**Key steps:**\n\n1. Parse AST, collect referenced identifiers\n2. **Remove shared declarations first** (before `babel.traverse`) — critical\n   to avoid `checkBlockScopedCollisions` crashes\n3. Track split-able nodes and their metadata\n4. For each intended split target:\n   - Resolve the property value through bindings\n   - Create a named export (e.g., `export { SplitComponent as component }`)\n5. Convert remaining user exports to imports from the base file\n6. Add shared bindings import if applicable\n7. Run `deadCodeElimination()`\n8. Strip orphaned expression statements\n9. Generate output with source maps\n\n### `compileCodeSplitSharedRoute()`\n\n**Purpose:** Produce the shared virtual module containing only the shared\nbinding declarations.\n\n**Input:** Original source code, set of shared binding names.\n\n**Output:** A module that declares and exports only shared bindings and their\ntransitive dependencies.\n\n**Key steps:**\n\n1. Parse AST, collect referenced identifiers\n2. Build dependency graph, expand shared bindings transitively\n3. Filter `program.body` to keep only:\n   - Import declarations (DCE removes unused ones)\n   - Declarations of bindings in the keep set\n4. Strip `export` wrappers from kept declarations\n5. Add `export { ... }` for all shared bindings\n6. Run `deadCodeElimination()`\n7. Generate output with source maps\n\n### `computeSharedBindings()`\n\n**Purpose:** Analyze a route file to determine which module-level bindings\nare referenced by multiple split groups.\n\nSee [Shared Bindings System](#shared-bindings-system) for the full algorithm.\n\n### `detectCodeSplitGroupingsFromRoute()`\n\n**Purpose:** Parse inline `codeSplitGroupings` from route options.\n\nTraverses the AST looking for a `codeSplitGroupings` property on the route\noptions object (supports both `createFileRoute` and `createRoute` call sites).\nIf found, extracts the array-of-arrays value and returns it.\n\n### Helper Functions\n\n| Function                                | Purpose                                                                                                        |\n| --------------------------------------- | -------------------------------------------------------------------------------------------------------------- |\n| `collectIdentifiersFromNode()`          | Fast recursive walker to collect referenced identifier names from any AST node. Cheaper than `babel.traverse`. |\n| `buildDeclarationMap()`                 | Maps binding name → AST declaration node for all module-level declarations.                                    |\n| `buildDependencyGraph()`                | Maps binding name → set of other local bindings it references.                                                 |\n| `expandTransitively()`                  | BFS expansion of a set through a dependency graph.                                                             |\n| `removeBindingsDependingOnRoute()`      | Reverse-graph BFS from `Route` to find and remove dependents.                                                  |\n| `expandDestructuredDeclarations()`      | If any binding in a destructured pattern is shared, mark all as shared.                                        |\n| `expandSharedDestructuredDeclarators()` | If bindings from same declarator appear in different groups, mark declarator as shared.                        |\n| `collectLocalBindingsFromStatement()`   | Collects locally-declared names from a statement (cheap, no traversal).                                        |\n| `collectModuleLevelRefsFromNode()`      | Intersects `collectIdentifiersFromNode()` with local module-level bindings.                                    |\n| `removeSharedDeclarations()`            | Filters shared binding declarations out of `program.body`.                                                     |\n| `findExportedSharedBindings()`          | Finds which shared bindings have `export` in the original source.                                              |\n\n---\n\n## Dead Code Elimination\n\nAfter each compiler transforms the AST, it runs `deadCodeElimination()` from\n`@tanstack/router-utils`. This is critical because:\n\n- The reference file no longer uses the component implementation (it was\n  replaced with a lazy wrapper), so the original component code and its\n  dependencies should be stripped.\n- The virtual file only exports specific properties, so everything else\n  (loader, beforeLoad, other components) should be stripped.\n- The shared file only keeps shared bindings, so everything else should be\n  stripped.\n\n### How It Works\n\n1. **`findReferencedIdentifiers(ast)`** — Collects all `Identifier` NodePaths\n   in the AST that are in a \"referenced\" position (not binding sites). Returns\n   a `Set<NodePath>`.\n\n2. **`deadCodeElimination(ast, refIdents)`** — Iterates over all bindings in\n   the program scope. For each binding, checks whether any of its references\n   are in `refIdents`. If not, the binding is unreferenced and its declaration\n   is removed. Repeats until no more bindings can be removed (handles chains\n   where removing one binding makes another unreferenced).\n\n### Import Registration for DCE\n\nWhen the compilers add new imports (for shared bindings, or convert exports\nto imports in virtual files), they must register the import specifier locals\nin `refIdents` so DCE can later decide whether to keep or remove them:\n\n```ts\nsharedImportPath.traverse({\n  Identifier(identPath) {\n    if (identPath.parentPath.isImportSpecifier() && identPath.key === 'local') {\n      refIdents.add(identPath)\n    }\n  },\n})\n```\n\nWithout this, DCE would have no path references for the new imports and would\nalways remove them.\n\n### Post-DCE Cleanup in Virtual Files\n\nDCE only removes unused **declarations**. Bare side-effect statements like\n`console.log(...)` survive even when no locally-bound names reference them.\nThe virtual compiler has an additional cleanup pass:\n\n```ts\nast.program.body = ast.program.body.filter((stmt) => {\n  if (!t.isExpressionStatement(stmt)) return true\n  const refs = collectIdentifiersFromNode(stmt)\n  return [...refs].some((name) => locallyBound.has(name))\n})\n```\n\nThis strips expression statements that don't reference any locally-bound name.\n\n### Directive Prologue Handling\n\nIf the file body is empty after DCE (virtual file where no properties matched),\ndirective prologues (`'use client'`, `'use strict'`) are also stripped:\n\n```ts\nif (ast.program.body.length === 0) {\n  ast.program.directives = []\n}\n```\n\n---\n\n## Framework Support\n\nThe code-splitting system is framework-agnostic at the Babel transform level.\nFramework differences are confined to `framework-options.ts`:\n\n| Framework | Package                  | `createFileRoute` | `lazyFn` | `lazyRouteComponent` |\n| --------- | ------------------------ | ----------------- | -------- | -------------------- |\n| React     | `@tanstack/react-router` | `createFileRoute` | `lazyFn` | `lazyRouteComponent` |\n| Solid     | `@tanstack/solid-router` | `createFileRoute` | `lazyFn` | `lazyRouteComponent` |\n| Vue       | `@tanstack/vue-router`   | `createFileRoute` | `lazyFn` | `lazyRouteComponent` |\n\nCurrently all frameworks use the same identifier names. The framework option\nis used to determine which package to import `lazyRouteComponent` and `lazyFn`\nfrom.\n\n### Plugin Order Validation (Vite only)\n\nThe reference plugin's `configResolved` hook checks that the TanStack Router\nplugin appears **before** JSX transformation plugins in the Vite config. This\nis required because the code-splitter must transform the source before JSX\nis compiled away. Validated plugins:\n\n- **React:** `@vitejs/plugin-react` (Babel), `@vitejs/plugin-react-swc` (SWC),\n  `@vitejs/plugin-react-oxc` (OXC)\n- **Solid:** `vite-plugin-solid`\n\nIf the order is wrong, the plugin throws an error with a suggested fix.\n\n### Environment Scoping\n\nWhen `userConfig.plugin?.vite?.environmentName` is set, all three plugins use\n`applyToEnvironment` to restrict themselves to that specific Vite environment.\nThis is necessary for TanStack Start, which creates separate plugin instances\nfor client and SSR environments.\n\n---\n\n## Edge Cases and Gotchas\n\n### 1. Exported Identifiers Are Not Split\n\nIf a value for a splittable route option is exported from the route file\n(e.g. `export const MyComp = ...` used as `component: MyComp`), the plugin\n**skips** splitting it. The value stays in the reference file and a warning is\nemitted:\n\n```\n[tanstack-router] These exports from \"about.tsx\" will not be code-split and will increase your bundle size:\n- MyComp\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.\n```\n\nThis is because other modules may import `MyComp` directly, and splitting it\nwould break those imports. (In dev, the warning is also injected into the\ncompiled output as a `console.warn` to make it obvious during local testing.)\n\n### 2. Root Routes Are Never Split\n\n`createRootRoute()` and `createRootRouteWithContext()` are in\n`unsplittableCreateRouteFns`. The reference compiler adds HMR handling but\nexits before attempting any code-splitting transforms.\n\n### 3. `undefined`, `null`, and `boolean` Values Are Kept In-Place\n\nProperties with these literal values are not split:\n\n```tsx\ncreateFileRoute('/about')({\n  component: undefined, // kept in reference\n  errorComponent: false, // kept in reference\n  notFoundComponent: null, // kept in reference\n})\n```\n\nThese represent \"fall back to parent route\" semantics and must not be moved.\n\n### 4. Destructured Declarations Must Be Shared Atomically\n\n```tsx\nconst { a, b } = createHelpers()\n```\n\nIf `a` is used by `component` (split) and `b` is used by `loader` (non-split),\nthe entire `const { a, b } = createHelpers()` declaration must go to the\nshared module. You can't split the initialization — calling `createHelpers()`\ntwice would be incorrect.\n\n### 5. Route-Dependent Bindings Cannot Be Shared\n\n```tsx\nconst routePath = Route.fullPath\nfunction useRouteStuff() {\n  return routePath\n}\n```\n\nEven if `useRouteStuff` is referenced by multiple groups, it cannot be\nextracted to the shared module because it depends on `Route`. Extracting it\nwould require `Route` in the shared module, duplicating the route singleton.\n`removeBindingsDependingOnRoute()` handles this via reverse-graph BFS.\n\n### 6. `removeSharedDeclarations` Must Run Before `babel.traverse` in Virtual Files\n\nIn `compileCodeSplitVirtualRoute()`, shared declarations are removed\n**before** `babel.traverse` runs:\n\n```ts\nif (opts.sharedBindings && opts.sharedBindings.size > 0) {\n  removeSharedDeclarations(ast, opts.sharedBindings)\n}\n\nbabel.traverse(ast, { ... })\n```\n\nIf done after, Babel's scope analysis would see both the shared declaration\nand the new shared import, causing a `checkBlockScopedCollisions` crash\n(duplicate `const` binding in the same scope).\n\n### 7. Directive Prologues Survive Code-Splitting\n\nBabel stores directives (like `'use client'`) in `program.directives`, not\nin `program.body`. They are preserved through all transforms automatically.\nThe only exception is when the body is completely empty after DCE — then\ndirectives are stripped too (a file with just `'use client'` and no code is\nuseless).\n\n### 8. Plugin Ordering in the Array Matters\n\nThe 3 plugins must be returned in order: reference, virtual, shared. The\nreference plugin populates `sharedBindingsMap` before the other two consume\nit. Bundlers process transforms in plugin array order for a given module ID.\n\n### 9. Imported Bindings Are Never Shared\n\n`computeSharedBindings()` only considers **locally-declared** module-level\nbindings. Import statements are handled by the bundler's module system — if\nboth the reference file and a virtual file import the same external module,\nthe bundler deduplicates that import automatically. No shared module needed.\n\n### 10. `SPLIT_NODES_CONFIG` — Split Strategy per Property\n\nEach splittable property has a configured split strategy:\n\n| Property            | Strategy             | Wrapper                                     |\n| ------------------- | -------------------- | ------------------------------------------- |\n| `component`         | `lazyRouteComponent` | Wraps with Suspense-compatible lazy loading |\n| `pendingComponent`  | `lazyRouteComponent` | Same                                        |\n| `errorComponent`    | `lazyRouteComponent` | Same                                        |\n| `notFoundComponent` | `lazyRouteComponent` | Same                                        |\n| `loader`            | `lazyFn`             | Wraps as a lazy function call               |\n\nComponents use `lazyRouteComponent` (framework-provided). In React this\nintegrates with Suspense-compatible lazy loading. Loaders use `lazyFn` which\nwraps the async function for deferred loading.\n\n### 11. Source Maps Are Preserved\n\nAll three compilers pass `sourceMaps: true` and `sourceFileName` to\n`generateFromAst()`, ensuring the browser's devtools can map back to the\noriginal source file.\n\n---\n\n## Module Graph Diagrams\n\n### Simple Route (No Shared Bindings)\n\n```mermaid\ngraph LR\n    subgraph \"Reference Module\"\n        REF[\"about.tsx\"]\n    end\n\n    subgraph \"Split Module\"\n        COMP[\"about.tsx?tsr-split=component\"]\n    end\n\n    REF -->|\"() => import()\"| COMP\n```\n\nWhen the route has no module-level bindings shared between split and non-split\nproperties, there is no shared module. The reference module has a dynamic\nimport to the split module.\n\n### Route With Shared Bindings\n\n```mermaid\ngraph LR\n    subgraph \"Reference Module\"\n        REF[\"cached.tsx\"]\n    end\n\n    subgraph \"Split Module\"\n        COMP[\"cached.tsx?tsr-split=component\"]\n    end\n\n    subgraph \"Shared Module\"\n        SHARED[\"cached.tsx?tsr-shared=1\"]\n    end\n\n    REF -->|\"() => import()\"| COMP\n    REF -->|\"import { getCached, cache }\"| SHARED\n    COMP -->|\"import { getCached }\"| SHARED\n```\n\nThe shared module is imported synchronously by both the reference module and\nthe split module. Bundlers will usually dedupe this to a single module instance;\nwhether it becomes a separate chunk or gets inlined into another chunk depends\non the bundler's chunking strategy.\n\n### Route With Multiple Split Groups\n\n```mermaid\ngraph LR\n    subgraph \"Reference Module\"\n        REF[\"dashboard.tsx\"]\n    end\n\n    subgraph \"Split Modules\"\n        COMP[\"dashboard.tsx?tsr-split=component\"]\n        ERR[\"dashboard.tsx?tsr-split=errorComponent\"]\n        NF[\"dashboard.tsx?tsr-split=notFoundComponent\"]\n    end\n\n    subgraph \"Shared Module\"\n        SHARED[\"?tsr-shared=1\"]\n    end\n\n    REF -->|\"() => import()\"| COMP\n    REF -->|\"() => import()\"| ERR\n    REF -->|\"() => import()\"| NF\n    REF --> SHARED\n    COMP --> SHARED\n    ERR --> SHARED\n    NF --> SHARED\n```\n\nEach split group gets its own split module. If a binding is shared across any\ntwo of these (or between a split module and the reference module), it lives in\nthe shared module.\n\n### Combined Groupings\n\n```mermaid\ngraph LR\n    subgraph \"Reference Module\"\n        REF[\"page.tsx\"]\n    end\n\n    subgraph \"Split Module\"\n        COMBINED[\"page.tsx?tsr-split=component---loader\"]\n    end\n\n    REF -->|\"() => import()\"| COMBINED\n```\n\nWhen `component` and `loader` are in the same grouping\n(`[['component', 'loader']]`), they end up in a single split module. This\nreduces the number of split modules (and likely requests) at the cost of\nloading the loader even when only the component is needed (and vice versa).\n\n---\n\n## Key Source Files\n\n| File                                          | Description                                                                  |\n| --------------------------------------------- | ---------------------------------------------------------------------------- |\n| `src/core/router-code-splitter-plugin.ts`     | Plugin factory — creates 3 plugins, manages `sharedBindingsMap`              |\n| `src/core/code-splitter/compilers.ts`         | All compiler functions (~1,970 lines)                                        |\n| `src/core/constants.ts`                       | `tsrSplit`, `tsrShared`, `splitRouteIdentNodes`, `defaultCodeSplitGroupings` |\n| `src/core/code-splitter/framework-options.ts` | Per-framework package/ident configuration                                    |\n| `src/core/code-splitter/path-ids.ts`          | URL-safe encoding/decoding for split identifiers                             |\n| `src/core/config.ts`                          | Plugin configuration types and validation                                    |\n| `src/core/route-hmr-statement.ts`             | HMR handling code template                                                   |\n| `tests/code-splitter/`                        | Unit tests and snapshot fixtures                                             |\n"
  },
  {
    "path": "packages/router-plugin/CHANGELOG.md",
    "content": "# @tanstack/router-plugin\n\n## 1.167.1\n\n### Patch Changes\n\n- Updated dependencies [[`91cc628`](https://github.com/TanStack/router/commit/91cc62899b75ca920fe83c5ee7f3dbb5c71a523f)]:\n  - @tanstack/react-router@1.168.1\n  - @tanstack/router-core@1.168.1\n  - @tanstack/router-generator@1.166.15\n\n## 1.167.0\n\n### Minor Changes\n\n- remove pendingMatches, cachedMatches ([#6704](https://github.com/TanStack/router/pull/6704))\n  move to signal-based reactivity\n  solid uses its own native signals\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/react-router@1.168.0\n  - @tanstack/router-core@1.168.0\n  - @tanstack/router-generator@1.166.14\n\n## 1.166.14\n\n### Patch Changes\n\n- Updated dependencies [[`5ff4f0b`](https://github.com/TanStack/router/commit/5ff4f0b8dce1fac2bb0b0bfe2684fc677a8ee505)]:\n  - @tanstack/router-core@1.167.5\n  - @tanstack/react-router@1.167.5\n  - @tanstack/router-generator@1.166.13\n\n## 1.166.13\n\n### Patch Changes\n\n- Add @tanstack/intent AI agent skills and CLI entry points for Router and Start packages ([#6866](https://github.com/TanStack/router/pull/6866))\n\n- Updated dependencies [[`940151c`](https://github.com/TanStack/router/commit/940151cbed0c76c92a5cf196c0905b17a956ca7e)]:\n  - @tanstack/router-core@1.167.4\n  - @tanstack/react-router@1.167.4\n  - @tanstack/virtual-file-routes@1.161.7\n  - @tanstack/router-generator@1.166.12\n\n## 1.166.12\n\n### Patch Changes\n\n- Updated dependencies [[`32fcba7`](https://github.com/TanStack/router/commit/32fcba7b044b03f5901308b870f70b0b4910c220)]:\n  - @tanstack/router-core@1.167.3\n  - @tanstack/react-router@1.167.3\n  - @tanstack/router-generator@1.166.11\n\n## 1.166.11\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/react-router@1.167.2\n  - @tanstack/router-core@1.167.2\n  - @tanstack/router-generator@1.166.10\n  - @tanstack/router-utils@1.161.6\n  - @tanstack/virtual-file-routes@1.161.6\n\n## 1.166.10\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/virtual-file-routes@1.161.5\n  - @tanstack/router-generator@1.166.9\n  - @tanstack/react-router@1.167.1\n  - @tanstack/router-utils@1.161.5\n  - @tanstack/router-core@1.167.1\n\n## 1.166.9\n\n### Patch Changes\n\n- Updated dependencies [[`6f297a2`](https://github.com/TanStack/router/commit/6f297a249424c0fd1c1a56aa4fc12c8217be7b6a)]:\n  - @tanstack/router-core@1.167.0\n  - @tanstack/react-router@1.167.0\n  - @tanstack/router-generator@1.166.8\n\n## 1.166.8\n\n### Patch Changes\n\n- fix: hoist inline component definitions for proper React HMR#6919 ([#6919](https://github.com/TanStack/router/pull/6919))\n\n- Updated dependencies [[`6069eba`](https://github.com/TanStack/router/commit/6069eba64369dbddb0d8dccdb4407f0e1a82259e)]:\n  - @tanstack/react-router@1.166.8\n  - @tanstack/router-generator@1.166.7\n"
  },
  {
    "path": "packages/router-plugin/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack Router Plugin\n\nSee https://tanstack.com/router/latest/docs/framework/react/routing/file-based-routing\n\n## Installation\n\n```bash\nnpm install -D @tanstack/router-plugin\n```\n\nSee https://tanstack.com/router/latest/docs/framework/react/routing/installation/with-router-cli for usage instructions.\n"
  },
  {
    "path": "packages/router-plugin/bin/intent.js",
    "content": "#!/usr/bin/env node\n// Auto-generated by @tanstack/intent setup\n// Exposes the intent end-user CLI for consumers of this library.\n// Commit this file, then add to your package.json:\n//   \"bin\": { \"intent\": \"./bin/intent.js\" }\ntry {\n  await import('@tanstack/intent/intent-library')\n} catch (e) {\n  const isModuleNotFound =\n    e?.code === 'ERR_MODULE_NOT_FOUND' || e?.code === 'MODULE_NOT_FOUND'\n  const missingIntentLibrary =\n    typeof e?.message === 'string' && e.message.includes('@tanstack/intent')\n\n  if (isModuleNotFound && missingIntentLibrary) {\n    console.error('@tanstack/intent is not installed.')\n    console.error('')\n    console.error('Install it as a dev dependency:')\n    console.error('  npm add -D @tanstack/intent')\n    console.error('')\n    console.error('Or run directly:')\n    console.error('  npx @tanstack/intent@latest list')\n    process.exit(1)\n  }\n  throw e\n}\n"
  },
  {
    "path": "packages/router-plugin/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/router-plugin/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-plugin\",\n  \"version\": \"1.167.1\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-plugin\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"clean:snapshots\": \"rimraf **/*snapshot* --glob\",\n    \"test\": \"pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit\",\n    \"test:unit\": \"vitest\",\n    \"test:unit:dev\": \"vitest --watch\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./vite\": {\n      \"import\": {\n        \"types\": \"./dist/esm/vite.d.ts\",\n        \"default\": \"./dist/esm/vite.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/vite.d.cts\",\n        \"default\": \"./dist/cjs/vite.cjs\"\n      }\n    },\n    \"./rspack\": {\n      \"import\": {\n        \"types\": \"./dist/esm/rspack.d.ts\",\n        \"default\": \"./dist/esm/rspack.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/rspack.d.cts\",\n        \"default\": \"./dist/cjs/rspack.cjs\"\n      }\n    },\n    \"./webpack\": {\n      \"import\": {\n        \"types\": \"./dist/esm/webpack.d.ts\",\n        \"default\": \"./dist/esm/webpack.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/webpack.d.cts\",\n        \"default\": \"./dist/cjs/webpack.cjs\"\n      }\n    },\n    \"./esbuild\": {\n      \"import\": {\n        \"types\": \"./dist/esm/esbuild.d.ts\",\n        \"default\": \"./dist/esm/esbuild.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/esbuild.d.cts\",\n        \"default\": \"./dist/cjs/esbuild.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\",\n    \"skills\",\n    \"bin\",\n    \"!skills/_artifacts\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@babel/core\": \"^7.28.5\",\n    \"@babel/plugin-syntax-jsx\": \"^7.27.1\",\n    \"@babel/plugin-syntax-typescript\": \"^7.27.1\",\n    \"@babel/template\": \"^7.27.2\",\n    \"@babel/traverse\": \"^7.28.5\",\n    \"@babel/types\": \"^7.28.5\",\n    \"@tanstack/router-core\": \"workspace:*\",\n    \"@tanstack/router-generator\": \"workspace:*\",\n    \"@tanstack/router-utils\": \"workspace:*\",\n    \"@tanstack/virtual-file-routes\": \"workspace:*\",\n    \"chokidar\": \"^3.6.0\",\n    \"unplugin\": \"^2.1.2\",\n    \"zod\": \"^3.24.2\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/intent\": \"^0.0.14\",\n    \"@types/babel__core\": \"^7.20.5\",\n    \"@types/babel__template\": \"^7.4.4\",\n    \"@types/babel__traverse\": \"^7.28.0\"\n  },\n  \"peerDependencies\": {\n    \"@rsbuild/core\": \">=1.0.2\",\n    \"@tanstack/react-router\": \"workspace:^\",\n    \"vite\": \">=5.0.0 || >=6.0.0 || >=7.0.0\",\n    \"vite-plugin-solid\": \"^2.11.10\",\n    \"webpack\": \">=5.92.0\"\n  },\n  \"peerDependenciesMeta\": {\n    \"@rsbuild/core\": {\n      \"optional\": true\n    },\n    \"@tanstack/react-router\": {\n      \"optional\": true\n    },\n    \"vite\": {\n      \"optional\": true\n    },\n    \"vite-plugin-solid\": {\n      \"optional\": true\n    },\n    \"webpack\": {\n      \"optional\": true\n    }\n  },\n  \"bin\": {\n    \"intent\": \"./bin/intent.js\"\n  }\n}\n"
  },
  {
    "path": "packages/router-plugin/skills/_artifacts/domain_map.yaml",
    "content": "# domain_map.yaml\n# Library: @tanstack/router-plugin\n# Version: 1.166.2\n# Date: 2026-03-08\n# Status: reviewed\n\nlibrary:\n  name: '@tanstack/router-plugin'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Bundler plugin for route generation and automatic code splitting.\n    Supports Vite, Webpack, Rspack, and esbuild via unplugin.\n  primary_framework: 'framework-agnostic'\n\ndomains:\n  - name: 'Bundler Integration'\n    slug: 'bundler-integration'\n    description: >-\n      Route generation and code splitting via bundler plugins.\n      Vite, Webpack, Rspack, esbuild support through unplugin.\n\nskills:\n  - name: 'Router Plugin'\n    slug: 'router-plugin'\n    domain: 'bundler-integration'\n    description: >-\n      Bundler plugin for route generation and automatic code splitting.\n      Supports Vite, Webpack, Rspack, and esbuild via unplugin.\n    type: core\n    packages:\n      - '@tanstack/router-plugin'\n    covers:\n      - TanStackRouterVite plugin\n      - TanStackRouterWebpack plugin\n      - TanStackRouterRspack plugin\n      - TanStackRouterEsbuild plugin\n      - Automatic route code generation\n      - Automatic code splitting\n      - Route tree configuration options\n    tasks:\n      - 'Configure route generation in Vite'\n      - 'Configure route generation in Webpack/Rspack'\n      - 'Enable automatic code splitting'\n    failure_modes:\n      - mistake: 'Using wrong plugin export for bundler'\n        mechanism: >-\n          Each bundler has its own export (TanStackRouterVite,\n          TanStackRouterWebpack, etc). Using the wrong one causes\n          build failures.\n        priority: HIGH\n        status: active\n\n      - mistake: 'Misconfiguring routesDirectory or generatedRouteTree'\n        mechanism: >-\n          routesDirectory must point to the actual routes folder and\n          generatedRouteTree to the desired output path. Wrong paths\n          cause missing routes or stale route trees.\n        priority: MEDIUM\n        status: active\n\ngaps: []\n"
  },
  {
    "path": "packages/router-plugin/skills/_artifacts/skill_spec.md",
    "content": "# @tanstack/router-plugin — Skill Spec\n\nBundler plugin for route generation and automatic code splitting. Supports Vite, Webpack, Rspack, and esbuild via unplugin.\n\n## Domains\n\n| Domain              | Description                                             | Skills        |\n| ------------------- | ------------------------------------------------------- | ------------- |\n| Bundler Integration | Route generation and code splitting via bundler plugins | router-plugin |\n\n## Skill Inventory\n\n| Skill         | Type | Domain              | What it covers                                                 | Failure modes |\n| ------------- | ---- | ------------------- | -------------------------------------------------------------- | ------------- |\n| router-plugin | core | bundler-integration | Vite/Webpack/Rspack/esbuild plugins, route gen, code splitting | 2             |\n\n## Failure Mode Inventory\n\n### router-plugin (2 failure modes)\n\n| #   | Mistake                                              | Priority | Source      |\n| --- | ---------------------------------------------------- | -------- | ----------- |\n| 1   | Using wrong plugin export for bundler                | HIGH     | source/docs |\n| 2   | Misconfiguring routesDirectory or generatedRouteTree | MEDIUM   | source/docs |\n"
  },
  {
    "path": "packages/router-plugin/skills/_artifacts/skill_tree.yaml",
    "content": "library:\n  name: '@tanstack/router-plugin'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Bundler plugin for route generation and automatic code splitting.\n    Supports Vite, Webpack, Rspack, and esbuild via unplugin.\ngenerated_at: '2026-03-08'\nskills:\n  - name: 'Router Plugin'\n    slug: 'router-plugin'\n    type: 'core'\n    domain: 'bundler-integration'\n    path: 'skills/router-plugin/SKILL.md'\n    package: 'packages/router-plugin'\n    description: >-\n      Bundler plugin for route generation and automatic code splitting.\n      Supports Vite, Webpack, Rspack, and esbuild via unplugin.\n    sources:\n      - 'TanStack/router:packages/router-plugin/src'\n      - 'TanStack/router:docs/router/routing/file-based-routing.md'\n      - 'TanStack/router:docs/router/guide/code-splitting.md'\n"
  },
  {
    "path": "packages/router-plugin/skills/router-plugin/SKILL.md",
    "content": "---\nname: router-plugin\ndescription: >-\n  TanStack Router bundler plugin for route generation and automatic\n  code splitting. Supports Vite, Webpack, Rspack, and esbuild.\n  Configures autoCodeSplitting, routesDirectory, target framework,\n  and code split groupings.\ntype: core\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nsources:\n  - TanStack/router:packages/router-plugin/src\n  - TanStack/router:docs/router/routing/file-based-routing.md\n  - TanStack/router:docs/router/guide/code-splitting.md\n---\n\n# Router Plugin (`@tanstack/router-plugin`)\n\nBundler plugin that powers TanStack Router's file-based routing and automatic code splitting. Works with Vite, Webpack, Rspack, and esbuild via unplugin.\n\n> **CRITICAL**: The router plugin MUST come before the framework plugin (React, Solid, Vue) in the Vite config. Wrong order causes route generation and code splitting to fail silently.\n\n## Install\n\n```bash\nnpm install -D @tanstack/router-plugin\n```\n\n## Bundler Setup\n\n### Vite (most common)\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    // MUST come before react()\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n    react(),\n  ],\n})\n```\n\n### Webpack\n\n```ts\n// webpack.config.js\nconst { tanstackRouter } = require('@tanstack/router-plugin/webpack')\n\nmodule.exports = {\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n  ],\n}\n```\n\n### Rspack\n\n```ts\n// rspack.config.js\nconst { tanstackRouter } = require('@tanstack/router-plugin/rspack')\n\nmodule.exports = {\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n  ],\n}\n```\n\n### esbuild\n\n```ts\nimport { tanstackRouter } from '@tanstack/router-plugin/esbuild'\nimport esbuild from 'esbuild'\n\nesbuild.build({\n  plugins: [\n    tanstackRouter({\n      target: 'react',\n      autoCodeSplitting: true,\n    }),\n  ],\n})\n```\n\n## Configuration Options\n\n### Core Options\n\n| Option                  | Type                          | Default                    | Description                                |\n| ----------------------- | ----------------------------- | -------------------------- | ------------------------------------------ |\n| `target`                | `'react' \\| 'solid' \\| 'vue'` | `'react'`                  | Target framework                           |\n| `routesDirectory`       | `string`                      | `'./src/routes'`           | Directory containing route files           |\n| `generatedRouteTree`    | `string`                      | `'./src/routeTree.gen.ts'` | Path for generated route tree              |\n| `autoCodeSplitting`     | `boolean`                     | `undefined`                | Enable automatic code splitting            |\n| `enableRouteGeneration` | `boolean`                     | `true`                     | Set to `false` to disable route generation |\n\n### File Convention Options\n\n| Option                   | Type                                                    | Default     | Description                          |\n| ------------------------ | ------------------------------------------------------- | ----------- | ------------------------------------ |\n| `routeFilePrefix`        | `string`                                                | `undefined` | Prefix filter for route files        |\n| `routeFileIgnorePrefix`  | `string`                                                | `'-'`       | Prefix to exclude files from routing |\n| `routeFileIgnorePattern` | `string`                                                | `undefined` | Pattern to exclude from routing      |\n| `indexToken`             | `string \\| RegExp \\| { regex: string; flags?: string }` | `'index'`   | Token identifying index routes       |\n| `routeToken`             | `string \\| RegExp \\| { regex: string; flags?: string }` | `'route'`   | Token identifying route config files |\n\n### Code Splitting Options\n\n```ts\ntanstackRouter({\n  target: 'react',\n  autoCodeSplitting: true,\n  codeSplittingOptions: {\n    // Default groupings for all routes\n    defaultBehavior: [['component'], ['errorComponent'], ['notFoundComponent']],\n\n    // Per-route custom splitting\n    splitBehavior: ({ routeId }) => {\n      if (routeId === '/dashboard') {\n        // Keep loader and component together for dashboard\n        return [['loader', 'component'], ['errorComponent']]\n      }\n      // Return undefined to use defaultBehavior\n    },\n  },\n})\n```\n\n### Output Options\n\n| Option                      | Type                   | Default     | Description                                  |\n| --------------------------- | ---------------------- | ----------- | -------------------------------------------- |\n| `quoteStyle`                | `'single' \\| 'double'` | `'single'`  | Quote style in generated code                |\n| `semicolons`                | `boolean`              | `false`     | Use semicolons in generated code             |\n| `disableTypes`              | `boolean`              | `false`     | Disable TypeScript types                     |\n| `disableLogging`            | `boolean`              | `false`     | Suppress plugin logs                         |\n| `addExtensions`             | `boolean \\| string`    | `false`     | Add file extensions to imports               |\n| `enableRouteTreeFormatting` | `boolean`              | `true`      | Format generated route tree                  |\n| `verboseFileRoutes`         | `boolean`              | `undefined` | When `false`, auto-imports `createFileRoute` |\n\n### Virtual Route Config\n\n```ts\nimport { routes } from './routes'\n\ntanstackRouter({\n  target: 'react',\n  virtualRouteConfig: routes, // or './routes.ts'\n})\n```\n\n## How It Works\n\nThe composed plugin assembles up to 4 sub-plugins:\n\n1. **Route Generator** (always) — Watches route files and generates `routeTree.gen.ts`\n2. **Code Splitter** (when `autoCodeSplitting: true`) — Splits route files into lazy-loaded chunks using virtual modules\n3. **Auto-Import** (when `verboseFileRoutes: false`) — Auto-injects `createFileRoute` imports\n4. **HMR** (dev mode, when code splitter is off) — Hot-reloads route changes without full refresh\n\n## Individual Plugin Exports\n\nFor advanced use, each sub-plugin is exported separately from the Vite entry:\n\n```ts\nimport {\n  tanstackRouter, // Composed (default)\n  tanstackRouterGenerator, // Generator only\n  tanStackRouterCodeSplitter, // Code splitter only\n  tanstackRouterAutoImport, // Auto-import only\n} from '@tanstack/router-plugin/vite'\n```\n\n## Common Mistakes\n\n### 1. CRITICAL: Wrong plugin order in Vite config\n\nThe router plugin must come before the framework plugin. Otherwise, route generation and code splitting fail silently.\n\n```ts\n// WRONG — react() before tanstackRouter()\nplugins: [react(), tanstackRouter({ target: 'react' })]\n\n// CORRECT — tanstackRouter() first\nplugins: [tanstackRouter({ target: 'react' }), react()]\n```\n\n### 2. HIGH: Missing target option for non-React frameworks\n\nThe `target` defaults to `'react'`. For Solid or Vue, you must set it explicitly.\n\n```ts\n// WRONG for Solid — generates React imports\ntanstackRouter({ autoCodeSplitting: true })\n\n// CORRECT for Solid\ntanstackRouter({ target: 'solid', autoCodeSplitting: true })\n```\n\n### 3. MEDIUM: Confusing autoCodeSplitting with manual lazy routes\n\nWhen `autoCodeSplitting` is enabled, the plugin handles splitting automatically. You do NOT need manual `createLazyRoute` or `lazyRouteComponent` calls — the plugin transforms your route files at build time.\n\n```tsx\n// WRONG — manual lazy loading with autoCodeSplitting enabled\nconst LazyAbout = lazyRouteComponent(() => import('./about'))\n\n// CORRECT — just write normal route files, plugin handles splitting\n// src/routes/about.tsx\nexport const Route = createFileRoute('/about')({\n  component: AboutPage,\n})\n\nfunction AboutPage() {\n  return <h1>About</h1>\n}\n```\n\n## Cross-References\n\n- [router-core/code-splitting](../../../router-core/skills/router-core/code-splitting/SKILL.md) — manual code splitting concepts\n- [virtual-file-routes](../../../virtual-file-routes/skills/virtual-file-routes/SKILL.md) — programmatic route trees\n"
  },
  {
    "path": "packages/router-plugin/src/core/code-splitter/compilers.ts",
    "content": "import * as t from '@babel/types'\nimport * as babel from '@babel/core'\nimport * as template from '@babel/template'\nimport {\n  deadCodeElimination,\n  findReferencedIdentifiers,\n  generateFromAst,\n  parseAst,\n} from '@tanstack/router-utils'\nimport { tsrShared, tsrSplit } from '../constants'\nimport { routeHmrStatement } from '../route-hmr-statement'\nimport { createIdentifier } from './path-ids'\nimport { getFrameworkOptions } from './framework-options'\nimport type {\n  CompileCodeSplitReferenceRouteOptions,\n  ReferenceRouteCompilerPlugin,\n} from './plugins'\nimport type { GeneratorResult, ParseAstOptions } from '@tanstack/router-utils'\nimport type { CodeSplitGroupings, SplitRouteIdentNodes } from '../constants'\nimport type { Config, DeletableNodes } from '../config'\n\ntype SplitNodeMeta = {\n  routeIdent: SplitRouteIdentNodes\n  splitStrategy: 'lazyFn' | 'lazyRouteComponent'\n  localImporterIdent: string\n  exporterIdent: string\n  localExporterIdent: string\n}\nconst SPLIT_NODES_CONFIG = new Map<SplitRouteIdentNodes, SplitNodeMeta>([\n  [\n    'loader',\n    {\n      routeIdent: 'loader',\n      localImporterIdent: '$$splitLoaderImporter', // const $$splitLoaderImporter = () => import('...')\n      splitStrategy: 'lazyFn',\n      localExporterIdent: 'SplitLoader', // const SplitLoader = ...\n      exporterIdent: 'loader', // export { SplitLoader as loader }\n    },\n  ],\n  [\n    'component',\n    {\n      routeIdent: 'component',\n      localImporterIdent: '$$splitComponentImporter', // const $$splitComponentImporter = () => import('...')\n      splitStrategy: 'lazyRouteComponent',\n      localExporterIdent: 'SplitComponent', // const SplitComponent = ...\n      exporterIdent: 'component', // export { SplitComponent as component }\n    },\n  ],\n  [\n    'pendingComponent',\n    {\n      routeIdent: 'pendingComponent',\n      localImporterIdent: '$$splitPendingComponentImporter', // const $$splitPendingComponentImporter = () => import('...')\n      splitStrategy: 'lazyRouteComponent',\n      localExporterIdent: 'SplitPendingComponent', // const SplitPendingComponent = ...\n      exporterIdent: 'pendingComponent', // export { SplitPendingComponent as pendingComponent }\n    },\n  ],\n  [\n    'errorComponent',\n    {\n      routeIdent: 'errorComponent',\n      localImporterIdent: '$$splitErrorComponentImporter', // const $$splitErrorComponentImporter = () => import('...')\n      splitStrategy: 'lazyRouteComponent',\n      localExporterIdent: 'SplitErrorComponent', // const SplitErrorComponent = ...\n      exporterIdent: 'errorComponent', // export { SplitErrorComponent as errorComponent }\n    },\n  ],\n  [\n    'notFoundComponent',\n    {\n      routeIdent: 'notFoundComponent',\n      localImporterIdent: '$$splitNotFoundComponentImporter', // const $$splitNotFoundComponentImporter = () => import('...')\n      splitStrategy: 'lazyRouteComponent',\n      localExporterIdent: 'SplitNotFoundComponent', // const SplitNotFoundComponent = ...\n      exporterIdent: 'notFoundComponent', // export { SplitNotFoundComponent as notFoundComponent }\n    },\n  ],\n])\nconst KNOWN_SPLIT_ROUTE_IDENTS = [...SPLIT_NODES_CONFIG.keys()] as const\n\nfunction addSplitSearchParamToFilename(\n  filename: string,\n  grouping: Array<string>,\n) {\n  const [bareFilename] = filename.split('?')\n\n  const params = new URLSearchParams()\n  params.append(tsrSplit, createIdentifier(grouping))\n\n  const result = `${bareFilename}?${params.toString()}`\n  return result\n}\n\nfunction removeSplitSearchParamFromFilename(filename: string) {\n  const [bareFilename] = filename.split('?')\n  return bareFilename!\n}\n\nexport function addSharedSearchParamToFilename(filename: string) {\n  const [bareFilename] = filename.split('?')\n  return `${bareFilename}?${tsrShared}=1`\n}\n\nconst splittableCreateRouteFns = ['createFileRoute']\nconst unsplittableCreateRouteFns = [\n  'createRootRoute',\n  'createRootRouteWithContext',\n]\nconst allCreateRouteFns = [\n  ...splittableCreateRouteFns,\n  ...unsplittableCreateRouteFns,\n]\n\n/**\n * Recursively walk an AST node and collect referenced identifier-like names.\n * Much cheaper than babel.traverse — no path/scope overhead.\n *\n * Notes:\n * - Uses @babel/types `isReferenced` to avoid collecting non-references like\n *   object keys, member expression properties, or binding identifiers.\n * - Also handles JSX identifiers for component references.\n */\nexport function collectIdentifiersFromNode(node: t.Node): Set<string> {\n  const ids = new Set<string>()\n\n  ;(function walk(\n    n: t.Node | null | undefined,\n    parent?: t.Node,\n    grandparent?: t.Node,\n    parentKey?: string,\n  ) {\n    if (!n) return\n\n    if (t.isIdentifier(n)) {\n      // When we don't have parent info (node passed in isolation), treat as referenced.\n      if (!parent || t.isReferenced(n, parent, grandparent)) {\n        ids.add(n.name)\n      }\n      return\n    }\n\n    if (t.isJSXIdentifier(n)) {\n      // Skip attribute names: <div data-testid=\"x\" />\n      if (parent && t.isJSXAttribute(parent) && parentKey === 'name') {\n        return\n      }\n\n      // Skip member properties: <Foo.Bar /> should count Foo, not Bar\n      if (\n        parent &&\n        t.isJSXMemberExpression(parent) &&\n        parentKey === 'property'\n      ) {\n        return\n      }\n\n      // Intrinsic elements (lowercase) are not identifiers\n      const first = n.name[0]\n      if (first && first === first.toLowerCase()) {\n        return\n      }\n\n      ids.add(n.name)\n      return\n    }\n\n    for (const key of t.VISITOR_KEYS[n.type] || []) {\n      const child = (n as any)[key]\n      if (Array.isArray(child)) {\n        for (const c of child) {\n          if (c && typeof c.type === 'string') {\n            walk(c, n, parent, key)\n          }\n        }\n      } else if (child && typeof child.type === 'string') {\n        walk(child, n, parent, key)\n      }\n    }\n  })(node)\n\n  return ids\n}\n\n/**\n * Build a map from binding name → declaration AST node for all\n * locally-declared module-level bindings. Built once, O(1) lookup.\n */\nexport function buildDeclarationMap(ast: t.File): Map<string, t.Node> {\n  const map = new Map<string, t.Node>()\n  for (const stmt of ast.program.body) {\n    const decl =\n      t.isExportNamedDeclaration(stmt) && stmt.declaration\n        ? stmt.declaration\n        : stmt\n\n    if (t.isVariableDeclaration(decl)) {\n      for (const declarator of decl.declarations) {\n        for (const name of collectIdentifiersFromPattern(declarator.id)) {\n          map.set(name, declarator)\n        }\n      }\n    } else if (t.isFunctionDeclaration(decl) && decl.id) {\n      map.set(decl.id.name, decl)\n    } else if (t.isClassDeclaration(decl) && decl.id) {\n      map.set(decl.id.name, decl)\n    }\n  }\n  return map\n}\n\n/**\n * Build a dependency graph: for each local binding, the set of other local\n * bindings its declaration references. Built once via simple node walking.\n */\nexport function buildDependencyGraph(\n  declMap: Map<string, t.Node>,\n  localBindings: Set<string>,\n): Map<string, Set<string>> {\n  const graph = new Map<string, Set<string>>()\n  for (const [name, declNode] of declMap) {\n    if (!localBindings.has(name)) continue\n    const allIds = collectIdentifiersFromNode(declNode)\n    const deps = new Set<string>()\n    for (const id of allIds) {\n      if (id !== name && localBindings.has(id)) deps.add(id)\n    }\n    graph.set(name, deps)\n  }\n  return graph\n}\n\n/**\n * Computes module-level bindings that are shared between split and non-split\n * route properties. These bindings need to be extracted into a shared virtual\n * module to avoid double-initialization.\n *\n * A binding is \"shared\" if it is referenced by at least one split property\n * AND at least one non-split property. Only locally-declared module-level\n * bindings are candidates (not imports — bundlers dedupe those).\n */\nexport function computeSharedBindings(opts: {\n  code: string\n  codeSplitGroupings: CodeSplitGroupings\n}): Set<string> {\n  const ast = parseAst(opts)\n\n  // Early bailout: collect all module-level locally-declared binding names.\n  // This is a cheap loop over program.body (no traversal). If the file has\n  // no local bindings (aside from `Route`), nothing can be shared — skip\n  // the expensive babel.traverse entirely.\n  const localModuleLevelBindings = new Set<string>()\n  for (const node of ast.program.body) {\n    collectLocalBindingsFromStatement(node, localModuleLevelBindings)\n  }\n\n  // File-based routes always export a route config binding (usually `Route`).\n  // This must never be extracted into the shared module.\n  localModuleLevelBindings.delete('Route')\n\n  if (localModuleLevelBindings.size === 0) {\n    return new Set()\n  }\n\n  function findIndexForSplitNode(str: string) {\n    return opts.codeSplitGroupings.findIndex((group) =>\n      group.includes(str as any),\n    )\n  }\n\n  // Find the route options object — needs babel.traverse for scope resolution\n  let routeOptions: t.ObjectExpression | undefined\n\n  babel.traverse(ast, {\n    CallExpression(path) {\n      if (!t.isIdentifier(path.node.callee)) return\n      if (!splittableCreateRouteFns.includes(path.node.callee.name)) return\n\n      if (t.isCallExpression(path.parentPath.node)) {\n        const opts = resolveIdentifier(path, path.parentPath.node.arguments[0])\n        if (t.isObjectExpression(opts)) routeOptions = opts\n      } else if (t.isVariableDeclarator(path.parentPath.node)) {\n        const caller = resolveIdentifier(path, path.parentPath.node.init)\n        if (t.isCallExpression(caller)) {\n          const opts = resolveIdentifier(path, caller.arguments[0])\n          if (t.isObjectExpression(opts)) routeOptions = opts\n        }\n      }\n    },\n  })\n\n  if (!routeOptions) return new Set()\n\n  // Fast path: if fewer than 2 distinct groups are referenced by route options,\n  // nothing can be shared and we can skip the rest of the work.\n  const splitGroupsPresent = new Set<number>()\n  let hasNonSplit = false\n  for (const prop of routeOptions.properties) {\n    if (!t.isObjectProperty(prop) || !t.isIdentifier(prop.key)) continue\n    if (prop.key.name === 'codeSplitGroupings') continue\n    if (t.isIdentifier(prop.value) && prop.value.name === 'undefined') continue\n    const groupIndex = findIndexForSplitNode(prop.key.name) // -1 if non-split\n    if (groupIndex === -1) {\n      hasNonSplit = true\n    } else {\n      splitGroupsPresent.add(groupIndex)\n    }\n  }\n\n  if (!hasNonSplit && splitGroupsPresent.size < 2) return new Set()\n\n  // Build dependency graph up front — needed for transitive expansion per-property.\n  // This graph excludes `Route` (deleted above) so group attribution works correctly.\n  const declMap = buildDeclarationMap(ast)\n  const depGraph = buildDependencyGraph(declMap, localModuleLevelBindings)\n\n  // Build a second dependency graph that includes `Route` so we can detect\n  // bindings that transitively depend on it. Such bindings must NOT be\n  // extracted into the shared module because they would drag the Route\n  // singleton with them, duplicating it across modules.\n  const allLocalBindings = new Set(localModuleLevelBindings)\n  allLocalBindings.add('Route')\n  const fullDepGraph = buildDependencyGraph(declMap, allLocalBindings)\n\n  // For each route property, track which \"group\" it belongs to.\n  // Non-split properties get group index -1.\n  // Split properties get their codeSplitGroupings index (0, 1, ...).\n  // A binding is \"shared\" if it appears in 2+ distinct groups.\n  // We expand each property's refs transitively BEFORE comparing groups,\n  // so indirect refs (e.g., component: MyComp where MyComp uses `shared`)\n  // are correctly attributed.\n  const refsByGroup = new Map<string, Set<number>>()\n\n  for (const prop of routeOptions.properties) {\n    if (!t.isObjectProperty(prop) || !t.isIdentifier(prop.key)) continue\n    const key = prop.key.name\n\n    if (key === 'codeSplitGroupings') continue\n\n    const groupIndex = findIndexForSplitNode(key) // -1 if non-split\n\n    const directRefs = collectModuleLevelRefsFromNode(\n      prop.value,\n      localModuleLevelBindings,\n    )\n\n    // Expand transitively: if component references SharedComp which references\n    // `shared`, then `shared` is also attributed to component's group.\n    const allRefs = new Set(directRefs)\n    expandTransitively(allRefs, depGraph)\n\n    for (const ref of allRefs) {\n      let groups = refsByGroup.get(ref)\n      if (!groups) {\n        groups = new Set()\n        refsByGroup.set(ref, groups)\n      }\n      groups.add(groupIndex)\n    }\n  }\n\n  // Shared = bindings appearing in 2+ distinct groups\n  const shared = new Set<string>()\n  for (const [name, groups] of refsByGroup) {\n    if (groups.size >= 2) shared.add(name)\n  }\n\n  // Destructured declarators (e.g. `const { a, b } = fn()`) must be treated\n  // as a single initialization unit. Even if each binding is referenced by\n  // only one group, if *different* bindings from the same declarator are\n  // referenced by different groups, the declarator must be extracted to the\n  // shared module to avoid double initialization.\n  expandSharedDestructuredDeclarators(ast, refsByGroup, shared)\n\n  if (shared.size === 0) return shared\n\n  // If any binding from a destructured declaration is shared,\n  // all bindings from that declaration must be shared\n  expandDestructuredDeclarations(ast, shared)\n\n  // Remove shared bindings that transitively depend on `Route`.\n  // The Route singleton must stay in the reference file; extracting a\n  // binding that references it would duplicate Route in the shared module.\n  removeBindingsDependingOnRoute(shared, fullDepGraph)\n\n  return shared\n}\n\n/**\n * If bindings from the same destructured declarator are referenced by\n * different groups, mark all bindings from that declarator as shared.\n */\nexport function expandSharedDestructuredDeclarators(\n  ast: t.File,\n  refsByGroup: Map<string, Set<number>>,\n  shared: Set<string>,\n) {\n  for (const stmt of ast.program.body) {\n    const decl =\n      t.isExportNamedDeclaration(stmt) && stmt.declaration\n        ? stmt.declaration\n        : stmt\n\n    if (!t.isVariableDeclaration(decl)) continue\n\n    for (const declarator of decl.declarations) {\n      if (!t.isObjectPattern(declarator.id) && !t.isArrayPattern(declarator.id))\n        continue\n\n      const names = collectIdentifiersFromPattern(declarator.id)\n\n      const usedGroups = new Set<number>()\n      for (const name of names) {\n        const groups = refsByGroup.get(name)\n        if (!groups) continue\n        for (const g of groups) usedGroups.add(g)\n      }\n\n      if (usedGroups.size >= 2) {\n        for (const name of names) {\n          shared.add(name)\n        }\n      }\n    }\n  }\n}\n\n/**\n * Collect locally-declared module-level binding names from a statement.\n * Pure node inspection, no traversal.\n */\nexport function collectLocalBindingsFromStatement(\n  node: t.Statement | t.ModuleDeclaration,\n  bindings: Set<string>,\n) {\n  const decl =\n    t.isExportNamedDeclaration(node) && node.declaration\n      ? node.declaration\n      : node\n\n  if (t.isVariableDeclaration(decl)) {\n    for (const declarator of decl.declarations) {\n      for (const name of collectIdentifiersFromPattern(declarator.id)) {\n        bindings.add(name)\n      }\n    }\n  } else if (t.isFunctionDeclaration(decl) && decl.id) {\n    bindings.add(decl.id.name)\n  } else if (t.isClassDeclaration(decl) && decl.id) {\n    bindings.add(decl.id.name)\n  }\n}\n\n/**\n * Collect direct module-level binding names referenced from a given AST node.\n * Uses a simple recursive walk instead of babel.traverse.\n */\nexport function collectModuleLevelRefsFromNode(\n  node: t.Node,\n  localModuleLevelBindings: Set<string>,\n): Set<string> {\n  const allIds = collectIdentifiersFromNode(node)\n  const refs = new Set<string>()\n  for (const name of allIds) {\n    if (localModuleLevelBindings.has(name)) refs.add(name)\n  }\n  return refs\n}\n\n/**\n * Expand the shared set transitively using a prebuilt dependency graph.\n * No AST traversals — pure graph BFS.\n */\nexport function expandTransitively(\n  shared: Set<string>,\n  depGraph: Map<string, Set<string>>,\n) {\n  const queue = [...shared]\n  const visited = new Set<string>()\n\n  while (queue.length > 0) {\n    const name = queue.pop()!\n    if (visited.has(name)) continue\n    visited.add(name)\n\n    const deps = depGraph.get(name)\n    if (!deps) continue\n\n    for (const dep of deps) {\n      if (!shared.has(dep)) {\n        shared.add(dep)\n        queue.push(dep)\n      }\n    }\n  }\n}\n\n/**\n * Remove any bindings from `shared` that transitively depend on `Route`.\n * The Route singleton must remain in the reference file; if a shared binding\n * references it (directly or transitively), extracting that binding would\n * duplicate Route in the shared module.\n *\n * Uses `depGraph` which must include `Route` as a node so the dependency\n * chain is visible.\n */\nexport function removeBindingsDependingOnRoute(\n  shared: Set<string>,\n  depGraph: Map<string, Set<string>>,\n) {\n  const reverseGraph = new Map<string, Set<string>>()\n  for (const [name, deps] of depGraph) {\n    for (const dep of deps) {\n      let parents = reverseGraph.get(dep)\n      if (!parents) {\n        parents = new Set<string>()\n        reverseGraph.set(dep, parents)\n      }\n      parents.add(name)\n    }\n  }\n\n  // Walk backwards from Route to find all bindings that can reach it.\n  const visited = new Set<string>()\n  const queue = ['Route']\n  while (queue.length > 0) {\n    const cur = queue.pop()!\n    if (visited.has(cur)) continue\n    visited.add(cur)\n\n    const parents = reverseGraph.get(cur)\n    if (!parents) continue\n    for (const parent of parents) {\n      if (!visited.has(parent)) queue.push(parent)\n    }\n  }\n\n  for (const name of [...shared]) {\n    if (visited.has(name)) {\n      shared.delete(name)\n    }\n  }\n}\n\n/**\n * If any binding from a destructured declaration is shared,\n * ensure all bindings from that same declaration are also shared.\n * Pure node inspection of program.body, no traversal.\n */\nexport function expandDestructuredDeclarations(\n  ast: t.File,\n  shared: Set<string>,\n) {\n  for (const stmt of ast.program.body) {\n    const decl =\n      t.isExportNamedDeclaration(stmt) && stmt.declaration\n        ? stmt.declaration\n        : stmt\n\n    if (!t.isVariableDeclaration(decl)) continue\n\n    for (const declarator of decl.declarations) {\n      if (!t.isObjectPattern(declarator.id) && !t.isArrayPattern(declarator.id))\n        continue\n\n      const names = collectIdentifiersFromPattern(declarator.id)\n      const hasShared = names.some((n) => shared.has(n))\n      if (hasShared) {\n        for (const n of names) {\n          shared.add(n)\n        }\n      }\n    }\n  }\n}\n\n/**\n * Find which shared bindings are user-exported in the original source.\n * These need to be re-exported from the shared module.\n */\nfunction findExportedSharedBindings(\n  ast: t.File,\n  sharedBindings: Set<string>,\n): Set<string> {\n  const exported = new Set<string>()\n  for (const stmt of ast.program.body) {\n    if (!t.isExportNamedDeclaration(stmt) || !stmt.declaration) continue\n\n    if (t.isVariableDeclaration(stmt.declaration)) {\n      for (const decl of stmt.declaration.declarations) {\n        for (const name of collectIdentifiersFromPattern(decl.id)) {\n          if (sharedBindings.has(name)) exported.add(name)\n        }\n      }\n    } else if (\n      t.isFunctionDeclaration(stmt.declaration) &&\n      stmt.declaration.id\n    ) {\n      if (sharedBindings.has(stmt.declaration.id.name))\n        exported.add(stmt.declaration.id.name)\n    } else if (t.isClassDeclaration(stmt.declaration) && stmt.declaration.id) {\n      if (sharedBindings.has(stmt.declaration.id.name))\n        exported.add(stmt.declaration.id.name)\n    }\n  }\n  return exported\n}\n\n/**\n * Remove declarations of shared bindings from the AST.\n * Handles both plain and exported declarations, including destructured patterns.\n * Removes the entire statement if all bindings in it are shared.\n */\nfunction removeSharedDeclarations(ast: t.File, sharedBindings: Set<string>) {\n  ast.program.body = ast.program.body.filter((stmt) => {\n    const decl =\n      t.isExportNamedDeclaration(stmt) && stmt.declaration\n        ? stmt.declaration\n        : stmt\n\n    if (t.isVariableDeclaration(decl)) {\n      // Filter out declarators where all bound names are shared\n      decl.declarations = decl.declarations.filter((declarator) => {\n        const names = collectIdentifiersFromPattern(declarator.id)\n        return !names.every((n) => sharedBindings.has(n))\n      })\n      // If no declarators remain, remove the entire statement\n      if (decl.declarations.length === 0) return false\n    } else if (t.isFunctionDeclaration(decl) && decl.id) {\n      if (sharedBindings.has(decl.id.name)) return false\n    } else if (t.isClassDeclaration(decl) && decl.id) {\n      if (sharedBindings.has(decl.id.name)) return false\n    }\n\n    return true\n  })\n}\n\nexport function compileCodeSplitReferenceRoute(\n  opts: ParseAstOptions & {\n    codeSplitGroupings: CodeSplitGroupings\n    deleteNodes?: Set<DeletableNodes>\n    targetFramework: Config['target']\n    filename: string\n    id: string\n    addHmr?: boolean\n    sharedBindings?: Set<string>\n    compilerPlugins?: Array<ReferenceRouteCompilerPlugin>\n  },\n): GeneratorResult | null {\n  const ast = parseAst(opts)\n\n  const refIdents = findReferencedIdentifiers(ast)\n\n  const knownExportedIdents = new Set<string>()\n\n  function findIndexForSplitNode(str: string) {\n    return opts.codeSplitGroupings.findIndex((group) =>\n      group.includes(str as any),\n    )\n  }\n\n  const frameworkOptions = getFrameworkOptions(opts.targetFramework)\n  const PACKAGE = frameworkOptions.package\n  const LAZY_ROUTE_COMPONENT_IDENT = frameworkOptions.idents.lazyRouteComponent\n  const LAZY_FN_IDENT = frameworkOptions.idents.lazyFn\n\n  let createRouteFn: string\n\n  let modified = false as boolean\n  let hmrAdded = false as boolean\n  let sharedExportedNames: Set<string> | undefined\n  babel.traverse(ast, {\n    Program: {\n      enter(programPath) {\n        /**\n         * If the component for the route is being imported from\n         * another file, this is to track the path to that file\n         * the path itself doesn't matter, we just need to keep\n         * track of it so that we can remove it from the imports\n         * list if it's not being used like:\n         *\n         * `import '../shared/imported'`\n         */\n        const removableImportPaths = new Set<string>([])\n\n        programPath.traverse({\n          CallExpression: (path) => {\n            if (!t.isIdentifier(path.node.callee)) {\n              return\n            }\n\n            if (!allCreateRouteFns.includes(path.node.callee.name)) {\n              return\n            }\n\n            createRouteFn = path.node.callee.name\n\n            function babelHandleReference(routeOptions: t.Node | undefined) {\n              const hasImportedOrDefinedIdentifier = (name: string) => {\n                return programPath.scope.hasBinding(name)\n              }\n\n              if (t.isObjectExpression(routeOptions)) {\n                if (opts.deleteNodes && opts.deleteNodes.size > 0) {\n                  routeOptions.properties = routeOptions.properties.filter(\n                    (prop) => {\n                      if (t.isObjectProperty(prop)) {\n                        if (t.isIdentifier(prop.key)) {\n                          if (opts.deleteNodes!.has(prop.key.name as any)) {\n                            modified = true\n                            return false\n                          }\n                        }\n                      }\n                      return true\n                    },\n                  )\n                }\n                if (!splittableCreateRouteFns.includes(createRouteFn)) {\n                  const insertionPath = path.getStatementParent() ?? path\n\n                  opts.compilerPlugins?.forEach((plugin) => {\n                    const pluginResult = plugin.onUnsplittableRoute?.({\n                      programPath,\n                      callExpressionPath: path,\n                      insertionPath,\n                      routeOptions,\n                      createRouteFn,\n                      opts: opts as CompileCodeSplitReferenceRouteOptions,\n                    })\n\n                    if (pluginResult?.modified) {\n                      modified = true\n                    }\n                  })\n\n                  // we can't split this route but we still add HMR handling if enabled\n                  if (opts.addHmr && !hmrAdded) {\n                    programPath.pushContainer('body', routeHmrStatement)\n                    modified = true\n                    hmrAdded = true\n                  }\n                  // exit traversal so this route is not split\n                  return programPath.stop()\n                }\n                routeOptions.properties.forEach((prop) => {\n                  if (t.isObjectProperty(prop)) {\n                    if (t.isIdentifier(prop.key)) {\n                      const key = prop.key.name\n\n                      // If the user has not specified a split grouping for this key\n                      // then we should not split it\n                      const codeSplitGroupingByKey = findIndexForSplitNode(key)\n                      if (codeSplitGroupingByKey === -1) {\n                        return\n                      }\n                      const codeSplitGroup = [\n                        ...new Set(\n                          opts.codeSplitGroupings[codeSplitGroupingByKey],\n                        ),\n                      ]\n\n                      // find key in nodeSplitConfig\n                      const isNodeConfigAvailable = SPLIT_NODES_CONFIG.has(\n                        key as any,\n                      )\n\n                      if (!isNodeConfigAvailable) {\n                        return\n                      }\n\n                      // Exit early if the value is a boolean, null, or undefined.\n                      // These values mean \"don't use this component, fallback to parent\"\n                      // No code splitting needed to preserve fallback behavior\n                      if (\n                        t.isBooleanLiteral(prop.value) ||\n                        t.isNullLiteral(prop.value) ||\n                        (t.isIdentifier(prop.value) &&\n                          prop.value.name === 'undefined')\n                      ) {\n                        return\n                      }\n\n                      const splitNodeMeta = SPLIT_NODES_CONFIG.get(key as any)!\n\n                      // We need to extract the existing search params from the filename, if any\n                      // and add the relevant codesplitPrefix to them, then write them back to the filename\n                      const splitUrl = addSplitSearchParamToFilename(\n                        opts.filename,\n                        codeSplitGroup,\n                      )\n\n                      if (\n                        splitNodeMeta.splitStrategy === 'lazyRouteComponent'\n                      ) {\n                        const value = prop.value\n\n                        let shouldSplit = true\n\n                        if (t.isIdentifier(value)) {\n                          const existingImportPath =\n                            getImportSpecifierAndPathFromLocalName(\n                              programPath,\n                              value.name,\n                            ).path\n                          if (existingImportPath) {\n                            removableImportPaths.add(existingImportPath)\n                          }\n\n                          // exported identifiers should not be split\n                          // since they are already being imported\n                          // and need to be retained in the compiled file\n                          const isExported = hasExport(ast, value)\n                          if (isExported) {\n                            knownExportedIdents.add(value.name)\n                          }\n                          shouldSplit = !isExported\n\n                          if (shouldSplit) {\n                            removeIdentifierLiteral(path, value)\n                          }\n                        }\n\n                        if (!shouldSplit) {\n                          return\n                        }\n\n                        modified = true\n\n                        // Prepend the import statement to the program along with the importer function\n                        // Check to see if lazyRouteComponent is already imported before attempting\n                        // to import it again\n                        if (\n                          !hasImportedOrDefinedIdentifier(\n                            LAZY_ROUTE_COMPONENT_IDENT,\n                          )\n                        ) {\n                          programPath.unshiftContainer('body', [\n                            template.statement(\n                              `import { ${LAZY_ROUTE_COMPONENT_IDENT} } from '${PACKAGE}'`,\n                            )(),\n                          ])\n                        }\n\n                        // Check to see if the importer function is already defined\n                        // If not, define it with the dynamic import statement\n                        if (\n                          !hasImportedOrDefinedIdentifier(\n                            splitNodeMeta.localImporterIdent,\n                          )\n                        ) {\n                          programPath.unshiftContainer('body', [\n                            template.statement(\n                              `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`,\n                            )(),\n                          ])\n                        }\n\n                        prop.value = template.expression(\n                          `${LAZY_ROUTE_COMPONENT_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}')`,\n                        )()\n\n                        // add HMR handling\n                        if (opts.addHmr && !hmrAdded) {\n                          programPath.pushContainer('body', routeHmrStatement)\n                          modified = true\n                          hmrAdded = true\n                        }\n                      } else {\n                        // if (splitNodeMeta.splitStrategy === 'lazyFn') {\n                        const value = prop.value\n\n                        let shouldSplit = true\n\n                        if (t.isIdentifier(value)) {\n                          const existingImportPath =\n                            getImportSpecifierAndPathFromLocalName(\n                              programPath,\n                              value.name,\n                            ).path\n                          if (existingImportPath) {\n                            removableImportPaths.add(existingImportPath)\n                          }\n\n                          // exported identifiers should not be split\n                          // since they are already being imported\n                          // and need to be retained in the compiled file\n                          const isExported = hasExport(ast, value)\n                          if (isExported) {\n                            knownExportedIdents.add(value.name)\n                          }\n                          shouldSplit = !isExported\n\n                          if (shouldSplit) {\n                            removeIdentifierLiteral(path, value)\n                          }\n                        }\n\n                        if (!shouldSplit) {\n                          return\n                        }\n                        modified = true\n\n                        // Prepend the import statement to the program along with the importer function\n                        if (!hasImportedOrDefinedIdentifier(LAZY_FN_IDENT)) {\n                          programPath.unshiftContainer(\n                            'body',\n                            template.smart(\n                              `import { ${LAZY_FN_IDENT} } from '${PACKAGE}'`,\n                            )(),\n                          )\n                        }\n\n                        // Check to see if the importer function is already defined\n                        // If not, define it with the dynamic import statement\n                        if (\n                          !hasImportedOrDefinedIdentifier(\n                            splitNodeMeta.localImporterIdent,\n                          )\n                        ) {\n                          programPath.unshiftContainer('body', [\n                            template.statement(\n                              `const ${splitNodeMeta.localImporterIdent} = () => import('${splitUrl}')`,\n                            )(),\n                          ])\n                        }\n\n                        // Add the lazyFn call with the dynamic import to the prop value\n                        prop.value = template.expression(\n                          `${LAZY_FN_IDENT}(${splitNodeMeta.localImporterIdent}, '${splitNodeMeta.exporterIdent}')`,\n                        )()\n                      }\n                    }\n                  }\n\n                  programPath.scope.crawl()\n                })\n              }\n            }\n\n            if (t.isCallExpression(path.parentPath.node)) {\n              // createFileRoute('/')({ ... })\n              const options = resolveIdentifier(\n                path,\n                path.parentPath.node.arguments[0],\n              )\n\n              babelHandleReference(options)\n            } else if (t.isVariableDeclarator(path.parentPath.node)) {\n              // createFileRoute({ ... })\n              const caller = resolveIdentifier(path, path.parentPath.node.init)\n\n              if (t.isCallExpression(caller)) {\n                const options = resolveIdentifier(path, caller.arguments[0])\n                babelHandleReference(options)\n              }\n            }\n          },\n        })\n\n        /**\n         * If the component for the route is being imported,\n         * and it's not being used, remove the import statement\n         * from the program, by checking that the import has no\n         * specifiers\n         */\n        if (removableImportPaths.size > 0) {\n          modified = true\n          programPath.traverse({\n            ImportDeclaration(path) {\n              if (path.node.specifiers.length > 0) return\n              if (removableImportPaths.has(path.node.source.value)) {\n                path.remove()\n              }\n            },\n          })\n        }\n\n        // Handle shared bindings inside the Program visitor so we have\n        // access to programPath for cheap refIdents registration.\n        if (opts.sharedBindings && opts.sharedBindings.size > 0) {\n          sharedExportedNames = findExportedSharedBindings(\n            ast,\n            opts.sharedBindings,\n          )\n          removeSharedDeclarations(ast, opts.sharedBindings)\n\n          const sharedModuleUrl = addSharedSearchParamToFilename(opts.filename)\n\n          const sharedImportSpecifiers = [...opts.sharedBindings].map((name) =>\n            t.importSpecifier(t.identifier(name), t.identifier(name)),\n          )\n          const [sharedImportPath] = programPath.unshiftContainer(\n            'body',\n            t.importDeclaration(\n              sharedImportSpecifiers,\n              t.stringLiteral(sharedModuleUrl),\n            ),\n          )\n\n          // Register import specifier locals in refIdents so DCE can remove unused ones\n          sharedImportPath.traverse({\n            Identifier(identPath) {\n              if (\n                identPath.parentPath.isImportSpecifier() &&\n                identPath.key === 'local'\n              ) {\n                refIdents.add(identPath)\n              }\n            },\n          })\n\n          // Re-export user-exported shared bindings from the shared module\n          if (sharedExportedNames.size > 0) {\n            const reExportSpecifiers = [...sharedExportedNames].map((name) =>\n              t.exportSpecifier(t.identifier(name), t.identifier(name)),\n            )\n            programPath.pushContainer(\n              'body',\n              t.exportNamedDeclaration(\n                null,\n                reExportSpecifiers,\n                t.stringLiteral(sharedModuleUrl),\n              ),\n            )\n          }\n        }\n      },\n    },\n  })\n\n  if (!modified) {\n    return null\n  }\n\n  deadCodeElimination(ast, refIdents)\n\n  // if there are exported identifiers, then we need to add a warning\n  // to the file to let the user know that the exported identifiers\n  // will not in the split file but in the original file, therefore\n  // increasing the bundle size\n  if (knownExportedIdents.size > 0) {\n    const warningMessage = createNotExportableMessage(\n      opts.filename,\n      knownExportedIdents,\n    )\n    console.warn(warningMessage)\n\n    // append this warning to the file using a template\n    if (process.env.NODE_ENV !== 'production') {\n      const warningTemplate = template.statement(\n        `console.warn(${JSON.stringify(warningMessage)})`,\n      )()\n      ast.program.body.unshift(warningTemplate)\n    }\n  }\n\n  const result = generateFromAst(ast, {\n    sourceMaps: true,\n    sourceFileName: opts.filename,\n    filename: opts.filename,\n  })\n\n  // @babel/generator does not populate sourcesContent because it only has\n  // the AST, not the original text.  Without this, Vite's composed\n  // sourcemap omits the original source, causing downstream consumers\n  // (e.g. import-protection snippet display) to fall back to the shorter\n  // compiled output and fail to resolve original line numbers.\n  if (result.map) {\n    result.map.sourcesContent = [opts.code]\n  }\n\n  return result\n}\n\nexport function compileCodeSplitVirtualRoute(\n  opts: ParseAstOptions & {\n    splitTargets: Array<SplitRouteIdentNodes>\n    filename: string\n    sharedBindings?: Set<string>\n  },\n): GeneratorResult {\n  const ast = parseAst(opts)\n  const refIdents = findReferencedIdentifiers(ast)\n\n  // Remove shared declarations BEFORE babel.traverse so the scope never sees\n  // conflicting bindings (avoids checkBlockScopedCollisions crash in DCE)\n  if (opts.sharedBindings && opts.sharedBindings.size > 0) {\n    removeSharedDeclarations(ast, opts.sharedBindings)\n  }\n\n  const intendedSplitNodes = new Set(opts.splitTargets)\n\n  const knownExportedIdents = new Set<string>()\n\n  babel.traverse(ast, {\n    Program: {\n      enter(programPath) {\n        const trackedNodesToSplitByType: Record<\n          SplitRouteIdentNodes,\n          { node: t.Node | undefined; meta: SplitNodeMeta } | undefined\n        > = {\n          component: undefined,\n          loader: undefined,\n          pendingComponent: undefined,\n          errorComponent: undefined,\n          notFoundComponent: undefined,\n        }\n\n        // Find and track all the known split-able nodes\n        programPath.traverse({\n          CallExpression: (path) => {\n            if (!t.isIdentifier(path.node.callee)) {\n              return\n            }\n\n            if (!splittableCreateRouteFns.includes(path.node.callee.name)) {\n              return\n            }\n\n            function babelHandleVirtual(options: t.Node | undefined) {\n              if (t.isObjectExpression(options)) {\n                options.properties.forEach((prop) => {\n                  if (t.isObjectProperty(prop)) {\n                    // do not use `intendedSplitNodes` here\n                    // since we have special considerations that need\n                    // to be accounted for like (not splitting exported identifiers)\n                    KNOWN_SPLIT_ROUTE_IDENTS.forEach((splitType) => {\n                      if (\n                        !t.isIdentifier(prop.key) ||\n                        prop.key.name !== splitType\n                      ) {\n                        return\n                      }\n\n                      const value = prop.value\n\n                      // If the value for the `key` is `undefined`, then we don't need to include it\n                      // in the split file, so we can just return, since it will kept in-place in the\n                      // reference file\n                      // This is useful for cases like: `createFileRoute('/')({ component: undefined })`\n                      if (t.isIdentifier(value) && value.name === 'undefined') {\n                        return\n                      }\n\n                      let isExported = false\n                      if (t.isIdentifier(value)) {\n                        isExported = hasExport(ast, value)\n                        if (isExported) {\n                          knownExportedIdents.add(value.name)\n                        }\n                      }\n\n                      // If the node is exported, we need to remove\n                      // the export from the split file\n                      if (isExported && t.isIdentifier(value)) {\n                        removeExports(ast, value)\n                      } else {\n                        const meta = SPLIT_NODES_CONFIG.get(splitType)!\n                        trackedNodesToSplitByType[splitType] = {\n                          node: prop.value,\n                          meta,\n                        }\n                      }\n                    })\n                  }\n                })\n\n                // Remove all of the options\n                options.properties = []\n              }\n            }\n\n            if (t.isCallExpression(path.parentPath.node)) {\n              // createFileRoute('/')({ ... })\n              const options = resolveIdentifier(\n                path,\n                path.parentPath.node.arguments[0],\n              )\n\n              babelHandleVirtual(options)\n            } else if (t.isVariableDeclarator(path.parentPath.node)) {\n              // createFileRoute({ ... })\n              const caller = resolveIdentifier(path, path.parentPath.node.init)\n\n              if (t.isCallExpression(caller)) {\n                const options = resolveIdentifier(path, caller.arguments[0])\n                babelHandleVirtual(options)\n              }\n            }\n          },\n        })\n\n        // Start the transformation to only exported the intended split nodes\n        intendedSplitNodes.forEach((SPLIT_TYPE) => {\n          const splitKey = trackedNodesToSplitByType[SPLIT_TYPE]\n\n          if (!splitKey) {\n            return\n          }\n\n          let splitNode = splitKey.node\n          const splitMeta = { ...splitKey.meta, shouldRemoveNode: true }\n\n          // Track the original identifier name before resolving through bindings,\n          // needed for destructured patterns where the binding resolves to the\n          // entire VariableDeclarator (ObjectPattern) rather than the specific binding\n          let originalIdentName: string | undefined\n          if (t.isIdentifier(splitNode)) {\n            originalIdentName = splitNode.name\n          }\n\n          while (t.isIdentifier(splitNode)) {\n            const binding = programPath.scope.getBinding(splitNode.name)\n            splitNode = binding?.path.node\n          }\n\n          // Add the node to the program\n          if (splitNode) {\n            if (t.isFunctionDeclaration(splitNode)) {\n              // an anonymous function declaration should only happen for `export default function() {...}`\n              // so we should never get here\n              if (!splitNode.id) {\n                throw new Error(\n                  `Function declaration for \"${SPLIT_TYPE}\" must have an identifier.`,\n                )\n              }\n              splitMeta.shouldRemoveNode = false\n              splitMeta.localExporterIdent = splitNode.id.name\n            } else if (\n              t.isFunctionExpression(splitNode) ||\n              t.isArrowFunctionExpression(splitNode)\n            ) {\n              programPath.pushContainer(\n                'body',\n                t.variableDeclaration('const', [\n                  t.variableDeclarator(\n                    t.identifier(splitMeta.localExporterIdent),\n                    splitNode as any,\n                  ),\n                ]),\n              )\n            } else if (\n              t.isImportSpecifier(splitNode) ||\n              t.isImportDefaultSpecifier(splitNode)\n            ) {\n              programPath.pushContainer(\n                'body',\n                t.variableDeclaration('const', [\n                  t.variableDeclarator(\n                    t.identifier(splitMeta.localExporterIdent),\n                    splitNode.local,\n                  ),\n                ]),\n              )\n            } else if (t.isVariableDeclarator(splitNode)) {\n              if (t.isIdentifier(splitNode.id)) {\n                splitMeta.localExporterIdent = splitNode.id.name\n                splitMeta.shouldRemoveNode = false\n              } else if (t.isObjectPattern(splitNode.id)) {\n                // Destructured binding like `const { component: MyComp } = createBits()`\n                // Use the original identifier name that was tracked before resolving\n                if (originalIdentName) {\n                  splitMeta.localExporterIdent = originalIdentName\n                }\n                splitMeta.shouldRemoveNode = false\n              } else {\n                throw new Error(\n                  `Unexpected splitNode type ☝️: ${splitNode.type}`,\n                )\n              }\n            } else if (t.isCallExpression(splitNode)) {\n              const outputSplitNodeCode = generateFromAst(splitNode).code\n              const splitNodeAst = babel.parse(outputSplitNodeCode)\n\n              if (!splitNodeAst) {\n                throw new Error(\n                  `Failed to parse the generated code for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\"`,\n                )\n              }\n\n              const statement = splitNodeAst.program.body[0]\n\n              if (!statement) {\n                throw new Error(\n                  `Failed to parse the generated code for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\" as no statement was found in the program body`,\n                )\n              }\n\n              if (t.isExpressionStatement(statement)) {\n                const expression = statement.expression\n                programPath.pushContainer(\n                  'body',\n                  t.variableDeclaration('const', [\n                    t.variableDeclarator(\n                      t.identifier(splitMeta.localExporterIdent),\n                      expression,\n                    ),\n                  ]),\n                )\n              } else {\n                throw new Error(\n                  `Unexpected expression type encounter for \"${SPLIT_TYPE}\" in the node type \"${splitNode.type}\"`,\n                )\n              }\n            } else if (t.isConditionalExpression(splitNode)) {\n              programPath.pushContainer(\n                'body',\n                t.variableDeclaration('const', [\n                  t.variableDeclarator(\n                    t.identifier(splitMeta.localExporterIdent),\n                    splitNode,\n                  ),\n                ]),\n              )\n            } else if (t.isTSAsExpression(splitNode)) {\n              // remove the type assertion\n              splitNode = splitNode.expression\n              programPath.pushContainer(\n                'body',\n                t.variableDeclaration('const', [\n                  t.variableDeclarator(\n                    t.identifier(splitMeta.localExporterIdent),\n                    splitNode,\n                  ),\n                ]),\n              )\n            } else if (t.isBooleanLiteral(splitNode)) {\n              // Handle boolean literals\n              // This exits early here, since this value will be kept in the reference file\n              return\n            } else if (t.isNullLiteral(splitNode)) {\n              // Handle null literals\n              // This exits early here, since this value will be kept in the reference file\n              return\n            } else {\n              console.info('Unexpected splitNode type:', splitNode)\n              throw new Error(`Unexpected splitNode type ☝️: ${splitNode.type}`)\n            }\n          }\n\n          if (splitMeta.shouldRemoveNode) {\n            // If the splitNode exists at the top of the program\n            // then we need to remove that copy\n            programPath.node.body = programPath.node.body.filter((node) => {\n              return node !== splitNode\n            })\n          }\n\n          // Export the node\n          programPath.pushContainer('body', [\n            t.exportNamedDeclaration(null, [\n              t.exportSpecifier(\n                t.identifier(splitMeta.localExporterIdent), // local variable name\n                t.identifier(splitMeta.exporterIdent), // as what name it should be exported as\n              ),\n            ]),\n          ])\n        })\n\n        // convert exports to imports from the original file\n        programPath.traverse({\n          ExportNamedDeclaration(path) {\n            // e.g. export const x = 1 or export { x }\n            // becomes\n            // import { x } from '${opts.id}'\n\n            if (path.node.declaration) {\n              if (t.isVariableDeclaration(path.node.declaration)) {\n                const specifiers = path.node.declaration.declarations.flatMap(\n                  (decl) => {\n                    if (t.isIdentifier(decl.id)) {\n                      return [\n                        t.importSpecifier(\n                          t.identifier(decl.id.name),\n                          t.identifier(decl.id.name),\n                        ),\n                      ]\n                    }\n\n                    if (t.isObjectPattern(decl.id)) {\n                      return collectIdentifiersFromPattern(decl.id).map(\n                        (name) =>\n                          t.importSpecifier(\n                            t.identifier(name),\n                            t.identifier(name),\n                          ),\n                      )\n                    }\n\n                    if (t.isArrayPattern(decl.id)) {\n                      return collectIdentifiersFromPattern(decl.id).map(\n                        (name) =>\n                          t.importSpecifier(\n                            t.identifier(name),\n                            t.identifier(name),\n                          ),\n                      )\n                    }\n\n                    return []\n                  },\n                )\n\n                if (specifiers.length === 0) {\n                  path.remove()\n                  return\n                }\n\n                const importDecl = t.importDeclaration(\n                  specifiers,\n                  t.stringLiteral(\n                    removeSplitSearchParamFromFilename(opts.filename),\n                  ),\n                )\n\n                path.replaceWith(importDecl)\n\n                // Track the imported identifier paths so deadCodeElimination can remove them if unused\n                // We need to traverse the newly created import to get the identifier paths\n                path.traverse({\n                  Identifier(identPath) {\n                    // Only track the local binding identifiers (the imported names)\n                    if (\n                      identPath.parentPath.isImportSpecifier() &&\n                      identPath.key === 'local'\n                    ) {\n                      refIdents.add(identPath)\n                    }\n                  },\n                })\n              }\n            }\n          },\n        })\n\n        // Add shared bindings import, registering specifiers in refIdents\n        // so DCE can remove unused ones (same pattern as import replacements above).\n        if (opts.sharedBindings && opts.sharedBindings.size > 0) {\n          const sharedImportSpecifiers = [...opts.sharedBindings].map((name) =>\n            t.importSpecifier(t.identifier(name), t.identifier(name)),\n          )\n          const sharedModuleUrl = addSharedSearchParamToFilename(\n            removeSplitSearchParamFromFilename(opts.filename),\n          )\n          const [sharedImportPath] = programPath.unshiftContainer(\n            'body',\n            t.importDeclaration(\n              sharedImportSpecifiers,\n              t.stringLiteral(sharedModuleUrl),\n            ),\n          )\n\n          sharedImportPath.traverse({\n            Identifier(identPath) {\n              if (\n                identPath.parentPath.isImportSpecifier() &&\n                identPath.key === 'local'\n              ) {\n                refIdents.add(identPath)\n              }\n            },\n          })\n        }\n      },\n    },\n  })\n\n  deadCodeElimination(ast, refIdents)\n\n  // Strip top-level expression statements that reference no locally-bound names.\n  // DCE only removes unused declarations; bare side-effect statements like\n  // `console.log(...)` survive even when the virtual file has no exports.\n  {\n    const locallyBound = new Set<string>()\n    for (const stmt of ast.program.body) {\n      collectLocalBindingsFromStatement(stmt, locallyBound)\n    }\n    ast.program.body = ast.program.body.filter((stmt) => {\n      if (!t.isExpressionStatement(stmt)) return true\n      const refs = collectIdentifiersFromNode(stmt)\n      // Keep if it references at least one locally-bound identifier\n      return [...refs].some((name) => locallyBound.has(name))\n    })\n  }\n\n  // If the body is empty after DCE, strip directive prologues too.\n  // A file containing only `'use client'` with no real code is useless.\n  if (ast.program.body.length === 0) {\n    ast.program.directives = []\n  }\n\n  const result = generateFromAst(ast, {\n    sourceMaps: true,\n    sourceFileName: opts.filename,\n    filename: opts.filename,\n  })\n\n  // @babel/generator does not populate sourcesContent — see compileCodeSplitReferenceRoute.\n  if (result.map) {\n    result.map.sourcesContent = [opts.code]\n  }\n\n  return result\n}\n\n/**\n * Compile the shared virtual module (`?tsr-shared=1`).\n * Keeps only shared binding declarations, their transitive dependencies,\n * and imports they need. Exports all shared bindings.\n */\nexport function compileCodeSplitSharedRoute(\n  opts: ParseAstOptions & {\n    sharedBindings: Set<string>\n    filename: string\n  },\n): GeneratorResult {\n  const ast = parseAst(opts)\n  const refIdents = findReferencedIdentifiers(ast)\n\n  // Collect all names that need to stay: shared bindings + their transitive deps\n  const localBindings = new Set<string>()\n  for (const node of ast.program.body) {\n    collectLocalBindingsFromStatement(node, localBindings)\n  }\n\n  // Route must never be extracted into the shared module.\n  // Excluding it from the dep graph prevents expandTransitively from\n  // pulling it in as a transitive dependency of a shared binding.\n  localBindings.delete('Route')\n\n  const declMap = buildDeclarationMap(ast)\n  const depGraph = buildDependencyGraph(declMap, localBindings)\n\n  // Start with shared bindings and expand transitively\n  const keepBindings = new Set(opts.sharedBindings)\n  keepBindings.delete('Route')\n  expandTransitively(keepBindings, depGraph)\n\n  // Remove all statements except:\n  // - Import declarations (needed for deps; DCE will clean unused ones)\n  // - Declarations of bindings in keepBindings\n  ast.program.body = ast.program.body.filter((stmt) => {\n    // Always keep imports — DCE will remove unused ones\n    if (t.isImportDeclaration(stmt)) return true\n\n    const decl =\n      t.isExportNamedDeclaration(stmt) && stmt.declaration\n        ? stmt.declaration\n        : stmt\n\n    if (t.isVariableDeclaration(decl)) {\n      // Keep declarators where at least one binding is in keepBindings\n      decl.declarations = decl.declarations.filter((declarator) => {\n        const names = collectIdentifiersFromPattern(declarator.id)\n        return names.some((n) => keepBindings.has(n))\n      })\n      if (decl.declarations.length === 0) return false\n\n      // Strip the `export` wrapper — shared module controls its own exports\n      if (t.isExportNamedDeclaration(stmt) && stmt.declaration) {\n        return true // keep for now, we'll convert below\n      }\n      return true\n    } else if (t.isFunctionDeclaration(decl) && decl.id) {\n      return keepBindings.has(decl.id.name)\n    } else if (t.isClassDeclaration(decl) && decl.id) {\n      return keepBindings.has(decl.id.name)\n    }\n\n    // Remove everything else (expression statements, other exports, etc.)\n    return false\n  })\n\n  // Convert `export const/function/class` to plain declarations\n  // (we'll add our own export statement at the end)\n  ast.program.body = ast.program.body.map((stmt) => {\n    if (t.isExportNamedDeclaration(stmt) && stmt.declaration) {\n      return stmt.declaration\n    }\n    return stmt\n  })\n\n  // Export all shared bindings (sorted for deterministic output)\n  const exportNames = [...opts.sharedBindings].sort((a, b) =>\n    a.localeCompare(b),\n  )\n  const exportSpecifiers = exportNames.map((name) =>\n    t.exportSpecifier(t.identifier(name), t.identifier(name)),\n  )\n  if (exportSpecifiers.length > 0) {\n    const exportDecl = t.exportNamedDeclaration(null, exportSpecifiers)\n    ast.program.body.push(exportDecl)\n\n    // Register export specifier locals in refIdents so DCE doesn't treat\n    // the exported bindings as unreferenced.\n    babel.traverse(ast, {\n      Program(programPath) {\n        const bodyPaths = programPath.get('body')\n        const last = bodyPaths[bodyPaths.length - 1]\n        if (last && last.isExportNamedDeclaration()) {\n          last.traverse({\n            Identifier(identPath) {\n              if (\n                identPath.parentPath.isExportSpecifier() &&\n                identPath.key === 'local'\n              ) {\n                refIdents.add(identPath)\n              }\n            },\n          })\n        }\n        programPath.stop()\n      },\n    })\n  }\n\n  deadCodeElimination(ast, refIdents)\n\n  // If the body is empty after DCE, strip directive prologues too.\n  if (ast.program.body.length === 0) {\n    ast.program.directives = []\n  }\n\n  const result = generateFromAst(ast, {\n    sourceMaps: true,\n    sourceFileName: opts.filename,\n    filename: opts.filename,\n  })\n\n  // @babel/generator does not populate sourcesContent — see compileCodeSplitReferenceRoute.\n  if (result.map) {\n    result.map.sourcesContent = [opts.code]\n  }\n\n  return result\n}\n\n/**\n * This function should read get the options from by searching for the key `codeSplitGroupings`\n * on createFileRoute and return it's values if it exists, else return undefined\n */\nexport function detectCodeSplitGroupingsFromRoute(opts: ParseAstOptions): {\n  groupings: CodeSplitGroupings | undefined\n} {\n  const ast = parseAst(opts)\n\n  let codeSplitGroupings: CodeSplitGroupings | undefined = undefined\n\n  babel.traverse(ast, {\n    Program: {\n      enter(programPath) {\n        programPath.traverse({\n          CallExpression(path) {\n            if (!t.isIdentifier(path.node.callee)) {\n              return\n            }\n\n            if (\n              !(\n                path.node.callee.name === 'createRoute' ||\n                path.node.callee.name === 'createFileRoute'\n              )\n            ) {\n              return\n            }\n\n            function babelHandleSplittingGroups(\n              routeOptions: t.Node | undefined,\n            ) {\n              if (t.isObjectExpression(routeOptions)) {\n                routeOptions.properties.forEach((prop) => {\n                  if (t.isObjectProperty(prop)) {\n                    if (t.isIdentifier(prop.key)) {\n                      if (prop.key.name === 'codeSplitGroupings') {\n                        const value = prop.value\n\n                        if (t.isArrayExpression(value)) {\n                          codeSplitGroupings = value.elements.map((group) => {\n                            if (t.isArrayExpression(group)) {\n                              return group.elements.map((node) => {\n                                if (!t.isStringLiteral(node)) {\n                                  throw new Error(\n                                    'You must provide a string literal for the codeSplitGroupings',\n                                  )\n                                }\n\n                                return node.value\n                              }) as Array<SplitRouteIdentNodes>\n                            }\n\n                            throw new Error(\n                              'You must provide arrays with codeSplitGroupings options.',\n                            )\n                          })\n                        } else {\n                          throw new Error(\n                            'You must provide an array of arrays for the codeSplitGroupings.',\n                          )\n                        }\n                      }\n                    }\n                  }\n                })\n              }\n            }\n\n            // Extracting the codeSplitGroupings\n            if (t.isCallExpression(path.parentPath.node)) {\n              // createFileRoute('/')({ ... })\n              const options = resolveIdentifier(\n                path,\n                path.parentPath.node.arguments[0],\n              )\n\n              babelHandleSplittingGroups(options)\n            } else if (t.isVariableDeclarator(path.parentPath.node)) {\n              // createFileRoute({ ... })\n              const caller = resolveIdentifier(path, path.parentPath.node.init)\n\n              if (t.isCallExpression(caller)) {\n                const options = resolveIdentifier(path, caller.arguments[0])\n                babelHandleSplittingGroups(options)\n              }\n            }\n          },\n        })\n      },\n    },\n  })\n\n  return { groupings: codeSplitGroupings }\n}\n\nfunction createNotExportableMessage(\n  filename: string,\n  idents: Set<string>,\n): string {\n  const list = Array.from(idents).map((d) => `- ${d}`)\n\n  const message = [\n    `[tanstack-router] These exports from \"${filename}\" will not be code-split and will increase your bundle size:`,\n    ...list,\n    'For the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.',\n  ].join('\\n')\n\n  return message\n}\n\nfunction getImportSpecifierAndPathFromLocalName(\n  programPath: babel.NodePath<t.Program>,\n  name: string,\n): {\n  specifier:\n    | t.ImportSpecifier\n    | t.ImportDefaultSpecifier\n    | t.ImportNamespaceSpecifier\n    | null\n  path: string | null\n} {\n  let specifier:\n    | t.ImportSpecifier\n    | t.ImportDefaultSpecifier\n    | t.ImportNamespaceSpecifier\n    | null = null\n  let path: string | null = null\n\n  programPath.traverse({\n    ImportDeclaration(importPath) {\n      const found = importPath.node.specifiers.find(\n        (targetSpecifier) => targetSpecifier.local.name === name,\n      )\n      if (found) {\n        specifier = found\n        path = importPath.node.source.value\n      }\n    },\n  })\n\n  return { specifier, path }\n}\n\n/**\n * Recursively collects all identifier names from a destructuring pattern\n * (ObjectPattern, ArrayPattern, AssignmentPattern, RestElement).\n */\nfunction collectIdentifiersFromPattern(\n  node: t.LVal | t.Node | null | undefined,\n): Array<string> {\n  if (!node) {\n    return []\n  }\n\n  if (t.isIdentifier(node)) {\n    return [node.name]\n  }\n\n  if (t.isAssignmentPattern(node)) {\n    return collectIdentifiersFromPattern(node.left)\n  }\n\n  if (t.isRestElement(node)) {\n    return collectIdentifiersFromPattern(node.argument)\n  }\n\n  if (t.isObjectPattern(node)) {\n    return node.properties.flatMap((prop) => {\n      if (t.isObjectProperty(prop)) {\n        return collectIdentifiersFromPattern(prop.value as t.LVal)\n      }\n      if (t.isRestElement(prop)) {\n        return collectIdentifiersFromPattern(prop.argument)\n      }\n      return []\n    })\n  }\n\n  if (t.isArrayPattern(node)) {\n    return node.elements.flatMap((element) =>\n      collectIdentifiersFromPattern(element),\n    )\n  }\n\n  return []\n}\n\n// Reusable function to get literal value or resolve variable to literal\nfunction resolveIdentifier(path: any, node: any): t.Node | undefined {\n  if (t.isIdentifier(node)) {\n    const binding = path.scope.getBinding(node.name)\n    if (\n      binding\n      // && binding.kind === 'const'\n    ) {\n      const declarator = binding.path.node\n      if (t.isObjectExpression(declarator.init)) {\n        return declarator.init\n      } else if (t.isFunctionDeclaration(declarator.init)) {\n        return declarator.init\n      }\n    }\n    return undefined\n  }\n\n  return node\n}\n\nfunction removeIdentifierLiteral(path: babel.NodePath, node: t.Identifier) {\n  const binding = path.scope.getBinding(node.name)\n  if (binding) {\n    // If the binding is a destructured property from an ObjectPattern,\n    // only remove that property instead of the entire declaration\n    if (\n      t.isVariableDeclarator(binding.path.node) &&\n      t.isObjectPattern(binding.path.node.id)\n    ) {\n      const objectPattern = binding.path.node.id\n      objectPattern.properties = objectPattern.properties.filter((prop) => {\n        if (!t.isObjectProperty(prop)) {\n          return true\n        }\n\n        if (t.isIdentifier(prop.value) && prop.value.name === node.name) {\n          return false\n        }\n\n        if (\n          t.isAssignmentPattern(prop.value) &&\n          t.isIdentifier(prop.value.left) &&\n          prop.value.left.name === node.name\n        ) {\n          return false\n        }\n\n        return true\n      })\n\n      // If no properties remain, remove the entire declaration\n      if (objectPattern.properties.length === 0) {\n        binding.path.remove()\n      }\n\n      return\n    }\n\n    binding.path.remove()\n  }\n}\n\nfunction hasExport(ast: t.File, node: t.Identifier): boolean {\n  let found = false\n\n  babel.traverse(ast, {\n    ExportNamedDeclaration(path) {\n      if (path.node.declaration) {\n        // declared as `const loaderFn = () => {}`\n        if (t.isVariableDeclaration(path.node.declaration)) {\n          path.node.declaration.declarations.forEach((decl) => {\n            if (t.isVariableDeclarator(decl)) {\n              if (t.isIdentifier(decl.id)) {\n                if (decl.id.name === node.name) {\n                  found = true\n                }\n              } else if (\n                t.isObjectPattern(decl.id) ||\n                t.isArrayPattern(decl.id)\n              ) {\n                // Handle destructured exports like `export const { a, b } = fn()`\n                const names = collectIdentifiersFromPattern(decl.id)\n                if (names.includes(node.name)) {\n                  found = true\n                }\n              }\n            }\n          })\n        }\n\n        // declared as `function loaderFn() {}`\n        if (t.isFunctionDeclaration(path.node.declaration)) {\n          if (t.isIdentifier(path.node.declaration.id)) {\n            if (path.node.declaration.id.name === node.name) {\n              found = true\n            }\n          }\n        }\n      }\n    },\n    ExportDefaultDeclaration(path) {\n      // declared as `export default loaderFn`\n      if (t.isIdentifier(path.node.declaration)) {\n        if (path.node.declaration.name === node.name) {\n          found = true\n        }\n      }\n\n      // declared as `export default function loaderFn() {}`\n      if (t.isFunctionDeclaration(path.node.declaration)) {\n        if (t.isIdentifier(path.node.declaration.id)) {\n          if (path.node.declaration.id.name === node.name) {\n            found = true\n          }\n        }\n      }\n    },\n  })\n\n  return found\n}\n\nfunction removeExports(ast: t.File, node: t.Identifier): boolean {\n  let removed = false\n\n  // The checks use sequential if/else if statements since it\n  // directly mutates the AST and as such doing normal checks\n  // (using only if statements) could lead to a situation where\n  // `path.node` is null since it has been already removed from\n  // the program tree but typescript doesn't know that.\n  babel.traverse(ast, {\n    ExportNamedDeclaration(path) {\n      if (path.node.declaration) {\n        if (t.isVariableDeclaration(path.node.declaration)) {\n          // declared as `const loaderFn = () => {}`\n          path.node.declaration.declarations.forEach((decl) => {\n            if (t.isVariableDeclarator(decl)) {\n              if (t.isIdentifier(decl.id)) {\n                if (decl.id.name === node.name) {\n                  path.remove()\n                  removed = true\n                }\n              } else if (\n                t.isObjectPattern(decl.id) ||\n                t.isArrayPattern(decl.id)\n              ) {\n                // Handle destructured exports like `export const { a, b } = fn()`\n                const names = collectIdentifiersFromPattern(decl.id)\n                if (names.includes(node.name)) {\n                  path.remove()\n                  removed = true\n                }\n              }\n            }\n          })\n        } else if (t.isFunctionDeclaration(path.node.declaration)) {\n          // declared as `export const loaderFn = () => {}`\n          if (t.isIdentifier(path.node.declaration.id)) {\n            if (path.node.declaration.id.name === node.name) {\n              path.remove()\n              removed = true\n            }\n          }\n        }\n      }\n    },\n    ExportDefaultDeclaration(path) {\n      // declared as `export default loaderFn`\n      if (t.isIdentifier(path.node.declaration)) {\n        if (path.node.declaration.name === node.name) {\n          path.remove()\n          removed = true\n        }\n      } else if (t.isFunctionDeclaration(path.node.declaration)) {\n        // declared as `export default function loaderFn() {}`\n        if (t.isIdentifier(path.node.declaration.id)) {\n          if (path.node.declaration.id.name === node.name) {\n            path.remove()\n            removed = true\n          }\n        }\n      }\n    },\n  })\n\n  return removed\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/code-splitter/framework-options.ts",
    "content": "type FrameworkOptions = {\n  package: string\n  idents: {\n    createFileRoute: string\n    lazyFn: string\n    lazyRouteComponent: string\n  }\n}\n\nexport function getFrameworkOptions(framework: string): FrameworkOptions {\n  let frameworkOptions: FrameworkOptions\n\n  switch (framework) {\n    case 'react':\n      frameworkOptions = {\n        package: '@tanstack/react-router',\n        idents: {\n          createFileRoute: 'createFileRoute',\n          lazyFn: 'lazyFn',\n          lazyRouteComponent: 'lazyRouteComponent',\n        },\n      }\n      break\n    case 'solid':\n      frameworkOptions = {\n        package: '@tanstack/solid-router',\n        idents: {\n          createFileRoute: 'createFileRoute',\n          lazyFn: 'lazyFn',\n          lazyRouteComponent: 'lazyRouteComponent',\n        },\n      }\n      break\n    case 'vue':\n      frameworkOptions = {\n        package: '@tanstack/vue-router',\n        idents: {\n          createFileRoute: 'createFileRoute',\n          lazyFn: 'lazyFn',\n          lazyRouteComponent: 'lazyRouteComponent',\n        },\n      }\n      break\n    default:\n      throw new Error(\n        `[getFrameworkOptions] - Unsupported framework: ${framework}`,\n      )\n  }\n\n  return frameworkOptions\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/code-splitter/path-ids.ts",
    "content": "export function createIdentifier(strings: Array<string>): string {\n  if (strings.length === 0) {\n    throw new Error('Cannot create an identifier from an empty array')\n  }\n\n  const sortedStrings = [...strings].sort()\n  const combinedString = sortedStrings.join('---') // Delimiter\n\n  // Replace unsafe characters\n  let safeString = combinedString.replace(/\\//g, '--slash--')\n  safeString = safeString.replace(/\\\\/g, '--backslash--')\n  safeString = safeString.replace(/\\?/g, '--question--')\n  safeString = safeString.replace(/%/g, '--percent--')\n  safeString = safeString.replace(/#/g, '--hash--')\n  safeString = safeString.replace(/\\+/g, '--plus--')\n  safeString = safeString.replace(/=/g, '--equals--')\n  safeString = safeString.replace(/&/g, '--ampersand--')\n  safeString = safeString.replace(/\\s/g, '_') // Replace spaces with underscores\n\n  return safeString\n}\n\nexport function decodeIdentifier(identifier: string): Array<string> {\n  if (!identifier) {\n    return []\n  }\n\n  let combinedString = identifier.replace(/--slash--/g, '/')\n  combinedString = combinedString.replace(/--backslash--/g, '\\\\')\n  combinedString = combinedString.replace(/--question--/g, '?')\n  combinedString = combinedString.replace(/--percent--/g, '%')\n  combinedString = combinedString.replace(/--hash--/g, '#')\n  combinedString = combinedString.replace(/--plus--/g, '+')\n  combinedString = combinedString.replace(/--equals--/g, '=')\n  combinedString = combinedString.replace(/--ampersand--/g, '&')\n  combinedString = combinedString.replace(/_/g, ' ') // Restore spaces\n\n  return combinedString.split('---')\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/code-splitter/plugins/framework-plugins.ts",
    "content": "import { createReactRefreshRouteComponentsPlugin } from './react-refresh-route-components'\nimport type { ReferenceRouteCompilerPlugin } from '../plugins'\nimport type { Config } from '../../config'\n\nexport function getReferenceRouteCompilerPlugins(opts: {\n  targetFramework: Config['target']\n  addHmr?: boolean\n}): Array<ReferenceRouteCompilerPlugin> | undefined {\n  switch (opts.targetFramework) {\n    case 'react': {\n      if (opts.addHmr) {\n        return [createReactRefreshRouteComponentsPlugin()]\n      }\n      return undefined\n    }\n    default:\n      return undefined\n  }\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/code-splitter/plugins/react-refresh-route-components.ts",
    "content": "import * as t from '@babel/types'\nimport { getUniqueProgramIdentifier } from '../../utils'\nimport type { ReferenceRouteCompilerPlugin } from '../plugins'\n\nconst REACT_REFRESH_ROUTE_COMPONENT_IDENTS = new Set([\n  'component',\n  'pendingComponent',\n  'errorComponent',\n  'notFoundComponent',\n])\n\nexport function createReactRefreshRouteComponentsPlugin(): ReferenceRouteCompilerPlugin {\n  return {\n    name: 'react-refresh-route-components',\n    onUnsplittableRoute(ctx) {\n      if (!ctx.opts.addHmr) {\n        return\n      }\n\n      const hoistedDeclarations: Array<t.VariableDeclaration> = []\n\n      ctx.routeOptions.properties.forEach((prop) => {\n        if (!t.isObjectProperty(prop) || !t.isIdentifier(prop.key)) {\n          return\n        }\n\n        if (!REACT_REFRESH_ROUTE_COMPONENT_IDENTS.has(prop.key.name)) {\n          return\n        }\n\n        if (\n          !t.isArrowFunctionExpression(prop.value) &&\n          !t.isFunctionExpression(prop.value)\n        ) {\n          return\n        }\n\n        const hoistedIdentifier = getUniqueProgramIdentifier(\n          ctx.programPath,\n          `TSR${prop.key.name[0]!.toUpperCase()}${prop.key.name.slice(1)}`,\n        )\n\n        hoistedDeclarations.push(\n          t.variableDeclaration('const', [\n            t.variableDeclarator(\n              hoistedIdentifier,\n              t.cloneNode(prop.value, true),\n            ),\n          ]),\n        )\n\n        prop.value = t.cloneNode(hoistedIdentifier)\n      })\n\n      if (hoistedDeclarations.length === 0) {\n        return\n      }\n\n      ctx.insertionPath.insertBefore(hoistedDeclarations)\n      return { modified: true }\n    },\n  }\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/code-splitter/plugins.ts",
    "content": "import type babel from '@babel/core'\nimport type * as t from '@babel/types'\nimport type { Config, DeletableNodes } from '../config'\nimport type { CodeSplitGroupings } from '../constants'\n\nexport type CompileCodeSplitReferenceRouteOptions = {\n  codeSplitGroupings: CodeSplitGroupings\n  deleteNodes?: Set<DeletableNodes>\n  targetFramework: Config['target']\n  filename: string\n  id: string\n  addHmr?: boolean\n  sharedBindings?: Set<string>\n}\n\nexport type ReferenceRouteCompilerPluginContext = {\n  programPath: babel.NodePath<t.Program>\n  callExpressionPath: babel.NodePath<t.CallExpression>\n  insertionPath: babel.NodePath\n  routeOptions: t.ObjectExpression\n  createRouteFn: string\n  opts: CompileCodeSplitReferenceRouteOptions\n}\n\nexport type ReferenceRouteCompilerPluginResult = {\n  modified?: boolean\n}\n\nexport type ReferenceRouteCompilerPlugin = {\n  name: string\n  onUnsplittableRoute?: (\n    ctx: ReferenceRouteCompilerPluginContext,\n  ) => void | ReferenceRouteCompilerPluginResult\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/config.ts",
    "content": "import { z } from 'zod'\nimport {\n  configSchema as generatorConfigSchema,\n  getConfig as getGeneratorConfig,\n} from '@tanstack/router-generator'\nimport type {\n  CreateFileRoute,\n  RegisteredRouter,\n  RouteIds,\n} from '@tanstack/router-core'\nimport type { CodeSplitGroupings } from './constants'\n\nexport const splitGroupingsSchema = z\n  .array(\n    z.array(\n      z.union([\n        z.literal('loader'),\n        z.literal('component'),\n        z.literal('pendingComponent'),\n        z.literal('errorComponent'),\n        z.literal('notFoundComponent'),\n      ]),\n    ),\n    {\n      message:\n        \"  Must be an Array of Arrays containing the split groupings. i.e. [['component'], ['pendingComponent'], ['errorComponent', 'notFoundComponent']]\",\n    },\n  )\n  .superRefine((val, ctx) => {\n    const flattened = val.flat()\n    const unique = [...new Set(flattened)]\n\n    // Elements must be unique,\n    // ie. this shouldn't be allows [['component'], ['component', 'loader']]\n    if (unique.length !== flattened.length) {\n      ctx.addIssue({\n        code: 'custom',\n        message:\n          \"  Split groupings must be unique and not repeated. i.e. i.e. [['component'], ['pendingComponent'], ['errorComponent', 'notFoundComponent']].\" +\n          `\\n  You input was: ${JSON.stringify(val)}.`,\n      })\n    }\n  })\n\nexport type CodeSplittingOptions = {\n  /**\n   * Use this function to programmatically control the code splitting behavior\n   * based on the `routeId` for each route.\n   *\n   * If you just need to change the default behavior, you can use the `defaultBehavior` option.\n   * @param params\n   */\n  splitBehavior?: (params: {\n    routeId: RouteIds<RegisteredRouter['routeTree']>\n  }) => CodeSplitGroupings | undefined | void\n\n  /**\n   * The default/global configuration to control your code splitting behavior per route.\n   * @default [['component'],['pendingComponent'],['errorComponent'],['notFoundComponent']]\n   */\n  defaultBehavior?: CodeSplitGroupings\n\n  /**\n   * The nodes that shall be deleted from the route.\n   * @default undefined\n   */\n  deleteNodes?: Array<DeletableNodes>\n\n  /**\n   * @default true\n   */\n  addHmr?: boolean\n}\n\nconst codeSplittingOptionsSchema = z.object({\n  splitBehavior: z.function().optional(),\n  defaultBehavior: splitGroupingsSchema.optional(),\n  deleteNodes: z.array(z.string()).optional(),\n  addHmr: z.boolean().optional().default(true),\n})\n\ntype FileRouteKeys = keyof (Parameters<\n  CreateFileRoute<any, any, any, any, any>\n>[0] & {})\nexport type DeletableNodes = FileRouteKeys | (string & {})\n\nexport const configSchema = generatorConfigSchema.extend({\n  enableRouteGeneration: z.boolean().optional(),\n  codeSplittingOptions: z\n    .custom<CodeSplittingOptions>((v) => {\n      return codeSplittingOptionsSchema.parse(v)\n    })\n    .optional(),\n  plugin: z\n    .object({\n      vite: z\n        .object({\n          environmentName: z.string().optional(),\n        })\n        .optional(),\n    })\n    .optional(),\n})\n\nexport const getConfig = (inlineConfig: Partial<Config>, root: string) => {\n  const config = getGeneratorConfig(inlineConfig, root)\n\n  return configSchema.parse({ ...inlineConfig, ...config })\n}\n\nexport type Config = z.infer<typeof configSchema>\nexport type ConfigInput = z.input<typeof configSchema>\nexport type ConfigOutput = z.output<typeof configSchema>\n"
  },
  {
    "path": "packages/router-plugin/src/core/constants.ts",
    "content": "export const tsrSplit = 'tsr-split'\nexport const tsrShared = 'tsr-shared'\n\nexport const splitRouteIdentNodes = [\n  'loader',\n  'component',\n  'pendingComponent',\n  'errorComponent',\n  'notFoundComponent',\n] as const\nexport type SplitRouteIdentNodes = (typeof splitRouteIdentNodes)[number]\nexport type CodeSplitGroupings = Array<Array<SplitRouteIdentNodes>>\n\nexport const defaultCodeSplitGroupings: CodeSplitGroupings = [\n  ['component'],\n  ['errorComponent'],\n  ['notFoundComponent'],\n]\n"
  },
  {
    "path": "packages/router-plugin/src/core/route-autoimport-plugin.ts",
    "content": "import { generateFromAst, logDiff, parseAst } from '@tanstack/router-utils'\nimport * as babel from '@babel/core'\nimport * as template from '@babel/template'\nimport { getConfig } from './config'\nimport { debug, normalizePath } from './utils'\nimport type { Config } from './config'\nimport type { UnpluginFactory } from 'unplugin'\n\n/**\n * This plugin adds imports for createFileRoute and createLazyFileRoute to the file route.\n */\nexport const unpluginRouteAutoImportFactory: UnpluginFactory<\n  Partial<Config | (() => Config)> | undefined\n> = (options = {}) => {\n  let ROOT: string = process.cwd()\n  let userConfig: Config\n\n  function initUserConfig() {\n    if (typeof options === 'function') {\n      userConfig = options()\n    } else {\n      userConfig = getConfig(options, ROOT)\n    }\n  }\n  return {\n    name: 'tanstack-router:autoimport',\n    enforce: 'pre',\n\n    transform: {\n      filter: {\n        // this is necessary for webpack / rspack to avoid matching .html files\n        id: /\\.(m|c)?(j|t)sx?$/,\n        code: /createFileRoute\\(|createLazyFileRoute\\(/,\n      },\n      handler(code, id) {\n        const normalizedId = normalizePath(id)\n        if (!globalThis.TSR_ROUTES_BY_ID_MAP?.has(normalizedId)) {\n          return null\n        }\n        let routeType: 'createFileRoute' | 'createLazyFileRoute'\n        if (code.includes('createFileRoute(')) {\n          routeType = 'createFileRoute'\n        } else if (code.includes('createLazyFileRoute(')) {\n          routeType = 'createLazyFileRoute'\n        } else {\n          return null\n        }\n\n        const routerImportPath = `@tanstack/${userConfig.target}-router`\n\n        const ast = parseAst({ code })\n\n        let isCreateRouteFunctionImported = false as boolean\n\n        babel.traverse(ast, {\n          Program: {\n            enter(programPath) {\n              programPath.traverse({\n                ImportDeclaration(path) {\n                  const importedSpecifiers = path.node.specifiers.map(\n                    (specifier) => specifier.local.name,\n                  )\n                  if (\n                    importedSpecifiers.includes(routeType) &&\n                    path.node.source.value === routerImportPath\n                  ) {\n                    isCreateRouteFunctionImported = true\n                  }\n                },\n              })\n            },\n          },\n        })\n\n        if (!isCreateRouteFunctionImported) {\n          if (debug) console.info('Adding autoimports to route ', normalizedId)\n\n          const autoImportStatement = template.statement(\n            `import { ${routeType} } from '${routerImportPath}'`,\n          )()\n          ast.program.body.unshift(autoImportStatement)\n\n          const result = generateFromAst(ast, {\n            sourceMaps: true,\n            filename: normalizedId,\n            sourceFileName: normalizedId,\n          })\n          if (debug) {\n            logDiff(code, result.code)\n            console.log('Output:\\n', result.code + '\\n\\n')\n          }\n          return result\n        }\n\n        return null\n      },\n    },\n\n    vite: {\n      configResolved(config) {\n        ROOT = config.root\n        initUserConfig()\n      },\n      // this check may only happen after config is resolved, so we use applyToEnvironment (apply is too early)\n      applyToEnvironment() {\n        return userConfig.verboseFileRoutes === false\n      },\n    },\n\n    rspack() {\n      ROOT = process.cwd()\n      initUserConfig()\n    },\n\n    webpack() {\n      ROOT = process.cwd()\n      initUserConfig()\n    },\n  }\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/route-hmr-statement.ts",
    "content": "import * as template from '@babel/template'\nimport type { AnyRoute, AnyRouteMatch, AnyRouter } from '@tanstack/router-core'\n\ntype AnyRouteWithPrivateProps = AnyRoute & {\n  _path: string\n  _id: string\n  _fullPath: string\n  _to: string\n}\n\nfunction handleRouteUpdate(\n  oldRoute: AnyRouteWithPrivateProps,\n  newRoute: AnyRouteWithPrivateProps,\n) {\n  newRoute._path = oldRoute._path\n  newRoute._id = oldRoute._id\n  newRoute._fullPath = oldRoute._fullPath\n  newRoute._to = oldRoute._to\n  newRoute.children = oldRoute.children\n  newRoute.parentRoute = oldRoute.parentRoute\n\n  const router = window.__TSR_ROUTER__!\n  router.routesById[newRoute.id] = newRoute\n  router.routesByPath[newRoute.fullPath] = newRoute\n  router.processedTree.matchCache.clear()\n  router.processedTree.flatCache?.clear()\n  router.processedTree.singleCache.clear()\n  router.resolvePathCache.clear()\n  // TODO: how to rebuild the tree if we add a new route?\n  walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree)\n  const filter = (m: AnyRouteMatch) => m.routeId === oldRoute.id\n  if (\n    router.stores.activeMatchesSnapshot.state.find(filter) ||\n    router.stores.pendingMatchesSnapshot.state.find(filter)\n  ) {\n    router.invalidate({ filter })\n  }\n  function walkReplaceSegmentTree(\n    route: AnyRouteWithPrivateProps,\n    node: AnyRouter['processedTree']['segmentTree'],\n  ) {\n    if (node.route?.id === route.id) node.route = route\n    if (node.index) walkReplaceSegmentTree(route, node.index)\n    node.static?.forEach((child) => walkReplaceSegmentTree(route, child))\n    node.staticInsensitive?.forEach((child) =>\n      walkReplaceSegmentTree(route, child),\n    )\n    node.dynamic?.forEach((child) => walkReplaceSegmentTree(route, child))\n    node.optional?.forEach((child) => walkReplaceSegmentTree(route, child))\n    node.wildcard?.forEach((child) => walkReplaceSegmentTree(route, child))\n  }\n}\n\nexport const routeHmrStatement = template.statement(\n  `\nif (import.meta.hot) {\n  import.meta.hot.accept((newModule) => {\n    if (Route && newModule && newModule.Route) {\n      (${handleRouteUpdate.toString()})(Route, newModule.Route)\n    }\n   })\n}\n`,\n  // Disable placeholder parsing so identifiers like __TSR_ROUTER__ are treated as normal identifiers instead of template placeholders\n  { placeholderPattern: false },\n)()\n"
  },
  {
    "path": "packages/router-plugin/src/core/router-code-splitter-plugin.ts",
    "content": "/**\n * It is important to familiarize yourself with how the code-splitting works in this plugin.\n * https://github.com/TanStack/router/pull/3355\n */\n\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { logDiff } from '@tanstack/router-utils'\nimport { getConfig, splitGroupingsSchema } from './config'\nimport {\n  compileCodeSplitReferenceRoute,\n  compileCodeSplitSharedRoute,\n  compileCodeSplitVirtualRoute,\n  computeSharedBindings,\n  detectCodeSplitGroupingsFromRoute,\n} from './code-splitter/compilers'\nimport { getReferenceRouteCompilerPlugins } from './code-splitter/plugins/framework-plugins'\nimport {\n  defaultCodeSplitGroupings,\n  splitRouteIdentNodes,\n  tsrShared,\n  tsrSplit,\n} from './constants'\nimport { decodeIdentifier } from './code-splitter/path-ids'\nimport { debug, normalizePath } from './utils'\nimport type { CodeSplitGroupings, SplitRouteIdentNodes } from './constants'\nimport type { GetRoutesByFileMapResultValue } from '@tanstack/router-generator'\nimport type { Config } from './config'\nimport type {\n  UnpluginFactory,\n  TransformResult as UnpluginTransformResult,\n} from 'unplugin'\n\nconst PLUGIN_NAME = 'unplugin:router-code-splitter'\nconst CODE_SPLITTER_PLUGIN_NAME =\n  'tanstack-router:code-splitter:compile-reference-file'\n\ntype TransformationPluginInfo = {\n  pluginNames: Array<string>\n  pkg: string\n  usage: string\n}\n\n/**\n * JSX transformation plugins grouped by framework.\n * These plugins must come AFTER the TanStack Router plugin in the Vite config.\n */\nconst TRANSFORMATION_PLUGINS_BY_FRAMEWORK: Record<\n  string,\n  Array<TransformationPluginInfo>\n> = {\n  react: [\n    {\n      // Babel-based React plugin\n      pluginNames: ['vite:react-babel', 'vite:react-refresh'],\n      pkg: '@vitejs/plugin-react',\n      usage: 'react()',\n    },\n    {\n      // SWC-based React plugin\n      pluginNames: ['vite:react-swc', 'vite:react-swc:resolve-runtime'],\n      pkg: '@vitejs/plugin-react-swc',\n      usage: 'reactSwc()',\n    },\n    {\n      // OXC-based React plugin (deprecated but should still be handled)\n      pluginNames: ['vite:react-oxc:config', 'vite:react-oxc:refresh-runtime'],\n      pkg: '@vitejs/plugin-react-oxc',\n      usage: 'reactOxc()',\n    },\n  ],\n  solid: [\n    {\n      pluginNames: ['solid'],\n      pkg: 'vite-plugin-solid',\n      usage: 'solid()',\n    },\n  ],\n}\n\nexport const unpluginRouterCodeSplitterFactory: UnpluginFactory<\n  Partial<Config | (() => Config)> | undefined\n> = (options = {}, { framework: _framework }) => {\n  let ROOT: string = process.cwd()\n  let userConfig: Config\n\n  function initUserConfig() {\n    if (typeof options === 'function') {\n      userConfig = options()\n    } else {\n      userConfig = getConfig(options, ROOT)\n    }\n  }\n  const isProduction = process.env.NODE_ENV === 'production'\n  // Map from normalized route file path → set of shared binding names.\n  // Populated by the reference compiler, consumed by virtual and shared compilers.\n  const sharedBindingsMap = new Map<string, Set<string>>()\n\n  const getGlobalCodeSplitGroupings = () => {\n    return (\n      userConfig.codeSplittingOptions?.defaultBehavior ||\n      defaultCodeSplitGroupings\n    )\n  }\n  const getShouldSplitFn = () => {\n    return userConfig.codeSplittingOptions?.splitBehavior\n  }\n\n  const handleCompilingReferenceFile = (\n    code: string,\n    id: string,\n    generatorNodeInfo: GetRoutesByFileMapResultValue,\n  ): UnpluginTransformResult => {\n    if (debug) console.info('Compiling Route: ', id)\n\n    const fromCode = detectCodeSplitGroupingsFromRoute({\n      code,\n    })\n\n    if (fromCode.groupings) {\n      const res = splitGroupingsSchema.safeParse(fromCode.groupings)\n      if (!res.success) {\n        const message = res.error.errors.map((e) => e.message).join('. ')\n        throw new Error(\n          `The groupings for the route \"${id}\" are invalid.\\n${message}`,\n        )\n      }\n    }\n\n    const userShouldSplitFn = getShouldSplitFn()\n\n    const pluginSplitBehavior = userShouldSplitFn?.({\n      routeId: generatorNodeInfo.routePath,\n    }) as CodeSplitGroupings | undefined\n\n    if (pluginSplitBehavior) {\n      const res = splitGroupingsSchema.safeParse(pluginSplitBehavior)\n      if (!res.success) {\n        const message = res.error.errors.map((e) => e.message).join('. ')\n        throw new Error(\n          `The groupings returned when using \\`splitBehavior\\` for the route \"${id}\" are invalid.\\n${message}`,\n        )\n      }\n    }\n\n    const splitGroupings: CodeSplitGroupings =\n      fromCode.groupings || pluginSplitBehavior || getGlobalCodeSplitGroupings()\n\n    // Compute shared bindings before compiling the reference route\n    const sharedBindings = computeSharedBindings({\n      code,\n      codeSplitGroupings: splitGroupings,\n    })\n    if (sharedBindings.size > 0) {\n      sharedBindingsMap.set(id, sharedBindings)\n    } else {\n      sharedBindingsMap.delete(id)\n    }\n\n    const addHmr =\n      (userConfig.codeSplittingOptions?.addHmr ?? true) && !isProduction\n\n    const compiledReferenceRoute = compileCodeSplitReferenceRoute({\n      code,\n      codeSplitGroupings: splitGroupings,\n      targetFramework: userConfig.target,\n      filename: id,\n      id,\n      deleteNodes: userConfig.codeSplittingOptions?.deleteNodes\n        ? new Set(userConfig.codeSplittingOptions.deleteNodes)\n        : undefined,\n      addHmr,\n      sharedBindings: sharedBindings.size > 0 ? sharedBindings : undefined,\n      compilerPlugins: getReferenceRouteCompilerPlugins({\n        targetFramework: userConfig.target,\n        addHmr,\n      }),\n    })\n\n    if (compiledReferenceRoute === null) {\n      if (debug) {\n        console.info(\n          `No changes made to route \"${id}\", skipping code-splitting.`,\n        )\n      }\n      return null\n    }\n    if (debug) {\n      logDiff(code, compiledReferenceRoute.code)\n      console.log('Output:\\n', compiledReferenceRoute.code + '\\n\\n')\n    }\n\n    return compiledReferenceRoute\n  }\n\n  const handleCompilingVirtualFile = (\n    code: string,\n    id: string,\n  ): UnpluginTransformResult => {\n    if (debug) console.info('Splitting Route: ', id)\n\n    const [_, ...pathnameParts] = id.split('?')\n\n    const searchParams = new URLSearchParams(pathnameParts.join('?'))\n    const splitValue = searchParams.get(tsrSplit)\n\n    if (!splitValue) {\n      throw new Error(\n        `The split value for the virtual route \"${id}\" was not found.`,\n      )\n    }\n\n    const rawGrouping = decodeIdentifier(splitValue)\n    const grouping = [...new Set(rawGrouping)].filter((p) =>\n      splitRouteIdentNodes.includes(p as any),\n    ) as Array<SplitRouteIdentNodes>\n\n    const baseId = id.split('?')[0]!\n    const resolvedSharedBindings = sharedBindingsMap.get(baseId)\n\n    const result = compileCodeSplitVirtualRoute({\n      code,\n      filename: id,\n      splitTargets: grouping,\n      sharedBindings: resolvedSharedBindings,\n    })\n\n    if (debug) {\n      logDiff(code, result.code)\n      console.log('Output:\\n', result.code + '\\n\\n')\n    }\n\n    return result\n  }\n\n  const includedCode = [\n    'createFileRoute(',\n    'createRootRoute(',\n    'createRootRouteWithContext(',\n  ]\n  return [\n    {\n      name: 'tanstack-router:code-splitter:compile-reference-file',\n      enforce: 'pre',\n\n      transform: {\n        filter: {\n          id: {\n            exclude: [tsrSplit, tsrShared],\n            // this is necessary for webpack / rspack to avoid matching .html files\n            include: /\\.(m|c)?(j|t)sx?$/,\n          },\n          code: {\n            include: includedCode,\n          },\n        },\n        handler(code, id) {\n          const normalizedId = normalizePath(id)\n          const generatorFileInfo =\n            globalThis.TSR_ROUTES_BY_ID_MAP?.get(normalizedId)\n          if (\n            generatorFileInfo &&\n            includedCode.some((included) => code.includes(included))\n          ) {\n            return handleCompilingReferenceFile(\n              code,\n              normalizedId,\n              generatorFileInfo,\n            )\n          }\n\n          return null\n        },\n      },\n\n      vite: {\n        configResolved(config) {\n          ROOT = config.root\n          initUserConfig()\n\n          // Validate plugin order - router must come before JSX transformation plugins\n          const routerPluginIndex = config.plugins.findIndex(\n            (p) => p.name === CODE_SPLITTER_PLUGIN_NAME,\n          )\n\n          if (routerPluginIndex === -1) return\n\n          const frameworkPlugins =\n            TRANSFORMATION_PLUGINS_BY_FRAMEWORK[userConfig.target]\n          if (!frameworkPlugins) return\n\n          for (const transformPlugin of frameworkPlugins) {\n            const transformPluginIndex = config.plugins.findIndex((p) =>\n              transformPlugin.pluginNames.includes(p.name),\n            )\n\n            if (\n              transformPluginIndex !== -1 &&\n              transformPluginIndex < routerPluginIndex\n            ) {\n              throw new Error(\n                `Plugin order error: '${transformPlugin.pkg}' is placed before '@tanstack/router-plugin'.\\n\\n` +\n                  `The TanStack Router plugin must come BEFORE JSX transformation plugins.\\n\\n` +\n                  `Please update your Vite config:\\n\\n` +\n                  `  plugins: [\\n` +\n                  `    tanstackRouter(),\\n` +\n                  `    ${transformPlugin.usage},\\n` +\n                  `  ]\\n`,\n              )\n            }\n          }\n        },\n        applyToEnvironment(environment) {\n          if (userConfig.plugin?.vite?.environmentName) {\n            return userConfig.plugin.vite.environmentName === environment.name\n          }\n          return true\n        },\n      },\n\n      rspack(compiler) {\n        ROOT = process.cwd()\n        initUserConfig()\n\n        if (compiler.options.mode === 'production') {\n          compiler.hooks.done.tap(PLUGIN_NAME, () => {\n            console.info('✅ ' + PLUGIN_NAME + ': code-splitting done!')\n          })\n        }\n      },\n\n      webpack(compiler) {\n        ROOT = process.cwd()\n        initUserConfig()\n\n        if (compiler.options.mode === 'production') {\n          compiler.hooks.done.tap(PLUGIN_NAME, () => {\n            console.info('✅ ' + PLUGIN_NAME + ': code-splitting done!')\n          })\n        }\n      },\n    },\n    {\n      name: 'tanstack-router:code-splitter:compile-virtual-file',\n      enforce: 'pre',\n\n      transform: {\n        filter: {\n          id: /tsr-split/,\n        },\n        handler(code, id) {\n          const url = pathToFileURL(id)\n          url.searchParams.delete('v')\n          const normalizedId = normalizePath(fileURLToPath(url))\n          return handleCompilingVirtualFile(code, normalizedId)\n        },\n      },\n\n      vite: {\n        applyToEnvironment(environment) {\n          if (userConfig.plugin?.vite?.environmentName) {\n            return userConfig.plugin.vite.environmentName === environment.name\n          }\n          return true\n        },\n      },\n    },\n    {\n      name: 'tanstack-router:code-splitter:compile-shared-file',\n      enforce: 'pre',\n\n      transform: {\n        filter: {\n          id: /tsr-shared/,\n        },\n        handler(code, id) {\n          const url = pathToFileURL(id)\n          url.searchParams.delete('v')\n          const normalizedId = normalizePath(fileURLToPath(url))\n          const [baseId] = normalizedId.split('?')\n\n          if (!baseId) return null\n\n          const sharedBindings = sharedBindingsMap.get(baseId)\n          if (!sharedBindings || sharedBindings.size === 0) return null\n\n          if (debug) console.info('Compiling Shared Module: ', id)\n\n          const result = compileCodeSplitSharedRoute({\n            code,\n            sharedBindings,\n            filename: normalizedId,\n          })\n\n          if (debug) {\n            logDiff(code, result.code)\n            console.log('Output:\\n', result.code + '\\n\\n')\n          }\n\n          return result\n        },\n      },\n\n      vite: {\n        applyToEnvironment(environment) {\n          if (userConfig.plugin?.vite?.environmentName) {\n            return userConfig.plugin.vite.environmentName === environment.name\n          }\n          return true\n        },\n      },\n    },\n  ]\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/router-composed-plugin.ts",
    "content": "import { getConfig } from '@tanstack/router-generator'\nimport { unpluginRouterGeneratorFactory } from './router-generator-plugin'\nimport { unpluginRouterCodeSplitterFactory } from './router-code-splitter-plugin'\nimport { unpluginRouterHmrFactory } from './router-hmr-plugin'\nimport { unpluginRouteAutoImportFactory } from './route-autoimport-plugin'\nimport type { Config } from './config'\nimport type { UnpluginFactory } from 'unplugin'\n\nexport const unpluginRouterComposedFactory: UnpluginFactory<\n  Partial<Config> | undefined\n> = (options = {}, meta) => {\n  const ROOT: string = process.cwd()\n  const userConfig = getConfig(options, ROOT)\n\n  const getPlugin = (pluginFactory: UnpluginFactory<Partial<Config>>) => {\n    const plugin = pluginFactory(options, meta)\n    if (!Array.isArray(plugin)) {\n      return [plugin]\n    }\n    return plugin\n  }\n\n  const routerGenerator = getPlugin(unpluginRouterGeneratorFactory)\n  const routerCodeSplitter = getPlugin(unpluginRouterCodeSplitterFactory)\n  const routeAutoImport = getPlugin(unpluginRouteAutoImportFactory)\n\n  const result = [...routerGenerator]\n  if (userConfig.autoCodeSplitting) {\n    result.push(...routerCodeSplitter)\n  }\n  if (userConfig.verboseFileRoutes === false) {\n    result.push(...routeAutoImport)\n  }\n\n  const isProduction = process.env.NODE_ENV === 'production'\n\n  if (!isProduction && !userConfig.autoCodeSplitting) {\n    const routerHmr = getPlugin(unpluginRouterHmrFactory)\n    result.push(...routerHmr)\n  }\n  return result\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/router-generator-plugin.ts",
    "content": "import { isAbsolute, join, normalize } from 'node:path'\nimport { Generator, resolveConfigPath } from '@tanstack/router-generator'\nimport { getConfig } from './config'\n\nimport type { GeneratorEvent } from '@tanstack/router-generator'\nimport type { FSWatcher } from 'chokidar'\nimport type { UnpluginFactory } from 'unplugin'\nimport type { Config } from './config'\n\nconst PLUGIN_NAME = 'unplugin:router-generator'\n\nexport const unpluginRouterGeneratorFactory: UnpluginFactory<\n  Partial<Config | (() => Config)> | undefined\n> = (options = {}) => {\n  let ROOT: string = process.cwd()\n  let userConfig: Config\n  let generator: Generator\n\n  const routeGenerationDisabled = () =>\n    userConfig.enableRouteGeneration === false\n  const getRoutesDirectoryPath = () => {\n    return isAbsolute(userConfig.routesDirectory)\n      ? userConfig.routesDirectory\n      : join(ROOT, userConfig.routesDirectory)\n  }\n\n  const initConfigAndGenerator = (opts?: { root?: string }) => {\n    if (opts?.root) {\n      ROOT = opts.root\n    }\n    if (typeof options === 'function') {\n      userConfig = options()\n    } else {\n      userConfig = getConfig(options, ROOT)\n    }\n    generator = new Generator({\n      config: userConfig,\n      root: ROOT,\n    })\n  }\n\n  const generate = async (opts?: {\n    file: string\n    event: 'create' | 'update' | 'delete'\n  }) => {\n    if (routeGenerationDisabled()) {\n      return\n    }\n    let generatorEvent: GeneratorEvent | undefined = undefined\n    if (opts) {\n      const filePath = normalize(opts.file)\n      if (filePath === resolveConfigPath({ configDirectory: ROOT })) {\n        initConfigAndGenerator()\n        return\n      }\n      generatorEvent = { path: filePath, type: opts.event }\n    }\n\n    try {\n      await generator.run(generatorEvent)\n      globalThis.TSR_ROUTES_BY_ID_MAP = generator.getRoutesByFileMap()\n    } catch (e) {\n      console.error(e)\n    }\n  }\n\n  return {\n    name: 'tanstack:router-generator',\n    enforce: 'pre',\n    async watchChange(id, { event }) {\n      await generate({\n        file: id,\n        event,\n      })\n    },\n    vite: {\n      async configResolved(config) {\n        initConfigAndGenerator({ root: config.root })\n        await generate()\n      },\n    },\n    rspack(compiler) {\n      initConfigAndGenerator()\n\n      let handle: FSWatcher | null = null\n\n      compiler.hooks.beforeRun.tapPromise(PLUGIN_NAME, () => generate())\n\n      compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, async () => {\n        if (handle) {\n          return\n        }\n\n        // rspack watcher doesn't register newly created files\n        const routesDirectoryPath = getRoutesDirectoryPath()\n        const chokidar = await import('chokidar')\n        handle = chokidar\n          .watch(routesDirectoryPath, { ignoreInitial: true })\n          .on('add', (file) => generate({ file, event: 'create' }))\n\n        await generate()\n      })\n\n      compiler.hooks.watchClose.tap(PLUGIN_NAME, async () => {\n        if (handle) {\n          await handle.close()\n        }\n      })\n    },\n    webpack(compiler) {\n      initConfigAndGenerator()\n\n      let handle: FSWatcher | null = null\n\n      compiler.hooks.beforeRun.tapPromise(PLUGIN_NAME, () => generate())\n\n      compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, async () => {\n        if (handle) {\n          return\n        }\n\n        // webpack watcher doesn't register newly created files\n        const routesDirectoryPath = getRoutesDirectoryPath()\n        const chokidar = await import('chokidar')\n        handle = chokidar\n          .watch(routesDirectoryPath, { ignoreInitial: true })\n          .on('add', (file) => generate({ file, event: 'create' }))\n\n        await generate()\n      })\n\n      compiler.hooks.watchClose.tap(PLUGIN_NAME, async () => {\n        if (handle) {\n          await handle.close()\n        }\n      })\n\n      compiler.hooks.done.tap(PLUGIN_NAME, () => {\n        console.info('✅ ' + PLUGIN_NAME + ': route-tree generation done')\n      })\n    },\n    esbuild: {\n      config() {\n        initConfigAndGenerator()\n      },\n    },\n  }\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/router-hmr-plugin.ts",
    "content": "import { generateFromAst, logDiff, parseAst } from '@tanstack/router-utils'\nimport { compileCodeSplitReferenceRoute } from './code-splitter/compilers'\nimport { getReferenceRouteCompilerPlugins } from './code-splitter/plugins/framework-plugins'\nimport { routeHmrStatement } from './route-hmr-statement'\nimport { debug, normalizePath } from './utils'\nimport { getConfig } from './config'\nimport type { UnpluginFactory } from 'unplugin'\nimport type { Config } from './config'\n\n/**\n * This plugin adds HMR support for file routes.\n * It is only added to the composed plugin in dev when autoCodeSplitting is disabled, since the code splitting plugin\n * handles HMR for code-split routes itself.\n */\n\nconst includeCode = [\n  'createFileRoute(',\n  'createRootRoute(',\n  'createRootRouteWithContext(',\n]\nexport const unpluginRouterHmrFactory: UnpluginFactory<\n  Partial<Config> | undefined\n> = (options = {}) => {\n  let ROOT: string = process.cwd()\n  let userConfig = options as Config\n\n  return {\n    name: 'tanstack-router:hmr',\n    enforce: 'pre',\n    transform: {\n      filter: {\n        // this is necessary for webpack / rspack to avoid matching .html files\n        id: /\\.(m|c)?(j|t)sx?$/,\n        code: {\n          include: includeCode,\n        },\n      },\n      handler(code, id) {\n        const normalizedId = normalizePath(id)\n        if (!globalThis.TSR_ROUTES_BY_ID_MAP?.has(normalizedId)) {\n          return null\n        }\n\n        if (debug) console.info('Adding HMR handling to route ', normalizedId)\n\n        if (userConfig.target === 'react') {\n          const compiled = compileCodeSplitReferenceRoute({\n            code,\n            filename: normalizedId,\n            id: normalizedId,\n            addHmr: true,\n            codeSplitGroupings: [],\n            targetFramework: 'react',\n            compilerPlugins: getReferenceRouteCompilerPlugins({\n              targetFramework: 'react',\n              addHmr: true,\n            }),\n          })\n\n          if (compiled) {\n            if (debug) {\n              logDiff(code, compiled.code)\n              console.log('Output:\\n', compiled.code + '\\n\\n')\n            }\n\n            return compiled\n          }\n        }\n\n        const ast = parseAst({ code })\n        ast.program.body.push(routeHmrStatement)\n        const result = generateFromAst(ast, {\n          sourceMaps: true,\n          filename: normalizedId,\n          sourceFileName: normalizedId,\n        })\n        if (debug) {\n          logDiff(code, result.code)\n          console.log('Output:\\n', result.code + '\\n\\n')\n        }\n        return result\n      },\n    },\n    vite: {\n      configResolved(config) {\n        ROOT = config.root\n        userConfig = getConfig(options, ROOT)\n      },\n      applyToEnvironment(environment) {\n        if (userConfig.plugin?.vite?.environmentName) {\n          return userConfig.plugin.vite.environmentName === environment.name\n        }\n        return true\n      },\n    },\n  }\n}\n"
  },
  {
    "path": "packages/router-plugin/src/core/utils.ts",
    "content": "import * as t from '@babel/types'\nimport type babel from '@babel/core'\n\nexport const debug =\n  process.env.TSR_VITE_DEBUG &&\n  ['true', 'router-plugin'].includes(process.env.TSR_VITE_DEBUG)\n\n/**\n * Normalizes a file path by converting Windows backslashes to forward slashes.\n * This ensures consistent path handling across different bundlers and operating systems.\n *\n * The route generator stores paths with forward slashes, but rspack/webpack on Windows\n * pass native paths with backslashes to transform handlers.\n */\nexport function normalizePath(path: string): string {\n  return path.replace(/\\\\/g, '/')\n}\n\nexport function getUniqueProgramIdentifier(\n  programPath: babel.NodePath<t.Program>,\n  baseName: string,\n): t.Identifier {\n  let name = baseName\n  let suffix = 2\n\n  while (\n    programPath.scope.hasBinding(name) ||\n    programPath.scope.hasGlobal(name)\n  ) {\n    name = `${baseName}${suffix}`\n    suffix++\n  }\n\n  return t.identifier(name)\n}\n"
  },
  {
    "path": "packages/router-plugin/src/esbuild.ts",
    "content": "import { createEsbuildPlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nimport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\n\nimport type { CodeSplittingOptions, Config } from './core/config'\n\n/**\n * @example\n * ```ts\n * export default {\n *   plugins: [TanStackRouterGeneratorEsbuild()],\n *   // ...\n * }\n * ```\n */\nconst TanStackRouterGeneratorEsbuild = createEsbuildPlugin(\n  unpluginRouterGeneratorFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default {\n *  plugins: [TanStackRouterCodeSplitterEsbuild()],\n *  // ...\n * }\n * ```\n */\nconst TanStackRouterCodeSplitterEsbuild = createEsbuildPlugin(\n  unpluginRouterCodeSplitterFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default {\n *   plugins: [tanstackRouter()],\n *   // ...\n * }\n * ```\n */\nconst TanStackRouterEsbuild = createEsbuildPlugin(unpluginRouterComposedFactory)\nconst tanstackRouter = TanStackRouterEsbuild\nexport default TanStackRouterEsbuild\n\nexport {\n  configSchema,\n  TanStackRouterGeneratorEsbuild,\n  TanStackRouterCodeSplitterEsbuild,\n  TanStackRouterEsbuild,\n  tanstackRouter,\n}\n\nexport type { Config, CodeSplittingOptions }\n"
  },
  {
    "path": "packages/router-plugin/src/global.d.ts",
    "content": "/* eslint-disable no-var */\nimport type { GetRoutesByFileMapResult } from '@tanstack/router-generator'\n\ndeclare global {\n  var TSR_ROUTES_BY_ID_MAP: GetRoutesByFileMapResult | undefined\n}\nexport {}\n"
  },
  {
    "path": "packages/router-plugin/src/index.ts",
    "content": "export { configSchema, getConfig } from './core/config'\nexport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nexport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nexport type {\n  Config,\n  ConfigInput,\n  ConfigOutput,\n  CodeSplittingOptions,\n  DeletableNodes,\n} from './core/config'\nexport {\n  tsrSplit,\n  splitRouteIdentNodes,\n  defaultCodeSplitGroupings,\n} from './core/constants'\n"
  },
  {
    "path": "packages/router-plugin/src/rspack.ts",
    "content": "import { createRspackPlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nimport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport type { CodeSplittingOptions, Config } from './core/config'\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n *   // ...\n *   tools: {\n *     rspack: {\n *       plugins: [TanStackRouterGeneratorRspack()],\n *     },\n *   },\n * })\n * ```\n */\nconst TanStackRouterGeneratorRspack = /* #__PURE__ */ createRspackPlugin(\n  unpluginRouterGeneratorFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n *   // ...\n *   tools: {\n *     rspack: {\n *       plugins: [TanStackRouterCodeSplitterRspack()],\n *     },\n *   },\n * })\n * ```\n */\nconst TanStackRouterCodeSplitterRspack = /* #__PURE__ */ createRspackPlugin(\n  unpluginRouterCodeSplitterFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n *   // ...\n *   tools: {\n *     rspack: {\n *       plugins: [tanstackRouter()],\n *     },\n *   },\n * })\n * ```\n */\nconst TanStackRouterRspack = /* #__PURE__ */ createRspackPlugin(\n  unpluginRouterComposedFactory,\n)\nconst tanstackRouter = TanStackRouterRspack\nexport default TanStackRouterRspack\nexport {\n  configSchema,\n  TanStackRouterRspack,\n  TanStackRouterGeneratorRspack,\n  TanStackRouterCodeSplitterRspack,\n  tanstackRouter,\n}\nexport type { Config, CodeSplittingOptions }\n"
  },
  {
    "path": "packages/router-plugin/src/vite.ts",
    "content": "import { createVitePlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nimport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport { unpluginRouteAutoImportFactory } from './core/route-autoimport-plugin'\nimport type { CodeSplittingOptions, Config, getConfig } from './core/config'\n\nconst tanstackRouterAutoImport = createVitePlugin(\n  unpluginRouteAutoImportFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n *   plugins: [tanstackRouterGenerator()],\n *   // ...\n * })\n * ```\n */\nconst tanstackRouterGenerator = createVitePlugin(unpluginRouterGeneratorFactory)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n *   plugins: [tanStackRouterCodeSplitter()],\n *   // ...\n * })\n * ```\n */\nconst tanStackRouterCodeSplitter = createVitePlugin(\n  unpluginRouterCodeSplitterFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default defineConfig({\n *   plugins: [tanstackRouter()],\n *   // ...\n * })\n * ```\n */\nconst tanstackRouter = createVitePlugin(unpluginRouterComposedFactory)\n\n/**\n * @deprecated Use `tanstackRouter` instead.\n */\nconst TanStackRouterVite = tanstackRouter\n\nexport default tanstackRouter\nexport {\n  configSchema,\n  getConfig,\n  tanstackRouterAutoImport,\n  tanStackRouterCodeSplitter,\n  tanstackRouterGenerator,\n  TanStackRouterVite,\n  tanstackRouter,\n}\n\nexport type { Config, CodeSplittingOptions }\n"
  },
  {
    "path": "packages/router-plugin/src/webpack.ts",
    "content": "import { createWebpackPlugin } from 'unplugin'\n\nimport { configSchema } from './core/config'\nimport { unpluginRouterCodeSplitterFactory } from './core/router-code-splitter-plugin'\nimport { unpluginRouterGeneratorFactory } from './core/router-generator-plugin'\nimport { unpluginRouterComposedFactory } from './core/router-composed-plugin'\nimport type { CodeSplittingOptions, Config } from './core/config'\n\n/**\n * @example\n * ```ts\n * export default {\n *   // ...\n *   plugins: [TanStackRouterGeneratorWebpack()],\n * }\n * ```\n */\nconst TanStackRouterGeneratorWebpack = /* #__PURE__ */ createWebpackPlugin(\n  unpluginRouterGeneratorFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default {\n *   // ...\n *   plugins: [TanStackRouterCodeSplitterWebpack()],\n * }\n * ```\n */\nconst TanStackRouterCodeSplitterWebpack = /* #__PURE__ */ createWebpackPlugin(\n  unpluginRouterCodeSplitterFactory,\n)\n\n/**\n * @example\n * ```ts\n * export default {\n *   // ...\n *   plugins: [tanstackRouter()],\n * }\n * ```\n */\nconst TanStackRouterWebpack = /* #__PURE__ */ createWebpackPlugin(\n  unpluginRouterComposedFactory,\n)\n\nconst tanstackRouter = TanStackRouterWebpack\nexport default TanStackRouterWebpack\nexport {\n  configSchema,\n  TanStackRouterWebpack,\n  TanStackRouterGeneratorWebpack,\n  TanStackRouterCodeSplitterWebpack,\n  tanstackRouter,\n}\nexport type { Config, CodeSplittingOptions }\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/arrow-function@false.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/arrow-function@true.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nif (import.meta.hot) {\n  import.meta.hot.accept(newModule => {\n    if (Route && newModule && newModule.Route) {\n      (function handleRouteUpdate(oldRoute, newRoute) {\n        newRoute._path = oldRoute._path;\n        newRoute._id = oldRoute._id;\n        newRoute._fullPath = oldRoute._fullPath;\n        newRoute._to = oldRoute._to;\n        newRoute.children = oldRoute.children;\n        newRoute.parentRoute = oldRoute.parentRoute;\n        const router = window.__TSR_ROUTER__;\n        router.routesById[newRoute.id] = newRoute;\n        router.routesByPath[newRoute.fullPath] = newRoute;\n        router.processedTree.matchCache.clear();\n        router.processedTree.flatCache?.clear();\n        router.processedTree.singleCache.clear();\n        router.resolvePathCache.clear();\n        walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree);\n        const filter = m => m.routeId === oldRoute.id;\n        if (router.stores.activeMatchesSnapshot.state.find(filter) || router.stores.pendingMatchesSnapshot.state.find(filter)) {\n          router.invalidate({\n            filter\n          });\n        }\n        ;\n        function walkReplaceSegmentTree(route, node) {\n          if (node.route?.id === route.id) node.route = route;\n          if (node.index) walkReplaceSegmentTree(route, node.index);\n          node.static?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.staticInsensitive?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.dynamic?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.optional?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.wildcard?.forEach(child => walkReplaceSegmentTree(route, child));\n        }\n      })(Route, newModule.Route);\n    }\n  });\n}"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/createRootRoute-inline-component@false.tsx",
    "content": "import * as React from 'react'\nimport { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <div>root hmr</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/createRootRoute-inline-component@true.tsx",
    "content": "import * as React from 'react';\nimport { createRootRoute } from '@tanstack/react-router';\nconst TSRComponent = () => <div>root hmr</div>;\nexport const Route = createRootRoute({\n  component: TSRComponent\n});\nif (import.meta.hot) {\n  import.meta.hot.accept(newModule => {\n    if (Route && newModule && newModule.Route) {\n      (function handleRouteUpdate(oldRoute, newRoute) {\n        newRoute._path = oldRoute._path;\n        newRoute._id = oldRoute._id;\n        newRoute._fullPath = oldRoute._fullPath;\n        newRoute._to = oldRoute._to;\n        newRoute.children = oldRoute.children;\n        newRoute.parentRoute = oldRoute.parentRoute;\n        const router = window.__TSR_ROUTER__;\n        router.routesById[newRoute.id] = newRoute;\n        router.routesByPath[newRoute.fullPath] = newRoute;\n        router.processedTree.matchCache.clear();\n        router.processedTree.flatCache?.clear();\n        router.processedTree.singleCache.clear();\n        router.resolvePathCache.clear();\n        walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree);\n        const filter = m => m.routeId === oldRoute.id;\n        if (router.stores.activeMatchesSnapshot.state.find(filter) || router.stores.pendingMatchesSnapshot.state.find(filter)) {\n          router.invalidate({\n            filter\n          });\n        }\n        ;\n        function walkReplaceSegmentTree(route, node) {\n          if (node.route?.id === route.id) node.route = route;\n          if (node.index) walkReplaceSegmentTree(route, node.index);\n          node.static?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.staticInsensitive?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.dynamic?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.optional?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.wildcard?.forEach(child => walkReplaceSegmentTree(route, child));\n        }\n      })(Route, newModule.Route);\n    }\n  });\n}"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/destructuring@false.tsx",
    "content": "import thing from 'thing'\n\nexport function test() {\n  const {\n    foo: {\n      bar: { destructured },\n    },\n  } = thing\n\n  return destructured\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/destructuring@true.tsx",
    "content": "import thing from 'thing'\n\nexport function test() {\n  const {\n    foo: {\n      bar: { destructured },\n    },\n  } = thing\n\n  return destructured\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/explicit-undefined-component@false.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/explicit-undefined-component@true.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/function-declaration@false.tsx",
    "content": "const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/react/function-declaration@true.tsx",
    "content": "const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nif (import.meta.hot) {\n  import.meta.hot.accept(newModule => {\n    if (Route && newModule && newModule.Route) {\n      (function handleRouteUpdate(oldRoute, newRoute) {\n        newRoute._path = oldRoute._path;\n        newRoute._id = oldRoute._id;\n        newRoute._fullPath = oldRoute._fullPath;\n        newRoute._to = oldRoute._to;\n        newRoute.children = oldRoute.children;\n        newRoute.parentRoute = oldRoute.parentRoute;\n        const router = window.__TSR_ROUTER__;\n        router.routesById[newRoute.id] = newRoute;\n        router.routesByPath[newRoute.fullPath] = newRoute;\n        router.processedTree.matchCache.clear();\n        router.processedTree.flatCache?.clear();\n        router.processedTree.singleCache.clear();\n        router.resolvePathCache.clear();\n        walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree);\n        const filter = m => m.routeId === oldRoute.id;\n        if (router.stores.activeMatchesSnapshot.state.find(filter) || router.stores.pendingMatchesSnapshot.state.find(filter)) {\n          router.invalidate({\n            filter\n          });\n        }\n        ;\n        function walkReplaceSegmentTree(route, node) {\n          if (node.route?.id === route.id) node.route = route;\n          if (node.index) walkReplaceSegmentTree(route, node.index);\n          node.static?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.staticInsensitive?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.dynamic?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.optional?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.wildcard?.forEach(child => walkReplaceSegmentTree(route, child));\n        }\n      })(Route, newModule.Route);\n    }\n  });\n}"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/solid/arrow-function@false.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/solid-router';\nimport { createFileRoute } from '@tanstack/solid-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/snapshots/solid/arrow-function@true.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/solid-router';\nimport { createFileRoute } from '@tanstack/solid-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nif (import.meta.hot) {\n  import.meta.hot.accept(newModule => {\n    if (Route && newModule && newModule.Route) {\n      (function handleRouteUpdate(oldRoute, newRoute) {\n        newRoute._path = oldRoute._path;\n        newRoute._id = oldRoute._id;\n        newRoute._fullPath = oldRoute._fullPath;\n        newRoute._to = oldRoute._to;\n        newRoute.children = oldRoute.children;\n        newRoute.parentRoute = oldRoute.parentRoute;\n        const router = window.__TSR_ROUTER__;\n        router.routesById[newRoute.id] = newRoute;\n        router.routesByPath[newRoute.fullPath] = newRoute;\n        router.processedTree.matchCache.clear();\n        router.processedTree.flatCache?.clear();\n        router.processedTree.singleCache.clear();\n        router.resolvePathCache.clear();\n        walkReplaceSegmentTree(newRoute, router.processedTree.segmentTree);\n        const filter = m => m.routeId === oldRoute.id;\n        if (router.stores.activeMatchesSnapshot.state.find(filter) || router.stores.pendingMatchesSnapshot.state.find(filter)) {\n          router.invalidate({\n            filter\n          });\n        }\n        ;\n        function walkReplaceSegmentTree(route, node) {\n          if (node.route?.id === route.id) node.route = route;\n          if (node.index) walkReplaceSegmentTree(route, node.index);\n          node.static?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.staticInsensitive?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.dynamic?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.optional?.forEach(child => walkReplaceSegmentTree(route, child));\n          node.wildcard?.forEach(child => walkReplaceSegmentTree(route, child));\n        }\n      })(Route, newModule.Route);\n    }\n  });\n}"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/test-files/react/arrow-function.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }]?.map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/test-files/react/createRootRoute-inline-component.tsx",
    "content": "import * as React from 'react'\nimport { createRootRoute } from '@tanstack/react-router'\n\nexport const Route = createRootRoute({\n  component: () => <div>root hmr</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/test-files/react/destructuring.tsx",
    "content": "import thing from 'thing'\n\nexport function test() {\n  const {\n    foo: {\n      bar: { destructured },\n    },\n  } = thing\n\n  return destructured\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/test-files/react/explicit-undefined-component.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/test-files/react/function-declaration.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }]?.map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr/test-files/solid/arrow-function.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { createFileRoute, Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        <Solid.For each={posts()}>\n          {(post) => {\n            return (\n              <li className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          }}\n        </Solid.For>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/add-hmr.test.ts",
    "content": "import { readFile, readdir } from 'node:fs/promises'\nimport path from 'node:path'\nimport { describe, expect, it } from 'vitest'\n\nimport { compileCodeSplitReferenceRoute } from '../src/core/code-splitter/compilers'\nimport { defaultCodeSplitGroupings } from '../src/core/constants'\nimport { getReferenceRouteCompilerPlugins } from '../src/core/code-splitter/plugins/framework-plugins'\nimport { frameworks } from './constants'\n\nfunction getFrameworkDir(framework: string) {\n  const files = path.resolve(__dirname, `./add-hmr/test-files/${framework}`)\n  const snapshots = path.resolve(__dirname, `./add-hmr/snapshots/${framework}`)\n  return { files, snapshots }\n}\n\ndescribe('add-hmr works', () => {\n  describe.each(frameworks)('FRAMEWORK=%s', async (framework) => {\n    const dirs = getFrameworkDir(framework)\n    const filenames = await readdir(dirs.files)\n\n    it.each(filenames)(\n      `should add hmr in \"reference\" for \"%s\"`,\n      async (filename) => {\n        const file = await readFile(path.join(dirs.files, filename))\n        const code = file.toString()\n\n        const compileResult = compileCodeSplitReferenceRoute({\n          code,\n          filename,\n          id: filename,\n          addHmr: true,\n          codeSplitGroupings: defaultCodeSplitGroupings,\n          targetFramework: framework,\n          compilerPlugins: getReferenceRouteCompilerPlugins({\n            targetFramework: framework,\n            addHmr: true,\n          }),\n        })\n\n        await expect(compileResult?.code || code).toMatchFileSnapshot(\n          path.join(dirs.snapshots, filename.replace('.tsx', '@true.tsx')),\n        )\n      },\n    )\n\n    it.each(filenames)(\n      `should NOT add hmr in \"reference\" for \"%s\"`,\n      async (filename) => {\n        const file = await readFile(path.join(dirs.files, filename))\n        const code = file.toString()\n\n        const compileResult = compileCodeSplitReferenceRoute({\n          code,\n          filename,\n          id: filename,\n          addHmr: false,\n          codeSplitGroupings: defaultCodeSplitGroupings,\n          targetFramework: framework,\n          compilerPlugins: getReferenceRouteCompilerPlugins({\n            targetFramework: framework,\n            addHmr: false,\n          }),\n        })\n\n        await expect(compileResult?.code || code).toMatchFileSnapshot(\n          path.join(dirs.snapshots, filename.replace('.tsx', '@false.tsx')),\n        )\n      },\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/shared/imported.tsx",
    "content": "import * as React from 'react'\n\nexport const importedComponent = () => {\n  return <div>I am imported</div>\n}\n\nexport const importedErrorComponent = () => {\n  return <div>I am an error imported</div>\n}\n\nexport const importedNotFoundComponent = () => {\n  return <div>I am a not found imported</div>\n}\n\nexport const importedPendingComponent = () => {\n  return <div>I am a pending imported</div>\n}\n\nexport const importedLoader = () => {\n  return {\n    randomNumber: Math.random(),\n  }\n}\n\nexport default function ImportedDefaultComponent() {\n  return <div>Default imported</div>\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/arrow-function@component.tsx",
    "content": "import * as React from 'react';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { Route } from \"arrow-function.tsx\";\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, {\n        id: 'i-do-not-exist',\n        title: 'Non-existent Post'\n      }]?.map(post => {\n        return <li key={post.id} className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n            postId: post.id\n          }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n            className: 'text-black font-bold'\n          }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n      })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n};\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/arrow-function@errorComponent.tsx",
    "content": "import * as React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/arrow-function@notFoundComponent.tsx",
    "content": "import * as React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals.tsx",
    "content": "const $$splitComponentImporter = () => import('boolean-null-literals.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/router';\n\n// Test errorComponent with false literal\nexport const Route = createFileRoute('/test')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  errorComponent: false,\n  pendingComponent: null,\n  loader: async () => ({\n    data: 'test'\n  })\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@component.tsx",
    "content": "// Test errorComponent with false literal\nconst SplitComponent = () => <div>Test Component</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/boolean-null-literals@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/chinese.tsx",
    "content": "const $$splitComponentImporter = () => import('chinese.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\ninterface DemoProps {\n  title: string;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/chinese@component.tsx",
    "content": "import * as React from 'react';\nfunction HomeComponent() {\n  return <div className=\"p-2\">\n      <Demo title=\"标题很好看，谁说不是呢？\" />\n      <Demo title=\"The title looks great, who can deny that?\" />\n    </div>;\n}\ninterface DemoProps {\n  title: string;\n}\nfunction Demo({\n  title\n}: DemoProps) {\n  return <h1 style={{\n    color: '#2969ff',\n    fontSize: '2rem',\n    fontWeight: 'bold',\n    letterSpacing: '3px'\n  }}>\n      {title}\n    </h1>;\n}\nexport { HomeComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/chinese@errorComponent.tsx",
    "content": "import * as React from 'react';\ninterface DemoProps {\n  title: string;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/chinese@notFoundComponent.tsx",
    "content": "import * as React from 'react';\ninterface DemoProps {\n  title: string;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/chinese@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('circular-reference-arrow-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-arrow-function@component.tsx",
    "content": "function getComponentName(obj: Record<string, unknown>): string {\n  return Object.keys(obj)[0];\n}\nconst App = () => {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>\n      Component Name is {componentName}\n      <OtherComponent />\n    </div>;\n};\nfunction OtherComponent() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>App component name is {componentName}</div>;\n}\nexport { App as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-arrow-function@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-arrow-function@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-function.tsx",
    "content": "const $$splitComponentImporter = () => import('circular-reference-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-function@component.tsx",
    "content": "function getComponentName(obj: Record<string, unknown>): string {\n  return Object.keys(obj)[0];\n}\nfunction App() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>\n      Component Name is {componentName}\n      <OtherComponent />\n    </div>;\n}\nfunction OtherComponent() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>App component name is {componentName}</div>;\n}\nexport { App as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-function@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-function@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/circular-reference-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/conditional-properties.tsx",
    "content": "const $$splitComponentImporter = () => import('conditional-properties.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { isEnabled } from '@features/feature-flags';\nimport TrueImport from '@modules/true-component';\nimport { falseLoader } from '@modules/false-component';\nexport const Route = createFileRoute('/posts')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: isEnabled ? TrueImport.loader : falseLoader\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/conditional-properties@component.tsx",
    "content": "import { isEnabled } from '@features/feature-flags';\nimport TrueImport from '@modules/true-component';\nimport { FalseComponent } from '@modules/false-component';\nconst SplitComponent = isEnabled ? TrueImport.Component : FalseComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/conditional-properties@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/conditional-properties@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/conditional-properties@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-multiple.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export-multiple.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const getConfig = () => ({\n  baseUrl: 'https://api.example.com',\n  timeout: 5000\n});\nexport const {\n  baseUrl,\n  timeout\n} = getConfig();\nexport const [first, second] = [1, 2];\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-multiple@component.tsx",
    "content": "import { baseUrl, timeout } from \"destructured-export-multiple.tsx\";\nfunction AboutComponent() {\n  return <div>\n      <p>Base URL: {baseUrl}</p>\n      <p>Timeout: {timeout}</p>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-multiple@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-multiple@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-multiple@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-nested.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export-nested.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nconst getConfig = () => ({\n  api: {\n    baseUrl: 'https://api.example.com'\n  },\n  timeout: 5000,\n  extra: 'data'\n});\nexport const {\n  api: {\n    baseUrl\n  },\n  ...rest\n} = getConfig();\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-nested@component.tsx",
    "content": "import { baseUrl } from \"destructured-export-nested.tsx\";\nfunction AboutComponent() {\n  return <div>\n      <p>Base URL: {baseUrl}</p>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-nested@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-nested@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export-nested@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}\nexport const {\n  getObject\n} = getObjectCallback();\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@component.tsx",
    "content": "export function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}\nfunction AboutComponent() {\n  return <div className=\"p-2\">\n      <h3>About</h3>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@errorComponent.tsx",
    "content": "export function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@notFoundComponent.tsx",
    "content": "export function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-export@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-react-memo-imported-component.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-react-memo-imported-component.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { importedLoader } from '../../shared/imported';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: importedLoader\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-react-memo-imported-component@component.tsx",
    "content": "import { memo } from 'react';\nfunction Component() {\n  return <div>Component</div>;\n}\nconst SplitComponent = memo(Component);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-react-memo-imported-component@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-react-memo-imported-component@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-react-memo-imported-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-route-options-defaults.tsx",
    "content": "import { loader } from \"destructured-route-options-defaults.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('destructured-route-options-defaults.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-route-options-defaults@component.tsx",
    "content": "import { MyComponent } from \"destructured-route-options-defaults.tsx?tsr-shared=1\";\nexport { MyComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-route-options-defaults@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-route-options-defaults@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructured-route-options-defaults@shared.tsx",
    "content": "function defaultLoader() {\n  return {\n    message: 'default'\n  };\n}\nfunction DefaultComponent() {\n  return <div>Default</div>;\n}\nconst createBits = () => ({\n  component: ActualComponent,\n  loader: () => ({\n    message: 'hello'\n  })\n});\nconst {\n  component: MyComponent = DefaultComponent,\n  loader = defaultLoader\n} = createBits();\nfunction ActualComponent() {\n  return <div>About</div>;\n}\nexport { ActualComponent, createBits, DefaultComponent, defaultLoader, loader, MyComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring.tsx",
    "content": "import thing from 'thing'\n\nexport function test() {\n  const {\n    foo: {\n      bar: { destructured },\n    },\n  } = thing\n\n  return destructured\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@component.tsx",
    "content": "import thing from 'thing';\nexport function test() {\n  const {\n    foo: {\n      bar: {\n        destructured\n      }\n    }\n  } = thing;\n  return destructured;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@errorComponent.tsx",
    "content": "import thing from 'thing';\nexport function test() {\n  const {\n    foo: {\n      bar: {\n        destructured\n      }\n    }\n  } = thing;\n  return destructured;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@notFoundComponent.tsx",
    "content": "import thing from 'thing';\nexport function test() {\n  const {\n    foo: {\n      bar: {\n        destructured\n      }\n    }\n  } = thing;\n  return destructured;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/destructuring@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue.tsx",
    "content": "'use client';\n\nconst $$splitComponentImporter = () => import('directive-prologue.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/directive')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue@component.tsx",
    "content": "'use client';\n\nconst SplitComponent = () => {\n  return <div>directive preserved</div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/directive-prologue@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@component.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@errorComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@notFoundComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/explicit-undefined-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound.tsx",
    "content": "console.warn(\"[tanstack-router] These exports from \\\"export-default-component-and-normal-notFound.tsx\\\" will not be code-split and will increase your bundle size:\\n- Home\\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.\");\nconst $$splitNotFoundComponentImporter = () => import('export-default-component-and-normal-notFound.tsx?tsr-split=notFoundComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport React, { useState } from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/home')({\n  component: Home,\n  notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')\n});\nexport default function Home() {\n  const [one, setOne] = useState('this is from a state');\n  return <div>\n      <h1>{one}</h1>\n    </div>;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@component.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@errorComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@notFoundComponent.tsx",
    "content": "import React from 'react';\nfunction NotFoundComponent() {\n  return <div>Not Found</div>;\n}\nexport { NotFoundComponent as notFoundComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component-and-normal-notFound@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component.tsx",
    "content": "import React, { useState } from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/home')({\n  component: Home,\n})\n\nexport default function Home() {\n  const [one, setOne] = useState('this is from a state')\n\n  return (\n    <div>\n      <h1>{one}</h1>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@component.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@errorComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@notFoundComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/export-default-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter.tsx",
    "content": "import * as React from 'react'\n// @ts-expect-error\nimport { useMemo } from 'tan-react'\n\nconst useUsedVar = 'i-am-unused'\n\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true'\n}, [])\n\nconsole.info(ReactUseMemoCall1)\n\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true'\n}, [])\n\nconsole.info(ReactUseMemoCall2)\n\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true'\n}, [])\n\nconsole.info(UseMemoCall1)\n\nconst UseMemoCall2 = useMemo(() => {\n  return 'true'\n}, [])\n\nconsole.info(UseMemoCall2)\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@component.tsx",
    "content": "import * as React from 'react';\n// @ts-expect-error\nimport { useMemo } from 'tan-react';\nconst useUsedVar = 'i-am-unused';\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall1);\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall2);\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall1);\nconst UseMemoCall2 = useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall2);"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@errorComponent.tsx",
    "content": "import * as React from 'react';\n// @ts-expect-error\nimport { useMemo } from 'tan-react';\nconst useUsedVar = 'i-am-unused';\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall1);\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall2);\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall1);\nconst UseMemoCall2 = useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall2);"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@notFoundComponent.tsx",
    "content": "import * as React from 'react';\n// @ts-expect-error\nimport { useMemo } from 'tan-react';\nconst useUsedVar = 'i-am-unused';\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall1);\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall2);\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall1);\nconst UseMemoCall2 = useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall2);"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-as-parameter@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration.tsx",
    "content": "const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration@component.tsx",
    "content": "import * as React from 'react';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { Route } from \"function-declaration.tsx\";\nfunction PostsComponent() {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, {\n        id: 'i-do-not-exist',\n        title: 'Non-existent Post'\n      }]?.map(post => {\n        return <li key={post.id} className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n            postId: post.id\n          }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n            className: 'text-black font-bold'\n          }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n      })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n}\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration@errorComponent.tsx",
    "content": "import * as React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration@notFoundComponent.tsx",
    "content": "import * as React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/function-declaration@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/importAttribute.tsx",
    "content": "const $$splitComponentImporter = () => import('importAttribute.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/importAttribute@component.tsx",
    "content": "import { test } from './test' with { type: 'macro' };\nconst SplitComponent = () => test;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/importAttribute@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/importAttribute@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/importAttribute@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component-destructured-loader.tsx",
    "content": "const $$splitComponentImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { importedLoader } from '../../shared/imported';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: importedLoader\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component-destructured-loader@component.tsx",
    "content": "import importedComponent from '../../shared/imported';\nconst SplitComponent = importedComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component-destructured-loader@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component-destructured-loader@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component-destructured-loader@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component.tsx",
    "content": "const $$splitComponentImporter = () => import('imported-default-component.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component@component.tsx",
    "content": "import ImportedDefaultComponent from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-default-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-errorComponent.tsx",
    "content": "const $$splitErrorComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=errorComponent');\nconst $$splitComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  errorComponent: lazyRouteComponent($$splitErrorComponentImporter, 'errorComponent')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-errorComponent@component.tsx",
    "content": "import ImportedDefaultComponent from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-errorComponent@errorComponent.tsx",
    "content": "import { importedErrorComponent } from '../../shared/imported';\nconst SplitErrorComponent = importedErrorComponent;\nexport { SplitErrorComponent as errorComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-errorComponent@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-errorComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-notFoundComponent.tsx",
    "content": "const $$splitNotFoundComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=notFoundComponent');\nconst $$splitComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-notFoundComponent@component.tsx",
    "content": "import ImportedDefaultComponent from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-notFoundComponent@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-notFoundComponent@notFoundComponent.tsx",
    "content": "import { importedNotFoundComponent } from '../../shared/imported';\nconst SplitNotFoundComponent = importedNotFoundComponent;\nexport { SplitNotFoundComponent as notFoundComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-notFoundComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-pendingComponent.tsx",
    "content": "const $$splitComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { importedPendingComponent } from '../../shared/imported';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  pendingComponent: importedPendingComponent\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-pendingComponent@component.tsx",
    "content": "import ImportedDefaultComponent from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-pendingComponent@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-pendingComponent@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported-pendingComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported.tsx",
    "content": "const $$splitComponentImporter = () => import('imported.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { importedLoader } from '../../shared';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: importedLoader\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported@component.tsx",
    "content": "import { importedComponent } from '../../shared';\nconst SplitComponent = importedComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/imported@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/inline.tsx",
    "content": "const $$splitComponentImporter = () => import('inline.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nRoute.addChildren([]);\nexport const test = 'test';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/inline@component.tsx",
    "content": "import * as React from 'react';\nimport * as styles from '../style.css';\nimport { TEST_DATA } from '../test.const';\nconst Button = (props: {\n  children: any;\n}) => {\n  return <button>{props.children}</button>;\n};\nimport { Route } from \"inline.tsx\";\nimport { test } from \"inline.tsx\";\nconst SplitComponent = () => {\n  return <div className=\"p-2\">\n        {test}\n        <h3 className={styles.indexPageTitle}>{TEST_DATA.welcome}</h3>\n        <Button>Click me</Button>\n      </div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/inline@errorComponent.tsx",
    "content": "import * as React from 'react';\nimport { Route } from \"inline.tsx\";"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/inline@notFoundComponent.tsx",
    "content": "import * as React from 'react';\nimport { Route } from \"inline.tsx\";"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/inline@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/random-number.tsx",
    "content": "const $$splitComponentImporter = () => import('random-number.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { Await, Link, createFileRoute, defer } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport { getSponsorsForSponsorPack } from '~/server/sponsors';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nexport const textColors = [`text-rose-500`, `text-yellow-500`, `text-teal-500`, `text-blue-500`];\nexport const gradients = [`from-rose-500 to-yellow-500`, `from-yellow-500 to-teal-500`, `from-teal-500 to-violet-500`, `from-blue-500 to-pink-500`];\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];\nexport const Route = createFileRoute('/')({\n  loader: () => {\n    return {\n      randomNumber: Math.random(),\n      sponsorsPromise: defer(getSponsorsForSponsorPack())\n    };\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/random-number@component.tsx",
    "content": "import { Await, Link } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport discordImage from '~/images/discord-logo-white.svg';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nimport { useMutation } from '~/hooks/useMutation';\nimport { sample } from '~/utils/utils';\nimport { textColors } from \"random-number.tsx\";\nimport { gradients } from \"random-number.tsx\";\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];\nimport { Route } from \"random-number.tsx\";\nasync function bytesSignupServerFn({\n  email\n}: {\n  email: string;\n}) {\n  'use server';\n\n  return fetch(`https://bytes.dev/api/bytes-optin-cors`, {\n    method: 'POST',\n    body: JSON.stringify({\n      email,\n      influencer: 'tanstack'\n    }),\n    headers: {\n      Accept: 'application/json',\n      'Content-Type': 'application/json'\n    }\n  });\n}\nfunction Index() {\n  const bytesSignupMutation = useMutation({\n    fn: bytesSignupServerFn\n  });\n  const {\n    sponsorsPromise,\n    randomNumber,\n    testing2\n  } = Route.useLoaderData();\n  const gradient = sample(gradients, randomNumber);\n  const textColor = sample(textColors, randomNumber);\n  return <>\n      {discordImage}\n      {gradient}\n      {textColor}\n    </>;\n}\nexport { Index as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/random-number@errorComponent.tsx",
    "content": "import { Await, Link } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/random-number@notFoundComponent.tsx",
    "content": "import { Await, Link } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/random-number@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-component.tsx",
    "content": "const $$splitComponentImporter = () => import('react-memo-component.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { importedLoader } from '../../shared/imported';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: importedLoader\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-component@component.tsx",
    "content": "import React from 'react';\nfunction Component() {\n  return <div>Component</div>;\n}\nconst SplitComponent = React.memo(Component);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-component@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-component@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-imported-component.tsx",
    "content": "const $$splitComponentImporter = () => import('react-memo-imported-component.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { importedLoader } from '../../shared/imported';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: importedLoader\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-imported-component@component.tsx",
    "content": "import React from 'react';\nimport { importedComponent } from '../../shared/imported';\nconst SplitComponent = React.memo(importedComponent);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-imported-component@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-imported-component@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/react-memo-imported-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-export-component.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport function Layout() {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: importedLoader,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nconst SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-export-component@component.tsx",
    "content": "import * as React from 'react';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-export-component@errorComponent.tsx",
    "content": "import * as React from 'react';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-export-component@notFoundComponent.tsx",
    "content": "import * as React from 'react';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-export-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-const.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport const loaderFn = () => {\n  return importedLoader()\n}\n\nconst Layout = () => {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n\nexport default Layout\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-const@component.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-const@errorComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-const@notFoundComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-const@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst createBits = () => ({\n  component: AboutComponentImpl,\n  loader: () => ({\n    message: 'hello',\n  }),\n})\n\nexport const { component: AboutComponent, loader } = createBits()\n\nfunction AboutComponentImpl() {\n  return <div>About</div>\n}\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n  loader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@component.tsx",
    "content": "import { AboutComponent } from \"retain-exports-destructured.tsx?tsr-shared=1\";\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-destructured@shared.tsx",
    "content": "const createBits = () => ({\n  component: AboutComponentImpl,\n  loader: () => ({\n    message: 'hello'\n  })\n});\nconst {\n  component: AboutComponent,\n  loader\n} = createBits();\nfunction AboutComponentImpl() {\n  return <div>About</div>;\n}\nexport { AboutComponent, AboutComponentImpl, createBits, loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport function loaderFn() {\n  return importedLoader()\n}\n\nfunction Layout() {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n\nexport default Layout\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@component.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@errorComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@notFoundComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader.tsx",
    "content": "const $$splitComponentImporter = () => import('retain-exports-loader.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport function loaderFn() {\n  return {\n    foo: 'bar'\n  };\n}\nexport const Route = createFileRoute('/_layout')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: loaderFn\n});\nexport const SIDEBAR_WIDTH = '150px';\nexport const SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@component.tsx",
    "content": "import * as React from 'react';\nimport { Outlet } from '@tanstack/react-router';\nimport { importedComponent as ImportedComponent } from '../../shared/imported';\nfunction Layout() {\n  return <main>\n      <header style={{\n      height: HEADER_HEIGHT\n    }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>;\n}\nconst HEADER_HEIGHT = '63px';\nconst ASIDE_WIDTH = '250px';\nexport { Layout as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@errorComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@notFoundComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/retain-exports-loader@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class.tsx",
    "content": "import { store } from \"shared-class.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-class.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/store')({\n  loader: async () => {\n    store.set('items', await fetch('/api'));\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@component.tsx",
    "content": "import { store } from \"shared-class.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>{store.get('items')}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-class@shared.tsx",
    "content": "class DataStore {\n  data = new Map();\n  get(k: string) {\n    return this.data.get(k);\n  }\n  set(k: string, v: unknown) {\n    this.data.set(k, v);\n  }\n}\nconst store = new DataStore();\nexport { DataStore, store };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export.tsx",
    "content": "import { apiUrl } from \"shared-destructured-export.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-destructured-export.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/config')({\n  loader: async () => fetch(apiUrl),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nexport { apiUrl, timeout } from \"shared-destructured-export.tsx?tsr-shared=1\";"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@component.tsx",
    "content": "import { timeout } from \"shared-destructured-export.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>Timeout: {timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured-export@shared.tsx",
    "content": "const {\n  apiUrl,\n  timeout\n} = getConfig();\nfunction getConfig() {\n  return {\n    apiUrl: '/api',\n    timeout: 5000\n  };\n}\nexport { apiUrl, getConfig, timeout };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured.tsx",
    "content": "import { apiUrl } from \"shared-destructured.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-destructured.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/config')({\n  loader: async () => fetch(apiUrl),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured@component.tsx",
    "content": "import { timeout } from \"shared-destructured.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>Timeout: {timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-destructured@shared.tsx",
    "content": "const {\n  apiUrl,\n  timeout\n} = getConfig();\nfunction getConfig() {\n  return {\n    apiUrl: '/api',\n    timeout: 5000\n  };\n}\nexport { apiUrl, getConfig, timeout };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-exported.tsx",
    "content": "import { queryOptions } from \"shared-exported.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-exported.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/query')({\n  loader: async () => {\n    return {\n      staleTime: queryOptions.staleTime\n    };\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nexport { queryOptions } from \"shared-exported.tsx?tsr-shared=1\";"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-exported@component.tsx",
    "content": "import { queryOptions } from \"shared-exported.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>GC: {queryOptions.gcTime}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-exported@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-exported@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-exported@shared.tsx",
    "content": "const queryOptions = {\n  staleTime: 5000,\n  gcTime: 10000\n};\nexport { queryOptions };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function.tsx",
    "content": "import { getCached, cache } from \"shared-function.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nfunction setCached(key: string, val: unknown) {\n  cache.set(key, val);\n}\nexport const Route = createFileRoute('/cached')({\n  loader: async () => {\n    setCached('data', await fetch('/api').then(r => r.json()));\n    return getCached('data');\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function@component.tsx",
    "content": "import { getCached } from \"shared-function.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>{JSON.stringify(getCached('data'))}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-function@shared.tsx",
    "content": "const cache = new Map();\nfunction getCached(key: string) {\n  return cache.get(key);\n}\nexport { cache, getCached };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-imported-binding.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { sharedUtil } from '../utils';\nexport const Route = createFileRoute('/imported')({\n  loader: async () => sharedUtil('load'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding@component.tsx",
    "content": "import { sharedUtil } from '../utils';\nconst SplitComponent = () => <div>{sharedUtil('render')}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-imported-binding@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref.tsx",
    "content": "import { state, getCount } from \"shared-indirect-ref.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-indirect-ref.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/shared-indirect')({\n  loader: () => {\n    state.count++;\n    return {\n      count: getCount()\n    };\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@component.tsx",
    "content": "import { state, getCount } from \"shared-indirect-ref.tsx?tsr-shared=1\";\nfunction SharedComponent() {\n  return <div>\n      {getCount()} - {state.count}\n    </div>;\n}\nexport { SharedComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-indirect-ref@shared.tsx",
    "content": "const state = {\n  count: 0\n};\nfunction getCount() {\n  return state.count;\n}\nexport { getCount, state };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref.tsx",
    "content": "import { shared } from \"shared-jsx-component-ref.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\n// @ts-nocheck\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/jsx')({\n  loader: () => shared,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@component.tsx",
    "content": "import { shared } from \"shared-jsx-component-ref.tsx?tsr-shared=1\"; // @ts-nocheck\nfunction SharedComponent() {\n  return <div>{shared}</div>;\n}\nexport { SharedComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-jsx-component-ref@shared.tsx",
    "content": "// @ts-nocheck\n\nconst shared = 1;\nexport { shared };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-none.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nconst loaderHelper = () => fetch('/api');\nexport const Route = createFileRoute('/clean')({\n  loader: async () => loaderHelper(),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none@component.tsx",
    "content": "const ComponentHelper = () => <span>helper</span>;\nconst SplitComponent = () => <div>\n      <ComponentHelper />\n    </div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-none@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route.tsx",
    "content": "import { HEADER } from \"shared-referencing-route.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-referencing-route.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nfunction usePageTitle() {\n  return `${HEADER} - ${Route.fullPath}`;\n}\nexport const Route = createFileRoute('/about')({\n  loader: async () => {\n    const title = usePageTitle();\n    return {\n      title\n    };\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@component.tsx",
    "content": "import { HEADER } from \"shared-referencing-route.tsx?tsr-shared=1\";\nfunction usePageTitle() {\n  return `${HEADER} - ${Route.fullPath}`;\n}\nimport { Route } from \"shared-referencing-route.tsx\";\nconst SplitComponent = () => {\n  const title = usePageTitle();\n  return <div>{title}</div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-referencing-route@shared.tsx",
    "content": "const HEADER = 'Page';\nexport { HEADER };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive.tsx",
    "content": "import { config } from \"shared-transitive.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-transitive.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nconst fetcher = (path: string) => fetch(`${config.url}${path}`);\nexport const Route = createFileRoute('/api')({\n  loader: async () => {\n    return fetcher('/data');\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive@component.tsx",
    "content": "import { config } from \"shared-transitive.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>Timeout: {config.timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-transitive@shared.tsx",
    "content": "const BASE_URL = 'https://api.example.com';\nconst config = {\n  url: BASE_URL,\n  timeout: 5000\n};\nexport { BASE_URL, config };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable.tsx",
    "content": "import { collection } from \"shared-variable.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-variable.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/todos')({\n  loader: async () => {\n    await collection.preload();\n    return {\n      data: 'loaded'\n    };\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable@component.tsx",
    "content": "import { collection } from \"shared-variable.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>{collection.name}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-variable@shared.tsx",
    "content": "const collection = {\n  name: 'todos',\n  preload: async () => {}\n};\nexport { collection };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect.tsx",
    "content": "import { registry } from \"shared-with-side-effect.tsx?tsr-shared=1\";\nconst $$splitComponentImporter = () => import('shared-with-side-effect.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nconsole.log('registry created');\nexport const Route = createFileRoute('/fx')({\n  loader: async () => {\n    registry.set('loaded', true);\n  },\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect@component.tsx",
    "content": "import { registry } from \"shared-with-side-effect.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>{registry.size}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/shared-with-side-effect@shared.tsx",
    "content": "const registry = new Map();\nexport { registry };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/undefined-test')({\n  component: undefined,\n  errorComponent: undefined,\n  pendingComponent: undefined,\n  notFoundComponent: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@component.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/undefined-literals@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/useStateDestructure.tsx",
    "content": "import * as React from 'react'\n\nimport { CgCornerUpLeft, CgSpinner } from 'react-icons/cg'\nimport {\n  FaBolt,\n  FaBook,\n  FaCheckCircle,\n  FaCogs,\n  FaDiscord,\n  FaGithub,\n  FaTshirt,\n  FaTwitter,\n} from 'react-icons/fa'\nimport { Await, Link, getRouteApi } from '@tanstack/react-router'\nimport { Carbon } from '~/components/Carbon'\nimport { Footer } from '~/components/Footer'\nimport { VscPreview, VscWand } from 'react-icons/vsc'\nimport { TbHeartHandshake } from 'react-icons/tb'\nimport SponsorPack from '~/components/SponsorPack'\nimport { startProject } from '~/projects/start'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { Framework, getBranch } from '~/projects'\nimport { seo } from '~/utils/seo'\n\nconst menu = [\n  {\n    label: (\n      <div className=\"flex items-center gap-2\">\n        <CgCornerUpLeft className=\"text-lg\" /> TanStack\n      </div>\n    ),\n    to: '/',\n  },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <VscPreview className=\"text-lg\" /> Examples\n  //     </div>\n  //   ),\n  //   to: './docs/react/examples/basic',\n  // },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <FaBook className=\"text-lg\" /> Docs\n  //     </div>\n  //   ),\n  //   to: './docs/',\n  // },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <FaGithub className=\"text-lg\" /> GitHub\n  //     </div>\n  //   ),\n  //   to: `https://github.com/${startProject.repo}`,\n  // },\n  {\n    label: (\n      <div className=\"flex items-center gap-1\">\n        <FaDiscord className=\"text-lg\" /> Discord\n      </div>\n    ),\n    to: 'https://tlinz.com/discord',\n  },\n  {\n    label: (\n      <div className=\"flex items-center gap-1\">\n        <FaTshirt className=\"text-lg\" /> Merch\n      </div>\n    ),\n    to: `https://cottonbureau.com/people/tanstack`,\n  },\n]\n\nexport const Route = createFileRoute('/_libraries/start/$version/')({\n  component: VersionIndex,\n  meta: () =>\n    seo({\n      title: startProject.name,\n      description: startProject.description,\n    }),\n})\n\nconst librariesRouteApi = getRouteApi('/_libraries')\n\nexport default function VersionIndex() {\n  const { sponsorsPromise } = librariesRouteApi.useLoaderData()\n  const { version } = Route.useParams()\n  const branch = getBranch(startProject, version)\n  const [framework, setFramework] = React.useState<Framework>('react')\n  const [isDark, setIsDark] = React.useState(true)\n\n  React.useEffect(() => {\n    setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)\n  }, [])\n\n  const gradientText = `inline-block text-transparent bg-clip-text bg-gradient-to-r ${startProject.colorFrom} ${startProject.colorTo}`\n\n  return (\n    <div className=\"flex flex-col gap-20 md:gap-32 max-w-full\">\n      <div\n        className=\"flex flex-wrap py-2 px-4 items-center justify-center text-sm max-w-screen-xl mx-auto\n          md:text-base md:self-end\"\n      >\n        {menu?.map((item, i) => {\n          const label = (\n            <div className=\"p-2 opacity-90 hover:opacity-100\">{item.label}</div>\n          )\n\n          return (\n            <div key={i} className=\"hover:underline\">\n              {item.to.startsWith('http') ? (\n                <a href={item.to}>{label}</a>\n              ) : (\n                <Link to={item.to} params>\n                  {label}\n                </Link>\n              )}\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex flex-col items-center gap-8 text-center px-4\">\n        <div className=\"flex gap-2 lg:gap-4 items-center\">\n          <h1\n            className={`inline-block\n            font-black text-4xl\n            md:text-6xl\n            lg:text-7xl relative`}\n          >\n            <span className={gradientText}>TanStack Start</span>\n          </h1>\n        </div>\n        {/* <div className=\"absolute left-1/2 top-0 -translate-x-1/2 -translate-y-[150%]\"> */}\n        <div\n          className=\"text-sm\n            md:text-base font-black\n            lg:text-lg align-super text-white animate-bounce uppercase\n              dark:text-black bg-black dark:bg-white shadow-xl shadow-black/30 px-2 py-1 rounded-md\n              leading-none whitespace-nowrap\"\n        >\n          Coming Soon!\n          {/* {version === 'latest' ? latestVersion : version} */}\n        </div>\n        {/* </div> */}\n        <h2\n          className=\"font-bold text-2xl max-w-md\n            md:text-3xl\n            lg:text-5xl lg:max-w-2xl\"\n        >\n          Full-stack React framework{' '}\n          <span className=\"underline decoration-dashed decoration-yellow-500 decoration-3 underline-offset-2\">\n            powered by TanStack Router\n          </span>{' '}\n        </h2>\n        <p\n          className=\"text opacity-90 max-w-[500px]\n            lg:text-xl lg:max-w-[600px]\"\n        >\n          Full-document SSR, Streaming, Server Functions, bundling and more,\n          powered by <strong>TanStack Router</strong>, <strong>Nitro</strong>{' '}\n          and <strong>Vite</strong>. Ready to deploy to your favorite hosting\n          provider.\n        </p>\n      </div>\n      <div className=\"space-y-8 px-4\">\n        <div className=\"font-black text-3xl mr-1 text-center\">\n          So when can I use it?\n        </div>\n        <div className=\"max-w-full p-8 w-[800px] mx-auto leading-loose space-y-4 bg-white dark:bg-gray-700 rounded-xl shadow-xl shadow-black/10\">\n          <div>\n            <strong>TanStack Start </strong> is currently in development and is\n            not yet available for public use. We are working hard to bring you\n            the best possible experience and will be releasing more details\n            soon. In the meantime, you can follow along with the development\n            process by watching the commits on this very website!\n          </div>\n          <div>\n            Yes, you heard that right!{' '}\n            <strong>\n              TanStack.com is already being built and deployed using TanStack\n              Start\n            </strong>\n            ! We are eating our own dog food and are excited to share the\n            results with you soon!\n          </div>\n        </div>\n        <div className=\"flex items-center gap-2 flex-wrap justify-center\">\n          <a\n            href={`https://github.com/TanStack/tanstack.com`}\n            className={`flex items-center gap-2 py-2 px-4 bg-cyan-700 rounded text-white uppercase font-extrabold`}\n          >\n            <FaGithub /> View TanStack.com Source\n          </a>\n          <a\n            href={`https://twitter.com/intent/post?text=${encodeURIComponent(\n              `I'm excited for TanStack Start, new full-stack React framework coming soon from team @Tan_Stack!\n              \nCheck it out at https://tanstack.com/start/`,\n            )}`}\n            target=\"_blank\"\n            className={`flex items-center gap-2 py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}\n          >\n            <FaTwitter /> Tweet about it!\n          </a>{' '}\n        </div>\n      </div>\n      {/* <div\n        className=\"text-lg flex flex-col gap-12 p-8 max-w-[1200px] mx-auto\n                        md:flex-row\"\n      >\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <VscWand className=\"text-cyan-500 text-6xl\" />\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Built on TanStack Router\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              Writing your data fetching logic by hand is over. Tell TanStack\n              Query where to get your data and how fresh you need it to be and\n              the rest is automatic. It handles{' '}\n              <span className=\"font-semibold text-cyan-700 dark:text-cyan-400\">\n                caching, background updates and stale data out of the box with\n                zero-configuration\n              </span>\n              .\n            </p>\n          </div>\n        </div>\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <div className=\"text-center\">\n            <FaBolt className=\"text-sky-600 text-6xl\" />\n          </div>\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Simple & Familiar\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              If you know how to work with promises or async/await, then you\n              already know how to use TanStack Query. There's{' '}\n              <span className=\"font-semibold text-sky-700 dark:text-sky-400\">\n                no global state to manage, reducers, normalization systems or\n                heavy configurations to understand\n              </span>\n              . Simply pass a function that resolves your data (or throws an\n              error) and the rest is history.\n            </p>\n          </div>\n        </div>\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <div className=\"text-center\">\n            <FaCogs className=\"text-blue-500 text-6xl\" />\n          </div>\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Extensible\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              TanStack Query is configurable down to each observer instance of a\n              query with knobs and options to fit every use-case. It comes wired\n              up with{' '}\n              <span className=\"font-semibold text-blue-700 dark:text-blue-400\">\n                dedicated devtools, infinite-loading APIs, and first class\n                mutation tools that make updating your data a breeze\n              </span>\n              . Don't worry though, everything is pre-configured for success!\n            </p>\n          </div>\n        </div>\n      </div> */}\n\n      {/* <div className=\"px-4 sm:px-6 lg:px-8 mx-auto\">\n        <div className=\" sm:text-center pb-16\">\n          <h3 className=\"text-3xl text-center mx-auto leading-tight font-extrabold tracking-tight sm:text-4xl lg:leading-none mt-2\">\n            No dependencies. All the Features.\n          </h3>\n          <p className=\"mt-4 text-xl max-w-3xl mx-auto leading-7 opacity-60\">\n            With zero dependencies, TanStack Query is extremely lean given the\n            dense feature set it provides. From weekend hobbies all the way to\n            enterprise e-commerce systems (Yes, I'm lookin' at you Walmart! 😉),\n            TanStack Query is the battle-hardened tool to help you succeed at\n            the speed of your creativity.\n          </p>\n        </div>\n        <div className=\"grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-10 gap-y-4  mx-auto\">\n          {[\n            'Backend agnostic',\n            'Dedicated Devtools',\n            'Auto Caching',\n            'Auto Refetching',\n            'Window Focus Refetching',\n            'Polling/Realtime Queries',\n            'Parallel Queries',\n            'Dependent Queries',\n            'Mutations API',\n            'Automatic Garbage Collection',\n            'Paginated/Cursor Queries',\n            'Load-More/Infinite Scroll Queries',\n            'Scroll Recovery',\n            'Request Cancellation',\n            'Suspense Ready!',\n            'Render-as-you-fetch',\n            'Prefetching',\n            'Variable-length Parallel Queries',\n            'Offline Support',\n            'SSR Support',\n            'Data Selectors',\n          ].map((d, i) => {\n            return (\n              <span key={i} className=\"flex items-center gap-2\">\n                <FaCheckCircle className=\"text-green-500 \" /> {d}\n              </span>\n            )\n          })}\n        </div>\n      </div> */}\n\n      {/* <div>\n        <div className=\"uppercase tracking-wider text-sm font-semibold text-center text-gray-400 mb-3\">\n          Trusted in Production by\n        </div>\n        <marquee scrollamount=\"2\">\n          <div className=\"flex gap-2 items-center text-3xl font-bold ml-[-100%]\">\n            {(new Array(4) as string[])\n              .fill('')\n              .reduce(\n                (all) => [...all, ...all],\n                [\n                  'Google',\n                  'Walmart',\n                  'Facebook',\n                  'PayPal',\n                  'Amazon',\n                  'American Express',\n                  'Microsoft',\n                  'Target',\n                  'Ebay',\n                  'Autodesk',\n                  'CarFAX',\n                  'Docusign',\n                  'HP',\n                  'MLB',\n                  'Volvo',\n                  'Ocado',\n                  'UPC.ch',\n                  'EFI.com',\n                  'ReactBricks',\n                  'Nozzle.io',\n                  'Uber',\n                ]\n              )\n              .map((d, i) => (\n                <span key={i} className=\"opacity-70 even:opacity-40\">\n                  {d}\n                </span>\n              ))}\n          </div>\n        </marquee>\n      </div> */}\n\n      <div className=\"px-4 w-[500px] max-w-full mx-auto\">\n        <h3 className=\"text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8\">\n          Partners\n        </h3>\n        <div className=\"h-8\" />\n        <div\n          className=\"flex-1 flex flex-col items-center text-sm text-center\n                      bg-white shadow-xl shadow-gray-500/20 rounded-lg\n                        divide-y-2 divide-gray-500 divide-opacity-10 overflow-hidden\n                        dark:bg-gray-800 dark:shadow-none\"\n        >\n          <span className=\"flex items-center gap-2 p-12 text-4xl text-rose-500 font-black uppercase\">\n            Start <TbHeartHandshake /> You?\n          </span>\n          <div className=\"flex flex-col p-4 gap-4\">\n            <div>\n              We're looking for a TanStack Start OSS Partner to go above and\n              beyond the call of sponsorship. Are you as invested in TanStack\n              Start as we are? Let's push the boundaries of Start together!\n            </div>\n            <a\n              href=\"mailto:partners@tanstack.com?subject=TanStack Start Partnership\"\n              className=\"text-blue-500 uppercase font-black text-sm\"\n            >\n              Let's chat\n            </a>\n          </div>\n        </div>\n      </div>\n\n      <div className=\"relative text-lg overflow-hidden\">\n        <h3 className=\"text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8\">\n          Sponsors\n        </h3>\n        <div\n          className=\"my-4 flex flex-wrap mx-auto max-w-screen-lg\"\n          style={{\n            aspectRatio: '1/1',\n          }}\n        >\n          <Await\n            promise={sponsorsPromise}\n            fallback={<CgSpinner className=\"text-2xl animate-spin\" />}\n            children={(sponsors) => {\n              return <SponsorPack sponsors={sponsors} />\n            }}\n          />\n        </div>\n        <div className=\"text-center\">\n          <a\n            href=\"https://github.com/sponsors/tannerlinsley\"\n            className=\"inline-block bg-green-500 px-4 py-2 text-xl mx-auto leading-tight font-extrabold tracking-tight text-white rounded-full\"\n          >\n            Become a Sponsor!\n          </a>\n        </div>\n      </div>\n\n      <div className=\"mx-auto max-w-[400px] flex flex-col gap-2 items-center\">\n        <div className=\"shadow-lg rounded-lg overflow-hidden bg-white dark:bg-gray-800 dark:text-white\">\n          <Carbon />\n        </div>\n        <span\n          className=\"text-[.7rem] bg-gray-500 bg-opacity-10 py-1 px-2 rounded text-gray-500\n                dark:bg-opacity-20\"\n        >\n          This ad helps us be happy about our invested time and not burn out and\n          rage-quit OSS. Yay money! 😉\n        </span>\n      </div>\n\n      {/* <div className=\"flex flex-col gap-4\">\n        <div className=\"px-4 sm:px-6 lg:px-8  mx-auto max-w-3xl sm:text-center\">\n          <h3 className=\"text-3xl text-center leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-2\">\n            Less code, fewer edge cases.\n          </h3>\n          <p className=\"my-4 text-xl leading-7  text-gray-600\">\n            Instead of writing reducers, caching logic, timers, retry logic,\n            complex async/await scripting (I could keep going...), you literally\n            write a tiny fraction of the code you normally would. You will be\n            surprised at how little code you're writing or how much code you're\n            deleting when you use TanStack Query. Try it out with one of the\n            examples below!\n          </p>\n          <div className=\"flex flex-wrap gap-2 justify-center\">\n            {(\n              [\n                { label: 'Angular', value: 'angular' },\n                { label: 'React', value: 'react' },\n                { label: 'Solid', value: 'solid' },\n                { label: 'Svelte', value: 'svelte' },\n                { label: 'Vue', value: 'vue' },\n              ] as const\n            ).map((item) => (\n              <button\n                key={item.value}\n                className={`inline-block py-2 px-4 rounded text-white uppercase font-extrabold ${\n                  item.value === framework\n                    ? 'bg-cyan-500'\n                    : 'bg-gray-300 dark:bg-gray-700 hover:bg-cyan-300'\n                }`}\n                onClick={() => setFramework(item.value)}\n              >\n                {item.label}\n              </button>\n            ))}\n          </div>\n        </div>\n      </div> */}\n\n      {/* {[''].includes(framework) ? (\n        <div className=\"px-2\">\n          <div className=\"p-8 text-center text-lg w-full max-w-screen-lg mx-auto bg-black text-white rounded-xl\">\n            Looking for the <strong>@tanstack/{framework}-query</strong>{' '}\n            example? We could use your help to build the{' '}\n            <strong>@tanstack/{framework}-query</strong> adapter! Join the{' '}\n            <a\n              href=\"https://tlinz.com/discord\"\n              className=\"text-teal-500 font-bold\"\n            >\n              TanStack Discord Server\n            </a>{' '}\n            and let's get to work!\n          </div>\n        </div>\n      ) : (\n        <div className=\"bg-white dark:bg-black\">\n          <iframe\n            key={framework}\n            src={`https://stackblitz.com/github/${repo}/tree/${branch}/examples/${framework}/simple?embed=1&theme=${\n              isDark ? 'dark' : 'light'\n            }`}\n            title={`tannerlinsley/${framework}-query: basic`}\n            sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n            className=\"shadow-2xl\"\n            loading=\"lazy\"\n            style={{\n              width: '100%',\n              height: '80vh',\n              border: '0',\n            }}\n          ></iframe>\n        </div>\n      )} */}\n\n      {/* <div className=\"flex flex-col gap-4 items-center\">\n        <div className=\"font-extrabold text-xl lg:text-2xl\">\n          Wow, you've come a long way!\n        </div>\n        <div className=\"italic font-sm opacity-70\">\n          Only one thing left to do...\n        </div>\n        <div>\n          <Link\n            to=\"./docs/\"\n            className={`inline-block py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}\n          >\n            Read the Docs!\n          </Link>\n        </div>\n      </div> */}\n      <Footer />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/useStateDestructure@component.tsx",
    "content": "import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';\nimport { VscPreview, VscWand } from 'react-icons/vsc';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/useStateDestructure@errorComponent.tsx",
    "content": "import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';\nimport { VscPreview, VscWand } from 'react-icons/vsc';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/useStateDestructure@notFoundComponent.tsx",
    "content": "import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';\nimport { VscPreview, VscWand } from 'react-icons/vsc';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/useStateDestructure@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/using.tsx",
    "content": "const DummyPostResource = (postId: string) => ({\n  postData: { id: postId, title: 'dummy', body: 'dummy' },\n  [Symbol.dispose]: () => console.log('disposing!'),\n})\nexport const Route = createFileRoute({\n  loader: ({ params: { postId } }) => {\n    using dummyPost = DummyPostResource(postId)\n    return dummyPost.postData\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/using@component.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/using@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/using@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/1-default/using@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('arrow-function.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/posts')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/arrow-function@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { Route } from \"arrow-function.tsx\";\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, {\n        id: 'i-do-not-exist',\n        title: 'Non-existent Post'\n      }]?.map(post => {\n        return <li key={post.id} className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n            postId: post.id\n          }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n            className: 'text-black font-bold'\n          }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n      })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n};\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/arrow-function@loader.tsx",
    "content": "import * as React from 'react';\nimport { fetchPosts } from '../posts';\nconst SplitLoader = fetchPosts;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals.tsx",
    "content": "const $$splitLoaderImporter = () => import('boolean-null-literals.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('boolean-null-literals.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/router';\n\n// Test errorComponent with false literal\nexport const Route = createFileRoute('/test')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  errorComponent: false,\n  pendingComponent: null,\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "// Test errorComponent with false literal\nconst SplitComponent = () => <div>Test Component</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@loader.tsx",
    "content": "// Test errorComponent with false literal\nconst SplitLoader = async () => ({\n  data: 'test'\n});\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/boolean-null-literals@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/chinese.tsx",
    "content": "const $$splitComponentImporter = () => import('chinese.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\ninterface DemoProps {\n  title: string;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/chinese@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nfunction HomeComponent() {\n  return <div className=\"p-2\">\n      <Demo title=\"标题很好看，谁说不是呢？\" />\n      <Demo title=\"The title looks great, who can deny that?\" />\n    </div>;\n}\ninterface DemoProps {\n  title: string;\n}\nfunction Demo({\n  title\n}: DemoProps) {\n  return <h1 style={{\n    color: '#2969ff',\n    fontSize: '2rem',\n    fontWeight: 'bold',\n    letterSpacing: '3px'\n  }}>\n      {title}\n    </h1>;\n}\nexport { HomeComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/chinese@loader.tsx",
    "content": "import * as React from 'react';\ninterface DemoProps {\n  title: string;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/chinese@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/circular-reference-arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('circular-reference-arrow-function.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/circular-reference-arrow-function@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "function getComponentName(obj: Record<string, unknown>): string {\n  return Object.keys(obj)[0];\n}\nconst App = () => {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>\n      Component Name is {componentName}\n      <OtherComponent />\n    </div>;\n};\nfunction OtherComponent() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>App component name is {componentName}</div>;\n}\nexport { App as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/circular-reference-arrow-function@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/circular-reference-arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/circular-reference-function.tsx",
    "content": "const $$splitComponentImporter = () => import('circular-reference-function.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/circular-reference-function@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "function getComponentName(obj: Record<string, unknown>): string {\n  return Object.keys(obj)[0];\n}\nfunction App() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>\n      Component Name is {componentName}\n      <OtherComponent />\n    </div>;\n}\nfunction OtherComponent() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>App component name is {componentName}</div>;\n}\nexport { App as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/circular-reference-function@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/circular-reference-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/conditional-properties.tsx",
    "content": "const $$splitLoaderImporter = () => import('conditional-properties.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('conditional-properties.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/posts')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/conditional-properties@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { isEnabled } from '@features/feature-flags';\nimport TrueImport from '@modules/true-component';\nimport { FalseComponent } from '@modules/false-component';\nconst SplitComponent = isEnabled ? TrueImport.Component : FalseComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/conditional-properties@loader.tsx",
    "content": "import { isEnabled } from '@features/feature-flags';\nimport TrueImport from '@modules/true-component';\nimport { falseLoader } from '@modules/false-component';\nconst SplitLoader = isEnabled ? TrueImport.loader : falseLoader;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/conditional-properties@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export-multiple.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export-multiple.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const getConfig = () => ({\n  baseUrl: 'https://api.example.com',\n  timeout: 5000\n});\nexport const {\n  baseUrl,\n  timeout\n} = getConfig();\nexport const [first, second] = [1, 2];\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export-multiple@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { baseUrl, timeout } from \"destructured-export-multiple.tsx\";\nfunction AboutComponent() {\n  return <div>\n      <p>Base URL: {baseUrl}</p>\n      <p>Timeout: {timeout}</p>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export-multiple@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export-multiple@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export-nested.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export-nested.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nconst getConfig = () => ({\n  api: {\n    baseUrl: 'https://api.example.com'\n  },\n  timeout: 5000,\n  extra: 'data'\n});\nexport const {\n  api: {\n    baseUrl\n  },\n  ...rest\n} = getConfig();\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export-nested@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { baseUrl } from \"destructured-export-nested.tsx\";\nfunction AboutComponent() {\n  return <div>\n      <p>Base URL: {baseUrl}</p>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export-nested@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export-nested@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}\nexport const {\n  getObject\n} = getObjectCallback();\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "export function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}\nfunction AboutComponent() {\n  return <div className=\"p-2\">\n      <h3>About</h3>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@loader.tsx",
    "content": "export function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-export@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-react-memo-imported-component.tsx",
    "content": "const $$splitLoaderImporter = () => import('destructured-react-memo-imported-component.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('destructured-react-memo-imported-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-react-memo-imported-component@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { memo } from 'react';\nfunction Component() {\n  return <div>Component</div>;\n}\nconst SplitComponent = memo(Component);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-react-memo-imported-component@loader.tsx",
    "content": "import { importedLoader } from '../../shared/imported';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-react-memo-imported-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-route-options-defaults.tsx",
    "content": "const $$splitLoaderImporter = () => import('destructured-route-options-defaults.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('destructured-route-options-defaults.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-route-options-defaults@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { MyComponent } from \"destructured-route-options-defaults.tsx?tsr-shared=1\";\nexport { MyComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-route-options-defaults@loader.tsx",
    "content": "import { loader } from \"destructured-route-options-defaults.tsx?tsr-shared=1\";\nexport { loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructured-route-options-defaults@shared.tsx",
    "content": "function defaultLoader() {\n  return {\n    message: 'default'\n  };\n}\nfunction DefaultComponent() {\n  return <div>Default</div>;\n}\nconst createBits = () => ({\n  component: ActualComponent,\n  loader: () => ({\n    message: 'hello'\n  })\n});\nconst {\n  component: MyComponent = DefaultComponent,\n  loader = defaultLoader\n} = createBits();\nfunction ActualComponent() {\n  return <div>About</div>;\n}\nexport { ActualComponent, createBits, DefaultComponent, defaultLoader, loader, MyComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring.tsx",
    "content": "import thing from 'thing'\n\nexport function test() {\n  const {\n    foo: {\n      bar: { destructured },\n    },\n  } = thing\n\n  return destructured\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import thing from 'thing';\nexport function test() {\n  const {\n    foo: {\n      bar: {\n        destructured\n      }\n    }\n  } = thing;\n  return destructured;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@loader.tsx",
    "content": "import thing from 'thing';\nexport function test() {\n  const {\n    foo: {\n      bar: {\n        destructured\n      }\n    }\n  } = thing;\n  return destructured;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/destructuring@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue.tsx",
    "content": "'use client';\n\nconst $$splitComponentImporter = () => import('directive-prologue.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/directive')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "'use client';\n\nconst SplitComponent = () => {\n  return <div>directive preserved</div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/directive-prologue@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@loader.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/explicit-undefined-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound.tsx",
    "content": "console.warn(\"[tanstack-router] These exports from \\\"export-default-component-and-normal-notFound.tsx\\\" will not be code-split and will increase your bundle size:\\n- Home\\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.\");\nconst $$splitNotFoundComponentImporter = () => import('export-default-component-and-normal-notFound.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport React, { useState } from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/home')({\n  component: Home,\n  notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')\n});\nexport default function Home() {\n  const [one, setOne] = useState('this is from a state');\n  return <div>\n      <h1>{one}</h1>\n    </div>;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';\nfunction NotFoundComponent() {\n  return <div>Not Found</div>;\n}\nexport { NotFoundComponent as notFoundComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@loader.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component-and-normal-notFound@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component.tsx",
    "content": "import React, { useState } from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/home')({\n  component: Home,\n})\n\nexport default function Home() {\n  const [one, setOne] = useState('this is from a state')\n\n  return (\n    <div>\n      <h1>{one}</h1>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@loader.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/export-default-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter.tsx",
    "content": "import * as React from 'react'\n// @ts-expect-error\nimport { useMemo } from 'tan-react'\n\nconst useUsedVar = 'i-am-unused'\n\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true'\n}, [])\n\nconsole.info(ReactUseMemoCall1)\n\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true'\n}, [])\n\nconsole.info(ReactUseMemoCall2)\n\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true'\n}, [])\n\nconsole.info(UseMemoCall1)\n\nconst UseMemoCall2 = useMemo(() => {\n  return 'true'\n}, [])\n\nconsole.info(UseMemoCall2)\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\n// @ts-expect-error\nimport { useMemo } from 'tan-react';\nconst useUsedVar = 'i-am-unused';\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall1);\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall2);\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall1);\nconst UseMemoCall2 = useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall2);"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@loader.tsx",
    "content": "import * as React from 'react';\n// @ts-expect-error\nimport { useMemo } from 'tan-react';\nconst useUsedVar = 'i-am-unused';\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall1);\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall2);\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall1);\nconst UseMemoCall2 = useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall2);"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-as-parameter@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration.tsx",
    "content": "const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('function-declaration.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/posts')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { Route } from \"function-declaration.tsx\";\nfunction PostsComponent() {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, {\n        id: 'i-do-not-exist',\n        title: 'Non-existent Post'\n      }]?.map(post => {\n        return <li key={post.id} className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n            postId: post.id\n          }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n            className: 'text-black font-bold'\n          }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n      })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n}\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@loader.tsx",
    "content": "import * as React from 'react';\nimport { fetchPosts } from '../posts';\nconst SplitLoader = fetchPosts;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/function-declaration@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute.tsx",
    "content": "const $$splitComponentImporter = () => import('importAttribute.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { test } from './test' with { type: 'macro' };\nconst SplitComponent = () => test;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/importAttribute@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader.tsx",
    "content": "const $$splitLoaderImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import importedComponent from '../../shared/imported';\nconst SplitComponent = importedComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@loader.tsx",
    "content": "import { importedLoader } from '../../shared/imported';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component-destructured-loader@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component.tsx",
    "content": "const $$splitComponentImporter = () => import('imported-default-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import ImportedDefaultComponent from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-default-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent.tsx",
    "content": "const $$splitErrorComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nconst $$splitComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  errorComponent: lazyRouteComponent($$splitErrorComponentImporter, 'errorComponent')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import ImportedDefaultComponent, { importedErrorComponent } from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };\nconst SplitErrorComponent = importedErrorComponent;\nexport { SplitErrorComponent as errorComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-errorComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent.tsx",
    "content": "const $$splitNotFoundComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nconst $$splitComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import ImportedDefaultComponent, { importedNotFoundComponent } from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };\nconst SplitNotFoundComponent = importedNotFoundComponent;\nexport { SplitNotFoundComponent as notFoundComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-notFoundComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent.tsx",
    "content": "const $$splitPendingComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nconst $$splitComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  pendingComponent: lazyRouteComponent($$splitPendingComponentImporter, 'pendingComponent')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import ImportedDefaultComponent, { importedPendingComponent } from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };\nconst SplitPendingComponent = importedPendingComponent;\nexport { SplitPendingComponent as pendingComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported-pendingComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported.tsx",
    "content": "const $$splitLoaderImporter = () => import('imported.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('imported.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { importedComponent } from '../../shared';\nconst SplitComponent = importedComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@loader.tsx",
    "content": "import { importedLoader } from '../../shared';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/imported@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline.tsx",
    "content": "const $$splitComponentImporter = () => import('inline.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nRoute.addChildren([]);\nexport const test = 'test';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport * as styles from '../style.css';\nimport { TEST_DATA } from '../test.const';\nconst Button = (props: {\n  children: any;\n}) => {\n  return <button>{props.children}</button>;\n};\nimport { Route } from \"inline.tsx\";\nimport { test } from \"inline.tsx\";\nconst SplitComponent = () => {\n  return <div className=\"p-2\">\n        {test}\n        <h3 className={styles.indexPageTitle}>{TEST_DATA.welcome}</h3>\n        <Button>Click me</Button>\n      </div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@loader.tsx",
    "content": "import * as React from 'react';\nimport { Route } from \"inline.tsx\";"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number.tsx",
    "content": "const $$splitComponentImporter = () => import('random-number.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('random-number.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { Await, Link, createFileRoute } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nexport const textColors = [`text-rose-500`, `text-yellow-500`, `text-teal-500`, `text-blue-500`];\nexport const gradients = [`from-rose-500 to-yellow-500`, `from-yellow-500 to-teal-500`, `from-teal-500 to-violet-500`, `from-blue-500 to-pink-500`];\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];\nexport const Route = createFileRoute('/')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { Await, Link } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport discordImage from '~/images/discord-logo-white.svg';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nimport { useMutation } from '~/hooks/useMutation';\nimport { sample } from '~/utils/utils';\nimport { textColors } from \"random-number.tsx\";\nimport { gradients } from \"random-number.tsx\";\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];\nimport { Route } from \"random-number.tsx\";\nasync function bytesSignupServerFn({\n  email\n}: {\n  email: string;\n}) {\n  'use server';\n\n  return fetch(`https://bytes.dev/api/bytes-optin-cors`, {\n    method: 'POST',\n    body: JSON.stringify({\n      email,\n      influencer: 'tanstack'\n    }),\n    headers: {\n      Accept: 'application/json',\n      'Content-Type': 'application/json'\n    }\n  });\n}\nfunction Index() {\n  const bytesSignupMutation = useMutation({\n    fn: bytesSignupServerFn\n  });\n  const {\n    sponsorsPromise,\n    randomNumber,\n    testing2\n  } = Route.useLoaderData();\n  const gradient = sample(gradients, randomNumber);\n  const textColor = sample(textColors, randomNumber);\n  return <>\n      {discordImage}\n      {gradient}\n      {textColor}\n    </>;\n}\nexport { Index as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@loader.tsx",
    "content": "import { Await, Link, defer } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport { getSponsorsForSponsorPack } from '~/server/sponsors';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];\nconst SplitLoader = () => {\n  return {\n    randomNumber: Math.random(),\n    sponsorsPromise: defer(getSponsorsForSponsorPack())\n  };\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/random-number@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component.tsx",
    "content": "const $$splitLoaderImporter = () => import('react-memo-component.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('react-memo-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';\nfunction Component() {\n  return <div>Component</div>;\n}\nconst SplitComponent = React.memo(Component);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@loader.tsx",
    "content": "import { importedLoader } from '../../shared/imported';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component.tsx",
    "content": "const $$splitLoaderImporter = () => import('react-memo-imported-component.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('react-memo-imported-component.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';\nimport { importedComponent } from '../../shared/imported';\nconst SplitComponent = React.memo(importedComponent);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@loader.tsx",
    "content": "import { importedLoader } from '../../shared/imported';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/react-memo-imported-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component.tsx",
    "content": "console.warn(\"[tanstack-router] These exports from \\\"retain-export-component.tsx\\\" will not be code-split and will increase your bundle size:\\n- Layout\\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.\");\nconst $$splitLoaderImporter = () => import('retain-export-component.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute, Outlet } from '@tanstack/react-router';\nimport { importedComponent as ImportedComponent } from '../../shared/imported';\nexport function Layout() {\n  return <main>\n      <header style={{\n      height: HEADER_HEIGHT\n    }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>;\n}\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});\nconst HEADER_HEIGHT = '63px';\nexport const SIDEBAR_WIDTH = '150px';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@loader.tsx",
    "content": "import * as React from 'react';\nimport { importedLoader } from '../../shared/imported';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-export-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport const loaderFn = () => {\n  return importedLoader()\n}\n\nconst Layout = () => {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n\nexport default Layout\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@loader.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-const@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst createBits = () => ({\n  component: AboutComponentImpl,\n  loader: () => ({\n    message: 'hello',\n  }),\n})\n\nexport const { component: AboutComponent, loader } = createBits()\n\nfunction AboutComponentImpl() {\n  return <div>About</div>\n}\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n  loader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { AboutComponent } from \"retain-exports-destructured.tsx?tsr-shared=1\";\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@loader.tsx",
    "content": "import { loader } from \"retain-exports-destructured.tsx?tsr-shared=1\";\nexport { loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-destructured@shared.tsx",
    "content": "const createBits = () => ({\n  component: AboutComponentImpl,\n  loader: () => ({\n    message: 'hello'\n  })\n});\nconst {\n  component: AboutComponent,\n  loader\n} = createBits();\nfunction AboutComponentImpl() {\n  return <div>About</div>;\n}\nexport { AboutComponent, AboutComponentImpl, createBits, loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport function loaderFn() {\n  return importedLoader()\n}\n\nfunction Layout() {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n\nexport default Layout\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@loader.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader.tsx",
    "content": "console.warn(\"[tanstack-router] These exports from \\\"retain-exports-loader.tsx\\\" will not be code-split and will increase your bundle size:\\n- loaderFn\\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.\");\nconst $$splitComponentImporter = () => import('retain-exports-loader.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport function loaderFn() {\n  return {\n    foo: 'bar'\n  };\n}\nexport const Route = createFileRoute('/_layout')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: loaderFn\n});\nexport const SIDEBAR_WIDTH = '150px';\nexport const SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport { Outlet } from '@tanstack/react-router';\nimport { importedComponent as ImportedComponent } from '../../shared/imported';\nfunction Layout() {\n  return <main>\n      <header style={{\n      height: HEADER_HEIGHT\n    }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>;\n}\nconst HEADER_HEIGHT = '63px';\nconst ASIDE_WIDTH = '250px';\nexport { Layout as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@loader.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/retain-exports-loader@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-class.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-class.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/store')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { store } from \"shared-class.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>{store.get('items')}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@loader.tsx",
    "content": "import { store } from \"shared-class.tsx?tsr-shared=1\";\nconst SplitLoader = async () => {\n  store.set('items', await fetch('/api'));\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-class@shared.tsx",
    "content": "class DataStore {\n  data = new Map();\n  get(k: string) {\n    return this.data.get(k);\n  }\n  set(k: string, v: unknown) {\n    this.data.set(k, v);\n  }\n}\nconst store = new DataStore();\nexport { DataStore, store };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-destructured-export.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-destructured-export.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/config')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nexport { apiUrl, timeout } from \"shared-destructured-export.tsx?tsr-shared=1\";"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { timeout } from \"shared-destructured-export.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>Timeout: {timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@loader.tsx",
    "content": "import { apiUrl } from \"shared-destructured-export.tsx?tsr-shared=1\";\nconst SplitLoader = async () => fetch(apiUrl);\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured-export@shared.tsx",
    "content": "const {\n  apiUrl,\n  timeout\n} = getConfig();\nfunction getConfig() {\n  return {\n    apiUrl: '/api',\n    timeout: 5000\n  };\n}\nexport { apiUrl, getConfig, timeout };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-destructured.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-destructured.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/config')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { timeout } from \"shared-destructured.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>Timeout: {timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@loader.tsx",
    "content": "import { apiUrl } from \"shared-destructured.tsx?tsr-shared=1\";\nconst SplitLoader = async () => fetch(apiUrl);\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-destructured@shared.tsx",
    "content": "const {\n  apiUrl,\n  timeout\n} = getConfig();\nfunction getConfig() {\n  return {\n    apiUrl: '/api',\n    timeout: 5000\n  };\n}\nexport { apiUrl, getConfig, timeout };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-exported.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-exported.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/query')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nexport { queryOptions } from \"shared-exported.tsx?tsr-shared=1\";"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { queryOptions } from \"shared-exported.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>GC: {queryOptions.gcTime}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@loader.tsx",
    "content": "import { queryOptions } from \"shared-exported.tsx?tsr-shared=1\";\nconst SplitLoader = async () => {\n  return {\n    staleTime: queryOptions.staleTime\n  };\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-exported@shared.tsx",
    "content": "const queryOptions = {\n  staleTime: 5000,\n  gcTime: 10000\n};\nexport { queryOptions };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-function.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-function.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/cached')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { getCached } from \"shared-function.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>{JSON.stringify(getCached('data'))}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@loader.tsx",
    "content": "import { getCached, cache } from \"shared-function.tsx?tsr-shared=1\";\nfunction setCached(key: string, val: unknown) {\n  cache.set(key, val);\n}\nconst SplitLoader = async () => {\n  setCached('data', await fetch('/api').then(r => r.json()));\n  return getCached('data');\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-function@shared.tsx",
    "content": "const cache = new Map();\nfunction getCached(key: string) {\n  return cache.get(key);\n}\nexport { cache, getCached };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-imported-binding.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-imported-binding.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/imported')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { sharedUtil } from '../utils';\nconst SplitComponent = () => <div>{sharedUtil('render')}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@loader.tsx",
    "content": "import { sharedUtil } from '../utils';\nconst SplitLoader = async () => sharedUtil('load');\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-imported-binding@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-indirect-ref.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-indirect-ref.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/shared-indirect')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { state, getCount } from \"shared-indirect-ref.tsx?tsr-shared=1\";\nfunction SharedComponent() {\n  return <div>\n      {getCount()} - {state.count}\n    </div>;\n}\nexport { SharedComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@loader.tsx",
    "content": "import { state, getCount } from \"shared-indirect-ref.tsx?tsr-shared=1\";\nconst SplitLoader = () => {\n  state.count++;\n  return {\n    count: getCount()\n  };\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-indirect-ref@shared.tsx",
    "content": "const state = {\n  count: 0\n};\nfunction getCount() {\n  return state.count;\n}\nexport { getCount, state };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\n// @ts-nocheck\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/jsx')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { shared } from \"shared-jsx-component-ref.tsx?tsr-shared=1\"; // @ts-nocheck\nfunction SharedComponent() {\n  return <div>{shared}</div>;\n}\nexport { SharedComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@loader.tsx",
    "content": "import { shared } from \"shared-jsx-component-ref.tsx?tsr-shared=1\"; // @ts-nocheck\nconst SplitLoader = () => shared;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-jsx-component-ref@shared.tsx",
    "content": "// @ts-nocheck\n\nconst shared = 1;\nexport { shared };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-none.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-none.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/clean')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "const ComponentHelper = () => <span>helper</span>;\nconst SplitComponent = () => <div>\n      <ComponentHelper />\n    </div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@loader.tsx",
    "content": "const loaderHelper = () => fetch('/api');\nconst SplitLoader = async () => loaderHelper();\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-none@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-referencing-route.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-referencing-route.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/about')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { HEADER } from \"shared-referencing-route.tsx?tsr-shared=1\";\nfunction usePageTitle() {\n  return `${HEADER} - ${Route.fullPath}`;\n}\nimport { Route } from \"shared-referencing-route.tsx\";\nconst SplitComponent = () => {\n  const title = usePageTitle();\n  return <div>{title}</div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@loader.tsx",
    "content": "import { HEADER } from \"shared-referencing-route.tsx?tsr-shared=1\";\nfunction usePageTitle() {\n  return `${HEADER} - ${Route.fullPath}`;\n}\nimport { Route } from \"shared-referencing-route.tsx\";\nconst SplitLoader = async () => {\n  const title = usePageTitle();\n  return {\n    title\n  };\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-referencing-route@shared.tsx",
    "content": "const HEADER = 'Page';\nexport { HEADER };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-transitive.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-transitive.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/api')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { config } from \"shared-transitive.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>Timeout: {config.timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@loader.tsx",
    "content": "import { config } from \"shared-transitive.tsx?tsr-shared=1\";\nconst fetcher = (path: string) => fetch(`${config.url}${path}`);\nconst SplitLoader = async () => {\n  return fetcher('/data');\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-transitive@shared.tsx",
    "content": "const BASE_URL = 'https://api.example.com';\nconst config = {\n  url: BASE_URL,\n  timeout: 5000\n};\nexport { BASE_URL, config };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-variable.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-variable.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/todos')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { collection } from \"shared-variable.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>{collection.name}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@loader.tsx",
    "content": "import { collection } from \"shared-variable.tsx?tsr-shared=1\";\nconst SplitLoader = async () => {\n  await collection.preload();\n  return {\n    data: 'loaded'\n  };\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-variable@shared.tsx",
    "content": "const collection = {\n  name: 'todos',\n  preload: async () => {}\n};\nexport { collection };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-with-side-effect.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-with-side-effect.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nconsole.log('registry created');\nexport const Route = createFileRoute('/fx')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { registry } from \"shared-with-side-effect.tsx?tsr-shared=1\";\nconst SplitComponent = () => <div>{registry.size}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@loader.tsx",
    "content": "import { registry } from \"shared-with-side-effect.tsx?tsr-shared=1\";\nconst SplitLoader = async () => {\n  registry.set('loaded', true);\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/shared-with-side-effect@shared.tsx",
    "content": "const registry = new Map();\nexport { registry };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/undefined-test')({\n  component: undefined,\n  errorComponent: undefined,\n  pendingComponent: undefined,\n  notFoundComponent: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@loader.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/undefined-literals@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure.tsx",
    "content": "import * as React from 'react'\n\nimport { CgCornerUpLeft, CgSpinner } from 'react-icons/cg'\nimport {\n  FaBolt,\n  FaBook,\n  FaCheckCircle,\n  FaCogs,\n  FaDiscord,\n  FaGithub,\n  FaTshirt,\n  FaTwitter,\n} from 'react-icons/fa'\nimport { Await, Link, getRouteApi } from '@tanstack/react-router'\nimport { Carbon } from '~/components/Carbon'\nimport { Footer } from '~/components/Footer'\nimport { VscPreview, VscWand } from 'react-icons/vsc'\nimport { TbHeartHandshake } from 'react-icons/tb'\nimport SponsorPack from '~/components/SponsorPack'\nimport { startProject } from '~/projects/start'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { Framework, getBranch } from '~/projects'\nimport { seo } from '~/utils/seo'\n\nconst menu = [\n  {\n    label: (\n      <div className=\"flex items-center gap-2\">\n        <CgCornerUpLeft className=\"text-lg\" /> TanStack\n      </div>\n    ),\n    to: '/',\n  },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <VscPreview className=\"text-lg\" /> Examples\n  //     </div>\n  //   ),\n  //   to: './docs/react/examples/basic',\n  // },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <FaBook className=\"text-lg\" /> Docs\n  //     </div>\n  //   ),\n  //   to: './docs/',\n  // },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <FaGithub className=\"text-lg\" /> GitHub\n  //     </div>\n  //   ),\n  //   to: `https://github.com/${startProject.repo}`,\n  // },\n  {\n    label: (\n      <div className=\"flex items-center gap-1\">\n        <FaDiscord className=\"text-lg\" /> Discord\n      </div>\n    ),\n    to: 'https://tlinz.com/discord',\n  },\n  {\n    label: (\n      <div className=\"flex items-center gap-1\">\n        <FaTshirt className=\"text-lg\" /> Merch\n      </div>\n    ),\n    to: `https://cottonbureau.com/people/tanstack`,\n  },\n]\n\nexport const Route = createFileRoute('/_libraries/start/$version/')({\n  component: VersionIndex,\n  meta: () =>\n    seo({\n      title: startProject.name,\n      description: startProject.description,\n    }),\n})\n\nconst librariesRouteApi = getRouteApi('/_libraries')\n\nexport default function VersionIndex() {\n  const { sponsorsPromise } = librariesRouteApi.useLoaderData()\n  const { version } = Route.useParams()\n  const branch = getBranch(startProject, version)\n  const [framework, setFramework] = React.useState<Framework>('react')\n  const [isDark, setIsDark] = React.useState(true)\n\n  React.useEffect(() => {\n    setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)\n  }, [])\n\n  const gradientText = `inline-block text-transparent bg-clip-text bg-gradient-to-r ${startProject.colorFrom} ${startProject.colorTo}`\n\n  return (\n    <div className=\"flex flex-col gap-20 md:gap-32 max-w-full\">\n      <div\n        className=\"flex flex-wrap py-2 px-4 items-center justify-center text-sm max-w-screen-xl mx-auto\n          md:text-base md:self-end\"\n      >\n        {menu?.map((item, i) => {\n          const label = (\n            <div className=\"p-2 opacity-90 hover:opacity-100\">{item.label}</div>\n          )\n\n          return (\n            <div key={i} className=\"hover:underline\">\n              {item.to.startsWith('http') ? (\n                <a href={item.to}>{label}</a>\n              ) : (\n                <Link to={item.to} params>\n                  {label}\n                </Link>\n              )}\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex flex-col items-center gap-8 text-center px-4\">\n        <div className=\"flex gap-2 lg:gap-4 items-center\">\n          <h1\n            className={`inline-block\n            font-black text-4xl\n            md:text-6xl\n            lg:text-7xl relative`}\n          >\n            <span className={gradientText}>TanStack Start</span>\n          </h1>\n        </div>\n        {/* <div className=\"absolute left-1/2 top-0 -translate-x-1/2 -translate-y-[150%]\"> */}\n        <div\n          className=\"text-sm\n            md:text-base font-black\n            lg:text-lg align-super text-white animate-bounce uppercase\n              dark:text-black bg-black dark:bg-white shadow-xl shadow-black/30 px-2 py-1 rounded-md\n              leading-none whitespace-nowrap\"\n        >\n          Coming Soon!\n          {/* {version === 'latest' ? latestVersion : version} */}\n        </div>\n        {/* </div> */}\n        <h2\n          className=\"font-bold text-2xl max-w-md\n            md:text-3xl\n            lg:text-5xl lg:max-w-2xl\"\n        >\n          Full-stack React framework{' '}\n          <span className=\"underline decoration-dashed decoration-yellow-500 decoration-3 underline-offset-2\">\n            powered by TanStack Router\n          </span>{' '}\n        </h2>\n        <p\n          className=\"text opacity-90 max-w-[500px]\n            lg:text-xl lg:max-w-[600px]\"\n        >\n          Full-document SSR, Streaming, Server Functions, bundling and more,\n          powered by <strong>TanStack Router</strong>, <strong>Nitro</strong>{' '}\n          and <strong>Vite</strong>. Ready to deploy to your favorite hosting\n          provider.\n        </p>\n      </div>\n      <div className=\"space-y-8 px-4\">\n        <div className=\"font-black text-3xl mr-1 text-center\">\n          So when can I use it?\n        </div>\n        <div className=\"max-w-full p-8 w-[800px] mx-auto leading-loose space-y-4 bg-white dark:bg-gray-700 rounded-xl shadow-xl shadow-black/10\">\n          <div>\n            <strong>TanStack Start </strong> is currently in development and is\n            not yet available for public use. We are working hard to bring you\n            the best possible experience and will be releasing more details\n            soon. In the meantime, you can follow along with the development\n            process by watching the commits on this very website!\n          </div>\n          <div>\n            Yes, you heard that right!{' '}\n            <strong>\n              TanStack.com is already being built and deployed using TanStack\n              Start\n            </strong>\n            ! We are eating our own dog food and are excited to share the\n            results with you soon!\n          </div>\n        </div>\n        <div className=\"flex items-center gap-2 flex-wrap justify-center\">\n          <a\n            href={`https://github.com/TanStack/tanstack.com`}\n            className={`flex items-center gap-2 py-2 px-4 bg-cyan-700 rounded text-white uppercase font-extrabold`}\n          >\n            <FaGithub /> View TanStack.com Source\n          </a>\n          <a\n            href={`https://twitter.com/intent/post?text=${encodeURIComponent(\n              `I'm excited for TanStack Start, new full-stack React framework coming soon from team @Tan_Stack!\n              \nCheck it out at https://tanstack.com/start/`,\n            )}`}\n            target=\"_blank\"\n            className={`flex items-center gap-2 py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}\n          >\n            <FaTwitter /> Tweet about it!\n          </a>{' '}\n        </div>\n      </div>\n      {/* <div\n        className=\"text-lg flex flex-col gap-12 p-8 max-w-[1200px] mx-auto\n                        md:flex-row\"\n      >\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <VscWand className=\"text-cyan-500 text-6xl\" />\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Built on TanStack Router\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              Writing your data fetching logic by hand is over. Tell TanStack\n              Query where to get your data and how fresh you need it to be and\n              the rest is automatic. It handles{' '}\n              <span className=\"font-semibold text-cyan-700 dark:text-cyan-400\">\n                caching, background updates and stale data out of the box with\n                zero-configuration\n              </span>\n              .\n            </p>\n          </div>\n        </div>\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <div className=\"text-center\">\n            <FaBolt className=\"text-sky-600 text-6xl\" />\n          </div>\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Simple & Familiar\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              If you know how to work with promises or async/await, then you\n              already know how to use TanStack Query. There's{' '}\n              <span className=\"font-semibold text-sky-700 dark:text-sky-400\">\n                no global state to manage, reducers, normalization systems or\n                heavy configurations to understand\n              </span>\n              . Simply pass a function that resolves your data (or throws an\n              error) and the rest is history.\n            </p>\n          </div>\n        </div>\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <div className=\"text-center\">\n            <FaCogs className=\"text-blue-500 text-6xl\" />\n          </div>\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Extensible\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              TanStack Query is configurable down to each observer instance of a\n              query with knobs and options to fit every use-case. It comes wired\n              up with{' '}\n              <span className=\"font-semibold text-blue-700 dark:text-blue-400\">\n                dedicated devtools, infinite-loading APIs, and first class\n                mutation tools that make updating your data a breeze\n              </span>\n              . Don't worry though, everything is pre-configured for success!\n            </p>\n          </div>\n        </div>\n      </div> */}\n\n      {/* <div className=\"px-4 sm:px-6 lg:px-8 mx-auto\">\n        <div className=\" sm:text-center pb-16\">\n          <h3 className=\"text-3xl text-center mx-auto leading-tight font-extrabold tracking-tight sm:text-4xl lg:leading-none mt-2\">\n            No dependencies. All the Features.\n          </h3>\n          <p className=\"mt-4 text-xl max-w-3xl mx-auto leading-7 opacity-60\">\n            With zero dependencies, TanStack Query is extremely lean given the\n            dense feature set it provides. From weekend hobbies all the way to\n            enterprise e-commerce systems (Yes, I'm lookin' at you Walmart! 😉),\n            TanStack Query is the battle-hardened tool to help you succeed at\n            the speed of your creativity.\n          </p>\n        </div>\n        <div className=\"grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-10 gap-y-4  mx-auto\">\n          {[\n            'Backend agnostic',\n            'Dedicated Devtools',\n            'Auto Caching',\n            'Auto Refetching',\n            'Window Focus Refetching',\n            'Polling/Realtime Queries',\n            'Parallel Queries',\n            'Dependent Queries',\n            'Mutations API',\n            'Automatic Garbage Collection',\n            'Paginated/Cursor Queries',\n            'Load-More/Infinite Scroll Queries',\n            'Scroll Recovery',\n            'Request Cancellation',\n            'Suspense Ready!',\n            'Render-as-you-fetch',\n            'Prefetching',\n            'Variable-length Parallel Queries',\n            'Offline Support',\n            'SSR Support',\n            'Data Selectors',\n          ].map((d, i) => {\n            return (\n              <span key={i} className=\"flex items-center gap-2\">\n                <FaCheckCircle className=\"text-green-500 \" /> {d}\n              </span>\n            )\n          })}\n        </div>\n      </div> */}\n\n      {/* <div>\n        <div className=\"uppercase tracking-wider text-sm font-semibold text-center text-gray-400 mb-3\">\n          Trusted in Production by\n        </div>\n        <marquee scrollamount=\"2\">\n          <div className=\"flex gap-2 items-center text-3xl font-bold ml-[-100%]\">\n            {(new Array(4) as string[])\n              .fill('')\n              .reduce(\n                (all) => [...all, ...all],\n                [\n                  'Google',\n                  'Walmart',\n                  'Facebook',\n                  'PayPal',\n                  'Amazon',\n                  'American Express',\n                  'Microsoft',\n                  'Target',\n                  'Ebay',\n                  'Autodesk',\n                  'CarFAX',\n                  'Docusign',\n                  'HP',\n                  'MLB',\n                  'Volvo',\n                  'Ocado',\n                  'UPC.ch',\n                  'EFI.com',\n                  'ReactBricks',\n                  'Nozzle.io',\n                  'Uber',\n                ]\n              )\n              .map((d, i) => (\n                <span key={i} className=\"opacity-70 even:opacity-40\">\n                  {d}\n                </span>\n              ))}\n          </div>\n        </marquee>\n      </div> */}\n\n      <div className=\"px-4 w-[500px] max-w-full mx-auto\">\n        <h3 className=\"text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8\">\n          Partners\n        </h3>\n        <div className=\"h-8\" />\n        <div\n          className=\"flex-1 flex flex-col items-center text-sm text-center\n                      bg-white shadow-xl shadow-gray-500/20 rounded-lg\n                        divide-y-2 divide-gray-500 divide-opacity-10 overflow-hidden\n                        dark:bg-gray-800 dark:shadow-none\"\n        >\n          <span className=\"flex items-center gap-2 p-12 text-4xl text-rose-500 font-black uppercase\">\n            Start <TbHeartHandshake /> You?\n          </span>\n          <div className=\"flex flex-col p-4 gap-4\">\n            <div>\n              We're looking for a TanStack Start OSS Partner to go above and\n              beyond the call of sponsorship. Are you as invested in TanStack\n              Start as we are? Let's push the boundaries of Start together!\n            </div>\n            <a\n              href=\"mailto:partners@tanstack.com?subject=TanStack Start Partnership\"\n              className=\"text-blue-500 uppercase font-black text-sm\"\n            >\n              Let's chat\n            </a>\n          </div>\n        </div>\n      </div>\n\n      <div className=\"relative text-lg overflow-hidden\">\n        <h3 className=\"text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8\">\n          Sponsors\n        </h3>\n        <div\n          className=\"my-4 flex flex-wrap mx-auto max-w-screen-lg\"\n          style={{\n            aspectRatio: '1/1',\n          }}\n        >\n          <Await\n            promise={sponsorsPromise}\n            fallback={<CgSpinner className=\"text-2xl animate-spin\" />}\n            children={(sponsors) => {\n              return <SponsorPack sponsors={sponsors} />\n            }}\n          />\n        </div>\n        <div className=\"text-center\">\n          <a\n            href=\"https://github.com/sponsors/tannerlinsley\"\n            className=\"inline-block bg-green-500 px-4 py-2 text-xl mx-auto leading-tight font-extrabold tracking-tight text-white rounded-full\"\n          >\n            Become a Sponsor!\n          </a>\n        </div>\n      </div>\n\n      <div className=\"mx-auto max-w-[400px] flex flex-col gap-2 items-center\">\n        <div className=\"shadow-lg rounded-lg overflow-hidden bg-white dark:bg-gray-800 dark:text-white\">\n          <Carbon />\n        </div>\n        <span\n          className=\"text-[.7rem] bg-gray-500 bg-opacity-10 py-1 px-2 rounded text-gray-500\n                dark:bg-opacity-20\"\n        >\n          This ad helps us be happy about our invested time and not burn out and\n          rage-quit OSS. Yay money! 😉\n        </span>\n      </div>\n\n      {/* <div className=\"flex flex-col gap-4\">\n        <div className=\"px-4 sm:px-6 lg:px-8  mx-auto max-w-3xl sm:text-center\">\n          <h3 className=\"text-3xl text-center leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-2\">\n            Less code, fewer edge cases.\n          </h3>\n          <p className=\"my-4 text-xl leading-7  text-gray-600\">\n            Instead of writing reducers, caching logic, timers, retry logic,\n            complex async/await scripting (I could keep going...), you literally\n            write a tiny fraction of the code you normally would. You will be\n            surprised at how little code you're writing or how much code you're\n            deleting when you use TanStack Query. Try it out with one of the\n            examples below!\n          </p>\n          <div className=\"flex flex-wrap gap-2 justify-center\">\n            {(\n              [\n                { label: 'Angular', value: 'angular' },\n                { label: 'React', value: 'react' },\n                { label: 'Solid', value: 'solid' },\n                { label: 'Svelte', value: 'svelte' },\n                { label: 'Vue', value: 'vue' },\n              ] as const\n            ).map((item) => (\n              <button\n                key={item.value}\n                className={`inline-block py-2 px-4 rounded text-white uppercase font-extrabold ${\n                  item.value === framework\n                    ? 'bg-cyan-500'\n                    : 'bg-gray-300 dark:bg-gray-700 hover:bg-cyan-300'\n                }`}\n                onClick={() => setFramework(item.value)}\n              >\n                {item.label}\n              </button>\n            ))}\n          </div>\n        </div>\n      </div> */}\n\n      {/* {[''].includes(framework) ? (\n        <div className=\"px-2\">\n          <div className=\"p-8 text-center text-lg w-full max-w-screen-lg mx-auto bg-black text-white rounded-xl\">\n            Looking for the <strong>@tanstack/{framework}-query</strong>{' '}\n            example? We could use your help to build the{' '}\n            <strong>@tanstack/{framework}-query</strong> adapter! Join the{' '}\n            <a\n              href=\"https://tlinz.com/discord\"\n              className=\"text-teal-500 font-bold\"\n            >\n              TanStack Discord Server\n            </a>{' '}\n            and let's get to work!\n          </div>\n        </div>\n      ) : (\n        <div className=\"bg-white dark:bg-black\">\n          <iframe\n            key={framework}\n            src={`https://stackblitz.com/github/${repo}/tree/${branch}/examples/${framework}/simple?embed=1&theme=${\n              isDark ? 'dark' : 'light'\n            }`}\n            title={`tannerlinsley/${framework}-query: basic`}\n            sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n            className=\"shadow-2xl\"\n            loading=\"lazy\"\n            style={{\n              width: '100%',\n              height: '80vh',\n              border: '0',\n            }}\n          ></iframe>\n        </div>\n      )} */}\n\n      {/* <div className=\"flex flex-col gap-4 items-center\">\n        <div className=\"font-extrabold text-xl lg:text-2xl\">\n          Wow, you've come a long way!\n        </div>\n        <div className=\"italic font-sm opacity-70\">\n          Only one thing left to do...\n        </div>\n        <div>\n          <Link\n            to=\"./docs/\"\n            className={`inline-block py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}\n          >\n            Read the Docs!\n          </Link>\n        </div>\n      </div> */}\n      <Footer />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';\nimport { VscPreview, VscWand } from 'react-icons/vsc';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@loader.tsx",
    "content": "import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';\nimport { VscPreview, VscWand } from 'react-icons/vsc';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/useStateDestructure@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using.tsx",
    "content": "const $$splitLoaderImporter = () => import('using.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/react-router';\nexport const Route = createFileRoute({\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using@loader.tsx",
    "content": "const DummyPostResource = (postId: string) => ({\n  postData: {\n    id: postId,\n    title: 'dummy',\n    body: 'dummy'\n  },\n  [Symbol.dispose]: () => console.log('disposing!')\n});\nconst SplitLoader = ({\n  params: {\n    postId\n  }\n}) => {\n  using dummyPost = DummyPostResource(postId);\n  return dummyPost.postData;\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/using@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/posts')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { fetchPosts } from '../posts';\nimport { Route } from \"arrow-function.tsx\";\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, {\n        id: 'i-do-not-exist',\n        title: 'Non-existent Post'\n      }]?.map(post => {\n        return <li key={post.id} className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n            postId: post.id\n          }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n            className: 'text-black font-bold'\n          }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n      })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n};\nconst SplitLoader = fetchPosts;\nexport { SplitLoader as loader };\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function@errorComponent.tsx",
    "content": "import * as React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals.tsx",
    "content": "const $$splitLoaderImporter = () => import('boolean-null-literals.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('boolean-null-literals.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/router';\n\n// Test errorComponent with false literal\nexport const Route = createFileRoute('/test')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  errorComponent: false,\n  pendingComponent: null,\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "// Test errorComponent with false literal\nconst SplitLoader = async () => ({\n  data: 'test'\n});\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>Test Component</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/boolean-null-literals@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/chinese.tsx",
    "content": "const $$splitComponentImporter = () => import('chinese.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\ninterface DemoProps {\n  title: string;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/chinese@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nfunction HomeComponent() {\n  return <div className=\"p-2\">\n      <Demo title=\"标题很好看，谁说不是呢？\" />\n      <Demo title=\"The title looks great, who can deny that?\" />\n    </div>;\n}\ninterface DemoProps {\n  title: string;\n}\nfunction Demo({\n  title\n}: DemoProps) {\n  return <h1 style={{\n    color: '#2969ff',\n    fontSize: '2rem',\n    fontWeight: 'bold',\n    letterSpacing: '3px'\n  }}>\n      {title}\n    </h1>;\n}\nexport { HomeComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/chinese@errorComponent.tsx",
    "content": "import * as React from 'react';\ninterface DemoProps {\n  title: string;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/chinese@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/circular-reference-arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('circular-reference-arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/circular-reference-arrow-function@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "function getComponentName(obj: Record<string, unknown>): string {\n  return Object.keys(obj)[0];\n}\nconst App = () => {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>\n      Component Name is {componentName}\n      <OtherComponent />\n    </div>;\n};\nfunction OtherComponent() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>App component name is {componentName}</div>;\n}\nexport { App as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/circular-reference-arrow-function@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/circular-reference-arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/circular-reference-function.tsx",
    "content": "const $$splitComponentImporter = () => import('circular-reference-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/circular-reference-function@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "function getComponentName(obj: Record<string, unknown>): string {\n  return Object.keys(obj)[0];\n}\nfunction App() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>\n      Component Name is {componentName}\n      <OtherComponent />\n    </div>;\n}\nfunction OtherComponent() {\n  const componentName = getComponentName({\n    App\n  });\n  return <div>App component name is {componentName}</div>;\n}\nexport { App as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/circular-reference-function@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/circular-reference-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/conditional-properties.tsx",
    "content": "const $$splitLoaderImporter = () => import('conditional-properties.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('conditional-properties.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/posts')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/conditional-properties@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { isEnabled } from '@features/feature-flags';\nimport TrueImport from '@modules/true-component';\nimport { FalseComponent, falseLoader } from '@modules/false-component';\nconst SplitLoader = isEnabled ? TrueImport.loader : falseLoader;\nexport { SplitLoader as loader };\nconst SplitComponent = isEnabled ? TrueImport.Component : FalseComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/conditional-properties@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/conditional-properties@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export-multiple.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export-multiple.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const getConfig = () => ({\n  baseUrl: 'https://api.example.com',\n  timeout: 5000\n});\nexport const {\n  baseUrl,\n  timeout\n} = getConfig();\nexport const [first, second] = [1, 2];\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export-multiple@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { baseUrl, timeout } from \"destructured-export-multiple.tsx\";\nfunction AboutComponent() {\n  return <div>\n      <p>Base URL: {baseUrl}</p>\n      <p>Timeout: {timeout}</p>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export-multiple@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export-multiple@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export-nested.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export-nested.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nconst getConfig = () => ({\n  api: {\n    baseUrl: 'https://api.example.com'\n  },\n  timeout: 5000,\n  extra: 'data'\n});\nexport const {\n  api: {\n    baseUrl\n  },\n  ...rest\n} = getConfig();\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export-nested@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { baseUrl } from \"destructured-export-nested.tsx\";\nfunction AboutComponent() {\n  return <div>\n      <p>Base URL: {baseUrl}</p>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export-nested@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export-nested@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export.tsx",
    "content": "const $$splitComponentImporter = () => import('destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}\nexport const {\n  getObject\n} = getObjectCallback();\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "export function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}\nfunction AboutComponent() {\n  return <div className=\"p-2\">\n      <h3>About</h3>\n    </div>;\n}\nexport { AboutComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@errorComponent.tsx",
    "content": "export function getObjectCallback() {\n  return {\n    getObject: () => ({\n      constA: 10,\n      constB: 5\n    })\n  };\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-export@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-react-memo-imported-component.tsx",
    "content": "const $$splitLoaderImporter = () => import('destructured-react-memo-imported-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('destructured-react-memo-imported-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-react-memo-imported-component@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { memo } from 'react';\nimport { importedLoader } from '../../shared/imported';\nfunction Component() {\n  return <div>Component</div>;\n}\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };\nconst SplitComponent = memo(Component);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-react-memo-imported-component@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-react-memo-imported-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-route-options-defaults.tsx",
    "content": "const $$splitLoaderImporter = () => import('destructured-route-options-defaults.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('destructured-route-options-defaults.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/about')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-route-options-defaults@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "function defaultLoader() {\n  return {\n    message: 'default'\n  };\n}\nfunction DefaultComponent() {\n  return <div>Default</div>;\n}\nconst createBits = () => ({\n  component: ActualComponent,\n  loader: () => ({\n    message: 'hello'\n  })\n});\nconst {\n  component: MyComponent = DefaultComponent,\n  loader = defaultLoader\n} = createBits();\nfunction ActualComponent() {\n  return <div>About</div>;\n}\nexport { loader };\nexport { MyComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-route-options-defaults@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructured-route-options-defaults@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring.tsx",
    "content": "import thing from 'thing'\n\nexport function test() {\n  const {\n    foo: {\n      bar: { destructured },\n    },\n  } = thing\n\n  return destructured\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import thing from 'thing';\nexport function test() {\n  const {\n    foo: {\n      bar: {\n        destructured\n      }\n    }\n  } = thing;\n  return destructured;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@errorComponent.tsx",
    "content": "import thing from 'thing';\nexport function test() {\n  const {\n    foo: {\n      bar: {\n        destructured\n      }\n    }\n  } = thing;\n  return destructured;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/destructuring@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue.tsx",
    "content": "'use client';\n\nconst $$splitComponentImporter = () => import('directive-prologue.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/directive')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "'use client';\n\nconst SplitComponent = () => {\n  return <div>directive preserved</div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/directive-prologue@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@errorComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/explicit-undefined-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound.tsx",
    "content": "console.warn(\"[tanstack-router] These exports from \\\"export-default-component-and-normal-notFound.tsx\\\" will not be code-split and will increase your bundle size:\\n- Home\\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.\");\nconst $$splitNotFoundComponentImporter = () => import('export-default-component-and-normal-notFound.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport React, { useState } from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/home')({\n  component: Home,\n  notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')\n});\nexport default function Home() {\n  const [one, setOne] = useState('this is from a state');\n  return <div>\n      <h1>{one}</h1>\n    </div>;\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';\nfunction NotFoundComponent() {\n  return <div>Not Found</div>;\n}\nexport { NotFoundComponent as notFoundComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@errorComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component-and-normal-notFound@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component.tsx",
    "content": "import React, { useState } from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/home')({\n  component: Home,\n})\n\nexport default function Home() {\n  const [one, setOne] = useState('this is from a state')\n\n  return (\n    <div>\n      <h1>{one}</h1>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@errorComponent.tsx",
    "content": "import React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/export-default-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter.tsx",
    "content": "import * as React from 'react'\n// @ts-expect-error\nimport { useMemo } from 'tan-react'\n\nconst useUsedVar = 'i-am-unused'\n\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true'\n}, [])\n\nconsole.info(ReactUseMemoCall1)\n\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true'\n}, [])\n\nconsole.info(ReactUseMemoCall2)\n\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true'\n}, [])\n\nconsole.info(UseMemoCall1)\n\nconst UseMemoCall2 = useMemo(() => {\n  return 'true'\n}, [])\n\nconsole.info(UseMemoCall2)\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\n// @ts-expect-error\nimport { useMemo } from 'tan-react';\nconst useUsedVar = 'i-am-unused';\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall1);\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall2);\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall1);\nconst UseMemoCall2 = useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall2);"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@errorComponent.tsx",
    "content": "import * as React from 'react';\n// @ts-expect-error\nimport { useMemo } from 'tan-react';\nconst useUsedVar = 'i-am-unused';\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall1);\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(ReactUseMemoCall2);\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall1);\nconst UseMemoCall2 = useMemo(() => {\n  return 'true';\n}, []);\nconsole.info(UseMemoCall2);"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-as-parameter@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration.tsx",
    "content": "const $$splitComponentImporter = () => import('function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('function-declaration.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/posts')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport { Link, Outlet } from '@tanstack/react-router';\nimport { fetchPosts } from '../posts';\nimport { Route } from \"function-declaration.tsx\";\nfunction PostsComponent() {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, {\n        id: 'i-do-not-exist',\n        title: 'Non-existent Post'\n      }]?.map(post => {\n        return <li key={post.id} className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n            postId: post.id\n          }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n            className: 'text-black font-bold'\n          }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n      })}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n}\nconst SplitLoader = fetchPosts;\nexport { SplitLoader as loader };\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@errorComponent.tsx",
    "content": "import * as React from 'react';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/function-declaration@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute.tsx",
    "content": "const $$splitComponentImporter = () => import('importAttribute.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { test } from './test' with { type: 'macro' };\nconst SplitComponent = () => test;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/importAttribute@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader.tsx",
    "content": "const $$splitLoaderImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('imported-default-component-destructured-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import importedComponent, { importedLoader } from '../../shared/imported';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };\nconst SplitComponent = importedComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component-destructured-loader@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component.tsx",
    "content": "const $$splitComponentImporter = () => import('imported-default-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import ImportedDefaultComponent from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-default-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent.tsx",
    "content": "const $$splitErrorComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=errorComponent');\nconst $$splitComponentImporter = () => import('imported-errorComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  errorComponent: lazyRouteComponent($$splitErrorComponentImporter, 'errorComponent')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import ImportedDefaultComponent from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@errorComponent.tsx",
    "content": "import { importedErrorComponent } from '../../shared/imported';\nconst SplitErrorComponent = importedErrorComponent;\nexport { SplitErrorComponent as errorComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-errorComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent.tsx",
    "content": "const $$splitNotFoundComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nconst $$splitComponentImporter = () => import('imported-notFoundComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  notFoundComponent: lazyRouteComponent($$splitNotFoundComponentImporter, 'notFoundComponent')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import ImportedDefaultComponent, { importedNotFoundComponent } from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };\nconst SplitNotFoundComponent = importedNotFoundComponent;\nexport { SplitNotFoundComponent as notFoundComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-notFoundComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent.tsx",
    "content": "const $$splitPendingComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nconst $$splitComponentImporter = () => import('imported-pendingComponent.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  pendingComponent: lazyRouteComponent($$splitPendingComponentImporter, 'pendingComponent')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import ImportedDefaultComponent, { importedPendingComponent } from '../../shared/imported';\nconst SplitComponent = ImportedDefaultComponent;\nexport { SplitComponent as component };\nconst SplitPendingComponent = importedPendingComponent;\nexport { SplitPendingComponent as pendingComponent };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported-pendingComponent@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported.tsx",
    "content": "const $$splitLoaderImporter = () => import('imported.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('imported.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { importedComponent, importedLoader } from '../../shared';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };\nconst SplitComponent = importedComponent;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/imported@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline.tsx",
    "content": "const $$splitComponentImporter = () => import('inline.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nRoute.addChildren([]);\nexport const test = 'test';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport * as styles from '../style.css';\nimport { TEST_DATA } from '../test.const';\nconst Button = (props: {\n  children: any;\n}) => {\n  return <button>{props.children}</button>;\n};\nimport { Route } from \"inline.tsx\";\nimport { test } from \"inline.tsx\";\nconst SplitComponent = () => {\n  return <div className=\"p-2\">\n        {test}\n        <h3 className={styles.indexPageTitle}>{TEST_DATA.welcome}</h3>\n        <Button>Click me</Button>\n      </div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@errorComponent.tsx",
    "content": "import * as React from 'react';\nimport { Route } from \"inline.tsx\";"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number.tsx",
    "content": "const $$splitComponentImporter = () => import('random-number.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('random-number.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { Await, Link, createFileRoute } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nexport const textColors = [`text-rose-500`, `text-yellow-500`, `text-teal-500`, `text-blue-500`];\nexport const gradients = [`from-rose-500 to-yellow-500`, `from-yellow-500 to-teal-500`, `from-teal-500 to-violet-500`, `from-blue-500 to-pink-500`];\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];\nexport const Route = createFileRoute('/')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { Await, Link, defer } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport { getSponsorsForSponsorPack } from '~/server/sponsors';\nimport discordImage from '~/images/discord-logo-white.svg';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nimport { useMutation } from '~/hooks/useMutation';\nimport { sample } from '~/utils/utils';\nimport { textColors } from \"random-number.tsx\";\nimport { gradients } from \"random-number.tsx\";\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];\nimport { Route } from \"random-number.tsx\";\nasync function bytesSignupServerFn({\n  email\n}: {\n  email: string;\n}) {\n  'use server';\n\n  return fetch(`https://bytes.dev/api/bytes-optin-cors`, {\n    method: 'POST',\n    body: JSON.stringify({\n      email,\n      influencer: 'tanstack'\n    }),\n    headers: {\n      Accept: 'application/json',\n      'Content-Type': 'application/json'\n    }\n  });\n}\nfunction Index() {\n  const bytesSignupMutation = useMutation({\n    fn: bytesSignupServerFn\n  });\n  const {\n    sponsorsPromise,\n    randomNumber,\n    testing2\n  } = Route.useLoaderData();\n  const gradient = sample(gradients, randomNumber);\n  const textColor = sample(textColors, randomNumber);\n  return <>\n      {discordImage}\n      {gradient}\n      {textColor}\n    </>;\n}\nconst SplitLoader = () => {\n  return {\n    randomNumber: Math.random(),\n    sponsorsPromise: defer(getSponsorsForSponsorPack())\n  };\n};\nexport { SplitLoader as loader };\nexport { Index as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@errorComponent.tsx",
    "content": "import { Await, Link } from '@tanstack/react-router';\nimport { Carbon } from '~/components/Carbon';\nimport { twMerge } from 'tailwind-merge';\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa';\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg';\nimport { Footer } from '~/components/Footer';\nimport SponsorPack from '~/components/SponsorPack';\nimport { LogoColor } from '~/components/LogoColor';\nimport agGridImage from '~/images/ag-grid.png';\nimport nozzleImage from '~/images/nozzle.png';\nimport bytesImage from '~/images/bytes.svg';\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png';\nconst courses = [{\n  name: 'The Official TanStack React Query Course',\n  cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n  href: 'https://query.gg/?s=tanstack',\n  description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`\n}];"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/random-number@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component.tsx",
    "content": "const $$splitLoaderImporter = () => import('react-memo-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('react-memo-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';\nimport { importedLoader } from '../../shared/imported';\nfunction Component() {\n  return <div>Component</div>;\n}\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };\nconst SplitComponent = React.memo(Component);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component.tsx",
    "content": "const $$splitLoaderImporter = () => import('react-memo-imported-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nconst $$splitComponentImporter = () => import('react-memo-imported-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import React from 'react';\nimport { importedLoader, importedComponent } from '../../shared/imported';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };\nconst SplitComponent = React.memo(importedComponent);\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/react-memo-imported-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component.tsx",
    "content": "console.warn(\"[tanstack-router] These exports from \\\"retain-export-component.tsx\\\" will not be code-split and will increase your bundle size:\\n- Layout\\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.\");\nconst $$splitLoaderImporter = () => import('retain-export-component.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute, Outlet } from '@tanstack/react-router';\nimport { importedComponent as ImportedComponent } from '../../shared/imported';\nexport function Layout() {\n  return <main>\n      <header style={{\n      height: HEADER_HEIGHT\n    }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>;\n}\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});\nconst HEADER_HEIGHT = '63px';\nexport const SIDEBAR_WIDTH = '150px';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport { importedLoader } from '../../shared/imported';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';\nconst SplitLoader = importedLoader;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@errorComponent.tsx",
    "content": "import * as React from 'react';\nconst SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-export-component@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport const loaderFn = () => {\n  return importedLoader()\n}\n\nconst Layout = () => {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n\nexport default Layout\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@errorComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-const@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst createBits = () => ({\n  component: AboutComponentImpl,\n  loader: () => ({\n    message: 'hello',\n  }),\n})\n\nexport const { component: AboutComponent, loader } = createBits()\n\nfunction AboutComponentImpl() {\n  return <div>About</div>\n}\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n  loader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "export { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-destructured@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport function loaderFn() {\n  return importedLoader()\n}\n\nfunction Layout() {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n\nexport default Layout\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@errorComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader.tsx",
    "content": "console.warn(\"[tanstack-router] These exports from \\\"retain-exports-loader.tsx\\\" will not be code-split and will increase your bundle size:\\n- loaderFn\\nFor the best optimization, these items should either have their export statements removed, or be imported from another location that is not a route file.\");\nconst $$splitComponentImporter = () => import('retain-exports-loader.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nimport * as React from 'react';\nimport { createFileRoute } from '@tanstack/react-router';\nexport function loaderFn() {\n  return {\n    foo: 'bar'\n  };\n}\nexport const Route = createFileRoute('/_layout')({\n  component: lazyRouteComponent($$splitComponentImporter, 'component'),\n  loader: loaderFn\n});\nexport const SIDEBAR_WIDTH = '150px';\nexport const SIDEBAR_MINI_WIDTH = '80px';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as React from 'react';\nimport { Outlet } from '@tanstack/react-router';\nimport { importedComponent as ImportedComponent } from '../../shared/imported';\nfunction Layout() {\n  return <main>\n      <header style={{\n      height: HEADER_HEIGHT\n    }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>;\n}\nconst HEADER_HEIGHT = '63px';\nconst ASIDE_WIDTH = '250px';\nexport { Layout as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@errorComponent.tsx",
    "content": "import * as React from 'react';\nconst ASIDE_WIDTH = '250px';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/retain-exports-loader@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-class.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-class.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nclass DataStore {\n  data = new Map();\n  get(k: string) {\n    return this.data.get(k);\n  }\n  set(k: string, v: unknown) {\n    this.data.set(k, v);\n  }\n}\nexport const Route = createFileRoute('/store')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "class DataStore {\n  data = new Map();\n  get(k: string) {\n    return this.data.get(k);\n  }\n  set(k: string, v: unknown) {\n    this.data.set(k, v);\n  }\n}\nconst store = new DataStore();\nconst SplitLoader = async () => {\n  store.set('items', await fetch('/api'));\n};\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>{store.get('items')}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@errorComponent.tsx",
    "content": "class DataStore {\n  data = new Map();\n  get(k: string) {\n    return this.data.get(k);\n  }\n  set(k: string, v: unknown) {\n    this.data.set(k, v);\n  }\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-class@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-destructured-export.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const {\n  apiUrl,\n  timeout\n} = getConfig();\nexport const Route = createFileRoute('/config')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});\nfunction getConfig() {\n  return {\n    apiUrl: '/api',\n    timeout: 5000\n  };\n}"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { apiUrl, timeout } from \"shared-destructured-export.tsx\";\nconst SplitLoader = async () => fetch(apiUrl);\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>Timeout: {timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured-export@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-destructured.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-destructured.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/config')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const {\n  apiUrl,\n  timeout\n} = getConfig();\nfunction getConfig() {\n  return {\n    apiUrl: '/api',\n    timeout: 5000\n  };\n}\nconst SplitLoader = async () => fetch(apiUrl);\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>Timeout: {timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-destructured@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-exported.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-exported.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-exported.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const queryOptions = {\n  staleTime: 5000,\n  gcTime: 10000\n};\nexport const Route = createFileRoute('/query')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-exported@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { queryOptions } from \"shared-exported.tsx\";\nconst SplitLoader = async () => {\n  return {\n    staleTime: queryOptions.staleTime\n  };\n};\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>GC: {queryOptions.gcTime}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-exported@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-exported@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-function.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/cached')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-function@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const cache = new Map();\nfunction getCached(key: string) {\n  return cache.get(key);\n}\nfunction setCached(key: string, val: unknown) {\n  cache.set(key, val);\n}\nconst SplitLoader = async () => {\n  setCached('data', await fetch('/api').then(r => r.json()));\n  return getCached('data');\n};\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>{JSON.stringify(getCached('data'))}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-function@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-imported-binding.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-imported-binding.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/imported')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { sharedUtil } from '../utils';\nconst SplitLoader = async () => sharedUtil('load');\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>{sharedUtil('render')}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-imported-binding@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-indirect-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-indirect-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/shared-indirect')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const state = {\n  count: 0\n};\nfunction getCount() {\n  return state.count;\n}\nfunction SharedComponent() {\n  return <div>\n      {getCount()} - {state.count}\n    </div>;\n}\nconst SplitLoader = () => {\n  state.count++;\n  return {\n    count: getCount()\n  };\n};\nexport { SplitLoader as loader };\nexport { SharedComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-indirect-ref@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-jsx-component-ref.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\n// @ts-nocheck\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/jsx')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "// @ts-nocheck\n\nconst shared = 1;\nfunction SharedComponent() {\n  return <div>{shared}</div>;\n}\nconst SplitLoader = () => shared;\nexport { SplitLoader as loader };\nexport { SharedComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-jsx-component-ref@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-none.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-none.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/clean')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const loaderHelper = () => fetch('/api');\nconst ComponentHelper = () => <span>helper</span>;\nconst SplitLoader = async () => loaderHelper();\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>\n      <ComponentHelper />\n    </div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-none@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-referencing-route.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-referencing-route.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/about')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const HEADER = 'Page';\nfunction usePageTitle() {\n  return `${HEADER} - ${Route.fullPath}`;\n}\nimport { Route } from \"shared-referencing-route.tsx\";\nconst SplitLoader = async () => {\n  const title = usePageTitle();\n  return {\n    title\n  };\n};\nexport { SplitLoader as loader };\nconst SplitComponent = () => {\n  const title = usePageTitle();\n  return <div>{title}</div>;\n};\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-referencing-route@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-transitive.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-transitive.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/api')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const BASE_URL = 'https://api.example.com';\nconst config = {\n  url: BASE_URL,\n  timeout: 5000\n};\nconst fetcher = (path: string) => fetch(`${config.url}${path}`);\nconst SplitLoader = async () => {\n  return fetcher('/data');\n};\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>Timeout: {config.timeout}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-transitive@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-variable.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-variable.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-variable.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/todos')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-variable@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const collection = {\n  name: 'todos',\n  preload: async () => {}\n};\nconst SplitLoader = async () => {\n  await collection.preload();\n  return {\n    data: 'loaded'\n  };\n};\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>{collection.name}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-variable@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-variable@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect.tsx",
    "content": "const $$splitComponentImporter = () => import('shared-with-side-effect.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/react-router';\nconst $$splitLoaderImporter = () => import('shared-with-side-effect.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nimport { createFileRoute } from '@tanstack/react-router';\nconsole.log('registry created');\nexport const Route = createFileRoute('/fx')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const registry = new Map();\nconst SplitLoader = async () => {\n  registry.set('loaded', true);\n};\nexport { SplitLoader as loader };\nconst SplitComponent = () => <div>{registry.size}</div>;\nexport { SplitComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/shared-with-side-effect@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/undefined-test')({\n  component: undefined,\n  errorComponent: undefined,\n  pendingComponent: undefined,\n  notFoundComponent: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/undefined-literals@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/useStateDestructure.tsx",
    "content": "import * as React from 'react'\n\nimport { CgCornerUpLeft, CgSpinner } from 'react-icons/cg'\nimport {\n  FaBolt,\n  FaBook,\n  FaCheckCircle,\n  FaCogs,\n  FaDiscord,\n  FaGithub,\n  FaTshirt,\n  FaTwitter,\n} from 'react-icons/fa'\nimport { Await, Link, getRouteApi } from '@tanstack/react-router'\nimport { Carbon } from '~/components/Carbon'\nimport { Footer } from '~/components/Footer'\nimport { VscPreview, VscWand } from 'react-icons/vsc'\nimport { TbHeartHandshake } from 'react-icons/tb'\nimport SponsorPack from '~/components/SponsorPack'\nimport { startProject } from '~/projects/start'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { Framework, getBranch } from '~/projects'\nimport { seo } from '~/utils/seo'\n\nconst menu = [\n  {\n    label: (\n      <div className=\"flex items-center gap-2\">\n        <CgCornerUpLeft className=\"text-lg\" /> TanStack\n      </div>\n    ),\n    to: '/',\n  },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <VscPreview className=\"text-lg\" /> Examples\n  //     </div>\n  //   ),\n  //   to: './docs/react/examples/basic',\n  // },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <FaBook className=\"text-lg\" /> Docs\n  //     </div>\n  //   ),\n  //   to: './docs/',\n  // },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <FaGithub className=\"text-lg\" /> GitHub\n  //     </div>\n  //   ),\n  //   to: `https://github.com/${startProject.repo}`,\n  // },\n  {\n    label: (\n      <div className=\"flex items-center gap-1\">\n        <FaDiscord className=\"text-lg\" /> Discord\n      </div>\n    ),\n    to: 'https://tlinz.com/discord',\n  },\n  {\n    label: (\n      <div className=\"flex items-center gap-1\">\n        <FaTshirt className=\"text-lg\" /> Merch\n      </div>\n    ),\n    to: `https://cottonbureau.com/people/tanstack`,\n  },\n]\n\nexport const Route = createFileRoute('/_libraries/start/$version/')({\n  component: VersionIndex,\n  meta: () =>\n    seo({\n      title: startProject.name,\n      description: startProject.description,\n    }),\n})\n\nconst librariesRouteApi = getRouteApi('/_libraries')\n\nexport default function VersionIndex() {\n  const { sponsorsPromise } = librariesRouteApi.useLoaderData()\n  const { version } = Route.useParams()\n  const branch = getBranch(startProject, version)\n  const [framework, setFramework] = React.useState<Framework>('react')\n  const [isDark, setIsDark] = React.useState(true)\n\n  React.useEffect(() => {\n    setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)\n  }, [])\n\n  const gradientText = `inline-block text-transparent bg-clip-text bg-gradient-to-r ${startProject.colorFrom} ${startProject.colorTo}`\n\n  return (\n    <div className=\"flex flex-col gap-20 md:gap-32 max-w-full\">\n      <div\n        className=\"flex flex-wrap py-2 px-4 items-center justify-center text-sm max-w-screen-xl mx-auto\n          md:text-base md:self-end\"\n      >\n        {menu?.map((item, i) => {\n          const label = (\n            <div className=\"p-2 opacity-90 hover:opacity-100\">{item.label}</div>\n          )\n\n          return (\n            <div key={i} className=\"hover:underline\">\n              {item.to.startsWith('http') ? (\n                <a href={item.to}>{label}</a>\n              ) : (\n                <Link to={item.to} params>\n                  {label}\n                </Link>\n              )}\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex flex-col items-center gap-8 text-center px-4\">\n        <div className=\"flex gap-2 lg:gap-4 items-center\">\n          <h1\n            className={`inline-block\n            font-black text-4xl\n            md:text-6xl\n            lg:text-7xl relative`}\n          >\n            <span className={gradientText}>TanStack Start</span>\n          </h1>\n        </div>\n        {/* <div className=\"absolute left-1/2 top-0 -translate-x-1/2 -translate-y-[150%]\"> */}\n        <div\n          className=\"text-sm\n            md:text-base font-black\n            lg:text-lg align-super text-white animate-bounce uppercase\n              dark:text-black bg-black dark:bg-white shadow-xl shadow-black/30 px-2 py-1 rounded-md\n              leading-none whitespace-nowrap\"\n        >\n          Coming Soon!\n          {/* {version === 'latest' ? latestVersion : version} */}\n        </div>\n        {/* </div> */}\n        <h2\n          className=\"font-bold text-2xl max-w-md\n            md:text-3xl\n            lg:text-5xl lg:max-w-2xl\"\n        >\n          Full-stack React framework{' '}\n          <span className=\"underline decoration-dashed decoration-yellow-500 decoration-3 underline-offset-2\">\n            powered by TanStack Router\n          </span>{' '}\n        </h2>\n        <p\n          className=\"text opacity-90 max-w-[500px]\n            lg:text-xl lg:max-w-[600px]\"\n        >\n          Full-document SSR, Streaming, Server Functions, bundling and more,\n          powered by <strong>TanStack Router</strong>, <strong>Nitro</strong>{' '}\n          and <strong>Vite</strong>. Ready to deploy to your favorite hosting\n          provider.\n        </p>\n      </div>\n      <div className=\"space-y-8 px-4\">\n        <div className=\"font-black text-3xl mr-1 text-center\">\n          So when can I use it?\n        </div>\n        <div className=\"max-w-full p-8 w-[800px] mx-auto leading-loose space-y-4 bg-white dark:bg-gray-700 rounded-xl shadow-xl shadow-black/10\">\n          <div>\n            <strong>TanStack Start </strong> is currently in development and is\n            not yet available for public use. We are working hard to bring you\n            the best possible experience and will be releasing more details\n            soon. In the meantime, you can follow along with the development\n            process by watching the commits on this very website!\n          </div>\n          <div>\n            Yes, you heard that right!{' '}\n            <strong>\n              TanStack.com is already being built and deployed using TanStack\n              Start\n            </strong>\n            ! We are eating our own dog food and are excited to share the\n            results with you soon!\n          </div>\n        </div>\n        <div className=\"flex items-center gap-2 flex-wrap justify-center\">\n          <a\n            href={`https://github.com/TanStack/tanstack.com`}\n            className={`flex items-center gap-2 py-2 px-4 bg-cyan-700 rounded text-white uppercase font-extrabold`}\n          >\n            <FaGithub /> View TanStack.com Source\n          </a>\n          <a\n            href={`https://twitter.com/intent/post?text=${encodeURIComponent(\n              `I'm excited for TanStack Start, new full-stack React framework coming soon from team @Tan_Stack!\n              \nCheck it out at https://tanstack.com/start/`,\n            )}`}\n            target=\"_blank\"\n            className={`flex items-center gap-2 py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}\n          >\n            <FaTwitter /> Tweet about it!\n          </a>{' '}\n        </div>\n      </div>\n      {/* <div\n        className=\"text-lg flex flex-col gap-12 p-8 max-w-[1200px] mx-auto\n                        md:flex-row\"\n      >\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <VscWand className=\"text-cyan-500 text-6xl\" />\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Built on TanStack Router\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              Writing your data fetching logic by hand is over. Tell TanStack\n              Query where to get your data and how fresh you need it to be and\n              the rest is automatic. It handles{' '}\n              <span className=\"font-semibold text-cyan-700 dark:text-cyan-400\">\n                caching, background updates and stale data out of the box with\n                zero-configuration\n              </span>\n              .\n            </p>\n          </div>\n        </div>\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <div className=\"text-center\">\n            <FaBolt className=\"text-sky-600 text-6xl\" />\n          </div>\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Simple & Familiar\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              If you know how to work with promises or async/await, then you\n              already know how to use TanStack Query. There's{' '}\n              <span className=\"font-semibold text-sky-700 dark:text-sky-400\">\n                no global state to manage, reducers, normalization systems or\n                heavy configurations to understand\n              </span>\n              . Simply pass a function that resolves your data (or throws an\n              error) and the rest is history.\n            </p>\n          </div>\n        </div>\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <div className=\"text-center\">\n            <FaCogs className=\"text-blue-500 text-6xl\" />\n          </div>\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Extensible\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              TanStack Query is configurable down to each observer instance of a\n              query with knobs and options to fit every use-case. It comes wired\n              up with{' '}\n              <span className=\"font-semibold text-blue-700 dark:text-blue-400\">\n                dedicated devtools, infinite-loading APIs, and first class\n                mutation tools that make updating your data a breeze\n              </span>\n              . Don't worry though, everything is pre-configured for success!\n            </p>\n          </div>\n        </div>\n      </div> */}\n\n      {/* <div className=\"px-4 sm:px-6 lg:px-8 mx-auto\">\n        <div className=\" sm:text-center pb-16\">\n          <h3 className=\"text-3xl text-center mx-auto leading-tight font-extrabold tracking-tight sm:text-4xl lg:leading-none mt-2\">\n            No dependencies. All the Features.\n          </h3>\n          <p className=\"mt-4 text-xl max-w-3xl mx-auto leading-7 opacity-60\">\n            With zero dependencies, TanStack Query is extremely lean given the\n            dense feature set it provides. From weekend hobbies all the way to\n            enterprise e-commerce systems (Yes, I'm lookin' at you Walmart! 😉),\n            TanStack Query is the battle-hardened tool to help you succeed at\n            the speed of your creativity.\n          </p>\n        </div>\n        <div className=\"grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-10 gap-y-4  mx-auto\">\n          {[\n            'Backend agnostic',\n            'Dedicated Devtools',\n            'Auto Caching',\n            'Auto Refetching',\n            'Window Focus Refetching',\n            'Polling/Realtime Queries',\n            'Parallel Queries',\n            'Dependent Queries',\n            'Mutations API',\n            'Automatic Garbage Collection',\n            'Paginated/Cursor Queries',\n            'Load-More/Infinite Scroll Queries',\n            'Scroll Recovery',\n            'Request Cancellation',\n            'Suspense Ready!',\n            'Render-as-you-fetch',\n            'Prefetching',\n            'Variable-length Parallel Queries',\n            'Offline Support',\n            'SSR Support',\n            'Data Selectors',\n          ].map((d, i) => {\n            return (\n              <span key={i} className=\"flex items-center gap-2\">\n                <FaCheckCircle className=\"text-green-500 \" /> {d}\n              </span>\n            )\n          })}\n        </div>\n      </div> */}\n\n      {/* <div>\n        <div className=\"uppercase tracking-wider text-sm font-semibold text-center text-gray-400 mb-3\">\n          Trusted in Production by\n        </div>\n        <marquee scrollamount=\"2\">\n          <div className=\"flex gap-2 items-center text-3xl font-bold ml-[-100%]\">\n            {(new Array(4) as string[])\n              .fill('')\n              .reduce(\n                (all) => [...all, ...all],\n                [\n                  'Google',\n                  'Walmart',\n                  'Facebook',\n                  'PayPal',\n                  'Amazon',\n                  'American Express',\n                  'Microsoft',\n                  'Target',\n                  'Ebay',\n                  'Autodesk',\n                  'CarFAX',\n                  'Docusign',\n                  'HP',\n                  'MLB',\n                  'Volvo',\n                  'Ocado',\n                  'UPC.ch',\n                  'EFI.com',\n                  'ReactBricks',\n                  'Nozzle.io',\n                  'Uber',\n                ]\n              )\n              .map((d, i) => (\n                <span key={i} className=\"opacity-70 even:opacity-40\">\n                  {d}\n                </span>\n              ))}\n          </div>\n        </marquee>\n      </div> */}\n\n      <div className=\"px-4 w-[500px] max-w-full mx-auto\">\n        <h3 className=\"text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8\">\n          Partners\n        </h3>\n        <div className=\"h-8\" />\n        <div\n          className=\"flex-1 flex flex-col items-center text-sm text-center\n                      bg-white shadow-xl shadow-gray-500/20 rounded-lg\n                        divide-y-2 divide-gray-500 divide-opacity-10 overflow-hidden\n                        dark:bg-gray-800 dark:shadow-none\"\n        >\n          <span className=\"flex items-center gap-2 p-12 text-4xl text-rose-500 font-black uppercase\">\n            Start <TbHeartHandshake /> You?\n          </span>\n          <div className=\"flex flex-col p-4 gap-4\">\n            <div>\n              We're looking for a TanStack Start OSS Partner to go above and\n              beyond the call of sponsorship. Are you as invested in TanStack\n              Start as we are? Let's push the boundaries of Start together!\n            </div>\n            <a\n              href=\"mailto:partners@tanstack.com?subject=TanStack Start Partnership\"\n              className=\"text-blue-500 uppercase font-black text-sm\"\n            >\n              Let's chat\n            </a>\n          </div>\n        </div>\n      </div>\n\n      <div className=\"relative text-lg overflow-hidden\">\n        <h3 className=\"text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8\">\n          Sponsors\n        </h3>\n        <div\n          className=\"my-4 flex flex-wrap mx-auto max-w-screen-lg\"\n          style={{\n            aspectRatio: '1/1',\n          }}\n        >\n          <Await\n            promise={sponsorsPromise}\n            fallback={<CgSpinner className=\"text-2xl animate-spin\" />}\n            children={(sponsors) => {\n              return <SponsorPack sponsors={sponsors} />\n            }}\n          />\n        </div>\n        <div className=\"text-center\">\n          <a\n            href=\"https://github.com/sponsors/tannerlinsley\"\n            className=\"inline-block bg-green-500 px-4 py-2 text-xl mx-auto leading-tight font-extrabold tracking-tight text-white rounded-full\"\n          >\n            Become a Sponsor!\n          </a>\n        </div>\n      </div>\n\n      <div className=\"mx-auto max-w-[400px] flex flex-col gap-2 items-center\">\n        <div className=\"shadow-lg rounded-lg overflow-hidden bg-white dark:bg-gray-800 dark:text-white\">\n          <Carbon />\n        </div>\n        <span\n          className=\"text-[.7rem] bg-gray-500 bg-opacity-10 py-1 px-2 rounded text-gray-500\n                dark:bg-opacity-20\"\n        >\n          This ad helps us be happy about our invested time and not burn out and\n          rage-quit OSS. Yay money! 😉\n        </span>\n      </div>\n\n      {/* <div className=\"flex flex-col gap-4\">\n        <div className=\"px-4 sm:px-6 lg:px-8  mx-auto max-w-3xl sm:text-center\">\n          <h3 className=\"text-3xl text-center leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-2\">\n            Less code, fewer edge cases.\n          </h3>\n          <p className=\"my-4 text-xl leading-7  text-gray-600\">\n            Instead of writing reducers, caching logic, timers, retry logic,\n            complex async/await scripting (I could keep going...), you literally\n            write a tiny fraction of the code you normally would. You will be\n            surprised at how little code you're writing or how much code you're\n            deleting when you use TanStack Query. Try it out with one of the\n            examples below!\n          </p>\n          <div className=\"flex flex-wrap gap-2 justify-center\">\n            {(\n              [\n                { label: 'Angular', value: 'angular' },\n                { label: 'React', value: 'react' },\n                { label: 'Solid', value: 'solid' },\n                { label: 'Svelte', value: 'svelte' },\n                { label: 'Vue', value: 'vue' },\n              ] as const\n            ).map((item) => (\n              <button\n                key={item.value}\n                className={`inline-block py-2 px-4 rounded text-white uppercase font-extrabold ${\n                  item.value === framework\n                    ? 'bg-cyan-500'\n                    : 'bg-gray-300 dark:bg-gray-700 hover:bg-cyan-300'\n                }`}\n                onClick={() => setFramework(item.value)}\n              >\n                {item.label}\n              </button>\n            ))}\n          </div>\n        </div>\n      </div> */}\n\n      {/* {[''].includes(framework) ? (\n        <div className=\"px-2\">\n          <div className=\"p-8 text-center text-lg w-full max-w-screen-lg mx-auto bg-black text-white rounded-xl\">\n            Looking for the <strong>@tanstack/{framework}-query</strong>{' '}\n            example? We could use your help to build the{' '}\n            <strong>@tanstack/{framework}-query</strong> adapter! Join the{' '}\n            <a\n              href=\"https://tlinz.com/discord\"\n              className=\"text-teal-500 font-bold\"\n            >\n              TanStack Discord Server\n            </a>{' '}\n            and let's get to work!\n          </div>\n        </div>\n      ) : (\n        <div className=\"bg-white dark:bg-black\">\n          <iframe\n            key={framework}\n            src={`https://stackblitz.com/github/${repo}/tree/${branch}/examples/${framework}/simple?embed=1&theme=${\n              isDark ? 'dark' : 'light'\n            }`}\n            title={`tannerlinsley/${framework}-query: basic`}\n            sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n            className=\"shadow-2xl\"\n            loading=\"lazy\"\n            style={{\n              width: '100%',\n              height: '80vh',\n              border: '0',\n            }}\n          ></iframe>\n        </div>\n      )} */}\n\n      {/* <div className=\"flex flex-col gap-4 items-center\">\n        <div className=\"font-extrabold text-xl lg:text-2xl\">\n          Wow, you've come a long way!\n        </div>\n        <div className=\"italic font-sm opacity-70\">\n          Only one thing left to do...\n        </div>\n        <div>\n          <Link\n            to=\"./docs/\"\n            className={`inline-block py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}\n          >\n            Read the Docs!\n          </Link>\n        </div>\n      </div> */}\n      <Footer />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/useStateDestructure@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';\nimport { VscPreview, VscWand } from 'react-icons/vsc';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/useStateDestructure@errorComponent.tsx",
    "content": "import { FaBolt, FaBook, FaCheckCircle, FaCogs } from 'react-icons/fa';\nimport { VscPreview, VscWand } from 'react-icons/vsc';"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/useStateDestructure@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/using.tsx",
    "content": "const $$splitLoaderImporter = () => import('using.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/react-router';\nexport const Route = createFileRoute({\n  loader: lazyFn($$splitLoaderImporter, 'loader')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/using@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "const DummyPostResource = (postId: string) => ({\n  postData: {\n    id: postId,\n    title: 'dummy',\n    body: 'dummy'\n  },\n  [Symbol.dispose]: () => console.log('disposing!')\n});\nconst SplitLoader = ({\n  params: {\n    postId\n  }\n}) => {\n  using dummyPost = DummyPostResource(postId);\n  return dummyPost.postData;\n};\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/using@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/using@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component');\nimport { lazyRouteComponent } from '@tanstack/solid-router';\nimport { createFileRoute } from '@tanstack/solid-router';\nimport { fetchPosts } from '../posts';\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/arrow-function@component.tsx",
    "content": "import * as Solid from 'solid-js';\nimport { Link, Outlet } from '@tanstack/solid-router';\nimport { Route } from \"arrow-function.tsx\";\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        <Solid.For each={posts()}>\n          {post => {\n          return <li className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n              postId: post.id\n            }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n              className: 'text-black font-bold'\n            }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n        }}\n        </Solid.For>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n};\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/arrow-function@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/arrow-function@notFoundComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/1-default/arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component---errorComponent---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/solid-router';\nconst $$splitLoaderImporter = () => import('arrow-function.tsx?tsr-split=loader');\nimport { lazyFn } from '@tanstack/solid-router';\nimport { createFileRoute } from '@tanstack/solid-router';\nexport const Route = createFileRoute('/posts')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/arrow-function@component---errorComponent---notFoundComponent---pendingComponent.tsx",
    "content": "import * as Solid from 'solid-js';\nimport { Link, Outlet } from '@tanstack/solid-router';\nimport { Route } from \"arrow-function.tsx\";\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        <Solid.For each={posts()}>\n          {post => {\n          return <li className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n              postId: post.id\n            }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n              className: 'text-black font-bold'\n            }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n        }}\n        </Solid.For>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n};\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/arrow-function@loader.tsx",
    "content": "import { fetchPosts } from '../posts';\nconst SplitLoader = fetchPosts;\nexport { SplitLoader as loader };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/2-components-combined-loader-separate/arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/arrow-function.tsx",
    "content": "const $$splitComponentImporter = () => import('arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyRouteComponent } from '@tanstack/solid-router';\nconst $$splitLoaderImporter = () => import('arrow-function.tsx?tsr-split=component---loader---notFoundComponent---pendingComponent');\nimport { lazyFn } from '@tanstack/solid-router';\nimport { createFileRoute } from '@tanstack/solid-router';\nexport const Route = createFileRoute('/posts')({\n  loader: lazyFn($$splitLoaderImporter, 'loader'),\n  component: lazyRouteComponent($$splitComponentImporter, 'component')\n});"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/arrow-function@component---loader---notFoundComponent---pendingComponent.tsx",
    "content": "import * as Solid from 'solid-js';\nimport { Link, Outlet } from '@tanstack/solid-router';\nimport { fetchPosts } from '../posts';\nimport { Route } from \"arrow-function.tsx\";\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData();\n  return <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        <Solid.For each={posts()}>\n          {post => {\n          return <li className=\"whitespace-nowrap\">\n                <Link to=\"/posts/$postId\" params={{\n              postId: post.id\n            }} className=\"block py-1 text-blue-800 hover:text-blue-600\" activeProps={{\n              className: 'text-black font-bold'\n            }}>\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>;\n        }}\n        </Solid.For>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>;\n};\nconst SplitLoader = fetchPosts;\nexport { SplitLoader as loader };\nexport { PostsComponent as component };"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/arrow-function@errorComponent.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/snapshots/solid/3-all-combined-errorComponent-separate/arrow-function@shared.tsx",
    "content": ""
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/arrow-function.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }]?.map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/boolean-null-literals.tsx",
    "content": "import { createFileRoute } from '@tanstack/router'\n\n// Test errorComponent with false literal\nexport const Route = createFileRoute('/test')({\n  component: () => <div>Test Component</div>,\n  errorComponent: false,\n  pendingComponent: null,\n  loader: async () => ({ data: 'test' }),\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/chinese.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomeComponent,\n})\n\nfunction HomeComponent() {\n  return (\n    <div className=\"p-2\">\n      <Demo title=\"标题很好看，谁说不是呢？\" />\n      <Demo title=\"The title looks great, who can deny that?\" />\n    </div>\n  )\n}\n\ninterface DemoProps {\n  title: string\n}\n\nfunction Demo({ title }: DemoProps) {\n  return (\n    <h1\n      style={{\n        color: '#2969ff',\n        fontSize: '2rem',\n        fontWeight: 'bold',\n        letterSpacing: '3px',\n      }}\n    >\n      {title}\n    </h1>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/circular-reference-arrow-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nfunction getComponentName(obj: Record<string, unknown>): string {\n  return Object.keys(obj)[0]\n}\n\nconst App = () => {\n  const componentName = getComponentName({ App })\n\n  return (\n    <div>\n      Component Name is {componentName}\n      <OtherComponent />\n    </div>\n  )\n}\n\nfunction OtherComponent() {\n  const componentName = getComponentName({ App })\n  return <div>App component name is {componentName}</div>\n}\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/circular-reference-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nfunction getComponentName(obj: Record<string, unknown>): string {\n  return Object.keys(obj)[0]\n}\n\nfunction App() {\n  const componentName = getComponentName({ App })\n\n  return (\n    <div>\n      Component Name is {componentName}\n      <OtherComponent />\n    </div>\n  )\n}\n\nfunction OtherComponent() {\n  const componentName = getComponentName({ App })\n  return <div>App component name is {componentName}</div>\n}\n\nexport const Route = createFileRoute('/')({\n  component: App,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/conditional-properties.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { isEnabled } from '@features/feature-flags'\nimport TrueImport from '@modules/true-component'\nimport { FalseComponent, falseLoader } from '@modules/false-component'\n\nexport const Route = createFileRoute('/posts')({\n  component: isEnabled ? TrueImport.Component : FalseComponent,\n  loader: isEnabled ? TrueImport.loader : falseLoader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/destructured-export-multiple.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const getConfig = () => ({\n  baseUrl: 'https://api.example.com',\n  timeout: 5000,\n})\n\nexport const { baseUrl, timeout } = getConfig()\n\nexport const [first, second] = [1, 2]\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div>\n      <p>Base URL: {baseUrl}</p>\n      <p>Timeout: {timeout}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/destructured-export-nested.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst getConfig = () => ({\n  api: {\n    baseUrl: 'https://api.example.com',\n  },\n  timeout: 5000,\n  extra: 'data',\n})\n\nexport const {\n  api: { baseUrl },\n  ...rest\n} = getConfig()\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div>\n      <p>Base URL: {baseUrl}</p>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/destructured-export.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport function getObjectCallback() {\n  return { getObject: () => ({ constA: 10, constB: 5 }) }\n}\n\nexport const { getObject } = getObjectCallback()\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n})\n\nfunction AboutComponent() {\n  return (\n    <div className=\"p-2\">\n      <h3>About</h3>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/destructured-react-memo-imported-component.tsx",
    "content": "import { memo } from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { importedLoader } from '../../shared/imported'\n\nexport const Route = createFileRoute('/')({\n  component: memo(Component),\n  loader: importedLoader,\n})\n\nfunction Component() {\n  return <div>Component</div>\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/destructured-route-options-defaults.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nfunction defaultLoader() {\n  return { message: 'default' }\n}\n\nfunction DefaultComponent() {\n  return <div>Default</div>\n}\n\nconst createBits = () => ({\n  component: ActualComponent,\n  loader: () => ({\n    message: 'hello',\n  }),\n})\n\nconst { component: MyComponent = DefaultComponent, loader = defaultLoader } =\n  createBits()\n\nfunction ActualComponent() {\n  return <div>About</div>\n}\n\nexport const Route = createFileRoute('/about')({\n  component: MyComponent,\n  loader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/destructuring.tsx",
    "content": "import thing from 'thing'\n\nexport function test() {\n  const {\n    foo: {\n      bar: { destructured },\n    },\n  } = thing\n\n  return destructured\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/directive-prologue.tsx",
    "content": "'use client'\n\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/directive')({\n  component: () => {\n    return <div>directive preserved</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/explicit-undefined-component.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  component: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/export-default-component-and-normal-notFound.tsx",
    "content": "import React, { useState } from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/home')({\n  component: Home,\n  notFoundComponent: NotFoundComponent,\n})\n\nfunction NotFoundComponent() {\n  return <div>Not Found</div>\n}\n\nexport default function Home() {\n  const [one, setOne] = useState('this is from a state')\n\n  return (\n    <div>\n      <h1>{one}</h1>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/export-default-component.tsx",
    "content": "import React, { useState } from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/home')({\n  component: Home,\n})\n\nexport default function Home() {\n  const [one, setOne] = useState('this is from a state')\n\n  return (\n    <div>\n      <h1>{one}</h1>\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/function-as-parameter.tsx",
    "content": "import * as React from 'react'\n// @ts-expect-error\nimport { useMemo } from 'tan-react'\n\nconst useUsedVar = 'i-am-unused'\n\nconst ReactUseMemoCall1 = React.useMemo(function performAction() {\n  return 'true'\n}, [])\n\nconsole.info(ReactUseMemoCall1)\n\nconst ReactUseMemoCall2 = React.useMemo(() => {\n  return 'true'\n}, [])\n\nconsole.info(ReactUseMemoCall2)\n\nconst UseMemoCall1 = useMemo(function performAction() {\n  return 'true'\n}, [])\n\nconsole.info(UseMemoCall1)\n\nconst UseMemoCall2 = useMemo(() => {\n  return 'true'\n}, [])\n\nconsole.info(UseMemoCall2)\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/function-declaration.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Link, Outlet } from '@tanstack/react-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nfunction PostsComponent() {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }]?.map(\n          (post) => {\n            return (\n              <li key={post.id} className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          },\n        )}\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/importAttribute.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport { test } from './test' with { type: 'macro' }\n\nexport const Route = createFileRoute('/')({\n  component: () => test,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/imported-default-component-destructured-loader.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport importedComponent, { importedLoader } from '../../shared/imported'\n\nexport const Route = createFileRoute('/')({\n  component: importedComponent,\n  loader: importedLoader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/imported-default-component.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport ImportedDefaultComponent from '../../shared/imported'\n\nexport const Route = createFileRoute('/')({\n  component: ImportedDefaultComponent,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/imported-errorComponent.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport ImportedDefaultComponent, {\n  importedErrorComponent,\n} from '../../shared/imported'\n\nexport const Route = createFileRoute('/')({\n  component: ImportedDefaultComponent,\n  errorComponent: importedErrorComponent,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/imported-notFoundComponent.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport ImportedDefaultComponent, {\n  importedNotFoundComponent,\n} from '../../shared/imported'\n\nexport const Route = createFileRoute('/')({\n  component: ImportedDefaultComponent,\n  notFoundComponent: importedNotFoundComponent,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/imported-pendingComponent.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport ImportedDefaultComponent, {\n  importedPendingComponent,\n} from '../../shared/imported'\n\nexport const Route = createFileRoute('/')({\n  component: ImportedDefaultComponent,\n  pendingComponent: importedPendingComponent,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/imported.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nimport { importedComponent, importedLoader } from '../../shared'\n\nexport const Route = createFileRoute('/')({\n  component: importedComponent,\n  loader: importedLoader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/inline.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport * as styles from '../style.css'\nimport { TEST_DATA } from '../test.const'\n\nconst Button = (props: { children: any }) => {\n  return <button>{props.children}</button>\n}\n\nexport const Route = createFileRoute('/')({\n  component: () => {\n    return (\n      <div className=\"p-2\">\n        {test}\n        <h3 className={styles.indexPageTitle}>{TEST_DATA.welcome}</h3>\n        <Button>Click me</Button>\n      </div>\n    )\n  },\n})\n\nRoute.addChildren([])\n\nexport const test = 'test'\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/random-number.tsx",
    "content": "import { Await, Link, createFileRoute, defer } from '@tanstack/react-router'\nimport { Carbon } from '~/components/Carbon'\nimport { twMerge } from 'tailwind-merge'\nimport { FaDiscord, FaGithub, FaTshirt } from 'react-icons/fa'\nimport { CgMusicSpeaker, CgSpinner } from 'react-icons/cg'\nimport { Footer } from '~/components/Footer'\nimport SponsorPack from '~/components/SponsorPack'\nimport { LogoColor } from '~/components/LogoColor'\nimport { getSponsorsForSponsorPack } from '~/server/sponsors'\nimport discordImage from '~/images/discord-logo-white.svg'\nimport agGridImage from '~/images/ag-grid.png'\nimport nozzleImage from '~/images/nozzle.png'\nimport bytesImage from '~/images/bytes.svg'\nimport bytesUidotdevImage from '~/images/bytes-uidotdev.png'\nimport { useMutation } from '~/hooks/useMutation'\nimport { sample } from '~/utils/utils'\n\nexport const textColors = [\n  `text-rose-500`,\n  `text-yellow-500`,\n  `text-teal-500`,\n  `text-blue-500`,\n]\n\nexport const gradients = [\n  `from-rose-500 to-yellow-500`,\n  `from-yellow-500 to-teal-500`,\n  `from-teal-500 to-violet-500`,\n  `from-blue-500 to-pink-500`,\n]\n\nconst courses = [\n  {\n    name: 'The Official TanStack React Query Course',\n    cardStyles: `border-t-4 border-red-500 hover:(border-green-500)`,\n    href: 'https://query.gg/?s=tanstack',\n    description: `Learn how to build enterprise quality apps with TanStack's React Query the easy way with our brand new course.`,\n  },\n]\n\nexport const Route = createFileRoute('/')({\n  loader: () => {\n    return {\n      randomNumber: Math.random(),\n      sponsorsPromise: defer(getSponsorsForSponsorPack()),\n    }\n  },\n  component: Index,\n})\n\nasync function bytesSignupServerFn({ email }: { email: string }) {\n  'use server'\n\n  return fetch(`https://bytes.dev/api/bytes-optin-cors`, {\n    method: 'POST',\n    body: JSON.stringify({\n      email,\n      influencer: 'tanstack',\n    }),\n    headers: {\n      Accept: 'application/json',\n      'Content-Type': 'application/json',\n    },\n  })\n}\n\nfunction Index() {\n  const bytesSignupMutation = useMutation({\n    fn: bytesSignupServerFn,\n  })\n\n  const { sponsorsPromise, randomNumber, testing2 } = Route.useLoaderData()\n  const gradient = sample(gradients, randomNumber)\n  const textColor = sample(textColors, randomNumber)\n\n  return (\n    <>\n      {discordImage}\n      {gradient}\n      {textColor}\n    </>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/react-memo-component.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { importedLoader } from '../../shared/imported'\n\nexport const Route = createFileRoute('/')({\n  component: React.memo(Component),\n  loader: importedLoader,\n})\n\nfunction Component() {\n  return <div>Component</div>\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/react-memo-imported-component.tsx",
    "content": "import React from 'react'\nimport { createFileRoute } from '@tanstack/react-router'\n\nimport { importedLoader, importedComponent } from '../../shared/imported'\n\nexport const Route = createFileRoute('/')({\n  component: React.memo(importedComponent),\n  loader: importedLoader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/retain-export-component.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport function Layout() {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: importedLoader,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nconst SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/retain-exports-const.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport const loaderFn = () => {\n  return importedLoader()\n}\n\nconst Layout = () => {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n\nexport default Layout\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/retain-exports-destructured.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst createBits = () => ({\n  component: AboutComponentImpl,\n  loader: () => ({\n    message: 'hello',\n  }),\n})\n\nexport const { component: AboutComponent, loader } = createBits()\n\nfunction AboutComponentImpl() {\n  return <div>About</div>\n}\n\nexport const Route = createFileRoute('/about')({\n  component: AboutComponent,\n  loader,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/retain-exports-function.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport {\n  importedComponent as ImportedComponent,\n  importedLoader,\n} from '../../shared/imported'\n\nexport function loaderFn() {\n  return importedLoader()\n}\n\nfunction Layout() {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n\nexport default Layout\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/retain-exports-loader.tsx",
    "content": "import * as React from 'react'\nimport { createFileRoute, Outlet } from '@tanstack/react-router'\nimport { importedComponent as ImportedComponent } from '../../shared/imported'\n\nexport function loaderFn() {\n  return { foo: 'bar' }\n}\n\nfunction Layout() {\n  return (\n    <main>\n      <header style={{ height: HEADER_HEIGHT }}>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/\">Home</a>\n            </li>\n          </ul>\n        </nav>\n      </header>\n      <ImportedComponent />\n      <Outlet />\n    </main>\n  )\n}\n\nexport const Route = createFileRoute('/_layout')({\n  component: Layout,\n  loader: loaderFn,\n})\n\nconst HEADER_HEIGHT = '63px'\nexport const SIDEBAR_WIDTH = '150px'\nexport const SIDEBAR_MINI_WIDTH = '80px'\nconst ASIDE_WIDTH = '250px'\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-class.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nclass DataStore {\n  data = new Map()\n  get(k: string) {\n    return this.data.get(k)\n  }\n  set(k: string, v: unknown) {\n    this.data.set(k, v)\n  }\n}\nconst store = new DataStore()\n\nexport const Route = createFileRoute('/store')({\n  loader: async () => {\n    store.set('items', await fetch('/api'))\n  },\n  component: () => <div>{store.get('items')}</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-destructured-export.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const { apiUrl, timeout } = getConfig()\n\nexport const Route = createFileRoute('/config')({\n  loader: async () => fetch(apiUrl),\n  component: () => <div>Timeout: {timeout}</div>,\n})\n\nfunction getConfig() {\n  return { apiUrl: '/api', timeout: 5000 }\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-destructured.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst { apiUrl, timeout } = getConfig()\n\nexport const Route = createFileRoute('/config')({\n  loader: async () => fetch(apiUrl),\n  component: () => <div>Timeout: {timeout}</div>,\n})\n\nfunction getConfig() {\n  return { apiUrl: '/api', timeout: 5000 }\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-exported.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const queryOptions = { staleTime: 5000, gcTime: 10000 }\n\nexport const Route = createFileRoute('/query')({\n  loader: async () => {\n    return { staleTime: queryOptions.staleTime }\n  },\n  component: () => <div>GC: {queryOptions.gcTime}</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst cache = new Map()\nfunction getCached(key: string) {\n  return cache.get(key)\n}\nfunction setCached(key: string, val: unknown) {\n  cache.set(key, val)\n}\n\nexport const Route = createFileRoute('/cached')({\n  loader: async () => {\n    setCached('data', await fetch('/api').then((r) => r.json()))\n    return getCached('data')\n  },\n  component: () => <div>{JSON.stringify(getCached('data'))}</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-imported-binding.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport { sharedUtil } from '../utils'\n\nexport const Route = createFileRoute('/imported')({\n  loader: async () => sharedUtil('load'),\n  component: () => <div>{sharedUtil('render')}</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-indirect-ref.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst state = { count: 0 }\n\nfunction getCount() {\n  return state.count\n}\n\nexport const Route = createFileRoute('/shared-indirect')({\n  loader: () => {\n    state.count++\n    return { count: getCount() }\n  },\n  component: SharedComponent,\n})\n\nfunction SharedComponent() {\n  return (\n    <div>\n      {getCount()} - {state.count}\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-jsx-component-ref.tsx",
    "content": "// @ts-nocheck\nimport { createFileRoute } from '@tanstack/react-router'\n\nconst shared = 1\n\nfunction SharedComponent() {\n  return <div>{shared}</div>\n}\n\nexport const Route = createFileRoute('/jsx')({\n  loader: () => shared,\n  component: SharedComponent,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-none.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst loaderHelper = () => fetch('/api')\nconst ComponentHelper = () => <span>helper</span>\n\nexport const Route = createFileRoute('/clean')({\n  loader: async () => loaderHelper(),\n  component: () => (\n    <div>\n      <ComponentHelper />\n    </div>\n  ),\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-referencing-route.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst HEADER = 'Page'\n\nfunction usePageTitle() {\n  return `${HEADER} - ${Route.fullPath}`\n}\n\nexport const Route = createFileRoute('/about')({\n  loader: async () => {\n    const title = usePageTitle()\n    return { title }\n  },\n  component: () => {\n    const title = usePageTitle()\n    return <div>{title}</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-transitive.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst BASE_URL = 'https://api.example.com'\nconst config = { url: BASE_URL, timeout: 5000 }\nconst fetcher = (path: string) => fetch(`${config.url}${path}`)\n\nexport const Route = createFileRoute('/api')({\n  loader: async () => {\n    return fetcher('/data')\n  },\n  component: () => <div>Timeout: {config.timeout}</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-variable.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst collection = { name: 'todos', preload: async () => {} }\n\nexport const Route = createFileRoute('/todos')({\n  loader: async () => {\n    await collection.preload()\n    return { data: 'loaded' }\n  },\n  component: () => <div>{collection.name}</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/shared-with-side-effect.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nconst registry = new Map()\nconsole.log('registry created')\n\nexport const Route = createFileRoute('/fx')({\n  loader: async () => {\n    registry.set('loaded', true)\n  },\n  component: () => <div>{registry.size}</div>,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/undefined-literals.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/undefined-test')({\n  component: undefined,\n  errorComponent: undefined,\n  pendingComponent: undefined,\n  notFoundComponent: undefined,\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/useStateDestructure.tsx",
    "content": "import * as React from 'react'\n\nimport { CgCornerUpLeft, CgSpinner } from 'react-icons/cg'\nimport {\n  FaBolt,\n  FaBook,\n  FaCheckCircle,\n  FaCogs,\n  FaDiscord,\n  FaGithub,\n  FaTshirt,\n  FaTwitter,\n} from 'react-icons/fa'\nimport { Await, Link, getRouteApi } from '@tanstack/react-router'\nimport { Carbon } from '~/components/Carbon'\nimport { Footer } from '~/components/Footer'\nimport { VscPreview, VscWand } from 'react-icons/vsc'\nimport { TbHeartHandshake } from 'react-icons/tb'\nimport SponsorPack from '~/components/SponsorPack'\nimport { startProject } from '~/projects/start'\nimport { createFileRoute } from '@tanstack/react-router'\nimport { Framework, getBranch } from '~/projects'\nimport { seo } from '~/utils/seo'\n\nconst menu = [\n  {\n    label: (\n      <div className=\"flex items-center gap-2\">\n        <CgCornerUpLeft className=\"text-lg\" /> TanStack\n      </div>\n    ),\n    to: '/',\n  },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <VscPreview className=\"text-lg\" /> Examples\n  //     </div>\n  //   ),\n  //   to: './docs/react/examples/basic',\n  // },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <FaBook className=\"text-lg\" /> Docs\n  //     </div>\n  //   ),\n  //   to: './docs/',\n  // },\n  // {\n  //   label: (\n  //     <div className=\"flex items-center gap-1\">\n  //       <FaGithub className=\"text-lg\" /> GitHub\n  //     </div>\n  //   ),\n  //   to: `https://github.com/${startProject.repo}`,\n  // },\n  {\n    label: (\n      <div className=\"flex items-center gap-1\">\n        <FaDiscord className=\"text-lg\" /> Discord\n      </div>\n    ),\n    to: 'https://tlinz.com/discord',\n  },\n  {\n    label: (\n      <div className=\"flex items-center gap-1\">\n        <FaTshirt className=\"text-lg\" /> Merch\n      </div>\n    ),\n    to: `https://cottonbureau.com/people/tanstack`,\n  },\n]\n\nexport const Route = createFileRoute('/_libraries/start/$version/')({\n  component: VersionIndex,\n  meta: () =>\n    seo({\n      title: startProject.name,\n      description: startProject.description,\n    }),\n})\n\nconst librariesRouteApi = getRouteApi('/_libraries')\n\nexport default function VersionIndex() {\n  const { sponsorsPromise } = librariesRouteApi.useLoaderData()\n  const { version } = Route.useParams()\n  const branch = getBranch(startProject, version)\n  const [framework, setFramework] = React.useState<Framework>('react')\n  const [isDark, setIsDark] = React.useState(true)\n\n  React.useEffect(() => {\n    setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)\n  }, [])\n\n  const gradientText = `inline-block text-transparent bg-clip-text bg-gradient-to-r ${startProject.colorFrom} ${startProject.colorTo}`\n\n  return (\n    <div className=\"flex flex-col gap-20 md:gap-32 max-w-full\">\n      <div\n        className=\"flex flex-wrap py-2 px-4 items-center justify-center text-sm max-w-screen-xl mx-auto\n          md:text-base md:self-end\"\n      >\n        {menu?.map((item, i) => {\n          const label = (\n            <div className=\"p-2 opacity-90 hover:opacity-100\">{item.label}</div>\n          )\n\n          return (\n            <div key={i} className=\"hover:underline\">\n              {item.to.startsWith('http') ? (\n                <a href={item.to}>{label}</a>\n              ) : (\n                <Link to={item.to} params>\n                  {label}\n                </Link>\n              )}\n            </div>\n          )\n        })}\n      </div>\n      <div className=\"flex flex-col items-center gap-8 text-center px-4\">\n        <div className=\"flex gap-2 lg:gap-4 items-center\">\n          <h1\n            className={`inline-block\n            font-black text-4xl\n            md:text-6xl\n            lg:text-7xl relative`}\n          >\n            <span className={gradientText}>TanStack Start</span>\n          </h1>\n        </div>\n        {/* <div className=\"absolute left-1/2 top-0 -translate-x-1/2 -translate-y-[150%]\"> */}\n        <div\n          className=\"text-sm\n            md:text-base font-black\n            lg:text-lg align-super text-white animate-bounce uppercase\n              dark:text-black bg-black dark:bg-white shadow-xl shadow-black/30 px-2 py-1 rounded-md\n              leading-none whitespace-nowrap\"\n        >\n          Coming Soon!\n          {/* {version === 'latest' ? latestVersion : version} */}\n        </div>\n        {/* </div> */}\n        <h2\n          className=\"font-bold text-2xl max-w-md\n            md:text-3xl\n            lg:text-5xl lg:max-w-2xl\"\n        >\n          Full-stack React framework{' '}\n          <span className=\"underline decoration-dashed decoration-yellow-500 decoration-3 underline-offset-2\">\n            powered by TanStack Router\n          </span>{' '}\n        </h2>\n        <p\n          className=\"text opacity-90 max-w-[500px]\n            lg:text-xl lg:max-w-[600px]\"\n        >\n          Full-document SSR, Streaming, Server Functions, bundling and more,\n          powered by <strong>TanStack Router</strong>, <strong>Nitro</strong>{' '}\n          and <strong>Vite</strong>. Ready to deploy to your favorite hosting\n          provider.\n        </p>\n      </div>\n      <div className=\"space-y-8 px-4\">\n        <div className=\"font-black text-3xl mr-1 text-center\">\n          So when can I use it?\n        </div>\n        <div className=\"max-w-full p-8 w-[800px] mx-auto leading-loose space-y-4 bg-white dark:bg-gray-700 rounded-xl shadow-xl shadow-black/10\">\n          <div>\n            <strong>TanStack Start </strong> is currently in development and is\n            not yet available for public use. We are working hard to bring you\n            the best possible experience and will be releasing more details\n            soon. In the meantime, you can follow along with the development\n            process by watching the commits on this very website!\n          </div>\n          <div>\n            Yes, you heard that right!{' '}\n            <strong>\n              TanStack.com is already being built and deployed using TanStack\n              Start\n            </strong>\n            ! We are eating our own dog food and are excited to share the\n            results with you soon!\n          </div>\n        </div>\n        <div className=\"flex items-center gap-2 flex-wrap justify-center\">\n          <a\n            href={`https://github.com/TanStack/tanstack.com`}\n            className={`flex items-center gap-2 py-2 px-4 bg-cyan-700 rounded text-white uppercase font-extrabold`}\n          >\n            <FaGithub /> View TanStack.com Source\n          </a>\n          <a\n            href={`https://twitter.com/intent/post?text=${encodeURIComponent(\n              `I'm excited for TanStack Start, new full-stack React framework coming soon from team @Tan_Stack!\n              \nCheck it out at https://tanstack.com/start/`,\n            )}`}\n            target=\"_blank\"\n            className={`flex items-center gap-2 py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}\n          >\n            <FaTwitter /> Tweet about it!\n          </a>{' '}\n        </div>\n      </div>\n      {/* <div\n        className=\"text-lg flex flex-col gap-12 p-8 max-w-[1200px] mx-auto\n                        md:flex-row\"\n      >\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <VscWand className=\"text-cyan-500 text-6xl\" />\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Built on TanStack Router\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              Writing your data fetching logic by hand is over. Tell TanStack\n              Query where to get your data and how fresh you need it to be and\n              the rest is automatic. It handles{' '}\n              <span className=\"font-semibold text-cyan-700 dark:text-cyan-400\">\n                caching, background updates and stale data out of the box with\n                zero-configuration\n              </span>\n              .\n            </p>\n          </div>\n        </div>\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <div className=\"text-center\">\n            <FaBolt className=\"text-sky-600 text-6xl\" />\n          </div>\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Simple & Familiar\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              If you know how to work with promises or async/await, then you\n              already know how to use TanStack Query. There's{' '}\n              <span className=\"font-semibold text-sky-700 dark:text-sky-400\">\n                no global state to manage, reducers, normalization systems or\n                heavy configurations to understand\n              </span>\n              . Simply pass a function that resolves your data (or throws an\n              error) and the rest is history.\n            </p>\n          </div>\n        </div>\n        <div className=\"flex-1 flex flex-col gap-8 items-center\">\n          <div className=\"text-center\">\n            <FaCogs className=\"text-blue-500 text-6xl\" />\n          </div>\n          <div className=\"flex flex-col gap-4\">\n            <h3 className=\"uppercase text-center text-xl font-black\">\n              Extensible\n            </h3>\n            <p className=\"text-sm text-gray-800 dark:text-gray-200 leading-6\">\n              TanStack Query is configurable down to each observer instance of a\n              query with knobs and options to fit every use-case. It comes wired\n              up with{' '}\n              <span className=\"font-semibold text-blue-700 dark:text-blue-400\">\n                dedicated devtools, infinite-loading APIs, and first class\n                mutation tools that make updating your data a breeze\n              </span>\n              . Don't worry though, everything is pre-configured for success!\n            </p>\n          </div>\n        </div>\n      </div> */}\n\n      {/* <div className=\"px-4 sm:px-6 lg:px-8 mx-auto\">\n        <div className=\" sm:text-center pb-16\">\n          <h3 className=\"text-3xl text-center mx-auto leading-tight font-extrabold tracking-tight sm:text-4xl lg:leading-none mt-2\">\n            No dependencies. All the Features.\n          </h3>\n          <p className=\"mt-4 text-xl max-w-3xl mx-auto leading-7 opacity-60\">\n            With zero dependencies, TanStack Query is extremely lean given the\n            dense feature set it provides. From weekend hobbies all the way to\n            enterprise e-commerce systems (Yes, I'm lookin' at you Walmart! 😉),\n            TanStack Query is the battle-hardened tool to help you succeed at\n            the speed of your creativity.\n          </p>\n        </div>\n        <div className=\"grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-10 gap-y-4  mx-auto\">\n          {[\n            'Backend agnostic',\n            'Dedicated Devtools',\n            'Auto Caching',\n            'Auto Refetching',\n            'Window Focus Refetching',\n            'Polling/Realtime Queries',\n            'Parallel Queries',\n            'Dependent Queries',\n            'Mutations API',\n            'Automatic Garbage Collection',\n            'Paginated/Cursor Queries',\n            'Load-More/Infinite Scroll Queries',\n            'Scroll Recovery',\n            'Request Cancellation',\n            'Suspense Ready!',\n            'Render-as-you-fetch',\n            'Prefetching',\n            'Variable-length Parallel Queries',\n            'Offline Support',\n            'SSR Support',\n            'Data Selectors',\n          ].map((d, i) => {\n            return (\n              <span key={i} className=\"flex items-center gap-2\">\n                <FaCheckCircle className=\"text-green-500 \" /> {d}\n              </span>\n            )\n          })}\n        </div>\n      </div> */}\n\n      {/* <div>\n        <div className=\"uppercase tracking-wider text-sm font-semibold text-center text-gray-400 mb-3\">\n          Trusted in Production by\n        </div>\n        <marquee scrollamount=\"2\">\n          <div className=\"flex gap-2 items-center text-3xl font-bold ml-[-100%]\">\n            {(new Array(4) as string[])\n              .fill('')\n              .reduce(\n                (all) => [...all, ...all],\n                [\n                  'Google',\n                  'Walmart',\n                  'Facebook',\n                  'PayPal',\n                  'Amazon',\n                  'American Express',\n                  'Microsoft',\n                  'Target',\n                  'Ebay',\n                  'Autodesk',\n                  'CarFAX',\n                  'Docusign',\n                  'HP',\n                  'MLB',\n                  'Volvo',\n                  'Ocado',\n                  'UPC.ch',\n                  'EFI.com',\n                  'ReactBricks',\n                  'Nozzle.io',\n                  'Uber',\n                ]\n              )\n              .map((d, i) => (\n                <span key={i} className=\"opacity-70 even:opacity-40\">\n                  {d}\n                </span>\n              ))}\n          </div>\n        </marquee>\n      </div> */}\n\n      <div className=\"px-4 w-[500px] max-w-full mx-auto\">\n        <h3 className=\"text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8\">\n          Partners\n        </h3>\n        <div className=\"h-8\" />\n        <div\n          className=\"flex-1 flex flex-col items-center text-sm text-center\n                      bg-white shadow-xl shadow-gray-500/20 rounded-lg\n                        divide-y-2 divide-gray-500 divide-opacity-10 overflow-hidden\n                        dark:bg-gray-800 dark:shadow-none\"\n        >\n          <span className=\"flex items-center gap-2 p-12 text-4xl text-rose-500 font-black uppercase\">\n            Start <TbHeartHandshake /> You?\n          </span>\n          <div className=\"flex flex-col p-4 gap-4\">\n            <div>\n              We're looking for a TanStack Start OSS Partner to go above and\n              beyond the call of sponsorship. Are you as invested in TanStack\n              Start as we are? Let's push the boundaries of Start together!\n            </div>\n            <a\n              href=\"mailto:partners@tanstack.com?subject=TanStack Start Partnership\"\n              className=\"text-blue-500 uppercase font-black text-sm\"\n            >\n              Let's chat\n            </a>\n          </div>\n        </div>\n      </div>\n\n      <div className=\"relative text-lg overflow-hidden\">\n        <h3 className=\"text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8\">\n          Sponsors\n        </h3>\n        <div\n          className=\"my-4 flex flex-wrap mx-auto max-w-screen-lg\"\n          style={{\n            aspectRatio: '1/1',\n          }}\n        >\n          <Await\n            promise={sponsorsPromise}\n            fallback={<CgSpinner className=\"text-2xl animate-spin\" />}\n            children={(sponsors) => {\n              return <SponsorPack sponsors={sponsors} />\n            }}\n          />\n        </div>\n        <div className=\"text-center\">\n          <a\n            href=\"https://github.com/sponsors/tannerlinsley\"\n            className=\"inline-block bg-green-500 px-4 py-2 text-xl mx-auto leading-tight font-extrabold tracking-tight text-white rounded-full\"\n          >\n            Become a Sponsor!\n          </a>\n        </div>\n      </div>\n\n      <div className=\"mx-auto max-w-[400px] flex flex-col gap-2 items-center\">\n        <div className=\"shadow-lg rounded-lg overflow-hidden bg-white dark:bg-gray-800 dark:text-white\">\n          <Carbon />\n        </div>\n        <span\n          className=\"text-[.7rem] bg-gray-500 bg-opacity-10 py-1 px-2 rounded text-gray-500\n                dark:bg-opacity-20\"\n        >\n          This ad helps us be happy about our invested time and not burn out and\n          rage-quit OSS. Yay money! 😉\n        </span>\n      </div>\n\n      {/* <div className=\"flex flex-col gap-4\">\n        <div className=\"px-4 sm:px-6 lg:px-8  mx-auto max-w-3xl sm:text-center\">\n          <h3 className=\"text-3xl text-center leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-2\">\n            Less code, fewer edge cases.\n          </h3>\n          <p className=\"my-4 text-xl leading-7  text-gray-600\">\n            Instead of writing reducers, caching logic, timers, retry logic,\n            complex async/await scripting (I could keep going...), you literally\n            write a tiny fraction of the code you normally would. You will be\n            surprised at how little code you're writing or how much code you're\n            deleting when you use TanStack Query. Try it out with one of the\n            examples below!\n          </p>\n          <div className=\"flex flex-wrap gap-2 justify-center\">\n            {(\n              [\n                { label: 'Angular', value: 'angular' },\n                { label: 'React', value: 'react' },\n                { label: 'Solid', value: 'solid' },\n                { label: 'Svelte', value: 'svelte' },\n                { label: 'Vue', value: 'vue' },\n              ] as const\n            ).map((item) => (\n              <button\n                key={item.value}\n                className={`inline-block py-2 px-4 rounded text-white uppercase font-extrabold ${\n                  item.value === framework\n                    ? 'bg-cyan-500'\n                    : 'bg-gray-300 dark:bg-gray-700 hover:bg-cyan-300'\n                }`}\n                onClick={() => setFramework(item.value)}\n              >\n                {item.label}\n              </button>\n            ))}\n          </div>\n        </div>\n      </div> */}\n\n      {/* {[''].includes(framework) ? (\n        <div className=\"px-2\">\n          <div className=\"p-8 text-center text-lg w-full max-w-screen-lg mx-auto bg-black text-white rounded-xl\">\n            Looking for the <strong>@tanstack/{framework}-query</strong>{' '}\n            example? We could use your help to build the{' '}\n            <strong>@tanstack/{framework}-query</strong> adapter! Join the{' '}\n            <a\n              href=\"https://tlinz.com/discord\"\n              className=\"text-teal-500 font-bold\"\n            >\n              TanStack Discord Server\n            </a>{' '}\n            and let's get to work!\n          </div>\n        </div>\n      ) : (\n        <div className=\"bg-white dark:bg-black\">\n          <iframe\n            key={framework}\n            src={`https://stackblitz.com/github/${repo}/tree/${branch}/examples/${framework}/simple?embed=1&theme=${\n              isDark ? 'dark' : 'light'\n            }`}\n            title={`tannerlinsley/${framework}-query: basic`}\n            sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"\n            className=\"shadow-2xl\"\n            loading=\"lazy\"\n            style={{\n              width: '100%',\n              height: '80vh',\n              border: '0',\n            }}\n          ></iframe>\n        </div>\n      )} */}\n\n      {/* <div className=\"flex flex-col gap-4 items-center\">\n        <div className=\"font-extrabold text-xl lg:text-2xl\">\n          Wow, you've come a long way!\n        </div>\n        <div className=\"italic font-sm opacity-70\">\n          Only one thing left to do...\n        </div>\n        <div>\n          <Link\n            to=\"./docs/\"\n            className={`inline-block py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}\n          >\n            Read the Docs!\n          </Link>\n        </div>\n      </div> */}\n      <Footer />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/react/using.tsx",
    "content": "const DummyPostResource = (postId: string) => ({\n  postData: { id: postId, title: 'dummy', body: 'dummy' },\n  [Symbol.dispose]: () => console.log('disposing!'),\n})\nexport const Route = createFileRoute({\n  loader: ({ params: { postId } }) => {\n    using dummyPost = DummyPostResource(postId)\n    return dummyPost.postData\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter/test-files/solid/arrow-function.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { createFileRoute, Link, Outlet } from '@tanstack/solid-router'\nimport { fetchPosts } from '../posts'\n\nexport const Route = createFileRoute('/posts')({\n  loader: fetchPosts,\n  component: PostsComponent,\n})\n\nconst PostsComponent = () => {\n  const posts = Route.useLoaderData()\n\n  return (\n    <div className=\"p-2 flex gap-2\">\n      <ul className=\"list-disc pl-4\">\n        <Solid.For each={posts()}>\n          {(post) => {\n            return (\n              <li className=\"whitespace-nowrap\">\n                <Link\n                  to=\"/posts/$postId\"\n                  params={{\n                    postId: post.id,\n                  }}\n                  className=\"block py-1 text-blue-800 hover:text-blue-600\"\n                  activeProps={{ className: 'text-black font-bold' }}\n                >\n                  <div>{post.title.substring(0, 20)}</div>\n                </Link>\n              </li>\n            )\n          }}\n        </Solid.For>\n      </ul>\n      <hr />\n      <Outlet />\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/code-splitter.test.ts",
    "content": "import { readFile, readdir } from 'node:fs/promises'\nimport path from 'node:path'\nimport { describe, expect, it } from 'vitest'\nimport { parseAst } from '@tanstack/router-utils'\n\nimport {\n  buildDeclarationMap,\n  buildDependencyGraph,\n  collectIdentifiersFromNode,\n  collectLocalBindingsFromStatement,\n  collectModuleLevelRefsFromNode,\n  compileCodeSplitReferenceRoute,\n  compileCodeSplitSharedRoute,\n  compileCodeSplitVirtualRoute,\n  computeSharedBindings,\n  expandDestructuredDeclarations,\n  expandSharedDestructuredDeclarators,\n  expandTransitively,\n  removeBindingsDependingOnRoute,\n} from '../src/core/code-splitter/compilers'\nimport { createIdentifier } from '../src/core/code-splitter/path-ids'\nimport { defaultCodeSplitGroupings } from '../src/core/constants'\nimport { frameworks } from './constants'\nimport type { CodeSplitGroupings } from '../src/core/constants'\n\nfunction getFrameworkDir(framework: string) {\n  const files = path.resolve(\n    __dirname,\n    `./code-splitter/test-files/${framework}`,\n  )\n  const snapshots = path.resolve(\n    __dirname,\n    `./code-splitter/snapshots/${framework}`,\n  )\n  return { files, snapshots }\n}\n\nconst testGroups: Array<{ name: string; groupings: CodeSplitGroupings }> = [\n  {\n    name: '1-default',\n    groupings: defaultCodeSplitGroupings,\n  },\n  {\n    name: '2-components-combined-loader-separate',\n    groupings: [\n      ['loader'],\n      ['component', 'pendingComponent', 'errorComponent', 'notFoundComponent'],\n    ],\n  },\n  {\n    name: '3-all-combined-errorComponent-separate',\n    groupings: [\n      ['loader', 'component', 'pendingComponent', 'notFoundComponent'],\n      ['errorComponent'],\n    ],\n  },\n]\n\ndescribe('code-splitter works', () => {\n  describe.each(frameworks)('FRAMEWORK=%s', (framework) => {\n    describe.each(testGroups)(\n      'SPLIT_GROUP=$name',\n      async ({ groupings: grouping, name: groupName }) => {\n        const dirs = getFrameworkDir(framework)\n        const filenames = await readdir(dirs.files)\n\n        it.each(filenames)(\n          `should compile \"reference\" for \"%s\"`,\n          async (filename) => {\n            const file = await readFile(path.join(dirs.files, filename))\n            const code = file.toString()\n\n            const sharedBindings = computeSharedBindings({\n              code,\n              codeSplitGroupings: grouping,\n            })\n\n            const compileResult = compileCodeSplitReferenceRoute({\n              code,\n              filename,\n              id: filename,\n              addHmr: false,\n              codeSplitGroupings: grouping,\n              targetFramework: framework,\n              sharedBindings:\n                sharedBindings.size > 0 ? sharedBindings : undefined,\n            })\n\n            await expect(compileResult?.code || code).toMatchFileSnapshot(\n              path.join(dirs.snapshots, groupName, filename),\n            )\n          },\n        )\n\n        it.each(filenames)(\n          `should compile \"virtual\" for \"%s\"`,\n          async (filename) => {\n            const file = await readFile(path.join(dirs.files, filename))\n            const code = file.toString()\n\n            const sharedBindings = computeSharedBindings({\n              code,\n              codeSplitGroupings: grouping,\n            })\n\n            for (const targets of grouping) {\n              const ident = createIdentifier(targets)\n\n              const splitResult = compileCodeSplitVirtualRoute({\n                code,\n                filename: `${filename}?${ident}`,\n                splitTargets: targets,\n                sharedBindings:\n                  sharedBindings.size > 0 ? sharedBindings : undefined,\n              })\n\n              const snapshotFilename = path.join(\n                dirs.snapshots,\n                groupName,\n                `${filename.replace('.tsx', '')}@${ident}.tsx`,\n              )\n              await expect(splitResult.code).toMatchFileSnapshot(\n                snapshotFilename,\n              )\n            }\n          },\n        )\n\n        it.each(filenames)(\n          `should compile \"shared\" for \"%s\"`,\n          async (filename) => {\n            const file = await readFile(path.join(dirs.files, filename))\n            const code = file.toString()\n\n            const sharedBindings = computeSharedBindings({\n              code,\n              codeSplitGroupings: grouping,\n            })\n\n            const snapshotFilename = path.join(\n              dirs.snapshots,\n              groupName,\n              `${filename.replace('.tsx', '')}@shared.tsx`,\n            )\n\n            if (sharedBindings.size === 0) {\n              // No shared module — snapshot should be empty string\n              await expect('').toMatchFileSnapshot(snapshotFilename)\n              return\n            }\n\n            const sharedResult = compileCodeSplitSharedRoute({\n              code,\n              sharedBindings,\n              filename: `${filename}?tsr-shared=1`,\n            })\n\n            await expect(sharedResult.code).toMatchFileSnapshot(\n              snapshotFilename,\n            )\n          },\n        )\n      },\n    )\n  })\n})\n\ndescribe('computeSharedBindings fast paths', () => {\n  it('returns empty when only one split group is present (default groupings)', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst shared = 42\nexport const Route = createFileRoute('/')({\n  component: () => shared,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultCodeSplitGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('returns empty when all split props are in the same group', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst shared = 42\nexport const Route = createFileRoute('/')({\n  component: () => shared,\n  loader: () => shared,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: [['component', 'loader']],\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('returns empty when all route option values are undefined', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: undefined,\n  errorComponent: undefined,\n  notFoundComponent: undefined,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultCodeSplitGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('returns empty when no local bindings exist (only imports + Route)', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div>hello</div>,\n  errorComponent: () => <div>error</div>,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultCodeSplitGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('does not fast-path when there is a non-split and a split group', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst shared = 42\nexport const Route = createFileRoute('/')({\n  component: () => shared,\n  beforeLoad: () => shared,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultCodeSplitGroupings,\n    })\n    expect(result).toContain('shared')\n  })\n})\n\n// ============================================================================\n// LAYER 1: Algebraic Property Tests on Helper Functions\n//\n// These test that the pure graph/set functions obey mathematical contracts\n// independent of any particular route file.\n// ============================================================================\n\ndescribe('expandTransitively', () => {\n  it('is idempotent — running twice yields the same result as once', () => {\n    // Graph: a -> b -> c, d -> b\n    const depGraph = new Map<string, Set<string>>([\n      ['a', new Set(['b'])],\n      ['b', new Set(['c'])],\n      ['c', new Set()],\n      ['d', new Set(['b'])],\n    ])\n\n    const first = new Set(['a'])\n    expandTransitively(first, depGraph)\n    const afterFirst = new Set(first)\n\n    expandTransitively(first, depGraph)\n    expect(first).toEqual(afterFirst)\n  })\n\n  it('is monotone — larger initial set produces equal or larger result', () => {\n    const depGraph = new Map<string, Set<string>>([\n      ['a', new Set(['c'])],\n      ['b', new Set(['d'])],\n      ['c', new Set()],\n      ['d', new Set()],\n    ])\n\n    const small = new Set(['a'])\n    expandTransitively(small, depGraph)\n\n    const large = new Set(['a', 'b'])\n    expandTransitively(large, depGraph)\n\n    for (const item of small) {\n      expect(large.has(item)).toBe(true)\n    }\n  })\n\n  it('handles cycles without infinite loops', () => {\n    const depGraph = new Map<string, Set<string>>([\n      ['a', new Set(['b'])],\n      ['b', new Set(['c'])],\n      ['c', new Set(['a'])],\n    ])\n\n    const set = new Set(['a'])\n    expandTransitively(set, depGraph)\n    expect(set).toEqual(new Set(['a', 'b', 'c']))\n  })\n\n  it('is a no-op when there are no dependencies', () => {\n    const depGraph = new Map<string, Set<string>>([\n      ['a', new Set()],\n      ['b', new Set()],\n    ])\n\n    const set = new Set(['a'])\n    expandTransitively(set, depGraph)\n    expect(set).toEqual(new Set(['a']))\n  })\n\n  it('handles missing entries in the graph gracefully', () => {\n    const depGraph = new Map<string, Set<string>>()\n    const set = new Set(['unknown'])\n    expandTransitively(set, depGraph)\n    expect(set).toEqual(new Set(['unknown']))\n  })\n})\n\ndescribe('buildDependencyGraph', () => {\n  it('result keys are a subset of localBindings', () => {\n    const code = `\nconst a = 1\nconst b = a + 1\nconst c = 2\n`\n    const ast = parseAst({ code })\n    const declMap = buildDeclarationMap(ast)\n    const localBindings = new Set(['a', 'b', 'c'])\n    const graph = buildDependencyGraph(declMap, localBindings)\n\n    for (const key of graph.keys()) {\n      expect(localBindings.has(key)).toBe(true)\n    }\n  })\n\n  it('dependency values are also subsets of localBindings', () => {\n    const code = `\nimport { external } from 'somewhere'\nconst a = external\nconst b = a + 1\n`\n    const ast = parseAst({ code })\n    const declMap = buildDeclarationMap(ast)\n    const localBindings = new Set(['a', 'b'])\n    const graph = buildDependencyGraph(declMap, localBindings)\n\n    for (const deps of graph.values()) {\n      for (const dep of deps) {\n        expect(localBindings.has(dep)).toBe(true)\n      }\n    }\n  })\n\n  it('captures direct references correctly', () => {\n    const code = `\nconst x = 10\nconst y = x + 1\n`\n    const ast = parseAst({ code })\n    const declMap = buildDeclarationMap(ast)\n    const localBindings = new Set(['x', 'y'])\n    const graph = buildDependencyGraph(declMap, localBindings)\n\n    expect(graph.get('y')).toEqual(new Set(['x']))\n    expect(graph.get('x')?.size ?? 0).toBe(0)\n  })\n})\n\ndescribe('removeBindingsDependingOnRoute', () => {\n  it('removes bindings that directly reference Route', () => {\n    const depGraph = new Map<string, Set<string>>([\n      ['helper', new Set(['Route'])],\n      ['standalone', new Set()],\n      ['Route', new Set()],\n    ])\n\n    const shared = new Set(['helper', 'standalone'])\n    removeBindingsDependingOnRoute(shared, depGraph)\n\n    expect(shared.has('helper')).toBe(false)\n    expect(shared.has('standalone')).toBe(true)\n  })\n\n  it('removes bindings that transitively reference Route', () => {\n    const depGraph = new Map<string, Set<string>>([\n      ['a', new Set(['b'])],\n      ['b', new Set(['Route'])],\n      ['c', new Set()],\n      ['Route', new Set()],\n    ])\n\n    const shared = new Set(['a', 'c'])\n    removeBindingsDependingOnRoute(shared, depGraph)\n\n    expect(shared.has('a')).toBe(false)\n    expect(shared.has('c')).toBe(true)\n  })\n\n  it('is a no-op when nothing depends on Route', () => {\n    const depGraph = new Map<string, Set<string>>([\n      ['a', new Set(['b'])],\n      ['b', new Set()],\n      ['Route', new Set()],\n    ])\n\n    const shared = new Set(['a', 'b'])\n    const before = new Set(shared)\n    removeBindingsDependingOnRoute(shared, depGraph)\n\n    expect(shared).toEqual(before)\n  })\n})\n\ndescribe('expandDestructuredDeclarations', () => {\n  it('is idempotent', () => {\n    const code = `const { a, b } = fn()`\n    const ast = parseAst({ code })\n\n    const shared = new Set(['a'])\n    expandDestructuredDeclarations(ast, shared)\n    const afterFirst = new Set(shared)\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toEqual(afterFirst)\n  })\n\n  it('pulls all siblings when one destructured binding is shared', () => {\n    const code = `const { a, b, c } = fn()`\n    const ast = parseAst({ code })\n\n    const shared = new Set(['b'])\n    expandDestructuredDeclarations(ast, shared)\n\n    expect(shared).toEqual(new Set(['a', 'b', 'c']))\n  })\n\n  it('does not affect non-destructured declarations', () => {\n    const code = `\nconst x = 1\nconst y = 2\n`\n    const ast = parseAst({ code })\n\n    const shared = new Set(['x'])\n    expandDestructuredDeclarations(ast, shared)\n\n    expect(shared).toEqual(new Set(['x']))\n  })\n})\n\ndescribe('collectLocalBindingsFromStatement', () => {\n  it('collects variable declaration names', () => {\n    const code = `const x = 1`\n    const ast = parseAst({ code })\n    const bindings = new Set<string>()\n    collectLocalBindingsFromStatement(ast.program.body[0]!, bindings)\n    expect(bindings).toEqual(new Set(['x']))\n  })\n\n  it('collects function declaration names', () => {\n    const code = `function foo() {}`\n    const ast = parseAst({ code })\n    const bindings = new Set<string>()\n    collectLocalBindingsFromStatement(ast.program.body[0]!, bindings)\n    expect(bindings).toEqual(new Set(['foo']))\n  })\n\n  it('collects class declaration names', () => {\n    const code = `class MyClass {}`\n    const ast = parseAst({ code })\n    const bindings = new Set<string>()\n    collectLocalBindingsFromStatement(ast.program.body[0]!, bindings)\n    expect(bindings).toEqual(new Set(['MyClass']))\n  })\n\n  it('collects exported declaration names', () => {\n    const code = `export const a = 1`\n    const ast = parseAst({ code })\n    const bindings = new Set<string>()\n    collectLocalBindingsFromStatement(ast.program.body[0]!, bindings)\n    expect(bindings).toEqual(new Set(['a']))\n  })\n\n  it('collects destructured binding names', () => {\n    const code = `const { a, b } = obj`\n    const ast = parseAst({ code })\n    const bindings = new Set<string>()\n    collectLocalBindingsFromStatement(ast.program.body[0]!, bindings)\n    expect(bindings).toEqual(new Set(['a', 'b']))\n  })\n})\n\n// ============================================================================\n// LAYER 2: Invariant Tests on computeSharedBindings\n//\n// These verify the core \"contracts\" of the shared bindings computation:\n// - Route is never extracted\n// - Results are always real local bindings\n// - Destructured cohesion holds\n// - Transitive dependencies are included\n// - Route-dependent bindings are excluded\n// ============================================================================\n\ndescribe('computeSharedBindings invariants', () => {\n  const defaultGroupings = defaultCodeSplitGroupings\n\n  function getLocalBindings(code: string): Set<string> {\n    const ast = parseAst({ code })\n    const bindings = new Set<string>()\n    for (const stmt of ast.program.body) {\n      collectLocalBindingsFromStatement(stmt, bindings)\n    }\n    bindings.delete('Route')\n    return bindings\n  }\n\n  it('INVARIANT: Route is never in the shared set', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst shared = 42\nexport const Route = createFileRoute('/')({\n  component: () => shared,\n  beforeLoad: () => shared,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result.has('Route')).toBe(false)\n  })\n\n  it('INVARIANT: all results are actual local bindings from the source', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nimport { external } from 'somewhere'\nconst config = { url: external, timeout: 5000 }\nconst fetcher = (path) => fetch(config.url + path)\nexport const Route = createFileRoute('/')({\n  loader: () => fetcher('/data'),\n  component: () => <div>{config.timeout}</div>,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    const localBindings = getLocalBindings(code)\n\n    for (const name of result) {\n      expect(localBindings.has(name)).toBe(true)\n    }\n  })\n\n  it('INVARIANT: imports are never in the shared set', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nimport { helper } from './utils'\nexport const Route = createFileRoute('/')({\n  loader: () => helper(),\n  component: () => <div>{helper()}</div>,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result.has('helper')).toBe(false)\n  })\n\n  it('INVARIANT: destructured siblings are either all shared or none shared', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst { a, b, c } = createHelpers()\nexport const Route = createFileRoute('/')({\n  loader: () => a,\n  component: () => <div>{b}</div>,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n\n    // If any destructured sibling is shared, all must be\n    const siblings = ['a', 'b', 'c']\n    const sharedSiblings = siblings.filter((s) => result.has(s))\n    if (sharedSiblings.length > 0) {\n      expect(sharedSiblings.length).toBe(siblings.length)\n    }\n  })\n\n  it('INVARIANT: transitive dependencies of shared bindings are also shared', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst BASE = 'https://api.example.com'\nconst config = { url: BASE }\nconst fetcher = () => fetch(config.url)\nexport const Route = createFileRoute('/')({\n  loader: () => fetcher(),\n  component: () => <div>{config.url}</div>,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n\n    // If config is shared (referenced by both loader via fetcher and component directly),\n    // then BASE (which config depends on) should also be shared\n    if (result.has('config')) {\n      expect(result.has('BASE')).toBe(true)\n    }\n  })\n\n  it('INVARIANT: bindings depending on Route are excluded from shared', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst HEADER = 'Page'\nfunction usePageTitle() {\n  return HEADER + ' - ' + Route.fullPath\n}\nexport const Route = createFileRoute('/about')({\n  loader: () => usePageTitle(),\n  component: () => <div>{usePageTitle()}</div>,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n\n    // usePageTitle references Route, so it must NOT be shared\n    expect(result.has('usePageTitle')).toBe(false)\n    // HEADER is only referenced by usePageTitle which depends on Route,\n    // so HEADER should also not be shared (unless it has other references)\n  })\n\n  it('INVARIANT: single-group-only bindings are never shared', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst loaderOnly = () => fetch('/api')\nconst componentOnly = () => <span>hi</span>\nconst shared = 42\nexport const Route = createFileRoute('/')({\n  loader: () => { loaderOnly(); return shared },\n  component: () => <div>{componentOnly()} {shared}</div>,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n\n    // loaderOnly is only used by loader (non-split), should NOT be shared\n    expect(result.has('loaderOnly')).toBe(false)\n    // componentOnly is only used by component (split), should NOT be shared\n    expect(result.has('componentOnly')).toBe(false)\n    // shared IS used by both groups\n    expect(result.has('shared')).toBe(true)\n  })\n\n  it('INVARIANT: empty result for unsplittable routes (createRootRoute)', () => {\n    const code = `\nimport { createRootRoute } from '@tanstack/react-router'\nconst shared = 42\nexport const Route = createRootRoute({\n  component: () => <div>{shared}</div>,\n  beforeLoad: () => shared,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('INVARIANT: result is stable across multiple calls with same input', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst shared = { name: 'test' }\nexport const Route = createFileRoute('/')({\n  loader: () => shared.name,\n  component: () => <div>{shared.name}</div>,\n})\n`\n    const opts = { code, codeSplitGroupings: defaultGroupings }\n    const result1 = computeSharedBindings(opts)\n    const result2 = computeSharedBindings(opts)\n    const result3 = computeSharedBindings(opts)\n\n    expect(result1).toEqual(result2)\n    expect(result2).toEqual(result3)\n  })\n})\n\n// ============================================================================\n// LAYER 3: Small-Scope Exhaustive Tests\n//\n// Inspired by Alloy's \"small scope hypothesis\" — most bugs show up in small\n// counterexamples. We exhaustively test all combinations of:\n// - binding declaration types (const, function, class)\n// - route property configurations (loader+component, loader+errorComponent, etc.)\n// - split grouping configurations\n// ============================================================================\n\ndescribe('small-scope exhaustive: computeSharedBindings', () => {\n  // Helper to generate a route file with specific binding configurations\n  function makeRouteCode(opts: {\n    bindings: Array<{ name: string; kind: 'const' | 'function' | 'class' }>\n    loaderRefs: Array<string>\n    componentRefs: Array<string>\n    errorComponentRefs?: Array<string>\n    beforeLoadRefs?: Array<string>\n  }): string {\n    const bindingDecls = opts.bindings\n      .map((b) => {\n        switch (b.kind) {\n          case 'const':\n            return `const ${b.name} = 42`\n          case 'function':\n            return `function ${b.name}() { return 42 }`\n          case 'class':\n            return `class ${b.name} { value = 42 }`\n        }\n      })\n      .join('\\n')\n\n    const loaderBody =\n      opts.loaderRefs.length > 0\n        ? opts.loaderRefs.map((r) => `${r}`).join('; ')\n        : '42'\n\n    const componentBody =\n      opts.componentRefs.length > 0\n        ? opts.componentRefs.map((r) => `{${r}}`).join('')\n        : 'hello'\n\n    const props: Array<string> = [\n      `  loader: () => { return ${loaderBody} }`,\n      `  component: () => <div>${componentBody}</div>`,\n    ]\n\n    if (opts.errorComponentRefs) {\n      const body =\n        opts.errorComponentRefs.length > 0\n          ? opts.errorComponentRefs.map((r) => `{${r}}`).join('')\n          : 'error'\n      props.push(`  errorComponent: () => <div>${body}</div>`)\n    }\n\n    if (opts.beforeLoadRefs) {\n      const body =\n        opts.beforeLoadRefs.length > 0\n          ? opts.beforeLoadRefs.map((r) => `${r}`).join('; ')\n          : '42'\n      props.push(`  beforeLoad: () => { return ${body} }`)\n    }\n\n    return `\nimport { createFileRoute } from '@tanstack/react-router'\n${bindingDecls}\nexport const Route = createFileRoute('/')({\n${props.join(',\\n')}\n})\n`\n  }\n\n  // Exhaustively test 1-binding scenarios with all grouping configs\n  const groupingConfigs: Array<{\n    name: string\n    groupings: CodeSplitGroupings\n  }> = [\n    { name: 'default', groupings: defaultCodeSplitGroupings },\n    {\n      name: 'loader+components-combined',\n      groupings: [\n        ['loader'],\n        [\n          'component',\n          'pendingComponent',\n          'errorComponent',\n          'notFoundComponent',\n        ],\n      ],\n    },\n  ]\n\n  const bindingKinds = ['const', 'function', 'class'] as const\n\n  describe('single binding × all property combinations', () => {\n    // For each binding kind × each grouping × each reference pattern,\n    // verify invariants hold\n    for (const kind of bindingKinds) {\n      for (const { name: groupName, groupings } of groupingConfigs) {\n        // Pattern: binding used only by loader (non-split) → never shared\n        it(`${kind} used only by loader [${groupName}] → not shared`, () => {\n          const code = makeRouteCode({\n            bindings: [{ name: 'x', kind }],\n            loaderRefs: ['x'],\n            componentRefs: [],\n          })\n          const result = computeSharedBindings({\n            code,\n            codeSplitGroupings: groupings,\n          })\n          expect(result.has('x')).toBe(false)\n        })\n\n        // Pattern: binding used only by component (split) → never shared\n        it(`${kind} used only by component [${groupName}] → not shared`, () => {\n          const code = makeRouteCode({\n            bindings: [{ name: 'x', kind }],\n            loaderRefs: [],\n            componentRefs: ['x'],\n          })\n          const result = computeSharedBindings({\n            code,\n            codeSplitGroupings: groupings,\n          })\n          expect(result.has('x')).toBe(false)\n        })\n\n        // Pattern: binding used by both loader AND component → shared\n        it(`${kind} used by loader+component [${groupName}] → shared`, () => {\n          const code = makeRouteCode({\n            bindings: [{ name: 'x', kind }],\n            loaderRefs: ['x'],\n            componentRefs: ['x'],\n          })\n          const result = computeSharedBindings({\n            code,\n            codeSplitGroupings: groupings,\n          })\n          expect(result.has('x')).toBe(true)\n        })\n\n        // Pattern: binding used by component AND beforeLoad (non-split) → shared\n        it(`${kind} used by component+beforeLoad [${groupName}] → shared`, () => {\n          const code = makeRouteCode({\n            bindings: [{ name: 'x', kind }],\n            loaderRefs: [],\n            componentRefs: ['x'],\n            beforeLoadRefs: ['x'],\n          })\n          const result = computeSharedBindings({\n            code,\n            codeSplitGroupings: groupings,\n          })\n          expect(result.has('x')).toBe(true)\n        })\n      }\n    }\n  })\n\n  describe('two bindings × cross-group references', () => {\n    for (const { name: groupName, groupings } of groupingConfigs) {\n      // Both bindings in same group → neither shared\n      it(`both in loader only [${groupName}] → neither shared`, () => {\n        const code = makeRouteCode({\n          bindings: [\n            { name: 'a', kind: 'const' },\n            { name: 'b', kind: 'const' },\n          ],\n          loaderRefs: ['a', 'b'],\n          componentRefs: [],\n        })\n        const result = computeSharedBindings({\n          code,\n          codeSplitGroupings: groupings,\n        })\n        expect(result.has('a')).toBe(false)\n        expect(result.has('b')).toBe(false)\n      })\n\n      // One binding per group → neither shared\n      it(`one per group, no overlap [${groupName}] → neither shared`, () => {\n        const code = makeRouteCode({\n          bindings: [\n            { name: 'a', kind: 'const' },\n            { name: 'b', kind: 'const' },\n          ],\n          loaderRefs: ['a'],\n          componentRefs: ['b'],\n        })\n        const result = computeSharedBindings({\n          code,\n          codeSplitGroupings: groupings,\n        })\n        expect(result.has('a')).toBe(false)\n        expect(result.has('b')).toBe(false)\n      })\n\n      // Both in both groups → both shared\n      it(`both in both groups [${groupName}] → both shared`, () => {\n        const code = makeRouteCode({\n          bindings: [\n            { name: 'a', kind: 'const' },\n            { name: 'b', kind: 'const' },\n          ],\n          loaderRefs: ['a', 'b'],\n          componentRefs: ['a', 'b'],\n        })\n        const result = computeSharedBindings({\n          code,\n          codeSplitGroupings: groupings,\n        })\n        expect(result.has('a')).toBe(true)\n        expect(result.has('b')).toBe(true)\n      })\n\n      // One shared, one not → exactly one shared\n      it(`one in both groups, one in one [${groupName}] → only cross-group is shared`, () => {\n        const code = makeRouteCode({\n          bindings: [\n            { name: 'a', kind: 'const' },\n            { name: 'b', kind: 'const' },\n          ],\n          loaderRefs: ['a'],\n          componentRefs: ['a', 'b'],\n        })\n        const result = computeSharedBindings({\n          code,\n          codeSplitGroupings: groupings,\n        })\n        expect(result.has('a')).toBe(true)\n        expect(result.has('b')).toBe(false)\n      })\n    }\n  })\n\n  describe('transitive dependency chains', () => {\n    it('A depends on B, both used by different groups → both shared', () => {\n      const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst BASE = 'https://api.example.com'\nconst config = { url: BASE }\nexport const Route = createFileRoute('/')({\n  loader: () => config.url,\n  component: () => <div>{config.url}</div>,\n})\n`\n      const result = computeSharedBindings({\n        code,\n        codeSplitGroupings: defaultCodeSplitGroupings,\n      })\n      // config is directly used by both groups → shared\n      expect(result.has('config')).toBe(true)\n      // BASE is a dep of config → also shared\n      expect(result.has('BASE')).toBe(true)\n    })\n\n    it('A depends on B depends on C, A used cross-group → all three shared', () => {\n      const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst c = 'deep'\nconst b = c + '-value'\nconst a = b + '-final'\nexport const Route = createFileRoute('/')({\n  loader: () => a,\n  component: () => <div>{a}</div>,\n})\n`\n      const result = computeSharedBindings({\n        code,\n        codeSplitGroupings: defaultCodeSplitGroupings,\n      })\n      expect(result.has('a')).toBe(true)\n      expect(result.has('b')).toBe(true)\n      expect(result.has('c')).toBe(true)\n    })\n\n    it('diamond dependency: A→B, A→C, B→D, C→D → all shared when A is cross-group', () => {\n      const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst D = 42\nconst B = D + 1\nconst C = D + 2\nconst A = B + C\nexport const Route = createFileRoute('/')({\n  loader: () => A,\n  component: () => <div>{A}</div>,\n})\n`\n      const result = computeSharedBindings({\n        code,\n        codeSplitGroupings: defaultCodeSplitGroupings,\n      })\n      expect(result.has('A')).toBe(true)\n      expect(result.has('B')).toBe(true)\n      expect(result.has('C')).toBe(true)\n      expect(result.has('D')).toBe(true)\n    })\n  })\n\n  describe('meta-invariant: all fixture files satisfy core contracts', () => {\n    const sharedFixtures = [\n      'shared-variable.tsx',\n      'shared-class.tsx',\n      'shared-function.tsx',\n      'shared-exported.tsx',\n      'shared-indirect-ref.tsx',\n      'shared-none.tsx',\n      'shared-destructured.tsx',\n      'shared-destructured-export.tsx',\n      'shared-imported-binding.tsx',\n      'shared-jsx-component-ref.tsx',\n      'shared-referencing-route.tsx',\n      'shared-transitive.tsx',\n      'shared-with-side-effect.tsx',\n    ]\n\n    // Run invariants across ALL existing test fixtures — like a conformance suite\n    it.each(sharedFixtures)(\n      'fixture \"%s\" satisfies: Route excluded, results ⊆ localBindings',\n      async (filename) => {\n        const file = await readFile(\n          path.join(__dirname, `./code-splitter/test-files/react/${filename}`),\n        )\n        const code = file.toString()\n\n        const result = computeSharedBindings({\n          code,\n          codeSplitGroupings: defaultCodeSplitGroupings,\n        })\n\n        // Contract 1: Route is never shared\n        expect(result.has('Route')).toBe(false)\n\n        // Contract 2: all results are real local bindings\n        const ast = parseAst({ code })\n        const localBindings = new Set<string>()\n        for (const stmt of ast.program.body) {\n          collectLocalBindingsFromStatement(stmt, localBindings)\n        }\n        localBindings.delete('Route')\n\n        for (const name of result) {\n          expect(localBindings.has(name)).toBe(true)\n        }\n\n        // Contract 3: result is deterministic\n        const result2 = computeSharedBindings({\n          code,\n          codeSplitGroupings: defaultCodeSplitGroupings,\n        })\n        expect(result).toEqual(result2)\n      },\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/config/withJson/tsr.config.json",
    "content": "{\n  \"routesDirectory\": \"./src/routes\",\n  \"generatedRouteTree\": \"./src/routeTree.gen.ts\",\n  \"target\": \"solid\",\n  \"autoCodeSplitting\": false\n}\n"
  },
  {
    "path": "packages/router-plugin/tests/config.test.ts",
    "content": "import path from 'node:path'\nimport { readFileSync } from 'node:fs'\nimport { describe, expect, it } from 'vitest'\nimport { getConfig } from '../src'\nimport type { Config } from '../src'\n\ndescribe('getConfig', () => {\n  const testCases = [\n    {\n      name: 'inline config',\n      inlineConfig: {\n        target: 'solid',\n        autoCodeSplitting: false,\n        enableRouteGeneration: true,\n      } as Partial<Config>,\n      withJson: false,\n    },\n    {\n      name: `inline config and relative paths`,\n      inlineConfig: {\n        target: 'solid',\n        autoCodeSplitting: false,\n        routesDirectory: 'src/paths',\n        generatedRouteTree: 'src/tree/routeTree.gen.ts',\n        enableRouteGeneration: true,\n      } as Partial<Config>,\n      withJson: false,\n    },\n    {\n      name: `inline config and \"./\" form relative paths`,\n      inlineConfig: {\n        target: 'solid',\n        autoCodeSplitting: true,\n        routesDirectory: './src/paths',\n        generatedRouteTree: './src/tree/routeTree.gen.ts',\n        enableRouteGeneration: true,\n      } as Partial<Config>,\n      withJson: false,\n    },\n    {\n      name: 'inline config and absolute paths',\n      inlineConfig: {\n        target: 'solid',\n        autoCodeSplitting: false,\n        routesDirectory: '/src/paths',\n        generatedRouteTree: '/src/tree/routeTree.gen.ts',\n        enableRouteGeneration: true,\n      } as Partial<Config>,\n      withJson: false,\n    },\n    {\n      name: 'json config',\n      inlineConfig: {} as Partial<Config>,\n      withJson: true,\n    },\n    {\n      name: 'combination of json and inline config',\n      inlineConfig: {\n        target: 'react',\n        autoCodeSplitting: true,\n        routesDirectory: './src/paths',\n        generatedRouteTree: './src/tree/routeTree.gen.ts',\n        enableRouteGeneration: true,\n      } as Partial<Config>,\n      withJson: true,\n    },\n  ]\n\n  it.each(testCases)('must resolve $name', ({ inlineConfig, withJson }) => {\n    const rootPath = withJson ? 'withJson' : 'withoutJson'\n    const root = path.resolve(import.meta.dirname, 'config', rootPath)\n\n    const jsonConfig = withJson\n      ? JSON.parse(readFileSync(path.resolve(root, 'tsr.config.json'), 'utf-8'))\n      : undefined\n\n    const routesPath =\n      inlineConfig.routesDirectory ??\n      jsonConfig?.routesDirectory ??\n      'src/routes'\n\n    const routeTreePath =\n      inlineConfig.generatedRouteTree ??\n      jsonConfig?.generatedRouteTree ??\n      'src/routeTree.gen.ts'\n\n    const routesDirectory = path.resolve(\n      import.meta.dirname,\n      'config',\n      rootPath,\n      routesPath,\n    )\n\n    const generatedRouteTree = path.resolve(\n      import.meta.dirname,\n      'config',\n      rootPath,\n      routeTreePath,\n    )\n\n    const resolvedConfig = getConfig(inlineConfig, root)\n\n    expect(resolvedConfig).toEqual(\n      expect.objectContaining({\n        ...jsonConfig,\n        ...inlineConfig,\n        routesDirectory,\n        generatedRouteTree,\n      }),\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/constants.ts",
    "content": "import type { Config } from '../src/core/config'\n\nexport const frameworks: Array<Config['target']> = ['react', 'solid']\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/1-delete-nodes-undefined/createRootRoute-ssr-function.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\n\nexport const Route = createRootRoute({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/1-delete-nodes-undefined/createRootRouteWithContext-ssr-function.tsx",
    "content": "import { createRootRouteWithContext } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\n\nexport const Route = createRootRouteWithContext<{}>()({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/1-delete-nodes-undefined/ssr-data-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: 'data-only',\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/1-delete-nodes-undefined/ssr-false.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: false,\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/1-delete-nodes-undefined/ssr-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\nexport const Route = createFileRoute('/')({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/2-delete-nodes-empty/createRootRoute-ssr-function.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\n\nexport const Route = createRootRoute({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/2-delete-nodes-empty/createRootRouteWithContext-ssr-function.tsx",
    "content": "import { createRootRouteWithContext } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\n\nexport const Route = createRootRouteWithContext<{}>()({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/2-delete-nodes-empty/ssr-data-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: 'data-only',\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/2-delete-nodes-empty/ssr-false.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: false,\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/2-delete-nodes-empty/ssr-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\nexport const Route = createFileRoute('/')({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/3-delete-nodes-ssr/createRootRoute-ssr-function.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router';\nexport const Route = createRootRoute({\n  component: () => {\n    return <div className=\"p-2\">hello world</div>;\n  }\n});"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/3-delete-nodes-ssr/createRootRouteWithContext-ssr-function.tsx",
    "content": "import { createRootRouteWithContext } from '@tanstack/react-router';\nexport const Route = createRootRouteWithContext<{}>()({\n  component: () => {\n    return <div className=\"p-2\">hello world</div>;\n  }\n});"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/3-delete-nodes-ssr/ssr-data-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: () => {\n    return <div className=\"p-2\">hello world</div>;\n  }\n});"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/3-delete-nodes-ssr/ssr-false.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: () => {\n    return <div className=\"p-2\">hello world</div>;\n  }\n});"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/react/3-delete-nodes-ssr/ssr-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router';\nexport const Route = createFileRoute('/')({\n  component: () => {\n    return <div className=\"p-2\">hello world</div>;\n  }\n});"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/1-delete-nodes-undefined/ssr-data-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: 'data-only',\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/1-delete-nodes-undefined/ssr-false.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: false,\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/1-delete-nodes-undefined/ssr-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: () => {\n    if (typeof window === 'undefined') {\n      return 'data-only'\n    }\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/2-delete-nodes-empty/ssr-data-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: 'data-only',\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/2-delete-nodes-empty/ssr-false.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: false,\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/2-delete-nodes-empty/ssr-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: () => {\n    if (typeof window === 'undefined') {\n      return 'data-only'\n    }\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/3-delete-nodes-ssr/ssr-data-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router';\nexport const Route = createFileRoute('/')({\n  component: () => {\n    return <div className=\"p-2\">hello world</div>;\n  }\n});"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/3-delete-nodes-ssr/ssr-false.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router';\nexport const Route = createFileRoute('/')({\n  component: () => {\n    return <div className=\"p-2\">hello world</div>;\n  }\n});"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/snapshots/solid/3-delete-nodes-ssr/ssr-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router';\nexport const Route = createFileRoute('/')({\n  component: () => {\n    return <div className=\"p-2\">hello world</div>;\n  }\n});"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/test-files/react/createRootRoute-ssr-function.tsx",
    "content": "import { createRootRoute } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\n\nexport const Route = createRootRoute({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/test-files/react/createRootRouteWithContext-ssr-function.tsx",
    "content": "import { createRootRouteWithContext } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\n\nexport const Route = createRootRouteWithContext<{}>()({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/test-files/react/ssr-data-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: 'data-only',\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/test-files/react/ssr-false.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: false,\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/test-files/react/ssr-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/react-router'\nimport crypto from 'node:crypto'\nexport const Route = createFileRoute('/')({\n  ssr: () => {\n    if (crypto.randomInt(0, 2) === 0) {\n      return 'data-only'\n    }\n    return false\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/test-files/solid/ssr-data-only.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: 'data-only',\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/test-files/solid/ssr-false.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: false,\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes/test-files/solid/ssr-function.tsx",
    "content": "import { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  ssr: () => {\n    if (typeof window === 'undefined') {\n      return 'data-only'\n    }\n  },\n  component: () => {\n    return <div className=\"p-2\">hello world</div>\n  },\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/delete-nodes.test.ts",
    "content": "import { readFile, readdir } from 'node:fs/promises'\nimport path from 'node:path'\nimport { describe, expect, it } from 'vitest'\n\nimport { compileCodeSplitReferenceRoute } from '../src/core/code-splitter/compilers'\nimport { frameworks } from './constants'\nimport type { DeletableNodes } from '../src/core/config'\n\nfunction getFrameworkDir(framework: string) {\n  const files = path.resolve(\n    __dirname,\n    `./delete-nodes/test-files/${framework}`,\n  )\n  const snapshots = path.resolve(\n    __dirname,\n    `./delete-nodes/snapshots/${framework}`,\n  )\n  return { files, snapshots }\n}\n\nconst testGroups: Array<{\n  name: string\n  deleteNodes: Array<DeletableNodes> | undefined\n}> = [\n  {\n    deleteNodes: undefined,\n    name: '1-delete-nodes-undefined',\n  },\n  { deleteNodes: [], name: '2-delete-nodes-empty' },\n  {\n    deleteNodes: ['ssr'],\n    name: '3-delete-nodes-ssr',\n  },\n]\n\ndescribe('code-splitter delete nodes', () => {\n  describe.each(frameworks)('FRAMEWORK=%s', (framework) => {\n    describe.each(testGroups)(\n      'SPLIT_GROUP=$name',\n      async ({ deleteNodes, name: groupName }) => {\n        const dirs = getFrameworkDir(framework)\n        const filenames = await readdir(dirs.files)\n\n        it.each(filenames)(\n          `should compile \"reference\" for \"%s\"`,\n          async (filename) => {\n            const file = await readFile(path.join(dirs.files, filename))\n            const code = file.toString()\n\n            const compileResult = compileCodeSplitReferenceRoute({\n              code,\n              filename,\n              id: filename,\n              addHmr: false,\n              codeSplitGroupings: [],\n              deleteNodes: new Set(deleteNodes),\n              targetFramework: framework,\n            })\n\n            await expect(compileResult?.code || code).toMatchFileSnapshot(\n              path.join(dirs.snapshots, groupName, filename),\n            )\n          },\n        )\n      },\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/detect-route-codesplit-groupings.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport { detectCodeSplitGroupingsFromRoute } from '../src/core/code-splitter/compilers'\nimport { defaultCodeSplitGroupings } from '../src/core/constants'\nimport type { CodeSplitGroupings } from '../src/core/constants'\n\nconst successCases: Array<{\n  name: string\n  code: string\n  expectedGrouping: CodeSplitGroupings | undefined\n}> = [\n  {\n    // This test should be updated whenever the `defaultCodeSplitGroupings` changes\n    name: 'verbose:true-defaults',\n    code: `\nimport {createFileRoute} from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts')({\ncodeSplitGroupings: [\n  ['component'],\n  ['errorComponent'],\n  ['notFoundComponent']\n]\n})\n`,\n    expectedGrouping: defaultCodeSplitGroupings,\n  },\n  {\n    // This test should be updated whenever the `defaultCodeSplitGroupings` changes\n    name: 'verbose:false-defaults',\n    code: `\nexport const Route = createFileRoute({\ncodeSplitGroupings: [\n  ['component'],\n  ['errorComponent'],\n  ['notFoundComponent']\n]\n})\n`,\n    expectedGrouping: defaultCodeSplitGroupings,\n  },\n  {\n    name: 'verbose:true-loader-separate-components-combined',\n    code: `\nimport {createFileRoute} from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts')({\ncodeSplitGroupings: [\n  ['loader'],\n  ['component', 'pendingComponent', 'errorComponent', 'notFoundComponent']\n]\n})\n`,\n    expectedGrouping: [\n      ['loader'],\n      ['component', 'pendingComponent', 'errorComponent', 'notFoundComponent'],\n    ],\n  },\n  {\n    name: 'verbose:false-loader-separate-components-combined',\n    code: `\nexport const Route = createFileRoute({\ncodeSplitGroupings: [\n  ['loader'],\n  ['component', 'pendingComponent', 'errorComponent', 'notFoundComponent']\n]\n})\n`,\n    expectedGrouping: [\n      ['loader'],\n      ['component', 'pendingComponent', 'errorComponent', 'notFoundComponent'],\n    ],\n  },\n  {\n    name: 'verbose:true-limited-loader-and-component',\n    code: `\nimport {createFileRoute} from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts')({\ncodeSplitGroupings: [\n  ['loader', 'component'],\n  ['pendingComponent', 'errorComponent', 'notFoundComponent']\n]\n})\n`,\n    expectedGrouping: [\n      ['loader', 'component'],\n      ['pendingComponent', 'errorComponent', 'notFoundComponent'],\n    ],\n  },\n  {\n    name: 'verbose:false-limited-loader-and-component',\n    code: `\nexport const Route = createFileRoute({\ncodeSplitGroupings: [\n  ['loader', 'component'],\n  ['pendingComponent', 'errorComponent', 'notFoundComponent']\n]\n})\n`,\n    expectedGrouping: [\n      ['loader', 'component'],\n      ['pendingComponent', 'errorComponent', 'notFoundComponent'],\n    ],\n  },\n  {\n    name: 'verbose:true-empty',\n    code: `\nimport {createFileRoute} from '@tanstack/react-router'\nexport const Route = createFileRoute('/posts')({})\n`,\n    expectedGrouping: undefined,\n  },\n  {\n    name: 'verbose:false-empty',\n    code: `\nexport const Route = createFileRoute({})\n`,\n    expectedGrouping: undefined,\n  },\n]\n\ndescribe('detectCodeSplitGroupingsFromRoute - success', () => {\n  it.each(successCases)(\n    'should detect code split groupings for $name',\n    ({ code, expectedGrouping }) => {\n      const result = detectCodeSplitGroupingsFromRoute({\n        code: code,\n        sourceFilename: 'test.ts',\n      })\n\n      expect(result.groupings).toEqual(expectedGrouping)\n    },\n  )\n})\n\nconst failCases: Array<{\n  name: string\n  code: string\n}> = [\n  {\n    name: 'verbose:true-not-nested-array',\n    code: `\n  import {createFileRoute} from '@tanstack/react-router'\n  export const Route = createFileRoute('/')({\n  codeSplitGroupings: [\n      'loader',\n  ]\n  })\n  `,\n  },\n  {\n    name: 'verbose:false-not-nested-array',\n    code: `\n  export const Route = createFileRoute({\n  codeSplitGroupings: [\n      'loader',\n  ]\n  })\n  `,\n  },\n  {\n    name: 'verbose:true-reference-variable',\n    code: `\nimport {createFileRoute} from '@tanstack/react-router'\nconst groupings = [\n  ['loader'],\n  ['component'],\n]\nexport const Route = createFileRoute('/')({\ncodeSplitGroupings: groupings\n})\n`,\n  },\n  {\n    name: 'verbose:false-reference-variable',\n    code: `\nconst groupings = [\n  ['loader'],\n  ['component'],\n]\nexport const Route = createFileRoute({\ncodeSplitGroupings: groupings\n})\n`,\n  },\n]\n\ndescribe('detectCodeSplitGroupingsFromRoute - fail', () => {\n  it.each(failCases)('should throw error for $name', ({ code }) => {\n    expect(() =>\n      detectCodeSplitGroupingsFromRoute({\n        code: code,\n        sourceFilename: 'test.ts',\n      }),\n    ).toThrowError()\n  })\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/shared-bindings-helpers.test.ts",
    "content": "import { describe, expect, it } from 'vitest'\nimport * as t from '@babel/types'\nimport { parseAst } from '@tanstack/router-utils'\n\nimport {\n  addSharedSearchParamToFilename,\n  buildDeclarationMap,\n  buildDependencyGraph,\n  collectIdentifiersFromNode,\n  collectLocalBindingsFromStatement,\n  collectModuleLevelRefsFromNode,\n  computeSharedBindings,\n  expandDestructuredDeclarations,\n  expandTransitively,\n  removeBindingsDependingOnRoute,\n} from '../src/core/code-splitter/compilers'\nimport { defaultCodeSplitGroupings } from '../src/core/constants'\nimport type { CodeSplitGroupings } from '../src/core/constants'\n\n// ─── Test helpers ──────────────────────────────────────────\n\nfunction parse(code: string) {\n  return parseAst({ code })\n}\n\nfunction collectBindings(code: string): Set<string> {\n  const ast = parse(code)\n  const bindings = new Set<string>()\n  for (const node of ast.program.body) {\n    collectLocalBindingsFromStatement(node, bindings)\n  }\n  return bindings\n}\n\n/** Build a dep graph from code for convenience */\nfunction graphFromCode(code: string) {\n  const ast = parse(code)\n  const locals = new Set<string>()\n  for (const node of ast.program.body) {\n    collectLocalBindingsFromStatement(node, locals)\n  }\n  const declMap = buildDeclarationMap(ast)\n  return {\n    ast,\n    locals,\n    declMap,\n    depGraph: buildDependencyGraph(declMap, locals),\n  }\n}\n\n// ─── addSharedSearchParamToFilename ────────────────────────\n\ndescribe('addSharedSearchParamToFilename', () => {\n  it('should append tsr-shared=1 to bare filename', () => {\n    expect(addSharedSearchParamToFilename('src/routes/index.tsx')).toBe(\n      'src/routes/index.tsx?tsr-shared=1',\n    )\n  })\n\n  it('should strip existing query params', () => {\n    expect(\n      addSharedSearchParamToFilename(\n        'src/routes/index.tsx?tsr-split=component',\n      ),\n    ).toBe('src/routes/index.tsx?tsr-shared=1')\n  })\n})\n\n// ─── collectIdentifiersFromNode ───────────────────────────\n\ndescribe('collectIdentifiersFromNode', () => {\n  it('should collect from a simple identifier', () => {\n    const ast = parse('const x = foo')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    expect(collectIdentifiersFromNode(init)).toEqual(new Set(['foo']))\n  })\n\n  it('should collect from a binary expression', () => {\n    const ast = parse('const x = a + b')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    expect(collectIdentifiersFromNode(init)).toEqual(new Set(['a', 'b']))\n  })\n\n  it('should ignore object literal keys', () => {\n    const ast = parse('const x = { key: value }')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    const ids = collectIdentifiersFromNode(init)\n    expect(ids).toContain('value')\n    expect(ids).not.toContain('key')\n  })\n\n  it('should ignore member expression properties', () => {\n    const ast = parse('const x = obj.prop + obj[dynamic]')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    const ids = collectIdentifiersFromNode(init)\n    expect(ids).toContain('obj')\n    expect(ids).toContain('dynamic')\n    expect(ids).not.toContain('prop')\n  })\n\n  it('should collect from a call expression', () => {\n    const ast = parse('const x = foo(bar, baz)')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    expect(collectIdentifiersFromNode(init)).toEqual(\n      new Set(['foo', 'bar', 'baz']),\n    )\n  })\n\n  it('should collect from arrow function body', () => {\n    const ast = parse('const x = () => a + b')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    const ids = collectIdentifiersFromNode(init)\n    expect(ids).toContain('a')\n    expect(ids).toContain('b')\n  })\n\n  it('should collect from member expressions', () => {\n    const ast = parse('const x = obj.prop')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    const ids = collectIdentifiersFromNode(init)\n    expect(ids).toContain('obj')\n    // property name is not a referenced identifier\n    expect(ids).not.toContain('prop')\n  })\n\n  it('should collect from nested structures', () => {\n    const ast = parse('const x = { key: fn(val) }')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    const ids = collectIdentifiersFromNode(init)\n    expect(ids).toContain('fn')\n    expect(ids).toContain('val')\n    // object literal keys are not referenced identifiers\n    expect(ids).not.toContain('key')\n  })\n\n  it('should return empty set for a numeric literal', () => {\n    const ast = parse('const x = 42')\n    const decl = ast.program.body[0] as t.VariableDeclaration\n    const init = decl.declarations[0]!.init!\n    expect(collectIdentifiersFromNode(init).size).toBe(0)\n  })\n\n  it('should collect from function declaration body', () => {\n    const ast = parse('function foo() { return bar + baz }')\n    const fn = ast.program.body[0]!\n    const ids = collectIdentifiersFromNode(fn)\n    // function name is a binding, not a reference\n    expect(ids).not.toContain('foo')\n    expect(ids).toContain('bar')\n    expect(ids).toContain('baz')\n  })\n})\n\n// ─── collectLocalBindingsFromStatement ─────────────────────\n\ndescribe('collectLocalBindingsFromStatement', () => {\n  it('should collect from const declaration', () => {\n    expect(collectBindings('const x = 1')).toEqual(new Set(['x']))\n  })\n\n  it('should collect from let declaration', () => {\n    expect(collectBindings('let x = 1')).toEqual(new Set(['x']))\n  })\n\n  it('should collect from multiple declarators', () => {\n    expect(collectBindings('const x = 1, y = 2')).toEqual(new Set(['x', 'y']))\n  })\n\n  it('should collect from function declaration', () => {\n    expect(collectBindings('function foo() {}')).toEqual(new Set(['foo']))\n  })\n\n  it('should collect from class declaration', () => {\n    expect(collectBindings('class Foo {}')).toEqual(new Set(['Foo']))\n  })\n\n  it('should collect from exported variable declaration', () => {\n    expect(collectBindings('export const x = 1')).toEqual(new Set(['x']))\n  })\n\n  it('should collect from exported function declaration', () => {\n    expect(collectBindings('export function foo() {}')).toEqual(\n      new Set(['foo']),\n    )\n  })\n\n  it('should collect from exported class declaration', () => {\n    expect(collectBindings('export class Foo {}')).toEqual(new Set(['Foo']))\n  })\n\n  it('should collect from object destructuring', () => {\n    expect(collectBindings('const { a, b } = obj')).toEqual(new Set(['a', 'b']))\n  })\n\n  it('should collect from nested object destructuring', () => {\n    expect(collectBindings('const { a: { b, c } } = obj')).toEqual(\n      new Set(['b', 'c']),\n    )\n  })\n\n  it('should collect from array destructuring', () => {\n    expect(collectBindings('const [a, b] = arr')).toEqual(new Set(['a', 'b']))\n  })\n\n  it('should collect from destructuring with defaults', () => {\n    expect(collectBindings('const { a = 1, b = 2 } = obj')).toEqual(\n      new Set(['a', 'b']),\n    )\n  })\n\n  it('should collect from destructuring with rest', () => {\n    expect(collectBindings('const { a, ...rest } = obj')).toEqual(\n      new Set(['a', 'rest']),\n    )\n  })\n\n  it('should collect from exported destructuring', () => {\n    expect(collectBindings('export const { a, b } = fn()')).toEqual(\n      new Set(['a', 'b']),\n    )\n  })\n\n  it('should NOT collect from import declarations', () => {\n    expect(collectBindings(\"import { a } from './mod'\")).toEqual(new Set())\n  })\n\n  it('should NOT collect from expression statements', () => {\n    expect(collectBindings('console.log(\"hello\")')).toEqual(new Set())\n  })\n\n  it('should collect from renamed destructuring', () => {\n    expect(collectBindings('const { a: renamedA } = obj')).toEqual(\n      new Set(['renamedA']),\n    )\n  })\n\n  it('should collect from multiple statements', () => {\n    const code = `\nconst x = 1\nfunction foo() {}\nclass Bar {}\n`\n    expect(collectBindings(code)).toEqual(new Set(['x', 'foo', 'Bar']))\n  })\n})\n\n// ─── buildDeclarationMap ──────────────────────────────────\n\ndescribe('buildDeclarationMap', () => {\n  it('should map variable names to their declarator nodes', () => {\n    const ast = parse('const x = 1\\nconst y = 2')\n    const map = buildDeclarationMap(ast)\n    expect(map.has('x')).toBe(true)\n    expect(map.has('y')).toBe(true)\n    expect(t.isVariableDeclarator(map.get('x'))).toBe(true)\n  })\n\n  it('should map function declarations', () => {\n    const ast = parse('function foo() {}')\n    const map = buildDeclarationMap(ast)\n    expect(map.has('foo')).toBe(true)\n    expect(t.isFunctionDeclaration(map.get('foo'))).toBe(true)\n  })\n\n  it('should map class declarations', () => {\n    const ast = parse('class Bar {}')\n    const map = buildDeclarationMap(ast)\n    expect(map.has('Bar')).toBe(true)\n    expect(t.isClassDeclaration(map.get('Bar'))).toBe(true)\n  })\n\n  it('should map exported declarations', () => {\n    const ast = parse('export const x = 1\\nexport function foo() {}')\n    const map = buildDeclarationMap(ast)\n    expect(map.has('x')).toBe(true)\n    expect(map.has('foo')).toBe(true)\n  })\n\n  it('should map destructured bindings to same declarator', () => {\n    const ast = parse('const { a, b } = fn()')\n    const map = buildDeclarationMap(ast)\n    expect(map.has('a')).toBe(true)\n    expect(map.has('b')).toBe(true)\n    expect(map.get('a')).toBe(map.get('b'))\n  })\n\n  it('should not include imports', () => {\n    const ast = parse(\"import { x } from './mod'\\nconst y = 1\")\n    const map = buildDeclarationMap(ast)\n    expect(map.has('x')).toBe(false)\n    expect(map.has('y')).toBe(true)\n  })\n})\n\n// ─── buildDependencyGraph ─────────────────────────────────\n\ndescribe('buildDependencyGraph', () => {\n  it('should detect direct dependency', () => {\n    const { depGraph } = graphFromCode('const a = 1\\nconst b = a + 1')\n    expect(depGraph.get('b')).toEqual(new Set(['a']))\n    expect(depGraph.get('a')).toEqual(new Set())\n  })\n\n  it('should not include self-references', () => {\n    const { depGraph } = graphFromCode('const a = () => a()')\n    expect(depGraph.get('a')!.has('a')).toBe(false)\n  })\n\n  it('should not include imported identifiers', () => {\n    const { depGraph } = graphFromCode(\n      \"import { ext } from './mod'\\nconst a = ext + 1\",\n    )\n    // ext is not in locals, so not in deps\n    expect(depGraph.get('a')!.has('ext')).toBe(false)\n  })\n\n  it('should handle multiple deps', () => {\n    const { depGraph } = graphFromCode(\n      'const a = 1\\nconst b = 2\\nconst c = a + b',\n    )\n    expect(depGraph.get('c')).toEqual(new Set(['a', 'b']))\n  })\n\n  it('should handle function declaration deps', () => {\n    const { depGraph } = graphFromCode(\n      'const config = {}\\nfunction init() { return config }',\n    )\n    expect(depGraph.get('init')).toEqual(new Set(['config']))\n  })\n\n  it('should handle chain deps (each link direct only)', () => {\n    const { depGraph } = graphFromCode('const a = 1\\nconst b = a\\nconst c = b')\n    expect(depGraph.get('c')).toEqual(new Set(['b']))\n    expect(depGraph.get('b')).toEqual(new Set(['a']))\n    expect(depGraph.get('a')).toEqual(new Set())\n  })\n})\n\n// ─── collectModuleLevelRefsFromNode ────────────────────────\n\ndescribe('collectModuleLevelRefsFromNode', () => {\n  it('should find identifier reference in expression', () => {\n    const code = 'const x = 1\\nconst y = x + 1'\n    const ast = parse(code)\n    const locals = new Set(['x', 'y'])\n\n    const yDecl = ast.program.body[1] as t.VariableDeclaration\n    const valueNode = yDecl.declarations[0]!.init!\n\n    const refs = collectModuleLevelRefsFromNode(valueNode, locals)\n    expect(refs).toContain('x')\n    expect(refs).not.toContain('y')\n  })\n\n  it('should return empty set when no local bindings referenced', () => {\n    const code = \"import { foo } from './mod'\\nconst x = foo()\"\n    const ast = parse(code)\n    const locals = new Set(['x']) // foo is imported, not local\n\n    const xDecl = ast.program.body[1] as t.VariableDeclaration\n    const valueNode = xDecl.declarations[0]!.init!\n\n    const refs = collectModuleLevelRefsFromNode(valueNode, locals)\n    expect(refs.size).toBe(0)\n  })\n\n  it('should find multiple references', () => {\n    const code = 'const a = 1\\nconst b = 2\\nconst c = a + b'\n    const ast = parse(code)\n    const locals = new Set(['a', 'b', 'c'])\n\n    const cDecl = ast.program.body[2] as t.VariableDeclaration\n    const valueNode = cDecl.declarations[0]!.init!\n\n    const refs = collectModuleLevelRefsFromNode(valueNode, locals)\n    expect(refs).toContain('a')\n    expect(refs).toContain('b')\n  })\n\n  it('should find refs inside function call arguments', () => {\n    const code = 'const config = {}\\nconst result = process(config)'\n    const ast = parse(code)\n    const locals = new Set(['config', 'result'])\n\n    const resultDecl = ast.program.body[1] as t.VariableDeclaration\n    const valueNode = resultDecl.declarations[0]!.init!\n\n    const refs = collectModuleLevelRefsFromNode(valueNode, locals)\n    expect(refs).toContain('config')\n  })\n\n  it('should only return direct refs (not transitive)', () => {\n    const code = 'const a = 1\\nconst b = a\\nconst c = b'\n    const ast = parse(code)\n    const locals = new Set(['a', 'b', 'c'])\n\n    const cDecl = ast.program.body[2] as t.VariableDeclaration\n    const valueNode = cDecl.declarations[0]!.init!\n\n    const refs = collectModuleLevelRefsFromNode(valueNode, locals)\n    // Only b is directly referenced, NOT a (transitive expansion is separate)\n    expect(refs).toContain('b')\n    expect(refs).not.toContain('a')\n  })\n})\n\n// ─── expandTransitively ───────────────────────────────────\n\ndescribe('expandTransitively', () => {\n  it('should expand shared set with deps of shared bindings', () => {\n    const { depGraph } = graphFromCode('const dep = 1\\nconst shared = dep + 1')\n    const shared = new Set(['shared'])\n\n    expandTransitively(shared, depGraph)\n    expect(shared).toContain('dep')\n  })\n\n  it('should handle multi-level transitive expansion', () => {\n    const { depGraph } = graphFromCode('const a = 1\\nconst b = a\\nconst c = b')\n    const shared = new Set(['c'])\n\n    expandTransitively(shared, depGraph)\n    expect(shared).toContain('b')\n    expect(shared).toContain('a')\n  })\n\n  it('should not expand bindings not in graph', () => {\n    const depGraph = new Map<string, Set<string>>()\n    depGraph.set('shared', new Set(['ext']))\n    // ext has no entry in graph\n    const shared = new Set(['shared'])\n\n    expandTransitively(shared, depGraph)\n    // ext added because it's a dep, even if it has no graph entry\n    expect(shared).toContain('ext')\n    expect(shared.size).toBe(2)\n  })\n\n  it('should not loop on circular references', () => {\n    const { depGraph } = graphFromCode(\n      'const a = () => b()\\nconst b = () => a()',\n    )\n    const shared = new Set(['a'])\n\n    expandTransitively(shared, depGraph)\n    expect(shared).toContain('a')\n    expect(shared).toContain('b')\n  })\n\n  it('should leave shared untouched when binding has no deps', () => {\n    const depGraph = new Map<string, Set<string>>()\n    depGraph.set('x', new Set())\n    const shared = new Set(['x'])\n\n    expandTransitively(shared, depGraph)\n    expect(shared.size).toBe(1)\n    expect(shared).toContain('x')\n  })\n\n  it('should handle function declaration deps', () => {\n    const { depGraph } = graphFromCode(\n      'const config = {}\\nfunction init() { return config }',\n    )\n    const shared = new Set(['init'])\n\n    expandTransitively(shared, depGraph)\n    expect(shared).toContain('config')\n  })\n\n  it('should handle empty graph', () => {\n    const depGraph = new Map<string, Set<string>>()\n    const shared = new Set(['x'])\n\n    expandTransitively(shared, depGraph)\n    expect(shared.size).toBe(1)\n  })\n})\n\n// ─── expandDestructuredDeclarations ───────────────────────\n\ndescribe('expandDestructuredDeclarations', () => {\n  it('should add all siblings when one destructured binding is shared', () => {\n    const ast = parse('const { a, b, c } = fn()')\n    const shared = new Set(['a'])\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toContain('a')\n    expect(shared).toContain('b')\n    expect(shared).toContain('c')\n  })\n\n  it('should handle array destructuring', () => {\n    const ast = parse('const [x, y] = fn()')\n    const shared = new Set(['y'])\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toContain('x')\n    expect(shared).toContain('y')\n  })\n\n  it('should not expand non-destructured declarations', () => {\n    const ast = parse('const a = 1\\nconst b = 2')\n    const shared = new Set(['a'])\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toContain('a')\n    expect(shared).not.toContain('b')\n  })\n\n  it('should handle exported destructured declarations', () => {\n    const ast = parse('export const { a, b } = fn()')\n    const shared = new Set(['b'])\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toContain('a')\n    expect(shared).toContain('b')\n  })\n\n  it('should not touch declarations where no binding is shared', () => {\n    const ast = parse('const { a, b } = fn()\\nconst { c, d } = other()')\n    const shared = new Set(['a'])\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toContain('a')\n    expect(shared).toContain('b')\n    expect(shared).not.toContain('c')\n    expect(shared).not.toContain('d')\n  })\n\n  it('should handle nested destructuring', () => {\n    const ast = parse('const { a, b: { c } } = fn()')\n    const shared = new Set(['a'])\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toContain('a')\n    expect(shared).toContain('c')\n  })\n\n  it('should handle destructuring with defaults', () => {\n    const ast = parse('const { a = 1, b = 2 } = fn()')\n    const shared = new Set(['a'])\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toContain('b')\n  })\n\n  it('should handle destructuring with rest', () => {\n    const ast = parse('const { a, ...rest } = fn()')\n    const shared = new Set(['a'])\n\n    expandDestructuredDeclarations(ast, shared)\n    expect(shared).toContain('rest')\n  })\n})\n\n// ─── computeSharedBindings (integration) ──────────────────\n\ndescribe('computeSharedBindings', () => {\n  const defaultGroupings = defaultCodeSplitGroupings\n\n  it('should return empty set when no route options exist', () => {\n    const code = 'const x = 1'\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('should return empty set for root routes (unsplittable)', () => {\n    const code = `\nimport { createRootRoute } from '@tanstack/react-router'\nconst shared = 42\nexport const Route = createRootRoute({\n  component: () => shared,\n  beforeLoad: () => shared,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('should detect binding shared between split and non-split properties', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst sharedValue = 42\nexport const Route = createFileRoute('/')({\n  component: () => sharedValue,\n  beforeLoad: () => sharedValue,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).toContain('sharedValue')\n  })\n\n  it('should NOT mark binding as shared if only used by split properties', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst myComponent = () => <div />\nexport const Route = createFileRoute('/')({\n  component: myComponent,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('should NOT mark binding as shared if only used by non-split properties', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst validator = () => true\nexport const Route = createFileRoute('/')({\n  component: () => <div />,\n  beforeLoad: validator,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('should detect shared function declaration', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nfunction helperFn() { return 42 }\nexport const Route = createFileRoute('/')({\n  component: () => helperFn(),\n  beforeLoad: () => helperFn(),\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).toContain('helperFn')\n  })\n\n  it('should mark shared when binding used by two different split groups', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nclass Config { value = 1 }\nexport const Route = createFileRoute('/')({\n  component: () => new Config(),\n  loader: () => new Config(),\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: [['component'], ['loader']],\n    })\n    // component and loader are in different split groups → Config is shared\n    expect(result).toContain('Config')\n  })\n\n  it('should detect shared class when used by split and non-split', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nclass Config { value = 1 }\nexport const Route = createFileRoute('/')({\n  component: () => new Config(),\n  beforeLoad: () => new Config(),\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).toContain('Config')\n  })\n\n  it('should expand transitive deps into shared set', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst BASE = 10\nconst multiplier = BASE * 2\nexport const Route = createFileRoute('/')({\n  component: () => multiplier,\n  beforeLoad: () => multiplier,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).toContain('multiplier')\n    expect(result).toContain('BASE')\n  })\n\n  it('should expand destructured declarations', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst { a, b } = getValues()\nexport const Route = createFileRoute('/')({\n  component: () => a,\n  beforeLoad: () => a,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).toContain('a')\n    expect(result).toContain('b')\n  })\n\n  it('should handle no local bindings gracefully', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nexport const Route = createFileRoute('/')({\n  component: () => <div />,\n  beforeLoad: () => {},\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result.size).toBe(0)\n  })\n\n  it('should not include imported bindings as shared (bundlers dedupe them)', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nimport { helper } from './utils'\nexport const Route = createFileRoute('/')({\n  component: () => helper(),\n  beforeLoad: () => helper(),\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).not.toContain('helper')\n    expect(result.size).toBe(0)\n  })\n\n  it('should handle multiple shared bindings', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst a = 1\nconst b = 2\nexport const Route = createFileRoute('/')({\n  component: () => a + b,\n  beforeLoad: () => a + b,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).toContain('a')\n    expect(result).toContain('b')\n  })\n\n  it('should handle chained createFileRoute call pattern', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst data = { value: 42 }\nexport const Route = createFileRoute('/')({\n  component: () => data.value,\n  validateSearch: () => data,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).toContain('data')\n  })\n\n  it('should handle loader in default groupings (not split by default)', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst config = { key: 'value' }\nexport const Route = createFileRoute('/')({\n  component: () => config.key,\n  loader: () => config,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    // In default groupings, loader is NOT split → non-split\n    // component IS split → config referenced by both → shared\n    expect(result).toContain('config')\n  })\n\n  it('should handle custom groupings where loader and component are in different split groups', () => {\n    const groupings: CodeSplitGroupings = [['component'], ['loader']]\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst config = { key: 'value' }\nexport const Route = createFileRoute('/')({\n  component: () => config.key,\n  loader: () => config,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: groupings,\n    })\n    // component and loader are in different split groups → config is shared\n    expect(result).toContain('config')\n  })\n\n  it('should NOT mark shared when binding used by only one split group', () => {\n    const groupings: CodeSplitGroupings = [\n      ['loader', 'component'],\n      ['errorComponent'],\n    ]\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst config = { key: 'value' }\nexport const Route = createFileRoute('/')({\n  component: () => config.key,\n  loader: () => config,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: groupings,\n    })\n    // component and loader are in the SAME split group → config only in one group → not shared\n    expect(result.size).toBe(0)\n  })\n\n  it('should handle custom groupings with non-split property referencing shared binding', () => {\n    const groupings: CodeSplitGroupings = [['component'], ['loader']]\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst config = { key: 'value' }\nexport const Route = createFileRoute('/')({\n  component: () => config.key,\n  loader: () => config,\n  beforeLoad: () => config,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: groupings,\n    })\n    // config used by component (split), loader (split), beforeLoad (non-split)\n    // In both splitRefs and nonSplitRefs → shared\n    expect(result).toContain('config')\n  })\n\n  it('should handle deep transitive chain with destructuring', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst base = 10\nconst { x, y } = compute(base)\nexport const Route = createFileRoute('/')({\n  component: () => x,\n  beforeLoad: () => x,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    // x is shared → y must be shared (destructured together)\n    // base is a transitive dep of {x, y} declaration → also shared\n    expect(result).toContain('x')\n    expect(result).toContain('y')\n    expect(result).toContain('base')\n  })\n\n  it('should NOT include bindings that transitively depend on Route', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst HEADER = 'Page'\nfunction usePageTitle() { return HEADER + ' - ' + Route.fullPath }\nexport const Route = createFileRoute('/about')({\n  loader: () => usePageTitle(),\n  component: () => usePageTitle(),\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    // usePageTitle references Route → cannot be shared\n    expect(result).not.toContain('usePageTitle')\n    // HEADER does NOT reference Route → still safe to share\n    expect(result).toContain('HEADER')\n    // Route must never be shared\n    expect(result).not.toContain('Route')\n  })\n\n  it('should remove entire transitive chain if it reaches Route', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst routeInfo = { path: '' }\nfunction initRouteInfo() { routeInfo.path = Route.fullPath }\nfunction getTitle() { initRouteInfo(); return routeInfo.path }\nexport const Route = createFileRoute('/test')({\n  loader: () => getTitle(),\n  component: () => getTitle(),\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    // getTitle → initRouteInfo → Route: entire chain cannot be shared\n    expect(result).not.toContain('getTitle')\n    expect(result).not.toContain('initRouteInfo')\n    expect(result).not.toContain('Route')\n    // routeInfo doesn't reference Route directly, but initRouteInfo does\n    // routeInfo itself may or may not be shared depending on its own deps\n  })\n\n  it('should keep bindings that do NOT depend on Route alongside ones that do', () => {\n    const code = `\nimport { createFileRoute } from '@tanstack/react-router'\nconst safeConfig = { timeout: 5000 }\nfunction unsafeHelper() { return Route.fullPath }\nexport const Route = createFileRoute('/mixed')({\n  loader: () => ({ config: safeConfig, path: unsafeHelper() }),\n  component: () => <div>{safeConfig.timeout} {unsafeHelper()}</div>,\n})\n`\n    const result = computeSharedBindings({\n      code,\n      codeSplitGroupings: defaultGroupings,\n    })\n    expect(result).toContain('safeConfig')\n    expect(result).not.toContain('unsafeHelper')\n    expect(result).not.toContain('Route')\n  })\n})\n\n// ─── removeBindingsDependingOnRoute ───────────────────────\n\ndescribe('removeBindingsDependingOnRoute', () => {\n  it('should remove a binding that directly depends on Route', () => {\n    const depGraph = new Map<string, Set<string>>()\n    depGraph.set('helper', new Set(['Route']))\n    depGraph.set('Route', new Set())\n    const shared = new Set(['helper'])\n\n    removeBindingsDependingOnRoute(shared, depGraph)\n    expect(shared).not.toContain('helper')\n  })\n\n  it('should remove a binding that transitively depends on Route', () => {\n    const depGraph = new Map<string, Set<string>>()\n    depGraph.set('a', new Set(['b']))\n    depGraph.set('b', new Set(['Route']))\n    depGraph.set('Route', new Set())\n    const shared = new Set(['a'])\n\n    removeBindingsDependingOnRoute(shared, depGraph)\n    expect(shared).not.toContain('a')\n  })\n\n  it('should keep a binding that does NOT depend on Route', () => {\n    const depGraph = new Map<string, Set<string>>()\n    depGraph.set('safe', new Set(['dep']))\n    depGraph.set('dep', new Set())\n    depGraph.set('Route', new Set())\n    const shared = new Set(['safe'])\n\n    removeBindingsDependingOnRoute(shared, depGraph)\n    expect(shared).toContain('safe')\n  })\n\n  it('should handle mixed: remove Route-dependent, keep safe bindings', () => {\n    const depGraph = new Map<string, Set<string>>()\n    depGraph.set('safe', new Set(['dep']))\n    depGraph.set('dep', new Set())\n    depGraph.set('unsafe', new Set(['Route']))\n    depGraph.set('Route', new Set())\n    const shared = new Set(['safe', 'unsafe'])\n\n    removeBindingsDependingOnRoute(shared, depGraph)\n    expect(shared).toContain('safe')\n    expect(shared).not.toContain('unsafe')\n  })\n\n  it('should handle empty shared set', () => {\n    const depGraph = new Map<string, Set<string>>()\n    const shared = new Set<string>()\n\n    removeBindingsDependingOnRoute(shared, depGraph)\n    expect(shared.size).toBe(0)\n  })\n\n  it('should handle binding with no graph entry', () => {\n    const depGraph = new Map<string, Set<string>>()\n    const shared = new Set(['orphan'])\n\n    removeBindingsDependingOnRoute(shared, depGraph)\n    // No deps found → does not depend on Route → keep\n    expect(shared).toContain('orphan')\n  })\n\n  it('should handle circular deps that do NOT reach Route', () => {\n    const depGraph = new Map<string, Set<string>>()\n    depGraph.set('a', new Set(['b']))\n    depGraph.set('b', new Set(['a']))\n    depGraph.set('Route', new Set())\n    const shared = new Set(['a'])\n\n    removeBindingsDependingOnRoute(shared, depGraph)\n    expect(shared).toContain('a')\n  })\n\n  it('should handle circular deps that DO reach Route', () => {\n    const depGraph = new Map<string, Set<string>>()\n    depGraph.set('a', new Set(['b']))\n    depGraph.set('b', new Set(['a', 'Route']))\n    depGraph.set('Route', new Set())\n    const shared = new Set(['a'])\n\n    removeBindingsDependingOnRoute(shared, depGraph)\n    expect(shared).not.toContain('a')\n  })\n})\n"
  },
  {
    "path": "packages/router-plugin/tests/utils.test.ts",
    "content": "import * as babel from '@babel/core'\nimport { parseAst } from '@tanstack/router-utils'\nimport { describe, expect, it } from 'vitest'\nimport { getUniqueProgramIdentifier, normalizePath } from '../src/core/utils'\nimport type { NodePath } from '@babel/core'\nimport type * as t from '@babel/types'\n\nfunction getProgramPath(code: string): NodePath<t.Program> {\n  const ast = parseAst({ code })\n  let programPath: NodePath<t.Program> | undefined\n\n  babel.traverse(ast, {\n    Program(path: NodePath<t.Program>) {\n      programPath = path\n      path.stop()\n    },\n  })\n\n  if (!programPath) {\n    throw new Error('Program path not found')\n  }\n\n  return programPath\n}\n\ndescribe('normalizePath', () => {\n  it('should convert Windows backslashes to forward slashes', () => {\n    expect(normalizePath('C:\\\\Users\\\\project\\\\src\\\\routes\\\\index.tsx')).toBe(\n      'C:/Users/project/src/routes/index.tsx',\n    )\n  })\n\n  it('should handle mixed slashes', () => {\n    expect(normalizePath('C:/Users\\\\project/src\\\\routes/index.tsx')).toBe(\n      'C:/Users/project/src/routes/index.tsx',\n    )\n  })\n\n  it('should leave forward slashes unchanged', () => {\n    expect(normalizePath('/home/user/project/src/routes/index.tsx')).toBe(\n      '/home/user/project/src/routes/index.tsx',\n    )\n  })\n\n  it('should handle relative paths with backslashes', () => {\n    expect(normalizePath('src\\\\routes\\\\index.tsx')).toBe('src/routes/index.tsx')\n  })\n\n  it('should handle empty string', () => {\n    expect(normalizePath('')).toBe('')\n  })\n\n  it('should handle path with query string', () => {\n    expect(normalizePath('C:\\\\project\\\\file.tsx?tsr-split=component')).toBe(\n      'C:/project/file.tsx?tsr-split=component',\n    )\n  })\n})\n\ndescribe('getUniqueProgramIdentifier', () => {\n  it('returns the base name when unused', () => {\n    const programPath = getProgramPath('const existing = 1')\n\n    expect(getUniqueProgramIdentifier(programPath, 'TSRComponent').name).toBe(\n      'TSRComponent',\n    )\n  })\n\n  it('appends numeric suffixes for existing bindings', () => {\n    const programPath = getProgramPath(\n      'const TSRComponent = 1\\nconst TSRComponent2 = 2',\n    )\n\n    expect(getUniqueProgramIdentifier(programPath, 'TSRComponent').name).toBe(\n      'TSRComponent3',\n    )\n  })\n\n  it('avoids globals too', () => {\n    const programPath = getProgramPath('const existing = window')\n\n    expect(getUniqueProgramIdentifier(programPath, 'window').name).toBe(\n      'window2',\n    )\n  })\n})\n"
  },
  {
    "path": "packages/router-plugin/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\", \"tests\"],\n  \"exclude\": [\"tests/**/test-files/**\", \"tests/**/snapshots/**\"],\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\"\n  }\n}\n"
  },
  {
    "path": "packages/router-plugin/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    typecheck: { enabled: true },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: [\n      './src/index.ts',\n      './src/vite.ts',\n      './src/rspack.ts',\n      './src/webpack.ts',\n      './src/esbuild.ts',\n    ],\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/router-ssr-query-core/CHANGELOG.md",
    "content": "# @tanstack/router-ssr-query-core\n\n## 1.167.0\n\n### Minor Changes\n\n- remove pendingMatches, cachedMatches ([#6704](https://github.com/TanStack/router/pull/6704))\n  move to signal-based reactivity\n  solid uses its own native signals\n\n## 1.166.9\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n## 1.166.8\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n"
  },
  {
    "path": "packages/router-ssr-query-core/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack Router Core\n\nSee [https://tanstack.com/router](https://tanstack.com/router) for documentation.\n"
  },
  {
    "path": "packages/router-ssr-query-core/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/router-ssr-query-core/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-ssr-query-core\",\n  \"version\": \"1.167.0\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-ssr-query-core\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:unit\": \"exit 0; vitest\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"devDependencies\": {\n    \"@tanstack/router-core\": \">=1.168.0\",\n    \"@tanstack/query-core\": \">=5.90.0\",\n    \"vite\": \"*\"\n  },\n  \"peerDependencies\": {\n    \"@tanstack/router-core\": \">=1.127.0\",\n    \"@tanstack/query-core\": \">=5.90.0\"\n  }\n}\n"
  },
  {
    "path": "packages/router-ssr-query-core/src/index.ts",
    "content": "import {\n  dehydrate as queryDehydrate,\n  hydrate as queryHydrate,\n} from '@tanstack/query-core'\nimport { isRedirect } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport type { AnyRouter } from '@tanstack/router-core'\nimport type {\n  QueryClient,\n  DehydratedState as QueryDehydratedState,\n} from '@tanstack/query-core'\n\nexport type RouterSsrQueryOptions<TRouter extends AnyRouter> = {\n  router: TRouter\n  queryClient: QueryClient\n\n  /**\n   * If `true`, the QueryClient will handle errors thrown by `redirect()` inside of mutations and queries.\n   *\n   * @default true\n   * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/api/router/redirectFunction)\n   */\n  handleRedirects?: boolean\n}\n\ntype DehydratedRouterQueryState = {\n  dehydratedQueryClient?: QueryDehydratedState\n  queryStream: ReadableStream<QueryDehydratedState>\n}\n\nexport function setupCoreRouterSsrQueryIntegration<TRouter extends AnyRouter>({\n  router,\n  queryClient,\n  handleRedirects = true,\n}: RouterSsrQueryOptions<TRouter>) {\n  const ogHydrate = router.options.hydrate\n  const ogDehydrate = router.options.dehydrate\n\n  if (isServer ?? router.isServer) {\n    const sentQueries = new Set<string>()\n    const queryStream = createPushableStream()\n    let unsubscribe: (() => void) | undefined = undefined\n    router.options.dehydrate =\n      async (): Promise<DehydratedRouterQueryState> => {\n        router.serverSsr!.onRenderFinished(() => {\n          queryStream.close()\n          unsubscribe?.()\n          unsubscribe = undefined\n        })\n        const ogDehydrated = await ogDehydrate?.()\n\n        const dehydratedRouter = {\n          ...ogDehydrated,\n          // prepare the stream for queries coming up during rendering\n          queryStream: queryStream.stream,\n        }\n\n        const dehydratedQueryClient = queryDehydrate(queryClient)\n        if (dehydratedQueryClient.queries.length > 0) {\n          dehydratedQueryClient.queries.forEach((query) => {\n            sentQueries.add(query.queryHash)\n          })\n          dehydratedRouter.dehydratedQueryClient = dehydratedQueryClient\n        }\n\n        return dehydratedRouter\n      }\n\n    const ogClientOptions = queryClient.getDefaultOptions()\n    queryClient.setDefaultOptions({\n      ...ogClientOptions,\n      dehydrate: {\n        shouldDehydrateQuery: () => true,\n        ...ogClientOptions.dehydrate,\n      },\n    })\n\n    unsubscribe = queryClient.getQueryCache().subscribe((event) => {\n      // before rendering starts, we do not stream individual queries\n      // instead we dehydrate the entire query client in router's dehydrate()\n      // if attachRouterServerSsrUtils() has not been called yet, `router.serverSsr` will be undefined and we also do not stream\n      if (!router.serverSsr?.isDehydrated()) {\n        return\n      }\n      if (sentQueries.has(event.query.queryHash)) {\n        return\n      }\n      // promise not yet set on the query, so we cannot stream it yet\n      if (!event.query.promise) {\n        return\n      }\n      if (queryStream.isClosed()) {\n        console.warn(\n          `tried to stream query ${event.query.queryHash} after stream was already closed`,\n        )\n        return\n      }\n      sentQueries.add(event.query.queryHash)\n      queryStream.enqueue(\n        queryDehydrate(queryClient, {\n          shouldDehydrateQuery: (query) => {\n            if (query.queryHash === event.query.queryHash) {\n              return (\n                ogClientOptions.dehydrate?.shouldDehydrateQuery?.(query) ?? true\n              )\n            }\n            return false\n          },\n        }),\n      )\n    })\n    // on the client\n  } else {\n    router.options.hydrate = async (dehydrated: DehydratedRouterQueryState) => {\n      await ogHydrate?.(dehydrated)\n      // hydrate the query client with the dehydrated data (if it was dehydrated on the server)\n      if (dehydrated.dehydratedQueryClient) {\n        queryHydrate(queryClient, dehydrated.dehydratedQueryClient)\n      }\n\n      // read the query stream and hydrate the queries as they come in\n      const reader = dehydrated.queryStream.getReader()\n      reader\n        .read()\n        .then(async function handle({ done, value }) {\n          queryHydrate(queryClient, value)\n          if (done) {\n            return\n          }\n          const result = await reader.read()\n          return handle(result)\n        })\n        .catch((err) => {\n          console.error('Error reading query stream:', err)\n        })\n    }\n    if (handleRedirects) {\n      const ogMutationCacheConfig = queryClient.getMutationCache().config\n      queryClient.getMutationCache().config = {\n        ...ogMutationCacheConfig,\n        onError: (error, ...rest) => {\n          if (isRedirect(error)) {\n            error.options._fromLocation = router.stores.location.state\n            return router.navigate(router.resolveRedirect(error).options)\n          }\n\n          return ogMutationCacheConfig.onError?.(error, ...rest)\n        },\n      }\n\n      const ogQueryCacheConfig = queryClient.getQueryCache().config\n      queryClient.getQueryCache().config = {\n        ...ogQueryCacheConfig,\n        onError: (error, ...rest) => {\n          if (isRedirect(error)) {\n            error.options._fromLocation = router.stores.location.state\n            return router.navigate(router.resolveRedirect(error).options)\n          }\n\n          return ogQueryCacheConfig.onError?.(error, ...rest)\n        },\n      }\n    }\n  }\n}\n\ntype PushableStream = {\n  stream: ReadableStream\n  enqueue: (chunk: unknown) => void\n  close: () => void\n  isClosed: () => boolean\n  error: (err: unknown) => void\n}\n\nfunction createPushableStream(): PushableStream {\n  let controllerRef: ReadableStreamDefaultController\n  const stream = new ReadableStream({\n    start(controller) {\n      controllerRef = controller\n    },\n  })\n  let _isClosed = false\n\n  return {\n    stream,\n    enqueue: (chunk) => controllerRef.enqueue(chunk),\n    close: () => {\n      controllerRef.close()\n      _isClosed = true\n    },\n    isClosed: () => _isClosed,\n    error: (err: unknown) => controllerRef.error(err),\n  }\n}\n"
  },
  {
    "path": "packages/router-ssr-query-core/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\", \"tests\", \"vite-minify-plugin.ts\"]\n}\n"
  },
  {
    "path": "packages/router-ssr-query-core/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport packageJson from './package.json'\nimport type { ViteUserConfig } from 'vitest/config'\n\nconst config = defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    environment: 'jsdom',\n    typecheck: { enabled: true },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: ['./src/index.ts'],\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/router-utils/CHANGELOG.md",
    "content": "# @tanstack/router-utils\n\n## 1.161.6\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n## 1.161.5\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n"
  },
  {
    "path": "packages/router-utils/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/router-utils/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-utils\",\n  \"version\": \"1.161.6\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-utils\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:unit\": \"exit 0; vitest --typecheck\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@babel/core\": \"^7.28.5\",\n    \"@babel/generator\": \"^7.28.5\",\n    \"@babel/parser\": \"^7.28.5\",\n    \"@babel/types\": \"^7.28.5\",\n    \"ansis\": \"^4.1.0\",\n    \"babel-dead-code-elimination\": \"^1.0.12\",\n    \"diff\": \"^8.0.2\",\n    \"pathe\": \"^2.0.3\",\n    \"tinyglobby\": \"^0.2.15\"\n  },\n  \"devDependencies\": {\n    \"@types/babel__core\": \"^7.20.5\",\n    \"@types/babel__generator\": \"^7.27.0\",\n    \"@types/diff\": \"^7.0.2\",\n    \"vite\": \"*\"\n  }\n}\n"
  },
  {
    "path": "packages/router-utils/src/ast.ts",
    "content": "import { parse } from '@babel/parser'\nimport _generate from '@babel/generator'\nimport * as t from '@babel/types'\nimport {\n  deadCodeElimination as _deadCodeElimination,\n  findReferencedIdentifiers,\n} from 'babel-dead-code-elimination'\nimport type { GeneratorOptions, GeneratorResult } from '@babel/generator'\nimport type { ParseResult, ParserOptions } from '@babel/parser'\nimport type * as _babel_types from '@babel/types'\n\nexport type ParseAstOptions = ParserOptions & {\n  code: string\n}\n\nexport type ParseAstResult = ParseResult<_babel_types.File>\nexport function parseAst({ code, ...opts }: ParseAstOptions): ParseAstResult {\n  return parse(code, {\n    plugins: ['jsx', 'typescript', 'explicitResourceManagement'],\n    sourceType: 'module',\n    ...opts,\n  })\n}\n\nlet generate = _generate\n\nif ('default' in generate) {\n  generate = generate.default as typeof generate\n}\ntype GenerateFromAstOptions = GeneratorOptions &\n  Required<Pick<GeneratorOptions, 'sourceFileName' | 'filename'>>\nexport function generateFromAst(\n  ast: _babel_types.Node,\n  opts?: GenerateFromAstOptions,\n): GeneratorResult {\n  return generate(\n    ast,\n    opts\n      ? { importAttributesKeyword: 'with', sourceMaps: true, ...opts }\n      : undefined,\n  )\n}\nexport type { GeneratorResult } from '@babel/generator'\n\n/**\n * Strips TypeScript type-only exports and imports from an AST.\n *\n * This is necessary because babel-dead-code-elimination doesn't handle\n * TypeScript type exports/imports. When a type export references an import\n * that pulls in server-only code, the dead code elimination won't remove\n * that import because it sees the type as still referencing it.\n *\n * This function removes:\n * - `export type Foo = ...`\n * - `export interface Foo { ... }`\n * - `export type { Foo } from './module'`\n * - `export type * from './module'`\n * - Type specifiers in mixed exports: `export { value, type Foo }` -> `export { value }`\n * - `import type { Foo } from './module'`\n * - Type specifiers in mixed imports: `import { value, type Foo } from './module'` -> `import { value }`\n *\n * Note: Non-exported type/interface declarations are preserved as they may be\n * used as type annotations within the code.\n *\n * @param ast - The Babel AST (or ParseResult) to mutate\n */\nexport function stripTypeExports(ast: ParseResult<_babel_types.File>): void {\n  // Filter the program body to remove type-only nodes\n  ast.program.body = ast.program.body.filter((node) => {\n    // Handle export declarations\n    if (t.isExportNamedDeclaration(node)) {\n      // Remove entire export if it's a type-only export\n      // e.g., `export type Foo = string`, `export interface Bar {}`, `export type { X } from './y'`\n      if (node.exportKind === 'type') {\n        return false\n      }\n\n      // For value exports with mixed specifiers, filter out type-only specifiers\n      // e.g., `export { value, type TypeOnly }` -> `export { value }`\n      if (node.specifiers.length > 0) {\n        node.specifiers = node.specifiers.filter((specifier) => {\n          if (t.isExportSpecifier(specifier)) {\n            return specifier.exportKind !== 'type'\n          }\n          return true\n        })\n\n        // If all specifiers were removed, remove the entire export declaration\n        // (unless it has a declaration like `export const x = 1`)\n        if (node.specifiers.length === 0 && !node.declaration) {\n          return false\n        }\n      }\n    }\n\n    // Handle type-only export-all declarations\n    // e.g., `export type * from './module'`\n    if (t.isExportAllDeclaration(node)) {\n      if (node.exportKind === 'type') {\n        return false\n      }\n    }\n\n    // Handle import declarations\n    if (t.isImportDeclaration(node)) {\n      // Remove entire import if it's a type-only import\n      // e.g., `import type { Foo } from './module'`\n      if (node.importKind === 'type') {\n        return false\n      }\n\n      // For value imports with mixed specifiers, filter out type-only specifiers\n      // e.g., `import { value, type TypeOnly } from './module'` -> `import { value }`\n      if (node.specifiers.length > 0) {\n        node.specifiers = node.specifiers.filter((specifier) => {\n          if (t.isImportSpecifier(specifier)) {\n            return specifier.importKind !== 'type'\n          }\n          return true\n        })\n\n        // If all specifiers were removed, remove the entire import declaration\n        if (node.specifiers.length === 0) {\n          return false\n        }\n      }\n    }\n\n    return true\n  })\n}\n\n// Re-export findReferencedIdentifiers from babel-dead-code-elimination\nexport { findReferencedIdentifiers }\n\n/**\n * Performs dead code elimination on the AST, with TypeScript type stripping.\n *\n * This is a wrapper around babel-dead-code-elimination that first strips\n * TypeScript type-only exports and imports. This is necessary because\n * babel-dead-code-elimination doesn't handle type exports, which can cause\n * imports to be retained when they're only referenced by type exports.\n *\n * @param ast - The Babel AST to mutate\n * @param candidates - Optional set of identifier paths to consider for removal.\n *                     If provided, only these identifiers will be candidates for removal.\n *                     This should be the result of `findReferencedIdentifiers(ast)` called\n *                     before any AST transformations.\n */\nexport function deadCodeElimination(\n  ast: ParseResult<_babel_types.File>,\n  candidates?: ReturnType<typeof findReferencedIdentifiers>,\n): void {\n  // First strip TypeScript type-only exports and imports\n  stripTypeExports(ast)\n\n  // Then run the original dead code elimination\n  _deadCodeElimination(ast, candidates)\n}\n"
  },
  {
    "path": "packages/router-utils/src/copy-files-plugin.ts",
    "content": "import { copyFile, mkdir } from 'node:fs/promises'\nimport { dirname, join } from 'pathe'\nimport { glob } from 'tinyglobby'\nimport type { Plugin } from 'vite'\n\nexport function copyFilesPlugin({\n  fromDir,\n  toDir,\n  pattern = '**',\n}: {\n  pattern?: string | Array<string>\n  fromDir: string\n  toDir: string\n}): Plugin {\n  return {\n    name: 'copy-files',\n    async writeBundle() {\n      const entries = await glob(pattern, { cwd: fromDir })\n      if (entries.length === 0) {\n        throw new Error(\n          `No files found matching pattern \"${pattern}\" in directory \"${fromDir}\"`,\n        )\n      }\n\n      for (const entry of entries) {\n        const srcPath = join(fromDir, entry)\n        const destPath = join(toDir, entry)\n        // Ensure the destination directory exists\n        await mkdir(dirname(destPath), { recursive: true })\n        await copyFile(srcPath, destPath)\n      }\n    },\n  }\n}\n"
  },
  {
    "path": "packages/router-utils/src/index.ts",
    "content": "export {\n  parseAst,\n  generateFromAst,\n  deadCodeElimination,\n  findReferencedIdentifiers,\n  stripTypeExports,\n} from './ast'\nexport type { ParseAstOptions, ParseAstResult, GeneratorResult } from './ast'\nexport { logDiff } from './logger'\n\nexport { copyFilesPlugin } from './copy-files-plugin'\n"
  },
  {
    "path": "packages/router-utils/src/logger.ts",
    "content": "import ansis from 'ansis'\nimport { diffWords } from 'diff'\n\nexport function logDiff(oldStr: string, newStr: string) {\n  const differences = diffWords(oldStr, newStr)\n\n  let output = ''\n  let unchangedLines = ''\n\n  function processUnchangedLines(lines: string): string {\n    const lineArray = lines.split('\\n')\n    if (lineArray.length > 4) {\n      return [\n        ansis.dim(lineArray[0]),\n        ansis.dim(lineArray[1]),\n        '',\n        ansis.dim.bold(`... (${lineArray.length - 4} lines) ...`),\n        '',\n        ansis.dim(lineArray[lineArray.length - 2]),\n        ansis.dim(lineArray[lineArray.length - 1]),\n      ].join('\\n')\n    }\n    return ansis.dim(lines)\n  }\n\n  differences.forEach((part, index) => {\n    const nextPart = differences[index + 1]\n\n    if (part.added) {\n      if (unchangedLines) {\n        output += processUnchangedLines(unchangedLines)\n        unchangedLines = ''\n      }\n      output += ansis.green.bold(part.value)\n      if (nextPart?.removed) output += ' '\n    } else if (part.removed) {\n      if (unchangedLines) {\n        output += processUnchangedLines(unchangedLines)\n        unchangedLines = ''\n      }\n      output += ansis.red.bold(part.value)\n      if (nextPart?.added) output += ' '\n    } else {\n      unchangedLines += part.value\n    }\n  })\n\n  // Process any remaining unchanged lines at the end\n  if (unchangedLines) {\n    output += processUnchangedLines(unchangedLines)\n  }\n\n  if (output) {\n    console.log('\\nDiff:')\n    console.log(output + '\\n\\n')\n  } else {\n    console.log('No changes')\n  }\n}\n"
  },
  {
    "path": "packages/router-utils/tests/stripTypeExports.test.ts",
    "content": "import { describe, expect, test } from 'vitest'\nimport { generateFromAst, parseAst, stripTypeExports } from '../src/ast'\n\nfunction transform(code: string): string {\n  const ast = parseAst({ code })\n  stripTypeExports(ast)\n  return generateFromAst(ast, {\n    sourceFileName: 'test.ts',\n    filename: 'test.ts',\n  }).code\n}\n\ndescribe('stripTypeExports', () => {\n  describe('type alias declarations', () => {\n    test('preserves top-level type alias declaration (non-exported)', () => {\n      const code = `type Foo = string;\nconst value = 1;`\n      const result = transform(code)\n      expect(result).toContain('type Foo = string')\n      expect(result).toContain('const value = 1')\n    })\n\n    test('removes export type alias declaration', () => {\n      const code = `export type Foo = string;\nexport const value = 1;`\n      const result = transform(code)\n      expect(result).not.toContain('type Foo')\n      expect(result).toContain('export const value = 1')\n    })\n  })\n\n  describe('interface declarations', () => {\n    test('preserves top-level interface declaration (non-exported)', () => {\n      const code = `interface Bar { x: number }\nconst value = 1;`\n      const result = transform(code)\n      expect(result).toContain('interface Bar')\n      expect(result).toContain('const value = 1')\n    })\n\n    test('removes export interface declaration', () => {\n      const code = `export interface Bar { x: number }\nexport const value = 1;`\n      const result = transform(code)\n      expect(result).not.toContain('interface Bar')\n      expect(result).toContain('export const value = 1')\n    })\n  })\n\n  describe('type re-exports', () => {\n    test('removes export type { X } from syntax', () => {\n      const code = `export type { Foo } from './other';\nexport const value = 1;`\n      const result = transform(code)\n      expect(result).not.toContain('Foo')\n      expect(result).not.toContain('./other')\n      expect(result).toContain('export const value = 1')\n    })\n\n    test('removes export type { X as Y } from syntax', () => {\n      const code = `export type { Foo as Bar } from './other';\nexport const value = 1;`\n      const result = transform(code)\n      expect(result).not.toContain('Foo')\n      expect(result).not.toContain('Bar')\n      expect(result).toContain('export const value = 1')\n    })\n\n    test('removes export type * from syntax', () => {\n      const code = `export type * from './types';\nexport const value = 1;`\n      const result = transform(code)\n      expect(result).not.toContain('./types')\n      expect(result).toContain('export const value = 1')\n    })\n\n    test('removes export type * as namespace from syntax', () => {\n      const code = `export type * as Types from './types';\nexport const value = 1;`\n      const result = transform(code)\n      expect(result).not.toContain('Types')\n      expect(result).not.toContain('./types')\n      expect(result).toContain('export const value = 1')\n    })\n\n    test('preserves regular export * from syntax', () => {\n      const code = `export * from './other';\nexport const value = 1;`\n      const result = transform(code)\n      expect(result).toContain(\"export * from './other'\")\n      expect(result).toContain('export const value = 1')\n    })\n  })\n\n  describe('mixed exports with type specifiers', () => {\n    test('removes type specifiers from mixed export', () => {\n      const code = `const value = 1;\ntype TypeOnly = string;\nexport { value, type TypeOnly };`\n      const result = transform(code)\n      expect(result).toContain('export { value }')\n      expect(result).not.toContain('TypeOnly')\n    })\n\n    test('removes entire export if all specifiers are type-only', () => {\n      const code = `type Foo = string;\ntype Bar = number;\nexport { type Foo, type Bar };\nexport const value = 1;`\n      const result = transform(code)\n      expect(result).not.toContain('export { type Foo')\n      expect(result).not.toContain('Foo')\n      expect(result).not.toContain('Bar')\n      expect(result).toContain('export const value = 1')\n    })\n  })\n\n  describe('type-only imports', () => {\n    test('removes import type declaration', () => {\n      const code = `import type { Foo } from './module';\nimport { value } from './other';`\n      const result = transform(code)\n      expect(result).not.toContain('Foo')\n      expect(result).not.toContain('./module')\n      expect(result).toContain(\"import { value } from './other'\")\n    })\n\n    test('removes import type * as namespace', () => {\n      const code = `import type * as Types from './module';\nimport { value } from './other';`\n      const result = transform(code)\n      expect(result).not.toContain('Types')\n      expect(result).not.toContain('./module')\n      expect(result).toContain(\"import { value } from './other'\")\n    })\n  })\n\n  describe('mixed imports with type specifiers', () => {\n    test('removes type specifiers from mixed import', () => {\n      const code = `import { value, type TypeOnly } from './module';`\n      const result = transform(code)\n      expect(result).toContain(\"import { value } from './module'\")\n      expect(result).not.toContain('TypeOnly')\n    })\n\n    test('removes entire import if all specifiers are type-only', () => {\n      const code = `import { type Foo, type Bar } from './module';\nimport { value } from './other';`\n      const result = transform(code)\n      expect(result).not.toContain('./module')\n      expect(result).not.toContain('Foo')\n      expect(result).not.toContain('Bar')\n      expect(result).toContain(\"import { value } from './other'\")\n    })\n  })\n\n  describe('preserves non-type code', () => {\n    test('preserves regular exports', () => {\n      const code = `export const value = 1;\nexport function foo() { return 2; }\nexport class MyClass {}`\n      const result = transform(code)\n      expect(result).toContain('export const value = 1')\n      expect(result).toContain('export function foo()')\n      expect(result).toContain('export class MyClass')\n    })\n\n    test('preserves regular imports', () => {\n      const code = `import { foo, bar } from './module';\nimport defaultExport from './other';\nimport * as namespace from './third';`\n      const result = transform(code)\n      expect(result).toContain(\"import { foo, bar } from './module'\")\n      expect(result).toContain(\"import defaultExport from './other'\")\n      expect(result).toContain(\"import * as namespace from './third'\")\n    })\n\n    test('preserves export with declaration', () => {\n      const code = `export const x = 1;\nexport function fn() {}\nexport class C {}`\n      const result = transform(code)\n      expect(result).toContain('export const x = 1')\n      expect(result).toContain('export function fn()')\n      expect(result).toContain('export class C')\n    })\n  })\n\n  describe('complex scenarios', () => {\n    test('handles file with mixed type and value exports', () => {\n      const code = `import { z } from 'zod';\nimport type { SomeType } from './types';\nimport { helper, type HelperType } from './helpers';\n\ntype LocalType = string;\ninterface LocalInterface { x: number }\n\nexport type ExportedType = z.infer<typeof schema>;\nexport interface ExportedInterface { y: string }\n\nconst schema = z.object({ name: z.string() });\nexport const myValue = 1;\nexport { helper, type HelperType };`\n\n      const result = transform(code)\n\n      // Should remove type imports\n      expect(result).not.toContain('SomeType')\n      expect(result).not.toContain('./types')\n      expect(result).not.toContain('HelperType')\n\n      // Should remove type declarations\n      expect(result).not.toContain('type LocalType')\n      expect(result).not.toContain('interface LocalInterface')\n      expect(result).not.toContain('type ExportedType')\n      expect(result).not.toContain('interface ExportedInterface')\n\n      // Should preserve value imports and exports\n      expect(result).toContain(\"import { z } from 'zod'\")\n      expect(result).toContain(\"import { helper } from './helpers'\")\n      expect(result).toContain('export const myValue = 1')\n      expect(result).toContain('export { helper }')\n    })\n\n    test('handles the issue #6480 scenario - type export referencing imported enum', () => {\n      // This simulates the problematic case from the issue:\n      // export type CreatePostInput = z.infer<typeof postSchema>;\n      // where postSchema uses an imported enum\n      const code = `import { z } from 'zod';\nimport { PostCategory } from './PostService';\n\nconst postSchema = z.object({\n  category: z.nativeEnum(PostCategory)\n});\n\nexport type CreatePostInput = z.infer<typeof postSchema>;\n\nexport const serverFn = () => {};`\n\n      const result = transform(code)\n\n      // The type export should be removed\n      expect(result).not.toContain('export type CreatePostInput')\n\n      // The value exports and imports should remain\n      expect(result).toContain(\"import { z } from 'zod'\")\n      expect(result).toContain(\"import { PostCategory } from './PostService'\")\n      expect(result).toContain('export const serverFn')\n    })\n  })\n})\n"
  },
  {
    "path": "packages/router-utils/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\", \"tests\"],\n  \"exclude\": [\"tests/generator/**/**\"]\n}\n"
  },
  {
    "path": "packages/router-utils/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\nimport packageJson from './package.json'\n\nconst config = defineConfig({\n  test: {\n    name: packageJson.name,\n    dir: './tests',\n    watch: false,\n    typecheck: { enabled: true },\n  },\n})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n  }),\n)\n"
  },
  {
    "path": "packages/router-vite-plugin/CHANGELOG.md",
    "content": "# @tanstack/router-vite-plugin\n\n## 1.166.16\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-plugin@1.167.1\n\n## 1.166.15\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/router-plugin@1.167.0\n\n## 1.166.14\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-plugin@1.166.14\n\n## 1.166.13\n\n### Patch Changes\n\n- Updated dependencies [[`940151c`](https://github.com/TanStack/router/commit/940151cbed0c76c92a5cf196c0905b17a956ca7e)]:\n  - @tanstack/router-plugin@1.166.13\n\n## 1.166.12\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-plugin@1.166.12\n\n## 1.166.11\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/router-plugin@1.166.11\n\n## 1.166.10\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/router-plugin@1.166.10\n\n## 1.166.9\n\n### Patch Changes\n\n- Updated dependencies []:\n  - @tanstack/router-plugin@1.166.9\n\n## 1.166.8\n\n### Patch Changes\n\n- Updated dependencies [[`6069eba`](https://github.com/TanStack/router/commit/6069eba64369dbddb0d8dccdb4407f0e1a82259e)]:\n  - @tanstack/router-plugin@1.166.8\n"
  },
  {
    "path": "packages/router-vite-plugin/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack Router Vite Plugin\n\nSee https://tanstack.com/router/latest/docs/framework/react/routing/file-based-routing\n"
  },
  {
    "path": "packages/router-vite-plugin/eslint.config.js",
    "content": "// @ts-check\n\nimport rootConfig from '../../eslint.config.js'\n\nexport default [...rootConfig]\n"
  },
  {
    "path": "packages/router-vite-plugin/package.json",
    "content": "{\n  \"name\": \"@tanstack/router-vite-plugin\",\n  \"version\": \"1.166.16\",\n  \"description\": \"Modern and scalable routing for React applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/router-vite-plugin\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"react\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test\": \"pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit\",\n    \"test:unit\": \"echo 'No unit tests are needed here since we do them in @tanstack/router-plugin!'\",\n    \"test:eslint\": \"eslint ./src\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js\",\n    \"test:types:ts59\": \"tsc\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@tanstack/router-plugin\": \"workspace:*\"\n  },\n  \"devDependencies\": {\n    \"vite\": \"*\"\n  }\n}\n"
  },
  {
    "path": "packages/router-vite-plugin/src/index.ts",
    "content": "export * from '@tanstack/router-plugin/vite'\nexport type * from '@tanstack/router-plugin/vite'\n"
  },
  {
    "path": "packages/router-vite-plugin/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"include\": [\"src\", \"vite.config.ts\", \"tests\"],\n  \"exclude\": [\"tests/test-files/**\", \"tests/snapshots/**\"],\n  \"compilerOptions\": {\n    \"jsx\": \"react-jsx\"\n  }\n}\n"
  },
  {
    "path": "packages/router-vite-plugin/vite.config.ts",
    "content": "import { defineConfig, mergeConfig } from 'vitest/config'\nimport { tanstackViteConfig } from '@tanstack/vite-config'\n\nconst config = defineConfig({})\n\nexport default mergeConfig(\n  config,\n  tanstackViteConfig({\n    entry: './src/index.ts',\n    srcDir: './src',\n    exclude: ['./src/tests/'],\n  }),\n)\n"
  },
  {
    "path": "packages/solid-router/CHANGELOG.md",
    "content": "# @tanstack/solid-router\n\n## 1.168.1\n\n### Patch Changes\n\n- Updated dependencies [[`91cc628`](https://github.com/TanStack/router/commit/91cc62899b75ca920fe83c5ee7f3dbb5c71a523f)]:\n  - @tanstack/router-core@1.168.1\n\n## 1.168.0\n\n### Minor Changes\n\n- remove pendingMatches, cachedMatches ([#6704](https://github.com/TanStack/router/pull/6704))\n  move to signal-based reactivity\n  solid uses its own native signals\n\n### Patch Changes\n\n- Updated dependencies [[`0545239`](https://github.com/TanStack/router/commit/054523900b2ee19308e5a88417dadfc6923afe30)]:\n  - @tanstack/router-core@1.168.0\n\n## 1.167.5\n\n### Patch Changes\n\n- Updated dependencies [[`5ff4f0b`](https://github.com/TanStack/router/commit/5ff4f0b8dce1fac2bb0b0bfe2684fc677a8ee505)]:\n  - @tanstack/router-core@1.167.5\n\n## 1.167.4\n\n### Patch Changes\n\n- Add @tanstack/intent AI agent skills and CLI entry points for Router and Start packages ([#6866](https://github.com/TanStack/router/pull/6866))\n\n- Updated dependencies [[`940151c`](https://github.com/TanStack/router/commit/940151cbed0c76c92a5cf196c0905b17a956ca7e)]:\n  - @tanstack/router-core@1.167.4\n\n## 1.167.3\n\n### Patch Changes\n\n- Updated dependencies [[`32fcba7`](https://github.com/TanStack/router/commit/32fcba7b044b03f5901308b870f70b0b4910c220)]:\n  - @tanstack/router-core@1.167.3\n\n## 1.167.2\n\n### Patch Changes\n\n- build: update to vite-config 5.x (rolldown) ([#6926](https://github.com/TanStack/router/pull/6926))\n\n- Updated dependencies [[`838b0eb`](https://github.com/TanStack/router/commit/838b0eb9a8bbbb987a0a6972c1446e01423bbd7b)]:\n  - @tanstack/history@1.161.6\n  - @tanstack/router-core@1.167.2\n\n## 1.167.1\n\n### Patch Changes\n\n- fix: build with @tanstack/vite-config 0.4.3 ([#6923](https://github.com/TanStack/router/pull/6923))\n\n- Updated dependencies [[`ef9b241`](https://github.com/TanStack/router/commit/ef9b241f3cfe95cee40daa96da669f0ffd4a971a)]:\n  - @tanstack/router-core@1.167.1\n  - @tanstack/history@1.161.5\n\n## 1.167.0\n\n### Minor Changes\n\n- feat: add staleReloadMode ([#6921](https://github.com/TanStack/router/pull/6921))\n\n### Patch Changes\n\n- Updated dependencies [[`6f297a2`](https://github.com/TanStack/router/commit/6f297a249424c0fd1c1a56aa4fc12c8217be7b6a)]:\n  - @tanstack/router-core@1.167.0\n"
  },
  {
    "path": "packages/solid-router/README.md",
    "content": "<img src=\"https://static.scarf.sh/a.png?x-pxid=d988eb79-b0fc-4a2b-8514-6a1ab932d188\" />\n\n# TanStack Solid Router\n\n![TanStack Router Header](https://raw.githubusercontent.com/TanStack/router/main/media/header_router.png)\n\n🤖 Type-safe router w/ built-in caching & URL state management for Solid!\n\n<a href=\"https://twitter.com/intent/tweet?button_hashtag=TanStack\" target=\"\\_parent\">\n  <img alt=\"#TanStack\" src=\"https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack\">\n</a><a href=\"https://discord.com/invite/WrRKjPJ\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/badge/Discord-TanStack-%235865F2\" />\n</a><a href=\"https://npmjs.com/package/@tanstack/solid-router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/npm/dm/@tanstack/router.svg\" />\n</a><a href=\"https://bundlephobia.com/result?p=@tanstack/solid-router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://badgen.net/bundlephobia/minzip/@tanstack/solid-router\" />\n</a><a href=\"#badge\">\n    <img alt=\"semantic-release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\">\n  </a><a href=\"https://github.com/TanStack/router/discussions\">\n  <img alt=\"Join the discussion on Github\" src=\"https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue\" />\n</a><a href=\"https://bestofjs.org/projects/router\"><img alt=\"Best of JS\" src=\"https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=tanstack%2Frouter%26since=daily\" /></a><a href=\"https://github.com/TanStack/router\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/github/stars/tanstack/router.svg?style=social&label=Star\" />\n</a><a href=\"https://twitter.com/tan_stack\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/twitter/follow/tan_stack.svg?style=social&label=Follow @TanStack\" />\n</a><a href=\"https://twitter.com/tannerlinsley\" target=\"\\_parent\">\n  <img alt=\"\" src=\"https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow @TannerLinsley\" />\n</a>\n\n## Visit [tanstack.com/router](https://tanstack.com/router) for docs, guides, API and more!\n"
  },
  {
    "path": "packages/solid-router/bin/intent.js",
    "content": "#!/usr/bin/env node\n// Auto-generated by @tanstack/intent setup\n// Exposes the intent end-user CLI for consumers of this library.\n// Commit this file, then add to your package.json:\n//   \"bin\": { \"intent\": \"./bin/intent.js\" }\ntry {\n  await import('@tanstack/intent/intent-library')\n} catch (e) {\n  const isModuleNotFound =\n    e?.code === 'ERR_MODULE_NOT_FOUND' || e?.code === 'MODULE_NOT_FOUND'\n  const missingIntentLibrary =\n    typeof e?.message === 'string' && e.message.includes('@tanstack/intent')\n\n  if (isModuleNotFound && missingIntentLibrary) {\n    console.error('@tanstack/intent is not installed.')\n    console.error('')\n    console.error('Install it as a dev dependency:')\n    console.error('  npm add -D @tanstack/intent')\n    console.error('')\n    console.error('Or run directly:')\n    console.error('  npx @tanstack/intent@latest list')\n    process.exit(1)\n  }\n  throw e\n}\n"
  },
  {
    "path": "packages/solid-router/eslint.config.ts",
    "content": "import solidPlugin from 'vite-plugin-solid'\nimport rootConfig from '../../eslint.config.js'\n\nexport default [\n  ...rootConfig,\n  {\n    ignores: ['bin/**'],\n  },\n  {\n    files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],\n    plugins: {\n      solidPlugin: solidPlugin(),\n    },\n    rules: {\n      '@typescript-eslint/no-unnecessary-condition': 'off',\n    },\n  },\n]\n"
  },
  {
    "path": "packages/solid-router/package.json",
    "content": "{\n  \"name\": \"@tanstack/solid-router\",\n  \"version\": \"1.168.1\",\n  \"description\": \"Modern and scalable routing for Solid applications\",\n  \"author\": \"Tanner Linsley\",\n  \"license\": \"MIT\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/TanStack/router.git\",\n    \"directory\": \"packages/solid-router\"\n  },\n  \"homepage\": \"https://tanstack.com/router\",\n  \"funding\": {\n    \"type\": \"github\",\n    \"url\": \"https://github.com/sponsors/tannerlinsley\"\n  },\n  \"keywords\": [\n    \"solidjs\",\n    \"location\",\n    \"router\",\n    \"routing\",\n    \"async\",\n    \"async router\",\n    \"typescript\"\n  ],\n  \"scripts\": {\n    \"clean\": \"rimraf ./dist && rimraf ./coverage\",\n    \"test:eslint\": \"eslint\",\n    \"test:types\": \"pnpm run \\\"/^test:types:ts[0-9]{2}$/\\\"\",\n    \"test:types:ts54\": \"node ../../node_modules/typescript54/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts55\": \"node ../../node_modules/typescript55/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts56\": \"node ../../node_modules/typescript56/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts57\": \"node ../../node_modules/typescript57/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts58\": \"node ../../node_modules/typescript58/lib/tsc.js -p tsconfig.legacy.json\",\n    \"test:types:ts59\": \"tsc -p tsconfig.legacy.json\",\n    \"test:unit\": \"vitest && vitest --mode server\",\n    \"test:unit:dev\": \"pnpm run test:unit --watch --hideSkippedTests\",\n    \"test:perf\": \"vitest bench\",\n    \"test:perf:dev\": \"pnpm run test:perf --watch --hideSkippedTests\",\n    \"test:build\": \"publint --strict && attw --ignore-rules no-resolution --pack .\",\n    \"build\": \"vite build && tsc -p tsconfig.build.json\"\n  },\n  \"type\": \"module\",\n  \"types\": \"dist/esm/index.d.ts\",\n  \"main\": \"dist/cjs/index.cjs\",\n  \"module\": \"dist/esm/index.js\",\n  \"exports\": {\n    \".\": {\n      \"solid\": {\n        \"types\": \"./dist/source/index.d.ts\",\n        \"development\": \"./dist/source/index.dev.jsx\",\n        \"default\": \"./dist/source/index.jsx\"\n      },\n      \"import\": {\n        \"types\": \"./dist/esm/index.d.ts\",\n        \"development\": \"./dist/esm/index.dev.js\",\n        \"default\": \"./dist/esm/index.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/index.d.cts\",\n        \"development\": \"./dist/cjs/index.dev.cjs\",\n        \"default\": \"./dist/cjs/index.cjs\"\n      }\n    },\n    \"./ssr/server\": {\n      \"solid\": {\n        \"types\": \"./dist/source/ssr/server.d.ts\",\n        \"default\": \"./dist/source/ssr/server.js\"\n      },\n      \"import\": {\n        \"types\": \"./dist/esm/ssr/server.d.ts\",\n        \"default\": \"./dist/esm/ssr/server.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/ssr/server.d.cts\",\n        \"default\": \"./dist/cjs/ssr/server.cjs\"\n      }\n    },\n    \"./ssr/client\": {\n      \"solid\": {\n        \"types\": \"./dist/source/ssr/client.d.ts\",\n        \"default\": \"./dist/source/ssr/client.js\"\n      },\n      \"import\": {\n        \"types\": \"./dist/esm/ssr/client.d.ts\",\n        \"default\": \"./dist/esm/ssr/client.js\"\n      },\n      \"require\": {\n        \"types\": \"./dist/cjs/ssr/client.d.cts\",\n        \"default\": \"./dist/cjs/ssr/client.cjs\"\n      }\n    },\n    \"./package.json\": \"./package.json\"\n  },\n  \"sideEffects\": false,\n  \"files\": [\n    \"dist\",\n    \"src\",\n    \"skills\",\n    \"bin\",\n    \"!skills/_artifacts\"\n  ],\n  \"engines\": {\n    \"node\": \">=20.19\"\n  },\n  \"dependencies\": {\n    \"@solid-devtools/logger\": \"^0.9.4\",\n    \"@solid-primitives/refs\": \"^1.0.8\",\n    \"@solidjs/meta\": \"^0.29.4\",\n    \"@tanstack/history\": \"workspace:*\",\n    \"@tanstack/router-core\": \"workspace:*\",\n    \"isbot\": \"^5.1.22\",\n    \"tiny-invariant\": \"^1.3.3\",\n    \"tiny-warning\": \"^1.0.3\"\n  },\n  \"devDependencies\": {\n    \"@solidjs/testing-library\": \"^0.8.10\",\n    \"@tanstack/intent\": \"^0.0.14\",\n    \"@testing-library/jest-dom\": \"^6.6.3\",\n    \"combinate\": \"^1.1.11\",\n    \"eslint-plugin-solid\": \"^0.14.5\",\n    \"solid-js\": \"^1.9.10\",\n    \"vite\": \"*\",\n    \"vite-plugin-solid\": \"^2.11.10\",\n    \"zod\": \"^3.23.8\"\n  },\n  \"peerDependencies\": {\n    \"solid-js\": \"^1.9.10\"\n  },\n  \"bin\": {\n    \"intent\": \"./bin/intent.js\"\n  }\n}\n"
  },
  {
    "path": "packages/solid-router/skills/_artifacts/domain_map.yaml",
    "content": "# domain_map.yaml\n# Library: @tanstack/solid-router\n# Version: 1.166.2\n# Date: 2026-03-08\n# Status: reviewed\n\nlibrary:\n  name: '@tanstack/solid-router'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Solid bindings for TanStack Router. Accessor<T> returns,\n    Solid primitives, createLink, @solidjs/meta head management.\n  primary_framework: 'solid'\n\ndomains:\n  - name: 'Solid Router Bindings'\n    slug: 'solid-router-bindings'\n    description: >-\n      Solid-specific components, hooks, and primitives for\n      TanStack Router. Accessor-based returns, createLink,\n      and @solidjs/meta integration.\n\nskills:\n  - name: 'Solid Router'\n    slug: 'solid-router'\n    domain: 'solid-router-bindings'\n    description: >-\n      Solid bindings for TanStack Router. Accessor<T> returns,\n      Solid primitives, createLink, @solidjs/meta head management.\n    type: framework\n    packages:\n      - '@tanstack/solid-router'\n    covers:\n      - Solid-specific router components\n      - Accessor<T> return types\n      - createLink component factory\n      - Solid primitives integration\n      - '@solidjs/meta head management'\n    tasks:\n      - 'Set up TanStack Router in a Solid app'\n      - 'Create type-safe links with createLink'\n      - 'Manage document head with @solidjs/meta'\n    failure_modes:\n      - mistake: 'Unwrapping accessors incorrectly'\n        mechanism: >-\n          Solid Router returns Accessor<T> instead of raw values.\n          Destructuring or reading outside reactive context loses\n          reactivity and causes stale data.\n        priority: HIGH\n        status: active\n\n      - mistake: 'Using React Router APIs instead of Solid equivalents'\n        mechanism: >-\n          Solid Router provides a Link component plus createLink\n          for custom wrappers, and uses Solid-specific primitives\n          instead of React hooks. Mixing React or React Router\n          patterns into Solid Router causes type/runtime errors.\n        priority: MEDIUM\n        status: active\n\ngaps: []\n"
  },
  {
    "path": "packages/solid-router/skills/_artifacts/skill_spec.md",
    "content": "# @tanstack/solid-router — Skill Spec\n\nSolid bindings for TanStack Router. Accessor<T> returns, Solid primitives, createLink, @solidjs/meta head management.\n\n## Domains\n\n| Domain                | Description                                                | Skills       |\n| --------------------- | ---------------------------------------------------------- | ------------ |\n| Solid Router Bindings | Solid components, hooks, Accessor returns, meta management | solid-router |\n\n## Skill Inventory\n\n| Skill        | Type      | Domain                | What it covers                                                   | Failure modes |\n| ------------ | --------- | --------------------- | ---------------------------------------------------------------- | ------------- |\n| solid-router | framework | solid-router-bindings | Accessor<T> returns, createLink, Solid primitives, @solidjs/meta | 2             |\n\n## Failure Mode Inventory\n\n### solid-router (2 failure modes)\n\n| #   | Mistake                                              | Priority | Source      |\n| --- | ---------------------------------------------------- | -------- | ----------- |\n| 1   | Unwrapping accessors incorrectly                     | HIGH     | source/docs |\n| 2   | Using React Router APIs instead of Solid equivalents | MEDIUM   | source/docs |\n"
  },
  {
    "path": "packages/solid-router/skills/_artifacts/skill_tree.yaml",
    "content": "library:\n  name: '@tanstack/solid-router'\n  version: '1.166.2'\n  repository: 'https://github.com/TanStack/router'\n  description: >-\n    Solid bindings for TanStack Router. Accessor<T> returns,\n    Solid primitives, createLink, @solidjs/meta head management.\ngenerated_at: '2026-03-08'\nskills:\n  - name: 'Solid Router'\n    slug: 'solid-router'\n    type: 'framework'\n    domain: 'solid-router-bindings'\n    path: 'skills/solid-router/SKILL.md'\n    package: 'packages/solid-router'\n    description: >-\n      Solid bindings for TanStack Router. Accessor<T> returns,\n      Solid primitives, createLink, @solidjs/meta head management.\n    sources:\n      - 'TanStack/router:packages/solid-router/src'\n"
  },
  {
    "path": "packages/solid-router/skills/solid-router/SKILL.md",
    "content": "---\nname: solid-router\ndescription: >-\n  Solid bindings for TanStack Router: RouterProvider, useRouter,\n  useRouterState, useMatch, useMatches, useLocation, useSearch,\n  useParams, useNavigate, useLoaderData, useLoaderDeps,\n  useRouteContext, useBlocker, useCanGoBack, Link, Navigate,\n  Outlet, CatchBoundary, ErrorComponent. Solid-specific patterns\n  with Accessor<T> returns, createSignal/createMemo/createEffect,\n  Show/Switch/Match/Dynamic, and @solidjs/meta for head management.\ntype: framework\nlibrary: tanstack-router\nlibrary_version: '1.166.2'\nframework: solid\nrequires:\n  - router-core\nsources:\n  - TanStack/router:packages/solid-router/src\n---\n\n# Solid Router (`@tanstack/solid-router`)\n\nThis skill builds on router-core. Read [router-core](../../../router-core/skills/router-core/SKILL.md) first for foundational concepts.\n\nThis skill covers the Solid-specific bindings, components, hooks, and setup for TanStack Router.\n\n> **CRITICAL**: TanStack Router types are FULLY INFERRED. Never cast, never annotate inferred values.\n> **CRITICAL**: TanStack Router is CLIENT-FIRST. Loaders run on the client by default, not on the server.\n> **CRITICAL**: Most hooks return `Accessor<T>` — you MUST call the accessor (`value()`) to read the reactive value. This is the #1 difference from the React version.\n> **CRITICAL**: Do not confuse `@tanstack/solid-router` with `@solidjs/router`. They are completely different libraries with different APIs.\n\n## Full Setup: File-Based Routing with Vite\n\n### 1. Install Dependencies\n\n```bash\nnpm install @tanstack/solid-router\nnpm install -D @tanstack/router-plugin @tanstack/solid-router-devtools\n```\n\n### 2. Configure Vite Plugin\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport solidPlugin from 'vite-plugin-solid'\nimport { tanstackRouter } from '@tanstack/router-plugin/vite'\n\nexport default defineConfig({\n  plugins: [\n    // MUST come before solid plugin\n    tanstackRouter({\n      target: 'solid',\n      autoCodeSplitting: true,\n    }),\n    solidPlugin(),\n  ],\n})\n```\n\n### 3. Create Root Route\n\n```tsx\n// src/routes/__root.tsx\nimport { createRootRoute, Link, Outlet } from '@tanstack/solid-router'\n\nexport const Route = createRootRoute({\n  component: RootLayout,\n})\n\nfunction RootLayout() {\n  return (\n    <>\n      <nav>\n        <Link to=\"/\" activeClass=\"font-bold\">\n          Home\n        </Link>\n        <Link to=\"/about\" activeClass=\"font-bold\">\n          About\n        </Link>\n      </nav>\n      <hr />\n      <Outlet />\n    </>\n  )\n}\n```\n\n### 4. Create Route Files\n\n```tsx\n// src/routes/index.tsx\nimport { createFileRoute } from '@tanstack/solid-router'\n\nexport const Route = createFileRoute('/')({\n  component: HomePage,\n})\n\nfunction HomePage() {\n  return <h1>Welcome Home</h1>\n}\n```\n\n### 5. Create Router Instance and Register Types\n\n```tsx\n// src/main.tsx\nimport { render } from 'solid-js/web'\nimport { RouterProvider, createRouter } from '@tanstack/solid-router'\nimport { routeTree } from './routeTree.gen'\n\nconst router = createRouter({ routeTree })\n\n// REQUIRED — without this, Link/useNavigate/useSearch have no type safety\ndeclare module '@tanstack/solid-router' {\n  interface Register {\n    router: typeof router\n  }\n}\n\nrender(\n  () => <RouterProvider router={router} />,\n  document.getElementById('root')!,\n)\n```\n\n## Hooks Reference\n\nAll hooks imported from `@tanstack/solid-router`. Most return `Accessor<T>` — call the result to read the value.\n\n### `useRouter()` — returns `TRouter` (NOT an Accessor)\n\n```tsx\nimport { useRouter } from '@tanstack/solid-router'\n\nfunction InvalidateButton() {\n  const router = useRouter()\n  return <button onClick={() => router.invalidate()}>Refresh data</button>\n}\n```\n\n### `useRouterState()` — returns `Accessor<T>`\n\nExposes the entire state and thus incurs a performance cost. For matches or location favor `useMatches` and `useLocation`.\n\n```tsx\nimport { useRouterState } from '@tanstack/solid-router'\n\nfunction LoadingIndicator() {\n  const isLoading = useRouterState({ select: (s) => s.isLoading })\n  return (\n    <Show when={isLoading()}>\n      <div>Loading...</div>\n    </Show>\n  )\n}\n```\n\n### `useNavigate()` — returns a function (NOT an Accessor)\n\n```tsx\nimport { useNavigate } from '@tanstack/solid-router'\n\nfunction AfterSubmit() {\n  const navigate = useNavigate()\n\n  const handleSubmit = async () => {\n    await saveData()\n    navigate({ to: '/posts/$postId', params: { postId: '123' } })\n  }\n\n  return <button onClick={handleSubmit}>Save</button>\n}\n```\n\n### `useSearch({ from })` — returns `Accessor<T>`\n\n```tsx\nimport { useSearch } from '@tanstack/solid-router'\n\nfunction Pagination() {\n  const search = useSearch({ from: '/products' })\n  return <span>Page {search().page}</span>\n}\n```\n\n### `useParams({ from })` — returns `Accessor<T>`\n\n```tsx\nimport { useParams } from '@tanstack/solid-router'\n\nfunction PostHeader() {\n  const params = useParams({ from: '/posts/$postId' })\n  return <h2>Post {params().postId}</h2>\n}\n```\n\n### `useLoaderData({ from })` — returns `Accessor<T>`\n\n```tsx\nimport { useLoaderData } from '@tanstack/solid-router'\n\nfunction PostContent() {\n  const data = useLoaderData({ from: '/posts/$postId' })\n  return <article>{data().post.content}</article>\n}\n```\n\n### `useMatch({ from })` — returns `Accessor<T>`\n\n```tsx\nimport { useMatch } from '@tanstack/solid-router'\n\nfunction PostDetails() {\n  const match = useMatch({ from: '/posts/$postId' })\n  return <div>{match().loaderData.post.title}</div>\n}\n```\n\n### Other Hooks\n\nAll imported from `@tanstack/solid-router`:\n\n- **`useMatches()`** — `Accessor<Array<Match>>`, all active route matches\n- **`useParentMatches()`** — `Accessor<Array<Match>>`, parent route matches\n- **`useChildMatches()`** — `Accessor<Array<Match>>`, child route matches\n- **`useRouteContext({ from })`** — `Accessor<T>`, context from `beforeLoad`\n- **`useLoaderDeps({ from })`** — `Accessor<T>`, loader dependency values\n- **`useBlocker({ shouldBlockFn })`** — blocks navigation for unsaved changes\n- **`useCanGoBack()`** — `Accessor<boolean>`\n- **`useLocation()`** — `Accessor<ParsedLocation>`\n- **`useLinkProps({ to, params?, search? })`** — returns `ComponentProps<'a'>` (NOT an Accessor)\n- **`useMatchRoute()`** — returns a function; calling it returns `Accessor<false | Params>`\n- **`useHydrated()`** — `Accessor<boolean>`\n\n## Components Reference\n\n### `RouterProvider`\n\n```tsx\n<RouterProvider router={router} />\n```\n\n### `Link`\n\nType-safe navigation link. Children can be a function for active state:\n\n```tsx\n;<Link to=\"/posts/$postId\" params={{ postId: '42' }}>\n  View Post\n</Link>\n\n{\n  /* Function children for active state */\n}\n;<Link to=\"/about\">\n  {(state) => <span classList={{ active: state.isActive }}>About</span>}\n</Link>\n```\n\n### `Outlet`\n\nRenders the matched child route component:\n\n```tsx\nfunction Layout() {\n  return (\n    <div>\n      <Sidebar />\n      <main>\n        <Outlet />\n      </main>\n    </div>\n  )\n}\n```\n\n### `Navigate`\n\nDeclarative redirect (triggers navigation in `onMount`):\n\n```tsx\nimport { Navigate } from '@tanstack/solid-router'\n\nfunction OldPage() {\n  return <Navigate to=\"/new-page\" />\n}\n```\n\n### `Await`\n\nRenders deferred data with Solid's `Suspense`:\n\n```tsx\nimport { Await } from '@tanstack/solid-router'\nimport { Suspense } from 'solid-js'\n\nfunction PostWithComments() {\n  const data = Route.useLoaderData()\n  return (\n    <Suspense fallback={<div>Loading...</div>}>\n      <Await promise={data().deferredComments}>\n        {(comments) => <For each={comments}>{(c) => <li>{c.text}</li>}</For>}\n      </Await>\n    </Suspense>\n  )\n}\n```\n\n### `CatchBoundary`\n\nError boundary wrapping `Solid.ErrorBoundary`:\n\n```tsx\nimport { CatchBoundary } from '@tanstack/solid-router'\n;<CatchBoundary\n  getResetKey={() => 'widget'}\n  errorComponent={({ error }) => <div>Error: {error.message}</div>}\n>\n  <RiskyWidget />\n</CatchBoundary>\n```\n\n### Other Components\n\n- **`CatchNotFound`** — catches `notFound()` errors in children; `fallback` receives the error data\n- **`Block`** — declarative navigation blocker; use `shouldBlockFn` and `withResolver` for custom UI\n- **`ScrollRestoration`** — **deprecated**; use `createRouter`'s `scrollRestoration: true` option instead\n- **`ClientOnly`** — renders children only after hydration; accepts `fallback` prop\n\n### `Block`\n\nDeclarative navigation blocker component:\n\n```tsx\nimport { Block } from '@tanstack/solid-router'\n;<Block shouldBlockFn={() => formIsDirty()} withResolver>\n  {({ status, proceed, reset }) => (\n    <Show when={status === 'blocked'}>\n      <div>\n        <p>Are you sure?</p>\n        <button onClick={proceed}>Yes</button>\n        <button onClick={reset}>No</button>\n      </div>\n    </Show>\n  )}\n</Block>\n```\n\n### `ScrollRestoration`\n\nRestores scroll position on navigation:\n\n```tsx\nimport { ScrollRestoration } from '@tanstack/solid-router'\n// In root route component\n;<ScrollRestoration />\n```\n\n### `ClientOnly`\n\nRenders children only after hydration:\n\n```tsx\nimport { ClientOnly } from '@tanstack/solid-router'\n;<ClientOnly fallback={<div>Loading...</div>}>\n  <BrowserOnlyWidget />\n</ClientOnly>\n```\n\n### Head Management\n\nUses `@solidjs/meta` under the hood:\n\n```tsx\nimport { HeadContent, Scripts } from '@tanstack/solid-router'\n\nfunction RootDocument(props) {\n  return (\n    <html>\n      <head>\n        <HeadContent />\n      </head>\n      <body>\n        {props.children}\n        <Scripts />\n      </body>\n    </html>\n  )\n}\n```\n\n## Solid-Specific Patterns\n\n### Custom Link Component with `createLink`\n\n```tsx\nimport { createLink } from '@tanstack/solid-router'\n\nconst StyledLinkComponent = (props) => (\n  <a {...props} class={`styled-link ${props.class ?? ''}`} />\n)\n\nconst StyledLink = createLink(StyledLinkComponent)\n\nfunction Nav() {\n  return (\n    <StyledLink to=\"/posts/$postId\" params={{ postId: '42' }}>\n      Post\n    </StyledLink>\n  )\n}\n```\n\n### Using Solid Primitives with Router State\n\n```tsx\nimport { createMemo, Show, For } from 'solid-js'\nimport { useRouterState } from '@tanstack/solid-router'\n\nfunction Breadcrumbs() {\n  const matches = useRouterState({ select: (s) => s.matches })\n  const crumbs = createMemo(() =>\n    matches().filter((m) => m.context?.breadcrumb),\n  )\n\n  return (\n    <nav>\n      <For each={crumbs()}>\n        {(match) => <span>{match.context.breadcrumb}</span>}\n      </For>\n    </nav>\n  )\n}\n```\n\n### Auth with Router Context\n\n```tsx\nimport { createRootRouteWithContext } from '@tanstack/solid-router'\n\nconst rootRoute = createRootRouteWithContext<{ auth: AuthState }>()({\n  component: RootComponent,\n})\n\n// In main.tsx — provide context at router creation\nconst router = createRouter({\n  routeTree,\n  context: { auth: authState },\n})\n\n// In a route — access via beforeLoad (NOT hooks)\nbeforeLoad: ({ context }) => {\n  if (!context.auth.isAuthenticated) {\n    throw redirect({ to: '/login' })\n  }\n}\n```\n\n## Common Mistakes\n\n### 1. CRITICAL: Forgetting to call Accessor\n\nHooks return `Accessor<T>` — you must call them to read the value. This is the #1 migration issue from React.\n\n```tsx\n// WRONG — comparing the accessor function, not its value\nconst params = useParams({ from: '/posts/$postId' })\nif (params.postId === '42') { ... } // params is a function!\n\n// CORRECT — call the accessor\nconst params = useParams({ from: '/posts/$postId' })\nif (params().postId === '42') { ... }\n```\n\n### 2. HIGH: Destructuring reactive values\n\nDestructuring breaks Solid's reactivity tracking.\n\n```tsx\n// WRONG — loses reactivity\nconst { page } = useSearch({ from: '/products' })()\n\n// CORRECT — access through accessor\nconst search = useSearch({ from: '/products' })\n<span>Page {search().page}</span>\n```\n\n### 3. HIGH: Using React hooks in beforeLoad or loader\n\n`beforeLoad` and `loader` are NOT components — they are plain async functions. No hooks (React or Solid) can be used in them. Pass state via router context instead.\n\n### 4. MEDIUM: Wrong plugin target\n\nMust set `target: 'solid'` in the router plugin config. Default is `'react'`.\n\n## Cross-References\n\n- [router-core/SKILL.md](../../../router-core/skills/router-core/SKILL.md) — all sub-skills for domain-specific patterns (search params, data loading, navigation, auth, SSR, etc.)\n"
  },
  {
    "path": "packages/solid-router/src/Asset.tsx",
    "content": "import { Link, Meta, Style, Title } from '@solidjs/meta'\nimport { onCleanup, onMount } from 'solid-js'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\nimport type { JSX } from 'solid-js'\n\nexport function Asset({\n  tag,\n  attrs,\n  children,\n}: RouterManagedTag): JSX.Element | null {\n  switch (tag) {\n    case 'title':\n      return <Title {...attrs}>{children}</Title>\n    case 'meta':\n      return <Meta {...attrs} />\n    case 'link':\n      return <Link {...attrs} />\n    case 'style':\n      return <Style {...attrs}>{children}</Style>\n    case 'script':\n      return <Script attrs={attrs}>{children}</Script>\n    default:\n      return null\n  }\n}\n\ninterface ScriptAttrs {\n  [key: string]: string | boolean | undefined\n  src?: string\n}\n\nfunction Script({\n  attrs,\n  children,\n}: {\n  attrs?: ScriptAttrs\n  children?: string\n}): JSX.Element | null {\n  const router = useRouter()\n  const dataScript =\n    typeof attrs?.type === 'string' &&\n    attrs.type !== '' &&\n    attrs.type !== 'text/javascript' &&\n    attrs.type !== 'module'\n\n  onMount(() => {\n    if (dataScript) return\n\n    if (attrs?.src) {\n      const normSrc = (() => {\n        try {\n          const base = document.baseURI || window.location.href\n          return new URL(attrs.src, base).href\n        } catch {\n          return attrs.src\n        }\n      })()\n      const existingScript = Array.from(\n        document.querySelectorAll('script[src]'),\n      ).find((el) => (el as HTMLScriptElement).src === normSrc)\n\n      if (existingScript) {\n        return\n      }\n\n      const script = document.createElement('script')\n\n      for (const [key, value] of Object.entries(attrs)) {\n        if (value !== undefined && value !== false) {\n          script.setAttribute(\n            key,\n            typeof value === 'boolean' ? '' : String(value),\n          )\n        }\n      }\n\n      document.head.appendChild(script)\n\n      onCleanup(() => {\n        if (script.parentNode) {\n          script.parentNode.removeChild(script)\n        }\n      })\n    }\n\n    if (typeof children === 'string') {\n      const typeAttr =\n        typeof attrs?.type === 'string' ? attrs.type : 'text/javascript'\n      const nonceAttr =\n        typeof attrs?.nonce === 'string' ? attrs.nonce : undefined\n      const existingScript = Array.from(\n        document.querySelectorAll('script:not([src])'),\n      ).find((el) => {\n        if (!(el instanceof HTMLScriptElement)) return false\n        const sType = el.getAttribute('type') ?? 'text/javascript'\n        const sNonce = el.getAttribute('nonce') ?? undefined\n        return (\n          el.textContent === children &&\n          sType === typeAttr &&\n          sNonce === nonceAttr\n        )\n      })\n\n      if (existingScript) {\n        return\n      }\n\n      const script = document.createElement('script')\n      script.textContent = children\n\n      if (attrs) {\n        for (const [key, value] of Object.entries(attrs)) {\n          if (value !== undefined && value !== false) {\n            script.setAttribute(\n              key,\n              typeof value === 'boolean' ? '' : String(value),\n            )\n          }\n        }\n      }\n\n      document.head.appendChild(script)\n\n      onCleanup(() => {\n        if (script.parentNode) {\n          script.parentNode.removeChild(script)\n        }\n      })\n    }\n  })\n\n  if (!(isServer ?? router.isServer)) {\n    if (dataScript && typeof children === 'string') {\n      return <script {...attrs} innerHTML={children} />\n    }\n\n    // render an empty script on the client just to avoid hydration errors\n    return null\n  }\n\n  if (attrs?.src && typeof attrs.src === 'string') {\n    return <script {...attrs} />\n  }\n\n  if (typeof children === 'string') {\n    return <script {...attrs} innerHTML={children} />\n  }\n\n  return null\n}\n"
  },
  {
    "path": "packages/solid-router/src/CatchBoundary.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport type { ErrorRouteComponent } from './route'\n\nexport function CatchBoundary(\n  props: {\n    getResetKey: () => number | string\n    children: Solid.JSX.Element\n    errorComponent?: ErrorRouteComponent\n    onCatch?: (error: Error) => void\n  } & Solid.ParentProps,\n) {\n  return (\n    <Solid.ErrorBoundary\n      fallback={(error, reset) => {\n        props.onCatch?.(error)\n\n        Solid.createEffect(\n          Solid.on([props.getResetKey], () => reset(), { defer: true }),\n        )\n\n        return (\n          <Dynamic\n            component={props.errorComponent ?? ErrorComponent}\n            error={error}\n            reset={reset}\n          />\n        )\n      }}\n    >\n      {props.children}\n    </Solid.ErrorBoundary>\n  )\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n  const [show, setShow] = Solid.createSignal(\n    process.env.NODE_ENV !== 'production',\n  )\n\n  return (\n    <div style={{ padding: '.5rem', 'max-width': '100%' }}>\n      <div style={{ display: 'flex', 'align-items': 'center', gap: '.5rem' }}>\n        <strong style={{ 'font-size': '1rem' }}>Something went wrong!</strong>\n        <button\n          style={{\n            appearance: 'none',\n            'font-size': '.6em',\n            border: '1px solid currentColor',\n            padding: '.1rem .2rem',\n            'font-weight': 'bold',\n            'border-radius': '.25rem',\n          }}\n          onClick={() => setShow((d) => !d)}\n        >\n          {show() ? 'Hide Error' : 'Show Error'}\n        </button>\n      </div>\n      <div style={{ height: '.25rem' }} />\n      {show() ? (\n        <div>\n          <pre\n            style={{\n              'font-size': '.7em',\n              border: '1px solid red',\n              'border-radius': '.25rem',\n              padding: '.3rem',\n              color: 'red',\n              overflow: 'auto',\n            }}\n          >\n            {error.message ? <code>{error.message}</code> : null}\n          </pre>\n        </div>\n      ) : null}\n    </div>\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/ClientOnly.tsx",
    "content": "import * as Solid from 'solid-js'\n\nexport interface ClientOnlyProps {\n  /**\n   * The children to render when the JS is loaded.\n   */\n  children: Solid.JSX.Element\n  /**\n   * The fallback component to render if the JS is not yet loaded.\n   */\n  fallback?: Solid.JSX.Element\n}\n\n/**\n * Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.\n *\n * ```tsx\n * return (\n *   <ClientOnly fallback={<FakeChart />}>\n *     <Chart />\n *   </ClientOnly>\n * )\n * ```\n */\nexport function ClientOnly(props: ClientOnlyProps) {\n  const hydrated = useHydrated()\n  return (\n    <Solid.Show when={hydrated()} fallback={props.fallback ?? null}>\n      <>{props.children}</>\n    </Solid.Show>\n  )\n}\n\n/**\n * Return a boolean indicating if the JS has been hydrated already.\n * When doing Server-Side Rendering, the result will always be false.\n * When doing Client-Side Rendering, the result will always be false on the\n * first render and true from then on. Even if a new component renders it will\n * always start with true.\n *\n * @example\n * ```tsx\n * // Disable a button that needs JS to work.\n * const hydrated = useHydrated()\n * return (\n *   <button type=\"button\" disabled={!hydrated()} onClick={doSomethingCustom}>\n *     Click me\n *   </button>\n * )\n * ```\n * @returns True if the JS has been hydrated already, false otherwise.\n */\nexport function useHydrated(): Solid.Accessor<boolean> {\n  const [hydrated, setHydrated] = Solid.createSignal(false)\n  Solid.onMount(() => {\n    setHydrated(true)\n  })\n  return hydrated\n}\n"
  },
  {
    "path": "packages/solid-router/src/HeadContent.dev.tsx",
    "content": "import { MetaProvider } from '@solidjs/meta'\nimport { For, createEffect, createMemo } from 'solid-js'\nimport { Asset } from './Asset'\nimport { useHydrated } from './ClientOnly'\nimport { useTags } from './headContentUtils'\n\nconst DEV_STYLES_ATTR = 'data-tanstack-router-dev-styles'\n\n/**\n * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.\n * When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`\n * to ensure it's part of the reactive tree and updates correctly during client-side navigation.\n * The component uses portals internally to render content into the `<head>` element.\n *\n * Development version: filters out dev styles link after hydration and\n * includes a fallback cleanup effect for hydration mismatch cases.\n */\nexport function HeadContent() {\n  const tags = useTags()\n  const hydrated = useHydrated()\n\n  // Fallback cleanup for hydration mismatch cases\n  // Runs when hydration completes to remove any orphaned dev styles links from DOM\n  createEffect(() => {\n    if (hydrated()) {\n      document\n        .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n        .forEach((el) => el.remove())\n    }\n  })\n\n  // Filter out dev styles after hydration\n  const filteredTags = createMemo(() => {\n    if (hydrated()) {\n      return tags().filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR])\n    }\n    return tags()\n  })\n\n  return (\n    <MetaProvider>\n      <For each={filteredTags()}>{(tag) => <Asset {...tag} />}</For>\n    </MetaProvider>\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/HeadContent.tsx",
    "content": "import { MetaProvider } from '@solidjs/meta'\nimport { For } from 'solid-js'\nimport { Asset } from './Asset'\nimport { useTags } from './headContentUtils'\n\n/**\n * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.\n * When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`\n * to ensure it's part of the reactive tree and updates correctly during client-side navigation.\n * The component uses portals internally to render content into the `<head>` element.\n */\nexport function HeadContent() {\n  const tags = useTags()\n\n  return (\n    <MetaProvider>\n      <For each={tags()}>{(tag) => <Asset {...tag} />}</For>\n    </MetaProvider>\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/Match.tsx",
    "content": "import * as Solid from 'solid-js'\nimport invariant from 'tiny-invariant'\nimport warning from 'tiny-warning'\nimport {\n  createControlledPromise,\n  getLocationChangeInfo,\n  isNotFound,\n  isRedirect,\n  rootRouteId,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { Dynamic } from 'solid-js/web'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport { nearestMatchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport type { AnyRoute, RootRouteOptions } from '@tanstack/router-core'\n\nexport const Match = (props: { matchId: string }) => {\n  const router = useRouter()\n\n  const match = Solid.createMemo(() => {\n    const id = props.matchId\n    if (!id) return undefined\n    return router.stores.activeMatchStoresById.get(id)?.state\n  })\n\n  const rawMatchState = Solid.createMemo(() => {\n    const currentMatch = match()\n    if (!currentMatch) {\n      return null\n    }\n\n    const routeId = currentMatch.routeId as string\n    const parentRouteId = (router.routesById[routeId] as AnyRoute)?.parentRoute\n      ?.id\n\n    return {\n      matchId: currentMatch.id,\n      routeId,\n      ssr: currentMatch.ssr,\n      _displayPending: currentMatch._displayPending,\n      parentRouteId: parentRouteId as string | undefined,\n    }\n  })\n\n  const hasPendingMatch = Solid.createMemo(() => {\n    const currentRouteId = rawMatchState()?.routeId\n    return currentRouteId\n      ? Boolean(router.stores.pendingRouteIds.state[currentRouteId])\n      : false\n  })\n  const nearestMatch = {\n    matchId: () => rawMatchState()?.matchId,\n    routeId: () => rawMatchState()?.routeId,\n    match,\n    hasPending: hasPendingMatch,\n  }\n\n  return (\n    <Solid.Show when={rawMatchState()}>\n      {(currentMatchState) => {\n        const route: () => AnyRoute = () =>\n          router.routesById[currentMatchState().routeId]\n\n        const resolvePendingComponent = () =>\n          route().options.pendingComponent ??\n          router.options.defaultPendingComponent\n\n        const routeErrorComponent = () =>\n          route().options.errorComponent ?? router.options.defaultErrorComponent\n\n        const routeOnCatch = () =>\n          route().options.onCatch ?? router.options.defaultOnCatch\n\n        const routeNotFoundComponent = () =>\n          route().isRoot\n            ? // If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component\n              (route().options.notFoundComponent ??\n              router.options.notFoundRoute?.options.component)\n            : route().options.notFoundComponent\n\n        const resolvedNoSsr =\n          currentMatchState().ssr === false ||\n          currentMatchState().ssr === 'data-only'\n\n        const ResolvedSuspenseBoundary = () => Solid.Suspense\n\n        const ResolvedCatchBoundary = () =>\n          routeErrorComponent() ? CatchBoundary : SafeFragment\n\n        const ResolvedNotFoundBoundary = () =>\n          routeNotFoundComponent() ? CatchNotFound : SafeFragment\n\n        const ShellComponent = route().isRoot\n          ? ((route().options as RootRouteOptions).shellComponent ??\n            SafeFragment)\n          : SafeFragment\n\n        return (\n          <ShellComponent>\n            <nearestMatchContext.Provider value={nearestMatch}>\n              <Dynamic\n                component={ResolvedSuspenseBoundary()}\n                fallback={\n                  // Don't show fallback on server when using no-ssr mode to avoid hydration mismatch\n                  (isServer ?? router.isServer) && resolvedNoSsr ? undefined : (\n                    <Dynamic component={resolvePendingComponent()} />\n                  )\n                }\n              >\n                <Dynamic\n                  component={ResolvedCatchBoundary()}\n                  getResetKey={() => router.stores.loadedAt.state}\n                  errorComponent={routeErrorComponent() || ErrorComponent}\n                  onCatch={(error: Error) => {\n                    // Forward not found errors (we don't want to show the error component for these)\n                    if (isNotFound(error)) throw error\n                    warning(\n                      false,\n                      `Error in route match: ${currentMatchState().routeId}`,\n                    )\n                    routeOnCatch()?.(error)\n                  }}\n                >\n                  <Dynamic\n                    component={ResolvedNotFoundBoundary()}\n                    fallback={(error: any) => {\n                      // If the current not found handler doesn't exist or it has a\n                      // route ID which doesn't match the current route, rethrow the error\n                      if (\n                        !routeNotFoundComponent() ||\n                        (error.routeId &&\n                          error.routeId !== currentMatchState().routeId) ||\n                        (!error.routeId && !route().isRoot)\n                      )\n                        throw error\n\n                      return (\n                        <Dynamic\n                          component={routeNotFoundComponent()}\n                          {...error}\n                        />\n                      )\n                    }}\n                  >\n                    <Solid.Switch>\n                      <Solid.Match when={resolvedNoSsr}>\n                        <Solid.Show\n                          when={!(isServer ?? router.isServer)}\n                          fallback={\n                            <Dynamic component={resolvePendingComponent()} />\n                          }\n                        >\n                          <MatchInner />\n                        </Solid.Show>\n                      </Solid.Match>\n                      <Solid.Match when={!resolvedNoSsr}>\n                        <MatchInner />\n                      </Solid.Match>\n                    </Solid.Switch>\n                  </Dynamic>\n                </Dynamic>\n              </Dynamic>\n            </nearestMatchContext.Provider>\n\n            {currentMatchState().parentRouteId === rootRouteId ? (\n              <>\n                <OnRendered />\n                <ScrollRestoration />\n              </>\n            ) : null}\n          </ShellComponent>\n        )\n      }}\n    </Solid.Show>\n  )\n}\n\n// On Rendered can't happen above the root layout because it actually\n// renders a dummy dom element to track the rendered state of the app.\n// We render a script tag with a key that changes based on the current\n// location state.__TSR_key. Also, because it's below the root layout, it\n// allows us to fire onRendered events even after a hydration mismatch\n// error that occurred above the root layout (like bad head/link tags,\n// which is common).\nfunction OnRendered() {\n  const router = useRouter()\n\n  const location = Solid.createMemo(\n    () => router.stores.resolvedLocation.state?.state.__TSR_key,\n  )\n  Solid.createEffect(\n    Solid.on([location], () => {\n      router.emit({\n        type: 'onRendered',\n        ...getLocationChangeInfo(\n          router.stores.location.state,\n          router.stores.resolvedLocation.state,\n        ),\n      })\n    }),\n  )\n  return null\n}\n\nexport const MatchInner = (): any => {\n  const router = useRouter()\n  const match = Solid.useContext(nearestMatchContext).match\n\n  const rawMatchState = Solid.createMemo(() => {\n    const currentMatch = match()\n    if (!currentMatch) {\n      return null\n    }\n\n    const routeId = currentMatch.routeId as string\n\n    const remountFn =\n      (router.routesById[routeId] as AnyRoute).options.remountDeps ??\n      router.options.defaultRemountDeps\n    const remountDeps = remountFn?.({\n      routeId,\n      loaderDeps: currentMatch.loaderDeps,\n      params: currentMatch._strictParams,\n      search: currentMatch._strictSearch,\n    })\n    const key = remountDeps ? JSON.stringify(remountDeps) : undefined\n\n    return {\n      key,\n      routeId,\n      match: {\n        id: currentMatch.id,\n        status: currentMatch.status,\n        error: currentMatch.error,\n        _forcePending: currentMatch._forcePending ?? false,\n        _displayPending: currentMatch._displayPending ?? false,\n      },\n    }\n  })\n\n  return (\n    <Solid.Show when={rawMatchState()}>\n      {(currentMatchState) => {\n        const route = () => router.routesById[currentMatchState().routeId]!\n\n        const currentMatch = () => currentMatchState().match\n\n        const componentKey = () =>\n          currentMatchState().key ?? currentMatchState().match.id\n\n        const out = () => {\n          const Comp =\n            route().options.component ?? router.options.defaultComponent\n          if (Comp) {\n            return <Comp />\n          }\n          return <Outlet />\n        }\n\n        const keyedOut = () => (\n          <Solid.Show when={componentKey()} keyed>\n            {(_key) => out()}\n          </Solid.Show>\n        )\n\n        return (\n          <Solid.Switch>\n            <Solid.Match when={currentMatch()._displayPending}>\n              {(_) => {\n                const [displayPendingResult] = Solid.createResource(\n                  () =>\n                    router.getMatch(currentMatch().id)?._nonReactive\n                      .displayPendingPromise,\n                )\n\n                return <>{displayPendingResult()}</>\n              }}\n            </Solid.Match>\n            <Solid.Match when={currentMatch()._forcePending}>\n              {(_) => {\n                const [minPendingResult] = Solid.createResource(\n                  () =>\n                    router.getMatch(currentMatch().id)?._nonReactive\n                      .minPendingPromise,\n                )\n\n                return <>{minPendingResult()}</>\n              }}\n            </Solid.Match>\n            <Solid.Match when={currentMatch().status === 'pending'}>\n              {(_) => {\n                const pendingMinMs =\n                  route().options.pendingMinMs ??\n                  router.options.defaultPendingMinMs\n\n                if (pendingMinMs) {\n                  const routerMatch = router.getMatch(currentMatch().id)\n                  if (\n                    routerMatch &&\n                    !routerMatch._nonReactive.minPendingPromise\n                  ) {\n                    // Create a promise that will resolve after the minPendingMs\n                    if (!(isServer ?? router.isServer)) {\n                      const minPendingPromise = createControlledPromise<void>()\n\n                      routerMatch._nonReactive.minPendingPromise =\n                        minPendingPromise\n\n                      setTimeout(() => {\n                        minPendingPromise.resolve()\n                        // We've handled the minPendingPromise, so we can delete it\n                        routerMatch._nonReactive.minPendingPromise = undefined\n                      }, pendingMinMs)\n                    }\n                  }\n                }\n\n                const [loaderResult] = Solid.createResource(async () => {\n                  await new Promise((r) => setTimeout(r, 0))\n                  return router.getMatch(currentMatch().id)?._nonReactive\n                    .loadPromise\n                })\n\n                const FallbackComponent =\n                  route().options.pendingComponent ??\n                  router.options.defaultPendingComponent\n\n                return (\n                  <>\n                    {FallbackComponent && pendingMinMs > 0 ? (\n                      <Dynamic component={FallbackComponent} />\n                    ) : null}\n                    {loaderResult()}\n                  </>\n                )\n              }}\n            </Solid.Match>\n            <Solid.Match when={currentMatch().status === 'notFound'}>\n              {(_) => {\n                invariant(\n                  isNotFound(currentMatch().error),\n                  'Expected a notFound error',\n                )\n\n                // Use Show with keyed to ensure re-render when routeId changes\n                return (\n                  <Solid.Show when={currentMatchState().routeId} keyed>\n                    {(_routeId) =>\n                      renderRouteNotFound(router, route(), currentMatch().error)\n                    }\n                  </Solid.Show>\n                )\n              }}\n            </Solid.Match>\n            <Solid.Match when={currentMatch().status === 'redirected'}>\n              {(_) => {\n                invariant(\n                  isRedirect(currentMatch().error),\n                  'Expected a redirect error',\n                )\n\n                const [loaderResult] = Solid.createResource(async () => {\n                  await new Promise((r) => setTimeout(r, 0))\n                  return router.getMatch(currentMatch().id)?._nonReactive\n                    .loadPromise\n                })\n\n                return <>{loaderResult()}</>\n              }}\n            </Solid.Match>\n            <Solid.Match when={currentMatch().status === 'error'}>\n              {(_) => {\n                if (isServer ?? router.isServer) {\n                  const RouteErrorComponent =\n                    (route().options.errorComponent ??\n                      router.options.defaultErrorComponent) ||\n                    ErrorComponent\n\n                  return (\n                    <RouteErrorComponent\n                      error={currentMatch().error}\n                      info={{\n                        componentStack: '',\n                      }}\n                    />\n                  )\n                }\n\n                throw currentMatch().error\n              }}\n            </Solid.Match>\n            <Solid.Match when={currentMatch().status === 'success'}>\n              {keyedOut()}\n            </Solid.Match>\n          </Solid.Switch>\n        )\n      }}\n    </Solid.Show>\n  )\n}\n\nexport const Outlet = () => {\n  const router = useRouter()\n  const nearestParentMatch = Solid.useContext(nearestMatchContext)\n  const parentMatch = nearestParentMatch.match\n  const routeId = nearestParentMatch.routeId\n  const route = Solid.createMemo(() =>\n    routeId() ? router.routesById[routeId()!] : undefined,\n  )\n\n  const parentGlobalNotFound = Solid.createMemo(\n    () => parentMatch()?.globalNotFound ?? false,\n  )\n\n  const childMatchId = Solid.createMemo(() => {\n    const currentRouteId = routeId()\n    return currentRouteId\n      ? router.stores.childMatchIdByRouteId.state[currentRouteId]\n      : undefined\n  })\n\n  const childMatchStatus = Solid.createMemo(() => {\n    const id = childMatchId()\n    if (!id) return undefined\n    return router.stores.activeMatchStoresById.get(id)?.state.status\n  })\n\n  // Only show not-found if we're not in a redirected state\n  const shouldShowNotFound = () =>\n    childMatchStatus() !== 'redirected' && parentGlobalNotFound()\n\n  return (\n    <Solid.Show\n      when={!shouldShowNotFound() && childMatchId()}\n      fallback={\n        <Solid.Show when={shouldShowNotFound() && route()}>\n          {(resolvedRoute) =>\n            renderRouteNotFound(router, resolvedRoute(), undefined)\n          }\n        </Solid.Show>\n      }\n    >\n      {(childMatchIdAccessor) => {\n        const currentMatchId = Solid.createMemo(() => childMatchIdAccessor())\n\n        return (\n          <Solid.Show\n            when={routeId() === rootRouteId}\n            fallback={<Match matchId={currentMatchId()} />}\n          >\n            <Solid.Suspense\n              fallback={\n                <Dynamic component={router.options.defaultPendingComponent} />\n              }\n            >\n              <Match matchId={currentMatchId()} />\n            </Solid.Suspense>\n          </Solid.Show>\n        )\n      }}\n    </Solid.Show>\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/Matches.tsx",
    "content": "import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { replaceEqualDeep, rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { Transitioner } from './Transitioner'\nimport { nearestMatchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Match } from './Match'\nimport type {\n  AnyRoute,\n  AnyRouter,\n  DeepPartial,\n  Expand,\n  MakeOptionalPathParams,\n  MakeOptionalSearchParams,\n  MakeRouteMatchUnion,\n  MaskOptions,\n  MatchRouteOptions,\n  NoInfer,\n  RegisteredRouter,\n  ResolveRelativePath,\n  ResolveRoute,\n  RouteByPath,\n  ToSubOptionsProps,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n  export interface RouteMatchExtensions {\n    meta?: Array<Solid.JSX.IntrinsicElements['meta'] | undefined>\n    links?: Array<Solid.JSX.IntrinsicElements['link'] | undefined>\n    scripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n    styles?: Array<Solid.JSX.IntrinsicElements['style'] | undefined>\n    headScripts?: Array<Solid.JSX.IntrinsicElements['script'] | undefined>\n  }\n}\n\nexport function Matches() {\n  const router = useRouter()\n\n  const ResolvedSuspense =\n    (isServer ?? router.isServer) ||\n    (typeof document !== 'undefined' && router.ssr)\n      ? SafeFragment\n      : Solid.Suspense\n\n  const rootRoute: () => AnyRoute = () => router.routesById[rootRouteId]\n  const PendingComponent =\n    rootRoute().options.pendingComponent ??\n    router.options.defaultPendingComponent\n\n  const OptionalWrapper = router.options.InnerWrap || SafeFragment\n\n  return (\n    <OptionalWrapper>\n      <ResolvedSuspense\n        fallback={PendingComponent ? <PendingComponent /> : null}\n      >\n        <Transitioner />\n        <MatchesInner />\n      </ResolvedSuspense>\n    </OptionalWrapper>\n  )\n}\n\nfunction MatchesInner() {\n  const router = useRouter()\n  const matchId = () => router.stores.firstMatchId.state\n  const routeId = () => (matchId() ? rootRouteId : undefined)\n  const match = () =>\n    routeId()\n      ? router.stores.getMatchStoreByRouteId(rootRouteId).state\n      : undefined\n  const hasPendingMatch = () =>\n    routeId()\n      ? Boolean(router.stores.pendingRouteIds.state[rootRouteId])\n      : false\n  const resetKey = () => router.stores.loadedAt.state\n  const nearestMatch = {\n    matchId,\n    routeId,\n    match,\n    hasPending: hasPendingMatch,\n  }\n\n  const matchComponent = () => {\n    return (\n      <Solid.Show when={matchId()}>\n        <Match matchId={matchId()!} />\n      </Solid.Show>\n    )\n  }\n\n  return (\n    <nearestMatchContext.Provider value={nearestMatch}>\n      {router.options.disableGlobalCatchBoundary ? (\n        matchComponent()\n      ) : (\n        <CatchBoundary\n          getResetKey={() => resetKey()}\n          errorComponent={ErrorComponent}\n          onCatch={\n            process.env.NODE_ENV !== 'production'\n              ? (error) => {\n                  warning(\n                    false,\n                    `The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`,\n                  )\n                  warning(false, error.message || error.toString())\n                }\n              : undefined\n          }\n        >\n          {matchComponent()}\n        </CatchBoundary>\n      )}\n    </nearestMatchContext.Provider>\n  )\n}\n\nexport type UseMatchRouteOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = undefined,\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '',\n> = ToSubOptionsProps<TRouter, TFrom, TTo> &\n  DeepPartial<MakeOptionalSearchParams<TRouter, TFrom, TTo>> &\n  DeepPartial<MakeOptionalPathParams<TRouter, TFrom, TTo>> &\n  MaskOptions<TRouter, TMaskFrom, TMaskTo> &\n  MatchRouteOptions\n\nexport function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {\n  const router = useRouter()\n\n  return <\n    const TFrom extends string = string,\n    const TTo extends string | undefined = undefined,\n    const TMaskFrom extends string = TFrom,\n    const TMaskTo extends string = '',\n  >(\n    opts: UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n  ): Solid.Accessor<\n    false | Expand<ResolveRoute<TRouter, TFrom, TTo>['types']['allParams']>\n  > => {\n    return Solid.createMemo(() => {\n      const { pending, caseSensitive, fuzzy, includeSearch, ...rest } = opts\n\n      router.stores.matchRouteReactivity.state\n      return router.matchRoute(rest as any, {\n        pending,\n        caseSensitive,\n        fuzzy,\n        includeSearch,\n      })\n    })\n  }\n}\n\nexport type MakeMatchRouteOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = undefined,\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '',\n> = UseMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {\n  // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n  children?:\n    | ((\n        params?: RouteByPath<\n          TRouter['routeTree'],\n          ResolveRelativePath<TFrom, NoInfer<TTo>>\n        >['types']['allParams'],\n      ) => Solid.JSX.Element)\n    | Solid.JSX.Element\n}\n\nexport function MatchRoute<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = string,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(props: MakeMatchRouteOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): any {\n  const matchRoute = useMatchRoute()\n  const params = matchRoute(props as any)\n\n  const renderedChild = Solid.createMemo(() => {\n    const matchedParams = params()\n    const child = props.children\n\n    if (typeof child === 'function') {\n      return (child as any)(matchedParams)\n    }\n\n    return matchedParams ? child : null\n  })\n\n  return <>{renderedChild()}</>\n}\n\nexport interface UseMatchesBaseOptions<TRouter extends AnyRouter, TSelected> {\n  select?: (matches: Array<MakeRouteMatchUnion<TRouter>>) => TSelected\n}\n\nexport type UseMatchesResult<\n  TRouter extends AnyRouter,\n  TSelected,\n> = unknown extends TSelected ? Array<MakeRouteMatchUnion<TRouter>> : TSelected\n\nexport function useMatches<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n  const router = useRouter<TRouter>()\n  return Solid.createMemo((prev: TSelected | undefined) => {\n    const matches = router.stores.activeMatchesSnapshot.state as Array<\n      MakeRouteMatchUnion<TRouter>\n    >\n    const res = opts?.select ? opts.select(matches) : matches\n    if (prev === undefined) return res\n    return replaceEqualDeep(prev, res) as any\n  }) as Solid.Accessor<UseMatchesResult<TRouter, TSelected>>\n}\n\nexport function useParentMatches<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n  const contextMatchId = Solid.useContext(nearestMatchContext).matchId\n\n  return useMatches({\n    select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n      matches = matches.slice(\n        0,\n        matches.findIndex((d) => d.id === contextMatchId()),\n      )\n      return opts?.select ? opts.select(matches) : matches\n    },\n  } as any)\n}\n\nexport function useChildMatches<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseMatchesBaseOptions<TRouter, TSelected>,\n): Solid.Accessor<UseMatchesResult<TRouter, TSelected>> {\n  const contextMatchId = Solid.useContext(nearestMatchContext).matchId\n\n  return useMatches({\n    select: (matches: Array<MakeRouteMatchUnion<TRouter>>) => {\n      matches = matches.slice(\n        matches.findIndex((d) => d.id === contextMatchId()) + 1,\n      )\n      return opts?.select ? opts.select(matches) : matches\n    },\n  } as any)\n}\n"
  },
  {
    "path": "packages/solid-router/src/RouterProvider.tsx",
    "content": "import { routerContext } from './routerContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Matches } from './Matches'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  RouterOptions,\n} from '@tanstack/router-core'\nimport type * as Solid from 'solid-js'\n\nexport function RouterContextProvider<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n  router,\n  children,\n  ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n  children: () => Solid.JSX.Element\n}) {\n  // Allow the router to update options on the router instance\n  router.update({\n    ...router.options,\n    ...rest,\n    context: {\n      ...router.options.context,\n      ...rest.context,\n    },\n  })\n\n  const OptionalWrapper = router.options.Wrap || SafeFragment\n\n  return (\n    <OptionalWrapper>\n      <routerContext.Provider value={router as AnyRouter}>\n        {children()}\n      </routerContext.Provider>\n    </OptionalWrapper>\n  )\n}\n\nexport function RouterProvider<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n  return (\n    <RouterContextProvider router={router} {...rest}>\n      {() => <Matches />}\n    </RouterContextProvider>\n  )\n}\n\nexport type RouterProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n  RouterOptions<\n    TRouter['routeTree'],\n    NonNullable<TRouter['options']['trailingSlash']>,\n    false,\n    TRouter['history'],\n    TDehydrated\n  >,\n  'context'\n> & {\n  router: TRouter\n  context?: Partial<\n    RouterOptions<\n      TRouter['routeTree'],\n      NonNullable<TRouter['options']['trailingSlash']>,\n      false,\n      TRouter['history'],\n      TDehydrated\n    >['context']\n  >\n}\n"
  },
  {
    "path": "packages/solid-router/src/SafeFragment.tsx",
    "content": "export function SafeFragment(props: any) {\n  return <>{props.children}</>\n}\n"
  },
  {
    "path": "packages/solid-router/src/ScriptOnce.tsx",
    "content": "import { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nexport function ScriptOnce({\n  children,\n}: {\n  children: string\n  log?: boolean\n  sync?: boolean\n}) {\n  const router = useRouter()\n  if (!(isServer ?? router.isServer)) {\n    return null\n  }\n  return (\n    <script\n      nonce={router.options.ssr?.nonce}\n      class=\"$tsr\"\n      innerHTML={children + ';document.currentScript.remove()'}\n    />\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/Scripts.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\nexport const Scripts = () => {\n  const router = useRouter()\n  const nonce = router.options.ssr?.nonce\n  const activeMatches = Solid.createMemo(\n    () => router.stores.activeMatchesSnapshot.state,\n  )\n  const assetScripts = Solid.createMemo(() => {\n    const assetScripts: Array<RouterManagedTag> = []\n    const manifest = router.ssr?.manifest\n\n    if (!manifest) {\n      return []\n    }\n\n    activeMatches()\n      .map((match) => router.looseRoutesById[match.routeId]!)\n      .forEach((route) =>\n        manifest.routes[route.id]?.assets\n          ?.filter((d) => d.tag === 'script')\n          .forEach((asset) => {\n            assetScripts.push({\n              tag: 'script',\n              attrs: { ...asset.attrs, nonce },\n              children: asset.children,\n            } as any)\n          }),\n      )\n\n    return assetScripts\n  })\n\n  const scripts = Solid.createMemo(() =>\n    (\n      activeMatches()\n        .map((match) => match.scripts!)\n        .flat(1)\n        .filter(Boolean) as Array<RouterManagedTag>\n    ).map(({ children, ...script }) => ({\n      tag: 'script',\n      attrs: {\n        ...script,\n        nonce,\n      },\n      children,\n    })),\n  )\n\n  let serverBufferedScript: RouterManagedTag | undefined = undefined\n\n  if (router.serverSsr) {\n    serverBufferedScript = router.serverSsr.takeBufferedScripts()\n  }\n\n  const allScripts = [\n    ...scripts(),\n    ...assetScripts(),\n  ] as Array<RouterManagedTag>\n\n  if (serverBufferedScript) {\n    allScripts.unshift(serverBufferedScript)\n  }\n\n  return (\n    <>\n      {allScripts.map((asset, i) => (\n        <Asset {...asset} />\n      ))}\n    </>\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/ScrollRestoration.tsx",
    "content": "import {\n  defaultGetScrollRestorationKey,\n  getCssSelector,\n  scrollRestorationCache,\n  setupScrollRestoration,\n} from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n  ParsedLocation,\n  ScrollRestorationEntry,\n  ScrollRestorationOptions,\n} from '@tanstack/router-core'\n\nfunction useScrollRestoration() {\n  const router = useRouter()\n  setupScrollRestoration(router, true)\n}\n\n/**\n * @deprecated use createRouter's `scrollRestoration` option instead\n */\nexport function ScrollRestoration(_props: ScrollRestorationOptions) {\n  useScrollRestoration()\n\n  if (process.env.NODE_ENV === 'development') {\n    console.warn(\n      \"The ScrollRestoration component is deprecated. Use createRouter's `scrollRestoration` option instead.\",\n    )\n  }\n\n  return null\n}\n\nexport function useElementScrollRestoration(\n  options: (\n    | {\n        id: string\n        getElement?: () => Window | Element | undefined | null\n      }\n    | {\n        id?: string\n        getElement: () => Window | Element | undefined | null\n      }\n  ) & {\n    getKey?: (location: ParsedLocation) => string\n  },\n): ScrollRestorationEntry | undefined {\n  useScrollRestoration()\n\n  const router = useRouter()\n  const getKey = options.getKey || defaultGetScrollRestorationKey\n\n  let elementSelector = ''\n\n  if (options.id) {\n    elementSelector = `[data-scroll-restoration-id=\"${options.id}\"]`\n  } else {\n    const element = options.getElement?.()\n    if (!element) {\n      return\n    }\n    elementSelector =\n      element instanceof Window ? 'window' : getCssSelector(element)\n  }\n\n  const restoreKey = getKey(router.latestLocation)\n  const byKey = scrollRestorationCache?.state[restoreKey]\n  return byKey?.[elementSelector]\n}\n"
  },
  {
    "path": "packages/solid-router/src/Transitioner.tsx",
    "content": "import * as Solid from 'solid-js'\nimport {\n  getLocationChangeInfo,\n  handleHashScroll,\n  trimPathRight,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nexport function Transitioner() {\n  const router = useRouter()\n  let mountLoadForRouter = { router, mounted: false }\n  const isLoading = Solid.createMemo(() => router.stores.isLoading.state)\n\n  if (isServer ?? router.isServer) {\n    return null\n  }\n\n  const [isSolidTransitioning, startSolidTransition] = Solid.useTransition()\n\n  // Track pending state changes\n  const hasPendingMatches = Solid.createMemo(\n    () => router.stores.hasPendingMatches.state,\n  )\n\n  const isAnyPending = Solid.createMemo(\n    () => isLoading() || isSolidTransitioning() || hasPendingMatches(),\n  )\n\n  const isPagePending = Solid.createMemo(\n    () => isLoading() || hasPendingMatches(),\n  )\n\n  router.startTransition = (fn: () => void | Promise<void>) => {\n    Solid.startTransition(() => {\n      startSolidTransition(fn)\n    })\n  }\n\n  // Subscribe to location changes\n  // and try to load the new location\n  Solid.onMount(() => {\n    const unsub = router.history.subscribe(router.load)\n\n    const nextLocation = router.buildLocation({\n      to: router.latestLocation.pathname,\n      search: true,\n      params: true,\n      hash: true,\n      state: true,\n      _includeValidateSearch: true,\n    })\n\n    // Check if the current URL matches the canonical form.\n    // Compare publicHref (browser-facing URL) for consistency with\n    // the server-side redirect check in router.beforeLoad.\n    if (\n      trimPathRight(router.latestLocation.publicHref) !==\n      trimPathRight(nextLocation.publicHref)\n    ) {\n      router.commitLocation({ ...nextLocation, replace: true })\n    }\n\n    Solid.onCleanup(() => {\n      unsub()\n    })\n  })\n\n  // Try to load the initial location\n  Solid.createRenderEffect(() => {\n    Solid.untrack(() => {\n      if (\n        // if we are hydrating from SSR, loading is triggered in ssr-client\n        (typeof window !== 'undefined' && router.ssr) ||\n        (mountLoadForRouter.router === router && mountLoadForRouter.mounted)\n      ) {\n        return\n      }\n      mountLoadForRouter = { router, mounted: true }\n      const tryLoad = async () => {\n        try {\n          await router.load()\n        } catch (err) {\n          console.error(err)\n        }\n      }\n      tryLoad()\n    })\n  })\n\n  Solid.createRenderEffect((previousIsLoading = false) => {\n    const currentIsLoading = isLoading()\n\n    if (previousIsLoading && !currentIsLoading) {\n      router.emit({\n        type: 'onLoad',\n        ...getLocationChangeInfo(\n          router.stores.location.state,\n          router.stores.resolvedLocation.state,\n        ),\n      })\n    }\n\n    return currentIsLoading\n  })\n\n  Solid.createComputed((previousIsPagePending = false) => {\n    const currentIsPagePending = isPagePending()\n\n    if (previousIsPagePending && !currentIsPagePending) {\n      router.emit({\n        type: 'onBeforeRouteMount',\n        ...getLocationChangeInfo(\n          router.stores.location.state,\n          router.stores.resolvedLocation.state,\n        ),\n      })\n    }\n\n    return currentIsPagePending\n  })\n\n  Solid.createRenderEffect((previousIsAnyPending = false) => {\n    const currentIsAnyPending = isAnyPending()\n\n    if (previousIsAnyPending && !currentIsAnyPending) {\n      const changeInfo = getLocationChangeInfo(\n        router.stores.location.state,\n        router.stores.resolvedLocation.state,\n      )\n      router.emit({\n        type: 'onResolved',\n        ...changeInfo,\n      })\n\n      Solid.batch(() => {\n        router.stores.status.setState(() => 'idle')\n        router.stores.resolvedLocation.setState(\n          () => router.stores.location.state,\n        )\n      })\n\n      if (changeInfo.hrefChanged) {\n        handleHashScroll(router)\n      }\n    }\n\n    return currentIsAnyPending\n  })\n\n  return null\n}\n"
  },
  {
    "path": "packages/solid-router/src/awaited.tsx",
    "content": "import * as Solid from 'solid-js'\n\nimport { TSR_DEFERRED_PROMISE, defer } from '@tanstack/router-core'\nimport type { DeferredPromise } from '@tanstack/router-core'\nimport type { SolidNode } from './route'\n\nexport type AwaitOptions<T> = {\n  promise: Promise<T>\n}\n\nexport function useAwaited<T>({\n  promise: _promise,\n}: AwaitOptions<T>): [T, DeferredPromise<T>] {\n  const promise = defer(_promise)\n\n  if (promise[TSR_DEFERRED_PROMISE].status === 'pending') {\n    throw promise\n  }\n\n  if (promise[TSR_DEFERRED_PROMISE].status === 'error') {\n    throw promise[TSR_DEFERRED_PROMISE].error\n  }\n\n  return [promise[TSR_DEFERRED_PROMISE].data, promise]\n}\n\nexport function Await<T>(\n  props: AwaitOptions<T> & {\n    fallback?: SolidNode\n    children: (result: T) => SolidNode\n  },\n) {\n  const [resource] = Solid.createResource(\n    () => defer(props.promise),\n    // Simple passthrough - just return the promise for Solid to await\n    (p) => p,\n    {\n      deferStream: true,\n    },\n  )\n\n  return (\n    <Solid.Show fallback={props.fallback} when={resource()}>\n      {(data) => props.children(data())}\n    </Solid.Show>\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/fileRoute.ts",
    "content": "import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport { useRouteContext } from './useRouteContext'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n  AnyContext,\n  AnyRoute,\n  AnyRouter,\n  Constrain,\n  ConstrainLiteral,\n  FileBaseRouteOptions,\n  FileRoutesByPath,\n  LazyRouteOptions,\n  Register,\n  RegisteredRouter,\n  ResolveParams,\n  Route,\n  RouteById,\n  RouteConstraints,\n  RouteIds,\n  RouteLoaderEntry,\n  UpdatableRouteOptions,\n  UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n  TFilePath extends keyof FileRoutesByPath,\n  TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n  TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n  TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n  TFullPath extends RouteConstraints['TFullPath'] =\n    FileRoutesByPath[TFilePath]['fullPath'],\n>(\n  path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n  if (typeof path === 'object') {\n    return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n      silent: true,\n    }).createRoute(path) as any\n  }\n  return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n    silent: true,\n  }).createRoute\n}\n\n/** \n  @deprecated It's no longer recommended to use the `FileRoute` class directly.\n  Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n  TFilePath extends keyof FileRoutesByPath,\n  TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n  TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n  TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n  TFullPath extends RouteConstraints['TFullPath'] =\n    FileRoutesByPath[TFilePath]['fullPath'],\n> {\n  silent?: boolean\n\n  constructor(\n    public path?: TFilePath,\n    _opts?: { silent: boolean },\n  ) {\n    this.silent = _opts?.silent\n  }\n\n  createRoute = <\n    TRegister = Register,\n    TSearchValidator = undefined,\n    TParams = ResolveParams<TPath>,\n    TRouteContextFn = AnyContext,\n    TBeforeLoadFn = AnyContext,\n    TLoaderDeps extends Record<string, any> = {},\n    TLoaderFn = undefined,\n    TChildren = unknown,\n    TSSR = unknown,\n    TMiddlewares = unknown,\n    THandlers = undefined,\n  >(\n    options?: FileBaseRouteOptions<\n      TRegister,\n      TParentRoute,\n      TId,\n      TPath,\n      TSearchValidator,\n      TParams,\n      TLoaderDeps,\n      TLoaderFn,\n      AnyContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      AnyContext,\n      TSSR,\n      TMiddlewares,\n      THandlers\n    > &\n      UpdatableRouteOptions<\n        TParentRoute,\n        TId,\n        TFullPath,\n        TParams,\n        TSearchValidator,\n        TLoaderFn,\n        TLoaderDeps,\n        AnyContext,\n        TRouteContextFn,\n        TBeforeLoadFn\n      >,\n  ): Route<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TFilePath,\n    TId,\n    TSearchValidator,\n    TParams,\n    AnyContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    unknown,\n    TSSR,\n    TMiddlewares,\n    THandlers\n  > => {\n    if (process.env.NODE_ENV !== 'production') {\n      warning(\n        this.silent,\n        'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n      )\n    }\n    const route = createRoute(options as any)\n    ;(route as any).isRoot = false\n    return route as any\n  }\n}\n\n/** \n  @deprecated It's recommended not to split loaders into separate files.\n  Instead, place the loader function in the the main route file, inside the\n  `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n  TFilePath extends keyof FileRoutesByPath,\n  TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n  _path: TFilePath,\n): <TLoaderFn>(\n  loaderFn: Constrain<\n    TLoaderFn,\n    RouteLoaderEntry<\n      Register,\n      TRoute['parentRoute'],\n      TRoute['types']['id'],\n      TRoute['types']['params'],\n      TRoute['types']['loaderDeps'],\n      TRoute['types']['routerContext'],\n      TRoute['types']['routeContextFn'],\n      TRoute['types']['beforeLoadFn']\n    >\n  >,\n) => TLoaderFn {\n  if (process.env.NODE_ENV !== 'production') {\n    warning(\n      false,\n      `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n    )\n  }\n  return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n  export interface LazyRoute<in out TRoute extends AnyRoute> {\n    useMatch: UseMatchRoute<TRoute['id']>\n    useRouteContext: UseRouteContextRoute<TRoute['id']>\n    useSearch: UseSearchRoute<TRoute['id']>\n    useParams: UseParamsRoute<TRoute['id']>\n    useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n    useLoaderData: UseLoaderDataRoute<TRoute['id']>\n    useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n  }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n  options: {\n    id: string\n  } & LazyRouteOptions\n\n  constructor(\n    opts: {\n      id: string\n    } & LazyRouteOptions,\n  ) {\n    this.options = opts\n  }\n\n  useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n    return useMatch({\n      select: opts?.select,\n      from: this.options.id,\n    } as any) as any\n  }\n\n  useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n    return useRouteContext({ ...(opts as any), from: this.options.id }) as any\n  }\n\n  useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n    return useSearch({\n      select: opts?.select,\n      from: this.options.id,\n    } as any) as any\n  }\n\n  useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n    return useParams({\n      select: opts?.select,\n      from: this.options.id,\n    } as any) as any\n  }\n\n  useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n    return useLoaderDeps({ ...opts, from: this.options.id } as any)\n  }\n\n  useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n    return useLoaderData({ ...opts, from: this.options.id } as any)\n  }\n\n  useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n    const router = useRouter()\n    return useNavigate({ from: router.routesById[this.options.id].fullPath })\n  }\n}\n\nexport function createLazyRoute<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TId extends string = string,\n  TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n  return (opts: LazyRouteOptions) => {\n    return new LazyRoute<TRoute>({\n      id: id,\n      ...opts,\n    })\n  }\n}\nexport function createLazyFileRoute<\n  TFilePath extends keyof FileRoutesByPath,\n  TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n  if (typeof id === 'object') {\n    return new LazyRoute<TRoute>(id) as any\n  }\n\n  return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"
  },
  {
    "path": "packages/solid-router/src/headContentUtils.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { escapeHtml } from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\n/**\n * Build the list of head/link/meta/script tags to render for active matches.\n * Used internally by `HeadContent`.\n */\nexport const useTags = () => {\n  const router = useRouter()\n  const nonce = router.options.ssr?.nonce\n  const activeMatches = Solid.createMemo(\n    () => router.stores.activeMatchesSnapshot.state,\n  )\n  const routeMeta = Solid.createMemo(() =>\n    activeMatches()\n      .map((match) => match.meta!)\n      .filter(Boolean),\n  )\n\n  const meta: Solid.Accessor<Array<RouterManagedTag>> = Solid.createMemo(() => {\n    const resultMeta: Array<RouterManagedTag> = []\n    const metaByAttribute: Record<string, true> = {}\n    let title: RouterManagedTag | undefined\n    const routeMetasArray = routeMeta()\n    for (let i = routeMetasArray.length - 1; i >= 0; i--) {\n      const metas = routeMetasArray[i]!\n      for (let j = metas.length - 1; j >= 0; j--) {\n        const m = metas[j]\n        if (!m) continue\n\n        if (m.title) {\n          if (!title) {\n            title = {\n              tag: 'title',\n              children: m.title,\n            }\n          }\n        } else if ('script:ld+json' in m) {\n          // Handle JSON-LD structured data\n          // Content is HTML-escaped to prevent XSS when injected via innerHTML\n          try {\n            const json = JSON.stringify(m['script:ld+json'])\n            resultMeta.push({\n              tag: 'script',\n              attrs: {\n                type: 'application/ld+json',\n              },\n              children: escapeHtml(json),\n            })\n          } catch {\n            // Skip invalid JSON-LD objects\n          }\n        } else {\n          const attribute = m.name ?? m.property\n          if (attribute) {\n            if (metaByAttribute[attribute]) {\n              continue\n            } else {\n              metaByAttribute[attribute] = true\n            }\n          }\n\n          resultMeta.push({\n            tag: 'meta',\n            attrs: {\n              ...m,\n              nonce,\n            },\n          })\n        }\n      }\n    }\n\n    if (title) {\n      resultMeta.push(title)\n    }\n\n    if (router.options.ssr?.nonce) {\n      resultMeta.push({\n        tag: 'meta',\n        attrs: {\n          property: 'csp-nonce',\n          content: router.options.ssr.nonce,\n        },\n      })\n    }\n    resultMeta.reverse()\n\n    return resultMeta\n  })\n\n  const links = Solid.createMemo(() => {\n    const matches = activeMatches()\n    const constructed = matches\n      .map((match) => match.links!)\n      .filter(Boolean)\n      .flat(1)\n      .map((link) => ({\n        tag: 'link',\n        attrs: {\n          ...link,\n          nonce,\n        },\n      })) satisfies Array<RouterManagedTag>\n\n    const manifest = router.ssr?.manifest\n\n    const assets = matches\n      .map((match) => manifest?.routes[match.routeId]?.assets ?? [])\n      .filter(Boolean)\n      .flat(1)\n      .filter((asset) => asset.tag === 'link')\n      .map(\n        (asset) =>\n          ({\n            tag: 'link',\n            attrs: { ...asset.attrs, nonce },\n          }) satisfies RouterManagedTag,\n      )\n\n    return [...constructed, ...assets]\n  })\n\n  const preloadLinks = Solid.createMemo(() => {\n    const matches = activeMatches()\n    const preloadLinks: Array<RouterManagedTag> = []\n\n    matches\n      .map((match) => router.looseRoutesById[match.routeId]!)\n      .forEach((route) =>\n        router.ssr?.manifest?.routes[route.id]?.preloads\n          ?.filter(Boolean)\n          .forEach((preload) => {\n            preloadLinks.push({\n              tag: 'link',\n              attrs: {\n                rel: 'modulepreload',\n                href: preload,\n                nonce,\n              },\n            })\n          }),\n      )\n\n    return preloadLinks\n  })\n\n  const styles = Solid.createMemo(() =>\n    (\n      activeMatches()\n        .map((match) => match.styles!)\n        .flat(1)\n        .filter(Boolean) as Array<RouterManagedTag>\n    ).map(({ children, ...style }) => ({\n      tag: 'style',\n      attrs: {\n        ...style,\n        nonce,\n      },\n      children,\n    })),\n  )\n\n  const headScripts = Solid.createMemo(() =>\n    (\n      activeMatches()\n        .map((match) => match.headScripts!)\n        .flat(1)\n        .filter(Boolean) as Array<RouterManagedTag>\n    ).map(({ children, ...script }) => ({\n      tag: 'script',\n      attrs: {\n        ...script,\n        nonce,\n      },\n      children,\n    })),\n  )\n\n  return () =>\n    uniqBy(\n      [\n        ...meta(),\n        ...preloadLinks(),\n        ...links(),\n        ...styles(),\n        ...headScripts(),\n      ] as Array<RouterManagedTag>,\n      (d) => {\n        return JSON.stringify(d)\n      },\n    )\n}\n\nexport function uniqBy<T>(arr: Array<T>, fn: (item: T) => string) {\n  const seen = new Set<string>()\n  return arr.filter((item) => {\n    const key = fn(item)\n    if (seen.has(key)) {\n      return false\n    }\n    seen.add(key)\n    return true\n  })\n}\n"
  },
  {
    "path": "packages/solid-router/src/history.ts",
    "content": "import type { HistoryLocation } from '@tanstack/history'\n\ndeclare module '@tanstack/history' {\n  interface HistoryState {\n    __tempLocation?: HistoryLocation\n    __tempKey?: string\n    __hashScrollIntoViewOptions?: boolean | ScrollIntoViewOptions\n  }\n}\n"
  },
  {
    "path": "packages/solid-router/src/index.dev.tsx",
    "content": "// Development entry point - re-exports everything from index.tsx\n// but overrides HeadContent with the dev version that handles\n// dev styles cleanup after hydration\n\nexport * from './index'\nexport { HeadContent } from './HeadContent.dev'\n"
  },
  {
    "path": "packages/solid-router/src/index.tsx",
    "content": "export {\n  defer,\n  isMatch,\n  joinPaths,\n  cleanPath,\n  trimPathLeft,\n  trimPathRight,\n  trimPath,\n  resolvePath,\n  interpolatePath,\n  rootRouteId,\n  defaultParseSearch,\n  defaultStringifySearch,\n  parseSearchWith,\n  stringifySearchWith,\n  functionalUpdate,\n  replaceEqualDeep,\n  isPlainObject,\n  isPlainArray,\n  deepEqual,\n  createControlledPromise,\n  retainSearchParams,\n  stripSearchParams,\n  createSerializationAdapter,\n} from '@tanstack/router-core'\n\nexport type {\n  DeferredPromiseState,\n  DeferredPromise,\n  ParsedLocation,\n  RemoveTrailingSlashes,\n  RemoveLeadingSlashes,\n  ActiveOptions,\n  ResolveRelativePath,\n  RootRouteId,\n  AnyPathParams,\n  ResolveParams,\n  ResolveOptionalParams,\n  ResolveRequiredParams,\n  SearchSchemaInput,\n  AnyContext,\n  RouteContext,\n  PreloadableObj,\n  RoutePathOptions,\n  StaticDataRouteOption,\n  RoutePathOptionsIntersection,\n  UpdatableStaticRouteOption,\n  MetaDescriptor,\n  RouteLinkEntry,\n  ParseParamsFn,\n  SearchFilter,\n  ResolveId,\n  InferFullSearchSchema,\n  InferFullSearchSchemaInput,\n  ErrorRouteProps,\n  ErrorComponentProps,\n  NotFoundRouteProps,\n  TrimPath,\n  TrimPathLeft,\n  TrimPathRight,\n  StringifyParamsFn,\n  ParamsOptions,\n  InferAllParams,\n  InferAllContext,\n  LooseReturnType,\n  LooseAsyncReturnType,\n  ContextReturnType,\n  ContextAsyncReturnType,\n  ResolveLoaderData,\n  ResolveRouteContext,\n  SearchSerializer,\n  SearchParser,\n  TrailingSlashOption,\n  Manifest,\n  RouterManagedTag,\n  ControlledPromise,\n  Constrain,\n  Expand,\n  MergeAll,\n  Assign,\n  IntersectAssign,\n  ResolveValidatorInput,\n  ResolveValidatorOutput,\n  AnyValidator,\n  DefaultValidator,\n  ValidatorFn,\n  AnySchema,\n  AnyValidatorAdapter,\n  AnyValidatorFn,\n  AnyValidatorObj,\n  ResolveValidatorInputFn,\n  ResolveValidatorOutputFn,\n  ResolveSearchValidatorInput,\n  ResolveSearchValidatorInputFn,\n  Validator,\n  ValidatorAdapter,\n  ValidatorObj,\n  NavigateFn,\n  BuildLocationFn,\n  InferDescendantToPaths,\n  RelativeToPath,\n  RelativeToParentPath,\n  RelativeToCurrentPath,\n  Register,\n  AbsoluteToPath,\n  RelativeToPathAutoComplete,\n  NavigateOptions,\n  ToOptions,\n  ToMaskOptions,\n  ToSubOptions,\n  ResolveRoute,\n  SearchParamOptions,\n  PathParamOptions,\n  ToPathOption,\n  LinkOptions,\n  MakeOptionalPathParams,\n  AnyRouterWithContext,\n  ParseRoute,\n  RoutesById,\n  RouteById,\n  RouteIds,\n  RoutesByPath,\n  RouteByPath,\n  RoutePaths,\n  FullSearchSchema,\n  AllParams,\n  AllLoaderData,\n  FullSearchSchemaInput,\n  AllContext,\n  CommitLocationOptions,\n  MatchLocation,\n  ResolveFullSearchSchema,\n  ResolveFullSearchSchemaInput,\n  ResolveAllParamsFromParent,\n  RouteContextParameter,\n  BeforeLoadContextParameter,\n  ResolveAllContext,\n  FullSearchSchemaOption,\n  MakeRemountDepsOptionsUnion,\n  RemountDepsOptions,\n  FileRouteTypes,\n  FileRoutesByPath,\n  UseNavigateResult,\n  AnyRedirect,\n  Redirect,\n  RedirectOptions,\n  ResolvedRedirect,\n  RouteOptions,\n  FileBaseRouteOptions,\n  BaseRouteOptions,\n  UpdatableRouteOptions,\n  RouteLoaderFn,\n  LoaderFnContext,\n  MakeRouteMatch,\n  MakeRouteMatchUnion,\n  RouteMatch,\n  AnyRouteMatch,\n  RouteContextFn,\n  RouteContextOptions,\n  BeforeLoadContextOptions,\n  ContextOptions,\n  RootRouteOptions,\n  AnyRouteWithContext,\n  LazyRouteOptions,\n  AnyRoute,\n  ResolveFullPath,\n  RouteConstraints,\n  RouterState,\n  ListenerFn,\n  BuildNextOptions,\n  AnyRouter,\n  RegisteredRouter,\n  RouterEvents,\n  RouterEvent,\n  RouterListener,\n  MatchRouteOptions,\n  RouteMask,\n  RouterContextOptions,\n  RouterOptions,\n  RouterConstructorOptions,\n  ControllablePromise,\n  InjectedHtmlEntry,\n  CreateFileRoute,\n  CreateLazyFileRoute,\n  AnySerializationAdapter,\n  SerializationAdapter,\n  SerializableExtensions,\n} from '@tanstack/router-core'\n\nexport {\n  createHistory,\n  createBrowserHistory,\n  createHashHistory,\n  createMemoryHistory,\n} from '@tanstack/history'\n\nexport type {\n  BlockerFn,\n  HistoryLocation,\n  RouterHistory,\n  ParsedPath,\n  HistoryState,\n} from '@tanstack/history'\n\nexport { useAwaited, Await } from './awaited'\nexport type { AwaitOptions } from './awaited'\n\nexport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nexport { ClientOnly, useHydrated } from './ClientOnly'\n\nexport {\n  FileRoute,\n  createFileRoute,\n  FileRouteLoader,\n  LazyRoute,\n  createLazyRoute,\n  createLazyFileRoute,\n} from './fileRoute'\n\nexport * from './history'\n\nexport { lazyRouteComponent } from './lazyRouteComponent'\n\nexport { useLinkProps, createLink, Link, linkOptions } from './link'\nexport type {\n  UseLinkPropsOptions,\n  ActiveLinkOptions,\n  LinkProps,\n  LinkComponent,\n  LinkComponentProps,\n  CreateLinkProps,\n} from './link'\n\nexport {\n  Matches,\n  useMatchRoute,\n  MatchRoute,\n  useMatches,\n  useParentMatches,\n  useChildMatches,\n} from './Matches'\n\nexport type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches'\n\nexport { Match, Outlet } from './Match'\n\nexport { useMatch } from './useMatch'\nexport { useLoaderDeps } from './useLoaderDeps'\nexport { useLoaderData } from './useLoaderData'\n\nexport {\n  redirect,\n  isRedirect,\n  DEFAULT_PROTOCOL_ALLOWLIST,\n} from '@tanstack/router-core'\n\nexport {\n  RouteApi,\n  getRouteApi,\n  Route,\n  createRoute,\n  RootRoute,\n  rootRouteWithContext,\n  createRootRoute,\n  createRootRouteWithContext,\n  createRouteMask,\n  NotFoundRoute,\n} from './route'\nexport type {\n  AnyRootRoute,\n  SolidNode,\n  AsyncRouteComponent,\n  RouteComponent,\n  ErrorRouteComponent,\n  NotFoundRouteComponent,\n} from './route'\n\nexport { createRouter, Router } from './router'\n\nexport { lazyFn, SearchParamError } from '@tanstack/router-core'\n\nexport { RouterProvider, RouterContextProvider } from './RouterProvider'\nexport type { RouterProps } from './RouterProvider'\n\nexport {\n  useElementScrollRestoration,\n  ScrollRestoration,\n} from './ScrollRestoration'\n\nexport type { UseBlockerOpts, ShouldBlockFn } from './useBlocker'\nexport { useBlocker, Block } from './useBlocker'\n\nexport { useNavigate, Navigate } from './useNavigate'\n\nexport { useParams } from './useParams'\nexport { useSearch } from './useSearch'\n\nexport { useRouteContext } from './useRouteContext'\nexport { useRouter } from './useRouter'\nexport { useRouterState } from './useRouterState'\nexport { useLocation } from './useLocation'\nexport { useCanGoBack } from './useCanGoBack'\n\nexport { CatchNotFound, DefaultGlobalNotFound } from './not-found'\nexport { notFound, isNotFound } from '@tanstack/router-core'\nexport type { NotFoundError } from '@tanstack/router-core'\n\nexport type {\n  ValidateLinkOptions,\n  ValidateUseSearchOptions,\n  ValidateUseParamsOptions,\n  ValidateLinkOptionsArray,\n} from './typePrimitives'\n\nexport type {\n  ValidateFromPath,\n  ValidateToPath,\n  ValidateSearch,\n  ValidateParams,\n  InferFrom,\n  InferTo,\n  InferMaskTo,\n  InferMaskFrom,\n  ValidateNavigateOptions,\n  ValidateNavigateOptionsArray,\n  ValidateRedirectOptions,\n  ValidateRedirectOptionsArray,\n  ValidateId,\n  InferStrict,\n  InferShouldThrow,\n  InferSelected,\n  ValidateUseSearchResult,\n  ValidateUseParamsResult,\n} from '@tanstack/router-core'\n\nexport { ScriptOnce } from './ScriptOnce'\n\nexport { Asset } from './Asset'\nexport { HeadContent } from './HeadContent'\nexport { useTags } from './headContentUtils'\nexport { Scripts } from './Scripts'\nexport { composeRewrites } from '@tanstack/router-core'\nexport type {\n  LocationRewrite,\n  LocationRewriteFunction,\n} from '@tanstack/router-core'\n"
  },
  {
    "path": "packages/solid-router/src/lazyRouteComponent.tsx",
    "content": "import { Dynamic } from 'solid-js/web'\nimport { createResource } from 'solid-js'\nimport { isModuleNotFoundError } from '@tanstack/router-core'\nimport type { AsyncRouteComponent } from './route'\n\nexport function lazyRouteComponent<\n  T extends Record<string, any>,\n  TKey extends keyof T = 'default',\n>(\n  importer: () => Promise<T>,\n  exportName?: TKey,\n): T[TKey] extends (props: infer TProps) => any\n  ? AsyncRouteComponent<TProps>\n  : never {\n  let loadPromise: Promise<any> | undefined\n  let comp: T[TKey] | T['default']\n  let error: any\n\n  const load = () => {\n    if (!loadPromise) {\n      loadPromise = importer()\n        .then((res) => {\n          loadPromise = undefined\n          comp = res[exportName ?? 'default']\n          return comp\n        })\n        .catch((err) => {\n          error = err\n        })\n    }\n\n    return loadPromise\n  }\n\n  const lazyComp = function Lazy(props: any) {\n    // Now that we're out of preload and into actual render path,\n    // throw the error if it was a module not found error during preload\n    if (error) {\n      // If the load fails due to module not found, it may mean a new version of\n      // the build was deployed and the user's browser is still using an old version.\n      // If this happens, the old version in the user's browser would have an outdated\n      // URL to the lazy module.\n      // In that case, we want to attempt one window refresh to get the latest.\n      if (isModuleNotFoundError(error)) {\n        // We don't want an error thrown from preload in this case, because\n        // there's nothing we want to do about module not found during preload.\n        // Record the error, recover the promise with a null return,\n        // and we will attempt module not found resolution during the render path.\n\n        if (\n          error instanceof Error &&\n          typeof window !== 'undefined' &&\n          typeof sessionStorage !== 'undefined'\n        ) {\n          // Again, we want to reload one time on module not found error and not enter\n          // a reload loop if there is some other issue besides an old deploy.\n          // That's why we store our reload attempt in sessionStorage.\n          // Use error.message as key because it contains the module path that failed.\n          const storageKey = `tanstack_router_reload:${error.message}`\n          if (!sessionStorage.getItem(storageKey)) {\n            sessionStorage.setItem(storageKey, '1')\n            window.location.reload()\n\n            // Return empty component while we wait for window to reload\n            return {\n              default: () => null,\n            }\n          }\n        }\n      }\n\n      // Otherwise, just throw the error\n      throw error\n    }\n\n    if (!comp) {\n      const [compResource] = createResource(load, {\n        initialValue: comp,\n        ssrLoadFrom: 'initial',\n      })\n      return <Dynamic component={compResource()} {...props} />\n    }\n\n    return <Dynamic component={comp} {...props} />\n  }\n\n  ;(lazyComp as any).preload = load\n\n  return lazyComp as any\n}\n"
  },
  {
    "path": "packages/solid-router/src/link.tsx",
    "content": "import * as Solid from 'solid-js'\n\nimport { mergeRefs } from '@solid-primitives/refs'\n\nimport {\n  deepEqual,\n  exactPathTest,\n  functionalUpdate,\n  isDangerousProtocol,\n  preloadWarning,\n  removeTrailingSlash,\n} from '@tanstack/router-core'\n\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { Dynamic } from 'solid-js/web'\nimport { useRouter } from './useRouter'\n\nimport { useIntersectionObserver } from './utils'\n\nimport { useHydrated } from './ClientOnly'\nimport type {\n  AnyRouter,\n  Constrain,\n  LinkOptions,\n  RegisteredRouter,\n  RoutePaths,\n} from '@tanstack/router-core'\nimport type {\n  ValidateLinkOptions,\n  ValidateLinkOptionsArray,\n} from './typePrimitives'\n\nconst timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()\n\nexport function useLinkProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n  TTo extends string = '',\n  TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n  TMaskTo extends string = '',\n>(\n  options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Solid.ComponentProps<'a'> {\n  const router = useRouter()\n  const [isTransitioning, setIsTransitioning] = Solid.createSignal(false)\n  const shouldHydrateHash = !isServer && !!router.options.ssr\n  const hasHydrated = useHydrated()\n\n  let hasRenderFetched = false\n\n  const [local, rest] = Solid.splitProps(\n    Solid.mergeProps(\n      {\n        activeProps: STATIC_ACTIVE_PROPS_GET,\n        inactiveProps: STATIC_INACTIVE_PROPS_GET,\n      },\n      options,\n    ),\n    [\n      'activeProps',\n      'inactiveProps',\n      'activeOptions',\n      'to',\n      'preload',\n      'preloadDelay',\n      'hashScrollIntoView',\n      'replace',\n      'startTransition',\n      'resetScroll',\n      'viewTransition',\n      'target',\n      'disabled',\n      'style',\n      'class',\n      'onClick',\n      'onBlur',\n      'onFocus',\n      'onMouseEnter',\n      'onMouseLeave',\n      'onMouseOver',\n      'onMouseOut',\n      'onTouchStart',\n      'ignoreBlocker',\n    ],\n  )\n\n  // const {\n  //   // custom props\n  //   activeProps = () => ({ class: 'active' }),\n  //   inactiveProps = () => ({}),\n  //   activeOptions,\n  //   to,\n  //   preload: userPreload,\n  //   preloadDelay: userPreloadDelay,\n  //   hashScrollIntoView,\n  //   replace,\n  //   startTransition,\n  //   resetScroll,\n  //   viewTransition,\n  //   // element props\n  //   children,\n  //   target,\n  //   disabled,\n  //   style,\n  //   class,\n  //   onClick,\n  //   onFocus,\n  //   onMouseEnter,\n  //   onMouseLeave,\n  //   onTouchStart,\n  //   ignoreBlocker,\n  //   ...rest\n  // } = options\n\n  const [_, propsSafeToSpread] = Solid.splitProps(rest, [\n    'params',\n    'search',\n    'hash',\n    'state',\n    'mask',\n    'reloadDocument',\n    'unsafeRelative',\n  ])\n\n  const currentLocation = Solid.createMemo(\n    () => router.stores.location.state,\n    undefined,\n    { equals: (prev, next) => prev.href === next.href },\n  )\n\n  const _options = () => options\n\n  const next = Solid.createMemo(() => {\n    // Rebuild when inherited search/hash or the current route context changes.\n    const _fromLocation = currentLocation()\n    const options = { _fromLocation, ..._options() } as any\n    // untrack because router-core will also access stores, which are signals in solid\n    return Solid.untrack(() => router.buildLocation(options))\n  })\n\n  const hrefOption = Solid.createMemo(() => {\n    if (_options().disabled) return undefined\n    // Use publicHref - it contains the correct href for display\n    // When a rewrite changes the origin, publicHref is the full URL\n    // Otherwise it's the origin-stripped path\n    // This avoids constructing URL objects in the hot path\n    const location = next().maskedLocation ?? next()\n    const publicHref = location.publicHref\n    const external = location.external\n\n    if (external) {\n      return { href: publicHref, external: true }\n    }\n\n    return {\n      href: router.history.createHref(publicHref) || '/',\n      external: false,\n    }\n  })\n\n  const externalLink = Solid.createMemo(() => {\n    const _href = hrefOption()\n    if (_href?.external) {\n      // Block dangerous protocols for external links\n      if (isDangerousProtocol(_href.href, router.protocolAllowlist)) {\n        if (process.env.NODE_ENV !== 'production') {\n          console.warn(`Blocked Link with dangerous protocol: ${_href.href}`)\n        }\n        return undefined\n      }\n      return _href.href\n    }\n    const to = _options().to\n    const safeInternal = isSafeInternal(to)\n    if (safeInternal) return undefined\n    if (typeof to !== 'string' || to.indexOf(':') === -1) return undefined\n    try {\n      new URL(to as any)\n      // Block dangerous protocols like javascript:, blob:, data:\n      if (isDangerousProtocol(to, router.protocolAllowlist)) {\n        if (process.env.NODE_ENV !== 'production') {\n          console.warn(`Blocked Link with dangerous protocol: ${to}`)\n        }\n        return undefined\n      }\n      return to\n    } catch {}\n    return undefined\n  })\n\n  const preload = Solid.createMemo(() => {\n    if (_options().reloadDocument || externalLink()) {\n      return false\n    }\n    return local.preload ?? router.options.defaultPreload\n  })\n  const preloadDelay = () =>\n    local.preloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n  const isActive = Solid.createMemo(() => {\n    if (externalLink()) return false\n    const activeOptions = local.activeOptions\n    const current = currentLocation()\n    const nextLocation = next()\n\n    if (activeOptions?.exact) {\n      const testExact = exactPathTest(\n        current.pathname,\n        nextLocation.pathname,\n        router.basepath,\n      )\n      if (!testExact) {\n        return false\n      }\n    } else {\n      const currentPath = removeTrailingSlash(current.pathname, router.basepath)\n      const nextPath = removeTrailingSlash(\n        nextLocation.pathname,\n        router.basepath,\n      )\n\n      const pathIsFuzzyEqual =\n        currentPath.startsWith(nextPath) &&\n        (currentPath.length === nextPath.length ||\n          currentPath[nextPath.length] === '/')\n      if (!pathIsFuzzyEqual) {\n        return false\n      }\n    }\n\n    if (activeOptions?.includeSearch ?? true) {\n      const searchTest = deepEqual(current.search, nextLocation.search, {\n        partial: !activeOptions?.exact,\n        ignoreUndefined: !activeOptions?.explicitUndefined,\n      })\n      if (!searchTest) {\n        return false\n      }\n    }\n\n    if (activeOptions?.includeHash) {\n      const currentHash =\n        shouldHydrateHash && !hasHydrated() ? '' : current.hash\n      return currentHash === nextLocation.hash\n    }\n    return true\n  })\n\n  const doPreload = () =>\n    router\n      .preloadRoute({ ..._options(), _builtLocation: next() } as any)\n      .catch((err: any) => {\n        console.warn(err)\n        console.warn(preloadWarning)\n      })\n\n  const preloadViewportIoCallback = (\n    entry: IntersectionObserverEntry | undefined,\n  ) => {\n    if (entry?.isIntersecting) {\n      doPreload()\n    }\n  }\n\n  const [ref, setRef] = Solid.createSignal<Element | null>(null)\n\n  useIntersectionObserver(\n    ref,\n    preloadViewportIoCallback,\n    { rootMargin: '100px' },\n    { disabled: !!local.disabled || !(preload() === 'viewport') },\n  )\n\n  Solid.createEffect(() => {\n    if (hasRenderFetched) {\n      return\n    }\n    if (!local.disabled && preload() === 'render') {\n      doPreload()\n      hasRenderFetched = true\n    }\n  })\n\n  if (externalLink()) {\n    return Solid.mergeProps(\n      propsSafeToSpread,\n      {\n        ref: mergeRefs(setRef, _options().ref),\n        href: externalLink(),\n      },\n      Solid.splitProps(local, [\n        'target',\n        'disabled',\n        'style',\n        'class',\n        'onClick',\n        'onBlur',\n        'onFocus',\n        'onMouseEnter',\n        'onMouseLeave',\n        'onMouseOut',\n        'onMouseOver',\n        'onTouchStart',\n      ])[0],\n    ) as any\n  }\n\n  // The click handler\n  const handleClick = (e: MouseEvent) => {\n    // Check actual element's target attribute as fallback\n    const elementTarget = (\n      e.currentTarget as HTMLAnchorElement | SVGAElement\n    ).getAttribute('target')\n    const effectiveTarget =\n      local.target !== undefined ? local.target : elementTarget\n\n    if (\n      !local.disabled &&\n      !isCtrlEvent(e) &&\n      !e.defaultPrevented &&\n      (!effectiveTarget || effectiveTarget === '_self') &&\n      e.button === 0\n    ) {\n      e.preventDefault()\n\n      setIsTransitioning(true)\n\n      const unsub = router.subscribe('onResolved', () => {\n        unsub()\n        setIsTransitioning(false)\n      })\n\n      // All is well? Navigate!\n      // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n      router.navigate({\n        ..._options(),\n        replace: local.replace,\n        resetScroll: local.resetScroll,\n        hashScrollIntoView: local.hashScrollIntoView,\n        startTransition: local.startTransition,\n        viewTransition: local.viewTransition,\n        ignoreBlocker: local.ignoreBlocker,\n      })\n    }\n  }\n\n  const enqueueIntentPreload = (e: MouseEvent | FocusEvent) => {\n    if (local.disabled || preload() !== 'intent') return\n\n    if (!preloadDelay()) {\n      doPreload()\n      return\n    }\n\n    const eventTarget = e.currentTarget || e.target\n\n    if (!eventTarget || timeoutMap.has(eventTarget)) return\n\n    timeoutMap.set(\n      eventTarget,\n      setTimeout(() => {\n        timeoutMap.delete(eventTarget)\n        doPreload()\n      }, preloadDelay()),\n    )\n  }\n\n  const handleTouchStart = (_: TouchEvent) => {\n    if (local.disabled || preload() !== 'intent') return\n    doPreload()\n  }\n\n  const handleLeave = (e: MouseEvent | FocusEvent) => {\n    if (local.disabled) return\n    const eventTarget = e.currentTarget || e.target\n\n    if (eventTarget) {\n      const id = timeoutMap.get(eventTarget)\n      clearTimeout(id)\n      timeoutMap.delete(eventTarget)\n    }\n  }\n\n  const simpleStyling = Solid.createMemo(\n    () =>\n      local.activeProps === STATIC_ACTIVE_PROPS_GET &&\n      local.inactiveProps === STATIC_INACTIVE_PROPS_GET &&\n      local.class === undefined &&\n      local.style === undefined,\n  )\n\n  const onClick = createComposedHandler(() => local.onClick, handleClick)\n  const onBlur = createComposedHandler(() => local.onBlur, handleLeave)\n  const onFocus = createComposedHandler(\n    () => local.onFocus,\n    enqueueIntentPreload,\n  )\n  const onMouseEnter = createComposedHandler(\n    () => local.onMouseEnter,\n    enqueueIntentPreload,\n  )\n  const onMouseOver = createComposedHandler(\n    () => local.onMouseOver,\n    enqueueIntentPreload,\n  )\n  const onMouseLeave = createComposedHandler(\n    () => local.onMouseLeave,\n    handleLeave,\n  )\n  const onMouseOut = createComposedHandler(() => local.onMouseOut, handleLeave)\n  const onTouchStart = createComposedHandler(\n    () => local.onTouchStart,\n    handleTouchStart,\n  )\n\n  type ResolvedLinkStateProps = Omit<Solid.ComponentProps<'a'>, 'style'> & {\n    style?: Solid.JSX.CSSProperties\n  }\n\n  const resolvedProps = Solid.createMemo(() => {\n    const active = isActive()\n\n    const base = {\n      href: hrefOption()?.href,\n      ref: mergeRefs(setRef, _options().ref),\n      onClick,\n      onBlur,\n      onFocus,\n      onMouseEnter,\n      onMouseOver,\n      onMouseLeave,\n      onMouseOut,\n      onTouchStart,\n      disabled: !!local.disabled,\n      target: local.target,\n      ...(local.disabled && STATIC_DISABLED_PROPS),\n      ...(isTransitioning() && STATIC_TRANSITIONING_ATTRIBUTES),\n    }\n\n    if (simpleStyling()) {\n      return {\n        ...base,\n        ...(active && STATIC_DEFAULT_ACTIVE_ATTRIBUTES),\n      }\n    }\n\n    const activeProps: ResolvedLinkStateProps = active\n      ? (functionalUpdate(local.activeProps as any, {}) ?? EMPTY_OBJECT)\n      : EMPTY_OBJECT\n    const inactiveProps: ResolvedLinkStateProps = active\n      ? EMPTY_OBJECT\n      : functionalUpdate(local.inactiveProps, {})\n    const style = {\n      ...local.style,\n      ...activeProps.style,\n      ...inactiveProps.style,\n    }\n    const className = [local.class, activeProps.class, inactiveProps.class]\n      .filter(Boolean)\n      .join(' ')\n\n    return {\n      ...activeProps,\n      ...inactiveProps,\n      ...base,\n      ...(Object.keys(style).length ? { style } : undefined),\n      ...(className ? { class: className } : undefined),\n      ...(active && STATIC_ACTIVE_ATTRIBUTES),\n    } as ResolvedLinkStateProps\n  })\n\n  return Solid.mergeProps(propsSafeToSpread, resolvedProps) as any\n}\n\nconst STATIC_ACTIVE_PROPS = { class: 'active' }\nconst STATIC_ACTIVE_PROPS_GET = () => STATIC_ACTIVE_PROPS\nconst EMPTY_OBJECT = {}\nconst STATIC_INACTIVE_PROPS_GET = () => EMPTY_OBJECT\nconst STATIC_DEFAULT_ACTIVE_ATTRIBUTES = {\n  class: 'active',\n  'data-status': 'active',\n  'aria-current': 'page',\n}\nconst STATIC_DISABLED_PROPS = {\n  role: 'link',\n  'aria-disabled': true,\n}\nconst STATIC_ACTIVE_ATTRIBUTES = {\n  'data-status': 'active',\n  'aria-current': 'page',\n}\nconst STATIC_TRANSITIONING_ATTRIBUTES = {\n  'data-transitioning': 'transitioning',\n}\n\n/** Call a JSX.EventHandlerUnion with the event. */\nfunction callHandler<T, TEvent extends Event>(\n  event: TEvent & { currentTarget: T; target: Element },\n  handler: Solid.JSX.EventHandlerUnion<T, TEvent>,\n) {\n  if (typeof handler === 'function') {\n    handler(event)\n  } else {\n    handler[0](handler[1], event)\n  }\n  return event.defaultPrevented\n}\n\nfunction createComposedHandler<T, TEvent extends Event>(\n  getHandler: () => Solid.JSX.EventHandlerUnion<T, TEvent> | undefined,\n  fallback: (event: TEvent) => void,\n) {\n  return (event: TEvent & { currentTarget: T; target: Element }) => {\n    const handler = getHandler()\n    if (!handler || !callHandler(event, handler)) fallback(event)\n  }\n}\n\nexport type UseLinkPropsOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n  TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  Omit<Solid.ComponentProps<'a'>, 'style'> & { style?: Solid.JSX.CSSProperties }\n\nexport type ActiveLinkOptions<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n  LinkComponentSolidProps<TComp> & {\n    [key: `data-${string}`]: unknown\n  }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n  /**\n   * A function that returns additional props for the `active` state of this link.\n   * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n   */\n  activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n  /**\n   * A function that returns additional props for the `inactive` state of this link.\n   * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n   */\n  inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n  LinkPropsChildren\n\nexport interface LinkPropsChildren {\n  // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n  children?:\n    | Solid.JSX.Element\n    | ((state: {\n        isActive: boolean\n        isTransitioning: boolean\n      }) => Solid.JSX.Element)\n}\n\ntype LinkComponentSolidProps<TComp> = TComp extends Solid.ValidComponent\n  ? Omit<Solid.ComponentProps<TComp>, keyof CreateLinkProps>\n  : never\n\nexport type LinkComponentProps<\n  TComp = 'a',\n  TRouter extends AnyRouter = RegisteredRouter,\n  TFrom extends string = string,\n  TTo extends string | undefined = '.',\n  TMaskFrom extends string = TFrom,\n  TMaskTo extends string = '.',\n> = LinkComponentSolidProps<TComp> &\n  LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n  any,\n  any,\n  string,\n  string,\n  string,\n  string\n>\n\nexport type LinkComponent<\n  in out TComp,\n  in out TDefaultFrom extends string = string,\n> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = TDefaultFrom,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(\n  props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Solid.JSX.Element\n\nexport interface LinkComponentRoute<\n  in out TDefaultFrom extends string = string,\n> {\n  defaultFrom: TDefaultFrom;\n  <\n    TRouter extends AnyRouter = RegisteredRouter,\n    const TTo extends string | undefined = undefined,\n    const TMaskTo extends string = '',\n  >(\n    props: LinkComponentProps<\n      'a',\n      TRouter,\n      this['defaultFrom'],\n      TTo,\n      this['defaultFrom'],\n      TMaskTo\n    >,\n  ): Solid.JSX.Element\n}\n\nexport function createLink<const TComp>(\n  Comp: Constrain<TComp, any, (props: CreateLinkProps) => Solid.JSX.Element>,\n): LinkComponent<TComp> {\n  return (props) => <Link {...props} _asChild={Comp} />\n}\n\nexport const Link: LinkComponent<'a'> = (props) => {\n  const [local, rest] = Solid.splitProps(\n    props as typeof props & { _asChild: any },\n    ['_asChild', 'children'],\n  )\n\n  const [_, linkProps] = Solid.splitProps(\n    useLinkProps(rest as unknown as any),\n    ['type'],\n  )\n\n  const children = Solid.createMemo(() => {\n    const ch = local.children\n    if (typeof ch === 'function') {\n      return ch({\n        get isActive() {\n          return (linkProps as any)['data-status'] === 'active'\n        },\n        get isTransitioning() {\n          return (linkProps as any)['data-transitioning'] === 'transitioning'\n        },\n      })\n    }\n\n    return ch satisfies Solid.JSX.Element\n  })\n\n  if (local._asChild === 'svg') {\n    const [_, svgLinkProps] = Solid.splitProps(linkProps, ['class'])\n    return (\n      <svg>\n        <a {...svgLinkProps}>{children()}</a>\n      </svg>\n    )\n  }\n\n  if (!local._asChild) {\n    return <a {...linkProps}>{children()}</a>\n  }\n\n  return (\n    <Dynamic component={local._asChild as Solid.ValidComponent} {...linkProps}>\n      {children()}\n    </Dynamic>\n  )\n}\n\nfunction isCtrlEvent(e: MouseEvent) {\n  return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nfunction isSafeInternal(to: unknown) {\n  if (typeof to !== 'string') return false\n  const zero = to.charCodeAt(0)\n  if (zero === 47) return to.charCodeAt(1) !== 47 // '/' but not '//'\n  return zero === 46 // '.', '..', './', '../'\n}\n\nexport type LinkOptionsFnOptions<\n  TOptions,\n  TComp,\n  TRouter extends AnyRouter = RegisteredRouter,\n> =\n  TOptions extends ReadonlyArray<any>\n    ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n    : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n  const TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n>(\n  options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n  return options as any\n}\n"
  },
  {
    "path": "packages/solid-router/src/matchContext.tsx",
    "content": "import * as Solid from 'solid-js'\nimport type { AnyRouteMatch } from '@tanstack/router-core'\n\nexport type NearestMatchContextValue = {\n  matchId: Solid.Accessor<string | undefined>\n  routeId: Solid.Accessor<string | undefined>\n  match: Solid.Accessor<AnyRouteMatch | undefined>\n  hasPending: Solid.Accessor<boolean>\n}\n\nconst defaultNearestMatchContext: NearestMatchContextValue = {\n  matchId: () => undefined,\n  routeId: () => undefined,\n  match: () => undefined,\n  hasPending: () => false,\n}\n\nexport const nearestMatchContext =\n  Solid.createContext<NearestMatchContextValue>(defaultNearestMatchContext)\n"
  },
  {
    "path": "packages/solid-router/src/not-found.tsx",
    "content": "import { isNotFound } from '@tanstack/router-core'\nimport * as Solid from 'solid-js'\nimport { CatchBoundary } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport type { NotFoundError } from '@tanstack/router-core'\n\nexport function CatchNotFound(props: {\n  fallback?: (error: NotFoundError) => Solid.JSX.Element\n  onCatch?: (error: Error) => void\n  children: Solid.JSX.Element\n}) {\n  const router = useRouter()\n  // TODO: Some way for the user to programmatically reset the not-found boundary?\n  const pathname = Solid.createMemo(() => router.stores.location.state.pathname)\n  const status = Solid.createMemo(() => router.stores.status.state)\n\n  return (\n    <CatchBoundary\n      getResetKey={() => `not-found-${pathname()}-${status()}`}\n      onCatch={(error) => {\n        if (isNotFound(error)) {\n          props.onCatch?.(error)\n        } else {\n          throw error\n        }\n      }}\n      errorComponent={({ error }) => {\n        if (isNotFound(error)) {\n          return props.fallback?.(error)\n        } else {\n          throw error\n        }\n      }}\n    >\n      {props.children}\n    </CatchBoundary>\n  )\n}\n\nexport function DefaultGlobalNotFound() {\n  return <p>Not Found</p>\n}\n"
  },
  {
    "path": "packages/solid-router/src/renderRouteNotFound.tsx",
    "content": "import warning from 'tiny-warning'\nimport { DefaultGlobalNotFound } from './not-found'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\n/**\n * Renders a not found component for a route when no matching route is found.\n *\n * @param router - The router instance containing the route configuration\n * @param route - The route that triggered the not found state\n * @param data - Additional data to pass to the not found component\n * @returns The rendered not found component or a default fallback component\n */\nexport function renderRouteNotFound(\n  router: AnyRouter,\n  route: AnyRoute,\n  data: any,\n) {\n  if (!route.options.notFoundComponent) {\n    if (router.options.defaultNotFoundComponent) {\n      return <router.options.defaultNotFoundComponent {...data} />\n    }\n\n    if (process.env.NODE_ENV === 'development') {\n      warning(\n        route.options.notFoundComponent,\n        `A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`,\n      )\n    }\n\n    return <DefaultGlobalNotFound />\n  }\n\n  return <route.options.notFoundComponent {...data} />\n}\n"
  },
  {
    "path": "packages/solid-router/src/route.tsx",
    "content": "import {\n  BaseRootRoute,\n  BaseRoute,\n  BaseRouteApi,\n  notFound,\n} from '@tanstack/router-core'\nimport { Link } from './link'\nimport { useLoaderData } from './useLoaderData'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useParams } from './useParams'\nimport { useSearch } from './useSearch'\nimport { useNavigate } from './useNavigate'\nimport { useMatch } from './useMatch'\nimport { useRouteContext } from './useRouteContext'\nimport { useRouter } from './useRouter'\nimport type {\n  AnyContext,\n  AnyRoute,\n  AnyRouter,\n  ConstrainLiteral,\n  ErrorComponentProps,\n  NotFoundError,\n  NotFoundRouteProps,\n  Register,\n  RegisteredRouter,\n  ResolveFullPath,\n  ResolveId,\n  ResolveParams,\n  RootRoute as RootRouteCore,\n  RootRouteId,\n  RootRouteOptions,\n  RouteConstraints,\n  Route as RouteCore,\n  RouteIds,\n  RouteMask,\n  RouteOptions,\n  RouteTypesById,\n  RouterCore,\n  ToMaskOptions,\n  UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseSearchRoute } from './useSearch'\nimport type * as Solid from 'solid-js'\nimport type { UseRouteContextRoute } from './useRouteContext'\nimport type { LinkComponentRoute } from './link'\n\ndeclare module '@tanstack/router-core' {\n  export interface UpdatableRouteOptionsExtensions {\n    component?: RouteComponent\n    errorComponent?: false | null | undefined | ErrorRouteComponent\n    notFoundComponent?: NotFoundRouteComponent\n    pendingComponent?: RouteComponent\n  }\n\n  export interface RootRouteOptionsExtensions {\n    shellComponent?: ({\n      children,\n    }: {\n      children: Solid.JSX.Element\n    }) => Solid.JSX.Element\n  }\n\n  export interface RouteExtensions<\n    in out TId extends string,\n    in out TFullPath extends string,\n  > {\n    useMatch: UseMatchRoute<TId>\n    useRouteContext: UseRouteContextRoute<TId>\n    useSearch: UseSearchRoute<TId>\n    useParams: UseParamsRoute<TId>\n    useLoaderDeps: UseLoaderDepsRoute<TId>\n    useLoaderData: UseLoaderDataRoute<TId>\n    useNavigate: () => UseNavigateResult<TFullPath>\n    Link: LinkComponentRoute<TFullPath>\n  }\n}\n\nexport function getRouteApi<\n  const TId,\n  TRouter extends AnyRouter = RegisteredRouter,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n  return new RouteApi<TId, TRouter>({ id })\n}\n\nexport class RouteApi<\n  TId,\n  TRouter extends AnyRouter = RegisteredRouter,\n> extends BaseRouteApi<TId, TRouter> {\n  /**\n   * @deprecated Use the `getRouteApi` function instead.\n   */\n  constructor({ id }: { id: TId }) {\n    super({ id })\n  }\n\n  useMatch: UseMatchRoute<TId> = (opts) => {\n    return useMatch({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useRouteContext: UseRouteContextRoute<TId> = (opts) => {\n    return useRouteContext({ ...(opts as any), from: this.id as any }) as any\n  }\n\n  useSearch: UseSearchRoute<TId> = (opts) => {\n    return useSearch({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useParams: UseParamsRoute<TId> = (opts) => {\n    return useParams({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n    return useLoaderDeps({ ...opts, from: this.id, strict: false } as any)\n  }\n\n  useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n    return useLoaderData({ ...opts, from: this.id, strict: false } as any)\n  }\n\n  useNavigate = (): UseNavigateResult<\n    RouteTypesById<TRouter, TId>['fullPath']\n  > => {\n    const router = useRouter()\n    return useNavigate({ from: router.routesById[this.id as string].fullPath })\n  }\n\n  notFound = (opts?: NotFoundError) => {\n    return notFound({ routeId: this.id as string, ...opts })\n  }\n\n  Link: LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']> = ((\n    props,\n  ) => {\n    const router = useRouter()\n    const fullPath = router.routesById[this.id as string].fullPath\n    return <Link from={fullPath as never} {...props} />\n  }) as LinkComponentRoute<RouteTypesById<TRouter, TId>['fullPath']>\n}\n\nexport class Route<\n  in out TRegister = unknown,\n  in out TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n  in out TPath extends RouteConstraints['TPath'] = '/',\n  in out TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n    TParentRoute,\n    TPath\n  >,\n  in out TCustomId extends RouteConstraints['TCustomId'] = string,\n  in out TId extends RouteConstraints['TId'] = ResolveId<\n    TParentRoute,\n    TCustomId,\n    TPath\n  >,\n  in out TSearchValidator = undefined,\n  in out TParams = ResolveParams<TPath>,\n  in out TRouterContext = AnyContext,\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TLoaderDeps extends Record<string, any> = {},\n  in out TLoaderFn = undefined,\n  in out TChildren = unknown,\n  in out TFileRouteTypes = unknown,\n  in out TSSR = unknown,\n  in out TMiddlewares = unknown,\n  in out THandlers = undefined,\n>\n  extends BaseRoute<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TFileRouteTypes,\n    TSSR,\n    TMiddlewares,\n    THandlers\n  >\n  implements\n    RouteCore<\n      TRegister,\n      TParentRoute,\n      TPath,\n      TFullPath,\n      TCustomId,\n      TId,\n      TSearchValidator,\n      TParams,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TChildren,\n      TFileRouteTypes,\n      TSSR,\n      TMiddlewares,\n      THandlers\n    >\n{\n  /**\n   * @deprecated Use the `createRoute` function instead.\n   */\n  constructor(\n    options?: RouteOptions<\n      TRegister,\n      TParentRoute,\n      TId,\n      TCustomId,\n      TFullPath,\n      TPath,\n      TSearchValidator,\n      TParams,\n      TLoaderDeps,\n      TLoaderFn,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TSSR,\n      TMiddlewares,\n      THandlers\n    >,\n  ) {\n    super(options)\n  }\n\n  useMatch: UseMatchRoute<TId> = (opts) => {\n    return useMatch({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useRouteContext: UseRouteContextRoute<TId> = (opts?) => {\n    return useRouteContext({ ...(opts as any), from: this.id }) as any\n  }\n\n  useSearch: UseSearchRoute<TId> = (opts) => {\n    return useSearch({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useParams: UseParamsRoute<TId> = (opts) => {\n    return useParams({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useLoaderDeps: UseLoaderDepsRoute<TId> = (opts) => {\n    return useLoaderDeps({ ...opts, from: this.id } as any)\n  }\n\n  useLoaderData: UseLoaderDataRoute<TId> = (opts) => {\n    return useLoaderData({ ...opts, from: this.id } as any)\n  }\n\n  useNavigate = (): UseNavigateResult<TFullPath> => {\n    return useNavigate({ from: this.fullPath })\n  }\n\n  Link: LinkComponentRoute<TFullPath> = ((props) => {\n    return <Link from={this.fullPath} {...props} />\n  }) as LinkComponentRoute<TFullPath>\n}\n\nexport function createRoute<\n  TRegister = unknown,\n  TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute,\n  TPath extends RouteConstraints['TPath'] = '/',\n  TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n    TParentRoute,\n    TPath\n  >,\n  TCustomId extends RouteConstraints['TCustomId'] = string,\n  TId extends RouteConstraints['TId'] = ResolveId<\n    TParentRoute,\n    TCustomId,\n    TPath\n  >,\n  TSearchValidator = undefined,\n  TParams = ResolveParams<TPath>,\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TChildren = unknown,\n  TSSR = unknown,\n  THandlers = undefined,\n>(\n  options: RouteOptions<\n    TRegister,\n    TParentRoute,\n    TId,\n    TCustomId,\n    TFullPath,\n    TPath,\n    TSearchValidator,\n    TParams,\n    TLoaderDeps,\n    TLoaderFn,\n    AnyContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TSSR,\n    THandlers\n  >,\n): Route<\n  TRegister,\n  TParentRoute,\n  TPath,\n  TFullPath,\n  TCustomId,\n  TId,\n  TSearchValidator,\n  TParams,\n  AnyContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TChildren,\n  unknown,\n  TSSR,\n  THandlers\n> {\n  return new Route<\n    TRegister,\n    TParentRoute,\n    TPath,\n    TFullPath,\n    TCustomId,\n    TId,\n    TSearchValidator,\n    TParams,\n    AnyContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    unknown,\n    TSSR,\n    THandlers\n  >(options)\n}\n\nexport type AnyRootRoute = RootRoute<\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any,\n  any\n>\n\nexport function createRootRouteWithContext<TRouterContext extends {}>() {\n  return <\n    TRegister = Register,\n    TRouteContextFn = AnyContext,\n    TBeforeLoadFn = AnyContext,\n    TSearchValidator = undefined,\n    TLoaderDeps extends Record<string, any> = {},\n    TLoaderFn = undefined,\n    TSSR = unknown,\n    THandlers = undefined,\n  >(\n    options?: RootRouteOptions<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TSSR,\n      THandlers\n    >,\n  ) => {\n    return createRootRoute<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TSSR,\n      THandlers\n    >(options)\n  }\n}\n\n/**\n * @deprecated Use the `createRootRouteWithContext` function instead.\n */\nexport const rootRouteWithContext = createRootRouteWithContext\n\nexport class RootRoute<\n  in out TRegister = Register,\n  in out TSearchValidator = undefined,\n  in out TRouterContext = {},\n  in out TRouteContextFn = AnyContext,\n  in out TBeforeLoadFn = AnyContext,\n  in out TLoaderDeps extends Record<string, any> = {},\n  in out TLoaderFn = undefined,\n  in out TChildren = unknown,\n  in out TFileRouteTypes = unknown,\n  in out TSSR = unknown,\n  in out THandlers = undefined,\n>\n  extends BaseRootRoute<\n    TRegister,\n    TSearchValidator,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TChildren,\n    TFileRouteTypes,\n    TSSR,\n    THandlers\n  >\n  implements\n    RootRouteCore<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TChildren,\n      TFileRouteTypes,\n      TSSR,\n      THandlers\n    >\n{\n  /**\n   * @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.\n   */\n  constructor(\n    options?: RootRouteOptions<\n      TRegister,\n      TSearchValidator,\n      TRouterContext,\n      TRouteContextFn,\n      TBeforeLoadFn,\n      TLoaderDeps,\n      TLoaderFn,\n      TSSR,\n      THandlers\n    >,\n  ) {\n    super(options)\n  }\n\n  useMatch: UseMatchRoute<RootRouteId> = (opts) => {\n    return useMatch({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useRouteContext: UseRouteContextRoute<RootRouteId> = (opts) => {\n    return useRouteContext({ ...(opts as any), from: this.id }) as any\n  }\n\n  useSearch: UseSearchRoute<RootRouteId> = (opts) => {\n    return useSearch({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useParams: UseParamsRoute<RootRouteId> = (opts) => {\n    return useParams({\n      select: opts?.select,\n      from: this.id,\n    } as any) as any\n  }\n\n  useLoaderDeps: UseLoaderDepsRoute<RootRouteId> = (opts) => {\n    return useLoaderDeps({ ...opts, from: this.id } as any)\n  }\n\n  useLoaderData: UseLoaderDataRoute<RootRouteId> = (opts) => {\n    return useLoaderData({ ...opts, from: this.id } as any)\n  }\n\n  useNavigate = (): UseNavigateResult<'/'> => {\n    return useNavigate({ from: this.fullPath })\n  }\n\n  Link: LinkComponentRoute<'/'> = ((props) => {\n    return <Link from={this.fullPath} {...(props as any)} />\n  }) as LinkComponentRoute<'/'>\n}\n\nexport function createRouteMask<\n  TRouteTree extends AnyRoute,\n  TFrom extends string,\n  TTo extends string,\n>(\n  opts: {\n    routeTree: TRouteTree\n  } & ToMaskOptions<RouterCore<TRouteTree, 'never', false>, TFrom, TTo>,\n): RouteMask<TRouteTree> {\n  return opts as any\n}\n\nexport type SolidNode = Solid.JSX.Element\n\nexport interface DefaultRouteTypes<TProps> {\n  component: (props: TProps) => any\n}\nexport interface RouteTypes<TProps> extends DefaultRouteTypes<TProps> {}\n\nexport type AsyncRouteComponent<TProps> = RouteTypes<TProps>['component'] & {\n  preload?: () => Promise<void>\n}\n\nexport type RouteComponent = AsyncRouteComponent<{}>\n\nexport type ErrorRouteComponent = AsyncRouteComponent<ErrorComponentProps>\n\nexport type NotFoundRouteComponent = RouteTypes<NotFoundRouteProps>['component']\n\nexport class NotFoundRoute<\n  TRegister,\n  TParentRoute extends AnyRootRoute,\n  TRouterContext = AnyContext,\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TSearchValidator = undefined,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TChildren = unknown,\n  TSSR = unknown,\n  THandlers = undefined,\n> extends Route<\n  TRegister,\n  TParentRoute,\n  '/404',\n  '/404',\n  '404',\n  '404',\n  TSearchValidator,\n  {},\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  TChildren,\n  TSSR,\n  THandlers\n> {\n  constructor(\n    options: Omit<\n      RouteOptions<\n        TRegister,\n        TParentRoute,\n        string,\n        string,\n        string,\n        string,\n        TSearchValidator,\n        {},\n        TLoaderDeps,\n        TLoaderFn,\n        TRouterContext,\n        TRouteContextFn,\n        TBeforeLoadFn,\n        TSSR,\n        THandlers\n      >,\n      | 'caseSensitive'\n      | 'parseParams'\n      | 'stringifyParams'\n      | 'path'\n      | 'id'\n      | 'params'\n    >,\n  ) {\n    super({\n      ...(options as any),\n      id: '404',\n    })\n  }\n}\n\nexport function createRootRoute<\n  TRegister = Register,\n  TSearchValidator = undefined,\n  TRouterContext = {},\n  TRouteContextFn = AnyContext,\n  TBeforeLoadFn = AnyContext,\n  TLoaderDeps extends Record<string, any> = {},\n  TLoaderFn = undefined,\n  TSSR = unknown,\n  THandlers = undefined,\n>(\n  options?: RootRouteOptions<\n    TRegister,\n    TSearchValidator,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    TSSR,\n    THandlers\n  >,\n): RootRoute<\n  TRegister,\n  TSearchValidator,\n  TRouterContext,\n  TRouteContextFn,\n  TBeforeLoadFn,\n  TLoaderDeps,\n  TLoaderFn,\n  unknown,\n  unknown,\n  TSSR,\n  THandlers\n> {\n  return new RootRoute<\n    TRegister,\n    TSearchValidator,\n    TRouterContext,\n    TRouteContextFn,\n    TBeforeLoadFn,\n    TLoaderDeps,\n    TLoaderFn,\n    unknown,\n    unknown,\n    TSSR,\n    THandlers\n  >(options)\n}\n"
  },
  {
    "path": "packages/solid-router/src/router.ts",
    "content": "import { RouterCore } from '@tanstack/router-core'\nimport { createFileRoute, createLazyFileRoute } from './fileRoute'\nimport { getStoreFactory } from './routerStores'\nimport type { RouterHistory } from '@tanstack/history'\nimport type {\n  AnyRoute,\n  CreateRouterFn,\n  RouterConstructorOptions,\n  TrailingSlashOption,\n} from '@tanstack/router-core'\nimport type {\n  ErrorRouteComponent,\n  NotFoundRouteComponent,\n  RouteComponent,\n} from './route'\nimport type { JSX } from 'solid-js'\n\ndeclare module '@tanstack/router-core' {\n  export interface RouterOptionsExtensions {\n    /**\n     * The default `component` a route should use if no component is provided.\n     *\n     * @default Outlet\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultcomponent-property)\n     */\n    defaultComponent?: RouteComponent\n    /**\n     * The default `errorComponent` a route should use if no error component is provided.\n     *\n     * @default ErrorComponent\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaulterrorcomponent-property)\n     * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)\n     */\n    defaultErrorComponent?: ErrorRouteComponent\n    /**\n     * The default `pendingComponent` a route should use if no pending component is provided.\n     *\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultpendingcomponent-property)\n     * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#showing-a-pending-component)\n     */\n    defaultPendingComponent?: RouteComponent\n    /**\n     * The default `notFoundComponent` a route should use if no notFound component is provided.\n     *\n     * @default NotFound\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultnotfoundcomponent-property)\n     * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/not-found-errors#default-router-wide-not-found-handling)\n     */\n    defaultNotFoundComponent?: NotFoundRouteComponent\n    /**\n     * A component that will be used to wrap the entire router.\n     *\n     * This is useful for providing a context to the entire router.\n     *\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#wrap-property)\n     */\n    Wrap?: (props: { children: any }) => JSX.Element\n    /**\n     * A component that will be used to wrap the inner contents of the router.\n     *\n     * 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.\n     *\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#innerwrap-property)\n     */\n    InnerWrap?: (props: { children: any }) => JSX.Element\n\n    /**\n     * The default `onCatch` handler for errors caught by the Router ErrorBoundary\n     *\n     * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultoncatch-property)\n     * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionsoncatch)\n     */\n    defaultOnCatch?: (error: Error) => void\n  }\n}\n\nexport const createRouter: CreateRouterFn = (options) => {\n  return new Router(options)\n}\n\nexport class Router<\n  in out TRouteTree extends AnyRoute,\n  in out TTrailingSlashOption extends TrailingSlashOption = 'never',\n  in out TDefaultStructuralSharingOption extends boolean = false,\n  in out TRouterHistory extends RouterHistory = RouterHistory,\n  in out TDehydrated extends Record<string, any> = Record<string, any>,\n> extends RouterCore<\n  TRouteTree,\n  TTrailingSlashOption,\n  TDefaultStructuralSharingOption,\n  TRouterHistory,\n  TDehydrated\n> {\n  constructor(\n    options: RouterConstructorOptions<\n      TRouteTree,\n      TTrailingSlashOption,\n      TDefaultStructuralSharingOption,\n      TRouterHistory,\n      TDehydrated\n    >,\n  ) {\n    super(options, getStoreFactory)\n  }\n}\n\nif (typeof globalThis !== 'undefined') {\n  ;(globalThis as any).createFileRoute = createFileRoute\n  ;(globalThis as any).createLazyFileRoute = createLazyFileRoute\n} else if (typeof window !== 'undefined') {\n  ;(window as any).createFileRoute = createFileRoute\n  ;(window as any).createLazyFileRoute = createLazyFileRoute\n}\n"
  },
  {
    "path": "packages/solid-router/src/routerContext.tsx",
    "content": "import * as Solid from 'solid-js'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport const routerContext = Solid.createContext<AnyRouter>(\n  null as unknown as AnyRouter,\n)\n"
  },
  {
    "path": "packages/solid-router/src/routerStores.ts",
    "content": "import * as Solid from 'solid-js'\nimport {\n  createNonReactiveMutableStore,\n  createNonReactiveReadonlyStore,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport type {\n  AnyRoute,\n  GetStoreConfig,\n  RouterReadableStore,\n  RouterStores,\n  RouterWritableStore,\n} from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n  export interface RouterStores<in out TRouteTree extends AnyRoute> {\n    /** Maps each active routeId to the matchId of its child in the match tree. */\n    childMatchIdByRouteId: RouterReadableStore<Record<string, string>>\n    /** Maps each pending routeId to true for quick lookup. */\n    pendingRouteIds: RouterReadableStore<Record<string, boolean>>\n  }\n}\n\nfunction initRouterStores(\n  stores: RouterStores<AnyRoute>,\n  createReadonlyStore: <TValue>(\n    read: () => TValue,\n  ) => RouterReadableStore<TValue>,\n) {\n  stores.childMatchIdByRouteId = createReadonlyStore(() => {\n    const ids = stores.matchesId.state\n    const obj: Record<string, string> = {}\n    for (let i = 0; i < ids.length - 1; i++) {\n      const parentStore = stores.activeMatchStoresById.get(ids[i]!)\n      if (parentStore?.routeId) {\n        obj[parentStore.routeId] = ids[i + 1]!\n      }\n    }\n    return obj\n  })\n\n  stores.pendingRouteIds = createReadonlyStore(() => {\n    const ids = stores.pendingMatchesId.state\n    const obj: Record<string, boolean> = {}\n    for (const id of ids) {\n      const store = stores.pendingMatchStoresById.get(id)\n      if (store?.routeId) {\n        obj[store.routeId] = true\n      }\n    }\n    return obj\n  })\n}\n\nfunction createSolidMutableStore<TValue>(\n  initialValue: TValue,\n): RouterWritableStore<TValue> {\n  const [signal, setSignal] = Solid.createSignal(initialValue)\n\n  return {\n    get state() {\n      return signal()\n    },\n    setState: setSignal,\n  }\n}\n\nlet finalizationRegistry: FinalizationRegistry<() => void> | null = null\nif (typeof globalThis !== 'undefined' && 'FinalizationRegistry' in globalThis) {\n  finalizationRegistry = new FinalizationRegistry((cb) => cb())\n}\n\nfunction createSolidReadonlyStore<TValue>(\n  read: () => TValue,\n): RouterReadableStore<TValue> {\n  let dispose!: () => void\n  const memo = Solid.createRoot((d) => {\n    dispose = d\n    return Solid.createMemo(read)\n  })\n  const store = {\n    get state() {\n      return memo()\n    },\n  }\n  finalizationRegistry?.register(store, dispose)\n  return store\n}\n\nexport const getStoreFactory: GetStoreConfig = (opts) => {\n  if (isServer ?? opts.isServer) {\n    return {\n      createMutableStore: createNonReactiveMutableStore,\n      createReadonlyStore: createNonReactiveReadonlyStore,\n      batch: (fn) => fn(),\n      init: (stores) =>\n        initRouterStores(stores, createNonReactiveReadonlyStore),\n    }\n  }\n\n  return {\n    createMutableStore: createSolidMutableStore,\n    createReadonlyStore: createSolidReadonlyStore,\n    batch: Solid.batch,\n    init: (stores) => initRouterStores(stores, createSolidReadonlyStore),\n  }\n}\n"
  },
  {
    "path": "packages/solid-router/src/scroll-restoration.tsx",
    "content": "import {\n  defaultGetScrollRestorationKey,\n  escapeHtml,\n  restoreScroll,\n  storageKey,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport { ScriptOnce } from './ScriptOnce'\n\nexport function ScrollRestoration() {\n  const router = useRouter()\n  if (!router.isScrollRestoring || !(isServer ?? router.isServer)) {\n    return null\n  }\n  if (typeof router.options.scrollRestoration === 'function') {\n    const shouldRestore = router.options.scrollRestoration({\n      location: router.latestLocation,\n    })\n    if (!shouldRestore) {\n      return null\n    }\n  }\n  const getKey =\n    router.options.getScrollRestorationKey || defaultGetScrollRestorationKey\n  const userKey = getKey(router.latestLocation)\n  const resolvedKey =\n    userKey !== defaultGetScrollRestorationKey(router.latestLocation)\n      ? userKey\n      : undefined\n\n  const restoreScrollOptions: Parameters<typeof restoreScroll>[0] = {\n    storageKey,\n    shouldScrollRestoration: true,\n  }\n  if (resolvedKey) {\n    restoreScrollOptions.key = resolvedKey\n  }\n\n  return (\n    <ScriptOnce\n      children={`(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})`}\n    />\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/ssr/RouterClient.tsx",
    "content": "import { hydrate } from '@tanstack/router-core/ssr/client'\nimport { Await } from '../awaited'\nimport { HeadContent } from '../HeadContent'\nimport { RouterProvider } from '../RouterProvider'\nimport type { AnyRouter } from '@tanstack/router-core'\nimport type { JSXElement } from 'solid-js'\n\nlet hydrationPromise: Promise<void | Array<Array<void>>> | undefined\n\nconst Dummy = (props: { children?: JSXElement }) => <>{props.children}</>\n\nexport function RouterClient(props: { router: AnyRouter }) {\n  if (!hydrationPromise) {\n    if (!props.router.stores.matchesId.state.length) {\n      hydrationPromise = hydrate(props.router)\n    } else {\n      hydrationPromise = Promise.resolve()\n    }\n  }\n  return (\n    <Await\n      promise={hydrationPromise}\n      children={() => (\n        <Dummy>\n          <Dummy>\n            <RouterProvider\n              router={props.router}\n              InnerWrap={(props) => (\n                <Dummy>\n                  <Dummy>\n                    <HeadContent />\n                    {props.children}\n                  </Dummy>\n                  <Dummy />\n                </Dummy>\n              )}\n            />\n          </Dummy>\n        </Dummy>\n      )}\n    />\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/ssr/RouterServer.tsx",
    "content": "import {\n  Hydration,\n  HydrationScript,\n  NoHydration,\n  ssr,\n  useAssets,\n} from 'solid-js/web'\nimport { MetaProvider } from '@solidjs/meta'\nimport { Asset } from '../Asset'\nimport { useTags } from '../headContentUtils'\nimport { RouterProvider } from '../RouterProvider'\nimport { Scripts } from '../Scripts'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport function ServerHeadContent() {\n  const tags = useTags()\n  useAssets(() => {\n    return (\n      <MetaProvider>\n        {tags().map((tag) => (\n          <Asset {...tag} />\n        ))}\n      </MetaProvider>\n    )\n  })\n  return null\n}\n\nconst docType = ssr('<!DOCTYPE html>')\n\nexport function RouterServer<TRouter extends AnyRouter>(props: {\n  router: TRouter\n}) {\n  return (\n    <NoHydration>\n      {docType as any}\n      <html>\n        <head>\n          <HydrationScript />\n        </head>\n        <body>\n          <Hydration>\n            <RouterProvider\n              router={props.router}\n              InnerWrap={(props) => (\n                <NoHydration>\n                  <MetaProvider>\n                    <ServerHeadContent />\n                    <Hydration>{props.children}</Hydration>\n                    <Scripts />\n                  </MetaProvider>\n                </NoHydration>\n              )}\n            />\n          </Hydration>\n        </body>\n      </html>\n    </NoHydration>\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/ssr/client.ts",
    "content": "export { RouterClient } from './RouterClient'\n"
  },
  {
    "path": "packages/solid-router/src/ssr/defaultRenderHandler.tsx",
    "content": "import { defineHandlerCallback } from '@tanstack/router-core/ssr/server'\nimport { RouterServer } from './RouterServer'\nimport { renderRouterToString } from './renderRouterToString'\n\nexport const defaultRenderHandler = defineHandlerCallback(\n  ({ router, responseHeaders }) =>\n    renderRouterToString({\n      router,\n      responseHeaders,\n      children: () => <RouterServer router={router} />,\n    }),\n)\n"
  },
  {
    "path": "packages/solid-router/src/ssr/defaultStreamHandler.tsx",
    "content": "import { defineHandlerCallback } from '@tanstack/router-core/ssr/server'\nimport { RouterServer } from './RouterServer'\nimport { renderRouterToStream } from './renderRouterToStream'\n\nexport const defaultStreamHandler = defineHandlerCallback(\n  ({ request, router, responseHeaders }) =>\n    renderRouterToStream({\n      request,\n      router,\n      responseHeaders,\n      children: () => <RouterServer router={router} />,\n    }),\n)\n"
  },
  {
    "path": "packages/solid-router/src/ssr/renderRouterToStream.tsx",
    "content": "import * as Solid from 'solid-js/web'\nimport { isbot } from 'isbot'\nimport { transformReadableStreamWithRouter } from '@tanstack/router-core/ssr/server'\nimport { makeSsrSerovalPlugin } from '@tanstack/router-core'\nimport type { JSXElement } from 'solid-js'\nimport type { ReadableStream } from 'node:stream/web'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport const renderRouterToStream = async ({\n  request,\n  router,\n  responseHeaders,\n  children,\n}: {\n  request: Request\n  router: AnyRouter\n  responseHeaders: Headers\n  children: () => JSXElement\n}) => {\n  const { writable, readable } = new TransformStream()\n\n  const docType = Solid.ssr('<!DOCTYPE html>')\n\n  const serializationAdapters =\n    (router.options as any)?.serializationAdapters ||\n    (router.options.ssr as any)?.serializationAdapters\n  const serovalPlugins = serializationAdapters?.map((adapter: any) => {\n    const plugin = makeSsrSerovalPlugin(adapter, { didRun: false })\n    return plugin\n  })\n\n  const stream = Solid.renderToStream(\n    () => (\n      <>\n        {docType}\n        {children()}\n      </>\n    ),\n    {\n      nonce: router.options.ssr?.nonce,\n      plugins: serovalPlugins,\n    } as any,\n  )\n\n  if (isbot(request.headers.get('User-Agent'))) {\n    await stream\n  }\n  stream.pipeTo(writable)\n\n  const responseStream = transformReadableStreamWithRouter(\n    router,\n    readable as unknown as ReadableStream,\n  )\n  return new Response(responseStream as any, {\n    status: router.stores.statusCode.state,\n    headers: responseHeaders,\n  })\n}\n"
  },
  {
    "path": "packages/solid-router/src/ssr/renderRouterToString.tsx",
    "content": "import * as Solid from 'solid-js/web'\nimport { makeSsrSerovalPlugin } from '@tanstack/router-core'\nimport type { AnyRouter } from '@tanstack/router-core'\nimport type { JSXElement } from 'solid-js'\n\nexport const renderRouterToString = ({\n  router,\n  responseHeaders,\n  children,\n}: {\n  router: AnyRouter\n  responseHeaders: Headers\n  children: () => JSXElement\n}) => {\n  try {\n    const serializationAdapters =\n      (router.options as any)?.serializationAdapters ||\n      (router.options.ssr as any)?.serializationAdapters\n    const serovalPlugins = serializationAdapters?.map((adapter: any) => {\n      const plugin = makeSsrSerovalPlugin(adapter, { didRun: false })\n      return plugin\n    })\n\n    let html = Solid.renderToString(children, {\n      nonce: router.options.ssr?.nonce,\n      plugins: serovalPlugins,\n    } as any)\n    router.serverSsr!.setRenderFinished()\n\n    const injectedHtml = router.serverSsr!.takeBufferedHtml()\n    if (injectedHtml) {\n      html = html.replace(`</body>`, () => `${injectedHtml}</body>`)\n    }\n    return new Response(`<!DOCTYPE html>${html}`, {\n      status: router.stores.statusCode.state,\n      headers: responseHeaders,\n    })\n  } catch (error) {\n    console.error('Render to string error:', error)\n    return new Response('Internal Server Error', {\n      status: 500,\n      headers: responseHeaders,\n    })\n  } finally {\n    router.serverSsr?.cleanup()\n  }\n}\n"
  },
  {
    "path": "packages/solid-router/src/ssr/server.ts",
    "content": "export { RouterServer } from './RouterServer'\nexport { defaultRenderHandler } from './defaultRenderHandler'\nexport { defaultStreamHandler } from './defaultStreamHandler'\nexport { renderRouterToStream } from './renderRouterToStream'\nexport { renderRouterToString } from './renderRouterToString'\nexport * from '@tanstack/router-core/ssr/server'\n"
  },
  {
    "path": "packages/solid-router/src/typePrimitives.ts",
    "content": "import type { LinkComponentProps } from './link'\nimport type { UseParamsOptions } from './useParams'\nimport type { UseSearchOptions } from './useSearch'\nimport type {\n  AnyRouter,\n  Constrain,\n  InferFrom,\n  InferMaskFrom,\n  InferMaskTo,\n  InferSelected,\n  InferShouldThrow,\n  InferStrict,\n  InferTo,\n  RegisteredRouter,\n} from '@tanstack/router-core'\n\nexport type ValidateLinkOptions<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TOptions = unknown,\n  TDefaultFrom extends string = string,\n  TComp = 'a',\n> = Constrain<\n  TOptions,\n  LinkComponentProps<\n    TComp,\n    TRouter,\n    InferFrom<TOptions, TDefaultFrom>,\n    InferTo<TOptions>,\n    InferMaskFrom<TOptions>,\n    InferMaskTo<TOptions>\n  >\n>\n\nexport type ValidateLinkOptionsArray<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,\n  TDefaultFrom extends string = string,\n  TComp = 'a',\n> = {\n  [K in keyof TOptions]: ValidateLinkOptions<\n    TRouter,\n    TOptions[K],\n    TDefaultFrom,\n    TComp\n  >\n}\n\nexport type ValidateUseSearchOptions<\n  TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n> = Constrain<\n  TOptions,\n  UseSearchOptions<\n    TRouter,\n    InferFrom<TOptions>,\n    InferStrict<TOptions>,\n    InferShouldThrow<TOptions>,\n    InferSelected<TOptions>\n  >\n>\n\nexport type ValidateUseParamsOptions<\n  TOptions,\n  TRouter extends AnyRouter = RegisteredRouter,\n> = Constrain<\n  TOptions,\n  UseParamsOptions<\n    TRouter,\n    InferFrom<TOptions>,\n    InferStrict<TOptions>,\n    InferShouldThrow<TOptions>,\n    InferSelected<TOptions>\n  >\n>\n"
  },
  {
    "path": "packages/solid-router/src/useBlocker.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { useRouter } from './useRouter'\nimport type {\n  BlockerFnArgs,\n  HistoryAction,\n  HistoryLocation,\n} from '@tanstack/history'\nimport type { SolidNode } from './route'\nimport type {\n  AnyRoute,\n  AnyRouter,\n  ParseRoute,\n  RegisteredRouter,\n} from '@tanstack/router-core'\n\ninterface ShouldBlockFnLocation<\n  out TRouteId,\n  out TFullPath,\n  out TAllParams,\n  out TFullSearchSchema,\n> {\n  routeId: TRouteId\n  fullPath: TFullPath\n  pathname: string\n  params: TAllParams\n  search: TFullSearchSchema\n}\n\ntype AnyShouldBlockFnLocation = ShouldBlockFnLocation<any, any, any, any>\ntype MakeShouldBlockFnLocationUnion<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,\n> = TRoute extends any\n  ? ShouldBlockFnLocation<\n      TRoute['id'],\n      TRoute['fullPath'],\n      TRoute['types']['allParams'],\n      TRoute['types']['fullSearchSchema']\n    >\n  : never\n\ntype BlockerResolver<TRouter extends AnyRouter = RegisteredRouter> =\n  | {\n      status: 'blocked'\n      current: MakeShouldBlockFnLocationUnion<TRouter>\n      next: MakeShouldBlockFnLocationUnion<TRouter>\n      action: HistoryAction\n      proceed: () => void\n      reset: () => void\n    }\n  | {\n      status: 'idle'\n      current: undefined\n      next: undefined\n      action: undefined\n      proceed: undefined\n      reset: undefined\n    }\n\ntype ShouldBlockFnArgs<TRouter extends AnyRouter = RegisteredRouter> = {\n  current: MakeShouldBlockFnLocationUnion<TRouter>\n  next: MakeShouldBlockFnLocationUnion<TRouter>\n  action: HistoryAction\n}\n\nexport type ShouldBlockFn<TRouter extends AnyRouter = RegisteredRouter> = (\n  args: ShouldBlockFnArgs<TRouter>,\n) => boolean | Promise<boolean>\nexport type UseBlockerOpts<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TWithResolver extends boolean = boolean,\n> = {\n  shouldBlockFn: ShouldBlockFn<TRouter>\n  enableBeforeUnload?: boolean | (() => boolean)\n  disabled?: boolean\n  withResolver?: TWithResolver\n}\n\ntype LegacyBlockerFn = () => Promise<any> | any\ntype LegacyBlockerOpts = {\n  blockerFn?: LegacyBlockerFn\n  condition?: boolean | any\n}\n\nfunction _resolveBlockerOpts(\n  opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,\n  condition?: boolean | any,\n): UseBlockerOpts {\n  if (opts === undefined) {\n    return {\n      shouldBlockFn: () => true,\n      withResolver: false,\n    }\n  }\n\n  if ('shouldBlockFn' in opts) {\n    return opts\n  }\n\n  if (typeof opts === 'function') {\n    const shouldBlock = Boolean(condition ?? true)\n\n    const _customBlockerFn = async () => {\n      if (shouldBlock) return await opts()\n      return false\n    }\n\n    return {\n      shouldBlockFn: _customBlockerFn,\n      enableBeforeUnload: shouldBlock,\n      withResolver: false,\n    }\n  }\n\n  const shouldBlock = Solid.createMemo(() => Boolean(opts.condition ?? true))\n\n  const _customBlockerFn = async () => {\n    if (shouldBlock() && opts.blockerFn !== undefined) {\n      return await opts.blockerFn()\n    }\n    return shouldBlock()\n  }\n\n  return {\n    get shouldBlockFn() {\n      return _customBlockerFn\n    },\n    get enableBeforeUnload() {\n      return shouldBlock()\n    },\n    get withResolver() {\n      return opts.blockerFn === undefined\n    },\n  }\n}\n\nexport function useBlocker<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TWithResolver extends boolean = false,\n>(\n  opts: UseBlockerOpts<TRouter, TWithResolver>,\n): TWithResolver extends true ? Solid.Accessor<BlockerResolver<TRouter>> : void\n\n/**\n * @deprecated Use the shouldBlockFn property instead\n */\nexport function useBlocker(\n  blockerFnOrOpts?: LegacyBlockerOpts,\n): Solid.Accessor<BlockerResolver>\n\n/**\n * @deprecated Use the UseBlockerOpts object syntax instead\n */\nexport function useBlocker(\n  blockerFn?: LegacyBlockerFn,\n  condition?: boolean | any,\n): Solid.Accessor<BlockerResolver>\n\nexport function useBlocker(\n  opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,\n  condition?: boolean | any,\n): Solid.Accessor<BlockerResolver> | void {\n  const props = Solid.mergeProps(\n    {\n      enableBeforeUnload: true,\n      disabled: false,\n      withResolver: false,\n    },\n    _resolveBlockerOpts(opts, condition),\n  )\n\n  const router = useRouter()\n\n  const [resolver, setResolver] = Solid.createSignal<BlockerResolver>({\n    status: 'idle',\n    current: undefined,\n    next: undefined,\n    action: undefined,\n    proceed: undefined,\n    reset: undefined,\n  })\n\n  Solid.createEffect(() => {\n    const blockerFnComposed = async (blockerFnArgs: BlockerFnArgs) => {\n      function getLocation(\n        location: HistoryLocation,\n      ): AnyShouldBlockFnLocation {\n        const parsedLocation = router.parseLocation(location)\n        const matchedRoutes = router.getMatchedRoutes(parsedLocation.pathname)\n        if (matchedRoutes.foundRoute === undefined) {\n          return {\n            routeId: '__notFound__',\n            fullPath: parsedLocation.pathname,\n            pathname: parsedLocation.pathname,\n            params: matchedRoutes.routeParams,\n            search: parsedLocation.search,\n          }\n        }\n        return {\n          routeId: matchedRoutes.foundRoute.id,\n          fullPath: matchedRoutes.foundRoute.fullPath,\n          pathname: parsedLocation.pathname,\n          params: matchedRoutes.routeParams,\n          search: parsedLocation.search,\n        }\n      }\n\n      const current = getLocation(blockerFnArgs.currentLocation)\n      const next = getLocation(blockerFnArgs.nextLocation)\n\n      if (\n        current.routeId === '__notFound__' &&\n        next.routeId !== '__notFound__'\n      ) {\n        return false\n      }\n\n      const shouldBlock = await props.shouldBlockFn({\n        action: blockerFnArgs.action,\n        current,\n        next,\n      })\n      if (!props.withResolver) {\n        return shouldBlock\n      }\n\n      if (!shouldBlock) {\n        return false\n      }\n\n      const promise = new Promise<boolean>((resolve) => {\n        setResolver({\n          status: 'blocked',\n          current,\n          next,\n          action: blockerFnArgs.action,\n          proceed: () => resolve(false),\n          reset: () => resolve(true),\n        })\n      })\n\n      const canNavigateAsync = await promise\n      setResolver({\n        status: 'idle',\n        current: undefined,\n        next: undefined,\n        action: undefined,\n        proceed: undefined,\n        reset: undefined,\n      })\n\n      return canNavigateAsync\n    }\n\n    const disposeBlock = props.disabled\n      ? undefined\n      : router.history.block({\n          blockerFn: blockerFnComposed,\n          enableBeforeUnload: props.enableBeforeUnload,\n        })\n\n    Solid.onCleanup(() => disposeBlock?.())\n  })\n\n  return resolver\n}\n\nconst _resolvePromptBlockerArgs = (\n  props: PromptProps | LegacyPromptProps,\n): UseBlockerOpts => {\n  if ('shouldBlockFn' in props) {\n    return props\n  }\n\n  const shouldBlock = Solid.createMemo(() => Boolean(props.condition ?? true))\n\n  const _customBlockerFn = async () => {\n    if (shouldBlock() && props.blockerFn !== undefined) {\n      return await props.blockerFn()\n    }\n    return shouldBlock\n  }\n\n  return {\n    shouldBlockFn: _customBlockerFn,\n    get enableBeforeUnload() {\n      return shouldBlock()\n    },\n    get withResolver() {\n      return props.blockerFn === undefined\n    },\n  }\n}\n\ninterface BlockComponent {\n  <\n    TRouter extends AnyRouter = RegisteredRouter,\n    TWithResolver extends boolean = boolean,\n  >(\n    opts: PromptProps<TRouter, TWithResolver>,\n  ): SolidNode\n  /**\n   *  @deprecated Use the UseBlockerOpts property instead\n   */\n  (opts: LegacyPromptProps): SolidNode\n}\n\nexport const Block: BlockComponent = function Block(\n  opts: PromptProps | LegacyPromptProps,\n): SolidNode {\n  const [propsWithChildren, rest] = Solid.splitProps(opts, ['children'])\n  const args = _resolvePromptBlockerArgs(rest)\n\n  const resolver = useBlocker(args)\n  const children = Solid.createMemo(() => {\n    const child = propsWithChildren.children\n    if (resolver && typeof child === 'function') return child(resolver())\n    return child\n  })\n\n  return <>{children()}</>\n}\n\ntype LegacyPromptProps = {\n  blockerFn?: LegacyBlockerFn\n  condition?: boolean | any\n  children?: SolidNode | ((params: BlockerResolver) => SolidNode)\n}\n\ntype PromptProps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TWithResolver extends boolean = boolean,\n  TParams = TWithResolver extends true ? BlockerResolver<TRouter> : void,\n> = UseBlockerOpts<TRouter, TWithResolver> & {\n  children?: SolidNode | ((params: TParams) => SolidNode)\n}\n"
  },
  {
    "path": "packages/solid-router/src/useCanGoBack.ts",
    "content": "import * as Solid from 'solid-js'\nimport { useRouter } from './useRouter'\n\nexport function useCanGoBack() {\n  const router = useRouter()\n  return Solid.createMemo(\n    () => router.stores.location.state.state.__TSR_index !== 0,\n  )\n}\n"
  },
  {
    "path": "packages/solid-router/src/useLoaderData.tsx",
    "content": "import { useMatch } from './useMatch'\nimport type { Accessor } from 'solid-js'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  ResolveUseLoaderData,\n  StrictOrFrom,\n  UseLoaderDataResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDataBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n> {\n  select?: (match: ResolveUseLoaderData<TRouter, TFrom, TStrict>) => TSelected\n}\n\nexport type UseLoaderDataOptions<\n  TRouter extends AnyRouter,\n  TFrom extends string | undefined,\n  TStrict extends boolean,\n  TSelected,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n  UseLoaderDataBaseOptions<TRouter, TFrom, TStrict, TSelected>\n\nexport type UseLoaderDataRoute<out TId> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseLoaderDataBaseOptions<TRouter, TId, true, TSelected>,\n) => Accessor<UseLoaderDataResult<TRouter, TId, true, TSelected>>\n\nexport function useLoaderData<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TSelected = unknown,\n>(\n  opts: UseLoaderDataOptions<TRouter, TFrom, TStrict, TSelected>,\n): Accessor<UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>> {\n  return useMatch({\n    from: opts.from!,\n    strict: opts.strict,\n    select: (s: any) => {\n      return opts.select ? opts.select(s.loaderData) : s.loaderData\n    },\n  } as any) as any\n}\n"
  },
  {
    "path": "packages/solid-router/src/useLoaderDeps.tsx",
    "content": "import { useMatch } from './useMatch'\nimport type { Accessor } from 'solid-js'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  ResolveUseLoaderDeps,\n  StrictOrFrom,\n  UseLoaderDepsResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDepsBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TSelected,\n> {\n  select?: (deps: ResolveUseLoaderDeps<TRouter, TFrom>) => TSelected\n}\n\nexport type UseLoaderDepsOptions<\n  TRouter extends AnyRouter,\n  TFrom extends string | undefined,\n  TSelected,\n> = StrictOrFrom<TRouter, TFrom> &\n  UseLoaderDepsBaseOptions<TRouter, TFrom, TSelected>\n\nexport type UseLoaderDepsRoute<out TId> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseLoaderDepsBaseOptions<TRouter, TId, TSelected>,\n) => Accessor<UseLoaderDepsResult<TRouter, TId, TSelected>>\n\nexport function useLoaderDeps<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TSelected = unknown,\n>(\n  opts: UseLoaderDepsOptions<TRouter, TFrom, TSelected>,\n): Accessor<UseLoaderDepsResult<TRouter, TFrom, TSelected>> {\n  return useMatch({\n    ...opts,\n    select: (s) => {\n      return opts.select ? opts.select(s.loaderDeps) : s.loaderDeps\n    },\n  }) as Accessor<UseLoaderDepsResult<TRouter, TFrom, TSelected>>\n}\n"
  },
  {
    "path": "packages/solid-router/src/useLocation.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  RouterState,\n} from '@tanstack/router-core'\nimport type { Accessor } from 'solid-js'\n\nexport interface UseLocationBaseOptions<TRouter extends AnyRouter, TSelected> {\n  select?: (state: RouterState<TRouter['routeTree']>['location']) => TSelected\n}\n\nexport type UseLocationResult<\n  TRouter extends AnyRouter,\n  TSelected,\n> = unknown extends TSelected\n  ? RouterState<TRouter['routeTree']>['location']\n  : TSelected\n\nexport function useLocation<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseLocationBaseOptions<TRouter, TSelected>,\n): Accessor<UseLocationResult<TRouter, TSelected>> {\n  const router = useRouter<TRouter>()\n\n  if (!opts?.select) {\n    return (() => router.stores.location.state) as Accessor<\n      UseLocationResult<TRouter, TSelected>\n    >\n  }\n\n  const select = opts.select\n\n  return Solid.createMemo((prev: TSelected | undefined) => {\n    const res = select(router.stores.location.state)\n    if (prev === undefined) return res\n    return replaceEqualDeep(prev, res)\n  }) as Accessor<UseLocationResult<TRouter, TSelected>>\n}\n"
  },
  {
    "path": "packages/solid-router/src/useMatch.tsx",
    "content": "import * as Solid from 'solid-js'\nimport invariant from 'tiny-invariant'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { nearestMatchContext } from './matchContext'\nimport { useRouter } from './useRouter'\nimport type {\n  AnyRouter,\n  MakeRouteMatch,\n  MakeRouteMatchUnion,\n  RegisteredRouter,\n  StrictOrFrom,\n  ThrowConstraint,\n  ThrowOrOptional,\n} from '@tanstack/router-core'\n\nexport interface UseMatchBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n> {\n  select?: (\n    match: MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>,\n  ) => TSelected\n  shouldThrow?: TThrow\n}\n\nexport type UseMatchRoute<out TFrom> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseMatchBaseOptions<TRouter, TFrom, true, true, TSelected>,\n) => Solid.Accessor<UseMatchResult<TRouter, TFrom, true, TSelected>>\n\nexport type UseMatchOptions<\n  TRouter extends AnyRouter,\n  TFrom extends string | undefined,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n  UseMatchBaseOptions<TRouter, TFrom, TStrict, TThrow, TSelected>\n\nexport type UseMatchResult<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TSelected,\n> = unknown extends TSelected\n  ? TStrict extends true\n    ? MakeRouteMatch<TRouter['routeTree'], TFrom, TStrict>\n    : MakeRouteMatchUnion<TRouter>\n  : TSelected\n\nexport function useMatch<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TThrow extends boolean = true,\n  TSelected = unknown,\n>(\n  opts: UseMatchOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    ThrowConstraint<TStrict, TThrow>,\n    TSelected\n  >,\n): Solid.Accessor<\n  ThrowOrOptional<UseMatchResult<TRouter, TFrom, TStrict, TSelected>, TThrow>\n> {\n  const router = useRouter<TRouter>()\n  const nearestMatch = opts.from\n    ? undefined\n    : Solid.useContext(nearestMatchContext)\n\n  const match = () => {\n    if (opts.from) {\n      return router.stores.getMatchStoreByRouteId(opts.from).state\n    }\n\n    return nearestMatch?.match()\n  }\n\n  Solid.createEffect(() => {\n    if (match() !== undefined) {\n      return\n    }\n\n    const hasPendingMatch = opts.from\n      ? Boolean(router.stores.pendingRouteIds.state[opts.from!])\n      : (nearestMatch?.hasPending() ?? false)\n\n    invariant(\n      !(\n        !hasPendingMatch &&\n        !router.stores.isTransitioning.state &&\n        (opts.shouldThrow ?? true)\n      ),\n      `Could not find ${opts.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'}`,\n    )\n  })\n\n  return Solid.createMemo((prev: TSelected | undefined) => {\n    const selectedMatch = match()\n\n    if (selectedMatch === undefined) return undefined\n    const res = opts.select ? opts.select(selectedMatch as any) : selectedMatch\n    if (prev === undefined) return res as TSelected\n    return replaceEqualDeep(prev, res) as TSelected\n  }) as any\n}\n"
  },
  {
    "path": "packages/solid-router/src/useNavigate.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { useRouter } from './useRouter'\nimport type {\n  AnyRouter,\n  FromPathOption,\n  NavigateOptions,\n  RegisteredRouter,\n  UseNavigateResult,\n} from '@tanstack/router-core'\n\nexport function useNavigate<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TDefaultFrom extends string = string,\n>(_defaultOpts?: {\n  from?: FromPathOption<TRouter, TDefaultFrom>\n}): UseNavigateResult<TDefaultFrom> {\n  const router = useRouter()\n\n  return ((options: NavigateOptions) => {\n    return router.navigate({\n      ...options,\n      from: options.from ?? _defaultOpts?.from,\n    })\n  }) as UseNavigateResult<TDefaultFrom>\n}\n\nexport function Navigate<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string = string,\n  const TTo extends string | undefined = undefined,\n  const TMaskFrom extends string = TFrom,\n  const TMaskTo extends string = '',\n>(props: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): null {\n  const { navigate } = useRouter()\n\n  Solid.onMount(() => {\n    navigate({\n      ...props,\n    })\n  })\n\n  return null\n}\n"
  },
  {
    "path": "packages/solid-router/src/useRouteContext.ts",
    "content": "import { useMatch } from './useMatch'\nimport type { Accessor } from 'solid-js'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  UseRouteContextBaseOptions,\n  UseRouteContextOptions,\n  UseRouteContextResult,\n} from '@tanstack/router-core'\n\nexport type UseRouteContextRoute<out TFrom> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseRouteContextBaseOptions<TRouter, TFrom, true, TSelected>,\n) => Accessor<UseRouteContextResult<TRouter, TFrom, true, TSelected>>\n\nexport function useRouteContext<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TSelected = unknown,\n>(\n  opts: UseRouteContextOptions<TRouter, TFrom, TStrict, TSelected>,\n): Accessor<UseRouteContextResult<TRouter, TFrom, TStrict, TSelected>> {\n  return useMatch({\n    ...(opts as any),\n    select: (match) =>\n      opts.select ? opts.select(match.context) : match.context,\n  }) as any\n}\n"
  },
  {
    "path": "packages/solid-router/src/useRouter.tsx",
    "content": "import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { routerContext } from './routerContext'\nimport type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'\n\nexport function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {\n  warn?: boolean\n}): TRouter {\n  const value = Solid.useContext(routerContext as any)\n  warning(\n    !((opts?.warn ?? true) && !value),\n    'useRouter must be used inside a <RouterProvider> component!',\n  )\n  return value as any\n}\n"
  },
  {
    "path": "packages/solid-router/src/useRouterState.tsx",
    "content": "import { isServer } from '@tanstack/router-core/isServer'\nimport * as Solid from 'solid-js'\nimport { replaceEqualDeep } from '@tanstack/router-core'\nimport { useRouter } from './useRouter'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  RouterState,\n} from '@tanstack/router-core'\nimport type { Accessor } from 'solid-js'\n\nexport type UseRouterStateOptions<TRouter extends AnyRouter, TSelected> = {\n  router?: TRouter\n  select?: (state: RouterState<TRouter['routeTree']>) => TSelected\n}\n\nexport type UseRouterStateResult<\n  TRouter extends AnyRouter,\n  TSelected,\n> = unknown extends TSelected ? RouterState<TRouter['routeTree']> : TSelected\n\nexport function useRouterState<\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseRouterStateOptions<TRouter, TSelected>,\n): Accessor<UseRouterStateResult<TRouter, TSelected>> {\n  const contextRouter = useRouter<TRouter>({\n    warn: opts?.router === undefined,\n  })\n  const router = opts?.router || contextRouter\n\n  // During SSR we render exactly once and do not need reactivity.\n  // Avoid subscribing to the store on the server since the server store\n  // implementation does not provide subscribe() semantics.\n  const _isServer = isServer ?? router.isServer\n  if (_isServer) {\n    const state = router.stores.__store.state as RouterState<\n      TRouter['routeTree']\n    >\n    const selected = (\n      opts?.select ? opts.select(state) : state\n    ) as UseRouterStateResult<TRouter, TSelected>\n    return (() => selected) as Accessor<\n      UseRouterStateResult<TRouter, TSelected>\n    >\n  }\n\n  if (!opts?.select) {\n    return (() => router.stores.__store.state) as Accessor<\n      UseRouterStateResult<TRouter, TSelected>\n    >\n  }\n\n  const select = opts.select\n\n  return Solid.createMemo((prev: TSelected | undefined) => {\n    const res = select(router.stores.__store.state)\n    if (prev === undefined) return res\n    return replaceEqualDeep(prev, res)\n  }) as Accessor<UseRouterStateResult<TRouter, TSelected>>\n}\n"
  },
  {
    "path": "packages/solid-router/src/useSearch.tsx",
    "content": "import { useMatch } from './useMatch'\nimport type { Accessor } from 'solid-js'\nimport type {\n  AnyRouter,\n  RegisteredRouter,\n  ResolveUseSearch,\n  StrictOrFrom,\n  ThrowConstraint,\n  ThrowOrOptional,\n  UseSearchResult,\n} from '@tanstack/router-core'\n\nexport interface UseSearchBaseOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n> {\n  select?: (state: ResolveUseSearch<TRouter, TFrom, TStrict>) => TSelected\n  shouldThrow?: TThrow\n}\n\nexport type UseSearchOptions<\n  TRouter extends AnyRouter,\n  TFrom,\n  TStrict extends boolean,\n  TThrow extends boolean,\n  TSelected,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n  UseSearchBaseOptions<TRouter, TFrom, TStrict, TThrow, TSelected>\n\nexport type UseSearchRoute<out TFrom> = <\n  TRouter extends AnyRouter = RegisteredRouter,\n  TSelected = unknown,\n>(\n  opts?: UseSearchBaseOptions<\n    TRouter,\n    TFrom,\n    /* TStrict */ true,\n    /* TThrow */ true,\n    TSelected\n  >,\n) => Accessor<UseSearchResult<TRouter, TFrom, true, TSelected>>\n\nexport function useSearch<\n  TRouter extends AnyRouter = RegisteredRouter,\n  const TFrom extends string | undefined = undefined,\n  TStrict extends boolean = true,\n  TThrow extends boolean = true,\n  TSelected = unknown,\n>(\n  opts: UseSearchOptions<\n    TRouter,\n    TFrom,\n    TStrict,\n    ThrowConstraint<TStrict, TThrow>,\n    TSelected\n  >,\n): Accessor<\n  ThrowOrOptional<UseSearchResult<TRouter, TFrom, TStrict, TSelected>, TThrow>\n> {\n  return useMatch({\n    from: opts.from!,\n    strict: opts.strict,\n    shouldThrow: opts.shouldThrow,\n    select: (match: any) => {\n      const search = match.search\n      return opts.select ? opts.select(search) : search\n    },\n  }) as any\n}\n"
  },
  {
    "path": "packages/solid-router/src/utils.ts",
    "content": "import * as Solid from 'solid-js'\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n *  ref,\n *  (entry) => { doSomething(entry) },\n *  { rootMargin: '10px' },\n *  { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n  ref: Solid.Accessor<T | null>,\n  callback: (entry: IntersectionObserverEntry | undefined) => void,\n  intersectionObserverOptions: IntersectionObserverInit = {},\n  options: { disabled?: boolean } = {},\n): Solid.Accessor<IntersectionObserver | null> {\n  const isIntersectionObserverAvailable =\n    typeof IntersectionObserver === 'function'\n  let observerRef: IntersectionObserver | null = null\n\n  Solid.createEffect(() => {\n    const r = ref()\n    if (!r || !isIntersectionObserverAvailable || options.disabled) {\n      return\n    }\n\n    observerRef = new IntersectionObserver(([entry]) => {\n      callback(entry)\n    }, intersectionObserverOptions)\n\n    observerRef.observe(r)\n\n    Solid.onCleanup(() => {\n      observerRef?.disconnect()\n    })\n  })\n\n  return () => observerRef\n}\n"
  },
  {
    "path": "packages/solid-router/tests/ClientOnly.test.tsx",
    "content": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\nimport { cleanup, render, screen } from '@solidjs/testing-library'\nimport {\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport { ClientOnly } from '../src/ClientOnly'\nimport type { RouterHistory } from '../src'\n\nafterEach(() => {\n  vi.resetAllMocks()\n  cleanup()\n})\n\nfunction createTestRouter(initialHistory?: RouterHistory) {\n  const history =\n    initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n  const rootRoute = createRootRoute({})\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => (\n      <div>\n        <p>Index Route</p>\n        <ClientOnly fallback={<div data-testid=\"loading\">Loading...</div>}>\n          <div data-testid=\"client-only-content\">Client Only Content</div>\n        </ClientOnly>\n      </div>\n    ),\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n  const router = createRouter({ routeTree, history })\n\n  return {\n    router,\n    routes: { indexRoute },\n  }\n}\n\ndescribe('ClientOnly', () => {\n  beforeEach(() => {\n    window.scrollTo = vi.fn()\n  })\n\n  // Clear mocks after each test to prevent interference\n  afterEach(() => {\n    vi.clearAllMocks()\n  })\n\n  it('should render client content after hydration', async () => {\n    const { router } = createTestRouter()\n    await router.load()\n\n    // Mock useSyncExternalStore to simulate hydration\n    // vi.spyOn(Solid, 'createEffect').mockImplementation(() => true)\n\n    render(() => <RouterProvider router={router} />)\n\n    expect(await screen.findByTestId('client-only-content')).toBeInTheDocument()\n    expect(screen.queryByTestId('loading')).not.toBeInTheDocument()\n  })\n\n  it('should handle navigation with client-only content', async () => {\n    const { router } = createTestRouter()\n    await router.load()\n\n    // Simulate hydration\n    // vi.spyOn(Solid, 'createEffect').mockImplementation(() => true)\n\n    // Re-render after hydration\n    render(() => <RouterProvider router={router} />)\n\n    // Content should be visible before navigation\n    expect(await screen.findByTestId('client-only-content')).toBeInTheDocument()\n\n    // Navigate to a different route and back\n    await router.navigate({ to: '/other' })\n    await router.navigate({ to: '/' })\n\n    // Content should still be visible after navigation\n    expect(await screen.findByTestId('client-only-content')).toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/Matches.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  MatchRoute,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  isMatch,\n  useMatchRoute,\n  useMatches,\n} from '../src'\nimport type { AnyRouteMatch, RouteMatch } from '@tanstack/router-core'\nimport type * as Solid from 'solid-js'\n\nconst rootRoute = createRootRoute()\n\ntype RootRoute = typeof rootRoute\n\ntype RootMatch = RouteMatch<\n  RootRoute['id'],\n  RootRoute['fullPath'],\n  RootRoute['types']['allParams'],\n  RootRoute['types']['fullSearchSchema'],\n  RootRoute['types']['loaderData'],\n  RootRoute['types']['allContext'],\n  RootRoute['types']['loaderDeps']\n>\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\ntype IndexRoute = typeof indexRoute\n\ntype IndexMatch = RouteMatch<\n  IndexRoute['id'],\n  IndexRoute['fullPath'],\n  IndexRoute['types']['allParams'],\n  IndexRoute['types']['fullSearchSchema'],\n  IndexRoute['types']['loaderData'],\n  IndexRoute['types']['allContext'],\n  IndexRoute['types']['loaderDeps']\n>\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n  loader: () => [{ id: '1' }, { id: '2' }],\n})\n\ntype InvoiceMatch = RouteMatch<\n  InvoiceRoute['id'],\n  InvoiceRoute['fullPath'],\n  InvoiceRoute['types']['allParams'],\n  InvoiceRoute['types']['fullSearchSchema'],\n  InvoiceRoute['types']['loaderData'],\n  InvoiceRoute['types']['allContext'],\n  InvoiceRoute['types']['loaderDeps']\n>\n\ntype InvoicesRoute = typeof invoicesRoute\n\ntype InvoicesMatch = RouteMatch<\n  InvoicesRoute['id'],\n  InvoicesRoute['fullPath'],\n  InvoicesRoute['types']['allParams'],\n  InvoicesRoute['types']['fullSearchSchema'],\n  InvoicesRoute['types']['loaderData'],\n  InvoicesRoute['types']['allContext'],\n  InvoicesRoute['types']['loaderDeps']\n>\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\ntype InvoicesIndexRoute = typeof invoicesIndexRoute\n\ntype InvoicesIndexMatch = RouteMatch<\n  InvoicesIndexRoute['id'],\n  InvoicesIndexRoute['fullPath'],\n  InvoicesIndexRoute['types']['allParams'],\n  InvoicesIndexRoute['types']['fullSearchSchema'],\n  InvoicesIndexRoute['types']['loaderData'],\n  InvoicesIndexRoute['types']['allContext'],\n  InvoicesIndexRoute['types']['loaderDeps']\n>\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n})\n\ntype InvoiceRoute = typeof invoiceRoute\n\nconst layoutRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  id: '_layout',\n})\n\ntype LayoutRoute = typeof layoutRoute\n\ntype LayoutMatch = RouteMatch<\n  LayoutRoute['id'],\n  LayoutRoute['fullPath'],\n  LayoutRoute['types']['allParams'],\n  LayoutRoute['types']['fullSearchSchema'],\n  LayoutRoute['types']['loaderData'],\n  LayoutRoute['types']['allContext'],\n  LayoutRoute['types']['loaderDeps']\n>\n\nconst commentsRoute = createRoute({\n  getParentRoute: () => layoutRoute,\n  path: 'comments/$id',\n  validateSearch: () => ({\n    page: 0,\n    search: '',\n  }),\n  loader: () =>\n    [{ comment: 'one comment' }, { comment: 'two comment' }] as const,\n})\n\ntype CommentsRoute = typeof commentsRoute\n\ntype CommentsMatch = RouteMatch<\n  CommentsRoute['id'],\n  CommentsRoute['fullPath'],\n  CommentsRoute['types']['allParams'],\n  CommentsRoute['types']['fullSearchSchema'],\n  CommentsRoute['types']['loaderData'],\n  CommentsRoute['types']['allContext'],\n  CommentsRoute['types']['loaderDeps']\n>\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n  layoutRoute.addChildren([commentsRoute]),\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\nconst useDefaultMatchRoute = useMatchRoute<DefaultRouter>\n\ntest('when matching a route with params', () => {\n  const matchRoute = useDefaultMatchRoute()\n\n  expectTypeOf(matchRoute<string, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      '/' | '.' | '..' | '/invoices' | '/invoices/$invoiceId' | '/comments/$id'\n    >()\n\n  expectTypeOf(MatchRoute<DefaultRouter, string, '/invoices/$invoiceId'>)\n    .parameter(0)\n    .toHaveProperty('to')\n    .toEqualTypeOf<\n      '/' | '.' | '..' | '/invoices' | '/invoices/$invoiceId' | '/comments/$id'\n    >()\n\n  expectTypeOf(\n    matchRoute({\n      to: '/invoices/$invoiceId',\n    }),\n  ).toEqualTypeOf<Solid.Accessor<false | { invoiceId: string }>>()\n})\n\ntest('when matching a route with params underneath a layout route', () => {\n  const matchRoute = useDefaultMatchRoute()\n\n  expectTypeOf(\n    matchRoute({\n      to: '/comments/$id',\n    }),\n  ).toEqualTypeOf<Solid.Accessor<false | { id: string }>>()\n})\n\ntest('useMatches returns a union of all matches', () => {\n  expectTypeOf(useMatches<DefaultRouter>()()).toEqualTypeOf<\n    Array<\n      | RootMatch\n      | IndexMatch\n      | InvoicesMatch\n      | InvoicesIndexMatch\n      | InvoiceMatch\n      | LayoutMatch\n      | CommentsMatch\n    >\n  >\n})\n\ntest('when filtering useMatches by search', () => {\n  const matches = useMatches<DefaultRouter>()()\n\n  expectTypeOf(isMatch<(typeof matches)[number], ''>)\n    .parameter(1)\n    .toEqualTypeOf<keyof AnyRouteMatch>()\n\n  expectTypeOf(isMatch<(typeof matches)[number], 'search.'>).parameter(1)\n    .toEqualTypeOf<'search.page' | 'search.search'>\n\n  expectTypeOf(\n    matches.filter((match) => isMatch(match, 'search.page')),\n  ).toEqualTypeOf<Array<InvoiceMatch | CommentsMatch>>()\n})\n\ntest('when filtering useMatches by loaderData with an array', () => {\n  const matches = useMatches<DefaultRouter>()()\n\n  expectTypeOf(isMatch<(typeof matches)[number], ''>)\n    .parameter(1)\n    .toEqualTypeOf<keyof AnyRouteMatch>()\n\n  expectTypeOf(isMatch<(typeof matches)[number], 'loaderData.'>)\n    .parameter(1)\n    .toEqualTypeOf<'loaderData.0' | 'loaderData.1' | `loaderData.${number}`>()\n\n  expectTypeOf(isMatch<(typeof matches)[number], 'loaderData.0.'>).parameter(1)\n    .toEqualTypeOf<'loaderData.0.id' | 'loaderData.0.comment'>\n\n  expectTypeOf(\n    matches.filter((match) => isMatch(match, 'loaderData.5.id')),\n  ).toEqualTypeOf<Array<InvoicesMatch>>()\n\n  expectTypeOf(\n    matches.filter((match) => isMatch(match, 'loaderData.0.comment')),\n  ).toEqualTypeOf<Array<CommentsMatch>>()\n})\n"
  },
  {
    "path": "packages/solid-router/tests/RouterProvider.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: '/',\n})\n\nconst invoicesRoute = createRoute({\n  getParentRoute: () => rootRoute,\n  path: 'invoices',\n})\n\nconst invoicesIndexRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '/',\n})\n\nconst invoiceRoute = createRoute({\n  getParentRoute: () => invoicesRoute,\n  path: '$invoiceId',\n  validateSearch: () => ({ page: 0 }),\n})\n\nconst routeTree = rootRoute.addChildren([\n  invoicesRoute.addChildren([invoicesIndexRoute, invoiceRoute]),\n  indexRoute,\n])\n\nconst defaultRouter = createRouter({\n  routeTree,\n})\n\ntype DefaultRouter = typeof defaultRouter\n\ntest('can pass default router to the provider', () => {\n  expectTypeOf(RouterProvider<DefaultRouter>)\n    .parameter(0)\n    .toMatchTypeOf<{\n      router: DefaultRouter\n      routeTree?: DefaultRouter['routeTree']\n    }>()\n})\n"
  },
  {
    "path": "packages/solid-router/tests/RouterProvider.test.tsx",
    "content": "import { describe, expect, it } from 'vitest'\nimport { render } from '@solidjs/testing-library'\nimport { createContext, useContext } from 'solid-js'\nimport { createRootRoute, createRouter } from '../src'\nimport { RouterProvider } from '../src/RouterProvider'\n\ndescribe('RouterProvider', () => {\n  it('should provide context through RouterProvider Wrap', async () => {\n    const ctx = createContext<string>()\n\n    const rootRoute = createRootRoute({\n      component: () => {\n        const contextValue = useContext(ctx)\n        expect(contextValue, 'Context is not provided').not.toBeUndefined()\n\n        return <div>{contextValue}</div>\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({\n      routeTree,\n    })\n\n    const app = render(() => (\n      <RouterProvider\n        router={router}\n        Wrap={(props) => {\n          return <ctx.Provider value={'findMe'}>{props.children}</ctx.Provider>\n        }}\n      />\n    ))\n\n    const indexElem = await app.findByText('findMe')\n    expect(indexElem).toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/Scripts.test.tsx",
    "content": "import { describe, expect, test } from 'vitest'\nimport { render } from '@solidjs/testing-library'\n\nimport {\n  HeadContent,\n  RouterProvider,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport { Scripts } from '../src/Scripts'\n\ndescribe('ssr scripts', () => {\n  test('it works', async () => {\n    const rootRoute = createRootRoute({\n      // loader: () => new Promise((r) => setTimeout(r, 1)),\n      head: () => {\n        return {\n          scripts: [\n            {\n              src: 'script.js',\n            },\n            {\n              src: 'script2.js',\n            },\n          ],\n        }\n      },\n      component: () => {\n        return <Scripts />\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      // loader: () => new Promise((r) => setTimeout(r, 2)),\n      head: () => {\n        return {\n          scripts: [\n            {\n              src: 'script3.js',\n            },\n          ],\n        }\n      },\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: true,\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.headScripts).flat(1)).toEqual([\n      { src: 'script.js' },\n      { src: 'script2.js' },\n      { src: 'script3.js' },\n    ])\n  })\n\n  test('excludes `undefined` script values', async () => {\n    const rootRoute = createRootRoute({\n      scripts: () => [\n        { src: 'script.js' },\n        undefined, // 'script2.js' opted out by certain conditions, such as `NODE_ENV=production`.\n      ],\n      component: () => {\n        return <Scripts />\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      scripts: () => [{ src: 'script3.js' }],\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: true,\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.scripts).flat(1)).toEqual([\n      { src: 'script.js' },\n      undefined,\n      { src: 'script3.js' },\n    ])\n\n    const { container } = render(() => <RouterProvider router={router} />)\n\n    expect(container.innerHTML).toEqual(\n      '<script src=\"script.js\"></script><script src=\"script3.js\"></script>',\n    )\n  })\n})\n\ndescribe('ssr HeadContent', () => {\n  test('derives title, dedupes meta, and allows non-loader HeadContent', async () => {\n    const rootRoute = createRootRoute({\n      loader: () =>\n        new Promise((r) => setTimeout(r, 1)).then(() => ({\n          description: 'Root',\n        })),\n      head: ({ loaderData }) => {\n        return {\n          meta: [\n            {\n              title: 'Root',\n            },\n            {\n              name: 'description',\n              content: loaderData?.description,\n            },\n            {\n              name: 'image',\n              content: 'image.jpg',\n            },\n            {\n              property: 'og:image',\n              content: 'root-image.jpg',\n            },\n            {\n              property: 'og:description',\n              content: 'Root description',\n            },\n          ],\n        }\n      },\n      component: () => {\n        return <HeadContent />\n      },\n    })\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      loader: () =>\n        new Promise((r) => setTimeout(r, 2)).then(() => ({\n          description: 'Index',\n        })),\n      head: ({ loaderData }) => {\n        return {\n          meta: [\n            {\n              title: 'Index',\n            },\n            {\n              name: 'description',\n              content: loaderData?.description,\n            },\n            {\n              name: 'last-modified',\n              content: '2021-10-10',\n            },\n            {\n              property: 'og:image',\n              content: 'index-image.jpg',\n            },\n          ],\n        }\n      },\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute]),\n      isServer: true,\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.meta).flat(1)).toEqual([\n      { title: 'Root' },\n      { name: 'description', content: 'Root' },\n      { name: 'image', content: 'image.jpg' },\n      { property: 'og:image', content: 'root-image.jpg' },\n      { property: 'og:description', content: 'Root description' },\n      { title: 'Index' },\n      { name: 'description', content: 'Index' },\n      { name: 'last-modified', content: '2021-10-10' },\n      { property: 'og:image', content: 'index-image.jpg' },\n    ])\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/Transitioner.test.tsx",
    "content": "import { describe, expect, it, vi } from 'vitest'\nimport { render, waitFor } from '@solidjs/testing-library'\nimport {\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport { RouterProvider } from '../src/RouterProvider'\n\ndescribe('Transitioner', () => {\n  it('should call router.load() when Transitioner mounts on the client', async () => {\n    const loader = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div>Index</div>,\n      loader,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n    })\n\n    // Mock router.load() to verify it gets called\n    const loadSpy = vi.spyOn(router, 'load')\n\n    render(() => <RouterProvider router={router} />)\n    await router.latestLoadPromise\n\n    // Wait for the createRenderEffect to run and call router.load()\n    await waitFor(() => {\n      expect(loadSpy).toHaveBeenCalledTimes(1)\n      expect(loader).toHaveBeenCalledTimes(1)\n    })\n\n    loadSpy.mockRestore()\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/blocker.test.tsx",
    "content": "import '@testing-library/jest-dom/vitest'\nimport { afterEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, fireEvent, render, screen } from '@solidjs/testing-library'\nimport combinate from 'combinate'\nimport {\n  Link,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n  useBlocker,\n  useNavigate,\n} from '../src'\nimport type { ShouldBlockFn } from '../src'\n\nafterEach(() => {\n  window.history.replaceState(null, 'root', '/')\n  vi.resetAllMocks()\n  cleanup()\n})\n\ninterface BlockerTestOpts {\n  blockerFn: ShouldBlockFn\n  disabled?: boolean\n  ignoreBlocker?: boolean\n}\n\nasync function setup({ blockerFn, disabled, ignoreBlocker }: BlockerTestOpts) {\n  const _mockBlockerFn = vi.fn(blockerFn)\n  const rootRoute = createRootRoute()\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: function Setup() {\n      const navigate = useNavigate()\n      useBlocker({ disabled, shouldBlockFn: _mockBlockerFn })\n      return (\n        <>\n          <h1>Index</h1>\n          <Link to=\"/posts\" ignoreBlocker={ignoreBlocker}>\n            link to posts\n          </Link>\n          <Link to=\"/foo\">link to foo</Link>\n          <button onClick={() => navigate({ to: '/posts', ignoreBlocker })}>\n            button\n          </button>\n        </>\n      )\n    },\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n    component: () => (\n      <>\n        <h1>Posts</h1>\n      </>\n    ),\n  })\n\n  const fooRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/foo',\n    beforeLoad: () => {\n      throw redirect({ to: '/bar' })\n    },\n    component: () => (\n      <>\n        <h1>Foo</h1>\n      </>\n    ),\n  })\n\n  const barRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/bar',\n    component: () => (\n      <>\n        <h1>Bar</h1>\n      </>\n    ),\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      fooRoute,\n      barRoute,\n    ]),\n  })\n\n  render(() => <RouterProvider router={router} />)\n  expect(window.location.pathname).toBe('/')\n\n  const postsLink = await screen.findByRole('link', { name: 'link to posts' })\n  const fooLink = await screen.findByRole('link', { name: 'link to foo' })\n  const button = await screen.findByRole('button', { name: 'button' })\n\n  return {\n    router,\n    clickable: { postsLink, fooLink, button },\n    blockerFn: _mockBlockerFn,\n  }\n}\n\nconst clickTarget = ['postsLink' as const, 'button' as const]\n\ndescribe('Blocker', () => {\n  const doesNotBlockTextMatrix = combinate({\n    opts: [\n      {\n        blockerFn: () => false,\n        disabled: false,\n        ignoreBlocker: undefined,\n      },\n      {\n        blockerFn: async () =>\n          await new Promise<boolean>((resolve) => resolve(false)),\n        disabled: false,\n        ignoreBlocker: false,\n      },\n      {\n        blockerFn: () => true,\n        disabled: true,\n        ignoreBlocker: false,\n      },\n      {\n        blockerFn: () => true,\n        disabled: false,\n        ignoreBlocker: true,\n      },\n    ],\n    clickTarget,\n  })\n  test.each(doesNotBlockTextMatrix)(\n    'does not block navigation with blockerFn = $flags.blockerFn, ignoreBlocker = $flags.ignoreBlocker, clickTarget = $clickTarget',\n    async ({ opts, clickTarget }) => {\n      const { clickable, blockerFn } = await setup(opts)\n\n      fireEvent.click(clickable[clickTarget])\n      expect(\n        await screen.findByRole('heading', { name: 'Posts' }),\n      ).toBeInTheDocument()\n      expect(window.location.pathname).toBe('/posts')\n      if (opts.ignoreBlocker || opts.disabled)\n        expect(blockerFn).not.toHaveBeenCalled()\n    },\n  )\n\n  const blocksTextMatrix = combinate({\n    opts: [\n      {\n        blockerFn: () => true,\n        disabled: false,\n        ignoreBlocker: undefined,\n      },\n      {\n        blockerFn: async () =>\n          await new Promise<boolean>((resolve) => resolve(true)),\n        disabled: false,\n        ignoreBlocker: false,\n      },\n    ],\n    clickTarget,\n  })\n  test.each(blocksTextMatrix)(\n    'blocks navigation with condition = $flags.blockerFn, ignoreBlocker = $flags.ignoreBlocker, clickTarget = $clickTarget',\n    async ({ opts, clickTarget }) => {\n      const { clickable } = await setup(opts)\n\n      fireEvent.click(clickable[clickTarget])\n      await expect(\n        screen.findByRole('header', { name: 'Posts' }),\n      ).rejects.toThrow()\n      expect(window.location.pathname).toBe('/')\n    },\n  )\n\n  test('blocker function is only called once when navigating to a route that redirects', async () => {\n    const { clickable, blockerFn } = await setup({\n      blockerFn: () => false,\n      ignoreBlocker: false,\n    })\n    fireEvent.click(clickable.fooLink)\n    expect(\n      await screen.findByRole('heading', { name: 'Bar' }),\n    ).toBeInTheDocument()\n    expect(window.location.pathname).toBe('/bar')\n    expect(blockerFn).toHaveBeenCalledTimes(1)\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/createLazyRoute.test.tsx",
    "content": "import { afterEach, describe, expect, it, vi } from 'vitest'\nimport { cleanup, fireEvent, render, screen } from '@solidjs/testing-library'\nimport {\n  Link,\n  RouterProvider,\n  createBrowserHistory,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { RouterHistory } from '../src'\n\nafterEach(() => {\n  vi.resetAllMocks()\n  cleanup()\n})\n\nfunction createTestRouter(initialHistory?: RouterHistory) {\n  const history =\n    initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n  const rootRoute = createRootRoute({})\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => (\n      <div>\n        <p>Index Route</p>\n        <Link to=\"/heavy\">Link to heavy</Link>\n      </div>\n    ),\n  })\n\n  const heavyRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/heavy',\n  }).lazy(() => import('./lazy/heavy').then((d) => d.default('/heavy')))\n\n  const routeTree = rootRoute.addChildren([indexRoute, heavyRoute])\n\n  const router = createRouter({ routeTree, history })\n\n  return {\n    router,\n    routes: { indexRoute, heavyRoute },\n  }\n}\n\ndescribe('preload: matched routes', { timeout: 20000 }, () => {\n  it('should wait for lazy options to be streamed in before ', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/'] }),\n    )\n\n    await router.load()\n\n    // Preload the route and navigate to it\n    router.preloadRoute({ to: '/heavy' })\n    await router.navigate({ to: '/heavy' })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/heavy')\n\n    const lazyRoute = router.routesByPath['/heavy']\n\n    expect(lazyRoute.options.component).toBeDefined()\n  })\n\n  it('should render the heavy/lazy component', async () => {\n    const { router } = createTestRouter(createBrowserHistory())\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToHeavy = await screen.findByText('Link to heavy')\n    expect(linkToHeavy).toBeInTheDocument()\n\n    expect(router.state.location.pathname).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    // click the link to navigate to the heavy route\n    fireEvent.click(linkToHeavy)\n\n    const heavyElement = await screen.findByText('I am sooo heavy')\n\n    expect(heavyElement).toBeInTheDocument()\n\n    expect(router.state.location.pathname).toBe('/heavy')\n    expect(window.location.pathname).toBe('/heavy')\n\n    const lazyRoute = router.routesByPath['/heavy']\n    expect(lazyRoute.options.component).toBeDefined()\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/disableGlobalCatchBoundary.test.tsx",
    "content": "import { afterEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, render, screen } from '@solidjs/testing-library'\nimport { ErrorBoundary } from 'solid-js'\nimport {\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { JSX } from 'solid-js'\n\nfunction ThrowingComponent() {\n  throw new Error('Test error')\n}\n\n// Custom error boundary to catch errors that bubble up\nfunction TestErrorBoundary(props: { children: JSX.Element }) {\n  return (\n    <ErrorBoundary\n      fallback={(err) => (\n        <div>External Error Boundary Caught: {err.message}</div>\n      )}\n    >\n      {props.children}\n    </ErrorBoundary>\n  )\n}\n\nfunction createTestRouter(disableGlobalCatchBoundary: boolean) {\n  const rootRoute = createRootRoute({})\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: ThrowingComponent,\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n  return createRouter({\n    routeTree,\n    disableGlobalCatchBoundary,\n  })\n}\n\nafterEach(() => {\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ndescribe('disableGlobalCatchBoundary option', () => {\n  test('catches errors in global boundary when disableGlobalCatchBoundary is false', async () => {\n    const router = createTestRouter(false)\n\n    render(() => <RouterProvider router={router} />)\n\n    // The global CatchBoundary shows \"Something went wrong!\" by default\n    const errorElement = await screen.findByText('Something went wrong!')\n    expect(errorElement).toBeInTheDocument()\n  })\n\n  test('errors bubble up to external error boundary when disableGlobalCatchBoundary is true', async () => {\n    const router = createTestRouter(true)\n\n    // Wrap RouterProvider in an external error boundary\n    render(() => (\n      <TestErrorBoundary>\n        <RouterProvider router={router} />\n      </TestErrorBoundary>\n    ))\n\n    // Error should bubble up and be caught by the external error boundary\n    const externalErrorElement = await screen.findByText(\n      'External Error Boundary Caught: Test error',\n    )\n    expect(externalErrorElement).toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/errorComponent.test.tsx",
    "content": "import { afterEach, describe, expect, test, vi } from 'vitest'\nimport { cleanup, fireEvent, render, screen } from '@solidjs/testing-library'\n\nimport {\n  Link,\n  RouterProvider,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { ErrorComponentProps } from '../src'\n\nfunction MyErrorComponent(props: ErrorComponentProps) {\n  return <div>Error: {props.error.message}</div>\n}\n\nasync function asyncToThrowFn() {\n  await new Promise((resolve) => setTimeout(resolve, 500))\n  throw new Error('error thrown')\n}\n\nfunction throwFn() {\n  throw new Error('error thrown')\n}\n\nafterEach(() => {\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ndescribe.each([{ preload: false }, { preload: 'intent' }] as const)(\n  'errorComponent is rendered when the preload=$preload',\n  (options) => {\n    describe.each([true, false])('with async=%s', (isAsync) => {\n      const throwableFn = isAsync ? asyncToThrowFn : throwFn\n\n      const callers = [\n        { caller: 'beforeLoad', testFn: throwableFn },\n        { caller: 'loader', testFn: throwableFn },\n      ]\n\n      test.each(callers)(\n        'an Error is thrown on navigate in the route $caller function',\n        async ({ caller, testFn }) => {\n          const rootRoute = createRootRoute()\n          const indexRoute = createRoute({\n            getParentRoute: () => rootRoute,\n            path: '/',\n            component: function Home() {\n              return (\n                <div>\n                  <Link to=\"/about\">link to about</Link>\n                </div>\n              )\n            },\n          })\n          const aboutRoute = createRoute({\n            getParentRoute: () => rootRoute,\n            path: '/about',\n            beforeLoad: caller === 'beforeLoad' ? testFn : undefined,\n            loader: caller === 'loader' ? testFn : undefined,\n            component: function Home() {\n              return <div>About route content</div>\n            },\n            errorComponent: MyErrorComponent,\n          })\n\n          const routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\n          const router = createRouter({\n            routeTree,\n            defaultPreload: options.preload,\n          })\n\n          render(() => <RouterProvider router={router} />)\n\n          const linkToAbout = await screen.findByRole('link', {\n            name: 'link to about',\n          })\n\n          expect(linkToAbout).toBeInTheDocument()\n          fireEvent.mouseOver(linkToAbout)\n          fireEvent.focus(linkToAbout)\n          fireEvent.click(linkToAbout)\n\n          const errorComponent = await screen.findByText(\n            `Error: error thrown`,\n            undefined,\n            { timeout: 1500 },\n          )\n          await expect(\n            screen.findByText('About route content'),\n          ).rejects.toThrow()\n          expect(errorComponent).toBeInTheDocument()\n        },\n      )\n\n      test.each(callers)(\n        'an Error is thrown on first load in the route $caller function',\n        async ({ caller, testFn }) => {\n          const rootRoute = createRootRoute()\n          const indexRoute = createRoute({\n            getParentRoute: () => rootRoute,\n            path: '/',\n            beforeLoad: caller === 'beforeLoad' ? testFn : undefined,\n            loader: caller === 'loader' ? testFn : undefined,\n            component: function Home() {\n              return <div>Index route content</div>\n            },\n            errorComponent: MyErrorComponent,\n          })\n\n          const routeTree = rootRoute.addChildren([indexRoute])\n\n          const router = createRouter({\n            routeTree,\n            defaultPreload: options.preload,\n          })\n\n          render(() => <RouterProvider router={router} />)\n\n          const errorComponent = await screen.findByText(\n            `Error: error thrown`,\n            undefined,\n            { timeout: 750 },\n          )\n          await expect(\n            screen.findByText('Index route content'),\n          ).rejects.toThrow()\n          expect(errorComponent).toBeInTheDocument()\n        },\n      )\n    })\n  },\n)\n"
  },
  {
    "path": "packages/solid-router/tests/fileRoute.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport { createFileRoute, createRootRoute } from '../src'\n\nconst rootRoute = createRootRoute()\n\nconst indexRoute = createFileRoute('/')()\n\nconst invoicesRoute = createFileRoute('/invoices')()\n\nconst invoiceRoute = createFileRoute('/invoices/$invoiceId')()\n\nconst postLayoutRoute = createFileRoute('/_postLayout')()\n\nconst postsRoute = createFileRoute('/_postLayout/posts')()\n\nconst postRoute = createFileRoute('/_postLayout/posts/$postId_')()\n\nconst protectedRoute = createFileRoute('/(auth)/protected')()\n\ndeclare module '@tanstack/router-core' {\n  interface FileRoutesByPath {\n    '/': {\n      preLoaderRoute: typeof indexRoute\n      parentRoute: typeof rootRoute\n      id: string\n      fullPath: string\n      path: string\n    }\n    '/(auth)/protected': {\n      preLoaderRoute: typeof protectedRoute\n      parentRoute: typeof rootRoute\n      id: '/protected'\n      fullPath: '/protected'\n      path: '(auth)/protected'\n    }\n    '/invoices': {\n      preLoaderRoute: typeof invoicesRoute\n      parentRoute: typeof indexRoute\n      id: '/invoices'\n      fullPath: '/invoices'\n      path: 'invoices'\n    }\n    '/invoices/$invoiceId': {\n      preLoaderRoute: typeof invoiceRoute\n      parentRoute: typeof invoicesRoute\n      id: '/invoices/$invoiceId'\n      fullPath: '/invoices/$invoiceId'\n      path: '/$invoiceId'\n    }\n    '/_postLayout': {\n      preLoaderRoute: typeof postLayoutRoute\n      parentRoute: typeof rootRoute\n      id: string\n      fullPath: string\n      path: string\n    }\n    '/_postLayout/posts': {\n      preLoaderRoute: typeof postsRoute\n      parentRoute: typeof postLayoutRoute\n      id: '/_postLayout/posts'\n      fullPath: '/posts'\n      path: '/posts'\n    }\n    '/_postLayout/posts/$postId_': {\n      preLoaderRoute: typeof postRoute\n      parentRoute: typeof postsRoute\n      id: '/_postLayout/posts/$postId_'\n      fullPath: '/posts/$postId'\n      path: '/$postId_'\n    }\n  }\n}\n\ntest('when creating a file route with a static route', () => {\n  expectTypeOf<'/invoices'>(invoicesRoute.fullPath)\n  expectTypeOf<'/invoices'>(invoicesRoute.id)\n  expectTypeOf<'invoices'>(invoicesRoute.path)\n})\n\ntest('when creating a file route with params', () => {\n  expectTypeOf<'/invoices/$invoiceId'>(invoiceRoute.fullPath)\n  expectTypeOf<'/invoices/$invoiceId'>(invoiceRoute.id)\n  expectTypeOf<'/$invoiceId'>(invoiceRoute.path)\n})\n\ntest('when creating a layout route', () => {\n  expectTypeOf<'/posts'>(postsRoute.fullPath)\n  expectTypeOf<'/_postLayout/posts'>(postsRoute.id)\n  expectTypeOf<'/posts'>(postsRoute.path)\n})\n\ntest('when creating a _ suffix route', () => {\n  expectTypeOf<'/posts/$postId'>(postRoute.fullPath)\n  expectTypeOf<'/$postId_'>(postRoute.path)\n  expectTypeOf<'/_postLayout/posts/$postId_'>(postRoute.id)\n})\n\ntest('when creating a folder group', () => {\n  expectTypeOf<'/protected'>(protectedRoute.fullPath)\n  expectTypeOf<'(auth)/protected'>(protectedRoute.path)\n  expectTypeOf<'/protected'>(protectedRoute.id)\n})\n"
  },
  {
    "path": "packages/solid-router/tests/fileRoute.test.ts",
    "content": "/* eslint-disable */\nimport { describe, it, expect } from 'vitest'\nimport {\n  getRouteApi,\n  createFileRoute,\n  createLazyRoute,\n  createLazyFileRoute,\n  LazyRoute,\n} from '../src'\n\ndescribe('createFileRoute has the same hooks as getRouteApi', () => {\n  const routeApi = getRouteApi('foo')\n  const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))\n  // @ts-expect-error\n  const route = createFileRoute('')({})\n\n  it.each(hookNames.map((name) => [name]))(\n    'should have the \"%s\" hook defined',\n    (hookName) => {\n      expect(route[hookName as keyof LazyRoute<any>]).toBeDefined()\n    },\n  )\n})\n\ndescribe('createLazyFileRoute has the same hooks as getRouteApi', () => {\n  const routeApi = getRouteApi('foo')\n  const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))\n  // @ts-expect-error\n  const route = createLazyFileRoute('')({})\n\n  it.each(hookNames.map((name) => [name]))(\n    'should have the \"%s\" hook defined',\n    (hookName) => {\n      expect(route[hookName as keyof LazyRoute<any>]).toBeDefined()\n    },\n  )\n})\n\ndescribe('createLazyRoute has the same hooks as getRouteApi', () => {\n  const routeApi = getRouteApi('foo')\n  const route = createLazyRoute({})({})\n  const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))\n\n  it.each(hookNames.map((name) => [name]))(\n    'should have the \"%s\" hook defined',\n    (hookName) => {\n      expect(route[hookName as keyof LazyRoute<any>]).toBeDefined()\n    },\n  )\n})\n"
  },
  {
    "path": "packages/solid-router/tests/index.test.tsx",
    "content": "import { expect, test } from 'vitest'\n\n// keeping this dummy test in since in the future\n// we may want to grab the commented out tests from here\n\ntest('index true=true', () => {\n  expect(true).toBe(true)\n})\n// import { render } from '@solidjs/testing-library'\n\n// import * as Solid from 'solid-js'\n\n// import {\n//   Outlet,\n//   RouterProvider,\n//   cleanPath,\n//   createMemoryHistory,\n//   createRootRoute,\n//   createRoute,\n//   createRouter,\n//   // Location,\n//   matchPathname,\n//   // ParsedLocation,\n//   parsePathname,\n//   redirect,\n//   // Route,\n//   // createMemoryHistory,\n//   resolvePath,\n//   // Segment,\n//   trimPath,\n//   trimPathLeft,\n// } from '../src'\n\n// import { createTimer, sleep } from './utils'\n\n// function RouterInstance(opts?: { initialEntries?: string[] }) {\n//   return new RouterInstance({\n//     routes: [],\n//     history: createMemoryHistory({\n//       initialEntries: opts?.initialEntries ?? ['/'],\n//     }),\n//   })\n// }\n\n// function createLocation(location: Partial<Location>): ParsedLocation {\n//   return {\n//     pathname: '',\n//     href: '',\n//     search: {},\n//     searchStr: '',\n//     state: {},\n//     hash: '',\n//     ...location,\n//   }\n// }\n\n// describe('Router', () => {\n//   test('mounts to /', async () => {\n//     const router = RouterInstance()\n\n//     const routes = [\n//       {\n//         path: '/',\n//       },\n//     ]\n\n//     router.update({\n//       routes,\n//     })\n\n//     const promise = router.mount()\n//     expect(router.store.pendingMatches[0].id).toBe('/')\n\n//     await promise\n//     expect(router.state.matches[0].id).toBe('/')\n//   })\n\n//   test('mounts to /a', async () => {\n//     const router = RouterInstance({ initialEntries: ['/a'] })\n//     const routes: Route[] = [\n//       {\n//         path: '/',\n//       },\n//       {\n//         path: '/a',\n//       },\n//     ]\n\n//     router.update({\n//       routes,\n//     })\n\n//     let promise = router.mount()\n\n//     expect(router.store.pendingMatches[0].id).toBe('/a')\n//     await promise\n//     expect(router.state.matches[0].id).toBe('/a')\n//   })\n\n//   test('mounts to /a/b', async () => {\n//     const router = RouterInstance({\n//       initialEntries: ['/a/b'],\n//     })\n\n//     const routes: Route[] = [\n//       {\n//         path: '/',\n//       },\n//       {\n//         path: '/a',\n//         children: [\n//           {\n//             path: '/b',\n//           },\n//         ],\n//       },\n//     ]\n\n//     router.update({\n//       routes,\n//     })\n\n//     let promise = router.mount()\n\n//     expect(router.store.pendingMatches[1].id).toBe('/a/b')\n//     await promise\n//     expect(router.state.matches[1].id).toBe('/a/b')\n//   })\n\n//   test('navigates to /a', async () => {\n//     const router = RouterInstance()\n//     const routes: Route[] = [\n//       {\n//         path: '/',\n//       },\n//       {\n//         path: 'a',\n//       },\n//     ]\n\n//     router.update({\n//       routes,\n//     })\n\n//     let promise = router.mount()\n\n//     expect(router.store.pendingMatches[0].id).toBe('/')\n\n//     await promise\n//     expect(router.state.matches[0].id).toBe('/')\n\n//     promise = router.navigate({ to: 'a' })\n//     expect(router.state.matches[0].id).toBe('/')\n//     expect(router.store.pendingMatches[0].id).toBe('a')\n\n//     await promise\n//     expect(router.state.matches[0].id).toBe('a')\n//     expect(router.store.pending).toBe(undefined)\n//   })\n\n//   test('navigates to /a to /a/b', async () => {\n//     const router = RouterInstance()\n//     const routes: Route[] = [\n//       {\n//         path: '/',\n//       },\n//       {\n//         path: 'a',\n//         children: [\n//           {\n//             path: 'b',\n//           },\n//         ],\n//       },\n//     ]\n\n//     router.update({\n//       routes,\n//     })\n\n//     await router.mount()\n//     expect(router.state.location.href).toBe('/')\n\n//     let promise = router.navigate({ to: 'a' })\n//     expect(router.store.pendingLocation.href).toBe('/a')\n//     await promise\n//     expect(router.state.location.href).toBe('/a')\n\n//     promise = router.navigate({ to: './b' })\n//     expect(router.store.pendingLocation.href).toBe('/a/b')\n//     await promise\n//     expect(router.state.location.href).toBe('/a/b')\n\n//     expect(router.store.pending).toBe(undefined)\n//   })\n\n//   test('async navigates to /a/b', async () => {\n//     const router = RouterInstance()\n//     const routes: Route[] = [\n//       {\n//         path: '/',\n//       },\n//       {\n//         path: 'a',\n//         loader: () => sleep(10).then((d) => ({ a: true })),\n//         children: [\n//           {\n//             path: 'b',\n//             loader: () => sleep(10).then((d) => ({ b: true })),\n//           },\n//         ],\n//       },\n//     ]\n\n//     const timer = createTimer()\n\n//     router.update({\n//       routes,\n//     })\n\n//     router.mount()\n\n//     timer.start()\n//     await router.navigate({ to: 'a/b' })\n//     expect(router.store.loaderData).toEqual({\n//       a: true,\n//       b: true,\n//     })\n//     expect(timer.getTime()).toBeLessThan(30)\n//   })\n\n//   test('async navigates with import + loader', async () => {\n//     const router = RouterInstance()\n//     const routes: Route[] = [\n//       {\n//         path: '/',\n//       },\n//       {\n//         path: 'a',\n//         import: async () => {\n//           await sleep(10)\n//           return {\n//             loader: () => sleep(10).then((d) => ({ a: true })),\n//           }\n//         },\n//         children: [\n//           {\n//             path: 'b',\n//             import: async () => {\n//               await sleep(10)\n//               return {\n//                 loader: () =>\n//                   sleep(10).then((d) => ({\n//                     b: true,\n//                   })),\n//               }\n//             },\n//           },\n//         ],\n//       },\n//     ]\n\n//     const timer = createTimer()\n\n//     router.update({\n//       routes,\n//     })\n\n//     router.mount()\n\n//     timer.start()\n//     await router.navigate({ to: 'a/b' })\n//     expect(router.store.loaderData).toEqual({\n//       a: true,\n//       b: true,\n//     })\n//     expect(timer.getTime()).toBeLessThan(28)\n//   })\n\n//   test('async navigates with import + elements + loader', async () => {\n//     const router = RouterInstance()\n//     const routes: Route[] = [\n//       {\n//         path: '/',\n//       },\n//       {\n//         path: 'a',\n//         import: async () => {\n//           await sleep(10)\n//           return {\n//             element: async () => {\n//               await sleep(20)\n//               return 'element'\n//             },\n//             loader: () => sleep(30).then((d) => ({ a: true })),\n//           }\n//         },\n//         children: [\n//           {\n//             path: 'b',\n//             import: async () => {\n//               await sleep(10)\n//               return {\n//                 element: async () => {\n//                   await sleep(20)\n//                   return 'element'\n//                 },\n//                 loader: () =>\n//                   sleep(30).then((d) => ({\n//                     b: true,\n//                   })),\n//               }\n//             },\n//           },\n//         ],\n//       },\n//     ]\n\n//     const timer = createTimer()\n\n//     router.update({\n//       routes,\n//     })\n\n//     router.mount()\n\n//     await router.navigate({ to: 'a/b' })\n//     expect(router.store.loaderData).toEqual({\n//       a: true,\n//       b: true,\n//     })\n//     expect(timer.getTime()).toBeLessThan(55)\n//   })\n\n//   test('async navigates with pending state', async () => {\n//     const router = RouterInstance()\n//     const routes: Route[] = [\n//       {\n//         path: '/',\n//       },\n//       {\n//         path: 'a',\n//         pendingMs: 10,\n//         loader: () => sleep(20),\n//         children: [\n//           {\n//             path: 'b',\n//             pendingMs: 30,\n//             loader: () => sleep(40),\n//           },\n//         ],\n//       },\n//     ]\n\n//     router.update({\n//       routes,\n//     })\n\n//     await router.mount()\n\n//     const timer = createTimer()\n//     await router.navigate({ to: 'a/b' })\n//     expect(timer.getTime()).toBeLessThan(46)\n//   })\n// })\n\n// describe('matchRoute', () => {\n//   describe('fuzzy', () => {\n//     ;(\n//       [\n//         [\n//           '/',\n//           {\n//             to: '/',\n//             fuzzy: true,\n//           },\n//           {},\n//         ],\n//         [\n//           '/a',\n//           {\n//             to: '/',\n//             fuzzy: true,\n//           },\n//           {},\n//         ],\n//         [\n//           '/a',\n//           {\n//             to: '/$',\n//             fuzzy: true,\n//           },\n//           { '*': 'a' },\n//         ],\n//         [\n//           '/a/b',\n//           {\n//             to: '/$',\n//             fuzzy: true,\n//           },\n//           { '*': 'a/b' },\n//         ],\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/$',\n//             fuzzy: true,\n//           },\n//           { '*': 'a/b/c' },\n//         ],\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/',\n//             fuzzy: true,\n//           },\n//           {},\n//         ],\n//         [\n//           '/a/b',\n//           {\n//             to: '/a/b/',\n//             fuzzy: true,\n//           },\n//           {},\n//         ],\n//       ] as const\n//     ).forEach(([a, b, eq]) => {\n//       test(`${a} == ${b.to}`, () => {\n//         expect(matchPathname('', a, b)).toEqual(eq)\n//       })\n//     })\n//   })\n\n//   describe('exact', () => {\n//     ;(\n//       [\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/',\n//           },\n//           undefined,\n//         ],\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/a/b',\n//           },\n//           undefined,\n//         ],\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/a/b/c',\n//           },\n//           {},\n//         ],\n//       ] as const\n//     ).forEach(([a, b, eq]) => {\n//       test(`${a} == ${b.to}`, () => {\n//         expect(matchPathname('', a, b)).toEqual(eq)\n//       })\n//     })\n//   })\n\n//   describe('basepath', () => {\n//     ;(\n//       [\n//         [\n//           '/base',\n//           '/base',\n//           {\n//             to: '/',\n//           },\n//           {},\n//         ],\n//         [\n//           '/base',\n//           '/base/a',\n//           {\n//             to: '/a',\n//           },\n//           {},\n//         ],\n//         [\n//           '/base',\n//           '/base/a/b/c',\n//           {\n//             to: '/a/b/c',\n//           },\n//           {},\n//         ],\n//         [\n//           '/base',\n//           '/base/posts',\n//           {\n//             fuzzy: true,\n//             to: '/',\n//           },\n//           {},\n//         ],\n//         [\n//           '/base',\n//           '/base/a',\n//           {\n//             to: '/b',\n//           },\n//           undefined,\n//         ],\n//       ] as const\n//     ).forEach(([a, b, c, eq]) => {\n//       test(`${b} == ${a} + ${c.to}`, () => {\n//         expect(matchPathname(a, b, c)).toEqual(eq)\n//       })\n//     })\n//   })\n\n//   describe('params', () => {\n//     ;(\n//       [\n//         [\n//           '/a/b',\n//           {\n//             to: '/a/$b',\n//           },\n//           { b: 'b' },\n//         ],\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/a/$b/$c',\n//           },\n//           { b: 'b', c: 'c' },\n//         ],\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/$a/$b/$c',\n//           },\n//           { a: 'a', b: 'b', c: 'c' },\n//         ],\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/$a/$',\n//           },\n//           { a: 'a', '*': 'b/c' },\n//         ],\n//         [\n//           '/a/b/c',\n//           {\n//             to: '/a/$b/c',\n//           },\n//           { b: 'b' },\n//         ],\n//       ] as const\n//     ).forEach(([a, b, eq]) => {\n//       test(`${a} == ${b.to}`, () => {\n//         expect(matchPathname('', a, b)).toEqual(eq)\n//       })\n//     })\n//   })\n// })\n"
  },
  {
    "path": "packages/solid-router/tests/lazy/heavy.tsx",
    "content": "import { createLazyRoute } from '../../src'\nimport HeavyComponent from './mockHeavyDependenciesRoute'\n\nexport default function Route(id: string) {\n  return createLazyRoute(id)({\n    component: HeavyComponent,\n  })\n}\n"
  },
  {
    "path": "packages/solid-router/tests/lazy/mockHeavyDependenciesRoute.tsx",
    "content": "// This mimicks the waiting of heavy dependencies, which need to be streamed in before the component is available.\nawait new Promise((resolve) => setTimeout(resolve, 2500))\n\nexport default function HeavyComponent() {\n  return <h1>I am sooo heavy</h1>\n}\n"
  },
  {
    "path": "packages/solid-router/tests/lazy/normal.tsx",
    "content": "import { createLazyFileRoute, createLazyRoute } from '../../src'\n\nexport function Route(id: string) {\n  return createLazyRoute(id)({\n    component: () => <h1>I'm a normal route</h1>,\n  })\n}\n\nexport function FileRoute(id: string) {\n  return createLazyFileRoute(id as never)({\n    component: () => <h1>I'm a normal file route</h1>,\n  })\n}\n"
  },
  {
    "path": "packages/solid-router/tests/link.test.tsx",
    "content": "import * as Solid from 'solid-js'\nimport { afterEach, beforeEach, describe, expect, it, test, vi } from 'vitest'\nimport {\n  cleanup,\n  fireEvent,\n  render,\n  screen,\n  waitFor,\n} from '@solidjs/testing-library'\n\nimport { z } from 'zod'\n\nimport { trailingSlashOptions } from '@tanstack/router-core'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createBrowserHistory,\n  createHashHistory,\n  createLink,\n  createMemoryHistory,\n  createRootRoute,\n  createRootRouteWithContext,\n  createRoute,\n  createRouteMask,\n  createRouter,\n  getRouteApi,\n  redirect,\n  retainSearchParams,\n  stripSearchParams,\n  useLoaderData,\n  useMatchRoute,\n  useParams,\n  useRouteContext,\n  useSearch,\n} from '../src'\nimport {\n  getIntersectionObserverMock,\n  getSearchParamsFromURI,\n  sleep,\n} from './utils'\nimport type { RouterHistory } from '../src'\n\nconst ioObserveMock = vi.fn()\nconst ioDisconnectMock = vi.fn()\nlet history: RouterHistory\n\nbeforeEach(() => {\n  const io = getIntersectionObserverMock({\n    observe: ioObserveMock,\n    disconnect: ioDisconnectMock,\n  })\n  vi.stubGlobal('IntersectionObserver', io)\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy?.()\n  window.history.replaceState(null, 'root', '/')\n  vi.resetAllMocks()\n  cleanup()\n})\n\nconst WAIT_TIME = 300\n\ndescribe('Link', () => {\n  // rerender doesn't exist in solid\n\n  // test('when using renderHook it returns a hook with same content to prove rerender works', async () => {\n  //   /**\n  //    * This is the hook that will be testet.\n  //    *\n  //    * @returns custom state\n  //    */\n  //   const useLocationFromState = () => {\n  //     const { location } = useRouterState()\n\n  //     // could return anything just to prove it will work.\n  //     const memoLocation = Solid.useMemo(() => {\n  //       return {\n  //         href: location.href,\n  //         pathname: location.pathname,\n  //       }\n  //     }, [location.href, location.pathname])\n\n  //     return memoLocation\n  //   }\n\n  //   const IndexComponent = ({ children }: { children: Solid.JSX.Element }) => {\n  //     return <h1 data-testid=\"testId\">{children}</h1>\n  //   }\n  //   const RouterContainer = ({ children }: { children: Solid.JSX.Element }) => {\n  //     const childrenRef = Solid.useRef(children)\n  //     const memoedRouteTree = Solid.useMemo(() => {\n  //       const rootRoute = createRootRoute()\n  //       const indexRoute = createRoute({\n  //         getParentRoute: () => rootRoute,\n  //         path: '/',\n  //         component: () => (\n  //           <IndexComponent>{childrenRef.current}</IndexComponent>\n  //         ),\n  //       })\n  //       return rootRoute.addChildren([indexRoute])\n  //     }, [])\n\n  //     const memoedRouter = Solid.useMemo(() => {\n  //       const router = createRouter({\n  //         routeTree: memoedRouteTree,\n  //       })\n\n  //       return router\n  //     }, [memoedRouteTree])\n  //     return <RouterProvider router={memoedRouter} />\n  //   }\n\n  //   const { result, rerender } = renderHook(\n  //     () => {\n  //       return useLocationFromState()\n  //     },\n  //     { wrapper: RouterContainer },\n  //   )\n  //   await waitFor(() => expect(screen.getByTestId('testId')).toBeVisible())\n  //   expect(result.current).toBeTruthy()\n\n  //   const original = result.current\n\n  //   rerender()\n\n  //   await waitFor(() => expect(screen.getByTestId('testId')).toBeVisible())\n  //   const updated = result.current\n\n  //   expect(original).toBe(updated)\n  // })\n\n  test('when a Link is disabled', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index</h1>\n          <Link to=\"/posts\" disabled>\n            Posts\n          </Link>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1>Posts</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(window.location.pathname).toBe('/')\n\n    expect(postsLink).not.toBeDisabled()\n    expect(postsLink).toHaveAttribute('aria-disabled', 'true')\n\n    fireEvent.click(postsLink)\n\n    await expect(\n      screen.findByRole('header', { name: 'Posts' }),\n    ).rejects.toThrow()\n  })\n\n  test('when a Link has children', async () => {\n    const ChildComponent = vi.fn().mockReturnValue(<button>Posts</button>)\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index</h1>\n          <Link to=\"/posts\">\n            <ChildComponent />\n          </Link>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1>Posts</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    fireEvent.click(postsLink)\n\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n\n    expect(ChildComponent).toBeCalledTimes(1)\n  })\n\n  test('when the current route is the root', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/\" activeProps={{ class: 'active' }}>\n              Index\n            </Link>\n            <Link to=\"/posts\" inactiveProps={{ class: 'inactive' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return <h1>Posts</h1>\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexLink = await screen.findByRole('link', { name: 'Index' })\n\n    expect(window.location.pathname).toBe('/')\n\n    expect(indexLink).toHaveAttribute('aria-current', 'page')\n    expect(indexLink).toHaveClass('active')\n    expect(indexLink).toHaveAttribute('data-status', 'active')\n    expect(indexLink).toHaveAttribute('href', '/')\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveClass('inactive')\n    expect(postsLink).toHaveAttribute('href', '/posts')\n    expect(postsLink).not.toHaveAttribute('aria-current', 'page')\n    expect(postsLink).not.toHaveAttribute('data-status', 'active')\n  })\n\n  describe('when the current route has a search fields with undefined values', () => {\n    async function runTest(opts: { explicitUndefined: boolean | undefined }) {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index</h1>\n              <Link\n                to=\"/\"\n                activeOptions={{ exact: true }}\n                inactiveProps={{ class: 'inactive' }}\n              >\n                Index exact\n              </Link>\n              <Link\n                to=\"/\"\n                search={{ foo: undefined }}\n                inactiveProps={{ class: 'inactive' }}\n                activeOptions={{ explicitUndefined: opts.explicitUndefined }}\n              >\n                Index foo=undefined\n              </Link>\n              <Link\n                to=\"/\"\n                search={{ foo: undefined }}\n                activeOptions={{\n                  exact: true,\n                  explicitUndefined: opts.explicitUndefined,\n                }}\n                inactiveProps={{ class: 'inactive' }}\n              >\n                Index foo=undefined-exact\n              </Link>\n              <Link\n                to=\"/\"\n                search={{ foo: 'bar' }}\n                inactiveProps={{\n                  class: 'inactive',\n                }}\n              >\n                Index foo=bar\n              </Link>\n            </>\n          )\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute]),\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      // round 1\n      const indexExactLink = await screen.findByRole('link', {\n        name: 'Index exact',\n      })\n\n      const indexFooUndefinedLink = await screen.findByRole('link', {\n        name: 'Index foo=undefined',\n      })\n\n      const indexFooUndefinedExactLink = await screen.findByRole('link', {\n        name: 'Index foo=undefined-exact',\n      })\n\n      const indexFooBarLink = await screen.findByRole('link', {\n        name: 'Index foo=bar',\n      })\n\n      expect(window.location.pathname).toBe('/')\n\n      expect(indexExactLink).toHaveClass('active')\n      expect(indexExactLink).not.toHaveClass('inactive')\n      expect(indexExactLink).toHaveAttribute('href', '/')\n      expect(indexExactLink).toHaveAttribute('aria-current', 'page')\n      expect(indexExactLink).toHaveAttribute('data-status', 'active')\n\n      if (opts.explicitUndefined) {\n        expect(indexFooUndefinedLink).toHaveClass('active')\n        expect(indexFooUndefinedLink).not.toHaveClass('inactive')\n        expect(indexFooUndefinedLink).toHaveAttribute('aria-current', 'page')\n        expect(indexFooUndefinedLink).toHaveAttribute('data-status', 'active')\n      } else {\n        expect(indexFooUndefinedLink).toHaveClass('active')\n        expect(indexFooUndefinedLink).not.toHaveClass('inactive')\n        expect(indexFooUndefinedLink).toHaveAttribute('aria-current', 'page')\n        expect(indexFooUndefinedLink).toHaveAttribute('data-status', 'active')\n      }\n\n      expect(indexFooUndefinedLink).toHaveAttribute('href', '/')\n\n      if (opts.explicitUndefined) {\n        expect(indexFooUndefinedExactLink).not.toHaveClass('active')\n        expect(indexFooUndefinedExactLink).toHaveClass('inactive')\n        expect(indexFooUndefinedExactLink).not.toHaveAttribute(\n          'aria-current',\n          'page',\n        )\n        expect(indexFooUndefinedExactLink).not.toHaveAttribute(\n          'data-status',\n          'active',\n        )\n      } else {\n        expect(indexFooUndefinedExactLink).toHaveClass('active')\n        expect(indexFooUndefinedExactLink).not.toHaveClass('inactive')\n        expect(indexFooUndefinedExactLink).toHaveAttribute(\n          'aria-current',\n          'page',\n        )\n        expect(indexFooUndefinedExactLink).toHaveAttribute(\n          'data-status',\n          'active',\n        )\n      }\n\n      expect(indexFooUndefinedExactLink).toHaveAttribute('href', '/')\n\n      expect(indexFooBarLink).toHaveClass('inactive')\n      expect(indexFooBarLink).not.toHaveClass('active')\n      expect(indexFooBarLink).toHaveAttribute('href', '/?foo=bar')\n      expect(indexFooBarLink).not.toHaveAttribute('aria-current', 'page')\n      expect(indexFooBarLink).not.toHaveAttribute('data-status', 'active')\n\n      // navigate to /?foo=bar\n      fireEvent.click(indexFooBarLink)\n\n      await waitFor(() => {\n        expect(indexFooBarLink).toHaveClass('active')\n      })\n\n      expect(indexExactLink).toHaveClass('inactive')\n      expect(indexExactLink).not.toHaveClass('active')\n      expect(indexExactLink).toHaveAttribute('href', '/')\n      expect(indexExactLink).not.toHaveAttribute('aria-current', 'page')\n      expect(indexExactLink).not.toHaveAttribute('data-status', 'active')\n\n      if (opts.explicitUndefined) {\n        expect(indexFooUndefinedLink).not.toHaveClass('active')\n        expect(indexFooUndefinedLink).toHaveClass('inactive')\n        expect(indexFooUndefinedLink).not.toHaveAttribute(\n          'aria-current',\n          'page',\n        )\n        expect(indexFooUndefinedLink).not.toHaveAttribute(\n          'data-status',\n          'active',\n        )\n      } else {\n        expect(indexFooUndefinedLink).toHaveClass('active')\n        expect(indexFooUndefinedLink).not.toHaveClass('inactive')\n        expect(indexFooUndefinedLink).toHaveAttribute('aria-current', 'page')\n        expect(indexFooUndefinedLink).toHaveAttribute('data-status', 'active')\n      }\n\n      expect(indexFooUndefinedLink).toHaveAttribute('href', '/')\n\n      expect(indexFooUndefinedExactLink).toHaveClass('inactive')\n      expect(indexFooUndefinedExactLink).not.toHaveClass('active')\n      expect(indexFooUndefinedExactLink).toHaveAttribute('href', '/')\n      expect(indexFooUndefinedExactLink).not.toHaveAttribute(\n        'aria-current',\n        'page',\n      )\n      expect(indexFooUndefinedExactLink).not.toHaveAttribute(\n        'data-status',\n        'active',\n      )\n\n      expect(indexFooBarLink).toHaveClass('active')\n      expect(indexFooBarLink).not.toHaveClass('inactive')\n      expect(indexFooBarLink).toHaveAttribute('href', '/?foo=bar')\n      expect(indexFooBarLink).toHaveAttribute('aria-current', 'page')\n      expect(indexFooBarLink).toHaveAttribute('data-status', 'active')\n    }\n\n    test.each([undefined, false])(\n      'activeOptions.explicitUndefined=%s',\n      async (explicitUndefined) => {\n        await runTest({ explicitUndefined })\n      },\n    )\n\n    test('activeOptions.explicitUndefined=true', async () => {\n      await runTest({ explicitUndefined: true })\n    })\n  })\n\n  describe('active and href updates', () => {\n    const createControlledPromise = () => {\n      let resolve!: () => void\n      const promise = new Promise<void>((r) => {\n        resolve = r\n      })\n\n      return { promise, resolve }\n    }\n\n    test('always reports external links as inactive', async () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <Link to=\"https://example.com\">\n            {({ isActive }) => (\n              <span data-testid=\"external-link-active\">{String(isActive)}</span>\n            )}\n          </Link>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute]),\n        history,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      expect(\n        await screen.findByTestId('external-link-active'),\n      ).toHaveTextContent('false')\n    })\n\n    test('updates exact and fuzzy active state before the next route renders', async () => {\n      const postLoader = createControlledPromise()\n\n      const rootRoute = createRootRoute({\n        component: () => (\n          <>\n            <Link\n              data-testid=\"posts-exact\"\n              to=\"/posts\"\n              activeOptions={{ exact: true }}\n              activeProps={{ class: 'active' }}\n              inactiveProps={{ class: 'inactive' }}\n            >\n              Posts exact\n            </Link>\n            <Link\n              data-testid=\"posts-fuzzy\"\n              to=\"/posts\"\n              activeProps={{ class: 'active' }}\n              inactiveProps={{ class: 'inactive' }}\n            >\n              Posts fuzzy\n            </Link>\n            <Link\n              data-testid=\"post-exact\"\n              to=\"/posts/$postId\"\n              params={{ postId: '1' }}\n              activeOptions={{ exact: true }}\n              activeProps={{ class: 'active' }}\n              inactiveProps={{ class: 'inactive' }}\n            >\n              Post exact\n            </Link>\n            <Outlet />\n          </>\n        ),\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'posts',\n        component: () => (\n          <>\n            <h1>Posts</h1>\n            <Link\n              data-testid=\"open-post\"\n              to=\"/posts/$postId\"\n              params={{ postId: '1' }}\n            >\n              Open post\n            </Link>\n            <Outlet />\n          </>\n        ),\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        loader: () => postLoader.promise,\n        component: () => <h1>Post detail</h1>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute.addChildren([postRoute])]),\n        history: createMemoryHistory({ initialEntries: ['/posts'] }),\n        defaultPendingMs: 0,\n        defaultPendingComponent: () => <p>Loading...</p>,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const postsExact = await screen.findByTestId('posts-exact')\n      const postsFuzzy = await screen.findByTestId('posts-fuzzy')\n      const postExact = await screen.findByTestId('post-exact')\n\n      expect(postsExact).toHaveClass('active')\n      expect(postsFuzzy).toHaveClass('active')\n      expect(postExact).toHaveClass('inactive')\n\n      fireEvent.click(screen.getByTestId('open-post'))\n\n      expect(await screen.findByText('Loading...')).toBeInTheDocument()\n      expect(screen.queryByText('Post detail')).not.toBeInTheDocument()\n      expect(router.state.location.pathname).toBe('/posts/1')\n      expect(postsExact).toHaveClass('inactive')\n      expect(postsFuzzy).toHaveClass('active')\n      expect(postExact).toHaveClass('active')\n\n      postLoader.resolve()\n\n      expect(await screen.findByText('Post detail')).toBeInTheDocument()\n    })\n\n    test('updates exact active state and href when only params change with params=true', async () => {\n      const postLoader = createControlledPromise()\n      let postLoadCount = 0\n\n      const rootRoute = createRootRoute({\n        component: () => {\n          const params = useParams({ strict: false })\n          const nextPostId = params().postId === '1' ? '2' : '1'\n\n          return (\n            <>\n              <Link\n                data-testid=\"current-post\"\n                from=\"/posts/$postId\"\n                to=\".\"\n                params={true}\n                activeOptions={{ exact: true }}\n                activeProps={{ class: 'active' }}\n                inactiveProps={{ class: 'inactive' }}\n              >\n                Current post\n              </Link>\n              <Link\n                data-testid=\"switch-post\"\n                from=\"/posts/$postId\"\n                to=\".\"\n                params={{ postId: nextPostId }}\n              >\n                Switch post\n              </Link>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts/$postId',\n        loader: () => {\n          postLoadCount += 1\n          return postLoadCount === 1 ? Promise.resolve() : postLoader.promise\n        },\n        component: () => {\n          const params = useParams({ strict: false })\n          return <h1>{`Post ${params().postId}`}</h1>\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postRoute]),\n        history: createMemoryHistory({ initialEntries: ['/posts/1'] }),\n        defaultPendingMs: 0,\n        defaultPendingComponent: () => <p>Loading...</p>,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const currentPost = await screen.findByTestId('current-post')\n      expect(await screen.findByText('Post 1')).toBeInTheDocument()\n      expect(currentPost).toHaveClass('active')\n      expect(currentPost).toHaveAttribute('href', '/posts/1')\n\n      fireEvent.click(screen.getByTestId('switch-post'))\n\n      expect(await screen.findByText('Loading...')).toBeInTheDocument()\n      expect(screen.queryByText('Post 2')).not.toBeInTheDocument()\n      expect(router.state.location.pathname).toBe('/posts/2')\n      expect(currentPost).toHaveClass('active')\n\n      await waitFor(() => {\n        expect(currentPost).toHaveAttribute('href', '/posts/2')\n      })\n\n      postLoader.resolve()\n\n      expect(await screen.findByText('Post 2')).toBeInTheDocument()\n    })\n\n    test('updates search-sensitive active state immediately with and without search=true', async () => {\n      const postsLoader = createControlledPromise()\n      let postsLoadCount = 0\n\n      const rootRoute = createRootRoute({\n        component: () => {\n          const search = useSearch({ strict: false })\n          const nextPage = Number(search().page ?? 1) === 1 ? 2 : 1\n\n          return (\n            <>\n              <Link\n                data-testid=\"static-search\"\n                to=\"/posts\"\n                search={{ page: 1 }}\n                activeOptions={{ exact: true, includeSearch: true }}\n                activeProps={{ class: 'active' }}\n                inactiveProps={{ class: 'inactive' }}\n              >\n                Static search\n              </Link>\n              <Link\n                data-testid=\"current-search\"\n                to=\"/posts\"\n                search={true}\n                activeOptions={{ exact: true, includeSearch: true }}\n                activeProps={{ class: 'active' }}\n                inactiveProps={{ class: 'inactive' }}\n              >\n                Current search\n              </Link>\n              <Link\n                data-testid=\"switch-search\"\n                from=\"/posts\"\n                to=\".\"\n                search={{ page: nextPage }}\n              >\n                Switch search\n              </Link>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts',\n        validateSearch: (input: Record<string, unknown>) => ({\n          page: Number(input.page ?? 1),\n        }),\n        loaderDeps: ({ search }) => ({ page: search.page }),\n        loader: () => {\n          postsLoadCount += 1\n          return postsLoadCount === 1 ? Promise.resolve() : postsLoader.promise\n        },\n        component: () => {\n          const search = useSearch({ strict: false })\n          return <h1>{`Posts ${search().page}`}</h1>\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n        history: createMemoryHistory({ initialEntries: ['/posts?page=1'] }),\n        defaultPendingMs: 0,\n        defaultPendingComponent: () => <p>Loading...</p>,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const staticSearch = await screen.findByTestId('static-search')\n      const currentSearch = await screen.findByTestId('current-search')\n\n      expect(await screen.findByText('Posts 1')).toBeInTheDocument()\n      expect(staticSearch).toHaveClass('active')\n      expect(currentSearch).toHaveClass('active')\n      expect(currentSearch).toHaveAttribute('href', '/posts?page=1')\n\n      fireEvent.click(screen.getByTestId('switch-search'))\n\n      expect(await screen.findByText('Loading...')).toBeInTheDocument()\n      expect(screen.queryByText('Posts 2')).not.toBeInTheDocument()\n      expect(router.state.location.search).toEqual({ page: 2 })\n      expect(staticSearch).toHaveClass('inactive')\n      expect(currentSearch).toHaveClass('active')\n\n      await waitFor(() => {\n        expect(currentSearch).toHaveAttribute('href', '/posts?page=2')\n      })\n\n      postsLoader.resolve()\n\n      expect(await screen.findByText('Posts 2')).toBeInTheDocument()\n    })\n\n    test('updates hash-sensitive active state immediately with and without hash=true', async () => {\n      const rootRoute = createRootRoute({\n        component: () => (\n          <>\n            <Link\n              data-testid=\"static-hash\"\n              to=\"/posts\"\n              hash=\"first\"\n              activeOptions={{ exact: true, includeHash: true }}\n              activeProps={{ class: 'active' }}\n              inactiveProps={{ class: 'inactive' }}\n            >\n              Static hash\n            </Link>\n            <Link\n              data-testid=\"current-hash\"\n              to=\"/posts\"\n              hash={true}\n              activeOptions={{ exact: true, includeHash: true }}\n              activeProps={{ class: 'active' }}\n              inactiveProps={{ class: 'inactive' }}\n            >\n              Current hash\n            </Link>\n            <Link data-testid=\"switch-hash\" from=\"/posts\" to=\".\" hash=\"second\">\n              Switch hash\n            </Link>\n            <Outlet />\n          </>\n        ),\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts',\n        component: () => <h1>Posts</h1>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([postsRoute]),\n        history: createMemoryHistory({ initialEntries: ['/posts#first'] }),\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const staticHash = await screen.findByTestId('static-hash')\n      const currentHash = await screen.findByTestId('current-hash')\n\n      expect(staticHash).toHaveClass('active')\n      expect(currentHash).toHaveClass('active')\n      expect(currentHash).toHaveAttribute('href', '/posts#first')\n\n      await fireEvent.click(screen.getByTestId('switch-hash'))\n\n      expect(router.state.location.hash).toBe('second')\n      expect(staticHash).toHaveClass('inactive')\n      expect(currentHash).toHaveClass('active')\n\n      await waitFor(() => {\n        expect(currentHash).toHaveAttribute('href', '/posts#second')\n      })\n    })\n\n    test('eventually updates relative hrefs when the current route changes', async () => {\n      const rootRoute = createRootRoute({\n        component: () => (\n          <>\n            <Link data-testid=\"relative-foo\" to=\"./foo\">\n              Relative foo\n            </Link>\n            <Link data-testid=\"to-posts\" to=\"/posts\">\n              To posts\n            </Link>\n            <Link data-testid=\"to-invoices\" to=\"/invoices\">\n              To invoices\n            </Link>\n            <Outlet />\n          </>\n        ),\n      })\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/posts',\n        component: () => <h1>Posts</h1>,\n      })\n\n      const postsFooRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: 'foo',\n        component: () => <h1>Posts foo</h1>,\n      })\n\n      const invoicesRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/invoices',\n        component: () => <h1>Invoices</h1>,\n      })\n\n      const invoicesFooRoute = createRoute({\n        getParentRoute: () => invoicesRoute,\n        path: 'foo',\n        component: () => <h1>Invoices foo</h1>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          postsRoute.addChildren([postsFooRoute]),\n          invoicesRoute.addChildren([invoicesFooRoute]),\n        ]),\n        history: createMemoryHistory({ initialEntries: ['/posts'] }),\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const relativeFoo = await screen.findByTestId('relative-foo')\n      expect(await screen.findByText('Posts')).toBeInTheDocument()\n      expect(relativeFoo).toHaveAttribute('href', '/posts/foo')\n\n      fireEvent.click(screen.getByTestId('to-invoices'))\n\n      expect(await screen.findByText('Invoices')).toBeInTheDocument()\n\n      await waitFor(() => {\n        expect(relativeFoo).toHaveAttribute('href', '/invoices/foo')\n      })\n    })\n  })\n\n  test('when the current route is the root with beforeLoad that throws', async () => {\n    const onError = vi.fn()\n    const rootRoute = createRootRoute({\n      onError,\n      beforeLoad: () => {\n        throw new Error('Something went wrong!')\n      },\n      errorComponent: () => <span>Oops! Something went wrong!</span>,\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/\" activeProps={{ class: 'active' }}>\n              Index\n            </Link>\n            <Link to=\"/posts\" inactiveProps={{ class: 'inactive' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return <h1>Posts</h1>\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const errorText = await screen.findByText('Oops! Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n    expect(onError).toHaveBeenCalledOnce()\n  })\n\n  test('when navigating to /posts', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/\">Index</Link>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n            <Link to=\"/\">Index</Link>\n            <Link to=\"/posts\" activeProps={{ class: 'active' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    fireEvent.click(postsLink)\n\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    const indexLink = await screen.findByRole('link', { name: 'Index' })\n\n    expect(window.location.pathname).toBe('/posts')\n    expect(indexLink).not.toHaveAttribute('aria-current', 'page')\n    expect(indexLink).not.toHaveAttribute('data-status', 'active')\n    expect(indexLink).toHaveAttribute('href', '/')\n\n    expect(postsLink).toHaveAttribute('data-status', 'active')\n    expect(postsLink).toHaveAttribute('aria-current', 'page')\n    expect(postsLink).toHaveClass('active')\n    expect(postsLink).toHaveAttribute('href', '/posts')\n  })\n\n  test('when navigating to /posts with a base url', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/\">Index</Link>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n            <Link to=\"/\">Index</Link>\n            <Link to=\"/posts\" activeProps={{ class: 'active' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      basepath: '/app',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    fireEvent.click(postsLink)\n\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n\n    const indexLink = await screen.findByRole('link', { name: 'Index' })\n\n    expect(window.location.pathname).toBe('/app/posts')\n    expect(indexLink).not.toHaveAttribute('aria-current', 'page')\n    expect(indexLink).not.toHaveAttribute('data-status', 'active')\n    expect(indexLink).toHaveAttribute('href', '/app/')\n\n    expect(postsLink).toHaveAttribute('data-status', 'active')\n    expect(postsLink).toHaveAttribute('aria-current', 'page')\n    expect(postsLink).toHaveClass('active')\n    expect(postsLink).toHaveAttribute('href', '/app/posts')\n  })\n\n  test('when navigating to /posts with search', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 0 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const search = useSearch({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>Page: {search().page}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        return {\n          page: input.page,\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts?page=0')\n\n    fireEvent.click(postsLink)\n\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n    expect(window.location.search).toBe('?page=0')\n\n    const pageZero = await screen.findByText('Page: 0')\n    expect(pageZero).toBeInTheDocument()\n  })\n\n  test('when navigation to . from /posts while updating search from /', async () => {\n    const RootComponent = () => {\n      return (\n        <>\n          <div data-testid=\"root-nav\">\n            <Link\n              to=\".\"\n              search={{ page: 2, filter: 'inactive' }}\n              data-testid=\"update-search\"\n            >\n              Update Search\n            </Link>\n          </div>\n          <Outlet />\n        </>\n      )\n    }\n\n    const rootRoute = createRootRoute({\n      component: RootComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link\n              to=\"/posts\"\n              search={{ page: 1, filter: 'active' }}\n              data-testid=\"to-posts\"\n            >\n              Go to Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const search = useSearch({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span data-testid=\"current-page\">Page: {search().page}</span>\n          <span data-testid=\"current-filter\">Filter: {search().filter}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        return {\n          page: input.page ? Number(input.page) : 1,\n          filter: (input.filter as string) || 'all',\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    // Start at index page\n    const toPostsLink = await screen.findByTestId('to-posts')\n    expect(toPostsLink).toHaveAttribute('href', '/posts?page=1&filter=active')\n\n    // Navigate to posts with initial search params\n    fireEvent.click(toPostsLink)\n\n    // Verify we're on posts with initial search\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n    expect(window.location.pathname).toBe('/posts')\n    expect(window.location.search).toBe('?page=1&filter=active')\n\n    const currentPage = await screen.findByTestId('current-page')\n    const currentFilter = await screen.findByTestId('current-filter')\n    expect(currentPage).toHaveTextContent('Page: 1')\n    expect(currentFilter).toHaveTextContent('Filter: active')\n\n    // Navigate to current route (.) with updated search\n    const updateSearchLink = await screen.findByTestId('update-search')\n    expect(updateSearchLink).toHaveAttribute(\n      'href',\n      '/posts?page=2&filter=inactive',\n    )\n\n    fireEvent.click(updateSearchLink)\n\n    // Wait for navigation to complete and search params to update\n    await waitFor(() => {\n      expect(window.location.search).toBe('?page=2&filter=inactive')\n    })\n\n    const updatedPage = await screen.findByTestId('current-page')\n    const updatedFilter = await screen.findByTestId('current-filter')\n\n    // Verify search was updated\n    // Wait for navigation to complete and search params to update\n    await waitFor(() => {\n      expect(window.location.pathname).toBe('/posts')\n      expect(window.location.search).toBe('?page=2&filter=inactive')\n    })\n\n    expect(updatedPage).toHaveTextContent('Page: 2')\n    expect(updatedFilter).toHaveTextContent('Filter: inactive')\n  })\n\n  test('when navigation to . from /posts while updating search from / and using base path', async () => {\n    const RootComponent = () => {\n      return (\n        <>\n          <div data-testid=\"root-nav\">\n            <Link\n              to=\".\"\n              search={{ page: 2, filter: 'inactive' }}\n              data-testid=\"update-search\"\n            >\n              Update Search\n            </Link>\n          </div>\n          <Outlet />\n        </>\n      )\n    }\n\n    const rootRoute = createRootRoute({\n      component: RootComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link\n              to=\"/posts\"\n              search={{ page: 1, filter: 'active' }}\n              data-testid=\"to-posts\"\n            >\n              Go to Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const search = useSearch({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span data-testid=\"current-page\">Page: {search().page}</span>\n          <span data-testid=\"current-filter\">Filter: {search().filter}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        return {\n          page: input.page ? Number(input.page) : 1,\n          filter: (input.filter as string) || 'all',\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history,\n    })\n\n    render(() => <RouterProvider router={router} basepath={'/Dashboard'} />)\n\n    // Start at index page\n    const toPostsLink = await screen.findByTestId('to-posts')\n    expect(toPostsLink).toHaveAttribute(\n      'href',\n      '/Dashboard/posts?page=1&filter=active',\n    )\n\n    // Navigate to posts with initial search params\n    fireEvent.click(toPostsLink)\n\n    // Verify we're on posts with initial search\n    const postsHeading = await screen.findByRole('heading', { name: 'Posts' })\n    expect(postsHeading).toBeInTheDocument()\n    expect(window.location.pathname).toBe('/Dashboard/posts')\n    expect(window.location.search).toBe('?page=1&filter=active')\n\n    const currentPage = await screen.findByTestId('current-page')\n    const currentFilter = await screen.findByTestId('current-filter')\n    expect(currentPage).toHaveTextContent('Page: 1')\n    expect(currentFilter).toHaveTextContent('Filter: active')\n\n    // Navigate to current route (.) with updated search\n    const updateSearchLink = await screen.findByTestId('update-search')\n\n    expect(updateSearchLink).toHaveAttribute(\n      'href',\n      '/Dashboard/posts?page=2&filter=inactive',\n    )\n\n    await fireEvent.click(updateSearchLink)\n\n    // Wait for navigation to complete and search params to update\n    await waitFor(() => {\n      expect(window.location.search).toBe('?page=2&filter=inactive')\n    })\n\n    await screen.findByTestId('current-page')\n    // Verify search was updated\n    expect(window.location.pathname).toBe('/Dashboard/posts')\n    expect(window.location.search).toBe('?page=2&filter=inactive')\n\n    const updatedPage = await screen.findByTestId('current-page')\n    const updatedFilter = await screen.findByTestId('current-filter')\n    expect(updatedPage).toHaveTextContent('Page: 2')\n    expect(updatedFilter).toHaveTextContent('Filter: inactive')\n  })\n\n  test('when navigating to /posts with invalid search', async () => {\n    const rootRoute = createRootRoute()\n    const onError = vi.fn()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 'invalid' }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const search = useSearch({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>Page: {search().page}</span>\n        </>\n      )\n    }\n\n    const ErrorComponent = () => {\n      return <h1>Oops, something went wrong</h1>\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      errorComponent: ErrorComponent,\n      onError,\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n\n        if (isNaN(page)) throw Error('Not a number!')\n\n        return {\n          page,\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts?page=invalid')\n\n    fireEvent.click(postsLink)\n\n    await waitFor(() => expect(onError).toHaveBeenCalledOnce())\n\n    const errorHeading = await screen.findByRole('heading', {\n      name: 'Oops, something went wrong',\n    })\n    expect(errorHeading).toBeInTheDocument()\n  })\n\n  test('when navigating to /posts with a loader', async () => {\n    const loader = vi.fn((opts) => {\n      return Promise.resolve({ pageDoubled: opts.deps.page.page * 2 })\n    })\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 2 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const data = useLoaderData({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>Page: {data().pageDoubled}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n\n        if (isNaN(page)) throw Error('Not a number!')\n\n        return {\n          page,\n        }\n      },\n      loaderDeps: (opts) => ({ page: opts.search }),\n      loader: loader,\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts?page=2')\n\n    fireEvent.click(postsLink)\n\n    const pageFour = await screen.findByText('Page: 4')\n    expect(pageFour).toBeInTheDocument()\n\n    expect(loader).toHaveBeenCalledOnce()\n  })\n\n  test('when navigating to /posts with a loader that errors', async () => {\n    const onError = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 2 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const loader = useLoaderData({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>Page: {loader().pageDoubled}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n\n        if (isNaN(page)) throw Error('Not a number!')\n\n        return {\n          page,\n        }\n      },\n      loaderDeps: (opts) => ({ page: opts.search }),\n      onError,\n      errorComponent: () => <span>Something went wrong!</span>,\n      loader: () => {\n        throw new Error()\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts?page=2')\n\n    fireEvent.click(postsLink)\n\n    const errorText = await screen.findByText('Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n\n    expect(onError).toHaveBeenCalledOnce()\n  })\n\n  test('when navigating away from a route with a loader that errors', async () => {\n    const postsOnError = vi.fn()\n    const indexOnError = vi.fn()\n    const rootRoute = createRootRoute({\n      component: () => (\n        <>\n          <div>\n            <Link to=\"/\">Index</Link> <Link to=\"/posts\">Posts</Link>\n          </div>\n          <hr />\n          <Outlet />\n        </>\n      ),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n          </>\n        )\n      },\n      onError: indexOnError,\n      errorComponent: () => <span>IndexError</span>,\n    })\n\n    const error = new Error('Something went wrong!')\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      loaderDeps: (opts) => ({ page: opts.search }),\n      loader: () => {\n        throw error\n      },\n      onError: postsOnError,\n      errorComponent: () => <span>PostsError</span>,\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    fireEvent.click(postsLink)\n\n    await sleep(WAIT_TIME)\n\n    const postsErrorText = await screen.findByText('PostsError')\n    expect(postsErrorText).toBeInTheDocument()\n\n    expect(postsOnError).toHaveBeenCalledOnce()\n    expect(postsOnError).toHaveBeenCalledWith(error)\n\n    const indexLink = await screen.findByRole('link', { name: 'Index' })\n    fireEvent.click(indexLink)\n    await sleep(WAIT_TIME)\n    await expect(screen.findByText('IndexError')).rejects.toThrow()\n    expect(indexOnError).not.toHaveBeenCalledOnce()\n  })\n\n  test('when navigating to /posts with a beforeLoad that redirects', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={{ page: 2 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return <h1>Posts</h1>\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      beforeLoad: () => {\n        throw redirect({\n          to: '/login',\n        })\n      },\n      component: PostsComponent,\n    })\n\n    const authRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: () => <h1>Auth!</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute, authRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    fireEvent.click(postsLink)\n\n    const authText = await screen.findByText('Auth!')\n    expect(authText).toBeInTheDocument()\n  })\n\n  test('when navigating to /posts with a beforeLoad that returns context', async () => {\n    const rootRoute = createRootRouteWithContext<{\n      userId: string\n    }>()()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const context = useRouteContext({ strict: false })\n      return (\n        <>\n          <h1>Posts</h1>\n          <span>UserId: {context().userId}</span>\n          <span>Username: {context().username}</span>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      beforeLoad: () => {\n        return Promise.resolve({\n          username: 'username',\n        })\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      context: { userId: 'userId' },\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    fireEvent.click(postsLink)\n\n    const userId = await screen.findByText('UserId: userId')\n    expect(userId).toBeInTheDocument()\n  })\n\n  test('when navigating to /posts with a beforeLoad that throws an error', async () => {\n    const onError = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return <h1>Posts</h1>\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      beforeLoad: () => {\n        throw new Error('Oops. Something went wrong!')\n      },\n      onError,\n      errorComponent: () => <span>Oops! Something went wrong!</span>,\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      context: { userId: 'userId' },\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    fireEvent.click(postsLink)\n\n    const errorText = await screen.findByText('Oops! Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n\n    expect(onError).toHaveBeenCalledOnce()\n  })\n\n  test('when navigating to /posts with a beforeLoad that throws an error bubbles to the root', async () => {\n    const rootRoute = createRootRoute({\n      errorComponent: () => <span>Oops! Something went wrong!</span>,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return <h1>Posts</h1>\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      beforeLoad: () => {\n        throw new Error('Oops. Something went wrong!')\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      context: { userId: 'userId' },\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    fireEvent.click(postsLink)\n\n    const errorText = await screen.findByText('Oops! Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n  })\n\n  test('when navigating to /posts with a beforeLoad that throws an error bubbles to the nearest parent', async () => {\n    const rootRoute = createRootRoute({\n      errorComponent: () => <span>Root error</span>,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              Post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      errorComponent: () => <span>Oops! Something went wrong!</span>,\n      component: PostsComponent,\n    })\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      beforeLoad: () => {\n        throw new Error('Oops. Something went wrong!')\n      },\n    })\n\n    const router = createRouter({\n      context: { userId: 'userId' },\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postRoute]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', { name: 'Post' })\n\n    fireEvent.click(postLink)\n\n    const errorText = await screen.findByText('Oops! Something went wrong!')\n    expect(errorText).toBeInTheDocument()\n  })\n\n  test('when navigating to the root with an error in component', async () => {\n    const notFoundComponent = vi.fn()\n\n    const rootRoute = createRootRoute({\n      errorComponent: () => <span>Expected rendering error message</span>,\n      notFoundComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        throw new Error(\n          'Error from component should not render notFoundComponent',\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const errorText = await screen.findByText(\n      'Expected rendering error message',\n    )\n    expect(errorText).toBeInTheDocument()\n    expect(notFoundComponent).not.toBeCalled()\n  })\n\n  test('when navigating to /posts with params', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link\n              to=\"/posts/$postId\"\n              params={{ postId: 'id1' }}\n              preloadDelay={0}\n            >\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Link to=\"/\">Index</Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return <span>Params: {params().postId}</span>\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postRoute]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.click(postLink)\n\n    const paramText = await screen.findByText('Params: id1')\n    expect(paramText).toBeInTheDocument()\n  })\n\n  test('keeps a relative link active when changing inherited params (issue #5655)', async () => {\n    const rootRoute = createRootRoute()\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/post/$postId',\n      component: () => {\n        const params = useParams({ strict: false })\n        const postId = () => params().postId\n\n        return (\n          <>\n            <Link\n              data-testid=\"step1-link\"\n              from=\"/post/$postId\"\n              to=\"step1\"\n              activeProps={{ class: 'active' }}\n            >\n              Step 1\n            </Link>\n            <Link\n              data-testid=\"step2-link\"\n              from=\"/post/$postId\"\n              to=\"step2\"\n              params={{ postId: postId() }}\n              activeProps={{ class: 'active' }}\n            >\n              Step 2\n            </Link>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const step1Route = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'step1',\n      component: () => {\n        const params = useParams({ strict: false })\n        const postId = () => params().postId\n        const otherPostId = () => (postId() === '1' ? '2' : '1')\n\n        return (\n          <>\n            <span>{`Post ${postId()} step1`}</span>\n            <Link\n              data-testid=\"switch-post-link\"\n              from=\"/post/$postId/step1\"\n              to=\".\"\n              params={{ postId: otherPostId() }}\n            >{`Go to post ${otherPostId()}`}</Link>\n          </>\n        )\n      },\n    })\n\n    const step2Route = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'step2',\n      component: () => {\n        const params = useParams({ strict: false })\n        const postId = () => params().postId\n        const otherPostId = () => (postId() === '1' ? '2' : '1')\n\n        return (\n          <>\n            <span>{`Post ${postId()} step2`}</span>\n            <Link\n              data-testid=\"switch-post-link\"\n              from=\"/post/$postId/step2\"\n              to=\".\"\n              params={{ postId: otherPostId() }}\n            >{`Go to post ${otherPostId()}`}</Link>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        postRoute.addChildren([step1Route, step2Route]),\n      ]),\n      history: createMemoryHistory({\n        initialEntries: ['/post/1/step1'],\n      }),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    expect(await screen.findByText('Post 1 step1')).toBeInTheDocument()\n    expect(screen.getByTestId('step1-link')).toHaveClass('active')\n\n    fireEvent.click(screen.getByTestId('switch-post-link'))\n\n    expect(await screen.findByText('Post 2 step1')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/post/2/step1')\n    expect(screen.getByTestId('step1-link')).toHaveClass('active')\n\n    fireEvent.click(screen.getByTestId('step2-link'))\n\n    expect(await screen.findByText('Post 2 step2')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/post/2/step2')\n    expect(screen.getByTestId('step2-link')).toHaveClass('active')\n\n    fireEvent.click(screen.getByTestId('switch-post-link'))\n\n    expect(await screen.findByText('Post 1 step2')).toBeInTheDocument()\n    expect(router.state.location.pathname).toBe('/post/1/step2')\n    expect(screen.getByTestId('step2-link')).toHaveClass('active')\n  })\n\n  test('when navigating from /posts to ./$postId', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostsIndexComponent = () => {\n      return (\n        <>\n          <h1>Posts Index</h1>\n          <Link from=\"/posts/\" to=\"./$postId\" params={{ postId: 'id1' }}>\n            To the first post\n          </Link>\n        </>\n      )\n    }\n\n    const postsIndexRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '/',\n      component: PostsIndexComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Link to=\"/\">Index</Link>\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postsIndexRoute, postRoute]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts')\n\n    fireEvent.click(postsLink)\n\n    const postsText = await screen.findByText('Posts Index')\n    expect(postsText).toBeInTheDocument()\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To the first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.click(postLink)\n\n    const paramText = await screen.findByText('Params: id1')\n    expect(paramText).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts/id1')\n  })\n\n  test('when navigating from /posts/$postId to \"/\"', async () => {\n    const rootRoute = createRootRoute({\n      component: () => {\n        return (\n          <>\n            <Link to=\"/\" data-testid=\"home-link\">\n              Home\n            </Link>\n            <Link to=\"/posts\" data-testid=\"posts-link\">\n              Posts\n            </Link>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1 data-testid=\"home-heading\">Index</h1>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Link\n            to=\"/posts/$postId\"\n            params={{ postId: 'id1' }}\n            data-testid=\"post1-link\"\n          >\n            To first post\n          </Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostsIndexComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"posts-index-heading\">Posts Index</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsIndexRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '/',\n      component: PostsIndexComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span data-testid=\"post-param\">Params: {params().postId}</span>\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postsIndexRoute, postRoute]),\n      ]),\n      history,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByTestId('posts-link')\n\n    expect(postsLink).toHaveAttribute('href', '/posts')\n\n    fireEvent.click(postsLink)\n\n    const postsText = await screen.findByTestId('posts-index-heading')\n    expect(postsText).toBeInTheDocument()\n\n    const postLink = await screen.findByTestId('post1-link')\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.click(postLink)\n\n    const paramText = await screen.findByTestId('post-param')\n    expect(paramText).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts/id1')\n\n    const homeLink = await screen.findByTestId('home-link')\n\n    const consoleWarnSpy = vi.spyOn(console, 'warn')\n\n    fireEvent.click(homeLink)\n\n    const homeHeading = await screen.findByTestId('home-heading')\n\n    expect(window.location.pathname).toBe('/')\n    expect(homeHeading).toBeInTheDocument()\n\n    expect(consoleWarnSpy).not.toHaveBeenCalled()\n\n    consoleWarnSpy.mockRestore()\n  })\n\n  test('when navigating from /posts to ../posts/$postId', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostsIndexComponent = () => {\n      return (\n        <>\n          <h1>Posts Index</h1>\n          <Link from=\"/posts/\" to=\"../posts/$postId\" params={{ postId: 'id1' }}>\n            To the first post\n          </Link>\n        </>\n      )\n    }\n\n    const postsIndexRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '/',\n      component: PostsIndexComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Link to=\"/\">Index</Link>\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postsIndexRoute, postRoute]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts')\n\n    fireEvent.click(postsLink)\n\n    const postsIndexText = await screen.findByText('Posts Index')\n    expect(postsIndexText).toBeInTheDocument()\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To the first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.click(postLink)\n\n    const paramText = await screen.findByText('Params: id1')\n    expect(paramText).toBeInTheDocument()\n  })\n\n  test('when navigating from /posts/$postId to /posts/$postId/info and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"/posts/$postId/info\">\n            To Information\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    fireEvent.click(postsLink)\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To Information',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1/info')\n\n    fireEvent.click(informationLink)\n\n    const informationText = await screen.findByText('Information')\n    expect(informationText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/info')\n\n    const paramsText2 = await screen.findByText('Params: id1')\n    expect(paramsText2).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId with a trailing slash to /posts/$postId/info and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const postIndexRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: '/',\n      component: () => <div>Post Index</div>,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"/posts/$postId/info\">\n            To Information\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([\n              postIndexRoute,\n              detailsRoute,\n              informationRoute,\n            ]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    fireEvent.click(postsLink)\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To Information',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1/info')\n\n    fireEvent.click(informationLink)\n\n    const informationText = await screen.findByText('Information')\n    expect(informationText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/info')\n\n    const paramsText2 = await screen.findByText('Params: id1')\n    expect(paramsText2).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /dashboard/posts/$postId to /dashboard/users', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/dashboard\" data-testid=\"dashboard-link\">\n              dashboard\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const dashboardRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'dashboard',\n      component: () => {\n        return (\n          <>\n            <h1 data-testid=\"dashboard-heading\">dashboard</h1>\n            <Link to=\"/dashboard/posts\" data-testid=\"posts-link\">\n              posts\n            </Link>\n            <Link to=\"/dashboard/users\" data-testid=\"users-link\">\n              users\n            </Link>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"posts-heading\">Posts</h1>\n          <Link\n            to=\"/dashboard/posts/$postid\"\n            data-testid=\"post1-link\"\n            params={{ postid: 'id1' }}\n          >\n            Post1\n          </Link>\n          <Link\n            to=\"/dashboard/posts/$postid\"\n            data-testid=\"post2-link\"\n            params={{ postid: 'id2' }}\n          >\n            Post2\n          </Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const UsersComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"users-heading\">Users</h1>\n          <Link\n            to=\"/dashboard/users/$userid\"\n            data-testid=\"user1-link\"\n            params={{ userid: 'id1' }}\n          >\n            User1\n          </Link>\n          <Link\n            to=\"/dashboard/users/$userid\"\n            data-testid=\"user2-link\"\n            params={{ userid: 'id2' }}\n          >\n            User2\n          </Link>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => dashboardRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const usersRoute = createRoute({\n      getParentRoute: () => dashboardRoute,\n      path: 'users',\n      component: UsersComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span data-testid=\"post-component\">Params: {params().postId}</span>\n        </>\n      )\n    }\n\n    const UserComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span data-testid=\"user-component\">Params: {params().userId}</span>\n        </>\n      )\n    }\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postid',\n      component: PostComponent,\n    })\n\n    const userRoute = createRoute({\n      getParentRoute: () => usersRoute,\n      path: '$userid',\n      component: UserComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        dashboardRoute.addChildren([\n          postsRoute.addChildren([postRoute]),\n          usersRoute.addChildren([userRoute]),\n        ]),\n      ]),\n      history,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const dashboardLink = await screen.findByTestId('dashboard-link')\n\n    fireEvent.click(dashboardLink)\n\n    const dashboardHeading = await screen.findByTestId('dashboard-heading')\n\n    expect(dashboardHeading).toBeInTheDocument()\n\n    const postsLink = await screen.findByTestId('posts-link')\n    fireEvent.click(postsLink)\n\n    const postsHeading = await screen.findByTestId('posts-heading')\n\n    expect(window.location.pathname).toEqual('/dashboard/posts')\n    expect(postsHeading).toBeInTheDocument()\n\n    const post1Link = await screen.findByTestId('post1-link')\n    fireEvent.click(post1Link)\n    const post1Heading = await screen.findByTestId('post-component')\n\n    expect(window.location.pathname).toEqual('/dashboard/posts/id1')\n    expect(post1Heading).toBeInTheDocument()\n\n    const consoleWarnSpy = vi.spyOn(console, 'warn')\n\n    const usersLink = await screen.findByTestId('users-link')\n    fireEvent.click(usersLink)\n\n    const usersHeading = await screen.findByTestId('users-heading')\n\n    expect(window.location.pathname).toEqual('/dashboard/users')\n    expect(usersHeading).toBeInTheDocument()\n\n    const user1Link = await screen.findByTestId('user1-link')\n    fireEvent.click(user1Link)\n    const user1Heading = await screen.findByTestId('user-component')\n\n    expect(window.location.pathname).toEqual('/dashboard/users/id1')\n    expect(user1Heading).toBeInTheDocument()\n\n    expect(consoleWarnSpy).not.toHaveBeenCalled()\n\n    consoleWarnSpy.mockRestore()\n  })\n\n  test('when navigating from /posts/$postId to ./info and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"./info\">\n            To Information\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    fireEvent.click(postsLink)\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To Information',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1/info')\n\n    fireEvent.click(informationLink)\n\n    const informationText = await screen.findByText('Information')\n    expect(informationText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/info')\n\n    const paramsText2 = await screen.findByText('Params: id1')\n    expect(paramsText2).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId to / and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"/\">\n            To Root\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([postRoute.addChildren([detailsRoute])]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    fireEvent.click(postsLink)\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const rootLink = await screen.findByRole('link', {\n      name: 'To Root',\n    })\n\n    expect(rootLink).toHaveAttribute('href', '/')\n\n    fireEvent.click(rootLink)\n\n    const indexText = await screen.findByText('Index')\n    expect(indexText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId with search and to ./info with search and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link\n              to=\"/posts/$postId/details\"\n              params={{ postId: 'id1' }}\n              search={{ page: 2 }}\n            >\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n      validateSearch: () => ({ page: 2 }),\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link\n            from=\"/posts/$postId\"\n            to=\"./info\"\n            search={(prev: any): any => ({ ...prev, more: true })}\n          >\n            To Information\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n      validateSearch: () => ({ more: false }),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details?page=2')\n\n    fireEvent.click(postsLink)\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To Information',\n    })\n\n    expect(informationLink).toHaveAttribute(\n      'href',\n      '/posts/id1/info?page=2&more=true',\n    )\n\n    fireEvent.click(informationLink)\n\n    const informationText = await screen.findByText('Information')\n    expect(informationText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/info')\n\n    const paramsText2 = await screen.findByText('Params: id1')\n    expect(paramsText2).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId to ../$postId and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"../$postId\">\n            To Post\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    fireEvent.click(postsLink)\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To Post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.click(postLink)\n\n    const postsText = await screen.findByText('Posts')\n    expect(postsText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts/$postId with an index to ../$postId and the current route is /posts/$postId/details', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const postIndexRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: '/',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link from=\"/posts/$postId\" to=\"../$postId\">\n            To Post\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([\n              postIndexRoute,\n              detailsRoute,\n              informationRoute,\n            ]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    fireEvent.click(postsLink)\n\n    const paramsText1 = await screen.findByText('Params: id1')\n    expect(paramsText1).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To Post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.click(postLink)\n\n    const postsText = await screen.findByText('Posts')\n    expect(postsText).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /invoices to ./invoiceId and the current route is /posts/$postId/details', async () => {\n    const rootRoute = createRootRoute({\n      errorComponent: (err) => <div>{err.error.message}</div>,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\">Posts</Link>\n            <Link to=\"/posts/$postId/details\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1>Details!</h1>\n          <Link\n            from=\"/invoices\"\n            to=\"./$invoiceId\"\n            params={{ invoiceId: 'id1' }}\n          >\n            To Invoices\n          </Link>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      component: () => (\n        <>\n          <h1>Invoices!</h1>\n          <Outlet />\n        </>\n      ),\n    })\n\n    const InvoiceComponent = () => {\n      const params = useParams({ strict: false })\n      return <span>invoiceId: {params().invoiceId}</span>\n    }\n\n    const invoiceRoute = createRoute({\n      getParentRoute: () => invoicesRoute,\n      path: '$invoiceId',\n      component: InvoiceComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          invoicesRoute.addChildren([invoiceRoute]),\n          postsRoute.addChildren([\n            postRoute.addChildren([detailsRoute, informationRoute]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'To first post' })\n\n    expect(postsLink).toHaveAttribute('href', '/posts/id1/details')\n\n    fireEvent.click(postsLink)\n  })\n\n  test('when navigating to /posts/$postId/info which is declaratively masked as /posts/$postId', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId/info\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute.addChildren([postRoute.addChildren([informationRoute])]),\n    ])\n\n    const routeMask = createRouteMask({\n      routeTree,\n      from: '/posts/$postId/info',\n      to: '/posts/$postId',\n    })\n\n    const router = createRouter({\n      routeTree,\n      routeMasks: [routeMask],\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating to /posts/$postId/info which is imperatively masked as /posts/$postId', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link\n              to=\"/posts/$postId/info\"\n              params={{ postId: 'id1' }}\n              mask={{ to: '/posts/$postId', params: { postId: 'id1' } }}\n            >\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const InformationComponent = () => {\n      return <h1>Information</h1>\n    }\n\n    const informationRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'info',\n      component: InformationComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute.addChildren([postRoute.addChildren([informationRoute])]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const informationLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(informationLink).toHaveAttribute('href', '/posts/id1')\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when preloading /post/$postId with a redirects to /login', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const loaderFn = vi.fn()\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      loader: () => {\n        loaderFn()\n        throw redirect({\n          to: '/login',\n          search,\n        })\n      },\n    })\n\n    const LoginComponent = () => {\n      const [status, setStatus] = Solid.createSignal<\n        'idle' | 'success' | 'error'\n      >('idle')\n\n      Solid.onMount(() => {\n        const onLoad = async () => {\n          try {\n            await router.preloadRoute({\n              to: '/posts/$postId',\n              params: { postId: 'id1' },\n              search: { postPage: 0 },\n            })\n            setStatus('success')\n          } catch (e) {\n            setStatus('error')\n          }\n        }\n        onLoad()\n      })\n\n      return <>{status() === 'success' ? 'Login!' : 'Waiting...'}</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      defaultPreload: 'intent',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.mouseOver(postLink)\n\n    await waitFor(() => expect(loaderFn).toHaveBeenCalled())\n\n    await waitFor(() => expect(search).toHaveBeenCalledWith({ postPage: 0 }))\n\n    fireEvent.click(postLink)\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating to /post/$postId with a redirect from /post/$postId to ../../login in a loader', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      loader: () => {\n        throw redirect({\n          from: postRoute.fullPath,\n          to: '../../login',\n          search,\n        })\n      },\n    })\n\n    const LoginComponent = () => {\n      return <>Login!</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.click(postLink)\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating to /post/$postId with a redirect from /post/$postId to ../../login in beforeLoad', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      beforeLoad: () => {\n        throw redirect({\n          from: postRoute.fullPath,\n          to: '../../login',\n          search,\n        })\n      },\n    })\n\n    const LoginComponent = () => {\n      return <>Login!</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.click(postLink)\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when preloading /post/$postId with a beforeLoad that navigates to /login', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      beforeLoad: (context) => context.navigate({ to: '/login', search }),\n    })\n\n    const LoginComponent = () => {\n      return <>Login!</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      defaultPreload: 'intent',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.mouseOver(postLink)\n\n    await waitFor(() => expect(search).toHaveBeenCalledWith({ postPage: 0 }))\n\n    fireEvent.click(postLink)\n\n    await sleep(WAIT_TIME)\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when preloading /post/$postId with a loader that navigates to /login', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts/$postId\" params={{ postId: 'id1' }}>\n              To first post\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const search = vi.fn((prev) => ({ page: prev.postPage }))\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n      validateSearch: () => ({ postPage: 0 }),\n      loader: (context) => {\n        context.navigate({ to: '/login', search })\n      },\n    })\n\n    const LoginComponent = () => {\n      return <>Login!</>\n    }\n\n    const loginRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'login',\n      component: LoginComponent,\n      validateSearch: () => ({ page: 0 }),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      loginRoute,\n      postsRoute.addChildren([postRoute]),\n    ])\n\n    const router = createRouter({\n      routeTree,\n      defaultPreload: 'intent',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'To first post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/posts/id1')\n\n    fireEvent.mouseOver(postLink)\n\n    await waitFor(() => expect(search).toHaveBeenCalledWith({ postPage: 0 }))\n\n    fireEvent.click(postLink)\n\n    const loginText = await screen.findByText('Login!')\n    expect(loginText).toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating from /posts to /invoices with conditionally rendering Link on the root', async () => {\n    const ErrorComponent = vi.fn(() => <div>Something went wrong!</div>)\n    const RootComponent = () => {\n      const matchRoute = useMatchRoute()\n      const matchPosts = matchRoute({ to: '/posts' })\n      const matchInvoices = matchRoute({ to: '/invoices' })\n\n      return (\n        <>\n          {Boolean(matchPosts()) && (\n            <Link from=\"/posts\" to=\"/posts\">\n              From posts\n            </Link>\n          )}\n          {Boolean(matchInvoices()) && (\n            <Link from=\"/invoices\" to=\"/invoices\">\n              From invoices\n            </Link>\n          )}\n          <Outlet />\n        </>\n      )\n    }\n\n    const rootRoute = createRootRoute({\n      component: RootComponent,\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index Route</h1>\n          <Link to=\"/posts\">Go to posts</Link>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      component: () => (\n        <>\n          <h1>On Posts</h1>\n          <Link to=\"/invoices\">To invoices</Link>\n        </>\n      ),\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n      component: () => (\n        <>\n          <h1>On Invoices</h1>\n          <Link to=\"/posts\">To posts</Link>\n        </>\n      ),\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      invoicesRoute,\n    ])\n\n    const router = createRouter({\n      routeTree,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Go to posts' })\n\n    fireEvent.click(postsLink)\n\n    const fromPostsLink = await screen.findByRole('link', {\n      name: 'From posts',\n    })\n\n    expect(fromPostsLink).toBeInTheDocument()\n\n    const toInvoicesLink = await screen.findByRole('link', {\n      name: 'To invoices',\n    })\n\n    fireEvent.click(toInvoicesLink)\n\n    const fromInvoicesLink = await screen.findByRole('link', {\n      name: 'From invoices',\n    })\n\n    expect(fromInvoicesLink).toBeInTheDocument()\n\n    expect(fromPostsLink).not.toBeInTheDocument()\n\n    const toPostsLink = await screen.findByRole('link', {\n      name: 'To posts',\n    })\n\n    fireEvent.click(toPostsLink)\n\n    const onPostsText = await screen.findByText('On Posts')\n    expect(onPostsText).toBeInTheDocument()\n\n    expect(fromInvoicesLink).not.toBeInTheDocument()\n\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when linking to self with from prop set and param containing a slash', async () => {\n    const ErrorComponent = vi.fn(() => <h1>Something went wrong!</h1>)\n\n    const rootRoute = createRootRoute({\n      errorComponent: ErrorComponent,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <Link to=\"/$postId\" params={{ postId: 'id/with-slash' }}>\n          Go to post\n        </Link>\n      ),\n    })\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/$postId',\n      component: () => (\n        <Link from=\"/$postId\" to=\"/$postId\">\n          Link to self with from prop set\n        </Link>\n      ),\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, postRoute])\n    const router = createRouter({ routeTree })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'Go to post',\n    })\n\n    expect(postLink).toHaveAttribute('href', '/id%2Fwith-slash')\n\n    fireEvent.click(postLink)\n\n    const selfLink = await screen.findByRole('link', {\n      name: 'Link to self with from prop set',\n    })\n\n    expect(selfLink).toBeInTheDocument()\n    expect(ErrorComponent).not.toHaveBeenCalled()\n  })\n\n  test('when navigating to /$postId with parseParams and stringifyParams', async () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <Link to=\"/$postId\" params={{ postId: 2 }}>\n          Go to post\n        </Link>\n      ),\n    })\n\n    let parseParams: any\n    let stringifyParams: any\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return <div>Post: {params().postId}</div>\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '$postId',\n      parseParams: (params) => {\n        parseParams = structuredClone(params) // clone object, because source will get mutated\n        return {\n          status: 'parsed',\n          postId: params.postId,\n        }\n      },\n      stringifyParams: (params) => {\n        stringifyParams = structuredClone(params) // clone object, because source will get mutated\n        return {\n          status: 'stringified',\n          postId: params.postId,\n        }\n      },\n      component: PostComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, postRoute])\n    const router = createRouter({ routeTree })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'Go to post',\n    })\n\n    expect(stringifyParams).toEqual({ postId: 2 })\n\n    expect(postLink).toHaveAttribute('href', '/2')\n\n    fireEvent.click(postLink)\n\n    const posts2Text = await screen.findByText('Post: 2')\n    expect(posts2Text).toBeInTheDocument()\n\n    expect(parseParams).toEqual({ postId: '2' })\n  })\n\n  test('when navigating to /$postId with params.parse and params.stringify', async () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <Link to=\"/$postId\" params={{ postId: 2 }}>\n          Go to post\n        </Link>\n      ),\n    })\n\n    let parseParams: any\n    let stringifyParams: any\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return <div>Post: {params().postId}</div>\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '$postId',\n      params: {\n        parse: (params) => {\n          parseParams = structuredClone(params) // clone object, because source will get mutated\n          return {\n            status: 'parsed',\n            postId: params.postId,\n          }\n        },\n        stringify: (params) => {\n          stringifyParams = structuredClone(params) // clone object, because source will get mutated\n          return {\n            status: 'stringified',\n            postId: params.postId,\n          }\n        },\n      },\n      component: PostComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, postRoute])\n    const router = createRouter({ routeTree })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink = await screen.findByRole('link', {\n      name: 'Go to post',\n    })\n\n    expect(stringifyParams).toEqual({ postId: 2 })\n\n    expect(postLink).toHaveAttribute('href', '/2')\n\n    fireEvent.click(postLink)\n\n    const posts2Text = await screen.findByText('Post: 2')\n    expect(posts2Text).toBeInTheDocument()\n\n    expect(parseParams).toEqual({ postId: '2' })\n  })\n\n  test('when navigating to /$postId with params.parse and params.stringify handles falsey inputs', async () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <Link to=\"/$postId\" params={{ postId: 2 }}>\n            Go to post 2\n          </Link>\n          <Link to=\"/$postId\" params={{ postId: 0 }}>\n            Go to post 0\n          </Link>\n        </>\n      ),\n    })\n\n    const stringifyParamsMock = vi.fn()\n\n    const parseParams = ({ postId }: { postId: string }) => {\n      return {\n        postId: parseInt(postId),\n      }\n    }\n\n    const stringifyParams = ({ postId }: { postId: number }) => {\n      stringifyParamsMock({ postId })\n      return {\n        postId: postId.toString(),\n      }\n    }\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return <div>Post: {params().postId}</div>\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '$postId',\n      params: {\n        parse: parseParams,\n        stringify: stringifyParams,\n      },\n      component: PostComponent,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, postRoute])\n    const router = createRouter({ routeTree })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postLink2 = await screen.findByRole('link', {\n      name: 'Go to post 2',\n    })\n    const postLink0 = await screen.findByRole('link', {\n      name: 'Go to post 0',\n    })\n\n    expect(postLink2).toHaveAttribute('href', '/2')\n    expect(postLink0).toHaveAttribute('href', '/0')\n\n    expect(stringifyParamsMock).toHaveBeenCalledWith({ postId: 2 })\n    expect(stringifyParamsMock).toHaveBeenCalledWith({ postId: 0 })\n  })\n\n  test.each([false, 'intent', 'render'] as const)(\n    'Router.preload=\"%s\", should not trigger the IntersectionObserver\\'s observe and disconnect methods',\n    async (preload) => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <h1>Index Heading</h1>\n            <Link to=\"/\">Index Link</Link>\n          </>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute]),\n        defaultPreload: preload,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const indexLink = await screen.findByRole('link', { name: 'Index Link' })\n      expect(indexLink).toBeInTheDocument()\n\n      expect(ioObserveMock).not.toBeCalled()\n      expect(ioDisconnectMock).not.toBeCalled()\n    },\n  )\n\n  test.each([false, 'intent', 'viewport', 'render'] as const)(\n    'Router.preload=\"%s\" with Link.preload=\"false\", should not trigger the IntersectionObserver\\'s observe method',\n    async (preload) => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <h1>Index Heading</h1>\n            <Link to=\"/\" preload={false}>\n              Index Link\n            </Link>\n          </>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute]),\n        defaultPreload: preload,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const indexLink = await screen.findByRole('link', { name: 'Index Link' })\n      expect(indexLink).toBeInTheDocument()\n\n      expect(ioObserveMock).not.toBeCalled()\n    },\n  )\n\n  test('Router.preload=\"viewport\", should trigger the IntersectionObserver\\'s observe and disconnect methods', async () => {\n    const rootRoute = createRootRoute()\n    const RouteComponent = () => {\n      const [count, setCount] = Solid.createSignal(0)\n      return (\n        <>\n          <h1>Index Heading</h1>\n          <output>{count()}</output>\n          <button onClick={() => setCount((c) => c + 1)}>Render</button>\n          <Link to=\"/\">Index Link</Link>\n        </>\n      )\n    }\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: RouteComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n      defaultPreload: 'viewport',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexLink = await screen.findByRole('link', { name: 'Index Link' })\n    expect(indexLink).toBeInTheDocument()\n\n    expect(ioObserveMock).toHaveBeenCalledOnce()\n    expect(ioDisconnectMock).not.toHaveBeenCalled()\n\n    const output = screen.getByRole('status')\n    expect(output).toHaveTextContent('0')\n\n    const button = screen.getByRole('button', { name: 'Render' })\n    fireEvent.click(button)\n    await waitFor(() => {\n      expect(output).toHaveTextContent('1')\n    })\n    expect(ioObserveMock).toHaveBeenCalledOnce() // it should not observe again\n    expect(ioDisconnectMock).not.toHaveBeenCalled() // it should not disconnect again\n  })\n\n  test(\"Router.preload='render', should trigger the route loader on render\", async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: () => {\n        mock()\n      },\n      component: () => (\n        <>\n          <h1>Index Heading</h1>\n          <Link to=\"/about\">About Link</Link>\n        </>\n      ),\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => (\n        <>\n          <h1>About Heading</h1>\n        </>\n      ),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([aboutRoute, indexRoute]),\n      defaultPreload: 'render',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const aboutLink = await screen.findByRole('link', { name: 'About Link' })\n    expect(aboutLink).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test.each([undefined, false, 'render', 'viewport'] as const)(\n    'Link.preload=\"%s\" should not preload on focus, hover, or touchstart',\n    async (preloadMode) => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <>\n            <h1>Index Heading</h1>\n            <Link\n              to=\"/about\"\n              {...(preloadMode === undefined ? {} : { preload: preloadMode })}\n            >\n              About Link\n            </Link>\n          </>\n        ),\n      })\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        component: () => <h1>About Heading</h1>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([aboutRoute, indexRoute]),\n        defaultPreload: false,\n        defaultPreloadDelay: 0,\n        history,\n      })\n\n      const preloadRouteSpy = vi.spyOn(router, 'preloadRoute')\n\n      render(() => <RouterProvider router={router} />)\n\n      const aboutLink = await screen.findByRole('link', { name: 'About Link' })\n      expect(aboutLink).toBeInTheDocument()\n\n      if (preloadMode === 'render') {\n        await waitFor(() =>\n          expect(preloadRouteSpy.mock.calls.length).toBeGreaterThan(0),\n        )\n      }\n\n      const baselineCalls = preloadRouteSpy.mock.calls.length\n\n      fireEvent.focus(aboutLink)\n      fireEvent.mouseOver(aboutLink)\n      fireEvent.touchStart(aboutLink)\n\n      await sleep(100)\n      expect(preloadRouteSpy).toHaveBeenCalledTimes(baselineCalls)\n    },\n  )\n\n  test('Link.preload=\"intent\" should preload on focus, hover, and touchstart', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index Heading</h1>\n          <Link to=\"/about\" preload=\"intent\">\n            About Link\n          </Link>\n        </>\n      ),\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <h1>About Heading</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([aboutRoute, indexRoute]),\n      defaultPreload: false,\n      defaultPreloadDelay: 0,\n      history,\n    })\n\n    const preloadRouteSpy = vi.spyOn(router, 'preloadRoute')\n\n    render(() => <RouterProvider router={router} />)\n\n    const aboutLink = await screen.findByRole('link', { name: 'About Link' })\n    expect(aboutLink).toBeInTheDocument()\n\n    const baselineCalls = preloadRouteSpy.mock.calls.length\n\n    fireEvent.focus(aboutLink)\n    await waitFor(() =>\n      expect(preloadRouteSpy).toHaveBeenCalledTimes(baselineCalls + 1),\n    )\n\n    fireEvent.mouseOver(aboutLink)\n    await waitFor(() =>\n      expect(preloadRouteSpy).toHaveBeenCalledTimes(baselineCalls + 2),\n    )\n\n    fireEvent.touchStart(aboutLink)\n    await waitFor(() =>\n      expect(preloadRouteSpy).toHaveBeenCalledTimes(baselineCalls + 3),\n    )\n  })\n\n  test('Router.preload=\"intent\", pendingComponent renders during unresolved route loader', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/posts\" preload=\"intent\">\n              link to posts\n            </Link>\n          </div>\n        )\n      },\n    })\n\n    const postRoute = createRoute({\n      ssr: false,\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      loader: () => sleep(WAIT_TIME),\n      component: () => <div>Posts page</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([postRoute, indexRoute])\n    const router = createRouter({\n      routeTree,\n      defaultPreload: 'intent',\n      defaultPendingMs: 200,\n      defaultPendingComponent: () => <p>Loading...</p>,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToPosts = await screen.findByRole('link', {\n      name: 'link to posts',\n    })\n    expect(linkToPosts).toBeInTheDocument()\n\n    fireEvent.focus(linkToPosts)\n    fireEvent.click(linkToPosts)\n\n    const loadingElement = await screen.findByText('Loading...')\n    expect(loadingElement).toBeInTheDocument()\n\n    const postsElement = await screen.findByText('Posts page')\n    expect(postsElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n  })\n\n  describe('when preloading a link, `preload` should be', () => {\n    async function runTest({\n      expectedPreload,\n      testIdToHover,\n    }: {\n      expectedPreload: boolean\n      testIdToHover: string\n    }) {\n      const rootRoute = createRootRoute({\n        component: () => {\n          return (\n            <>\n              <Link\n                data-testid=\"link-1\"\n                to=\"/posts/$postId\"\n                params={{ postId: 'id1' }}\n              >\n                To first post\n              </Link>\n              <Link\n                data-testid=\"link-2\"\n                to=\"/posts/$postId\"\n                params={{ postId: 'id2' }}\n              >\n                To second post\n              </Link>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index</h1>\n            </>\n          )\n        },\n      })\n\n      const PostsComponent = () => {\n        return (\n          <>\n            <h1>Posts</h1>\n            <Outlet />\n          </>\n        )\n      }\n\n      const postsBeforeLoadFn = vi.fn()\n      const postsLoaderFn = vi.fn()\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'posts',\n        component: PostsComponent,\n        beforeLoad: postsBeforeLoadFn,\n        loader: postsLoaderFn,\n      })\n\n      const PostComponent = () => {\n        const params = useParams({ strict: false })\n        return (\n          <>\n            <span>Params: {params().postId}</span>\n          </>\n        )\n      }\n\n      const postBeforeLoadFn = vi.fn()\n      const postLoaderFn = vi.fn()\n\n      const postRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        component: PostComponent,\n        beforeLoad: postBeforeLoadFn,\n        loader: postLoaderFn,\n      })\n\n      const routeTree = rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postRoute]),\n      ])\n\n      const router = createRouter({\n        routeTree,\n        defaultPreload: 'intent',\n      })\n\n      render(() => <RouterProvider router={router} />)\n      const link = await screen.findByTestId(testIdToHover)\n      fireEvent.mouseOver(link)\n\n      const expected = expect.objectContaining({ preload: expectedPreload })\n      await waitFor(() =>\n        expect(postsBeforeLoadFn).toHaveBeenCalledWith(expected),\n      )\n      await waitFor(() => expect(postsLoaderFn).toHaveBeenCalledWith(expected))\n\n      await waitFor(() =>\n        expect(postBeforeLoadFn).toHaveBeenCalledWith(expected),\n      )\n      await waitFor(() => expect(postLoaderFn).toHaveBeenCalledWith(expected))\n    }\n    test('`true` when on / and hovering `/posts/id1` ', async () => {\n      await runTest({ expectedPreload: true, testIdToHover: 'link-1' })\n    })\n\n    test('`false` when on `/posts/id1` and hovering `/posts/id1`', async () => {\n      window.history.replaceState(null, 'root', '/posts/id1')\n      await runTest({ expectedPreload: false, testIdToHover: 'link-1' })\n    })\n\n    test('`true` when on `/posts/id1` and hovering `/posts/id2`', async () => {\n      window.history.replaceState(null, 'root', '/posts/id1')\n      await runTest({ expectedPreload: false, testIdToHover: 'link-2' })\n    })\n  })\n})\n\ndescribe('createLink', () => {\n  it('should pass the \"disabled\" prop to the rendered target element', async () => {\n    const CustomLink = createLink('button')\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <CustomLink to=\"/\" disabled>\n          Index\n        </CustomLink>\n      ),\n    })\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const customElement = await screen.findByText('Index')\n\n    expect(customElement).toBeDisabled()\n    expect(customElement.getAttribute('disabled')).toBe('')\n  })\n\n  it('should pass the \"foo\" prop to the rendered target element', async () => {\n    const CustomLink = createLink('button')\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <CustomLink\n          to=\"/\"\n          // @ts-expect-error\n          foo=\"bar\"\n        >\n          Index\n        </CustomLink>\n      ),\n    })\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const customElement = await screen.findByText('Index')\n\n    expect(customElement.hasAttribute('foo')).toBe(true)\n    expect(customElement.getAttribute('foo')).toBe('bar')\n  })\n\n  it('should pass activeProps and inactiveProps to the custom link', async () => {\n    const Button: Solid.Component<\n      Solid.ParentProps<{\n        active?: boolean\n        foo?: boolean\n        overrideMeIfYouWant: string\n      }>\n    > = (props) => {\n      const [local, rest] = Solid.splitProps(props, [\n        'active',\n        'foo',\n        'children',\n      ])\n\n      return (\n        <button {...rest}>\n          active: {local.active ? 'yes' : 'no'} - foo:{' '}\n          {local.foo ? 'yes' : 'no'} - {local.children}\n        </button>\n      )\n    }\n\n    const ButtonLink = createLink(Button)\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <ButtonLink\n            to=\"/\"\n            overrideMeIfYouWant=\"Button1\"\n            activeProps={{\n              active: true,\n              'data-hello': 'world',\n              overrideMeIfYouWant: 'overridden-by-activeProps',\n            }}\n            inactiveProps={{ foo: true }}\n          >\n            Button1\n          </ButtonLink>\n          <ButtonLink\n            to=\"/posts\"\n            overrideMeIfYouWant=\"Button2\"\n            activeProps={{\n              active: true,\n              'data-hello': 'world',\n            }}\n            inactiveProps={{\n              foo: true,\n              'data-hello': 'void',\n              overrideMeIfYouWant: 'overridden-by-inactiveProps',\n            }}\n          >\n            Button2\n          </ButtonLink>\n          <ButtonLink\n            to=\"/posts\"\n            overrideMeIfYouWant=\"Button3\"\n            activeProps={{\n              active: true,\n            }}\n            inactiveProps={{\n              active: false,\n            }}\n          >\n            Button3\n          </ButtonLink>\n        </>\n      ),\n    })\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n    })\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const button1 = await screen.findByText('active: yes - foo: no - Button1')\n    expect(button1.getAttribute('data-hello')).toBe('world')\n    expect(button1.getAttribute('overrideMeIfYouWant')).toBe(\n      'overridden-by-activeProps',\n    )\n\n    const button2 = await screen.findByText('active: no - foo: yes - Button2')\n    expect(button2.getAttribute('data-hello')).toBe('void')\n    expect(button2.getAttribute('overrideMeIfYouWant')).toBe(\n      'overridden-by-inactiveProps',\n    )\n\n    const button3 = await screen.findByText('active: no - foo: no - Button3')\n    expect(button3.getAttribute('overrideMeIfYouWant')).toBe('Button3')\n  })\n\n  it('should respect target attribute set by custom component', async () => {\n    const CustomLinkWithTarget = (props: {\n      href?: string\n      children?: Solid.JSX.Element\n      ref?: (el: HTMLAnchorElement) => void\n    }) => (\n      <a ref={props.ref} {...props} target=\"_blank\" rel=\"noopener noreferrer\" />\n    )\n\n    const CreatedCustomLink = createLink(CustomLinkWithTarget)\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index</h1>\n          <CreatedCustomLink to=\"/posts\">\n            Posts (should open in new tab)\n          </CreatedCustomLink>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1 data-testid=\"posts-heading\">Posts</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const originalOpen = window.open\n    const openMock = vi.fn()\n    window.open = openMock\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', {\n      name: 'Posts (should open in new tab)',\n    })\n\n    expect(postsLink).toHaveAttribute('target', '_blank')\n    expect(postsLink).toHaveAttribute('rel', 'noopener noreferrer')\n\n    fireEvent.click(postsLink)\n\n    await waitFor(() => {\n      expect(router.state.location.pathname).toBe('/')\n    })\n\n    await expect(screen.findByTestId('posts-heading')).rejects.toThrow()\n\n    window.open = originalOpen\n  })\n\n  it('should allow override of target prop even when custom component sets it', async () => {\n    const CustomLinkWithDefaultTarget = (props: {\n      href?: string\n      children?: Solid.JSX.Element\n      target?: string\n      ref?: (el: HTMLAnchorElement) => void\n    }) => <a ref={props.ref} target=\"_blank\" {...props} />\n\n    const CreatedCustomLink = createLink(CustomLinkWithDefaultTarget)\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <>\n          <h1>Index</h1>\n          <CreatedCustomLink to=\"/posts\" target=\"_self\">\n            Posts (should navigate internally)\n          </CreatedCustomLink>\n        </>\n      ),\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1 data-testid=\"posts-heading\">Posts</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', {\n      name: 'Posts (should navigate internally)',\n    })\n\n    expect(postsLink).toHaveAttribute('target', '_self')\n\n    fireEvent.click(postsLink)\n\n    await waitFor(() => {\n      expect(router.state.location.pathname).toBe('/posts')\n    })\n\n    const postsHeading = await screen.findByTestId('posts-heading')\n    expect(postsHeading).toBeInTheDocument()\n  })\n})\n\ndescribe('search middleware', () => {\n  test('legacy search filters still work', async () => {\n    const rootRoute = createRootRoute({\n      validateSearch: (input) => {\n        return {\n          root: input.root as string | undefined,\n          foo: input.foo as string | undefined,\n        }\n      },\n      preSearchFilters: [\n        (search) => {\n          return { ...search, foo: 'foo' }\n        },\n      ],\n      postSearchFilters: [\n        (search) => {\n          return { ...search, root: search.root ?? 'default' }\n        },\n      ],\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link to=\"/posts\" search={(p: any) => ({ page: 123, foo: p.foo })}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n        return {\n          page,\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history: createMemoryHistory({ initialEntries: ['/?foo=bar'] }),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByRole('link', { name: 'Posts' })\n    expect(postsLink).toHaveAttribute('href')\n    const href = postsLink.getAttribute('href')\n    const search = getSearchParamsFromURI(href!)\n    expect(search.size).toBe(3)\n    expect(search.get('page')).toBe('123')\n    expect(search.get('root')).toBe('default')\n    expect(search.get('foo')).toBe('foo')\n  })\n\n  test('search middlewares work', async () => {\n    const rootRoute = createRootRoute({\n      errorComponent: (error) => <div>{error.error.stack}</div>,\n      validateSearch: (input) => {\n        return {\n          root: input.root as string | undefined,\n          foo: input.foo as string | undefined,\n        }\n      },\n      search: {\n        middlewares: [\n          ({ search, next }) => {\n            return next({ ...search, foo: 'foo' })\n          },\n          ({ search, next }) => {\n            expect(search.foo).toBe('foo')\n            const { root, ...result } = next({ ...search, foo: 'hello' })\n            return { ...result, root: root ?? search.root }\n          },\n        ],\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const search = indexRoute.useSearch()\n        return (\n          <>\n            <h1>Index</h1>\n            <div data-testid=\"search\">{search().root ?? '$undefined'}</div>\n            <Link\n              data-testid=\"update-search\"\n              to=\"/\"\n              search={{ root: 'newValue' }}\n            >\n              update search\n            </Link>\n            <Link to=\"/posts\" search={{ page: 123 }}>\n              Posts\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      return (\n        <>\n          <h1>Posts</h1>\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: (input: Record<string, unknown>) => {\n        const page = Number(input.page)\n        return {\n          page,\n        }\n      },\n      component: PostsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      history: createMemoryHistory({ initialEntries: ['/?root=abc'] }),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    async function checkSearchValue(value: string) {\n      const searchValue = await screen.findByTestId('search')\n      expect(searchValue).toHaveTextContent(value)\n    }\n    async function checkPostsLink(root: string) {\n      const postsLink = await screen.findByRole('link', { name: 'Posts' })\n      expect(postsLink).toHaveAttribute('href')\n      const href = postsLink.getAttribute('href')\n      const search = getSearchParamsFromURI(href!)\n      expect(search.size).toBe(2)\n      expect(search.get('page')).toBe('123')\n      expect(search.get('root')).toBe(root)\n    }\n    await checkSearchValue('abc')\n    await checkPostsLink('abc')\n\n    const updateSearchLink = await screen.findByTestId('update-search')\n    fireEvent.click(updateSearchLink)\n    await sleep(0)\n    await checkSearchValue('newValue')\n    await checkPostsLink('newValue')\n    expect(router.state.location.search).toEqual({ root: 'newValue' })\n  })\n\n  test('search middlewares work with redirect', async () => {\n    const rootRoute = createRootRoute({\n      validateSearch: z.object({ root: z.string().optional() }),\n      component: () => {\n        return (\n          <>\n            <h1>Root</h1>\n            <Link\n              data-testid=\"root-link-posts\"\n              search={{ foo: 'default' }}\n              to=\"/posts\"\n            >\n              posts\n            </Link>{' '}\n            <Link data-testid=\"root-link-invoices\" to=\"/invoices\">\n              invoices\n            </Link>\n            <Outlet />\n          </>\n        )\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: () => {\n        throw redirect({ to: '/posts' })\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'posts',\n      validateSearch: z.object({\n        foo: z.string().default('default'),\n      }),\n      search: {\n        middlewares: [\n          // this means we cannot get the correct input type for this schema\n          stripSearchParams({ foo: 'default' }),\n          retainSearchParams(true),\n        ],\n      },\n\n      component: () => {\n        const search = postsRoute.useSearch()\n        return (\n          <>\n            <h1>Posts</h1>\n            <div data-testid=\"posts-search\">{search().foo}</div>\n            <Link data-testid=\"posts-link-new\" to=\"/posts/new\">\n              new\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const postsNewRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: 'new',\n    })\n\n    const invoicesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: 'invoices',\n    })\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        postsRoute.addChildren([postsNewRoute]),\n        invoicesRoute,\n      ]),\n    })\n\n    window.history.replaceState(null, 'root', '/?root=abc')\n\n    render(() => <RouterProvider router={router} />)\n\n    const searchValue = await screen.findByTestId('posts-search')\n    expect(searchValue).toHaveTextContent('default')\n\n    expect(router.state.location.pathname).toBe('/posts')\n    expect(router.state.location.search).toEqual({ root: 'abc' })\n\n    // link to sibling does not retain search param\n    const invoicesLink = await screen.findByTestId('root-link-invoices')\n    expect(invoicesLink).toHaveAttribute('href')\n    const invoicesLinkHref = invoicesLink.getAttribute('href')\n    const invoicesLinkSearch = getSearchParamsFromURI(invoicesLinkHref!)\n    expect(invoicesLinkSearch.size).toBe(0)\n\n    // link to child retains search param\n    const postsNewLink = await screen.findByTestId('posts-link-new')\n    expect(postsNewLink).toHaveAttribute('href')\n    const postsNewLinkHref = postsNewLink.getAttribute('href')\n    const postsNewLinkSearch = getSearchParamsFromURI(postsNewLinkHref!)\n    expect(postsNewLinkSearch.size).toBe(1)\n    expect(postsNewLinkSearch.get('root')).toBe('abc')\n\n    const postsLink = await screen.findByTestId('root-link-posts')\n    expect(postsLink).toHaveAttribute('href')\n    const postsLinkHref = postsNewLink.getAttribute('href')\n    const postsLinkSearch = getSearchParamsFromURI(postsLinkHref!)\n    expect(postsLinkSearch.size).toBe(1)\n    expect(postsLinkSearch.get('root')).toBe('abc')\n    expect(postsLink).toHaveAttribute('data-status', 'active')\n  })\n\n  describe('reloadDocument', () => {\n    test('link to /posts with params', async () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index</h1>\n              <Link\n                to=\"/posts/$postId\"\n                params={{ postId: 'id1' }}\n                reloadDocument={true}\n                data-testid=\"link-to-post-1\"\n              >\n                To first post\n              </Link>\n            </>\n          )\n        },\n      })\n\n      const PostsComponent = () => {\n        return (\n          <>\n            <h1>Posts</h1>\n            <Link to=\"/\">Index</Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const postsRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'posts',\n        component: PostsComponent,\n      })\n\n      const PostComponent = () => {\n        const params = useParams({ strict: false })\n        return <span>Params: {params().postId}</span>\n      }\n\n      const postRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        component: PostComponent,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          postsRoute.addChildren([postRoute]),\n        ]),\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const postLink = await screen.findByTestId('link-to-post-1')\n\n      expect(postLink).toHaveAttribute('href', '/posts/id1')\n    })\n  })\n})\n\ndescribe.each([{ basepath: '' }, { basepath: '/basepath' }])(\n  'relative links with %s',\n  ({ basepath }) => {\n    const setupRouter = () => {\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return <h1>Index Route</h1>\n        },\n      })\n      const aRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'a',\n        component: () => {\n          return (\n            <>\n              <h1>A Route</h1>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const bRoute = createRoute({\n        getParentRoute: () => aRoute,\n        path: 'b',\n        component: () => {\n          return (\n            <>\n              <h1>B Route</h1>\n              <Link to=\"..\">Link to Parent</Link>\n            </>\n          )\n        },\n      })\n\n      const paramRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'param/$param',\n        component: () => {\n          return (\n            <>\n              <h1>Param Route</h1>\n              <Link from={paramRoute.fullPath} to=\"./a\">\n                Link to ./a\n              </Link>\n              <Link to=\"c\" unsafeRelative=\"path\">\n                Link to c\n              </Link>\n              <Link to=\"../c\" unsafeRelative=\"path\">\n                Link to ../c\n              </Link>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const paramARoute = createRoute({\n        getParentRoute: () => paramRoute,\n        path: 'a',\n        component: () => {\n          return (\n            <>\n              <h1>Param A Route</h1>\n              <Link from={paramARoute.fullPath} to=\"..\">\n                Link to .. from /param/foo/a\n              </Link>\n              <Link to=\"..\" data-testid={'link-to-previous'}>\n                Link to .. from current active route\n              </Link>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const paramBRoute = createRoute({\n        getParentRoute: () => paramARoute,\n        path: 'b',\n        component: () => {\n          return (\n            <>\n              <h1>Param B Route</h1>\n              <Link to=\"..\">Link to Parent</Link>\n              <Link to=\".\" params={{ param: 'bar' }}>\n                Link to . with param:bar\n              </Link>\n              <Link to=\"..\" params={{ param: 'bar' }}>\n                Link to Parent with param:bar\n              </Link>\n              <paramBRoute.Link\n                to=\"..\"\n                params={(prev) => ({ ...prev, param: 'bar' })}\n              >\n                Link to Parent with param:bar functional\n              </paramBRoute.Link>\n            </>\n          )\n        },\n      })\n\n      const paramCRoute = createRoute({\n        getParentRoute: () => paramARoute,\n        path: 'c',\n        component: () => {\n          return <h1>Param C Route</h1>\n        },\n      })\n\n      const splatRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'splat/$',\n        component: () => {\n          return (\n            <>\n              <h1>Splat Route</h1>\n              <Link to=\"..\" unsafeRelative=\"path\">\n                Unsafe link to ..\n              </Link>\n              <Link to=\".\" unsafeRelative=\"path\">\n                Unsafe link to .\n              </Link>\n              <Link to=\"./child\" unsafeRelative=\"path\">\n                Unsafe link to ./child\n              </Link>\n            </>\n          )\n        },\n      })\n\n      return createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          aRoute.addChildren([bRoute]),\n          paramRoute.addChildren([\n            paramARoute.addChildren([paramBRoute, paramCRoute]),\n          ]),\n          splatRoute,\n        ]),\n\n        basepath: basepath === '' ? undefined : basepath,\n      })\n    }\n\n    test('should navigate to the parent route', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      // Navigate to /a/b\n      window.history.replaceState(null, 'root', `${basepath}/a/b`)\n\n      // Inspect the link to go up a parent\n      const parentLink = await screen.findByText('Link to Parent')\n      expect(parentLink.getAttribute('href')).toBe(`${basepath}/a`)\n\n      // Click the link and ensure the new location\n      fireEvent.click(parentLink)\n\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/a`),\n      )\n    })\n\n    test('should navigate to the parent route and keep params', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      // Navigate to /param/oldParamValue/a/b\n      window.history.replaceState(null, 'root', `${basepath}/param/foo/a/b`)\n\n      // Inspect the link to go up a parent and keep the params\n      const parentLink = await screen.findByText('Link to Parent')\n      expect(parentLink.getAttribute('href')).toBe(`${basepath}/param/foo/a`)\n\n      // Click the link and ensure the new location\n      fireEvent.click(parentLink)\n\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/param/foo/a`),\n      )\n    })\n\n    test('should navigate to the parent route and change params', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      // Navigate to /param/oldParamValue/a/b\n      window.history.replaceState(null, 'root', `${basepath}/param/foo/a/b`)\n\n      // Inspect the link to go up a parent and keep the params\n      const parentLink = await screen.findByText(\n        'Link to Parent with param:bar',\n      )\n      expect(parentLink.getAttribute('href')).toBe(`${basepath}/param/bar/a`)\n\n      // Click the link and ensure the new location\n      fireEvent.click(parentLink)\n\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/param/bar/a`),\n      )\n    })\n\n    test('should navigate to a relative link based on render location', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      window.history.replaceState(null, 'root', `${basepath}/param/foo/a/b`)\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText('Link to ./a')\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/param/foo/a`)\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/param/foo/a`),\n      )\n    })\n\n    test('should navigate to a parent link based on render location', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      window.history.replaceState(null, 'root', `${basepath}/param/foo/a/b`)\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText(\n        'Link to .. from /param/foo/a',\n      )\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/param/foo`)\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/param/foo`),\n      )\n    })\n\n    test('should navigate to a parent link based on active location', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      window.history.replaceState(null, 'root', `${basepath}/param/foo/a/b`)\n\n      const relativeLink = await screen.findByTestId('link-to-previous')\n\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/param/foo/a`)\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/param/foo/a`),\n      )\n    })\n\n    test('should navigate to a child link based on pathname', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      window.history.replaceState(null, 'root', `${basepath}/param/foo/a/b`)\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText('Link to c')\n      expect(relativeLink.getAttribute('href')).toBe(\n        `${basepath}/param/foo/a/b/c`,\n      )\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/param/foo/a/b/c`),\n      )\n    })\n\n    test('should navigate to a relative link based on pathname', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      window.history.replaceState(null, 'root', `${basepath}/param/foo/a/b`)\n\n      // Inspect the relative link to ./a\n      const relativeLink = await screen.findByText('Link to ../c')\n      expect(relativeLink.getAttribute('href')).toBe(\n        `${basepath}/param/foo/a/c`,\n      )\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/param/foo/a/c`),\n      )\n    })\n\n    test('should navigate to parent inside of splat route based on pathname', async () => {\n      const router = setupRouter()\n\n      render(() => <RouterProvider router={router} />)\n\n      window.history.replaceState(null, 'root', `${basepath}/splat/a/b/c/d`)\n\n      const relativeLink = await screen.findByText('Unsafe link to ..')\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/splat/a/b/c`)\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/splat/a/b/c`),\n      )\n    })\n\n    test('should navigate to same route inside of splat route based on pathname', async () => {\n      const router = setupRouter()\n\n      window.history.replaceState(null, 'root', `${basepath}/splat/a/b/c`)\n\n      render(() => <RouterProvider router={router} />)\n\n      const relativeLink = await screen.findByText('Unsafe link to .')\n      expect(relativeLink.getAttribute('href')).toBe(`${basepath}/splat/a/b/c`)\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n\n      expect(window.location.pathname).toBe(`${basepath}/splat/a/b/c`)\n    })\n\n    test('should navigate to child route inside of splat route based on pathname', async () => {\n      const router = setupRouter()\n\n      window.history.replaceState(null, 'root', `${basepath}/splat/a/b/c`)\n\n      render(() => <RouterProvider router={router} />)\n\n      const relativeLink = await screen.findByText('Unsafe link to ./child')\n      expect(relativeLink.getAttribute('href')).toBe(\n        `${basepath}/splat/a/b/c/child`,\n      )\n\n      // Click the link and ensure the new location\n      fireEvent.click(relativeLink)\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/splat/a/b/c/child`),\n      )\n    })\n\n    test('should navigate to same route with different params', async () => {\n      const router = setupRouter()\n\n      window.history.replaceState(null, 'root', `${basepath}/param/foo/a/b`)\n\n      render(() => <RouterProvider router={router} />)\n\n      const parentLink = await screen.findByText('Link to . with param:bar')\n\n      fireEvent.click(parentLink)\n\n      await waitFor(() =>\n        expect(window.location.pathname).toBe(`${basepath}/param/bar/a/b`),\n      )\n    })\n  },\n)\n\ndescribe('splat routes with empty splat', () => {\n  test.each(Object.values(trailingSlashOptions))(\n    'should handle empty _splat parameter with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash === 'always' ? '/' : ''\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index Route</h1>\n              <Link\n                data-testid=\"splat-link-with-empty-splat\"\n                to=\"/splat/$\"\n                params={{ _splat: '' }}\n                activeProps={{ class: 'active' }}\n              >\n                Link to splat with _splat value\n              </Link>\n              <Link\n                data-testid=\"splat-link-with-undefined-splat\"\n                to=\"/splat/$\"\n                params={{ _splat: undefined }}\n                activeProps={{ class: 'active' }}\n              >\n                Link to splat with undefined _splat\n              </Link>\n              <Link\n                data-testid=\"splat-link-with-no-splat\"\n                to=\"/splat/$\"\n                params={{}}\n                activeProps={{ class: 'active' }}\n              >\n                Link to splat with no _splat at all\n              </Link>\n            </>\n          )\n        },\n      })\n\n      const splatRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'splat/$',\n        component: () => {\n          return <h1>Splat Route</h1>\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, splatRoute]),\n        history,\n        trailingSlash,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const splatLinkWithEmptySplat = await screen.findByTestId(\n        'splat-link-with-empty-splat',\n      )\n      const splatLinkWithUndefinedSplat = await screen.findByTestId(\n        'splat-link-with-undefined-splat',\n      )\n      const splatLinkWithNoSplat = await screen.findByTestId(\n        'splat-link-with-no-splat',\n      )\n\n      // When _splat has a value, it should follow the trailingSlash setting\n      await waitFor(() => {\n        expect(splatLinkWithEmptySplat.getAttribute('href')).toBe(\n          `/splat${tail}`,\n        )\n        expect(splatLinkWithUndefinedSplat.getAttribute('href')).toBe(\n          `/splat${tail}`,\n        )\n        expect(splatLinkWithNoSplat.getAttribute('href')).toBe(`/splat${tail}`)\n      })\n\n      // Click the link with empty _splat and ensure the route matches\n      fireEvent.click(splatLinkWithEmptySplat)\n\n      await waitFor(async () => {\n        expect(splatLinkWithEmptySplat).toHaveClass('active')\n        expect(splatLinkWithUndefinedSplat).toHaveClass('active')\n        expect(splatLinkWithNoSplat).toHaveClass('active')\n        expect(window.location.pathname).toBe(`/splat${tail}`)\n        expect(await screen.findByText('Splat Route')).toBeInTheDocument()\n      })\n    },\n  )\n})\n\ndescribe('relative links to current route', () => {\n  test.each([true, false])(\n    'should navigate to current route when using \".\" in nested route structure from Index Route with trailingSlash: %s',\n    async (trailingSlash: boolean) => {\n      const tail = trailingSlash ? '/' : ''\n\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <Link data-testid=\"posts-link\" to=\"/post\">\n              Post\n            </Link>\n            <Link\n              data-testid=\"search-link\"\n              to=\".\"\n              search={{ param1: 'value1' }}\n            >\n              Search\n            </Link>\n            <Link\n              data-testid=\"search2-link\"\n              to=\".\"\n              search={{ param1: 'value2' }}\n            >\n              Search2\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n        validateSearch: z.object({\n          param1: z.string().optional(),\n        }),\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => indexRoute,\n        path: 'post',\n        component: () => (\n          <>\n            <div>Post</div>\n          </>\n        ),\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postRoute]),\n        history,\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const postButton = await screen.findByTestId('posts-link')\n      const searchButton = await screen.findByTestId('search-link')\n      const searchButton2 = await screen.findByTestId('search2-link')\n\n      fireEvent.click(postButton)\n\n      await waitFor(() => {\n        expect(window.location.pathname).toBe(`/post${tail}`)\n      })\n\n      fireEvent.click(searchButton)\n\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe(`/post${tail}`)\n        expect(router.state.location.search).toEqual({ param1: 'value1' })\n      })\n\n      fireEvent.click(searchButton2)\n\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe(`/post${tail}`)\n        expect(router.state.location.search).toEqual({ param1: 'value2' })\n      })\n    },\n  )\n\n  test.each([true, false])(\n    'should navigate to current route with search params when using \".\" in nested route structure from Index Route with trailingSlash: %s',\n    async (trailingSlash: boolean) => {\n      const tail = trailingSlash ? '/' : ''\n\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <Link data-testid=\"posts-link\" to=\"/post\">\n              Post\n            </Link>\n            <Link\n              data-testid=\"search-link\"\n              to=\".\"\n              search={{ param1: 'value1' }}\n            >\n              Search\n            </Link>\n            <Link\n              data-testid=\"search2-link\"\n              to=\"/post\"\n              search={{ param1: 'value2' }}\n            >\n              Search2\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n        validateSearch: z.object({\n          param1: z.string().optional(),\n        }),\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => indexRoute,\n        path: 'post',\n        component: () => <div>Post</div>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postRoute]),\n        history,\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const postButton = await screen.findByTestId('posts-link')\n\n      fireEvent.click(postButton)\n\n      await waitFor(() => {\n        expect(window.location.pathname).toBe(`/post${tail}`)\n      })\n\n      const searchButton = await screen.findByTestId('search-link')\n\n      fireEvent.click(searchButton)\n\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe(`/post${tail}`)\n        expect(router.state.location.search).toEqual({ param1: 'value1' })\n      })\n\n      const searchButton2 = await screen.findByTestId('search2-link')\n\n      fireEvent.click(searchButton2)\n\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe(`/post${tail}`)\n        expect(router.state.location.search).toEqual({ param1: 'value2' })\n      })\n    },\n  )\n\n  test.each([true, false])(\n    'should navigate to current route with changing path params when using \".\" in nested route structure with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash ? '/' : ''\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"index-heading\">Index</h1>\n            <Link data-testid=\"posts-link\" to=\"/posts\">\n              Posts\n            </Link>\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n      })\n\n      const layoutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        id: '_layout',\n        component: () => {\n          return (\n            <>\n              <h1>Layout</h1>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const PostsComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"posts-index-heading\">Posts</h1>\n            <Link\n              data-testid=\"first-post-link\"\n              to=\"$postId\"\n              params={{ postId: 'id1' }}\n            >\n              To first post\n            </Link>\n            <Link\n              data-testid=\"second-post-link\"\n              to=\".\"\n              params={{ postId: 'id2' }}\n            >\n              To second post\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const postsRoute = createRoute({\n        getParentRoute: () => layoutRoute,\n        path: 'posts',\n        component: PostsComponent,\n      })\n\n      const PostComponent = () => {\n        const params = useParams({ strict: false })\n        return (\n          <>\n            <span data-testid={`post-${params().postId}`}>\n              Params: {params().postId}\n            </span>\n          </>\n        )\n      }\n\n      const postRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        component: PostComponent,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          layoutRoute.addChildren([postsRoute.addChildren([postRoute])]),\n        ]),\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const postsButton = await screen.findByTestId('posts-link')\n\n      fireEvent.click(postsButton)\n\n      await waitFor(() => {\n        expect(window.location.pathname).toEqual(`/posts${tail}`)\n      })\n\n      const firstPostButton = await screen.findByTestId('first-post-link')\n\n      fireEvent.click(firstPostButton)\n\n      await waitFor(() => {\n        expect(window.location.pathname).toEqual(`/posts/id1${tail}`)\n      })\n\n      const secondPostButton = await screen.findByTestId('second-post-link')\n\n      fireEvent.click(secondPostButton)\n\n      await waitFor(() => {\n        expect(window.location.pathname).toEqual(`/posts/id2${tail}`)\n      })\n    },\n  )\n})\n\ndescribe('relative links to from route', () => {\n  test.each([true, false])(\n    'should navigate to from route when using \".\" in nested route structure from Index Route with trailingSlash: %s',\n    async (trailingSlash: boolean) => {\n      const tail = trailingSlash ? '/' : ''\n\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <Link data-testid=\"posts-link\" to=\"/post\">\n              Post\n            </Link>\n            <Link\n              data-testid=\"search-link\"\n              to=\".\"\n              search={{ param1: 'value1' }}\n            >\n              Search\n            </Link>\n            <Link data-testid=\"home-link\" from=\"/\" to=\".\">\n              Go To Home\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n        validateSearch: z.object({\n          param1: z.string().optional(),\n        }),\n      })\n\n      const postRoute = createRoute({\n        getParentRoute: () => indexRoute,\n        path: 'post',\n        component: () => <div>Post</div>,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postRoute]),\n        history,\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const postButton = await screen.findByTestId('posts-link')\n\n      fireEvent.click(postButton)\n\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe(`/post${tail}`)\n      })\n\n      const searchButton = await screen.findByTestId('search-link')\n\n      fireEvent.click(searchButton)\n\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe(`/post${tail}`)\n        expect(router.state.location.search).toEqual({ param1: 'value1' })\n      })\n\n      const homeBtn = await screen.findByTestId('home-link')\n\n      fireEvent.click(homeBtn)\n\n      await waitFor(() => {\n        expect(router.state.location.pathname).toBe(`/`)\n        expect(router.state.location.search).toEqual({})\n      })\n    },\n  )\n\n  test.each([true, false])(\n    'should navigate to from route with path params when using \".\" in nested route structure with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash ? '/' : ''\n      const rootRoute = createRootRoute()\n\n      const IndexComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"index-heading\">Index</h1>\n            <Link data-testid=\"posts-link\" to=\"/posts\">\n              Posts\n            </Link>\n          </>\n        )\n      }\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: IndexComponent,\n      })\n\n      const layoutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        id: '_layout',\n        component: () => {\n          return (\n            <>\n              <h1>Layout</h1>\n              <Outlet />\n            </>\n          )\n        },\n      })\n\n      const PostsComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"posts-index-heading\">Posts</h1>\n            <Link\n              data-testid=\"first-post-link\"\n              to=\"$postId\"\n              params={{ postId: '1' }}\n            >\n              To first post\n            </Link>\n            <Link\n              data-testid=\"second-post-link\"\n              to=\"$postId\"\n              params={{ postId: '2' }}\n            >\n              To second post\n            </Link>\n            <Link data-testid=\"to-posts-index-link\" from=\"/posts\" to=\".\">\n              To posts list\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const PostDetailComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"post-detail-index-heading\">Post Detail</h1>\n            <Link data-testid=\"post-info-link\" to=\"info\">\n              To post info\n            </Link>\n            <Link data-testid=\"post-notes-link\" to=\"notes\">\n              To post notes\n            </Link>\n            <Link\n              data-testid=\"to-post-detail-index-link\"\n              from=\"/posts/$postId\"\n              to=\".\"\n            >\n              To index detail options\n            </Link>\n            <Outlet />\n          </>\n        )\n      }\n\n      const PostInfoComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"post-info-heading\">Post Info</h1>\n          </>\n        )\n      }\n\n      const PostNotesComponent = () => {\n        return (\n          <>\n            <h1 data-testid=\"post-notes-heading\">Post Notes</h1>\n          </>\n        )\n      }\n\n      const postsRoute = createRoute({\n        getParentRoute: () => layoutRoute,\n        path: 'posts',\n        component: PostsComponent,\n      })\n\n      const postDetailRoute = createRoute({\n        getParentRoute: () => postsRoute,\n        path: '$postId',\n        component: PostDetailComponent,\n      })\n\n      const postInfoRoute = createRoute({\n        getParentRoute: () => postDetailRoute,\n        path: 'info',\n        component: PostInfoComponent,\n      })\n\n      const postNotesRoute = createRoute({\n        getParentRoute: () => postDetailRoute,\n        path: 'notes',\n        component: PostNotesComponent,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([\n          indexRoute,\n          layoutRoute.addChildren([\n            postsRoute.addChildren([\n              postDetailRoute.addChildren([postInfoRoute, postNotesRoute]),\n            ]),\n          ]),\n        ]),\n        trailingSlash: trailingSlash ? 'always' : 'never',\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const postsButton = await screen.findByTestId('posts-link')\n\n      fireEvent.click(postsButton)\n\n      await waitFor(() => {\n        expect(screen.queryByTestId('posts-index-heading')).toBeInTheDocument()\n        expect(window.location.pathname).toEqual(`/posts${tail}`)\n      })\n\n      const firstPostButton = await screen.findByTestId('first-post-link')\n\n      fireEvent.click(firstPostButton)\n\n      await waitFor(() => {\n        expect(\n          screen.queryByTestId('post-detail-index-heading'),\n        ).toBeInTheDocument()\n        expect(window.location.pathname).toEqual(`/posts/1${tail}`)\n      })\n\n      const postInfoButton = await screen.findByTestId('post-info-link')\n\n      fireEvent.click(postInfoButton)\n\n      await waitFor(() => {\n        expect(screen.queryByTestId('post-info-heading')).toBeInTheDocument()\n        expect(window.location.pathname).toEqual(`/posts/1/info${tail}`)\n      })\n\n      const toPostDetailIndexButton = await screen.findByTestId(\n        'to-post-detail-index-link',\n      )\n\n      fireEvent.click(toPostDetailIndexButton)\n\n      await waitFor(() => {\n        expect(\n          screen.queryByTestId('post-detail-index-heading'),\n        ).toBeInTheDocument()\n        expect(\n          screen.queryByTestId('post-info-heading'),\n        ).not.toBeInTheDocument()\n        expect(window.location.pathname).toEqual(`/posts/1${tail}`)\n      })\n\n      const postNotesButton = await screen.findByTestId('post-notes-link')\n\n      fireEvent.click(postNotesButton)\n\n      await waitFor(() => {\n        expect(screen.queryByTestId('post-notes-heading')).toBeInTheDocument()\n        expect(window.location.pathname).toEqual(`/posts/1/notes${tail}`)\n      })\n\n      const toPostsIndexButton = await screen.findByTestId(\n        'to-posts-index-link',\n      )\n\n      fireEvent.click(toPostsIndexButton)\n\n      await waitFor(() => {\n        expect(screen.queryByTestId('posts-index-heading')).toBeInTheDocument()\n        expect(\n          screen.queryByTestId('post-notes-heading'),\n        ).not.toBeInTheDocument()\n        expect(\n          screen.queryByTestId('post-detail-index-heading'),\n        ).not.toBeInTheDocument()\n        expect(window.location.pathname).toEqual(`/posts${tail}`)\n      })\n\n      const secondPostButton = await screen.findByTestId('second-post-link')\n\n      fireEvent.click(secondPostButton)\n\n      await waitFor(() => {\n        expect(\n          screen.queryByTestId('post-detail-index-heading'),\n        ).toBeInTheDocument()\n        expect(window.location.pathname).toEqual(`/posts/2${tail}`)\n      })\n    },\n  )\n})\n\ndescribe('when on /posts/$postId and navigating to ../ with default `from` /posts', () => {\n  async function runTest(navigateVia: 'Route' | 'RouteApi') {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"index-heading\">Index</h1>\n          <Link data-testid=\"posts-link\" to=\"/posts\">\n            Posts\n          </Link>\n          <Link\n            data-testid=\"index-to-first-post-link\"\n            to=\"/posts/$postId/details\"\n            params={{ postId: 'id1' }}\n          >\n            To first post\n          </Link>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      component: () => {\n        return (\n          <>\n            <h1>Layout</h1>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const PostsComponent = () => {\n      const LinkViaRoute = () => (\n        <Link from={postsRoute.fullPath} to=\"../\" data-testid=\"link-to-home\">\n          To Home\n        </Link>\n      )\n\n      const LinkViaRouteApi = () => {\n        const RouteApiLink = postsRouteApi.Link\n        return (\n          <RouteApiLink to=\"../\" data-testid=\"link-to-home\">\n            To Home\n          </RouteApiLink>\n        )\n      }\n\n      return (\n        <>\n          <h1>Posts</h1>\n          {navigateVia === 'Route' ? <LinkViaRoute /> : <LinkViaRouteApi />}\n          <Outlet />\n        </>\n      )\n    }\n\n    const postsRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: 'posts',\n      component: PostsComponent,\n    })\n\n    const postsRouteApi = getRouteApi('/_layout/posts')\n\n    const PostComponent = () => {\n      const params = useParams({ strict: false })\n      return (\n        <>\n          <span>Params: {params().postId}</span>\n          <Outlet />\n        </>\n      )\n    }\n\n    const postRoute = createRoute({\n      getParentRoute: () => postsRoute,\n      path: '$postId',\n      component: PostComponent,\n    })\n\n    const PostIndexComponent = () => {\n      return (\n        <>\n          <h1>Post Index</h1>\n        </>\n      )\n    }\n\n    const postIndexRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: '/',\n      component: PostIndexComponent,\n    })\n\n    const DetailsComponent = () => {\n      return (\n        <>\n          <h1 data-testid=\"details-heading\">Details!</h1>\n        </>\n      )\n    }\n\n    const detailsRoute = createRoute({\n      getParentRoute: () => postRoute,\n      path: 'details',\n      component: DetailsComponent,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        layoutRoute.addChildren([\n          postsRoute.addChildren([\n            postRoute.addChildren([postIndexRoute, detailsRoute]),\n          ]),\n        ]),\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsButton = await screen.findByTestId('index-to-first-post-link')\n\n    fireEvent.click(postsButton)\n\n    expect(await screen.findByTestId('details-heading')).toBeInTheDocument()\n\n    expect(window.location.pathname).toEqual('/posts/id1/details')\n\n    const homeButton = await screen.findByTestId('link-to-home')\n\n    fireEvent.click(homeButton)\n\n    expect(await screen.findByTestId('index-heading')).toBeInTheDocument()\n    expect(window.location.pathname).toEqual('/')\n  }\n\n  test('Route', () => runTest('Route'))\n  test('RouteApi', () => runTest('RouteApi'))\n})\n\ndescribe('rewrite', () => {\n  test('renders hard link when rewrite points to different origin', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link data-testid=\"link-to-index\" to=\"/\">\n              Index\n            </Link>\n            <Link data-testid=\"link-to-info\" to=\"/info\">\n              Info\n            </Link>\n            <Link data-testid=\"link-to-app\" to=\"/app\">\n              App\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const infoRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/info',\n      component: () => {\n        return (\n          <>\n            <h1>Info</h1>\n          </>\n        )\n      },\n    })\n\n    const appRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/app',\n      component: () => {\n        return (\n          <>\n            <h1>App</h1>\n          </>\n        )\n      },\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, infoRoute, appRoute]),\n      history,\n      origin: 'http://example.com',\n      rewrite: {\n        input: ({ url }) => {\n          if (url.href.startsWith('http://app.example.com')) {\n            return url.href.replace('http://example.com/ap', '')\n          }\n          return undefined\n        },\n        output: ({ url }) => {\n          if (url.pathname.startsWith('/app')) {\n            ;((url.hostname = 'app.example.com'),\n              (url.pathname = url.pathname.replace(/^\\/app/, '')))\n          }\n          return url\n        },\n      },\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const infoLink = await screen.findByTestId('link-to-info')\n    expect(infoLink).toHaveAttribute('href', '/info')\n\n    const appLink = await screen.findByTestId('link-to-app')\n    expect(appLink).toHaveAttribute('href', 'http://app.example.com/')\n  })\n})\n\ndescribe('hash history with target=\"_blank\" links', () => {\n  test('should generate correct href for target=\"_blank\" links in hash history mode', async () => {\n    const hashHistory = createHashHistory()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <>\n            <h1>Index</h1>\n            <Link data-testid=\"posts-link\" to=\"/posts\">\n              Posts (same tab)\n            </Link>\n            <Link data-testid=\"about-blank-link\" to=\"/about\" target=\"_blank\">\n              About (new tab)\n            </Link>\n          </>\n        )\n      },\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => <h1>Posts</h1>,\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <h1>About</h1>,\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([indexRoute, postsRoute, aboutRoute]),\n      history: hashHistory,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const postsLink = await screen.findByTestId('posts-link')\n    expect(postsLink).toHaveAttribute('href', '/#/posts')\n    expect(postsLink).not.toHaveAttribute('target', '_blank')\n\n    const postsBlankLink = await screen.findByTestId('about-blank-link')\n    expect(postsBlankLink).toHaveAttribute('href', '/#/about')\n    expect(postsBlankLink).toHaveAttribute('target', '_blank')\n  })\n})\n\ndescribe('encoded and unicode paths', () => {\n  const testCases = [\n    {\n      name: 'with prefix',\n      path: '/foo/prefix@대{$}',\n      expectedPath:\n        '/foo/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]',\n      expectedLocation: '/foo/prefix@대test[s%5C/.%5C/parameter%25!🚀%40]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with suffix',\n      path: '/foo/{$}대suffix@',\n      expectedPath:\n        '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]%EB%8C%80suffix@',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀%40]대suffix@',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with wildcard',\n      path: '/foo/$',\n      expectedPath: '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n    // '/' is left as is with splat params but encoded with normal params\n    {\n      name: 'with path param',\n      path: `/foo/$id`,\n      expectedPath: '/foo/test[s%5C%2F.%5C%2Fparameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C%2F.%5C%2Fparameter%25!🚀]',\n      params: {\n        id: 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n  ]\n\n  test.each(testCases)(\n    'should handle encoded, decoded paths with unicode characters correctly - $name',\n    async ({ path, expectedPath, expectedLocation, params }) => {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <>\n              <h1>Index Route</h1>\n              <Link data-testid=\"link-to-path\" to={path} params={params}>\n                Link to path\n              </Link>\n            </>\n          )\n        },\n      })\n\n      const pathRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path,\n        component: PathRouteComponent,\n      })\n\n      function PathRouteComponent() {\n        const params = pathRoute.useParams()\n        return (\n          <div>\n            <h1>Path Route</h1>\n            <p>\n              params:{' '}\n              <span data-testid=\"params-to-validate\">\n                {JSON.stringify(params())}\n              </span>\n            </p>\n          </div>\n        )\n      }\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, pathRoute]),\n        history,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const link = await screen.findByTestId('link-to-path')\n\n      expect(link.getAttribute('href')).toBe(expectedPath)\n\n      fireEvent.click(link)\n\n      const paramsToValidate = await screen.findByTestId('params-to-validate')\n\n      expect(window.location.pathname).toBe(expectedPath)\n      expect(router.latestLocation.pathname).toBe(expectedLocation)\n\n      expect(paramsToValidate.textContent).toEqual(JSON.stringify(params))\n    },\n  )\n})\n"
  },
  {
    "path": "packages/solid-router/tests/navigate.test.tsx",
    "content": "import { afterEach, describe, expect, it, test, vi } from 'vitest'\n\nimport { trailingSlashOptions } from '@tanstack/router-core'\nimport { waitFor } from '@solidjs/testing-library'\nimport {\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../src'\nimport type { RouterHistory } from '../src'\n\nafterEach(() => {\n  vi.clearAllMocks()\n})\n\nfunction createTestRouter(initialHistory?: RouterHistory) {\n  const history =\n    initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n  const rootRoute = createRootRoute({})\n  const indexRoute = createRoute({ getParentRoute: () => rootRoute, path: '/' })\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n  })\n  const postIdRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '/$slug',\n  })\n  const projectRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/p',\n  })\n  const projectIdRoute = createRoute({\n    getParentRoute: () => projectRoute,\n    path: '/$projectId',\n  })\n  const projectVersionRoute = createRoute({\n    getParentRoute: () => projectIdRoute,\n    path: '/$version',\n  })\n  const projectFrameRoute = createRoute({\n    getParentRoute: () => projectVersionRoute,\n    path: '/$framework',\n  })\n\n  const uRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/u',\n  })\n  const uLayoutRoute = createRoute({\n    id: '_layout',\n    getParentRoute: () => uRoute,\n  })\n  const uUsernameRoute = createRoute({\n    getParentRoute: () => uLayoutRoute,\n    path: '$username',\n  })\n\n  const gRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/g',\n  })\n  const gLayoutRoute = createRoute({\n    id: 'layout',\n    getParentRoute: () => gRoute,\n  })\n  const gUsernameRoute = createRoute({\n    getParentRoute: () => gLayoutRoute,\n    path: '$username',\n  })\n  const searchRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'search',\n    validateSearch: (search: Record<string, unknown>) => {\n      return {\n        ['foo=bar']: Number(search['foo=bar'] ?? 1),\n      }\n    },\n  })\n\n  const projectTree = projectRoute.addChildren([\n    projectIdRoute.addChildren([\n      projectVersionRoute.addChildren([projectFrameRoute]),\n    ]),\n  ])\n  const uTree = uRoute.addChildren([uLayoutRoute.addChildren([uUsernameRoute])])\n  const gTree = gRoute.addChildren([gLayoutRoute.addChildren([gUsernameRoute])])\n\n  const routeTree = rootRoute.addChildren([\n    indexRoute,\n    postsRoute.addChildren([postIdRoute]),\n    projectTree,\n    uTree,\n    gTree,\n  ])\n  const router = createRouter({ routeTree, history })\n\n  return {\n    router,\n    routes: {\n      indexRoute,\n      postsRoute,\n      postIdRoute,\n      projectRoute,\n      projectIdRoute,\n      projectVersionRoute,\n      projectFrameRoute,\n    },\n  }\n}\n\ndescribe('router.navigate navigation using a single path param - object syntax for updates', () => {\n  it('should change $slug in \"/posts/$slug\" from \"tanner\" to \"tkdodo\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      to: '/posts/$slug',\n      params: { slug: 'tkdodo' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should change $slug in \"/posts/$slug\" from \"tanner\" to \"tkdodo\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      params: { slug: 'tkdodo' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n})\n\ndescribe('router.navigate navigation using a single path param - function syntax for updates', () => {\n  it('should change $slug in \"/posts/$slug\" from \"tanner\" to \"tkdodo\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      to: '/posts/$slug',\n      params: (p: any) => ({ ...p, slug: 'tkdodo' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should change $slug in \"/posts/$slug\" from \"tanner\" to \"tkdodo\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, slug: 'tkdodo' }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n})\n\ndescribe('router.navigate navigation using multiple path params - object syntax for updates', () => {\n  it('should change $projectId in \"/p/$projectId/$version/$framework\" from \"router\" to \"query\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: { projectId: 'query' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/query/v1/react')\n  })\n\n  it('should change $projectId in \"/p/$projectId/$version/$framework\" from \"router\" to \"query\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: { projectId: 'query' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/query/v1/react')\n  })\n\n  it('should change $version in \"/p/$projectId/$version/$framework\" from \"v1\" to \"v3\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: { version: 'v3' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v3/react')\n  })\n\n  it('should change $version in \"/p/$projectId/$version/$framework\" from \"v1\" to \"v3\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: { version: 'v3' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v3/react')\n  })\n\n  it('should change $framework in \"/p/$projectId/$version/$framework\" from \"react\" to \"vue\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: { framework: 'vue' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/vue')\n  })\n\n  it('should change $framework in \"/p/$projectId/$version/$framework\" from \"react\" to \"vue\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: { framework: 'vue' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/vue')\n  })\n})\n\ndescribe('router.navigate navigation using multiple path params - function syntax for updates', () => {\n  it('should change $projectId in \"/p/$projectId/$version/$framework\" from \"router\" to \"query\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: (p: any) => ({ ...p, projectId: 'query' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/query/v1/react')\n  })\n\n  it('should change $projectId in \"/p/$projectId/$version/$framework\" from \"router\" to \"query\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, projectId: 'query' }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/query/v1/react')\n  })\n\n  it('should change $version in \"/p/$projectId/$version/$framework\" from \"v1\" to \"v3\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: (p: any) => ({ ...p, version: 'v3' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v3/react')\n  })\n\n  it('should change $version in \"/p/$projectId/$version/$framework\" from \"v1\" to \"v3\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, version: 'v3' }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v3/react')\n  })\n\n  it('should change $framework in \"/p/$projectId/$version/$framework\" from \"react\" to \"vue\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/$version/$framework',\n      params: (p: any) => ({ ...p, framework: 'vue' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/vue')\n  })\n\n  it('should change $framework in \"/p/$projectId/$version/$framework\" from \"react\" to \"vue\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, framework: 'vue' }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/v1/vue')\n  })\n})\n\ndescribe('router.navigate navigation using layout routes resolves correctly', () => {\n  it('should resolve \"/u/tanner\" in \"/u/_layout/$username\" to \"/u/tkdodo\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/u/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/u/tanner')\n\n    await router.navigate({\n      to: '/u/$username',\n      params: { username: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/u/tkdodo')\n  })\n\n  it('should resolve \"/u/tanner\" in \"/u/_layout/$username\" to \"/u/tkdodo\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/u/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/u/tanner')\n\n    await router.navigate({\n      params: { username: 'tkdodo' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/u/tkdodo')\n  })\n\n  it('should resolve \"/g/tanner\" in \"/g/layout/$username\" to \"/g/tkdodo\"', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/g/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/g/tanner')\n\n    await router.navigate({\n      to: '/g/$username',\n      params: { username: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/g/tkdodo')\n  })\n\n  it('should resolve \"/g/tanner\" in \"/g/layout/$username\" to \"/g/tkdodo\" w/o \"to\" path being provided', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/g/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/g/tanner')\n\n    await router.navigate({\n      params: { username: 'tkdodo' },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/g/tkdodo')\n  })\n\n  it('should handle search params with special characters', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/search?foo%3Dbar=2'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/search')\n    expect(router.state.location.search).toStrictEqual(\n      toNullObj({ 'foo=bar': 2 }),\n    )\n\n    await router.navigate({\n      search: { 'foo=bar': 3 },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.search).toStrictEqual(\n      toNullObj({ 'foo=bar': 3 }),\n    )\n  })\n})\n\nfunction toNullObj<T>(obj: T): T {\n  if (typeof obj === 'object') return Object.assign(Object.create(null), obj)\n  return obj\n}\n\ndescribe('relative navigation', () => {\n  it('should navigate to a child route', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts')\n\n    await router.navigate({\n      from: '/posts',\n      to: './$slug',\n      params: { slug: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should navigate to a parent route', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      to: '..',\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate to a sibling route', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      from: '/posts/$slug',\n      to: '.',\n      params: { slug: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n\n  it('should navigate to a sibling route without from', async () => {\n    const { router } = createTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    )\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n\n    await router.navigate({\n      to: '.',\n      params: { slug: 'tkdodo' },\n    })\n\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tkdodo')\n  })\n})\n\ndescribe('splat routes with empty splat', () => {\n  it.each(Object.values(trailingSlashOptions))(\n    'should handle empty _splat parameter with trailingSlash: %s',\n    async (trailingSlash) => {\n      const tail = trailingSlash === 'always' ? '/' : ''\n\n      const history = createMemoryHistory({ initialEntries: ['/'] })\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n      })\n\n      const splatRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: 'splat/$',\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, splatRoute]),\n        history,\n        trailingSlash,\n      })\n\n      await router.load()\n\n      // All of these route params should navigate to the same location\n      const paramSets = [\n        {\n          _splat: '',\n        },\n        {\n          _splat: undefined,\n        },\n        {},\n      ]\n\n      for (const params of paramSets) {\n        await router.navigate({\n          to: '/splat/$',\n          params,\n        })\n        await router.invalidate()\n\n        await waitFor(() => {\n          expect(router.state.location.pathname).toBe(`/splat${tail}`)\n        })\n\n        // Navigate back to index\n        await router.navigate({ to: '/' })\n        await router.invalidate()\n      }\n    },\n  )\n})\n\ndescribe('router.navigate navigation using optional path parameters - object syntax for updates', () => {\n  function createOptionalParamTestRouter(initialHistory?: RouterHistory) {\n    const history =\n      initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    // Single optional parameter\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}',\n    })\n\n    // Multiple optional parameters\n    const articlesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/articles/{-$category}/{-$slug}',\n    })\n\n    // Mixed required and optional parameters\n    const projectRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/p/$projectId/{-$version}/{-$framework}',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      articlesRoute,\n      projectRoute,\n    ])\n    const router = createRouter({ routeTree, history })\n\n    return {\n      router,\n      routes: {\n        indexRoute,\n        postsRoute,\n        articlesRoute,\n        projectRoute,\n      },\n    }\n  }\n\n  it('should navigate from \"/posts/tech\" to \"/posts\" by setting category to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: { category: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate from \"/posts\" to \"/posts/tech\" by setting category', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: { category: 'tech' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tech')\n  })\n\n  it('should navigate from \"/posts/tech\" to \"/posts/news\" by changing category', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: { category: 'news' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/news')\n  })\n\n  it('should navigate without \"to\" path and set category to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      params: { category: undefined },\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should handle multiple optional parameters - set one to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/articles/tech/hello-world'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/articles/tech/hello-world')\n\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: { category: 'tech', slug: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles/tech')\n  })\n\n  it('should handle multiple optional parameters - set both to undefined', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/articles/tech/hello-world'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/articles/tech/hello-world')\n\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: { category: undefined, slug: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles')\n  })\n\n  it('should handle mixed required and optional parameters', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/{-$version}/{-$framework}',\n      params: { projectId: 'router', version: undefined, framework: 'vue' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/vue')\n  })\n\n  it('should carry over optional parameters from current route when using empty params', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    // Navigate to a different route with optional params\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: { category: 'news' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles/news')\n\n    // Navigate back to posts - should carry over 'news' from current params\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: {},\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/news')\n  })\n})\n\ndescribe('router.navigate navigation using optional path parameters - function syntax for updates', () => {\n  function createOptionalParamTestRouter(initialHistory?: RouterHistory) {\n    const history =\n      initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}',\n    })\n\n    const articlesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/articles/{-$category}/{-$slug}',\n    })\n\n    const projectRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/p/$projectId/{-$version}/{-$framework}',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      articlesRoute,\n      projectRoute,\n    ])\n    const router = createRouter({ routeTree, history })\n\n    return { router }\n  }\n\n  it('should navigate from \"/posts/tech\" to \"/posts\" by setting category to undefined using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: (p: any) => ({ ...p, category: undefined }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate from \"/posts/tech\" to \"/posts\" by setting category to undefined in function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: (p: any) => ({ ...p, category: undefined }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should navigate from \"/posts\" to \"/posts/tech\" by setting category using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: (p: any) => ({ ...p, category: 'tech' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/tech')\n  })\n\n  it('should navigate from \"/posts/tech\" to \"/posts/news\" by changing category using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: (p: any) => ({ ...p, category: 'news' }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/news')\n  })\n\n  it('should navigate without \"to\" path and set category to undefined using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    await router.navigate({\n      params: (p: any) => ({ ...p, category: undefined }),\n    } as any)\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts')\n  })\n\n  it('should handle multiple optional parameters - remove one using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/articles/tech/hello-world'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/articles/tech/hello-world')\n\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: (p: any) => ({ ...p, slug: undefined }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles/tech')\n  })\n\n  it('should handle multiple optional parameters - clear all using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/articles/tech/hello-world'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/articles/tech/hello-world')\n\n    await router.navigate({\n      to: '/articles/{-$category}/{-$slug}',\n      params: (p: any) => ({ ...p, category: undefined, slug: undefined }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles')\n  })\n\n  it('should handle mixed required and optional parameters using function', async () => {\n    const { router } = createOptionalParamTestRouter(\n      createMemoryHistory({ initialEntries: ['/p/router/v1/react'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/p/router/v1/react')\n\n    await router.navigate({\n      to: '/p/$projectId/{-$version}/{-$framework}',\n      params: (p: any) => ({\n        ...p,\n        projectId: 'router',\n        version: undefined,\n        framework: 'vue',\n      }),\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/p/router/vue')\n  })\n})\n\ndescribe('router.navigate navigation using optional path parameters - parameter inheritance and isolation', () => {\n  function createInheritanceTestRouter(initialHistory?: RouterHistory) {\n    const history =\n      initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    // Route with same optional param names but different paths\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts/{-$category}',\n    })\n\n    const articlesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/articles/{-$category}',\n    })\n\n    // Route with nested optional params\n    const docsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/docs/{-$version}',\n    })\n\n    const docsTopicRoute = createRoute({\n      getParentRoute: () => docsRoute,\n      path: '/{-$topic}',\n    })\n\n    const routeTree = rootRoute.addChildren([\n      indexRoute,\n      postsRoute,\n      articlesRoute,\n      docsRoute.addChildren([docsTopicRoute]),\n    ])\n    const router = createRouter({ routeTree, history })\n\n    return { router }\n  }\n\n  it('should carry over optional parameters between different routes with same param names', async () => {\n    const { router } = createInheritanceTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    // Navigate to articles without specifying category\n    await router.navigate({\n      to: '/articles/{-$category}',\n      params: {},\n    })\n    await router.invalidate()\n\n    // Should carry over 'tech' from current route params\n    expect(router.state.location.pathname).toBe('/articles/tech')\n  })\n\n  it('should properly handle navigation between routes with different optional param structures', async () => {\n    const { router } = createInheritanceTestRouter(\n      createMemoryHistory({ initialEntries: ['/posts/tech'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/posts/tech')\n\n    // Navigate to articles with explicit category\n    await router.navigate({\n      to: '/articles/{-$category}',\n      params: { category: 'news' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/articles/news')\n\n    // Navigate back to posts without explicit category removal\n    await router.navigate({\n      to: '/posts/{-$category}',\n      params: {},\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/posts/news')\n  })\n\n  it('should handle nested optional parameters correctly', async () => {\n    const { router } = createInheritanceTestRouter(\n      createMemoryHistory({ initialEntries: ['/docs/v1/getting-started'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/docs/v1/getting-started')\n\n    // Remove topic but keep version\n    await router.navigate({\n      to: '/docs/{-$version}/{-$topic}',\n      params: { version: 'v1', topic: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/docs/v1')\n\n    // Remove version but add topic\n    await router.navigate({\n      to: '/docs/{-$version}/{-$topic}',\n      params: { version: undefined, topic: 'api' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/docs/api')\n\n    // Remove both\n    await router.navigate({\n      to: '/docs/{-$version}/{-$topic}',\n      params: { version: undefined, topic: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/docs')\n  })\n})\n\ndescribe('router.navigate navigation using optional path parameters - edge cases and validations', () => {\n  function createEdgeCaseTestRouter(initialHistory?: RouterHistory) {\n    const history =\n      initialHistory ?? createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n\n    // Route with prefix/suffix\n    const filesRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/files/prefix{-$name}.txt',\n    })\n\n    // Route with all optional params\n    const dateRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/date/{-$year}/{-$month}/{-$day}',\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, filesRoute, dateRoute])\n    const router = createRouter({ routeTree, history })\n\n    return { router }\n  }\n\n  it('should handle optional parameters with prefix/suffix correctly', async () => {\n    const { router } = createEdgeCaseTestRouter(\n      createMemoryHistory({ initialEntries: ['/files/prefixdocument.txt'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/files/prefixdocument.txt')\n\n    // Remove the name parameter\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files')\n\n    // Add the name parameter back\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: 'report' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files/prefixreport.txt')\n  })\n\n  it('should handle route with all optional parameters', async () => {\n    const { router } = createEdgeCaseTestRouter(\n      createMemoryHistory({ initialEntries: ['/date/2024/03/15'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/date/2024/03/15')\n\n    // Remove day only\n    await router.navigate({\n      to: '/date/{-$year}/{-$month}/{-$day}',\n      params: { year: '2024', month: '03', day: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/date/2024/03')\n\n    // Remove month and day\n    await router.navigate({\n      to: '/date/{-$year}/{-$month}/{-$day}',\n      params: { year: '2024', month: undefined, day: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/date/2024')\n\n    // Remove all parameters\n    await router.navigate({\n      to: '/date/{-$year}/{-$month}/{-$day}',\n      params: { year: undefined, month: undefined, day: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/date')\n\n    // Add all parameters back\n    await router.navigate({\n      to: '/date/{-$year}/{-$month}/{-$day}',\n      params: { year: '2025', month: '12', day: '31' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/date/2025/12/31')\n  })\n\n  it('should handle empty string vs undefined distinction', async () => {\n    const { router } = createEdgeCaseTestRouter(\n      createMemoryHistory({ initialEntries: ['/files/prefix.txt'] }),\n    )\n\n    await router.load()\n    expect(router.state.location.pathname).toBe('/files/prefix.txt')\n\n    // Set name to empty string (should still include the param)\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: '' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files/prefix.txt')\n\n    // Set name to a value\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: 'test' },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files/prefixtest.txt')\n\n    // Set name to undefined (should remove the param)\n    await router.navigate({\n      to: '/files/prefix{-$name}.txt',\n      params: { name: undefined },\n    })\n    await router.invalidate()\n\n    expect(router.state.location.pathname).toBe('/files')\n  })\n})\n\ndescribe('encoded and unicode paths', () => {\n  const testCases = [\n    {\n      name: 'with prefix',\n      path: '/foo/prefix@대{$}',\n      expectedPath:\n        '/foo/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]',\n      expectedLocation: '/foo/prefix@대test[s%5C/.%5C/parameter%25!🚀%40]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with suffix',\n      path: '/foo/{$}대suffix@',\n      expectedPath:\n        '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80%40]%EB%8C%80suffix@',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀%40]대suffix@',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀@]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀@]',\n      },\n    },\n    {\n      name: 'with wildcard',\n      path: '/foo/$',\n      expectedPath: '/foo/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C/.%5C/parameter%25!🚀]',\n      params: {\n        _splat: 'test[s\\\\/.\\\\/parameter%!🚀]',\n        '*': 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n    // '/' is left as is with splat params but encoded with normal params\n    {\n      name: 'with path param',\n      path: `/foo/$id`,\n      expectedPath: '/foo/test[s%5C%2F.%5C%2Fparameter%25!%F0%9F%9A%80]',\n      expectedLocation: '/foo/test[s%5C%2F.%5C%2Fparameter%25!🚀]',\n      params: {\n        id: 'test[s\\\\/.\\\\/parameter%!🚀]',\n      },\n    },\n  ]\n\n  test.each(testCases)(\n    'should handle encoded, decoded paths with unicode characters correctly - $name',\n    async ({ path, expectedPath, expectedLocation, params }) => {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n      })\n\n      const pathRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path,\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, pathRoute]),\n        history: createMemoryHistory({ initialEntries: ['/'] }),\n      })\n\n      await router.load()\n      await router.navigate({ to: path, params })\n      await router.invalidate()\n\n      expect(router.state.location.href).toBe(expectedPath)\n      expect(router.state.location.pathname).toBe(expectedLocation)\n    },\n  )\n})\n"
  },
  {
    "path": "packages/solid-router/tests/not-found.test.tsx",
    "content": "import { afterEach, beforeEach, expect, test } from 'vitest'\nimport { cleanup, render, screen } from '@solidjs/testing-library'\n\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  notFound,\n  rootRouteId,\n} from '../src'\nimport type { NotFoundRouteProps, RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ntest.each([\n  {\n    notFoundMode: 'fuzzy' as const,\n    expectedNotFoundComponent: 'settings-not-found',\n  },\n  {\n    notFoundMode: 'root' as const,\n    expectedNotFoundComponent: 'root-not-found',\n  },\n])(\n  'correct notFoundComponent is rendered for mode=%s',\n  async ({ notFoundMode, expectedNotFoundComponent }) => {\n    const rootRoute = createRootRoute({\n      component: () => (\n        <div data-testid=\"root-component\">\n          <h1>Root Component</h1>\n          <div>\n            <Link data-testid=\"settings-link\" to=\"/settings/\">\n              link to settings\n            </Link>{' '}\n            <Link data-testid=\"non-existing-link\" to=\"/settings/does-not-exist\">\n              link to non-existing route\n            </Link>\n          </div>\n          <Outlet />\n        </div>\n      ),\n      notFoundComponent: () => (\n        <span data-testid=\"root-not-found\">Root Not Found Component</span>\n      ),\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div data-testid=\"index-component\">\n          <h2>Index Page</h2>\n        </div>\n      ),\n    })\n\n    const settingsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/settings',\n      notFoundComponent: () => (\n        <span data-testid=\"settings-not-found\">\n          Settings Not Found Component\n        </span>\n      ),\n      component: () => (\n        <div>\n          <p>Settings Page Layout</p>\n          <Outlet />\n        </div>\n      ),\n    })\n\n    const settingsIndexRoute = createRoute({\n      getParentRoute: () => settingsRoute,\n      path: '/',\n      component: () => (\n        <div data-testid=\"settings-index-component\">Settings Page</div>\n      ),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([\n        indexRoute,\n        settingsRoute.addChildren([settingsIndexRoute]),\n      ]),\n      history,\n      notFoundMode,\n    })\n\n    render(() => <RouterProvider router={router} />)\n    await router.load()\n    await screen.findByTestId('root-component')\n\n    const settingsLink = screen.getByTestId('settings-link')\n    settingsLink.click()\n\n    const settingsIndexComponent = await screen.findByTestId(\n      'settings-index-component',\n    )\n    expect(settingsIndexComponent).toBeInTheDocument()\n\n    const nonExistingLink = screen.getByTestId('non-existing-link')\n    nonExistingLink.click()\n\n    const notFoundComponent = await screen.findByTestId(\n      expectedNotFoundComponent,\n      {},\n      { timeout: 1000 },\n    )\n    expect(notFoundComponent).toBeInTheDocument()\n  },\n)\n\ntest('defaultNotFoundComponent and notFoundComponent receives data props via spread operator', async () => {\n  const isCustomData = (data: unknown): data is typeof customData => {\n    return 'message' in (data as typeof customData)\n  }\n\n  const customData = {\n    message: 'Custom not found message',\n  }\n\n  const DefaultNotFoundComponentWithProps = (props: NotFoundRouteProps) => (\n    <div data-testid=\"default-not-found-with-props\">\n      <span data-testid=\"message\">\n        {isCustomData(props.data) && <span>{props.data.message}</span>}\n      </span>\n    </div>\n  )\n\n  const rootRoute = createRootRoute({\n    component: () => (\n      <div data-testid=\"root-component\">\n        <h1>Root Component</h1>\n        <div>\n          <Link\n            data-testid=\"default-not-found-route-link\"\n            to=\"/default-not-found-route\"\n          >\n            link to default not found route\n          </Link>\n          <Link data-testid=\"not-found-route-link\" to=\"/not-found-route\">\n            link to not found route\n          </Link>\n        </div>\n        <Outlet />\n      </div>\n    ),\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: () => (\n      <div data-testid=\"index-component\">\n        <h2>Index Page</h2>\n      </div>\n    ),\n  })\n\n  const defaultNotFoundRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/default-not-found-route',\n    loader: () => {\n      throw notFound({ data: customData })\n    },\n    component: () => (\n      <div data-testid=\"default-not-found-route-component\">\n        Should not render\n      </div>\n    ),\n  })\n\n  const notFoundRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/not-found-route',\n    loader: () => {\n      throw notFound({ data: customData })\n    },\n    component: () => (\n      <div data-testid=\"not-found-route-component\">Should not render</div>\n    ),\n    notFoundComponent: (props) => (\n      <div data-testid=\"not-found-with-props\">\n        <span data-testid=\"message\">\n          {isCustomData(props.data) && <span>{props.data.message}</span>}\n        </span>\n      </div>\n    ),\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      indexRoute,\n      defaultNotFoundRoute,\n      notFoundRoute,\n    ]),\n    history,\n    defaultNotFoundComponent: DefaultNotFoundComponentWithProps,\n  })\n\n  render(() => <RouterProvider router={router} />)\n  await router.load()\n  await screen.findByTestId('root-component')\n\n  const defaultNotFoundRouteLink = screen.getByTestId(\n    'default-not-found-route-link',\n  )\n  defaultNotFoundRouteLink.click()\n\n  const defaultNotFoundComponent = await screen.findByTestId(\n    'default-not-found-with-props',\n    {},\n    { timeout: 1000 },\n  )\n  expect(defaultNotFoundComponent).toBeInTheDocument()\n\n  const defaultNotFoundComponentMessage = await screen.findByTestId('message')\n  expect(defaultNotFoundComponentMessage).toHaveTextContent(customData.message)\n\n  const notFoundRouteLink = screen.getByTestId('not-found-route-link')\n  notFoundRouteLink.click()\n\n  const notFoundComponent = await screen.findByTestId(\n    'not-found-with-props',\n    {},\n    { timeout: 1000 },\n  )\n  expect(notFoundComponent).toBeInTheDocument()\n\n  const errorMessageComponent = await screen.findByTestId('message')\n  expect(errorMessageComponent).toHaveTextContent(customData.message)\n})\n\ntest('beforeLoad notFound with routeId targets parent notFoundComponent', async () => {\n  const rootRoute = createRootRoute({\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"root-not-found\">Root not found</span>\n    ),\n  })\n\n  const parentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/parent',\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"parent-not-found\">Parent not found</span>\n    ),\n  })\n\n  const childRoute = createRoute({\n    getParentRoute: () => parentRoute,\n    path: '/child',\n    beforeLoad: () => {\n      throw notFound({ routeId: parentRoute.id })\n    },\n    component: () => <span data-testid=\"child-component\">Child</span>,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([parentRoute.addChildren([childRoute])]),\n    history,\n  })\n\n  render(() => <RouterProvider router={router} />)\n  await router.navigate({ to: '/parent/child' })\n\n  expect(await screen.findByTestId('parent-not-found')).toBeInTheDocument()\n  expect(screen.queryByTestId('child-component')).not.toBeInTheDocument()\n})\n\ntest('beforeLoad notFound with routeId targets parent boundary and preserves parent loader data', async () => {\n  const rootRoute = createRootRoute({\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"root-not-found\">Root not found</span>\n    ),\n  })\n\n  const parentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/parent',\n    loader: () => ({ message: 'ready' }),\n    component: () => <Outlet />,\n    notFoundComponent: () => {\n      const loaderData = parentRoute.useLoaderData()\n      return (\n        <span data-testid=\"parent-not-found-with-loader-data\">\n          {loaderData().message}\n        </span>\n      )\n    },\n  })\n\n  const childRoute = createRoute({\n    getParentRoute: () => parentRoute,\n    path: '/child',\n    beforeLoad: () => {\n      throw notFound({ routeId: parentRoute.id })\n    },\n    component: () => <span data-testid=\"child-component\">Child</span>,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([parentRoute.addChildren([childRoute])]),\n    history,\n  })\n\n  render(() => <RouterProvider router={router} />)\n  await router.navigate({ to: '/parent/child' })\n\n  expect(\n    await screen.findByTestId('parent-not-found-with-loader-data'),\n  ).toHaveTextContent('ready')\n  expect(screen.queryByTestId('child-component')).not.toBeInTheDocument()\n})\n\ntest('beforeLoad notFound with routeId targets root notFoundComponent', async () => {\n  const rootRoute = createRootRoute({\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"root-not-found\">Root not found</span>\n    ),\n  })\n\n  const parentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/parent',\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"parent-not-found\">Parent not found</span>\n    ),\n  })\n\n  const childRoute = createRoute({\n    getParentRoute: () => parentRoute,\n    path: '/child',\n    beforeLoad: () => {\n      throw notFound({ routeId: rootRouteId })\n    },\n    component: () => <span data-testid=\"child-component\">Child</span>,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([parentRoute.addChildren([childRoute])]),\n    history,\n  })\n\n  render(() => <RouterProvider router={router} />)\n  await router.navigate({ to: '/parent/child' })\n\n  expect(await screen.findByTestId('root-not-found')).toBeInTheDocument()\n  expect(screen.queryByTestId('child-component')).not.toBeInTheDocument()\n})\n\ntest('beforeLoad notFound with non-exact routeId falls back to root notFoundComponent', async () => {\n  const rootRoute = createRootRoute({\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"root-not-found\">Root not found</span>\n    ),\n  })\n\n  const parentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/parent',\n    component: () => <Outlet />,\n    notFoundComponent: () => (\n      <span data-testid=\"parent-not-found\">Parent not found</span>\n    ),\n  })\n\n  const childRoute = createRoute({\n    getParentRoute: () => parentRoute,\n    path: '/child',\n    beforeLoad: () => {\n      throw notFound({ routeId: `${parentRoute.id}/` as never })\n    },\n    component: () => <span data-testid=\"child-component\">Child</span>,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([parentRoute.addChildren([childRoute])]),\n    history,\n    notFoundMode: 'fuzzy',\n  })\n\n  render(() => <RouterProvider router={router} />)\n  await router.navigate({ to: '/parent/child' })\n\n  expect(await screen.findByTestId('root-not-found')).toBeInTheDocument()\n  expect(screen.queryByTestId('parent-not-found')).not.toBeInTheDocument()\n  expect(screen.queryByTestId('child-component')).not.toBeInTheDocument()\n})\n"
  },
  {
    "path": "packages/solid-router/tests/redirect.test.tsx",
    "content": "import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library'\n\nimport { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\n\nimport invariant from 'tiny-invariant'\nimport {\n  Link,\n  RouterProvider,\n  createBrowserHistory,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n  useRouter,\n} from '../src'\n\nimport { sleep } from './utils'\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\nconst WAIT_TIME = 100\n\ndescribe('redirect', () => {\n  describe('SPA', () => {\n    test('when `redirect` is thrown in `beforeLoad`', async () => {\n      const nestedLoaderMock = vi.fn()\n      const nestedFooLoaderMock = vi.fn()\n\n      const rootRoute = createRootRoute({})\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <div>\n              <h1>Index page</h1>\n              <Link to=\"/about\">link to about</Link>\n            </div>\n          )\n        },\n      })\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        beforeLoad: async () => {\n          await sleep(WAIT_TIME)\n          throw redirect({ to: '/nested/foo' })\n        },\n      })\n      const nestedRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/nested',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          nestedLoaderMock('nested')\n        },\n      })\n      const fooRoute = createRoute({\n        getParentRoute: () => nestedRoute,\n        path: '/foo',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          nestedFooLoaderMock('foo')\n        },\n        component: () => <div>Nested Foo page</div>,\n      })\n      const routeTree = rootRoute.addChildren([\n        nestedRoute.addChildren([fooRoute]),\n        aboutRoute,\n        indexRoute,\n      ])\n      const router = createRouter({ routeTree })\n\n      render(() => <RouterProvider router={router} />)\n\n      const linkToAbout = await screen.findByText('link to about')\n\n      expect(linkToAbout).toBeInTheDocument()\n\n      fireEvent.click(linkToAbout)\n\n      const fooElement = await screen.findByText('Nested Foo page')\n\n      expect(fooElement).toBeInTheDocument()\n\n      expect(router.state.location.href).toBe('/nested/foo')\n      expect(window.location.pathname).toBe('/nested/foo')\n\n      expect(nestedLoaderMock).toHaveBeenCalled()\n      expect(nestedFooLoaderMock).toHaveBeenCalled()\n    })\n\n    test('when `redirect` is thrown in `loader`', async () => {\n      const nestedLoaderMock = vi.fn()\n      const nestedFooLoaderMock = vi.fn()\n\n      const rootRoute = createRootRoute({})\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <div>\n              <h1>Index page</h1>\n              <Link to=\"/about\">link to about</Link>\n            </div>\n          )\n        },\n      })\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          throw redirect({\n            to: '/nested/foo',\n            hash: 'some-hash',\n            search: { someSearch: 'hello123' },\n          })\n        },\n      })\n      const nestedRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/nested',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          nestedLoaderMock('nested')\n        },\n      })\n      const fooRoute = createRoute({\n        validateSearch: (search) => {\n          return {\n            someSearch: search.someSearch as string,\n          }\n        },\n        getParentRoute: () => nestedRoute,\n        path: '/foo',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          nestedFooLoaderMock('foo')\n        },\n        component: () => <div>Nested Foo page</div>,\n      })\n      const routeTree = rootRoute.addChildren([\n        nestedRoute.addChildren([fooRoute]),\n        aboutRoute,\n        indexRoute,\n      ])\n      const router = createRouter({ routeTree })\n\n      render(() => <RouterProvider router={router} />)\n\n      const linkToAbout = await screen.findByText('link to about')\n\n      expect(linkToAbout).toBeInTheDocument()\n\n      fireEvent.click(linkToAbout)\n\n      const fooElement = await screen.findByText('Nested Foo page')\n\n      expect(fooElement).toBeInTheDocument()\n\n      expect(router.state.location.href).toBe(\n        '/nested/foo?someSearch=hello123#some-hash',\n      )\n      expect(window.location.pathname).toBe('/nested/foo')\n\n      expect(nestedLoaderMock).toHaveBeenCalled()\n      expect(nestedFooLoaderMock).toHaveBeenCalled()\n    })\n\n    test('when `redirect` is thrown in `loader` after `router.invalidate()`', async () => {\n      let shouldRedirect = false\n\n      const rootRoute = createRootRoute({})\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          return (\n            <div>\n              <h1>Index page</h1>\n              <Link data-testid=\"link-to-about\" to=\"/about\">\n                link to about\n              </Link>\n            </div>\n          )\n        },\n      })\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        loader: async () => {\n          await sleep(WAIT_TIME)\n          if (shouldRedirect) {\n            throw redirect({\n              to: '/final',\n            })\n          }\n        },\n        component: function Component() {\n          const router = useRouter()\n          return (\n            <button\n              data-testid=\"button-invalidate\"\n              onClick={() => {\n                shouldRedirect = true\n                router.invalidate()\n              }}\n            >\n              invalidate\n            </button>\n          )\n        },\n      })\n      const finalRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/final',\n        component: () => <div>Final</div>,\n      })\n\n      const routeTree = rootRoute.addChildren([\n        aboutRoute,\n        indexRoute,\n        finalRoute,\n      ])\n      const router = createRouter({ routeTree, history })\n\n      render(() => <RouterProvider router={router} />)\n\n      const linkToAbout = await screen.findByTestId('link-to-about')\n      expect(linkToAbout).toBeInTheDocument()\n\n      fireEvent.click(linkToAbout)\n\n      const invalidateButton = await screen.findByTestId('button-invalidate')\n      expect(invalidateButton).toBeInTheDocument()\n\n      fireEvent.click(invalidateButton)\n\n      expect(await screen.findByText('Final')).toBeInTheDocument()\n      expect(window.location.pathname).toBe('/final')\n    })\n  })\n\n  describe('SSR', () => {\n    test('when `redirect` is thrown in `beforeLoad`', async () => {\n      const rootRoute = createRootRoute()\n\n      const indexRoute = createRoute({\n        path: '/',\n        getParentRoute: () => rootRoute,\n        beforeLoad: () => {\n          throw redirect({\n            to: '/about',\n          })\n        },\n      })\n\n      const aboutRoute = createRoute({\n        path: '/about',\n        getParentRoute: () => rootRoute,\n        component: () => {\n          return 'About'\n        },\n      })\n\n      const router = createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, aboutRoute]),\n        // Mock server mode\n        isServer: true,\n        history: createMemoryHistory({\n          initialEntries: ['/'],\n        }),\n      })\n\n      await router.load()\n\n      expect(router.state.redirect).toBeDefined()\n      expect(router.state.redirect).toBeInstanceOf(Response)\n      invariant(router.state.redirect)\n\n      expect(router.state.redirect.options).toEqual({\n        _fromLocation: expect.objectContaining({\n          hash: '',\n          href: '/',\n          pathname: '/',\n          search: {},\n          searchStr: '',\n        }),\n        to: '/about',\n        href: '/about',\n        statusCode: 307,\n      })\n    })\n  })\n\n  test('when `redirect` is thrown in `loader`', async () => {\n    const rootRoute = createRootRoute()\n\n    const indexRoute = createRoute({\n      path: '/',\n      getParentRoute: () => rootRoute,\n      loader: () => {\n        throw redirect({\n          to: '/about',\n        })\n      },\n    })\n\n    const aboutRoute = createRoute({\n      path: '/about',\n      getParentRoute: () => rootRoute,\n      component: () => {\n        return 'About'\n      },\n    })\n\n    const router = createRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      routeTree: rootRoute.addChildren([indexRoute, aboutRoute]),\n      // Mock server mode\n      isServer: true,\n    })\n\n    await router.load()\n\n    const currentRedirect = router.state.redirect\n\n    expect(currentRedirect).toBeDefined()\n    expect(currentRedirect).toBeInstanceOf(Response)\n    invariant(currentRedirect)\n    expect(currentRedirect.status).toEqual(307)\n    expect(currentRedirect.headers.get('Location')).toEqual('/about')\n    expect(currentRedirect.options).toEqual({\n      _fromLocation: {\n        external: false,\n        publicHref: '/',\n        hash: '',\n        href: '/',\n        pathname: '/',\n        search: {},\n        searchStr: '',\n        state: {\n          __TSR_index: 0,\n          __TSR_key: currentRedirect.options._fromLocation!.state.__TSR_key,\n          key: currentRedirect.options._fromLocation!.state.key,\n        },\n      },\n      href: '/about',\n      to: '/about',\n      statusCode: 307,\n    })\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/route.test-d.tsx",
    "content": "import { expectTypeOf, test } from 'vitest'\nimport {\n  createRootRoute,\n  createRootRouteWithContext,\n  createRoute,\n  createRouter,\n  redirect,\n} from '../src'\nimport type { Accessor } from 'solid-js'\nimport type {\n  BuildLocationFn,\n  ControlledPromise,\n  NavigateFn,\n  NavigateOptions,\n  ParsedLocation,\n  SearchSchemaInput,\n} from '../src'\nimport type {\n  AnyRoute,\n  AnyRouter,\n  MakeRouteMatchFromRoute,\n  MakeRouteMatchUnion,\n} from '@tanstack/router-core'\n\ntest('when creating the root', () => {\n  const rootRoute = createRootRoute()\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n})\n\ntest('when creating the root with routeContext', () => {\n  const rootRoute = createRootRoute({\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {}\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n})\n\ntest('when creating the root with beforeLoad', () => {\n  const rootRoute = createRootRoute({\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {}\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n})\n\ntest('when creating the root with a loader', () => {\n  const rootRoute = createRootRoute({\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: {}\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: never\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n})\n\ntest('when creating the root route with context and routeContext', () => {\n  const createRouteResult = createRootRouteWithContext<{ userId: string }>()\n  const rootRoute = createRouteResult({\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n\n  const router = createRouter({\n    routeTree: rootRoute,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      userId: string\n    }>\n  >()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((context: { userId: string }) => unknown) | undefined>()\n})\n\ntest('when creating the root route with context and beforeLoad', () => {\n  const createRouteResult = createRootRouteWithContext<{ userId: string }>()\n\n  const rootRoute = createRouteResult({\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n\n  const router = createRouter({\n    routeTree: rootRoute,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      userId: string\n    }>\n  >()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((context: { userId: string }) => unknown) | undefined>()\n})\n\ntest('when creating the root route with context and a loader', () => {\n  const createRouteResult = createRootRouteWithContext<{ userId: string }>()\n\n  const rootRoute = createRouteResult({\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: { userId: string }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: never\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n\n  const router = createRouter({\n    routeTree: rootRoute,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      userId: string\n    }>\n  >()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((context: { userId: string }) => unknown) | undefined>()\n})\n\ntest('when creating the root route with context, routeContext, beforeLoad and a loader', () => {\n  const createRouteResult = createRootRouteWithContext<{ userId: string }>()\n\n  const rootRoute = createRouteResult({\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n\n      return {\n        env: 'env1' as const,\n      }\n    },\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; env: 'env1' }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '__root__'\n      }>()\n      return { permission: 'view' as const }\n    },\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: { userId: string; permission: 'view'; env: 'env1' }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: never\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n    },\n  })\n\n  expectTypeOf(rootRoute.fullPath).toEqualTypeOf<'/'>()\n  expectTypeOf(rootRoute.id).toEqualTypeOf<'__root__'>()\n  expectTypeOf(rootRoute.path).toEqualTypeOf<'/'>()\n\n  const router = createRouter({\n    routeTree: rootRoute,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      userId: string\n      permission: 'view'\n      env: 'env1'\n    }>\n  >()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((context: {\n          userId: string\n          permission: 'view'\n          env: 'env1'\n        }) => string)\n      | undefined\n    >()\n})\n\ntest('when creating a child route from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n  })\n\n  expectTypeOf(invoicesRoute.fullPath).toEqualTypeOf<'/invoices'>()\n  expectTypeOf(invoicesRoute.path).toEqualTypeOf<'invoices'>()\n  expectTypeOf(invoicesRoute.id).toEqualTypeOf<'/invoices'>()\n})\n\ntest('when creating a child route from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      userId: string\n    }>\n  >()\n\n  expectTypeOf(rootRoute.useRouteContext<typeof router>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((context: { userId: string }) => unknown) | undefined>()\n})\n\ntest('when creating a child route with routeContext from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n\n      return {\n        env: 'env1' as const,\n      }\n    },\n  })\n})\n\ntest('when creating a child route with beforeLoad from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n    },\n  })\n})\n\ntest('when creating a child route with a loader from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    loader: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: {}\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n      return [{ id: 'invoice1' }, { id: 'invoice2' }] as const\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((\n          search: readonly [\n            { readonly id: 'invoice1' },\n            { readonly id: 'invoice2' },\n          ],\n        ) => string)\n      | undefined\n    >()\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router>()).toEqualTypeOf<\n    Accessor<\n      readonly [{ readonly id: 'invoice1' }, { readonly id: 'invoice2' }]\n    >\n  >()\n})\n\ntest('when creating a child route with a loader from the root route with context', () => {\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        deps: {}\n        context: { userId: string }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n      return [{ id: 'invoice1' }, { id: 'invoice2' }] as const\n    },\n  })\n\n  const rootRoute = createRootRouteWithContext<{\n    userId: string\n  }>()()\n\n  const routeTree = rootRoute.addChildren([invoicesRoute])\n\n  const router = createRouter({\n    routeTree,\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router, string>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((\n          search: readonly [\n            { readonly id: 'invoice1' },\n            { readonly id: 'invoice2' },\n          ],\n        ) => string)\n      | undefined\n    >()\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router>()).toEqualTypeOf<\n    Accessor<\n      readonly [{ readonly id: 'invoice1' }, { readonly id: 'invoice2' }]\n    >\n  >()\n\n  expectTypeOf(invoicesRoute.useLoaderData<typeof router>()).toEqualTypeOf<\n    Accessor<\n      readonly [{ readonly id: 'invoice1' }, { readonly id: 'invoice2' }]\n    >\n  >()\n})\n\ntest('when creating a child route with search params from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      page: number\n    }>\n  >()\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((search: { page: number }) => number) | undefined>()\n})\n\ntest('when creating a child route with optional search params from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: (): { page?: number } => ({ page: 0 }),\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      page?: number\n    }>\n  >()\n\n  expectTypeOf(invoicesRoute.useSearch<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      ((search: { page?: number | undefined }) => number) | undefined\n    >()\n})\n\ntest('when creating a child route with params from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      invoiceId: string\n    }>\n  >()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((params: { invoiceId: string }) => number) | undefined>()\n})\n\ntest('when creating a child route with a splat param from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices/$',\n    getParentRoute: () => rootRoute,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      _splat?: string\n    }>\n  >()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<((params: { _splat?: string }) => number) | undefined>()\n})\n\ntest('when creating a child route with a param and splat param from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices/$invoiceId/$',\n    getParentRoute: () => rootRoute,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      invoiceId: string\n      _splat?: string\n    }>\n  >()\n\n  expectTypeOf(invoicesRoute.useParams<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      ((params: { invoiceId: string; _splat?: string }) => number) | undefined\n    >()\n})\n\ntest('when creating a child route with params, search and loader from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        deps: {}\n        context: {}\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>\n    },\n  })\n})\n\ntest('when creating a child route with params, search, loader and loaderDeps from the root route', () => {\n  const rootRoute = createRootRoute()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    loaderDeps: (deps) => ({ page: deps.search.page }),\n    loader: (opts) =>\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        deps: { page: number }\n        context: {}\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>(),\n  })\n})\n\ntest('when creating a child route with params, search, loader and loaderDeps from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    loaderDeps: (deps) => ({ page: deps.search.page }),\n    loader: (opts) =>\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        deps: { page: number }\n        context: { userId: string }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>(),\n  })\n})\n\ntest('when creating a child route with params, search with routeContext from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId'\n      }>()\n    },\n  })\n})\n\ntest('when creating a child route with params, search with beforeLoad from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toMatchTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        search: { page: number }\n        matches: Array<MakeRouteMatchUnion>\n      }>()\n    },\n  })\n})\n\ntest('when creating a child route with params, search with routeContext, beforeLoad and a loader from the root route with context', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    context: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId'\n      }>()\n      return {\n        env: 'env1',\n      }\n    },\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; env: string }\n        search: { page: number }\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId'\n      }>()\n      return { permission: 'view' } as const\n    },\n    loader: (opts) => {\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        deps: {}\n        context: { userId: string; env: string; readonly permission: 'view' }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<MakeRouteMatchFromRoute<typeof rootRoute>>\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>()\n    },\n  })\n})\n\ntest('when creating a child route with params from a parent with params', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices/$invoiceId',\n    getParentRoute: () => rootRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: '$detailId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([detailsRoute]),\n    ]),\n  })\n\n  expectTypeOf(detailsRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      invoiceId: string\n      detailId: string\n    }>\n  >()\n\n  expectTypeOf(detailsRoute.useParams<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      ((params: { invoiceId: string; detailId: string }) => number) | undefined\n    >()\n})\n\ntest('when creating a child route with search from a parent with search', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ invoicePage: 0 }),\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoicesRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([detailsRoute]),\n    ]),\n  })\n\n  expectTypeOf(detailsRoute.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      invoicePage: number\n      detailPage: number\n    }>\n  >()\n\n  expectTypeOf(detailsRoute.useSearch<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((params: { invoicePage: number; detailPage: number }) => number)\n      | undefined\n    >()\n})\n\ntest('when creating a child route with routeContext from a parent with routeContext', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n\n      return { invoiceId: 'invoiceId1' }\n    },\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoicesRoute,\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; invoiceId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/details'\n      }>()\n\n      return { detailId: 'detailId1' }\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([detailsRoute]),\n    ]),\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(detailsRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      userId: string\n      invoiceId: string\n      detailId: string\n    }>\n  >()\n\n  expectTypeOf(detailsRoute.useRouteContext<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((params: {\n          userId: string\n          invoiceId: string\n          detailId: string\n        }) => number)\n      | undefined\n    >()\n})\n\ntest('when creating a child route with beforeLoad from a parent with beforeLoad', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    beforeLoad: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n      return { invoiceId: 'invoiceId1' }\n    },\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoicesRoute,\n    beforeLoad: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; invoiceId: string }\n        search: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/details'\n      }>()\n      return { detailId: 'detailId1' }\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([detailsRoute]),\n    ]),\n    context: { userId: '123' },\n  })\n\n  expectTypeOf(detailsRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      userId: string\n      invoiceId: string\n      detailId: string\n    }>\n  >()\n\n  expectTypeOf(detailsRoute.useRouteContext<typeof router, number>)\n    .parameter(0)\n    .exclude<undefined>()\n    .toHaveProperty('select')\n    .toEqualTypeOf<\n      | ((params: {\n          userId: string\n          invoiceId: string\n          detailId: string\n        }) => number)\n      | undefined\n    >()\n})\n\ntest('when creating a child route with routeContext, beforeLoad, search, params, loaderDeps and loader', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n      return { env: 'env1' }\n    },\n    beforeLoad: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: {}\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: { userId: string; env: string }\n        search: { page: number }\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices'\n      }>()\n      return { invoicePermissions: ['view'] as const }\n    },\n  })\n\n  const invoiceRoute = createRoute({\n    path: '$invoiceId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoiceRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {\n          userId: string\n          env: string\n          invoicePermissions: readonly ['view']\n        }\n        deps: {}\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId/details'\n      }>()\n      return { detailEnv: 'detailEnv' }\n    },\n    beforeLoad: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {\n          detailEnv: string\n          userId: string\n          env: string\n          invoicePermissions: readonly ['view']\n        }\n        search: { page: number; detailPage: number }\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId/details'\n      }>()\n      return { detailsPermissions: ['view'] as const }\n    },\n  })\n\n  const detailRoute = createRoute({\n    path: '$detailId',\n    getParentRoute: () => detailsRoute,\n    loaderDeps: (deps) => ({\n      detailPage: deps.search.detailPage,\n      invoicePage: deps.search.page,\n    }),\n    context: (opt) => {\n      expectTypeOf(opt).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string; detailId: string }\n        location: ParsedLocation\n        navigate: NavigateFn\n        buildLocation: BuildLocationFn\n        cause: 'preload' | 'enter' | 'stay'\n        context: {\n          userId: string\n          env: string\n          invoicePermissions: readonly ['view']\n          detailEnv: string\n          detailsPermissions: readonly ['view']\n        }\n        deps: { detailPage: number; invoicePage: number }\n        matches: Array<MakeRouteMatchUnion>\n        routeId: '/invoices/$invoiceId/details/$detailId'\n      }>()\n      return { detailEnv: 'detailEnv' }\n    },\n    loader: (opts) =>\n      expectTypeOf(opts).toEqualTypeOf<{\n        abortController: AbortController\n        preload: boolean\n        params: { invoiceId: string; detailId: string }\n        deps: { detailPage: number; invoicePage: number }\n        context: {\n          userId: string\n          env: string\n          invoicePermissions: readonly ['view']\n          detailEnv: string\n          detailsPermissions: readonly ['view']\n        }\n        location: ParsedLocation\n        navigate: (opts: NavigateOptions<AnyRouter>) => Promise<void> | void\n        parentMatchPromise: Promise<\n          MakeRouteMatchFromRoute<typeof detailsRoute>\n        >\n        cause: 'preload' | 'enter' | 'stay'\n        route: AnyRoute\n      }>(),\n  })\n})\n\ntest('when creating a child route with context, search, params and beforeLoad', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    beforeLoad: () => ({ invoicePermissions: ['view'] as const }),\n  })\n\n  const invoiceRoute = createRoute({\n    path: '$invoiceId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoiceRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n    beforeLoad: () => ({ detailsPermissions: ['view'] as const }),\n  })\n\n  const detailRoute = createRoute({\n    path: '$detailId',\n    getParentRoute: () => detailsRoute,\n    beforeLoad: (opts) => {\n      expectTypeOf(opts).toMatchTypeOf<{\n        params: { detailId: string; invoiceId: string }\n        search: { detailPage: number; page: number }\n        context: {\n          userId: string\n          detailsPermissions: readonly ['view']\n          invoicePermissions: readonly ['view']\n        }\n      }>()\n      expectTypeOf(opts.buildLocation<Router, '.', '/'>)\n        .parameter(0)\n        .toHaveProperty('to')\n        .toEqualTypeOf<\n          | '.'\n          | './invoices'\n          | './invoices/$invoiceId'\n          | './invoices/$invoiceId/details'\n          | './invoices/$invoiceId/details/$detailId'\n          | undefined\n        >()\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([\n    invoicesRoute.addChildren([\n      invoiceRoute.addChildren([detailsRoute.addChildren([detailRoute])]),\n    ]),\n  ])\n\n  const router = createRouter({\n    routeTree,\n    context: { userId: 'userId' },\n  })\n\n  type Router = typeof router\n})\n\ntest('when creating a child route with context, search, params, loader, loaderDeps and onEnter, onStay, onLeave', () => {\n  const rootRoute = createRootRouteWithContext<{ userId: string }>()()\n\n  const invoicesRoute = createRoute({\n    path: 'invoices',\n    getParentRoute: () => rootRoute,\n    validateSearch: () => ({ page: 0 }),\n    beforeLoad: () => ({ invoicePermissions: ['view'] as const }),\n  })\n\n  const invoiceRoute = createRoute({\n    path: '$invoiceId',\n    getParentRoute: () => invoicesRoute,\n  })\n\n  const detailsRoute = createRoute({\n    path: 'details',\n    getParentRoute: () => invoiceRoute,\n    validateSearch: () => ({ detailPage: 0 }),\n    beforeLoad: () => ({ detailsPermissions: ['view'] as const }),\n  })\n\n  type TExpectedParams = { detailId: string; invoiceId: string }\n  type TExpectedSearch = { detailPage: number; page: number }\n  type TExpectedContext = {\n    userId: string\n    detailsPermissions: readonly ['view']\n    invoicePermissions: readonly ['view']\n    detailPermission: boolean\n  }\n  type TExpectedLoaderData = { detailLoader: 'detailResult' }\n  type TExpectedMatch = {\n    params: TExpectedParams\n    search: TExpectedSearch\n    context: TExpectedContext\n    loaderDeps: { detailPage: number; invoicePage: number }\n    beforeLoadPromise?: ControlledPromise<void>\n    loaderPromise?: ControlledPromise<void>\n    componentsPromise?: Promise<Array<void>>\n    loaderData?: TExpectedLoaderData\n  }\n\n  createRoute({\n    path: '$detailId',\n    getParentRoute: () => detailsRoute,\n    beforeLoad: () => ({ detailPermission: true }),\n    loaderDeps: (deps) => ({\n      detailPage: deps.search.detailPage,\n      invoicePage: deps.search.page,\n    }),\n    loader: () => ({ detailLoader: 'detailResult' }) as const,\n    onEnter: (match) => expectTypeOf(match).toMatchTypeOf<TExpectedMatch>(),\n    onStay: (match) => expectTypeOf(match).toMatchTypeOf<TExpectedMatch>(),\n    onLeave: (match) => expectTypeOf(match).toMatchTypeOf<TExpectedMatch>(),\n  })\n})\n\ntest('when creating a child route with parseParams and stringify params without params in path', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    parseParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{}>()\n      return params\n    },\n    stringifyParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{}>()\n      return params\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx).toHaveProperty('params').toEqualTypeOf<{}>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx).toHaveProperty('params').toEqualTypeOf<{}>()\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([invoicesRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{}>\n  >()\n})\n\ntest('when creating a child route with params.parse and params.stringify without params in path', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    params: {\n      parse: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{}>()\n        return params\n      },\n      stringify: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{}>()\n        return params\n      },\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx).toHaveProperty('params').toEqualTypeOf<{}>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx).toHaveProperty('params').toEqualTypeOf<{}>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{}>\n  >()\n})\n\ntest('when creating a child route with parseParams and stringifyParams with params in path', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    parseParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ invoiceId: string }>()\n      return { invoiceId: Number(params.invoiceId) }\n    },\n    stringifyParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ invoiceId: number }>()\n      return { invoiceId: params.invoiceId.toString() }\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoiceRoute]),\n  })\n\n  expectTypeOf(invoiceRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      invoiceId: number\n    }>\n  >()\n})\n\ntest('when creating a child route with params.parse and params.stringify with params in path', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    params: {\n      parse: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ invoiceId: string }>()\n        return { invoiceId: Number(params.invoiceId) }\n      },\n      stringify: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ invoiceId: number }>()\n        return { invoiceId: params.invoiceId.toString() }\n      },\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: invoicesRoute.addChildren([invoiceRoute]),\n  })\n\n  expectTypeOf(invoiceRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      invoiceId: number\n    }>\n  >()\n})\n\ntest('when creating a child route with parseParams and stringifyParams with merged params from parent', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    parseParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ invoiceId: string }>()\n      return { invoiceId: Number(params.invoiceId) }\n    },\n    stringifyParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ invoiceId: number }>()\n      return { invoiceId: params.invoiceId.toString() }\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n  })\n\n  const detailRoute = createRoute({\n    getParentRoute: () => invoiceRoute,\n    path: '$detailId',\n\n    parseParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{\n        detailId: string\n      }>()\n      return { detailId: Number(params.detailId) }\n    },\n    stringifyParams: (params) => {\n      expectTypeOf(params).toEqualTypeOf<{ detailId: number }>()\n      return { detailId: params.detailId.toString() }\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number; detailId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number; detailId: number }>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: invoicesRoute.addChildren([\n      invoiceRoute.addChildren([detailRoute]),\n    ]),\n  })\n\n  expectTypeOf(detailRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      detailId: number\n      invoiceId: number\n    }>\n  >()\n})\n\ntest('when creating a child route with params.parse and params.stringify with merged params from parent', () => {\n  const rootRoute = createRootRoute()\n\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n  })\n\n  const invoiceRoute = createRoute({\n    getParentRoute: () => invoicesRoute,\n    path: '$invoiceId',\n    params: {\n      parse: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ invoiceId: string }>()\n        return { invoiceId: Number(params.invoiceId) }\n      },\n      stringify: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ invoiceId: number }>()\n        return { invoiceId: params.invoiceId.toString() }\n      },\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number }>()\n    },\n  })\n\n  const detailRoute = createRoute({\n    getParentRoute: () => invoiceRoute,\n    path: '$detailId',\n    params: {\n      parse: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{\n          detailId: string\n        }>()\n        return { detailId: Number(params.detailId) }\n      },\n      stringify: (params) => {\n        expectTypeOf(params).toEqualTypeOf<{ detailId: number }>()\n        return { detailId: params.detailId.toString() }\n      },\n    },\n    beforeLoad: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number; detailId: number }>()\n    },\n    loader: (ctx) => {\n      expectTypeOf(ctx)\n        .toHaveProperty('params')\n        .toEqualTypeOf<{ invoiceId: number; detailId: number }>()\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([\n      invoicesRoute.addChildren([invoiceRoute.addChildren([detailRoute])]),\n    ]),\n  })\n\n  expectTypeOf(detailRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      detailId: number\n      invoiceId: number\n    }>\n  >()\n})\n\ntest('when routeContext throws', () => {\n  const rootRoute = createRootRoute()\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    context: () => {\n      throw redirect({ to: '/somewhere' })\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{}>\n  >()\n})\n\ntest('when beforeLoad throws', () => {\n  const rootRoute = createRootRoute()\n  const invoicesRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'invoices',\n    beforeLoad: () => {\n      throw redirect({ to: '/somewhere' })\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([invoicesRoute]),\n  })\n\n  expectTypeOf(invoicesRoute.useRouteContext<typeof router>()).toEqualTypeOf<\n    Accessor<{}>\n  >()\n})\n\ntest('when creating a child route with no explicit search input', () => {\n  const rootRoute = createRootRoute({\n    validateSearch: (input) => {\n      expectTypeOf(input).toEqualTypeOf<Record<string, unknown>>()\n      return {\n        page: 0,\n      }\n    },\n  })\n\n  const rootRouteWithContext = createRootRouteWithContext()({\n    validateSearch: (input) => {\n      expectTypeOf(input).toEqualTypeOf<Record<string, unknown>>()\n      return {\n        page: 0,\n      }\n    },\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    validateSearch: (input) => {\n      expectTypeOf(input).toEqualTypeOf<Record<string, unknown>>()\n      return {\n        page: 0,\n      }\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(rootRoute.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      page: number\n    }>\n  >()\n\n  expectTypeOf(indexRoute.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      page: number\n    }>\n  >()\n\n  expectTypeOf(rootRouteWithContext.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      page: number\n    }>\n  >()\n\n  const navigate = indexRoute.useNavigate()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ page: number }>()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ page: number }>()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ page: number }>()\n})\n\ntest('when creating a child route with an explicit search input', () => {\n  const rootRoute = createRootRoute({\n    validateSearch: (input: SearchSchemaInput & { input: string }) => {\n      return {\n        page: input.input,\n      }\n    },\n  })\n\n  const rootRouteWithContext = createRootRouteWithContext()({\n    validateSearch: (input: SearchSchemaInput & { input: string }) => {\n      return {\n        page: input.input,\n      }\n    },\n  })\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    validateSearch: (input: SearchSchemaInput & { input: string }) => {\n      return {\n        page: input.input,\n      }\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([indexRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(rootRoute.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      page: string\n    }>\n  >()\n\n  expectTypeOf(indexRoute.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      page: string\n    }>\n  >()\n\n  expectTypeOf(rootRouteWithContext.useSearch<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      page: string\n    }>\n  >()\n\n  const navigate = indexRoute.useNavigate()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .exclude<Function | boolean>()\n    .toEqualTypeOf<{ input: string }>()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .returns.toEqualTypeOf<{ input: string }>()\n\n  expectTypeOf(navigate<typeof router, '/', '/'>)\n    .parameter(0)\n    .toHaveProperty('search')\n    .parameter(0)\n    .toEqualTypeOf<{ page: string }>()\n})\n\ntest('when creating a route with a prefix and suffix', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'prefix{$postId}suffix',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      postId: string\n    }>\n  >()\n})\n\ntest('when creating a route with a optional prefix and suffix', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'prefix{-$postId}suffix',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      postId?: string\n    }>\n  >()\n})\n\ntest('when creating a route with a splat prefix and suffix', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'prefix{$}suffix',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      _splat?: string\n    }>\n  >()\n})\n\ntest('when creating a route with a splat, optional param and required param', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'docs/$docId/$/{-$detailId}/{$myFile}.pdf',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      docId: string\n      _splat?: string\n      myFile: string\n      detailId?: string\n    }>\n  >()\n})\n\ntest('when creating a route with a boundary splat, optional param and required param', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'docs/$docId/before{$}after/detail{-$detailId}/file-{$myFile}.pdf',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      docId: string\n      _splat?: string\n      myFile: string\n      detailId?: string\n    }>\n  >()\n})\n\ntest('when creating a route with a nested boundary splat, optional param and required param', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'docs/$docId/before{$}after/{-detail{$detailId}suffix}/file-{$myFile}.pdf',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      docId: string\n      _splat?: string\n      myFile: string\n      detailId?: string\n    }>\n  >()\n})\n\ntest('when creating a route with a nested boundary splat, optional param, required param and escaping', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: 'docs/$docId/before{$}after/{-detail{$detailId}suffix}[.$test]/file-{$myFile}[.]pdf/escape-param[$postId]',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{\n      docId: string\n      _splat?: string\n      myFile: string\n      detailId?: string\n    }>\n  >()\n})\n\ntest('when creating a route with escaped path param', () => {\n  const rootRoute = createRootRoute()\n\n  const prefixSuffixRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '[$postId]',\n  })\n\n  const routeTree = rootRoute.addChildren([prefixSuffixRoute])\n\n  const router = createRouter({ routeTree })\n\n  expectTypeOf(prefixSuffixRoute.useParams<typeof router>()).toEqualTypeOf<\n    Accessor<{}>\n  >()\n})\n"
  },
  {
    "path": "packages/solid-router/tests/route.test.tsx",
    "content": "import { cleanup, render, screen } from '@solidjs/testing-library'\nimport { afterEach, beforeEach, describe, expect, it, test, vi } from 'vitest'\n\nimport {\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  getRouteApi,\n} from '../src'\n\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\n\nafterEach(() => {\n  history.destroy()\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\ndescribe('getRouteApi', () => {\n  it('should have the useMatch hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useMatch).toBeDefined()\n  })\n\n  it('should have the useRouteContext hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useRouteContext).toBeDefined()\n  })\n\n  it('should have the useSearch hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useSearch).toBeDefined()\n  })\n\n  it('should have the useParams hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useParams).toBeDefined()\n  })\n\n  it('should have the useLoaderData hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useLoaderData).toBeDefined()\n  })\n\n  it('should have the useLoaderDeps hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useLoaderDeps).toBeDefined()\n  })\n\n  it('should have the useNavigate hook', () => {\n    const api = getRouteApi('foo')\n    expect(api.useNavigate).toBeDefined()\n  })\n})\n\ndescribe('createRoute has the same hooks as getRouteApi', () => {\n  const routeApi = getRouteApi('foo')\n  const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))\n  const route = createRoute({} as any)\n\n  it.each(hookNames.map((name) => [name]))(\n    'should have the \"%s\" hook defined',\n    (hookName) => {\n      expect(route[hookName as keyof typeof route]).toBeDefined()\n    },\n  )\n})\n\n/* disabled until HMR bug is fixed \ndescribe('throws invariant exception when trying to access properties before `createRouter` completed', () => {\n  function setup() {\n    const rootRoute = createRootRoute()\n\n    const IndexComponent = () => {\n      const navigate = useNavigate()\n      return (\n        <>\n          <h1>Index</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n          <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        </>\n      )\n    }\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: IndexComponent,\n    })\n\n    const postsRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/posts',\n      component: () => {\n        return (\n          <>\n            <h1>Posts</h1>\n          </>\n        )\n      },\n    })\n    const initRouter = () =>\n      createRouter({\n        routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n      })\n    return { initRouter, rootRoute, indexRoute, postsRoute }\n  }\n\n  it('to', () => {\n    const { initRouter, indexRoute, postsRoute } = setup()\n\n    const expectedError = `Invariant failed: trying to access property 'to' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`\n    expect(() => indexRoute.to).toThrowError(expectedError)\n    expect(() => postsRoute.to).toThrowError(expectedError)\n\n    initRouter()\n\n    expect(indexRoute.to).toBe('/')\n    expect(postsRoute.to).toBe('/posts')\n  })\n\n  it('fullPath', () => {\n    const { initRouter, indexRoute, postsRoute } = setup()\n\n    const expectedError = `trying to access property 'fullPath' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`\n    expect(() => indexRoute.fullPath).toThrowError(expectedError)\n    expect(() => postsRoute.fullPath).toThrowError(expectedError)\n\n    initRouter()\n\n    expect(indexRoute.fullPath).toBe('/')\n    expect(postsRoute.fullPath).toBe('/posts')\n  })\n\n  it('id', () => {\n    const { initRouter, indexRoute, postsRoute } = setup()\n\n    const expectedError = `Invariant failed: trying to access property 'id' on a route which is not initialized yet. Route properties are only available after 'createRouter' completed.`\n    expect(() => indexRoute.id).toThrowError(expectedError)\n    expect(() => postsRoute.id).toThrowError(expectedError)\n\n    initRouter()\n\n    expect(indexRoute.to).toBe('/')\n    expect(postsRoute.to).toBe('/posts')\n  })\n})\n*/\n\ndescribe('onEnter event', () => {\n  it('should have router context defined in router.load()', async () => {\n    const fn = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return <h1>Index</h1>\n      },\n      onEnter: ({ context }) => {\n        fn(context)\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    await router.load()\n\n    expect(fn).toHaveBeenCalledWith({ foo: 'bar' })\n  })\n\n  it('should have router context defined in <RouterProvider router={router} />', async () => {\n    const fn = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return <h1>Index</h1>\n      },\n      onEnter: ({ context }) => {\n        fn(context)\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    expect(fn).toHaveBeenCalledWith({ foo: 'bar' })\n  })\n})\n\ndescribe('useLoaderDeps', () => {\n  test('returns an Accessor', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loaderDeps: ({ search }) => ({ testDep: 'value' }),\n      component: () => {\n        const deps = indexRoute.useLoaderDeps()\n        // deps should be an Accessor, so we need to call it to get the value\n        expect(typeof deps).toBe('function')\n        expect(deps()).toEqual({ testDep: 'value' })\n        return <div>Index</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n  })\n\n  test('returns an Accessor via Route API', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loaderDeps: ({ search }) => ({ testDep: 'api-value' }),\n      component: () => {\n        const api = getRouteApi('/')\n        const deps = api.useLoaderDeps()\n        // deps should be an Accessor, so we need to call it to get the value\n        expect(typeof deps).toBe('function')\n        expect(deps()).toEqual({ testDep: 'api-value' })\n        return <div>Index with API</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index with API')\n    expect(indexElem).toBeInTheDocument()\n  })\n})\n\ndescribe('route.head', () => {\n  test('meta', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        meta: [\n          { title: 'Root' },\n          {\n            charSet: 'utf-8',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        meta: [{ title: 'Index' }],\n      }),\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    await router.load()\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const metaState = router.state.matches.map((m) => m.meta)\n    expect(metaState).toEqual([\n      [\n        { title: 'Root' },\n        {\n          charSet: 'utf-8',\n        },\n      ],\n      [{ title: 'Index' }],\n    ])\n  })\n\n  test('meta w/ loader', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        meta: [\n          { title: 'Root' },\n          {\n            charSet: 'utf-8',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        meta: [{ title: 'Index' }],\n      }),\n      loader: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 200))\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const metaState = router.state.matches.map((m) => m.meta)\n    expect(metaState).toEqual([\n      [\n        { title: 'Root' },\n        {\n          charSet: 'utf-8',\n        },\n      ],\n      [{ title: 'Index' }],\n    ])\n  })\n\n  test('scripts', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        scripts: [{ src: 'root.js' }, { src: 'root2.js' }],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        scripts: [{ src: 'index.js' }],\n      }),\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    await router.load()\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const scriptsState = router.state.matches.map((m) => m.headScripts)\n    expect(scriptsState).toEqual([\n      [{ src: 'root.js' }, { src: 'root2.js' }],\n      [{ src: 'index.js' }],\n    ])\n  })\n\n  test('scripts w/ loader', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        scripts: [{ src: 'root.js' }, { src: 'root2.js' }],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        scripts: [{ src: 'index.js' }],\n      }),\n      loader: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 200))\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const scriptsState = router.state.matches.map((m) => m.headScripts)\n    expect(scriptsState).toEqual([\n      [{ src: 'root.js' }, { src: 'root2.js' }],\n      [{ src: 'index.js' }],\n    ])\n  })\n\n  test('links', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        links: [{ href: 'root.css' }, { href: 'root2.css' }],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        links: [{ href: 'index.css' }],\n      }),\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    await router.load()\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const linksState = router.state.matches.map((m) => m.links)\n    expect(linksState).toEqual([\n      [{ href: 'root.css' }, { href: 'root2.css' }],\n      [{ href: 'index.css' }],\n    ])\n  })\n\n  test('links w/loader', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        links: [{ href: 'root.css' }, { href: 'root2.css' }],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        links: [{ href: 'index.css' }],\n      }),\n      loader: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 200))\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const linksState = router.state.matches.map((m) => m.links)\n    expect(linksState).toEqual([\n      [{ href: 'root.css' }, { href: 'root2.css' }],\n      [{ href: 'index.css' }],\n    ])\n  })\n\n  test('styles', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        styles: [\n          {\n            media: 'all and (min-width: 200px)',\n            children: '.inline-div { color: blue; }',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        styles: [\n          {\n            media: 'all and (min-width: 100px)',\n            children: '.inline-div { background-color: yellow; }',\n          },\n        ],\n      }),\n      component: () => <div class=\"inline-div\">Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    await router.load()\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const stylesState = router.state.matches.map((m) => m.styles)\n    expect(stylesState).toEqual([\n      [\n        {\n          media: 'all and (min-width: 200px)',\n          children: '.inline-div { color: blue; }',\n        },\n      ],\n      [\n        {\n          media: 'all and (min-width: 100px)',\n          children: '.inline-div { background-color: yellow; }',\n        },\n      ],\n    ])\n  })\n\n  test('styles w/loader', async () => {\n    const rootRoute = createRootRoute({\n      head: () => ({\n        styles: [\n          {\n            media: 'all and (min-width: 200px)',\n            children: '.inline-div { color: blue; }',\n          },\n        ],\n      }),\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      head: () => ({\n        styles: [\n          {\n            media: 'all and (min-width: 100px)',\n            children: '.inline-div { background-color: yellow; }',\n          },\n        ],\n      }),\n      loader: async () => {\n        await new Promise((resolve) => setTimeout(resolve, 200))\n      },\n      component: () => <div>Index</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n    render(() => <RouterProvider router={router} />)\n    const indexElem = await screen.findByText('Index')\n    expect(indexElem).toBeInTheDocument()\n\n    const stylesState = router.state.matches.map((m) => m.styles)\n    expect(stylesState).toEqual([\n      [\n        {\n          media: 'all and (min-width: 200px)',\n          children: '.inline-div { color: blue; }',\n        },\n      ],\n      [\n        {\n          media: 'all and (min-width: 100px)',\n          children: '.inline-div { background-color: yellow; }',\n        },\n      ],\n    ])\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/routeContext.test.tsx",
    "content": "import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library'\nimport { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'\nimport { z } from 'zod'\n\nimport { createEffect, onMount } from 'solid-js'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  createBrowserHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  redirect,\n} from '../src'\n\nimport { sleep } from './utils'\nimport type { RouterHistory } from '../src'\n\nlet history: RouterHistory\n\nbeforeEach(() => {\n  history = createBrowserHistory()\n  expect(window.location.pathname).toBe('/')\n})\nafterEach(() => {\n  history.destroy()\n  window.history.replaceState(null, 'root', '/')\n  vi.clearAllMocks()\n  vi.resetAllMocks()\n  cleanup()\n})\n\nconst WAIT_TIME = 150\n\ndescribe('context function', () => {\n  describe('context is executed', () => {\n    async function findByText(text: string) {\n      const element = await screen.findByText(text)\n      expect(element).toBeInTheDocument()\n    }\n\n    async function clickButton(name: string) {\n      const button = await screen.findByRole('button', {\n        name,\n      })\n      expect(button).toBeInTheDocument()\n      fireEvent.click(button)\n    }\n\n    test('when the path params change', async () => {\n      const mockContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => {\n          const navigate = indexRoute.useNavigate()\n          return (\n            <div>\n              <h1>Index page</h1>\n\n              <button\n                onClick={() =>\n                  navigate({ to: '/detail/$id', params: { id: 1 } })\n                }\n              >\n                detail-1\n              </button>\n            </div>\n          )\n        },\n      })\n      const detailRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/detail/$id',\n        params: {\n          parse: (p) => z.object({ id: z.coerce.number() }).parse(p),\n          stringify: (p) => ({ id: `${p.id}` }),\n        },\n        context: (args) => {\n          mockContextFn(args.params)\n        },\n        component: () => {\n          const id = detailRoute.useParams({ select: (params) => params.id })\n          const navigate = detailRoute.useNavigate()\n          return (\n            <div>\n              <h1>Detail page: {id()}</h1>\n              <button\n                onClick={() =>\n                  navigate({\n                    to: '/detail/$id',\n                    params: (p: any) => ({ ...p, id: p.id + 1 }),\n                  })\n                }\n              >\n                next\n              </button>\n            </div>\n          )\n        },\n      })\n\n      const routeTree = rootRoute.addChildren([indexRoute, detailRoute])\n      const router = createRouter({ routeTree, history })\n\n      await render(() => <RouterProvider router={router} />)\n\n      await findByText('Index page')\n      expect(mockContextFn).not.toHaveBeenCalled()\n\n      await clickButton('detail-1')\n\n      await findByText('Detail page: 1')\n      console.log(mockContextFn.mock.calls)\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({ id: 1 })\n      mockContextFn.mockClear()\n      await clickButton('next')\n\n      await findByText('Detail page: 2')\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({ id: 2 })\n      mockContextFn.mockClear()\n      await clickButton('next')\n\n      await findByText('Detail page: 3')\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({ id: 3 })\n      mockContextFn.mockClear()\n    })\n\n    test('when loader deps change', async () => {\n      const mockContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        validateSearch: z.object({\n          foo: z.string().optional(),\n          bar: z.string().optional(),\n        }),\n        path: '/',\n        loaderDeps: ({ search }) => ({ foo: search.foo }),\n        context: ({ deps }) => {\n          mockContextFn(deps)\n        },\n        component: () => {\n          const navigate = indexRoute.useNavigate()\n          return (\n            <div>\n              <h1>Index page</h1>\n              <h2>search: {JSON.stringify(indexRoute.useSearch()())}</h2>\n              <button\n                onClick={() => {\n                  navigate({ search: (p: any) => ({ ...p, foo: 'foo-1' }) })\n                }}\n              >\n                foo-1\n              </button>\n              <button\n                onClick={() => {\n                  navigate({ search: (p: any) => ({ ...p, foo: 'foo-2' }) })\n                }}\n              >\n                foo-2\n              </button>\n              <button\n                onClick={() => {\n                  navigate({ search: (p: any) => ({ ...p, bar: 'bar-1' }) })\n                }}\n              >\n                bar-1\n              </button>\n              <button\n                onClick={() => {\n                  navigate({ search: (p: any) => ({ ...p, bar: 'bar-2' }) })\n                }}\n              >\n                bar-2\n              </button>\n              <button\n                onClick={() => {\n                  navigate({ search: {} })\n                }}\n              >\n                clear\n              </button>\n            </div>\n          )\n        },\n      })\n\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history })\n\n      render(() => <RouterProvider router={router} />)\n\n      await findByText('Index page')\n      await findByText(`search: ${JSON.stringify({})}`)\n\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({})\n      mockContextFn.mockClear()\n\n      await clickButton('foo-1')\n      await findByText(`search: ${JSON.stringify({ foo: 'foo-1' })}`)\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({ foo: 'foo-1' })\n\n      mockContextFn.mockClear()\n      await clickButton('foo-1')\n      await findByText(`search: ${JSON.stringify({ foo: 'foo-1' })}`)\n      expect(mockContextFn).not.toHaveBeenCalled()\n\n      await clickButton('bar-1')\n      await findByText(\n        `search: ${JSON.stringify({ foo: 'foo-1', bar: 'bar-1' })}`,\n      )\n      expect(mockContextFn).not.toHaveBeenCalled()\n\n      await clickButton('foo-2')\n      await findByText(\n        `search: ${JSON.stringify({ foo: 'foo-2', bar: 'bar-1' })}`,\n      )\n      expect(mockContextFn).toHaveBeenCalledWith({ foo: 'foo-2' })\n      mockContextFn.mockClear()\n\n      await clickButton('bar-2')\n      await findByText(\n        `search: ${JSON.stringify({ foo: 'foo-2', bar: 'bar-2' })}`,\n      )\n      expect(mockContextFn).not.toHaveBeenCalled()\n\n      await clickButton('clear')\n      await findByText(`search: ${JSON.stringify({})}`)\n      expect(mockContextFn).toHaveBeenCalledOnce()\n      expect(mockContextFn).toHaveBeenCalledWith({})\n    })\n  })\n\n  describe('accessing values in the context function', () => {\n    test('receives an empty object', async () => {\n      const mockIndexContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => {\n          mockIndexContextFn(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history })\n\n      render(() => <RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexContextFn).toHaveBeenCalledWith({})\n    })\n\n    test('receives an empty object - with an empty object when creating the router', async () => {\n      const mockIndexContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => {\n          mockIndexContextFn(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history, context: {} })\n\n      render(() => <RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexContextFn).toHaveBeenCalledWith({})\n    })\n\n    test('receives valid values - with values added when creating the router', async () => {\n      const mockIndexContextFn = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => {\n          mockIndexContextFn(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'Router' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexContextFn).toHaveBeenCalledWith({ project: 'Router' })\n    })\n\n    test('receives valid values when updating the values in the parent route to be read in the child route', async () => {\n      const mockIndexContextFn = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: () => ({\n          project: 'Router',\n        }),\n      })\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => {\n          mockIndexContextFn(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({ routeTree, history })\n\n      render(() => <RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexContextFn).toHaveBeenCalledWith({ project: 'Router' })\n    })\n  })\n\n  describe('return values being available in beforeLoad', () => {\n    test('when returning an empty object in a regular route', async () => {\n      const mockIndexBeforeLoad = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: () => ({}),\n        beforeLoad: ({ context }) => {\n          mockIndexBeforeLoad(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexBeforeLoad).toHaveBeenCalledWith({ project: 'foo' })\n      expect(mockIndexBeforeLoad).toHaveBeenCalledTimes(1)\n    })\n\n    test('when updating the initial router context value in a regular route', async () => {\n      const mockIndexBeforeLoad = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => ({ ...context, project: 'Query' }),\n        beforeLoad: ({ context }) => {\n          mockIndexBeforeLoad(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const indexElement = await screen.findByText('Index page')\n      expect(indexElement).toBeInTheDocument()\n\n      expect(mockIndexBeforeLoad).toHaveBeenCalledWith({ project: 'Query' })\n      expect(mockIndexBeforeLoad).toHaveBeenCalledTimes(1)\n    })\n\n    test('when returning an empty object in the root route', async () => {\n      const mock = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: () => ({}),\n        beforeLoad: ({ context }) => {\n          mock(context)\n        },\n        component: () => <div>Root page</div>,\n      })\n      const routeTree = rootRoute.addChildren([])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Root page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mock).toHaveBeenCalledWith({ project: 'foo' })\n      expect(mock).toHaveBeenCalledTimes(1)\n    })\n\n    test('when updating the initial router context value in the parent route and in the child route', async () => {\n      const mockRootBeforeLoad = vi.fn()\n      const mockIndexBeforeLoad = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: ({ context }) => ({ ...context, project: 'Router' }),\n        beforeLoad: ({ context }) => {\n          mockRootBeforeLoad(context)\n        },\n        component: () => (\n          <div>\n            Root page <Outlet />\n          </div>\n        ),\n      })\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => ({ ...context, project: 'Query' }),\n        beforeLoad: ({ context }) => {\n          mockIndexBeforeLoad(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'bar' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const indexElement = await screen.findByText('Index page')\n      expect(indexElement).toBeInTheDocument()\n\n      expect(mockRootBeforeLoad).toHaveBeenCalledWith({ project: 'Router' })\n      expect(mockRootBeforeLoad).toHaveBeenCalledTimes(1)\n\n      expect(mockIndexBeforeLoad).toHaveBeenCalledWith({ project: 'Query' })\n      expect(mockIndexBeforeLoad).toHaveBeenCalledTimes(1)\n    })\n  })\n\n  describe('return values being available in loader', () => {\n    test('when returning an empty object in a regular route', async () => {\n      const mockIndexLoader = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: () => ({}),\n        loader: ({ context }) => {\n          mockIndexLoader(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Index page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockIndexLoader).toHaveBeenCalledWith({ project: 'foo' })\n      expect(mockIndexLoader).toHaveBeenCalledTimes(1)\n    })\n\n    test('when updating the initial router context value in a regular route', async () => {\n      const mockIndexLoader = vi.fn()\n\n      const rootRoute = createRootRoute()\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => ({ ...context, project: 'Query' }),\n        loader: ({ context }) => {\n          mockIndexLoader(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const indexElement = await screen.findByText('Index page')\n      expect(indexElement).toBeInTheDocument()\n\n      expect(mockIndexLoader).toHaveBeenCalledWith({ project: 'Query' })\n      expect(mockIndexLoader).toHaveBeenCalledTimes(1)\n    })\n\n    test('when returning an empty object in the root route', async () => {\n      const mockRootLoader = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: () => ({}),\n        loader: ({ context }) => {\n          mockRootLoader(context)\n        },\n        component: () => <div>Root page</div>,\n      })\n      const routeTree = rootRoute.addChildren([])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'foo' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const rootElement = await screen.findByText('Root page')\n      expect(rootElement).toBeInTheDocument()\n\n      expect(mockRootLoader).toHaveBeenCalledWith({ project: 'foo' })\n      expect(mockRootLoader).toHaveBeenCalledTimes(1)\n    })\n\n    test('when updating the initial router context value in the root route and in the child route', async () => {\n      const mockRootLoader = vi.fn()\n      const mockIndexLoader = vi.fn()\n\n      const rootRoute = createRootRoute({\n        context: ({ context }) => ({ ...context, project: 'Router' }),\n        loader: ({ context }) => {\n          mockRootLoader(context)\n        },\n        component: () => (\n          <div>\n            Root page <Outlet />\n          </div>\n        ),\n      })\n      const indexRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        context: ({ context }) => ({ ...context, project: 'Query' }),\n        loader: ({ context }) => {\n          mockIndexLoader(context)\n        },\n        component: () => <div>Index page</div>,\n      })\n      const routeTree = rootRoute.addChildren([indexRoute])\n      const router = createRouter({\n        routeTree,\n        history,\n        context: { project: 'bar' },\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const indexElement = await screen.findByText('Index page')\n      expect(indexElement).toBeInTheDocument()\n\n      expect(mockRootLoader).toHaveBeenCalledWith({ project: 'Router' })\n      expect(mockRootLoader).toHaveBeenCalledTimes(1)\n\n      expect(mockIndexLoader).toHaveBeenCalledWith({ project: 'Query' })\n      expect(mockIndexLoader).toHaveBeenCalledTimes(1)\n    })\n  })\n})\n\ndescribe('beforeLoad in the route definition', () => {\n  // Present at the root route\n  test('route context, present in the root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: ({ context }) => {\n        mock(context)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('route context (sleep), present in the root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Present at the index route\n  test('route context, present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: ({ context }) => {\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('route context (sleep), present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context that is updated at the root, is the same in the index route\n  test('modified route context, present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return {\n          ...context,\n          foo: 'sean',\n        }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'sean' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context the context is available after a redirect on first-load\n  test('on first-load, route context is present in the /about route after a redirect is thrown in the beforeLoad of the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n    expect(router.state.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('on first-load, route context is present in the /about route after a redirect is thrown in the loader of the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n    expect(router.state.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context the context is available after a redirect on navigate\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the beforeLoad of the /about route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/person')\n    expect(router.state.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the loader of the /about route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/person')\n    expect(router.state.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by /nested/about, is the same as its parent route /nested on navigate\n  test('nested destination on navigate, route context in the /nested/about route is correctly inherited from the /nested parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/nested/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/about',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/about')\n    expect(window.location.pathname).toBe('/nested/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by /nested/person route, is the same as its parent route /nested on navigate after a redirect /about\n  test('nested destination on navigate, when a redirect is thrown in beforeLoad in /about, the /nested/person route context is correctly inherited from its parent /nested', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('nested destination on navigate, when a redirect is thrown in loader in /about, the /nested/person route context is correctly inherited from parent /nested', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (index route) on first-load\n  test('_layout on first-load, route context in the index route is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([indexRoute]),\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on navigate\n  test('_layout on navigate, route context in the /about route is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/about',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on after a redirect on navigate\n  test('_layout on navigate, when a redirect is thrown in beforeLoad in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('_layout on navigate, when a redirect is thrown in loader in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('child route receives updated values after the values were previously returned by the child route and then updated by the parent route', async () => {\n    const mockIndexBeforeLoadFn = vi.fn()\n    let counter = 0\n\n    const rootRoute = createRootRoute({\n      beforeLoad: () => {\n        counter++\n        return {\n          counter,\n        }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: ({ context }) => {\n        mockIndexBeforeLoadFn(context)\n        return {\n          counter: context.counter,\n        }\n      },\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return (\n          <div>\n            <span data-testid=\"index-page\">Index page</span>\n            <span data-testid=\"counter\">{context().counter}</span>\n          </div>\n        )\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(() => <RouterProvider router={router} />)\n\n    const rootElement = await screen.findByTestId('index-page')\n    expect(rootElement).toBeInTheDocument()\n\n    async function check(expectedCounter: number) {\n      const counterElement = await screen.findByTestId('counter')\n      expect(counterElement).toHaveTextContent(`${expectedCounter}`)\n\n      expect(mockIndexBeforeLoadFn).toHaveBeenCalledWith({\n        counter: expectedCounter,\n      })\n    }\n\n    await check(1)\n    await router.invalidate()\n    await check(2)\n  })\n})\n\ndescribe('loader in the route definition', () => {\n  // Present at the root route\n  test('route context, present in the root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      loader: ({ context }) => {\n        mock(context)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('route context (sleep), present in the root route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Root page</div>,\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const rootElement = await screen.findByText('Root page')\n    expect(rootElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Present at the index route\n  test('route context, present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: ({ context }) => {\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('route context (sleep), present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context that is updated at the root, is the same in the index route\n  test('modified route context, present in the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return {\n          ...context,\n          foo: 'sean',\n        }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'sean' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // disabled test due to flakiness\n  test.skip(\"on navigate (with preload using router methods), loader isn't invoked with undefined context if beforeLoad is pending when navigation happens\", async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n    })\n    const aboutRoute = createRoute({\n      ssr: false,\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        return { mock }\n      },\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        expect(context.mock).toBe(mock)\n        context.mock()\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({\n      routeTree,\n      history,\n      context: { foo: 'bar' },\n    })\n\n    await router.load()\n\n    // Don't await, simulate user clicking before preload is done\n    router.preloadRoute(aboutRoute)\n\n    await router.navigate(aboutRoute)\n    await router.invalidate()\n\n    // Expect only a single call as the one from preload and the one from navigate are deduped\n    expect(mock).toHaveBeenCalledOnce()\n  })\n\n  test(\"on navigate (with preload), loader isn't invoked with undefined context if beforeLoad is pending when navigation happens\", async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\" preload=\"intent\">\n              link to about\n            </Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      ssr: false,\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        return { mock }\n      },\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        expect(context.mock).toBe(mock)\n        context.mock()\n      },\n      component: () => <div>About page</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({\n      routeTree,\n      history,\n      defaultPreload: 'intent',\n      context: { foo: 'bar' },\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n\n    // Don't await, simulate user clicking before preload is done\n    fireEvent.focus(linkToAbout)\n    fireEvent.click(linkToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n\n    // Expect only a single call as the one from preload and the one from navigate are deduped\n    expect(mock).toHaveBeenCalledOnce()\n  })\n\n  // Check if context the context is available after a redirect on first-load\n  test('on first-load, route context is present in the /about route after a redirect is thrown in beforeLoad of the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n    expect(router.state.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('on first-load, route context is present in the /about route after a redirect is thrown in loader of the index route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/about')\n    expect(router.state.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context the context is available after a redirect on navigate\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the beforeLoad of the /about route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/person')\n    expect(router.state.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the loader of the /about route', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/person')\n    expect(router.state.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a /nested/about, is the same as its parent route /nested on navigate\n  test('nested destination on navigate, route context in the /nested/about route is correctly inherited from the /nested parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/nested/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/about',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/about')\n    expect(window.location.pathname).toBe('/nested/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a /nested/person route, is the same as its parent route /nested on navigate after a redirect /about\n  test('nested destination on navigate, when a redirect is thrown in beforeLoad in /about, the /nested/person route context is correctly inherited from its parent /nested', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('nested destination on navigate, when a redirect is thrown in loader in /about, the /nested/person route context is correctly inherited from parent /nested', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'nested' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (index route) on first-load\n  test('_layout on first-load, route context in the index route is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Index page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([indexRoute]),\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const indexElement = await screen.findByText('Index page')\n    expect(indexElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on navigate\n  test('_layout on navigate, route context in the /about route is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/about',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>About page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const aboutElement = await screen.findByText('About page')\n    expect(aboutElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on after a redirect on navigate\n  test('_layout on navigate, when a redirect is thrown in beforeLoad in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n\n  test('_layout on navigate, when a redirect is thrown in loader in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const mock = vi.fn()\n\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n        return (\n          <div>\n            <h1>Index page</h1>\n            <button\n              onClick={() => {\n                navigate({ to: '/about' })\n              }}\n            >\n              button to about\n            </button>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      loader: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        mock(context)\n      },\n      component: () => <div>Person page</div>,\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const buttonToAbout = await screen.findByRole('button', {\n      name: 'button to about',\n    })\n    expect(buttonToAbout).toBeInTheDocument()\n    fireEvent.click(buttonToAbout)\n\n    const personElement = await screen.findByText('Person page')\n    expect(personElement).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(mock).toHaveBeenCalledWith({ foo: 'bar', layout: 'layout' })\n    expect(mock).toHaveBeenCalledTimes(1)\n  })\n})\n\ndescribe('useRouteContext in the component', () => {\n  // Present at the root route\n  test('route context, present in the root route', async () => {\n    const rootRoute = createRootRoute({\n      component: () => {\n        const context = rootRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('route context (sleep in beforeLoad), present in the root route', async () => {\n    const rootRoute = createRootRoute({\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n      },\n      component: () => {\n        const context = rootRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Note: This test passes in solid-router but fails in react-router, even\n  // though in issue (GitHub #6040), the bug manifests in both routers.\n  test('route context, (sleep in beforeLoad), with immediate navigation', async () => {\n    const contextValues: Array<{ data: string }> = []\n\n    const rootRoute = createRootRoute({\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        return { data: 'context-from-beforeLoad' }\n      },\n      shellComponent: () => {\n        const context = rootRoute.useRouteContext()\n\n        // Track context value at render time\n        createEffect(() => {\n          const contextValue: { data: string } = context()\n          contextValues.push(contextValue)\n        })\n\n        return <Outlet />\n      },\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const navigate = indexRoute.useNavigate()\n\n        // Navigate away immediately on mount\n        onMount(() => {\n          navigate({ to: '/other' })\n        })\n\n        return <div>Index page</div>\n      },\n    })\n\n    const otherRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/other',\n      component: () => <div>Other page</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, otherRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(() => <RouterProvider router={router} />)\n\n    // Wait for navigation to complete\n    await screen.findByText('Other page')\n\n    const allContextsValid = contextValues.every(\n      (c) => c.data === 'context-from-beforeLoad',\n    )\n    expect(allContextsValid).toBe(true)\n  })\n\n  test('route context (sleep in loader), present root route', async () => {\n    const rootRoute = createRootRoute({\n      loader: async () => {\n        await sleep(WAIT_TIME)\n      },\n      component: () => {\n        const context = rootRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Present at the index route\n  test('route context, present in the index route', async () => {\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const context = indexRoute.useRouteContext()\n\n        if (context === undefined) {\n          throw new Error('context is undefined')\n        }\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('route context (sleep in beforeLoad), present in the index route', async () => {\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n      },\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('route context (sleep in loader), present in the index route', async () => {\n    const rootRoute = createRootRoute({})\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n      },\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context that is updated at the root, is the same in the root route\n  test('modified route context, present in the root route', async () => {\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return {\n          ...context,\n          foo: 'sean',\n        }\n      },\n      component: () => {\n        const context = rootRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'sean' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if the context that is updated at the root, is the same in the index route\n  test('modified route context, present in the index route', async () => {\n    const rootRoute = createRootRoute({\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return {\n          ...context,\n          foo: 'sean',\n        }\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'sean' }))\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if the context that is available after a redirect on first-load\n  test('on first-load, route context is present in the /about route after a redirect is thrown in the beforeLoad of the index route', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => {\n        const context = aboutRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('on first-load, route context is present in the /about route after a redirect is thrown in the loader of the index route', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/about' })\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => {\n        const context = aboutRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([aboutRoute, indexRoute])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if the context that is available after a redirect on navigate\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the beforeLoad of the /about route', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n    expect(content).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n  })\n\n  test('on navigate, route context is present in the /person route after a redirect is thrown in the loader of the /about route', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      personRoute,\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(JSON.stringify({ foo: 'bar' }))\n    expect(content).toBeInTheDocument()\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n  })\n\n  // Check if context returned by /nested/about, is the same its parent /nested on navigate\n  test('nested destination on navigate, route context in the /nested/about route is correctly inherited from its parent /nested', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/nested/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n      component: () => <Outlet />,\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/about',\n      component: () => {\n        const context = aboutRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'nested' }),\n    )\n\n    expect(router.state.location.href).toBe('/nested/about')\n    expect(window.location.pathname).toBe('/nested/about')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on after a redirect on navigate\n  test('nested destination on navigate, when a redirect is thrown in beforeLoad in /about, the /nested/person route context is correctly inherited from its parent /nested', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n      component: () => <Outlet />,\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'nested' }),\n    )\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('nested destination on navigate, when a redirect is thrown in loader in /about, the /nested/person route context is correctly inherited from its parent /nested', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/nested/person' })\n      },\n    })\n    const nestedRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/nested',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'nested' }\n      },\n      component: () => <Outlet />,\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => nestedRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      nestedRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'nested' }),\n    )\n\n    expect(router.state.location.href).toBe('/nested/person')\n    expect(window.location.pathname).toBe('/nested/person')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context returned by a layout route, is the same its child route (index route) on first-load\n  test('_layout on first-load, route context in the index route is correctly inherited from the layout parent', async () => {\n    const rootRoute = createRootRoute()\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n      component: () => <Outlet />,\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/',\n      component: () => {\n        const context = indexRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([indexRoute]),\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'layout' }),\n    )\n\n    expect(router.state.location.href).toBe('/')\n    expect(window.location.pathname).toBe('/')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on navigate\n  test('_layout on navigate, route context in the /about route is correctly inherited from the layout parent', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n      component: () => <Outlet />,\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/about',\n      component: () => {\n        const context = aboutRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([aboutRoute]),\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'layout' }),\n    )\n\n    expect(router.state.location.href).toBe('/about')\n    expect(window.location.pathname).toBe('/about')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  // Check if context returned by a layout route, is the same its child route (about route) on after a redirect on navigate\n  test('_layout on navigate, when a redirect is thrown in beforeLoad in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      beforeLoad: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n      component: () => <Outlet />,\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'layout' }),\n    )\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(content).toBeInTheDocument()\n  })\n\n  test('_layout on navigate, when a redirect is thrown in loader in /about, the /person route context is correctly inherited from the layout parent', async () => {\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => {\n        return (\n          <div>\n            <h1>Index page</h1>\n            <Link to=\"/about\">link to about</Link>\n          </div>\n        )\n      },\n    })\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      loader: async () => {\n        await sleep(WAIT_TIME)\n        throw redirect({ to: '/person' })\n      },\n    })\n    const layoutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      id: '_layout',\n      beforeLoad: async ({ context }) => {\n        await sleep(WAIT_TIME)\n        return { ...context, layout: 'layout' }\n      },\n      component: () => <Outlet />,\n    })\n    const personRoute = createRoute({\n      getParentRoute: () => layoutRoute,\n      path: '/person',\n      component: () => {\n        const context = personRoute.useRouteContext()\n        return <div>{JSON.stringify(context())}</div>\n      },\n    })\n    const routeTree = rootRoute.addChildren([\n      layoutRoute.addChildren([personRoute]),\n      aboutRoute,\n      indexRoute,\n    ])\n    const router = createRouter({ routeTree, history, context: { foo: 'bar' } })\n\n    render(() => <RouterProvider router={router} />)\n\n    const linkToAbout = await screen.findByRole('link', {\n      name: 'link to about',\n    })\n    expect(linkToAbout).toBeInTheDocument()\n    fireEvent.click(linkToAbout)\n\n    const content = await screen.findByText(\n      JSON.stringify({ foo: 'bar', layout: 'layout' }),\n    )\n\n    expect(router.state.location.href).toBe('/person')\n    expect(window.location.pathname).toBe('/person')\n\n    expect(content).toBeInTheDocument()\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/router.test.tsx",
    "content": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'\nimport {\n  cleanup,\n  fireEvent,\n  render,\n  screen,\n  waitFor,\n} from '@solidjs/testing-library'\nimport { z } from 'zod'\nimport { composeRewrites, notFound } from '@tanstack/router-core'\nimport {\n  Link,\n  Outlet,\n  RouterProvider,\n  SearchParamError,\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n  useNavigate,\n} from '../src'\nimport { sleep } from './utils'\nimport type { StandardSchemaValidator } from '@tanstack/router-core'\nimport type {\n  AnyRoute,\n  AnyRouter,\n  RouterOptions,\n  ValidatorFn,\n  ValidatorObj,\n} from '../src'\n\nafterEach(() => {\n  vi.resetAllMocks()\n  window.history.replaceState(null, 'root', '/')\n  cleanup()\n})\n\nconst mockFn1 = vi.fn()\n\nexport function validateSearchParams<\n  TExpected extends Partial<Record<string, string>>,\n>(expected: TExpected, router: AnyRouter) {\n  const parsedSearch = new URLSearchParams(window.location.search)\n  expect(parsedSearch.size).toBe(Object.keys(expected).length)\n  for (const [key, value] of Object.entries(expected)) {\n    expect(parsedSearch.get(key)).toBe(value)\n  }\n  expect(router.state.location.search).toEqual(expected)\n}\n\nfunction createTestRouter(\n  options?: RouterOptions<AnyRoute, 'never', any, any, any>,\n) {\n  const rootRoute = createRootRoute({\n    validateSearch: z.object({ root: z.string().optional() }),\n    component: () => {\n      const search = rootRoute.useSearch()\n      return (\n        <>\n          <div data-testid=\"search-root\">{search().root ?? '$undefined'}</div>\n          <Outlet />\n        </>\n      )\n    },\n  })\n  const indexRoute = createRoute({ getParentRoute: () => rootRoute, path: '/' })\n  const usersRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/users',\n  })\n  const userRoute = createRoute({\n    getParentRoute: () => usersRoute,\n    path: '/$userId',\n  })\n  const userFilesRoute = createRoute({\n    getParentRoute: () => userRoute,\n    path: '/files/$fileId',\n  })\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n  })\n  const postIdRoute = createRoute({\n    getParentRoute: () => postsRoute,\n    path: '/$slug',\n  })\n  const topLevelSplatRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '$',\n  })\n  // This is simulates a user creating a `é.tsx` file using file-based routing\n  const pathSegmentEAccentRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/path-segment/é',\n  })\n  // This is simulates a user creating a `🚀.tsx` file using file-based routing\n  const pathSegmentRocketEmojiRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/path-segment/🚀',\n  })\n  const pathSegmentSoloSplatRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/solo-splat/$',\n  })\n  const pathSegmentLayoutSplatRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/layout-splat',\n  })\n  const pathSegmentLayoutSplatIndexRoute = createRoute({\n    getParentRoute: () => pathSegmentLayoutSplatRoute,\n    path: '/',\n  })\n  const pathSegmentLayoutSplatSplatRoute = createRoute({\n    getParentRoute: () => pathSegmentLayoutSplatRoute,\n    path: '$',\n  })\n  const protectedRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    id: '/_protected',\n  }).lazy(() => import('./lazy/normal').then((f) => f.Route('/_protected')))\n  const protectedLayoutRoute = createRoute({\n    getParentRoute: () => protectedRoute,\n    id: '/_layout',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) => f.Route('/_protected/_layout')),\n  )\n  const protectedFileBasedLayoutRoute = createRoute({\n    getParentRoute: () => protectedRoute,\n    id: '/_fileBasedLayout',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) =>\n      f.FileRoute('/_protected/_fileBasedLayout'),\n    ),\n  )\n  const protectedFileBasedLayoutParentRoute = createRoute({\n    getParentRoute: () => protectedFileBasedLayoutRoute,\n    path: '/fileBasedParent',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) =>\n      f.FileRoute('/_protected/_fileBasedLayout/fileBasedParent'),\n    ),\n  )\n  const protectedLayoutParentRoute = createRoute({\n    getParentRoute: () => protectedLayoutRoute,\n    path: '/parent',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) => f.Route('/_protected/_layout/parent')),\n  )\n  const protectedLayoutParentChildRoute = createRoute({\n    getParentRoute: () => protectedLayoutParentRoute,\n    path: '/child',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) =>\n      f.Route('/_protected/_layout/parent/child'),\n    ),\n  )\n  const protectedFileBasedLayoutParentChildRoute = createRoute({\n    getParentRoute: () => protectedFileBasedLayoutParentRoute,\n    path: '/child',\n  }).lazy(() =>\n    import('./lazy/normal').then((f) =>\n      f.FileRoute('/_protected/_fileBasedLayout/fileBasedParent/child'),\n    ),\n  )\n  const searchRoute = createRoute({\n    validateSearch: z.object({ search: z.string().optional() }),\n    getParentRoute: () => rootRoute,\n    path: 'search',\n    component: () => {\n      const search = searchRoute.useSearch()\n      return (\n        <>\n          <div data-testid=\"search-search\">\n            {search().search ?? '$undefined'}\n          </div>\n        </>\n      )\n    },\n  })\n  const searchWithDefaultRoute = createRoute({\n    getParentRoute: () => rootRoute,\n\n    path: 'searchWithDefault',\n  })\n  const searchWithDefaultIndexRoute = createRoute({\n    getParentRoute: () => searchWithDefaultRoute,\n    path: '/',\n    component: () => {\n      return (\n        <>\n          <Link\n            data-testid=\"link-without-params\"\n            to=\"/searchWithDefault/check\"\n            search={{ default: 'd1' }}\n          >\n            without params\n          </Link>\n          <Link\n            data-testid=\"link-with-optional-param\"\n            to=\"/searchWithDefault/check\"\n            search={{ optional: 'o1' }}\n          >\n            with optional param\n          </Link>\n          <Link\n            data-testid=\"link-with-default-param\"\n            to=\"/searchWithDefault/check\"\n            search={{ default: 'd2' }}\n          >\n            with default param\n          </Link>\n          <Link\n            data-testid=\"link-with-both-params\"\n            to=\"/searchWithDefault/check\"\n            search={{ optional: 'o1', default: 'd2' }}\n          >\n            with both params\n          </Link>\n        </>\n      )\n    },\n  })\n\n  const searchWithDefaultCheckRoute = createRoute({\n    validateSearch: z.object({\n      default: z.string().default('d1'),\n      optional: z.string().optional(),\n    }),\n    getParentRoute: () => searchWithDefaultRoute,\n    path: 'check',\n    component: () => {\n      const search = searchWithDefaultCheckRoute.useSearch()\n      return (\n        <>\n          <div data-testid=\"search-default\">{search().default}</div>\n          <div data-testid=\"search-optional\">\n            {search().optional ?? '$undefined'}\n          </div>\n        </>\n      )\n    },\n  })\n\n  const nestedSearchRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    validateSearch: z.object({ foo: z.string() }),\n    path: 'nested-search',\n  })\n\n  const nestedSearchChildRoute = createRoute({\n    getParentRoute: () => nestedSearchRoute,\n    validateSearch: z.object({ bar: z.string() }),\n    path: 'child',\n  })\n\n  const linksToItselfRoute = createRoute({\n    validateSearch: z.object({ search: z.string().optional() }),\n    getParentRoute: () => rootRoute,\n    path: 'linksToItself',\n    component: () => {\n      return (\n        <>\n          <Link to=\"/linksToItself\" data-testid=\"link\">\n            Click me\n          </Link>\n        </>\n      )\n    },\n  })\n\n  const routeTree = rootRoute.addChildren([\n    indexRoute,\n    usersRoute.addChildren([userRoute.addChildren([userFilesRoute])]),\n    postsRoute.addChildren([postIdRoute]),\n    pathSegmentEAccentRoute,\n    pathSegmentRocketEmojiRoute,\n    pathSegmentSoloSplatRoute,\n    topLevelSplatRoute,\n    pathSegmentLayoutSplatRoute.addChildren([\n      pathSegmentLayoutSplatIndexRoute,\n      pathSegmentLayoutSplatSplatRoute,\n    ]),\n    protectedRoute.addChildren([\n      protectedLayoutRoute.addChildren([\n        protectedLayoutParentRoute.addChildren([\n          protectedLayoutParentChildRoute,\n        ]),\n      ]),\n      protectedFileBasedLayoutRoute.addChildren([\n        protectedFileBasedLayoutParentRoute.addChildren([\n          protectedFileBasedLayoutParentChildRoute,\n        ]),\n      ]),\n    ]),\n    searchRoute,\n    searchWithDefaultRoute.addChildren([\n      searchWithDefaultIndexRoute,\n      searchWithDefaultCheckRoute,\n    ]),\n    nestedSearchRoute.addChildren([nestedSearchChildRoute]),\n    linksToItselfRoute,\n  ])\n\n  const router = createRouter({ routeTree, ...options })\n\n  return {\n    router,\n    routes: {\n      indexRoute,\n      postsRoute,\n      postIdRoute,\n      topLevelSplatRoute,\n      pathSegmentEAccentRoute,\n      pathSegmentRocketEmojiRoute,\n    },\n  }\n}\n\ndescribe('encoding: URL param segment for /posts/$slug', () => {\n  it('state.location.pathname, should have the params.slug value of \"tanner\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/tanner')\n  })\n\n  it('state.location.pathname, should have the params.slug value of \"🚀\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/🚀'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/🚀')\n  })\n\n  it('state.location.pathname, should have the params.slug value of \"100%25\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/100%25'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/100%25')\n  })\n\n  it('state.location.pathname, should have the params.slug value of \"100%26\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/100%26'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/100%26')\n  })\n\n  it('state.location.pathname, should have the params.slug value of \"%F0%9F%9A%80\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/%F0%9F%9A%80'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/posts/🚀')\n  })\n\n  it('state.location.pathname, should have the params.slug value of \"framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: [\n          '/posts/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n        ],\n      }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href).toBe(\n      '/posts/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n    )\n\n    expect(router.state.location.pathname).toBe(\n      '/posts/framework%2Freact%2Fguide%2Ffile-based-routing tanstack',\n    )\n  })\n\n  it('params.slug for the matched route, should be \"tanner\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/tanner'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('tanner')\n  })\n\n  it('params.slug for the matched route, should be \"🚀\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/🚀'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('🚀')\n  })\n\n  it('params.slug for the matched route, should be \"🚀\" instead of it being \"%F0%9F%9A%80\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/%F0%9F%9A%80'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('🚀')\n  })\n\n  it('params.slug for the matched route, should be \"100%\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/100%25'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('100%')\n  })\n\n  it('params.slug for the matched route, should be \"100&\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/100%26'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('100&')\n  })\n\n  it('params.slug for the matched route, should be \"100%100\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/100%25100'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('100%100')\n  })\n\n  it('params.slug for the matched route, should be \"100&100\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/posts/100%26100'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe('100&100')\n  })\n\n  it('params.slug for the matched route, should be \"framework/react/guide/file-based-routing tanstack\" instead of it being \"framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: [\n          '/posts/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n        ],\n      }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.postIdRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any).slug).toBe(\n      'framework/react/guide/file-based-routing tanstack',\n    )\n  })\n\n  it('params.slug should be encoded in the final URL', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    await router.load()\n    render(() => <RouterProvider router={router} />)\n\n    await router.navigate({ to: '/posts/$slug', params: { slug: '@jane' } })\n\n    expect(router.state.location.pathname).toBe('/posts/%40jane')\n  })\n\n  it('params.slug should be encoded in the final URL except characters in pathParamsAllowedCharacters', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n      pathParamsAllowedCharacters: ['@'],\n    })\n\n    await router.load()\n    render(() => <RouterProvider router={router} />)\n\n    await router.navigate({ to: '/posts/$slug', params: { slug: '@jane' } })\n\n    expect(router.state.location.pathname).toBe('/posts/@jane')\n  })\n})\n\ndescribe('encoding: URL splat segment for /$', () => {\n  it('state.location.pathname, should have the params._splat value of \"tanner\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/tanner'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/tanner')\n  })\n\n  it('state.location.pathname, should have the params._splat value of \"🚀\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/🚀'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href).toBe('/%F0%9F%9A%80')\n    expect(router.state.location.pathname).toBe('/🚀')\n  })\n\n  it('state.location.pathname, should have the params._splat value of \"100%25\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/100%25'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/100%25')\n  })\n\n  it('state.location.pathname, should have the params._splat value of \"100%26\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/100%26'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.pathname).toBe('/100%26')\n  })\n\n  it('state.location.pathname, should have the params._splat value of \"%F0%9F%9A%80\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/%F0%9F%9A%80'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href).toBe('/%F0%9F%9A%80')\n    expect(router.state.location.pathname).toBe('/🚀')\n  })\n\n  it('state.location.pathname, should have the params._splat value of \"framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: [\n          '/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n        ],\n      }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href).toBe(\n      '/framework%2Freact%2Fguide%2Ffile-based-routing%20tanstack',\n    )\n    expect(router.state.location.pathname).toBe(\n      '/framework%2Freact%2Fguide%2Ffile-based-routing tanstack',\n    )\n  })\n\n  it('state.location.pathname, should have the params._splat value of \"framework/react/guide/file-based-routing tanstack\"', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/framework/react/guide/file-based-routing tanstack'],\n      }),\n    })\n\n    await router.load()\n\n    expect(router.state.location.href).toBe(\n      '/framework/react/guide/file-based-routing%20tanstack',\n    )\n\n    expect(router.state.location.pathname).toBe(\n      '/framework/react/guide/file-based-routing tanstack',\n    )\n  })\n\n  it('params._splat for the matched route, should be \"tanner\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/tanner'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.topLevelSplatRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any)._splat).toBe('tanner')\n  })\n\n  it('params._splat for the matched route, should be \"🚀\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/🚀'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.topLevelSplatRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any)._splat).toBe('🚀')\n  })\n\n  it('params._splat for the matched route, should be \"🚀\" instead of it being \"%F0%9F%9A%80\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/%F0%9F%9A%80'] }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.topLevelSplatRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any)._splat).toBe('🚀')\n  })\n\n  it('params._splat for the matched route, should be \"framework/react/guide/file-based-routing tanstack\"', async () => {\n    const { router, routes } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/framework/react/guide/file-based-routing tanstack'],\n      }),\n    })\n\n    await router.load()\n\n    const match = router.state.matches.find(\n      (r) => r.routeId === routes.topLevelSplatRoute.id,\n    )\n\n    if (!match) {\n      throw new Error('No match found')\n    }\n\n    expect((match.params as unknown as any)._splat).toBe(\n      'framework/react/guide/file-based-routing tanstack',\n    )\n  })\n})\n\ndescribe('encoding: URL path segment', () => {\n  it.each([\n    {\n      input: '/path-segment/%C3%A9',\n      path: '/path-segment/é',\n      url: '/path-segment/%C3%A9',\n    },\n    {\n      input: '/path-segment/é',\n      path: '/path-segment/é',\n      url: '/path-segment/%C3%A9',\n    },\n    {\n      input: '/path-segment/100%25', // `%25` = `%`\n      path: '/path-segment/100%25',\n      url: '/path-segment/100%25',\n    },\n    {\n      input: '/path-segment/100%25%25',\n      path: '/path-segment/100%25%25',\n      url: '/path-segment/100%25%25',\n    },\n    {\n      input: '/path-segment/100%26', // `%26` = `&`\n      path: '/path-segment/100%26',\n      url: '/path-segment/100%26',\n    },\n    {\n      input: '/path-segment/%F0%9F%9A%80',\n      path: '/path-segment/🚀',\n      url: '/path-segment/%F0%9F%9A%80',\n    },\n    {\n      input: '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon',\n      path: '/path-segment/🚀to%2Fthe%2Fmoon',\n      url: '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon',\n    },\n    {\n      input: '/path-segment/%25%F0%9F%9A%80to%2Fthe%2Fmoon',\n      path: '/path-segment/%25🚀to%2Fthe%2Fmoon',\n      url: '/path-segment/%25%F0%9F%9A%80to%2Fthe%2Fmoon',\n    },\n    {\n      input: '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon%25',\n      path: '/path-segment/🚀to%2Fthe%2Fmoon%25',\n      url: '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon%25',\n    },\n    {\n      input:\n        '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon%25%F0%9F%9A%80to%2Fthe%2Fmoon',\n      path: '/path-segment/🚀to%2Fthe%2Fmoon%25🚀to%2Fthe%2Fmoon',\n      url: '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon%25%F0%9F%9A%80to%2Fthe%2Fmoon',\n    },\n    {\n      input: '/path-segment/🚀',\n      path: '/path-segment/🚀',\n      url: '/path-segment/%F0%9F%9A%80',\n    },\n    {\n      input: '/path-segment/🚀to%2Fthe%2Fmoon',\n      path: '/path-segment/🚀to%2Fthe%2Fmoon',\n      url: '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon',\n    },\n  ])('should resolve $input to $output', async ({ input, path, url }) => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: [input] }),\n    })\n\n    render(() => <RouterProvider router={router} />)\n    await router.load()\n\n    expect(router.state.location.pathname).toBe(path)\n    expect(router.state.location.href).toBe(url)\n  })\n})\n\ndescribe('router emits events during rendering', () => {\n  it('during initial load, should emit the \"onResolved\" event', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const unsub = router.subscribe('onResolved', mockFn1)\n    await router.load()\n    render(() => <RouterProvider router={router} />)\n\n    await waitFor(() => expect(mockFn1).toBeCalled())\n    unsub()\n  })\n\n  it('after a navigation, should have emitted the \"onResolved\" event twice', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const unsub = router.subscribe('onResolved', mockFn1)\n    await router.load()\n    await render(() => <RouterProvider router={router} />)\n    await sleep(0)\n    await router.navigate({ to: '/$', params: { _splat: 'tanner' } })\n\n    await waitFor(() => expect(mockFn1).toBeCalledTimes(2))\n    unsub()\n  })\n\n  it('should emit the \"onRendered\" event when a route renders, after navigation, and after param/search updates', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n      scrollRestoration: true,\n    })\n\n    const mockOnRendered = vi.fn()\n    const unsub = router.subscribe('onRendered', mockOnRendered)\n    await router.load()\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(0))\n    render(() => <RouterProvider router={router} />)\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(1))\n    expect(mockOnRendered.mock.calls[0]?.[0]?.toLocation.pathname).toBe('/')\n\n    await router.navigate({ to: '/posts/$slug', params: { slug: 'first' } })\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(2))\n    expect(mockOnRendered.mock.calls[1]?.[0]?.toLocation.pathname).toBe(\n      '/posts/first',\n    )\n\n    await router.navigate({ to: '/posts/$slug', params: { slug: 'second' } })\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(3))\n    expect(mockOnRendered.mock.calls[2]?.[0]?.toLocation.pathname).toBe(\n      '/posts/second',\n    )\n\n    await router.navigate({\n      to: '/posts/$slug',\n      params: { slug: 'second' },\n      search: { root: 'search-change' },\n    })\n\n    await waitFor(() => expect(mockOnRendered).toBeCalledTimes(4))\n    expect(mockOnRendered.mock.calls[3]?.[0]?.toLocation.search.root).toBe(\n      'search-change',\n    )\n\n    unsub()\n  })\n\n  it('during initial load, should emit the \"onBeforeRouteMount\" and \"onResolved\" events in the correct order', async () => {\n    const mockOnBeforeRouteMount = vi.fn()\n    const mockOnResolved = vi.fn()\n\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    // Subscribe to the events\n    const unsubBeforeRouteMount = router.subscribe(\n      'onBeforeRouteMount',\n      mockOnBeforeRouteMount,\n    )\n    const unsubResolved = router.subscribe('onResolved', mockOnResolved)\n\n    await router.load()\n    render(() => <RouterProvider router={router} />)\n\n    // Ensure the \"onBeforeRouteMount\" event was called once\n    await waitFor(() => expect(mockOnBeforeRouteMount).toBeCalledTimes(1))\n\n    // Ensure the \"onResolved\" event was also called once\n    await waitFor(() => expect(mockOnResolved).toBeCalledTimes(1))\n\n    // Check if the invocation call orders are defined before comparing\n    const beforeRouteMountOrder =\n      mockOnBeforeRouteMount.mock.invocationCallOrder[0]\n    const onResolvedOrder = mockOnResolved.mock.invocationCallOrder[0]\n\n    if (beforeRouteMountOrder !== undefined && onResolvedOrder !== undefined) {\n      expect(beforeRouteMountOrder).toBeLessThan(onResolvedOrder)\n    } else {\n      throw new Error('onBeforeRouteMount should be emitted before onResolved.')\n    }\n\n    unsubBeforeRouteMount()\n    unsubResolved()\n  })\n})\n\ndescribe('router matches URLs to route definitions', () => {\n  it('solo splat route matches index route', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/solo-splat'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.routeId)).toEqual([\n      '__root__',\n      '/solo-splat/$',\n    ])\n  })\n\n  it('solo splat route matches with splat', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/solo-splat/test'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.routeId)).toEqual([\n      '__root__',\n      '/solo-splat/$',\n    ])\n  })\n\n  it('layout splat route matches with splat', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/layout-splat/test'] }),\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.routeId)).toEqual([\n      '__root__',\n      '/layout-splat',\n      '/layout-splat/$',\n    ])\n  })\n\n  it('nested path params', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({\n        initialEntries: ['/users/5678/files/123'],\n      }),\n    })\n\n    await router.load()\n\n    expect(router.state.matches.map((d) => d.routeId)).toEqual([\n      '__root__',\n      '/users',\n      '/users/$userId',\n      '/users/$userId/files/$fileId',\n    ])\n  })\n})\n\ndescribe('matches', () => {\n  describe('params', () => {\n    it('/users/$userId/files/$fileId', async () => {\n      const { router } = createTestRouter({\n        history: createMemoryHistory({\n          initialEntries: ['/users/5678/files/123'],\n        }),\n      })\n\n      await router.load()\n\n      const expectedStrictParams: Record<string, unknown> = {\n        __root__: {},\n        '/users': {},\n        '/users/$userId': { userId: '5678' },\n        '/users/$userId/files/$fileId': { userId: '5678', fileId: '123' },\n      }\n\n      expect(router.state.matches.length).toEqual(\n        Object.entries(expectedStrictParams).length,\n      )\n      router.state.matches.forEach((match) => {\n        expect(match.params).toEqual(\n          expectedStrictParams['/users/$userId/files/$fileId'],\n        )\n      })\n      router.state.matches.forEach((match) => {\n        expect(match._strictParams).toEqual(expectedStrictParams[match.routeId])\n      })\n    })\n  })\n\n  describe('search', () => {\n    it('/nested-search/child?foo=hello&bar=world', async () => {\n      const { router } = createTestRouter({\n        history: createMemoryHistory({\n          initialEntries: ['/nested-search/child?foo=hello&bar=world'],\n        }),\n      })\n\n      await router.load()\n\n      const expectedStrictSearch: Record<string, unknown> = {\n        __root__: {},\n        '/nested-search': { foo: 'hello' },\n        '/nested-search/child': { foo: 'hello', bar: 'world' },\n      }\n\n      expect(router.state.matches.length).toEqual(\n        Object.entries(expectedStrictSearch).length,\n      )\n      router.state.matches.forEach((match) => {\n        expect(match.search).toEqual(\n          expectedStrictSearch['/nested-search/child'],\n        )\n      })\n      router.state.matches.forEach((match) => {\n        expect(match._strictSearch).toEqual(expectedStrictSearch[match.routeId])\n      })\n    })\n  })\n})\n\ndescribe('invalidate', () => {\n  it('after router.invalid(), routes should be `valid` again after loading', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    await router.load()\n\n    router.state.matches.forEach((match) => {\n      expect(match.invalid).toBe(false)\n    })\n\n    await router.invalidate()\n\n    router.state.matches.forEach((match) => {\n      expect(match.invalid).toBe(false)\n    })\n  })\n\n  it('re-runs loaders that throw notFound() when invalidated via HMR filter', async () => {\n    const history = createMemoryHistory({\n      initialEntries: ['/hmr-not-found'],\n    })\n    const loader = vi.fn(() => {\n      throw notFound()\n    })\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const hmrRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/hmr-not-found',\n      loader,\n      component: () => <div data-testid=\"hmr-route\">Route</div>,\n      notFoundComponent: () => (\n        <div data-testid=\"hmr-route-not-found\">Route Not Found</div>\n      ),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([hmrRoute]),\n      history,\n    })\n\n    render(() => <RouterProvider router={router} />)\n    await router.load()\n\n    await screen.findByTestId('hmr-route-not-found')\n    const initialCalls = loader.mock.calls.length\n    expect(initialCalls).toBeGreaterThan(0)\n\n    await router.invalidate({\n      filter: (match) => match.routeId === hmrRoute.id,\n    })\n\n    await waitFor(() => expect(loader).toHaveBeenCalledTimes(initialCalls + 1))\n    await screen.findByTestId('hmr-route-not-found')\n    expect(screen.queryByTestId('hmr-route')).not.toBeInTheDocument()\n  })\n\n  it('keeps rendering a route notFoundComponent when loader returns notFound() after invalidate', async () => {\n    const history = createMemoryHistory({\n      initialEntries: ['/loader-not-found'],\n    })\n    const loader = vi.fn(() => notFound())\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const loaderRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/loader-not-found',\n      loader,\n      component: () => <div data-testid=\"loader-route\">Route</div>,\n      notFoundComponent: () => (\n        <div data-testid=\"loader-not-found-component\">Route Not Found</div>\n      ),\n    })\n\n    const router = createRouter({\n      routeTree: rootRoute.addChildren([loaderRoute]),\n      history,\n    })\n\n    render(() => <RouterProvider router={router} />)\n    await router.load()\n\n    await screen.findByTestId('loader-not-found-component')\n    const initialCalls = loader.mock.calls.length\n    expect(initialCalls).toBeGreaterThan(0)\n\n    await router.invalidate()\n\n    await waitFor(() => expect(loader).toHaveBeenCalledTimes(initialCalls + 1))\n    await screen.findByTestId('loader-not-found-component')\n    expect(screen.queryByTestId('loader-route')).not.toBeInTheDocument()\n  })\n})\n\ndescribe('search params in URL', () => {\n  const testCases = [\n    { route: '/', search: { root: 'world' } },\n    { route: '/', search: { root: 'world', unknown: 'asdf' } },\n    { route: '/search', search: { search: 'foo' } },\n    { route: '/search', search: { root: 'world', search: 'foo' } },\n    {\n      route: '/search',\n      search: { root: 'world', search: 'foo', unknown: 'asdf' },\n    },\n  ]\n  describe.each([undefined, false])(\n    'does not modify the search params in the URL when search.strict=%s',\n    (strict) => {\n      it.each(testCases)(\n        'at $route with search params $search',\n        async ({ route, search }) => {\n          const { router } = createTestRouter({ search: { strict } })\n          window.history.replaceState(\n            null,\n            '',\n            `${route}?${new URLSearchParams(search as Record<string, string>).toString()}`,\n          )\n\n          render(() => <RouterProvider router={router} />)\n          await router.load()\n\n          expect(await screen.findByTestId('search-root')).toHaveTextContent(\n            search.root ?? '$undefined',\n          )\n          if (route === '/search') {\n            expect(\n              await screen.findByTestId('search-search'),\n            ).toHaveTextContent(search.search ?? '$undefined')\n          }\n          validateSearchParams(search, router)\n        },\n      )\n    },\n  )\n\n  describe('removes unknown search params in the URL when search.strict=true', () => {\n    it.each(testCases)('%j', async ({ route, search }) => {\n      const { router } = createTestRouter({ search: { strict: true } })\n      window.history.replaceState(\n        null,\n        '',\n        `${route}?${new URLSearchParams(search as Record<string, string>).toString()}`,\n      )\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n      await expect(await screen.findByTestId('search-root')).toHaveTextContent(\n        search.root ?? 'undefined',\n      )\n      if (route === '/search') {\n        expect(await screen.findByTestId('search-search')).toHaveTextContent(\n          search.search ?? 'undefined',\n        )\n      }\n\n      expect(window.location.pathname).toEqual(route)\n      const { unknown: _, ...expectedSearch } = { ...search }\n      validateSearchParams(expectedSearch, router)\n    })\n  })\n\n  describe.each([false, true, undefined])('default search params', (strict) => {\n    let router: AnyRouter\n    beforeEach(() => {\n      const result = createTestRouter({ search: { strict } })\n      router = result.router\n    })\n\n    async function checkSearch(expectedSearch: {\n      default: string\n      optional?: string\n    }) {\n      expect(await screen.findByTestId('search-default')).toHaveTextContent(\n        expectedSearch.default,\n      )\n      expect(await screen.findByTestId('search-optional')).toHaveTextContent(\n        expectedSearch.optional ?? '$undefined',\n      )\n\n      validateSearchParams(expectedSearch, router)\n    }\n\n    it('should add the default search param upon initial load when no search params are present', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault/check`)\n\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n\n      await checkSearch({ default: 'd1' })\n    })\n\n    it('should have the correct `default` search param upon initial load when the `default` param is present', async () => {\n      window.history.replaceState(\n        null,\n        '',\n        `/searchWithDefault/check?default=d2`,\n      )\n\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n\n      await checkSearch({ default: 'd2' })\n    })\n\n    it('should add the default search param upon initial load when only the optional search param is present', async () => {\n      window.history.replaceState(\n        null,\n        '',\n        `/searchWithDefault/check?optional=o1`,\n      )\n\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n\n      await checkSearch({ default: 'd1', optional: 'o1' })\n    })\n\n    it('should keep the search param upon initial load when both search params are present', async () => {\n      window.history.replaceState(\n        null,\n        '',\n        `/searchWithDefault/check?default=d2&optional=o1`,\n      )\n\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n\n      await checkSearch({ default: 'd2', optional: 'o1' })\n    })\n\n    it('should have the default search param when navigating without search params', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault`)\n\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n      const link = await screen.findByTestId('link-without-params')\n\n      expect(link).toBeInTheDocument()\n      fireEvent.click(link)\n\n      await checkSearch({ default: 'd1' })\n    })\n\n    it('should have the default search param when navigating with the optional search param', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault`)\n\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n      const link = await screen.findByTestId('link-with-optional-param')\n\n      expect(link).toBeInTheDocument()\n      fireEvent.click(link)\n\n      await checkSearch({ default: 'd1', optional: 'o1' })\n    })\n\n    it('should have the correct `default` search param when navigating with the `default` search param', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault`)\n\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n      const link = await screen.findByTestId('link-with-default-param')\n\n      expect(link).toBeInTheDocument()\n      fireEvent.click(link)\n\n      await checkSearch({ default: 'd2' })\n    })\n\n    it('should have the correct search params when navigating with both search params', async () => {\n      window.history.replaceState(null, '', `/searchWithDefault`)\n\n      render(() => <RouterProvider router={router} />)\n      await router.load()\n      const link = await screen.findByTestId('link-with-both-params')\n\n      expect(link).toBeInTheDocument()\n      fireEvent.click(link)\n\n      await checkSearch({ default: 'd2', optional: 'o1' })\n    })\n  })\n\n  describe('validates search params', () => {\n    class TestValidationError extends Error {\n      issues: Array<{ message: string }>\n      constructor(issues: Array<{ message: string }>) {\n        super('validation failed')\n        this.name = 'TestValidationError'\n        this.issues = issues\n      }\n    }\n    const testCases: [\n      StandardSchemaValidator<Record<string, unknown>, { search: string }>,\n      ValidatorFn<Record<string, unknown>, { search: string }>,\n      ValidatorObj<Record<string, unknown>, { search: string }>,\n    ] = [\n      {\n        ['~standard']: {\n          validate: (input) => {\n            const result = z.object({ search: z.string() }).safeParse(input)\n            if (result.success) {\n              return { value: result.data }\n            }\n            return new TestValidationError(result.error.issues)\n          },\n        },\n      },\n      ({ search }) => {\n        if (typeof search !== 'string') {\n          throw new TestValidationError([\n            { message: 'search must be a string' },\n          ])\n        }\n        return { search }\n      },\n      {\n        parse: ({ search }) => {\n          if (typeof search !== 'string') {\n            throw new TestValidationError([\n              { message: 'search must be a string' },\n            ])\n          }\n          return { search }\n        },\n      },\n    ]\n\n    describe.each(testCases)('search param validation', (validateSearch) => {\n      it('does not throw an error when the search param is valid', async () => {\n        let errorSpy: Error | undefined\n        const rootRoute = createRootRoute({\n          validateSearch,\n          errorComponent: ({ error }) => {\n            errorSpy = error\n            return <></>\n          },\n        })\n\n        const history = createMemoryHistory({\n          initialEntries: ['/search?search=foo'],\n        })\n        const router = createRouter({ routeTree: rootRoute, history })\n        render(() => <RouterProvider router={router} />)\n        await router.load()\n\n        expect(errorSpy).toBeUndefined()\n      })\n\n      it('throws an error when the search param is not valid', async () => {\n        let errorSpy: Error | undefined\n        const rootRoute = createRootRoute({\n          validateSearch,\n          errorComponent: ({ error }) => {\n            errorSpy = error\n            return <></>\n          },\n        })\n\n        const history = createMemoryHistory({ initialEntries: ['/search'] })\n        const router = createRouter({ routeTree: rootRoute, history })\n        render(() => <RouterProvider router={router} />)\n        await router.load()\n\n        expect(errorSpy).toBeInstanceOf(SearchParamError)\n        expect(errorSpy?.cause).toBeInstanceOf(TestValidationError)\n      })\n    })\n  })\n})\n\ndescribe('route ids should be consistent after rebuilding the route tree', () => {\n  it('should have the same route ids after rebuilding the route tree', async () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const originalRouteIds = Object.keys(router.routesById)\n\n    await router.navigate({\n      to: '/parent/child',\n    })\n\n    await router.navigate({\n      to: '/filBasedParent/child',\n    })\n\n    router.buildRouteTree()\n\n    const rebuiltRouteIds = Object.keys(router.routesById)\n\n    originalRouteIds.forEach((id) => {\n      expect(rebuiltRouteIds).toContain(id)\n    })\n\n    rebuiltRouteIds.forEach((id) => {\n      expect(originalRouteIds).toContain(id)\n    })\n  })\n})\n\ndescribe('route id uniqueness', () => {\n  it('routesById should not have routes duplicated route ids', () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const routeIdSet = new Set<string>()\n\n    Object.values(router.routesById).forEach((route) => {\n      expect(routeIdSet.has(route.id)).toBe(false)\n      routeIdSet.add(route.id)\n    })\n  })\n\n  it('routesByPath should not have routes duplicated route ids', () => {\n    const { router } = createTestRouter({\n      history: createMemoryHistory({ initialEntries: ['/'] }),\n    })\n\n    const routeIdSet = new Set<string>()\n\n    Object.values(router.routesByPath).forEach((route) => {\n      expect(routeIdSet.has(route.id)).toBe(false)\n      routeIdSet.add(route.id)\n    })\n  })\n})\n\nconst createHistoryRouter = () => {\n  const rootRoute = createRootRoute()\n\n  const IndexComponent = () => {\n    const navigate = useNavigate()\n\n    return (\n      <>\n        <h1>Index</h1>\n        <button onClick={() => navigate({ to: '/' })}>Index</button>\n        <button onClick={() => navigate({ to: '/posts' })}>Posts</button>\n        <button onClick={() => navigate({ to: '/posts', replace: true })}>\n          Replace\n        </button>\n      </>\n    )\n  }\n\n  const indexRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/',\n    component: IndexComponent,\n  })\n\n  const postsRoute = createRoute({\n    getParentRoute: () => rootRoute,\n    path: '/posts',\n    component: function Component() {\n      const navigate = useNavigate()\n\n      return (\n        <>\n          <h1>Posts</h1>\n          <button onClick={() => navigate({ to: '/' })}>Index</button>\n        </>\n      )\n    },\n  })\n\n  const router = createRouter({\n    routeTree: rootRoute.addChildren([indexRoute, postsRoute]),\n  })\n\n  return { router }\n}\n\ndescribe('history: History gives correct notifcations and state', () => {\n  it('should work with push and back', async () => {\n    const { router: router } = createHistoryRouter()\n\n    type Router = typeof router\n\n    const results: Array<\n      Parameters<Parameters<Router['history']['subscribe']>[0]>[0]['action']\n    > = []\n\n    render(() => <RouterProvider router={router} />)\n\n    const unsub = router.history.subscribe(({ action }) => {\n      results.push(action)\n    })\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    router.history.back()\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    expect(results).toEqual([{ type: 'PUSH' }, { type: 'BACK' }])\n\n    unsub()\n  })\n\n  it('should work more complex scenario', async () => {\n    const { router: router } = createHistoryRouter()\n\n    type Router = typeof router\n\n    const results: Array<\n      Parameters<Parameters<Router['history']['subscribe']>[0]>[0]['action']\n    > = []\n\n    render(() => <RouterProvider router={router} />)\n\n    const unsub = router.history.subscribe(({ action }) => {\n      results.push(action)\n    })\n\n    const replaceButton = await screen.findByRole('button', { name: 'Replace' })\n\n    fireEvent.click(replaceButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    const indexButton = await screen.findByRole('button', { name: 'Index' })\n\n    fireEvent.click(indexButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    const postsButton = await screen.findByRole('button', { name: 'Posts' })\n\n    fireEvent.click(postsButton)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    router.history.back()\n\n    expect(\n      await screen.findByRole('heading', { name: 'Index' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/')\n\n    router.history.go(1)\n\n    expect(\n      await screen.findByRole('heading', { name: 'Posts' }),\n    ).toBeInTheDocument()\n\n    expect(window.location.pathname).toBe('/posts')\n\n    expect(results).toEqual([\n      { type: 'REPLACE' },\n      { type: 'PUSH' },\n      { type: 'PUSH' },\n      { type: 'BACK' },\n      { type: 'GO', index: 1 },\n    ])\n\n    unsub()\n  })\n})\n\nit('does not push to history if url and state are the same', async () => {\n  const history = createMemoryHistory({ initialEntries: ['/linksToItself'] })\n  const { router } = createTestRouter({\n    history,\n  })\n  render(() => <RouterProvider router={router} />)\n  const link = await screen.findByTestId('link')\n  fireEvent.click(link)\n  expect(history.length).toBe(1)\n})\n\ndescribe('does not strip search params if search validation fails', () => {\n  afterEach(() => {\n    window.history.replaceState(null, 'root', '/')\n    cleanup()\n  })\n\n  function getRouter() {\n    const rootRoute = createRootRoute({\n      validateSearch: z.object({ root: z.string() }),\n      component: () => {\n        const search = rootRoute.useSearch()\n        return (\n          <div>\n            <div data-testid=\"search-root\">{search().root ?? '$undefined'}</div>\n            <Outlet />\n          </div>\n        )\n      },\n    })\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      validateSearch: z.object({ index: z.string() }),\n      component: () => {\n        const search = rootRoute.useSearch()\n        return (\n          <>\n            <div data-testid=\"search-index\">\n              {search().index ?? '$undefined'}\n            </div>\n            <Outlet />\n          </>\n        )\n      },\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute])\n\n    const router = createRouter({ routeTree })\n\n    return router\n  }\n\n  it('smoke test - all required search params are present', async () => {\n    window.history.replaceState(null, 'root', '/?root=hello&index=world')\n    const router = getRouter()\n    render(() => <RouterProvider router={router} />)\n\n    expect(await screen.findByTestId('search-root')).toHaveTextContent('hello')\n    expect(await screen.findByTestId('search-index')).toHaveTextContent('world')\n\n    expect(window.location.search).toBe('?root=hello&index=world')\n  })\n\n  it('root is missing', () => {\n    window.history.replaceState(null, 'root', '/?index=world')\n    const router = getRouter()\n    render(() => <RouterProvider router={router} />)\n\n    expect(window.location.search).toBe('?index=world')\n  })\n\n  it('index is missing', () => {\n    window.history.replaceState(null, 'root', '/?root=hello')\n    const router = getRouter()\n\n    render(() => <RouterProvider router={router} />)\n\n    expect(window.location.search).toBe('?root=hello')\n  })\n})\n\ndescribe('statusCode reset on navigation', () => {\n  it('should reset statusCode to 200 when navigating from 404 to valid route', async () => {\n    const history = createMemoryHistory({ initialEntries: ['/'] })\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div>Home</div>,\n    })\n\n    const validRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/valid',\n      component: () => <div>Valid Route</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, validRoute])\n    const router = createRouter({ routeTree, history })\n\n    render(() => <RouterProvider router={router} />)\n\n    expect(router.state.statusCode).toBe(200)\n\n    await router.navigate({ to: '/' })\n    await waitFor(() => expect(router.state.statusCode).toBe(200))\n\n    await router.navigate({ to: '/non-existing' })\n    await waitFor(() => expect(router.state.statusCode).toBe(404))\n\n    await router.navigate({ to: '/valid' })\n    await waitFor(() => expect(router.state.statusCode).toBe(200))\n\n    await router.navigate({ to: '/another-non-existing' })\n    await waitFor(() => expect(router.state.statusCode).toBe(404))\n  })\n\n  describe.each([true, false])(\n    'status code is set when loader/beforeLoad throws (isAsync=%s)',\n    (isAsync) => {\n      const throwingFun = isAsync\n        ? (toThrow: () => void) => async () => {\n            await new Promise((resolve) => setTimeout(resolve, 10))\n            toThrow()\n          }\n        : (toThrow: () => void) => toThrow\n\n      const throwNotFound = throwingFun(() => {\n        throw notFound()\n      })\n      const throwError = throwingFun(() => {\n        throw new Error('test-error')\n      })\n      it('should set statusCode to 404 when a route loader throws a notFound()', async () => {\n        const history = createMemoryHistory({ initialEntries: ['/'] })\n\n        const rootRoute = createRootRoute()\n\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => <div>Home</div>,\n        })\n\n        const loaderThrowsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/loader-throws-not-found',\n          loader: throwNotFound,\n          component: () => (\n            <div data-testid=\"route-component\">loader will throw</div>\n          ),\n          notFoundComponent: () => (\n            <div data-testid=\"not-found-component\">Not Found</div>\n          ),\n        })\n\n        const routeTree = rootRoute.addChildren([indexRoute, loaderThrowsRoute])\n        const router = createRouter({ routeTree, history })\n\n        render(() => <RouterProvider router={router} />)\n\n        expect(router.state.statusCode).toBe(200)\n\n        await router.navigate({ to: '/loader-throws-not-found' })\n        await waitFor(() => expect(router.state.statusCode).toBe(404))\n        expect(\n          await screen.findByTestId('not-found-component'),\n        ).toBeInTheDocument()\n        expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()\n      })\n\n      it('should set statusCode to 404 when a route beforeLoad throws a notFound()', async () => {\n        const history = createMemoryHistory({ initialEntries: ['/'] })\n\n        const rootRoute = createRootRoute({\n          notFoundComponent: () => (\n            <div data-testid=\"not-found-component\">Not Found</div>\n          ),\n        })\n\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => <div>Home</div>,\n        })\n\n        const beforeLoadThrowsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/beforeload-throws-not-found',\n          beforeLoad: throwNotFound,\n          component: () => (\n            <div data-testid=\"route-component\">beforeLoad will throw</div>\n          ),\n          notFoundComponent: () => (\n            <div data-testid=\"not-found-component\">Not Found</div>\n          ),\n        })\n\n        const routeTree = rootRoute.addChildren([\n          indexRoute,\n          beforeLoadThrowsRoute,\n        ])\n        const router = createRouter({ routeTree, history })\n\n        render(() => <RouterProvider router={router} />)\n\n        expect(router.state.statusCode).toBe(200)\n\n        await router.navigate({ to: '/beforeload-throws-not-found' })\n        await waitFor(() => expect(router.state.statusCode).toBe(404))\n        expect(\n          await screen.findByTestId('not-found-component'),\n        ).toBeInTheDocument()\n        expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()\n      })\n\n      it('should set statusCode to 500 when a route loader throws an Error', async () => {\n        const history = createMemoryHistory({ initialEntries: ['/'] })\n\n        const rootRoute = createRootRoute()\n\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => <div>Home</div>,\n        })\n\n        const loaderThrowsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/loader-throws-error',\n          loader: throwError,\n          component: () => (\n            <div data-testid=\"route-component\">loader will throw</div>\n          ),\n          errorComponent: () => <div data-testid=\"error-component\">Error</div>,\n        })\n\n        const routeTree = rootRoute.addChildren([indexRoute, loaderThrowsRoute])\n        const router = createRouter({ routeTree, history })\n\n        render(() => <RouterProvider router={router} />)\n\n        expect(router.state.statusCode).toBe(200)\n\n        await router.navigate({ to: '/loader-throws-error' })\n        await waitFor(() => expect(router.state.statusCode).toBe(500))\n        expect(await screen.findByTestId('error-component')).toBeInTheDocument()\n        expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()\n      })\n\n      it('should set statusCode to 500 when a route beforeLoad throws an Error', async () => {\n        const history = createMemoryHistory({ initialEntries: ['/'] })\n\n        const rootRoute = createRootRoute()\n\n        const indexRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/',\n          component: () => <div>Home</div>,\n        })\n\n        const beforeLoadThrowsRoute = createRoute({\n          getParentRoute: () => rootRoute,\n          path: '/beforeload-throws-error',\n          beforeLoad: throwError,\n          component: () => (\n            <div data-testid=\"route-component\">beforeLoad will throw</div>\n          ),\n          errorComponent: () => <div data-testid=\"error-component\">Error</div>,\n        })\n\n        const routeTree = rootRoute.addChildren([\n          indexRoute,\n          beforeLoadThrowsRoute,\n        ])\n        const router = createRouter({ routeTree, history })\n\n        render(() => <RouterProvider router={router} />)\n\n        expect(router.state.statusCode).toBe(200)\n\n        await router.navigate({ to: '/beforeload-throws-error' })\n        await waitFor(() => expect(router.state.statusCode).toBe(500))\n        expect(await screen.findByTestId('error-component')).toBeInTheDocument()\n        expect(screen.queryByTestId('route-component')).not.toBeInTheDocument()\n      })\n    },\n  )\n})\n\ndescribe('basepath', () => {\n  it('should handle basic basepath rewriting with input', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const homeRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div data-testid=\"home\">Home</div>,\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <div data-testid=\"about\">About</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([homeRoute, aboutRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/my-app/about'],\n      }),\n      basepath: 'my-app',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('about')).toBeInTheDocument()\n    })\n\n    // Router should interpret the URL without the basepath\n    expect(router.state.location.pathname).toBe('/about')\n  })\n\n  it.each([\n    {\n      description: 'basepath with leading and trailing slashes',\n      basepath: '/api/v1/',\n    },\n    {\n      description: 'basepath with leading slash but without trailing slash',\n      basepath: '/api/v1',\n    },\n    {\n      description: 'basepath without leading slash but with trailing slash',\n      basepath: 'api/v1/',\n    },\n    {\n      description: 'basepath without leading and trailing slashes',\n      basepath: 'api/v1',\n    },\n  ])('should handle $description', async ({ basepath }) => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const usersRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/users',\n      component: () => <div data-testid=\"users\">Users</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([usersRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/api/v1/users'],\n      }),\n      basepath,\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('users')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/users')\n  })\n\n  it.each([\n    { description: 'has trailing slash', basepath: '/my-app/' },\n    { description: 'has no trailing slash', basepath: '/my-app' },\n  ])(\n    'should not resolve to 404 when basepath $description and URL matches',\n    async ({ basepath }) => {\n      const rootRoute = createRootRoute({\n        component: () => <Outlet />,\n      })\n\n      const homeRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => <div data-testid=\"home\">Home</div>,\n      })\n\n      const usersRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/users',\n        component: () => <div data-testid=\"users\">Users</div>,\n      })\n\n      const routeTree = rootRoute.addChildren([homeRoute, usersRoute])\n\n      const router = createRouter({\n        routeTree,\n        history: createMemoryHistory({\n          initialEntries: ['/my-app/'],\n        }),\n        basepath,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      await waitFor(() => {\n        expect(screen.getByTestId('home')).toBeInTheDocument()\n      })\n\n      expect(router.state.location.pathname).toBe('/')\n      expect(router.state.statusCode).toBe(200)\n    },\n  )\n\n  it.each([\n    { description: 'with trailing slash', basepath: '/my-app/' },\n    { description: 'without trailing slash', basepath: '/my-app' },\n  ])(\n    'should handle basepath $description when navigating to root path',\n    async ({ basepath }) => {\n      const rootRoute = createRootRoute({\n        component: () => <Outlet />,\n      })\n\n      const homeRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/',\n        component: () => (\n          <div>\n            <Link to=\"/about\" data-testid=\"about-link\">\n              About\n            </Link>\n          </div>\n        ),\n      })\n\n      const aboutRoute = createRoute({\n        getParentRoute: () => rootRoute,\n        path: '/about',\n        component: () => <div data-testid=\"about\">About</div>,\n      })\n\n      const routeTree = rootRoute.addChildren([homeRoute, aboutRoute])\n\n      const history = createMemoryHistory({ initialEntries: ['/my-app/'] })\n\n      const router = createRouter({\n        routeTree,\n        history,\n        basepath,\n      })\n\n      render(() => <RouterProvider router={router} />)\n\n      const aboutLink = await screen.findByTestId('about-link')\n      fireEvent.click(aboutLink)\n\n      await waitFor(() => {\n        expect(screen.getByTestId('about')).toBeInTheDocument()\n      })\n\n      expect(router.state.location.pathname).toBe('/about')\n      expect(history.location.pathname).toBe('/my-app/about')\n    },\n  )\n\n  it('should handle empty basepath gracefully', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const testRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/test',\n      component: () => <div data-testid=\"test\">Test</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([testRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/test'],\n      }),\n      basepath: '',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    expect(await screen.findByTestId('test')).toBeInTheDocument()\n\n    expect(router.state.location.pathname).toBe('/test')\n  })\n\n  it('should combine basepath with additional input rewrite logic', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const newApiRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/api/v2',\n      component: () => <div data-testid=\"api-v2\">API v2</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([newApiRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/my-app/legacy/api/v1'],\n      }),\n      basepath: 'my-app',\n      rewrite: {\n        input: ({ url }) => {\n          if (url.pathname === '/legacy/api/v1') {\n            url.pathname = '/api/v2'\n            return url\n          }\n          return undefined\n        },\n      },\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    expect(await screen.findByTestId('api-v2')).toBeInTheDocument()\n\n    // Should first remove basepath (/my-app/legacy/api/v1 -> /legacy/api/v1)\n    // Then apply additional rewrite (/legacy/api/v1 -> /api/v2)\n    expect(router.state.location.pathname).toBe('/api/v2')\n  })\n\n  it('should preserve search params and hash when rewriting basepath', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const searchRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/search',\n      component: () => <div data-testid=\"search\">Search</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([searchRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/app/search?q=test&filter=all#results'],\n      }),\n      basepath: 'app',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('search')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/search')\n    expect(router.state.location.search).toEqual({\n      q: 'test',\n      filter: 'all',\n    })\n    expect(router.state.location.hash).toBe('results')\n  })\n\n  it('should handle nested basepath with multiple rewrite layers', async () => {\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const finalRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/final',\n      component: () => <div data-testid=\"final\">Final</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([finalRoute])\n\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/base/legacy/old/path'],\n      }),\n      basepath: 'base',\n      rewrite: composeRewrites([\n        {\n          input: ({ url }) => {\n            // First layer: convert legacy paths\n            if (url.pathname === '/legacy/old/path') {\n              url.pathname = '/new/path'\n              return url\n            }\n            return undefined\n          },\n          output: ({ url }) => {\n            // First layer: convert legacy paths\n            if (url.pathname === '/new/path') {\n              url.pathname = '/legacy/old/path'\n              return url\n            }\n            return undefined\n          },\n        },\n      ]),\n    })\n\n    // Add a second rewrite layer\n    const originalRewrite = router.options.rewrite\n    router.update({\n      rewrite: composeRewrites([\n        originalRewrite!,\n        {\n          input: ({ url }) => {\n            if (url.pathname === '/new/path') {\n              url.pathname = '/final'\n            }\n            return url\n          },\n          output: ({ url }) => {\n            if (url.pathname === '/final') {\n              url.pathname = '/new/path'\n            }\n            return url\n          },\n        },\n      ]),\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    expect(router.state.location.pathname).toBe('/final')\n    expect(await screen.findByTestId('final')).toBeInTheDocument()\n\n    // Should apply: /base/legacy/old/path -> /legacy/old/path -> /new/path -> /final\n  })\n\n  it('should handle basepath with output rewriting', async () => {\n    // This test verifies that basepath is added back when navigating\n\n    const rootRoute = createRootRoute({\n      component: () => <Outlet />,\n    })\n\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => (\n        <div>\n          <Link to=\"/about\" data-testid=\"about-link\">\n            About\n          </Link>\n        </div>\n      ),\n    })\n\n    const aboutRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/about',\n      component: () => <div data-testid=\"about\">About</div>,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute, aboutRoute])\n\n    const history = createMemoryHistory({ initialEntries: ['/my-app/'] })\n\n    const router = createRouter({\n      routeTree,\n      history,\n      basepath: 'my-app',\n    })\n\n    render(() => <RouterProvider router={router} />)\n\n    const aboutLink = await screen.findByTestId('about-link')\n\n    fireEvent.click(aboutLink)\n\n    await waitFor(() => {\n      expect(screen.getByTestId('about')).toBeInTheDocument()\n    })\n\n    expect(router.state.location.pathname).toBe('/about')\n    expect(history.location.pathname).toBe('/my-app/about')\n  })\n})\n"
  },
  {
    "path": "packages/solid-router/tests/server/Transitioner.test.tsx",
    "content": "import { describe, expect, it, vi } from 'vitest'\nimport { renderToStringAsync } from 'solid-js/web'\nimport {\n  createMemoryHistory,\n  createRootRoute,\n  createRoute,\n  createRouter,\n} from '../../src'\nimport { RouterProvider } from '../../src/RouterProvider'\n\ndescribe('Transitioner (server)', () => {\n  it('should call router.load() only once when on the server', async () => {\n    const loader = vi.fn()\n    const rootRoute = createRootRoute()\n    const indexRoute = createRoute({\n      getParentRoute: () => rootRoute,\n      path: '/',\n      component: () => <div>Index</div>,\n      loader,\n    })\n\n    const routeTree = rootRoute.addChildren([indexRoute])\n    const router = createRouter({\n      routeTree,\n      history: createMemoryHistory({\n        initialEntries: ['/'],\n      }),\n      isServer: true,\n    })\n\n    // Mock router.load() to verify it gets called\n    const loadSpy = vi.spyOn(router, 'load')\n\n    await router.load()\n\n    await renderToStringAsync(() => <RouterProvider router={router} />)\n\n    expect(loadSpy).toHaveBeenCalledTimes(1)\n    expect(loader).toHaveBeenCalledTimes(1)\n\n    loadSpy.mockRestore()\n  })\n})\n"
  }
]